@shopify/cli
Version:
A CLI tool to build for the Shopify platform
75 lines (73 loc) • 122 kB
JavaScript
import{b as nr,g as Pt}from"./chunk-VPRTJUIN.js";function hr(t){return this[t<0?this.length+t:t]}function Er(t){if(typeof t=="string")return an;if(Array.isArray(t))return ln;if(!t)return;let{type:e}=t;if(mn.has(e))return e}function br(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(gn(t))throw new Error("doc is valid.");let r=Object.prototype.toString.call(t);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let u=Sr([...mn].map(g=>`'${g}'`));return`Unexpected doc.type '${t.type}'.
Expected it to be ${u}.`}function Nr(t,e){if(typeof t=="string")return e(t);let r=new Map;return u(t);function u(y){if(r.has(y))return r.get(y);let b=g(y);return r.set(y,b),b}function g(y){switch(gn(y)){case ln:return e(y.map(u));case Nt:return e({...y,parts:y.parts.map(u)});case Lt:return e({...y,breakContents:u(y.breakContents),flatContents:u(y.flatContents)});case Ot:{let{expandedStates:b,contents:A}=y;return b?(b=b.map(u),A=b[0]):A=u(A),e({...y,contents:A,expandedStates:b})}case wt:case un:case pn:case hn:case At:return e({...y,contents:u(y.contents)});case an:case cn:case fn:case dn:case De:case Mt:return e(y);default:throw new Or(y)}}}function Lr(t,e=gt){return Nr(t,r=>typeof r=="string"?pe(e,r.split(`
`)):r)}function nt(t,e){return Mr(t),Be(e),{type:wt,contents:e,n:t}}function $t(t){return nt(Number.NEGATIVE_INFINITY,t)}function Tr(t){return nt({type:"root"},t)}function xr(t){return nt(-1,t)}function vn(t){return Ar(t),{type:Nt,parts:t}}function Xe(t,e={}){return Be(t),yn(e.expandedStates,!0),{type:Ot,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function Rt(t,e){return Xe(t[0],{...e,expandedStates:t})}function mt(t,e="",r={}){return Be(t),e!==""&&Be(e),{type:Lt,breakContents:t,flatContents:e,groupId:r.groupId}}function pe(t,e){Be(t),yn(e);let r=[];for(let u=0;u<e.length;u++)u!==0&&r.push(t),r.push(e[u]);return r}function Ir(t){return Be(t),{type:At,contents:t}}function rt(t){return(e,r,u)=>{let g=!!u?.backwards;if(r===!1)return!1;let{length:y}=e,b=r;for(;b>=0&&b<y;){let A=e.charAt(b);if(t instanceof RegExp){if(!t.test(A))return b}else if(!t.includes(A))return b;g?b--:b++}return b===-1||b===y?b:!1}}function Pr(t,e,r){let u=!!r?.backwards;if(e===!1)return!1;let g=t.charAt(e);if(u){if(t.charAt(e-1)==="\r"&&g===`
`)return e-2;if(Yt(g))return e-1}else{if(g==="\r"&&t.charAt(e+1)===`
`)return e+2;if(Yt(g))return e+1}return e}function $r(t,e){let r=e-1;r=_t(t,r,{backwards:!0}),r=Bt(t,r,{backwards:!0}),r=_t(t,r,{backwards:!0});let u=Bt(t,r,{backwards:!0});return r!==u}function bn(t,e){switch(t.type){case"comment":if(jr(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}}function wn(t,e){let{node:r}=t;if(r.type==="root"&&e.filepath&&/(?:[/\\]|^)\.(?:prettier|stylelint|lintstaged)rc$/u.test(e.filepath))return async u=>{let g=await u(e.originalText,{parser:"json"});return g?[g,H]:void 0}}function Ue(t){if(Fe!==null&&typeof Fe.property){let e=Fe;return Fe=Ue.prototype=null,e}return Fe=Ue.prototype=t??Object.create(null),new Ue}function Jr(t){return Ue(t)}function Gr(t,e="type"){Jr(t);function r(u){let g=u[e],y=t[g];if(!Array.isArray(y))throw Object.assign(new Error(`Missing visitor keys for '${g}'.`),{node:u});return y}return r}function ti(t){return Array.isArray(t)&&t.length>0}function Oe(t,e){return typeof t?.type=="string"&&e.includes(t.type)}function On(t,e,r){return e("children"in t?{...t,children:t.children.map(u=>On(u,e,t))}:t,r)}function qe(t,e,r){Object.defineProperty(t,e,{get:r,enumerable:!1})}function ni(t,e){let r=0,u=e.length;for(let g=t.position.end.offset-1;g<u;g++){let y=e[g];if(y===`
`&&r++,r===1&&/\S/u.test(y))return!1;if(r===2)return!0}return!1}function Nn(t){let{node:e}=t;switch(e.type){case"tag":case"anchor":case"comment":return!1}let r=t.stack.length;for(let u=1;u<r;u++){let g=t.stack[u],y=t.stack[u-1];if(Array.isArray(y)&&typeof g=="number"&&g!==y.length-1)return!1}return!0}function yt(t){return Je(t.children)?yt(ve(0,t.children,-1)):t}function Dt(t){return t.value.trim()==="prettier-ignore"}function ri(t){let{node:e}=t;if(e.type==="documentBody"){let r=t.parent.head;return ye(r)&&Dt(ve(0,r.endComments,-1))}return xe(e)&&Dt(ve(0,e.leadingComments,-1))}function Ze(t){return!Je(t.children)&&!ii(t)}function ii(t){return xe(t)||_e(t)||Ln(t)||be(t)||ye(t)}function xe(t){return Je(t?.leadingComments)}function _e(t){return Je(t?.middleComments)}function Ln(t){return t?.indicatorComment}function be(t){return t?.trailingComment}function ye(t){return Je(t?.endComments)}function An(t){return t?t.split(/(?<!^| ) (?! |$)/u):[]}function si(t,e,r){let u=e.split(`
`).map((y,b,A)=>b===0&&b===A.length-1?y:b!==0&&b!==A.length-1?y.trim():b===0?y.trimEnd():y.trimStart());if(r.proseWrap==="preserve")return u.map(y=>y?[y]:[]);let g=[];for(let[y,b]of u.entries()){let A=An(b);y>0&&u[y-1].length>0&&A.length>0&&!(t==="quoteDouble"&&ve(0,ve(0,g,-1),-1).endsWith("\\"))?g[g.length-1]=[...ve(0,g,-1),...A]:g.push(A)}return r.proseWrap==="never"?g.map(y=>[y.join(" ")]):g}function oi(t,{parentIndent:e,isLastDescendant:r,options:u}){let g=t.position.start.line===t.position.end.line?"":u.originalText.slice(t.position.start.offset,t.position.end.offset).match(/^[^\n]*\n(.*)$/su)[1],y;if(t.indent===null){let C=g.match(/^(?<leadingSpace> *)[^\n\r ]/mu);y=C?C.groups.leadingSpace.length:Number.POSITIVE_INFINITY}else y=t.indent-1+e;let b=g.split(`
`).map(C=>C.slice(y));if(u.proseWrap==="preserve"||t.type==="blockLiteral")return k(b.map(C=>C?[C]:[]));let A=[];for(let[C,P]of b.entries()){let F=An(P);C>0&&F.length>0&&b[C-1].length>0&&!/^\s/u.test(F[0])&&!/^\s|\s$/u.test(ve(0,A,-1))?A[A.length-1]=[...ve(0,A,-1),...F]:A.push(F)}return A=A.map(C=>{let P=[];for(let F of C)P.length>0&&/\s$/u.test(ve(0,P,-1))?P[P.length-1]+=" "+F:P.push(F);return P}),u.proseWrap==="never"&&(A=A.map(C=>[C.join(" ")])),k(A);function k(C){if(t.chomping==="keep")return ve(0,C,-1).length===0?C.slice(0,-1):C;let P=0;for(let F=C.length-1;F>=0&&C[F].length===0;F--)P++;return P===0?C:P>=2&&!r?C.slice(0,-(P-1)):C.slice(0,-P)}}function vt(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}}function Mn(t,e){let{node:r,root:u}=t,g;return at.has(u)?g=at.get(u):(g=new Set,at.set(u,g)),!g.has(r.position.end.line)&&(g.add(r.position.end.line),ni(r,e)&&!Tn(t.parent))?En:""}function Tn(t){return ye(t)&&!Oe(t,["documentHead","documentBody","flowMapping","flowSequence"])}function ge(t,e){return nt(" ".repeat(t),e)}function ai(t,e,r){let{node:u}=t,g=t.ancestors.filter(C=>C.type==="sequence"||C.type==="mapping").length,y=Nn(t),b=[u.type==="blockFolded"?">":"|"];u.indent!==null&&b.push(u.indent.toString()),u.chomping!=="clip"&&b.push(u.chomping==="keep"?"+":"-"),Ln(u)&&b.push(" ",r("indicatorComment"));let A=oi(u,{parentIndent:g,isLastDescendant:y,options:e}),k=[];for(let[C,P]of A.entries())C===0&&k.push(H),k.push(vn(pe(Qe,P))),C!==A.length-1?k.push(P.length===0?H:Tr(gt)):u.chomping==="keep"&&y&&k.push($t(P.length===0?H:gt));return u.indent===null?b.push(xr(ge(e.tabWidth,k))):b.push($t(ge(u.indent-1+g,k))),b}function Wt(t,e,r){let{node:u}=t,g=u.type==="flowMapping",y=g?"{":"[",b=g?"}":"]",A=En;g&&u.children.length>0&&e.bracketSpacing&&(A=Qe);let k=ve(0,u.children,-1),C=k?.type==="flowMappingItem"&&Ze(k.key)&&Ze(k.value);return[y,ge(e.tabWidth,[A,ci(t,e,r),e.trailingComma==="none"?"":mt(","),ye(u)?[H,pe(H,t.map(r,"endComments"))]:""]),C?"":A,b]}function ci(t,e,r){return t.map(({isLast:u,node:g,next:y})=>[r(),u?"":[",",Qe,g.position.start.line!==y.position.start.line?Mn(t,e.originalText):""]],"children")}function ui(t,e,r){let{node:u,parent:g}=t,{key:y,value:b}=u,A=Ze(y),k=Ze(b);if(A&&k)return": ";let C=r("key"),P=fi(u)?" ":"";if(k)return u.type==="flowMappingItem"&&g.type==="flowMapping"?C:u.type==="mappingItem"&<(y.content,e)&&!be(y.content)&&g.tag?.value!=="tag:yaml.org,2002:set"?[C,P,":"]:["? ",ge(2,C)];let F=r("value");if(A)return[": ",ge(2,F)];if(xe(b)||!vt(y.content))return["? ",ge(2,C),H,...t.map(()=>[r(),H],"value","leadingComments"),": ",ge(2,F)];if(pi(y.content)&&!xe(y.content)&&!_e(y.content)&&!be(y.content)&&!ye(y)&&!xe(b.content)&&!_e(b.content)&&!ye(b)&<(b.content,e))return[C,P,": ",F];let ie=Symbol("mappingKey"),q=Xe([mt("? "),Xe(ge(2,C),{id:ie})]),z=[H,": ",ge(2,F)],K=[P,":"];ye(b)&&b.content&&Oe(b.content,["flowMapping","flowSequence"])&&b.content.children.length===0?K.push(" "):xe(b.content)||ye(b)&&b.content&&!Oe(b.content,["mapping","sequence"])||g.type==="mapping"&&be(y.content)&&vt(b.content)||Oe(b.content,["mapping","sequence"])&&b.content.tag===null&&b.content.anchor===null?K.push(H):b.content?K.push(Qe):be(b)&&K.push(" "),K.push(F);let ee=ge(e.tabWidth,K);return lt(y.content,e)&&!xe(y.content)&&!_e(y.content)&&!be(y.content)&&!ye(y)?Rt([[C,ee]]):Rt([[q,mt(z,ee,{groupId:ie})]])}function lt(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(/\\$/mu.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 ]/u.test(t.value);default:return!1}}function fi(t){return t.key.content?.type==="alias"}function pi(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}}function hi(t){return On(t,mi)}function mi(t){switch(t.type){case"document":qe(t,"head",()=>t.children[0]),qe(t,"body",()=>t.children[1]);break;case"documentBody":case"sequenceItem":case"flowSequenceItem":case"mappingKey":case"mappingValue":qe(t,"content",()=>t.children[0]);break;case"mappingItem":case"flowMappingItem":qe(t,"key",()=>t.children[0]),qe(t,"value",()=>t.children[1]);break}return t}function yi(t,e,r){let{node:u}=t,g=[];u.type!=="mappingValue"&&xe(u)&&g.push([pe(H,t.map(r,"leadingComments")),H]);let{tag:y,anchor:b}=u;y&&g.push(r("tag")),y&&b&&g.push(" "),b&&g.push(r("anchor"));let A="";return Oe(u,["mapping","sequence","comment","directive","mappingItem","sequenceItem"])&&!Nn(t)&&(A=Mn(t,e.originalText)),(y||b)&&(Oe(u,["sequence","mapping"])&&!_e(u)?g.push(H):g.push(" ")),_e(u)&&g.push([u.middleComments.length===1?"":H,pe(H,t.map(r,"middleComments")),H]),ri(t)?g.push(Lr(e.originalText.slice(u.position.start.offset,u.position.end.offset).trimEnd())):g.push(Xe(vi(t,e,r))),be(u)&&!Oe(u,["document","documentHead"])&&g.push(Ir([u.type==="mappingValue"&&!u.content?"":" ",t.parent.type==="mappingKey"&&t.getParentNode(2).type==="mapping"&&vt(u)?"":Tt,r("trailingComment")])),Tn(u)&&g.push(ge(u.type==="sequenceItem"?2:0,[H,pe(H,t.map(({node:k})=>[Sn(e.originalText,xt(k))?H:"",r()],"endComments"))])),g.push(A),g}function vi(t,e,r){let{node:u}=t;switch(u.type){case"root":{let g=yt(u),y=!(Oe(g,["blockLiteral","blockFolded"])&&g.chomping==="keep"),b=[];return t.each(({node:A,isFirst:k})=>{k||b.push(H),b.push(r()),Si(t)&&(y&&b.push(H),b.push("..."),be(A)&&b.push(" ",r("trailingComment")))},"children"),y&&b.push(H),b}case"document":{let g=[];return bi(t)&&((u.head.children.length>0||u.head.endComments.length>0)&&g.push(r("head")),be(u.head)?g.push(["---"," ",r(["head","trailingComment"])]):g.push("---")),Ei(u)&&g.push(r("body")),pe(H,g)}case"documentHead":return pe(H,[...t.map(r,"children"),...t.map(r,"endComments")]);case"documentBody":{let{children:g,endComments:y}=u,b="";if(g.length>0&&y.length>0){let A=yt(u);if(Oe(A,["blockFolded","blockLiteral"]))A.chomping!=="keep"&&(b=[H,H]);else{let k=ve(0,g,-1);b=Oe(k,["mapping"])&&Sn(e.originalText,xt(y[0]))?[H,H]:H}}return[pe(H,t.map(r,"children")),b,pe(H,t.map(r,"endComments"))]}case"directive":return["%",pe(" ",[u.name,...u.parameters])];case"comment":return["#",u.value];case"alias":return["*",u.value];case"tag":return e.originalText.slice(u.position.start.offset,u.position.end.offset);case"anchor":return["&",u.value];case"plain":return Ke(u.type,e.originalText.slice(u.position.start.offset,u.position.end.offset),e);case"quoteDouble":case"quoteSingle":{let g=e.originalText.slice(u.position.start.offset+1,u.position.end.offset-1);if(u.type==="quoteSingle"&&g.includes("\\")||u.type==="quoteDouble"&&/\\[^"]/u.test(g)){let b=u.type==="quoteDouble"?'"':"'";return[b,Ke(u.type,g,e),b]}if(g.includes('"'))return["'",Ke(u.type,u.type==="quoteDouble"?ot(0,ot(0,g,'\\"','"'),"'","'".repeat(2)):g,e),"'"];if(g.includes("'"))return['"',Ke(u.type,u.type==="quoteSingle"?ot(0,g,"''","'"):g,e),'"'];let y=e.singleQuote?"'":'"';return[y,Ke(u.type,g,e),y]}case"blockFolded":case"blockLiteral":return li(t,e,r);case"mapping":case"sequence":return pe(H,t.map(r,"children"));case"sequenceItem":return["- ",ge(2,u.content?r("content"):"")];case"mappingKey":case"mappingValue":return u.content?r("content"):"";case"mappingItem":case"flowMappingItem":return di(t,e,r);case"flowMapping":return Wt(t,e,r);case"flowSequence":return Wt(t,e,r);case"flowSequenceItem":return r("content");default:throw new _r(u,"YAML")}}function Ei(t){return t.body.children.length>0||ye(t.body)}function Si(t){let e=t.node;if(e.documentEndMarker||be(e))return!0;if(t.isLast)return!1;let r=t.next;return r.head.children.length>0||ye(r.head)}function bi(t){let e=t.node;return e.directivesEndMarker||e.head.children.length>0||ye(e.head)||be(e.head)}function Ke(t,e,r){let u=si(t,e,r);return pe(H,u.map(g=>vn(pe(Qe,g))))}function de(t,e=null){"children"in t&&t.children.forEach(r=>de(r,t)),"anchor"in t&&t.anchor&&de(t.anchor,t),"tag"in t&&t.tag&&de(t.tag,t),"leadingComments"in t&&t.leadingComments.forEach(r=>de(r,t)),"middleComments"in t&&t.middleComments.forEach(r=>de(r,t)),"indicatorComment"in t&&t.indicatorComment&&de(t.indicatorComment,t),"trailingComment"in t&&t.trailingComment&&de(t.trailingComment,t),"endComments"in t&&t.endComments.forEach(r=>de(r,t)),Object.defineProperty(t,"_parent",{value:e,enumerable:!1})}function et(t){return`${t.line}:${t.column}`}function Ti(t){de(t);let e=xi(t),r=t.children.slice();t.comments.sort((u,g)=>u.position.start.offset-g.position.end.offset).filter(u=>!u._parent).forEach(u=>{for(;r.length>1&&u.position.start.line>r[0].position.end.line;)r.shift();ki(u,e,r[0])})}function xi(t){let e=Array.from(new Array(t.position.end.line),()=>({}));for(let r of t.comments)e[r.position.start.line-1].comment=r;return kn(e,t),e}function kn(t,e){if(e.position.start.offset!==e.position.end.offset){if("leadingComments"in e){let{start:r}=e.position,{leadingAttachableNode:u}=t[r.line-1];(!u||r.column<u.position.start.column)&&(t[r.line-1].leadingAttachableNode=e)}if("trailingComment"in e&&e.position.end.column>1&&e.type!=="document"&&e.type!=="documentHead"){let{end:r}=e.position,{trailingAttachableNode:u}=t[r.line-1];(!u||r.column>=u.position.end.column)&&(t[r.line-1].trailingAttachableNode=e)}if(e.type!=="root"&&e.type!=="document"&&e.type!=="documentHead"&&e.type!=="documentBody"){let{start:r,end:u}=e.position,g=[u.line].concat(r.line===u.line?[]:r.line);for(let y of g){let b=t[y-1].trailingNode;(!b||u.column>=b.position.end.column)&&(t[y-1].trailingNode=e)}}"children"in e&&e.children.forEach(r=>{kn(t,r)})}}function ki(t,e,r){let u=t.position.start.line,{trailingAttachableNode:g}=e[u-1];if(g){if(g.trailingComment)throw new Error(`Unexpected multiple trailing comment at ${et(t.position.start)}`);de(t,g),g.trailingComment=t;return}for(let b=u;b>=r.position.start.line;b--){let{trailingNode:A}=e[b-1],k;if(A)k=A;else if(b!==u&&e[b-1].comment)k=e[b-1].comment._parent;else continue;if((k.type==="sequence"||k.type==="mapping")&&(k=k.children[0]),k.type==="mappingItem"){let[C,P]=k.children;k=Cn(C)?C:P}for(;;){if(Ci(k,t)){de(t,k),k.endComments.push(t);return}if(!k._parent)break;k=k._parent}break}for(let b=u+1;b<=r.position.end.line;b++){let{leadingAttachableNode:A}=e[b-1];if(A){de(t,A),A.leadingComments.push(t);return}}let y=r.children[1];de(t,y),y.endComments.push(t)}function Ci(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"||Cn(t));default:return!1}}function Cn(t){return t.position.start!==t.position.end&&(t.children.length===0||t.position.start.offset!==t.children[0].position.start.offset)}function le(t,e){return{type:t,position:e}}function Ii(t,e,r){return{...le("root",t),children:e,comments:r}}function ze(t){switch(t.type){case"DOCUMENT":for(let e=t.contents.length-1;e>=0;e--)t.contents[e].type==="BLANK_LINE"?t.contents.splice(e,1):ze(t.contents[e]);for(let e=t.directives.length-1;e>=0;e--)t.directives[e].type==="BLANK_LINE"&&t.directives.splice(e,1);break;case"FLOW_MAP":case"FLOW_SEQ":case"MAP":case"SEQ":for(let e=t.items.length-1;e>=0;e--){let r=t.items[e];"char"in r||(r.type==="BLANK_LINE"?t.items.splice(e,1):ze(r))}break;case"MAP_KEY":case"MAP_VALUE":case"SEQ_ITEM":t.node&&ze(t.node);break;case"ALIAS":case"BLANK_LINE":case"BLOCK_FOLDED":case"BLOCK_LITERAL":case"COMMENT":case"DIRECTIVE":case"PLAIN":case"QUOTE_DOUBLE":case"QUOTE_SINGLE":break;default:throw new Error(`Unexpected node type ${JSON.stringify(t.type)}`)}}function Ie(t,e){return{start:t,end:e}}function Ft(t){return{start:t,end:t}}function Pi(t,e){return{...le("anchor",t),value:e}}function kt(t,e){return{...le("comment",t),value:e}}function $i(t,e,r){return{anchor:e,tag:t,middleComments:r}}function Ri(t,e){return{...le("tag",t),value:e}}function In(t,e,r=()=>!1){let u=t.cstNode,g=[],y=null,b=null,A=null;for(let k of u.props){let C=e.text[k.origStart];switch(C){case Ye.Tag:y=y||k,b=Ri(e.transformRange(k),t.tag);break;case Ye.Anchor:y=y||k,A=Pi(e.transformRange(k),u.anchor);break;case Ye.Comment:{let P=kt(e.transformRange(k),e.text.slice(k.origStart+1,k.origEnd));e.comments.push(P),!r(P)&&y&&y.origEnd<=k.origStart&&k.origEnd<=u.valueRange.origStart&&g.push(P);break}default:throw new Error(`Unexpected leading character ${JSON.stringify(C)}`)}}return $i(b,A,g)}function We(){return{leadingComments:[]}}function it(t=null){return{trailingComment:t}}function $e(){return{...We(),...it()}}function _i(t,e,r){return{...le("alias",t),...$e(),...e,value:r}}function Yi(t,e){let r=t.cstNode;return _i(e.transformRange({origStart:r.valueRange.origStart-1,origEnd:r.valueRange.origEnd}),e.transformContent(t),r.rawValue)}function Bi(t){return{...t,type:"blockFolded"}}function Di(t,e,r,u,g,y){return{...le("blockValue",t),...We(),...e,chomping:r,indent:u,value:g,indicatorComment:y}}function Pn(t,e){let r=t.cstNode,u=1,g=r.chomping==="CLIP"?0:1,y=r.header.origEnd-r.header.origStart-u-g!==0,b=e.transformRange({origStart:r.header.origStart,origEnd:r.valueRange.origEnd}),A=null,k=In(t,e,C=>{if(!(b.start.offset<C.position.start.offset&&C.position.end.offset<b.end.offset))return!1;if(A)throw new Error(`Unexpected multiple indicator comments at ${et(C.position.start)}`);return A=C,!0});return Di(b,k,Et[r.chomping],y?r.blockIndent:null,r.strValue,A)}function Wi(t,e){return Bi(Pn(t,e))}function ji(t){return{...t,type:"blockLiteral"}}function Fi(t,e){return ji(Pn(t,e))}function qi(t,e){return kt(e.transformRange(t.range),t.comment)}function Ki(t,e,r){return{...le("directive",t),...$e(),name:e,parameters:r}}function Ct(t,e){for(let r of t.props){let u=e.text[r.origStart];if(u===Ye.Comment)e.comments.push(kt(e.transformRange(r),e.text.slice(r.origStart+1,r.origEnd)));else throw new Error(`Unexpected leading character ${JSON.stringify(u)}`)}}function Ui(t,e){return Ct(t,e),Ki(e.transformRange(t.range),t.name,t.parameters)}function Vi(t,e,r,u,g,y){return{...le("document",t),...it(y),directivesEndMarker:e,documentEndMarker:r,children:[u,g]}}function Re(t=[]){return{endComments:t}}function Qi(t,e,r){return{...le("documentBody",t),...Re(r),children:e?[e]:[]}}function ke(t){return t[t.length-1]}function $n(t,e){let r=t.match(e);return r?r.index:-1}function Ji(t,e,r){let u=t.cstNode,{comments:g,endComments:y,documentTrailingComment:b,documentHeadTrailingComment:A}=Gi(u,e,r),k=e.transformNode(t.contents),{position:C,documentEndPoint:P}=Hi(u,k,e);return e.comments.push(...g,...y),{documentBody:Qi(C,k,y),documentEndPoint:P,documentTrailingComment:b,documentHeadTrailingComment:A}}function Gi(t,e,r){let u=[],g=[],y=[],b=[],A=!1;for(let k=t.contents.length-1;k>=0;k--){let C=t.contents[k];if(C.type==="COMMENT"){let P=e.transformNode(C);r&&r.line===P.position.start.line?b.unshift(P):A?u.unshift(P):P.position.start.offset>=t.valueRange.origEnd?y.unshift(P):u.unshift(P)}else A=!0}if(y.length>1)throw new Error(`Unexpected multiple document trailing comments at ${et(y[1].position.start)}`);if(b.length>1)throw new Error(`Unexpected multiple documentHead trailing comments at ${et(b[1].position.start)}`);return{comments:u,endComments:g,documentTrailingComment:ke(y)||null,documentHeadTrailingComment:ke(b)||null}}function Hi(t,e,r){let u=$n(r.text.slice(t.valueRange.origEnd),/^\.\.\./),g=u===-1?t.valueRange.origEnd:Math.max(0,t.valueRange.origEnd-1);r.text[g-1]==="\r"&&g--;let y=r.transformRange({origStart:e!==null?e.position.start.offset:g,origEnd:g}),b=u===-1?y.end:r.transformOffset(t.valueRange.origEnd+3);return{position:y,documentEndPoint:b}}function zi(t,e,r,u){return{...le("documentHead",t),...Re(r),...it(u),children:e}}function Xi(t,e){let r=t.cstNode,{directives:u,comments:g,endComments:y}=Zi(r,e),{position:b,documentEndMarkererPoint:A}=es(r,u,e);return e.comments.push(...g,...y),{createDocumentHeadWithTrailingComment:k=>(k&&e.comments.push(k),zi(b,u,y,k)),documentHeadEndMarkerPoint:A}}function Zi(t,e){let r=[],u=[],g=[],y=!1;for(let b=t.directives.length-1;b>=0;b--){let A=e.transformNode(t.directives[b]);A.type==="comment"?y?u.unshift(A):g.unshift(A):(y=!0,r.unshift(A))}return{directives:r,comments:u,endComments:g}}function es(t,e,r){let u=$n(r.text.slice(0,t.valueRange.origStart),/---\s*$/);u>0&&!/[\r\n]/.test(r.text[u-1])&&(u=-1);let g=u===-1?{origStart:t.valueRange.origStart,origEnd:t.valueRange.origStart}:{origStart:u,origEnd:u+3};return e.length!==0&&(g.origStart=e[0].position.start.offset),{position:r.transformRange(g),documentEndMarkererPoint:u===-1?null:r.transformOffset(u)}}function ts(t,e){let{createDocumentHeadWithTrailingComment:r,documentHeadEndMarkerPoint:u}=Xi(t,e),{documentBody:g,documentEndPoint:y,documentTrailingComment:b,documentHeadTrailingComment:A}=Ji(t,e,u),k=r(A);b&&e.comments.push(b);let C=t.cstNode;return Vi(Ie(k.position.start,y),!!C.directivesEndMarker,!!C.documentEndMarker,k,g,b)}function Rn(t,e,r){return{...le("flowCollection",t),...$e(),...Re(),...e,children:r}}function ns(t,e,r){return{...Rn(t,e,r),type:"flowMapping"}}function _n(t,e,r){return{...le("flowMappingItem",t),...We(),children:[e,r]}}function st(t,e){let r=[];for(let u of t)u&&"type"in u&&u.type==="COMMENT"?e.comments.push(e.transformNode(u)):r.push(u);return r}function Yn(t){let[e,r]=["?",":"].map(u=>{let g=t.find(y=>"char"in y&&y.char===u);return g?{origStart:g.origOffset,origEnd:g.origOffset+1}:null});return{additionalKeyRange:e,additionalValueRange:r}}function Bn(t,e){let r=e;return u=>t.slice(r,r=u)}function Dn(t){let e=[],r=Bn(t,1),u=!1;for(let g=1;g<t.length-1;g++){let y=t[g];if("char"in y&&y.char===","){e.push(r(g)),r(g+1),u=!1;continue}u=!0}return u&&e.push(r(t.length-1)),e}function qt(t,e){return{...le("mappingKey",t),...it(),...Re(),children:e?[e]:[]}}function Kt(t,e){return{...le("mappingValue",t),...$e(),...Re(),children:e?[e]:[]}}function It(t,e,r,u,g){let y=e.transformNode(t.key),b=e.transformNode(t.value),A=y||u?qt(e.transformRange({origStart:u?u.origStart:y.position.start.offset,origEnd:y?y.position.end.offset:u.origStart+1}),y):null,k=b||g?Kt(e.transformRange({origStart:g?g.origStart:b.position.start.offset,origEnd:b?b.position.end.offset:g.origStart+1}),b):null;return r(Ie(A?A.position.start:k.position.start,k?k.position.end:A.position.end),A||qt(Ft(k.position.start),null),k||Kt(Ft(A.position.end),null))}function rs(t,e){let r=st(t.cstNode.items,e),u=Dn(r),g=t.items.map((A,k)=>{let C=u[k],{additionalKeyRange:P,additionalValueRange:F}=Yn(C);return It(A,e,_n,P,F)}),y=r[0],b=ke(r);return ns(e.transformRange({origStart:y.origOffset,origEnd:b.origOffset+1}),e.transformContent(t),g)}function is(t,e,r){return{...Rn(t,e,r),type:"flowSequence"}}function ss(t,e){return{...le("flowSequenceItem",t),children:[e]}}function os(t,e){let r=st(t.cstNode.items,e),u=Dn(r),g=t.items.map((A,k)=>{if(A.type!=="PAIR"){let C=e.transformNode(A);return ss(Ie(C.position.start,C.position.end),C)}else{let C=u[k],{additionalKeyRange:P,additionalValueRange:F}=Yn(C);return It(A,e,_n,P,F)}}),y=r[0],b=ke(r);return is(e.transformRange({origStart:y.origOffset,origEnd:b.origOffset+1}),e.transformContent(t),g)}function as(t,e,r){return{...le("mapping",t),...We(),...e,children:r}}function ls(t,e,r){return{...le("mappingItem",t),...We(),children:[e,r]}}function cs(t,e){let r=t.cstNode;r.items.filter(b=>b.type==="MAP_KEY"||b.type==="MAP_VALUE").forEach(b=>Ct(b,e));let u=st(r.items,e),g=us(u),y=t.items.map((b,A)=>{let k=g[A],[C,P]=k[0].type==="MAP_VALUE"?[null,k[0].range]:[k[0].range,k.length===1?null:k[1].range];return It(b,e,ls,C,P)});return as(Ie(y[0].position.start,ke(y).position.end),e.transformContent(t),y)}function us(t){let e=[],r=Bn(t,0),u=!1;for(let g=0;g<t.length;g++){if(t[g].type==="MAP_VALUE"){e.push(r(g+1)),u=!1;continue}u&&e.push(r(g)),u=!0}return u&&e.push(r(1/0)),e}function fs(t,e,r){return{...le("plain",t),...$e(),...e,value:r}}function ps(t,e,r){for(let u=e;u>=0;u--)if(r.test(t[u]))return u;return-1}function ds(t,e){let r=t.cstNode;return fs(e.transformRange({origStart:r.valueRange.origStart,origEnd:ps(e.text,r.valueRange.origEnd-1,/\S/)+1}),e.transformContent(t),r.strValue)}function hs(t){return{...t,type:"quoteDouble"}}function ms(t,e,r){return{...le("quoteValue",t),...e,...$e(),value:r}}function Wn(t,e){let r=t.cstNode;return ms(e.transformRange(r.valueRange),e.transformContent(t),r.strValue)}function gs(t,e){return hs(Wn(t,e))}function ys(t){return{...t,type:"quoteSingle"}}function vs(t,e){return ys(Wn(t,e))}function Es(t,e,r){return{...le("sequence",t),...We(),...Re(),...e,children:r}}function Ss(t,e){return{...le("sequenceItem",t),...$e(),...Re(),children:e?[e]:[]}}function bs(t,e){let r=st(t.cstNode.items,e).map((u,g)=>{Ct(u,e);let y=e.transformNode(t.items[g]);return Ss(Ie(e.transformOffset(u.valueRange.origStart),y===null?e.transformOffset(u.valueRange.origStart+1):y.position.end),y)});return Es(Ie(r[0].position.start,ke(r).position.end),e.transformContent(t),r)}function ws(t,e){if(t===null||t.type===void 0&&t.value===null)return null;switch(t.type){case"ALIAS":return Yi(t,e);case"BLOCK_FOLDED":return Wi(t,e);case"BLOCK_LITERAL":return Fi(t,e);case"COMMENT":return qi(t,e);case"DIRECTIVE":return Ui(t,e);case"DOCUMENT":return ts(t,e);case"FLOW_MAP":return rs(t,e);case"FLOW_SEQ":return os(t,e);case"MAP":return cs(t,e);case"PLAIN":return ds(t,e);case"QUOTE_DOUBLE":return gs(t,e);case"QUOTE_SINGLE":return vs(t,e);case"SEQ":return bs(t,e);default:throw new Error(`Unexpected node type ${t.type}`)}}function Ls(t,e,r){let u=new SyntaxError(t);return u.name="YAMLSyntaxError",u.source=e,u.position=r,u}function As(t,e){let r=t.source.range||t.source.valueRange;return Ls(t.message,e.text,e.transformRange(r))}function jn(t){if("children"in t){if(t.children.length===1){let e=t.children[0];if(e.type==="plain"&&e.tag===null&&e.anchor===null&&e.value==="")return t.children.splice(0,1),t}t.children.forEach(jn)}return t}function Ut(t,e,r,u){let g=e(t);return y=>{u(g,y)&&r(t,g=y)}}function Fn(t){if(t===null||!("children"in t))return;let e=t.children;if(e.forEach(Fn),t.type==="document"){let[y,b]=t.children;y.position.start.offset===y.position.end.offset?y.position.start=y.position.end=b.position.start:b.position.start.offset===b.position.end.offset&&(b.position.start=b.position.end=y.position.end)}let r=Ut(t.position,Ms,Ts,Cs),u=Ut(t.position,xs,ks,Is);"endComments"in t&&t.endComments.length!==0&&(r(t.endComments[0].position.start),u(ke(t.endComments).position.end));let g=e.filter(y=>y!==null);if(g.length!==0){let y=g[0],b=ke(g);r(y.position.start),u(b.position.end),"leadingComments"in y&&y.leadingComments.length!==0&&r(y.leadingComments[0].position.start),"tag"in y&&y.tag&&r(y.tag.position.start),"anchor"in y&&y.anchor&&r(y.anchor.position.start),"trailingComment"in b&&b.trailingComment&&u(b.trailingComment.position.end)}}function Ms(t){return t.start}function Ts(t,e){t.start=e}function xs(t){return t.end}function ks(t,e){t.end=e}function Cs(t,e){return e.offset<t.offset}function Is(t,e){return e.offset>t.offset}function Ps(t){let e=jt.default.parseCST(t),r=new Ns(e,t);r.setOrigRanges();let u=e.map(y=>new jt.default.Document({merge:!1,keepCstNodes:!0}).parse(y));for(let y of u)for(let b of y.errors)if(!(b instanceof Mi&&b.message==='Map keys must be unique; "<<" is repeated'))throw As(b,r);u.forEach(y=>ze(y.cstNode));let g=Ii(r.transformRange({origStart:0,origEnd:t.length}),u.map(y=>r.transformNode(y)),r.comments);return Ti(g),Fn(g),jn(g),g}function $s(t,e){let r=new SyntaxError(t+" ("+e.loc.start.line+":"+e.loc.start.column+")");return Object.assign(r,e)}function _s(t){try{let e=Ps(t);return delete e.comments,e}catch(e){throw e?.position?Rs(e.message,{loc:e.position,cause:e}):e}}var rr,St,ir,sr,or,ar,Me,Vt,lr,bt,Pe,cr,Ve,Xt,tn,ur,fr,sn,pr,dr,on,mr,ve,gr,yr,ot,vr,tt,an,ln,cn,un,wt,fn,Ot,Nt,Lt,pn,At,dn,De,hn,Mt,mn,gn,Sr,wr,Or,Be,yn,Ar,Mr,Tt,Qe,En,kr,H,Cr,gt,Fs,_t,qs,Ks,Yt,Bt,Sn,Rr,_r,Yr,Br,Dr,Wr,jr,Fr,qr,Kr,Ur,Vr,Fe,Qr,Hr,ae,zr,Xr,Zr,xt,ei,Je,at,li,di,gi,wi,Oi,Ni,ct,Li,Ai,xn,jt,Ee,Us,Vs,Qs,Js,Gs,Hs,zs,Xs,Zs,Mi,eo,to,Ye,Et,ut,Os,Ns,Rs,Ys,Bs,Ds,Ws,js=nr(()=>{Pt();rr=Object.create,St=Object.defineProperty,ir=Object.getOwnPropertyDescriptor,sr=Object.getOwnPropertyNames,or=Object.getPrototypeOf,ar=Object.prototype.hasOwnProperty,Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Vt=(t,e)=>{for(var r in e)St(t,r,{get:e[r],enumerable:!0})},lr=(t,e,r,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let g of sr(e))!ar.call(t,g)&&g!==r&&St(t,g,{get:()=>e[g],enumerable:!(u=ir(e,g))||u.enumerable});return t},bt=(t,e,r)=>(r=t!=null?rr(or(t)):{},lr(e||!t||!t.__esModule?St(r,"default",{value:t,enumerable:!0}):r,t)),Pe=Me(t=>{"use strict";var e={ANCHOR:"&",COMMENT:"#",TAG:"!",DIRECTIVES_END:"-",DOCUMENT_END:"."},r={ALIAS:"ALIAS",BLANK_LINE:"BLANK_LINE",BLOCK_FOLDED:"BLOCK_FOLDED",BLOCK_LITERAL:"BLOCK_LITERAL",COMMENT:"COMMENT",DIRECTIVE:"DIRECTIVE",DOCUMENT:"DOCUMENT",FLOW_MAP:"FLOW_MAP",FLOW_SEQ:"FLOW_SEQ",MAP:"MAP",MAP_KEY:"MAP_KEY",MAP_VALUE:"MAP_VALUE",PLAIN:"PLAIN",QUOTE_DOUBLE:"QUOTE_DOUBLE",QUOTE_SINGLE:"QUOTE_SINGLE",SEQ:"SEQ",SEQ_ITEM:"SEQ_ITEM"},u="tag:yaml.org,2002:",g={MAP:"tag:yaml.org,2002:map",SEQ:"tag:yaml.org,2002:seq",STR:"tag:yaml.org,2002:str"};function y(l){let i=[0],n=l.indexOf(`
`);for(;n!==-1;)n+=1,i.push(n),n=l.indexOf(`
`,n);return i}function b(l){let i,n;return typeof l=="string"?(i=y(l),n=l):(Array.isArray(l)&&(l=l[0]),l&&l.context&&(l.lineStarts||(l.lineStarts=y(l.context.src)),i=l.lineStarts,n=l.context.src)),{lineStarts:i,src:n}}function A(l,i){if(typeof l!="number"||l<0)return null;let{lineStarts:n,src:s}=b(i);if(!n||!s||l>s.length)return null;for(let p=0;p<n.length;++p){let c=n[p];if(l<c)return{line:p,col:l-n[p-1]+1};if(l===c)return{line:p+1,col:1}}let o=n.length;return{line:o,col:l-n[o-1]+1}}function k(l,i){let{lineStarts:n,src:s}=b(i);if(!n||!(l>=1)||l>n.length)return null;let o=n[l-1],p=n[l];for(;p&&p>o&&s[p-1]===`
`;)--p;return s.slice(o,p)}function C({start:l,end:i},n,s=80){let o=k(l.line,n);if(!o)return null;let{col:p}=l;if(o.length>s)if(p<=s-10)o=o.substr(0,s-1)+"\u2026";else{let x=Math.round(s/2);o.length>p+x&&(o=o.substr(0,p+x-1)+"\u2026"),p-=o.length-s,o="\u2026"+o.substr(1-s)}let c=1,h="";i&&(i.line===l.line&&p+(i.col-l.col)<=s+1?c=i.col-l.col:(c=Math.min(o.length+1,s)-p,h="\u2026"));let E=p>1?" ".repeat(p-1):"",O="^".repeat(c);return`${o}
${E}${O}${h}`}var P=class Qt{static copy(i){return new Qt(i.start,i.end)}constructor(i,n){this.start=i,this.end=n||i}isEmpty(){return typeof this.start!="number"||!this.end||this.end<=this.start}setOrigRange(i,n){let{start:s,end:o}=this;if(i.length===0||o<=i[0])return this.origStart=s,this.origEnd=o,n;let p=n;for(;p<i.length&&!(i[p]>s);)++p;this.origStart=s+p;let c=p;for(;p<i.length&&!(i[p]>=o);)++p;return this.origEnd=o+p,c}},F=class Ae{static addStringTerminator(i,n,s){if(s[s.length-1]===`
`)return s;let o=Ae.endOfWhiteSpace(i,n);return o>=i.length||i[o]===`
`?s+`
`:s}static atDocumentBoundary(i,n,s){let o=i[n];if(!o)return!0;let p=i[n-1];if(p&&p!==`
`)return!1;if(s){if(o!==s)return!1}else if(o!==e.DIRECTIVES_END&&o!==e.DOCUMENT_END)return!1;let c=i[n+1],h=i[n+2];if(c!==o||h!==o)return!1;let E=i[n+3];return!E||E===`
`||E===" "||E===" "}static endOfIdentifier(i,n){let s=i[n],o=s==="<",p=o?[`
`," "," ",">"]:[`
`," "," ","[","]","{","}",","];for(;s&&p.indexOf(s)===-1;)s=i[n+=1];return o&&s===">"&&(n+=1),n}static endOfIndent(i,n){let s=i[n];for(;s===" ";)s=i[n+=1];return n}static endOfLine(i,n){let s=i[n];for(;s&&s!==`
`;)s=i[n+=1];return n}static endOfWhiteSpace(i,n){let s=i[n];for(;s===" "||s===" ";)s=i[n+=1];return n}static startOfLine(i,n){let s=i[n-1];if(s===`
`)return n;for(;s&&s!==`
`;)s=i[n-=1];return n+1}static endOfBlockIndent(i,n,s){let o=Ae.endOfIndent(i,s);if(o>s+n)return o;{let p=Ae.endOfWhiteSpace(i,o),c=i[p];if(!c||c===`
`)return p}return null}static atBlank(i,n,s){let o=i[n];return o===`
`||o===" "||o===" "||s&&!o}static nextNodeIsIndented(i,n,s){return!i||n<0?!1:n>0?!0:s&&i==="-"}static normalizeOffset(i,n){let s=i[n];return s?s!==`
`&&i[n-1]===`
`?n-1:Ae.endOfWhiteSpace(i,n):n}static foldNewline(i,n,s){let o=0,p=!1,c="",h=i[n+1];for(;h===" "||h===" "||h===`
`;){switch(h){case`
`:o=0,n+=1,c+=`
`;break;case" ":o<=s&&(p=!0),n=Ae.endOfWhiteSpace(i,n+2)-1;break;case" ":o+=1,n+=1;break}h=i[n+1]}return c||(c=" "),h&&o<=s&&(p=!0),{fold:c,offset:n,error:p}}constructor(i,n,s){Object.defineProperty(this,"context",{value:s||null,writable:!0}),this.error=null,this.range=null,this.valueRange=null,this.props=n||[],this.type=i,this.value=null}getPropValue(i,n,s){if(!this.context)return null;let{src:o}=this.context,p=this.props[i];return p&&o[p.start]===n?o.slice(p.start+(s?1:0),p.end):null}get anchor(){for(let i=0;i<this.props.length;++i){let n=this.getPropValue(i,e.ANCHOR,!0);if(n!=null)return n}return null}get comment(){let i=[];for(let n=0;n<this.props.length;++n){let s=this.getPropValue(n,e.COMMENT,!0);s!=null&&i.push(s)}return i.length>0?i.join(`
`):null}commentHasRequiredWhitespace(i){let{src:n}=this.context;if(this.header&&i===this.header.end||!this.valueRange)return!1;let{end:s}=this.valueRange;return i!==s||Ae.atBlank(n,s-1)}get hasComment(){if(this.context){let{src:i}=this.context;for(let n=0;n<this.props.length;++n)if(i[this.props[n].start]===e.COMMENT)return!0}return!1}get hasProps(){if(this.context){let{src:i}=this.context;for(let n=0;n<this.props.length;++n)if(i[this.props[n].start]!==e.COMMENT)return!0}return!1}get includesTrailingLines(){return!1}get jsonLike(){return[r.FLOW_MAP,r.FLOW_SEQ,r.QUOTE_DOUBLE,r.QUOTE_SINGLE].indexOf(this.type)!==-1}get rangeAsLinePos(){if(!this.range||!this.context)return;let i=A(this.range.start,this.context.root);if(!i)return;let n=A(this.range.end,this.context.root);return{start:i,end:n}}get rawValue(){if(!this.valueRange||!this.context)return null;let{start:i,end:n}=this.valueRange;return this.context.src.slice(i,n)}get tag(){for(let i=0;i<this.props.length;++i){let n=this.getPropValue(i,e.TAG,!1);if(n!=null){if(n[1]==="<")return{verbatim:n.slice(2,-1)};{let[s,o,p]=n.match(/^(.*!)([^!]*)$/);return{handle:o,suffix:p}}}}return null}get valueRangeContainsNewline(){if(!this.valueRange||!this.context)return!1;let{start:i,end:n}=this.valueRange,{src:s}=this.context;for(let o=i;o<n;++o)if(s[o]===`
`)return!0;return!1}parseComment(i){let{src:n}=this.context;if(n[i]===e.COMMENT){let s=Ae.endOfLine(n,i+1),o=new P(i,s);return this.props.push(o),s}return i}setOrigRanges(i,n){return this.range&&(n=this.range.setOrigRange(i,n)),this.valueRange&&this.valueRange.setOrigRange(i,n),this.props.forEach(s=>s.setOrigRange(i,n)),n}toString(){let{context:{src:i},range:n,value:s}=this;if(s!=null)return s;let o=i.slice(n.start,n.end);return Ae.addStringTerminator(i,n.end,o)}},ie=class extends Error{constructor(l,i,n){if(!n||!(i instanceof F))throw new Error(`Invalid arguments for new ${l}`);super(),this.name=l,this.message=n,this.source=i}makePretty(){if(!this.source)return;this.nodeType=this.source.type;let l=this.source.context&&this.source.context.root;if(typeof this.offset=="number"){this.range=new P(this.offset,this.offset+1);let i=l&&A(this.offset,l);if(i){let n={line:i.line,col:i.col+1};this.linePos={start:i,end:n}}delete this.offset}else this.range=this.source.range,this.linePos=this.source.rangeAsLinePos;if(this.linePos){let{line:i,col:n}=this.linePos.start;this.message+=` at line ${i}, column ${n}`;let s=l&&C(this.linePos,l);s&&(this.message+=`:
${s}
`)}delete this.source}},q=class extends ie{constructor(l,i){super("YAMLReferenceError",l,i)}},z=class extends ie{constructor(l,i){super("YAMLSemanticError",l,i)}},K=class extends ie{constructor(l,i){super("YAMLSyntaxError",l,i)}},ee=class extends ie{constructor(l,i){super("YAMLWarning",l,i)}};function ce(l,i,n){return i in l?Object.defineProperty(l,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):l[i]=n,l}var M=class ft extends F{static endOfLine(i,n,s){let o=i[n],p=n;for(;o&&o!==`
`&&!(s&&(o==="["||o==="]"||o==="{"||o==="}"||o===","));){let c=i[p+1];if(o===":"&&(!c||c===`
`||c===" "||c===" "||s&&c===",")||(o===" "||o===" ")&&c==="#")break;p+=1,o=c}return p}get strValue(){if(!this.valueRange||!this.context)return null;let{start:i,end:n}=this.valueRange,{src:s}=this.context,o=s[n-1];for(;i<n&&(o===`
`||o===" "||o===" ");)o=s[--n-1];let p="";for(let h=i;h<n;++h){let E=s[h];if(E===`
`){let{fold:O,offset:x}=F.foldNewline(s,h,-1);p+=O,h=x}else if(E===" "||E===" "){let O=h,x=s[h+1];for(;h<n&&(x===" "||x===" ");)h+=1,x=s[h+1];x!==`
`&&(p+=h>O?s.slice(O,h+1):E)}else p+=E}let c=s[i];switch(c){case" ":{let h="Plain value cannot start with a tab character";return{errors:[new z(this,h)],str:p}}case"@":case"`":{let h=`Plain value cannot start with reserved character ${c}`;return{errors:[new z(this,h)],str:p}}default:return p}}parseBlockValue(i){let{indent:n,inFlow:s,src:o}=this.context,p=i,c=i;for(let h=o[p];h===`
`&&!F.atDocumentBoundary(o,p+1);h=o[p]){let E=F.endOfBlockIndent(o,n,p+1);if(E===null||o[E]==="#")break;o[E]===`
`?p=E:(c=ft.endOfLine(o,E,s),p=c)}return this.valueRange.isEmpty()&&(this.valueRange.start=i),this.valueRange.end=c,c}parse(i,n){this.context=i;let{inFlow:s,src:o}=i,p=n,c=o[p];return c&&c!=="#"&&c!==`
`&&(p=ft.endOfLine(o,n,s)),this.valueRange=new P(n,p),p=F.endOfWhiteSpace(o,p),p=this.parseComment(p),(!this.hasComment||this.valueRange.isEmpty())&&(p=this.parseBlockValue(p)),p}};t.Char=e,t.Node=F,t.PlainValue=M,t.Range=P,t.Type=r,t.YAMLError=ie,t.YAMLReferenceError=q,t.YAMLSemanticError=z,t.YAMLSyntaxError=K,t.YAMLWarning=ee,t._defineProperty=ce,t.defaultTagPrefix=u,t.defaultTags=g}),cr=Me(t=>{"use strict";var e=Pe(),r=class extends e.Node{constructor(){super(e.Type.BLANK_LINE)}get includesTrailingLines(){return!0}parse(M,l){return this.context=M,this.range=new e.Range(l,l+1),l+1}},u=class extends e.Node{constructor(M,l){super(M,l),this.node=null}get includesTrailingLines(){return!!this.node&&this.node.includesTrailingLines}parse(M,l){this.context=M;let{parseNode:i,src:n}=M,{atLineStart:s,lineStart:o}=M;!s&&this.type===e.Type.SEQ_ITEM&&(this.error=new e.YAMLSemanticError(this,"Sequence items must not have preceding content on the same line"));let p=s?l-o:M.indent,c=e.Node.endOfWhiteSpace(n,l+1),h=n[c],E=h==="#",O=[],x=null;for(;h===`
`||h==="#";){if(h==="#"){let W=e.Node.endOfLine(n,c+1);O.push(new e.Range(c,W)),c=W}else{s=!0,o=c+1;let W=e.Node.endOfWhiteSpace(n,o);n[W]===`
`&&O.length===0&&(x=new r,o=x.parse({src:n},o)),c=e.Node.endOfIndent(n,o)}h=n[c]}if(e.Node.nextNodeIsIndented(h,c-(o+p),this.type!==e.Type.SEQ_ITEM)?this.node=i({atLineStart:s,inCollection:!1,indent:p,lineStart:o,parent:this},c):h&&o>l+1&&(c=o-1),this.node){if(x){let W=M.parent.items||M.parent.contents;W&&W.push(x)}O.length&&Array.prototype.push.apply(this.props,O),c=this.node.range.end}else if(E){let W=O[0];this.props.push(W),c=W.end}else c=e.Node.endOfLine(n,l+1);let _=this.node?this.node.valueRange.end:c;return this.valueRange=new e.Range(l,_),c}setOrigRanges(M,l){return l=super.setOrigRanges(M,l),this.node?this.node.setOrigRanges(M,l):l}toString(){let{context:{src:M},node:l,range:i,value:n}=this;if(n!=null)return n;let s=l?M.slice(i.start,l.range.start)+String(l):M.slice(i.start,i.end);return e.Node.addStringTerminator(M,i.end,s)}},g=class extends e.Node{constructor(){super(e.Type.COMMENT)}parse(M,l){this.context=M;let i=this.parseComment(l);return this.range=new e.Range(l,i),i}};function y(M){let l=M;for(;l instanceof u;)l=l.node;if(!(l instanceof b))return null;let i=l.items.length,n=-1;for(let p=i-1;p>=0;--p){let c=l.items[p];if(c.type===e.Type.COMMENT){let{indent:h,lineStart:E}=c.context;if(h>0&&c.range.start>=E+h)break;n=p}else if(c.type===e.Type.BLANK_LINE)n=p;else break}if(n===-1)return null;let s=l.items.splice(n,i-n),o=s[0].range.start;for(;l.range.end=o,l.valueRange&&l.valueRange.end>o&&(l.valueRange.end=o),l!==M;)l=l.context.parent;return s}var b=class pt extends e.Node{static nextContentHasIndent(l,i,n){let s=e.Node.endOfLine(l,i)+1;i=e.Node.endOfWhiteSpace(l,s);let o=l[i];return o?i>=s+n?!0:o!=="#"&&o!==`
`?!1:pt.nextContentHasIndent(l,i,n):!1}constructor(l){super(l.type===e.Type.SEQ_ITEM?e.Type.SEQ:e.Type.MAP);for(let n=l.props.length-1;n>=0;--n)if(l.props[n].start<l.context.lineStart){this.props=l.props.slice(0,n+1),l.props=l.props.slice(n+1);let s=l.props[0]||l.valueRange;l.range.start=s.start;break}this.items=[l];let i=y(l);i&&Array.prototype.push.apply(this.items,i)}get includesTrailingLines(){return this.items.length>0}parse(l,i){this.context=l;let{parseNode:n,src:s}=l,o=e.Node.startOfLine(s,i),p=this.items[0];p.context.parent=this,this.valueRange=e.Range.copy(p.valueRange);let c=p.range.start-p.context.lineStart,h=i;h=e.Node.normalizeOffset(s,h);let E=s[h],O=e.Node.endOfWhiteSpace(s,o)===h,x=!1;for(;E;){for(;E===`
`||E==="#";){if(O&&E===`
`&&!x){let B=new r;if(h=B.parse({src:s},h),this.valueRange.end=h,h>=s.length){E=null;break}this.items.push(B),h-=1}else if(E==="#"){if(h<o+c&&!pt.nextContentHasIndent(s,h,c))return h;let B=new g;if(h=B.parse({indent:c,lineStart:o,src:s},h),this.items.push(B),this.valueRange.end=h,h>=s.length){E=null;break}}if(o=h+1,h=e.Node.endOfIndent(s,o),e.Node.atBlank(s,h)){let B=e.Node.endOfWhiteSpace(s,h),U=s[B];(!U||U===`
`||U==="#")&&(h=B)}E=s[h],O=!0}if(!E)break;if(h!==o+c&&(O||E!==":")){if(h<o+c){o>i&&(h=o);break}else if(!this.error){let B="All collection items must start at the same column";this.error=new e.YAMLSyntaxError(this,B)}}if(p.type===e.Type.SEQ_ITEM){if(E!=="-"){o>i&&(h=o);break}}else if(E==="-"&&!this.error){let B=s[h+1];if(!B||B===`
`||B===" "||B===" "){let U="A collection cannot be both a mapping and a sequence";this.error=new e.YAMLSyntaxError(this,U)}}let _=n({atLineStart:O,inCollection:!0,indent:c,lineStart:o,parent:this},h);if(!_)return h;if(this.items.push(_),this.valueRange.end=_.valueRange.end,h=e.Node.normalizeOffset(s,_.range.end),E=s[h],O=!1,x=_.includesTrailingLines,E){let B=h-1,U=s[B];for(;U===" "||U===" ";)U=s[--B];U===`
`&&(o=B+1,O=!0)}let W=y(_);W&&Array.prototype.push.apply(this.items,W)}return h}setOrigRanges(l,i){return i=super.setOrigRanges(l,i),this.items.forEach(n=>{i=n.setOrigRanges(l,i)}),i}toString(){let{context:{src:l},items:i,range:n,value:s}=this;if(s!=null)return s;let o=l.slice(n.start,i[0].range.start)+String(i[0]);for(let p=1;p<i.length;++p){let c=i[p],{atLineStart:h,indent:E}=c.context;if(h)for(let O=0;O<E;++O)o+=" ";o+=String(c)}return e.Node.addStringTerminator(l,n.end,o)}},A=class extends e.Node{constructor(){super(e.Type.DIRECTIVE),this.name=null}get parameters(){let M=this.rawValue;return M?M.trim().split(/[ \t]+/):[]}parseName(M){let{src:l}=this.context,i=M,n=l[i];for(;n&&n!==`
`&&n!==" "&&n!==" ";)n=l[i+=1];return this.name=l.slice(M,i),i}parseParameters(M){let{src:l}=this.context,i=M,n=l[i];for(;n&&n!==`
`&&n!=="#";)n=l[i+=1];return this.valueRange=new e.Range(M,i),i}parse(M,l){this.context=M;let i=this.parseName(l+1);return i=this.parseParameters(i),i=this.parseComment(i),this.range=new e.Range(l,i),i}},k=class dt extends e.Node{static startCommentOrEndBlankLine(l,i){let n=e.Node.endOfWhiteSpace(l,i),s=l[n];return s==="#"||s===`
`?n:i}constructor(){super(e.Type.DOCUMENT),this.directives=null,this.contents=null,this.directivesEndMarker=null,this.documentEndMarker=null}parseDirectives(l){let{src:i}=this.context;this.directives=[];let n=!0,s=!1,o=l;for(;!e.Node.atDocumentBoundary(i,o,e.Char.DIRECTIVES_END);)switch(o=dt.startCommentOrEndBlankLine(i,o),i[o]){case`
`:if(n){let p=new r;o=p.parse({src:i},o),o<i.length&&this.directives.push(p)}else o+=1,n=!0;break;case"#":{let p=new g;o=p.parse({src:i},o),this.directives.push(p),n=!1}break;case"%":{let p=new A;o=p.parse({parent:this,src:i},o),this.directives.push(p),s=!0,n=!1}break;default:return s?this.error=new e.YAMLSemanticError(this,"Missing directives-end indicator line"):this.directives.length>0&&(this.contents=this.directives,this.directives=[]),o}return i[o]?(this.directivesEndMarker=new e.Range(o,o+3),o+3):(s?this.error=new e.YAMLSemanticError(this,"Missing directives-end indicator line"):this.directives.length>0&&(this.contents=this.directives,this.directives=[]),o)}parseContents(l){let{parseNode:i,src:n}=this.context;this.contents||(this.contents=[]);let s=l;for(;n[s-1]==="-";)s-=1;let o=e.Node.endOfWhiteSpace(n,l),p=s===l;for(this.valueRange=new e.Range(o);!e.Node.atDocumentBoundary(n,o,e.Char.DOCUMENT_END);){switch(n[o]){case`
`:if(p){let c=new r;o=c.parse({src:n},o),o<n.length&&this.contents.push(c)}else o+=1,p=!0;s=o;break;case"#":{let c=new g;o=c.parse({src:n},o),this.contents.push(c),p=!1}break;default:{let c=e.Node.endOfIndent(n,o),h=i({atLineStart:p,indent:-1,inFlow:!1,inCollection:!1,lineStart:s,parent:this},c);if(!h)return this.valueRange.end=c;this.contents.push(h),o=h.range.end,p=!1;let E=y(h);E&&Array.prototype.push.apply(this.contents,E)}}o=dt.startCommentOrEndBlankLine(n,o)}if(this.valueRange.end=o,n[o]&&(this.documentEndMarker=new e.Range(o,o+3),o+=3,n[o])){if(o=e.Node.endOfWhiteSpace(n,o),n[o]==="#"){let c=new g;o=c.parse({src:n},o),this.contents.push(c)}switch(n[o]){case`
`:o+=1;break;case void 0:break;default:this.error=new e.YAMLSyntaxError(this,"Document end marker line cannot have a non-comment suffix")}}return o}parse(l,i){l.root=this,this.context=l;let{src:n}=l,s=n.charCodeAt(i)===65279?i+1:i;return s=this.parseDirectives(s),s=this.parseContents(s),s}setOrigRanges(l,i){return i=super.setOrigRanges(l,i),this.directives.forEach(n=>{i=n.setOrigRanges(l,i)}),this.directivesEndMarker&&(i=this.directivesEndMarker.setOrigRange(l,i)),this.contents.forEach(n=>{i=n.setOrigRanges(l,i)}),this.documentEndMarker&&(i=this.documentEndMarker.setOrigRange(l,i)),i}toString(){let{contents:l,directives:i,value:n}=this;if(n!=null)return n;let s=i.join("");return l.length>0&&((i.length>0||l[0].type===e.Type.COMMENT)&&(s+=`---
`),s+=l.join("")),s[s.length-1]!==`
`&&(s+=`
`),s}},C=class extends e.Node{parse(M,l){this.context=M;let{src:i}=M,n=e.Node.endOfIdentifier(i,l+1);return this.valueRange=new e.Range(l+1,n),n=e.Node.endOfWhiteSpace(i,n),n=this.parseComment(n),n}},P={CLIP:"CLIP",KEEP:"KEEP",STRIP:"STRIP"},F=class extends e.Node{constructor(M,l){super(M,l),this.blockIndent=null,this.chomping=P.CLIP,this.header=null}get includesTrailingLines(){return this.chomping===P.KEEP}get strValue(){if(!this.valueRange||!this.context)return null;let{start:M,end:l}=this.valueRange,{indent:i,src:n}=this.context;if(this.valueRange.isEmpty())return"";let s=null,o=n[l-1];for(;o===`
`||o===" "||o===" ";){if(l-=1,l<=M){if(this.chomping===P.KEEP)break;return""}o===`
`&&(s=l),o=n[l-1]}let p=l+1;s&&(this.chomping===P.KEEP?(p=s,l=this.valueRange.end):l=s);let c=i+this.blockIndent,h=this.type===e.Type.BLOCK_FOLDED,E=!0,O="",x="",_=!1;for(let W=M;W<l;++W){for(let U=0;U<c&&n[W]===" ";++U)W+=1;let B=n[W];if(B===`
`)x===`
`?O+=`
`:x=`
`;else{let U=e.Node.endOfLine(n,W),oe=n.slice(W,U);W=U,h&&(B===" "||B===" ")&&W<p?(x===" "?x=`
`:!_&&!E&&x===`
`&&(x=`
`),O+=x+oe,x=U<l&&n[U]||"",_=!0):(O+=x+oe,x=h&&W<p?" ":`
`,_=!1),E&&oe!==""&&(E=!1)}}return this.chomping===P.STRIP?O:O+`
`}parseBlockHeader(M){let{src:l}=this.context,i=M+1,n="";for(;;){let s=l[i];switch(s){case"-":this.chomping=P.STRIP;break;case"+":this.chomping=P.KEEP;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n+=s;break;default:return this.blockIndent=Number(n)||null,this.header=new e.Range(M,i),i}i+=1}}parseBlockValue(M){let{indent:l,src:i}=this.context,n=!!this.blockIndent,s=M,o=M,p=1;for(let c=i[s];c===`
`&&(s+=1,!e.Node.atDocumentBoundary(i,s));c=i[s]){let h=e.Node.endOfBlockIndent(i,l,s);if(h===null)break;let E=i[h],O=h-(s+l);if(this.blockIndent){if(E&&E!==`
`&&O<this.blockIndent){if(i[h]==="#")break;if(!this.error){let x=`Block scalars must not be less