@mcp-use/cli 4.0.2-canary.5 → 5.0.0-canary.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ # Third-party notices
2
+
3
+ `@mcp-use/cli` includes a vendored, minified copy of the `yaml` 2.8.3 parser
4
+ in its Node-only Skills discovery entry point.
5
+
6
+ ## yaml
7
+
8
+ Copyright Eemeli Aro <eemeli@gmail.com>
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted, provided that the above
12
+ copyright notice and this permission notice appear in all copies.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
+ PERFORMANCE OF THIS SOFTWARE.
package/dist/bin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as o}from"./chunk-Q53LTBGS.js";import"./chunk-RXKUVCL7.js";import"./chunk-WOT6VMZA.js";import{readFileSync as i}from"fs";import{createRequire as a}from"module";import{dirname as t,join as c,parse as m}from"path";function p(){try{let e=a(import.meta.url).resolve("mcp-use"),n=t(e),s=m(n).root;for(;n!==s;){try{let r=JSON.parse(i(c(n,"package.json"),"utf8"));if(r.name==="mcp-use"&&typeof r.version=="string")return r.version}catch{}n=t(n)}}catch{}}o(process.argv.slice(2),{frameworkVersion:p()??"4.0.2-canary.5"}).then(e=>{process.exitCode=e},e=>{console.error(e instanceof Error?e.message:String(e)),process.exitCode=1});
2
+ import{a as o}from"./chunk-YN5LLEPO.js";import"./chunk-RXKUVCL7.js";import"./chunk-WOT6VMZA.js";import{readFileSync as i}from"fs";import{createRequire as a}from"module";import{dirname as t,join as c,parse as m}from"path";function p(){try{let e=a(import.meta.url).resolve("mcp-use"),n=t(e),s=m(n).root;for(;n!==s;){try{let r=JSON.parse(i(c(n,"package.json"),"utf8"));if(r.name==="mcp-use"&&typeof r.version=="string")return r.version}catch{}n=t(n)}}catch{}}o(process.argv.slice(2),{frameworkVersion:p()??"5.0.0-canary.7"}).then(e=>{process.exitCode=e},e=>{console.error(e instanceof Error?e.message:String(e)),process.exitCode=1});
@@ -0,0 +1,131 @@
1
+ import{createHash as qs}from"crypto";import{existsSync as Us,lstatSync as Ln,readdirSync as Rs,readFileSync as Cn}from"fs";import{basename as Oe,isAbsolute as $n,relative as pe,resolve as Ae,sep as R}from"path";var lt=Symbol.for("yaml.alias"),et=Symbol.for("yaml.document"),G=Symbol.for("yaml.map"),jt=Symbol.for("yaml.pair"),U=Symbol.for("yaml.scalar"),ce=Symbol.for("yaml.seq"),M=Symbol.for("yaml.node.type"),z=e=>!!e&&typeof e=="object"&&e[M]===lt,ke=e=>!!e&&typeof e=="object"&&e[M]===et,ve=e=>!!e&&typeof e=="object"&&e[M]===G,T=e=>!!e&&typeof e=="object"&&e[M]===jt,I=e=>!!e&&typeof e=="object"&&e[M]===U,Se=e=>!!e&&typeof e=="object"&&e[M]===ce;function $(e){if(e&&typeof e=="object")switch(e[M]){case G:case ce:return!0}return!1}function L(e){if(e&&typeof e=="object")switch(e[M]){case lt:case G:case U:case ce:return!0}return!1}var Kt=e=>(I(e)||$(e))&&!!e.anchor,_=Symbol("break visit"),Bt=Symbol("skip children"),q=Symbol("remove node");function ue(e,t){let n=Mt(t);ke(e)?te(null,e.contents,n,Object.freeze([e]))===q&&(e.contents=null):te(null,e,n,Object.freeze([]))}ue.BREAK=_;ue.SKIP=Bt;ue.REMOVE=q;function te(e,t,n,s){let i=Dt(e,t,n,s);if(L(i)||T(i))return Pt(e,s,i),te(e,i,n,s);if(typeof i!="symbol"){if($(t)){s=Object.freeze(s.concat(t));for(let r=0;r<t.items.length;++r){let o=te(r,t.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===_)return _;o===q&&(t.items.splice(r,1),r-=1)}}}else if(T(t)){s=Object.freeze(s.concat(t));let r=te("key",t.key,n,s);if(r===_)return _;r===q&&(t.key=null);let o=te("value",t.value,n,s);if(o===_)return _;o===q&&(t.value=null)}}return i}async function at(e,t){let n=Mt(t);ke(e)?await ne(null,e.contents,n,Object.freeze([e]))===q&&(e.contents=null):await ne(null,e,n,Object.freeze([]))}at.BREAK=_;at.SKIP=Bt;at.REMOVE=q;async function ne(e,t,n,s){let i=await Dt(e,t,n,s);if(L(i)||T(i))return Pt(e,s,i),ne(e,i,n,s);if(typeof i!="symbol"){if($(t)){s=Object.freeze(s.concat(t));for(let r=0;r<t.items.length;++r){let o=await ne(r,t.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===_)return _;o===q&&(t.items.splice(r,1),r-=1)}}}else if(T(t)){s=Object.freeze(s.concat(t));let r=await ne("key",t.key,n,s);if(r===_)return _;r===q&&(t.key=null);let o=await ne("value",t.value,n,s);if(o===_)return _;o===q&&(t.value=null)}}return i}function Mt(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Dt(e,t,n,s){if(typeof n=="function")return n(e,t,s);if(ve(t))return n.Map?.(e,t,s);if(Se(t))return n.Seq?.(e,t,s);if(T(t))return n.Pair?.(e,t,s);if(I(t))return n.Scalar?.(e,t,s);if(z(t))return n.Alias?.(e,t,s)}function Pt(e,t,n){let s=t[t.length-1];if($(s))s.items[e]=n;else if(T(s))e==="key"?s.key=n:s.value=n;else if(ke(s))s.contents=n;else{let i=z(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var _n={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},jn=e=>e.replace(/[!,[\]{}]/g,t=>_n[t]),re=class V{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},V.defaultYaml,t),this.tags=Object.assign({},V.defaultTags,n)}clone(){let t=new V(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new V(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:V.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},V.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:V.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},V.defaultTags),this.atNextDocument=!1);let s=t.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[r,o]=s;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return n(6,`Unsupported YAML version ${r}`,o),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,s,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);let r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(o){return n(String(o)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+jn(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),i;if(t&&s.length>0&&L(t.contents)){let r={};ue(t.contents,(o,l)=>{L(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of s)r==="!!"&&o==="tag:yaml.org,2002:"||(!t||i.some(l=>l.startsWith(o)))&&n.push(`%TAG ${r} ${o}`);return n.join(`
2
+ `)}};re.defaultYaml={explicit:!1,version:"1.2"};re.defaultTags={"!!":"tag:yaml.org,2002:"};function qt(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(t)}return!0}function Ut(e){let t=new Set;return ue(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function Rt(e,t){for(let n=1;;++n){let s=`${e}${n}`;if(!t.has(s))return s}}function Kn(e,t){let n=[],s=new Map,i=null;return{onAnchor:r=>{n.push(r),i??(i=Ut(e));let o=Rt(t,i);return i.add(o),o},setAnchors:()=>{for(let r of n){let o=s.get(r);if(typeof o=="object"&&o.anchor&&(I(o.node)||$(o.node)))o.node.anchor=o.anchor;else{let l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:s}}function se(e,t,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;i<r;++i){let o=s[i],l=se(e,s,String(i),o);l===void 0?delete s[i]:l!==o&&(s[i]=l)}else if(s instanceof Map)for(let i of Array.from(s.keys())){let r=s.get(i),o=se(e,s,i,r);o===void 0?s.delete(i):o!==r&&s.set(i,o)}else if(s instanceof Set)for(let i of Array.from(s)){let r=se(e,s,i,i);r===void 0?s.delete(i):r!==i&&(s.delete(i),s.add(r))}else for(let[i,r]of Object.entries(s)){let o=se(e,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return e.call(t,n,s)}function B(e,t,n){if(Array.isArray(e))return e.map((s,i)=>B(s,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!Kt(e))return e.toJSON(t,n);let s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=r=>{s.res=r,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!n?.keep?Number(e):e}var ct=class{constructor(e){Object.defineProperty(this,M,{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:t,maxAliasCount:n,onAnchor:s,reviver:i}={}){if(!ke(e))throw new TypeError("A document argument is required");let r={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},o=B(this,"",r);if(typeof s=="function")for(let{count:l,res:a}of r.anchors.values())s(a,l);return typeof i=="function"?se(i,{"":o},"",o):o}},ut=class extends ct{constructor(e){super(lt),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ue(e,{Node:(i,r)=>{(z(r)||Kt(r))&&n.push(r)}}),t&&(t.aliasResolveCache=n));let s;for(let i of n){if(i===this)break;i.anchor===this.source&&(s=i)}return s}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:s,maxAliasCount:i}=t,r=this.resolve(s,t);if(!r){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let o=n.get(r);if(o||(B(r,null,t),o=n.get(r)),o?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=_e(s,r,n)),o.count*o.aliasCount>i)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return o.res}toString(e,t,n){let s=`*${this.source}`;if(e){if(qt(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`${s} `}return s}};function _e(e,t,n){if(z(t)){let s=t.resolve(e),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if($(t)){let s=0;for(let i of t.items){let r=_e(e,i,n);r>s&&(s=r)}return s}else if(T(t)){let s=_e(e,t.key,n),i=_e(e,t.value,n);return Math.max(s,i)}return 1}var Ft=e=>!e||typeof e!="function"&&typeof e!="object",E=class extends ct{constructor(e){super(U),this.value=e}toJSON(e,t){return t?.keep?this.value:B(this.value,e,t)}toString(){return String(this.value)}};E.BLOCK_FOLDED="BLOCK_FOLDED";E.BLOCK_LITERAL="BLOCK_LITERAL";E.PLAIN="PLAIN";E.QUOTE_DOUBLE="QUOTE_DOUBLE";E.QUOTE_SINGLE="QUOTE_SINGLE";var Bn="tag:yaml.org,2002:";function Mn(e,t,n){if(t){let s=n.filter(r=>r.tag===t),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(s=>s.identify?.(e)&&!s.format)}function be(e,t,n){if(ke(e)&&(e=e.contents),L(e))return e;if(T(e)){let u=n.schema[G].createNode?.(n.schema,null,n);return u.items.push(e),u}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=n,a;if(s&&e&&typeof e=="object"){if(a=l.get(e),a)return a.anchor??(a.anchor=i(e)),new ut(a.anchor);a={anchor:null,node:null},l.set(e,a)}t?.startsWith("!!")&&(t=Bn+t.slice(2));let c=Mn(e,t,o.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let u=new E(e);return a&&(a.node=u),u}c=e instanceof Map?o[G]:Symbol.iterator in Object(e)?o[ce]:o[G]}r&&(r(c),delete n.onTagObj);let p=c?.createNode?c.createNode(n.schema,e,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,e,n):new E(e);return t?p.tag=t:c.default||(p.tag=c.tag),a&&(a.node=p),p}function De(e,t,n){let s=n;for(let i=t.length-1;i>=0;--i){let r=t[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=s,s=o}else s=new Map([[r,s]])}return be(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var me=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Vt=class extends ct{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>L(n)||T(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(me(e))this.add(t);else{let[n,...s]=e,i=this.get(n,!0);if($(i))i.addIn(s,t);else if(i===void 0&&this.schema)this.set(n,De(this.schema,s,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let s=this.get(t,!0);if($(s))return s.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...s]=e,i=this.get(n,!0);return s.length===0?!t&&I(i)?i.value:i:$(i)?i.getIn(s,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!T(t))return!1;let n=t.value;return n==null||e&&I(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let s=this.get(t,!0);return $(s)?s.hasIn(n):!1}setIn(e,t){let[n,...s]=e;if(s.length===0)this.set(n,t);else{let i=this.get(n,!0);if($(i))i.setIn(s,t);else if(i===void 0&&this.schema)this.set(n,De(this.schema,s,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}},Dn=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function J(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var H=(e,t,n)=>e.endsWith(`
3
+ `)?J(n,t):n.includes(`
4
+ `)?`
5
+ `+J(n,t):(e.endsWith(" ")?"":" ")+n,Jt="flow",tt="block",je="quoted";function qe(e,t,n="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return e;i<r&&(r=0);let a=Math.max(1+r,1+i-t.length);if(e.length<=a)return e;let c=[],p={},u=i-t.length;typeof s=="number"&&(s>i-Math.max(2,r)?c.push(0):u=i-s);let f,m,b=!1,h=-1,d=-1,k=-1;n===tt&&(h=Et(e,h,t.length),h!==-1&&(u=h+a));for(let g;g=e[h+=1];){if(n===je&&g==="\\"){switch(d=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}k=h}if(g===`
6
+ `)n===tt&&(h=Et(e,h,t.length)),u=h+t.length+a,f=void 0;else{if(g===" "&&m&&m!==" "&&m!==`
7
+ `&&m!==" "){let w=e[h+1];w&&w!==" "&&w!==`
8
+ `&&w!==" "&&(f=h)}if(h>=u)if(f)c.push(f),u=f+a,f=void 0;else if(n===je){for(;m===" "||m===" ";)m=g,g=e[h+=1],b=!0;let w=h>k+1?h-2:d-1;if(p[w])return e;c.push(w),p[w]=!0,u=w+a,f=void 0}else b=!0}m=g}if(b&&l&&l(),c.length===0)return e;o&&o();let y=e.slice(0,c[0]);for(let g=0;g<c.length;++g){let w=c[g],N=c[g+1]||e.length;w===0?y=`
9
+ ${t}${e.slice(0,N)}`:(n===je&&p[w]&&(y+=`${e[w]}\\`),y+=`
10
+ ${t}${e.slice(w+1,N)}`)}return y}function Et(e,t,n){let s=t,i=t+1,r=e[i];for(;r===" "||r===" ";)if(t<i+n)r=e[++t];else{do r=e[++t];while(r&&r!==`
11
+ `);s=t,i=t+1,r=e[i]}return s}var Ue=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Re=e=>/^(%|---|\.\.\.)/m.test(e);function Pn(e,t,n){if(!t||t<0)return!1;let s=t-n,i=e.length;if(i<=s)return!1;for(let r=0,o=0;r<i;++r)if(e[r]===`
12
+ `){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function ye(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=t,i=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(Re(e)?" ":""),o="",l=0;for(let a=0,c=n[a];c;c=n[++a])if(c===" "&&n[a+1]==="\\"&&n[a+2]==="n"&&(o+=n.slice(l,a)+"\\ ",a+=1,l=a,c="\\"),c==="\\")switch(n[a+1]){case"u":{o+=n.slice(l,a);let p=n.substr(a+2,4);switch(p){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:p.substr(0,2)==="00"?o+="\\x"+p.substr(2):o+=n.substr(a,6)}a+=5,l=a+1}break;case"n":if(s||n[a+2]==='"'||n.length<i)a+=1;else{for(o+=n.slice(l,a)+`
13
+
14
+ `;n[a+2]==="\\"&&n[a+3]==="n"&&n[a+4]!=='"';)o+=`
15
+ `,a+=2;o+=r,n[a+2]===" "&&(o+="\\"),a+=1,l=a+1}break;default:a+=1}return o=l?o+n.slice(l):n,s?o:qe(o,r,je,Ue(t,!1))}function nt(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
16
+ `)||/[ \t]\n|\n[ \t]/.test(e))return ye(e,t);let n=t.indent||(Re(e)?" ":""),s="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
17
+ ${n}`)+"'";return t.implicitKey?s:qe(s,n,Jt,Ue(t,!1))}function ie(e,t){let{singleQuote:n}=t.options,s;if(n===!1)s=ye;else{let i=e.includes('"'),r=e.includes("'");i&&!r?s=nt:r&&!i?s=ye:s=n?nt:ye}return s(e,t)}var st;try{st=new RegExp(`(^|(?<!
18
+ ))
19
+ +(?!
20
+ |$)`,"g")}catch{st=/\n+(?!\n|$)/g}function Ke({comment:e,type:t,value:n},s,i,r){let{blockQuote:o,commentString:l,lineWidth:a}=s.options;if(!o||/\n[\t ]+$/.test(n))return ie(n,s);let c=s.indent||(s.forceBlockIndent||Re(n)?" ":""),p=o==="literal"?!0:o==="folded"||t===E.BLOCK_FOLDED?!1:t===E.BLOCK_LITERAL?!0:!Pn(n,a,c.length);if(!n)return p?`|
21
+ `:`>
22
+ `;let u,f;for(f=n.length;f>0;--f){let w=n[f-1];if(w!==`
23
+ `&&w!==" "&&w!==" ")break}let m=n.substring(f),b=m.indexOf(`
24
+ `);b===-1?u="-":n===m||b!==m.length-1?(u="+",r&&r()):u="",m&&(n=n.slice(0,-m.length),m[m.length-1]===`
25
+ `&&(m=m.slice(0,-1)),m=m.replace(st,`$&${c}`));let h=!1,d,k=-1;for(d=0;d<n.length;++d){let w=n[d];if(w===" ")h=!0;else if(w===`
26
+ `)k=d;else break}let y=n.substring(0,k<d?k+1:d);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${c}`));let g=(h?c?"2":"1":"")+u;if(e&&(g+=" "+l(e.replace(/ ?[\r\n]+/g," ")),i&&i()),!p){let w=n.replace(/\n+/g,`
27
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),N=!1,S=Ue(s,!0);o!=="folded"&&t!==E.BLOCK_FOLDED&&(S.onOverflow=()=>{N=!0});let A=qe(`${y}${w}${m}`,c,tt,S);if(!N)return`>${g}
28
+ ${c}${A}`}return n=n.replace(/\n+/g,`$&${c}`),`|${g}
29
+ ${c}${y}${n}${m}`}function qn(e,t,n,s){let{type:i,value:r}=e,{actualString:o,implicitKey:l,indent:a,indentStep:c,inFlow:p}=t;if(l&&r.includes(`
30
+ `)||p&&/[[\]{},]/.test(r))return ie(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||p||!r.includes(`
31
+ `)?ie(r,t):Ke(e,t,n,s);if(!l&&!p&&i!==E.PLAIN&&r.includes(`
32
+ `))return Ke(e,t,n,s);if(Re(r)){if(a==="")return t.forceBlockIndent=!0,Ke(e,t,n,s);if(l&&a===c)return ie(r,t)}let u=r.replace(/\n+/g,`$&
33
+ ${a}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:m,tags:b}=t.doc.schema;if(b.some(f)||m?.some(f))return ie(r,t)}return l?u:qe(u,a,Jt,Ue(t,!1))}function ft(e,t,n,s){let{implicitKey:i,inFlow:r}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:l}=e;l!==E.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=E.QUOTE_DOUBLE);let a=p=>{switch(p){case E.BLOCK_FOLDED:case E.BLOCK_LITERAL:return i||r?ie(o.value,t):Ke(o,t,n,s);case E.QUOTE_DOUBLE:return ye(o.value,t);case E.QUOTE_SINGLE:return nt(o.value,t);case E.PLAIN:return qn(o,t,n,s);default:return null}},c=a(l);if(c===null){let{defaultKeyType:p,defaultStringType:u}=t.options,f=i&&p||u;if(c=a(f),c===null)throw new Error(`Unsupported default string type ${f}`)}return c}function Wt(e,t){let n=Object.assign({blockQuote:!0,commentString:Dn,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},e.schema.toStringOptions,t),s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function Un(e,t){if(t.tag){let i=e.filter(r=>r.tag===t.tag);if(i.length>0)return i.find(r=>r.format===t.format)??i[0]}let n,s;if(I(t)){s=t.value;let i=e.filter(r=>r.identify?.(s));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}n=i.find(r=>r.format===t.format)??i.find(r=>!r.format)}else s=t,n=e.find(i=>i.nodeClass&&s instanceof i.nodeClass);if(!n){let i=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${i} value`)}return n}function Rn(e,t,{anchors:n,doc:s}){if(!s.directives)return"";let i=[],r=(I(e)||$(e))&&e.anchor;r&&qt(r)&&(n.add(r),i.push(`&${r}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(s.directives.tagString(o)),i.join(" ")}function oe(e,t,n,s){if(T(e))return e.toString(t,n,s);if(z(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,r=L(e)?e:t.doc.createNode(e,{onTagObj:a=>i=a});i??(i=Un(t.doc.schema.tags,r));let o=Rn(r,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let l=typeof i.stringify=="function"?i.stringify(r,t,n,s):I(r)?ft(r,t,n,s):r.toString(t,n,s);return o?I(r)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
34
+ ${t.indent}${l}`:l}function Fn({key:e,value:t},n,s,i){let{allNullValues:r,doc:o,indent:l,indentStep:a,options:{commentString:c,indentSeq:p,simpleKeys:u}}=n,f=L(e)&&e.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if($(e)||!L(e)&&typeof e=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let m=!u&&(!e||f&&t==null&&!n.inFlow||$(e)||(I(e)?e.type===E.BLOCK_FOLDED||e.type===E.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(u||!r),indent:l+a});let b=!1,h=!1,d=oe(e,n,()=>b=!0,()=>h=!0);if(!m&&!n.inFlow&&d.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(r||t==null)return b&&s&&s(),d===""?"?":m?`? ${d}`:d}else if(r&&!u||t==null&&m)return d=`? ${d}`,f&&!b?d+=H(d,n.indent,c(f)):h&&i&&i(),d;b&&(f=null),m?(f&&(d+=H(d,n.indent,c(f))),d=`? ${d}
35
+ ${l}:`):(d=`${d}:`,f&&(d+=H(d,n.indent,c(f))));let k,y,g;L(t)?(k=!!t.spaceBefore,y=t.commentBefore,g=t.comment):(k=!1,y=null,g=null,t&&typeof t=="object"&&(t=o.createNode(t))),n.implicitKey=!1,!m&&!f&&I(t)&&(n.indentAtStart=d.length+1),h=!1,!p&&a.length>=2&&!n.inFlow&&!m&&Se(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let w=!1,N=oe(t,n,()=>w=!0,()=>h=!0),S=" ";if(f||k||y){if(S=k?`
36
+ `:"",y){let A=c(y);S+=`
37
+ ${J(A,n.indent)}`}N===""&&!n.inFlow?S===`
38
+ `&&g&&(S=`
39
+
40
+ `):S+=`
41
+ ${n.indent}`}else if(!m&&$(t)){let A=N[0],v=N.indexOf(`
42
+ `),O=v!==-1,C=n.inFlow??t.flow??t.items.length===0;if(O||!C){let F=!1;if(O&&(A==="&"||A==="!")){let x=N.indexOf(" ");A==="&"&&x!==-1&&x<v&&N[x+1]==="!"&&(x=N.indexOf(" ",x+1)),(x===-1||v<x)&&(F=!0)}F||(S=`
43
+ ${n.indent}`)}}else(N===""||N[0]===`
44
+ `)&&(S="");return d+=S+N,n.inFlow?w&&s&&s():g&&!w?d+=H(d,n.indent,c(g)):h&&i&&i(),d}function Vn(e,t){(e==="debug"||e==="warn")&&console.warn(t)}var Te="<<",W={identify:e=>e===Te||typeof e=="symbol"&&e.description===Te,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new E(Symbol(Te)),{addToJSMap:Yt}),stringify:()=>Te},Jn=(e,t)=>(W.identify(t)||I(t)&&(!t.type||t.type===E.PLAIN)&&W.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===W.tag&&n.default);function Yt(e,t,n){if(n=e&&z(n)?n.resolve(e.doc):n,Se(n))for(let s of n.items)Ge(e,t,s);else if(Array.isArray(n))for(let s of n)Ge(e,t,s);else Ge(e,t,n)}function Ge(e,t,n){let s=e&&z(n)?n.resolve(e.doc):n;if(!ve(s))throw new Error("Merge sources must be maps or map aliases");let i=s.toJSON(null,e,Map);for(let[r,o]of i)t instanceof Map?t.has(r)||t.set(r,o):t instanceof Set?t.add(r):Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function Gt(e,t,{key:n,value:s}){if(L(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(Jn(e,n))Yt(e,t,s);else{let i=B(n,"",e);if(t instanceof Map)t.set(i,B(s,i,e));else if(t instanceof Set)t.add(i);else{let r=Wn(n,i,e),o=B(s,r,e);r in t?Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[r]=o}}return t}function Wn(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(L(e)&&n?.doc){let s=Wt(n.doc,{});s.anchors=new Set;for(let r of n.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;let i=e.toString(s);if(!n.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),Vn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function ht(e,t,n){let s=be(e,void 0,n),i=be(t,void 0,n);return new j(s,i)}var j=class Ht{constructor(t,n=null){Object.defineProperty(this,M,{value:jt}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return L(n)&&(n=n.clone(t)),L(s)&&(s=s.clone(t)),new Ht(n,s)}toJSON(t,n){let s=n?.mapAsMap?new Map:{};return Gt(n,s,this)}toString(t,n,s){return t?.doc?Fn(this,t,n,s):JSON.stringify(this)}};function Qt(e,t,n){return(t.inFlow??e.flow?Gn:Yn)(e,t,n)}function Yn({comment:e,items:t},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:l}){let{indent:a,options:{commentString:c}}=n,p=Object.assign({},n,{indent:r,type:null}),u=!1,f=[];for(let b=0;b<t.length;++b){let h=t[b],d=null;if(L(h))!u&&h.spaceBefore&&f.push(""),Pe(n,f,h.commentBefore,u),h.comment&&(d=h.comment);else if(T(h)){let y=L(h.key)?h.key:null;y&&(!u&&y.spaceBefore&&f.push(""),Pe(n,f,y.commentBefore,u))}u=!1;let k=oe(h,p,()=>d=null,()=>u=!0);d&&(k+=H(k,r,c(d))),u&&d&&(u=!1),f.push(s+k)}let m;if(f.length===0)m=i.start+i.end;else{m=f[0];for(let b=1;b<f.length;++b){let h=f[b];m+=h?`
45
+ ${a}${h}`:`
46
+ `}}return e?(m+=`
47
+ `+J(c(e),a),l&&l()):u&&o&&o(),m}function Gn({items:e},t,{flowChars:n,itemIndent:s}){let{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:l}}=t;s+=r;let a=Object.assign({},t,{indent:s,inFlow:!0,type:null}),c=!1,p=0,u=[];for(let b=0;b<e.length;++b){let h=e[b],d=null;if(L(h))h.spaceBefore&&u.push(""),Pe(t,u,h.commentBefore,!1),h.comment&&(d=h.comment);else if(T(h)){let y=L(h.key)?h.key:null;y&&(y.spaceBefore&&u.push(""),Pe(t,u,y.commentBefore,!1),y.comment&&(c=!0));let g=L(h.value)?h.value:null;g?(g.comment&&(d=g.comment),g.commentBefore&&(c=!0)):h.value==null&&y?.comment&&(d=y.comment)}d&&(c=!0);let k=oe(h,a,()=>d=null);c||(c=u.length>p||k.includes(`
48
+ `)),b<e.length-1?k+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=u.reduce((y,g)=>y+g.length+2,2)+(k.length+2)>t.options.lineWidth)),c&&(k+=",")),d&&(k+=H(k,s,l(d))),u.push(k),p=u.length}let{start:f,end:m}=n;if(u.length===0)return f+m;if(!c){let b=u.reduce((h,d)=>h+d.length+2,2);c=t.options.lineWidth>0&&b>t.options.lineWidth}if(c){let b=f;for(let h of u)b+=h?`
49
+ ${r}${i}${h}`:`
50
+ `;return`${b}
51
+ ${i}${m}`}else return`${f}${o}${u.join(" ")}${o}${m}`}function Pe({indent:e,options:{commentString:t}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){let r=J(t(s),e);n.push(r.trimStart())}}function Q(e,t){let n=I(t)?t.value:t;for(let s of e)if(T(s)&&(s.key===t||s.key===n||I(s.key)&&s.key.value===n))return s}var K=class extends Vt{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(G,e),this.items=[]}static from(e,t,n){let{keepUndefined:s,replacer:i}=n,r=new this(e),o=(l,a)=>{if(typeof i=="function")a=i.call(t,l,a);else if(Array.isArray(i)&&!i.includes(l))return;(a!==void 0||s)&&r.items.push(ht(l,a,n))};if(t instanceof Map)for(let[l,a]of t)o(l,a);else if(t&&typeof t=="object")for(let l of Object.keys(t))o(l,t[l]);return typeof e.sortMapEntries=="function"&&r.items.sort(e.sortMapEntries),r}add(e,t){let n;T(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new j(e,e?.value):n=new j(e.key,e.value);let s=Q(this.items,n.key),i=this.schema?.sortMapEntries;if(s){if(!t)throw new Error(`Key ${n.key} already set`);I(s.value)&&Ft(n.value)?s.value.value=n.value:s.value=n.value}else if(i){let r=this.items.findIndex(o=>i(n,o)<0);r===-1?this.items.push(n):this.items.splice(r,0,n)}else this.items.push(n)}delete(e){let t=Q(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Q(this.items,e)?.value;return(!t&&I(n)?n.value:n)??void 0}has(e){return!!Q(this.items,e)}set(e,t){this.add(new j(e,t),!0)}toJSON(e,t,n){let s=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(s);for(let i of this.items)Gt(t,s,i);return s}toString(e,t,n){if(!e)return JSON.stringify(this);for(let s of this.items)if(!T(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Qt(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}},fe={collection:"map",default:!0,nodeClass:K,tag:"tag:yaml.org,2002:map",resolve(e,t){return ve(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>K.from(e,t,n)},X=class extends Vt{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ce,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=xe(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=xe(e);if(typeof n!="number")return;let s=this.items[n];return!t&&I(s)?s.value:s}has(e){let t=xe(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=xe(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let s=this.items[n];I(s)&&Ft(t)?s.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let s=0;for(let i of this.items)n.push(B(i,String(s++),t));return n}toString(e,t,n){return e?Qt(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:s}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let r=0;for(let o of t){if(typeof s=="function"){let l=t instanceof Set?o:String(r++);o=s.call(t,l,o)}i.items.push(be(o,void 0,n))}}return i}};function xe(e){let t=I(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}var he={collection:"seq",default:!0,nodeClass:X,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Se(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>X.from(e,t,n)},Fe={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,s){return t=Object.assign({actualString:!0},t),ft(e,t,n,s)}},Ve={identify:e=>e==null,createNode:()=>new E(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new E(null),stringify:({source:e},t)=>typeof e=="string"&&Ve.test.test(e)?e:t.options.nullStr},pt={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new E(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&pt.test.test(e)){let s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};function P({format:e,minFractionDigits:t,tag:n,value:s}){if(typeof s=="bigint")return String(s);let i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let l=t-(r.length-o-1);for(;l-- >0;)r+="0"}return r}var Xt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:P},zt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():P(e)}},Zt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new E(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:P},Je=e=>typeof e=="bigint"||Number.isInteger(e),dt=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function en(e,t,n){let{value:s}=e;return Je(s)&&s>=0?n+s.toString(t):P(e)}var tn={identify:e=>Je(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>dt(e,2,8,n),stringify:e=>en(e,8,"0o")},nn={identify:Je,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>dt(e,0,10,n),stringify:P},sn={identify:e=>Je(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>dt(e,2,16,n),stringify:e=>en(e,16,"0x")},Hn=[fe,he,Fe,Ve,pt,tn,nn,sn,Xt,zt,Zt];function Nt(e){return typeof e=="bigint"||Number.isInteger(e)}var $e=({value:e})=>JSON.stringify(e),Qn=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:$e},{identify:e=>e==null,createNode:()=>new E(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:$e},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:$e},{identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Nt(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:$e}],Xn={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},zn=[fe,he].concat(Qn,Xn),mt={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let i=0;i<n.length;++i)s[i]=n.charCodeAt(i);return s}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},s,i,r){if(!n)return"";let o=n,l;if(typeof btoa=="function"){let a="";for(let c=0;c<o.length;++c)a+=String.fromCharCode(o[c]);l=btoa(a)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=E.BLOCK_LITERAL),t!==E.QUOTE_DOUBLE){let a=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),c=Math.ceil(l.length/a),p=new Array(c);for(let u=0,f=0;u<c;++u,f+=a)p[u]=l.substr(f,a);l=p.join(t===E.BLOCK_LITERAL?`
52
+ `:" ")}return ft({comment:e,type:t,value:l},s,i,r)}};function rn(e,t){if(Se(e))for(let n=0;n<e.items.length;++n){let s=e.items[n];if(!T(s)){if(ve(s)){s.items.length>1&&t("Each pair must have its own sequence indicator");let i=s.items[0]||new j(new E(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore}
53
+ ${i.key.commentBefore}`:s.commentBefore),s.comment){let r=i.value??i.key;r.comment=r.comment?`${s.comment}
54
+ ${r.comment}`:s.comment}s=i}e.items[n]=T(s)?s:new j(s)}}else t("Expected a sequence for this tag");return e}function on(e,t,n){let{replacer:s}=n,i=new X(e);i.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,String(r++),o));let l,a;if(Array.isArray(o))if(o.length===2)l=o[0],a=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)l=c[0],a=o[l];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else l=o;i.items.push(ht(l,a,n))}return i}var gt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:rn,createNode:on},Be=class ln extends X{constructor(){super(),this.add=K.prototype.add.bind(this),this.delete=K.prototype.delete.bind(this),this.get=K.prototype.get.bind(this),this.has=K.prototype.has.bind(this),this.set=K.prototype.set.bind(this),this.tag=ln.tag}toJSON(t,n){if(!n)return super.toJSON(t);let s=new Map;n?.onCreate&&n.onCreate(s);for(let i of this.items){let r,o;if(T(i)?(r=B(i.key,"",n),o=B(i.value,r,n)):r=B(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(t,n,s){let i=on(t,n,s),r=new this;return r.items=i.items,r}};Be.tag="tag:yaml.org,2002:omap";var yt={collection:"seq",identify:e=>e instanceof Map,nodeClass:Be,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=rn(e,t),s=[];for(let{key:i}of n.items)I(i)&&(s.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Be,n)},createNode:(e,t,n)=>Be.from(e,t,n)};function an({value:e,source:t},n){return t&&(e?cn:un).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var cn={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new E(!0),stringify:an},un={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new E(!1),stringify:an},Zn={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:P},es={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():P(e)}},ts={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new E(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:P},Ee=e=>typeof e=="bigint"||Number.isInteger(e);function We(e,t,n,{intAsBigInt:s}){let i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return i==="-"?BigInt(-1)*o:o}let r=parseInt(e,n);return i==="-"?-1*r:r}function bt(e,t,n){let{value:s}=e;if(Ee(s)){let i=s.toString(t);return s<0?"-"+n+i.substr(1):n+i}return P(e)}var ns={identify:Ee,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>We(e,2,2,n),stringify:e=>bt(e,2,"0b")},ss={identify:Ee,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>We(e,1,8,n),stringify:e=>bt(e,8,"0")},is={identify:Ee,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>We(e,0,10,n),stringify:P},rs={identify:Ee,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>We(e,2,16,n),stringify:e=>bt(e,16,"0x")},Me=class fn extends K{constructor(t){super(t),this.tag=fn.tag}add(t){let n;T(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new j(t.key,null):n=new j(t,null),Q(this.items,n.key)||this.items.push(n)}get(t,n){let s=Q(this.items,t);return!n&&T(s)?I(s.key)?s.key.value:s.key:s}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let s=Q(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new j(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){let{replacer:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),r.items.push(ht(o,null,s));return r}};Me.tag="tag:yaml.org,2002:set";var wt={collection:"map",identify:e=>e instanceof Set,nodeClass:Me,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Me.from(e,t,n),resolve(e,t){if(ve(e)){if(e.hasAllNullValues(!0))return Object.assign(new Me,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function kt(e,t){let n=e[0],s=n==="-"||n==="+"?e.substring(1):e,i=o=>t?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,l)=>o*i(60)+i(l),i(0));return n==="-"?i(-1)*r:r}function hn(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return P(e);let s="";t<0&&(s="-",t*=n(-1));let i=n(60),r=[t%i];return t<60?r.unshift(0):(t=(t-r[0])/i,r.unshift(t%i),t>=60&&(t=(t-r[0])/i,r.unshift(t))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var pn={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>kt(e,n),stringify:hn},dn={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>kt(e,!1),stringify:hn},Ye={identify:e=>e 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(e){let t=e.match(Ye.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,i,r,o,l]=t.map(Number),a=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(n,s-1,i,r||0,o||0,l||0,a),p=t[8];if(p&&p!=="Z"){let u=kt(p,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},Ot=[fe,he,Fe,Ve,cn,un,ns,ss,is,rs,Zn,es,ts,mt,W,yt,gt,wt,pn,dn,Ye],At=new Map([["core",Hn],["failsafe",[fe,he,Fe]],["json",zn],["yaml11",Ot],["yaml-1.1",Ot]]),It={binary:mt,bool:pt,float:Zt,floatExp:zt,floatNaN:Xt,floatTime:dn,int:nn,intHex:sn,intOct:tn,intTime:pn,map:fe,merge:W,null:Ve,omap:yt,pairs:gt,seq:he,set:wt,timestamp:Ye},os={"tag:yaml.org,2002:binary":mt,"tag:yaml.org,2002:merge":W,"tag:yaml.org,2002:omap":yt,"tag:yaml.org,2002:pairs":gt,"tag:yaml.org,2002:set":wt,"tag:yaml.org,2002:timestamp":Ye};function He(e,t,n){let s=At.get(t);if(s&&!e)return n&&!s.includes(W)?s.concat(W):s.slice();let i=s;if(!i)if(Array.isArray(e))i=[];else{let r=Array.from(At.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(let r of e)i=i.concat(r);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(W)),i.reduce((r,o)=>{let l=typeof o=="string"?It[o]:o;if(!l){let a=JSON.stringify(o),c=Object.keys(It).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${a}; use one of ${c}`)}return r.includes(l)||r.push(l),r},[])}var ls=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,as=class mn{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(t)?He(t,"compat"):t?He(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?os:{},this.tags=He(n,this.name,s),this.toStringOptions=l??null,Object.defineProperty(this,G,{value:fe}),Object.defineProperty(this,U,{value:Fe}),Object.defineProperty(this,ce,{value:he}),this.sortMapEntries=typeof o=="function"?o:o===!0?ls:null}clone(){let t=Object.create(mn.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function cs(e,t){let n=[],s=t.directives===!0;if(t.directives!==!1&&e.directives){let a=e.directives.toString(e);a?(n.push(a),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");let i=Wt(e,t),{commentString:r}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");let a=r(e.commentBefore);n.unshift(J(a,""))}let o=!1,l=null;if(e.contents){if(L(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){let p=r(e.contents.commentBefore);n.push(J(p,""))}i.forceBlockIndent=!!e.comment,l=e.contents.comment}let a=l?void 0:()=>o=!0,c=oe(e.contents,i,()=>l=null,a);l&&(c+=H(c,"",r(l))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(oe(e.contents,i));if(e.directives?.docEnd)if(e.comment){let a=r(e.comment);a.includes(`
55
+ `)?(n.push("..."),n.push(J(a,""))):n.push(`... ${a}`)}else n.push("...");else{let a=e.comment;a&&o&&(a=a.replace(/^\n+/,"")),a&&((!o||l)&&n[n.length-1]!==""&&n.push(""),n.push(J(r(a),"")))}return n.join(`
56
+ `)+`
57
+ `}var gn=class yn{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,M,{value:et});let i=null;typeof n=="function"||Array.isArray(n)?i=n:s===void 0&&n&&(s=n,n=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:o}=r;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new re({version:o}),this.setSchema(o,s),this.contents=t===void 0?null:this.createNode(t,i,s)}clone(){let t=Object.create(yn.prototype,{[M]:{value:et}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=L(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Z(this.contents)&&this.contents.add(t)}addIn(t,n){Z(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let s=Ut(this);t.anchor=!n||s.has(n)?Rt(n||"a",s):n}return new ut(t.anchor)}createNode(t,n,s){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){let d=y=>typeof y=="number"||y instanceof String||y instanceof Number,k=n.filter(d).map(String);k.length>0&&(n=n.concat(k)),i=n}else s===void 0&&n&&(s=n,n=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:l,keepUndefined:a,onTagObj:c,tag:p}=s??{},{onAnchor:u,setAnchors:f,sourceObjects:m}=Kn(this,o||"a"),b={aliasDuplicateObjects:r??!0,keepUndefined:a??!1,onAnchor:u,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:m},h=be(t,p,b);return l&&$(h)&&(h.flow=!0),f(),h}createPair(t,n,s={}){let i=this.createNode(t,null,s),r=this.createNode(n,null,s);return new j(i,r)}delete(t){return Z(this.contents)?this.contents.delete(t):!1}deleteIn(t){return me(t)?this.contents==null?!1:(this.contents=null,!0):Z(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return $(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return me(t)?!n&&I(this.contents)?this.contents.value:this.contents:$(this.contents)?this.contents.getIn(t,n):void 0}has(t){return $(this.contents)?this.contents.has(t):!1}hasIn(t){return me(t)?this.contents!==void 0:$(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=De(this.schema,[t],n):Z(this.contents)&&this.contents.set(t,n)}setIn(t,n){me(t)?this.contents=n:this.contents==null?this.contents=De(this.schema,Array.from(t),n):Z(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new re({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new re({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new as(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:s,maxAliasCount:i,onAnchor:r,reviver:o}={}){let l={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=B(this.contents,n??"",l);if(typeof r=="function")for(let{count:c,res:p}of l.anchors.values())r(p,c);return typeof o=="function"?se(o,{"":a},"",a):a}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return cs(this,t)}};function Z(e){if($(e))return!0;throw new Error("Expected a YAML collection as document contents")}var bn=class extends Error{constructor(e,t,n,s){super(),this.name=e,this.code=n,this.message=s,this.pos=t}},ge=class extends bn{constructor(e,t,n){super("YAMLParseError",e,t,n)}},us=class extends bn{constructor(e,t,n){super("YAMLWarning",e,t,n)}},Tt=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));let{line:s,col:i}=n.linePos[0];n.message+=` at line ${s}, column ${i}`;let r=i-1,o=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let l=Math.min(r-39,o.length-79);o="\u2026"+o.substring(l),r-=l-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),s>1&&/^ *$/.test(o.substring(0,r))){let l=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);l.length>80&&(l=l.substring(0,79)+`\u2026
58
+ `),o=l+o}if(/[^ ]/.test(o)){let l=1,a=n.linePos[1];a?.line===s&&a.col>i&&(l=Math.max(1,Math.min(a.col-i,80-r)));let c=" ".repeat(r)+"^".repeat(l);n.message+=`:
59
+
60
+ ${o}
61
+ ${c}
62
+ `}};function le(e,{flow:t,indicator:n,next:s,offset:i,onError:r,parentIndent:o,startOnNewline:l}){let a=!1,c=l,p=l,u="",f="",m=!1,b=!1,h=null,d=null,k=null,y=null,g=null,w=null,N=null;for(let v of e)switch(b&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&r(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b=!1),h&&(c&&v.type!=="comment"&&v.type!=="newline"&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),v.type){case"space":!t&&(n!=="doc-start"||s?.type!=="flow-collection")&&v.source.includes(" ")&&(h=v),p=!0;break;case"comment":{p||r(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let O=v.source.substring(1)||" ";u?u+=f+O:u=O,f="",c=!1;break}case"newline":c?u?u+=v.source:(!w||n!=="seq-item-ind")&&(a=!0):f+=v.source,c=!0,m=!0,(d||k)&&(y=v),p=!0;break;case"anchor":d&&r(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&r(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),d=v,N??(N=v.offset),c=!1,p=!1,b=!0;break;case"tag":{k&&r(v,"MULTIPLE_TAGS","A node can have at most one tag"),k=v,N??(N=v.offset),c=!1,p=!1,b=!0;break}case n:(d||k)&&r(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),w&&r(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${t??"collection"}`),w=v,c=n==="seq-item-ind"||n==="explicit-key-ind",p=!1;break;case"comma":if(t){g&&r(v,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),g=v,c=!1,p=!1;break}default:r(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),c=!1,p=!1}let S=e[e.length-1],A=S?S.offset+S.source.length:i;return b&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(c&&h.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:g,found:w,spaceBefore:a,comment:u,hasNewline:m,anchor:d,tag:k,newlineAfterProp:y,end:A,start:N??A}}function we(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
63
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(we(t.key)||we(t.value))return!0}return!1;default:return!0}}function it(e,t,n){if(t?.type==="flow-collection"){let s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&we(t)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function wn(e,t,n){let{uniqueKeys:s}=e.options;if(s===!1)return!1;let i=typeof s=="function"?s:(r,o)=>r===o||I(r)&&I(o)&&r.value===o.value;return t.some(r=>i(r.key,n))}var xt="All mapping items must start at the same column";function fs({composeNode:e,composeEmptyNode:t},n,s,i,r){let o=r?.nodeClass??K,l=new o(n.schema);n.atRoot&&(n.atRoot=!1);let a=s.offset,c=null;for(let p of s.items){let{start:u,key:f,sep:m,value:b}=p,h=le(u,{indicator:"explicit-key-ind",next:f??m?.[0],offset:a,onError:i,parentIndent:s.indent,startOnNewline:!0}),d=!h.found;if(d){if(f&&(f.type==="block-seq"?i(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==s.indent&&i(a,"BAD_INDENT",xt)),!h.anchor&&!h.tag&&!m){c=h.end,h.comment&&(l.comment?l.comment+=`
64
+ `+h.comment:l.comment=h.comment);continue}(h.newlineAfterProp||we(f))&&i(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==s.indent&&i(a,"BAD_INDENT",xt);n.atKey=!0;let k=h.end,y=f?e(n,f,h,i):t(n,k,u,null,h,i);n.schema.compat&&it(s.indent,f,i),n.atKey=!1,wn(n,l.items,y)&&i(k,"DUPLICATE_KEY","Map keys must be unique");let g=le(m??[],{indicator:"map-value-ind",next:b,offset:y.range[2],onError:i,parentIndent:s.indent,startOnNewline:!f||f.type==="block-scalar"});if(a=g.end,g.found){d&&(b?.type==="block-map"&&!g.hasNewline&&i(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<g.found.offset-1024&&i(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let w=b?e(n,b,g,i):t(n,a,m,null,g,i);n.schema.compat&&it(s.indent,b,i),a=w.range[2];let N=new j(y,w);n.options.keepSourceTokens&&(N.srcToken=p),l.items.push(N)}else{d&&i(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),g.comment&&(y.comment?y.comment+=`
65
+ `+g.comment:y.comment=g.comment);let w=new j(y);n.options.keepSourceTokens&&(w.srcToken=p),l.items.push(w)}}return c&&c<a&&i(c,"IMPOSSIBLE","Map comment with trailing content"),l.range=[s.offset,a,c??a],l}function hs({composeNode:e,composeEmptyNode:t},n,s,i,r){let o=r?.nodeClass??X,l=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let a=s.offset,c=null;for(let{start:p,value:u}of s.items){let f=le(p,{indicator:"seq-item-ind",next:u,offset:a,onError:i,parentIndent:s.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(a,"MISSING_CHAR","Sequence item without - indicator");else{c=f.end,f.comment&&(l.comment=f.comment);continue}let m=u?e(n,u,f,i):t(n,f.end,p,null,f,i);n.schema.compat&&it(s.indent,u,i),a=m.range[2],l.items.push(m)}return l.range=[s.offset,a,c??a],l}function Ne(e,t,n,s){let i="";if(e){let r=!1,o="";for(let l of e){let{source:a,type:c}=l;switch(c){case"space":r=!0;break;case"comment":{n&&!r&&s(l,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let p=a.substring(1)||" ";i?i+=o+p:i=p,o="";break}case"newline":i&&(o+=a),r=!0;break;default:s(l,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=a.length}}return{comment:i,offset:t}}var Qe="Block collections are not allowed within flow collections",Xe=e=>e&&(e.type==="block-map"||e.type==="block-seq");function ps({composeNode:e,composeEmptyNode:t},n,s,i,r){let o=s.start.source==="{",l=o?"flow map":"flow sequence",a=r?.nodeClass??(o?K:X),c=new a(n.schema);c.flow=!0;let p=n.atRoot;p&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=s.offset+s.start.source.length;for(let d=0;d<s.items.length;++d){let k=s.items[d],{start:y,key:g,sep:w,value:N}=k,S=le(y,{flow:l,indicator:"explicit-key-ind",next:g??w?.[0],offset:u,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!S.found){if(!S.anchor&&!S.tag&&!w&&!N){d===0&&S.comma?i(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`):d<s.items.length-1&&i(S.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${l}`),S.comment&&(c.comment?c.comment+=`
66
+ `+S.comment:c.comment=S.comment),u=S.end;continue}!o&&n.options.strict&&we(g)&&i(g,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(d===0)S.comma&&i(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`);else if(S.comma||i(S.start,"MISSING_CHAR",`Missing , between ${l} items`),S.comment){let A="";e:for(let v of y)switch(v.type){case"comma":case"space":break;case"comment":A=v.source.substring(1);break e;default:break e}if(A){let v=c.items[c.items.length-1];T(v)&&(v=v.value??v.key),v.comment?v.comment+=`
67
+ `+A:v.comment=A,S.comment=S.comment.substring(A.length+1)}}if(!o&&!w&&!S.found){let A=N?e(n,N,S,i):t(n,S.end,w,null,S,i);c.items.push(A),u=A.range[2],Xe(N)&&i(A.range,"BLOCK_IN_FLOW",Qe)}else{n.atKey=!0;let A=S.end,v=g?e(n,g,S,i):t(n,A,y,null,S,i);Xe(g)&&i(v.range,"BLOCK_IN_FLOW",Qe),n.atKey=!1;let O=le(w??[],{flow:l,indicator:"map-value-ind",next:N,offset:v.range[2],onError:i,parentIndent:s.indent,startOnNewline:!1});if(O.found){if(!o&&!S.found&&n.options.strict){if(w)for(let x of w){if(x===O.found)break;if(x.type==="newline"){i(x,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}S.start<O.found.offset-1024&&i(O.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]===":"?i(N,"MISSING_CHAR",`Missing space after : in ${l}`):i(O.start,"MISSING_CHAR",`Missing , or : between ${l} items`));let C=N?e(n,N,O,i):O.found?t(n,O.end,w,null,O,i):null;C?Xe(N)&&i(C.range,"BLOCK_IN_FLOW",Qe):O.comment&&(v.comment?v.comment+=`
68
+ `+O.comment:v.comment=O.comment);let F=new j(v,C);if(n.options.keepSourceTokens&&(F.srcToken=k),o){let x=c;wn(n,x.items,v)&&i(A,"DUPLICATE_KEY","Map keys must be unique"),x.items.push(F)}else{let x=new K(n.schema);x.flow=!0,x.items.push(F);let Ie=(C??v).range;x.range=[v.range[0],Ie[1],Ie[2]],c.items.push(x)}u=C?C.range[2]:O.end}}let f=o?"}":"]",[m,...b]=s.end,h=u;if(m?.source===f)h=m.offset+m.source.length;else{let d=l[0].toUpperCase()+l.substring(1),k=p?`${d} must end with a ${f}`:`${d} in block collection must be sufficiently indented and end with a ${f}`;i(u,p?"MISSING_CHAR":"BAD_INDENT",k),m&&m.source.length!==1&&b.unshift(m)}if(b.length>0){let d=Ne(b,h,n.options.strict,i);d.comment&&(c.comment?c.comment+=`
69
+ `+d.comment:c.comment=d.comment),c.range=[s.offset,h,d.offset]}else c.range=[s.offset,h,h];return c}function ze(e,t,n,s,i,r){let o=n.type==="block-map"?fs(e,t,n,s,r):n.type==="block-seq"?hs(e,t,n,s,r):ps(e,t,n,s,r),l=o.constructor;return i==="!"||i===l.tagName?(o.tag=l.tagName,o):(i&&(o.tag=i),o)}function ds(e,t,n,s,i){let r=s.tag,o=r?t.directives.tagName(r.source,f=>i(r,"TAG_RESOLVE_FAILED",f)):null;if(n.type==="block-seq"){let{anchor:f,newlineAfterProp:m}=s,b=f&&r?f.offset>r.offset?f:r:f??r;b&&(!m||m.offset<b.offset)&&i(b,"MISSING_CHAR","Missing newline after block sequence props")}let l=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===K.tagName&&l==="map"||o===X.tagName&&l==="seq")return ze(e,t,n,i,o);let a=t.schema.tags.find(f=>f.tag===o&&f.collection===l);if(!a){let f=t.schema.knownTags[o];if(f?.collection===l)t.schema.tags.push(Object.assign({},f,{default:!1})),a=f;else return f?i(r,"BAD_COLLECTION_TYPE",`${f.tag} used for ${l} collection, but expects ${f.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),ze(e,t,n,i,o)}let c=ze(e,t,n,i,o,a),p=a.resolve?.(c,f=>i(r,"TAG_RESOLVE_FAILED",f),t.options)??c,u=L(p)?p:new E(p);return u.range=c.range,u.tag=o,a?.format&&(u.format=a.format),u}function ms(e,t,n){let s=t.offset,i=gs(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};let r=i.mode===">"?E.BLOCK_FOLDED:E.BLOCK_LITERAL,o=t.source?ys(t.source):[],l=o.length;for(let h=o.length-1;h>=0;--h){let d=o[h][1];if(d===""||d==="\r")l=h;else break}if(l===0){let h=i.chomp==="+"&&o.length>0?`
70
+ `.repeat(Math.max(1,o.length-1)):"",d=s+i.length;return t.source&&(d+=t.source.length),{value:h,type:r,comment:i.comment,range:[s,d,d]}}let a=t.indent+i.indent,c=t.offset+i.length,p=0;for(let h=0;h<l;++h){let[d,k]=o[h];if(k===""||k==="\r")i.indent===0&&d.length>a&&(a=d.length);else{d.length<a&&n(c+d.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(a=d.length),p=h,a===0&&!e.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=d.length+k.length+1}for(let h=o.length-1;h>=l;--h)o[h][0].length>a&&(l=h+1);let u="",f="",m=!1;for(let h=0;h<p;++h)u+=o[h][0].slice(a)+`
71
+ `;for(let h=p;h<l;++h){let[d,k]=o[h];c+=d.length+k.length+1;let y=k[k.length-1]==="\r";if(y&&(k=k.slice(0,-1)),k&&d.length<a){let g=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-k.length-(y?2:1),"BAD_INDENT",g),d=""}r===E.BLOCK_LITERAL?(u+=f+d.slice(a)+k,f=`
72
+ `):d.length>a||k[0]===" "?(f===" "?f=`
73
+ `:!m&&f===`
74
+ `&&(f=`
75
+
76
+ `),u+=f+d.slice(a)+k,f=`
77
+ `,m=!0):k===""?f===`
78
+ `?u+=`
79
+ `:f=`
80
+ `:(u+=f+k,f=" ",m=!1)}switch(i.chomp){case"-":break;case"+":for(let h=l;h<o.length;++h)u+=`
81
+ `+o[h][0].slice(a);u[u.length-1]!==`
82
+ `&&(u+=`
83
+ `);break;default:u+=`
84
+ `}let b=s+i.length+t.source.length;return{value:u,type:r,comment:i.comment,range:[s,b,b]}}function gs({offset:e,props:t},n,s){if(t[0].type!=="block-scalar-header")return s(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=t[0],r=i[0],o=0,l="",a=-1;for(let f=1;f<i.length;++f){let m=i[f];if(!l&&(m==="-"||m==="+"))l=m;else{let b=Number(m);!o&&b?o=b:a===-1&&(a=e+f)}}a!==-1&&s(a,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,p="",u=i.length;for(let f=1;f<t.length;++f){let m=t[f];switch(m.type){case"space":c=!0;case"newline":u+=m.source.length;break;case"comment":n&&!c&&s(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=m.source.length,p=m.source.substring(1);break;case"error":s(m,"UNEXPECTED_TOKEN",m.message),u+=m.source.length;break;default:{let b=`Unexpected token in block scalar header: ${m.type}`;s(m,"UNEXPECTED_TOKEN",b);let h=m.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:r,indent:o,chomp:l,comment:p,length:u}}function ys(e){let t=e.split(/\n( *)/),n=t[0],s=n.match(/^( *)/),i=[s?.[1]?[s[1],n.slice(s[1].length)]:["",n]];for(let r=1;r<t.length;r+=2)i.push([t[r],t[r+1]]);return i}function bs(e,t,n){let{offset:s,type:i,source:r,end:o}=e,l,a,c=(f,m,b)=>n(s+f,m,b);switch(i){case"scalar":l=E.PLAIN,a=ws(r,c);break;case"single-quoted-scalar":l=E.QUOTE_SINGLE,a=ks(r,c);break;case"double-quoted-scalar":l=E.QUOTE_DOUBLE,a=vs(r,c);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}let p=s+r.length,u=Ne(o,p,t,n);return{value:a,type:l,comment:u.comment,range:[s,p,u.offset]}}function ws(e,t){let n="";switch(e[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 ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),kn(e)}function ks(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),kn(e.slice(1,-1)).replace(/''/g,"'")}function kn(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
85
+ `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
86
+ `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let s=t.exec(e);if(!s)return e;let i=s[1],r=" ",o=t.lastIndex;for(n.lastIndex=o;s=n.exec(e);)s[1]===""?r===`
87
+ `?i+=r:r=`
88
+ `:(i+=r+s[1],r=" "),o=n.lastIndex;let l=/[ \t]*(.*)/sy;return l.lastIndex=o,s=l.exec(e),i+r+(s?.[1]??"")}function vs(e,t){let n="";for(let s=1;s<e.length-1;++s){let i=e[s];if(!(i==="\r"&&e[s+1]===`
89
+ `))if(i===`
90
+ `){let{fold:r,offset:o}=Ss(e,s);n+=r,s=o}else if(i==="\\"){let r=e[++s],o=Es[r];if(o)n+=o;else if(r===`
91
+ `)for(r=e[s+1];r===" "||r===" ";)r=e[++s+1];else if(r==="\r"&&e[s+1]===`
92
+ `)for(r=e[++s+1];r===" "||r===" ";)r=e[++s+1];else if(r==="x"||r==="u"||r==="U"){let l={x:2,u:4,U:8}[r];n+=Ns(e,s+1,l,t),s+=l}else{let l=e.substr(s-1,2);t(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),n+=l}}else if(i===" "||i===" "){let r=s,o=e[s+1];for(;o===" "||o===" ";)o=e[++s+1];o!==`
93
+ `&&!(o==="\r"&&e[s+2]===`
94
+ `)&&(n+=s>r?e.slice(r,s+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function Ss(e,t){let n="",s=e[t+1];for(;(s===" "||s===" "||s===`
95
+ `||s==="\r")&&!(s==="\r"&&e[t+2]!==`
96
+ `);)s===`
97
+ `&&(n+=`
98
+ `),t+=1,s=e[t+1];return n||(n=" "),{fold:n,offset:t}}var Es={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
99
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Ns(e,t,n,s){let i=e.substr(t,n),r=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(r)){let o=e.substr(t-2,n+2);return s(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}return String.fromCodePoint(r)}function vn(e,t,n,s){let{value:i,type:r,comment:o,range:l}=t.type==="block-scalar"?ms(e,t,s):bs(t,e.options.strict,s),a=n?e.directives.tagName(n.source,u=>s(n,"TAG_RESOLVE_FAILED",u)):null,c;e.options.stringKeys&&e.atKey?c=e.schema[U]:a?c=Os(e.schema,i,a,n,s):t.type==="scalar"?c=As(e,i,t,s):c=e.schema[U];let p;try{let u=c.resolve(i,f=>s(n??t,"TAG_RESOLVE_FAILED",f),e.options);p=I(u)?u:new E(u)}catch(u){let f=u instanceof Error?u.message:String(u);s(n??t,"TAG_RESOLVE_FAILED",f),p=new E(i)}return p.range=l,p.source=i,r&&(p.type=r),a&&(p.tag=a),c.format&&(p.format=c.format),o&&(p.comment=o),p}function Os(e,t,n,s,i){if(n==="!")return e[U];let r=[];for(let l of e.tags)if(!l.collection&&l.tag===n)if(l.default&&l.test)r.push(l);else return l;for(let l of r)if(l.test?.test(t))return l;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[U])}function As({atKey:e,directives:t,schema:n},s,i,r){let o=n.tags.find(l=>(l.default===!0||e&&l.default==="key")&&l.test?.test(s))||n[U];if(n.compat){let l=n.compat.find(a=>a.default&&a.test?.test(s))??n[U];if(o.tag!==l.tag){let a=t.tagString(o.tag),c=t.tagString(l.tag),p=`Value may be parsed as either ${a} or ${c}`;r(i,"TAG_RESOLVE_FAILED",p,!0)}}return o}function Is(e,t,n){if(t){n??(n=t.length);for(let s=n-1;s>=0;--s){let i=t[s];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++s];i?.type==="space";)e+=i.source.length,i=t[++s];break}}return e}var Ts={composeNode:Sn,composeEmptyNode:vt};function Sn(e,t,n,s){let i=e.atKey,{spaceBefore:r,comment:o,anchor:l,tag:a}=n,c,p=!0;switch(t.type){case"alias":c=xs(e,t,s),(l||a)&&s(t,"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=vn(e,t,a,s),l&&(c.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=ds(Ts,e,t,n,s),l&&(c.anchor=l.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);s(t,"RESOURCE_EXHAUSTION",f)}break;default:{let u=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",u),p=!1}}return c??(c=vt(e,t.offset,void 0,null,n,s)),l&&c.anchor===""&&s(l,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!I(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&s(a??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?c.comment=o:c.commentBefore=o),e.options.keepSourceTokens&&p&&(c.srcToken=t),c}function vt(e,t,n,s,{spaceBefore:i,comment:r,anchor:o,tag:l,end:a},c){let p={type:"scalar",offset:Is(t,n,s),indent:-1,source:""},u=vn(e,p,l,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),r&&(u.comment=r,u.range[2]=a),u}function xs({options:e},{offset:t,source:n,end:s},i){let r=new ut(n.substring(1));r.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+n.length,l=Ne(s,o,e.strict,i);return r.range=[t,o,l.offset],l.comment&&(r.comment=l.comment),r}function $s(e,t,{offset:n,start:s,value:i,end:r},o){let l=Object.assign({_directives:t},e),a=new gn(void 0,l),c={atKey:!1,atRoot:!0,directives:a.directives,options:a.options,schema:a.schema},p=le(s,{indicator:"doc-start",next:i??r?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});p.found&&(a.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!p.hasNewline&&o(p.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),a.contents=i?Sn(c,i,p,o):vt(c,p.end,s,null,p,o);let u=a.contents.range[2],f=Ne(r,u,!1,o);return f.comment&&(a.comment=f.comment),a.range=[n,u,f.offset],a}function de(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function $t(e){let t="",n=!1,s=!1;for(let i=0;i<e.length;++i){let r=e[i];switch(r[0]){case"#":t+=(t===""?"":s?`
100
+
101
+ `:`
102
+ `)+(r.substring(1)||" "),n=!0,s=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:t,afterEmptyLine:s}}var Ls=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,s,i)=>{let r=de(t);i?this.warnings.push(new us(r,n,s)):this.errors.push(new ge(r,n,s))},this.directives=new re({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:s}=$t(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
103
+ ${n}`:n;else if(s||e.directives.docStart||!i)e.commentBefore=n;else if($(i)&&!i.flow&&i.items.length>0){let r=i.items[0];T(r)&&(r=r.key);let o=r.commentBefore;r.commentBefore=o?`${n}
104
+ ${o}`:n}else{let r=i.commentBefore;i.commentBefore=r?`${n}
105
+ ${r}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:$t(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let s of e)yield*this.next(s);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,s)=>{let i=de(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",n,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=$s(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new ge(de(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new ge(de(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let t=Ne(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
106
+ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new ge(de(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),s=new gn(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,t,t],this.decorate(s,!1),yield s}}},rt=Symbol("break visit"),Cs=Symbol("skip children"),En=Symbol("remove item");function ae(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Nn(Object.freeze([]),e,t)}ae.BREAK=rt;ae.SKIP=Cs;ae.REMOVE=En;ae.itemAtPath=(e,t)=>{let n=e;for(let[s,i]of t){let r=n?.[s];if(r&&"items"in r)n=r.items[i];else return}return n};ae.parentCollection=(e,t)=>{let n=ae.itemAtPath(e,t.slice(0,-1)),s=t[t.length-1][0],i=n?.[s];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Nn(e,t,n){let s=n(t,e);if(typeof s=="symbol")return s;for(let i of["key","value"]){let r=t[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let l=Nn(Object.freeze(e.concat([[i,o]])),r.items[o],n);if(typeof l=="number")o=l-1;else{if(l===rt)return rt;l===En&&(r.items.splice(o,1),o-=1)}}typeof s=="function"&&i==="key"&&(s=s(t,e))}}return typeof s=="function"?s(t,e):s}var On="\uFEFF",An="",In="",ot="";function _s(e){switch(e){case On:return"byte-order-mark";case An:return"doc-mode";case In:return"flow-error-end";case ot:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
107
+ `:case`\r
108
+ `: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(e[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 D(e){switch(e){case void 0:case" ":case`
109
+ `:case"\r":case" ":return!0;default:return!1}}var Lt=new Set("0123456789ABCDEFabcdef"),js=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Le=new Set(",[]{}"),Ks=new Set(` ,[]{}
110
+ \r `),Ze=e=>!e||Ks.has(e),Bs=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,t=!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=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
111
+ `?!0:t==="\r"?this.buffer[e+1]===`
112
+ `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let s=this.buffer[n+e+1];if(s===`
113
+ `||!s&&!this.atEnd)return e+n+1}return t===`
114
+ `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&D(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(`
115
+ `,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]===On&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");for(;n!==-1;){let i=e[n-1];if(i===" "||i===" "){t=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let i=e[t-1];if(i===" "||i===" ")t-=1;else break}let s=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield An,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 t=this.peek(3);if((t==="---"||t==="...")&&D(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!D(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&D(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);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(Ze),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let s=this.getLine();if(s===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&s[0]!=="#"||n===0&&(s.startsWith("---")||s.startsWith("..."))&&D(s[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield In,yield*this.parseLineStart();let i=0;for(;s[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),s[i]){case void 0:return"flow";case"#":return yield*this.pushCount(s.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(Ze),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let r=this.charAt(1);if(this.flowKey||D(r)||r===",")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),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let i=0;for(;this.buffer[t-1-i]==="\\";)i+=1;if(i%2===0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),s=n.indexOf(`
116
+ `,this.pos);if(s!==-1){for(;s!==-1;){let i=this.continueScalar(s+1);if(i===-1)break;s=n.indexOf(`
117
+ `,i)}s!==-1&&(t=s-(n[s-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>D(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`
118
+ `:e=i,t=0;break;case"\r":{let r=this.buffer[i+1];if(!r&&!this.atEnd)return this.setNext("block-scalar");if(r===`
119
+ `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t: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(`
120
+ `,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(n=this.buffer[s];n===" ";)n=this.buffer[++s];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
121
+ `;)n=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let i=e-1,r=this.buffer[i];r==="\r"&&(r=this.buffer[--i]);let o=i;for(;r===" ";)r=this.buffer[--i];if(r===`
122
+ `&&i>=this.pos&&i+1+t>o)e=i;else break}while(!0);return yield ot,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,s;for(;s=this.buffer[++n];)if(s===":"){let i=this.buffer[n+1];if(D(i)||e&&Le.has(i))break;t=n}else if(D(s)){let i=this.buffer[n+1];if(s==="\r"&&(i===`
123
+ `?(n+=1,s=`
124
+ `,i=this.buffer[n+1]):t=n),i==="#"||e&&Le.has(i))break;if(s===`
125
+ `){let r=this.continueScalar(n+1);if(r===-1)break;n=Math.max(n,r-2)}}else{if(e&&Le.has(s))break;t=n}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield ot,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Ze))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(D(t)||e&&Le.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!D(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(js.has(t))t=this.buffer[++e];else if(t==="%"&&Lt.has(this.buffer[e+1])&&Lt.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
126
+ `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
127
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let s=t-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=t),s}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},Ms=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let i=t+n>>1;this.lineStarts[i]<e?t=i+1:n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let s=this.lineStarts[t-1];return{line:t,col:e-s+1}}}};function Y(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Ct(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function Tn(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ce(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function ee(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function _t(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Y(t.start,"explicit-key-ind")&&!Y(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,Tn(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}var Ds=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 Bs,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=_s(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){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 n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,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 t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&_t(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let s=n.items[n.items.length-1];if(s.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=t;else{Object.assign(s,{key:t,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{let s=n.items[n.items.length-1];s.value?n.items.push({start:[],value:t}):s.value=t;break}case"flow-collection":{let s=n.items[n.items.length-1];!s||s.value?n.items.push({start:[],key:t,sep:[]}):s.sep?s.value=t:Object.assign(s,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let s=t.items[t.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&Ct(s.start)===-1&&(t.indent===0||s.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(n.type==="document"?n.end=s.start:n.items.push({start:s.start}),t.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":{Ct(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 t=this.startBlockValue(e);t?this.stack.push(t):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 t=Ce(this.peek(2)),n=ee(t),s;e.end?(s=e.end,s.push(this.sourceToken),delete e.end):s=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:s}]};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 t=this.source.indexOf(`
128
+ `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
129
+ `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,s=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(s&&t.sep&&!t.value){let r=[];for(let o=0;o<t.sep.length;++o){let l=t.sep[o];switch(l.type){case"newline":r.push(o);break;case"space":break;case"comment":l.indent>e.indent&&(r.length=0);break;default:r.length=0}}r.length>=2&&(i=t.sep.splice(r[1]))}switch(this.type){case"anchor":case"tag":s||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):s||t.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(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Y(t.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(Tn(t.key)&&!Y(t.sep,"newline")){let r=ee(t.start),o=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:o,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(Y(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let r=ee(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||s?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Y(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);s||t.value?(e.items.push({start:i,key:r,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(r):(Object.assign(t,{key:r,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type==="block-seq"){if(!t.explicitKey&&t.sep&&!Y(t.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 n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||Y(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:s,sep:[]}):t.sep?this.stack.push(s):Object.assign(t,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let s=Ce(n),i=ee(s);_t(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
130
+ `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
131
+ `,t)+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 t=Ce(e),n=ee(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Ce(e),n=ee(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.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;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function Ps(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Ms||null,prettyErrors:t}}function xn(e,t={}){let{lineCounter:n,prettyErrors:s}=Ps(t),i=new Ds(n?.addNewLine),r=new Ls(t),o=null;for(let l of r.compose(i.parse(e),!0,e.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new ge(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(o.errors.forEach(Tt(e,n)),o.warnings.forEach(Tt(e,n))),o}var Fs=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function Vs(e,t){if(t.trim()===""||$n(t))throw new TypeError("skills.directory must be a non-empty project-relative path");let n=Ae(e),s=Ae(n,t),i=pe(n,s);if(i===".."||i.startsWith(`..${R}`)||$n(i))throw new TypeError("skills.directory must stay within the project root");return s}function Js(e,t,n="skills"){if(e===!1)return;let s=typeof e=="object"&&e?.directory!==void 0?e.directory:n;return Vs(t,s)}function Ws(e){let t=e.slice(e.lastIndexOf(".")+1).toLowerCase();return{md:"text/markdown",txt:"text/plain",json:"application/json",yaml:"application/yaml",yml:"application/yaml",js:"text/javascript",mjs:"text/javascript",cjs:"text/javascript",ts:"text/typescript",py:"text/x-python",sh:"text/x-shellscript",html:"text/html",css:"text/css",csv:"text/csv",xml:"application/xml",svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",pdf:"application/pdf",zip:"application/zip"}[t]??"application/octet-stream"}function Ys(e){return e.startsWith("text/")||e==="application/json"||e==="application/yaml"||e==="application/xml"||e==="image/svg+xml"}function Gs(e){let t=[],n=[e],s=i=>{for(let r of Rs(i,{withFileTypes:!0}).sort((o,l)=>o.name.localeCompare(l.name))){let o=Ae(i,r.name),l=Ln(o);l.isSymbolicLink()||(l.isDirectory()?(n.push(o),s(o)):l.isFile()&&t.push(o))}};return s(e),{files:t,directories:n}}function St(e,t,n){let s=pe(e,t).split(R).map(encodeURIComponent),i=pe(t,n).split(R).map(encodeURIComponent),[r,...o]=[...s,...i];return`skill://${r??""}/${o.join("/")}`}function Hs(e){let t=Cn(e,"utf8"),n=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(t);if(n?.[1]===void 0)throw new Error(`${e}: SKILL.md must begin with YAML frontmatter`);let s=xn(n[1],{prettyErrors:!0});if(s.errors.length>0)throw new Error(`${e}: invalid YAML frontmatter: ${s.errors[0]?.message}`);let i;try{i=s.toJSON()}catch(a){throw new Error(`${e}: invalid YAML frontmatter: ${a instanceof Error?a.message:String(a)}`,{cause:a})}if(typeof i!="object"||i===null||Array.isArray(i))throw new Error(`${e}: frontmatter must be a YAML mapping`);let r=i,o=r.name,l=r.description;if(typeof o!="string"||o.length<1||o.length>64||!Fs.test(o))throw new Error(`${e}: name must be 1-64 lowercase letters, digits, or single hyphens`);if(o!==Oe(Ae(e,"..")))throw new Error(`${e}: frontmatter name must match its parent directory`);if(typeof l!="string"||l.trim()===""||l.length>1024)throw new Error(`${e}: description must be a non-empty string of at most 1024 characters`);return r}function di(e,t,n="skills",s){if(e===!1)return;let i=e===!0||typeof e=="object"&&e!==null,r=Js(e,t,n);if(!Us(r)){if(!i)return;throw new Error(`Skills directory not found: ${r}`)}if(!Ln(r).isDirectory())throw new Error(`Skills path is not a directory: ${r}`);let{files:o,directories:l}=Gs(r),a=o.filter(y=>Oe(y)==="SKILL.md");a.length===0&&console.warn(`[mcp-use] Skills directory is empty: ${r}`);let c=[],p=s?.readResourceFile??Cn,u=(y,g)=>{let w=g instanceof Error?g:new Error(String(g));if(s?.onInvalidSkill===void 0)throw w;c.push(y),s.onInvalidSkill(w)},f=[];for(let y of a){let g=Ae(y,"..");try{if(g===r)throw new Error(`${y}: SKILL.md must be inside a named child directory`);f.push({skillFile:y,skillRoot:g,metadata:Hs(y)})}catch(w){u(g,w)}}let m=(y,g)=>c.some(w=>w.startsWith(`${g}${R}`)&&(y===w||y.startsWith(`${w}${R}`))),b=[];f.sort((y,g)=>pe(r,g.skillRoot).split(R).length-pe(r,y.skillRoot).split(R).length).forEach(({skillFile:y,skillRoot:g,metadata:w})=>{try{let S=o.filter(O=>O.startsWith(`${g}${R}`)&&!m(O,g)).map(O=>{let C=p(O),F=St(r,g,O),x=Ws(O),Ie=`sha256:${qs("sha256").update(C).digest("hex")}`;return{uri:F,name:Oe(O),mimeType:x,digest:Ie,...Ys(x)?{text:C.toString("utf8")}:{blob:C.toString("base64")}}}),A=St(r,g,y).replace(/\/SKILL\.md$/,""),v=l.filter(O=>O===g||O.startsWith(`${g}${R}`)&&!m(O,g)).map(O=>{let C=pe(g,O);return{uri:C===""?A:`${A}/${C.split(R).map(encodeURIComponent).join("/")}`,name:C===""?Oe(g):Oe(O)}});b.push({skill:{uri:St(r,g,y),frontmatter:w,resources:S.map(({uri:O,digest:C})=>({uri:O,digest:C}))},resources:S,directories:v})}catch(N){u(g,N)}});let h=new Map,d=new Map;for(let{resources:y,directories:g}of b){for(let w of y)h.has(w.uri)||h.set(w.uri,w);for(let w of g)d.set(w.uri,w)}let k=b.map(({skill:y})=>y);return k.sort((y,g)=>y.uri.localeCompare(g.uri)),{skills:k,resources:[...h.values()].sort((y,g)=>y.uri.localeCompare(g.uri)),directories:[...d.values()].sort((y,g)=>y.uri.localeCompare(g.uri))}}export{Js as a,di as b};
@@ -1,5 +1,5 @@
1
- import{a as L,b as U,c as O,d as R,e as j,f as I,i as A,l as T}from"../chunk-TSMDTAVA.js";import{a as P,b as S,c as N,d as _}from"../chunk-OMRWADFK.js";import{a as D,b as C}from"../chunk-LUVZUL5C.js";import"../chunk-WOT6VMZA.js";import{randomBytes as z}from"crypto";import{existsSync as q}from"fs";import{cp as te,mkdir as M,rm as ne,writeFile as V}from"fs/promises";import{join as m,relative as y,resolve as se}from"path";import ae from"@tailwindcss/vite";import oe from"@vitejs/plugin-react";import{build as x}from"vite";import{createServerModuleRunner as k}from"vite";var ee="/mcp",F="http://localhost:3000";async function re(e,r){let n=k(e,{hmr:!1,sourcemapInterceptor:"node"}),i=process.env.MCP_URL;try{i===void 0&&(process.env.MCP_URL=F);let t=(await n.import(r)).default;if(t===null||typeof t!="object")throw new Error("The server entry must default-export the MCPServer instance.");return t.basePath??ee}finally{i===void 0?delete process.env.MCP_URL:process.env.MCP_URL=i,await n.close()}}async function J(e,r){return re(e,r)}async function B(e,r,n){let i=k(e,{hmr:!1,sourcemapInterceptor:"node"}),s=process.env.MCP_URL;try{s===void 0&&(process.env.MCP_URL=F);let c=(await i.import(r)).default;if(c===null||typeof c!="object")throw new Error("The server entry must default-export the MCPServer instance.");if(typeof c.__primeViews!="function")throw new Error("The entry's default export does not support __primeViews.");c.__primeViews(n),c.__mount()}finally{s===void 0?delete process.env.MCP_URL:process.env.MCP_URL=s,await i.close()}}function W(e){return e.replace(/\/+$/,"")}function ie(e,r){let n=r.replace(/^\/+/,"");return e==="/"?`/${n}`:`${e}/${n}`}function E(e,r){return`${ie(e,`_mcp-use/views/${r}`)}/`}var w="index.js",ce="entry-wrapper.ts",ue=100*1024*1024;async function Y(e,r){let n=m(e,"public");q(n)&&await te(n,r,{recursive:!0})}async function H(e,r,n){let i=m(e,ce);await M(e,{recursive:!0});let s=JSON.stringify(n);return await V(i,[`import server from ${JSON.stringify(r)};`,'import { registerViews } from "mcp-use";',`server[registerViews](${s});`,"export default server;",""].join(`
2
- `)),i}function le(){let e=process.env.MCP_ASSETS_URL;if(!(e===void 0||e.trim()===""))try{return W(new URL(e).href.replace(/\/$/,""))}catch{return}}function $(e,r,n,i){let s=e.replace(/^\/+/,"");return`${n}${E(i,r)}${s}`}function de(e,r,n,i){return e.kind!=="external"?e:{...e,entry:$(e.entry,r,n,i),css:e.css.map(s=>$(s,r,n,i)),...e.scripts!==void 0&&{scripts:e.scripts.map(s=>$(s,r,n,i))}}}async function fe(e,r){let n=m(r.viewsOutDir,e.name),i=await x({root:r.cwd,configFile:r.userViteConfig,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:r.cacheDir,resolve:{tsconfigPaths:!0,alias:{tailwindcss:U()}},oxc:{jsx:{runtime:"automatic"}},plugins:[ae(),oe(),T({getViews:()=>[e]})],build:{outDir:n,emptyOutDir:!0,write:!r.inline,target:"es2022",sourcemap:r.inline?!1:r.sourceMaps,minify:!0,cssCodeSplit:!1,chunkSizeWarningLimit:1e3,assetsInlineLimit:ue,rollupOptions:{input:{[e.name]:I(e.name)},output:{format:"es",codeSplitting:!r.inline,entryFileNames:"assets/[name]-[hash].js",chunkFileNames:"assets/[name]-[hash].js",assetFileNames:"assets/[name]-[hash][extname]"}}},base:"./"}),s=Array.isArray(i)?i[0]:i;if(s===void 0||!("output"in s))throw new Error(`Client build for view "${e.name}" produced no output.`);let t=s.output,c=Array.isArray(t)?t:Object.values(t),l,p,d,f=[];for(let o of c){if(typeof o!="object"||o===null||!("fileName"in o)||typeof o.fileName!="string")continue;let a=o;a.type==="chunk"&&a.isEntry===!0?(l=a.fileName,d=a.code):a.type==="asset"&&a.fileName.endsWith(".css")&&(p=a.fileName,typeof a.source=="string"?f.push(a.source):a.source instanceof Uint8Array&&f.push(new TextDecoder().decode(a.source)))}if(l===void 0)throw new Error(`Client build produced no entry chunk for view "${e.name}".`);if(r.inline){if(d===void 0)throw new Error(`Client build produced no entry source for view "${e.name}".`);return{kind:"inline",js:d,css:f.join(`
3
- `)}}return{kind:"external",entry:l.replace(/^\/+/,""),css:p!==void 0?[p.replace(/^\/+/,"")]:[]}}async function me(e){let r=performance.now();N(e.cwd,"production");let n=e.mcpDir===void 0?e.cwd:se(e.cwd,e.mcpDir),i=e.entry===void 0?D(n):D(e.cwd,e.entry),s=await C(e.cwd,i);(s==="created"||s==="updated")&&console.log(`[mcp-use] ${s} mcp-env.d.ts`);let t=O(e.cwd),c=e.viewsDir??(e.mcpDir===void 0?void 0:m(e.mcpDir,"views"));q(R(e.cwd,c))||console.log("[mcp-use] views directory not configured.");let l=j(e.cwd,c),p=L(e.cwd),d=e.sourceMaps===!0,f=e.inline===!0,o;if(l.length===0){o??=await A(e.cwd,t.cache,!1);try{await B(o.environments.ssr,i,{});let Z=await H(t.cache,i,{});await x({root:e.cwd,configFile:!1,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:t.cache,resolve:{tsconfigPaths:!0,alias:P(e.cwd)},plugins:[_(e.cwd)],build:{ssr:Z,outDir:t.build,emptyOutDir:!0,target:"node22",sourcemap:d,minify:!1,rollupOptions:{output:{format:"es",entryFileNames:w}}},ssr:{...S(e.cwd),target:"node"}})}finally{await o?.close()}await Y(e.cwd,m(t.build,"views/public"));let u={buildId:z(8).toString("hex"),entryPoint:w,createdAt:new Date().toISOString(),views:{}};await M(t.build,{recursive:!0}),await V(t.buildManifest,`${JSON.stringify(u,null,2)}
4
- `);let g=Math.round(performance.now()-r);console.log(`[mcp-use] built ${y(e.cwd,i)} \u2192 ${y(e.cwd,t.build)}/${w} (${g}ms)`);return}await ne(t.build,{recursive:!0,force:!0});let v=m(t.build,"views");await M(v,{recursive:!0}),o??=await A(e.cwd,t.cache,!1);let a,h={},b=le();try{a=await J(o.environments.ssr,i);for(let u of l){let g=await fe(u,{cwd:e.cwd,cacheDir:t.cache,viewsOutDir:v,userViteConfig:p,sourceMaps:d,inline:f});b!==void 0&&!f&&(g=de(g,u.name,b,a)),h[u.name]=g}if(b!==void 0&&!f){let u=`${b}${E(a,"<view-name>")}`;console.log(`[mcp-use] MCP_ASSETS_URL set \u2014 publish ${y(e.cwd,v)}/ at ${u}`),a!=="/mcp"&&console.log(`[mcp-use] CDN manifest uses basePath ${a} from server entry`)}await Y(e.cwd,m(v,"public")),await B(o.environments.ssr,i,h)}finally{await o.close()}let G=await H(t.cache,i,h);await x({root:e.cwd,configFile:!1,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:t.cache,resolve:{tsconfigPaths:!0,alias:P(e.cwd)},oxc:{jsx:{runtime:"automatic"}},plugins:[_(e.cwd)],build:{ssr:G,outDir:t.build,emptyOutDir:!1,target:"node22",sourcemap:d,minify:!1,rollupOptions:{output:{format:"es",entryFileNames:w}}},ssr:{...S(e.cwd),target:"node"}});let K={buildId:z(8).toString("hex"),entryPoint:w,createdAt:new Date().toISOString(),views:h};await M(t.build,{recursive:!0}),await V(t.buildManifest,`${JSON.stringify(K,null,2)}
5
- `);let Q=Math.round(performance.now()-r),X=l.map(u=>u.name).join(", ");console.log(`[mcp-use] built ${y(e.cwd,i)} + views (${X}) \u2192 ${y(e.cwd,t.build)}/${w} (${Q}ms)`)}export{me as runBuild};
1
+ import{a as L,b as U,c as j,d as R,e as T,f as I,i as E,l as F}from"../chunk-TSMDTAVA.js";import{a as _,b as P,c as O,d as k}from"../chunk-OMRWADFK.js";import{a as M,b as N}from"../chunk-LUVZUL5C.js";import"../chunk-WOT6VMZA.js";import{randomBytes as H}from"crypto";import{existsSync as K}from"fs";import{cp as ae,mkdir as b,rm as oe,writeFile as C}from"fs/promises";import{join as p,relative as y,resolve as ce}from"path";import le from"@tailwindcss/vite";import ue from"@vitejs/plugin-react";import{build as V}from"vite";import{createServerModuleRunner as J}from"vite";var te="/mcp",W="http://localhost:3000";async function se(e,i){let s=J(e,{hmr:!1,sourcemapInterceptor:"node"}),t=process.env.MCP_URL;try{t===void 0&&(process.env.MCP_URL=W);let r=(await s.import(i)).default;if(r===null||typeof r!="object")throw new Error("The server entry must default-export the MCPServer instance.");return r.basePath??te}finally{t===void 0?delete process.env.MCP_URL:process.env.MCP_URL=t,await s.close()}}async function z(e,i){return se(e,i)}async function $(e,i,s,t,n){let r=J(e,{hmr:!1,sourcemapInterceptor:"node"}),l=process.env.MCP_URL;try{l===void 0&&(process.env.MCP_URL=W);let o=(await r.import(i)).default;if(o===null||typeof o!="object")throw new Error("The server entry must default-export the MCPServer instance.");if(typeof o.__primeViews!="function")throw new Error("The entry's default export does not support __primeViews.");if(typeof o.__skillsConfig!="function"||typeof o.__primeSkills!="function")throw new Error("The entry's default export does not support Skills over MCP.");let{discoverConfiguredSkills:d}=await import("../internal/skills-loader.js"),u=d(o.__skillsConfig(),t,n);return o.__primeViews(s),o.__primeSkills(u),o.__mount(),u}finally{l===void 0?delete process.env.MCP_URL:process.env.MCP_URL=l,await r.close()}}function Y(e){return e.replace(/\/+$/,"")}function ne(e,i){let s=i.replace(/^\/+/,"");return e==="/"?`/${s}`:`${e}/${s}`}function A(e,i){return`${ne(e,`_mcp-use/views/${i}`)}/`}var w="index.js",de="entry-wrapper.ts",fe=100*1024*1024;async function q(e,i){let s=p(e,"public");K(s)&&await ae(s,i,{recursive:!0})}async function G(e,i,s,t){let n=p(e,de);await b(e,{recursive:!0});let r=JSON.stringify(s),l=JSON.stringify(t);return await C(n,[`import server from ${JSON.stringify(i)};`,'import { registerSkills, registerViews } from "mcp-use";',`server[registerViews](${r});`,`server[registerSkills](${l});`,"export default server;",""].join(`
2
+ `)),n}function me(){let e=process.env.MCP_ASSETS_URL;if(!(e===void 0||e.trim()===""))try{return Y(new URL(e).href.replace(/\/$/,""))}catch{return}}function B(e,i,s,t){let n=e.replace(/^\/+/,"");return`${s}${A(t,i)}${n}`}function pe(e,i,s,t){return e.kind!=="external"?e:{...e,entry:B(e.entry,i,s,t),css:e.css.map(n=>B(n,i,s,t)),...e.scripts!==void 0&&{scripts:e.scripts.map(n=>B(n,i,s,t))}}}async function we(e,i){let s=p(i.viewsOutDir,e.name),t=await V({root:i.cwd,configFile:i.userViteConfig,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:i.cacheDir,resolve:{tsconfigPaths:!0,alias:{tailwindcss:U()}},oxc:{jsx:{runtime:"automatic"}},plugins:[le(),ue(),F({getViews:()=>[e]})],build:{outDir:s,emptyOutDir:!0,write:!i.inline,target:"es2022",sourcemap:i.inline?!1:i.sourceMaps,minify:!0,cssCodeSplit:!1,chunkSizeWarningLimit:1e3,assetsInlineLimit:fe,rollupOptions:{input:{[e.name]:I(e.name)},output:{format:"es",codeSplitting:!i.inline,entryFileNames:"assets/[name]-[hash].js",chunkFileNames:"assets/[name]-[hash].js",assetFileNames:"assets/[name]-[hash][extname]"}}},base:"./"}),n=Array.isArray(t)?t[0]:t;if(n===void 0||!("output"in n))throw new Error(`Client build for view "${e.name}" produced no output.`);let r=n.output,l=Array.isArray(r)?r:Object.values(r),m,o,d,u=[];for(let c of l){if(typeof c!="object"||c===null||!("fileName"in c)||typeof c.fileName!="string")continue;let a=c;a.type==="chunk"&&a.isEntry===!0?(m=a.fileName,d=a.code):a.type==="asset"&&a.fileName.endsWith(".css")&&(o=a.fileName,typeof a.source=="string"?u.push(a.source):a.source instanceof Uint8Array&&u.push(new TextDecoder().decode(a.source)))}if(m===void 0)throw new Error(`Client build produced no entry chunk for view "${e.name}".`);if(i.inline){if(d===void 0)throw new Error(`Client build produced no entry source for view "${e.name}".`);return{kind:"inline",js:d,css:u.join(`
3
+ `)}}return{kind:"external",entry:m.replace(/^\/+/,""),css:o!==void 0?[o.replace(/^\/+/,"")]:[]}}async function ge(e){let i=performance.now();O(e.cwd,"production");let s=e.mcpDir===void 0?e.cwd:ce(e.cwd,e.mcpDir),t=e.entry===void 0?M(s):M(e.cwd,e.entry),n=await N(e.cwd,t);(n==="created"||n==="updated")&&console.log(`[mcp-use] ${n} mcp-env.d.ts`);let r=j(e.cwd),l=e.viewsDir??(e.mcpDir===void 0?void 0:p(e.mcpDir,"views"));K(R(e.cwd,l))||console.log("[mcp-use] views directory not configured.");let m=T(e.cwd,l),o=L(e.cwd),d=e.sourceMaps===!0,u=e.inline===!0,c,D=e.mcpDir===void 0?"skills":p(e.mcpDir,"skills");if(m.length===0){c??=await E(e.cwd,r.cache,!1);try{let ie=await $(c.environments.ssr,t,{},e.cwd,D),re=await G(r.cache,t,{},ie);await V({root:e.cwd,configFile:!1,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:r.cache,resolve:{tsconfigPaths:!0,alias:_(e.cwd)},plugins:[k(e.cwd)],build:{ssr:re,outDir:r.build,emptyOutDir:!0,target:"node22",sourcemap:d,minify:!1,rollupOptions:{output:{format:"es",entryFileNames:w}}},ssr:{...P(e.cwd),target:"node"}})}finally{await c?.close()}await q(e.cwd,p(r.build,"views/public"));let f={buildId:H(8).toString("hex"),entryPoint:w,createdAt:new Date().toISOString(),views:{}};await b(r.build,{recursive:!0}),await C(r.buildManifest,`${JSON.stringify(f,null,2)}
4
+ `);let v=Math.round(performance.now()-i);console.log(`[mcp-use] built ${y(e.cwd,t)} \u2192 ${y(e.cwd,r.build)}/${w} (${v}ms)`);return}await oe(r.build,{recursive:!0,force:!0});let a=p(r.build,"views");await b(a,{recursive:!0}),c??=await E(e.cwd,r.cache,!1);let g,h={},x,S=me();try{g=await z(c.environments.ssr,t);for(let f of m){let v=await we(f,{cwd:e.cwd,cacheDir:r.cache,viewsOutDir:a,userViteConfig:o,sourceMaps:d,inline:u});S!==void 0&&!u&&(v=pe(v,f.name,S,g)),h[f.name]=v}if(S!==void 0&&!u){let f=`${S}${A(g,"<view-name>")}`;console.log(`[mcp-use] MCP_ASSETS_URL set \u2014 publish ${y(e.cwd,a)}/ at ${f}`),g!=="/mcp"&&console.log(`[mcp-use] CDN manifest uses basePath ${g} from server entry`)}await q(e.cwd,p(a,"public")),x=await $(c.environments.ssr,t,h,e.cwd,D)}finally{await c.close()}let Q=await G(r.cache,t,h,x);await V({root:e.cwd,configFile:!1,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:r.cache,resolve:{tsconfigPaths:!0,alias:_(e.cwd)},oxc:{jsx:{runtime:"automatic"}},plugins:[k(e.cwd)],build:{ssr:Q,outDir:r.build,emptyOutDir:!1,target:"node22",sourcemap:d,minify:!1,rollupOptions:{output:{format:"es",entryFileNames:w}}},ssr:{...P(e.cwd),target:"node"}});let X={buildId:H(8).toString("hex"),entryPoint:w,createdAt:new Date().toISOString(),views:h};await b(r.build,{recursive:!0}),await C(r.buildManifest,`${JSON.stringify(X,null,2)}
5
+ `);let Z=Math.round(performance.now()-i),ee=m.map(f=>f.name).join(", ");console.log(`[mcp-use] built ${y(e.cwd,t)} + views (${ee}) \u2192 ${y(e.cwd,r.build)}/${w} (${Z}ms)`)}export{ge as runBuild};