prettier
Version:
Prettier is an opinionated code formatter
59 lines (56 loc) • 143 kB
JavaScript
var Oo=Object.defineProperty;var Qt=(t,e)=>{for(var n in e)Oo(t,n,{get:e[n],enumerable:!0})};var To={};Qt(To,{__parsePrettierYamlConfig:()=>fl,languages:()=>vr,options:()=>Dr,parsers:()=>Xs,printers:()=>cl});var Ht=(t,e)=>(n,s,...r)=>n|1&&s==null?void 0:(e.call(s)??s[t]).apply(s,r);function _o(t){return this[t<0?this.length+t:t]}var Io=Ht("at",function(){if(Array.isArray(this)||typeof this=="string")return _o}),V=Io;var Lo=String.prototype.replaceAll??function(t,e){return t.global?this.replace(t,e):this.split(t).join(e)},Po=Ht("replaceAll",function(){if(typeof this=="string")return Lo}),Jt=Po;var vo=()=>{},dt=vo;var gt="string",yt="array",Wt="cursor",Xt="indent",Ue="align",zt="trim",je="group",Ve="fill",Ge="if-break",Zt="indent-if-break",Qe="line-suffix",en="line-suffix-boundary",ke="line",tn="label",He="break-parent",nn=new Set([Wt,Xt,Ue,zt,je,Ve,Ge,Zt,Qe,en,ke,tn,He]);function sn(t,e,n){if(!t.has(e)){let s=n(e);t.set(e,s)}return t.get(e)}function Do(t){if(typeof t=="string")return gt;if(Array.isArray(t))return yt;if(!t)return;let{type:e}=t;if(nn.has(e))return e}var rn=Do;var xo=t=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function Mo(t){let e=t===null?"null":typeof t;if(e!=="string"&&e!=="object")return`Unexpected doc '${e}',
Expected it to be 'string' or 'object'.`;if(rn(t))throw new Error("doc is valid.");let n=Object.prototype.toString.call(t);if(n!=="[object Object]")return`Unexpected doc '${n}'.`;let s=xo([...nn].map(r=>`'${r}'`));return`Unexpected doc.type '${t.type}'.
Expected it to be ${s}.`}var os=class extends Error{name="InvalidDocError";constructor(e){super(Mo(e)),this.doc=e}},Zs=os;function $o(t,e){if(typeof t=="string")return e(t);let n=new Map;return s(t);function s(i){return sn(n,i,r)}function r(i){switch(rn(i)){case yt:return e(i.map(s));case Ve:return e({...i,parts:i.parts.map(s)});case Ge:return e({...i,breakContents:s(i.breakContents),flatContents:s(i.flatContents)});case je:{let{expandedStates:o,contents:a}=i;return o?(o=o.map(s),a=o[0]):a=s(a),e({...i,contents:a,expandedStates:o})}case Ue:case Xt:case Zt:case tn:case Qe:return e({...i,contents:s(i.contents)});case gt:case Wt:case zt:case en:case ke:case He:return e(i);default:throw new Zs(i)}}}function er(t,e=wt){return $o(t,n=>typeof n=="string"?R(e,n.split(`
`)):n)}var re=dt,on=dt,tr=dt,nr=dt;function bt(t,e){return nr(t),re(e),{type:Ue,contents:e,n:t}}function as(t){return bt(Number.NEGATIVE_INFINITY,t)}function sr(t){return bt({type:"root"},t)}function rr(t){return bt(-1,t)}var kt={type:He};function an(t){return tr(t),{type:Ve,parts:t}}function Je(t,e={}){return re(t),on(e.expandedStates,!0),{type:je,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function ls(t,e){return Je(t[0],{...e,expandedStates:t})}function St(t,e="",n={}){return re(t),e!==""&&re(e),{type:Ge,breakContents:t,flatContents:e,groupId:n.groupId}}function R(t,e){re(t),on(e);let n=[];for(let s=0;s<e.length;s++)s!==0&&n.push(t),n.push(e[s]);return n}var Se={type:ke},ln={type:ke,soft:!0},Bo={type:ke,hard:!0},O=[Bo,kt],Ro={type:ke,hard:!0,literal:!0},wt=[Ro,kt];function ir(t){return re(t),{type:Qe,contents:t}}function cn(t){return(e,n,s)=>{if(n===!1)return!1;let r=!!s?.backwards,{length:i}=e,o=n;for(;o>=0&&o<i;){let a=e.charAt(o);if(t instanceof RegExp){if(!t.test(a))return o}else if(!t.includes(a))return o;r?o--:o++}return o===-1||o===i?o:!1}}var bc=cn(/\s/),cs=cn(" "),kc=cn(",; "),Sc=cn(/[^\n\r]/);var or=t=>t===`
`||t==="\r"||t==="\u2028"||t==="\u2029";function qo(t,e,n){if(e===!1)return!1;let s=!!n?.backwards,r=t.charAt(e);if(s){if(t.charAt(e-1)==="\r"&&r===`
`)return e-2;if(or(r))return e-1}else{if(r==="\r"&&t.charAt(e+1)===`
`)return e+2;if(or(r))return e+1}return e}var fs=qo;function Fo(t,e){let n=e-1;n=cs(t,n,{backwards:!0}),n=fs(t,n,{backwards:!0}),n=cs(t,n,{backwards:!0});let s=fs(t,n,{backwards:!0});return n!==s}var us=Fo;var ps=class extends Error{name="UnexpectedNodeError";constructor(e,n,s="type"){super(`Unexpected ${n} node ${s}: ${JSON.stringify(e[s])}.`),this.node=e}},ar=ps;function lr(t,e){let{node:n}=t;if(n.type==="root"&&e.filepath&&/(?:[/\\]|^)\.(?:prettier|stylelint|lintstaged)rc$/.test(e.filepath))return async s=>{let r=await s(e.originalText,{parser:"json"});return r?[r,O]:void 0}}lr.getVisitorKeys=()=>[];var cr=lr;var Et=null;function Ct(t){if(Et!==null&&typeof Et.property){let e=Et;return Et=Ct.prototype=null,e}return Et=Ct.prototype=t??Object.create(null),new Ct}var Ko=10;for(let t=0;t<=Ko;t++)Ct();function ms(t){return Ct(t)}function Yo(t,e="type"){ms(t);function n(s){let r=s[e],i=t[r];if(!Array.isArray(i))throw Object.assign(new Error(`Missing visitor keys for '${r}'.`),{node:s});return i}return n}var fr=Yo;var P=[["children","anchor","tag","indicatorComment","leadingComments","middleComments","trailingComment","endComments"],["anchor","tag","indicatorComment","leadingComments","middleComments","trailingComment","endComments"],["key","value","children","anchor","tag","indicatorComment","leadingComments","middleComments","trailingComment","endComments"],["content","children","anchor","tag","indicatorComment","leadingComments","middleComments","trailingComment","endComments"],["indicatorComment","leadingComments","middleComments","trailingComment","endComments"]],ur={root:P[0],document:["head","body","children","anchor","tag","indicatorComment","leadingComments","middleComments","trailingComment","endComments"],documentHead:P[0],documentBody:P[0],directive:P[1],alias:P[1],blockLiteral:P[1],blockFolded:P[0],plain:P[0],quoteSingle:P[1],quoteDouble:P[1],mapping:P[0],mappingItem:P[2],mappingKey:P[3],mappingValue:P[3],sequence:P[0],sequenceItem:P[3],flowMapping:P[0],flowMappingItem:P[2],flowSequence:P[0],flowSequenceItem:P[3],comment:P[1],tag:P[4],anchor:P[4]};var Uo=fr(ur),pr=Uo;var Nt=t=>t.position.start.offset,mr=t=>t.position.end.offset;var hr="format";var dr=/^\s*#[^\S\n]*@(?:noformat|noprettier)\s*?(?:\n|$)/,gr=/^\s*#[^\S\n]*@(?:format|prettier)\s*?(?:\n|$)/,yr=/^\s*@(?:format|prettier)\s*$/;var wr=t=>yr.test(t),br=t=>gr.test(t),kr=t=>dr.test(t),Sr=t=>`# @${hr}
${t}`;function hs(t,e){switch(t.type){case"comment":if(wr(t.value))return null;break;case"quoteDouble":case"quoteSingle":e.type="quote";break;case"document":e.directivesEndMarker||delete e.directivesEndMarker,e.documentEndMarker||delete e.documentEndMarker;break;case"blockLiteral":case"blockFolded":t.chomping==="keep"?e.value=t.value.split(`
`).map(n=>n.replace(/[ \t]+$/,"")).join(`
`):(t.chomping==="clip"||t.chomping==="strip")&&(e.value=t.value.trimEnd());break}}hs.ignoredProperties=new Set(["position"]);function jo(t){return Array.isArray(t)&&t.length>0}var We=jo;function X(t,e){return typeof t?.type=="string"&&e.includes(t.type)}function ds(t,e,n){return e("children"in t?{...t,children:t.children.map(s=>ds(s,e,t))}:t,n)}function Xe(t,e,n){Object.defineProperty(t,e,{get:n,enumerable:!1})}function Cr(t,e){let n=0,s=e.length;for(let r=t.position.end.offset-1;r<s;r++){let i=e[r];if(i===`
`&&n++,n===1&&/\S/.test(i))return!1;if(n===2)return!0}return!1}function fn(t){let{node:e}=t;switch(e.type){case"tag":case"anchor":case"comment":return!1}let n=t.stack.length;for(let s=1;s<n;s++){let r=t.stack[s],i=t.stack[s-1];if(Array.isArray(i)&&typeof r=="number"&&r!==i.length-1)return!1}return!0}function un(t){return We(t.children)?un(V(0,t.children,-1)):t}function Er(t){return t.value.trim()==="prettier-ignore"}function Nr(t){let{node:e}=t;if(e.type==="documentBody"){let n=t.parent.head;return K(n)&&Er(V(0,n.endComments,-1))}return pe(e)&&Er(V(0,e.leadingComments,-1))}function ze(t){return!We(t.children)&&!Vo(t)}function Vo(t){return pe(t)||Pe(t)||gs(t)||z(t)||K(t)}function pe(t){return We(t?.leadingComments)}function Pe(t){return We(t?.middleComments)}function gs(t){return t?.indicatorComment}function z(t){return t?.trailingComment}function K(t){return We(t?.endComments)}function Ar(t){return t?t.split(/(?<!^| ) (?! |$)/):[]}function Tr(t,e,n){let s=e.split(`
`).map((i,o,a)=>o===0&&o===a.length-1?i:o!==0&&o!==a.length-1?i.trim():o===0?i.trimEnd():i.trimStart());if(n.proseWrap==="preserve")return s.map(i=>i?[i]:[]);let r=[];for(let[i,o]of s.entries()){let a=Ar(o);i>0&&s[i-1].length>0&&a.length>0&&!(t==="quoteDouble"&&V(0,V(0,r,-1),-1).endsWith("\\"))?r[r.length-1]=[...V(0,r,-1),...a]:r.push(a)}return n.proseWrap==="never"?r.map(i=>[i.join(" ")]):r}function Or(t,{parentIndent:e,isLastDescendant:n,options:s}){let r=t.position.start.line===t.position.end.line?"":s.originalText.slice(t.position.start.offset,t.position.end.offset).match(/^[^\n]*\n(.*)$/s)[1];if(r==="")return[];let i;if(t.indent===null){let c=r.match(/^(?<leadingSpace> *)[^\n\r ]/m);i=c?c.groups.leadingSpace.length:Number.POSITIVE_INFINITY}else i=t.indent-1+e;let o=r.split(`
`).map(c=>c.slice(i));if(s.proseWrap==="preserve"||t.type==="blockLiteral")return l(o.map(c=>c?[c]:[]));let a=[];for(let[c,u]of o.entries()){let f=Ar(u);c>0&&f.length>0&&o[c-1].length>0&&!/^\s/.test(f[0])&&!/^\s|\s$/.test(V(0,a,-1))?a[a.length-1]=[...V(0,a,-1),...f]:a.push(f)}return a=a.map(c=>{let u=[];for(let f of c)u.length>0&&/\s$/.test(V(0,u,-1))?u[u.length-1]+=" "+f:u.push(f);return u}),s.proseWrap==="never"&&(a=a.map(c=>[c.join(" ")])),l(a);function l(c){if(t.chomping==="keep")return r.endsWith(`
`)&&V(0,c,-1).length===0?c.slice(0,-1):c;let u=0;for(let f=c.length-1;f>=0&&c[f].every(p=>p.replace(/[ \t]+$/,"")==="");f--)u++;return u===0?c:u>=2&&!n?c.slice(0,-(u-1)):c.slice(0,-u)}}function At(t){if(!t)return!0;switch(t.type){case"plain":case"quoteDouble":case"quoteSingle":case"alias":case"flowMapping":case"flowSequence":return!0;default:return!1}}var Go=new WeakMap;function pn(t,e){let{node:n,root:s}=t,r=sn(Go,s,()=>new Set);return!r.has(n.position.end.offset)&&(r.add(n.position.end.offset),Cr(n,e)&&!ys(t.parent))?ln:""}function ys(t){return K(t)&&!X(t,["documentHead","documentBody","flowMapping","flowSequence"])}function Y(t,e){return bt(" ".repeat(t),e)}function Qo(t,e,n){let{node:s}=t,r=t.ancestors.filter(c=>c.type==="sequence"||c.type==="mapping").length,i=fn(t),o=[s.type==="blockFolded"?">":"|"];s.indent!==null&&o.push(s.indent.toString()),s.chomping!=="clip"&&o.push(s.chomping==="keep"?"+":"-"),gs(s)&&o.push(" ",n("indicatorComment"));let a=Or(s,{parentIndent:r,isLastDescendant:i,options:e}),l=[];for(let[c,u]of a.entries())c===0&&l.push(O),l.push(an(R(Se,u))),c!==a.length-1?l.push(u.length===0?O:sr(wt)):s.chomping==="keep"&&i&&l.push(as(u.length===0?O:wt));return s.indent===null?o.push(rr(Y(e.tabWidth,l))):o.push(as(Y(s.indent-1+r,l))),o}var _r=Qo;function mn(t,e,n){let{node:s}=t,r=s.type==="flowMapping",i=r?"{":"[",o=r?"}":"]",a=ln;r&&s.children.length>0&&e.bracketSpacing&&(a=Se);let l=V(0,s.children,-1),c=l?.type==="flowMappingItem"&&ze(l.key)&&ze(l.value);return[i,Y(e.tabWidth,[a,Ho(t,e,n),e.trailingComma==="none"?"":St(","),K(s)?[O,R(O,t.map(n,"endComments"))]:""]),c?"":a,o]}function Ho(t,e,n){return t.map(({isLast:s,node:r,next:i})=>[n(),s?"":[",",Se,r.position.start.line!==i.position.start.line?pn(t,e.originalText):""]],"children")}function Jo(t,e,n){let{node:s,parent:r}=t,{key:i,value:o}=s,a=ze(i),l=ze(o);if(a&&l)return": ";let c=n("key"),u=Wo(s)?" ":"";if(l)return s.type==="flowMappingItem"&&r.type==="flowMapping"?c:s.type==="mappingItem"&&hn(i.content,e)&&!z(i.content)&&r.tag?.value!=="tag:yaml.org,2002:set"?[c,u,":"]:["? ",Y(2,c)];let f=n("value");if(a)return[": ",Y(2,f)];if(pe(o)||!At(i.content))return["? ",Y(2,c),O,...t.map(()=>[n(),O],"value","leadingComments"),": ",Y(2,f)];if(Xo(i.content)&&!pe(i.content)&&!Pe(i.content)&&!z(i.content)&&!K(i)&&!pe(o.content)&&!Pe(o.content)&&!K(o)&&hn(o.content,e)&&hn(i.content,e))return[c,u,": ",f];let p=Symbol("mappingKey"),h=Je([St("? "),Je(Y(2,c),{id:p})]),g=[O,": ",Y(2,f)],m=[u,":"];K(o)&&o.content&&X(o.content,["flowMapping","flowSequence"])&&o.content.children.length===0?m.push(" "):pe(o.content)||K(o)&&o.content&&!X(o.content,["mapping","sequence"])||r.type==="mapping"&&z(i.content)&&At(o.content)||X(o.content,["mapping","sequence"])&&o.content.tag===null&&o.content.anchor===null?m.push(O):o.content?m.push(Se):z(o)&&m.push(" "),m.push(f);let d=Y(e.tabWidth,m);return hn(i.content,e)&&!pe(i.content)&&!Pe(i.content)&&!z(i.content)&&!K(i)?ls([[c,d]]):ls([[h,St(g,d,{groupId:p})]])}function hn(t,e){if(!t)return!0;switch(t.type){case"plain":case"quoteSingle":case"quoteDouble":break;case"alias":return!0;default:return!1}if(e.proseWrap==="preserve")return t.position.start.line===t.position.end.line;if(/\\$/m.test(e.originalText.slice(t.position.start.offset,t.position.end.offset)))return!1;switch(e.proseWrap){case"never":return!t.value.includes(`
`);case"always":return!/[\n ]/.test(t.value);default:return!1}}function Wo(t){return t.key.content?.type==="alias"}function Xo(t){if(!t)return!0;switch(t.type){case"plain":case"quoteDouble":case"quoteSingle":return t.position.start.line===t.position.end.line;case"alias":return!0;default:return!1}}var Ir=Jo;function zo(t){return ds(t,Zo)}function Zo(t){switch(t.type){case"document":Xe(t,"head",()=>t.children[0]),Xe(t,"body",()=>t.children[1]);break;case"documentBody":case"sequenceItem":case"flowSequenceItem":case"mappingKey":case"mappingValue":Xe(t,"content",()=>t.children[0]);break;case"mappingItem":case"flowMappingItem":Xe(t,"key",()=>t.children[0]),Xe(t,"value",()=>t.children[1]);break}return t}var Lr=zo;function ea(t,e,n){let{node:s}=t,r=[];s.type!=="mappingValue"&&pe(s)&&r.push([R(O,t.map(n,"leadingComments")),O]);let{tag:i,anchor:o}=s;i&&r.push(n("tag")),i&&o&&r.push(" "),o&&r.push(n("anchor"));let a="";return X(s,["mapping","sequence","comment","directive","mappingItem","sequenceItem"])&&!fn(t)&&(a=pn(t,e.originalText)),(i||o)&&(X(s,["sequence","mapping"])&&!Pe(s)?r.push(O):r.push(" ")),Pe(s)&&r.push([s.middleComments.length===1?"":O,R(O,t.map(n,"middleComments")),O]),Nr(t)?r.push(er(e.originalText.slice(s.position.start.offset,s.position.end.offset).trimEnd())):r.push(Je(ta(t,e,n))),z(s)&&!X(s,["document","documentHead"])&&r.push(ir([s.type==="mappingValue"&&!s.content?"":" ",t.parent.type==="mappingKey"&&t.getParentNode(2).type==="mapping"&&At(s)?"":kt,n("trailingComment")])),ys(s)&&r.push(Y(s.type==="sequenceItem"?2:0,[O,R(O,t.map(({node:l})=>[us(e.originalText,Nt(l))?O:"",n()],"endComments"))])),r.push(a),r}function ta(t,e,n){let{node:s}=t;switch(s.type){case"root":{let r=un(s),i=!(X(r,["blockLiteral","blockFolded"])&&r.chomping==="keep"),o=[];return t.each(({node:a,isFirst:l})=>{l||o.push(O),o.push(n()),sa(t)&&(i&&o.push(O),o.push("..."),z(a)&&o.push(" ",n("trailingComment")))},"children"),i&&o.push(O),o}case"document":{let r=[];return ra(t)&&((s.head.children.length>0||s.head.endComments.length>0)&&r.push(n("head")),z(s.head)?r.push(["---"," ",n(["head","trailingComment"])]):r.push("---")),na(s)&&r.push(n("body")),R(O,r)}case"documentHead":return R(O,[...t.map(n,"children"),...t.map(n,"endComments")]);case"documentBody":{let{children:r,endComments:i}=s,o="";if(r.length>0&&i.length>0){let a=un(s);if(X(a,["blockFolded","blockLiteral"]))a.chomping!=="keep"&&(o=[O,O]);else{let l=V(0,r,-1);o=X(l,["mapping"])&&us(e.originalText,Nt(i[0]))?[O,O]:O}}return[R(O,t.map(n,"children")),o,R(O,t.map(n,"endComments"))]}case"directive":return["%",R(" ",[s.name,...s.parameters])];case"comment":return["#",s.value];case"alias":return["*",s.value];case"tag":return e.originalText.slice(s.position.start.offset,s.position.end.offset);case"anchor":return["&",s.value];case"plain":return Tt(s.type,e.originalText.slice(s.position.start.offset,s.position.end.offset),e);case"quoteDouble":case"quoteSingle":{let o=e.originalText.slice(s.position.start.offset+1,s.position.end.offset-1);if(s.type==="quoteSingle"&&o.includes("\\")||s.type==="quoteDouble"&&/\\[^"]/.test(o)){let l=s.type==="quoteDouble"?'"':"'";return[l,Tt(s.type,o,e),l]}if(o.includes('"'))return["'",Tt(s.type,s.type==="quoteDouble"?Jt(0,Jt(0,o,'\\"','"'),"'","'".repeat(2)):o,e),"'"];if(o.includes("'"))return['"',Tt(s.type,s.type==="quoteSingle"?Jt(0,o,"''","'"):o,e),'"'];let a=e.singleQuote?"'":'"';return[a,Tt(s.type,o,e),a]}case"blockFolded":case"blockLiteral":return _r(t,e,n);case"mapping":case"sequence":return R(O,t.map(n,"children"));case"sequenceItem":return["- ",Y(2,s.content?n("content"):"")];case"mappingKey":case"mappingValue":return s.content?n("content"):"";case"mappingItem":case"flowMappingItem":return Ir(t,e,n);case"flowMapping":return mn(t,e,n);case"flowSequence":return mn(t,e,n);case"flowSequenceItem":return n("content");default:throw new ar(s,"YAML")}}function na(t){return t.body.children.length>0||K(t.body)}function sa(t){let e=t.node;if(e.documentEndMarker||z(e))return!0;if(t.isLast)return!1;let n=t.next;return n.head.children.length>0||K(n.head)}function ra(t){let e=t.node;return e.directivesEndMarker||e.head.children.length>0||K(e.head)||z(e.head)}function Tt(t,e,n){let s=Tr(t,e,n);return R(O,s.map(r=>an(R(Se,r))))}var ia={preprocess:Lr,embed:cr,print:ea,massageAstNode:hs,insertPragma:Sr,getVisitorKeys:pr},Pr=ia;var vr=[{name:"YAML",type:"data",aceMode:"yaml",extensions:[".yml",".mir",".reek",".rviz",".sublime-syntax",".syntax",".yaml",".yaml-tmlanguage",".yaml.sed",".yml.mysql"],filenames:[".clang-format",".clang-tidy",".clangd",".gemrc","CITATION.cff","glide.lock","pixi.lock",".prettierrc",".stylelintrc",".lintstagedrc"],tmScope:"source.yaml",aliases:["yml"],codemirrorMode:"yaml",codemirrorMimeType:"text/x-yaml",parsers:["yaml"],vscodeLanguageIds:["yaml","ansible","dockercompose","github-actions-workflow","home-assistant"],linguistLanguageId:407}];var dn={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var oa={bracketSpacing:dn.bracketSpacing,singleQuote:dn.singleQuote,proseWrap:dn.proseWrap},Dr=oa;var Xs={};Qt(Xs,{yaml:()=>ll});var Ot=class extends SyntaxError{name="YAMLSyntaxError";code;source;position;constructor(t,e){super(e.message,{cause:e}),this.cause??(this.cause=e),this.code=e.code,this.source=t.text,this.position=t.transformRange(e.pos)}};function Q(t,e=null){"children"in t&&t.children.forEach(n=>Q(n,t)),"anchor"in t&&t.anchor&&Q(t.anchor,t),"tag"in t&&t.tag&&Q(t.tag,t);"leadingComments"in t&&t.leadingComments.forEach(n=>Q(n,t)),"middleComments"in t&&t.middleComments.forEach(n=>Q(n,t)),"indicatorComment"in t&&t.indicatorComment&&Q(t.indicatorComment,t),"trailingComment"in t&&t.trailingComment&&Q(t.trailingComment,t),"endComments"in t&&t.endComments.forEach(n=>Q(n,t)),Object.defineProperty(t,"_parent",{value:e,enumerable:!1})}function ve(t){return`${t.line}:${t.column}`}function xr(t){Q(t);let e=aa(t),n=t.children.slice();t.comments.filter(s=>!s._parent).forEach(s=>{for(;n.length>1&&s.position.start.line>n[0].position.end.line;)n.shift();la(s,e,n[0])})}function aa(t){let e=Array.from(new Array(t.position.end.line),()=>({}));for(let n of t.comments)e[n.position.start.line-1].comment=n;return Mr(e,t),e}function Mr(t,e){if(e.position.start.offset!==e.position.end.offset){if("leadingComments"in e){let{start:n}=e.position,{leadingAttachableNode:s}=t[n.line-1];(!s||n.column<s.position.start.column)&&(t[n.line-1].leadingAttachableNode=e)}if("trailingComment"in e&&e.position.end.column>1&&e.type!=="document"&&e.type!=="documentHead"){let{end:n}=e.position,{trailingAttachableNode:s}=t[n.line-1];(!s||n.column>=s.position.end.column)&&(t[n.line-1].trailingAttachableNode=e)}if(e.type!=="root"&&e.type!=="document"&&e.type!=="documentHead"&&e.type!=="documentBody"){let{start:n,end:s}=e.position,r=[s.line].concat(n.line===s.line?[]:n.line);for(let i of r){let o=t[i-1].trailingNode;(!o||s.column>=o.position.end.column)&&(t[i-1].trailingNode=e)}}"children"in e&&e.children.forEach(n=>{Mr(t,n)})}}function la(t,e,n){let s=t.position.start.line,{trailingAttachableNode:r}=e[s-1];if(r){if(r.trailingComment)throw new Error(`Unexpected multiple trailing comment at ${ve(t.position.start)}`);Q(t,r),r.trailingComment=t;return}for(let o=s;o>=n.position.start.line;o--){let{trailingNode:a}=e[o-1],l;if(a)l=a;else if(o!==s&&e[o-1].comment)l=e[o-1].comment._parent;else continue;if((l.type==="sequence"||l.type==="mapping")&&(l=l.children[0]),l.type==="mappingItem"){let[c,u]=l.children;l=$r(c)?c:u}for(;;){if(ca(l,t)){Q(t,l),l.endComments.push(t);return}if(!l._parent)break;l=l._parent}break}for(let o=s+1;o<=n.position.end.line;o++){let{leadingAttachableNode:a}=e[o-1];if(a){Q(t,a),a.leadingComments.push(t);return}}let i=n.children[1];Q(t,i),i.endComments.push(t)}function ca(t,e){if(t.position.start.offset<e.position.start.offset&&t.position.end.offset>e.position.end.offset)switch(t.type){case"flowMapping":case"flowSequence":return t.children.length===0||e.position.start.line>t.children[t.children.length-1].position.end.line}if(e.position.end.offset<t.position.end.offset)return!1;switch(t.type){case"sequenceItem":return e.position.start.column>t.position.start.column;case"mappingKey":case"mappingValue":return e.position.start.column>t._parent.position.start.column&&(t.children.length===0||t.children.length===1&&t.children[0].type!=="blockFolded"&&t.children[0].type!=="blockLiteral")&&(t.type==="mappingValue"||$r(t));default:return!1}}function $r(t){return t.position.start!==t.position.end&&(t.children.length===0||t.position.start.offset!==t.children[0].position.start.offset)}function Br(t,e,n){return{type:"root",position:t,children:e,comments:n}}function Z(t,e){return{start:t,end:e}}function Rr(t){return{start:t,end:t}}function qr(t,e){return{type:"comment",position:e.transformRange([t.offset,t.offset+t.source.length]),value:t.source.slice(1)}}function Fr(t,e){return{type:"anchor",position:t,value:e}}function Kr(t,e,n){return{anchor:e,tag:t,middleComments:n}}function Yr(t,e){return{type:"tag",position:t,value:e}}function Ur(t,e,n){let s=[],r=null,i=null,o=null;for(let a of e){let l=[a.offset,a.offset+a.source.length];switch(a.type){case"tag":{r??(r=l);let c=t.tag??a.source.slice(a.source.startsWith("!!")?2:1);c==="!"&&(c="tag:yaml.org,2002:str"),i=Yr(n.transformRange(l),c)}break;case"anchor":r??(r=l),o=Fr(n.transformRange(l),t.anchor);break;case"comment":{let c=n.transformComment(a);r&&r[0]<=l[0]&&l[1]<=t.range[0]&&s.push(c);break}default:throw new Error(`Unexpected content property token type: ${a.type}`)}}return Kr(i,o,s)}function jr(t,e,n){return{type:"alias",position:t,leadingComments:[],trailingComment:null,...e,value:n}}function*q(...t){for(let e of t)if(e)for(let n of e)fa(n)||(yield n)}function fa(t){return t.type==="space"||t.type==="newline"}function Ee(t){return t.type==="comment"||t.type==="tag"||t.type==="anchor"}function D(t,e){let n=[];for(let s of q(t))s.type==="comment"?e.transformComment(s):n.push(s);return n}function Vr(t,e,n){let s=t.srcToken;for(let r of D(s.end,e))throw new Error(`Unexpected token type in alias end: ${r.type}`);return jr(e.transformRange(t.range),e.transformContentProperties(t,n.tokens),t.source)}function Gr(t){return{...t,type:"blockFolded"}}function Qr(t,e,n,s,r,i){return{type:"blockValue",position:t,leadingComments:[],...e,chomping:n,indent:s,value:r,indicatorComment:i}}function gn(t,e,n,s){let r=null,i=null;for(let a of q(e.props))if(a.type==="comment")i=n.transformComment(a);else if(a.type==="block-scalar-header")r=a;else throw new Error(`Unexpected token type in block value end: ${a.type}`);if(!r)throw new Error("Expected block scalar header token");let o=ua(r.source);return Qr(n.transformRange(t.range),n.transformContentProperties(t,s.tokens),o.chomping,o.indent,t.source,i)}function ua(t){let e=/([+-]?)(\d*)([+-]?)$/u.exec(t),n=null,s="clip";if(e){n=e[2]?Number(e[2]):null;let r=e[3]||e[1];s=r==="+"?"keep":r==="-"?"strip":"clip"}return{chomping:s,indent:n}}function Hr(t,e,n){let s=t.srcToken;if(!s||s.type!=="block-scalar")throw new Error("Expected block scalar srcToken");return Gr(gn(t,s,e,n))}function Jr(t){return{...t,type:"blockLiteral"}}function Wr(t,e,n){let s=t.srcToken;if(!s||s.type!=="block-scalar")throw new Error("Expected block scalar srcToken");return Jr(gn(t,s,e,n))}function yn(t,e,n){return{type:"flowCollection",position:t,leadingComments:[],trailingComment:null,endComments:[],...e,children:n}}function Xr(t,e,n){return{...yn(t,e,n),type:"flowMapping"}}function _t(t,e,n){return{type:"flowMappingItem",position:t,leadingComments:[],children:[e,n]}}function zr(t,e){return{type:"mappingKey",position:t,trailingComment:null,endComments:[],children:e?[e]:[]}}function ws(t,e){return{type:"mappingValue",position:t,leadingComments:[],trailingComment:null,endComments:[],children:e?[e]:[]}}function Ce(t,e,n,s){var r;let i=[],o=null;for(let h of q(e.start)){if(Ee(h)){i.push(h);continue}if(h.type==="explicit-key-ind"){o=h;continue}if(h.type==="comma")continue;throw new Error(`Unexpected token type in collection item start: ${h.type}`)}let a=[],l=null;for(let h of q(e.sep)){if(Ee(h)){a.push(h);continue}if(h.type==="map-value-ind"){l=h;continue}throw new Error(`Unexpected token type in collection item sep: ${h.type}`)}let c=o?.offset??((r=e.key)===null||r===void 0?void 0:r.offset)??l?.offset??e.value.offset,u=[c,e.key?t.key.range[1]:o?o.offset+o.source.length:c],f=null;if(t.value){var p;let h=l?.offset??((p=e.value)===null||p===void 0?void 0:p.offset)??t.value.range[0];f=[h,e.value?t.value.range[1]:l?l.offset+l.source.length:h]}return pa(t,n,s,{range:u,props:{tokens:i}},{range:f,props:{tokens:a}})}function pa(t,e,n,s,r){let i=null;It(t.key,s.props)?D(s.props.tokens,e):i=e.transformNode(t.key,s.props);let o=null;It(t.value,r.props)?D(r.props.tokens,e):o=e.transformNode(t.value,r.props);let a=zr(e.transformRange([s.range?s.range[0]:i.position.start.offset,i?i.position.end.offset:s.range[1]]),i),l=o||r.range?ws(e.transformRange([r.range?r.range[0]:o.position.start.offset,o?o.position.end.offset:r.range[0]+1]),o):null;return n(Z(a.position.start,l?l.position.end:a.position.end),a,l||ws(Rr(a.position.end),null))}function Zr(t,e,n){let s=t.srcToken;if(!s||s.type!=="flow-collection")throw new Error("Expected flow-collection CST node for flow map");let r=t.items.map((o,a)=>{let l=s.items[a];return Ce(o,l,e,_t)});if(t.items.length<s.items.length)for(let o=t.items.length;o<s.items.length;o++){let a=s.items[o];for(let l of D(a.start,e)){if(l.type==="comma")continue;throw new Error(`Unexpected token type in collection item start: ${l.type}`)}}let i=null;for(let o of D(s.end,e)){if(o.type==="flow-map-end"){i=o;continue}throw new Error(`Unexpected token type in flow map end: ${o.type}`)}if(!i)throw new Error("Expected flow-map-end token");return Xr(e.transformRange([s.start.offset,i.offset+i.source.length]),e.transformContentProperties(t,n.tokens),r)}function ei(t,e,n){return{...yn(t,e,n),type:"flowSequence"}}function ti(t,e){return{type:"flowSequenceItem",position:t,children:[e]}}function ie(t){return t[t.length-1]}var Gs={};Qt(Gs,{Alias:()=>de,CST:()=>Us,Composer:()=>_e,Document:()=>ye,Lexer:()=>mt,LineCounter:()=>qe,Pair:()=>v,Parser:()=>Ie,Scalar:()=>y,Schema:()=>lt,YAMLError:()=>ft,YAMLMap:()=>x,YAMLParseError:()=>te,YAMLSeq:()=>F,YAMLWarning:()=>ut,isAlias:()=>H,isCollection:()=>I,isDocument:()=>ne,isMap:()=>U,isNode:()=>_,isPair:()=>T,isScalar:()=>C,isSeq:()=>J,parse:()=>Xi,parseAllDocuments:()=>Wi,parseDocument:()=>Vs,stringify:()=>zi,visit:()=>ae,visitAsync:()=>Lt});var wn=Symbol.for("yaml.alias"),bn=Symbol.for("yaml.document"),oe=Symbol.for("yaml.map"),bs=Symbol.for("yaml.pair"),ee=Symbol.for("yaml.scalar"),Ne=Symbol.for("yaml.seq"),G=Symbol.for("yaml.node.type"),H=t=>!!t&&typeof t=="object"&&t[G]===wn,ne=t=>!!t&&typeof t=="object"&&t[G]===bn,U=t=>!!t&&typeof t=="object"&&t[G]===oe,T=t=>!!t&&typeof t=="object"&&t[G]===bs,C=t=>!!t&&typeof t=="object"&&t[G]===ee,J=t=>!!t&&typeof t=="object"&&t[G]===Ne;function I(t){if(t&&typeof t=="object")switch(t[G]){case oe:case Ne:return!0}return!1}function _(t){if(t&&typeof t=="object")switch(t[G]){case wn:case oe:case ee:case Ne:return!0}return!1}var kn=t=>(C(t)||I(t))&&!!t.anchor;var W=Symbol("break visit"),ni=Symbol("skip children"),me=Symbol("remove node");function ae(t,e){let n=si(e);ne(t)?Ze(null,t.contents,n,Object.freeze([t]))===me&&(t.contents=null):Ze(null,t,n,Object.freeze([]))}ae.BREAK=W;ae.SKIP=ni;ae.REMOVE=me;function Ze(t,e,n,s){let r=ri(t,e,n,s);if(_(r)||T(r))return ii(t,s,r),Ze(t,r,n,s);if(typeof r!="symbol"){if(I(e)){s=Object.freeze(s.concat(e));for(let i=0;i<e.items.length;++i){let o=Ze(i,e.items[i],n,s);if(typeof o=="number")i=o-1;else{if(o===W)return W;o===me&&(e.items.splice(i,1),i-=1)}}}else if(T(e)){s=Object.freeze(s.concat(e));let i=Ze("key",e.key,n,s);if(i===W)return W;i===me&&(e.key=null);let o=Ze("value",e.value,n,s);if(o===W)return W;o===me&&(e.value=null)}}return r}async function Lt(t,e){let n=si(e);ne(t)?await et(null,t.contents,n,Object.freeze([t]))===me&&(t.contents=null):await et(null,t,n,Object.freeze([]))}Lt.BREAK=W;Lt.SKIP=ni;Lt.REMOVE=me;async function et(t,e,n,s){let r=await ri(t,e,n,s);if(_(r)||T(r))return ii(t,s,r),et(t,r,n,s);if(typeof r!="symbol"){if(I(e)){s=Object.freeze(s.concat(e));for(let i=0;i<e.items.length;++i){let o=await et(i,e.items[i],n,s);if(typeof o=="number")i=o-1;else{if(o===W)return W;o===me&&(e.items.splice(i,1),i-=1)}}}else if(T(e)){s=Object.freeze(s.concat(e));let i=await et("key",e.key,n,s);if(i===W)return W;i===me&&(e.key=null);let o=await et("value",e.value,n,s);if(o===W)return W;o===me&&(e.value=null)}}return r}function si(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function ri(t,e,n,s){if(typeof n=="function")return n(t,e,s);if(U(e))return n.Map?.(t,e,s);if(J(e))return n.Seq?.(t,e,s);if(T(e))return n.Pair?.(t,e,s);if(C(e))return n.Scalar?.(t,e,s);if(H(e))return n.Alias?.(t,e,s)}function ii(t,e,n){let s=e[e.length-1];if(I(s))s.items[t]=n;else if(T(s))t==="key"?s.key=n:s.value=n;else if(ne(s))s.contents=n;else{let r=H(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}var ma={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ha=t=>t.replace(/[!,[\]{}]/g,e=>ma[e]),he=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let s=e.trim().split(/[ \t]+/),r=s.shift();switch(r){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[i,o]=s;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[i]=s;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{let o=/^\d+\.\d+$/.test(i);return n(6,`Unsupported YAML version ${i}`,o),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,s,r]=e.match(/^(.*!)([^!]*)$/s);r||n(`The ${e} tag has no suffix`);let i=this.tags[s];if(i)try{return i+decodeURIComponent(r)}catch(o){return n(String(o)),null}return s==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,s]of Object.entries(this.tags))if(e.startsWith(s))return n+ha(e.substring(s.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),r;if(e&&s.length>0&&_(e.contents)){let i={};ae(e.contents,(o,a)=>{_(a)&&a.tag&&(i[a.tag]=!0)}),r=Object.keys(i)}else r=[];for(let[i,o]of s)i==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(o)))&&n.push(`%TAG ${i} ${o}`);return n.join(`
`)}};he.defaultYaml={explicit:!1,version:"1.2"};he.defaultTags={"!!":"tag:yaml.org,2002:"};function Sn(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function ks(t){let e=new Set;return ae(t,{Value(n,s){s.anchor&&e.add(s.anchor)}}),e}function Ss(t,e){for(let n=1;;++n){let s=`${t}${n}`;if(!e.has(s))return s}}function oi(t,e){let n=[],s=new Map,r=null;return{onAnchor:i=>{n.push(i),r??(r=ks(t));let o=Ss(e,r);return r.add(o),o},setAnchors:()=>{for(let i of n){let o=s.get(i);if(typeof o=="object"&&o.anchor&&(C(o.node)||I(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:s}}function De(t,e,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let r=0,i=s.length;r<i;++r){let o=s[r],a=De(t,s,String(r),o);a===void 0?delete s[r]:a!==o&&(s[r]=a)}else if(s instanceof Map)for(let r of Array.from(s.keys())){let i=s.get(r),o=De(t,s,r,i);o===void 0?s.delete(r):o!==i&&s.set(r,o)}else if(s instanceof Set)for(let r of Array.from(s)){let i=De(t,s,r,r);i===void 0?s.delete(r):i!==r&&(s.delete(r),s.add(i))}else for(let[r,i]of Object.entries(s)){let o=De(t,s,r,i);o===void 0?delete s[r]:o!==i&&(s[r]=o)}return t.call(e,n,s)}function B(t,e,n){if(Array.isArray(t))return t.map((s,r)=>B(s,String(r),n));if(t&&typeof t.toJSON=="function"){if(!n||!kn(t))return t.toJSON(e,n);let s={aliasCount:0,count:1,res:void 0};n.anchors.set(t,s),n.onCreate=i=>{s.res=i,delete n.onCreate};let r=t.toJSON(e,n);return n.onCreate&&n.onCreate(r),r}return typeof t=="bigint"&&!n?.keep?Number(t):t}var xe=class{constructor(e){Object.defineProperty(this,G,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:s,onAnchor:r,reviver:i}={}){if(!ne(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=B(this,"",o);if(typeof r=="function")for(let{count:l,res:c}of o.anchors.values())r(c,l);return typeof i=="function"?De(i,{"":a},"",a):a}};var de=class extends xe{constructor(e){super(wn),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let s;n?.aliasResolveCache?s=n.aliasResolveCache:(s=[],ae(e,{Node:(i,o)=>{(H(o)||kn(o))&&s.push(o)}}),n&&(n.aliasResolveCache=s));let r;for(let i of s){if(i===this)break;i.anchor===this.source&&(r=i)}return r}toJSON(e,n){if(!n)return{source:this.source};let{anchors:s,doc:r,maxAliasCount:i}=n,o=this.resolve(r,n);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=s.get(o);if(a||(B(o,null,n),a=s.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=En(r,o,s)),a.count*a.aliasCount>i)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,n,s){let r=`*${this.source}`;if(e){if(Sn(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(e.implicitKey)return`${r} `}return r}};function En(t,e,n){if(H(e)){let s=e.resolve(t),r=n&&s&&n.get(s);return r?r.count*r.aliasCount:0}else if(I(e)){let s=0;for(let r of e.items){let i=En(t,r,n);i>s&&(s=i)}return s}else if(T(e)){let s=En(t,e.key,n),r=En(t,e.value,n);return Math.max(s,r)}return 1}var Cn=t=>!t||typeof t!="function"&&typeof t!="object",y=class extends xe{constructor(e){super(ee),this.value=e}toJSON(e,n){return n?.keep?this.value:B(this.value,e,n)}toString(){return String(this.value)}};y.BLOCK_FOLDED="BLOCK_FOLDED";y.BLOCK_LITERAL="BLOCK_LITERAL";y.PLAIN="PLAIN";y.QUOTE_DOUBLE="QUOTE_DOUBLE";y.QUOTE_SINGLE="QUOTE_SINGLE";var da="tag:yaml.org,2002:";function ga(t,e,n){if(e){let s=n.filter(i=>i.tag===e),r=s.find(i=>!i.format)??s[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return n.find(s=>s.identify?.(t)&&!s.format)}function Ae(t,e,n){if(ne(t)&&(t=t.contents),_(t))return t;if(T(t)){let f=n.schema[oe].createNode?.(n.schema,null,n);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:s,onAnchor:r,onTagObj:i,schema:o,sourceObjects:a}=n,l;if(s&&t&&typeof t=="object"){if(l=a.get(t),l)return l.anchor??(l.anchor=r(t)),new de(l.anchor);l={anchor:null,node:null},a.set(t,l)}e?.startsWith("!!")&&(e=da+e.slice(2));let c=ga(t,e,o.tags);if(!c){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new y(t);return l&&(l.node=f),f}c=t instanceof Map?o[oe]:Symbol.iterator in Object(t)?o[Ne]:o[oe]}i&&(i(c),delete n.onTagObj);let u=c?.createNode?c.createNode(n.schema,t,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,t,n):new y(t);return e?u.tag=e:c.default||(u.tag=c.tag),l&&(l.node=u),u}function Pt(t,e,n){let s=n;for(let r=e.length-1;r>=0;--r){let i=e[r];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let o=[];o[i]=s,s=o}else s=new Map([[i,s]])}return Ae(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var nt=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,tt=class extends xe{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(s=>_(s)||T(s)?s.clone(e):s),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(nt(e))this.add(n);else{let[s,...r]=e,i=this.get(s,!0);if(I(i))i.addIn(r,n);else if(i===void 0&&this.schema)this.set(s,Pt(this.schema,r,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}deleteIn(e){let[n,...s]=e;if(s.length===0)return this.delete(n);let r=this.get(n,!0);if(I(r))return r.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(e,n){let[s,...r]=e,i=this.get(s,!0);return r.length===0?!n&&C(i)?i.value:i:I(i)?i.getIn(r,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!T(n))return!1;let s=n.value;return s==null||e&&C(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){let[n,...s]=e;if(s.length===0)return this.has(n);let r=this.get(n,!0);return I(r)?r.hasIn(s):!1}setIn(e,n){let[s,...r]=e;if(r.length===0)this.set(s,n);else{let i=this.get(s,!0);if(I(i))i.setIn(r,n);else if(i===void 0&&this.schema)this.set(s,Pt(this.schema,r,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}};var ai=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function se(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var ge=(t,e,n)=>t.endsWith(`
`)?se(n,e):n.includes(`
`)?`
`+se(n,e):(t.endsWith(" ")?"":" ")+n;var Es="flow",Nn="block",vt="quoted";function Dt(t,e,n="flow",{indentAtStart:s,lineWidth:r=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){if(!r||r<0)return t;r<i&&(i=0);let l=Math.max(1+i,1+r-e.length);if(t.length<=l)return t;let c=[],u={},f=r-e.length;typeof s=="number"&&(s>r-Math.max(2,i)?c.push(0):f=r-s);let p,h,g=!1,m=-1,d=-1,b=-1;n===Nn&&(m=li(t,m,e.length),m!==-1&&(f=m+l));for(let S;S=t[m+=1];){if(n===vt&&S==="\\"){switch(d=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}b=m}if(S===`
`)n===Nn&&(m=li(t,m,e.length)),f=m+e.length+l,p=void 0;else{if(S===" "&&h&&h!==" "&&h!==`
`&&h!==" "){let E=t[m+1];E&&E!==" "&&E!==`
`&&E!==" "&&(p=m)}if(m>=f)if(p)c.push(p),f=p+l,p=void 0;else if(n===vt){for(;h===" "||h===" ";)h=S,S=t[m+=1],g=!0;let E=m>b+1?m-2:d-1;if(u[E])return t;c.push(E),u[E]=!0,f=E+l,p=void 0}else g=!0}h=S}if(g&&a&&a(),c.length===0)return t;o&&o();let k=t.slice(0,c[0]);for(let S=0;S<c.length;++S){let E=c[S],N=c[S+1]||t.length;E===0?k=`
${e}${t.slice(0,N)}`:(n===vt&&u[E]&&(k+=`${t[E]}\\`),k+=`
${e}${t.slice(E+1,N)}`)}return k}function li(t,e,n){let s=e,r=e+1,i=t[r];for(;i===" "||i===" ";)if(e<r+n)i=t[++e];else{do i=t[++e];while(i&&i!==`
`);s=e,r=e+1,i=t[r]}return s}var Tn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),On=t=>/^(%|---|\.\.\.)/m.test(t);function ya(t,e,n){if(!e||e<0)return!1;let s=e-n,r=t.length;if(r<=s)return!1;for(let i=0,o=0;i<r;++i)if(t[i]===`
`){if(i-o>s)return!0;if(o=i+1,r-o<=s)return!1}return!0}function xt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=e,r=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(On(t)?" ":""),o="",a=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(o+=n.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{o+=n.slice(a,l);let u=n.substr(l+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(s||n[l+2]==='"'||n.length<r)l+=1;else{for(o+=n.slice(a,l)+`
`;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)o+=`
`,l+=2;o+=i,n[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+n.slice(a):n,s?o:Dt(o,i,vt,Tn(e,!1))}function Cs(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
`)||/[ \t]\n|\n[ \t]/.test(t))return xt(t,e);let n=e.indent||(On(t)?" ":""),s="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
${n}`)+"'";return e.implicitKey?s:Dt(s,n,Es,Tn(e,!1))}function st(t,e){let{singleQuote:n}=e.options,s;if(n===!1)s=xt;else{let r=t.includes('"'),i=t.includes("'");r&&!i?s=Cs:i&&!r?s=xt:s=n?Cs:xt}return s(t,e)}var Ns;try{Ns=new RegExp(`(^|(?<!
))
+(?!
|$)`,"g")}catch{Ns=/\n+(?!\n|$)/g}function An({comment:t,type:e,value:n},s,r,i){let{blockQuote:o,commentString:a,lineWidth:l}=s.options;if(!o||/\n[\t ]+$/.test(n))return st(n,s);let c=s.indent||(s.forceBlockIndent||On(n)?" ":""),u=o==="literal"?!0:o==="folded"||e===y.BLOCK_FOLDED?!1:e===y.BLOCK_LITERAL?!0:!ya(n,l,c.length);if(!n)return u?`|
`:`>
`;let f,p;for(p=n.length;p>0;--p){let N=n[p-1];if(N!==`
`&&N!==" "&&N!==" ")break}let h=n.substring(p),g=h.indexOf(`
`);g===-1?f="-":n===h||g!==h.length-1?(f="+",i&&i()):f="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
`&&(h=h.slice(0,-1)),h=h.replace(Ns,`$&${c}`));let m=!1,d,b=-1;for(d=0;d<n.length;++d){let N=n[d];if(N===" ")m=!0;else if(N===`
`)b=d;else break}let k=n.substring(0,b<d?b+1:d);k&&(n=n.substring(k.length),k=k.replace(/\n+/g,`$&${c}`));let E=(m?c?"2":"1":"")+f;if(t&&(E+=" "+a(t.replace(/ ?[\r\n]+/g," ")),r&&r()),!u){let N=n.replace(/\n+/g,`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),A=!1,L=Tn(s,!0);o!=="folded"&&e!==y.BLOCK_FOLDED&&(L.onOverflow=()=>{A=!0});let w=Dt(`${k}${N}${h}`,c,Nn,L);if(!A)return`>${E}
${c}${w}`}return n=n.replace(/\n+/g,`$&${c}`),`|${E}
${c}${k}${n}${h}`}function wa(t,e,n,s){let{type:r,value:i}=t,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:u}=e;if(a&&i.includes(`
`)||u&&/[[\]{},]/.test(i))return st(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||u||!i.includes(`
`)?st(i,e):An(t,e,n,s);if(!a&&!u&&r!==y.PLAIN&&i.includes(`
`))return An(t,e,n,s);if(On(i)){if(l==="")return e.forceBlockIndent=!0,An(t,e,n,s);if(a&&l===c)return st(i,e)}let f=i.replace(/\n+/g,`$&
${l}`);if(o){let p=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:h,tags:g}=e.doc.schema;if(g.some(p)||h?.some(p))return st(i,e)}return a?f:Dt(f,l,Es,Tn(e,!1))}function Te(t,e,n,s){let{implicitKey:r,inFlow:i}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==y.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=y.QUOTE_DOUBLE);let l=u=>{switch(u){case y.BLOCK_FOLDED:case y.BLOCK_LITERAL:return r||i?st(o.value,e):An(o,e,n,s);case y.QUOTE_DOUBLE:return xt(o.value,e);case y.QUOTE_SINGLE:return Cs(o.value,e);case y.PLAIN:return wa(o,e,n,s);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=e.options,p=r&&u||f;if(c=l(p),c===null)throw new Error(`Unsupported default string type ${p}`)}return c}function _n(t,e){let n=Object.assign({blockQuote:!0,commentString:ai,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function ba(t,e){if(e.tag){let r=t.filter(i=>i.tag===e.tag);if(r.length>0)return r.find(i=>i.format===e.format)??r[0]}let n,s;if(C(e)){s=e.value;let r=t.filter(i=>i.identify?.(s));if(r.length>1){let i=r.filter(o=>o.test);i.length>0&&(r=i)}n=r.find(i=>i.format===e.format)??r.find(i=>!i.format)}else s=e,n=t.find(r=>r.nodeClass&&s instanceof r.nodeClass);if(!n){let r=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${r} value`)}return n}function ka(t,e,{anchors:n,doc:s}){if(!s.directives)return"";let r=[],i=(C(t)||I(t))&&t.anchor;i&&Sn(i)&&(n.add(i),r.push(`&${i}`));let o=t.tag??(e.default?null:e.tag);return o&&r.push(s.directives.tagString(o)),r.join(" ")}function Oe(t,e,n,s){if(T(t))return t.toString(e,n,s);if(H(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let r,i=_(t)?t:e.doc.createNode(t,{onTagObj:l=>r=l});r??(r=ba(e.doc.schema.tags,i));let o=ka(i,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof r.stringify=="function"?r.stringify(i,e,n,s):C(i)?Te(i,e,n,s):i.toString(e,n,s);return o?C(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
${e.indent}${a}`:a}function ci({key:t,value:e},n,s,r){let{allNullValues:i,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=n,p=_(t)&&t.comment||null;if(f){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(I(t)||!_(t)&&typeof t=="object"){let L="With simple keys, collection cannot be used as a key value";throw new Error(L)}}let h=!f&&(!t||p&&e==null&&!n.inFlow||I(t)||(C(t)?t.type===y.BLOCK_FOLDED||t.type===y.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(f||!i),indent:a+l});let g=!1,m=!1,d=Oe(t,n,()=>g=!0,()=>m=!0);if(!h&&!n.inFlow&&d.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(i||e==null)return g&&s&&s(),d===""?"?":h?`? ${d}`:d}else if(i&&!f||e==null&&h)return d=`? ${d}`,p&&!g?d+=ge(d,n.indent,c(p)):m&&r&&r(),d;g&&(p=null),h?(p&&(d+=ge(d,n.indent,c(p))),d=`? ${d}
${a}:`):(d=`${d}:`,p&&(d+=ge(d,n.indent,c(p))));let b,k,S;_(e)?(b=!!e.spaceBefore,k=e.commentBefore,S=e.comment):(b=!1,k=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!h&&!p&&C(e)&&(n.indentAtStart=d.length+1),m=!1,!u&&l.length>=2&&!n.inFlow&&!h&&J(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let E=!1,N=Oe(e,n,()=>E=!0,()=>m=!0),A=" ";if(p||b||k){if(A=b?`
`:"",k){let L=c(k);A+=`
${se(L,n.indent)}`}N===""&&!n.inFlow?A===`
`&&S&&(A=`
`):A+=`
${n.indent}`}else if(!h&&I(e)){let L=N[0],w=N.indexOf(`
`),M=w!==-1,Le=n.inFlow??e.flow??e.items.length===0;if(M||!Le){let Ye=!1;if(M&&(L==="&"||L==="!")){let $=N.indexOf(" ");L==="&"&&$!==-1&&$<w&&N[$+1]==="!"&&($=N.indexOf(" ",$+1)),($===-1||w<$)&&(Ye=!0)}Ye||(A=`
${n.indent}`)}}else(N===""||N[0]===`
`)&&(A="");return d+=A+N,n.inFlow?E&&s&&s():S&&!E?d+=ge(d,n.indent,c(S)):m&&r&&r(),d}function In(t,e){(t==="debug"||t==="warn")&&console.warn(e)}var Ln="<<",le={identify:t=>t===Ln||typeof t=="symbol"&&t.description===Ln,default:"key",tag:"tag:yaml.