@keepdb/cc 0.1.7 → 0.1.9
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.
- package/dist/bin/cli.js +141 -3
- package/package.json +6 -7
package/dist/bin/cli.js
CHANGED
|
@@ -1,5 +1,143 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
var xl=Object.create;var xr=Object.defineProperty;var Nl=Object.getOwnPropertyDescriptor;var Cl=Object.getOwnPropertyNames;var Il=Object.getPrototypeOf,Ll=Object.prototype.hasOwnProperty;var ps=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var w=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),Rl=(s,e)=>{for(var t in e)xr(s,t,{get:e[t],enumerable:!0})},ql=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Cl(e))!Ll.call(s,n)&&n!==t&&xr(s,n,{get:()=>e[n],enumerable:!(r=Nl(e,n))||r.enumerable});return s};var Pl=(s,e,t)=>(t=s!=null?xl(Il(s)):{},ql(e||!s||!s.__esModule?xr(t,"default",{value:s,enumerable:!0}):t,s));var q=w(V=>{"use strict";var Lr=Symbol.for("yaml.alias"),Ui=Symbol.for("yaml.document"),ws=Symbol.for("yaml.map"),Vi=Symbol.for("yaml.pair"),Rr=Symbol.for("yaml.scalar"),_s=Symbol.for("yaml.seq"),pe=Symbol.for("yaml.node.type"),Yu=s=>!!s&&typeof s=="object"&&s[pe]===Lr,Ju=s=>!!s&&typeof s=="object"&&s[pe]===Ui,Wu=s=>!!s&&typeof s=="object"&&s[pe]===ws,Zu=s=>!!s&&typeof s=="object"&&s[pe]===Vi,Hi=s=>!!s&&typeof s=="object"&&s[pe]===Rr,zu=s=>!!s&&typeof s=="object"&&s[pe]===_s;function Yi(s){if(s&&typeof s=="object")switch(s[pe]){case ws:case _s:return!0}return!1}function Gu(s){if(s&&typeof s=="object")switch(s[pe]){case Lr:case ws:case Rr:case _s:return!0}return!1}var Qu=s=>(Hi(s)||Yi(s))&&!!s.anchor;V.ALIAS=Lr;V.DOC=Ui;V.MAP=ws;V.NODE_TYPE=pe;V.PAIR=Vi;V.SCALAR=Rr;V.SEQ=_s;V.hasAnchor=Qu;V.isAlias=Yu;V.isCollection=Yi;V.isDocument=Ju;V.isMap=Wu;V.isNode=Gu;V.isPair=Zu;V.isScalar=Hi;V.isSeq=zu});var It=w(qr=>{"use strict";var F=q(),W=Symbol("break visit"),Ji=Symbol("skip children"),ce=Symbol("remove node");function Ss(s,e){let t=Wi(e);F.isDocument(s)?dt(null,s.contents,t,Object.freeze([s]))===ce&&(s.contents=null):dt(null,s,t,Object.freeze([]))}Ss.BREAK=W;Ss.SKIP=Ji;Ss.REMOVE=ce;function dt(s,e,t,r){let n=Zi(s,e,t,r);if(F.isNode(n)||F.isPair(n))return zi(s,r,n),dt(s,n,t,r);if(typeof n!="symbol"){if(F.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let a=dt(i,e.items[i],t,r);if(typeof a=="number")i=a-1;else{if(a===W)return W;a===ce&&(e.items.splice(i,1),i-=1)}}}else if(F.isPair(e)){r=Object.freeze(r.concat(e));let i=dt("key",e.key,t,r);if(i===W)return W;i===ce&&(e.key=null);let a=dt("value",e.value,t,r);if(a===W)return W;a===ce&&(e.value=null)}}return n}async function ks(s,e){let t=Wi(e);F.isDocument(s)?await ht(null,s.contents,t,Object.freeze([s]))===ce&&(s.contents=null):await ht(null,s,t,Object.freeze([]))}ks.BREAK=W;ks.SKIP=Ji;ks.REMOVE=ce;async function ht(s,e,t,r){let n=await Zi(s,e,t,r);if(F.isNode(n)||F.isPair(n))return zi(s,r,n),ht(s,n,t,r);if(typeof n!="symbol"){if(F.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let a=await ht(i,e.items[i],t,r);if(typeof a=="number")i=a-1;else{if(a===W)return W;a===ce&&(e.items.splice(i,1),i-=1)}}}else if(F.isPair(e)){r=Object.freeze(r.concat(e));let i=await ht("key",e.key,t,r);if(i===W)return W;i===ce&&(e.key=null);let a=await ht("value",e.value,t,r);if(a===W)return W;a===ce&&(e.value=null)}}return n}function Wi(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Zi(s,e,t,r){if(typeof t=="function")return t(s,e,r);if(F.isMap(e))return t.Map?.(s,e,r);if(F.isSeq(e))return t.Seq?.(s,e,r);if(F.isPair(e))return t.Pair?.(s,e,r);if(F.isScalar(e))return t.Scalar?.(s,e,r);if(F.isAlias(e))return t.Alias?.(s,e,r)}function zi(s,e,t){let r=e[e.length-1];if(F.isCollection(r))r.items[s]=t;else if(F.isPair(r))s==="key"?r.key=t:r.value=t;else if(F.isDocument(r))r.contents=t;else{let n=F.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}qr.visit=Ss;qr.visitAsync=ks});var Pr=w(Qi=>{"use strict";var Gi=q(),Xu=It(),ef={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},tf=s=>s.replace(/[!,[\]{}]/g,e=>ef[e]),Lt=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[i,a]=r;return this.tags[i]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[i]=r;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{let a=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,a),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let a=e.slice(2,-1);return a==="!"||a==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),a)}let[,r,n]=e.match(/^(.*!)([^!]*)$/s);n||t(`The ${e} tag has no suffix`);let i=this.tags[r];if(i)try{return i+decodeURIComponent(n)}catch(a){return t(String(a)),null}return r==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,r]of Object.entries(this.tags))if(e.startsWith(r))return t+tf(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(e&&r.length>0&&Gi.isNode(e.contents)){let i={};Xu.visit(e.contents,(a,o)=>{Gi.isNode(o)&&o.tag&&(i[o.tag]=!0)}),n=Object.keys(i)}else n=[];for(let[i,a]of r)i==="!!"&&a==="tag:yaml.org,2002:"||(!e||n.some(o=>o.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
3
|
+
`)}};Lt.defaultYaml={explicit:!1,version:"1.2"};Lt.defaultTags={"!!":"tag:yaml.org,2002:"};Qi.Directives=Lt});var As=w(Rt=>{"use strict";var Xi=q(),sf=It();function rf(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function ea(s){let e=new Set;return sf.visit(s,{Value(t,r){r.anchor&&e.add(r.anchor)}}),e}function ta(s,e){for(let t=1;;++t){let r=`${s}${t}`;if(!e.has(r))return r}}function nf(s,e){let t=[],r=new Map,n=null;return{onAnchor:i=>{t.push(i),n??(n=ea(s));let a=ta(e,n);return n.add(a),a},setAnchors:()=>{for(let i of t){let a=r.get(i);if(typeof a=="object"&&a.anchor&&(Xi.isScalar(a.node)||Xi.isCollection(a.node)))a.node.anchor=a.anchor;else{let o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=i,o}}},sourceObjects:r}}Rt.anchorIsValid=rf;Rt.anchorNames=ea;Rt.createNodeAnchors=nf;Rt.findNewAnchor=ta});var Mr=w(sa=>{"use strict";function qt(s,e,t,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let n=0,i=r.length;n<i;++n){let a=r[n],o=qt(s,r,String(n),a);o===void 0?delete r[n]:o!==a&&(r[n]=o)}else if(r instanceof Map)for(let n of Array.from(r.keys())){let i=r.get(n),a=qt(s,r,n,i);a===void 0?r.delete(n):a!==i&&r.set(n,a)}else if(r instanceof Set)for(let n of Array.from(r)){let i=qt(s,r,n,n);i===void 0?r.delete(n):i!==n&&(r.delete(n),r.add(i))}else for(let[n,i]of Object.entries(r)){let a=qt(s,r,n,i);a===void 0?delete r[n]:a!==i&&(r[n]=a)}return s.call(e,t,r)}sa.applyReviver=qt});var we=w(na=>{"use strict";var af=q();function ra(s,e,t){if(Array.isArray(s))return s.map((r,n)=>ra(r,String(n),t));if(s&&typeof s.toJSON=="function"){if(!t||!af.hasAnchor(s))return s.toJSON(e,t);let r={aliasCount:0,count:1,res:void 0};t.anchors.set(s,r),t.onCreate=i=>{r.res=i,delete t.onCreate};let n=s.toJSON(e,t);return t.onCreate&&t.onCreate(n),n}return typeof s=="bigint"&&!t?.keep?Number(s):s}na.toJS=ra});var Es=w(aa=>{"use strict";var of=Mr(),ia=q(),cf=we(),$r=class{constructor(e){Object.defineProperty(this,ia.NODE_TYPE,{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:r,onAnchor:n,reviver:i}={}){if(!ia.isDocument(e))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},o=cf.toJS(this,"",a);if(typeof n=="function")for(let{count:c,res:l}of a.anchors.values())n(l,c);return typeof i=="function"?of.applyReviver(i,{"":o},"",o):o}};aa.NodeBase=$r});var Pt=w(oa=>{"use strict";var lf=As(),uf=It(),pt=q(),ff=Es(),df=we(),jr=class extends ff.NodeBase{constructor(e){super(pt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let r;t?.aliasResolveCache?r=t.aliasResolveCache:(r=[],uf.visit(e,{Node:(i,a)=>{(pt.isAlias(a)||pt.hasAnchor(a))&&r.push(a)}}),t&&(t.aliasResolveCache=r));let n;for(let i of r){if(i===this)break;i.anchor===this.source&&(n=i)}return n}toJSON(e,t){if(!t)return{source:this.source};let{anchors:r,doc:n,maxAliasCount:i}=t,a=this.resolve(n,t);if(!a){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let o=r.get(a);if(o||(df.toJS(a,null,t),o=r.get(a)),o?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Ts(n,a,r)),o.count*o.aliasCount>i)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return o.res}toString(e,t,r){let n=`*${this.source}`;if(e){if(lf.anchorIsValid(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`${n} `}return n}};function Ts(s,e,t){if(pt.isAlias(e)){let r=e.resolve(s),n=t&&r&&t.get(r);return n?n.count*n.aliasCount:0}else if(pt.isCollection(e)){let r=0;for(let n of e.items){let i=Ts(s,n,t);i>r&&(r=i)}return r}else if(pt.isPair(e)){let r=Ts(s,e.key,t),n=Ts(s,e.value,t);return Math.max(r,n)}return 1}oa.Alias=jr});var B=w(Dr=>{"use strict";var hf=q(),pf=Es(),mf=we(),yf=s=>!s||typeof s!="function"&&typeof s!="object",_e=class extends pf.NodeBase{constructor(e){super(hf.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:mf.toJS(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";Dr.Scalar=_e;Dr.isScalarValue=yf});var Mt=w(la=>{"use strict";var gf=Pt(),Je=q(),ca=B(),vf="tag:yaml.org,2002:";function bf(s,e,t){if(e){let r=t.filter(i=>i.tag===e),n=r.find(i=>!i.format)??r[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return t.find(r=>r.identify?.(s)&&!r.format)}function wf(s,e,t){if(Je.isDocument(s)&&(s=s.contents),Je.isNode(s))return s;if(Je.isPair(s)){let f=t.schema[Je.MAP].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:r,onAnchor:n,onTagObj:i,schema:a,sourceObjects:o}=t,c;if(r&&s&&typeof s=="object"){if(c=o.get(s),c)return c.anchor??(c.anchor=n(s)),new gf.Alias(c.anchor);c={anchor:null,node:null},o.set(s,c)}e?.startsWith("!!")&&(e=vf+e.slice(2));let l=bf(s,e,a.tags);if(!l){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let f=new ca.Scalar(s);return c&&(c.node=f),f}l=s instanceof Map?a[Je.MAP]:Symbol.iterator in Object(s)?a[Je.SEQ]:a[Je.MAP]}i&&(i(l),delete t.onTagObj);let u=l?.createNode?l.createNode(t.schema,s,t):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(t.schema,s,t):new ca.Scalar(s);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}la.createNode=wf});var xs=w(Os=>{"use strict";var _f=Mt(),le=q(),Sf=Es();function Br(s,e,t){let r=t;for(let n=e.length-1;n>=0;--n){let i=e[n];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let a=[];a[i]=r,r=a}else r=new Map([[i,r]])}return _f.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var ua=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,Fr=class extends Sf.NodeBase{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(r=>le.isNode(r)||le.isPair(r)?r.clone(e):r),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(ua(e))this.add(t);else{let[r,...n]=e,i=this.get(r,!0);if(le.isCollection(i))i.addIn(n,t);else if(i===void 0&&this.schema)this.set(r,Br(this.schema,n,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let n=this.get(t,!0);if(le.isCollection(n))return n.deleteIn(r);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...n]=e,i=this.get(r,!0);return n.length===0?!t&&le.isScalar(i)?i.value:i:le.isCollection(i)?i.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!le.isPair(t))return!1;let r=t.value;return r==null||e&&le.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let n=this.get(t,!0);return le.isCollection(n)?n.hasIn(r):!1}setIn(e,t){let[r,...n]=e;if(n.length===0)this.set(r,t);else{let i=this.get(r,!0);if(le.isCollection(i))i.setIn(n,t);else if(i===void 0&&this.schema)this.set(r,Br(this.schema,n,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}};Os.Collection=Fr;Os.collectionFromPath=Br;Os.isEmptyPath=ua});var $t=w(Ns=>{"use strict";var kf=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Kr(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var Af=(s,e,t)=>s.endsWith(`
|
|
4
|
+
`)?Kr(t,e):t.includes(`
|
|
5
|
+
`)?`
|
|
6
|
+
`+Kr(t,e):(s.endsWith(" ")?"":" ")+t;Ns.indentComment=Kr;Ns.lineComment=Af;Ns.stringifyComment=kf});var da=w(jt=>{"use strict";var Ef="flow",Ur="block",Cs="quoted";function Tf(s,e,t="flow",{indentAtStart:r,lineWidth:n=80,minContentWidth:i=20,onFold:a,onOverflow:o}={}){if(!n||n<0)return s;n<i&&(i=0);let c=Math.max(1+i,1+n-e.length);if(s.length<=c)return s;let l=[],u={},f=n-e.length;typeof r=="number"&&(r>n-Math.max(2,i)?l.push(0):f=n-r);let d,p,g=!1,h=-1,m=-1,v=-1;t===Ur&&(h=fa(s,h,e.length),h!==-1&&(f=h+c));for(let k;k=s[h+=1];){if(t===Cs&&k==="\\"){switch(m=h,s[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}v=h}if(k===`
|
|
7
|
+
`)t===Ur&&(h=fa(s,h,e.length)),f=h+e.length+c,d=void 0;else{if(k===" "&&p&&p!==" "&&p!==`
|
|
8
|
+
`&&p!==" "){let x=s[h+1];x&&x!==" "&&x!==`
|
|
9
|
+
`&&x!==" "&&(d=h)}if(h>=f)if(d)l.push(d),f=d+c,d=void 0;else if(t===Cs){for(;p===" "||p===" ";)p=k,k=s[h+=1],g=!0;let x=h>v+1?h-2:m-1;if(u[x])return s;l.push(x),u[x]=!0,f=x+c,d=void 0}else g=!0}p=k}if(g&&o&&o(),l.length===0)return s;a&&a();let S=s.slice(0,l[0]);for(let k=0;k<l.length;++k){let x=l[k],C=l[k+1]||s.length;x===0?S=`
|
|
10
|
+
${e}${s.slice(0,C)}`:(t===Cs&&u[x]&&(S+=`${s[x]}\\`),S+=`
|
|
11
|
+
${e}${s.slice(x+1,C)}`)}return S}function fa(s,e,t){let r=e,n=e+1,i=s[n];for(;i===" "||i===" ";)if(e<n+t)i=s[++e];else{do i=s[++e];while(i&&i!==`
|
|
12
|
+
`);r=e,n=e+1,i=s[n]}return r}jt.FOLD_BLOCK=Ur;jt.FOLD_FLOW=Ef;jt.FOLD_QUOTED=Cs;jt.foldFlowLines=Tf});var Bt=w(ha=>{"use strict";var re=B(),Se=da(),Ls=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),Rs=s=>/^(%|---|\.\.\.)/m.test(s);function Of(s,e,t){if(!e||e<0)return!1;let r=e-t,n=s.length;if(n<=r)return!1;for(let i=0,a=0;i<n;++i)if(s[i]===`
|
|
13
|
+
`){if(i-a>r)return!0;if(a=i+1,n-a<=r)return!1}return!0}function Dt(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:r}=e,n=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(Rs(s)?" ":""),a="",o=0;for(let c=0,l=t[c];l;l=t[++c])if(l===" "&&t[c+1]==="\\"&&t[c+2]==="n"&&(a+=t.slice(o,c)+"\\ ",c+=1,o=c,l="\\"),l==="\\")switch(t[c+1]){case"u":{a+=t.slice(o,c);let u=t.substr(c+2,4);switch(u){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:u.substr(0,2)==="00"?a+="\\x"+u.substr(2):a+=t.substr(c,6)}c+=5,o=c+1}break;case"n":if(r||t[c+2]==='"'||t.length<n)c+=1;else{for(a+=t.slice(o,c)+`
|
|
14
|
+
|
|
15
|
+
`;t[c+2]==="\\"&&t[c+3]==="n"&&t[c+4]!=='"';)a+=`
|
|
16
|
+
`,c+=2;a+=i,t[c+2]===" "&&(a+="\\"),c+=1,o=c+1}break;default:c+=1}return a=o?a+t.slice(o):t,r?a:Se.foldFlowLines(a,i,Se.FOLD_QUOTED,Ls(e,!1))}function Vr(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test(s))return Dt(s,e);let t=e.indent||(Rs(s)?" ":""),r="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${t}`)+"'";return e.implicitKey?r:Se.foldFlowLines(r,t,Se.FOLD_FLOW,Ls(e,!1))}function mt(s,e){let{singleQuote:t}=e.options,r;if(t===!1)r=Dt;else{let n=s.includes('"'),i=s.includes("'");n&&!i?r=Vr:i&&!n?r=Dt:r=t?Vr:Dt}return r(s,e)}var Hr;try{Hr=new RegExp(`(^|(?<!
|
|
19
|
+
))
|
|
20
|
+
+(?!
|
|
21
|
+
|$)`,"g")}catch{Hr=/\n+(?!\n|$)/g}function Is({comment:s,type:e,value:t},r,n,i){let{blockQuote:a,commentString:o,lineWidth:c}=r.options;if(!a||/\n[\t ]+$/.test(t))return mt(t,r);let l=r.indent||(r.forceBlockIndent||Rs(t)?" ":""),u=a==="literal"?!0:a==="folded"||e===re.Scalar.BLOCK_FOLDED?!1:e===re.Scalar.BLOCK_LITERAL?!0:!Of(t,c,l.length);if(!t)return u?`|
|
|
22
|
+
`:`>
|
|
23
|
+
`;let f,d;for(d=t.length;d>0;--d){let C=t[d-1];if(C!==`
|
|
24
|
+
`&&C!==" "&&C!==" ")break}let p=t.substring(d),g=p.indexOf(`
|
|
25
|
+
`);g===-1?f="-":t===p||g!==p.length-1?(f="+",i&&i()):f="",p&&(t=t.slice(0,-p.length),p[p.length-1]===`
|
|
26
|
+
`&&(p=p.slice(0,-1)),p=p.replace(Hr,`$&${l}`));let h=!1,m,v=-1;for(m=0;m<t.length;++m){let C=t[m];if(C===" ")h=!0;else if(C===`
|
|
27
|
+
`)v=m;else break}let S=t.substring(0,v<m?v+1:m);S&&(t=t.substring(S.length),S=S.replace(/\n+/g,`$&${l}`));let x=(h?l?"2":"1":"")+f;if(s&&(x+=" "+o(s.replace(/ ?[\r\n]+/g," ")),n&&n()),!u){let C=t.replace(/\n+/g,`
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),T=!1,P=Ls(r,!0);a!=="folded"&&e!==re.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{T=!0});let A=Se.foldFlowLines(`${S}${C}${p}`,l,Se.FOLD_BLOCK,P);if(!T)return`>${x}
|
|
29
|
+
${l}${A}`}return t=t.replace(/\n+/g,`$&${l}`),`|${x}
|
|
30
|
+
${l}${S}${t}${p}`}function xf(s,e,t,r){let{type:n,value:i}=s,{actualString:a,implicitKey:o,indent:c,indentStep:l,inFlow:u}=e;if(o&&i.includes(`
|
|
31
|
+
`)||u&&/[[\]{},]/.test(i))return mt(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return o||u||!i.includes(`
|
|
32
|
+
`)?mt(i,e):Is(s,e,t,r);if(!o&&!u&&n!==re.Scalar.PLAIN&&i.includes(`
|
|
33
|
+
`))return Is(s,e,t,r);if(Rs(i)){if(c==="")return e.forceBlockIndent=!0,Is(s,e,t,r);if(o&&c===l)return mt(i,e)}let f=i.replace(/\n+/g,`$&
|
|
34
|
+
${c}`);if(a){let d=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(f),{compat:p,tags:g}=e.doc.schema;if(g.some(d)||p?.some(d))return mt(i,e)}return o?f:Se.foldFlowLines(f,c,Se.FOLD_FLOW,Ls(e,!1))}function Nf(s,e,t,r){let{implicitKey:n,inFlow:i}=e,a=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:o}=s;o!==re.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=re.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case re.Scalar.BLOCK_FOLDED:case re.Scalar.BLOCK_LITERAL:return n||i?mt(a.value,e):Is(a,e,t,r);case re.Scalar.QUOTE_DOUBLE:return Dt(a.value,e);case re.Scalar.QUOTE_SINGLE:return Vr(a.value,e);case re.Scalar.PLAIN:return xf(a,e,t,r);default:return null}},l=c(o);if(l===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=n&&u||f;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}ha.stringifyString=Nf});var Ft=w(Yr=>{"use strict";var Cf=As(),ke=q(),If=$t(),Lf=Bt();function Rf(s,e){let t=Object.assign({blockQuote:!0,commentString:If.stringifyComment,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},s.schema.toStringOptions,e),r;switch(t.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:r,options:t}}function qf(s,e){if(e.tag){let n=s.filter(i=>i.tag===e.tag);if(n.length>0)return n.find(i=>i.format===e.format)??n[0]}let t,r;if(ke.isScalar(e)){r=e.value;let n=s.filter(i=>i.identify?.(r));if(n.length>1){let i=n.filter(a=>a.test);i.length>0&&(n=i)}t=n.find(i=>i.format===e.format)??n.find(i=>!i.format)}else r=e,t=s.find(n=>n.nodeClass&&r instanceof n.nodeClass);if(!t){let n=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${n} value`)}return t}function Pf(s,e,{anchors:t,doc:r}){if(!r.directives)return"";let n=[],i=(ke.isScalar(s)||ke.isCollection(s))&&s.anchor;i&&Cf.anchorIsValid(i)&&(t.add(i),n.push(`&${i}`));let a=s.tag??(e.default?null:e.tag);return a&&n.push(r.directives.tagString(a)),n.join(" ")}function Mf(s,e,t,r){if(ke.isPair(s))return s.toString(e,t,r);if(ke.isAlias(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let n,i=ke.isNode(s)?s:e.doc.createNode(s,{onTagObj:c=>n=c});n??(n=qf(e.doc.schema.tags,i));let a=Pf(i,n,e);a.length>0&&(e.indentAtStart=(e.indentAtStart??0)+a.length+1);let o=typeof n.stringify=="function"?n.stringify(i,e,t,r):ke.isScalar(i)?Lf.stringifyString(i,e,t,r):i.toString(e,t,r);return a?ke.isScalar(i)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a}
|
|
35
|
+
${e.indent}${o}`:o}Yr.createStringifyContext=Rf;Yr.stringify=Mf});var ga=w(ya=>{"use strict";var me=q(),pa=B(),ma=Ft(),Kt=$t();function $f({key:s,value:e},t,r,n){let{allNullValues:i,doc:a,indent:o,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=t,d=me.isNode(s)&&s.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(me.isCollection(s)||!me.isNode(s)&&typeof s=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let p=!f&&(!s||d&&e==null&&!t.inFlow||me.isCollection(s)||(me.isScalar(s)?s.type===pa.Scalar.BLOCK_FOLDED||s.type===pa.Scalar.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(f||!i),indent:o+c});let g=!1,h=!1,m=ma.stringify(s,t,()=>g=!0,()=>h=!0);if(!p&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(i||e==null)return g&&r&&r(),m===""?"?":p?`? ${m}`:m}else if(i&&!f||e==null&&p)return m=`? ${m}`,d&&!g?m+=Kt.lineComment(m,t.indent,l(d)):h&&n&&n(),m;g&&(d=null),p?(d&&(m+=Kt.lineComment(m,t.indent,l(d))),m=`? ${m}
|
|
36
|
+
${o}:`):(m=`${m}:`,d&&(m+=Kt.lineComment(m,t.indent,l(d))));let v,S,k;me.isNode(e)?(v=!!e.spaceBefore,S=e.commentBefore,k=e.comment):(v=!1,S=null,k=null,e&&typeof e=="object"&&(e=a.createNode(e))),t.implicitKey=!1,!p&&!d&&me.isScalar(e)&&(t.indentAtStart=m.length+1),h=!1,!u&&c.length>=2&&!t.inFlow&&!p&&me.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let x=!1,C=ma.stringify(e,t,()=>x=!0,()=>h=!0),T=" ";if(d||v||S){if(T=v?`
|
|
37
|
+
`:"",S){let P=l(S);T+=`
|
|
38
|
+
${Kt.indentComment(P,t.indent)}`}C===""&&!t.inFlow?T===`
|
|
39
|
+
`&&k&&(T=`
|
|
40
|
+
|
|
41
|
+
`):T+=`
|
|
42
|
+
${t.indent}`}else if(!p&&me.isCollection(e)){let P=C[0],A=C.indexOf(`
|
|
43
|
+
`),$=A!==-1,K=t.inFlow??e.flow??e.items.length===0;if($||!K){let z=!1;if($&&(P==="&"||P==="!")){let D=C.indexOf(" ");P==="&"&&D!==-1&&D<A&&C[D+1]==="!"&&(D=C.indexOf(" ",D+1)),(D===-1||A<D)&&(z=!0)}z||(T=`
|
|
44
|
+
${t.indent}`)}}else(C===""||C[0]===`
|
|
45
|
+
`)&&(T="");return m+=T+C,t.inFlow?x&&r&&r():k&&!x?m+=Kt.lineComment(m,t.indent,l(k)):h&&n&&n(),m}ya.stringifyPair=$f});var Wr=w(Jr=>{"use strict";var va=ps("process");function jf(s,...e){s==="debug"&&console.log(...e)}function Df(s,e){(s==="debug"||s==="warn")&&(typeof va.emitWarning=="function"?va.emitWarning(e):console.warn(e))}Jr.debug=jf;Jr.warn=Df});var $s=w(Ms=>{"use strict";var Ut=q(),ba=B(),qs="<<",Ps={identify:s=>s===qs||typeof s=="symbol"&&s.description===qs,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ba.Scalar(Symbol(qs)),{addToJSMap:wa}),stringify:()=>qs},Bf=(s,e)=>(Ps.identify(e)||Ut.isScalar(e)&&(!e.type||e.type===ba.Scalar.PLAIN)&&Ps.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===Ps.tag&&t.default);function wa(s,e,t){if(t=s&&Ut.isAlias(t)?t.resolve(s.doc):t,Ut.isSeq(t))for(let r of t.items)Zr(s,e,r);else if(Array.isArray(t))for(let r of t)Zr(s,e,r);else Zr(s,e,t)}function Zr(s,e,t){let r=s&&Ut.isAlias(t)?t.resolve(s.doc):t;if(!Ut.isMap(r))throw new Error("Merge sources must be maps or map aliases");let n=r.toJSON(null,s,Map);for(let[i,a]of n)e instanceof Map?e.has(i)||e.set(i,a):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:a,writable:!0,enumerable:!0,configurable:!0});return e}Ms.addMergeToJSMap=wa;Ms.isMergeKey=Bf;Ms.merge=Ps});var Gr=w(ka=>{"use strict";var Ff=Wr(),_a=$s(),Kf=Ft(),Sa=q(),zr=we();function Uf(s,e,{key:t,value:r}){if(Sa.isNode(t)&&t.addToJSMap)t.addToJSMap(s,e,r);else if(_a.isMergeKey(s,t))_a.addMergeToJSMap(s,e,r);else{let n=zr.toJS(t,"",s);if(e instanceof Map)e.set(n,zr.toJS(r,n,s));else if(e instanceof Set)e.add(n);else{let i=Vf(t,n,s),a=zr.toJS(r,i,s);i in e?Object.defineProperty(e,i,{value:a,writable:!0,enumerable:!0,configurable:!0}):e[i]=a}}return e}function Vf(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(Sa.isNode(s)&&t?.doc){let r=Kf.createStringifyContext(t.doc,{});r.anchors=new Set;for(let i of t.anchors.keys())r.anchors.add(i.anchor);r.inFlow=!0,r.inStringifyKey=!0;let n=s.toString(r);if(!t.mapKeyWarned){let i=JSON.stringify(n);i.length>40&&(i=i.substring(0,36)+'..."'),Ff.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return n}return JSON.stringify(e)}ka.addPairToJSMap=Uf});var Ae=w(Qr=>{"use strict";var Aa=Mt(),Hf=ga(),Yf=Gr(),js=q();function Jf(s,e,t){let r=Aa.createNode(s,void 0,t),n=Aa.createNode(e,void 0,t);return new Ds(r,n)}var Ds=class s{constructor(e,t=null){Object.defineProperty(this,js.NODE_TYPE,{value:js.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:r}=this;return js.isNode(t)&&(t=t.clone(e)),js.isNode(r)&&(r=r.clone(e)),new s(t,r)}toJSON(e,t){let r=t?.mapAsMap?new Map:{};return Yf.addPairToJSMap(t,r,this)}toString(e,t,r){return e?.doc?Hf.stringifyPair(this,e,t,r):JSON.stringify(this)}};Qr.Pair=Ds;Qr.createPair=Jf});var Xr=w(Ta=>{"use strict";var We=q(),Ea=Ft(),Bs=$t();function Wf(s,e,t){return(e.inFlow??s.flow?zf:Zf)(s,e,t)}function Zf({comment:s,items:e},t,{blockItemPrefix:r,flowChars:n,itemIndent:i,onChompKeep:a,onComment:o}){let{indent:c,options:{commentString:l}}=t,u=Object.assign({},t,{indent:i,type:null}),f=!1,d=[];for(let g=0;g<e.length;++g){let h=e[g],m=null;if(We.isNode(h))!f&&h.spaceBefore&&d.push(""),Fs(t,d,h.commentBefore,f),h.comment&&(m=h.comment);else if(We.isPair(h)){let S=We.isNode(h.key)?h.key:null;S&&(!f&&S.spaceBefore&&d.push(""),Fs(t,d,S.commentBefore,f))}f=!1;let v=Ea.stringify(h,u,()=>m=null,()=>f=!0);m&&(v+=Bs.lineComment(v,i,l(m))),f&&m&&(f=!1),d.push(r+v)}let p;if(d.length===0)p=n.start+n.end;else{p=d[0];for(let g=1;g<d.length;++g){let h=d[g];p+=h?`
|
|
46
|
+
${c}${h}`:`
|
|
47
|
+
`}}return s?(p+=`
|
|
48
|
+
`+Bs.indentComment(l(s),c),o&&o()):f&&a&&a(),p}function zf({items:s},e,{flowChars:t,itemIndent:r}){let{indent:n,indentStep:i,flowCollectionPadding:a,options:{commentString:o}}=e;r+=i;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let g=0;g<s.length;++g){let h=s[g],m=null;if(We.isNode(h))h.spaceBefore&&f.push(""),Fs(e,f,h.commentBefore,!1),h.comment&&(m=h.comment);else if(We.isPair(h)){let S=We.isNode(h.key)?h.key:null;S&&(S.spaceBefore&&f.push(""),Fs(e,f,S.commentBefore,!1),S.comment&&(l=!0));let k=We.isNode(h.value)?h.value:null;k?(k.comment&&(m=k.comment),k.commentBefore&&(l=!0)):h.value==null&&S?.comment&&(m=S.comment)}m&&(l=!0);let v=Ea.stringify(h,c,()=>m=null);l||(l=f.length>u||v.includes(`
|
|
49
|
+
`)),g<s.length-1?v+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=f.reduce((S,k)=>S+k.length+2,2)+(v.length+2)>e.options.lineWidth)),l&&(v+=",")),m&&(v+=Bs.lineComment(v,r,o(m))),f.push(v),u=f.length}let{start:d,end:p}=t;if(f.length===0)return d+p;if(!l){let g=f.reduce((h,m)=>h+m.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let h of f)g+=h?`
|
|
50
|
+
${i}${n}${h}`:`
|
|
51
|
+
`;return`${g}
|
|
52
|
+
${n}${p}`}else return`${d}${a}${f.join(" ")}${a}${p}`}function Fs({indent:s,options:{commentString:e}},t,r,n){if(r&&n&&(r=r.replace(/^\n+/,"")),r){let i=Bs.indentComment(e(r),s);t.push(i.trimStart())}}Ta.stringifyCollection=Wf});var Te=w(tn=>{"use strict";var Gf=Xr(),Qf=Gr(),Xf=xs(),Ee=q(),Ks=Ae(),ed=B();function Vt(s,e){let t=Ee.isScalar(e)?e.value:e;for(let r of s)if(Ee.isPair(r)&&(r.key===e||r.key===t||Ee.isScalar(r.key)&&r.key.value===t))return r}var en=class extends Xf.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ee.MAP,e),this.items=[]}static from(e,t,r){let{keepUndefined:n,replacer:i}=r,a=new this(e),o=(c,l)=>{if(typeof i=="function")l=i.call(t,c,l);else if(Array.isArray(i)&&!i.includes(c))return;(l!==void 0||n)&&a.items.push(Ks.createPair(c,l,r))};if(t instanceof Map)for(let[c,l]of t)o(c,l);else if(t&&typeof t=="object")for(let c of Object.keys(t))o(c,t[c]);return typeof e.sortMapEntries=="function"&&a.items.sort(e.sortMapEntries),a}add(e,t){let r;Ee.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Ks.Pair(e,e?.value):r=new Ks.Pair(e.key,e.value);let n=Vt(this.items,r.key),i=this.schema?.sortMapEntries;if(n){if(!t)throw new Error(`Key ${r.key} already set`);Ee.isScalar(n.value)&&ed.isScalarValue(r.value)?n.value.value=r.value:n.value=r.value}else if(i){let a=this.items.findIndex(o=>i(r,o)<0);a===-1?this.items.push(r):this.items.splice(a,0,r)}else this.items.push(r)}delete(e){let t=Vt(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Vt(this.items,e)?.value;return(!t&&Ee.isScalar(n)?n.value:n)??void 0}has(e){return!!Vt(this.items,e)}set(e,t){this.add(new Ks.Pair(e,t),!0)}toJSON(e,t,r){let n=r?new r:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(n);for(let i of this.items)Qf.addPairToJSMap(t,n,i);return n}toString(e,t,r){if(!e)return JSON.stringify(this);for(let n of this.items)if(!Ee.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Gf.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}};tn.YAMLMap=en;tn.findPair=Vt});var yt=w(xa=>{"use strict";var td=q(),Oa=Te(),sd={collection:"map",default:!0,nodeClass:Oa.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(s,e){return td.isMap(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>Oa.YAMLMap.from(s,e,t)};xa.map=sd});var Oe=w(Na=>{"use strict";var rd=Mt(),nd=Xr(),id=xs(),Vs=q(),ad=B(),od=we(),sn=class extends id.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Vs.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Us(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let r=Us(e);if(typeof r!="number")return;let n=this.items[r];return!t&&Vs.isScalar(n)?n.value:n}has(e){let t=Us(e);return typeof t=="number"&&t<this.items.length}set(e,t){let r=Us(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[r];Vs.isScalar(n)&&ad.isScalarValue(t)?n.value=t:this.items[r]=t}toJSON(e,t){let r=[];t?.onCreate&&t.onCreate(r);let n=0;for(let i of this.items)r.push(od.toJS(i,String(n++),t));return r}toString(e,t,r){return e?nd.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:t}):JSON.stringify(this)}static from(e,t,r){let{replacer:n}=r,i=new this(e);if(t&&Symbol.iterator in Object(t)){let a=0;for(let o of t){if(typeof n=="function"){let c=t instanceof Set?o:String(a++);o=n.call(t,c,o)}i.items.push(rd.createNode(o,void 0,r))}}return i}};function Us(s){let e=Vs.isScalar(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Na.YAMLSeq=sn});var gt=w(Ia=>{"use strict";var cd=q(),Ca=Oe(),ld={collection:"seq",default:!0,nodeClass:Ca.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(s,e){return cd.isSeq(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>Ca.YAMLSeq.from(s,e,t)};Ia.seq=ld});var Ht=w(La=>{"use strict";var ud=Bt(),fd={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,r){return e=Object.assign({actualString:!0},e),ud.stringifyString(s,e,t,r)}};La.string=fd});var Hs=w(Pa=>{"use strict";var Ra=B(),qa={identify:s=>s==null,createNode:()=>new Ra.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ra.Scalar(null),stringify:({source:s},e)=>typeof s=="string"&&qa.test.test(s)?s:e.options.nullStr};Pa.nullTag=qa});var rn=w($a=>{"use strict";var dd=B(),Ma={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new dd.Scalar(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&Ma.test.test(s)){let r=s[0]==="t"||s[0]==="T";if(e===r)return s}return e?t.options.trueStr:t.options.falseStr}};$a.boolTag=Ma});var vt=w(ja=>{"use strict";function hd({format:s,minFractionDigits:e,tag:t,value:r}){if(typeof r=="bigint")return String(r);let n=typeof r=="number"?r:Number(r);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let i=Object.is(r,-0)?"-0":JSON.stringify(r);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(i)){let a=i.indexOf(".");a<0&&(a=i.length,i+=".");let o=e-(i.length-a-1);for(;o-- >0;)i+="0"}return i}ja.stringifyNumber=hd});var an=w(Ys=>{"use strict";var pd=B(),nn=vt(),md={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:nn.stringifyNumber},yd={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():nn.stringifyNumber(s)}},gd={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){let e=new pd.Scalar(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:nn.stringifyNumber};Ys.float=gd;Ys.floatExp=yd;Ys.floatNaN=md});var cn=w(Ws=>{"use strict";var Da=vt(),Js=s=>typeof s=="bigint"||Number.isInteger(s),on=(s,e,t,{intAsBigInt:r})=>r?BigInt(s):parseInt(s.substring(e),t);function Ba(s,e,t){let{value:r}=s;return Js(r)&&r>=0?t+r.toString(e):Da.stringifyNumber(s)}var vd={identify:s=>Js(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>on(s,2,8,t),stringify:s=>Ba(s,8,"0o")},bd={identify:Js,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>on(s,0,10,t),stringify:Da.stringifyNumber},wd={identify:s=>Js(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>on(s,2,16,t),stringify:s=>Ba(s,16,"0x")};Ws.int=bd;Ws.intHex=wd;Ws.intOct=vd});var Ka=w(Fa=>{"use strict";var _d=yt(),Sd=Hs(),kd=gt(),Ad=Ht(),Ed=rn(),ln=an(),un=cn(),Td=[_d.map,kd.seq,Ad.string,Sd.nullTag,Ed.boolTag,un.intOct,un.int,un.intHex,ln.floatNaN,ln.floatExp,ln.float];Fa.schema=Td});var Ha=w(Va=>{"use strict";var Od=B(),xd=yt(),Nd=gt();function Ua(s){return typeof s=="bigint"||Number.isInteger(s)}var Zs=({value:s})=>JSON.stringify(s),Cd=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Zs},{identify:s=>s==null,createNode:()=>new Od.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Zs},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:Zs},{identify:Ua,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>Ua(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Zs}],Id={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Ld=[xd.map,Nd.seq].concat(Cd,Id);Va.schema=Ld});var dn=w(Ya=>{"use strict";var Yt=ps("buffer"),fn=B(),Rd=Bt(),qd={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof Yt.Buffer=="function")return Yt.Buffer.from(s,"base64");if(typeof atob=="function"){let t=atob(s.replace(/[\n\r]/g,"")),r=new Uint8Array(t.length);for(let n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},r,n,i){if(!t)return"";let a=t,o;if(typeof Yt.Buffer=="function")o=a instanceof Yt.Buffer?a.toString("base64"):Yt.Buffer.from(a.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<a.length;++l)c+=String.fromCharCode(a[l]);o=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=fn.Scalar.BLOCK_LITERAL),e!==fn.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(o.length/c),u=new Array(l);for(let f=0,d=0;f<l;++f,d+=c)u[f]=o.substr(d,c);o=u.join(e===fn.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return Rd.stringifyString({comment:s,type:e,value:o},r,n,i)}};Ya.binary=qd});var Qs=w(Gs=>{"use strict";var zs=q(),hn=Ae(),Pd=B(),Md=Oe();function Ja(s,e){if(zs.isSeq(s))for(let t=0;t<s.items.length;++t){let r=s.items[t];if(!zs.isPair(r)){if(zs.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let n=r.items[0]||new hn.Pair(new Pd.Scalar(null));if(r.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${r.commentBefore}
|
|
54
|
+
${n.key.commentBefore}`:r.commentBefore),r.comment){let i=n.value??n.key;i.comment=i.comment?`${r.comment}
|
|
55
|
+
${i.comment}`:r.comment}r=n}s.items[t]=zs.isPair(r)?r:new hn.Pair(r)}}else e("Expected a sequence for this tag");return s}function Wa(s,e,t){let{replacer:r}=t,n=new Md.YAMLSeq(s);n.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let a of e){typeof r=="function"&&(a=r.call(e,String(i++),a));let o,c;if(Array.isArray(a))if(a.length===2)o=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let l=Object.keys(a);if(l.length===1)o=l[0],c=a[o];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else o=a;n.items.push(hn.createPair(o,c,t))}return n}var $d={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ja,createNode:Wa};Gs.createPairs=Wa;Gs.pairs=$d;Gs.resolvePairs=Ja});var yn=w(mn=>{"use strict";var Za=q(),pn=we(),Jt=Te(),jd=Oe(),za=Qs(),Ze=class s extends jd.YAMLSeq{constructor(){super(),this.add=Jt.YAMLMap.prototype.add.bind(this),this.delete=Jt.YAMLMap.prototype.delete.bind(this),this.get=Jt.YAMLMap.prototype.get.bind(this),this.has=Jt.YAMLMap.prototype.has.bind(this),this.set=Jt.YAMLMap.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let r=new Map;t?.onCreate&&t.onCreate(r);for(let n of this.items){let i,a;if(Za.isPair(n)?(i=pn.toJS(n.key,"",t),a=pn.toJS(n.value,i,t)):i=pn.toJS(n,"",t),r.has(i))throw new Error("Ordered maps must not include duplicate keys");r.set(i,a)}return r}static from(e,t,r){let n=za.createPairs(e,t,r),i=new this;return i.items=n.items,i}};Ze.tag="tag:yaml.org,2002:omap";var Dd={collection:"seq",identify:s=>s instanceof Map,nodeClass:Ze,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=za.resolvePairs(s,e),r=[];for(let{key:n}of t.items)Za.isScalar(n)&&(r.includes(n.value)?e(`Ordered maps must not include duplicate keys: ${n.value}`):r.push(n.value));return Object.assign(new Ze,t)},createNode:(s,e,t)=>Ze.from(s,e,t)};mn.YAMLOMap=Ze;mn.omap=Dd});var to=w(gn=>{"use strict";var Ga=B();function Qa({value:s,source:e},t){return e&&(s?Xa:eo).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var Xa={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ga.Scalar(!0),stringify:Qa},eo={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ga.Scalar(!1),stringify:Qa};gn.falseTag=eo;gn.trueTag=Xa});var so=w(Xs=>{"use strict";var Bd=B(),vn=vt(),Fd={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:vn.stringifyNumber},Kd={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():vn.stringifyNumber(s)}},Ud={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new Bd.Scalar(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let r=s.substring(t+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:vn.stringifyNumber};Xs.float=Ud;Xs.floatExp=Kd;Xs.floatNaN=Fd});var no=w(Zt=>{"use strict";var ro=vt(),Wt=s=>typeof s=="bigint"||Number.isInteger(s);function er(s,e,t,{intAsBigInt:r}){let n=s[0];if((n==="-"||n==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),r){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let a=BigInt(s);return n==="-"?BigInt(-1)*a:a}let i=parseInt(s,t);return n==="-"?-1*i:i}function bn(s,e,t){let{value:r}=s;if(Wt(r)){let n=r.toString(e);return r<0?"-"+t+n.substr(1):t+n}return ro.stringifyNumber(s)}var Vd={identify:Wt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>er(s,2,2,t),stringify:s=>bn(s,2,"0b")},Hd={identify:Wt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>er(s,1,8,t),stringify:s=>bn(s,8,"0")},Yd={identify:Wt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>er(s,0,10,t),stringify:ro.stringifyNumber},Jd={identify:Wt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>er(s,2,16,t),stringify:s=>bn(s,16,"0x")};Zt.int=Yd;Zt.intBin=Vd;Zt.intHex=Jd;Zt.intOct=Hd});var _n=w(wn=>{"use strict";var rr=q(),tr=Ae(),sr=Te(),ze=class s extends sr.YAMLMap{constructor(e){super(e),this.tag=s.tag}add(e){let t;rr.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new tr.Pair(e.key,null):t=new tr.Pair(e,null),sr.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let r=sr.findPair(this.items,e);return!t&&rr.isPair(r)?rr.isScalar(r.key)?r.key.value:r.key:r}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let r=sr.findPair(this.items,e);r&&!t?this.items.splice(this.items.indexOf(r),1):!r&&t&&this.items.push(new tr.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,r);throw new Error("Set items must all have null values")}static from(e,t,r){let{replacer:n}=r,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let a of t)typeof n=="function"&&(a=n.call(t,a,a)),i.items.push(tr.createPair(a,null,r));return i}};ze.tag="tag:yaml.org,2002:set";var Wd={collection:"map",identify:s=>s instanceof Set,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>ze.from(s,e,t),resolve(s,e){if(rr.isMap(s)){if(s.hasAllNullValues(!0))return Object.assign(new ze,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};wn.YAMLSet=ze;wn.set=Wd});var kn=w(nr=>{"use strict";var Zd=vt();function Sn(s,e){let t=s[0],r=t==="-"||t==="+"?s.substring(1):s,n=a=>e?BigInt(a):Number(a),i=r.replace(/_/g,"").split(":").reduce((a,o)=>a*n(60)+n(o),n(0));return t==="-"?n(-1)*i:i}function io(s){let{value:e}=s,t=a=>a;if(typeof e=="bigint")t=a=>BigInt(a);else if(isNaN(e)||!isFinite(e))return Zd.stringifyNumber(s);let r="";e<0&&(r="-",e*=t(-1));let n=t(60),i=[e%n];return e<60?i.unshift(0):(e=(e-i[0])/n,i.unshift(e%n),e>=60&&(e=(e-i[0])/n,i.unshift(e))),r+i.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var zd={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>Sn(s,t),stringify:io},Gd={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>Sn(s,!1),stringify:io},ao={identify:s=>s 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(s){let e=s.match(ao.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,r,n,i,a,o]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(t,r-1,n,i||0,a||0,o||0,c),u=e[8];if(u&&u!=="Z"){let f=Sn(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};nr.floatTime=Gd;nr.intTime=zd;nr.timestamp=ao});var lo=w(co=>{"use strict";var Qd=yt(),Xd=Hs(),eh=gt(),th=Ht(),sh=dn(),oo=to(),An=so(),ir=no(),rh=$s(),nh=yn(),ih=Qs(),ah=_n(),En=kn(),oh=[Qd.map,eh.seq,th.string,Xd.nullTag,oo.trueTag,oo.falseTag,ir.intBin,ir.intOct,ir.int,ir.intHex,An.floatNaN,An.floatExp,An.float,sh.binary,rh.merge,nh.omap,ih.pairs,ah.set,En.intTime,En.floatTime,En.timestamp];co.schema=oh});var wo=w(xn=>{"use strict";var po=yt(),ch=Hs(),mo=gt(),lh=Ht(),uh=rn(),Tn=an(),On=cn(),fh=Ka(),dh=Ha(),yo=dn(),zt=$s(),go=yn(),vo=Qs(),uo=lo(),bo=_n(),ar=kn(),fo=new Map([["core",fh.schema],["failsafe",[po.map,mo.seq,lh.string]],["json",dh.schema],["yaml11",uo.schema],["yaml-1.1",uo.schema]]),ho={binary:yo.binary,bool:uh.boolTag,float:Tn.float,floatExp:Tn.floatExp,floatNaN:Tn.floatNaN,floatTime:ar.floatTime,int:On.int,intHex:On.intHex,intOct:On.intOct,intTime:ar.intTime,map:po.map,merge:zt.merge,null:ch.nullTag,omap:go.omap,pairs:vo.pairs,seq:mo.seq,set:bo.set,timestamp:ar.timestamp},hh={"tag:yaml.org,2002:binary":yo.binary,"tag:yaml.org,2002:merge":zt.merge,"tag:yaml.org,2002:omap":go.omap,"tag:yaml.org,2002:pairs":vo.pairs,"tag:yaml.org,2002:set":bo.set,"tag:yaml.org,2002:timestamp":ar.timestamp};function ph(s,e,t){let r=fo.get(e);if(r&&!s)return t&&!r.includes(zt.merge)?r.concat(zt.merge):r.slice();let n=r;if(!n)if(Array.isArray(s))n=[];else{let i=Array.from(fo.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(s))for(let i of s)n=n.concat(i);else typeof s=="function"&&(n=s(n.slice()));return t&&(n=n.concat(zt.merge)),n.reduce((i,a)=>{let o=typeof a=="string"?ho[a]:a;if(!o){let c=JSON.stringify(a),l=Object.keys(ho).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return i.includes(o)||i.push(o),i},[])}xn.coreKnownTags=hh;xn.getTags=ph});var In=w(_o=>{"use strict";var Nn=q(),mh=yt(),yh=gt(),gh=Ht(),or=wo(),vh=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0,Cn=class s{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:n,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?or.getTags(e,"compat"):e?or.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=n?or.coreKnownTags:{},this.tags=or.getTags(t,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,Nn.MAP,{value:mh.map}),Object.defineProperty(this,Nn.SCALAR,{value:gh.string}),Object.defineProperty(this,Nn.SEQ,{value:yh.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?vh:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};_o.Schema=Cn});var ko=w(So=>{"use strict";var bh=q(),Ln=Ft(),Gt=$t();function wh(s,e){let t=[],r=e.directives===!0;if(e.directives!==!1&&s.directives){let c=s.directives.toString(s);c?(t.push(c),r=!0):s.directives.docStart&&(r=!0)}r&&t.push("---");let n=Ln.createStringifyContext(s,e),{commentString:i}=n.options;if(s.commentBefore){t.length!==1&&t.unshift("");let c=i(s.commentBefore);t.unshift(Gt.indentComment(c,""))}let a=!1,o=null;if(s.contents){if(bh.isNode(s.contents)){if(s.contents.spaceBefore&&r&&t.push(""),s.contents.commentBefore){let u=i(s.contents.commentBefore);t.push(Gt.indentComment(u,""))}n.forceBlockIndent=!!s.comment,o=s.contents.comment}let c=o?void 0:()=>a=!0,l=Ln.stringify(s.contents,n,()=>o=null,c);o&&(l+=Gt.lineComment(l,"",i(o))),(l[0]==="|"||l[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${l}`:t.push(l)}else t.push(Ln.stringify(s.contents,n));if(s.directives?.docEnd)if(s.comment){let c=i(s.comment);c.includes(`
|
|
56
|
+
`)?(t.push("..."),t.push(Gt.indentComment(c,""))):t.push(`... ${c}`)}else t.push("...");else{let c=s.comment;c&&a&&(c=c.replace(/^\n+/,"")),c&&((!a||o)&&t[t.length-1]!==""&&t.push(""),t.push(Gt.indentComment(i(c),"")))}return t.join(`
|
|
57
|
+
`)+`
|
|
58
|
+
`}So.stringifyDocument=wh});var Qt=w(Ao=>{"use strict";var _h=Pt(),bt=xs(),te=q(),Sh=Ae(),kh=we(),Ah=In(),Eh=ko(),Rn=As(),Th=Mr(),Oh=Mt(),qn=Pr(),Pn=class s{constructor(e,t,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,te.NODE_TYPE,{value:te.DOC});let n=null;typeof t=="function"||Array.isArray(t)?n=t:r===void 0&&t&&(r=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=i;let{version:a}=i;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new qn.Directives({version:a}),this.setSchema(a,r),this.contents=e===void 0?null:this.createNode(e,n,r)}clone(){let e=Object.create(s.prototype,{[te.NODE_TYPE]:{value:te.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=te.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){wt(this.contents)&&this.contents.add(e)}addIn(e,t){wt(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let r=Rn.anchorNames(this);e.anchor=!t||r.has(t)?Rn.findNewAnchor(t||"a",r):t}return new _h.Alias(e.anchor)}createNode(e,t,r){let n;if(typeof t=="function")e=t.call({"":e},"",e),n=t;else if(Array.isArray(t)){let m=S=>typeof S=="number"||S instanceof String||S instanceof Number,v=t.filter(m).map(String);v.length>0&&(t=t.concat(v)),n=t}else r===void 0&&t&&(r=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:c,onTagObj:l,tag:u}=r??{},{onAnchor:f,setAnchors:d,sourceObjects:p}=Rn.createNodeAnchors(this,a||"a"),g={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:p},h=Oh.createNode(e,u,g);return o&&te.isCollection(h)&&(h.flow=!0),d(),h}createPair(e,t,r={}){let n=this.createNode(e,null,r),i=this.createNode(t,null,r);return new Sh.Pair(n,i)}delete(e){return wt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return bt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):wt(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return te.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return bt.isEmptyPath(e)?!t&&te.isScalar(this.contents)?this.contents.value:this.contents:te.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return te.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return bt.isEmptyPath(e)?this.contents!==void 0:te.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=bt.collectionFromPath(this.schema,[e],t):wt(this.contents)&&this.contents.set(e,t)}setIn(e,t){bt.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=bt.collectionFromPath(this.schema,Array.from(e),t):wt(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new qn.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new qn.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(r)this.schema=new Ah.Schema(Object.assign(r,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=kh.toJS(this.contents,t??"",o);if(typeof i=="function")for(let{count:l,res:u}of o.anchors.values())i(u,l);return typeof a=="function"?Th.applyReviver(a,{"":c},"",c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Eh.stringifyDocument(this,e)}};function wt(s){if(te.isCollection(s))return!0;throw new Error("Expected a YAML collection as document contents")}Ao.Document=Pn});var ts=w(es=>{"use strict";var Xt=class extends Error{constructor(e,t,r,n){super(),this.name=e,this.code=r,this.message=n,this.pos=t}},Mn=class extends Xt{constructor(e,t,r){super("YAMLParseError",e,t,r)}},$n=class extends Xt{constructor(e,t,r){super("YAMLWarning",e,t,r)}},xh=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(o=>e.linePos(o));let{line:r,col:n}=t.linePos[0];t.message+=` at line ${r}, column ${n}`;let i=n-1,a=s.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(i>=60&&a.length>80){let o=Math.min(i-39,a.length-79);a="\u2026"+a.substring(o),i-=o-1}if(a.length>80&&(a=a.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(a.substring(0,i))){let o=s.substring(e.lineStarts[r-2],e.lineStarts[r-1]);o.length>80&&(o=o.substring(0,79)+`\u2026
|
|
59
|
+
`),a=o+a}if(/[^ ]/.test(a)){let o=1,c=t.linePos[1];c?.line===r&&c.col>n&&(o=Math.max(1,Math.min(c.col-n,80-i)));let l=" ".repeat(i)+"^".repeat(o);t.message+=`:
|
|
60
|
+
|
|
61
|
+
${a}
|
|
62
|
+
${l}
|
|
63
|
+
`}};es.YAMLError=Xt;es.YAMLParseError=Mn;es.YAMLWarning=$n;es.prettifyError=xh});var ss=w(Eo=>{"use strict";function Nh(s,{flow:e,indicator:t,next:r,offset:n,onError:i,parentIndent:a,startOnNewline:o}){let c=!1,l=o,u=o,f="",d="",p=!1,g=!1,h=null,m=null,v=null,S=null,k=null,x=null,C=null;for(let A of s)switch(g&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&i(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&i(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(t!=="doc-start"||r?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||i(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let $=A.source.substring(1)||" ";f?f+=d+$:f=$,d="",l=!1;break}case"newline":l?f?f+=A.source:(!x||t!=="seq-item-ind")&&(c=!0):d+=A.source,l=!0,p=!0,(m||v)&&(S=A),u=!0;break;case"anchor":m&&i(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&i(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=A,C??(C=A.offset),l=!1,u=!1,g=!0;break;case"tag":{v&&i(A,"MULTIPLE_TAGS","A node can have at most one tag"),v=A,C??(C=A.offset),l=!1,u=!1,g=!0;break}case t:(m||v)&&i(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&i(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=t==="seq-item-ind"||t==="explicit-key-ind",u=!1;break;case"comma":if(e){k&&i(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=A,l=!1,u=!1;break}default:i(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let T=s[s.length-1],P=T?T.offset+T.source.length:n;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&i(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=a||r?.type==="block-map"||r?.type==="block-seq")&&i(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:x,spaceBefore:c,comment:f,hasNewline:p,anchor:m,tag:v,newlineAfterProp:S,end:P,start:C??P}}Eo.resolveProps=Nh});var cr=w(To=>{"use strict";function jn(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
|
|
64
|
+
`))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(jn(e.key)||jn(e.value))return!0}return!1;default:return!0}}To.containsNewline=jn});var Dn=w(Oo=>{"use strict";var Ch=cr();function Ih(s,e,t){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===s&&(r.source==="]"||r.source==="}")&&Ch.containsNewline(e)&&t(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Oo.flowIndentCheck=Ih});var Bn=w(No=>{"use strict";var xo=q();function Lh(s,e,t){let{uniqueKeys:r}=s.options;if(r===!1)return!1;let n=typeof r=="function"?r:(i,a)=>i===a||xo.isScalar(i)&&xo.isScalar(a)&&i.value===a.value;return e.some(i=>n(i.key,t))}No.mapIncludes=Lh});var Po=w(qo=>{"use strict";var Co=Ae(),Rh=Te(),Io=ss(),qh=cr(),Lo=Dn(),Ph=Bn(),Ro="All mapping items must start at the same column";function Mh({composeNode:s,composeEmptyNode:e},t,r,n,i){let a=i?.nodeClass??Rh.YAMLMap,o=new a(t.schema);t.atRoot&&(t.atRoot=!1);let c=r.offset,l=null;for(let u of r.items){let{start:f,key:d,sep:p,value:g}=u,h=Io.resolveProps(f,{indicator:"explicit-key-ind",next:d??p?.[0],offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0}),m=!h.found;if(m){if(d&&(d.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&n(c,"BAD_INDENT",Ro)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(o.comment?o.comment+=`
|
|
65
|
+
`+h.comment:o.comment=h.comment);continue}(h.newlineAfterProp||qh.containsNewline(d))&&n(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&n(c,"BAD_INDENT",Ro);t.atKey=!0;let v=h.end,S=d?s(t,d,h,n):e(t,v,f,null,h,n);t.schema.compat&&Lo.flowIndentCheck(r.indent,d,n),t.atKey=!1,Ph.mapIncludes(t,o.items,S)&&n(v,"DUPLICATE_KEY","Map keys must be unique");let k=Io.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:S.range[2],onError:n,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=k.end,k.found){m&&(g?.type==="block-map"&&!k.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&h.start<k.found.offset-1024&&n(S.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=g?s(t,g,k,n):e(t,c,p,null,k,n);t.schema.compat&&Lo.flowIndentCheck(r.indent,g,n),c=x.range[2];let C=new Co.Pair(S,x);t.options.keepSourceTokens&&(C.srcToken=u),o.items.push(C)}else{m&&n(S.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(S.comment?S.comment+=`
|
|
66
|
+
`+k.comment:S.comment=k.comment);let x=new Co.Pair(S);t.options.keepSourceTokens&&(x.srcToken=u),o.items.push(x)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),o.range=[r.offset,c,l??c],o}qo.resolveBlockMap=Mh});var $o=w(Mo=>{"use strict";var $h=Oe(),jh=ss(),Dh=Dn();function Bh({composeNode:s,composeEmptyNode:e},t,r,n,i){let a=i?.nodeClass??$h.YAMLSeq,o=new a(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let c=r.offset,l=null;for(let{start:u,value:f}of r.items){let d=jh.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?n(d.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(o.comment=d.comment);continue}let p=f?s(t,f,d,n):e(t,d.end,u,null,d,n);t.schema.compat&&Dh.flowIndentCheck(r.indent,f,n),c=p.range[2],o.items.push(p)}return o.range=[r.offset,c,l??c],o}Mo.resolveBlockSeq=Bh});var _t=w(jo=>{"use strict";function Fh(s,e,t,r){let n="";if(s){let i=!1,a="";for(let o of s){let{source:c,type:l}=o;switch(l){case"space":i=!0;break;case"comment":{t&&!i&&r(o,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";n?n+=a+u:n=u,a="";break}case"newline":n&&(a+=c),i=!0;break;default:r(o,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:n,offset:e}}jo.resolveEnd=Fh});var Ko=w(Fo=>{"use strict";var Kh=q(),Uh=Ae(),Do=Te(),Vh=Oe(),Hh=_t(),Bo=ss(),Yh=cr(),Jh=Bn(),Fn="Block collections are not allowed within flow collections",Kn=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Wh({composeNode:s,composeEmptyNode:e},t,r,n,i){let a=r.start.source==="{",o=a?"flow map":"flow sequence",c=i?.nodeClass??(a?Do.YAMLMap:Vh.YAMLSeq),l=new c(t.schema);l.flow=!0;let u=t.atRoot;u&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let f=r.offset+r.start.source.length;for(let m=0;m<r.items.length;++m){let v=r.items[m],{start:S,key:k,sep:x,value:C}=v,T=Bo.resolveProps(S,{flow:o,indicator:"explicit-key-ind",next:k??x?.[0],offset:f,onError:n,parentIndent:r.indent,startOnNewline:!1});if(!T.found){if(!T.anchor&&!T.tag&&!x&&!C){m===0&&T.comma?n(T.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`):m<r.items.length-1&&n(T.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${o}`),T.comment&&(l.comment?l.comment+=`
|
|
67
|
+
`+T.comment:l.comment=T.comment),f=T.end;continue}!a&&t.options.strict&&Yh.containsNewline(k)&&n(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)T.comma&&n(T.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`);else if(T.comma||n(T.start,"MISSING_CHAR",`Missing , between ${o} items`),T.comment){let P="";e:for(let A of S)switch(A.type){case"comma":case"space":break;case"comment":P=A.source.substring(1);break e;default:break e}if(P){let A=l.items[l.items.length-1];Kh.isPair(A)&&(A=A.value??A.key),A.comment?A.comment+=`
|
|
68
|
+
`+P:A.comment=P,T.comment=T.comment.substring(P.length+1)}}if(!a&&!x&&!T.found){let P=C?s(t,C,T,n):e(t,T.end,x,null,T,n);l.items.push(P),f=P.range[2],Kn(C)&&n(P.range,"BLOCK_IN_FLOW",Fn)}else{t.atKey=!0;let P=T.end,A=k?s(t,k,T,n):e(t,P,S,null,T,n);Kn(k)&&n(A.range,"BLOCK_IN_FLOW",Fn),t.atKey=!1;let $=Bo.resolveProps(x??[],{flow:o,indicator:"map-value-ind",next:C,offset:A.range[2],onError:n,parentIndent:r.indent,startOnNewline:!1});if($.found){if(!a&&!T.found&&t.options.strict){if(x)for(let D of x){if(D===$.found)break;if(D.type==="newline"){n(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}T.start<$.found.offset-1024&&n($.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source?.[0]===":"?n(C,"MISSING_CHAR",`Missing space after : in ${o}`):n($.start,"MISSING_CHAR",`Missing , or : between ${o} items`));let K=C?s(t,C,$,n):$.found?e(t,$.end,x,null,$,n):null;K?Kn(C)&&n(K.range,"BLOCK_IN_FLOW",Fn):$.comment&&(A.comment?A.comment+=`
|
|
69
|
+
`+$.comment:A.comment=$.comment);let z=new Uh.Pair(A,K);if(t.options.keepSourceTokens&&(z.srcToken=v),a){let D=l;Jh.mapIncludes(t,D.items,A)&&n(P,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(z)}else{let D=new Do.YAMLMap(t.schema);D.flow=!0,D.items.push(z);let Ce=(K??A).range;D.range=[A.range[0],Ce[1],Ce[2]],l.items.push(D)}f=K?K.range[2]:$.end}}let d=a?"}":"]",[p,...g]=r.end,h=f;if(p?.source===d)h=p.offset+p.source.length;else{let m=o[0].toUpperCase()+o.substring(1),v=u?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;n(f,u?"MISSING_CHAR":"BAD_INDENT",v),p&&p.source.length!==1&&g.unshift(p)}if(g.length>0){let m=Hh.resolveEnd(g,h,t.options.strict,n);m.comment&&(l.comment?l.comment+=`
|
|
70
|
+
`+m.comment:l.comment=m.comment),l.range=[r.offset,h,m.offset]}else l.range=[r.offset,h,h];return l}Fo.resolveFlowCollection=Wh});var Vo=w(Uo=>{"use strict";var Zh=q(),zh=B(),Gh=Te(),Qh=Oe(),Xh=Po(),ep=$o(),tp=Ko();function Un(s,e,t,r,n,i){let a=t.type==="block-map"?Xh.resolveBlockMap(s,e,t,r,i):t.type==="block-seq"?ep.resolveBlockSeq(s,e,t,r,i):tp.resolveFlowCollection(s,e,t,r,i),o=a.constructor;return n==="!"||n===o.tagName?(a.tag=o.tagName,a):(n&&(a.tag=n),a)}function sp(s,e,t,r,n){let i=r.tag,a=i?e.directives.tagName(i.source,d=>n(i,"TAG_RESOLVE_FAILED",d)):null;if(t.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=r,g=d&&i?d.offset>i.offset?d:i:d??i;g&&(!p||p.offset<g.offset)&&n(g,"MISSING_CHAR","Missing newline after block sequence props")}let o=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!i||!a||a==="!"||a===Gh.YAMLMap.tagName&&o==="map"||a===Qh.YAMLSeq.tagName&&o==="seq")return Un(s,e,t,n,a);let c=e.schema.tags.find(d=>d.tag===a&&d.collection===o);if(!c){let d=e.schema.knownTags[a];if(d?.collection===o)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?n(i,"BAD_COLLECTION_TYPE",`${d.tag} used for ${o} collection, but expects ${d.collection??"scalar"}`,!0):n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),Un(s,e,t,n,a)}let l=Un(s,e,t,n,a,c),u=c.resolve?.(l,d=>n(i,"TAG_RESOLVE_FAILED",d),e.options)??l,f=Zh.isNode(u)?u:new zh.Scalar(u);return f.range=l.range,f.tag=a,c?.format&&(f.format=c.format),f}Uo.composeCollection=sp});var Hn=w(Ho=>{"use strict";var Vn=B();function rp(s,e,t){let r=e.offset,n=np(e,s.options.strict,t);if(!n)return{value:"",type:null,comment:"",range:[r,r,r]};let i=n.mode===">"?Vn.Scalar.BLOCK_FOLDED:Vn.Scalar.BLOCK_LITERAL,a=e.source?ip(e.source):[],o=a.length;for(let h=a.length-1;h>=0;--h){let m=a[h][1];if(m===""||m==="\r")o=h;else break}if(o===0){let h=n.chomp==="+"&&a.length>0?`
|
|
71
|
+
`.repeat(Math.max(1,a.length-1)):"",m=r+n.length;return e.source&&(m+=e.source.length),{value:h,type:i,comment:n.comment,range:[r,m,m]}}let c=e.indent+n.indent,l=e.offset+n.length,u=0;for(let h=0;h<o;++h){let[m,v]=a[h];if(v===""||v==="\r")n.indent===0&&m.length>c&&(c=m.length);else{m.length<c&&t(l+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(c=m.length),u=h,c===0&&!s.atRoot&&t(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=m.length+v.length+1}for(let h=a.length-1;h>=o;--h)a[h][0].length>c&&(o=h+1);let f="",d="",p=!1;for(let h=0;h<u;++h)f+=a[h][0].slice(c)+`
|
|
72
|
+
`;for(let h=u;h<o;++h){let[m,v]=a[h];l+=m.length+v.length+1;let S=v[v.length-1]==="\r";if(S&&(v=v.slice(0,-1)),v&&m.length<c){let x=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;t(l-v.length-(S?2:1),"BAD_INDENT",x),m=""}i===Vn.Scalar.BLOCK_LITERAL?(f+=d+m.slice(c)+v,d=`
|
|
73
|
+
`):m.length>c||v[0]===" "?(d===" "?d=`
|
|
74
|
+
`:!p&&d===`
|
|
75
|
+
`&&(d=`
|
|
76
|
+
|
|
77
|
+
`),f+=d+m.slice(c)+v,d=`
|
|
78
|
+
`,p=!0):v===""?d===`
|
|
79
|
+
`?f+=`
|
|
80
|
+
`:d=`
|
|
81
|
+
`:(f+=d+v,d=" ",p=!1)}switch(n.chomp){case"-":break;case"+":for(let h=o;h<a.length;++h)f+=`
|
|
82
|
+
`+a[h][0].slice(c);f[f.length-1]!==`
|
|
83
|
+
`&&(f+=`
|
|
84
|
+
`);break;default:f+=`
|
|
85
|
+
`}let g=r+n.length+e.source.length;return{value:f,type:i,comment:n.comment,range:[r,g,g]}}function np({offset:s,props:e},t,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=e[0],i=n[0],a=0,o="",c=-1;for(let d=1;d<n.length;++d){let p=n[d];if(!o&&(p==="-"||p==="+"))o=p;else{let g=Number(p);!a&&g?a=g:c===-1&&(c=s+d)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,u="",f=n.length;for(let d=1;d<e.length;++d){let p=e[d];switch(p.type){case"space":l=!0;case"newline":f+=p.source.length;break;case"comment":t&&!l&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,u=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{let g=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",g);let h=p.source;h&&typeof h=="string"&&(f+=h.length)}}}return{mode:i,indent:a,chomp:o,comment:u,length:f}}function ip(s){let e=s.split(/\n( *)/),t=e[0],r=t.match(/^( *)/),i=[r?.[1]?[r[1],t.slice(r[1].length)]:["",t]];for(let a=1;a<e.length;a+=2)i.push([e[a],e[a+1]]);return i}Ho.resolveBlockScalar=rp});var Jn=w(Jo=>{"use strict";var Yn=B(),ap=_t();function op(s,e,t){let{offset:r,type:n,source:i,end:a}=s,o,c,l=(d,p,g)=>t(r+d,p,g);switch(n){case"scalar":o=Yn.Scalar.PLAIN,c=cp(i,l);break;case"single-quoted-scalar":o=Yn.Scalar.QUOTE_SINGLE,c=lp(i,l);break;case"double-quoted-scalar":o=Yn.Scalar.QUOTE_DOUBLE,c=up(i,l);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[r,r+i.length,r+i.length]}}let u=r+i.length,f=ap.resolveEnd(a,u,e,t);return{value:c,type:o,comment:f.comment,range:[r,u,f.offset]}}function cp(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Yo(s)}function lp(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),Yo(s.slice(1,-1)).replace(/''/g,"'")}function Yo(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
86
|
+
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
87
|
+
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(s);if(!r)return s;let n=r[1],i=" ",a=e.lastIndex;for(t.lastIndex=a;r=t.exec(s);)r[1]===""?i===`
|
|
88
|
+
`?n+=i:i=`
|
|
89
|
+
`:(n+=i+r[1],i=" "),a=t.lastIndex;let o=/[ \t]*(.*)/sy;return o.lastIndex=a,r=o.exec(s),n+i+(r?.[1]??"")}function up(s,e){let t="";for(let r=1;r<s.length-1;++r){let n=s[r];if(!(n==="\r"&&s[r+1]===`
|
|
90
|
+
`))if(n===`
|
|
91
|
+
`){let{fold:i,offset:a}=fp(s,r);t+=i,r=a}else if(n==="\\"){let i=s[++r],a=dp[i];if(a)t+=a;else if(i===`
|
|
92
|
+
`)for(i=s[r+1];i===" "||i===" ";)i=s[++r+1];else if(i==="\r"&&s[r+1]===`
|
|
93
|
+
`)for(i=s[++r+1];i===" "||i===" ";)i=s[++r+1];else if(i==="x"||i==="u"||i==="U"){let o={x:2,u:4,U:8}[i];t+=hp(s,r+1,o,e),r+=o}else{let o=s.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),t+=o}}else if(n===" "||n===" "){let i=r,a=s[r+1];for(;a===" "||a===" ";)a=s[++r+1];a!==`
|
|
94
|
+
`&&!(a==="\r"&&s[r+2]===`
|
|
95
|
+
`)&&(t+=r>i?s.slice(i,r+1):n)}else t+=n}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function fp(s,e){let t="",r=s[e+1];for(;(r===" "||r===" "||r===`
|
|
96
|
+
`||r==="\r")&&!(r==="\r"&&s[e+2]!==`
|
|
97
|
+
`);)r===`
|
|
98
|
+
`&&(t+=`
|
|
99
|
+
`),e+=1,r=s[e+1];return t||(t=" "),{fold:t,offset:e}}var dp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
100
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function hp(s,e,t,r){let n=s.substr(e,t),a=n.length===t&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;if(isNaN(a)){let o=s.substr(e-2,t+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}return String.fromCodePoint(a)}Jo.resolveFlowScalar=op});var zo=w(Zo=>{"use strict";var Ge=q(),Wo=B(),pp=Hn(),mp=Jn();function yp(s,e,t,r){let{value:n,type:i,comment:a,range:o}=e.type==="block-scalar"?pp.resolveBlockScalar(s,e,r):mp.resolveFlowScalar(e,s.options.strict,r),c=t?s.directives.tagName(t.source,f=>r(t,"TAG_RESOLVE_FAILED",f)):null,l;s.options.stringKeys&&s.atKey?l=s.schema[Ge.SCALAR]:c?l=gp(s.schema,n,c,t,r):e.type==="scalar"?l=vp(s,n,e,r):l=s.schema[Ge.SCALAR];let u;try{let f=l.resolve(n,d=>r(t??e,"TAG_RESOLVE_FAILED",d),s.options);u=Ge.isScalar(f)?f:new Wo.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);r(t??e,"TAG_RESOLVE_FAILED",d),u=new Wo.Scalar(n)}return u.range=o,u.source=n,i&&(u.type=i),c&&(u.tag=c),l.format&&(u.format=l.format),a&&(u.comment=a),u}function gp(s,e,t,r,n){if(t==="!")return s[Ge.SCALAR];let i=[];for(let o of s.tags)if(!o.collection&&o.tag===t)if(o.default&&o.test)i.push(o);else return o;for(let o of i)if(o.test?.test(e))return o;let a=s.knownTags[t];return a&&!a.collection?(s.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[Ge.SCALAR])}function vp({atKey:s,directives:e,schema:t},r,n,i){let a=t.tags.find(o=>(o.default===!0||s&&o.default==="key")&&o.test?.test(r))||t[Ge.SCALAR];if(t.compat){let o=t.compat.find(c=>c.default&&c.test?.test(r))??t[Ge.SCALAR];if(a.tag!==o.tag){let c=e.tagString(a.tag),l=e.tagString(o.tag),u=`Value may be parsed as either ${c} or ${l}`;i(n,"TAG_RESOLVE_FAILED",u,!0)}}return a}Zo.composeScalar=yp});var Qo=w(Go=>{"use strict";function bp(s,e,t){if(e){t??(t=e.length);for(let r=t-1;r>=0;--r){let n=e[r];switch(n.type){case"space":case"comment":case"newline":s-=n.source.length;continue}for(n=e[++r];n?.type==="space";)s+=n.source.length,n=e[++r];break}}return s}Go.emptyScalarPosition=bp});var tc=w(Zn=>{"use strict";var wp=Pt(),_p=q(),Sp=Vo(),Xo=zo(),kp=_t(),Ap=Qo(),Ep={composeNode:ec,composeEmptyNode:Wn};function ec(s,e,t,r){let n=s.atKey,{spaceBefore:i,comment:a,anchor:o,tag:c}=t,l,u=!0;switch(e.type){case"alias":l=Tp(s,e,r),(o||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Xo.composeScalar(s,e,c,r),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Sp.composeCollection(Ep,s,e,t,r),o&&(l.anchor=o.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);r(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",f),u=!1}}return l??(l=Wn(s,e.offset,void 0,null,t,r)),o&&l.anchor===""&&r(o,"BAD_ALIAS","Anchor cannot be an empty string"),n&&s.options.stringKeys&&(!_p.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(l.spaceBefore=!0),a&&(e.type==="scalar"&&e.source===""?l.comment=a:l.commentBefore=a),s.options.keepSourceTokens&&u&&(l.srcToken=e),l}function Wn(s,e,t,r,{spaceBefore:n,comment:i,anchor:a,tag:o,end:c},l){let u={type:"scalar",offset:Ap.emptyScalarPosition(e,t,r),indent:-1,source:""},f=Xo.composeScalar(s,u,o,l);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&l(a,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(f.spaceBefore=!0),i&&(f.comment=i,f.range[2]=c),f}function Tp({options:s},{offset:e,source:t,end:r},n){let i=new wp.Alias(t.substring(1));i.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&n(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=e+t.length,o=kp.resolveEnd(r,a,s.strict,n);return i.range=[e,a,o.offset],o.comment&&(i.comment=o.comment),i}Zn.composeEmptyNode=Wn;Zn.composeNode=ec});var nc=w(rc=>{"use strict";var Op=Qt(),sc=tc(),xp=_t(),Np=ss();function Cp(s,e,{offset:t,start:r,value:n,end:i},a){let o=Object.assign({_directives:e},s),c=new Op.Document(void 0,o),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Np.resolveProps(r,{indicator:"doc-start",next:n??i?.[0],offset:t,onError:a,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!u.hasNewline&&a(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?sc.composeNode(l,n,u,a):sc.composeEmptyNode(l,u.end,r,null,u,a);let f=c.contents.range[2],d=xp.resolveEnd(i,f,!1,a);return d.comment&&(c.comment=d.comment),c.range=[t,f,d.offset],c}rc.composeDoc=Cp});var Gn=w(oc=>{"use strict";var Ip=ps("process"),Lp=Pr(),Rp=Qt(),rs=ts(),ic=q(),qp=nc(),Pp=_t();function ns(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function ac(s){let e="",t=!1,r=!1;for(let n=0;n<s.length;++n){let i=s[n];switch(i[0]){case"#":e+=(e===""?"":r?`
|
|
101
|
+
|
|
102
|
+
`:`
|
|
103
|
+
`)+(i.substring(1)||" "),t=!0,r=!1;break;case"%":s[n+1]?.[0]!=="#"&&(n+=1),t=!1;break;default:t||(r=!0),t=!1}}return{comment:e,afterEmptyLine:r}}var zn=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,n,i)=>{let a=ns(t);i?this.warnings.push(new rs.YAMLWarning(a,r,n)):this.errors.push(new rs.YAMLParseError(a,r,n))},this.directives=new Lp.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:n}=ac(this.prelude);if(r){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
104
|
+
${r}`:r;else if(n||e.directives.docStart||!i)e.commentBefore=r;else if(ic.isCollection(i)&&!i.flow&&i.items.length>0){let a=i.items[0];ic.isPair(a)&&(a=a.key);let o=a.commentBefore;a.commentBefore=o?`${r}
|
|
105
|
+
${o}`:r}else{let a=i.commentBefore;i.commentBefore=a?`${r}
|
|
106
|
+
${a}`:r}}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:ac(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,r=-1){for(let n of e)yield*this.next(n);yield*this.end(t,r)}*next(e){switch(Ip.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,r,n)=>{let i=ns(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=qp.composeDoc(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,r=new rs.YAMLParseError(ns(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new rs.YAMLParseError(ns(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let t=Pp.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
107
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new rs.YAMLParseError(ns(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 r=Object.assign({_directives:this.directives},this.options),n=new Rp.Document(void 0,r);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,t,t],this.decorate(n,!1),yield n}}};oc.Composer=zn});var uc=w(lr=>{"use strict";var Mp=Hn(),$p=Jn(),jp=ts(),cc=Bt();function Dp(s,e=!0,t){if(s){let r=(n,i,a)=>{let o=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(t)t(o,i,a);else throw new jp.YAMLParseError([o,o+1],i,a)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return $p.resolveFlowScalar(s,e,r);case"block-scalar":return Mp.resolveBlockScalar({options:{strict:e}},s,r)}}return null}function Bp(s,e){let{implicitKey:t=!1,indent:r,inFlow:n=!1,offset:i=-1,type:a="PLAIN"}=e,o=cc.stringifyString({type:a,value:s},{implicitKey:t,indent:r>0?" ".repeat(r):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
|
|
108
|
+
`}];switch(o[0]){case"|":case">":{let l=o.indexOf(`
|
|
109
|
+
`),u=o.substring(0,l),f=o.substring(l+1)+`
|
|
110
|
+
`,d=[{type:"block-scalar-header",offset:i,indent:r,source:u}];return lc(d,c)||d.push({type:"newline",offset:-1,indent:r,source:`
|
|
111
|
+
`}),{type:"block-scalar",offset:i,indent:r,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:i,indent:r,source:o,end:c};case"'":return{type:"single-quoted-scalar",offset:i,indent:r,source:o,end:c};default:return{type:"scalar",offset:i,indent:r,source:o,end:c}}}function Fp(s,e,t={}){let{afterKey:r=!1,implicitKey:n=!1,inFlow:i=!1,type:a}=t,o="indent"in s?s.indent:null;if(r&&typeof o=="number"&&(o+=2),!a)switch(s.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let l=s.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let c=cc.stringifyString({type:a,value:e},{implicitKey:n||o===null,indent:o!==null&&o>0?" ".repeat(o):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Kp(s,c);break;case'"':Qn(s,c,"double-quoted-scalar");break;case"'":Qn(s,c,"single-quoted-scalar");break;default:Qn(s,c,"scalar")}}function Kp(s,e){let t=e.indexOf(`
|
|
112
|
+
`),r=e.substring(0,t),n=e.substring(t+1)+`
|
|
113
|
+
`;if(s.type==="block-scalar"){let i=s.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=r,s.source=n}else{let{offset:i}=s,a="indent"in s?s.indent:-1,o=[{type:"block-scalar-header",offset:i,indent:a,source:r}];lc(o,"end"in s?s.end:void 0)||o.push({type:"newline",offset:-1,indent:a,source:`
|
|
114
|
+
`});for(let c of Object.keys(s))c!=="type"&&c!=="offset"&&delete s[c];Object.assign(s,{type:"block-scalar",indent:a,props:o,source:n})}}function lc(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function Qn(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let r=s.props.slice(1),n=e.length;s.props[0].type==="block-scalar-header"&&(n-=s.props[0].source.length);for(let i of r)i.offset+=n;delete s.props,Object.assign(s,{type:t,source:e,end:r});break}case"block-map":case"block-seq":{let n={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`
|
|
115
|
+
`};delete s.items,Object.assign(s,{type:t,source:e,end:[n]});break}default:{let r="indent"in s?s.indent:-1,n="end"in s&&Array.isArray(s.end)?s.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(s))i!=="type"&&i!=="offset"&&delete s[i];Object.assign(s,{type:t,indent:r,source:e,end:n})}}}lr.createScalarToken=Bp;lr.resolveAsScalar=Dp;lr.setScalarValue=Fp});var dc=w(fc=>{"use strict";var Up=s=>"type"in s?fr(s):ur(s);function fr(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=fr(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=ur(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=ur(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=ur(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function ur({start:s,key:e,sep:t,value:r}){let n="";for(let i of s)n+=i.source;if(e&&(n+=fr(e)),t)for(let i of t)n+=i.source;return r&&(n+=fr(r)),n}fc.stringify=Up});var yc=w(mc=>{"use strict";var Xn=Symbol("break visit"),Vp=Symbol("skip children"),hc=Symbol("remove item");function Qe(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),pc(Object.freeze([]),s,e)}Qe.BREAK=Xn;Qe.SKIP=Vp;Qe.REMOVE=hc;Qe.itemAtPath=(s,e)=>{let t=s;for(let[r,n]of e){let i=t?.[r];if(i&&"items"in i)t=i.items[n];else return}return t};Qe.parentCollection=(s,e)=>{let t=Qe.itemAtPath(s,e.slice(0,-1)),r=e[e.length-1][0],n=t?.[r];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function pc(s,e,t){let r=t(e,s);if(typeof r=="symbol")return r;for(let n of["key","value"]){let i=e[n];if(i&&"items"in i){for(let a=0;a<i.items.length;++a){let o=pc(Object.freeze(s.concat([[n,a]])),i.items[a],t);if(typeof o=="number")a=o-1;else{if(o===Xn)return Xn;o===hc&&(i.items.splice(a,1),a-=1)}}typeof r=="function"&&n==="key"&&(r=r(e,s))}}return typeof r=="function"?r(e,s):r}mc.visit=Qe});var dr=w(Z=>{"use strict";var ei=uc(),Hp=dc(),Yp=yc(),ti="\uFEFF",si="",ri="",ni="",Jp=s=>!!s&&"items"in s,Wp=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function Zp(s){switch(s){case ti:return"<BOM>";case si:return"<DOC>";case ri:return"<FLOW_END>";case ni:return"<SCALAR>";default:return JSON.stringify(s)}}function zp(s){switch(s){case ti:return"byte-order-mark";case si:return"doc-mode";case ri:return"flow-error-end";case ni:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
116
|
+
`:case`\r
|
|
117
|
+
`: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(s[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}Z.createScalarToken=ei.createScalarToken;Z.resolveAsScalar=ei.resolveAsScalar;Z.setScalarValue=ei.setScalarValue;Z.stringify=Hp.stringify;Z.visit=Yp.visit;Z.BOM=ti;Z.DOCUMENT=si;Z.FLOW_END=ri;Z.SCALAR=ni;Z.isCollection=Jp;Z.isScalar=Wp;Z.prettyToken=Zp;Z.tokenType=zp});var oi=w(vc=>{"use strict";var is=dr();function ne(s){switch(s){case void 0:case" ":case`
|
|
118
|
+
`:case"\r":case" ":return!0;default:return!1}}var gc=new Set("0123456789ABCDEFabcdef"),Gp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),hr=new Set(",[]{}"),Qp=new Set(` ,[]{}
|
|
119
|
+
\r `),ii=s=>!s||Qp.has(s),ai=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 r=this.next??"stream";for(;r&&(t||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
120
|
+
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
121
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let r=0;for(;t===" ";)t=this.buffer[++r+e];if(t==="\r"){let n=this.buffer[r+e+1];if(n===`
|
|
122
|
+
`||!n&&!this.atEnd)return e+r+1}return t===`
|
|
123
|
+
`||r>=this.indentNext||!t&&!this.atEnd?e+r:-1}if(t==="-"||t==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&ne(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(`
|
|
124
|
+
`,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]===is.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,r=e.indexOf("#");for(;r!==-1;){let i=e[r-1];if(i===" "||i===" "){t=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let i=e[t-1];if(i===" "||i===" ")t-=1;else break}let n=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),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 is.DOCUMENT,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==="...")&&ne(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&&!ne(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===":")&&ne(t)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,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(ii),"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,r=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=r=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&ne(n[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield is.FLOW_END,yield*this.parseLineStart();let i=0;for(;n[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),n[i]){case void 0:return"flow";case"#":return yield*this.pushCount(n.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(ii),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||ne(a)||a===",")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 r=this.buffer.substring(0,t),n=r.indexOf(`
|
|
125
|
+
`,this.pos);if(n!==-1){for(;n!==-1;){let i=this.continueScalar(n+1);if(i===-1)break;n=r.indexOf(`
|
|
126
|
+
`,i)}n!==-1&&(t=n-(r[n-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=>ne(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,r;e:for(let i=this.pos;r=this.buffer[i];++i)switch(r){case" ":t+=1;break;case`
|
|
127
|
+
`:e=i,t=0;break;case"\r":{let a=this.buffer[i+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===`
|
|
128
|
+
`)break}default:break e}if(!r&&!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(`
|
|
129
|
+
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;for(r=this.buffer[n];r===" ";)r=this.buffer[++n];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
130
|
+
`;)r=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let i=e-1,a=this.buffer[i];a==="\r"&&(a=this.buffer[--i]);let o=i;for(;a===" ";)a=this.buffer[--i];if(a===`
|
|
131
|
+
`&&i>=this.pos&&i+1+t>o)e=i;else break}while(!0);return yield is.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,r=this.pos-1,n;for(;n=this.buffer[++r];)if(n===":"){let i=this.buffer[r+1];if(ne(i)||e&&hr.has(i))break;t=r}else if(ne(n)){let i=this.buffer[r+1];if(n==="\r"&&(i===`
|
|
132
|
+
`?(r+=1,n=`
|
|
133
|
+
`,i=this.buffer[r+1]):t=r),i==="#"||e&&hr.has(i))break;if(n===`
|
|
134
|
+
`){let a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(e&&hr.has(n))break;t=r}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield is.SCALAR,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 r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.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(ii))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(ne(t)||e&&hr.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(;!ne(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(Gp.has(t))t=this.buffer[++e];else if(t==="%"&&gc.has(this.buffer[e+1])&&gc.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===`
|
|
135
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
136
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,r;do r=this.buffer[++t];while(r===" "||e&&r===" ");let n=t-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=t),n}*pushUntil(e){let t=this.pos,r=this.buffer[t];for(;!e(r);)r=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};vc.Lexer=ai});var li=w(bc=>{"use strict";var ci=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,r=this.lineStarts.length;for(;t<r;){let i=t+r>>1;this.lineStarts[i]<e?t=i+1:r=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let n=this.lineStarts[t-1];return{line:t,col:e-n+1}}}};bc.LineCounter=ci});var fi=w(Ac=>{"use strict";var Xp=ps("process"),wc=dr(),em=oi();function xe(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function _c(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function kc(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function pr(s){switch(s.type){case"document":return s.start;case"block-map":{let e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function St(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function Sc(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!xe(e.start,"explicit-key-ind")&&!xe(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,kc(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var ui=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 em.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,t))yield*this.next(r);t||(yield*this.end())}*next(e){if(this.source=e,Xp.env.LOG_TOKENS&&console.log("|",wc.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=wc.tokenType(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 r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,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 r=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in r?r.indent:0:t.type==="flow-collection"&&r.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Sc(t),r.type){case"document":r.value=t;break;case"block-scalar":r.props.push(t);break;case"block-map":{let n=r.items[r.items.length-1];if(n.value){r.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=r.items[r.items.length-1];n.value?r.items.push({start:[],value:t}):n.value=t;break}case"flow-collection":{let n=r.items[r.items.length-1];!n||n.value?r.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&_c(n.start)===-1&&(t.indent===0||n.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(r.type==="document"?r.end=n.start:r.items.push({start:n.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":{_c(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=pr(this.peek(2)),r=St(t),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:n}]};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(`
|
|
137
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
138
|
+
`,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 r="end"in t.value?t.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.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 r=!this.onKeyLine&&this.indent===e.indent,n=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(n&&t.sep&&!t.value){let a=[];for(let o=0;o<t.sep.length;++o){let c=t.sep[o];switch(c.type){case"newline":a.push(o);break;case"space":break;case"comment":c.indent>e.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(i=t.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":n||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):n||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(xe(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(kc(t.key)&&!xe(t.sep,"newline")){let a=St(t.start),o=t.key,c=t.sep;c.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:o,sep:c}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(xe(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let a=St(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||n?e.items.push({start:i,key:null,sep:[this.sourceToken]}):xe(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 a=this.flowScalar(this.type);n||t.value?(e.items.push({start:i,key:a,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(a):(Object.assign(t,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(e);if(a){if(a.type==="block-seq"){if(!t.explicitKey&&t.sep&&!xe(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 r&&e.items.push({start:i});this.stack.push(a);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 r="end"in t.value?t.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.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||xe(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.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 n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=pr(r),i=St(n);Sc(e);let a=e.end.splice(1,e.end.length);a.push(this.sourceToken);let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:a}]};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(`
|
|
139
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
140
|
+
`,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=pr(e),r=St(t);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=pr(e),r=St(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Ac.Parser=ui});var Nc=w(os=>{"use strict";var Ec=Gn(),tm=Qt(),as=ts(),sm=Wr(),rm=q(),nm=li(),Tc=fi();function Oc(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new nm.LineCounter||null,prettyErrors:e}}function im(s,e={}){let{lineCounter:t,prettyErrors:r}=Oc(e),n=new Tc.Parser(t?.addNewLine),i=new Ec.Composer(e),a=Array.from(i.compose(n.parse(s)));if(r&&t)for(let o of a)o.errors.forEach(as.prettifyError(s,t)),o.warnings.forEach(as.prettifyError(s,t));return a.length>0?a:Object.assign([],{empty:!0},i.streamInfo())}function xc(s,e={}){let{lineCounter:t,prettyErrors:r}=Oc(e),n=new Tc.Parser(t?.addNewLine),i=new Ec.Composer(e),a=null;for(let o of i.compose(n.parse(s),!0,s.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new as.YAMLParseError(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&t&&(a.errors.forEach(as.prettifyError(s,t)),a.warnings.forEach(as.prettifyError(s,t))),a}function am(s,e,t){let r;typeof e=="function"?r=e:t===void 0&&e&&typeof e=="object"&&(t=e);let n=xc(s,t);if(!n)return null;if(n.warnings.forEach(i=>sm.warn(n.options.logLevel,i)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:r},t))}function om(s,e,t){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let n=Math.round(t);t=n<1?void 0:n>8?{indent:8}:{indent:n}}if(s===void 0){let{keepUndefined:n}=t??e??{};if(!n)return}return rm.isDocument(s)&&!r?s.toString(t):new tm.Document(s,r,t).toString(t)}os.parse=am;os.parseAllDocuments=im;os.parseDocument=xc;os.stringify=om});var Ic=w(M=>{"use strict";var cm=Gn(),lm=Qt(),um=In(),di=ts(),fm=Pt(),Ne=q(),dm=Ae(),hm=B(),pm=Te(),mm=Oe(),ym=dr(),gm=oi(),vm=li(),bm=fi(),mr=Nc(),Cc=It();M.Composer=cm.Composer;M.Document=lm.Document;M.Schema=um.Schema;M.YAMLError=di.YAMLError;M.YAMLParseError=di.YAMLParseError;M.YAMLWarning=di.YAMLWarning;M.Alias=fm.Alias;M.isAlias=Ne.isAlias;M.isCollection=Ne.isCollection;M.isDocument=Ne.isDocument;M.isMap=Ne.isMap;M.isNode=Ne.isNode;M.isPair=Ne.isPair;M.isScalar=Ne.isScalar;M.isSeq=Ne.isSeq;M.Pair=dm.Pair;M.Scalar=hm.Scalar;M.YAMLMap=pm.YAMLMap;M.YAMLSeq=mm.YAMLSeq;M.CST=ym;M.Lexer=gm.Lexer;M.LineCounter=vm.LineCounter;M.Parser=bm.Parser;M.parse=mr.parse;M.parseAllDocuments=mr.parseAllDocuments;M.parseDocument=mr.parseDocument;M.stringify=mr.stringify;M.visit=Cc.visit;M.visitAsync=Cc.visitAsync});var G={};Rl(G,{BRAND:()=>ou,DIRTY:()=>Ie,EMPTY_PATH:()=>Dl,INVALID:()=>O,NEVER:()=>Hu,OK:()=>H,ParseStatus:()=>U,Schema:()=>L,ZodAny:()=>ve,ZodArray:()=>he,ZodBigInt:()=>Re,ZodBoolean:()=>qe,ZodBranded:()=>Nt,ZodCatch:()=>He,ZodDate:()=>Pe,ZodDefault:()=>Ve,ZodDiscriminatedUnion:()=>gs,ZodEffects:()=>ee,ZodEnum:()=>Ke,ZodError:()=>Y,ZodFirstPartyTypeKind:()=>N,ZodFunction:()=>bs,ZodIntersection:()=>De,ZodIssueCode:()=>y,ZodLazy:()=>Be,ZodLiteral:()=>Fe,ZodMap:()=>lt,ZodNaN:()=>ft,ZodNativeEnum:()=>Ue,ZodNever:()=>se,ZodNull:()=>$e,ZodNullable:()=>oe,ZodNumber:()=>Le,ZodObject:()=>J,ZodOptional:()=>Q,ZodParsedType:()=>_,ZodPipeline:()=>Ct,ZodPromise:()=>be,ZodReadonly:()=>Ye,ZodRecord:()=>vs,ZodSchema:()=>L,ZodSet:()=>ut,ZodString:()=>ge,ZodSymbol:()=>ot,ZodTransformer:()=>ee,ZodTuple:()=>ae,ZodType:()=>L,ZodUndefined:()=>Me,ZodUnion:()=>je,ZodUnknown:()=>de,ZodVoid:()=>ct,addIssueToContext:()=>b,any:()=>yu,array:()=>wu,bigint:()=>fu,boolean:()=>Ki,coerce:()=>Vu,custom:()=>Di,date:()=>du,datetimeRegex:()=>$i,defaultErrorMap:()=>ue,discriminatedUnion:()=>Au,effect:()=>Mu,enum:()=>Ru,function:()=>Cu,getErrorMap:()=>nt,getParsedType:()=>ie,instanceof:()=>lu,intersection:()=>Eu,isAborted:()=>ms,isAsync:()=>it,isDirty:()=>ys,isValid:()=>ye,late:()=>cu,lazy:()=>Iu,literal:()=>Lu,makeIssue:()=>xt,map:()=>xu,nan:()=>uu,nativeEnum:()=>qu,never:()=>vu,null:()=>mu,nullable:()=>ju,number:()=>Fi,object:()=>_u,objectUtil:()=>Nr,oboolean:()=>Uu,onumber:()=>Ku,optional:()=>$u,ostring:()=>Fu,pipeline:()=>Bu,preprocess:()=>Du,promise:()=>Pu,quotelessJson:()=>Ml,record:()=>Ou,set:()=>Nu,setErrorMap:()=>jl,strictObject:()=>Su,string:()=>Bi,symbol:()=>hu,transformer:()=>Mu,tuple:()=>Tu,undefined:()=>pu,union:()=>ku,unknown:()=>gu,util:()=>R,void:()=>bu});var R;(function(s){s.assertEqual=n=>{};function e(n){}s.assertIs=e;function t(n){throw new Error}s.assertNever=t,s.arrayToEnum=n=>{let i={};for(let a of n)i[a]=a;return i},s.getValidEnumValues=n=>{let i=s.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),a={};for(let o of i)a[o]=n[o];return s.objectValues(a)},s.objectValues=n=>s.objectKeys(n).map(function(i){return n[i]}),s.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.push(a);return i},s.find=(n,i)=>{for(let a of n)if(i(a))return a},s.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function r(n,i=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}s.joinValues=r,s.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(R||(R={}));var Nr;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Nr||(Nr={}));var _=R.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ie=s=>{switch(typeof s){case"undefined":return _.undefined;case"string":return _.string;case"number":return Number.isNaN(s)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(s)?_.array:s===null?_.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?_.promise:typeof Map<"u"&&s instanceof Map?_.map:typeof Set<"u"&&s instanceof Set?_.set:typeof Date<"u"&&s instanceof Date?_.date:_.object;default:return _.unknown}};var y=R.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ml=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:"),Y=class s extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},r={_errors:[]},n=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)r._errors.push(t(a));else{let o=r,c=0;for(;c<a.path.length;){let l=a.path[c];c===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(a))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return n(this),r}static assert(e){if(!(e instanceof s))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,R.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];t[i]=t[i]||[],t[i].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};Y.create=s=>new Y(s);var $l=(s,e)=>{let t;switch(s.code){case y.invalid_type:s.received===_.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case y.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,R.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:t=`Unrecognized key(s) in object: ${R.joinValues(s.keys,", ")}`;break;case y.invalid_union:t="Invalid input";break;case y.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${R.joinValues(s.options)}`;break;case y.invalid_enum_value:t=`Invalid enum value. Expected ${R.joinValues(s.options)}, received '${s.received}'`;break;case y.invalid_arguments:t="Invalid function arguments";break;case y.invalid_return_type:t="Invalid function return type";break;case y.invalid_date:t="Invalid date";break;case y.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:R.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case y.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case y.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case y.custom:t="Invalid input";break;case y.invalid_intersection_types:t="Intersection results could not be merged";break;case y.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case y.not_finite:t="Number must be finite";break;default:t=e.defaultError,R.assertNever(s)}return{message:t}},ue=$l;var Li=ue;function jl(s){Li=s}function nt(){return Li}var xt=s=>{let{data:e,path:t,errorMaps:r,issueData:n}=s,i=[...t,...n.path||[]],a={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let o="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)o=l(a,{data:e,defaultError:o}).message;return{...n,path:i,message:o}},Dl=[];function b(s,e){let t=nt(),r=xt({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===ue?void 0:ue].filter(n=>!!n)});s.common.issues.push(r)}var U=class s{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return O;n.status==="dirty"&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let i=await n.key,a=await n.value;r.push({key:i,value:a})}return s.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:i,value:a}=n;if(i.status==="aborted"||a.status==="aborted")return O;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(r[i.value]=a.value)}return{status:e.value,value:r}}},O=Object.freeze({status:"aborted"}),Ie=s=>({status:"dirty",value:s}),H=s=>({status:"valid",value:s}),ms=s=>s.status==="aborted",ys=s=>s.status==="dirty",ye=s=>s.status==="valid",it=s=>typeof Promise<"u"&&s instanceof Promise;var E;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(E||(E={}));var X=class{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ri=(s,e)=>{if(ye(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Y(s.common.issues);return this._error=t,this._error}}};function I(s){if(!s)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:n}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,o)=>{let{message:c}=s;return a.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??r??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:n}}var L=class{get description(){return this._def.description}_getType(e){return ie(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new U,ctx:{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(it(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Ri(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return ye(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>ye(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},n=this._parse({data:e,path:r.path,parent:r}),i=await(it(n)?n:Promise.resolve(n));return Ri(r,i)}refine(e,t){let r=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{let a=e(n),o=()=>i.addIssue({code:y.custom,...r(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new ee({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Q.create(this,this._def)}nullable(){return oe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return he.create(this)}promise(){return be.create(this,this._def)}or(e){return je.create([this,e],this._def)}and(e){return De.create(this,e,this._def)}transform(e){return new ee({...I(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Ve({...I(this._def),innerType:this,defaultValue:t,typeName:N.ZodDefault})}brand(){return new Nt({typeName:N.ZodBranded,type:this,...I(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new He({...I(this._def),innerType:this,catchValue:t,typeName:N.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ct.create(this,e)}readonly(){return Ye.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Bl=/^c[^\s-]{8,}$/i,Fl=/^[0-9a-z]+$/,Kl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ul=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Vl=/^[a-z0-9_-]{21}$/i,Hl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Yl=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Jl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Cr,Zl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Gl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ql=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,eu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Pi="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",tu=new RegExp(`^${Pi}$`);function Mi(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);let t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function su(s){return new RegExp(`^${Mi(s)}$`)}function $i(s){let e=`${Pi}T${Mi(s)}`,t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ru(s,e){return!!((e==="v4"||!e)&&Zl.test(s)||(e==="v6"||!e)&&Gl.test(s))}function nu(s,e){if(!Hl.test(s))return!1;try{let[t]=s.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(r));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function iu(s,e){return!!((e==="v4"||!e)&&zl.test(s)||(e==="v6"||!e)&&Ql.test(s))}var ge=class s extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:_.string,received:i.parsedType}),O}let r=new U,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(n=this._getOrReturnCtx(e,n),a?b(n,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&b(n,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Jl.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"email",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Cr||(Cr=new RegExp(Wl,"u")),Cr.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"emoji",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Ul.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"uuid",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Vl.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"nanoid",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Bl.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Fl.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid2",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Kl.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ulid",code:y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),b(n,{validation:"url",code:y.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"regex",code:y.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),b(n,{code:y.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:y.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:y.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?$i(i).test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:y.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?tu.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:y.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?su(i).test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:y.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Yl.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"duration",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?ru(e.data,i.version)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ip",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?nu(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"jwt",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?iu(e.data,i.version)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cidr",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Xl.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"base64",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?eu.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"base64url",code:y.invalid_string,message:i.message}),r.dirty()):R.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(n=>e.test(n),{validation:t,code:y.invalid_string,...E.errToObj(r)})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...E.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...E.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...E.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...E.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...E.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};ge.create=s=>new ge({checks:[],typeName:N.ZodString,coerce:s?.coerce??!1,...I(s)});function au(s,e){let t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,n=t>r?t:r,i=Number.parseInt(s.toFixed(n).replace(".","")),a=Number.parseInt(e.toFixed(n).replace(".",""));return i%a/10**n}var Le=class s extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==_.number){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:_.number,received:i.parsedType}),O}let r,n=new U;for(let i of this._def.checks)i.kind==="int"?R.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),b(r,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:y.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?au(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),b(r,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),b(r,{code:y.not_finite,message:i.message}),n.dirty()):R.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,n){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.toString(n)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&R.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Le.create=s=>new Le({checks:[],typeName:N.ZodNumber,coerce:s?.coerce||!1,...I(s)});var Re=class s extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==_.bigint)return this._getInvalidInput(e);let r,n=new U;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:y.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),b(r,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):R.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return b(t,{code:y.invalid_type,expected:_.bigint,received:t.parsedType}),O}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,n){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.toString(n)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Re.create=s=>new Re({checks:[],typeName:N.ZodBigInt,coerce:s?.coerce??!1,...I(s)});var qe=class extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:_.boolean,received:r.parsedType}),O}return H(e.data)}};qe.create=s=>new qe({typeName:N.ZodBoolean,coerce:s?.coerce||!1,...I(s)});var Pe=class s extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:_.date,received:i.parsedType}),O}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_date}),O}let r=new U,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):R.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Pe.create=s=>new Pe({checks:[],coerce:s?.coerce||!1,typeName:N.ZodDate,...I(s)});var ot=class extends L{_parse(e){if(this._getType(e)!==_.symbol){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:_.symbol,received:r.parsedType}),O}return H(e.data)}};ot.create=s=>new ot({typeName:N.ZodSymbol,...I(s)});var Me=class extends L{_parse(e){if(this._getType(e)!==_.undefined){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:_.undefined,received:r.parsedType}),O}return H(e.data)}};Me.create=s=>new Me({typeName:N.ZodUndefined,...I(s)});var $e=class extends L{_parse(e){if(this._getType(e)!==_.null){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:_.null,received:r.parsedType}),O}return H(e.data)}};$e.create=s=>new $e({typeName:N.ZodNull,...I(s)});var ve=class extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return H(e.data)}};ve.create=s=>new ve({typeName:N.ZodAny,...I(s)});var de=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return H(e.data)}};de.create=s=>new de({typeName:N.ZodUnknown,...I(s)});var se=class extends L{_parse(e){let t=this._getOrReturnCtx(e);return b(t,{code:y.invalid_type,expected:_.never,received:t.parsedType}),O}};se.create=s=>new se({typeName:N.ZodNever,...I(s)});var ct=class extends L{_parse(e){if(this._getType(e)!==_.undefined){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:_.void,received:r.parsedType}),O}return H(e.data)}};ct.create=s=>new ct({typeName:N.ZodVoid,...I(s)});var he=class s extends L{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==_.array)return b(t,{code:y.invalid_type,expected:_.array,received:t.parsedType}),O;if(n.exactLength!==null){let a=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(a||o)&&(b(t,{code:a?y.too_big:y.too_small,minimum:o?n.exactLength.value:void 0,maximum:a?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(b(t,{code:y.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(b(t,{code:y.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>n.type._parseAsync(new X(t,a,t.path,o)))).then(a=>U.mergeArray(r,a));let i=[...t.data].map((a,o)=>n.type._parseSync(new X(t,a,t.path,o)));return U.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new s({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new s({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new s({...this._def,exactLength:{value:e,message:E.toString(t)}})}nonempty(e){return this.min(1,e)}};he.create=(s,e)=>new he({type:s,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...I(e)});function at(s){if(s instanceof J){let e={};for(let t in s.shape){let r=s.shape[t];e[t]=Q.create(at(r))}return new J({...s._def,shape:()=>e})}else return s instanceof he?new he({...s._def,type:at(s.element)}):s instanceof Q?Q.create(at(s.unwrap())):s instanceof oe?oe.create(at(s.unwrap())):s instanceof ae?ae.create(s.items.map(e=>at(e))):s}var J=class s extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=R.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==_.object){let l=this._getOrReturnCtx(e);return b(l,{code:y.invalid_type,expected:_.object,received:l.parsedType}),O}let{status:r,ctx:n}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof se&&this._def.unknownKeys==="strip"))for(let l in n.data)a.includes(l)||o.push(l);let c=[];for(let l of a){let u=i[l],f=n.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new X(n,f,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof se){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(l==="strict")o.length>0&&(b(n,{code:y.unrecognized_keys,keys:o}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of o){let f=n.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new X(n,f,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let f=await u.key,d=await u.value;l.push({key:f,value:d,alwaysSet:u.alwaysSet})}return l}).then(l=>U.mergeObjectSync(r,l)):U.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new s({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:E.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(e){return new s({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new s({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new s({...this._def,catchall:e})}pick(e){let t={};for(let r of R.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new s({...this._def,shape:()=>t})}omit(e){let t={};for(let r of R.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new s({...this._def,shape:()=>t})}deepPartial(){return at(this)}partial(e){let t={};for(let r of R.objectKeys(this.shape)){let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new s({...this._def,shape:()=>t})}required(e){let t={};for(let r of R.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Q;)i=i._def.innerType;t[r]=i}return new s({...this._def,shape:()=>t})}keyof(){return ji(R.objectKeys(this.shape))}};J.create=(s,e)=>new J({shape:()=>s,unknownKeys:"strip",catchall:se.create(),typeName:N.ZodObject,...I(e)});J.strictCreate=(s,e)=>new J({shape:()=>s,unknownKeys:"strict",catchall:se.create(),typeName:N.ZodObject,...I(e)});J.lazycreate=(s,e)=>new J({shape:s,unknownKeys:"strip",catchall:se.create(),typeName:N.ZodObject,...I(e)});var je=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(o=>new Y(o.ctx.common.issues));return b(t,{code:y.invalid_union,unionErrors:a}),O}if(t.common.async)return Promise.all(r.map(async i=>{let a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(n);{let i,a=[];for(let c of r){let l={...t,common:{...t.common,issues:[]},parent:null},u=c._parseSync({data:t.data,path:t.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(c=>new Y(c));return b(t,{code:y.invalid_union,unionErrors:o}),O}}get options(){return this._def.options}};je.create=(s,e)=>new je({options:s,typeName:N.ZodUnion,...I(e)});var fe=s=>s instanceof Be?fe(s.schema):s instanceof ee?fe(s.innerType()):s instanceof Fe?[s.value]:s instanceof Ke?s.options:s instanceof Ue?R.objectValues(s.enum):s instanceof Ve?fe(s._def.innerType):s instanceof Me?[void 0]:s instanceof $e?[null]:s instanceof Q?[void 0,...fe(s.unwrap())]:s instanceof oe?[null,...fe(s.unwrap())]:s instanceof Nt||s instanceof Ye?fe(s.unwrap()):s instanceof He?fe(s._def.innerType):[],gs=class s extends L{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.object)return b(t,{code:y.invalid_type,expected:_.object,received:t.parsedType}),O;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(b(t,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),O)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let i of t){let a=fe(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of a){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,i)}}return new s({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...I(r)})}};function Ir(s,e){let t=ie(s),r=ie(e);if(s===e)return{valid:!0,data:s};if(t===_.object&&r===_.object){let n=R.objectKeys(e),i=R.objectKeys(s).filter(o=>n.indexOf(o)!==-1),a={...s,...e};for(let o of i){let c=Ir(s[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(t===_.array&&r===_.array){if(s.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<s.length;i++){let a=s[i],o=e[i],c=Ir(a,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===_.date&&r===_.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}var De=class extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(i,a)=>{if(ms(i)||ms(a))return O;let o=Ir(i.value,a.value);return o.valid?((ys(i)||ys(a))&&t.dirty(),{status:t.value,value:o.data}):(b(r,{code:y.invalid_intersection_types}),O)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>n(i,a)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};De.create=(s,e,t)=>new De({left:s,right:e,typeName:N.ZodIntersection,...I(t)});var ae=class s extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.array)return b(r,{code:y.invalid_type,expected:_.array,received:r.parsedType}),O;if(r.data.length<this._def.items.length)return b(r,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O;!this._def.rest&&r.data.length>this._def.items.length&&(b(r,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...r.data].map((a,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new X(r,a,r.path,o)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>U.mergeArray(t,a)):U.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new s({...this._def,rest:e})}};ae.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ae({items:s,typeName:N.ZodTuple,rest:null,...I(e)})};var vs=class s extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.object)return b(r,{code:y.invalid_type,expected:_.object,received:r.parsedType}),O;let n=[],i=this._def.keyType,a=this._def.valueType;for(let o in r.data)n.push({key:i._parse(new X(r,o,r.path,o)),value:a._parse(new X(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?U.mergeObjectAsync(t,n):U.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof L?new s({keyType:e,valueType:t,typeName:N.ZodRecord,...I(r)}):new s({keyType:ge.create(),valueType:e,typeName:N.ZodRecord,...I(t)})}},lt=class extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.map)return b(r,{code:y.invalid_type,expected:_.map,received:r.parsedType}),O;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([o,c],l)=>({key:n._parse(new X(r,o,r.path,[l,"key"])),value:i._parse(new X(r,c,r.path,[l,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of a){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return O;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let c of a){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return O;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}}}};lt.create=(s,e,t)=>new lt({valueType:e,keyType:s,typeName:N.ZodMap,...I(t)});var ut=class s extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.set)return b(r,{code:y.invalid_type,expected:_.set,received:r.parsedType}),O;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(b(r,{code:y.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&(b(r,{code:y.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(c){let l=new Set;for(let u of c){if(u.status==="aborted")return O;u.status==="dirty"&&t.dirty(),l.add(u.value)}return{status:t.value,value:l}}let o=[...r.data.values()].map((c,l)=>i._parse(new X(r,c,r.path,l)));return r.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,t){return new s({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new s({...this._def,maxSize:{value:e,message:E.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ut.create=(s,e)=>new ut({valueType:s,minSize:null,maxSize:null,typeName:N.ZodSet,...I(e)});var bs=class s extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.function)return b(t,{code:y.invalid_type,expected:_.function,received:t.parsedType}),O;function r(o,c){return xt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nt(),ue].filter(l=>!!l),issueData:{code:y.invalid_arguments,argumentsError:c}})}function n(o,c){return xt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nt(),ue].filter(l=>!!l),issueData:{code:y.invalid_return_type,returnTypeError:c}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof be){let o=this;return H(async function(...c){let l=new Y([]),u=await o._def.args.parseAsync(c,i).catch(p=>{throw l.addIssue(r(c,p)),l}),f=await Reflect.apply(a,this,u);return await o._def.returns._def.type.parseAsync(f,i).catch(p=>{throw l.addIssue(n(f,p)),l})})}else{let o=this;return H(function(...c){let l=o._def.args.safeParse(c,i);if(!l.success)throw new Y([r(c,l.error)]);let u=Reflect.apply(a,this,l.data),f=o._def.returns.safeParse(u,i);if(!f.success)throw new Y([n(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new s({...this._def,args:ae.create(e).rest(de.create())})}returns(e){return new s({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new s({args:e||ae.create([]).rest(de.create()),returns:t||de.create(),typeName:N.ZodFunction,...I(r)})}},Be=class extends L{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Be.create=(s,e)=>new Be({getter:s,typeName:N.ZodLazy,...I(e)});var Fe=class extends L{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return b(t,{received:t.data,code:y.invalid_literal,expected:this._def.value}),O}return{status:"valid",value:e.data}}get value(){return this._def.value}};Fe.create=(s,e)=>new Fe({value:s,typeName:N.ZodLiteral,...I(e)});function ji(s,e){return new Ke({values:s,typeName:N.ZodEnum,...I(e)})}var Ke=class s extends L{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return b(t,{expected:R.joinValues(r),received:t.parsedType,code:y.invalid_type}),O}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return b(t,{received:t.data,code:y.invalid_enum_value,options:r}),O}return H(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return s.create(e,{...this._def,...t})}exclude(e,t=this._def){return s.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Ke.create=ji;var Ue=class extends L{_parse(e){let t=R.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==_.string&&r.parsedType!==_.number){let n=R.objectValues(t);return b(r,{expected:R.joinValues(n),received:r.parsedType,code:y.invalid_type}),O}if(this._cache||(this._cache=new Set(R.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=R.objectValues(t);return b(r,{received:r.data,code:y.invalid_enum_value,options:n}),O}return H(e.data)}get enum(){return this._def.values}};Ue.create=(s,e)=>new Ue({values:s,typeName:N.ZodNativeEnum,...I(e)});var be=class extends L{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.promise&&t.common.async===!1)return b(t,{code:y.invalid_type,expected:_.promise,received:t.parsedType}),O;let r=t.parsedType===_.promise?t.data:Promise.resolve(t.data);return H(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};be.create=(s,e)=>new be({type:s,typeName:N.ZodPromise,...I(e)});var ee=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:a=>{b(r,a),a.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let a=n.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return O;let c=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return c.status==="aborted"?O:c.status==="dirty"?Ie(c.value):t.value==="dirty"?Ie(c.value):c});{if(t.value==="aborted")return O;let o=this._def.schema._parseSync({data:a,path:r.path,parent:r});return o.status==="aborted"?O:o.status==="dirty"?Ie(o.value):t.value==="dirty"?Ie(o.value):o}}if(n.type==="refinement"){let a=o=>{let c=n.refinement(o,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?O:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?O:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ye(a))return O;let o=n.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>ye(a)?Promise.resolve(n.transform(a.value,i)).then(o=>({status:t.value,value:o})):O);R.assertNever(n)}};ee.create=(s,e,t)=>new ee({schema:s,typeName:N.ZodEffects,effect:e,...I(t)});ee.createWithPreprocess=(s,e,t)=>new ee({schema:e,effect:{type:"preprocess",transform:s},typeName:N.ZodEffects,...I(t)});var Q=class extends L{_parse(e){return this._getType(e)===_.undefined?H(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Q.create=(s,e)=>new Q({innerType:s,typeName:N.ZodOptional,...I(e)});var oe=class extends L{_parse(e){return this._getType(e)===_.null?H(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};oe.create=(s,e)=>new oe({innerType:s,typeName:N.ZodNullable,...I(e)});var Ve=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===_.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ve.create=(s,e)=>new Ve({innerType:s,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...I(e)});var He=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return it(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Y(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Y(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};He.create=(s,e)=>new He({innerType:s,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...I(e)});var ft=class extends L{_parse(e){if(this._getType(e)!==_.nan){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:_.nan,received:r.parsedType}),O}return{status:"valid",value:e.data}}};ft.create=s=>new ft({typeName:N.ZodNaN,...I(s)});var ou=Symbol("zod_brand"),Nt=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Ct=class s extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?O:i.status==="dirty"?(t.dirty(),Ie(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?O:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new s({in:e,out:t,typeName:N.ZodPipeline})}},Ye=class extends L{_parse(e){let t=this._def.innerType._parse(e),r=n=>(ye(n)&&(n.value=Object.freeze(n.value)),n);return it(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}};Ye.create=(s,e)=>new Ye({innerType:s,typeName:N.ZodReadonly,...I(e)});function qi(s,e){let t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}function Di(s,e={},t){return s?ve.create().superRefine((r,n)=>{let i=s(r);if(i instanceof Promise)return i.then(a=>{if(!a){let o=qi(e,r),c=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:c})}});if(!i){let a=qi(e,r),o=a.fatal??t??!0;n.addIssue({code:"custom",...a,fatal:o})}}):ve.create()}var cu={object:J.lazycreate},N;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(N||(N={}));var lu=(s,e={message:`Input not instance of ${s.name}`})=>Di(t=>t instanceof s,e),Bi=ge.create,Fi=Le.create,uu=ft.create,fu=Re.create,Ki=qe.create,du=Pe.create,hu=ot.create,pu=Me.create,mu=$e.create,yu=ve.create,gu=de.create,vu=se.create,bu=ct.create,wu=he.create,_u=J.create,Su=J.strictCreate,ku=je.create,Au=gs.create,Eu=De.create,Tu=ae.create,Ou=vs.create,xu=lt.create,Nu=ut.create,Cu=bs.create,Iu=Be.create,Lu=Fe.create,Ru=Ke.create,qu=Ue.create,Pu=be.create,Mu=ee.create,$u=Q.create,ju=oe.create,Du=ee.createWithPreprocess,Bu=Ct.create,Fu=()=>Bi().optional(),Ku=()=>Fi().optional(),Uu=()=>Ki().optional(),Vu={string:(s=>ge.create({...s,coerce:!0})),number:(s=>Le.create({...s,coerce:!0})),boolean:(s=>qe.create({...s,coerce:!0})),bigint:(s=>Re.create({...s,coerce:!0})),date:(s=>Pe.create({...s,coerce:!0}))};var Hu=O;var qc=Pl(Ic(),1);import{readFileSync as wm,existsSync as Rc}from"fs";import{resolve as Lc,join as _m}from"path";import{homedir as Sm}from"os";var Pc=["haiku","sonnet","opus"],km=s=>{if(typeof s!="string")return null;let[e,t]=s.split("@");return{model:e,weight:Number(t)||1}},Am=G.object({name:G.string().min(1),url:G.string().url(),apiKey:G.string().min(1),models:G.record(G.string(),G.string()).refine(s=>Object.keys(s).some(e=>Pc.includes(e)),{message:"\u81F3\u5C11\u9700\u8981\u4E00\u4E2A\u6709\u6548\u7684 tier (haiku/sonnet/opus)"})}),Em=G.object({providers:G.array(Am).min(1),fetchTimeout:G.number().int().positive().default(3e4)}),Tm=s=>{if(s)return Lc(s);let e=Lc("ismartify.config.yaml");return Rc(e)?e:_m(Sm(),".keepdb","ismartify.config.yaml")},Mc=s=>{let e=Tm(s);if(!Rc(e))throw new Error(s?`\u914D\u7F6E\u6587\u4EF6\u4E0D\u5B58\u5728: ${e}`:"\u672A\u627E\u5230\u914D\u7F6E\u6587\u4EF6\uFF0C\u8BF7\u521B\u5EFA ismartify.config.yaml \u6216 ~/.keepdb/ismartify.config.yaml");let t=(0,qc.parse)(wm(e,"utf-8"));if(!t.codeplan)throw new Error(`\u914D\u7F6E\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF: \u7F3A\u5C11\u9876\u5C42 "codeplan:" key\u3002
|
|
3
141
|
\u8BF7\u53C2\u8003\u683C\u5F0F:
|
|
4
142
|
|
|
5
143
|
codeplan:
|
|
@@ -9,7 +147,7 @@ codeplan:
|
|
|
9
147
|
url: https://api.example.com/anthropic
|
|
10
148
|
apiKey: sk-xxx
|
|
11
149
|
models:
|
|
12
|
-
sonnet: model-name@1`);let r=J.parse(o.codeplan),s=Object.fromEntries(r.providers.map(n=>[n.name,{name:n.name,url:n.url,apiKey:n.apiKey}])),i=r.providers.flatMap(n=>Object.entries(n.models).filter(([c])=>A.includes(c)).map(([c,a])=>{let m=W(a);return m?{tier:c,targetModel:m.model,weight:m.weight,provider:n.name}:null}).filter(Boolean));return{providers:s,slots:i,fetchTimeout:r.fetchTimeout,getProvider:n=>s[n]}};import{Hono as X}from"hono";import{logger as B}from"hono/logger";import{Hono as z}from"hono";var h=t=>{let e=new z;return e.get("/",o=>{let r=Object.values(t.providers).map(({name:s,url:i})=>({name:s,url:i,models:t.slots.filter(n=>n.provider===s).map(({tier:n,targetModel:c,weight:a})=>({tier:n,targetModel:c,weight:a}))}));return o.json({fetchTimeout:t.fetchTimeout,providers:r})}),e};import{Hono as G}from"hono";var S="sonnet",g=["opus","sonnet","haiku"],$=t=>{if(!t||typeof t!="string")return S;let e=t.toLowerCase();return e.includes("haiku")?"haiku":e.includes("opus")?"opus":e.includes("sonnet")?"sonnet":S},C=t=>{let e=g.indexOf(t);return e===-1?g:g.slice(e)};var R=t=>{let e=new Map;return t.forEach((o,r)=>{let s=e.get(o.tier)||[];s.push({...o,originalIndex:r}),e.set(o.tier,s)}),{select:(o,r=[])=>{let s=(e.get(o)||[]).filter(c=>!r.includes(c.originalIndex));if(s.length===0)return null;let i=s.reduce((c,a)=>c+a.weight,0),n=Math.random()*i;for(let c of s){if(n<c.weight)return c;n-=c.weight}return null},countByTier:o=>(e.get(o)||[]).length}};var I=t=>{let e=R(t.slots);return{forward:async({path:r,method:s,jsonBody:i,signal:n})=>{var y;let c=$(i==null?void 0:i.model),a=C(c),m=[];for(let b of a){let F=e.countByTier(b);for(let w=0;w<F;w++){let d=e.select(b,m);if(!d)break;m.push(d.originalIndex);let u=t.getProvider(d.provider);if(!u)continue;let M=i?JSON.stringify({...i,model:d.targetModel}):void 0;try{let f=new AbortController,x=()=>f.abort();n==null||n.addEventListener("abort",x,{once:!0});let j=setTimeout(()=>f.abort(),t.fetchTimeout);try{let l=await fetch(`${u.url}${r}`,{method:s,headers:{"Content-Type":"application/json","Anthropic-Version":"2023-06-01","x-api-key":u.apiKey,"Accept-Encoding":"identity"},body:M,duplex:"half",signal:f.signal});if(l.status===429||l.status>=500){console.warn(`[Fallback] ${u.name} (${d.targetModel}) -> ${l.status}`),await((y=l.body)==null?void 0:y.cancel());continue}let{readable:H,writable:K}=new TransformStream;return l.body.pipeTo(K).catch(v=>{v.name!=="AbortError"&&console.warn(`[Stream] ${u.name}: ${v.message}`)}),new Response(H,{status:l.status,headers:l.headers})}finally{clearTimeout(j),n==null||n.removeEventListener("abort",x)}}catch(f){f.name!=="AbortError"&&console.warn(`[Error] ${u.name}: ${f.message}`)}}}return new Response(JSON.stringify({error:`\u8BE5\u6863\u4F4D (${c}) \u53CA\u5176\u964D\u7EA7\u6863\u4F4D\u6240\u6709\u914D\u7F6E\u7684\u6A21\u578B\u63D2\u69FD\u5747\u5C1D\u8BD5\u5931\u8D25`}),{status:502,headers:{"Content-Type":"application/json"}})}}};var L=t=>{let e=I(t),o=new G;return o.all("/*",async r=>{let{pathname:s,search:i}=new URL(r.req.url),n=s.replace(/^\/anthropic/,"")+i,c=r.req.method,a=null;if(c!=="GET"&&c!=="HEAD")try{a=await r.req.json()}catch{}return e.forward({path:n,method:c,jsonBody:a,signal:r.req.raw.signal})}),o};var O=t=>{let e=new X;return e.use("*",B()),e.route("/config",h(t)),e.route("/status",h(t)),e.route("/anthropic/v1",L(t)),e};import{serve as Q}from"@hono/node-server";var Y=`
|
|
150
|
+
sonnet: model-name@1`);let r=Em.parse(t.codeplan),n=Object.fromEntries(r.providers.map(a=>[a.name,{name:a.name,url:a.url,apiKey:a.apiKey}])),i=r.providers.flatMap(a=>Object.entries(a.models).filter(([o])=>Pc.includes(o)).map(([o,c])=>{let l=km(c);return l?{tier:o,targetModel:l.model,weight:l.weight,provider:a.name}:null}).filter(Boolean));return{providers:n,slots:i,fetchTimeout:r.fetchTimeout,getProvider:a=>n[a]}};var hi=(s,e,t)=>(r,n)=>{let i=-1;return a(0);async function a(o){if(o<=i)throw new Error("next() called multiple times");i=o;let c,l=!1,u;if(s[o]?(u=s[o][0][0],r.req.routeIndex=o):u=o===s.length&&n||void 0,u)try{c=await u(r,()=>a(o+1))}catch(f){if(f instanceof Error&&e)r.error=f,c=await e(f,r),l=!0;else throw f}else r.finalized===!1&&t&&(c=await t(r));return c&&(r.finalized===!1||l)&&(r.res=c),r}};var $c=Symbol();var jc=async(s,e=Object.create(null))=>{let{all:t=!1,dot:r=!1}=e,i=(s instanceof yr?s.raw.headers:s.headers).get("Content-Type");return i?.startsWith("multipart/form-data")||i?.startsWith("application/x-www-form-urlencoded")?Om(s,{all:t,dot:r}):{}};async function Om(s,e){let t=await s.formData();return t?xm(t,e):{}}function xm(s,e){let t=Object.create(null);return s.forEach((r,n)=>{e.all||n.endsWith("[]")?Nm(t,n,r):t[n]=r}),e.dot&&Object.entries(t).forEach(([r,n])=>{r.includes(".")&&(Cm(t,r,n),delete t[r])}),t}var Nm=(s,e,t)=>{s[e]!==void 0?Array.isArray(s[e])?s[e].push(t):s[e]=[s[e],t]:e.endsWith("[]")?s[e]=[t]:s[e]=t},Cm=(s,e,t)=>{if(/(?:^|\.)__proto__\./.test(e))return;let r=s,n=e.split(".");n.forEach((i,a)=>{a===n.length-1?r[i]=t:((!r[i]||typeof r[i]!="object"||Array.isArray(r[i])||r[i]instanceof File)&&(r[i]=Object.create(null)),r=r[i])})};var mi=s=>{let e=s.split("/");return e[0]===""&&e.shift(),e},Dc=s=>{let{groups:e,path:t}=Im(s),r=mi(t);return Lm(r,e)},Im=s=>{let e=[];return s=s.replace(/\{[^}]+\}/g,(t,r)=>{let n=`@${r}`;return e.push([n,t]),n}),{groups:e,path:s}},Lm=(s,e)=>{for(let t=e.length-1;t>=0;t--){let[r]=e[t];for(let n=s.length-1;n>=0;n--)if(s[n].includes(r)){s[n]=s[n].replace(r,e[t][1]);break}}return s},gr={},Bc=(s,e)=>{if(s==="*")return"*";let t=s.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(t){let r=`${s}#${e}`;return gr[r]||(t[2]?gr[r]=e&&e[0]!==":"&&e[0]!=="*"?[r,t[1],new RegExp(`^${t[2]}(?=/${e})`)]:[s,t[1],new RegExp(`^${t[2]}$`)]:gr[r]=[s,t[1],!0]),gr[r]}return null},vr=(s,e)=>{try{return e(s)}catch{return s.replace(/(?:%[0-9A-Fa-f]{2})+/g,t=>{try{return e(t)}catch{return t}})}},Rm=s=>vr(s,decodeURI),yi=s=>{let e=s.url,t=e.indexOf("/",e.indexOf(":")+4),r=t;for(;r<e.length;r++){let n=e.charCodeAt(r);if(n===37){let i=e.indexOf("?",r),a=e.indexOf("#",r),o=i===-1?a===-1?void 0:a:a===-1?i:Math.min(i,a),c=e.slice(t,o);return Rm(c.includes("%25")?c.replace(/%25/g,"%2525"):c)}else if(n===63||n===35)break}return e.slice(t,r)};var Fc=s=>{let e=yi(s);return e.length>1&&e.at(-1)==="/"?e.slice(0,-1):e},Xe=(s,e,...t)=>(t.length&&(e=Xe(e,...t)),`${s?.[0]==="/"?"":"/"}${s}${e==="/"?"":`${s?.at(-1)==="/"?"":"/"}${e?.[0]==="/"?e.slice(1):e}`}`),br=s=>{if(s.charCodeAt(s.length-1)!==63||!s.includes(":"))return null;let e=s.split("/"),t=[],r="";return e.forEach(n=>{if(n!==""&&!/\:/.test(n))r+="/"+n;else if(/\:/.test(n))if(/\?/.test(n)){t.length===0&&r===""?t.push("/"):t.push(r);let i=n.replace("?","");r+="/"+i,t.push(r)}else r+="/"+n}),t.filter((n,i,a)=>a.indexOf(n)===i)},pi=s=>/[%+]/.test(s)?(s.indexOf("+")!==-1&&(s=s.replace(/\+/g," ")),s.indexOf("%")!==-1?vr(s,gi):s):s,Kc=(s,e,t)=>{let r;if(!t&&e&&!/[%+]/.test(e)){let a=s.indexOf("?",8);if(a===-1)return;for(s.startsWith(e,a+1)||(a=s.indexOf(`&${e}`,a+1));a!==-1;){let o=s.charCodeAt(a+e.length+1);if(o===61){let c=a+e.length+2,l=s.indexOf("&",c);return pi(s.slice(c,l===-1?void 0:l))}else if(o==38||isNaN(o))return"";a=s.indexOf(`&${e}`,a+1)}if(r=/[%+]/.test(s),!r)return}let n={};r??=/[%+]/.test(s);let i=s.indexOf("?",8);for(;i!==-1;){let a=s.indexOf("&",i+1),o=s.indexOf("=",i);o>a&&a!==-1&&(o=-1);let c=s.slice(i+1,o===-1?a===-1?void 0:a:o);if(r&&(c=pi(c)),i=a,c==="")continue;let l;o===-1?l="":(l=s.slice(o+1,a===-1?void 0:a),r&&(l=pi(l))),t?(n[c]&&Array.isArray(n[c])||(n[c]=[]),n[c].push(l)):n[c]??=l}return e?n[e]:n},Uc=Kc,Vc=(s,e)=>Kc(s,e,!0),gi=decodeURIComponent;var Hc=s=>vr(s,gi),yr=class{raw;#t;#e;routeIndex=0;path;bodyCache={};constructor(s,e="/",t=[[]]){this.raw=s,this.path=e,this.#e=t,this.#t={}}param(s){return s?this.#s(s):this.#i()}#s(s){let e=this.#e[0][this.routeIndex][1][s],t=this.#n(e);return t&&/\%/.test(t)?Hc(t):t}#i(){let s={},e=Object.keys(this.#e[0][this.routeIndex][1]);for(let t of e){let r=this.#n(this.#e[0][this.routeIndex][1][t]);r!==void 0&&(s[t]=/\%/.test(r)?Hc(r):r)}return s}#n(s){return this.#e[1]?this.#e[1][s]:s}query(s){return Uc(this.url,s)}queries(s){return Vc(this.url,s)}header(s){if(s)return this.raw.headers.get(s)??void 0;let e={};return this.raw.headers.forEach((t,r)=>{e[r]=t}),e}async parseBody(s){return jc(this,s)}#r=s=>{let{bodyCache:e,raw:t}=this,r=e[s];if(r)return r;let n=Object.keys(e)[0];return n?e[n].then(i=>(n==="json"&&(i=JSON.stringify(i)),new Response(i)[s]())):e[s]=t[s]()};json(){return this.#r("text").then(s=>JSON.parse(s))}text(){return this.#r("text")}arrayBuffer(){return this.#r("arrayBuffer")}blob(){return this.#r("blob")}formData(){return this.#r("formData")}addValidatedData(s,e){this.#t[s]=e}valid(s){return this.#t[s]}get url(){return this.raw.url}get method(){return this.raw.method}get[$c](){return this.#e}get matchedRoutes(){return this.#e[0].map(([[,s]])=>s)}get routePath(){return this.#e[0].map(([[,s]])=>s)[this.routeIndex].path}};var Yc={Stringify:1,BeforeStream:2,Stream:3},qm=(s,e)=>{let t=new String(s);return t.isEscaped=!0,t.callbacks=e,t};var vi=async(s,e,t,r,n)=>{typeof s=="object"&&!(s instanceof String)&&(s instanceof Promise||(s=s.toString()),s instanceof Promise&&(s=await s));let i=s.callbacks;if(!i?.length)return Promise.resolve(s);n?n[0]+=s:n=[s];let a=Promise.all(i.map(o=>o({phase:e,buffer:n,context:r}))).then(o=>Promise.all(o.filter(Boolean).map(c=>vi(c,e,!1,r,n))).then(()=>n[0]));return t?qm(await a,i):a};var Pm="text/plain; charset=UTF-8",bi=(s,e)=>({"Content-Type":s,...e}),cs=(s,e)=>new Response(s,e),Jc=class{#t;#e;env={};#s;finalized=!1;error;#i;#n;#r;#u;#c;#l;#o;#f;#d;constructor(s,e){this.#t=s,e&&(this.#n=e.executionCtx,this.env=e.env,this.#l=e.notFoundHandler,this.#d=e.path,this.#f=e.matchResult)}get req(){return this.#e??=new yr(this.#t,this.#d,this.#f),this.#e}get event(){if(this.#n&&"respondWith"in this.#n)return this.#n;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#n)return this.#n;throw Error("This context has no ExecutionContext")}get res(){return this.#r||=cs(null,{headers:this.#o??=new Headers})}set res(s){if(this.#r&&s){s=cs(s.body,s);for(let[e,t]of this.#r.headers.entries())if(e!=="content-type")if(e==="set-cookie"){let r=this.#r.headers.getSetCookie();s.headers.delete("set-cookie");for(let n of r)s.headers.append("set-cookie",n)}else s.headers.set(e,t)}this.#r=s,this.finalized=!0}render=(...s)=>(this.#c??=e=>this.html(e),this.#c(...s));setLayout=s=>this.#u=s;getLayout=()=>this.#u;setRenderer=s=>{this.#c=s};header=(s,e,t)=>{this.finalized&&(this.#r=cs(this.#r.body,this.#r));let r=this.#r?this.#r.headers:this.#o??=new Headers;e===void 0?r.delete(s):t?.append?r.append(s,e):r.set(s,e)};status=s=>{this.#i=s};set=(s,e)=>{this.#s??=new Map,this.#s.set(s,e)};get=s=>this.#s?this.#s.get(s):void 0;get var(){return this.#s?Object.fromEntries(this.#s):{}}#a(s,e,t){let r=this.#r?new Headers(this.#r.headers):this.#o??new Headers;if(typeof e=="object"&&"headers"in e){let i=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[a,o]of i)a.toLowerCase()==="set-cookie"?r.append(a,o):r.set(a,o)}if(t)for(let[i,a]of Object.entries(t))if(typeof a=="string")r.set(i,a);else{r.delete(i);for(let o of a)r.append(i,o)}let n=typeof e=="number"?e:e?.status??this.#i;return cs(s,{status:n,headers:r})}newResponse=(...s)=>this.#a(...s);body=(s,e,t)=>this.#a(s,e,t);text=(s,e,t)=>!this.#o&&!this.#i&&!e&&!t&&!this.finalized?new Response(s):this.#a(s,e,bi(Pm,t));json=(s,e,t)=>this.#a(JSON.stringify(s),e,bi("application/json",t));html=(s,e,t)=>{let r=n=>this.#a(n,e,bi("text/html; charset=UTF-8",t));return typeof s=="object"?vi(s,Yc.Stringify,!1,{}).then(r):r(s)};redirect=(s,e)=>{let t=String(s);return this.header("Location",/[^\x00-\xFF]/.test(t)?encodeURI(t):t),this.newResponse(null,e??302)};notFound=()=>(this.#l??=()=>cs(),this.#l(this))};var j="ALL",Wc="all",Zc=["get","post","put","delete","options","patch"],wr="Can not add a route since the matcher is already built.",_r=class extends Error{};var zc="__COMPOSED_HANDLER";var Mm=s=>s.text("404 Not Found",404),Gc=(s,e)=>{if("getResponse"in s){let t=s.getResponse();return e.newResponse(t.body,t)}return console.error(s),e.text("Internal Server Error",500)},Qc=class Xc{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#t="/";routes=[];constructor(e={}){[...Zc,Wc].forEach(i=>{this[i]=(a,...o)=>(typeof a=="string"?this.#t=a:this.#i(i,this.#t,a),o.forEach(c=>{this.#i(i,this.#t,c)}),this)}),this.on=(i,a,...o)=>{for(let c of[a].flat()){this.#t=c;for(let l of[i].flat())o.map(u=>{this.#i(l.toUpperCase(),this.#t,u)})}return this},this.use=(i,...a)=>(typeof i=="string"?this.#t=i:(this.#t="*",a.unshift(i)),a.forEach(o=>{this.#i(j,this.#t,o)}),this);let{strict:r,...n}=e;Object.assign(this,n),this.getPath=r??!0?e.getPath??yi:Fc}#e(){let e=new Xc({router:this.router,getPath:this.getPath});return e.errorHandler=this.errorHandler,e.#s=this.#s,e.routes=this.routes,e}#s=Mm;errorHandler=Gc;route(e,t){let r=this.basePath(e);return t.routes.map(n=>{let i;t.errorHandler===Gc?i=n.handler:(i=async(a,o)=>(await hi([],t.errorHandler)(a,()=>n.handler(a,o))).res,i[zc]=n.handler),r.#i(n.method,n.path,i)}),this}basePath(e){let t=this.#e();return t._basePath=Xe(this._basePath,e),t}onError=e=>(this.errorHandler=e,this);notFound=e=>(this.#s=e,this);mount(e,t,r){let n,i;r&&(typeof r=="function"?i=r:(i=r.optionHandler,r.replaceRequest===!1?n=c=>c:n=r.replaceRequest));let a=i?c=>{let l=i(c);return Array.isArray(l)?l:[l]}:c=>{let l;try{l=c.executionCtx}catch{}return[c.env,l]};n||=(()=>{let c=Xe(this._basePath,e),l=c==="/"?0:c.length;return u=>{let f=new URL(u.url);return f.pathname=f.pathname.slice(l)||"/",new Request(f,u)}})();let o=async(c,l)=>{let u=await t(n(c.req.raw),...a(c));if(u)return u;await l()};return this.#i(j,Xe(e,"*"),o),this}#i(e,t,r){e=e.toUpperCase(),t=Xe(this._basePath,t);let n={basePath:this._basePath,path:t,method:e,handler:r};this.router.add(e,t,[r,n]),this.routes.push(n)}#n(e,t){if(e instanceof Error)return this.errorHandler(e,t);throw e}#r(e,t,r,n){if(n==="HEAD")return(async()=>new Response(null,await this.#r(e,t,r,"GET")))();let i=this.getPath(e,{env:r}),a=this.router.match(n,i),o=new Jc(e,{path:i,matchResult:a,env:r,executionCtx:t,notFoundHandler:this.#s});if(a[0].length===1){let l;try{l=a[0][0][0][0](o,async()=>{o.res=await this.#s(o)})}catch(u){return this.#n(u,o)}return l instanceof Promise?l.then(u=>u||(o.finalized?o.res:this.#s(o))).catch(u=>this.#n(u,o)):l??this.#s(o)}let c=hi(a[0],this.errorHandler,this.#s);return(async()=>{try{let l=await c(o);if(!l.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return l.res}catch(l){return this.#n(l,o)}})()}fetch=(e,...t)=>this.#r(e,t[1],t[0],e.method);request=(e,t,r,n)=>e instanceof Request?this.fetch(t?new Request(e,t):e,r,n):(e=e.toString(),this.fetch(new Request(/^https?:\/\//.test(e)?e:`http://localhost${Xe("/",e)}`,t),r,n));fire=()=>{addEventListener("fetch",e=>{e.respondWith(this.#r(e.request,e,void 0,e.request.method))})}};var Sr=[];function wi(s,e){let t=this.buildAllMatchers(),r=((n,i)=>{let a=t[n]||t[j],o=a[2][i];if(o)return o;let c=i.match(a[0]);if(!c)return[[],Sr];let l=c.indexOf("",1);return[a[1][l],c]});return this.match=r,r(s,e)}var kr="[^/]+",ls=".*",us="(?:|/.*)",et=Symbol(),$m=new Set(".\\+*[^]$()");function jm(s,e){return s.length===1?e.length===1?s<e?-1:1:-1:e.length===1||s===ls||s===us?1:e===ls||e===us?-1:s===kr?1:e===kr?-1:s.length===e.length?s<e?-1:1:e.length-s.length}var el=class _i{#t;#e;#s=Object.create(null);insert(e,t,r,n,i){if(e.length===0){if(this.#t!==void 0)throw et;if(i)return;this.#t=t;return}let[a,...o]=e,c=a==="*"?o.length===0?["","",ls]:["","",kr]:a==="/*"?["","",us]:a.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),l;if(c){let u=c[1],f=c[2]||kr;if(u&&c[2]&&(f===".*"||(f=f.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(f))))throw et;if(l=this.#s[f],!l){if(Object.keys(this.#s).some(d=>d!==ls&&d!==us))throw et;if(i)return;l=this.#s[f]=new _i,u!==""&&(l.#e=n.varIndex++)}!i&&u!==""&&r.push([u,l.#e])}else if(l=this.#s[a],!l){if(Object.keys(this.#s).some(u=>u.length>1&&u!==ls&&u!==us))throw et;if(i)return;l=this.#s[a]=new _i}l.insert(o,t,r,n,i)}buildRegExpStr(){let t=Object.keys(this.#s).sort(jm).map(r=>{let n=this.#s[r];return(typeof n.#e=="number"?`(${r})@${n.#e}`:$m.has(r)?`\\${r}`:r)+n.buildRegExpStr()});return typeof this.#t=="number"&&t.unshift(`#${this.#t}`),t.length===0?"":t.length===1?t[0]:"(?:"+t.join("|")+")"}};var tl=class{#t={varIndex:0};#e=new el;insert(s,e,t){let r=[],n=[];for(let a=0;;){let o=!1;if(s=s.replace(/\{[^}]+\}/g,c=>{let l=`@\\${a}`;return n[a]=[l,c],a++,o=!0,l}),!o)break}let i=s.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let a=n.length-1;a>=0;a--){let[o]=n[a];for(let c=i.length-1;c>=0;c--)if(i[c].indexOf(o)!==-1){i[c]=i[c].replace(o,n[a][1]);break}}return this.#e.insert(i,e,r,this.#t,t),r}buildRegExp(){let s=this.#e.buildRegExpStr();if(s==="")return[/^$/,[],[]];let e=0,t=[],r=[];return s=s.replace(/#(\d+)|@(\d+)|\.\*\$/g,(n,i,a)=>i!==void 0?(t[++e]=Number(i),"$()"):(a!==void 0&&(r[Number(a)]=++e),"")),[new RegExp(`^${s}`),t,r]}};var Dm=[/^$/,[],Object.create(null)],sl=Object.create(null);function rl(s){return sl[s]??=new RegExp(s==="*"?"":`^${s.replace(/\/\*$|([.\\+*[^\]$()])/g,(e,t)=>t?`\\${t}`:"(?:|/.*)")}$`)}function Bm(){sl=Object.create(null)}function Fm(s){let e=new tl,t=[];if(s.length===0)return Dm;let r=s.map(l=>[!/\*|\/:/.test(l[0]),...l]).sort(([l,u],[f,d])=>l?1:f?-1:u.length-d.length),n=Object.create(null);for(let l=0,u=-1,f=r.length;l<f;l++){let[d,p,g]=r[l];d?n[p]=[g.map(([m])=>[m,Object.create(null)]),Sr]:u++;let h;try{h=e.insert(p,u,d)}catch(m){throw m===et?new _r(p):m}d||(t[u]=g.map(([m,v])=>{let S=Object.create(null);for(v-=1;v>=0;v--){let[k,x]=h[v];S[k]=x}return[m,S]}))}let[i,a,o]=e.buildRegExp();for(let l=0,u=t.length;l<u;l++)for(let f=0,d=t[l].length;f<d;f++){let p=t[l][f]?.[1];if(!p)continue;let g=Object.keys(p);for(let h=0,m=g.length;h<m;h++)p[g[h]]=o[p[g[h]]]}let c=[];for(let l in a)c[l]=t[a[l]];return[i,c,n]}function kt(s,e){if(s){for(let t of Object.keys(s).sort((r,n)=>n.length-r.length))if(rl(t).test(e))return[...s[t]]}}var Ar=class{name="RegExpRouter";#t;#e;constructor(){this.#t={[j]:Object.create(null)},this.#e={[j]:Object.create(null)}}add(s,e,t){let r=this.#t,n=this.#e;if(!r||!n)throw new Error(wr);r[s]||[r,n].forEach(o=>{o[s]=Object.create(null),Object.keys(o[j]).forEach(c=>{o[s][c]=[...o[j][c]]})}),e==="/*"&&(e="*");let i=(e.match(/\/:/g)||[]).length;if(/\*$/.test(e)){let o=rl(e);s===j?Object.keys(r).forEach(c=>{r[c][e]||=kt(r[c],e)||kt(r[j],e)||[]}):r[s][e]||=kt(r[s],e)||kt(r[j],e)||[],Object.keys(r).forEach(c=>{(s===j||s===c)&&Object.keys(r[c]).forEach(l=>{o.test(l)&&r[c][l].push([t,i])})}),Object.keys(n).forEach(c=>{(s===j||s===c)&&Object.keys(n[c]).forEach(l=>o.test(l)&&n[c][l].push([t,i]))});return}let a=br(e)||[e];for(let o=0,c=a.length;o<c;o++){let l=a[o];Object.keys(n).forEach(u=>{(s===j||s===u)&&(n[u][l]||=[...kt(r[u],l)||kt(r[j],l)||[]],n[u][l].push([t,i-c+o+1]))})}}match=wi;buildAllMatchers(){let s=Object.create(null);return Object.keys(this.#e).concat(Object.keys(this.#t)).forEach(e=>{s[e]||=this.#s(e)}),this.#t=this.#e=void 0,Bm(),s}#s(s){let e=[],t=s===j;return[this.#t,this.#e].forEach(r=>{let n=r[s]?Object.keys(r[s]).map(i=>[i,r[s][i]]):[];n.length!==0?(t||=!0,e.push(...n)):s!==j&&e.push(...Object.keys(r[j]).map(i=>[i,r[j][i]]))}),t?Fm(e):null}};var Si=class{name="SmartRouter";#t=[];#e=[];constructor(s){this.#t=s.routers}add(s,e,t){if(!this.#e)throw new Error(wr);this.#e.push([s,e,t])}match(s,e){if(!this.#e)throw new Error("Fatal error");let t=this.#t,r=this.#e,n=t.length,i=0,a;for(;i<n;i++){let o=t[i];try{for(let c=0,l=r.length;c<l;c++)o.add(...r[c]);a=o.match(s,e)}catch(c){if(c instanceof _r)continue;throw c}this.match=o.match.bind(o),this.#t=[o],this.#e=void 0;break}if(i===n)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,a}get activeRouter(){if(this.#e||this.#t.length!==1)throw new Error("No active router has been determined yet.");return this.#t[0]}};var fs=Object.create(null),Km=s=>{for(let e in s)return!0;return!1},nl=class il{#t;#e;#s;#i=0;#n=fs;constructor(e,t,r){if(this.#e=r||Object.create(null),this.#t=[],e&&t){let n=Object.create(null);n[e]={handler:t,possibleKeys:[],score:0},this.#t=[n]}this.#s=[]}insert(e,t,r){this.#i=++this.#i;let n=this,i=Dc(t),a=[];for(let o=0,c=i.length;o<c;o++){let l=i[o],u=i[o+1],f=Bc(l,u),d=Array.isArray(f)?f[0]:l;if(d in n.#e){n=n.#e[d],f&&a.push(f[1]);continue}n.#e[d]=new il,f&&(n.#s.push(f),a.push(f[1])),n=n.#e[d]}return n.#t.push({[e]:{handler:r,possibleKeys:a.filter((o,c,l)=>l.indexOf(o)===c),score:this.#i}}),n}#r(e,t,r,n,i){for(let a=0,o=t.#t.length;a<o;a++){let c=t.#t[a],l=c[r]||c[j],u={};if(l!==void 0&&(l.params=Object.create(null),e.push(l),n!==fs||i&&i!==fs))for(let f=0,d=l.possibleKeys.length;f<d;f++){let p=l.possibleKeys[f],g=u[l.score];l.params[p]=i?.[p]&&!g?i[p]:n[p]??i?.[p],u[l.score]=!0}}}search(e,t){let r=[];this.#n=fs;let i=[this],a=mi(t),o=[],c=a.length,l=null;for(let u=0;u<c;u++){let f=a[u],d=u===c-1,p=[];for(let h=0,m=i.length;h<m;h++){let v=i[h],S=v.#e[f];S&&(S.#n=v.#n,d?(S.#e["*"]&&this.#r(r,S.#e["*"],e,v.#n),this.#r(r,S,e,v.#n)):p.push(S));for(let k=0,x=v.#s.length;k<x;k++){let C=v.#s[k],T=v.#n===fs?{}:{...v.#n};if(C==="*"){let z=v.#e["*"];z&&(this.#r(r,z,e,v.#n),z.#n=T,p.push(z));continue}let[P,A,$]=C;if(!f&&!($ instanceof RegExp))continue;let K=v.#e[P];if($ instanceof RegExp){if(l===null){l=new Array(c);let Ce=t[0]==="/"?1:0;for(let Ot=0;Ot<c;Ot++)l[Ot]=Ce,Ce+=a[Ot].length+1}let z=t.substring(l[u]),D=$.exec(z);if(D){if(T[A]=D[0],this.#r(r,K,e,v.#n,T),Km(K.#e)){K.#n=T;let Ce=D[0].match(/\//)?.length??0;(o[Ce]||=[]).push(K)}continue}}($===!0||$.test(f))&&(T[A]=f,d?(this.#r(r,K,e,T,v.#n),K.#e["*"]&&this.#r(r,K.#e["*"],e,T,v.#n)):(K.#n=T,p.push(K)))}}let g=o.shift();i=g?p.concat(g):p}return r.length>1&&r.sort((u,f)=>u.score-f.score),[r.map(({handler:u,params:f})=>[u,f])]}};var ki=class{name="TrieRouter";#t;constructor(){this.#t=new nl}add(s,e,t){let r=br(e);if(r){for(let n=0,i=r.length;n<i;n++)this.#t.insert(s,r[n],t);return}this.#t.insert(s,e,t)}match(s,e){return this.#t.search(s,e)}};var tt=class extends Qc{constructor(s={}){super(s),this.router=s.router??new Si({routers:[new Ar,new ki]})}};function Um(){let{process:s,Deno:e}=globalThis;return!(typeof e?.noColor=="boolean"?e.noColor:s!==void 0?"NO_COLOR"in s?.env:!1)}async function al(){let{navigator:s}=globalThis,e="cloudflare:workers";return!(s!==void 0&&s.userAgent==="Cloudflare-Workers"?await(async()=>{try{return"NO_COLOR"in((await import(e)).env??{})}catch{return!1}})():!Um())}var Vm=s=>{let[e,t]=[",","."];return s.map(n=>n.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+e)).join(t)},Hm=s=>{let e=Date.now()-s;return Vm([e<1e3?e+"ms":Math.round(e/1e3)+"s"])},Ym=async s=>{if(await al())switch(s/100|0){case 5:return`\x1B[31m${s}\x1B[0m`;case 4:return`\x1B[33m${s}\x1B[0m`;case 3:return`\x1B[36m${s}\x1B[0m`;case 2:return`\x1B[32m${s}\x1B[0m`}return`${s}`};async function ol(s,e,t,r,n=0,i){let a=e==="<--"?`${e} ${t} ${r}`:`${e} ${t} ${r} ${await Ym(n)} ${i}`;s(a)}var cl=(s=console.log)=>async function(t,r){let{method:n,url:i}=t.req,a=i.slice(i.indexOf("/",8));await ol(s,"<--",n,a);let o=Date.now();await r(),await ol(s,"-->",n,a,t.res.status,Hm(o))};var Ai=s=>{let e=new tt;return e.get("/",t=>{let r=Object.values(s.providers).map(({name:n,url:i})=>({name:n,url:i,models:s.slots.filter(a=>a.provider===n).map(({tier:a,targetModel:o,weight:c})=>({tier:a,targetModel:o,weight:c}))}));return t.json({fetchTimeout:s.fetchTimeout,providers:r})}),e};var ll="sonnet",Ei=["opus","sonnet","haiku"],ul=s=>{if(!s||typeof s!="string")return ll;let e=s.toLowerCase();return e.includes("haiku")?"haiku":e.includes("opus")?"opus":e.includes("sonnet")?"sonnet":ll},fl=s=>{let e=Ei.indexOf(s);return e===-1?Ei:Ei.slice(e)};var dl=s=>{let e=new Map;return s.forEach((t,r)=>{let n=e.get(t.tier)||[];n.push({...t,originalIndex:r}),e.set(t.tier,n)}),{select:(t,r=[])=>{let n=(e.get(t)||[]).filter(o=>!r.includes(o.originalIndex));if(n.length===0)return null;let i=n.reduce((o,c)=>o+c.weight,0),a=Math.random()*i;for(let o of n){if(a<o.weight)return o;a-=o.weight}return null},countByTier:t=>(e.get(t)||[]).length}};var hl=s=>{let e=dl(s.slots);return{forward:async({path:r,method:n,jsonBody:i,signal:a})=>{let o=ul(i?.model),c=fl(o),l=[];for(let u of c){let f=e.countByTier(u);for(let d=0;d<f;d++){let p=e.select(u,l);if(!p)break;l.push(p.originalIndex);let g=s.getProvider(p.provider);if(!g)continue;let h=i?JSON.stringify({...i,model:p.targetModel}):void 0;try{let m=new AbortController,v=()=>m.abort();a?.addEventListener("abort",v,{once:!0});let S=setTimeout(()=>m.abort(),s.fetchTimeout);try{let k=await fetch(`${g.url}${r}`,{method:n,headers:{"Content-Type":"application/json","Anthropic-Version":"2023-06-01","x-api-key":g.apiKey,"Accept-Encoding":"identity"},body:h,duplex:"half",signal:m.signal});if(k.status===429||k.status>=500){console.warn(`[Fallback] ${g.name} (${p.targetModel}) -> ${k.status}`),await k.body?.cancel();continue}let{readable:C,writable:T}=new TransformStream;return k.body.pipeTo(T).catch(P=>{P.name!=="AbortError"&&console.warn(`[Stream] ${g.name}: ${P.message}`)}),new Response(C,{status:k.status,headers:k.headers})}finally{clearTimeout(S),a?.removeEventListener("abort",v)}}catch(m){m.name!=="AbortError"&&console.warn(`[Error] ${g.name}: ${m.message}`)}}}return new Response(JSON.stringify({error:`\u8BE5\u6863\u4F4D (${o}) \u53CA\u5176\u964D\u7EA7\u6863\u4F4D\u6240\u6709\u914D\u7F6E\u7684\u6A21\u578B\u63D2\u69FD\u5747\u5C1D\u8BD5\u5931\u8D25`}),{status:502,headers:{"Content-Type":"application/json"}})}}};var pl=s=>{let e=hl(s),t=new tt;return t.all("/*",async r=>{let{pathname:n,search:i}=new URL(r.req.url),a=n.replace(/^\/anthropic/,"")+i,o=r.req.method,c=null;if(o!=="GET"&&o!=="HEAD")try{c=await r.req.json()}catch{}return e.forward({path:a,method:o,jsonBody:c,signal:r.req.raw.signal})}),t};var ml=s=>{let e=new tt;return e.use("*",cl()),e.route("/config",Ai(s)),e.route("/status",Ai(s)),e.route("/anthropic/v1",pl(s)),e};import{createServer as Jm}from"http";import{Http2ServerRequest as bl,constants as Wm}from"http2";import{Http2ServerRequest as Ti}from"http2";import{Readable as yl}from"stream";import ay from"crypto";var st=class extends Error{constructor(s,e){super(s,e),this.name="RequestError"}},Zm=s=>s instanceof st?s:new st(s.message,{cause:s}),zm=global.Request,ds=class extends zm{constructor(s,e){typeof s=="object"&&Tt in s&&(s=s[Tt]()),typeof e?.body?.getReader<"u"&&(e.duplex??="half"),super(s,e)}},Gm=s=>{let e=[],t=s.rawHeaders;for(let r=0;r<t.length;r+=2){let{[r]:n,[r+1]:i}=t;n.charCodeAt(0)!==58&&e.push([n,i])}return new Headers(e)},wl=Symbol("wrapBodyStream"),Qm=(s,e,t,r,n)=>{let i={method:s,headers:t,signal:n.signal};if(s==="TRACE"){i.method="GET";let a=new ds(e,i);return Object.defineProperty(a,"method",{get(){return"TRACE"}}),a}if(!(s==="GET"||s==="HEAD"))if("rawBody"in r&&r.rawBody instanceof Buffer)i.body=new ReadableStream({start(a){a.enqueue(r.rawBody),a.close()}});else if(r[wl]){let a;i.body=new ReadableStream({async pull(o){try{a||=yl.toWeb(r).getReader();let{done:c,value:l}=await a.read();c?o.close():o.enqueue(l)}catch(c){o.error(c)}}})}else i.body=yl.toWeb(r);return new ds(e,i)},Tt=Symbol("getRequestCache"),Xm=Symbol("requestCache"),Er=Symbol("incomingKey"),Tr=Symbol("urlKey"),ey=Symbol("headersKey"),Et=Symbol("abortControllerKey"),ty=Symbol("getAbortController"),Or={get method(){return this[Er].method||"GET"},get url(){return this[Tr]},get headers(){return this[ey]||=Gm(this[Er])},[ty](){return this[Tt](),this[Et]},[Tt](){return this[Et]||=new AbortController,this[Xm]||=Qm(this.method,this[Tr],this.headers,this[Er],this[Et])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(s=>{Object.defineProperty(Or,s,{get(){return this[Tt]()[s]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(s=>{Object.defineProperty(Or,s,{value:function(){return this[Tt]()[s]()}})});Object.setPrototypeOf(Or,ds.prototype);var sy=(s,e)=>{let t=Object.create(Or);t[Er]=s;let r=s.url||"";if(r[0]!=="/"&&(r.startsWith("http://")||r.startsWith("https://"))){if(s instanceof Ti)throw new st("Absolute URL for :path is not allowed in HTTP/2");try{let o=new URL(r);t[Tr]=o.href}catch(o){throw new st("Invalid absolute URL",{cause:o})}return t}let n=(s instanceof Ti?s.authority:s.headers.host)||e;if(!n)throw new st("Missing host header");let i;if(s instanceof Ti){if(i=s.scheme,!(i==="http"||i==="https"))throw new st("Unsupported scheme")}else i=s.socket&&s.socket.encrypted?"https":"http";let a=new URL(`${i}://${n}${r}`);if(a.hostname.length!==n.length&&a.hostname!==n.replace(/:\d+$/,""))throw new st("Invalid host header");return t[Tr]=a.href,t},gl=Symbol("responseCache"),At=Symbol("getResponseCache"),rt=Symbol("cache"),Ci=global.Response,hs=class _l{#t;#e;[At](){return delete this[rt],this[gl]||=new Ci(this.#t,this.#e)}constructor(e,t){let r;if(this.#t=e,t instanceof _l){let n=t[gl];if(n){this.#e=n,this[At]();return}else this.#e=t.#e,r=new Headers(t.#e.headers)}else this.#e=t;(typeof e=="string"||typeof e?.getReader<"u"||e instanceof Blob||e instanceof Uint8Array)&&(this[rt]=[t?.status||200,e,r||t?.headers])}get headers(){let e=this[rt];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":"text/plain; charset=UTF-8"})),e[2]):this[At]().headers}get status(){return this[rt]?.[0]??this[At]().status}get ok(){let e=this.status;return e>=200&&e<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(s=>{Object.defineProperty(hs.prototype,s,{get(){return this[At]()[s]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(s=>{Object.defineProperty(hs.prototype,s,{value:function(){return this[At]()[s]()}})});Object.setPrototypeOf(hs,Ci);Object.setPrototypeOf(hs.prototype,Ci.prototype);async function ry(s){return Promise.race([s,Promise.resolve().then(()=>Promise.resolve(void 0))])}function Sl(s,e,t){let r=o=>{s.cancel(o).catch(()=>{})};return e.on("close",r),e.on("error",r),(t??s.read()).then(a,n),s.closed.finally(()=>{e.off("close",r),e.off("error",r)});function n(o){o&&e.destroy(o)}function i(){s.read().then(a,n)}function a({done:o,value:c}){try{if(o)e.end();else if(!e.write(c))e.once("drain",i);else return s.read().then(a,n)}catch(l){n(l)}}}function ny(s,e){if(s.locked)throw new TypeError("ReadableStream is locked.");return e.destroyed?void 0:Sl(s.getReader(),e)}var xi=s=>{let e={};s instanceof Headers||(s=new Headers(s??void 0));let t=[];for(let[r,n]of s)r==="set-cookie"?t.push(n):e[r]=n;return t.length>0&&(e["set-cookie"]=t),e["content-type"]??="text/plain; charset=UTF-8",e},iy="x-hono-already-sent";typeof global.crypto>"u"&&(global.crypto=ay);var Ii=Symbol("outgoingEnded"),vl=Symbol("incomingDraining"),oy=500,cy=64*1024*1024,Oi=s=>{let e=s;if(s.destroyed||e[vl])return;if(e[vl]=!0,s instanceof bl){try{s.stream?.close?.(Wm.NGHTTP2_NO_ERROR)}catch{}return}let t=0,r=()=>{clearTimeout(i),s.off("data",a),s.off("end",r),s.off("error",r)},n=()=>{r();let o=s.socket;o&&!o.destroyed&&o.destroySoon()},i=setTimeout(n,oy);i.unref?.();let a=o=>{t+=o.length,t>cy&&n()};s.on("data",a),s.on("end",r),s.on("error",r),s.resume()},ly=()=>new Response(null,{status:400}),kl=s=>new Response(null,{status:s instanceof Error&&(s.name==="TimeoutError"||s.constructor.name==="TimeoutError")?504:500}),Ni=(s,e)=>{let t=s instanceof Error?s:new Error("unknown error",{cause:s});t.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(s),e.headersSent||e.writeHead(500,{"Content-Type":"text/plain"}),e.end(`Error: ${t.message}`),e.destroy(t))},Al=s=>{"flushHeaders"in s&&s.writable&&s.flushHeaders()},El=async(s,e)=>{let[t,r,n]=s[rt],i=!1;if(!n)n={"content-type":"text/plain; charset=UTF-8"};else if(n instanceof Headers)i=n.has("content-length"),n=xi(n);else if(Array.isArray(n)){let a=new Headers(n);i=a.has("content-length"),n=xi(a)}else for(let a in n)if(a.length===14&&a.toLowerCase()==="content-length"){i=!0;break}i||(typeof r=="string"?n["Content-Length"]=Buffer.byteLength(r):r instanceof Uint8Array?n["Content-Length"]=r.byteLength:r instanceof Blob&&(n["Content-Length"]=r.size)),e.writeHead(t,n),typeof r=="string"||r instanceof Uint8Array?e.end(r):r instanceof Blob?e.end(new Uint8Array(await r.arrayBuffer())):(Al(e),await ny(r,e)?.catch(a=>Ni(a,e))),e[Ii]?.()},uy=s=>typeof s.then=="function",fy=async(s,e,t={})=>{if(uy(s))if(t.errorHandler)try{s=await s}catch(n){let i=await t.errorHandler(n);if(!i)return;s=i}else s=await s.catch(kl);if(rt in s)return El(s,e);let r=xi(s.headers);if(s.body){let n=s.body.getReader(),i=[],a=!1,o;if(r["transfer-encoding"]!=="chunked"){let c=2;for(let l=0;l<c;l++){o||=n.read();let u=await ry(o).catch(f=>{console.error(f),a=!0});if(!u){if(l===1){await new Promise(f=>setTimeout(f)),c=3;continue}break}if(o=void 0,u.value&&i.push(u.value),u.done){a=!0;break}}a&&!("content-length"in r)&&(r["content-length"]=i.reduce((l,u)=>l+u.length,0))}e.writeHead(s.status,r),i.forEach(c=>{e.write(c)}),a?e.end():(i.length===0&&Al(e),await Sl(n,e,o))}else r[iy]||(e.writeHead(s.status,r),e.end());e[Ii]?.()},dy=(s,e={})=>{let t=e.autoCleanupIncoming??!0;return e.overrideGlobalObjects!==!1&&global.Request!==ds&&(Object.defineProperty(global,"Request",{value:ds}),Object.defineProperty(global,"Response",{value:hs})),async(r,n)=>{let i,a;try{a=sy(r,e.hostname);let o=!t||r.method==="GET"||r.method==="HEAD";if(o||(r[wl]=!0,r.on("end",()=>{o=!0}),r instanceof bl&&(n[Ii]=()=>{o||setTimeout(()=>{o||setTimeout(()=>{Oi(r)})})}),n.on("finish",()=>{o||Oi(r)})),n.on("close",()=>{a[Et]&&(r.errored?a[Et].abort(r.errored.toString()):n.writableFinished||a[Et].abort("Client connection prematurely closed.")),o||setTimeout(()=>{o||setTimeout(()=>{Oi(r)})})}),i=s(a,{incoming:r,outgoing:n}),rt in i)return El(i,n)}catch(o){if(i)return Ni(o,n);if(e.errorHandler){if(i=await e.errorHandler(a?o:Zm(o)),!i)return}else a?i=kl(o):i=ly()}try{return await fy(i,n,e)}catch(o){return Ni(o,n)}}},hy=s=>{let e=s.fetch,t=dy(e,{hostname:s.hostname,overrideGlobalObjects:s.overrideGlobalObjects,autoCleanupIncoming:s.autoCleanupIncoming});return(s.createServer||Jm)(s.serverOptions||{},t)},Tl=(s,e)=>{let t=hy(s);return t.listen(s?.port??3e3,s.hostname,()=>{let r=t.address();e&&e(r)}),t};var py=`
|
|
13
151
|
@keepdb/cc - Anthropic API \u4EE3\u7406\u670D\u52A1
|
|
14
152
|
|
|
15
153
|
Usage:
|
|
@@ -24,4 +162,4 @@ Examples:
|
|
|
24
162
|
keepdb-cc start
|
|
25
163
|
keepdb-cc start --port 8080
|
|
26
164
|
keepdb-cc start --config /path/to/ismartify.config.yaml
|
|
27
|
-
`.trim(),
|
|
165
|
+
`.trim(),Ol=s=>s&&!s.startsWith("-"),my=s=>{let e=s.slice(2),t={command:null,config:null,port:null};for(let r=0;r<e.length;r++){let n=e[r];if(n==="--config"&&Ol(e[r+1]))t.config=e[++r];else if(n==="--port"&&Ol(e[r+1])){let i=Number(e[++r]);(!Number.isFinite(i)||i<1||i>65535)&&(console.error(`\u65E0\u6548\u7AEF\u53E3\u53F7: ${e[r]}`),process.exit(1)),t.port=i}else!n.startsWith("-")&&!t.command&&(t.command=n)}return t},yy=()=>{let{command:s,config:e,port:t}=my(process.argv);s!=="start"&&(console.log(py),process.exit(s?1:0));let r;try{r=Mc(e)}catch(i){console.error(`\u914D\u7F6E\u52A0\u8F7D\u5931\u8D25: ${i.message}`),process.exit(1)}let n=ml(r);Tl({fetch:n.fetch,port:t||6110},i=>{console.log(`@keepdb/cc \u4EE3\u7406\u670D\u52A1\u5DF2\u542F\u52A8: http://localhost:${i.port}`)})};yy();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keepdb/cc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Anthropic API 代理 - 按模型档位路由、权重负载均衡、故障转移",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,16 +9,15 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/"
|
|
11
11
|
],
|
|
12
|
-
"dependencies": {
|
|
12
|
+
"dependencies": {},
|
|
13
|
+
"devDependencies": {
|
|
13
14
|
"@hono/node-server": "^1.14.0",
|
|
14
|
-
"@keepdb/kit": "^0.4.22",
|
|
15
15
|
"hono": "^4.12.9",
|
|
16
|
-
"zod": "^3.24.0"
|
|
17
|
-
},
|
|
18
|
-
"devDependencies": {
|
|
19
16
|
"tsup": "^8.4.0",
|
|
20
17
|
"typescript": "^6.0.2",
|
|
21
|
-
"vitest": "^4.1.1"
|
|
18
|
+
"vitest": "^4.1.1",
|
|
19
|
+
"yaml": "^2.8.3",
|
|
20
|
+
"zod": "^3.24.0"
|
|
22
21
|
},
|
|
23
22
|
"scripts": {
|
|
24
23
|
"build": "tsup",
|