Files
Aislo/node_modules/prettier/plugins/yaml.mjs
T
2026-07-05 14:05:22 +09:00

155 lines
140 KiB
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.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new y(Symbol(Ln)),{addToJSMap:Ts}),stringify:()=>Ln},fi=(t,e)=>(le.identify(e)||C(e)&&(!e.type||e.type===y.PLAIN)&&le.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===le.tag&&n.default);function Ts(t,e,n){let s=ui(t,n);if(J(s))for(let r of s.items)As(t,e,r);else if(Array.isArray(s))for(let r of s)As(t,e,r);else As(t,e,s)}function As(t,e,n){let s=ui(t,n);if(!U(s))throw new Error("Merge sources must be maps or map aliases");let r=s.toJSON(null,t,Map);for(let[i,o]of r)e instanceof Map?e.has(i)||e.set(i,o):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function ui(t,e){return t&&H(e)?e.resolve(t.doc,t):e}function Pn(t,e,{key:n,value:s}){if(_(n)&&n.addToJSMap)n.addToJSMap(t,e,s);else if(fi(t,n))Ts(t,e,s);else{let r=B(n,"",t);if(e instanceof Map)e.set(r,B(s,r,t));else if(e instanceof Set)e.add(r);else{let i=Sa(n,r,t),o=B(s,i,t);i in e?Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[i]=o}}return e}function Sa(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(_(t)&&n?.doc){let s=_n(n.doc,{});s.anchors=new Set;for(let i of n.anchors.keys())s.anchors.add(i.anchor);s.inFlow=!0,s.inStringifyKey=!0;let r=t.toString(s);if(!n.mapKeyWarned){let i=JSON.stringify(r);i.length>40&&(i=i.substring(0,36)+'..."'),In(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(e)}function rt(t,e,n){let s=Ae(t,void 0,n),r=Ae(e,void 0,n);return new v(s,r)}var v=class t{constructor(e,n=null){Object.defineProperty(this,G,{value:bs}),this.key=e,this.value=n}clone(e){let{key:n,value:s}=this;return _(n)&&(n=n.clone(e)),_(s)&&(s=s.clone(e)),new t(n,s)}toJSON(e,n){let s=n?.mapAsMap?new Map:{};return Pn(n,s,this)}toString(e,n,s){return e?.doc?ci(this,e,n,s):JSON.stringify(this)}};function Dn(t,e,n){return(e.inFlow??t.flow?Ca:Ea)(t,e,n)}function Ea({comment:t,items:e},n,{blockItemPrefix:s,flowChars:r,itemIndent:i,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=n,u=Object.assign({},n,{indent:i,type:null}),f=!1,p=[];for(let g=0;g<e.length;++g){let m=e[g],d=null;if(_(m))!f&&m.spaceBefore&&p.push(""),vn(n,p,m.commentBefore,f),m.comment&&(d=m.comment);else if(T(m)){let k=_(m.key)?m.key:null;k&&(!f&&k.spaceBefore&&p.push(""),vn(n,p,k.commentBefore,f))}f=!1;let b=Oe(m,u,()=>d=null,()=>f=!0);d&&(b+=ge(b,i,c(d))),f&&d&&(f=!1),p.push(s+b)}let h;if(p.length===0)h=r.start+r.end;else{h=p[0];for(let g=1;g<p.length;++g){let m=p[g];h+=m?`
${l}${m}`:`
`}}return t?(h+=`
`+se(c(t),l),a&&a()):f&&o&&o(),h}function Ca({items:t},e,{flowChars:n,itemIndent:s}){let{indent:r,indentStep:i,flowCollectionPadding:o,options:{commentString:a}}=e;s+=i;let l=Object.assign({},e,{indent:s,inFlow:!0,type:null}),c=!1,u=0,f=[];for(let g=0;g<t.length;++g){let m=t[g],d=null;if(_(m))m.spaceBefore&&f.push(""),vn(e,f,m.commentBefore,!1),m.comment&&(d=m.comment);else if(T(m)){let k=_(m.key)?m.key:null;k&&(k.spaceBefore&&f.push(""),vn(e,f,k.commentBefore,!1),k.comment&&(c=!0));let S=_(m.value)?m.value:null;S?(S.comment&&(d=S.comment),S.commentBefore&&(c=!0)):m.value==null&&k?.comment&&(d=k.comment)}d&&(c=!0);let b=Oe(m,l,()=>d=null);c||(c=f.length>u||b.includes(`
`)),g<t.length-1?b+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=f.reduce((k,S)=>k+S.length+2,2)+(b.length+2)>e.options.lineWidth)),c&&(b+=",")),d&&(b+=ge(b,s,a(d))),f.push(b),u=f.length}let{start:p,end:h}=n;if(f.length===0)return p+h;if(!c){let g=f.reduce((m,d)=>m+d.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=p;for(let m of f)g+=m?`
${i}${r}${m}`:`
`;return`${g}
${r}${h}`}else return`${p}${o}${f.join(" ")}${o}${h}`}function vn({indent:t,options:{commentString:e}},n,s,r){if(s&&r&&(s=s.replace(/^\n+/,"")),s){let i=se(e(s),t);n.push(i.trimStart())}}function Me(t,e){let n=C(e)?e.value:e;for(let s of t)if(T(s)&&(s.key===e||s.key===n||C(s.key)&&s.key.value===n))return s}var x=class extends tt{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(oe,e),this.items=[]}static from(e,n,s){let{keepUndefined:r,replacer:i}=s,o=new this(e),a=(l,c)=>{if(typeof i=="function")c=i.call(n,l,c);else if(Array.isArray(i)&&!i.includes(l))return;(c!==void 0||r)&&o.items.push(rt(l,c,s))};if(n instanceof Map)for(let[l,c]of n)a(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))a(l,n[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let s;T(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new v(e,e?.value):s=new v(e.key,e.value);let r=Me(this.items,s.key),i=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${s.key} already set`);C(r.value)&&Cn(s.value)?r.value.value=s.value:r.value=s.value}else if(i){let o=this.items.findIndex(a=>i(s,a)<0);o===-1?this.items.push(s):this.items.splice(o,0,s)}else this.items.push(s)}delete(e){let n=Me(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let r=Me(this.items,e)?.value;return(!n&&C(r)?r.value:r)??void 0}has(e){return!!Me(this.items,e)}set(e,n){this.add(new v(e,n),!0)}toJSON(e,n,s){let r=s?new s:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let i of this.items)Pn(n,r,i);return r}toString(e,n,s){if(!e)return JSON.stringify(this);for(let r of this.items)if(!T(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Dn(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:n})}};var ce={collection:"map",default:!0,nodeClass:x,tag:"tag:yaml.org,2002:map",resolve(t,e){return U(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>x.from(t,e,n)};var F=class extends tt{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ne,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=xn(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let s=xn(e);if(typeof s!="number")return;let r=this.items[s];return!n&&C(r)?r.value:r}has(e){let n=xn(e);return typeof n=="number"&&n<this.items.length}set(e,n){let s=xn(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[s];C(r)&&Cn(n)?r.value=n:this.items[s]=n}toJSON(e,n){let s=[];n?.onCreate&&n.onCreate(s);let r=0;for(let i of this.items)s.push(B(i,String(r++),n));return s}toString(e,n,s){return e?Dn(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:s,onComment:n}):JSON.stringify(this)}static from(e,n,s){let{replacer:r}=s,i=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof r=="function"){let l=n instanceof Set?a:String(o++);a=r.call(n,l,a)}i.items.push(Ae(a,void 0,s))}}return i}};function xn(t){let e=C(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var fe={collection:"seq",default:!0,nodeClass:F,tag:"tag:yaml.org,2002:seq",resolve(t,e){return J(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>F.from(t,e,n)};var $e={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,s){return e=Object.assign({actualString:!0},e),Te(t,e,n,s)}};var Ke={identify:t=>t==null,createNode:()=>new y(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new y(null),stringify:({source:t},e)=>typeof t=="string"&&Ke.test.test(t)?t:e.options.nullStr};var Mt={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new y(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Mt.test.test(t)){let s=t[0]==="t"||t[0]==="T";if(e===s)return t}return e?n.options.trueStr:n.options.falseStr}};function j({format:t,minFractionDigits:e,tag:n,value:s}){if(typeof s=="bigint")return String(s);let r=typeof s=="number"?s:Number(s);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let i=Object.is(s,-0)?"-0":JSON.stringify(s);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(i)&&!i.includes("e")){let o=i.indexOf(".");o<0&&(o=i.length,i+=".");let a=e-(i.length-o-1);for(;a-- >0;)i+="0"}return i}var Mn={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:j},$n={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():j(t)}},Bn={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new y(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:j};var Rn=t=>typeof t=="bigint"||Number.isInteger(t),Os=(t,e,n,{intAsBigInt:s})=>s?BigInt(t):parseInt(t.substring(e),n);function pi(t,e,n){let{value:s}=t;return Rn(s)&&s>=0?n+s.toString(e):j(t)}var qn={identify:t=>Rn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Os(t,2,8,n),stringify:t=>pi(t,8,"0o")},Fn={identify:Rn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Os(t,0,10,n),stringify:j},Kn={identify:t=>Rn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Os(t,2,16,n),stringify:t=>pi(t,16,"0x")};var mi=[ce,fe,$e,Ke,Mt,qn,Fn,Kn,Mn,$n,Bn];function hi(t){return typeof t=="bigint"||Number.isInteger(t)}var Yn=({value:t})=>JSON.stringify(t),Na=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Yn},{identify:t=>t==null,createNode:()=>new y(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Yn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Yn},{identify:hi,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>hi(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Yn}],Aa={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},di=[ce,fe].concat(Na,Aa);var $t={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let r=0;r<n.length;++r)s[r]=n.charCodeAt(r);return s}else return t},stringify({comment:t,type:e,value:n},s,r,i){if(!n)return"";let o=n,a;if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=y.BLOCK_LITERAL),e!==y.QUOTE_DOUBLE){let l=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),c=Math.ceil(a.length/l),u=new Array(c);for(let f=0,p=0;f<c;++f,p+=l)u[f]=a.substr(p,l);a=u.join(e===y.BLOCK_LITERAL?`
`:" ")}return Te({comment:t,type:e,value:a},s,r,i)}};function _s(t,e){if(J(t))for(let n=0;n<t.items.length;++n){let s=t.items[n];if(!T(s)){if(U(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");let r=s.items[0]||new v(new y(null));if(s.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${s.commentBefore}
${r.key.commentBefore}`:s.commentBefore),s.comment){let i=r.value??r.key;i.comment=i.comment?`${s.comment}
${i.comment}`:s.comment}s=r}t.items[n]=T(s)?s:new v(s)}}else e("Expected a sequence for this tag");return t}function Is(t,e,n){let{replacer:s}=n,r=new F(t);r.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof s=="function"&&(o=s.call(e,String(i++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;r.items.push(rt(a,l,n))}return r}var Bt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:_s,createNode:Is};var it=class t extends F{constructor(){super(),this.add=x.prototype.add.bind(this),this.delete=x.prototype.delete.bind(this),this.get=x.prototype.get.bind(this),this.has=x.prototype.has.bind(this),this.set=x.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let s=new Map;n?.onCreate&&n.onCreate(s);for(let r of this.items){let i,o;if(T(r)?(i=B(r.key,"",n),o=B(r.value,i,n)):i=B(r,"",n),s.has(i))throw new Error("Ordered maps must not include duplicate keys");s.set(i,o)}return s}static from(e,n,s){let r=Is(e,n,s),i=new this;return i.items=r.items,i}};it.tag="tag:yaml.org,2002:omap";var Rt={collection:"seq",identify:t=>t instanceof Map,nodeClass:it,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=_s(t,e),s=[];for(let{key:r}of n.items)C(r)&&(s.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):s.push(r.value));return Object.assign(new it,n)},createNode:(t,e,n)=>it.from(t,e,n)};function gi({value:t,source:e},n){return e&&(t?Ls:Ps).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Ls={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new y(!0),stringify:gi},Ps={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new y(!1),stringify:gi};var yi={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:j},wi={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():j(t)}},bi={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new y(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let s=t.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:j};var qt=t=>typeof t=="bigint"||Number.isInteger(t);function Un(t,e,n,{intAsBigInt:s}){let r=t[0];if((r==="-"||r==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),s){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return r==="-"?BigInt(-1)*o:o}let i=parseInt(t,n);return r==="-"?-1*i:i}function vs(t,e,n){let{value:s}=t;if(qt(s)){let r=s.toString(e);return s<0?"-"+n+r.substr(1):n+r}return j(t)}var ki={identify:qt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Un(t,2,2,n),stringify:t=>vs(t,2,"0b")},Si={identify:qt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Un(t,1,8,n),stringify:t=>vs(t,8,"0")},Ei={identify:qt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Un(t,0,10,n),stringify:j},Ci={identify:qt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Un(t,2,16,n),stringify:t=>vs(t,16,"0x")};var ot=class t extends x{constructor(e){super(e),this.tag=t.tag}add(e){let n;T(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new v(e.key,null):n=new v(e,null),Me(this.items,n.key)||this.items.push(n)}get(e,n){let s=Me(this.items,e);return!n&&T(s)?C(s.key)?s.key.value:s.key:s}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let s=Me(this.items,e);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new v(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(e,n,s){let{replacer:r}=s,i=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),i.items.push(rt(o,null,s));return i}};ot.tag="tag:yaml.org,2002:set";var Ft={collection:"map",identify:t=>t instanceof Set,nodeClass:ot,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>ot.from(t,e,n),resolve(t,e){if(U(t)){if(t.hasAllNullValues(!0))return Object.assign(new ot,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};function Ds(t,e){let n=t[0],s=n==="-"||n==="+"?t.substring(1):t,r=o=>e?BigInt(o):Number(o),i=s.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return n==="-"?r(-1)*i:i}function Ni(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return j(t);let s="";e<0&&(s="-",e*=n(-1));let r=n(60),i=[e%r];return e<60?i.unshift(0):(e=(e-i[0])/r,i.unshift(e%r),e>=60&&(e=(e-i[0])/r,i.unshift(e))),s+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var jn={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>Ds(t,n),stringify:Ni},Vn={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Ds(t,!1),stringify:Ni},at={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(at.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,r,i,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(n,s-1,r,i||0,o||0,a||0,l),u=e[8];if(u&&u!=="Z"){let f=Ds(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var xs=[ce,fe,$e,Ke,Ls,Ps,ki,Si,Ei,Ci,yi,wi,bi,$t,le,Rt,Bt,Ft,jn,Vn,at];var Ai=new Map([["core",mi],["failsafe",[ce,fe,$e]],["json",di],["yaml11",xs],["yaml-1.1",xs]]),Ti={binary:$t,bool:Mt,float:Bn,floatExp:$n,floatNaN:Mn,floatTime:Vn,int:Fn,intHex:Kn,intOct:qn,intTime:jn,map:ce,merge:le,null:Ke,omap:Rt,pairs:Bt,seq:fe,set:Ft,timestamp:at},Oi={"tag:yaml.org,2002:binary":$t,"tag:yaml.org,2002:merge":le,"tag:yaml.org,2002:omap":Rt,"tag:yaml.org,2002:pairs":Bt,"tag:yaml.org,2002:set":Ft,"tag:yaml.org,2002:timestamp":at};function Gn(t,e,n){let s=Ai.get(e);if(s&&!t)return n&&!s.includes(le)?s.concat(le):s.slice();let r=s;if(!r)if(Array.isArray(t))r=[];else{let i=Array.from(Ai.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(t))for(let i of t)r=r.concat(i);else typeof t=="function"&&(r=t(r.slice()));return n&&(r=r.concat(le)),r.reduce((i,o)=>{let a=typeof o=="string"?Ti[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Ti).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return i.includes(a)||i.push(a),i},[])}var Ta=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,lt=class t{constructor({compat:e,customTags:n,merge:s,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Gn(e,"compat"):e?Gn(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=r?Oi:{},this.tags=Gn(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,oe,{value:ce}),Object.defineProperty(this,ee,{value:$e}),Object.defineProperty(this,Ne,{value:fe}),this.sortMapEntries=typeof o=="function"?o:o===!0?Ta:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function _i(t,e){let n=[],s=e.directives===!0;if(e.directives!==!1&&t.directives){let l=t.directives.toString(t);l?(n.push(l),s=!0):t.directives.docStart&&(s=!0)}s&&n.push("---");let r=_n(t,e),{commentString:i}=r.options;if(t.commentBefore){n.length!==1&&n.unshift("");let l=i(t.commentBefore);n.unshift(se(l,""))}let o=!1,a=null;if(t.contents){if(_(t.contents)){if(t.contents.spaceBefore&&s&&n.push(""),t.contents.commentBefore){let u=i(t.contents.commentBefore);n.push(se(u,""))}r.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>o=!0,c=Oe(t.contents,r,()=>a=null,l);a&&(c+=ge(c,"",i(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Oe(t.contents,r));if(t.directives?.docEnd)if(t.comment){let l=i(t.comment);l.includes(`
`)?(n.push("..."),n.push(se(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=t.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(se(i(l),"")))}return n.join(`
`)+`
`}var ye=class t{constructor(e,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,G,{value:bn});let r=null;typeof n=="function"||Array.isArray(n)?r=n:s===void 0&&n&&(s=n,n=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=i;let{version:o}=i;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new he({version:o}),this.setSchema(o,s),this.contents=e===void 0?null:this.createNode(e,r,s)}clone(){let e=Object.create(t.prototype,{[G]:{value:bn}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=_(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ct(this.contents)&&this.contents.add(e)}addIn(e,n){ct(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let s=ks(this);e.anchor=!n||s.has(n)?Ss(n||"a",s):n}return new de(e.anchor)}createNode(e,n,s){let r;if(typeof n=="function")e=n.call({"":e},"",e),r=n;else if(Array.isArray(n)){let d=k=>typeof k=="number"||k instanceof String||k instanceof Number,b=n.filter(d).map(String);b.length>0&&(n=n.concat(b)),r=n}else s===void 0&&n&&(s=n,n=void 0);let{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:u}=s??{},{onAnchor:f,setAnchors:p,sourceObjects:h}=oi(this,o||"a"),g={aliasDuplicateObjects:i??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:h},m=Ae(e,u,g);return a&&I(m)&&(m.flow=!0),p(),m}createPair(e,n,s={}){let r=this.createNode(e,null,s),i=this.createNode(n,null,s);return new v(r,i)}delete(e){return ct(this.contents)?this.contents.delete(e):!1}deleteIn(e){return nt(e)?this.contents==null?!1:(this.contents=null,!0):ct(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return I(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return nt(e)?!n&&C(this.contents)?this.contents.value:this.contents:I(this.contents)?this.contents.getIn(e,n):void 0}has(e){return I(this.contents)?this.contents.has(e):!1}hasIn(e){return nt(e)?this.contents!==void 0:I(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=Pt(this.schema,[e],n):ct(this.contents)&&this.contents.set(e,n)}setIn(e,n){nt(e)?this.contents=n:this.contents==null?this.contents=Pt(this.schema,Array.from(e),n):ct(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let s;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new he({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new he({version:e}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new lt(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:s,maxAliasCount:r,onAnchor:i,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},l=B(this.contents,n??"",a);if(typeof i=="function")for(let{count:c,res:u}of a.anchors.values())i(u,c);return typeof o=="function"?De(o,{"":l},"",l):l}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return _i(this,e)}};function ct(t){if(I(t))return!0;throw new Error("Expected a YAML collection as document contents")}var ft=class extends Error{constructor(e,n,s,r){super(),this.name=e,this.code=s,this.message=r,this.pos=n}},te=class extends ft{constructor(e,n,s){super("YAMLParseError",e,n,s)}},ut=class extends ft{constructor(e,n,s){super("YAMLWarning",e,n,s)}},Kt=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:s,col:r}=n.linePos[0];n.message+=` at line ${s}, column ${r}`;let i=r-1,o=t.substring(e.lineStarts[s-1],e.lineStarts[s]).replace(/[\n\r]+$/,"");if(i>=60&&o.length>80){let a=Math.min(i-39,o.length-79);o="\u2026"+o.substring(a),i-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),s>1&&/^ *$/.test(o.substring(0,i))){let a=t.substring(e.lineStarts[s-2],e.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=n.linePos[1];l?.line===s&&l.col>r&&(a=Math.max(1,Math.min(l.col-r,80-i)));let c=" ".repeat(i)+"^".repeat(a);n.message+=`:
${o}
${c}
`}};function we(t,{flow:e,indicator:n,next:s,offset:r,onError:i,parentIndent:o,startOnNewline:a}){let l=!1,c=a,u=a,f="",p="",h=!1,g=!1,m=null,d=null,b=null,k=null,S=null,E=null,N=null;for(let w of t)switch(g&&(w.type!=="space"&&w.type!=="newline"&&w.type!=="comma"&&i(w.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),m&&(c&&w.type!=="comment"&&w.type!=="newline"&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),w.type){case"space":!e&&(n!=="doc-start"||s?.type!=="flow-collection")&&w.source.includes(" ")&&(m=w),u=!0;break;case"comment":{u||i(w,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=w.source.substring(1)||" ";f?f+=p+M:f=M,p="",c=!1;break}case"newline":c?f?f+=w.source:(!E||n!=="seq-item-ind")&&(l=!0):p+=w.source,c=!0,h=!0,(d||b)&&(k=w),u=!0;break;case"anchor":d&&i(w,"MULTIPLE_ANCHORS","A node can have at most one anchor"),w.source.endsWith(":")&&i(w.offset+w.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),d=w,N??(N=w.offset),c=!1,u=!1,g=!0;break;case"tag":{b&&i(w,"MULTIPLE_TAGS","A node can have at most one tag"),b=w,N??(N=w.offset),c=!1,u=!1,g=!0;break}case n:(d||b)&&i(w,"BAD_PROP_ORDER",`Anchors and tags must be after the ${w.source} indicator`),E&&i(w,"UNEXPECTED_TOKEN",`Unexpected ${w.source} in ${e??"collection"}`),E=w,c=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&i(w,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=w,c=!1,u=!1;break}default:i(w,"UNEXPECTED_TOKEN",`Unexpected ${w.type} token`),c=!1,u=!1}let A=t[t.length-1],L=A?A.offset+A.source.length:r;return g&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&i(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(c&&m.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:E,spaceBefore:l,comment:f,hasNewline:h,anchor:d,tag:b,newlineAfterProp:k,end:L,start:N??L}}function Be(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(Be(e.key)||Be(e.value))return!0}return!1;default:return!0}}function Yt(t,e,n){if(e?.type==="flow-collection"){let s=e.end[0];s.indent===t&&(s.source==="]"||s.source==="}")&&Be(e)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Qn(t,e,n){let{uniqueKeys:s}=t.options;if(s===!1)return!1;let r=typeof s=="function"?s:(i,o)=>i===o||C(i)&&C(o)&&i.value===o.value;return e.some(i=>r(i.key,n))}var Ii="All mapping items must start at the same column";function Li({composeNode:t,composeEmptyNode:e},n,s,r,i){let o=i?.nodeClass??x,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let l=s.offset,c=null;for(let u of s.items){let{start:f,key:p,sep:h,value:g}=u,m=we(f,{indicator:"explicit-key-ind",next:p??h?.[0],offset:l,onError:r,parentIndent:s.indent,startOnNewline:!0}),d=!m.found;if(d){if(p&&(p.type==="block-seq"?r(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==s.indent&&r(l,"BAD_INDENT",Ii)),!m.anchor&&!m.tag&&!h){c=m.end,m.comment&&(a.comment?a.comment+=`
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||Be(p))&&r(p??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==s.indent&&r(l,"BAD_INDENT",Ii);n.atKey=!0;let b=m.end,k=p?t(n,p,m,r):e(n,b,f,null,m,r);n.schema.compat&&Yt(s.indent,p,r),n.atKey=!1,Qn(n,a.items,k)&&r(b,"DUPLICATE_KEY","Map keys must be unique");let S=we(h??[],{indicator:"map-value-ind",next:g,offset:k.range[2],onError:r,parentIndent:s.indent,startOnNewline:!p||p.type==="block-scalar"});if(l=S.end,S.found){d&&(g?.type==="block-map"&&!S.hasNewline&&r(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.start<S.found.offset-1024&&r(k.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let E=g?t(n,g,S,r):e(n,l,h,null,S,r);n.schema.compat&&Yt(s.indent,g,r),l=E.range[2];let N=new v(k,E);n.options.keepSourceTokens&&(N.srcToken=u),a.items.push(N)}else{d&&r(k.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(k.comment?k.comment+=`
`+S.comment:k.comment=S.comment);let E=new v(k);n.options.keepSourceTokens&&(E.srcToken=u),a.items.push(E)}}return c&&c<l&&r(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,l,c??l],a}function Pi({composeNode:t,composeEmptyNode:e},n,s,r,i){let o=i?.nodeClass??F,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=s.offset,c=null;for(let{start:u,value:f}of s.items){let p=we(u,{indicator:"seq-item-ind",next:f,offset:l,onError:r,parentIndent:s.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||f)f?.type==="block-seq"?r(p.end,"BAD_INDENT","All sequence items must start at the same column"):r(l,"MISSING_CHAR","Sequence item without - indicator");else{c=p.end,p.comment&&(a.comment=p.comment);continue}let h=f?t(n,f,p,r):e(n,p.end,u,null,p,r);n.schema.compat&&Yt(s.indent,f,r),l=h.range[2],a.items.push(h)}return a.range=[s.offset,l,c??l],a}function be(t,e,n,s){let r="";if(t){let i=!1,o="";for(let a of t){let{source:l,type:c}=a;switch(c){case"space":i=!0;break;case"comment":{n&&!i&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=l.substring(1)||" ";r?r+=o+u:r=u,o="";break}case"newline":r&&(o+=l),i=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:r,offset:e}}var Ms="Block collections are not allowed within flow collections",$s=t=>t&&(t.type==="block-map"||t.type==="block-seq");function vi({composeNode:t,composeEmptyNode:e},n,s,r,i){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=i?.nodeClass??(o?x:F),c=new l(n.schema);c.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=s.offset+s.start.source.length;for(let d=0;d<s.items.length;++d){let b=s.items[d],{start:k,key:S,sep:E,value:N}=b,A=we(k,{flow:a,indicator:"explicit-key-ind",next:S??E?.[0],offset:f,onError:r,parentIndent:s.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!E&&!N){d===0&&A.comma?r(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):d<s.items.length-1&&r(A.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),A.comment&&(c.comment?c.comment+=`
`+A.comment:c.comment=A.comment),f=A.end;continue}!o&&n.options.strict&&Be(S)&&r(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(d===0)A.comma&&r(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(A.comma||r(A.start,"MISSING_CHAR",`Missing , between ${a} items`),A.comment){let L="";e:for(let w of k)switch(w.type){case"comma":case"space":break;case"comment":L=w.source.substring(1);break e;default:break e}if(L){let w=c.items[c.items.length-1];T(w)&&(w=w.value??w.key),w.comment?w.comment+=`
`+L:w.comment=L,A.comment=A.comment.substring(L.length+1)}}if(!o&&!E&&!A.found){let L=N?t(n,N,A,r):e(n,A.end,E,null,A,r);c.items.push(L),f=L.range[2],$s(N)&&r(L.range,"BLOCK_IN_FLOW",Ms)}else{n.atKey=!0;let L=A.end,w=S?t(n,S,A,r):e(n,L,k,null,A,r);$s(S)&&r(w.range,"BLOCK_IN_FLOW",Ms),n.atKey=!1;let M=we(E??[],{flow:a,indicator:"map-value-ind",next:N,offset:w.range[2],onError:r,parentIndent:s.indent,startOnNewline:!1});if(M.found){if(!o&&!A.found&&n.options.strict){if(E)for(let $ of E){if($===M.found)break;if($.type==="newline"){r($,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}A.start<M.found.offset-1024&&r(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else N&&("source"in N&&N.source?.[0]===":"?r(N,"MISSING_CHAR",`Missing space after : in ${a}`):r(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let Le=N?t(n,N,M,r):M.found?e(n,M.end,E,null,M,r):null;Le?$s(N)&&r(Le.range,"BLOCK_IN_FLOW",Ms):M.comment&&(w.comment?w.comment+=`
`+M.comment:w.comment=M.comment);let Ye=new v(w,Le);if(n.options.keepSourceTokens&&(Ye.srcToken=b),o){let $=c;Qn(n,$.items,w)&&r(L,"DUPLICATE_KEY","Map keys must be unique"),$.items.push(Ye)}else{let $=new x(n.schema);$.flow=!0,$.items.push(Ye);let zs=(Le??w).range;$.range=[w.range[0],zs[1],zs[2]],c.items.push($)}f=Le?Le.range[2]:M.end}}let p=o?"}":"]",[h,...g]=s.end,m=f;if(h?.source===p)m=h.offset+h.source.length;else{let d=a[0].toUpperCase()+a.substring(1),b=u?`${d} must end with a ${p}`:`${d} in block collection must be sufficiently indented and end with a ${p}`;r(f,u?"MISSING_CHAR":"BAD_INDENT",b),h&&h.source.length!==1&&g.unshift(h)}if(g.length>0){let d=be(g,m,n.options.strict,r);d.comment&&(c.comment?c.comment+=`
`+d.comment:c.comment=d.comment),c.range=[s.offset,m,d.offset]}else c.range=[s.offset,m,m];return c}function Bs(t,e,n,s,r,i){let o=n.type==="block-map"?Li(t,e,n,s,i):n.type==="block-seq"?Pi(t,e,n,s,i):vi(t,e,n,s,i),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function Di(t,e,n,s,r){let i=s.tag,o=i?e.directives.tagName(i.source,p=>r(i,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){let{anchor:p,newlineAfterProp:h}=s,g=p&&i?p.offset>i.offset?p:i:p??i;g&&(!h||h.offset<g.offset)&&r(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!i||!o||o==="!"||o===x.tagName&&a==="map"||o===F.tagName&&a==="seq")return Bs(t,e,n,r,o);let l=e.schema.tags.find(p=>p.tag===o&&p.collection===a);if(!l){let p=e.schema.knownTags[o];if(p?.collection===a)e.schema.tags.push(Object.assign({},p,{default:!1})),l=p;else return p?r(i,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0):r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Bs(t,e,n,r,o)}let c=Bs(t,e,n,r,o,l),u=l.resolve?.(c,p=>r(i,"TAG_RESOLVE_FAILED",p),e.options)??c,f=_(u)?u:new y(u);return f.range=c.range,f.tag=o,l?.format&&(f.format=l.format),f}function Hn(t,e,n){let s=e.offset,r=Oa(e,t.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[s,s,s]};let i=r.mode===">"?y.BLOCK_FOLDED:y.BLOCK_LITERAL,o=e.source?_a(e.source):[],a=o.length;for(let m=o.length-1;m>=0;--m){let d=o[m][1];if(d===""||d==="\r")a=m;else break}if(a===0){let m=r.chomp==="+"&&o.length>0?`
`.repeat(Math.max(1,o.length-1)):"",d=s+r.length;return e.source&&(d+=e.source.length),{value:m,type:i,comment:r.comment,range:[s,d,d]}}let l=e.indent+r.indent,c=e.offset+r.length,u=0;for(let m=0;m<a;++m){let[d,b]=o[m];if(b===""||b==="\r")r.indent===0&&d.length>l&&(l=d.length);else{d.length<l&&n(c+d.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(l=d.length),u=m,l===0&&!t.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=d.length+b.length+1}for(let m=o.length-1;m>=a;--m)o[m][0].length>l&&(a=m+1);let f="",p="",h=!1;for(let m=0;m<u;++m)f+=o[m][0].slice(l)+`
`;for(let m=u;m<a;++m){let[d,b]=o[m];c+=d.length+b.length+1;let k=b[b.length-1]==="\r";if(k&&(b=b.slice(0,-1)),b&&d.length<l){let E=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(c-b.length-(k?2:1),"BAD_INDENT",E),d=""}i===y.BLOCK_LITERAL?(f+=p+d.slice(l)+b,p=`
`):d.length>l||b[0]===" "?(p===" "?p=`
`:!h&&p===`
`&&(p=`
`),f+=p+d.slice(l)+b,p=`
`,h=!0):b===""?p===`
`?f+=`
`:p=`
`:(f+=p+b,p=" ",h=!1)}switch(r.chomp){case"-":break;case"+":for(let m=a;m<o.length;++m)f+=`
`+o[m][0].slice(l);f[f.length-1]!==`
`&&(f+=`
`);break;default:f+=`
`}let g=s+r.length+e.source.length;return{value:f,type:i,comment:r.comment,range:[s,g,g]}}function Oa({offset:t,props:e},n,s){if(e[0].type!=="block-scalar-header")return s(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],i=r[0],o=0,a="",l=-1;for(let p=1;p<r.length;++p){let h=r[p];if(!a&&(h==="-"||h==="+"))a=h;else{let g=Number(h);!o&&g?o=g:l===-1&&(l=t+p)}}l!==-1&&s(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let c=!1,u="",f=r.length;for(let p=1;p<e.length;++p){let h=e[p];switch(h.type){case"space":c=!0;case"newline":f+=h.source.length;break;case"comment":n&&!c&&s(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=h.source.length,u=h.source.substring(1);break;case"error":s(h,"UNEXPECTED_TOKEN",h.message),f+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;s(h,"UNEXPECTED_TOKEN",g);let m=h.source;m&&typeof m=="string"&&(f+=m.length)}}}return{mode:i,indent:o,chomp:a,comment:u,length:f}}function _a(t){let e=t.split(/\n( *)/),n=e[0],s=n.match(/^( *)/),i=[s?.[1]?[s[1],n.slice(s[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)i.push([e[o],e[o+1]]);return i}function Jn(t,e,n){let{offset:s,type:r,source:i,end:o}=t,a,l,c=(p,h,g)=>n(s+p,h,g);switch(r){case"scalar":a=y.PLAIN,l=Ia(i,c);break;case"single-quoted-scalar":a=y.QUOTE_SINGLE,l=La(i,c);break;case"double-quoted-scalar":a=y.QUOTE_DOUBLE,l=Pa(i,c);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[s,s+i.length,s+i.length]}}let u=s+i.length,f=be(o,u,e,n);return{value:l,type:a,comment:f.comment,range:[s,u,f.offset]}}function Ia(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),xi(t)}function La(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),xi(t.slice(1,-1)).replace(/''/g,"'")}function xi(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let s=e.exec(t);if(!s)return t;let r=s[1],i=" ",o=e.lastIndex;for(n.lastIndex=o;s=n.exec(t);)s[1]===""?i===`
`?r+=i:i=`
`:(r+=i+s[1],i=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,s=a.exec(t),r+i+(s?.[1]??"")}function Pa(t,e){let n="";for(let s=1;s<t.length-1;++s){let r=t[s];if(!(r==="\r"&&t[s+1]===`
`))if(r===`
`){let{fold:i,offset:o}=va(t,s);n+=i,s=o}else if(r==="\\"){let i=t[++s],o=Da[i];if(o)n+=o;else if(i===`
`)for(i=t[s+1];i===" "||i===" ";)i=t[++s+1];else if(i==="\r"&&t[s+1]===`
`)for(i=t[++s+1];i===" "||i===" ";)i=t[++s+1];else if(i==="x"||i==="u"||i==="U"){let a=i==="x"?2:i==="u"?4:8;n+=xa(t,s+1,a,e),s+=a}else{let a=t.substr(s-1,2);e(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(r===" "||r===" "){let i=s,o=t[s+1];for(;o===" "||o===" ";)o=t[++s+1];o!==`
`&&!(o==="\r"&&t[s+2]===`
`)&&(n+=s>i?t.slice(i,s+1):r)}else n+=r}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function va(t,e){let n="",s=t[e+1];for(;(s===" "||s===" "||s===`
`||s==="\r")&&!(s==="\r"&&t[e+2]!==`
`);)s===`
`&&(n+=`
`),e+=1,s=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Da={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function xa(t,e,n,s){let r=t.substr(e,n),o=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let a=t.substr(e-2,n+2);return s(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function Rs(t,e,n,s){let{value:r,type:i,comment:o,range:a}=e.type==="block-scalar"?Hn(t,e,s):Jn(e,t.options.strict,s),l=n?t.directives.tagName(n.source,f=>s(n,"TAG_RESOLVE_FAILED",f)):null,c;t.options.stringKeys&&t.atKey?c=t.schema[ee]:l?c=Ma(t.schema,r,l,n,s):e.type==="scalar"?c=$a(t,r,e,s):c=t.schema[ee];let u;try{let f=c.resolve(r,p=>s(n??e,"TAG_RESOLVE_FAILED",p),t.options);u=C(f)?f:new y(f)}catch(f){let p=f instanceof Error?f.message:String(f);s(n??e,"TAG_RESOLVE_FAILED",p),u=new y(r)}return u.range=a,u.source=r,i&&(u.type=i),l&&(u.tag=l),c.format&&(u.format=c.format),o&&(u.comment=o),u}function Ma(t,e,n,s,r){if(n==="!")return t[ee];let i=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)i.push(a);else return a;for(let a of i)if(a.test?.test(e))return a;let o=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[ee])}function $a({atKey:t,directives:e,schema:n},s,r,i){let o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(s))||n[ee];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(s))??n[ee];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),u=`Value may be parsed as either ${l} or ${c}`;i(r,"TAG_RESOLVE_FAILED",u,!0)}}return o}function Mi(t,e,n){if(e){n??(n=e.length);for(let s=n-1;s>=0;--s){let r=e[s];switch(r.type){case"space":case"comment":case"newline":t-=r.source.length;continue}for(r=e[++s];r?.type==="space";)t+=r.source.length,r=e[++s];break}}return t}var Ba={composeNode:qs,composeEmptyNode:Wn};function qs(t,e,n,s){let r=t.atKey,{spaceBefore:i,comment:o,anchor:a,tag:l}=n,c,u=!0;switch(e.type){case"alias":c=Ra(t,e,s),(a||l)&&s(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=Rs(t,e,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Di(Ba,t,e,n,s),a&&(c.anchor=a.source.substring(1))}catch(f){let p=f instanceof Error?f.message:String(f);s(e,"RESOURCE_EXHAUSTION",p)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",f),u=!1}}return c??(c=Wn(t,e.offset,void 0,null,n,s)),a&&c.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&t.options.stringKeys&&(!C(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&s(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),t.options.keepSourceTokens&&u&&(c.srcToken=e),c}function Wn(t,e,n,s,{spaceBefore:r,comment:i,anchor:o,tag:a,end:l},c){let u={type:"scalar",offset:Mi(e,n,s),indent:-1,source:""},f=Rs(t,u,a,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(f.spaceBefore=!0),i&&(f.comment=i,f.range[2]=l),f}function Ra({options:t},{offset:e,source:n,end:s},r){let i=new de(n.substring(1));i.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&r(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+n.length,a=be(s,o,t.strict,r);return i.range=[e,o,a.offset],a.comment&&(i.comment=a.comment),i}function $i(t,e,{offset:n,start:s,value:r,end:i},o){let a=Object.assign({_directives:e},t),l=new ye(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=we(s,{indicator:"doc-start",next:r??i?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(l.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=r?qs(c,r,u,o):Wn(c,u.end,s,null,u,o);let f=l.contents.range[2],p=be(i,f,!1,o);return p.comment&&(l.comment=p.comment),l.range=[n,f,p.offset],l}function Ut(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function Bi(t){let e="",n=!1,s=!1;for(let r=0;r<t.length;++r){let i=t[r];switch(i[0]){case"#":e+=(e===""?"":s?`
`:`
`)+(i.substring(1)||" "),n=!0,s=!1;break;case"%":t[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:e,afterEmptyLine:s}}var _e=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,r,i)=>{let o=Ut(n);i?this.warnings.push(new ut(o,s,r)):this.errors.push(new te(o,s,r))},this.directives=new he({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:s,afterEmptyLine:r}=Bi(this.prelude);if(s){let i=e.contents;if(n)e.comment=e.comment?`${e.comment}
${s}`:s;else if(r||e.directives.docStart||!i)e.commentBefore=s;else if(I(i)&&!i.flow&&i.items.length>0){let o=i.items[0];T(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s}
${a}`:s}else{let o=i.commentBefore;i.commentBefore=o?`${s}
${o}`:s}}if(n){for(let i=0;i<this.errors.length;++i)e.errors.push(this.errors[i]);for(let i=0;i<this.warnings.length;++i)e.warnings.push(this.warnings[i])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Bi(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,s=-1){for(let r of e)yield*this.next(r);yield*this.end(n,s)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(n,s,r)=>{let i=Ut(e);i[0]+=n,this.onError(i,"BAD_DIRECTIVE",s,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=$i(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,s=new te(Ut(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){let s="Unexpected doc-end without preceding document";this.errors.push(new te(Ut(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let n=be(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let s=this.doc.comment;this.doc.comment=s?`${s}
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new te(Ut(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let s=Object.assign({_directives:this.directives},this.options),r=new ye(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};var Us={};Qt(Us,{BOM:()=>jt,DOCUMENT:()=>Vt,FLOW_END:()=>Gt,SCALAR:()=>pt,createScalarToken:()=>qi,isCollection:()=>Ka,isScalar:()=>Ya,prettyToken:()=>Ua,resolveAsScalar:()=>Ri,setScalarValue:()=>Fi,stringify:()=>Yi,tokenType:()=>Ys,visit:()=>Re});function Ri(t,e=!0,n){if(t){let s=(r,i,o)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,i,o);else throw new te([a,a+1],i,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Jn(t,e,s);case"block-scalar":return Hn({options:{strict:e}},t,s)}}return null}function qi(t,e){let{implicitKey:n=!1,indent:s,inFlow:r=!1,offset:i=-1,type:o="PLAIN"}=e,a=Te({type:o,value:t},{implicitKey:n,indent:s>0?" ".repeat(s):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:s,source:`
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
`),u=a.substring(0,c),f=a.substring(c+1)+`
`,p=[{type:"block-scalar-header",offset:i,indent:s,source:u}];return Ki(p,l)||p.push({type:"newline",offset:-1,indent:s,source:`
`}),{type:"block-scalar",offset:i,indent:s,props:p,source:f}}case'"':return{type:"double-quoted-scalar",offset:i,indent:s,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:i,indent:s,source:a,end:l};default:return{type:"scalar",offset:i,indent:s,source:a,end:l}}}function Fi(t,e,n={}){let{afterKey:s=!1,implicitKey:r=!1,inFlow:i=!1,type:o}=n,a="indent"in t?t.indent:null;if(s&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=t.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=Te({type:o,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":qa(t,l);break;case'"':Fs(t,l,"double-quoted-scalar");break;case"'":Fs(t,l,"single-quoted-scalar");break;default:Fs(t,l,"scalar")}}function qa(t,e){let n=e.indexOf(`
`),s=e.substring(0,n),r=e.substring(n+1)+`
`;if(t.type==="block-scalar"){let i=t.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=s,t.source=r}else{let{offset:i}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:s}];Ki(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
`});for(let l of Object.keys(t))l!=="type"&&l!=="offset"&&delete t[l];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:r})}}function Ki(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function Fs(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let s=t.props.slice(1),r=e.length;t.props[0].type==="block-scalar-header"&&(r-=t.props[0].source.length);for(let i of s)i.offset+=r;delete t.props,Object.assign(t,{type:n,source:e,end:s});break}case"block-map":case"block-seq":{let r={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
`};delete t.items,Object.assign(t,{type:n,source:e,end:[r]});break}default:{let s="indent"in t?t.indent:-1,r="end"in t&&Array.isArray(t.end)?t.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(t))i!=="type"&&i!=="offset"&&delete t[i];Object.assign(t,{type:n,indent:s,source:e,end:r})}}}var Yi=t=>"type"in t?zn(t):Xn(t);function zn(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=zn(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Xn(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Xn(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Xn(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function Xn({start:t,key:e,sep:n,value:s}){let r="";for(let i of t)r+=i.source;if(e&&(r+=zn(e)),n)for(let i of n)r+=i.source;return s&&(r+=zn(s)),r}var Ks=Symbol("break visit"),Fa=Symbol("skip children"),Ui=Symbol("remove item");function Re(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),ji(Object.freeze([]),t,e)}Re.BREAK=Ks;Re.SKIP=Fa;Re.REMOVE=Ui;Re.itemAtPath=(t,e)=>{let n=t;for(let[s,r]of e){let i=n?.[s];if(i&&"items"in i)n=i.items[r];else return}return n};Re.parentCollection=(t,e)=>{let n=Re.itemAtPath(t,e.slice(0,-1)),s=e[e.length-1][0],r=n?.[s];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function ji(t,e,n){let s=n(e,t);if(typeof s=="symbol")return s;for(let r of["key","value"]){let i=e[r];if(i&&"items"in i){for(let o=0;o<i.items.length;++o){let a=ji(Object.freeze(t.concat([[r,o]])),i.items[o],n);if(typeof a=="number")o=a-1;else{if(a===Ks)return Ks;a===Ui&&(i.items.splice(o,1),o-=1)}}typeof s=="function"&&r==="key"&&(s=s(e,t))}}return typeof s=="function"?s(e,t):s}var jt="\uFEFF",Vt="",Gt="",pt="",Ka=t=>!!t&&"items"in t,Ya=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Ua(t){switch(t){case jt:return"<BOM>";case Vt:return"<DOC>";case Gt:return"<FLOW_END>";case pt:return"<SCALAR>";default:return JSON.stringify(t)}}function Ys(t){switch(t){case jt:return"byte-order-mark";case Vt:return"doc-mode";case Gt:return"flow-error-end";case pt:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
`:case`\r
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function ue(t){switch(t){case void 0:case" ":case`
`:case"\r":case" ":return!0;default:return!1}}var Vi=new Set("0123456789ABCDEFabcdef"),ja=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Zn=new Set(",[]{}"),Va=new Set(` ,[]{}
\r `),js=t=>!t||Va.has(t),mt=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
`?!0:n==="\r"?this.buffer[e+1]===`
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let s=0;for(;n===" ";)n=this.buffer[++s+e];if(n==="\r"){let r=this.buffer[s+e+1];if(r===`
`||!r&&!this.atEnd)return e+s+1}return n===`
`||s>=this.indentNext||!n&&!this.atEnd?e+s:-1}if(n==="-"||n==="."){let s=this.buffer.substr(e,3);if((s==="---"||s==="...")&&ue(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===jt&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,s=e.indexOf("#");for(;s!==-1;){let i=e[s-1];if(i===" "||i===" "){n=s-1;break}else s=e.indexOf("#",s+1)}for(;;){let i=e[n-1];if(i===" "||i===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield Vt,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&ue(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ue(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ue(n)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(js),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,s=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((s!==-1&&s<this.indentNext&&r[0]!=="#"||s===0&&(r.startsWith("---")||r.startsWith("..."))&&ue(r[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield Gt,yield*this.parseLineStart();let i=0;for(;r[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-i),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(js),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ue(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let i=0;for(;this.buffer[n-1-i]==="\\";)i+=1;if(i%2===0)break;n=this.buffer.indexOf('"',n+1)}let s=this.buffer.substring(0,n),r=s.indexOf(`
`,this.pos);if(r!==-1){for(;r!==-1;){let i=this.continueScalar(r+1);if(i===-1)break;r=s.indexOf(`
`,i)}r!==-1&&(n=r-(s[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>ue(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,s;e:for(let i=this.pos;s=this.buffer[i];++i)switch(s){case" ":n+=1;break;case`
`:e=i,n=0;break;case"\r":{let o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
`)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(s=this.buffer[r];s===" ";)s=this.buffer[++r];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===`
`;)s=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let i=e-1,o=this.buffer[i];o==="\r"&&(o=this.buffer[--i]);let a=i;for(;o===" ";)o=this.buffer[--i];if(o===`
`&&i>=this.pos&&i+1+n>a)e=i;else break}while(!0);return yield pt,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,s=this.pos-1,r;for(;r=this.buffer[++s];)if(r===":"){let i=this.buffer[s+1];if(ue(i)||e&&Zn.has(i))break;n=s}else if(ue(r)){let i=this.buffer[s+1];if(r==="\r"&&(i===`
`?(s+=1,r=`
`,i=this.buffer[s+1]):n=s),i==="#"||e&&Zn.has(i))break;if(r===`
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(e&&Zn.has(r))break;n=s}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield pt,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(js),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,s=this.charAt(1);if(ue(s)||n&&Zn.has(s)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!ue(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(ja.has(n))n=this.buffer[++e];else if(n==="%"&&Vi.has(this.buffer[e+1])&&Vi.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
`?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||e&&s===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(e){let n=this.pos,s=this.buffer[n];for(;!e(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};var qe=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,s=this.lineStarts.length;for(;n<s;){let i=n+s>>1;this.lineStarts[i]<e?n=i+1:s=i}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let r=this.lineStarts[n-1];return{line:n,col:e-r+1}}}};function Fe(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Gi(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Hi(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function es(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function ht(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function ts(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function Qi(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Fe(e.start,"explicit-key-ind")&&!Fe(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Hi(e.value)?e.value.end?ts(e.value.end,e.sep):e.value.end=e.sep:ts(e.start,e.sep),delete e.sep)}var Ie=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new mt,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let s of this.lexer.lex(e,n))yield*this.next(s);n||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=Ys(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let s=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Qi(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{let r=s.items[s.items.length-1];if(r.value){s.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=s.items[s.items.length-1];r.value?s.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=s.items[s.items.length-1];!r||r.value?s.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&Gi(r.start)===-1&&(n.indent===0||r.start.every(i=>i.type!=="comment"||i.indent<n.indent))&&(s.type==="document"?s.end=r.start:s.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Gi(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=es(this.peek(2)),s=ht(n),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let s="end"in n.value?n.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){ts(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let s=!this.onKeyLine&&this.indent===e.indent,r=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",i=[];if(r&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let l=n.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Fe(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Hi(n.key)&&!Fe(n.sep,"newline")){let o=ht(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else i.length>0?n.sep=n.sep.concat(i,this.sourceToken):n.sep.push(this.sourceToken);else if(Fe(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=ht(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Fe(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);r||n.value?(e.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Fe(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&e.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let s="end"in n.value?n.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){ts(r,n.start),r.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||Fe(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let s=this.startBlockValue(e);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let s=this.startBlockValue(e);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{let s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===e.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){let r=es(s),i=ht(r);Qi(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
`,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=es(e),s=ht(n);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=es(e),s=ht(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function Ji(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new qe||null,prettyErrors:e}}function Wi(t,e={}){let{lineCounter:n,prettyErrors:s}=Ji(e),r=new Ie(n?.addNewLine),i=new _e(e),o=Array.from(i.compose(r.parse(t)));if(s&&n)for(let a of o)a.errors.forEach(Kt(t,n)),a.warnings.forEach(Kt(t,n));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function Vs(t,e={}){let{lineCounter:n,prettyErrors:s}=Ji(e),r=new Ie(n?.addNewLine),i=new _e(e),o=null;for(let a of i.compose(r.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new te(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(o.errors.forEach(Kt(t,n)),o.warnings.forEach(Kt(t,n))),o}function Xi(t,e,n){let s;typeof e=="function"?s=e:n===void 0&&e&&typeof e=="object"&&(n=e);let r=Vs(t,n);if(!r)return null;if(r.warnings.forEach(i=>In(r.options.logLevel,i)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:s},n))}function zi(t,e,n){let s=null;if(typeof e=="function"||Array.isArray(e)?s=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(t===void 0){let{keepUndefined:r}=n??e??{};if(!r)return}return ne(t)&&!s?t.toString(n):new ye(t,s,n).toString(n)}var Zi=Gs;function eo(t,e,n){let s=t.srcToken;if(!s||s.type!=="flow-collection")throw new Error("Expected flow-collection CST node for flow sequence");let r=t.items.map((o,a)=>{let l=s.items[a];if(Ga(o,l))return Ce(ie(o.items),l,e,_t);if(T(o))return Ce(o,l,e,_t);{let c=[];for(let f of q(l.start)){if(Ee(f)){c.push(f);continue}if(f.type==="comma")continue;throw new Error(`Unexpected token type in sequence item start: ${f.type}`)}let u=e.transformNode(o,{tokens:c});return ti(Z(u.position.start,u.position.end),u)}});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 q(s.end)){if(o.type==="comment"){e.transformComment(o);continue}if(o.type==="flow-seq-end"){i=o;continue}throw new Error(`Unexpected token type in flow seq end: ${o.type}`)}if(!i)throw new Error("Expected flow-seq-end token");return ei(e.transformRange([s.start.offset,i.offset+i.source.length]),e.transformContentProperties(t,n.tokens),r)}function Ga(t,e){if(t.srcToken)return!1;if(!U(t))return!1;return t.items.length!==1?!1:t.items[0].srcToken===e}function ss(t,e,n){return{type:"mapping",position:t,leadingComments:[],...e,children:n}}function rs(t,e,n){return{type:"mappingItem",position:t,leadingComments:[],children:[e,n]}}function to(t,e,n){let s=t.srcToken;if(!s||s.type!=="block-map")throw new Error("Expected block mapping srcToken");let r=t.items.map((i,o)=>{let a=s.items[o];return Ce(i,a,e,rs)});if(t.items.length<s.items.length)for(let i=t.items.length;i<s.items.length;i++){let o=s.items[i];for(let a of D(o.start,e))throw new Error(`Unexpected token type in collection item start: ${a.type}`)}return ss(Z(r[0].position.start,ie(r).position.end),e.transformContentProperties(t,n.tokens),r)}function Qs(t,e,n){return{type:"plain",position:t,leadingComments:[],trailingComment:null,...e,value:n}}function no(t,e,n){for(let s=e;s>=0;s--)if(n.test(t[s]))return s;return-1}function so(t,e,n){if(t.range[0]===t.range[1]){let r=no(e.text,t.range[0]-1,/\S/u)+1;return Qs(e.transformRange([r,r]),e.transformContentProperties(t,n.tokens),"")}let s=t.srcToken;if(!s||s.type!=="scalar")throw new Error("Expected plain scalar srcToken");for(let r of D(s.end,e))throw new Error(`Unexpected token type in plain scalar end: ${r.type}`);return Qs(e.transformRange(t.range),e.transformContentProperties(t,n.tokens),t.source)}function ro(t){return{...t,type:"quoteDouble"}}function io(t,e,n){return{type:"quoteValue",position:t,...e,leadingComments:[],trailingComment:null,value:n}}function is(t,e,n,s){for(let r of D(e.end,n))throw new Error(`Unexpected token type in quote value end: ${r.type}`);return io(n.transformRange(t.range),n.transformContentProperties(t,s.tokens),t.source)}function oo(t,e,n){let s=t.srcToken;if(!s||s.type!=="double-quoted-scalar")throw new Error("Expected double-quoted scalar srcToken");return ro(is(t,s,e,n))}function ao(t){return{...t,type:"quoteSingle"}}function lo(t,e,n){let s=t.srcToken;if(!s||s.type!=="single-quoted-scalar")throw new Error("Expected single-quoted scalar srcToken");return ao(is(t,s,e,n))}function co(t,e,n){return{type:"sequence",position:t,leadingComments:[],endComments:[],...e,children:n}}function fo(t,e){return{type:"sequenceItem",position:t,leadingComments:[],trailingComment:null,endComments:[],children:e?[e]:[]}}function uo(t,e,n){let s=t.srcToken;if(!s||s.type!=="block-seq")throw new Error("Expected block sequence srcToken");let r=t.items.map((i,o)=>{let a=s.items[o],l=[],c=null;for(let f of q(a.start)){if(Ee(f)){l.push(f);continue}if(f.type==="seq-item-ind"){c=f;continue}throw new Error(`Unexpected token type in sequence item start: ${f.type}`)}let u=Qa(i,e,{tokens:l});return fo(Z(c?e.transformOffset(c.offset):u.position.start,u?.position.end??e.transformOffset(c.offset+c.source.length)),u)});if(t.items.length<s.items.length)for(let i=t.items.length;i<s.items.length;i++){let o=s.items[i];for(let a of D(o.start,e))throw new Error(`Unexpected token type in collection item start: ${a.type}`)}return co(Z(r[0].position.start,ie(r).position.end),e.transformContentProperties(t,n.tokens),r)}function Qa(t,e,n){if(!T(t))return It(t,n)?(D(n.tokens,e),null):e.transformNode(t,n);let s=t.srcToken,r=Ce(t,s,e,rs);return ss(r.position,e.transformContentProperties(t.key,n.tokens),[r])}function po(t,e,n){if(t==null)return null;if(H(t))return Vr(t,e,n);if(U(t))return t.flow?Zr(t,e,n):to(t,e,n);if(J(t))return t.flow?eo(t,e,n):uo(t,e,n);if(C(t)){switch(t.type){case"BLOCK_FOLDED":return Hr(t,e,n);case"BLOCK_LITERAL":return Wr(t,e,n);case"PLAIN":return so(t,e,n);case"QUOTE_DOUBLE":return oo(t,e,n);case"QUOTE_SINGLE":return lo(t,e,n)}throw new Error(`Unexpected scalar type: ${t.type}`)}throw new Error("Unexpected unknown node type")}function It(t,e){return!t||t.range[0]===t.range[1]&&e.tokens.every(n=>n.type==="comment")}var Ha=class{text;comments=[];#e;constructor(t,e){this.text=t,this.#e=e}transformOffset(t){let{line:e,col:n}=this.#e.linePos(t);return{line:e,column:n,offset:t}}transformRange(t){let[e,n]=t.map(s=>this.transformOffset(s));return Z(e,n)}transformNode(t,e){return po(t,this,e)}transformComment(t){let e=qr(t,this);return this.comments.push(e),e}transformContentProperties(t,e){return Ur(t,e,this)}},mo=Ha;function ho(t,e,n,s,r,i){return{type:"document",position:t,trailingComment:i,directivesEndMarker:e,documentEndMarker:n,children:[s,r]}}function go(t,e,n){return{type:"documentBody",position:t,endComments:n,children:e?[e]:[]}}function yo(t,e,n){for(let s=e;s<t.length;s++)if(n.test(t[s]))return s;return null}function wo(t,e,n,s,r,i,o){let{documentTrailingComment:a,endComments:l,propTokens:c}=Ja(e,n,r,i,o),u=s.contents&&(s.contents.range[0]<s.contents.range[1]||c.some(g=>g.type==="tag"||g.type==="anchor")),f=u?o.transformNode(s.contents,{tokens:c}):null;if(!u)for(let g of D(c,o))throw new Error(`Unexpected token type in empty document body: ${g.type}`);let{position:p,documentEndPoint:h}=Wa(t,s,f,i,o);return{documentBody:go(p,f,l),documentEndPoint:h,documentTrailingComment:a}}function Ja(t,e,n,s,r){let i=[],o=[],a=[];for(let c of t){if(Ee(c)){a.push(c);continue}throw new Error(`Unexpected token type: ${c.type}`)}for(let c of D(n,r))throw new Error(`Unexpected token type: ${c.type}`);let l=s?r.transformOffset(s.offset):null;if(e)for(let c of q(e.end,s?.end)){if(c.type==="comment"){let u=r.transformComment(c);l?l.line===u.position.start.line?o.push(u):u.position.start.line<l.line&&i.push(u):i.push(u);continue}throw new Error(`Unexpected token type: ${c.type}`)}if(o.length>1)throw new Error(`Unexpected multiple document trailing comments at ${ve(o[1].position.start)}`);return{propTokens:a,endComments:i,documentTrailingComment:ie(o)||null}}function Wa(t,e,n,s,r){let i=s?Math.max(0,s.offset-1):yo(r.text,e.range[2],/\S/u)??r.text.length;r.text[i-1]==="\r"&&i--;let o=n!==null?n.position.start.offset:i;if(t){let l=t.offset+t.source.length+1;o<l&&l<=i&&(o=l)}let a=r.transformRange([o,i]);return{position:a,documentEndPoint:s?r.transformOffset(s.offset+s.source.length):a.end}}function bo(t,e,n,s){return{type:"documentHead",position:t,endComments:n,trailingComment:s,children:e}}function ko(t,e,n){return{type:"directive",position:t,leadingComments:[],trailingComment:null,name:e,parameters:n}}function So(t,e){let n=t.source.trim().split(/[\t ]+/),s=n.shift().replace(/^%/,"");return ko(e.transformRange([t.offset,t.offset+t.source.length]),s,n)}function Eo(t,e,n,s){let{directives:r,endCommentCandidates:i}=Xa(t,s),o=[],a=null;if(e){for(let u of q(e.start))if(o.push(u),!a&&u.type==="doc-start"){for(let f of o)if(f.type==="comment"){let p=s.transformComment(f);i.push(p)}o=[],a=u}}let l=za(r,n,a,s),c=null;if(a&&o.length>0){let u=o[0];u.type==="comment"&&s.transformOffset(u.offset).line===l.end.line&&(c=s.transformComment(u),o.shift())}return{documentHead:bo(l,r,a?i:[],c),docStart:a,tokensBeforeBody:o}}function Xa(t,e){let n=[],s=[],r=null;for(let i of t)if(i.type==="comment"){let o=e.transformComment(i);r&&r.position.end.line===o.position.start.line&&!r.trailingComment?(r.trailingComment=o,r.position.end=o.position.end):s.push(o)}else{let o=So(i,e);n.push(o),r=o,s=[]}return{directives:n,endCommentCandidates:s}}function za(t,e,n,s){let r=n?[n.offset,n.offset+n.source.length]:e.contents?[e.contents.range[0],e.contents.range[0]]:[e.range[0],e.range[0]];return t.length!==0&&(r[0]=t[0].position.start.offset),s.transformRange(r)}function Co(t,e){let{documentHead:n,tokensBeforeBody:s,docStart:r}=Eo(t.tokensBeforeBody,t.cstNode,t.node,e),{documentBody:i,documentEndPoint:o,documentTrailingComment:a}=wo(r,s,t.cstNode,t.node,t.tokensAfterBody,t.documentEnd,e);return ho(Z(n.position.start,o),!!r,!!t.documentEnd,n,i,a)}function No(t,e,n){if(t.length===0)return[];let s=[],r=[],i=[],o=null,a=l=>{let c={tokensBeforeBody:[...i,...r],cstNode:l,node:t[s.length],tokensAfterBody:[],documentEnd:null};return s.push(c),i.length=0,r.length=0,c};for(let l of q(e)){if(l.type==="document"){if(s.length>=t.length)throw new Error(`Unexpected 'document' token at ${ve(n.transformOffset(l.offset))}`);o=a(l);continue}if(l.type==="comment"){r.push(l);continue}if(l.type==="directive"){i.push(...r,l),r.length=0;continue}if(l.type==="doc-end"){if(!o||o.documentEnd)throw new Error(`Unexpected 'doc-end' token at ${ve(n.transformOffset(l.offset))}`);o.tokensAfterBody=[...r],r.length=0,o.documentEnd=l;continue}}if(i.length>0){let[l]=i;throw new Error(`Unexpected '${l.type}' token at ${ve(n.transformOffset(l.offset))}`)}return r.length>0&&(o||(o=a(null)),r.length>0&&(o.tokensAfterBody.push(...r),r.length=0)),s.map(l=>Co(l,n))}function Hs(t,e,n,s){let r=e(t);return i=>{s(r,i)&&n(t,r=i)}}function Js(t){if(t===null||!("children"in t))return;let e=t.children;if(e.forEach(Js),t.type==="document"){let[i,o]=t.children;i.position.start.offset===i.position.end.offset?i.position.start=i.position.end=o.position.start:o.position.start.offset===o.position.end.offset&&(o.position.start=o.position.end=i.position.end)}let n=Hs(t.position,Za,el,sl),s=Hs(t.position,tl,nl,rl);"endComments"in t&&t.endComments.length!==0&&(n(t.endComments[0].position.start),s(ie(t.endComments).position.end));let r=e.filter(i=>i!==null);if(r.length!==0){let i=r[0],o=ie(r);n(i.position.start),s(o.position.end),"leadingComments"in i&&i.leadingComments.length!==0&&n(i.leadingComments[0].position.start),"tag"in i&&i.tag&&n(i.tag.position.start),"anchor"in i&&i.anchor&&n(i.anchor.position.start),"trailingComment"in o&&o.trailingComment&&s(o.trailingComment.position.end)}}function Za(t){return t.start}function el(t,e){t.start=e}function tl(t){return t.end}function nl(t,e){t.end=e}function sl(t,e){return e.offset<t.offset}function rl(t,e){return e.offset>t.offset}function Ws(t,e){let n=new qe,s=new mo(t,n),r=new Ie(n.addNewLine),i=new _e({keepSourceTokens:!0,uniqueKeys:e?.uniqueKeys,lineCounter:n,merge:!0}),o=[],a=[...r.parse(t)];for(let f of i.compose(a,!0,t.length)){let{errors:p}=f;if(p.length>0)throw new Ot(s,p[0]);o.push(f)}let l=No(o,a,s),c=s.comments.sort((f,p)=>f.position.start.offset-p.position.end.offset),u=Br(s.transformRange([0,t.length]),l,c);return xr(u),Js(u),u}function il(t,e){let n=new SyntaxError(t+" ("+e.loc.start.line+":"+e.loc.start.column+")");return Object.assign(n,e)}var Ao=il;var ol={uniqueKeys:!1};function al(t){let e;try{e=Ws(t,ol)}catch(n){throw n instanceof Ot?Ao(n.message,{loc:n.position,cause:n}):n}return delete e.comments,e}var ll={astFormat:"yaml",parse:al,hasPragma:br,hasIgnorePragma:kr,locStart:Nt,locEnd:mr};var cl={yaml:Pr};var fl=Zi.parse;export{fl as __parsePrettierYamlConfig,To as default,vr as languages,Dr as options,Xs as parsers,cl as printers};