gigabuddy 0.6.0 → 0.7.0

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/index.js CHANGED
@@ -1,85 +1,85 @@
1
- var Mg=Object.create;var es=Object.defineProperty;var qg=Object.getOwnPropertyDescriptor;var Ug=Object.getOwnPropertyNames;var Lg=Object.getPrototypeOf,Fg=Object.prototype.hasOwnProperty;var z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ts=(e,t)=>{for(var r in t)es(e,r,{get:t[r],enumerable:!0})},Vg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ug(t))!Fg.call(e,o)&&o!==r&&es(e,o,{get:()=>t[o],enumerable:!(n=qg(t,o))||n.enumerable});return e};var Hg=(e,t,r)=>(r=e!=null?Mg(Lg(e)):{},Vg(t||!e||!e.__esModule?es(r,"default",{value:e,enumerable:!0}):r,e));var Xr=z(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.regexpCode=q.getEsmExportName=q.getProperty=q.safeStringify=q.stringify=q.strConcat=q.addCodeArg=q.str=q._=q.nil=q._Code=q.Name=q.IDENTIFIER=q._CodeOrName=void 0;var Yr=class{};q._CodeOrName=Yr;q.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var It=class extends Yr{constructor(t){if(super(),!q.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};q.Name=It;var Ze=class extends Yr{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof It&&(r[n.str]=(r[n.str]||0)+1),r),{})}};q._Code=Ze;q.nil=new Ze("");function Sf(e,...t){let r=[e[0]],n=0;for(;n<t.length;)ki(r,t[n]),r.push(e[++n]);return new Ze(r)}q._=Sf;var zi=new Ze("+");function Pf(e,...t){let r=[Qr(e[0])],n=0;for(;n<t.length;)r.push(zi),ki(r,t[n]),r.push(zi,Qr(e[++n]));return v$(r),new Ze(r)}q.str=Pf;function ki(e,t){t instanceof Ze?e.push(...t._items):t instanceof It?e.push(t):e.push(b$(t))}q.addCodeArg=ki;function v$(e){let t=1;for(;t<e.length-1;){if(e[t]===zi){let r=$$(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function $$(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof It||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof It))return`"${e}${t.slice(1)}`}function w$(e,t){return t.emptyStr()?e:e.emptyStr()?t:Pf`${e}${t}`}q.strConcat=w$;function b$(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Qr(Array.isArray(e)?e.join(","):e)}function x$(e){return new Ze(Qr(e))}q.stringify=x$;function Qr(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}q.safeStringify=Qr;function z$(e){return typeof e=="string"&&q.IDENTIFIER.test(e)?new Ze(`.${e}`):Sf`[${e}]`}q.getProperty=z$;function k$(e){if(typeof e=="string"&&q.IDENTIFIER.test(e))return new Ze(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}q.getEsmExportName=k$;function S$(e){return new Ze(e.toString())}q.regexpCode=S$});var Ti=z(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.ValueScope=ze.ValueScopeName=ze.Scope=ze.varKinds=ze.UsedValueState=void 0;var xe=Xr(),Si=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},fo;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(fo||(ze.UsedValueState=fo={}));ze.varKinds={const:new xe.Name("const"),let:new xe.Name("let"),var:new xe.Name("var")};var mo=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof xe.Name?t:this.name(t)}name(t){return new xe.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};ze.Scope=mo;var ho=class extends xe.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,xe._)`.${new xe.Name(r)}[${n}]`}};ze.ValueScopeName=ho;var P$=(0,xe._)`\n`,Pi=class extends mo{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?P$:xe.nil}}get(){return this._scope}name(t){return new ho(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,xe._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let s=xe.nil;for(let i in t){let a=t[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,fo.Started);let l=r(u);if(l){let p=this.opts.es5?ze.varKinds.var:ze.varKinds.const;s=(0,xe._)`${s}${p} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,xe._)`${s}${l}${this.opts._n}`;else throw new Si(u);c.set(u,fo.Completed)})}return s}};ze.ValueScope=Pi});var C=z(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.or=N.and=N.not=N.CodeGen=N.operators=N.varKinds=N.ValueScopeName=N.ValueScope=N.Scope=N.Name=N.regexpCode=N.stringify=N.getProperty=N.nil=N.strConcat=N.str=N._=void 0;var Z=Xr(),Ve=Ti(),$t=Xr();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return $t._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return $t.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return $t.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return $t.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return $t.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return $t.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return $t.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return $t.Name}});var vo=Ti();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return vo.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return vo.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return vo.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return vo.varKinds}});N.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};var ut=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Ei=class extends ut{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?Ve.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=rr(this.rhs,t,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},go=class extends ut{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof Z.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=rr(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return yo(t,this.rhs)}},Ri=class extends go{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Ii=class extends ut{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Oi=class extends ut{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Ci=class extends ut{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Ni=class extends ut{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=rr(this.code,t,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},en=class extends ut{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(t,r)||(T$(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Nt(t,r.names),{})}},lt=class extends en{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Ai=class extends en{},tr=class extends lt{};tr.kind="else";var Ot=class e extends lt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new tr(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(Tf(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=rr(this.condition,t,r),this}get names(){let t=super.names;return yo(t,this.condition),this.else&&Nt(t,this.else.names),t}};Ot.kind="if";var Ct=class extends lt{};Ct.kind="for";var ji=class extends Ct{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=rr(this.iteration,t,r),this}get names(){return Nt(super.names,this.iteration.names)}},Zi=class extends Ct{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?Ve.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=yo(super.names,this.from);return yo(t,this.to)}},_o=class extends Ct{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=rr(this.iterable,t,r),this}get names(){return Nt(super.names,this.iterable.names)}},tn=class extends lt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};tn.kind="func";var rn=class extends en{render(t){return"return "+super.render(t)}};rn.kind="return";var Di=class extends lt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Nt(t,this.catch.names),this.finally&&Nt(t,this.finally.names),t}},nn=class extends lt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};nn.kind="catch";var on=class extends lt{render(t){return"finally"+super.render(t)}};on.kind="finally";var Mi=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
2
- `:""},this._extScope=t,this._scope=new Ve.Scope({parent:t}),this._nodes=[new Ai]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Ei(t,s,n)),s}const(t,r,n){return this._def(Ve.varKinds.const,t,r,n)}let(t,r,n){return this._def(Ve.varKinds.let,t,r,n)}var(t,r,n){return this._def(Ve.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new go(t,r,n))}add(t,r){return this._leafNode(new Ri(t,N.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Z.nil&&this._leafNode(new Ni(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,o));return r.push("}"),new Z._Code(r)}if(t,r,n){if(this._blockNode(new Ot(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Ot(t))}else(){return this._elseNode(new tr)}endIf(){return this._endBlockNode(Ot,tr)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new ji(t),r)}forRange(t,r,n,o,s=this.opts.es5?Ve.varKinds.var:Ve.varKinds.let){let i=this._scope.toName(t);return this._for(new Zi(s,i,r,n),()=>o(i))}forOf(t,r,n,o=Ve.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof Z.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Z._)`${i}.length`,a=>{this.var(s,(0,Z._)`${i}[${a}]`),n(s)})}return this._for(new _o("of",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?Ve.varKinds.var:Ve.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Z._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new _o("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(Ct)}label(t){return this._leafNode(new Ii(t))}break(t){return this._leafNode(new Oi(t))}return(t){let r=new rn;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(rn)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Di;if(this._blockNode(o),this.code(t),r){let s=this.name("e");this._currNode=o.catch=new nn(s),r(s)}return n&&(this._currNode=o.finally=new on,this.code(n)),this._endBlockNode(nn,on)}throw(t){return this._leafNode(new Ci(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=Z.nil,n,o){return this._blockNode(new tn(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(tn)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Ot))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};N.CodeGen=Mi;function Nt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function yo(e,t){return t instanceof Z._CodeOrName?Nt(e,t.names):e}function rr(e,t,r){if(e instanceof Z.Name)return n(e);if(!o(e))return e;return new Z._Code(e._items.reduce((s,i)=>(i instanceof Z.Name&&(i=n(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function o(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function T$(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Tf(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Z._)`!${qi(e)}`}N.not=Tf;var E$=Ef(N.operators.AND);function R$(...e){return e.reduce(E$)}N.and=R$;var I$=Ef(N.operators.OR);function O$(...e){return e.reduce(I$)}N.or=O$;function Ef(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:(0,Z._)`${qi(t)} ${e} ${qi(r)}`}function qi(e){return e instanceof Z.Name?e:(0,Z._)`(${e})`}});var D=z(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.checkStrictMode=A.getErrorPath=A.Type=A.useFunc=A.setEvaluated=A.evaluatedPropsToName=A.mergeEvaluated=A.eachItem=A.unescapeJsonPointer=A.escapeJsonPointer=A.escapeFragment=A.unescapeFragment=A.schemaRefOrVal=A.schemaHasRulesButRef=A.schemaHasRules=A.checkUnknownRules=A.alwaysValidSchema=A.toHash=void 0;var K=C(),C$=Xr();function N$(e){let t={};for(let r of e)t[r]=!0;return t}A.toHash=N$;function A$(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Of(e,t),!Cf(t,e.self.RULES.all))}A.alwaysValidSchema=A$;function Of(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let s in t)o[s]||jf(e,`unknown keyword: "${s}"`)}A.checkUnknownRules=Of;function Cf(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}A.schemaHasRules=Cf;function j$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}A.schemaHasRulesButRef=j$;function Z$({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,K._)`${r}`}return(0,K._)`${e}${t}${(0,K.getProperty)(n)}`}A.schemaRefOrVal=Z$;function D$(e){return Nf(decodeURIComponent(e))}A.unescapeFragment=D$;function M$(e){return encodeURIComponent(Li(e))}A.escapeFragment=M$;function Li(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}A.escapeJsonPointer=Li;function Nf(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}A.unescapeJsonPointer=Nf;function q$(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}A.eachItem=q$;function Rf({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof K.Name?(s instanceof K.Name?e(o,s,i):t(o,s,i),i):s instanceof K.Name?(t(o,i,s),s):r(s,i);return a===K.Name&&!(c instanceof K.Name)?n(o,c):c}}A.mergeEvaluated={props:Rf({mergeNames:(e,t,r)=>e.if((0,K._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,K._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,K._)`${r} || {}`).code((0,K._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,K._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,K._)`${r} || {}`),Fi(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Af}),items:Rf({mergeNames:(e,t,r)=>e.if((0,K._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,K._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,K._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,K._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Af(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,K._)`{}`);return t!==void 0&&Fi(e,r,t),r}A.evaluatedPropsToName=Af;function Fi(e,t,r){Object.keys(r).forEach(n=>e.assign((0,K._)`${t}${(0,K.getProperty)(n)}`,!0))}A.setEvaluated=Fi;var If={};function U$(e,t){return e.scopeValue("func",{ref:t,code:If[t.code]||(If[t.code]=new C$._Code(t.code))})}A.useFunc=U$;var Ui;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ui||(A.Type=Ui={}));function L$(e,t,r){if(e instanceof K.Name){let n=t===Ui.Num;return r?n?(0,K._)`"[" + ${e} + "]"`:(0,K._)`"['" + ${e} + "']"`:n?(0,K._)`"/" + ${e}`:(0,K._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,K.getProperty)(e).toString():"/"+Li(e)}A.getErrorPath=L$;function jf(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}A.checkStrictMode=jf});var dt=z(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});var he=C(),F$={data:new he.Name("data"),valCxt:new he.Name("valCxt"),instancePath:new he.Name("instancePath"),parentData:new he.Name("parentData"),parentDataProperty:new he.Name("parentDataProperty"),rootData:new he.Name("rootData"),dynamicAnchors:new he.Name("dynamicAnchors"),vErrors:new he.Name("vErrors"),errors:new he.Name("errors"),this:new he.Name("this"),self:new he.Name("self"),scope:new he.Name("scope"),json:new he.Name("json"),jsonPos:new he.Name("jsonPos"),jsonLen:new he.Name("jsonLen"),jsonPart:new he.Name("jsonPart")};Vi.default=F$});var sn=z(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.extendErrors=ge.resetErrorsCount=ge.reportExtraError=ge.reportError=ge.keyword$DataError=ge.keywordError=void 0;var M=C(),$o=D(),ve=dt();ge.keywordError={message:({keyword:e})=>(0,M.str)`must pass "${e}" keyword validation`};ge.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,M.str)`"${e}" keyword must be ${t} ($data)`:(0,M.str)`"${e}" keyword is invalid ($data)`};function V$(e,t=ge.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=Mf(e,t,r);n??(i||a)?Zf(s,c):Df(o,(0,M._)`[${c}]`)}ge.reportError=V$;function H$(e,t=ge.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=Mf(e,t,r);Zf(o,a),s||i||Df(n,ve.default.vErrors)}ge.reportExtraError=H$;function J$(e,t){e.assign(ve.default.errors,t),e.if((0,M._)`${ve.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,M._)`${ve.default.vErrors}.length`,t),()=>e.assign(ve.default.vErrors,null)))}ge.resetErrorsCount=J$;function K$({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,ve.default.errors,a=>{e.const(i,(0,M._)`${ve.default.vErrors}[${a}]`),e.if((0,M._)`${i}.instancePath === undefined`,()=>e.assign((0,M._)`${i}.instancePath`,(0,M.strConcat)(ve.default.instancePath,s.errorPath))),e.assign((0,M._)`${i}.schemaPath`,(0,M.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,M._)`${i}.schema`,r),e.assign((0,M._)`${i}.data`,n))})}ge.extendErrors=K$;function Zf(e,t){let r=e.const("err",t);e.if((0,M._)`${ve.default.vErrors} === null`,()=>e.assign(ve.default.vErrors,(0,M._)`[${r}]`),(0,M._)`${ve.default.vErrors}.push(${r})`),e.code((0,M._)`${ve.default.errors}++`)}function Df(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,M._)`new ${e.ValidationError}(${t})`):(r.assign((0,M._)`${n}.errors`,t),r.return(!1))}var At={keyword:new M.Name("keyword"),schemaPath:new M.Name("schemaPath"),params:new M.Name("params"),propertyName:new M.Name("propertyName"),message:new M.Name("message"),schema:new M.Name("schema"),parentSchema:new M.Name("parentSchema")};function Mf(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,M._)`{}`:G$(e,t,r)}function G$(e,t,r={}){let{gen:n,it:o}=e,s=[B$(o,r),W$(e,r)];return Y$(e,t,s),n.object(...s)}function B$({errorPath:e},{instancePath:t}){let r=t?(0,M.str)`${e}${(0,$o.getErrorPath)(t,$o.Type.Str)}`:e;return[ve.default.instancePath,(0,M.strConcat)(ve.default.instancePath,r)]}function W$({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,M.str)`${t}/${e}`;return r&&(o=(0,M.str)`${o}${(0,$o.getErrorPath)(r,$o.Type.Str)}`),[At.schemaPath,o]}function Y$(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:p}=a;n.push([At.keyword,o],[At.params,typeof t=="function"?t(e):t||(0,M._)`{}`]),c.messages&&n.push([At.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([At.schema,i],[At.parentSchema,(0,M._)`${l}${p}`],[ve.default.data,s]),u&&n.push([At.propertyName,u])}});var Uf=z(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.boolOrEmptySchema=nr.topBoolOrEmptySchema=void 0;var Q$=sn(),X$=C(),ew=dt(),tw={message:"boolean schema is false"};function rw(e){let{gen:t,schema:r,validateName:n}=e;r===!1?qf(e,!1):typeof r=="object"&&r.$async===!0?t.return(ew.default.data):(t.assign((0,X$._)`${n}.errors`,null),t.return(!0))}nr.topBoolOrEmptySchema=rw;function nw(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),qf(e)):r.var(t,!0)}nr.boolOrEmptySchema=nw;function qf(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Q$.reportError)(o,tw,void 0,t)}});var Hi=z(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.getRules=or.isJSONType=void 0;var ow=["string","number","integer","boolean","null","object","array"],sw=new Set(ow);function iw(e){return typeof e=="string"&&sw.has(e)}or.isJSONType=iw;function aw(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}or.getRules=aw});var Ji=z(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.shouldUseRule=wt.shouldUseGroup=wt.schemaHasRulesForType=void 0;function cw({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Lf(e,n)}wt.schemaHasRulesForType=cw;function Lf(e,t){return t.rules.some(r=>Ff(e,r))}wt.shouldUseGroup=Lf;function Ff(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}wt.shouldUseRule=Ff});var an=z(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.reportTypeError=_e.checkDataTypes=_e.checkDataType=_e.coerceAndCheckDataType=_e.getJSONTypes=_e.getSchemaTypes=_e.DataType=void 0;var uw=Hi(),lw=Ji(),dw=sn(),O=C(),Vf=D(),sr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(sr||(_e.DataType=sr={}));function pw(e){let t=Hf(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}_e.getSchemaTypes=pw;function Hf(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(uw.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}_e.getJSONTypes=Hf;function fw(e,t){let{gen:r,data:n,opts:o}=e,s=mw(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,lw.schemaHasRulesForType)(e,t[0]));if(i){let a=Gi(t,n,o.strictNumbers,sr.Wrong);r.if(a,()=>{s.length?hw(e,t,s):Bi(e)})}return i}_e.coerceAndCheckDataType=fw;var Jf=new Set(["string","number","integer","boolean","null"]);function mw(e,t){return t?e.filter(r=>Jf.has(r)||t==="array"&&r==="array"):[]}function hw(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",(0,O._)`typeof ${o}`),a=n.let("coerced",(0,O._)`undefined`);s.coerceTypes==="array"&&n.if((0,O._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,O._)`${o}[0]`).assign(i,(0,O._)`typeof ${o}`).if(Gi(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,O._)`${a} !== undefined`);for(let u of r)(Jf.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),Bi(e),n.endIf(),n.if((0,O._)`${a} !== undefined`,()=>{n.assign(o,a),gw(e,a)});function c(u){switch(u){case"string":n.elseIf((0,O._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,O._)`"" + ${o}`).elseIf((0,O._)`${o} === null`).assign(a,(0,O._)`""`);return;case"number":n.elseIf((0,O._)`${i} == "boolean" || ${o} === null
1
+ var c_=Object.create;var os=Object.defineProperty;var u_=Object.getOwnPropertyDescriptor;var l_=Object.getOwnPropertyNames;var d_=Object.getPrototypeOf,p_=Object.prototype.hasOwnProperty;var z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ss=(e,t)=>{for(var r in t)os(e,r,{get:t[r],enumerable:!0})},f_=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of l_(t))!p_.call(e,o)&&o!==r&&os(e,o,{get:()=>t[o],enumerable:!(n=u_(t,o))||n.enumerable});return e};var m_=(e,t,r)=>(r=e!=null?c_(d_(e)):{},f_(t||!e||!e.__esModule?os(r,"default",{value:e,enumerable:!0}):r,e));var tn=z(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.regexpCode=q.getEsmExportName=q.getProperty=q.safeStringify=q.stringify=q.strConcat=q.addCodeArg=q.str=q._=q.nil=q._Code=q.Name=q.IDENTIFIER=q._CodeOrName=void 0;var Xr=class{};q._CodeOrName=Xr;q.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var It=class extends Xr{constructor(t){if(super(),!q.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};q.Name=It;var Me=class extends Xr{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof It&&(r[n.str]=(r[n.str]||0)+1),r),{})}};q._Code=Me;q.nil=new Me("");function Af(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Ei(r,t[n]),r.push(e[++n]);return new Me(r)}q._=Af;var Ti=new Me("+");function jf(e,...t){let r=[en(e[0])],n=0;for(;n<t.length;)r.push(Ti),Ei(r,t[n]),r.push(Ti,en(e[++n]));return L$(r),new Me(r)}q.str=jf;function Ei(e,t){t instanceof Me?e.push(...t._items):t instanceof It?e.push(t):e.push(H$(t))}q.addCodeArg=Ei;function L$(e){let t=1;for(;t<e.length-1;){if(e[t]===Ti){let r=F$(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function F$(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof It||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof It))return`"${e}${t.slice(1)}`}function V$(e,t){return t.emptyStr()?e:e.emptyStr()?t:jf`${e}${t}`}q.strConcat=V$;function H$(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:en(Array.isArray(e)?e.join(","):e)}function J$(e){return new Me(en(e))}q.stringify=J$;function en(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}q.safeStringify=en;function K$(e){return typeof e=="string"&&q.IDENTIFIER.test(e)?new Me(`.${e}`):Af`[${e}]`}q.getProperty=K$;function B$(e){if(typeof e=="string"&&q.IDENTIFIER.test(e))return new Me(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}q.getEsmExportName=B$;function G$(e){return new Me(e.toString())}q.regexpCode=G$});var Oi=z(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.ValueScope=Se.ValueScopeName=Se.Scope=Se.varKinds=Se.UsedValueState=void 0;var ze=tn(),Ri=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},go;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(go||(Se.UsedValueState=go={}));Se.varKinds={const:new ze.Name("const"),let:new ze.Name("let"),var:new ze.Name("var")};var _o=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof ze.Name?t:this.name(t)}name(t){return new ze.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Se.Scope=_o;var yo=class extends ze.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,ze._)`.${new ze.Name(r)}[${n}]`}};Se.ValueScopeName=yo;var W$=(0,ze._)`\n`,Ii=class extends _o{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?W$:ze.nil}}get(){return this._scope}name(t){return new yo(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,ze._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let s=ze.nil;for(let i in t){let a=t[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,go.Started);let l=r(u);if(l){let p=this.opts.es5?Se.varKinds.var:Se.varKinds.const;s=(0,ze._)`${s}${p} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,ze._)`${s}${l}${this.opts._n}`;else throw new Ri(u);c.set(u,go.Completed)})}return s}};Se.ValueScope=Ii});var C=z(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.or=N.and=N.not=N.CodeGen=N.operators=N.varKinds=N.ValueScopeName=N.ValueScope=N.Scope=N.Name=N.regexpCode=N.stringify=N.getProperty=N.nil=N.strConcat=N.str=N._=void 0;var Z=tn(),Je=Oi(),$t=tn();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return $t._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return $t.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return $t.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return $t.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return $t.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return $t.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return $t.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return $t.Name}});var bo=Oi();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return bo.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return bo.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return bo.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return bo.varKinds}});N.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};var lt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Ci=class extends lt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?Je.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=or(this.rhs,t,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},vo=class extends lt{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof Z.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=or(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return wo(t,this.rhs)}},Ni=class extends vo{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Ai=class extends lt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},ji=class extends lt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Zi=class extends lt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Di=class extends lt{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=or(this.code,t,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},rn=class extends lt{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(t,r)||(Y$(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Nt(t,r.names),{})}},dt=class extends rn{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Mi=class extends rn{},nr=class extends dt{};nr.kind="else";var Ot=class e extends dt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new nr(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(Zf(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=or(this.condition,t,r),this}get names(){let t=super.names;return wo(t,this.condition),this.else&&Nt(t,this.else.names),t}};Ot.kind="if";var Ct=class extends dt{};Ct.kind="for";var qi=class extends Ct{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=or(this.iteration,t,r),this}get names(){return Nt(super.names,this.iteration.names)}},Ui=class extends Ct{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?Je.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=wo(super.names,this.from);return wo(t,this.to)}},$o=class extends Ct{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=or(this.iterable,t,r),this}get names(){return Nt(super.names,this.iterable.names)}},nn=class extends dt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};nn.kind="func";var on=class extends rn{render(t){return"return "+super.render(t)}};on.kind="return";var Li=class extends dt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Nt(t,this.catch.names),this.finally&&Nt(t,this.finally.names),t}},sn=class extends dt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};sn.kind="catch";var an=class extends dt{render(t){return"finally"+super.render(t)}};an.kind="finally";var Fi=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
2
+ `:""},this._extScope=t,this._scope=new Je.Scope({parent:t}),this._nodes=[new Mi]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Ci(t,s,n)),s}const(t,r,n){return this._def(Je.varKinds.const,t,r,n)}let(t,r,n){return this._def(Je.varKinds.let,t,r,n)}var(t,r,n){return this._def(Je.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new vo(t,r,n))}add(t,r){return this._leafNode(new Ni(t,N.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Z.nil&&this._leafNode(new Di(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,o));return r.push("}"),new Z._Code(r)}if(t,r,n){if(this._blockNode(new Ot(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Ot(t))}else(){return this._elseNode(new nr)}endIf(){return this._endBlockNode(Ot,nr)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new qi(t),r)}forRange(t,r,n,o,s=this.opts.es5?Je.varKinds.var:Je.varKinds.let){let i=this._scope.toName(t);return this._for(new Ui(s,i,r,n),()=>o(i))}forOf(t,r,n,o=Je.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof Z.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Z._)`${i}.length`,a=>{this.var(s,(0,Z._)`${i}[${a}]`),n(s)})}return this._for(new $o("of",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?Je.varKinds.var:Je.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Z._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new $o("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(Ct)}label(t){return this._leafNode(new Ai(t))}break(t){return this._leafNode(new ji(t))}return(t){let r=new on;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(on)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Li;if(this._blockNode(o),this.code(t),r){let s=this.name("e");this._currNode=o.catch=new sn(s),r(s)}return n&&(this._currNode=o.finally=new an,this.code(n)),this._endBlockNode(sn,an)}throw(t){return this._leafNode(new Zi(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=Z.nil,n,o){return this._blockNode(new nn(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(nn)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Ot))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};N.CodeGen=Fi;function Nt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function wo(e,t){return t instanceof Z._CodeOrName?Nt(e,t.names):e}function or(e,t,r){if(e instanceof Z.Name)return n(e);if(!o(e))return e;return new Z._Code(e._items.reduce((s,i)=>(i instanceof Z.Name&&(i=n(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function o(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function Y$(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Zf(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Z._)`!${Vi(e)}`}N.not=Zf;var Q$=Df(N.operators.AND);function X$(...e){return e.reduce(Q$)}N.and=X$;var ew=Df(N.operators.OR);function tw(...e){return e.reduce(ew)}N.or=tw;function Df(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:(0,Z._)`${Vi(t)} ${e} ${Vi(r)}`}function Vi(e){return e instanceof Z.Name?e:(0,Z._)`(${e})`}});var D=z(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.checkStrictMode=A.getErrorPath=A.Type=A.useFunc=A.setEvaluated=A.evaluatedPropsToName=A.mergeEvaluated=A.eachItem=A.unescapeJsonPointer=A.escapeJsonPointer=A.escapeFragment=A.unescapeFragment=A.schemaRefOrVal=A.schemaHasRulesButRef=A.schemaHasRules=A.checkUnknownRules=A.alwaysValidSchema=A.toHash=void 0;var K=C(),rw=tn();function nw(e){let t={};for(let r of e)t[r]=!0;return t}A.toHash=nw;function ow(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Uf(e,t),!Lf(t,e.self.RULES.all))}A.alwaysValidSchema=ow;function Uf(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let s in t)o[s]||Hf(e,`unknown keyword: "${s}"`)}A.checkUnknownRules=Uf;function Lf(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}A.schemaHasRules=Lf;function sw(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}A.schemaHasRulesButRef=sw;function iw({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,K._)`${r}`}return(0,K._)`${e}${t}${(0,K.getProperty)(n)}`}A.schemaRefOrVal=iw;function aw(e){return Ff(decodeURIComponent(e))}A.unescapeFragment=aw;function cw(e){return encodeURIComponent(Ji(e))}A.escapeFragment=cw;function Ji(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}A.escapeJsonPointer=Ji;function Ff(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}A.unescapeJsonPointer=Ff;function uw(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}A.eachItem=uw;function Mf({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof K.Name?(s instanceof K.Name?e(o,s,i):t(o,s,i),i):s instanceof K.Name?(t(o,i,s),s):r(s,i);return a===K.Name&&!(c instanceof K.Name)?n(o,c):c}}A.mergeEvaluated={props:Mf({mergeNames:(e,t,r)=>e.if((0,K._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,K._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,K._)`${r} || {}`).code((0,K._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,K._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,K._)`${r} || {}`),Ki(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Vf}),items:Mf({mergeNames:(e,t,r)=>e.if((0,K._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,K._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,K._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,K._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Vf(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,K._)`{}`);return t!==void 0&&Ki(e,r,t),r}A.evaluatedPropsToName=Vf;function Ki(e,t,r){Object.keys(r).forEach(n=>e.assign((0,K._)`${t}${(0,K.getProperty)(n)}`,!0))}A.setEvaluated=Ki;var qf={};function lw(e,t){return e.scopeValue("func",{ref:t,code:qf[t.code]||(qf[t.code]=new rw._Code(t.code))})}A.useFunc=lw;var Hi;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Hi||(A.Type=Hi={}));function dw(e,t,r){if(e instanceof K.Name){let n=t===Hi.Num;return r?n?(0,K._)`"[" + ${e} + "]"`:(0,K._)`"['" + ${e} + "']"`:n?(0,K._)`"/" + ${e}`:(0,K._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,K.getProperty)(e).toString():"/"+Ji(e)}A.getErrorPath=dw;function Hf(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}A.checkStrictMode=Hf});var pt=z(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});var he=C(),pw={data:new he.Name("data"),valCxt:new he.Name("valCxt"),instancePath:new he.Name("instancePath"),parentData:new he.Name("parentData"),parentDataProperty:new he.Name("parentDataProperty"),rootData:new he.Name("rootData"),dynamicAnchors:new he.Name("dynamicAnchors"),vErrors:new he.Name("vErrors"),errors:new he.Name("errors"),this:new he.Name("this"),self:new he.Name("self"),scope:new he.Name("scope"),json:new he.Name("json"),jsonPos:new he.Name("jsonPos"),jsonLen:new he.Name("jsonLen"),jsonPart:new he.Name("jsonPart")};Bi.default=pw});var cn=z(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.extendErrors=ge.resetErrorsCount=ge.reportExtraError=ge.reportError=ge.keyword$DataError=ge.keywordError=void 0;var M=C(),xo=D(),$e=pt();ge.keywordError={message:({keyword:e})=>(0,M.str)`must pass "${e}" keyword validation`};ge.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,M.str)`"${e}" keyword must be ${t} ($data)`:(0,M.str)`"${e}" keyword is invalid ($data)`};function fw(e,t=ge.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=Bf(e,t,r);n??(i||a)?Jf(s,c):Kf(o,(0,M._)`[${c}]`)}ge.reportError=fw;function mw(e,t=ge.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=Bf(e,t,r);Jf(o,a),s||i||Kf(n,$e.default.vErrors)}ge.reportExtraError=mw;function hw(e,t){e.assign($e.default.errors,t),e.if((0,M._)`${$e.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,M._)`${$e.default.vErrors}.length`,t),()=>e.assign($e.default.vErrors,null)))}ge.resetErrorsCount=hw;function gw({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,$e.default.errors,a=>{e.const(i,(0,M._)`${$e.default.vErrors}[${a}]`),e.if((0,M._)`${i}.instancePath === undefined`,()=>e.assign((0,M._)`${i}.instancePath`,(0,M.strConcat)($e.default.instancePath,s.errorPath))),e.assign((0,M._)`${i}.schemaPath`,(0,M.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,M._)`${i}.schema`,r),e.assign((0,M._)`${i}.data`,n))})}ge.extendErrors=gw;function Jf(e,t){let r=e.const("err",t);e.if((0,M._)`${$e.default.vErrors} === null`,()=>e.assign($e.default.vErrors,(0,M._)`[${r}]`),(0,M._)`${$e.default.vErrors}.push(${r})`),e.code((0,M._)`${$e.default.errors}++`)}function Kf(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,M._)`new ${e.ValidationError}(${t})`):(r.assign((0,M._)`${n}.errors`,t),r.return(!1))}var At={keyword:new M.Name("keyword"),schemaPath:new M.Name("schemaPath"),params:new M.Name("params"),propertyName:new M.Name("propertyName"),message:new M.Name("message"),schema:new M.Name("schema"),parentSchema:new M.Name("parentSchema")};function Bf(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,M._)`{}`:_w(e,t,r)}function _w(e,t,r={}){let{gen:n,it:o}=e,s=[yw(o,r),vw(e,r)];return $w(e,t,s),n.object(...s)}function yw({errorPath:e},{instancePath:t}){let r=t?(0,M.str)`${e}${(0,xo.getErrorPath)(t,xo.Type.Str)}`:e;return[$e.default.instancePath,(0,M.strConcat)($e.default.instancePath,r)]}function vw({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,M.str)`${t}/${e}`;return r&&(o=(0,M.str)`${o}${(0,xo.getErrorPath)(r,xo.Type.Str)}`),[At.schemaPath,o]}function $w(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:p}=a;n.push([At.keyword,o],[At.params,typeof t=="function"?t(e):t||(0,M._)`{}`]),c.messages&&n.push([At.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([At.schema,i],[At.parentSchema,(0,M._)`${l}${p}`],[$e.default.data,s]),u&&n.push([At.propertyName,u])}});var Wf=z(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.boolOrEmptySchema=sr.topBoolOrEmptySchema=void 0;var ww=cn(),bw=C(),xw=pt(),zw={message:"boolean schema is false"};function Sw(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Gf(e,!1):typeof r=="object"&&r.$async===!0?t.return(xw.default.data):(t.assign((0,bw._)`${n}.errors`,null),t.return(!0))}sr.topBoolOrEmptySchema=Sw;function kw(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Gf(e)):r.var(t,!0)}sr.boolOrEmptySchema=kw;function Gf(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,ww.reportError)(o,zw,void 0,t)}});var Gi=z(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.getRules=ir.isJSONType=void 0;var Pw=["string","number","integer","boolean","null","object","array"],Tw=new Set(Pw);function Ew(e){return typeof e=="string"&&Tw.has(e)}ir.isJSONType=Ew;function Rw(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ir.getRules=Rw});var Wi=z(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.shouldUseRule=wt.shouldUseGroup=wt.schemaHasRulesForType=void 0;function Iw({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Yf(e,n)}wt.schemaHasRulesForType=Iw;function Yf(e,t){return t.rules.some(r=>Qf(e,r))}wt.shouldUseGroup=Yf;function Qf(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}wt.shouldUseRule=Qf});var un=z(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.reportTypeError=_e.checkDataTypes=_e.checkDataType=_e.coerceAndCheckDataType=_e.getJSONTypes=_e.getSchemaTypes=_e.DataType=void 0;var Ow=Gi(),Cw=Wi(),Nw=cn(),O=C(),Xf=D(),ar;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(ar||(_e.DataType=ar={}));function Aw(e){let t=em(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}_e.getSchemaTypes=Aw;function em(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Ow.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}_e.getJSONTypes=em;function jw(e,t){let{gen:r,data:n,opts:o}=e,s=Zw(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,Cw.schemaHasRulesForType)(e,t[0]));if(i){let a=Qi(t,n,o.strictNumbers,ar.Wrong);r.if(a,()=>{s.length?Dw(e,t,s):Xi(e)})}return i}_e.coerceAndCheckDataType=jw;var tm=new Set(["string","number","integer","boolean","null"]);function Zw(e,t){return t?e.filter(r=>tm.has(r)||t==="array"&&r==="array"):[]}function Dw(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",(0,O._)`typeof ${o}`),a=n.let("coerced",(0,O._)`undefined`);s.coerceTypes==="array"&&n.if((0,O._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,O._)`${o}[0]`).assign(i,(0,O._)`typeof ${o}`).if(Qi(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,O._)`${a} !== undefined`);for(let u of r)(tm.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),Xi(e),n.endIf(),n.if((0,O._)`${a} !== undefined`,()=>{n.assign(o,a),Mw(e,a)});function c(u){switch(u){case"string":n.elseIf((0,O._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,O._)`"" + ${o}`).elseIf((0,O._)`${o} === null`).assign(a,(0,O._)`""`);return;case"number":n.elseIf((0,O._)`${i} == "boolean" || ${o} === null
3
3
  || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,O._)`+${o}`);return;case"integer":n.elseIf((0,O._)`${i} === "boolean" || ${o} === null
4
4
  || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,O._)`+${o}`);return;case"boolean":n.elseIf((0,O._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,O._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,O._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,O._)`${i} === "string" || ${i} === "number"
5
- || ${i} === "boolean" || ${o} === null`).assign(a,(0,O._)`[${o}]`)}}}function gw({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,O._)`${t} !== undefined`,()=>e.assign((0,O._)`${t}[${r}]`,n))}function Ki(e,t,r,n=sr.Correct){let o=n===sr.Correct?O.operators.EQ:O.operators.NEQ,s;switch(e){case"null":return(0,O._)`${t} ${o} null`;case"array":s=(0,O._)`Array.isArray(${t})`;break;case"object":s=(0,O._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,O._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,O._)`typeof ${t} ${o} ${e}`}return n===sr.Correct?s:(0,O.not)(s);function i(a=O.nil){return(0,O.and)((0,O._)`typeof ${t} == "number"`,a,r?(0,O._)`isFinite(${t})`:O.nil)}}_e.checkDataType=Ki;function Gi(e,t,r,n){if(e.length===1)return Ki(e[0],t,r,n);let o,s=(0,Vf.toHash)(e);if(s.array&&s.object){let i=(0,O._)`typeof ${t} != "object"`;o=s.null?i:(0,O._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=O.nil;s.number&&delete s.integer;for(let i in s)o=(0,O.and)(o,Ki(i,t,r,n));return o}_e.checkDataTypes=Gi;var _w={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,O._)`{type: ${e}}`:(0,O._)`{type: ${t}}`};function Bi(e){let t=yw(e);(0,dw.reportError)(t,_w)}_e.reportTypeError=Bi;function yw(e){let{gen:t,data:r,schema:n}=e,o=(0,Vf.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Gf=z(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.assignDefaults=void 0;var ir=C(),vw=D();function $w(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Kf(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Kf(e,s,o.default))}wo.assignDefaults=$w;function Kf(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,ir._)`${s}${(0,ir.getProperty)(t)}`;if(o){(0,vw.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,ir._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,ir._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,ir._)`${a} = ${(0,ir.stringify)(r)}`)}});var De=z(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.validateUnion=V.validateArray=V.usePattern=V.callValidateCode=V.schemaProperties=V.allSchemaProperties=V.noPropertyInData=V.propertyInData=V.isOwnProperty=V.hasPropFunc=V.reportMissingProp=V.checkMissingProp=V.checkReportMissingProp=void 0;var W=C(),Wi=D(),bt=dt(),ww=D();function bw(e,t){let{gen:r,data:n,it:o}=e;r.if(Qi(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,W._)`${t}`},!0),e.error()})}V.checkReportMissingProp=bw;function xw({gen:e,data:t,it:{opts:r}},n,o){return(0,W.or)(...n.map(s=>(0,W.and)(Qi(e,t,s,r.ownProperties),(0,W._)`${o} = ${s}`)))}V.checkMissingProp=xw;function zw(e,t){e.setParams({missingProperty:t},!0),e.error()}V.reportMissingProp=zw;function Bf(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,W._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=Bf;function Yi(e,t,r){return(0,W._)`${Bf(e)}.call(${t}, ${r})`}V.isOwnProperty=Yi;function kw(e,t,r,n){let o=(0,W._)`${t}${(0,W.getProperty)(r)} !== undefined`;return n?(0,W._)`${o} && ${Yi(e,t,r)}`:o}V.propertyInData=kw;function Qi(e,t,r,n){let o=(0,W._)`${t}${(0,W.getProperty)(r)} === undefined`;return n?(0,W.or)(o,(0,W.not)(Yi(e,t,r))):o}V.noPropertyInData=Qi;function Wf(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}V.allSchemaProperties=Wf;function Sw(e,t){return Wf(t).filter(r=>!(0,Wi.alwaysValidSchema)(e,t[r]))}V.schemaProperties=Sw;function Pw({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,W._)`${e}, ${t}, ${n}${o}`:t,p=[[bt.default.instancePath,(0,W.strConcat)(bt.default.instancePath,s)],[bt.default.parentData,i.parentData],[bt.default.parentDataProperty,i.parentDataProperty],[bt.default.rootData,bt.default.rootData]];i.opts.dynamicRef&&p.push([bt.default.dynamicAnchors,bt.default.dynamicAnchors]);let m=(0,W._)`${l}, ${r.object(...p)}`;return c!==W.nil?(0,W._)`${a}.call(${c}, ${m})`:(0,W._)`${a}(${m})`}V.callValidateCode=Pw;var Tw=(0,W._)`new RegExp`;function Ew({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,W._)`${o.code==="new RegExp"?Tw:(0,ww.useFunc)(e,o)}(${r}, ${n})`})}V.usePattern=Ew;function Rw(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,W._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Wi.Type.Num},s),t.if((0,W.not)(s),a)})}}V.validateArray=Rw;function Iw(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Wi.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,W._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,W.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}V.validateUnion=Iw});var Xf=z(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.validateKeywordUsage=Ye.validSchemaType=Ye.funcKeywordCode=Ye.macroKeywordCode=void 0;var $e=C(),jt=dt(),Ow=De(),Cw=sn();function Nw(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Qf(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:$e.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Ye.macroKeywordCode=Nw;function Aw(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;Zw(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Qf(n,o,u),p=n.let("valid");e.block$data(p,m),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function m(){if(t.errors===!1)y(),t.modifying&&Yf(e),$(()=>e.error());else{let v=t.async?f():g();t.modifying&&Yf(e),$(()=>jw(e,v))}}function f(){let v=n.let("ruleErrs",null);return n.try(()=>y((0,$e._)`await `),R=>n.assign(p,!1).if((0,$e._)`${R} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,$e._)`${R}.errors`),()=>n.throw(R))),v}function g(){let v=(0,$e._)`${l}.errors`;return n.assign(v,null),y($e.nil),v}function y(v=t.async?(0,$e._)`await `:$e.nil){let R=c.opts.passContext?jt.default.this:jt.default.self,x=!("compile"in t&&!a||t.schema===!1);n.assign(p,(0,$e._)`${v}${(0,Ow.callValidateCode)(e,l,R,x)}`,t.modifying)}function $(v){var R;n.if((0,$e.not)((R=t.valid)!==null&&R!==void 0?R:p),v)}}Ye.funcKeywordCode=Aw;function Yf(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,$e._)`${n.parentData}[${n.parentDataProperty}]`))}function jw(e,t){let{gen:r}=e;r.if((0,$e._)`Array.isArray(${t})`,()=>{r.assign(jt.default.vErrors,(0,$e._)`${jt.default.vErrors} === null ? ${t} : ${jt.default.vErrors}.concat(${t})`).assign(jt.default.errors,(0,$e._)`${jt.default.vErrors}.length`),(0,Cw.extendErrors)(e)},()=>e.error())}function Zw({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Qf(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,$e.stringify)(r)})}function Dw(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Ye.validSchemaType=Dw;function Mw({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ye.validateKeywordUsage=Mw});var tm=z(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.extendSubschemaMode=xt.extendSubschemaData=xt.getSubschema=void 0;var Qe=C(),em=D();function qw(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,Qe._)`${e.schemaPath}${(0,Qe.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Qe._)`${e.schemaPath}${(0,Qe.getProperty)(t)}${(0,Qe.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,em.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}xt.getSubschema=qw;function Uw(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:p}=t,m=a.let("data",(0,Qe._)`${t.data}${(0,Qe.getProperty)(r)}`,!0);c(m),e.errorPath=(0,Qe.str)`${u}${(0,em.getErrorPath)(r,n,p.jsPropertySyntax)}`,e.parentDataProperty=(0,Qe._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof Qe.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}xt.extendSubschemaData=Uw;function Lw(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}xt.extendSubschemaMode=Lw});var Xi=z((iO,rm)=>{"use strict";rm.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var om=z((aO,nm)=>{"use strict";var zt=nm.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};bo(t,n,o,e,"",e)};zt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};zt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};zt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};zt.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function bo(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var p=n[l];if(Array.isArray(p)){if(l in zt.arrayKeywords)for(var m=0;m<p.length;m++)bo(e,t,r,p[m],o+"/"+l+"/"+m,s,o,l,n,m)}else if(l in zt.propsKeywords){if(p&&typeof p=="object")for(var f in p)bo(e,t,r,p[f],o+"/"+l+"/"+Fw(f),s,o,l,n,f)}else(l in zt.keywords||e.allKeys&&!(l in zt.skipKeywords))&&bo(e,t,r,p,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function Fw(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var cn=z(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.getSchemaRefs=ke.resolveUrl=ke.normalizeId=ke._getFullPath=ke.getFullPath=ke.inlineRef=void 0;var Vw=D(),Hw=Xi(),Jw=om(),Kw=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Gw(e,t=!0){return typeof e=="boolean"?!0:t===!0?!ea(e):t?sm(e)<=t:!1}ke.inlineRef=Gw;var Bw=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ea(e){for(let t in e){if(Bw.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(ea)||typeof r=="object"&&ea(r))return!0}return!1}function sm(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!Kw.has(r)&&(typeof e[r]=="object"&&(0,Vw.eachItem)(e[r],n=>t+=sm(n)),t===1/0))return 1/0}return t}function im(e,t="",r){r!==!1&&(t=ar(t));let n=e.parse(t);return am(e,n)}ke.getFullPath=im;function am(e,t){return e.serialize(t).split("#")[0]+"#"}ke._getFullPath=am;var Ww=/#\/?$/;function ar(e){return e?e.replace(Ww,""):""}ke.normalizeId=ar;function Yw(e,t,r){return r=ar(r),e.resolve(t,r)}ke.resolveUrl=Yw;var Qw=/^[a-z_][-a-z0-9._]*$/i;function Xw(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=ar(e[r]||t),s={"":o},i=im(n,o,!1),a={},c=new Set;return Jw(e,{allKeys:!0},(p,m,f,g)=>{if(g===void 0)return;let y=i+m,$=s[g];typeof p[r]=="string"&&($=v.call(this,p[r])),R.call(this,p.$anchor),R.call(this,p.$dynamicAnchor),s[m]=$;function v(x){let k=this.opts.uriResolver.resolve;if(x=ar($?k($,x):x),c.has(x))throw l(x);c.add(x);let S=this.refs[x];return typeof S=="string"&&(S=this.refs[S]),typeof S=="object"?u(p,S.schema,x):x!==ar(y)&&(x[0]==="#"?(u(p,a[x],x),a[x]=p):this.refs[x]=y),x}function R(x){if(typeof x=="string"){if(!Qw.test(x))throw new Error(`invalid anchor "${x}"`);v.call(this,`#${x}`)}}}),a;function u(p,m,f){if(m!==void 0&&!Hw(p,m))throw l(f)}function l(p){return new Error(`reference "${p}" resolves to more than one schema`)}}ke.getSchemaRefs=Xw});var dn=z(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.getData=kt.KeywordCxt=kt.validateFunctionCode=void 0;var pm=Uf(),cm=an(),ra=Ji(),xo=an(),eb=Gf(),ln=Xf(),ta=tm(),T=C(),I=dt(),tb=cn(),pt=D(),un=sn();function rb(e){if(hm(e)&&(gm(e),mm(e))){sb(e);return}fm(e,()=>(0,pm.topBoolOrEmptySchema)(e))}kt.validateFunctionCode=rb;function fm({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,(0,T._)`${I.default.data}, ${I.default.valCxt}`,n.$async,()=>{e.code((0,T._)`"use strict"; ${um(r,o)}`),ob(e,o),e.code(s)}):e.func(t,(0,T._)`${I.default.data}, ${nb(o)}`,n.$async,()=>e.code(um(r,o)).code(s))}function nb(e){return(0,T._)`{${I.default.instancePath}="", ${I.default.parentData}, ${I.default.parentDataProperty}, ${I.default.rootData}=${I.default.data}${e.dynamicRef?(0,T._)`, ${I.default.dynamicAnchors}={}`:T.nil}}={}`}function ob(e,t){e.if(I.default.valCxt,()=>{e.var(I.default.instancePath,(0,T._)`${I.default.valCxt}.${I.default.instancePath}`),e.var(I.default.parentData,(0,T._)`${I.default.valCxt}.${I.default.parentData}`),e.var(I.default.parentDataProperty,(0,T._)`${I.default.valCxt}.${I.default.parentDataProperty}`),e.var(I.default.rootData,(0,T._)`${I.default.valCxt}.${I.default.rootData}`),t.dynamicRef&&e.var(I.default.dynamicAnchors,(0,T._)`${I.default.valCxt}.${I.default.dynamicAnchors}`)},()=>{e.var(I.default.instancePath,(0,T._)`""`),e.var(I.default.parentData,(0,T._)`undefined`),e.var(I.default.parentDataProperty,(0,T._)`undefined`),e.var(I.default.rootData,I.default.data),t.dynamicRef&&e.var(I.default.dynamicAnchors,(0,T._)`{}`)})}function sb(e){let{schema:t,opts:r,gen:n}=e;fm(e,()=>{r.$comment&&t.$comment&&ym(e),lb(e),n.let(I.default.vErrors,null),n.let(I.default.errors,0),r.unevaluated&&ib(e),_m(e),fb(e)})}function ib(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,T._)`${r}.evaluated`),t.if((0,T._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,T._)`${e.evaluated}.props`,(0,T._)`undefined`)),t.if((0,T._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,T._)`${e.evaluated}.items`,(0,T._)`undefined`))}function um(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,T._)`/*# sourceURL=${r} */`:T.nil}function ab(e,t){if(hm(e)&&(gm(e),mm(e))){cb(e,t);return}(0,pm.boolOrEmptySchema)(e,t)}function mm({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function hm(e){return typeof e.schema!="boolean"}function cb(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&ym(e),db(e),pb(e);let s=n.const("_errs",I.default.errors);_m(e,s),n.var(t,(0,T._)`${s} === ${I.default.errors}`)}function gm(e){(0,pt.checkUnknownRules)(e),ub(e)}function _m(e,t){if(e.opts.jtd)return lm(e,[],!1,t);let r=(0,cm.getSchemaTypes)(e.schema),n=(0,cm.coerceAndCheckDataType)(e,r);lm(e,r,!n,t)}function ub(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,pt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function lb(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,pt.checkStrictMode)(e,"default is ignored in the schema root")}function db(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,tb.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function pb(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function ym({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code((0,T._)`${I.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,T.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,T._)`${I.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function fb(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if((0,T._)`${I.default.errors} === 0`,()=>t.return(I.default.data),()=>t.throw((0,T._)`new ${o}(${I.default.vErrors})`)):(t.assign((0,T._)`${n}.errors`,I.default.vErrors),s.unevaluated&&mb(e),t.return((0,T._)`${I.default.errors} === 0`))}function mb({gen:e,evaluated:t,props:r,items:n}){r instanceof T.Name&&e.assign((0,T._)`${t}.props`,r),n instanceof T.Name&&e.assign((0,T._)`${t}.items`,n)}function lm(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,pt.schemaHasRulesButRef)(s,l))){o.block(()=>$m(e,"$ref",l.all.$ref.definition));return}c.jtd||hb(e,t),o.block(()=>{for(let m of l.rules)p(m);p(l.post)});function p(m){(0,ra.shouldUseGroup)(s,m)&&(m.type?(o.if((0,xo.checkDataType)(m.type,i,c.strictNumbers)),dm(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,xo.reportTypeError)(e)),o.endIf()):dm(e,m),a||o.if((0,T._)`${I.default.errors} === ${n||0}`))}}function dm(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,eb.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,ra.shouldUseRule)(n,s)&&$m(e,s.keyword,s.definition,t.type)})}function hb(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(gb(e,t),e.opts.allowUnionTypes||_b(e,t),yb(e,e.dataTypes))}function gb(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{vm(e.dataTypes,r)||na(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),$b(e,t)}}function _b(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&na(e,"use allowUnionTypes to allow union type keyword")}function yb(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,ra.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>vb(t,i))&&na(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function vb(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function vm(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function $b(e,t){let r=[];for(let n of e.dataTypes)vm(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function na(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,pt.checkStrictMode)(e,t,e.opts.strictTypes)}var zo=class{constructor(t,r,n){if((0,ln.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,pt.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",wm(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,ln.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",I.default.errors))}result(t,r,n){this.failResult((0,T.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,T.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,T._)`${r} !== undefined && (${(0,T.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?un.reportExtraError:un.reportError)(this,this.def.error,r)}$dataError(){(0,un.reportError)(this,this.def.$dataError||un.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,un.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=T.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=T.nil,r=T.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,T.or)((0,T._)`${o} === undefined`,r)),t!==T.nil&&n.assign(t,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==T.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,T.or)(i(),a());function i(){if(n.length){if(!(r instanceof T.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,T._)`${(0,xo.checkDataTypes)(c,r,s.opts.strictNumbers,xo.DataType.Wrong)}`}return T.nil}function a(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,T._)`!${c}(${r})`}return T.nil}}subschema(t,r){let n=(0,ta.getSubschema)(this.it,t);(0,ta.extendSubschemaData)(n,this.it,t),(0,ta.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return ab(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=pt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=pt.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,T.Name)),!0}};kt.KeywordCxt=zo;function $m(e,t,r,n){let o=new zo(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,ln.funcKeywordCode)(o,r):"macro"in r?(0,ln.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,ln.funcKeywordCode)(o,r)}var wb=/^\/(?:[^~]|~0|~1)*$/,bb=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function wm(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return I.default.rootData;if(e[0]==="/"){if(!wb.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=I.default.rootData}else{let u=bb.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,T._)`${s}${(0,T.getProperty)((0,pt.unescapeJsonPointer)(u))}`,i=(0,T._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}kt.getData=wm});var ko=z(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});var oa=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};sa.default=oa});var pn=z(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var ia=cn(),aa=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,ia.resolveUrl)(t,r,n),this.missingSchema=(0,ia.normalizeId)((0,ia.getFullPath)(t,this.missingRef))}};ca.default=aa});var Po=z(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.resolveSchema=Me.getCompilingSchema=Me.resolveRef=Me.compileSchema=Me.SchemaEnv=void 0;var He=C(),xb=ko(),Zt=dt(),Je=cn(),bm=D(),zb=dn(),cr=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Je.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};Me.SchemaEnv=cr;function la(e){let t=xm.call(this,e);if(t)return t;let r=(0,Je.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new He.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:xb.default,code:(0,He._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Zt.default.data,parentData:Zt.default.parentData,parentDataProperty:Zt.default.parentDataProperty,dataNames:[Zt.default.data],dataPathArr:[He.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,He.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:He.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,He._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,zb.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let p=i.toString();l=`${i.scopeRefs(Zt.default.scope)}return ${p}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Zt.default.self}`,`${Zt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:p,scopeValues:i._values}),this.opts.unevaluated){let{props:g,items:y}=u;f.evaluated={props:g instanceof He.Name?void 0:g,items:y instanceof He.Name?void 0:y,dynamicProps:g instanceof He.Name,dynamicItems:y instanceof He.Name},f.source&&(f.source.evaluated=(0,He.stringify)(f.evaluated))}return e.validate=f,e}catch(p){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),p}finally{this._compilations.delete(e)}}Me.compileSchema=la;function kb(e,t,r){var n;r=(0,Je.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=Tb.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new cr({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=Sb.call(this,s)}Me.resolveRef=kb;function Sb(e){return(0,Je.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:la.call(this,e)}function xm(e){for(let t of this._compilations)if(Pb(t,e))return t}Me.getCompilingSchema=xm;function Pb(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Tb(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||So.call(this,e,t)}function So(e,t){let r=this.opts.uriResolver.parse(t),n=(0,Je._getFullPath)(this.opts.uriResolver,r),o=(0,Je.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return ua.call(this,r,e);let s=(0,Je.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=So.call(this,e,i);return typeof a?.schema!="object"?void 0:ua.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||la.call(this,i),s===(0,Je.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Je.resolveUrl)(this.opts.uriResolver,o,u)),new cr({schema:a,schemaId:c,root:e,baseId:o})}return ua.call(this,r,i)}}Me.resolveSchema=So;var Eb=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ua(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,bm.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Eb.has(a)&&u&&(t=(0,Je.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,bm.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Je.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=So.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new cr({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var zm=z((fO,Rb)=>{Rb.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var pa=z((mO,Tm)=>{"use strict";var Ib=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Sm=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function da(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var Ob=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function km(e){return e.length=0,!0}function Cb(e,t,r){if(e.length){let n=da(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function Nb(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],s=!1,i=!1,a=Cb;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(o,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(s=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=km}else{o.push(u);continue}}return o.length&&(a===km?r.zone=o.join(""):i?n.push(o.join("")):n.push(da(o))),r.address=n.join(""),r}function Pm(e){if(Ab(e,":")<2)return{host:e,isIPV6:!1};let t=Nb(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function Ab(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function jb(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function Zb(e,t){let r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function Db(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Sm(r)){let n=Pm(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=e.host}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}Tm.exports={nonSimpleDomain:Ob,recomposeAuthority:Db,normalizeComponentEncoding:Zb,removeDotSegments:jb,isIPv4:Sm,isUUID:Ib,normalizeIPv6:Pm,stringArrayToHexStripped:da}});var Cm=z((hO,Om)=>{"use strict";var{isUUID:Mb}=pa(),qb=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Ub=["http","https","ws","wss","urn","urn:uuid"];function Lb(e){return Ub.indexOf(e)!==-1}function fa(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function Em(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Rm(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function Fb(e){return e.secure=fa(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Vb(e){if((e.port===(fa(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function Hb(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(qb);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=ma(o);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Jb(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=ma(o);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function Kb(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Mb(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Gb(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Im={scheme:"http",domainHost:!0,parse:Em,serialize:Rm},Bb={scheme:"https",domainHost:Im.domainHost,parse:Em,serialize:Rm},To={scheme:"ws",domainHost:!0,parse:Fb,serialize:Vb},Wb={scheme:"wss",domainHost:To.domainHost,parse:To.parse,serialize:To.serialize},Yb={scheme:"urn",parse:Hb,serialize:Jb,skipNormalize:!0},Qb={scheme:"urn:uuid",parse:Kb,serialize:Gb,skipNormalize:!0},Eo={http:Im,https:Bb,ws:To,wss:Wb,urn:Yb,"urn:uuid":Qb};Object.setPrototypeOf(Eo,null);function ma(e){return e&&(Eo[e]||Eo[e.toLowerCase()])||void 0}Om.exports={wsIsSecure:fa,SCHEMES:Eo,isValidSchemeName:Lb,getSchemeHandler:ma}});var jm=z((gO,Io)=>{"use strict";var{normalizeIPv6:Xb,removeDotSegments:fn,recomposeAuthority:e0,normalizeComponentEncoding:Ro,isIPv4:t0,nonSimpleDomain:r0}=pa(),{SCHEMES:n0,getSchemeHandler:Nm}=Cm();function o0(e,t){return typeof e=="string"?e=Xe(ft(e,t),t):typeof e=="object"&&(e=ft(Xe(e,t),t)),e}function s0(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Am(ft(e,n),ft(t,n),n,!0);return n.skipEscape=!0,Xe(o,n)}function Am(e,t,r,n){let o={};return n||(e=ft(Xe(e,r),r),t=ft(Xe(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=fn(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=fn(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=fn(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=fn(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function i0(e,t,r){return typeof e=="string"?(e=unescape(e),e=Xe(Ro(ft(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Xe(Ro(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=Xe(Ro(ft(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Xe(Ro(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function Xe(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[],s=Nm(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let i=e0(r);if(i!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(i),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=fn(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var a0=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function ft(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let s=e.match(a0);if(s){if(n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5]),n.host)if(t0(n.host)===!1){let c=Xb(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let i=Nm(r.scheme||n.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&n.host&&(r.domainHost||i&&i.domainHost)&&o===!1&&r0(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!i||i&&!i.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),i&&i.parse&&i.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var ha={SCHEMES:n0,normalize:o0,resolve:s0,resolveComponent:Am,equal:i0,serialize:Xe,parse:ft};Io.exports=ha;Io.exports.default=ha;Io.exports.fastUri=ha});var Dm=z(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var Zm=jm();Zm.code='require("ajv/dist/runtime/uri").default';ga.default=Zm});var Jm=z(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.CodeGen=pe.Name=pe.nil=pe.stringify=pe.str=pe._=pe.KeywordCxt=void 0;var c0=dn();Object.defineProperty(pe,"KeywordCxt",{enumerable:!0,get:function(){return c0.KeywordCxt}});var ur=C();Object.defineProperty(pe,"_",{enumerable:!0,get:function(){return ur._}});Object.defineProperty(pe,"str",{enumerable:!0,get:function(){return ur.str}});Object.defineProperty(pe,"stringify",{enumerable:!0,get:function(){return ur.stringify}});Object.defineProperty(pe,"nil",{enumerable:!0,get:function(){return ur.nil}});Object.defineProperty(pe,"Name",{enumerable:!0,get:function(){return ur.Name}});Object.defineProperty(pe,"CodeGen",{enumerable:!0,get:function(){return ur.CodeGen}});var u0=ko(),Fm=pn(),l0=Hi(),mn=Po(),d0=C(),hn=cn(),Oo=an(),ya=D(),Mm=zm(),p0=Dm(),Vm=(e,t)=>new RegExp(e,t);Vm.code="new RegExp";var f0=["removeAdditional","useDefaults","coerceTypes"],m0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),h0={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},qm=200;function _0(e){var t,r,n,o,s,i,a,c,u,l,p,m,f,g,y,$,v,R,x,k,S,Te,Oe,Sr,Qo;let Pr=e.strict,Xo=(t=e.code)===null||t===void 0?void 0:t.optimize,Sc=Xo===!0||Xo===void 0?1:Xo||0,Pc=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Vm,Dg=(o=e.uriResolver)!==null&&o!==void 0?o:p0.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:Pr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:Pr)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Pr)!==null&&l!==void 0?l:"log",strictTuples:(m=(p=e.strictTuples)!==null&&p!==void 0?p:Pr)!==null&&m!==void 0?m:"log",strictRequired:(g=(f=e.strictRequired)!==null&&f!==void 0?f:Pr)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Sc,regExp:Pc}:{optimize:Sc,regExp:Pc},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:qm,loopEnum:($=e.loopEnum)!==null&&$!==void 0?$:qm,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(R=e.messages)!==null&&R!==void 0?R:!0,inlineRefs:(x=e.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(k=e.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(S=e.addUsedSchema)!==null&&S!==void 0?S:!0,validateSchema:(Te=e.validateSchema)!==null&&Te!==void 0?Te:!0,validateFormats:(Oe=e.validateFormats)!==null&&Oe!==void 0?Oe:!0,unicodeRegExp:(Sr=e.unicodeRegExp)!==null&&Sr!==void 0?Sr:!0,int32range:(Qo=e.int32range)!==null&&Qo!==void 0?Qo:!0,uriResolver:Dg}}var gn=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,..._0(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new d0.ValueScope({scope:{},prefixes:m0,es5:r,lines:n}),this.logger=x0(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,l0.getRules)(),Um.call(this,h0,t,"NOT SUPPORTED"),Um.call(this,g0,t,"DEPRECATED","warn"),this._metaOpts=w0.call(this),t.formats&&v0.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&$0.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),y0.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Mm;n==="id"&&(o={...Mm},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,p){await s.call(this,l.$schema);let m=this._addSchema(l,p);return m.validate||i.call(this,m)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(p){if(!(p instanceof Fm.default))throw p;return a.call(this,p),await c.call(this,p.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:p}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${p} cannot be resolved`)}async function c(l){let p=await u.call(this,l);this.refs[l]||await s.call(this,p.$schema),this.refs[l]||this.addSchema(p,l,r)}async function u(l){let p=this._loading[l];if(p)return p;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,n,o);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,hn.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(t){let r;for(;typeof(r=Lm.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new mn.SchemaEnv({schema:{},schemaId:n});if(r=mn.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Lm.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,hn.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(k0.call(this,n,r),!r)return(0,ya.eachItem)(n,s=>_a.call(this,s)),this;P0.call(this,r);let o={...r,type:(0,Oo.getJSONTypes)(r.type),schemaType:(0,Oo.getJSONTypes)(r.schemaType)};return(0,ya.eachItem)(n,o.type.length===0?s=>_a.call(this,s,o):s=>o.type.forEach(i=>_a.call(this,s,o,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(s=>s.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let s=o.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=Hm(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,hn.normalizeId)(i||n);let u=hn.getSchemaRefs.call(this,t,n);return c=new mn.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):mn.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{mn.compileSchema.call(this,t)}finally{this.opts=r}}};gn.ValidationError=u0.default;gn.MissingRefError=Fm.default;pe.default=gn;function Um(e,t,r,n="error"){for(let o in e){let s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function Lm(e){return e=(0,hn.normalizeId)(e),this.schemas[e]||this.refs[e]}function y0(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function v0(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function $0(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function w0(){let e={...this.opts};for(let t of f0)delete e[t];return e}var b0={log(){},warn(){},error(){}};function x0(e){if(e===!1)return b0;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var z0=/^[a-z_$][a-z0-9_$:-]*$/i;function k0(e,t){let{RULES:r}=this;if((0,ya.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!z0.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function _a(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,Oo.getJSONTypes)(t.type),schemaType:(0,Oo.getJSONTypes)(t.schemaType)}};t.before?S0.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function S0(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function P0(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Hm(t)),e.validateSchema=this.compile(t,!0))}var T0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Hm(e){return{anyOf:[e,T0]}}});var Km=z(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var E0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};va.default=E0});var Ym=z(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.callRef=Dt.getValidate=void 0;var R0=pn(),Gm=De(),Se=C(),lr=dt(),Bm=Po(),Co=D(),I0={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return p();let l=Bm.resolveRef.call(c,u,o,r);if(l===void 0)throw new R0.default(n.opts.uriResolver,o,r);if(l instanceof Bm.SchemaEnv)return m(l);return f(l);function p(){if(s===u)return No(e,i,s,s.$async);let g=t.scopeValue("root",{ref:u});return No(e,(0,Se._)`${g}.validate`,u,u.$async)}function m(g){let y=Wm(e,g);No(e,y,g,g.$async)}function f(g){let y=t.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Se.stringify)(g)}:{ref:g}),$=t.name("valid"),v=e.subschema({schema:g,dataTypes:[],schemaPath:Se.nil,topSchemaRef:y,errSchemaPath:r},$);e.mergeEvaluated(v),e.ok($)}}};function Wm(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Se._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Dt.getValidate=Wm;function No(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?lr.default.this:Se.nil;n?l():p();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let g=o.let("valid");o.try(()=>{o.code((0,Se._)`await ${(0,Gm.callValidateCode)(e,t,u)}`),f(t),i||o.assign(g,!0)},y=>{o.if((0,Se._)`!(${y} instanceof ${s.ValidationError})`,()=>o.throw(y)),m(y),i||o.assign(g,!1)}),e.ok(g)}function p(){e.result((0,Gm.callValidateCode)(e,t,u),()=>f(t),()=>m(t))}function m(g){let y=(0,Se._)`${g}.errors`;o.assign(lr.default.vErrors,(0,Se._)`${lr.default.vErrors} === null ? ${y} : ${lr.default.vErrors}.concat(${y})`),o.assign(lr.default.errors,(0,Se._)`${lr.default.vErrors}.length`)}function f(g){var y;if(!s.opts.unevaluated)return;let $=(y=r?.validate)===null||y===void 0?void 0:y.evaluated;if(s.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(s.props=Co.mergeEvaluated.props(o,$.props,s.props));else{let v=o.var("props",(0,Se._)`${g}.evaluated.props`);s.props=Co.mergeEvaluated.props(o,v,s.props,Se.Name)}if(s.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(s.items=Co.mergeEvaluated.items(o,$.items,s.items));else{let v=o.var("items",(0,Se._)`${g}.evaluated.items`);s.items=Co.mergeEvaluated.items(o,v,s.items,Se.Name)}}}Dt.callRef=No;Dt.default=I0});var Qm=z($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var O0=Km(),C0=Ym(),N0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",O0.default,C0.default];$a.default=N0});var Xm=z(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var Ao=C(),St=Ao.operators,jo={maximum:{okStr:"<=",ok:St.LTE,fail:St.GT},minimum:{okStr:">=",ok:St.GTE,fail:St.LT},exclusiveMaximum:{okStr:"<",ok:St.LT,fail:St.GTE},exclusiveMinimum:{okStr:">",ok:St.GT,fail:St.LTE}},A0={message:({keyword:e,schemaCode:t})=>(0,Ao.str)`must be ${jo[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ao._)`{comparison: ${jo[e].okStr}, limit: ${t}}`},j0={keyword:Object.keys(jo),type:"number",schemaType:"number",$data:!0,error:A0,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Ao._)`${r} ${jo[t].fail} ${n} || isNaN(${r})`)}};wa.default=j0});var eh=z(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});var _n=C(),Z0={message:({schemaCode:e})=>(0,_n.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,_n._)`{multipleOf: ${e}}`},D0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Z0,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,_n._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,_n._)`${i} !== parseInt(${i})`;e.fail$data((0,_n._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};ba.default=D0});var rh=z(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});function th(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}xa.default=th;th.code='require("ajv/dist/runtime/ucs2length").default'});var nh=z(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var Mt=C(),M0=D(),q0=rh(),U0={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Mt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Mt._)`{limit: ${e}}`},L0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:U0,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?Mt.operators.GT:Mt.operators.LT,i=o.opts.unicode===!1?(0,Mt._)`${r}.length`:(0,Mt._)`${(0,M0.useFunc)(e.gen,q0.default)}(${r})`;e.fail$data((0,Mt._)`${i} ${s} ${n}`)}};za.default=L0});var oh=z(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var F0=De(),V0=D(),dr=C(),H0={message:({schemaCode:e})=>(0,dr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,dr._)`{pattern: ${e}}`},J0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:H0,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,dr._)`new RegExp`:(0,V0.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,dr._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,dr._)`!${l}`)}else{let c=(0,F0.usePattern)(e,o);e.fail$data((0,dr._)`!${c}.test(${r})`)}}};ka.default=J0});var sh=z(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var yn=C(),K0={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,yn.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,yn._)`{limit: ${e}}`},G0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:K0,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?yn.operators.GT:yn.operators.LT;e.fail$data((0,yn._)`Object.keys(${r}).length ${o} ${n}`)}};Sa.default=G0});var ih=z(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var vn=De(),$n=C(),B0=D(),W0={message:({params:{missingProperty:e}})=>(0,$n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,$n._)`{missingProperty: ${e}}`},Y0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:W0,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:g}=e.it;for(let y of r)if(f?.[y]===void 0&&!g.has(y)){let $=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${y}" is not defined at "${$}" (strictRequired)`;(0,B0.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)e.block$data($n.nil,p);else for(let f of r)(0,vn.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||s){let g=t.let("valid",!0);e.block$data(g,()=>m(f,g)),e.ok(g)}else t.if((0,vn.checkMissingProp)(e,r,f)),(0,vn.reportMissingProp)(e,f),t.else()}function p(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,vn.noPropertyInData)(t,o,f,a.ownProperties),()=>e.error())})}function m(f,g){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(g,(0,vn.propertyInData)(t,o,f,a.ownProperties)),t.if((0,$n.not)(g),()=>{e.error(),t.break()})},$n.nil)}}};Pa.default=Y0});var ah=z(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});var wn=C(),Q0={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,wn.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,wn._)`{limit: ${e}}`},X0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Q0,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?wn.operators.GT:wn.operators.LT;e.fail$data((0,wn._)`${r}.length ${o} ${n}`)}};Ta.default=X0});var Zo=z(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var ch=Xi();ch.code='require("ajv/dist/runtime/equal").default';Ea.default=ch});var uh=z(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var Ra=an(),fe=C(),ex=D(),tx=Zo(),rx={message:({params:{i:e,j:t}})=>(0,fe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,fe._)`{i: ${e}, j: ${t}}`},nx={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:rx,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?(0,Ra.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,fe._)`${i} === false`),e.ok(c);function l(){let g=t.let("i",(0,fe._)`${r}.length`),y=t.let("j");e.setParams({i:g,j:y}),t.assign(c,!0),t.if((0,fe._)`${g} > 1`,()=>(p()?m:f)(g,y))}function p(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function m(g,y){let $=t.name("item"),v=(0,Ra.checkDataTypes)(u,$,a.opts.strictNumbers,Ra.DataType.Wrong),R=t.const("indices",(0,fe._)`{}`);t.for((0,fe._)`;${g}--;`,()=>{t.let($,(0,fe._)`${r}[${g}]`),t.if(v,(0,fe._)`continue`),u.length>1&&t.if((0,fe._)`typeof ${$} == "string"`,(0,fe._)`${$} += "_"`),t.if((0,fe._)`typeof ${R}[${$}] == "number"`,()=>{t.assign(y,(0,fe._)`${R}[${$}]`),e.error(),t.assign(c,!1).break()}).code((0,fe._)`${R}[${$}] = ${g}`)})}function f(g,y){let $=(0,ex.useFunc)(t,tx.default),v=t.name("outer");t.label(v).for((0,fe._)`;${g}--;`,()=>t.for((0,fe._)`${y} = ${g}; ${y}--;`,()=>t.if((0,fe._)`${$}(${r}[${g}], ${r}[${y}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};Ia.default=nx});var lh=z(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var Oa=C(),ox=D(),sx=Zo(),ix={message:"must be equal to constant",params:({schemaCode:e})=>(0,Oa._)`{allowedValue: ${e}}`},ax={keyword:"const",$data:!0,error:ix,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s=="object"?e.fail$data((0,Oa._)`!${(0,ox.useFunc)(t,sx.default)}(${r}, ${o})`):e.fail((0,Oa._)`${s} !== ${r}`)}};Ca.default=ax});var dh=z(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var bn=C(),cx=D(),ux=Zo(),lx={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,bn._)`{allowedValues: ${e}}`},dx={keyword:"enum",schemaType:"array",$data:!0,error:lx,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,cx.useFunc)(t,ux.default)),l;if(a||n)l=t.let("valid"),e.block$data(l,p);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,bn.or)(...o.map((g,y)=>m(f,y)))}e.pass(l);function p(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,bn._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,g){let y=o[g];return typeof y=="object"&&y!==null?(0,bn._)`${u()}(${r}, ${f}[${g}])`:(0,bn._)`${r} === ${y}`}}};Na.default=dx});var ph=z(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var px=Xm(),fx=eh(),mx=nh(),hx=oh(),gx=sh(),_x=ih(),yx=ah(),vx=uh(),$x=lh(),wx=dh(),bx=[px.default,fx.default,mx.default,hx.default,gx.default,_x.default,yx.default,vx.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},$x.default,wx.default];Aa.default=bx});var Za=z(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.validateAdditionalItems=void 0;var qt=C(),ja=D(),xx={message:({params:{len:e}})=>(0,qt.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,qt._)`{limit: ${e}}`},zx={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:xx,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,ja.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}fh(e,n)}};function fh(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,qt._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,qt._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,ja.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,qt._)`${a} <= ${t.length}`);r.if((0,qt.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:ja.Type.Num},u),i.allErrors||r.if((0,qt.not)(u),()=>r.break())})}}xn.validateAdditionalItems=fh;xn.default=zx});var Da=z(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.validateTuple=void 0;var mh=C(),Do=D(),kx=De(),Sx={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return hh(e,"additionalItems",t);r.items=!0,!(0,Do.alwaysValidSchema)(r,t)&&e.ok((0,kx.validateArray)(e))}};function hh(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Do.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,mh._)`${s}.length`);r.forEach((p,m)=>{(0,Do.alwaysValidSchema)(a,p)||(n.if((0,mh._)`${u} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(p){let{opts:m,errSchemaPath:f}=a,g=r.length,y=g===p.minItems&&(g===p.maxItems||p[t]===!1);if(m.strictTuples&&!y){let $=`"${i}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Do.checkStrictMode)(a,$,m.strictTuples)}}}zn.validateTuple=hh;zn.default=Sx});var gh=z(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});var Px=Da(),Tx={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Px.validateTuple)(e,"items")};Ma.default=Tx});var yh=z(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var _h=C(),Ex=D(),Rx=De(),Ix=Za(),Ox={message:({params:{len:e}})=>(0,_h.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,_h._)`{limit: ${e}}`},Cx={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Ox,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,Ex.alwaysValidSchema)(n,t)&&(o?(0,Ix.validateAdditionalItems)(e,o):e.ok((0,Rx.validateArray)(e)))}};qa.default=Cx});var vh=z(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});var qe=C(),Mo=D(),Nx={message:({params:{min:e,max:t}})=>t===void 0?(0,qe.str)`must contain at least ${e} valid item(s)`:(0,qe.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,qe._)`{minContains: ${e}}`:(0,qe._)`{minContains: ${e}, maxContains: ${t}}`},Ax={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Nx,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,qe._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Mo.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Mo.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Mo.alwaysValidSchema)(s,r)){let y=(0,qe._)`${l} >= ${i}`;a!==void 0&&(y=(0,qe._)`${y} && ${l} <= ${a}`),e.pass(y);return}s.items=!0;let p=t.name("valid");a===void 0&&i===1?f(p,()=>t.if(p,()=>t.break())):i===0?(t.let(p,!0),a!==void 0&&t.if((0,qe._)`${o}.length > 0`,m)):(t.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let y=t.name("_valid"),$=t.let("count",0);f(y,()=>t.if(y,()=>g($)))}function f(y,$){t.forRange("i",0,l,v=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:Mo.Type.Num,compositeRule:!0},y),$()})}function g(y){t.code((0,qe._)`${y}++`),a===void 0?t.if((0,qe._)`${y} >= ${i}`,()=>t.assign(p,!0).break()):(t.if((0,qe._)`${y} > ${a}`,()=>t.assign(p,!1).break()),i===1?t.assign(p,!0):t.if((0,qe._)`${y} >= ${i}`,()=>t.assign(p,!0)))}}};Ua.default=Ax});var bh=z(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.validateSchemaDeps=et.validatePropertyDeps=et.error=void 0;var La=C(),jx=D(),kn=De();et.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,La.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,La._)`{property: ${e},
5
+ || ${i} === "boolean" || ${o} === null`).assign(a,(0,O._)`[${o}]`)}}}function Mw({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,O._)`${t} !== undefined`,()=>e.assign((0,O._)`${t}[${r}]`,n))}function Yi(e,t,r,n=ar.Correct){let o=n===ar.Correct?O.operators.EQ:O.operators.NEQ,s;switch(e){case"null":return(0,O._)`${t} ${o} null`;case"array":s=(0,O._)`Array.isArray(${t})`;break;case"object":s=(0,O._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,O._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,O._)`typeof ${t} ${o} ${e}`}return n===ar.Correct?s:(0,O.not)(s);function i(a=O.nil){return(0,O.and)((0,O._)`typeof ${t} == "number"`,a,r?(0,O._)`isFinite(${t})`:O.nil)}}_e.checkDataType=Yi;function Qi(e,t,r,n){if(e.length===1)return Yi(e[0],t,r,n);let o,s=(0,Xf.toHash)(e);if(s.array&&s.object){let i=(0,O._)`typeof ${t} != "object"`;o=s.null?i:(0,O._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=O.nil;s.number&&delete s.integer;for(let i in s)o=(0,O.and)(o,Yi(i,t,r,n));return o}_e.checkDataTypes=Qi;var qw={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,O._)`{type: ${e}}`:(0,O._)`{type: ${t}}`};function Xi(e){let t=Uw(e);(0,Nw.reportError)(t,qw)}_e.reportTypeError=Xi;function Uw(e){let{gen:t,data:r,schema:n}=e,o=(0,Xf.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var nm=z(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});zo.assignDefaults=void 0;var cr=C(),Lw=D();function Fw(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)rm(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,s)=>rm(e,s,o.default))}zo.assignDefaults=Fw;function rm(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,cr._)`${s}${(0,cr.getProperty)(t)}`;if(o){(0,Lw.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,cr._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,cr._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,cr._)`${a} = ${(0,cr.stringify)(r)}`)}});var qe=z(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.validateUnion=V.validateArray=V.usePattern=V.callValidateCode=V.schemaProperties=V.allSchemaProperties=V.noPropertyInData=V.propertyInData=V.isOwnProperty=V.hasPropFunc=V.reportMissingProp=V.checkMissingProp=V.checkReportMissingProp=void 0;var W=C(),ea=D(),bt=pt(),Vw=D();function Hw(e,t){let{gen:r,data:n,it:o}=e;r.if(ra(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,W._)`${t}`},!0),e.error()})}V.checkReportMissingProp=Hw;function Jw({gen:e,data:t,it:{opts:r}},n,o){return(0,W.or)(...n.map(s=>(0,W.and)(ra(e,t,s,r.ownProperties),(0,W._)`${o} = ${s}`)))}V.checkMissingProp=Jw;function Kw(e,t){e.setParams({missingProperty:t},!0),e.error()}V.reportMissingProp=Kw;function om(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,W._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=om;function ta(e,t,r){return(0,W._)`${om(e)}.call(${t}, ${r})`}V.isOwnProperty=ta;function Bw(e,t,r,n){let o=(0,W._)`${t}${(0,W.getProperty)(r)} !== undefined`;return n?(0,W._)`${o} && ${ta(e,t,r)}`:o}V.propertyInData=Bw;function ra(e,t,r,n){let o=(0,W._)`${t}${(0,W.getProperty)(r)} === undefined`;return n?(0,W.or)(o,(0,W.not)(ta(e,t,r))):o}V.noPropertyInData=ra;function sm(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}V.allSchemaProperties=sm;function Gw(e,t){return sm(t).filter(r=>!(0,ea.alwaysValidSchema)(e,t[r]))}V.schemaProperties=Gw;function Ww({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,W._)`${e}, ${t}, ${n}${o}`:t,p=[[bt.default.instancePath,(0,W.strConcat)(bt.default.instancePath,s)],[bt.default.parentData,i.parentData],[bt.default.parentDataProperty,i.parentDataProperty],[bt.default.rootData,bt.default.rootData]];i.opts.dynamicRef&&p.push([bt.default.dynamicAnchors,bt.default.dynamicAnchors]);let m=(0,W._)`${l}, ${r.object(...p)}`;return c!==W.nil?(0,W._)`${a}.call(${c}, ${m})`:(0,W._)`${a}(${m})`}V.callValidateCode=Ww;var Yw=(0,W._)`new RegExp`;function Qw({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,W._)`${o.code==="new RegExp"?Yw:(0,Vw.useFunc)(e,o)}(${r}, ${n})`})}V.usePattern=Qw;function Xw(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,W._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:ea.Type.Num},s),t.if((0,W.not)(s),a)})}}V.validateArray=Xw;function e0(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ea.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,W._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,W.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}V.validateUnion=e0});var cm=z(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.validateKeywordUsage=Xe.validSchemaType=Xe.funcKeywordCode=Xe.macroKeywordCode=void 0;var we=C(),jt=pt(),t0=qe(),r0=cn();function n0(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=am(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:we.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Xe.macroKeywordCode=n0;function o0(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;i0(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=am(n,o,u),p=n.let("valid");e.block$data(p,m),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function m(){if(t.errors===!1)_(),t.modifying&&im(e),y(()=>e.error());else{let v=t.async?f():g();t.modifying&&im(e),y(()=>s0(e,v))}}function f(){let v=n.let("ruleErrs",null);return n.try(()=>_((0,we._)`await `),k=>n.assign(p,!1).if((0,we._)`${k} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,we._)`${k}.errors`),()=>n.throw(k))),v}function g(){let v=(0,we._)`${l}.errors`;return n.assign(v,null),_(we.nil),v}function _(v=t.async?(0,we._)`await `:we.nil){let k=c.opts.passContext?jt.default.this:jt.default.self,x=!("compile"in t&&!a||t.schema===!1);n.assign(p,(0,we._)`${v}${(0,t0.callValidateCode)(e,l,k,x)}`,t.modifying)}function y(v){var k;n.if((0,we.not)((k=t.valid)!==null&&k!==void 0?k:p),v)}}Xe.funcKeywordCode=o0;function im(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,we._)`${n.parentData}[${n.parentDataProperty}]`))}function s0(e,t){let{gen:r}=e;r.if((0,we._)`Array.isArray(${t})`,()=>{r.assign(jt.default.vErrors,(0,we._)`${jt.default.vErrors} === null ? ${t} : ${jt.default.vErrors}.concat(${t})`).assign(jt.default.errors,(0,we._)`${jt.default.vErrors}.length`),(0,r0.extendErrors)(e)},()=>e.error())}function i0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function am(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,we.stringify)(r)})}function a0(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Xe.validSchemaType=a0;function c0({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Xe.validateKeywordUsage=c0});var lm=z(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.extendSubschemaMode=xt.extendSubschemaData=xt.getSubschema=void 0;var et=C(),um=D();function u0(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,et._)`${e.schemaPath}${(0,et.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,et._)`${e.schemaPath}${(0,et.getProperty)(t)}${(0,et.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,um.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}xt.getSubschema=u0;function l0(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:p}=t,m=a.let("data",(0,et._)`${t.data}${(0,et.getProperty)(r)}`,!0);c(m),e.errorPath=(0,et.str)`${u}${(0,um.getErrorPath)(r,n,p.jsPropertySyntax)}`,e.parentDataProperty=(0,et._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof et.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}xt.extendSubschemaData=l0;function d0(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}xt.extendSubschemaMode=d0});var na=z((BO,dm)=>{"use strict";dm.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var fm=z((GO,pm)=>{"use strict";var zt=pm.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};So(t,n,o,e,"",e)};zt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};zt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};zt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};zt.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function So(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var p=n[l];if(Array.isArray(p)){if(l in zt.arrayKeywords)for(var m=0;m<p.length;m++)So(e,t,r,p[m],o+"/"+l+"/"+m,s,o,l,n,m)}else if(l in zt.propsKeywords){if(p&&typeof p=="object")for(var f in p)So(e,t,r,p[f],o+"/"+l+"/"+p0(f),s,o,l,n,f)}else(l in zt.keywords||e.allKeys&&!(l in zt.skipKeywords))&&So(e,t,r,p,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function p0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var ln=z(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.getSchemaRefs=ke.resolveUrl=ke.normalizeId=ke._getFullPath=ke.getFullPath=ke.inlineRef=void 0;var f0=D(),m0=na(),h0=fm(),g0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function _0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!oa(e):t?mm(e)<=t:!1}ke.inlineRef=_0;var y0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function oa(e){for(let t in e){if(y0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(oa)||typeof r=="object"&&oa(r))return!0}return!1}function mm(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!g0.has(r)&&(typeof e[r]=="object"&&(0,f0.eachItem)(e[r],n=>t+=mm(n)),t===1/0))return 1/0}return t}function hm(e,t="",r){r!==!1&&(t=ur(t));let n=e.parse(t);return gm(e,n)}ke.getFullPath=hm;function gm(e,t){return e.serialize(t).split("#")[0]+"#"}ke._getFullPath=gm;var v0=/#\/?$/;function ur(e){return e?e.replace(v0,""):""}ke.normalizeId=ur;function $0(e,t,r){return r=ur(r),e.resolve(t,r)}ke.resolveUrl=$0;var w0=/^[a-z_][-a-z0-9._]*$/i;function b0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=ur(e[r]||t),s={"":o},i=hm(n,o,!1),a={},c=new Set;return h0(e,{allKeys:!0},(p,m,f,g)=>{if(g===void 0)return;let _=i+m,y=s[g];typeof p[r]=="string"&&(y=v.call(this,p[r])),k.call(this,p.$anchor),k.call(this,p.$dynamicAnchor),s[m]=y;function v(x){let S=this.opts.uriResolver.resolve;if(x=ur(y?S(y,x):x),c.has(x))throw l(x);c.add(x);let P=this.refs[x];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?u(p,P.schema,x):x!==ur(_)&&(x[0]==="#"?(u(p,a[x],x),a[x]=p):this.refs[x]=_),x}function k(x){if(typeof x=="string"){if(!w0.test(x))throw new Error(`invalid anchor "${x}"`);v.call(this,`#${x}`)}}}),a;function u(p,m,f){if(m!==void 0&&!m0(p,m))throw l(f)}function l(p){return new Error(`reference "${p}" resolves to more than one schema`)}}ke.getSchemaRefs=b0});var fn=z(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.getData=St.KeywordCxt=St.validateFunctionCode=void 0;var wm=Wf(),_m=un(),ia=Wi(),ko=un(),x0=nm(),pn=cm(),sa=lm(),E=C(),I=pt(),z0=ln(),ft=D(),dn=cn();function S0(e){if(zm(e)&&(Sm(e),xm(e))){T0(e);return}bm(e,()=>(0,wm.topBoolOrEmptySchema)(e))}St.validateFunctionCode=S0;function bm({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,(0,E._)`${I.default.data}, ${I.default.valCxt}`,n.$async,()=>{e.code((0,E._)`"use strict"; ${ym(r,o)}`),P0(e,o),e.code(s)}):e.func(t,(0,E._)`${I.default.data}, ${k0(o)}`,n.$async,()=>e.code(ym(r,o)).code(s))}function k0(e){return(0,E._)`{${I.default.instancePath}="", ${I.default.parentData}, ${I.default.parentDataProperty}, ${I.default.rootData}=${I.default.data}${e.dynamicRef?(0,E._)`, ${I.default.dynamicAnchors}={}`:E.nil}}={}`}function P0(e,t){e.if(I.default.valCxt,()=>{e.var(I.default.instancePath,(0,E._)`${I.default.valCxt}.${I.default.instancePath}`),e.var(I.default.parentData,(0,E._)`${I.default.valCxt}.${I.default.parentData}`),e.var(I.default.parentDataProperty,(0,E._)`${I.default.valCxt}.${I.default.parentDataProperty}`),e.var(I.default.rootData,(0,E._)`${I.default.valCxt}.${I.default.rootData}`),t.dynamicRef&&e.var(I.default.dynamicAnchors,(0,E._)`${I.default.valCxt}.${I.default.dynamicAnchors}`)},()=>{e.var(I.default.instancePath,(0,E._)`""`),e.var(I.default.parentData,(0,E._)`undefined`),e.var(I.default.parentDataProperty,(0,E._)`undefined`),e.var(I.default.rootData,I.default.data),t.dynamicRef&&e.var(I.default.dynamicAnchors,(0,E._)`{}`)})}function T0(e){let{schema:t,opts:r,gen:n}=e;bm(e,()=>{r.$comment&&t.$comment&&Pm(e),C0(e),n.let(I.default.vErrors,null),n.let(I.default.errors,0),r.unevaluated&&E0(e),km(e),j0(e)})}function E0(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,E._)`${r}.evaluated`),t.if((0,E._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,E._)`${e.evaluated}.props`,(0,E._)`undefined`)),t.if((0,E._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,E._)`${e.evaluated}.items`,(0,E._)`undefined`))}function ym(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,E._)`/*# sourceURL=${r} */`:E.nil}function R0(e,t){if(zm(e)&&(Sm(e),xm(e))){I0(e,t);return}(0,wm.boolOrEmptySchema)(e,t)}function xm({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function zm(e){return typeof e.schema!="boolean"}function I0(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Pm(e),N0(e),A0(e);let s=n.const("_errs",I.default.errors);km(e,s),n.var(t,(0,E._)`${s} === ${I.default.errors}`)}function Sm(e){(0,ft.checkUnknownRules)(e),O0(e)}function km(e,t){if(e.opts.jtd)return vm(e,[],!1,t);let r=(0,_m.getSchemaTypes)(e.schema),n=(0,_m.coerceAndCheckDataType)(e,r);vm(e,r,!n,t)}function O0(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,ft.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function C0(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ft.checkStrictMode)(e,"default is ignored in the schema root")}function N0(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,z0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function A0(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Pm({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code((0,E._)`${I.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,E.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,E._)`${I.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function j0(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if((0,E._)`${I.default.errors} === 0`,()=>t.return(I.default.data),()=>t.throw((0,E._)`new ${o}(${I.default.vErrors})`)):(t.assign((0,E._)`${n}.errors`,I.default.vErrors),s.unevaluated&&Z0(e),t.return((0,E._)`${I.default.errors} === 0`))}function Z0({gen:e,evaluated:t,props:r,items:n}){r instanceof E.Name&&e.assign((0,E._)`${t}.props`,r),n instanceof E.Name&&e.assign((0,E._)`${t}.items`,n)}function vm(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,ft.schemaHasRulesButRef)(s,l))){o.block(()=>Em(e,"$ref",l.all.$ref.definition));return}c.jtd||D0(e,t),o.block(()=>{for(let m of l.rules)p(m);p(l.post)});function p(m){(0,ia.shouldUseGroup)(s,m)&&(m.type?(o.if((0,ko.checkDataType)(m.type,i,c.strictNumbers)),$m(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,ko.reportTypeError)(e)),o.endIf()):$m(e,m),a||o.if((0,E._)`${I.default.errors} === ${n||0}`))}}function $m(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,x0.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,ia.shouldUseRule)(n,s)&&Em(e,s.keyword,s.definition,t.type)})}function D0(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(M0(e,t),e.opts.allowUnionTypes||q0(e,t),U0(e,e.dataTypes))}function M0(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Tm(e.dataTypes,r)||aa(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),F0(e,t)}}function q0(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&aa(e,"use allowUnionTypes to allow union type keyword")}function U0(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,ia.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>L0(t,i))&&aa(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function L0(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Tm(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function F0(e,t){let r=[];for(let n of e.dataTypes)Tm(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function aa(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,ft.checkStrictMode)(e,t,e.opts.strictTypes)}var Po=class{constructor(t,r,n){if((0,pn.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ft.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Rm(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,pn.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",I.default.errors))}result(t,r,n){this.failResult((0,E.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,E.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,E._)`${r} !== undefined && (${(0,E.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?dn.reportExtraError:dn.reportError)(this,this.def.error,r)}$dataError(){(0,dn.reportError)(this,this.def.$dataError||dn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,dn.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=E.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=E.nil,r=E.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,E.or)((0,E._)`${o} === undefined`,r)),t!==E.nil&&n.assign(t,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==E.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,E.or)(i(),a());function i(){if(n.length){if(!(r instanceof E.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,E._)`${(0,ko.checkDataTypes)(c,r,s.opts.strictNumbers,ko.DataType.Wrong)}`}return E.nil}function a(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,E._)`!${c}(${r})`}return E.nil}}subschema(t,r){let n=(0,sa.getSubschema)(this.it,t);(0,sa.extendSubschemaData)(n,this.it,t),(0,sa.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return R0(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=ft.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=ft.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,E.Name)),!0}};St.KeywordCxt=Po;function Em(e,t,r,n){let o=new Po(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,pn.funcKeywordCode)(o,r):"macro"in r?(0,pn.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,pn.funcKeywordCode)(o,r)}var V0=/^\/(?:[^~]|~0|~1)*$/,H0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Rm(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return I.default.rootData;if(e[0]==="/"){if(!V0.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=I.default.rootData}else{let u=H0.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,E._)`${s}${(0,E.getProperty)((0,ft.unescapeJsonPointer)(u))}`,i=(0,E._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}St.getData=Rm});var To=z(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});var ca=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};ua.default=ca});var mn=z(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var la=ln(),da=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,la.resolveUrl)(t,r,n),this.missingSchema=(0,la.normalizeId)((0,la.getFullPath)(t,this.missingRef))}};pa.default=da});var Ro=z(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.resolveSchema=Ue.getCompilingSchema=Ue.resolveRef=Ue.compileSchema=Ue.SchemaEnv=void 0;var Ke=C(),J0=To(),Zt=pt(),Be=ln(),Im=D(),K0=fn(),lr=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Be.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};Ue.SchemaEnv=lr;function ma(e){let t=Om.call(this,e);if(t)return t;let r=(0,Be.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new Ke.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:J0.default,code:(0,Ke._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Zt.default.data,parentData:Zt.default.parentData,parentDataProperty:Zt.default.parentDataProperty,dataNames:[Zt.default.data],dataPathArr:[Ke.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Ke.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Ke.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ke._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,K0.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let p=i.toString();l=`${i.scopeRefs(Zt.default.scope)}return ${p}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Zt.default.self}`,`${Zt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:p,scopeValues:i._values}),this.opts.unevaluated){let{props:g,items:_}=u;f.evaluated={props:g instanceof Ke.Name?void 0:g,items:_ instanceof Ke.Name?void 0:_,dynamicProps:g instanceof Ke.Name,dynamicItems:_ instanceof Ke.Name},f.source&&(f.source.evaluated=(0,Ke.stringify)(f.evaluated))}return e.validate=f,e}catch(p){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),p}finally{this._compilations.delete(e)}}Ue.compileSchema=ma;function B0(e,t,r){var n;r=(0,Be.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=Y0.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new lr({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=G0.call(this,s)}Ue.resolveRef=B0;function G0(e){return(0,Be.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:ma.call(this,e)}function Om(e){for(let t of this._compilations)if(W0(t,e))return t}Ue.getCompilingSchema=Om;function W0(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Y0(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Eo.call(this,e,t)}function Eo(e,t){let r=this.opts.uriResolver.parse(t),n=(0,Be._getFullPath)(this.opts.uriResolver,r),o=(0,Be.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return fa.call(this,r,e);let s=(0,Be.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Eo.call(this,e,i);return typeof a?.schema!="object"?void 0:fa.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||ma.call(this,i),s===(0,Be.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Be.resolveUrl)(this.opts.uriResolver,o,u)),new lr({schema:a,schemaId:c,root:e,baseId:o})}return fa.call(this,r,i)}}Ue.resolveSchema=Eo;var Q0=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function fa(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Im.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Q0.has(a)&&u&&(t=(0,Be.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Im.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Be.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=Eo.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new lr({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var Cm=z((tC,X0)=>{X0.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var $a=z((rC,qm)=>{"use strict";var eb=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),ga=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Dt=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),_a=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Am=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),ya=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),tb=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Pe=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Pe[t]="%"+e[t>>4]+e[t&15]}function ye(e){return e<2048?Pe[192|e>>6]+Pe[128|e&63]:e<65536?Pe[224|e>>12]+Pe[128|e>>6&63]+Pe[128|e&63]:Pe[240|e>>18]+Pe[128|e>>12&63]+Pe[128|e>>6&63]+Pe[128|e&63]}function rb(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var nb=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),ob=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),sb=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),ib=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function ab(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!sb(e[t])){if(e[t]==="%"&&t+2<e.length&&Dt(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function Nm(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)e[a]==="0"?(n===-1&&(n=a),o++,o>r&&(r=o,t=n)):(n=-1,o=0);if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function cb(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!ga(c))return;s+=2;continue}if(!nb(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1)return s!==8?void 0:Nm(o);if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<o.length;a++)i.push(o[a]);return Nm(i)}function ha(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&ob(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(ub(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(o=n.slice(s+a),!ab(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=cb(n);return i===void 0?{host:e,isIPV6:!1,error:!0}:{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function ub(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function lb(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var db={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},pb=/[@/?#:]/g,fb=/[@/?#]/g;function jm(e,t){let r=t?fb:pb;return r.lastIndex=0,e.replace(r,n=>db[n])}function Zm(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(Dt(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&_a(i)?r+=i:r+="%"+s,n+=2;continue}}r+=e[n]}return r}function mb(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Dt(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&_a(i)?t+=i:t+="%"+s,r+=2;continue}}if(Am(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=Mm(o)?n:Pe[o];else if(o<55296||o>57343)t+=ye(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=ye(65536+(o-55296<<10)+(s-56320)),r++):t+=ye(65533)}else t+=ye(65533)}}return t}function hb(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let s=e[o];if(s==="%"&&o+2<e.length){let i=e.slice(o+1,o+3);if(Dt(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/"&&(n=!1),Am(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Pe[i];else if(i<55296||i>57343)r+=ye(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);a>=56320&&a<=57343?(r+=ye(65536+(i-55296<<10)+(a-56320)),o++):r+=ye(65533)}else r+=ye(65533)}}return r}function va(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Dt(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Pe[s];else if(s<55296||s>57343)r+=ye(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);i>=56320&&i<=57343?(r+=ye(65536+(s-55296<<10)+(i-56320)),n++):r+=ye(65533)}else r+=ye(65533)}}return r}function Dm(e){return va(e,tb)}function gb(e){return va(e,ya)}function _b(e){return va(e,ya)}function Mm(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function yb(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Dt(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));_a(i)?t+=i:t+="%"+s,r+=2;continue}}if(ya(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=Mm(o)?n:Pe[o];else if(o<55296||o>57343)t+=ye(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=ye(65536+(o-55296<<10)+(s-56320)),r++):t+=ye(65533)}else t+=ye(65533)}}return t}function vb(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Dt(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function $b(e){let t=[];if(e.userinfo!==void 0&&(t.push(Dm(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!ga(r)){let n=ha(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=Zm(r,!0),n=ha(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=jm(r,!1)}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}qm.exports={nonSimpleDomain:ib,recomposeAuthority:$b,reescapeHostDelimiters:jm,normalizePercentEncoding:Zm,normalizePathEncoding:mb,serializePathEncoding:hb,normalizeQueryFragmentEncoding:yb,encodeUserinfo:Dm,encodeQuery:gb,encodeFragment:_b,escapePreservingEscapes:vb,removeDotSegments:lb,isIPv4:ga,isUUID:eb,normalizeIPv6:ha,stringArrayToHexStripped:rb}});var Hm=z((nC,Vm)=>{"use strict";var{isUUID:wb}=$a(),bb=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,xb=["http","https","ws","wss","urn","urn:uuid"];function zb(e){return xb.indexOf(e)!==-1}function wa(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function Um(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Lm(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function Sb(e){return e.secure=wa(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function kb(e){if((e.port===(wa(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function Pb(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(bb);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=ba(o);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Tb(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=ba(o);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function Eb(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!wb(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Rb(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Fm={scheme:"http",domainHost:!0,parse:Um,serialize:Lm},Ib={scheme:"https",domainHost:Fm.domainHost,parse:Um,serialize:Lm},Io={scheme:"ws",domainHost:!0,parse:Sb,serialize:kb},Ob={scheme:"wss",domainHost:Io.domainHost,parse:Io.parse,serialize:Io.serialize},Cb={scheme:"urn",parse:Pb,serialize:Tb,skipNormalize:!0},Nb={scheme:"urn:uuid",parse:Eb,serialize:Rb,skipNormalize:!0},Oo={http:Fm,https:Ib,ws:Io,wss:Ob,urn:Cb,"urn:uuid":Nb};Object.setPrototypeOf(Oo,null);function ba(e){return e&&(Oo[e]||Oo[e.toLowerCase()])||void 0}Vm.exports={wsIsSecure:wa,SCHEMES:Oo,isValidSchemeName:zb,getSchemeHandler:ba}});var sh=z((oC,Ao)=>{"use strict";var{normalizeIPv6:Wm,removeDotSegments:gn,recomposeAuthority:Ab,normalizePercentEncoding:Ym,normalizePathEncoding:jb,serializePathEncoding:Jm,normalizeQueryFragmentEncoding:Km,encodeQuery:Zb,encodeFragment:Db,reescapeHostDelimiters:Mb,isIPv4:Qm,nonSimpleDomain:qb}=$a(),{SCHEMES:Xm,getSchemeHandler:xa}=Hm(),eh=/^[A-Za-z][A-Za-z0-9+.-]*$/u,th="URI scheme is malformed.";function Bm(e){let t=unescape(String(e));if(!eh.test(t))throw new TypeError(th);return t}function Ub(e,t){return typeof e=="string"?e=Gb(e,t):typeof e=="object"&&(e=No(Mt(e,t),t)),e}function Lb(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=Co(e,n),{parsed:l,malformedAuthorityOrPort:p,malformedPercentEncoding:m,malformedSchemeSpecific:f,malformedHost:g,malformedScheme:_}=Co(t,n);if(s||p||i||m||a||f||c||g||u||_)throw new Error(o.error||l.error||"URI is malformed.");let y=rh(o,l,n,!0),v=xa(r&&r.scheme||y.scheme),k=y.host,x=k!==void 0&&k!==""&&(Qm(k)||Wm(k).isIPV6);nh(y,r||{},v,x);let S=k&&k.indexOf("%")!==-1&&!/\P{ASCII}/u.test(k);if(y.error&&!S)throw new Error(y.error);return n.skipEscape=!0,Mt(y,n)}function rh(e,t,r,n){let o={};return n||(e=No(Mt(e,r),r),t=No(Mt(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=gn(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=gn(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=gn(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=gn(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function Fb(e,t,r){let n=Gm(e,r),o=Gm(t,r);return n!==void 0&&o!==void 0&&n===o}function Mt(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=Bm(r.scheme));let s=xa(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(n.skipEscape?r.path=Ym(r.path):r.path=Jm(r.path,a)),n.reference!=="suffix"&&r.scheme&&(r.scheme=Bm(r.scheme),o.push(r.scheme,":"));let c=Ab(r);if(c!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(c),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let u=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(u=gn(u)),a&&(u=Jm(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",Zb(r.query)),r.fragment!==void 0&&o.push("#",Db(r.fragment)),o.join("")}var Vb=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Hb=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Jb=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Kb(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function hn(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Bb(e){let t=e[4];return hn(e[3])||t!==void 0&&!(t[0]==="["&&t[t.length-1]==="]")&&hn(t)||hn(e[6])||hn(e[7])||hn(e[8])}function nh(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&e.host[0]!=="["&&(t.domainHost||r&&r.domainHost)&&n===!1&&qb(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}return!1}function Co(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let p=e.match(Hb);p!==null&&p[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let m=e.match(Jb);if(m!==null){let g=m[1],_=g.replace(/[\t\n\r]/g,"");_.length>=2&&(_.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):g.length!==_.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let f=e.match(Vb);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0){let y=unescape(n.scheme);eh.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||th,u=!0)}s=Bb(f),s&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=f[5]);let g=Kb(n,f);if(g!==void 0&&(n.error=n.error||g,o=!0),n.host)if(Qm(n.host)===!1){let v=n.host[0]==="["&&n.host[n.host.length-1]==="]",k=Wm(n.host);l=k.isIPV6||k.isIPVFuture===!0,c=v&&k.error===!0,n.host=l?k.host:k.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",o=!0)}else l=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let _=xa(r.scheme||n.scheme);if(a=nh(n,r,_,l),!_||_&&!_.skipNormalize){if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=l?n.host:Ym(n.host,!0);n.host=Mb(y,l)}n.path&&(n.path=jb(n.path)),n.query&&(n.query=Km(n.query)),n.fragment&&(n.fragment=Km(n.fragment))}_&&_.parse&&(_.parse(n,r),_===Xm.urn&&n.nid===void 0&&(i=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function No(e,t){return Co(e,t).parsed}function Gb(e,t){return oh(e,t).normalized}function oh(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=Co(e,t);return{normalized:n||o||s||i||a?e:Mt(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function Gm(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:Mt(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=oh(r,t);return o||s||i||a||c?void 0:n}var za={SCHEMES:Xm,normalize:Ub,resolve:Lb,resolveComponent:rh,equal:Fb,serialize:Mt,parse:No};Ao.exports=za;Ao.exports.default=za;Ao.exports.fastUri=za});var ah=z(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var ih=sh();ih.code='require("ajv/dist/runtime/uri").default';Sa.default=ih});var hh=z(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.CodeGen=pe.Name=pe.nil=pe.stringify=pe.str=pe._=pe.KeywordCxt=void 0;var Wb=fn();Object.defineProperty(pe,"KeywordCxt",{enumerable:!0,get:function(){return Wb.KeywordCxt}});var dr=C();Object.defineProperty(pe,"_",{enumerable:!0,get:function(){return dr._}});Object.defineProperty(pe,"str",{enumerable:!0,get:function(){return dr.str}});Object.defineProperty(pe,"stringify",{enumerable:!0,get:function(){return dr.stringify}});Object.defineProperty(pe,"nil",{enumerable:!0,get:function(){return dr.nil}});Object.defineProperty(pe,"Name",{enumerable:!0,get:function(){return dr.Name}});Object.defineProperty(pe,"CodeGen",{enumerable:!0,get:function(){return dr.CodeGen}});var Yb=To(),ph=mn(),Qb=Gi(),_n=Ro(),Xb=C(),yn=ln(),jo=un(),Pa=D(),ch=Cm(),ex=ah(),fh=(e,t)=>new RegExp(e,t);fh.code="new RegExp";var tx=["removeAdditional","useDefaults","coerceTypes"],rx=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),nx={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},ox={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},uh=200;function sx(e){var t,r,n,o,s,i,a,c,u,l,p,m,f,g,_,y,v,k,x,S,P,Re,Ne,Tr,rs;let Er=e.strict,ns=(t=e.code)===null||t===void 0?void 0:t.optimize,Ac=ns===!0||ns===void 0?1:ns||0,jc=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:fh,a_=(o=e.uriResolver)!==null&&o!==void 0?o:ex.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:Er)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:Er)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Er)!==null&&l!==void 0?l:"log",strictTuples:(m=(p=e.strictTuples)!==null&&p!==void 0?p:Er)!==null&&m!==void 0?m:"log",strictRequired:(g=(f=e.strictRequired)!==null&&f!==void 0?f:Er)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Ac,regExp:jc}:{optimize:Ac,regExp:jc},loopRequired:(_=e.loopRequired)!==null&&_!==void 0?_:uh,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:uh,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(x=e.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(S=e.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:(P=e.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(Re=e.validateSchema)!==null&&Re!==void 0?Re:!0,validateFormats:(Ne=e.validateFormats)!==null&&Ne!==void 0?Ne:!0,unicodeRegExp:(Tr=e.unicodeRegExp)!==null&&Tr!==void 0?Tr:!0,int32range:(rs=e.int32range)!==null&&rs!==void 0?rs:!0,uriResolver:a_}}var vn=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...sx(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new Xb.ValueScope({scope:{},prefixes:rx,es5:r,lines:n}),this.logger=dx(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,Qb.getRules)(),lh.call(this,nx,t,"NOT SUPPORTED"),lh.call(this,ox,t,"DEPRECATED","warn"),this._metaOpts=ux.call(this),t.formats&&ax.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&cx.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),ix.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=ch;n==="id"&&(o={...ch},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,p){await s.call(this,l.$schema);let m=this._addSchema(l,p);return m.validate||i.call(this,m)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(p){if(!(p instanceof ph.default))throw p;return a.call(this,p),await c.call(this,p.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:p}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${p} cannot be resolved`)}async function c(l){let p=await u.call(this,l);this.refs[l]||await s.call(this,p.$schema),this.refs[l]||this.addSchema(p,l,r)}async function u(l){let p=this._loading[l];if(p)return p;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,n,o);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,yn.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(t){let r;for(;typeof(r=dh.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new _n.SchemaEnv({schema:{},schemaId:n});if(r=_n.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=dh.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,yn.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(fx.call(this,n,r),!r)return(0,Pa.eachItem)(n,s=>ka.call(this,s)),this;hx.call(this,r);let o={...r,type:(0,jo.getJSONTypes)(r.type),schemaType:(0,jo.getJSONTypes)(r.schemaType)};return(0,Pa.eachItem)(n,o.type.length===0?s=>ka.call(this,s,o):s=>o.type.forEach(i=>ka.call(this,s,o,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(s=>s.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let s=o.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=mh(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,yn.normalizeId)(i||n);let u=yn.getSchemaRefs.call(this,t,n);return c=new _n.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):_n.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{_n.compileSchema.call(this,t)}finally{this.opts=r}}};vn.ValidationError=Yb.default;vn.MissingRefError=ph.default;pe.default=vn;function lh(e,t,r,n="error"){for(let o in e){let s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function dh(e){return e=(0,yn.normalizeId)(e),this.schemas[e]||this.refs[e]}function ix(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function ax(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function cx(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function ux(){let e={...this.opts};for(let t of tx)delete e[t];return e}var lx={log(){},warn(){},error(){}};function dx(e){if(e===!1)return lx;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var px=/^[a-z_$][a-z0-9_$:-]*$/i;function fx(e,t){let{RULES:r}=this;if((0,Pa.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!px.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function ka(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,jo.getJSONTypes)(t.type),schemaType:(0,jo.getJSONTypes)(t.schemaType)}};t.before?mx.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function mx(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function hx(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=mh(t)),e.validateSchema=this.compile(t,!0))}var gx={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function mh(e){return{anyOf:[e,gx]}}});var gh=z(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});var _x={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ta.default=_x});var $h=z(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.callRef=qt.getValidate=void 0;var yx=mn(),_h=qe(),Te=C(),pr=pt(),yh=Ro(),Zo=D(),vx={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return p();let l=yh.resolveRef.call(c,u,o,r);if(l===void 0)throw new yx.default(n.opts.uriResolver,o,r);if(l instanceof yh.SchemaEnv)return m(l);return f(l);function p(){if(s===u)return Do(e,i,s,s.$async);let g=t.scopeValue("root",{ref:u});return Do(e,(0,Te._)`${g}.validate`,u,u.$async)}function m(g){let _=vh(e,g);Do(e,_,g,g.$async)}function f(g){let _=t.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Te.stringify)(g)}:{ref:g}),y=t.name("valid"),v=e.subschema({schema:g,dataTypes:[],schemaPath:Te.nil,topSchemaRef:_,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function vh(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Te._)`${r.scopeValue("wrapper",{ref:t})}.validate`}qt.getValidate=vh;function Do(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?pr.default.this:Te.nil;n?l():p();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let g=o.let("valid");o.try(()=>{o.code((0,Te._)`await ${(0,_h.callValidateCode)(e,t,u)}`),f(t),i||o.assign(g,!0)},_=>{o.if((0,Te._)`!(${_} instanceof ${s.ValidationError})`,()=>o.throw(_)),m(_),i||o.assign(g,!1)}),e.ok(g)}function p(){e.result((0,_h.callValidateCode)(e,t,u),()=>f(t),()=>m(t))}function m(g){let _=(0,Te._)`${g}.errors`;o.assign(pr.default.vErrors,(0,Te._)`${pr.default.vErrors} === null ? ${_} : ${pr.default.vErrors}.concat(${_})`),o.assign(pr.default.errors,(0,Te._)`${pr.default.vErrors}.length`)}function f(g){var _;if(!s.opts.unevaluated)return;let y=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=Zo.mergeEvaluated.props(o,y.props,s.props));else{let v=o.var("props",(0,Te._)`${g}.evaluated.props`);s.props=Zo.mergeEvaluated.props(o,v,s.props,Te.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=Zo.mergeEvaluated.items(o,y.items,s.items));else{let v=o.var("items",(0,Te._)`${g}.evaluated.items`);s.items=Zo.mergeEvaluated.items(o,v,s.items,Te.Name)}}}qt.callRef=Do;qt.default=vx});var wh=z(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var $x=gh(),wx=$h(),bx=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",$x.default,wx.default];Ea.default=bx});var bh=z(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var Mo=C(),kt=Mo.operators,qo={maximum:{okStr:"<=",ok:kt.LTE,fail:kt.GT},minimum:{okStr:">=",ok:kt.GTE,fail:kt.LT},exclusiveMaximum:{okStr:"<",ok:kt.LT,fail:kt.GTE},exclusiveMinimum:{okStr:">",ok:kt.GT,fail:kt.LTE}},xx={message:({keyword:e,schemaCode:t})=>(0,Mo.str)`must be ${qo[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Mo._)`{comparison: ${qo[e].okStr}, limit: ${t}}`},zx={keyword:Object.keys(qo),type:"number",schemaType:"number",$data:!0,error:xx,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Mo._)`${r} ${qo[t].fail} ${n} || isNaN(${r})`)}};Ra.default=zx});var xh=z(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var $n=C(),Sx={message:({schemaCode:e})=>(0,$n.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,$n._)`{multipleOf: ${e}}`},kx={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Sx,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,$n._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,$n._)`${i} !== parseInt(${i})`;e.fail$data((0,$n._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Ia.default=kx});var Sh=z(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});function zh(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}Oa.default=zh;zh.code='require("ajv/dist/runtime/ucs2length").default'});var kh=z(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var Ut=C(),Px=D(),Tx=Sh(),Ex={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Ut.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Ut._)`{limit: ${e}}`},Rx={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Ex,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?Ut.operators.GT:Ut.operators.LT,i=o.opts.unicode===!1?(0,Ut._)`${r}.length`:(0,Ut._)`${(0,Px.useFunc)(e.gen,Tx.default)}(${r})`;e.fail$data((0,Ut._)`${i} ${s} ${n}`)}};Ca.default=Rx});var Ph=z(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var Ix=qe(),Ox=D(),fr=C(),Cx={message:({schemaCode:e})=>(0,fr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,fr._)`{pattern: ${e}}`},Nx={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Cx,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,fr._)`new RegExp`:(0,Ox.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,fr._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,fr._)`!${l}`)}else{let c=(0,Ix.usePattern)(e,o);e.fail$data((0,fr._)`!${c}.test(${r})`)}}};Na.default=Nx});var Th=z(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var wn=C(),Ax={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,wn.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,wn._)`{limit: ${e}}`},jx={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Ax,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?wn.operators.GT:wn.operators.LT;e.fail$data((0,wn._)`Object.keys(${r}).length ${o} ${n}`)}};Aa.default=jx});var Eh=z(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var bn=qe(),xn=C(),Zx=D(),Dx={message:({params:{missingProperty:e}})=>(0,xn.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,xn._)`{missingProperty: ${e}}`},Mx={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Dx,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:g}=e.it;for(let _ of r)if(f?.[_]===void 0&&!g.has(_)){let y=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${_}" is not defined at "${y}" (strictRequired)`;(0,Zx.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(xn.nil,p);else for(let f of r)(0,bn.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||s){let g=t.let("valid",!0);e.block$data(g,()=>m(f,g)),e.ok(g)}else t.if((0,bn.checkMissingProp)(e,r,f)),(0,bn.reportMissingProp)(e,f),t.else()}function p(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,bn.noPropertyInData)(t,o,f,a.ownProperties),()=>e.error())})}function m(f,g){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(g,(0,bn.propertyInData)(t,o,f,a.ownProperties)),t.if((0,xn.not)(g),()=>{e.error(),t.break()})},xn.nil)}}};ja.default=Mx});var Rh=z(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});var zn=C(),qx={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,zn.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,zn._)`{limit: ${e}}`},Ux={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:qx,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?zn.operators.GT:zn.operators.LT;e.fail$data((0,zn._)`${r}.length ${o} ${n}`)}};Za.default=Ux});var Uo=z(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var Ih=na();Ih.code='require("ajv/dist/runtime/equal").default';Da.default=Ih});var Oh=z(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var Ma=un(),fe=C(),Lx=D(),Fx=Uo(),Vx={message:({params:{i:e,j:t}})=>(0,fe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,fe._)`{i: ${e}, j: ${t}}`},Hx={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Vx,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?(0,Ma.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,fe._)`${i} === false`),e.ok(c);function l(){let g=t.let("i",(0,fe._)`${r}.length`),_=t.let("j");e.setParams({i:g,j:_}),t.assign(c,!0),t.if((0,fe._)`${g} > 1`,()=>(p()?m:f)(g,_))}function p(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function m(g,_){let y=t.name("item"),v=(0,Ma.checkDataTypes)(u,y,a.opts.strictNumbers,Ma.DataType.Wrong),k=t.const("indices",(0,fe._)`{}`);t.for((0,fe._)`;${g}--;`,()=>{t.let(y,(0,fe._)`${r}[${g}]`),t.if(v,(0,fe._)`continue`),u.length>1&&t.if((0,fe._)`typeof ${y} == "string"`,(0,fe._)`${y} += "_"`),t.if((0,fe._)`typeof ${k}[${y}] == "number"`,()=>{t.assign(_,(0,fe._)`${k}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,fe._)`${k}[${y}] = ${g}`)})}function f(g,_){let y=(0,Lx.useFunc)(t,Fx.default),v=t.name("outer");t.label(v).for((0,fe._)`;${g}--;`,()=>t.for((0,fe._)`${_} = ${g}; ${_}--;`,()=>t.if((0,fe._)`${y}(${r}[${g}], ${r}[${_}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};qa.default=Hx});var Ch=z(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var Ua=C(),Jx=D(),Kx=Uo(),Bx={message:"must be equal to constant",params:({schemaCode:e})=>(0,Ua._)`{allowedValue: ${e}}`},Gx={keyword:"const",$data:!0,error:Bx,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s=="object"?e.fail$data((0,Ua._)`!${(0,Jx.useFunc)(t,Kx.default)}(${r}, ${o})`):e.fail((0,Ua._)`${s} !== ${r}`)}};La.default=Gx});var Nh=z(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var Sn=C(),Wx=D(),Yx=Uo(),Qx={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Sn._)`{allowedValues: ${e}}`},Xx={keyword:"enum",schemaType:"array",$data:!0,error:Qx,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,Wx.useFunc)(t,Yx.default)),l;if(a||n)l=t.let("valid"),e.block$data(l,p);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,Sn.or)(...o.map((g,_)=>m(f,_)))}e.pass(l);function p(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,Sn._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,g){let _=o[g];return typeof _=="object"&&_!==null?(0,Sn._)`${u()}(${r}, ${f}[${g}])`:(0,Sn._)`${r} === ${_}`}}};Fa.default=Xx});var Ah=z(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var ez=bh(),tz=xh(),rz=kh(),nz=Ph(),oz=Th(),sz=Eh(),iz=Rh(),az=Oh(),cz=Ch(),uz=Nh(),lz=[ez.default,tz.default,rz.default,nz.default,oz.default,sz.default,iz.default,az.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},cz.default,uz.default];Va.default=lz});var Ja=z(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.validateAdditionalItems=void 0;var Lt=C(),Ha=D(),dz={message:({params:{len:e}})=>(0,Lt.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Lt._)`{limit: ${e}}`},pz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:dz,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Ha.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}jh(e,n)}};function jh(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,Lt._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Lt._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,Ha.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Lt._)`${a} <= ${t.length}`);r.if((0,Lt.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:Ha.Type.Num},u),i.allErrors||r.if((0,Lt.not)(u),()=>r.break())})}}kn.validateAdditionalItems=jh;kn.default=pz});var Ka=z(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.validateTuple=void 0;var Zh=C(),Lo=D(),fz=qe(),mz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Dh(e,"additionalItems",t);r.items=!0,!(0,Lo.alwaysValidSchema)(r,t)&&e.ok((0,fz.validateArray)(e))}};function Dh(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Lo.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,Zh._)`${s}.length`);r.forEach((p,m)=>{(0,Lo.alwaysValidSchema)(a,p)||(n.if((0,Zh._)`${u} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(p){let{opts:m,errSchemaPath:f}=a,g=r.length,_=g===p.minItems&&(g===p.maxItems||p[t]===!1);if(m.strictTuples&&!_){let y=`"${i}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Lo.checkStrictMode)(a,y,m.strictTuples)}}}Pn.validateTuple=Dh;Pn.default=mz});var Mh=z(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});var hz=Ka(),gz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,hz.validateTuple)(e,"items")};Ba.default=gz});var Uh=z(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});var qh=C(),_z=D(),yz=qe(),vz=Ja(),$z={message:({params:{len:e}})=>(0,qh.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,qh._)`{limit: ${e}}`},wz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:$z,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,_z.alwaysValidSchema)(n,t)&&(o?(0,vz.validateAdditionalItems)(e,o):e.ok((0,yz.validateArray)(e)))}};Ga.default=wz});var Lh=z(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});var Le=C(),Fo=D(),bz={message:({params:{min:e,max:t}})=>t===void 0?(0,Le.str)`must contain at least ${e} valid item(s)`:(0,Le.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Le._)`{minContains: ${e}}`:(0,Le._)`{minContains: ${e}, maxContains: ${t}}`},xz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:bz,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,Le._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Fo.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Fo.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Fo.alwaysValidSchema)(s,r)){let _=(0,Le._)`${l} >= ${i}`;a!==void 0&&(_=(0,Le._)`${_} && ${l} <= ${a}`),e.pass(_);return}s.items=!0;let p=t.name("valid");a===void 0&&i===1?f(p,()=>t.if(p,()=>t.break())):i===0?(t.let(p,!0),a!==void 0&&t.if((0,Le._)`${o}.length > 0`,m)):(t.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let _=t.name("_valid"),y=t.let("count",0);f(_,()=>t.if(_,()=>g(y)))}function f(_,y){t.forRange("i",0,l,v=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:Fo.Type.Num,compositeRule:!0},_),y()})}function g(_){t.code((0,Le._)`${_}++`),a===void 0?t.if((0,Le._)`${_} >= ${i}`,()=>t.assign(p,!0).break()):(t.if((0,Le._)`${_} > ${a}`,()=>t.assign(p,!1).break()),i===1?t.assign(p,!0):t.if((0,Le._)`${_} >= ${i}`,()=>t.assign(p,!0)))}}};Wa.default=xz});var Hh=z(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.validateSchemaDeps=tt.validatePropertyDeps=tt.error=void 0;var Ya=C(),zz=D(),Tn=qe();tt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Ya.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Ya._)`{property: ${e},
6
6
  missingProperty: ${n},
7
7
  depsCount: ${t},
8
- deps: ${r}}`};var Zx={keyword:"dependencies",type:"object",schemaType:"object",error:et.error,code(e){let[t,r]=Dx(e);$h(e,t),wh(e,r)}};function Dx({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function $h(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,kn.propertyInData)(r,n,i,o.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,kn.checkReportMissingProp)(e,u)}):(r.if((0,La._)`${c} && (${(0,kn.checkMissingProp)(e,a,s)})`),(0,kn.reportMissingProp)(e,s),r.else())}}et.validatePropertyDeps=$h;function wh(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t)(0,jx.alwaysValidSchema)(s,t[a])||(r.if((0,kn.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}et.validateSchemaDeps=wh;et.default=Zx});var zh=z(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var xh=C(),Mx=D(),qx={message:"property name must be valid",params:({params:e})=>(0,xh._)`{propertyName: ${e.propertyName}}`},Ux={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:qx,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,Mx.alwaysValidSchema)(o,r))return;let s=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,xh.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};Fa.default=Ux});var Ha=z(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var qo=De(),Ke=C(),Lx=dt(),Uo=D(),Fx={message:"must NOT have additional properties",params:({params:e})=>(0,Ke._)`{additionalProperty: ${e.additionalProperty}}`},Vx={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Fx,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Uo.alwaysValidSchema)(i,r))return;let u=(0,qo.allSchemaProperties)(n.properties),l=(0,qo.allSchemaProperties)(n.patternProperties);p(),e.ok((0,Ke._)`${s} === ${Lx.default.errors}`);function p(){t.forIn("key",o,$=>{!u.length&&!l.length?g($):t.if(m($),()=>g($))})}function m($){let v;if(u.length>8){let R=(0,Uo.schemaRefOrVal)(i,n.properties,"properties");v=(0,qo.isOwnProperty)(t,R,$)}else u.length?v=(0,Ke.or)(...u.map(R=>(0,Ke._)`${$} === ${R}`)):v=Ke.nil;return l.length&&(v=(0,Ke.or)(v,...l.map(R=>(0,Ke._)`${(0,qo.usePattern)(e,R)}.test(${$})`))),(0,Ke.not)(v)}function f($){t.code((0,Ke._)`delete ${o}[${$}]`)}function g($){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f($);return}if(r===!1){e.setParams({additionalProperty:$}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Uo.alwaysValidSchema)(i,r)){let v=t.name("valid");c.removeAdditional==="failing"?(y($,v,!1),t.if((0,Ke.not)(v),()=>{e.reset(),f($)})):(y($,v),a||t.if((0,Ke.not)(v),()=>t.break()))}}function y($,v,R){let x={keyword:"additionalProperties",dataProp:$,dataPropType:Uo.Type.Str};R===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,v)}}};Va.default=Vx});var Ph=z(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});var Hx=dn(),kh=De(),Ja=D(),Sh=Ha(),Jx={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Sh.default.code(new Hx.KeywordCxt(s,Sh.default,"additionalProperties"));let i=(0,kh.allSchemaProperties)(r);for(let p of i)s.definedProperties.add(p);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Ja.mergeEvaluated.props(t,(0,Ja.toHash)(i),s.props));let a=i.filter(p=>!(0,Ja.alwaysValidSchema)(s,r[p]));if(a.length===0)return;let c=t.name("valid");for(let p of a)u(p)?l(p):(t.if((0,kh.propertyInData)(t,o,p,s.opts.ownProperties)),l(p),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(p),e.ok(c);function u(p){return s.opts.useDefaults&&!s.compositeRule&&r[p].default!==void 0}function l(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};Ka.default=Jx});var Ih=z(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});var Th=De(),Lo=C(),Eh=D(),Rh=D(),Kx={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,Th.allSchemaProperties)(r),c=a.filter(y=>(0,Eh.alwaysValidSchema)(s,r[y]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof Lo.Name)&&(s.props=(0,Rh.evaluatedPropsToName)(t,s.props));let{props:p}=s;m();function m(){for(let y of a)u&&f(y),s.allErrors?g(y):(t.var(l,!0),g(y),t.if(l))}function f(y){for(let $ in u)new RegExp(y).test($)&&(0,Eh.checkStrictMode)(s,`property ${$} matches pattern ${y} (use allowMatchingProperties)`)}function g(y){t.forIn("key",n,$=>{t.if((0,Lo._)`${(0,Th.usePattern)(e,y)}.test(${$})`,()=>{let v=c.includes(y);v||e.subschema({keyword:"patternProperties",schemaProp:y,dataProp:$,dataPropType:Rh.Type.Str},l),s.opts.unevaluated&&p!==!0?t.assign((0,Lo._)`${p}[${$}]`,!0):!v&&!s.allErrors&&t.if((0,Lo.not)(l),()=>t.break())})})}}};Ga.default=Kx});var Oh=z(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});var Gx=D(),Bx={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Gx.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Ba.default=Bx});var Ch=z(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});var Wx=De(),Yx={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Wx.validateUnion,error:{message:"must match a schema in anyOf"}};Wa.default=Yx});var Nh=z(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});var Fo=C(),Qx=D(),Xx={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Fo._)`{passingSchemas: ${e.passing}}`},ez={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Xx,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,p)=>{let m;(0,Qx.alwaysValidSchema)(o,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c),p>0&&t.if((0,Fo._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Fo._)`[${a}, ${p}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,p),m&&e.mergeEvaluated(m,Fo.Name)})})}}};Ya.default=ez});var Ah=z(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});var tz=D(),rz={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if((0,tz.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Qa.default=rz});var Dh=z(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});var Vo=C(),Zh=D(),nz={message:({params:e})=>(0,Vo.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Vo._)`{failingKeyword: ${e.ifClause}}`},oz={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:nz,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Zh.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=jh(n,"then"),s=jh(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else o?t.if(a,u("then")):t.if((0,Vo.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,p){return()=>{let m=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(m,i),p?t.assign(p,(0,Vo._)`${l}`):e.setParams({ifClause:l})}}}};function jh(e,t){let r=e.schema[t];return r!==void 0&&!(0,Zh.alwaysValidSchema)(e,r)}Xa.default=oz});var Mh=z(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});var sz=D(),iz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,sz.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};ec.default=iz});var qh=z(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});var az=Za(),cz=gh(),uz=Da(),lz=yh(),dz=vh(),pz=bh(),fz=zh(),mz=Ha(),hz=Ph(),gz=Ih(),_z=Oh(),yz=Ch(),vz=Nh(),$z=Ah(),wz=Dh(),bz=Mh();function xz(e=!1){let t=[_z.default,yz.default,vz.default,$z.default,wz.default,bz.default,fz.default,mz.default,pz.default,hz.default,gz.default];return e?t.push(cz.default,lz.default):t.push(az.default,uz.default),t.push(dz.default),t}tc.default=xz});var Uh=z(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});var ne=C(),zz={message:({schemaCode:e})=>(0,ne.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ne._)`{format: ${e}}`},kz={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:zz,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:p}=a;if(!c.validateFormats)return;o?m():f();function m(){let g=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),y=r.const("fDef",(0,ne._)`${g}[${i}]`),$=r.let("fType"),v=r.let("format");r.if((0,ne._)`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>r.assign($,(0,ne._)`${y}.type || "string"`).assign(v,(0,ne._)`${y}.validate`),()=>r.assign($,(0,ne._)`"string"`).assign(v,y)),e.fail$data((0,ne.or)(R(),x()));function R(){return c.strictSchema===!1?ne.nil:(0,ne._)`${i} && !${v}`}function x(){let k=l.$async?(0,ne._)`(${y}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,ne._)`${v}(${n})`,S=(0,ne._)`(typeof ${v} == "function" ? ${k} : ${v}.test(${n}))`;return(0,ne._)`${v} && ${v} !== true && ${$} === ${t} && !${S}`}}function f(){let g=p.formats[s];if(!g){R();return}if(g===!0)return;let[y,$,v]=x(g);y===t&&e.pass(k());function R(){if(c.strictSchema===!1){p.logger.warn(S());return}throw new Error(S());function S(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function x(S){let Te=S instanceof RegExp?(0,ne.regexpCode)(S):c.code.formats?(0,ne._)`${c.code.formats}${(0,ne.getProperty)(s)}`:void 0,Oe=r.scopeValue("formats",{key:s,ref:S,code:Te});return typeof S=="object"&&!(S instanceof RegExp)?[S.type||"string",S.validate,(0,ne._)`${Oe}.validate`]:["string",S,Oe]}function k(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ne._)`await ${v}(${n})`}return typeof $=="function"?(0,ne._)`${v}(${n})`:(0,ne._)`${v}.test(${n})`}}}};rc.default=kz});var Lh=z(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});var Sz=Uh(),Pz=[Sz.default];nc.default=Pz});var Fh=z(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.contentVocabulary=pr.metadataVocabulary=void 0;pr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];pr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Hh=z(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});var Tz=Qm(),Ez=ph(),Rz=qh(),Iz=Lh(),Vh=Fh(),Oz=[Tz.default,Ez.default,(0,Rz.default)(),Iz.default,Vh.metadataVocabulary,Vh.contentVocabulary];oc.default=Oz});var Kh=z(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.DiscrError=void 0;var Jh;(function(e){e.Tag="tag",e.Mapping="mapping"})(Jh||(Ho.DiscrError=Jh={}))});var Bh=z(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});var fr=C(),sc=Kh(),Gh=Po(),Cz=pn(),Nz=D(),Az={message:({params:{discrError:e,tagName:t}})=>e===sc.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,fr._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},jz={keyword:"discriminator",type:"object",schemaType:"object",error:Az,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,fr._)`${r}${(0,fr.getProperty)(a)}`);t.if((0,fr._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:sc.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=m();t.if(!1);for(let g in f)t.elseIf((0,fr._)`${u} === ${g}`),t.assign(c,p(f[g]));t.else(),e.error(!1,{discrError:sc.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function p(f){let g=t.name("valid"),y=e.subschema({keyword:"oneOf",schemaProp:f},g);return e.mergeEvaluated(y,fr.Name),g}function m(){var f;let g={},y=v(o),$=!0;for(let k=0;k<i.length;k++){let S=i[k];if(S?.$ref&&!(0,Nz.schemaHasRulesButRef)(S,s.self.RULES)){let Oe=S.$ref;if(S=Gh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Oe),S instanceof Gh.SchemaEnv&&(S=S.schema),S===void 0)throw new Cz.default(s.opts.uriResolver,s.baseId,Oe)}let Te=(f=S?.properties)===null||f===void 0?void 0:f[a];if(typeof Te!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);$=$&&(y||v(S)),R(Te,k)}if(!$)throw new Error(`discriminator: "${a}" must be required`);return g;function v({required:k}){return Array.isArray(k)&&k.includes(a)}function R(k,S){if(k.const)x(k.const,S);else if(k.enum)for(let Te of k.enum)x(Te,S);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(k,S){if(typeof k!="string"||k in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[k]=S}}}};ic.default=jz});var Wh=z((oC,Zz)=>{Zz.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Qh=z((Y,ac)=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.MissingRefError=Y.ValidationError=Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=Y.Ajv=void 0;var Dz=Jm(),Mz=Hh(),qz=Bh(),Yh=Wh(),Uz=["/properties"],Jo="http://json-schema.org/draft-07/schema",mr=class extends Dz.default{_addVocabularies(){super._addVocabularies(),Mz.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(qz.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Yh,Uz):Yh;this.addMetaSchema(t,Jo,!1),this.refs["http://json-schema.org/schema"]=Jo}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Jo)?Jo:void 0)}};Y.Ajv=mr;ac.exports=Y=mr;ac.exports.Ajv=mr;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=mr;var Lz=dn();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return Lz.KeywordCxt}});var hr=C();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return hr._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return hr.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return hr.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return hr.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return hr.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return hr.CodeGen}});var Fz=ko();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return Fz.default}});var Vz=pn();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return Vz.default}})});var ig=z(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.formatNames=rt.fastFormats=rt.fullFormats=void 0;function tt(e,t){return{validate:e,compare:t}}rt.fullFormats={date:tt(rg,dc),time:tt(uc(!0),pc),"date-time":tt(Xh(!0),og),"iso-time":tt(uc(),ng),"iso-date-time":tt(Xh(),sg),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Wz,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:nk,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:Yz,int32:{type:"number",validate:ek},int64:{type:"number",validate:tk},float:{type:"number",validate:tg},double:{type:"number",validate:tg},password:!0,binary:!0};rt.fastFormats={...rt.fullFormats,date:tt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,dc),time:tt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,pc),"date-time":tt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,og),"iso-time":tt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,ng),"iso-date-time":tt(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,sg),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};rt.formatNames=Object.keys(rt.fullFormats);function Hz(e){return e%4===0&&(e%100!==0||e%400===0)}var Jz=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Kz=[0,31,28,31,30,31,30,31,31,30,31,30,31];function rg(e){let t=Jz.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&Hz(r)?29:Kz[n])}function dc(e,t){if(e&&t)return e>t?1:e<t?-1:0}var cc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function uc(e){return function(r){let n=cc.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let p=s-l*c,m=o-u*c-(p<0?1:0);return(m===23||m===-1)&&(p===59||p===-1)&&i<61}}function pc(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function ng(e,t){if(!(e&&t))return;let r=cc.exec(e),n=cc.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var lc=/t|\s/i;function Xh(e){let t=uc(e);return function(n){let o=n.split(lc);return o.length===2&&rg(o[0])&&t(o[1])}}function og(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function sg(e,t){if(!(e&&t))return;let[r,n]=e.split(lc),[o,s]=t.split(lc),i=dc(r,o);if(i!==void 0)return i||pc(n,s)}var Gz=/\/|:/,Bz=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Wz(e){return Gz.test(e)&&Bz.test(e)}var eg=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Yz(e){return eg.lastIndex=0,eg.test(e)}var Qz=-(2**31),Xz=2**31-1;function ek(e){return Number.isInteger(e)&&e<=Xz&&e>=Qz}function tk(e){return Number.isInteger(e)}function tg(){return!0}var rk=/[^\\]\\Z/;function nk(e){if(rk.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var ag=z(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.formatLimitDefinition=void 0;var ok=Qh(),Ge=C(),Pt=Ge.operators,Ko={formatMaximum:{okStr:"<=",ok:Pt.LTE,fail:Pt.GT},formatMinimum:{okStr:">=",ok:Pt.GTE,fail:Pt.LT},formatExclusiveMaximum:{okStr:"<",ok:Pt.LT,fail:Pt.GTE},formatExclusiveMinimum:{okStr:">",ok:Pt.GT,fail:Pt.LTE}},sk={message:({keyword:e,schemaCode:t})=>(0,Ge.str)`should be ${Ko[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ge._)`{comparison: ${Ko[e].okStr}, limit: ${t}}`};gr.formatLimitDefinition={keyword:Object.keys(Ko),type:"string",schemaType:"string",$data:!0,error:sk,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new ok.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,Ge._)`${m}[${c.schemaCode}]`);e.fail$data((0,Ge.or)((0,Ge._)`typeof ${f} != "object"`,(0,Ge._)`${f} instanceof RegExp`,(0,Ge._)`typeof ${f}.compare != "function"`,p(f)))}function l(){let m=c.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${m}" does not define "compare" function`);let g=t.scopeValue("formats",{key:m,ref:f,code:i.code.formats?(0,Ge._)`${i.code.formats}${(0,Ge.getProperty)(m)}`:void 0});e.fail$data(p(g))}function p(m){return(0,Ge._)`${m}.compare(${r}, ${n}) ${Ko[o].fail} 0`}},dependencies:["format"]};var ik=e=>(e.addKeyword(gr.formatLimitDefinition),e);gr.default=ik});var dg=z((Sn,lg)=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});var _r=ig(),ak=ag(),fc=C(),cg=new fc.Name("fullFormats"),ck=new fc.Name("fastFormats"),mc=(e,t={keywords:!0})=>{if(Array.isArray(t))return ug(e,t,_r.fullFormats,cg),e;let[r,n]=t.mode==="fast"?[_r.fastFormats,ck]:[_r.fullFormats,cg],o=t.formats||_r.formatNames;return ug(e,o,r,n),t.keywords&&(0,ak.default)(e),e};mc.get=(e,t="full")=>{let n=(t==="fast"?_r.fastFormats:_r.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function ug(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,fc._)`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}lg.exports=Sn=mc;Object.defineProperty(Sn,"__esModule",{value:!0});Sn.default=mc});import{execFileSync as Ig,spawnSync as Og}from"node:child_process";import{readFileSync as bc}from"node:fs";import{homedir as Ok}from"node:os";import{join as Ck}from"node:path";import*as Cg from"node:readline/promises";import*as Le from"node:fs";import*as Tc from"node:os";import*as ie from"node:path";var Er=process.env.GIGABUDDY_HOME??ie.join(Tc.homedir(),".gigabuddy"),Et="default",Ec=ie.join(Er,"accounts"),Rc=ie.join(Er,"config.json");function Tr(e){return/^[a-z0-9][a-z0-9._-]{0,63}$/i.test(e)&&e!=="accounts"}function Lt(e){if(!Tr(e))throw new Error(`Invalid account name "${e}" \u2014 use letters, digits, dots, dashes or underscores (max 64 chars).`)}function rs(e){return Lt(e),e===Et?Er:ie.join(Ec,e)}function Un(){let e=[];try{for(let t of Le.readdirSync(Ec,{withFileTypes:!0}))t.isDirectory()&&Tr(t.name)&&e.push(t.name)}catch{}return[Et,...e.sort()]}function Ft(){try{return JSON.parse(Le.readFileSync(Rc,"utf-8"))}catch{return{}}}function ns(e){Le.existsSync(Er)||Le.mkdirSync(Er,{recursive:!0,mode:448}),Le.writeFileSync(Rc,JSON.stringify(e,null,2)+`
9
- `,{mode:384})}function Ic(e){Lt(e);let t=Ft();t.defaultAccount=e,ns(t)}function os(e,t){Lt(t);let r=Ft();r.pins={...r.pins,[ie.resolve(e)]:t},ns(r)}function Oc(e){let t=Ft(),r=ie.resolve(e);return t.pins?.[r]?(delete t.pins[r],ns(t),!0):!1}function ss(e){let t=ie.resolve(e);for(;;){if(Le.existsSync(ie.join(t,".git")))return t;let r=ie.dirname(t);if(r===t)return ie.resolve(e);t=r}}function Jg(e,t){let r=ie.relative(e,t);return r===""||!r.startsWith("..")&&!ie.isAbsolute(r)}function mt(e=process.cwd()){let t=process.env.GIGABUDDY_ACCOUNT;if(t&&Tr(t))return{name:t,source:"env"};let r=Ft(),n=ie.resolve(e),o;for(let[s,i]of Object.entries(r.pins??{}))Tr(i)&&Jg(s,n)&&(!o||s.length>o.dir.length)&&(o={dir:s,account:i});return o?{name:o.account,source:"pin",pinnedAt:o.dir}:r.defaultAccount&&Tr(r.defaultAccount)?{name:r.defaultAccount,source:"config-default"}:{name:Et,source:"fallback"}}import*as Ee from"node:fs";import*as Cc from"node:path";var Kg={shared:{prod:"credentials.json",staging:"credentials.staging.json"},user:{prod:"user-credentials.json",staging:"user-credentials.staging.json"},agent:{prod:"agent-credentials.json",staging:"agent-credentials.staging.json"}};function Rr(e=!1,t="shared",r){let n=Kg[t];return Cc.join(rs(r??mt().name),e?n.staging:n.prod)}function nt(e=!1,t="shared",r){try{let n=Ee.readFileSync(Rr(e,t,r),"utf-8"),o=JSON.parse(n);return o.refreshToken?o:null}catch{return null}}function is(e,t=!1,r="shared",n){let o=rs(n??mt().name);Ee.existsSync(o)||Ee.mkdirSync(o,{recursive:!0,mode:448}),Ln(Rr(t,r,n),JSON.stringify(e,null,2))}function Nc(e=!1,t="shared",r){let n=Rr(e,t,r);Ee.existsSync(n)&&Ee.unlinkSync(n)}function Ln(e,t){Ee.writeFileSync(e,t,{mode:384});try{Ee.chmodSync(e,384)}catch{}}var Ac,as=Object.freeze({status:"aborted"});function h(e,t,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let m=l[p];m in a||(a[m]=u[m].bind(a))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var Gg=Symbol("zod_brand"),We=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Vt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Ac=globalThis).__zod_globalConfig??(Ac.__zod_globalConfig={});var Ht=globalThis.__zod_globalConfig;function we(e){return e&&Object.assign(Ht,e),Ht}var j={};ts(j,{BIGINT_FORMAT_RANGES:()=>Mc,Class:()=>us,NUMBER_FORMAT_RANGES:()=>hs,aborted:()=>_t,allowsEval:()=>ps,assert:()=>Xg,assertEqual:()=>Bg,assertIs:()=>Yg,assertNever:()=>Qg,assertNotEqual:()=>Wg,assignProp:()=>ht,base64ToUint8Array:()=>Uc,base64urlToUint8Array:()=>g_,cached:()=>Kt,captureStackTrace:()=>Hn,cleanEnum:()=>h_,cleanRegex:()=>Nr,clone:()=>Ce,cloneDef:()=>t_,createTransparentProxy:()=>a_,defineLazy:()=>L,esc:()=>Vn,escapeRegex:()=>st,explicitlyAborted:()=>gs,extend:()=>l_,finalizeIssue:()=>Ne,floatSafeRemainder:()=>ls,getElementAtPath:()=>r_,getEnumValues:()=>Or,getLengthableOrigin:()=>Ar,getParsedType:()=>i_,getSizableOrigin:()=>qc,hexToUint8Array:()=>y_,isObject:()=>Rt,isPlainObject:()=>gt,issue:()=>Gt,joinValues:()=>Fn,jsonStringifyReplacer:()=>Jt,merge:()=>p_,mergeDefs:()=>ot,normalizeParams:()=>E,nullish:()=>Cr,numKeys:()=>s_,objectClone:()=>e_,omit:()=>u_,optionalKeys:()=>ms,parsedType:()=>_s,partial:()=>f_,pick:()=>c_,prefixIssues:()=>it,primitiveTypes:()=>Dc,promiseAllObject:()=>n_,propertyKeyTypes:()=>fs,randomString:()=>o_,required:()=>m_,safeExtend:()=>d_,shallowClone:()=>Zc,slugify:()=>ds,stringifyPrimitive:()=>Jn,uint8ArrayToBase64:()=>Lc,uint8ArrayToBase64url:()=>__,uint8ArrayToHex:()=>v_,unwrapMessage:()=>Ir});function Bg(e){return e}function Wg(e){return e}function Yg(e){}function Qg(e){throw new Error("Unexpected value in exhaustive check")}function Xg(e){}function Or(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Fn(e,t="|"){return e.map(r=>Jn(r)).join(t)}function Jt(e,t){return typeof t=="bigint"?t.toString():t}function Kt(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Cr(e){return e==null}function Nr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ls(e,t){let r=e/t,n=Math.round(r),o=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var jc=Symbol("evaluating");function L(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==jc)return n===void 0&&(n=jc,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function e_(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ht(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ot(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function t_(e){return ot(e._zod.def)}function r_(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function n_(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=n[s];return o})}function o_(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Vn(e){return JSON.stringify(e)}function ds(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Hn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Rt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ps=Kt(()=>{if(Ht.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function gt(e){if(Rt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Rt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Zc(e){return gt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function s_(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var i_=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},fs=new Set(["string","number","symbol"]),Dc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function st(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ce(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function E(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function a_(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,s){return t??(t=e()),Reflect.set(t,n,o,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function Jn(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function ms(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var hs={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Mc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function c_(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=ot(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return ht(this,"shape",i),i},checks:[]});return Ce(e,s)}function u_(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=ot(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return ht(this,"shape",i),i},checks:[]});return Ce(e,s)}function l_(e,t){if(!gt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=ot(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return ht(this,"shape",s),s}});return Ce(e,o)}function d_(e,t){if(!gt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=ot(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ht(this,"shape",n),n}});return Ce(e,r)}function p_(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ot(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ht(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ce(e,r)}function f_(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=ot(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return ht(this,"shape",c),c},checks:[]});return Ce(t,i)}function m_(e,t,r){let n=ot(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(let i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return ht(this,"shape",s),s}});return Ce(t,n)}function _t(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function gs(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function it(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ir(e){return typeof e=="string"?e:e?.message}function Ne(e,t,r){let n=e.message?e.message:Ir(e.inst?._zod.def?.error?.(e))??Ir(t?.error?.(e))??Ir(r.customError?.(e))??Ir(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=n,t?.reportInput&&(a.input=i),a}function qc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ar(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function _s(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Gt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function h_(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Uc(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Lc(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function g_(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Uc(t+r)}function __(e){return Lc(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function y_(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function v_(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var us=class{constructor(...t){}};var Fc=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Jt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Kn=h("$ZodError",Fc),ys=h("$ZodError",Fc,{Parent:Error});function vs(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function $s(e,t=r=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return n(e),r}var Gn=e=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new We;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>Ne(c,s,we())));throw Hn(a,o?.callee),a}return i.value};var Bn=e=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>Ne(c,s,we())));throw Hn(a,o?.callee),a}return i.value};var jr=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new We;return s.issues.length?{success:!1,error:new(e??Kn)(s.issues.map(i=>Ne(i,o,we())))}:{success:!0,data:s.value}},Vc=jr(ys),Zr=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Ne(i,o,we())))}:{success:!0,data:s.value}},Hc=Zr(ys),Jc=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Gn(e)(t,r,o)};var Kc=e=>(t,r,n)=>Gn(e)(t,r,n);var Gc=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Bn(e)(t,r,o)};var Bc=e=>async(t,r,n)=>Bn(e)(t,r,n);var Wc=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return jr(e)(t,r,o)};var Yc=e=>(t,r,n)=>jr(e)(t,r,n);var Qc=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Zr(e)(t,r,o)};var Xc=e=>async(t,r,n)=>Zr(e)(t,r,n);var eu=/^[cC][0-9a-z]{6,}$/,tu=/^[0-9a-z]+$/,ru=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nu=/^[0-9a-vA-V]{20}$/,ou=/^[A-Za-z0-9]{27}$/,su=/^[a-zA-Z0-9_-]{21}$/,iu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var au=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ws=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var cu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var w_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function uu(){return new RegExp(w_,"u")}var lu=/^(?:(?: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])$/,du=/^(([0-9a-fA-F]{1,4}:){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}|:))$/;var pu=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,fu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bs=/^[A-Za-z0-9_-]*$/;var hu=/^https?$/,gu=/^\+[1-9]\d{6,14}$/,_u="(?:(?:\\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])))",yu=new RegExp(`^${_u}$`);function vu(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $u(e){return new RegExp(`^${vu(e)}$`)}function wu(e){let t=vu({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${_u}T(?:${n})$`)}var bu=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},xu=/^-?\d+n?$/,zu=/^-?\d+$/,xs=/^-?\d+(?:\.\d+)?$/,ku=/^(?:true|false)$/i,Su=/^null$/i;var Pu=/^[^A-Z]*$/,Tu=/^[^a-z]*$/;var ae=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Eu={number:"number",bigint:"bigint",object:"date"},zs=h("$ZodCheckLessThan",(e,t)=>{ae.init(e,t);let r=Eu[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ks=h("$ZodCheckGreaterThan",(e,t)=>{ae.init(e,t);let r=Eu[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ru=h("$ZodCheckMultipleOf",(e,t)=>{ae.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):ls(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Iu=h("$ZodCheckNumberFormat",(e,t)=>{ae.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=hs[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,r&&(a.pattern=zu)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Ou=h("$ZodCheckMaxLength",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Cr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let i=Ar(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Cu=h("$ZodCheckMinLength",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Cr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let i=Ar(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Nu=h("$ZodCheckLengthEquals",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Cr(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,s=o.length;if(s===t.length)return;let i=Ar(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Mr=h("$ZodCheckStringFormat",(e,t)=>{var r,n;ae.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Au=h("$ZodCheckRegex",(e,t)=>{Mr.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ju=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Pu),Mr.init(e,t)}),Zu=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Tu),Mr.init(e,t)}),Du=h("$ZodCheckIncludes",(e,t)=>{ae.init(e,t);let r=st(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Mu=h("$ZodCheckStartsWith",(e,t)=>{ae.init(e,t);let r=new RegExp(`^${st(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),qu=h("$ZodCheckEndsWith",(e,t)=>{ae.init(e,t);let r=new RegExp(`.*${st(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Uu=h("$ZodCheckOverwrite",(e,t)=>{ae.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Wn=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
8
+ deps: ${r}}`};var Sz={keyword:"dependencies",type:"object",schemaType:"object",error:tt.error,code(e){let[t,r]=kz(e);Fh(e,t),Vh(e,r)}};function kz({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function Fh(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,Tn.propertyInData)(r,n,i,o.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,Tn.checkReportMissingProp)(e,u)}):(r.if((0,Ya._)`${c} && (${(0,Tn.checkMissingProp)(e,a,s)})`),(0,Tn.reportMissingProp)(e,s),r.else())}}tt.validatePropertyDeps=Fh;function Vh(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t)(0,zz.alwaysValidSchema)(s,t[a])||(r.if((0,Tn.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}tt.validateSchemaDeps=Vh;tt.default=Sz});var Kh=z(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});var Jh=C(),Pz=D(),Tz={message:"property name must be valid",params:({params:e})=>(0,Jh._)`{propertyName: ${e.propertyName}}`},Ez={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Tz,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,Pz.alwaysValidSchema)(o,r))return;let s=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,Jh.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};Qa.default=Ez});var ec=z(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});var Vo=qe(),Ge=C(),Rz=pt(),Ho=D(),Iz={message:"must NOT have additional properties",params:({params:e})=>(0,Ge._)`{additionalProperty: ${e.additionalProperty}}`},Oz={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Iz,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Ho.alwaysValidSchema)(i,r))return;let u=(0,Vo.allSchemaProperties)(n.properties),l=(0,Vo.allSchemaProperties)(n.patternProperties);p(),e.ok((0,Ge._)`${s} === ${Rz.default.errors}`);function p(){t.forIn("key",o,y=>{!u.length&&!l.length?g(y):t.if(m(y),()=>g(y))})}function m(y){let v;if(u.length>8){let k=(0,Ho.schemaRefOrVal)(i,n.properties,"properties");v=(0,Vo.isOwnProperty)(t,k,y)}else u.length?v=(0,Ge.or)(...u.map(k=>(0,Ge._)`${y} === ${k}`)):v=Ge.nil;return l.length&&(v=(0,Ge.or)(v,...l.map(k=>(0,Ge._)`${(0,Vo.usePattern)(e,k)}.test(${y})`))),(0,Ge.not)(v)}function f(y){t.code((0,Ge._)`delete ${o}[${y}]`)}function g(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Ho.alwaysValidSchema)(i,r)){let v=t.name("valid");c.removeAdditional==="failing"?(_(y,v,!1),t.if((0,Ge.not)(v),()=>{e.reset(),f(y)})):(_(y,v),a||t.if((0,Ge.not)(v),()=>t.break()))}}function _(y,v,k){let x={keyword:"additionalProperties",dataProp:y,dataPropType:Ho.Type.Str};k===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,v)}}};Xa.default=Oz});var Wh=z(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});var Cz=fn(),Bh=qe(),tc=D(),Gh=ec(),Nz={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Gh.default.code(new Cz.KeywordCxt(s,Gh.default,"additionalProperties"));let i=(0,Bh.allSchemaProperties)(r);for(let p of i)s.definedProperties.add(p);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=tc.mergeEvaluated.props(t,(0,tc.toHash)(i),s.props));let a=i.filter(p=>!(0,tc.alwaysValidSchema)(s,r[p]));if(a.length===0)return;let c=t.name("valid");for(let p of a)u(p)?l(p):(t.if((0,Bh.propertyInData)(t,o,p,s.opts.ownProperties)),l(p),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(p),e.ok(c);function u(p){return s.opts.useDefaults&&!s.compositeRule&&r[p].default!==void 0}function l(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};rc.default=Nz});var eg=z(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});var Yh=qe(),Jo=C(),Qh=D(),Xh=D(),Az={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,Yh.allSchemaProperties)(r),c=a.filter(_=>(0,Qh.alwaysValidSchema)(s,r[_]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof Jo.Name)&&(s.props=(0,Xh.evaluatedPropsToName)(t,s.props));let{props:p}=s;m();function m(){for(let _ of a)u&&f(_),s.allErrors?g(_):(t.var(l,!0),g(_),t.if(l))}function f(_){for(let y in u)new RegExp(_).test(y)&&(0,Qh.checkStrictMode)(s,`property ${y} matches pattern ${_} (use allowMatchingProperties)`)}function g(_){t.forIn("key",n,y=>{t.if((0,Jo._)`${(0,Yh.usePattern)(e,_)}.test(${y})`,()=>{let v=c.includes(_);v||e.subschema({keyword:"patternProperties",schemaProp:_,dataProp:y,dataPropType:Xh.Type.Str},l),s.opts.unevaluated&&p!==!0?t.assign((0,Jo._)`${p}[${y}]`,!0):!v&&!s.allErrors&&t.if((0,Jo.not)(l),()=>t.break())})})}}};nc.default=Az});var tg=z(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});var jz=D(),Zz={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,jz.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};oc.default=Zz});var rg=z(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});var Dz=qe(),Mz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Dz.validateUnion,error:{message:"must match a schema in anyOf"}};sc.default=Mz});var ng=z(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});var Ko=C(),qz=D(),Uz={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Ko._)`{passingSchemas: ${e.passing}}`},Lz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Uz,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,p)=>{let m;(0,qz.alwaysValidSchema)(o,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c),p>0&&t.if((0,Ko._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Ko._)`[${a}, ${p}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,p),m&&e.mergeEvaluated(m,Ko.Name)})})}}};ic.default=Lz});var og=z(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});var Fz=D(),Vz={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if((0,Fz.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};ac.default=Vz});var ag=z(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});var Bo=C(),ig=D(),Hz={message:({params:e})=>(0,Bo.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Bo._)`{failingKeyword: ${e.ifClause}}`},Jz={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Hz,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,ig.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=sg(n,"then"),s=sg(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else o?t.if(a,u("then")):t.if((0,Bo.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,p){return()=>{let m=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(m,i),p?t.assign(p,(0,Bo._)`${l}`):e.setParams({ifClause:l})}}}};function sg(e,t){let r=e.schema[t];return r!==void 0&&!(0,ig.alwaysValidSchema)(e,r)}cc.default=Jz});var cg=z(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});var Kz=D(),Bz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Kz.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};uc.default=Bz});var ug=z(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});var Gz=Ja(),Wz=Mh(),Yz=Ka(),Qz=Uh(),Xz=Lh(),eS=Hh(),tS=Kh(),rS=ec(),nS=Wh(),oS=eg(),sS=tg(),iS=rg(),aS=ng(),cS=og(),uS=ag(),lS=cg();function dS(e=!1){let t=[sS.default,iS.default,aS.default,cS.default,uS.default,lS.default,tS.default,rS.default,eS.default,nS.default,oS.default];return e?t.push(Wz.default,Qz.default):t.push(Gz.default,Yz.default),t.push(Xz.default),t}lc.default=dS});var lg=z(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});var ne=C(),pS={message:({schemaCode:e})=>(0,ne.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ne._)`{format: ${e}}`},fS={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:pS,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:p}=a;if(!c.validateFormats)return;o?m():f();function m(){let g=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),_=r.const("fDef",(0,ne._)`${g}[${i}]`),y=r.let("fType"),v=r.let("format");r.if((0,ne._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(y,(0,ne._)`${_}.type || "string"`).assign(v,(0,ne._)`${_}.validate`),()=>r.assign(y,(0,ne._)`"string"`).assign(v,_)),e.fail$data((0,ne.or)(k(),x()));function k(){return c.strictSchema===!1?ne.nil:(0,ne._)`${i} && !${v}`}function x(){let S=l.$async?(0,ne._)`(${_}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,ne._)`${v}(${n})`,P=(0,ne._)`(typeof ${v} == "function" ? ${S} : ${v}.test(${n}))`;return(0,ne._)`${v} && ${v} !== true && ${y} === ${t} && !${P}`}}function f(){let g=p.formats[s];if(!g){k();return}if(g===!0)return;let[_,y,v]=x(g);_===t&&e.pass(S());function k(){if(c.strictSchema===!1){p.logger.warn(P());return}throw new Error(P());function P(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function x(P){let Re=P instanceof RegExp?(0,ne.regexpCode)(P):c.code.formats?(0,ne._)`${c.code.formats}${(0,ne.getProperty)(s)}`:void 0,Ne=r.scopeValue("formats",{key:s,ref:P,code:Re});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,ne._)`${Ne}.validate`]:["string",P,Ne]}function S(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ne._)`await ${v}(${n})`}return typeof y=="function"?(0,ne._)`${v}(${n})`:(0,ne._)`${v}.test(${n})`}}}};dc.default=fS});var dg=z(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});var mS=lg(),hS=[mS.default];pc.default=hS});var pg=z(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.contentVocabulary=mr.metadataVocabulary=void 0;mr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];mr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var mg=z(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});var gS=wh(),_S=Ah(),yS=ug(),vS=dg(),fg=pg(),$S=[gS.default,_S.default,(0,yS.default)(),vS.default,fg.metadataVocabulary,fg.contentVocabulary];fc.default=$S});var gg=z(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.DiscrError=void 0;var hg;(function(e){e.Tag="tag",e.Mapping="mapping"})(hg||(Go.DiscrError=hg={}))});var yg=z(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});var hr=C(),mc=gg(),_g=Ro(),wS=mn(),bS=D(),xS={message:({params:{discrError:e,tagName:t}})=>e===mc.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,hr._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},zS={keyword:"discriminator",type:"object",schemaType:"object",error:xS,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,hr._)`${r}${(0,hr.getProperty)(a)}`);t.if((0,hr._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:mc.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=m();t.if(!1);for(let g in f)t.elseIf((0,hr._)`${u} === ${g}`),t.assign(c,p(f[g]));t.else(),e.error(!1,{discrError:mc.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function p(f){let g=t.name("valid"),_=e.subschema({keyword:"oneOf",schemaProp:f},g);return e.mergeEvaluated(_,hr.Name),g}function m(){var f;let g={},_=v(o),y=!0;for(let S=0;S<i.length;S++){let P=i[S];if(P?.$ref&&!(0,bS.schemaHasRulesButRef)(P,s.self.RULES)){let Ne=P.$ref;if(P=_g.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Ne),P instanceof _g.SchemaEnv&&(P=P.schema),P===void 0)throw new wS.default(s.opts.uriResolver,s.baseId,Ne)}let Re=(f=P?.properties)===null||f===void 0?void 0:f[a];if(typeof Re!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(_||v(P)),k(Re,S)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return g;function v({required:S}){return Array.isArray(S)&&S.includes(a)}function k(S,P){if(S.const)x(S.const,P);else if(S.enum)for(let Re of S.enum)x(Re,P);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(S,P){if(typeof S!="string"||S in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[S]=P}}}};hc.default=zS});var vg=z((JC,SS)=>{SS.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var wg=z((Y,gc)=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.MissingRefError=Y.ValidationError=Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=Y.Ajv=void 0;var kS=hh(),PS=mg(),TS=yg(),$g=vg(),ES=["/properties"],Wo="http://json-schema.org/draft-07/schema",gr=class extends kS.default{_addVocabularies(){super._addVocabularies(),PS.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(TS.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema($g,ES):$g;this.addMetaSchema(t,Wo,!1),this.refs["http://json-schema.org/schema"]=Wo}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Wo)?Wo:void 0)}};Y.Ajv=gr;gc.exports=Y=gr;gc.exports.Ajv=gr;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=gr;var RS=fn();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return RS.KeywordCxt}});var _r=C();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return _r._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return _r.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return _r.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return _r.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return _r.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return _r.CodeGen}});var IS=To();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return IS.default}});var OS=mn();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return OS.default}})});var Eg=z(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.formatNames=nt.fastFormats=nt.fullFormats=void 0;function rt(e,t){return{validate:e,compare:t}}nt.fullFormats={date:rt(Sg,$c),time:rt(yc(!0),wc),"date-time":rt(bg(!0),Pg),"iso-time":rt(yc(),kg),"iso-date-time":rt(bg(),Tg),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:DS,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:HS,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:MS,int32:{type:"number",validate:LS},int64:{type:"number",validate:FS},float:{type:"number",validate:zg},double:{type:"number",validate:zg},password:!0,binary:!0};nt.fastFormats={...nt.fullFormats,date:rt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,$c),time:rt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,wc),"date-time":rt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Pg),"iso-time":rt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,kg),"iso-date-time":rt(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Tg),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};nt.formatNames=Object.keys(nt.fullFormats);function CS(e){return e%4===0&&(e%100!==0||e%400===0)}var NS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,AS=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Sg(e){let t=NS.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&CS(r)?29:AS[n])}function $c(e,t){if(e&&t)return e>t?1:e<t?-1:0}var _c=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function yc(e){return function(r){let n=_c.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let p=s-l*c,m=o-u*c-(p<0?1:0);return(m===23||m===-1)&&(p===59||p===-1)&&i<61}}function wc(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function kg(e,t){if(!(e&&t))return;let r=_c.exec(e),n=_c.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var vc=/t|\s/i;function bg(e){let t=yc(e);return function(n){let o=n.split(vc);return o.length===2&&Sg(o[0])&&t(o[1])}}function Pg(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function Tg(e,t){if(!(e&&t))return;let[r,n]=e.split(vc),[o,s]=t.split(vc),i=$c(r,o);if(i!==void 0)return i||wc(n,s)}var jS=/\/|:/,ZS=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function DS(e){return jS.test(e)&&ZS.test(e)}var xg=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function MS(e){return xg.lastIndex=0,xg.test(e)}var qS=-(2**31),US=2**31-1;function LS(e){return Number.isInteger(e)&&e<=US&&e>=qS}function FS(e){return Number.isInteger(e)}function zg(){return!0}var VS=/[^\\]\\Z/;function HS(e){if(VS.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Rg=z(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.formatLimitDefinition=void 0;var JS=wg(),We=C(),Pt=We.operators,Yo={formatMaximum:{okStr:"<=",ok:Pt.LTE,fail:Pt.GT},formatMinimum:{okStr:">=",ok:Pt.GTE,fail:Pt.LT},formatExclusiveMaximum:{okStr:"<",ok:Pt.LT,fail:Pt.GTE},formatExclusiveMinimum:{okStr:">",ok:Pt.GT,fail:Pt.LTE}},KS={message:({keyword:e,schemaCode:t})=>(0,We.str)`should be ${Yo[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,We._)`{comparison: ${Yo[e].okStr}, limit: ${t}}`};yr.formatLimitDefinition={keyword:Object.keys(Yo),type:"string",schemaType:"string",$data:!0,error:KS,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new JS.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,We._)`${m}[${c.schemaCode}]`);e.fail$data((0,We.or)((0,We._)`typeof ${f} != "object"`,(0,We._)`${f} instanceof RegExp`,(0,We._)`typeof ${f}.compare != "function"`,p(f)))}function l(){let m=c.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${m}" does not define "compare" function`);let g=t.scopeValue("formats",{key:m,ref:f,code:i.code.formats?(0,We._)`${i.code.formats}${(0,We.getProperty)(m)}`:void 0});e.fail$data(p(g))}function p(m){return(0,We._)`${m}.compare(${r}, ${n}) ${Yo[o].fail} 0`}},dependencies:["format"]};var BS=e=>(e.addKeyword(yr.formatLimitDefinition),e);yr.default=BS});var Ng=z((En,Cg)=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});var vr=Eg(),GS=Rg(),bc=C(),Ig=new bc.Name("fullFormats"),WS=new bc.Name("fastFormats"),xc=(e,t={keywords:!0})=>{if(Array.isArray(t))return Og(e,t,vr.fullFormats,Ig),e;let[r,n]=t.mode==="fast"?[vr.fastFormats,WS]:[vr.fullFormats,Ig],o=t.formats||vr.formatNames;return Og(e,o,r,n),t.keywords&&(0,GS.default)(e),e};xc.get=(e,t="full")=>{let n=(t==="fast"?vr.fastFormats:vr.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function Og(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,bc._)`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}Cg.exports=En=xc;Object.defineProperty(En,"__esModule",{value:!0});En.default=xc});import{execFileSync as e_,spawnSync as t_}from"node:child_process";import{readFileSync as Ic}from"node:fs";import{homedir as $k}from"node:os";import{join as wk}from"node:path";import*as r_ from"node:readline/promises";import*as Ve from"node:fs";import*as Zc from"node:os";import*as ie from"node:path";var Ir=process.env.GIGABUDDY_HOME??ie.join(Zc.homedir(),".gigabuddy"),Et="default",Dc=ie.join(Ir,"accounts"),Mc=ie.join(Ir,"config.json");function Rr(e){return/^[a-z0-9][a-z0-9._-]{0,63}$/i.test(e)&&e!=="accounts"}function Vt(e){if(!Rr(e))throw new Error(`Invalid account name "${e}" \u2014 use letters, digits, dots, dashes or underscores (max 64 chars).`)}function is(e){return Vt(e),e===Et?Ir:ie.join(Dc,e)}function Vn(){let e=[];try{for(let t of Ve.readdirSync(Dc,{withFileTypes:!0}))t.isDirectory()&&Rr(t.name)&&e.push(t.name)}catch{}return[Et,...e.sort()]}function Ht(){try{return JSON.parse(Ve.readFileSync(Mc,"utf-8"))}catch{return{}}}function as(e){Ve.existsSync(Ir)||Ve.mkdirSync(Ir,{recursive:!0,mode:448}),Ve.writeFileSync(Mc,JSON.stringify(e,null,2)+`
9
+ `,{mode:384})}function qc(e){Vt(e);let t=Ht();t.defaultAccount=e,as(t)}function cs(e,t){Vt(t);let r=Ht();r.pins={...r.pins,[ie.resolve(e)]:t},as(r)}function Uc(e){let t=Ht(),r=ie.resolve(e);return t.pins?.[r]?(delete t.pins[r],as(t),!0):!1}function us(e){let t=ie.resolve(e);for(;;){if(Ve.existsSync(ie.join(t,".git")))return t;let r=ie.dirname(t);if(r===t)return ie.resolve(e);t=r}}function h_(e,t){let r=ie.relative(e,t);return r===""||!r.startsWith("..")&&!ie.isAbsolute(r)}function mt(e=process.cwd()){let t=process.env.GIGABUDDY_ACCOUNT;if(t&&Rr(t))return{name:t,source:"env"};let r=Ht(),n=ie.resolve(e),o;for(let[s,i]of Object.entries(r.pins??{}))Rr(i)&&h_(s,n)&&(!o||s.length>o.dir.length)&&(o={dir:s,account:i});return o?{name:o.account,source:"pin",pinnedAt:o.dir}:r.defaultAccount&&Rr(r.defaultAccount)?{name:r.defaultAccount,source:"config-default"}:{name:Et,source:"fallback"}}import*as Ie from"node:fs";import*as Lc from"node:path";var g_={shared:{prod:"credentials.json",staging:"credentials.staging.json"},user:{prod:"user-credentials.json",staging:"user-credentials.staging.json"},agent:{prod:"agent-credentials.json",staging:"agent-credentials.staging.json"}};function Or(e=!1,t="shared",r){let n=g_[t];return Lc.join(is(r??mt().name),e?n.staging:n.prod)}function ot(e=!1,t="shared",r){try{let n=Ie.readFileSync(Or(e,t,r),"utf-8"),o=JSON.parse(n);return o.refreshToken?o:null}catch{return null}}function ls(e,t=!1,r="shared",n){let o=is(n??mt().name);Ie.existsSync(o)||Ie.mkdirSync(o,{recursive:!0,mode:448}),Hn(Or(t,r,n),JSON.stringify(e,null,2))}function Fc(e=!1,t="shared",r){let n=Or(e,t,r);Ie.existsSync(n)&&Ie.unlinkSync(n)}function Hn(e,t){Ie.writeFileSync(e,t,{mode:384});try{Ie.chmodSync(e,384)}catch{}}var Vc,ds=Object.freeze({status:"aborted"});function h(e,t,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let m=l[p];m in a||(a[m]=u[m].bind(a))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var __=Symbol("zod_brand"),Qe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Jt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Vc=globalThis).__zod_globalConfig??(Vc.__zod_globalConfig={});var Kt=globalThis.__zod_globalConfig;function be(e){return e&&Object.assign(Kt,e),Kt}var j={};ss(j,{BIGINT_FORMAT_RANGES:()=>Bc,Class:()=>fs,NUMBER_FORMAT_RANGES:()=>vs,aborted:()=>_t,allowsEval:()=>gs,assert:()=>b_,assertEqual:()=>y_,assertIs:()=>$_,assertNever:()=>w_,assertNotEqual:()=>v_,assignProp:()=>ht,base64ToUint8Array:()=>Wc,base64urlToUint8Array:()=>M_,cached:()=>Gt,captureStackTrace:()=>Bn,cleanEnum:()=>D_,cleanRegex:()=>jr,clone:()=>Ae,cloneDef:()=>z_,createTransparentProxy:()=>R_,defineLazy:()=>L,esc:()=>Kn,escapeRegex:()=>it,explicitlyAborted:()=>$s,extend:()=>C_,finalizeIssue:()=>je,floatSafeRemainder:()=>ms,getElementAtPath:()=>S_,getEnumValues:()=>Nr,getLengthableOrigin:()=>Zr,getParsedType:()=>E_,getSizableOrigin:()=>Gc,hexToUint8Array:()=>U_,isObject:()=>Rt,isPlainObject:()=>gt,issue:()=>Wt,joinValues:()=>Jn,jsonStringifyReplacer:()=>Bt,merge:()=>A_,mergeDefs:()=>st,normalizeParams:()=>R,nullish:()=>Ar,numKeys:()=>T_,objectClone:()=>x_,omit:()=>O_,optionalKeys:()=>ys,parsedType:()=>ws,partial:()=>j_,pick:()=>I_,prefixIssues:()=>at,primitiveTypes:()=>Kc,promiseAllObject:()=>k_,propertyKeyTypes:()=>_s,randomString:()=>P_,required:()=>Z_,safeExtend:()=>N_,shallowClone:()=>Jc,slugify:()=>hs,stringifyPrimitive:()=>Gn,uint8ArrayToBase64:()=>Yc,uint8ArrayToBase64url:()=>q_,uint8ArrayToHex:()=>L_,unwrapMessage:()=>Cr});function y_(e){return e}function v_(e){return e}function $_(e){}function w_(e){throw new Error("Unexpected value in exhaustive check")}function b_(e){}function Nr(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Jn(e,t="|"){return e.map(r=>Gn(r)).join(t)}function Bt(e,t){return typeof t=="bigint"?t.toString():t}function Gt(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ar(e){return e==null}function jr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ms(e,t){let r=e/t,n=Math.round(r),o=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var Hc=Symbol("evaluating");function L(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Hc)return n===void 0&&(n=Hc,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function x_(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ht(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function st(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function z_(e){return st(e._zod.def)}function S_(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function k_(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=n[s];return o})}function P_(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Kn(e){return JSON.stringify(e)}function hs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Bn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Rt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var gs=Gt(()=>{if(Kt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function gt(e){if(Rt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Rt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Jc(e){return gt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function T_(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var E_=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},_s=new Set(["string","number","symbol"]),Kc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function it(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ae(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function R(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function R_(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,s){return t??(t=e()),Reflect.set(t,n,o,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function Gn(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function ys(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var vs={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Bc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function I_(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=st(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return ht(this,"shape",i),i},checks:[]});return Ae(e,s)}function O_(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=st(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return ht(this,"shape",i),i},checks:[]});return Ae(e,s)}function C_(e,t){if(!gt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=st(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return ht(this,"shape",s),s}});return Ae(e,o)}function N_(e,t){if(!gt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=st(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ht(this,"shape",n),n}});return Ae(e,r)}function A_(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=st(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ht(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ae(e,r)}function j_(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=st(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return ht(this,"shape",c),c},checks:[]});return Ae(t,i)}function Z_(e,t,r){let n=st(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(let i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return ht(this,"shape",s),s}});return Ae(t,n)}function _t(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function $s(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function at(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Cr(e){return typeof e=="string"?e:e?.message}function je(e,t,r){let n=e.message?e.message:Cr(e.inst?._zod.def?.error?.(e))??Cr(t?.error?.(e))??Cr(r.customError?.(e))??Cr(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=n,t?.reportInput&&(a.input=i),a}function Gc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Zr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ws(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Wt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function D_(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Wc(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Yc(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function M_(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Wc(t+r)}function q_(e){return Yc(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function U_(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function L_(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var fs=class{constructor(...t){}};var Qc=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Bt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Wn=h("$ZodError",Qc),bs=h("$ZodError",Qc,{Parent:Error});function xs(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function zs(e,t=r=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return n(e),r}var Yn=e=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Qe;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>je(c,s,be())));throw Bn(a,o?.callee),a}return i.value};var Qn=e=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>je(c,s,be())));throw Bn(a,o?.callee),a}return i.value};var Dr=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Qe;return s.issues.length?{success:!1,error:new(e??Wn)(s.issues.map(i=>je(i,o,be())))}:{success:!0,data:s.value}},Xc=Dr(bs),Mr=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>je(i,o,be())))}:{success:!0,data:s.value}},eu=Mr(bs),tu=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Yn(e)(t,r,o)};var ru=e=>(t,r,n)=>Yn(e)(t,r,n);var nu=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Qn(e)(t,r,o)};var ou=e=>async(t,r,n)=>Qn(e)(t,r,n);var su=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Dr(e)(t,r,o)};var iu=e=>(t,r,n)=>Dr(e)(t,r,n);var au=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Mr(e)(t,r,o)};var cu=e=>async(t,r,n)=>Mr(e)(t,r,n);var uu=/^[cC][0-9a-z]{6,}$/,lu=/^[0-9a-z]+$/,du=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pu=/^[0-9a-vA-V]{20}$/,fu=/^[A-Za-z0-9]{27}$/,mu=/^[a-zA-Z0-9_-]{21}$/,hu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var gu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ss=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var _u=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var V_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function yu(){return new RegExp(V_,"u")}var vu=/^(?:(?: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])$/,$u=/^(([0-9a-fA-F]{1,4}:){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}|:))$/;var wu=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,bu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ks=/^[A-Za-z0-9_-]*$/;var zu=/^https?$/,Su=/^\+[1-9]\d{6,14}$/,ku="(?:(?:\\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])))",Pu=new RegExp(`^${ku}$`);function Tu(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Eu(e){return new RegExp(`^${Tu(e)}$`)}function Ru(e){let t=Tu({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${ku}T(?:${n})$`)}var Iu=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ou=/^-?\d+n?$/,Cu=/^-?\d+$/,Ps=/^-?\d+(?:\.\d+)?$/,Nu=/^(?:true|false)$/i,Au=/^null$/i;var ju=/^[^A-Z]*$/,Zu=/^[^a-z]*$/;var ae=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Du={number:"number",bigint:"bigint",object:"date"},Ts=h("$ZodCheckLessThan",(e,t)=>{ae.init(e,t);let r=Du[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Es=h("$ZodCheckGreaterThan",(e,t)=>{ae.init(e,t);let r=Du[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Mu=h("$ZodCheckMultipleOf",(e,t)=>{ae.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):ms(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),qu=h("$ZodCheckNumberFormat",(e,t)=>{ae.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=vs[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,r&&(a.pattern=Cu)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Uu=h("$ZodCheckMaxLength",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ar(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let i=Zr(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Lu=h("$ZodCheckMinLength",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ar(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let i=Zr(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Fu=h("$ZodCheckLengthEquals",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ar(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,s=o.length;if(s===t.length)return;let i=Zr(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ur=h("$ZodCheckStringFormat",(e,t)=>{var r,n;ae.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Vu=h("$ZodCheckRegex",(e,t)=>{Ur.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Hu=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ju),Ur.init(e,t)}),Ju=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Zu),Ur.init(e,t)}),Ku=h("$ZodCheckIncludes",(e,t)=>{ae.init(e,t);let r=it(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Bu=h("$ZodCheckStartsWith",(e,t)=>{ae.init(e,t);let r=new RegExp(`^${it(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Gu=h("$ZodCheckEndsWith",(e,t)=>{ae.init(e,t);let r=new RegExp(`.*${it(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Wu=h("$ZodCheckOverwrite",(e,t)=>{ae.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Xn=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
10
10
  `).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,o.join(`
11
- `))}};var Fu={major:4,minor:4,patch:3};var F=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fu;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,a,c)=>{let u=_t(i),l;for(let p of a){if(p._zod.def.when){if(gs(i)||!p._zod.def.when(i))continue}else if(u)continue;let m=i.issues.length,f=p._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new We;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==m&&(u||(u=_t(i,m)))});else{if(i.issues.length===m)continue;u||(u=_t(i,m))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(_t(i))return i.aborted=!0,i;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new We;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new We;return c.then(u=>o(u,n,a))}return o(c,n,a)}}L(e,"~standard",()=>({validate:o=>{try{let s=Vc(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Hc(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Xn=h("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??bu(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),B=h("$ZodStringFormat",(e,t)=>{Mr.init(e,t),Xn.init(e,t)}),Qu=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=au),B.init(e,t)}),Xu=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ws(n))}else t.pattern??(t.pattern=ws());B.init(e,t)}),el=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=cu),B.init(e,t)}),tl=h("$ZodURL",(e,t)=>{B.init(e,t),e._zod.check=r=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===hu.source&&!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),rl=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=uu()),B.init(e,t)}),nl=h("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=su),B.init(e,t)}),ol=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=eu),B.init(e,t)}),sl=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tu),B.init(e,t)}),il=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ru),B.init(e,t)}),al=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=nu),B.init(e,t)}),cl=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ou),B.init(e,t)}),ul=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=wu(t)),B.init(e,t)}),ll=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yu),B.init(e,t)}),dl=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=$u(t)),B.init(e,t)}),pl=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=iu),B.init(e,t)}),fl=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=lu),B.init(e,t),e._zod.bag.format="ipv4"}),ml=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=du),B.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var hl=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pu),B.init(e,t)}),gl=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=fu),B.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,s]=n;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function _l(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var yl=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mu),B.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{_l(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function b_(e){if(!bs.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return _l(r)}var vl=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=bs),B.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{b_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),$l=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=gu),B.init(e,t)});function x_(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var wl=h("$ZodJWT",(e,t)=>{B.init(e,t),e._zod.check=r=>{x_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Ps=h("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??xs,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),bl=h("$ZodNumberFormat",(e,t)=>{Iu.init(e,t),Ps.init(e,t)}),xl=h("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=ku,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),zl=h("$ZodBigInt",(e,t)=>{F.init(e,t),e._zod.pattern=xu,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var kl=h("$ZodNull",(e,t)=>{F.init(e,t),e._zod.pattern=Su,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Sl=h("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Pl=h("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Tl=h("$ZodNever",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var El=h("$ZodDate",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),r}});function Vu(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues)),t.value[r]=e.value}var Rl=h("$ZodArray",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>Vu(u,r,i))):Vu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Qn(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...it(r,e.issues))}if(!i&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function Il(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=ms(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ol(e,t,r,n,o,s){let i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optin==="optional",p=c.optout==="optional";for(let m in t){if(m==="__proto__"||a.has(m))continue;if(u==="never"){i.push(m);continue}let f=c.run({value:t[m],issues:[]},n);f instanceof Promise?e.push(f.then(g=>Qn(g,r,m,t,l,p))):Qn(f,r,m,t,l,p)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var z_=h("$ZodObject",(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Kt(()=>Il(t));L(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let p of l.values)c[u].add(p)}}return c});let o=Rt,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],p=i.shape;for(let m of i.keys){let f=p[m],g=f._zod.optin==="optional",y=f._zod.optout==="optional",$=f._zod.run({value:u[m],issues:[]},c);$ instanceof Promise?l.push($.then(v=>Qn(v,a,m,u,g,y))):Qn($,a,m,u,g,y)}return s?Ol(l,u,a,c,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),Cl=h("$ZodObjectJIT",(e,t)=>{z_.init(e,t);let r=e._zod.parse,n=Kt(()=>Il(t)),o=m=>{let f=new Wn(["shape","payload","ctx"]),g=n.value,y=x=>{let k=Vn(x);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};f.write("const input = payload.value;");let $=Object.create(null),v=0;for(let x of g.keys)$[x]=`key_${v++}`;f.write("const newResult = {};");for(let x of g.keys){let k=$[x],S=Vn(x),Te=m[x],Oe=Te?._zod?.optin==="optional",Sr=Te?._zod?.optout==="optional";f.write(`const ${k} = ${y(x)};`),Oe&&Sr?f.write(`
12
- if (${k}.issues.length) {
13
- if (${S} in input) {
14
- payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
11
+ `))}};var Qu={major:4,minor:4,patch:3};var F=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Qu;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,a,c)=>{let u=_t(i),l;for(let p of a){if(p._zod.def.when){if($s(i)||!p._zod.def.when(i))continue}else if(u)continue;let m=i.issues.length,f=p._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Qe;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==m&&(u||(u=_t(i,m)))});else{if(i.issues.length===m)continue;u||(u=_t(i,m))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(_t(i))return i.aborted=!0,i;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Qe;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Qe;return c.then(u=>o(u,n,a))}return o(c,n,a)}}L(e,"~standard",()=>({validate:o=>{try{let s=Xc(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return eu(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),ro=h("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Iu(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),G=h("$ZodStringFormat",(e,t)=>{Ur.init(e,t),ro.init(e,t)}),al=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=gu),G.init(e,t)}),cl=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ss(n))}else t.pattern??(t.pattern=Ss());G.init(e,t)}),ul=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=_u),G.init(e,t)}),ll=h("$ZodURL",(e,t)=>{G.init(e,t),e._zod.check=r=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===zu.source&&!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),dl=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=yu()),G.init(e,t)}),pl=h("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=mu),G.init(e,t)}),fl=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=uu),G.init(e,t)}),ml=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=lu),G.init(e,t)}),hl=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=du),G.init(e,t)}),gl=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pu),G.init(e,t)}),_l=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=fu),G.init(e,t)}),yl=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ru(t)),G.init(e,t)}),vl=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Pu),G.init(e,t)}),$l=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Eu(t)),G.init(e,t)}),wl=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=hu),G.init(e,t)}),bl=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=vu),G.init(e,t),e._zod.bag.format="ipv4"}),xl=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=$u),G.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var zl=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=wu),G.init(e,t)}),Sl=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=bu),G.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,s]=n;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function kl(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Pl=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=xu),G.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{kl(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function H_(e){if(!ks.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return kl(r)}var Tl=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ks),G.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{H_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),El=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Su),G.init(e,t)});function J_(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Rl=h("$ZodJWT",(e,t)=>{G.init(e,t),e._zod.check=r=>{J_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Is=h("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ps,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),Il=h("$ZodNumberFormat",(e,t)=>{qu.init(e,t),Is.init(e,t)}),Ol=h("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=Nu,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),Cl=h("$ZodBigInt",(e,t)=>{F.init(e,t),e._zod.pattern=Ou,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Nl=h("$ZodNull",(e,t)=>{F.init(e,t),e._zod.pattern=Au,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Al=h("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),jl=h("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Zl=h("$ZodNever",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var Dl=h("$ZodDate",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),r}});function Xu(e,t,r){e.issues.length&&t.issues.push(...at(r,e.issues)),t.value[r]=e.value}var Ml=h("$ZodArray",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>Xu(u,r,i))):Xu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function to(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...at(r,e.issues))}if(!i&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function ql(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=ys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ul(e,t,r,n,o,s){let i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optin==="optional",p=c.optout==="optional";for(let m in t){if(m==="__proto__"||a.has(m))continue;if(u==="never"){i.push(m);continue}let f=c.run({value:t[m],issues:[]},n);f instanceof Promise?e.push(f.then(g=>to(g,r,m,t,l,p))):to(f,r,m,t,l,p)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var K_=h("$ZodObject",(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Gt(()=>ql(t));L(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let p of l.values)c[u].add(p)}}return c});let o=Rt,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],p=i.shape;for(let m of i.keys){let f=p[m],g=f._zod.optin==="optional",_=f._zod.optout==="optional",y=f._zod.run({value:u[m],issues:[]},c);y instanceof Promise?l.push(y.then(v=>to(v,a,m,u,g,_))):to(y,a,m,u,g,_)}return s?Ul(l,u,a,c,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),Ll=h("$ZodObjectJIT",(e,t)=>{K_.init(e,t);let r=e._zod.parse,n=Gt(()=>ql(t)),o=m=>{let f=new Xn(["shape","payload","ctx"]),g=n.value,_=x=>{let S=Kn(x);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),v=0;for(let x of g.keys)y[x]=`key_${v++}`;f.write("const newResult = {};");for(let x of g.keys){let S=y[x],P=Kn(x),Re=m[x],Ne=Re?._zod?.optin==="optional",Tr=Re?._zod?.optout==="optional";f.write(`const ${S} = ${_(x)};`),Ne&&Tr?f.write(`
12
+ if (${S}.issues.length) {
13
+ if (${P} in input) {
14
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
15
15
  ...iss,
16
- path: iss.path ? [${S}, ...iss.path] : [${S}]
16
+ path: iss.path ? [${P}, ...iss.path] : [${P}]
17
17
  })));
18
18
  }
19
19
  }
20
20
 
21
- if (${k}.value === undefined) {
22
- if (${S} in input) {
23
- newResult[${S}] = undefined;
21
+ if (${S}.value === undefined) {
22
+ if (${P} in input) {
23
+ newResult[${P}] = undefined;
24
24
  }
25
25
  } else {
26
- newResult[${S}] = ${k}.value;
26
+ newResult[${P}] = ${S}.value;
27
27
  }
28
28
 
29
- `):Oe?f.write(`
30
- if (${k}.issues.length) {
31
- payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
29
+ `):Ne?f.write(`
30
+ if (${S}.issues.length) {
31
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
32
32
  ...iss,
33
- path: iss.path ? [${S}, ...iss.path] : [${S}]
33
+ path: iss.path ? [${P}, ...iss.path] : [${P}]
34
34
  })));
35
35
  }
36
36
 
37
- if (${k}.value === undefined) {
38
- if (${S} in input) {
39
- newResult[${S}] = undefined;
37
+ if (${S}.value === undefined) {
38
+ if (${P} in input) {
39
+ newResult[${P}] = undefined;
40
40
  }
41
41
  } else {
42
- newResult[${S}] = ${k}.value;
42
+ newResult[${P}] = ${S}.value;
43
43
  }
44
44
 
45
45
  `):f.write(`
46
- const ${k}_present = ${S} in input;
47
- if (${k}.issues.length) {
48
- payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
46
+ const ${S}_present = ${P} in input;
47
+ if (${S}.issues.length) {
48
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
49
49
  ...iss,
50
- path: iss.path ? [${S}, ...iss.path] : [${S}]
50
+ path: iss.path ? [${P}, ...iss.path] : [${P}]
51
51
  })));
52
52
  }
53
- if (!${k}_present && !${k}.issues.length) {
53
+ if (!${S}_present && !${S}.issues.length) {
54
54
  payload.issues.push({
55
55
  code: "invalid_type",
56
56
  expected: "nonoptional",
57
57
  input: undefined,
58
- path: [${S}]
58
+ path: [${P}]
59
59
  });
60
60
  }
61
61
 
62
- if (${k}_present) {
63
- if (${k}.value === undefined) {
64
- newResult[${S}] = undefined;
62
+ if (${S}_present) {
63
+ if (${S}.value === undefined) {
64
+ newResult[${P}] = undefined;
65
65
  } else {
66
- newResult[${S}] = ${k}.value;
66
+ newResult[${P}] = ${S}.value;
67
67
  }
68
68
  }
69
69
 
70
- `)}f.write("payload.value = newResult;"),f.write("return payload;");let R=f.compile();return(x,k)=>R(m,x,k)},s,i=Rt,a=!Ht.jitless,u=a&&ps.value,l=t.catchall,p;e._zod.parse=(m,f)=>{p??(p=n.value);let g=m.value;return i(g)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=o(t.shape)),m=s(m,f),l?Ol([],g,m,f,p,e):m):r(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function Hu(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!_t(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Ne(i,n,we())))}),t)}var Ts=h("$ZodUnion",(e,t)=>{F.init(e,t),L(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),L(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),L(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),L(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){let n=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${n.map(o=>Nr(o.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>Hu(a,n,e,o)):Hu(i,n,e,o)}});var Nl=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ts.init(e,t);let r=e._zod.parse;L(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=Kt(()=>{let o=t.options,s=new Map;for(let i of o){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!Rt(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=n.value.get(i?.[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback||s.direction==="backward"?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:i,path:[t.discriminator],inst:e}),o)}}),Al=h("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Ju(r,c,u)):Ju(r,s,i)}});function Ss(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(gt(e)&&gt(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(let s of n){let i=Ss(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Ss(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ju(e,t,r){let n=new Map,o;for(let a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(let c of a.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(a);let s=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),_t(e))return e;let i=Ss(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var jl=h("$ZodRecord",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!gt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Ne(f,n,we())),input:u,path:[u],inst:e});continue}let p=l.value,m=t.valueType._zod.run({value:o[u],issues:[]},n);m instanceof Promise?s.push(m.then(f=>{f.issues.length&&r.issues.push(...it(u,f.issues)),r.value[p]=f.value})):(m.issues.length&&r.issues.push(...it(u,m.issues)),r.value[p]=m.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&xs.test(a)&&c.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},n);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){t.mode==="loose"?r.value[a]=o[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>Ne(p,n,we())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:o[a],issues:[]},n);l instanceof Promise?s.push(l.then(p=>{p.issues.length&&r.issues.push(...it(a,p.issues)),r.value[c.value]=p.value})):(l.issues.length&&r.issues.push(...it(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Zl=h("$ZodEnum",(e,t)=>{F.init(e,t);let r=Or(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>fs.has(typeof o)).map(o=>typeof o=="string"?st(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),Dl=h("$ZodLiteral",(e,t)=>{if(F.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?st(n):n?st(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var Ml=h("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Vt(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r.fallback=!0,r));if(o instanceof Promise)throw new We;return r.value=o,r.fallback=!0,r}});function Ku(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Es=h("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),L(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Nr(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>Ku(i,o)):Ku(s,o)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),ql=h("$ZodExactOptional",(e,t)=>{Es.init(e,t),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Ul=h("$ZodNullable",(e,t)=>{F.init(e,t),L(e._zod,"optin",()=>t.innerType._zod.optin),L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Nr(r.source)}|null)$`):void 0}),L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Ll=h("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Gu(s,t)):Gu(o,t)}});function Gu(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Fl=h("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Vl=h("$ZodNonOptional",(e,t)=>{F.init(e,t),L(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Bu(s,e)):Bu(o,e)}});function Bu(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Hl=h("$ZodCatch",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Ne(i,n,we()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>Ne(s,n,we()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var Rs=h("$ZodPipe",(e,t)=>{F.init(e,t),L(e._zod,"values",()=>t.in._zod.values),L(e._zod,"optin",()=>t.in._zod.optin),L(e._zod,"optout",()=>t.out._zod.optout),L(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Yn(i,t.in,n)):Yn(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Yn(s,t.out,n)):Yn(o,t.out,n)}});function Yn(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var Jl=h("$ZodPreprocess",(e,t)=>{Rs.init(e,t)}),Kl=h("$ZodReadonly",(e,t)=>{F.init(e,t),L(e._zod,"propValues",()=>t.innerType._zod.propValues),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"optin",()=>t.innerType?._zod?.optin),L(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Wu):Wu(o)}});function Wu(e){return e.value=Object.freeze(e.value),e}var Gl=h("$ZodCustom",(e,t)=>{ae.init(e,t),F.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Yu(s,r,n,e));Yu(o,r,n,e)}});function Yu(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Gt(o))}}var k_=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=n[o.expected]??o.expected,i=_s(o.input),a=n[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${Jn(o.values[0])}`:`Invalid option: expected one of ${Fn(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",i=t(o.origin);return i?`Too big: expected ${o.origin??"value"} to have ${s}${o.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",i=t(o.origin);return i?`Too small: expected ${o.origin} to have ${s}${o.minimum.toString()} ${i.unit}`:`Too small: expected ${o.origin} to be ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Fn(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return o.options&&Array.isArray(o.options)&&o.options.length>0?`Invalid discriminator value. Expected ${o.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Bl(){return{localeError:k_()}}var Wl,S_=Symbol("ZodOutput"),P_=Symbol("ZodInput"),Is=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Yl(){return new Is}(Wl=globalThis).__zod_globalRegistry??(Wl.__zod_globalRegistry=Yl());var yt=globalThis.__zod_globalRegistry;function Ql(e,t){return new e({type:"string",...E(t)})}function Xl(e,t){return new e({type:"string",coerce:!0,...E(t)})}function ed(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}function Os(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}function td(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(t)})}function rd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(t)})}function nd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(t)})}function od(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(t)})}function Cs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}function sd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}function id(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}function ad(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}function cd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}function ud(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}function ld(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}function dd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}function pd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}function fd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}function md(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}function hd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}function gd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}function _d(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}function yd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}function vd(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}function $d(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(t)})}function wd(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}function bd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}function xd(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}function zd(e,t){return new e({type:"number",checks:[],...E(t)})}function kd(e,t){return new e({type:"number",coerce:!0,checks:[],...E(t)})}function Sd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E(t)})}function Pd(e,t){return new e({type:"boolean",...E(t)})}function Td(e,t){return new e({type:"boolean",coerce:!0,...E(t)})}function Ed(e,t){return new e({type:"bigint",coerce:!0,...E(t)})}function Rd(e,t){return new e({type:"null",...E(t)})}function Id(e){return new e({type:"any"})}function Od(e){return new e({type:"unknown"})}function Cd(e,t){return new e({type:"never",...E(t)})}function Nd(e,t){return new e({type:"date",coerce:!0,...E(t)})}function Bt(e,t){return new zs({check:"less_than",...E(t),value:e,inclusive:!1})}function at(e,t){return new zs({check:"less_than",...E(t),value:e,inclusive:!0})}function Wt(e,t){return new ks({check:"greater_than",...E(t),value:e,inclusive:!1})}function Fe(e,t){return new ks({check:"greater_than",...E(t),value:e,inclusive:!0})}function qr(e,t){return new Ru({check:"multiple_of",...E(t),value:e})}function eo(e,t){return new Ou({check:"max_length",...E(t),maximum:e})}function Yt(e,t){return new Cu({check:"min_length",...E(t),minimum:e})}function to(e,t){return new Nu({check:"length_equals",...E(t),length:e})}function Ns(e,t){return new Au({check:"string_format",format:"regex",...E(t),pattern:e})}function As(e){return new ju({check:"string_format",format:"lowercase",...E(e)})}function js(e){return new Zu({check:"string_format",format:"uppercase",...E(e)})}function Zs(e,t){return new Du({check:"string_format",format:"includes",...E(t),includes:e})}function Ds(e,t){return new Mu({check:"string_format",format:"starts_with",...E(t),prefix:e})}function Ms(e,t){return new qu({check:"string_format",format:"ends_with",...E(t),suffix:e})}function vt(e){return new Uu({check:"overwrite",tx:e})}function qs(e){return vt(t=>t.normalize(e))}function Us(){return vt(e=>e.trim())}function Ls(){return vt(e=>e.toLowerCase())}function Fs(){return vt(e=>e.toUpperCase())}function Vs(){return vt(e=>ds(e))}function Ad(e,t,r){return new e({type:"array",element:t,...E(r)})}function jd(e,t,r){let n=E(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Zd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...E(r)})}function Dd(e,t){let r=T_(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Gt(o,n.value,r._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(Gt(s))}},e(n.value,n)),t);return r}function T_(e,t){let r=new ae({check:"custom",...E(t)});return r._zod.check=e,r}function Hs(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??yt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function re(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let m=i.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let p=e._zod.parent;p&&(i.ref||(i.ref=p),re(p,t,l),t.seen.get(p).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&ye(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Js(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,m=e.external.uri??(g=>g);if(p)return{ref:m(p)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
70
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");let k=f.compile();return(x,S)=>k(m,x,S)},s,i=Rt,a=!Kt.jitless,u=a&&gs.value,l=t.catchall,p;e._zod.parse=(m,f)=>{p??(p=n.value);let g=m.value;return i(g)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=o(t.shape)),m=s(m,f),l?Ul([],g,m,f,p,e):m):r(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function el(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!_t(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>je(i,n,be())))}),t)}var Os=h("$ZodUnion",(e,t)=>{F.init(e,t),L(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),L(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),L(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),L(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){let n=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${n.map(o=>jr(o.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>el(a,n,e,o)):el(i,n,e,o)}});var Fl=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Os.init(e,t);let r=e._zod.parse;L(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=Gt(()=>{let o=t.options,s=new Map;for(let i of o){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!Rt(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=n.value.get(i?.[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback||s.direction==="backward"?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:i,path:[t.discriminator],inst:e}),o)}}),Vl=h("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>tl(r,c,u)):tl(r,s,i)}});function Rs(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(gt(e)&&gt(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(let s of n){let i=Rs(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Rs(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function tl(e,t,r){let n=new Map,o;for(let a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(let c of a.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(a);let s=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),_t(e))return e;let i=Rs(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var Hl=h("$ZodRecord",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!gt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>je(f,n,be())),input:u,path:[u],inst:e});continue}let p=l.value,m=t.valueType._zod.run({value:o[u],issues:[]},n);m instanceof Promise?s.push(m.then(f=>{f.issues.length&&r.issues.push(...at(u,f.issues)),r.value[p]=f.value})):(m.issues.length&&r.issues.push(...at(u,m.issues)),r.value[p]=m.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Ps.test(a)&&c.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},n);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){t.mode==="loose"?r.value[a]=o[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>je(p,n,be())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:o[a],issues:[]},n);l instanceof Promise?s.push(l.then(p=>{p.issues.length&&r.issues.push(...at(a,p.issues)),r.value[c.value]=p.value})):(l.issues.length&&r.issues.push(...at(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Jl=h("$ZodEnum",(e,t)=>{F.init(e,t);let r=Nr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>_s.has(typeof o)).map(o=>typeof o=="string"?it(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),Kl=h("$ZodLiteral",(e,t)=>{if(F.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?it(n):n?it(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var Bl=h("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Jt(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r.fallback=!0,r));if(o instanceof Promise)throw new Qe;return r.value=o,r.fallback=!0,r}});function rl(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Cs=h("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),L(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${jr(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>rl(i,o)):rl(s,o)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),Gl=h("$ZodExactOptional",(e,t)=>{Cs.init(e,t),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Wl=h("$ZodNullable",(e,t)=>{F.init(e,t),L(e._zod,"optin",()=>t.innerType._zod.optin),L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${jr(r.source)}|null)$`):void 0}),L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Yl=h("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>nl(s,t)):nl(o,t)}});function nl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ql=h("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Xl=h("$ZodNonOptional",(e,t)=>{F.init(e,t),L(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>ol(s,e)):ol(o,e)}});function ol(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var ed=h("$ZodCatch",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>je(i,n,be()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>je(s,n,be()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var Ns=h("$ZodPipe",(e,t)=>{F.init(e,t),L(e._zod,"values",()=>t.in._zod.values),L(e._zod,"optin",()=>t.in._zod.optin),L(e._zod,"optout",()=>t.out._zod.optout),L(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>eo(i,t.in,n)):eo(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>eo(s,t.out,n)):eo(o,t.out,n)}});function eo(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var td=h("$ZodPreprocess",(e,t)=>{Ns.init(e,t)}),rd=h("$ZodReadonly",(e,t)=>{F.init(e,t),L(e._zod,"propValues",()=>t.innerType._zod.propValues),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"optin",()=>t.innerType?._zod?.optin),L(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(sl):sl(o)}});function sl(e){return e.value=Object.freeze(e.value),e}var nd=h("$ZodCustom",(e,t)=>{ae.init(e,t),F.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>il(s,r,n,e));il(o,r,n,e)}});function il(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Wt(o))}}var B_=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=n[o.expected]??o.expected,i=ws(o.input),a=n[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${Gn(o.values[0])}`:`Invalid option: expected one of ${Jn(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",i=t(o.origin);return i?`Too big: expected ${o.origin??"value"} to have ${s}${o.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",i=t(o.origin);return i?`Too small: expected ${o.origin} to have ${s}${o.minimum.toString()} ${i.unit}`:`Too small: expected ${o.origin} to be ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Jn(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return o.options&&Array.isArray(o.options)&&o.options.length>0?`Invalid discriminator value. Expected ${o.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function od(){return{localeError:B_()}}var sd,G_=Symbol("ZodOutput"),W_=Symbol("ZodInput"),As=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function id(){return new As}(sd=globalThis).__zod_globalRegistry??(sd.__zod_globalRegistry=id());var yt=globalThis.__zod_globalRegistry;function ad(e,t){return new e({type:"string",...R(t)})}function cd(e,t){return new e({type:"string",coerce:!0,...R(t)})}function ud(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...R(t)})}function js(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...R(t)})}function ld(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function dd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function pd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function fd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function Zs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function md(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function hd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function gd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function _d(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function yd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function vd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function $d(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function wd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function bd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function xd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function zd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function Sd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...R(t)})}function kd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...R(t)})}function Pd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function Td(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}function Ed(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function Rd(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function Id(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function Od(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function Cd(e,t){return new e({type:"number",checks:[],...R(t)})}function Nd(e,t){return new e({type:"number",coerce:!0,checks:[],...R(t)})}function Ad(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...R(t)})}function jd(e,t){return new e({type:"boolean",...R(t)})}function Zd(e,t){return new e({type:"boolean",coerce:!0,...R(t)})}function Dd(e,t){return new e({type:"bigint",coerce:!0,...R(t)})}function Md(e,t){return new e({type:"null",...R(t)})}function qd(e){return new e({type:"any"})}function Ud(e){return new e({type:"unknown"})}function Ld(e,t){return new e({type:"never",...R(t)})}function Fd(e,t){return new e({type:"date",coerce:!0,...R(t)})}function Yt(e,t){return new Ts({check:"less_than",...R(t),value:e,inclusive:!1})}function ct(e,t){return new Ts({check:"less_than",...R(t),value:e,inclusive:!0})}function Qt(e,t){return new Es({check:"greater_than",...R(t),value:e,inclusive:!1})}function He(e,t){return new Es({check:"greater_than",...R(t),value:e,inclusive:!0})}function Lr(e,t){return new Mu({check:"multiple_of",...R(t),value:e})}function no(e,t){return new Uu({check:"max_length",...R(t),maximum:e})}function Xt(e,t){return new Lu({check:"min_length",...R(t),minimum:e})}function oo(e,t){return new Fu({check:"length_equals",...R(t),length:e})}function Ds(e,t){return new Vu({check:"string_format",format:"regex",...R(t),pattern:e})}function Ms(e){return new Hu({check:"string_format",format:"lowercase",...R(e)})}function qs(e){return new Ju({check:"string_format",format:"uppercase",...R(e)})}function Us(e,t){return new Ku({check:"string_format",format:"includes",...R(t),includes:e})}function Ls(e,t){return new Bu({check:"string_format",format:"starts_with",...R(t),prefix:e})}function Fs(e,t){return new Gu({check:"string_format",format:"ends_with",...R(t),suffix:e})}function vt(e){return new Wu({check:"overwrite",tx:e})}function Vs(e){return vt(t=>t.normalize(e))}function Hs(){return vt(e=>e.trim())}function Js(){return vt(e=>e.toLowerCase())}function Ks(){return vt(e=>e.toUpperCase())}function Bs(){return vt(e=>hs(e))}function Vd(e,t,r){return new e({type:"array",element:t,...R(r)})}function Hd(e,t,r){let n=R(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Jd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function Kd(e,t){let r=Y_(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Wt(o,n.value,r._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(Wt(s))}},e(n.value,n)),t);return r}function Y_(e,t){let r=new ae({check:"custom",...R(t)});return r._zod.check=e,r}function Gs(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??yt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function re(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let m=i.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let p=e._zod.parent;p&&(i.ref||(i.ref=p),re(p,t,l),t.seen.get(p).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&ve(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Ws(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,m=e.external.uri??(g=>g);if(p)return{ref:m(p)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
71
71
 
72
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Ks(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){n(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Object.assign(u,g),Object.assign(u,l),a._zod.parent===p)for(let $ in u)$==="$ref"||$==="allOf"||$ in l||delete u[$];if(g.$ref&&f.def)for(let $ in u)$==="$ref"||$==="allOf"||$ in f.def&&JSON.stringify(u[$])===JSON.stringify(f.def[$])&&delete u[$]}let m=a._zod.parent;if(m&&m!==p){n(m);let f=e.seen.get(m);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let g in u)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ur(t,"input",e.processors),output:Ur(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ye(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ye(n.element,r);if(n.type==="set")return ye(n.valueType,r);if(n.type==="lazy")return ye(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return ye(n.innerType,r);if(n.type==="intersection")return ye(n.left,r)||ye(n.right,r);if(n.type==="record"||n.type==="map")return ye(n.keyType,r)||ye(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ye(n.in,r)||ye(n.out,r);if(n.type==="object"){for(let o in n.shape)if(ye(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(ye(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(ye(o,r))return!0;return!!(n.rest&&ye(n.rest,r))}return!1}var Md=(e,t={})=>r=>{let n=Hs({...r,processors:t});return re(e,n),Js(n,e),Ks(n,e)},Ur=(e,t,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=Hs({...o??{},target:s,io:t,processors:r});return re(e,i),Js(i,e),Ks(i,e)};var E_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},qd=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=E_[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Ud=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number";let p=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";p?f?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof s=="number"&&(o.minimum=s),m?f?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof i=="number"&&(o.maximum=i),typeof c=="number"&&(o.multipleOf=c)},Ld=(e,t,r,n)=>{r.type="boolean"},Fd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")};var Vd=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var Hd=(e,t,r,n)=>{r.not={}},Jd=(e,t,r,n)=>{},Kd=(e,t,r,n)=>{},Gd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Bd=(e,t,r,n)=>{let o=e._zod.def,s=Or(o.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Wd=(e,t,r,n)=>{let o=e._zod.def,s=[];for(let i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var Yd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Qd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Xd=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=re(s.element,t,{...n,path:[...n.path,"items"]})},ep=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object",o.properties={};let i=s.shape;for(let u in i)o.properties[u]=re(i[u],t,{...n,path:[...n.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=re(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},tp=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>re(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},rp=(e,t,r,n)=>{let o=e._zod.def,s=re(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=re(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var np=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=re(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)o.patternProperties[p.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=re(s.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=re(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(o.required=l)}},op=(e,t,r,n)=>{let o=e._zod.def,s=re(o.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},sp=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},ip=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},ap=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},cp=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},up=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;re(i,t,n);let a=t.seen.get(e);a.ref=i},lp=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var Gs=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var Lr={};ts(Lr,{ZodISODate:()=>pp,ZodISODateTime:()=>dp,ZodISODuration:()=>mp,ZodISOTime:()=>fp,date:()=>Ws,datetime:()=>Bs,duration:()=>Qs,time:()=>Ys});var dp=h("ZodISODateTime",(e,t)=>{ul.init(e,t),Q.init(e,t)});function Bs(e){return $d(dp,e)}var pp=h("ZodISODate",(e,t)=>{ll.init(e,t),Q.init(e,t)});function Ws(e){return wd(pp,e)}var fp=h("ZodISOTime",(e,t)=>{dl.init(e,t),Q.init(e,t)});function Ys(e){return bd(fp,e)}var mp=h("ZodISODuration",(e,t)=>{pl.init(e,t),Q.init(e,t)});function Qs(e){return xd(mp,e)}var Z_=(e,t)=>{Kn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>$s(e,r)},flatten:{value:r=>vs(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Jt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Jt,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Re=h("ZodError",Z_,{Parent:Error});var gp=Gn(Re),_p=Bn(Re),yp=jr(Re),vp=Zr(Re),$p=Jc(Re),wp=Kc(Re),bp=Gc(Re),xp=Bc(Re),zp=Wc(Re),kp=Yc(Re),Sp=Qc(Re),Pp=Xc(Re);var Tp=new WeakMap;function Fr(e,t,r){let n=Object.getPrototypeOf(e),o=Tp.get(n);if(o||(o=new Set,Tp.set(n,o)),!o.has(t)){o.add(t);for(let s in r){let i=r[s];Object.defineProperty(n,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var H=h("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ur(e,"input"),output:Ur(e,"output")}}),e.toJSONSchema=Md(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>gp(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>yp(e,r,n),e.parseAsync=async(r,n)=>_p(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>vp(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>$p(e,r,n),e.decode=(r,n)=>wp(e,r,n),e.encodeAsync=async(r,n)=>bp(e,r,n),e.decodeAsync=async(r,n)=>xp(e,r,n),e.safeEncode=(r,n)=>zp(e,r,n),e.safeDecode=(r,n)=>kp(e,r,n),e.safeEncodeAsync=async(r,n)=>Sp(e,r,n),e.safeDecodeAsync=async(r,n)=>Pp(e,r,n),Fr(e,"ZodType",{check(...r){let n=this.def;return this.clone(j.mergeDefs(n,{checks:[...n.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return Ce(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(ky(r,n))},superRefine(r,n){return this.check(Sy(r,n))},overwrite(r){return this.check(vt(r))},optional(){return te(this)},exactOptional(){return fy(this)},nullable(){return Op(this)},nullish(){return te(Op(this))},nonoptional(r){return vy(this,r)},array(){return w(this)},or(r){return G([this,r])},and(r){return oo(this,r)},transform(r){return Cp(this,Lp(r))},default(r){return gy(this,r)},prefault(r){return yy(this,r)},catch(r){return wy(this,r)},pipe(r){return Cp(this,r)},readonly(){return zy(this)},describe(r){let n=this.clone();return yt.add(n,{description:r}),n},meta(...r){if(r.length===0)return yt.get(this);let n=this.clone();return yt.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return yt.get(e)?.description},configurable:!0}),e)),Np=h("_ZodString",(e,t)=>{Xn.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>qd(e,n,o,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Fr(e,"_ZodString",{regex(...n){return this.check(Ns(...n))},includes(...n){return this.check(Zs(...n))},startsWith(...n){return this.check(Ds(...n))},endsWith(...n){return this.check(Ms(...n))},min(...n){return this.check(Yt(...n))},max(...n){return this.check(eo(...n))},length(...n){return this.check(to(...n))},nonempty(...n){return this.check(Yt(1,...n))},lowercase(n){return this.check(As(n))},uppercase(n){return this.check(js(n))},trim(){return this.check(Us())},normalize(...n){return this.check(qs(...n))},toLowerCase(){return this.check(Ls())},toUpperCase(){return this.check(Fs())},slugify(){return this.check(Vs())}})}),ei=h("ZodString",(e,t)=>{Xn.init(e,t),Np.init(e,t),e.email=r=>e.check(ed(M_,r)),e.url=r=>e.check(Cs(Ap,r)),e.jwt=r=>e.check(vd(ey,r)),e.emoji=r=>e.check(sd(q_,r)),e.guid=r=>e.check(Os(Ep,r)),e.uuid=r=>e.check(td(ro,r)),e.uuidv4=r=>e.check(rd(ro,r)),e.uuidv6=r=>e.check(nd(ro,r)),e.uuidv7=r=>e.check(od(ro,r)),e.nanoid=r=>e.check(id(U_,r)),e.guid=r=>e.check(Os(Ep,r)),e.cuid=r=>e.check(ad(L_,r)),e.cuid2=r=>e.check(cd(F_,r)),e.ulid=r=>e.check(ud(V_,r)),e.base64=r=>e.check(gd(Y_,r)),e.base64url=r=>e.check(_d(Q_,r)),e.xid=r=>e.check(ld(H_,r)),e.ksuid=r=>e.check(dd(J_,r)),e.ipv4=r=>e.check(pd(K_,r)),e.ipv6=r=>e.check(fd(G_,r)),e.cidrv4=r=>e.check(md(B_,r)),e.cidrv6=r=>e.check(hd(W_,r)),e.e164=r=>e.check(yd(X_,r)),e.datetime=r=>e.check(Bs(r)),e.date=r=>e.check(Ws(r)),e.time=r=>e.check(Ys(r)),e.duration=r=>e.check(Qs(r))});function d(e){return Ql(ei,e)}var Q=h("ZodStringFormat",(e,t)=>{B.init(e,t),Np.init(e,t)}),M_=h("ZodEmail",(e,t)=>{el.init(e,t),Q.init(e,t)});var Ep=h("ZodGUID",(e,t)=>{Qu.init(e,t),Q.init(e,t)});var ro=h("ZodUUID",(e,t)=>{Xu.init(e,t),Q.init(e,t)});var Ap=h("ZodURL",(e,t)=>{tl.init(e,t),Q.init(e,t)});function jp(e){return Cs(Ap,e)}var q_=h("ZodEmoji",(e,t)=>{rl.init(e,t),Q.init(e,t)});var U_=h("ZodNanoID",(e,t)=>{nl.init(e,t),Q.init(e,t)});var L_=h("ZodCUID",(e,t)=>{ol.init(e,t),Q.init(e,t)});var F_=h("ZodCUID2",(e,t)=>{sl.init(e,t),Q.init(e,t)});var V_=h("ZodULID",(e,t)=>{il.init(e,t),Q.init(e,t)});var H_=h("ZodXID",(e,t)=>{al.init(e,t),Q.init(e,t)});var J_=h("ZodKSUID",(e,t)=>{cl.init(e,t),Q.init(e,t)});var K_=h("ZodIPv4",(e,t)=>{fl.init(e,t),Q.init(e,t)});var G_=h("ZodIPv6",(e,t)=>{ml.init(e,t),Q.init(e,t)});var B_=h("ZodCIDRv4",(e,t)=>{hl.init(e,t),Q.init(e,t)});var W_=h("ZodCIDRv6",(e,t)=>{gl.init(e,t),Q.init(e,t)});var Y_=h("ZodBase64",(e,t)=>{yl.init(e,t),Q.init(e,t)});var Q_=h("ZodBase64URL",(e,t)=>{vl.init(e,t),Q.init(e,t)});var X_=h("ZodE164",(e,t)=>{$l.init(e,t),Q.init(e,t)});var ey=h("ZodJWT",(e,t)=>{wl.init(e,t),Q.init(e,t)});var no=h("ZodNumber",(e,t)=>{Ps.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Ud(e,n,o,s),Fr(e,"ZodNumber",{gt(n,o){return this.check(Wt(n,o))},gte(n,o){return this.check(Fe(n,o))},min(n,o){return this.check(Fe(n,o))},lt(n,o){return this.check(Bt(n,o))},lte(n,o){return this.check(at(n,o))},max(n,o){return this.check(at(n,o))},int(n){return this.check(Rp(n))},safe(n){return this.check(Rp(n))},positive(n){return this.check(Wt(0,n))},nonnegative(n){return this.check(Fe(0,n))},negative(n){return this.check(Bt(0,n))},nonpositive(n){return this.check(at(0,n))},multipleOf(n,o){return this.check(qr(n,o))},step(n,o){return this.check(qr(n,o))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function U(e){return zd(no,e)}var ty=h("ZodNumberFormat",(e,t)=>{bl.init(e,t),no.init(e,t)});function Rp(e){return Sd(ty,e)}var ti=h("ZodBoolean",(e,t)=>{xl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ld(e,r,n,o)});function J(e){return Pd(ti,e)}var Zp=h("ZodBigInt",(e,t)=>{zl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Fd(e,n,o,s),e.gte=(n,o)=>e.check(Fe(n,o)),e.min=(n,o)=>e.check(Fe(n,o)),e.gt=(n,o)=>e.check(Wt(n,o)),e.gte=(n,o)=>e.check(Fe(n,o)),e.min=(n,o)=>e.check(Fe(n,o)),e.lt=(n,o)=>e.check(Bt(n,o)),e.lte=(n,o)=>e.check(at(n,o)),e.max=(n,o)=>e.check(at(n,o)),e.positive=n=>e.check(Wt(BigInt(0),n)),e.negative=n=>e.check(Bt(BigInt(0),n)),e.nonpositive=n=>e.check(at(BigInt(0),n)),e.nonnegative=n=>e.check(Fe(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(qr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var ry=h("ZodNull",(e,t)=>{kl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vd(e,r,n,o)});function ri(e){return Rd(ry,e)}var ny=h("ZodAny",(e,t)=>{Sl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jd(e,r,n,o)});function Dp(){return Id(ny)}var oy=h("ZodUnknown",(e,t)=>{Pl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kd(e,r,n,o)});function X(){return Od(oy)}var sy=h("ZodNever",(e,t)=>{Tl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hd(e,r,n,o)});function iy(e){return Cd(sy,e)}var Mp=h("ZodDate",(e,t)=>{El.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Gd(e,n,o,s),e.min=(n,o)=>e.check(Fe(n,o)),e.max=(n,o)=>e.check(at(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var ay=h("ZodArray",(e,t)=>{Rl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xd(e,r,n,o),e.element=t.element,Fr(e,"ZodArray",{min(r,n){return this.check(Yt(r,n))},nonempty(r){return this.check(Yt(1,r))},max(r,n){return this.check(eo(r,n))},length(r,n){return this.check(to(r,n))},unwrap(){return this.element}})});function w(e,t){return Ad(ay,e,t)}var qp=h("ZodObject",(e,t)=>{Cl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ep(e,r,n,o),j.defineLazy(e,"shape",()=>t.shape),Fr(e,"ZodObject",{keyof(){return be(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:X()})},loose(){return this.clone({...this._zod.def,catchall:X()})},strict(){return this.clone({...this._zod.def,catchall:iy()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return j.extend(this,r)},safeExtend(r){return j.safeExtend(this,r)},merge(r){return j.merge(this,r)},pick(r){return j.pick(this,r)},omit(r){return j.omit(this,r)},partial(...r){return j.partial(Fp,this,r[0])},required(...r){return j.required(Vp,this,r[0])}})});function b(e,t){let r={type:"object",shape:e??{},...j.normalizeParams(t)};return new qp(r)}function se(e,t){return new qp({type:"object",shape:e,catchall:X(),...j.normalizeParams(t)})}var Up=h("ZodUnion",(e,t)=>{Ts.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tp(e,r,n,o),e.options=t.options});function G(e,t){return new Up({type:"union",options:e,...j.normalizeParams(t)})}var cy=h("ZodDiscriminatedUnion",(e,t)=>{Up.init(e,t),Nl.init(e,t)});function ni(e,t,r){return new cy({type:"union",options:t,discriminator:e,...j.normalizeParams(r)})}var uy=h("ZodIntersection",(e,t)=>{Al.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rp(e,r,n,o)});function oo(e,t){return new uy({type:"intersection",left:e,right:t})}var Ip=h("ZodRecord",(e,t)=>{jl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>np(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return!t||!t._zod?new Ip({type:"record",keyType:d(),valueType:e,...j.normalizeParams(t)}):new Ip({type:"record",keyType:e,valueType:t,...j.normalizeParams(r)})}var Xs=h("ZodEnum",(e,t)=>{Zl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Bd(e,n,o,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Xs({...t,checks:[],...j.normalizeParams(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Xs({...t,checks:[],...j.normalizeParams(o),entries:s})}});function be(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Xs({type:"enum",entries:r,...j.normalizeParams(t)})}var ly=h("ZodLiteral",(e,t)=>{Dl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wd(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function P(e,t){return new ly({type:"literal",values:Array.isArray(e)?e:[e],...j.normalizeParams(t)})}var dy=h("ZodTransform",(e,t)=>{Ml.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qd(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Vt(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(j.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(j.issue(i))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=o,r.fallback=!0,r)}});function Lp(e){return new dy({type:"transform",transform:e})}var Fp=h("ZodOptional",(e,t)=>{Es.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function te(e){return new Fp({type:"optional",innerType:e})}var py=h("ZodExactOptional",(e,t)=>{ql.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fy(e){return new py({type:"optional",innerType:e})}var my=h("ZodNullable",(e,t)=>{Ul.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>op(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Op(e){return new my({type:"nullable",innerType:e})}var hy=h("ZodDefault",(e,t)=>{Ll.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ip(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gy(e,t){return new hy({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var _y=h("ZodPrefault",(e,t)=>{Fl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ap(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function yy(e,t){return new _y({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var Vp=h("ZodNonOptional",(e,t)=>{Vl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vy(e,t){return new Vp({type:"nonoptional",innerType:e,...j.normalizeParams(t)})}var $y=h("ZodCatch",(e,t)=>{Hl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wy(e,t){return new $y({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Hp=h("ZodPipe",(e,t)=>{Rs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>up(e,r,n,o),e.in=t.in,e.out=t.out});function Cp(e,t){return new Hp({type:"pipe",in:e,out:t})}var by=h("ZodPreprocess",(e,t)=>{Hp.init(e,t),Jl.init(e,t)}),xy=h("ZodReadonly",(e,t)=>{Kl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zy(e){return new xy({type:"readonly",innerType:e})}var Jp=h("ZodCustom",(e,t)=>{Gl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yd(e,r,n,o)});function Kp(e,t){return jd(Jp,e??(()=>!0),t)}function ky(e,t={}){return Zd(Jp,e,t)}function Sy(e,t){return Dd(e,t)}function oi(e,t){return new by({type:"pipe",in:Lp(e),out:t})}var Bp={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var Gp;Gp||(Gp={});var so={};ts(so,{bigint:()=>Ry,boolean:()=>Ey,date:()=>Iy,number:()=>Ty,string:()=>Py});function Py(e){return Xl(ei,e)}function Ty(e){return kd(no,e)}function Ey(e){return Td(ti,e)}function Ry(e){return Ed(Zp,e)}function Iy(e){return Nd(Mp,e)}we(Bl());var Wp="io.modelcontextprotocol/related-task",ao="2.0",ce=Kp(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Yp=G([d(),U().int()]),Qp=d(),XP=se({ttl:G([U(),ri()]).optional(),pollInterval:U().optional()}),Cy=b({ttl:U().optional()}),Ny=b({taskId:d()}),si=se({progressToken:Yp.optional(),[Wp]:Ny.optional()}),Ie=b({_meta:si.optional()}),co=Ie.extend({task:Cy.optional()});var ue=b({method:d(),params:Ie.loose().optional()}),Ae=b({_meta:si.optional()}),je=b({method:d(),params:Ae.loose().optional()}),le=se({_meta:si.optional()}),uo=G([d(),U().int()]),Ay=b({jsonrpc:P(ao),id:uo,...ue.shape}).strict();var jy=b({jsonrpc:P(ao),...je.shape}).strict();var Xp=b({jsonrpc:P(ao),id:uo,result:le}).strict();var Vr;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Vr||(Vr={}));var ef=b({jsonrpc:P(ao),id:uo.optional(),error:b({code:U().int(),message:d(),data:X().optional()})}).strict();var Zy=G([Ay,jy,Xp,ef]),eT=G([Xp,ef]),ii=le.strict(),Dy=Ae.extend({requestId:uo.optional(),reason:d().optional()}),ai=je.extend({method:P("notifications/cancelled"),params:Dy}),My=b({src:d(),mimeType:d().optional(),sizes:w(d()).optional(),theme:be(["light","dark"]).optional()}),Hr=b({icons:w(My).optional()}),Xt=b({name:d(),title:d().optional()}),tf=Xt.extend({...Xt.shape,...Hr.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),qy=oo(b({applyDefaults:J().optional()}),ee(d(),X())),Uy=oi(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,oo(b({form:qy.optional(),url:ce.optional()}),ee(d(),X()).optional())),Ly=se({list:ce.optional(),cancel:ce.optional(),requests:se({sampling:se({createMessage:ce.optional()}).optional(),elicitation:se({create:ce.optional()}).optional()}).optional()}),Fy=se({list:ce.optional(),cancel:ce.optional(),requests:se({tools:se({call:ce.optional()}).optional()}).optional()}),Vy=b({experimental:ee(d(),ce).optional(),sampling:b({context:ce.optional(),tools:ce.optional()}).optional(),elicitation:Uy.optional(),roots:b({listChanged:J().optional()}).optional(),tasks:Ly.optional()}),Hy=Ie.extend({protocolVersion:d(),capabilities:Vy,clientInfo:tf}),Jy=ue.extend({method:P("initialize"),params:Hy});var Ky=b({experimental:ee(d(),ce).optional(),logging:ce.optional(),completions:ce.optional(),prompts:b({listChanged:J().optional()}).optional(),resources:b({subscribe:J().optional(),listChanged:J().optional()}).optional(),tools:b({listChanged:J().optional()}).optional(),tasks:Fy.optional()}),rf=le.extend({protocolVersion:d(),capabilities:Ky,serverInfo:tf,instructions:d().optional()}),Gy=je.extend({method:P("notifications/initialized"),params:Ae.optional()});var ci=ue.extend({method:P("ping"),params:Ie.optional()}),By=b({progress:U(),total:te(U()),message:te(d())}),Wy=b({...Ae.shape,...By.shape,progressToken:Yp}),ui=je.extend({method:P("notifications/progress"),params:Wy}),Yy=Ie.extend({cursor:Qp.optional()}),Jr=ue.extend({params:Yy.optional()}),Kr=le.extend({nextCursor:Qp.optional()}),Qy=be(["working","input_required","completed","failed","cancelled"]),Gr=b({taskId:d(),status:Qy,ttl:G([U(),ri()]),createdAt:d(),lastUpdatedAt:d(),pollInterval:te(U()),statusMessage:te(d())}),lo=le.extend({task:Gr}),Xy=Ae.merge(Gr),li=je.extend({method:P("notifications/tasks/status"),params:Xy}),di=ue.extend({method:P("tasks/get"),params:Ie.extend({taskId:d()})}),pi=le.merge(Gr),fi=ue.extend({method:P("tasks/result"),params:Ie.extend({taskId:d()})}),tT=le.loose(),mi=Jr.extend({method:P("tasks/list")}),hi=Kr.extend({tasks:w(Gr)}),gi=ue.extend({method:P("tasks/cancel"),params:Ie.extend({taskId:d()})}),ev=le.merge(Gr),nf=b({uri:d(),mimeType:te(d()),_meta:ee(d(),X()).optional()}),of=nf.extend({text:d()}),_i=d().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),sf=nf.extend({blob:_i}),Br=be(["user","assistant"]),er=b({audience:w(Br).optional(),priority:U().min(0).max(1).optional(),lastModified:Lr.datetime({offset:!0}).optional()}),af=b({...Xt.shape,...Hr.shape,uri:d(),description:te(d()),mimeType:te(d()),annotations:er.optional(),_meta:te(se({}))}),tv=b({...Xt.shape,...Hr.shape,uriTemplate:d(),description:te(d()),mimeType:te(d()),annotations:er.optional(),_meta:te(se({}))}),rv=Jr.extend({method:P("resources/list")}),cf=Kr.extend({resources:w(af)}),nv=Jr.extend({method:P("resources/templates/list")}),uf=Kr.extend({resourceTemplates:w(tv)}),yi=Ie.extend({uri:d()}),ov=yi,sv=ue.extend({method:P("resources/read"),params:ov}),lf=le.extend({contents:w(G([of,sf]))}),df=je.extend({method:P("notifications/resources/list_changed"),params:Ae.optional()}),iv=yi,av=ue.extend({method:P("resources/subscribe"),params:iv}),cv=yi,uv=ue.extend({method:P("resources/unsubscribe"),params:cv}),lv=Ae.extend({uri:d()}),dv=je.extend({method:P("notifications/resources/updated"),params:lv}),pv=b({name:d(),description:te(d()),required:te(J())}),fv=b({...Xt.shape,...Hr.shape,description:te(d()),arguments:te(w(pv)),_meta:te(se({}))}),mv=Jr.extend({method:P("prompts/list")}),pf=Kr.extend({prompts:w(fv)}),hv=Ie.extend({name:d(),arguments:ee(d(),d()).optional()}),gv=ue.extend({method:P("prompts/get"),params:hv}),vi=b({type:P("text"),text:d(),annotations:er.optional(),_meta:ee(d(),X()).optional()}),$i=b({type:P("image"),data:_i,mimeType:d(),annotations:er.optional(),_meta:ee(d(),X()).optional()}),wi=b({type:P("audio"),data:_i,mimeType:d(),annotations:er.optional(),_meta:ee(d(),X()).optional()}),_v=b({type:P("tool_use"),name:d(),id:d(),input:ee(d(),X()),_meta:ee(d(),X()).optional()}),yv=b({type:P("resource"),resource:G([of,sf]),annotations:er.optional(),_meta:ee(d(),X()).optional()}),vv=af.extend({type:P("resource_link")}),bi=G([vi,$i,wi,vv,yv]),$v=b({role:Br,content:bi}),ff=le.extend({description:d().optional(),messages:w($v)}),mf=je.extend({method:P("notifications/prompts/list_changed"),params:Ae.optional()}),wv=b({title:d().optional(),readOnlyHint:J().optional(),destructiveHint:J().optional(),idempotentHint:J().optional(),openWorldHint:J().optional()}),bv=b({taskSupport:be(["required","optional","forbidden"]).optional()}),hf=b({...Xt.shape,...Hr.shape,description:d().optional(),inputSchema:b({type:P("object"),properties:ee(d(),ce).optional(),required:w(d()).optional()}).catchall(X()),outputSchema:b({type:P("object"),properties:ee(d(),ce).optional(),required:w(d()).optional()}).catchall(X()).optional(),annotations:wv.optional(),execution:bv.optional(),_meta:ee(d(),X()).optional()}),xv=Jr.extend({method:P("tools/list")}),gf=Kr.extend({tools:w(hf)}),po=le.extend({content:w(bi).default([]),structuredContent:ee(d(),X()).optional(),isError:J().optional()}),rT=po.or(le.extend({toolResult:X()})),zv=co.extend({name:d(),arguments:ee(d(),X()).optional()}),kv=ue.extend({method:P("tools/call"),params:zv}),xi=je.extend({method:P("notifications/tools/list_changed"),params:Ae.optional()}),Sv=b({autoRefresh:J().default(!0),debounceMs:U().int().nonnegative().default(300)}),_f=be(["debug","info","notice","warning","error","critical","alert","emergency"]),Pv=Ie.extend({level:_f}),Tv=ue.extend({method:P("logging/setLevel"),params:Pv}),Ev=Ae.extend({level:_f,logger:d().optional(),data:X()}),Rv=je.extend({method:P("notifications/message"),params:Ev}),Iv=b({name:d().optional()}),Ov=b({hints:w(Iv).optional(),costPriority:U().min(0).max(1).optional(),speedPriority:U().min(0).max(1).optional(),intelligencePriority:U().min(0).max(1).optional()}),Cv=b({mode:be(["auto","required","none"]).optional()}),Nv=b({type:P("tool_result"),toolUseId:d().describe("The unique identifier for the corresponding tool call."),content:w(bi).default([]),structuredContent:b({}).loose().optional(),isError:J().optional(),_meta:ee(d(),X()).optional()}),Av=ni("type",[vi,$i,wi]),io=ni("type",[vi,$i,wi,_v,Nv]),jv=b({role:Br,content:G([io,w(io)]),_meta:ee(d(),X()).optional()}),Zv=co.extend({messages:w(jv),modelPreferences:Ov.optional(),systemPrompt:d().optional(),includeContext:be(["none","thisServer","allServers"]).optional(),temperature:U().optional(),maxTokens:U().int(),stopSequences:w(d()).optional(),metadata:ce.optional(),tools:w(hf).optional(),toolChoice:Cv.optional()}),yf=ue.extend({method:P("sampling/createMessage"),params:Zv}),vf=le.extend({model:d(),stopReason:te(be(["endTurn","stopSequence","maxTokens"]).or(d())),role:Br,content:Av}),$f=le.extend({model:d(),stopReason:te(be(["endTurn","stopSequence","maxTokens","toolUse"]).or(d())),role:Br,content:G([io,w(io)])}),Dv=b({type:P("boolean"),title:d().optional(),description:d().optional(),default:J().optional()}),Mv=b({type:P("string"),title:d().optional(),description:d().optional(),minLength:U().optional(),maxLength:U().optional(),format:be(["email","uri","date","date-time"]).optional(),default:d().optional()}),qv=b({type:be(["number","integer"]),title:d().optional(),description:d().optional(),minimum:U().optional(),maximum:U().optional(),default:U().optional()}),Uv=b({type:P("string"),title:d().optional(),description:d().optional(),enum:w(d()),default:d().optional()}),Lv=b({type:P("string"),title:d().optional(),description:d().optional(),oneOf:w(b({const:d(),title:d()})),default:d().optional()}),Fv=b({type:P("string"),title:d().optional(),description:d().optional(),enum:w(d()),enumNames:w(d()).optional(),default:d().optional()}),Vv=G([Uv,Lv]),Hv=b({type:P("array"),title:d().optional(),description:d().optional(),minItems:U().optional(),maxItems:U().optional(),items:b({type:P("string"),enum:w(d())}),default:w(d()).optional()}),Jv=b({type:P("array"),title:d().optional(),description:d().optional(),minItems:U().optional(),maxItems:U().optional(),items:b({anyOf:w(b({const:d(),title:d()}))}),default:w(d()).optional()}),Kv=G([Hv,Jv]),Gv=G([Fv,Vv,Kv]),Bv=G([Gv,Dv,Mv,qv]),Wv=co.extend({mode:P("form").optional(),message:d(),requestedSchema:b({type:P("object"),properties:ee(d(),Bv),required:w(d()).optional()})}),Yv=co.extend({mode:P("url"),message:d(),elicitationId:d(),url:d().url()}),Qv=G([Wv,Yv]),wf=ue.extend({method:P("elicitation/create"),params:Qv}),Xv=Ae.extend({elicitationId:d()}),e$=je.extend({method:P("notifications/elicitation/complete"),params:Xv}),bf=le.extend({action:be(["accept","decline","cancel"]),content:oi(e=>e===null?void 0:e,ee(d(),G([d(),U(),J(),w(d())])).optional())}),t$=b({type:P("ref/resource"),uri:d()});var r$=b({type:P("ref/prompt"),name:d()}),n$=Ie.extend({ref:G([r$,t$]),argument:b({name:d(),value:d()}),context:b({arguments:ee(d(),d()).optional()}).optional()}),o$=ue.extend({method:P("completion/complete"),params:n$});var xf=le.extend({completion:se({values:w(d()).max(100),total:te(U().int()),hasMore:te(J())})}),s$=b({uri:d().startsWith("file://"),name:d().optional(),_meta:ee(d(),X()).optional()}),i$=ue.extend({method:P("roots/list"),params:Ie.optional()}),a$=le.extend({roots:w(s$)}),c$=je.extend({method:P("notifications/roots/list_changed"),params:Ae.optional()}),nT=G([ci,Jy,o$,Tv,gv,mv,rv,nv,sv,av,uv,kv,xv,di,fi,mi,gi]),oT=G([ai,ui,Gy,c$,li]),sT=G([ii,vf,$f,bf,a$,pi,hi,lo]),iT=G([ci,yf,wf,i$,di,fi,mi,gi]),aT=G([ai,ui,Rv,dv,df,xi,mf,li,e$]),cT=G([ii,rf,xf,ff,pf,cf,uf,lf,po,gf,pi,hi,lo]);var u$=Symbol("Let zodToJsonSchema decide on which parser to use");var UT=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var uk=Hg(dg(),1);var dk;dk=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);var me=jp().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Bp.custom,message:"URL must be parseable",fatal:!0}),as}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),pk=se({resource:d().url(),authorization_servers:w(me).optional(),jwks_uri:d().url().optional(),scopes_supported:w(d()).optional(),bearer_methods_supported:w(d()).optional(),resource_signing_alg_values_supported:w(d()).optional(),resource_name:d().optional(),resource_documentation:d().optional(),resource_policy_uri:d().url().optional(),resource_tos_uri:d().url().optional(),tls_client_certificate_bound_access_tokens:J().optional(),authorization_details_types_supported:w(d()).optional(),dpop_signing_alg_values_supported:w(d()).optional(),dpop_bound_access_tokens_required:J().optional()}),fg=se({issuer:d(),authorization_endpoint:me,token_endpoint:me,registration_endpoint:me.optional(),scopes_supported:w(d()).optional(),response_types_supported:w(d()),response_modes_supported:w(d()).optional(),grant_types_supported:w(d()).optional(),token_endpoint_auth_methods_supported:w(d()).optional(),token_endpoint_auth_signing_alg_values_supported:w(d()).optional(),service_documentation:me.optional(),revocation_endpoint:me.optional(),revocation_endpoint_auth_methods_supported:w(d()).optional(),revocation_endpoint_auth_signing_alg_values_supported:w(d()).optional(),introspection_endpoint:d().optional(),introspection_endpoint_auth_methods_supported:w(d()).optional(),introspection_endpoint_auth_signing_alg_values_supported:w(d()).optional(),code_challenge_methods_supported:w(d()).optional(),client_id_metadata_document_supported:J().optional()}),fk=se({issuer:d(),authorization_endpoint:me,token_endpoint:me,userinfo_endpoint:me.optional(),jwks_uri:me,registration_endpoint:me.optional(),scopes_supported:w(d()).optional(),response_types_supported:w(d()),response_modes_supported:w(d()).optional(),grant_types_supported:w(d()).optional(),acr_values_supported:w(d()).optional(),subject_types_supported:w(d()),id_token_signing_alg_values_supported:w(d()),id_token_encryption_alg_values_supported:w(d()).optional(),id_token_encryption_enc_values_supported:w(d()).optional(),userinfo_signing_alg_values_supported:w(d()).optional(),userinfo_encryption_alg_values_supported:w(d()).optional(),userinfo_encryption_enc_values_supported:w(d()).optional(),request_object_signing_alg_values_supported:w(d()).optional(),request_object_encryption_alg_values_supported:w(d()).optional(),request_object_encryption_enc_values_supported:w(d()).optional(),token_endpoint_auth_methods_supported:w(d()).optional(),token_endpoint_auth_signing_alg_values_supported:w(d()).optional(),display_values_supported:w(d()).optional(),claim_types_supported:w(d()).optional(),claims_supported:w(d()).optional(),service_documentation:d().optional(),claims_locales_supported:w(d()).optional(),ui_locales_supported:w(d()).optional(),claims_parameter_supported:J().optional(),request_parameter_supported:J().optional(),request_uri_parameter_supported:J().optional(),require_request_uri_registration:J().optional(),op_policy_uri:me.optional(),op_tos_uri:me.optional(),client_id_metadata_document_supported:J().optional()}),mk=b({...fk.shape,...fg.pick({code_challenge_methods_supported:!0}).shape}),hk=b({access_token:d(),id_token:d().optional(),token_type:d(),expires_in:so.number().optional(),scope:d().optional(),refresh_token:d().optional()}).strip(),gk=b({error:d(),error_description:d().optional(),error_uri:d().optional()}),pg=me.optional().or(P("").transform(()=>{})),_k=b({redirect_uris:w(me),token_endpoint_auth_method:d().optional(),grant_types:w(d()).optional(),response_types:w(d()).optional(),client_name:d().optional(),client_uri:me.optional(),logo_uri:pg,scope:d().optional(),contacts:w(d()).optional(),tos_uri:pg,policy_uri:d().optional(),jwks_uri:me.optional(),jwks:Dp().optional(),software_id:d().optional(),software_version:d().optional(),software_statement:d().optional()}).strip(),yk=b({client_id:d(),client_secret:d().optional(),client_id_issued_at:U().optional(),client_secret_expires_at:U().optional()}).strip(),vk=_k.merge(yk),PC=b({error:d(),error_description:d().optional()}).strip(),TC=b({token:d(),token_type_hint:d().optional()}).strip();var oe=class extends Error{constructor(t,r){super(t),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}},Pn=class extends oe{};Pn.errorCode="invalid_request";var yr=class extends oe{};yr.errorCode="invalid_client";var vr=class extends oe{};vr.errorCode="invalid_grant";var $r=class extends oe{};$r.errorCode="unauthorized_client";var Tn=class extends oe{};Tn.errorCode="unsupported_grant_type";var En=class extends oe{};En.errorCode="invalid_scope";var Rn=class extends oe{};Rn.errorCode="access_denied";var wr=class extends oe{};wr.errorCode="server_error";var In=class extends oe{};In.errorCode="temporarily_unavailable";var On=class extends oe{};On.errorCode="unsupported_response_type";var Cn=class extends oe{};Cn.errorCode="unsupported_token_type";var Nn=class extends oe{};Nn.errorCode="invalid_token";var An=class extends oe{};An.errorCode="method_not_allowed";var jn=class extends oe{};jn.errorCode="too_many_requests";var br=class extends oe{};br.errorCode="invalid_client_metadata";var Zn=class extends oe{};Zn.errorCode="insufficient_scope";var Dn=class extends oe{};Dn.errorCode="invalid_target";var $k={[Pn.errorCode]:Pn,[yr.errorCode]:yr,[vr.errorCode]:vr,[$r.errorCode]:$r,[Tn.errorCode]:Tn,[En.errorCode]:En,[Rn.errorCode]:Rn,[wr.errorCode]:wr,[In.errorCode]:In,[On.errorCode]:On,[Cn.errorCode]:Cn,[Nn.errorCode]:Nn,[An.errorCode]:An,[jn.errorCode]:jn,[br.errorCode]:br,[Zn.errorCode]:Zn,[Dn.errorCode]:Dn};async function wk(e){let{exec:t}=await import("node:child_process"),{promisify:r}=await import("node:util"),n=r(t),o=process.platform,s=o==="darwin"?`open "${e}"`:o==="win32"?`start "" "${e}"`:`xdg-open "${e}"`;await n(s)}function mg(e){return new Promise(t=>setTimeout(t,e))}function Mn(e){try{let t=e.split(".")[1];if(!t)return;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf-8"));return typeof r.email=="string"?r.email:void 0}catch{return}}async function bk(e){let t=e.fetchImpl??fetch,r={clientId:e.clientId??"gigabuddy-cli"};e.productId!==void 0&&(r.productId=e.productId),e.scopes!==void 0&&(r.scopes=e.scopes);let n=await t(`${e.authUrl}/api/auth/device/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw new Error(`Failed to start device flow: ${await n.text()}`);let{deviceCode:o,userCode:s,verificationUrl:i,expiresIn:a,interval:c}=await n.json();return{deviceCode:o,userCode:s,verificationUrl:i,expiresIn:a,interval:c}}async function xk(e,t,r={}){let n=r.fetchImpl??fetch,o=Date.now()+t.expiresIn*1e3,s=(t.interval||5)*1e3;for(;Date.now()<o;){await mg(s);let i=await n(`${e}/api/auth/device/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:t.deviceCode})});if(i.status===429){await mg(s);continue}if(!i.ok)continue;let a=await i.json();if(a.status==="complete"&&a.platformToken&&a.refreshToken&&a.userId)return{refreshToken:a.refreshToken,platformToken:a.platformToken,userId:a.userId,userEmail:a.userEmail??Mn(a.platformToken)};if(a.status==="expired")throw new Error("Device code expired. Please try again.");r.onPending?.()}throw new Error("Authentication timed out. Please try again.")}async function hg(e){let t=await bk({authUrl:e.authUrl,clientId:e.clientId??"gigabuddy-cli",productId:e.productId??"gigabuddy/studio",scopes:e.scopes,fetchImpl:e.fetchImpl});return e.onPrompt?.({verificationUrl:t.verificationUrl,userCode:t.userCode}),(e.openBrowserImpl??wk)(t.verificationUrl).catch(()=>{}),xk(e.authUrl,t,{onPending:e.onPending,fetchImpl:e.fetchImpl})}function hc(e){if(!e)return null;try{let t=e.split(".")[1];if(!t)return null;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf-8")),n={};return typeof r.sub=="string"&&(n.userId=r.sub),typeof r.email=="string"&&(n.email=r.email),n.userId||n.email?n:null}catch{return null}}function zk(e,t){return e.userId&&t.userId?e.userId===t.userId:e.email&&t.email?e.email.toLowerCase()===t.email.toLowerCase():null}function xr(e){return e.email&&e.userId?`${e.email} (${e.userId})`:e.email??e.userId??"unknown"}var kk=["gigabuddy"];function Sk(e=kk){return new RegExp(e.map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"i")}function Pk(e,t,r="plugin:gigabuddy:agent",n){if(!e)return[];let o=Sk(n),s=e.projects?.[t],i=new Set((Array.isArray(s?.disabledMcpServers)?s.disabledMcpServers:[]).filter(l=>typeof l=="string")),a=[],c=Array.isArray(e.claudeAiMcpEverConnected)?e.claudeAiMcpEverConnected:[];for(let l of c)typeof l!="string"||!o.test(l)||i.has(l)||a.push({name:l,kind:"claude.ai"});let u={...e.mcpServers??{},...s?.mcpServers??{}};for(let l of Object.keys(u))l===r||!o.test(l)||i.has(l)||a.push({name:l,kind:"local"});return a}function Tk(e){let t=[];for(let r of e.split(`
73
- `)){let n=/^\s*\/\/([^=\s]+?)\/:_authToken\s*=\s*(\S+)\s*$/.exec(r);if(!n)continue;let o=hc(n[2]);o?.userId?.startsWith("user:")&&t.push({host:n[1],principal:o})}return t}function gg(e){let t=[];for(let{host:n,principal:o}of Tk(e.npmrc))zk(e.self,o)===!1&&t.push({source:`${e.npmrcLabel??"~/.npmrc"} (//${n}/)`,principal:o,fix:"gigabuddy login --npm"+(e.self.email?` as ${e.self.email}`:"")});let r=e.claudeConfig&&e.projectDir?Pk(e.claudeConfig,e.projectDir,e.selfDoorName,e.doorNames):[];return{self:e.self,secondDoors:r,mismatches:t}}function Ut(e){let t=new URL(e),r=t.pathname.replace(/\/+$/,"");return`//${t.host}${r}/:_authToken`}function qn(e){return`${e}:registry`}function Go(e){return e.replace(/\/+$/,"")+"/"}function _g(e,t){let r=Go(t.registryUrl),n=new Map([[qn(t.scope).toLowerCase(),`${qn(t.scope)}=${r}`],[Ut(r).toLowerCase(),`${Ut(r)}=${t.token}`]]),o=e.length>0?e.split(`
74
- `):[],s=new Set,i=[];for(let c of o){let u=vg(c);if(u&&n.has(u)){if(s.has(u))continue;s.add(u),i.push(n.get(u));continue}i.push(c)}let a=[...n.entries()].filter(([c])=>!s.has(c)).map(([,c])=>c);if(a.length===0)return i.join(`
72
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Ys(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){n(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Object.assign(u,g),Object.assign(u,l),a._zod.parent===p)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(g.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let m=a._zod.parent;if(m&&m!==p){n(m);let f=e.seen.get(m);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let g in u)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Fr(t,"input",e.processors),output:Fr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ve(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ve(n.element,r);if(n.type==="set")return ve(n.valueType,r);if(n.type==="lazy")return ve(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return ve(n.innerType,r);if(n.type==="intersection")return ve(n.left,r)||ve(n.right,r);if(n.type==="record"||n.type==="map")return ve(n.keyType,r)||ve(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ve(n.in,r)||ve(n.out,r);if(n.type==="object"){for(let o in n.shape)if(ve(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(ve(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(ve(o,r))return!0;return!!(n.rest&&ve(n.rest,r))}return!1}var Bd=(e,t={})=>r=>{let n=Gs({...r,processors:t});return re(e,n),Ws(n,e),Ys(n,e)},Fr=(e,t,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=Gs({...o??{},target:s,io:t,processors:r});return re(e,i),Ws(i,e),Ys(i,e)};var Q_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Gd=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Q_[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Wd=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number";let p=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";p?f?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof s=="number"&&(o.minimum=s),m?f?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof i=="number"&&(o.maximum=i),typeof c=="number"&&(o.multipleOf=c)},Yd=(e,t,r,n)=>{r.type="boolean"},Qd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")};var Xd=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var ep=(e,t,r,n)=>{r.not={}},tp=(e,t,r,n)=>{},rp=(e,t,r,n)=>{},np=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},op=(e,t,r,n)=>{let o=e._zod.def,s=Nr(o.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},sp=(e,t,r,n)=>{let o=e._zod.def,s=[];for(let i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var ip=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var ap=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var cp=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=re(s.element,t,{...n,path:[...n.path,"items"]})},up=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object",o.properties={};let i=s.shape;for(let u in i)o.properties[u]=re(i[u],t,{...n,path:[...n.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=re(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},lp=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>re(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},dp=(e,t,r,n)=>{let o=e._zod.def,s=re(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=re(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var pp=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=re(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)o.patternProperties[p.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=re(s.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=re(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(o.required=l)}},fp=(e,t,r,n)=>{let o=e._zod.def,s=re(o.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},mp=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},hp=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},gp=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},_p=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},yp=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;re(i,t,n);let a=t.seen.get(e);a.ref=i},vp=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var Qs=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var Vr={};ss(Vr,{ZodISODate:()=>wp,ZodISODateTime:()=>$p,ZodISODuration:()=>xp,ZodISOTime:()=>bp,date:()=>ei,datetime:()=>Xs,duration:()=>ri,time:()=>ti});var $p=h("ZodISODateTime",(e,t)=>{yl.init(e,t),Q.init(e,t)});function Xs(e){return Ed($p,e)}var wp=h("ZodISODate",(e,t)=>{vl.init(e,t),Q.init(e,t)});function ei(e){return Rd(wp,e)}var bp=h("ZodISOTime",(e,t)=>{$l.init(e,t),Q.init(e,t)});function ti(e){return Id(bp,e)}var xp=h("ZodISODuration",(e,t)=>{wl.init(e,t),Q.init(e,t)});function ri(e){return Od(xp,e)}var iy=(e,t)=>{Wn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>zs(e,r)},flatten:{value:r=>xs(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Bt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Bt,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Oe=h("ZodError",iy,{Parent:Error});var Sp=Yn(Oe),kp=Qn(Oe),Pp=Dr(Oe),Tp=Mr(Oe),Ep=tu(Oe),Rp=ru(Oe),Ip=nu(Oe),Op=ou(Oe),Cp=su(Oe),Np=iu(Oe),Ap=au(Oe),jp=cu(Oe);var Zp=new WeakMap;function Hr(e,t,r){let n=Object.getPrototypeOf(e),o=Zp.get(n);if(o||(o=new Set,Zp.set(n,o)),!o.has(t)){o.add(t);for(let s in r){let i=r[s];Object.defineProperty(n,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var H=h("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Fr(e,"input"),output:Fr(e,"output")}}),e.toJSONSchema=Bd(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>Sp(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Pp(e,r,n),e.parseAsync=async(r,n)=>kp(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Tp(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Ep(e,r,n),e.decode=(r,n)=>Rp(e,r,n),e.encodeAsync=async(r,n)=>Ip(e,r,n),e.decodeAsync=async(r,n)=>Op(e,r,n),e.safeEncode=(r,n)=>Cp(e,r,n),e.safeDecode=(r,n)=>Np(e,r,n),e.safeEncodeAsync=async(r,n)=>Ap(e,r,n),e.safeDecodeAsync=async(r,n)=>jp(e,r,n),Hr(e,"ZodType",{check(...r){let n=this.def;return this.clone(j.mergeDefs(n,{checks:[...n.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return Ae(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(By(r,n))},superRefine(r,n){return this.check(Gy(r,n))},overwrite(r){return this.check(vt(r))},optional(){return te(this)},exactOptional(){return jy(this)},nullable(){return Up(this)},nullish(){return te(Up(this))},nonoptional(r){return Ly(this,r)},array(){return w(this)},or(r){return B([this,r])},and(r){return ao(this,r)},transform(r){return Lp(this,Yp(r))},default(r){return My(this,r)},prefault(r){return Uy(this,r)},catch(r){return Vy(this,r)},pipe(r){return Lp(this,r)},readonly(){return Ky(this)},describe(r){let n=this.clone();return yt.add(n,{description:r}),n},meta(...r){if(r.length===0)return yt.get(this);let n=this.clone();return yt.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return yt.get(e)?.description},configurable:!0}),e)),Fp=h("_ZodString",(e,t)=>{ro.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Gd(e,n,o,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Hr(e,"_ZodString",{regex(...n){return this.check(Ds(...n))},includes(...n){return this.check(Us(...n))},startsWith(...n){return this.check(Ls(...n))},endsWith(...n){return this.check(Fs(...n))},min(...n){return this.check(Xt(...n))},max(...n){return this.check(no(...n))},length(...n){return this.check(oo(...n))},nonempty(...n){return this.check(Xt(1,...n))},lowercase(n){return this.check(Ms(n))},uppercase(n){return this.check(qs(n))},trim(){return this.check(Hs())},normalize(...n){return this.check(Vs(...n))},toLowerCase(){return this.check(Js())},toUpperCase(){return this.check(Ks())},slugify(){return this.check(Bs())}})}),oi=h("ZodString",(e,t)=>{ro.init(e,t),Fp.init(e,t),e.email=r=>e.check(ud(cy,r)),e.url=r=>e.check(Zs(Vp,r)),e.jwt=r=>e.check(Td(xy,r)),e.emoji=r=>e.check(md(uy,r)),e.guid=r=>e.check(js(Dp,r)),e.uuid=r=>e.check(ld(so,r)),e.uuidv4=r=>e.check(dd(so,r)),e.uuidv6=r=>e.check(pd(so,r)),e.uuidv7=r=>e.check(fd(so,r)),e.nanoid=r=>e.check(hd(ly,r)),e.guid=r=>e.check(js(Dp,r)),e.cuid=r=>e.check(gd(dy,r)),e.cuid2=r=>e.check(_d(py,r)),e.ulid=r=>e.check(yd(fy,r)),e.base64=r=>e.check(Sd($y,r)),e.base64url=r=>e.check(kd(wy,r)),e.xid=r=>e.check(vd(my,r)),e.ksuid=r=>e.check($d(hy,r)),e.ipv4=r=>e.check(wd(gy,r)),e.ipv6=r=>e.check(bd(_y,r)),e.cidrv4=r=>e.check(xd(yy,r)),e.cidrv6=r=>e.check(zd(vy,r)),e.e164=r=>e.check(Pd(by,r)),e.datetime=r=>e.check(Xs(r)),e.date=r=>e.check(ei(r)),e.time=r=>e.check(ti(r)),e.duration=r=>e.check(ri(r))});function d(e){return ad(oi,e)}var Q=h("ZodStringFormat",(e,t)=>{G.init(e,t),Fp.init(e,t)}),cy=h("ZodEmail",(e,t)=>{ul.init(e,t),Q.init(e,t)});var Dp=h("ZodGUID",(e,t)=>{al.init(e,t),Q.init(e,t)});var so=h("ZodUUID",(e,t)=>{cl.init(e,t),Q.init(e,t)});var Vp=h("ZodURL",(e,t)=>{ll.init(e,t),Q.init(e,t)});function Hp(e){return Zs(Vp,e)}var uy=h("ZodEmoji",(e,t)=>{dl.init(e,t),Q.init(e,t)});var ly=h("ZodNanoID",(e,t)=>{pl.init(e,t),Q.init(e,t)});var dy=h("ZodCUID",(e,t)=>{fl.init(e,t),Q.init(e,t)});var py=h("ZodCUID2",(e,t)=>{ml.init(e,t),Q.init(e,t)});var fy=h("ZodULID",(e,t)=>{hl.init(e,t),Q.init(e,t)});var my=h("ZodXID",(e,t)=>{gl.init(e,t),Q.init(e,t)});var hy=h("ZodKSUID",(e,t)=>{_l.init(e,t),Q.init(e,t)});var gy=h("ZodIPv4",(e,t)=>{bl.init(e,t),Q.init(e,t)});var _y=h("ZodIPv6",(e,t)=>{xl.init(e,t),Q.init(e,t)});var yy=h("ZodCIDRv4",(e,t)=>{zl.init(e,t),Q.init(e,t)});var vy=h("ZodCIDRv6",(e,t)=>{Sl.init(e,t),Q.init(e,t)});var $y=h("ZodBase64",(e,t)=>{Pl.init(e,t),Q.init(e,t)});var wy=h("ZodBase64URL",(e,t)=>{Tl.init(e,t),Q.init(e,t)});var by=h("ZodE164",(e,t)=>{El.init(e,t),Q.init(e,t)});var xy=h("ZodJWT",(e,t)=>{Rl.init(e,t),Q.init(e,t)});var io=h("ZodNumber",(e,t)=>{Is.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Wd(e,n,o,s),Hr(e,"ZodNumber",{gt(n,o){return this.check(Qt(n,o))},gte(n,o){return this.check(He(n,o))},min(n,o){return this.check(He(n,o))},lt(n,o){return this.check(Yt(n,o))},lte(n,o){return this.check(ct(n,o))},max(n,o){return this.check(ct(n,o))},int(n){return this.check(Mp(n))},safe(n){return this.check(Mp(n))},positive(n){return this.check(Qt(0,n))},nonnegative(n){return this.check(He(0,n))},negative(n){return this.check(Yt(0,n))},nonpositive(n){return this.check(ct(0,n))},multipleOf(n,o){return this.check(Lr(n,o))},step(n,o){return this.check(Lr(n,o))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function U(e){return Cd(io,e)}var zy=h("ZodNumberFormat",(e,t)=>{Il.init(e,t),io.init(e,t)});function Mp(e){return Ad(zy,e)}var si=h("ZodBoolean",(e,t)=>{Ol.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yd(e,r,n,o)});function J(e){return jd(si,e)}var Jp=h("ZodBigInt",(e,t)=>{Cl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Qd(e,n,o,s),e.gte=(n,o)=>e.check(He(n,o)),e.min=(n,o)=>e.check(He(n,o)),e.gt=(n,o)=>e.check(Qt(n,o)),e.gte=(n,o)=>e.check(He(n,o)),e.min=(n,o)=>e.check(He(n,o)),e.lt=(n,o)=>e.check(Yt(n,o)),e.lte=(n,o)=>e.check(ct(n,o)),e.max=(n,o)=>e.check(ct(n,o)),e.positive=n=>e.check(Qt(BigInt(0),n)),e.negative=n=>e.check(Yt(BigInt(0),n)),e.nonpositive=n=>e.check(ct(BigInt(0),n)),e.nonnegative=n=>e.check(He(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(Lr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var Sy=h("ZodNull",(e,t)=>{Nl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xd(e,r,n,o)});function ii(e){return Md(Sy,e)}var ky=h("ZodAny",(e,t)=>{Al.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tp(e,r,n,o)});function Kp(){return qd(ky)}var Py=h("ZodUnknown",(e,t)=>{jl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rp(e,r,n,o)});function X(){return Ud(Py)}var Ty=h("ZodNever",(e,t)=>{Zl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ep(e,r,n,o)});function Ey(e){return Ld(Ty,e)}var Bp=h("ZodDate",(e,t)=>{Dl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>np(e,n,o,s),e.min=(n,o)=>e.check(He(n,o)),e.max=(n,o)=>e.check(ct(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var Ry=h("ZodArray",(e,t)=>{Ml.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cp(e,r,n,o),e.element=t.element,Hr(e,"ZodArray",{min(r,n){return this.check(Xt(r,n))},nonempty(r){return this.check(Xt(1,r))},max(r,n){return this.check(no(r,n))},length(r,n){return this.check(oo(r,n))},unwrap(){return this.element}})});function w(e,t){return Vd(Ry,e,t)}var Gp=h("ZodObject",(e,t)=>{Ll.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>up(e,r,n,o),j.defineLazy(e,"shape",()=>t.shape),Hr(e,"ZodObject",{keyof(){return xe(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:X()})},loose(){return this.clone({...this._zod.def,catchall:X()})},strict(){return this.clone({...this._zod.def,catchall:Ey()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return j.extend(this,r)},safeExtend(r){return j.safeExtend(this,r)},merge(r){return j.merge(this,r)},pick(r){return j.pick(this,r)},omit(r){return j.omit(this,r)},partial(...r){return j.partial(Qp,this,r[0])},required(...r){return j.required(Xp,this,r[0])}})});function b(e,t){let r={type:"object",shape:e??{},...j.normalizeParams(t)};return new Gp(r)}function se(e,t){return new Gp({type:"object",shape:e,catchall:X(),...j.normalizeParams(t)})}var Wp=h("ZodUnion",(e,t)=>{Os.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lp(e,r,n,o),e.options=t.options});function B(e,t){return new Wp({type:"union",options:e,...j.normalizeParams(t)})}var Iy=h("ZodDiscriminatedUnion",(e,t)=>{Wp.init(e,t),Fl.init(e,t)});function ai(e,t,r){return new Iy({type:"union",options:t,discriminator:e,...j.normalizeParams(r)})}var Oy=h("ZodIntersection",(e,t)=>{Vl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dp(e,r,n,o)});function ao(e,t){return new Oy({type:"intersection",left:e,right:t})}var qp=h("ZodRecord",(e,t)=>{Hl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pp(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return!t||!t._zod?new qp({type:"record",keyType:d(),valueType:e,...j.normalizeParams(t)}):new qp({type:"record",keyType:e,valueType:t,...j.normalizeParams(r)})}var ni=h("ZodEnum",(e,t)=>{Jl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>op(e,n,o,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new ni({...t,checks:[],...j.normalizeParams(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new ni({...t,checks:[],...j.normalizeParams(o),entries:s})}});function xe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new ni({type:"enum",entries:r,...j.normalizeParams(t)})}var Cy=h("ZodLiteral",(e,t)=>{Kl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sp(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function T(e,t){return new Cy({type:"literal",values:Array.isArray(e)?e:[e],...j.normalizeParams(t)})}var Ny=h("ZodTransform",(e,t)=>{Bl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ap(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Jt(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(j.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(j.issue(i))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=o,r.fallback=!0,r)}});function Yp(e){return new Ny({type:"transform",transform:e})}var Qp=h("ZodOptional",(e,t)=>{Cs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function te(e){return new Qp({type:"optional",innerType:e})}var Ay=h("ZodExactOptional",(e,t)=>{Gl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function jy(e){return new Ay({type:"optional",innerType:e})}var Zy=h("ZodNullable",(e,t)=>{Wl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Up(e){return new Zy({type:"nullable",innerType:e})}var Dy=h("ZodDefault",(e,t)=>{Yl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function My(e,t){return new Dy({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var qy=h("ZodPrefault",(e,t)=>{Ql.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Uy(e,t){return new qy({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var Xp=h("ZodNonOptional",(e,t)=>{Xl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ly(e,t){return new Xp({type:"nonoptional",innerType:e,...j.normalizeParams(t)})}var Fy=h("ZodCatch",(e,t)=>{ed.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_p(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vy(e,t){return new Fy({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var ef=h("ZodPipe",(e,t)=>{Ns.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yp(e,r,n,o),e.in=t.in,e.out=t.out});function Lp(e,t){return new ef({type:"pipe",in:e,out:t})}var Hy=h("ZodPreprocess",(e,t)=>{ef.init(e,t),td.init(e,t)}),Jy=h("ZodReadonly",(e,t)=>{rd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ky(e){return new Jy({type:"readonly",innerType:e})}var tf=h("ZodCustom",(e,t)=>{nd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ip(e,r,n,o)});function rf(e,t){return Hd(tf,e??(()=>!0),t)}function By(e,t={}){return Jd(tf,e,t)}function Gy(e,t){return Kd(e,t)}function ci(e,t){return new Hy({type:"pipe",in:Yp(e),out:t})}var of={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var nf;nf||(nf={});var co={};ss(co,{bigint:()=>Xy,boolean:()=>Qy,date:()=>ev,number:()=>Yy,string:()=>Wy});function Wy(e){return cd(oi,e)}function Yy(e){return Nd(io,e)}function Qy(e){return Zd(si,e)}function Xy(e){return Dd(Jp,e)}function ev(e){return Fd(Bp,e)}be(od());var sf="io.modelcontextprotocol/related-task",lo="2.0",ce=rf(e=>e!==null&&(typeof e=="object"||typeof e=="function")),af=B([d(),U().int()]),cf=d(),UT=se({ttl:B([U(),ii()]).optional(),pollInterval:U().optional()}),rv=b({ttl:U().optional()}),nv=b({taskId:d()}),ui=se({progressToken:af.optional(),[sf]:nv.optional()}),Ce=b({_meta:ui.optional()}),po=Ce.extend({task:rv.optional()});var ue=b({method:d(),params:Ce.loose().optional()}),Ze=b({_meta:ui.optional()}),De=b({method:d(),params:Ze.loose().optional()}),le=se({_meta:ui.optional()}),fo=B([d(),U().int()]),ov=b({jsonrpc:T(lo),id:fo,...ue.shape}).strict();var sv=b({jsonrpc:T(lo),...De.shape}).strict();var uf=b({jsonrpc:T(lo),id:fo,result:le}).strict();var Jr;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Jr||(Jr={}));var lf=b({jsonrpc:T(lo),id:fo.optional(),error:b({code:U().int(),message:d(),data:X().optional()})}).strict();var iv=B([ov,sv,uf,lf]),LT=B([uf,lf]),li=le.strict(),av=Ze.extend({requestId:fo.optional(),reason:d().optional()}),di=De.extend({method:T("notifications/cancelled"),params:av}),cv=b({src:d(),mimeType:d().optional(),sizes:w(d()).optional(),theme:xe(["light","dark"]).optional()}),Kr=b({icons:w(cv).optional()}),tr=b({name:d(),title:d().optional()}),df=tr.extend({...tr.shape,...Kr.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),uv=ao(b({applyDefaults:J().optional()}),ee(d(),X())),lv=ci(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ao(b({form:uv.optional(),url:ce.optional()}),ee(d(),X()).optional())),dv=se({list:ce.optional(),cancel:ce.optional(),requests:se({sampling:se({createMessage:ce.optional()}).optional(),elicitation:se({create:ce.optional()}).optional()}).optional()}),pv=se({list:ce.optional(),cancel:ce.optional(),requests:se({tools:se({call:ce.optional()}).optional()}).optional()}),fv=b({experimental:ee(d(),ce).optional(),sampling:b({context:ce.optional(),tools:ce.optional()}).optional(),elicitation:lv.optional(),roots:b({listChanged:J().optional()}).optional(),tasks:dv.optional()}),mv=Ce.extend({protocolVersion:d(),capabilities:fv,clientInfo:df}),hv=ue.extend({method:T("initialize"),params:mv});var gv=b({experimental:ee(d(),ce).optional(),logging:ce.optional(),completions:ce.optional(),prompts:b({listChanged:J().optional()}).optional(),resources:b({subscribe:J().optional(),listChanged:J().optional()}).optional(),tools:b({listChanged:J().optional()}).optional(),tasks:pv.optional()}),pf=le.extend({protocolVersion:d(),capabilities:gv,serverInfo:df,instructions:d().optional()}),_v=De.extend({method:T("notifications/initialized"),params:Ze.optional()});var pi=ue.extend({method:T("ping"),params:Ce.optional()}),yv=b({progress:U(),total:te(U()),message:te(d())}),vv=b({...Ze.shape,...yv.shape,progressToken:af}),fi=De.extend({method:T("notifications/progress"),params:vv}),$v=Ce.extend({cursor:cf.optional()}),Br=ue.extend({params:$v.optional()}),Gr=le.extend({nextCursor:cf.optional()}),wv=xe(["working","input_required","completed","failed","cancelled"]),Wr=b({taskId:d(),status:wv,ttl:B([U(),ii()]),createdAt:d(),lastUpdatedAt:d(),pollInterval:te(U()),statusMessage:te(d())}),mo=le.extend({task:Wr}),bv=Ze.merge(Wr),mi=De.extend({method:T("notifications/tasks/status"),params:bv}),hi=ue.extend({method:T("tasks/get"),params:Ce.extend({taskId:d()})}),gi=le.merge(Wr),_i=ue.extend({method:T("tasks/result"),params:Ce.extend({taskId:d()})}),FT=le.loose(),yi=Br.extend({method:T("tasks/list")}),vi=Gr.extend({tasks:w(Wr)}),$i=ue.extend({method:T("tasks/cancel"),params:Ce.extend({taskId:d()})}),xv=le.merge(Wr),ff=b({uri:d(),mimeType:te(d()),_meta:ee(d(),X()).optional()}),mf=ff.extend({text:d()}),wi=d().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),hf=ff.extend({blob:wi}),Yr=xe(["user","assistant"]),rr=b({audience:w(Yr).optional(),priority:U().min(0).max(1).optional(),lastModified:Vr.datetime({offset:!0}).optional()}),gf=b({...tr.shape,...Kr.shape,uri:d(),description:te(d()),mimeType:te(d()),annotations:rr.optional(),_meta:te(se({}))}),zv=b({...tr.shape,...Kr.shape,uriTemplate:d(),description:te(d()),mimeType:te(d()),annotations:rr.optional(),_meta:te(se({}))}),Sv=Br.extend({method:T("resources/list")}),_f=Gr.extend({resources:w(gf)}),kv=Br.extend({method:T("resources/templates/list")}),yf=Gr.extend({resourceTemplates:w(zv)}),bi=Ce.extend({uri:d()}),Pv=bi,Tv=ue.extend({method:T("resources/read"),params:Pv}),vf=le.extend({contents:w(B([mf,hf]))}),$f=De.extend({method:T("notifications/resources/list_changed"),params:Ze.optional()}),Ev=bi,Rv=ue.extend({method:T("resources/subscribe"),params:Ev}),Iv=bi,Ov=ue.extend({method:T("resources/unsubscribe"),params:Iv}),Cv=Ze.extend({uri:d()}),Nv=De.extend({method:T("notifications/resources/updated"),params:Cv}),Av=b({name:d(),description:te(d()),required:te(J())}),jv=b({...tr.shape,...Kr.shape,description:te(d()),arguments:te(w(Av)),_meta:te(se({}))}),Zv=Br.extend({method:T("prompts/list")}),wf=Gr.extend({prompts:w(jv)}),Dv=Ce.extend({name:d(),arguments:ee(d(),d()).optional()}),Mv=ue.extend({method:T("prompts/get"),params:Dv}),xi=b({type:T("text"),text:d(),annotations:rr.optional(),_meta:ee(d(),X()).optional()}),zi=b({type:T("image"),data:wi,mimeType:d(),annotations:rr.optional(),_meta:ee(d(),X()).optional()}),Si=b({type:T("audio"),data:wi,mimeType:d(),annotations:rr.optional(),_meta:ee(d(),X()).optional()}),qv=b({type:T("tool_use"),name:d(),id:d(),input:ee(d(),X()),_meta:ee(d(),X()).optional()}),Uv=b({type:T("resource"),resource:B([mf,hf]),annotations:rr.optional(),_meta:ee(d(),X()).optional()}),Lv=gf.extend({type:T("resource_link")}),ki=B([xi,zi,Si,Lv,Uv]),Fv=b({role:Yr,content:ki}),bf=le.extend({description:d().optional(),messages:w(Fv)}),xf=De.extend({method:T("notifications/prompts/list_changed"),params:Ze.optional()}),Vv=b({title:d().optional(),readOnlyHint:J().optional(),destructiveHint:J().optional(),idempotentHint:J().optional(),openWorldHint:J().optional()}),Hv=b({taskSupport:xe(["required","optional","forbidden"]).optional()}),zf=b({...tr.shape,...Kr.shape,description:d().optional(),inputSchema:b({type:T("object"),properties:ee(d(),ce).optional(),required:w(d()).optional()}).catchall(X()),outputSchema:b({type:T("object"),properties:ee(d(),ce).optional(),required:w(d()).optional()}).catchall(X()).optional(),annotations:Vv.optional(),execution:Hv.optional(),_meta:ee(d(),X()).optional()}),Jv=Br.extend({method:T("tools/list")}),Sf=Gr.extend({tools:w(zf)}),ho=le.extend({content:w(ki).default([]),structuredContent:ee(d(),X()).optional(),isError:J().optional()}),VT=ho.or(le.extend({toolResult:X()})),Kv=po.extend({name:d(),arguments:ee(d(),X()).optional()}),Bv=ue.extend({method:T("tools/call"),params:Kv}),Pi=De.extend({method:T("notifications/tools/list_changed"),params:Ze.optional()}),Gv=b({autoRefresh:J().default(!0),debounceMs:U().int().nonnegative().default(300)}),kf=xe(["debug","info","notice","warning","error","critical","alert","emergency"]),Wv=Ce.extend({level:kf}),Yv=ue.extend({method:T("logging/setLevel"),params:Wv}),Qv=Ze.extend({level:kf,logger:d().optional(),data:X()}),Xv=De.extend({method:T("notifications/message"),params:Qv}),e$=b({name:d().optional()}),t$=b({hints:w(e$).optional(),costPriority:U().min(0).max(1).optional(),speedPriority:U().min(0).max(1).optional(),intelligencePriority:U().min(0).max(1).optional()}),r$=b({mode:xe(["auto","required","none"]).optional()}),n$=b({type:T("tool_result"),toolUseId:d().describe("The unique identifier for the corresponding tool call."),content:w(ki).default([]),structuredContent:b({}).loose().optional(),isError:J().optional(),_meta:ee(d(),X()).optional()}),o$=ai("type",[xi,zi,Si]),uo=ai("type",[xi,zi,Si,qv,n$]),s$=b({role:Yr,content:B([uo,w(uo)]),_meta:ee(d(),X()).optional()}),i$=po.extend({messages:w(s$),modelPreferences:t$.optional(),systemPrompt:d().optional(),includeContext:xe(["none","thisServer","allServers"]).optional(),temperature:U().optional(),maxTokens:U().int(),stopSequences:w(d()).optional(),metadata:ce.optional(),tools:w(zf).optional(),toolChoice:r$.optional()}),Pf=ue.extend({method:T("sampling/createMessage"),params:i$}),Tf=le.extend({model:d(),stopReason:te(xe(["endTurn","stopSequence","maxTokens"]).or(d())),role:Yr,content:o$}),Ef=le.extend({model:d(),stopReason:te(xe(["endTurn","stopSequence","maxTokens","toolUse"]).or(d())),role:Yr,content:B([uo,w(uo)])}),a$=b({type:T("boolean"),title:d().optional(),description:d().optional(),default:J().optional()}),c$=b({type:T("string"),title:d().optional(),description:d().optional(),minLength:U().optional(),maxLength:U().optional(),format:xe(["email","uri","date","date-time"]).optional(),default:d().optional()}),u$=b({type:xe(["number","integer"]),title:d().optional(),description:d().optional(),minimum:U().optional(),maximum:U().optional(),default:U().optional()}),l$=b({type:T("string"),title:d().optional(),description:d().optional(),enum:w(d()),default:d().optional()}),d$=b({type:T("string"),title:d().optional(),description:d().optional(),oneOf:w(b({const:d(),title:d()})),default:d().optional()}),p$=b({type:T("string"),title:d().optional(),description:d().optional(),enum:w(d()),enumNames:w(d()).optional(),default:d().optional()}),f$=B([l$,d$]),m$=b({type:T("array"),title:d().optional(),description:d().optional(),minItems:U().optional(),maxItems:U().optional(),items:b({type:T("string"),enum:w(d())}),default:w(d()).optional()}),h$=b({type:T("array"),title:d().optional(),description:d().optional(),minItems:U().optional(),maxItems:U().optional(),items:b({anyOf:w(b({const:d(),title:d()}))}),default:w(d()).optional()}),g$=B([m$,h$]),_$=B([p$,f$,g$]),y$=B([_$,a$,c$,u$]),v$=po.extend({mode:T("form").optional(),message:d(),requestedSchema:b({type:T("object"),properties:ee(d(),y$),required:w(d()).optional()})}),$$=po.extend({mode:T("url"),message:d(),elicitationId:d(),url:d().url()}),w$=B([v$,$$]),Rf=ue.extend({method:T("elicitation/create"),params:w$}),b$=Ze.extend({elicitationId:d()}),x$=De.extend({method:T("notifications/elicitation/complete"),params:b$}),If=le.extend({action:xe(["accept","decline","cancel"]),content:ci(e=>e===null?void 0:e,ee(d(),B([d(),U(),J(),w(d())])).optional())}),z$=b({type:T("ref/resource"),uri:d()});var S$=b({type:T("ref/prompt"),name:d()}),k$=Ce.extend({ref:B([S$,z$]),argument:b({name:d(),value:d()}),context:b({arguments:ee(d(),d()).optional()}).optional()}),P$=ue.extend({method:T("completion/complete"),params:k$});var Of=le.extend({completion:se({values:w(d()).max(100),total:te(U().int()),hasMore:te(J())})}),T$=b({uri:d().startsWith("file://"),name:d().optional(),_meta:ee(d(),X()).optional()}),E$=ue.extend({method:T("roots/list"),params:Ce.optional()}),R$=le.extend({roots:w(T$)}),I$=De.extend({method:T("notifications/roots/list_changed"),params:Ze.optional()}),HT=B([pi,hv,P$,Yv,Mv,Zv,Sv,kv,Tv,Rv,Ov,Bv,Jv,hi,_i,yi,$i]),JT=B([di,fi,_v,I$,mi]),KT=B([li,Tf,Ef,If,R$,gi,vi,mo]),BT=B([pi,Pf,Rf,E$,hi,_i,yi,$i]),GT=B([di,fi,Xv,Nv,$f,Pi,xf,mi,x$]),WT=B([li,pf,Of,bf,wf,_f,yf,vf,ho,Sf,gi,vi,mo]);var O$=Symbol("Let zodToJsonSchema decide on which parser to use");var EE=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var YS=m_(Ng(),1);var XS;XS=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);var me=Hp().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:of.custom,message:"URL must be parseable",fatal:!0}),ds}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),ek=se({resource:d().url(),authorization_servers:w(me).optional(),jwks_uri:d().url().optional(),scopes_supported:w(d()).optional(),bearer_methods_supported:w(d()).optional(),resource_signing_alg_values_supported:w(d()).optional(),resource_name:d().optional(),resource_documentation:d().optional(),resource_policy_uri:d().url().optional(),resource_tos_uri:d().url().optional(),tls_client_certificate_bound_access_tokens:J().optional(),authorization_details_types_supported:w(d()).optional(),dpop_signing_alg_values_supported:w(d()).optional(),dpop_bound_access_tokens_required:J().optional()}),jg=se({issuer:d(),authorization_endpoint:me,token_endpoint:me,registration_endpoint:me.optional(),scopes_supported:w(d()).optional(),response_types_supported:w(d()),response_modes_supported:w(d()).optional(),grant_types_supported:w(d()).optional(),token_endpoint_auth_methods_supported:w(d()).optional(),token_endpoint_auth_signing_alg_values_supported:w(d()).optional(),service_documentation:me.optional(),revocation_endpoint:me.optional(),revocation_endpoint_auth_methods_supported:w(d()).optional(),revocation_endpoint_auth_signing_alg_values_supported:w(d()).optional(),introspection_endpoint:d().optional(),introspection_endpoint_auth_methods_supported:w(d()).optional(),introspection_endpoint_auth_signing_alg_values_supported:w(d()).optional(),code_challenge_methods_supported:w(d()).optional(),client_id_metadata_document_supported:J().optional()}),tk=se({issuer:d(),authorization_endpoint:me,token_endpoint:me,userinfo_endpoint:me.optional(),jwks_uri:me,registration_endpoint:me.optional(),scopes_supported:w(d()).optional(),response_types_supported:w(d()),response_modes_supported:w(d()).optional(),grant_types_supported:w(d()).optional(),acr_values_supported:w(d()).optional(),subject_types_supported:w(d()),id_token_signing_alg_values_supported:w(d()),id_token_encryption_alg_values_supported:w(d()).optional(),id_token_encryption_enc_values_supported:w(d()).optional(),userinfo_signing_alg_values_supported:w(d()).optional(),userinfo_encryption_alg_values_supported:w(d()).optional(),userinfo_encryption_enc_values_supported:w(d()).optional(),request_object_signing_alg_values_supported:w(d()).optional(),request_object_encryption_alg_values_supported:w(d()).optional(),request_object_encryption_enc_values_supported:w(d()).optional(),token_endpoint_auth_methods_supported:w(d()).optional(),token_endpoint_auth_signing_alg_values_supported:w(d()).optional(),display_values_supported:w(d()).optional(),claim_types_supported:w(d()).optional(),claims_supported:w(d()).optional(),service_documentation:d().optional(),claims_locales_supported:w(d()).optional(),ui_locales_supported:w(d()).optional(),claims_parameter_supported:J().optional(),request_parameter_supported:J().optional(),request_uri_parameter_supported:J().optional(),require_request_uri_registration:J().optional(),op_policy_uri:me.optional(),op_tos_uri:me.optional(),client_id_metadata_document_supported:J().optional()}),rk=b({...tk.shape,...jg.pick({code_challenge_methods_supported:!0}).shape}),nk=b({access_token:d(),id_token:d().optional(),token_type:d(),expires_in:co.number().optional(),scope:d().optional(),refresh_token:d().optional()}).strip(),ok=b({error:d(),error_description:d().optional(),error_uri:d().optional()}),Ag=me.optional().or(T("").transform(()=>{})),sk=b({redirect_uris:w(me),token_endpoint_auth_method:d().optional(),grant_types:w(d()).optional(),response_types:w(d()).optional(),client_name:d().optional(),client_uri:me.optional(),logo_uri:Ag,scope:d().optional(),contacts:w(d()).optional(),tos_uri:Ag,policy_uri:d().optional(),jwks_uri:me.optional(),jwks:Kp().optional(),software_id:d().optional(),software_version:d().optional(),software_statement:d().optional()}).strip(),ik=b({client_id:d(),client_secret:d().optional(),client_id_issued_at:U().optional(),client_secret_expires_at:U().optional()}).strip(),ak=sk.merge(ik),h1=b({error:d(),error_description:d().optional()}).strip(),g1=b({token:d(),token_type_hint:d().optional()}).strip();var oe=class extends Error{constructor(t,r){super(t),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}},Rn=class extends oe{};Rn.errorCode="invalid_request";var $r=class extends oe{};$r.errorCode="invalid_client";var wr=class extends oe{};wr.errorCode="invalid_grant";var br=class extends oe{};br.errorCode="unauthorized_client";var In=class extends oe{};In.errorCode="unsupported_grant_type";var On=class extends oe{};On.errorCode="invalid_scope";var Cn=class extends oe{};Cn.errorCode="access_denied";var xr=class extends oe{};xr.errorCode="server_error";var Nn=class extends oe{};Nn.errorCode="temporarily_unavailable";var An=class extends oe{};An.errorCode="unsupported_response_type";var jn=class extends oe{};jn.errorCode="unsupported_token_type";var Zn=class extends oe{};Zn.errorCode="invalid_token";var Dn=class extends oe{};Dn.errorCode="method_not_allowed";var Mn=class extends oe{};Mn.errorCode="too_many_requests";var zr=class extends oe{};zr.errorCode="invalid_client_metadata";var qn=class extends oe{};qn.errorCode="insufficient_scope";var Un=class extends oe{};Un.errorCode="invalid_target";var ck={[Rn.errorCode]:Rn,[$r.errorCode]:$r,[wr.errorCode]:wr,[br.errorCode]:br,[In.errorCode]:In,[On.errorCode]:On,[Cn.errorCode]:Cn,[xr.errorCode]:xr,[Nn.errorCode]:Nn,[An.errorCode]:An,[jn.errorCode]:jn,[Zn.errorCode]:Zn,[Dn.errorCode]:Dn,[Mn.errorCode]:Mn,[zr.errorCode]:zr,[qn.errorCode]:qn,[Un.errorCode]:Un};async function uk(e){let{exec:t}=await import("node:child_process"),{promisify:r}=await import("node:util"),n=r(t),o=process.platform,s=o==="darwin"?`open "${e}"`:o==="win32"?`start "" "${e}"`:`xdg-open "${e}"`;await n(s)}function Zg(e){return new Promise(t=>setTimeout(t,e))}function Ln(e){try{let t=e.split(".")[1];if(!t)return;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf-8"));return typeof r.email=="string"?r.email:void 0}catch{return}}async function lk(e){let t=e.fetchImpl??fetch,r={clientId:e.clientId??"gigabuddy-cli"};e.productId!==void 0&&(r.productId=e.productId),e.scopes!==void 0&&(r.scopes=e.scopes);let n=await t(`${e.authUrl}/api/auth/device/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw new Error(`Failed to start device flow: ${await n.text()}`);let{deviceCode:o,userCode:s,verificationUrl:i,expiresIn:a,interval:c}=await n.json();return{deviceCode:o,userCode:s,verificationUrl:i,expiresIn:a,interval:c}}async function dk(e,t,r={}){let n=r.fetchImpl??fetch,o=Date.now()+t.expiresIn*1e3,s=(t.interval||5)*1e3;for(;Date.now()<o;){await Zg(s);let i=await n(`${e}/api/auth/device/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:t.deviceCode})});if(i.status===429){await Zg(s);continue}if(!i.ok)continue;let a=await i.json();if(a.status==="complete"&&a.platformToken&&a.refreshToken&&a.userId)return{refreshToken:a.refreshToken,platformToken:a.platformToken,userId:a.userId,userEmail:a.userEmail??Ln(a.platformToken)};if(a.status==="expired")throw new Error("Device code expired. Please try again.");r.onPending?.()}throw new Error("Authentication timed out. Please try again.")}async function Dg(e){let t=await lk({authUrl:e.authUrl,clientId:e.clientId??"gigabuddy-cli",productId:e.productId??"gigabuddy/studio",scopes:e.scopes,fetchImpl:e.fetchImpl});return e.onPrompt?.({verificationUrl:t.verificationUrl,userCode:t.userCode}),(e.openBrowserImpl??uk)(t.verificationUrl).catch(()=>{}),dk(e.authUrl,t,{onPending:e.onPending,fetchImpl:e.fetchImpl})}function zc(e){if(!e)return null;try{let t=e.split(".")[1];if(!t)return null;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf-8")),n={};return typeof r.sub=="string"&&(n.userId=r.sub),typeof r.email=="string"&&(n.email=r.email),n.userId||n.email?n:null}catch{return null}}function pk(e,t){return e.userId&&t.userId?e.userId===t.userId:e.email&&t.email?e.email.toLowerCase()===t.email.toLowerCase():null}function Sr(e){return e.email&&e.userId?`${e.email} (${e.userId})`:e.email??e.userId??"unknown"}var fk=["gigabuddy"];function mk(e=fk){return new RegExp(e.map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"i")}function hk(e,t,r="plugin:gigabuddy:agent",n){if(!e)return[];let o=mk(n),s=e.projects?.[t],i=new Set((Array.isArray(s?.disabledMcpServers)?s.disabledMcpServers:[]).filter(l=>typeof l=="string")),a=[],c=Array.isArray(e.claudeAiMcpEverConnected)?e.claudeAiMcpEverConnected:[];for(let l of c)typeof l!="string"||!o.test(l)||i.has(l)||a.push({name:l,kind:"claude.ai"});let u={...e.mcpServers??{},...s?.mcpServers??{}};for(let l of Object.keys(u))l===r||!o.test(l)||i.has(l)||a.push({name:l,kind:"local"});return a}function gk(e){let t=[];for(let r of e.split(`
73
+ `)){let n=/^\s*\/\/([^=\s]+?)\/:_authToken\s*=\s*(\S+)\s*$/.exec(r);if(!n)continue;let o=zc(n[2]);o?.userId?.startsWith("user:")&&t.push({host:n[1],principal:o})}return t}function Mg(e){let t=[];for(let{host:n,principal:o}of gk(e.npmrc))pk(e.self,o)===!1&&t.push({source:`${e.npmrcLabel??"~/.npmrc"} (//${n}/)`,principal:o,fix:"gigabuddy login --npm"+(e.self.email?` as ${e.self.email}`:"")});let r=e.claudeConfig&&e.projectDir?hk(e.claudeConfig,e.projectDir,e.selfDoorName,e.doorNames):[];return{self:e.self,secondDoors:r,mismatches:t}}function Ft(e){let t=new URL(e),r=t.pathname.replace(/\/+$/,"");return`//${t.host}${r}/:_authToken`}function Fn(e){return`${e}:registry`}function Qo(e){return e.replace(/\/+$/,"")+"/"}function qg(e,t){let r=Qo(t.registryUrl),n=new Map([[Fn(t.scope).toLowerCase(),`${Fn(t.scope)}=${r}`],[Ft(r).toLowerCase(),`${Ft(r)}=${t.token}`]]),o=e.length>0?e.split(`
74
+ `):[],s=new Set,i=[];for(let c of o){let u=Lg(c);if(u&&n.has(u)){if(s.has(u))continue;s.add(u),i.push(n.get(u));continue}i.push(c)}let a=[...n.entries()].filter(([c])=>!s.has(c)).map(([,c])=>c);if(a.length===0)return i.join(`
75
75
  `);for(;i.length>0&&i[i.length-1].trim()==="";)i.pop();return[...i,...a,""].join(`
76
- `)}function yg(e,t){let r=Go(t.registryUrl),n=new Set([qn(t.scope).toLowerCase(),Ut(r).toLowerCase()]),s=e.split(`
77
- `).filter(i=>{let a=vg(i);return!(a&&n.has(a))}).join(`
78
- `);return s.trim().length===0?"":s}function vg(e){let t=e.trim();if(t.length===0||t.startsWith("#")||t.startsWith(";"))return null;let r=t.indexOf("=");return r===-1?null:t.slice(0,r).trim().toLowerCase()}import*as Bo from"node:fs";import*as $g from"node:os";import*as Tt from"node:path";var Be="@gigabuddy";async function wg(e){let r=await(e.fetchImpl??fetch)(`${e.authUrl}/api/token/registry`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.refreshToken})});if(!r.ok)throw new Error(`Could not mint a registry credential (${r.status}): ${await r.text()}`);let n=await r.json();if(!n.token||!n.registryUrl)throw new Error("Auth returned an incomplete registry credential");return{token:n.token,expiresIn:n.expiresIn??0,registryUrl:n.registryUrl}}async function bg(e){try{return(await(e.fetchImpl??fetch)(`${e.authUrl}/api/auth/signout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.refreshToken})})).ok}catch{return!1}}function Pe(){return process.env.NPM_CONFIG_USERCONFIG??Tt.join($g.homedir(),".npmrc")}function xg(e){try{return Bo.readFileSync(e,"utf-8")}catch{return""}}function gc(e,t=Pe()){let r=_g(xg(t),{scope:Be,registryUrl:e.registryUrl,token:e.token});return Ln(t,r),t}function _c(e,t=Pe()){let r=[],n=Tt.resolve(e);for(;;){let o=Tt.join(n,".npmrc");o!==Tt.resolve(t)&&Bo.existsSync(o)&&r.push(o);let s=Tt.dirname(n);if(s===n)break;n=s}return r}function Wo(e,t){let r=Ut(Go(t)).toLowerCase(),n=qn(Be).toLowerCase();return e.split(`
79
- `).some(o=>{let s=o.trim();if(!s||s.startsWith("#")||s.startsWith(";"))return!1;let i=s.indexOf("=");if(i===-1)return!1;let a=s.slice(0,i).trim().toLowerCase();return a===r||a===n})}function zg(e,t=Pe()){let r=xg(t),n=yg(r,{scope:Be,registryUrl:e});return n===r?null:(Ln(t,n),t)}var Ek="gigabuddy:registry";function kg(e=process.env){return!!(e.ACTIONS_ID_TOKEN_REQUEST_URL&&e.ACTIONS_ID_TOKEN_REQUEST_TOKEN)}async function Sg(e={}){let t=e.env??process.env,r=e.fetchImpl??fetch,n=t.ACTIONS_ID_TOKEN_REQUEST_URL,o=t.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!n||!o)throw new Error("Not inside a GitHub Actions job that can mint an ID token \u2014 add `permissions: id-token: write` to the workflow");let s=n.includes("?")?"&":"?",i=await r(`${n}${s}audience=${encodeURIComponent(Ek)}`,{headers:{Authorization:`Bearer ${o}`}});if(!i.ok)throw new Error(`GitHub would not mint an ID token (${i.status}): ${await i.text()}`);let a=await i.json();if(!a.value)throw new Error("GitHub returned no ID token");return a.value}async function Pg(e){let r=await(e.fetchImpl??fetch)(`${e.authUrl}/api/token/ci`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:e.idToken})});if(!r.ok){let o=await r.text();try{let s=JSON.parse(o);o=s.error_description??s.error??o}catch{}throw new Error(`Could not mint a CI registry credential (${r.status}): ${o}`)}let n=await r.json();if(!n.token||!n.registryUrl||!n.repository)throw new Error("Auth returned an incomplete CI registry credential");return{token:n.token,expiresIn:n.expiresIn??0,registryUrl:n.registryUrl,repository:n.repository,bindings:n.bindings??[]}}var zr=class{refreshToken;authUrl;platformToken=null;tokenExpiresAt=0;refreshPromise=null;onRefreshTokenRotated;reloginHint;fetchImpl;constructor(t){this.refreshToken=t.refreshToken,this.authUrl=t.authUrl,this.onRefreshTokenRotated=t.onRefreshTokenRotated,this.reloginHint=t.reloginHint??"Sign in again with 'gigabuddy login'.",this.fetchImpl=t.fetchImpl??fetch}async getToken(){return this.platformToken&&Date.now()<this.tokenExpiresAt-6e4?this.platformToken:this.refresh()}invalidate(){this.platformToken=null,this.tokenExpiresAt=0}async refresh(){return this.refreshPromise?this.refreshPromise:(this.refreshPromise=this.doRefresh().finally(()=>{this.refreshPromise=null}),this.refreshPromise)}async doRefresh(){let t=await this.fetchImpl(`${this.authUrl}/api/token/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:this.refreshToken})});if(!t.ok){let n=await t.text();throw new Error(`Token refresh failed (${t.status}): ${n}. ${this.reloginHint}`)}let r=await t.json();return this.platformToken=r.token,this.tokenExpiresAt=Date.now()+r.expiresIn*1e3,r.refreshToken&&r.refreshToken!==this.refreshToken&&(this.refreshToken=r.refreshToken,this.onRefreshTokenRotated?.(r.refreshToken)),r.token}};var yc="@gigabuddy",vc=20;function Rk(e){try{let t=e.split(".")[1];if(!t)return null;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf-8"));return typeof r.exp=="number"?new Date(r.exp*1e3):null}catch{return null}}function $c(e,t){let r=null;for(let n of e.split(`
80
- `)){let o=n.trim();if(!o||o.startsWith("#")||o.startsWith(";"))continue;let s=o.indexOf("=");s!==-1&&o.slice(0,s).trim().toLowerCase()===t.toLowerCase()&&(r=o.slice(s+1).trim())}return r}async function Tg(e,t){let r=[],n=[],o=(v,R,x)=>r.push({label:v,status:R,detail:x}),s=Number(e.nodeVersion.replace(/^v/,"").split(".")[0]);Number.isFinite(s)&&s<vc?(o("Node version","fail",`${e.nodeVersion} \u2014 gigabuddy needs Node ${vc} or newer`),n.push(`Upgrade Node to ${vc}+ \u2014 nothing below that is supported.`)):o("Node version","ok",e.nodeVersion);let i=e.loadCredentials(!1)??e.loadCredentials(!0);if(!i)return o("Signed in","fail","no credentials found"),n.push("Run `gigabuddy login --npm` \u2014 you are not signed in, so the registry cannot know who you are."),{checks:r,advice:n};let a={label:"Signed in",status:"ok",detail:i.userEmail??i.userId};r.push(a);let c=null;try{c=await new zr({refreshToken:i.refreshToken,authUrl:i.authUrl,fetchImpl:e.fetchImpl}).getToken();let v=Mn(c);v&&(a.detail=v),o("Session","ok","live")}catch(v){o("Session","fail",`not accepted by auth \u2014 ${v instanceof Error?v.message:String(v)}`),n.push("Run `gigabuddy login` \u2014 your session was revoked or expired, so every credential from it is dead.")}let u=e.readNpmrc(),l=$c(u,`${yc}:registry`);l?o(`${yc} registry`,"ok",l):(o(`${yc} registry`,"fail",`not set in ${Pe()}`),n.push("Run `gigabuddy login --npm` \u2014 npm has no registry configured for @gigabuddy packages."));let p=l?Ut(l):null,m=p?$c(u,p):null;if(l&&!m)o("Registry credential","fail",`no ${p} in ${Pe()}`),n.push("Run `gigabuddy login --npm` \u2014 the registry is configured but has no credential to authenticate with.");else if(m){let v=Rk(m);v&&v.getTime()<Date.now()?(o("Registry credential","fail",`expired ${v.toISOString().slice(0,10)}`),n.push("Run `gigabuddy login --npm` \u2014 your npm credential expired. They are long-lived, not permanent.")):o("Registry credential","ok",v?`valid until ${v.toISOString().slice(0,10)}`:"present")}{let v={...i.userId?{userId:i.userId}:{},...a.detail?{email:a.detail}:{},...hc(c)??{}},R=gg({self:v,npmrc:u,npmrcLabel:Pe(),claudeConfig:e.readClaudeConfig(),projectDir:e.projectDir});for(let k of R.mismatches)o("Same account everywhere","fail",`${k.source} is ${xr(k.principal)}`),n.push(`Your login is ${xr(v)} but ${k.source} was minted as ${xr(k.principal)} \u2014 work through npm and work through the plugin land on different humans. Re-run \`${k.fix}\` so every credential on this machine is the same account.`);let x=R.secondDoors.filter(k=>k.kind==="claude.ai");x.length>0&&(o("One Gigabuddy door in Claude Code","warn",x.map(k=>k.name).join(", ")+" was connected before and is not disabled here"),n.push(`Claude Code has connected ${x.map(k=>`\`${k.name}\``).join(" and ")} before and it is not disabled for ${e.projectDir} \u2014 if it still shows in Claude Code's /mcp it runs alongside the gigabuddy plugin. That connector acts as a grant agent sponsored by whoever consented on claude.ai \u2014 not necessarily ${xr(v)} \u2014 so work through both doors splits across two humans. Uncheck it in /mcp, or use only one door per session.`)),R.mismatches.length===0&&x.length===0&&o("Same account everywhere","ok",xr(v))}let f=e.shadowingNpmrcFiles().filter(v=>Wo(v.contents,l??"")),g=m,y=Pe();if(f.length>0){let v=f[0],R=p?$c(v.contents,p):null;R&&(g=R,y=v.path),o("Other .npmrc files","fail",`${v.path} also configures this registry`),n.push(`${v.path} sets a credential for this registry, and npm prefers it over ${Pe()} \u2014 so the credential you just minted is not the one being sent. Delete that file's \`_authToken\` line (or the file), then install again. This is usually a leftover from configuring the registry by hand before \`login --npm\` existed.`)}let $=e.npmEffectiveRegistry();if($&&l&&$.replace(/\/+$/,"")!==l.replace(/\/+$/,"")?(o("npm resolves @gigabuddy to","fail",`${$} \u2014 NOT what we configured`),n.push(`Something is overriding your user-level .npmrc \u2014 most often a project .npmrc, or an npm_config_ env var. npm is sending @gigabuddy installs to ${$}.`)):$&&o("npm resolves @gigabuddy to","ok",$),l&&g){let v=l.replace(/\/+$/,""),R=y===Pe()?"":` (using the credential from ${y})`;try{let x=await e.fetchImpl(`${v}/-/ping`,{headers:{authorization:`Bearer ${g}`}});x.ok?o("Registry reachable","ok",`${v}${R}`):x.status===401?(o("Registry reachable","fail",`reachable, but rejected the credential (401)${R}`),n.push(y===Pe()?"Run `gigabuddy login --npm` \u2014 the registry did not accept your credential.":`The registry rejected the credential in ${y}. That file is the problem, not your login.`)):o("Registry reachable","warn",`responded ${x.status}`)}catch(x){o("Registry reachable","fail",`cannot reach ${v} \u2014 ${x instanceof Error?x.message:String(x)}`),n.push("Check your network or proxy \u2014 the registry is unreachable from here.")}if(t)try{let x=await e.fetchImpl(`${v}/${t.replace("/","%2F")}`,{headers:{authorization:`Bearer ${g}`}});x.ok?o(`Access to ${t}`,"ok","you can install it"):x.status===404?(o(`Access to ${t}`,"fail","the registry will not serve it to you"),n.push(`The registry answers "no such package" for ${t}. That single answer covers BOTH "this name does not exist" and "you do not have access" \u2014 deliberately, so private names stay private. Everything else above is healthy, so: check the spelling first, and if it is right, ask whoever owns the package to grant you access.`)):x.status===401?o(`Access to ${t}`,"fail","credential rejected (401)"):o(`Access to ${t}`,"warn",`registry responded ${x.status}`)}catch(x){o(`Access to ${t}`,"fail",x instanceof Error?x.message:String(x))}}return{checks:r,advice:n}}var Ik={ok:"\u2713",warn:"!",fail:"\u2717",skip:"-"};function Eg(e,t){let r=(i,a)=>t?`\x1B[${i}m${a}\x1B[0m`:a,n={ok:"32",warn:"33",fail:"31",skip:"90"},o=Math.max(...e.checks.map(i=>i.label.length)),s=e.checks.map(i=>` ${r(n[i.status],Ik[i.status])} ${i.label.padEnd(o)} ${i.detail??""}`.trimEnd());if(e.advice.length===0)return s.push("",` ${r("32","Everything checks out.")}`),s.join(`
76
+ `)}function Ug(e,t){let r=Qo(t.registryUrl),n=new Set([Fn(t.scope).toLowerCase(),Ft(r).toLowerCase()]),s=e.split(`
77
+ `).filter(i=>{let a=Lg(i);return!(a&&n.has(a))}).join(`
78
+ `);return s.trim().length===0?"":s}function Lg(e){let t=e.trim();if(t.length===0||t.startsWith("#")||t.startsWith(";"))return null;let r=t.indexOf("=");return r===-1?null:t.slice(0,r).trim().toLowerCase()}import*as Xo from"node:fs";import*as Fg from"node:os";import*as Tt from"node:path";var Ye="@gigabuddy";async function Vg(e){let r=await(e.fetchImpl??fetch)(`${e.authUrl}/api/token/registry`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.refreshToken})});if(!r.ok)throw new Error(`Could not mint a registry credential (${r.status}): ${await r.text()}`);let n=await r.json();if(!n.token||!n.registryUrl)throw new Error("Auth returned an incomplete registry credential");return{token:n.token,expiresIn:n.expiresIn??0,registryUrl:n.registryUrl}}async function Hg(e){try{return(await(e.fetchImpl??fetch)(`${e.authUrl}/api/auth/signout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.refreshToken})})).ok}catch{return!1}}function Ee(){return process.env.NPM_CONFIG_USERCONFIG??Tt.join(Fg.homedir(),".npmrc")}function Jg(e){try{return Xo.readFileSync(e,"utf-8")}catch{return""}}function Sc(e,t=Ee()){let r=qg(Jg(t),{scope:Ye,registryUrl:e.registryUrl,token:e.token});return Hn(t,r),t}function kc(e,t=Ee()){let r=[],n=Tt.resolve(e);for(;;){let o=Tt.join(n,".npmrc");o!==Tt.resolve(t)&&Xo.existsSync(o)&&r.push(o);let s=Tt.dirname(n);if(s===n)break;n=s}return r}function es(e,t){let r=Ft(Qo(t)).toLowerCase(),n=Fn(Ye).toLowerCase();return e.split(`
79
+ `).some(o=>{let s=o.trim();if(!s||s.startsWith("#")||s.startsWith(";"))return!1;let i=s.indexOf("=");if(i===-1)return!1;let a=s.slice(0,i).trim().toLowerCase();return a===r||a===n})}function Kg(e,t=Ee()){let r=Jg(t),n=Ug(r,{scope:Ye,registryUrl:e});return n===r?null:(Hn(t,n),t)}var _k="gigabuddy:registry";function Bg(e=process.env){return!!(e.ACTIONS_ID_TOKEN_REQUEST_URL&&e.ACTIONS_ID_TOKEN_REQUEST_TOKEN)}async function Gg(e={}){let t=e.env??process.env,r=e.fetchImpl??fetch,n=t.ACTIONS_ID_TOKEN_REQUEST_URL,o=t.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!n||!o)throw new Error("Not inside a GitHub Actions job that can mint an ID token \u2014 add `permissions: id-token: write` to the workflow");let s=n.includes("?")?"&":"?",i=await r(`${n}${s}audience=${encodeURIComponent(_k)}`,{headers:{Authorization:`Bearer ${o}`}});if(!i.ok)throw new Error(`GitHub would not mint an ID token (${i.status}): ${await i.text()}`);let a=await i.json();if(!a.value)throw new Error("GitHub returned no ID token");return a.value}async function Wg(e){let r=await(e.fetchImpl??fetch)(`${e.authUrl}/api/token/ci`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:e.idToken})});if(!r.ok){let o=await r.text();try{let s=JSON.parse(o);o=s.error_description??s.error??o}catch{}throw new Error(`Could not mint a CI registry credential (${r.status}): ${o}`)}let n=await r.json();if(!n.token||!n.registryUrl||!n.repository)throw new Error("Auth returned an incomplete CI registry credential");return{token:n.token,expiresIn:n.expiresIn??0,registryUrl:n.registryUrl,repository:n.repository,bindings:n.bindings??[]}}var kr=class{refreshToken;authUrl;platformToken=null;tokenExpiresAt=0;refreshPromise=null;onRefreshTokenRotated;reloginHint;fetchImpl;constructor(t){this.refreshToken=t.refreshToken,this.authUrl=t.authUrl,this.onRefreshTokenRotated=t.onRefreshTokenRotated,this.reloginHint=t.reloginHint??"Sign in again with 'gigabuddy login'.",this.fetchImpl=t.fetchImpl??fetch}async getToken(){return this.platformToken&&Date.now()<this.tokenExpiresAt-6e4?this.platformToken:this.refresh()}invalidate(){this.platformToken=null,this.tokenExpiresAt=0}async refresh(){return this.refreshPromise?this.refreshPromise:(this.refreshPromise=this.doRefresh().finally(()=>{this.refreshPromise=null}),this.refreshPromise)}async doRefresh(){let t=await this.fetchImpl(`${this.authUrl}/api/token/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:this.refreshToken})});if(!t.ok){let n=await t.text();throw new Error(`Token refresh failed (${t.status}): ${n}. ${this.reloginHint}`)}let r=await t.json();return this.platformToken=r.token,this.tokenExpiresAt=Date.now()+r.expiresIn*1e3,r.refreshToken&&r.refreshToken!==this.refreshToken&&(this.refreshToken=r.refreshToken,this.onRefreshTokenRotated?.(r.refreshToken)),r.token}};var Pc="@gigabuddy",Tc=20;function yk(e){try{let t=e.split(".")[1];if(!t)return null;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf-8"));return typeof r.exp=="number"?new Date(r.exp*1e3):null}catch{return null}}function Ec(e,t){let r=null;for(let n of e.split(`
80
+ `)){let o=n.trim();if(!o||o.startsWith("#")||o.startsWith(";"))continue;let s=o.indexOf("=");s!==-1&&o.slice(0,s).trim().toLowerCase()===t.toLowerCase()&&(r=o.slice(s+1).trim())}return r}async function Yg(e,t){let r=[],n=[],o=(v,k,x)=>r.push({label:v,status:k,detail:x}),s=Number(e.nodeVersion.replace(/^v/,"").split(".")[0]);Number.isFinite(s)&&s<Tc?(o("Node version","fail",`${e.nodeVersion} \u2014 gigabuddy needs Node ${Tc} or newer`),n.push(`Upgrade Node to ${Tc}+ \u2014 nothing below that is supported.`)):o("Node version","ok",e.nodeVersion);let i=e.loadCredentials(!1)??e.loadCredentials(!0);if(!i)return o("Signed in","fail","no credentials found"),n.push("Run `gigabuddy login --npm` \u2014 you are not signed in, so the registry cannot know who you are."),{checks:r,advice:n};let a={label:"Signed in",status:"ok",detail:i.userEmail??i.userId};r.push(a);let c=null;try{c=await new kr({refreshToken:i.refreshToken,authUrl:i.authUrl,fetchImpl:e.fetchImpl}).getToken();let v=Ln(c);v&&(a.detail=v),o("Session","ok","live")}catch(v){o("Session","fail",`not accepted by auth \u2014 ${v instanceof Error?v.message:String(v)}`),n.push("Run `gigabuddy login` \u2014 your session was revoked or expired, so every credential from it is dead.")}let u=e.readNpmrc(),l=Ec(u,`${Pc}:registry`);l?o(`${Pc} registry`,"ok",l):(o(`${Pc} registry`,"fail",`not set in ${Ee()}`),n.push("Run `gigabuddy login --npm` \u2014 npm has no registry configured for @gigabuddy packages."));let p=l?Ft(l):null,m=p?Ec(u,p):null;if(l&&!m)o("Registry credential","fail",`no ${p} in ${Ee()}`),n.push("Run `gigabuddy login --npm` \u2014 the registry is configured but has no credential to authenticate with.");else if(m){let v=yk(m);v&&v.getTime()<Date.now()?(o("Registry credential","fail",`expired ${v.toISOString().slice(0,10)}`),n.push("Run `gigabuddy login --npm` \u2014 your npm credential expired. They are long-lived, not permanent.")):o("Registry credential","ok",v?`valid until ${v.toISOString().slice(0,10)}`:"present")}{let v={...i.userId?{userId:i.userId}:{},...a.detail?{email:a.detail}:{},...zc(c)??{}},k=Mg({self:v,npmrc:u,npmrcLabel:Ee(),claudeConfig:e.readClaudeConfig(),projectDir:e.projectDir});for(let S of k.mismatches)o("Same account everywhere","fail",`${S.source} is ${Sr(S.principal)}`),n.push(`Your login is ${Sr(v)} but ${S.source} was minted as ${Sr(S.principal)} \u2014 work through npm and work through the plugin land on different humans. Re-run \`${S.fix}\` so every credential on this machine is the same account.`);let x=k.secondDoors.filter(S=>S.kind==="claude.ai");x.length>0&&(o("One Gigabuddy door in Claude Code","warn",x.map(S=>S.name).join(", ")+" was connected before and is not disabled here"),n.push(`Claude Code has connected ${x.map(S=>`\`${S.name}\``).join(" and ")} before and it is not disabled for ${e.projectDir} \u2014 if it still shows in Claude Code's /mcp it runs alongside the gigabuddy plugin. That connector acts as a grant agent sponsored by whoever consented on claude.ai \u2014 not necessarily ${Sr(v)} \u2014 so work through both doors splits across two humans. Uncheck it in /mcp, or use only one door per session.`)),k.mismatches.length===0&&x.length===0&&o("Same account everywhere","ok",Sr(v))}let f=e.shadowingNpmrcFiles().filter(v=>es(v.contents,l??"")),g=m,_=Ee();if(f.length>0){let v=f[0],k=p?Ec(v.contents,p):null;k&&(g=k,_=v.path),o("Other .npmrc files","fail",`${v.path} also configures this registry`),n.push(`${v.path} sets a credential for this registry, and npm prefers it over ${Ee()} \u2014 so the credential you just minted is not the one being sent. Delete that file's \`_authToken\` line (or the file), then install again. This is usually a leftover from configuring the registry by hand before \`login --npm\` existed.`)}let y=e.npmEffectiveRegistry();if(y&&l&&y.replace(/\/+$/,"")!==l.replace(/\/+$/,"")?(o("npm resolves @gigabuddy to","fail",`${y} \u2014 NOT what we configured`),n.push(`Something is overriding your user-level .npmrc \u2014 most often a project .npmrc, or an npm_config_ env var. npm is sending @gigabuddy installs to ${y}.`)):y&&o("npm resolves @gigabuddy to","ok",y),l&&g){let v=l.replace(/\/+$/,""),k=_===Ee()?"":` (using the credential from ${_})`;try{let x=await e.fetchImpl(`${v}/-/ping`,{headers:{authorization:`Bearer ${g}`}});x.ok?o("Registry reachable","ok",`${v}${k}`):x.status===401?(o("Registry reachable","fail",`reachable, but rejected the credential (401)${k}`),n.push(_===Ee()?"Run `gigabuddy login --npm` \u2014 the registry did not accept your credential.":`The registry rejected the credential in ${_}. That file is the problem, not your login.`)):o("Registry reachable","warn",`responded ${x.status}`)}catch(x){o("Registry reachable","fail",`cannot reach ${v} \u2014 ${x instanceof Error?x.message:String(x)}`),n.push("Check your network or proxy \u2014 the registry is unreachable from here.")}if(t)try{let x=await e.fetchImpl(`${v}/${t.replace("/","%2F")}`,{headers:{authorization:`Bearer ${g}`}});x.ok?o(`Access to ${t}`,"ok","you can install it"):x.status===404?(o(`Access to ${t}`,"fail","the registry will not serve it to you"),n.push(`The registry answers "no such package" for ${t}. That single answer covers BOTH "this name does not exist" and "you do not have access" \u2014 deliberately, so private names stay private. Everything else above is healthy, so: check the spelling first, and if it is right, ask whoever owns the package to grant you access.`)):x.status===401?o(`Access to ${t}`,"fail","credential rejected (401)"):o(`Access to ${t}`,"warn",`registry responded ${x.status}`)}catch(x){o(`Access to ${t}`,"fail",x instanceof Error?x.message:String(x))}}return{checks:r,advice:n}}var vk={ok:"\u2713",warn:"!",fail:"\u2717",skip:"-"};function Qg(e,t){let r=(i,a)=>t?`\x1B[${i}m${a}\x1B[0m`:a,n={ok:"32",warn:"33",fail:"31",skip:"90"},o=Math.max(...e.checks.map(i=>i.label.length)),s=e.checks.map(i=>` ${r(n[i.status],vk[i.status])} ${i.label.padEnd(o)} ${i.detail??""}`.trimEnd());if(e.advice.length===0)return s.push("",` ${r("32","Everything checks out.")}`),s.join(`
81
81
  `);s.push("",r("1"," What to do:"));for(let i of e.advice){let a=i.replace(/(.{1,74})(\s|$)/g,`$1
82
82
  `).trimEnd().split(`
83
83
  `);s.push(` \u2022 ${a[0]}`);for(let c of a.slice(1))s.push(` ${c}`)}return s.join(`
84
- `)}var Nk=["agent:spawn","discovery:read","packages:read"],Ue="user",Ak="https://auth.gigabuddy.com",jk="https://api.gigabuddy.com",Zk="https://auth.staging.gigabuddy.com",Dk="https://api.staging.gigabuddy.com";function EN(e){let t=e.staging??!1;return{staging:t,authUrl:e.authUrl??(t?Zk:Ak),apiUrl:e.apiUrl??(t?Dk:jk)}}function Ng(e){try{return bc(e,"utf-8")}catch{return""}}function _(e=""){console.error(e)}function kr(e){return e?(Lt(e),{name:e,source:"env"}):mt()}function Yo(e){return e===Et?"":` (account: ${e})`}async function Ag(e,t){let r=kr(t).name;_(`Signing in to ${e.staging?"Gigabuddy Staging":"Gigabuddy"}${Yo(r)}\u2026`);let n=await hg({authUrl:e.authUrl,apiUrl:e.apiUrl,clientId:"gigabuddy-cli",scopes:Nk,onPrompt:({verificationUrl:s,userCode:i})=>{_(),_(` Open: ${s}`),_(` Code: ${i}`),_()},onPending:()=>process.stderr.write(".")}),o={refreshToken:n.refreshToken,userId:n.userId,userEmail:n.userEmail,authUrl:e.authUrl,apiUrl:e.apiUrl,createdAt:new Date().toISOString()};return is(o,e.staging,Ue,r),o}async function RN(e,t={}){let r=kr(t.account).name,n=await Ag(e,r);_(),_(" Signed in."),n.userEmail&&_(` Account: ${n.userEmail}${Yo(r)}`),_(` Saved to: ${Rr(e.staging,Ue,r)}`),t.account&&await Mk(t.account),_(),_(` To install ${Be} packages from the Gigabuddy registry: gigabuddy login --npm`)}async function Mk(e){let t=mt();if(t.name===e)return;let r=ss(process.cwd());if(process.stdin.isTTY!==!0||process.stderr.isTTY!==!0){_(),_(` This directory resolves account "${t.name}". To use ${e} here: gigabuddy use ${e}`);return}_();let n=Cg.createInterface({input:process.stdin,output:process.stderr});try{let o=(await n.question(` Always use "${e}" in ${r}? [Y/n] `)).trim().toLowerCase();o===""||o==="y"||o==="yes"?(os(r,e),_(` Pinned. Everything under this repo (worktrees included) now signs as ${e}.`)):_(` Left unpinned \u2014 this login is saved, and \`gigabuddy use ${e}\` pins it later.`)}finally{n.close()}}function jg(e){if(e<=0)return"";let t=Math.round(e/86400);return t>=1?` (valid ~${t} days)`:` (valid ${Math.round(e/3600)}h)`}async function IN(e,t){if(kg()){await qk(e);return}let r=kr(t).name,n=nt(e.staging,Ue,r),o=!n;if(n||(_("Not signed in yet \u2014 signing in first."),_(),n=await Ag(e,r),_(),_(" Signed in.")),!o){await Rg(n);return}try{await Rg(n)}catch(s){_(),_(` \u26A0 Signed in, but npm setup failed: ${s instanceof Error?s.message:String(s)}`),_(" You are signed in \u2014 retry just that half with: gigabuddy login --npm"),process.exitCode=1}}async function Rg(e){let t=await wg({authUrl:e.authUrl,refreshToken:e.refreshToken}),r=gc(t);_(),_(` npm is set up for ${Be} packages${jg(t.expiresIn)}`),_(` Registry: ${t.registryUrl}`),_(` Written to: ${r}`),_(),_(` Try it: npm install ${Be}/app-kit`),_(),_(" This credential is registry-only \u2014 it installs what you can install and nothing else."),_(" Run this again when it expires, or after your access changes.");let n=_c(process.cwd()).filter(o=>Wo(Ng(o),t.registryUrl));n.length>0&&(_(),_(` \u26A0 ${n[0]} also configures this registry, and npm prefers it over ${r}.`),_(" Installs will keep using THAT credential, not this one. Delete its _authToken line."))}async function qk(e){_("GitHub Actions detected \u2014 using the job\u2019s OIDC identity (no sign-in, nothing stored).");let t=await Sg(),r=await Pg({authUrl:e.authUrl,idToken:t}),n=gc(r);_(),_(` npm is set up for ${Be} packages as ${r.repository}\u2019s CI${jg(r.expiresIn)}`),_(` Registry: ${r.registryUrl}`),_(` Written to: ${n}`),r.bindings.length>0&&_(` Sponsored by ${r.bindings.length} room(s): ${r.bindings.map(o=>o.placeId).join(", ")}`),_(),_(" This credential is registry-only and expires with the job. Run it again in any later job that installs.")}function Uk(e,t){let r=nt(e,Ue,kr(t).name),n=process.env.GIGABUDDY_NPM_REGISTRY_URL;return n||(r?.authUrl.includes("staging")?"https://npm.staging.gigabuddy.com":"https://npm.gigabuddy.com")}function Lk(e,t){let r=zg(Uk(e.staging,t));if(!r){_(`No ${Be} registry entries found in ${Pe()}`);return}_(`Removed ${Be} registry credentials from ${r}`)}async function ON(e,t){let r=kr(t).name,n=nt(e.staging,Ue,r);if(Lk(e,r),!n){_(`Not signed in${Yo(r)}.`);return}let o=await bg({authUrl:n.authUrl,refreshToken:n.refreshToken});Nc(e.staging,Ue,r),o?_(`Signed out${e.staging?" of staging":""}. Any npm credential from this session stops working shortly.`):(_(`Signed out locally${e.staging?" of staging":""} \u2014 but could not reach the server to revoke the session.`),_(" Credentials already copied elsewhere may keep working. Sign out again when you are back online,"),_(" or revoke the session from your account settings."))}async function xc(e,t,r){if(e.userEmail)return e.userEmail;try{let n=await new zr({refreshToken:e.refreshToken,authUrl:e.authUrl}).getToken(),o=Mn(n);return o?(is({...e,userEmail:o},t,Ue,r),o):e.userId}catch{return e.userId}}async function CN(e,t){let r=await Tg({readNpmrc:()=>{try{return bc(Pe(),"utf-8")}catch{return""}},npmEffectiveRegistry:()=>{try{let o=Ig("npm",["config","get",`${Be}:registry`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();return o&&o!=="undefined"&&o!=="null"?o:null}catch{return null}},shadowingNpmrcFiles:()=>_c(process.cwd()).map(o=>({path:o,contents:Ng(o)})),fetchImpl:fetch,nodeVersion:process.version,loadCredentials:o=>nt(o,Ue),readClaudeConfig:()=>{try{return JSON.parse(bc(Ck(Ok(),".claude.json"),"utf-8"))}catch{return null}},projectDir:process.cwd()},t),n=process.stderr.isTTY===!0&&!process.env.NO_COLOR;_(),_(Eg(r,n)),_(),r.advice.length>0&&(process.exitCode=1)}var zc="gigabuddy/claude-plugin",wc="gigabuddy@gigabuddy",Zg={runClaude(e){let t=Og("claude",e,{stdio:["ignore","inherit","inherit"]});if(t.error&&t.error.code==="ENOENT")return"missing";if(t.error)throw t.error;return t.status??1}};function NN(e=Zg){_("Setting up Gigabuddy for Claude Code\u2026"),_();let t=e.runClaude(["plugin","marketplace","add",zc]);if(t==="missing"){_(" Could not find the `claude` command on this machine."),_(" If Claude Code is installed, run these inside any Claude Code session instead:"),_(),_(` /plugin marketplace add ${zc}`),_(` /plugin install ${wc}`),_(),_(" Then restart Claude Code."),process.exitCode=1;return}if(t!==0){_(),_(" \u26A0 Adding the Gigabuddy marketplace failed (see above). Nothing else was changed."),process.exitCode=1;return}if(e.runClaude(["plugin","install",wc])!==0){_(),_(" \u26A0 Installing the plugin failed (see above). The marketplace was added \u2014 retry with:"),_(),_(` claude plugin install ${wc}`),process.exitCode=1;return}_(),_(" Gigabuddy is installed. Next:"),_(),_(" 1. Restart Claude Code so the plugin loads."),_(" 2. Ask your session to sign you in and connect you to a room."),_(' (Several identities on this machine? Say which: "sign in as my work account".)')}function kc(e){switch(e.source){case"env":return"from GIGABUDDY_ACCOUNT";case"pin":return`pinned at ${e.pinnedAt}`;case"config-default":return"your default account";case"fallback":return""}}var Fk={latestVersion(){try{return Ig("npm",["view","gigabuddy","version"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()||null}catch{return null}},installLatest(){return Og("npm",["install","-g","gigabuddy@latest"],{stdio:["ignore","inherit","inherit"]}).status??1},refreshPlugin(){return Zg.runClaude(["plugin","marketplace","add",zc])}};async function AN(e,t=Fk){let r=t.latestVersion();if(!r){_("Could not reach npm to check for a newer version \u2014 are you online?"),process.exitCode=1;return}if(r===e)_(`gigabuddy v${e} is already the latest.`);else{if(_(`Updating gigabuddy v${e} \u2192 v${r}\u2026`),t.installLatest()!==0){_(),_(" \u26A0 npm install failed (see above). Try: npm install -g gigabuddy@latest"),process.exitCode=1;return}_(` Updated to v${r}.`)}t.refreshPlugin()===0&&_(" Claude Code plugin refreshed (restart Claude Code to pick up a new version)."),_(" The in-session agent (@gigabuddy/agent) updates itself on each launch.")}async function jN(e){let t=kr(e),r=nt(!1,Ue,t.name),n=nt(!0,Ue,t.name),o=Un().length>1||t.name!==Et;if(o){let s=kc(t);_(`Account: ${t.name}${s?` (${s})`:""}`),_()}if(!r&&!n){_(`Not signed in${o?Yo(t.name):""}.`),_(),_(" gigabuddy login");return}for(let[s,i,a]of[["Production",r,!1],["Staging",n,!0]])i&&(_(`${s}:`),_(` Account: ${await xc(i,a,t.name)}`),_(` Since: ${i.createdAt}`))}async function ZN(){let e=mt(),t=Ft(),r=Un();r.includes(e.name)||r.push(e.name),_("Accounts:");for(let o of r){let s=nt(!1,Ue,o),i=nt(!0,Ue,o),a=s?await xc(s,!1,o):i?`${await xc(i,!0,o)} (staging only)`:"not signed in",c=[];o===e.name&&c.push("active here"),o===(t.defaultAccount??Et)&&c.push("default"),_(` ${o===e.name?"*":" "} ${o} \u2014 ${a}${c.length?` [${c.join(", ")}]`:""}`)}let n=kc(e);n&&(_(),_(` Active account here: ${e.name} \u2014 ${n}`)),_(),_(" gigabuddy login --account <name> sign an account in"),_(" gigabuddy use <name> use an account for this repo"),_(" gigabuddy use --default <name> make an account the machine default")}function DN(e,t={},r=process.cwd()){let n=ss(r);if(t.unpin){_(Oc(n)?`Unpinned ${n}.`:`No pin on ${n}.`);return}if(!e){let o=mt(r),s=kc(o);_(`Active account here: ${o.name}${s?` (${s})`:""}`),_(),_(" gigabuddy use <name> pin this repo to an account"),_(" gigabuddy use --unpin remove this repo's pin");return}if(Lt(e),Un().includes(e)||_(`Note: no account "${e}" exists yet \u2014 sign it in with: gigabuddy login --account ${e}`),t.default){Ic(e),_(`Default account is now ${e}.`);return}os(n,e),_(`Pinned ${n} \u2192 ${e}.`),_("Everything under it (worktrees included) now signs as this account.")}export{jk as PRODUCTION_API_URL,Ak as PRODUCTION_AUTH_URL,Dk as STAGING_API_URL,Zk as STAGING_AUTH_URL,ZN as accountsCommand,kr as activeAccount,CN as doctorCommand,RN as loginCommand,ON as logoutCommand,IN as npmLoginCommand,Lk as npmLogoutCommand,EN as resolveEnv,NN as setupCommand,Ag as signIn,jN as statusCommand,AN as updateCommand,DN as useCommand};
84
+ `)}var bk=["agent:spawn","discovery:read","packages:read"],Fe="user",xk="https://auth.gigabuddy.com",zk="https://api.gigabuddy.com",Sk="https://auth.staging.gigabuddy.com",kk="https://api.staging.gigabuddy.com";function _N(e){let t=e.staging??!1;return{staging:t,authUrl:e.authUrl??(t?Sk:xk),apiUrl:e.apiUrl??(t?kk:zk)}}function n_(e){try{return Ic(e,"utf-8")}catch{return""}}function $(e=""){console.error(e)}function Pr(e){return e?(Vt(e),{name:e,source:"env"}):mt()}function ts(e){return e===Et?"":` (account: ${e})`}async function o_(e,t){let r=Pr(t).name;$(`Signing in to ${e.staging?"Gigabuddy Staging":"Gigabuddy"}${ts(r)}\u2026`);let n=await Dg({authUrl:e.authUrl,apiUrl:e.apiUrl,clientId:"gigabuddy-cli",scopes:bk,onPrompt:({verificationUrl:s,userCode:i})=>{$(),$(` Open: ${s}`),$(` Code: ${i}`),$()},onPending:()=>process.stderr.write(".")}),o={refreshToken:n.refreshToken,userId:n.userId,userEmail:n.userEmail,authUrl:e.authUrl,apiUrl:e.apiUrl,createdAt:new Date().toISOString()};return ls(o,e.staging,Fe,r),o}async function yN(e,t={}){let r=Pr(t.account).name,n=await o_(e,r);$(),$(" Signed in."),n.userEmail&&$(` Account: ${n.userEmail}${ts(r)}`),$(` Saved to: ${Or(e.staging,Fe,r)}`),t.account&&await Pk(t.account),$(),$(` To install ${Ye} packages from the Gigabuddy registry: gigabuddy login --npm`)}async function Pk(e){let t=mt();if(t.name===e)return;let r=us(process.cwd());if(process.stdin.isTTY!==!0||process.stderr.isTTY!==!0){$(),$(` This directory resolves account "${t.name}". To use ${e} here: gigabuddy use ${e}`);return}$();let n=r_.createInterface({input:process.stdin,output:process.stderr});try{let o=(await n.question(` Always use "${e}" in ${r}? [Y/n] `)).trim().toLowerCase();o===""||o==="y"||o==="yes"?(cs(r,e),$(` Pinned. Everything under this repo (worktrees included) now signs as ${e}.`)):$(` Left unpinned \u2014 this login is saved, and \`gigabuddy use ${e}\` pins it later.`)}finally{n.close()}}function s_(e){if(e<=0)return"";let t=Math.round(e/86400);if(t>=1)return` (valid ~${t} days)`;let r=Math.round(e/3600);return r>=1?` (valid ${r}h)`:` (valid ${Math.max(1,Math.round(e/60))}m)`}async function vN(e,t){if(Bg()){await Tk(e);return}let r=Pr(t).name,n=ot(e.staging,Fe,r),o=!n;if(n||($("Not signed in yet \u2014 signing in first."),$(),n=await o_(e,r),$(),$(" Signed in.")),!o){await Xg(n);return}try{await Xg(n)}catch(s){$(),$(` \u26A0 Signed in, but npm setup failed: ${s instanceof Error?s.message:String(s)}`),$(" You are signed in \u2014 retry just that half with: gigabuddy login --npm"),process.exitCode=1}}async function Xg(e){let t=await Vg({authUrl:e.authUrl,refreshToken:e.refreshToken}),r=Sc(t);$(),$(` npm is set up for ${Ye} packages${s_(t.expiresIn)}`),$(` Registry: ${t.registryUrl}`),$(` Written to: ${r}`),$(),$(` Try it: npm install ${Ye}/app-kit`),$(),$(" This credential is registry-only \u2014 it installs what you can install and nothing else."),$(" Run this again when it expires, or after your access changes.");let n=kc(process.cwd()).filter(o=>es(n_(o),t.registryUrl));n.length>0&&($(),$(` \u26A0 ${n[0]} also configures this registry, and npm prefers it over ${r}.`),$(" Installs will keep using THAT credential, not this one. Delete its _authToken line."))}async function Tk(e){$("GitHub Actions detected \u2014 using the job\u2019s OIDC identity (no sign-in, nothing stored).");let t=await Gg(),r=await Wg({authUrl:e.authUrl,idToken:t}),n=Sc(r);$(),$(` npm is set up for ${Ye} packages as ${r.repository}\u2019s CI${s_(r.expiresIn)}`),$(` Registry: ${r.registryUrl}`),$(` Written to: ${n}`),r.bindings.length>0&&$(` Sponsored by ${r.bindings.length} room(s): ${r.bindings.map(o=>o.placeId).join(", ")}`),$(),$(" This credential is registry-only and expires with the job. Run it again in any later job that installs.")}function Ek(e,t){let r=ot(e,Fe,Pr(t).name),n=process.env.GIGABUDDY_NPM_REGISTRY_URL;return n||(r?.authUrl.includes("staging")?"https://npm.staging.gigabuddy.com":"https://npm.gigabuddy.com")}function Rk(e,t){let r=Kg(Ek(e.staging,t));if(!r){$(`No ${Ye} registry entries found in ${Ee()}`);return}$(`Removed ${Ye} registry credentials from ${r}`)}async function $N(e,t){let r=Pr(t).name,n=ot(e.staging,Fe,r);if(Rk(e,r),!n){$(`Not signed in${ts(r)}.`);return}let o=await Hg({authUrl:n.authUrl,refreshToken:n.refreshToken});Fc(e.staging,Fe,r),o?$(`Signed out${e.staging?" of staging":""}. Any npm credential from this session stops working shortly.`):($(`Signed out locally${e.staging?" of staging":""} \u2014 but could not reach the server to revoke the session.`),$(" Credentials already copied elsewhere may keep working. Sign out again when you are back online,"),$(" or revoke the session from your account settings."))}async function Oc(e,t,r){if(e.userEmail)return e.userEmail;try{let n=await new kr({refreshToken:e.refreshToken,authUrl:e.authUrl}).getToken(),o=Ln(n);return o?(ls({...e,userEmail:o},t,Fe,r),o):e.userId}catch{return e.userId}}async function wN(e,t){let r=await Yg({readNpmrc:()=>{try{return Ic(Ee(),"utf-8")}catch{return""}},npmEffectiveRegistry:()=>{try{let o=e_("npm",["config","get",`${Ye}:registry`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();return o&&o!=="undefined"&&o!=="null"?o:null}catch{return null}},shadowingNpmrcFiles:()=>kc(process.cwd()).map(o=>({path:o,contents:n_(o)})),fetchImpl:fetch,nodeVersion:process.version,loadCredentials:o=>ot(o,Fe),readClaudeConfig:()=>{try{return JSON.parse(Ic(wk($k(),".claude.json"),"utf-8"))}catch{return null}},projectDir:process.cwd()},t),n=process.stderr.isTTY===!0&&!process.env.NO_COLOR;$(),$(Qg(r,n)),$(),r.advice.length>0&&(process.exitCode=1)}var Cc="gigabuddy/claude-plugin",Rc="gigabuddy@gigabuddy",i_={runClaude(e){let t=t_("claude",e,{stdio:["ignore","inherit","inherit"]});if(t.error&&t.error.code==="ENOENT")return"missing";if(t.error)throw t.error;return t.status??1}};function bN(e=i_){$("Setting up Gigabuddy for Claude Code\u2026"),$();let t=e.runClaude(["plugin","marketplace","add",Cc]);if(t==="missing"){$(" Could not find the `claude` command on this machine."),$(" If Claude Code is installed, run these inside any Claude Code session instead:"),$(),$(` /plugin marketplace add ${Cc}`),$(` /plugin install ${Rc}`),$(),$(" Then restart Claude Code."),process.exitCode=1;return}if(t!==0){$(),$(" \u26A0 Adding the Gigabuddy marketplace failed (see above). Nothing else was changed."),process.exitCode=1;return}if(e.runClaude(["plugin","install",Rc])!==0){$(),$(" \u26A0 Installing the plugin failed (see above). The marketplace was added \u2014 retry with:"),$(),$(` claude plugin install ${Rc}`),process.exitCode=1;return}$(),$(" Gigabuddy is installed. Next:"),$(),$(" 1. Restart Claude Code so the plugin loads."),$(" 2. Ask your session to sign you in and connect you to a room."),$(' (Several identities on this machine? Say which: "sign in as my work account".)')}function Nc(e){switch(e.source){case"env":return"from GIGABUDDY_ACCOUNT";case"pin":return`pinned at ${e.pinnedAt}`;case"config-default":return"your default account";case"fallback":return""}}var Ik={latestVersion(){try{return e_("npm",["view","gigabuddy","version"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()||null}catch{return null}},installLatest(){return t_("npm",["install","-g","gigabuddy@latest"],{stdio:["ignore","inherit","inherit"]}).status??1},refreshPlugin(){return i_.runClaude(["plugin","marketplace","add",Cc])}};async function xN(e,t=Ik){let r=t.latestVersion();if(!r){$("Could not reach npm to check for a newer version \u2014 are you online?"),process.exitCode=1;return}if(r===e)$(`gigabuddy v${e} is already the latest.`);else{if($(`Updating gigabuddy v${e} \u2192 v${r}\u2026`),t.installLatest()!==0){$(),$(" \u26A0 npm install failed (see above). Try: npm install -g gigabuddy@latest"),process.exitCode=1;return}$(` Updated to v${r}.`)}t.refreshPlugin()===0&&$(" Claude Code plugin refreshed (restart Claude Code to pick up a new version)."),$(" The in-session agent (@gigabuddy/agent) updates itself on each launch.")}async function zN(e){let t=Pr(e),r=ot(!1,Fe,t.name),n=ot(!0,Fe,t.name),o=Vn().length>1||t.name!==Et;if(o){let s=Nc(t);$(`Account: ${t.name}${s?` (${s})`:""}`),$()}if(!r&&!n){$(`Not signed in${o?ts(t.name):""}.`),$(),$(" gigabuddy login");return}for(let[s,i,a]of[["Production",r,!1],["Staging",n,!0]])i&&($(`${s}:`),$(` Account: ${await Oc(i,a,t.name)}`),$(` Since: ${i.createdAt}`))}async function SN(){let e=mt(),t=Ht(),r=Vn();r.includes(e.name)||r.push(e.name),$("Accounts:");for(let o of r){let s=ot(!1,Fe,o),i=ot(!0,Fe,o),a=s?await Oc(s,!1,o):i?`${await Oc(i,!0,o)} (staging only)`:"not signed in",c=[];o===e.name&&c.push("active here"),o===(t.defaultAccount??Et)&&c.push("default"),$(` ${o===e.name?"*":" "} ${o} \u2014 ${a}${c.length?` [${c.join(", ")}]`:""}`)}let n=Nc(e);n&&($(),$(` Active account here: ${e.name} \u2014 ${n}`)),$(),$(" gigabuddy login --account <name> sign an account in"),$(" gigabuddy use <name> use an account for this repo"),$(" gigabuddy use --default <name> make an account the machine default")}function kN(e,t={},r=process.cwd()){let n=us(r);if(t.unpin){$(Uc(n)?`Unpinned ${n}.`:`No pin on ${n}.`);return}if(!e){let o=mt(r),s=Nc(o);$(`Active account here: ${o.name}${s?` (${s})`:""}`),$(),$(" gigabuddy use <name> pin this repo to an account"),$(" gigabuddy use --unpin remove this repo's pin");return}if(Vt(e),Vn().includes(e)||$(`Note: no account "${e}" exists yet \u2014 sign it in with: gigabuddy login --account ${e}`),t.default){qc(e),$(`Default account is now ${e}.`);return}cs(n,e),$(`Pinned ${n} \u2192 ${e}.`),$("Everything under it (worktrees included) now signs as this account.")}export{zk as PRODUCTION_API_URL,xk as PRODUCTION_AUTH_URL,kk as STAGING_API_URL,Sk as STAGING_AUTH_URL,SN as accountsCommand,Pr as activeAccount,wN as doctorCommand,yN as loginCommand,$N as logoutCommand,vN as npmLoginCommand,Rk as npmLogoutCommand,_N as resolveEnv,bN as setupCommand,o_ as signIn,zN as statusCommand,xN as updateCommand,kN as useCommand};
85
85
  //# sourceMappingURL=index.js.map