claude-mem 12.3.2 → 12.3.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/dist/npx-cli/index.js +115 -115
- package/dist/opencode-plugin/index.js +2 -2
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/hooks/hooks.json +3 -3
- package/plugin/package.json +1 -1
- package/plugin/scripts/context-generator.cjs +1 -1
- package/plugin/scripts/mcp-server.cjs +28 -28
- package/plugin/scripts/worker-service.cjs +161 -157
- package/plugin/ui/viewer-bundle.js +10 -10
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var Tb=Object.create;var oc=Object.defineProperty;var Ob=Object.getOwnPropertyDescriptor;var jb=Object.getOwnPropertyNames;var Db=Object.getPrototypeOf,Nb=Object.prototype.hasOwnProperty;var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Wn=(t,e)=>{for(var r in e)oc(t,r,{get:e[r],enumerable:!0})},Mb=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jb(e))!Nb.call(t,o)&&o!==r&&oc(t,o,{get:()=>e[o],enumerable:!(n=Ob(e,o))||n.enumerable});return t};var kt=(t,e,r)=>(r=t!=null?Tb(Db(t)):{},Mb(e||!t||!t.__esModule?oc(r,"default",{value:t,enumerable:!0}):r,t));var oi=I(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.regexpCode=ne.getEsmExportName=ne.getProperty=ne.safeStringify=ne.stringify=ne.strConcat=ne.addCodeArg=ne.str=ne._=ne.nil=ne._Code=ne.Name=ne.IDENTIFIER=ne._CodeOrName=void 0;var ri=class{};ne._CodeOrName=ri;ne.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Or=class extends ri{constructor(e){if(super(),!ne.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ne.Name=Or;var ct=class extends ri{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Or&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ne._Code=ct;ne.nil=new ct("");function Zv(t,...e){let r=[t[0]],n=0;for(;n<e.length;)ep(r,e[n]),r.push(t[++n]);return new ct(r)}ne._=Zv;var Qd=new ct("+");function Lv(t,...e){let r=[ni(t[0])],n=0;for(;n<e.length;)r.push(Qd),ep(r,e[n]),r.push(Qd,ni(t[++n]));return xE(r),new ct(r)}ne.str=Lv;function ep(t,e){e instanceof ct?t.push(...e._items):e instanceof Or?t.push(e):t.push(wE(e))}ne.addCodeArg=ep;function xE(t){let e=1;for(;e<t.length-1;){if(t[e]===Qd){let r=SE(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function SE(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Or||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Or))return`"${t}${e.slice(1)}`}function kE(t,e){return e.emptyStr()?t:t.emptyStr()?e:Lv`${t}${e}`}ne.strConcat=kE;function wE(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:ni(Array.isArray(t)?t.join(","):t)}function EE(t){return new ct(ni(t))}ne.stringify=EE;function ni(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ne.safeStringify=ni;function IE(t){return typeof t=="string"&&ne.IDENTIFIER.test(t)?new ct(`.${t}`):Zv`[${t}]`}ne.getProperty=IE;function zE(t){if(typeof t=="string"&&ne.IDENTIFIER.test(t))return new ct(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ne.getEsmExportName=zE;function PE(t){return new ct(t.toString())}ne.regexpCode=PE});var np=I(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.ValueScope=Ge.ValueScopeName=Ge.Scope=Ge.varKinds=Ge.UsedValueState=void 0;var He=oi(),tp=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},us;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(us||(Ge.UsedValueState=us={}));Ge.varKinds={const:new He.Name("const"),let:new He.Name("let"),var:new He.Name("var")};var ls=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof He.Name?e:this.name(e)}name(e){return new He.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Ge.Scope=ls;var ds=class extends He.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,He._)`.${new He.Name(r)}[${n}]`}};Ge.ValueScopeName=ds;var TE=(0,He._)`\n`,rp=class extends ls{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?TE:He.nil}}get(){return this._scope}name(e){return new ds(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,He._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=He.nil;for(let a in e){let s=e[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,us.Started);let l=r(u);if(l){let d=this.opts.es5?Ge.varKinds.var:Ge.varKinds.const;i=(0,He._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,He._)`${i}${l}${this.opts._n}`;else throw new tp(u);c.set(u,us.Completed)})}return i}};Ge.ValueScope=rp});var H=I(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.or=K.and=K.not=K.CodeGen=K.operators=K.varKinds=K.ValueScopeName=K.ValueScope=K.Scope=K.Name=K.regexpCode=K.stringify=K.getProperty=K.nil=K.strConcat=K.str=K._=void 0;var ee=oi(),_t=np(),mr=oi();Object.defineProperty(K,"_",{enumerable:!0,get:function(){return mr._}});Object.defineProperty(K,"str",{enumerable:!0,get:function(){return mr.str}});Object.defineProperty(K,"strConcat",{enumerable:!0,get:function(){return mr.strConcat}});Object.defineProperty(K,"nil",{enumerable:!0,get:function(){return mr.nil}});Object.defineProperty(K,"getProperty",{enumerable:!0,get:function(){return mr.getProperty}});Object.defineProperty(K,"stringify",{enumerable:!0,get:function(){return mr.stringify}});Object.defineProperty(K,"regexpCode",{enumerable:!0,get:function(){return mr.regexpCode}});Object.defineProperty(K,"Name",{enumerable:!0,get:function(){return mr.Name}});var hs=np();Object.defineProperty(K,"Scope",{enumerable:!0,get:function(){return hs.Scope}});Object.defineProperty(K,"ValueScope",{enumerable:!0,get:function(){return hs.ValueScope}});Object.defineProperty(K,"ValueScopeName",{enumerable:!0,get:function(){return hs.ValueScopeName}});Object.defineProperty(K,"varKinds",{enumerable:!0,get:function(){return hs.varKinds}});K.operators={GT:new ee._Code(">"),GTE:new ee._Code(">="),LT:new ee._Code("<"),LTE:new ee._Code("<="),EQ:new ee._Code("==="),NEQ:new ee._Code("!=="),NOT:new ee._Code("!"),OR:new ee._Code("||"),AND:new ee._Code("&&"),ADD:new ee._Code("+")};var Jt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},op=class extends Jt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?_t.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=$n(this.rhs,e,r)),this}get names(){return this.rhs instanceof ee._CodeOrName?this.rhs.names:{}}},ps=class extends Jt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ee.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=$n(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ee.Name?{}:{...this.lhs.names};return ms(e,this.rhs)}},ip=class extends ps{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},ap=class extends Jt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},sp=class extends Jt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},cp=class extends Jt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},up=class extends Jt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=$n(this.code,e,r),this}get names(){return this.code instanceof ee._CodeOrName?this.code.names:{}}},ii=class extends Jt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(OE(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Nr(e,r.names),{})}},Ht=class extends ii{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},lp=class extends ii{},yn=class extends Ht{};yn.kind="else";var jr=class t extends Ht{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new yn(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Fv(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=$n(this.condition,e,r),this}get names(){let e=super.names;return ms(e,this.condition),this.else&&Nr(e,this.else.names),e}};jr.kind="if";var Dr=class extends Ht{};Dr.kind="for";var dp=class extends Dr{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=$n(this.iteration,e,r),this}get names(){return Nr(super.names,this.iteration.names)}},pp=class extends Dr{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?_t.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=ms(super.names,this.from);return ms(e,this.to)}},fs=class extends Dr{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=$n(this.iterable,e,r),this}get names(){return Nr(super.names,this.iterable.names)}},ai=class extends Ht{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};ai.kind="func";var si=class extends ii{render(e){return"return "+super.render(e)}};si.kind="return";var fp=class extends Ht{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Nr(e,this.catch.names),this.finally&&Nr(e,this.finally.names),e}},ci=class extends Ht{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};ci.kind="catch";var ui=class extends Ht{render(e){return"finally"+super.render(e)}};ui.kind="finally";var mp=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
-
`:""},this._extScope=e,this._scope=new _t.Scope({parent:e}),this._nodes=[new lp]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new op(e,i,n)),i}const(e,r,n){return this._def(_t.varKinds.const,e,r,n)}let(e,r,n){return this._def(_t.varKinds.let,e,r,n)}var(e,r,n){return this._def(_t.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new ps(e,r,n))}add(e,r){return this._leafNode(new ip(e,K.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ee.nil&&this._leafNode(new up(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,ee.addCodeArg)(r,o));return r.push("}"),new ee._Code(r)}if(e,r,n){if(this._blockNode(new jr(e)),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(e){return this._elseNode(new jr(e))}else(){return this._elseNode(new yn)}endIf(){return this._endBlockNode(jr,yn)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new dp(e),r)}forRange(e,r,n,o,i=this.opts.es5?_t.varKinds.var:_t.varKinds.let){let a=this._scope.toName(e);return this._for(new pp(i,a,r,n),()=>o(a))}forOf(e,r,n,o=_t.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let a=r instanceof ee.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ee._)`${a}.length`,s=>{this.var(i,(0,ee._)`${a}[${s}]`),n(i)})}return this._for(new fs("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?_t.varKinds.var:_t.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ee._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new fs("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Dr)}label(e){return this._leafNode(new ap(e))}break(e){return this._leafNode(new sp(e))}return(e){let r=new si;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(si)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new fp;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new ci(i),r(i)}return n&&(this._currNode=o.finally=new ui,this.code(n)),this._endBlockNode(ci,ui)}throw(e){return this._leafNode(new cp(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){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||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ee.nil,n,o){return this._blockNode(new ai(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(ai)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof jr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};K.CodeGen=mp;function Nr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function ms(t,e){return e instanceof ee._CodeOrName?Nr(t,e.names):t}function $n(t,e,r){if(t instanceof ee.Name)return n(t);if(!o(t))return t;return new ee._Code(t._items.reduce((i,a)=>(a instanceof ee.Name&&(a=n(a)),a instanceof ee._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||e[i.str]!==1?i:(delete e[i.str],a)}function o(i){return i instanceof ee._Code&&i._items.some(a=>a instanceof ee.Name&&e[a.str]===1&&r[a.str]!==void 0)}}function OE(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Fv(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ee._)`!${hp(t)}`}K.not=Fv;var jE=qv(K.operators.AND);function DE(...t){return t.reduce(jE)}K.and=DE;var NE=qv(K.operators.OR);function ME(...t){return t.reduce(NE)}K.or=ME;function qv(t){return(e,r)=>e===ee.nil?r:r===ee.nil?e:(0,ee._)`${hp(e)} ${t} ${hp(r)}`}function hp(t){return t instanceof ee.Name?t:(0,ee._)`(${t})`}});var te=I(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.checkStrictMode=B.getErrorPath=B.Type=B.useFunc=B.setEvaluated=B.evaluatedPropsToName=B.mergeEvaluated=B.eachItem=B.unescapeJsonPointer=B.escapeJsonPointer=B.escapeFragment=B.unescapeFragment=B.schemaRefOrVal=B.schemaHasRulesButRef=B.schemaHasRules=B.checkUnknownRules=B.alwaysValidSchema=B.toHash=void 0;var pe=H(),RE=oi();function AE(t){let e={};for(let r of t)e[r]=!0;return e}B.toHash=AE;function CE(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Jv(t,e),!Hv(e,t.self.RULES.all))}B.alwaysValidSchema=CE;function Jv(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||Yv(t,`unknown keyword: "${i}"`)}B.checkUnknownRules=Jv;function Hv(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}B.schemaHasRules=Hv;function UE(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}B.schemaHasRulesButRef=UE;function ZE({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,pe._)`${r}`}return(0,pe._)`${t}${e}${(0,pe.getProperty)(n)}`}B.schemaRefOrVal=ZE;function LE(t){return Gv(decodeURIComponent(t))}B.unescapeFragment=LE;function FE(t){return encodeURIComponent(vp(t))}B.escapeFragment=FE;function vp(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}B.escapeJsonPointer=vp;function Gv(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}B.unescapeJsonPointer=Gv;function qE(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}B.eachItem=qE;function Vv({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof pe.Name?(i instanceof pe.Name?t(o,i,a):e(o,i,a),a):i instanceof pe.Name?(e(o,a,i),i):r(i,a);return s===pe.Name&&!(c instanceof pe.Name)?n(o,c):c}}B.mergeEvaluated={props:Vv({mergeNames:(t,e,r)=>t.if((0,pe._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,pe._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,pe._)`${r} || {}`).code((0,pe._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,pe._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,pe._)`${r} || {}`),_p(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Kv}),items:Vv({mergeNames:(t,e,r)=>t.if((0,pe._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,pe._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,pe._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,pe._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Kv(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,pe._)`{}`);return e!==void 0&&_p(t,r,e),r}B.evaluatedPropsToName=Kv;function _p(t,e,r){Object.keys(r).forEach(n=>t.assign((0,pe._)`${e}${(0,pe.getProperty)(n)}`,!0))}B.setEvaluated=_p;var Wv={};function VE(t,e){return t.scopeValue("func",{ref:e,code:Wv[e.code]||(Wv[e.code]=new RE._Code(e.code))})}B.useFunc=VE;var gp;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(gp||(B.Type=gp={}));function WE(t,e,r){if(t instanceof pe.Name){let n=e===gp.Num;return r?n?(0,pe._)`"[" + ${t} + "]"`:(0,pe._)`"['" + ${t} + "']"`:n?(0,pe._)`"/" + ${t}`:(0,pe._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,pe.getProperty)(t).toString():"/"+vp(t)}B.getErrorPath=WE;function Yv(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}B.checkStrictMode=Yv});var Gt=I(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});var je=H(),JE={data:new je.Name("data"),valCxt:new je.Name("valCxt"),instancePath:new je.Name("instancePath"),parentData:new je.Name("parentData"),parentDataProperty:new je.Name("parentDataProperty"),rootData:new je.Name("rootData"),dynamicAnchors:new je.Name("dynamicAnchors"),vErrors:new je.Name("vErrors"),errors:new je.Name("errors"),this:new je.Name("this"),self:new je.Name("self"),scope:new je.Name("scope"),json:new je.Name("json"),jsonPos:new je.Name("jsonPos"),jsonLen:new je.Name("jsonLen"),jsonPart:new je.Name("jsonPart")};yp.default=JE});var li=I(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.extendErrors=De.resetErrorsCount=De.reportExtraError=De.reportError=De.keyword$DataError=De.keywordError=void 0;var re=H(),gs=te(),Le=Gt();De.keywordError={message:({keyword:t})=>(0,re.str)`must pass "${t}" keyword validation`};De.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,re.str)`"${t}" keyword must be ${e} ($data)`:(0,re.str)`"${t}" keyword is invalid ($data)`};function HE(t,e=De.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:a,allErrors:s}=o,c=Qv(t,e,r);n??(a||s)?Bv(i,c):Xv(o,(0,re._)`[${c}]`)}De.reportError=HE;function GE(t,e=De.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:a}=n,s=Qv(t,e,r);Bv(o,s),i||a||Xv(n,Le.default.vErrors)}De.reportExtraError=GE;function KE(t,e){t.assign(Le.default.errors,e),t.if((0,re._)`${Le.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,re._)`${Le.default.vErrors}.length`,e),()=>t.assign(Le.default.vErrors,null)))}De.resetErrorsCount=KE;function YE({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=t.name("err");t.forRange("i",o,Le.default.errors,s=>{t.const(a,(0,re._)`${Le.default.vErrors}[${s}]`),t.if((0,re._)`${a}.instancePath === undefined`,()=>t.assign((0,re._)`${a}.instancePath`,(0,re.strConcat)(Le.default.instancePath,i.errorPath))),t.assign((0,re._)`${a}.schemaPath`,(0,re.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,re._)`${a}.schema`,r),t.assign((0,re._)`${a}.data`,n))})}De.extendErrors=YE;function Bv(t,e){let r=t.const("err",e);t.if((0,re._)`${Le.default.vErrors} === null`,()=>t.assign(Le.default.vErrors,(0,re._)`[${r}]`),(0,re._)`${Le.default.vErrors}.push(${r})`),t.code((0,re._)`${Le.default.errors}++`)}function Xv(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,re._)`new ${t.ValidationError}(${e})`):(r.assign((0,re._)`${n}.errors`,e),r.return(!1))}var Mr={keyword:new re.Name("keyword"),schemaPath:new re.Name("schemaPath"),params:new re.Name("params"),propertyName:new re.Name("propertyName"),message:new re.Name("message"),schema:new re.Name("schema"),parentSchema:new re.Name("parentSchema")};function Qv(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,re._)`{}`:BE(t,e,r)}function BE(t,e,r={}){let{gen:n,it:o}=t,i=[XE(o,r),QE(t,r)];return e0(t,e,i),n.object(...i)}function XE({errorPath:t},{instancePath:e}){let r=e?(0,re.str)`${t}${(0,gs.getErrorPath)(e,gs.Type.Str)}`:t;return[Le.default.instancePath,(0,re.strConcat)(Le.default.instancePath,r)]}function QE({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,re.str)`${e}/${t}`;return r&&(o=(0,re.str)`${o}${(0,gs.getErrorPath)(r,gs.Type.Str)}`),[Mr.schemaPath,o]}function e0(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Mr.keyword,o],[Mr.params,typeof e=="function"?e(t):e||(0,re._)`{}`]),c.messages&&n.push([Mr.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Mr.schema,a],[Mr.parentSchema,(0,re._)`${l}${d}`],[Le.default.data,i]),u&&n.push([Mr.propertyName,u])}});var t_=I(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.boolOrEmptySchema=bn.topBoolOrEmptySchema=void 0;var t0=li(),r0=H(),n0=Gt(),o0={message:"boolean schema is false"};function i0(t){let{gen:e,schema:r,validateName:n}=t;r===!1?e_(t,!1):typeof r=="object"&&r.$async===!0?e.return(n0.default.data):(e.assign((0,r0._)`${n}.errors`,null),e.return(!0))}bn.topBoolOrEmptySchema=i0;function a0(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),e_(t)):r.var(e,!0)}bn.boolOrEmptySchema=a0;function e_(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,t0.reportError)(o,o0,void 0,e)}});var $p=I(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.getRules=xn.isJSONType=void 0;var s0=["string","number","integer","boolean","null","object","array"],c0=new Set(s0);function u0(t){return typeof t=="string"&&c0.has(t)}xn.isJSONType=u0;function l0(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}xn.getRules=l0});var bp=I(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.shouldUseRule=hr.shouldUseGroup=hr.schemaHasRulesForType=void 0;function d0({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&r_(t,n)}hr.schemaHasRulesForType=d0;function r_(t,e){return e.rules.some(r=>n_(t,r))}hr.shouldUseGroup=r_;function n_(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}hr.shouldUseRule=n_});var di=I(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.reportTypeError=Ne.checkDataTypes=Ne.checkDataType=Ne.coerceAndCheckDataType=Ne.getJSONTypes=Ne.getSchemaTypes=Ne.DataType=void 0;var p0=$p(),f0=bp(),m0=li(),J=H(),o_=te(),Sn;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Sn||(Ne.DataType=Sn={}));function h0(t){let e=i_(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Ne.getSchemaTypes=h0;function i_(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(p0.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ne.getJSONTypes=i_;function g0(t,e){let{gen:r,data:n,opts:o}=t,i=v0(e,o.coerceTypes),a=e.length>0&&!(i.length===0&&e.length===1&&(0,f0.schemaHasRulesForType)(t,e[0]));if(a){let s=Sp(e,n,o.strictNumbers,Sn.Wrong);r.if(s,()=>{i.length?_0(t,e,i):kp(t)})}return a}Ne.coerceAndCheckDataType=g0;var a_=new Set(["string","number","integer","boolean","null"]);function v0(t,e){return e?t.filter(r=>a_.has(r)||e==="array"&&r==="array"):[]}function _0(t,e,r){let{gen:n,data:o,opts:i}=t,a=n.let("dataType",(0,J._)`typeof ${o}`),s=n.let("coerced",(0,J._)`undefined`);i.coerceTypes==="array"&&n.if((0,J._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,J._)`${o}[0]`).assign(a,(0,J._)`typeof ${o}`).if(Sp(e,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,J._)`${s} !== undefined`);for(let u of r)(a_.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),kp(t),n.endIf(),n.if((0,J._)`${s} !== undefined`,()=>{n.assign(o,s),y0(t,s)});function c(u){switch(u){case"string":n.elseIf((0,J._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,J._)`"" + ${o}`).elseIf((0,J._)`${o} === null`).assign(s,(0,J._)`""`);return;case"number":n.elseIf((0,J._)`${a} == "boolean" || ${o} === null
|
|
2
|
+
"use strict";var Mb=Object.create;var ac=Object.defineProperty;var Rb=Object.getOwnPropertyDescriptor;var Ab=Object.getOwnPropertyNames;var Cb=Object.getPrototypeOf,Ub=Object.prototype.hasOwnProperty;var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Jn=(t,e)=>{for(var r in e)ac(t,r,{get:e[r],enumerable:!0})},Zb=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ab(e))!Ub.call(t,o)&&o!==r&&ac(t,o,{get:()=>e[o],enumerable:!(n=Rb(e,o))||n.enumerable});return t};var wt=(t,e,r)=>(r=t!=null?Mb(Cb(t)):{},Zb(e||!t||!t.__esModule?ac(r,"default",{value:t,enumerable:!0}):r,t));var ii=I(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.regexpCode=ne.getEsmExportName=ne.getProperty=ne.safeStringify=ne.stringify=ne.strConcat=ne.addCodeArg=ne.str=ne._=ne.nil=ne._Code=ne.Name=ne.IDENTIFIER=ne._CodeOrName=void 0;var ni=class{};ne._CodeOrName=ni;ne.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var jr=class extends ni{constructor(e){if(super(),!ne.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ne.Name=jr;var ct=class extends ni{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof jr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ne._Code=ct;ne.nil=new ct("");function Fv(t,...e){let r=[t[0]],n=0;for(;n<e.length;)rp(r,e[n]),r.push(t[++n]);return new ct(r)}ne._=Fv;var tp=new ct("+");function qv(t,...e){let r=[oi(t[0])],n=0;for(;n<e.length;)r.push(tp),rp(r,e[n]),r.push(tp,oi(t[++n]));return IE(r),new ct(r)}ne.str=qv;function rp(t,e){e instanceof ct?t.push(...e._items):e instanceof jr?t.push(e):t.push(TE(e))}ne.addCodeArg=rp;function IE(t){let e=1;for(;e<t.length-1;){if(t[e]===tp){let r=zE(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function zE(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof jr||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof jr))return`"${t}${e.slice(1)}`}function PE(t,e){return e.emptyStr()?t:t.emptyStr()?e:qv`${t}${e}`}ne.strConcat=PE;function TE(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:oi(Array.isArray(t)?t.join(","):t)}function OE(t){return new ct(oi(t))}ne.stringify=OE;function oi(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ne.safeStringify=oi;function jE(t){return typeof t=="string"&&ne.IDENTIFIER.test(t)?new ct(`.${t}`):Fv`[${t}]`}ne.getProperty=jE;function DE(t){if(typeof t=="string"&&ne.IDENTIFIER.test(t))return new ct(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ne.getEsmExportName=DE;function NE(t){return new ct(t.toString())}ne.regexpCode=NE});var ip=I(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.ValueScope=Ge.ValueScopeName=Ge.Scope=Ge.varKinds=Ge.UsedValueState=void 0;var He=ii(),np=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},ls;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(ls||(Ge.UsedValueState=ls={}));Ge.varKinds={const:new He.Name("const"),let:new He.Name("let"),var:new He.Name("var")};var ds=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof He.Name?e:this.name(e)}name(e){return new He.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Ge.Scope=ds;var ps=class extends He.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,He._)`.${new He.Name(r)}[${n}]`}};Ge.ValueScopeName=ps;var ME=(0,He._)`\n`,op=class extends ds{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?ME:He.nil}}get(){return this._scope}name(e){return new ps(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,He._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=He.nil;for(let a in e){let s=e[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,ls.Started);let l=r(u);if(l){let d=this.opts.es5?Ge.varKinds.var:Ge.varKinds.const;i=(0,He._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,He._)`${i}${l}${this.opts._n}`;else throw new np(u);c.set(u,ls.Completed)})}return i}};Ge.ValueScope=op});var H=I(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.or=K.and=K.not=K.CodeGen=K.operators=K.varKinds=K.ValueScopeName=K.ValueScope=K.Scope=K.Name=K.regexpCode=K.stringify=K.getProperty=K.nil=K.strConcat=K.str=K._=void 0;var ee=ii(),yt=ip(),mr=ii();Object.defineProperty(K,"_",{enumerable:!0,get:function(){return mr._}});Object.defineProperty(K,"str",{enumerable:!0,get:function(){return mr.str}});Object.defineProperty(K,"strConcat",{enumerable:!0,get:function(){return mr.strConcat}});Object.defineProperty(K,"nil",{enumerable:!0,get:function(){return mr.nil}});Object.defineProperty(K,"getProperty",{enumerable:!0,get:function(){return mr.getProperty}});Object.defineProperty(K,"stringify",{enumerable:!0,get:function(){return mr.stringify}});Object.defineProperty(K,"regexpCode",{enumerable:!0,get:function(){return mr.regexpCode}});Object.defineProperty(K,"Name",{enumerable:!0,get:function(){return mr.Name}});var gs=ip();Object.defineProperty(K,"Scope",{enumerable:!0,get:function(){return gs.Scope}});Object.defineProperty(K,"ValueScope",{enumerable:!0,get:function(){return gs.ValueScope}});Object.defineProperty(K,"ValueScopeName",{enumerable:!0,get:function(){return gs.ValueScopeName}});Object.defineProperty(K,"varKinds",{enumerable:!0,get:function(){return gs.varKinds}});K.operators={GT:new ee._Code(">"),GTE:new ee._Code(">="),LT:new ee._Code("<"),LTE:new ee._Code("<="),EQ:new ee._Code("==="),NEQ:new ee._Code("!=="),NOT:new ee._Code("!"),OR:new ee._Code("||"),AND:new ee._Code("&&"),ADD:new ee._Code("+")};var Ht=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ap=class extends Ht{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?yt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=bn(this.rhs,e,r)),this}get names(){return this.rhs instanceof ee._CodeOrName?this.rhs.names:{}}},fs=class extends Ht{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ee.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=bn(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ee.Name?{}:{...this.lhs.names};return hs(e,this.rhs)}},sp=class extends fs{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},cp=class extends Ht{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},up=class extends Ht{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},lp=class extends Ht{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},dp=class extends Ht{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=bn(this.code,e,r),this}get names(){return this.code instanceof ee._CodeOrName?this.code.names:{}}},ai=class extends Ht{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(RE(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Mr(e,r.names),{})}},Gt=class extends ai{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},pp=class extends ai{},$n=class extends Gt{};$n.kind="else";var Dr=class t extends Gt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new $n(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Vv(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=bn(this.condition,e,r),this}get names(){let e=super.names;return hs(e,this.condition),this.else&&Mr(e,this.else.names),e}};Dr.kind="if";var Nr=class extends Gt{};Nr.kind="for";var fp=class extends Nr{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=bn(this.iteration,e,r),this}get names(){return Mr(super.names,this.iteration.names)}},mp=class extends Nr{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?yt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=hs(super.names,this.from);return hs(e,this.to)}},ms=class extends Nr{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=bn(this.iterable,e,r),this}get names(){return Mr(super.names,this.iterable.names)}},si=class extends Gt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};si.kind="func";var ci=class extends ai{render(e){return"return "+super.render(e)}};ci.kind="return";var hp=class extends Gt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Mr(e,this.catch.names),this.finally&&Mr(e,this.finally.names),e}},ui=class extends Gt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};ui.kind="catch";var li=class extends Gt{render(e){return"finally"+super.render(e)}};li.kind="finally";var gp=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new yt.Scope({parent:e}),this._nodes=[new pp]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new ap(e,i,n)),i}const(e,r,n){return this._def(yt.varKinds.const,e,r,n)}let(e,r,n){return this._def(yt.varKinds.let,e,r,n)}var(e,r,n){return this._def(yt.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new fs(e,r,n))}add(e,r){return this._leafNode(new sp(e,K.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ee.nil&&this._leafNode(new dp(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,ee.addCodeArg)(r,o));return r.push("}"),new ee._Code(r)}if(e,r,n){if(this._blockNode(new Dr(e)),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(e){return this._elseNode(new Dr(e))}else(){return this._elseNode(new $n)}endIf(){return this._endBlockNode(Dr,$n)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new fp(e),r)}forRange(e,r,n,o,i=this.opts.es5?yt.varKinds.var:yt.varKinds.let){let a=this._scope.toName(e);return this._for(new mp(i,a,r,n),()=>o(a))}forOf(e,r,n,o=yt.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let a=r instanceof ee.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ee._)`${a}.length`,s=>{this.var(i,(0,ee._)`${a}[${s}]`),n(i)})}return this._for(new ms("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?yt.varKinds.var:yt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ee._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new ms("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Nr)}label(e){return this._leafNode(new cp(e))}break(e){return this._leafNode(new up(e))}return(e){let r=new ci;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(ci)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new hp;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new ui(i),r(i)}return n&&(this._currNode=o.finally=new li,this.code(n)),this._endBlockNode(ui,li)}throw(e){return this._leafNode(new lp(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){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||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ee.nil,n,o){return this._blockNode(new si(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(si)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Dr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};K.CodeGen=gp;function Mr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function hs(t,e){return e instanceof ee._CodeOrName?Mr(t,e.names):t}function bn(t,e,r){if(t instanceof ee.Name)return n(t);if(!o(t))return t;return new ee._Code(t._items.reduce((i,a)=>(a instanceof ee.Name&&(a=n(a)),a instanceof ee._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||e[i.str]!==1?i:(delete e[i.str],a)}function o(i){return i instanceof ee._Code&&i._items.some(a=>a instanceof ee.Name&&e[a.str]===1&&r[a.str]!==void 0)}}function RE(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Vv(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ee._)`!${vp(t)}`}K.not=Vv;var AE=Wv(K.operators.AND);function CE(...t){return t.reduce(AE)}K.and=CE;var UE=Wv(K.operators.OR);function ZE(...t){return t.reduce(UE)}K.or=ZE;function Wv(t){return(e,r)=>e===ee.nil?r:r===ee.nil?e:(0,ee._)`${vp(e)} ${t} ${vp(r)}`}function vp(t){return t instanceof ee.Name?t:(0,ee._)`(${t})`}});var te=I(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.checkStrictMode=B.getErrorPath=B.Type=B.useFunc=B.setEvaluated=B.evaluatedPropsToName=B.mergeEvaluated=B.eachItem=B.unescapeJsonPointer=B.escapeJsonPointer=B.escapeFragment=B.unescapeFragment=B.schemaRefOrVal=B.schemaHasRulesButRef=B.schemaHasRules=B.checkUnknownRules=B.alwaysValidSchema=B.toHash=void 0;var pe=H(),LE=ii();function FE(t){let e={};for(let r of t)e[r]=!0;return e}B.toHash=FE;function qE(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Gv(t,e),!Kv(e,t.self.RULES.all))}B.alwaysValidSchema=qE;function Gv(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||Xv(t,`unknown keyword: "${i}"`)}B.checkUnknownRules=Gv;function Kv(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}B.schemaHasRules=Kv;function VE(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}B.schemaHasRulesButRef=VE;function WE({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,pe._)`${r}`}return(0,pe._)`${t}${e}${(0,pe.getProperty)(n)}`}B.schemaRefOrVal=WE;function JE(t){return Yv(decodeURIComponent(t))}B.unescapeFragment=JE;function HE(t){return encodeURIComponent(yp(t))}B.escapeFragment=HE;function yp(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}B.escapeJsonPointer=yp;function Yv(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}B.unescapeJsonPointer=Yv;function GE(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}B.eachItem=GE;function Jv({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof pe.Name?(i instanceof pe.Name?t(o,i,a):e(o,i,a),a):i instanceof pe.Name?(e(o,a,i),i):r(i,a);return s===pe.Name&&!(c instanceof pe.Name)?n(o,c):c}}B.mergeEvaluated={props:Jv({mergeNames:(t,e,r)=>t.if((0,pe._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,pe._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,pe._)`${r} || {}`).code((0,pe._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,pe._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,pe._)`${r} || {}`),$p(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Bv}),items:Jv({mergeNames:(t,e,r)=>t.if((0,pe._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,pe._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,pe._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,pe._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Bv(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,pe._)`{}`);return e!==void 0&&$p(t,r,e),r}B.evaluatedPropsToName=Bv;function $p(t,e,r){Object.keys(r).forEach(n=>t.assign((0,pe._)`${e}${(0,pe.getProperty)(n)}`,!0))}B.setEvaluated=$p;var Hv={};function KE(t,e){return t.scopeValue("func",{ref:e,code:Hv[e.code]||(Hv[e.code]=new LE._Code(e.code))})}B.useFunc=KE;var _p;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(_p||(B.Type=_p={}));function YE(t,e,r){if(t instanceof pe.Name){let n=e===_p.Num;return r?n?(0,pe._)`"[" + ${t} + "]"`:(0,pe._)`"['" + ${t} + "']"`:n?(0,pe._)`"/" + ${t}`:(0,pe._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,pe.getProperty)(t).toString():"/"+yp(t)}B.getErrorPath=YE;function Xv(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}B.checkStrictMode=Xv});var Kt=I(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var je=H(),BE={data:new je.Name("data"),valCxt:new je.Name("valCxt"),instancePath:new je.Name("instancePath"),parentData:new je.Name("parentData"),parentDataProperty:new je.Name("parentDataProperty"),rootData:new je.Name("rootData"),dynamicAnchors:new je.Name("dynamicAnchors"),vErrors:new je.Name("vErrors"),errors:new je.Name("errors"),this:new je.Name("this"),self:new je.Name("self"),scope:new je.Name("scope"),json:new je.Name("json"),jsonPos:new je.Name("jsonPos"),jsonLen:new je.Name("jsonLen"),jsonPart:new je.Name("jsonPart")};bp.default=BE});var di=I(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.extendErrors=De.resetErrorsCount=De.reportExtraError=De.reportError=De.keyword$DataError=De.keywordError=void 0;var re=H(),vs=te(),Le=Kt();De.keywordError={message:({keyword:t})=>(0,re.str)`must pass "${t}" keyword validation`};De.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,re.str)`"${t}" keyword must be ${e} ($data)`:(0,re.str)`"${t}" keyword is invalid ($data)`};function XE(t,e=De.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:a,allErrors:s}=o,c=t_(t,e,r);n??(a||s)?Qv(i,c):e_(o,(0,re._)`[${c}]`)}De.reportError=XE;function QE(t,e=De.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:a}=n,s=t_(t,e,r);Qv(o,s),i||a||e_(n,Le.default.vErrors)}De.reportExtraError=QE;function e0(t,e){t.assign(Le.default.errors,e),t.if((0,re._)`${Le.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,re._)`${Le.default.vErrors}.length`,e),()=>t.assign(Le.default.vErrors,null)))}De.resetErrorsCount=e0;function t0({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=t.name("err");t.forRange("i",o,Le.default.errors,s=>{t.const(a,(0,re._)`${Le.default.vErrors}[${s}]`),t.if((0,re._)`${a}.instancePath === undefined`,()=>t.assign((0,re._)`${a}.instancePath`,(0,re.strConcat)(Le.default.instancePath,i.errorPath))),t.assign((0,re._)`${a}.schemaPath`,(0,re.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,re._)`${a}.schema`,r),t.assign((0,re._)`${a}.data`,n))})}De.extendErrors=t0;function Qv(t,e){let r=t.const("err",e);t.if((0,re._)`${Le.default.vErrors} === null`,()=>t.assign(Le.default.vErrors,(0,re._)`[${r}]`),(0,re._)`${Le.default.vErrors}.push(${r})`),t.code((0,re._)`${Le.default.errors}++`)}function e_(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,re._)`new ${t.ValidationError}(${e})`):(r.assign((0,re._)`${n}.errors`,e),r.return(!1))}var Rr={keyword:new re.Name("keyword"),schemaPath:new re.Name("schemaPath"),params:new re.Name("params"),propertyName:new re.Name("propertyName"),message:new re.Name("message"),schema:new re.Name("schema"),parentSchema:new re.Name("parentSchema")};function t_(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,re._)`{}`:r0(t,e,r)}function r0(t,e,r={}){let{gen:n,it:o}=t,i=[n0(o,r),o0(t,r)];return i0(t,e,i),n.object(...i)}function n0({errorPath:t},{instancePath:e}){let r=e?(0,re.str)`${t}${(0,vs.getErrorPath)(e,vs.Type.Str)}`:t;return[Le.default.instancePath,(0,re.strConcat)(Le.default.instancePath,r)]}function o0({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,re.str)`${e}/${t}`;return r&&(o=(0,re.str)`${o}${(0,vs.getErrorPath)(r,vs.Type.Str)}`),[Rr.schemaPath,o]}function i0(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Rr.keyword,o],[Rr.params,typeof e=="function"?e(t):e||(0,re._)`{}`]),c.messages&&n.push([Rr.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Rr.schema,a],[Rr.parentSchema,(0,re._)`${l}${d}`],[Le.default.data,i]),u&&n.push([Rr.propertyName,u])}});var n_=I(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.boolOrEmptySchema=xn.topBoolOrEmptySchema=void 0;var a0=di(),s0=H(),c0=Kt(),u0={message:"boolean schema is false"};function l0(t){let{gen:e,schema:r,validateName:n}=t;r===!1?r_(t,!1):typeof r=="object"&&r.$async===!0?e.return(c0.default.data):(e.assign((0,s0._)`${n}.errors`,null),e.return(!0))}xn.topBoolOrEmptySchema=l0;function d0(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),r_(t)):r.var(e,!0)}xn.boolOrEmptySchema=d0;function r_(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,a0.reportError)(o,u0,void 0,e)}});var xp=I(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.getRules=Sn.isJSONType=void 0;var p0=["string","number","integer","boolean","null","object","array"],f0=new Set(p0);function m0(t){return typeof t=="string"&&f0.has(t)}Sn.isJSONType=m0;function h0(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Sn.getRules=h0});var Sp=I(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.shouldUseRule=hr.shouldUseGroup=hr.schemaHasRulesForType=void 0;function g0({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&o_(t,n)}hr.schemaHasRulesForType=g0;function o_(t,e){return e.rules.some(r=>i_(t,r))}hr.shouldUseGroup=o_;function i_(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}hr.shouldUseRule=i_});var pi=I(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.reportTypeError=Ne.checkDataTypes=Ne.checkDataType=Ne.coerceAndCheckDataType=Ne.getJSONTypes=Ne.getSchemaTypes=Ne.DataType=void 0;var v0=xp(),_0=Sp(),y0=di(),J=H(),a_=te(),kn;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(kn||(Ne.DataType=kn={}));function $0(t){let e=s_(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Ne.getSchemaTypes=$0;function s_(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(v0.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ne.getJSONTypes=s_;function b0(t,e){let{gen:r,data:n,opts:o}=t,i=x0(e,o.coerceTypes),a=e.length>0&&!(i.length===0&&e.length===1&&(0,_0.schemaHasRulesForType)(t,e[0]));if(a){let s=wp(e,n,o.strictNumbers,kn.Wrong);r.if(s,()=>{i.length?S0(t,e,i):Ep(t)})}return a}Ne.coerceAndCheckDataType=b0;var c_=new Set(["string","number","integer","boolean","null"]);function x0(t,e){return e?t.filter(r=>c_.has(r)||e==="array"&&r==="array"):[]}function S0(t,e,r){let{gen:n,data:o,opts:i}=t,a=n.let("dataType",(0,J._)`typeof ${o}`),s=n.let("coerced",(0,J._)`undefined`);i.coerceTypes==="array"&&n.if((0,J._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,J._)`${o}[0]`).assign(a,(0,J._)`typeof ${o}`).if(wp(e,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,J._)`${s} !== undefined`);for(let u of r)(c_.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),Ep(t),n.endIf(),n.if((0,J._)`${s} !== undefined`,()=>{n.assign(o,s),k0(t,s)});function c(u){switch(u){case"string":n.elseIf((0,J._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,J._)`"" + ${o}`).elseIf((0,J._)`${o} === null`).assign(s,(0,J._)`""`);return;case"number":n.elseIf((0,J._)`${a} == "boolean" || ${o} === null
|
|
4
4
|
|| (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,J._)`+${o}`);return;case"integer":n.elseIf((0,J._)`${a} === "boolean" || ${o} === null
|
|
5
5
|
|| (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,J._)`+${o}`);return;case"boolean":n.elseIf((0,J._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,J._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,J._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,J._)`${a} === "string" || ${a} === "number"
|
|
6
|
-
|| ${a} === "boolean" || ${o} === null`).assign(s,(0,J._)`[${o}]`)}}}function y0({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,J._)`${e} !== undefined`,()=>t.assign((0,J._)`${e}[${r}]`,n))}function xp(t,e,r,n=Sn.Correct){let o=n===Sn.Correct?J.operators.EQ:J.operators.NEQ,i;switch(t){case"null":return(0,J._)`${e} ${o} null`;case"array":i=(0,J._)`Array.isArray(${e})`;break;case"object":i=(0,J._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=a((0,J._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=a();break;default:return(0,J._)`typeof ${e} ${o} ${t}`}return n===Sn.Correct?i:(0,J.not)(i);function a(s=J.nil){return(0,J.and)((0,J._)`typeof ${e} == "number"`,s,r?(0,J._)`isFinite(${e})`:J.nil)}}Ne.checkDataType=xp;function Sp(t,e,r,n){if(t.length===1)return xp(t[0],e,r,n);let o,i=(0,o_.toHash)(t);if(i.array&&i.object){let a=(0,J._)`typeof ${e} != "object"`;o=i.null?a:(0,J._)`!${e} || ${a}`,delete i.null,delete i.array,delete i.object}else o=J.nil;i.number&&delete i.integer;for(let a in i)o=(0,J.and)(o,xp(a,e,r,n));return o}Ne.checkDataTypes=Sp;var $0={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,J._)`{type: ${t}}`:(0,J._)`{type: ${e}}`};function kp(t){let e=b0(t);(0,m0.reportError)(e,$0)}Ne.reportTypeError=kp;function b0(t){let{gen:e,data:r,schema:n}=t,o=(0,o_.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var c_=I(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.assignDefaults=void 0;var kn=H(),x0=te();function S0(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)s_(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>s_(t,i,o.default))}vs.assignDefaults=S0;function s_(t,e,r){let{gen:n,compositeRule:o,data:i,opts:a}=t;if(r===void 0)return;let s=(0,kn._)`${i}${(0,kn.getProperty)(e)}`;if(o){(0,x0.checkStrictMode)(t,`default is ignored for: ${s}`);return}let c=(0,kn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,kn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,kn._)`${s} = ${(0,kn.stringify)(r)}`)}});var ut=I(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.validateUnion=se.validateArray=se.usePattern=se.callValidateCode=se.schemaProperties=se.allSchemaProperties=se.noPropertyInData=se.propertyInData=se.isOwnProperty=se.hasPropFunc=se.reportMissingProp=se.checkMissingProp=se.checkReportMissingProp=void 0;var he=H(),wp=te(),gr=Gt(),k0=te();function w0(t,e){let{gen:r,data:n,it:o}=t;r.if(Ip(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,he._)`${e}`},!0),t.error()})}se.checkReportMissingProp=w0;function E0({gen:t,data:e,it:{opts:r}},n,o){return(0,he.or)(...n.map(i=>(0,he.and)(Ip(t,e,i,r.ownProperties),(0,he._)`${o} = ${i}`)))}se.checkMissingProp=E0;function I0(t,e){t.setParams({missingProperty:e},!0),t.error()}se.reportMissingProp=I0;function u_(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,he._)`Object.prototype.hasOwnProperty`})}se.hasPropFunc=u_;function Ep(t,e,r){return(0,he._)`${u_(t)}.call(${e}, ${r})`}se.isOwnProperty=Ep;function z0(t,e,r,n){let o=(0,he._)`${e}${(0,he.getProperty)(r)} !== undefined`;return n?(0,he._)`${o} && ${Ep(t,e,r)}`:o}se.propertyInData=z0;function Ip(t,e,r,n){let o=(0,he._)`${e}${(0,he.getProperty)(r)} === undefined`;return n?(0,he.or)(o,(0,he.not)(Ep(t,e,r))):o}se.noPropertyInData=Ip;function l_(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}se.allSchemaProperties=l_;function P0(t,e){return l_(e).filter(r=>!(0,wp.alwaysValidSchema)(t,e[r]))}se.schemaProperties=P0;function T0({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,he._)`${t}, ${e}, ${n}${o}`:e,d=[[gr.default.instancePath,(0,he.strConcat)(gr.default.instancePath,i)],[gr.default.parentData,a.parentData],[gr.default.parentDataProperty,a.parentDataProperty],[gr.default.rootData,gr.default.rootData]];a.opts.dynamicRef&&d.push([gr.default.dynamicAnchors,gr.default.dynamicAnchors]);let p=(0,he._)`${l}, ${r.object(...d)}`;return c!==he.nil?(0,he._)`${s}.call(${c}, ${p})`:(0,he._)`${s}(${p})`}se.callValidateCode=T0;var O0=(0,he._)`new RegExp`;function j0({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,he._)`${o.code==="new RegExp"?O0:(0,k0.useFunc)(t,o)}(${r}, ${n})`})}se.usePattern=j0;function D0(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let s=e.let("valid",!0);return a(()=>e.assign(s,!1)),s}return e.var(i,!0),a(()=>e.break()),i;function a(s){let c=e.const("len",(0,he._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:wp.Type.Num},i),e.if((0,he.not)(i),s)})}}se.validateArray=D0;function N0(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,wp.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);e.assign(a,(0,he._)`${a} || ${s}`),t.mergeValidEvaluated(l,s)||e.if((0,he.not)(a))})),t.result(a,()=>t.reset(),()=>t.error(!0))}se.validateUnion=N0});var f_=I(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.validateKeywordUsage=zt.validSchemaType=zt.funcKeywordCode=zt.macroKeywordCode=void 0;var Fe=H(),Rr=Gt(),M0=ut(),R0=li();function A0(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=t,s=e.macro.call(a.self,o,i,a),c=p_(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");t.subschema({schema:s,schemaPath:Fe.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}zt.macroKeywordCode=A0;function C0(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=t;Z0(c,e);let u=!s&&e.compile?e.compile.call(c.self,i,a,c):e.validate,l=p_(n,o,u),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)g(),e.modifying&&d_(t),$(()=>t.error());else{let k=e.async?f():h();e.modifying&&d_(t),$(()=>U0(t,k))}}function f(){let k=n.let("ruleErrs",null);return n.try(()=>g((0,Fe._)`await `),S=>n.assign(d,!1).if((0,Fe._)`${S} instanceof ${c.ValidationError}`,()=>n.assign(k,(0,Fe._)`${S}.errors`),()=>n.throw(S))),k}function h(){let k=(0,Fe._)`${l}.errors`;return n.assign(k,null),g(Fe.nil),k}function g(k=e.async?(0,Fe._)`await `:Fe.nil){let S=c.opts.passContext?Rr.default.this:Rr.default.self,x=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,Fe._)`${k}${(0,M0.callValidateCode)(t,l,S,x)}`,e.modifying)}function $(k){var S;n.if((0,Fe.not)((S=e.valid)!==null&&S!==void 0?S:d),k)}}zt.funcKeywordCode=C0;function d_(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Fe._)`${n.parentData}[${n.parentDataProperty}]`))}function U0(t,e){let{gen:r}=t;r.if((0,Fe._)`Array.isArray(${e})`,()=>{r.assign(Rr.default.vErrors,(0,Fe._)`${Rr.default.vErrors} === null ? ${e} : ${Rr.default.vErrors}.concat(${e})`).assign(Rr.default.errors,(0,Fe._)`${Rr.default.vErrors}.length`),(0,R0.extendErrors)(t)},()=>t.error())}function Z0({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function p_(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Fe.stringify)(r)})}function L0(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}zt.validSchemaType=L0;function F0({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}zt.validateKeywordUsage=F0});var h_=I(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.extendSubschemaMode=vr.extendSubschemaData=vr.getSubschema=void 0;var Pt=H(),m_=te();function q0(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,Pt._)`${t.schemaPath}${(0,Pt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,Pt._)`${t.schemaPath}${(0,Pt.getProperty)(e)}${(0,Pt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,m_.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}vr.getSubschema=q0;function V0(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=s.let("data",(0,Pt._)`${e.data}${(0,Pt.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Pt.str)`${u}${(0,m_.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Pt._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Pt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(t.propertyName=a)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}vr.extendSubschemaData=V0;function W0(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}vr.extendSubschemaMode=W0});var zp=I((XU,g_)=>{"use strict";g_.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}});var __=I((QU,v_)=>{"use strict";var _r=v_.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};_s(e,n,o,t,"",t)};_r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};_r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};_r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};_r.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 _s(t,e,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in _r.arrayKeywords)for(var p=0;p<d.length;p++)_s(t,e,r,d[p],o+"/"+l+"/"+p,i,o,l,n,p)}else if(l in _r.propsKeywords){if(d&&typeof d=="object")for(var f in d)_s(t,e,r,d[f],o+"/"+l+"/"+J0(f),i,o,l,n,f)}else(l in _r.keywords||t.allKeys&&!(l in _r.skipKeywords))&&_s(t,e,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function J0(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var pi=I(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.getSchemaRefs=Ke.resolveUrl=Ke.normalizeId=Ke._getFullPath=Ke.getFullPath=Ke.inlineRef=void 0;var H0=te(),G0=zp(),K0=__(),Y0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function B0(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Pp(t):e?y_(t)<=e:!1}Ke.inlineRef=B0;var X0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Pp(t){for(let e in t){if(X0.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Pp)||typeof r=="object"&&Pp(r))return!0}return!1}function y_(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Y0.has(r)&&(typeof t[r]=="object"&&(0,H0.eachItem)(t[r],n=>e+=y_(n)),e===1/0))return 1/0}return e}function $_(t,e="",r){r!==!1&&(e=wn(e));let n=t.parse(e);return b_(t,n)}Ke.getFullPath=$_;function b_(t,e){return t.serialize(e).split("#")[0]+"#"}Ke._getFullPath=b_;var Q0=/#\/?$/;function wn(t){return t?t.replace(Q0,""):""}Ke.normalizeId=wn;function eI(t,e,r){return r=wn(r),t.resolve(e,r)}Ke.resolveUrl=eI;var tI=/^[a-z_][-a-z0-9._]*$/i;function rI(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=wn(t[r]||e),i={"":o},a=$_(n,o,!1),s={},c=new Set;return K0(t,{allKeys:!0},(d,p,f,h)=>{if(h===void 0)return;let g=a+p,$=i[h];typeof d[r]=="string"&&($=k.call(this,d[r])),S.call(this,d.$anchor),S.call(this,d.$dynamicAnchor),i[p]=$;function k(x){let N=this.opts.uriResolver.resolve;if(x=wn($?N($,x):x),c.has(x))throw l(x);c.add(x);let T=this.refs[x];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?u(d,T.schema,x):x!==wn(g)&&(x[0]==="#"?(u(d,s[x],x),s[x]=d):this.refs[x]=g),x}function S(x){if(typeof x=="string"){if(!tI.test(x))throw new Error(`invalid anchor "${x}"`);k.call(this,`#${x}`)}}}),s;function u(d,p,f){if(p!==void 0&&!G0(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ke.getSchemaRefs=rI});var hi=I(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.getData=yr.KeywordCxt=yr.validateFunctionCode=void 0;var E_=t_(),x_=di(),Op=bp(),ys=di(),nI=c_(),mi=f_(),Tp=h_(),D=H(),Z=Gt(),oI=pi(),Kt=te(),fi=li();function iI(t){if(P_(t)&&(T_(t),z_(t))){cI(t);return}I_(t,()=>(0,E_.topBoolOrEmptySchema)(t))}yr.validateFunctionCode=iI;function I_({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,D._)`${Z.default.data}, ${Z.default.valCxt}`,n.$async,()=>{t.code((0,D._)`"use strict"; ${S_(r,o)}`),sI(t,o),t.code(i)}):t.func(e,(0,D._)`${Z.default.data}, ${aI(o)}`,n.$async,()=>t.code(S_(r,o)).code(i))}function aI(t){return(0,D._)`{${Z.default.instancePath}="", ${Z.default.parentData}, ${Z.default.parentDataProperty}, ${Z.default.rootData}=${Z.default.data}${t.dynamicRef?(0,D._)`, ${Z.default.dynamicAnchors}={}`:D.nil}}={}`}function sI(t,e){t.if(Z.default.valCxt,()=>{t.var(Z.default.instancePath,(0,D._)`${Z.default.valCxt}.${Z.default.instancePath}`),t.var(Z.default.parentData,(0,D._)`${Z.default.valCxt}.${Z.default.parentData}`),t.var(Z.default.parentDataProperty,(0,D._)`${Z.default.valCxt}.${Z.default.parentDataProperty}`),t.var(Z.default.rootData,(0,D._)`${Z.default.valCxt}.${Z.default.rootData}`),e.dynamicRef&&t.var(Z.default.dynamicAnchors,(0,D._)`${Z.default.valCxt}.${Z.default.dynamicAnchors}`)},()=>{t.var(Z.default.instancePath,(0,D._)`""`),t.var(Z.default.parentData,(0,D._)`undefined`),t.var(Z.default.parentDataProperty,(0,D._)`undefined`),t.var(Z.default.rootData,Z.default.data),e.dynamicRef&&t.var(Z.default.dynamicAnchors,(0,D._)`{}`)})}function cI(t){let{schema:e,opts:r,gen:n}=t;I_(t,()=>{r.$comment&&e.$comment&&j_(t),fI(t),n.let(Z.default.vErrors,null),n.let(Z.default.errors,0),r.unevaluated&&uI(t),O_(t),gI(t)})}function uI(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,D._)`${r}.evaluated`),e.if((0,D._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,D._)`${t.evaluated}.props`,(0,D._)`undefined`)),e.if((0,D._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,D._)`${t.evaluated}.items`,(0,D._)`undefined`))}function S_(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,D._)`/*# sourceURL=${r} */`:D.nil}function lI(t,e){if(P_(t)&&(T_(t),z_(t))){dI(t,e);return}(0,E_.boolOrEmptySchema)(t,e)}function z_({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function P_(t){return typeof t.schema!="boolean"}function dI(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&j_(t),mI(t),hI(t);let i=n.const("_errs",Z.default.errors);O_(t,i),n.var(e,(0,D._)`${i} === ${Z.default.errors}`)}function T_(t){(0,Kt.checkUnknownRules)(t),pI(t)}function O_(t,e){if(t.opts.jtd)return k_(t,[],!1,e);let r=(0,x_.getSchemaTypes)(t.schema),n=(0,x_.coerceAndCheckDataType)(t,r);k_(t,r,!n,e)}function pI(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Kt.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function fI(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Kt.checkStrictMode)(t,"default is ignored in the schema root")}function mI(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,oI.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function hI(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function j_({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,D._)`${Z.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,D.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,D._)`${Z.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function gI(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,D._)`${Z.default.errors} === 0`,()=>e.return(Z.default.data),()=>e.throw((0,D._)`new ${o}(${Z.default.vErrors})`)):(e.assign((0,D._)`${n}.errors`,Z.default.vErrors),i.unevaluated&&vI(t),e.return((0,D._)`${Z.default.errors} === 0`))}function vI({gen:t,evaluated:e,props:r,items:n}){r instanceof D.Name&&t.assign((0,D._)`${e}.props`,r),n instanceof D.Name&&t.assign((0,D._)`${e}.items`,n)}function k_(t,e,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Kt.schemaHasRulesButRef)(i,l))){o.block(()=>N_(t,"$ref",l.all.$ref.definition));return}c.jtd||_I(t,e),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Op.shouldUseGroup)(i,p)&&(p.type?(o.if((0,ys.checkDataType)(p.type,a,c.strictNumbers)),w_(t,p),e.length===1&&e[0]===p.type&&r&&(o.else(),(0,ys.reportTypeError)(t)),o.endIf()):w_(t,p),s||o.if((0,D._)`${Z.default.errors} === ${n||0}`))}}function w_(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,nI.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,Op.shouldUseRule)(n,i)&&N_(t,i.keyword,i.definition,e.type)})}function _I(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(yI(t,e),t.opts.allowUnionTypes||$I(t,e),bI(t,t.dataTypes))}function yI(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{D_(t.dataTypes,r)||jp(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),SI(t,e)}}function $I(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&jp(t,"use allowUnionTypes to allow union type keyword")}function bI(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Op.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>xI(e,a))&&jp(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function xI(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function D_(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function SI(t,e){let r=[];for(let n of t.dataTypes)D_(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function jp(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Kt.checkStrictMode)(t,e,t.opts.strictTypes)}var $s=class{constructor(e,r,n){if((0,mi.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Kt.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",M_(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,mi.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=e.gen.const("_errs",Z.default.errors))}result(e,r,n){this.failResult((0,D.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,D.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,D._)`${r} !== undefined && (${(0,D.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?fi.reportExtraError:fi.reportError)(this,this.def.error,r)}$dataError(){(0,fi.reportError)(this,this.def.$dataError||fi.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,fi.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=D.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=D.nil,r=D.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,D.or)((0,D._)`${o} === undefined`,r)),e!==D.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==D.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,D.or)(a(),s());function a(){if(n.length){if(!(r instanceof D.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,D._)`${(0,ys.checkDataTypes)(c,r,i.opts.strictNumbers,ys.DataType.Wrong)}`}return D.nil}function s(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,D._)`!${c}(${r})`}return D.nil}}subschema(e,r){let n=(0,Tp.getSubschema)(this.it,e);(0,Tp.extendSubschemaData)(n,this.it,e),(0,Tp.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return lI(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Kt.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Kt.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,D.Name)),!0}};yr.KeywordCxt=$s;function N_(t,e,r,n){let o=new $s(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,mi.funcKeywordCode)(o,r):"macro"in r?(0,mi.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,mi.funcKeywordCode)(o,r)}var kI=/^\/(?:[^~]|~0|~1)*$/,wI=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function M_(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return Z.default.rootData;if(t[0]==="/"){if(!kI.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=Z.default.rootData}else{let u=wI.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,D._)`${i}${(0,D.getProperty)((0,Kt.unescapeJsonPointer)(u))}`,a=(0,D._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}yr.getData=M_});var bs=I(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var Dp=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Np.default=Dp});var gi=I(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var Mp=pi(),Rp=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Mp.resolveUrl)(e,r,n),this.missingSchema=(0,Mp.normalizeId)((0,Mp.getFullPath)(e,this.missingRef))}};Ap.default=Rp});var Ss=I(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.resolveSchema=lt.getCompilingSchema=lt.resolveRef=lt.compileSchema=lt.SchemaEnv=void 0;var yt=H(),EI=bs(),Ar=Gt(),$t=pi(),R_=te(),II=hi(),En=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,$t.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};lt.SchemaEnv=En;function Up(t){let e=A_.call(this,t);if(e)return e;let r=(0,$t.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new yt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;t.$async&&(s=a.scopeValue("Error",{ref:EI.default,code:(0,yt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");t.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Ar.default.data,parentData:Ar.default.parentData,parentDataProperty:Ar.default.parentDataProperty,dataNames:[Ar.default.data],dataPathArr:[yt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,yt.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:yt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,yt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,II.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Ar.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${Ar.default.self}`,`${Ar.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:h,items:g}=u;f.evaluated={props:h instanceof yt.Name?void 0:h,items:g instanceof yt.Name?void 0:g,dynamicProps:h instanceof yt.Name,dynamicItems:g instanceof yt.Name},f.source&&(f.source.evaluated=(0,yt.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}lt.compileSchema=Up;function zI(t,e,r){var n;r=(0,$t.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=OI.call(this,t,r);if(i===void 0){let a=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new En({schema:a,schemaId:s,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=PI.call(this,i)}lt.resolveRef=zI;function PI(t){return(0,$t.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Up.call(this,t)}function A_(t){for(let e of this._compilations)if(TI(e,t))return e}lt.getCompilingSchema=A_;function TI(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function OI(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||xs.call(this,t,e)}function xs(t,e){let r=this.opts.uriResolver.parse(e),n=(0,$t._getFullPath)(this.opts.uriResolver,r),o=(0,$t.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return Cp.call(this,r,t);let i=(0,$t.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=xs.call(this,t,a);return typeof s?.schema!="object"?void 0:Cp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||Up.call(this,a),i===(0,$t.normalizeId)(e)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,$t.resolveUrl)(this.opts.uriResolver,o,u)),new En({schema:s,schemaId:c,root:t,baseId:o})}return Cp.call(this,r,a)}}lt.resolveSchema=xs;var jI=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Cp(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,R_.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!jI.has(s)&&u&&(e=(0,$t.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,R_.schemaHasRulesButRef)(r,this.RULES)){let s=(0,$t.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=xs.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new En({schema:r,schemaId:a,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var C_=I((iZ,DI)=>{DI.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 Lp=I((aZ,F_)=>{"use strict";var NI=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Z_=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function Zp(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var MI=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function U_(t){return t.length=0,!0}function RI(t,e,r){if(t.length){let n=Zp(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function AI(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=RI;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=U_}else{o.push(u);continue}}return o.length&&(s===U_?r.zone=o.join(""):a?n.push(o.join("")):n.push(Zp(o))),r.address=n.join(""),r}function L_(t){if(CI(t,":")<2)return{host:t,isIPV6:!1};let e=AI(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function CI(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function UI(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(o===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function ZI(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function LI(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!Z_(r)){let n=L_(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}F_.exports={nonSimpleDomain:MI,recomposeAuthority:LI,normalizeComponentEncoding:ZI,removeDotSegments:UI,isIPv4:Z_,isUUID:NI,normalizeIPv6:L_,stringArrayToHexStripped:Zp}});var H_=I((sZ,J_)=>{"use strict";var{isUUID:FI}=Lp(),qI=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,VI=["http","https","ws","wss","urn","urn:uuid"];function WI(t){return VI.indexOf(t)!==-1}function Fp(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function q_(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function V_(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function JI(t){return t.secure=Fp(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function HI(t){if((t.port===(Fp(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function GI(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(qI);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=qp(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function KI(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=qp(o);i&&(t=i.serialize(t,e));let a=t,s=t.nss;return a.path=`${n||e.nid}:${s}`,e.skipEscape=!0,a}function YI(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!FI(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function BI(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var W_={scheme:"http",domainHost:!0,parse:q_,serialize:V_},XI={scheme:"https",domainHost:W_.domainHost,parse:q_,serialize:V_},ks={scheme:"ws",domainHost:!0,parse:JI,serialize:HI},QI={scheme:"wss",domainHost:ks.domainHost,parse:ks.parse,serialize:ks.serialize},ez={scheme:"urn",parse:GI,serialize:KI,skipNormalize:!0},tz={scheme:"urn:uuid",parse:YI,serialize:BI,skipNormalize:!0},ws={http:W_,https:XI,ws:ks,wss:QI,urn:ez,"urn:uuid":tz};Object.setPrototypeOf(ws,null);function qp(t){return t&&(ws[t]||ws[t.toLowerCase()])||void 0}J_.exports={wsIsSecure:Fp,SCHEMES:ws,isValidSchemeName:WI,getSchemeHandler:qp}});var Y_=I((cZ,Is)=>{"use strict";var{normalizeIPv6:rz,removeDotSegments:vi,recomposeAuthority:nz,normalizeComponentEncoding:Es,isIPv4:oz,nonSimpleDomain:iz}=Lp(),{SCHEMES:az,getSchemeHandler:G_}=H_();function sz(t,e){return typeof t=="string"?t=Tt(Yt(t,e),e):typeof t=="object"&&(t=Yt(Tt(t,e),e)),t}function cz(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=K_(Yt(t,n),Yt(e,n),n,!0);return n.skipEscape=!0,Tt(o,n)}function K_(t,e,r,n){let o={};return n||(t=Yt(Tt(t,r),r),e=Yt(Tt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=vi(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=vi(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=vi(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=vi(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function uz(t,e,r){return typeof t=="string"?(t=unescape(t),t=Tt(Es(Yt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Tt(Es(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Tt(Es(Yt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Tt(Es(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Tt(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=G_(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=nz(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=vi(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var lz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Yt(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(lz);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(oz(n.host)===!1){let c=rz(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=G_(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&iz(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Vp={SCHEMES:az,normalize:sz,resolve:cz,resolveComponent:K_,equal:uz,serialize:Tt,parse:Yt};Is.exports=Vp;Is.exports.default=Vp;Is.exports.fastUri=Vp});var X_=I(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var B_=Y_();B_.code='require("ajv/dist/runtime/uri").default';Wp.default=B_});var ay=I(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.CodeGen=Ee.Name=Ee.nil=Ee.stringify=Ee.str=Ee._=Ee.KeywordCxt=void 0;var dz=hi();Object.defineProperty(Ee,"KeywordCxt",{enumerable:!0,get:function(){return dz.KeywordCxt}});var In=H();Object.defineProperty(Ee,"_",{enumerable:!0,get:function(){return In._}});Object.defineProperty(Ee,"str",{enumerable:!0,get:function(){return In.str}});Object.defineProperty(Ee,"stringify",{enumerable:!0,get:function(){return In.stringify}});Object.defineProperty(Ee,"nil",{enumerable:!0,get:function(){return In.nil}});Object.defineProperty(Ee,"Name",{enumerable:!0,get:function(){return In.Name}});Object.defineProperty(Ee,"CodeGen",{enumerable:!0,get:function(){return In.CodeGen}});var pz=bs(),ny=gi(),fz=$p(),_i=Ss(),mz=H(),yi=pi(),zs=di(),Hp=te(),Q_=C_(),hz=X_(),oy=(t,e)=>new RegExp(t,e);oy.code="new RegExp";var gz=["removeAdditional","useDefaults","coerceTypes"],vz=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),_z={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."},yz={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},ey=200;function $z(t){var e,r,n,o,i,a,s,c,u,l,d,p,f,h,g,$,k,S,x,N,T,Ve,We,qn,qr;let ye=t.strict,rr=(e=t.code)===null||e===void 0?void 0:e.optimize,mt=rr===!0||rr===void 0?1:rr||0,Vn=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:oy,Pb=(o=t.uriResolver)!==null&&o!==void 0?o:hz.default;return{strictSchema:(a=(i=t.strictSchema)!==null&&i!==void 0?i:ye)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=t.strictNumbers)!==null&&s!==void 0?s:ye)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:ye)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:ye)!==null&&p!==void 0?p:"log",strictRequired:(h=(f=t.strictRequired)!==null&&f!==void 0?f:ye)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:mt,regExp:Vn}:{optimize:mt,regExp:Vn},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:ey,loopEnum:($=t.loopEnum)!==null&&$!==void 0?$:ey,meta:(k=t.meta)!==null&&k!==void 0?k:!0,messages:(S=t.messages)!==null&&S!==void 0?S:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(N=t.schemaId)!==null&&N!==void 0?N:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(Ve=t.validateSchema)!==null&&Ve!==void 0?Ve:!0,validateFormats:(We=t.validateFormats)!==null&&We!==void 0?We:!0,unicodeRegExp:(qn=t.unicodeRegExp)!==null&&qn!==void 0?qn:!0,int32range:(qr=t.int32range)!==null&&qr!==void 0?qr:!0,uriResolver:Pb}}var $i=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...$z(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new mz.ValueScope({scope:{},prefixes:vz,es5:r,lines:n}),this.logger=Ez(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,fz.getRules)(),ty.call(this,_z,e,"NOT SUPPORTED"),ty.call(this,yz,e,"DEPRECATED","warn"),this._metaOpts=kz.call(this),e.formats&&xz.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Sz.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),bz.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=Q_;n==="id"&&(o={...Q_},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,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,e,r);async function o(l,d){await i.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||a.call(this,p)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof ny.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({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 i.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(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let a of e)this.addSchema(a,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:a}=this.opts;if(i=e[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,yi.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$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,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=ry.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new _i.SchemaEnv({schema:{},schemaId:n});if(r=_i.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=ry.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,yi.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,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(zz.call(this,n,r),!r)return(0,Hp.eachItem)(n,i=>Jp.call(this,i)),this;Tz.call(this,r);let o={...r,type:(0,zs.getJSONTypes)(r.type),schemaType:(0,zs.getJSONTypes)(r.schemaType)};return(0,Hp.eachItem)(n,o.type.length===0?i=>Jp.call(this,i,o):i=>o.type.forEach(a=>Jp.call(this,i,o,a))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),a=e;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=iy(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e=="object")a=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,yi.normalizeId)(a||n);let u=yi.getSchemaRefs.call(this,e,n);return c=new _i.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):_i.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{_i.compileSchema.call(this,e)}finally{this.opts=r}}};$i.ValidationError=pz.default;$i.MissingRefError=ny.default;Ee.default=$i;function ty(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function ry(t){return t=(0,yi.normalizeId)(t),this.schemas[t]||this.refs[t]}function bz(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function xz(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Sz(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function kz(){let t={...this.opts};for(let e of gz)delete t[e];return t}var wz={log(){},warn(){},error(){}};function Ez(t){if(t===!1)return wz;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Iz=/^[a-z_$][a-z0-9_$:-]*$/i;function zz(t,e){let{RULES:r}=this;if((0,Hp.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Iz.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Jp(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,zs.getJSONTypes)(e.type),schemaType:(0,zs.getJSONTypes)(e.schemaType)}};e.before?Pz.call(this,a,s,e.before):a.rules.push(s),i.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Pz(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Tz(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=iy(e)),t.validateSchema=this.compile(e,!0))}var Oz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function iy(t){return{anyOf:[t,Oz]}}});var sy=I(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var jz={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Gp.default=jz});var dy=I(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.callRef=Cr.getValidate=void 0;var Dz=gi(),cy=ut(),Ye=H(),zn=Gt(),uy=Ss(),Ps=te(),Nz={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=uy.resolveRef.call(c,u,o,r);if(l===void 0)throw new Dz.default(n.opts.uriResolver,o,r);if(l instanceof uy.SchemaEnv)return p(l);return f(l);function d(){if(i===u)return Ts(t,a,i,i.$async);let h=e.scopeValue("root",{ref:u});return Ts(t,(0,Ye._)`${h}.validate`,u,u.$async)}function p(h){let g=ly(t,h);Ts(t,g,h,h.$async)}function f(h){let g=e.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Ye.stringify)(h)}:{ref:h}),$=e.name("valid"),k=t.subschema({schema:h,dataTypes:[],schemaPath:Ye.nil,topSchemaRef:g,errSchemaPath:r},$);t.mergeEvaluated(k),t.ok($)}}};function ly(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Ye._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Cr.getValidate=ly;function Ts(t,e,r,n){let{gen:o,it:i}=t,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?zn.default.this:Ye.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0,Ye._)`await ${(0,cy.callValidateCode)(t,e,u)}`),f(e),a||o.assign(h,!0)},g=>{o.if((0,Ye._)`!(${g} instanceof ${i.ValidationError})`,()=>o.throw(g)),p(g),a||o.assign(h,!1)}),t.ok(h)}function d(){t.result((0,cy.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(h){let g=(0,Ye._)`${h}.errors`;o.assign(zn.default.vErrors,(0,Ye._)`${zn.default.vErrors} === null ? ${g} : ${zn.default.vErrors}.concat(${g})`),o.assign(zn.default.errors,(0,Ye._)`${zn.default.vErrors}.length`)}function f(h){var g;if(!i.opts.unevaluated)return;let $=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(i.props=Ps.mergeEvaluated.props(o,$.props,i.props));else{let k=o.var("props",(0,Ye._)`${h}.evaluated.props`);i.props=Ps.mergeEvaluated.props(o,k,i.props,Ye.Name)}if(i.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(i.items=Ps.mergeEvaluated.items(o,$.items,i.items));else{let k=o.var("items",(0,Ye._)`${h}.evaluated.items`);i.items=Ps.mergeEvaluated.items(o,k,i.items,Ye.Name)}}}Cr.callRef=Ts;Cr.default=Nz});var py=I(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var Mz=sy(),Rz=dy(),Az=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Mz.default,Rz.default];Kp.default=Az});var fy=I(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});var Os=H(),$r=Os.operators,js={maximum:{okStr:"<=",ok:$r.LTE,fail:$r.GT},minimum:{okStr:">=",ok:$r.GTE,fail:$r.LT},exclusiveMaximum:{okStr:"<",ok:$r.LT,fail:$r.GTE},exclusiveMinimum:{okStr:">",ok:$r.GT,fail:$r.LTE}},Cz={message:({keyword:t,schemaCode:e})=>(0,Os.str)`must be ${js[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Os._)`{comparison: ${js[t].okStr}, limit: ${e}}`},Uz={keyword:Object.keys(js),type:"number",schemaType:"number",$data:!0,error:Cz,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Os._)`${r} ${js[e].fail} ${n} || isNaN(${r})`)}};Yp.default=Uz});var my=I(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var bi=H(),Zz={message:({schemaCode:t})=>(0,bi.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,bi._)`{multipleOf: ${t}}`},Lz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Zz,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,a=e.let("res"),s=i?(0,bi._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,bi._)`${a} !== parseInt(${a})`;t.fail$data((0,bi._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Bp.default=Lz});var gy=I(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});function hy(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}Xp.default=hy;hy.code='require("ajv/dist/runtime/ucs2length").default'});var vy=I(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var Ur=H(),Fz=te(),qz=gy(),Vz={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Ur.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Ur._)`{limit: ${t}}`},Wz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Vz,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?Ur.operators.GT:Ur.operators.LT,a=o.opts.unicode===!1?(0,Ur._)`${r}.length`:(0,Ur._)`${(0,Fz.useFunc)(t.gen,qz.default)}(${r})`;t.fail$data((0,Ur._)`${a} ${i} ${n}`)}};Qp.default=Wz});var _y=I(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var Jz=ut(),Hz=te(),Pn=H(),Gz={message:({schemaCode:t})=>(0,Pn.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Pn._)`{pattern: ${t}}`},Kz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Gz,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,Pn._)`new RegExp`:(0,Hz.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Pn._)`${u}(${i}, ${s}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Pn._)`!${l}`)}else{let c=(0,Jz.usePattern)(t,o);t.fail$data((0,Pn._)`!${c}.test(${r})`)}}};ef.default=Kz});var yy=I(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var xi=H(),Yz={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,xi.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,xi._)`{limit: ${t}}`},Bz={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Yz,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?xi.operators.GT:xi.operators.LT;t.fail$data((0,xi._)`Object.keys(${r}).length ${o} ${n}`)}};tf.default=Bz});var $y=I(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var Si=ut(),ki=H(),Xz=te(),Qz={message:({params:{missingProperty:t}})=>(0,ki.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,ki._)`{missingProperty: ${t}}`},eP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Qz,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:a}=t,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let f=t.parentSchema.properties,{definedProperties:h}=t.it;for(let g of r)if(f?.[g]===void 0&&!h.has(g)){let $=a.schemaEnv.baseId+a.errSchemaPath,k=`required property "${g}" is not defined at "${$}" (strictRequired)`;(0,Xz.checkStrictMode)(a,k,a.opts.strictRequired)}}function u(){if(c||i)t.block$data(ki.nil,d);else for(let f of r)(0,Si.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||i){let h=e.let("valid",!0);t.block$data(h,()=>p(f,h)),t.ok(h)}else e.if((0,Si.checkMissingProp)(t,r,f)),(0,Si.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,Si.noPropertyInData)(e,o,f,s.ownProperties),()=>t.error())})}function p(f,h){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(h,(0,Si.propertyInData)(e,o,f,s.ownProperties)),e.if((0,ki.not)(h),()=>{t.error(),e.break()})},ki.nil)}}};rf.default=eP});var by=I(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var wi=H(),tP={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,wi.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,wi._)`{limit: ${t}}`},rP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:tP,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?wi.operators.GT:wi.operators.LT;t.fail$data((0,wi._)`${r}.length ${o} ${n}`)}};nf.default=rP});var Ds=I(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var xy=zp();xy.code='require("ajv/dist/runtime/equal").default';of.default=xy});var Sy=I(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var af=di(),Ie=H(),nP=te(),oP=Ds(),iP={message:({params:{i:t,j:e}})=>(0,Ie.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Ie._)`{i: ${t}, j: ${e}}`},aP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:iP,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,af.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Ie._)`${a} === false`),t.ok(c);function l(){let h=e.let("i",(0,Ie._)`${r}.length`),g=e.let("j");t.setParams({i:h,j:g}),e.assign(c,!0),e.if((0,Ie._)`${h} > 1`,()=>(d()?p:f)(h,g))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,g){let $=e.name("item"),k=(0,af.checkDataTypes)(u,$,s.opts.strictNumbers,af.DataType.Wrong),S=e.const("indices",(0,Ie._)`{}`);e.for((0,Ie._)`;${h}--;`,()=>{e.let($,(0,Ie._)`${r}[${h}]`),e.if(k,(0,Ie._)`continue`),u.length>1&&e.if((0,Ie._)`typeof ${$} == "string"`,(0,Ie._)`${$} += "_"`),e.if((0,Ie._)`typeof ${S}[${$}] == "number"`,()=>{e.assign(g,(0,Ie._)`${S}[${$}]`),t.error(),e.assign(c,!1).break()}).code((0,Ie._)`${S}[${$}] = ${h}`)})}function f(h,g){let $=(0,nP.useFunc)(e,oP.default),k=e.name("outer");e.label(k).for((0,Ie._)`;${h}--;`,()=>e.for((0,Ie._)`${g} = ${h}; ${g}--;`,()=>e.if((0,Ie._)`${$}(${r}[${h}], ${r}[${g}])`,()=>{t.error(),e.assign(c,!1).break(k)})))}}};sf.default=aP});var ky=I(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var cf=H(),sP=te(),cP=Ds(),uP={message:"must be equal to constant",params:({schemaCode:t})=>(0,cf._)`{allowedValue: ${t}}`},lP={keyword:"const",$data:!0,error:uP,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,cf._)`!${(0,sP.useFunc)(e,cP.default)}(${r}, ${o})`):t.fail((0,cf._)`${i} !== ${r}`)}};uf.default=lP});var wy=I(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var Ei=H(),dP=te(),pP=Ds(),fP={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Ei._)`{allowedValues: ${t}}`},mP={keyword:"enum",schemaType:"array",$data:!0,error:fP,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,dP.useFunc)(e,pP.default)),l;if(s||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=e.const("vSchema",i);l=(0,Ei.or)(...o.map((h,g)=>p(f,g)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,f=>e.if((0,Ei._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,h){let g=o[h];return typeof g=="object"&&g!==null?(0,Ei._)`${u()}(${r}, ${f}[${h}])`:(0,Ei._)`${r} === ${g}`}}};lf.default=mP});var Ey=I(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var hP=fy(),gP=my(),vP=vy(),_P=_y(),yP=yy(),$P=$y(),bP=by(),xP=Sy(),SP=ky(),kP=wy(),wP=[hP.default,gP.default,vP.default,_P.default,yP.default,$P.default,bP.default,xP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},SP.default,kP.default];df.default=wP});var ff=I(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.validateAdditionalItems=void 0;var Zr=H(),pf=te(),EP={message:({params:{len:t}})=>(0,Zr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Zr._)`{limit: ${t}}`},IP={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:EP,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,pf.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Iy(t,n)}};function Iy(t,e){let{gen:r,schema:n,data:o,keyword:i,it:a}=t;a.items=!0;let s=r.const("len",(0,Zr._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Zr._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,pf.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Zr._)`${s} <= ${e.length}`);r.if((0,Zr.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,s,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:pf.Type.Num},u),a.allErrors||r.if((0,Zr.not)(u),()=>r.break())})}}Ii.validateAdditionalItems=Iy;Ii.default=IP});var mf=I(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.validateTuple=void 0;var zy=H(),Ns=te(),zP=ut(),PP={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Py(t,"additionalItems",e);r.items=!0,!(0,Ns.alwaysValidSchema)(r,e)&&t.ok((0,zP.validateArray)(t))}};function Py(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=t;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=Ns.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,zy._)`${i}.length`);r.forEach((d,p)=>{(0,Ns.alwaysValidSchema)(s,d)||(n.if((0,zy._)`${u} > ${p}`,()=>t.subschema({keyword:a,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=s,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(p.strictTuples&&!g){let $=`"${a}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,Ns.checkStrictMode)(s,$,p.strictTuples)}}}zi.validateTuple=Py;zi.default=PP});var Ty=I(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var TP=mf(),OP={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,TP.validateTuple)(t,"items")};hf.default=OP});var jy=I(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var Oy=H(),jP=te(),DP=ut(),NP=ff(),MP={message:({params:{len:t}})=>(0,Oy.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Oy._)`{limit: ${t}}`},RP={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:MP,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,jP.alwaysValidSchema)(n,e)&&(o?(0,NP.validateAdditionalItems)(t,o):t.ok((0,DP.validateArray)(t)))}};gf.default=RP});var Dy=I(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var dt=H(),Ms=te(),AP={message:({params:{min:t,max:e}})=>e===void 0?(0,dt.str)`must contain at least ${t} valid item(s)`:(0,dt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,dt._)`{minContains: ${t}}`:(0,dt._)`{minContains: ${t}, maxContains: ${e}}`},CP={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:AP,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=e.const("len",(0,dt._)`${o}.length`);if(t.setParams({min:a,max:s}),s===void 0&&a===0){(0,Ms.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,Ms.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ms.alwaysValidSchema)(i,r)){let g=(0,dt._)`${l} >= ${a}`;s!==void 0&&(g=(0,dt._)`${g} && ${l} <= ${s}`),t.pass(g);return}i.items=!0;let d=e.name("valid");s===void 0&&a===1?f(d,()=>e.if(d,()=>e.break())):a===0?(e.let(d,!0),s!==void 0&&e.if((0,dt._)`${o}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let g=e.name("_valid"),$=e.let("count",0);f(g,()=>e.if(g,()=>h($)))}function f(g,$){e.forRange("i",0,l,k=>{t.subschema({keyword:"contains",dataProp:k,dataPropType:Ms.Type.Num,compositeRule:!0},g),$()})}function h(g){e.code((0,dt._)`${g}++`),s===void 0?e.if((0,dt._)`${g} >= ${a}`,()=>e.assign(d,!0).break()):(e.if((0,dt._)`${g} > ${s}`,()=>e.assign(d,!1).break()),a===1?e.assign(d,!0):e.if((0,dt._)`${g} >= ${a}`,()=>e.assign(d,!0)))}}};vf.default=CP});var Ry=I(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.validateSchemaDeps=Ot.validatePropertyDeps=Ot.error=void 0;var _f=H(),UP=te(),Pi=ut();Ot.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,_f.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,_f._)`{property: ${t},
|
|
6
|
+
|| ${a} === "boolean" || ${o} === null`).assign(s,(0,J._)`[${o}]`)}}}function k0({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,J._)`${e} !== undefined`,()=>t.assign((0,J._)`${e}[${r}]`,n))}function kp(t,e,r,n=kn.Correct){let o=n===kn.Correct?J.operators.EQ:J.operators.NEQ,i;switch(t){case"null":return(0,J._)`${e} ${o} null`;case"array":i=(0,J._)`Array.isArray(${e})`;break;case"object":i=(0,J._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=a((0,J._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=a();break;default:return(0,J._)`typeof ${e} ${o} ${t}`}return n===kn.Correct?i:(0,J.not)(i);function a(s=J.nil){return(0,J.and)((0,J._)`typeof ${e} == "number"`,s,r?(0,J._)`isFinite(${e})`:J.nil)}}Ne.checkDataType=kp;function wp(t,e,r,n){if(t.length===1)return kp(t[0],e,r,n);let o,i=(0,a_.toHash)(t);if(i.array&&i.object){let a=(0,J._)`typeof ${e} != "object"`;o=i.null?a:(0,J._)`!${e} || ${a}`,delete i.null,delete i.array,delete i.object}else o=J.nil;i.number&&delete i.integer;for(let a in i)o=(0,J.and)(o,kp(a,e,r,n));return o}Ne.checkDataTypes=wp;var w0={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,J._)`{type: ${t}}`:(0,J._)`{type: ${e}}`};function Ep(t){let e=E0(t);(0,y0.reportError)(e,w0)}Ne.reportTypeError=Ep;function E0(t){let{gen:e,data:r,schema:n}=t,o=(0,a_.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var l_=I(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.assignDefaults=void 0;var wn=H(),I0=te();function z0(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)u_(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>u_(t,i,o.default))}_s.assignDefaults=z0;function u_(t,e,r){let{gen:n,compositeRule:o,data:i,opts:a}=t;if(r===void 0)return;let s=(0,wn._)`${i}${(0,wn.getProperty)(e)}`;if(o){(0,I0.checkStrictMode)(t,`default is ignored for: ${s}`);return}let c=(0,wn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,wn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,wn._)`${s} = ${(0,wn.stringify)(r)}`)}});var ut=I(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.validateUnion=se.validateArray=se.usePattern=se.callValidateCode=se.schemaProperties=se.allSchemaProperties=se.noPropertyInData=se.propertyInData=se.isOwnProperty=se.hasPropFunc=se.reportMissingProp=se.checkMissingProp=se.checkReportMissingProp=void 0;var he=H(),Ip=te(),gr=Kt(),P0=te();function T0(t,e){let{gen:r,data:n,it:o}=t;r.if(Pp(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,he._)`${e}`},!0),t.error()})}se.checkReportMissingProp=T0;function O0({gen:t,data:e,it:{opts:r}},n,o){return(0,he.or)(...n.map(i=>(0,he.and)(Pp(t,e,i,r.ownProperties),(0,he._)`${o} = ${i}`)))}se.checkMissingProp=O0;function j0(t,e){t.setParams({missingProperty:e},!0),t.error()}se.reportMissingProp=j0;function d_(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,he._)`Object.prototype.hasOwnProperty`})}se.hasPropFunc=d_;function zp(t,e,r){return(0,he._)`${d_(t)}.call(${e}, ${r})`}se.isOwnProperty=zp;function D0(t,e,r,n){let o=(0,he._)`${e}${(0,he.getProperty)(r)} !== undefined`;return n?(0,he._)`${o} && ${zp(t,e,r)}`:o}se.propertyInData=D0;function Pp(t,e,r,n){let o=(0,he._)`${e}${(0,he.getProperty)(r)} === undefined`;return n?(0,he.or)(o,(0,he.not)(zp(t,e,r))):o}se.noPropertyInData=Pp;function p_(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}se.allSchemaProperties=p_;function N0(t,e){return p_(e).filter(r=>!(0,Ip.alwaysValidSchema)(t,e[r]))}se.schemaProperties=N0;function M0({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,he._)`${t}, ${e}, ${n}${o}`:e,d=[[gr.default.instancePath,(0,he.strConcat)(gr.default.instancePath,i)],[gr.default.parentData,a.parentData],[gr.default.parentDataProperty,a.parentDataProperty],[gr.default.rootData,gr.default.rootData]];a.opts.dynamicRef&&d.push([gr.default.dynamicAnchors,gr.default.dynamicAnchors]);let p=(0,he._)`${l}, ${r.object(...d)}`;return c!==he.nil?(0,he._)`${s}.call(${c}, ${p})`:(0,he._)`${s}(${p})`}se.callValidateCode=M0;var R0=(0,he._)`new RegExp`;function A0({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,he._)`${o.code==="new RegExp"?R0:(0,P0.useFunc)(t,o)}(${r}, ${n})`})}se.usePattern=A0;function C0(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let s=e.let("valid",!0);return a(()=>e.assign(s,!1)),s}return e.var(i,!0),a(()=>e.break()),i;function a(s){let c=e.const("len",(0,he._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:Ip.Type.Num},i),e.if((0,he.not)(i),s)})}}se.validateArray=C0;function U0(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Ip.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);e.assign(a,(0,he._)`${a} || ${s}`),t.mergeValidEvaluated(l,s)||e.if((0,he.not)(a))})),t.result(a,()=>t.reset(),()=>t.error(!0))}se.validateUnion=U0});var h_=I(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.validateKeywordUsage=Pt.validSchemaType=Pt.funcKeywordCode=Pt.macroKeywordCode=void 0;var Fe=H(),Ar=Kt(),Z0=ut(),L0=di();function F0(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=t,s=e.macro.call(a.self,o,i,a),c=m_(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");t.subschema({schema:s,schemaPath:Fe.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Pt.macroKeywordCode=F0;function q0(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=t;W0(c,e);let u=!s&&e.compile?e.compile.call(c.self,i,a,c):e.validate,l=m_(n,o,u),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)g(),e.modifying&&f_(t),$(()=>t.error());else{let k=e.async?f():h();e.modifying&&f_(t),$(()=>V0(t,k))}}function f(){let k=n.let("ruleErrs",null);return n.try(()=>g((0,Fe._)`await `),S=>n.assign(d,!1).if((0,Fe._)`${S} instanceof ${c.ValidationError}`,()=>n.assign(k,(0,Fe._)`${S}.errors`),()=>n.throw(S))),k}function h(){let k=(0,Fe._)`${l}.errors`;return n.assign(k,null),g(Fe.nil),k}function g(k=e.async?(0,Fe._)`await `:Fe.nil){let S=c.opts.passContext?Ar.default.this:Ar.default.self,x=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,Fe._)`${k}${(0,Z0.callValidateCode)(t,l,S,x)}`,e.modifying)}function $(k){var S;n.if((0,Fe.not)((S=e.valid)!==null&&S!==void 0?S:d),k)}}Pt.funcKeywordCode=q0;function f_(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Fe._)`${n.parentData}[${n.parentDataProperty}]`))}function V0(t,e){let{gen:r}=t;r.if((0,Fe._)`Array.isArray(${e})`,()=>{r.assign(Ar.default.vErrors,(0,Fe._)`${Ar.default.vErrors} === null ? ${e} : ${Ar.default.vErrors}.concat(${e})`).assign(Ar.default.errors,(0,Fe._)`${Ar.default.vErrors}.length`),(0,L0.extendErrors)(t)},()=>t.error())}function W0({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function m_(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Fe.stringify)(r)})}function J0(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Pt.validSchemaType=J0;function H0({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Pt.validateKeywordUsage=H0});var v_=I(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.extendSubschemaMode=vr.extendSubschemaData=vr.getSubschema=void 0;var Tt=H(),g_=te();function G0(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,Tt._)`${t.schemaPath}${(0,Tt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,Tt._)`${t.schemaPath}${(0,Tt.getProperty)(e)}${(0,Tt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,g_.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}vr.getSubschema=G0;function K0(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=s.let("data",(0,Tt._)`${e.data}${(0,Tt.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Tt.str)`${u}${(0,g_.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Tt._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Tt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(t.propertyName=a)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}vr.extendSubschemaData=K0;function Y0(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}vr.extendSubschemaMode=Y0});var Tp=I((oZ,__)=>{"use strict";__.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}});var $_=I((iZ,y_)=>{"use strict";var _r=y_.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};ys(e,n,o,t,"",t)};_r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};_r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};_r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};_r.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 ys(t,e,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in _r.arrayKeywords)for(var p=0;p<d.length;p++)ys(t,e,r,d[p],o+"/"+l+"/"+p,i,o,l,n,p)}else if(l in _r.propsKeywords){if(d&&typeof d=="object")for(var f in d)ys(t,e,r,d[f],o+"/"+l+"/"+B0(f),i,o,l,n,f)}else(l in _r.keywords||t.allKeys&&!(l in _r.skipKeywords))&&ys(t,e,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function B0(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var fi=I(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.getSchemaRefs=Ke.resolveUrl=Ke.normalizeId=Ke._getFullPath=Ke.getFullPath=Ke.inlineRef=void 0;var X0=te(),Q0=Tp(),eI=$_(),tI=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function rI(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Op(t):e?b_(t)<=e:!1}Ke.inlineRef=rI;var nI=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Op(t){for(let e in t){if(nI.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Op)||typeof r=="object"&&Op(r))return!0}return!1}function b_(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!tI.has(r)&&(typeof t[r]=="object"&&(0,X0.eachItem)(t[r],n=>e+=b_(n)),e===1/0))return 1/0}return e}function x_(t,e="",r){r!==!1&&(e=En(e));let n=t.parse(e);return S_(t,n)}Ke.getFullPath=x_;function S_(t,e){return t.serialize(e).split("#")[0]+"#"}Ke._getFullPath=S_;var oI=/#\/?$/;function En(t){return t?t.replace(oI,""):""}Ke.normalizeId=En;function iI(t,e,r){return r=En(r),t.resolve(e,r)}Ke.resolveUrl=iI;var aI=/^[a-z_][-a-z0-9._]*$/i;function sI(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=En(t[r]||e),i={"":o},a=x_(n,o,!1),s={},c=new Set;return eI(t,{allKeys:!0},(d,p,f,h)=>{if(h===void 0)return;let g=a+p,$=i[h];typeof d[r]=="string"&&($=k.call(this,d[r])),S.call(this,d.$anchor),S.call(this,d.$dynamicAnchor),i[p]=$;function k(x){let N=this.opts.uriResolver.resolve;if(x=En($?N($,x):x),c.has(x))throw l(x);c.add(x);let T=this.refs[x];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?u(d,T.schema,x):x!==En(g)&&(x[0]==="#"?(u(d,s[x],x),s[x]=d):this.refs[x]=g),x}function S(x){if(typeof x=="string"){if(!aI.test(x))throw new Error(`invalid anchor "${x}"`);k.call(this,`#${x}`)}}}),s;function u(d,p,f){if(p!==void 0&&!Q0(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ke.getSchemaRefs=sI});var gi=I(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.getData=yr.KeywordCxt=yr.validateFunctionCode=void 0;var z_=n_(),k_=pi(),Dp=Sp(),$s=pi(),cI=l_(),hi=h_(),jp=v_(),D=H(),Z=Kt(),uI=fi(),Yt=te(),mi=di();function lI(t){if(O_(t)&&(j_(t),T_(t))){fI(t);return}P_(t,()=>(0,z_.topBoolOrEmptySchema)(t))}yr.validateFunctionCode=lI;function P_({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,D._)`${Z.default.data}, ${Z.default.valCxt}`,n.$async,()=>{t.code((0,D._)`"use strict"; ${w_(r,o)}`),pI(t,o),t.code(i)}):t.func(e,(0,D._)`${Z.default.data}, ${dI(o)}`,n.$async,()=>t.code(w_(r,o)).code(i))}function dI(t){return(0,D._)`{${Z.default.instancePath}="", ${Z.default.parentData}, ${Z.default.parentDataProperty}, ${Z.default.rootData}=${Z.default.data}${t.dynamicRef?(0,D._)`, ${Z.default.dynamicAnchors}={}`:D.nil}}={}`}function pI(t,e){t.if(Z.default.valCxt,()=>{t.var(Z.default.instancePath,(0,D._)`${Z.default.valCxt}.${Z.default.instancePath}`),t.var(Z.default.parentData,(0,D._)`${Z.default.valCxt}.${Z.default.parentData}`),t.var(Z.default.parentDataProperty,(0,D._)`${Z.default.valCxt}.${Z.default.parentDataProperty}`),t.var(Z.default.rootData,(0,D._)`${Z.default.valCxt}.${Z.default.rootData}`),e.dynamicRef&&t.var(Z.default.dynamicAnchors,(0,D._)`${Z.default.valCxt}.${Z.default.dynamicAnchors}`)},()=>{t.var(Z.default.instancePath,(0,D._)`""`),t.var(Z.default.parentData,(0,D._)`undefined`),t.var(Z.default.parentDataProperty,(0,D._)`undefined`),t.var(Z.default.rootData,Z.default.data),e.dynamicRef&&t.var(Z.default.dynamicAnchors,(0,D._)`{}`)})}function fI(t){let{schema:e,opts:r,gen:n}=t;P_(t,()=>{r.$comment&&e.$comment&&N_(t),_I(t),n.let(Z.default.vErrors,null),n.let(Z.default.errors,0),r.unevaluated&&mI(t),D_(t),bI(t)})}function mI(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,D._)`${r}.evaluated`),e.if((0,D._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,D._)`${t.evaluated}.props`,(0,D._)`undefined`)),e.if((0,D._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,D._)`${t.evaluated}.items`,(0,D._)`undefined`))}function w_(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,D._)`/*# sourceURL=${r} */`:D.nil}function hI(t,e){if(O_(t)&&(j_(t),T_(t))){gI(t,e);return}(0,z_.boolOrEmptySchema)(t,e)}function T_({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function O_(t){return typeof t.schema!="boolean"}function gI(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&N_(t),yI(t),$I(t);let i=n.const("_errs",Z.default.errors);D_(t,i),n.var(e,(0,D._)`${i} === ${Z.default.errors}`)}function j_(t){(0,Yt.checkUnknownRules)(t),vI(t)}function D_(t,e){if(t.opts.jtd)return E_(t,[],!1,e);let r=(0,k_.getSchemaTypes)(t.schema),n=(0,k_.coerceAndCheckDataType)(t,r);E_(t,r,!n,e)}function vI(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Yt.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function _I(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Yt.checkStrictMode)(t,"default is ignored in the schema root")}function yI(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,uI.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function $I(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function N_({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,D._)`${Z.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,D.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,D._)`${Z.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function bI(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,D._)`${Z.default.errors} === 0`,()=>e.return(Z.default.data),()=>e.throw((0,D._)`new ${o}(${Z.default.vErrors})`)):(e.assign((0,D._)`${n}.errors`,Z.default.vErrors),i.unevaluated&&xI(t),e.return((0,D._)`${Z.default.errors} === 0`))}function xI({gen:t,evaluated:e,props:r,items:n}){r instanceof D.Name&&t.assign((0,D._)`${e}.props`,r),n instanceof D.Name&&t.assign((0,D._)`${e}.items`,n)}function E_(t,e,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Yt.schemaHasRulesButRef)(i,l))){o.block(()=>R_(t,"$ref",l.all.$ref.definition));return}c.jtd||SI(t,e),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Dp.shouldUseGroup)(i,p)&&(p.type?(o.if((0,$s.checkDataType)(p.type,a,c.strictNumbers)),I_(t,p),e.length===1&&e[0]===p.type&&r&&(o.else(),(0,$s.reportTypeError)(t)),o.endIf()):I_(t,p),s||o.if((0,D._)`${Z.default.errors} === ${n||0}`))}}function I_(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,cI.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,Dp.shouldUseRule)(n,i)&&R_(t,i.keyword,i.definition,e.type)})}function SI(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(kI(t,e),t.opts.allowUnionTypes||wI(t,e),EI(t,t.dataTypes))}function kI(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{M_(t.dataTypes,r)||Np(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),zI(t,e)}}function wI(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Np(t,"use allowUnionTypes to allow union type keyword")}function EI(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Dp.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>II(e,a))&&Np(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function II(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function M_(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function zI(t,e){let r=[];for(let n of t.dataTypes)M_(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Np(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Yt.checkStrictMode)(t,e,t.opts.strictTypes)}var bs=class{constructor(e,r,n){if((0,hi.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Yt.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",A_(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,hi.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=e.gen.const("_errs",Z.default.errors))}result(e,r,n){this.failResult((0,D.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,D.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,D._)`${r} !== undefined && (${(0,D.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?mi.reportExtraError:mi.reportError)(this,this.def.error,r)}$dataError(){(0,mi.reportError)(this,this.def.$dataError||mi.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,mi.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=D.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=D.nil,r=D.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,D.or)((0,D._)`${o} === undefined`,r)),e!==D.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==D.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,D.or)(a(),s());function a(){if(n.length){if(!(r instanceof D.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,D._)`${(0,$s.checkDataTypes)(c,r,i.opts.strictNumbers,$s.DataType.Wrong)}`}return D.nil}function s(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,D._)`!${c}(${r})`}return D.nil}}subschema(e,r){let n=(0,jp.getSubschema)(this.it,e);(0,jp.extendSubschemaData)(n,this.it,e),(0,jp.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return hI(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Yt.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Yt.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,D.Name)),!0}};yr.KeywordCxt=bs;function R_(t,e,r,n){let o=new bs(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,hi.funcKeywordCode)(o,r):"macro"in r?(0,hi.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,hi.funcKeywordCode)(o,r)}var PI=/^\/(?:[^~]|~0|~1)*$/,TI=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function A_(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return Z.default.rootData;if(t[0]==="/"){if(!PI.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=Z.default.rootData}else{let u=TI.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,D._)`${i}${(0,D.getProperty)((0,Yt.unescapeJsonPointer)(u))}`,a=(0,D._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}yr.getData=A_});var xs=I(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});var Mp=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Rp.default=Mp});var vi=I(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var Ap=fi(),Cp=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Ap.resolveUrl)(e,r,n),this.missingSchema=(0,Ap.normalizeId)((0,Ap.getFullPath)(e,this.missingRef))}};Up.default=Cp});var ks=I(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.resolveSchema=lt.getCompilingSchema=lt.resolveRef=lt.compileSchema=lt.SchemaEnv=void 0;var $t=H(),OI=xs(),Cr=Kt(),bt=fi(),C_=te(),jI=gi(),In=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,bt.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};lt.SchemaEnv=In;function Lp(t){let e=U_.call(this,t);if(e)return e;let r=(0,bt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new $t.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;t.$async&&(s=a.scopeValue("Error",{ref:OI.default,code:(0,$t._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");t.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Cr.default.data,parentData:Cr.default.parentData,parentDataProperty:Cr.default.parentDataProperty,dataNames:[Cr.default.data],dataPathArr:[$t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,$t.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:$t.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,$t._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,jI.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Cr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${Cr.default.self}`,`${Cr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:h,items:g}=u;f.evaluated={props:h instanceof $t.Name?void 0:h,items:g instanceof $t.Name?void 0:g,dynamicProps:h instanceof $t.Name,dynamicItems:g instanceof $t.Name},f.source&&(f.source.evaluated=(0,$t.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}lt.compileSchema=Lp;function DI(t,e,r){var n;r=(0,bt.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=RI.call(this,t,r);if(i===void 0){let a=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new In({schema:a,schemaId:s,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=NI.call(this,i)}lt.resolveRef=DI;function NI(t){return(0,bt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Lp.call(this,t)}function U_(t){for(let e of this._compilations)if(MI(e,t))return e}lt.getCompilingSchema=U_;function MI(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function RI(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Ss.call(this,t,e)}function Ss(t,e){let r=this.opts.uriResolver.parse(e),n=(0,bt._getFullPath)(this.opts.uriResolver,r),o=(0,bt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return Zp.call(this,r,t);let i=(0,bt.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=Ss.call(this,t,a);return typeof s?.schema!="object"?void 0:Zp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||Lp.call(this,a),i===(0,bt.normalizeId)(e)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,bt.resolveUrl)(this.opts.uriResolver,o,u)),new In({schema:s,schemaId:c,root:t,baseId:o})}return Zp.call(this,r,a)}}lt.resolveSchema=Ss;var AI=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Zp(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,C_.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!AI.has(s)&&u&&(e=(0,bt.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,C_.schemaHasRulesButRef)(r,this.RULES)){let s=(0,bt.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=Ss.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new In({schema:r,schemaId:a,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var Z_=I((dZ,CI)=>{CI.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 qp=I((pZ,V_)=>{"use strict";var UI=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),F_=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function Fp(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var ZI=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function L_(t){return t.length=0,!0}function LI(t,e,r){if(t.length){let n=Fp(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function FI(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=LI;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=L_}else{o.push(u);continue}}return o.length&&(s===L_?r.zone=o.join(""):a?n.push(o.join("")):n.push(Fp(o))),r.address=n.join(""),r}function q_(t){if(qI(t,":")<2)return{host:t,isIPV6:!1};let e=FI(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function qI(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function VI(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(o===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function WI(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function JI(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!F_(r)){let n=q_(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}V_.exports={nonSimpleDomain:ZI,recomposeAuthority:JI,normalizeComponentEncoding:WI,removeDotSegments:VI,isIPv4:F_,isUUID:UI,normalizeIPv6:q_,stringArrayToHexStripped:Fp}});var K_=I((fZ,G_)=>{"use strict";var{isUUID:HI}=qp(),GI=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,KI=["http","https","ws","wss","urn","urn:uuid"];function YI(t){return KI.indexOf(t)!==-1}function Vp(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function W_(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function J_(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function BI(t){return t.secure=Vp(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function XI(t){if((t.port===(Vp(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function QI(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(GI);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=Wp(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function ez(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=Wp(o);i&&(t=i.serialize(t,e));let a=t,s=t.nss;return a.path=`${n||e.nid}:${s}`,e.skipEscape=!0,a}function tz(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!HI(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function rz(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var H_={scheme:"http",domainHost:!0,parse:W_,serialize:J_},nz={scheme:"https",domainHost:H_.domainHost,parse:W_,serialize:J_},ws={scheme:"ws",domainHost:!0,parse:BI,serialize:XI},oz={scheme:"wss",domainHost:ws.domainHost,parse:ws.parse,serialize:ws.serialize},iz={scheme:"urn",parse:QI,serialize:ez,skipNormalize:!0},az={scheme:"urn:uuid",parse:tz,serialize:rz,skipNormalize:!0},Es={http:H_,https:nz,ws,wss:oz,urn:iz,"urn:uuid":az};Object.setPrototypeOf(Es,null);function Wp(t){return t&&(Es[t]||Es[t.toLowerCase()])||void 0}G_.exports={wsIsSecure:Vp,SCHEMES:Es,isValidSchemeName:YI,getSchemeHandler:Wp}});var X_=I((mZ,zs)=>{"use strict";var{normalizeIPv6:sz,removeDotSegments:_i,recomposeAuthority:cz,normalizeComponentEncoding:Is,isIPv4:uz,nonSimpleDomain:lz}=qp(),{SCHEMES:dz,getSchemeHandler:Y_}=K_();function pz(t,e){return typeof t=="string"?t=Ot(Bt(t,e),e):typeof t=="object"&&(t=Bt(Ot(t,e),e)),t}function fz(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=B_(Bt(t,n),Bt(e,n),n,!0);return n.skipEscape=!0,Ot(o,n)}function B_(t,e,r,n){let o={};return n||(t=Bt(Ot(t,r),r),e=Bt(Ot(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=_i(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=_i(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=_i(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=_i(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function mz(t,e,r){return typeof t=="string"?(t=unescape(t),t=Ot(Is(Bt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Ot(Is(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Ot(Is(Bt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Ot(Is(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Ot(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=Y_(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=cz(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=_i(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var hz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Bt(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(hz);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(uz(n.host)===!1){let c=sz(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=Y_(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&lz(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Jp={SCHEMES:dz,normalize:pz,resolve:fz,resolveComponent:B_,equal:mz,serialize:Ot,parse:Bt};zs.exports=Jp;zs.exports.default=Jp;zs.exports.fastUri=Jp});var ey=I(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var Q_=X_();Q_.code='require("ajv/dist/runtime/uri").default';Hp.default=Q_});var cy=I(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.CodeGen=Ee.Name=Ee.nil=Ee.stringify=Ee.str=Ee._=Ee.KeywordCxt=void 0;var gz=gi();Object.defineProperty(Ee,"KeywordCxt",{enumerable:!0,get:function(){return gz.KeywordCxt}});var zn=H();Object.defineProperty(Ee,"_",{enumerable:!0,get:function(){return zn._}});Object.defineProperty(Ee,"str",{enumerable:!0,get:function(){return zn.str}});Object.defineProperty(Ee,"stringify",{enumerable:!0,get:function(){return zn.stringify}});Object.defineProperty(Ee,"nil",{enumerable:!0,get:function(){return zn.nil}});Object.defineProperty(Ee,"Name",{enumerable:!0,get:function(){return zn.Name}});Object.defineProperty(Ee,"CodeGen",{enumerable:!0,get:function(){return zn.CodeGen}});var vz=xs(),iy=vi(),_z=xp(),yi=ks(),yz=H(),$i=fi(),Ps=pi(),Kp=te(),ty=Z_(),$z=ey(),ay=(t,e)=>new RegExp(t,e);ay.code="new RegExp";var bz=["removeAdditional","useDefaults","coerceTypes"],xz=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Sz={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."},kz={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},ry=200;function wz(t){var e,r,n,o,i,a,s,c,u,l,d,p,f,h,g,$,k,S,x,N,T,Ve,We,Vn,Vr;let ye=t.strict,rr=(e=t.code)===null||e===void 0?void 0:e.optimize,ht=rr===!0||rr===void 0?1:rr||0,Wn=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:ay,Nb=(o=t.uriResolver)!==null&&o!==void 0?o:$z.default;return{strictSchema:(a=(i=t.strictSchema)!==null&&i!==void 0?i:ye)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=t.strictNumbers)!==null&&s!==void 0?s:ye)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:ye)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:ye)!==null&&p!==void 0?p:"log",strictRequired:(h=(f=t.strictRequired)!==null&&f!==void 0?f:ye)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:ht,regExp:Wn}:{optimize:ht,regExp:Wn},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:ry,loopEnum:($=t.loopEnum)!==null&&$!==void 0?$:ry,meta:(k=t.meta)!==null&&k!==void 0?k:!0,messages:(S=t.messages)!==null&&S!==void 0?S:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(N=t.schemaId)!==null&&N!==void 0?N:"$id",addUsedSchema:(T=t.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(Ve=t.validateSchema)!==null&&Ve!==void 0?Ve:!0,validateFormats:(We=t.validateFormats)!==null&&We!==void 0?We:!0,unicodeRegExp:(Vn=t.unicodeRegExp)!==null&&Vn!==void 0?Vn:!0,int32range:(Vr=t.int32range)!==null&&Vr!==void 0?Vr:!0,uriResolver:Nb}}var bi=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...wz(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new yz.ValueScope({scope:{},prefixes:xz,es5:r,lines:n}),this.logger=Oz(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,_z.getRules)(),ny.call(this,Sz,e,"NOT SUPPORTED"),ny.call(this,kz,e,"DEPRECATED","warn"),this._metaOpts=Pz.call(this),e.formats&&Iz.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&zz.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Ez.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=ty;n==="id"&&(o={...ty},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,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,e,r);async function o(l,d){await i.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||a.call(this,p)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof iy.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({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 i.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(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let a of e)this.addSchema(a,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:a}=this.opts;if(i=e[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,$i.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$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,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=oy.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new yi.SchemaEnv({schema:{},schemaId:n});if(r=yi.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=oy.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,$i.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,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(Dz.call(this,n,r),!r)return(0,Kp.eachItem)(n,i=>Gp.call(this,i)),this;Mz.call(this,r);let o={...r,type:(0,Ps.getJSONTypes)(r.type),schemaType:(0,Ps.getJSONTypes)(r.schemaType)};return(0,Kp.eachItem)(n,o.type.length===0?i=>Gp.call(this,i,o):i=>o.type.forEach(a=>Gp.call(this,i,o,a))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),a=e;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=sy(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e=="object")a=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,$i.normalizeId)(a||n);let u=$i.getSchemaRefs.call(this,e,n);return c=new yi.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):yi.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{yi.compileSchema.call(this,e)}finally{this.opts=r}}};bi.ValidationError=vz.default;bi.MissingRefError=iy.default;Ee.default=bi;function ny(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function oy(t){return t=(0,$i.normalizeId)(t),this.schemas[t]||this.refs[t]}function Ez(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Iz(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function zz(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function Pz(){let t={...this.opts};for(let e of bz)delete t[e];return t}var Tz={log(){},warn(){},error(){}};function Oz(t){if(t===!1)return Tz;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var jz=/^[a-z_$][a-z0-9_$:-]*$/i;function Dz(t,e){let{RULES:r}=this;if((0,Kp.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!jz.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Gp(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,Ps.getJSONTypes)(e.type),schemaType:(0,Ps.getJSONTypes)(e.schemaType)}};e.before?Nz.call(this,a,s,e.before):a.rules.push(s),i.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Nz(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Mz(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=sy(e)),t.validateSchema=this.compile(e,!0))}var Rz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function sy(t){return{anyOf:[t,Rz]}}});var uy=I(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});var Az={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Yp.default=Az});var fy=I(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.callRef=Ur.getValidate=void 0;var Cz=vi(),ly=ut(),Ye=H(),Pn=Kt(),dy=ks(),Ts=te(),Uz={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=dy.resolveRef.call(c,u,o,r);if(l===void 0)throw new Cz.default(n.opts.uriResolver,o,r);if(l instanceof dy.SchemaEnv)return p(l);return f(l);function d(){if(i===u)return Os(t,a,i,i.$async);let h=e.scopeValue("root",{ref:u});return Os(t,(0,Ye._)`${h}.validate`,u,u.$async)}function p(h){let g=py(t,h);Os(t,g,h,h.$async)}function f(h){let g=e.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Ye.stringify)(h)}:{ref:h}),$=e.name("valid"),k=t.subschema({schema:h,dataTypes:[],schemaPath:Ye.nil,topSchemaRef:g,errSchemaPath:r},$);t.mergeEvaluated(k),t.ok($)}}};function py(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Ye._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Ur.getValidate=py;function Os(t,e,r,n){let{gen:o,it:i}=t,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?Pn.default.this:Ye.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0,Ye._)`await ${(0,ly.callValidateCode)(t,e,u)}`),f(e),a||o.assign(h,!0)},g=>{o.if((0,Ye._)`!(${g} instanceof ${i.ValidationError})`,()=>o.throw(g)),p(g),a||o.assign(h,!1)}),t.ok(h)}function d(){t.result((0,ly.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(h){let g=(0,Ye._)`${h}.errors`;o.assign(Pn.default.vErrors,(0,Ye._)`${Pn.default.vErrors} === null ? ${g} : ${Pn.default.vErrors}.concat(${g})`),o.assign(Pn.default.errors,(0,Ye._)`${Pn.default.vErrors}.length`)}function f(h){var g;if(!i.opts.unevaluated)return;let $=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(i.props=Ts.mergeEvaluated.props(o,$.props,i.props));else{let k=o.var("props",(0,Ye._)`${h}.evaluated.props`);i.props=Ts.mergeEvaluated.props(o,k,i.props,Ye.Name)}if(i.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(i.items=Ts.mergeEvaluated.items(o,$.items,i.items));else{let k=o.var("items",(0,Ye._)`${h}.evaluated.items`);i.items=Ts.mergeEvaluated.items(o,k,i.items,Ye.Name)}}}Ur.callRef=Os;Ur.default=Uz});var my=I(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var Zz=uy(),Lz=fy(),Fz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Zz.default,Lz.default];Bp.default=Fz});var hy=I(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var js=H(),$r=js.operators,Ds={maximum:{okStr:"<=",ok:$r.LTE,fail:$r.GT},minimum:{okStr:">=",ok:$r.GTE,fail:$r.LT},exclusiveMaximum:{okStr:"<",ok:$r.LT,fail:$r.GTE},exclusiveMinimum:{okStr:">",ok:$r.GT,fail:$r.LTE}},qz={message:({keyword:t,schemaCode:e})=>(0,js.str)`must be ${Ds[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,js._)`{comparison: ${Ds[t].okStr}, limit: ${e}}`},Vz={keyword:Object.keys(Ds),type:"number",schemaType:"number",$data:!0,error:qz,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,js._)`${r} ${Ds[e].fail} ${n} || isNaN(${r})`)}};Xp.default=Vz});var gy=I(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var xi=H(),Wz={message:({schemaCode:t})=>(0,xi.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,xi._)`{multipleOf: ${t}}`},Jz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Wz,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,a=e.let("res"),s=i?(0,xi._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,xi._)`${a} !== parseInt(${a})`;t.fail$data((0,xi._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Qp.default=Jz});var _y=I(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});function vy(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}ef.default=vy;vy.code='require("ajv/dist/runtime/ucs2length").default'});var yy=I(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var Zr=H(),Hz=te(),Gz=_y(),Kz={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Zr.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Zr._)`{limit: ${t}}`},Yz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Kz,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?Zr.operators.GT:Zr.operators.LT,a=o.opts.unicode===!1?(0,Zr._)`${r}.length`:(0,Zr._)`${(0,Hz.useFunc)(t.gen,Gz.default)}(${r})`;t.fail$data((0,Zr._)`${a} ${i} ${n}`)}};tf.default=Yz});var $y=I(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var Bz=ut(),Xz=te(),Tn=H(),Qz={message:({schemaCode:t})=>(0,Tn.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Tn._)`{pattern: ${t}}`},eP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Qz,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,Tn._)`new RegExp`:(0,Xz.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Tn._)`${u}(${i}, ${s}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Tn._)`!${l}`)}else{let c=(0,Bz.usePattern)(t,o);t.fail$data((0,Tn._)`!${c}.test(${r})`)}}};rf.default=eP});var by=I(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var Si=H(),tP={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Si.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Si._)`{limit: ${t}}`},rP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:tP,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Si.operators.GT:Si.operators.LT;t.fail$data((0,Si._)`Object.keys(${r}).length ${o} ${n}`)}};nf.default=rP});var xy=I(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var ki=ut(),wi=H(),nP=te(),oP={message:({params:{missingProperty:t}})=>(0,wi.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,wi._)`{missingProperty: ${t}}`},iP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:oP,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:a}=t,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let f=t.parentSchema.properties,{definedProperties:h}=t.it;for(let g of r)if(f?.[g]===void 0&&!h.has(g)){let $=a.schemaEnv.baseId+a.errSchemaPath,k=`required property "${g}" is not defined at "${$}" (strictRequired)`;(0,nP.checkStrictMode)(a,k,a.opts.strictRequired)}}function u(){if(c||i)t.block$data(wi.nil,d);else for(let f of r)(0,ki.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||i){let h=e.let("valid",!0);t.block$data(h,()=>p(f,h)),t.ok(h)}else e.if((0,ki.checkMissingProp)(t,r,f)),(0,ki.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,ki.noPropertyInData)(e,o,f,s.ownProperties),()=>t.error())})}function p(f,h){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(h,(0,ki.propertyInData)(e,o,f,s.ownProperties)),e.if((0,wi.not)(h),()=>{t.error(),e.break()})},wi.nil)}}};of.default=iP});var Sy=I(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});var Ei=H(),aP={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Ei.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Ei._)`{limit: ${t}}`},sP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:aP,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Ei.operators.GT:Ei.operators.LT;t.fail$data((0,Ei._)`${r}.length ${o} ${n}`)}};af.default=sP});var Ns=I(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var ky=Tp();ky.code='require("ajv/dist/runtime/equal").default';sf.default=ky});var wy=I(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var cf=pi(),Ie=H(),cP=te(),uP=Ns(),lP={message:({params:{i:t,j:e}})=>(0,Ie.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Ie._)`{i: ${t}, j: ${e}}`},dP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:lP,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,cf.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Ie._)`${a} === false`),t.ok(c);function l(){let h=e.let("i",(0,Ie._)`${r}.length`),g=e.let("j");t.setParams({i:h,j:g}),e.assign(c,!0),e.if((0,Ie._)`${h} > 1`,()=>(d()?p:f)(h,g))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,g){let $=e.name("item"),k=(0,cf.checkDataTypes)(u,$,s.opts.strictNumbers,cf.DataType.Wrong),S=e.const("indices",(0,Ie._)`{}`);e.for((0,Ie._)`;${h}--;`,()=>{e.let($,(0,Ie._)`${r}[${h}]`),e.if(k,(0,Ie._)`continue`),u.length>1&&e.if((0,Ie._)`typeof ${$} == "string"`,(0,Ie._)`${$} += "_"`),e.if((0,Ie._)`typeof ${S}[${$}] == "number"`,()=>{e.assign(g,(0,Ie._)`${S}[${$}]`),t.error(),e.assign(c,!1).break()}).code((0,Ie._)`${S}[${$}] = ${h}`)})}function f(h,g){let $=(0,cP.useFunc)(e,uP.default),k=e.name("outer");e.label(k).for((0,Ie._)`;${h}--;`,()=>e.for((0,Ie._)`${g} = ${h}; ${g}--;`,()=>e.if((0,Ie._)`${$}(${r}[${h}], ${r}[${g}])`,()=>{t.error(),e.assign(c,!1).break(k)})))}}};uf.default=dP});var Ey=I(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var lf=H(),pP=te(),fP=Ns(),mP={message:"must be equal to constant",params:({schemaCode:t})=>(0,lf._)`{allowedValue: ${t}}`},hP={keyword:"const",$data:!0,error:mP,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,lf._)`!${(0,pP.useFunc)(e,fP.default)}(${r}, ${o})`):t.fail((0,lf._)`${i} !== ${r}`)}};df.default=hP});var Iy=I(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});var Ii=H(),gP=te(),vP=Ns(),_P={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Ii._)`{allowedValues: ${t}}`},yP={keyword:"enum",schemaType:"array",$data:!0,error:_P,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,gP.useFunc)(e,vP.default)),l;if(s||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=e.const("vSchema",i);l=(0,Ii.or)(...o.map((h,g)=>p(f,g)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,f=>e.if((0,Ii._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,h){let g=o[h];return typeof g=="object"&&g!==null?(0,Ii._)`${u()}(${r}, ${f}[${h}])`:(0,Ii._)`${r} === ${g}`}}};pf.default=yP});var zy=I(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});var $P=hy(),bP=gy(),xP=yy(),SP=$y(),kP=by(),wP=xy(),EP=Sy(),IP=wy(),zP=Ey(),PP=Iy(),TP=[$P.default,bP.default,xP.default,SP.default,kP.default,wP.default,EP.default,IP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},zP.default,PP.default];ff.default=TP});var hf=I(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.validateAdditionalItems=void 0;var Lr=H(),mf=te(),OP={message:({params:{len:t}})=>(0,Lr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Lr._)`{limit: ${t}}`},jP={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:OP,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,mf.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Py(t,n)}};function Py(t,e){let{gen:r,schema:n,data:o,keyword:i,it:a}=t;a.items=!0;let s=r.const("len",(0,Lr._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Lr._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,mf.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Lr._)`${s} <= ${e.length}`);r.if((0,Lr.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,s,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:mf.Type.Num},u),a.allErrors||r.if((0,Lr.not)(u),()=>r.break())})}}zi.validateAdditionalItems=Py;zi.default=jP});var gf=I(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.validateTuple=void 0;var Ty=H(),Ms=te(),DP=ut(),NP={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Oy(t,"additionalItems",e);r.items=!0,!(0,Ms.alwaysValidSchema)(r,e)&&t.ok((0,DP.validateArray)(t))}};function Oy(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=t;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=Ms.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,Ty._)`${i}.length`);r.forEach((d,p)=>{(0,Ms.alwaysValidSchema)(s,d)||(n.if((0,Ty._)`${u} > ${p}`,()=>t.subschema({keyword:a,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=s,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(p.strictTuples&&!g){let $=`"${a}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,Ms.checkStrictMode)(s,$,p.strictTuples)}}}Pi.validateTuple=Oy;Pi.default=NP});var jy=I(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var MP=gf(),RP={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,MP.validateTuple)(t,"items")};vf.default=RP});var Ny=I(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var Dy=H(),AP=te(),CP=ut(),UP=hf(),ZP={message:({params:{len:t}})=>(0,Dy.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Dy._)`{limit: ${t}}`},LP={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:ZP,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,AP.alwaysValidSchema)(n,e)&&(o?(0,UP.validateAdditionalItems)(t,o):t.ok((0,CP.validateArray)(t)))}};_f.default=LP});var My=I(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var dt=H(),Rs=te(),FP={message:({params:{min:t,max:e}})=>e===void 0?(0,dt.str)`must contain at least ${t} valid item(s)`:(0,dt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,dt._)`{minContains: ${t}}`:(0,dt._)`{minContains: ${t}, maxContains: ${e}}`},qP={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:FP,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=e.const("len",(0,dt._)`${o}.length`);if(t.setParams({min:a,max:s}),s===void 0&&a===0){(0,Rs.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,Rs.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Rs.alwaysValidSchema)(i,r)){let g=(0,dt._)`${l} >= ${a}`;s!==void 0&&(g=(0,dt._)`${g} && ${l} <= ${s}`),t.pass(g);return}i.items=!0;let d=e.name("valid");s===void 0&&a===1?f(d,()=>e.if(d,()=>e.break())):a===0?(e.let(d,!0),s!==void 0&&e.if((0,dt._)`${o}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let g=e.name("_valid"),$=e.let("count",0);f(g,()=>e.if(g,()=>h($)))}function f(g,$){e.forRange("i",0,l,k=>{t.subschema({keyword:"contains",dataProp:k,dataPropType:Rs.Type.Num,compositeRule:!0},g),$()})}function h(g){e.code((0,dt._)`${g}++`),s===void 0?e.if((0,dt._)`${g} >= ${a}`,()=>e.assign(d,!0).break()):(e.if((0,dt._)`${g} > ${s}`,()=>e.assign(d,!1).break()),a===1?e.assign(d,!0):e.if((0,dt._)`${g} >= ${a}`,()=>e.assign(d,!0)))}}};yf.default=qP});var Cy=I(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.validateSchemaDeps=jt.validatePropertyDeps=jt.error=void 0;var $f=H(),VP=te(),Ti=ut();jt.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,$f.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,$f._)`{property: ${t},
|
|
7
7
|
missingProperty: ${n},
|
|
8
8
|
depsCount: ${e},
|
|
9
|
-
deps: ${r}}`};var ZP={keyword:"dependencies",type:"object",schemaType:"object",error:Ot.error,code(t){let[e,r]=LP(t);Ny(t,e),My(t,r)}};function LP({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function Ny(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let a in e){let s=e[a];if(s.length===0)continue;let c=(0,Pi.propertyInData)(r,n,a,o.opts.ownProperties);t.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,Pi.checkReportMissingProp)(t,u)}):(r.if((0,_f._)`${c} && (${(0,Pi.checkMissingProp)(t,s,i)})`),(0,Pi.reportMissingProp)(t,i),r.else())}}Ot.validatePropertyDeps=Ny;function My(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,a=r.name("valid");for(let s in e)(0,UP.alwaysValidSchema)(i,e[s])||(r.if((0,Pi.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:s},a);t.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),t.ok(a))}Ot.validateSchemaDeps=My;Ot.default=ZP});var Cy=I(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var Ay=H(),FP=te(),qP={message:"property name must be valid",params:({params:t})=>(0,Ay._)`{propertyName: ${t.propertyName}}`},VP={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:qP,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,FP.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),e.if((0,Ay.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};yf.default=VP});var bf=I($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});var Rs=ut(),bt=H(),WP=Gt(),As=te(),JP={message:"must NOT have additional properties",params:({params:t})=>(0,bt._)`{additionalProperty: ${t.additionalProperty}}`},HP={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:JP,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,As.alwaysValidSchema)(a,r))return;let u=(0,Rs.allSchemaProperties)(n.properties),l=(0,Rs.allSchemaProperties)(n.patternProperties);d(),t.ok((0,bt._)`${i} === ${WP.default.errors}`);function d(){e.forIn("key",o,$=>{!u.length&&!l.length?h($):e.if(p($),()=>h($))})}function p($){let k;if(u.length>8){let S=(0,As.schemaRefOrVal)(a,n.properties,"properties");k=(0,Rs.isOwnProperty)(e,S,$)}else u.length?k=(0,bt.or)(...u.map(S=>(0,bt._)`${$} === ${S}`)):k=bt.nil;return l.length&&(k=(0,bt.or)(k,...l.map(S=>(0,bt._)`${(0,Rs.usePattern)(t,S)}.test(${$})`))),(0,bt.not)(k)}function f($){e.code((0,bt._)`delete ${o}[${$}]`)}function h($){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f($);return}if(r===!1){t.setParams({additionalProperty:$}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,As.alwaysValidSchema)(a,r)){let k=e.name("valid");c.removeAdditional==="failing"?(g($,k,!1),e.if((0,bt.not)(k),()=>{t.reset(),f($)})):(g($,k),s||e.if((0,bt.not)(k),()=>e.break()))}}function g($,k,S){let x={keyword:"additionalProperties",dataProp:$,dataPropType:As.Type.Str};S===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,k)}}};$f.default=HP});var Ly=I(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});var GP=hi(),Uy=ut(),xf=te(),Zy=bf(),KP={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Zy.default.code(new GP.KeywordCxt(i,Zy.default,"additionalProperties"));let a=(0,Uy.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=xf.mergeEvaluated.props(e,(0,xf.toHash)(a),i.props));let s=a.filter(d=>!(0,xf.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=e.name("valid");for(let d of s)u(d)?l(d):(e.if((0,Uy.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Sf.default=KP});var Wy=I(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});var Fy=ut(),Cs=H(),qy=te(),Vy=te(),YP={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:a}=i,s=(0,Fy.allSchemaProperties)(r),c=s.filter(g=>(0,qy.alwaysValidSchema)(i,r[g]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof Cs.Name)&&(i.props=(0,Vy.evaluatedPropsToName)(e,i.props));let{props:d}=i;p();function p(){for(let g of s)u&&f(g),i.allErrors?h(g):(e.var(l,!0),h(g),e.if(l))}function f(g){for(let $ in u)new RegExp(g).test($)&&(0,qy.checkStrictMode)(i,`property ${$} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){e.forIn("key",n,$=>{e.if((0,Cs._)`${(0,Fy.usePattern)(t,g)}.test(${$})`,()=>{let k=c.includes(g);k||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:$,dataPropType:Vy.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,Cs._)`${d}[${$}]`,!0):!k&&!i.allErrors&&e.if((0,Cs.not)(l),()=>e.break())})})}}};kf.default=YP});var Jy=I(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});var BP=te(),XP={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,BP.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};wf.default=XP});var Hy=I(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});var QP=ut(),eT={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:QP.validateUnion,error:{message:"must match a schema in anyOf"}};Ef.default=eT});var Gy=I(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});var Us=H(),tT=te(),rT={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Us._)`{passingSchemas: ${t.passing}}`},nT={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:rT,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=e.let("valid",!1),s=e.let("passing",null),c=e.name("_valid");t.setParams({passing:s}),e.block(u),t.result(a,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let p;(0,tT.alwaysValidSchema)(o,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Us._)`${c} && ${a}`).assign(a,!1).assign(s,(0,Us._)`[${s}, ${d}]`).else(),e.if(c,()=>{e.assign(a,!0),e.assign(s,d),p&&t.mergeEvaluated(p,Us.Name)})})}}};If.default=nT});var Ky=I(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});var oT=te(),iT={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,a)=>{if((0,oT.alwaysValidSchema)(n,i))return;let s=t.subschema({keyword:"allOf",schemaProp:a},o);t.ok(o),t.mergeEvaluated(s)})}};zf.default=iT});var Xy=I(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});var Zs=H(),By=te(),aT={message:({params:t})=>(0,Zs.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Zs._)`{failingKeyword: ${t.ifClause}}`},sT={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:aT,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,By.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Yy(n,"then"),i=Yy(n,"else");if(!o&&!i)return;let a=e.let("valid",!0),s=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(s,u("then",l),u("else",l))}else o?e.if(s,u("then")):e.if((0,Zs.not)(s),u("else"));t.pass(a,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},s);e.assign(a,s),t.mergeValidEvaluated(p,a),d?e.assign(d,(0,Zs._)`${l}`):t.setParams({ifClause:l})}}}};function Yy(t,e){let r=t.schema[e];return r!==void 0&&!(0,By.alwaysValidSchema)(t,r)}Pf.default=sT});var Qy=I(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});var cT=te(),uT={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,cT.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Tf.default=uT});var e$=I(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});var lT=ff(),dT=Ty(),pT=mf(),fT=jy(),mT=Dy(),hT=Ry(),gT=Cy(),vT=bf(),_T=Ly(),yT=Wy(),$T=Jy(),bT=Hy(),xT=Gy(),ST=Ky(),kT=Xy(),wT=Qy();function ET(t=!1){let e=[$T.default,bT.default,xT.default,ST.default,kT.default,wT.default,gT.default,vT.default,hT.default,_T.default,yT.default];return t?e.push(dT.default,fT.default):e.push(lT.default,pT.default),e.push(mT.default),e}Of.default=ET});var t$=I(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});var ve=H(),IT={message:({schemaCode:t})=>(0,ve.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ve._)`{format: ${t}}`},zT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:IT,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?p():f();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,ve._)`${h}[${a}]`),$=r.let("fType"),k=r.let("format");r.if((0,ve._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign($,(0,ve._)`${g}.type || "string"`).assign(k,(0,ve._)`${g}.validate`),()=>r.assign($,(0,ve._)`"string"`).assign(k,g)),t.fail$data((0,ve.or)(S(),x()));function S(){return c.strictSchema===!1?ve.nil:(0,ve._)`${a} && !${k}`}function x(){let N=l.$async?(0,ve._)`(${g}.async ? await ${k}(${n}) : ${k}(${n}))`:(0,ve._)`${k}(${n})`,T=(0,ve._)`(typeof ${k} == "function" ? ${N} : ${k}.test(${n}))`;return(0,ve._)`${k} && ${k} !== true && ${$} === ${e} && !${T}`}}function f(){let h=d.formats[i];if(!h){S();return}if(h===!0)return;let[g,$,k]=x(h);g===e&&t.pass(N());function S(){if(c.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function x(T){let Ve=T instanceof RegExp?(0,ve.regexpCode)(T):c.code.formats?(0,ve._)`${c.code.formats}${(0,ve.getProperty)(i)}`:void 0,We=r.scopeValue("formats",{key:i,ref:T,code:Ve});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,ve._)`${We}.validate`]:["string",T,We]}function N(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ve._)`await ${k}(${n})`}return typeof $=="function"?(0,ve._)`${k}(${n})`:(0,ve._)`${k}.test(${n})`}}}};jf.default=zT});var r$=I(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});var PT=t$(),TT=[PT.default];Df.default=TT});var n$=I(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.contentVocabulary=Tn.metadataVocabulary=void 0;Tn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Tn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var i$=I(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});var OT=py(),jT=Ey(),DT=e$(),NT=r$(),o$=n$(),MT=[OT.default,jT.default,(0,DT.default)(),NT.default,o$.metadataVocabulary,o$.contentVocabulary];Nf.default=MT});var s$=I(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.DiscrError=void 0;var a$;(function(t){t.Tag="tag",t.Mapping="mapping"})(a$||(Ls.DiscrError=a$={}))});var u$=I(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});var On=H(),Mf=s$(),c$=Ss(),RT=gi(),AT=te(),CT={message:({params:{discrError:t,tagName:e}})=>t===Mf.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,On._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},UT={keyword:"discriminator",type:"object",schemaType:"object",error:CT,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,On._)`${r}${(0,On.getProperty)(s)}`);e.if((0,On._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Mf.DiscrError.Tag,tag:u,tagName:s})),t.ok(c);function l(){let f=p();e.if(!1);for(let h in f)e.elseIf((0,On._)`${u} === ${h}`),e.assign(c,d(f[h]));e.else(),t.error(!1,{discrError:Mf.DiscrError.Mapping,tag:u,tagName:s}),e.endIf()}function d(f){let h=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:f},h);return t.mergeEvaluated(g,On.Name),h}function p(){var f;let h={},g=k(o),$=!0;for(let N=0;N<a.length;N++){let T=a[N];if(T?.$ref&&!(0,AT.schemaHasRulesButRef)(T,i.self.RULES)){let We=T.$ref;if(T=c$.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,We),T instanceof c$.SchemaEnv&&(T=T.schema),T===void 0)throw new RT.default(i.opts.uriResolver,i.baseId,We)}let Ve=(f=T?.properties)===null||f===void 0?void 0:f[s];if(typeof Ve!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);$=$&&(g||k(T)),S(Ve,N)}if(!$)throw new Error(`discriminator: "${s}" must be required`);return h;function k({required:N}){return Array.isArray(N)&&N.includes(s)}function S(N,T){if(N.const)x(N.const,T);else if(N.enum)for(let Ve of N.enum)x(Ve,T);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function x(N,T){if(typeof N!="string"||N in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[N]=T}}}};Rf.default=UT});var l$=I((YZ,ZT)=>{ZT.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 Cf=I((ge,Af)=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.MissingRefError=ge.ValidationError=ge.CodeGen=ge.Name=ge.nil=ge.stringify=ge.str=ge._=ge.KeywordCxt=ge.Ajv=void 0;var LT=ay(),FT=i$(),qT=u$(),d$=l$(),VT=["/properties"],Fs="http://json-schema.org/draft-07/schema",jn=class extends LT.default{_addVocabularies(){super._addVocabularies(),FT.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(qT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(d$,VT):d$;this.addMetaSchema(e,Fs,!1),this.refs["http://json-schema.org/schema"]=Fs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Fs)?Fs:void 0)}};ge.Ajv=jn;Af.exports=ge=jn;Af.exports.Ajv=jn;Object.defineProperty(ge,"__esModule",{value:!0});ge.default=jn;var WT=hi();Object.defineProperty(ge,"KeywordCxt",{enumerable:!0,get:function(){return WT.KeywordCxt}});var Dn=H();Object.defineProperty(ge,"_",{enumerable:!0,get:function(){return Dn._}});Object.defineProperty(ge,"str",{enumerable:!0,get:function(){return Dn.str}});Object.defineProperty(ge,"stringify",{enumerable:!0,get:function(){return Dn.stringify}});Object.defineProperty(ge,"nil",{enumerable:!0,get:function(){return Dn.nil}});Object.defineProperty(ge,"Name",{enumerable:!0,get:function(){return Dn.Name}});Object.defineProperty(ge,"CodeGen",{enumerable:!0,get:function(){return Dn.CodeGen}});var JT=bs();Object.defineProperty(ge,"ValidationError",{enumerable:!0,get:function(){return JT.default}});var HT=gi();Object.defineProperty(ge,"MissingRefError",{enumerable:!0,get:function(){return HT.default}})});var y$=I(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.formatNames=Dt.fastFormats=Dt.fullFormats=void 0;function jt(t,e){return{validate:t,compare:e}}Dt.fullFormats={date:jt(h$,Ff),time:jt(Zf(!0),qf),"date-time":jt(p$(!0),v$),"iso-time":jt(Zf(),g$),"iso-date-time":jt(p$(),_$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:QT,"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:aO,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:eO,int32:{type:"number",validate:nO},int64:{type:"number",validate:oO},float:{type:"number",validate:m$},double:{type:"number",validate:m$},password:!0,binary:!0};Dt.fastFormats={...Dt.fullFormats,date:jt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ff),time:jt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,qf),"date-time":jt(/^\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,v$),"iso-time":jt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,g$),"iso-date-time":jt(/^\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,_$),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};Dt.formatNames=Object.keys(Dt.fullFormats);function GT(t){return t%4===0&&(t%100!==0||t%400===0)}var KT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,YT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function h$(t){let e=KT.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&>(r)?29:YT[n])}function Ff(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Uf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Zf(t){return function(r){let n=Uf.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&a<61}}function qf(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function g$(t,e){if(!(t&&e))return;let r=Uf.exec(t),n=Uf.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var Lf=/t|\s/i;function p$(t){let e=Zf(t);return function(n){let o=n.split(Lf);return o.length===2&&h$(o[0])&&e(o[1])}}function v$(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function _$(t,e){if(!(t&&e))return;let[r,n]=t.split(Lf),[o,i]=e.split(Lf),a=Ff(r,o);if(a!==void 0)return a||qf(n,i)}var BT=/\/|:/,XT=/^(?:[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 QT(t){return BT.test(t)&&XT.test(t)}var f$=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function eO(t){return f$.lastIndex=0,f$.test(t)}var tO=-(2**31),rO=2**31-1;function nO(t){return Number.isInteger(t)&&t<=rO&&t>=tO}function oO(t){return Number.isInteger(t)}function m$(){return!0}var iO=/[^\\]\\Z/;function aO(t){if(iO.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var $$=I(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.formatLimitDefinition=void 0;var sO=Cf(),xt=H(),br=xt.operators,qs={formatMaximum:{okStr:"<=",ok:br.LTE,fail:br.GT},formatMinimum:{okStr:">=",ok:br.GTE,fail:br.LT},formatExclusiveMaximum:{okStr:"<",ok:br.LT,fail:br.GTE},formatExclusiveMinimum:{okStr:">",ok:br.GT,fail:br.LTE}},cO={message:({keyword:t,schemaCode:e})=>(0,xt.str)`should be ${qs[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,xt._)`{comparison: ${qs[t].okStr}, limit: ${e}}`};Nn.formatLimitDefinition={keyword:Object.keys(qs),type:"string",schemaType:"string",$data:!0,error:cO,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new sO.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:s.formats,code:a.code.formats}),f=e.const("fmt",(0,xt._)`${p}[${c.schemaCode}]`);t.fail$data((0,xt.or)((0,xt._)`typeof ${f} != "object"`,(0,xt._)`${f} instanceof RegExp`,(0,xt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=s.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let h=e.scopeValue("formats",{key:p,ref:f,code:a.code.formats?(0,xt._)`${a.code.formats}${(0,xt.getProperty)(p)}`:void 0});t.fail$data(d(h))}function d(p){return(0,xt._)`${p}.compare(${r}, ${n}) ${qs[o].fail} 0`}},dependencies:["format"]};var uO=t=>(t.addKeyword(Nn.formatLimitDefinition),t);Nn.default=uO});var k$=I((Ti,S$)=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});var Mn=y$(),lO=$$(),Vf=H(),b$=new Vf.Name("fullFormats"),dO=new Vf.Name("fastFormats"),Wf=(t,e={keywords:!0})=>{if(Array.isArray(e))return x$(t,e,Mn.fullFormats,b$),t;let[r,n]=e.mode==="fast"?[Mn.fastFormats,dO]:[Mn.fullFormats,b$],o=e.formats||Mn.formatNames;return x$(t,o,r,n),e.keywords&&(0,lO.default)(t),t};Wf.get=(t,e="full")=>{let n=(e==="fast"?Mn.fastFormats:Mn.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function x$(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,Vf._)`require("ajv-formats/dist/formats").${n}`);for(let a of e)t.addFormat(a,r[a])}S$.exports=Ti=Wf;Object.defineProperty(Ti,"__esModule",{value:!0});Ti.default=Wf});var Mt=require("fs"),Jn=require("path"),$m=require("os"),ic=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(ic||{}),ym=(0,Jn.join)((0,$m.homedir)(),".claude-mem"),ac=class{level=null;useColor;logFilePath=null;logFileInitialized=!1;constructor(){this.useColor=process.stdout.isTTY??!1}ensureLogFileInitialized(){if(!this.logFileInitialized){this.logFileInitialized=!0;try{let e=(0,Jn.join)(ym,"logs");(0,Mt.existsSync)(e)||(0,Mt.mkdirSync)(e,{recursive:!0});let r=new Date().toISOString().split("T")[0];this.logFilePath=(0,Jn.join)(e,`claude-mem-${r}.log`)}catch(e){console.error("[LOGGER] Failed to initialize log file:",e instanceof Error?e.message:String(e)),this.logFilePath=null}}}getLevel(){if(this.level===null)try{let e=(0,Jn.join)(ym,"settings.json");if((0,Mt.existsSync)(e)){let r=(0,Mt.readFileSync)(e,"utf-8"),o=(JSON.parse(r).CLAUDE_MEM_LOG_LEVEL||"INFO").toUpperCase();this.level=ic[o]??1}else this.level=1}catch(e){console.error("[LOGGER] Failed to load log level from settings:",e instanceof Error?e.message:String(e)),this.level=1}return this.level}correlationId(e,r){return`obs-${e}-${r}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message}
|
|
10
|
-
${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Object.keys(e);return r.length===0?"{}":r.length<=3?JSON.stringify(e):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,r){if(!r)return e;let n=r;if(typeof r=="string")try{n=JSON.parse(r)}catch{n=r}if(e==="Bash"&&n.command)return`${e}(${n.command})`;if(n.file_path)return`${e}(${n.file_path})`;if(n.notebook_path)return`${e}(${n.notebook_path})`;if(e==="Glob"&&n.pattern)return`${e}(${n.pattern})`;if(e==="Grep"&&n.pattern)return`${e}(${n.pattern})`;if(n.url)return`${e}(${n.url})`;if(n.query)return`${e}(${n.query})`;if(e==="Task"){if(n.subagent_type)return`${e}(${n.subagent_type})`;if(n.description)return`${e}(${n.description})`}return e==="Skill"&&n.skill?`${e}(${n.skill})`:e==="LSP"&&n.operation?`${e}(${n.operation})`:e}formatTimestamp(e){let r=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),s=String(e.getSeconds()).padStart(2,"0"),c=String(e.getMilliseconds()).padStart(3,"0");return`${r}-${n}-${o} ${i}:${a}:${s}.${c}`}log(e,r,n,o,i){if(e<this.getLevel())return;this.ensureLogFileInitialized();let a=this.formatTimestamp(new Date),s=
|
|
9
|
+
deps: ${r}}`};var WP={keyword:"dependencies",type:"object",schemaType:"object",error:jt.error,code(t){let[e,r]=JP(t);Ry(t,e),Ay(t,r)}};function JP({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function Ry(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let a in e){let s=e[a];if(s.length===0)continue;let c=(0,Ti.propertyInData)(r,n,a,o.opts.ownProperties);t.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,Ti.checkReportMissingProp)(t,u)}):(r.if((0,$f._)`${c} && (${(0,Ti.checkMissingProp)(t,s,i)})`),(0,Ti.reportMissingProp)(t,i),r.else())}}jt.validatePropertyDeps=Ry;function Ay(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,a=r.name("valid");for(let s in e)(0,VP.alwaysValidSchema)(i,e[s])||(r.if((0,Ti.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:s},a);t.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),t.ok(a))}jt.validateSchemaDeps=Ay;jt.default=WP});var Zy=I(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});var Uy=H(),HP=te(),GP={message:"property name must be valid",params:({params:t})=>(0,Uy._)`{propertyName: ${t.propertyName}}`},KP={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:GP,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,HP.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),e.if((0,Uy.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};bf.default=KP});var Sf=I(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});var As=ut(),xt=H(),YP=Kt(),Cs=te(),BP={message:"must NOT have additional properties",params:({params:t})=>(0,xt._)`{additionalProperty: ${t.additionalProperty}}`},XP={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:BP,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,Cs.alwaysValidSchema)(a,r))return;let u=(0,As.allSchemaProperties)(n.properties),l=(0,As.allSchemaProperties)(n.patternProperties);d(),t.ok((0,xt._)`${i} === ${YP.default.errors}`);function d(){e.forIn("key",o,$=>{!u.length&&!l.length?h($):e.if(p($),()=>h($))})}function p($){let k;if(u.length>8){let S=(0,Cs.schemaRefOrVal)(a,n.properties,"properties");k=(0,As.isOwnProperty)(e,S,$)}else u.length?k=(0,xt.or)(...u.map(S=>(0,xt._)`${$} === ${S}`)):k=xt.nil;return l.length&&(k=(0,xt.or)(k,...l.map(S=>(0,xt._)`${(0,As.usePattern)(t,S)}.test(${$})`))),(0,xt.not)(k)}function f($){e.code((0,xt._)`delete ${o}[${$}]`)}function h($){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f($);return}if(r===!1){t.setParams({additionalProperty:$}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,Cs.alwaysValidSchema)(a,r)){let k=e.name("valid");c.removeAdditional==="failing"?(g($,k,!1),e.if((0,xt.not)(k),()=>{t.reset(),f($)})):(g($,k),s||e.if((0,xt.not)(k),()=>e.break()))}}function g($,k,S){let x={keyword:"additionalProperties",dataProp:$,dataPropType:Cs.Type.Str};S===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,k)}}};xf.default=XP});var qy=I(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});var QP=gi(),Ly=ut(),kf=te(),Fy=Sf(),eT={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Fy.default.code(new QP.KeywordCxt(i,Fy.default,"additionalProperties"));let a=(0,Ly.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=kf.mergeEvaluated.props(e,(0,kf.toHash)(a),i.props));let s=a.filter(d=>!(0,kf.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=e.name("valid");for(let d of s)u(d)?l(d):(e.if((0,Ly.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};wf.default=eT});var Hy=I(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});var Vy=ut(),Us=H(),Wy=te(),Jy=te(),tT={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:a}=i,s=(0,Vy.allSchemaProperties)(r),c=s.filter(g=>(0,Wy.alwaysValidSchema)(i,r[g]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof Us.Name)&&(i.props=(0,Jy.evaluatedPropsToName)(e,i.props));let{props:d}=i;p();function p(){for(let g of s)u&&f(g),i.allErrors?h(g):(e.var(l,!0),h(g),e.if(l))}function f(g){for(let $ in u)new RegExp(g).test($)&&(0,Wy.checkStrictMode)(i,`property ${$} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){e.forIn("key",n,$=>{e.if((0,Us._)`${(0,Vy.usePattern)(t,g)}.test(${$})`,()=>{let k=c.includes(g);k||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:$,dataPropType:Jy.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,Us._)`${d}[${$}]`,!0):!k&&!i.allErrors&&e.if((0,Us.not)(l),()=>e.break())})})}}};Ef.default=tT});var Gy=I(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});var rT=te(),nT={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,rT.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};If.default=nT});var Ky=I(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});var oT=ut(),iT={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:oT.validateUnion,error:{message:"must match a schema in anyOf"}};zf.default=iT});var Yy=I(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});var Zs=H(),aT=te(),sT={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Zs._)`{passingSchemas: ${t.passing}}`},cT={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:sT,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=e.let("valid",!1),s=e.let("passing",null),c=e.name("_valid");t.setParams({passing:s}),e.block(u),t.result(a,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let p;(0,aT.alwaysValidSchema)(o,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Zs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,Zs._)`[${s}, ${d}]`).else(),e.if(c,()=>{e.assign(a,!0),e.assign(s,d),p&&t.mergeEvaluated(p,Zs.Name)})})}}};Pf.default=cT});var By=I(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});var uT=te(),lT={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,a)=>{if((0,uT.alwaysValidSchema)(n,i))return;let s=t.subschema({keyword:"allOf",schemaProp:a},o);t.ok(o),t.mergeEvaluated(s)})}};Tf.default=lT});var e$=I(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});var Ls=H(),Qy=te(),dT={message:({params:t})=>(0,Ls.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ls._)`{failingKeyword: ${t.ifClause}}`},pT={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:dT,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,Qy.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Xy(n,"then"),i=Xy(n,"else");if(!o&&!i)return;let a=e.let("valid",!0),s=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(s,u("then",l),u("else",l))}else o?e.if(s,u("then")):e.if((0,Ls.not)(s),u("else"));t.pass(a,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},s);e.assign(a,s),t.mergeValidEvaluated(p,a),d?e.assign(d,(0,Ls._)`${l}`):t.setParams({ifClause:l})}}}};function Xy(t,e){let r=t.schema[e];return r!==void 0&&!(0,Qy.alwaysValidSchema)(t,r)}Of.default=pT});var t$=I(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});var fT=te(),mT={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,fT.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};jf.default=mT});var r$=I(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});var hT=hf(),gT=jy(),vT=gf(),_T=Ny(),yT=My(),$T=Cy(),bT=Zy(),xT=Sf(),ST=qy(),kT=Hy(),wT=Gy(),ET=Ky(),IT=Yy(),zT=By(),PT=e$(),TT=t$();function OT(t=!1){let e=[wT.default,ET.default,IT.default,zT.default,PT.default,TT.default,bT.default,xT.default,$T.default,ST.default,kT.default];return t?e.push(gT.default,_T.default):e.push(hT.default,vT.default),e.push(yT.default),e}Df.default=OT});var n$=I(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});var ve=H(),jT={message:({schemaCode:t})=>(0,ve.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ve._)`{format: ${t}}`},DT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:jT,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?p():f();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,ve._)`${h}[${a}]`),$=r.let("fType"),k=r.let("format");r.if((0,ve._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign($,(0,ve._)`${g}.type || "string"`).assign(k,(0,ve._)`${g}.validate`),()=>r.assign($,(0,ve._)`"string"`).assign(k,g)),t.fail$data((0,ve.or)(S(),x()));function S(){return c.strictSchema===!1?ve.nil:(0,ve._)`${a} && !${k}`}function x(){let N=l.$async?(0,ve._)`(${g}.async ? await ${k}(${n}) : ${k}(${n}))`:(0,ve._)`${k}(${n})`,T=(0,ve._)`(typeof ${k} == "function" ? ${N} : ${k}.test(${n}))`;return(0,ve._)`${k} && ${k} !== true && ${$} === ${e} && !${T}`}}function f(){let h=d.formats[i];if(!h){S();return}if(h===!0)return;let[g,$,k]=x(h);g===e&&t.pass(N());function S(){if(c.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function x(T){let Ve=T instanceof RegExp?(0,ve.regexpCode)(T):c.code.formats?(0,ve._)`${c.code.formats}${(0,ve.getProperty)(i)}`:void 0,We=r.scopeValue("formats",{key:i,ref:T,code:Ve});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,ve._)`${We}.validate`]:["string",T,We]}function N(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ve._)`await ${k}(${n})`}return typeof $=="function"?(0,ve._)`${k}(${n})`:(0,ve._)`${k}.test(${n})`}}}};Nf.default=DT});var o$=I(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});var NT=n$(),MT=[NT.default];Mf.default=MT});var i$=I(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.contentVocabulary=On.metadataVocabulary=void 0;On.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];On.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var s$=I(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});var RT=my(),AT=zy(),CT=r$(),UT=o$(),a$=i$(),ZT=[RT.default,AT.default,(0,CT.default)(),UT.default,a$.metadataVocabulary,a$.contentVocabulary];Rf.default=ZT});var u$=I(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.DiscrError=void 0;var c$;(function(t){t.Tag="tag",t.Mapping="mapping"})(c$||(Fs.DiscrError=c$={}))});var d$=I(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});var jn=H(),Af=u$(),l$=ks(),LT=vi(),FT=te(),qT={message:({params:{discrError:t,tagName:e}})=>t===Af.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,jn._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},VT={keyword:"discriminator",type:"object",schemaType:"object",error:qT,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,jn._)`${r}${(0,jn.getProperty)(s)}`);e.if((0,jn._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Af.DiscrError.Tag,tag:u,tagName:s})),t.ok(c);function l(){let f=p();e.if(!1);for(let h in f)e.elseIf((0,jn._)`${u} === ${h}`),e.assign(c,d(f[h]));e.else(),t.error(!1,{discrError:Af.DiscrError.Mapping,tag:u,tagName:s}),e.endIf()}function d(f){let h=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:f},h);return t.mergeEvaluated(g,jn.Name),h}function p(){var f;let h={},g=k(o),$=!0;for(let N=0;N<a.length;N++){let T=a[N];if(T?.$ref&&!(0,FT.schemaHasRulesButRef)(T,i.self.RULES)){let We=T.$ref;if(T=l$.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,We),T instanceof l$.SchemaEnv&&(T=T.schema),T===void 0)throw new LT.default(i.opts.uriResolver,i.baseId,We)}let Ve=(f=T?.properties)===null||f===void 0?void 0:f[s];if(typeof Ve!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);$=$&&(g||k(T)),S(Ve,N)}if(!$)throw new Error(`discriminator: "${s}" must be required`);return h;function k({required:N}){return Array.isArray(N)&&N.includes(s)}function S(N,T){if(N.const)x(N.const,T);else if(N.enum)for(let Ve of N.enum)x(Ve,T);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function x(N,T){if(typeof N!="string"||N in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[N]=T}}}};Cf.default=VT});var p$=I((rL,WT)=>{WT.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 Zf=I((ge,Uf)=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.MissingRefError=ge.ValidationError=ge.CodeGen=ge.Name=ge.nil=ge.stringify=ge.str=ge._=ge.KeywordCxt=ge.Ajv=void 0;var JT=cy(),HT=s$(),GT=d$(),f$=p$(),KT=["/properties"],qs="http://json-schema.org/draft-07/schema",Dn=class extends JT.default{_addVocabularies(){super._addVocabularies(),HT.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(GT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(f$,KT):f$;this.addMetaSchema(e,qs,!1),this.refs["http://json-schema.org/schema"]=qs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(qs)?qs:void 0)}};ge.Ajv=Dn;Uf.exports=ge=Dn;Uf.exports.Ajv=Dn;Object.defineProperty(ge,"__esModule",{value:!0});ge.default=Dn;var YT=gi();Object.defineProperty(ge,"KeywordCxt",{enumerable:!0,get:function(){return YT.KeywordCxt}});var Nn=H();Object.defineProperty(ge,"_",{enumerable:!0,get:function(){return Nn._}});Object.defineProperty(ge,"str",{enumerable:!0,get:function(){return Nn.str}});Object.defineProperty(ge,"stringify",{enumerable:!0,get:function(){return Nn.stringify}});Object.defineProperty(ge,"nil",{enumerable:!0,get:function(){return Nn.nil}});Object.defineProperty(ge,"Name",{enumerable:!0,get:function(){return Nn.Name}});Object.defineProperty(ge,"CodeGen",{enumerable:!0,get:function(){return Nn.CodeGen}});var BT=xs();Object.defineProperty(ge,"ValidationError",{enumerable:!0,get:function(){return BT.default}});var XT=vi();Object.defineProperty(ge,"MissingRefError",{enumerable:!0,get:function(){return XT.default}})});var b$=I(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.formatNames=Nt.fastFormats=Nt.fullFormats=void 0;function Dt(t,e){return{validate:t,compare:e}}Nt.fullFormats={date:Dt(v$,Vf),time:Dt(Ff(!0),Wf),"date-time":Dt(m$(!0),y$),"iso-time":Dt(Ff(),_$),"iso-date-time":Dt(m$(),$$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:oO,"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:dO,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:iO,int32:{type:"number",validate:cO},int64:{type:"number",validate:uO},float:{type:"number",validate:g$},double:{type:"number",validate:g$},password:!0,binary:!0};Nt.fastFormats={...Nt.fullFormats,date:Dt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Vf),time:Dt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Wf),"date-time":Dt(/^\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,y$),"iso-time":Dt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,_$),"iso-date-time":Dt(/^\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,$$),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Nt.formatNames=Object.keys(Nt.fullFormats);function QT(t){return t%4===0&&(t%100!==0||t%400===0)}var eO=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,tO=[0,31,28,31,30,31,30,31,31,30,31,30,31];function v$(t){let e=eO.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&QT(r)?29:tO[n])}function Vf(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Lf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Ff(t){return function(r){let n=Lf.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&a<61}}function Wf(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function _$(t,e){if(!(t&&e))return;let r=Lf.exec(t),n=Lf.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var qf=/t|\s/i;function m$(t){let e=Ff(t);return function(n){let o=n.split(qf);return o.length===2&&v$(o[0])&&e(o[1])}}function y$(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function $$(t,e){if(!(t&&e))return;let[r,n]=t.split(qf),[o,i]=e.split(qf),a=Vf(r,o);if(a!==void 0)return a||Wf(n,i)}var rO=/\/|:/,nO=/^(?:[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 oO(t){return rO.test(t)&&nO.test(t)}var h$=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function iO(t){return h$.lastIndex=0,h$.test(t)}var aO=-(2**31),sO=2**31-1;function cO(t){return Number.isInteger(t)&&t<=sO&&t>=aO}function uO(t){return Number.isInteger(t)}function g$(){return!0}var lO=/[^\\]\\Z/;function dO(t){if(lO.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var x$=I(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.formatLimitDefinition=void 0;var pO=Zf(),St=H(),br=St.operators,Vs={formatMaximum:{okStr:"<=",ok:br.LTE,fail:br.GT},formatMinimum:{okStr:">=",ok:br.GTE,fail:br.LT},formatExclusiveMaximum:{okStr:"<",ok:br.LT,fail:br.GTE},formatExclusiveMinimum:{okStr:">",ok:br.GT,fail:br.LTE}},fO={message:({keyword:t,schemaCode:e})=>(0,St.str)`should be ${Vs[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,St._)`{comparison: ${Vs[t].okStr}, limit: ${e}}`};Mn.formatLimitDefinition={keyword:Object.keys(Vs),type:"string",schemaType:"string",$data:!0,error:fO,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new pO.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:s.formats,code:a.code.formats}),f=e.const("fmt",(0,St._)`${p}[${c.schemaCode}]`);t.fail$data((0,St.or)((0,St._)`typeof ${f} != "object"`,(0,St._)`${f} instanceof RegExp`,(0,St._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=s.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let h=e.scopeValue("formats",{key:p,ref:f,code:a.code.formats?(0,St._)`${a.code.formats}${(0,St.getProperty)(p)}`:void 0});t.fail$data(d(h))}function d(p){return(0,St._)`${p}.compare(${r}, ${n}) ${Vs[o].fail} 0`}},dependencies:["format"]};var mO=t=>(t.addKeyword(Mn.formatLimitDefinition),t);Mn.default=mO});var E$=I((Oi,w$)=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});var Rn=b$(),hO=x$(),Jf=H(),S$=new Jf.Name("fullFormats"),gO=new Jf.Name("fastFormats"),Hf=(t,e={keywords:!0})=>{if(Array.isArray(e))return k$(t,e,Rn.fullFormats,S$),t;let[r,n]=e.mode==="fast"?[Rn.fastFormats,gO]:[Rn.fullFormats,S$],o=e.formats||Rn.formatNames;return k$(t,o,r,n),e.keywords&&(0,hO.default)(t),t};Hf.get=(t,e="full")=>{let n=(e==="fast"?Rn.fastFormats:Rn.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function k$(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,Jf._)`require("ajv-formats/dist/formats").${n}`);for(let a of e)t.addFormat(a,r[a])}w$.exports=Oi=Hf;Object.defineProperty(Oi,"__esModule",{value:!0});Oi.default=Hf});var Rt=require("fs"),Hn=require("path"),xm=require("os"),sc=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(sc||{}),bm=(0,Hn.join)((0,xm.homedir)(),".claude-mem"),cc=class{level=null;useColor;logFilePath=null;logFileInitialized=!1;constructor(){this.useColor=process.stdout.isTTY??!1}ensureLogFileInitialized(){if(!this.logFileInitialized){this.logFileInitialized=!0;try{let e=(0,Hn.join)(bm,"logs");(0,Rt.existsSync)(e)||(0,Rt.mkdirSync)(e,{recursive:!0});let r=new Date().toISOString().split("T")[0];this.logFilePath=(0,Hn.join)(e,`claude-mem-${r}.log`)}catch(e){console.error("[LOGGER] Failed to initialize log file:",e instanceof Error?e.message:String(e)),this.logFilePath=null}}}getLevel(){if(this.level===null)try{let e=(0,Hn.join)(bm,"settings.json");if((0,Rt.existsSync)(e)){let r=(0,Rt.readFileSync)(e,"utf-8"),o=(JSON.parse(r).CLAUDE_MEM_LOG_LEVEL||"INFO").toUpperCase();this.level=sc[o]??1}else this.level=1}catch(e){console.error("[LOGGER] Failed to load log level from settings:",e instanceof Error?e.message:String(e)),this.level=1}return this.level}correlationId(e,r){return`obs-${e}-${r}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message}
|
|
10
|
+
${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Object.keys(e);return r.length===0?"{}":r.length<=3?JSON.stringify(e):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,r){if(!r)return e;let n=r;if(typeof r=="string")try{n=JSON.parse(r)}catch{n=r}if(e==="Bash"&&n.command)return`${e}(${n.command})`;if(n.file_path)return`${e}(${n.file_path})`;if(n.notebook_path)return`${e}(${n.notebook_path})`;if(e==="Glob"&&n.pattern)return`${e}(${n.pattern})`;if(e==="Grep"&&n.pattern)return`${e}(${n.pattern})`;if(n.url)return`${e}(${n.url})`;if(n.query)return`${e}(${n.query})`;if(e==="Task"){if(n.subagent_type)return`${e}(${n.subagent_type})`;if(n.description)return`${e}(${n.description})`}return e==="Skill"&&n.skill?`${e}(${n.skill})`:e==="LSP"&&n.operation?`${e}(${n.operation})`:e}formatTimestamp(e){let r=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),s=String(e.getSeconds()).padStart(2,"0"),c=String(e.getMilliseconds()).padStart(3,"0");return`${r}-${n}-${o} ${i}:${a}:${s}.${c}`}log(e,r,n,o,i){if(e<this.getLevel())return;this.ensureLogFileInitialized();let a=this.formatTimestamp(new Date),s=sc[e].padEnd(5),c=r.padEnd(6),u="";o?.correlationId?u=`[${o.correlationId}] `:o?.sessionId&&(u=`[session-${o.sessionId}] `);let l="";i!=null&&(i instanceof Error?l=this.getLevel()===0?`
|
|
11
11
|
${i.message}
|
|
12
12
|
${i.stack}`:` ${i.message}`:this.getLevel()===0&&typeof i=="object"?l=`
|
|
13
|
-
`+JSON.stringify(i,null,2):l=" "+this.formatData(i));let d="";if(o){let{sessionId:f,memorySessionId:h,correlationId:g,...$}=o;Object.keys($).length>0&&(d=` {${Object.entries($).map(([S,x])=>`${S}=${x}`).join(", ")}}`)}let p=`[${a}] [${s}] [${c}] ${u}${n}${d}${l}`;if(this.logFilePath)try{(0,
|
|
13
|
+
`+JSON.stringify(i,null,2):l=" "+this.formatData(i));let d="";if(o){let{sessionId:f,memorySessionId:h,correlationId:g,...$}=o;Object.keys($).length>0&&(d=` {${Object.entries($).map(([S,x])=>`${S}=${x}`).join(", ")}}`)}let p=`[${a}] [${s}] [${c}] ${u}${n}${d}${l}`;if(this.logFilePath)try{(0,Rt.appendFileSync)(this.logFilePath,p+`
|
|
14
14
|
`,"utf8")}catch(f){process.stderr.write(`[LOGGER] Failed to write to log file: ${f instanceof Error?f.message:String(f)}
|
|
15
15
|
`)}else process.stderr.write(p+`
|
|
16
16
|
`)}debug(e,r,n,o){this.log(0,e,r,n,o)}info(e,r,n,o){this.log(1,e,r,n,o)}warn(e,r,n,o){this.log(2,e,r,n,o)}error(e,r,n,o){this.log(3,e,r,n,o)}dataIn(e,r,n,o){this.info(e,`\u2192 ${r}`,n,o)}dataOut(e,r,n,o){this.info(e,`\u2190 ${r}`,n,o)}success(e,r,n,o){this.info(e,`\u2713 ${r}`,n,o)}failure(e,r,n,o){this.error(e,`\u2717 ${r}`,n,o)}timing(e,r,n,o){this.info(e,`\u23F1 ${r}`,o,{duration:`${n}ms`})}happyPathError(e,r,n,o,i=""){let u=((new Error().stack||"").split(`
|
|
17
|
-
`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),l=u?`${u[1].split("/").pop()}:${u[2]}`:"unknown",d={...n,location:l};return this.warn(e,`[HAPPY-PATH] ${r}`,d,o),i}},_=new ac;var X;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(X||(X={}));var bm;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(bm||(bm={}));var z=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rt=t=>{switch(typeof t){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(t)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(t)?z.array:t===null?z.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?z.promise:typeof Map<"u"&&t instanceof Map?z.map:typeof Set<"u"&&t instanceof Set?z.set:typeof Date<"u"&&t instanceof Date?z.date:z.object;default:return z.unknown}};var y=X.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var Be=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,X.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Be.create=t=>new Be(t);var Rb=(t,e)=>{let r;switch(t.code){case y.invalid_type:t.received===z.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,X.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:r=`Unrecognized key(s) in object: ${X.joinValues(t.keys,", ")}`;break;case y.invalid_union:r="Invalid input";break;case y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${X.joinValues(t.options)}`;break;case y.invalid_enum_value:r=`Invalid enum value. Expected ${X.joinValues(t.options)}, received '${t.received}'`;break;case y.invalid_arguments:r="Invalid function arguments";break;case y.invalid_return_type:r="Invalid function return type";break;case y.invalid_date:r="Invalid date";break;case y.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:X.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case y.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case y.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case y.custom:r="Invalid input";break;case y.invalid_intersection_types:r="Intersection results could not be merged";break;case y.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case y.not_finite:r="Number must be finite";break;default:r=e.defaultError,X.assertNever(t)}return{message:r}},nr=Rb;var Ab=nr;function Hn(){return Ab}var Zi=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};function w(t,e){let r=Hn(),n=Zi({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===nr?void 0:nr].filter(o=>!!o)});t.common.issues.push(n)}var Pe=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return C;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return C;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},C=Object.freeze({status:"aborted"}),Vr=t=>({status:"dirty",value:t}),Re=t=>({status:"valid",value:t}),sc=t=>t.status==="aborted",cc=t=>t.status==="dirty",xr=t=>t.status==="valid",Gn=t=>typeof Promise<"u"&&t instanceof Promise;var O;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(O||(O={}));var nt=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},xm=(t,e)=>{if(xr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Be(t.common.issues);return this._error=r,this._error}}};function F(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var G=class{get description(){return this._def.description}_getType(e){return Rt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pe,ctx:{common:e.parent.common,data:e.data,parsedType:Rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Gn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rt(e)},o=this._parseSync({data:e,path:n.path,parent:n});return xm(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return xr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>xr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rt(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Gn(o)?o:Promise.resolve(o));return xm(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:y.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new gt({schema:this,typeName:M.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ht.create(this,this._def)}nullable(){return Ut.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ir.create(this)}promise(){return Sr.create(this,this._def)}or(e){return Kr.create([this,e],this._def)}and(e){return Yr.create(this,e,this._def)}transform(e){return new gt({...F(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new tn({...F(this._def),innerType:this,defaultValue:r,typeName:M.ZodDefault})}brand(){return new Li({typeName:M.ZodBranded,type:this,...F(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new rn({...F(this._def),innerType:this,catchValue:r,typeName:M.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Fi.create(this,e)}readonly(){return nn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Cb=/^c[^\s-]{8,}$/i,Ub=/^[0-9a-z]+$/,Zb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Lb=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Fb=/^[a-z0-9_-]{21}$/i,qb=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Vb=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Wb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uc,Hb=/^(?:(?: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])$/,Gb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Kb=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Yb=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bb=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xb=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Sm="((\\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])))",Qb=new RegExp(`^${Sm}$`);function km(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function ex(t){return new RegExp(`^${km(t)}$`)}function tx(t){let e=`${Sm}T${km(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function rx(t,e){return!!((e==="v4"||!e)&&Hb.test(t)||(e==="v6"||!e)&&Kb.test(t))}function nx(t,e){if(!qb.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function ox(t,e){return!!((e==="v4"||!e)&&Gb.test(t)||(e==="v6"||!e)&&Yb.test(t))}var Jr=class t extends G{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_type,expected:z.string,received:i.parsedType}),C}let n=new Pe,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),w(o,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),w(o,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?w(o,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&w(o,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Wb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"email",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")uc||(uc=new RegExp(Jb,"u")),uc.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"emoji",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Lb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"uuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Fb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"nanoid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Cb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"cuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Ub.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"cuid2",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Zb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"ulid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),w(o,{validation:"url",code:y.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"regex",code:y.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?tx(i).test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Qb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?ex(i).test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Vb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"duration",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?rx(e.data,i.version)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"ip",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?nx(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"jwt",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?ox(e.data,i.version)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"cidr",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Bb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"base64",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Xb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"base64url",code:y.invalid_string,message:i.message}),n.dirty()):X.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:y.invalid_string,...O.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...O.errToObj(e)})}url(e){return this._addCheck({kind:"url",...O.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...O.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...O.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...O.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...O.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...O.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...O.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...O.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...O.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...O.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...O.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...O.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...O.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...O.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...O.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...O.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...O.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...O.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...O.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...O.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...O.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...O.errToObj(r)})}nonempty(e){return this.min(1,O.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Jr.create=t=>new Jr({checks:[],typeName:M.ZodString,coerce:t?.coerce??!1,...F(t)});function ix(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}var Kn=class t extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==z.number){let i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_type,expected:z.number,received:i.parsedType}),C}let n,o=new Pe;for(let i of this._def.checks)i.kind==="int"?X.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?ix(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{code:y.not_finite,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:O.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:O.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&X.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Kn.create=t=>new Kn({checks:[],typeName:M.ZodNumber,coerce:t?.coerce||!1,...F(t)});var Yn=class t extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==z.bigint)return this._getInvalidInput(e);let n,o=new Pe;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return w(r,{code:y.invalid_type,expected:z.bigint,received:r.parsedType}),C}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Yn.create=t=>new Yn({checks:[],typeName:M.ZodBigInt,coerce:t?.coerce??!1,...F(t)});var Bn=class extends G{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.boolean,received:n.parsedType}),C}return Re(e.data)}};Bn.create=t=>new Bn({typeName:M.ZodBoolean,coerce:t?.coerce||!1,...F(t)});var Xn=class t extends G{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_type,expected:z.date,received:i.parsedType}),C}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_date}),C}let n=new Pe,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),w(o,{code:y.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),w(o,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):X.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:O.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:O.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Xn.create=t=>new Xn({checks:[],coerce:t?.coerce||!1,typeName:M.ZodDate,...F(t)});var Qn=class extends G{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.symbol,received:n.parsedType}),C}return Re(e.data)}};Qn.create=t=>new Qn({typeName:M.ZodSymbol,...F(t)});var Hr=class extends G{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.undefined,received:n.parsedType}),C}return Re(e.data)}};Hr.create=t=>new Hr({typeName:M.ZodUndefined,...F(t)});var Gr=class extends G{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.null,received:n.parsedType}),C}return Re(e.data)}};Gr.create=t=>new Gr({typeName:M.ZodNull,...F(t)});var eo=class extends G{constructor(){super(...arguments),this._any=!0}_parse(e){return Re(e.data)}};eo.create=t=>new eo({typeName:M.ZodAny,...F(t)});var or=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Re(e.data)}};or.create=t=>new or({typeName:M.ZodUnknown,...F(t)});var wt=class extends G{_parse(e){let r=this._getOrReturnCtx(e);return w(r,{code:y.invalid_type,expected:z.never,received:r.parsedType}),C}};wt.create=t=>new wt({typeName:M.ZodNever,...F(t)});var to=class extends G{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.void,received:n.parsedType}),C}return Re(e.data)}};to.create=t=>new to({typeName:M.ZodVoid,...F(t)});var ir=class t extends G{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==z.array)return w(r,{code:y.invalid_type,expected:z.array,received:r.parsedType}),C;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(w(r,{code:a?y.too_big:y.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(w(r,{code:y.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(w(r,{code:y.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new nt(r,a,r.path,s)))).then(a=>Pe.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new nt(r,a,r.path,s)));return Pe.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:O.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:O.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:O.toString(r)}})}nonempty(e){return this.min(1,e)}};ir.create=(t,e)=>new ir({type:t,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...F(e)});function Wr(t){if(t instanceof Xe){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ht.create(Wr(n))}return new Xe({...t._def,shape:()=>e})}else return t instanceof ir?new ir({...t._def,type:Wr(t.element)}):t instanceof ht?ht.create(Wr(t.unwrap())):t instanceof Ut?Ut.create(Wr(t.unwrap())):t instanceof Ct?Ct.create(t.items.map(e=>Wr(e))):t}var Xe=class t extends G{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=X.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==z.object){let u=this._getOrReturnCtx(e);return w(u,{code:y.invalid_type,expected:z.object,received:u.parsedType}),C}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof wt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new nt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof wt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(w(o,{code:y.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new nt(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>Pe.mergeObjectSync(n,u)):Pe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return O.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:M.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of X.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of X.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Wr(this)}partial(e){let r={};for(let n of X.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of X.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ht;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return wm(X.objectKeys(this.shape))}};Xe.create=(t,e)=>new Xe({shape:()=>t,unknownKeys:"strip",catchall:wt.create(),typeName:M.ZodObject,...F(e)});Xe.strictCreate=(t,e)=>new Xe({shape:()=>t,unknownKeys:"strict",catchall:wt.create(),typeName:M.ZodObject,...F(e)});Xe.lazycreate=(t,e)=>new Xe({shape:t,unknownKeys:"strip",catchall:wt.create(),typeName:M.ZodObject,...F(e)});var Kr=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Be(s.ctx.common.issues));return w(r,{code:y.invalid_union,unionErrors:a}),C}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new Be(c));return w(r,{code:y.invalid_union,unionErrors:s}),C}}get options(){return this._def.options}};Kr.create=(t,e)=>new Kr({options:t,typeName:M.ZodUnion,...F(e)});var At=t=>t instanceof Br?At(t.schema):t instanceof gt?At(t.innerType()):t instanceof Xr?[t.value]:t instanceof Qr?t.options:t instanceof en?X.objectValues(t.enum):t instanceof tn?At(t._def.innerType):t instanceof Hr?[void 0]:t instanceof Gr?[null]:t instanceof ht?[void 0,...At(t.unwrap())]:t instanceof Ut?[null,...At(t.unwrap())]:t instanceof Li||t instanceof nn?At(t.unwrap()):t instanceof rn?At(t._def.innerType):[],lc=class t extends G{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.object)return w(r,{code:y.invalid_type,expected:z.object,received:r.parsedType}),C;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(w(r,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=At(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:M.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...F(n)})}};function dc(t,e){let r=Rt(t),n=Rt(e);if(t===e)return{valid:!0,data:t};if(r===z.object&&n===z.object){let o=X.objectKeys(e),i=X.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let c=dc(t[s],e[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===z.array&&n===z.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],c=dc(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===z.date&&n===z.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Yr=class extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(sc(i)||sc(a))return C;let s=dc(i.value,a.value);return s.valid?((cc(i)||cc(a))&&r.dirty(),{status:r.value,value:s.data}):(w(n,{code:y.invalid_intersection_types}),C)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Yr.create=(t,e,r)=>new Yr({left:t,right:e,typeName:M.ZodIntersection,...F(r)});var Ct=class t extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return w(n,{code:y.invalid_type,expected:z.array,received:n.parsedType}),C;if(n.data.length<this._def.items.length)return w(n,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),C;!this._def.rest&&n.data.length>this._def.items.length&&(w(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new nt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Pe.mergeArray(r,a)):Pe.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Ct.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ct({items:t,typeName:M.ZodTuple,rest:null,...F(e)})};var pc=class t extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.object)return w(n,{code:y.invalid_type,expected:z.object,received:n.parsedType}),C;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new nt(n,s,n.path,s)),value:a._parse(new nt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Pe.mergeObjectAsync(r,o):Pe.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof G?new t({keyType:e,valueType:r,typeName:M.ZodRecord,...F(n)}):new t({keyType:Jr.create(),valueType:e,typeName:M.ZodRecord,...F(r)})}},ro=class extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.map)return w(n,{code:y.invalid_type,expected:z.map,received:n.parsedType}),C;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new nt(n,s,n.path,[u,"key"])),value:i._parse(new nt(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return C;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return C;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};ro.create=(t,e,r)=>new ro({valueType:e,keyType:t,typeName:M.ZodMap,...F(r)});var no=class t extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return w(n,{code:y.invalid_type,expected:z.set,received:n.parsedType}),C;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(w(n,{code:y.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(w(n,{code:y.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return C;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new nt(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:O.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:O.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};no.create=(t,e)=>new no({valueType:t,minSize:null,maxSize:null,typeName:M.ZodSet,...F(e)});var fc=class t extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.function)return w(r,{code:y.invalid_type,expected:z.function,received:r.parsedType}),C;function n(s,c){return Zi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Hn(),nr].filter(u=>!!u),issueData:{code:y.invalid_arguments,argumentsError:c}})}function o(s,c){return Zi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Hn(),nr].filter(u=>!!u),issueData:{code:y.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Sr){let s=this;return Re(async function(...c){let u=new Be([]),l=await s._def.args.parseAsync(c,i).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(f=>{throw u.addIssue(o(d,f)),u})})}else{let s=this;return Re(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Be([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Be([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Ct.create(e).rest(or.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Ct.create([]).rest(or.create()),returns:r||or.create(),typeName:M.ZodFunction,...F(n)})}},Br=class extends G{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Br.create=(t,e)=>new Br({getter:t,typeName:M.ZodLazy,...F(e)});var Xr=class extends G{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return w(r,{received:r.data,code:y.invalid_literal,expected:this._def.value}),C}return{status:"valid",value:e.data}}get value(){return this._def.value}};Xr.create=(t,e)=>new Xr({value:t,typeName:M.ZodLiteral,...F(e)});function wm(t,e){return new Qr({values:t,typeName:M.ZodEnum,...F(e)})}var Qr=class t extends G{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return w(r,{expected:X.joinValues(n),received:r.parsedType,code:y.invalid_type}),C}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return w(r,{received:r.data,code:y.invalid_enum_value,options:n}),C}return Re(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Qr.create=wm;var en=class extends G{_parse(e){let r=X.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==z.string&&n.parsedType!==z.number){let o=X.objectValues(r);return w(n,{expected:X.joinValues(o),received:n.parsedType,code:y.invalid_type}),C}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=X.objectValues(r);return w(n,{received:n.data,code:y.invalid_enum_value,options:o}),C}return Re(e.data)}get enum(){return this._def.values}};en.create=(t,e)=>new en({values:t,typeName:M.ZodNativeEnum,...F(e)});var Sr=class extends G{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.promise&&r.common.async===!1)return w(r,{code:y.invalid_type,expected:z.promise,received:r.parsedType}),C;let n=r.parsedType===z.promise?r.data:Promise.resolve(r.data);return Re(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Sr.create=(t,e)=>new Sr({type:t,typeName:M.ZodPromise,...F(e)});var gt=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===M.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{w(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return C;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?C:c.status==="dirty"?Vr(c.value):r.value==="dirty"?Vr(c.value):c});{if(r.value==="aborted")return C;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?C:s.status==="dirty"?Vr(s.value):r.value==="dirty"?Vr(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?C:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?C:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!xr(a))return C;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>xr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):C);X.assertNever(o)}};gt.create=(t,e,r)=>new gt({schema:t,typeName:M.ZodEffects,effect:e,...F(r)});gt.createWithPreprocess=(t,e,r)=>new gt({schema:e,effect:{type:"preprocess",transform:t},typeName:M.ZodEffects,...F(r)});var ht=class extends G{_parse(e){return this._getType(e)===z.undefined?Re(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ht.create=(t,e)=>new ht({innerType:t,typeName:M.ZodOptional,...F(e)});var Ut=class extends G{_parse(e){return this._getType(e)===z.null?Re(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ut.create=(t,e)=>new Ut({innerType:t,typeName:M.ZodNullable,...F(e)});var tn=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};tn.create=(t,e)=>new tn({innerType:t,typeName:M.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...F(e)});var rn=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Gn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Be(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Be(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};rn.create=(t,e)=>new rn({innerType:t,typeName:M.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...F(e)});var oo=class extends G{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.nan,received:n.parsedType}),C}return{status:"valid",value:e.data}}};oo.create=t=>new oo({typeName:M.ZodNaN,...F(t)});var Li=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Fi=class t extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?C:i.status==="dirty"?(r.dirty(),Vr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?C:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:M.ZodPipeline})}},nn=class extends G{_parse(e){let r=this._def.innerType._parse(e),n=o=>(xr(o)&&(o.value=Object.freeze(o.value)),o);return Gn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};nn.create=(t,e)=>new nn({innerType:t,typeName:M.ZodReadonly,...F(e)});var Uj={object:Xe.lazycreate},M;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(M||(M={}));var Zj=Jr.create,Lj=Kn.create,Fj=oo.create,qj=Yn.create,Vj=Bn.create,Wj=Xn.create,Jj=Qn.create,Hj=Hr.create,Gj=Gr.create,Kj=eo.create,Yj=or.create,Bj=wt.create,Xj=to.create,Qj=ir.create,ax=Xe.create,eD=Xe.strictCreate,tD=Kr.create,rD=lc.create,nD=Yr.create,oD=Ct.create,iD=pc.create,aD=ro.create,sD=no.create,cD=fc.create,uD=Br.create,lD=Xr.create,dD=Qr.create,pD=en.create,fD=Sr.create,mD=gt.create,hD=ht.create,gD=Ut.create,vD=gt.createWithPreprocess,_D=Fi.create;var Em=Object.freeze({status:"aborted"});function m(t,e,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}var Et=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},kr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},qi={};function be(t){return t&&Object.assign(qi,t),qi}var b={};Wn(b,{BIGINT_FORMAT_RANGES:()=>Sc,Class:()=>hc,NUMBER_FORMAT_RANGES:()=>xc,aborted:()=>ur,allowsEval:()=>_c,assert:()=>fx,assertEqual:()=>ux,assertIs:()=>dx,assertNever:()=>px,assertNotEqual:()=>lx,assignProp:()=>sr,base64ToUint8Array:()=>Nm,base64urlToUint8Array:()=>kx,cached:()=>an,captureStackTrace:()=>Wi,cleanEnum:()=>Sx,cleanRegex:()=>so,clone:()=>Ae,cloneDef:()=>hx,createTransparentProxy:()=>bx,defineLazy:()=>q,esc:()=>Vi,escapeRegex:()=>ot,extend:()=>Tm,finalizeIssue:()=>Je,floatSafeRemainder:()=>gc,getElementAtPath:()=>gx,getEnumValues:()=>ao,getLengthableOrigin:()=>lo,getParsedType:()=>$x,getSizableOrigin:()=>uo,hexToUint8Array:()=>Ex,isObject:()=>wr,isPlainObject:()=>cr,issue:()=>sn,joinValues:()=>R,jsonStringifyReplacer:()=>on,merge:()=>xx,mergeDefs:()=>Zt,normalizeParams:()=>E,nullish:()=>ar,numKeys:()=>yx,objectClone:()=>mx,omit:()=>Pm,optionalKeys:()=>bc,parsedType:()=>U,partial:()=>jm,pick:()=>zm,prefixIssues:()=>Qe,primitiveTypes:()=>$c,promiseAllObject:()=>vx,propertyKeyTypes:()=>co,randomString:()=>_x,required:()=>Dm,safeExtend:()=>Om,shallowClone:()=>yc,slugify:()=>vc,stringifyPrimitive:()=>A,uint8ArrayToBase64:()=>Mm,uint8ArrayToBase64url:()=>wx,uint8ArrayToHex:()=>Ix,unwrapMessage:()=>io});function ux(t){return t}function lx(t){return t}function dx(t){}function px(t){throw new Error("Unexpected value in exhaustive check")}function fx(t){}function ao(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function R(t,e="|"){return t.map(r=>A(r)).join(e)}function on(t,e){return typeof e=="bigint"?e.toString():e}function an(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function ar(t){return t==null}function so(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function gc(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}var Im=Symbol("evaluating");function q(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Im)return n===void 0&&(n=Im,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function mx(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function sr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Zt(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function hx(t){return Zt(t._zod.def)}function gx(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function vx(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<e.length;i++)o[e[i]]=n[i];return o})}function _x(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Vi(t){return JSON.stringify(t)}function vc(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Wi="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function wr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var _c=an(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function cr(t){if(wr(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(wr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function yc(t){return cr(t)?{...t}:Array.isArray(t)?[...t]:t}function yx(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var $x=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},co=new Set(["string","number","symbol"]),$c=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ot(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ae(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function E(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function bx(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function A(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function bc(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var xc={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]},Sc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zm(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Zt(t._zod.def,{get shape(){let a={};for(let s in e){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(a[s]=r.shape[s])}return sr(this,"shape",a),a},checks:[]});return Ae(t,i)}function Pm(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Zt(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let s in e){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete a[s]}return sr(this,"shape",a),a},checks:[]});return Ae(t,i)}function Tm(t,e){if(!cr(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let i=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Zt(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return sr(this,"shape",i),i}});return Ae(t,o)}function Om(t,e){if(!cr(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Zt(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return sr(this,"shape",n),n}});return Ae(t,r)}function xx(t,e){let r=Zt(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return sr(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Ae(t,r)}function jm(t,e,r){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Zt(e._zod.def,{get shape(){let s=e._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=t?new t({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=t?new t({type:"optional",innerType:s[u]}):s[u];return sr(this,"shape",c),c},checks:[]});return Ae(e,a)}function Dm(t,e,r){let n=Zt(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new t({type:"nonoptional",innerType:o[a]});return sr(this,"shape",i),i}});return Ae(e,n)}function ur(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Qe(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function io(t){return typeof t=="string"?t:t?.message}function Je(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=io(t.inst?._zod.def?.error?.(t))??io(e?.error?.(t))??io(r.customError?.(t))??io(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function uo(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function lo(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function U(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function sn(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Sx(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Nm(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function Mm(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function kx(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Nm(e+r)}function wx(t){return Mm(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Ex(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function Ix(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var hc=class{constructor(...e){}};var Rm=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,on,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Ji=m("$ZodError",Rm),po=m("$ZodError",Rm,{Parent:Error});function Hi(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function Gi(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(t),r}var fo=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new Et;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>Je(c,i,be())));throw Wi(s,o?.callee),s}return a.value},mo=fo(po),ho=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>Je(c,i,be())));throw Wi(s,o?.callee),s}return a.value},go=ho(po),vo=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Et;return i.issues.length?{success:!1,error:new(t??Ji)(i.issues.map(a=>Je(a,o,be())))}:{success:!0,data:i.value}},cn=vo(po),_o=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>Je(a,o,be())))}:{success:!0,data:i.value}},yo=_o(po),Am=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return fo(t)(e,r,o)};var Cm=t=>(e,r,n)=>fo(t)(e,r,n);var Um=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ho(t)(e,r,o)};var Zm=t=>async(e,r,n)=>ho(t)(e,r,n);var Lm=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return vo(t)(e,r,o)};var Fm=t=>(e,r,n)=>vo(t)(e,r,n);var qm=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return _o(t)(e,r,o)};var Vm=t=>async(e,r,n)=>_o(t)(e,r,n);var it={};Wn(it,{base64:()=>Uc,base64url:()=>Ki,bigint:()=>Wc,boolean:()=>Hc,browserEmail:()=>Rx,cidrv4:()=>Ac,cidrv6:()=>Cc,cuid:()=>kc,cuid2:()=>wc,date:()=>Lc,datetime:()=>qc,domain:()=>Ux,duration:()=>Tc,e164:()=>Zc,email:()=>jc,emoji:()=>Dc,extendedDuration:()=>Px,guid:()=>Oc,hex:()=>Zx,hostname:()=>Cx,html5Email:()=>Dx,idnEmail:()=>Mx,integer:()=>Jc,ipv4:()=>Nc,ipv6:()=>Mc,ksuid:()=>zc,lowercase:()=>Yc,mac:()=>Rc,md5_base64:()=>Fx,md5_base64url:()=>qx,md5_hex:()=>Lx,nanoid:()=>Pc,null:()=>Gc,number:()=>Yi,rfc5322Email:()=>Nx,sha1_base64:()=>Wx,sha1_base64url:()=>Jx,sha1_hex:()=>Vx,sha256_base64:()=>Gx,sha256_base64url:()=>Kx,sha256_hex:()=>Hx,sha384_base64:()=>Bx,sha384_base64url:()=>Xx,sha384_hex:()=>Yx,sha512_base64:()=>eS,sha512_base64url:()=>tS,sha512_hex:()=>Qx,string:()=>Vc,time:()=>Fc,ulid:()=>Ec,undefined:()=>Kc,unicodeEmail:()=>Wm,uppercase:()=>Bc,uuid:()=>Er,uuid4:()=>Tx,uuid6:()=>Ox,uuid7:()=>jx,xid:()=>Ic});var kc=/^[cC][^\s-]{8,}$/,wc=/^[0-9a-z]+$/,Ec=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ic=/^[0-9a-vA-V]{20}$/,zc=/^[A-Za-z0-9]{27}$/,Pc=/^[a-zA-Z0-9_-]{21}$/,Tc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Px=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Oc=/^([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})$/,Er=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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)$/,Tx=Er(4),Ox=Er(6),jx=Er(7),jc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Dx=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Nx=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Wm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Mx=Wm,Rx=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ax="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Dc(){return new RegExp(Ax,"u")}var Nc=/^(?:(?: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])$/,Mc=/^(([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}|:))$/,Rc=t=>{let e=ot(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},Ac=/^((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])$/,Cc=/^(([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])$/,Uc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ki=/^[A-Za-z0-9_-]*$/,Cx=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Ux=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Zc=/^\+[1-9]\d{6,14}$/,Jm="(?:(?:\\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])))",Lc=new RegExp(`^${Jm}$`);function Hm(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Fc(t){return new RegExp(`^${Hm(t)}$`)}function qc(t){let e=Hm({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Jm}T(?:${n})$`)}var Vc=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Wc=/^-?\d+n?$/,Jc=/^-?\d+$/,Yi=/^-?\d+(?:\.\d+)?$/,Hc=/^(?:true|false)$/i,Gc=/^null$/i;var Kc=/^undefined$/i;var Yc=/^[^A-Z]*$/,Bc=/^[^a-z]*$/,Zx=/^[0-9a-fA-F]*$/;function $o(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function bo(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var Lx=/^[0-9a-fA-F]{32}$/,Fx=$o(22,"=="),qx=bo(22),Vx=/^[0-9a-fA-F]{40}$/,Wx=$o(27,"="),Jx=bo(27),Hx=/^[0-9a-fA-F]{64}$/,Gx=$o(43,"="),Kx=bo(43),Yx=/^[0-9a-fA-F]{96}$/,Bx=$o(64,""),Xx=bo(64),Qx=/^[0-9a-fA-F]{128}$/,eS=$o(86,"=="),tS=bo(86);var ce=m("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Km={number:"number",bigint:"bigint",object:"date"},Xc=m("$ZodCheckLessThan",(t,e)=>{ce.init(t,e);let r=Km[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Qc=m("$ZodCheckGreaterThan",(t,e)=>{ce.init(t,e);let r=Km[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Ym=m("$ZodCheckMultipleOf",(t,e)=>{ce.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):gc(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Bm=m("$ZodCheckNumberFormat",(t,e)=>{ce.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=xc[e.format];t._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=o,s.maximum=i,r&&(s.pattern=Jc)}),t._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),Xm=m("$ZodCheckBigIntFormat",(t,e)=>{ce.init(t,e);let[r,n]=Sc[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),Qm=m("$ZodCheckMaxSize",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;o.size<=e.maximum||n.issues.push({origin:uo(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),eh=m("$ZodCheckMinSize",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:uo(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),th=m("$ZodCheckSizeEquals",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let a=i>e.size;n.issues.push({origin:uo(o),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),rh=m("$ZodCheckMaxLength",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=lo(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),nh=m("$ZodCheckMinLength",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=lo(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),oh=m("$ZodCheckLengthEquals",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let a=lo(o),s=i>e.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),xo=m("$ZodCheckStringFormat",(t,e)=>{var r,n;ce.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),ih=m("$ZodCheckRegex",(t,e)=>{xo.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),ah=m("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Yc),xo.init(t,e)}),sh=m("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Bc),xo.init(t,e)}),ch=m("$ZodCheckIncludes",(t,e)=>{ce.init(t,e);let r=ot(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),uh=m("$ZodCheckStartsWith",(t,e)=>{ce.init(t,e);let r=new RegExp(`^${ot(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),lh=m("$ZodCheckEndsWith",(t,e)=>{ce.init(t,e);let r=new RegExp(`.*${ot(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function Gm(t,e,r){t.issues.length&&e.issues.push(...Qe(r,t.issues))}var dh=m("$ZodCheckProperty",(t,e)=>{ce.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Gm(o,r,e.property));Gm(n,r,e.property)}}),ph=m("$ZodCheckMimeType",(t,e)=>{ce.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),fh=m("$ZodCheckOverwrite",(t,e)=>{ce.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var Bi=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
17
|
+
`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),l=u?`${u[1].split("/").pop()}:${u[2]}`:"unknown",d={...n,location:l};return this.warn(e,`[HAPPY-PATH] ${r}`,d,o),i}},_=new cc;var X;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(X||(X={}));var Sm;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Sm||(Sm={}));var z=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),At=t=>{switch(typeof t){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(t)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(t)?z.array:t===null?z.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?z.promise:typeof Map<"u"&&t instanceof Map?z.map:typeof Set<"u"&&t instanceof Set?z.set:typeof Date<"u"&&t instanceof Date?z.date:z.object;default:return z.unknown}};var y=X.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var Be=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,X.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Be.create=t=>new Be(t);var Lb=(t,e)=>{let r;switch(t.code){case y.invalid_type:t.received===z.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,X.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:r=`Unrecognized key(s) in object: ${X.joinValues(t.keys,", ")}`;break;case y.invalid_union:r="Invalid input";break;case y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${X.joinValues(t.options)}`;break;case y.invalid_enum_value:r=`Invalid enum value. Expected ${X.joinValues(t.options)}, received '${t.received}'`;break;case y.invalid_arguments:r="Invalid function arguments";break;case y.invalid_return_type:r="Invalid function return type";break;case y.invalid_date:r="Invalid date";break;case y.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:X.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case y.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case y.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case y.custom:r="Invalid input";break;case y.invalid_intersection_types:r="Intersection results could not be merged";break;case y.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case y.not_finite:r="Number must be finite";break;default:r=e.defaultError,X.assertNever(t)}return{message:r}},nr=Lb;var Fb=nr;function Gn(){return Fb}var Li=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};function w(t,e){let r=Gn(),n=Li({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===nr?void 0:nr].filter(o=>!!o)});t.common.issues.push(n)}var Pe=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return C;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return C;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},C=Object.freeze({status:"aborted"}),Wr=t=>({status:"dirty",value:t}),Re=t=>({status:"valid",value:t}),uc=t=>t.status==="aborted",lc=t=>t.status==="dirty",Sr=t=>t.status==="valid",Kn=t=>typeof Promise<"u"&&t instanceof Promise;var O;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(O||(O={}));var nt=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},km=(t,e)=>{if(Sr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Be(t.common.issues);return this._error=r,this._error}}};function F(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var G=class{get description(){return this._def.description}_getType(e){return At(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:At(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pe,ctx:{common:e.parent.common,data:e.data,parsedType:At(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Kn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:At(e)},o=this._parseSync({data:e,path:n.path,parent:n});return km(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:At(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Sr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Sr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:At(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Kn(o)?o:Promise.resolve(o));return km(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:y.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new vt({schema:this,typeName:M.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return gt.create(this,this._def)}nullable(){return Zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ir.create(this)}promise(){return kr.create(this,this._def)}or(e){return Yr.create([this,e],this._def)}and(e){return Br.create(this,e,this._def)}transform(e){return new vt({...F(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new rn({...F(this._def),innerType:this,defaultValue:r,typeName:M.ZodDefault})}brand(){return new Fi({typeName:M.ZodBranded,type:this,...F(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new nn({...F(this._def),innerType:this,catchValue:r,typeName:M.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return qi.create(this,e)}readonly(){return on.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},qb=/^c[^\s-]{8,}$/i,Vb=/^[0-9a-z]+$/,Wb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Jb=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Hb=/^[a-z0-9_-]{21}$/i,Gb=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Kb=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Yb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Bb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dc,Xb=/^(?:(?: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])$/,Qb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ex=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tx=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rx=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nx=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wm="((\\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])))",ox=new RegExp(`^${wm}$`);function Em(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function ix(t){return new RegExp(`^${Em(t)}$`)}function ax(t){let e=`${wm}T${Em(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function sx(t,e){return!!((e==="v4"||!e)&&Xb.test(t)||(e==="v6"||!e)&&ex.test(t))}function cx(t,e){if(!Gb.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function ux(t,e){return!!((e==="v4"||!e)&&Qb.test(t)||(e==="v6"||!e)&&tx.test(t))}var Hr=class t extends G{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_type,expected:z.string,received:i.parsedType}),C}let n=new Pe,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),w(o,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),w(o,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?w(o,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&w(o,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Yb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"email",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")dc||(dc=new RegExp(Bb,"u")),dc.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"emoji",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Jb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"uuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Hb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"nanoid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")qb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"cuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Vb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"cuid2",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Wb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"ulid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),w(o,{validation:"url",code:y.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"regex",code:y.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?ax(i).test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?ox.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?ix(i).test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{code:y.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Kb.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"duration",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?sx(e.data,i.version)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"ip",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?cx(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"jwt",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?ux(e.data,i.version)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"cidr",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?rx.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"base64",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?nx.test(e.data)||(o=this._getOrReturnCtx(e,o),w(o,{validation:"base64url",code:y.invalid_string,message:i.message}),n.dirty()):X.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:y.invalid_string,...O.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...O.errToObj(e)})}url(e){return this._addCheck({kind:"url",...O.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...O.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...O.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...O.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...O.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...O.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...O.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...O.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...O.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...O.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...O.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...O.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...O.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...O.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...O.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...O.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...O.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...O.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...O.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...O.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...O.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...O.errToObj(r)})}nonempty(e){return this.min(1,O.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Hr.create=t=>new Hr({checks:[],typeName:M.ZodString,coerce:t?.coerce??!1,...F(t)});function lx(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}var Yn=class t extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==z.number){let i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_type,expected:z.number,received:i.parsedType}),C}let n,o=new Pe;for(let i of this._def.checks)i.kind==="int"?X.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?lx(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),w(n,{code:y.not_finite,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:O.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:O.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&X.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Yn.create=t=>new Yn({checks:[],typeName:M.ZodNumber,coerce:t?.coerce||!1,...F(t)});var Bn=class t extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==z.bigint)return this._getInvalidInput(e);let n,o=new Pe;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),w(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return w(r,{code:y.invalid_type,expected:z.bigint,received:r.parsedType}),C}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Bn.create=t=>new Bn({checks:[],typeName:M.ZodBigInt,coerce:t?.coerce??!1,...F(t)});var Xn=class extends G{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.boolean,received:n.parsedType}),C}return Re(e.data)}};Xn.create=t=>new Xn({typeName:M.ZodBoolean,coerce:t?.coerce||!1,...F(t)});var Qn=class t extends G{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_type,expected:z.date,received:i.parsedType}),C}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return w(i,{code:y.invalid_date}),C}let n=new Pe,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),w(o,{code:y.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),w(o,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):X.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:O.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:O.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Qn.create=t=>new Qn({checks:[],coerce:t?.coerce||!1,typeName:M.ZodDate,...F(t)});var eo=class extends G{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.symbol,received:n.parsedType}),C}return Re(e.data)}};eo.create=t=>new eo({typeName:M.ZodSymbol,...F(t)});var Gr=class extends G{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.undefined,received:n.parsedType}),C}return Re(e.data)}};Gr.create=t=>new Gr({typeName:M.ZodUndefined,...F(t)});var Kr=class extends G{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.null,received:n.parsedType}),C}return Re(e.data)}};Kr.create=t=>new Kr({typeName:M.ZodNull,...F(t)});var to=class extends G{constructor(){super(...arguments),this._any=!0}_parse(e){return Re(e.data)}};to.create=t=>new to({typeName:M.ZodAny,...F(t)});var or=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Re(e.data)}};or.create=t=>new or({typeName:M.ZodUnknown,...F(t)});var Et=class extends G{_parse(e){let r=this._getOrReturnCtx(e);return w(r,{code:y.invalid_type,expected:z.never,received:r.parsedType}),C}};Et.create=t=>new Et({typeName:M.ZodNever,...F(t)});var ro=class extends G{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.void,received:n.parsedType}),C}return Re(e.data)}};ro.create=t=>new ro({typeName:M.ZodVoid,...F(t)});var ir=class t extends G{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==z.array)return w(r,{code:y.invalid_type,expected:z.array,received:r.parsedType}),C;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(w(r,{code:a?y.too_big:y.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(w(r,{code:y.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(w(r,{code:y.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new nt(r,a,r.path,s)))).then(a=>Pe.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new nt(r,a,r.path,s)));return Pe.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:O.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:O.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:O.toString(r)}})}nonempty(e){return this.min(1,e)}};ir.create=(t,e)=>new ir({type:t,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...F(e)});function Jr(t){if(t instanceof Xe){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=gt.create(Jr(n))}return new Xe({...t._def,shape:()=>e})}else return t instanceof ir?new ir({...t._def,type:Jr(t.element)}):t instanceof gt?gt.create(Jr(t.unwrap())):t instanceof Zt?Zt.create(Jr(t.unwrap())):t instanceof Ut?Ut.create(t.items.map(e=>Jr(e))):t}var Xe=class t extends G{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=X.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==z.object){let u=this._getOrReturnCtx(e);return w(u,{code:y.invalid_type,expected:z.object,received:u.parsedType}),C}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Et&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new nt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Et){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(w(o,{code:y.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new nt(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>Pe.mergeObjectSync(n,u)):Pe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return O.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:M.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of X.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of X.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Jr(this)}partial(e){let r={};for(let n of X.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of X.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof gt;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Im(X.objectKeys(this.shape))}};Xe.create=(t,e)=>new Xe({shape:()=>t,unknownKeys:"strip",catchall:Et.create(),typeName:M.ZodObject,...F(e)});Xe.strictCreate=(t,e)=>new Xe({shape:()=>t,unknownKeys:"strict",catchall:Et.create(),typeName:M.ZodObject,...F(e)});Xe.lazycreate=(t,e)=>new Xe({shape:t,unknownKeys:"strip",catchall:Et.create(),typeName:M.ZodObject,...F(e)});var Yr=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Be(s.ctx.common.issues));return w(r,{code:y.invalid_union,unionErrors:a}),C}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new Be(c));return w(r,{code:y.invalid_union,unionErrors:s}),C}}get options(){return this._def.options}};Yr.create=(t,e)=>new Yr({options:t,typeName:M.ZodUnion,...F(e)});var Ct=t=>t instanceof Xr?Ct(t.schema):t instanceof vt?Ct(t.innerType()):t instanceof Qr?[t.value]:t instanceof en?t.options:t instanceof tn?X.objectValues(t.enum):t instanceof rn?Ct(t._def.innerType):t instanceof Gr?[void 0]:t instanceof Kr?[null]:t instanceof gt?[void 0,...Ct(t.unwrap())]:t instanceof Zt?[null,...Ct(t.unwrap())]:t instanceof Fi||t instanceof on?Ct(t.unwrap()):t instanceof nn?Ct(t._def.innerType):[],pc=class t extends G{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.object)return w(r,{code:y.invalid_type,expected:z.object,received:r.parsedType}),C;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(w(r,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=Ct(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:M.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...F(n)})}};function fc(t,e){let r=At(t),n=At(e);if(t===e)return{valid:!0,data:t};if(r===z.object&&n===z.object){let o=X.objectKeys(e),i=X.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let c=fc(t[s],e[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===z.array&&n===z.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],c=fc(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===z.date&&n===z.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Br=class extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(uc(i)||uc(a))return C;let s=fc(i.value,a.value);return s.valid?((lc(i)||lc(a))&&r.dirty(),{status:r.value,value:s.data}):(w(n,{code:y.invalid_intersection_types}),C)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Br.create=(t,e,r)=>new Br({left:t,right:e,typeName:M.ZodIntersection,...F(r)});var Ut=class t extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return w(n,{code:y.invalid_type,expected:z.array,received:n.parsedType}),C;if(n.data.length<this._def.items.length)return w(n,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),C;!this._def.rest&&n.data.length>this._def.items.length&&(w(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new nt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Pe.mergeArray(r,a)):Pe.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Ut.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ut({items:t,typeName:M.ZodTuple,rest:null,...F(e)})};var mc=class t extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.object)return w(n,{code:y.invalid_type,expected:z.object,received:n.parsedType}),C;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new nt(n,s,n.path,s)),value:a._parse(new nt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Pe.mergeObjectAsync(r,o):Pe.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof G?new t({keyType:e,valueType:r,typeName:M.ZodRecord,...F(n)}):new t({keyType:Hr.create(),valueType:e,typeName:M.ZodRecord,...F(r)})}},no=class extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.map)return w(n,{code:y.invalid_type,expected:z.map,received:n.parsedType}),C;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new nt(n,s,n.path,[u,"key"])),value:i._parse(new nt(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return C;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return C;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};no.create=(t,e,r)=>new no({valueType:e,keyType:t,typeName:M.ZodMap,...F(r)});var oo=class t extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return w(n,{code:y.invalid_type,expected:z.set,received:n.parsedType}),C;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(w(n,{code:y.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(w(n,{code:y.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return C;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new nt(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:O.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:O.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};oo.create=(t,e)=>new oo({valueType:t,minSize:null,maxSize:null,typeName:M.ZodSet,...F(e)});var hc=class t extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.function)return w(r,{code:y.invalid_type,expected:z.function,received:r.parsedType}),C;function n(s,c){return Li({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Gn(),nr].filter(u=>!!u),issueData:{code:y.invalid_arguments,argumentsError:c}})}function o(s,c){return Li({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Gn(),nr].filter(u=>!!u),issueData:{code:y.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof kr){let s=this;return Re(async function(...c){let u=new Be([]),l=await s._def.args.parseAsync(c,i).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(f=>{throw u.addIssue(o(d,f)),u})})}else{let s=this;return Re(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Be([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Be([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Ut.create(e).rest(or.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Ut.create([]).rest(or.create()),returns:r||or.create(),typeName:M.ZodFunction,...F(n)})}},Xr=class extends G{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Xr.create=(t,e)=>new Xr({getter:t,typeName:M.ZodLazy,...F(e)});var Qr=class extends G{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return w(r,{received:r.data,code:y.invalid_literal,expected:this._def.value}),C}return{status:"valid",value:e.data}}get value(){return this._def.value}};Qr.create=(t,e)=>new Qr({value:t,typeName:M.ZodLiteral,...F(e)});function Im(t,e){return new en({values:t,typeName:M.ZodEnum,...F(e)})}var en=class t extends G{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return w(r,{expected:X.joinValues(n),received:r.parsedType,code:y.invalid_type}),C}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return w(r,{received:r.data,code:y.invalid_enum_value,options:n}),C}return Re(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};en.create=Im;var tn=class extends G{_parse(e){let r=X.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==z.string&&n.parsedType!==z.number){let o=X.objectValues(r);return w(n,{expected:X.joinValues(o),received:n.parsedType,code:y.invalid_type}),C}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=X.objectValues(r);return w(n,{received:n.data,code:y.invalid_enum_value,options:o}),C}return Re(e.data)}get enum(){return this._def.values}};tn.create=(t,e)=>new tn({values:t,typeName:M.ZodNativeEnum,...F(e)});var kr=class extends G{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.promise&&r.common.async===!1)return w(r,{code:y.invalid_type,expected:z.promise,received:r.parsedType}),C;let n=r.parsedType===z.promise?r.data:Promise.resolve(r.data);return Re(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};kr.create=(t,e)=>new kr({type:t,typeName:M.ZodPromise,...F(e)});var vt=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===M.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{w(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return C;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?C:c.status==="dirty"?Wr(c.value):r.value==="dirty"?Wr(c.value):c});{if(r.value==="aborted")return C;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?C:s.status==="dirty"?Wr(s.value):r.value==="dirty"?Wr(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?C:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?C:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Sr(a))return C;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Sr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):C);X.assertNever(o)}};vt.create=(t,e,r)=>new vt({schema:t,typeName:M.ZodEffects,effect:e,...F(r)});vt.createWithPreprocess=(t,e,r)=>new vt({schema:e,effect:{type:"preprocess",transform:t},typeName:M.ZodEffects,...F(r)});var gt=class extends G{_parse(e){return this._getType(e)===z.undefined?Re(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gt.create=(t,e)=>new gt({innerType:t,typeName:M.ZodOptional,...F(e)});var Zt=class extends G{_parse(e){return this._getType(e)===z.null?Re(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Zt.create=(t,e)=>new Zt({innerType:t,typeName:M.ZodNullable,...F(e)});var rn=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};rn.create=(t,e)=>new rn({innerType:t,typeName:M.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...F(e)});var nn=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Kn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Be(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Be(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};nn.create=(t,e)=>new nn({innerType:t,typeName:M.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...F(e)});var io=class extends G{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return w(n,{code:y.invalid_type,expected:z.nan,received:n.parsedType}),C}return{status:"valid",value:e.data}}};io.create=t=>new io({typeName:M.ZodNaN,...F(t)});var Fi=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},qi=class t extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?C:i.status==="dirty"?(r.dirty(),Wr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?C:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:M.ZodPipeline})}},on=class extends G{_parse(e){let r=this._def.innerType._parse(e),n=o=>(Sr(o)&&(o.value=Object.freeze(o.value)),o);return Kn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};on.create=(t,e)=>new on({innerType:t,typeName:M.ZodReadonly,...F(e)});var Wj={object:Xe.lazycreate},M;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(M||(M={}));var Jj=Hr.create,Hj=Yn.create,Gj=io.create,Kj=Bn.create,Yj=Xn.create,Bj=Qn.create,Xj=eo.create,Qj=Gr.create,eD=Kr.create,tD=to.create,rD=or.create,nD=Et.create,oD=ro.create,iD=ir.create,dx=Xe.create,aD=Xe.strictCreate,sD=Yr.create,cD=pc.create,uD=Br.create,lD=Ut.create,dD=mc.create,pD=no.create,fD=oo.create,mD=hc.create,hD=Xr.create,gD=Qr.create,vD=en.create,_D=tn.create,yD=kr.create,$D=vt.create,bD=gt.create,xD=Zt.create,SD=vt.createWithPreprocess,kD=qi.create;var zm=Object.freeze({status:"aborted"});function m(t,e,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}var It=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},wr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Vi={};function be(t){return t&&Object.assign(Vi,t),Vi}var b={};Jn(b,{BIGINT_FORMAT_RANGES:()=>wc,Class:()=>vc,NUMBER_FORMAT_RANGES:()=>kc,aborted:()=>ur,allowsEval:()=>$c,assert:()=>_x,assertEqual:()=>mx,assertIs:()=>gx,assertNever:()=>vx,assertNotEqual:()=>hx,assignProp:()=>sr,base64ToUint8Array:()=>Rm,base64urlToUint8Array:()=>Px,cached:()=>sn,captureStackTrace:()=>Ji,cleanEnum:()=>zx,cleanRegex:()=>co,clone:()=>Ae,cloneDef:()=>$x,createTransparentProxy:()=>Ex,defineLazy:()=>q,esc:()=>Wi,escapeRegex:()=>ot,extend:()=>jm,finalizeIssue:()=>Je,floatSafeRemainder:()=>_c,getElementAtPath:()=>bx,getEnumValues:()=>so,getLengthableOrigin:()=>po,getParsedType:()=>wx,getSizableOrigin:()=>lo,hexToUint8Array:()=>Ox,isObject:()=>Er,isPlainObject:()=>cr,issue:()=>cn,joinValues:()=>R,jsonStringifyReplacer:()=>an,merge:()=>Ix,mergeDefs:()=>Lt,normalizeParams:()=>E,nullish:()=>ar,numKeys:()=>kx,objectClone:()=>yx,omit:()=>Om,optionalKeys:()=>Sc,parsedType:()=>U,partial:()=>Nm,pick:()=>Tm,prefixIssues:()=>Qe,primitiveTypes:()=>xc,promiseAllObject:()=>xx,propertyKeyTypes:()=>uo,randomString:()=>Sx,required:()=>Mm,safeExtend:()=>Dm,shallowClone:()=>bc,slugify:()=>yc,stringifyPrimitive:()=>A,uint8ArrayToBase64:()=>Am,uint8ArrayToBase64url:()=>Tx,uint8ArrayToHex:()=>jx,unwrapMessage:()=>ao});function mx(t){return t}function hx(t){return t}function gx(t){}function vx(t){throw new Error("Unexpected value in exhaustive check")}function _x(t){}function so(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function R(t,e="|"){return t.map(r=>A(r)).join(e)}function an(t,e){return typeof e=="bigint"?e.toString():e}function sn(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function ar(t){return t==null}function co(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function _c(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}var Pm=Symbol("evaluating");function q(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Pm)return n===void 0&&(n=Pm,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function yx(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function sr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Lt(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function $x(t){return Lt(t._zod.def)}function bx(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function xx(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<e.length;i++)o[e[i]]=n[i];return o})}function Sx(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Wi(t){return JSON.stringify(t)}function yc(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ji="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Er(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var $c=sn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function cr(t){if(Er(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Er(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function bc(t){return cr(t)?{...t}:Array.isArray(t)?[...t]:t}function kx(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var wx=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},uo=new Set(["string","number","symbol"]),xc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ot(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ae(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function E(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Ex(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function A(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Sc(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var kc={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]},wc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Tm(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Lt(t._zod.def,{get shape(){let a={};for(let s in e){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(a[s]=r.shape[s])}return sr(this,"shape",a),a},checks:[]});return Ae(t,i)}function Om(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Lt(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let s in e){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete a[s]}return sr(this,"shape",a),a},checks:[]});return Ae(t,i)}function jm(t,e){if(!cr(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let i=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Lt(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return sr(this,"shape",i),i}});return Ae(t,o)}function Dm(t,e){if(!cr(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Lt(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return sr(this,"shape",n),n}});return Ae(t,r)}function Ix(t,e){let r=Lt(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return sr(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Ae(t,r)}function Nm(t,e,r){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Lt(e._zod.def,{get shape(){let s=e._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=t?new t({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=t?new t({type:"optional",innerType:s[u]}):s[u];return sr(this,"shape",c),c},checks:[]});return Ae(e,a)}function Mm(t,e,r){let n=Lt(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new t({type:"nonoptional",innerType:o[a]});return sr(this,"shape",i),i}});return Ae(e,n)}function ur(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Qe(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function ao(t){return typeof t=="string"?t:t?.message}function Je(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=ao(t.inst?._zod.def?.error?.(t))??ao(e?.error?.(t))??ao(r.customError?.(t))??ao(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function lo(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function po(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function U(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function cn(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function zx(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Rm(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function Am(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Px(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Rm(e+r)}function Tx(t){return Am(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Ox(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function jx(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var vc=class{constructor(...e){}};var Cm=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,an,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Hi=m("$ZodError",Cm),fo=m("$ZodError",Cm,{Parent:Error});function Gi(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function Ki(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(t),r}var mo=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new It;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>Je(c,i,be())));throw Ji(s,o?.callee),s}return a.value},ho=mo(fo),go=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>Je(c,i,be())));throw Ji(s,o?.callee),s}return a.value},vo=go(fo),_o=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new It;return i.issues.length?{success:!1,error:new(t??Hi)(i.issues.map(a=>Je(a,o,be())))}:{success:!0,data:i.value}},un=_o(fo),yo=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>Je(a,o,be())))}:{success:!0,data:i.value}},$o=yo(fo),Um=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return mo(t)(e,r,o)};var Zm=t=>(e,r,n)=>mo(t)(e,r,n);var Lm=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return go(t)(e,r,o)};var Fm=t=>async(e,r,n)=>go(t)(e,r,n);var qm=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return _o(t)(e,r,o)};var Vm=t=>(e,r,n)=>_o(t)(e,r,n);var Wm=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return yo(t)(e,r,o)};var Jm=t=>async(e,r,n)=>yo(t)(e,r,n);var it={};Jn(it,{base64:()=>Lc,base64url:()=>Yi,bigint:()=>Hc,boolean:()=>Kc,browserEmail:()=>Lx,cidrv4:()=>Uc,cidrv6:()=>Zc,cuid:()=>Ec,cuid2:()=>Ic,date:()=>qc,datetime:()=>Wc,domain:()=>Vx,duration:()=>jc,e164:()=>Fc,email:()=>Nc,emoji:()=>Mc,extendedDuration:()=>Nx,guid:()=>Dc,hex:()=>Wx,hostname:()=>qx,html5Email:()=>Cx,idnEmail:()=>Zx,integer:()=>Gc,ipv4:()=>Rc,ipv6:()=>Ac,ksuid:()=>Tc,lowercase:()=>Xc,mac:()=>Cc,md5_base64:()=>Hx,md5_base64url:()=>Gx,md5_hex:()=>Jx,nanoid:()=>Oc,null:()=>Yc,number:()=>Bi,rfc5322Email:()=>Ux,sha1_base64:()=>Yx,sha1_base64url:()=>Bx,sha1_hex:()=>Kx,sha256_base64:()=>Qx,sha256_base64url:()=>eS,sha256_hex:()=>Xx,sha384_base64:()=>rS,sha384_base64url:()=>nS,sha384_hex:()=>tS,sha512_base64:()=>iS,sha512_base64url:()=>aS,sha512_hex:()=>oS,string:()=>Jc,time:()=>Vc,ulid:()=>zc,undefined:()=>Bc,unicodeEmail:()=>Hm,uppercase:()=>Qc,uuid:()=>Ir,uuid4:()=>Mx,uuid6:()=>Rx,uuid7:()=>Ax,xid:()=>Pc});var Ec=/^[cC][^\s-]{8,}$/,Ic=/^[0-9a-z]+$/,zc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Pc=/^[0-9a-vA-V]{20}$/,Tc=/^[A-Za-z0-9]{27}$/,Oc=/^[a-zA-Z0-9_-]{21}$/,jc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Nx=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Dc=/^([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})$/,Ir=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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)$/,Mx=Ir(4),Rx=Ir(6),Ax=Ir(7),Nc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Cx=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ux=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Hm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Zx=Hm,Lx=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Fx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Mc(){return new RegExp(Fx,"u")}var Rc=/^(?:(?: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])$/,Ac=/^(([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}|:))$/,Cc=t=>{let e=ot(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},Uc=/^((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])$/,Zc=/^(([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])$/,Lc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yi=/^[A-Za-z0-9_-]*$/,qx=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Vx=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Fc=/^\+[1-9]\d{6,14}$/,Gm="(?:(?:\\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])))",qc=new RegExp(`^${Gm}$`);function Km(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Vc(t){return new RegExp(`^${Km(t)}$`)}function Wc(t){let e=Km({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Gm}T(?:${n})$`)}var Jc=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Hc=/^-?\d+n?$/,Gc=/^-?\d+$/,Bi=/^-?\d+(?:\.\d+)?$/,Kc=/^(?:true|false)$/i,Yc=/^null$/i;var Bc=/^undefined$/i;var Xc=/^[^A-Z]*$/,Qc=/^[^a-z]*$/,Wx=/^[0-9a-fA-F]*$/;function bo(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function xo(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var Jx=/^[0-9a-fA-F]{32}$/,Hx=bo(22,"=="),Gx=xo(22),Kx=/^[0-9a-fA-F]{40}$/,Yx=bo(27,"="),Bx=xo(27),Xx=/^[0-9a-fA-F]{64}$/,Qx=bo(43,"="),eS=xo(43),tS=/^[0-9a-fA-F]{96}$/,rS=bo(64,""),nS=xo(64),oS=/^[0-9a-fA-F]{128}$/,iS=bo(86,"=="),aS=xo(86);var ce=m("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Bm={number:"number",bigint:"bigint",object:"date"},eu=m("$ZodCheckLessThan",(t,e)=>{ce.init(t,e);let r=Bm[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),tu=m("$ZodCheckGreaterThan",(t,e)=>{ce.init(t,e);let r=Bm[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Xm=m("$ZodCheckMultipleOf",(t,e)=>{ce.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):_c(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Qm=m("$ZodCheckNumberFormat",(t,e)=>{ce.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=kc[e.format];t._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=o,s.maximum=i,r&&(s.pattern=Gc)}),t._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),eh=m("$ZodCheckBigIntFormat",(t,e)=>{ce.init(t,e);let[r,n]=wc[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),th=m("$ZodCheckMaxSize",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;o.size<=e.maximum||n.issues.push({origin:lo(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),rh=m("$ZodCheckMinSize",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:lo(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),nh=m("$ZodCheckSizeEquals",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let a=i>e.size;n.issues.push({origin:lo(o),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),oh=m("$ZodCheckMaxLength",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=po(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),ih=m("$ZodCheckMinLength",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=po(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),ah=m("$ZodCheckLengthEquals",(t,e)=>{var r;ce.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!ar(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let a=po(o),s=i>e.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),So=m("$ZodCheckStringFormat",(t,e)=>{var r,n;ce.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),sh=m("$ZodCheckRegex",(t,e)=>{So.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),ch=m("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Xc),So.init(t,e)}),uh=m("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Qc),So.init(t,e)}),lh=m("$ZodCheckIncludes",(t,e)=>{ce.init(t,e);let r=ot(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),dh=m("$ZodCheckStartsWith",(t,e)=>{ce.init(t,e);let r=new RegExp(`^${ot(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),ph=m("$ZodCheckEndsWith",(t,e)=>{ce.init(t,e);let r=new RegExp(`.*${ot(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function Ym(t,e,r){t.issues.length&&e.issues.push(...Qe(r,t.issues))}var fh=m("$ZodCheckProperty",(t,e)=>{ce.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Ym(o,r,e.property));Ym(n,r,e.property)}}),mh=m("$ZodCheckMimeType",(t,e)=>{ce.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),hh=m("$ZodCheckOverwrite",(t,e)=>{ce.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var Xi=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
18
18
|
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(`
|
|
19
|
-
`))}};var hh={major:4,minor:3,patch:6};var L=m("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=hh;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,s,c)=>{let u=ur(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&c?.async===!1)throw new Et;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(u||(u=ur(a,p)))});else{if(a.issues.length===p)continue;u||(u=ur(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(ur(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new Et;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(a,s)=>{if(s.skipChecks)return t._zod.parse(a,s);if(s.direction==="backward"){let u=t._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=t._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new Et;return c.then(u=>o(u,n,s))}return o(c,n,s)}}q(t,"~standard",()=>({validate:o=>{try{let i=cn(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return yo(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Ir=m("$ZodString",(t,e)=>{L.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Vc(t._zod.bag),t._zod.parse=(r,n)=>{if(e.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:t}),r}}),ie=m("$ZodStringFormat",(t,e)=>{xo.init(t,e),Ir.init(t,e)}),tu=m("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Oc),ie.init(t,e)}),ru=m("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Er(n))}else e.pattern??(e.pattern=Er());ie.init(t,e)}),nu=m("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=jc),ie.init(t,e)}),ou=m("$ZodURL",(t,e)=>{ie.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),iu=m("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Dc()),ie.init(t,e)}),au=m("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Pc),ie.init(t,e)}),su=m("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=kc),ie.init(t,e)}),cu=m("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=wc),ie.init(t,e)}),uu=m("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Ec),ie.init(t,e)}),lu=m("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Ic),ie.init(t,e)}),du=m("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=zc),ie.init(t,e)}),pu=m("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=qc(e)),ie.init(t,e)}),fu=m("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Lc),ie.init(t,e)}),mu=m("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Fc(e)),ie.init(t,e)}),hu=m("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Tc),ie.init(t,e)}),gu=m("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Nc),ie.init(t,e),t._zod.bag.format="ipv4"}),vu=m("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Mc),ie.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),_u=m("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=Rc(e.delimiter)),ie.init(t,e),t._zod.bag.format="mac"}),yu=m("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Ac),ie.init(t,e)}),$u=m("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Cc),ie.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Ih(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var bu=m("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Uc),ie.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{Ih(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function rS(t){if(!Ki.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Ih(r)}var xu=m("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ki),ie.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{rS(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Su=m("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Zc),ie.init(t,e)});function nS(t,e=null){try{let r=t.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||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var ku=m("$ZodJWT",(t,e)=>{ie.init(t,e),t._zod.check=r=>{nS(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),wu=m("$ZodCustomStringFormat",(t,e)=>{ie.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),na=m("$ZodNumber",(t,e)=>{L.init(t,e),t._zod.pattern=t._zod.bag.pattern??Yi,t._zod.parse=(r,n)=>{if(e.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 i=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:t,...i?{received:i}:{}}),r}}),Eu=m("$ZodNumberFormat",(t,e)=>{Bm.init(t,e),na.init(t,e)}),So=m("$ZodBoolean",(t,e)=>{L.init(t,e),t._zod.pattern=Hc,t._zod.parse=(r,n)=>{if(e.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:t}),r}}),oa=m("$ZodBigInt",(t,e)=>{L.init(t,e),t._zod.pattern=Wc,t._zod.parse=(r,n)=>{if(e.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:t}),r}}),Iu=m("$ZodBigIntFormat",(t,e)=>{Xm.init(t,e),oa.init(t,e)}),zu=m("$ZodSymbol",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),Pu=m("$ZodUndefined",(t,e)=>{L.init(t,e),t._zod.pattern=Kc,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),Tu=m("$ZodNull",(t,e)=>{L.init(t,e),t._zod.pattern=Gc,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),Ou=m("$ZodAny",(t,e)=>{L.init(t,e),t._zod.parse=r=>r}),ju=m("$ZodUnknown",(t,e)=>{L.init(t,e),t._zod.parse=r=>r}),Du=m("$ZodNever",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Nu=m("$ZodVoid",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),Mu=m("$ZodDate",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function gh(t,e,r){t.issues.length&&e.issues.push(...Qe(r,t.issues)),e.value[r]=t.value}var Ru=m("$ZodArray",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=e.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>gh(u,r,a))):gh(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function ra(t,e,r,n,o){if(t.issues.length){if(o&&!(r in n))return;e.issues.push(...Qe(r,t.issues))}t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function zh(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=bc(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function Ph(t,e,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in e){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:e[d],issues:[]},n);p instanceof Promise?t.push(p.then(f=>ra(f,r,d,e,l))):ra(p,r,d,e,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var Th=m("$ZodObject",(t,e)=>{if(L.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...s};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=an(()=>zh(e));q(t._zod,"propValues",()=>{let s=e.shape,c={};for(let u in s){let l=s[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=wr,i=e.catchall,a;t._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let f=d[p],h=f._zod.optout==="optional",g=f._zod.run({value:u[p],issues:[]},c);g instanceof Promise?l.push(g.then($=>ra($,s,p,u,h))):ra(g,s,p,u,h)}return i?Ph(l,u,s,c,n.value,t):l.length?Promise.all(l).then(()=>s):s}}),Oh=m("$ZodObjectJIT",(t,e)=>{Th.init(t,e);let r=t._zod.parse,n=an(()=>zh(e)),o=p=>{let f=new Bi(["shape","payload","ctx"]),h=n.value,g=x=>{let N=Vi(x);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};f.write("const input = payload.value;");let $=Object.create(null),k=0;for(let x of h.keys)$[x]=`key_${k++}`;f.write("const newResult = {};");for(let x of h.keys){let N=$[x],T=Vi(x),We=p[x]?._zod?.optout==="optional";f.write(`const ${N} = ${g(x)};`),We?f.write(`
|
|
19
|
+
`))}};var vh={major:4,minor:3,patch:6};var L=m("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=vh;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,s,c)=>{let u=ur(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&c?.async===!1)throw new It;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(u||(u=ur(a,p)))});else{if(a.issues.length===p)continue;u||(u=ur(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(ur(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new It;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(a,s)=>{if(s.skipChecks)return t._zod.parse(a,s);if(s.direction==="backward"){let u=t._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=t._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new It;return c.then(u=>o(u,n,s))}return o(c,n,s)}}q(t,"~standard",()=>({validate:o=>{try{let i=un(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return $o(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),zr=m("$ZodString",(t,e)=>{L.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Jc(t._zod.bag),t._zod.parse=(r,n)=>{if(e.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:t}),r}}),ie=m("$ZodStringFormat",(t,e)=>{So.init(t,e),zr.init(t,e)}),nu=m("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Dc),ie.init(t,e)}),ou=m("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Ir(n))}else e.pattern??(e.pattern=Ir());ie.init(t,e)}),iu=m("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Nc),ie.init(t,e)}),au=m("$ZodURL",(t,e)=>{ie.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),su=m("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Mc()),ie.init(t,e)}),cu=m("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Oc),ie.init(t,e)}),uu=m("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Ec),ie.init(t,e)}),lu=m("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Ic),ie.init(t,e)}),du=m("$ZodULID",(t,e)=>{e.pattern??(e.pattern=zc),ie.init(t,e)}),pu=m("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Pc),ie.init(t,e)}),fu=m("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Tc),ie.init(t,e)}),mu=m("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Wc(e)),ie.init(t,e)}),hu=m("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=qc),ie.init(t,e)}),gu=m("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Vc(e)),ie.init(t,e)}),vu=m("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=jc),ie.init(t,e)}),_u=m("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Rc),ie.init(t,e),t._zod.bag.format="ipv4"}),yu=m("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Ac),ie.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),$u=m("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=Cc(e.delimiter)),ie.init(t,e),t._zod.bag.format="mac"}),bu=m("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Uc),ie.init(t,e)}),xu=m("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Zc),ie.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Ph(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Su=m("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Lc),ie.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{Ph(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function sS(t){if(!Yi.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Ph(r)}var ku=m("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Yi),ie.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{sS(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),wu=m("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Fc),ie.init(t,e)});function cS(t,e=null){try{let r=t.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||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var Eu=m("$ZodJWT",(t,e)=>{ie.init(t,e),t._zod.check=r=>{cS(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Iu=m("$ZodCustomStringFormat",(t,e)=>{ie.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),oa=m("$ZodNumber",(t,e)=>{L.init(t,e),t._zod.pattern=t._zod.bag.pattern??Bi,t._zod.parse=(r,n)=>{if(e.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 i=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:t,...i?{received:i}:{}}),r}}),zu=m("$ZodNumberFormat",(t,e)=>{Qm.init(t,e),oa.init(t,e)}),ko=m("$ZodBoolean",(t,e)=>{L.init(t,e),t._zod.pattern=Kc,t._zod.parse=(r,n)=>{if(e.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:t}),r}}),ia=m("$ZodBigInt",(t,e)=>{L.init(t,e),t._zod.pattern=Hc,t._zod.parse=(r,n)=>{if(e.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:t}),r}}),Pu=m("$ZodBigIntFormat",(t,e)=>{eh.init(t,e),ia.init(t,e)}),Tu=m("$ZodSymbol",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),Ou=m("$ZodUndefined",(t,e)=>{L.init(t,e),t._zod.pattern=Bc,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),ju=m("$ZodNull",(t,e)=>{L.init(t,e),t._zod.pattern=Yc,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),Du=m("$ZodAny",(t,e)=>{L.init(t,e),t._zod.parse=r=>r}),Nu=m("$ZodUnknown",(t,e)=>{L.init(t,e),t._zod.parse=r=>r}),Mu=m("$ZodNever",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Ru=m("$ZodVoid",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),Au=m("$ZodDate",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function _h(t,e,r){t.issues.length&&e.issues.push(...Qe(r,t.issues)),e.value[r]=t.value}var Cu=m("$ZodArray",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=e.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>_h(u,r,a))):_h(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function na(t,e,r,n,o){if(t.issues.length){if(o&&!(r in n))return;e.issues.push(...Qe(r,t.issues))}t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function Th(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Sc(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function Oh(t,e,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in e){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:e[d],issues:[]},n);p instanceof Promise?t.push(p.then(f=>na(f,r,d,e,l))):na(p,r,d,e,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var jh=m("$ZodObject",(t,e)=>{if(L.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...s};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=sn(()=>Th(e));q(t._zod,"propValues",()=>{let s=e.shape,c={};for(let u in s){let l=s[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=Er,i=e.catchall,a;t._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let f=d[p],h=f._zod.optout==="optional",g=f._zod.run({value:u[p],issues:[]},c);g instanceof Promise?l.push(g.then($=>na($,s,p,u,h))):na(g,s,p,u,h)}return i?Oh(l,u,s,c,n.value,t):l.length?Promise.all(l).then(()=>s):s}}),Dh=m("$ZodObjectJIT",(t,e)=>{jh.init(t,e);let r=t._zod.parse,n=sn(()=>Th(e)),o=p=>{let f=new Xi(["shape","payload","ctx"]),h=n.value,g=x=>{let N=Wi(x);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};f.write("const input = payload.value;");let $=Object.create(null),k=0;for(let x of h.keys)$[x]=`key_${k++}`;f.write("const newResult = {};");for(let x of h.keys){let N=$[x],T=Wi(x),We=p[x]?._zod?.optout==="optional";f.write(`const ${N} = ${g(x)};`),We?f.write(`
|
|
20
20
|
if (${N}.issues.length) {
|
|
21
21
|
if (${T} in input) {
|
|
22
22
|
payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
|
|
@@ -50,11 +50,11 @@ ${i.stack}`:` ${i.message}`:this.getLevel()===0&&typeof i=="object"?l=`
|
|
|
50
50
|
newResult[${T}] = ${N}.value;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
`)}f.write("payload.value = newResult;"),f.write("return payload;");let S=f.compile();return(x,N)=>S(p,x,N)},i,a=wr,s=!qi.jitless,u=s&&_c.value,l=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=n.value);let h=p.value;return a(h)?s&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=o(e.shape)),p=i(p,f),l?Ph([],h,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),p)}});function vh(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!ur(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>Je(a,n,be())))}),e)}var ko=m("$ZodUnion",(t,e)=>{L.init(t,e),q(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),q(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),q(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),q(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>so(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>vh(c,o,t,i)):vh(s,o,t,i)}});function _h(t,e,r,n){let o=t.filter(i=>i.issues.length===0);return o.length===1?(e.value=o[0].value,e):(o.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>Je(a,n,be())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}var Au=m("$ZodXor",(t,e)=>{ko.init(t,e),e.inclusive=!1;let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>_h(c,o,t,i)):_h(s,o,t,i)}}),Cu=m("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,ko.init(t,e);let r=t._zod.parse;q(t._zod,"propValues",()=>{let o={};for(let i of e.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=an(()=>{let o=e.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});t._zod.parse=(o,i)=>{let a=o.value;if(!wr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),o;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:a,path:[e.discriminator],inst:t}),o)}}),Uu=m("$ZodIntersection",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),a=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>yh(r,c,u)):yh(r,i,a)}});function eu(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(cr(t)&&cr(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let a=eu(t[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],a=eu(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function yh(t,e,r){let n=new Map,o;for(let s of e.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else t.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else t.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&t.issues.push({...o,keys:i}),ur(t))return t;let a=eu(e.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}var ia=m("$ZodTuple",(t,e)=>{L.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!e.rest){let l=i.length>r.length,d=i.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:t,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(p=>Xi(p,n,u))):Xi(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let p=e.rest._zod.run({value:d,issues:[]},o);p instanceof Promise?a.push(p.then(f=>Xi(f,n,u))):Xi(p,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Xi(t,e,r){t.issues.length&&e.issues.push(...Qe(r,t.issues)),e.value[r]=t.value}var Zu=m("$ZodRecord",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!cr(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],a=e.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Qe(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Qe(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=e.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Yi.test(s)&&c.issues.length){let d=e.keyType._zod.run({value:Number(s),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){e.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Je(d,n,be())),input:s,path:[s],inst:t});continue}let l=e.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Qe(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Qe(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),Lu=m("$ZodMap",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=e.keyType._zod.run({value:a,issues:[]},n),u=e.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{$h(l,d,r,a,o,t,n)})):$h(c,u,r,a,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function $h(t,e,r,n,o,i,a){t.issues.length&&(co.has(typeof n)?r.issues.push(...Qe(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(s=>Je(s,a,be()))})),e.issues.length&&(co.has(typeof n)?r.issues.push(...Qe(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>Je(s,a,be()))})),r.value.set(t.value,e.value)}var Fu=m("$ZodSet",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=e.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>bh(c,r))):bh(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function bh(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var qu=m("$ZodEnum",(t,e)=>{L.init(t,e);let r=ao(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>co.has(typeof o)).map(o=>typeof o=="string"?ot(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:t}),o}}),Vu=m("$ZodLiteral",(t,e)=>{if(L.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?ot(n):n?ot(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),Wu=m("$ZodFile",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),Ju=m("$ZodTransform",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new kr(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new Et;return r.value=o,r}});function xh(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var aa=m("$ZodOptional",(t,e)=>{L.init(t,e),t._zod.optin="optional",t._zod.optout="optional",q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),q(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${so(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>xh(i,r.value)):xh(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),Hu=m("$ZodExactOptional",(t,e)=>{aa.init(t,e),q(t._zod,"values",()=>e.innerType._zod.values),q(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),Gu=m("$ZodNullable",(t,e)=>{L.init(t,e),q(t._zod,"optin",()=>e.innerType._zod.optin),q(t._zod,"optout",()=>e.innerType._zod.optout),q(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${so(r.source)}|null)$`):void 0}),q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),Ku=m("$ZodDefault",(t,e)=>{L.init(t,e),t._zod.optin="optional",q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Sh(i,e)):Sh(o,e)}});function Sh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Yu=m("$ZodPrefault",(t,e)=>{L.init(t,e),t._zod.optin="optional",q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),Bu=m("$ZodNonOptional",(t,e)=>{L.init(t,e),q(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>kh(i,t)):kh(o,t)}});function kh(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var Xu=m("$ZodSuccess",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new kr("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),Qu=m("$ZodCatch",(t,e)=>{L.init(t,e),q(t._zod,"optin",()=>e.innerType._zod.optin),q(t._zod,"optout",()=>e.innerType._zod.optout),q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>Je(a,n,be()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>Je(i,n,be()))},input:r.value}),r.issues=[]),r)}}),el=m("$ZodNaN",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),tl=m("$ZodPipe",(t,e)=>{L.init(t,e),q(t._zod,"values",()=>e.in._zod.values),q(t._zod,"optin",()=>e.in._zod.optin),q(t._zod,"optout",()=>e.out._zod.optout),q(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Qi(a,e.in,n)):Qi(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Qi(i,e.out,n)):Qi(o,e.out,n)}});function Qi(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var wo=m("$ZodCodec",(t,e)=>{L.init(t,e),q(t._zod,"values",()=>e.in._zod.values),q(t._zod,"optin",()=>e.in._zod.optin),q(t._zod,"optout",()=>e.out._zod.optout),q(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(a=>ea(a,e,n)):ea(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>ea(a,e,n)):ea(i,e,n)}}});function ea(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>ta(t,i,e.out,r)):ta(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>ta(t,i,e.in,r)):ta(t,o,e.in,r)}}function ta(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var rl=m("$ZodReadonly",(t,e)=>{L.init(t,e),q(t._zod,"propValues",()=>e.innerType._zod.propValues),q(t._zod,"values",()=>e.innerType._zod.values),q(t._zod,"optin",()=>e.innerType?._zod?.optin),q(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(wh):wh(o)}});function wh(t){return t.value=Object.freeze(t.value),t}var nl=m("$ZodTemplateLiteral",(t,e)=>{L.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||$c.has(typeof n))r.push(ot(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"string",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),ol=m("$ZodFunction",(t,e)=>(L.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?mo(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?mo(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await go(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await go(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new ia({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),il=m("$ZodPromise",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),al=m("$ZodLazy",(t,e)=>{L.init(t,e),q(t._zod,"innerType",()=>e.getter()),q(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),q(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),q(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),q(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),sl=m("$ZodCustom",(t,e)=>{ce.init(t,e),L.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>Eh(i,r,n,t));Eh(o,r,n,t)}});function Eh(t,e,r,n){if(!t){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),e.issues.push(sn(o))}}var iS=()=>{let t={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 e(o){return t[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 i=n[o.expected]??o.expected,a=U(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${A(o.values[0])}`:`Invalid option: expected one of ${R(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.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":""}: ${R(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function cl(){return{localeError:iS()}}var jh;var ll=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function dl(){return new ll}(jh=globalThis).__zod_globalRegistry??(jh.__zod_globalRegistry=dl());var Ce=globalThis.__zod_globalRegistry;function pl(t,e){return new t({type:"string",...E(e)})}function sa(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...E(e)})}function Eo(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...E(e)})}function ca(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...E(e)})}function ua(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(e)})}function la(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(e)})}function da(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(e)})}function Io(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...E(e)})}function pa(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...E(e)})}function fa(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(e)})}function ma(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...E(e)})}function ha(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(e)})}function ga(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...E(e)})}function va(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...E(e)})}function _a(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(e)})}function ya(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(e)})}function $a(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(e)})}function fl(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...E(e)})}function ba(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(e)})}function xa(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(e)})}function Sa(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...E(e)})}function ka(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...E(e)})}function wa(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...E(e)})}function Ea(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...E(e)})}function ml(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(e)})}function hl(t,e){return new t({type:"string",format:"date",check:"string_format",...E(e)})}function gl(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...E(e)})}function vl(t,e){return new t({type:"string",format:"duration",check:"string_format",...E(e)})}function _l(t,e){return new t({type:"number",checks:[],...E(e)})}function yl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...E(e)})}function $l(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...E(e)})}function bl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...E(e)})}function xl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...E(e)})}function Sl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...E(e)})}function kl(t,e){return new t({type:"boolean",...E(e)})}function wl(t,e){return new t({type:"bigint",...E(e)})}function El(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...E(e)})}function Il(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...E(e)})}function zl(t,e){return new t({type:"symbol",...E(e)})}function Pl(t,e){return new t({type:"undefined",...E(e)})}function Tl(t,e){return new t({type:"null",...E(e)})}function Ol(t){return new t({type:"any"})}function jl(t){return new t({type:"unknown"})}function Dl(t,e){return new t({type:"never",...E(e)})}function Nl(t,e){return new t({type:"void",...E(e)})}function Ml(t,e){return new t({type:"date",...E(e)})}function Rl(t,e){return new t({type:"nan",...E(e)})}function Lt(t,e){return new Xc({check:"less_than",...E(e),value:t,inclusive:!1})}function et(t,e){return new Xc({check:"less_than",...E(e),value:t,inclusive:!0})}function Ft(t,e){return new Qc({check:"greater_than",...E(e),value:t,inclusive:!1})}function Ue(t,e){return new Qc({check:"greater_than",...E(e),value:t,inclusive:!0})}function Al(t){return Ft(0,t)}function Cl(t){return Lt(0,t)}function Ul(t){return et(0,t)}function Zl(t){return Ue(0,t)}function zr(t,e){return new Ym({check:"multiple_of",...E(e),value:t})}function Pr(t,e){return new Qm({check:"max_size",...E(e),maximum:t})}function qt(t,e){return new eh({check:"min_size",...E(e),minimum:t})}function un(t,e){return new th({check:"size_equals",...E(e),size:t})}function ln(t,e){return new rh({check:"max_length",...E(e),maximum:t})}function lr(t,e){return new nh({check:"min_length",...E(e),minimum:t})}function dn(t,e){return new oh({check:"length_equals",...E(e),length:t})}function zo(t,e){return new ih({check:"string_format",format:"regex",...E(e),pattern:t})}function Po(t){return new ah({check:"string_format",format:"lowercase",...E(t)})}function To(t){return new sh({check:"string_format",format:"uppercase",...E(t)})}function Oo(t,e){return new ch({check:"string_format",format:"includes",...E(e),includes:t})}function jo(t,e){return new uh({check:"string_format",format:"starts_with",...E(e),prefix:t})}function Do(t,e){return new lh({check:"string_format",format:"ends_with",...E(e),suffix:t})}function Ll(t,e,r){return new dh({check:"property",property:t,schema:e,...E(r)})}function No(t,e){return new ph({check:"mime_type",mime:t,...E(e)})}function It(t){return new fh({check:"overwrite",tx:t})}function Mo(t){return It(e=>e.normalize(t))}function Ro(){return It(t=>t.trim())}function Ao(){return It(t=>t.toLowerCase())}function Co(){return It(t=>t.toUpperCase())}function Ia(){return It(t=>vc(t))}function Dh(t,e,r){return new t({type:"array",element:e,...E(r)})}function Fl(t,e){return new t({type:"file",...E(e)})}function ql(t,e,r){let n=E(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function Vl(t,e,r){return new t({type:"custom",check:"custom",fn:e,...E(r)})}function Wl(t){let e=uS(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(sn(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(sn(o))}},t(r.value,r)));return e}function uS(t,e){let r=new ce({check:"custom",...E(e)});return r._zod.check=t,r}function Jl(t){let e=new ce({check:"describe"});return e._zod.onattach=[r=>{let n=Ce.get(r)??{};Ce.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function Hl(t){let e=new ce({check:"meta"});return e._zod.onattach=[r=>{let n=Ce.get(r)??{};Ce.add(r,{...n,...t})}],e._zod.check=()=>{},e}function Gl(t,e){let r=E(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(f=>typeof f=="string"?f.toLowerCase():f),o=o.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(n),a=new Set(o),s=t.Codec??wo,c=t.Boolean??So,u=t.String??Ir,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new s({type:"pipe",in:l,out:d,transform:((f,h)=>{let g=f;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:a.has(g)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:h.value,inst:p,continue:!1}),{})}),reverseTransform:((f,h)=>f===!0?n[0]||"true":o[0]||"false"),error:r.error});return p}function pn(t,e,r,n={}){let o=E(n),i={...E(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}function za(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??Ce,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function fe(t,e,r={path:[],schemaPath:[]}){var n;let o=t._zod.def,i=e.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,a);let s=t._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,a.schema,l);else{let p=a.schema,f=e.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(t,e,p,l)}let d=t._zod.parent;d&&(a.ref||(a.ref=d),fe(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(a.schema,c),e.io==="input"&&Ze(t)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(t).schema}function Pa(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of t.seen.entries()){let s=t.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(a[0])?.id,p=t.external.uri??(h=>h);if(d)return{ref:p(d)};let f=a[1].defId??a[1].schema.id??`schema${t.counter++}`;return a[1].defId=f,{defId:f,ref:`${p("__shared")}#/${s}/${f}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(t.cycles==="throw")for(let a of t.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
53
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let S=f.compile();return(x,N)=>S(p,x,N)},i,a=Er,s=!Vi.jitless,u=s&&$c.value,l=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=n.value);let h=p.value;return a(h)?s&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=o(e.shape)),p=i(p,f),l?Oh([],h,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),p)}});function yh(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!ur(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>Je(a,n,be())))}),e)}var wo=m("$ZodUnion",(t,e)=>{L.init(t,e),q(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),q(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),q(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),q(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>co(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>yh(c,o,t,i)):yh(s,o,t,i)}});function $h(t,e,r,n){let o=t.filter(i=>i.issues.length===0);return o.length===1?(e.value=o[0].value,e):(o.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>Je(a,n,be())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}var Uu=m("$ZodXor",(t,e)=>{wo.init(t,e),e.inclusive=!1;let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>$h(c,o,t,i)):$h(s,o,t,i)}}),Zu=m("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,wo.init(t,e);let r=t._zod.parse;q(t._zod,"propValues",()=>{let o={};for(let i of e.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=sn(()=>{let o=e.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});t._zod.parse=(o,i)=>{let a=o.value;if(!Er(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),o;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:a,path:[e.discriminator],inst:t}),o)}}),Lu=m("$ZodIntersection",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),a=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>bh(r,c,u)):bh(r,i,a)}});function ru(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(cr(t)&&cr(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let a=ru(t[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],a=ru(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bh(t,e,r){let n=new Map,o;for(let s of e.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else t.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else t.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&t.issues.push({...o,keys:i}),ur(t))return t;let a=ru(e.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}var aa=m("$ZodTuple",(t,e)=>{L.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!e.rest){let l=i.length>r.length,d=i.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:t,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(p=>Qi(p,n,u))):Qi(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let p=e.rest._zod.run({value:d,issues:[]},o);p instanceof Promise?a.push(p.then(f=>Qi(f,n,u))):Qi(p,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Qi(t,e,r){t.issues.length&&e.issues.push(...Qe(r,t.issues)),e.value[r]=t.value}var Fu=m("$ZodRecord",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!cr(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],a=e.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Qe(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Qe(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=e.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Bi.test(s)&&c.issues.length){let d=e.keyType._zod.run({value:Number(s),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){e.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Je(d,n,be())),input:s,path:[s],inst:t});continue}let l=e.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Qe(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Qe(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),qu=m("$ZodMap",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=e.keyType._zod.run({value:a,issues:[]},n),u=e.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{xh(l,d,r,a,o,t,n)})):xh(c,u,r,a,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function xh(t,e,r,n,o,i,a){t.issues.length&&(uo.has(typeof n)?r.issues.push(...Qe(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(s=>Je(s,a,be()))})),e.issues.length&&(uo.has(typeof n)?r.issues.push(...Qe(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>Je(s,a,be()))})),r.value.set(t.value,e.value)}var Vu=m("$ZodSet",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=e.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>Sh(c,r))):Sh(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Sh(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var Wu=m("$ZodEnum",(t,e)=>{L.init(t,e);let r=so(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>uo.has(typeof o)).map(o=>typeof o=="string"?ot(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:t}),o}}),Ju=m("$ZodLiteral",(t,e)=>{if(L.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?ot(n):n?ot(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),Hu=m("$ZodFile",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),Gu=m("$ZodTransform",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new wr(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new It;return r.value=o,r}});function kh(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var sa=m("$ZodOptional",(t,e)=>{L.init(t,e),t._zod.optin="optional",t._zod.optout="optional",q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),q(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${co(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>kh(i,r.value)):kh(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),Ku=m("$ZodExactOptional",(t,e)=>{sa.init(t,e),q(t._zod,"values",()=>e.innerType._zod.values),q(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),Yu=m("$ZodNullable",(t,e)=>{L.init(t,e),q(t._zod,"optin",()=>e.innerType._zod.optin),q(t._zod,"optout",()=>e.innerType._zod.optout),q(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${co(r.source)}|null)$`):void 0}),q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),Bu=m("$ZodDefault",(t,e)=>{L.init(t,e),t._zod.optin="optional",q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>wh(i,e)):wh(o,e)}});function wh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Xu=m("$ZodPrefault",(t,e)=>{L.init(t,e),t._zod.optin="optional",q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),Qu=m("$ZodNonOptional",(t,e)=>{L.init(t,e),q(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Eh(i,t)):Eh(o,t)}});function Eh(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var el=m("$ZodSuccess",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new wr("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),tl=m("$ZodCatch",(t,e)=>{L.init(t,e),q(t._zod,"optin",()=>e.innerType._zod.optin),q(t._zod,"optout",()=>e.innerType._zod.optout),q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>Je(a,n,be()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>Je(i,n,be()))},input:r.value}),r.issues=[]),r)}}),rl=m("$ZodNaN",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),nl=m("$ZodPipe",(t,e)=>{L.init(t,e),q(t._zod,"values",()=>e.in._zod.values),q(t._zod,"optin",()=>e.in._zod.optin),q(t._zod,"optout",()=>e.out._zod.optout),q(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>ea(a,e.in,n)):ea(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ea(i,e.out,n)):ea(o,e.out,n)}});function ea(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var Eo=m("$ZodCodec",(t,e)=>{L.init(t,e),q(t._zod,"values",()=>e.in._zod.values),q(t._zod,"optin",()=>e.in._zod.optin),q(t._zod,"optout",()=>e.out._zod.optout),q(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(a=>ta(a,e,n)):ta(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>ta(a,e,n)):ta(i,e,n)}}});function ta(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>ra(t,i,e.out,r)):ra(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>ra(t,i,e.in,r)):ra(t,o,e.in,r)}}function ra(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var ol=m("$ZodReadonly",(t,e)=>{L.init(t,e),q(t._zod,"propValues",()=>e.innerType._zod.propValues),q(t._zod,"values",()=>e.innerType._zod.values),q(t._zod,"optin",()=>e.innerType?._zod?.optin),q(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(Ih):Ih(o)}});function Ih(t){return t.value=Object.freeze(t.value),t}var il=m("$ZodTemplateLiteral",(t,e)=>{L.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||xc.has(typeof n))r.push(ot(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"string",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),al=m("$ZodFunction",(t,e)=>(L.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?ho(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?ho(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await vo(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await vo(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new aa({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),sl=m("$ZodPromise",(t,e)=>{L.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),cl=m("$ZodLazy",(t,e)=>{L.init(t,e),q(t._zod,"innerType",()=>e.getter()),q(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),q(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),q(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),q(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),ul=m("$ZodCustom",(t,e)=>{ce.init(t,e),L.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>zh(i,r,n,t));zh(o,r,n,t)}});function zh(t,e,r,n){if(!t){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),e.issues.push(cn(o))}}var lS=()=>{let t={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 e(o){return t[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 i=n[o.expected]??o.expected,a=U(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${A(o.values[0])}`:`Invalid option: expected one of ${R(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.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":""}: ${R(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function ll(){return{localeError:lS()}}var Nh;var pl=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fl(){return new pl}(Nh=globalThis).__zod_globalRegistry??(Nh.__zod_globalRegistry=fl());var Ce=globalThis.__zod_globalRegistry;function ml(t,e){return new t({type:"string",...E(e)})}function ca(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...E(e)})}function Io(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...E(e)})}function ua(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...E(e)})}function la(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(e)})}function da(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(e)})}function pa(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(e)})}function zo(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...E(e)})}function fa(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...E(e)})}function ma(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(e)})}function ha(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...E(e)})}function ga(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(e)})}function va(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...E(e)})}function _a(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...E(e)})}function ya(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(e)})}function $a(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(e)})}function ba(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(e)})}function hl(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...E(e)})}function xa(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(e)})}function Sa(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(e)})}function ka(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...E(e)})}function wa(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...E(e)})}function Ea(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...E(e)})}function Ia(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...E(e)})}function gl(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(e)})}function vl(t,e){return new t({type:"string",format:"date",check:"string_format",...E(e)})}function _l(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...E(e)})}function yl(t,e){return new t({type:"string",format:"duration",check:"string_format",...E(e)})}function $l(t,e){return new t({type:"number",checks:[],...E(e)})}function bl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...E(e)})}function xl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...E(e)})}function Sl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...E(e)})}function kl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...E(e)})}function wl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...E(e)})}function El(t,e){return new t({type:"boolean",...E(e)})}function Il(t,e){return new t({type:"bigint",...E(e)})}function zl(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...E(e)})}function Pl(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...E(e)})}function Tl(t,e){return new t({type:"symbol",...E(e)})}function Ol(t,e){return new t({type:"undefined",...E(e)})}function jl(t,e){return new t({type:"null",...E(e)})}function Dl(t){return new t({type:"any"})}function Nl(t){return new t({type:"unknown"})}function Ml(t,e){return new t({type:"never",...E(e)})}function Rl(t,e){return new t({type:"void",...E(e)})}function Al(t,e){return new t({type:"date",...E(e)})}function Cl(t,e){return new t({type:"nan",...E(e)})}function Ft(t,e){return new eu({check:"less_than",...E(e),value:t,inclusive:!1})}function et(t,e){return new eu({check:"less_than",...E(e),value:t,inclusive:!0})}function qt(t,e){return new tu({check:"greater_than",...E(e),value:t,inclusive:!1})}function Ue(t,e){return new tu({check:"greater_than",...E(e),value:t,inclusive:!0})}function Ul(t){return qt(0,t)}function Zl(t){return Ft(0,t)}function Ll(t){return et(0,t)}function Fl(t){return Ue(0,t)}function Pr(t,e){return new Xm({check:"multiple_of",...E(e),value:t})}function Tr(t,e){return new th({check:"max_size",...E(e),maximum:t})}function Vt(t,e){return new rh({check:"min_size",...E(e),minimum:t})}function ln(t,e){return new nh({check:"size_equals",...E(e),size:t})}function dn(t,e){return new oh({check:"max_length",...E(e),maximum:t})}function lr(t,e){return new ih({check:"min_length",...E(e),minimum:t})}function pn(t,e){return new ah({check:"length_equals",...E(e),length:t})}function Po(t,e){return new sh({check:"string_format",format:"regex",...E(e),pattern:t})}function To(t){return new ch({check:"string_format",format:"lowercase",...E(t)})}function Oo(t){return new uh({check:"string_format",format:"uppercase",...E(t)})}function jo(t,e){return new lh({check:"string_format",format:"includes",...E(e),includes:t})}function Do(t,e){return new dh({check:"string_format",format:"starts_with",...E(e),prefix:t})}function No(t,e){return new ph({check:"string_format",format:"ends_with",...E(e),suffix:t})}function ql(t,e,r){return new fh({check:"property",property:t,schema:e,...E(r)})}function Mo(t,e){return new mh({check:"mime_type",mime:t,...E(e)})}function zt(t){return new hh({check:"overwrite",tx:t})}function Ro(t){return zt(e=>e.normalize(t))}function Ao(){return zt(t=>t.trim())}function Co(){return zt(t=>t.toLowerCase())}function Uo(){return zt(t=>t.toUpperCase())}function za(){return zt(t=>yc(t))}function Mh(t,e,r){return new t({type:"array",element:e,...E(r)})}function Vl(t,e){return new t({type:"file",...E(e)})}function Wl(t,e,r){let n=E(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function Jl(t,e,r){return new t({type:"custom",check:"custom",fn:e,...E(r)})}function Hl(t){let e=mS(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(cn(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(cn(o))}},t(r.value,r)));return e}function mS(t,e){let r=new ce({check:"custom",...E(e)});return r._zod.check=t,r}function Gl(t){let e=new ce({check:"describe"});return e._zod.onattach=[r=>{let n=Ce.get(r)??{};Ce.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function Kl(t){let e=new ce({check:"meta"});return e._zod.onattach=[r=>{let n=Ce.get(r)??{};Ce.add(r,{...n,...t})}],e._zod.check=()=>{},e}function Yl(t,e){let r=E(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(f=>typeof f=="string"?f.toLowerCase():f),o=o.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(n),a=new Set(o),s=t.Codec??Eo,c=t.Boolean??ko,u=t.String??zr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new s({type:"pipe",in:l,out:d,transform:((f,h)=>{let g=f;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:a.has(g)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:h.value,inst:p,continue:!1}),{})}),reverseTransform:((f,h)=>f===!0?n[0]||"true":o[0]||"false"),error:r.error});return p}function fn(t,e,r,n={}){let o=E(n),i={...E(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}function Pa(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??Ce,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function fe(t,e,r={path:[],schemaPath:[]}){var n;let o=t._zod.def,i=e.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,a);let s=t._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,a.schema,l);else{let p=a.schema,f=e.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(t,e,p,l)}let d=t._zod.parent;d&&(a.ref||(a.ref=d),fe(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(a.schema,c),e.io==="input"&&Ze(t)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(t).schema}function Ta(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of t.seen.entries()){let s=t.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(a[0])?.id,p=t.external.uri??(h=>h);if(d)return{ref:p(d)};let f=a[1].defId??a[1].schema.id??`schema${t.counter++}`;return a[1].defId=f,{defId:f,ref:`${p("__shared")}#/${s}/${f}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(t.cycles==="throw")for(let a of t.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
54
54
|
|
|
55
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let s=a[1];if(e===a[0]){i(a);continue}if(t.external){let u=t.external.registry.get(a[0])?.id;if(e!==a[0]&&u){i(a);continue}}if(t.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&t.reused==="ref"){i(a);continue}}}function Ta(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=t.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let p=t.seen.get(l),f=p.schema;if(f.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),a._zod.parent===l)for(let g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(f.$ref&&p.def)for(let g in c)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(c[g])===JSON.stringify(p.def[g])&&delete c[g]}let d=a._zod.parent;if(d&&d!==l){n(d);let p=t.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}t.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(a)}Object.assign(o,r.def??r.schema);let i=t.external?.defs??{};for(let a of t.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Uo(e,"input",t.processors),output:Uo(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ze(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ze(n.element,r);if(n.type==="set")return Ze(n.valueType,r);if(n.type==="lazy")return Ze(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 Ze(n.innerType,r);if(n.type==="intersection")return Ze(n.left,r)||Ze(n.right,r);if(n.type==="record"||n.type==="map")return Ze(n.keyType,r)||Ze(n.valueType,r);if(n.type==="pipe")return Ze(n.in,r)||Ze(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ze(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ze(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ze(o,r))return!0;return!!(n.rest&&Ze(n.rest,r))}return!1}var Nh=(t,e={})=>r=>{let n=za({...r,processors:e});return fe(t,n),Pa(n,t),Ta(n,t)},Uo=(t,e,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=za({...o??{},target:i,io:e,processors:r});return fe(t,a),Pa(a,t),Ta(a,t)};var lS={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Mh=(t,e,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=lS[s]??s,o.format===""&&delete o.format,s==="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=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Rh=(t,e,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&e.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&e.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Ah=(t,e,r,n)=>{r.type="boolean"},Ch=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Uh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Zh=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Lh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Fh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},qh=(t,e,r,n)=>{r.not={}},Vh=(t,e,r,n)=>{},Wh=(t,e,r,n)=>{},Jh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Hh=(t,e,r,n)=>{let o=t._zod.def,i=ao(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Gh=(t,e,r,n)=>{let o=t._zod.def,i=[];for(let a of o.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Kh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Yh=(t,e,r,n)=>{let o=r,i=t._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Bh=(t,e,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=t._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},Xh=(t,e,r,n)=>{r.type="boolean"},Qh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},eg=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},tg=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},rg=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},ng=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},og=(t,e,r,n)=>{let o=r,i=t._zod.def,{minimum:a,maximum:s}=t._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=fe(i.element,e,{...n,path:[...n.path,"items"]})},ig=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=fe(a[u],e,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=fe(i.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},Kl=(t,e,r,n)=>{let o=t._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>fe(s,e,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},ag=(t,e,r,n)=>{let o=t._zod.def,i=fe(o.left,e,{...n,path:[...n.path,"allOf",0]}),a=fe(o.right,e,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},sg=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="array";let a=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,f)=>fe(p,e,{...n,path:[...n.path,a,f]})),u=i.rest?fe(i.rest,e,{...n,path:[...n.path,s,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null;e.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):e.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=t._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},cg=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=fe(i.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=fe(i.keyType,e,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=fe(i.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},ug=(t,e,r,n)=>{let o=t._zod.def,i=fe(o.innerType,e,n),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},lg=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},dg=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},pg=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},fg=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},mg=(t,e,r,n)=>{let o=t._zod.def,i=e.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;fe(i,e,n);let a=e.seen.get(t);a.ref=i},hg=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.readOnly=!0},gg=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},Yl=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},vg=(t,e,r,n)=>{let o=t._zod.innerType;fe(o,e,n);let i=e.seen.get(t);i.ref=o};function fn(t){return!!t._zod}function dr(t,e){return fn(t)?cn(t,e):t.safeParse(e)}function Oa(t){if(!t)return;let e;if(fn(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function bg(t){if(fn(t)){let i=t._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var Zo={};Wn(Zo,{ZodAny:()=>Ug,ZodArray:()=>qg,ZodBase64:()=>$d,ZodBase64URL:()=>bd,ZodBigInt:()=>Za,ZodBigIntFormat:()=>kd,ZodBoolean:()=>Ua,ZodCIDRv4:()=>_d,ZodCIDRv6:()=>yd,ZodCUID:()=>dd,ZodCUID2:()=>pd,ZodCatch:()=>uv,ZodCodec:()=>Od,ZodCustom:()=>Ja,ZodCustomStringFormat:()=>Fo,ZodDate:()=>Ed,ZodDefault:()=>nv,ZodDiscriminatedUnion:()=>Wg,ZodE164:()=>xd,ZodEmail:()=>cd,ZodEmoji:()=>ud,ZodEnum:()=>Lo,ZodExactOptional:()=>ev,ZodFile:()=>Xg,ZodFunction:()=>_v,ZodGUID:()=>Da,ZodIPv4:()=>gd,ZodIPv6:()=>vd,ZodIntersection:()=>Jg,ZodJWT:()=>Sd,ZodKSUID:()=>hd,ZodLazy:()=>hv,ZodLiteral:()=>Bg,ZodMAC:()=>Mg,ZodMap:()=>Kg,ZodNaN:()=>dv,ZodNanoID:()=>ld,ZodNever:()=>Lg,ZodNonOptional:()=>Pd,ZodNull:()=>Cg,ZodNullable:()=>rv,ZodNumber:()=>Ca,ZodNumberFormat:()=>mn,ZodObject:()=>Fa,ZodOptional:()=>zd,ZodPipe:()=>Td,ZodPrefault:()=>iv,ZodPromise:()=>vv,ZodReadonly:()=>pv,ZodRecord:()=>Wa,ZodSet:()=>Yg,ZodString:()=>Ra,ZodStringFormat:()=>ue,ZodSuccess:()=>cv,ZodSymbol:()=>Rg,ZodTemplateLiteral:()=>mv,ZodTransform:()=>Qg,ZodTuple:()=>Hg,ZodType:()=>V,ZodULID:()=>fd,ZodURL:()=>Aa,ZodUUID:()=>Vt,ZodUndefined:()=>Ag,ZodUnion:()=>qa,ZodUnknown:()=>Zg,ZodVoid:()=>Fg,ZodXID:()=>md,ZodXor:()=>Vg,_ZodString:()=>sd,_default:()=>ov,_function:()=>zk,any:()=>lk,array:()=>Y,base64:()=>HS,base64url:()=>GS,bigint:()=>ik,boolean:()=>$e,catch:()=>lv,check:()=>Pk,cidrv4:()=>WS,cidrv6:()=>JS,codec:()=>wk,cuid:()=>AS,cuid2:()=>CS,custom:()=>jd,date:()=>pk,describe:()=>Tk,discriminatedUnion:()=>Va,e164:()=>KS,email:()=>IS,emoji:()=>MS,enum:()=>Oe,exactOptional:()=>tv,file:()=>bk,float32:()=>tk,float64:()=>rk,function:()=>zk,guid:()=>zS,hash:()=>ek,hex:()=>QS,hostname:()=>XS,httpUrl:()=>NS,instanceof:()=>jk,int:()=>ad,int32:()=>nk,int64:()=>ak,intersection:()=>qo,ipv4:()=>FS,ipv6:()=>VS,json:()=>Nk,jwt:()=>YS,keyof:()=>fk,ksuid:()=>LS,lazy:()=>gv,literal:()=>j,looseObject:()=>Te,looseRecord:()=>vk,mac:()=>qS,map:()=>_k,meta:()=>Ok,nan:()=>kk,nanoid:()=>RS,nativeEnum:()=>$k,never:()=>wd,nonoptional:()=>sv,null:()=>La,nullable:()=>Na,nullish:()=>xk,number:()=>oe,object:()=>P,optional:()=>me,partialRecord:()=>gk,pipe:()=>Ma,prefault:()=>av,preprocess:()=>Ha,promise:()=>Ik,readonly:()=>fv,record:()=>ae,refine:()=>yv,set:()=>yk,strictObject:()=>mk,string:()=>v,stringFormat:()=>BS,stringbool:()=>Dk,success:()=>Sk,superRefine:()=>$v,symbol:()=>ck,templateLiteral:()=>Ek,transform:()=>Id,tuple:()=>Gg,uint32:()=>ok,uint64:()=>sk,ulid:()=>US,undefined:()=>uk,union:()=>de,unknown:()=>le,url:()=>DS,uuid:()=>PS,uuidv4:()=>TS,uuidv6:()=>OS,uuidv7:()=>jS,void:()=>dk,xid:()=>ZS,xor:()=>hk});var ja={};Wn(ja,{endsWith:()=>Do,gt:()=>Ft,gte:()=>Ue,includes:()=>Oo,length:()=>dn,lowercase:()=>Po,lt:()=>Lt,lte:()=>et,maxLength:()=>ln,maxSize:()=>Pr,mime:()=>No,minLength:()=>lr,minSize:()=>qt,multipleOf:()=>zr,negative:()=>Cl,nonnegative:()=>Zl,nonpositive:()=>Ul,normalize:()=>Mo,overwrite:()=>It,positive:()=>Al,property:()=>Ll,regex:()=>zo,size:()=>un,slugify:()=>Ia,startsWith:()=>jo,toLowerCase:()=>Ao,toUpperCase:()=>Co,trim:()=>Ro,uppercase:()=>To});var Tr={};Wn(Tr,{ZodISODate:()=>ed,ZodISODateTime:()=>Xl,ZodISODuration:()=>od,ZodISOTime:()=>rd,date:()=>td,datetime:()=>Ql,duration:()=>id,time:()=>nd});var Xl=m("ZodISODateTime",(t,e)=>{pu.init(t,e),ue.init(t,e)});function Ql(t){return ml(Xl,t)}var ed=m("ZodISODate",(t,e)=>{fu.init(t,e),ue.init(t,e)});function td(t){return hl(ed,t)}var rd=m("ZodISOTime",(t,e)=>{mu.init(t,e),ue.init(t,e)});function nd(t){return gl(rd,t)}var od=m("ZodISODuration",(t,e)=>{hu.init(t,e),ue.init(t,e)});function id(t){return vl(od,t)}var xg=(t,e)=>{Ji.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Gi(t,r)},flatten:{value:r=>Hi(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,on,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,on,2)}},isEmpty:{get(){return t.issues.length===0}}})},$A=m("ZodError",xg),tt=m("ZodError",xg,{Parent:Error});var Sg=fo(tt),kg=ho(tt),wg=vo(tt),Eg=_o(tt),Ig=Am(tt),zg=Cm(tt),Pg=Um(tt),Tg=Zm(tt),Og=Lm(tt),jg=Fm(tt),Dg=qm(tt),Ng=Vm(tt);var V=m("ZodType",(t,e)=>(L.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Uo(t,"input"),output:Uo(t,"output")}}),t.toJSONSchema=Nh(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(b.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),t.with=t.check,t.clone=(r,n)=>Ae(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>Sg(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>wg(t,r,n),t.parseAsync=async(r,n)=>kg(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Eg(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>Ig(t,r,n),t.decode=(r,n)=>zg(t,r,n),t.encodeAsync=async(r,n)=>Pg(t,r,n),t.decodeAsync=async(r,n)=>Tg(t,r,n),t.safeEncode=(r,n)=>Og(t,r,n),t.safeDecode=(r,n)=>jg(t,r,n),t.safeEncodeAsync=async(r,n)=>Dg(t,r,n),t.safeDecodeAsync=async(r,n)=>Ng(t,r,n),t.refine=(r,n)=>t.check(yv(r,n)),t.superRefine=r=>t.check($v(r)),t.overwrite=r=>t.check(It(r)),t.optional=()=>me(t),t.exactOptional=()=>tv(t),t.nullable=()=>Na(t),t.nullish=()=>me(Na(t)),t.nonoptional=r=>sv(t,r),t.array=()=>Y(t),t.or=r=>de([t,r]),t.and=r=>qo(t,r),t.transform=r=>Ma(t,Id(r)),t.default=r=>ov(t,r),t.prefault=r=>av(t,r),t.catch=r=>lv(t,r),t.pipe=r=>Ma(t,r),t.readonly=()=>fv(t),t.describe=r=>{let n=t.clone();return Ce.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ce.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ce.get(t);let n=t.clone();return Ce.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=r=>r(t),t)),sd=m("_ZodString",(t,e)=>{Ir.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Mh(t,n,o,i);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(zo(...n)),t.includes=(...n)=>t.check(Oo(...n)),t.startsWith=(...n)=>t.check(jo(...n)),t.endsWith=(...n)=>t.check(Do(...n)),t.min=(...n)=>t.check(lr(...n)),t.max=(...n)=>t.check(ln(...n)),t.length=(...n)=>t.check(dn(...n)),t.nonempty=(...n)=>t.check(lr(1,...n)),t.lowercase=n=>t.check(Po(n)),t.uppercase=n=>t.check(To(n)),t.trim=()=>t.check(Ro()),t.normalize=(...n)=>t.check(Mo(...n)),t.toLowerCase=()=>t.check(Ao()),t.toUpperCase=()=>t.check(Co()),t.slugify=()=>t.check(Ia())}),Ra=m("ZodString",(t,e)=>{Ir.init(t,e),sd.init(t,e),t.email=r=>t.check(sa(cd,r)),t.url=r=>t.check(Io(Aa,r)),t.jwt=r=>t.check(Ea(Sd,r)),t.emoji=r=>t.check(pa(ud,r)),t.guid=r=>t.check(Eo(Da,r)),t.uuid=r=>t.check(ca(Vt,r)),t.uuidv4=r=>t.check(ua(Vt,r)),t.uuidv6=r=>t.check(la(Vt,r)),t.uuidv7=r=>t.check(da(Vt,r)),t.nanoid=r=>t.check(fa(ld,r)),t.guid=r=>t.check(Eo(Da,r)),t.cuid=r=>t.check(ma(dd,r)),t.cuid2=r=>t.check(ha(pd,r)),t.ulid=r=>t.check(ga(fd,r)),t.base64=r=>t.check(Sa($d,r)),t.base64url=r=>t.check(ka(bd,r)),t.xid=r=>t.check(va(md,r)),t.ksuid=r=>t.check(_a(hd,r)),t.ipv4=r=>t.check(ya(gd,r)),t.ipv6=r=>t.check($a(vd,r)),t.cidrv4=r=>t.check(ba(_d,r)),t.cidrv6=r=>t.check(xa(yd,r)),t.e164=r=>t.check(wa(xd,r)),t.datetime=r=>t.check(Ql(r)),t.date=r=>t.check(td(r)),t.time=r=>t.check(nd(r)),t.duration=r=>t.check(id(r))});function v(t){return pl(Ra,t)}var ue=m("ZodStringFormat",(t,e)=>{ie.init(t,e),sd.init(t,e)}),cd=m("ZodEmail",(t,e)=>{nu.init(t,e),ue.init(t,e)});function IS(t){return sa(cd,t)}var Da=m("ZodGUID",(t,e)=>{tu.init(t,e),ue.init(t,e)});function zS(t){return Eo(Da,t)}var Vt=m("ZodUUID",(t,e)=>{ru.init(t,e),ue.init(t,e)});function PS(t){return ca(Vt,t)}function TS(t){return ua(Vt,t)}function OS(t){return la(Vt,t)}function jS(t){return da(Vt,t)}var Aa=m("ZodURL",(t,e)=>{ou.init(t,e),ue.init(t,e)});function DS(t){return Io(Aa,t)}function NS(t){return Io(Aa,{protocol:/^https?$/,hostname:it.domain,...b.normalizeParams(t)})}var ud=m("ZodEmoji",(t,e)=>{iu.init(t,e),ue.init(t,e)});function MS(t){return pa(ud,t)}var ld=m("ZodNanoID",(t,e)=>{au.init(t,e),ue.init(t,e)});function RS(t){return fa(ld,t)}var dd=m("ZodCUID",(t,e)=>{su.init(t,e),ue.init(t,e)});function AS(t){return ma(dd,t)}var pd=m("ZodCUID2",(t,e)=>{cu.init(t,e),ue.init(t,e)});function CS(t){return ha(pd,t)}var fd=m("ZodULID",(t,e)=>{uu.init(t,e),ue.init(t,e)});function US(t){return ga(fd,t)}var md=m("ZodXID",(t,e)=>{lu.init(t,e),ue.init(t,e)});function ZS(t){return va(md,t)}var hd=m("ZodKSUID",(t,e)=>{du.init(t,e),ue.init(t,e)});function LS(t){return _a(hd,t)}var gd=m("ZodIPv4",(t,e)=>{gu.init(t,e),ue.init(t,e)});function FS(t){return ya(gd,t)}var Mg=m("ZodMAC",(t,e)=>{_u.init(t,e),ue.init(t,e)});function qS(t){return fl(Mg,t)}var vd=m("ZodIPv6",(t,e)=>{vu.init(t,e),ue.init(t,e)});function VS(t){return $a(vd,t)}var _d=m("ZodCIDRv4",(t,e)=>{yu.init(t,e),ue.init(t,e)});function WS(t){return ba(_d,t)}var yd=m("ZodCIDRv6",(t,e)=>{$u.init(t,e),ue.init(t,e)});function JS(t){return xa(yd,t)}var $d=m("ZodBase64",(t,e)=>{bu.init(t,e),ue.init(t,e)});function HS(t){return Sa($d,t)}var bd=m("ZodBase64URL",(t,e)=>{xu.init(t,e),ue.init(t,e)});function GS(t){return ka(bd,t)}var xd=m("ZodE164",(t,e)=>{Su.init(t,e),ue.init(t,e)});function KS(t){return wa(xd,t)}var Sd=m("ZodJWT",(t,e)=>{ku.init(t,e),ue.init(t,e)});function YS(t){return Ea(Sd,t)}var Fo=m("ZodCustomStringFormat",(t,e)=>{wu.init(t,e),ue.init(t,e)});function BS(t,e,r={}){return pn(Fo,t,e,r)}function XS(t){return pn(Fo,"hostname",it.hostname,t)}function QS(t){return pn(Fo,"hex",it.hex,t)}function ek(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=it[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return pn(Fo,n,o,e)}var Ca=m("ZodNumber",(t,e)=>{na.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Rh(t,n,o,i),t.gt=(n,o)=>t.check(Ft(n,o)),t.gte=(n,o)=>t.check(Ue(n,o)),t.min=(n,o)=>t.check(Ue(n,o)),t.lt=(n,o)=>t.check(Lt(n,o)),t.lte=(n,o)=>t.check(et(n,o)),t.max=(n,o)=>t.check(et(n,o)),t.int=n=>t.check(ad(n)),t.safe=n=>t.check(ad(n)),t.positive=n=>t.check(Ft(0,n)),t.nonnegative=n=>t.check(Ue(0,n)),t.negative=n=>t.check(Lt(0,n)),t.nonpositive=n=>t.check(et(0,n)),t.multipleOf=(n,o)=>t.check(zr(n,o)),t.step=(n,o)=>t.check(zr(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function oe(t){return _l(Ca,t)}var mn=m("ZodNumberFormat",(t,e)=>{Eu.init(t,e),Ca.init(t,e)});function ad(t){return yl(mn,t)}function tk(t){return $l(mn,t)}function rk(t){return bl(mn,t)}function nk(t){return xl(mn,t)}function ok(t){return Sl(mn,t)}var Ua=m("ZodBoolean",(t,e)=>{So.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ah(t,r,n,o)});function $e(t){return kl(Ua,t)}var Za=m("ZodBigInt",(t,e)=>{oa.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Ch(t,n,o,i),t.gte=(n,o)=>t.check(Ue(n,o)),t.min=(n,o)=>t.check(Ue(n,o)),t.gt=(n,o)=>t.check(Ft(n,o)),t.gte=(n,o)=>t.check(Ue(n,o)),t.min=(n,o)=>t.check(Ue(n,o)),t.lt=(n,o)=>t.check(Lt(n,o)),t.lte=(n,o)=>t.check(et(n,o)),t.max=(n,o)=>t.check(et(n,o)),t.positive=n=>t.check(Ft(BigInt(0),n)),t.negative=n=>t.check(Lt(BigInt(0),n)),t.nonpositive=n=>t.check(et(BigInt(0),n)),t.nonnegative=n=>t.check(Ue(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(zr(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function ik(t){return wl(Za,t)}var kd=m("ZodBigIntFormat",(t,e)=>{Iu.init(t,e),Za.init(t,e)});function ak(t){return El(kd,t)}function sk(t){return Il(kd,t)}var Rg=m("ZodSymbol",(t,e)=>{zu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Uh(t,r,n,o)});function ck(t){return zl(Rg,t)}var Ag=m("ZodUndefined",(t,e)=>{Pu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Lh(t,r,n,o)});function uk(t){return Pl(Ag,t)}var Cg=m("ZodNull",(t,e)=>{Tu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Zh(t,r,n,o)});function La(t){return Tl(Cg,t)}var Ug=m("ZodAny",(t,e)=>{Ou.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Vh(t,r,n,o)});function lk(){return Ol(Ug)}var Zg=m("ZodUnknown",(t,e)=>{ju.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Wh(t,r,n,o)});function le(){return jl(Zg)}var Lg=m("ZodNever",(t,e)=>{Du.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>qh(t,r,n,o)});function wd(t){return Dl(Lg,t)}var Fg=m("ZodVoid",(t,e)=>{Nu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Fh(t,r,n,o)});function dk(t){return Nl(Fg,t)}var Ed=m("ZodDate",(t,e)=>{Mu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Jh(t,n,o,i),t.min=(n,o)=>t.check(Ue(n,o)),t.max=(n,o)=>t.check(et(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function pk(t){return Ml(Ed,t)}var qg=m("ZodArray",(t,e)=>{Ru.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>og(t,r,n,o),t.element=e.element,t.min=(r,n)=>t.check(lr(r,n)),t.nonempty=r=>t.check(lr(1,r)),t.max=(r,n)=>t.check(ln(r,n)),t.length=(r,n)=>t.check(dn(r,n)),t.unwrap=()=>t.element});function Y(t,e){return Dh(qg,t,e)}function fk(t){let e=t._zod.def.shape;return Oe(Object.keys(e))}var Fa=m("ZodObject",(t,e)=>{Oh.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ig(t,r,n,o),b.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Oe(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:le()}),t.loose=()=>t.clone({...t._zod.def,catchall:le()}),t.strict=()=>t.clone({...t._zod.def,catchall:wd()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>b.extend(t,r),t.safeExtend=r=>b.safeExtend(t,r),t.merge=r=>b.merge(t,r),t.pick=r=>b.pick(t,r),t.omit=r=>b.omit(t,r),t.partial=(...r)=>b.partial(zd,t,r[0]),t.required=(...r)=>b.required(Pd,t,r[0])});function P(t,e){let r={type:"object",shape:t??{},...b.normalizeParams(e)};return new Fa(r)}function mk(t,e){return new Fa({type:"object",shape:t,catchall:wd(),...b.normalizeParams(e)})}function Te(t,e){return new Fa({type:"object",shape:t,catchall:le(),...b.normalizeParams(e)})}var qa=m("ZodUnion",(t,e)=>{ko.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Kl(t,r,n,o),t.options=e.options});function de(t,e){return new qa({type:"union",options:t,...b.normalizeParams(e)})}var Vg=m("ZodXor",(t,e)=>{qa.init(t,e),Au.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Kl(t,r,n,o),t.options=e.options});function hk(t,e){return new Vg({type:"union",options:t,inclusive:!1,...b.normalizeParams(e)})}var Wg=m("ZodDiscriminatedUnion",(t,e)=>{qa.init(t,e),Cu.init(t,e)});function Va(t,e,r){return new Wg({type:"union",options:e,discriminator:t,...b.normalizeParams(r)})}var Jg=m("ZodIntersection",(t,e)=>{Uu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ag(t,r,n,o)});function qo(t,e){return new Jg({type:"intersection",left:t,right:e})}var Hg=m("ZodTuple",(t,e)=>{ia.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>sg(t,r,n,o),t.rest=r=>t.clone({...t._zod.def,rest:r})});function Gg(t,e,r){let n=e instanceof L,o=n?r:e,i=n?e:null;return new Hg({type:"tuple",items:t,rest:i,...b.normalizeParams(o)})}var Wa=m("ZodRecord",(t,e)=>{Zu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>cg(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType});function ae(t,e,r){return new Wa({type:"record",keyType:t,valueType:e,...b.normalizeParams(r)})}function gk(t,e,r){let n=Ae(t);return n._zod.values=void 0,new Wa({type:"record",keyType:n,valueType:e,...b.normalizeParams(r)})}function vk(t,e,r){return new Wa({type:"record",keyType:t,valueType:e,mode:"loose",...b.normalizeParams(r)})}var Kg=m("ZodMap",(t,e)=>{Lu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>rg(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(qt(...r)),t.nonempty=r=>t.check(qt(1,r)),t.max=(...r)=>t.check(Pr(...r)),t.size=(...r)=>t.check(un(...r))});function _k(t,e,r){return new Kg({type:"map",keyType:t,valueType:e,...b.normalizeParams(r)})}var Yg=m("ZodSet",(t,e)=>{Fu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ng(t,r,n,o),t.min=(...r)=>t.check(qt(...r)),t.nonempty=r=>t.check(qt(1,r)),t.max=(...r)=>t.check(Pr(...r)),t.size=(...r)=>t.check(un(...r))});function yk(t,e){return new Yg({type:"set",valueType:t,...b.normalizeParams(e)})}var Lo=m("ZodEnum",(t,e)=>{qu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Hh(t,n,o,i),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Lo({...e,checks:[],...b.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Lo({...e,checks:[],...b.normalizeParams(o),entries:i})}});function Oe(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Lo({type:"enum",entries:r,...b.normalizeParams(e)})}function $k(t,e){return new Lo({type:"enum",entries:t,...b.normalizeParams(e)})}var Bg=m("ZodLiteral",(t,e)=>{Vu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Gh(t,r,n,o),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function j(t,e){return new Bg({type:"literal",values:Array.isArray(t)?t:[t],...b.normalizeParams(e)})}var Xg=m("ZodFile",(t,e)=>{Wu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Bh(t,r,n,o),t.min=(r,n)=>t.check(qt(r,n)),t.max=(r,n)=>t.check(Pr(r,n)),t.mime=(r,n)=>t.check(No(Array.isArray(r)?r:[r],n))});function bk(t){return Fl(Xg,t)}var Qg=m("ZodTransform",(t,e)=>{Ju.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>tg(t,r,n,o),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new kr(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(b.issue(i,r.value,e));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),r.issues.push(b.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Id(t){return new Qg({type:"transform",transform:t})}var zd=m("ZodOptional",(t,e)=>{aa.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Yl(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function me(t){return new zd({type:"optional",innerType:t})}var ev=m("ZodExactOptional",(t,e)=>{Hu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Yl(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function tv(t){return new ev({type:"optional",innerType:t})}var rv=m("ZodNullable",(t,e)=>{Gu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ug(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Na(t){return new rv({type:"nullable",innerType:t})}function xk(t){return me(Na(t))}var nv=m("ZodDefault",(t,e)=>{Ku.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>dg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function ov(t,e){return new nv({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():b.shallowClone(e)}})}var iv=m("ZodPrefault",(t,e)=>{Yu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>pg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function av(t,e){return new iv({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():b.shallowClone(e)}})}var Pd=m("ZodNonOptional",(t,e)=>{Bu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>lg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function sv(t,e){return new Pd({type:"nonoptional",innerType:t,...b.normalizeParams(e)})}var cv=m("ZodSuccess",(t,e)=>{Xu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Xh(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Sk(t){return new cv({type:"success",innerType:t})}var uv=m("ZodCatch",(t,e)=>{Qu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>fg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function lv(t,e){return new uv({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var dv=m("ZodNaN",(t,e)=>{el.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Kh(t,r,n,o)});function kk(t){return Rl(dv,t)}var Td=m("ZodPipe",(t,e)=>{tl.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>mg(t,r,n,o),t.in=e.in,t.out=e.out});function Ma(t,e){return new Td({type:"pipe",in:t,out:e})}var Od=m("ZodCodec",(t,e)=>{Td.init(t,e),wo.init(t,e)});function wk(t,e,r){return new Od({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var pv=m("ZodReadonly",(t,e)=>{rl.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>hg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function fv(t){return new pv({type:"readonly",innerType:t})}var mv=m("ZodTemplateLiteral",(t,e)=>{nl.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Yh(t,r,n,o)});function Ek(t,e){return new mv({type:"template_literal",parts:t,...b.normalizeParams(e)})}var hv=m("ZodLazy",(t,e)=>{al.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>vg(t,r,n,o),t.unwrap=()=>t._zod.def.getter()});function gv(t){return new hv({type:"lazy",getter:t})}var vv=m("ZodPromise",(t,e)=>{il.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>gg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Ik(t){return new vv({type:"promise",innerType:t})}var _v=m("ZodFunction",(t,e)=>{ol.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>eg(t,r,n,o)});function zk(t){return new _v({type:"function",input:Array.isArray(t?.input)?Gg(t?.input):t?.input??Y(le()),output:t?.output??le()})}var Ja=m("ZodCustom",(t,e)=>{sl.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Qh(t,r,n,o)});function Pk(t){let e=new ce({check:"custom"});return e._zod.check=t,e}function jd(t,e){return ql(Ja,t??(()=>!0),e)}function yv(t,e={}){return Vl(Ja,t,e)}function $v(t){return Wl(t)}var Tk=Jl,Ok=Hl;function jk(t,e={}){let r=new Ja({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...b.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=n=>{n.value instanceof t||n.issues.push({code:"invalid_type",expected:t.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Dk=(...t)=>Gl({Codec:Od,Boolean:Ua,String:Ra},...t);function Nk(t){let e=gv(()=>de([v(t),oe(),$e(),La(),Y(e),ae(v(),e)]));return e}function Ha(t,e){return Ma(Id(t),e)}var bv;bv||(bv={});var zA={...Zo,...ja,iso:Tr};be(cl());var Nd="2025-11-25";var xv=[Nd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],pr="io.modelcontextprotocol/related-task",Ka="2.0",xe=jd(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Sv=de([v(),oe().int()]),kv=v(),HA=Te({ttl:oe().optional(),pollInterval:oe().optional()}),Ck=P({ttl:oe().optional()}),Uk=P({taskId:v()}),Md=Te({progressToken:Sv.optional(),[pr]:Uk.optional()}),rt=P({_meta:Md.optional()}),Vo=rt.extend({task:Ck.optional()}),wv=t=>Vo.safeParse(t).success,Se=P({method:v(),params:rt.loose().optional()}),at=P({_meta:Md.optional()}),st=P({method:v(),params:at.loose().optional()}),ke=Te({_meta:Md.optional()}),Ya=de([v(),oe().int()]),Ev=P({jsonrpc:j(Ka),id:Ya,...Se.shape}).strict(),Rd=t=>Ev.safeParse(t).success,Iv=P({jsonrpc:j(Ka),...st.shape}).strict(),zv=t=>Iv.safeParse(t).success,Ad=P({jsonrpc:j(Ka),id:Ya,result:ke}).strict(),Wo=t=>Ad.safeParse(t).success;var Q;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Q||(Q={}));var Cd=P({jsonrpc:j(Ka),id:Ya.optional(),error:P({code:oe().int(),message:v(),data:le().optional()})}).strict();var Pv=t=>Cd.safeParse(t).success;var Tv=de([Ev,Iv,Ad,Cd]),GA=de([Ad,Cd]),Ba=ke.strict(),Zk=at.extend({requestId:Ya.optional(),reason:v().optional()}),Xa=st.extend({method:j("notifications/cancelled"),params:Zk}),Lk=P({src:v(),mimeType:v().optional(),sizes:Y(v()).optional(),theme:Oe(["light","dark"]).optional()}),Jo=P({icons:Y(Lk).optional()}),hn=P({name:v(),title:v().optional()}),Ov=hn.extend({...hn.shape,...Jo.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Fk=qo(P({applyDefaults:$e().optional()}),ae(v(),le())),qk=Ha(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,qo(P({form:Fk.optional(),url:xe.optional()}),ae(v(),le()).optional())),Vk=Te({list:xe.optional(),cancel:xe.optional(),requests:Te({sampling:Te({createMessage:xe.optional()}).optional(),elicitation:Te({create:xe.optional()}).optional()}).optional()}),Wk=Te({list:xe.optional(),cancel:xe.optional(),requests:Te({tools:Te({call:xe.optional()}).optional()}).optional()}),Jk=P({experimental:ae(v(),xe).optional(),sampling:P({context:xe.optional(),tools:xe.optional()}).optional(),elicitation:qk.optional(),roots:P({listChanged:$e().optional()}).optional(),tasks:Vk.optional(),extensions:ae(v(),xe).optional()}),Hk=rt.extend({protocolVersion:v(),capabilities:Jk,clientInfo:Ov}),Ud=Se.extend({method:j("initialize"),params:Hk});var Gk=P({experimental:ae(v(),xe).optional(),logging:xe.optional(),completions:xe.optional(),prompts:P({listChanged:$e().optional()}).optional(),resources:P({subscribe:$e().optional(),listChanged:$e().optional()}).optional(),tools:P({listChanged:$e().optional()}).optional(),tasks:Wk.optional(),extensions:ae(v(),xe).optional()}),Kk=ke.extend({protocolVersion:v(),capabilities:Gk,serverInfo:Ov,instructions:v().optional()}),Zd=st.extend({method:j("notifications/initialized"),params:at.optional()});var Qa=Se.extend({method:j("ping"),params:rt.optional()}),Yk=P({progress:oe(),total:me(oe()),message:me(v())}),Bk=P({...at.shape,...Yk.shape,progressToken:Sv}),es=st.extend({method:j("notifications/progress"),params:Bk}),Xk=rt.extend({cursor:kv.optional()}),Ho=Se.extend({params:Xk.optional()}),Go=ke.extend({nextCursor:kv.optional()}),Qk=Oe(["working","input_required","completed","failed","cancelled"]),Ko=P({taskId:v(),status:Qk,ttl:de([oe(),La()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:me(oe()),statusMessage:me(v())}),gn=ke.extend({task:Ko}),ew=at.merge(Ko),Yo=st.extend({method:j("notifications/tasks/status"),params:ew}),ts=Se.extend({method:j("tasks/get"),params:rt.extend({taskId:v()})}),rs=ke.merge(Ko),ns=Se.extend({method:j("tasks/result"),params:rt.extend({taskId:v()})}),KA=ke.loose(),os=Ho.extend({method:j("tasks/list")}),is=Go.extend({tasks:Y(Ko)}),as=Se.extend({method:j("tasks/cancel"),params:rt.extend({taskId:v()})}),jv=ke.merge(Ko),Dv=P({uri:v(),mimeType:me(v()),_meta:ae(v(),le()).optional()}),Nv=Dv.extend({text:v()}),Ld=v().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Mv=Dv.extend({blob:Ld}),Bo=Oe(["user","assistant"]),vn=P({audience:Y(Bo).optional(),priority:oe().min(0).max(1).optional(),lastModified:Tr.datetime({offset:!0}).optional()}),Rv=P({...hn.shape,...Jo.shape,uri:v(),description:me(v()),mimeType:me(v()),size:me(oe()),annotations:vn.optional(),_meta:me(Te({}))}),tw=P({...hn.shape,...Jo.shape,uriTemplate:v(),description:me(v()),mimeType:me(v()),annotations:vn.optional(),_meta:me(Te({}))}),rw=Ho.extend({method:j("resources/list")}),nw=Go.extend({resources:Y(Rv)}),ow=Ho.extend({method:j("resources/templates/list")}),iw=Go.extend({resourceTemplates:Y(tw)}),Fd=rt.extend({uri:v()}),aw=Fd,sw=Se.extend({method:j("resources/read"),params:aw}),cw=ke.extend({contents:Y(de([Nv,Mv]))}),uw=st.extend({method:j("notifications/resources/list_changed"),params:at.optional()}),lw=Fd,dw=Se.extend({method:j("resources/subscribe"),params:lw}),pw=Fd,fw=Se.extend({method:j("resources/unsubscribe"),params:pw}),mw=at.extend({uri:v()}),hw=st.extend({method:j("notifications/resources/updated"),params:mw}),gw=P({name:v(),description:me(v()),required:me($e())}),vw=P({...hn.shape,...Jo.shape,description:me(v()),arguments:me(Y(gw)),_meta:me(Te({}))}),_w=Ho.extend({method:j("prompts/list")}),yw=Go.extend({prompts:Y(vw)}),$w=rt.extend({name:v(),arguments:ae(v(),v()).optional()}),bw=Se.extend({method:j("prompts/get"),params:$w}),qd=P({type:j("text"),text:v(),annotations:vn.optional(),_meta:ae(v(),le()).optional()}),Vd=P({type:j("image"),data:Ld,mimeType:v(),annotations:vn.optional(),_meta:ae(v(),le()).optional()}),Wd=P({type:j("audio"),data:Ld,mimeType:v(),annotations:vn.optional(),_meta:ae(v(),le()).optional()}),xw=P({type:j("tool_use"),name:v(),id:v(),input:ae(v(),le()),_meta:ae(v(),le()).optional()}),Sw=P({type:j("resource"),resource:de([Nv,Mv]),annotations:vn.optional(),_meta:ae(v(),le()).optional()}),kw=Rv.extend({type:j("resource_link")}),Jd=de([qd,Vd,Wd,kw,Sw]),ww=P({role:Bo,content:Jd}),Ew=ke.extend({description:v().optional(),messages:Y(ww)}),Iw=st.extend({method:j("notifications/prompts/list_changed"),params:at.optional()}),zw=P({title:v().optional(),readOnlyHint:$e().optional(),destructiveHint:$e().optional(),idempotentHint:$e().optional(),openWorldHint:$e().optional()}),Pw=P({taskSupport:Oe(["required","optional","forbidden"]).optional()}),Av=P({...hn.shape,...Jo.shape,description:v().optional(),inputSchema:P({type:j("object"),properties:ae(v(),xe).optional(),required:Y(v()).optional()}).catchall(le()),outputSchema:P({type:j("object"),properties:ae(v(),xe).optional(),required:Y(v()).optional()}).catchall(le()).optional(),annotations:zw.optional(),execution:Pw.optional(),_meta:ae(v(),le()).optional()}),Hd=Ho.extend({method:j("tools/list")}),Tw=Go.extend({tools:Y(Av)}),ss=ke.extend({content:Y(Jd).default([]),structuredContent:ae(v(),le()).optional(),isError:$e().optional()}),YA=ss.or(ke.extend({toolResult:le()})),Ow=Vo.extend({name:v(),arguments:ae(v(),le()).optional()}),Xo=Se.extend({method:j("tools/call"),params:Ow}),jw=st.extend({method:j("notifications/tools/list_changed"),params:at.optional()}),BA=P({autoRefresh:$e().default(!0),debounceMs:oe().int().nonnegative().default(300)}),Qo=Oe(["debug","info","notice","warning","error","critical","alert","emergency"]),Dw=rt.extend({level:Qo}),Gd=Se.extend({method:j("logging/setLevel"),params:Dw}),Nw=at.extend({level:Qo,logger:v().optional(),data:le()}),Mw=st.extend({method:j("notifications/message"),params:Nw}),Rw=P({name:v().optional()}),Aw=P({hints:Y(Rw).optional(),costPriority:oe().min(0).max(1).optional(),speedPriority:oe().min(0).max(1).optional(),intelligencePriority:oe().min(0).max(1).optional()}),Cw=P({mode:Oe(["auto","required","none"]).optional()}),Uw=P({type:j("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:Y(Jd).default([]),structuredContent:P({}).loose().optional(),isError:$e().optional(),_meta:ae(v(),le()).optional()}),Zw=Va("type",[qd,Vd,Wd]),Ga=Va("type",[qd,Vd,Wd,xw,Uw]),Lw=P({role:Bo,content:de([Ga,Y(Ga)]),_meta:ae(v(),le()).optional()}),Fw=Vo.extend({messages:Y(Lw),modelPreferences:Aw.optional(),systemPrompt:v().optional(),includeContext:Oe(["none","thisServer","allServers"]).optional(),temperature:oe().optional(),maxTokens:oe().int(),stopSequences:Y(v()).optional(),metadata:xe.optional(),tools:Y(Av).optional(),toolChoice:Cw.optional()}),qw=Se.extend({method:j("sampling/createMessage"),params:Fw}),ei=ke.extend({model:v(),stopReason:me(Oe(["endTurn","stopSequence","maxTokens"]).or(v())),role:Bo,content:Zw}),Kd=ke.extend({model:v(),stopReason:me(Oe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:Bo,content:de([Ga,Y(Ga)])}),Vw=P({type:j("boolean"),title:v().optional(),description:v().optional(),default:$e().optional()}),Ww=P({type:j("string"),title:v().optional(),description:v().optional(),minLength:oe().optional(),maxLength:oe().optional(),format:Oe(["email","uri","date","date-time"]).optional(),default:v().optional()}),Jw=P({type:Oe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:oe().optional(),maximum:oe().optional(),default:oe().optional()}),Hw=P({type:j("string"),title:v().optional(),description:v().optional(),enum:Y(v()),default:v().optional()}),Gw=P({type:j("string"),title:v().optional(),description:v().optional(),oneOf:Y(P({const:v(),title:v()})),default:v().optional()}),Kw=P({type:j("string"),title:v().optional(),description:v().optional(),enum:Y(v()),enumNames:Y(v()).optional(),default:v().optional()}),Yw=de([Hw,Gw]),Bw=P({type:j("array"),title:v().optional(),description:v().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:P({type:j("string"),enum:Y(v())}),default:Y(v()).optional()}),Xw=P({type:j("array"),title:v().optional(),description:v().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:P({anyOf:Y(P({const:v(),title:v()}))}),default:Y(v()).optional()}),Qw=de([Bw,Xw]),eE=de([Kw,Yw,Qw]),tE=de([eE,Vw,Ww,Jw]),rE=Vo.extend({mode:j("form").optional(),message:v(),requestedSchema:P({type:j("object"),properties:ae(v(),tE),required:Y(v()).optional()})}),nE=Vo.extend({mode:j("url"),message:v(),elicitationId:v(),url:v().url()}),oE=de([rE,nE]),iE=Se.extend({method:j("elicitation/create"),params:oE}),aE=at.extend({elicitationId:v()}),sE=st.extend({method:j("notifications/elicitation/complete"),params:aE}),_n=ke.extend({action:Oe(["accept","decline","cancel"]),content:Ha(t=>t===null?void 0:t,ae(v(),de([v(),oe(),$e(),Y(v())])).optional())}),cE=P({type:j("ref/resource"),uri:v()});var uE=P({type:j("ref/prompt"),name:v()}),lE=rt.extend({ref:de([uE,cE]),argument:P({name:v(),value:v()}),context:P({arguments:ae(v(),v()).optional()}).optional()}),dE=Se.extend({method:j("completion/complete"),params:lE});var pE=ke.extend({completion:Te({values:Y(v()).max(100),total:me(oe().int()),hasMore:me($e())})}),fE=P({uri:v().startsWith("file://"),name:v().optional(),_meta:ae(v(),le()).optional()}),mE=Se.extend({method:j("roots/list"),params:rt.optional()}),Yd=ke.extend({roots:Y(fE)}),hE=st.extend({method:j("notifications/roots/list_changed"),params:at.optional()}),XA=de([Qa,Ud,dE,Gd,bw,_w,rw,ow,sw,dw,fw,Xo,Hd,ts,ns,os,as]),QA=de([Xa,es,Zd,hE,Yo]),eC=de([Ba,ei,Kd,_n,Yd,rs,is,gn]),tC=de([Qa,qw,iE,mE,ts,ns,os,as]),rC=de([Xa,es,Mw,hw,uw,jw,Iw,Yo,sE]),nC=de([Ba,Kk,pE,Ew,yw,nw,iw,cw,ss,Tw,rs,is,gn]),W=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===Q.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Dd(o.elicitations,r)}return new t(e,r,n)}},Dd=class extends W{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(Q.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function fr(t){return t==="completed"||t==="failed"||t==="cancelled"}var AC=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Bd(t){let r=Oa(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=bg(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Xd(t,e){let r=dr(t,e);if(!r.success)throw r.error;return r.data}var bE=6e4,cs=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Xa,r=>{this._oncancel(r)}),this.setNotificationHandler(es,r=>{this._onprogress(r)}),this.setRequestHandler(Qa,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ts,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new W(Q.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(ns,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,p=new W(d.error.code,d.error.message,d.error.data);l(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new W(Q.InvalidParams,`Task not found: ${i}`);if(!fr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(fr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[pr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(os,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new W(Q.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(as,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new W(Q.InvalidParams,`Task not found: ${r.params.taskId}`);if(fr(o.status))throw new W(Q.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new W(Q.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof W?o:new W(Q.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),W.fromError(Q.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),Wo(i)||Pv(i)?this._onresponse(i):Rd(i)?this._onrequest(i,a):zv(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=W.fromError(Q.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,i=e.params?._meta?.[pr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:Q.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let s=wv(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:e.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new W(Q.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};i&&!f.relatedTask&&(f.relatedTask={taskId:i});let h=f.relatedTask?.taskId??i;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:Q.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Wo(e))n(e);else{let a=new W(e.error.code,e.error.message,e.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(Wo(e)&&e.result&&typeof e.result=="object"){let a=e.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),Wo(e))o(e);else{let a=W.fromError(e.error.code,e.error.message,e.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(e,r,n)}}catch(a){yield{type:"error",error:a instanceof W?a:new W(Q.InternalError,String(a))}}return}let i;try{let a=await this.request(e,gn,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new W(Q.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},fr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new W(Q.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new W(Q.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof W?a:new W(Q.InternalError,String(a))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=S=>{l(S)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(S){d(S);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[pr]:c}});let h=S=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(S)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(N=>this._onerror(new Error(`Failed to send cancellation: ${N}`)));let x=S instanceof W?S:new W(Q.RequestTimeout,String(S));l(x)};this._responseHandlers.set(p,S=>{if(!n?.signal?.aborted){if(S instanceof Error)return l(S);try{let x=dr(r,S.result);x.success?u(x.data):l(x.error)}catch(x){l(x)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let g=n?.timeout??bE,$=()=>h(W.fromError(Q.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,n?.maxTotalTimeout,$,n?.resetTimeoutOnProgress??!1);let k=c?.taskId;if(k){let S=x=>{let N=this._responseHandlers.get(p);N?N(x):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,S),this._enqueueTaskMessage(k,{type:"request",message:f,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(p),l(x)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(S=>{this._cleanupTimeout(p),l(S)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},rs,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},is,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},jv,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[pr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[pr]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[pr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(e,r){let n=Bd(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Xd(e,o);return Promise.resolve(r(a,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=Bd(e);this._notificationHandlers.set(n,o=>{let i=Xd(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,o)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&Rd(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new W(Q.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new W(Q.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new W(Q.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new W(Q.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=Yo.parse({method:"notifications/tasks/status",params:s});await this.notification(c),fr(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new W(Q.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(fr(s.status))throw new W(Q.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=Yo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),fr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Cv(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Uv(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let a=r[o];Cv(a)&&Cv(i)?r[o]={...a,...i}:r[o]=i}return r}var w$=kt(Cf(),1),E$=kt(k$(),1);function pO(){let t=new w$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,E$.default)(t),t}var Vs=class{constructor(e){this._ajv=e??pO()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Ws=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}createMessageStream(e,r){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],i=Array.isArray(o.content)?o.content:[o.content],a=i.some(l=>l.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=s?Array.isArray(s.content)?s.content:[s.content]:[],u=c.some(l=>l.type==="tool_use");if(a){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(i.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},ei,r)}elicitInputStream(e,r){let n=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let i=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:i},_n,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function I$(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function z$(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Js=class extends cs{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Qo.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Vs,this.setRequestHandler(Ud,n=>this._oninitialize(n)),this.setNotificationHandler(Zd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Gd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Qo.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Ws(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Uv(this._capabilities,e)}setRequestHandler(e,r){let o=Oa(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(fn(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=dr(Xo,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new W(Q.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=dr(gn,p);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new W(Q.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let f=dr(ss,p);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new W(Q.InvalidParams,`Invalid tools/call result: ${h}`)}return f.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){z$(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&I$(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:xv.includes(r)?r:Nd,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Ba)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Kd,r):this.request({method:"sampling/createMessage",params:e},ei,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},_n,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},i=await this.request({method:"elicitation/create",params:o},_n,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new W(Q.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof W?a:new W(Q.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Yd,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Jf=kt(require("node:process"),1);var Hs=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
56
|
-
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),
|
|
57
|
-
`}var Gs=class{constructor(e=Jf.default.stdin,r=Jf.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Hs,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=P$(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Yf=kt(require("path"),1);var pt={DEFAULT:3e5,HEALTH_CHECK:3e3,POST_SPAWN_WAIT:15e3,READINESS_WAIT:3e4,PORT_IN_USE_WAIT:3e3,WORKER_STARTUP_WAIT:1e3,PRE_RESTART_SETTLE_DELAY:2e3,POWERSHELL_COMMAND:1e4,WINDOWS_MULTIPLIER:1.5};function T$(t){return process.platform==="win32"?Math.round(t*pt.WINDOWS_MULTIPLIER):t}var Nt=require("fs"),Oi=require("path"),Hf=require("os"),Bt=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-6",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_CLAUDE_AUTH_METHOD:"cli",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED:"true",CLAUDE_MEM_GEMINI_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_GEMINI_MAX_TOKENS:"100000",CLAUDE_MEM_OPENROUTER_API_KEY:"",CLAUDE_MEM_OPENROUTER_MODEL:"xiaomi/mimo-v2-flash:free",CLAUDE_MEM_OPENROUTER_SITE_URL:"",CLAUDE_MEM_OPENROUTER_APP_NAME:"claude-mem",CLAUDE_MEM_OPENROUTER_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_OPENROUTER_MAX_TOKENS:"100000",CLAUDE_MEM_DATA_DIR:(0,Oi.join)((0,Hf.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_FULL_COUNT:"0",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false",CLAUDE_MEM_CONTEXT_SHOW_TERMINAL_OUTPUT:"true",CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED:"false",CLAUDE_MEM_FOLDER_USE_LOCAL_MD:"false",CLAUDE_MEM_TRANSCRIPTS_ENABLED:"true",CLAUDE_MEM_TRANSCRIPTS_CONFIG_PATH:(0,Oi.join)((0,Hf.homedir)(),".claude-mem","transcript-watch.json"),CLAUDE_MEM_MAX_CONCURRENT_AGENTS:"2",CLAUDE_MEM_EXCLUDED_PROJECTS:"",CLAUDE_MEM_FOLDER_MD_EXCLUDE:"[]",CLAUDE_MEM_SEMANTIC_INJECT:"false",CLAUDE_MEM_SEMANTIC_INJECT_LIMIT:"5",CLAUDE_MEM_TIER_ROUTING_ENABLED:"true",CLAUDE_MEM_TIER_SIMPLE_MODEL:"haiku",CLAUDE_MEM_TIER_SUMMARY_MODEL:"",CLAUDE_MEM_CHROMA_ENABLED:"true",CLAUDE_MEM_CHROMA_MODE:"local",CLAUDE_MEM_CHROMA_HOST:"127.0.0.1",CLAUDE_MEM_CHROMA_PORT:"8000",CLAUDE_MEM_CHROMA_SSL:"false",CLAUDE_MEM_CHROMA_API_KEY:"",CLAUDE_MEM_CHROMA_TENANT:"default_tenant",CLAUDE_MEM_CHROMA_DATABASE:"default_database"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return process.env[e]??this.DEFAULTS[e]}static getInt(e){let r=this.get(e);return parseInt(r,10)}static getBool(e){let r=this.get(e);return r==="true"||r===!0}static applyEnvOverrides(e){let r={...e};for(let n of Object.keys(this.DEFAULTS))process.env[n]!==void 0&&(r[n]=process.env[n]);return r}static loadFromFile(e){try{if(!(0,Nt.existsSync)(e)){let a=this.getAllDefaults();try{let s=(0,Oi.dirname)(e);(0,Nt.existsSync)(s)||(0,Nt.mkdirSync)(s,{recursive:!0}),(0,Nt.writeFileSync)(e,JSON.stringify(a,null,2),"utf-8"),console.log("[SETTINGS] Created settings file with defaults:",e)}catch(s){console.warn("[SETTINGS] Failed to create settings file, using in-memory defaults:",e,s instanceof Error?s.message:String(s))}return this.applyEnvOverrides(a)}let r=(0,Nt.readFileSync)(e,"utf-8"),n=JSON.parse(r),o=n;if(n.env&&typeof n.env=="object"){o=n.env;try{(0,Nt.writeFileSync)(e,JSON.stringify(o,null,2),"utf-8"),console.log("[SETTINGS] Migrated settings file from nested to flat schema:",e)}catch(a){console.warn("[SETTINGS] Failed to auto-migrate settings file:",e,a instanceof Error?a.message:String(a))}}let i={...this.DEFAULTS};for(let a of Object.keys(this.DEFAULTS))o[a]!==void 0&&(i[a]=o[a]);return this.applyEnvOverrides(i)}catch(r){return console.warn("[SETTINGS] Failed to load settings, using defaults:",e,r instanceof Error?r.message:String(r)),this.applyEnvOverrides(this.getAllDefaults())}}};var _e=require("path"),Gf=require("os"),Kf=require("fs");var O$=require("url");var vO={};function mO(){return typeof __dirname<"u"?__dirname:(0,_e.dirname)((0,O$.fileURLToPath)(vO.url))}var _L=mO();function hO(){if(process.env.CLAUDE_MEM_DATA_DIR)return process.env.CLAUDE_MEM_DATA_DIR;let t=(0,_e.join)((0,Gf.homedir)(),".claude-mem"),e=(0,_e.join)(t,"settings.json");try{if((0,Kf.existsSync)(e)){let{readFileSync:r}=require("fs"),n=JSON.parse(r(e,"utf-8")),o=n.env??n;if(o.CLAUDE_MEM_DATA_DIR)return o.CLAUDE_MEM_DATA_DIR}}catch{}return t}var Xt=hO(),Ks=process.env.CLAUDE_CONFIG_DIR||(0,_e.join)((0,Gf.homedir)(),".claude"),j$=(0,_e.join)(Ks,"plugins","marketplaces","thedotmack"),yL=(0,_e.join)(Xt,"archives"),$L=(0,_e.join)(Xt,"logs"),bL=(0,_e.join)(Xt,"trash"),xL=(0,_e.join)(Xt,"backups"),SL=(0,_e.join)(Xt,"modes"),kL=(0,_e.join)(Xt,"settings.json"),wL=(0,_e.join)(Xt,"claude-mem.db"),EL=(0,_e.join)(Xt,"vector-db"),gO=(0,_e.join)(Xt,"observer-sessions"),IL=(0,_e.basename)(gO),zL=(0,_e.join)(Ks,"settings.json"),PL=(0,_e.join)(Ks,"commands"),TL=(0,_e.join)(Ks,"CLAUDE.md");var _O=(()=>{let t=process.env.CLAUDE_MEM_HEALTH_TIMEOUT_MS;if(t){let e=parseInt(t,10);if(Number.isFinite(e)&&e>=500&&e<=3e5)return e;_.warn("SYSTEM","Invalid CLAUDE_MEM_HEALTH_TIMEOUT_MS, using default",{value:t,min:500,max:3e5})}return T$(pt.HEALTH_CHECK)})();function yO(t,e={},r){return new Promise((n,o)=>{let i=setTimeout(()=>o(new Error(`Request timed out after ${r}ms`)),r);fetch(t,e).then(a=>{clearTimeout(i),n(a)},a=>{clearTimeout(i),o(a)})})}var Ys=null,Bs=null;function Bf(){if(Ys!==null)return Ys;let t=Yf.default.join(Bt.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=Bt.loadFromFile(t);return Ys=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),Ys}function $O(){if(Bs!==null)return Bs;let t=Yf.default.join(Bt.get("CLAUDE_MEM_DATA_DIR"),"settings.json");return Bs=Bt.loadFromFile(t).CLAUDE_MEM_WORKER_HOST,Bs}function bO(t){return`http://${$O()}:${Bf()}${t}`}function Xs(t,e={}){let r=e.method??"GET",n=e.timeoutMs??_O,o=bO(t),i={method:r};return e.headers&&(i.headers=e.headers),e.body&&(i.body=e.body),n>0?yO(o,i,n):fetch(o,i)}var sm=kt(require("path"),1),ft=require("fs");var er=kt(require("path"),1),im=require("os"),qe=require("fs"),tr=require("child_process"),G$=require("util");var xO=["CLAUDECODE_","CLAUDE_CODE_"],SO=new Set(["CLAUDECODE","CLAUDE_CODE_SESSION","CLAUDE_CODE_ENTRYPOINT","MCP_SESSION_ID"]),kO=new Set(["CLAUDE_CODE_OAUTH_TOKEN","CLAUDE_CODE_GIT_BASH_PATH"]);function D$(t=process.env){let e={};for(let[r,n]of Object.entries(t))if(n!==void 0){if(kO.has(r)){e[r]=n;continue}SO.has(r)||xO.some(o=>r.startsWith(o))||(e[r]=n)}return e}var Lr=require("fs"),W$=require("os"),rm=kt(require("path"),1);var Qt=require("fs"),N$=require("os"),ji=kt(require("path"),1);var wO=5e3,EO=1e3,IO=ji.default.join((0,N$.homedir)(),".claude-mem"),zO=ji.default.join(IO,"supervisor.json");function St(t){if(!Number.isInteger(t)||t<0||t===0)return!1;try{return process.kill(t,0),!0}catch(e){if(e instanceof Error){let r=e.code;return r==="EPERM"?!0:(_.debug("SYSTEM","PID check failed",{pid:t,code:r}),!1)}return _.warn("SYSTEM","PID check threw non-Error",{pid:t,error:String(e)}),!1}}var Qf=class{registryPath;entries=new Map;runtimeProcesses=new Map;initialized=!1;constructor(e=zO){this.registryPath=e}initialize(){if(this.initialized)return;if(this.initialized=!0,(0,Qt.mkdirSync)(ji.default.dirname(this.registryPath),{recursive:!0}),!(0,Qt.existsSync)(this.registryPath)){this.persist();return}try{let n=JSON.parse((0,Qt.readFileSync)(this.registryPath,"utf-8")).processes??{};for(let[o,i]of Object.entries(n))this.entries.set(o,i)}catch(r){r instanceof Error?_.warn("SYSTEM","Failed to parse supervisor registry, rebuilding",{path:this.registryPath},r):_.warn("SYSTEM","Failed to parse supervisor registry, rebuilding",{path:this.registryPath,error:String(r)}),this.entries.clear()}let e=this.pruneDeadEntries();e>0&&_.info("SYSTEM","Removed dead processes from supervisor registry",{removed:e}),this.persist()}register(e,r,n){this.initialize(),this.entries.set(e,r),n&&this.runtimeProcesses.set(e,n),this.persist()}unregister(e){this.initialize(),this.entries.delete(e),this.runtimeProcesses.delete(e),this.persist()}clear(){this.entries.clear(),this.runtimeProcesses.clear(),this.persist()}getAll(){return this.initialize(),Array.from(this.entries.entries()).map(([e,r])=>({id:e,...r})).sort((e,r)=>{let n=Date.parse(e.startedAt),o=Date.parse(r.startedAt);return(Number.isNaN(n)?0:n)-(Number.isNaN(o)?0:o)})}getBySession(e){let r=String(e);return this.getAll().filter(n=>n.sessionId!==void 0&&String(n.sessionId)===r)}getRuntimeProcess(e){return this.runtimeProcesses.get(e)}getByPid(e){return this.getAll().filter(r=>r.pid===e)}pruneDeadEntries(){this.initialize();let e=0;for(let[r,n]of this.entries)St(n.pid)||(this.entries.delete(r),this.runtimeProcesses.delete(r),e+=1);return e>0&&this.persist(),e}async reapSession(e){this.initialize();let r=this.getBySession(e);if(r.length===0)return 0;let n=typeof e=="number"?e:Number(e)||void 0;_.info("SYSTEM",`Reaping ${r.length} process(es) for session ${e}`,{sessionId:n,pids:r.map(s=>s.pid)});let o=r.filter(s=>St(s.pid));for(let s of o)try{process.kill(s.pid,"SIGTERM")}catch(c){c instanceof Error?c.code!=="ESRCH"&&_.debug("SYSTEM",`Failed to SIGTERM session process PID ${s.pid}`,{pid:s.pid},c):_.warn("SYSTEM",`Failed to SIGTERM session process PID ${s.pid} (non-Error)`,{pid:s.pid,error:String(c)})}let i=Date.now()+wO;for(;Date.now()<i&&o.filter(c=>St(c.pid)).length!==0;)await new Promise(c=>setTimeout(c,100));let a=o.filter(s=>St(s.pid));for(let s of a){_.warn("SYSTEM",`Session process PID ${s.pid} did not exit after SIGTERM, sending SIGKILL`,{pid:s.pid,sessionId:n});try{process.kill(s.pid,"SIGKILL")}catch(c){c instanceof Error?c.code!=="ESRCH"&&_.debug("SYSTEM",`Failed to SIGKILL session process PID ${s.pid}`,{pid:s.pid},c):_.warn("SYSTEM",`Failed to SIGKILL session process PID ${s.pid} (non-Error)`,{pid:s.pid,error:String(c)})}}if(a.length>0){let s=Date.now()+EO;for(;Date.now()<s&&a.filter(u=>St(u.pid)).length!==0;)await new Promise(u=>setTimeout(u,100))}for(let s of r)this.entries.delete(s.id),this.runtimeProcesses.delete(s.id);return this.persist(),_.info("SYSTEM",`Reaped ${r.length} process(es) for session ${e}`,{sessionId:n,reaped:r.length}),r.length}persist(){let e={processes:Object.fromEntries(this.entries.entries())};(0,Qt.mkdirSync)(ji.default.dirname(this.registryPath),{recursive:!0}),(0,Qt.writeFileSync)(this.registryPath,JSON.stringify(e,null,2))}},Xf=null;function Qs(){return Xf||(Xf=new Qf),Xf}var A$=require("child_process"),C$=require("fs"),U$=require("os"),em=kt(require("path"),1),Z$=require("util");var PO=(0,Z$.promisify)(A$.execFile),TO=em.default.join((0,U$.homedir)(),".claude-mem"),OO=em.default.join(TO,"worker.pid");async function L$(t){let e=t.currentPid??process.pid,r=t.pidFilePath??OO,n=t.registry.getAll(),o=[...n].filter(a=>a.pid!==e).sort((a,s)=>Date.parse(s.startedAt)-Date.parse(a.startedAt));for(let a of o){if(!St(a.pid)){t.registry.unregister(a.id);continue}try{await R$(a.pid,"SIGTERM")}catch(s){s instanceof Error?_.debug("SYSTEM","Failed to send SIGTERM to child process",{pid:a.pid,type:a.type},s):_.warn("SYSTEM","Failed to send SIGTERM to child process (non-Error)",{pid:a.pid,type:a.type,error:String(s)})}}await M$(o,5e3);let i=o.filter(a=>St(a.pid));for(let a of i)try{await R$(a.pid,"SIGKILL")}catch(s){s instanceof Error?_.debug("SYSTEM","Failed to force kill child process",{pid:a.pid,type:a.type},s):_.warn("SYSTEM","Failed to force kill child process (non-Error)",{pid:a.pid,type:a.type,error:String(s)})}await M$(i,1e3);for(let a of o)t.registry.unregister(a.id);for(let a of n.filter(s=>s.pid===e))t.registry.unregister(a.id);try{(0,C$.rmSync)(r,{force:!0})}catch(a){a instanceof Error?_.debug("SYSTEM","Failed to remove PID file during shutdown",{pidFilePath:r},a):_.warn("SYSTEM","Failed to remove PID file during shutdown (non-Error)",{pidFilePath:r,error:String(a)})}t.registry.pruneDeadEntries()}async function M$(t,e){let r=Date.now()+e;for(;Date.now()<r;){if(t.filter(o=>St(o.pid)).length===0)return;await new Promise(o=>setTimeout(o,100))}}async function R$(t,e){if(e==="SIGTERM"){try{process.kill(t,e)}catch(r){if(r instanceof Error&&r.code==="ESRCH")return;throw r}return}if(process.platform==="win32"){let r=await jO();if(r){await new Promise((o,i)=>{r(t,e,a=>{if(!a){o();return}if(a.code==="ESRCH"){o();return}i(a)})});return}let n=["/PID",String(t),"/T"];e==="SIGKILL"&&n.push("/F"),await PO("taskkill",n,{timeout:pt.POWERSHELL_COMMAND,windowsHide:!0});return}try{process.kill(t,e)}catch(r){if(r instanceof Error&&r.code==="ESRCH")return;throw r}}async function jO(){let t="tree-kill";try{let e=await import(t);return e.default??e}catch(e){return _.debug("SYSTEM","tree-kill module not available, using fallback",{},e instanceof Error?e:void 0),null}}var F$=3e4,Rn=null;function DO(){let e=Qs().pruneDeadEntries();e>0&&_.info("SYSTEM",`Health check: pruned ${e} dead process(es) from registry`)}function q$(){Rn===null&&(Rn=setInterval(DO,F$),Rn.unref(),_.debug("SYSTEM","Health checker started",{intervalMs:F$}))}function V$(){Rn!==null&&(clearInterval(Rn),Rn=null,_.debug("SYSTEM","Health checker stopped"))}var NO=rm.default.join((0,W$.homedir)(),".claude-mem"),MO=rm.default.join(NO,"worker.pid"),tm=class{registry;started=!1;stopPromise=null;signalHandlersRegistered=!1;shutdownInitiated=!1;shutdownHandler=null;constructor(e){this.registry=e}async start(){if(this.started)return;if(this.registry.initialize(),nm({logAlive:!1})==="alive")throw new Error("Worker already running");this.started=!0,q$()}configureSignalHandlers(e){if(this.shutdownHandler=e,this.signalHandlersRegistered)return;this.signalHandlersRegistered=!0;let r=async n=>{if(this.shutdownInitiated){_.warn("SYSTEM",`Received ${n} but shutdown already in progress`);return}this.shutdownInitiated=!0,_.info("SYSTEM",`Received ${n}, shutting down...`);try{this.shutdownHandler?await this.shutdownHandler():await this.stop()}catch(o){o instanceof Error?_.error("SYSTEM","Error during shutdown",{},o):_.error("SYSTEM","Error during shutdown (non-Error)",{error:String(o)});try{await this.stop()}catch(i){i instanceof Error?_.debug("SYSTEM","Supervisor shutdown fallback failed",{},i):_.debug("SYSTEM","Supervisor shutdown fallback failed",{error:String(i)})}}process.exit(0)};process.on("SIGTERM",()=>{r("SIGTERM")}),process.on("SIGINT",()=>{r("SIGINT")}),process.platform!=="win32"&&(process.argv.includes("--daemon")?process.on("SIGHUP",()=>{_.debug("SYSTEM","Ignoring SIGHUP in daemon mode")}):process.on("SIGHUP",()=>{r("SIGHUP")}))}async stop(){if(this.stopPromise){await this.stopPromise;return}V$(),this.stopPromise=L$({registry:this.registry,currentPid:process.pid}).finally(()=>{this.started=!1,this.stopPromise=null}),await this.stopPromise}assertCanSpawn(e){if(this.stopPromise!==null)throw new Error(`Supervisor is shutting down, refusing to spawn ${e}`)}registerProcess(e,r,n){this.registry.register(e,r,n)}unregisterProcess(e){this.registry.unregister(e)}getRegistry(){return this.registry}},RO=new tm(Qs());function J$(){return RO}function nm(t={}){let e=t.pidFilePath??MO;if(!(0,Lr.existsSync)(e))return"missing";let r=null;try{r=JSON.parse((0,Lr.readFileSync)(e,"utf-8"))}catch(n){return n instanceof Error?_.warn("SYSTEM","Failed to parse worker PID file, removing it",{path:e},n):_.warn("SYSTEM","Failed to parse worker PID file, removing it",{path:e,error:String(n)}),(0,Lr.rmSync)(e,{force:!0}),"invalid"}return St(r.pid)?((t.logAlive??!0)&&_.info("SYSTEM","Worker already running (PID alive)",{existingPid:r.pid,existingPort:r.port,startedAt:r.startedAt}),"alive"):(_.info("SYSTEM","Removing stale PID file (worker process is dead)",{pid:r.pid,port:r.port,startedAt:r.startedAt}),(0,Lr.rmSync)(e,{force:!0}),"stale")}var r6=(0,G$.promisify)(tr.exec),AO=er.default.join((0,im.homedir)(),".claude-mem"),An=er.default.join(AO,"worker.pid");function H$(t){return t?/(^|[\\/])bun(\.exe)?$/i.test(t.trim()):!1}function CO(t,e){let r=e==="win32"?`where ${t}`:`which ${t}`,n;try{n=(0,tr.execSync)(r,{stdio:["ignore","pipe","ignore"],encoding:"utf-8",windowsHide:!0})}catch(i){return i instanceof Error?_.debug("SYSTEM",`Binary lookup failed for ${t}`,{command:r},i):_.debug("SYSTEM",`Binary lookup failed for ${t}`,{command:r},new Error(String(i))),null}return n.split(/\r?\n/).map(i=>i.trim()).find(i=>i.length>0)||null}var om;function UO(t={}){let e=Object.keys(t).length===0;if(e&&om!==void 0)return om;let r=ZO(t);return e&&r!==null&&(om=r),r}function ZO(t){let e=t.platform??process.platform,r=t.execPath??process.execPath;if(H$(r))return r;let n=t.env??process.env,o=t.homeDirectory??(0,im.homedir)(),i=t.pathExists??qe.existsSync,a=t.lookupInPath??CO,s=e==="win32"?[n.BUN,n.BUN_PATH,er.default.join(o,".bun","bin","bun.exe"),er.default.join(o,".bun","bin","bun"),n.USERPROFILE?er.default.join(n.USERPROFILE,".bun","bin","bun.exe"):void 0,n.LOCALAPPDATA?er.default.join(n.LOCALAPPDATA,"bun","bun.exe"):void 0,n.LOCALAPPDATA?er.default.join(n.LOCALAPPDATA,"bun","bin","bun.exe"):void 0]:[n.BUN,n.BUN_PATH,er.default.join(o,".bun","bin","bun"),"/usr/local/bin/bun","/opt/homebrew/bin/bun","/home/linuxbrew/.linuxbrew/bin/bun","/usr/bin/bun","/snap/bin/bun"];for(let c of s){let u=c?.trim();if(u&&(H$(u)&&i(u)||u.toLowerCase()==="bun"))return u}return a("bun",e)}function K$(){if((0,qe.existsSync)(An))try{(0,qe.unlinkSync)(An)}catch(t){t instanceof Error?_.warn("SYSTEM","Failed to remove PID file",{path:An},t):_.warn("SYSTEM","Failed to remove PID file",{path:An},new Error(String(t)))}}function Cn(t){return process.platform==="win32"?Math.round(t*2):t}function Y$(t,e,r={}){let n=process.platform==="win32";J$().assertCanSpawn("worker daemon");let o=D$({...process.env,CLAUDE_MEM_WORKER_PORT:String(e),...r}),i=UO();if(!i){_.error("SYSTEM","Bun runtime not found \u2014 install from https://bun.sh and ensure it is on PATH or set BUN env var. The worker daemon requires Bun because it uses bun:sqlite.");return}if(n){let c=`Start-Process -FilePath '${i.replace(/'/g,"''")}' -ArgumentList @('${t.replace(/'/g,"''")}','--daemon') -WindowStyle Hidden`,u=Buffer.from(c,"utf16le").toString("base64");try{return(0,tr.execSync)(`powershell -NoProfile -EncodedCommand ${u}`,{stdio:"ignore",windowsHide:!0,env:o}),0}catch(l){l instanceof Error?_.error("SYSTEM","Failed to spawn worker daemon on Windows",{runtimePath:i},l):_.error("SYSTEM","Failed to spawn worker daemon on Windows",{runtimePath:i},new Error(String(l)));return}}let a="/usr/bin/setsid";if((0,qe.existsSync)(a)){let c=(0,tr.spawn)(a,[i,t,"--daemon"],{detached:!0,stdio:"ignore",env:o});return c.pid===void 0?void 0:(c.unref(),c.pid)}let s=(0,tr.spawn)(i,[t,"--daemon"],{detached:!0,stdio:"ignore",env:o});if(s.pid!==void 0)return s.unref(),s.pid}function B$(){try{if(!(0,qe.existsSync)(An))return;let t=new Date;(0,qe.utimesSync)(An,t,t)}catch{}}function X$(){return nm({logAlive:!1})}var Q$=kt(require("net"),1);async function LO(t,e,r="GET"){let n=await fetch(`http://127.0.0.1:${t}${e}`,{method:r}),o="";try{o=await n.text()}catch{}return{ok:n.ok,statusCode:n.status,body:o}}async function eb(t){if(process.platform==="win32")try{return(await fetch(`http://127.0.0.1:${t}/api/health`)).ok}catch(e){return e instanceof Error?_.debug("SYSTEM","Windows health check failed (port not in use)",{},e):_.debug("SYSTEM","Windows health check failed (port not in use)",{error:String(e)}),!1}return new Promise(e=>{let r=Q$.default.createServer();r.once("error",n=>{n.code==="EADDRINUSE"?e(!0):e(!1)}),r.once("listening",()=>{r.close(()=>e(!1))}),r.listen(t,"127.0.0.1")})}async function tb(t,e,r,n){let o=Date.now();for(;Date.now()-o<r;){try{if((await LO(t,e)).ok)return!0}catch(i){i instanceof Error?_.debug("SYSTEM",n,{},i):_.debug("SYSTEM",n,{error:String(i)})}await new Promise(i=>setTimeout(i,500))}return!1}function Di(t,e=3e4){return tb(t,"/api/health",e,"Service not ready yet, will retry")}function am(t,e=3e4){return tb(t,"/api/readiness",e,"Worker not ready yet, will retry")}var FO=120*1e3;function cm(){return sm.default.join(Bt.get("CLAUDE_MEM_DATA_DIR"),".worker-start-attempted")}function qO(){if(process.platform!=="win32")return!1;let t=cm();if(!(0,ft.existsSync)(t))return!1;try{let e=(0,ft.statSync)(t).mtimeMs;return Date.now()-e<FO}catch(e){return e instanceof Error?_.debug("SYSTEM","Could not stat worker spawn lock file",{},e):_.debug("SYSTEM","Could not stat worker spawn lock file",{error:String(e)}),!1}}function VO(){if(process.platform==="win32")try{let t=cm();(0,ft.mkdirSync)(sm.default.dirname(t),{recursive:!0}),(0,ft.writeFileSync)(t,"","utf-8")}catch{}}function ec(){if(process.platform==="win32")try{let t=cm();(0,ft.existsSync)(t)&&(0,ft.unlinkSync)(t)}catch{}}async function rb(t,e){return e?(0,ft.existsSync)(e)?X$()==="alive"?(_.info("SYSTEM","Worker PID file points to a live process, skipping duplicate spawn"),await Di(t,Cn(pt.PORT_IN_USE_WAIT))?(ec(),_.info("SYSTEM","Worker became healthy while waiting on live PID"),!0):(_.warn("SYSTEM","Live PID detected but worker did not become healthy before timeout"),!1)):await Di(t,1e3)?(ec(),await am(t,Cn(pt.READINESS_WAIT))||_.warn("SYSTEM","Worker is alive but readiness timed out \u2014 proceeding anyway"),_.info("SYSTEM","Worker already running and healthy"),!0):await eb(t)?(_.info("SYSTEM","Port in use, waiting for worker to become healthy"),await Di(t,Cn(pt.PORT_IN_USE_WAIT))?(ec(),_.info("SYSTEM","Worker is now healthy"),!0):(_.error("SYSTEM","Port in use but worker not responding to health checks"),!1)):qO()?(_.warn("SYSTEM","Worker unavailable on Windows \u2014 skipping spawn (recent attempt failed within cooldown)"),!1):(_.info("SYSTEM","Starting worker daemon",{workerScriptPath:e}),VO(),Y$(e,t)===void 0?(_.error("SYSTEM","Failed to spawn worker daemon"),!1):await Di(t,Cn(pt.POST_SPAWN_WAIT))?(await am(t,Cn(pt.READINESS_WAIT))||_.warn("SYSTEM","Worker is alive but readiness timed out \u2014 proceeding anyway"),ec(),B$(),_.info("SYSTEM","Worker started successfully"),!0):(K$(),_.error("SYSTEM","Worker failed to start (health check timeout)"),!1)):(_.error("SYSTEM","ensureWorkerStarted: worker script not found at expected path \u2014 likely a partial install or build artifact missing",{workerScriptPath:e}),!1):(_.error("SYSTEM","ensureWorkerStarted called with empty workerScriptPath \u2014 caller bug"),!1)}var Ln=require("node:fs/promises"),Ai=require("node:path");var ib=require("node:child_process"),Me=require("node:fs"),ze=require("node:path"),mm=require("node:os"),dm=require("node:module");var oj={},pm=typeof __filename<"u"?(0,dm.createRequire)(__filename):(0,dm.createRequire)(oj.url),fm={".js":"javascript",".mjs":"javascript",".cjs":"javascript",".jsx":"tsx",".ts":"typescript",".tsx":"tsx",".py":"python",".pyw":"python",".go":"go",".rs":"rust",".rb":"ruby",".java":"java",".c":"c",".h":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".kt":"kotlin",".kts":"kotlin",".swift":"swift",".php":"php",".ex":"elixir",".exs":"elixir",".lua":"lua",".scala":"scala",".sc":"scala",".sh":"bash",".bash":"bash",".zsh":"bash",".hs":"haskell",".zig":"zig",".css":"css",".scss":"scss",".toml":"toml",".yml":"yaml",".yaml":"yaml",".sql":"sql",".md":"markdown",".mdx":"markdown"};function ab(t,e){let r=t.slice(t.lastIndexOf("."));return fm[r]?fm[r]:e.extensionToLanguage[r]?e.extensionToLanguage[r]:"unknown"}function sb(t,e){return e.languageToQueryKey[t]?e.languageToQueryKey[t]:HO(t)}var Ni=new Map,Un={grammars:{},extensionToLanguage:{},languageToQueryKey:{}};function Ri(t){if(Ni.has(t))return Ni.get(t);let e=(0,ze.join)(t,".claude-mem.json"),r;try{let i=(0,Me.readFileSync)(e,"utf-8");r=JSON.parse(i)}catch{return Ni.set(t,Un),Un}let n=r.grammars;if(!n||typeof n!="object"||Array.isArray(n))return Ni.set(t,Un),Un;let o={grammars:{},extensionToLanguage:{},languageToQueryKey:{}};for(let[i,a]of Object.entries(n)){if(cb[i]||!a||typeof a!="object"||Array.isArray(a))continue;let s=a,c=s.package,u=s.extensions,l=s.query;if(!(typeof c!="string"||!Array.isArray(u))&&u.every(d=>typeof d=="string")){o.grammars[i]={package:c,extensions:u,query:typeof l=="string"?l:void 0};for(let d of u)fm[d]||(o.extensionToLanguage[d]=i);if(typeof l=="string"){let d=(0,ze.join)(t,l);try{let p=(0,Me.readFileSync)(d,"utf-8"),f=`user_${i}`;lb[f]=p,o.languageToQueryKey[i]=f}catch{console.error(`[smart-file-read] Custom query file not found: ${d}, falling back to generic`),o.languageToQueryKey[i]="generic"}}else o.languageToQueryKey[i]="generic"}}return Ni.set(t,o),o}var cb={javascript:"tree-sitter-javascript",typescript:"tree-sitter-typescript/typescript",tsx:"tree-sitter-typescript/tsx",python:"tree-sitter-python",go:"tree-sitter-go",rust:"tree-sitter-rust",ruby:"tree-sitter-ruby",java:"tree-sitter-java",c:"tree-sitter-c",cpp:"tree-sitter-cpp",kotlin:"tree-sitter-kotlin",swift:"tree-sitter-swift",php:"tree-sitter-php/php",elixir:"tree-sitter-elixir",lua:"@tree-sitter-grammars/tree-sitter-lua",scala:"tree-sitter-scala",bash:"tree-sitter-bash",haskell:"tree-sitter-haskell",zig:"@tree-sitter-grammars/tree-sitter-zig",css:"tree-sitter-css",scss:"tree-sitter-scss",toml:"@tree-sitter-grammars/tree-sitter-toml",yaml:"@tree-sitter-grammars/tree-sitter-yaml",sql:"@derekstride/tree-sitter-sql",markdown:"@tree-sitter-grammars/tree-sitter-markdown"},WO={markdown:"tree-sitter-markdown"};function JO(t){let e=cb[t];if(!e)return null;let r=WO[t];if(r){try{let n=pm.resolve(e+"/package.json"),o=(0,ze.join)((0,ze.dirname)(n),r);if((0,Me.existsSync)((0,ze.join)(o,"src")))return o}catch{}return null}try{let n=pm.resolve(e+"/package.json");return(0,ze.dirname)(n)}catch{return null}}function ub(t,e){let r=JO(t);if(r)return r;if(!e)return null;let o=Ri(e).grammars[t];if(!o)return null;try{let i=(0,ze.join)(e,"node_modules",o.package,"package.json");if((0,Me.existsSync)(i)){let a=(0,ze.dirname)(i);if((0,Me.existsSync)((0,ze.join)(a,"src")))return a}}catch{}return console.error(`[smart-file-read] Grammar package not found for "${t}": ${o.package} (install it in your project's node_modules)`),null}var lb={jsts:`
|
|
55
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let s=a[1];if(e===a[0]){i(a);continue}if(t.external){let u=t.external.registry.get(a[0])?.id;if(e!==a[0]&&u){i(a);continue}}if(t.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&t.reused==="ref"){i(a);continue}}}function Oa(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=t.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let p=t.seen.get(l),f=p.schema;if(f.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),a._zod.parent===l)for(let g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(f.$ref&&p.def)for(let g in c)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(c[g])===JSON.stringify(p.def[g])&&delete c[g]}let d=a._zod.parent;if(d&&d!==l){n(d);let p=t.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}t.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(a)}Object.assign(o,r.def??r.schema);let i=t.external?.defs??{};for(let a of t.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Zo(e,"input",t.processors),output:Zo(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ze(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ze(n.element,r);if(n.type==="set")return Ze(n.valueType,r);if(n.type==="lazy")return Ze(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 Ze(n.innerType,r);if(n.type==="intersection")return Ze(n.left,r)||Ze(n.right,r);if(n.type==="record"||n.type==="map")return Ze(n.keyType,r)||Ze(n.valueType,r);if(n.type==="pipe")return Ze(n.in,r)||Ze(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ze(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ze(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ze(o,r))return!0;return!!(n.rest&&Ze(n.rest,r))}return!1}var Rh=(t,e={})=>r=>{let n=Pa({...r,processors:e});return fe(t,n),Ta(n,t),Oa(n,t)},Zo=(t,e,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Pa({...o??{},target:i,io:e,processors:r});return fe(t,a),Ta(a,t),Oa(a,t)};var hS={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ah=(t,e,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=hS[s]??s,o.format===""&&delete o.format,s==="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=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Ch=(t,e,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&e.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&e.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Uh=(t,e,r,n)=>{r.type="boolean"},Zh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Lh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Fh=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},qh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Vh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Wh=(t,e,r,n)=>{r.not={}},Jh=(t,e,r,n)=>{},Hh=(t,e,r,n)=>{},Gh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Kh=(t,e,r,n)=>{let o=t._zod.def,i=so(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Yh=(t,e,r,n)=>{let o=t._zod.def,i=[];for(let a of o.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Bh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Xh=(t,e,r,n)=>{let o=r,i=t._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Qh=(t,e,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=t._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},eg=(t,e,r,n)=>{r.type="boolean"},tg=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},rg=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},ng=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},og=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},ig=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},ag=(t,e,r,n)=>{let o=r,i=t._zod.def,{minimum:a,maximum:s}=t._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=fe(i.element,e,{...n,path:[...n.path,"items"]})},sg=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=fe(a[u],e,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=fe(i.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},Bl=(t,e,r,n)=>{let o=t._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>fe(s,e,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},cg=(t,e,r,n)=>{let o=t._zod.def,i=fe(o.left,e,{...n,path:[...n.path,"allOf",0]}),a=fe(o.right,e,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},ug=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="array";let a=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,f)=>fe(p,e,{...n,path:[...n.path,a,f]})),u=i.rest?fe(i.rest,e,{...n,path:[...n.path,s,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null;e.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):e.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=t._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},lg=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=fe(i.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=fe(i.keyType,e,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=fe(i.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},dg=(t,e,r,n)=>{let o=t._zod.def,i=fe(o.innerType,e,n),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},pg=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},fg=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},mg=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},hg=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},gg=(t,e,r,n)=>{let o=t._zod.def,i=e.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;fe(i,e,n);let a=e.seen.get(t);a.ref=i},vg=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.readOnly=!0},_g=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},Xl=(t,e,r,n)=>{let o=t._zod.def;fe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},yg=(t,e,r,n)=>{let o=t._zod.innerType;fe(o,e,n);let i=e.seen.get(t);i.ref=o};function mn(t){return!!t._zod}function dr(t,e){return mn(t)?un(t,e):t.safeParse(e)}function ja(t){if(!t)return;let e;if(mn(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Sg(t){if(mn(t)){let i=t._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var Lo={};Jn(Lo,{ZodAny:()=>Lg,ZodArray:()=>Wg,ZodBase64:()=>xd,ZodBase64URL:()=>Sd,ZodBigInt:()=>La,ZodBigIntFormat:()=>Ed,ZodBoolean:()=>Za,ZodCIDRv4:()=>$d,ZodCIDRv6:()=>bd,ZodCUID:()=>fd,ZodCUID2:()=>md,ZodCatch:()=>dv,ZodCodec:()=>Dd,ZodCustom:()=>Ha,ZodCustomStringFormat:()=>qo,ZodDate:()=>zd,ZodDefault:()=>iv,ZodDiscriminatedUnion:()=>Hg,ZodE164:()=>kd,ZodEmail:()=>ld,ZodEmoji:()=>dd,ZodEnum:()=>Fo,ZodExactOptional:()=>rv,ZodFile:()=>ev,ZodFunction:()=>$v,ZodGUID:()=>Na,ZodIPv4:()=>_d,ZodIPv6:()=>yd,ZodIntersection:()=>Gg,ZodJWT:()=>wd,ZodKSUID:()=>vd,ZodLazy:()=>vv,ZodLiteral:()=>Qg,ZodMAC:()=>Ag,ZodMap:()=>Bg,ZodNaN:()=>fv,ZodNanoID:()=>pd,ZodNever:()=>qg,ZodNonOptional:()=>Od,ZodNull:()=>Zg,ZodNullable:()=>ov,ZodNumber:()=>Ua,ZodNumberFormat:()=>hn,ZodObject:()=>qa,ZodOptional:()=>Td,ZodPipe:()=>jd,ZodPrefault:()=>sv,ZodPromise:()=>yv,ZodReadonly:()=>mv,ZodRecord:()=>Ja,ZodSet:()=>Xg,ZodString:()=>Aa,ZodStringFormat:()=>ue,ZodSuccess:()=>lv,ZodSymbol:()=>Cg,ZodTemplateLiteral:()=>gv,ZodTransform:()=>tv,ZodTuple:()=>Kg,ZodType:()=>V,ZodULID:()=>hd,ZodURL:()=>Ca,ZodUUID:()=>Wt,ZodUndefined:()=>Ug,ZodUnion:()=>Va,ZodUnknown:()=>Fg,ZodVoid:()=>Vg,ZodXID:()=>gd,ZodXor:()=>Jg,_ZodString:()=>ud,_default:()=>av,_function:()=>Dk,any:()=>hk,array:()=>Y,base64:()=>XS,base64url:()=>QS,bigint:()=>lk,boolean:()=>$e,catch:()=>pv,check:()=>Nk,cidrv4:()=>YS,cidrv6:()=>BS,codec:()=>Tk,cuid:()=>FS,cuid2:()=>qS,custom:()=>Nd,date:()=>vk,describe:()=>Mk,discriminatedUnion:()=>Wa,e164:()=>ek,email:()=>jS,emoji:()=>ZS,enum:()=>Oe,exactOptional:()=>nv,file:()=>Ek,float32:()=>ak,float64:()=>sk,function:()=>Dk,guid:()=>DS,hash:()=>ik,hex:()=>ok,hostname:()=>nk,httpUrl:()=>US,instanceof:()=>Ak,int:()=>cd,int32:()=>ck,int64:()=>dk,intersection:()=>Vo,ipv4:()=>HS,ipv6:()=>KS,json:()=>Uk,jwt:()=>tk,keyof:()=>_k,ksuid:()=>JS,lazy:()=>_v,literal:()=>j,looseObject:()=>Te,looseRecord:()=>xk,mac:()=>GS,map:()=>Sk,meta:()=>Rk,nan:()=>Pk,nanoid:()=>LS,nativeEnum:()=>wk,never:()=>Id,nonoptional:()=>uv,null:()=>Fa,nullable:()=>Ma,nullish:()=>Ik,number:()=>oe,object:()=>P,optional:()=>me,partialRecord:()=>bk,pipe:()=>Ra,prefault:()=>cv,preprocess:()=>Ga,promise:()=>jk,readonly:()=>hv,record:()=>ae,refine:()=>bv,set:()=>kk,strictObject:()=>yk,string:()=>v,stringFormat:()=>rk,stringbool:()=>Ck,success:()=>zk,superRefine:()=>xv,symbol:()=>fk,templateLiteral:()=>Ok,transform:()=>Pd,tuple:()=>Yg,uint32:()=>uk,uint64:()=>pk,ulid:()=>VS,undefined:()=>mk,union:()=>de,unknown:()=>le,url:()=>CS,uuid:()=>NS,uuidv4:()=>MS,uuidv6:()=>RS,uuidv7:()=>AS,void:()=>gk,xid:()=>WS,xor:()=>$k});var Da={};Jn(Da,{endsWith:()=>No,gt:()=>qt,gte:()=>Ue,includes:()=>jo,length:()=>pn,lowercase:()=>To,lt:()=>Ft,lte:()=>et,maxLength:()=>dn,maxSize:()=>Tr,mime:()=>Mo,minLength:()=>lr,minSize:()=>Vt,multipleOf:()=>Pr,negative:()=>Zl,nonnegative:()=>Fl,nonpositive:()=>Ll,normalize:()=>Ro,overwrite:()=>zt,positive:()=>Ul,property:()=>ql,regex:()=>Po,size:()=>ln,slugify:()=>za,startsWith:()=>Do,toLowerCase:()=>Co,toUpperCase:()=>Uo,trim:()=>Ao,uppercase:()=>Oo});var Or={};Jn(Or,{ZodISODate:()=>rd,ZodISODateTime:()=>ed,ZodISODuration:()=>ad,ZodISOTime:()=>od,date:()=>nd,datetime:()=>td,duration:()=>sd,time:()=>id});var ed=m("ZodISODateTime",(t,e)=>{mu.init(t,e),ue.init(t,e)});function td(t){return gl(ed,t)}var rd=m("ZodISODate",(t,e)=>{hu.init(t,e),ue.init(t,e)});function nd(t){return vl(rd,t)}var od=m("ZodISOTime",(t,e)=>{gu.init(t,e),ue.init(t,e)});function id(t){return _l(od,t)}var ad=m("ZodISODuration",(t,e)=>{vu.init(t,e),ue.init(t,e)});function sd(t){return yl(ad,t)}var kg=(t,e)=>{Hi.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Ki(t,r)},flatten:{value:r=>Gi(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,an,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,an,2)}},isEmpty:{get(){return t.issues.length===0}}})},EA=m("ZodError",kg),tt=m("ZodError",kg,{Parent:Error});var wg=mo(tt),Eg=go(tt),Ig=_o(tt),zg=yo(tt),Pg=Um(tt),Tg=Zm(tt),Og=Lm(tt),jg=Fm(tt),Dg=qm(tt),Ng=Vm(tt),Mg=Wm(tt),Rg=Jm(tt);var V=m("ZodType",(t,e)=>(L.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Zo(t,"input"),output:Zo(t,"output")}}),t.toJSONSchema=Rh(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(b.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),t.with=t.check,t.clone=(r,n)=>Ae(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>wg(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Ig(t,r,n),t.parseAsync=async(r,n)=>Eg(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>zg(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>Pg(t,r,n),t.decode=(r,n)=>Tg(t,r,n),t.encodeAsync=async(r,n)=>Og(t,r,n),t.decodeAsync=async(r,n)=>jg(t,r,n),t.safeEncode=(r,n)=>Dg(t,r,n),t.safeDecode=(r,n)=>Ng(t,r,n),t.safeEncodeAsync=async(r,n)=>Mg(t,r,n),t.safeDecodeAsync=async(r,n)=>Rg(t,r,n),t.refine=(r,n)=>t.check(bv(r,n)),t.superRefine=r=>t.check(xv(r)),t.overwrite=r=>t.check(zt(r)),t.optional=()=>me(t),t.exactOptional=()=>nv(t),t.nullable=()=>Ma(t),t.nullish=()=>me(Ma(t)),t.nonoptional=r=>uv(t,r),t.array=()=>Y(t),t.or=r=>de([t,r]),t.and=r=>Vo(t,r),t.transform=r=>Ra(t,Pd(r)),t.default=r=>av(t,r),t.prefault=r=>cv(t,r),t.catch=r=>pv(t,r),t.pipe=r=>Ra(t,r),t.readonly=()=>hv(t),t.describe=r=>{let n=t.clone();return Ce.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ce.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ce.get(t);let n=t.clone();return Ce.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=r=>r(t),t)),ud=m("_ZodString",(t,e)=>{zr.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Ah(t,n,o,i);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(Po(...n)),t.includes=(...n)=>t.check(jo(...n)),t.startsWith=(...n)=>t.check(Do(...n)),t.endsWith=(...n)=>t.check(No(...n)),t.min=(...n)=>t.check(lr(...n)),t.max=(...n)=>t.check(dn(...n)),t.length=(...n)=>t.check(pn(...n)),t.nonempty=(...n)=>t.check(lr(1,...n)),t.lowercase=n=>t.check(To(n)),t.uppercase=n=>t.check(Oo(n)),t.trim=()=>t.check(Ao()),t.normalize=(...n)=>t.check(Ro(...n)),t.toLowerCase=()=>t.check(Co()),t.toUpperCase=()=>t.check(Uo()),t.slugify=()=>t.check(za())}),Aa=m("ZodString",(t,e)=>{zr.init(t,e),ud.init(t,e),t.email=r=>t.check(ca(ld,r)),t.url=r=>t.check(zo(Ca,r)),t.jwt=r=>t.check(Ia(wd,r)),t.emoji=r=>t.check(fa(dd,r)),t.guid=r=>t.check(Io(Na,r)),t.uuid=r=>t.check(ua(Wt,r)),t.uuidv4=r=>t.check(la(Wt,r)),t.uuidv6=r=>t.check(da(Wt,r)),t.uuidv7=r=>t.check(pa(Wt,r)),t.nanoid=r=>t.check(ma(pd,r)),t.guid=r=>t.check(Io(Na,r)),t.cuid=r=>t.check(ha(fd,r)),t.cuid2=r=>t.check(ga(md,r)),t.ulid=r=>t.check(va(hd,r)),t.base64=r=>t.check(ka(xd,r)),t.base64url=r=>t.check(wa(Sd,r)),t.xid=r=>t.check(_a(gd,r)),t.ksuid=r=>t.check(ya(vd,r)),t.ipv4=r=>t.check($a(_d,r)),t.ipv6=r=>t.check(ba(yd,r)),t.cidrv4=r=>t.check(xa($d,r)),t.cidrv6=r=>t.check(Sa(bd,r)),t.e164=r=>t.check(Ea(kd,r)),t.datetime=r=>t.check(td(r)),t.date=r=>t.check(nd(r)),t.time=r=>t.check(id(r)),t.duration=r=>t.check(sd(r))});function v(t){return ml(Aa,t)}var ue=m("ZodStringFormat",(t,e)=>{ie.init(t,e),ud.init(t,e)}),ld=m("ZodEmail",(t,e)=>{iu.init(t,e),ue.init(t,e)});function jS(t){return ca(ld,t)}var Na=m("ZodGUID",(t,e)=>{nu.init(t,e),ue.init(t,e)});function DS(t){return Io(Na,t)}var Wt=m("ZodUUID",(t,e)=>{ou.init(t,e),ue.init(t,e)});function NS(t){return ua(Wt,t)}function MS(t){return la(Wt,t)}function RS(t){return da(Wt,t)}function AS(t){return pa(Wt,t)}var Ca=m("ZodURL",(t,e)=>{au.init(t,e),ue.init(t,e)});function CS(t){return zo(Ca,t)}function US(t){return zo(Ca,{protocol:/^https?$/,hostname:it.domain,...b.normalizeParams(t)})}var dd=m("ZodEmoji",(t,e)=>{su.init(t,e),ue.init(t,e)});function ZS(t){return fa(dd,t)}var pd=m("ZodNanoID",(t,e)=>{cu.init(t,e),ue.init(t,e)});function LS(t){return ma(pd,t)}var fd=m("ZodCUID",(t,e)=>{uu.init(t,e),ue.init(t,e)});function FS(t){return ha(fd,t)}var md=m("ZodCUID2",(t,e)=>{lu.init(t,e),ue.init(t,e)});function qS(t){return ga(md,t)}var hd=m("ZodULID",(t,e)=>{du.init(t,e),ue.init(t,e)});function VS(t){return va(hd,t)}var gd=m("ZodXID",(t,e)=>{pu.init(t,e),ue.init(t,e)});function WS(t){return _a(gd,t)}var vd=m("ZodKSUID",(t,e)=>{fu.init(t,e),ue.init(t,e)});function JS(t){return ya(vd,t)}var _d=m("ZodIPv4",(t,e)=>{_u.init(t,e),ue.init(t,e)});function HS(t){return $a(_d,t)}var Ag=m("ZodMAC",(t,e)=>{$u.init(t,e),ue.init(t,e)});function GS(t){return hl(Ag,t)}var yd=m("ZodIPv6",(t,e)=>{yu.init(t,e),ue.init(t,e)});function KS(t){return ba(yd,t)}var $d=m("ZodCIDRv4",(t,e)=>{bu.init(t,e),ue.init(t,e)});function YS(t){return xa($d,t)}var bd=m("ZodCIDRv6",(t,e)=>{xu.init(t,e),ue.init(t,e)});function BS(t){return Sa(bd,t)}var xd=m("ZodBase64",(t,e)=>{Su.init(t,e),ue.init(t,e)});function XS(t){return ka(xd,t)}var Sd=m("ZodBase64URL",(t,e)=>{ku.init(t,e),ue.init(t,e)});function QS(t){return wa(Sd,t)}var kd=m("ZodE164",(t,e)=>{wu.init(t,e),ue.init(t,e)});function ek(t){return Ea(kd,t)}var wd=m("ZodJWT",(t,e)=>{Eu.init(t,e),ue.init(t,e)});function tk(t){return Ia(wd,t)}var qo=m("ZodCustomStringFormat",(t,e)=>{Iu.init(t,e),ue.init(t,e)});function rk(t,e,r={}){return fn(qo,t,e,r)}function nk(t){return fn(qo,"hostname",it.hostname,t)}function ok(t){return fn(qo,"hex",it.hex,t)}function ik(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=it[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return fn(qo,n,o,e)}var Ua=m("ZodNumber",(t,e)=>{oa.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Ch(t,n,o,i),t.gt=(n,o)=>t.check(qt(n,o)),t.gte=(n,o)=>t.check(Ue(n,o)),t.min=(n,o)=>t.check(Ue(n,o)),t.lt=(n,o)=>t.check(Ft(n,o)),t.lte=(n,o)=>t.check(et(n,o)),t.max=(n,o)=>t.check(et(n,o)),t.int=n=>t.check(cd(n)),t.safe=n=>t.check(cd(n)),t.positive=n=>t.check(qt(0,n)),t.nonnegative=n=>t.check(Ue(0,n)),t.negative=n=>t.check(Ft(0,n)),t.nonpositive=n=>t.check(et(0,n)),t.multipleOf=(n,o)=>t.check(Pr(n,o)),t.step=(n,o)=>t.check(Pr(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function oe(t){return $l(Ua,t)}var hn=m("ZodNumberFormat",(t,e)=>{zu.init(t,e),Ua.init(t,e)});function cd(t){return bl(hn,t)}function ak(t){return xl(hn,t)}function sk(t){return Sl(hn,t)}function ck(t){return kl(hn,t)}function uk(t){return wl(hn,t)}var Za=m("ZodBoolean",(t,e)=>{ko.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Uh(t,r,n,o)});function $e(t){return El(Za,t)}var La=m("ZodBigInt",(t,e)=>{ia.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Zh(t,n,o,i),t.gte=(n,o)=>t.check(Ue(n,o)),t.min=(n,o)=>t.check(Ue(n,o)),t.gt=(n,o)=>t.check(qt(n,o)),t.gte=(n,o)=>t.check(Ue(n,o)),t.min=(n,o)=>t.check(Ue(n,o)),t.lt=(n,o)=>t.check(Ft(n,o)),t.lte=(n,o)=>t.check(et(n,o)),t.max=(n,o)=>t.check(et(n,o)),t.positive=n=>t.check(qt(BigInt(0),n)),t.negative=n=>t.check(Ft(BigInt(0),n)),t.nonpositive=n=>t.check(et(BigInt(0),n)),t.nonnegative=n=>t.check(Ue(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Pr(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function lk(t){return Il(La,t)}var Ed=m("ZodBigIntFormat",(t,e)=>{Pu.init(t,e),La.init(t,e)});function dk(t){return zl(Ed,t)}function pk(t){return Pl(Ed,t)}var Cg=m("ZodSymbol",(t,e)=>{Tu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Lh(t,r,n,o)});function fk(t){return Tl(Cg,t)}var Ug=m("ZodUndefined",(t,e)=>{Ou.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>qh(t,r,n,o)});function mk(t){return Ol(Ug,t)}var Zg=m("ZodNull",(t,e)=>{ju.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Fh(t,r,n,o)});function Fa(t){return jl(Zg,t)}var Lg=m("ZodAny",(t,e)=>{Du.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Jh(t,r,n,o)});function hk(){return Dl(Lg)}var Fg=m("ZodUnknown",(t,e)=>{Nu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Hh(t,r,n,o)});function le(){return Nl(Fg)}var qg=m("ZodNever",(t,e)=>{Mu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Wh(t,r,n,o)});function Id(t){return Ml(qg,t)}var Vg=m("ZodVoid",(t,e)=>{Ru.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Vh(t,r,n,o)});function gk(t){return Rl(Vg,t)}var zd=m("ZodDate",(t,e)=>{Au.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Gh(t,n,o,i),t.min=(n,o)=>t.check(Ue(n,o)),t.max=(n,o)=>t.check(et(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function vk(t){return Al(zd,t)}var Wg=m("ZodArray",(t,e)=>{Cu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ag(t,r,n,o),t.element=e.element,t.min=(r,n)=>t.check(lr(r,n)),t.nonempty=r=>t.check(lr(1,r)),t.max=(r,n)=>t.check(dn(r,n)),t.length=(r,n)=>t.check(pn(r,n)),t.unwrap=()=>t.element});function Y(t,e){return Mh(Wg,t,e)}function _k(t){let e=t._zod.def.shape;return Oe(Object.keys(e))}var qa=m("ZodObject",(t,e)=>{Dh.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>sg(t,r,n,o),b.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Oe(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:le()}),t.loose=()=>t.clone({...t._zod.def,catchall:le()}),t.strict=()=>t.clone({...t._zod.def,catchall:Id()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>b.extend(t,r),t.safeExtend=r=>b.safeExtend(t,r),t.merge=r=>b.merge(t,r),t.pick=r=>b.pick(t,r),t.omit=r=>b.omit(t,r),t.partial=(...r)=>b.partial(Td,t,r[0]),t.required=(...r)=>b.required(Od,t,r[0])});function P(t,e){let r={type:"object",shape:t??{},...b.normalizeParams(e)};return new qa(r)}function yk(t,e){return new qa({type:"object",shape:t,catchall:Id(),...b.normalizeParams(e)})}function Te(t,e){return new qa({type:"object",shape:t,catchall:le(),...b.normalizeParams(e)})}var Va=m("ZodUnion",(t,e)=>{wo.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Bl(t,r,n,o),t.options=e.options});function de(t,e){return new Va({type:"union",options:t,...b.normalizeParams(e)})}var Jg=m("ZodXor",(t,e)=>{Va.init(t,e),Uu.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Bl(t,r,n,o),t.options=e.options});function $k(t,e){return new Jg({type:"union",options:t,inclusive:!1,...b.normalizeParams(e)})}var Hg=m("ZodDiscriminatedUnion",(t,e)=>{Va.init(t,e),Zu.init(t,e)});function Wa(t,e,r){return new Hg({type:"union",options:e,discriminator:t,...b.normalizeParams(r)})}var Gg=m("ZodIntersection",(t,e)=>{Lu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>cg(t,r,n,o)});function Vo(t,e){return new Gg({type:"intersection",left:t,right:e})}var Kg=m("ZodTuple",(t,e)=>{aa.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ug(t,r,n,o),t.rest=r=>t.clone({...t._zod.def,rest:r})});function Yg(t,e,r){let n=e instanceof L,o=n?r:e,i=n?e:null;return new Kg({type:"tuple",items:t,rest:i,...b.normalizeParams(o)})}var Ja=m("ZodRecord",(t,e)=>{Fu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>lg(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType});function ae(t,e,r){return new Ja({type:"record",keyType:t,valueType:e,...b.normalizeParams(r)})}function bk(t,e,r){let n=Ae(t);return n._zod.values=void 0,new Ja({type:"record",keyType:n,valueType:e,...b.normalizeParams(r)})}function xk(t,e,r){return new Ja({type:"record",keyType:t,valueType:e,mode:"loose",...b.normalizeParams(r)})}var Bg=m("ZodMap",(t,e)=>{qu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>og(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(Vt(...r)),t.nonempty=r=>t.check(Vt(1,r)),t.max=(...r)=>t.check(Tr(...r)),t.size=(...r)=>t.check(ln(...r))});function Sk(t,e,r){return new Bg({type:"map",keyType:t,valueType:e,...b.normalizeParams(r)})}var Xg=m("ZodSet",(t,e)=>{Vu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ig(t,r,n,o),t.min=(...r)=>t.check(Vt(...r)),t.nonempty=r=>t.check(Vt(1,r)),t.max=(...r)=>t.check(Tr(...r)),t.size=(...r)=>t.check(ln(...r))});function kk(t,e){return new Xg({type:"set",valueType:t,...b.normalizeParams(e)})}var Fo=m("ZodEnum",(t,e)=>{Wu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Kh(t,n,o,i),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Fo({...e,checks:[],...b.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Fo({...e,checks:[],...b.normalizeParams(o),entries:i})}});function Oe(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Fo({type:"enum",entries:r,...b.normalizeParams(e)})}function wk(t,e){return new Fo({type:"enum",entries:t,...b.normalizeParams(e)})}var Qg=m("ZodLiteral",(t,e)=>{Ju.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Yh(t,r,n,o),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function j(t,e){return new Qg({type:"literal",values:Array.isArray(t)?t:[t],...b.normalizeParams(e)})}var ev=m("ZodFile",(t,e)=>{Hu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Qh(t,r,n,o),t.min=(r,n)=>t.check(Vt(r,n)),t.max=(r,n)=>t.check(Tr(r,n)),t.mime=(r,n)=>t.check(Mo(Array.isArray(r)?r:[r],n))});function Ek(t){return Vl(ev,t)}var tv=m("ZodTransform",(t,e)=>{Gu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ng(t,r,n,o),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new wr(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(b.issue(i,r.value,e));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),r.issues.push(b.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Pd(t){return new tv({type:"transform",transform:t})}var Td=m("ZodOptional",(t,e)=>{sa.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Xl(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function me(t){return new Td({type:"optional",innerType:t})}var rv=m("ZodExactOptional",(t,e)=>{Ku.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Xl(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function nv(t){return new rv({type:"optional",innerType:t})}var ov=m("ZodNullable",(t,e)=>{Yu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>dg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Ma(t){return new ov({type:"nullable",innerType:t})}function Ik(t){return me(Ma(t))}var iv=m("ZodDefault",(t,e)=>{Bu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>fg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function av(t,e){return new iv({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():b.shallowClone(e)}})}var sv=m("ZodPrefault",(t,e)=>{Xu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>mg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function cv(t,e){return new sv({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():b.shallowClone(e)}})}var Od=m("ZodNonOptional",(t,e)=>{Qu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>pg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function uv(t,e){return new Od({type:"nonoptional",innerType:t,...b.normalizeParams(e)})}var lv=m("ZodSuccess",(t,e)=>{el.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>eg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function zk(t){return new lv({type:"success",innerType:t})}var dv=m("ZodCatch",(t,e)=>{tl.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>hg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function pv(t,e){return new dv({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var fv=m("ZodNaN",(t,e)=>{rl.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Bh(t,r,n,o)});function Pk(t){return Cl(fv,t)}var jd=m("ZodPipe",(t,e)=>{nl.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>gg(t,r,n,o),t.in=e.in,t.out=e.out});function Ra(t,e){return new jd({type:"pipe",in:t,out:e})}var Dd=m("ZodCodec",(t,e)=>{jd.init(t,e),Eo.init(t,e)});function Tk(t,e,r){return new Dd({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var mv=m("ZodReadonly",(t,e)=>{ol.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>vg(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function hv(t){return new mv({type:"readonly",innerType:t})}var gv=m("ZodTemplateLiteral",(t,e)=>{il.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Xh(t,r,n,o)});function Ok(t,e){return new gv({type:"template_literal",parts:t,...b.normalizeParams(e)})}var vv=m("ZodLazy",(t,e)=>{cl.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>yg(t,r,n,o),t.unwrap=()=>t._zod.def.getter()});function _v(t){return new vv({type:"lazy",getter:t})}var yv=m("ZodPromise",(t,e)=>{sl.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>_g(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function jk(t){return new yv({type:"promise",innerType:t})}var $v=m("ZodFunction",(t,e)=>{al.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>rg(t,r,n,o)});function Dk(t){return new $v({type:"function",input:Array.isArray(t?.input)?Yg(t?.input):t?.input??Y(le()),output:t?.output??le()})}var Ha=m("ZodCustom",(t,e)=>{ul.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>tg(t,r,n,o)});function Nk(t){let e=new ce({check:"custom"});return e._zod.check=t,e}function Nd(t,e){return Wl(Ha,t??(()=>!0),e)}function bv(t,e={}){return Jl(Ha,t,e)}function xv(t){return Hl(t)}var Mk=Gl,Rk=Kl;function Ak(t,e={}){let r=new Ha({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...b.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=n=>{n.value instanceof t||n.issues.push({code:"invalid_type",expected:t.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Ck=(...t)=>Yl({Codec:Dd,Boolean:Za,String:Aa},...t);function Uk(t){let e=_v(()=>de([v(t),oe(),$e(),Fa(),Y(e),ae(v(),e)]));return e}function Ga(t,e){return Ra(Pd(t),e)}var Sv;Sv||(Sv={});var NA={...Lo,...Da,iso:Or};be(ll());var Rd="2025-11-25";var kv=[Rd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],pr="io.modelcontextprotocol/related-task",Ya="2.0",xe=Nd(t=>t!==null&&(typeof t=="object"||typeof t=="function")),wv=de([v(),oe().int()]),Ev=v(),QA=Te({ttl:oe().optional(),pollInterval:oe().optional()}),qk=P({ttl:oe().optional()}),Vk=P({taskId:v()}),Ad=Te({progressToken:wv.optional(),[pr]:Vk.optional()}),rt=P({_meta:Ad.optional()}),Wo=rt.extend({task:qk.optional()}),Iv=t=>Wo.safeParse(t).success,Se=P({method:v(),params:rt.loose().optional()}),at=P({_meta:Ad.optional()}),st=P({method:v(),params:at.loose().optional()}),ke=Te({_meta:Ad.optional()}),Ba=de([v(),oe().int()]),zv=P({jsonrpc:j(Ya),id:Ba,...Se.shape}).strict(),Cd=t=>zv.safeParse(t).success,Pv=P({jsonrpc:j(Ya),...st.shape}).strict(),Tv=t=>Pv.safeParse(t).success,Ud=P({jsonrpc:j(Ya),id:Ba,result:ke}).strict(),Jo=t=>Ud.safeParse(t).success;var Q;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Q||(Q={}));var Zd=P({jsonrpc:j(Ya),id:Ba.optional(),error:P({code:oe().int(),message:v(),data:le().optional()})}).strict();var Ov=t=>Zd.safeParse(t).success;var jv=de([zv,Pv,Ud,Zd]),eC=de([Ud,Zd]),Xa=ke.strict(),Wk=at.extend({requestId:Ba.optional(),reason:v().optional()}),Qa=st.extend({method:j("notifications/cancelled"),params:Wk}),Jk=P({src:v(),mimeType:v().optional(),sizes:Y(v()).optional(),theme:Oe(["light","dark"]).optional()}),Ho=P({icons:Y(Jk).optional()}),gn=P({name:v(),title:v().optional()}),Dv=gn.extend({...gn.shape,...Ho.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Hk=Vo(P({applyDefaults:$e().optional()}),ae(v(),le())),Gk=Ga(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Vo(P({form:Hk.optional(),url:xe.optional()}),ae(v(),le()).optional())),Kk=Te({list:xe.optional(),cancel:xe.optional(),requests:Te({sampling:Te({createMessage:xe.optional()}).optional(),elicitation:Te({create:xe.optional()}).optional()}).optional()}),Yk=Te({list:xe.optional(),cancel:xe.optional(),requests:Te({tools:Te({call:xe.optional()}).optional()}).optional()}),Bk=P({experimental:ae(v(),xe).optional(),sampling:P({context:xe.optional(),tools:xe.optional()}).optional(),elicitation:Gk.optional(),roots:P({listChanged:$e().optional()}).optional(),tasks:Kk.optional(),extensions:ae(v(),xe).optional()}),Xk=rt.extend({protocolVersion:v(),capabilities:Bk,clientInfo:Dv}),Ld=Se.extend({method:j("initialize"),params:Xk});var Qk=P({experimental:ae(v(),xe).optional(),logging:xe.optional(),completions:xe.optional(),prompts:P({listChanged:$e().optional()}).optional(),resources:P({subscribe:$e().optional(),listChanged:$e().optional()}).optional(),tools:P({listChanged:$e().optional()}).optional(),tasks:Yk.optional(),extensions:ae(v(),xe).optional()}),ew=ke.extend({protocolVersion:v(),capabilities:Qk,serverInfo:Dv,instructions:v().optional()}),Fd=st.extend({method:j("notifications/initialized"),params:at.optional()});var es=Se.extend({method:j("ping"),params:rt.optional()}),tw=P({progress:oe(),total:me(oe()),message:me(v())}),rw=P({...at.shape,...tw.shape,progressToken:wv}),ts=st.extend({method:j("notifications/progress"),params:rw}),nw=rt.extend({cursor:Ev.optional()}),Go=Se.extend({params:nw.optional()}),Ko=ke.extend({nextCursor:Ev.optional()}),ow=Oe(["working","input_required","completed","failed","cancelled"]),Yo=P({taskId:v(),status:ow,ttl:de([oe(),Fa()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:me(oe()),statusMessage:me(v())}),vn=ke.extend({task:Yo}),iw=at.merge(Yo),Bo=st.extend({method:j("notifications/tasks/status"),params:iw}),rs=Se.extend({method:j("tasks/get"),params:rt.extend({taskId:v()})}),ns=ke.merge(Yo),os=Se.extend({method:j("tasks/result"),params:rt.extend({taskId:v()})}),tC=ke.loose(),is=Go.extend({method:j("tasks/list")}),as=Ko.extend({tasks:Y(Yo)}),ss=Se.extend({method:j("tasks/cancel"),params:rt.extend({taskId:v()})}),Nv=ke.merge(Yo),Mv=P({uri:v(),mimeType:me(v()),_meta:ae(v(),le()).optional()}),Rv=Mv.extend({text:v()}),qd=v().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Av=Mv.extend({blob:qd}),Xo=Oe(["user","assistant"]),_n=P({audience:Y(Xo).optional(),priority:oe().min(0).max(1).optional(),lastModified:Or.datetime({offset:!0}).optional()}),Cv=P({...gn.shape,...Ho.shape,uri:v(),description:me(v()),mimeType:me(v()),size:me(oe()),annotations:_n.optional(),_meta:me(Te({}))}),aw=P({...gn.shape,...Ho.shape,uriTemplate:v(),description:me(v()),mimeType:me(v()),annotations:_n.optional(),_meta:me(Te({}))}),sw=Go.extend({method:j("resources/list")}),cw=Ko.extend({resources:Y(Cv)}),uw=Go.extend({method:j("resources/templates/list")}),lw=Ko.extend({resourceTemplates:Y(aw)}),Vd=rt.extend({uri:v()}),dw=Vd,pw=Se.extend({method:j("resources/read"),params:dw}),fw=ke.extend({contents:Y(de([Rv,Av]))}),mw=st.extend({method:j("notifications/resources/list_changed"),params:at.optional()}),hw=Vd,gw=Se.extend({method:j("resources/subscribe"),params:hw}),vw=Vd,_w=Se.extend({method:j("resources/unsubscribe"),params:vw}),yw=at.extend({uri:v()}),$w=st.extend({method:j("notifications/resources/updated"),params:yw}),bw=P({name:v(),description:me(v()),required:me($e())}),xw=P({...gn.shape,...Ho.shape,description:me(v()),arguments:me(Y(bw)),_meta:me(Te({}))}),Sw=Go.extend({method:j("prompts/list")}),kw=Ko.extend({prompts:Y(xw)}),ww=rt.extend({name:v(),arguments:ae(v(),v()).optional()}),Ew=Se.extend({method:j("prompts/get"),params:ww}),Wd=P({type:j("text"),text:v(),annotations:_n.optional(),_meta:ae(v(),le()).optional()}),Jd=P({type:j("image"),data:qd,mimeType:v(),annotations:_n.optional(),_meta:ae(v(),le()).optional()}),Hd=P({type:j("audio"),data:qd,mimeType:v(),annotations:_n.optional(),_meta:ae(v(),le()).optional()}),Iw=P({type:j("tool_use"),name:v(),id:v(),input:ae(v(),le()),_meta:ae(v(),le()).optional()}),zw=P({type:j("resource"),resource:de([Rv,Av]),annotations:_n.optional(),_meta:ae(v(),le()).optional()}),Pw=Cv.extend({type:j("resource_link")}),Gd=de([Wd,Jd,Hd,Pw,zw]),Tw=P({role:Xo,content:Gd}),Ow=ke.extend({description:v().optional(),messages:Y(Tw)}),jw=st.extend({method:j("notifications/prompts/list_changed"),params:at.optional()}),Dw=P({title:v().optional(),readOnlyHint:$e().optional(),destructiveHint:$e().optional(),idempotentHint:$e().optional(),openWorldHint:$e().optional()}),Nw=P({taskSupport:Oe(["required","optional","forbidden"]).optional()}),Uv=P({...gn.shape,...Ho.shape,description:v().optional(),inputSchema:P({type:j("object"),properties:ae(v(),xe).optional(),required:Y(v()).optional()}).catchall(le()),outputSchema:P({type:j("object"),properties:ae(v(),xe).optional(),required:Y(v()).optional()}).catchall(le()).optional(),annotations:Dw.optional(),execution:Nw.optional(),_meta:ae(v(),le()).optional()}),Kd=Go.extend({method:j("tools/list")}),Mw=Ko.extend({tools:Y(Uv)}),cs=ke.extend({content:Y(Gd).default([]),structuredContent:ae(v(),le()).optional(),isError:$e().optional()}),rC=cs.or(ke.extend({toolResult:le()})),Rw=Wo.extend({name:v(),arguments:ae(v(),le()).optional()}),Qo=Se.extend({method:j("tools/call"),params:Rw}),Aw=st.extend({method:j("notifications/tools/list_changed"),params:at.optional()}),nC=P({autoRefresh:$e().default(!0),debounceMs:oe().int().nonnegative().default(300)}),ei=Oe(["debug","info","notice","warning","error","critical","alert","emergency"]),Cw=rt.extend({level:ei}),Yd=Se.extend({method:j("logging/setLevel"),params:Cw}),Uw=at.extend({level:ei,logger:v().optional(),data:le()}),Zw=st.extend({method:j("notifications/message"),params:Uw}),Lw=P({name:v().optional()}),Fw=P({hints:Y(Lw).optional(),costPriority:oe().min(0).max(1).optional(),speedPriority:oe().min(0).max(1).optional(),intelligencePriority:oe().min(0).max(1).optional()}),qw=P({mode:Oe(["auto","required","none"]).optional()}),Vw=P({type:j("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:Y(Gd).default([]),structuredContent:P({}).loose().optional(),isError:$e().optional(),_meta:ae(v(),le()).optional()}),Ww=Wa("type",[Wd,Jd,Hd]),Ka=Wa("type",[Wd,Jd,Hd,Iw,Vw]),Jw=P({role:Xo,content:de([Ka,Y(Ka)]),_meta:ae(v(),le()).optional()}),Hw=Wo.extend({messages:Y(Jw),modelPreferences:Fw.optional(),systemPrompt:v().optional(),includeContext:Oe(["none","thisServer","allServers"]).optional(),temperature:oe().optional(),maxTokens:oe().int(),stopSequences:Y(v()).optional(),metadata:xe.optional(),tools:Y(Uv).optional(),toolChoice:qw.optional()}),Gw=Se.extend({method:j("sampling/createMessage"),params:Hw}),ti=ke.extend({model:v(),stopReason:me(Oe(["endTurn","stopSequence","maxTokens"]).or(v())),role:Xo,content:Ww}),Bd=ke.extend({model:v(),stopReason:me(Oe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:Xo,content:de([Ka,Y(Ka)])}),Kw=P({type:j("boolean"),title:v().optional(),description:v().optional(),default:$e().optional()}),Yw=P({type:j("string"),title:v().optional(),description:v().optional(),minLength:oe().optional(),maxLength:oe().optional(),format:Oe(["email","uri","date","date-time"]).optional(),default:v().optional()}),Bw=P({type:Oe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:oe().optional(),maximum:oe().optional(),default:oe().optional()}),Xw=P({type:j("string"),title:v().optional(),description:v().optional(),enum:Y(v()),default:v().optional()}),Qw=P({type:j("string"),title:v().optional(),description:v().optional(),oneOf:Y(P({const:v(),title:v()})),default:v().optional()}),eE=P({type:j("string"),title:v().optional(),description:v().optional(),enum:Y(v()),enumNames:Y(v()).optional(),default:v().optional()}),tE=de([Xw,Qw]),rE=P({type:j("array"),title:v().optional(),description:v().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:P({type:j("string"),enum:Y(v())}),default:Y(v()).optional()}),nE=P({type:j("array"),title:v().optional(),description:v().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:P({anyOf:Y(P({const:v(),title:v()}))}),default:Y(v()).optional()}),oE=de([rE,nE]),iE=de([eE,tE,oE]),aE=de([iE,Kw,Yw,Bw]),sE=Wo.extend({mode:j("form").optional(),message:v(),requestedSchema:P({type:j("object"),properties:ae(v(),aE),required:Y(v()).optional()})}),cE=Wo.extend({mode:j("url"),message:v(),elicitationId:v(),url:v().url()}),uE=de([sE,cE]),lE=Se.extend({method:j("elicitation/create"),params:uE}),dE=at.extend({elicitationId:v()}),pE=st.extend({method:j("notifications/elicitation/complete"),params:dE}),yn=ke.extend({action:Oe(["accept","decline","cancel"]),content:Ga(t=>t===null?void 0:t,ae(v(),de([v(),oe(),$e(),Y(v())])).optional())}),fE=P({type:j("ref/resource"),uri:v()});var mE=P({type:j("ref/prompt"),name:v()}),hE=rt.extend({ref:de([mE,fE]),argument:P({name:v(),value:v()}),context:P({arguments:ae(v(),v()).optional()}).optional()}),gE=Se.extend({method:j("completion/complete"),params:hE});var vE=ke.extend({completion:Te({values:Y(v()).max(100),total:me(oe().int()),hasMore:me($e())})}),_E=P({uri:v().startsWith("file://"),name:v().optional(),_meta:ae(v(),le()).optional()}),yE=Se.extend({method:j("roots/list"),params:rt.optional()}),Xd=ke.extend({roots:Y(_E)}),$E=st.extend({method:j("notifications/roots/list_changed"),params:at.optional()}),oC=de([es,Ld,gE,Yd,Ew,Sw,sw,uw,pw,gw,_w,Qo,Kd,rs,os,is,ss]),iC=de([Qa,ts,Fd,$E,Bo]),aC=de([Xa,ti,Bd,yn,Xd,ns,as,vn]),sC=de([es,Gw,lE,yE,rs,os,is,ss]),cC=de([Qa,ts,Zw,$w,mw,Aw,jw,Bo,pE]),uC=de([Xa,ew,vE,Ow,kw,cw,lw,fw,cs,Mw,ns,as,vn]),W=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===Q.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Md(o.elicitations,r)}return new t(e,r,n)}},Md=class extends W{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(Q.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function fr(t){return t==="completed"||t==="failed"||t==="cancelled"}var qC=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Qd(t){let r=ja(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Sg(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function ep(t,e){let r=dr(t,e);if(!r.success)throw r.error;return r.data}var EE=6e4,us=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Qa,r=>{this._oncancel(r)}),this.setNotificationHandler(ts,r=>{this._onprogress(r)}),this.setRequestHandler(es,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(rs,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new W(Q.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(os,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,p=new W(d.error.code,d.error.message,d.error.data);l(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new W(Q.InvalidParams,`Task not found: ${i}`);if(!fr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(fr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[pr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(is,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new W(Q.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(ss,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new W(Q.InvalidParams,`Task not found: ${r.params.taskId}`);if(fr(o.status))throw new W(Q.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new W(Q.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof W?o:new W(Q.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),W.fromError(Q.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),Jo(i)||Ov(i)?this._onresponse(i):Cd(i)?this._onrequest(i,a):Tv(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=W.fromError(Q.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,i=e.params?._meta?.[pr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:Q.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let s=Iv(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:e.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new W(Q.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};i&&!f.relatedTask&&(f.relatedTask={taskId:i});let h=f.relatedTask?.taskId??i;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:Q.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Jo(e))n(e);else{let a=new W(e.error.code,e.error.message,e.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(Jo(e)&&e.result&&typeof e.result=="object"){let a=e.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),Jo(e))o(e);else{let a=W.fromError(e.error.code,e.error.message,e.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(e,r,n)}}catch(a){yield{type:"error",error:a instanceof W?a:new W(Q.InternalError,String(a))}}return}let i;try{let a=await this.request(e,vn,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new W(Q.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},fr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new W(Q.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new W(Q.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof W?a:new W(Q.InternalError,String(a))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=S=>{l(S)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(S){d(S);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[pr]:c}});let h=S=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(S)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(N=>this._onerror(new Error(`Failed to send cancellation: ${N}`)));let x=S instanceof W?S:new W(Q.RequestTimeout,String(S));l(x)};this._responseHandlers.set(p,S=>{if(!n?.signal?.aborted){if(S instanceof Error)return l(S);try{let x=dr(r,S.result);x.success?u(x.data):l(x.error)}catch(x){l(x)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let g=n?.timeout??EE,$=()=>h(W.fromError(Q.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,n?.maxTotalTimeout,$,n?.resetTimeoutOnProgress??!1);let k=c?.taskId;if(k){let S=x=>{let N=this._responseHandlers.get(p);N?N(x):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,S),this._enqueueTaskMessage(k,{type:"request",message:f,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(p),l(x)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(S=>{this._cleanupTimeout(p),l(S)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},ns,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},as,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Nv,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[pr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[pr]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[pr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(e,r){let n=Qd(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=ep(e,o);return Promise.resolve(r(a,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=Qd(e);this._notificationHandlers.set(n,o=>{let i=ep(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,o)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&Cd(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new W(Q.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new W(Q.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new W(Q.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new W(Q.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=Bo.parse({method:"notifications/tasks/status",params:s});await this.notification(c),fr(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new W(Q.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(fr(s.status))throw new W(Q.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=Bo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),fr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Zv(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Lv(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let a=r[o];Zv(a)&&Zv(i)?r[o]={...a,...i}:r[o]=i}return r}var I$=wt(Zf(),1),z$=wt(E$(),1);function vO(){let t=new I$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,z$.default)(t),t}var Ws=class{constructor(e){this._ajv=e??vO()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Js=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}createMessageStream(e,r){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],i=Array.isArray(o.content)?o.content:[o.content],a=i.some(l=>l.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=s?Array.isArray(s.content)?s.content:[s.content]:[],u=c.some(l=>l.type==="tool_use");if(a){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(i.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},ti,r)}elicitInputStream(e,r){let n=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let i=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:i},yn,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function P$(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function T$(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Hs=class extends us{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(ei.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Ws,this.setRequestHandler(Ld,n=>this._oninitialize(n)),this.setNotificationHandler(Fd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Yd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=ei.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Js(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Lv(this._capabilities,e)}setRequestHandler(e,r){let o=ja(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(mn(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=dr(Qo,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new W(Q.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=dr(vn,p);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new W(Q.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let f=dr(cs,p);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new W(Q.InvalidParams,`Invalid tools/call result: ${h}`)}return f.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){T$(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&P$(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:kv.includes(r)?r:Rd,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Xa)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Bd,r):this.request({method:"sampling/createMessage",params:e},ti,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},yn,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},i=await this.request({method:"elicitation/create",params:o},yn,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new W(Q.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof W?a:new W(Q.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Xd,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Gf=wt(require("node:process"),1);var Gs=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
56
|
+
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),_O(r)}clear(){this._buffer=void 0}};function _O(t){return jv.parse(JSON.parse(t))}function O$(t){return JSON.stringify(t)+`
|
|
57
|
+
`}var Ks=class{constructor(e=Gf.default.stdin,r=Gf.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Gs,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=O$(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Xf=wt(require("path"),1);var pt={DEFAULT:3e5,HEALTH_CHECK:3e3,POST_SPAWN_WAIT:15e3,READINESS_WAIT:3e4,PORT_IN_USE_WAIT:3e3,WORKER_STARTUP_WAIT:1e3,PRE_RESTART_SETTLE_DELAY:2e3,POWERSHELL_COMMAND:1e4,WINDOWS_MULTIPLIER:1.5};function j$(t){return process.platform==="win32"?Math.round(t*pt.WINDOWS_MULTIPLIER):t}var Mt=require("fs"),ji=require("path"),Kf=require("os"),Xt=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-6",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:String(37700+(process.getuid?.()??77)%100),CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_CLAUDE_AUTH_METHOD:"cli",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED:"true",CLAUDE_MEM_GEMINI_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_GEMINI_MAX_TOKENS:"100000",CLAUDE_MEM_OPENROUTER_API_KEY:"",CLAUDE_MEM_OPENROUTER_MODEL:"xiaomi/mimo-v2-flash:free",CLAUDE_MEM_OPENROUTER_SITE_URL:"",CLAUDE_MEM_OPENROUTER_APP_NAME:"claude-mem",CLAUDE_MEM_OPENROUTER_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_OPENROUTER_MAX_TOKENS:"100000",CLAUDE_MEM_DATA_DIR:(0,ji.join)((0,Kf.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_FULL_COUNT:"0",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false",CLAUDE_MEM_CONTEXT_SHOW_TERMINAL_OUTPUT:"true",CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED:"false",CLAUDE_MEM_FOLDER_USE_LOCAL_MD:"false",CLAUDE_MEM_TRANSCRIPTS_ENABLED:"true",CLAUDE_MEM_TRANSCRIPTS_CONFIG_PATH:(0,ji.join)((0,Kf.homedir)(),".claude-mem","transcript-watch.json"),CLAUDE_MEM_MAX_CONCURRENT_AGENTS:"2",CLAUDE_MEM_EXCLUDED_PROJECTS:"",CLAUDE_MEM_FOLDER_MD_EXCLUDE:"[]",CLAUDE_MEM_SEMANTIC_INJECT:"false",CLAUDE_MEM_SEMANTIC_INJECT_LIMIT:"5",CLAUDE_MEM_TIER_ROUTING_ENABLED:"true",CLAUDE_MEM_TIER_SIMPLE_MODEL:"haiku",CLAUDE_MEM_TIER_SUMMARY_MODEL:"",CLAUDE_MEM_CHROMA_ENABLED:"true",CLAUDE_MEM_CHROMA_MODE:"local",CLAUDE_MEM_CHROMA_HOST:"127.0.0.1",CLAUDE_MEM_CHROMA_PORT:"8000",CLAUDE_MEM_CHROMA_SSL:"false",CLAUDE_MEM_CHROMA_API_KEY:"",CLAUDE_MEM_CHROMA_TENANT:"default_tenant",CLAUDE_MEM_CHROMA_DATABASE:"default_database"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return process.env[e]??this.DEFAULTS[e]}static getInt(e){let r=this.get(e);return parseInt(r,10)}static getBool(e){let r=this.get(e);return r==="true"||r===!0}static applyEnvOverrides(e){let r={...e};for(let n of Object.keys(this.DEFAULTS))process.env[n]!==void 0&&(r[n]=process.env[n]);return r}static loadFromFile(e){try{if(!(0,Mt.existsSync)(e)){let a=this.getAllDefaults();try{let s=(0,ji.dirname)(e);(0,Mt.existsSync)(s)||(0,Mt.mkdirSync)(s,{recursive:!0}),(0,Mt.writeFileSync)(e,JSON.stringify(a,null,2),"utf-8"),console.log("[SETTINGS] Created settings file with defaults:",e)}catch(s){console.warn("[SETTINGS] Failed to create settings file, using in-memory defaults:",e,s instanceof Error?s.message:String(s))}return this.applyEnvOverrides(a)}let r=(0,Mt.readFileSync)(e,"utf-8"),n=JSON.parse(r),o=n;if(n.env&&typeof n.env=="object"){o=n.env;try{(0,Mt.writeFileSync)(e,JSON.stringify(o,null,2),"utf-8"),console.log("[SETTINGS] Migrated settings file from nested to flat schema:",e)}catch(a){console.warn("[SETTINGS] Failed to auto-migrate settings file:",e,a instanceof Error?a.message:String(a))}}let i={...this.DEFAULTS};for(let a of Object.keys(this.DEFAULTS))o[a]!==void 0&&(i[a]=o[a]);return this.applyEnvOverrides(i)}catch(r){return console.warn("[SETTINGS] Failed to load settings, using defaults:",e,r instanceof Error?r.message:String(r)),this.applyEnvOverrides(this.getAllDefaults())}}};var _e=require("path"),Yf=require("os"),Bf=require("fs");var D$=require("url");var xO={};function yO(){return typeof __dirname<"u"?__dirname:(0,_e.dirname)((0,D$.fileURLToPath)(xO.url))}var kL=yO();function $O(){if(process.env.CLAUDE_MEM_DATA_DIR)return process.env.CLAUDE_MEM_DATA_DIR;let t=(0,_e.join)((0,Yf.homedir)(),".claude-mem"),e=(0,_e.join)(t,"settings.json");try{if((0,Bf.existsSync)(e)){let{readFileSync:r}=require("fs"),n=JSON.parse(r(e,"utf-8")),o=n.env??n;if(o.CLAUDE_MEM_DATA_DIR)return o.CLAUDE_MEM_DATA_DIR}}catch{}return t}var ft=$O(),Ys=process.env.CLAUDE_CONFIG_DIR||(0,_e.join)((0,Yf.homedir)(),".claude"),N$=(0,_e.join)(Ys,"plugins","marketplaces","thedotmack"),wL=(0,_e.join)(ft,"archives"),EL=(0,_e.join)(ft,"logs"),IL=(0,_e.join)(ft,"trash"),zL=(0,_e.join)(ft,"backups"),PL=(0,_e.join)(ft,"modes"),TL=(0,_e.join)(ft,"settings.json"),OL=(0,_e.join)(ft,"claude-mem.db"),jL=(0,_e.join)(ft,"vector-db"),bO=(0,_e.join)(ft,"observer-sessions"),DL=(0,_e.basename)(bO),NL=(0,_e.join)(Ys,"settings.json"),ML=(0,_e.join)(Ys,"commands"),RL=(0,_e.join)(Ys,"CLAUDE.md");var M$=require("crypto"),xr=require("fs"),R$=require("path");var SO="worker-auth-token",Bs=null;function A$(){if(Bs)return Bs;let t=(0,R$.join)(ft,SO);if((0,xr.existsSync)(t)){let r=(0,xr.readFileSync)(t,"utf-8").trim();if(r.length>=32)return Bs=r,r}let e=(0,M$.randomBytes)(32).toString("hex");return(0,xr.mkdirSync)(ft,{recursive:!0}),(0,xr.writeFileSync)(t,e,{mode:384}),Bs=e,e}var kO=(()=>{let t=process.env.CLAUDE_MEM_HEALTH_TIMEOUT_MS;if(t){let e=parseInt(t,10);if(Number.isFinite(e)&&e>=500&&e<=3e5)return e;_.warn("SYSTEM","Invalid CLAUDE_MEM_HEALTH_TIMEOUT_MS, using default",{value:t,min:500,max:3e5})}return j$(pt.HEALTH_CHECK)})();function wO(t,e={},r){return new Promise((n,o)=>{let i=setTimeout(()=>o(new Error(`Request timed out after ${r}ms`)),r);fetch(t,e).then(a=>{clearTimeout(i),n(a)},a=>{clearTimeout(i),o(a)})})}var Xs=null,Qs=null;function Qf(){if(Xs!==null)return Xs;let t=Xf.default.join(Xt.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=Xt.loadFromFile(t);return Xs=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),Xs}function EO(){if(Qs!==null)return Qs;let t=Xf.default.join(Xt.get("CLAUDE_MEM_DATA_DIR"),"settings.json");return Qs=Xt.loadFromFile(t).CLAUDE_MEM_WORKER_HOST,Qs}function IO(t){return`http://${EO()}:${Qf()}${t}`}function ec(t,e={}){let r=e.method??"GET",n=e.timeoutMs??kO,o=IO(t),i={method:r},a={...e.headers,Authorization:`Bearer ${A$()}`};return i.headers=a,e.body&&(i.body=e.body),n>0?wO(o,i,n):fetch(o,i)}var um=wt(require("path"),1),mt=require("fs");var er=wt(require("path"),1),sm=require("os"),qe=require("fs"),tr=require("child_process"),Q$=require("util");var zO=["CLAUDECODE_","CLAUDE_CODE_"],PO=new Set(["CLAUDECODE","CLAUDE_CODE_SESSION","CLAUDE_CODE_ENTRYPOINT","MCP_SESSION_ID"]),TO=new Set(["CLAUDE_CODE_OAUTH_TOKEN","CLAUDE_CODE_GIT_BASH_PATH"]);function C$(t=process.env){let e={};for(let[r,n]of Object.entries(t))if(n!==void 0){if(TO.has(r)){e[r]=n;continue}PO.has(r)||zO.some(o=>r.startsWith(o))||(e[r]=n)}return e}var Fr=require("fs"),Y$=require("os"),om=wt(require("path"),1);var Qt=require("fs"),U$=require("os"),Di=wt(require("path"),1);var OO=5e3,jO=1e3,DO=Di.default.join((0,U$.homedir)(),".claude-mem"),NO=Di.default.join(DO,"supervisor.json");function kt(t){if(!Number.isInteger(t)||t<0||t===0)return!1;try{return process.kill(t,0),!0}catch(e){if(e instanceof Error){let r=e.code;return r==="EPERM"?!0:(_.debug("SYSTEM","PID check failed",{pid:t,code:r}),!1)}return _.warn("SYSTEM","PID check threw non-Error",{pid:t,error:String(e)}),!1}}var tm=class{registryPath;entries=new Map;runtimeProcesses=new Map;initialized=!1;constructor(e=NO){this.registryPath=e}initialize(){if(this.initialized)return;if(this.initialized=!0,(0,Qt.mkdirSync)(Di.default.dirname(this.registryPath),{recursive:!0}),!(0,Qt.existsSync)(this.registryPath)){this.persist();return}try{let n=JSON.parse((0,Qt.readFileSync)(this.registryPath,"utf-8")).processes??{};for(let[o,i]of Object.entries(n))this.entries.set(o,i)}catch(r){r instanceof Error?_.warn("SYSTEM","Failed to parse supervisor registry, rebuilding",{path:this.registryPath},r):_.warn("SYSTEM","Failed to parse supervisor registry, rebuilding",{path:this.registryPath,error:String(r)}),this.entries.clear()}let e=this.pruneDeadEntries();e>0&&_.info("SYSTEM","Removed dead processes from supervisor registry",{removed:e}),this.persist()}register(e,r,n){this.initialize(),this.entries.set(e,r),n&&this.runtimeProcesses.set(e,n),this.persist()}unregister(e){this.initialize(),this.entries.delete(e),this.runtimeProcesses.delete(e),this.persist()}clear(){this.entries.clear(),this.runtimeProcesses.clear(),this.persist()}getAll(){return this.initialize(),Array.from(this.entries.entries()).map(([e,r])=>({id:e,...r})).sort((e,r)=>{let n=Date.parse(e.startedAt),o=Date.parse(r.startedAt);return(Number.isNaN(n)?0:n)-(Number.isNaN(o)?0:o)})}getBySession(e){let r=String(e);return this.getAll().filter(n=>n.sessionId!==void 0&&String(n.sessionId)===r)}getRuntimeProcess(e){return this.runtimeProcesses.get(e)}getByPid(e){return this.getAll().filter(r=>r.pid===e)}pruneDeadEntries(){this.initialize();let e=0;for(let[r,n]of this.entries)kt(n.pid)||(this.entries.delete(r),this.runtimeProcesses.delete(r),e+=1);return e>0&&this.persist(),e}async reapSession(e){this.initialize();let r=this.getBySession(e);if(r.length===0)return 0;let n=typeof e=="number"?e:Number(e)||void 0;_.info("SYSTEM",`Reaping ${r.length} process(es) for session ${e}`,{sessionId:n,pids:r.map(s=>s.pid)});let o=r.filter(s=>kt(s.pid));for(let s of o)try{process.kill(s.pid,"SIGTERM")}catch(c){c instanceof Error?c.code!=="ESRCH"&&_.debug("SYSTEM",`Failed to SIGTERM session process PID ${s.pid}`,{pid:s.pid},c):_.warn("SYSTEM",`Failed to SIGTERM session process PID ${s.pid} (non-Error)`,{pid:s.pid,error:String(c)})}let i=Date.now()+OO;for(;Date.now()<i&&o.filter(c=>kt(c.pid)).length!==0;)await new Promise(c=>setTimeout(c,100));let a=o.filter(s=>kt(s.pid));for(let s of a){_.warn("SYSTEM",`Session process PID ${s.pid} did not exit after SIGTERM, sending SIGKILL`,{pid:s.pid,sessionId:n});try{process.kill(s.pid,"SIGKILL")}catch(c){c instanceof Error?c.code!=="ESRCH"&&_.debug("SYSTEM",`Failed to SIGKILL session process PID ${s.pid}`,{pid:s.pid},c):_.warn("SYSTEM",`Failed to SIGKILL session process PID ${s.pid} (non-Error)`,{pid:s.pid,error:String(c)})}}if(a.length>0){let s=Date.now()+jO;for(;Date.now()<s&&a.filter(u=>kt(u.pid)).length!==0;)await new Promise(u=>setTimeout(u,100))}for(let s of r)this.entries.delete(s.id),this.runtimeProcesses.delete(s.id);return this.persist(),_.info("SYSTEM",`Reaped ${r.length} process(es) for session ${e}`,{sessionId:n,reaped:r.length}),r.length}persist(){let e={processes:Object.fromEntries(this.entries.entries())};(0,Qt.mkdirSync)(Di.default.dirname(this.registryPath),{recursive:!0}),(0,Qt.writeFileSync)(this.registryPath,JSON.stringify(e,null,2))}},em=null;function tc(){return em||(em=new tm),em}var F$=require("child_process"),q$=require("fs"),V$=require("os"),rm=wt(require("path"),1),W$=require("util");var MO=(0,W$.promisify)(F$.execFile),RO=rm.default.join((0,V$.homedir)(),".claude-mem"),AO=rm.default.join(RO,"worker.pid");async function J$(t){let e=t.currentPid??process.pid,r=t.pidFilePath??AO,n=t.registry.getAll(),o=[...n].filter(a=>a.pid!==e).sort((a,s)=>Date.parse(s.startedAt)-Date.parse(a.startedAt));for(let a of o){if(!kt(a.pid)){t.registry.unregister(a.id);continue}try{await L$(a.pid,"SIGTERM")}catch(s){s instanceof Error?_.debug("SYSTEM","Failed to send SIGTERM to child process",{pid:a.pid,type:a.type},s):_.warn("SYSTEM","Failed to send SIGTERM to child process (non-Error)",{pid:a.pid,type:a.type,error:String(s)})}}await Z$(o,5e3);let i=o.filter(a=>kt(a.pid));for(let a of i)try{await L$(a.pid,"SIGKILL")}catch(s){s instanceof Error?_.debug("SYSTEM","Failed to force kill child process",{pid:a.pid,type:a.type},s):_.warn("SYSTEM","Failed to force kill child process (non-Error)",{pid:a.pid,type:a.type,error:String(s)})}await Z$(i,1e3);for(let a of o)t.registry.unregister(a.id);for(let a of n.filter(s=>s.pid===e))t.registry.unregister(a.id);try{(0,q$.rmSync)(r,{force:!0})}catch(a){a instanceof Error?_.debug("SYSTEM","Failed to remove PID file during shutdown",{pidFilePath:r},a):_.warn("SYSTEM","Failed to remove PID file during shutdown (non-Error)",{pidFilePath:r,error:String(a)})}t.registry.pruneDeadEntries()}async function Z$(t,e){let r=Date.now()+e;for(;Date.now()<r;){if(t.filter(o=>kt(o.pid)).length===0)return;await new Promise(o=>setTimeout(o,100))}}async function L$(t,e){if(e==="SIGTERM"){try{process.kill(t,e)}catch(r){if(r instanceof Error&&r.code==="ESRCH")return;throw r}return}if(process.platform==="win32"){let r=await CO();if(r){await new Promise((o,i)=>{r(t,e,a=>{if(!a){o();return}if(a.code==="ESRCH"){o();return}i(a)})});return}let n=["/PID",String(t),"/T"];e==="SIGKILL"&&n.push("/F"),await MO("taskkill",n,{timeout:pt.POWERSHELL_COMMAND,windowsHide:!0});return}try{process.kill(t,e)}catch(r){if(r instanceof Error&&r.code==="ESRCH")return;throw r}}async function CO(){let t="tree-kill";try{let e=await import(t);return e.default??e}catch(e){return _.debug("SYSTEM","tree-kill module not available, using fallback",{},e instanceof Error?e:void 0),null}}var H$=3e4,An=null;function UO(){let e=tc().pruneDeadEntries();e>0&&_.info("SYSTEM",`Health check: pruned ${e} dead process(es) from registry`)}function G$(){An===null&&(An=setInterval(UO,H$),An.unref(),_.debug("SYSTEM","Health checker started",{intervalMs:H$}))}function K$(){An!==null&&(clearInterval(An),An=null,_.debug("SYSTEM","Health checker stopped"))}var ZO=om.default.join((0,Y$.homedir)(),".claude-mem"),LO=om.default.join(ZO,"worker.pid"),nm=class{registry;started=!1;stopPromise=null;signalHandlersRegistered=!1;shutdownInitiated=!1;shutdownHandler=null;constructor(e){this.registry=e}async start(){if(this.started)return;if(this.registry.initialize(),im({logAlive:!1})==="alive")throw new Error("Worker already running");this.started=!0,G$()}configureSignalHandlers(e){if(this.shutdownHandler=e,this.signalHandlersRegistered)return;this.signalHandlersRegistered=!0;let r=async n=>{if(this.shutdownInitiated){_.warn("SYSTEM",`Received ${n} but shutdown already in progress`);return}this.shutdownInitiated=!0,_.info("SYSTEM",`Received ${n}, shutting down...`);try{this.shutdownHandler?await this.shutdownHandler():await this.stop()}catch(o){o instanceof Error?_.error("SYSTEM","Error during shutdown",{},o):_.error("SYSTEM","Error during shutdown (non-Error)",{error:String(o)});try{await this.stop()}catch(i){i instanceof Error?_.debug("SYSTEM","Supervisor shutdown fallback failed",{},i):_.debug("SYSTEM","Supervisor shutdown fallback failed",{error:String(i)})}}process.exit(0)};process.on("SIGTERM",()=>{r("SIGTERM")}),process.on("SIGINT",()=>{r("SIGINT")}),process.platform!=="win32"&&(process.argv.includes("--daemon")?process.on("SIGHUP",()=>{_.debug("SYSTEM","Ignoring SIGHUP in daemon mode")}):process.on("SIGHUP",()=>{r("SIGHUP")}))}async stop(){if(this.stopPromise){await this.stopPromise;return}K$(),this.stopPromise=J$({registry:this.registry,currentPid:process.pid}).finally(()=>{this.started=!1,this.stopPromise=null}),await this.stopPromise}assertCanSpawn(e){if(this.stopPromise!==null)throw new Error(`Supervisor is shutting down, refusing to spawn ${e}`)}registerProcess(e,r,n){this.registry.register(e,r,n)}unregisterProcess(e){this.registry.unregister(e)}getRegistry(){return this.registry}},FO=new nm(tc());function B$(){return FO}function im(t={}){let e=t.pidFilePath??LO;if(!(0,Fr.existsSync)(e))return"missing";let r=null;try{r=JSON.parse((0,Fr.readFileSync)(e,"utf-8"))}catch(n){return n instanceof Error?_.warn("SYSTEM","Failed to parse worker PID file, removing it",{path:e},n):_.warn("SYSTEM","Failed to parse worker PID file, removing it",{path:e,error:String(n)}),(0,Fr.rmSync)(e,{force:!0}),"invalid"}return kt(r.pid)?((t.logAlive??!0)&&_.info("SYSTEM","Worker already running (PID alive)",{existingPid:r.pid,existingPort:r.port,startedAt:r.startedAt}),"alive"):(_.info("SYSTEM","Removing stale PID file (worker process is dead)",{pid:r.pid,port:r.port,startedAt:r.startedAt}),(0,Fr.rmSync)(e,{force:!0}),"stale")}var d6=(0,Q$.promisify)(tr.exec),qO=er.default.join((0,sm.homedir)(),".claude-mem"),Cn=er.default.join(qO,"worker.pid");function X$(t){return t?/(^|[\\/])bun(\.exe)?$/i.test(t.trim()):!1}function VO(t,e){let r=e==="win32"?`where ${t}`:`which ${t}`,n;try{n=(0,tr.execSync)(r,{stdio:["ignore","pipe","ignore"],encoding:"utf-8",windowsHide:!0})}catch(i){return i instanceof Error?_.debug("SYSTEM",`Binary lookup failed for ${t}`,{command:r},i):_.debug("SYSTEM",`Binary lookup failed for ${t}`,{command:r},new Error(String(i))),null}return n.split(/\r?\n/).map(i=>i.trim()).find(i=>i.length>0)||null}var am;function WO(t={}){let e=Object.keys(t).length===0;if(e&&am!==void 0)return am;let r=JO(t);return e&&r!==null&&(am=r),r}function JO(t){let e=t.platform??process.platform,r=t.execPath??process.execPath;if(X$(r))return r;let n=t.env??process.env,o=t.homeDirectory??(0,sm.homedir)(),i=t.pathExists??qe.existsSync,a=t.lookupInPath??VO,s=e==="win32"?[n.BUN,n.BUN_PATH,er.default.join(o,".bun","bin","bun.exe"),er.default.join(o,".bun","bin","bun"),n.USERPROFILE?er.default.join(n.USERPROFILE,".bun","bin","bun.exe"):void 0,n.LOCALAPPDATA?er.default.join(n.LOCALAPPDATA,"bun","bun.exe"):void 0,n.LOCALAPPDATA?er.default.join(n.LOCALAPPDATA,"bun","bin","bun.exe"):void 0]:[n.BUN,n.BUN_PATH,er.default.join(o,".bun","bin","bun"),"/usr/local/bin/bun","/opt/homebrew/bin/bun","/home/linuxbrew/.linuxbrew/bin/bun","/usr/bin/bun","/snap/bin/bun"];for(let c of s){let u=c?.trim();if(u&&(X$(u)&&i(u)||u.toLowerCase()==="bun"))return u}return a("bun",e)}function eb(){if((0,qe.existsSync)(Cn))try{(0,qe.unlinkSync)(Cn)}catch(t){t instanceof Error?_.warn("SYSTEM","Failed to remove PID file",{path:Cn},t):_.warn("SYSTEM","Failed to remove PID file",{path:Cn},new Error(String(t)))}}function Un(t){return process.platform==="win32"?Math.round(t*2):t}function tb(t,e,r={}){let n=process.platform==="win32";B$().assertCanSpawn("worker daemon");let o=C$({...process.env,CLAUDE_MEM_WORKER_PORT:String(e),...r}),i=WO();if(!i){_.error("SYSTEM","Bun runtime not found \u2014 install from https://bun.sh and ensure it is on PATH or set BUN env var. The worker daemon requires Bun because it uses bun:sqlite.");return}if(n){let c=`Start-Process -FilePath '${i.replace(/'/g,"''")}' -ArgumentList @('${t.replace(/'/g,"''")}','--daemon') -WindowStyle Hidden`,u=Buffer.from(c,"utf16le").toString("base64");try{return(0,tr.execSync)(`powershell -NoProfile -EncodedCommand ${u}`,{stdio:"ignore",windowsHide:!0,env:o}),0}catch(l){l instanceof Error?_.error("SYSTEM","Failed to spawn worker daemon on Windows",{runtimePath:i},l):_.error("SYSTEM","Failed to spawn worker daemon on Windows",{runtimePath:i},new Error(String(l)));return}}let a="/usr/bin/setsid";if((0,qe.existsSync)(a)){let c=(0,tr.spawn)(a,[i,t,"--daemon"],{detached:!0,stdio:"ignore",env:o});return c.pid===void 0?void 0:(c.unref(),c.pid)}let s=(0,tr.spawn)(i,[t,"--daemon"],{detached:!0,stdio:"ignore",env:o});if(s.pid!==void 0)return s.unref(),s.pid}function rb(){try{if(!(0,qe.existsSync)(Cn))return;let t=new Date;(0,qe.utimesSync)(Cn,t,t)}catch{}}function nb(){return im({logAlive:!1})}var ob=wt(require("net"),1);async function HO(t,e,r="GET"){let n=await fetch(`http://127.0.0.1:${t}${e}`,{method:r}),o="";try{o=await n.text()}catch{}return{ok:n.ok,statusCode:n.status,body:o}}async function ib(t){if(process.platform==="win32")try{return(await fetch(`http://127.0.0.1:${t}/api/health`)).ok}catch(e){return e instanceof Error?_.debug("SYSTEM","Windows health check failed (port not in use)",{},e):_.debug("SYSTEM","Windows health check failed (port not in use)",{error:String(e)}),!1}return new Promise(e=>{let r=ob.default.createServer();r.once("error",n=>{n.code==="EADDRINUSE"?e(!0):e(!1)}),r.once("listening",()=>{r.close(()=>e(!1))}),r.listen(t,"127.0.0.1")})}async function ab(t,e,r,n){let o=Date.now();for(;Date.now()-o<r;){try{if((await HO(t,e)).ok)return!0}catch(i){i instanceof Error?_.debug("SYSTEM",n,{},i):_.debug("SYSTEM",n,{error:String(i)})}await new Promise(i=>setTimeout(i,500))}return!1}function Ni(t,e=3e4){return ab(t,"/api/health",e,"Service not ready yet, will retry")}function cm(t,e=3e4){return ab(t,"/api/readiness",e,"Worker not ready yet, will retry")}var GO=120*1e3;function lm(){return um.default.join(Xt.get("CLAUDE_MEM_DATA_DIR"),".worker-start-attempted")}function KO(){if(process.platform!=="win32")return!1;let t=lm();if(!(0,mt.existsSync)(t))return!1;try{let e=(0,mt.statSync)(t).mtimeMs;return Date.now()-e<GO}catch(e){return e instanceof Error?_.debug("SYSTEM","Could not stat worker spawn lock file",{},e):_.debug("SYSTEM","Could not stat worker spawn lock file",{error:String(e)}),!1}}function YO(){if(process.platform==="win32")try{let t=lm();(0,mt.mkdirSync)(um.default.dirname(t),{recursive:!0}),(0,mt.writeFileSync)(t,"","utf-8")}catch{}}function rc(){if(process.platform==="win32")try{let t=lm();(0,mt.existsSync)(t)&&(0,mt.unlinkSync)(t)}catch{}}async function sb(t,e){return e?(0,mt.existsSync)(e)?nb()==="alive"?(_.info("SYSTEM","Worker PID file points to a live process, skipping duplicate spawn"),await Ni(t,Un(pt.PORT_IN_USE_WAIT))?(rc(),_.info("SYSTEM","Worker became healthy while waiting on live PID"),!0):(_.warn("SYSTEM","Live PID detected but worker did not become healthy before timeout"),!1)):await Ni(t,1e3)?(rc(),await cm(t,Un(pt.READINESS_WAIT))||_.warn("SYSTEM","Worker is alive but readiness timed out \u2014 proceeding anyway"),_.info("SYSTEM","Worker already running and healthy"),!0):await ib(t)?(_.info("SYSTEM","Port in use, waiting for worker to become healthy"),await Ni(t,Un(pt.PORT_IN_USE_WAIT))?(rc(),_.info("SYSTEM","Worker is now healthy"),!0):(_.error("SYSTEM","Port in use but worker not responding to health checks"),!1)):KO()?(_.warn("SYSTEM","Worker unavailable on Windows \u2014 skipping spawn (recent attempt failed within cooldown)"),!1):(_.info("SYSTEM","Starting worker daemon",{workerScriptPath:e}),YO(),tb(e,t)===void 0?(_.error("SYSTEM","Failed to spawn worker daemon"),!1):await Ni(t,Un(pt.POST_SPAWN_WAIT))?(await cm(t,Un(pt.READINESS_WAIT))||_.warn("SYSTEM","Worker is alive but readiness timed out \u2014 proceeding anyway"),rc(),rb(),_.info("SYSTEM","Worker started successfully"),!0):(eb(),_.error("SYSTEM","Worker failed to start (health check timeout)"),!1)):(_.error("SYSTEM","ensureWorkerStarted: worker script not found at expected path \u2014 likely a partial install or build artifact missing",{workerScriptPath:e}),!1):(_.error("SYSTEM","ensureWorkerStarted called with empty workerScriptPath \u2014 caller bug"),!1)}var Fn=require("node:fs/promises"),Ci=require("node:path");var lb=require("node:child_process"),Me=require("node:fs"),ze=require("node:path"),gm=require("node:os"),fm=require("node:module");var lj={},mm=typeof __filename<"u"?(0,fm.createRequire)(__filename):(0,fm.createRequire)(lj.url),hm={".js":"javascript",".mjs":"javascript",".cjs":"javascript",".jsx":"tsx",".ts":"typescript",".tsx":"tsx",".py":"python",".pyw":"python",".go":"go",".rs":"rust",".rb":"ruby",".java":"java",".c":"c",".h":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".kt":"kotlin",".kts":"kotlin",".swift":"swift",".php":"php",".ex":"elixir",".exs":"elixir",".lua":"lua",".scala":"scala",".sc":"scala",".sh":"bash",".bash":"bash",".zsh":"bash",".hs":"haskell",".zig":"zig",".css":"css",".scss":"scss",".toml":"toml",".yml":"yaml",".yaml":"yaml",".sql":"sql",".md":"markdown",".mdx":"markdown"};function db(t,e){let r=t.slice(t.lastIndexOf("."));return hm[r]?hm[r]:e.extensionToLanguage[r]?e.extensionToLanguage[r]:"unknown"}function pb(t,e){return e.languageToQueryKey[t]?e.languageToQueryKey[t]:QO(t)}var Mi=new Map,Zn={grammars:{},extensionToLanguage:{},languageToQueryKey:{}};function Ai(t){if(Mi.has(t))return Mi.get(t);let e=(0,ze.join)(t,".claude-mem.json"),r;try{let i=(0,Me.readFileSync)(e,"utf-8");r=JSON.parse(i)}catch{return Mi.set(t,Zn),Zn}let n=r.grammars;if(!n||typeof n!="object"||Array.isArray(n))return Mi.set(t,Zn),Zn;let o={grammars:{},extensionToLanguage:{},languageToQueryKey:{}};for(let[i,a]of Object.entries(n)){if(fb[i]||!a||typeof a!="object"||Array.isArray(a))continue;let s=a,c=s.package,u=s.extensions,l=s.query;if(!(typeof c!="string"||!Array.isArray(u))&&u.every(d=>typeof d=="string")){o.grammars[i]={package:c,extensions:u,query:typeof l=="string"?l:void 0};for(let d of u)hm[d]||(o.extensionToLanguage[d]=i);if(typeof l=="string"){let d=(0,ze.join)(t,l);try{let p=(0,Me.readFileSync)(d,"utf-8"),f=`user_${i}`;hb[f]=p,o.languageToQueryKey[i]=f}catch{console.error(`[smart-file-read] Custom query file not found: ${d}, falling back to generic`),o.languageToQueryKey[i]="generic"}}else o.languageToQueryKey[i]="generic"}}return Mi.set(t,o),o}var fb={javascript:"tree-sitter-javascript",typescript:"tree-sitter-typescript/typescript",tsx:"tree-sitter-typescript/tsx",python:"tree-sitter-python",go:"tree-sitter-go",rust:"tree-sitter-rust",ruby:"tree-sitter-ruby",java:"tree-sitter-java",c:"tree-sitter-c",cpp:"tree-sitter-cpp",kotlin:"tree-sitter-kotlin",swift:"tree-sitter-swift",php:"tree-sitter-php/php",elixir:"tree-sitter-elixir",lua:"@tree-sitter-grammars/tree-sitter-lua",scala:"tree-sitter-scala",bash:"tree-sitter-bash",haskell:"tree-sitter-haskell",zig:"@tree-sitter-grammars/tree-sitter-zig",css:"tree-sitter-css",scss:"tree-sitter-scss",toml:"@tree-sitter-grammars/tree-sitter-toml",yaml:"@tree-sitter-grammars/tree-sitter-yaml",sql:"@derekstride/tree-sitter-sql",markdown:"@tree-sitter-grammars/tree-sitter-markdown"},BO={markdown:"tree-sitter-markdown"};function XO(t){let e=fb[t];if(!e)return null;let r=BO[t];if(r){try{let n=mm.resolve(e+"/package.json"),o=(0,ze.join)((0,ze.dirname)(n),r);if((0,Me.existsSync)((0,ze.join)(o,"src")))return o}catch{}return null}try{let n=mm.resolve(e+"/package.json");return(0,ze.dirname)(n)}catch{return null}}function mb(t,e){let r=XO(t);if(r)return r;if(!e)return null;let o=Ai(e).grammars[t];if(!o)return null;try{let i=(0,ze.join)(e,"node_modules",o.package,"package.json");if((0,Me.existsSync)(i)){let a=(0,ze.dirname)(i);if((0,Me.existsSync)((0,ze.join)(a,"src")))return a}}catch{}return console.error(`[smart-file-read] Grammar package not found for "${t}": ${o.package} (install it in your project's node_modules)`),null}var hb={jsts:`
|
|
58
58
|
(function_declaration name: (identifier) @name) @func
|
|
59
59
|
(lexical_declaration (variable_declarator name: (identifier) @name value: [(arrow_function) (function_expression)])) @const_func
|
|
60
60
|
(class_declaration name: (type_identifier) @name) @cls
|
|
@@ -176,25 +176,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
176
176
|
(interface_declaration name: (name) @name) @iface
|
|
177
177
|
(trait_declaration name: (name) @name) @trait_def
|
|
178
178
|
(namespace_use_declaration) @imp
|
|
179
|
-
`};function
|
|
180
|
-
`)){if(o.length>0&&!o.startsWith(" ")&&!o.startsWith(" ")){r=o.trim(),e.has(r)||e.set(r,[]),n=null;continue}if(!r)continue;let i=o.match(/^\s+pattern:\s+(\d+)/);if(i){n={pattern:parseInt(i[1]),captures:[]},e.get(r).push(n);continue}let a=o.match(/^\s+capture:\s+(?:\d+\s*-\s*)?(\w+),\s*start:\s*\((\d+),\s*(\d+)\),\s*end:\s*\((\d+),\s*(\d+)\)(?:,\s*text:\s*`([^`]*)`)?/);a&&n&&n.captures.push({tag:a[1],startRow:parseInt(a[2]),startCol:parseInt(a[3]),endRow:parseInt(a[4]),endCol:parseInt(a[5]),text:a[6]})}return e}var
|
|
181
|
-
`),s=a.indexOf("{");s!==-1&&s<500&&(i=a.slice(0,s).replace(/\n/g," ").replace(/\s+/g," ").trim())}return i=i.replace(/\s*[{:]\s*$/,"").trim(),i.length>n&&(i=i.slice(0,n-3)+"..."),i}function
|
|
182
|
-
`).trim():void 0}function
|
|
183
|
-
`),a=
|
|
184
|
-
`);r.set(p.relativePath,{filePath:p.relativePath,language:i,symbols:[],imports:[],totalLines:f.length,foldedTokenEstimate:50})}continue}let c=
|
|
185
|
-
`),h=d.get(p.absolutePath)||[],g=
|
|
186
|
-
`)}function
|
|
187
|
-
`)}function
|
|
188
|
-
`).find(c=>{let u=c.replace(/^[\s*/]+/,"").replace(/^['"`]{3}/,"").trim();return u.length>0&&!u.startsWith("/**")});if(s){let c=s.replace(/^[\s*/]+/,"").replace(/^['"`]{3}/,"").replace(/['"`]{3}$/,"").trim();c&&r.push(`${e} \u{1F4AC} ${c}`)}}if(t.children&&t.children.length>0)for(let a of t.children)r.push(
|
|
189
|
-
`)}function
|
|
179
|
+
`};function QO(t){switch(t){case"javascript":case"typescript":case"tsx":return"jsts";case"python":return"python";case"go":return"go";case"rust":return"rust";case"ruby":return"ruby";case"java":return"java";case"kotlin":return"kotlin";case"swift":return"swift";case"php":return"php";case"elixir":return"generic";case"lua":return"lua";case"scala":return"scala";case"bash":return"bash";case"haskell":return"haskell";case"zig":return"zig";case"css":return"css";case"scss":return"scss";case"toml":return"toml";case"yaml":return"yaml";case"sql":return"sql";case"markdown":return"markdown";default:return"generic"}}var dm=null,pm=new Map;function gb(t){if(pm.has(t))return pm.get(t);dm||(dm=(0,Me.mkdtempSync)((0,ze.join)((0,gm.tmpdir)(),"smart-read-queries-")));let e=(0,ze.join)(dm,`${t}.scm`);return(0,Me.writeFileSync)(e,hb[t]),pm.set(t,e),e}var Ri=null;function ej(){if(Ri)return Ri;try{let t=mm.resolve("tree-sitter-cli/package.json"),e=(0,ze.join)((0,ze.dirname)(t),"tree-sitter");if((0,Me.existsSync)(e))return Ri=e,e}catch{}return Ri="tree-sitter",Ri}function tj(t,e,r){return vb(t,[e],r).get(e)||[]}function vb(t,e,r){if(e.length===0)return new Map;let n=ej(),o=["query","-p",r,t,...e],i;try{i=(0,lb.execFileSync)(n,o,{encoding:"utf-8",timeout:3e4,stdio:["pipe","pipe","pipe"]})}catch(a){return _.debug("WORKER",`tree-sitter query failed for ${e.length} file(s)`,void 0,a instanceof Error?a:void 0),new Map}return rj(i)}function rj(t){let e=new Map,r=null,n=null;for(let o of t.split(`
|
|
180
|
+
`)){if(o.length>0&&!o.startsWith(" ")&&!o.startsWith(" ")){r=o.trim(),e.has(r)||e.set(r,[]),n=null;continue}if(!r)continue;let i=o.match(/^\s+pattern:\s+(\d+)/);if(i){n={pattern:parseInt(i[1]),captures:[]},e.get(r).push(n);continue}let a=o.match(/^\s+capture:\s+(?:\d+\s*-\s*)?(\w+),\s*start:\s*\((\d+),\s*(\d+)\),\s*end:\s*\((\d+),\s*(\d+)\)(?:,\s*text:\s*`([^`]*)`)?/);a&&n&&n.captures.push({tag:a[1],startRow:parseInt(a[2]),startCol:parseInt(a[3]),endRow:parseInt(a[4]),endCol:parseInt(a[5]),text:a[6]})}return e}var cb={func:"function",const_func:"function",cls:"class",method:"method",iface:"interface",tdef:"type",enm:"enum",struct_def:"struct",trait_def:"trait",impl_def:"impl",mixin_def:"mixin",heading:"section",code_block:"code",frontmatter:"metadata",ref:"reference"},nj=new Set(["class","struct","impl","trait"]);function oj(t,e,r,n=200){let i=t[e]||"";if(!i.trimEnd().endsWith("{")&&!i.trimEnd().endsWith(":")){let a=t.slice(e,Math.min(e+10,r+1)).join(`
|
|
181
|
+
`),s=a.indexOf("{");s!==-1&&s<500&&(i=a.slice(0,s).replace(/\n/g," ").replace(/\s+/g," ").trim())}return i=i.replace(/\s*[{:]\s*$/,"").trim(),i.length>n&&(i=i.slice(0,n-3)+"..."),i}function ij(t,e){let r=[],n=!1;for(let o=e-1;o>=0;o--){let i=t[o].trim();if(i===""){if(n)break;continue}if(i.startsWith("/**")||i.startsWith("*")||i.startsWith("*/")||i.startsWith("//")||i.startsWith("///")||i.startsWith("//!")||i.startsWith("#")||i.startsWith("@"))r.unshift(t[o]),n=!0;else break}return r.length>0?r.join(`
|
|
182
|
+
`).trim():void 0}function aj(t,e,r){for(let n=e+1;n<=Math.min(e+3,r);n++){let o=t[n]?.trim();if(o){if(o.startsWith('"""')||o.startsWith("'''"))return o;break}}}function sj(t,e,r,n,o,i){switch(i){case"javascript":case"typescript":case"tsx":return n.some(a=>e>=a.startRow&&r<=a.endRow);case"python":return!t.startsWith("_");case"go":return t.length>0&&t[0]===t[0].toUpperCase()&&t[0]!==t[0].toLowerCase();case"rust":return o[e]?.trimStart().startsWith("pub")??!1;default:return!0}}function _b(t,e,r){let n=[],o=[],i=[],a=[];for(let c of t)for(let u of c.captures)u.tag==="exp"&&i.push({startRow:u.startRow,endRow:u.endRow}),u.tag==="imp"&&o.push(u.text||e[u.startRow]?.trim()||"");for(let c of t){let u=c.captures.find(x=>cb[x.tag]),l=c.captures.find(x=>x.tag==="name");if(!u)continue;let d=u.startRow,p=u.endRow,f=cb[u.tag],h=l?.text||"anonymous",g;if(r==="markdown"&&f==="section"){let N=(e[d]||"").match(/^(#{1,6})\s/),T=N?N[1].length:1;g=`${"#".repeat(T)} ${h}`}else if(r==="markdown"&&f==="code"){let x=h!=="anonymous"?h:"";g=x?"```"+x:"```"}else r==="markdown"&&f==="metadata"?g="---frontmatter---":r==="markdown"&&f==="reference"?g=e[d]?.trim()||h:g=oj(e,d,p);let $=r==="markdown"?void 0:ij(e,d),k=r==="python"?aj(e,d,p):void 0,S={name:h,kind:f,signature:g,jsdoc:$||k,lineStart:d,lineEnd:p,exported:sj(h,d,p,i,e,r)};nj.has(f)&&(S.children=[],a.push({sym:S,startRow:d,endRow:p})),n.push(S)}if(r==="markdown"){let c=new Map,u=new Set;for(let l of n){if(l.kind!=="code")continue;let d=`${l.lineStart}:${l.lineEnd}`,p=c.get(d);p?l.name!=="anonymous"?(u.add(p),c.set(d,l)):u.add(l):c.set(d,l)}if(u.size>0){let l=n.filter(d=>!u.has(d));n.length=0,n.push(...l)}}let s=new Set;for(let c of a)for(let u of n)u!==c.sym&&u.lineStart>c.startRow&&u.lineEnd<=c.endRow&&(u.kind==="function"&&(u.kind="method"),c.sym.children.push(u),s.add(u));return{symbols:n.filter(c=>!s.has(c)),imports:o}}function nc(t,e,r){let n=r?Ai(r):Zn,o=db(e,n),i=t.split(`
|
|
183
|
+
`),a=mb(o,r);if(!a)return{filePath:e,language:o,symbols:[],imports:[],totalLines:i.length,foldedTokenEstimate:50};let s=pb(o,n),c=gb(s),u=e.slice(e.lastIndexOf("."))||".txt",l=(0,Me.mkdtempSync)((0,ze.join)((0,gm.tmpdir)(),"smart-src-")),d=(0,ze.join)(l,`source${u}`);(0,Me.writeFileSync)(d,t);try{let p=tj(c,d,a),f=_b(p,i,o),h=Ln({filePath:e,language:o,symbols:f.symbols,imports:f.imports,totalLines:i.length,foldedTokenEstimate:0});return{filePath:e,language:o,symbols:f.symbols,imports:f.imports,totalLines:i.length,foldedTokenEstimate:Math.ceil(h.length/4)}}finally{(0,Me.rmSync)(l,{recursive:!0,force:!0})}}function yb(t,e){let r=new Map,n=e?Ai(e):Zn,o=new Map;for(let i of t){let a=db(i.relativePath,n);o.has(a)||o.set(a,[]),o.get(a).push(i)}for(let[i,a]of o){let s=mb(i,e);if(!s){for(let p of a){let f=p.content.split(`
|
|
184
|
+
`);r.set(p.relativePath,{filePath:p.relativePath,language:i,symbols:[],imports:[],totalLines:f.length,foldedTokenEstimate:50})}continue}let c=pb(i,n),u=gb(c),l=a.map(p=>p.absolutePath),d=vb(u,l,s);for(let p of a){let f=p.content.split(`
|
|
185
|
+
`),h=d.get(p.absolutePath)||[],g=_b(h,f,i),$=Ln({filePath:p.relativePath,language:i,symbols:g.symbols,imports:g.imports,totalLines:f.length,foldedTokenEstimate:0});r.set(p.relativePath,{filePath:p.relativePath,language:i,symbols:g.symbols,imports:g.imports,totalLines:f.length,foldedTokenEstimate:Math.ceil($.length/4)})}}return r}function Ln(t){if(t.language==="markdown")return cj(t);let e=[];if(e.push(`\u{1F4C1} ${t.filePath} (${t.language}, ${t.totalLines} lines)`),e.push(""),t.imports.length>0){e.push(` \u{1F4E6} Imports: ${t.imports.length} statements`);for(let r of t.imports.slice(0,10))e.push(` ${r}`);t.imports.length>10&&e.push(` ... +${t.imports.length-10} more`),e.push("")}for(let r of t.symbols)e.push($b(r," "));return e.join(`
|
|
186
|
+
`)}function cj(t){let e=[];e.push(`\u{1F4C4} ${t.filePath} (${t.language}, ${t.totalLines} lines)`);for(let n of t.symbols)if(n.kind==="section"){let o=n.signature.match(/^(#{1,6})\s/),i=o?o[1].length:1,a=" ".repeat(i),s=`L${n.lineStart+1}`,c=`${a}${n.signature}`;e.push(`${c.padEnd(56)}${s}`)}else if(n.kind==="code"){let o=ub(t.symbols,n.lineStart),i=" ".repeat(o+1),a=n.lineStart===n.lineEnd?`L${n.lineStart+1}`:`L${n.lineStart+1}-${n.lineEnd+1}`,s=`${i}${n.signature}`;e.push(`${s.padEnd(56)}${a}`)}else if(n.kind==="metadata"){let o=n.lineStart===n.lineEnd?`L${n.lineStart+1}`:`L${n.lineStart+1}-${n.lineEnd+1}`,i=` ${n.signature}`;e.push(`${i.padEnd(56)}${o}`)}else if(n.kind==="reference"){let o=ub(t.symbols,n.lineStart),i=" ".repeat(o+1),a=`L${n.lineStart+1}`,s=`${i}\u2197 ${n.name}`;e.push(`${s.padEnd(56)}${a}`)}return e.join(`
|
|
187
|
+
`)}function ub(t,e){let r=0;for(let n of t)if(n.kind==="section"&&n.lineStart<e){let o=n.signature.match(/^(#{1,6})\s/);r=o?o[1].length:1}return r}function $b(t,e){let r=[],n=uj(t.kind),o=t.exported?" [exported]":"",i=t.lineStart===t.lineEnd?`L${t.lineStart+1}`:`L${t.lineStart+1}-${t.lineEnd+1}`;if(r.push(`${e}${n} ${t.name}${o} (${i})`),r.push(`${e} ${t.signature}`),t.jsdoc){let s=t.jsdoc.split(`
|
|
188
|
+
`).find(c=>{let u=c.replace(/^[\s*/]+/,"").replace(/^['"`]{3}/,"").trim();return u.length>0&&!u.startsWith("/**")});if(s){let c=s.replace(/^[\s*/]+/,"").replace(/^['"`]{3}/,"").replace(/['"`]{3}$/,"").trim();c&&r.push(`${e} \u{1F4AC} ${c}`)}}if(t.children&&t.children.length>0)for(let a of t.children)r.push($b(a,e+" "));return r.join(`
|
|
189
|
+
`)}function uj(t){return{function:"\u0192",method:"\u0192",class:"\u25C6",interface:"\u25C7",type:"\u25C7",const:"\u25CF",variable:"\u25CB",export:"\u2192",struct:"\u25C6",enum:"\u25A3",trait:"\u25C7",impl:"\u25C8",property:"\u25CB",getter:"\u21E2",setter:"\u21E0",mixin:"\u25C8",section:"\xA7",code:"\u2318",metadata:"\u25CA",reference:"\u2197"}[t]||"\xB7"}function bb(t,e,r){let n=nc(t,e),o=u=>{for(let l of u){if(l.name===r)return l;if(l.children){let d=o(l.children);if(d)return d}}return null},i=o(n.symbols);if(!i)return null;let a=t.split(`
|
|
190
190
|
`);if(n.language==="markdown"&&i.kind==="section"){let u=i.signature.match(/^(#{1,6})\s/),l=u?u[1].length:1,d=i.lineStart,p=a.length-1;for(let h of n.symbols)if(h.kind==="section"&&h.lineStart>d){let g=h.signature.match(/^(#{1,6})\s/);if((g?g[1].length:1)<=l){for(p=h.lineStart-1;p>d&&a[p].trim()==="";)p--;break}}let f=a.slice(d,p+1).join(`
|
|
191
191
|
`);return`<!-- \u{1F4CD} ${e} L${d+1}-${p+1} -->
|
|
192
192
|
${f}`}let s=i.lineStart;for(let u=i.lineStart-1;u>=0;u--){let l=a[u].trim();if(l===""||l.startsWith("*")||l.startsWith("/**")||l.startsWith("///")||l.startsWith("//")||l.startsWith("#")||l.startsWith("@")||l==="*/")s=u;else break}let c=a.slice(s,i.lineEnd+1).join(`
|
|
193
193
|
`);return`// \u{1F4CD} ${e} L${s+1}-${i.lineEnd+1}
|
|
194
|
-
${c}`}var
|
|
194
|
+
${c}`}var xb=new Set([".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".go",".rs",".rb",".java",".cs",".cpp",".cc",".cxx",".c",".h",".hpp",".hh",".swift",".kt",".kts",".php",".vue",".svelte",".ex",".exs",".lua",".scala",".sc",".sh",".bash",".zsh",".hs",".zig",".css",".scss",".toml",".yml",".yaml",".sql",".md",".mdx"]),dj=new Set(["node_modules",".git","dist","build",".next","__pycache__",".venv","venv","env",".env","target","vendor",".cache",".turbo","coverage",".nyc_output",".claude",".smart-file-read"]),pj=512*1024;async function*Sb(t,e,r=20,n){if(r<=0)return;let o;try{o=await(0,Fn.readdir)(t,{withFileTypes:!0})}catch(i){_.debug("WORKER",`walkDir: failed to read directory ${t}`,void 0,i instanceof Error?i:void 0);return}for(let i of o){if(i.name.startsWith(".")&&i.name!=="."||dj.has(i.name))continue;let a=(0,Ci.join)(t,i.name);if(i.isDirectory())yield*Sb(a,e,r-1,n);else if(i.isFile()){let s=i.name.slice(i.name.lastIndexOf("."));(xb.has(s)||n&&n.has(s))&&(yield a)}}}async function fj(t){try{let e=await(0,Fn.stat)(t);if(e.size>pj||e.size===0)return null;let r=await(0,Fn.readFile)(t,"utf-8");return r.slice(0,1e3).includes("\0")?null:r}catch(e){return _.debug("WORKER",`safeReadFile: failed to read ${t}`,void 0,e instanceof Error?e:void 0),null}}async function kb(t,e,r={}){let n=r.maxResults||20,o=e.toLowerCase(),i=o.split(/[\s_\-./]+/).filter(S=>S.length>0),a=r.projectRoot||t,s=Ai(a),c=new Set;for(let S of Object.values(s.grammars))for(let x of S.extensions)xb.has(x)||c.add(x);let u=[];for await(let S of Sb(t,t,20,c.size>0?c:void 0)){if(r.filePattern&&!(0,Ci.relative)(t,S).toLowerCase().includes(r.filePattern.toLowerCase()))continue;let x=await fj(S);x&&u.push({absolutePath:S,relativePath:(0,Ci.relative)(t,S),content:x})}let l=yb(u,a),d=[],p=[],f=0;for(let[S,x]of l){f+=mj(x);let T=oc(S.toLowerCase(),i)>0,Ve=[],We=(Vn,Vr)=>{for(let ye of Vn){let rr=0,ht="",Wn=oc(ye.name.toLowerCase(),i);Wn>0&&(rr+=Wn*3,ht="name match"),ye.signature.toLowerCase().includes(o)&&(rr+=2,ht=ht?`${ht} + signature`:"signature match"),ye.jsdoc&&ye.jsdoc.toLowerCase().includes(o)&&(rr+=1,ht=ht?`${ht} + jsdoc`:"jsdoc match"),rr>0&&(T=!0,Ve.push({filePath:S,symbolName:Vr?`${Vr}.${ye.name}`:ye.name,kind:ye.kind,signature:ye.signature,jsdoc:ye.jsdoc,lineStart:ye.lineStart,lineEnd:ye.lineEnd,matchReason:ht})),ye.children&&We(ye.children,ye.name)}};We(x.symbols),T&&(d.push(x),p.push(...Ve))}p.sort((S,x)=>{let N=oc(S.symbolName.toLowerCase(),i);return oc(x.symbolName.toLowerCase(),i)-N});let h=p.slice(0,n),g=new Set(h.map(S=>S.filePath)),$=d.filter(S=>g.has(S.filePath)).slice(0,n),k=$.reduce((S,x)=>S+x.foldedTokenEstimate,0);return{foldedFiles:$,matchingSymbols:h,totalFilesScanned:u.length,totalSymbolsFound:f,tokenEstimate:k}}function oc(t,e){let r=0;for(let n of e)if(t===n)r+=10;else if(t.includes(n))r+=5;else{let o=0,i=0;for(let a of n){let s=t.indexOf(a,o);s!==-1&&(i++,o=s+1)}i===n.length&&(r+=1)}return r}function mj(t){let e=t.symbols.length;for(let r of t.symbols)r.children&&(e+=r.children.length);return e}function wb(t,e){let r=[];if(r.push(`\u{1F50D} Smart Search: "${e}"`),r.push(` Scanned ${t.totalFilesScanned} files, found ${t.totalSymbolsFound} symbols`),r.push(` ${t.matchingSymbols.length} matches across ${t.foldedFiles.length} files (~${t.tokenEstimate} tokens for folded view)`),r.push(""),t.matchingSymbols.length===0)return r.push(" No matching symbols found."),r.join(`
|
|
195
195
|
`);r.push("\u2500\u2500 Matching Symbols \u2500\u2500"),r.push("");for(let n of t.matchingSymbols){if(r.push(` ${n.kind} ${n.symbolName} (${n.filePath}:${n.lineStart+1})`),r.push(` ${n.signature}`),n.jsdoc){let o=n.jsdoc.split(`
|
|
196
|
-
`).find(i=>i.replace(/^[\s*/]+/,"").trim().length>0);o&&r.push(` \u{1F4AC} ${o.replace(/^[\s*/]+/,"").trim()}`)}r.push("")}r.push("\u2500\u2500 Folded File Views \u2500\u2500"),r.push("");for(let n of t.foldedFiles)r.push(
|
|
197
|
-
`)}var
|
|
196
|
+
`).find(i=>i.replace(/^[\s*/]+/,"").trim().length>0);o&&r.push(` \u{1F4AC} ${o.replace(/^[\s*/]+/,"").trim()}`)}r.push("")}r.push("\u2500\u2500 Folded File Views \u2500\u2500"),r.push("");for(let n of t.foldedFiles)r.push(Ln(n)),r.push("");return r.push("\u2500\u2500 Actions \u2500\u2500"),r.push(" To see full implementation: use smart_unfold with file path and symbol name"),r.join(`
|
|
197
|
+
`)}var _m=require("node:fs/promises"),zb=require("node:fs"),qr=require("node:path"),Pb=require("node:url"),wj={},hj="12.3.3";console.log=(...t)=>{_.error("CONSOLE","Intercepted console output (MCP protocol protection)",void 0,{args:t})};var Tb=!1,Ob=(()=>{if(typeof __dirname<"u")return __dirname;try{return(0,qr.dirname)((0,Pb.fileURLToPath)(wj.url))}catch{return Tb=!0,process.cwd()}})(),ym=(0,qr.resolve)(Ob,"worker-service.cjs");function gj(){Tb&&((0,zb.existsSync)(ym)||_.error("SYSTEM","mcp-server: dirname resolution failed (both __dirname and import.meta.url are unavailable). Fell back to process.cwd() and the resolved WORKER_SCRIPT_PATH does not exist. This is the actual problem \u2014 the worker bundle is fine, but mcp-server cannot locate it. Worker auto-start will fail until the dirname-resolution path is fixed.",{workerScriptPath:ym,mcpServerDir:Ob}))}var Eb={search:"/api/search",timeline:"/api/timeline"};async function vm(t,e){_.debug("SYSTEM","\u2192 Worker API",void 0,{endpoint:t,params:e});let r=new URLSearchParams;for(let[o,i]of Object.entries(e))i!=null&&r.append(o,String(i));let n=`${t}?${r}`;try{let o=await ec(n);if(!o.ok){let a=await o.text();throw new Error(`Worker API error (${o.status}): ${a}`)}let i=await o.json();return _.debug("SYSTEM","\u2190 Worker API success",void 0,{endpoint:t}),i}catch(o){return _.error("SYSTEM","\u2190 Worker API error",{endpoint:t},o instanceof Error?o:new Error(String(o))),{content:[{type:"text",text:`Error calling Worker API: ${o instanceof Error?o.message:String(o)}`}],isError:!0}}}async function vj(t,e){let r=await ec(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){let o=await r.text();throw new Error(`Worker API error (${r.status}): ${o}`)}let n=await r.json();return _.debug("HTTP","Worker API success (POST)",void 0,{endpoint:t}),{content:[{type:"text",text:JSON.stringify(n,null,2)}]}}async function qn(t,e){_.debug("HTTP","Worker API request (POST)",void 0,{endpoint:t});try{return await vj(t,e)}catch(r){return _.error("HTTP","Worker API error (POST)",{endpoint:t},r instanceof Error?r:new Error(String(r))),{content:[{type:"text",text:`Error calling Worker API: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}}async function _j(){try{return(await ec("/api/health")).ok}catch(t){return _.debug("SYSTEM","Worker health check failed",{},t instanceof Error?t:new Error(String(t))),!1}}async function yj(){if(await _j())return!0;_.warn("SYSTEM","Worker not available, attempting auto-start for MCP client"),gj();try{let t=Qf(),e=await sb(t,ym);return e||_.error("SYSTEM","Worker auto-start returned false \u2014 MCP tools that require the worker (search, timeline, get_observations) will fail until the worker is running. Check earlier log lines for the specific failure reason (Bun not found, missing worker bundle, port conflict, etc.)."),e}catch(t){return _.error("SYSTEM","Worker auto-start threw \u2014 MCP tools that require the worker (search, timeline, get_observations) will fail until the worker is running.",void 0,t instanceof Error?t:new Error(String(t))),!1}}var jb=[{name:"__IMPORTANT",description:`3-LAYER WORKFLOW (ALWAYS FOLLOW):
|
|
198
198
|
1. search(query) \u2192 Get index with IDs (~50-100 tokens/result)
|
|
199
199
|
2. timeline(anchor=ID) \u2192 Get context around interesting results
|
|
200
200
|
3. get_observations([IDs]) \u2192 Fetch full details ONLY for filtered IDs
|
|
@@ -214,8 +214,8 @@ NEVER fetch full details without filtering first. 10x token savings.`,inputSchem
|
|
|
214
214
|
\`get_observations(ids=[...])\` # ALWAYS batch for 2+ items
|
|
215
215
|
Returns: Complete details (~500-1000 tokens/result)
|
|
216
216
|
|
|
217
|
-
**Why:** 10x token savings. Never fetch full details without filtering first.`}]})},{name:"search",description:"Step 1: Search memory. Returns index with IDs. Params: query, limit, project, type, obs_type, dateStart, dateEnd, offset, orderBy",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search query"},limit:{type:"number",description:"Max results (default 20)"},project:{type:"string",description:"Filter by project name"},type:{type:"string",description:"Filter by observation type"},obs_type:{type:"string",description:"Filter by obs_type field"},dateStart:{type:"string",description:"Start date filter (ISO)"},dateEnd:{type:"string",description:"End date filter (ISO)"},offset:{type:"number",description:"Pagination offset"},orderBy:{type:"string",description:"Sort order: date_desc or date_asc"}},additionalProperties:!0},handler:async t=>{let e=
|
|
217
|
+
**Why:** 10x token savings. Never fetch full details without filtering first.`}]})},{name:"search",description:"Step 1: Search memory. Returns index with IDs. Params: query, limit, project, type, obs_type, dateStart, dateEnd, offset, orderBy",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search query"},limit:{type:"number",description:"Max results (default 20)"},project:{type:"string",description:"Filter by project name"},type:{type:"string",description:"Filter by observation type"},obs_type:{type:"string",description:"Filter by obs_type field"},dateStart:{type:"string",description:"Start date filter (ISO)"},dateEnd:{type:"string",description:"End date filter (ISO)"},offset:{type:"number",description:"Pagination offset"},orderBy:{type:"string",description:"Sort order: date_desc or date_asc"}},additionalProperties:!0},handler:async t=>{let e=Eb.search;return await vm(e,t)}},{name:"timeline",description:"Step 2: Get context around results. Params: anchor (observation ID) OR query (finds anchor automatically), depth_before, depth_after, project",inputSchema:{type:"object",properties:{anchor:{type:"number",description:"Observation ID to center the timeline around"},query:{type:"string",description:"Query to find anchor automatically"},depth_before:{type:"number",description:"Items before anchor (default 3)"},depth_after:{type:"number",description:"Items after anchor (default 3)"},project:{type:"string",description:"Filter by project name"}},additionalProperties:!0},handler:async t=>{let e=Eb.timeline;return await vm(e,t)}},{name:"get_observations",description:"Step 3: Fetch full details for filtered IDs. Params: ids (array of observation IDs, required), orderBy, limit, project",inputSchema:{type:"object",properties:{ids:{type:"array",items:{type:"number"},description:"Array of observation IDs to fetch (required)"}},required:["ids"],additionalProperties:!0},handler:async t=>await qn("/api/observations/batch",t)},{name:"smart_search",description:"Search codebase for symbols, functions, classes using tree-sitter AST parsing. Returns folded structural views with token counts. Use path parameter to scope the search.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search term \u2014 matches against symbol names, file names, and file content"},path:{type:"string",description:"Root directory to search (default: current working directory)"},max_results:{type:"number",description:"Maximum results to return (default: 20)"},file_pattern:{type:"string",description:'Substring filter for file paths (e.g. ".ts", "src/services")'}},required:["query"]},handler:async t=>{let e=(0,qr.resolve)(t.path||process.cwd()),r=await kb(e,t.query,{maxResults:t.max_results||20,filePattern:t.file_pattern});return{content:[{type:"text",text:wb(r,t.query)}]}}},{name:"smart_unfold",description:"Expand a specific symbol (function, class, method) from a file. Returns the full source code of just that symbol. Use after smart_search or smart_outline to read specific code.",inputSchema:{type:"object",properties:{file_path:{type:"string",description:"Path to the source file"},symbol_name:{type:"string",description:"Name of the symbol to unfold (function, class, method, etc.)"}},required:["file_path","symbol_name"]},handler:async t=>{let e=(0,qr.resolve)(t.file_path),r=await(0,_m.readFile)(e,"utf-8"),n=bb(r,e,t.symbol_name);if(n)return{content:[{type:"text",text:n}]};let o=nc(r,e);if(o.symbols.length>0){let i=o.symbols.map(a=>` - ${a.name} (${a.kind})`).join(`
|
|
218
218
|
`);return{content:[{type:"text",text:`Symbol "${t.symbol_name}" not found in ${t.file_path}.
|
|
219
219
|
|
|
220
220
|
Available symbols:
|
|
221
|
-
${i}`}]}}return{content:[{type:"text",text:`Could not parse ${t.file_path}. File may be unsupported or empty.`}]}}},{name:"smart_outline",description:"Get structural outline of a file \u2014 shows all symbols (functions, classes, methods, types) with signatures but bodies folded. Much cheaper than reading the full file.",inputSchema:{type:"object",properties:{file_path:{type:"string",description:"Path to the source file"}},required:["file_path"]},handler:async t=>{let e=(0,
|
|
221
|
+
${i}`}]}}return{content:[{type:"text",text:`Could not parse ${t.file_path}. File may be unsupported or empty.`}]}}},{name:"smart_outline",description:"Get structural outline of a file \u2014 shows all symbols (functions, classes, methods, types) with signatures but bodies folded. Much cheaper than reading the full file.",inputSchema:{type:"object",properties:{file_path:{type:"string",description:"Path to the source file"}},required:["file_path"]},handler:async t=>{let e=(0,qr.resolve)(t.file_path),r=await(0,_m.readFile)(e,"utf-8"),n=nc(r,e);return n.symbols.length>0?{content:[{type:"text",text:Ln(n)}]}:{content:[{type:"text",text:`Could not parse ${t.file_path}. File may use an unsupported language or be empty.`}]}}},{name:"build_corpus",description:"Build a knowledge corpus from filtered observations. Creates a queryable knowledge agent. Params: name (required), description, project, types (comma-separated), concepts (comma-separated), files (comma-separated), query, dateStart, dateEnd, limit",inputSchema:{type:"object",properties:{name:{type:"string",description:"Corpus name (used as filename)"},description:{type:"string",description:"What this corpus is about"},project:{type:"string",description:"Filter by project"},types:{type:"string",description:"Comma-separated observation types: decision,bugfix,feature,refactor,discovery,change"},concepts:{type:"string",description:"Comma-separated concepts to filter by"},files:{type:"string",description:"Comma-separated file paths to filter by"},query:{type:"string",description:"Semantic search query"},dateStart:{type:"string",description:"Start date (ISO format)"},dateEnd:{type:"string",description:"End date (ISO format)"},limit:{type:"number",description:"Maximum observations (default 500)"}},required:["name"],additionalProperties:!0},handler:async t=>await qn("/api/corpus",t)},{name:"list_corpora",description:"List all knowledge corpora with their stats and priming status",inputSchema:{type:"object",properties:{},additionalProperties:!0},handler:async t=>await vm("/api/corpus",t)},{name:"prime_corpus",description:"Prime a knowledge corpus \u2014 creates an AI session loaded with the corpus knowledge. Must be called before query_corpus.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Name of the corpus to prime"}},required:["name"],additionalProperties:!0},handler:async t=>{let{name:e,...r}=t;if(typeof e!="string"||e.trim()==="")throw new Error("Missing required argument: name");return await qn(`/api/corpus/${encodeURIComponent(e)}/prime`,r)}},{name:"query_corpus",description:"Ask a question to a primed knowledge corpus. The corpus must be primed first with prime_corpus.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Name of the corpus to query"},question:{type:"string",description:"The question to ask"}},required:["name","question"],additionalProperties:!0},handler:async t=>{let{name:e,...r}=t;if(typeof e!="string"||e.trim()==="")throw new Error("Missing required argument: name");return await qn(`/api/corpus/${encodeURIComponent(e)}/query`,r)}},{name:"rebuild_corpus",description:"Rebuild a knowledge corpus from its stored filter \u2014 re-runs the search to refresh with new observations. Does not re-prime the session.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Name of the corpus to rebuild"}},required:["name"],additionalProperties:!0},handler:async t=>{let{name:e,...r}=t;if(typeof e!="string"||e.trim()==="")throw new Error("Missing required argument: name");return await qn(`/api/corpus/${encodeURIComponent(e)}/rebuild`,r)}},{name:"reprime_corpus",description:"Create a fresh knowledge agent session for a corpus, clearing prior Q&A context. Use when conversation has drifted or after rebuilding.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Name of the corpus to reprime"}},required:["name"],additionalProperties:!0},handler:async t=>{let{name:e,...r}=t;if(typeof e!="string"||e.trim()==="")throw new Error("Missing required argument: name");return await qn(`/api/corpus/${encodeURIComponent(e)}/reprime`,r)}}],$m=new Hs({name:"claude-mem",version:hj},{capabilities:{tools:{}}});$m.setRequestHandler(Kd,async()=>({tools:jb.map(t=>({name:t.name,description:t.description,inputSchema:t.inputSchema}))}));$m.setRequestHandler(Qo,async t=>{let e=jb.find(r=>r.name===t.params.name);if(!e)throw new Error(`Unknown tool: ${t.params.name}`);try{return await e.handler(t.params.arguments||{})}catch(r){return _.error("SYSTEM","Tool execution failed",{tool:t.params.name},r instanceof Error?r:new Error(String(r))),{content:[{type:"text",text:`Tool execution failed: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}});var $j=3e4,Ui=null,Ib=!1;function ic(){Zi("stdio-closed")}function Db(t){_.warn("SYSTEM","MCP stdio stream errored, shutting down",{message:t.message}),Zi("stdio-error")}function bj(){process.stdin.on("end",ic),process.stdin.on("close",ic),process.stdin.on("error",Db)}function xj(){process.stdin.off("end",ic),process.stdin.off("close",ic),process.stdin.off("error",Db)}function Sj(){if(process.platform==="win32")return;let t=process.ppid;Ui=setInterval(()=>{(process.ppid===1||process.ppid!==t)&&(_.info("SYSTEM","Parent process died, self-exiting to prevent orphan",{initialPpid:t,currentPpid:process.ppid}),Zi())},$j),Ui.unref&&Ui.unref()}function Zi(t="shutdown"){Ib||(Ib=!0,Ui&&clearInterval(Ui),xj(),_.info("SYSTEM","MCP server shutting down",{reason:t}),process.exit(0))}process.on("SIGTERM",Zi);process.on("SIGINT",Zi);async function kj(){let t=new Ks;bj(),await $m.connect(t),_.info("SYSTEM","Claude-mem search server started"),Sj(),setTimeout(async()=>{await yj()?_.info("SYSTEM","Worker available",void 0,{}):(_.error("SYSTEM","Worker not available",void 0,{}),_.error("SYSTEM","Tools will fail until Worker is started"),_.error("SYSTEM","Start Worker with: npm run worker:restart"))},0)}kj().catch(t=>{_.error("SYSTEM","Fatal error",void 0,t),process.exit(0)});
|