@keepdb/cc 0.1.7 → 0.1.8
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 Cl=Object.getOwnPropertyDescriptor;var Il=Object.getOwnPropertyNames;var Ll=Object.getPrototypeOf,Rl=Object.prototype.hasOwnProperty;var ms=(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 _=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),ql=(s,e)=>{for(var t in e)xr(s,t,{get:e[t],enumerable:!0})},Pl=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Il(e))!Rl.call(s,n)&&n!==t&&xr(s,n,{get:()=>e[n],enumerable:!(r=Cl(e,n))||r.enumerable});return s};var Ml=(s,e,t)=>(t=s!=null?xl(Ll(s)):{},Pl(e||!s||!s.__esModule?xr(t,"default",{value:s,enumerable:!0}):t,s));var P=_(H=>{"use strict";var Rr=Symbol.for("yaml.alias"),Vi=Symbol.for("yaml.document"),_s=Symbol.for("yaml.map"),Hi=Symbol.for("yaml.pair"),qr=Symbol.for("yaml.scalar"),Ss=Symbol.for("yaml.seq"),me=Symbol.for("yaml.node.type"),Ju=s=>!!s&&typeof s=="object"&&s[me]===Rr,Wu=s=>!!s&&typeof s=="object"&&s[me]===Vi,Zu=s=>!!s&&typeof s=="object"&&s[me]===_s,zu=s=>!!s&&typeof s=="object"&&s[me]===Hi,Yi=s=>!!s&&typeof s=="object"&&s[me]===qr,Gu=s=>!!s&&typeof s=="object"&&s[me]===Ss;function Ji(s){if(s&&typeof s=="object")switch(s[me]){case _s:case Ss:return!0}return!1}function Qu(s){if(s&&typeof s=="object")switch(s[me]){case Rr:case _s:case qr:case Ss:return!0}return!1}var Xu=s=>(Yi(s)||Ji(s))&&!!s.anchor;H.ALIAS=Rr;H.DOC=Vi;H.MAP=_s;H.NODE_TYPE=me;H.PAIR=Hi;H.SCALAR=qr;H.SEQ=Ss;H.hasAnchor=Xu;H.isAlias=Ju;H.isCollection=Ji;H.isDocument=Wu;H.isMap=Zu;H.isNode=Qu;H.isPair=zu;H.isScalar=Yi;H.isSeq=Gu});var Lt=_(Pr=>{"use strict";var K=P(),z=Symbol("break visit"),Wi=Symbol("skip children"),le=Symbol("remove node");function ks(s,e){let t=Zi(e);K.isDocument(s)?ht(null,s.contents,t,Object.freeze([s]))===le&&(s.contents=null):ht(null,s,t,Object.freeze([]))}ks.BREAK=z;ks.SKIP=Wi;ks.REMOVE=le;function ht(s,e,t,r){let n=zi(s,e,t,r);if(K.isNode(n)||K.isPair(n))return Gi(s,r,n),ht(s,n,t,r);if(typeof n!="symbol"){if(K.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let a=ht(i,e.items[i],t,r);if(typeof a=="number")i=a-1;else{if(a===z)return z;a===le&&(e.items.splice(i,1),i-=1)}}}else if(K.isPair(e)){r=Object.freeze(r.concat(e));let i=ht("key",e.key,t,r);if(i===z)return z;i===le&&(e.key=null);let a=ht("value",e.value,t,r);if(a===z)return z;a===le&&(e.value=null)}}return n}async function As(s,e){let t=Zi(e);K.isDocument(s)?await pt(null,s.contents,t,Object.freeze([s]))===le&&(s.contents=null):await pt(null,s,t,Object.freeze([]))}As.BREAK=z;As.SKIP=Wi;As.REMOVE=le;async function pt(s,e,t,r){let n=await zi(s,e,t,r);if(K.isNode(n)||K.isPair(n))return Gi(s,r,n),pt(s,n,t,r);if(typeof n!="symbol"){if(K.isCollection(e)){r=Object.freeze(r.concat(e));for(let i=0;i<e.items.length;++i){let a=await pt(i,e.items[i],t,r);if(typeof a=="number")i=a-1;else{if(a===z)return z;a===le&&(e.items.splice(i,1),i-=1)}}}else if(K.isPair(e)){r=Object.freeze(r.concat(e));let i=await pt("key",e.key,t,r);if(i===z)return z;i===le&&(e.key=null);let a=await pt("value",e.value,t,r);if(a===z)return z;a===le&&(e.value=null)}}return n}function Zi(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){var n,i,a,o,c;if(typeof t=="function")return t(s,e,r);if(K.isMap(e))return(n=t.Map)==null?void 0:n.call(t,s,e,r);if(K.isSeq(e))return(i=t.Seq)==null?void 0:i.call(t,s,e,r);if(K.isPair(e))return(a=t.Pair)==null?void 0:a.call(t,s,e,r);if(K.isScalar(e))return(o=t.Scalar)==null?void 0:o.call(t,s,e,r);if(K.isAlias(e))return(c=t.Alias)==null?void 0:c.call(t,s,e,r)}function Gi(s,e,t){let r=e[e.length-1];if(K.isCollection(r))r.items[s]=t;else if(K.isPair(r))s==="key"?r.key=t:r.value=t;else if(K.isDocument(r))r.contents=t;else{let n=K.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}Pr.visit=ks;Pr.visitAsync=As});var Mr=_(Xi=>{"use strict";var Qi=P(),ef=Lt(),tf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},sf=s=>s.replace(/[!,[\]{}]/g,e=>tf[e]),Rt=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+sf(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&&Qi.isNode(e.contents)){let i={};ef.visit(e.contents,(a,o)=>{Qi.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
|
+
`)}};Rt.defaultYaml={explicit:!1,version:"1.2"};Rt.defaultTags={"!!":"tag:yaml.org,2002:"};Xi.Directives=Rt});var Es=_(qt=>{"use strict";var ea=P(),rf=Lt();function nf(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 ta(s){let e=new Set;return rf.visit(s,{Value(t,r){r.anchor&&e.add(r.anchor)}}),e}function sa(s,e){for(let t=1;;++t){let r=`${s}${t}`;if(!e.has(r))return r}}function af(s,e){let t=[],r=new Map,n=null;return{onAnchor:i=>{t.push(i),n??(n=ta(s));let a=sa(e,n);return n.add(a),a},setAnchors:()=>{for(let i of t){let a=r.get(i);if(typeof a=="object"&&a.anchor&&(ea.isScalar(a.node)||ea.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}}qt.anchorIsValid=nf;qt.anchorNames=ta;qt.createNodeAnchors=af;qt.findNewAnchor=sa});var $r=_(ra=>{"use strict";function Pt(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=Pt(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=Pt(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=Pt(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=Pt(s,r,n,i);a===void 0?delete r[n]:a!==i&&(r[n]=a)}return s.call(e,t,r)}ra.applyReviver=Pt});var _e=_(ia=>{"use strict";var of=P();function na(s,e,t){if(Array.isArray(s))return s.map((r,n)=>na(r,String(n),t));if(s&&typeof s.toJSON=="function"){if(!t||!of.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!=null&&t.keep)?Number(s):s}ia.toJS=na});var Ts=_(oa=>{"use strict";var cf=$r(),aa=P(),lf=_e(),jr=class{constructor(e){Object.defineProperty(this,aa.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(!aa.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=lf.toJS(this,"",a);if(typeof n=="function")for(let{count:c,res:l}of a.anchors.values())n(l,c);return typeof i=="function"?cf.applyReviver(i,{"":o},"",o):o}};oa.NodeBase=jr});var Mt=_(ca=>{"use strict";var uf=Es(),ff=Lt(),mt=P(),df=Ts(),hf=_e(),Dr=class extends df.NodeBase{constructor(e){super(mt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let r;t!=null&&t.aliasResolveCache?r=t.aliasResolveCache:(r=[],ff.visit(e,{Node:(i,a)=>{(mt.isAlias(a)||mt.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||(hf.toJS(a,null,t),o=r.get(a)),(o==null?void 0: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=Os(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(uf.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 Os(s,e,t){if(mt.isAlias(e)){let r=e.resolve(s),n=t&&r&&t.get(r);return n?n.count*n.aliasCount:0}else if(mt.isCollection(e)){let r=0;for(let n of e.items){let i=Os(s,n,t);i>r&&(r=i)}return r}else if(mt.isPair(e)){let r=Os(s,e.key,t),n=Os(s,e.value,t);return Math.max(r,n)}return 1}ca.Alias=Dr});var B=_(Br=>{"use strict";var pf=P(),mf=Ts(),yf=_e(),gf=s=>!s||typeof s!="function"&&typeof s!="object",Se=class extends mf.NodeBase{constructor(e){super(pf.SCALAR),this.value=e}toJSON(e,t){return t!=null&&t.keep?this.value:yf.toJS(this.value,e,t)}toString(){return String(this.value)}};Se.BLOCK_FOLDED="BLOCK_FOLDED";Se.BLOCK_LITERAL="BLOCK_LITERAL";Se.PLAIN="PLAIN";Se.QUOTE_DOUBLE="QUOTE_DOUBLE";Se.QUOTE_SINGLE="QUOTE_SINGLE";Br.Scalar=Se;Br.isScalarValue=gf});var $t=_(ua=>{"use strict";var vf=Mt(),We=P(),la=B(),bf="tag:yaml.org,2002:";function wf(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=>{var n;return((n=r.identify)==null?void 0:n.call(r,s))&&!r.format})}function _f(s,e,t){var f,d,h;if(We.isDocument(s)&&(s=s.contents),We.isNode(s))return s;if(We.isPair(s)){let g=(d=(f=t.schema[We.MAP]).createNode)==null?void 0:d.call(f,t.schema,null,t);return g.items.push(s),g}(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 vf.Alias(c.anchor);c={anchor:null,node:null},o.set(s,c)}e!=null&&e.startsWith("!!")&&(e=bf+e.slice(2));let l=wf(s,e,a.tags);if(!l){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let g=new la.Scalar(s);return c&&(c.node=g),g}l=s instanceof Map?a[We.MAP]:Symbol.iterator in Object(s)?a[We.SEQ]:a[We.MAP]}i&&(i(l),delete t.onTagObj);let u=l!=null&&l.createNode?l.createNode(t.schema,s,t):typeof((h=l==null?void 0:l.nodeClass)==null?void 0:h.from)=="function"?l.nodeClass.from(t.schema,s,t):new la.Scalar(s);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}ua.createNode=_f});var xs=_(Ns=>{"use strict";var Sf=$t(),ue=P(),kf=Ts();function Fr(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 Sf.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 fa=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,Kr=class extends kf.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=>ue.isNode(r)||ue.isPair(r)?r.clone(e):r),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(fa(e))this.add(t);else{let[r,...n]=e,i=this.get(r,!0);if(ue.isCollection(i))i.addIn(n,t);else if(i===void 0&&this.schema)this.set(r,Fr(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(ue.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&&ue.isScalar(i)?i.value:i:ue.isCollection(i)?i.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!ue.isPair(t))return!1;let r=t.value;return r==null||e&&ue.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 ue.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(ue.isCollection(i))i.setIn(n,t);else if(i===void 0&&this.schema)this.set(r,Fr(this.schema,n,t));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}};Ns.Collection=Kr;Ns.collectionFromPath=Fr;Ns.isEmptyPath=fa});var jt=_(Cs=>{"use strict";var Af=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Ur(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var Ef=(s,e,t)=>s.endsWith(`
|
|
4
|
+
`)?Ur(t,e):t.includes(`
|
|
5
|
+
`)?`
|
|
6
|
+
`+Ur(t,e):(s.endsWith(" ")?"":" ")+t;Cs.indentComment=Ur;Cs.lineComment=Ef;Cs.stringifyComment=Af});var ha=_(Dt=>{"use strict";var Tf="flow",Vr="block",Is="quoted";function Of(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,h,g=!1,p=-1,m=-1,v=-1;t===Vr&&(p=da(s,p,e.length),p!==-1&&(f=p+c));for(let E;E=s[p+=1];){if(t===Is&&E==="\\"){switch(m=p,s[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}v=p}if(E===`
|
|
7
|
+
`)t===Vr&&(p=da(s,p,e.length)),f=p+e.length+c,d=void 0;else{if(E===" "&&h&&h!==" "&&h!==`
|
|
8
|
+
`&&h!==" "){let A=s[p+1];A&&A!==" "&&A!==`
|
|
9
|
+
`&&A!==" "&&(d=p)}if(p>=f)if(d)l.push(d),f=d+c,d=void 0;else if(t===Is){for(;h===" "||h===" ";)h=E,E=s[p+=1],g=!0;let A=p>v+1?p-2:m-1;if(u[A])return s;l.push(A),u[A]=!0,f=A+c,d=void 0}else g=!0}h=E}if(g&&o&&o(),l.length===0)return s;a&&a();let w=s.slice(0,l[0]);for(let E=0;E<l.length;++E){let A=l[E],x=l[E+1]||s.length;A===0?w=`
|
|
10
|
+
${e}${s.slice(0,x)}`:(t===Is&&u[A]&&(w+=`${s[A]}\\`),w+=`
|
|
11
|
+
${e}${s.slice(A+1,x)}`)}return w}function da(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}Dt.FOLD_BLOCK=Vr;Dt.FOLD_FLOW=Tf;Dt.FOLD_QUOTED=Is;Dt.foldFlowLines=Of});var Ft=_(pa=>{"use strict";var ne=B(),ke=ha(),Rs=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),qs=s=>/^(%|---|\.\.\.)/m.test(s);function Nf(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 Bt(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:r}=e,n=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(qs(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:ke.foldFlowLines(a,i,ke.FOLD_QUOTED,Rs(e,!1))}function Hr(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test(s))return Bt(s,e);let t=e.indent||(qs(s)?" ":""),r="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${t}`)+"'";return e.implicitKey?r:ke.foldFlowLines(r,t,ke.FOLD_FLOW,Rs(e,!1))}function yt(s,e){let{singleQuote:t}=e.options,r;if(t===!1)r=Bt;else{let n=s.includes('"'),i=s.includes("'");n&&!i?r=Hr:i&&!n?r=Bt:r=t?Hr:Bt}return r(s,e)}var Yr;try{Yr=new RegExp(`(^|(?<!
|
|
19
|
+
))
|
|
20
|
+
+(?!
|
|
21
|
+
|$)`,"g")}catch{Yr=/\n+(?!\n|$)/g}function Ls({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 yt(t,r);let l=r.indent||(r.forceBlockIndent||qs(t)?" ":""),u=a==="literal"?!0:a==="folded"||e===ne.Scalar.BLOCK_FOLDED?!1:e===ne.Scalar.BLOCK_LITERAL?!0:!Nf(t,c,l.length);if(!t)return u?`|
|
|
22
|
+
`:`>
|
|
23
|
+
`;let f,d;for(d=t.length;d>0;--d){let x=t[d-1];if(x!==`
|
|
24
|
+
`&&x!==" "&&x!==" ")break}let h=t.substring(d),g=h.indexOf(`
|
|
25
|
+
`);g===-1?f="-":t===h||g!==h.length-1?(f="+",i&&i()):f="",h&&(t=t.slice(0,-h.length),h[h.length-1]===`
|
|
26
|
+
`&&(h=h.slice(0,-1)),h=h.replace(Yr,`$&${l}`));let p=!1,m,v=-1;for(m=0;m<t.length;++m){let x=t[m];if(x===" ")p=!0;else if(x===`
|
|
27
|
+
`)v=m;else break}let w=t.substring(0,v<m?v+1:m);w&&(t=t.substring(w.length),w=w.replace(/\n+/g,`$&${l}`));let A=(p?l?"2":"1":"")+f;if(s&&(A+=" "+o(s.replace(/ ?[\r\n]+/g," ")),n&&n()),!u){let x=t.replace(/\n+/g,`
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),q=!1,O=Rs(r,!0);a!=="folded"&&e!==ne.Scalar.BLOCK_FOLDED&&(O.onOverflow=()=>{q=!0});let T=ke.foldFlowLines(`${w}${x}${h}`,l,ke.FOLD_BLOCK,O);if(!q)return`>${A}
|
|
29
|
+
${l}${T}`}return t=t.replace(/\n+/g,`$&${l}`),`|${A}
|
|
30
|
+
${l}${w}${t}${h}`}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 yt(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return o||u||!i.includes(`
|
|
32
|
+
`)?yt(i,e):Ls(s,e,t,r);if(!o&&!u&&n!==ne.Scalar.PLAIN&&i.includes(`
|
|
33
|
+
`))return Ls(s,e,t,r);if(qs(i)){if(c==="")return e.forceBlockIndent=!0,Ls(s,e,t,r);if(o&&c===l)return yt(i,e)}let f=i.replace(/\n+/g,`$&
|
|
34
|
+
${c}`);if(a){let d=p=>{var m;return p.default&&p.tag!=="tag:yaml.org,2002:str"&&((m=p.test)==null?void 0:m.test(f))},{compat:h,tags:g}=e.doc.schema;if(g.some(d)||h!=null&&h.some(d))return yt(i,e)}return o?f:ke.foldFlowLines(f,c,ke.FOLD_FLOW,Rs(e,!1))}function Cf(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!==ne.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=ne.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ne.Scalar.BLOCK_FOLDED:case ne.Scalar.BLOCK_LITERAL:return n||i?yt(a.value,e):Ls(a,e,t,r);case ne.Scalar.QUOTE_DOUBLE:return Bt(a.value,e);case ne.Scalar.QUOTE_SINGLE:return Hr(a.value,e);case ne.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}pa.stringifyString=Cf});var Kt=_(Jr=>{"use strict";var If=Es(),Ae=P(),Lf=jt(),Rf=Ft();function qf(s,e){let t=Object.assign({blockQuote:!0,commentString:Lf.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 Pf(s,e){var n;if(e.tag){let i=s.filter(a=>a.tag===e.tag);if(i.length>0)return i.find(a=>a.format===e.format)??i[0]}let t,r;if(Ae.isScalar(e)){r=e.value;let i=s.filter(a=>{var o;return(o=a.identify)==null?void 0:o.call(a,r)});if(i.length>1){let a=i.filter(o=>o.test);a.length>0&&(i=a)}t=i.find(a=>a.format===e.format)??i.find(a=>!a.format)}else r=e,t=s.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!t){let i=((n=r==null?void 0:r.constructor)==null?void 0:n.name)??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return t}function Mf(s,e,{anchors:t,doc:r}){if(!r.directives)return"";let n=[],i=(Ae.isScalar(s)||Ae.isCollection(s))&&s.anchor;i&&If.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 $f(s,e,t,r){var c;if(Ae.isPair(s))return s.toString(e,t,r);if(Ae.isAlias(s)){if(e.doc.directives)return s.toString(e);if((c=e.resolvedAliases)!=null&&c.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=Ae.isNode(s)?s:e.doc.createNode(s,{onTagObj:l=>n=l});n??(n=Pf(e.doc.schema.tags,i));let a=Mf(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):Ae.isScalar(i)?Rf.stringifyString(i,e,t,r):i.toString(e,t,r);return a?Ae.isScalar(i)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a}
|
|
35
|
+
${e.indent}${o}`:o}Jr.createStringifyContext=qf;Jr.stringify=$f});var va=_(ga=>{"use strict";var ye=P(),ma=B(),ya=Kt(),Ut=jt();function jf({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=ye.isNode(s)&&s.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ye.isCollection(s)||!ye.isNode(s)&&typeof s=="object"){let O="With simple keys, collection cannot be used as a key value";throw new Error(O)}}let h=!f&&(!s||d&&e==null&&!t.inFlow||ye.isCollection(s)||(ye.isScalar(s)?s.type===ma.Scalar.BLOCK_FOLDED||s.type===ma.Scalar.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!h&&(f||!i),indent:o+c});let g=!1,p=!1,m=ya.stringify(s,t,()=>g=!0,()=>p=!0);if(!h&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(t.inFlow){if(i||e==null)return g&&r&&r(),m===""?"?":h?`? ${m}`:m}else if(i&&!f||e==null&&h)return m=`? ${m}`,d&&!g?m+=Ut.lineComment(m,t.indent,l(d)):p&&n&&n(),m;g&&(d=null),h?(d&&(m+=Ut.lineComment(m,t.indent,l(d))),m=`? ${m}
|
|
36
|
+
${o}:`):(m=`${m}:`,d&&(m+=Ut.lineComment(m,t.indent,l(d))));let v,w,E;ye.isNode(e)?(v=!!e.spaceBefore,w=e.commentBefore,E=e.comment):(v=!1,w=null,E=null,e&&typeof e=="object"&&(e=a.createNode(e))),t.implicitKey=!1,!h&&!d&&ye.isScalar(e)&&(t.indentAtStart=m.length+1),p=!1,!u&&c.length>=2&&!t.inFlow&&!h&&ye.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let A=!1,x=ya.stringify(e,t,()=>A=!0,()=>p=!0),q=" ";if(d||v||w){if(q=v?`
|
|
37
|
+
`:"",w){let O=l(w);q+=`
|
|
38
|
+
${Ut.indentComment(O,t.indent)}`}x===""&&!t.inFlow?q===`
|
|
39
|
+
`&&E&&(q=`
|
|
40
|
+
|
|
41
|
+
`):q+=`
|
|
42
|
+
${t.indent}`}else if(!h&&ye.isCollection(e)){let O=x[0],T=x.indexOf(`
|
|
43
|
+
`),$=T!==-1,D=t.inFlow??e.flow??e.items.length===0;if($||!D){let F=!1;if($&&(O==="&"||O==="!")){let U=x.indexOf(" ");O==="&"&&U!==-1&&U<T&&x[U+1]==="!"&&(U=x.indexOf(" ",U+1)),(U===-1||T<U)&&(F=!0)}F||(q=`
|
|
44
|
+
${t.indent}`)}}else(x===""||x[0]===`
|
|
45
|
+
`)&&(q="");return m+=q+x,t.inFlow?A&&r&&r():E&&!A?m+=Ut.lineComment(m,t.indent,l(E)):p&&n&&n(),m}ga.stringifyPair=jf});var Zr=_(Wr=>{"use strict";var ba=ms("process");function Df(s,...e){s==="debug"&&console.log(...e)}function Bf(s,e){(s==="debug"||s==="warn")&&(typeof ba.emitWarning=="function"?ba.emitWarning(e):console.warn(e))}Wr.debug=Df;Wr.warn=Bf});var js=_($s=>{"use strict";var Vt=P(),wa=B(),Ps="<<",Ms={identify:s=>s===Ps||typeof s=="symbol"&&s.description===Ps,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new wa.Scalar(Symbol(Ps)),{addToJSMap:_a}),stringify:()=>Ps},Ff=(s,e)=>(Ms.identify(e)||Vt.isScalar(e)&&(!e.type||e.type===wa.Scalar.PLAIN)&&Ms.identify(e.value))&&(s==null?void 0:s.doc.schema.tags.some(t=>t.tag===Ms.tag&&t.default));function _a(s,e,t){if(t=s&&Vt.isAlias(t)?t.resolve(s.doc):t,Vt.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&&Vt.isAlias(t)?t.resolve(s.doc):t;if(!Vt.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}$s.addMergeToJSMap=_a;$s.isMergeKey=Ff;$s.merge=Ms});var Qr=_(Aa=>{"use strict";var Kf=Zr(),Sa=js(),Uf=Kt(),ka=P(),Gr=_e();function Vf(s,e,{key:t,value:r}){if(ka.isNode(t)&&t.addToJSMap)t.addToJSMap(s,e,r);else if(Sa.isMergeKey(s,t))Sa.addMergeToJSMap(s,e,r);else{let n=Gr.toJS(t,"",s);if(e instanceof Map)e.set(n,Gr.toJS(r,n,s));else if(e instanceof Set)e.add(n);else{let i=Hf(t,n,s),a=Gr.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 Hf(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(ka.isNode(s)&&(t!=null&&t.doc)){let r=Uf.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)+'..."'),Kf.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)}Aa.addPairToJSMap=Vf});var Ee=_(Xr=>{"use strict";var Ea=$t(),Yf=va(),Jf=Qr(),Ds=P();function Wf(s,e,t){let r=Ea.createNode(s,void 0,t),n=Ea.createNode(e,void 0,t);return new Bs(r,n)}var Bs=class s{constructor(e,t=null){Object.defineProperty(this,Ds.NODE_TYPE,{value:Ds.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:r}=this;return Ds.isNode(t)&&(t=t.clone(e)),Ds.isNode(r)&&(r=r.clone(e)),new s(t,r)}toJSON(e,t){let r=t!=null&&t.mapAsMap?new Map:{};return Jf.addPairToJSMap(t,r,this)}toString(e,t,r){return e!=null&&e.doc?Yf.stringifyPair(this,e,t,r):JSON.stringify(this)}};Xr.Pair=Bs;Xr.createPair=Wf});var en=_(Oa=>{"use strict";var Ze=P(),Ta=Kt(),Fs=jt();function Zf(s,e,t){return(e.inFlow??s.flow?Gf: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 p=e[g],m=null;if(Ze.isNode(p))!f&&p.spaceBefore&&d.push(""),Ks(t,d,p.commentBefore,f),p.comment&&(m=p.comment);else if(Ze.isPair(p)){let w=Ze.isNode(p.key)?p.key:null;w&&(!f&&w.spaceBefore&&d.push(""),Ks(t,d,w.commentBefore,f))}f=!1;let v=Ta.stringify(p,u,()=>m=null,()=>f=!0);m&&(v+=Fs.lineComment(v,i,l(m))),f&&m&&(f=!1),d.push(r+v)}let h;if(d.length===0)h=n.start+n.end;else{h=d[0];for(let g=1;g<d.length;++g){let p=d[g];h+=p?`
|
|
46
|
+
${c}${p}`:`
|
|
47
|
+
`}}return s?(h+=`
|
|
48
|
+
`+Fs.indentComment(l(s),c),o&&o()):f&&a&&a(),h}function Gf({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 p=s[g],m=null;if(Ze.isNode(p))p.spaceBefore&&f.push(""),Ks(e,f,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Ze.isPair(p)){let w=Ze.isNode(p.key)?p.key:null;w&&(w.spaceBefore&&f.push(""),Ks(e,f,w.commentBefore,!1),w.comment&&(l=!0));let E=Ze.isNode(p.value)?p.value:null;E?(E.comment&&(m=E.comment),E.commentBefore&&(l=!0)):p.value==null&&(w!=null&&w.comment)&&(m=w.comment)}m&&(l=!0);let v=Ta.stringify(p,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((w,E)=>w+E.length+2,2)+(v.length+2)>e.options.lineWidth)),l&&(v+=",")),m&&(v+=Fs.lineComment(v,r,o(m))),f.push(v),u=f.length}let{start:d,end:h}=t;if(f.length===0)return d+h;if(!l){let g=f.reduce((p,m)=>p+m.length+2,2);l=e.options.lineWidth>0&&g>e.options.lineWidth}if(l){let g=d;for(let p of f)g+=p?`
|
|
50
|
+
${i}${n}${p}`:`
|
|
51
|
+
`;return`${g}
|
|
52
|
+
${n}${h}`}else return`${d}${a}${f.join(" ")}${a}${h}`}function Ks({indent:s,options:{commentString:e}},t,r,n){if(r&&n&&(r=r.replace(/^\n+/,"")),r){let i=Fs.indentComment(e(r),s);t.push(i.trimStart())}}Oa.stringifyCollection=Zf});var Oe=_(sn=>{"use strict";var Qf=en(),Xf=Qr(),ed=xs(),Te=P(),Us=Ee(),td=B();function Ht(s,e){let t=Te.isScalar(e)?e.value:e;for(let r of s)if(Te.isPair(r)&&(r.key===e||r.key===t||Te.isScalar(r.key)&&r.key.value===t))return r}var tn=class extends ed.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Te.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(Us.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){var a;let r;Te.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Us.Pair(e,e==null?void 0:e.value):r=new Us.Pair(e.key,e.value);let n=Ht(this.items,r.key),i=(a=this.schema)==null?void 0:a.sortMapEntries;if(n){if(!t)throw new Error(`Key ${r.key} already set`);Te.isScalar(n.value)&&td.isScalarValue(r.value)?n.value.value=r.value:n.value=r.value}else if(i){let o=this.items.findIndex(c=>i(r,c)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let t=Ht(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let r=Ht(this.items,e),n=r==null?void 0:r.value;return(!t&&Te.isScalar(n)?n.value:n)??void 0}has(e){return!!Ht(this.items,e)}set(e,t){this.add(new Us.Pair(e,t),!0)}toJSON(e,t,r){let n=r?new r:t!=null&&t.mapAsMap?new Map:{};t!=null&&t.onCreate&&t.onCreate(n);for(let i of this.items)Xf.addPairToJSMap(t,n,i);return n}toString(e,t,r){if(!e)return JSON.stringify(this);for(let n of this.items)if(!Te.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})),Qf.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}};sn.YAMLMap=tn;sn.findPair=Ht});var gt=_(xa=>{"use strict";var sd=P(),Na=Oe(),rd={collection:"map",default:!0,nodeClass:Na.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(s,e){return sd.isMap(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>Na.YAMLMap.from(s,e,t)};xa.map=rd});var Ne=_(Ca=>{"use strict";var nd=$t(),id=en(),ad=xs(),Hs=P(),od=B(),cd=_e(),rn=class extends ad.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Hs.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Vs(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let r=Vs(e);if(typeof r!="number")return;let n=this.items[r];return!t&&Hs.isScalar(n)?n.value:n}has(e){let t=Vs(e);return typeof t=="number"&&t<this.items.length}set(e,t){let r=Vs(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[r];Hs.isScalar(n)&&od.isScalarValue(t)?n.value=t:this.items[r]=t}toJSON(e,t){let r=[];t!=null&&t.onCreate&&t.onCreate(r);let n=0;for(let i of this.items)r.push(cd.toJS(i,String(n++),t));return r}toString(e,t,r){return e?id.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(nd.createNode(o,void 0,r))}}return i}};function Vs(s){let e=Hs.isScalar(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Ca.YAMLSeq=rn});var vt=_(La=>{"use strict";var ld=P(),Ia=Ne(),ud={collection:"seq",default:!0,nodeClass:Ia.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(s,e){return ld.isSeq(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>Ia.YAMLSeq.from(s,e,t)};La.seq=ud});var Yt=_(Ra=>{"use strict";var fd=Ft(),dd={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),fd.stringifyString(s,e,t,r)}};Ra.string=dd});var Ys=_(Ma=>{"use strict";var qa=B(),Pa={identify:s=>s==null,createNode:()=>new qa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new qa.Scalar(null),stringify:({source:s},e)=>typeof s=="string"&&Pa.test.test(s)?s:e.options.nullStr};Ma.nullTag=Pa});var nn=_(ja=>{"use strict";var hd=B(),$a={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new hd.Scalar(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&$a.test.test(s)){let r=s[0]==="t"||s[0]==="T";if(e===r)return s}return e?t.options.trueStr:t.options.falseStr}};ja.boolTag=$a});var bt=_(Da=>{"use strict";function pd({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}Da.stringifyNumber=pd});var on=_(Js=>{"use strict";var md=B(),an=bt(),yd={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:an.stringifyNumber},gd={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():an.stringifyNumber(s)}},vd={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 md.Scalar(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:an.stringifyNumber};Js.float=vd;Js.floatExp=gd;Js.floatNaN=yd});var ln=_(Zs=>{"use strict";var Ba=bt(),Ws=s=>typeof s=="bigint"||Number.isInteger(s),cn=(s,e,t,{intAsBigInt:r})=>r?BigInt(s):parseInt(s.substring(e),t);function Fa(s,e,t){let{value:r}=s;return Ws(r)&&r>=0?t+r.toString(e):Ba.stringifyNumber(s)}var bd={identify:s=>Ws(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>cn(s,2,8,t),stringify:s=>Fa(s,8,"0o")},wd={identify:Ws,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>cn(s,0,10,t),stringify:Ba.stringifyNumber},_d={identify:s=>Ws(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>cn(s,2,16,t),stringify:s=>Fa(s,16,"0x")};Zs.int=wd;Zs.intHex=_d;Zs.intOct=bd});var Ua=_(Ka=>{"use strict";var Sd=gt(),kd=Ys(),Ad=vt(),Ed=Yt(),Td=nn(),un=on(),fn=ln(),Od=[Sd.map,Ad.seq,Ed.string,kd.nullTag,Td.boolTag,fn.intOct,fn.int,fn.intHex,un.floatNaN,un.floatExp,un.float];Ka.schema=Od});var Ya=_(Ha=>{"use strict";var Nd=B(),xd=gt(),Cd=vt();function Va(s){return typeof s=="bigint"||Number.isInteger(s)}var zs=({value:s})=>JSON.stringify(s),Id=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:zs},{identify:s=>s==null,createNode:()=>new Nd.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:Va,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})=>Va(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}],Ld={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Rd=[xd.map,Cd.seq].concat(Id,Ld);Ha.schema=Rd});var hn=_(Ja=>{"use strict";var Jt=ms("buffer"),dn=B(),qd=Ft(),Pd={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof Jt.Buffer=="function")return Jt.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 Jt.Buffer=="function")o=a instanceof Jt.Buffer?a.toString("base64"):Jt.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=dn.Scalar.BLOCK_LITERAL),e!==dn.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===dn.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return qd.stringifyString({comment:s,type:e,value:o},r,n,i)}};Ja.binary=Pd});var Xs=_(Qs=>{"use strict";var Gs=P(),pn=Ee(),Md=B(),$d=Ne();function Wa(s,e){if(Gs.isSeq(s))for(let t=0;t<s.items.length;++t){let r=s.items[t];if(!Gs.isPair(r)){if(Gs.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let n=r.items[0]||new pn.Pair(new Md.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]=Gs.isPair(r)?r:new pn.Pair(r)}}else e("Expected a sequence for this tag");return s}function Za(s,e,t){let{replacer:r}=t,n=new $d.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(pn.createPair(o,c,t))}return n}var jd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Wa,createNode:Za};Qs.createPairs=Za;Qs.pairs=jd;Qs.resolvePairs=Wa});var gn=_(yn=>{"use strict";var za=P(),mn=_e(),Wt=Oe(),Dd=Ne(),Ga=Xs(),ze=class s extends Dd.YAMLSeq{constructor(){super(),this.add=Wt.YAMLMap.prototype.add.bind(this),this.delete=Wt.YAMLMap.prototype.delete.bind(this),this.get=Wt.YAMLMap.prototype.get.bind(this),this.has=Wt.YAMLMap.prototype.has.bind(this),this.set=Wt.YAMLMap.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let r=new Map;t!=null&&t.onCreate&&t.onCreate(r);for(let n of this.items){let i,a;if(za.isPair(n)?(i=mn.toJS(n.key,"",t),a=mn.toJS(n.value,i,t)):i=mn.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=Ga.createPairs(e,t,r),i=new this;return i.items=n.items,i}};ze.tag="tag:yaml.org,2002:omap";var Bd={collection:"seq",identify:s=>s instanceof Map,nodeClass:ze,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=Ga.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)};yn.YAMLOMap=ze;yn.omap=Bd});var so=_(vn=>{"use strict";var Qa=B();function Xa({value:s,source:e},t){return e&&(s?eo:to).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var eo={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 Qa.Scalar(!0),stringify:Xa},to={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 Qa.Scalar(!1),stringify:Xa};vn.falseTag=to;vn.trueTag=eo});var ro=_(er=>{"use strict";var Fd=B(),bn=bt(),Kd={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:bn.stringifyNumber},Ud={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():bn.stringifyNumber(s)}},Vd={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 Fd.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:bn.stringifyNumber};er.float=Vd;er.floatExp=Ud;er.floatNaN=Kd});var io=_(zt=>{"use strict";var no=bt(),Zt=s=>typeof s=="bigint"||Number.isInteger(s);function tr(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 wn(s,e,t){let{value:r}=s;if(Zt(r)){let n=r.toString(e);return r<0?"-"+t+n.substr(1):t+n}return no.stringifyNumber(s)}var Hd={identify:Zt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>tr(s,2,2,t),stringify:s=>wn(s,2,"0b")},Yd={identify:Zt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>tr(s,1,8,t),stringify:s=>wn(s,8,"0")},Jd={identify:Zt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>tr(s,0,10,t),stringify:no.stringifyNumber},Wd={identify:Zt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>tr(s,2,16,t),stringify:s=>wn(s,16,"0x")};zt.int=Jd;zt.intBin=Hd;zt.intHex=Wd;zt.intOct=Yd});var Sn=_(_n=>{"use strict";var nr=P(),sr=Ee(),rr=Oe(),Ge=class s extends rr.YAMLMap{constructor(e){super(e),this.tag=s.tag}add(e){let t;nr.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new sr.Pair(e.key,null):t=new sr.Pair(e,null),rr.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let r=rr.findPair(this.items,e);return!t&&nr.isPair(r)?nr.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=rr.findPair(this.items,e);r&&!t?this.items.splice(this.items.indexOf(r),1):!r&&t&&this.items.push(new sr.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(sr.createPair(a,null,r));return i}};Ge.tag="tag:yaml.org,2002:set";var Zd={collection:"map",identify:s=>s instanceof Set,nodeClass:Ge,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>Ge.from(s,e,t),resolve(s,e){if(nr.isMap(s)){if(s.hasAllNullValues(!0))return Object.assign(new Ge,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};_n.YAMLSet=Ge;_n.set=Zd});var An=_(ir=>{"use strict";var zd=bt();function kn(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 ao(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 Gd={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})=>kn(s,t),stringify:ao},Qd={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=>kn(s,!1),stringify:ao},oo={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(oo.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=kn(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:s})=>(s==null?void 0:s.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""};ir.floatTime=Qd;ir.intTime=Gd;ir.timestamp=oo});var uo=_(lo=>{"use strict";var Xd=gt(),eh=Ys(),th=vt(),sh=Yt(),rh=hn(),co=so(),En=ro(),ar=io(),nh=js(),ih=gn(),ah=Xs(),oh=Sn(),Tn=An(),ch=[Xd.map,th.seq,sh.string,eh.nullTag,co.trueTag,co.falseTag,ar.intBin,ar.intOct,ar.int,ar.intHex,En.floatNaN,En.floatExp,En.float,rh.binary,nh.merge,ih.omap,ah.pairs,oh.set,Tn.intTime,Tn.floatTime,Tn.timestamp];lo.schema=ch});var _o=_(xn=>{"use strict";var mo=gt(),lh=Ys(),yo=vt(),uh=Yt(),fh=nn(),On=on(),Nn=ln(),dh=Ua(),hh=Ya(),go=hn(),Gt=js(),vo=gn(),bo=Xs(),fo=uo(),wo=Sn(),or=An(),ho=new Map([["core",dh.schema],["failsafe",[mo.map,yo.seq,uh.string]],["json",hh.schema],["yaml11",fo.schema],["yaml-1.1",fo.schema]]),po={binary:go.binary,bool:fh.boolTag,float:On.float,floatExp:On.floatExp,floatNaN:On.floatNaN,floatTime:or.floatTime,int:Nn.int,intHex:Nn.intHex,intOct:Nn.intOct,intTime:or.intTime,map:mo.map,merge:Gt.merge,null:lh.nullTag,omap:vo.omap,pairs:bo.pairs,seq:yo.seq,set:wo.set,timestamp:or.timestamp},ph={"tag:yaml.org,2002:binary":go.binary,"tag:yaml.org,2002:merge":Gt.merge,"tag:yaml.org,2002:omap":vo.omap,"tag:yaml.org,2002:pairs":bo.pairs,"tag:yaml.org,2002:set":wo.set,"tag:yaml.org,2002:timestamp":or.timestamp};function mh(s,e,t){let r=ho.get(e);if(r&&!s)return t&&!r.includes(Gt.merge)?r.concat(Gt.merge):r.slice();let n=r;if(!n)if(Array.isArray(s))n=[];else{let i=Array.from(ho.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(Gt.merge)),n.reduce((i,a)=>{let o=typeof a=="string"?po[a]:a;if(!o){let c=JSON.stringify(a),l=Object.keys(po).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=ph;xn.getTags=mh});var Ln=_(So=>{"use strict";var Cn=P(),yh=gt(),gh=vt(),vh=Yt(),cr=_o(),bh=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0,In=class s{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:n,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?cr.getTags(e,"compat"):e?cr.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=n?cr.coreKnownTags:{},this.tags=cr.getTags(t,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,Cn.MAP,{value:yh.map}),Object.defineProperty(this,Cn.SCALAR,{value:vh.string}),Object.defineProperty(this,Cn.SEQ,{value:gh.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?bh:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};So.Schema=In});var Ao=_(ko=>{"use strict";var wh=P(),Rn=Kt(),Qt=jt();function _h(s,e){var c;let t=[],r=e.directives===!0;if(e.directives!==!1&&s.directives){let l=s.directives.toString(s);l?(t.push(l),r=!0):s.directives.docStart&&(r=!0)}r&&t.push("---");let n=Rn.createStringifyContext(s,e),{commentString:i}=n.options;if(s.commentBefore){t.length!==1&&t.unshift("");let l=i(s.commentBefore);t.unshift(Qt.indentComment(l,""))}let a=!1,o=null;if(s.contents){if(wh.isNode(s.contents)){if(s.contents.spaceBefore&&r&&t.push(""),s.contents.commentBefore){let f=i(s.contents.commentBefore);t.push(Qt.indentComment(f,""))}n.forceBlockIndent=!!s.comment,o=s.contents.comment}let l=o?void 0:()=>a=!0,u=Rn.stringify(s.contents,n,()=>o=null,l);o&&(u+=Qt.lineComment(u,"",i(o))),(u[0]==="|"||u[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${u}`:t.push(u)}else t.push(Rn.stringify(s.contents,n));if((c=s.directives)!=null&&c.docEnd)if(s.comment){let l=i(s.comment);l.includes(`
|
|
56
|
+
`)?(t.push("..."),t.push(Qt.indentComment(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=s.comment;l&&a&&(l=l.replace(/^\n+/,"")),l&&((!a||o)&&t[t.length-1]!==""&&t.push(""),t.push(Qt.indentComment(i(l),"")))}return t.join(`
|
|
57
|
+
`)+`
|
|
58
|
+
`}ko.stringifyDocument=_h});var Xt=_(Eo=>{"use strict";var Sh=Mt(),wt=xs(),se=P(),kh=Ee(),Ah=_e(),Eh=Ln(),Th=Ao(),qn=Es(),Oh=$r(),Nh=$t(),Pn=Mr(),Mn=class s{constructor(e,t,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,se.NODE_TYPE,{value:se.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!=null&&r._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Pn.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,{[se.NODE_TYPE]:{value:se.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=se.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){_t(this.contents)&&this.contents.add(e)}addIn(e,t){_t(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let r=qn.anchorNames(this);e.anchor=!t||r.has(t)?qn.findNewAnchor(t||"a",r):t}return new Sh.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=w=>typeof w=="number"||w instanceof String||w 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:h}=qn.createNodeAnchors(this,a||"a"),g={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:h},p=Nh.createNode(e,u,g);return o&&se.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,t,r={}){let n=this.createNode(e,null,r),i=this.createNode(t,null,r);return new kh.Pair(n,i)}delete(e){return _t(this.contents)?this.contents.delete(e):!1}deleteIn(e){return wt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):_t(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return se.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return wt.isEmptyPath(e)?!t&&se.isScalar(this.contents)?this.contents.value:this.contents:se.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return se.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return wt.isEmptyPath(e)?this.contents!==void 0:se.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=wt.collectionFromPath(this.schema,[e],t):_t(this.contents)&&this.contents.set(e,t)}setIn(e,t){wt.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=wt.collectionFromPath(this.schema,Array.from(e),t):_t(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 Pn.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 Pn.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 Eh.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=Ah.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"?Oh.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 Th.stringifyDocument(this,e)}};function _t(s){if(se.isCollection(s))return!0;throw new Error("Expected a YAML collection as document contents")}Eo.Document=Mn});var ss=_(ts=>{"use strict";var es=class extends Error{constructor(e,t,r,n){super(),this.name=e,this.code=r,this.message=n,this.pos=t}},$n=class extends es{constructor(e,t,r){super("YAMLParseError",e,t,r)}},jn=class extends es{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==null?void 0: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
|
+
`}};ts.YAMLError=es;ts.YAMLParseError=$n;ts.YAMLWarning=jn;ts.prettifyError=xh});var rs=_(To=>{"use strict";function Ch(s,{flow:e,indicator:t,next:r,offset:n,onError:i,parentIndent:a,startOnNewline:o}){let c=!1,l=o,u=o,f="",d="",h=!1,g=!1,p=null,m=null,v=null,w=null,E=null,A=null,x=null;for(let T of s)switch(g&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&i(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),p&&(l&&T.type!=="comment"&&T.type!=="newline"&&i(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),T.type){case"space":!e&&(t!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&T.source.includes(" ")&&(p=T),u=!0;break;case"comment":{u||i(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let $=T.source.substring(1)||" ";f?f+=d+$:f=$,d="",l=!1;break}case"newline":l?f?f+=T.source:(!A||t!=="seq-item-ind")&&(c=!0):d+=T.source,l=!0,h=!0,(m||v)&&(w=T),u=!0;break;case"anchor":m&&i(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&i(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=T,x??(x=T.offset),l=!1,u=!1,g=!0;break;case"tag":{v&&i(T,"MULTIPLE_TAGS","A node can have at most one tag"),v=T,x??(x=T.offset),l=!1,u=!1,g=!0;break}case t:(m||v)&&i(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),A&&i(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${e??"collection"}`),A=T,l=t==="seq-item-ind"||t==="explicit-key-ind",u=!1;break;case"comma":if(e){E&&i(T,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),E=T,l=!1,u=!1;break}default:i(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),l=!1,u=!1}let q=s[s.length-1],O=q?q.offset+q.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"),p&&(l&&p.indent<=a||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&i(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:E,found:A,spaceBefore:c,comment:f,hasNewline:h,anchor:m,tag:v,newlineAfterProp:w,end:O,start:x??O}}To.resolveProps=Ch});var lr=_(Oo=>{"use strict";function Dn(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(Dn(e.key)||Dn(e.value))return!0}return!1;default:return!0}}Oo.containsNewline=Dn});var Bn=_(No=>{"use strict";var Ih=lr();function Lh(s,e,t){if((e==null?void 0:e.type)==="flow-collection"){let r=e.end[0];r.indent===s&&(r.source==="]"||r.source==="}")&&Ih.containsNewline(e)&&t(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}No.flowIndentCheck=Lh});var Fn=_(Co=>{"use strict";var xo=P();function Rh(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))}Co.mapIncludes=Rh});var Mo=_(Po=>{"use strict";var Io=Ee(),qh=Oe(),Lo=rs(),Ph=lr(),Ro=Bn(),Mh=Fn(),qo="All mapping items must start at the same column";function $h({composeNode:s,composeEmptyNode:e},t,r,n,i){var u;let a=(i==null?void 0:i.nodeClass)??qh.YAMLMap,o=new a(t.schema);t.atRoot&&(t.atRoot=!1);let c=r.offset,l=null;for(let f of r.items){let{start:d,key:h,sep:g,value:p}=f,m=Lo.resolveProps(d,{indicator:"explicit-key-ind",next:h??(g==null?void 0:g[0]),offset:c,onError:n,parentIndent:r.indent,startOnNewline:!0}),v=!m.found;if(v){if(h&&(h.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==r.indent&&n(c,"BAD_INDENT",qo)),!m.anchor&&!m.tag&&!g){l=m.end,m.comment&&(o.comment?o.comment+=`
|
|
65
|
+
`+m.comment:o.comment=m.comment);continue}(m.newlineAfterProp||Ph.containsNewline(h))&&n(h??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((u=m.found)==null?void 0:u.indent)!==r.indent&&n(c,"BAD_INDENT",qo);t.atKey=!0;let w=m.end,E=h?s(t,h,m,n):e(t,w,d,null,m,n);t.schema.compat&&Ro.flowIndentCheck(r.indent,h,n),t.atKey=!1,Mh.mapIncludes(t,o.items,E)&&n(w,"DUPLICATE_KEY","Map keys must be unique");let A=Lo.resolveProps(g??[],{indicator:"map-value-ind",next:p,offset:E.range[2],onError:n,parentIndent:r.indent,startOnNewline:!h||h.type==="block-scalar"});if(c=A.end,A.found){v&&((p==null?void 0:p.type)==="block-map"&&!A.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&m.start<A.found.offset-1024&&n(E.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=p?s(t,p,A,n):e(t,c,g,null,A,n);t.schema.compat&&Ro.flowIndentCheck(r.indent,p,n),c=x.range[2];let q=new Io.Pair(E,x);t.options.keepSourceTokens&&(q.srcToken=f),o.items.push(q)}else{v&&n(E.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),A.comment&&(E.comment?E.comment+=`
|
|
66
|
+
`+A.comment:E.comment=A.comment);let x=new Io.Pair(E);t.options.keepSourceTokens&&(x.srcToken=f),o.items.push(x)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),o.range=[r.offset,c,l??c],o}Po.resolveBlockMap=$h});var jo=_($o=>{"use strict";var jh=Ne(),Dh=rs(),Bh=Bn();function Fh({composeNode:s,composeEmptyNode:e},t,r,n,i){let a=(i==null?void 0:i.nodeClass)??jh.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=Dh.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==null?void 0: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 h=f?s(t,f,d,n):e(t,d.end,u,null,d,n);t.schema.compat&&Bh.flowIndentCheck(r.indent,f,n),c=h.range[2],o.items.push(h)}return o.range=[r.offset,c,l??c],o}$o.resolveBlockSeq=Fh});var St=_(Do=>{"use strict";function Kh(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}}Do.resolveEnd=Kh});var Uo=_(Ko=>{"use strict";var Uh=P(),Vh=Ee(),Bo=Oe(),Hh=Ne(),Yh=St(),Fo=rs(),Jh=lr(),Wh=Fn(),Kn="Block collections are not allowed within flow collections",Un=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Zh({composeNode:s,composeEmptyNode:e},t,r,n,i){var m;let a=r.start.source==="{",o=a?"flow map":"flow sequence",c=(i==null?void 0:i.nodeClass)??(a?Bo.YAMLMap:Hh.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 v=0;v<r.items.length;++v){let w=r.items[v],{start:E,key:A,sep:x,value:q}=w,O=Fo.resolveProps(E,{flow:o,indicator:"explicit-key-ind",next:A??(x==null?void 0:x[0]),offset:f,onError:n,parentIndent:r.indent,startOnNewline:!1});if(!O.found){if(!O.anchor&&!O.tag&&!x&&!q){v===0&&O.comma?n(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`):v<r.items.length-1&&n(O.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${o}`),O.comment&&(l.comment?l.comment+=`
|
|
67
|
+
`+O.comment:l.comment=O.comment),f=O.end;continue}!a&&t.options.strict&&Jh.containsNewline(A)&&n(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(v===0)O.comma&&n(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`);else if(O.comma||n(O.start,"MISSING_CHAR",`Missing , between ${o} items`),O.comment){let T="";e:for(let $ of E)switch($.type){case"comma":case"space":break;case"comment":T=$.source.substring(1);break e;default:break e}if(T){let $=l.items[l.items.length-1];Uh.isPair($)&&($=$.value??$.key),$.comment?$.comment+=`
|
|
68
|
+
`+T:$.comment=T,O.comment=O.comment.substring(T.length+1)}}if(!a&&!x&&!O.found){let T=q?s(t,q,O,n):e(t,O.end,x,null,O,n);l.items.push(T),f=T.range[2],Un(q)&&n(T.range,"BLOCK_IN_FLOW",Kn)}else{t.atKey=!0;let T=O.end,$=A?s(t,A,O,n):e(t,T,E,null,O,n);Un(A)&&n($.range,"BLOCK_IN_FLOW",Kn),t.atKey=!1;let D=Fo.resolveProps(x??[],{flow:o,indicator:"map-value-ind",next:q,offset:$.range[2],onError:n,parentIndent:r.indent,startOnNewline:!1});if(D.found){if(!a&&!O.found&&t.options.strict){if(x)for(let J of x){if(J===D.found)break;if(J.type==="newline"){n(J,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}O.start<D.found.offset-1024&&n(D.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else q&&("source"in q&&((m=q.source)==null?void 0:m[0])===":"?n(q,"MISSING_CHAR",`Missing space after : in ${o}`):n(D.start,"MISSING_CHAR",`Missing , or : between ${o} items`));let F=q?s(t,q,D,n):D.found?e(t,D.end,x,null,D,n):null;F?Un(q)&&n(F.range,"BLOCK_IN_FLOW",Kn):D.comment&&($.comment?$.comment+=`
|
|
69
|
+
`+D.comment:$.comment=D.comment);let U=new Vh.Pair($,F);if(t.options.keepSourceTokens&&(U.srcToken=w),a){let J=l;Wh.mapIncludes(t,J.items,$)&&n(T,"DUPLICATE_KEY","Map keys must be unique"),J.items.push(U)}else{let J=new Bo.YAMLMap(t.schema);J.flow=!0,J.items.push(U);let Ie=(F??$).range;J.range=[$.range[0],Ie[1],Ie[2]],l.items.push(J)}f=F?F.range[2]:D.end}}let d=a?"}":"]",[h,...g]=r.end,p=f;if((h==null?void 0:h.source)===d)p=h.offset+h.source.length;else{let v=o[0].toUpperCase()+o.substring(1),w=u?`${v} must end with a ${d}`:`${v} in block collection must be sufficiently indented and end with a ${d}`;n(f,u?"MISSING_CHAR":"BAD_INDENT",w),h&&h.source.length!==1&&g.unshift(h)}if(g.length>0){let v=Yh.resolveEnd(g,p,t.options.strict,n);v.comment&&(l.comment?l.comment+=`
|
|
70
|
+
`+v.comment:l.comment=v.comment),l.range=[r.offset,p,v.offset]}else l.range=[r.offset,p,p];return l}Ko.resolveFlowCollection=Zh});var Ho=_(Vo=>{"use strict";var zh=P(),Gh=B(),Qh=Oe(),Xh=Ne(),ep=Mo(),tp=jo(),sp=Uo();function Vn(s,e,t,r,n,i){let a=t.type==="block-map"?ep.resolveBlockMap(s,e,t,r,i):t.type==="block-seq"?tp.resolveBlockSeq(s,e,t,r,i):sp.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 rp(s,e,t,r,n){var d;let i=r.tag,a=i?e.directives.tagName(i.source,h=>n(i,"TAG_RESOLVE_FAILED",h)):null;if(t.type==="block-seq"){let{anchor:h,newlineAfterProp:g}=r,p=h&&i?h.offset>i.offset?h:i:h??i;p&&(!g||g.offset<p.offset)&&n(p,"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===Qh.YAMLMap.tagName&&o==="map"||a===Xh.YAMLSeq.tagName&&o==="seq")return Vn(s,e,t,n,a);let c=e.schema.tags.find(h=>h.tag===a&&h.collection===o);if(!c){let h=e.schema.knownTags[a];if((h==null?void 0:h.collection)===o)e.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else return h?n(i,"BAD_COLLECTION_TYPE",`${h.tag} used for ${o} collection, but expects ${h.collection??"scalar"}`,!0):n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),Vn(s,e,t,n,a)}let l=Vn(s,e,t,n,a,c),u=((d=c.resolve)==null?void 0:d.call(c,l,h=>n(i,"TAG_RESOLVE_FAILED",h),e.options))??l,f=zh.isNode(u)?u:new Gh.Scalar(u);return f.range=l.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}Vo.composeCollection=rp});var Yn=_(Yo=>{"use strict";var Hn=B();function np(s,e,t){let r=e.offset,n=ip(e,s.options.strict,t);if(!n)return{value:"",type:null,comment:"",range:[r,r,r]};let i=n.mode===">"?Hn.Scalar.BLOCK_FOLDED:Hn.Scalar.BLOCK_LITERAL,a=e.source?ap(e.source):[],o=a.length;for(let p=a.length-1;p>=0;--p){let m=a[p][1];if(m===""||m==="\r")o=p;else break}if(o===0){let p=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:p,type:i,comment:n.comment,range:[r,m,m]}}let c=e.indent+n.indent,l=e.offset+n.length,u=0;for(let p=0;p<o;++p){let[m,v]=a[p];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=p,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 p=a.length-1;p>=o;--p)a[p][0].length>c&&(o=p+1);let f="",d="",h=!1;for(let p=0;p<u;++p)f+=a[p][0].slice(c)+`
|
|
72
|
+
`;for(let p=u;p<o;++p){let[m,v]=a[p];l+=m.length+v.length+1;let w=v[v.length-1]==="\r";if(w&&(v=v.slice(0,-1)),v&&m.length<c){let A=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;t(l-v.length-(w?2:1),"BAD_INDENT",A),m=""}i===Hn.Scalar.BLOCK_LITERAL?(f+=d+m.slice(c)+v,d=`
|
|
73
|
+
`):m.length>c||v[0]===" "?(d===" "?d=`
|
|
74
|
+
`:!h&&d===`
|
|
75
|
+
`&&(d=`
|
|
76
|
+
|
|
77
|
+
`),f+=d+m.slice(c)+v,d=`
|
|
78
|
+
`,h=!0):v===""?d===`
|
|
79
|
+
`?f+=`
|
|
80
|
+
`:d=`
|
|
81
|
+
`:(f+=d+v,d=" ",h=!1)}switch(n.chomp){case"-":break;case"+":for(let p=o;p<a.length;++p)f+=`
|
|
82
|
+
`+a[p][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 ip({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 h=n[d];if(!o&&(h==="-"||h==="+"))o=h;else{let g=Number(h);!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 h=e[d];switch(h.type){case"space":l=!0;case"newline":f+=h.source.length;break;case"comment":t&&!l&&r(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=h.source.length,u=h.source.substring(1);break;case"error":r(h,"UNEXPECTED_TOKEN",h.message),f+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;r(h,"UNEXPECTED_TOKEN",g);let p=h.source;p&&typeof p=="string"&&(f+=p.length)}}}return{mode:i,indent:a,chomp:o,comment:u,length:f}}function ap(s){let e=s.split(/\n( *)/),t=e[0],r=t.match(/^( *)/),i=[r!=null&&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}Yo.resolveBlockScalar=np});var Wn=_(Wo=>{"use strict";var Jn=B(),op=St();function cp(s,e,t){let{offset:r,type:n,source:i,end:a}=s,o,c,l=(d,h,g)=>t(r+d,h,g);switch(n){case"scalar":o=Jn.Scalar.PLAIN,c=lp(i,l);break;case"single-quoted-scalar":o=Jn.Scalar.QUOTE_SINGLE,c=up(i,l);break;case"double-quoted-scalar":o=Jn.Scalar.QUOTE_DOUBLE,c=fp(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=op.resolveEnd(a,u,e,t);return{value:c,type:o,comment:f.comment,range:[r,u,f.offset]}}function lp(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}`),Jo(s)}function up(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),Jo(s.slice(1,-1)).replace(/''/g,"'")}function Jo(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==null?void 0:r[1])??"")}function fp(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}=dp(s,r);t+=i,r=a}else if(n==="\\"){let i=s[++r],a=hp[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+=pp(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 dp(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 hp={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 pp(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)}Wo.resolveFlowScalar=cp});var Go=_(zo=>{"use strict";var Qe=P(),Zo=B(),mp=Yn(),yp=Wn();function gp(s,e,t,r){let{value:n,type:i,comment:a,range:o}=e.type==="block-scalar"?mp.resolveBlockScalar(s,e,r):yp.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[Qe.SCALAR]:c?l=vp(s.schema,n,c,t,r):e.type==="scalar"?l=bp(s,n,e,r):l=s.schema[Qe.SCALAR];let u;try{let f=l.resolve(n,d=>r(t??e,"TAG_RESOLVE_FAILED",d),s.options);u=Qe.isScalar(f)?f:new Zo.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);r(t??e,"TAG_RESOLVE_FAILED",d),u=new Zo.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 vp(s,e,t,r,n){var o;if(t==="!")return s[Qe.SCALAR];let i=[];for(let c of s.tags)if(!c.collection&&c.tag===t)if(c.default&&c.test)i.push(c);else return c;for(let c of i)if((o=c.test)!=null&&o.test(e))return c;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[Qe.SCALAR])}function bp({atKey:s,directives:e,schema:t},r,n,i){let a=t.tags.find(o=>{var c;return(o.default===!0||s&&o.default==="key")&&((c=o.test)==null?void 0:c.test(r))})||t[Qe.SCALAR];if(t.compat){let o=t.compat.find(c=>{var l;return c.default&&((l=c.test)==null?void 0:l.test(r))})??t[Qe.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=gp});var Xo=_(Qo=>{"use strict";function wp(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==null?void 0:n.type)==="space";)s+=n.source.length,n=e[++r];break}}return s}Qo.emptyScalarPosition=wp});var sc=_(zn=>{"use strict";var _p=Mt(),Sp=P(),kp=Ho(),ec=Go(),Ap=St(),Ep=Xo(),Tp={composeNode:tc,composeEmptyNode:Zn};function tc(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=Op(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=ec.composeScalar(s,e,c,r),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=kp.composeCollection(Tp,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=Zn(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&&(!Sp.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 Zn(s,e,t,r,{spaceBefore:n,comment:i,anchor:a,tag:o,end:c},l){let u={type:"scalar",offset:Ep.emptyScalarPosition(e,t,r),indent:-1,source:""},f=ec.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 Op({options:s},{offset:e,source:t,end:r},n){let i=new _p.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=Ap.resolveEnd(r,a,s.strict,n);return i.range=[e,a,o.offset],o.comment&&(i.comment=o.comment),i}zn.composeEmptyNode=Zn;zn.composeNode=tc});var ic=_(nc=>{"use strict";var Np=Xt(),rc=sc(),xp=St(),Cp=rs();function Ip(s,e,{offset:t,start:r,value:n,end:i},a){let o=Object.assign({_directives:e},s),c=new Np.Document(void 0,o),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Cp.resolveProps(r,{indicator:"doc-start",next:n??(i==null?void 0: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?rc.composeNode(l,n,u,a):rc.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}nc.composeDoc=Ip});var Qn=_(cc=>{"use strict";var Lp=ms("process"),Rp=Mr(),qp=Xt(),ns=ss(),ac=P(),Pp=ic(),Mp=St();function is(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 oc(s){var n;let e="",t=!1,r=!1;for(let i=0;i<s.length;++i){let a=s[i];switch(a[0]){case"#":e+=(e===""?"":r?`
|
|
101
|
+
|
|
102
|
+
`:`
|
|
103
|
+
`)+(a.substring(1)||" "),t=!0,r=!1;break;case"%":((n=s[i+1])==null?void 0:n[0])!=="#"&&(i+=1),t=!1;break;default:t||(r=!0),t=!1}}return{comment:e,afterEmptyLine:r}}var Gn=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,n,i)=>{let a=is(t);i?this.warnings.push(new ns.YAMLWarning(a,r,n)):this.errors.push(new ns.YAMLParseError(a,r,n))},this.directives=new Rp.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:n}=oc(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(ac.isCollection(i)&&!i.flow&&i.items.length>0){let a=i.items[0];ac.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:oc(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(Lp.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,r,n)=>{let i=is(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Pp.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 ns.YAMLParseError(is(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 ns.YAMLParseError(is(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let t=Mp.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 ns.YAMLParseError(is(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 qp.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}}};cc.Composer=Gn});var fc=_(ur=>{"use strict";var $p=Yn(),jp=Wn(),Dp=ss(),lc=Ft();function Bp(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 Dp.YAMLParseError([o,o+1],i,a)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return jp.resolveFlowScalar(s,e,r);case"block-scalar":return $p.resolveBlockScalar({options:{strict:e}},s,r)}}return null}function Fp(s,e){let{implicitKey:t=!1,indent:r,inFlow:n=!1,offset:i=-1,type:a="PLAIN"}=e,o=lc.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 uc(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 Kp(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=lc.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">":Up(s,c);break;case'"':Xn(s,c,"double-quoted-scalar");break;case"'":Xn(s,c,"single-quoted-scalar");break;default:Xn(s,c,"scalar")}}function Up(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}];uc(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 uc(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 Xn(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})}}}ur.createScalarToken=Fp;ur.resolveAsScalar=Bp;ur.setScalarValue=Kp});var hc=_(dc=>{"use strict";var Vp=s=>"type"in s?dr(s):fr(s);function dr(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=dr(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=fr(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=fr(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=fr(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 fr({start:s,key:e,sep:t,value:r}){let n="";for(let i of s)n+=i.source;if(e&&(n+=dr(e)),t)for(let i of t)n+=i.source;return r&&(n+=dr(r)),n}dc.stringify=Vp});var gc=_(yc=>{"use strict";var ei=Symbol("break visit"),Hp=Symbol("skip children"),pc=Symbol("remove item");function Xe(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),mc(Object.freeze([]),s,e)}Xe.BREAK=ei;Xe.SKIP=Hp;Xe.REMOVE=pc;Xe.itemAtPath=(s,e)=>{let t=s;for(let[r,n]of e){let i=t==null?void 0:t[r];if(i&&"items"in i)t=i.items[n];else return}return t};Xe.parentCollection=(s,e)=>{let t=Xe.itemAtPath(s,e.slice(0,-1)),r=e[e.length-1][0],n=t==null?void 0:t[r];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function mc(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=mc(Object.freeze(s.concat([[n,a]])),i.items[a],t);if(typeof o=="number")a=o-1;else{if(o===ei)return ei;o===pc&&(i.items.splice(a,1),a-=1)}}typeof r=="function"&&n==="key"&&(r=r(e,s))}}return typeof r=="function"?r(e,s):r}yc.visit=Xe});var hr=_(G=>{"use strict";var ti=fc(),Yp=hc(),Jp=gc(),si="\uFEFF",ri="",ni="",ii="",Wp=s=>!!s&&"items"in s,Zp=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 si:return"<BOM>";case ri:return"<DOC>";case ni:return"<FLOW_END>";case ii:return"<SCALAR>";default:return JSON.stringify(s)}}function Gp(s){switch(s){case si:return"byte-order-mark";case ri:return"doc-mode";case ni:return"flow-error-end";case ii: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}G.createScalarToken=ti.createScalarToken;G.resolveAsScalar=ti.resolveAsScalar;G.setScalarValue=ti.setScalarValue;G.stringify=Yp.stringify;G.visit=Jp.visit;G.BOM=si;G.DOCUMENT=ri;G.FLOW_END=ni;G.SCALAR=ii;G.isCollection=Wp;G.isScalar=Zp;G.prettyToken=zp;G.tokenType=Gp});var ci=_(bc=>{"use strict";var as=hr();function ie(s){switch(s){case void 0:case" ":case`
|
|
118
|
+
`:case"\r":case" ":return!0;default:return!1}}var vc=new Set("0123456789ABCDEFabcdef"),Qp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),pr=new Set(",[]{}"),Xp=new Set(` ,[]{}
|
|
119
|
+
\r `),ai=s=>!s||Xp.has(s),oi=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==="...")&&ie(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]===as.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 as.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==="...")&&ie(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&&!ie(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===":")&&ie(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(ai),"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("..."))&&ie(n[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield as.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(ai),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||ie(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=>ie(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 as.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(ie(i)||e&&pr.has(i))break;t=r}else if(ie(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&&pr.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&&pr.has(n))break;t=r}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield as.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(ai))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(ie(t)||e&&pr.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(;!ie(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(Qp.has(t))t=this.buffer[++e];else if(t==="%"&&vc.has(this.buffer[e+1])&&vc.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)}};bc.Lexer=oi});var ui=_(wc=>{"use strict";var li=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}}}};wc.LineCounter=li});var di=_(Ec=>{"use strict";var em=ms("process"),_c=hr(),tm=ci();function xe(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Sc(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 Ac(s){switch(s==null?void 0:s.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function mr(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 kt(s){var t;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(;((t=s[++e])==null?void 0:t.type)==="space";);return s.splice(e,s.length)}function kc(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,Ac(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 fi=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 tm.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,em.env.LOG_TOKENS&&console.log("|",_c.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=_c.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==null?void 0: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"&&kc(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&&Sc(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":{Sc(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=mr(this.peek(2)),r=kt(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){var r;let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0,i=Array.isArray(n)?n[n.length-1]:void 0;(i==null?void 0:i.type)==="comment"?n==null||n.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2],i=(r=n==null?void 0:n.value)==null?void 0:r.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",a=[];if(i&&t.sep&&!t.value){let o=[];for(let c=0;c<t.sep.length;++c){let l=t.sep[c];switch(l.type){case"newline":o.push(c);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||t.value?(a.push(this.sourceToken),e.items.push({start:a}),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):i||t.value?(a.push(this.sourceToken),e.items.push({start:a,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:a,key:null,sep:[this.sourceToken]}]});else if(Ac(t.key)&&!xe(t.sep,"newline")){let o=kt(t.start),c=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:c,sep:l}]})}else a.length>0?t.sep=t.sep.concat(a,this.sourceToken):t.sep.push(this.sourceToken);else if(xe(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=kt(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:a,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 o=this.flowScalar(this.type);i||t.value?(e.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.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 n&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var r;let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0,i=Array.isArray(n)?n[n.length-1]:void 0;(i==null?void 0:i.type)==="comment"?n==null||n.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2],i=(r=n==null?void 0:n.value)==null?void 0:r.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.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 n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while((r==null?void 0: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=mr(r),i=kt(n);kc(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=mr(e),r=kt(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=mr(e),r=kt(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())}}};Ec.Parser=fi});var Cc=_(cs=>{"use strict";var Tc=Qn(),sm=Xt(),os=ss(),rm=Zr(),nm=P(),im=ui(),Oc=di();function Nc(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new im.LineCounter||null,prettyErrors:e}}function am(s,e={}){let{lineCounter:t,prettyErrors:r}=Nc(e),n=new Oc.Parser(t==null?void 0:t.addNewLine),i=new Tc.Composer(e),a=Array.from(i.compose(n.parse(s)));if(r&&t)for(let o of a)o.errors.forEach(os.prettifyError(s,t)),o.warnings.forEach(os.prettifyError(s,t));return a.length>0?a:Object.assign([],{empty:!0},i.streamInfo())}function xc(s,e={}){let{lineCounter:t,prettyErrors:r}=Nc(e),n=new Oc.Parser(t==null?void 0:t.addNewLine),i=new Tc.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 os.YAMLParseError(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&t&&(a.errors.forEach(os.prettifyError(s,t)),a.warnings.forEach(os.prettifyError(s,t))),a}function om(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=>rm.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 cm(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 nm.isDocument(s)&&!r?s.toString(t):new sm.Document(s,r,t).toString(t)}cs.parse=om;cs.parseAllDocuments=am;cs.parseDocument=xc;cs.stringify=cm});var Lc=_(M=>{"use strict";var lm=Qn(),um=Xt(),fm=Ln(),hi=ss(),dm=Mt(),Ce=P(),hm=Ee(),pm=B(),mm=Oe(),ym=Ne(),gm=hr(),vm=ci(),bm=ui(),wm=di(),yr=Cc(),Ic=Lt();M.Composer=lm.Composer;M.Document=um.Document;M.Schema=fm.Schema;M.YAMLError=hi.YAMLError;M.YAMLParseError=hi.YAMLParseError;M.YAMLWarning=hi.YAMLWarning;M.Alias=dm.Alias;M.isAlias=Ce.isAlias;M.isCollection=Ce.isCollection;M.isDocument=Ce.isDocument;M.isMap=Ce.isMap;M.isNode=Ce.isNode;M.isPair=Ce.isPair;M.isScalar=Ce.isScalar;M.isSeq=Ce.isSeq;M.Pair=hm.Pair;M.Scalar=pm.Scalar;M.YAMLMap=mm.YAMLMap;M.YAMLSeq=ym.YAMLSeq;M.CST=gm;M.Lexer=vm.Lexer;M.LineCounter=bm.LineCounter;M.Parser=wm.Parser;M.parse=yr.parse;M.parseAllDocuments=yr.parseAllDocuments;M.parseDocument=yr.parseDocument;M.stringify=yr.stringify;M.visit=Ic.visit;M.visitAsync=Ic.visitAsync});var Q={};ql(Q,{BRAND:()=>cu,DIRTY:()=>Le,EMPTY_PATH:()=>Bl,INVALID:()=>N,NEVER:()=>Yu,OK:()=>Y,ParseStatus:()=>V,Schema:()=>L,ZodAny:()=>be,ZodArray:()=>pe,ZodBigInt:()=>qe,ZodBoolean:()=>Pe,ZodBranded:()=>Ct,ZodCatch:()=>Ye,ZodDate:()=>Me,ZodDefault:()=>He,ZodDiscriminatedUnion:()=>vs,ZodEffects:()=>te,ZodEnum:()=>Ue,ZodError:()=>W,ZodFirstPartyTypeKind:()=>C,ZodFunction:()=>ws,ZodIntersection:()=>Be,ZodIssueCode:()=>y,ZodLazy:()=>Fe,ZodLiteral:()=>Ke,ZodMap:()=>ut,ZodNaN:()=>dt,ZodNativeEnum:()=>Ve,ZodNever:()=>re,ZodNull:()=>je,ZodNullable:()=>ce,ZodNumber:()=>Re,ZodObject:()=>Z,ZodOptional:()=>X,ZodParsedType:()=>S,ZodPipeline:()=>It,ZodPromise:()=>we,ZodReadonly:()=>Je,ZodRecord:()=>bs,ZodSchema:()=>L,ZodSet:()=>ft,ZodString:()=>ve,ZodSymbol:()=>ct,ZodTransformer:()=>te,ZodTuple:()=>oe,ZodType:()=>L,ZodUndefined:()=>$e,ZodUnion:()=>De,ZodUnknown:()=>he,ZodVoid:()=>lt,addIssueToContext:()=>b,any:()=>gu,array:()=>_u,bigint:()=>du,boolean:()=>Ui,coerce:()=>Hu,custom:()=>Bi,date:()=>hu,datetimeRegex:()=>ji,defaultErrorMap:()=>fe,discriminatedUnion:()=>Eu,effect:()=>$u,enum:()=>qu,function:()=>Iu,getErrorMap:()=>it,getParsedType:()=>ae,instanceof:()=>uu,intersection:()=>Tu,isAborted:()=>ys,isAsync:()=>at,isDirty:()=>gs,isValid:()=>ge,late:()=>lu,lazy:()=>Lu,literal:()=>Ru,makeIssue:()=>xt,map:()=>xu,nan:()=>fu,nativeEnum:()=>Pu,never:()=>bu,null:()=>yu,nullable:()=>Du,number:()=>Ki,object:()=>Su,objectUtil:()=>Cr,oboolean:()=>Vu,onumber:()=>Uu,optional:()=>ju,ostring:()=>Ku,pipeline:()=>Fu,preprocess:()=>Bu,promise:()=>Mu,quotelessJson:()=>$l,record:()=>Nu,set:()=>Cu,setErrorMap:()=>Dl,strictObject:()=>ku,string:()=>Fi,symbol:()=>pu,transformer:()=>$u,tuple:()=>Ou,undefined:()=>mu,union:()=>Au,unknown:()=>vu,util:()=>R,void:()=>wu});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 Cr;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Cr||(Cr={}));var S=R.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ae=s=>{switch(typeof s){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(s)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(s)?S.array:s===null?S.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?S.promise:typeof Map<"u"&&s instanceof Map?S.map:typeof Set<"u"&&s instanceof Set?S.set:typeof Date<"u"&&s instanceof Date?S.date:S.object;default:return S.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"]),$l=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:"),W=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()}};W.create=s=>new W(s);var jl=(s,e)=>{let t;switch(s.code){case y.invalid_type:s.received===S.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}},fe=jl;var Ri=fe;function Dl(s){Ri=s}function it(){return Ri}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}},Bl=[];function b(s,e){let t=it(),r=xt({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===fe?void 0:fe].filter(n=>!!n)});s.common.issues.push(r)}var V=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 N;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 N;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}}},N=Object.freeze({status:"aborted"}),Le=s=>({status:"dirty",value:s}),Y=s=>({status:"valid",value:s}),ys=s=>s.status==="aborted",gs=s=>s.status==="dirty",ge=s=>s.status==="valid",at=s=>typeof Promise<"u"&&s instanceof Promise;var k;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(k||(k={}));var ee=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}},qi=(s,e)=>{if(ge(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 W(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 ae(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ae(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new V,ctx:{common:e.parent.common,data:e.data,parsedType:ae(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(at(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==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ae(e)},n=this._parseSync({data:e,path:r.path,parent:r});return qi(r,n)}"~validate"(e){var r,n;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ae(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:t});return ge(i)?{value:i.value}:{issues:t.common.issues}}catch(i){(n=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(i=>ge(i)?{value:i.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==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ae(e)},n=this._parse({data:e,path:r.path,parent:r}),i=await(at(n)?n:Promise.resolve(n));return qi(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 te({schema:this,typeName:C.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 X.create(this,this._def)}nullable(){return ce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pe.create(this)}promise(){return we.create(this,this._def)}or(e){return De.create([this,e],this._def)}and(e){return Be.create(this,e,this._def)}transform(e){return new te({...I(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new He({...I(this._def),innerType:this,defaultValue:t,typeName:C.ZodDefault})}brand(){return new Ct({typeName:C.ZodBranded,type:this,...I(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Ye({...I(this._def),innerType:this,catchValue:t,typeName:C.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return It.create(this,e)}readonly(){return Je.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Fl=/^c[^\s-]{8,}$/i,Kl=/^[0-9a-z]+$/,Ul=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Vl=/^[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,Hl=/^[a-z0-9_-]{21}$/i,Yl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Jl=/^[-+]?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)?)??$/,Wl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ir,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])$/,Gl=/^(?:(?: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])$/,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]))$/,Xl=/^(([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])$/,eu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Mi="((\\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])))",su=new RegExp(`^${Mi}$`);function $i(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 ru(s){return new RegExp(`^${$i(s)}$`)}function ji(s){let e=`${Mi}T${$i(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 nu(s,e){return!!((e==="v4"||!e)&&zl.test(s)||(e==="v6"||!e)&&Ql.test(s))}function iu(s,e){if(!Yl.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==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function au(s,e){return!!((e==="v4"||!e)&&Gl.test(s)||(e==="v6"||!e)&&Xl.test(s))}var ve=class s extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==S.string){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:S.string,received:i.parsedType}),N}let r=new V,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")Wl.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")Ir||(Ir=new RegExp(Zl,"u")),Ir.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")Vl.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")Hl.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")Fl.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")Kl.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")Ul.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"?ji(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"?su.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:y.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?ru(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"?Jl.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"duration",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?nu(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"?iu(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"?au(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"?eu.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"base64",code:y.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?tu.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,...k.errToObj(r)})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...k.errToObj(e)})}url(e){return this._addCheck({kind:"url",...k.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...k.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...k.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...k.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...k.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...k.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...k.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...k.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...k.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...k.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...k.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...k.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==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...k.errToObj(e==null?void 0: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==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...k.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...k.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...k.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...k.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...k.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...k.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...k.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...k.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...k.errToObj(t)})}nonempty(e){return this.min(1,k.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}};ve.create=s=>new ve({checks:[],typeName:C.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...I(s)});function ou(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 Re=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)!==S.number){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:S.number,received:i.parsedType}),N}let r,n=new V;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"?ou(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,k.toString(t))}gt(e,t){return this.setLimit("min",e,!1,k.toString(t))}lte(e,t){return this.setLimit("max",e,!0,k.toString(t))}lt(e,t){return this.setLimit("max",e,!1,k.toString(t))}setLimit(e,t,r,n){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:k.toString(n)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:k.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:k.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:k.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k.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)}};Re.create=s=>new Re({checks:[],typeName:C.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...I(s)});var qe=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)!==S.bigint)return this._getInvalidInput(e);let r,n=new V;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:S.bigint,received:t.parsedType}),N}gte(e,t){return this.setLimit("min",e,!0,k.toString(t))}gt(e,t){return this.setLimit("min",e,!1,k.toString(t))}lte(e,t){return this.setLimit("max",e,!0,k.toString(t))}lt(e,t){return this.setLimit("max",e,!1,k.toString(t))}setLimit(e,t,r,n){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:k.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:k.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:k.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}};qe.create=s=>new qe({checks:[],typeName:C.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...I(s)});var Pe=class extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.boolean){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:S.boolean,received:r.parsedType}),N}return Y(e.data)}};Pe.create=s=>new Pe({typeName:C.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...I(s)});var Me=class s extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==S.date){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_type,expected:S.date,received:i.parsedType}),N}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return b(i,{code:y.invalid_date}),N}let r=new V,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:k.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:k.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}};Me.create=s=>new Me({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:C.ZodDate,...I(s)});var ct=class extends L{_parse(e){if(this._getType(e)!==S.symbol){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:S.symbol,received:r.parsedType}),N}return Y(e.data)}};ct.create=s=>new ct({typeName:C.ZodSymbol,...I(s)});var $e=class extends L{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:S.undefined,received:r.parsedType}),N}return Y(e.data)}};$e.create=s=>new $e({typeName:C.ZodUndefined,...I(s)});var je=class extends L{_parse(e){if(this._getType(e)!==S.null){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:S.null,received:r.parsedType}),N}return Y(e.data)}};je.create=s=>new je({typeName:C.ZodNull,...I(s)});var be=class extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return Y(e.data)}};be.create=s=>new be({typeName:C.ZodAny,...I(s)});var he=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Y(e.data)}};he.create=s=>new he({typeName:C.ZodUnknown,...I(s)});var re=class extends L{_parse(e){let t=this._getOrReturnCtx(e);return b(t,{code:y.invalid_type,expected:S.never,received:t.parsedType}),N}};re.create=s=>new re({typeName:C.ZodNever,...I(s)});var lt=class extends L{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:S.void,received:r.parsedType}),N}return Y(e.data)}};lt.create=s=>new lt({typeName:C.ZodVoid,...I(s)});var pe=class s extends L{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==S.array)return b(t,{code:y.invalid_type,expected:S.array,received:t.parsedType}),N;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 ee(t,a,t.path,o)))).then(a=>V.mergeArray(r,a));let i=[...t.data].map((a,o)=>n.type._parseSync(new ee(t,a,t.path,o)));return V.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new s({...this._def,minLength:{value:e,message:k.toString(t)}})}max(e,t){return new s({...this._def,maxLength:{value:e,message:k.toString(t)}})}length(e,t){return new s({...this._def,exactLength:{value:e,message:k.toString(t)}})}nonempty(e){return this.min(1,e)}};pe.create=(s,e)=>new pe({type:s,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...I(e)});function ot(s){if(s instanceof Z){let e={};for(let t in s.shape){let r=s.shape[t];e[t]=X.create(ot(r))}return new Z({...s._def,shape:()=>e})}else return s instanceof pe?new pe({...s._def,type:ot(s.element)}):s instanceof X?X.create(ot(s.unwrap())):s instanceof ce?ce.create(ot(s.unwrap())):s instanceof oe?oe.create(s.items.map(e=>ot(e))):s}var Z=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)!==S.object){let l=this._getOrReturnCtx(e);return b(l,{code:y.invalid_type,expected:S.object,received:l.parsedType}),N}let{status:r,ctx:n}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof re&&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 ee(n,f,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof re){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 ee(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=>V.mergeObjectSync(r,l)):V.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return k.errToObj,new s({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var i,a;let n=((a=(i=this._def).errorMap)==null?void 0:a.call(i,t,r).message)??r.defaultError;return t.code==="unrecognized_keys"?{message:k.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:C.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 ot(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 X;)i=i._def.innerType;t[r]=i}return new s({...this._def,shape:()=>t})}keyof(){return Di(R.objectKeys(this.shape))}};Z.create=(s,e)=>new Z({shape:()=>s,unknownKeys:"strip",catchall:re.create(),typeName:C.ZodObject,...I(e)});Z.strictCreate=(s,e)=>new Z({shape:()=>s,unknownKeys:"strict",catchall:re.create(),typeName:C.ZodObject,...I(e)});Z.lazycreate=(s,e)=>new Z({shape:s,unknownKeys:"strip",catchall:re.create(),typeName:C.ZodObject,...I(e)});var De=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 W(o.ctx.common.issues));return b(t,{code:y.invalid_union,unionErrors:a}),N}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 W(c));return b(t,{code:y.invalid_union,unionErrors:o}),N}}get options(){return this._def.options}};De.create=(s,e)=>new De({options:s,typeName:C.ZodUnion,...I(e)});var de=s=>s instanceof Fe?de(s.schema):s instanceof te?de(s.innerType()):s instanceof Ke?[s.value]:s instanceof Ue?s.options:s instanceof Ve?R.objectValues(s.enum):s instanceof He?de(s._def.innerType):s instanceof $e?[void 0]:s instanceof je?[null]:s instanceof X?[void 0,...de(s.unwrap())]:s instanceof ce?[null,...de(s.unwrap())]:s instanceof Ct||s instanceof Je?de(s.unwrap()):s instanceof Ye?de(s._def.innerType):[],vs=class s extends L{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.object)return b(t,{code:y.invalid_type,expected:S.object,received:t.parsedType}),N;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]}),N)}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=de(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:C.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...I(r)})}};function Lr(s,e){let t=ae(s),r=ae(e);if(s===e)return{valid:!0,data:s};if(t===S.object&&r===S.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=Lr(s[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(t===S.array&&r===S.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=Lr(a,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===S.date&&r===S.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}var Be=class extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(i,a)=>{if(ys(i)||ys(a))return N;let o=Lr(i.value,a.value);return o.valid?((gs(i)||gs(a))&&t.dirty(),{status:t.value,value:o.data}):(b(r,{code:y.invalid_intersection_types}),N)};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}))}};Be.create=(s,e,t)=>new Be({left:s,right:e,typeName:C.ZodIntersection,...I(t)});var oe=class s extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.array)return b(r,{code:y.invalid_type,expected:S.array,received:r.parsedType}),N;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"}),N;!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 ee(r,a,r.path,o)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>V.mergeArray(t,a)):V.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new s({...this._def,rest:e})}};oe.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new oe({items:s,typeName:C.ZodTuple,rest:null,...I(e)})};var bs=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!==S.object)return b(r,{code:y.invalid_type,expected:S.object,received:r.parsedType}),N;let n=[],i=this._def.keyType,a=this._def.valueType;for(let o in r.data)n.push({key:i._parse(new ee(r,o,r.path,o)),value:a._parse(new ee(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?V.mergeObjectAsync(t,n):V.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:C.ZodRecord,...I(r)}):new s({keyType:ve.create(),valueType:e,typeName:C.ZodRecord,...I(t)})}},ut=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!==S.map)return b(r,{code:y.invalid_type,expected:S.map,received:r.parsedType}),N;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([o,c],l)=>({key:n._parse(new ee(r,o,r.path,[l,"key"])),value:i._parse(new ee(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 N;(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 N;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(l.value,u.value)}return{status:t.value,value:o}}}};ut.create=(s,e,t)=>new ut({valueType:e,keyType:s,typeName:C.ZodMap,...I(t)});var ft=class s extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.set)return b(r,{code:y.invalid_type,expected:S.set,received:r.parsedType}),N;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 N;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 ee(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:k.toString(t)}})}max(e,t){return new s({...this._def,maxSize:{value:e,message:k.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ft.create=(s,e)=>new ft({valueType:s,minSize:null,maxSize:null,typeName:C.ZodSet,...I(e)});var ws=class s extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.function)return b(t,{code:y.invalid_type,expected:S.function,received:t.parsedType}),N;function r(o,c){return xt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,it(),fe].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,it(),fe].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 we){let o=this;return Y(async function(...c){let l=new W([]),u=await o._def.args.parseAsync(c,i).catch(h=>{throw l.addIssue(r(c,h)),l}),f=await Reflect.apply(a,this,u);return await o._def.returns._def.type.parseAsync(f,i).catch(h=>{throw l.addIssue(n(f,h)),l})})}else{let o=this;return Y(function(...c){let l=o._def.args.safeParse(c,i);if(!l.success)throw new W([r(c,l.error)]);let u=Reflect.apply(a,this,l.data),f=o._def.returns.safeParse(u,i);if(!f.success)throw new W([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:oe.create(e).rest(he.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||oe.create([]).rest(he.create()),returns:t||he.create(),typeName:C.ZodFunction,...I(r)})}},Fe=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})}};Fe.create=(s,e)=>new Fe({getter:s,typeName:C.ZodLazy,...I(e)});var Ke=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}),N}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(s,e)=>new Ke({value:s,typeName:C.ZodLiteral,...I(e)});function Di(s,e){return new Ue({values:s,typeName:C.ZodEnum,...I(e)})}var Ue=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}),N}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}),N}return Y(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})}};Ue.create=Di;var Ve=class extends L{_parse(e){let t=R.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==S.string&&r.parsedType!==S.number){let n=R.objectValues(t);return b(r,{expected:R.joinValues(n),received:r.parsedType,code:y.invalid_type}),N}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}),N}return Y(e.data)}get enum(){return this._def.values}};Ve.create=(s,e)=>new Ve({values:s,typeName:C.ZodNativeEnum,...I(e)});var we=class extends L{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.promise&&t.common.async===!1)return b(t,{code:y.invalid_type,expected:S.promise,received:t.parsedType}),N;let r=t.parsedType===S.promise?t.data:Promise.resolve(t.data);return Y(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};we.create=(s,e)=>new we({type:s,typeName:C.ZodPromise,...I(e)});var te=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.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 N;let c=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return c.status==="aborted"?N:c.status==="dirty"?Le(c.value):t.value==="dirty"?Le(c.value):c});{if(t.value==="aborted")return N;let o=this._def.schema._parseSync({data:a,path:r.path,parent:r});return o.status==="aborted"?N:o.status==="dirty"?Le(o.value):t.value==="dirty"?Le(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"?N:(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"?N:(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(!ge(a))return N;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=>ge(a)?Promise.resolve(n.transform(a.value,i)).then(o=>({status:t.value,value:o})):N);R.assertNever(n)}};te.create=(s,e,t)=>new te({schema:s,typeName:C.ZodEffects,effect:e,...I(t)});te.createWithPreprocess=(s,e,t)=>new te({schema:e,effect:{type:"preprocess",transform:s},typeName:C.ZodEffects,...I(t)});var X=class extends L{_parse(e){return this._getType(e)===S.undefined?Y(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};X.create=(s,e)=>new X({innerType:s,typeName:C.ZodOptional,...I(e)});var ce=class extends L{_parse(e){return this._getType(e)===S.null?Y(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ce.create=(s,e)=>new ce({innerType:s,typeName:C.ZodNullable,...I(e)});var He=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===S.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};He.create=(s,e)=>new He({innerType:s,typeName:C.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...I(e)});var Ye=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 at(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new W(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new W(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Ye.create=(s,e)=>new Ye({innerType:s,typeName:C.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...I(e)});var dt=class extends L{_parse(e){if(this._getType(e)!==S.nan){let r=this._getOrReturnCtx(e);return b(r,{code:y.invalid_type,expected:S.nan,received:r.parsedType}),N}return{status:"valid",value:e.data}}};dt.create=s=>new dt({typeName:C.ZodNaN,...I(s)});var cu=Symbol("zod_brand"),Ct=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}},It=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"?N:i.status==="dirty"?(t.dirty(),Le(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"?N: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:C.ZodPipeline})}},Je=class extends L{_parse(e){let t=this._def.innerType._parse(e),r=n=>(ge(n)&&(n.value=Object.freeze(n.value)),n);return at(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}};Je.create=(s,e)=>new Je({innerType:s,typeName:C.ZodReadonly,...I(e)});function Pi(s,e){let t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}function Bi(s,e={},t){return s?be.create().superRefine((r,n)=>{let i=s(r);if(i instanceof Promise)return i.then(a=>{if(!a){let o=Pi(e,r),c=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:c})}});if(!i){let a=Pi(e,r),o=a.fatal??t??!0;n.addIssue({code:"custom",...a,fatal:o})}}):be.create()}var lu={object:Z.lazycreate},C;(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"})(C||(C={}));var uu=(s,e={message:`Input not instance of ${s.name}`})=>Bi(t=>t instanceof s,e),Fi=ve.create,Ki=Re.create,fu=dt.create,du=qe.create,Ui=Pe.create,hu=Me.create,pu=ct.create,mu=$e.create,yu=je.create,gu=be.create,vu=he.create,bu=re.create,wu=lt.create,_u=pe.create,Su=Z.create,ku=Z.strictCreate,Au=De.create,Eu=vs.create,Tu=Be.create,Ou=oe.create,Nu=bs.create,xu=ut.create,Cu=ft.create,Iu=ws.create,Lu=Fe.create,Ru=Ke.create,qu=Ue.create,Pu=Ve.create,Mu=we.create,$u=te.create,ju=X.create,Du=ce.create,Bu=te.createWithPreprocess,Fu=It.create,Ku=()=>Fi().optional(),Uu=()=>Ki().optional(),Vu=()=>Ui().optional(),Hu={string:(s=>ve.create({...s,coerce:!0})),number:(s=>Re.create({...s,coerce:!0})),boolean:(s=>Pe.create({...s,coerce:!0})),bigint:(s=>qe.create({...s,coerce:!0})),date:(s=>Me.create({...s,coerce:!0}))};var Yu=N;var Pc=Ml(Lc(),1);import{readFileSync as _m,existsSync as qc}from"fs";import{resolve as Rc,join as Sm}from"path";import{homedir as km}from"os";var Mc=["haiku","sonnet","opus"],Am=s=>{if(typeof s!="string")return null;let[e,t]=s.split("@");return{model:e,weight:Number(t)||1}},Em=Q.object({name:Q.string().min(1),url:Q.string().url(),apiKey:Q.string().min(1),models:Q.record(Q.string(),Q.string()).refine(s=>Object.keys(s).some(e=>Mc.includes(e)),{message:"\u81F3\u5C11\u9700\u8981\u4E00\u4E2A\u6709\u6548\u7684 tier (haiku/sonnet/opus)"})}),Tm=Q.object({providers:Q.array(Em).min(1),fetchTimeout:Q.number().int().positive().default(3e4)}),Om=s=>{if(s)return Rc(s);let e=Rc("ismartify.config.yaml");return qc(e)?e:Sm(km(),".keepdb","ismartify.config.yaml")},$c=s=>{let e=Om(s);if(!qc(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,Pc.parse)(_m(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=Tm.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])=>Mc.includes(o)).map(([o,c])=>{let l=Am(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 pi=(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 jc=Symbol();var Dc=async(s,e=Object.create(null))=>{let{all:t=!1,dot:r=!1}=e,i=(s instanceof gr?s.raw.headers:s.headers).get("Content-Type");return i!=null&&i.startsWith("multipart/form-data")||i!=null&&i.startsWith("application/x-www-form-urlencoded")?Nm(s,{all:t,dot:r}):{}};async function Nm(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("[]")?Cm(t,n,r):t[n]=r}),e.dot&&Object.entries(t).forEach(([r,n])=>{r.includes(".")&&(Im(t,r,n),delete t[r])}),t}var Cm=(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},Im=(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 yi=s=>{let e=s.split("/");return e[0]===""&&e.shift(),e},Bc=s=>{let{groups:e,path:t}=Lm(s),r=yi(t);return Rm(r,e)},Lm=s=>{let e=[];return s=s.replace(/\{[^}]+\}/g,(t,r)=>{let n=`@${r}`;return e.push([n,t]),n}),{groups:e,path:s}},Rm=(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},vr={},Fc=(s,e)=>{if(s==="*")return"*";let t=s.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(t){let r=`${s}#${e}`;return vr[r]||(t[2]?vr[r]=e&&e[0]!==":"&&e[0]!=="*"?[r,t[1],new RegExp(`^${t[2]}(?=/${e})`)]:[s,t[1],new RegExp(`^${t[2]}$`)]:vr[r]=[s,t[1],!0]),vr[r]}return null},br=(s,e)=>{try{return e(s)}catch{return s.replace(/(?:%[0-9A-Fa-f]{2})+/g,t=>{try{return e(t)}catch{return t}})}},qm=s=>br(s,decodeURI),gi=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 qm(c.includes("%25")?c.replace(/%25/g,"%2525"):c)}else if(n===63||n===35)break}return e.slice(t,r)};var Kc=s=>{let e=gi(s);return e.length>1&&e.at(-1)==="/"?e.slice(0,-1):e},et=(s,e,...t)=>(t.length&&(e=et(e,...t)),`${(s==null?void 0:s[0])==="/"?"":"/"}${s}${e==="/"?"":`${(s==null?void 0:s.at(-1))==="/"?"":"/"}${(e==null?void 0:e[0])==="/"?e.slice(1):e}`}`),wr=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)},mi=s=>/[%+]/.test(s)?(s.indexOf("+")!==-1&&(s=s.replace(/\+/g," ")),s.indexOf("%")!==-1?br(s,vi):s):s,Uc=(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 mi(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=mi(c)),i=a,c==="")continue;let l;o===-1?l="":(l=s.slice(o+1,a===-1?void 0:a),r&&(l=mi(l))),t?(n[c]&&Array.isArray(n[c])||(n[c]=[]),n[c].push(l)):n[c]??=l}return e?n[e]:n},Vc=Uc,Hc=(s,e)=>Uc(s,e,!0),vi=decodeURIComponent;var Yc=s=>br(s,vi),gr=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)?Yc(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)?Yc(r):r)}return s}#n(s){return this.#e[1]?this.#e[1][s]:s}query(s){return Vc(this.url,s)}queries(s){return Hc(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 Dc(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[jc](){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 Jc={Stringify:1,BeforeStream:2,Stream:3},Pm=(s,e)=>{let t=new String(s);return t.isEscaped=!0,t.callbacks=e,t};var bi=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!=null&&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=>bi(c,e,!1,r,n))).then(()=>n[0]));return t?Pm(await a,i):a};var Mm="text/plain; charset=UTF-8",wi=(s,e)=>({"Content-Type":s,...e}),ls=(s,e)=>new Response(s,e),Wc=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 gr(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||=ls(null,{headers:this.#o??=new Headers})}set res(s){if(this.#r&&s){s=ls(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=ls(this.#r.body,this.#r));let r=this.#r?this.#r.headers:this.#o??=new Headers;e===void 0?r.delete(s):t!=null&&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==null?void 0:e.status)??this.#i;return ls(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,wi(Mm,t));json=(s,e,t)=>this.#a(JSON.stringify(s),e,wi("application/json",t));html=(s,e,t)=>{let r=n=>this.#a(n,e,wi("text/html; charset=UTF-8",t));return typeof s=="object"?bi(s,Jc.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??=()=>ls(),this.#l(this))};var j="ALL",Zc="all",zc=["get","post","put","delete","options","patch"],_r="Can not add a route since the matcher is already built.",Sr=class extends Error{};var Gc="__COMPOSED_HANDLER";var $m=s=>s.text("404 Not Found",404),Qc=(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)},Xc=class el{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#t="/";routes=[];constructor(e={}){[...zc,Zc].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??gi:Kc}#e(){let e=new el({router:this.router,getPath:this.getPath});return e.errorHandler=this.errorHandler,e.#s=this.#s,e.routes=this.routes,e}#s=$m;errorHandler=Qc;route(e,t){let r=this.basePath(e);return t.routes.map(n=>{let i;t.errorHandler===Qc?i=n.handler:(i=async(a,o)=>(await pi([],t.errorHandler)(a,()=>n.handler(a,o))).res,i[Gc]=n.handler),r.#i(n.method,n.path,i)}),this}basePath(e){let t=this.#e();return t._basePath=et(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=et(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,et(e,"*"),o),this}#i(e,t,r){e=e.toUpperCase(),t=et(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 Wc(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=pi(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${et("/",e)}`,t),r,n));fire=()=>{addEventListener("fetch",e=>{e.respondWith(this.#r(e.request,e,void 0,e.request.method))})}};var kr=[];function _i(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[[],kr];let l=c.indexOf("",1);return[a[1][l],c]});return this.match=r,r(s,e)}var Ar="[^/]+",us=".*",fs="(?:|/.*)",tt=Symbol(),jm=new Set(".\\+*[^]$()");function Dm(s,e){return s.length===1?e.length===1?s<e?-1:1:-1:e.length===1||s===us||s===fs?1:e===us||e===fs?-1:s===Ar?1:e===Ar?-1:s.length===e.length?s<e?-1:1:e.length-s.length}var tl=class Si{#t;#e;#s=Object.create(null);insert(e,t,r,n,i){if(e.length===0){if(this.#t!==void 0)throw tt;if(i)return;this.#t=t;return}let[a,...o]=e,c=a==="*"?o.length===0?["","",us]:["","",Ar]:a==="/*"?["","",fs]:a.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),l;if(c){let u=c[1],f=c[2]||Ar;if(u&&c[2]&&(f===".*"||(f=f.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(f))))throw tt;if(l=this.#s[f],!l){if(Object.keys(this.#s).some(d=>d!==us&&d!==fs))throw tt;if(i)return;l=this.#s[f]=new Si,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!==us&&u!==fs))throw tt;if(i)return;l=this.#s[a]=new Si}l.insert(o,t,r,n,i)}buildRegExpStr(){let t=Object.keys(this.#s).sort(Dm).map(r=>{let n=this.#s[r];return(typeof n.#e=="number"?`(${r})@${n.#e}`:jm.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 sl=class{#t={varIndex:0};#e=new tl;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 Bm=[/^$/,[],Object.create(null)],rl=Object.create(null);function nl(s){return rl[s]??=new RegExp(s==="*"?"":`^${s.replace(/\/\*$|([.\\+*[^\]$()])/g,(e,t)=>t?`\\${t}`:"(?:|/.*)")}$`)}function Fm(){rl=Object.create(null)}function Km(s){var l;let e=new sl,t=[];if(s.length===0)return Bm;let r=s.map(u=>[!/\*|\/:/.test(u[0]),...u]).sort(([u,f],[d,h])=>u?1:d?-1:f.length-h.length),n=Object.create(null);for(let u=0,f=-1,d=r.length;u<d;u++){let[h,g,p]=r[u];h?n[g]=[p.map(([v])=>[v,Object.create(null)]),kr]:f++;let m;try{m=e.insert(g,f,h)}catch(v){throw v===tt?new Sr(g):v}h||(t[f]=p.map(([v,w])=>{let E=Object.create(null);for(w-=1;w>=0;w--){let[A,x]=m[w];E[A]=x}return[v,E]}))}let[i,a,o]=e.buildRegExp();for(let u=0,f=t.length;u<f;u++)for(let d=0,h=t[u].length;d<h;d++){let g=(l=t[u][d])==null?void 0:l[1];if(!g)continue;let p=Object.keys(g);for(let m=0,v=p.length;m<v;m++)g[p[m]]=o[g[p[m]]]}let c=[];for(let u in a)c[u]=t[a[u]];return[i,c,n]}function At(s,e){if(s){for(let t of Object.keys(s).sort((r,n)=>n.length-r.length))if(nl(t).test(e))return[...s[t]]}}var Er=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(_r);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=nl(e);s===j?Object.keys(r).forEach(c=>{r[c][e]||=At(r[c],e)||At(r[j],e)||[]}):r[s][e]||=At(r[s],e)||At(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=wr(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]||=[...At(r[u],l)||At(r[j],l)||[]],n[u][l].push([t,i-c+o+1]))})}}match=_i;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,Fm(),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?Km(e):null}};var ki=class{name="SmartRouter";#t=[];#e=[];constructor(s){this.#t=s.routers}add(s,e,t){if(!this.#e)throw new Error(_r);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 Sr)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 ds=Object.create(null),Um=s=>{for(let e in s)return!0;return!1},il=class al{#t;#e;#s;#i=0;#n=ds;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=Bc(t),a=[];for(let o=0,c=i.length;o<c;o++){let l=i[o],u=i[o+1],f=Fc(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 al,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!==ds||i&&i!==ds))for(let f=0,d=l.possibleKeys.length;f<d;f++){let h=l.possibleKeys[f],g=u[l.score];l.params[h]=i!=null&&i[h]&&!g?i[h]:n[h]??(i==null?void 0:i[h]),u[l.score]=!0}}}search(e,t){var u;let r=[];this.#n=ds;let i=[this],a=yi(t),o=[],c=a.length,l=null;for(let f=0;f<c;f++){let d=a[f],h=f===c-1,g=[];for(let m=0,v=i.length;m<v;m++){let w=i[m],E=w.#e[d];E&&(E.#n=w.#n,h?(E.#e["*"]&&this.#r(r,E.#e["*"],e,w.#n),this.#r(r,E,e,w.#n)):g.push(E));for(let A=0,x=w.#s.length;A<x;A++){let q=w.#s[A],O=w.#n===ds?{}:{...w.#n};if(q==="*"){let U=w.#e["*"];U&&(this.#r(r,U,e,w.#n),U.#n=O,g.push(U));continue}let[T,$,D]=q;if(!d&&!(D instanceof RegExp))continue;let F=w.#e[T];if(D instanceof RegExp){if(l===null){l=new Array(c);let Ie=t[0]==="/"?1:0;for(let Nt=0;Nt<c;Nt++)l[Nt]=Ie,Ie+=a[Nt].length+1}let U=t.substring(l[f]),J=D.exec(U);if(J){if(O[$]=J[0],this.#r(r,F,e,w.#n,O),Um(F.#e)){F.#n=O;let Ie=((u=J[0].match(/\//))==null?void 0:u.length)??0;(o[Ie]||=[]).push(F)}continue}}(D===!0||D.test(d))&&(O[$]=d,h?(this.#r(r,F,e,O,w.#n),F.#e["*"]&&this.#r(r,F.#e["*"],e,O,w.#n)):(F.#n=O,g.push(F)))}}let p=o.shift();i=p?g.concat(p):g}return r.length>1&&r.sort((f,d)=>f.score-d.score),[r.map(({handler:f,params:d})=>[f,d])]}};var Ai=class{name="TrieRouter";#t;constructor(){this.#t=new il}add(s,e,t){let r=wr(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 st=class extends Xc{constructor(s={}){super(s),this.router=s.router??new ki({routers:[new Er,new Ai]})}};function Vm(){let{process:s,Deno:e}=globalThis;return!(typeof(e==null?void 0:e.noColor)=="boolean"?e.noColor:s!==void 0?"NO_COLOR"in(s==null?void 0:s.env):!1)}async function ol(){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}})():!Vm())}var Hm=s=>{let[e,t]=[",","."];return s.map(n=>n.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+e)).join(t)},Ym=s=>{let e=Date.now()-s;return Hm([e<1e3?e+"ms":Math.round(e/1e3)+"s"])},Jm=async s=>{if(await ol())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 cl(s,e,t,r,n=0,i){let a=e==="<--"?`${e} ${t} ${r}`:`${e} ${t} ${r} ${await Jm(n)} ${i}`;s(a)}var ll=(s=console.log)=>async function(t,r){let{method:n,url:i}=t.req,a=i.slice(i.indexOf("/",8));await cl(s,"<--",n,a);let o=Date.now();await r(),await cl(s,"-->",n,a,t.res.status,Ym(o))};var Ei=s=>{let e=new st;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 ul="sonnet",Ti=["opus","sonnet","haiku"],fl=s=>{if(!s||typeof s!="string")return ul;let e=s.toLowerCase();return e.includes("haiku")?"haiku":e.includes("opus")?"opus":e.includes("sonnet")?"sonnet":ul},dl=s=>{let e=Ti.indexOf(s);return e===-1?Ti:Ti.slice(e)};var hl=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 pl=s=>{let e=hl(s.slots);return{forward:async({path:r,method:n,jsonBody:i,signal:a})=>{var u;let o=fl(i==null?void 0:i.model),c=dl(o),l=[];for(let f of c){let d=e.countByTier(f);for(let h=0;h<d;h++){let g=e.select(f,l);if(!g)break;l.push(g.originalIndex);let p=s.getProvider(g.provider);if(!p)continue;let m=i?JSON.stringify({...i,model:g.targetModel}):void 0;try{let v=new AbortController,w=()=>v.abort();a==null||a.addEventListener("abort",w,{once:!0});let E=setTimeout(()=>v.abort(),s.fetchTimeout);try{let A=await fetch(`${p.url}${r}`,{method:n,headers:{"Content-Type":"application/json","Anthropic-Version":"2023-06-01","x-api-key":p.apiKey,"Accept-Encoding":"identity"},body:m,duplex:"half",signal:v.signal});if(A.status===429||A.status>=500){console.warn(`[Fallback] ${p.name} (${g.targetModel}) -> ${A.status}`),await((u=A.body)==null?void 0:u.cancel());continue}let{readable:q,writable:O}=new TransformStream;return A.body.pipeTo(O).catch(T=>{T.name!=="AbortError"&&console.warn(`[Stream] ${p.name}: ${T.message}`)}),new Response(q,{status:A.status,headers:A.headers})}finally{clearTimeout(E),a==null||a.removeEventListener("abort",w)}}catch(v){v.name!=="AbortError"&&console.warn(`[Error] ${p.name}: ${v.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 ml=s=>{let e=pl(s),t=new st;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 yl=s=>{let e=new st;return e.use("*",ll()),e.route("/config",Ei(s)),e.route("/status",Ei(s)),e.route("/anthropic/v1",ml(s)),e};import{createServer as Wm}from"http";import{Http2ServerRequest as wl,constants as Zm}from"http2";import{Http2ServerRequest as Oi}from"http2";import{Readable as gl}from"stream";import oy from"crypto";var rt=class extends Error{constructor(s,e){super(s,e),this.name="RequestError"}},zm=s=>s instanceof rt?s:new rt(s.message,{cause:s}),Gm=global.Request,hs=class extends Gm{constructor(s,e){var t;typeof s=="object"&&Ot in s&&(s=s[Ot]()),typeof((t=e==null?void 0:e.body)==null?void 0:t.getReader)<"u"&&(e.duplex??="half"),super(s,e)}},Qm=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)},_l=Symbol("wrapBodyStream"),Xm=(s,e,t,r,n)=>{let i={method:s,headers:t,signal:n.signal};if(s==="TRACE"){i.method="GET";let a=new hs(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[_l]){let a;i.body=new ReadableStream({async pull(o){try{a||=gl.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=gl.toWeb(r);return new hs(e,i)},Ot=Symbol("getRequestCache"),ey=Symbol("requestCache"),Tr=Symbol("incomingKey"),Or=Symbol("urlKey"),ty=Symbol("headersKey"),Tt=Symbol("abortControllerKey"),sy=Symbol("getAbortController"),Nr={get method(){return this[Tr].method||"GET"},get url(){return this[Or]},get headers(){return this[ty]||=Qm(this[Tr])},[sy](){return this[Ot](),this[Tt]},[Ot](){return this[Tt]||=new AbortController,this[ey]||=Xm(this.method,this[Or],this.headers,this[Tr],this[Tt])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(s=>{Object.defineProperty(Nr,s,{get(){return this[Ot]()[s]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(s=>{Object.defineProperty(Nr,s,{value:function(){return this[Ot]()[s]()}})});Object.setPrototypeOf(Nr,hs.prototype);var ry=(s,e)=>{let t=Object.create(Nr);t[Tr]=s;let r=s.url||"";if(r[0]!=="/"&&(r.startsWith("http://")||r.startsWith("https://"))){if(s instanceof Oi)throw new rt("Absolute URL for :path is not allowed in HTTP/2");try{let o=new URL(r);t[Or]=o.href}catch(o){throw new rt("Invalid absolute URL",{cause:o})}return t}let n=(s instanceof Oi?s.authority:s.headers.host)||e;if(!n)throw new rt("Missing host header");let i;if(s instanceof Oi){if(i=s.scheme,!(i==="http"||i==="https"))throw new rt("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 rt("Invalid host header");return t[Or]=a.href,t},vl=Symbol("responseCache"),Et=Symbol("getResponseCache"),nt=Symbol("cache"),Ii=global.Response,ps=class Sl{#t;#e;[Et](){return delete this[nt],this[vl]||=new Ii(this.#t,this.#e)}constructor(e,t){let r;if(this.#t=e,t instanceof Sl){let n=t[vl];if(n){this.#e=n,this[Et]();return}else this.#e=t.#e,r=new Headers(t.#e.headers)}else this.#e=t;(typeof e=="string"||typeof(e==null?void 0:e.getReader)<"u"||e instanceof Blob||e instanceof Uint8Array)&&(this[nt]=[(t==null?void 0:t.status)||200,e,r||(t==null?void 0:t.headers)])}get headers(){let e=this[nt];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":"text/plain; charset=UTF-8"})),e[2]):this[Et]().headers}get status(){var e;return((e=this[nt])==null?void 0:e[0])??this[Et]().status}get ok(){let e=this.status;return e>=200&&e<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(s=>{Object.defineProperty(ps.prototype,s,{get(){return this[Et]()[s]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(s=>{Object.defineProperty(ps.prototype,s,{value:function(){return this[Et]()[s]()}})});Object.setPrototypeOf(ps,Ii);Object.setPrototypeOf(ps.prototype,Ii.prototype);async function ny(s){return Promise.race([s,Promise.resolve().then(()=>Promise.resolve(void 0))])}function kl(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 iy(s,e){if(s.locked)throw new TypeError("ReadableStream is locked.");return e.destroyed?void 0:kl(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},ay="x-hono-already-sent";typeof global.crypto>"u"&&(global.crypto=oy);var Li=Symbol("outgoingEnded"),bl=Symbol("incomingDraining"),cy=500,ly=64*1024*1024,Ni=s=>{var o,c,l;let e=s;if(s.destroyed||e[bl])return;if(e[bl]=!0,s instanceof wl){try{(c=(o=s.stream)==null?void 0:o.close)==null||c.call(o,Zm.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 u=s.socket;u&&!u.destroyed&&u.destroySoon()},i=setTimeout(n,cy);(l=i.unref)==null||l.call(i);let a=u=>{t+=u.length,t>ly&&n()};s.on("data",a),s.on("end",r),s.on("error",r),s.resume()},uy=()=>new Response(null,{status:400}),Al=s=>new Response(null,{status:s instanceof Error&&(s.name==="TimeoutError"||s.constructor.name==="TimeoutError")?504:500}),Ci=(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))},El=s=>{"flushHeaders"in s&&s.writable&&s.flushHeaders()},Tl=async(s,e)=>{var a,o;let[t,r,n]=s[nt],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 c=new Headers(n);i=c.has("content-length"),n=xi(c)}else for(let c in n)if(c.length===14&&c.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())):(El(e),await((a=iy(r,e))==null?void 0:a.catch(c=>Ci(c,e)))),(o=e[Li])==null||o.call(e)},fy=s=>typeof s.then=="function",dy=async(s,e,t={})=>{var n;if(fy(s))if(t.errorHandler)try{s=await s}catch(i){let a=await t.errorHandler(i);if(!a)return;s=a}else s=await s.catch(Al);if(nt in s)return Tl(s,e);let r=xi(s.headers);if(s.body){let i=s.body.getReader(),a=[],o=!1,c;if(r["transfer-encoding"]!=="chunked"){let l=2;for(let u=0;u<l;u++){c||=i.read();let f=await ny(c).catch(d=>{console.error(d),o=!0});if(!f){if(u===1){await new Promise(d=>setTimeout(d)),l=3;continue}break}if(c=void 0,f.value&&a.push(f.value),f.done){o=!0;break}}o&&!("content-length"in r)&&(r["content-length"]=a.reduce((u,f)=>u+f.length,0))}e.writeHead(s.status,r),a.forEach(l=>{e.write(l)}),o?e.end():(a.length===0&&El(e),await kl(i,e,c))}else r[ay]||(e.writeHead(s.status,r),e.end());(n=e[Li])==null||n.call(e)},hy=(s,e={})=>{let t=e.autoCleanupIncoming??!0;return e.overrideGlobalObjects!==!1&&global.Request!==hs&&(Object.defineProperty(global,"Request",{value:hs}),Object.defineProperty(global,"Response",{value:ps})),async(r,n)=>{let i,a;try{a=ry(r,e.hostname);let o=!t||r.method==="GET"||r.method==="HEAD";if(o||(r[_l]=!0,r.on("end",()=>{o=!0}),r instanceof wl&&(n[Li]=()=>{o||setTimeout(()=>{o||setTimeout(()=>{Ni(r)})})}),n.on("finish",()=>{o||Ni(r)})),n.on("close",()=>{a[Tt]&&(r.errored?a[Tt].abort(r.errored.toString()):n.writableFinished||a[Tt].abort("Client connection prematurely closed.")),o||setTimeout(()=>{o||setTimeout(()=>{Ni(r)})})}),i=s(a,{incoming:r,outgoing:n}),nt in i)return Tl(i,n)}catch(o){if(i)return Ci(o,n);if(e.errorHandler){if(i=await e.errorHandler(a?o:zm(o)),!i)return}else a?i=Al(o):i=uy()}try{return await dy(i,n,e)}catch(o){return Ci(o,n)}}},py=s=>{let e=s.fetch,t=hy(e,{hostname:s.hostname,overrideGlobalObjects:s.overrideGlobalObjects,autoCleanupIncoming:s.autoCleanupIncoming});return(s.createServer||Wm)(s.serverOptions||{},t)},Ol=(s,e)=>{let t=py(s);return t.listen((s==null?void 0:s.port)??3e3,s.hostname,()=>{let r=t.address();e&&e(r)}),t};var my=`
|
|
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(),Nl=s=>s&&!s.startsWith("-"),yy=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"&&Nl(e[r+1]))t.config=e[++r];else if(n==="--port"&&Nl(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},gy=()=>{let{command:s,config:e,port:t}=yy(process.argv);s!=="start"&&(console.log(my),process.exit(s?1:0));let r;try{r=$c(e)}catch(i){console.error(`\u914D\u7F6E\u52A0\u8F7D\u5931\u8D25: ${i.message}`),process.exit(1)}let n=yl(r);Ol({fetch:n.fetch,port:t||6110},i=>{console.log(`@keepdb/cc \u4EE3\u7406\u670D\u52A1\u5DF2\u542F\u52A8: http://localhost:${i.port}`)})};gy();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keepdb/cc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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",
|