gigabuddy 0.8.1 → 0.8.3
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/bin/cli.js +23 -23
- package/index.js +15 -15
- package/package.json +1 -1
- package/src/lib/commands.d.ts +8 -0
package/bin/cli.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var Hy=Object.create;var hs=Object.defineProperty;var Jy=Object.getOwnPropertyDescriptor;var Ky=Object.getOwnPropertyNames;var Gy=Object.getPrototypeOf,By=Object.prototype.hasOwnProperty;var z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),gs=(e,t)=>{for(var r in t)hs(e,r,{get:t[r],enumerable:!0})},Wy=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ky(t))!By.call(e,o)&&o!==r&&hs(e,o,{get:()=>t[o],enumerable:!(n=Jy(t,o))||n.enumerable});return e};var Yy=(e,t,r)=>(r=e!=null?Hy(Gy(e)):{},Wy(t||!e||!e.__esModule?hs(r,"default",{value:e,enumerable:!0}):r,e));var sn=z(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.regexpCode=U.getEsmExportName=U.getProperty=U.safeStringify=U.stringify=U.strConcat=U.addCodeArg=U.str=U._=U.nil=U._Code=U.Name=U.IDENTIFIER=U._CodeOrName=void 0;var nn=class{};U._CodeOrName=nn;U.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Nt=class extends nn{constructor(t){if(super(),!U.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}}};U.Name=Nt;var qe=class extends nn{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 Nt&&(r[n.str]=(r[n.str]||0)+1),r),{})}};U._Code=qe;U.nil=new qe("");function rm(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Mi(r,t[n]),r.push(e[++n]);return new qe(r)}U._=rm;var Di=new qe("+");function nm(e,...t){let r=[on(e[0])],n=0;for(;n<t.length;)r.push(Di),Mi(r,t[n]),r.push(Di,on(e[++n]));return kb(r),new qe(r)}U.str=nm;function Mi(e,t){t instanceof qe?e.push(...t._items):t instanceof Nt?e.push(t):e.push(Eb(t))}U.addCodeArg=Mi;function kb(e){let t=1;for(;t<e.length-1;){if(e[t]===Di){let r=Sb(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function Sb(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Nt||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 Nt))return`"${e}${t.slice(1)}`}function Pb(e,t){return t.emptyStr()?e:e.emptyStr()?t:nm`${e}${t}`}U.strConcat=Pb;function Eb(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:on(Array.isArray(e)?e.join(","):e)}function Tb(e){return new qe(on(e))}U.stringify=Tb;function on(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}U.safeStringify=on;function Rb(e){return typeof e=="string"&&U.IDENTIFIER.test(e)?new qe(`.${e}`):rm`[${e}]`}U.getProperty=Rb;function Ib(e){if(typeof e=="string"&&U.IDENTIFIER.test(e))return new qe(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}U.getEsmExportName=Ib;function Cb(e){return new qe(e.toString())}U.regexpCode=Cb});var Li=z(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.ValueScope=Se.ValueScopeName=Se.Scope=Se.varKinds=Se.UsedValueState=void 0;var ke=sn(),Ui=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},xo;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(xo||(Se.UsedValueState=xo={}));Se.varKinds={const:new ke.Name("const"),let:new ke.Name("let"),var:new ke.Name("var")};var zo=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof ke.Name?t:this.name(t)}name(t){return new ke.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=zo;var ko=class extends ke.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,ke._)`.${new ke.Name(r)}[${n}]`}};Se.ValueScopeName=ko;var Ob=(0,ke._)`\n`,qi=class extends zo{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?Ob:ke.nil}}get(){return this._scope}name(t){return new ko(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,ke._)`${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=ke.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,xo.Started);let l=r(u);if(l){let d=this.opts.es5?Se.varKinds.var:Se.varKinds.const;s=(0,ke._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,ke._)`${s}${l}${this.opts._n}`;else throw new Ui(u);c.set(u,xo.Completed)})}return s}};Se.ValueScope=qi});var O=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=sn(),Ge=Li(),wt=sn();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return wt._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return wt.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return wt.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return wt.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return wt.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return wt.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return wt.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return wt.Name}});var To=Li();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return To.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return To.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return To.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return To.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 dt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Fi=class extends dt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?Ge.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=ar(this.rhs,t,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},So=class extends dt{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=ar(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return Eo(t,this.rhs)}},Vi=class extends So{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Hi=class extends dt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Ji=class extends dt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Ki=class extends dt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Gi=class extends dt{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=ar(this.code,t,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},an=class extends dt{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)||(Nb(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Zt(t,r.names),{})}},pt=class extends an{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Bi=class extends an{},ir=class extends pt{};ir.kind="else";var At=class e extends pt{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 ir(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(om(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=ar(this.condition,t,r),this}get names(){let t=super.names;return Eo(t,this.condition),this.else&&Zt(t,this.else.names),t}};At.kind="if";var jt=class extends pt{};jt.kind="for";var Wi=class extends jt{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=ar(this.iteration,t,r),this}get names(){return Zt(super.names,this.iteration.names)}},Yi=class extends jt{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?Ge.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=Eo(super.names,this.from);return Eo(t,this.to)}},Po=class extends jt{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=ar(this.iterable,t,r),this}get names(){return Zt(super.names,this.iterable.names)}},cn=class extends pt{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)}};cn.kind="func";var un=class extends an{render(t){return"return "+super.render(t)}};un.kind="return";var Qi=class extends pt{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&&Zt(t,this.catch.names),this.finally&&Zt(t,this.finally.names),t}},ln=class extends pt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};ln.kind="catch";var dn=class extends pt{render(t){return"finally"+super.render(t)}};dn.kind="finally";var Xi=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
-
`:""},this._extScope=t,this._scope=new Ge.Scope({parent:t}),this._nodes=[new Bi]}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 Fi(t,s,n)),s}const(t,r,n){return this._def(Ge.varKinds.const,t,r,n)}let(t,r,n){return this._def(Ge.varKinds.let,t,r,n)}var(t,r,n){return this._def(Ge.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new So(t,r,n))}add(t,r){return this._leafNode(new Vi(t,N.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Z.nil&&this._leafNode(new Gi(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 At(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 At(t))}else(){return this._elseNode(new ir)}endIf(){return this._endBlockNode(At,ir)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Wi(t),r)}forRange(t,r,n,o,s=this.opts.es5?Ge.varKinds.var:Ge.varKinds.let){let i=this._scope.toName(t);return this._for(new Yi(s,i,r,n),()=>o(i))}forOf(t,r,n,o=Ge.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 Po("of",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?Ge.varKinds.var:Ge.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 Po("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(jt)}label(t){return this._leafNode(new Hi(t))}break(t){return this._leafNode(new Ji(t))}return(t){let r=new un;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(un)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Qi;if(this._blockNode(o),this.code(t),r){let s=this.name("e");this._currNode=o.catch=new ln(s),r(s)}return n&&(this._currNode=o.finally=new dn,this.code(n)),this._endBlockNode(ln,dn)}throw(t){return this._leafNode(new Ki(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 cn(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(cn)}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 At))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=Xi;function Zt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Eo(e,t){return t instanceof Z._CodeOrName?Zt(e,t.names):e}function ar(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 Nb(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function om(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Z._)`!${ea(e)}`}N.not=om;var Ab=sm(N.operators.AND);function jb(...e){return e.reduce(Ab)}N.and=jb;var Zb=sm(N.operators.OR);function Db(...e){return e.reduce(Zb)}N.or=Db;function sm(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:(0,Z._)`${ea(t)} ${e} ${ea(r)}`}function ea(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=O(),Mb=sn();function Ub(e){let t={};for(let r of e)t[r]=!0;return t}A.toHash=Ub;function qb(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(cm(e,t),!um(t,e.self.RULES.all))}A.alwaysValidSchema=qb;function cm(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]||pm(e,`unknown keyword: "${s}"`)}A.checkUnknownRules=cm;function um(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}A.schemaHasRules=um;function Lb(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=Lb;function Fb({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=Fb;function Vb(e){return lm(decodeURIComponent(e))}A.unescapeFragment=Vb;function Hb(e){return encodeURIComponent(ra(e))}A.escapeFragment=Hb;function ra(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}A.escapeJsonPointer=ra;function lm(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}A.unescapeJsonPointer=lm;function Jb(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}A.eachItem=Jb;function im({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:im({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} || {}`),na(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:dm}),items:im({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 dm(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,K._)`{}`);return t!==void 0&&na(e,r,t),r}A.evaluatedPropsToName=dm;function na(e,t,r){Object.keys(r).forEach(n=>e.assign((0,K._)`${t}${(0,K.getProperty)(n)}`,!0))}A.setEvaluated=na;var am={};function Kb(e,t){return e.scopeValue("func",{ref:t,code:am[t.code]||(am[t.code]=new Mb._Code(t.code))})}A.useFunc=Kb;var ta;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(ta||(A.Type=ta={}));function Gb(e,t,r){if(e instanceof K.Name){let n=t===ta.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():"/"+ra(e)}A.getErrorPath=Gb;function pm(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=pm});var ft=z(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});var he=O(),Bb={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")};oa.default=Bb});var pn=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=O(),Ro=D(),we=ft();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 Wb(e,t=ge.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=hm(e,t,r);n??(i||a)?fm(s,c):mm(o,(0,M._)`[${c}]`)}ge.reportError=Wb;function Yb(e,t=ge.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=hm(e,t,r);fm(o,a),s||i||mm(n,we.default.vErrors)}ge.reportExtraError=Yb;function Qb(e,t){e.assign(we.default.errors,t),e.if((0,M._)`${we.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,M._)`${we.default.vErrors}.length`,t),()=>e.assign(we.default.vErrors,null)))}ge.resetErrorsCount=Qb;function Xb({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,we.default.errors,a=>{e.const(i,(0,M._)`${we.default.vErrors}[${a}]`),e.if((0,M._)`${i}.instancePath === undefined`,()=>e.assign((0,M._)`${i}.instancePath`,(0,M.strConcat)(we.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=Xb;function fm(e,t){let r=e.const("err",t);e.if((0,M._)`${we.default.vErrors} === null`,()=>e.assign(we.default.vErrors,(0,M._)`[${r}]`),(0,M._)`${we.default.vErrors}.push(${r})`),e.code((0,M._)`${we.default.errors}++`)}function mm(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 Dt={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 hm(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,M._)`{}`:e$(e,t,r)}function e$(e,t,r={}){let{gen:n,it:o}=e,s=[t$(o,r),r$(e,r)];return n$(e,t,s),n.object(...s)}function t$({errorPath:e},{instancePath:t}){let r=t?(0,M.str)`${e}${(0,Ro.getErrorPath)(t,Ro.Type.Str)}`:e;return[we.default.instancePath,(0,M.strConcat)(we.default.instancePath,r)]}function r$({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,Ro.getErrorPath)(r,Ro.Type.Str)}`),[Dt.schemaPath,o]}function n$(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Dt.keyword,o],[Dt.params,typeof t=="function"?t(e):t||(0,M._)`{}`]),c.messages&&n.push([Dt.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Dt.schema,i],[Dt.parentSchema,(0,M._)`${l}${d}`],[we.default.data,s]),u&&n.push([Dt.propertyName,u])}});var ym=z(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.boolOrEmptySchema=cr.topBoolOrEmptySchema=void 0;var o$=pn(),s$=O(),i$=ft(),a$={message:"boolean schema is false"};function c$(e){let{gen:t,schema:r,validateName:n}=e;r===!1?gm(e,!1):typeof r=="object"&&r.$async===!0?t.return(i$.default.data):(t.assign((0,s$._)`${n}.errors`,null),t.return(!0))}cr.topBoolOrEmptySchema=c$;function u$(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),gm(e)):r.var(t,!0)}cr.boolOrEmptySchema=u$;function gm(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,o$.reportError)(o,a$,void 0,t)}});var sa=z(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.getRules=ur.isJSONType=void 0;var l$=["string","number","integer","boolean","null","object","array"],d$=new Set(l$);function p$(e){return typeof e=="string"&&d$.has(e)}ur.isJSONType=p$;function f$(){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:{}}}ur.getRules=f$});var ia=z(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.shouldUseRule=bt.shouldUseGroup=bt.schemaHasRulesForType=void 0;function m$({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&_m(e,n)}bt.schemaHasRulesForType=m$;function _m(e,t){return t.rules.some(r=>vm(e,r))}bt.shouldUseGroup=_m;function vm(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))}bt.shouldUseRule=vm});var fn=z(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.reportTypeError=ye.checkDataTypes=ye.checkDataType=ye.coerceAndCheckDataType=ye.getJSONTypes=ye.getSchemaTypes=ye.DataType=void 0;var h$=sa(),g$=ia(),y$=pn(),C=O(),wm=D(),lr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(lr||(ye.DataType=lr={}));function _$(e){let t=bm(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}ye.getSchemaTypes=_$;function bm(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(h$.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}ye.getJSONTypes=bm;function v$(e,t){let{gen:r,data:n,opts:o}=e,s=w$(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,g$.schemaHasRulesForType)(e,t[0]));if(i){let a=ca(t,n,o.strictNumbers,lr.Wrong);r.if(a,()=>{s.length?b$(e,t,s):ua(e)})}return i}ye.coerceAndCheckDataType=v$;var $m=new Set(["string","number","integer","boolean","null"]);function w$(e,t){return t?e.filter(r=>$m.has(r)||t==="array"&&r==="array"):[]}function b$(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",(0,C._)`typeof ${o}`),a=n.let("coerced",(0,C._)`undefined`);s.coerceTypes==="array"&&n.if((0,C._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,C._)`${o}[0]`).assign(i,(0,C._)`typeof ${o}`).if(ca(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,C._)`${a} !== undefined`);for(let u of r)($m.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),ua(e),n.endIf(),n.if((0,C._)`${a} !== undefined`,()=>{n.assign(o,a),$$(e,a)});function c(u){switch(u){case"string":n.elseIf((0,C._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,C._)`"" + ${o}`).elseIf((0,C._)`${o} === null`).assign(a,(0,C._)`""`);return;case"number":n.elseIf((0,C._)`${i} == "boolean" || ${o} === null
|
|
2
|
+
var Ky=Object.create;var hs=Object.defineProperty;var Gy=Object.getOwnPropertyDescriptor;var By=Object.getOwnPropertyNames;var Wy=Object.getPrototypeOf,Yy=Object.prototype.hasOwnProperty;var z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),gs=(e,t)=>{for(var r in t)hs(e,r,{get:t[r],enumerable:!0})},Qy=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of By(t))!Yy.call(e,o)&&o!==r&&hs(e,o,{get:()=>t[o],enumerable:!(n=Gy(t,o))||n.enumerable});return e};var Xy=(e,t,r)=>(r=e!=null?Ky(Wy(e)):{},Qy(t||!e||!e.__esModule?hs(r,"default",{value:e,enumerable:!0}):r,e));var on=z(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.regexpCode=U.getEsmExportName=U.getProperty=U.safeStringify=U.stringify=U.strConcat=U.addCodeArg=U.str=U._=U.nil=U._Code=U.Name=U.IDENTIFIER=U._CodeOrName=void 0;var rn=class{};U._CodeOrName=rn;U.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var At=class extends rn{constructor(t){if(super(),!U.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}}};U.Name=At;var qe=class extends rn{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 At&&(r[n.str]=(r[n.str]||0)+1),r),{})}};U._Code=qe;U.nil=new qe("");function rm(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Mi(r,t[n]),r.push(e[++n]);return new qe(r)}U._=rm;var Di=new qe("+");function nm(e,...t){let r=[nn(e[0])],n=0;for(;n<t.length;)r.push(Di),Mi(r,t[n]),r.push(Di,nn(e[++n]));return Pb(r),new qe(r)}U.str=nm;function Mi(e,t){t instanceof qe?e.push(...t._items):t instanceof At?e.push(t):e.push(Rb(t))}U.addCodeArg=Mi;function Pb(e){let t=1;for(;t<e.length-1;){if(e[t]===Di){let r=Eb(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function Eb(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof At||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 At))return`"${e}${t.slice(1)}`}function Tb(e,t){return t.emptyStr()?e:e.emptyStr()?t:nm`${e}${t}`}U.strConcat=Tb;function Rb(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:nn(Array.isArray(e)?e.join(","):e)}function Ib(e){return new qe(nn(e))}U.stringify=Ib;function nn(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}U.safeStringify=nn;function Cb(e){return typeof e=="string"&&U.IDENTIFIER.test(e)?new qe(`.${e}`):rm`[${e}]`}U.getProperty=Cb;function Ob(e){if(typeof e=="string"&&U.IDENTIFIER.test(e))return new qe(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}U.getEsmExportName=Ob;function Ab(e){return new qe(e.toString())}U.regexpCode=Ab});var Li=z(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.ValueScope=Se.ValueScopeName=Se.Scope=Se.varKinds=Se.UsedValueState=void 0;var ke=on(),Ui=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},xo;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(xo||(Se.UsedValueState=xo={}));Se.varKinds={const:new ke.Name("const"),let:new ke.Name("let"),var:new ke.Name("var")};var zo=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof ke.Name?t:this.name(t)}name(t){return new ke.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=zo;var ko=class extends ke.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,ke._)`.${new ke.Name(r)}[${n}]`}};Se.ValueScopeName=ko;var Nb=(0,ke._)`\n`,qi=class extends zo{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?Nb:ke.nil}}get(){return this._scope}name(t){return new ko(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,ke._)`${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=ke.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,xo.Started);let l=r(u);if(l){let d=this.opts.es5?Se.varKinds.var:Se.varKinds.const;s=(0,ke._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,ke._)`${s}${l}${this.opts._n}`;else throw new Ui(u);c.set(u,xo.Completed)})}return s}};Se.ValueScope=qi});var O=z(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.or=A.and=A.not=A.CodeGen=A.operators=A.varKinds=A.ValueScopeName=A.ValueScope=A.Scope=A.Name=A.regexpCode=A.stringify=A.getProperty=A.nil=A.strConcat=A.str=A._=void 0;var Z=on(),Ge=Li(),wt=on();Object.defineProperty(A,"_",{enumerable:!0,get:function(){return wt._}});Object.defineProperty(A,"str",{enumerable:!0,get:function(){return wt.str}});Object.defineProperty(A,"strConcat",{enumerable:!0,get:function(){return wt.strConcat}});Object.defineProperty(A,"nil",{enumerable:!0,get:function(){return wt.nil}});Object.defineProperty(A,"getProperty",{enumerable:!0,get:function(){return wt.getProperty}});Object.defineProperty(A,"stringify",{enumerable:!0,get:function(){return wt.stringify}});Object.defineProperty(A,"regexpCode",{enumerable:!0,get:function(){return wt.regexpCode}});Object.defineProperty(A,"Name",{enumerable:!0,get:function(){return wt.Name}});var To=Li();Object.defineProperty(A,"Scope",{enumerable:!0,get:function(){return To.Scope}});Object.defineProperty(A,"ValueScope",{enumerable:!0,get:function(){return To.ValueScope}});Object.defineProperty(A,"ValueScopeName",{enumerable:!0,get:function(){return To.ValueScopeName}});Object.defineProperty(A,"varKinds",{enumerable:!0,get:function(){return To.varKinds}});A.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 dt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Fi=class extends dt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?Ge.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=cr(this.rhs,t,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},So=class extends dt{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=cr(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return Eo(t,this.rhs)}},Vi=class extends So{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Hi=class extends dt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Ji=class extends dt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Ki=class extends dt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Gi=class extends dt{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=cr(this.code,t,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},sn=class extends dt{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)||(jb(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Zt(t,r.names),{})}},pt=class extends sn{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Bi=class extends sn{},ar=class extends pt{};ar.kind="else";var Nt=class e extends pt{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 ar(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(om(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=cr(this.condition,t,r),this}get names(){let t=super.names;return Eo(t,this.condition),this.else&&Zt(t,this.else.names),t}};Nt.kind="if";var jt=class extends pt{};jt.kind="for";var Wi=class extends jt{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=cr(this.iteration,t,r),this}get names(){return Zt(super.names,this.iteration.names)}},Yi=class extends jt{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?Ge.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=Eo(super.names,this.from);return Eo(t,this.to)}},Po=class extends jt{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=cr(this.iterable,t,r),this}get names(){return Zt(super.names,this.iterable.names)}},an=class extends pt{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)}};an.kind="func";var cn=class extends sn{render(t){return"return "+super.render(t)}};cn.kind="return";var Qi=class extends pt{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&&Zt(t,this.catch.names),this.finally&&Zt(t,this.finally.names),t}},un=class extends pt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};un.kind="catch";var ln=class extends pt{render(t){return"finally"+super.render(t)}};ln.kind="finally";var Xi=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=t,this._scope=new Ge.Scope({parent:t}),this._nodes=[new Bi]}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 Fi(t,s,n)),s}const(t,r,n){return this._def(Ge.varKinds.const,t,r,n)}let(t,r,n){return this._def(Ge.varKinds.let,t,r,n)}var(t,r,n){return this._def(Ge.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new So(t,r,n))}add(t,r){return this._leafNode(new Vi(t,A.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Z.nil&&this._leafNode(new Gi(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 Nt(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 Nt(t))}else(){return this._elseNode(new ar)}endIf(){return this._endBlockNode(Nt,ar)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Wi(t),r)}forRange(t,r,n,o,s=this.opts.es5?Ge.varKinds.var:Ge.varKinds.let){let i=this._scope.toName(t);return this._for(new Yi(s,i,r,n),()=>o(i))}forOf(t,r,n,o=Ge.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 Po("of",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?Ge.varKinds.var:Ge.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 Po("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(jt)}label(t){return this._leafNode(new Hi(t))}break(t){return this._leafNode(new Ji(t))}return(t){let r=new cn;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(cn)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Qi;if(this._blockNode(o),this.code(t),r){let s=this.name("e");this._currNode=o.catch=new un(s),r(s)}return n&&(this._currNode=o.finally=new ln,this.code(n)),this._endBlockNode(un,ln)}throw(t){return this._leafNode(new Ki(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 an(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(an)}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 Nt))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}};A.CodeGen=Xi;function Zt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Eo(e,t){return t instanceof Z._CodeOrName?Zt(e,t.names):e}function cr(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 jb(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function om(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Z._)`!${ea(e)}`}A.not=om;var Zb=sm(A.operators.AND);function Db(...e){return e.reduce(Zb)}A.and=Db;var Mb=sm(A.operators.OR);function Ub(...e){return e.reduce(Mb)}A.or=Ub;function sm(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:(0,Z._)`${ea(t)} ${e} ${ea(r)}`}function ea(e){return e instanceof Z.Name?e:(0,Z._)`(${e})`}});var D=z(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.checkStrictMode=N.getErrorPath=N.Type=N.useFunc=N.setEvaluated=N.evaluatedPropsToName=N.mergeEvaluated=N.eachItem=N.unescapeJsonPointer=N.escapeJsonPointer=N.escapeFragment=N.unescapeFragment=N.schemaRefOrVal=N.schemaHasRulesButRef=N.schemaHasRules=N.checkUnknownRules=N.alwaysValidSchema=N.toHash=void 0;var K=O(),qb=on();function Lb(e){let t={};for(let r of e)t[r]=!0;return t}N.toHash=Lb;function Fb(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(cm(e,t),!um(t,e.self.RULES.all))}N.alwaysValidSchema=Fb;function cm(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]||pm(e,`unknown keyword: "${s}"`)}N.checkUnknownRules=cm;function um(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}N.schemaHasRules=um;function Vb(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}N.schemaHasRulesButRef=Vb;function Hb({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)}`}N.schemaRefOrVal=Hb;function Jb(e){return lm(decodeURIComponent(e))}N.unescapeFragment=Jb;function Kb(e){return encodeURIComponent(ra(e))}N.escapeFragment=Kb;function ra(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}N.escapeJsonPointer=ra;function lm(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}N.unescapeJsonPointer=lm;function Gb(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}N.eachItem=Gb;function im({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}}N.mergeEvaluated={props:im({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} || {}`),na(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:dm}),items:im({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 dm(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,K._)`{}`);return t!==void 0&&na(e,r,t),r}N.evaluatedPropsToName=dm;function na(e,t,r){Object.keys(r).forEach(n=>e.assign((0,K._)`${t}${(0,K.getProperty)(n)}`,!0))}N.setEvaluated=na;var am={};function Bb(e,t){return e.scopeValue("func",{ref:t,code:am[t.code]||(am[t.code]=new qb._Code(t.code))})}N.useFunc=Bb;var ta;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(ta||(N.Type=ta={}));function Wb(e,t,r){if(e instanceof K.Name){let n=t===ta.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():"/"+ra(e)}N.getErrorPath=Wb;function pm(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}N.checkStrictMode=pm});var ft=z(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});var he=O(),Yb={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")};oa.default=Yb});var dn=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=O(),Ro=D(),we=ft();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 Qb(e,t=ge.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=hm(e,t,r);n??(i||a)?fm(s,c):mm(o,(0,M._)`[${c}]`)}ge.reportError=Qb;function Xb(e,t=ge.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=hm(e,t,r);fm(o,a),s||i||mm(n,we.default.vErrors)}ge.reportExtraError=Xb;function e$(e,t){e.assign(we.default.errors,t),e.if((0,M._)`${we.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,M._)`${we.default.vErrors}.length`,t),()=>e.assign(we.default.vErrors,null)))}ge.resetErrorsCount=e$;function t$({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,we.default.errors,a=>{e.const(i,(0,M._)`${we.default.vErrors}[${a}]`),e.if((0,M._)`${i}.instancePath === undefined`,()=>e.assign((0,M._)`${i}.instancePath`,(0,M.strConcat)(we.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=t$;function fm(e,t){let r=e.const("err",t);e.if((0,M._)`${we.default.vErrors} === null`,()=>e.assign(we.default.vErrors,(0,M._)`[${r}]`),(0,M._)`${we.default.vErrors}.push(${r})`),e.code((0,M._)`${we.default.errors}++`)}function mm(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 Dt={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 hm(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,M._)`{}`:r$(e,t,r)}function r$(e,t,r={}){let{gen:n,it:o}=e,s=[n$(o,r),o$(e,r)];return s$(e,t,s),n.object(...s)}function n$({errorPath:e},{instancePath:t}){let r=t?(0,M.str)`${e}${(0,Ro.getErrorPath)(t,Ro.Type.Str)}`:e;return[we.default.instancePath,(0,M.strConcat)(we.default.instancePath,r)]}function o$({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,Ro.getErrorPath)(r,Ro.Type.Str)}`),[Dt.schemaPath,o]}function s$(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Dt.keyword,o],[Dt.params,typeof t=="function"?t(e):t||(0,M._)`{}`]),c.messages&&n.push([Dt.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Dt.schema,i],[Dt.parentSchema,(0,M._)`${l}${d}`],[we.default.data,s]),u&&n.push([Dt.propertyName,u])}});var ym=z(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.boolOrEmptySchema=ur.topBoolOrEmptySchema=void 0;var i$=dn(),a$=O(),c$=ft(),u$={message:"boolean schema is false"};function l$(e){let{gen:t,schema:r,validateName:n}=e;r===!1?gm(e,!1):typeof r=="object"&&r.$async===!0?t.return(c$.default.data):(t.assign((0,a$._)`${n}.errors`,null),t.return(!0))}ur.topBoolOrEmptySchema=l$;function d$(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),gm(e)):r.var(t,!0)}ur.boolOrEmptySchema=d$;function gm(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,i$.reportError)(o,u$,void 0,t)}});var sa=z(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.getRules=lr.isJSONType=void 0;var p$=["string","number","integer","boolean","null","object","array"],f$=new Set(p$);function m$(e){return typeof e=="string"&&f$.has(e)}lr.isJSONType=m$;function h$(){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:{}}}lr.getRules=h$});var ia=z(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.shouldUseRule=bt.shouldUseGroup=bt.schemaHasRulesForType=void 0;function g$({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&_m(e,n)}bt.schemaHasRulesForType=g$;function _m(e,t){return t.rules.some(r=>vm(e,r))}bt.shouldUseGroup=_m;function vm(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))}bt.shouldUseRule=vm});var pn=z(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.reportTypeError=ye.checkDataTypes=ye.checkDataType=ye.coerceAndCheckDataType=ye.getJSONTypes=ye.getSchemaTypes=ye.DataType=void 0;var y$=sa(),_$=ia(),v$=dn(),C=O(),wm=D(),dr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(dr||(ye.DataType=dr={}));function w$(e){let t=bm(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}ye.getSchemaTypes=w$;function bm(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(y$.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}ye.getJSONTypes=bm;function b$(e,t){let{gen:r,data:n,opts:o}=e,s=$$(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,_$.schemaHasRulesForType)(e,t[0]));if(i){let a=ca(t,n,o.strictNumbers,dr.Wrong);r.if(a,()=>{s.length?x$(e,t,s):ua(e)})}return i}ye.coerceAndCheckDataType=b$;var $m=new Set(["string","number","integer","boolean","null"]);function $$(e,t){return t?e.filter(r=>$m.has(r)||t==="array"&&r==="array"):[]}function x$(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",(0,C._)`typeof ${o}`),a=n.let("coerced",(0,C._)`undefined`);s.coerceTypes==="array"&&n.if((0,C._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,C._)`${o}[0]`).assign(i,(0,C._)`typeof ${o}`).if(ca(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,C._)`${a} !== undefined`);for(let u of r)($m.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),ua(e),n.endIf(),n.if((0,C._)`${a} !== undefined`,()=>{n.assign(o,a),z$(e,a)});function c(u){switch(u){case"string":n.elseIf((0,C._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,C._)`"" + ${o}`).elseIf((0,C._)`${o} === null`).assign(a,(0,C._)`""`);return;case"number":n.elseIf((0,C._)`${i} == "boolean" || ${o} === null
|
|
4
4
|
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,C._)`+${o}`);return;case"integer":n.elseIf((0,C._)`${i} === "boolean" || ${o} === null
|
|
5
5
|
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,C._)`+${o}`);return;case"boolean":n.elseIf((0,C._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,C._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,C._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,C._)`${i} === "string" || ${i} === "number"
|
|
6
|
-
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,C._)`[${o}]`)}}}function $$({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,C._)`${t} !== undefined`,()=>e.assign((0,C._)`${t}[${r}]`,n))}function aa(e,t,r,n=lr.Correct){let o=n===lr.Correct?C.operators.EQ:C.operators.NEQ,s;switch(e){case"null":return(0,C._)`${t} ${o} null`;case"array":s=(0,C._)`Array.isArray(${t})`;break;case"object":s=(0,C._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,C._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,C._)`typeof ${t} ${o} ${e}`}return n===lr.Correct?s:(0,C.not)(s);function i(a=C.nil){return(0,C.and)((0,C._)`typeof ${t} == "number"`,a,r?(0,C._)`isFinite(${t})`:C.nil)}}ye.checkDataType=aa;function ca(e,t,r,n){if(e.length===1)return aa(e[0],t,r,n);let o,s=(0,wm.toHash)(e);if(s.array&&s.object){let i=(0,C._)`typeof ${t} != "object"`;o=s.null?i:(0,C._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=C.nil;s.number&&delete s.integer;for(let i in s)o=(0,C.and)(o,aa(i,t,r,n));return o}ye.checkDataTypes=ca;var x$={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,C._)`{type: ${e}}`:(0,C._)`{type: ${t}}`};function ua(e){let t=z$(e);(0,y$.reportError)(t,x$)}ye.reportTypeError=ua;function z$(e){let{gen:t,data:r,schema:n}=e,o=(0,wm.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var zm=z(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.assignDefaults=void 0;var dr=O(),k$=D();function S$(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)xm(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,s)=>xm(e,s,o.default))}Io.assignDefaults=S$;function xm(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,dr._)`${s}${(0,dr.getProperty)(t)}`;if(o){(0,k$.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,dr._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,dr._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,dr._)`${a} = ${(0,dr.stringify)(r)}`)}});var Le=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=O(),la=D(),$t=ft(),P$=D();function E$(e,t){let{gen:r,data:n,it:o}=e;r.if(pa(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,W._)`${t}`},!0),e.error()})}V.checkReportMissingProp=E$;function T$({gen:e,data:t,it:{opts:r}},n,o){return(0,W.or)(...n.map(s=>(0,W.and)(pa(e,t,s,r.ownProperties),(0,W._)`${o} = ${s}`)))}V.checkMissingProp=T$;function R$(e,t){e.setParams({missingProperty:t},!0),e.error()}V.reportMissingProp=R$;function km(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,W._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=km;function da(e,t,r){return(0,W._)`${km(e)}.call(${t}, ${r})`}V.isOwnProperty=da;function I$(e,t,r,n){let o=(0,W._)`${t}${(0,W.getProperty)(r)} !== undefined`;return n?(0,W._)`${o} && ${da(e,t,r)}`:o}V.propertyInData=I$;function pa(e,t,r,n){let o=(0,W._)`${t}${(0,W.getProperty)(r)} === undefined`;return n?(0,W.or)(o,(0,W.not)(da(e,t,r))):o}V.noPropertyInData=pa;function Sm(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}V.allSchemaProperties=Sm;function C$(e,t){return Sm(t).filter(r=>!(0,la.alwaysValidSchema)(e,t[r]))}V.schemaProperties=C$;function O$({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,d=[[$t.default.instancePath,(0,W.strConcat)($t.default.instancePath,s)],[$t.default.parentData,i.parentData],[$t.default.parentDataProperty,i.parentDataProperty],[$t.default.rootData,$t.default.rootData]];i.opts.dynamicRef&&d.push([$t.default.dynamicAnchors,$t.default.dynamicAnchors]);let m=(0,W._)`${l}, ${r.object(...d)}`;return c!==W.nil?(0,W._)`${a}.call(${c}, ${m})`:(0,W._)`${a}(${m})`}V.callValidateCode=O$;var N$=(0,W._)`new RegExp`;function A$({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"?N$:(0,P$.useFunc)(e,o)}(${r}, ${n})`})}V.usePattern=A$;function j$(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:la.Type.Num},s),t.if((0,W.not)(s),a)})}}V.validateArray=j$;function Z$(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,la.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=Z$});var Tm=z(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.validateKeywordUsage=tt.validSchemaType=tt.funcKeywordCode=tt.macroKeywordCode=void 0;var be=O(),Mt=ft(),D$=Le(),M$=pn();function U$(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Em(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:be.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}tt.macroKeywordCode=U$;function q$(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;F$(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Em(n,o,u),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)_(),t.modifying&&Pm(e),v(()=>e.error());else{let w=t.async?f():g();t.modifying&&Pm(e),v(()=>L$(e,w))}}function f(){let w=n.let("ruleErrs",null);return n.try(()=>_((0,be._)`await `),k=>n.assign(d,!1).if((0,be._)`${k} instanceof ${c.ValidationError}`,()=>n.assign(w,(0,be._)`${k}.errors`),()=>n.throw(k))),w}function g(){let w=(0,be._)`${l}.errors`;return n.assign(w,null),_(be.nil),w}function _(w=t.async?(0,be._)`await `:be.nil){let k=c.opts.passContext?Mt.default.this:Mt.default.self,x=!("compile"in t&&!a||t.schema===!1);n.assign(d,(0,be._)`${w}${(0,D$.callValidateCode)(e,l,k,x)}`,t.modifying)}function v(w){var k;n.if((0,be.not)((k=t.valid)!==null&&k!==void 0?k:d),w)}}tt.funcKeywordCode=q$;function Pm(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,be._)`${n.parentData}[${n.parentDataProperty}]`))}function L$(e,t){let{gen:r}=e;r.if((0,be._)`Array.isArray(${t})`,()=>{r.assign(Mt.default.vErrors,(0,be._)`${Mt.default.vErrors} === null ? ${t} : ${Mt.default.vErrors}.concat(${t})`).assign(Mt.default.errors,(0,be._)`${Mt.default.vErrors}.length`),(0,M$.extendErrors)(e)},()=>e.error())}function F$({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Em(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,be.stringify)(r)})}function V$(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")}tt.validSchemaType=V$;function H$({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)}}tt.validateKeywordUsage=H$});var Im=z(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.extendSubschemaMode=xt.extendSubschemaData=xt.getSubschema=void 0;var rt=O(),Rm=D();function J$(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,rt._)`${e.schemaPath}${(0,rt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,rt._)`${e.schemaPath}${(0,rt.getProperty)(t)}${(0,rt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Rm.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=J$;function K$(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:d}=t,m=a.let("data",(0,rt._)`${t.data}${(0,rt.getProperty)(r)}`,!0);c(m),e.errorPath=(0,rt.str)`${u}${(0,Rm.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,rt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof rt.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=K$;function G$(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=G$});var fa=z((GO,Cm)=>{"use strict";Cm.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 Nm=z((BO,Om)=>{"use strict";var zt=Om.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(){};Co(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 Co(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 d=n[l];if(Array.isArray(d)){if(l in zt.arrayKeywords)for(var m=0;m<d.length;m++)Co(e,t,r,d[m],o+"/"+l+"/"+m,s,o,l,n,m)}else if(l in zt.propsKeywords){if(d&&typeof d=="object")for(var f in d)Co(e,t,r,d[f],o+"/"+l+"/"+B$(f),s,o,l,n,f)}else(l in zt.keywords||e.allKeys&&!(l in zt.skipKeywords))&&Co(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function B$(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var mn=z(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.getSchemaRefs=Pe.resolveUrl=Pe.normalizeId=Pe._getFullPath=Pe.getFullPath=Pe.inlineRef=void 0;var W$=D(),Y$=fa(),Q$=Nm(),X$=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function e0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!ma(e):t?Am(e)<=t:!1}Pe.inlineRef=e0;var t0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ma(e){for(let t in e){if(t0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(ma)||typeof r=="object"&&ma(r))return!0}return!1}function Am(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!X$.has(r)&&(typeof e[r]=="object"&&(0,W$.eachItem)(e[r],n=>t+=Am(n)),t===1/0))return 1/0}return t}function jm(e,t="",r){r!==!1&&(t=pr(t));let n=e.parse(t);return Zm(e,n)}Pe.getFullPath=jm;function Zm(e,t){return e.serialize(t).split("#")[0]+"#"}Pe._getFullPath=Zm;var r0=/#\/?$/;function pr(e){return e?e.replace(r0,""):""}Pe.normalizeId=pr;function n0(e,t,r){return r=pr(r),e.resolve(t,r)}Pe.resolveUrl=n0;var o0=/^[a-z_][-a-z0-9._]*$/i;function s0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=pr(e[r]||t),s={"":o},i=jm(n,o,!1),a={},c=new Set;return Q$(e,{allKeys:!0},(d,m,f,g)=>{if(g===void 0)return;let _=i+m,v=s[g];typeof d[r]=="string"&&(v=w.call(this,d[r])),k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),s[m]=v;function w(x){let S=this.opts.uriResolver.resolve;if(x=pr(v?S(v,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(d,P.schema,x):x!==pr(_)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=_),x}function k(x){if(typeof x=="string"){if(!o0.test(x))throw new Error(`invalid anchor "${x}"`);w.call(this,`#${x}`)}}}),a;function u(d,m,f){if(m!==void 0&&!Y$(d,m))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Pe.getSchemaRefs=s0});var yn=z(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.getData=kt.KeywordCxt=kt.validateFunctionCode=void 0;var Lm=ym(),Dm=fn(),ga=ia(),Oo=fn(),i0=zm(),gn=Tm(),ha=Im(),T=O(),I=ft(),a0=mn(),mt=D(),hn=pn();function c0(e){if(Hm(e)&&(Jm(e),Vm(e))){d0(e);return}Fm(e,()=>(0,Lm.topBoolOrEmptySchema)(e))}kt.validateFunctionCode=c0;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"; ${Mm(r,o)}`),l0(e,o),e.code(s)}):e.func(t,(0,T._)`${I.default.data}, ${u0(o)}`,n.$async,()=>e.code(Mm(r,o)).code(s))}function u0(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 l0(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 d0(e){let{schema:t,opts:r,gen:n}=e;Fm(e,()=>{r.$comment&&t.$comment&&Gm(e),g0(e),n.let(I.default.vErrors,null),n.let(I.default.errors,0),r.unevaluated&&p0(e),Km(e),v0(e)})}function p0(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 Mm(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 f0(e,t){if(Hm(e)&&(Jm(e),Vm(e))){m0(e,t);return}(0,Lm.boolOrEmptySchema)(e,t)}function Vm({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 m0(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Gm(e),y0(e),_0(e);let s=n.const("_errs",I.default.errors);Km(e,s),n.var(t,(0,T._)`${s} === ${I.default.errors}`)}function Jm(e){(0,mt.checkUnknownRules)(e),h0(e)}function Km(e,t){if(e.opts.jtd)return Um(e,[],!1,t);let r=(0,Dm.getSchemaTypes)(e.schema),n=(0,Dm.coerceAndCheckDataType)(e,r);Um(e,r,!n,t)}function h0(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,mt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function g0(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,mt.checkStrictMode)(e,"default is ignored in the schema root")}function y0(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,a0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function _0(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Gm({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 v0(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&&w0(e),t.return((0,T._)`${I.default.errors} === 0`))}function w0({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 Um(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,mt.schemaHasRulesButRef)(s,l))){o.block(()=>Wm(e,"$ref",l.all.$ref.definition));return}c.jtd||b0(e,t),o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){(0,ga.shouldUseGroup)(s,m)&&(m.type?(o.if((0,Oo.checkDataType)(m.type,i,c.strictNumbers)),qm(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,Oo.reportTypeError)(e)),o.endIf()):qm(e,m),a||o.if((0,T._)`${I.default.errors} === ${n||0}`))}}function qm(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,i0.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,ga.shouldUseRule)(n,s)&&Wm(e,s.keyword,s.definition,t.type)})}function b0(e,t){e.schemaEnv.meta||!e.opts.strictTypes||($0(e,t),e.opts.allowUnionTypes||x0(e,t),z0(e,e.dataTypes))}function $0(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Bm(e.dataTypes,r)||ya(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),S0(e,t)}}function x0(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&ya(e,"use allowUnionTypes to allow union type keyword")}function z0(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,ga.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>k0(t,i))&&ya(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function k0(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Bm(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function S0(e,t){let r=[];for(let n of e.dataTypes)Bm(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function ya(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,mt.checkStrictMode)(e,t,e.opts.strictTypes)}var No=class{constructor(t,r,n){if((0,gn.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,mt.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",Ym(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,gn.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?hn.reportExtraError:hn.reportError)(this,this.def.error,r)}$dataError(){(0,hn.reportError)(this,this.def.$dataError||hn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,hn.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,Oo.checkDataTypes)(c,r,s.opts.strictNumbers,Oo.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,ha.getSubschema)(this.it,t);(0,ha.extendSubschemaData)(n,this.it,t),(0,ha.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return f0(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=mt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=mt.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=No;function Wm(e,t,r,n){let o=new No(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,gn.funcKeywordCode)(o,r):"macro"in r?(0,gn.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,gn.funcKeywordCode)(o,r)}var P0=/^\/(?:[^~]|~0|~1)*$/,E0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ym(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return I.default.rootData;if(e[0]==="/"){if(!P0.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=I.default.rootData}else{let u=E0.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,mt.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=Ym});var Ao=z(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var _a=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};va.default=_a});var _n=z($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var wa=mn(),ba=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,wa.resolveUrl)(t,r,n),this.missingSchema=(0,wa.normalizeId)((0,wa.getFullPath)(t,this.missingRef))}};$a.default=ba});var Zo=z(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.resolveSchema=Fe.getCompilingSchema=Fe.resolveRef=Fe.compileSchema=Fe.SchemaEnv=void 0;var Be=O(),T0=Ao(),Ut=ft(),We=mn(),Qm=D(),R0=yn(),fr=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,We.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};Fe.SchemaEnv=fr;function za(e){let t=Xm.call(this,e);if(t)return t;let r=(0,We.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new Be.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:T0.default,code:(0,Be._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Ut.default.data,parentData:Ut.default.parentData,parentDataProperty:Ut.default.parentDataProperty,dataNames:[Ut.default.data],dataPathArr:[Be.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Be.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Be.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Be._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,R0.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Ut.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Ut.default.self}`,`${Ut.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:d,scopeValues:i._values}),this.opts.unevaluated){let{props:g,items:_}=u;f.evaluated={props:g instanceof Be.Name?void 0:g,items:_ instanceof Be.Name?void 0:_,dynamicProps:g instanceof Be.Name,dynamicItems:_ instanceof Be.Name},f.source&&(f.source.evaluated=(0,Be.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}Fe.compileSchema=za;function I0(e,t,r){var n;r=(0,We.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=N0.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 fr({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=C0.call(this,s)}Fe.resolveRef=I0;function C0(e){return(0,We.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:za.call(this,e)}function Xm(e){for(let t of this._compilations)if(O0(t,e))return t}Fe.getCompilingSchema=Xm;function O0(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function N0(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||jo.call(this,e,t)}function jo(e,t){let r=this.opts.uriResolver.parse(t),n=(0,We._getFullPath)(this.opts.uriResolver,r),o=(0,We.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return xa.call(this,r,e);let s=(0,We.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=jo.call(this,e,i);return typeof a?.schema!="object"?void 0:xa.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||za.call(this,i),s===(0,We.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,We.resolveUrl)(this.opts.uriResolver,o,u)),new fr({schema:a,schemaId:c,root:e,baseId:o})}return xa.call(this,r,i)}}Fe.resolveSchema=jo;var A0=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function xa(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,Qm.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!A0.has(a)&&u&&(t=(0,We.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Qm.schemaHasRulesButRef)(r,this.RULES)){let a=(0,We.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=jo.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new fr({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var eh=z((tN,j0)=>{j0.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 Ra=z((rN,ah)=>{"use strict";var Z0=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Sa=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),qt=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Pa=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),rh=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Ea=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),D0=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Ee=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Ee[t]="%"+e[t>>4]+e[t&15]}function _e(e){return e<2048?Ee[192|e>>6]+Ee[128|e&63]:e<65536?Ee[224|e>>12]+Ee[128|e>>6&63]+Ee[128|e&63]:Ee[240|e>>18]+Ee[128|e>>12&63]+Ee[128|e>>6&63]+Ee[128|e&63]}function M0(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 U0=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),q0=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),L0=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),F0=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function V0(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!L0(e[t])){if(e[t]==="%"&&t+2<e.length&&qt(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function th(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 H0(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||!Sa(c))return;s+=2;continue}if(!U0(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1)return s!==8?void 0:th(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 th(i)}function ka(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&&q0(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(J0(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),!V0(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=H0(n);return i===void 0?{host:e,isIPV6:!1,error:!0}:{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function J0(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function K0(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 G0={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},B0=/[@/?#:]/g,W0=/[@/?#]/g;function nh(e,t){let r=t?W0:B0;return r.lastIndex=0,e.replace(r,n=>G0[n])}function oh(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(qt(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&Pa(i)?r+=i:r+="%"+s,n+=2;continue}}r+=e[n]}return r}function Y0(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(qt(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&Pa(i)?t+=i:t+="%"+s,r+=2;continue}}if(rh(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=ih(o)?n:Ee[o];else if(o<55296||o>57343)t+=_e(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=_e(65536+(o-55296<<10)+(s-56320)),r++):t+=_e(65533)}else t+=_e(65533)}}return t}function Q0(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(qt(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/"&&(n=!1),rh(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Ee[i];else if(i<55296||i>57343)r+=_e(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);a>=56320&&a<=57343?(r+=_e(65536+(i-55296<<10)+(a-56320)),o++):r+=_e(65533)}else r+=_e(65533)}}return r}function Ta(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(qt(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Ee[s];else if(s<55296||s>57343)r+=_e(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);i>=56320&&i<=57343?(r+=_e(65536+(s-55296<<10)+(i-56320)),n++):r+=_e(65533)}else r+=_e(65533)}}return r}function sh(e){return Ta(e,D0)}function X0(e){return Ta(e,Ea)}function ex(e){return Ta(e,Ea)}function ih(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 tx(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(qt(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));Pa(i)?t+=i:t+="%"+s,r+=2;continue}}if(Ea(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=ih(o)?n:Ee[o];else if(o<55296||o>57343)t+=_e(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=_e(65536+(o-55296<<10)+(s-56320)),r++):t+=_e(65533)}else t+=_e(65533)}}return t}function rx(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(qt(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function nx(e){let t=[];if(e.userinfo!==void 0&&(t.push(sh(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!Sa(r)){let n=ka(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=oh(r,!0),n=ka(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=nh(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}ah.exports={nonSimpleDomain:F0,recomposeAuthority:nx,reescapeHostDelimiters:nh,normalizePercentEncoding:oh,normalizePathEncoding:Y0,serializePathEncoding:Q0,normalizeQueryFragmentEncoding:tx,encodeUserinfo:sh,encodeQuery:X0,encodeFragment:ex,escapePreservingEscapes:rx,removeDotSegments:K0,isIPv4:Sa,isUUID:Z0,normalizeIPv6:ka,stringArrayToHexStripped:M0}});var ph=z((nN,dh)=>{"use strict";var{isUUID:ox}=Ra(),sx=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,ix=["http","https","ws","wss","urn","urn:uuid"];function ax(e){return ix.indexOf(e)!==-1}function Ia(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 ch(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function uh(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 cx(e){return e.secure=Ia(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function ux(e){if((e.port===(Ia(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 lx(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(sx);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=Ca(o);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function dx(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=Ca(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 px(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!ox(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function fx(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var lh={scheme:"http",domainHost:!0,parse:ch,serialize:uh},mx={scheme:"https",domainHost:lh.domainHost,parse:ch,serialize:uh},Do={scheme:"ws",domainHost:!0,parse:cx,serialize:ux},hx={scheme:"wss",domainHost:Do.domainHost,parse:Do.parse,serialize:Do.serialize},gx={scheme:"urn",parse:lx,serialize:dx,skipNormalize:!0},yx={scheme:"urn:uuid",parse:px,serialize:fx,skipNormalize:!0},Mo={http:lh,https:mx,ws:Do,wss:hx,urn:gx,"urn:uuid":yx};Object.setPrototypeOf(Mo,null);function Ca(e){return e&&(Mo[e]||Mo[e.toLowerCase()])||void 0}dh.exports={wsIsSecure:Ia,SCHEMES:Mo,isValidSchemeName:ax,getSchemeHandler:Ca}});var Sh=z((oN,Lo)=>{"use strict";var{normalizeIPv6:yh,removeDotSegments:wn,recomposeAuthority:_x,normalizePercentEncoding:_h,normalizePathEncoding:vx,serializePathEncoding:fh,normalizeQueryFragmentEncoding:mh,encodeQuery:wx,encodeFragment:bx,reescapeHostDelimiters:$x,isIPv4:vh,nonSimpleDomain:xx}=Ra(),{SCHEMES:wh,getSchemeHandler:Oa}=ph(),bh=/^[A-Za-z][A-Za-z0-9+.-]*$/u,$h="URI scheme is malformed.";function hh(e){let t=unescape(String(e));if(!bh.test(t))throw new TypeError($h);return t}function zx(e,t){return typeof e=="string"?e=Cx(e,t):typeof e=="object"&&(e=qo(Lt(e,t),t)),e}function kx(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}=Uo(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:f,malformedHost:g,malformedScheme:_}=Uo(t,n);if(s||d||i||m||a||f||c||g||u||_)throw new Error(o.error||l.error||"URI is malformed.");let v=xh(o,l,n,!0),w=Oa(r&&r.scheme||v.scheme),k=v.host,x=k!==void 0&&k!==""&&(vh(k)||yh(k).isIPV6);zh(v,r||{},w,x);let S=k&&k.indexOf("%")!==-1&&!/\P{ASCII}/u.test(k);if(v.error&&!S)throw new Error(v.error);return n.skipEscape=!0,Lt(v,n)}function xh(e,t,r,n){let o={};return n||(e=qo(Lt(e,r),r),t=qo(Lt(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=wn(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=wn(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=wn(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=wn(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 Sx(e,t,r){let n=gh(e,r),o=gh(t,r);return n!==void 0&&o!==void 0&&n===o}function Lt(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=hh(r.scheme));let s=Oa(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=_h(r.path):r.path=fh(r.path,a)),n.reference!=="suffix"&&r.scheme&&(r.scheme=hh(r.scheme),o.push(r.scheme,":"));let c=_x(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=wn(u)),a&&(u=fh(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",wx(r.query)),r.fragment!==void 0&&o.push("#",bx(r.fragment)),o.join("")}var Px=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Ex=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Tx=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Rx(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 vn(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 Ix(e){let t=e[4];return vn(e[3])||t!==void 0&&!(t[0]==="["&&t[t.length-1]==="]")&&vn(t)||vn(e[6])||vn(e[7])||vn(e[8])}function zh(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&e.host[0]!=="["&&(t.domainHost||r&&r.domainHost)&&n===!1&&xx(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 Uo(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 d=e.match(Ex);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let m=e.match(Tx);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(Px);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 v=unescape(n.scheme);bh.test(v)?n.scheme=v.toLowerCase():(n.error=n.error||$h,u=!0)}s=Ix(f),s&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=f[5]);let g=Rx(n,f);if(g!==void 0&&(n.error=n.error||g,o=!0),n.host)if(vh(n.host)===!1){let w=n.host[0]==="["&&n.host[n.host.length-1]==="]",k=yh(n.host);l=k.isIPV6||k.isIPVFuture===!0,c=w&&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 _=Oa(r.scheme||n.scheme);if(a=zh(n,r,_,l),!_||_&&!_.skipNormalize){if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let v=l?n.host:_h(n.host,!0);n.host=$x(v,l)}n.path&&(n.path=vx(n.path)),n.query&&(n.query=mh(n.query)),n.fragment&&(n.fragment=mh(n.fragment))}_&&_.parse&&(_.parse(n,r),_===wh.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 qo(e,t){return Uo(e,t).parsed}function Cx(e,t){return kh(e,t).normalized}function kh(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=Uo(e,t);return{normalized:n||o||s||i||a?e:Lt(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function gh(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:Lt(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=kh(r,t);return o||s||i||a||c?void 0:n}var Na={SCHEMES:wh,normalize:zx,resolve:kx,resolveComponent:xh,equal:Sx,serialize:Lt,parse:qo};Lo.exports=Na;Lo.exports.default=Na;Lo.exports.fastUri=Na});var Eh=z(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var Ph=Sh();Ph.code='require("ajv/dist/runtime/uri").default';Aa.default=Ph});var jh=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 Ox=yn();Object.defineProperty(pe,"KeywordCxt",{enumerable:!0,get:function(){return Ox.KeywordCxt}});var mr=O();Object.defineProperty(pe,"_",{enumerable:!0,get:function(){return mr._}});Object.defineProperty(pe,"str",{enumerable:!0,get:function(){return mr.str}});Object.defineProperty(pe,"stringify",{enumerable:!0,get:function(){return mr.stringify}});Object.defineProperty(pe,"nil",{enumerable:!0,get:function(){return mr.nil}});Object.defineProperty(pe,"Name",{enumerable:!0,get:function(){return mr.Name}});Object.defineProperty(pe,"CodeGen",{enumerable:!0,get:function(){return mr.CodeGen}});var Nx=Ao(),Oh=_n(),Ax=sa(),bn=Zo(),jx=O(),$n=mn(),Fo=fn(),Za=D(),Th=eh(),Zx=Eh(),Nh=(e,t)=>new RegExp(e,t);Nh.code="new RegExp";var Dx=["removeAdditional","useDefaults","coerceTypes"],Mx=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Ux={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."},qx={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Rh=200;function Lx(e){var t,r,n,o,s,i,a,c,u,l,d,m,f,g,_,v,w,k,x,S,P,Re,Ae,Ir,fs;let Cr=e.strict,ms=(t=e.code)===null||t===void 0?void 0:t.optimize,ru=ms===!0||ms===void 0?1:ms||0,nu=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Nh,Vy=(o=e.uriResolver)!==null&&o!==void 0?o:Zx.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:Cr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:Cr)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Cr)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:Cr)!==null&&m!==void 0?m:"log",strictRequired:(g=(f=e.strictRequired)!==null&&f!==void 0?f:Cr)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:ru,regExp:nu}:{optimize:ru,regExp:nu},loopRequired:(_=e.loopRequired)!==null&&_!==void 0?_:Rh,loopEnum:(v=e.loopEnum)!==null&&v!==void 0?v:Rh,meta:(w=e.meta)!==null&&w!==void 0?w:!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:(Ae=e.validateFormats)!==null&&Ae!==void 0?Ae:!0,unicodeRegExp:(Ir=e.unicodeRegExp)!==null&&Ir!==void 0?Ir:!0,int32range:(fs=e.int32range)!==null&&fs!==void 0?fs:!0,uriResolver:Vy}}var xn=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,...Lx(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new jx.ValueScope({scope:{},prefixes:Mx,es5:r,lines:n}),this.logger=Gx(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,Ax.getRules)(),Ih.call(this,Ux,t,"NOT SUPPORTED"),Ih.call(this,qx,t,"DEPRECATED","warn"),this._metaOpts=Jx.call(this),t.formats&&Vx.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Hx.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Fx.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Th;n==="id"&&(o={...Th},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,d){await s.call(this,l.$schema);let m=this._addSchema(l,d);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(d){if(!(d instanceof Oh.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;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,$n.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=Ch.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new bn.SchemaEnv({schema:{},schemaId:n});if(r=bn.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=Ch.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,$n.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(Wx.call(this,n,r),!r)return(0,Za.eachItem)(n,s=>ja.call(this,s)),this;Qx.call(this,r);let o={...r,type:(0,Fo.getJSONTypes)(r.type),schemaType:(0,Fo.getJSONTypes)(r.schemaType)};return(0,Za.eachItem)(n,o.type.length===0?s=>ja.call(this,s,o):s=>o.type.forEach(i=>ja.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]=Ah(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,$n.normalizeId)(i||n);let u=$n.getSchemaRefs.call(this,t,n);return c=new bn.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):bn.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{bn.compileSchema.call(this,t)}finally{this.opts=r}}};xn.ValidationError=Nx.default;xn.MissingRefError=Oh.default;pe.default=xn;function Ih(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 Ch(e){return e=(0,$n.normalizeId)(e),this.schemas[e]||this.refs[e]}function Fx(){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 Vx(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function Hx(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 Jx(){let e={...this.opts};for(let t of Dx)delete e[t];return e}var Kx={log(){},warn(){},error(){}};function Gx(e){if(e===!1)return Kx;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 Bx=/^[a-z_$][a-z0-9_$:-]*$/i;function Wx(e,t){let{RULES:r}=this;if((0,Za.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Bx.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 ja(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,Fo.getJSONTypes)(t.type),schemaType:(0,Fo.getJSONTypes)(t.schemaType)}};t.before?Yx.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 Yx(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 Qx(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Ah(t)),e.validateSchema=this.compile(t,!0))}var Xx={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ah(e){return{anyOf:[e,Xx]}}});var Zh=z(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var ez={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Da.default=ez});var qh=z(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.callRef=Ft.getValidate=void 0;var tz=_n(),Dh=Le(),Te=O(),hr=ft(),Mh=Zo(),Vo=D(),rz={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 d();let l=Mh.resolveRef.call(c,u,o,r);if(l===void 0)throw new tz.default(n.opts.uriResolver,o,r);if(l instanceof Mh.SchemaEnv)return m(l);return f(l);function d(){if(s===u)return Ho(e,i,s,s.$async);let g=t.scopeValue("root",{ref:u});return Ho(e,(0,Te._)`${g}.validate`,u,u.$async)}function m(g){let _=Uh(e,g);Ho(e,_,g,g.$async)}function f(g){let _=t.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Te.stringify)(g)}:{ref:g}),v=t.name("valid"),w=e.subschema({schema:g,dataTypes:[],schemaPath:Te.nil,topSchemaRef:_,errSchemaPath:r},v);e.mergeEvaluated(w),e.ok(v)}}};function Uh(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Te._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Ft.getValidate=Uh;function Ho(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?hr.default.this:Te.nil;n?l():d();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,Dh.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 d(){e.result((0,Dh.callValidateCode)(e,t,u),()=>f(t),()=>m(t))}function m(g){let _=(0,Te._)`${g}.errors`;o.assign(hr.default.vErrors,(0,Te._)`${hr.default.vErrors} === null ? ${_} : ${hr.default.vErrors}.concat(${_})`),o.assign(hr.default.errors,(0,Te._)`${hr.default.vErrors}.length`)}function f(g){var _;if(!s.opts.unevaluated)return;let v=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(s.props=Vo.mergeEvaluated.props(o,v.props,s.props));else{let w=o.var("props",(0,Te._)`${g}.evaluated.props`);s.props=Vo.mergeEvaluated.props(o,w,s.props,Te.Name)}if(s.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(s.items=Vo.mergeEvaluated.items(o,v.items,s.items));else{let w=o.var("items",(0,Te._)`${g}.evaluated.items`);s.items=Vo.mergeEvaluated.items(o,w,s.items,Te.Name)}}}Ft.callRef=Ho;Ft.default=rz});var Lh=z(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});var nz=Zh(),oz=qh(),sz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",nz.default,oz.default];Ma.default=sz});var Fh=z(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});var Jo=O(),St=Jo.operators,Ko={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}},iz={message:({keyword:e,schemaCode:t})=>(0,Jo.str)`must be ${Ko[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Jo._)`{comparison: ${Ko[e].okStr}, limit: ${t}}`},az={keyword:Object.keys(Ko),type:"number",schemaType:"number",$data:!0,error:iz,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Jo._)`${r} ${Ko[t].fail} ${n} || isNaN(${r})`)}};Ua.default=az});var Vh=z(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var zn=O(),cz={message:({schemaCode:e})=>(0,zn.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,zn._)`{multipleOf: ${e}}`},uz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:cz,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,zn._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,zn._)`${i} !== parseInt(${i})`;e.fail$data((0,zn._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};qa.default=uz});var Jh=z(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});function Hh(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}La.default=Hh;Hh.code='require("ajv/dist/runtime/ucs2length").default'});var Kh=z(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var Vt=O(),lz=D(),dz=Jh(),pz={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Vt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Vt._)`{limit: ${e}}`},fz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:pz,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?Vt.operators.GT:Vt.operators.LT,i=o.opts.unicode===!1?(0,Vt._)`${r}.length`:(0,Vt._)`${(0,lz.useFunc)(e.gen,dz.default)}(${r})`;e.fail$data((0,Vt._)`${i} ${s} ${n}`)}};Fa.default=fz});var Gh=z(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var mz=Le(),hz=D(),gr=O(),gz={message:({schemaCode:e})=>(0,gr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,gr._)`{pattern: ${e}}`},yz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:gz,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,gr._)`new RegExp`:(0,hz.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,gr._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,gr._)`!${l}`)}else{let c=(0,mz.usePattern)(e,o);e.fail$data((0,gr._)`!${c}.test(${r})`)}}};Va.default=yz});var Bh=z(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});var kn=O(),_z={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,kn.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,kn._)`{limit: ${e}}`},vz={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:_z,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?kn.operators.GT:kn.operators.LT;e.fail$data((0,kn._)`Object.keys(${r}).length ${o} ${n}`)}};Ha.default=vz});var Wh=z(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var Sn=Le(),Pn=O(),wz=D(),bz={message:({params:{missingProperty:e}})=>(0,Pn.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Pn._)`{missingProperty: ${e}}`},$z={keyword:"required",type:"object",schemaType:"array",$data:!0,error:bz,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 v=i.schemaEnv.baseId+i.errSchemaPath,w=`required property "${_}" is not defined at "${v}" (strictRequired)`;(0,wz.checkStrictMode)(i,w,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(Pn.nil,d);else for(let f of r)(0,Sn.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,Sn.checkMissingProp)(e,r,f)),(0,Sn.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,Sn.noPropertyInData)(t,o,f,a.ownProperties),()=>e.error())})}function m(f,g){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(g,(0,Sn.propertyInData)(t,o,f,a.ownProperties)),t.if((0,Pn.not)(g),()=>{e.error(),t.break()})},Pn.nil)}}};Ja.default=$z});var Yh=z(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});var En=O(),xz={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,En.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,En._)`{limit: ${e}}`},zz={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:xz,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?En.operators.GT:En.operators.LT;e.fail$data((0,En._)`${r}.length ${o} ${n}`)}};Ka.default=zz});var Go=z(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});var Qh=fa();Qh.code='require("ajv/dist/runtime/equal").default';Ga.default=Qh});var Xh=z(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});var Ba=fn(),fe=O(),kz=D(),Sz=Go(),Pz={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}}`},Ez={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Pz,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,Ba.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`,()=>(d()?m:f)(g,_))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function m(g,_){let v=t.name("item"),w=(0,Ba.checkDataTypes)(u,v,a.opts.strictNumbers,Ba.DataType.Wrong),k=t.const("indices",(0,fe._)`{}`);t.for((0,fe._)`;${g}--;`,()=>{t.let(v,(0,fe._)`${r}[${g}]`),t.if(w,(0,fe._)`continue`),u.length>1&&t.if((0,fe._)`typeof ${v} == "string"`,(0,fe._)`${v} += "_"`),t.if((0,fe._)`typeof ${k}[${v}] == "number"`,()=>{t.assign(_,(0,fe._)`${k}[${v}]`),e.error(),t.assign(c,!1).break()}).code((0,fe._)`${k}[${v}] = ${g}`)})}function f(g,_){let v=(0,kz.useFunc)(t,Sz.default),w=t.name("outer");t.label(w).for((0,fe._)`;${g}--;`,()=>t.for((0,fe._)`${_} = ${g}; ${_}--;`,()=>t.if((0,fe._)`${v}(${r}[${g}], ${r}[${_}])`,()=>{e.error(),t.assign(c,!1).break(w)})))}}};Wa.default=Ez});var eg=z(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});var Ya=O(),Tz=D(),Rz=Go(),Iz={message:"must be equal to constant",params:({schemaCode:e})=>(0,Ya._)`{allowedValue: ${e}}`},Cz={keyword:"const",$data:!0,error:Iz,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s=="object"?e.fail$data((0,Ya._)`!${(0,Tz.useFunc)(t,Rz.default)}(${r}, ${o})`):e.fail((0,Ya._)`${s} !== ${r}`)}};Qa.default=Cz});var tg=z(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});var Tn=O(),Oz=D(),Nz=Go(),Az={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Tn._)`{allowedValues: ${e}}`},jz={keyword:"enum",schemaType:"array",$data:!0,error:Az,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,Oz.useFunc)(t,Nz.default)),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,Tn.or)(...o.map((g,_)=>m(f,_)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,Tn._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,g){let _=o[g];return typeof _=="object"&&_!==null?(0,Tn._)`${u()}(${r}, ${f}[${g}])`:(0,Tn._)`${r} === ${_}`}}};Xa.default=jz});var rg=z(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});var Zz=Fh(),Dz=Vh(),Mz=Kh(),Uz=Gh(),qz=Bh(),Lz=Wh(),Fz=Yh(),Vz=Xh(),Hz=eg(),Jz=tg(),Kz=[Zz.default,Dz.default,Mz.default,Uz.default,qz.default,Lz.default,Fz.default,Vz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Hz.default,Jz.default];ec.default=Kz});var rc=z(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.validateAdditionalItems=void 0;var Ht=O(),tc=D(),Gz={message:({params:{len:e}})=>(0,Ht.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Ht._)`{limit: ${e}}`},Bz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Gz,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,tc.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}ng(e,n)}};function ng(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,Ht._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Ht._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,tc.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Ht._)`${a} <= ${t.length}`);r.if((0,Ht.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:tc.Type.Num},u),i.allErrors||r.if((0,Ht.not)(u),()=>r.break())})}}Rn.validateAdditionalItems=ng;Rn.default=Bz});var nc=z(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.validateTuple=void 0;var og=O(),Bo=D(),Wz=Le(),Yz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return sg(e,"additionalItems",t);r.items=!0,!(0,Bo.alwaysValidSchema)(r,t)&&e.ok((0,Wz.validateArray)(e))}};function sg(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=Bo.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,og._)`${s}.length`);r.forEach((d,m)=>{(0,Bo.alwaysValidSchema)(a,d)||(n.if((0,og._)`${u} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(d){let{opts:m,errSchemaPath:f}=a,g=r.length,_=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(m.strictTuples&&!_){let v=`"${i}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Bo.checkStrictMode)(a,v,m.strictTuples)}}}In.validateTuple=sg;In.default=Yz});var ig=z(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});var Qz=nc(),Xz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Qz.validateTuple)(e,"items")};oc.default=Xz});var cg=z(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});var ag=O(),ek=D(),tk=Le(),rk=rc(),nk={message:({params:{len:e}})=>(0,ag.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ag._)`{limit: ${e}}`},ok={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:nk,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,ek.alwaysValidSchema)(n,t)&&(o?(0,rk.validateAdditionalItems)(e,o):e.ok((0,tk.validateArray)(e)))}};sc.default=ok});var ug=z(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});var Ve=O(),Wo=D(),sk={message:({params:{min:e,max:t}})=>t===void 0?(0,Ve.str)`must contain at least ${e} valid item(s)`:(0,Ve.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Ve._)`{minContains: ${e}}`:(0,Ve._)`{minContains: ${e}, maxContains: ${t}}`},ik={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:sk,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,Ve._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Wo.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Wo.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Wo.alwaysValidSchema)(s,r)){let _=(0,Ve._)`${l} >= ${i}`;a!==void 0&&(_=(0,Ve._)`${_} && ${l} <= ${a}`),e.pass(_);return}s.items=!0;let d=t.name("valid");a===void 0&&i===1?f(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,Ve._)`${o}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let _=t.name("_valid"),v=t.let("count",0);f(_,()=>t.if(_,()=>g(v)))}function f(_,v){t.forRange("i",0,l,w=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:Wo.Type.Num,compositeRule:!0},_),v()})}function g(_){t.code((0,Ve._)`${_}++`),a===void 0?t.if((0,Ve._)`${_} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,Ve._)`${_} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,Ve._)`${_} >= ${i}`,()=>t.assign(d,!0)))}}};ic.default=ik});var pg=z(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.validateSchemaDeps=nt.validatePropertyDeps=nt.error=void 0;var ac=O(),ak=D(),Cn=Le();nt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,ac.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,ac._)`{property: ${e},
|
|
6
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,C._)`[${o}]`)}}}function z$({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,C._)`${t} !== undefined`,()=>e.assign((0,C._)`${t}[${r}]`,n))}function aa(e,t,r,n=dr.Correct){let o=n===dr.Correct?C.operators.EQ:C.operators.NEQ,s;switch(e){case"null":return(0,C._)`${t} ${o} null`;case"array":s=(0,C._)`Array.isArray(${t})`;break;case"object":s=(0,C._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,C._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,C._)`typeof ${t} ${o} ${e}`}return n===dr.Correct?s:(0,C.not)(s);function i(a=C.nil){return(0,C.and)((0,C._)`typeof ${t} == "number"`,a,r?(0,C._)`isFinite(${t})`:C.nil)}}ye.checkDataType=aa;function ca(e,t,r,n){if(e.length===1)return aa(e[0],t,r,n);let o,s=(0,wm.toHash)(e);if(s.array&&s.object){let i=(0,C._)`typeof ${t} != "object"`;o=s.null?i:(0,C._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=C.nil;s.number&&delete s.integer;for(let i in s)o=(0,C.and)(o,aa(i,t,r,n));return o}ye.checkDataTypes=ca;var k$={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,C._)`{type: ${e}}`:(0,C._)`{type: ${t}}`};function ua(e){let t=S$(e);(0,v$.reportError)(t,k$)}ye.reportTypeError=ua;function S$(e){let{gen:t,data:r,schema:n}=e,o=(0,wm.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var zm=z(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.assignDefaults=void 0;var pr=O(),P$=D();function E$(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)xm(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,s)=>xm(e,s,o.default))}Io.assignDefaults=E$;function xm(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,pr._)`${s}${(0,pr.getProperty)(t)}`;if(o){(0,P$.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,pr._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,pr._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,pr._)`${a} = ${(0,pr.stringify)(r)}`)}});var Le=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=O(),la=D(),$t=ft(),T$=D();function R$(e,t){let{gen:r,data:n,it:o}=e;r.if(pa(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,W._)`${t}`},!0),e.error()})}V.checkReportMissingProp=R$;function I$({gen:e,data:t,it:{opts:r}},n,o){return(0,W.or)(...n.map(s=>(0,W.and)(pa(e,t,s,r.ownProperties),(0,W._)`${o} = ${s}`)))}V.checkMissingProp=I$;function C$(e,t){e.setParams({missingProperty:t},!0),e.error()}V.reportMissingProp=C$;function km(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,W._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=km;function da(e,t,r){return(0,W._)`${km(e)}.call(${t}, ${r})`}V.isOwnProperty=da;function O$(e,t,r,n){let o=(0,W._)`${t}${(0,W.getProperty)(r)} !== undefined`;return n?(0,W._)`${o} && ${da(e,t,r)}`:o}V.propertyInData=O$;function pa(e,t,r,n){let o=(0,W._)`${t}${(0,W.getProperty)(r)} === undefined`;return n?(0,W.or)(o,(0,W.not)(da(e,t,r))):o}V.noPropertyInData=pa;function Sm(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}V.allSchemaProperties=Sm;function A$(e,t){return Sm(t).filter(r=>!(0,la.alwaysValidSchema)(e,t[r]))}V.schemaProperties=A$;function N$({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,d=[[$t.default.instancePath,(0,W.strConcat)($t.default.instancePath,s)],[$t.default.parentData,i.parentData],[$t.default.parentDataProperty,i.parentDataProperty],[$t.default.rootData,$t.default.rootData]];i.opts.dynamicRef&&d.push([$t.default.dynamicAnchors,$t.default.dynamicAnchors]);let m=(0,W._)`${l}, ${r.object(...d)}`;return c!==W.nil?(0,W._)`${a}.call(${c}, ${m})`:(0,W._)`${a}(${m})`}V.callValidateCode=N$;var j$=(0,W._)`new RegExp`;function Z$({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"?j$:(0,T$.useFunc)(e,o)}(${r}, ${n})`})}V.usePattern=Z$;function D$(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:la.Type.Num},s),t.if((0,W.not)(s),a)})}}V.validateArray=D$;function M$(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,la.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=M$});var Tm=z(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.validateKeywordUsage=tt.validSchemaType=tt.funcKeywordCode=tt.macroKeywordCode=void 0;var be=O(),Mt=ft(),U$=Le(),q$=dn();function L$(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Em(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:be.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}tt.macroKeywordCode=L$;function F$(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;H$(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Em(n,o,u),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)_(),t.modifying&&Pm(e),v(()=>e.error());else{let w=t.async?f():g();t.modifying&&Pm(e),v(()=>V$(e,w))}}function f(){let w=n.let("ruleErrs",null);return n.try(()=>_((0,be._)`await `),k=>n.assign(d,!1).if((0,be._)`${k} instanceof ${c.ValidationError}`,()=>n.assign(w,(0,be._)`${k}.errors`),()=>n.throw(k))),w}function g(){let w=(0,be._)`${l}.errors`;return n.assign(w,null),_(be.nil),w}function _(w=t.async?(0,be._)`await `:be.nil){let k=c.opts.passContext?Mt.default.this:Mt.default.self,x=!("compile"in t&&!a||t.schema===!1);n.assign(d,(0,be._)`${w}${(0,U$.callValidateCode)(e,l,k,x)}`,t.modifying)}function v(w){var k;n.if((0,be.not)((k=t.valid)!==null&&k!==void 0?k:d),w)}}tt.funcKeywordCode=F$;function Pm(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,be._)`${n.parentData}[${n.parentDataProperty}]`))}function V$(e,t){let{gen:r}=e;r.if((0,be._)`Array.isArray(${t})`,()=>{r.assign(Mt.default.vErrors,(0,be._)`${Mt.default.vErrors} === null ? ${t} : ${Mt.default.vErrors}.concat(${t})`).assign(Mt.default.errors,(0,be._)`${Mt.default.vErrors}.length`),(0,q$.extendErrors)(e)},()=>e.error())}function H$({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Em(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,be.stringify)(r)})}function J$(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")}tt.validSchemaType=J$;function K$({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)}}tt.validateKeywordUsage=K$});var Im=z(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.extendSubschemaMode=xt.extendSubschemaData=xt.getSubschema=void 0;var rt=O(),Rm=D();function G$(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,rt._)`${e.schemaPath}${(0,rt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,rt._)`${e.schemaPath}${(0,rt.getProperty)(t)}${(0,rt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Rm.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=G$;function B$(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:d}=t,m=a.let("data",(0,rt._)`${t.data}${(0,rt.getProperty)(r)}`,!0);c(m),e.errorPath=(0,rt.str)`${u}${(0,Rm.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,rt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof rt.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=B$;function W$(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=W$});var fa=z((WO,Cm)=>{"use strict";Cm.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 Am=z((YO,Om)=>{"use strict";var zt=Om.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(){};Co(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 Co(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 d=n[l];if(Array.isArray(d)){if(l in zt.arrayKeywords)for(var m=0;m<d.length;m++)Co(e,t,r,d[m],o+"/"+l+"/"+m,s,o,l,n,m)}else if(l in zt.propsKeywords){if(d&&typeof d=="object")for(var f in d)Co(e,t,r,d[f],o+"/"+l+"/"+Y$(f),s,o,l,n,f)}else(l in zt.keywords||e.allKeys&&!(l in zt.skipKeywords))&&Co(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function Y$(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var fn=z(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.getSchemaRefs=Pe.resolveUrl=Pe.normalizeId=Pe._getFullPath=Pe.getFullPath=Pe.inlineRef=void 0;var Q$=D(),X$=fa(),e0=Am(),t0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function r0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!ma(e):t?Nm(e)<=t:!1}Pe.inlineRef=r0;var n0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ma(e){for(let t in e){if(n0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(ma)||typeof r=="object"&&ma(r))return!0}return!1}function Nm(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!t0.has(r)&&(typeof e[r]=="object"&&(0,Q$.eachItem)(e[r],n=>t+=Nm(n)),t===1/0))return 1/0}return t}function jm(e,t="",r){r!==!1&&(t=fr(t));let n=e.parse(t);return Zm(e,n)}Pe.getFullPath=jm;function Zm(e,t){return e.serialize(t).split("#")[0]+"#"}Pe._getFullPath=Zm;var o0=/#\/?$/;function fr(e){return e?e.replace(o0,""):""}Pe.normalizeId=fr;function s0(e,t,r){return r=fr(r),e.resolve(t,r)}Pe.resolveUrl=s0;var i0=/^[a-z_][-a-z0-9._]*$/i;function a0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=fr(e[r]||t),s={"":o},i=jm(n,o,!1),a={},c=new Set;return e0(e,{allKeys:!0},(d,m,f,g)=>{if(g===void 0)return;let _=i+m,v=s[g];typeof d[r]=="string"&&(v=w.call(this,d[r])),k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),s[m]=v;function w(x){let S=this.opts.uriResolver.resolve;if(x=fr(v?S(v,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(d,P.schema,x):x!==fr(_)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=_),x}function k(x){if(typeof x=="string"){if(!i0.test(x))throw new Error(`invalid anchor "${x}"`);w.call(this,`#${x}`)}}}),a;function u(d,m,f){if(m!==void 0&&!X$(d,m))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Pe.getSchemaRefs=a0});var gn=z(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.getData=kt.KeywordCxt=kt.validateFunctionCode=void 0;var Lm=ym(),Dm=pn(),ga=ia(),Oo=pn(),c0=zm(),hn=Tm(),ha=Im(),T=O(),I=ft(),u0=fn(),mt=D(),mn=dn();function l0(e){if(Hm(e)&&(Jm(e),Vm(e))){f0(e);return}Fm(e,()=>(0,Lm.topBoolOrEmptySchema)(e))}kt.validateFunctionCode=l0;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"; ${Mm(r,o)}`),p0(e,o),e.code(s)}):e.func(t,(0,T._)`${I.default.data}, ${d0(o)}`,n.$async,()=>e.code(Mm(r,o)).code(s))}function d0(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 p0(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 f0(e){let{schema:t,opts:r,gen:n}=e;Fm(e,()=>{r.$comment&&t.$comment&&Gm(e),_0(e),n.let(I.default.vErrors,null),n.let(I.default.errors,0),r.unevaluated&&m0(e),Km(e),b0(e)})}function m0(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 Mm(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 h0(e,t){if(Hm(e)&&(Jm(e),Vm(e))){g0(e,t);return}(0,Lm.boolOrEmptySchema)(e,t)}function Vm({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 g0(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Gm(e),v0(e),w0(e);let s=n.const("_errs",I.default.errors);Km(e,s),n.var(t,(0,T._)`${s} === ${I.default.errors}`)}function Jm(e){(0,mt.checkUnknownRules)(e),y0(e)}function Km(e,t){if(e.opts.jtd)return Um(e,[],!1,t);let r=(0,Dm.getSchemaTypes)(e.schema),n=(0,Dm.coerceAndCheckDataType)(e,r);Um(e,r,!n,t)}function y0(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,mt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function _0(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,mt.checkStrictMode)(e,"default is ignored in the schema root")}function v0(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function w0(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Gm({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 b0(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&&$0(e),t.return((0,T._)`${I.default.errors} === 0`))}function $0({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 Um(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,mt.schemaHasRulesButRef)(s,l))){o.block(()=>Wm(e,"$ref",l.all.$ref.definition));return}c.jtd||x0(e,t),o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){(0,ga.shouldUseGroup)(s,m)&&(m.type?(o.if((0,Oo.checkDataType)(m.type,i,c.strictNumbers)),qm(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,Oo.reportTypeError)(e)),o.endIf()):qm(e,m),a||o.if((0,T._)`${I.default.errors} === ${n||0}`))}}function qm(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,c0.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,ga.shouldUseRule)(n,s)&&Wm(e,s.keyword,s.definition,t.type)})}function x0(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(z0(e,t),e.opts.allowUnionTypes||k0(e,t),S0(e,e.dataTypes))}function z0(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Bm(e.dataTypes,r)||ya(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),E0(e,t)}}function k0(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&ya(e,"use allowUnionTypes to allow union type keyword")}function S0(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,ga.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>P0(t,i))&&ya(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function P0(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Bm(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function E0(e,t){let r=[];for(let n of e.dataTypes)Bm(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function ya(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,mt.checkStrictMode)(e,t,e.opts.strictTypes)}var Ao=class{constructor(t,r,n){if((0,hn.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,mt.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",Ym(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,hn.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?mn.reportExtraError:mn.reportError)(this,this.def.error,r)}$dataError(){(0,mn.reportError)(this,this.def.$dataError||mn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,mn.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,Oo.checkDataTypes)(c,r,s.opts.strictNumbers,Oo.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,ha.getSubschema)(this.it,t);(0,ha.extendSubschemaData)(n,this.it,t),(0,ha.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return h0(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=mt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=mt.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=Ao;function Wm(e,t,r,n){let o=new Ao(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,hn.funcKeywordCode)(o,r):"macro"in r?(0,hn.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,hn.funcKeywordCode)(o,r)}var T0=/^\/(?:[^~]|~0|~1)*$/,R0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ym(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return I.default.rootData;if(e[0]==="/"){if(!T0.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=I.default.rootData}else{let u=R0.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,mt.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=Ym});var No=z(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var _a=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};va.default=_a});var yn=z($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var wa=fn(),ba=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,wa.resolveUrl)(t,r,n),this.missingSchema=(0,wa.normalizeId)((0,wa.getFullPath)(t,this.missingRef))}};$a.default=ba});var Zo=z(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.resolveSchema=Fe.getCompilingSchema=Fe.resolveRef=Fe.compileSchema=Fe.SchemaEnv=void 0;var Be=O(),I0=No(),Ut=ft(),We=fn(),Qm=D(),C0=gn(),mr=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,We.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};Fe.SchemaEnv=mr;function za(e){let t=Xm.call(this,e);if(t)return t;let r=(0,We.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new Be.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:I0.default,code:(0,Be._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Ut.default.data,parentData:Ut.default.parentData,parentDataProperty:Ut.default.parentDataProperty,dataNames:[Ut.default.data],dataPathArr:[Be.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Be.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Be.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Be._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,C0.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Ut.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Ut.default.self}`,`${Ut.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:d,scopeValues:i._values}),this.opts.unevaluated){let{props:g,items:_}=u;f.evaluated={props:g instanceof Be.Name?void 0:g,items:_ instanceof Be.Name?void 0:_,dynamicProps:g instanceof Be.Name,dynamicItems:_ instanceof Be.Name},f.source&&(f.source.evaluated=(0,Be.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}Fe.compileSchema=za;function O0(e,t,r){var n;r=(0,We.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=j0.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 mr({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=A0.call(this,s)}Fe.resolveRef=O0;function A0(e){return(0,We.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:za.call(this,e)}function Xm(e){for(let t of this._compilations)if(N0(t,e))return t}Fe.getCompilingSchema=Xm;function N0(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function j0(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||jo.call(this,e,t)}function jo(e,t){let r=this.opts.uriResolver.parse(t),n=(0,We._getFullPath)(this.opts.uriResolver,r),o=(0,We.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return xa.call(this,r,e);let s=(0,We.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=jo.call(this,e,i);return typeof a?.schema!="object"?void 0:xa.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||za.call(this,i),s===(0,We.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,We.resolveUrl)(this.opts.uriResolver,o,u)),new mr({schema:a,schemaId:c,root:e,baseId:o})}return xa.call(this,r,i)}}Fe.resolveSchema=jo;var Z0=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function xa(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,Qm.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Z0.has(a)&&u&&(t=(0,We.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Qm.schemaHasRulesButRef)(r,this.RULES)){let a=(0,We.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=jo.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new mr({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var eh=z((nA,D0)=>{D0.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 Ra=z((oA,ah)=>{"use strict";var M0=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Sa=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),qt=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Pa=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),rh=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Ea=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),U0=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Ee=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Ee[t]="%"+e[t>>4]+e[t&15]}function _e(e){return e<2048?Ee[192|e>>6]+Ee[128|e&63]:e<65536?Ee[224|e>>12]+Ee[128|e>>6&63]+Ee[128|e&63]:Ee[240|e>>18]+Ee[128|e>>12&63]+Ee[128|e>>6&63]+Ee[128|e&63]}function q0(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 L0=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),F0=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),V0=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),H0=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function J0(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!V0(e[t])){if(e[t]==="%"&&t+2<e.length&&qt(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function th(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 K0(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||!Sa(c))return;s+=2;continue}if(!L0(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1)return s!==8?void 0:th(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 th(i)}function ka(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&&F0(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(G0(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),!J0(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=K0(n);return i===void 0?{host:e,isIPV6:!1,error:!0}:{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function G0(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function B0(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 W0={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Y0=/[@/?#:]/g,Q0=/[@/?#]/g;function nh(e,t){let r=t?Q0:Y0;return r.lastIndex=0,e.replace(r,n=>W0[n])}function oh(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(qt(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&Pa(i)?r+=i:r+="%"+s,n+=2;continue}}r+=e[n]}return r}function X0(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(qt(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&Pa(i)?t+=i:t+="%"+s,r+=2;continue}}if(rh(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=ih(o)?n:Ee[o];else if(o<55296||o>57343)t+=_e(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=_e(65536+(o-55296<<10)+(s-56320)),r++):t+=_e(65533)}else t+=_e(65533)}}return t}function ex(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(qt(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/"&&(n=!1),rh(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Ee[i];else if(i<55296||i>57343)r+=_e(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);a>=56320&&a<=57343?(r+=_e(65536+(i-55296<<10)+(a-56320)),o++):r+=_e(65533)}else r+=_e(65533)}}return r}function Ta(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(qt(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Ee[s];else if(s<55296||s>57343)r+=_e(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);i>=56320&&i<=57343?(r+=_e(65536+(s-55296<<10)+(i-56320)),n++):r+=_e(65533)}else r+=_e(65533)}}return r}function sh(e){return Ta(e,U0)}function tx(e){return Ta(e,Ea)}function rx(e){return Ta(e,Ea)}function ih(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 nx(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(qt(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));Pa(i)?t+=i:t+="%"+s,r+=2;continue}}if(Ea(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=ih(o)?n:Ee[o];else if(o<55296||o>57343)t+=_e(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=_e(65536+(o-55296<<10)+(s-56320)),r++):t+=_e(65533)}else t+=_e(65533)}}return t}function ox(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(qt(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function sx(e){let t=[];if(e.userinfo!==void 0&&(t.push(sh(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!Sa(r)){let n=ka(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=oh(r,!0),n=ka(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=nh(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}ah.exports={nonSimpleDomain:H0,recomposeAuthority:sx,reescapeHostDelimiters:nh,normalizePercentEncoding:oh,normalizePathEncoding:X0,serializePathEncoding:ex,normalizeQueryFragmentEncoding:nx,encodeUserinfo:sh,encodeQuery:tx,encodeFragment:rx,escapePreservingEscapes:ox,removeDotSegments:B0,isIPv4:Sa,isUUID:M0,normalizeIPv6:ka,stringArrayToHexStripped:q0}});var ph=z((sA,dh)=>{"use strict";var{isUUID:ix}=Ra(),ax=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,cx=["http","https","ws","wss","urn","urn:uuid"];function ux(e){return cx.indexOf(e)!==-1}function Ia(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 ch(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function uh(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 lx(e){return e.secure=Ia(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function dx(e){if((e.port===(Ia(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 px(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(ax);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=Ca(o);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function fx(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=Ca(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 mx(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!ix(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function hx(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var lh={scheme:"http",domainHost:!0,parse:ch,serialize:uh},gx={scheme:"https",domainHost:lh.domainHost,parse:ch,serialize:uh},Do={scheme:"ws",domainHost:!0,parse:lx,serialize:dx},yx={scheme:"wss",domainHost:Do.domainHost,parse:Do.parse,serialize:Do.serialize},_x={scheme:"urn",parse:px,serialize:fx,skipNormalize:!0},vx={scheme:"urn:uuid",parse:mx,serialize:hx,skipNormalize:!0},Mo={http:lh,https:gx,ws:Do,wss:yx,urn:_x,"urn:uuid":vx};Object.setPrototypeOf(Mo,null);function Ca(e){return e&&(Mo[e]||Mo[e.toLowerCase()])||void 0}dh.exports={wsIsSecure:Ia,SCHEMES:Mo,isValidSchemeName:ux,getSchemeHandler:Ca}});var Sh=z((iA,Lo)=>{"use strict";var{normalizeIPv6:yh,removeDotSegments:vn,recomposeAuthority:wx,normalizePercentEncoding:_h,normalizePathEncoding:bx,serializePathEncoding:fh,normalizeQueryFragmentEncoding:mh,encodeQuery:$x,encodeFragment:xx,reescapeHostDelimiters:zx,isIPv4:vh,nonSimpleDomain:kx}=Ra(),{SCHEMES:wh,getSchemeHandler:Oa}=ph(),bh=/^[A-Za-z][A-Za-z0-9+.-]*$/u,$h="URI scheme is malformed.";function hh(e){let t=unescape(String(e));if(!bh.test(t))throw new TypeError($h);return t}function Sx(e,t){return typeof e=="string"?e=Ax(e,t):typeof e=="object"&&(e=qo(Lt(e,t),t)),e}function Px(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}=Uo(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:f,malformedHost:g,malformedScheme:_}=Uo(t,n);if(s||d||i||m||a||f||c||g||u||_)throw new Error(o.error||l.error||"URI is malformed.");let v=xh(o,l,n,!0),w=Oa(r&&r.scheme||v.scheme),k=v.host,x=k!==void 0&&k!==""&&(vh(k)||yh(k).isIPV6);zh(v,r||{},w,x);let S=k&&k.indexOf("%")!==-1&&!/\P{ASCII}/u.test(k);if(v.error&&!S)throw new Error(v.error);return n.skipEscape=!0,Lt(v,n)}function xh(e,t,r,n){let o={};return n||(e=qo(Lt(e,r),r),t=qo(Lt(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=vn(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=vn(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=vn(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=vn(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 Ex(e,t,r){let n=gh(e,r),o=gh(t,r);return n!==void 0&&o!==void 0&&n===o}function Lt(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=hh(r.scheme));let s=Oa(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=_h(r.path):r.path=fh(r.path,a)),n.reference!=="suffix"&&r.scheme&&(r.scheme=hh(r.scheme),o.push(r.scheme,":"));let c=wx(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=vn(u)),a&&(u=fh(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",$x(r.query)),r.fragment!==void 0&&o.push("#",xx(r.fragment)),o.join("")}var Tx=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Rx=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Ix=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Cx(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 _n(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 Ox(e){let t=e[4];return _n(e[3])||t!==void 0&&!(t[0]==="["&&t[t.length-1]==="]")&&_n(t)||_n(e[6])||_n(e[7])||_n(e[8])}function zh(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&e.host[0]!=="["&&(t.domainHost||r&&r.domainHost)&&n===!1&&kx(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 Uo(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 d=e.match(Rx);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let m=e.match(Ix);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(Tx);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 v=unescape(n.scheme);bh.test(v)?n.scheme=v.toLowerCase():(n.error=n.error||$h,u=!0)}s=Ox(f),s&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=f[5]);let g=Cx(n,f);if(g!==void 0&&(n.error=n.error||g,o=!0),n.host)if(vh(n.host)===!1){let w=n.host[0]==="["&&n.host[n.host.length-1]==="]",k=yh(n.host);l=k.isIPV6||k.isIPVFuture===!0,c=w&&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 _=Oa(r.scheme||n.scheme);if(a=zh(n,r,_,l),!_||_&&!_.skipNormalize){if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let v=l?n.host:_h(n.host,!0);n.host=zx(v,l)}n.path&&(n.path=bx(n.path)),n.query&&(n.query=mh(n.query)),n.fragment&&(n.fragment=mh(n.fragment))}_&&_.parse&&(_.parse(n,r),_===wh.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 qo(e,t){return Uo(e,t).parsed}function Ax(e,t){return kh(e,t).normalized}function kh(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=Uo(e,t);return{normalized:n||o||s||i||a?e:Lt(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function gh(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:Lt(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=kh(r,t);return o||s||i||a||c?void 0:n}var Aa={SCHEMES:wh,normalize:Sx,resolve:Px,resolveComponent:xh,equal:Ex,serialize:Lt,parse:qo};Lo.exports=Aa;Lo.exports.default=Aa;Lo.exports.fastUri=Aa});var Eh=z(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var Ph=Sh();Ph.code='require("ajv/dist/runtime/uri").default';Na.default=Ph});var jh=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 Nx=gn();Object.defineProperty(pe,"KeywordCxt",{enumerable:!0,get:function(){return Nx.KeywordCxt}});var hr=O();Object.defineProperty(pe,"_",{enumerable:!0,get:function(){return hr._}});Object.defineProperty(pe,"str",{enumerable:!0,get:function(){return hr.str}});Object.defineProperty(pe,"stringify",{enumerable:!0,get:function(){return hr.stringify}});Object.defineProperty(pe,"nil",{enumerable:!0,get:function(){return hr.nil}});Object.defineProperty(pe,"Name",{enumerable:!0,get:function(){return hr.Name}});Object.defineProperty(pe,"CodeGen",{enumerable:!0,get:function(){return hr.CodeGen}});var jx=No(),Oh=yn(),Zx=sa(),wn=Zo(),Dx=O(),bn=fn(),Fo=pn(),Za=D(),Th=eh(),Mx=Eh(),Ah=(e,t)=>new RegExp(e,t);Ah.code="new RegExp";var Ux=["removeAdditional","useDefaults","coerceTypes"],qx=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Lx={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."},Fx={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Rh=200;function Vx(e){var t,r,n,o,s,i,a,c,u,l,d,m,f,g,_,v,w,k,x,S,P,Re,Ne,Rr,fs;let Ir=e.strict,ms=(t=e.code)===null||t===void 0?void 0:t.optimize,ru=ms===!0||ms===void 0?1:ms||0,nu=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Ah,Jy=(o=e.uriResolver)!==null&&o!==void 0?o:Mx.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:Ir)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:Ir)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Ir)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:Ir)!==null&&m!==void 0?m:"log",strictRequired:(g=(f=e.strictRequired)!==null&&f!==void 0?f:Ir)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:ru,regExp:nu}:{optimize:ru,regExp:nu},loopRequired:(_=e.loopRequired)!==null&&_!==void 0?_:Rh,loopEnum:(v=e.loopEnum)!==null&&v!==void 0?v:Rh,meta:(w=e.meta)!==null&&w!==void 0?w:!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:(Rr=e.unicodeRegExp)!==null&&Rr!==void 0?Rr:!0,int32range:(fs=e.int32range)!==null&&fs!==void 0?fs:!0,uriResolver:Jy}}var $n=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,...Vx(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new Dx.ValueScope({scope:{},prefixes:qx,es5:r,lines:n}),this.logger=Wx(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,Zx.getRules)(),Ih.call(this,Lx,t,"NOT SUPPORTED"),Ih.call(this,Fx,t,"DEPRECATED","warn"),this._metaOpts=Gx.call(this),t.formats&&Jx.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Kx.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Hx.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Th;n==="id"&&(o={...Th},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,d){await s.call(this,l.$schema);let m=this._addSchema(l,d);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(d){if(!(d instanceof Oh.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;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,bn.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=Ch.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new wn.SchemaEnv({schema:{},schemaId:n});if(r=wn.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=Ch.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,bn.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(Qx.call(this,n,r),!r)return(0,Za.eachItem)(n,s=>ja.call(this,s)),this;ez.call(this,r);let o={...r,type:(0,Fo.getJSONTypes)(r.type),schemaType:(0,Fo.getJSONTypes)(r.schemaType)};return(0,Za.eachItem)(n,o.type.length===0?s=>ja.call(this,s,o):s=>o.type.forEach(i=>ja.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]=Nh(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,bn.normalizeId)(i||n);let u=bn.getSchemaRefs.call(this,t,n);return c=new wn.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):wn.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{wn.compileSchema.call(this,t)}finally{this.opts=r}}};$n.ValidationError=jx.default;$n.MissingRefError=Oh.default;pe.default=$n;function Ih(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 Ch(e){return e=(0,bn.normalizeId)(e),this.schemas[e]||this.refs[e]}function Hx(){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 Jx(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function Kx(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 Gx(){let e={...this.opts};for(let t of Ux)delete e[t];return e}var Bx={log(){},warn(){},error(){}};function Wx(e){if(e===!1)return Bx;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 Yx=/^[a-z_$][a-z0-9_$:-]*$/i;function Qx(e,t){let{RULES:r}=this;if((0,Za.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Yx.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 ja(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,Fo.getJSONTypes)(t.type),schemaType:(0,Fo.getJSONTypes)(t.schemaType)}};t.before?Xx.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 Xx(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 ez(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Nh(t)),e.validateSchema=this.compile(t,!0))}var tz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Nh(e){return{anyOf:[e,tz]}}});var Zh=z(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var rz={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Da.default=rz});var qh=z(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.callRef=Ft.getValidate=void 0;var nz=yn(),Dh=Le(),Te=O(),gr=ft(),Mh=Zo(),Vo=D(),oz={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 d();let l=Mh.resolveRef.call(c,u,o,r);if(l===void 0)throw new nz.default(n.opts.uriResolver,o,r);if(l instanceof Mh.SchemaEnv)return m(l);return f(l);function d(){if(s===u)return Ho(e,i,s,s.$async);let g=t.scopeValue("root",{ref:u});return Ho(e,(0,Te._)`${g}.validate`,u,u.$async)}function m(g){let _=Uh(e,g);Ho(e,_,g,g.$async)}function f(g){let _=t.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Te.stringify)(g)}:{ref:g}),v=t.name("valid"),w=e.subschema({schema:g,dataTypes:[],schemaPath:Te.nil,topSchemaRef:_,errSchemaPath:r},v);e.mergeEvaluated(w),e.ok(v)}}};function Uh(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Te._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Ft.getValidate=Uh;function Ho(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?gr.default.this:Te.nil;n?l():d();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,Dh.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 d(){e.result((0,Dh.callValidateCode)(e,t,u),()=>f(t),()=>m(t))}function m(g){let _=(0,Te._)`${g}.errors`;o.assign(gr.default.vErrors,(0,Te._)`${gr.default.vErrors} === null ? ${_} : ${gr.default.vErrors}.concat(${_})`),o.assign(gr.default.errors,(0,Te._)`${gr.default.vErrors}.length`)}function f(g){var _;if(!s.opts.unevaluated)return;let v=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(s.props=Vo.mergeEvaluated.props(o,v.props,s.props));else{let w=o.var("props",(0,Te._)`${g}.evaluated.props`);s.props=Vo.mergeEvaluated.props(o,w,s.props,Te.Name)}if(s.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(s.items=Vo.mergeEvaluated.items(o,v.items,s.items));else{let w=o.var("items",(0,Te._)`${g}.evaluated.items`);s.items=Vo.mergeEvaluated.items(o,w,s.items,Te.Name)}}}Ft.callRef=Ho;Ft.default=oz});var Lh=z(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});var sz=Zh(),iz=qh(),az=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",sz.default,iz.default];Ma.default=az});var Fh=z(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});var Jo=O(),St=Jo.operators,Ko={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}},cz={message:({keyword:e,schemaCode:t})=>(0,Jo.str)`must be ${Ko[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Jo._)`{comparison: ${Ko[e].okStr}, limit: ${t}}`},uz={keyword:Object.keys(Ko),type:"number",schemaType:"number",$data:!0,error:cz,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Jo._)`${r} ${Ko[t].fail} ${n} || isNaN(${r})`)}};Ua.default=uz});var Vh=z(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var xn=O(),lz={message:({schemaCode:e})=>(0,xn.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,xn._)`{multipleOf: ${e}}`},dz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:lz,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,xn._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,xn._)`${i} !== parseInt(${i})`;e.fail$data((0,xn._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};qa.default=dz});var Jh=z(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});function Hh(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}La.default=Hh;Hh.code='require("ajv/dist/runtime/ucs2length").default'});var Kh=z(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var Vt=O(),pz=D(),fz=Jh(),mz={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Vt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Vt._)`{limit: ${e}}`},hz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:mz,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?Vt.operators.GT:Vt.operators.LT,i=o.opts.unicode===!1?(0,Vt._)`${r}.length`:(0,Vt._)`${(0,pz.useFunc)(e.gen,fz.default)}(${r})`;e.fail$data((0,Vt._)`${i} ${s} ${n}`)}};Fa.default=hz});var Gh=z(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var gz=Le(),yz=D(),yr=O(),_z={message:({schemaCode:e})=>(0,yr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,yr._)`{pattern: ${e}}`},vz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:_z,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,yr._)`new RegExp`:(0,yz.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,yr._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,yr._)`!${l}`)}else{let c=(0,gz.usePattern)(e,o);e.fail$data((0,yr._)`!${c}.test(${r})`)}}};Va.default=vz});var Bh=z(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});var zn=O(),wz={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,zn.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,zn._)`{limit: ${e}}`},bz={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:wz,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?zn.operators.GT:zn.operators.LT;e.fail$data((0,zn._)`Object.keys(${r}).length ${o} ${n}`)}};Ha.default=bz});var Wh=z(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var kn=Le(),Sn=O(),$z=D(),xz={message:({params:{missingProperty:e}})=>(0,Sn.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Sn._)`{missingProperty: ${e}}`},zz={keyword:"required",type:"object",schemaType:"array",$data:!0,error:xz,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 v=i.schemaEnv.baseId+i.errSchemaPath,w=`required property "${_}" is not defined at "${v}" (strictRequired)`;(0,$z.checkStrictMode)(i,w,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(Sn.nil,d);else for(let f of r)(0,kn.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,kn.checkMissingProp)(e,r,f)),(0,kn.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,kn.noPropertyInData)(t,o,f,a.ownProperties),()=>e.error())})}function m(f,g){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(g,(0,kn.propertyInData)(t,o,f,a.ownProperties)),t.if((0,Sn.not)(g),()=>{e.error(),t.break()})},Sn.nil)}}};Ja.default=zz});var Yh=z(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});var Pn=O(),kz={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Pn.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Pn._)`{limit: ${e}}`},Sz={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:kz,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Pn.operators.GT:Pn.operators.LT;e.fail$data((0,Pn._)`${r}.length ${o} ${n}`)}};Ka.default=Sz});var Go=z(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});var Qh=fa();Qh.code='require("ajv/dist/runtime/equal").default';Ga.default=Qh});var Xh=z(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});var Ba=pn(),fe=O(),Pz=D(),Ez=Go(),Tz={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}}`},Rz={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Tz,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,Ba.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`,()=>(d()?m:f)(g,_))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function m(g,_){let v=t.name("item"),w=(0,Ba.checkDataTypes)(u,v,a.opts.strictNumbers,Ba.DataType.Wrong),k=t.const("indices",(0,fe._)`{}`);t.for((0,fe._)`;${g}--;`,()=>{t.let(v,(0,fe._)`${r}[${g}]`),t.if(w,(0,fe._)`continue`),u.length>1&&t.if((0,fe._)`typeof ${v} == "string"`,(0,fe._)`${v} += "_"`),t.if((0,fe._)`typeof ${k}[${v}] == "number"`,()=>{t.assign(_,(0,fe._)`${k}[${v}]`),e.error(),t.assign(c,!1).break()}).code((0,fe._)`${k}[${v}] = ${g}`)})}function f(g,_){let v=(0,Pz.useFunc)(t,Ez.default),w=t.name("outer");t.label(w).for((0,fe._)`;${g}--;`,()=>t.for((0,fe._)`${_} = ${g}; ${_}--;`,()=>t.if((0,fe._)`${v}(${r}[${g}], ${r}[${_}])`,()=>{e.error(),t.assign(c,!1).break(w)})))}}};Wa.default=Rz});var eg=z(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});var Ya=O(),Iz=D(),Cz=Go(),Oz={message:"must be equal to constant",params:({schemaCode:e})=>(0,Ya._)`{allowedValue: ${e}}`},Az={keyword:"const",$data:!0,error:Oz,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s=="object"?e.fail$data((0,Ya._)`!${(0,Iz.useFunc)(t,Cz.default)}(${r}, ${o})`):e.fail((0,Ya._)`${s} !== ${r}`)}};Qa.default=Az});var tg=z(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});var En=O(),Nz=D(),jz=Go(),Zz={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,En._)`{allowedValues: ${e}}`},Dz={keyword:"enum",schemaType:"array",$data:!0,error:Zz,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,Nz.useFunc)(t,jz.default)),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,En.or)(...o.map((g,_)=>m(f,_)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,En._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,g){let _=o[g];return typeof _=="object"&&_!==null?(0,En._)`${u()}(${r}, ${f}[${g}])`:(0,En._)`${r} === ${_}`}}};Xa.default=Dz});var rg=z(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});var Mz=Fh(),Uz=Vh(),qz=Kh(),Lz=Gh(),Fz=Bh(),Vz=Wh(),Hz=Yh(),Jz=Xh(),Kz=eg(),Gz=tg(),Bz=[Mz.default,Uz.default,qz.default,Lz.default,Fz.default,Vz.default,Hz.default,Jz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Kz.default,Gz.default];ec.default=Bz});var rc=z(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.validateAdditionalItems=void 0;var Ht=O(),tc=D(),Wz={message:({params:{len:e}})=>(0,Ht.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Ht._)`{limit: ${e}}`},Yz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Wz,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,tc.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}ng(e,n)}};function ng(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,Ht._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Ht._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,tc.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Ht._)`${a} <= ${t.length}`);r.if((0,Ht.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:tc.Type.Num},u),i.allErrors||r.if((0,Ht.not)(u),()=>r.break())})}}Tn.validateAdditionalItems=ng;Tn.default=Yz});var nc=z(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.validateTuple=void 0;var og=O(),Bo=D(),Qz=Le(),Xz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return sg(e,"additionalItems",t);r.items=!0,!(0,Bo.alwaysValidSchema)(r,t)&&e.ok((0,Qz.validateArray)(e))}};function sg(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=Bo.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,og._)`${s}.length`);r.forEach((d,m)=>{(0,Bo.alwaysValidSchema)(a,d)||(n.if((0,og._)`${u} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(d){let{opts:m,errSchemaPath:f}=a,g=r.length,_=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(m.strictTuples&&!_){let v=`"${i}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Bo.checkStrictMode)(a,v,m.strictTuples)}}}Rn.validateTuple=sg;Rn.default=Xz});var ig=z(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});var ek=nc(),tk={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,ek.validateTuple)(e,"items")};oc.default=tk});var cg=z(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});var ag=O(),rk=D(),nk=Le(),ok=rc(),sk={message:({params:{len:e}})=>(0,ag.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ag._)`{limit: ${e}}`},ik={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:sk,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,rk.alwaysValidSchema)(n,t)&&(o?(0,ok.validateAdditionalItems)(e,o):e.ok((0,nk.validateArray)(e)))}};sc.default=ik});var ug=z(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});var Ve=O(),Wo=D(),ak={message:({params:{min:e,max:t}})=>t===void 0?(0,Ve.str)`must contain at least ${e} valid item(s)`:(0,Ve.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Ve._)`{minContains: ${e}}`:(0,Ve._)`{minContains: ${e}, maxContains: ${t}}`},ck={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:ak,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,Ve._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Wo.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Wo.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Wo.alwaysValidSchema)(s,r)){let _=(0,Ve._)`${l} >= ${i}`;a!==void 0&&(_=(0,Ve._)`${_} && ${l} <= ${a}`),e.pass(_);return}s.items=!0;let d=t.name("valid");a===void 0&&i===1?f(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,Ve._)`${o}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let _=t.name("_valid"),v=t.let("count",0);f(_,()=>t.if(_,()=>g(v)))}function f(_,v){t.forRange("i",0,l,w=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:Wo.Type.Num,compositeRule:!0},_),v()})}function g(_){t.code((0,Ve._)`${_}++`),a===void 0?t.if((0,Ve._)`${_} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,Ve._)`${_} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,Ve._)`${_} >= ${i}`,()=>t.assign(d,!0)))}}};ic.default=ck});var pg=z(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.validateSchemaDeps=nt.validatePropertyDeps=nt.error=void 0;var ac=O(),uk=D(),In=Le();nt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,ac.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,ac._)`{property: ${e},
|
|
7
7
|
missingProperty: ${n},
|
|
8
8
|
depsCount: ${t},
|
|
9
|
-
deps: ${r}}`};var ck={keyword:"dependencies",type:"object",schemaType:"object",error:nt.error,code(e){let[t,r]=uk(e);lg(e,t),dg(e,r)}};function uk({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 lg(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,Cn.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,Cn.checkReportMissingProp)(e,u)}):(r.if((0,ac._)`${c} && (${(0,Cn.checkMissingProp)(e,a,s)})`),(0,Cn.reportMissingProp)(e,s),r.else())}}nt.validatePropertyDeps=lg;function dg(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t)(0,ak.alwaysValidSchema)(s,t[a])||(r.if((0,Cn.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))}nt.validateSchemaDeps=dg;nt.default=ck});var mg=z(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});var fg=O(),lk=D(),dk={message:"property name must be valid",params:({params:e})=>(0,fg._)`{propertyName: ${e.propertyName}}`},pk={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:dk,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,lk.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,fg.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};cc.default=pk});var lc=z(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});var Yo=Le(),Ye=O(),fk=ft(),Qo=D(),mk={message:"must NOT have additional properties",params:({params:e})=>(0,Ye._)`{additionalProperty: ${e.additionalProperty}}`},hk={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:mk,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,Qo.alwaysValidSchema)(i,r))return;let u=(0,Yo.allSchemaProperties)(n.properties),l=(0,Yo.allSchemaProperties)(n.patternProperties);d(),e.ok((0,Ye._)`${s} === ${fk.default.errors}`);function d(){t.forIn("key",o,v=>{!u.length&&!l.length?g(v):t.if(m(v),()=>g(v))})}function m(v){let w;if(u.length>8){let k=(0,Qo.schemaRefOrVal)(i,n.properties,"properties");w=(0,Yo.isOwnProperty)(t,k,v)}else u.length?w=(0,Ye.or)(...u.map(k=>(0,Ye._)`${v} === ${k}`)):w=Ye.nil;return l.length&&(w=(0,Ye.or)(w,...l.map(k=>(0,Ye._)`${(0,Yo.usePattern)(e,k)}.test(${v})`))),(0,Ye.not)(w)}function f(v){t.code((0,Ye._)`delete ${o}[${v}]`)}function g(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(v);return}if(r===!1){e.setParams({additionalProperty:v}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Qo.alwaysValidSchema)(i,r)){let w=t.name("valid");c.removeAdditional==="failing"?(_(v,w,!1),t.if((0,Ye.not)(w),()=>{e.reset(),f(v)})):(_(v,w),a||t.if((0,Ye.not)(w),()=>t.break()))}}function _(v,w,k){let x={keyword:"additionalProperties",dataProp:v,dataPropType:Qo.Type.Str};k===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,w)}}};uc.default=hk});var yg=z(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});var gk=yn(),hg=Le(),dc=D(),gg=lc(),yk={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&&gg.default.code(new gk.KeywordCxt(s,gg.default,"additionalProperties"));let i=(0,hg.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=dc.mergeEvaluated.props(t,(0,dc.toHash)(i),s.props));let a=i.filter(d=>!(0,dc.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)u(d)?l(d):(t.if((0,hg.propertyInData)(t,o,d,s.opts.ownProperties)),l(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};pc.default=yk});var bg=z(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});var _g=Le(),Xo=O(),vg=D(),wg=D(),_k={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,_g.allSchemaProperties)(r),c=a.filter(_=>(0,vg.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 Xo.Name)&&(s.props=(0,wg.evaluatedPropsToName)(t,s.props));let{props:d}=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 v in u)new RegExp(_).test(v)&&(0,vg.checkStrictMode)(s,`property ${v} matches pattern ${_} (use allowMatchingProperties)`)}function g(_){t.forIn("key",n,v=>{t.if((0,Xo._)`${(0,_g.usePattern)(e,_)}.test(${v})`,()=>{let w=c.includes(_);w||e.subschema({keyword:"patternProperties",schemaProp:_,dataProp:v,dataPropType:wg.Type.Str},l),s.opts.unevaluated&&d!==!0?t.assign((0,Xo._)`${d}[${v}]`,!0):!w&&!s.allErrors&&t.if((0,Xo.not)(l),()=>t.break())})})}}};fc.default=_k});var $g=z(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});var vk=D(),wk={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,vk.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"}};mc.default=wk});var xg=z(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});var bk=Le(),$k={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:bk.validateUnion,error:{message:"must match a schema in anyOf"}};hc.default=$k});var zg=z(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});var es=O(),xk=D(),zk={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,es._)`{passingSchemas: ${e.passing}}`},kk={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:zk,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,d)=>{let m;(0,xk.alwaysValidSchema)(o,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,es._)`${c} && ${i}`).assign(i,!1).assign(a,(0,es._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),m&&e.mergeEvaluated(m,es.Name)})})}}};gc.default=kk});var kg=z(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});var Sk=D(),Pk={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,Sk.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};yc.default=Pk});var Eg=z(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});var ts=O(),Pg=D(),Ek={message:({params:e})=>(0,ts.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,ts._)`{failingKeyword: ${e.ifClause}}`},Tk={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Ek,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Pg.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,ts.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,d){return()=>{let m=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(m,i),d?t.assign(d,(0,ts._)`${l}`):e.setParams({ifClause:l})}}}};function Sg(e,t){let r=e.schema[t];return r!==void 0&&!(0,Pg.alwaysValidSchema)(e,r)}_c.default=Tk});var Tg=z(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});var Rk=D(),Ik={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Rk.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};vc.default=Ik});var Rg=z(wc=>{"use strict";Object.defineProperty(wc,"__esModule",{value:!0});var Ck=rc(),Ok=ig(),Nk=nc(),Ak=cg(),jk=ug(),Zk=pg(),Dk=mg(),Mk=lc(),Uk=yg(),qk=bg(),Lk=$g(),Fk=xg(),Vk=zg(),Hk=kg(),Jk=Eg(),Kk=Tg();function Gk(e=!1){let t=[Lk.default,Fk.default,Vk.default,Hk.default,Jk.default,Kk.default,Dk.default,Mk.default,Zk.default,Uk.default,qk.default];return e?t.push(Ok.default,Ak.default):t.push(Ck.default,Nk.default),t.push(jk.default),t}wc.default=Gk});var Ig=z(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});var ne=O(),Bk={message:({schemaCode:e})=>(0,ne.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ne._)`{format: ${e}}`},Wk={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Bk,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?m():f();function m(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),_=r.const("fDef",(0,ne._)`${g}[${i}]`),v=r.let("fType"),w=r.let("format");r.if((0,ne._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(v,(0,ne._)`${_}.type || "string"`).assign(w,(0,ne._)`${_}.validate`),()=>r.assign(v,(0,ne._)`"string"`).assign(w,_)),e.fail$data((0,ne.or)(k(),x()));function k(){return c.strictSchema===!1?ne.nil:(0,ne._)`${i} && !${w}`}function x(){let S=l.$async?(0,ne._)`(${_}.async ? await ${w}(${n}) : ${w}(${n}))`:(0,ne._)`${w}(${n})`,P=(0,ne._)`(typeof ${w} == "function" ? ${S} : ${w}.test(${n}))`;return(0,ne._)`${w} && ${w} !== true && ${v} === ${t} && !${P}`}}function f(){let g=d.formats[s];if(!g){k();return}if(g===!0)return;let[_,v,w]=x(g);_===t&&e.pass(S());function k(){if(c.strictSchema===!1){d.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,Ae=r.scopeValue("formats",{key:s,ref:P,code:Re});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,ne._)`${Ae}.validate`]:["string",P,Ae]}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 ${w}(${n})`}return typeof v=="function"?(0,ne._)`${w}(${n})`:(0,ne._)`${w}.test(${n})`}}}};bc.default=Wk});var Cg=z($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});var Yk=Ig(),Qk=[Yk.default];$c.default=Qk});var Og=z(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.contentVocabulary=yr.metadataVocabulary=void 0;yr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];yr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Ag=z(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});var Xk=Lh(),eS=rg(),tS=Rg(),rS=Cg(),Ng=Og(),nS=[Xk.default,eS.default,(0,tS.default)(),rS.default,Ng.metadataVocabulary,Ng.contentVocabulary];xc.default=nS});var Zg=z(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.DiscrError=void 0;var jg;(function(e){e.Tag="tag",e.Mapping="mapping"})(jg||(rs.DiscrError=jg={}))});var Mg=z(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});var _r=O(),zc=Zg(),Dg=Zo(),oS=_n(),sS=D(),iS={message:({params:{discrError:e,tagName:t}})=>e===zc.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,_r._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},aS={keyword:"discriminator",type:"object",schemaType:"object",error:iS,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,_r._)`${r}${(0,_r.getProperty)(a)}`);t.if((0,_r._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:zc.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,_r._)`${u} === ${g}`),t.assign(c,d(f[g]));t.else(),e.error(!1,{discrError:zc.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(f){let g=t.name("valid"),_=e.subschema({keyword:"oneOf",schemaProp:f},g);return e.mergeEvaluated(_,_r.Name),g}function m(){var f;let g={},_=w(o),v=!0;for(let S=0;S<i.length;S++){let P=i[S];if(P?.$ref&&!(0,sS.schemaHasRulesButRef)(P,s.self.RULES)){let Ae=P.$ref;if(P=Dg.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Ae),P instanceof Dg.SchemaEnv&&(P=P.schema),P===void 0)throw new oS.default(s.opts.uriResolver,s.baseId,Ae)}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}"`);v=v&&(_||w(P)),k(Re,S)}if(!v)throw new Error(`discriminator: "${a}" must be required`);return g;function w({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}}}};kc.default=aS});var Ug=z((JN,cS)=>{cS.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 Lg=z((Y,Sc)=>{"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 uS=jh(),lS=Ag(),dS=Mg(),qg=Ug(),pS=["/properties"],ns="http://json-schema.org/draft-07/schema",vr=class extends uS.default{_addVocabularies(){super._addVocabularies(),lS.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(dS.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(qg,pS):qg;this.addMetaSchema(t,ns,!1),this.refs["http://json-schema.org/schema"]=ns}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ns)?ns:void 0)}};Y.Ajv=vr;Sc.exports=Y=vr;Sc.exports.Ajv=vr;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=vr;var fS=yn();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return fS.KeywordCxt}});var wr=O();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return wr._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return wr.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return wr.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return wr.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return wr.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return wr.CodeGen}});var mS=Ao();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return mS.default}});var hS=_n();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return hS.default}})});var Wg=z(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.formatNames=st.fastFormats=st.fullFormats=void 0;function ot(e,t){return{validate:e,compare:t}}st.fullFormats={date:ot(Jg,Rc),time:ot(Ec(!0),Ic),"date-time":ot(Fg(!0),Gg),"iso-time":ot(Ec(),Kg),"iso-date-time":ot(Fg(),Bg),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:bS,"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:ES,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:$S,int32:{type:"number",validate:kS},int64:{type:"number",validate:SS},float:{type:"number",validate:Hg},double:{type:"number",validate:Hg},password:!0,binary:!0};st.fastFormats={...st.fullFormats,date:ot(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Rc),time:ot(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ic),"date-time":ot(/^\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,Gg),"iso-time":ot(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Kg),"iso-date-time":ot(/^\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,Bg),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};st.formatNames=Object.keys(st.fullFormats);function gS(e){return e%4===0&&(e%100!==0||e%400===0)}var yS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,_S=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Jg(e){let t=yS.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&&gS(r)?29:_S[n])}function Rc(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Pc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Ec(e){return function(r){let n=Pc.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 d=s-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function Ic(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=Pc.exec(e),n=Pc.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 Tc=/t|\s/i;function Fg(e){let t=Ec(e);return function(n){let o=n.split(Tc);return o.length===2&&Jg(o[0])&&t(o[1])}}function Gg(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function Bg(e,t){if(!(e&&t))return;let[r,n]=e.split(Tc),[o,s]=t.split(Tc),i=Rc(r,o);if(i!==void 0)return i||Ic(n,s)}var vS=/\/|:/,wS=/^(?:[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 bS(e){return vS.test(e)&&wS.test(e)}var Vg=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function $S(e){return Vg.lastIndex=0,Vg.test(e)}var xS=-(2**31),zS=2**31-1;function kS(e){return Number.isInteger(e)&&e<=zS&&e>=xS}function SS(e){return Number.isInteger(e)}function Hg(){return!0}var PS=/[^\\]\\Z/;function ES(e){if(PS.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Yg=z(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.formatLimitDefinition=void 0;var TS=Lg(),Qe=O(),Pt=Qe.operators,os={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}},RS={message:({keyword:e,schemaCode:t})=>(0,Qe.str)`should be ${os[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Qe._)`{comparison: ${os[e].okStr}, limit: ${t}}`};br.formatLimitDefinition={keyword:Object.keys(os),type:"string",schemaType:"string",$data:!0,error:RS,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 TS.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,Qe._)`${m}[${c.schemaCode}]`);e.fail$data((0,Qe.or)((0,Qe._)`typeof ${f} != "object"`,(0,Qe._)`${f} instanceof RegExp`,(0,Qe._)`typeof ${f}.compare != "function"`,d(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,Qe._)`${i.code.formats}${(0,Qe.getProperty)(m)}`:void 0});e.fail$data(d(g))}function d(m){return(0,Qe._)`${m}.compare(${r}, ${n}) ${os[o].fail} 0`}},dependencies:["format"]};var IS=e=>(e.addKeyword(br.formatLimitDefinition),e);br.default=IS});var ty=z((On,ey)=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});var $r=Wg(),CS=Yg(),Cc=O(),Qg=new Cc.Name("fullFormats"),OS=new Cc.Name("fastFormats"),Oc=(e,t={keywords:!0})=>{if(Array.isArray(t))return Xg(e,t,$r.fullFormats,Qg),e;let[r,n]=t.mode==="fast"?[$r.fastFormats,OS]:[$r.fullFormats,Qg],o=t.formats||$r.formatNames;return Xg(e,o,r,n),t.keywords&&(0,CS.default)(e),e};Oc.get=(e,t="full")=>{let n=(t==="fast"?$r.fastFormats:$r.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function Xg(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Cc._)`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}ey.exports=On=Oc;Object.defineProperty(On,"__esModule",{value:!0});On.default=Oc});import{readFileSync as SP}from"node:fs";import{dirname as PP,join as EP}from"node:path";import{fileURLToPath as TP}from"node:url";import{parseArgs as RP}from"node:util";import{execFileSync as wy,spawnSync as Tr}from"node:child_process";import{readFileSync as Hc}from"node:fs";import{homedir as rP}from"node:os";import{join as nP}from"node:path";import*as by from"node:readline/promises";import*as Je from"node:fs";import*as ou from"node:os";import*as ie from"node:path";var Nr=process.env.GIGABUDDY_HOME??ie.join(ou.homedir(),".gigabuddy"),Ct="default",su=ie.join(Nr,"accounts"),iu=ie.join(Nr,"config.json");function Or(e){return/^[a-z0-9][a-z0-9._-]{0,63}$/i.test(e)&&e!=="accounts"}function Kt(e){if(!Or(e))throw new Error(`Invalid account name "${e}" \u2014 use letters, digits, dots, dashes or underscores (max 64 chars).`)}function ys(e){return Kt(e),e===Ct?Nr:ie.join(su,e)}function Yn(){let e=[];try{for(let t of Je.readdirSync(su,{withFileTypes:!0}))t.isDirectory()&&Or(t.name)&&e.push(t.name)}catch{}return[Ct,...e.sort()]}function Gt(){try{return JSON.parse(Je.readFileSync(iu,"utf-8"))}catch{return{}}}function _s(e){Je.existsSync(Nr)||Je.mkdirSync(Nr,{recursive:!0,mode:448}),Je.writeFileSync(iu,JSON.stringify(e,null,2)+`
|
|
10
|
-
`,{mode:384})}function au(e){Kt(e);let t=Gt();t.defaultAccount=e,_s(t)}function vs(e,t){Kt(t);let r=Gt();r.pins={...r.pins,[ie.resolve(e)]:t},_s(r)}function cu(e){let t=Gt(),r=ie.resolve(e);return t.pins?.[r]?(delete t.pins[r],_s(t),!0):!1}function Ar(e){let t=ie.resolve(e);for(;;){if(Je.existsSync(ie.join(t,".git")))return t;let r=ie.dirname(t);if(r===t)return ie.resolve(e);t=r}}function Qy(e,t){let r=ie.relative(e,t);return r===""||!r.startsWith("..")&&!ie.isAbsolute(r)}function Xe(e=process.cwd()){let t=process.env.GIGABUDDY_ACCOUNT;if(t&&Or(t))return{name:t,source:"env"};let r=Gt(),n=ie.resolve(e),o;for(let[s,i]of Object.entries(r.pins??{}))Or(i)&&Qy(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&&Or(r.defaultAccount)?{name:r.defaultAccount,source:"config-default"}:{name:Ct,source:"fallback"}}import*as Ie from"node:fs";import*as uu from"node:path";var Xy={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 jr(e=!1,t="shared",r){let n=Xy[t];return uu.join(ys(r??Xe().name),e?n.staging:n.prod)}function je(e=!1,t="shared",r){try{let n=Ie.readFileSync(jr(e,t,r),"utf-8"),o=JSON.parse(n);return o.refreshToken?o:null}catch{return null}}function ws(e,t=!1,r="shared",n){let o=ys(n??Xe().name);Ie.existsSync(o)||Ie.mkdirSync(o,{recursive:!0,mode:448}),Qn(jr(t,r,n),JSON.stringify(e,null,2))}function lu(e=!1,t="shared",r){let n=jr(e,t,r);Ie.existsSync(n)&&Ie.unlinkSync(n)}function Qn(e,t){Ie.writeFileSync(e,t,{mode:384});try{Ie.chmodSync(e,384)}catch{}}var du,bs=Object.freeze({status:"aborted"});function y(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 d=0;d<l.length;d++){let m=l[d];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 e_=Symbol("zod_brand"),et=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Bt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(du=globalThis).__zod_globalConfig??(du.__zod_globalConfig={});var Wt=globalThis.__zod_globalConfig;function xe(e){return e&&Object.assign(Wt,e),Wt}var j={};gs(j,{BIGINT_FORMAT_RANGES:()=>hu,Class:()=>xs,NUMBER_FORMAT_RANGES:()=>Ts,aborted:()=>yt,allowsEval:()=>Ss,assert:()=>s_,assertEqual:()=>t_,assertIs:()=>n_,assertNever:()=>o_,assertNotEqual:()=>r_,assignProp:()=>ht,base64ToUint8Array:()=>yu,base64urlToUint8Array:()=>$_,cached:()=>Qt,captureStackTrace:()=>to,cleanEnum:()=>b_,cleanRegex:()=>Ur,clone:()=>Ze,cloneDef:()=>a_,createTransparentProxy:()=>f_,defineLazy:()=>L,esc:()=>eo,escapeRegex:()=>at,explicitlyAborted:()=>Rs,extend:()=>g_,finalizeIssue:()=>De,floatSafeRemainder:()=>zs,getElementAtPath:()=>c_,getEnumValues:()=>Dr,getLengthableOrigin:()=>qr,getParsedType:()=>p_,getSizableOrigin:()=>gu,hexToUint8Array:()=>z_,isObject:()=>Ot,isPlainObject:()=>gt,issue:()=>Xt,joinValues:()=>Xn,jsonStringifyReplacer:()=>Yt,merge:()=>__,mergeDefs:()=>it,normalizeParams:()=>R,nullish:()=>Mr,numKeys:()=>d_,objectClone:()=>i_,omit:()=>h_,optionalKeys:()=>Es,parsedType:()=>Is,partial:()=>v_,pick:()=>m_,prefixIssues:()=>ct,primitiveTypes:()=>mu,promiseAllObject:()=>u_,propertyKeyTypes:()=>Ps,randomString:()=>l_,required:()=>w_,safeExtend:()=>y_,shallowClone:()=>fu,slugify:()=>ks,stringifyPrimitive:()=>ro,uint8ArrayToBase64:()=>_u,uint8ArrayToBase64url:()=>x_,uint8ArrayToHex:()=>k_,unwrapMessage:()=>Zr});function t_(e){return e}function r_(e){return e}function n_(e){}function o_(e){throw new Error("Unexpected value in exhaustive check")}function s_(e){}function Dr(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 Xn(e,t="|"){return e.map(r=>ro(r)).join(t)}function Yt(e,t){return typeof t=="bigint"?t.toString():t}function Qt(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Mr(e){return e==null}function Ur(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function zs(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 pu=Symbol("evaluating");function L(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==pu)return n===void 0&&(n=pu,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function i_(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 it(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function a_(e){return it(e._zod.def)}function c_(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function u_(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 l_(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function eo(e){return JSON.stringify(e)}function ks(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var to="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ot(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ss=Qt(()=>{if(Wt.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(Ot(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ot(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function fu(e){return gt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function d_(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var p_=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}`)}},Ps=new Set(["string","number","symbol"]),mu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function at(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(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 f_(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 ro(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Es(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ts={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]},hu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function m_(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=it(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 Ze(e,s)}function h_(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=it(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 Ze(e,s)}function g_(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=it(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return ht(this,"shape",s),s}});return Ze(e,o)}function y_(e,t){if(!gt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=it(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ht(this,"shape",n),n}});return Ze(e,r)}function __(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=it(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 Ze(e,r)}function v_(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=it(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 Ze(t,i)}function w_(e,t,r){let n=it(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 Ze(t,n)}function yt(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 Rs(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 ct(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Zr(e){return typeof e=="string"?e:e?.message}function De(e,t,r){let n=e.message?e.message:Zr(e.inst?._zod.def?.error?.(e))??Zr(t?.error?.(e))??Zr(r.customError?.(e))??Zr(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 gu(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function qr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Is(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 Xt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function b_(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function yu(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 _u(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function $_(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return yu(t+r)}function x_(e){return _u(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function z_(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 k_(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var xs=class{constructor(...t){}};var vu=(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,Yt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},no=y("$ZodError",vu),Cs=y("$ZodError",vu,{Parent:Error});function Os(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 Ns(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 oo=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 et;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>De(c,s,xe())));throw to(a,o?.callee),a}return i.value};var so=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=>De(c,s,xe())));throw to(a,o?.callee),a}return i.value};var Lr=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 et;return s.issues.length?{success:!1,error:new(e??no)(s.issues.map(i=>De(i,o,xe())))}:{success:!0,data:s.value}},wu=Lr(Cs),Fr=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=>De(i,o,xe())))}:{success:!0,data:s.value}},bu=Fr(Cs),$u=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return oo(e)(t,r,o)};var xu=e=>(t,r,n)=>oo(e)(t,r,n);var zu=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return so(e)(t,r,o)};var ku=e=>async(t,r,n)=>so(e)(t,r,n);var Su=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Lr(e)(t,r,o)};var Pu=e=>(t,r,n)=>Lr(e)(t,r,n);var Eu=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Fr(e)(t,r,o)};var Tu=e=>async(t,r,n)=>Fr(e)(t,r,n);var Ru=/^[cC][0-9a-z]{6,}$/,Iu=/^[0-9a-z]+$/,Cu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ou=/^[0-9a-vA-V]{20}$/,Nu=/^[A-Za-z0-9]{27}$/,Au=/^[a-zA-Z0-9_-]{21}$/,ju=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Zu=/^([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})$/,As=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 Du=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var P_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Mu(){return new RegExp(P_,"u")}var Uu=/^(?:(?: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])$/,qu=/^(([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 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])\/([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])$/,Vu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,js=/^[A-Za-z0-9_-]*$/;var Hu=/^https?$/,Ju=/^\+[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])))",Gu=new RegExp(`^${Ku}$`);function Bu(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 Wu(e){return new RegExp(`^${Bu(e)}$`)}function Yu(e){let t=Bu({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 Qu=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Xu=/^-?\d+n?$/,el=/^-?\d+$/,Zs=/^-?\d+(?:\.\d+)?$/,tl=/^(?:true|false)$/i,rl=/^null$/i;var nl=/^[^A-Z]*$/,ol=/^[^a-z]*$/;var ae=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),sl={number:"number",bigint:"bigint",object:"date"},Ds=y("$ZodCheckLessThan",(e,t)=>{ae.init(e,t);let r=sl[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})}}),Ms=y("$ZodCheckGreaterThan",(e,t)=>{ae.init(e,t);let r=sl[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})}}),il=y("$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):zs(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})}}),al=y("$ZodCheckNumberFormat",(e,t)=>{ae.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Ts[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=el)}),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 cl=y("$ZodCheckMaxLength",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Mr(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=qr(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ul=y("$ZodCheckMinLength",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Mr(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=qr(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ll=y("$ZodCheckLengthEquals",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Mr(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=qr(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})}}),Hr=y("$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=()=>{})}),dl=y("$ZodCheckRegex",(e,t)=>{Hr.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})}}),pl=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=nl),Hr.init(e,t)}),fl=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ol),Hr.init(e,t)}),ml=y("$ZodCheckIncludes",(e,t)=>{ae.init(e,t);let r=at(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})}}),hl=y("$ZodCheckStartsWith",(e,t)=>{ae.init(e,t);let r=new RegExp(`^${at(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})}}),gl=y("$ZodCheckEndsWith",(e,t)=>{ae.init(e,t);let r=new RegExp(`.*${at(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 yl=y("$ZodCheckOverwrite",(e,t)=>{ae.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var io=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(`
|
|
9
|
+
deps: ${r}}`};var lk={keyword:"dependencies",type:"object",schemaType:"object",error:nt.error,code(e){let[t,r]=dk(e);lg(e,t),dg(e,r)}};function dk({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 lg(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,In.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,In.checkReportMissingProp)(e,u)}):(r.if((0,ac._)`${c} && (${(0,In.checkMissingProp)(e,a,s)})`),(0,In.reportMissingProp)(e,s),r.else())}}nt.validatePropertyDeps=lg;function dg(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t)(0,uk.alwaysValidSchema)(s,t[a])||(r.if((0,In.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))}nt.validateSchemaDeps=dg;nt.default=lk});var mg=z(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});var fg=O(),pk=D(),fk={message:"property name must be valid",params:({params:e})=>(0,fg._)`{propertyName: ${e.propertyName}}`},mk={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:fk,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,pk.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,fg.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};cc.default=mk});var lc=z(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});var Yo=Le(),Ye=O(),hk=ft(),Qo=D(),gk={message:"must NOT have additional properties",params:({params:e})=>(0,Ye._)`{additionalProperty: ${e.additionalProperty}}`},yk={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:gk,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,Qo.alwaysValidSchema)(i,r))return;let u=(0,Yo.allSchemaProperties)(n.properties),l=(0,Yo.allSchemaProperties)(n.patternProperties);d(),e.ok((0,Ye._)`${s} === ${hk.default.errors}`);function d(){t.forIn("key",o,v=>{!u.length&&!l.length?g(v):t.if(m(v),()=>g(v))})}function m(v){let w;if(u.length>8){let k=(0,Qo.schemaRefOrVal)(i,n.properties,"properties");w=(0,Yo.isOwnProperty)(t,k,v)}else u.length?w=(0,Ye.or)(...u.map(k=>(0,Ye._)`${v} === ${k}`)):w=Ye.nil;return l.length&&(w=(0,Ye.or)(w,...l.map(k=>(0,Ye._)`${(0,Yo.usePattern)(e,k)}.test(${v})`))),(0,Ye.not)(w)}function f(v){t.code((0,Ye._)`delete ${o}[${v}]`)}function g(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(v);return}if(r===!1){e.setParams({additionalProperty:v}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Qo.alwaysValidSchema)(i,r)){let w=t.name("valid");c.removeAdditional==="failing"?(_(v,w,!1),t.if((0,Ye.not)(w),()=>{e.reset(),f(v)})):(_(v,w),a||t.if((0,Ye.not)(w),()=>t.break()))}}function _(v,w,k){let x={keyword:"additionalProperties",dataProp:v,dataPropType:Qo.Type.Str};k===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,w)}}};uc.default=yk});var yg=z(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});var _k=gn(),hg=Le(),dc=D(),gg=lc(),vk={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&&gg.default.code(new _k.KeywordCxt(s,gg.default,"additionalProperties"));let i=(0,hg.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=dc.mergeEvaluated.props(t,(0,dc.toHash)(i),s.props));let a=i.filter(d=>!(0,dc.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)u(d)?l(d):(t.if((0,hg.propertyInData)(t,o,d,s.opts.ownProperties)),l(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};pc.default=vk});var bg=z(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});var _g=Le(),Xo=O(),vg=D(),wg=D(),wk={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,_g.allSchemaProperties)(r),c=a.filter(_=>(0,vg.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 Xo.Name)&&(s.props=(0,wg.evaluatedPropsToName)(t,s.props));let{props:d}=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 v in u)new RegExp(_).test(v)&&(0,vg.checkStrictMode)(s,`property ${v} matches pattern ${_} (use allowMatchingProperties)`)}function g(_){t.forIn("key",n,v=>{t.if((0,Xo._)`${(0,_g.usePattern)(e,_)}.test(${v})`,()=>{let w=c.includes(_);w||e.subschema({keyword:"patternProperties",schemaProp:_,dataProp:v,dataPropType:wg.Type.Str},l),s.opts.unevaluated&&d!==!0?t.assign((0,Xo._)`${d}[${v}]`,!0):!w&&!s.allErrors&&t.if((0,Xo.not)(l),()=>t.break())})})}}};fc.default=wk});var $g=z(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});var bk=D(),$k={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,bk.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"}};mc.default=$k});var xg=z(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});var xk=Le(),zk={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:xk.validateUnion,error:{message:"must match a schema in anyOf"}};hc.default=zk});var zg=z(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});var es=O(),kk=D(),Sk={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,es._)`{passingSchemas: ${e.passing}}`},Pk={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Sk,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,d)=>{let m;(0,kk.alwaysValidSchema)(o,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,es._)`${c} && ${i}`).assign(i,!1).assign(a,(0,es._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),m&&e.mergeEvaluated(m,es.Name)})})}}};gc.default=Pk});var kg=z(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});var Ek=D(),Tk={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,Ek.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};yc.default=Tk});var Eg=z(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});var ts=O(),Pg=D(),Rk={message:({params:e})=>(0,ts.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,ts._)`{failingKeyword: ${e.ifClause}}`},Ik={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Rk,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Pg.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,ts.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,d){return()=>{let m=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(m,i),d?t.assign(d,(0,ts._)`${l}`):e.setParams({ifClause:l})}}}};function Sg(e,t){let r=e.schema[t];return r!==void 0&&!(0,Pg.alwaysValidSchema)(e,r)}_c.default=Ik});var Tg=z(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});var Ck=D(),Ok={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Ck.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};vc.default=Ok});var Rg=z(wc=>{"use strict";Object.defineProperty(wc,"__esModule",{value:!0});var Ak=rc(),Nk=ig(),jk=nc(),Zk=cg(),Dk=ug(),Mk=pg(),Uk=mg(),qk=lc(),Lk=yg(),Fk=bg(),Vk=$g(),Hk=xg(),Jk=zg(),Kk=kg(),Gk=Eg(),Bk=Tg();function Wk(e=!1){let t=[Vk.default,Hk.default,Jk.default,Kk.default,Gk.default,Bk.default,Uk.default,qk.default,Mk.default,Lk.default,Fk.default];return e?t.push(Nk.default,Zk.default):t.push(Ak.default,jk.default),t.push(Dk.default),t}wc.default=Wk});var Ig=z(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});var ne=O(),Yk={message:({schemaCode:e})=>(0,ne.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ne._)`{format: ${e}}`},Qk={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Yk,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?m():f();function m(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),_=r.const("fDef",(0,ne._)`${g}[${i}]`),v=r.let("fType"),w=r.let("format");r.if((0,ne._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(v,(0,ne._)`${_}.type || "string"`).assign(w,(0,ne._)`${_}.validate`),()=>r.assign(v,(0,ne._)`"string"`).assign(w,_)),e.fail$data((0,ne.or)(k(),x()));function k(){return c.strictSchema===!1?ne.nil:(0,ne._)`${i} && !${w}`}function x(){let S=l.$async?(0,ne._)`(${_}.async ? await ${w}(${n}) : ${w}(${n}))`:(0,ne._)`${w}(${n})`,P=(0,ne._)`(typeof ${w} == "function" ? ${S} : ${w}.test(${n}))`;return(0,ne._)`${w} && ${w} !== true && ${v} === ${t} && !${P}`}}function f(){let g=d.formats[s];if(!g){k();return}if(g===!0)return;let[_,v,w]=x(g);_===t&&e.pass(S());function k(){if(c.strictSchema===!1){d.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 ${w}(${n})`}return typeof v=="function"?(0,ne._)`${w}(${n})`:(0,ne._)`${w}.test(${n})`}}}};bc.default=Qk});var Cg=z($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});var Xk=Ig(),eS=[Xk.default];$c.default=eS});var Og=z(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.contentVocabulary=_r.metadataVocabulary=void 0;_r.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];_r.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Ng=z(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});var tS=Lh(),rS=rg(),nS=Rg(),oS=Cg(),Ag=Og(),sS=[tS.default,rS.default,(0,nS.default)(),oS.default,Ag.metadataVocabulary,Ag.contentVocabulary];xc.default=sS});var Zg=z(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.DiscrError=void 0;var jg;(function(e){e.Tag="tag",e.Mapping="mapping"})(jg||(rs.DiscrError=jg={}))});var Mg=z(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});var vr=O(),zc=Zg(),Dg=Zo(),iS=yn(),aS=D(),cS={message:({params:{discrError:e,tagName:t}})=>e===zc.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,vr._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},uS={keyword:"discriminator",type:"object",schemaType:"object",error:cS,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,vr._)`${r}${(0,vr.getProperty)(a)}`);t.if((0,vr._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:zc.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,vr._)`${u} === ${g}`),t.assign(c,d(f[g]));t.else(),e.error(!1,{discrError:zc.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(f){let g=t.name("valid"),_=e.subschema({keyword:"oneOf",schemaProp:f},g);return e.mergeEvaluated(_,vr.Name),g}function m(){var f;let g={},_=w(o),v=!0;for(let S=0;S<i.length;S++){let P=i[S];if(P?.$ref&&!(0,aS.schemaHasRulesButRef)(P,s.self.RULES)){let Ne=P.$ref;if(P=Dg.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Ne),P instanceof Dg.SchemaEnv&&(P=P.schema),P===void 0)throw new iS.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}"`);v=v&&(_||w(P)),k(Re,S)}if(!v)throw new Error(`discriminator: "${a}" must be required`);return g;function w({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}}}};kc.default=uS});var Ug=z((GA,lS)=>{lS.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 Lg=z((Y,Sc)=>{"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 dS=jh(),pS=Ng(),fS=Mg(),qg=Ug(),mS=["/properties"],ns="http://json-schema.org/draft-07/schema",wr=class extends dS.default{_addVocabularies(){super._addVocabularies(),pS.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(fS.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(qg,mS):qg;this.addMetaSchema(t,ns,!1),this.refs["http://json-schema.org/schema"]=ns}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ns)?ns:void 0)}};Y.Ajv=wr;Sc.exports=Y=wr;Sc.exports.Ajv=wr;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=wr;var hS=gn();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return hS.KeywordCxt}});var br=O();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return br._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return br.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return br.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return br.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return br.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return br.CodeGen}});var gS=No();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return gS.default}});var yS=yn();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return yS.default}})});var Wg=z(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.formatNames=st.fastFormats=st.fullFormats=void 0;function ot(e,t){return{validate:e,compare:t}}st.fullFormats={date:ot(Jg,Rc),time:ot(Ec(!0),Ic),"date-time":ot(Fg(!0),Gg),"iso-time":ot(Ec(),Kg),"iso-date-time":ot(Fg(),Bg),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:xS,"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:RS,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:zS,int32:{type:"number",validate:PS},int64:{type:"number",validate:ES},float:{type:"number",validate:Hg},double:{type:"number",validate:Hg},password:!0,binary:!0};st.fastFormats={...st.fullFormats,date:ot(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Rc),time:ot(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ic),"date-time":ot(/^\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,Gg),"iso-time":ot(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Kg),"iso-date-time":ot(/^\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,Bg),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};st.formatNames=Object.keys(st.fullFormats);function _S(e){return e%4===0&&(e%100!==0||e%400===0)}var vS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,wS=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Jg(e){let t=vS.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&&_S(r)?29:wS[n])}function Rc(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Pc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Ec(e){return function(r){let n=Pc.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 d=s-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function Ic(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=Pc.exec(e),n=Pc.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 Tc=/t|\s/i;function Fg(e){let t=Ec(e);return function(n){let o=n.split(Tc);return o.length===2&&Jg(o[0])&&t(o[1])}}function Gg(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function Bg(e,t){if(!(e&&t))return;let[r,n]=e.split(Tc),[o,s]=t.split(Tc),i=Rc(r,o);if(i!==void 0)return i||Ic(n,s)}var bS=/\/|:/,$S=/^(?:[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 xS(e){return bS.test(e)&&$S.test(e)}var Vg=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function zS(e){return Vg.lastIndex=0,Vg.test(e)}var kS=-(2**31),SS=2**31-1;function PS(e){return Number.isInteger(e)&&e<=SS&&e>=kS}function ES(e){return Number.isInteger(e)}function Hg(){return!0}var TS=/[^\\]\\Z/;function RS(e){if(TS.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Yg=z($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.formatLimitDefinition=void 0;var IS=Lg(),Qe=O(),Pt=Qe.operators,os={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}},CS={message:({keyword:e,schemaCode:t})=>(0,Qe.str)`should be ${os[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Qe._)`{comparison: ${os[e].okStr}, limit: ${t}}`};$r.formatLimitDefinition={keyword:Object.keys(os),type:"string",schemaType:"string",$data:!0,error:CS,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 IS.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,Qe._)`${m}[${c.schemaCode}]`);e.fail$data((0,Qe.or)((0,Qe._)`typeof ${f} != "object"`,(0,Qe._)`${f} instanceof RegExp`,(0,Qe._)`typeof ${f}.compare != "function"`,d(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,Qe._)`${i.code.formats}${(0,Qe.getProperty)(m)}`:void 0});e.fail$data(d(g))}function d(m){return(0,Qe._)`${m}.compare(${r}, ${n}) ${os[o].fail} 0`}},dependencies:["format"]};var OS=e=>(e.addKeyword($r.formatLimitDefinition),e);$r.default=OS});var ty=z((Cn,ey)=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});var xr=Wg(),AS=Yg(),Cc=O(),Qg=new Cc.Name("fullFormats"),NS=new Cc.Name("fastFormats"),Oc=(e,t={keywords:!0})=>{if(Array.isArray(t))return Xg(e,t,xr.fullFormats,Qg),e;let[r,n]=t.mode==="fast"?[xr.fastFormats,NS]:[xr.fullFormats,Qg],o=t.formats||xr.formatNames;return Xg(e,o,r,n),t.keywords&&(0,AS.default)(e),e};Oc.get=(e,t="full")=>{let n=(t==="fast"?xr.fastFormats:xr.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function Xg(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Cc._)`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}ey.exports=Cn=Oc;Object.defineProperty(Cn,"__esModule",{value:!0});Cn.default=Oc});import{readFileSync as EP}from"node:fs";import{dirname as TP,join as RP}from"node:path";import{fileURLToPath as IP}from"node:url";import{parseArgs as CP}from"node:util";import{execFileSync as wy,spawnSync as Jt}from"node:child_process";import{readFileSync as Hc}from"node:fs";import{homedir as oP}from"node:os";import{join as sP}from"node:path";import*as by from"node:readline/promises";import*as Je from"node:fs";import*as ou from"node:os";import*as ie from"node:path";var Or=process.env.GIGABUDDY_HOME??ie.join(ou.homedir(),".gigabuddy"),Ct="default",su=ie.join(Or,"accounts"),iu=ie.join(Or,"config.json");function Cr(e){return/^[a-z0-9][a-z0-9._-]{0,63}$/i.test(e)&&e!=="accounts"}function Gt(e){if(!Cr(e))throw new Error(`Invalid account name "${e}" \u2014 use letters, digits, dots, dashes or underscores (max 64 chars).`)}function ys(e){return Gt(e),e===Ct?Or:ie.join(su,e)}function Yn(){let e=[];try{for(let t of Je.readdirSync(su,{withFileTypes:!0}))t.isDirectory()&&Cr(t.name)&&e.push(t.name)}catch{}return[Ct,...e.sort()]}function Bt(){try{return JSON.parse(Je.readFileSync(iu,"utf-8"))}catch{return{}}}function _s(e){Je.existsSync(Or)||Je.mkdirSync(Or,{recursive:!0,mode:448}),Je.writeFileSync(iu,JSON.stringify(e,null,2)+`
|
|
10
|
+
`,{mode:384})}function au(e){Gt(e);let t=Bt();t.defaultAccount=e,_s(t)}function vs(e,t){Gt(t);let r=Bt();r.pins={...r.pins,[ie.resolve(e)]:t},_s(r)}function cu(e){let t=Bt(),r=ie.resolve(e);return t.pins?.[r]?(delete t.pins[r],_s(t),!0):!1}function Ar(e){let t=ie.resolve(e);for(;;){if(Je.existsSync(ie.join(t,".git")))return t;let r=ie.dirname(t);if(r===t)return ie.resolve(e);t=r}}function e_(e,t){let r=ie.relative(e,t);return r===""||!r.startsWith("..")&&!ie.isAbsolute(r)}function Xe(e=process.cwd()){let t=process.env.GIGABUDDY_ACCOUNT;if(t&&Cr(t))return{name:t,source:"env"};let r=Bt(),n=ie.resolve(e),o;for(let[s,i]of Object.entries(r.pins??{}))Cr(i)&&e_(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&&Cr(r.defaultAccount)?{name:r.defaultAccount,source:"config-default"}:{name:Ct,source:"fallback"}}import*as Ie from"node:fs";import*as uu from"node:path";var t_={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 Nr(e=!1,t="shared",r){let n=t_[t];return uu.join(ys(r??Xe().name),e?n.staging:n.prod)}function je(e=!1,t="shared",r){try{let n=Ie.readFileSync(Nr(e,t,r),"utf-8"),o=JSON.parse(n);return o.refreshToken?o:null}catch{return null}}function ws(e,t=!1,r="shared",n){let o=ys(n??Xe().name);Ie.existsSync(o)||Ie.mkdirSync(o,{recursive:!0,mode:448}),Qn(Nr(t,r,n),JSON.stringify(e,null,2))}function lu(e=!1,t="shared",r){let n=Nr(e,t,r);Ie.existsSync(n)&&Ie.unlinkSync(n)}function Qn(e,t){Ie.writeFileSync(e,t,{mode:384});try{Ie.chmodSync(e,384)}catch{}}var du,bs=Object.freeze({status:"aborted"});function y(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 d=0;d<l.length;d++){let m=l[d];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 r_=Symbol("zod_brand"),et=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Wt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(du=globalThis).__zod_globalConfig??(du.__zod_globalConfig={});var Yt=globalThis.__zod_globalConfig;function xe(e){return e&&Object.assign(Yt,e),Yt}var j={};gs(j,{BIGINT_FORMAT_RANGES:()=>hu,Class:()=>xs,NUMBER_FORMAT_RANGES:()=>Ts,aborted:()=>yt,allowsEval:()=>Ss,assert:()=>a_,assertEqual:()=>n_,assertIs:()=>s_,assertNever:()=>i_,assertNotEqual:()=>o_,assignProp:()=>ht,base64ToUint8Array:()=>yu,base64urlToUint8Array:()=>z_,cached:()=>Xt,captureStackTrace:()=>to,cleanEnum:()=>x_,cleanRegex:()=>Mr,clone:()=>Ze,cloneDef:()=>u_,createTransparentProxy:()=>h_,defineLazy:()=>L,esc:()=>eo,escapeRegex:()=>at,explicitlyAborted:()=>Rs,extend:()=>__,finalizeIssue:()=>De,floatSafeRemainder:()=>zs,getElementAtPath:()=>l_,getEnumValues:()=>Zr,getLengthableOrigin:()=>Ur,getParsedType:()=>m_,getSizableOrigin:()=>gu,hexToUint8Array:()=>S_,isObject:()=>Ot,isPlainObject:()=>gt,issue:()=>er,joinValues:()=>Xn,jsonStringifyReplacer:()=>Qt,merge:()=>w_,mergeDefs:()=>it,normalizeParams:()=>R,nullish:()=>Dr,numKeys:()=>f_,objectClone:()=>c_,omit:()=>y_,optionalKeys:()=>Es,parsedType:()=>Is,partial:()=>b_,pick:()=>g_,prefixIssues:()=>ct,primitiveTypes:()=>mu,promiseAllObject:()=>d_,propertyKeyTypes:()=>Ps,randomString:()=>p_,required:()=>$_,safeExtend:()=>v_,shallowClone:()=>fu,slugify:()=>ks,stringifyPrimitive:()=>ro,uint8ArrayToBase64:()=>_u,uint8ArrayToBase64url:()=>k_,uint8ArrayToHex:()=>P_,unwrapMessage:()=>jr});function n_(e){return e}function o_(e){return e}function s_(e){}function i_(e){throw new Error("Unexpected value in exhaustive check")}function a_(e){}function Zr(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 Xn(e,t="|"){return e.map(r=>ro(r)).join(t)}function Qt(e,t){return typeof t=="bigint"?t.toString():t}function Xt(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Dr(e){return e==null}function Mr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function zs(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 pu=Symbol("evaluating");function L(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==pu)return n===void 0&&(n=pu,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function c_(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 it(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function u_(e){return it(e._zod.def)}function l_(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function d_(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 eo(e){return JSON.stringify(e)}function ks(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var to="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ot(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ss=Xt(()=>{if(Yt.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(Ot(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ot(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function fu(e){return gt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function f_(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var m_=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}`)}},Ps=new Set(["string","number","symbol"]),mu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function at(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(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 h_(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 ro(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Es(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ts={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]},hu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function g_(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=it(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 Ze(e,s)}function y_(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=it(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 Ze(e,s)}function __(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=it(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return ht(this,"shape",s),s}});return Ze(e,o)}function v_(e,t){if(!gt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=it(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ht(this,"shape",n),n}});return Ze(e,r)}function w_(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=it(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 Ze(e,r)}function b_(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=it(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 Ze(t,i)}function $_(e,t,r){let n=it(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 Ze(t,n)}function yt(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 Rs(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 ct(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function jr(e){return typeof e=="string"?e:e?.message}function De(e,t,r){let n=e.message?e.message:jr(e.inst?._zod.def?.error?.(e))??jr(t?.error?.(e))??jr(r.customError?.(e))??jr(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 gu(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ur(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Is(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 er(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function x_(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function yu(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 _u(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function z_(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return yu(t+r)}function k_(e){return _u(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function S_(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 P_(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var xs=class{constructor(...t){}};var vu=(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,Qt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},no=y("$ZodError",vu),Cs=y("$ZodError",vu,{Parent:Error});function Os(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 As(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 oo=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 et;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>De(c,s,xe())));throw to(a,o?.callee),a}return i.value};var so=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=>De(c,s,xe())));throw to(a,o?.callee),a}return i.value};var qr=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 et;return s.issues.length?{success:!1,error:new(e??no)(s.issues.map(i=>De(i,o,xe())))}:{success:!0,data:s.value}},wu=qr(Cs),Lr=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=>De(i,o,xe())))}:{success:!0,data:s.value}},bu=Lr(Cs),$u=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return oo(e)(t,r,o)};var xu=e=>(t,r,n)=>oo(e)(t,r,n);var zu=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return so(e)(t,r,o)};var ku=e=>async(t,r,n)=>so(e)(t,r,n);var Su=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return qr(e)(t,r,o)};var Pu=e=>(t,r,n)=>qr(e)(t,r,n);var Eu=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Lr(e)(t,r,o)};var Tu=e=>async(t,r,n)=>Lr(e)(t,r,n);var Ru=/^[cC][0-9a-z]{6,}$/,Iu=/^[0-9a-z]+$/,Cu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ou=/^[0-9a-vA-V]{20}$/,Au=/^[A-Za-z0-9]{27}$/,Nu=/^[a-zA-Z0-9_-]{21}$/,ju=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Zu=/^([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})$/,Ns=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 Du=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var T_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Mu(){return new RegExp(T_,"u")}var Uu=/^(?:(?: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])$/,qu=/^(([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 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])\/([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])$/,Vu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,js=/^[A-Za-z0-9_-]*$/;var Hu=/^https?$/,Ju=/^\+[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])))",Gu=new RegExp(`^${Ku}$`);function Bu(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 Wu(e){return new RegExp(`^${Bu(e)}$`)}function Yu(e){let t=Bu({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 Qu=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Xu=/^-?\d+n?$/,el=/^-?\d+$/,Zs=/^-?\d+(?:\.\d+)?$/,tl=/^(?:true|false)$/i,rl=/^null$/i;var nl=/^[^A-Z]*$/,ol=/^[^a-z]*$/;var ae=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),sl={number:"number",bigint:"bigint",object:"date"},Ds=y("$ZodCheckLessThan",(e,t)=>{ae.init(e,t);let r=sl[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})}}),Ms=y("$ZodCheckGreaterThan",(e,t)=>{ae.init(e,t);let r=sl[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})}}),il=y("$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):zs(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})}}),al=y("$ZodCheckNumberFormat",(e,t)=>{ae.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Ts[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=el)}),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 cl=y("$ZodCheckMaxLength",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Dr(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=Ur(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ul=y("$ZodCheckMinLength",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Dr(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=Ur(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ll=y("$ZodCheckLengthEquals",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Dr(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=Ur(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})}}),Vr=y("$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=()=>{})}),dl=y("$ZodCheckRegex",(e,t)=>{Vr.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})}}),pl=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=nl),Vr.init(e,t)}),fl=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ol),Vr.init(e,t)}),ml=y("$ZodCheckIncludes",(e,t)=>{ae.init(e,t);let r=at(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})}}),hl=y("$ZodCheckStartsWith",(e,t)=>{ae.init(e,t);let r=new RegExp(`^${at(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})}}),gl=y("$ZodCheckEndsWith",(e,t)=>{ae.init(e,t);let r=new RegExp(`.*${at(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 yl=y("$ZodCheckOverwrite",(e,t)=>{ae.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var io=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(`
|
|
11
11
|
`).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(`
|
|
12
|
-
`))}};var vl={major:4,minor:4,patch:3};var F=y("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=vl;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=yt(i),l;for(let d of a){if(d._zod.def.when){if(Rs(i)||!d._zod.def.when(i))continue}else if(u)continue;let m=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new et;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==m&&(u||(u=yt(i,m)))});else{if(i.issues.length===m)continue;u||(u=yt(i,m))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(yt(i))return i.aborted=!0,i;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new et;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 et;return c.then(u=>o(u,n,a))}return o(c,n,a)}}L(e,"~standard",()=>({validate:o=>{try{let s=wu(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return bu(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),uo=y("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qu(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=y("$ZodStringFormat",(e,t)=>{Hr.init(e,t),uo.init(e,t)}),El=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Zu),B.init(e,t)}),Tl=y("$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=As(n))}else t.pattern??(t.pattern=As());B.init(e,t)}),Rl=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Du),B.init(e,t)}),Il=y("$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})}}}),Cl=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Mu()),B.init(e,t)}),Ol=y("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Au),B.init(e,t)}),Nl=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ru),B.init(e,t)}),Al=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Iu),B.init(e,t)}),jl=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Cu),B.init(e,t)}),Zl=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ou),B.init(e,t)}),Dl=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Nu),B.init(e,t)}),Ml=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Yu(t)),B.init(e,t)}),Ul=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Gu),B.init(e,t)}),ql=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Wu(t)),B.init(e,t)}),Ll=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ju),B.init(e,t)}),Fl=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Uu),B.init(e,t),e._zod.bag.format="ipv4"}),Vl=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=qu),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=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Lu),B.init(e,t)}),Jl=y("$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 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 Gl=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Vu),B.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 E_(e){if(!js.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Kl(r)}var Bl=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=js),B.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{E_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Wl=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ju),B.init(e,t)});function T_(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 Yl=y("$ZodJWT",(e,t)=>{B.init(e,t),e._zod.check=r=>{T_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var qs=y("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??Zs,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}}),Ql=y("$ZodNumberFormat",(e,t)=>{al.init(e,t),qs.init(e,t)}),Xl=y("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=tl,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}}),ed=y("$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 td=y("$ZodNull",(e,t)=>{F.init(e,t),e._zod.pattern=rl,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}}),rd=y("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),nd=y("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),od=y("$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 sd=y("$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 wl(e,t,r){e.issues.length&&t.issues.push(...ct(r,e.issues)),t.value[r]=e.value}var id=y("$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=>wl(u,r,i))):wl(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function co(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...ct(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 ad(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=Es(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function cd(e,t,r,n,o,s){let i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optin==="optional",d=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=>co(g,r,m,t,l,d))):co(f,r,m,t,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var R_=y("$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=Qt(()=>ad(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 d of l.values)c[u].add(d)}}return c});let o=Ot,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=[],d=i.shape;for(let m of i.keys){let f=d[m],g=f._zod.optin==="optional",_=f._zod.optout==="optional",v=f._zod.run({value:u[m],issues:[]},c);v instanceof Promise?l.push(v.then(w=>co(w,a,m,u,g,_))):co(v,a,m,u,g,_)}return s?cd(l,u,a,c,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),ud=y("$ZodObjectJIT",(e,t)=>{R_.init(e,t);let r=e._zod.parse,n=Qt(()=>ad(t)),o=m=>{let f=new io(["shape","payload","ctx"]),g=n.value,_=x=>{let S=eo(x);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");let v=Object.create(null),w=0;for(let x of g.keys)v[x]=`key_${w++}`;f.write("const newResult = {};");for(let x of g.keys){let S=v[x],P=eo(x),Re=m[x],Ae=Re?._zod?.optin==="optional",Ir=Re?._zod?.optout==="optional";f.write(`const ${S} = ${_(x)};`),Ae&&Ir?f.write(`
|
|
12
|
+
`))}};var vl={major:4,minor:4,patch:3};var F=y("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=vl;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=yt(i),l;for(let d of a){if(d._zod.def.when){if(Rs(i)||!d._zod.def.when(i))continue}else if(u)continue;let m=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new et;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==m&&(u||(u=yt(i,m)))});else{if(i.issues.length===m)continue;u||(u=yt(i,m))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(yt(i))return i.aborted=!0,i;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new et;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 et;return c.then(u=>o(u,n,a))}return o(c,n,a)}}L(e,"~standard",()=>({validate:o=>{try{let s=wu(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return bu(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),uo=y("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qu(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=y("$ZodStringFormat",(e,t)=>{Vr.init(e,t),uo.init(e,t)}),El=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Zu),B.init(e,t)}),Tl=y("$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=Ns(n))}else t.pattern??(t.pattern=Ns());B.init(e,t)}),Rl=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Du),B.init(e,t)}),Il=y("$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})}}}),Cl=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Mu()),B.init(e,t)}),Ol=y("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Nu),B.init(e,t)}),Al=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ru),B.init(e,t)}),Nl=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Iu),B.init(e,t)}),jl=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Cu),B.init(e,t)}),Zl=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ou),B.init(e,t)}),Dl=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Au),B.init(e,t)}),Ml=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Yu(t)),B.init(e,t)}),Ul=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Gu),B.init(e,t)}),ql=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Wu(t)),B.init(e,t)}),Ll=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ju),B.init(e,t)}),Fl=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Uu),B.init(e,t),e._zod.bag.format="ipv4"}),Vl=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=qu),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=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Lu),B.init(e,t)}),Jl=y("$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 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 Gl=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Vu),B.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 R_(e){if(!js.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Kl(r)}var Bl=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=js),B.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{R_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Wl=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ju),B.init(e,t)});function I_(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 Yl=y("$ZodJWT",(e,t)=>{B.init(e,t),e._zod.check=r=>{I_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var qs=y("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??Zs,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}}),Ql=y("$ZodNumberFormat",(e,t)=>{al.init(e,t),qs.init(e,t)}),Xl=y("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=tl,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}}),ed=y("$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 td=y("$ZodNull",(e,t)=>{F.init(e,t),e._zod.pattern=rl,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}}),rd=y("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),nd=y("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),od=y("$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 sd=y("$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 wl(e,t,r){e.issues.length&&t.issues.push(...ct(r,e.issues)),t.value[r]=e.value}var id=y("$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=>wl(u,r,i))):wl(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function co(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...ct(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 ad(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=Es(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function cd(e,t,r,n,o,s){let i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optin==="optional",d=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=>co(g,r,m,t,l,d))):co(f,r,m,t,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var C_=y("$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=Xt(()=>ad(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 d of l.values)c[u].add(d)}}return c});let o=Ot,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=[],d=i.shape;for(let m of i.keys){let f=d[m],g=f._zod.optin==="optional",_=f._zod.optout==="optional",v=f._zod.run({value:u[m],issues:[]},c);v instanceof Promise?l.push(v.then(w=>co(w,a,m,u,g,_))):co(v,a,m,u,g,_)}return s?cd(l,u,a,c,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),ud=y("$ZodObjectJIT",(e,t)=>{C_.init(e,t);let r=e._zod.parse,n=Xt(()=>ad(t)),o=m=>{let f=new io(["shape","payload","ctx"]),g=n.value,_=x=>{let S=eo(x);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");let v=Object.create(null),w=0;for(let x of g.keys)v[x]=`key_${w++}`;f.write("const newResult = {};");for(let x of g.keys){let S=v[x],P=eo(x),Re=m[x],Ne=Re?._zod?.optin==="optional",Rr=Re?._zod?.optout==="optional";f.write(`const ${S} = ${_(x)};`),Ne&&Rr?f.write(`
|
|
13
13
|
if (${S}.issues.length) {
|
|
14
14
|
if (${P} in input) {
|
|
15
15
|
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
@@ -27,7 +27,7 @@ var Hy=Object.create;var hs=Object.defineProperty;var Jy=Object.getOwnPropertyDe
|
|
|
27
27
|
newResult[${P}] = ${S}.value;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
`):
|
|
30
|
+
`):Ne?f.write(`
|
|
31
31
|
if (${S}.issues.length) {
|
|
32
32
|
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
33
33
|
...iss,
|
|
@@ -68,38 +68,38 @@ var Hy=Object.create;var hs=Object.defineProperty;var Jy=Object.getOwnPropertyDe
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
`)}f.write("payload.value = newResult;"),f.write("return payload;");let k=f.compile();return(x,S)=>k(m,x,S)},s,i=Ot,a=!Wt.jitless,u=a&&Ss.value,l=t.catchall,d;e._zod.parse=(m,f)=>{d??(d=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?cd([],g,m,f,d,e):m):r(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function bl(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=>!yt(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=>De(i,n,xe())))}),t)}var Ls=y("$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=>Ur(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=>bl(a,n,e,o)):bl(i,n,e,o)}});var ld=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ls.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=Qt(()=>{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(!Ot(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)}}),dd=y("$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])=>$l(r,c,u)):$l(r,s,i)}});function Us(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)&>(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=Us(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=Us(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 $l(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}),yt(e))return e;let i=Us(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 pd=y("$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=>De(f,n,xe())),input:u,path:[u],inst:e});continue}let d=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(...ct(u,f.issues)),r.value[d]=f.value})):(m.issues.length&&r.issues.push(...ct(u,m.issues)),r.value[d]=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"&&Zs.test(a)&&c.issues.length){let d=t.keyType._zod.run({value:Number(a),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[a]=o[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>De(d,n,xe())),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(d=>{d.issues.length&&r.issues.push(...ct(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...ct(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var fd=y("$ZodEnum",(e,t)=>{F.init(e,t);let r=Dr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Ps.has(typeof o)).map(o=>typeof o=="string"?at(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}}),md=y("$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"?at(n):n?at(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 hd=y("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Bt(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 et;return r.value=o,r.fallback=!0,r}});function xl(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Fs=y("$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(`^(${Ur(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=>xl(i,o)):xl(s,o)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),gd=y("$ZodExactOptional",(e,t)=>{Fs.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)}),yd=y("$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(`^(${Ur(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)}),_d=y("$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=>zl(s,t)):zl(o,t)}});function zl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var vd=y("$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))}),wd=y("$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=>kl(s,e)):kl(o,e)}});function kl(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 bd=y("$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=>De(i,n,xe()))},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=>De(s,n,xe()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var Vs=y("$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=>ao(i,t.in,n)):ao(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>ao(s,t.out,n)):ao(o,t.out,n)}});function ao(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 $d=y("$ZodPreprocess",(e,t)=>{Vs.init(e,t)}),xd=y("$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 zd=y("$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=>Pl(s,r,n,e));Pl(o,r,n,e)}});function Pl(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(Xt(o))}}var I_=()=>{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=Is(o.input),a=n[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${ro(o.values[0])}`:`Invalid option: expected one of ${Xn(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":""}: ${Xn(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 kd(){return{localeError:I_()}}var Sd,C_=Symbol("ZodOutput"),O_=Symbol("ZodInput"),Hs=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 Pd(){return new Hs}(Sd=globalThis).__zod_globalRegistry??(Sd.__zod_globalRegistry=Pd());var _t=globalThis.__zod_globalRegistry;function Ed(e,t){return new e({type:"string",...R(t)})}function Td(e,t){return new e({type:"string",coerce:!0,...R(t)})}function Rd(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 Id(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function Cd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function Od(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function Nd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function Ks(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function Ad(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function jd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function Zd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function Dd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function Md(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function Ud(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function qd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function Ld(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function Fd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function Vd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function Hd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function Jd(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 Gd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function Bd(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}function Wd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function Yd(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function Qd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function Xd(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function ep(e,t){return new e({type:"number",checks:[],...R(t)})}function tp(e,t){return new e({type:"number",coerce:!0,checks:[],...R(t)})}function rp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...R(t)})}function np(e,t){return new e({type:"boolean",...R(t)})}function op(e,t){return new e({type:"boolean",coerce:!0,...R(t)})}function sp(e,t){return new e({type:"bigint",coerce:!0,...R(t)})}function ip(e,t){return new e({type:"null",...R(t)})}function ap(e){return new e({type:"any"})}function cp(e){return new e({type:"unknown"})}function up(e,t){return new e({type:"never",...R(t)})}function lp(e,t){return new e({type:"date",coerce:!0,...R(t)})}function er(e,t){return new Ds({check:"less_than",...R(t),value:e,inclusive:!1})}function ut(e,t){return new Ds({check:"less_than",...R(t),value:e,inclusive:!0})}function tr(e,t){return new Ms({check:"greater_than",...R(t),value:e,inclusive:!1})}function Ke(e,t){return new Ms({check:"greater_than",...R(t),value:e,inclusive:!0})}function Jr(e,t){return new il({check:"multiple_of",...R(t),value:e})}function lo(e,t){return new cl({check:"max_length",...R(t),maximum:e})}function rr(e,t){return new ul({check:"min_length",...R(t),minimum:e})}function po(e,t){return new ll({check:"length_equals",...R(t),length:e})}function Gs(e,t){return new dl({check:"string_format",format:"regex",...R(t),pattern:e})}function Bs(e){return new pl({check:"string_format",format:"lowercase",...R(e)})}function Ws(e){return new fl({check:"string_format",format:"uppercase",...R(e)})}function Ys(e,t){return new ml({check:"string_format",format:"includes",...R(t),includes:e})}function Qs(e,t){return new hl({check:"string_format",format:"starts_with",...R(t),prefix:e})}function Xs(e,t){return new gl({check:"string_format",format:"ends_with",...R(t),suffix:e})}function vt(e){return new yl({check:"overwrite",tx:e})}function ei(e){return vt(t=>t.normalize(e))}function ti(){return vt(e=>e.trim())}function ri(){return vt(e=>e.toLowerCase())}function ni(){return vt(e=>e.toUpperCase())}function oi(){return vt(e=>ks(e))}function dp(e,t,r){return new e({type:"array",element:t,...R(r)})}function pp(e,t,r){let n=R(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function fp(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function mp(e,t){let r=N_(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Xt(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(Xt(s))}},e(n.value,n)),t);return r}function N_(e,t){let r=new ae({check:"custom",...R(t)});return r._zod.check=e,r}function si(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??_t,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 d=e._zod.parent;d&&(i.ref||(i.ref=d),re(d,t,l),t.seen.get(d).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 ii(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 d=e.external.registry.get(i[0])?.id,m=e.external.uri??(g=>g);if(d)return{ref:m(d)};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 d in l)delete l[d];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
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let k=f.compile();return(x,S)=>k(m,x,S)},s,i=Ot,a=!Yt.jitless,u=a&&Ss.value,l=t.catchall,d;e._zod.parse=(m,f)=>{d??(d=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?cd([],g,m,f,d,e):m):r(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function bl(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=>!yt(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=>De(i,n,xe())))}),t)}var Ls=y("$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=>Mr(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=>bl(a,n,e,o)):bl(i,n,e,o)}});var ld=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ls.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=Xt(()=>{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(!Ot(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)}}),dd=y("$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])=>$l(r,c,u)):$l(r,s,i)}});function Us(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)&>(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=Us(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=Us(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 $l(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}),yt(e))return e;let i=Us(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 pd=y("$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=>De(f,n,xe())),input:u,path:[u],inst:e});continue}let d=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(...ct(u,f.issues)),r.value[d]=f.value})):(m.issues.length&&r.issues.push(...ct(u,m.issues)),r.value[d]=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"&&Zs.test(a)&&c.issues.length){let d=t.keyType._zod.run({value:Number(a),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[a]=o[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>De(d,n,xe())),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(d=>{d.issues.length&&r.issues.push(...ct(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...ct(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var fd=y("$ZodEnum",(e,t)=>{F.init(e,t);let r=Zr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Ps.has(typeof o)).map(o=>typeof o=="string"?at(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}}),md=y("$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"?at(n):n?at(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 hd=y("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Wt(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 et;return r.value=o,r.fallback=!0,r}});function xl(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Fs=y("$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(`^(${Mr(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=>xl(i,o)):xl(s,o)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),gd=y("$ZodExactOptional",(e,t)=>{Fs.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)}),yd=y("$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(`^(${Mr(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)}),_d=y("$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=>zl(s,t)):zl(o,t)}});function zl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var vd=y("$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))}),wd=y("$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=>kl(s,e)):kl(o,e)}});function kl(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 bd=y("$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=>De(i,n,xe()))},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=>De(s,n,xe()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var Vs=y("$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=>ao(i,t.in,n)):ao(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>ao(s,t.out,n)):ao(o,t.out,n)}});function ao(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 $d=y("$ZodPreprocess",(e,t)=>{Vs.init(e,t)}),xd=y("$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 zd=y("$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=>Pl(s,r,n,e));Pl(o,r,n,e)}});function Pl(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(er(o))}}var O_=()=>{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=Is(o.input),a=n[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${ro(o.values[0])}`:`Invalid option: expected one of ${Xn(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":""}: ${Xn(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 kd(){return{localeError:O_()}}var Sd,A_=Symbol("ZodOutput"),N_=Symbol("ZodInput"),Hs=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 Pd(){return new Hs}(Sd=globalThis).__zod_globalRegistry??(Sd.__zod_globalRegistry=Pd());var _t=globalThis.__zod_globalRegistry;function Ed(e,t){return new e({type:"string",...R(t)})}function Td(e,t){return new e({type:"string",coerce:!0,...R(t)})}function Rd(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 Id(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function Cd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function Od(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function Ad(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function Ks(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function Nd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function jd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function Zd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function Dd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function Md(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function Ud(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function qd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function Ld(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function Fd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function Vd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function Hd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function Jd(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 Gd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function Bd(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}function Wd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function Yd(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function Qd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function Xd(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function ep(e,t){return new e({type:"number",checks:[],...R(t)})}function tp(e,t){return new e({type:"number",coerce:!0,checks:[],...R(t)})}function rp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...R(t)})}function np(e,t){return new e({type:"boolean",...R(t)})}function op(e,t){return new e({type:"boolean",coerce:!0,...R(t)})}function sp(e,t){return new e({type:"bigint",coerce:!0,...R(t)})}function ip(e,t){return new e({type:"null",...R(t)})}function ap(e){return new e({type:"any"})}function cp(e){return new e({type:"unknown"})}function up(e,t){return new e({type:"never",...R(t)})}function lp(e,t){return new e({type:"date",coerce:!0,...R(t)})}function tr(e,t){return new Ds({check:"less_than",...R(t),value:e,inclusive:!1})}function ut(e,t){return new Ds({check:"less_than",...R(t),value:e,inclusive:!0})}function rr(e,t){return new Ms({check:"greater_than",...R(t),value:e,inclusive:!1})}function Ke(e,t){return new Ms({check:"greater_than",...R(t),value:e,inclusive:!0})}function Hr(e,t){return new il({check:"multiple_of",...R(t),value:e})}function lo(e,t){return new cl({check:"max_length",...R(t),maximum:e})}function nr(e,t){return new ul({check:"min_length",...R(t),minimum:e})}function po(e,t){return new ll({check:"length_equals",...R(t),length:e})}function Gs(e,t){return new dl({check:"string_format",format:"regex",...R(t),pattern:e})}function Bs(e){return new pl({check:"string_format",format:"lowercase",...R(e)})}function Ws(e){return new fl({check:"string_format",format:"uppercase",...R(e)})}function Ys(e,t){return new ml({check:"string_format",format:"includes",...R(t),includes:e})}function Qs(e,t){return new hl({check:"string_format",format:"starts_with",...R(t),prefix:e})}function Xs(e,t){return new gl({check:"string_format",format:"ends_with",...R(t),suffix:e})}function vt(e){return new yl({check:"overwrite",tx:e})}function ei(e){return vt(t=>t.normalize(e))}function ti(){return vt(e=>e.trim())}function ri(){return vt(e=>e.toLowerCase())}function ni(){return vt(e=>e.toUpperCase())}function oi(){return vt(e=>ks(e))}function dp(e,t,r){return new e({type:"array",element:t,...R(r)})}function pp(e,t,r){let n=R(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function fp(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function mp(e,t){let r=j_(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(er(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(er(s))}},e(n.value,n)),t);return r}function j_(e,t){let r=new ae({check:"custom",...R(t)});return r._zod.check=e,r}function si(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??_t,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 d=e._zod.parent;d&&(i.ref||(i.ref=d),re(d,t,l),t.seen.get(d).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 ii(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 d=e.external.registry.get(i[0])?.id,m=e.external.uri??(g=>g);if(d)return{ref:m(d)};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 d in l)delete l[d];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>
|
|
72
72
|
|
|
73
|
-
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 ai(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},d=c.ref;if(c.ref=null,d){n(d);let f=e.seen.get(d),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===d)for(let v in u)v==="$ref"||v==="allOf"||v in l||delete u[v];if(g.$ref&&f.def)for(let v in u)v==="$ref"||v==="allOf"||v in f.def&&JSON.stringify(u[v])===JSON.stringify(f.def[v])&&delete u[v]}let m=a._zod.parent;if(m&&m!==d){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:Kr(t,"input",e.processors),output:Kr(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 hp=(e,t={})=>r=>{let n=si({...r,processors:t});return re(e,n),ii(n,e),ai(n,e)},Kr=(e,t,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=si({...o??{},target:s,io:t,processors:r});return re(e,i),ii(i,e),ai(i,e)};var A_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gp=(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=A_[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(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},yp=(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 d=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";d?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)},_p=(e,t,r,n)=>{r.type="boolean"},vp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")};var wp=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var bp=(e,t,r,n)=>{r.not={}},$p=(e,t,r,n)=>{},xp=(e,t,r,n)=>{},zp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},kp=(e,t,r,n)=>{let o=e._zod.def,s=Dr(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 Pp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Ep=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Tp=(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"]})},Rp=(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)},Ip=(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},Cp=(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 Op=(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 d of c)o.patternProperties[d.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(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Np=(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"}]},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},jp=(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))},Zp=(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)))},Dp=(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},Mp=(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},Up=(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 ci=(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 Gr={};gs(Gr,{ZodISODate:()=>Lp,ZodISODateTime:()=>qp,ZodISODuration:()=>Vp,ZodISOTime:()=>Fp,date:()=>li,datetime:()=>ui,duration:()=>pi,time:()=>di});var qp=y("ZodISODateTime",(e,t)=>{Ml.init(e,t),Q.init(e,t)});function ui(e){return Wd(qp,e)}var Lp=y("ZodISODate",(e,t)=>{Ul.init(e,t),Q.init(e,t)});function li(e){return Yd(Lp,e)}var Fp=y("ZodISOTime",(e,t)=>{ql.init(e,t),Q.init(e,t)});function di(e){return Qd(Fp,e)}var Vp=y("ZodISODuration",(e,t)=>{Ll.init(e,t),Q.init(e,t)});function pi(e){return Xd(Vp,e)}var F_=(e,t)=>{no.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ns(e,r)},flatten:{value:r=>Os(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Yt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Yt,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Ce=y("ZodError",F_,{Parent:Error});var Jp=oo(Ce),Kp=so(Ce),Gp=Lr(Ce),Bp=Fr(Ce),Wp=$u(Ce),Yp=xu(Ce),Qp=zu(Ce),Xp=ku(Ce),ef=Su(Ce),tf=Pu(Ce),rf=Eu(Ce),nf=Tu(Ce);var of=new WeakMap;function Br(e,t,r){let n=Object.getPrototypeOf(e),o=of.get(n);if(o||(o=new Set,of.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=y("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Kr(e,"input"),output:Kr(e,"output")}}),e.toJSONSchema=hp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>Jp(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Gp(e,r,n),e.parseAsync=async(r,n)=>Kp(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Bp(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Wp(e,r,n),e.decode=(r,n)=>Yp(e,r,n),e.encodeAsync=async(r,n)=>Qp(e,r,n),e.decodeAsync=async(r,n)=>Xp(e,r,n),e.safeEncode=(r,n)=>ef(e,r,n),e.safeDecode=(r,n)=>tf(e,r,n),e.safeEncodeAsync=async(r,n)=>rf(e,r,n),e.safeDecodeAsync=async(r,n)=>nf(e,r,n),Br(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 Ze(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Iv(r,n))},superRefine(r,n){return this.check(Cv(r,n))},overwrite(r){return this.check(vt(r))},optional(){return te(this)},exactOptional(){return vv(this)},nullable(){return uf(this)},nullish(){return te(uf(this))},nonoptional(r){return kv(this,r)},array(){return b(this)},or(r){return G([this,r])},and(r){return ho(this,r)},transform(r){return lf(this,vf(r))},default(r){return $v(this,r)},prefault(r){return zv(this,r)},catch(r){return Pv(this,r)},pipe(r){return lf(this,r)},readonly(){return Rv(this)},describe(r){let n=this.clone();return _t.add(n,{description:r}),n},meta(...r){if(r.length===0)return _t.get(this);let n=this.clone();return _t.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 _t.get(e)?.description},configurable:!0}),e)),df=y("_ZodString",(e,t)=>{uo.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>gp(e,n,o,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Br(e,"_ZodString",{regex(...n){return this.check(Gs(...n))},includes(...n){return this.check(Ys(...n))},startsWith(...n){return this.check(Qs(...n))},endsWith(...n){return this.check(Xs(...n))},min(...n){return this.check(rr(...n))},max(...n){return this.check(lo(...n))},length(...n){return this.check(po(...n))},nonempty(...n){return this.check(rr(1,...n))},lowercase(n){return this.check(Bs(n))},uppercase(n){return this.check(Ws(n))},trim(){return this.check(ti())},normalize(...n){return this.check(ei(...n))},toLowerCase(){return this.check(ri())},toUpperCase(){return this.check(ni())},slugify(){return this.check(oi())}})}),mi=y("ZodString",(e,t)=>{uo.init(e,t),df.init(e,t),e.email=r=>e.check(Rd(H_,r)),e.url=r=>e.check(Ks(pf,r)),e.jwt=r=>e.check(Bd(iv,r)),e.emoji=r=>e.check(Ad(J_,r)),e.guid=r=>e.check(Js(sf,r)),e.uuid=r=>e.check(Id(fo,r)),e.uuidv4=r=>e.check(Cd(fo,r)),e.uuidv6=r=>e.check(Od(fo,r)),e.uuidv7=r=>e.check(Nd(fo,r)),e.nanoid=r=>e.check(jd(K_,r)),e.guid=r=>e.check(Js(sf,r)),e.cuid=r=>e.check(Zd(G_,r)),e.cuid2=r=>e.check(Dd(B_,r)),e.ulid=r=>e.check(Md(W_,r)),e.base64=r=>e.check(Jd(nv,r)),e.base64url=r=>e.check(Kd(ov,r)),e.xid=r=>e.check(Ud(Y_,r)),e.ksuid=r=>e.check(qd(Q_,r)),e.ipv4=r=>e.check(Ld(X_,r)),e.ipv6=r=>e.check(Fd(ev,r)),e.cidrv4=r=>e.check(Vd(tv,r)),e.cidrv6=r=>e.check(Hd(rv,r)),e.e164=r=>e.check(Gd(sv,r)),e.datetime=r=>e.check(ui(r)),e.date=r=>e.check(li(r)),e.time=r=>e.check(di(r)),e.duration=r=>e.check(pi(r))});function p(e){return Ed(mi,e)}var Q=y("ZodStringFormat",(e,t)=>{B.init(e,t),df.init(e,t)}),H_=y("ZodEmail",(e,t)=>{Rl.init(e,t),Q.init(e,t)});var sf=y("ZodGUID",(e,t)=>{El.init(e,t),Q.init(e,t)});var fo=y("ZodUUID",(e,t)=>{Tl.init(e,t),Q.init(e,t)});var pf=y("ZodURL",(e,t)=>{Il.init(e,t),Q.init(e,t)});function ff(e){return Ks(pf,e)}var J_=y("ZodEmoji",(e,t)=>{Cl.init(e,t),Q.init(e,t)});var K_=y("ZodNanoID",(e,t)=>{Ol.init(e,t),Q.init(e,t)});var G_=y("ZodCUID",(e,t)=>{Nl.init(e,t),Q.init(e,t)});var B_=y("ZodCUID2",(e,t)=>{Al.init(e,t),Q.init(e,t)});var W_=y("ZodULID",(e,t)=>{jl.init(e,t),Q.init(e,t)});var Y_=y("ZodXID",(e,t)=>{Zl.init(e,t),Q.init(e,t)});var Q_=y("ZodKSUID",(e,t)=>{Dl.init(e,t),Q.init(e,t)});var X_=y("ZodIPv4",(e,t)=>{Fl.init(e,t),Q.init(e,t)});var ev=y("ZodIPv6",(e,t)=>{Vl.init(e,t),Q.init(e,t)});var tv=y("ZodCIDRv4",(e,t)=>{Hl.init(e,t),Q.init(e,t)});var rv=y("ZodCIDRv6",(e,t)=>{Jl.init(e,t),Q.init(e,t)});var nv=y("ZodBase64",(e,t)=>{Gl.init(e,t),Q.init(e,t)});var ov=y("ZodBase64URL",(e,t)=>{Bl.init(e,t),Q.init(e,t)});var sv=y("ZodE164",(e,t)=>{Wl.init(e,t),Q.init(e,t)});var iv=y("ZodJWT",(e,t)=>{Yl.init(e,t),Q.init(e,t)});var mo=y("ZodNumber",(e,t)=>{qs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>yp(e,n,o,s),Br(e,"ZodNumber",{gt(n,o){return this.check(tr(n,o))},gte(n,o){return this.check(Ke(n,o))},min(n,o){return this.check(Ke(n,o))},lt(n,o){return this.check(er(n,o))},lte(n,o){return this.check(ut(n,o))},max(n,o){return this.check(ut(n,o))},int(n){return this.check(af(n))},safe(n){return this.check(af(n))},positive(n){return this.check(tr(0,n))},nonnegative(n){return this.check(Ke(0,n))},negative(n){return this.check(er(0,n))},nonpositive(n){return this.check(ut(0,n))},multipleOf(n,o){return this.check(Jr(n,o))},step(n,o){return this.check(Jr(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 q(e){return ep(mo,e)}var av=y("ZodNumberFormat",(e,t)=>{Ql.init(e,t),mo.init(e,t)});function af(e){return rp(av,e)}var hi=y("ZodBoolean",(e,t)=>{Xl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_p(e,r,n,o)});function J(e){return np(hi,e)}var mf=y("ZodBigInt",(e,t)=>{ed.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>vp(e,n,o,s),e.gte=(n,o)=>e.check(Ke(n,o)),e.min=(n,o)=>e.check(Ke(n,o)),e.gt=(n,o)=>e.check(tr(n,o)),e.gte=(n,o)=>e.check(Ke(n,o)),e.min=(n,o)=>e.check(Ke(n,o)),e.lt=(n,o)=>e.check(er(n,o)),e.lte=(n,o)=>e.check(ut(n,o)),e.max=(n,o)=>e.check(ut(n,o)),e.positive=n=>e.check(tr(BigInt(0),n)),e.negative=n=>e.check(er(BigInt(0),n)),e.nonpositive=n=>e.check(ut(BigInt(0),n)),e.nonnegative=n=>e.check(Ke(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(Jr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var cv=y("ZodNull",(e,t)=>{td.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wp(e,r,n,o)});function gi(e){return ip(cv,e)}var uv=y("ZodAny",(e,t)=>{rd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$p(e,r,n,o)});function hf(){return ap(uv)}var lv=y("ZodUnknown",(e,t)=>{nd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xp(e,r,n,o)});function X(){return cp(lv)}var dv=y("ZodNever",(e,t)=>{od.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bp(e,r,n,o)});function pv(e){return up(dv,e)}var gf=y("ZodDate",(e,t)=>{sd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>zp(e,n,o,s),e.min=(n,o)=>e.check(Ke(n,o)),e.max=(n,o)=>e.check(ut(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 fv=y("ZodArray",(e,t)=>{id.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tp(e,r,n,o),e.element=t.element,Br(e,"ZodArray",{min(r,n){return this.check(rr(r,n))},nonempty(r){return this.check(rr(1,r))},max(r,n){return this.check(lo(r,n))},length(r,n){return this.check(po(r,n))},unwrap(){return this.element}})});function b(e,t){return dp(fv,e,t)}var yf=y("ZodObject",(e,t)=>{ud.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rp(e,r,n,o),j.defineLazy(e,"shape",()=>t.shape),Br(e,"ZodObject",{keyof(){return ze(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:pv()})},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(wf,this,r[0])},required(...r){return j.required(bf,this,r[0])}})});function $(e,t){let r={type:"object",shape:e??{},...j.normalizeParams(t)};return new yf(r)}function se(e,t){return new yf({type:"object",shape:e,catchall:X(),...j.normalizeParams(t)})}var _f=y("ZodUnion",(e,t)=>{Ls.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ip(e,r,n,o),e.options=t.options});function G(e,t){return new _f({type:"union",options:e,...j.normalizeParams(t)})}var mv=y("ZodDiscriminatedUnion",(e,t)=>{_f.init(e,t),ld.init(e,t)});function yi(e,t,r){return new mv({type:"union",options:t,discriminator:e,...j.normalizeParams(r)})}var hv=y("ZodIntersection",(e,t)=>{dd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cp(e,r,n,o)});function ho(e,t){return new hv({type:"intersection",left:e,right:t})}var cf=y("ZodRecord",(e,t)=>{pd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Op(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return!t||!t._zod?new cf({type:"record",keyType:p(),valueType:e,...j.normalizeParams(t)}):new cf({type:"record",keyType:e,valueType:t,...j.normalizeParams(r)})}var fi=y("ZodEnum",(e,t)=>{fd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>kp(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 fi({...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 fi({...t,checks:[],...j.normalizeParams(o),entries:s})}});function ze(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new fi({type:"enum",entries:r,...j.normalizeParams(t)})}var gv=y("ZodLiteral",(e,t)=>{md.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 E(e,t){return new gv({type:"literal",values:Array.isArray(e)?e:[e],...j.normalizeParams(t)})}var yv=y("ZodTransform",(e,t)=>{hd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ep(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Bt(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 vf(e){return new yv({type:"transform",transform:e})}var wf=y("ZodOptional",(e,t)=>{Fs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ci(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function te(e){return new wf({type:"optional",innerType:e})}var _v=y("ZodExactOptional",(e,t)=>{gd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ci(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vv(e){return new _v({type:"optional",innerType:e})}var wv=y("ZodNullable",(e,t)=>{yd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Np(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function uf(e){return new wv({type:"nullable",innerType:e})}var bv=y("ZodDefault",(e,t)=>{_d.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $v(e,t){return new bv({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var xv=y("ZodPrefault",(e,t)=>{vd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zv(e,t){return new xv({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var bf=y("ZodNonOptional",(e,t)=>{wd.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 kv(e,t){return new bf({type:"nonoptional",innerType:e,...j.normalizeParams(t)})}var Sv=y("ZodCatch",(e,t)=>{bd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Pv(e,t){return new Sv({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var $f=y("ZodPipe",(e,t)=>{Vs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mp(e,r,n,o),e.in=t.in,e.out=t.out});function lf(e,t){return new $f({type:"pipe",in:e,out:t})}var Ev=y("ZodPreprocess",(e,t)=>{$f.init(e,t),$d.init(e,t)}),Tv=y("ZodReadonly",(e,t)=>{xd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Up(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Rv(e){return new Tv({type:"readonly",innerType:e})}var xf=y("ZodCustom",(e,t)=>{zd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pp(e,r,n,o)});function zf(e,t){return pp(xf,e??(()=>!0),t)}function Iv(e,t={}){return fp(xf,e,t)}function Cv(e,t){return mp(e,t)}function _i(e,t){return new Ev({type:"pipe",in:vf(e),out:t})}var Sf={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 kf;kf||(kf={});var go={};gs(go,{bigint:()=>jv,boolean:()=>Av,date:()=>Zv,number:()=>Nv,string:()=>Ov});function Ov(e){return Td(mi,e)}function Nv(e){return tp(mo,e)}function Av(e){return op(hi,e)}function jv(e){return sp(mf,e)}function Zv(e){return lp(gf,e)}xe(kd());var Pf="io.modelcontextprotocol/related-task",_o="2.0",ce=zf(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Ef=G([p(),q().int()]),Tf=p(),qT=se({ttl:G([q(),gi()]).optional(),pollInterval:q().optional()}),Mv=$({ttl:q().optional()}),Uv=$({taskId:p()}),vi=se({progressToken:Ef.optional(),[Pf]:Uv.optional()}),Oe=$({_meta:vi.optional()}),vo=Oe.extend({task:Mv.optional()});var ue=$({method:p(),params:Oe.loose().optional()}),Me=$({_meta:vi.optional()}),Ue=$({method:p(),params:Me.loose().optional()}),le=se({_meta:vi.optional()}),wo=G([p(),q().int()]),qv=$({jsonrpc:E(_o),id:wo,...ue.shape}).strict();var Lv=$({jsonrpc:E(_o),...Ue.shape}).strict();var Rf=$({jsonrpc:E(_o),id:wo,result:le}).strict();var Wr;(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"})(Wr||(Wr={}));var If=$({jsonrpc:E(_o),id:wo.optional(),error:$({code:q().int(),message:p(),data:X().optional()})}).strict();var Fv=G([qv,Lv,Rf,If]),LT=G([Rf,If]),wi=le.strict(),Vv=Me.extend({requestId:wo.optional(),reason:p().optional()}),bi=Ue.extend({method:E("notifications/cancelled"),params:Vv}),Hv=$({src:p(),mimeType:p().optional(),sizes:b(p()).optional(),theme:ze(["light","dark"]).optional()}),Yr=$({icons:b(Hv).optional()}),or=$({name:p(),title:p().optional()}),Cf=or.extend({...or.shape,...Yr.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),Jv=ho($({applyDefaults:J().optional()}),ee(p(),X())),Kv=_i(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ho($({form:Jv.optional(),url:ce.optional()}),ee(p(),X()).optional())),Gv=se({list:ce.optional(),cancel:ce.optional(),requests:se({sampling:se({createMessage:ce.optional()}).optional(),elicitation:se({create:ce.optional()}).optional()}).optional()}),Bv=se({list:ce.optional(),cancel:ce.optional(),requests:se({tools:se({call:ce.optional()}).optional()}).optional()}),Wv=$({experimental:ee(p(),ce).optional(),sampling:$({context:ce.optional(),tools:ce.optional()}).optional(),elicitation:Kv.optional(),roots:$({listChanged:J().optional()}).optional(),tasks:Gv.optional()}),Yv=Oe.extend({protocolVersion:p(),capabilities:Wv,clientInfo:Cf}),Qv=ue.extend({method:E("initialize"),params:Yv});var Xv=$({experimental:ee(p(),ce).optional(),logging:ce.optional(),completions:ce.optional(),prompts:$({listChanged:J().optional()}).optional(),resources:$({subscribe:J().optional(),listChanged:J().optional()}).optional(),tools:$({listChanged:J().optional()}).optional(),tasks:Bv.optional()}),Of=le.extend({protocolVersion:p(),capabilities:Xv,serverInfo:Cf,instructions:p().optional()}),ew=Ue.extend({method:E("notifications/initialized"),params:Me.optional()});var $i=ue.extend({method:E("ping"),params:Oe.optional()}),tw=$({progress:q(),total:te(q()),message:te(p())}),rw=$({...Me.shape,...tw.shape,progressToken:Ef}),xi=Ue.extend({method:E("notifications/progress"),params:rw}),nw=Oe.extend({cursor:Tf.optional()}),Qr=ue.extend({params:nw.optional()}),Xr=le.extend({nextCursor:Tf.optional()}),ow=ze(["working","input_required","completed","failed","cancelled"]),en=$({taskId:p(),status:ow,ttl:G([q(),gi()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:te(q()),statusMessage:te(p())}),bo=le.extend({task:en}),sw=Me.merge(en),zi=Ue.extend({method:E("notifications/tasks/status"),params:sw}),ki=ue.extend({method:E("tasks/get"),params:Oe.extend({taskId:p()})}),Si=le.merge(en),Pi=ue.extend({method:E("tasks/result"),params:Oe.extend({taskId:p()})}),FT=le.loose(),Ei=Qr.extend({method:E("tasks/list")}),Ti=Xr.extend({tasks:b(en)}),Ri=ue.extend({method:E("tasks/cancel"),params:Oe.extend({taskId:p()})}),iw=le.merge(en),Nf=$({uri:p(),mimeType:te(p()),_meta:ee(p(),X()).optional()}),Af=Nf.extend({text:p()}),Ii=p().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),jf=Nf.extend({blob:Ii}),tn=ze(["user","assistant"]),sr=$({audience:b(tn).optional(),priority:q().min(0).max(1).optional(),lastModified:Gr.datetime({offset:!0}).optional()}),Zf=$({...or.shape,...Yr.shape,uri:p(),description:te(p()),mimeType:te(p()),annotations:sr.optional(),_meta:te(se({}))}),aw=$({...or.shape,...Yr.shape,uriTemplate:p(),description:te(p()),mimeType:te(p()),annotations:sr.optional(),_meta:te(se({}))}),cw=Qr.extend({method:E("resources/list")}),Df=Xr.extend({resources:b(Zf)}),uw=Qr.extend({method:E("resources/templates/list")}),Mf=Xr.extend({resourceTemplates:b(aw)}),Ci=Oe.extend({uri:p()}),lw=Ci,dw=ue.extend({method:E("resources/read"),params:lw}),Uf=le.extend({contents:b(G([Af,jf]))}),qf=Ue.extend({method:E("notifications/resources/list_changed"),params:Me.optional()}),pw=Ci,fw=ue.extend({method:E("resources/subscribe"),params:pw}),mw=Ci,hw=ue.extend({method:E("resources/unsubscribe"),params:mw}),gw=Me.extend({uri:p()}),yw=Ue.extend({method:E("notifications/resources/updated"),params:gw}),_w=$({name:p(),description:te(p()),required:te(J())}),vw=$({...or.shape,...Yr.shape,description:te(p()),arguments:te(b(_w)),_meta:te(se({}))}),ww=Qr.extend({method:E("prompts/list")}),Lf=Xr.extend({prompts:b(vw)}),bw=Oe.extend({name:p(),arguments:ee(p(),p()).optional()}),$w=ue.extend({method:E("prompts/get"),params:bw}),Oi=$({type:E("text"),text:p(),annotations:sr.optional(),_meta:ee(p(),X()).optional()}),Ni=$({type:E("image"),data:Ii,mimeType:p(),annotations:sr.optional(),_meta:ee(p(),X()).optional()}),Ai=$({type:E("audio"),data:Ii,mimeType:p(),annotations:sr.optional(),_meta:ee(p(),X()).optional()}),xw=$({type:E("tool_use"),name:p(),id:p(),input:ee(p(),X()),_meta:ee(p(),X()).optional()}),zw=$({type:E("resource"),resource:G([Af,jf]),annotations:sr.optional(),_meta:ee(p(),X()).optional()}),kw=Zf.extend({type:E("resource_link")}),ji=G([Oi,Ni,Ai,kw,zw]),Sw=$({role:tn,content:ji}),Ff=le.extend({description:p().optional(),messages:b(Sw)}),Vf=Ue.extend({method:E("notifications/prompts/list_changed"),params:Me.optional()}),Pw=$({title:p().optional(),readOnlyHint:J().optional(),destructiveHint:J().optional(),idempotentHint:J().optional(),openWorldHint:J().optional()}),Ew=$({taskSupport:ze(["required","optional","forbidden"]).optional()}),Hf=$({...or.shape,...Yr.shape,description:p().optional(),inputSchema:$({type:E("object"),properties:ee(p(),ce).optional(),required:b(p()).optional()}).catchall(X()),outputSchema:$({type:E("object"),properties:ee(p(),ce).optional(),required:b(p()).optional()}).catchall(X()).optional(),annotations:Pw.optional(),execution:Ew.optional(),_meta:ee(p(),X()).optional()}),Tw=Qr.extend({method:E("tools/list")}),Jf=Xr.extend({tools:b(Hf)}),$o=le.extend({content:b(ji).default([]),structuredContent:ee(p(),X()).optional(),isError:J().optional()}),VT=$o.or(le.extend({toolResult:X()})),Rw=vo.extend({name:p(),arguments:ee(p(),X()).optional()}),Iw=ue.extend({method:E("tools/call"),params:Rw}),Zi=Ue.extend({method:E("notifications/tools/list_changed"),params:Me.optional()}),Cw=$({autoRefresh:J().default(!0),debounceMs:q().int().nonnegative().default(300)}),Kf=ze(["debug","info","notice","warning","error","critical","alert","emergency"]),Ow=Oe.extend({level:Kf}),Nw=ue.extend({method:E("logging/setLevel"),params:Ow}),Aw=Me.extend({level:Kf,logger:p().optional(),data:X()}),jw=Ue.extend({method:E("notifications/message"),params:Aw}),Zw=$({name:p().optional()}),Dw=$({hints:b(Zw).optional(),costPriority:q().min(0).max(1).optional(),speedPriority:q().min(0).max(1).optional(),intelligencePriority:q().min(0).max(1).optional()}),Mw=$({mode:ze(["auto","required","none"]).optional()}),Uw=$({type:E("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:b(ji).default([]),structuredContent:$({}).loose().optional(),isError:J().optional(),_meta:ee(p(),X()).optional()}),qw=yi("type",[Oi,Ni,Ai]),yo=yi("type",[Oi,Ni,Ai,xw,Uw]),Lw=$({role:tn,content:G([yo,b(yo)]),_meta:ee(p(),X()).optional()}),Fw=vo.extend({messages:b(Lw),modelPreferences:Dw.optional(),systemPrompt:p().optional(),includeContext:ze(["none","thisServer","allServers"]).optional(),temperature:q().optional(),maxTokens:q().int(),stopSequences:b(p()).optional(),metadata:ce.optional(),tools:b(Hf).optional(),toolChoice:Mw.optional()}),Gf=ue.extend({method:E("sampling/createMessage"),params:Fw}),Bf=le.extend({model:p(),stopReason:te(ze(["endTurn","stopSequence","maxTokens"]).or(p())),role:tn,content:qw}),Wf=le.extend({model:p(),stopReason:te(ze(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:tn,content:G([yo,b(yo)])}),Vw=$({type:E("boolean"),title:p().optional(),description:p().optional(),default:J().optional()}),Hw=$({type:E("string"),title:p().optional(),description:p().optional(),minLength:q().optional(),maxLength:q().optional(),format:ze(["email","uri","date","date-time"]).optional(),default:p().optional()}),Jw=$({type:ze(["number","integer"]),title:p().optional(),description:p().optional(),minimum:q().optional(),maximum:q().optional(),default:q().optional()}),Kw=$({type:E("string"),title:p().optional(),description:p().optional(),enum:b(p()),default:p().optional()}),Gw=$({type:E("string"),title:p().optional(),description:p().optional(),oneOf:b($({const:p(),title:p()})),default:p().optional()}),Bw=$({type:E("string"),title:p().optional(),description:p().optional(),enum:b(p()),enumNames:b(p()).optional(),default:p().optional()}),Ww=G([Kw,Gw]),Yw=$({type:E("array"),title:p().optional(),description:p().optional(),minItems:q().optional(),maxItems:q().optional(),items:$({type:E("string"),enum:b(p())}),default:b(p()).optional()}),Qw=$({type:E("array"),title:p().optional(),description:p().optional(),minItems:q().optional(),maxItems:q().optional(),items:$({anyOf:b($({const:p(),title:p()}))}),default:b(p()).optional()}),Xw=G([Yw,Qw]),eb=G([Bw,Ww,Xw]),tb=G([eb,Vw,Hw,Jw]),rb=vo.extend({mode:E("form").optional(),message:p(),requestedSchema:$({type:E("object"),properties:ee(p(),tb),required:b(p()).optional()})}),nb=vo.extend({mode:E("url"),message:p(),elicitationId:p(),url:p().url()}),ob=G([rb,nb]),Yf=ue.extend({method:E("elicitation/create"),params:ob}),sb=Me.extend({elicitationId:p()}),ib=Ue.extend({method:E("notifications/elicitation/complete"),params:sb}),Qf=le.extend({action:ze(["accept","decline","cancel"]),content:_i(e=>e===null?void 0:e,ee(p(),G([p(),q(),J(),b(p())])).optional())}),ab=$({type:E("ref/resource"),uri:p()});var cb=$({type:E("ref/prompt"),name:p()}),ub=Oe.extend({ref:G([cb,ab]),argument:$({name:p(),value:p()}),context:$({arguments:ee(p(),p()).optional()}).optional()}),lb=ue.extend({method:E("completion/complete"),params:ub});var Xf=le.extend({completion:se({values:b(p()).max(100),total:te(q().int()),hasMore:te(J())})}),db=$({uri:p().startsWith("file://"),name:p().optional(),_meta:ee(p(),X()).optional()}),pb=ue.extend({method:E("roots/list"),params:Oe.optional()}),fb=le.extend({roots:b(db)}),mb=Ue.extend({method:E("notifications/roots/list_changed"),params:Me.optional()}),HT=G([$i,Qv,lb,Nw,$w,ww,cw,uw,dw,fw,hw,Iw,Tw,ki,Pi,Ei,Ri]),JT=G([bi,xi,ew,mb,zi]),KT=G([wi,Bf,Wf,Qf,fb,Si,Ti,bo]),GT=G([$i,Gf,Yf,pb,ki,Pi,Ei,Ri]),BT=G([bi,xi,jw,yw,qf,Zi,Vf,zi,ib]),WT=G([wi,Of,Xf,Ff,Lf,Df,Mf,Uf,$o,Jf,Si,Ti,bo]);var hb=Symbol("Let zodToJsonSchema decide on which parser to use");var TR=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var NS=Yy(ty(),1);var jS;jS=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);var me=ff().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Sf.custom,message:"URL must be parseable",fatal:!0}),bs}).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"}),ZS=se({resource:p().url(),authorization_servers:b(me).optional(),jwks_uri:p().url().optional(),scopes_supported:b(p()).optional(),bearer_methods_supported:b(p()).optional(),resource_signing_alg_values_supported:b(p()).optional(),resource_name:p().optional(),resource_documentation:p().optional(),resource_policy_uri:p().url().optional(),resource_tos_uri:p().url().optional(),tls_client_certificate_bound_access_tokens:J().optional(),authorization_details_types_supported:b(p()).optional(),dpop_signing_alg_values_supported:b(p()).optional(),dpop_bound_access_tokens_required:J().optional()}),ny=se({issuer:p(),authorization_endpoint:me,token_endpoint:me,registration_endpoint:me.optional(),scopes_supported:b(p()).optional(),response_types_supported:b(p()),response_modes_supported:b(p()).optional(),grant_types_supported:b(p()).optional(),token_endpoint_auth_methods_supported:b(p()).optional(),token_endpoint_auth_signing_alg_values_supported:b(p()).optional(),service_documentation:me.optional(),revocation_endpoint:me.optional(),revocation_endpoint_auth_methods_supported:b(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:b(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:b(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:b(p()).optional(),code_challenge_methods_supported:b(p()).optional(),client_id_metadata_document_supported:J().optional()}),DS=se({issuer:p(),authorization_endpoint:me,token_endpoint:me,userinfo_endpoint:me.optional(),jwks_uri:me,registration_endpoint:me.optional(),scopes_supported:b(p()).optional(),response_types_supported:b(p()),response_modes_supported:b(p()).optional(),grant_types_supported:b(p()).optional(),acr_values_supported:b(p()).optional(),subject_types_supported:b(p()),id_token_signing_alg_values_supported:b(p()),id_token_encryption_alg_values_supported:b(p()).optional(),id_token_encryption_enc_values_supported:b(p()).optional(),userinfo_signing_alg_values_supported:b(p()).optional(),userinfo_encryption_alg_values_supported:b(p()).optional(),userinfo_encryption_enc_values_supported:b(p()).optional(),request_object_signing_alg_values_supported:b(p()).optional(),request_object_encryption_alg_values_supported:b(p()).optional(),request_object_encryption_enc_values_supported:b(p()).optional(),token_endpoint_auth_methods_supported:b(p()).optional(),token_endpoint_auth_signing_alg_values_supported:b(p()).optional(),display_values_supported:b(p()).optional(),claim_types_supported:b(p()).optional(),claims_supported:b(p()).optional(),service_documentation:p().optional(),claims_locales_supported:b(p()).optional(),ui_locales_supported:b(p()).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()}),MS=$({...DS.shape,...ny.pick({code_challenge_methods_supported:!0}).shape}),US=$({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:go.number().optional(),scope:p().optional(),refresh_token:p().optional()}).strip(),qS=$({error:p(),error_description:p().optional(),error_uri:p().optional()}),ry=me.optional().or(E("").transform(()=>{})),LS=$({redirect_uris:b(me),token_endpoint_auth_method:p().optional(),grant_types:b(p()).optional(),response_types:b(p()).optional(),client_name:p().optional(),client_uri:me.optional(),logo_uri:ry,scope:p().optional(),contacts:b(p()).optional(),tos_uri:ry,policy_uri:p().optional(),jwks_uri:me.optional(),jwks:hf().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),FS=$({client_id:p(),client_secret:p().optional(),client_id_issued_at:q().optional(),client_secret_expires_at:q().optional()}).strip(),VS=LS.merge(FS),hA=$({error:p(),error_description:p().optional()}).strip(),gA=$({token:p(),token_type_hint:p().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}},Nn=class extends oe{};Nn.errorCode="invalid_request";var xr=class extends oe{};xr.errorCode="invalid_client";var zr=class extends oe{};zr.errorCode="invalid_grant";var kr=class extends oe{};kr.errorCode="unauthorized_client";var An=class extends oe{};An.errorCode="unsupported_grant_type";var jn=class extends oe{};jn.errorCode="invalid_scope";var Zn=class extends oe{};Zn.errorCode="access_denied";var Sr=class extends oe{};Sr.errorCode="server_error";var Dn=class extends oe{};Dn.errorCode="temporarily_unavailable";var Mn=class extends oe{};Mn.errorCode="unsupported_response_type";var Un=class extends oe{};Un.errorCode="unsupported_token_type";var qn=class extends oe{};qn.errorCode="invalid_token";var Ln=class extends oe{};Ln.errorCode="method_not_allowed";var Fn=class extends oe{};Fn.errorCode="too_many_requests";var Pr=class extends oe{};Pr.errorCode="invalid_client_metadata";var Vn=class extends oe{};Vn.errorCode="insufficient_scope";var Hn=class extends oe{};Hn.errorCode="invalid_target";var HS={[Nn.errorCode]:Nn,[xr.errorCode]:xr,[zr.errorCode]:zr,[kr.errorCode]:kr,[An.errorCode]:An,[jn.errorCode]:jn,[Zn.errorCode]:Zn,[Sr.errorCode]:Sr,[Dn.errorCode]:Dn,[Mn.errorCode]:Mn,[Un.errorCode]:Un,[qn.errorCode]:qn,[Ln.errorCode]:Ln,[Fn.errorCode]:Fn,[Pr.errorCode]:Pr,[Vn.errorCode]:Vn,[Hn.errorCode]:Hn};async function JS(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 oy(e){return new Promise(t=>setTimeout(t,e))}function Jn(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 KS(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 GS(e,t,r={}){let n=r.fetchImpl??fetch,o=Date.now()+t.expiresIn*1e3,s=(t.interval||5)*1e3;for(;Date.now()<o;){await oy(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 oy(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??Jn(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 sy(e){let t=await KS({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??JS)(t.verificationUrl).catch(()=>{}),GS(e.authUrl,t,{onPending:e.onPending,fetchImpl:e.fetchImpl})}function Nc(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 BS(e,t){return e.userId&&t.userId?e.userId===t.userId:e.email&&t.email?e.email.toLowerCase()===t.email.toLowerCase():null}function Er(e){return e.email&&e.userId?`${e.email} (${e.userId})`:e.email??e.userId??"unknown"}var WS=["gigabuddy"];function YS(e=WS){return new RegExp(e.map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"i")}function QS(e,t,r="plugin:gigabuddy:agent",n){if(!e)return[];let o=YS(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 XS(e){let t=[];for(let r of e.split(`
|
|
74
|
-
`)){let n=/^\s*\/\/([^=\s]+?)\/:_authToken\s*=\s*(\S+)\s*$/.exec(r);if(!n)continue;let o=
|
|
73
|
+
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 ai(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},d=c.ref;if(c.ref=null,d){n(d);let f=e.seen.get(d),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===d)for(let v in u)v==="$ref"||v==="allOf"||v in l||delete u[v];if(g.$ref&&f.def)for(let v in u)v==="$ref"||v==="allOf"||v in f.def&&JSON.stringify(u[v])===JSON.stringify(f.def[v])&&delete u[v]}let m=a._zod.parent;if(m&&m!==d){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:Jr(t,"input",e.processors),output:Jr(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 hp=(e,t={})=>r=>{let n=si({...r,processors:t});return re(e,n),ii(n,e),ai(n,e)},Jr=(e,t,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=si({...o??{},target:s,io:t,processors:r});return re(e,i),ii(i,e),ai(i,e)};var Z_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gp=(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=Z_[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(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},yp=(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 d=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";d?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)},_p=(e,t,r,n)=>{r.type="boolean"},vp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")};var wp=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var bp=(e,t,r,n)=>{r.not={}},$p=(e,t,r,n)=>{},xp=(e,t,r,n)=>{},zp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},kp=(e,t,r,n)=>{let o=e._zod.def,s=Zr(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 Pp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Ep=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Tp=(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"]})},Rp=(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)},Ip=(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},Cp=(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 Op=(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 d of c)o.patternProperties[d.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(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Ap=(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"}]},Np=(e,t,r,n)=>{let o=e._zod.def;re(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},jp=(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))},Zp=(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)))},Dp=(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},Mp=(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},Up=(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 ci=(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 Kr={};gs(Kr,{ZodISODate:()=>Lp,ZodISODateTime:()=>qp,ZodISODuration:()=>Vp,ZodISOTime:()=>Fp,date:()=>li,datetime:()=>ui,duration:()=>pi,time:()=>di});var qp=y("ZodISODateTime",(e,t)=>{Ml.init(e,t),Q.init(e,t)});function ui(e){return Wd(qp,e)}var Lp=y("ZodISODate",(e,t)=>{Ul.init(e,t),Q.init(e,t)});function li(e){return Yd(Lp,e)}var Fp=y("ZodISOTime",(e,t)=>{ql.init(e,t),Q.init(e,t)});function di(e){return Qd(Fp,e)}var Vp=y("ZodISODuration",(e,t)=>{Ll.init(e,t),Q.init(e,t)});function pi(e){return Xd(Vp,e)}var H_=(e,t)=>{no.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>As(e,r)},flatten:{value:r=>Os(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Qt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Qt,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Ce=y("ZodError",H_,{Parent:Error});var Jp=oo(Ce),Kp=so(Ce),Gp=qr(Ce),Bp=Lr(Ce),Wp=$u(Ce),Yp=xu(Ce),Qp=zu(Ce),Xp=ku(Ce),ef=Su(Ce),tf=Pu(Ce),rf=Eu(Ce),nf=Tu(Ce);var of=new WeakMap;function Gr(e,t,r){let n=Object.getPrototypeOf(e),o=of.get(n);if(o||(o=new Set,of.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=y("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Jr(e,"input"),output:Jr(e,"output")}}),e.toJSONSchema=hp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>Jp(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Gp(e,r,n),e.parseAsync=async(r,n)=>Kp(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Bp(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Wp(e,r,n),e.decode=(r,n)=>Yp(e,r,n),e.encodeAsync=async(r,n)=>Qp(e,r,n),e.decodeAsync=async(r,n)=>Xp(e,r,n),e.safeEncode=(r,n)=>ef(e,r,n),e.safeDecode=(r,n)=>tf(e,r,n),e.safeEncodeAsync=async(r,n)=>rf(e,r,n),e.safeDecodeAsync=async(r,n)=>nf(e,r,n),Gr(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 Ze(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Ov(r,n))},superRefine(r,n){return this.check(Av(r,n))},overwrite(r){return this.check(vt(r))},optional(){return te(this)},exactOptional(){return bv(this)},nullable(){return uf(this)},nullish(){return te(uf(this))},nonoptional(r){return Pv(this,r)},array(){return b(this)},or(r){return G([this,r])},and(r){return ho(this,r)},transform(r){return lf(this,vf(r))},default(r){return zv(this,r)},prefault(r){return Sv(this,r)},catch(r){return Tv(this,r)},pipe(r){return lf(this,r)},readonly(){return Cv(this)},describe(r){let n=this.clone();return _t.add(n,{description:r}),n},meta(...r){if(r.length===0)return _t.get(this);let n=this.clone();return _t.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 _t.get(e)?.description},configurable:!0}),e)),df=y("_ZodString",(e,t)=>{uo.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>gp(e,n,o,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Gr(e,"_ZodString",{regex(...n){return this.check(Gs(...n))},includes(...n){return this.check(Ys(...n))},startsWith(...n){return this.check(Qs(...n))},endsWith(...n){return this.check(Xs(...n))},min(...n){return this.check(nr(...n))},max(...n){return this.check(lo(...n))},length(...n){return this.check(po(...n))},nonempty(...n){return this.check(nr(1,...n))},lowercase(n){return this.check(Bs(n))},uppercase(n){return this.check(Ws(n))},trim(){return this.check(ti())},normalize(...n){return this.check(ei(...n))},toLowerCase(){return this.check(ri())},toUpperCase(){return this.check(ni())},slugify(){return this.check(oi())}})}),mi=y("ZodString",(e,t)=>{uo.init(e,t),df.init(e,t),e.email=r=>e.check(Rd(K_,r)),e.url=r=>e.check(Ks(pf,r)),e.jwt=r=>e.check(Bd(cv,r)),e.emoji=r=>e.check(Nd(G_,r)),e.guid=r=>e.check(Js(sf,r)),e.uuid=r=>e.check(Id(fo,r)),e.uuidv4=r=>e.check(Cd(fo,r)),e.uuidv6=r=>e.check(Od(fo,r)),e.uuidv7=r=>e.check(Ad(fo,r)),e.nanoid=r=>e.check(jd(B_,r)),e.guid=r=>e.check(Js(sf,r)),e.cuid=r=>e.check(Zd(W_,r)),e.cuid2=r=>e.check(Dd(Y_,r)),e.ulid=r=>e.check(Md(Q_,r)),e.base64=r=>e.check(Jd(sv,r)),e.base64url=r=>e.check(Kd(iv,r)),e.xid=r=>e.check(Ud(X_,r)),e.ksuid=r=>e.check(qd(ev,r)),e.ipv4=r=>e.check(Ld(tv,r)),e.ipv6=r=>e.check(Fd(rv,r)),e.cidrv4=r=>e.check(Vd(nv,r)),e.cidrv6=r=>e.check(Hd(ov,r)),e.e164=r=>e.check(Gd(av,r)),e.datetime=r=>e.check(ui(r)),e.date=r=>e.check(li(r)),e.time=r=>e.check(di(r)),e.duration=r=>e.check(pi(r))});function p(e){return Ed(mi,e)}var Q=y("ZodStringFormat",(e,t)=>{B.init(e,t),df.init(e,t)}),K_=y("ZodEmail",(e,t)=>{Rl.init(e,t),Q.init(e,t)});var sf=y("ZodGUID",(e,t)=>{El.init(e,t),Q.init(e,t)});var fo=y("ZodUUID",(e,t)=>{Tl.init(e,t),Q.init(e,t)});var pf=y("ZodURL",(e,t)=>{Il.init(e,t),Q.init(e,t)});function ff(e){return Ks(pf,e)}var G_=y("ZodEmoji",(e,t)=>{Cl.init(e,t),Q.init(e,t)});var B_=y("ZodNanoID",(e,t)=>{Ol.init(e,t),Q.init(e,t)});var W_=y("ZodCUID",(e,t)=>{Al.init(e,t),Q.init(e,t)});var Y_=y("ZodCUID2",(e,t)=>{Nl.init(e,t),Q.init(e,t)});var Q_=y("ZodULID",(e,t)=>{jl.init(e,t),Q.init(e,t)});var X_=y("ZodXID",(e,t)=>{Zl.init(e,t),Q.init(e,t)});var ev=y("ZodKSUID",(e,t)=>{Dl.init(e,t),Q.init(e,t)});var tv=y("ZodIPv4",(e,t)=>{Fl.init(e,t),Q.init(e,t)});var rv=y("ZodIPv6",(e,t)=>{Vl.init(e,t),Q.init(e,t)});var nv=y("ZodCIDRv4",(e,t)=>{Hl.init(e,t),Q.init(e,t)});var ov=y("ZodCIDRv6",(e,t)=>{Jl.init(e,t),Q.init(e,t)});var sv=y("ZodBase64",(e,t)=>{Gl.init(e,t),Q.init(e,t)});var iv=y("ZodBase64URL",(e,t)=>{Bl.init(e,t),Q.init(e,t)});var av=y("ZodE164",(e,t)=>{Wl.init(e,t),Q.init(e,t)});var cv=y("ZodJWT",(e,t)=>{Yl.init(e,t),Q.init(e,t)});var mo=y("ZodNumber",(e,t)=>{qs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>yp(e,n,o,s),Gr(e,"ZodNumber",{gt(n,o){return this.check(rr(n,o))},gte(n,o){return this.check(Ke(n,o))},min(n,o){return this.check(Ke(n,o))},lt(n,o){return this.check(tr(n,o))},lte(n,o){return this.check(ut(n,o))},max(n,o){return this.check(ut(n,o))},int(n){return this.check(af(n))},safe(n){return this.check(af(n))},positive(n){return this.check(rr(0,n))},nonnegative(n){return this.check(Ke(0,n))},negative(n){return this.check(tr(0,n))},nonpositive(n){return this.check(ut(0,n))},multipleOf(n,o){return this.check(Hr(n,o))},step(n,o){return this.check(Hr(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 q(e){return ep(mo,e)}var uv=y("ZodNumberFormat",(e,t)=>{Ql.init(e,t),mo.init(e,t)});function af(e){return rp(uv,e)}var hi=y("ZodBoolean",(e,t)=>{Xl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_p(e,r,n,o)});function J(e){return np(hi,e)}var mf=y("ZodBigInt",(e,t)=>{ed.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>vp(e,n,o,s),e.gte=(n,o)=>e.check(Ke(n,o)),e.min=(n,o)=>e.check(Ke(n,o)),e.gt=(n,o)=>e.check(rr(n,o)),e.gte=(n,o)=>e.check(Ke(n,o)),e.min=(n,o)=>e.check(Ke(n,o)),e.lt=(n,o)=>e.check(tr(n,o)),e.lte=(n,o)=>e.check(ut(n,o)),e.max=(n,o)=>e.check(ut(n,o)),e.positive=n=>e.check(rr(BigInt(0),n)),e.negative=n=>e.check(tr(BigInt(0),n)),e.nonpositive=n=>e.check(ut(BigInt(0),n)),e.nonnegative=n=>e.check(Ke(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(Hr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var lv=y("ZodNull",(e,t)=>{td.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wp(e,r,n,o)});function gi(e){return ip(lv,e)}var dv=y("ZodAny",(e,t)=>{rd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$p(e,r,n,o)});function hf(){return ap(dv)}var pv=y("ZodUnknown",(e,t)=>{nd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xp(e,r,n,o)});function X(){return cp(pv)}var fv=y("ZodNever",(e,t)=>{od.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bp(e,r,n,o)});function mv(e){return up(fv,e)}var gf=y("ZodDate",(e,t)=>{sd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>zp(e,n,o,s),e.min=(n,o)=>e.check(Ke(n,o)),e.max=(n,o)=>e.check(ut(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 hv=y("ZodArray",(e,t)=>{id.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tp(e,r,n,o),e.element=t.element,Gr(e,"ZodArray",{min(r,n){return this.check(nr(r,n))},nonempty(r){return this.check(nr(1,r))},max(r,n){return this.check(lo(r,n))},length(r,n){return this.check(po(r,n))},unwrap(){return this.element}})});function b(e,t){return dp(hv,e,t)}var yf=y("ZodObject",(e,t)=>{ud.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rp(e,r,n,o),j.defineLazy(e,"shape",()=>t.shape),Gr(e,"ZodObject",{keyof(){return ze(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:mv()})},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(wf,this,r[0])},required(...r){return j.required(bf,this,r[0])}})});function $(e,t){let r={type:"object",shape:e??{},...j.normalizeParams(t)};return new yf(r)}function se(e,t){return new yf({type:"object",shape:e,catchall:X(),...j.normalizeParams(t)})}var _f=y("ZodUnion",(e,t)=>{Ls.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ip(e,r,n,o),e.options=t.options});function G(e,t){return new _f({type:"union",options:e,...j.normalizeParams(t)})}var gv=y("ZodDiscriminatedUnion",(e,t)=>{_f.init(e,t),ld.init(e,t)});function yi(e,t,r){return new gv({type:"union",options:t,discriminator:e,...j.normalizeParams(r)})}var yv=y("ZodIntersection",(e,t)=>{dd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cp(e,r,n,o)});function ho(e,t){return new yv({type:"intersection",left:e,right:t})}var cf=y("ZodRecord",(e,t)=>{pd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Op(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return!t||!t._zod?new cf({type:"record",keyType:p(),valueType:e,...j.normalizeParams(t)}):new cf({type:"record",keyType:e,valueType:t,...j.normalizeParams(r)})}var fi=y("ZodEnum",(e,t)=>{fd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,s)=>kp(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 fi({...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 fi({...t,checks:[],...j.normalizeParams(o),entries:s})}});function ze(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new fi({type:"enum",entries:r,...j.normalizeParams(t)})}var _v=y("ZodLiteral",(e,t)=>{md.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 E(e,t){return new _v({type:"literal",values:Array.isArray(e)?e:[e],...j.normalizeParams(t)})}var vv=y("ZodTransform",(e,t)=>{hd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ep(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Wt(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 vf(e){return new vv({type:"transform",transform:e})}var wf=y("ZodOptional",(e,t)=>{Fs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ci(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function te(e){return new wf({type:"optional",innerType:e})}var wv=y("ZodExactOptional",(e,t)=>{gd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ci(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bv(e){return new wv({type:"optional",innerType:e})}var $v=y("ZodNullable",(e,t)=>{yd.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 uf(e){return new $v({type:"nullable",innerType:e})}var xv=y("ZodDefault",(e,t)=>{_d.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zv(e,t){return new xv({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var kv=y("ZodPrefault",(e,t)=>{vd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Sv(e,t){return new kv({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var bf=y("ZodNonOptional",(e,t)=>{wd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Np(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Pv(e,t){return new bf({type:"nonoptional",innerType:e,...j.normalizeParams(t)})}var Ev=y("ZodCatch",(e,t)=>{bd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tv(e,t){return new Ev({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var $f=y("ZodPipe",(e,t)=>{Vs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mp(e,r,n,o),e.in=t.in,e.out=t.out});function lf(e,t){return new $f({type:"pipe",in:e,out:t})}var Rv=y("ZodPreprocess",(e,t)=>{$f.init(e,t),$d.init(e,t)}),Iv=y("ZodReadonly",(e,t)=>{xd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Up(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Cv(e){return new Iv({type:"readonly",innerType:e})}var xf=y("ZodCustom",(e,t)=>{zd.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pp(e,r,n,o)});function zf(e,t){return pp(xf,e??(()=>!0),t)}function Ov(e,t={}){return fp(xf,e,t)}function Av(e,t){return mp(e,t)}function _i(e,t){return new Rv({type:"pipe",in:vf(e),out:t})}var Sf={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 kf;kf||(kf={});var go={};gs(go,{bigint:()=>Dv,boolean:()=>Zv,date:()=>Mv,number:()=>jv,string:()=>Nv});function Nv(e){return Td(mi,e)}function jv(e){return tp(mo,e)}function Zv(e){return op(hi,e)}function Dv(e){return sp(mf,e)}function Mv(e){return lp(gf,e)}xe(kd());var Pf="io.modelcontextprotocol/related-task",_o="2.0",ce=zf(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Ef=G([p(),q().int()]),Tf=p(),FT=se({ttl:G([q(),gi()]).optional(),pollInterval:q().optional()}),qv=$({ttl:q().optional()}),Lv=$({taskId:p()}),vi=se({progressToken:Ef.optional(),[Pf]:Lv.optional()}),Oe=$({_meta:vi.optional()}),vo=Oe.extend({task:qv.optional()});var ue=$({method:p(),params:Oe.loose().optional()}),Me=$({_meta:vi.optional()}),Ue=$({method:p(),params:Me.loose().optional()}),le=se({_meta:vi.optional()}),wo=G([p(),q().int()]),Fv=$({jsonrpc:E(_o),id:wo,...ue.shape}).strict();var Vv=$({jsonrpc:E(_o),...Ue.shape}).strict();var Rf=$({jsonrpc:E(_o),id:wo,result:le}).strict();var Br;(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"})(Br||(Br={}));var If=$({jsonrpc:E(_o),id:wo.optional(),error:$({code:q().int(),message:p(),data:X().optional()})}).strict();var Hv=G([Fv,Vv,Rf,If]),VT=G([Rf,If]),wi=le.strict(),Jv=Me.extend({requestId:wo.optional(),reason:p().optional()}),bi=Ue.extend({method:E("notifications/cancelled"),params:Jv}),Kv=$({src:p(),mimeType:p().optional(),sizes:b(p()).optional(),theme:ze(["light","dark"]).optional()}),Wr=$({icons:b(Kv).optional()}),sr=$({name:p(),title:p().optional()}),Cf=sr.extend({...sr.shape,...Wr.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),Gv=ho($({applyDefaults:J().optional()}),ee(p(),X())),Bv=_i(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ho($({form:Gv.optional(),url:ce.optional()}),ee(p(),X()).optional())),Wv=se({list:ce.optional(),cancel:ce.optional(),requests:se({sampling:se({createMessage:ce.optional()}).optional(),elicitation:se({create:ce.optional()}).optional()}).optional()}),Yv=se({list:ce.optional(),cancel:ce.optional(),requests:se({tools:se({call:ce.optional()}).optional()}).optional()}),Qv=$({experimental:ee(p(),ce).optional(),sampling:$({context:ce.optional(),tools:ce.optional()}).optional(),elicitation:Bv.optional(),roots:$({listChanged:J().optional()}).optional(),tasks:Wv.optional()}),Xv=Oe.extend({protocolVersion:p(),capabilities:Qv,clientInfo:Cf}),ew=ue.extend({method:E("initialize"),params:Xv});var tw=$({experimental:ee(p(),ce).optional(),logging:ce.optional(),completions:ce.optional(),prompts:$({listChanged:J().optional()}).optional(),resources:$({subscribe:J().optional(),listChanged:J().optional()}).optional(),tools:$({listChanged:J().optional()}).optional(),tasks:Yv.optional()}),Of=le.extend({protocolVersion:p(),capabilities:tw,serverInfo:Cf,instructions:p().optional()}),rw=Ue.extend({method:E("notifications/initialized"),params:Me.optional()});var $i=ue.extend({method:E("ping"),params:Oe.optional()}),nw=$({progress:q(),total:te(q()),message:te(p())}),ow=$({...Me.shape,...nw.shape,progressToken:Ef}),xi=Ue.extend({method:E("notifications/progress"),params:ow}),sw=Oe.extend({cursor:Tf.optional()}),Yr=ue.extend({params:sw.optional()}),Qr=le.extend({nextCursor:Tf.optional()}),iw=ze(["working","input_required","completed","failed","cancelled"]),Xr=$({taskId:p(),status:iw,ttl:G([q(),gi()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:te(q()),statusMessage:te(p())}),bo=le.extend({task:Xr}),aw=Me.merge(Xr),zi=Ue.extend({method:E("notifications/tasks/status"),params:aw}),ki=ue.extend({method:E("tasks/get"),params:Oe.extend({taskId:p()})}),Si=le.merge(Xr),Pi=ue.extend({method:E("tasks/result"),params:Oe.extend({taskId:p()})}),HT=le.loose(),Ei=Yr.extend({method:E("tasks/list")}),Ti=Qr.extend({tasks:b(Xr)}),Ri=ue.extend({method:E("tasks/cancel"),params:Oe.extend({taskId:p()})}),cw=le.merge(Xr),Af=$({uri:p(),mimeType:te(p()),_meta:ee(p(),X()).optional()}),Nf=Af.extend({text:p()}),Ii=p().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),jf=Af.extend({blob:Ii}),en=ze(["user","assistant"]),ir=$({audience:b(en).optional(),priority:q().min(0).max(1).optional(),lastModified:Kr.datetime({offset:!0}).optional()}),Zf=$({...sr.shape,...Wr.shape,uri:p(),description:te(p()),mimeType:te(p()),annotations:ir.optional(),_meta:te(se({}))}),uw=$({...sr.shape,...Wr.shape,uriTemplate:p(),description:te(p()),mimeType:te(p()),annotations:ir.optional(),_meta:te(se({}))}),lw=Yr.extend({method:E("resources/list")}),Df=Qr.extend({resources:b(Zf)}),dw=Yr.extend({method:E("resources/templates/list")}),Mf=Qr.extend({resourceTemplates:b(uw)}),Ci=Oe.extend({uri:p()}),pw=Ci,fw=ue.extend({method:E("resources/read"),params:pw}),Uf=le.extend({contents:b(G([Nf,jf]))}),qf=Ue.extend({method:E("notifications/resources/list_changed"),params:Me.optional()}),mw=Ci,hw=ue.extend({method:E("resources/subscribe"),params:mw}),gw=Ci,yw=ue.extend({method:E("resources/unsubscribe"),params:gw}),_w=Me.extend({uri:p()}),vw=Ue.extend({method:E("notifications/resources/updated"),params:_w}),ww=$({name:p(),description:te(p()),required:te(J())}),bw=$({...sr.shape,...Wr.shape,description:te(p()),arguments:te(b(ww)),_meta:te(se({}))}),$w=Yr.extend({method:E("prompts/list")}),Lf=Qr.extend({prompts:b(bw)}),xw=Oe.extend({name:p(),arguments:ee(p(),p()).optional()}),zw=ue.extend({method:E("prompts/get"),params:xw}),Oi=$({type:E("text"),text:p(),annotations:ir.optional(),_meta:ee(p(),X()).optional()}),Ai=$({type:E("image"),data:Ii,mimeType:p(),annotations:ir.optional(),_meta:ee(p(),X()).optional()}),Ni=$({type:E("audio"),data:Ii,mimeType:p(),annotations:ir.optional(),_meta:ee(p(),X()).optional()}),kw=$({type:E("tool_use"),name:p(),id:p(),input:ee(p(),X()),_meta:ee(p(),X()).optional()}),Sw=$({type:E("resource"),resource:G([Nf,jf]),annotations:ir.optional(),_meta:ee(p(),X()).optional()}),Pw=Zf.extend({type:E("resource_link")}),ji=G([Oi,Ai,Ni,Pw,Sw]),Ew=$({role:en,content:ji}),Ff=le.extend({description:p().optional(),messages:b(Ew)}),Vf=Ue.extend({method:E("notifications/prompts/list_changed"),params:Me.optional()}),Tw=$({title:p().optional(),readOnlyHint:J().optional(),destructiveHint:J().optional(),idempotentHint:J().optional(),openWorldHint:J().optional()}),Rw=$({taskSupport:ze(["required","optional","forbidden"]).optional()}),Hf=$({...sr.shape,...Wr.shape,description:p().optional(),inputSchema:$({type:E("object"),properties:ee(p(),ce).optional(),required:b(p()).optional()}).catchall(X()),outputSchema:$({type:E("object"),properties:ee(p(),ce).optional(),required:b(p()).optional()}).catchall(X()).optional(),annotations:Tw.optional(),execution:Rw.optional(),_meta:ee(p(),X()).optional()}),Iw=Yr.extend({method:E("tools/list")}),Jf=Qr.extend({tools:b(Hf)}),$o=le.extend({content:b(ji).default([]),structuredContent:ee(p(),X()).optional(),isError:J().optional()}),JT=$o.or(le.extend({toolResult:X()})),Cw=vo.extend({name:p(),arguments:ee(p(),X()).optional()}),Ow=ue.extend({method:E("tools/call"),params:Cw}),Zi=Ue.extend({method:E("notifications/tools/list_changed"),params:Me.optional()}),Aw=$({autoRefresh:J().default(!0),debounceMs:q().int().nonnegative().default(300)}),Kf=ze(["debug","info","notice","warning","error","critical","alert","emergency"]),Nw=Oe.extend({level:Kf}),jw=ue.extend({method:E("logging/setLevel"),params:Nw}),Zw=Me.extend({level:Kf,logger:p().optional(),data:X()}),Dw=Ue.extend({method:E("notifications/message"),params:Zw}),Mw=$({name:p().optional()}),Uw=$({hints:b(Mw).optional(),costPriority:q().min(0).max(1).optional(),speedPriority:q().min(0).max(1).optional(),intelligencePriority:q().min(0).max(1).optional()}),qw=$({mode:ze(["auto","required","none"]).optional()}),Lw=$({type:E("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:b(ji).default([]),structuredContent:$({}).loose().optional(),isError:J().optional(),_meta:ee(p(),X()).optional()}),Fw=yi("type",[Oi,Ai,Ni]),yo=yi("type",[Oi,Ai,Ni,kw,Lw]),Vw=$({role:en,content:G([yo,b(yo)]),_meta:ee(p(),X()).optional()}),Hw=vo.extend({messages:b(Vw),modelPreferences:Uw.optional(),systemPrompt:p().optional(),includeContext:ze(["none","thisServer","allServers"]).optional(),temperature:q().optional(),maxTokens:q().int(),stopSequences:b(p()).optional(),metadata:ce.optional(),tools:b(Hf).optional(),toolChoice:qw.optional()}),Gf=ue.extend({method:E("sampling/createMessage"),params:Hw}),Bf=le.extend({model:p(),stopReason:te(ze(["endTurn","stopSequence","maxTokens"]).or(p())),role:en,content:Fw}),Wf=le.extend({model:p(),stopReason:te(ze(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:en,content:G([yo,b(yo)])}),Jw=$({type:E("boolean"),title:p().optional(),description:p().optional(),default:J().optional()}),Kw=$({type:E("string"),title:p().optional(),description:p().optional(),minLength:q().optional(),maxLength:q().optional(),format:ze(["email","uri","date","date-time"]).optional(),default:p().optional()}),Gw=$({type:ze(["number","integer"]),title:p().optional(),description:p().optional(),minimum:q().optional(),maximum:q().optional(),default:q().optional()}),Bw=$({type:E("string"),title:p().optional(),description:p().optional(),enum:b(p()),default:p().optional()}),Ww=$({type:E("string"),title:p().optional(),description:p().optional(),oneOf:b($({const:p(),title:p()})),default:p().optional()}),Yw=$({type:E("string"),title:p().optional(),description:p().optional(),enum:b(p()),enumNames:b(p()).optional(),default:p().optional()}),Qw=G([Bw,Ww]),Xw=$({type:E("array"),title:p().optional(),description:p().optional(),minItems:q().optional(),maxItems:q().optional(),items:$({type:E("string"),enum:b(p())}),default:b(p()).optional()}),eb=$({type:E("array"),title:p().optional(),description:p().optional(),minItems:q().optional(),maxItems:q().optional(),items:$({anyOf:b($({const:p(),title:p()}))}),default:b(p()).optional()}),tb=G([Xw,eb]),rb=G([Yw,Qw,tb]),nb=G([rb,Jw,Kw,Gw]),ob=vo.extend({mode:E("form").optional(),message:p(),requestedSchema:$({type:E("object"),properties:ee(p(),nb),required:b(p()).optional()})}),sb=vo.extend({mode:E("url"),message:p(),elicitationId:p(),url:p().url()}),ib=G([ob,sb]),Yf=ue.extend({method:E("elicitation/create"),params:ib}),ab=Me.extend({elicitationId:p()}),cb=Ue.extend({method:E("notifications/elicitation/complete"),params:ab}),Qf=le.extend({action:ze(["accept","decline","cancel"]),content:_i(e=>e===null?void 0:e,ee(p(),G([p(),q(),J(),b(p())])).optional())}),ub=$({type:E("ref/resource"),uri:p()});var lb=$({type:E("ref/prompt"),name:p()}),db=Oe.extend({ref:G([lb,ub]),argument:$({name:p(),value:p()}),context:$({arguments:ee(p(),p()).optional()}).optional()}),pb=ue.extend({method:E("completion/complete"),params:db});var Xf=le.extend({completion:se({values:b(p()).max(100),total:te(q().int()),hasMore:te(J())})}),fb=$({uri:p().startsWith("file://"),name:p().optional(),_meta:ee(p(),X()).optional()}),mb=ue.extend({method:E("roots/list"),params:Oe.optional()}),hb=le.extend({roots:b(fb)}),gb=Ue.extend({method:E("notifications/roots/list_changed"),params:Me.optional()}),KT=G([$i,ew,pb,jw,zw,$w,lw,dw,fw,hw,yw,Ow,Iw,ki,Pi,Ei,Ri]),GT=G([bi,xi,rw,gb,zi]),BT=G([wi,Bf,Wf,Qf,hb,Si,Ti,bo]),WT=G([$i,Gf,Yf,mb,ki,Pi,Ei,Ri]),YT=G([bi,xi,Dw,vw,qf,Zi,Vf,zi,cb]),QT=G([wi,Of,Xf,Ff,Lf,Df,Mf,Uf,$o,Jf,Si,Ti,bo]);var yb=Symbol("Let zodToJsonSchema decide on which parser to use");var IR=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var jS=Xy(ty(),1);var DS;DS=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);var me=ff().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Sf.custom,message:"URL must be parseable",fatal:!0}),bs}).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"}),MS=se({resource:p().url(),authorization_servers:b(me).optional(),jwks_uri:p().url().optional(),scopes_supported:b(p()).optional(),bearer_methods_supported:b(p()).optional(),resource_signing_alg_values_supported:b(p()).optional(),resource_name:p().optional(),resource_documentation:p().optional(),resource_policy_uri:p().url().optional(),resource_tos_uri:p().url().optional(),tls_client_certificate_bound_access_tokens:J().optional(),authorization_details_types_supported:b(p()).optional(),dpop_signing_alg_values_supported:b(p()).optional(),dpop_bound_access_tokens_required:J().optional()}),ny=se({issuer:p(),authorization_endpoint:me,token_endpoint:me,registration_endpoint:me.optional(),scopes_supported:b(p()).optional(),response_types_supported:b(p()),response_modes_supported:b(p()).optional(),grant_types_supported:b(p()).optional(),token_endpoint_auth_methods_supported:b(p()).optional(),token_endpoint_auth_signing_alg_values_supported:b(p()).optional(),service_documentation:me.optional(),revocation_endpoint:me.optional(),revocation_endpoint_auth_methods_supported:b(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:b(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:b(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:b(p()).optional(),code_challenge_methods_supported:b(p()).optional(),client_id_metadata_document_supported:J().optional()}),US=se({issuer:p(),authorization_endpoint:me,token_endpoint:me,userinfo_endpoint:me.optional(),jwks_uri:me,registration_endpoint:me.optional(),scopes_supported:b(p()).optional(),response_types_supported:b(p()),response_modes_supported:b(p()).optional(),grant_types_supported:b(p()).optional(),acr_values_supported:b(p()).optional(),subject_types_supported:b(p()),id_token_signing_alg_values_supported:b(p()),id_token_encryption_alg_values_supported:b(p()).optional(),id_token_encryption_enc_values_supported:b(p()).optional(),userinfo_signing_alg_values_supported:b(p()).optional(),userinfo_encryption_alg_values_supported:b(p()).optional(),userinfo_encryption_enc_values_supported:b(p()).optional(),request_object_signing_alg_values_supported:b(p()).optional(),request_object_encryption_alg_values_supported:b(p()).optional(),request_object_encryption_enc_values_supported:b(p()).optional(),token_endpoint_auth_methods_supported:b(p()).optional(),token_endpoint_auth_signing_alg_values_supported:b(p()).optional(),display_values_supported:b(p()).optional(),claim_types_supported:b(p()).optional(),claims_supported:b(p()).optional(),service_documentation:p().optional(),claims_locales_supported:b(p()).optional(),ui_locales_supported:b(p()).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()}),qS=$({...US.shape,...ny.pick({code_challenge_methods_supported:!0}).shape}),LS=$({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:go.number().optional(),scope:p().optional(),refresh_token:p().optional()}).strip(),FS=$({error:p(),error_description:p().optional(),error_uri:p().optional()}),ry=me.optional().or(E("").transform(()=>{})),VS=$({redirect_uris:b(me),token_endpoint_auth_method:p().optional(),grant_types:b(p()).optional(),response_types:b(p()).optional(),client_name:p().optional(),client_uri:me.optional(),logo_uri:ry,scope:p().optional(),contacts:b(p()).optional(),tos_uri:ry,policy_uri:p().optional(),jwks_uri:me.optional(),jwks:hf().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),HS=$({client_id:p(),client_secret:p().optional(),client_id_issued_at:q().optional(),client_secret_expires_at:q().optional()}).strip(),JS=VS.merge(HS),yN=$({error:p(),error_description:p().optional()}).strip(),_N=$({token:p(),token_type_hint:p().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}},On=class extends oe{};On.errorCode="invalid_request";var zr=class extends oe{};zr.errorCode="invalid_client";var kr=class extends oe{};kr.errorCode="invalid_grant";var Sr=class extends oe{};Sr.errorCode="unauthorized_client";var An=class extends oe{};An.errorCode="unsupported_grant_type";var Nn=class extends oe{};Nn.errorCode="invalid_scope";var jn=class extends oe{};jn.errorCode="access_denied";var Pr=class extends oe{};Pr.errorCode="server_error";var Zn=class extends oe{};Zn.errorCode="temporarily_unavailable";var Dn=class extends oe{};Dn.errorCode="unsupported_response_type";var Mn=class extends oe{};Mn.errorCode="unsupported_token_type";var Un=class extends oe{};Un.errorCode="invalid_token";var qn=class extends oe{};qn.errorCode="method_not_allowed";var Ln=class extends oe{};Ln.errorCode="too_many_requests";var Er=class extends oe{};Er.errorCode="invalid_client_metadata";var Fn=class extends oe{};Fn.errorCode="insufficient_scope";var Vn=class extends oe{};Vn.errorCode="invalid_target";var KS={[On.errorCode]:On,[zr.errorCode]:zr,[kr.errorCode]:kr,[Sr.errorCode]:Sr,[An.errorCode]:An,[Nn.errorCode]:Nn,[jn.errorCode]:jn,[Pr.errorCode]:Pr,[Zn.errorCode]:Zn,[Dn.errorCode]:Dn,[Mn.errorCode]:Mn,[Un.errorCode]:Un,[qn.errorCode]:qn,[Ln.errorCode]:Ln,[Er.errorCode]:Er,[Fn.errorCode]:Fn,[Vn.errorCode]:Vn};async function GS(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 oy(e){return new Promise(t=>setTimeout(t,e))}function Hn(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 BS(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 WS(e,t,r={}){let n=r.fetchImpl??fetch,o=Date.now()+t.expiresIn*1e3,s=(t.interval||5)*1e3;for(;Date.now()<o;){await oy(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 oy(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??Hn(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 sy(e){let t=await BS({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??GS)(t.verificationUrl).catch(()=>{}),WS(e.authUrl,t,{onPending:e.onPending,fetchImpl:e.fetchImpl})}function Ac(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 YS(e,t){return e.userId&&t.userId?e.userId===t.userId:e.email&&t.email?e.email.toLowerCase()===t.email.toLowerCase():null}function Tr(e){return e.email&&e.userId?`${e.email} (${e.userId})`:e.email??e.userId??"unknown"}var QS=["gigabuddy"];function XS(e=QS){return new RegExp(e.map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"i")}function eP(e,t,r="plugin:gigabuddy:agent",n){if(!e)return[];let o=XS(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 tP(e){let t=[];for(let r of e.split(`
|
|
74
|
+
`)){let n=/^\s*\/\/([^=\s]+?)\/:_authToken\s*=\s*(\S+)\s*$/.exec(r);if(!n)continue;let o=Ac(n[2]);o?.userId?.startsWith("user:")&&t.push({host:n[1],principal:o})}return t}function iy(e){let t=[];for(let{host:n,principal:o}of tP(e.npmrc))YS(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?eP(e.claudeConfig,e.projectDir,e.selfDoorName,e.doorNames):[];return{self:e.self,secondDoors:r,mismatches:t}}function Et(e){let t=new URL(e),r=t.pathname.replace(/\/+$/,"");return`//${t.host}${r}/:_authToken`}function Jn(e){return`${e}:registry`}function Kn(e){return e.replace(/\/+$/,"")+"/"}function ay(e,t){let r=Kn(t.registryUrl),n=new Map([[Jn(t.scope).toLowerCase(),`${Jn(t.scope)}=${r}`],[Et(r).toLowerCase(),`${Et(r)}=${t.token}`]]),o=e.length>0?e.split(`
|
|
75
75
|
`):[],s=new Set,i=[];for(let c of o){let u=uy(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(`
|
|
76
76
|
`);for(;i.length>0&&i[i.length-1].trim()==="";)i.pop();return[...i,...a,""].join(`
|
|
77
|
-
`)}function cy(e,t){let r=
|
|
77
|
+
`)}function cy(e,t){let r=Kn(t.registryUrl),n=new Set([Jn(t.scope).toLowerCase(),Et(r).toLowerCase()]),s=e.split(`
|
|
78
78
|
`).filter(i=>{let a=uy(i);return!(a&&n.has(a))}).join(`
|
|
79
|
-
`);return s.trim().length===0?"":s}function uy(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 ss from"node:fs";import*as ly from"node:os";import*as Tt from"node:path";var He="@gigabuddy";async function
|
|
80
|
-
`).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 Dc(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 py(e,t=$e()){let r=Et(
|
|
81
|
-
`)){let s=o.trim();if(!s||s.startsWith("#")||s.startsWith(";"))continue;let i=s.indexOf("=");i!==-1&&s.slice(0,i).trim().toLowerCase()===r&&(n=s.slice(i+1).trim())}return n?{token:n,expiresAt:Dc(n)}:null}function fy(e,t=$e()){let r=jc(t),n=cy(r,{scope:He,registryUrl:e});return n===r?null:(Qn(t,n),t)}var
|
|
82
|
-
`)){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 gy(e,t){let r=[],n=[],o=(w,k,x)=>r.push({label:w,status:k,detail:x}),s=Number(e.nodeVersion.replace(/^v/,"").split(".")[0]);Number.isFinite(s)&&s<qc?(o("Node version","fail",`${e.nodeVersion} \u2014 gigabuddy needs Node ${qc} or newer`),n.push(`Upgrade Node to ${qc}+ \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 Rt({refreshToken:i.refreshToken,authUrl:i.authUrl,fetchImpl:e.fetchImpl}).getToken();let w=
|
|
79
|
+
`);return s.trim().length===0?"":s}function uy(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 ss from"node:fs";import*as ly from"node:os";import*as Tt from"node:path";var He="@gigabuddy";async function Nc(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 dy(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 $e(){return process.env.NPM_CONFIG_USERCONFIG??Tt.join(ly.homedir(),".npmrc")}function jc(e){try{return ss.readFileSync(e,"utf-8")}catch{return""}}function is(e,t=$e()){let r=ay(jc(t),{scope:He,registryUrl:e.registryUrl,token:e.token});return Qn(t,r),t}function Zc(e,t=$e()){let r=[],n=Tt.resolve(e);for(;;){let o=Tt.join(n,".npmrc");o!==Tt.resolve(t)&&ss.existsSync(o)&&r.push(o);let s=Tt.dirname(n);if(s===n)break;n=s}return r}function as(e,t){let r=Et(Kn(t)).toLowerCase(),n=Jn(He).toLowerCase();return e.split(`
|
|
80
|
+
`).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 Dc(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 py(e,t=$e()){let r=Et(Kn(e)).toLowerCase(),n=null;for(let o of jc(t).split(`
|
|
81
|
+
`)){let s=o.trim();if(!s||s.startsWith("#")||s.startsWith(";"))continue;let i=s.indexOf("=");i!==-1&&s.slice(0,i).trim().toLowerCase()===r&&(n=s.slice(i+1).trim())}return n?{token:n,expiresAt:Dc(n)}:null}function fy(e,t=$e()){let r=jc(t),n=cy(r,{scope:He,registryUrl:e});return n===r?null:(Qn(t,n),t)}var rP="gigabuddy:registry";function Mc(e=process.env){return!!(e.ACTIONS_ID_TOKEN_REQUEST_URL&&e.ACTIONS_ID_TOKEN_REQUEST_TOKEN)}async function my(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(rP)}`,{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 hy(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 Rt=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 Uc="@gigabuddy",qc=20;function Lc(e,t){let r=null;for(let n of e.split(`
|
|
82
|
+
`)){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 gy(e,t){let r=[],n=[],o=(w,k,x)=>r.push({label:w,status:k,detail:x}),s=Number(e.nodeVersion.replace(/^v/,"").split(".")[0]);Number.isFinite(s)&&s<qc?(o("Node version","fail",`${e.nodeVersion} \u2014 gigabuddy needs Node ${qc} or newer`),n.push(`Upgrade Node to ${qc}+ \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 Rt({refreshToken:i.refreshToken,authUrl:i.authUrl,fetchImpl:e.fetchImpl}).getToken();let w=Hn(c);w&&(a.detail=w),o("Session","ok","live")}catch(w){o("Session","fail",`not accepted by auth \u2014 ${w instanceof Error?w.message:String(w)}`),n.push("Run `gigabuddy login` \u2014 your session was revoked or expired, so every credential from it is dead.")}let u=e.readNpmrc(),l=Lc(u,`${Uc}:registry`);l?o(`${Uc} registry`,"ok",l):(o(`${Uc} registry`,"fail",`not set in ${$e()}`),n.push("Run `gigabuddy login --npm` \u2014 npm has no registry configured for @gigabuddy packages."));let d=l?Et(l):null,m=d?Lc(u,d):null;if(l&&!m)o("Registry credential","fail",`no ${d} in ${$e()}`),n.push("Run `gigabuddy login --npm` \u2014 the registry is configured but has no credential to authenticate with.");else if(m){let w=Dc(m);w&&w.getTime()<Date.now()?(o("Registry credential","fail",`expired ${w.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",w?`valid until ${w.toISOString().slice(0,10)}`:"present")}{let w={...i.userId?{userId:i.userId}:{},...a.detail?{email:a.detail}:{},...Ac(c)??{}},k=iy({self:w,npmrc:u,npmrcLabel:$e(),claudeConfig:e.readClaudeConfig(),projectDir:e.projectDir});for(let S of k.mismatches)o("Same account everywhere","fail",`${S.source} is ${Tr(S.principal)}`),n.push(`Your login is ${Tr(w)} but ${S.source} was minted as ${Tr(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 ${Tr(w)} \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",Tr(w))}let f=e.shadowingNpmrcFiles().filter(w=>as(w.contents,l??"")),g=m,_=$e();if(f.length>0){let w=f[0],k=d?Lc(w.contents,d):null;k&&(g=k,_=w.path),o("Other .npmrc files","fail",`${w.path} also configures this registry`),n.push(`${w.path} sets a credential for this registry, and npm prefers it over ${$e()} \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 v=e.npmEffectiveRegistry();if(v&&l&&v.replace(/\/+$/,"")!==l.replace(/\/+$/,"")?(o("npm resolves @gigabuddy to","fail",`${v} \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 ${v}.`)):v&&o("npm resolves @gigabuddy to","ok",v),l&&g){let w=l.replace(/\/+$/,""),k=_===$e()?"":` (using the credential from ${_})`;try{let x=await e.fetchImpl(`${w}/-/ping`,{headers:{authorization:`Bearer ${g}`}});x.ok?o("Registry reachable","ok",`${w}${k}`):x.status===401?(o("Registry reachable","fail",`reachable, but rejected the credential (401)${k}`),n.push(_===$e()?"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 ${w} \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(`${w}/${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 nP={ok:"\u2713",warn:"!",fail:"\u2717",skip:"-"};function yy(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],nP[i.status])} ${i.label.padEnd(o)} ${i.detail??""}`.trimEnd());if(e.advice.length===0)return s.push("",` ${r("32","Everything checks out.")}`),s.join(`
|
|
83
83
|
`);s.push("",r("1"," What to do:"));for(let i of e.advice){let a=i.replace(/(.{1,74})(\s|$)/g,`$1
|
|
84
84
|
`).trimEnd().split(`
|
|
85
85
|
`);s.push(` \u2022 ${a[0]}`);for(let c of a.slice(1))s.push(` ${c}`)}return s.join(`
|
|
86
|
-
`)}var oP=["agent:spawn","discovery:read","packages:read"],Ne="user",sP="https://auth.gigabuddy.com",iP="https://api.gigabuddy.com",aP="https://auth.staging.gigabuddy.com",cP="https://api.staging.gigabuddy.com";function $y(e){let t=e.staging??!1;return{staging:t,authUrl:e.authUrl??(t?aP:sP),apiUrl:e.apiUrl??(t?cP:iP)}}function xy(e){try{return Hc(e,"utf-8")}catch{return""}}function h(e=""){console.error(e)}function Jt(e){return e?(Kt(e),{name:e,source:"env"}):Xe()}function ls(e){return e===Ct?"":` (account: ${e})`}async function zy(e,t){let r=Jt(t).name;h(`Signing in to ${e.staging?"Gigabuddy Staging":"Gigabuddy"}${ls(r)}\u2026`);let n=await sy({authUrl:e.authUrl,apiUrl:e.apiUrl,clientId:"gigabuddy-cli",scopes:oP,onPrompt:({verificationUrl:s,userCode:i})=>{h(),h(` Open: ${s}`),h(` Code: ${i}`),h()},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 ws(o,e.staging,Ne,r),o}async function ky(e,t={}){let r=Jt(t.account).name,n=await zy(e,r);h(),h(" Signed in."),n.userEmail&&h(` Account: ${n.userEmail}${ls(r)}`),h(` Saved to: ${jr(e.staging,Ne,r)}`),t.account&&await uP(t.account),h(),h(` To install ${He} packages from the Gigabuddy registry: gigabuddy login --npm`)}async function uP(e){let t=Xe();if(t.name===e)return;let r=Ar(process.cwd());if(process.stdin.isTTY!==!0||process.stderr.isTTY!==!0){h(),h(` This directory resolves account "${t.name}". To use ${e} here: gigabuddy use ${e}`);return}h();let n=by.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"?(vs(r,e),h(` Pinned. Everything under this repo (worktrees included) now signs as ${e}.`)):h(` Left unpinned \u2014 this login is saved, and \`gigabuddy use ${e}\` pins it later.`)}finally{n.close()}}function Gc(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 Sy(e,t){if(Mc()){await dP(e);return}let r=Jt(t).name,n=je(e.staging,Ne,r),o=!n;if(n||(h("Not signed in yet \u2014 signing in first."),h(),n=await zy(e,r),h(),h(" Signed in.")),!o){await _y(n);return}try{await _y(n)}catch(s){h(),h(` \u26A0 Signed in, but npm setup failed: ${s instanceof Error?s.message:String(s)}`),h(" You are signed in \u2014 retry just that half with: gigabuddy login --npm"),process.exitCode=1}}var lP=7*24*60*60*1e3;async function Py(e,t,r=Date.now()){if(Mc())return;let n=je(e.staging,Ne,Jt(t).name);if(!n)return;let o=py(Ey(e.staging,t));if(o&&!(o.expiresAt&&o.expiresAt.getTime()-r>lP))try{let s=await Ac({authUrl:n.authUrl,refreshToken:n.refreshToken}),i=is(s);h(`Renewed the npm credential for ${He}${Gc(s.expiresIn)} in ${i}`)}catch(s){h(`Could not renew the npm credential: ${s instanceof Error?s.message:String(s)}`),h("Run `gigabuddy login --npm` to renew it by hand."),process.exitCode=1}}async function _y(e){let t=await Ac({authUrl:e.authUrl,refreshToken:e.refreshToken}),r=is(t);h(),h(` npm is set up for ${He} packages${Gc(t.expiresIn)}`),h(` Registry: ${t.registryUrl}`),h(` Written to: ${r}`),h(),h(` Try it: npm install ${He}/app-kit`),h(),h(" This credential is registry-only \u2014 it installs what you can install and nothing else."),h(" Run this again when it expires, or after your access changes.");let n=Zc(process.cwd()).filter(o=>as(xy(o),t.registryUrl));n.length>0&&(h(),h(` \u26A0 ${n[0]} also configures this registry, and npm prefers it over ${r}.`),h(" Installs will keep using THAT credential, not this one. Delete its _authToken line."))}async function dP(e){h("GitHub Actions detected \u2014 using the job\u2019s OIDC identity (no sign-in, nothing stored).");let t=await my(),r=await hy({authUrl:e.authUrl,idToken:t}),n=is(r);h(),h(` npm is set up for ${He} packages as ${r.repository}\u2019s CI${Gc(r.expiresIn)}`),h(` Registry: ${r.registryUrl}`),h(` Written to: ${n}`),r.bindings.length>0&&h(` Sponsored by ${r.bindings.length} room(s): ${r.bindings.map(o=>o.placeId).join(", ")}`),h(),h(" This credential is registry-only and expires with the job. Run it again in any later job that installs.")}function Ey(e,t){let r=je(e,Ne,Jt(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 Bc(e,t){let r=fy(Ey(e.staging,t));if(!r){h(`No ${He} registry entries found in ${$e()}`);return}h(`Removed ${He} registry credentials from ${r}`)}async function Ty(e,t){let r=Jt(t).name,n=je(e.staging,Ne,r);if(Bc(e,r),!n){h(`Not signed in${ls(r)}.`);return}let o=await dy({authUrl:n.authUrl,refreshToken:n.refreshToken});lu(e.staging,Ne,r),o?h(`Signed out${e.staging?" of staging":""}. Any npm credential from this session stops working shortly.`):(h(`Signed out locally${e.staging?" of staging":""} \u2014 but could not reach the server to revoke the session.`),h(" Credentials already copied elsewhere may keep working. Sign out again when you are back online,"),h(" or revoke the session from your account settings."))}async function Jc(e,t,r){if(e.userEmail)return e.userEmail;try{let n=await new Rt({refreshToken:e.refreshToken,authUrl:e.authUrl}).getToken(),o=Jn(n);return o?(ws({...e,userEmail:o},t,Ne,r),o):e.userId}catch{return e.userId}}async function Ry(e,t){let r=await gy({readNpmrc:()=>{try{return Hc($e(),"utf-8")}catch{return""}},npmEffectiveRegistry:()=>{try{let o=wy("npm",["config","get",`${He}:registry`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();return o&&o!=="undefined"&&o!=="null"?o:null}catch{return null}},shadowingNpmrcFiles:()=>Zc(process.cwd()).map(o=>({path:o,contents:xy(o)})),fetchImpl:fetch,nodeVersion:process.version,loadCredentials:o=>je(o,Ne),readClaudeConfig:()=>{try{return JSON.parse(Hc(nP(rP(),".claude.json"),"utf-8"))}catch{return null}},projectDir:process.cwd()},t),n=process.stderr.isTTY===!0&&!process.env.NO_COLOR;h(),h(yy(r,n)),h(),r.advice.length>0&&(process.exitCode=1)}var Rr="gigabuddy/agent-plugins",It="gigabuddy@gigabuddy",Kc="gigabuddy",Wc="@gigabuddy/agent",us=["install","-g",`${Wc}@latest`,"--@gigabuddy:registry=https://registry.npmjs.org/"],ds=["claude","codex"];function Fc(e,t,r){let n=Tr(e,t,{stdio:["ignore","inherit","inherit"],timeout:r});if(n.error&&n.error.code==="ENOENT")return"missing";if(n.error&&n.error.code==="ETIMEDOUT")return 1;if(n.error)throw n.error;return n.status??1}function Yc(e){return Tr(e,["--version"],{stdio:"ignore"}).status===0}var Vc;function cs(){if(Vc===void 0){let e=["codex"];process.platform==="darwin"&&e.push("/Applications/ChatGPT.app/Contents/Resources/codex","/Applications/Codex.app/Contents/Resources/codex"),Vc=e.find(Yc)??null}return Vc}var vy="0.148.0";function pP(e,t){let r=s=>(s.match(/\d+(\.\d+)*/)?.[0]??"0").split(".").map(Number),n=r(e),o=r(t);for(let s=0;s<Math.max(n.length,o.length);s++){let i=(n[s]??0)-(o[s]??0);if(i!==0)return i>0}return!0}function fP(e){let t=Tr(e,["--version"],{encoding:"utf-8"});return t.status===0?/\d+\.\d+\.\d+/.exec(t.stdout)?.[0]??null:null}var Bn={has:e=>e==="claude"?Yc("claude"):cs()!==null,runClaude:e=>Fc("claude",e),runCodex(e){let t=cs();return t?Fc(t,e):"missing"},codexVersion(){let e=cs();return e?fP(e):null},installAgent(){return Tr("npm",us,{stdio:["ignore","inherit","inherit"]}).status??1},warmAgent:()=>Fc("gigabuddy-agent",["warm"],3e4)};function Iy(e,t=Bn){let r=e?[e]:ds.filter(n=>t.has(n));if(r.length===0){h("Could not find Claude Code or Codex on this machine."),h(),h(" In Claude Code, run these inside any session:"),h(),h(` /plugin marketplace add ${Rr}`),h(` /plugin install ${It}`),h(),h(" For Codex, install it and run `gigabuddy setup codex`."),process.exitCode=1;return}r.forEach((n,o)=>{o>0&&h(),n==="claude"?mP(t):hP(t)})}function mP(e){h("Setting up Gigabuddy for Claude Code\u2026"),h();let t=e.runClaude(["plugin","marketplace","add",Rr]);if(t==="missing"){h(" Could not find the `claude` command on this machine."),h(" If Claude Code is installed, run these inside any Claude Code session instead:"),h(),h(` /plugin marketplace add ${Rr}`),h(` /plugin install ${It}`),h(),h(" Then restart Claude Code."),process.exitCode=1;return}if(t!==0){h(),h(" \u26A0 Adding the Gigabuddy marketplace failed (see above). Nothing else was changed."),process.exitCode=1;return}if(e.runClaude(["plugin","install",It])!==0){h(),h(" \u26A0 Installing the plugin failed (see above). The marketplace was added \u2014 retry with:"),h(),h(` claude plugin install ${It}`),process.exitCode=1;return}h(),h(` Installing the agent (${Wc})\u2026`),e.installAgent()!==0&&(h(),h(" \u26A0 Installing the agent failed (see above). The plugin still works, but downloads the"),h(" agent each time it starts. Retry with:"),h(),h(` npm ${us.slice(0,3).join(" ")}`)),h(),h(" Gigabuddy is installed in Claude Code. Next:"),h(),h(" 1. Restart Claude Code so the plugin loads."),h(" 2. Ask your session to sign you in and connect you to a room."),h(' (Several identities on this machine? Say which: "sign in as my work account".)')}function hP(e){h("Setting up Gigabuddy for Codex\u2026"),h();let t=e.codexVersion();if(t&&!pP(t,vy)){h(` Gigabuddy needs Codex ${vy} or newer; this machine has ${t}.`),h(" Update Codex first (the desktop app updates itself; for the CLI run"),h(" `npm install -g @openai/codex@latest`), then run `gigabuddy setup codex` again."),process.exitCode=1;return}let r=e.runCodex(["plugin","marketplace","add",Rr]);if(r==="missing"){h(" Could not find the `codex` command on this machine. Once Codex is installed, run:"),h(),h(` codex plugin marketplace add ${Rr}`),h(` codex plugin add ${It}`),h(` npm ${us.slice(0,3).join(" ")}`),process.exitCode=1;return}if(r!==0){h(),h(" \u26A0 Adding the Gigabuddy marketplace failed (see above). Nothing else was changed."),process.exitCode=1;return}if(e.runCodex(["plugin","marketplace","upgrade",Kc]),e.runCodex(["plugin","add",It])!==0){h(),h(" \u26A0 Installing the plugin failed (see above). The marketplace was added \u2014 retry with:"),h(),h(` codex plugin add ${It}`),process.exitCode=1;return}h(),h(` Installing the agent (${Wc})\u2026`),e.installAgent()!==0?(h(),h(" \u26A0 Installing the agent failed (see above). The plugin works without it, but starts"),h(" too slowly for Codex some of the time. Retry with:"),h(),h(` npm ${us.slice(0,3).join(" ")}`),process.exitCode=1):e.warmAgent()!==0&&(h(" Your room's tools will be listed from your second Codex session. Once the above is"),h(" fixed, `gigabuddy setup codex` again gets them into the first.")),h(),h(" Gigabuddy is installed in Codex. Next:"),h(),h(" 1. Restart Codex so the plugin loads."),h(" 2. In a new thread, ask Codex to connect you to your Gigabuddy room.")}function Qc(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 gP={latestVersion(){try{return wy("npm",["view","gigabuddy","version"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()||null}catch{return null}},installLatest(){return Tr("npm",["install","-g","gigabuddy@latest"],{stdio:["ignore","inherit","inherit"]}).status??1},refreshPlugin(){return Bn.runClaude(["plugin","marketplace","add",Rr])},refreshCodexPlugin(){let e=cs();if(!e)return"missing";let t=Tr(e,["plugin","marketplace","list"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});if(!new RegExp(`^${Kc}\\s`,"m").test(t.stdout??""))return"missing";let r=Bn.runCodex(["plugin","marketplace","upgrade",Kc]);return r===0?Bn.runCodex(["plugin","add",It]):r},updateAgent(){return Yc("gigabuddy-agent")?Bn.installAgent():"not-installed"}};async function Cy(e,t=gP){let r=t.latestVersion();if(!r){h("Could not reach npm to check for a newer version \u2014 are you online?"),process.exitCode=1;return}if(r===e)h(`gigabuddy v${e} is already the latest.`);else{if(h(`Updating gigabuddy v${e} \u2192 v${r}\u2026`),t.installLatest()!==0){h(),h(" \u26A0 npm install failed (see above). Try: npm install -g gigabuddy@latest"),process.exitCode=1;return}h(` Updated to v${r}.`)}t.refreshPlugin()===0&&h(" Claude Code plugin refreshed (restart Claude Code to pick up a new version)."),t.refreshCodexPlugin()===0&&h(" Codex plugin refreshed (restart Codex to pick up a new version).");let o=t.updateAgent();o===0?h(" Agent (@gigabuddy/agent) updated."):o!=="not-installed"&&(h(" \u26A0 Updating the agent failed (see above). Try: npm install -g @gigabuddy/agent@latest"),process.exitCode=1)}async function Oy(e){let t=Jt(e),r=je(!1,Ne,t.name),n=je(!0,Ne,t.name),o=Yn().length>1||t.name!==Ct;if(o){let s=Qc(t);h(`Account: ${t.name}${s?` (${s})`:""}`),h()}if(!r&&!n){h(`Not signed in${o?ls(t.name):""}.`),h(),h(" gigabuddy login");return}for(let[s,i,a]of[["Production",r,!1],["Staging",n,!0]])i&&(h(`${s}:`),h(` Account: ${await Jc(i,a,t.name)}`),h(` Since: ${i.createdAt}`))}async function Ny(){let e=Xe(),t=Gt(),r=Yn();r.includes(e.name)||r.push(e.name),h("Accounts:");for(let o of r){let s=je(!1,Ne,o),i=je(!0,Ne,o),a=s?await Jc(s,!1,o):i?`${await Jc(i,!0,o)} (staging only)`:"not signed in",c=[];o===e.name&&c.push("active here"),o===(t.defaultAccount??Ct)&&c.push("default"),h(` ${o===e.name?"*":" "} ${o} \u2014 ${a}${c.length?` [${c.join(", ")}]`:""}`)}let n=Qc(e);n&&(h(),h(` Active account here: ${e.name} \u2014 ${n}`)),h(),h(" gigabuddy login --account <name> sign an account in"),h(" gigabuddy use <name> use an account for this repo"),h(" gigabuddy use --default <name> make an account the machine default")}function Ay(e,t={},r=process.cwd()){let n=Ar(r);if(t.unpin){h(cu(n)?`Unpinned ${n}.`:`No pin on ${n}.`);return}if(!e){let o=Xe(r),s=Qc(o);h(`Active account here: ${o.name}${s?` (${s})`:""}`),h(),h(" gigabuddy use <name> pin this repo to an account"),h(" gigabuddy use --unpin remove this repo's pin");return}if(Kt(e),Yn().includes(e)||h(`Note: no account "${e}" exists yet \u2014 sign it in with: gigabuddy login --account ${e}`),t.default){au(e),h(`Default account is now ${e}.`);return}vs(n,e),h(`Pinned ${n} \u2192 ${e}.`),h("Everything under it (worktrees included) now signs as this account.")}import{existsSync as Xc,mkdirSync as yP,readFileSync as eu,writeFileSync as jy}from"node:fs";import{join as Wn}from"node:path";var tu=".gigabuddy",_P="channel-policy.json",vP="default-place.json";function ps(e){return Wn(e,tu,_P)}function Zy(e){let t=ps(e);if(!Xc(t))return{};try{let r=JSON.parse(eu(t,"utf-8"));return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch(r){throw new Error(`${t} is not valid JSON (${r instanceof Error?r.message:String(r)}) \u2014 fix or remove it first.`)}}function Dy(e,t){let r=Wn(e,tu);yP(r,{recursive:!0}),Xc(Wn(r,".gitignore"))||jy(Wn(r,".gitignore"),`*
|
|
87
|
-
`),
|
|
88
|
-
`)}function
|
|
86
|
+
`)}var iP=["agent:spawn","discovery:read","packages:read"],Ae="user",aP="https://auth.gigabuddy.com",cP="https://api.gigabuddy.com",uP="https://auth.staging.gigabuddy.com",lP="https://api.staging.gigabuddy.com";function $y(e){let t=e.staging??!1;return{staging:t,authUrl:e.authUrl??(t?uP:aP),apiUrl:e.apiUrl??(t?lP:cP)}}function xy(e){try{return Hc(e,"utf-8")}catch{return""}}function h(e=""){console.error(e)}function Kt(e){return e?(Gt(e),{name:e,source:"env"}):Xe()}function ls(e){return e===Ct?"":` (account: ${e})`}async function zy(e,t){let r=Kt(t).name;h(`Signing in to ${e.staging?"Gigabuddy Staging":"Gigabuddy"}${ls(r)}\u2026`);let n=await sy({authUrl:e.authUrl,apiUrl:e.apiUrl,clientId:"gigabuddy-cli",scopes:iP,onPrompt:({verificationUrl:s,userCode:i})=>{h(),h(` Open: ${s}`),h(` Code: ${i}`),h()},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 ws(o,e.staging,Ae,r),o}async function ky(e,t={}){let r=Kt(t.account).name,n=await zy(e,r);h(),h(" Signed in."),n.userEmail&&h(` Account: ${n.userEmail}${ls(r)}`),h(` Saved to: ${Nr(e.staging,Ae,r)}`),t.account&&await dP(t.account),h(),h(` To install ${He} packages from the Gigabuddy registry: gigabuddy login --npm`)}async function dP(e){let t=Xe();if(t.name===e)return;let r=Ar(process.cwd());if(process.stdin.isTTY!==!0||process.stderr.isTTY!==!0){h(),h(` This directory resolves account "${t.name}". To use ${e} here: gigabuddy use ${e}`);return}h();let n=by.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"?(vs(r,e),h(` Pinned. Everything under this repo (worktrees included) now signs as ${e}.`)):h(` Left unpinned \u2014 this login is saved, and \`gigabuddy use ${e}\` pins it later.`)}finally{n.close()}}function Gc(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 Sy(e,t){if(Mc()){await fP(e);return}let r=Kt(t).name,n=je(e.staging,Ae,r),o=!n;if(n||(h("Not signed in yet \u2014 signing in first."),h(),n=await zy(e,r),h(),h(" Signed in.")),!o){await _y(n);return}try{await _y(n)}catch(s){h(),h(` \u26A0 Signed in, but npm setup failed: ${s instanceof Error?s.message:String(s)}`),h(" You are signed in \u2014 retry just that half with: gigabuddy login --npm"),process.exitCode=1}}var pP=7*24*60*60*1e3;async function Py(e,t,r=Date.now()){if(Mc())return;let n=je(e.staging,Ae,Kt(t).name);if(!n)return;let o=py(Ey(e.staging,t));if(o&&!(o.expiresAt&&o.expiresAt.getTime()-r>pP))try{let s=await Nc({authUrl:n.authUrl,refreshToken:n.refreshToken}),i=is(s);h(`Renewed the npm credential for ${He}${Gc(s.expiresIn)} in ${i}`)}catch(s){h(`Could not renew the npm credential: ${s instanceof Error?s.message:String(s)}`),h("Run `gigabuddy login --npm` to renew it by hand."),process.exitCode=1}}async function _y(e){let t=await Nc({authUrl:e.authUrl,refreshToken:e.refreshToken}),r=is(t);h(),h(` npm is set up for ${He} packages${Gc(t.expiresIn)}`),h(` Registry: ${t.registryUrl}`),h(` Written to: ${r}`),h(),h(` Try it: npm install ${He}/app-kit`),h(),h(" This credential is registry-only \u2014 it installs what you can install and nothing else."),h(" Run this again when it expires, or after your access changes.");let n=Zc(process.cwd()).filter(o=>as(xy(o),t.registryUrl));n.length>0&&(h(),h(` \u26A0 ${n[0]} also configures this registry, and npm prefers it over ${r}.`),h(" Installs will keep using THAT credential, not this one. Delete its _authToken line."))}async function fP(e){h("GitHub Actions detected \u2014 using the job\u2019s OIDC identity (no sign-in, nothing stored).");let t=await my(),r=await hy({authUrl:e.authUrl,idToken:t}),n=is(r);h(),h(` npm is set up for ${He} packages as ${r.repository}\u2019s CI${Gc(r.expiresIn)}`),h(` Registry: ${r.registryUrl}`),h(` Written to: ${n}`),r.bindings.length>0&&h(` Sponsored by ${r.bindings.length} room(s): ${r.bindings.map(o=>o.placeId).join(", ")}`),h(),h(" This credential is registry-only and expires with the job. Run it again in any later job that installs.")}function Ey(e,t){let r=je(e,Ae,Kt(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 Bc(e,t){let r=fy(Ey(e.staging,t));if(!r){h(`No ${He} registry entries found in ${$e()}`);return}h(`Removed ${He} registry credentials from ${r}`)}async function Ty(e,t){let r=Kt(t).name,n=je(e.staging,Ae,r);if(Bc(e,r),!n){h(`Not signed in${ls(r)}.`);return}let o=await dy({authUrl:n.authUrl,refreshToken:n.refreshToken});lu(e.staging,Ae,r),o?h(`Signed out${e.staging?" of staging":""}. Any npm credential from this session stops working shortly.`):(h(`Signed out locally${e.staging?" of staging":""} \u2014 but could not reach the server to revoke the session.`),h(" Credentials already copied elsewhere may keep working. Sign out again when you are back online,"),h(" or revoke the session from your account settings."))}async function Jc(e,t,r){if(e.userEmail)return e.userEmail;try{let n=await new Rt({refreshToken:e.refreshToken,authUrl:e.authUrl}).getToken(),o=Hn(n);return o?(ws({...e,userEmail:o},t,Ae,r),o):e.userId}catch{return e.userId}}async function Ry(e,t){let r=await gy({readNpmrc:()=>{try{return Hc($e(),"utf-8")}catch{return""}},npmEffectiveRegistry:()=>{try{let o=wy("npm",["config","get",`${He}:registry`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();return o&&o!=="undefined"&&o!=="null"?o:null}catch{return null}},shadowingNpmrcFiles:()=>Zc(process.cwd()).map(o=>({path:o,contents:xy(o)})),fetchImpl:fetch,nodeVersion:process.version,loadCredentials:o=>je(o,Ae),readClaudeConfig:()=>{try{return JSON.parse(Hc(sP(oP(),".claude.json"),"utf-8"))}catch{return null}},projectDir:process.cwd()},t),n=process.stderr.isTTY===!0&&!process.env.NO_COLOR;h(),h(yy(r,n)),h(),r.advice.length>0&&(process.exitCode=1)}var Bn="gigabuddy/agent-plugins",Iy="gigabuddy",It="gigabuddy@gigabuddy",Kc="gigabuddy",Wc="@gigabuddy/agent",us=["install","-g",`${Wc}@latest`,"--@gigabuddy:registry=https://registry.npmjs.org/"],ds=["claude","codex"];function Fc(e,t,r){let n=Jt(e,t,{stdio:["ignore","inherit","inherit"],timeout:r});if(n.error&&n.error.code==="ENOENT")return"missing";if(n.error&&n.error.code==="ETIMEDOUT")return 1;if(n.error)throw n.error;return n.status??1}function Yc(e){return Jt(e,["--version"],{stdio:"ignore"}).status===0}var Vc;function cs(){if(Vc===void 0){let e=["codex"];process.platform==="darwin"&&e.push("/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex","/Applications/ChatGPT.app/Contents/Resources/codex","/Applications/Codex.app/Contents/Resources/codex"),Vc=e.find(Yc)??null}return Vc}var vy="0.148.0";function mP(e,t){let r=s=>(s.match(/\d+(\.\d+)*/)?.[0]??"0").split(".").map(Number),n=r(e),o=r(t);for(let s=0;s<Math.max(n.length,o.length);s++){let i=(n[s]??0)-(o[s]??0);if(i!==0)return i>0}return!0}function hP(e){let t=Jt(e,["--version"],{encoding:"utf-8"});return t.status===0?/\d+\.\d+\.\d+/.exec(t.stdout)?.[0]??null:null}var Gn={has:e=>e==="claude"?Yc("claude"):cs()!==null,hasClaudeMarketplace(){let e=Jt("claude",["plugin","marketplace","list"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:15e3});return new RegExp(`^\\s*(?:\u276F\\s*)?${Iy}\\s*$`,"m").test(e.stdout??"")},runClaude:e=>Fc("claude",e),runCodex(e){let t=cs();return t?Fc(t,e):"missing"},codexVersion(){let e=cs();return e?hP(e):null},installAgent(){return Jt("npm",us,{stdio:["ignore","inherit","inherit"]}).status??1},warmAgent:()=>Fc("gigabuddy-agent",["warm"],3e4)};function Cy(e,t=Gn){let r=e?[e]:ds.filter(n=>t.has(n));if(r.length===0){h("Could not find Claude Code or Codex on this machine."),h(),h(" In Claude Code, run these inside any session:"),h(),h(` /plugin marketplace add ${Bn}`),h(` /plugin install ${It}`),h(),h(" For Codex, install it and run `gigabuddy setup codex`."),process.exitCode=1;return}r.forEach((n,o)=>{o>0&&h(),n==="claude"?gP(t):yP(t)})}function Oy(e){return e.hasClaudeMarketplace?.()?e.runClaude(["plugin","marketplace","update",Iy]):e.runClaude(["plugin","marketplace","add",Bn])}function gP(e){h("Setting up Gigabuddy for Claude Code\u2026"),h();let t=Oy(e);if(t==="missing"){h(" Could not find the `claude` command on this machine."),h(" If Claude Code is installed, run these inside any Claude Code session instead:"),h(),h(` /plugin marketplace add ${Bn}`),h(` /plugin install ${It}`),h(),h(" Then restart Claude Code."),process.exitCode=1;return}if(t!==0){h(),h(" \u26A0 Adding the Gigabuddy marketplace failed (see above). Nothing else was changed."),process.exitCode=1;return}if(e.runClaude(["plugin","install",It])!==0){h(),h(" \u26A0 Installing the plugin failed (see above). The marketplace was added \u2014 retry with:"),h(),h(` claude plugin install ${It}`),process.exitCode=1;return}h(),h(` Installing the agent (${Wc})\u2026`),e.installAgent()!==0&&(h(),h(" \u26A0 Installing the agent failed (see above). The plugin still works, but downloads the"),h(" agent each time it starts. Retry with:"),h(),h(` npm ${us.slice(0,3).join(" ")}`)),h(),h(" Gigabuddy is installed in Claude Code. Next:"),h(),h(" 1. Restart Claude Code so the plugin loads."),h(" 2. Ask your session to sign you in and connect you to a room."),h(' (Several identities on this machine? Say which: "sign in as my work account".)')}function yP(e){h("Setting up Gigabuddy for Codex\u2026"),h();let t=e.codexVersion();if(t&&!mP(t,vy)){h(` Gigabuddy needs Codex ${vy} or newer; this machine has ${t}.`),h(" Update Codex first (the desktop app updates itself; for the CLI run"),h(" `npm install -g @openai/codex@latest`), then run `gigabuddy setup codex` again."),process.exitCode=1;return}let r=e.runCodex(["plugin","marketplace","add",Bn]);if(r==="missing"){h(" Could not find the `codex` command on this machine. Once Codex is installed, run:"),h(),h(` codex plugin marketplace add ${Bn}`),h(` codex plugin add ${It}`),h(` npm ${us.slice(0,3).join(" ")}`),process.exitCode=1;return}if(r!==0){h(),h(" \u26A0 Adding the Gigabuddy marketplace failed (see above). Nothing else was changed."),process.exitCode=1;return}if(e.runCodex(["plugin","marketplace","upgrade",Kc]),e.runCodex(["plugin","add",It])!==0){h(),h(" \u26A0 Installing the plugin failed (see above). The marketplace was added \u2014 retry with:"),h(),h(` codex plugin add ${It}`),process.exitCode=1;return}h(),h(` Installing the agent (${Wc})\u2026`),e.installAgent()!==0?(h(),h(" \u26A0 Installing the agent failed (see above). The plugin works without it, but starts"),h(" too slowly for Codex some of the time. Retry with:"),h(),h(` npm ${us.slice(0,3).join(" ")}`),process.exitCode=1):e.warmAgent()!==0&&(h(" Your room's tools will be listed from your second Codex session. Once the above is"),h(" fixed, `gigabuddy setup codex` again gets them into the first.")),h(),h(" Gigabuddy is installed in Codex. Next:"),h(),h(" 1. Restart Codex so the plugin loads."),h(" 2. In a new thread, ask Codex to connect you to your Gigabuddy room.")}function Qc(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 _P={latestVersion(){try{return wy("npm",["view","gigabuddy","version"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()||null}catch{return null}},installLatest(){return Jt("npm",["install","-g","gigabuddy@latest"],{stdio:["ignore","inherit","inherit"]}).status??1},refreshPlugin(){return Oy(Gn)},refreshCodexPlugin(){let e=cs();if(!e)return"missing";let t=Jt(e,["plugin","marketplace","list"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});if(!new RegExp(`^${Kc}\\s`,"m").test(t.stdout??""))return"missing";let r=Gn.runCodex(["plugin","marketplace","upgrade",Kc]);return r===0?Gn.runCodex(["plugin","add",It]):r},updateAgent(){return Yc("gigabuddy-agent")?Gn.installAgent():"not-installed"}};async function Ay(e,t=_P){let r=t.latestVersion();if(!r){h("Could not reach npm to check for a newer version \u2014 are you online?"),process.exitCode=1;return}if(r===e)h(`gigabuddy v${e} is already the latest.`);else{if(h(`Updating gigabuddy v${e} \u2192 v${r}\u2026`),t.installLatest()!==0){h(),h(" \u26A0 npm install failed (see above). Try: npm install -g gigabuddy@latest"),process.exitCode=1;return}h(` Updated to v${r}.`)}t.refreshPlugin()===0&&h(" Claude Code plugin refreshed (restart Claude Code to pick up a new version)."),t.refreshCodexPlugin()===0&&h(" Codex plugin refreshed (restart Codex to pick up a new version).");let o=t.updateAgent();o===0?h(" Agent (@gigabuddy/agent) updated."):o!=="not-installed"&&(h(" \u26A0 Updating the agent failed (see above). Try: npm install -g @gigabuddy/agent@latest"),process.exitCode=1)}async function Ny(e){let t=Kt(e),r=je(!1,Ae,t.name),n=je(!0,Ae,t.name),o=Yn().length>1||t.name!==Ct;if(o){let s=Qc(t);h(`Account: ${t.name}${s?` (${s})`:""}`),h()}if(!r&&!n){h(`Not signed in${o?ls(t.name):""}.`),h(),h(" gigabuddy login");return}for(let[s,i,a]of[["Production",r,!1],["Staging",n,!0]])i&&(h(`${s}:`),h(` Account: ${await Jc(i,a,t.name)}`),h(` Since: ${i.createdAt}`))}async function jy(){let e=Xe(),t=Bt(),r=Yn();r.includes(e.name)||r.push(e.name),h("Accounts:");for(let o of r){let s=je(!1,Ae,o),i=je(!0,Ae,o),a=s?await Jc(s,!1,o):i?`${await Jc(i,!0,o)} (staging only)`:"not signed in",c=[];o===e.name&&c.push("active here"),o===(t.defaultAccount??Ct)&&c.push("default"),h(` ${o===e.name?"*":" "} ${o} \u2014 ${a}${c.length?` [${c.join(", ")}]`:""}`)}let n=Qc(e);n&&(h(),h(` Active account here: ${e.name} \u2014 ${n}`)),h(),h(" gigabuddy login --account <name> sign an account in"),h(" gigabuddy use <name> use an account for this repo"),h(" gigabuddy use --default <name> make an account the machine default")}function Zy(e,t={},r=process.cwd()){let n=Ar(r);if(t.unpin){h(cu(n)?`Unpinned ${n}.`:`No pin on ${n}.`);return}if(!e){let o=Xe(r),s=Qc(o);h(`Active account here: ${o.name}${s?` (${s})`:""}`),h(),h(" gigabuddy use <name> pin this repo to an account"),h(" gigabuddy use --unpin remove this repo's pin");return}if(Gt(e),Yn().includes(e)||h(`Note: no account "${e}" exists yet \u2014 sign it in with: gigabuddy login --account ${e}`),t.default){au(e),h(`Default account is now ${e}.`);return}vs(n,e),h(`Pinned ${n} \u2192 ${e}.`),h("Everything under it (worktrees included) now signs as this account.")}import{existsSync as Xc,mkdirSync as vP,readFileSync as eu,writeFileSync as Dy}from"node:fs";import{join as Wn}from"node:path";var tu=".gigabuddy",wP="channel-policy.json",bP="default-place.json";function ps(e){return Wn(e,tu,wP)}function My(e){let t=ps(e);if(!Xc(t))return{};try{let r=JSON.parse(eu(t,"utf-8"));return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch(r){throw new Error(`${t} is not valid JSON (${r instanceof Error?r.message:String(r)}) \u2014 fix or remove it first.`)}}function Uy(e,t){let r=Wn(e,tu);vP(r,{recursive:!0}),Xc(Wn(r,".gitignore"))||Dy(Wn(r,".gitignore"),`*
|
|
87
|
+
`),Dy(ps(e),JSON.stringify(t,null,2)+`
|
|
88
|
+
`)}function qy(e){return(e.trustedSenders??[]).map(t=>typeof t=="string"?{id:t}:t).filter(t=>!!t?.id)}function $P(e){try{let t=JSON.parse(eu(Wn(e,tu,bP),"utf-8"));return typeof t.placeId=="string"&&t.placeId?{placeId:t.placeId,placeName:t.placeName}:null}catch{return null}}async function xP(e,t){let n=((await t.fetchJson(`${e}/api/installations/mine`)).installations??[]).map(i=>i.installationId).filter(Boolean),o=[],s=[];for(let i of n){let a;try{a=await t.fetchJson(`${e}/ext/places/boot?tenancyId=${encodeURIComponent(i)}`)}catch(c){s.push(`${i}: ${c instanceof Error?c.message:String(c)}`);continue}for(let c of a.places??[])o.push({id:c.id,name:c.name??c.id,members:c.members??[]})}if(o.length===0&&s.length>0)throw new Error(`Could not read any room roster:
|
|
89
89
|
${s.map(i=>` ${i}`).join(`
|
|
90
|
-
`)}`);return o}function
|
|
90
|
+
`)}`);return o}function Ly(e,t){return(e??"").trim().toLowerCase()===t.trim().toLowerCase()}function zP(e,t){let r=e.find(s=>s.id===t);if(r)return r;let n=e.filter(s=>Ly(s.name,t));if(n.length===1)return n[0];if(n.length===0){let s=e.map(i=>` ${i.name} (${i.id})`).join(`
|
|
91
91
|
`);throw new Error(`No room named "${t}" among the rooms you can reach.${s?`
|
|
92
92
|
Rooms:
|
|
93
93
|
${s}`:""}`)}let o=n.map(s=>` ${s.id}`).join(`
|
|
94
94
|
`);throw new Error(`"${t}" names ${n.length} rooms \u2014 pass the id with --in instead:
|
|
95
|
-
${o}`)}function
|
|
95
|
+
${o}`)}function kP(e,t){if(/^[a-z_]+:/i.test(t)){let o=e.members.find(s=>s.actorId===t);return o||{actorId:t}}let r=e.members.filter(o=>Ly(o.displayName,t));if(r.length===1)return r[0];if(r.length===0){let o=e.members.filter(s=>(s.displayName??"").toLowerCase().includes(t.trim().toLowerCase())).slice(0,8).map(s=>` ${s.displayName} (${s.actorId})`).join(`
|
|
96
96
|
`);throw new Error(`Nobody named "${t}" in ${e.name}.${o?`
|
|
97
97
|
Did you mean:
|
|
98
98
|
${o}`:""}
|
|
99
99
|
Pass the canonical id instead if you have it.`)}let n=r.map(o=>` ${o.actorId} (${o.actorType??"?"})`).join(`
|
|
100
100
|
`);throw new Error(`"${t}" names ${r.length} members of ${e.name} \u2014 pass the id instead:
|
|
101
|
-
${n}`)}function
|
|
102
|
-
`))}}function
|
|
101
|
+
${n}`)}function SP(e=""){console.log(e)}function PP(e){let t=e.account??Xe(e.cwd??process.cwd()).name,r=je(e.staging??!1,"user",t);if(!r||!("refreshToken"in r))throw new Error("Not signed in. Run: gigabuddy login");let n=new Rt({refreshToken:r.refreshToken,authUrl:r.authUrl});return{apiUrl:r.apiUrl,fetchJson:async o=>{let s=await n.getToken(),i=await fetch(o,{headers:{Authorization:`Bearer ${s}`}});if(!i.ok)throw new Error(`${i.status} ${i.statusText} from ${o}`);return i.json()}}}async function Fy(e,t,r={},n){let o=n?.say??SP,s=r.cwd??process.cwd(),i=Ar(s);switch(e){case"list":{let a=qy(My(i));if(a.length===0){o(`No trusted senders for ${i}.`),o(" gigabuddy trust add <name> [--in <room>]");return}for(let c of a){let u=c.placeName??c.placeId;o(`${c.name??c.id} ${c.id}${u?` in ${u}`:" (any room)"}`)}return}case"show":{let a=ps(i);if(!Xc(a)){o(`No channel policy at ${a} \u2014 the guard runs on its defaults.`);return}o(eu(a,"utf-8").trimEnd());return}case"add":case"remove":{if(!t)throw new Error(`Usage: gigabuddy trust ${e} <name|id> [--in <room>]`);let a=r.in??$P(i)?.placeId;if(!a)throw new Error('No room to resolve in: this repo has no pinned room. Pass --in "<room name>" (or a place: id).');let c=n??PP(r),u=c.apiUrl;if(!u)throw new Error("No API URL on the credential \u2014 sign in again with: gigabuddy login");let l=await xP(u,c),d=zP(l,a),m=kP(d,t),f=My(i),g=qy(f),_=w=>w.id===m.actorId&&(!w.placeId||w.placeId===d.id);if(e==="remove"){let w=g.filter(k=>!_(k));if(w.length===g.length){o(`${m.displayName??m.actorId} (${m.actorId}) was not trusted in ${d.name}.`);return}Uy(i,{...f,trustedSenders:w}),o(`No longer trusting ${m.displayName??m.actorId} (${m.actorId}) in ${d.name}.`);return}if(g.some(_)){o(`${m.displayName??m.actorId} (${m.actorId}) is already trusted in ${d.name}.`);return}let v={id:m.actorId,...m.displayName?{name:m.displayName}:{},placeId:d.id,placeName:d.name,addedAt:(c.now??(()=>new Date))().toISOString()};Uy(i,{...f,trustedSenders:[...g,v]}),o(`Trusting ${m.displayName??m.actorId} (${m.actorId}) in ${d.name}.`),o('A wake from them now gets the "trusted" posture: tool calls become an approval prompt relayed to you \u2014 never run on their say-so alone.'),o(`Written to ${ps(i)}`);return}default:throw new Error(["Usage:"," gigabuddy trust add <name|id> [--in <room>] vouch for a sender (buddy, person) by name in a room"," gigabuddy trust remove <name|id> [--in <room>] withdraw it"," gigabuddy trust list who is trusted for this repo"," gigabuddy trust show print the whole channel policy"].join(`
|
|
102
|
+
`))}}function Vy(){try{let e=RP(TP(IP(import.meta.url)),"..","package.json");return JSON.parse(EP(e,"utf-8")).version}catch{return"unknown"}}function Hy(){console.error(`
|
|
103
103
|
gigabuddy \u2014 the Gigabuddy CLI
|
|
104
104
|
|
|
105
105
|
Usage:
|
|
@@ -172,5 +172,5 @@ If an install fails:
|
|
|
172
172
|
|
|
173
173
|
npm answers a denied read with "not found", which looks the same as a typo.
|
|
174
174
|
doctor tells you which it is.
|
|
175
|
-
`)}async function
|
|
175
|
+
`)}async function OP(){let{values:e,positionals:t}=CP({options:{account:{type:"string"},npm:{type:"boolean"},renew:{type:"boolean"},"no-npm":{type:"boolean"},default:{type:"boolean"},unpin:{type:"boolean"},in:{type:"string"},staging:{type:"boolean"},"auth-url":{type:"string"},"api-url":{type:"string"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}},allowPositionals:!0}),r=t[0];if(e.version||r==="version"){console.log(`gigabuddy v${Vy()}`);return}if(e.help||!r){Hy(),process.exitCode=e.help?0:1;return}let n=$y({staging:e.staging,authUrl:e["auth-url"],apiUrl:e["api-url"]});switch(r){case"setup":{let o=t[1];if(o!==void 0&&!ds.includes(o)){console.error(`Unknown harness '${o}'. Use one of: ${ds.join(", ")}.`),process.exitCode=1;return}Cy(o);return}case"login":e.npm&&e.renew?await Py(n,e.account):e.npm?await Sy(n,e.account):await ky(n,{account:e.account});return;case"logout":e.npm?Bc(n,e.account):await Ty(n,e.account);return;case"status":await Ny(e.account);return;case"accounts":await jy();return;case"update":await Ay(Vy());return;case"use":Zy(t[1],{default:e.default,unpin:e.unpin});return;case"doctor":await Ry(n,t[1]);return;case"trust":await Fy(t[1],t[2],{in:e.in,account:e.account,staging:e.staging});return;default:console.error(`Unknown command: ${r}`),console.error(""),Hy(),process.exitCode=1}}OP().catch(e=>{console.error(""),console.error(e instanceof Error?e.message:String(e)),process.exit(1)});
|
|
176
176
|
//# sourceMappingURL=cli.js.map
|