@orochibraru/ui 1.0.0 → 1.0.1
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/README.md +84 -3
- package/dist/components/blocks/accent-toggle.svelte +7 -3
- package/dist/components/blocks/accent-toggle.svelte.d.ts +1 -1
- package/dist/components/blocks/bottom-nav.svelte +1 -1
- package/dist/components/blocks/command-palette.svelte +268 -0
- package/dist/components/blocks/command-palette.svelte.d.ts +37 -0
- package/dist/components/blocks/error-page.svelte +23 -7
- package/dist/components/blocks/error-page.svelte.d.ts +4 -0
- package/dist/components/blocks/fab.svelte +1 -1
- package/dist/components/blocks/install-prompt.svelte +14 -8
- package/dist/components/blocks/install-prompt.svelte.d.ts +2 -1
- package/dist/components/blocks/music-player/labelled-slider.svelte +3 -12
- package/dist/components/blocks/music-player/labelled-slider.svelte.d.ts +1 -2
- package/dist/components/blocks/music-player.svelte +13 -12
- package/dist/components/blocks/otp-field.svelte +77 -33
- package/dist/components/blocks/otp-field.svelte.d.ts +7 -0
- package/dist/components/blocks/password-input.svelte +56 -16
- package/dist/components/blocks/password-input.svelte.d.ts +3 -0
- package/dist/components/blocks/stepper/stepper-phone-header.svelte +93 -0
- package/dist/components/blocks/stepper/stepper-phone-header.svelte.d.ts +13 -0
- package/dist/components/blocks/stepper.svelte +175 -0
- package/dist/components/blocks/stepper.svelte.d.ts +30 -0
- package/dist/components/blocks/time-range-picker.svelte +229 -0
- package/dist/components/blocks/time-range-picker.svelte.d.ts +33 -0
- package/dist/components/blocks/time-series-chart/data-table.svelte +43 -0
- package/dist/components/blocks/time-series-chart/data-table.svelte.d.ts +15 -0
- package/dist/components/blocks/time-series-chart/legend.svelte +23 -0
- package/dist/components/blocks/time-series-chart/legend.svelte.d.ts +10 -0
- package/dist/components/blocks/time-series-chart/marks.svelte +118 -0
- package/dist/components/blocks/time-series-chart/marks.svelte.d.ts +29 -0
- package/dist/components/blocks/time-series-chart/messages.d.ts +13 -0
- package/dist/components/blocks/time-series-chart/messages.js +12 -0
- package/dist/components/blocks/time-series-chart/readout.svelte +44 -0
- package/dist/components/blocks/time-series-chart/readout.svelte.d.ts +15 -0
- package/dist/components/blocks/time-series-chart/scale.d.ts +24 -0
- package/dist/components/blocks/time-series-chart/scale.js +136 -0
- package/dist/components/blocks/time-series-chart/time.d.ts +7 -0
- package/dist/components/blocks/time-series-chart/time.js +96 -0
- package/dist/components/blocks/time-series-chart.svelte +492 -0
- package/dist/components/blocks/time-series-chart.svelte.d.ts +18 -0
- package/dist/components/blocks/top-loading-bar.svelte +1 -1
- package/dist/components/blocks/video-player/center-controls.svelte +7 -7
- package/dist/components/blocks/video-player/control-bar.svelte +41 -35
- package/dist/components/blocks/video-player/control-button.svelte +1 -1
- package/dist/components/blocks/video-player/option-menu.svelte +1 -1
- package/dist/components/blocks/video-player/scrub-bar.svelte +39 -12
- package/dist/components/blocks/video-player/scrub-bar.svelte.d.ts +2 -0
- package/dist/components/blocks/video-player.svelte +2 -2
- package/dist/components/kit/accordion.svelte +70 -0
- package/dist/components/kit/accordion.svelte.d.ts +37 -0
- package/dist/components/kit/avatar-group.svelte +84 -0
- package/dist/components/kit/avatar-group.svelte.d.ts +14 -0
- package/dist/components/kit/bar-list.svelte +104 -0
- package/dist/components/kit/bar-list.svelte.d.ts +22 -0
- package/dist/components/kit/breadcrumbs.svelte +102 -0
- package/dist/components/kit/breadcrumbs.svelte.d.ts +14 -0
- package/dist/components/kit/checkbox-list.svelte +98 -0
- package/dist/components/kit/checkbox-list.svelte.d.ts +15 -0
- package/dist/components/kit/checkbox.svelte +84 -0
- package/dist/components/kit/checkbox.svelte.d.ts +8 -0
- package/dist/components/kit/confirm-dialog.svelte +127 -0
- package/dist/components/kit/confirm-dialog.svelte.d.ts +19 -0
- package/dist/components/kit/data-table.svelte +280 -0
- package/dist/components/kit/data-table.svelte.d.ts +46 -0
- package/dist/components/kit/date-field.svelte +210 -0
- package/dist/components/kit/date-field.svelte.d.ts +14 -0
- package/dist/components/kit/field-frame.svelte +71 -0
- package/dist/components/kit/field-frame.svelte.d.ts +26 -0
- package/dist/components/kit/fieldset-frame.svelte +69 -0
- package/dist/components/kit/fieldset-frame.svelte.d.ts +14 -0
- package/dist/components/kit/file-dropzone/files.d.ts +14 -0
- package/dist/components/kit/file-dropzone/files.js +69 -0
- package/dist/components/kit/file-dropzone.svelte +253 -0
- package/dist/components/kit/file-dropzone.svelte.d.ts +25 -0
- package/dist/components/kit/form.svelte +335 -0
- package/dist/components/kit/form.svelte.d.ts +61 -0
- package/dist/components/kit/input.svelte +73 -0
- package/dist/components/kit/input.svelte.d.ts +9 -0
- package/dist/components/kit/menu.svelte +163 -0
- package/dist/components/kit/menu.svelte.d.ts +28 -0
- package/dist/components/kit/pagination.svelte +134 -0
- package/dist/components/kit/pagination.svelte.d.ts +17 -0
- package/dist/components/kit/radio-list.svelte +131 -0
- package/dist/components/kit/radio-list.svelte.d.ts +15 -0
- package/dist/components/kit/segmented-control/segment.svelte +47 -0
- package/dist/components/kit/segmented-control/segment.svelte.d.ts +11 -0
- package/dist/components/kit/segmented-control.svelte +70 -0
- package/dist/components/kit/segmented-control.svelte.d.ts +16 -0
- package/dist/components/kit/select.svelte +244 -0
- package/dist/components/kit/select.svelte.d.ts +26 -0
- package/dist/components/kit/status-badge.svelte +54 -0
- package/dist/components/kit/status-badge.svelte.d.ts +31 -0
- package/dist/components/kit/switch.svelte +84 -0
- package/dist/components/kit/switch.svelte.d.ts +8 -0
- package/dist/components/kit/tabs.svelte +86 -0
- package/dist/components/kit/tabs.svelte.d.ts +20 -0
- package/dist/components/kit/textarea.svelte +92 -0
- package/dist/components/kit/textarea.svelte.d.ts +11 -0
- package/dist/components/ui/drawer/drawer-content.svelte +1 -1
- package/dist/components/ui/input-group/input-group-input.svelte.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-input.svelte.d.ts +1 -1
- package/dist/components/ui/sonner/sonner.svelte +2 -4
- package/dist/mcp-content.json +1 -1
- package/dist/mcp.js +11 -11
- package/dist/server/hooks.d.ts +9 -0
- package/dist/server/hooks.js +41 -0
- package/dist/server/logger.d.ts +39 -0
- package/dist/server/logger.js +144 -0
- package/dist/server/telemetry.d.ts +23 -0
- package/dist/server/telemetry.js +82 -0
- package/dist/theme.css +18 -6
- package/package.json +40 -1
package/dist/mcp.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var bb=Object.create;var{getPrototypeOf:$b,defineProperty:fd,getOwnPropertyNames:wb}=Object;var md=Object.prototype.hasOwnProperty;function kb(e){return this[e]}var Sb,zb,hd=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?Sb??=new WeakMap:zb??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?bb($b(e)):{};let i=t||!e||!e.__esModule||!md.call(e,"default")?fd(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of wb(e))if(!md.call(i,a))fd(i,a,{get:kb.bind(e,a),enumerable:!0})}if(n)o.set(e,i);return i};var z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var bo=z(function(Hh){Object.defineProperty(Hh,"__esModule",{value:!0});Hh.regexpCode=Hh.getEsmExportName=Hh.getProperty=Hh.safeStringify=Hh.stringify=Hh.strConcat=Hh.addCodeArg=Hh.str=Hh._=Hh.nil=Hh._Code=Hh.Name=Hh.IDENTIFIER=Hh._CodeOrName=void 0;class ti{}Hh._CodeOrName=ti;Hh.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class tn extends ti{constructor(e){super();if(!Hh.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Hh.Name=tn;class ft extends ti{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((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof tn)t[r.str]=(t[r.str]||0)+1;return t},{})}}Hh._Code=ft;Hh.nil=new ft("");function Uh(e,...t){let r=[e[0]],n=0;while(n<t.length)cl(r,t[n]),r.push(e[++n]);return new ft(r)}Hh._=Uh;var al=new ft("+");function Vh(e,...t){let r=[xo(e[0])],n=0;while(n<t.length)r.push(al),cl(r,t[n]),r.push(al,xo(e[++n]));return xS(r),new ft(r)}Hh.str=Vh;function cl(e,t){if(t instanceof ft)e.push(...t._items);else if(t instanceof tn)e.push(t);else e.push(wS(t))}Hh.addCodeArg=cl;function xS(e){let t=1;while(t<e.length-1){if(e[t]===al){let r=bS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function bS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof tn||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof tn))return`"${e}${t.slice(1)}`;return}function $S(e,t){return t.emptyStr()?e:e.emptyStr()?t:Vh`${e}${t}`}Hh.strConcat=$S;function wS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:xo(Array.isArray(e)?e.join(","):e)}function kS(e){return new ft(xo(e))}Hh.stringify=kS;function xo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Hh.safeStringify=xo;function SS(e){return typeof e=="string"&&Hh.IDENTIFIER.test(e)?new ft(`.${e}`):Uh`[${e}]`}Hh.getProperty=SS;function zS(e){if(typeof e=="string"&&Hh.IDENTIFIER.test(e))return new ft(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Hh.getEsmExportName=zS;function PS(e){return new ft(e.toString())}Hh.regexpCode=PS});var pl=z(function(Gh){Object.defineProperty(Gh,"__esModule",{value:!0});Gh.ValueScope=Gh.ValueScopeName=Gh.Scope=Gh.varKinds=Gh.UsedValueState=void 0;var se=bo();class Jh extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var ni;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(ni||(Gh.UsedValueState=ni={}));Gh.varKinds={const:new se.Name("const"),let:new se.Name("let"),var:new se.Name("var")};class ll{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof se.Name?e:this.name(e)}name(e){return new se.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}Gh.Scope=ll;class dl extends se.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=se._`.${new se.Name(t)}[${r}]`}}Gh.ValueScopeName=dl;var qS=se._`\n`;class Kh extends ll{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?qS:se.nil}}get(){return this._scope}name(e){return new dl(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:o}=n,s=(r=t.key)!==null&&r!==void 0?r:t.ref,i=this._values[o];if(i){let u=i.get(s);if(u)return u}else i=this._values[o]=new Map;i.set(s,n);let a=this._scope[o]||(this._scope[o]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return se._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let o=se.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,ni.Started);let u=t(c);if(u){let l=this.opts.es5?Gh.varKinds.var:Gh.varKinds.const;o=se._`${o}${l} ${c} = ${u};${this.opts._n}`}else if(u=n===null||n===void 0?void 0:n(c))o=se._`${o}${u}${this.opts._n}`;else throw new Jh(c);a.set(c,ni.Completed)})}return o}}Gh.ValueScope=Kh});var B=z(function(Ve){Object.defineProperty(Ve,"__esModule",{value:!0});Ve.or=Ve.and=Ve.not=Ve.CodeGen=Ve.operators=Ve.varKinds=Ve.ValueScopeName=Ve.ValueScope=Ve.Scope=Ve.Name=Ve.regexpCode=Ve.stringify=Ve.getProperty=Ve.nil=Ve.strConcat=Ve.str=Ve._=void 0;var E=bo(),ve=pl(),Qt=bo();Object.defineProperty(Ve,"_",{enumerable:!0,get:function(){return Qt._}});Object.defineProperty(Ve,"str",{enumerable:!0,get:function(){return Qt.str}});Object.defineProperty(Ve,"strConcat",{enumerable:!0,get:function(){return Qt.strConcat}});Object.defineProperty(Ve,"nil",{enumerable:!0,get:function(){return Qt.nil}});Object.defineProperty(Ve,"getProperty",{enumerable:!0,get:function(){return Qt.getProperty}});Object.defineProperty(Ve,"stringify",{enumerable:!0,get:function(){return Qt.stringify}});Object.defineProperty(Ve,"regexpCode",{enumerable:!0,get:function(){return Qt.regexpCode}});Object.defineProperty(Ve,"Name",{enumerable:!0,get:function(){return Qt.Name}});var ui=pl();Object.defineProperty(Ve,"Scope",{enumerable:!0,get:function(){return ui.Scope}});Object.defineProperty(Ve,"ValueScope",{enumerable:!0,get:function(){return ui.ValueScope}});Object.defineProperty(Ve,"ValueScopeName",{enumerable:!0,get:function(){return ui.ValueScopeName}});Object.defineProperty(Ve,"varKinds",{enumerable:!0,get:function(){return ui.varKinds}});Ve.operators={GT:new E._Code(">"),GTE:new E._Code(">="),LT:new E._Code("<"),LTE:new E._Code("<="),EQ:new E._Code("==="),NEQ:new E._Code("!=="),NOT:new E._Code("!"),OR:new E._Code("||"),AND:new E._Code("&&"),ADD:new E._Code("+")};class er{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Xh extends er{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?ve.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=nn(this.rhs,e,t);return this}get names(){return this.rhs instanceof E._CodeOrName?this.rhs.names:{}}}class hl extends er{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof E.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=nn(this.rhs,e,t),this}get names(){let e=this.lhs instanceof E.Name?{}:{...this.lhs.names};return ci(e,this.rhs)}}class Yh extends hl{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Qh extends er{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class eg extends er{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class tg extends er{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class rg extends er{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=nn(this.code,e,t),this}get names(){return this.code instanceof E._CodeOrName?this.code.names:{}}}class li extends er{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let o=r[n];if(o.optimizeNames(e,t))continue;VS(e,o.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Tr(e,t.names),{})}}class tr extends li{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class ng extends li{}class $o extends tr{}$o.kind="else";class qt extends tr{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new $o(r):r}if(t){if(e===!1)return t instanceof qt?t:t.nodes;if(this.nodes.length)return this;return new qt(cg(e),t instanceof qt?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=nn(this.condition,e,t),this}get names(){let e=super.names;if(ci(e,this.condition),this.else)Tr(e,this.else.names);return e}}qt.kind="if";class rn extends tr{}rn.kind="for";class og extends rn{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=nn(this.iteration,e,t),this}get names(){return Tr(super.names,this.iteration.names)}}class sg extends rn{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?ve.varKinds.var:this.varKind,{name:r,from:n,to:o}=this;return`for(${t} ${r}=${n}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){let e=ci(super.names,this.from);return ci(e,this.to)}}class fl extends rn{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=nn(this.iterable,e,t),this}get names(){return Tr(super.names,this.iterable.names)}}class oi extends tr{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}oi.kind="func";class si extends li{render(e){return"return "+super.render(e)}}si.kind="return";class ig extends tr{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Tr(e,this.catch.names);if(this.finally)Tr(e,this.finally.names);return e}}class ii extends tr{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}ii.kind="catch";class ai extends tr{render(e){return"finally"+super.render(e)}}ai.kind="finally";class ag{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
3
|
-
`:""},this._extScope=e,this._scope=new ve.Scope({parent:e}),this._nodes=[new ng]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){let o=this._scope.toName(t);if(r!==void 0&&n)this._constants[o.str]=r;return this._leafNode(new Xh(e,o,r)),o}const(e,t,r){return this._def(ve.varKinds.const,e,t,r)}let(e,t,r){return this._def(ve.varKinds.let,e,t,r)}var(e,t,r){return this._def(ve.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new hl(e,t,r))}add(e,t){return this._leafNode(new Yh(e,Ve.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==E.nil)this._leafNode(new rg(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),E.addCodeArg(t,n)}return t.push("}"),new E._Code(t)}if(e,t,r){if(this._blockNode(new qt(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new qt(e))}else(){return this._elseNode(new $o)}endIf(){return this._endBlockNode(qt,$o)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new og(e),t)}forRange(e,t,r,n,o=this.opts.es5?ve.varKinds.var:ve.varKinds.let){let s=this._scope.toName(e);return this._for(new sg(o,s,t,r),()=>n(s))}forOf(e,t,r,n=ve.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=t instanceof E.Name?t:this.var("_arr",t);return this.forRange("_i",0,E._`${s}.length`,(i)=>{this.var(o,E._`${s}[${i}]`),r(o)})}return this._for(new fl("of",n,o,t),()=>r(o))}forIn(e,t,r,n=this.opts.es5?ve.varKinds.var:ve.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,E._`Object.keys(${t})`,r);let o=this._scope.toName(e);return this._for(new fl("in",n,o,t),()=>r(o))}endFor(){return this._endBlockNode(rn)}label(e){return this._leafNode(new Qh(e))}break(e){return this._leafNode(new eg(e))}return(e){let t=new si;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(si)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new ig;if(this._blockNode(n),this.code(e),t){let o=this.name("e");this._currNode=n.catch=new ii(o),t(o)}if(r)this._currNode=n.finally=new ai,this.code(r);return this._endBlockNode(ii,ai)}throw(e){return this._leafNode(new tg(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=E.nil,r,n){if(this._blockNode(new oi(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(oi)}optimize(e=1){while(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,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof qt))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}Ve.CodeGen=ag;function Tr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function ci(e,t){return t instanceof E._CodeOrName?Tr(e,t.names):e}function nn(e,t,r){if(e instanceof E.Name)return n(e);if(!o(e))return e;return new E._Code(e._items.reduce((s,i)=>{if(i instanceof E.Name)i=n(i);if(i instanceof E._Code)s.push(...i._items);else s.push(i);return s},[]));function n(s){let i=r[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function o(s){return s instanceof E._Code&&s._items.some((i)=>i instanceof E.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function VS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function cg(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:E._`!${ml(e)}`}Ve.not=cg;var HS=ug(Ve.operators.AND);function BS(...e){return e.reduce(HS)}Ve.and=BS;var JS=ug(Ve.operators.OR);function KS(...e){return e.reduce(JS)}Ve.or=KS;function ug(e){return(t,r)=>t===E.nil?r:r===E.nil?t:E._`${ml(t)} ${e} ${ml(r)}`}function ml(e){return e instanceof E.Name?e:E._`(${e})`}});var Q=z(function(vg){Object.defineProperty(vg,"__esModule",{value:!0});vg.checkStrictMode=vg.getErrorPath=vg.Type=vg.useFunc=vg.setEvaluated=vg.evaluatedPropsToName=vg.mergeEvaluated=vg.eachItem=vg.unescapeJsonPointer=vg.escapeJsonPointer=vg.escapeFragment=vg.unescapeFragment=vg.schemaRefOrVal=vg.schemaHasRulesButRef=vg.schemaHasRules=vg.checkUnknownRules=vg.alwaysValidSchema=vg.toHash=void 0;var D=B(),fg=bo();function YS(e){let t={};for(let r of e)t[r]=!0;return t}vg.toHash=YS;function QS(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return mg(e,t),!hg(t,e.self.RULES.all)}vg.alwaysValidSchema=QS;function mg(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let o=n.RULES.keywords;for(let s in t)if(!o[s])yg(e,`unknown keyword: "${s}"`)}vg.checkUnknownRules=mg;function hg(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}vg.schemaHasRules=hg;function ez(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}vg.schemaHasRulesButRef=ez;function tz({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return D._`${r}`}return D._`${e}${t}${D.getProperty(n)}`}vg.schemaRefOrVal=tz;function rz(e){return gg(decodeURIComponent(e))}vg.unescapeFragment=rz;function nz(e){return encodeURIComponent(_l(e))}vg.escapeFragment=nz;function _l(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}vg.escapeJsonPointer=_l;function gg(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}vg.unescapeJsonPointer=gg;function oz(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}vg.eachItem=oz;function dg({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof D.Name?(s instanceof D.Name?e(o,s,i):t(o,s,i),i):s instanceof D.Name?(t(o,i,s),s):r(s,i);return a===D.Name&&!(c instanceof D.Name)?n(o,c):c}}vg.mergeEvaluated={props:dg({mergeNames:(e,t,r)=>e.if(D._`${r} !== true && ${t} !== undefined`,()=>{e.if(D._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,D._`${r} || {}`).code(D._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(D._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,D._`${r} || {}`),yl(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:_g}),items:dg({mergeNames:(e,t,r)=>e.if(D._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,D._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(D._`${r} !== true`,()=>e.assign(r,t===!0?!0:D._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function _g(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",D._`{}`);if(t!==void 0)yl(e,r,t);return r}vg.evaluatedPropsToName=_g;function yl(e,t,r){Object.keys(r).forEach((n)=>e.assign(D._`${t}${D.getProperty(n)}`,!0))}vg.setEvaluated=yl;var pg={};function sz(e,t){return e.scopeValue("func",{ref:t,code:pg[t.code]||(pg[t.code]=new fg._Code(t.code))})}vg.useFunc=sz;var gl;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(gl||(vg.Type=gl={}));function iz(e,t,r){if(e instanceof D.Name){let n=t===gl.Num;return r?n?D._`"[" + ${e} + "]"`:D._`"['" + ${e} + "']"`:n?D._`"/" + ${e}`:D._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?D.getProperty(e).toString():"/"+_l(e)}vg.getErrorPath=iz;function yg(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}vg.checkStrictMode=yg});var Lt=z(function(bg){Object.defineProperty(bg,"__esModule",{value:!0});var re=B(),kz={data:new re.Name("data"),valCxt:new re.Name("valCxt"),instancePath:new re.Name("instancePath"),parentData:new re.Name("parentData"),parentDataProperty:new re.Name("parentDataProperty"),rootData:new re.Name("rootData"),dynamicAnchors:new re.Name("dynamicAnchors"),vErrors:new re.Name("vErrors"),errors:new re.Name("errors"),this:new re.Name("this"),self:new re.Name("self"),scope:new re.Name("scope"),json:new re.Name("json"),jsonPos:new re.Name("jsonPos"),jsonLen:new re.Name("jsonLen"),jsonPart:new re.Name("jsonPart")};bg.default=kz});var wo=z(function(Sg){Object.defineProperty(Sg,"__esModule",{value:!0});Sg.extendErrors=Sg.resetErrorsCount=Sg.reportExtraError=Sg.reportError=Sg.keyword$DataError=Sg.keywordError=void 0;var O=B(),rr=Q(),qe=Lt();Sg.keywordError={message:({keyword:e})=>O.str`must pass "${e}" keyword validation`};Sg.keyword$DataError={message:({keyword:e,schemaType:t})=>t?O.str`"${e}" keyword must be ${t} ($data)`:O.str`"${e}" keyword is invalid ($data)`};function zz(e,t=Sg.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=kg(e,t,r);if(n!==null&&n!==void 0?n:i||a)$g(s,c);else wg(o,O._`[${c}]`)}Sg.reportError=zz;function Pz(e,t=Sg.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=kg(e,t,r);if($g(o,a),!(s||i))wg(n,qe.default.vErrors)}Sg.reportExtraError=Pz;function Ez(e,t){e.assign(qe.default.errors,t),e.if(O._`${qe.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(O._`${qe.default.vErrors}.length`,t),()=>e.assign(qe.default.vErrors,null)))}Sg.resetErrorsCount=Ez;function Tz({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,qe.default.errors,(a)=>{if(e.const(i,O._`${qe.default.vErrors}[${a}]`),e.if(O._`${i}.instancePath === undefined`,()=>e.assign(O._`${i}.instancePath`,O.strConcat(qe.default.instancePath,s.errorPath))),e.assign(O._`${i}.schemaPath`,O.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(O._`${i}.schema`,r),e.assign(O._`${i}.data`,n)})}Sg.extendErrors=Tz;function $g(e,t){let r=e.const("err",t);e.if(O._`${qe.default.vErrors} === null`,()=>e.assign(qe.default.vErrors,O._`[${r}]`),O._`${qe.default.vErrors}.push(${r})`),e.code(O._`${qe.default.errors}++`)}function wg(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;if(o.$async)r.throw(O._`new ${e.ValidationError}(${t})`);else r.assign(O._`${n}.errors`,t),r.return(!1)}var Rr={keyword:new O.Name("keyword"),schemaPath:new O.Name("schemaPath"),params:new O.Name("params"),propertyName:new O.Name("propertyName"),message:new O.Name("message"),schema:new O.Name("schema"),parentSchema:new O.Name("parentSchema")};function kg(e,t,r){let{createErrors:n}=e.it;if(n===!1)return O._`{}`;return Rz(e,t,r)}function Rz(e,t,r={}){let{gen:n,it:o}=e,s=[Oz(o,r),Iz(e,r)];return Az(e,t,s),n.object(...s)}function Oz({errorPath:e},{instancePath:t}){let r=t?O.str`${e}${rr.getErrorPath(t,rr.Type.Str)}`:e;return[qe.default.instancePath,O.strConcat(qe.default.instancePath,r)]}function Iz({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:O.str`${t}/${e}`;if(r)o=O.str`${o}${rr.getErrorPath(r,rr.Type.Str)}`;return[Rr.schemaPath,o]}function Az(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;if(n.push([Rr.keyword,o],[Rr.params,typeof t=="function"?t(e):t||O._`{}`]),c.messages)n.push([Rr.message,typeof r=="function"?r(e):r]);if(c.verbose)n.push([Rr.schema,i],[Rr.parentSchema,O._`${l}${d}`],[qe.default.data,s]);if(u)n.push([Rr.propertyName,u])}});var Ig=z(function(Rg){Object.defineProperty(Rg,"__esModule",{value:!0});Rg.boolOrEmptySchema=Rg.topBoolOrEmptySchema=void 0;var Pg=wo(),Eg=B(),Mz=Lt(),Dz={message:"boolean schema is false"};function qz(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)Tg(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(Mz.default.data);else t.assign(Eg._`${n}.errors`,null),t.return(!0)}Rg.topBoolOrEmptySchema=qz;function Lz(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),Tg(e);else r.var(t,!0)}Rg.boolOrEmptySchema=Lz;function Tg(e,t){let{gen:r,data:n}=e;Pg.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},Dz,void 0,t)}});var xl=z(function(Ag){Object.defineProperty(Ag,"__esModule",{value:!0});Ag.getRules=Ag.isJSONType=void 0;var Uz=["string","number","integer","boolean","null","object","array"],Vz=new Set(Uz);function Hz(e){return typeof e=="string"&&Vz.has(e)}Ag.isJSONType=Hz;function Bz(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Ag.getRules=Bz});var bl=z(function(Zg){Object.defineProperty(Zg,"__esModule",{value:!0});Zg.shouldUseRule=Zg.shouldUseGroup=Zg.schemaHasRulesForType=void 0;function Kz({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Ng(e,n)}Zg.schemaHasRulesForType=Kz;function Ng(e,t){return t.rules.some((r)=>jg(e,r))}Zg.shouldUseGroup=Ng;function jg(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((n)=>e[n]!==void 0))}Zg.shouldUseRule=jg});var ko=z(function(Vg){Object.defineProperty(Vg,"__esModule",{value:!0});Vg.reportTypeError=Vg.checkDataTypes=Vg.checkDataType=Vg.coerceAndCheckDataType=Vg.getJSONTypes=Vg.getSchemaTypes=Vg.DataType=void 0;var Dg=xl(),qg=bl(),Lg=wo(),k=B(),pi=Q(),on;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(on||(Vg.DataType=on={}));function Xz(e){let t=Fg(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}Vg.getSchemaTypes=Xz;function Fg(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Dg.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}Vg.getJSONTypes=Fg;function Yz(e,t){let{gen:r,data:n,opts:o}=e,s=Qz(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&qg.schemaHasRulesForType(e,t[0]));if(i){let a=wl(t,n,o.strictNumbers,on.Wrong);r.if(a,()=>{if(s.length)eP(e,t,s);else kl(e)})}return i}Vg.coerceAndCheckDataType=Yz;var Ug=new Set(["string","number","integer","boolean","null"]);function Qz(e,t){return t?e.filter((r)=>Ug.has(r)||t==="array"&&r==="array"):[]}function eP(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",k._`typeof ${o}`),a=n.let("coerced",k._`undefined`);if(s.coerceTypes==="array")n.if(k._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,k._`${o}[0]`).assign(i,k._`typeof ${o}`).if(wl(t,o,s.strictNumbers),()=>n.assign(a,o)));n.if(k._`${a} !== undefined`);for(let u of r)if(Ug.has(u)||u==="array"&&s.coerceTypes==="array")c(u);n.else(),kl(e),n.endIf(),n.if(k._`${a} !== undefined`,()=>{n.assign(o,a),tP(e,a)});function c(u){switch(u){case"string":n.elseIf(k._`${i} == "number" || ${i} == "boolean"`).assign(a,k._`"" + ${o}`).elseIf(k._`${o} === null`).assign(a,k._`""`);return;case"number":n.elseIf(k._`${i} == "boolean" || ${o} === null
|
|
2
|
+
var bb=Object.create;var{getPrototypeOf:$b,defineProperty:fd,getOwnPropertyNames:wb}=Object;var md=Object.prototype.hasOwnProperty;function kb(e){return this[e]}var Sb,zb,hd=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?Sb??=new WeakMap:zb??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?bb($b(e)):{};let i=t||!e||!e.__esModule||!md.call(e,"default")?fd(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of wb(e))if(!md.call(i,a))fd(i,a,{get:kb.bind(e,a),enumerable:!0})}if(n)o.set(e,i);return i};var z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var bo=z(function(Hh){Object.defineProperty(Hh,"__esModule",{value:!0});Hh.regexpCode=Hh.getEsmExportName=Hh.getProperty=Hh.safeStringify=Hh.stringify=Hh.strConcat=Hh.addCodeArg=Hh.str=Hh._=Hh.nil=Hh._Code=Hh.Name=Hh.IDENTIFIER=Hh._CodeOrName=void 0;class ti{}Hh._CodeOrName=ti;Hh.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class tn extends ti{constructor(e){super();if(!Hh.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Hh.Name=tn;class ft extends ti{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((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof tn)t[r.str]=(t[r.str]||0)+1;return t},{})}}Hh._Code=ft;Hh.nil=new ft("");function Uh(e,...t){let r=[e[0]],n=0;while(n<t.length)ul(r,t[n]),r.push(e[++n]);return new ft(r)}Hh._=Uh;var cl=new ft("+");function Vh(e,...t){let r=[xo(e[0])],n=0;while(n<t.length)r.push(cl),ul(r,t[n]),r.push(cl,xo(e[++n]));return xS(r),new ft(r)}Hh.str=Vh;function ul(e,t){if(t instanceof ft)e.push(...t._items);else if(t instanceof tn)e.push(t);else e.push(wS(t))}Hh.addCodeArg=ul;function xS(e){let t=1;while(t<e.length-1){if(e[t]===cl){let r=bS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function bS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof tn||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof tn))return`"${e}${t.slice(1)}`;return}function $S(e,t){return t.emptyStr()?e:e.emptyStr()?t:Vh`${e}${t}`}Hh.strConcat=$S;function wS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:xo(Array.isArray(e)?e.join(","):e)}function kS(e){return new ft(xo(e))}Hh.stringify=kS;function xo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Hh.safeStringify=xo;function SS(e){return typeof e=="string"&&Hh.IDENTIFIER.test(e)?new ft(`.${e}`):Uh`[${e}]`}Hh.getProperty=SS;function zS(e){if(typeof e=="string"&&Hh.IDENTIFIER.test(e))return new ft(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Hh.getEsmExportName=zS;function PS(e){return new ft(e.toString())}Hh.regexpCode=PS});var fl=z(function(Gh){Object.defineProperty(Gh,"__esModule",{value:!0});Gh.ValueScope=Gh.ValueScopeName=Gh.Scope=Gh.varKinds=Gh.UsedValueState=void 0;var se=bo();class Jh extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var ni;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(ni||(Gh.UsedValueState=ni={}));Gh.varKinds={const:new se.Name("const"),let:new se.Name("let"),var:new se.Name("var")};class dl{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof se.Name?e:this.name(e)}name(e){return new se.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}Gh.Scope=dl;class pl extends se.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=se._`.${new se.Name(t)}[${r}]`}}Gh.ValueScopeName=pl;var qS=se._`\n`;class Kh extends dl{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?qS:se.nil}}get(){return this._scope}name(e){return new pl(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:o}=n,s=(r=t.key)!==null&&r!==void 0?r:t.ref,i=this._values[o];if(i){let u=i.get(s);if(u)return u}else i=this._values[o]=new Map;i.set(s,n);let a=this._scope[o]||(this._scope[o]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return se._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let o=se.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,ni.Started);let u=t(c);if(u){let l=this.opts.es5?Gh.varKinds.var:Gh.varKinds.const;o=se._`${o}${l} ${c} = ${u};${this.opts._n}`}else if(u=n===null||n===void 0?void 0:n(c))o=se._`${o}${u}${this.opts._n}`;else throw new Jh(c);a.set(c,ni.Completed)})}return o}}Gh.ValueScope=Kh});var B=z(function(Ve){Object.defineProperty(Ve,"__esModule",{value:!0});Ve.or=Ve.and=Ve.not=Ve.CodeGen=Ve.operators=Ve.varKinds=Ve.ValueScopeName=Ve.ValueScope=Ve.Scope=Ve.Name=Ve.regexpCode=Ve.stringify=Ve.getProperty=Ve.nil=Ve.strConcat=Ve.str=Ve._=void 0;var E=bo(),ve=fl(),Qt=bo();Object.defineProperty(Ve,"_",{enumerable:!0,get:function(){return Qt._}});Object.defineProperty(Ve,"str",{enumerable:!0,get:function(){return Qt.str}});Object.defineProperty(Ve,"strConcat",{enumerable:!0,get:function(){return Qt.strConcat}});Object.defineProperty(Ve,"nil",{enumerable:!0,get:function(){return Qt.nil}});Object.defineProperty(Ve,"getProperty",{enumerable:!0,get:function(){return Qt.getProperty}});Object.defineProperty(Ve,"stringify",{enumerable:!0,get:function(){return Qt.stringify}});Object.defineProperty(Ve,"regexpCode",{enumerable:!0,get:function(){return Qt.regexpCode}});Object.defineProperty(Ve,"Name",{enumerable:!0,get:function(){return Qt.Name}});var ui=fl();Object.defineProperty(Ve,"Scope",{enumerable:!0,get:function(){return ui.Scope}});Object.defineProperty(Ve,"ValueScope",{enumerable:!0,get:function(){return ui.ValueScope}});Object.defineProperty(Ve,"ValueScopeName",{enumerable:!0,get:function(){return ui.ValueScopeName}});Object.defineProperty(Ve,"varKinds",{enumerable:!0,get:function(){return ui.varKinds}});Ve.operators={GT:new E._Code(">"),GTE:new E._Code(">="),LT:new E._Code("<"),LTE:new E._Code("<="),EQ:new E._Code("==="),NEQ:new E._Code("!=="),NOT:new E._Code("!"),OR:new E._Code("||"),AND:new E._Code("&&"),ADD:new E._Code("+")};class er{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Xh extends er{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?ve.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=nn(this.rhs,e,t);return this}get names(){return this.rhs instanceof E._CodeOrName?this.rhs.names:{}}}class gl extends er{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof E.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=nn(this.rhs,e,t),this}get names(){let e=this.lhs instanceof E.Name?{}:{...this.lhs.names};return ci(e,this.rhs)}}class Yh extends gl{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Qh extends er{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class eg extends er{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class tg extends er{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class rg extends er{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=nn(this.code,e,t),this}get names(){return this.code instanceof E._CodeOrName?this.code.names:{}}}class li extends er{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let o=r[n];if(o.optimizeNames(e,t))continue;VS(e,o.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Tr(e,t.names),{})}}class tr extends li{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class ng extends li{}class $o extends tr{}$o.kind="else";class qt extends tr{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new $o(r):r}if(t){if(e===!1)return t instanceof qt?t:t.nodes;if(this.nodes.length)return this;return new qt(cg(e),t instanceof qt?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=nn(this.condition,e,t),this}get names(){let e=super.names;if(ci(e,this.condition),this.else)Tr(e,this.else.names);return e}}qt.kind="if";class rn extends tr{}rn.kind="for";class og extends rn{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=nn(this.iteration,e,t),this}get names(){return Tr(super.names,this.iteration.names)}}class sg extends rn{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?ve.varKinds.var:this.varKind,{name:r,from:n,to:o}=this;return`for(${t} ${r}=${n}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){let e=ci(super.names,this.from);return ci(e,this.to)}}class ml extends rn{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=nn(this.iterable,e,t),this}get names(){return Tr(super.names,this.iterable.names)}}class oi extends tr{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}oi.kind="func";class si extends li{render(e){return"return "+super.render(e)}}si.kind="return";class ig extends tr{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Tr(e,this.catch.names);if(this.finally)Tr(e,this.finally.names);return e}}class ii extends tr{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}ii.kind="catch";class ai extends tr{render(e){return"finally"+super.render(e)}}ai.kind="finally";class ag{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new ve.Scope({parent:e}),this._nodes=[new ng]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){let o=this._scope.toName(t);if(r!==void 0&&n)this._constants[o.str]=r;return this._leafNode(new Xh(e,o,r)),o}const(e,t,r){return this._def(ve.varKinds.const,e,t,r)}let(e,t,r){return this._def(ve.varKinds.let,e,t,r)}var(e,t,r){return this._def(ve.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new gl(e,t,r))}add(e,t){return this._leafNode(new Yh(e,Ve.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==E.nil)this._leafNode(new rg(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),E.addCodeArg(t,n)}return t.push("}"),new E._Code(t)}if(e,t,r){if(this._blockNode(new qt(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new qt(e))}else(){return this._elseNode(new $o)}endIf(){return this._endBlockNode(qt,$o)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new og(e),t)}forRange(e,t,r,n,o=this.opts.es5?ve.varKinds.var:ve.varKinds.let){let s=this._scope.toName(e);return this._for(new sg(o,s,t,r),()=>n(s))}forOf(e,t,r,n=ve.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=t instanceof E.Name?t:this.var("_arr",t);return this.forRange("_i",0,E._`${s}.length`,(i)=>{this.var(o,E._`${s}[${i}]`),r(o)})}return this._for(new ml("of",n,o,t),()=>r(o))}forIn(e,t,r,n=this.opts.es5?ve.varKinds.var:ve.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,E._`Object.keys(${t})`,r);let o=this._scope.toName(e);return this._for(new ml("in",n,o,t),()=>r(o))}endFor(){return this._endBlockNode(rn)}label(e){return this._leafNode(new Qh(e))}break(e){return this._leafNode(new eg(e))}return(e){let t=new si;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(si)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new ig;if(this._blockNode(n),this.code(e),t){let o=this.name("e");this._currNode=n.catch=new ii(o),t(o)}if(r)this._currNode=n.finally=new ai,this.code(r);return this._endBlockNode(ii,ai)}throw(e){return this._leafNode(new tg(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=E.nil,r,n){if(this._blockNode(new oi(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(oi)}optimize(e=1){while(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,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof qt))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}Ve.CodeGen=ag;function Tr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function ci(e,t){return t instanceof E._CodeOrName?Tr(e,t.names):e}function nn(e,t,r){if(e instanceof E.Name)return n(e);if(!o(e))return e;return new E._Code(e._items.reduce((s,i)=>{if(i instanceof E.Name)i=n(i);if(i instanceof E._Code)s.push(...i._items);else s.push(i);return s},[]));function n(s){let i=r[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function o(s){return s instanceof E._Code&&s._items.some((i)=>i instanceof E.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function VS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function cg(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:E._`!${hl(e)}`}Ve.not=cg;var HS=ug(Ve.operators.AND);function BS(...e){return e.reduce(HS)}Ve.and=BS;var JS=ug(Ve.operators.OR);function KS(...e){return e.reduce(JS)}Ve.or=KS;function ug(e){return(t,r)=>t===E.nil?r:r===E.nil?t:E._`${hl(t)} ${e} ${hl(r)}`}function hl(e){return e instanceof E.Name?e:E._`(${e})`}});var Q=z(function(vg){Object.defineProperty(vg,"__esModule",{value:!0});vg.checkStrictMode=vg.getErrorPath=vg.Type=vg.useFunc=vg.setEvaluated=vg.evaluatedPropsToName=vg.mergeEvaluated=vg.eachItem=vg.unescapeJsonPointer=vg.escapeJsonPointer=vg.escapeFragment=vg.unescapeFragment=vg.schemaRefOrVal=vg.schemaHasRulesButRef=vg.schemaHasRules=vg.checkUnknownRules=vg.alwaysValidSchema=vg.toHash=void 0;var D=B(),fg=bo();function YS(e){let t={};for(let r of e)t[r]=!0;return t}vg.toHash=YS;function QS(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return mg(e,t),!hg(t,e.self.RULES.all)}vg.alwaysValidSchema=QS;function mg(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let o=n.RULES.keywords;for(let s in t)if(!o[s])yg(e,`unknown keyword: "${s}"`)}vg.checkUnknownRules=mg;function hg(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}vg.schemaHasRules=hg;function ez(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}vg.schemaHasRulesButRef=ez;function tz({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return D._`${r}`}return D._`${e}${t}${D.getProperty(n)}`}vg.schemaRefOrVal=tz;function rz(e){return gg(decodeURIComponent(e))}vg.unescapeFragment=rz;function nz(e){return encodeURIComponent(yl(e))}vg.escapeFragment=nz;function yl(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}vg.escapeJsonPointer=yl;function gg(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}vg.unescapeJsonPointer=gg;function oz(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}vg.eachItem=oz;function dg({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof D.Name?(s instanceof D.Name?e(o,s,i):t(o,s,i),i):s instanceof D.Name?(t(o,i,s),s):r(s,i);return a===D.Name&&!(c instanceof D.Name)?n(o,c):c}}vg.mergeEvaluated={props:dg({mergeNames:(e,t,r)=>e.if(D._`${r} !== true && ${t} !== undefined`,()=>{e.if(D._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,D._`${r} || {}`).code(D._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(D._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,D._`${r} || {}`),vl(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:_g}),items:dg({mergeNames:(e,t,r)=>e.if(D._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,D._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(D._`${r} !== true`,()=>e.assign(r,t===!0?!0:D._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function _g(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",D._`{}`);if(t!==void 0)vl(e,r,t);return r}vg.evaluatedPropsToName=_g;function vl(e,t,r){Object.keys(r).forEach((n)=>e.assign(D._`${t}${D.getProperty(n)}`,!0))}vg.setEvaluated=vl;var pg={};function sz(e,t){return e.scopeValue("func",{ref:t,code:pg[t.code]||(pg[t.code]=new fg._Code(t.code))})}vg.useFunc=sz;var _l;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(_l||(vg.Type=_l={}));function iz(e,t,r){if(e instanceof D.Name){let n=t===_l.Num;return r?n?D._`"[" + ${e} + "]"`:D._`"['" + ${e} + "']"`:n?D._`"/" + ${e}`:D._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?D.getProperty(e).toString():"/"+yl(e)}vg.getErrorPath=iz;function yg(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}vg.checkStrictMode=yg});var Lt=z(function(bg){Object.defineProperty(bg,"__esModule",{value:!0});var re=B(),kz={data:new re.Name("data"),valCxt:new re.Name("valCxt"),instancePath:new re.Name("instancePath"),parentData:new re.Name("parentData"),parentDataProperty:new re.Name("parentDataProperty"),rootData:new re.Name("rootData"),dynamicAnchors:new re.Name("dynamicAnchors"),vErrors:new re.Name("vErrors"),errors:new re.Name("errors"),this:new re.Name("this"),self:new re.Name("self"),scope:new re.Name("scope"),json:new re.Name("json"),jsonPos:new re.Name("jsonPos"),jsonLen:new re.Name("jsonLen"),jsonPart:new re.Name("jsonPart")};bg.default=kz});var wo=z(function(Sg){Object.defineProperty(Sg,"__esModule",{value:!0});Sg.extendErrors=Sg.resetErrorsCount=Sg.reportExtraError=Sg.reportError=Sg.keyword$DataError=Sg.keywordError=void 0;var O=B(),rr=Q(),qe=Lt();Sg.keywordError={message:({keyword:e})=>O.str`must pass "${e}" keyword validation`};Sg.keyword$DataError={message:({keyword:e,schemaType:t})=>t?O.str`"${e}" keyword must be ${t} ($data)`:O.str`"${e}" keyword is invalid ($data)`};function zz(e,t=Sg.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=kg(e,t,r);if(n!==null&&n!==void 0?n:i||a)$g(s,c);else wg(o,O._`[${c}]`)}Sg.reportError=zz;function Pz(e,t=Sg.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=kg(e,t,r);if($g(o,a),!(s||i))wg(n,qe.default.vErrors)}Sg.reportExtraError=Pz;function Ez(e,t){e.assign(qe.default.errors,t),e.if(O._`${qe.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(O._`${qe.default.vErrors}.length`,t),()=>e.assign(qe.default.vErrors,null)))}Sg.resetErrorsCount=Ez;function Tz({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,qe.default.errors,(a)=>{if(e.const(i,O._`${qe.default.vErrors}[${a}]`),e.if(O._`${i}.instancePath === undefined`,()=>e.assign(O._`${i}.instancePath`,O.strConcat(qe.default.instancePath,s.errorPath))),e.assign(O._`${i}.schemaPath`,O.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(O._`${i}.schema`,r),e.assign(O._`${i}.data`,n)})}Sg.extendErrors=Tz;function $g(e,t){let r=e.const("err",t);e.if(O._`${qe.default.vErrors} === null`,()=>e.assign(qe.default.vErrors,O._`[${r}]`),O._`${qe.default.vErrors}.push(${r})`),e.code(O._`${qe.default.errors}++`)}function wg(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;if(o.$async)r.throw(O._`new ${e.ValidationError}(${t})`);else r.assign(O._`${n}.errors`,t),r.return(!1)}var Rr={keyword:new O.Name("keyword"),schemaPath:new O.Name("schemaPath"),params:new O.Name("params"),propertyName:new O.Name("propertyName"),message:new O.Name("message"),schema:new O.Name("schema"),parentSchema:new O.Name("parentSchema")};function kg(e,t,r){let{createErrors:n}=e.it;if(n===!1)return O._`{}`;return Rz(e,t,r)}function Rz(e,t,r={}){let{gen:n,it:o}=e,s=[Oz(o,r),Iz(e,r)];return Az(e,t,s),n.object(...s)}function Oz({errorPath:e},{instancePath:t}){let r=t?O.str`${e}${rr.getErrorPath(t,rr.Type.Str)}`:e;return[qe.default.instancePath,O.strConcat(qe.default.instancePath,r)]}function Iz({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:O.str`${t}/${e}`;if(r)o=O.str`${o}${rr.getErrorPath(r,rr.Type.Str)}`;return[Rr.schemaPath,o]}function Az(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;if(n.push([Rr.keyword,o],[Rr.params,typeof t=="function"?t(e):t||O._`{}`]),c.messages)n.push([Rr.message,typeof r=="function"?r(e):r]);if(c.verbose)n.push([Rr.schema,i],[Rr.parentSchema,O._`${l}${d}`],[qe.default.data,s]);if(u)n.push([Rr.propertyName,u])}});var Ig=z(function(Rg){Object.defineProperty(Rg,"__esModule",{value:!0});Rg.boolOrEmptySchema=Rg.topBoolOrEmptySchema=void 0;var Pg=wo(),Eg=B(),Mz=Lt(),Dz={message:"boolean schema is false"};function qz(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)Tg(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(Mz.default.data);else t.assign(Eg._`${n}.errors`,null),t.return(!0)}Rg.topBoolOrEmptySchema=qz;function Lz(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),Tg(e);else r.var(t,!0)}Rg.boolOrEmptySchema=Lz;function Tg(e,t){let{gen:r,data:n}=e;Pg.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},Dz,void 0,t)}});var bl=z(function(Ag){Object.defineProperty(Ag,"__esModule",{value:!0});Ag.getRules=Ag.isJSONType=void 0;var Uz=["string","number","integer","boolean","null","object","array"],Vz=new Set(Uz);function Hz(e){return typeof e=="string"&&Vz.has(e)}Ag.isJSONType=Hz;function Bz(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Ag.getRules=Bz});var $l=z(function(Zg){Object.defineProperty(Zg,"__esModule",{value:!0});Zg.shouldUseRule=Zg.shouldUseGroup=Zg.schemaHasRulesForType=void 0;function Kz({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Ng(e,n)}Zg.schemaHasRulesForType=Kz;function Ng(e,t){return t.rules.some((r)=>jg(e,r))}Zg.shouldUseGroup=Ng;function jg(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((n)=>e[n]!==void 0))}Zg.shouldUseRule=jg});var ko=z(function(Vg){Object.defineProperty(Vg,"__esModule",{value:!0});Vg.reportTypeError=Vg.checkDataTypes=Vg.checkDataType=Vg.coerceAndCheckDataType=Vg.getJSONTypes=Vg.getSchemaTypes=Vg.DataType=void 0;var Dg=bl(),qg=$l(),Lg=wo(),k=B(),pi=Q(),on;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(on||(Vg.DataType=on={}));function Xz(e){let t=Fg(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}Vg.getSchemaTypes=Xz;function Fg(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Dg.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}Vg.getJSONTypes=Fg;function Yz(e,t){let{gen:r,data:n,opts:o}=e,s=Qz(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&qg.schemaHasRulesForType(e,t[0]));if(i){let a=kl(t,n,o.strictNumbers,on.Wrong);r.if(a,()=>{if(s.length)eP(e,t,s);else Sl(e)})}return i}Vg.coerceAndCheckDataType=Yz;var Ug=new Set(["string","number","integer","boolean","null"]);function Qz(e,t){return t?e.filter((r)=>Ug.has(r)||t==="array"&&r==="array"):[]}function eP(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",k._`typeof ${o}`),a=n.let("coerced",k._`undefined`);if(s.coerceTypes==="array")n.if(k._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,k._`${o}[0]`).assign(i,k._`typeof ${o}`).if(kl(t,o,s.strictNumbers),()=>n.assign(a,o)));n.if(k._`${a} !== undefined`);for(let u of r)if(Ug.has(u)||u==="array"&&s.coerceTypes==="array")c(u);n.else(),Sl(e),n.endIf(),n.if(k._`${a} !== undefined`,()=>{n.assign(o,a),tP(e,a)});function c(u){switch(u){case"string":n.elseIf(k._`${i} == "number" || ${i} == "boolean"`).assign(a,k._`"" + ${o}`).elseIf(k._`${o} === null`).assign(a,k._`""`);return;case"number":n.elseIf(k._`${i} == "boolean" || ${o} === null
|
|
4
4
|
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,k._`+${o}`);return;case"integer":n.elseIf(k._`${i} === "boolean" || ${o} === null
|
|
5
5
|
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,k._`+${o}`);return;case"boolean":n.elseIf(k._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf(k._`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf(k._`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf(k._`${i} === "string" || ${i} === "number"
|
|
6
|
-
|| ${i} === "boolean" || ${o} === null`).assign(a,k._`[${o}]`)}}}function tP({gen:e,parentData:t,parentDataProperty:r},n){e.if(k._`${t} !== undefined`,()=>e.assign(k._`${t}[${r}]`,n))}function $l(e,t,r,n=on.Correct){let o=n===on.Correct?k.operators.EQ:k.operators.NEQ,s;switch(e){case"null":return k._`${t} ${o} null`;case"array":s=k._`Array.isArray(${t})`;break;case"object":s=k._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(k._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return k._`typeof ${t} ${o} ${e}`}return n===on.Correct?s:k.not(s);function i(a=k.nil){return k.and(k._`typeof ${t} == "number"`,a,r?k._`isFinite(${t})`:k.nil)}}Vg.checkDataType=$l;function wl(e,t,r,n){if(e.length===1)return $l(e[0],t,r,n);let o,s=pi.toHash(e);if(s.array&&s.object){let i=k._`typeof ${t} != "object"`;o=s.null?i:k._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=k.nil;if(s.number)delete s.integer;for(let i in s)o=k.and(o,$l(i,t,r,n));return o}Vg.checkDataTypes=wl;var rP={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?k._`{type: ${e}}`:k._`{type: ${t}}`};function kl(e){let t=nP(e);Lg.reportError(t,rP)}Vg.reportTypeError=kl;function nP(e){let{gen:t,data:r,schema:n}=e,o=pi.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Wg=z(function(Kg){Object.defineProperty(Kg,"__esModule",{value:!0});Kg.assignDefaults=void 0;var ot=B(),Jg=Q();function lP(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Bg(e,o,r[o].default);else if(t==="array"&&Array.isArray(n))n.forEach((o,s)=>Bg(e,s,o.default))}Kg.assignDefaults=lP;function Bg(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=ot._`${s}${ot.getProperty(t)}`;if(o){Jg.checkStrictMode(e,`default is ignored for: ${a}`);return}let c=ot._`${a} === undefined`;if(i.useDefaults==="empty")c=ot._`${c} || ${a} === null || ${a} === ""`;n.if(c,ot._`${a} = ${ot.stringify(r)}`)}});var st=z(function(e_){Object.defineProperty(e_,"__esModule",{value:!0});e_.validateUnion=e_.validateArray=e_.usePattern=e_.callValidateCode=e_.schemaProperties=e_.allSchemaProperties=e_.noPropertyInData=e_.propertyInData=e_.isOwnProperty=e_.hasPropFunc=e_.reportMissingProp=e_.checkMissingProp=e_.checkReportMissingProp=void 0;var q=B(),sn=Q(),nr=Lt(),Xg=Q();function dP(e,t){let{gen:r,data:n,it:o}=e;r.if(zl(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:q._`${t}`},!0),e.error()})}e_.checkReportMissingProp=dP;function pP({gen:e,data:t,it:{opts:r}},n,o){return q.or(...n.map((s)=>q.and(zl(e,t,s,r.ownProperties),q._`${o} = ${s}`)))}e_.checkMissingProp=pP;function fP(e,t){e.setParams({missingProperty:t},!0),e.error()}e_.reportMissingProp=fP;function Yg(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:q._`Object.prototype.hasOwnProperty`})}e_.hasPropFunc=Yg;function Sl(e,t,r){return q._`${Yg(e)}.call(${t}, ${r})`}e_.isOwnProperty=Sl;function mP(e,t,r,n){let o=q._`${t}${q.getProperty(r)} !== undefined`;return n?q._`${o} && ${Sl(e,t,r)}`:o}e_.propertyInData=mP;function zl(e,t,r,n){let o=q._`${t}${q.getProperty(r)} === undefined`;return n?q.or(o,q.not(Sl(e,t,r))):o}e_.noPropertyInData=zl;function Qg(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}e_.allSchemaProperties=Qg;function hP(e,t){return Qg(t).filter((r)=>!sn.alwaysValidSchema(e,t[r]))}e_.schemaProperties=hP;function gP({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?q._`${e}, ${t}, ${n}${o}`:t,d=[[nr.default.instancePath,q.strConcat(nr.default.instancePath,s)],[nr.default.parentData,i.parentData],[nr.default.parentDataProperty,i.parentDataProperty],[nr.default.rootData,nr.default.rootData]];if(i.opts.dynamicRef)d.push([nr.default.dynamicAnchors,nr.default.dynamicAnchors]);let m=q._`${l}, ${r.object(...d)}`;return c!==q.nil?q._`${a}.call(${c}, ${m})`:q._`${a}(${m})`}e_.callValidateCode=gP;var _P=q._`new RegExp`;function yP({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:q._`${o.code==="new RegExp"?_P:Xg.useFunc(e,o)}(${r}, ${n})`})}e_.usePattern=yP;function vP(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",q._`${r}.length`);t.forRange("i",0,c,(u)=>{e.subschema({keyword:n,dataProp:u,dataPropType:sn.Type.Num},s),t.if(q.not(s),a)})}}e_.validateArray=vP;function xP(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>sn.alwaysValidSchema(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);if(t.assign(i,q._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(q.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}e_.validateUnion=xP});var c_=z(function(i_){Object.defineProperty(i_,"__esModule",{value:!0});i_.validateKeywordUsage=i_.validSchemaType=i_.funcKeywordCode=i_.macroKeywordCode=void 0;var oe=B(),Or=Lt(),n_=st(),o_=wo();function AP(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=s_(r,n,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:oe.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}i_.macroKeywordCode=AP;function CP(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;jP(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=s_(n,o,u),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1){if(h(),t.modifying)r_(e);g(()=>e.error())}else{let v=t.async?p():f();if(t.modifying)r_(e);g(()=>NP(e,v))}}function p(){let v=n.let("ruleErrs",null);return n.try(()=>h(oe._`await `),(T)=>n.assign(d,!1).if(oe._`${T} instanceof ${c.ValidationError}`,()=>n.assign(v,oe._`${T}.errors`),()=>n.throw(T))),v}function f(){let v=oe._`${l}.errors`;return n.assign(v,null),h(oe.nil),v}function h(v=t.async?oe._`await `:oe.nil){let T=c.opts.passContext?Or.default.this:Or.default.self,M=!(("compile"in t)&&!a||t.schema===!1);n.assign(d,oe._`${v}${n_.callValidateCode(e,l,T,M)}`,t.modifying)}function g(v){var T;n.if(oe.not((T=t.valid)!==null&&T!==void 0?T:d),v)}}i_.funcKeywordCode=CP;function r_(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,oe._`${n.parentData}[${n.parentDataProperty}]`))}function NP(e,t){let{gen:r}=e;r.if(oe._`Array.isArray(${t})`,()=>{r.assign(Or.default.vErrors,oe._`${Or.default.vErrors} === null ? ${t} : ${Or.default.vErrors}.concat(${t})`).assign(Or.default.errors,oe._`${Or.default.vErrors}.length`),o_.extendErrors(e)},()=>e.error())}function jP({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function s_(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:oe.stringify(r)})}function ZP(e,t,r=!1){return!t.length||t.some((n)=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}i_.validSchemaType=ZP;function MP({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw Error("ajv implementation error");let i=o.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw Error(c)}}}i_.validateKeywordUsage=MP});var d_=z(function(u_){Object.defineProperty(u_,"__esModule",{value:!0});u_.extendSubschemaMode=u_.extendSubschemaData=u_.getSubschema=void 0;var Se=B(),fi=Q();function FP(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:Se._`${e.schemaPath}${Se.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Se._`${e.schemaPath}${Se.getProperty(t)}${Se.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${fi.escapeFragment(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}u_.getSubschema=FP;function UP(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,m=a.let("data",Se._`${t.data}${Se.getProperty(r)}`,!0);c(m),e.errorPath=Se.str`${u}${fi.getErrorPath(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=Se._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof Se.Name?o:a.let("data",o,!0);if(c(u),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}u_.extendSubschemaData=UP;function VP(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){if(n!==void 0)e.compositeRule=n;if(o!==void 0)e.createErrors=o;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=r}u_.extendSubschemaMode=VP});var Pl=z(function(GM,p_){p_.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var m_=z(function(WM,f_){var or=f_.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};mi(t,n,o,e,"",e)};or.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};or.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};or.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};or.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 mi(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in or.arrayKeywords)for(var m=0;m<d.length;m++)mi(e,t,r,d[m],o+"/"+l+"/"+m,s,o,l,n,m)}else if(l in or.propsKeywords){if(d&&typeof d=="object")for(var p in d)mi(e,t,r,d[p],o+"/"+l+"/"+JP(p),s,o,l,n,p)}else if(l in or.keywords||e.allKeys&&!(l in or.skipKeywords))mi(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function JP(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var So=z(function(v_){Object.defineProperty(v_,"__esModule",{value:!0});v_.getSchemaRefs=v_.resolveUrl=v_.normalizeId=v_._getFullPath=v_.getFullPath=v_.inlineRef=void 0;var h_=Q(),KP=Pl(),GP=m_(),WP=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function XP(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!El(e);if(!t)return!1;return g_(e)<=t}v_.inlineRef=XP;var YP=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function El(e){for(let t in e){if(YP.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(El))return!0;if(typeof r=="object"&&El(r))return!0}return!1}function g_(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,WP.has(r))continue;if(typeof e[r]=="object")h_.eachItem(e[r],(n)=>t+=g_(n));if(t===1/0)return 1/0}return t}function __(e,t="",r){if(r!==!1)t=an(t);let n=e.parse(t);return y_(e,n)}v_.getFullPath=__;function y_(e,t){return e.serialize(t).split("#")[0]+"#"}v_._getFullPath=y_;var QP=/#\/?$/;function an(e){return e?e.replace(QP,""):""}v_.normalizeId=an;function eE(e,t,r){return r=an(r),e.resolve(t,r)}v_.resolveUrl=eE;var tE=/^[a-z_][-a-z0-9._]*$/i;function rE(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=an(e[r]||t),s={"":o},i=__(n,o,!1),a={},c=new Set;return GP(e,{allKeys:!0},(d,m,p,f)=>{if(f===void 0)return;let h=i+m,g=s[f];if(typeof d[r]=="string")g=v.call(this,d[r]);T.call(this,d.$anchor),T.call(this,d.$dynamicAnchor),s[m]=g;function v(M){let Y=this.opts.uriResolver.resolve;if(M=an(g?Y(g,M):M),c.has(M))throw l(M);c.add(M);let C=this.refs[M];if(typeof C=="string")C=this.refs[C];if(typeof C=="object")u(d,C.schema,M);else if(M!==an(h))if(M[0]==="#")u(d,a[M],M),a[M]=d;else this.refs[M]=h;return M}function T(M){if(typeof M=="string"){if(!tE.test(M))throw Error(`invalid anchor "${M}"`);v.call(this,`#${M}`)}}}),a;function u(d,m,p){if(m!==void 0&&!KP(d,m))throw l(p)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}v_.getSchemaRefs=rE});var zo=z(function(N_){Object.defineProperty(N_,"__esModule",{value:!0});N_.getData=N_.KeywordCxt=N_.validateFunctionCode=void 0;var gi=Ig(),hi=ko(),un=bl(),sr=ko(),k_=Wg(),$t=c_(),cn=d_(),x=B(),U=Lt(),S_=So(),Re=Q(),bt=wo();function cE(e){if(E_(e)){if(T_(e),P_(e)){dE(e);return}}z_(e,()=>gi.topBoolOrEmptySchema(e))}N_.validateFunctionCode=cE;function z_({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){if(o.code.es5)e.func(t,x._`${U.default.data}, ${U.default.valCxt}`,n.$async,()=>{e.code(x._`"use strict"; ${b_(r,o)}`),lE(e,o),e.code(s)});else e.func(t,x._`${U.default.data}, ${uE(o)}`,n.$async,()=>e.code(b_(r,o)).code(s))}function uE(e){return x._`{${U.default.instancePath}="", ${U.default.parentData}, ${U.default.parentDataProperty}, ${U.default.rootData}=${U.default.data}${e.dynamicRef?x._`, ${U.default.dynamicAnchors}={}`:x.nil}}={}`}function lE(e,t){e.if(U.default.valCxt,()=>{if(e.var(U.default.instancePath,x._`${U.default.valCxt}.${U.default.instancePath}`),e.var(U.default.parentData,x._`${U.default.valCxt}.${U.default.parentData}`),e.var(U.default.parentDataProperty,x._`${U.default.valCxt}.${U.default.parentDataProperty}`),e.var(U.default.rootData,x._`${U.default.valCxt}.${U.default.rootData}`),t.dynamicRef)e.var(U.default.dynamicAnchors,x._`${U.default.valCxt}.${U.default.dynamicAnchors}`)},()=>{if(e.var(U.default.instancePath,x._`""`),e.var(U.default.parentData,x._`undefined`),e.var(U.default.parentDataProperty,x._`undefined`),e.var(U.default.rootData,U.default.data),t.dynamicRef)e.var(U.default.dynamicAnchors,x._`{}`)})}function dE(e){let{schema:t,opts:r,gen:n}=e;z_(e,()=>{if(r.$comment&&t.$comment)O_(e);if(gE(e),n.let(U.default.vErrors,null),n.let(U.default.errors,0),r.unevaluated)pE(e);R_(e),vE(e)});return}function pE(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",x._`${r}.evaluated`),t.if(x._`${e.evaluated}.dynamicProps`,()=>t.assign(x._`${e.evaluated}.props`,x._`undefined`)),t.if(x._`${e.evaluated}.dynamicItems`,()=>t.assign(x._`${e.evaluated}.items`,x._`undefined`))}function b_(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?x._`/*# sourceURL=${r} */`:x.nil}function fE(e,t){if(E_(e)){if(T_(e),P_(e)){mE(e,t);return}}gi.boolOrEmptySchema(e,t)}function P_({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function E_(e){return typeof e.schema!="boolean"}function mE(e,t){let{schema:r,gen:n,opts:o}=e;if(o.$comment&&r.$comment)O_(e);_E(e),yE(e);let s=n.const("_errs",U.default.errors);R_(e,s),n.var(t,x._`${s} === ${U.default.errors}`)}function T_(e){Re.checkUnknownRules(e),hE(e)}function R_(e,t){if(e.opts.jtd)return $_(e,[],!1,t);let r=hi.getSchemaTypes(e.schema),n=hi.coerceAndCheckDataType(e,r);$_(e,r,!n,t)}function hE(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&Re.schemaHasRulesButRef(t,o.RULES))o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function gE(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)Re.checkStrictMode(e,"default is ignored in the schema root")}function _E(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=S_.resolveUrl(e.opts.uriResolver,e.baseId,t)}function yE(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function O_({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code(x._`${U.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=x.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(x._`${U.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function vE(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;if(r.$async)t.if(x._`${U.default.errors} === 0`,()=>t.return(U.default.data),()=>t.throw(x._`new ${o}(${U.default.vErrors})`));else{if(t.assign(x._`${n}.errors`,U.default.vErrors),s.unevaluated)xE(e);t.return(x._`${U.default.errors} === 0`)}}function xE({gen:e,evaluated:t,props:r,items:n}){if(r instanceof x.Name)e.assign(x._`${t}.props`,r);if(n instanceof x.Name)e.assign(x._`${t}.items`,n)}function $_(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!Re.schemaHasRulesButRef(s,l))){o.block(()=>A_(e,"$ref",l.all.$ref.definition));return}if(!c.jtd)bE(e,t);o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){if(!un.shouldUseGroup(s,m))return;if(m.type){if(o.if(sr.checkDataType(m.type,i,c.strictNumbers)),w_(e,m),t.length===1&&t[0]===m.type&&r)o.else(),sr.reportTypeError(e);o.endIf()}else w_(e,m);if(!a)o.if(x._`${U.default.errors} === ${n||0}`)}}function w_(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;if(o)k_.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(un.shouldUseRule(n,s))A_(e,s.keyword,s.definition,t.type)})}function bE(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if($E(e,t),!e.opts.allowUnionTypes)wE(e,t);kE(e,e.dataTypes)}function $E(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!I_(e.dataTypes,r))Tl(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),zE(e,t)}function wE(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Tl(e,"use allowUnionTypes to allow union type keyword")}function kE(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&un.shouldUseRule(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>SE(t,i)))Tl(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function SE(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function I_(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function zE(e,t){let r=[];for(let n of e.dataTypes)if(I_(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Tl(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,Re.checkStrictMode(e,t,e.opts.strictTypes)}class Rl{constructor(e,t,r){if($t.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=Re.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",C_(this.$data,e));else if(this.schemaCode=this.schemaValue,!$t.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",U.default.errors)}result(e,t,r){this.failResult(x.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(x.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(x._`${t} !== undefined && (${x.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?bt.reportExtraError:bt.reportError)(this,this.def.error,t)}$dataError(){bt.reportError(this,this.def.$dataError||bt.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');bt.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=x.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=x.nil,t=x.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:o,def:s}=this;if(r.if(x.or(x._`${n} === undefined`,t)),e!==x.nil)r.assign(e,!0);if(o.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==x.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return x.or(s(),i());function s(){if(r.length){if(!(t instanceof x.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return x._`${sr.checkDataTypes(a,t,o.opts.strictNumbers,sr.DataType.Wrong)}`}return x.nil}function i(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return x._`!${a}(${t})`}return x.nil}}subschema(e,t){let r=cn.getSubschema(this.it,e);cn.extendSubschemaData(r,this.it,e),cn.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return fE(n,t),n}mergeEvaluated(e,t){let{it:r,gen:n}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=Re.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Re.mergeEvaluated.items(n,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:n}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return n.if(t,()=>this.mergeEvaluated(e,x.Name)),!0}}N_.KeywordCxt=Rl;function A_(e,t,r,n){let o=new Rl(e,r,t);if("code"in r)r.code(o,n);else if(o.$data&&r.validate)$t.funcKeywordCode(o,r);else if("macro"in r)$t.macroKeywordCode(o,r);else if(r.compile||r.validate)$t.funcKeywordCode(o,r)}var PE=/^\/(?:[^~]|~0|~1)*$/,EE=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function C_(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return U.default.rootData;if(e[0]==="/"){if(!PE.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=U.default.rootData}else{let u=EE.exec(e);if(!u)throw Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw Error(c("property/index",l));return n[t-l]}if(l>t)throw Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)if(u)s=x._`${s}${x.getProperty(Re.unescapeJsonPointer(u))}`,i=x._`${i} && ${s}`;return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}N_.getData=C_});var _i=z(function(M_){Object.defineProperty(M_,"__esModule",{value:!0});class Z_ extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}M_.default=Z_});var Po=z(function(q_){Object.defineProperty(q_,"__esModule",{value:!0});var ln=So();class D_ extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=ln.resolveUrl(e,t,r),this.missingSchema=ln.normalizeId(ln.getFullPath(e,this.missingRef))}}q_.default=D_});var xi=z(function(U_){Object.defineProperty(U_,"__esModule",{value:!0});U_.resolveSchema=U_.getCompilingSchema=U_.resolveRef=U_.compileSchema=U_.SchemaEnv=void 0;var xe=B(),AE=_i(),Ir=Lt(),be=So(),yi=Q(),L_=zo();class Eo{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:be.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}U_.SchemaEnv=Eo;function Il(e){let t=F_.call(this,e);if(t)return t;let r=be.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new xe.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:AE.default,code:xe._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Ir.default.data,parentData:Ir.default.parentData,parentDataProperty:Ir.default.parentDataProperty,dataNames:[Ir.default.data],dataPathArr:[xe.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:xe.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:xe.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:xe._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),L_.validateFunctionCode(u),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(Ir.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let p=Function(`${Ir.default.self}`,`${Ir.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async)p.$async=!0;if(this.opts.code.source===!0)p.source={validateName:c,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:f,items:h}=u;if(p.evaluated={props:f instanceof xe.Name?void 0:f,items:h instanceof xe.Name?void 0:h,dynamicProps:f instanceof xe.Name,dynamicItems:h instanceof xe.Name},p.source)p.source.evaluated=xe.stringify(p.evaluated)}return e.validate=p,e}catch(d){if(delete e.validate,delete e.validateName,l)this.logger.error("Error compiling schema, function code:",l);throw d}finally{this._compilations.delete(e)}}U_.compileSchema=Il;function CE(e,t,r){var n;r=be.resolveUrl(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=ZE.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;if(i)s=new Eo({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=NE.call(this,s)}U_.resolveRef=CE;function NE(e){if(be.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Il.call(this,e)}function F_(e){for(let t of this._compilations)if(jE(t,e))return t}U_.getCompilingSchema=F_;function jE(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function ZE(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||vi.call(this,e,t)}function vi(e,t){let r=this.opts.uriResolver.parse(t),n=be._getFullPath(this.opts.uriResolver,r),o=be.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Ol.call(this,r,e);let s=be.normalizeId(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=vi.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Ol.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Il.call(this,i);if(s===be.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];if(u)o=be.resolveUrl(this.opts.uriResolver,o,u);return new Eo({schema:a,schemaId:c,root:e,baseId:o})}return Ol.call(this,r,i)}U_.resolveSchema=vi;var ME=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ol(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let c=r[yi.unescapeFragment(a)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!ME.has(a)&&u)t=be.resolveUrl(this.opts.uriResolver,t,u)}let s;if(typeof r!="boolean"&&r.$ref&&!yi.schemaHasRulesButRef(r,this.RULES)){let a=be.resolveUrl(this.opts.uriResolver,t,r.$ref);s=vi.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Eo({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s;return}});var H_=z(function(rD,UE){UE.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 Ml=z(function(nD,Q_){var VE=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Cl=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),HE=RegExp.prototype.test.bind(/^\d*$/u),Ar=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Nl=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),J_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),jl=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),BE=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),He=Array(256);for(let t=0;t<256;t++)He[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Ne(e){if(e<2048)return He[192|e>>6]+He[128|e&63];if(e<65536)return He[224|e>>12]+He[128|e>>6&63]+He[128|e&63];return He[240|e>>18]+He[128|e>>12&63]+He[128|e>>6&63]+He[128|e&63]}function JE(e){let t="",r=0,n=0;for(n=0;n<e.length;n++){if(r=e[n].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var KE=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),GE=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),WE=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),XE=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function YE(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(WE(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Ar(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function B_(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(n===-1)n=a;if(o++,o>r)r=o,t=n}else n=-1,o=0;if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function QE(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!Cl(c))return;s+=2;continue}if(!KE(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1){if(s!==8)return;return B_(o)}if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<o.length;a++)i.push(o[a]);return B_(i)}function Al(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&GE(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(eT(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(o=n.slice(s+a),!YE(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=QE(n);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function eT(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function K_(e){let t=e,r=[],n=-1,o=0;while(o=t.length){if(o===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(o===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(o===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function tT(e){if(e===""||e[0]==="/")return K_(e);let t=e.split("/"),r=t.length-1,n=[],o=!1;for(let s=0;s<=r;s++){let i=t[s];if(i==="."||i===".."){if(i==="..")if(n.length!==0&&n[n.length-1]!=="..")n.pop();else n.push("..");o=s===r}else n.push(i)}if(o&&n[n.length-1]!=="..")n.push("");if(n.length===0||n[0]===""||n[0].includes(":"))n.unshift(".");return n.join("/")}var rT={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},nT=/[@/?#:]/g,oT=/[@/?#]/g;function G_(e,t){let r=t?oT:nT;return r.lastIndex=0,e.replace(r,(n)=>rT[n])}function W_(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(Ar(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&Nl(i))r+=i;else r+="%"+s;n+=2;continue}}r+=e[n]}return r}function sT(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Ar(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(i!=="."&&Nl(i))t+=i;else t+="%"+s;r+=2;continue}}if(J_(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=Y_(o)?n:He[o];else if(o<55296||o>57343)t+=Ne(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=Ne(65536+(o-55296<<10)+(s-56320)),r++;else t+=Ne(65533)}else t+=Ne(65533)}}return t}function iT(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let s=e[o];if(s==="%"&&o+2<e.length){let i=e.slice(o+1,o+3);if(Ar(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/")n=!1;if(J_(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=He[i];else if(i<55296||i>57343)r+=Ne(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);if(a>=56320&&a<=57343)r+=Ne(65536+(i-55296<<10)+(a-56320)),o++;else r+=Ne(65533)}else r+=Ne(65533)}}return r}function Zl(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Ar(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=He[s];else if(s<55296||s>57343)r+=Ne(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);if(i>=56320&&i<=57343)r+=Ne(65536+(s-55296<<10)+(i-56320)),n++;else r+=Ne(65533)}else r+=Ne(65533)}}return r}function X_(e){return Zl(e,BE)}function aT(e){return Zl(e,jl)}function cT(e){return Zl(e,jl)}function Y_(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function uT(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Ar(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(Nl(i))t+=i;else t+="%"+s;r+=2;continue}}if(jl(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=Y_(o)?n:He[o];else if(o<55296||o>57343)t+=Ne(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=Ne(65536+(o-55296<<10)+(s-56320)),r++;else t+=Ne(65533)}else t+=Ne(65533)}}return t}function lT(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Ar(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function dT(e){let t=[];if(e.userinfo!==void 0)t.push(X_(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Cl(r)){let n=Al(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=W_(r,!0),n=Al(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=G_(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!HE(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}Q_.exports={nonSimpleDomain:XE,recomposeAuthority:dT,reescapeHostDelimiters:G_,normalizePercentEncoding:W_,normalizePathEncoding:sT,serializePathEncoding:iT,normalizeQueryFragmentEncoding:uT,encodeUserinfo:X_,encodeQuery:aT,encodeFragment:cT,escapePreservingEscapes:lT,removeDotSegments:K_,removeDotSegmentsRelative:tT,isIPv4:Cl,isUUID:VE,normalizeIPv6:Al,stringArrayToHexStripped:JE}});var oy=z(function(oD,ny){var{isUUID:pT}=Ml(),fT=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,mT=["http","https","ws","wss","urn","urn:uuid"];function hT(e){return mT.indexOf(e)!==-1}function Dl(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function ey(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function ty(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function gT(e){return e.secure=Dl(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function _T(e){if(e.port===(Dl(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function yT(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(fT);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=ql(o);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function vT(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=ql(o);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function xT(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!pT(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function bT(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var ry={scheme:"http",domainHost:!0,parse:ey,serialize:ty},$T={scheme:"https",domainHost:ry.domainHost,parse:ey,serialize:ty},bi={scheme:"ws",domainHost:!0,parse:gT,serialize:_T},wT={scheme:"wss",domainHost:bi.domainHost,parse:bi.parse,serialize:bi.serialize},kT={scheme:"urn",parse:yT,serialize:vT,skipNormalize:!0},ST={scheme:"urn:uuid",parse:xT,serialize:bT,skipNormalize:!0},$i={http:ry,https:$T,ws:bi,wss:wT,urn:kT,"urn:uuid":ST};Object.setPrototypeOf($i,null);function ql(e){return e&&($i[e]||$i[e.toLowerCase()])||void 0}ny.exports={wsIsSecure:Dl,SCHEMES:$i,isValidSchemeName:hT,getSchemeHandler:ql}});var yy=z(function(sD,zi){var{normalizeIPv6:uy,removeDotSegments:Ro,removeDotSegmentsRelative:ly,recomposeAuthority:zT,normalizePercentEncoding:Ll,normalizePathEncoding:PT,serializePathEncoding:sy,normalizeQueryFragmentEncoding:iy,encodeQuery:ET,encodeFragment:TT,reescapeHostDelimiters:RT,isIPv4:dy,nonSimpleDomain:OT}=Ml(),{SCHEMES:py,getSchemeHandler:Fl}=oy(),fy=/^[A-Za-z][A-Za-z0-9+.-]*$/u,IT=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function ay(e){let t=String(e);if(!fy.test(t))throw TypeError("URI scheme is malformed.");return t}function AT(e,t){if(typeof e==="string")e=FT(e,t);else if(typeof e==="object")e=ki(Cr(e,t),t);return e}function CT(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=wi(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:p,malformedHost:f,malformedScheme:h}=wi(t,n);if(s||d||i||m||a||p||c||f||u||h)throw Error(o.error||l.error||"URI is malformed.");let g=my(o,l,n,!0),v=Fl(r&&r.scheme||g.scheme),T=g.host,M=T!==void 0&&T!==""&&(dy(T)||uy(T).isIPV6);if(gy(g,r||{},v,M))throw Error("URI host is malformed.");hy(g,r||{},v,M);let Y=T&&T.indexOf("%")!==-1&&!/\P{ASCII}/u.test(T);if(g.error&&!Y)throw Error(g.error);return n.skipEscape=!0,Cr(g,n)}function my(e,t,r,n){let o={};if(!n)e=ki(Cr(e,r),r),t=ki(Cr(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Ro(t.path||""),o.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Ro(t.path||""),o.query=t.query;else{if(!t.path)if(o.path=e.path,t.query!==void 0)o.query=t.query;else o.query=e.query;else{if(t.path[0]==="/")o.path=Ro(t.path);else{let s=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(s&&!e.path)o.path="/"+t.path;else if(!e.path)o.path=t.path;else o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;o.path=e.scheme===void 0&&!s&&o.path[0]!=="/"?ly(o.path):Ro(o.path)}o.query=t.query}o.userinfo=e.userinfo,o.host=e.host,o.port=e.port}o.scheme=e.scheme}return o.fragment=t.fragment,o}function NT(e,t,r){let n=cy(e,r),o=cy(t,r);return n!==void 0&&o!==void 0&&n===o}function Cr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[];if(r.scheme)r.scheme=ay(r.scheme);let s=Fl(n.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=(r.scheme===void 0||n.reference==="suffix")&&!i,c=!n.skipEscape&&a;if(r.path!==void 0)if(!n.skipEscape)r.path=sy(r.path,c);else r.path=Ll(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=ay(r.scheme),o.push(r.scheme,":");let u=zT(r);if(u!==void 0){if(n.reference!=="suffix")o.push("//");if(o.push(u),r.path&&r.path[0]!=="/")o.push("/")}if(r.path!==void 0){let l=r.path;if(!n.absolutePath&&(!s||!s.absolutePath))l=a&&l[0]!=="/"?ly(l):Ro(l);if(a)l=sy(l,!0);if(u===void 0&&l[0]==="/"&&l[1]==="/")l="/%2F"+l.slice(2);o.push(l)}if(r.query!==void 0)o.push("?",ET(r.query));if(r.fragment!==void 0)o.push("#",TT(r.fragment));return o.join("")}var jT=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,ZT=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,MT=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function DT(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function To(e){if(e===void 0)return!1;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Si(e){return e[0]==="["&&e[e.length-1]==="]"}function qT(e){let t=e[4];return To(e[3])||t!==void 0&&!Si(t)&&To(t)||To(e[6])||To(e[7])||To(e[8])}function hy(e,t,r,n){if(gy(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Si(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&OT(e.host)){let o;try{o=new URL("http://"+e.host)}catch(s){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+s,!0}if(!LT(o))return e.error=e.error||"URI host is malformed.",!0;e.host=o.hostname}return!1}function gy(e,t,r,n){return Boolean(e.host&&n===!1&&!Si(e.host)&&(t.domainHost||r&&r.domainHost)&&IT.test(e.host))}function LT(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function wi(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let d=e.match(ZT);if(d!==null&&d[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",o=!0;let m=e.match(MT);if(m!==null){let f=m[1],h=f.replace(/[\t\n\r]/g,"");if(h.length>=2){if(h.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",o=!0;else if(f.length!==h.length)n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0}}let p=e.match(jT);if(p){if(n.scheme=p[1],n.userinfo=p[3],n.host=p[4],n.port=parseInt(p[5],10),n.path=p[6]||"",n.query=p[7],n.fragment=p[8],n.scheme!==void 0)if(fy.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",u=!0;if(s=qT(p),s)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=p[5];let f=DT(n,p);if(f!==void 0)n.error=n.error||f,o=!0;if(n.host)if(dy(n.host)===!1){let v=Si(n.host),T=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,M=uy(n.host);if(l=M.isIPV6||M.isIPVFuture===!0,c=T&&(!v||M.error===!0),n.host=l?M.host:M.host.toLowerCase(),c)n.error=n.error||"URI host is malformed.",o=!0}else l=!0;if(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";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let h=Fl(r.scheme||n.scheme);if(!c)a=hy(n,r,h,l);if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let g=l?n.host:Ll(n.host,!0);if(!l)g=Ll(g.toLowerCase());n.host=l||r.scheme!=="null"?RT(g,l):g}if(!h||h&&!h.skipNormalize){if(n.path)n.path=PT(n.path);if(n.query)n.query=iy(n.query);if(n.fragment)n.fragment=iy(n.fragment)}if(h&&h.parse){if(h.parse(n,r),h===py.urn&&n.nid===void 0)i=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function ki(e,t){return wi(e,t).parsed}function FT(e,t){return _y(e,t).normalized}function _y(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=wi(e,t);return{normalized:n||o||s||i||a?e:Cr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function cy(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:Cr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=_y(r,t);return o||s||i||a||c?void 0:n}var Ul={SCHEMES:py,normalize:AT,resolve:CT,resolveComponent:my,equal:NT,serialize:Cr,parse:ki};zi.exports=Ul;zi.exports.default=Ul;zi.exports.fastUri=Ul});var by=z(function(xy){Object.defineProperty(xy,"__esModule",{value:!0});var vy=yy();vy.code='require("ajv/dist/runtime/uri").default';xy.default=vy});var Oy=z(function(Ft){Object.defineProperty(Ft,"__esModule",{value:!0});Ft.CodeGen=Ft.Name=Ft.nil=Ft.stringify=Ft.str=Ft._=Ft.KeywordCxt=void 0;var VT=zo();Object.defineProperty(Ft,"KeywordCxt",{enumerable:!0,get:function(){return VT.KeywordCxt}});var pn=B();Object.defineProperty(Ft,"_",{enumerable:!0,get:function(){return pn._}});Object.defineProperty(Ft,"str",{enumerable:!0,get:function(){return pn.str}});Object.defineProperty(Ft,"stringify",{enumerable:!0,get:function(){return pn.stringify}});Object.defineProperty(Ft,"nil",{enumerable:!0,get:function(){return pn.nil}});Object.defineProperty(Ft,"Name",{enumerable:!0,get:function(){return pn.Name}});Object.defineProperty(Ft,"CodeGen",{enumerable:!0,get:function(){return pn.CodeGen}});var HT=_i(),zy=Po(),Py=xl(),wt=xi(),Ey=B(),kt=So(),ir=ko(),dn=Q(),$y=H_(),BT=by(),Ty=(e,t)=>new RegExp(e,t);Ty.code="new RegExp";var JT=["removeAdditional","useDefaults","coerceTypes"],KT=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),GT={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."},WT={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},wy=200;function XT(e){var t,r,n,o,s,i,a,c,u,l,d,m,p,f,h,g,v,T,M,Y,C,K,ke,vr,Nr;let At=e.strict,jr=(t=e.code)===null||t===void 0?void 0:t.optimize,No=jr===!0||jr===void 0?1:jr||0,jo=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Ty,xb=(o=e.uriResolver)!==null&&o!==void 0?o:BT.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:At)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:At)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:At)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:At)!==null&&m!==void 0?m:"log",strictRequired:(f=(p=e.strictRequired)!==null&&p!==void 0?p:At)!==null&&f!==void 0?f:!1,code:e.code?{...e.code,optimize:No,regExp:jo}:{optimize:No,regExp:jo},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:wy,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:wy,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(T=e.messages)!==null&&T!==void 0?T:!0,inlineRefs:(M=e.inlineRefs)!==null&&M!==void 0?M:!0,schemaId:(Y=e.schemaId)!==null&&Y!==void 0?Y:"$id",addUsedSchema:(C=e.addUsedSchema)!==null&&C!==void 0?C:!0,validateSchema:(K=e.validateSchema)!==null&&K!==void 0?K:!0,validateFormats:(ke=e.validateFormats)!==null&&ke!==void 0?ke:!0,unicodeRegExp:(vr=e.unicodeRegExp)!==null&&vr!==void 0?vr:!0,int32range:(Nr=e.int32range)!==null&&Nr!==void 0?Nr:!0,uriResolver:xb}}class Pi{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...XT(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new Ey.ValueScope({scope:{},prefixes:KT,es5:t,lines:r}),this.logger=nR(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=Py.getRules(),ky.call(this,GT,e,"NOT SUPPORTED"),ky.call(this,WT,e,"DEPRECATED","warn"),this._metaOpts=tR.call(this),e.formats)QT.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)eR.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);YT.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=$y;if(r==="id")n={...$y},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(u,l){await o.call(this,u.$schema);let d=this._addSchema(u,l);return d.validate||s.call(this,d)}async function o(u){if(u&&!this.getSchema(u))await n.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(l){if(!(l instanceof zy.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,u)}}function i({missingSchema:u,missingRef:l}){if(this.refs[u])throw Error(`AnySchema ${u} is loaded but ${l} cannot be resolved`)}async function a(u){let l=await c.call(this,u);if(!this.refs[u])await o.call(this,l.$schema);if(!this.refs[u])this.addSchema(l,u,t)}async function c(u){let l=this._loading[u];if(l)return l;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,n);return this}let o;if(typeof e==="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw Error(`schema ${s} must be string`)}return t=kt.normalizeId(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(r,e);if(!n&&t){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw Error(o)}return n}getSchema(e){let t;while(typeof(t=Sy.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new wt.SchemaEnv({schema:{},schemaId:r});if(t=wt.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}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 t=Sy.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=kt.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(sR.call(this,r,t),!t)return dn.eachItem(r,(o)=>Vl.call(this,o)),this;aR.call(this,t);let n={...t,type:ir.getJSONTypes(t.type),schemaType:ir.getJSONTypes(t.schemaType)};return dn.eachItem(r,n.type.length===0?(o)=>Vl.call(this,o,n):(o)=>n.type.forEach((s)=>Vl.call(this,o,n,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let n=r.rules.findIndex((o)=>o.keyword===e);if(n>=0)r.rules.splice(n,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,o)=>n+t+o)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let o=n.split("/").slice(1),s=e;for(let i of o)s=s[i];for(let i in r){let a=r[i];if(typeof a!="object")continue;let{$data:c}=a.definition,u=s[i];if(c&&u)s[i]=Ry(u)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=kt.normalizeId(s||r);let c=kt.getSchemaRefs.call(this,e,r);if(a=new wt.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:c}),this._cache.set(a.schema,a),o&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else wt.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{wt.compileSchema.call(this,e)}finally{this.opts=t}}}Pi.ValidationError=HT.default;Pi.MissingRefError=zy.default;Ft.default=Pi;function ky(e,t,r,n="error"){for(let o in e){let s=o;if(s in t)this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function Sy(e){return e=kt.normalizeId(e),this.schemas[e]||this.refs[e]}function YT(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function QT(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function eR(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function tR(){let e={...this.opts};for(let t of JT)delete e[t];return e}var rR={log(){},warn(){},error(){}};function nR(e){if(e===!1)return rR;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var oR=/^[a-z_$][a-z0-9_$:-]*$/i;function sR(e,t){let{RULES:r}=this;if(dn.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!oR.test(n))throw Error(`Keyword ${n} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function Vl(e,t,r){var n;let o=t===null||t===void 0?void 0:t.post;if(r&&o)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(!i)i={type:r,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:ir.getJSONTypes(t.type),schemaType:ir.getJSONTypes(t.schemaType)}};if(t.before)iR.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((c)=>this.addKeyword(c))}function iR(e,t,r){let n=e.rules.findIndex((o)=>o.keyword===r);if(n>=0)e.rules.splice(n,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function aR(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=Ry(t);e.validateSchema=this.compile(t,!0)}var cR={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ry(e){return{anyOf:[e,cR]}}});var Ay=z(function(Iy){Object.defineProperty(Iy,"__esModule",{value:!0});var dR={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Iy.default=dR});var Zy=z(function(Ny){Object.defineProperty(Ny,"__esModule",{value:!0});Ny.callRef=Ny.getValidate=void 0;var fR=Po(),Ti=st(),ie=B(),fn=Lt(),Ri=xi(),ar=Q(),mR={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=Ri.resolveRef.call(c,u,o,r);if(l===void 0)throw new fR.default(n.opts.uriResolver,o,r);if(l instanceof Ri.SchemaEnv)return m(l);return p(l);function d(){if(s===u)return Ei(e,i,s,s.$async);let f=t.scopeValue("root",{ref:u});return Ei(e,ie._`${f}.validate`,u,u.$async)}function m(f){let h=Cy(e,f);Ei(e,h,f,f.$async)}function p(f){let h=t.scopeValue("schema",a.code.source===!0?{ref:f,code:ie.stringify(f)}:{ref:f}),g=t.name("valid"),v=e.subschema({schema:f,dataTypes:[],schemaPath:ie.nil,topSchemaRef:h,errSchemaPath:r},g);e.mergeEvaluated(v),e.ok(g)}}};function Cy(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):ie._`${r.scopeValue("wrapper",{ref:t})}.validate`}Ny.getValidate=Cy;function Ei(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?fn.default.this:ie.nil;if(n)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let f=o.let("valid");o.try(()=>{if(o.code(ie._`await ${Ti.callValidateCode(e,t,u)}`),p(t),!i)o.assign(f,!0)},(h)=>{if(o.if(ie._`!(${h} instanceof ${s.ValidationError})`,()=>o.throw(h)),m(h),!i)o.assign(f,!1)}),e.ok(f)}function d(){e.result(Ti.callValidateCode(e,t,u),()=>p(t),()=>m(t))}function m(f){let h=ie._`${f}.errors`;o.assign(fn.default.vErrors,ie._`${fn.default.vErrors} === null ? ${h} : ${fn.default.vErrors}.concat(${h})`),o.assign(fn.default.errors,ie._`${fn.default.vErrors}.length`)}function p(f){var h;if(!s.opts.unevaluated)return;let g=(h=r===null||r===void 0?void 0:r.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(g&&!g.dynamicProps){if(g.props!==void 0)s.props=ar.mergeEvaluated.props(o,g.props,s.props)}else{let v=o.var("props",ie._`${f}.evaluated.props`);s.props=ar.mergeEvaluated.props(o,v,s.props,ie.Name)}if(s.items!==!0)if(g&&!g.dynamicItems){if(g.items!==void 0)s.items=ar.mergeEvaluated.items(o,g.items,s.items)}else{let v=o.var("items",ie._`${f}.evaluated.items`);s.items=ar.mergeEvaluated.items(o,v,s.items,ie.Name)}}}Ny.callRef=Ei;Ny.default=mR});var Dy=z(function(My){Object.defineProperty(My,"__esModule",{value:!0});var _R=Ay(),yR=Zy(),vR=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",_R.default,yR.default];My.default=vR});var Ly=z(function(qy){Object.defineProperty(qy,"__esModule",{value:!0});var ur=B(),cr=ur.operators,Oi={maximum:{okStr:"<=",ok:cr.LTE,fail:cr.GT},minimum:{okStr:">=",ok:cr.GTE,fail:cr.LT},exclusiveMaximum:{okStr:"<",ok:cr.LT,fail:cr.GTE},exclusiveMinimum:{okStr:">",ok:cr.GT,fail:cr.LTE}},bR={message:({keyword:e,schemaCode:t})=>ur.str`must be ${Oi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>ur._`{comparison: ${Oi[e].okStr}, limit: ${t}}`},$R={keyword:Object.keys(Oi),type:"number",schemaType:"number",$data:!0,error:bR,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(ur._`${r} ${Oi[t].fail} ${n} || isNaN(${r})`)}};qy.default=$R});var Uy=z(function(Fy){Object.defineProperty(Fy,"__esModule",{value:!0});var St=B(),kR={message:({schemaCode:e})=>St.str`must be multiple of ${e}`,params:({schemaCode:e})=>St._`{multipleOf: ${e}}`},SR={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:kR,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?St._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:St._`${i} !== parseInt(${i})`;e.fail$data(St._`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Fy.default=SR});var By=z(function(Hy){Object.defineProperty(Hy,"__esModule",{value:!0});function Vy(e){let t=e.length,r=0,n=0,o;while(n<t)if(r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t){if(o=e.charCodeAt(n),(o&64512)===56320)n++}return r}Hy.default=Vy;Vy.code='require("ajv/dist/runtime/ucs2length").default'});var Gy=z(function(Ky){Object.defineProperty(Ky,"__esModule",{value:!0});var Be=B(),Jy=Q(),ER=By(),TR={message({keyword:e,schemaCode:t}){return Be.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Be._`{limit: ${e}}`},RR={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:TR,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?Be.operators.GT:Be.operators.LT,i=o.opts.unicode===!1?Be._`${r}.length`:Be._`${Jy.useFunc(e.gen,ER.default)}(${r})`;e.fail$data(Be._`${i} ${s} ${n}`)}};Ky.default=RR});var Qy=z(function(Yy){Object.defineProperty(Yy,"__esModule",{value:!0});var Wy=st(),Xy=Q(),it=B(),IR={message:({schemaCode:e})=>it.str`must match pattern "${e}"`,params:({schemaCode:e})=>it._`{pattern: ${e}}`},AR={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:IR,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?it._`new RegExp`:Xy.useFunc(t,c),l=t.let("valid");t.try(()=>t.assign(l,it._`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(it._`!${l}`)}else{let c=Wy.usePattern(e,o);e.fail$data(it._`!${c}.test(${r})`)}}};Yy.default=AR});var tv=z(function(ev){Object.defineProperty(ev,"__esModule",{value:!0});var zt=B(),NR={message({keyword:e,schemaCode:t}){return zt.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>zt._`{limit: ${e}}`},jR={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:NR,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?zt.operators.GT:zt.operators.LT;e.fail$data(zt._`Object.keys(${r}).length ${o} ${n}`)}};ev.default=jR});var ov=z(function(nv){Object.defineProperty(nv,"__esModule",{value:!0});var Pt=st(),Et=B(),rv=Q(),MR={message:({params:{missingProperty:e}})=>Et.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Et._`{missingProperty: ${e}}`},DR={keyword:"required",type:"object",schemaType:"array",$data:!0,error:MR,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors)u();else l();if(a.strictRequired){let p=e.parentSchema.properties,{definedProperties:f}=e.it;for(let h of r)if((p===null||p===void 0?void 0:p[h])===void 0&&!f.has(h)){let g=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${h}" is not defined at "${g}" (strictRequired)`;rv.checkStrictMode(i,v,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(Et.nil,d);else for(let p of r)Pt.checkReportMissingProp(e,p)}function l(){let p=t.let("missing");if(c||s){let f=t.let("valid",!0);e.block$data(f,()=>m(p,f)),e.ok(f)}else t.if(Pt.checkMissingProp(e,r,p)),Pt.reportMissingProp(e,p),t.else()}function d(){t.forOf("prop",n,(p)=>{e.setParams({missingProperty:p}),t.if(Pt.noPropertyInData(t,o,p,a.ownProperties),()=>e.error())})}function m(p,f){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(f,Pt.propertyInData(t,o,p,a.ownProperties)),t.if(Et.not(f),()=>{e.error(),t.break()})},Et.nil)}}};nv.default=DR});var iv=z(function(sv){Object.defineProperty(sv,"__esModule",{value:!0});var Tt=B(),LR={message({keyword:e,schemaCode:t}){return Tt.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Tt._`{limit: ${e}}`},FR={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:LR,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Tt.operators.GT:Tt.operators.LT;e.fail$data(Tt._`${r}.length ${o} ${n}`)}};sv.default=FR});var Ii=z(function(cv){Object.defineProperty(cv,"__esModule",{value:!0});var av=Pl();av.code='require("ajv/dist/runtime/equal").default';cv.default=av});var dv=z(function(lv){Object.defineProperty(lv,"__esModule",{value:!0});var mn=ko(),ee=B(),uv=Q(),HR=Ii(),BR={message:({params:{i:e,j:t}})=>ee.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>ee._`{i: ${e}, j: ${t}}`},JR={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:BR,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?mn.getSchemaTypes(s.items):[];e.block$data(c,l,ee._`${i} === false`),e.ok(c);function l(){let f=t.let("i",ee._`${r}.length`),h=t.let("j");e.setParams({i:f,j:h}),t.assign(c,!0),t.if(ee._`${f} > 1`,()=>(d()?m:p)(f,h))}function d(){return u.length>0&&!u.some((f)=>f==="object"||f==="array")}function m(f,h){let g=t.name("item"),v=mn.checkDataTypes(u,g,a.opts.strictNumbers,mn.DataType.Wrong),T=t.const("indices",ee._`{}`);t.for(ee._`;${f}--;`,()=>{if(t.let(g,ee._`${r}[${f}]`),t.if(v,ee._`continue`),u.length>1)t.if(ee._`typeof ${g} == "string"`,ee._`${g} += "_"`);t.if(ee._`typeof ${T}[${g}] == "number"`,()=>{t.assign(h,ee._`${T}[${g}]`),e.error(),t.assign(c,!1).break()}).code(ee._`${T}[${g}] = ${f}`)})}function p(f,h){let g=uv.useFunc(t,HR.default),v=t.name("outer");t.label(v).for(ee._`;${f}--;`,()=>t.for(ee._`${h} = ${f}; ${h}--;`,()=>t.if(ee._`${g}(${r}[${f}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};lv.default=JR});var mv=z(function(fv){Object.defineProperty(fv,"__esModule",{value:!0});var hn=B(),pv=Q(),GR=Ii(),WR={message:"must be equal to constant",params:({schemaCode:e})=>hn._`{allowedValue: ${e}}`},XR={keyword:"const",$data:!0,error:WR,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;if(n||s&&typeof s=="object")e.fail$data(hn._`!${pv.useFunc(t,GR.default)}(${r}, ${o})`);else e.fail(hn._`${s} !== ${r}`)}};fv.default=XR});var _v=z(function(gv){Object.defineProperty(gv,"__esModule",{value:!0});var Rt=B(),hv=Q(),QR=Ii(),eO={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Rt._`{allowedValues: ${e}}`},tO={keyword:"enum",schemaType:"array",$data:!0,error:eO,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c!==null&&c!==void 0?c:c=hv.useFunc(t,QR.default),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw Error("ajv implementation error");let p=t.const("vSchema",s);l=Rt.or(...o.map((f,h)=>m(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(p)=>t.if(Rt._`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function m(p,f){let h=o[f];return typeof h==="object"&&h!==null?Rt._`${u()}(${r}, ${p}[${f}])`:Rt._`${r} === ${h}`}}};gv.default=tO});var vv=z(function(yv){Object.defineProperty(yv,"__esModule",{value:!0});var nO=Ly(),oO=Uy(),sO=Gy(),iO=Qy(),aO=tv(),cO=ov(),uO=iv(),lO=dv(),dO=mv(),pO=_v(),fO=[nO.default,oO.default,sO.default,iO.default,aO.default,cO.default,uO.default,lO.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},dO.default,pO.default];yv.default=fO});var Hl=z(function(bv){Object.defineProperty(bv,"__esModule",{value:!0});bv.validateAdditionalItems=void 0;var Je=B(),gn=Q(),hO={message:({params:{len:e}})=>Je.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Je._`{limit: ${e}}`},gO={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:hO,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){gn.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}xv(e,n)}};function xv(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",Je._`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(Je._`${a} <= ${t.length}`);else if(typeof n=="object"&&!gn.alwaysValidSchema(i,n)){let u=r.var("valid",Je._`${a} <= ${t.length}`);r.if(Je.not(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:gn.Type.Num},u),!i.allErrors)r.if(Je.not(u),()=>r.break())})}}bv.validateAdditionalItems=xv;bv.default=gO});var Bl=z(function(Sv){Object.defineProperty(Sv,"__esModule",{value:!0});Sv.validateTuple=void 0;var Ai=B(),lr=Q(),wv=st(),yO={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return kv(e,"additionalItems",t);if(r.items=!0,lr.alwaysValidSchema(r,t))return;e.ok(wv.validateArray(e))}};function kv(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;if(l(o),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=lr.mergeEvaluated.items(n,r.length,a.items);let c=n.name("valid"),u=n.const("len",Ai._`${s}.length`);r.forEach((d,m)=>{if(lr.alwaysValidSchema(a,d))return;n.if(Ai._`${u} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c)});function l(d){let{opts:m,errSchemaPath:p}=a,f=r.length,h=f===d.minItems&&(f===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let g=`"${i}" is ${f}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;lr.checkStrictMode(a,g,m.strictTuples)}}}Sv.validateTuple=kv;Sv.default=yO});var Tv=z(function(Ev){Object.defineProperty(Ev,"__esModule",{value:!0});var Pv=Bl(),xO={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>Pv.validateTuple(e,"items")};Ev.default=xO});var Cv=z(function(Av){Object.defineProperty(Av,"__esModule",{value:!0});var Ci=B(),Rv=Q(),Ov=st(),Iv=Hl(),$O={message:({params:{len:e}})=>Ci.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Ci._`{limit: ${e}}`},wO={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:$O,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;if(n.items=!0,Rv.alwaysValidSchema(n,t))return;if(o)Iv.validateAdditionalItems(e,o);else e.ok(Ov.validateArray(e))}};Av.default=wO});var jv=z(function(Nv){Object.defineProperty(Nv,"__esModule",{value:!0});var ge=B(),dr=Q(),SO={message:({params:{min:e,max:t}})=>t===void 0?ge.str`must contain at least ${e} valid item(s)`:ge.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ge._`{minContains: ${e}}`:ge._`{minContains: ${e}, maxContains: ${t}}`},zO={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:SO,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;if(s.opts.next)i=c===void 0?1:c,a=u;else i=1;let l=t.const("len",ge._`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){dr.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){dr.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(dr.alwaysValidSchema(s,r)){let h=ge._`${l} >= ${i}`;if(a!==void 0)h=ge._`${h} && ${l} <= ${a}`;e.pass(h);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)p(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(ge._`${o}.length > 0`,m)}else t.let(d,!1),m();e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),g=t.let("count",0);p(h,()=>t.if(h,()=>f(g)))}function p(h,g){t.forRange("i",0,l,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:dr.Type.Num,compositeRule:!0},h),g()})}function f(h){if(t.code(ge._`${h}++`),a===void 0)t.if(ge._`${h} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(ge._`${h} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(ge._`${h} >= ${i}`,()=>t.assign(d,!0))}}};Nv.default=zO});var Uv=z(function(qv){Object.defineProperty(qv,"__esModule",{value:!0});qv.validateSchemaDeps=qv.validatePropertyDeps=qv.error=void 0;var _n=B(),Zv=Q(),Ot=st();qv.error={message:({params:{property:e,depsCount:t,deps:r}})=>_n.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>_n._`{property: ${e},
|
|
6
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,k._`[${o}]`)}}}function tP({gen:e,parentData:t,parentDataProperty:r},n){e.if(k._`${t} !== undefined`,()=>e.assign(k._`${t}[${r}]`,n))}function wl(e,t,r,n=on.Correct){let o=n===on.Correct?k.operators.EQ:k.operators.NEQ,s;switch(e){case"null":return k._`${t} ${o} null`;case"array":s=k._`Array.isArray(${t})`;break;case"object":s=k._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(k._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return k._`typeof ${t} ${o} ${e}`}return n===on.Correct?s:k.not(s);function i(a=k.nil){return k.and(k._`typeof ${t} == "number"`,a,r?k._`isFinite(${t})`:k.nil)}}Vg.checkDataType=wl;function kl(e,t,r,n){if(e.length===1)return wl(e[0],t,r,n);let o,s=pi.toHash(e);if(s.array&&s.object){let i=k._`typeof ${t} != "object"`;o=s.null?i:k._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=k.nil;if(s.number)delete s.integer;for(let i in s)o=k.and(o,wl(i,t,r,n));return o}Vg.checkDataTypes=kl;var rP={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?k._`{type: ${e}}`:k._`{type: ${t}}`};function Sl(e){let t=nP(e);Lg.reportError(t,rP)}Vg.reportTypeError=Sl;function nP(e){let{gen:t,data:r,schema:n}=e,o=pi.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Wg=z(function(Kg){Object.defineProperty(Kg,"__esModule",{value:!0});Kg.assignDefaults=void 0;var ot=B(),Jg=Q();function lP(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Bg(e,o,r[o].default);else if(t==="array"&&Array.isArray(n))n.forEach((o,s)=>Bg(e,s,o.default))}Kg.assignDefaults=lP;function Bg(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=ot._`${s}${ot.getProperty(t)}`;if(o){Jg.checkStrictMode(e,`default is ignored for: ${a}`);return}let c=ot._`${a} === undefined`;if(i.useDefaults==="empty")c=ot._`${c} || ${a} === null || ${a} === ""`;n.if(c,ot._`${a} = ${ot.stringify(r)}`)}});var st=z(function(e_){Object.defineProperty(e_,"__esModule",{value:!0});e_.validateUnion=e_.validateArray=e_.usePattern=e_.callValidateCode=e_.schemaProperties=e_.allSchemaProperties=e_.noPropertyInData=e_.propertyInData=e_.isOwnProperty=e_.hasPropFunc=e_.reportMissingProp=e_.checkMissingProp=e_.checkReportMissingProp=void 0;var q=B(),sn=Q(),nr=Lt(),Xg=Q();function dP(e,t){let{gen:r,data:n,it:o}=e;r.if(Pl(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:q._`${t}`},!0),e.error()})}e_.checkReportMissingProp=dP;function pP({gen:e,data:t,it:{opts:r}},n,o){return q.or(...n.map((s)=>q.and(Pl(e,t,s,r.ownProperties),q._`${o} = ${s}`)))}e_.checkMissingProp=pP;function fP(e,t){e.setParams({missingProperty:t},!0),e.error()}e_.reportMissingProp=fP;function Yg(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:q._`Object.prototype.hasOwnProperty`})}e_.hasPropFunc=Yg;function zl(e,t,r){return q._`${Yg(e)}.call(${t}, ${r})`}e_.isOwnProperty=zl;function mP(e,t,r,n){let o=q._`${t}${q.getProperty(r)} !== undefined`;return n?q._`${o} && ${zl(e,t,r)}`:o}e_.propertyInData=mP;function Pl(e,t,r,n){let o=q._`${t}${q.getProperty(r)} === undefined`;return n?q.or(o,q.not(zl(e,t,r))):o}e_.noPropertyInData=Pl;function Qg(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}e_.allSchemaProperties=Qg;function hP(e,t){return Qg(t).filter((r)=>!sn.alwaysValidSchema(e,t[r]))}e_.schemaProperties=hP;function gP({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?q._`${e}, ${t}, ${n}${o}`:t,d=[[nr.default.instancePath,q.strConcat(nr.default.instancePath,s)],[nr.default.parentData,i.parentData],[nr.default.parentDataProperty,i.parentDataProperty],[nr.default.rootData,nr.default.rootData]];if(i.opts.dynamicRef)d.push([nr.default.dynamicAnchors,nr.default.dynamicAnchors]);let m=q._`${l}, ${r.object(...d)}`;return c!==q.nil?q._`${a}.call(${c}, ${m})`:q._`${a}(${m})`}e_.callValidateCode=gP;var _P=q._`new RegExp`;function yP({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:q._`${o.code==="new RegExp"?_P:Xg.useFunc(e,o)}(${r}, ${n})`})}e_.usePattern=yP;function vP(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",q._`${r}.length`);t.forRange("i",0,c,(u)=>{e.subschema({keyword:n,dataProp:u,dataPropType:sn.Type.Num},s),t.if(q.not(s),a)})}}e_.validateArray=vP;function xP(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>sn.alwaysValidSchema(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);if(t.assign(i,q._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(q.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}e_.validateUnion=xP});var c_=z(function(i_){Object.defineProperty(i_,"__esModule",{value:!0});i_.validateKeywordUsage=i_.validSchemaType=i_.funcKeywordCode=i_.macroKeywordCode=void 0;var oe=B(),Or=Lt(),n_=st(),o_=wo();function AP(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=s_(r,n,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:oe.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}i_.macroKeywordCode=AP;function CP(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;jP(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=s_(n,o,u),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1){if(h(),t.modifying)r_(e);g(()=>e.error())}else{let v=t.async?p():f();if(t.modifying)r_(e);g(()=>NP(e,v))}}function p(){let v=n.let("ruleErrs",null);return n.try(()=>h(oe._`await `),(T)=>n.assign(d,!1).if(oe._`${T} instanceof ${c.ValidationError}`,()=>n.assign(v,oe._`${T}.errors`),()=>n.throw(T))),v}function f(){let v=oe._`${l}.errors`;return n.assign(v,null),h(oe.nil),v}function h(v=t.async?oe._`await `:oe.nil){let T=c.opts.passContext?Or.default.this:Or.default.self,M=!(("compile"in t)&&!a||t.schema===!1);n.assign(d,oe._`${v}${n_.callValidateCode(e,l,T,M)}`,t.modifying)}function g(v){var T;n.if(oe.not((T=t.valid)!==null&&T!==void 0?T:d),v)}}i_.funcKeywordCode=CP;function r_(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,oe._`${n.parentData}[${n.parentDataProperty}]`))}function NP(e,t){let{gen:r}=e;r.if(oe._`Array.isArray(${t})`,()=>{r.assign(Or.default.vErrors,oe._`${Or.default.vErrors} === null ? ${t} : ${Or.default.vErrors}.concat(${t})`).assign(Or.default.errors,oe._`${Or.default.vErrors}.length`),o_.extendErrors(e)},()=>e.error())}function jP({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function s_(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:oe.stringify(r)})}function ZP(e,t,r=!1){return!t.length||t.some((n)=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}i_.validSchemaType=ZP;function MP({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw Error("ajv implementation error");let i=o.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw Error(c)}}}i_.validateKeywordUsage=MP});var d_=z(function(u_){Object.defineProperty(u_,"__esModule",{value:!0});u_.extendSubschemaMode=u_.extendSubschemaData=u_.getSubschema=void 0;var Se=B(),fi=Q();function FP(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:Se._`${e.schemaPath}${Se.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Se._`${e.schemaPath}${Se.getProperty(t)}${Se.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${fi.escapeFragment(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}u_.getSubschema=FP;function UP(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,m=a.let("data",Se._`${t.data}${Se.getProperty(r)}`,!0);c(m),e.errorPath=Se.str`${u}${fi.getErrorPath(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=Se._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof Se.Name?o:a.let("data",o,!0);if(c(u),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}u_.extendSubschemaData=UP;function VP(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){if(n!==void 0)e.compositeRule=n;if(o!==void 0)e.createErrors=o;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=r}u_.extendSubschemaMode=VP});var El=z(function(YM,p_){p_.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var m_=z(function(QM,f_){var or=f_.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};mi(t,n,o,e,"",e)};or.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};or.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};or.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};or.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 mi(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in or.arrayKeywords)for(var m=0;m<d.length;m++)mi(e,t,r,d[m],o+"/"+l+"/"+m,s,o,l,n,m)}else if(l in or.propsKeywords){if(d&&typeof d=="object")for(var p in d)mi(e,t,r,d[p],o+"/"+l+"/"+JP(p),s,o,l,n,p)}else if(l in or.keywords||e.allKeys&&!(l in or.skipKeywords))mi(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function JP(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var So=z(function(v_){Object.defineProperty(v_,"__esModule",{value:!0});v_.getSchemaRefs=v_.resolveUrl=v_.normalizeId=v_._getFullPath=v_.getFullPath=v_.inlineRef=void 0;var h_=Q(),KP=El(),GP=m_(),WP=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function XP(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Tl(e);if(!t)return!1;return g_(e)<=t}v_.inlineRef=XP;var YP=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Tl(e){for(let t in e){if(YP.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Tl))return!0;if(typeof r=="object"&&Tl(r))return!0}return!1}function g_(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,WP.has(r))continue;if(typeof e[r]=="object")h_.eachItem(e[r],(n)=>t+=g_(n));if(t===1/0)return 1/0}return t}function __(e,t="",r){if(r!==!1)t=an(t);let n=e.parse(t);return y_(e,n)}v_.getFullPath=__;function y_(e,t){return e.serialize(t).split("#")[0]+"#"}v_._getFullPath=y_;var QP=/#\/?$/;function an(e){return e?e.replace(QP,""):""}v_.normalizeId=an;function eE(e,t,r){return r=an(r),e.resolve(t,r)}v_.resolveUrl=eE;var tE=/^[a-z_][-a-z0-9._]*$/i;function rE(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=an(e[r]||t),s={"":o},i=__(n,o,!1),a={},c=new Set;return GP(e,{allKeys:!0},(d,m,p,f)=>{if(f===void 0)return;let h=i+m,g=s[f];if(typeof d[r]=="string")g=v.call(this,d[r]);T.call(this,d.$anchor),T.call(this,d.$dynamicAnchor),s[m]=g;function v(M){let Y=this.opts.uriResolver.resolve;if(M=an(g?Y(g,M):M),c.has(M))throw l(M);c.add(M);let C=this.refs[M];if(typeof C=="string")C=this.refs[C];if(typeof C=="object")u(d,C.schema,M);else if(M!==an(h))if(M[0]==="#")u(d,a[M],M),a[M]=d;else this.refs[M]=h;return M}function T(M){if(typeof M=="string"){if(!tE.test(M))throw Error(`invalid anchor "${M}"`);v.call(this,`#${M}`)}}}),a;function u(d,m,p){if(m!==void 0&&!KP(d,m))throw l(p)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}v_.getSchemaRefs=rE});var zo=z(function(N_){Object.defineProperty(N_,"__esModule",{value:!0});N_.getData=N_.KeywordCxt=N_.validateFunctionCode=void 0;var gi=Ig(),hi=ko(),un=$l(),sr=ko(),k_=Wg(),$t=c_(),cn=d_(),x=B(),U=Lt(),S_=So(),Re=Q(),bt=wo();function cE(e){if(E_(e)){if(T_(e),P_(e)){dE(e);return}}z_(e,()=>gi.topBoolOrEmptySchema(e))}N_.validateFunctionCode=cE;function z_({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){if(o.code.es5)e.func(t,x._`${U.default.data}, ${U.default.valCxt}`,n.$async,()=>{e.code(x._`"use strict"; ${b_(r,o)}`),lE(e,o),e.code(s)});else e.func(t,x._`${U.default.data}, ${uE(o)}`,n.$async,()=>e.code(b_(r,o)).code(s))}function uE(e){return x._`{${U.default.instancePath}="", ${U.default.parentData}, ${U.default.parentDataProperty}, ${U.default.rootData}=${U.default.data}${e.dynamicRef?x._`, ${U.default.dynamicAnchors}={}`:x.nil}}={}`}function lE(e,t){e.if(U.default.valCxt,()=>{if(e.var(U.default.instancePath,x._`${U.default.valCxt}.${U.default.instancePath}`),e.var(U.default.parentData,x._`${U.default.valCxt}.${U.default.parentData}`),e.var(U.default.parentDataProperty,x._`${U.default.valCxt}.${U.default.parentDataProperty}`),e.var(U.default.rootData,x._`${U.default.valCxt}.${U.default.rootData}`),t.dynamicRef)e.var(U.default.dynamicAnchors,x._`${U.default.valCxt}.${U.default.dynamicAnchors}`)},()=>{if(e.var(U.default.instancePath,x._`""`),e.var(U.default.parentData,x._`undefined`),e.var(U.default.parentDataProperty,x._`undefined`),e.var(U.default.rootData,U.default.data),t.dynamicRef)e.var(U.default.dynamicAnchors,x._`{}`)})}function dE(e){let{schema:t,opts:r,gen:n}=e;z_(e,()=>{if(r.$comment&&t.$comment)O_(e);if(gE(e),n.let(U.default.vErrors,null),n.let(U.default.errors,0),r.unevaluated)pE(e);R_(e),vE(e)});return}function pE(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",x._`${r}.evaluated`),t.if(x._`${e.evaluated}.dynamicProps`,()=>t.assign(x._`${e.evaluated}.props`,x._`undefined`)),t.if(x._`${e.evaluated}.dynamicItems`,()=>t.assign(x._`${e.evaluated}.items`,x._`undefined`))}function b_(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?x._`/*# sourceURL=${r} */`:x.nil}function fE(e,t){if(E_(e)){if(T_(e),P_(e)){mE(e,t);return}}gi.boolOrEmptySchema(e,t)}function P_({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function E_(e){return typeof e.schema!="boolean"}function mE(e,t){let{schema:r,gen:n,opts:o}=e;if(o.$comment&&r.$comment)O_(e);_E(e),yE(e);let s=n.const("_errs",U.default.errors);R_(e,s),n.var(t,x._`${s} === ${U.default.errors}`)}function T_(e){Re.checkUnknownRules(e),hE(e)}function R_(e,t){if(e.opts.jtd)return $_(e,[],!1,t);let r=hi.getSchemaTypes(e.schema),n=hi.coerceAndCheckDataType(e,r);$_(e,r,!n,t)}function hE(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&Re.schemaHasRulesButRef(t,o.RULES))o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function gE(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)Re.checkStrictMode(e,"default is ignored in the schema root")}function _E(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=S_.resolveUrl(e.opts.uriResolver,e.baseId,t)}function yE(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function O_({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code(x._`${U.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=x.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(x._`${U.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function vE(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;if(r.$async)t.if(x._`${U.default.errors} === 0`,()=>t.return(U.default.data),()=>t.throw(x._`new ${o}(${U.default.vErrors})`));else{if(t.assign(x._`${n}.errors`,U.default.vErrors),s.unevaluated)xE(e);t.return(x._`${U.default.errors} === 0`)}}function xE({gen:e,evaluated:t,props:r,items:n}){if(r instanceof x.Name)e.assign(x._`${t}.props`,r);if(n instanceof x.Name)e.assign(x._`${t}.items`,n)}function $_(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!Re.schemaHasRulesButRef(s,l))){o.block(()=>A_(e,"$ref",l.all.$ref.definition));return}if(!c.jtd)bE(e,t);o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){if(!un.shouldUseGroup(s,m))return;if(m.type){if(o.if(sr.checkDataType(m.type,i,c.strictNumbers)),w_(e,m),t.length===1&&t[0]===m.type&&r)o.else(),sr.reportTypeError(e);o.endIf()}else w_(e,m);if(!a)o.if(x._`${U.default.errors} === ${n||0}`)}}function w_(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;if(o)k_.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(un.shouldUseRule(n,s))A_(e,s.keyword,s.definition,t.type)})}function bE(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if($E(e,t),!e.opts.allowUnionTypes)wE(e,t);kE(e,e.dataTypes)}function $E(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!I_(e.dataTypes,r))Rl(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),zE(e,t)}function wE(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Rl(e,"use allowUnionTypes to allow union type keyword")}function kE(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&un.shouldUseRule(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>SE(t,i)))Rl(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function SE(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function I_(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function zE(e,t){let r=[];for(let n of e.dataTypes)if(I_(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Rl(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,Re.checkStrictMode(e,t,e.opts.strictTypes)}class Ol{constructor(e,t,r){if($t.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=Re.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",C_(this.$data,e));else if(this.schemaCode=this.schemaValue,!$t.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",U.default.errors)}result(e,t,r){this.failResult(x.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(x.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(x._`${t} !== undefined && (${x.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?bt.reportExtraError:bt.reportError)(this,this.def.error,t)}$dataError(){bt.reportError(this,this.def.$dataError||bt.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');bt.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=x.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=x.nil,t=x.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:o,def:s}=this;if(r.if(x.or(x._`${n} === undefined`,t)),e!==x.nil)r.assign(e,!0);if(o.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==x.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return x.or(s(),i());function s(){if(r.length){if(!(t instanceof x.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return x._`${sr.checkDataTypes(a,t,o.opts.strictNumbers,sr.DataType.Wrong)}`}return x.nil}function i(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return x._`!${a}(${t})`}return x.nil}}subschema(e,t){let r=cn.getSubschema(this.it,e);cn.extendSubschemaData(r,this.it,e),cn.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return fE(n,t),n}mergeEvaluated(e,t){let{it:r,gen:n}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=Re.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Re.mergeEvaluated.items(n,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:n}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return n.if(t,()=>this.mergeEvaluated(e,x.Name)),!0}}N_.KeywordCxt=Ol;function A_(e,t,r,n){let o=new Ol(e,r,t);if("code"in r)r.code(o,n);else if(o.$data&&r.validate)$t.funcKeywordCode(o,r);else if("macro"in r)$t.macroKeywordCode(o,r);else if(r.compile||r.validate)$t.funcKeywordCode(o,r)}var PE=/^\/(?:[^~]|~0|~1)*$/,EE=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function C_(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return U.default.rootData;if(e[0]==="/"){if(!PE.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=U.default.rootData}else{let u=EE.exec(e);if(!u)throw Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw Error(c("property/index",l));return n[t-l]}if(l>t)throw Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)if(u)s=x._`${s}${x.getProperty(Re.unescapeJsonPointer(u))}`,i=x._`${i} && ${s}`;return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}N_.getData=C_});var _i=z(function(M_){Object.defineProperty(M_,"__esModule",{value:!0});class Z_ extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}M_.default=Z_});var Po=z(function(q_){Object.defineProperty(q_,"__esModule",{value:!0});var ln=So();class D_ extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=ln.resolveUrl(e,t,r),this.missingSchema=ln.normalizeId(ln.getFullPath(e,this.missingRef))}}q_.default=D_});var xi=z(function(U_){Object.defineProperty(U_,"__esModule",{value:!0});U_.resolveSchema=U_.getCompilingSchema=U_.resolveRef=U_.compileSchema=U_.SchemaEnv=void 0;var xe=B(),AE=_i(),Ir=Lt(),be=So(),yi=Q(),L_=zo();class Eo{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:be.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}U_.SchemaEnv=Eo;function Al(e){let t=F_.call(this,e);if(t)return t;let r=be.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new xe.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:AE.default,code:xe._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Ir.default.data,parentData:Ir.default.parentData,parentDataProperty:Ir.default.parentDataProperty,dataNames:[Ir.default.data],dataPathArr:[xe.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:xe.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:xe.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:xe._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),L_.validateFunctionCode(u),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(Ir.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let p=Function(`${Ir.default.self}`,`${Ir.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async)p.$async=!0;if(this.opts.code.source===!0)p.source={validateName:c,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:f,items:h}=u;if(p.evaluated={props:f instanceof xe.Name?void 0:f,items:h instanceof xe.Name?void 0:h,dynamicProps:f instanceof xe.Name,dynamicItems:h instanceof xe.Name},p.source)p.source.evaluated=xe.stringify(p.evaluated)}return e.validate=p,e}catch(d){if(delete e.validate,delete e.validateName,l)this.logger.error("Error compiling schema, function code:",l);throw d}finally{this._compilations.delete(e)}}U_.compileSchema=Al;function CE(e,t,r){var n;r=be.resolveUrl(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=ZE.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;if(i)s=new Eo({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=NE.call(this,s)}U_.resolveRef=CE;function NE(e){if(be.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Al.call(this,e)}function F_(e){for(let t of this._compilations)if(jE(t,e))return t}U_.getCompilingSchema=F_;function jE(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function ZE(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||vi.call(this,e,t)}function vi(e,t){let r=this.opts.uriResolver.parse(t),n=be._getFullPath(this.opts.uriResolver,r),o=be.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Il.call(this,r,e);let s=be.normalizeId(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=vi.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Il.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Al.call(this,i);if(s===be.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];if(u)o=be.resolveUrl(this.opts.uriResolver,o,u);return new Eo({schema:a,schemaId:c,root:e,baseId:o})}return Il.call(this,r,i)}U_.resolveSchema=vi;var ME=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Il(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let c=r[yi.unescapeFragment(a)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!ME.has(a)&&u)t=be.resolveUrl(this.opts.uriResolver,t,u)}let s;if(typeof r!="boolean"&&r.$ref&&!yi.schemaHasRulesButRef(r,this.RULES)){let a=be.resolveUrl(this.opts.uriResolver,t,r.$ref);s=vi.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Eo({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s;return}});var H_=z(function(sD,UE){UE.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 Dl=z(function(iD,Q_){var VE=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Nl=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),HE=RegExp.prototype.test.bind(/^\d*$/u),Ar=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),jl=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),J_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Zl=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),BE=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),He=Array(256);for(let t=0;t<256;t++)He[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Ne(e){if(e<2048)return He[192|e>>6]+He[128|e&63];if(e<65536)return He[224|e>>12]+He[128|e>>6&63]+He[128|e&63];return He[240|e>>18]+He[128|e>>12&63]+He[128|e>>6&63]+He[128|e&63]}function JE(e){let t="",r=0,n=0;for(n=0;n<e.length;n++){if(r=e[n].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var KE=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),GE=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),WE=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),XE=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function YE(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(WE(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Ar(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function B_(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(n===-1)n=a;if(o++,o>r)r=o,t=n}else n=-1,o=0;if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function QE(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!Nl(c))return;s+=2;continue}if(!KE(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1){if(s!==8)return;return B_(o)}if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<o.length;a++)i.push(o[a]);return B_(i)}function Cl(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&GE(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(eT(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(o=n.slice(s+a),!YE(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=QE(n);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function eT(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function K_(e){let t=e,r=[],n=-1,o=0;while(o=t.length){if(o===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(o===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(o===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function tT(e){if(e===""||e[0]==="/")return K_(e);let t=e.split("/"),r=t.length-1,n=[],o=!1;for(let s=0;s<=r;s++){let i=t[s];if(i==="."||i===".."){if(i==="..")if(n.length!==0&&n[n.length-1]!=="..")n.pop();else n.push("..");o=s===r}else n.push(i)}if(o&&n[n.length-1]!=="..")n.push("");if(n.length===0||n[0]===""||n[0].includes(":"))n.unshift(".");return n.join("/")}var rT={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},nT=/[@/?#:]/g,oT=/[@/?#]/g;function G_(e,t){let r=t?oT:nT;return r.lastIndex=0,e.replace(r,(n)=>rT[n])}function W_(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(Ar(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&jl(i))r+=i;else r+="%"+s;n+=2;continue}}r+=e[n]}return r}function sT(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Ar(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(i!=="."&&jl(i))t+=i;else t+="%"+s;r+=2;continue}}if(J_(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=Y_(o)?n:He[o];else if(o<55296||o>57343)t+=Ne(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=Ne(65536+(o-55296<<10)+(s-56320)),r++;else t+=Ne(65533)}else t+=Ne(65533)}}return t}function iT(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let s=e[o];if(s==="%"&&o+2<e.length){let i=e.slice(o+1,o+3);if(Ar(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/")n=!1;if(J_(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=He[i];else if(i<55296||i>57343)r+=Ne(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);if(a>=56320&&a<=57343)r+=Ne(65536+(i-55296<<10)+(a-56320)),o++;else r+=Ne(65533)}else r+=Ne(65533)}}return r}function Ml(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Ar(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=He[s];else if(s<55296||s>57343)r+=Ne(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);if(i>=56320&&i<=57343)r+=Ne(65536+(s-55296<<10)+(i-56320)),n++;else r+=Ne(65533)}else r+=Ne(65533)}}return r}function X_(e){return Ml(e,BE)}function aT(e){return Ml(e,Zl)}function cT(e){return Ml(e,Zl)}function Y_(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function uT(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Ar(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(jl(i))t+=i;else t+="%"+s;r+=2;continue}}if(Zl(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=Y_(o)?n:He[o];else if(o<55296||o>57343)t+=Ne(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=Ne(65536+(o-55296<<10)+(s-56320)),r++;else t+=Ne(65533)}else t+=Ne(65533)}}return t}function lT(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Ar(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function dT(e){let t=[];if(e.userinfo!==void 0)t.push(X_(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Nl(r)){let n=Cl(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=W_(r,!0),n=Cl(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=G_(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!HE(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}Q_.exports={nonSimpleDomain:XE,recomposeAuthority:dT,reescapeHostDelimiters:G_,normalizePercentEncoding:W_,normalizePathEncoding:sT,serializePathEncoding:iT,normalizeQueryFragmentEncoding:uT,encodeUserinfo:X_,encodeQuery:aT,encodeFragment:cT,escapePreservingEscapes:lT,removeDotSegments:K_,removeDotSegmentsRelative:tT,isIPv4:Nl,isUUID:VE,normalizeIPv6:Cl,stringArrayToHexStripped:JE}});var oy=z(function(aD,ny){var{isUUID:pT}=Dl(),fT=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,mT=["http","https","ws","wss","urn","urn:uuid"];function hT(e){return mT.indexOf(e)!==-1}function ql(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function ey(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function ty(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function gT(e){return e.secure=ql(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function _T(e){if(e.port===(ql(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function yT(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(fT);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=Ll(o);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function vT(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=Ll(o);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function xT(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!pT(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function bT(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var ry={scheme:"http",domainHost:!0,parse:ey,serialize:ty},$T={scheme:"https",domainHost:ry.domainHost,parse:ey,serialize:ty},bi={scheme:"ws",domainHost:!0,parse:gT,serialize:_T},wT={scheme:"wss",domainHost:bi.domainHost,parse:bi.parse,serialize:bi.serialize},kT={scheme:"urn",parse:yT,serialize:vT,skipNormalize:!0},ST={scheme:"urn:uuid",parse:xT,serialize:bT,skipNormalize:!0},$i={http:ry,https:$T,ws:bi,wss:wT,urn:kT,"urn:uuid":ST};Object.setPrototypeOf($i,null);function Ll(e){return e&&($i[e]||$i[e.toLowerCase()])||void 0}ny.exports={wsIsSecure:ql,SCHEMES:$i,isValidSchemeName:hT,getSchemeHandler:Ll}});var yy=z(function(cD,zi){var{normalizeIPv6:uy,removeDotSegments:Ro,removeDotSegmentsRelative:ly,recomposeAuthority:zT,normalizePercentEncoding:Fl,normalizePathEncoding:PT,serializePathEncoding:sy,normalizeQueryFragmentEncoding:iy,encodeQuery:ET,encodeFragment:TT,reescapeHostDelimiters:RT,isIPv4:dy,nonSimpleDomain:OT}=Dl(),{SCHEMES:py,getSchemeHandler:Ul}=oy(),fy=/^[A-Za-z][A-Za-z0-9+.-]*$/u,IT=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function ay(e){let t=String(e);if(!fy.test(t))throw TypeError("URI scheme is malformed.");return t}function AT(e,t){if(typeof e==="string")e=FT(e,t);else if(typeof e==="object")e=ki(Cr(e,t),t);return e}function CT(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=wi(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:p,malformedHost:f,malformedScheme:h}=wi(t,n);if(s||d||i||m||a||p||c||f||u||h)throw Error(o.error||l.error||"URI is malformed.");let g=my(o,l,n,!0),v=Ul(r&&r.scheme||g.scheme),T=g.host,M=T!==void 0&&T!==""&&(dy(T)||uy(T).isIPV6);if(gy(g,r||{},v,M))throw Error("URI host is malformed.");hy(g,r||{},v,M);let Y=T&&T.indexOf("%")!==-1&&!/\P{ASCII}/u.test(T);if(g.error&&!Y)throw Error(g.error);return n.skipEscape=!0,Cr(g,n)}function my(e,t,r,n){let o={};if(!n)e=ki(Cr(e,r),r),t=ki(Cr(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Ro(t.path||""),o.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Ro(t.path||""),o.query=t.query;else{if(!t.path)if(o.path=e.path,t.query!==void 0)o.query=t.query;else o.query=e.query;else{if(t.path[0]==="/")o.path=Ro(t.path);else{let s=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(s&&!e.path)o.path="/"+t.path;else if(!e.path)o.path=t.path;else o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;o.path=e.scheme===void 0&&!s&&o.path[0]!=="/"?ly(o.path):Ro(o.path)}o.query=t.query}o.userinfo=e.userinfo,o.host=e.host,o.port=e.port}o.scheme=e.scheme}return o.fragment=t.fragment,o}function NT(e,t,r){let n=cy(e,r),o=cy(t,r);return n!==void 0&&o!==void 0&&n===o}function Cr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[];if(r.scheme)r.scheme=ay(r.scheme);let s=Ul(n.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=(r.scheme===void 0||n.reference==="suffix")&&!i,c=!n.skipEscape&&a;if(r.path!==void 0)if(!n.skipEscape)r.path=sy(r.path,c);else r.path=Fl(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=ay(r.scheme),o.push(r.scheme,":");let u=zT(r);if(u!==void 0){if(n.reference!=="suffix")o.push("//");if(o.push(u),r.path&&r.path[0]!=="/")o.push("/")}if(r.path!==void 0){let l=r.path;if(!n.absolutePath&&(!s||!s.absolutePath))l=a&&l[0]!=="/"?ly(l):Ro(l);if(a)l=sy(l,!0);if(u===void 0&&l[0]==="/"&&l[1]==="/")l="/%2F"+l.slice(2);o.push(l)}if(r.query!==void 0)o.push("?",ET(r.query));if(r.fragment!==void 0)o.push("#",TT(r.fragment));return o.join("")}var jT=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,ZT=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,MT=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function DT(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function To(e){if(e===void 0)return!1;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Si(e){return e[0]==="["&&e[e.length-1]==="]"}function qT(e){let t=e[4];return To(e[3])||t!==void 0&&!Si(t)&&To(t)||To(e[6])||To(e[7])||To(e[8])}function hy(e,t,r,n){if(gy(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Si(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&OT(e.host)){let o;try{o=new URL("http://"+e.host)}catch(s){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+s,!0}if(!LT(o))return e.error=e.error||"URI host is malformed.",!0;e.host=o.hostname}return!1}function gy(e,t,r,n){return Boolean(e.host&&n===!1&&!Si(e.host)&&(t.domainHost||r&&r.domainHost)&&IT.test(e.host))}function LT(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function wi(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let d=e.match(ZT);if(d!==null&&d[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",o=!0;let m=e.match(MT);if(m!==null){let f=m[1],h=f.replace(/[\t\n\r]/g,"");if(h.length>=2){if(h.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",o=!0;else if(f.length!==h.length)n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0}}let p=e.match(jT);if(p){if(n.scheme=p[1],n.userinfo=p[3],n.host=p[4],n.port=parseInt(p[5],10),n.path=p[6]||"",n.query=p[7],n.fragment=p[8],n.scheme!==void 0)if(fy.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",u=!0;if(s=qT(p),s)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=p[5];let f=DT(n,p);if(f!==void 0)n.error=n.error||f,o=!0;if(n.host)if(dy(n.host)===!1){let v=Si(n.host),T=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,M=uy(n.host);if(l=M.isIPV6||M.isIPVFuture===!0,c=T&&(!v||M.error===!0),n.host=l?M.host:M.host.toLowerCase(),c)n.error=n.error||"URI host is malformed.",o=!0}else l=!0;if(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";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let h=Ul(r.scheme||n.scheme);if(!c)a=hy(n,r,h,l);if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let g=l?n.host:Fl(n.host,!0);if(!l)g=Fl(g.toLowerCase());n.host=l||r.scheme!=="null"?RT(g,l):g}if(!h||h&&!h.skipNormalize){if(n.path)n.path=PT(n.path);if(n.query)n.query=iy(n.query);if(n.fragment)n.fragment=iy(n.fragment)}if(h&&h.parse){if(h.parse(n,r),h===py.urn&&n.nid===void 0)i=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function ki(e,t){return wi(e,t).parsed}function FT(e,t){return _y(e,t).normalized}function _y(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=wi(e,t);return{normalized:n||o||s||i||a?e:Cr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function cy(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:Cr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=_y(r,t);return o||s||i||a||c?void 0:n}var Vl={SCHEMES:py,normalize:AT,resolve:CT,resolveComponent:my,equal:NT,serialize:Cr,parse:ki};zi.exports=Vl;zi.exports.default=Vl;zi.exports.fastUri=Vl});var by=z(function(xy){Object.defineProperty(xy,"__esModule",{value:!0});var vy=yy();vy.code='require("ajv/dist/runtime/uri").default';xy.default=vy});var Oy=z(function(Ft){Object.defineProperty(Ft,"__esModule",{value:!0});Ft.CodeGen=Ft.Name=Ft.nil=Ft.stringify=Ft.str=Ft._=Ft.KeywordCxt=void 0;var VT=zo();Object.defineProperty(Ft,"KeywordCxt",{enumerable:!0,get:function(){return VT.KeywordCxt}});var pn=B();Object.defineProperty(Ft,"_",{enumerable:!0,get:function(){return pn._}});Object.defineProperty(Ft,"str",{enumerable:!0,get:function(){return pn.str}});Object.defineProperty(Ft,"stringify",{enumerable:!0,get:function(){return pn.stringify}});Object.defineProperty(Ft,"nil",{enumerable:!0,get:function(){return pn.nil}});Object.defineProperty(Ft,"Name",{enumerable:!0,get:function(){return pn.Name}});Object.defineProperty(Ft,"CodeGen",{enumerable:!0,get:function(){return pn.CodeGen}});var HT=_i(),zy=Po(),Py=bl(),wt=xi(),Ey=B(),kt=So(),ir=ko(),dn=Q(),$y=H_(),BT=by(),Ty=(e,t)=>new RegExp(e,t);Ty.code="new RegExp";var JT=["removeAdditional","useDefaults","coerceTypes"],KT=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),GT={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."},WT={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},wy=200;function XT(e){var t,r,n,o,s,i,a,c,u,l,d,m,p,f,h,g,v,T,M,Y,C,K,ke,vr,Nr;let At=e.strict,jr=(t=e.code)===null||t===void 0?void 0:t.optimize,No=jr===!0||jr===void 0?1:jr||0,jo=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Ty,xb=(o=e.uriResolver)!==null&&o!==void 0?o:BT.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:At)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:At)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:At)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:At)!==null&&m!==void 0?m:"log",strictRequired:(f=(p=e.strictRequired)!==null&&p!==void 0?p:At)!==null&&f!==void 0?f:!1,code:e.code?{...e.code,optimize:No,regExp:jo}:{optimize:No,regExp:jo},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:wy,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:wy,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(T=e.messages)!==null&&T!==void 0?T:!0,inlineRefs:(M=e.inlineRefs)!==null&&M!==void 0?M:!0,schemaId:(Y=e.schemaId)!==null&&Y!==void 0?Y:"$id",addUsedSchema:(C=e.addUsedSchema)!==null&&C!==void 0?C:!0,validateSchema:(K=e.validateSchema)!==null&&K!==void 0?K:!0,validateFormats:(ke=e.validateFormats)!==null&&ke!==void 0?ke:!0,unicodeRegExp:(vr=e.unicodeRegExp)!==null&&vr!==void 0?vr:!0,int32range:(Nr=e.int32range)!==null&&Nr!==void 0?Nr:!0,uriResolver:xb}}class Pi{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...XT(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new Ey.ValueScope({scope:{},prefixes:KT,es5:t,lines:r}),this.logger=nR(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=Py.getRules(),ky.call(this,GT,e,"NOT SUPPORTED"),ky.call(this,WT,e,"DEPRECATED","warn"),this._metaOpts=tR.call(this),e.formats)QT.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)eR.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);YT.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=$y;if(r==="id")n={...$y},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(u,l){await o.call(this,u.$schema);let d=this._addSchema(u,l);return d.validate||s.call(this,d)}async function o(u){if(u&&!this.getSchema(u))await n.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(l){if(!(l instanceof zy.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,u)}}function i({missingSchema:u,missingRef:l}){if(this.refs[u])throw Error(`AnySchema ${u} is loaded but ${l} cannot be resolved`)}async function a(u){let l=await c.call(this,u);if(!this.refs[u])await o.call(this,l.$schema);if(!this.refs[u])this.addSchema(l,u,t)}async function c(u){let l=this._loading[u];if(l)return l;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,n);return this}let o;if(typeof e==="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw Error(`schema ${s} must be string`)}return t=kt.normalizeId(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(r,e);if(!n&&t){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw Error(o)}return n}getSchema(e){let t;while(typeof(t=Sy.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new wt.SchemaEnv({schema:{},schemaId:r});if(t=wt.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}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 t=Sy.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=kt.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(sR.call(this,r,t),!t)return dn.eachItem(r,(o)=>Hl.call(this,o)),this;aR.call(this,t);let n={...t,type:ir.getJSONTypes(t.type),schemaType:ir.getJSONTypes(t.schemaType)};return dn.eachItem(r,n.type.length===0?(o)=>Hl.call(this,o,n):(o)=>n.type.forEach((s)=>Hl.call(this,o,n,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let n=r.rules.findIndex((o)=>o.keyword===e);if(n>=0)r.rules.splice(n,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,o)=>n+t+o)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let o=n.split("/").slice(1),s=e;for(let i of o)s=s[i];for(let i in r){let a=r[i];if(typeof a!="object")continue;let{$data:c}=a.definition,u=s[i];if(c&&u)s[i]=Ry(u)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=kt.normalizeId(s||r);let c=kt.getSchemaRefs.call(this,e,r);if(a=new wt.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:c}),this._cache.set(a.schema,a),o&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else wt.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{wt.compileSchema.call(this,e)}finally{this.opts=t}}}Pi.ValidationError=HT.default;Pi.MissingRefError=zy.default;Ft.default=Pi;function ky(e,t,r,n="error"){for(let o in e){let s=o;if(s in t)this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function Sy(e){return e=kt.normalizeId(e),this.schemas[e]||this.refs[e]}function YT(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function QT(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function eR(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function tR(){let e={...this.opts};for(let t of JT)delete e[t];return e}var rR={log(){},warn(){},error(){}};function nR(e){if(e===!1)return rR;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var oR=/^[a-z_$][a-z0-9_$:-]*$/i;function sR(e,t){let{RULES:r}=this;if(dn.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!oR.test(n))throw Error(`Keyword ${n} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function Hl(e,t,r){var n;let o=t===null||t===void 0?void 0:t.post;if(r&&o)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(!i)i={type:r,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:ir.getJSONTypes(t.type),schemaType:ir.getJSONTypes(t.schemaType)}};if(t.before)iR.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((c)=>this.addKeyword(c))}function iR(e,t,r){let n=e.rules.findIndex((o)=>o.keyword===r);if(n>=0)e.rules.splice(n,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function aR(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=Ry(t);e.validateSchema=this.compile(t,!0)}var cR={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ry(e){return{anyOf:[e,cR]}}});var Ay=z(function(Iy){Object.defineProperty(Iy,"__esModule",{value:!0});var dR={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Iy.default=dR});var Zy=z(function(Ny){Object.defineProperty(Ny,"__esModule",{value:!0});Ny.callRef=Ny.getValidate=void 0;var fR=Po(),Ti=st(),ie=B(),fn=Lt(),Ri=xi(),ar=Q(),mR={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=Ri.resolveRef.call(c,u,o,r);if(l===void 0)throw new fR.default(n.opts.uriResolver,o,r);if(l instanceof Ri.SchemaEnv)return m(l);return p(l);function d(){if(s===u)return Ei(e,i,s,s.$async);let f=t.scopeValue("root",{ref:u});return Ei(e,ie._`${f}.validate`,u,u.$async)}function m(f){let h=Cy(e,f);Ei(e,h,f,f.$async)}function p(f){let h=t.scopeValue("schema",a.code.source===!0?{ref:f,code:ie.stringify(f)}:{ref:f}),g=t.name("valid"),v=e.subschema({schema:f,dataTypes:[],schemaPath:ie.nil,topSchemaRef:h,errSchemaPath:r},g);e.mergeEvaluated(v),e.ok(g)}}};function Cy(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):ie._`${r.scopeValue("wrapper",{ref:t})}.validate`}Ny.getValidate=Cy;function Ei(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?fn.default.this:ie.nil;if(n)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let f=o.let("valid");o.try(()=>{if(o.code(ie._`await ${Ti.callValidateCode(e,t,u)}`),p(t),!i)o.assign(f,!0)},(h)=>{if(o.if(ie._`!(${h} instanceof ${s.ValidationError})`,()=>o.throw(h)),m(h),!i)o.assign(f,!1)}),e.ok(f)}function d(){e.result(Ti.callValidateCode(e,t,u),()=>p(t),()=>m(t))}function m(f){let h=ie._`${f}.errors`;o.assign(fn.default.vErrors,ie._`${fn.default.vErrors} === null ? ${h} : ${fn.default.vErrors}.concat(${h})`),o.assign(fn.default.errors,ie._`${fn.default.vErrors}.length`)}function p(f){var h;if(!s.opts.unevaluated)return;let g=(h=r===null||r===void 0?void 0:r.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(g&&!g.dynamicProps){if(g.props!==void 0)s.props=ar.mergeEvaluated.props(o,g.props,s.props)}else{let v=o.var("props",ie._`${f}.evaluated.props`);s.props=ar.mergeEvaluated.props(o,v,s.props,ie.Name)}if(s.items!==!0)if(g&&!g.dynamicItems){if(g.items!==void 0)s.items=ar.mergeEvaluated.items(o,g.items,s.items)}else{let v=o.var("items",ie._`${f}.evaluated.items`);s.items=ar.mergeEvaluated.items(o,v,s.items,ie.Name)}}}Ny.callRef=Ei;Ny.default=mR});var Dy=z(function(My){Object.defineProperty(My,"__esModule",{value:!0});var _R=Ay(),yR=Zy(),vR=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",_R.default,yR.default];My.default=vR});var Ly=z(function(qy){Object.defineProperty(qy,"__esModule",{value:!0});var ur=B(),cr=ur.operators,Oi={maximum:{okStr:"<=",ok:cr.LTE,fail:cr.GT},minimum:{okStr:">=",ok:cr.GTE,fail:cr.LT},exclusiveMaximum:{okStr:"<",ok:cr.LT,fail:cr.GTE},exclusiveMinimum:{okStr:">",ok:cr.GT,fail:cr.LTE}},bR={message:({keyword:e,schemaCode:t})=>ur.str`must be ${Oi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>ur._`{comparison: ${Oi[e].okStr}, limit: ${t}}`},$R={keyword:Object.keys(Oi),type:"number",schemaType:"number",$data:!0,error:bR,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(ur._`${r} ${Oi[t].fail} ${n} || isNaN(${r})`)}};qy.default=$R});var Uy=z(function(Fy){Object.defineProperty(Fy,"__esModule",{value:!0});var St=B(),kR={message:({schemaCode:e})=>St.str`must be multiple of ${e}`,params:({schemaCode:e})=>St._`{multipleOf: ${e}}`},SR={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:kR,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?St._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:St._`${i} !== parseInt(${i})`;e.fail$data(St._`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Fy.default=SR});var By=z(function(Hy){Object.defineProperty(Hy,"__esModule",{value:!0});function Vy(e){let t=e.length,r=0,n=0,o;while(n<t)if(r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t){if(o=e.charCodeAt(n),(o&64512)===56320)n++}return r}Hy.default=Vy;Vy.code='require("ajv/dist/runtime/ucs2length").default'});var Gy=z(function(Ky){Object.defineProperty(Ky,"__esModule",{value:!0});var Be=B(),Jy=Q(),ER=By(),TR={message({keyword:e,schemaCode:t}){return Be.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Be._`{limit: ${e}}`},RR={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:TR,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?Be.operators.GT:Be.operators.LT,i=o.opts.unicode===!1?Be._`${r}.length`:Be._`${Jy.useFunc(e.gen,ER.default)}(${r})`;e.fail$data(Be._`${i} ${s} ${n}`)}};Ky.default=RR});var Qy=z(function(Yy){Object.defineProperty(Yy,"__esModule",{value:!0});var Wy=st(),Xy=Q(),it=B(),IR={message:({schemaCode:e})=>it.str`must match pattern "${e}"`,params:({schemaCode:e})=>it._`{pattern: ${e}}`},AR={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:IR,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?it._`new RegExp`:Xy.useFunc(t,c),l=t.let("valid");t.try(()=>t.assign(l,it._`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(it._`!${l}`)}else{let c=Wy.usePattern(e,o);e.fail$data(it._`!${c}.test(${r})`)}}};Yy.default=AR});var tv=z(function(ev){Object.defineProperty(ev,"__esModule",{value:!0});var zt=B(),NR={message({keyword:e,schemaCode:t}){return zt.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>zt._`{limit: ${e}}`},jR={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:NR,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?zt.operators.GT:zt.operators.LT;e.fail$data(zt._`Object.keys(${r}).length ${o} ${n}`)}};ev.default=jR});var ov=z(function(nv){Object.defineProperty(nv,"__esModule",{value:!0});var Pt=st(),Et=B(),rv=Q(),MR={message:({params:{missingProperty:e}})=>Et.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Et._`{missingProperty: ${e}}`},DR={keyword:"required",type:"object",schemaType:"array",$data:!0,error:MR,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors)u();else l();if(a.strictRequired){let p=e.parentSchema.properties,{definedProperties:f}=e.it;for(let h of r)if((p===null||p===void 0?void 0:p[h])===void 0&&!f.has(h)){let g=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${h}" is not defined at "${g}" (strictRequired)`;rv.checkStrictMode(i,v,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(Et.nil,d);else for(let p of r)Pt.checkReportMissingProp(e,p)}function l(){let p=t.let("missing");if(c||s){let f=t.let("valid",!0);e.block$data(f,()=>m(p,f)),e.ok(f)}else t.if(Pt.checkMissingProp(e,r,p)),Pt.reportMissingProp(e,p),t.else()}function d(){t.forOf("prop",n,(p)=>{e.setParams({missingProperty:p}),t.if(Pt.noPropertyInData(t,o,p,a.ownProperties),()=>e.error())})}function m(p,f){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(f,Pt.propertyInData(t,o,p,a.ownProperties)),t.if(Et.not(f),()=>{e.error(),t.break()})},Et.nil)}}};nv.default=DR});var iv=z(function(sv){Object.defineProperty(sv,"__esModule",{value:!0});var Tt=B(),LR={message({keyword:e,schemaCode:t}){return Tt.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Tt._`{limit: ${e}}`},FR={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:LR,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Tt.operators.GT:Tt.operators.LT;e.fail$data(Tt._`${r}.length ${o} ${n}`)}};sv.default=FR});var Ii=z(function(cv){Object.defineProperty(cv,"__esModule",{value:!0});var av=El();av.code='require("ajv/dist/runtime/equal").default';cv.default=av});var dv=z(function(lv){Object.defineProperty(lv,"__esModule",{value:!0});var mn=ko(),ee=B(),uv=Q(),HR=Ii(),BR={message:({params:{i:e,j:t}})=>ee.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>ee._`{i: ${e}, j: ${t}}`},JR={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:BR,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?mn.getSchemaTypes(s.items):[];e.block$data(c,l,ee._`${i} === false`),e.ok(c);function l(){let f=t.let("i",ee._`${r}.length`),h=t.let("j");e.setParams({i:f,j:h}),t.assign(c,!0),t.if(ee._`${f} > 1`,()=>(d()?m:p)(f,h))}function d(){return u.length>0&&!u.some((f)=>f==="object"||f==="array")}function m(f,h){let g=t.name("item"),v=mn.checkDataTypes(u,g,a.opts.strictNumbers,mn.DataType.Wrong),T=t.const("indices",ee._`{}`);t.for(ee._`;${f}--;`,()=>{if(t.let(g,ee._`${r}[${f}]`),t.if(v,ee._`continue`),u.length>1)t.if(ee._`typeof ${g} == "string"`,ee._`${g} += "_"`);t.if(ee._`typeof ${T}[${g}] == "number"`,()=>{t.assign(h,ee._`${T}[${g}]`),e.error(),t.assign(c,!1).break()}).code(ee._`${T}[${g}] = ${f}`)})}function p(f,h){let g=uv.useFunc(t,HR.default),v=t.name("outer");t.label(v).for(ee._`;${f}--;`,()=>t.for(ee._`${h} = ${f}; ${h}--;`,()=>t.if(ee._`${g}(${r}[${f}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};lv.default=JR});var mv=z(function(fv){Object.defineProperty(fv,"__esModule",{value:!0});var hn=B(),pv=Q(),GR=Ii(),WR={message:"must be equal to constant",params:({schemaCode:e})=>hn._`{allowedValue: ${e}}`},XR={keyword:"const",$data:!0,error:WR,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;if(n||s&&typeof s=="object")e.fail$data(hn._`!${pv.useFunc(t,GR.default)}(${r}, ${o})`);else e.fail(hn._`${s} !== ${r}`)}};fv.default=XR});var _v=z(function(gv){Object.defineProperty(gv,"__esModule",{value:!0});var Rt=B(),hv=Q(),QR=Ii(),eO={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Rt._`{allowedValues: ${e}}`},tO={keyword:"enum",schemaType:"array",$data:!0,error:eO,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c!==null&&c!==void 0?c:c=hv.useFunc(t,QR.default),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw Error("ajv implementation error");let p=t.const("vSchema",s);l=Rt.or(...o.map((f,h)=>m(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(p)=>t.if(Rt._`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function m(p,f){let h=o[f];return typeof h==="object"&&h!==null?Rt._`${u()}(${r}, ${p}[${f}])`:Rt._`${r} === ${h}`}}};gv.default=tO});var vv=z(function(yv){Object.defineProperty(yv,"__esModule",{value:!0});var nO=Ly(),oO=Uy(),sO=Gy(),iO=Qy(),aO=tv(),cO=ov(),uO=iv(),lO=dv(),dO=mv(),pO=_v(),fO=[nO.default,oO.default,sO.default,iO.default,aO.default,cO.default,uO.default,lO.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},dO.default,pO.default];yv.default=fO});var Bl=z(function(bv){Object.defineProperty(bv,"__esModule",{value:!0});bv.validateAdditionalItems=void 0;var Je=B(),gn=Q(),hO={message:({params:{len:e}})=>Je.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Je._`{limit: ${e}}`},gO={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:hO,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){gn.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}xv(e,n)}};function xv(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",Je._`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(Je._`${a} <= ${t.length}`);else if(typeof n=="object"&&!gn.alwaysValidSchema(i,n)){let u=r.var("valid",Je._`${a} <= ${t.length}`);r.if(Je.not(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:gn.Type.Num},u),!i.allErrors)r.if(Je.not(u),()=>r.break())})}}bv.validateAdditionalItems=xv;bv.default=gO});var Jl=z(function(Sv){Object.defineProperty(Sv,"__esModule",{value:!0});Sv.validateTuple=void 0;var Ai=B(),lr=Q(),wv=st(),yO={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return kv(e,"additionalItems",t);if(r.items=!0,lr.alwaysValidSchema(r,t))return;e.ok(wv.validateArray(e))}};function kv(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;if(l(o),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=lr.mergeEvaluated.items(n,r.length,a.items);let c=n.name("valid"),u=n.const("len",Ai._`${s}.length`);r.forEach((d,m)=>{if(lr.alwaysValidSchema(a,d))return;n.if(Ai._`${u} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c)});function l(d){let{opts:m,errSchemaPath:p}=a,f=r.length,h=f===d.minItems&&(f===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let g=`"${i}" is ${f}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;lr.checkStrictMode(a,g,m.strictTuples)}}}Sv.validateTuple=kv;Sv.default=yO});var Tv=z(function(Ev){Object.defineProperty(Ev,"__esModule",{value:!0});var Pv=Jl(),xO={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>Pv.validateTuple(e,"items")};Ev.default=xO});var Cv=z(function(Av){Object.defineProperty(Av,"__esModule",{value:!0});var Ci=B(),Rv=Q(),Ov=st(),Iv=Bl(),$O={message:({params:{len:e}})=>Ci.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Ci._`{limit: ${e}}`},wO={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:$O,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;if(n.items=!0,Rv.alwaysValidSchema(n,t))return;if(o)Iv.validateAdditionalItems(e,o);else e.ok(Ov.validateArray(e))}};Av.default=wO});var jv=z(function(Nv){Object.defineProperty(Nv,"__esModule",{value:!0});var ge=B(),dr=Q(),SO={message:({params:{min:e,max:t}})=>t===void 0?ge.str`must contain at least ${e} valid item(s)`:ge.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ge._`{minContains: ${e}}`:ge._`{minContains: ${e}, maxContains: ${t}}`},zO={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:SO,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;if(s.opts.next)i=c===void 0?1:c,a=u;else i=1;let l=t.const("len",ge._`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){dr.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){dr.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(dr.alwaysValidSchema(s,r)){let h=ge._`${l} >= ${i}`;if(a!==void 0)h=ge._`${h} && ${l} <= ${a}`;e.pass(h);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)p(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(ge._`${o}.length > 0`,m)}else t.let(d,!1),m();e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),g=t.let("count",0);p(h,()=>t.if(h,()=>f(g)))}function p(h,g){t.forRange("i",0,l,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:dr.Type.Num,compositeRule:!0},h),g()})}function f(h){if(t.code(ge._`${h}++`),a===void 0)t.if(ge._`${h} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(ge._`${h} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(ge._`${h} >= ${i}`,()=>t.assign(d,!0))}}};Nv.default=zO});var Uv=z(function(qv){Object.defineProperty(qv,"__esModule",{value:!0});qv.validateSchemaDeps=qv.validatePropertyDeps=qv.error=void 0;var _n=B(),Zv=Q(),Ot=st();qv.error={message:({params:{property:e,depsCount:t,deps:r}})=>_n.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>_n._`{property: ${e},
|
|
7
7
|
missingProperty: ${n},
|
|
8
8
|
depsCount: ${t},
|
|
9
|
-
deps: ${r}}`};var EO={keyword:"dependencies",type:"object",schemaType:"object",error:qv.error,code(e){let[t,r]=TO(e);Mv(e,t),Dv(e,r)}};function TO({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function Mv(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=Ot.propertyInData(r,n,i,o.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors)r.if(c,()=>{for(let u of a)Ot.checkReportMissingProp(e,u)});else r.if(_n._`${c} && (${Ot.checkMissingProp(e,a,s)})`),Ot.reportMissingProp(e,s),r.else()}}qv.validatePropertyDeps=Mv;function Dv(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t){if(Zv.alwaysValidSchema(s,t[a]))continue;r.if(Ot.propertyInData(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i)}}qv.validateSchemaDeps=Dv;qv.default=EO});var Bv=z(function(Hv){Object.defineProperty(Hv,"__esModule",{value:!0});var Ni=B(),Vv=Q(),IO={message:"property name must be valid",params:({params:e})=>Ni._`{propertyName: ${e.propertyName}}`},AO={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:IO,code(e){let{gen:t,schema:r,data:n,it:o}=e;if(Vv.alwaysValidSchema(o,r))return;let s=t.name("valid");t.forIn("key",n,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if(Ni.not(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};Hv.default=AO});var Jl=z(function(Jv){Object.defineProperty(Jv,"__esModule",{value:!0});var pr=st(),$e=B(),NO=Lt(),fr=Q(),jO={message:"must NOT have additional properties",params:({params:e})=>$e._`{additionalProperty: ${e.additionalProperty}}`},ZO={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:jO,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&fr.alwaysValidSchema(i,r))return;let u=pr.allSchemaProperties(n.properties),l=pr.allSchemaProperties(n.patternProperties);d(),e.ok($e._`${s} === ${NO.default.errors}`);function d(){t.forIn("key",o,(g)=>{if(!u.length&&!l.length)f(g);else t.if(m(g),()=>f(g))})}function m(g){let v;if(u.length>8){let T=fr.schemaRefOrVal(i,n.properties,"properties");v=pr.isOwnProperty(t,T,g)}else if(u.length)v=$e.or(...u.map((T)=>$e._`${g} === ${T}`));else v=$e.nil;if(l.length)v=$e.or(v,...l.map((T)=>$e._`${pr.usePattern(e,T)}.test(${g})`));return $e.not(v)}function p(g){t.code($e._`delete ${o}[${g}]`)}function f(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(g);return}if(r===!1){if(e.setParams({additionalProperty:g}),e.error(),!a)t.break();return}if(typeof r=="object"&&!fr.alwaysValidSchema(i,r)){let v=t.name("valid");if(c.removeAdditional==="failing")h(g,v,!1),t.if($e.not(v),()=>{e.reset(),p(g)});else if(h(g,v),!a)t.if($e.not(v),()=>t.break())}}function h(g,v,T){let M={keyword:"additionalProperties",dataProp:g,dataPropType:fr.Type.Str};if(T===!1)Object.assign(M,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(M,v)}}};Jv.default=ZO});var Xv=z(function(Wv){Object.defineProperty(Wv,"__esModule",{value:!0});var Gv=zo(),ji=st(),yn=Q(),Kv=Jl(),DO={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;if(s.opts.removeAdditional==="all"&&n.additionalProperties===void 0)Kv.default.code(new Gv.KeywordCxt(s,Kv.default,"additionalProperties"));let i=ji.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=yn.mergeEvaluated.props(t,yn.toHash(i),s.props);let a=i.filter((d)=>!yn.alwaysValidSchema(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a){if(u(d))l(d);else{if(t.if(ji.propertyInData(t,o,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(c)}function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Wv.default=DO});var Qv=z(function(Yv){Object.defineProperty(Yv,"__esModule",{value:!0});var Zi=st(),mr=B(),Mi=Q(),Di=Q(),LO={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=Zi.allSchemaProperties(r),c=a.filter((h)=>Mi.alwaysValidSchema(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof mr.Name))s.props=Di.evaluatedPropsToName(t,s.props);let{props:d}=s;m();function m(){for(let h of a){if(u)p(h);if(s.allErrors)f(h);else t.var(l,!0),f(h),t.if(l)}}function p(h){for(let g in u)if(new RegExp(h).test(g))Mi.checkStrictMode(s,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function f(h){t.forIn("key",n,(g)=>{t.if(mr._`${Zi.usePattern(e,h)}.test(${g})`,()=>{let v=c.includes(h);if(!v)e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:Di.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(mr._`${d}[${g}]`,!0);else if(!v&&!s.allErrors)t.if(mr.not(l),()=>t.break())})})}}};Yv.default=LO});var rx=z(function(tx){Object.defineProperty(tx,"__esModule",{value:!0});var ex=Q(),UO={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(ex.alwaysValidSchema(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};tx.default=UO});var sx=z(function(ox){Object.defineProperty(ox,"__esModule",{value:!0});var nx=st(),HO={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:nx.validateUnion,error:{message:"must match a schema in anyOf"}};ox.default=HO});var cx=z(function(ax){Object.defineProperty(ax,"__esModule",{value:!0});var hr=B(),ix=Q(),JO={message:"must match exactly one schema in oneOf",params:({params:e})=>hr._`{passingSchemas: ${e.passing}}`},KO={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:JO,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let m;if(ix.alwaysValidSchema(o,l))t.var(c,!0);else m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(hr._`${c} && ${i}`).assign(i,!1).assign(a,hr._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,d),m)e.mergeEvaluated(m,hr.Name)})})}}};ax.default=KO});var dx=z(function(lx){Object.defineProperty(lx,"__esModule",{value:!0});var ux=Q(),WO={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if(ux.alwaysValidSchema(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};lx.default=WO});var mx=z(function(fx){Object.defineProperty(fx,"__esModule",{value:!0});var gr=B(),qi=Q(),YO={message:({params:e})=>gr.str`must match "${e.ifClause}" schema`,params:({params:e})=>gr._`{failingKeyword: ${e.ifClause}}`},QO={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:YO,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)qi.checkStrictMode(n,'"if" without "then" and "else" is ignored');let o=px(n,"then"),s=px(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else if(o)t.if(a,u("then"));else t.if(gr.not(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let m=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(m,i),d)t.assign(d,gr._`${l}`);else e.setParams({ifClause:l})}}}};function px(e,t){let r=e.schema[t];return r!==void 0&&!qi.alwaysValidSchema(e,r)}fx.default=QO});var _x=z(function(gx){Object.defineProperty(gx,"__esModule",{value:!0});var hx=Q(),tI={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)hx.checkStrictMode(r,`"${e}" without "if" is ignored`)}};gx.default=tI});var vx=z(function(yx){Object.defineProperty(yx,"__esModule",{value:!0});var nI=Hl(),oI=Tv(),sI=Bl(),iI=Cv(),aI=jv(),cI=Uv(),uI=Bv(),lI=Jl(),dI=Xv(),pI=Qv(),fI=rx(),mI=sx(),hI=cx(),gI=dx(),_I=mx(),yI=_x();function vI(e=!1){let t=[fI.default,mI.default,hI.default,gI.default,_I.default,yI.default,uI.default,lI.default,cI.default,dI.default,pI.default];if(e)t.push(oI.default,iI.default);else t.push(nI.default,sI.default);return t.push(aI.default),t}yx.default=vI});var bx=z(function(xx){Object.defineProperty(xx,"__esModule",{value:!0});var H=B(),bI={message:({schemaCode:e})=>H.str`must match format "${e}"`,params:({schemaCode:e})=>H._`{format: ${e}}`},$I={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:bI,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;if(o)m();else p();function m(){let f=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",H._`${f}[${i}]`),g=r.let("fType"),v=r.let("format");r.if(H._`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,H._`${h}.type || "string"`).assign(v,H._`${h}.validate`),()=>r.assign(g,H._`"string"`).assign(v,h)),e.fail$data(H.or(T(),M()));function T(){if(c.strictSchema===!1)return H.nil;return H._`${i} && !${v}`}function M(){let Y=l.$async?H._`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:H._`${v}(${n})`,C=H._`(typeof ${v} == "function" ? ${Y} : ${v}.test(${n}))`;return H._`${v} && ${v} !== true && ${g} === ${t} && !${C}`}}function p(){let f=d.formats[s];if(!f){T();return}if(f===!0)return;let[h,g,v]=M(f);if(h===t)e.pass(Y());function T(){if(c.strictSchema===!1){d.logger.warn(C());return}throw Error(C());function C(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function M(C){let K=C instanceof RegExp?H.regexpCode(C):c.code.formats?H._`${c.code.formats}${H.getProperty(s)}`:void 0,ke=r.scopeValue("formats",{key:s,ref:C,code:K});if(typeof C=="object"&&!(C instanceof RegExp))return[C.type||"string",C.validate,H._`${ke}.validate`];return["string",C,ke]}function Y(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!l.$async)throw Error("async format in sync schema");return H._`await ${v}(${n})`}return typeof g=="function"?H._`${v}(${n})`:H._`${v}.test(${n})`}}}};xx.default=$I});var wx=z(function($x){Object.defineProperty($x,"__esModule",{value:!0});var kI=bx(),SI=[kI.default];$x.default=SI});var zx=z(function(kx){Object.defineProperty(kx,"__esModule",{value:!0});kx.contentVocabulary=kx.metadataVocabulary=void 0;kx.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];kx.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Ex=z(function(Px){Object.defineProperty(Px,"__esModule",{value:!0});var EI=Dy(),TI=vv(),RI=vx(),OI=wx(),Li=zx(),II=[EI.default,TI.default,(0,RI.default)(),OI.default,Li.metadataVocabulary,Li.contentVocabulary];Px.default=II});var Ix=z(function(Rx){Object.defineProperty(Rx,"__esModule",{value:!0});Rx.DiscrError=void 0;var Tx;(function(e){e.Tag="tag",e.Mapping="mapping"})(Tx||(Rx.DiscrError=Tx={}))});var Nx=z(function(Cx){Object.defineProperty(Cx,"__esModule",{value:!0});var at=B(),vn=Ix(),Fi=xi(),CI=Po(),Ax=Q(),NI={message:({params:{discrError:e,tagName:t}})=>e===vn.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>at._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},jI={keyword:"discriminator",type:"object",schemaType:"object",error:NI,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",at._`${r}${at.getProperty(a)}`);t.if(at._`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:vn.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let p=m();t.if(!1);for(let f in p)t.elseIf(at._`${u} === ${f}`),t.assign(c,d(p[f]));t.else(),e.error(!1,{discrError:vn.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(p){let f=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},f);return e.mergeEvaluated(h,at.Name),f}function m(){var p;let f={},h=v(o),g=!0;for(let Y=0;Y<i.length;Y++){let C=i[Y];if((C===null||C===void 0?void 0:C.$ref)&&!Ax.schemaHasRulesButRef(C,s.self.RULES)){let ke=C.$ref;if(C=Fi.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,ke),C instanceof Fi.SchemaEnv)C=C.schema;if(C===void 0)throw new CI.default(s.opts.uriResolver,s.baseId,ke)}let K=(p=C===null||C===void 0?void 0:C.properties)===null||p===void 0?void 0:p[a];if(typeof K!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||v(C)),T(K,Y)}if(!g)throw Error(`discriminator: "${a}" must be required`);return f;function v({required:Y}){return Array.isArray(Y)&&Y.includes(a)}function T(Y,C){if(Y.const)M(Y.const,C);else if(Y.enum)for(let K of Y.enum)M(K,C);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function M(Y,C){if(typeof Y!="string"||Y in f)throw Error(`discriminator: "${a}" values must be unique strings`);f[Y]=C}}}};Cx.default=jI});var jx=z(function(QD,MI){MI.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 Gl=z(function(Ke,Kl){Object.defineProperty(Ke,"__esModule",{value:!0});Ke.MissingRefError=Ke.ValidationError=Ke.CodeGen=Ke.Name=Ke.nil=Ke.stringify=Ke.str=Ke._=Ke.KeywordCxt=Ke.Ajv=void 0;var DI=Oy(),qI=Ex(),LI=Nx(),Zx=jx(),FI=["/properties"],Ui="http://json-schema.org/draft-07/schema";class Oo extends DI.default{_addVocabularies(){if(super._addVocabularies(),qI.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(LI.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Zx,FI):Zx;this.addMetaSchema(e,Ui,!1),this.refs["http://json-schema.org/schema"]=Ui}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ui)?Ui:void 0)}}Ke.Ajv=Oo;Kl.exports=Ke=Oo;Kl.exports.Ajv=Oo;Object.defineProperty(Ke,"__esModule",{value:!0});Ke.default=Oo;var UI=zo();Object.defineProperty(Ke,"KeywordCxt",{enumerable:!0,get:function(){return UI.KeywordCxt}});var xn=B();Object.defineProperty(Ke,"_",{enumerable:!0,get:function(){return xn._}});Object.defineProperty(Ke,"str",{enumerable:!0,get:function(){return xn.str}});Object.defineProperty(Ke,"stringify",{enumerable:!0,get:function(){return xn.stringify}});Object.defineProperty(Ke,"nil",{enumerable:!0,get:function(){return xn.nil}});Object.defineProperty(Ke,"Name",{enumerable:!0,get:function(){return xn.Name}});Object.defineProperty(Ke,"CodeGen",{enumerable:!0,get:function(){return xn.CodeGen}});var VI=_i();Object.defineProperty(Ke,"ValidationError",{enumerable:!0,get:function(){return VI.default}});var HI=Po();Object.defineProperty(Ke,"MissingRefError",{enumerable:!0,get:function(){return HI.default}})});var Jx=z(function(Hx){Object.defineProperty(Hx,"__esModule",{value:!0});Hx.formatNames=Hx.fastFormats=Hx.fullFormats=void 0;function It(e,t){return{validate:e,compare:t}}Hx.fullFormats={date:It(Lx,Ql),time:It(Xl(!0),ed),"date-time":It(Mx(!0),Ux),"iso-time":It(Xl(),Fx),"iso-date-time":It(Mx(),Vx),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:QI,"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:i1,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:e1,int32:{type:"number",validate:n1},int64:{type:"number",validate:o1},float:{type:"number",validate:qx},double:{type:"number",validate:qx},password:!0,binary:!0};Hx.fastFormats={...Hx.fullFormats,date:It(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ql),time:It(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ed),"date-time":It(/^\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,Ux),"iso-time":It(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Fx),"iso-date-time":It(/^\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,Vx),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};Hx.formatNames=Object.keys(Hx.fullFormats);function KI(e){return e%4===0&&(e%100!==0||e%400===0)}var GI=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,WI=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Lx(e){let t=GI.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&KI(r)?29:WI[n])}function Ql(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Wl=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Xl(e){return function(r){let n=Wl.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function ed(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(!(r&&n))return;return r-n}function Fx(e,t){if(!(e&&t))return;let r=Wl.exec(e),n=Wl.exec(t);if(!(r&&n))return;if(e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t)return 1;if(e<t)return-1;return 0}var Yl=/t|\s/i;function Mx(e){let t=Xl(e);return function(n){let o=n.split(Yl);return o.length===2&&Lx(o[0])&&t(o[1])}}function Ux(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(!(r&&n))return;return r-n}function Vx(e,t){if(!(e&&t))return;let[r,n]=e.split(Yl),[o,s]=t.split(Yl),i=Ql(r,o);if(i===void 0)return;return i||ed(n,s)}var XI=/\/|:/,YI=/^(?:[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 QI(e){return XI.test(e)&&YI.test(e)}var Dx=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function e1(e){return Dx.lastIndex=0,Dx.test(e)}var t1=-2147483648,r1=2147483647;function n1(e){return Number.isInteger(e)&&e<=r1&&e>=t1}function o1(e){return Number.isInteger(e)}function qx(){return!0}var s1=/[^\\]\\Z/;function i1(e){if(s1.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var Wx=z(function(Gx){Object.defineProperty(Gx,"__esModule",{value:!0});Gx.formatLimitDefinition=void 0;var Kx=Gl(),we=B(),_r=we.operators,Vi={formatMaximum:{okStr:"<=",ok:_r.LTE,fail:_r.GT},formatMinimum:{okStr:">=",ok:_r.GTE,fail:_r.LT},formatExclusiveMaximum:{okStr:"<",ok:_r.LT,fail:_r.GTE},formatExclusiveMinimum:{okStr:">",ok:_r.GT,fail:_r.LTE}},c1={message:({keyword:e,schemaCode:t})=>we.str`should be ${Vi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>we._`{comparison: ${Vi[e].okStr}, limit: ${t}}`};Gx.formatLimitDefinition={keyword:Object.keys(Vi),type:"string",schemaType:"string",$data:!0,error:c1,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new Kx.KeywordCxt(s,a.RULES.all.format.definition,"format");if(c.$data)u();else l();function u(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),p=t.const("fmt",we._`${m}[${c.schemaCode}]`);e.fail$data(we.or(we._`typeof ${p} != "object"`,we._`${p} instanceof RegExp`,we._`typeof ${p}.compare != "function"`,d(p)))}function l(){let m=c.schema,p=a.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw Error(`"${o}": format "${m}" does not define "compare" function`);let f=t.scopeValue("formats",{key:m,ref:p,code:i.code.formats?we._`${i.code.formats}${we.getProperty(m)}`:void 0});e.fail$data(d(f))}function d(m){return we._`${m}.compare(${r}, ${n}) ${Vi[o].fail} 0`}},dependencies:["format"]};var u1=(e)=>(e.addKeyword(Gx.formatLimitDefinition),e);Gx.default=u1});var eb=z(function(Io,Qx){Object.defineProperty(Io,"__esModule",{value:!0});var ct=Jx(),d1=Wx(),bn=B(),Xx=new bn.Name("fullFormats"),p1=new bn.Name("fastFormats"),nd=(e,t={keywords:!0})=>{if(Array.isArray(t))return Yx(e,t,ct.fullFormats,Xx),e;let[r,n]=t.mode==="fast"?[ct.fastFormats,p1]:[ct.fullFormats,Xx],o=t.formats||ct.formatNames;if(Yx(e,o,r,n),t.keywords)(0,d1.default)(e);return e};nd.get=(e,t="full")=>{let n=(t==="fast"?ct.fastFormats:ct.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function Yx(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=bn._`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}Qx.exports=Io=nd;Object.defineProperty(Io,"__esModule",{value:!0});Io.default=nd});import{readFileSync as $1}from"node:fs";import eh from"node:process";function wn(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Ji(e,t="|"){return e.map((r)=>Gi(r)).join(t)}function kn(e,t){if(typeof t==="bigint")return t.toString();return t}class gd{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Sn(e){return new gd(e)}function _d(e){return e===null||e===void 0}function Zo(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function yd(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function Ge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function zn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ct(e){return zn(e._zod.def)??e._zod.def.shape}function vd(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Ge(this,t,n),n},enumerable:!0,configurable:!0})}function xd(e,t,r){if(t in e)Ge(e,t,r);else e[t]=r}function xr(e,t,r,n){let o=Ct(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);if(!i.enumerable)continue;if(i.get)vd(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a});else xd(e,s,n?n(i.value,s):i.value)}}function Pb(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)vd(e,r,()=>t[r]);else xd(e,r,n.value)}}function Le(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function bd(e){return JSON.stringify(e)}function $d(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ki="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Zr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var wd=Sn(()=>{if(Fe.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function br(e){if(Zr(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(Zr(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Mo(e){if(br(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var kd=new Set(["string","number","symbol"]);function Vt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function We(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function I(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Gi(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Sd(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Do=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Wi={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zd(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s={};return xr(s,e,qo(e,t)),We(e,Le(r,{shape:s,checks:[]}))}function qo(e,t){let r=Ct(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function Pd(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(qo(e,t)),i={};return xr(i,e,Reflect.ownKeys(Ct(e)).filter((a)=>!s.has(a))),We(e,Le(r,{shape:i,checks:[]}))}function Ed(e,t){if(!br(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Ct(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return We(e,Le(e._zod.def,{shape:Td(e,t)}))}function Td(e,t){let r={};return xr(r,e,Reflect.ownKeys(Ct(e))),Pb(r,t),r}function Rd(e,t){if(!br(t))throw Error("Invalid input to safeExtend: expected a plain object");return We(e,Le(e._zod.def,{shape:Td(e,t)}))}function Od(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};xr(r,e,Reflect.ownKeys(Ct(e))),xr(r,t,Reflect.ownKeys(Ct(t)));let n=Le(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return We(e,n)}function Xi(e,t,r,n="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(qo(t,r)):void 0,c={};return xr(c,t,Reflect.ownKeys(Ct(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),We(t,Le(t._zod.def,{shape:c,checks:[]}))}function Id(e,t,r){let n=r?new Set(qo(t,r)):void 0,o={};return xr(o,t,Reflect.ownKeys(Ct(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),We(t,Le(t._zod.def,{shape:o}))}function mt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ad(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Ht(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function $n(e){return typeof e==="string"?e:e?.message}function Yi(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function Lo(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function ht(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:$n(e.inst?._zod.def?.error?.(e))??$n(s?.(e))??$n(t?.error?.(e))??$n(r.customError?.(e))??$n(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=e.input;return a}var Eb=/[\uD800-\uDBFF]/;function Fo(e){let t=e.length;if(!Eb.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Uo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Cd(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function $r(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Nd(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else Tb(e,r,n.value)}}function ut(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Vo(e,t,r){return ut(e,t,r,!1)}function jd(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return ut(this,r,n(this))},set(o){ut(this,r,o)}})}return t}function Tb(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:ut(this,t,r.bind(this))},set(n){ut(this,t,n)}})}function Rb(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Bi,Ut=!1,Ob={configurable:!0,get(){Ut=!0;return}};function te(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Bi!==e._zod){Bi=void 0;return}Bi=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Ob);let o=Ut;Ut=!1;try{let s=r(this);if(Ut)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return Ut=Ut||o,s}catch(s){throw delete this[t],Ut=Ut||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Qi(e,t,r,n){let o=Rb(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var Ib="~constantCatch";function Zd(e){let t=()=>e;return t[Ib]=!0,t}var Md;var ea={value:void 0,enumerable:!1},Dd="captureStackTrace"in Error?Error:null;function Ab(e){let t=Dd;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Dd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function y(e,t,r,n){let o={};function s(m){this.def=m,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function c(m,p){if(!m._zod){ea.value=new s(p);try{Object.defineProperty(m,"_zod",ea)}finally{ea.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,p),a){let h=Object.getPrototypeOf(m),g=m._zod.constr.prototype,v=h;while(v&&v!==g)v=Object.getPrototypeOf(v);let T=v??h;if(!a.has(T))a.add(T),Nd(T,i)}let f=d.prototype;for(let h in f){if(!Object.prototype.hasOwnProperty.call(f,h))continue;if(!(h in m))m[h]=f[h].bind(m)}}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(m){let p=n?.Parent?Ab(l):this;c(p,m);let f=p._zod.deferred;if(f){for(let g of f)g();p._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;if(h)h(p);return p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(m)=>{if(n?.Parent&&m instanceof n.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class gt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Pn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Md=globalThis).__zod_globalConfig??(Md.__zod_globalConfig={});var Fe=globalThis.__zod_globalConfig;function Ye(e){if(e)Object.assign(Fe,e);return Fe}function Cb(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,kn,2)),e.message}function Nb(e){this._zod.message=e}var jb={get:Cb,set:Nb,enumerable:!0,configurable:!0},ra={value:void 0,enumerable:!1},qd=new WeakSet([Object.prototype,Error.prototype]),Ld=(e,t)=>{e.name="$ZodError",ra.value=t,Object.defineProperty(e,"issues",ra),ra.value=void 0,Object.defineProperty(e,"message",jb);let r=Object.getPrototypeOf(e);if(!qd.has(r))qd.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},Fd=y("$ZodError",Ld),En=y("$ZodError",Ld,void 0,{Parent:Error});function Zb(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function Ud(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Zb(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Vd(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;while(u<a.length){let l=a[u],d=u===a.length-1;if(l==="_errors"){if(d)c._errors.push(t(i));u++;continue}if(!Object.prototype.hasOwnProperty.call(c,l))Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[l];if(d)m._errors.push(t(i));c=m,u++}}}};return n(e),r}function Ho(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Tn=(e)=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new gt;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>ht(u,i,Ye())));throw Ki(c,s?.callee??t),c}return a.value};return t},na=Tn(En),Rn=(e)=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>ht(u,i,Ye())));throw Ki(c,s?.callee??t),c}return a.value};return t},oa=Rn(En),On=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new gt;return s.issues.length?Hd(e,s.issues,o):{success:!0,data:s.value}},In=On(En);function Hd(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>ht(o,r,Ye()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var An=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?Hd(e,s.issues,o):{success:!0,data:s.value}},Cn=An(En),Db=Symbol.for("zod.compile.invalid"),qb=Symbol.for("zod.compile.fallback"),Bo=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Db)return!0;if(n.definite===!0&&r===void 0)return!1}return Lb(e,t,r)};function Lb(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o)n[qb]=!0,s=o({value:t,issues:[]},n);else s=e._zod.run({value:t,issues:[]},n);if(s instanceof Promise)throw new gt;return s.issues.length===0}var Jo=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},Bd=(e)=>{let t=Tn(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,Ho(r,i))};return r};var Jd=(e)=>{let t=Tn(e),r=(n,o,s,i)=>t(n,o,s,Ho(r,i));return r};var Kd=(e)=>{let t=Rn(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,Ho(r,i))};return r};var Gd=(e)=>{let t=Rn(e),r=async(n,o,s,i)=>await t(n,o,s,Ho(r,i));return r};var Wd=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return On(e)(t,r,o)};var Xd=(e)=>(t,r,n)=>On(e)(t,r,n);var Yd=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return An(e)(t,r,o)};var Qd=(e)=>async(t,r,n)=>An(e)(t,r,n);var ep=/^[cC][0-9a-z]{6,}$/,tp=/^[0-9a-z]+$/,rp=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,np=/^[0-9a-vA-V]{20}$/,op=/^[A-Za-z0-9]{27}$/,sp=/^[a-zA-Z0-9_-]{21}$/;function ip(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var ap=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var cp=/^([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})$/,ia=(e)=>{if(!e)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var up=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Fb="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function lp(){return new RegExp(Fb,"u")}var dp=/^(?:(?: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])$/,pp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var fp=/^((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])$/,mp=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gp=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var _p=/^https?$/,yp=/^\+[1-9]\d{6,14}$/;var vp="(?:(?:\\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])))";function Ub(e){return new RegExp(`^${e}$`)}var xp=Ub(vp);function sa(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function bp(e){return new RegExp(`^${sa(e)}$`)}function $p(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${sa({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${sa({precision:e.precision})}`:r;return new RegExp(`^${vp}T(?:${n})$`)}var wp=/^[\s\S]{0,}$/;var aa=/^-?\d+$/,Nn=/^-?\d+(?:\.\d+)?$/,kp=/^(?:true|false)$/i,Sp=/^null$/i;var zp=/^[^A-Z]*$/,Pp=/^[^a-z]*$/;var Pe=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var ca=(e)=>{let t=e.value;return!_d(t)&&t.length!==void 0},Ko={number:"number",bigint:"bigint",object:"date"},ua=y("$ZodCheckLessThan",(e,t)=>{Pe.init(e,t);let r=Ko[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Ko[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),la=y("$ZodCheckGreaterThan",(e,t)=>{Pe.init(e,t);let r=Ko[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Ko[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ep=y("$ZodCheckMultipleOf",(e,t)=>{Pe.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):yd(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Tp=y("$ZodCheckNumberFormat",(e,t)=>{Pe.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Do[t.format];e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(a<o)i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Rp=y("$ZodCheckMaxLength",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=ca),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>t.maximum?Fo(o):s)<=t.maximum)return;let a=Uo(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Op=y("$ZodCheckMinLength",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=ca),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>=t.minimum&&s<t.minimum*2?Fo(o):s)>=t.minimum)return;let a=Uo(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ip=y("$ZodCheckLengthEquals",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=ca),e._zod.check=(n)=>{let o=n.value,s=o.length,i=typeof o==="string"&&s>=t.length&&s<=t.length*2?Fo(o):s;if(i===t.length)return;let a=Uo(o),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),jn=y("$ZodCheckStringFormat",(e,t)=>{var r,n;if(Pe.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Ap=y("$ZodCheckRegex",(e,t)=>{jn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Cp=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=zp),jn.init(e,t)}),Np=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Pp),jn.init(e,t)}),jp=y("$ZodCheckIncludes",(e,t)=>{Pe.init(e,t);let r=Vt(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Zp=y("$ZodCheckStartsWith",(e,t)=>{Pe.init(e,t);let r=new RegExp(`^${Vt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Mp=y("$ZodCheckEndsWith",(e,t)=>{Pe.init(e,t);let r=new RegExp(`.*${Vt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Dp=y("$ZodCheckOverwrite",(e,t)=>{Pe.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class da{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
9
|
+
deps: ${r}}`};var EO={keyword:"dependencies",type:"object",schemaType:"object",error:qv.error,code(e){let[t,r]=TO(e);Mv(e,t),Dv(e,r)}};function TO({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function Mv(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=Ot.propertyInData(r,n,i,o.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors)r.if(c,()=>{for(let u of a)Ot.checkReportMissingProp(e,u)});else r.if(_n._`${c} && (${Ot.checkMissingProp(e,a,s)})`),Ot.reportMissingProp(e,s),r.else()}}qv.validatePropertyDeps=Mv;function Dv(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t){if(Zv.alwaysValidSchema(s,t[a]))continue;r.if(Ot.propertyInData(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i)}}qv.validateSchemaDeps=Dv;qv.default=EO});var Bv=z(function(Hv){Object.defineProperty(Hv,"__esModule",{value:!0});var Ni=B(),Vv=Q(),IO={message:"property name must be valid",params:({params:e})=>Ni._`{propertyName: ${e.propertyName}}`},AO={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:IO,code(e){let{gen:t,schema:r,data:n,it:o}=e;if(Vv.alwaysValidSchema(o,r))return;let s=t.name("valid");t.forIn("key",n,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if(Ni.not(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};Hv.default=AO});var Kl=z(function(Jv){Object.defineProperty(Jv,"__esModule",{value:!0});var pr=st(),$e=B(),NO=Lt(),fr=Q(),jO={message:"must NOT have additional properties",params:({params:e})=>$e._`{additionalProperty: ${e.additionalProperty}}`},ZO={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:jO,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&fr.alwaysValidSchema(i,r))return;let u=pr.allSchemaProperties(n.properties),l=pr.allSchemaProperties(n.patternProperties);d(),e.ok($e._`${s} === ${NO.default.errors}`);function d(){t.forIn("key",o,(g)=>{if(!u.length&&!l.length)f(g);else t.if(m(g),()=>f(g))})}function m(g){let v;if(u.length>8){let T=fr.schemaRefOrVal(i,n.properties,"properties");v=pr.isOwnProperty(t,T,g)}else if(u.length)v=$e.or(...u.map((T)=>$e._`${g} === ${T}`));else v=$e.nil;if(l.length)v=$e.or(v,...l.map((T)=>$e._`${pr.usePattern(e,T)}.test(${g})`));return $e.not(v)}function p(g){t.code($e._`delete ${o}[${g}]`)}function f(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(g);return}if(r===!1){if(e.setParams({additionalProperty:g}),e.error(),!a)t.break();return}if(typeof r=="object"&&!fr.alwaysValidSchema(i,r)){let v=t.name("valid");if(c.removeAdditional==="failing")h(g,v,!1),t.if($e.not(v),()=>{e.reset(),p(g)});else if(h(g,v),!a)t.if($e.not(v),()=>t.break())}}function h(g,v,T){let M={keyword:"additionalProperties",dataProp:g,dataPropType:fr.Type.Str};if(T===!1)Object.assign(M,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(M,v)}}};Jv.default=ZO});var Xv=z(function(Wv){Object.defineProperty(Wv,"__esModule",{value:!0});var Gv=zo(),ji=st(),yn=Q(),Kv=Kl(),DO={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;if(s.opts.removeAdditional==="all"&&n.additionalProperties===void 0)Kv.default.code(new Gv.KeywordCxt(s,Kv.default,"additionalProperties"));let i=ji.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=yn.mergeEvaluated.props(t,yn.toHash(i),s.props);let a=i.filter((d)=>!yn.alwaysValidSchema(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a){if(u(d))l(d);else{if(t.if(ji.propertyInData(t,o,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(c)}function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Wv.default=DO});var Qv=z(function(Yv){Object.defineProperty(Yv,"__esModule",{value:!0});var Zi=st(),mr=B(),Mi=Q(),Di=Q(),LO={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=Zi.allSchemaProperties(r),c=a.filter((h)=>Mi.alwaysValidSchema(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof mr.Name))s.props=Di.evaluatedPropsToName(t,s.props);let{props:d}=s;m();function m(){for(let h of a){if(u)p(h);if(s.allErrors)f(h);else t.var(l,!0),f(h),t.if(l)}}function p(h){for(let g in u)if(new RegExp(h).test(g))Mi.checkStrictMode(s,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function f(h){t.forIn("key",n,(g)=>{t.if(mr._`${Zi.usePattern(e,h)}.test(${g})`,()=>{let v=c.includes(h);if(!v)e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:Di.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(mr._`${d}[${g}]`,!0);else if(!v&&!s.allErrors)t.if(mr.not(l),()=>t.break())})})}}};Yv.default=LO});var rx=z(function(tx){Object.defineProperty(tx,"__esModule",{value:!0});var ex=Q(),UO={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(ex.alwaysValidSchema(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};tx.default=UO});var sx=z(function(ox){Object.defineProperty(ox,"__esModule",{value:!0});var nx=st(),HO={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:nx.validateUnion,error:{message:"must match a schema in anyOf"}};ox.default=HO});var cx=z(function(ax){Object.defineProperty(ax,"__esModule",{value:!0});var hr=B(),ix=Q(),JO={message:"must match exactly one schema in oneOf",params:({params:e})=>hr._`{passingSchemas: ${e.passing}}`},KO={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:JO,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let m;if(ix.alwaysValidSchema(o,l))t.var(c,!0);else m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(hr._`${c} && ${i}`).assign(i,!1).assign(a,hr._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,d),m)e.mergeEvaluated(m,hr.Name)})})}}};ax.default=KO});var dx=z(function(lx){Object.defineProperty(lx,"__esModule",{value:!0});var ux=Q(),WO={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if(ux.alwaysValidSchema(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};lx.default=WO});var mx=z(function(fx){Object.defineProperty(fx,"__esModule",{value:!0});var gr=B(),qi=Q(),YO={message:({params:e})=>gr.str`must match "${e.ifClause}" schema`,params:({params:e})=>gr._`{failingKeyword: ${e.ifClause}}`},QO={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:YO,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)qi.checkStrictMode(n,'"if" without "then" and "else" is ignored');let o=px(n,"then"),s=px(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else if(o)t.if(a,u("then"));else t.if(gr.not(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let m=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(m,i),d)t.assign(d,gr._`${l}`);else e.setParams({ifClause:l})}}}};function px(e,t){let r=e.schema[t];return r!==void 0&&!qi.alwaysValidSchema(e,r)}fx.default=QO});var _x=z(function(gx){Object.defineProperty(gx,"__esModule",{value:!0});var hx=Q(),tI={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)hx.checkStrictMode(r,`"${e}" without "if" is ignored`)}};gx.default=tI});var vx=z(function(yx){Object.defineProperty(yx,"__esModule",{value:!0});var nI=Bl(),oI=Tv(),sI=Jl(),iI=Cv(),aI=jv(),cI=Uv(),uI=Bv(),lI=Kl(),dI=Xv(),pI=Qv(),fI=rx(),mI=sx(),hI=cx(),gI=dx(),_I=mx(),yI=_x();function vI(e=!1){let t=[fI.default,mI.default,hI.default,gI.default,_I.default,yI.default,uI.default,lI.default,cI.default,dI.default,pI.default];if(e)t.push(oI.default,iI.default);else t.push(nI.default,sI.default);return t.push(aI.default),t}yx.default=vI});var bx=z(function(xx){Object.defineProperty(xx,"__esModule",{value:!0});var H=B(),bI={message:({schemaCode:e})=>H.str`must match format "${e}"`,params:({schemaCode:e})=>H._`{format: ${e}}`},$I={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:bI,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;if(o)m();else p();function m(){let f=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",H._`${f}[${i}]`),g=r.let("fType"),v=r.let("format");r.if(H._`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,H._`${h}.type || "string"`).assign(v,H._`${h}.validate`),()=>r.assign(g,H._`"string"`).assign(v,h)),e.fail$data(H.or(T(),M()));function T(){if(c.strictSchema===!1)return H.nil;return H._`${i} && !${v}`}function M(){let Y=l.$async?H._`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:H._`${v}(${n})`,C=H._`(typeof ${v} == "function" ? ${Y} : ${v}.test(${n}))`;return H._`${v} && ${v} !== true && ${g} === ${t} && !${C}`}}function p(){let f=d.formats[s];if(!f){T();return}if(f===!0)return;let[h,g,v]=M(f);if(h===t)e.pass(Y());function T(){if(c.strictSchema===!1){d.logger.warn(C());return}throw Error(C());function C(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function M(C){let K=C instanceof RegExp?H.regexpCode(C):c.code.formats?H._`${c.code.formats}${H.getProperty(s)}`:void 0,ke=r.scopeValue("formats",{key:s,ref:C,code:K});if(typeof C=="object"&&!(C instanceof RegExp))return[C.type||"string",C.validate,H._`${ke}.validate`];return["string",C,ke]}function Y(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!l.$async)throw Error("async format in sync schema");return H._`await ${v}(${n})`}return typeof g=="function"?H._`${v}(${n})`:H._`${v}.test(${n})`}}}};xx.default=$I});var wx=z(function($x){Object.defineProperty($x,"__esModule",{value:!0});var kI=bx(),SI=[kI.default];$x.default=SI});var zx=z(function(kx){Object.defineProperty(kx,"__esModule",{value:!0});kx.contentVocabulary=kx.metadataVocabulary=void 0;kx.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];kx.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Ex=z(function(Px){Object.defineProperty(Px,"__esModule",{value:!0});var EI=Dy(),TI=vv(),RI=vx(),OI=wx(),Li=zx(),II=[EI.default,TI.default,(0,RI.default)(),OI.default,Li.metadataVocabulary,Li.contentVocabulary];Px.default=II});var Ix=z(function(Rx){Object.defineProperty(Rx,"__esModule",{value:!0});Rx.DiscrError=void 0;var Tx;(function(e){e.Tag="tag",e.Mapping="mapping"})(Tx||(Rx.DiscrError=Tx={}))});var Nx=z(function(Cx){Object.defineProperty(Cx,"__esModule",{value:!0});var at=B(),vn=Ix(),Fi=xi(),CI=Po(),Ax=Q(),NI={message:({params:{discrError:e,tagName:t}})=>e===vn.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>at._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},jI={keyword:"discriminator",type:"object",schemaType:"object",error:NI,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",at._`${r}${at.getProperty(a)}`);t.if(at._`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:vn.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let p=m();t.if(!1);for(let f in p)t.elseIf(at._`${u} === ${f}`),t.assign(c,d(p[f]));t.else(),e.error(!1,{discrError:vn.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(p){let f=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},f);return e.mergeEvaluated(h,at.Name),f}function m(){var p;let f={},h=v(o),g=!0;for(let Y=0;Y<i.length;Y++){let C=i[Y];if((C===null||C===void 0?void 0:C.$ref)&&!Ax.schemaHasRulesButRef(C,s.self.RULES)){let ke=C.$ref;if(C=Fi.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,ke),C instanceof Fi.SchemaEnv)C=C.schema;if(C===void 0)throw new CI.default(s.opts.uriResolver,s.baseId,ke)}let K=(p=C===null||C===void 0?void 0:C.properties)===null||p===void 0?void 0:p[a];if(typeof K!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||v(C)),T(K,Y)}if(!g)throw Error(`discriminator: "${a}" must be required`);return f;function v({required:Y}){return Array.isArray(Y)&&Y.includes(a)}function T(Y,C){if(Y.const)M(Y.const,C);else if(Y.enum)for(let K of Y.enum)M(K,C);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function M(Y,C){if(typeof Y!="string"||Y in f)throw Error(`discriminator: "${a}" values must be unique strings`);f[Y]=C}}}};Cx.default=jI});var jx=z(function(r4,MI){MI.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 Wl=z(function(Ke,Gl){Object.defineProperty(Ke,"__esModule",{value:!0});Ke.MissingRefError=Ke.ValidationError=Ke.CodeGen=Ke.Name=Ke.nil=Ke.stringify=Ke.str=Ke._=Ke.KeywordCxt=Ke.Ajv=void 0;var DI=Oy(),qI=Ex(),LI=Nx(),Zx=jx(),FI=["/properties"],Ui="http://json-schema.org/draft-07/schema";class Oo extends DI.default{_addVocabularies(){if(super._addVocabularies(),qI.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(LI.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Zx,FI):Zx;this.addMetaSchema(e,Ui,!1),this.refs["http://json-schema.org/schema"]=Ui}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ui)?Ui:void 0)}}Ke.Ajv=Oo;Gl.exports=Ke=Oo;Gl.exports.Ajv=Oo;Object.defineProperty(Ke,"__esModule",{value:!0});Ke.default=Oo;var UI=zo();Object.defineProperty(Ke,"KeywordCxt",{enumerable:!0,get:function(){return UI.KeywordCxt}});var xn=B();Object.defineProperty(Ke,"_",{enumerable:!0,get:function(){return xn._}});Object.defineProperty(Ke,"str",{enumerable:!0,get:function(){return xn.str}});Object.defineProperty(Ke,"stringify",{enumerable:!0,get:function(){return xn.stringify}});Object.defineProperty(Ke,"nil",{enumerable:!0,get:function(){return xn.nil}});Object.defineProperty(Ke,"Name",{enumerable:!0,get:function(){return xn.Name}});Object.defineProperty(Ke,"CodeGen",{enumerable:!0,get:function(){return xn.CodeGen}});var VI=_i();Object.defineProperty(Ke,"ValidationError",{enumerable:!0,get:function(){return VI.default}});var HI=Po();Object.defineProperty(Ke,"MissingRefError",{enumerable:!0,get:function(){return HI.default}})});var Jx=z(function(Hx){Object.defineProperty(Hx,"__esModule",{value:!0});Hx.formatNames=Hx.fastFormats=Hx.fullFormats=void 0;function It(e,t){return{validate:e,compare:t}}Hx.fullFormats={date:It(Lx,ed),time:It(Yl(!0),td),"date-time":It(Mx(!0),Ux),"iso-time":It(Yl(),Fx),"iso-date-time":It(Mx(),Vx),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:QI,"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:i1,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:e1,int32:{type:"number",validate:n1},int64:{type:"number",validate:o1},float:{type:"number",validate:qx},double:{type:"number",validate:qx},password:!0,binary:!0};Hx.fastFormats={...Hx.fullFormats,date:It(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,ed),time:It(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,td),"date-time":It(/^\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,Ux),"iso-time":It(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Fx),"iso-date-time":It(/^\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,Vx),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};Hx.formatNames=Object.keys(Hx.fullFormats);function KI(e){return e%4===0&&(e%100!==0||e%400===0)}var GI=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,WI=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Lx(e){let t=GI.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&KI(r)?29:WI[n])}function ed(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Xl=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Yl(e){return function(r){let n=Xl.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function td(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(!(r&&n))return;return r-n}function Fx(e,t){if(!(e&&t))return;let r=Xl.exec(e),n=Xl.exec(t);if(!(r&&n))return;if(e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t)return 1;if(e<t)return-1;return 0}var Ql=/t|\s/i;function Mx(e){let t=Yl(e);return function(n){let o=n.split(Ql);return o.length===2&&Lx(o[0])&&t(o[1])}}function Ux(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(!(r&&n))return;return r-n}function Vx(e,t){if(!(e&&t))return;let[r,n]=e.split(Ql),[o,s]=t.split(Ql),i=ed(r,o);if(i===void 0)return;return i||td(n,s)}var XI=/\/|:/,YI=/^(?:[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 QI(e){return XI.test(e)&&YI.test(e)}var Dx=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function e1(e){return Dx.lastIndex=0,Dx.test(e)}var t1=-2147483648,r1=2147483647;function n1(e){return Number.isInteger(e)&&e<=r1&&e>=t1}function o1(e){return Number.isInteger(e)}function qx(){return!0}var s1=/[^\\]\\Z/;function i1(e){if(s1.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var Wx=z(function(Gx){Object.defineProperty(Gx,"__esModule",{value:!0});Gx.formatLimitDefinition=void 0;var Kx=Wl(),we=B(),_r=we.operators,Vi={formatMaximum:{okStr:"<=",ok:_r.LTE,fail:_r.GT},formatMinimum:{okStr:">=",ok:_r.GTE,fail:_r.LT},formatExclusiveMaximum:{okStr:"<",ok:_r.LT,fail:_r.GTE},formatExclusiveMinimum:{okStr:">",ok:_r.GT,fail:_r.LTE}},c1={message:({keyword:e,schemaCode:t})=>we.str`should be ${Vi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>we._`{comparison: ${Vi[e].okStr}, limit: ${t}}`};Gx.formatLimitDefinition={keyword:Object.keys(Vi),type:"string",schemaType:"string",$data:!0,error:c1,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new Kx.KeywordCxt(s,a.RULES.all.format.definition,"format");if(c.$data)u();else l();function u(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),p=t.const("fmt",we._`${m}[${c.schemaCode}]`);e.fail$data(we.or(we._`typeof ${p} != "object"`,we._`${p} instanceof RegExp`,we._`typeof ${p}.compare != "function"`,d(p)))}function l(){let m=c.schema,p=a.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw Error(`"${o}": format "${m}" does not define "compare" function`);let f=t.scopeValue("formats",{key:m,ref:p,code:i.code.formats?we._`${i.code.formats}${we.getProperty(m)}`:void 0});e.fail$data(d(f))}function d(m){return we._`${m}.compare(${r}, ${n}) ${Vi[o].fail} 0`}},dependencies:["format"]};var u1=(e)=>(e.addKeyword(Gx.formatLimitDefinition),e);Gx.default=u1});var eb=z(function(Io,Qx){Object.defineProperty(Io,"__esModule",{value:!0});var ct=Jx(),d1=Wx(),bn=B(),Xx=new bn.Name("fullFormats"),p1=new bn.Name("fastFormats"),od=(e,t={keywords:!0})=>{if(Array.isArray(t))return Yx(e,t,ct.fullFormats,Xx),e;let[r,n]=t.mode==="fast"?[ct.fastFormats,p1]:[ct.fullFormats,Xx],o=t.formats||ct.formatNames;if(Yx(e,o,r,n),t.keywords)(0,d1.default)(e);return e};od.get=(e,t="full")=>{let n=(t==="fast"?ct.fastFormats:ct.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function Yx(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=bn._`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}Qx.exports=Io=od;Object.defineProperty(Io,"__esModule",{value:!0});Io.default=od});import{readFileSync as S1}from"node:fs";import eh from"node:process";function wn(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Ki(e,t="|"){return e.map((r)=>Wi(r)).join(t)}function kn(e,t){if(typeof t==="bigint")return t.toString();return t}class gd{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Sn(e){return new gd(e)}function _d(e){return e===null||e===void 0}function Zo(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function yd(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function Ge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function zn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ct(e){return zn(e._zod.def)??e._zod.def.shape}function vd(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Ge(this,t,n),n},enumerable:!0,configurable:!0})}function xd(e,t,r){if(t in e)Ge(e,t,r);else e[t]=r}function xr(e,t,r,n){let o=Ct(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);if(!i.enumerable)continue;if(i.get)vd(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a});else xd(e,s,n?n(i.value,s):i.value)}}function Pb(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)vd(e,r,()=>t[r]);else xd(e,r,n.value)}}function Le(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function bd(e){return JSON.stringify(e)}function $d(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Gi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Zr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var wd=Sn(()=>{if(Fe.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function br(e){if(Zr(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(Zr(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Mo(e){if(br(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var kd=new Set(["string","number","symbol"]);function Vt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function We(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function I(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Wi(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Sd(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Do=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Xi={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zd(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s={};return xr(s,e,qo(e,t)),We(e,Le(r,{shape:s,checks:[]}))}function qo(e,t){let r=Ct(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function Pd(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(qo(e,t)),i={};return xr(i,e,Reflect.ownKeys(Ct(e)).filter((a)=>!s.has(a))),We(e,Le(r,{shape:i,checks:[]}))}function Ed(e,t){if(!br(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Ct(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return We(e,Le(e._zod.def,{shape:Td(e,t)}))}function Td(e,t){let r={};return xr(r,e,Reflect.ownKeys(Ct(e))),Pb(r,t),r}function Rd(e,t){if(!br(t))throw Error("Invalid input to safeExtend: expected a plain object");return We(e,Le(e._zod.def,{shape:Td(e,t)}))}function Od(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};xr(r,e,Reflect.ownKeys(Ct(e))),xr(r,t,Reflect.ownKeys(Ct(t)));let n=Le(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return We(e,n)}function Yi(e,t,r,n="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(qo(t,r)):void 0,c={};return xr(c,t,Reflect.ownKeys(Ct(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),We(t,Le(t._zod.def,{shape:c,checks:[]}))}function Id(e,t,r){let n=r?new Set(qo(t,r)):void 0,o={};return xr(o,t,Reflect.ownKeys(Ct(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),We(t,Le(t._zod.def,{shape:o}))}function mt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ad(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Ht(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function $n(e){return typeof e==="string"?e:e?.message}function Qi(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function Lo(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function ht(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:$n(e.inst?._zod.def?.error?.(e))??$n(s?.(e))??$n(t?.error?.(e))??$n(r.customError?.(e))??$n(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=e.input;return a}var Eb=/[\uD800-\uDBFF]/;function Fo(e){let t=e.length;if(!Eb.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Uo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Cd(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function $r(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Nd(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else Tb(e,r,n.value)}}function ut(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Vo(e,t,r){return ut(e,t,r,!1)}function jd(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return ut(this,r,n(this))},set(o){ut(this,r,o)}})}return t}function Tb(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:ut(this,t,r.bind(this))},set(n){ut(this,t,n)}})}function Rb(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Ji,Ut=!1,Ob={configurable:!0,get(){Ut=!0;return}};function te(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Ji!==e._zod){Ji=void 0;return}Ji=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Ob);let o=Ut;Ut=!1;try{let s=r(this);if(Ut)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return Ut=Ut||o,s}catch(s){throw delete this[t],Ut=Ut||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function ea(e,t,r,n){let o=Rb(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var Ib="~constantCatch";function Zd(e){let t=()=>e;return t[Ib]=!0,t}var Md;var ta={value:void 0,enumerable:!1},Dd="captureStackTrace"in Error?Error:null;function Ab(e){let t=Dd;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Dd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function y(e,t,r,n){let o={};function s(m){this.def=m,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function c(m,p){if(!m._zod){ta.value=new s(p);try{Object.defineProperty(m,"_zod",ta)}finally{ta.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,p),a){let h=Object.getPrototypeOf(m),g=m._zod.constr.prototype,v=h;while(v&&v!==g)v=Object.getPrototypeOf(v);let T=v??h;if(!a.has(T))a.add(T),Nd(T,i)}let f=d.prototype;for(let h in f){if(!Object.prototype.hasOwnProperty.call(f,h))continue;if(!(h in m))m[h]=f[h].bind(m)}}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(m){let p=n?.Parent?Ab(l):this;c(p,m);let f=p._zod.deferred;if(f){for(let g of f)g();p._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;if(h)h(p);return p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(m)=>{if(n?.Parent&&m instanceof n.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class gt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Pn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Md=globalThis).__zod_globalConfig??(Md.__zod_globalConfig={});var Fe=globalThis.__zod_globalConfig;function Ye(e){if(e)Object.assign(Fe,e);return Fe}function Cb(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,kn,2)),e.message}function Nb(e){this._zod.message=e}var jb={get:Cb,set:Nb,enumerable:!0,configurable:!0},na={value:void 0,enumerable:!1},qd=new WeakSet([Object.prototype,Error.prototype]),Ld=(e,t)=>{e.name="$ZodError",na.value=t,Object.defineProperty(e,"issues",na),na.value=void 0,Object.defineProperty(e,"message",jb);let r=Object.getPrototypeOf(e);if(!qd.has(r))qd.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},Fd=y("$ZodError",Ld),En=y("$ZodError",Ld,void 0,{Parent:Error});function Zb(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function Ud(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Zb(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Vd(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;while(u<a.length){let l=a[u],d=u===a.length-1;if(l==="_errors"){if(d)c._errors.push(t(i));u++;continue}if(!Object.prototype.hasOwnProperty.call(c,l))Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[l];if(d)m._errors.push(t(i));c=m,u++}}}};return n(e),r}function Ho(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Tn=(e)=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new gt;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>ht(u,i,Ye())));throw Gi(c,s?.callee??t),c}return a.value};return t},oa=Tn(En),Rn=(e)=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>ht(u,i,Ye())));throw Gi(c,s?.callee??t),c}return a.value};return t},sa=Rn(En),On=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new gt;return s.issues.length?Hd(e,s.issues,o):{success:!0,data:s.value}},In=On(En);function Hd(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>ht(o,r,Ye()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var An=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?Hd(e,s.issues,o):{success:!0,data:s.value}},Cn=An(En),Db=Symbol.for("zod.compile.invalid"),qb=Symbol.for("zod.compile.fallback"),Bo=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Db)return!0;if(n.definite===!0&&r===void 0)return!1}return Lb(e,t,r)};function Lb(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o)n[qb]=!0,s=o({value:t,issues:[]},n);else s=e._zod.run({value:t,issues:[]},n);if(s instanceof Promise)throw new gt;return s.issues.length===0}var Jo=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},Bd=(e)=>{let t=Tn(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,Ho(r,i))};return r};var Jd=(e)=>{let t=Tn(e),r=(n,o,s,i)=>t(n,o,s,Ho(r,i));return r};var Kd=(e)=>{let t=Rn(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,Ho(r,i))};return r};var Gd=(e)=>{let t=Rn(e),r=async(n,o,s,i)=>await t(n,o,s,Ho(r,i));return r};var Wd=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return On(e)(t,r,o)};var Xd=(e)=>(t,r,n)=>On(e)(t,r,n);var Yd=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return An(e)(t,r,o)};var Qd=(e)=>async(t,r,n)=>An(e)(t,r,n);var ep=/^[cC][0-9a-z]{6,}$/,tp=/^[0-9a-z]+$/,rp=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,np=/^[0-9a-vA-V]{20}$/,op=/^[A-Za-z0-9]{27}$/,sp=/^[a-zA-Z0-9_-]{21}$/;function ip(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var ap=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var cp=/^([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})$/,aa=(e)=>{if(!e)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var up=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Fb="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function lp(){return new RegExp(Fb,"u")}var dp=/^(?:(?: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])$/,pp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var fp=/^((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])$/,mp=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gp=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var _p=/^https?$/,yp=/^\+[1-9]\d{6,14}$/;var vp="(?:(?:\\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])))";function Ub(e){return new RegExp(`^${e}$`)}var xp=Ub(vp);function ia(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function bp(e){return new RegExp(`^${ia(e)}$`)}function $p(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${ia({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${ia({precision:e.precision})}`:r;return new RegExp(`^${vp}T(?:${n})$`)}var wp=/^[\s\S]{0,}$/;var ca=/^-?\d+$/,Nn=/^-?\d+(?:\.\d+)?$/,kp=/^(?:true|false)$/i,Sp=/^null$/i;var zp=/^[^A-Z]*$/,Pp=/^[^a-z]*$/;var Pe=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var ua=(e)=>{let t=e.value;return!_d(t)&&t.length!==void 0},Ko={number:"number",bigint:"bigint",object:"date"},la=y("$ZodCheckLessThan",(e,t)=>{Pe.init(e,t);let r=Ko[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Ko[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),da=y("$ZodCheckGreaterThan",(e,t)=>{Pe.init(e,t);let r=Ko[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Ko[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ep=y("$ZodCheckMultipleOf",(e,t)=>{Pe.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):yd(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Tp=y("$ZodCheckNumberFormat",(e,t)=>{Pe.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Do[t.format];e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(a<o)i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Rp=y("$ZodCheckMaxLength",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=ua),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>t.maximum?Fo(o):s)<=t.maximum)return;let a=Uo(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Op=y("$ZodCheckMinLength",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=ua),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>=t.minimum&&s<t.minimum*2?Fo(o):s)>=t.minimum)return;let a=Uo(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ip=y("$ZodCheckLengthEquals",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=ua),e._zod.check=(n)=>{let o=n.value,s=o.length,i=typeof o==="string"&&s>=t.length&&s<=t.length*2?Fo(o):s;if(i===t.length)return;let a=Uo(o),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),jn=y("$ZodCheckStringFormat",(e,t)=>{var r,n;if(Pe.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Ap=y("$ZodCheckRegex",(e,t)=>{jn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Cp=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=zp),jn.init(e,t)}),Np=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Pp),jn.init(e,t)}),jp=y("$ZodCheckIncludes",(e,t)=>{Pe.init(e,t);let r=Vt(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Zp=y("$ZodCheckStartsWith",(e,t)=>{Pe.init(e,t);let r=new RegExp(`^${Vt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Mp=y("$ZodCheckEndsWith",(e,t)=>{Pe.init(e,t);let r=new RegExp(`.*${Vt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Dp=y("$ZodCheckOverwrite",(e,t)=>{Pe.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class pa{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
10
10
|
`).filter((s)=>s),n=Math.min(...r.map((s)=>s.length-s.trimStart().length)),o=r.map((s)=>s.slice(n)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
11
11
|
${t.join(`
|
|
12
12
|
`)}
|
|
13
|
-
};`)(...Object.values(this.closed))}}var Lp={major:4,minor:6,patch:7};var ae=y("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Lp;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=mt(a),d;for(let m of c){if(m._zod.def.when){if(Ad(a))continue;if(!m._zod.def.when(a))continue}else if(l)continue;let p=a.issues.length,f=m._zod.check(a);if(f instanceof Promise&&u?.async===!1)throw new gt;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await f,a.issues.length===p)return;if(Lo(a.issues,p,e),!l)l=mt(a,p)});else{if(a.issues.length===p)continue;if(Lo(a.issues,p,e),!l)l=mt(a,p)}}if(d)return d.then(()=>a);return a},i=(a,c,u)=>{if(mt(a))return a.aborted=!0,a;let l=s(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new gt;return l.then((d)=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>i(d,a,c));return i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new gt;return u.then((l)=>s(l,o,c))}return s(u,o,c)}}},{get "~standard"(){return Vo(this,"~standard",fa(this))},set "~standard"(e){ut(this,"~standard",e)}}),Yp=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>ht(r,t,Ye()))}:{value:e.value};async function Vb(e,t){let r={async:!0};return Yp(await e._zod.run({value:t,issues:[]},r),r)}function fa(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Yp(n,r)}catch(n){}return Vb(e,t)},vendor:"zod",version:1}}var Zn=y("$ZodString",(e,t)=>{ae.init(e,t),e._zod.pattern=t.pattern??wp,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ue=y("$ZodStringFormat",(e,t)=>{jn.init(e,t),Zn.init(e,t)}),ma=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=cp),ue.init(e,t)}),ha=y("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ia(n))}else t.pattern??(t.pattern=ia());ue.init(e,t)}),ga=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=up),ue.init(e,t)}),Qp=1,Wo=2;function ef(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Hb(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return ef(e)||Wo;return Bb(e,t)}function Bb(e,t){if(!t.normalize&&t.protocol?.source===_p.source&&!/^https?:\/\//i.test(e))return Qp;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Wo}return new URL(e)}catch{return Wo}}var Jb=/[\t\n\r]/g;function Fp(e){return e.replace(Jb,"")}function Kb(e,t){return t.lastIndex=0,t.test(e.hostname)}function Gb(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var _a=y("$ZodURL",(e,t)=>{ue.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Hb(n,t);if(o===Qp){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Wo){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Fp(n);return}if(t.hostname&&!Kb(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Gb(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Fp(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ya=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=lp()),ue.init(e,t)}),va=y("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?sp:ip(t.length)),ue.init(e,t)}),xa=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ep),ue.init(e,t)}),ba=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tp),ue.init(e,t)}),$a=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=rp),ue.init(e,t)}),wa=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=np),ue.init(e,t)}),ka=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=op),ue.init(e,t)}),tf=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$p(t)),ue.init(e,t)}),rf=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xp),ue.init(e,t)}),nf=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=bp(t)),ue.init(e,t)}),of=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ap),ue.init(e,t)}),Sa=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dp),ue.init(e,t)}),Wb=/^[0-9a-fA-F:.]+$/;function sf(e){if(!Wb.test(e))return!1;return ef(`http://[${e}]`)}var za=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=pp),ue.init(e,t),e._zod.check=(r)=>{if(!sf(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Pa=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fp),ue.init(e,t)});function Xb(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return sf(r)}var Ea=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=mp),ue.init(e,t),e._zod.check=(r)=>{if(!Xb(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function af(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ta=/^[0-9a-zA-Z+/]*={0,2}$/,Ra=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ta),ue.init(e,t),e._zod.check=(r)=>{if(af(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Yo=/^[A-Za-z0-9_-]*$/;function Yb(e){if(!Yo.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return af(r)}var Oa=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Yo),ue.init(e,t),e._zod.check=(r)=>{if(Yb(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ia=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=yp),ue.init(e,t)});function Qb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Aa=y("$ZodJWT",(e,t)=>{ue.init(e,t),e._zod.check=(r)=>{if(Qb(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Qo=y("$ZodNumber",(e,t)=>{ae.init(e,t),e._zod.pattern=Nn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),Ca=y("$ZodNumberFormat",(e,t)=>{Tp.init(e,t),Qo.init(e,t)}),Na=y("$ZodBoolean",(e,t)=>{ae.init(e,t),e._zod.pattern=kp,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var ja=y("$ZodNull",(e,t)=>{ae.init(e,t),e._zod.pattern=Sp,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var Za=y("$ZodUnknown",(e,t)=>{ae.init(e,t),e._zod.parse=(r)=>r}),Ma=y("$ZodNever",(e,t)=>{ae.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function e0(e,t){let r=Yi(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((s)=>s[0])),o=e._zod.parse;e._zod.parse=(s,i)=>{let a=t(s.value);if(a>n&&!i?.skipChecks&&i?.direction!=="backward"){for(let[c,u]of Yi(e._zod.def.checks))if(a>c&&u._zod.def.when(s)){let l=s.issues.length;return u._zod.check(s),s.issues[l].continue=!1,Lo(s.issues,l,e),s}}return o(s,i)}}var t0=(e)=>Array.isArray(e)?e.length:-1;function Up(e,t,r){if(e.issues.length)t.issues.push(...Ht(r,e.issues));t.value[r]=e.value}var Da=y("$ZodArray",(e,t)=>{ae.init(e,t);let r=Fe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],a=o?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)i.push(l.then((d)=>Up(d,n,c)));else if(Up(l,n,c),a&&l.issues.length!==0&&mt(l))break}if(i.length)return Promise.all(i).then(()=>n);return n},e0(e,t0)});function Xo(e,t,r,n,o,s){let i=r in n,a=s==="optional";if(!i&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...Ht(r,e.issues))}if(!i&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i||o==="defaulted"&&!a)t.value[r]=void 0}else t.value[r]=e.value}var r0=[];function cf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:r0,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=Sd(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function uf(e,t,r,n,o,s,i){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,{optin:d,optout:m}=u,p=0;for(let f in t){if(i&&r.issues.length!==p){if(mt(r,p))break;p=r.issues.length}if(c.has(f))continue;if(f==="__proto__"){if(l==="never")a.push(f);continue}if(l==="never"){a.push(f);continue}let h=u.run({value:t[f],issues:[]},n);if(h instanceof Promise)e.push(h.then((g)=>Xo(g,r,f,t,d,m)));else Xo(h,r,f,t,d,m)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var qa=y("$ZodObject",(e,t)=>{ae.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=Sn(()=>cf(t));te(e,"propValues",(u)=>{let l=u.def.shape,d={};for(let m in l){let p=l[m]._zod;if(p.values){if(!Object.prototype.hasOwnProperty.call(d,m))Ge(d,m,new Set);for(let f of p.values)d[m].add(f);if(p.optin!==void 0)d[m].add(void 0)}}return d});let s=Zr,i=t.catchall,a,c=Fe.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let m=[],p=a.shape,f=l?.abortEarly,h=u.issues.length;for(let g of a.allKeys){if(f&&u.issues.length!==h){if(mt(u,h))break;h=u.issues.length}if(g==="__proto__")continue;let v=p[g],T=v._zod.optin,M=v._zod.optout,Y=v._zod.run({value:d[g],issues:[]},l);if(Y instanceof Promise)m.push(Y.then((C)=>Xo(C,u,g,d,T,M)));else Xo(Y,u,g,d,T,M)}if(!i)return m.length?Promise.all(m).then(()=>u):u;return uf(m,d,u,l,o.value,e,f===!0)}}),lf=y("$ZodObjectJIT",(e,t)=>{qa.init(e,t);let r=e._zod.parse,n=Sn(()=>cf(t)),o=Fe.memoizer,s=(p)=>{let f=n.value,h=f.symbolKeys,g=new da(["payload","ctx"],{shape:p,inst:e,memo:o,syms:h}),v=(C)=>`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`,T=(C,K)=>`
|
|
13
|
+
};`)(...Object.values(this.closed))}}var Lp={major:4,minor:6,patch:7};var ae=y("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Lp;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=mt(a),d;for(let m of c){if(m._zod.def.when){if(Ad(a))continue;if(!m._zod.def.when(a))continue}else if(l)continue;let p=a.issues.length,f=m._zod.check(a);if(f instanceof Promise&&u?.async===!1)throw new gt;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await f,a.issues.length===p)return;if(Lo(a.issues,p,e),!l)l=mt(a,p)});else{if(a.issues.length===p)continue;if(Lo(a.issues,p,e),!l)l=mt(a,p)}}if(d)return d.then(()=>a);return a},i=(a,c,u)=>{if(mt(a))return a.aborted=!0,a;let l=s(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new gt;return l.then((d)=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>i(d,a,c));return i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new gt;return u.then((l)=>s(l,o,c))}return s(u,o,c)}}},{get "~standard"(){return Vo(this,"~standard",ma(this))},set "~standard"(e){ut(this,"~standard",e)}}),Yp=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>ht(r,t,Ye()))}:{value:e.value};async function Vb(e,t){let r={async:!0};return Yp(await e._zod.run({value:t,issues:[]},r),r)}function ma(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Yp(n,r)}catch(n){}return Vb(e,t)},vendor:"zod",version:1}}var Zn=y("$ZodString",(e,t)=>{ae.init(e,t),e._zod.pattern=t.pattern??wp,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ue=y("$ZodStringFormat",(e,t)=>{jn.init(e,t),Zn.init(e,t)}),ha=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=cp),ue.init(e,t)}),ga=y("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=aa(n))}else t.pattern??(t.pattern=aa());ue.init(e,t)}),_a=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=up),ue.init(e,t)}),Qp=1,Wo=2;function ef(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Hb(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return ef(e)||Wo;return Bb(e,t)}function Bb(e,t){if(!t.normalize&&t.protocol?.source===_p.source&&!/^https?:\/\//i.test(e))return Qp;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Wo}return new URL(e)}catch{return Wo}}var Jb=/[\t\n\r]/g;function Fp(e){return e.replace(Jb,"")}function Kb(e,t){return t.lastIndex=0,t.test(e.hostname)}function Gb(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ya=y("$ZodURL",(e,t)=>{ue.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Hb(n,t);if(o===Qp){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Wo){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Fp(n);return}if(t.hostname&&!Kb(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Gb(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Fp(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),va=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=lp()),ue.init(e,t)}),xa=y("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?sp:ip(t.length)),ue.init(e,t)}),ba=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ep),ue.init(e,t)}),$a=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tp),ue.init(e,t)}),wa=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=rp),ue.init(e,t)}),ka=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=np),ue.init(e,t)}),Sa=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=op),ue.init(e,t)}),tf=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$p(t)),ue.init(e,t)}),rf=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xp),ue.init(e,t)}),nf=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=bp(t)),ue.init(e,t)}),of=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ap),ue.init(e,t)}),za=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dp),ue.init(e,t)}),Wb=/^[0-9a-fA-F:.]+$/;function sf(e){if(!Wb.test(e))return!1;return ef(`http://[${e}]`)}var Pa=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=pp),ue.init(e,t),e._zod.check=(r)=>{if(!sf(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Ea=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fp),ue.init(e,t)});function Xb(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return sf(r)}var Ta=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=mp),ue.init(e,t),e._zod.check=(r)=>{if(!Xb(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function af(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ra=/^[0-9a-zA-Z+/]*={0,2}$/,Oa=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ra),ue.init(e,t),e._zod.check=(r)=>{if(af(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Yo=/^[A-Za-z0-9_-]*$/;function Yb(e){if(!Yo.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return af(r)}var Ia=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Yo),ue.init(e,t),e._zod.check=(r)=>{if(Yb(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Aa=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=yp),ue.init(e,t)});function Qb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Ca=y("$ZodJWT",(e,t)=>{ue.init(e,t),e._zod.check=(r)=>{if(Qb(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Qo=y("$ZodNumber",(e,t)=>{ae.init(e,t),e._zod.pattern=Nn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),Na=y("$ZodNumberFormat",(e,t)=>{Tp.init(e,t),Qo.init(e,t)}),ja=y("$ZodBoolean",(e,t)=>{ae.init(e,t),e._zod.pattern=kp,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Za=y("$ZodNull",(e,t)=>{ae.init(e,t),e._zod.pattern=Sp,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var Ma=y("$ZodUnknown",(e,t)=>{ae.init(e,t),e._zod.parse=(r)=>r}),Da=y("$ZodNever",(e,t)=>{ae.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function e0(e,t){let r=Qi(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((s)=>s[0])),o=e._zod.parse;e._zod.parse=(s,i)=>{let a=t(s.value);if(a>n&&!i?.skipChecks&&i?.direction!=="backward"){for(let[c,u]of Qi(e._zod.def.checks))if(a>c&&u._zod.def.when(s)){let l=s.issues.length;return u._zod.check(s),s.issues[l].continue=!1,Lo(s.issues,l,e),s}}return o(s,i)}}var t0=(e)=>Array.isArray(e)?e.length:-1;function Up(e,t,r){if(e.issues.length)t.issues.push(...Ht(r,e.issues));t.value[r]=e.value}var qa=y("$ZodArray",(e,t)=>{ae.init(e,t);let r=Fe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],a=o?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)i.push(l.then((d)=>Up(d,n,c)));else if(Up(l,n,c),a&&l.issues.length!==0&&mt(l))break}if(i.length)return Promise.all(i).then(()=>n);return n},e0(e,t0)});function Xo(e,t,r,n,o,s){let i=r in n,a=s==="optional";if(!i&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...Ht(r,e.issues))}if(!i&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i||o==="defaulted"&&!a)t.value[r]=void 0}else t.value[r]=e.value}var r0=[];function cf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:r0,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=Sd(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function uf(e,t,r,n,o,s,i){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,{optin:d,optout:m}=u,p=0;for(let f in t){if(i&&r.issues.length!==p){if(mt(r,p))break;p=r.issues.length}if(c.has(f))continue;if(f==="__proto__"){if(l==="never")a.push(f);continue}if(l==="never"){a.push(f);continue}let h=u.run({value:t[f],issues:[]},n);if(h instanceof Promise)e.push(h.then((g)=>Xo(g,r,f,t,d,m)));else Xo(h,r,f,t,d,m)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var La=y("$ZodObject",(e,t)=>{ae.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=Sn(()=>cf(t));te(e,"propValues",(u)=>{let l=u.def.shape,d={};for(let m in l){let p=l[m]._zod;if(p.values){if(!Object.prototype.hasOwnProperty.call(d,m))Ge(d,m,new Set);for(let f of p.values)d[m].add(f);if(p.optin!==void 0)d[m].add(void 0)}}return d});let s=Zr,i=t.catchall,a,c=Fe.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let m=[],p=a.shape,f=l?.abortEarly,h=u.issues.length;for(let g of a.allKeys){if(f&&u.issues.length!==h){if(mt(u,h))break;h=u.issues.length}if(g==="__proto__")continue;let v=p[g],T=v._zod.optin,M=v._zod.optout,Y=v._zod.run({value:d[g],issues:[]},l);if(Y instanceof Promise)m.push(Y.then((C)=>Xo(C,u,g,d,T,M)));else Xo(Y,u,g,d,T,M)}if(!i)return m.length?Promise.all(m).then(()=>u):u;return uf(m,d,u,l,o.value,e,f===!0)}}),lf=y("$ZodObjectJIT",(e,t)=>{La.init(e,t);let r=e._zod.parse,n=Sn(()=>cf(t)),o=Fe.memoizer,s=(p)=>{let f=n.value,h=f.symbolKeys,g=new pa(["payload","ctx"],{shape:p,inst:e,memo:o,syms:h}),v=(C)=>`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`,T=(C,K)=>`
|
|
14
14
|
let ${C}_ab = false;
|
|
15
15
|
for (let i = 0; i < ${C}.issues.length; i++) {
|
|
16
16
|
const iss = ${C}.issues[i];
|
|
@@ -60,16 +60,16 @@ ${t.join(`
|
|
|
60
60
|
if (${K}.value !== undefined || ${vr}) {
|
|
61
61
|
newResult[${ke}] = ${K}.value;
|
|
62
62
|
}
|
|
63
|
-
`)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()},i,a=Zr,c=!Fe.jitless,l=c&&wd.value,d=t.catchall,m;e._zod.parse=(p,f)=>{m??(m=n.value);let h=p.value;if(!a(h))return p.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),p;if(c&&l&&f?.async===!1&&f.jitless!==!0){if(!i)i=s(t.shape);if(p=i(p,f),!d)return p;return uf([],h,p,f,m,e,f?.abortEarly===!0)}return r(p,f)}});function Vp(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!mt(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>ht(i,n,Ye())))}),t}var es=y("$ZodUnion",(e,t)=>{ae.init(e,t),te(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),te(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),te(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),te(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((s)=>s._zod.pattern);return new RegExp(`^(${o.map((s)=>Zo(s.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}if(!s)return Vp(i,n,e,o);return Promise.all(i).then((a)=>Vp(a,n,e,o))}});function n0(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var La=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,es.init(e,t);let r=e._zod.parse;te(e,"propValues",(o)=>{let s={},i=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))i++;for(let[u,l]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(s,u))Ge(s,u,new Set);for(let d of l)s[u].add(d)}}if(!o.def.unionFallback&&i>1)s[o.def.discriminator]?.delete(void 0);return s}),t.options.forEach((o,s)=>{let i=zn(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index "${s}"`)});let n=Sn(()=>n0(t));e._zod.parse=(o,s)=>{let i=o.value;if(!Zr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=i?.[t.discriminator],c=n.value.get(a);if(c&&(a!==void 0||s.direction!=="backward"))return c._zod.run(o,s);if(t.unionFallback||s.direction==="backward")return r(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((u)=>n.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),o}}),Fa=y("$ZodIntersection",(e,t)=>{ae.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([c,u])=>Hp(r,c,u));return Hp(r,s,i)}});function pa(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(br(e)&&br(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let s of n){if(s==="__proto__")continue;let i=pa(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=pa(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Hp(e,t,r){let n=new Map,o,s=new Map,i=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);if(!s.has(m))s.set(m,u);d=[m]}else return!1;for(let m of d){if(!n.has(m))n.set(m,{});n.get(m)[l]=!0}return!0};for(let u of t.issues)if(!i(u,"l"))e.issues.push(u);for(let u of r.issues)if(!i(u,"r"))e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter((l)=>o.keys.includes(l)):[];if(u.length)e.issues.push({...o,keys:u});for(let l of a)if(!u.includes(l)&&s.has(l))e.issues.push(s.get(l))}let c=pa(t.value,r.value);if(!c.valid){if(mt(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Ua=y("$ZodRecord",(e,t)=>{ae.init(e,t);let r=Fe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!br(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(c.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((f)=>ht(f,o,Ye())),input:l,path:[l],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let p=t.valueType._zod.run({value:s[l],issues:[]},o);if(p instanceof Promise)i.push(p.then((f)=>{if(f.issues.length)n.issues.push(...Ht(l,f.issues));n.value[m]=f.value}));else{if(p.issues.length)n.issues.push(...Ht(l,p.issues));n.value[m]=p.value}}let u;for(let l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=s[l]}else u=u??[],u.push(l);if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let u of Reflect.ownKeys(s)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Nn.test(u)&&l.issues.length){let f=t.keyType._zod.run({value:Number(u),issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)l=f}if(l.issues.length){if(t.mode==="loose")n.value[u]=s[u];else if(a)c=c??[],c.push(u);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((f)=>ht(f,o,Ye())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let p=t.valueType._zod.run({value:s[u],issues:[]},o);if(p instanceof Promise)i.push(p.then((f)=>{if(f.issues.length)n.issues.push(...Ht(u,f.issues));n.value[m]=f.value}));else{if(p.issues.length)n.issues.push(...Ht(u,p.issues));n.value[m]=p.value}}if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}if(i.length)return Promise.all(i).then(()=>n);return n}});var Va=y("$ZodEnum",(e,t)=>{ae.init(e,t);let r=wn(t.entries),n=new Set(r);e._zod.values=n,te(e,"pattern",(o)=>{let s=wn(o.def.entries).filter((i)=>kd.has(typeof i));return new RegExp(s.length?`^(${s.map((i)=>Vt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),Ha=y("$ZodLiteral",(e,t)=>{ae.init(e,t);let r=new Set(t.values);e._zod.values=r,te(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((s)=>typeof s==="string"?Vt(s):s?Vt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var Ba=y("$ZodTransform",(e,t)=>{ae.init(e,t),e._zod.optin="optional",Fe.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pn(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(r.value=i,r));if(o instanceof Promise)throw new gt;return r.value=o,r}});function Bp(e,t){return e.value=t.issues.length?void 0:t.value,e}var ts=y("$ZodOptional",(e,t)=>{ae.init(e,t),te(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",te(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),te(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zo(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>Bp(r,s));return Bp(r,o)}return t.innerType._zod.run(r,n)}}),Ja=y("$ZodExactOptional",(e,t)=>{ts.init(e,t),te(e,"values",(r)=>r.def.innerType._zod.values),te(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Ka=y("$ZodNullable",(e,t)=>{ae.init(e,t),te(e,"optin",(r)=>r.def.innerType._zod.optin),te(e,"optout",(r)=>r.def.innerType._zod.optout),te(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zo(n.source)}|null)$`):void 0}),te(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Ga=y("$ZodDefault",(e,t)=>{ae.init(e,t),e._zod.optin="defaulted",te(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Jp(s,t));return Jp(o,t)}});function Jp(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Wa=y("$ZodPrefault",(e,t)=>{ae.init(e,t),e._zod.optin="defaulted",te(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Xa=y("$ZodNonOptional",(e,t)=>{ae.init(e,t),te(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Kp(s,e));return Kp(o,e)}});function Kp(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Gp(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>ht(o,n,Ye()))},input:e.value}),e}var Ya=y("$ZodCatch",(e,t)=>{ae.init(e,t),te(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),te(e,"optout",(r)=>r.def.innerType._zod.optout),te(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>Gp(r,s,t,n));return Gp(r,o,t,n)}});var rs=y("$ZodPipe",(e,t)=>{ae.init(e,t),te(e,"values",(r)=>r.def.in._zod.values),te(e,"optin",(r)=>r.def.in._zod.optin),te(e,"optout",(r)=>r.def.out._zod.optout),te(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>Go(i,t.in,n));return Go(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Go(s,t.out,n));return Go(o,t.out,n)}});function Go(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var df=y("$ZodPreprocess",(e,t)=>{rs.init(e,t)}),Qa=y("$ZodReadonly",(e,t)=>{ae.init(e,t),te(e,"propValues",(r)=>r.def.innerType._zod.propValues),te(e,"values",(r)=>r.def.innerType._zod.values),te(e,"optin",(r)=>r.def.innerType?._zod?.optin),te(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(Wp);return Wp(o)}});function Wp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var ec=y("$ZodCustom",(e,t)=>{Pe.init(e,t),ae.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((s)=>Xp(s,r,n,e));Xp(o,r,n,e);return}});function Xp(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push($r(o))}}class ff extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var rc="~memo",pf=[];function mf(e){return e!==null&&typeof e==="object"}function tc(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var hf=new WeakMap,Mn=0,ss=1,Dn=2;function is(e,t,r){let n=hf.get(e);if(n!==void 0)return n?Dn:Mn;if(t.has(e))return Dn;t.add(e);let o=Mn,s=(l)=>{if(o!==Dn&&l?._zod){let d=is(l,t,r);if(d>o)o=d}},i=(l,d)=>{let m=Mn;for(let p of Reflect.ownKeys(l)){let f=Object.getOwnPropertyDescriptor(l,p);if(d&&!f.enumerable)continue;let h=f.get?ss:f.value?._zod?is(f.value,t,r):Mn;if(h>m)m=h}return m},a=(l)=>{if(l>o)o=l},c=e._zod.def,u=c.type;switch(u){case"object":{let l=zn(c);a(l?i(l,!0):ss),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?is(l,t,!1):ss);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;let m=d.value;if(!m||typeof m!=="object")continue;if(m._zod)s(m);else if(Array.isArray(m))for(let p of m)s(p)}}return t.delete(e),o0(e,o)}function o0(e,t){if(t!==ss)hf.set(e,t===Dn);return t}function s0(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var ns,os=[],i0={alloc(e,t,r){let n=ns;if(!n)return r;ns=void 0;let o={value:r,issues:null};return n.set(t.value,o),os.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!=="backward"&&a0(s,o.value))throw new ff;return r(o,s)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let v=is(e,new Set,!1);if(v===Mn){if(e._zod.parse=i,e._zod.run===a)e._zod.run=i;return i(c,u)}if(v===Dn||n)r=!0;else n=!0}let l=c.value;if(!mf(l))return i(c,u);let d=u[rc];if(!d)d={buckets:new WeakMap,backEdges:void 0},u[rc]=d;let m;if(o===u)m=s;else m=s0(d,e),o=u,s=m;let p=m.get(l);if(p){if(c.value=p.value,p.issues){if(p.issues.length)c.issues.push(...tc(p.issues))}else c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value);return c}ns=m;let f=os.length,h=i(c,u);ns=void 0;let g=os.length>f?os.pop():void 0;if(h instanceof Promise)return h.then((v)=>{if(g)g.issues=v.issues.length?tc(v.issues):pf;return v});if(g)g.issues=h.issues.length?tc(h.issues):pf;return h};if(e._zod.parse=a,e._zod.run===i)e._zod.run=a})}};function gf(){return i0}function a0(e,t){let r=e[rc]?.backEdges;return r!==void 0&&mf(t)&&r.has(t)}var c0=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??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",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(s,i){if(s==="number"&&typeof i==="number"&&!Number.isFinite(i))return String(i);return n[s]??s}return(s)=>{switch(s.code){case"invalid_type":{let i=o(s.expected),a=Cd(s.input),c=o(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${Gi(s.values[0])}`;return`Invalid option: expected one of ${Ji(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);if(a)return`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);if(a)return`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`;return`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Ji(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((a)=>`'${a}'`).join(" | ")}`;if(s.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function nc(){return{localeError:c0()}}var _f;class yf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function u0(){return new yf}(_f=globalThis).__zod_globalRegistry??(_f.__zod_globalRegistry=u0());var wr=globalThis.__zod_globalRegistry;function vf(e){if(e.checks)e.checks=[...e.checks];return e}function oc(e,t){return new e(vf({type:"string",...I(t)}))}function sc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function ic(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function ac(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function cc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function uc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function lc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function dc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function pc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function fc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function mc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function hc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function gc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function _c(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function yc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function vc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function xc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function bc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function $c(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function wc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function kc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function Sc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function zc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}function as(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function Pc(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function Ec(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function Tc(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function Rc(e,t){return new e(vf({type:"number",checks:[],...I(t)}))}function Oc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function Ic(e,t){return new e({type:"boolean",...I(t)})}function Ac(e,t){return new e({type:"null",...I(t)})}function Cc(e){return new e({type:"unknown"})}function Nc(e,t){return new e({type:"never",...I(t)})}function cs(e,t){return new ua({check:"less_than",...I(t),value:e,inclusive:!1})}function qn(e,t){return new ua({check:"less_than",...I(t),value:e,inclusive:!0})}function us(e,t){return new la({check:"greater_than",...I(t),value:e,inclusive:!1})}function Ln(e,t){return new la({check:"greater_than",...I(t),value:e,inclusive:!0})}function ls(e,t){return new Ep({check:"multiple_of",...I(t),value:e})}function ds(e,t){return new Rp({check:"max_length",...I(t),maximum:e})}function Dr(e,t){return new Op({check:"min_length",...I(t),minimum:e})}function ps(e,t){return new Ip({check:"length_equals",...I(t),length:e})}function jc(e,t){return new Ap({check:"string_format",format:"regex",...I(t),pattern:e})}function Zc(e){return new Cp({check:"string_format",format:"lowercase",...I(e)})}function Mc(e){return new Np({check:"string_format",format:"uppercase",...I(e)})}function Dc(e,t){return new jp({check:"string_format",format:"includes",...I(t),includes:e})}function qc(e,t){return new Zp({check:"string_format",format:"starts_with",...I(t),prefix:e})}function Lc(e,t){return new Mp({check:"string_format",format:"ends_with",...I(t),suffix:e})}function Bt(e){return new Dp({check:"overwrite",tx:e})}function Fc(e){return Bt((t)=>t.normalize(e))}function Uc(){return Bt((e)=>e.trim())}function Vc(){return Bt((e)=>e.toLowerCase())}function Hc(){return Bt((e)=>e.toUpperCase())}function Bc(){return Bt((e)=>$d(e))}function xf(e,t,r){return new e({type:"array",element:t,...I(r)})}function Jc(e,t,r){let n=I(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Kc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function Gc(e,t){let r=l0((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push($r(o,n.value,r._zod.def));else{let s=o;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=n.value;s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push($r(s))}},e(n.value,n)),t);return r}function l0(e,t){let r=new Pe({check:"custom",...I(t)});return r._zod.check=e,r}function Fn(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))Ge(e,n,r[n]);return e}function Vn(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??wr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ee(e,t,r,n,o){let s=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw Error(o);return Object.assign(r,s),!0}function ce(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let m=i.schema,p=t.processors[o.type];if(!p)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,m,l)}let d=e._zod.parent;if(d){if(!i.ref)i.ref=d;ce(d,t,l),t.seen.get(d).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Fn(i.schema,c);if(t.io==="input"&&je(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function bf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Hn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,m=e.external.uri??((f)=>f);if(d)return{ref:m(d)};let p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${m("__shared")}#/${a}/${bf(p)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+bf(l)}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
63
|
+
`)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()},i,a=Zr,c=!Fe.jitless,l=c&&wd.value,d=t.catchall,m;e._zod.parse=(p,f)=>{m??(m=n.value);let h=p.value;if(!a(h))return p.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),p;if(c&&l&&f?.async===!1&&f.jitless!==!0){if(!i)i=s(t.shape);if(p=i(p,f),!d)return p;return uf([],h,p,f,m,e,f?.abortEarly===!0)}return r(p,f)}});function Vp(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!mt(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>ht(i,n,Ye())))}),t}var es=y("$ZodUnion",(e,t)=>{ae.init(e,t),te(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),te(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),te(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),te(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((s)=>s._zod.pattern);return new RegExp(`^(${o.map((s)=>Zo(s.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}if(!s)return Vp(i,n,e,o);return Promise.all(i).then((a)=>Vp(a,n,e,o))}});function n0(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var Fa=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,es.init(e,t);let r=e._zod.parse;te(e,"propValues",(o)=>{let s={},i=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))i++;for(let[u,l]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(s,u))Ge(s,u,new Set);for(let d of l)s[u].add(d)}}if(!o.def.unionFallback&&i>1)s[o.def.discriminator]?.delete(void 0);return s}),t.options.forEach((o,s)=>{let i=zn(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index "${s}"`)});let n=Sn(()=>n0(t));e._zod.parse=(o,s)=>{let i=o.value;if(!Zr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=i?.[t.discriminator],c=n.value.get(a);if(c&&(a!==void 0||s.direction!=="backward"))return c._zod.run(o,s);if(t.unionFallback||s.direction==="backward")return r(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((u)=>n.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),o}}),Ua=y("$ZodIntersection",(e,t)=>{ae.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([c,u])=>Hp(r,c,u));return Hp(r,s,i)}});function fa(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(br(e)&&br(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let s of n){if(s==="__proto__")continue;let i=fa(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=fa(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Hp(e,t,r){let n=new Map,o,s=new Map,i=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);if(!s.has(m))s.set(m,u);d=[m]}else return!1;for(let m of d){if(!n.has(m))n.set(m,{});n.get(m)[l]=!0}return!0};for(let u of t.issues)if(!i(u,"l"))e.issues.push(u);for(let u of r.issues)if(!i(u,"r"))e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter((l)=>o.keys.includes(l)):[];if(u.length)e.issues.push({...o,keys:u});for(let l of a)if(!u.includes(l)&&s.has(l))e.issues.push(s.get(l))}let c=fa(t.value,r.value);if(!c.valid){if(mt(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Va=y("$ZodRecord",(e,t)=>{ae.init(e,t);let r=Fe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!br(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(c.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((f)=>ht(f,o,Ye())),input:l,path:[l],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let p=t.valueType._zod.run({value:s[l],issues:[]},o);if(p instanceof Promise)i.push(p.then((f)=>{if(f.issues.length)n.issues.push(...Ht(l,f.issues));n.value[m]=f.value}));else{if(p.issues.length)n.issues.push(...Ht(l,p.issues));n.value[m]=p.value}}let u;for(let l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=s[l]}else u=u??[],u.push(l);if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let u of Reflect.ownKeys(s)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Nn.test(u)&&l.issues.length){let f=t.keyType._zod.run({value:Number(u),issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)l=f}if(l.issues.length){if(t.mode==="loose")n.value[u]=s[u];else if(a)c=c??[],c.push(u);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((f)=>ht(f,o,Ye())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let p=t.valueType._zod.run({value:s[u],issues:[]},o);if(p instanceof Promise)i.push(p.then((f)=>{if(f.issues.length)n.issues.push(...Ht(u,f.issues));n.value[m]=f.value}));else{if(p.issues.length)n.issues.push(...Ht(u,p.issues));n.value[m]=p.value}}if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}if(i.length)return Promise.all(i).then(()=>n);return n}});var Ha=y("$ZodEnum",(e,t)=>{ae.init(e,t);let r=wn(t.entries),n=new Set(r);e._zod.values=n,te(e,"pattern",(o)=>{let s=wn(o.def.entries).filter((i)=>kd.has(typeof i));return new RegExp(s.length?`^(${s.map((i)=>Vt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),Ba=y("$ZodLiteral",(e,t)=>{ae.init(e,t);let r=new Set(t.values);e._zod.values=r,te(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((s)=>typeof s==="string"?Vt(s):s?Vt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var Ja=y("$ZodTransform",(e,t)=>{ae.init(e,t),e._zod.optin="optional",Fe.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pn(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(r.value=i,r));if(o instanceof Promise)throw new gt;return r.value=o,r}});function Bp(e,t){return e.value=t.issues.length?void 0:t.value,e}var ts=y("$ZodOptional",(e,t)=>{ae.init(e,t),te(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",te(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),te(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zo(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>Bp(r,s));return Bp(r,o)}return t.innerType._zod.run(r,n)}}),Ka=y("$ZodExactOptional",(e,t)=>{ts.init(e,t),te(e,"values",(r)=>r.def.innerType._zod.values),te(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Ga=y("$ZodNullable",(e,t)=>{ae.init(e,t),te(e,"optin",(r)=>r.def.innerType._zod.optin),te(e,"optout",(r)=>r.def.innerType._zod.optout),te(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zo(n.source)}|null)$`):void 0}),te(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Wa=y("$ZodDefault",(e,t)=>{ae.init(e,t),e._zod.optin="defaulted",te(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Jp(s,t));return Jp(o,t)}});function Jp(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Xa=y("$ZodPrefault",(e,t)=>{ae.init(e,t),e._zod.optin="defaulted",te(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Ya=y("$ZodNonOptional",(e,t)=>{ae.init(e,t),te(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Kp(s,e));return Kp(o,e)}});function Kp(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Gp(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>ht(o,n,Ye()))},input:e.value}),e}var Qa=y("$ZodCatch",(e,t)=>{ae.init(e,t),te(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),te(e,"optout",(r)=>r.def.innerType._zod.optout),te(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>Gp(r,s,t,n));return Gp(r,o,t,n)}});var rs=y("$ZodPipe",(e,t)=>{ae.init(e,t),te(e,"values",(r)=>r.def.in._zod.values),te(e,"optin",(r)=>r.def.in._zod.optin),te(e,"optout",(r)=>r.def.out._zod.optout),te(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>Go(i,t.in,n));return Go(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Go(s,t.out,n));return Go(o,t.out,n)}});function Go(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var df=y("$ZodPreprocess",(e,t)=>{rs.init(e,t)}),ec=y("$ZodReadonly",(e,t)=>{ae.init(e,t),te(e,"propValues",(r)=>r.def.innerType._zod.propValues),te(e,"values",(r)=>r.def.innerType._zod.values),te(e,"optin",(r)=>r.def.innerType?._zod?.optin),te(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(Wp);return Wp(o)}});function Wp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var tc=y("$ZodCustom",(e,t)=>{Pe.init(e,t),ae.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((s)=>Xp(s,r,n,e));Xp(o,r,n,e);return}});function Xp(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push($r(o))}}class ff extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var nc="~memo",pf=[];function mf(e){return e!==null&&typeof e==="object"}function rc(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var hf=new WeakMap,Mn=0,ss=1,Dn=2;function is(e,t,r){let n=hf.get(e);if(n!==void 0)return n?Dn:Mn;if(t.has(e))return Dn;t.add(e);let o=Mn,s=(l)=>{if(o!==Dn&&l?._zod){let d=is(l,t,r);if(d>o)o=d}},i=(l,d)=>{let m=Mn;for(let p of Reflect.ownKeys(l)){let f=Object.getOwnPropertyDescriptor(l,p);if(d&&!f.enumerable)continue;let h=f.get?ss:f.value?._zod?is(f.value,t,r):Mn;if(h>m)m=h}return m},a=(l)=>{if(l>o)o=l},c=e._zod.def,u=c.type;switch(u){case"object":{let l=zn(c);a(l?i(l,!0):ss),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?is(l,t,!1):ss);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;let m=d.value;if(!m||typeof m!=="object")continue;if(m._zod)s(m);else if(Array.isArray(m))for(let p of m)s(p)}}return t.delete(e),o0(e,o)}function o0(e,t){if(t!==ss)hf.set(e,t===Dn);return t}function s0(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var ns,os=[],i0={alloc(e,t,r){let n=ns;if(!n)return r;ns=void 0;let o={value:r,issues:null};return n.set(t.value,o),os.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!=="backward"&&a0(s,o.value))throw new ff;return r(o,s)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let v=is(e,new Set,!1);if(v===Mn){if(e._zod.parse=i,e._zod.run===a)e._zod.run=i;return i(c,u)}if(v===Dn||n)r=!0;else n=!0}let l=c.value;if(!mf(l))return i(c,u);let d=u[nc];if(!d)d={buckets:new WeakMap,backEdges:void 0},u[nc]=d;let m;if(o===u)m=s;else m=s0(d,e),o=u,s=m;let p=m.get(l);if(p){if(c.value=p.value,p.issues){if(p.issues.length)c.issues.push(...rc(p.issues))}else c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value);return c}ns=m;let f=os.length,h=i(c,u);ns=void 0;let g=os.length>f?os.pop():void 0;if(h instanceof Promise)return h.then((v)=>{if(g)g.issues=v.issues.length?rc(v.issues):pf;return v});if(g)g.issues=h.issues.length?rc(h.issues):pf;return h};if(e._zod.parse=a,e._zod.run===i)e._zod.run=a})}};function gf(){return i0}function a0(e,t){let r=e[nc]?.backEdges;return r!==void 0&&mf(t)&&r.has(t)}var c0=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??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",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(s,i){if(s==="number"&&typeof i==="number"&&!Number.isFinite(i))return String(i);return n[s]??s}return(s)=>{switch(s.code){case"invalid_type":{let i=o(s.expected),a=Cd(s.input),c=o(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${Wi(s.values[0])}`;return`Invalid option: expected one of ${Ki(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);if(a)return`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);if(a)return`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`;return`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Ki(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((a)=>`'${a}'`).join(" | ")}`;if(s.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function oc(){return{localeError:c0()}}var _f;class yf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function u0(){return new yf}(_f=globalThis).__zod_globalRegistry??(_f.__zod_globalRegistry=u0());var wr=globalThis.__zod_globalRegistry;function vf(e){if(e.checks)e.checks=[...e.checks];return e}function sc(e,t){return new e(vf({type:"string",...I(t)}))}function ic(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function ac(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function cc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function uc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function lc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function dc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function pc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function fc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function mc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function hc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function gc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function _c(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function yc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function vc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function xc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function bc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function $c(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function wc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function kc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function Sc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function zc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function Pc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}function as(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function Ec(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function Tc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function Rc(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function Oc(e,t){return new e(vf({type:"number",checks:[],...I(t)}))}function Ic(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function Ac(e,t){return new e({type:"boolean",...I(t)})}function Cc(e,t){return new e({type:"null",...I(t)})}function Nc(e){return new e({type:"unknown"})}function jc(e,t){return new e({type:"never",...I(t)})}function cs(e,t){return new la({check:"less_than",...I(t),value:e,inclusive:!1})}function qn(e,t){return new la({check:"less_than",...I(t),value:e,inclusive:!0})}function us(e,t){return new da({check:"greater_than",...I(t),value:e,inclusive:!1})}function Ln(e,t){return new da({check:"greater_than",...I(t),value:e,inclusive:!0})}function ls(e,t){return new Ep({check:"multiple_of",...I(t),value:e})}function ds(e,t){return new Rp({check:"max_length",...I(t),maximum:e})}function Dr(e,t){return new Op({check:"min_length",...I(t),minimum:e})}function ps(e,t){return new Ip({check:"length_equals",...I(t),length:e})}function Zc(e,t){return new Ap({check:"string_format",format:"regex",...I(t),pattern:e})}function Mc(e){return new Cp({check:"string_format",format:"lowercase",...I(e)})}function Dc(e){return new Np({check:"string_format",format:"uppercase",...I(e)})}function qc(e,t){return new jp({check:"string_format",format:"includes",...I(t),includes:e})}function Lc(e,t){return new Zp({check:"string_format",format:"starts_with",...I(t),prefix:e})}function Fc(e,t){return new Mp({check:"string_format",format:"ends_with",...I(t),suffix:e})}function Bt(e){return new Dp({check:"overwrite",tx:e})}function Uc(e){return Bt((t)=>t.normalize(e))}function Vc(){return Bt((e)=>e.trim())}function Hc(){return Bt((e)=>e.toLowerCase())}function Bc(){return Bt((e)=>e.toUpperCase())}function Jc(){return Bt((e)=>$d(e))}function xf(e,t,r){return new e({type:"array",element:t,...I(r)})}function Kc(e,t,r){let n=I(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Gc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function Wc(e,t){let r=l0((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push($r(o,n.value,r._zod.def));else{let s=o;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=n.value;s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push($r(s))}},e(n.value,n)),t);return r}function l0(e,t){let r=new Pe({check:"custom",...I(t)});return r._zod.check=e,r}function Fn(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))Ge(e,n,r[n]);return e}function Vn(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??wr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ee(e,t,r,n,o){let s=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw Error(o);return Object.assign(r,s),!0}function ce(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let m=i.schema,p=t.processors[o.type];if(!p)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,m,l)}let d=e._zod.parent;if(d){if(!i.ref)i.ref=d;ce(d,t,l),t.seen.get(d).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Fn(i.schema,c);if(t.io==="input"&&je(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function bf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Hn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,m=e.external.uri??((f)=>f);if(d)return{ref:m(d)};let p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${m("__shared")}#/${a}/${bf(p)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+bf(l)}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
64
64
|
|
|
65
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref")s(i)}}if(e.external)e.sharedDefsExtractedFor=e.external}function kf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;kf(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let s=n.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!=="string")return;if(!r.includes(i))r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Sf=new Set(["type","properties","required","additionalProperties"]),$f=["oneOf","anyOf"];function wf(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Wc(e){let t=[];for(let s of e){if(typeof s!=="object"||s.type!=="object")return null;for(let i in s)if(!Sf.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??wf(u);if(l===null||l===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(l)))a.push(l)}let c=a.length===1?a[0]:Wc(a)??{allOf:a};Ge(r,i,c)}for(let i of s.required??[])n.add(i)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((s)=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let a=wf(i);if(a&&!s.some((c)=>JSON.stringify(c)===JSON.stringify(a)))s.push(a)}if(s.length===1)o.additionalProperties=s[0];else if(s.length>1)o.additionalProperties={allOf:s}}return o}function d0(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Sf)if(o in e)return;let r=t.filter((o)=>$f.some((s)=>Array.isArray(o[s]))),n=null;if(!r.length)n=Wc(t);else{let o=r[0],s=$f.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let i=t.filter((c)=>c!==o),a=o[s].map((c)=>Wc([...i,c]));if(a.some((c)=>!c))return;n={[s]:a}}if(!n)return;delete e.allOf,Fn(e,n)}function Bn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){n(d);let p=e.seen.get(d),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(f);else Fn(u,f);if(Fn(u,l),a._zod.parent===d)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(!(g in l))delete u[g]}if(f.$ref&&p.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in p.def&&JSON.stringify(u[g])===JSON.stringify(p.def[g]))delete u[g]}}let m=a._zod.parent;if(m&&m!==d){n(m);let p=e.seen.get(m);if(p?.schema.$ref){if(u.$ref=p.schema.$ref,p.def)for(let f in u){if(f==="$ref"||f==="allOf")continue;if(f in p.def&&JSON.stringify(u[f])===JSON.stringify(p.def[f]))delete u[f]}}}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())kf(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);if(d)d.push(u);else a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])d0(u)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Fn(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;Ge(i,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")o.$defs=i;else o.definitions=i;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Un(t,"input",e.processors),output:Un(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function je(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return je(n.element,r);if(n.type==="set")return je(n.valueType,r);if(n.type==="lazy")return je(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"||n.type==="catch")return je(n.innerType,r);if(n.type==="intersection")return je(n.left,r)||je(n.right,r);if(n.type==="record"||n.type==="map")return je(n.keyType,r)||je(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return je(n.in,r)||je(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(je(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(je(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(je(o,r))return!0;if(n.rest&&je(n.rest,r))return!0;return!1}return!1}var zf=(e,t={})=>(r)=>{let n=Vn({...r,processors:t});return ce(e,n),Hn(n,e),Bn(n,e)},Un=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=Vn({...o??{},target:s,io:t,processors:r});return ce(e,i),Hn(i,e),Bn(i,e)};var qr=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Lr=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Pf=(e,t)=>{qr(e,"minimum",t),Lr(e,"maximum",t)},If=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Af=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Cf=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Nf=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Ef=(e,t)=>qr(e,"minimum",t.minimum),Tf=(e,t)=>Lr(e,"maximum",t.maximum),Rf=(e)=>(t,r)=>{Nf(t,r.format);let[n,o]=e[r.format];qr(t,"minimum",n),Lr(t,"maximum",o)},p0={greater_than:(e,t)=>qr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Lr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>If(e,t.value),number_format:Rf(Do),bigint_format:Rf(Wi),min_length:Ef,max_length:Tf,length_equals:(e,t)=>Pf(e,t.length),min_size:Ef,max_size:Tf,size_equals:(e,t)=>Pf(e,t.size),string_format:(e,t)=>{if(Nf(e,t.format),t.pattern)Af(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Cf(e,t.mime)};function Ue(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of n)p0[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)qr(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)qr(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)Lr(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)Lr(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)If(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)Cf(t,o.mime);for(let s of o.patterns??[])Af(t,s);return t}var f0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},m0=new Map([[Ta,hp],[Yo,gp]]),jf=(e)=>m0.get(e)??e,Qc=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=Ue(e);if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(a){if(o.format=f0[a]??a,o.format==="")delete o.format;if(a==="time"||l)delete o.format}if(u)o.contentEncoding=u;if(c&&c.size>0){let d=[...c].map(jf);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},eu=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=Ue(e);o.type=l?"integer":"number";let d=typeof u==="number"&&u>=(s??Number.NEGATIVE_INFINITY),m=typeof c==="number"&&c<=(i??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(p)o.minimum=u,o.exclusiveMinimum=!0;else o.exclusiveMinimum=u;else if(typeof s==="number")o.minimum=s;if(m)if(p)o.maximum=c,o.exclusiveMaximum=!0;else o.exclusiveMaximum=c;else if(typeof i==="number")o.maximum=i;if(a){let f=new Set;for(let v of a)if(Number.isFinite(v)&&v!==0)f.add(Math.abs(v));else Ee(e,t,o,n,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[h,...g]=f;if(h!==void 0)o.multipleOf=h;if(g.length)o.allOf=[...o.allOf??[],...g.map((v)=>({multipleOf:v}))]}},tu=(e,t,r,n)=>{r.type="boolean"},Zf=(e,t,r,n)=>{Ee(e,t,r,n,"BigInt cannot be represented in JSON Schema")},Mf=(e,t,r,n)=>{Ee(e,t,r,n,"Symbols cannot be represented in JSON Schema")},ru=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},Df=(e,t,r,n)=>{Ee(e,t,r,n,"Undefined cannot be represented in JSON Schema")},qf=(e,t,r,n)=>{Ee(e,t,r,n,"Void cannot be represented in JSON Schema")},nu=(e,t,r,n)=>{r.not={}},Lf=(e,t,r,n)=>{},ou=(e,t,r,n)=>{},Ff=(e,t,r,n)=>{Ee(e,t,r,n,"Date cannot be represented in JSON Schema")},su=(e,t,r,n)=>{let o=e._zod.def,s=wn(o.entries);if(s.length===0){r.not={};return}if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},iu=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(Ee(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i==="bigint"){if(Ee(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}},Uf=(e,t,r,n)=>{Ee(e,t,r,n,"NaN cannot be represented in JSON Schema")},Vf=(e,t,r,n)=>{let o=r,s=e._zod.pattern;if(!s)throw Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},Hf=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:s,maximum:i,mime:a}=Ue(e);if(s!==void 0)o.minLength=s;if(i!==void 0)o.maxLength=i;if(!a)return;if(a.length===0)o.not={};else if(a.length===1)o.contentMediaType=a[0];else o.anyOf=a.map((c)=>({contentMediaType:c}))},Bf=(e,t,r,n)=>{r.type="boolean"},au=(e,t,r,n)=>{Ee(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Jf=(e,t,r,n)=>{Ee(e,t,r,n,"Function types cannot be represented in JSON Schema")},cu=(e,t,r,n)=>{Ee(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Kf=(e,t,r,n)=>{Ee(e,t,r,n,"Map cannot be represented in JSON Schema")},Gf=(e,t,r,n)=>{Ee(e,t,r,n,"Set cannot be represented in JSON Schema")},uu=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=Ue(e);if(typeof i==="number")o.minItems=i;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=ce(s.element,t,{...n,path:[...n.path,"items"]})};function Jn(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Jn(t.out);if(t.type==="catch")return Jn(t.innerType);return e._zod.optin}var lu=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&Ee(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in i)Ge(o.properties,u,ce(i[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];if(t.io==="input"?Jn(l)===void 0:l._zod.optout===void 0)c.push(u)}if(c.length>0)o.required=c;if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=ce(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},du=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>ce(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));if(s)r.oneOf=i;else r.anyOf=i},pu=(e,t,r,n)=>{let o=e._zod.def,s=ce(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=ce(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)},Wf=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((h,g)=>ce(h,t,{...n,path:[...n.path,i,g]})),u=s.rest?ce(s.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null,l=s.items.length;while(l>0){let h=s.items[l-1];if(!(t.io==="input"?Jn(h)!==void 0:h._zod.optout==="optional"))break;l--}let d=s.items.length,m=!s.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=c,m)o.items=!1;else if(u)o.items=u;if(l>0)o.minItems=l;if(m)o.maxItems=d}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},u)o.items.anyOf.push(u);if(l>0)o.minItems=l;if(m)o.maxItems=d}else{if(o.items=c,m)o.additionalItems=!1;else if(u)o.additionalItems=u;if(l>0)o.minItems=l;if(m)o.maxItems=d}let{minimum:p,maximum:f}=Ue(e);if(typeof p==="number")o.minItems=p;if(typeof f==="number")o.maxItems=f};function Xc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let f=e.get(t)?.def;if(!f)return t;let h=Xc(e,f,r);return h===f?t:h}for(let f of["anyOf","oneOf"]){let h=t[f];if(!Array.isArray(h))continue;let g=h.map((v)=>Xc(e,v,r));if(g.some((v,T)=>v!==h[T]))t={...t,[f]:g}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((f)=>f==="number"||f==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some((f)=>typeof f==="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:m,...p}=t;if(p.enum)p.enum=p.enum.map((f)=>typeof f==="number"?String(f):f);else if(typeof p.const==="number")p.const=String(p.const);if(!o)return p;if(p.type="string",!s)p.pattern=(n.includes("number")?Nn:aa).source;return p}var Yc=new WeakMap;function h0(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of Yc.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Xc(t,s,new Set);if(i!==s)r.set(s,i)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let s=o&&r.get(o.propertyNames);if(s)o.propertyNames=s}}var fu=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,a=Ue(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=ce(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)Ge(o.patternProperties,jf(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=ce(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Yc.get(t);if(!l)l=[],Yc.set(t,l),t.deferred.push(()=>h0(t));l.push(e)}o.additionalProperties=ce(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&Jn(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter((d)=>typeof d==="string"||typeof d==="number");if(l.length>0)o.required=l.map(String)}},mu=(e,t,r,n)=>{let o=e._zod.def,s=ce(o.innerType,t,n),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},hu=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},gu=Symbol();function Xf(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return s=!0,null});if(!s)return JSON.parse(i);return Ee(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),gu}var _u=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=Xf(o.defaultValue,e,t,r,n);if(i!==gu)r.default=i},yu=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=Xf(o.defaultValue,e,t,r,n);if(i!==gu)r._prefault=i},vu=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{Ee(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},xu=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;ce(i,t,n);let a=t.seen.get(e);a.ref=i},bu=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0},Yf=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},fs=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Qf=(e,t,r,n)=>{let o=e._zod.innerType;ce(o,t,n);let s=t.seen.get(e);s.ref=o},Of={string:Qc,number:eu,boolean:tu,bigint:Zf,symbol:Mf,null:ru,undefined:Df,void:qf,never:nu,any:Lf,unknown:ou,date:Ff,enum:su,literal:iu,nan:Uf,template_literal:Vf,file:Hf,success:Bf,custom:au,function:Jf,transform:cu,map:Kf,set:Gf,array:uu,object:lu,union:du,intersection:pu,tuple:Wf,record:fu,nullable:mu,nonoptional:hu,default:_u,prefault:yu,catch:vu,pipe:xu,readonly:bu,promise:Yf,optional:fs,lazy:Qf};function $u(e,t){if("_idmap"in e){let n=e,o=Vn({...t,processors:Of}),s={};for(let c of n._idmap.entries()){let[u,l]=c;ce(l,o)}let i={},a={registry:n,uri:t?.uri,defs:s};o.external=a;for(let c of n._idmap.entries()){let[u,l]=c;Hn(o,l),Ge(i,u,Bn(o,l))}if(Object.keys(s).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:s}}return{schemas:i}}let r=Vn({...t,processors:Of});return ce(e,r),Hn(r,e),Bn(r,e)}var tm=new WeakSet([Object.prototype,Error.prototype]);function ms(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var w0=(e,t)=>{Fd.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(tm.has(r))return;tm.add(r),ms(r,"format",(n)=>(o)=>Vd(n,o)),ms(r,"flatten",(n)=>(o)=>Ud(n,o)),ms(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,kn,2)}),ms(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,kn,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var Qe=y("ZodError",w0,void 0,{Parent:Error});var rm=Tn(Qe),nm=Rn(Qe),om=On(Qe),sm=An(Qe),im=Bd(Qe),am=Jd(Qe),cm=Kd(Qe),um=Gd(Qe),lm=Wd(Qe),dm=Xd(Qe),pm=Yd(Qe),fm=Qd(Qe);function h$(){if(!Fe.localeError)Ye(nc())}function gs(){if(!Fe.memoizer)Ye({memoizer:gf()})}var me=y("ZodType",(e,t)=>(h$(),ae.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Le(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return We(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ow(e,t))},superRefine(e,t){return this.check(sw(e,t))},overwrite(e){return this.check(Bt(e))},optional(){return fe(this)},exactOptional(){return B$(this)},nullable(){return gm(this)},nullish(){return fe(gm(this))},nonoptional(e){return Y$(this,e)},array(){return W(this)},or(e){return de([this,e])},and(e){return _s(this,e)},transform(e){return _m(this,zm(e))},default(e){return G$(this,e)},prefault(e){return X$(this,e)},catch(e){return ew(this,e)},pipe(e){return _m(this,e)},readonly(){return nw(this)},describe(e){let t=this.clone();return wr.add(t,{description:e}),t},meta(...e){if(e.length===0)return wr.get(this);let t=this.clone();return wr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Vo(this,"~standard",{...fa(this),jsonSchema:{input:Un(this,"input"),output:Un(this,"output")}})},set "~standard"(e){ut(this,"~standard",e)},parse:function e(t,r){return rm(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await nm(this,t,r,{callee:e})},safeParse(e,t){return om(this,e,t)},async safeParseAsync(e,t){return sm(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ut(this,"spa",e)},validate(e,t){return Bo(this,e,t)},validateAsync(e,t){return Jo(this,e,t)},encode:function e(t,r){return im(this,t,r,{callee:e})},decode:function e(t,r){return am(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await cm(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await um(this,t,r,{callee:e})},safeEncode(e,t){return lm(this,e,t)},safeDecode(e,t){return dm(this,e,t)},async safeEncodeAsync(e,t){return pm(this,e,t)},async safeDecodeAsync(e,t){return fm(this,e,t)},toJSONSchema(e){return zf(this,{})(e)},get description(){return wr.get(this)?.description},get _def(){return this._zod.def}}),ym=y("_ZodString",(e,t)=>{Zn.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qc(e,r,n,o)},jd({format:(e)=>Ue(e).format??null,minLength:(e)=>Ue(e).minimum??null,maxLength:(e)=>Ue(e).maximum??null},{regex(...e){return this.check(jc(...e))},includes(...e){return this.check(Dc(...e))},startsWith(...e){return this.check(qc(...e))},endsWith(...e){return this.check(Lc(...e))},min(...e){return this.check(Dr(...e))},max(...e){return this.check(ds(...e))},length(...e){return this.check(ps(...e))},nonempty(...e){return this.check(Dr(1,...e))},lowercase(e){return this.check(Zc(e))},uppercase(e){return this.check(Mc(e))},trim(){return this.check(Uc())},normalize(...e){return this.check(Fc(...e))},toLowerCase(){return this.check(Vc())},toUpperCase(){return this.check(Hc())},slugify(){return this.check(Bc())}})),g$=y("ZodString",(e,t)=>{Zn.init(e,t),ym.init(e,t)},{email(e){return this.check(sc(_$,e))},url(e){return this.check(dc(v$,e))},jwt(e){return this.check(zc(C$,e))},emoji(e){return this.check(pc(x$,e))},guid(e){return this.check(ic(y$,e))},uuid(e){return this.check(ac(hs,e))},uuidv4(e){return this.check(cc(hs,e))},uuidv6(e){return this.check(uc(hs,e))},uuidv7(e){return this.check(lc(hs,e))},nanoid(e){return this.check(fc(b$,e))},cuid(e){return this.check(mc($$,e))},cuid2(e){return this.check(hc(w$,e))},ulid(e){return this.check(gc(k$,e))},base64(e){return this.check(wc(O$,e))},base64url(e){return this.check(kc(I$,e))},xid(e){return this.check(_c(S$,e))},ksuid(e){return this.check(yc(z$,e))},ipv4(e){return this.check(vc(P$,e))},ipv6(e){return this.check(xc(E$,e))},cidrv4(e){return this.check(bc(T$,e))},cidrv6(e){return this.check($c(R$,e))},e164(e){return this.check(Sc(A$,e))},datetime(e){return this.check(as(ku,e))},date(e){return this.check(Pc(vm,e))},time(e){return this.check(Ec(xm,e))},duration(e){return this.check(Tc(bm,e))}});function _(e){return oc(g$,e)}var _e=y("ZodStringFormat",(e,t)=>{ue.init(e,t),ym.init(e,t)}),ku=y("ZodISODateTime",(e,t)=>{tf.init(e,t),_e.init(e,t)}),vm=y("ZodISODate",(e,t)=>{rf.init(e,t),_e.init(e,t)}),xm=y("ZodISOTime",(e,t)=>{nf.init(e,t),_e.init(e,t)}),bm=y("ZodISODuration",(e,t)=>{of.init(e,t),_e.init(e,t)}),_$=y("ZodEmail",(e,t)=>{ga.init(e,t),_e.init(e,t)});var y$=y("ZodGUID",(e,t)=>{ma.init(e,t),_e.init(e,t)});var hs=y("ZodUUID",(e,t)=>{ha.init(e,t),_e.init(e,t)});var v$=y("ZodURL",(e,t)=>{_a.init(e,t),_e.init(e,t)});var x$=y("ZodEmoji",(e,t)=>{ya.init(e,t),_e.init(e,t)});var b$=y("ZodNanoID",(e,t)=>{va.init(e,t),_e.init(e,t)});var $$=y("ZodCUID",(e,t)=>{xa.init(e,t),_e.init(e,t)});var w$=y("ZodCUID2",(e,t)=>{ba.init(e,t),_e.init(e,t)});var k$=y("ZodULID",(e,t)=>{$a.init(e,t),_e.init(e,t)});var S$=y("ZodXID",(e,t)=>{wa.init(e,t),_e.init(e,t)});var z$=y("ZodKSUID",(e,t)=>{ka.init(e,t),_e.init(e,t)});var P$=y("ZodIPv4",(e,t)=>{Sa.init(e,t),_e.init(e,t)});var E$=y("ZodIPv6",(e,t)=>{za.init(e,t),_e.init(e,t)});var T$=y("ZodCIDRv4",(e,t)=>{Pa.init(e,t),_e.init(e,t)});var R$=y("ZodCIDRv6",(e,t)=>{Ea.init(e,t),_e.init(e,t)});var O$=y("ZodBase64",(e,t)=>{Ra.init(e,t),_e.init(e,t)});var I$=y("ZodBase64URL",(e,t)=>{Oa.init(e,t),_e.init(e,t)});var A$=y("ZodE164",(e,t)=>{Ia.init(e,t),_e.init(e,t)});var C$=y("ZodJWT",(e,t)=>{Aa.init(e,t),_e.init(e,t)});var $m=y("ZodNumber",(e,t)=>{Qo.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eu(e,r,n,o),e.isFinite=!0},jd({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=Ue(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=Ue(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=Ue(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>Ue(e).format??null},{gt(e,t){return this.check(us(e,t))},gte(e,t){return this.check(Ln(e,t))},min(e,t){return this.check(Ln(e,t))},lt(e,t){return this.check(cs(e,t))},lte(e,t){return this.check(qn(e,t))},max(e,t){return this.check(qn(e,t))},int(e){return this.check(mm(e))},safe(e){return this.check(mm(e))},positive(e){return this.check(us(0,e))},nonnegative(e){return this.check(Ln(0,e))},negative(e){return this.check(cs(0,e))},nonpositive(e){return this.check(qn(0,e))},multipleOf(e,t){return this.check(ls(e,t))},step(e,t){return this.check(ls(e,t))},finite(){return this}}));function ne(e){return Rc($m,e)}var N$=y("ZodNumberFormat",(e,t)=>{Ca.init(e,t),$m.init(e,t)});function mm(e){return Oc(N$,e)}var j$=y("ZodBoolean",(e,t)=>{Na.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tu(e,r,n,o)});function Te(e){return Ic(j$,e)}var Z$=y("ZodNull",(e,t)=>{ja.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ru(e,r,n,o)});function wm(e){return Ac(Z$,e)}var M$=y("ZodUnknown",(e,t)=>{Za.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ou(e,r,n,o)});function pe(){return Cc(M$)}var D$=y("ZodNever",(e,t)=>{Ma.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nu(e,r,n,o)});function q$(e){return Nc(D$,e)}var L$=y("ZodArray",(e,t)=>{gs(),Da.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uu(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Dr(e,t))},nonempty(e){return this.check(Dr(1,e))},max(e,t){return this.check(ds(e,t))},length(e,t){return this.check(ps(e,t))},unwrap(){return this.element}});function W(e,t){return xf(L$,e,t)}var km=y("ZodObject",(e,t)=>{gs(),lf.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lu(e,r,n,o),Qi(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Ae(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Le(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Le(this._zod.def,{catchall:pe()}))},loose(){return this.clone(Le(this._zod.def,{catchall:pe()}))},strict(){return this.clone(Le(this._zod.def,{catchall:q$()}))},strip(){return this.clone(Le(this._zod.def,{catchall:void 0}))},extend(e){return Ed(this,e)},safeExtend(e){return Rd(this,e)},merge(e){return Od(this,e)},pick(e){return zd(this,e)},omit(e){return Pd(this,e)},partial(...e){return Xi(ys,this,e[0])},exactPartial(...e){return Xi(Pm,this,e[0],"exactPartial")},required(...e){return Id(Em,this,e[0])}});function R(e,t){let r={type:"object",shape:e??{},...I(t)};return new km(r)}function Ze(e,t){return new km({type:"object",shape:e,catchall:pe(),...I(t)})}var Sm=y("ZodUnion",(e,t)=>{es.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>du(e,r,n,o),e.options=t.options});function de(e,t){return new Sm({type:"union",options:e,...I(t)})}var F$=y("ZodDiscriminatedUnion",(e,t)=>{Sm.init(e,t),La.init(e,t)});function Su(e,t,r){return new F$({type:"union",options:t,discriminator:e,...I(r)})}var U$=y("ZodIntersection",(e,t)=>{Fa.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pu(e,r,n,o)});function _s(e,t){return new U$({type:"intersection",left:e,right:t})}var hm=y("ZodRecord",(e,t)=>{gs(),Ua.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fu(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function le(e,t,r){if(!t||!t._zod)return new hm({type:"record",keyType:_(),valueType:e,...I(t)});return new hm({type:"record",keyType:e,valueType:t,...I(r)})}var wu=y("ZodEnum",(e,t)=>{Va.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,o,s)=>su(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new wu({...t,checks:[],...I(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new wu({...t,checks:[],...I(o),entries:s})}});function Ae(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new wu({type:"enum",entries:r,...I(t)})}var V$=y("ZodLiteral",(e,t)=>{Ha.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>iu(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Z(e,t){return new V$({type:"literal",values:Array.isArray(e)?e:[e],...I(t)})}var H$=y("ZodTransform",(e,t)=>{gs(),Ba.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cu(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pn(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push($r(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=e),r.issues.push($r(i))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r));return r.value=o,r}});function zm(e){return new H$({type:"transform",transform:e})}var ys=y("ZodOptional",(e,t)=>{ts.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fe(e){return new ys({type:"optional",innerType:e})}var Pm=y("ZodExactOptional",(e,t)=>{Ja.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function B$(e){return new Pm({type:"optional",innerType:e})}var J$=y("ZodNullable",(e,t)=>{Ka.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gm(e){return new J$({type:"nullable",innerType:e})}var K$=y("ZodDefault",(e,t)=>{Ga.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_u(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function G$(e,t){return new K$({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Mo(t)}})}var W$=y("ZodPrefault",(e,t)=>{Wa.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function X$(e,t){return new W$({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Mo(t)}})}var Em=y("ZodNonOptional",(e,t)=>{Xa.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Y$(e,t){return new Em({type:"nonoptional",innerType:e,...I(t)})}var Q$=y("ZodCatch",(e,t)=>{Ya.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ew(e,t){return new Q$({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Zd(t)})}var Tm=y("ZodPipe",(e,t)=>{rs.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xu(e,r,n,o),e.in=t.in,e.out=t.out});function _m(e,t){return new Tm({type:"pipe",in:e,out:t})}var tw=y("ZodPreprocess",(e,t)=>{Tm.init(e,t),df.init(e,t)}),rw=y("ZodReadonly",(e,t)=>{Qa.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function nw(e){return new rw({type:"readonly",innerType:e})}var Rm=y("ZodCustom",(e,t)=>{ec.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>au(e,r,n,o)});function Om(e,t){return Jc(Rm,e??(()=>!0),t)}function ow(e,t={}){return Kc(Rm,e,t)}function sw(e,t){return Gc(e,t)}function zu(e,t){return new tw({type:"pipe",in:zm(e),out:t})}function iw(e){return as(ku,e)}var Pu="2025-11-25";var Cm=[Pu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Jt="io.modelcontextprotocol/related-task",xs="2.0",ze=Om((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),Nm=de([_(),ne().int()]),jm=_(),FA=Ze({ttl:ne().optional(),pollInterval:ne().optional()}),aw=R({ttl:ne().optional()}),cw=R({taskId:_()}),Eu=Ze({progressToken:Nm.optional(),[Jt]:cw.optional()}),et=R({_meta:Eu.optional()}),Kn=et.extend({task:aw.optional()}),Zm=(e)=>Kn.safeParse(e).success,Oe=R({method:_(),params:et.loose().optional()}),rt=R({_meta:Eu.optional()}),nt=R({method:_(),params:rt.loose().optional()}),Ie=Ze({_meta:Eu.optional()}),bs=de([_(),ne().int()]),Mm=R({jsonrpc:Z(xs),id:bs,...Oe.shape}).strict(),Tu=(e)=>Mm.safeParse(e).success,Dm=R({jsonrpc:Z(xs),...nt.shape}).strict(),qm=(e)=>Dm.safeParse(e).success,Ru=R({jsonrpc:Z(xs),id:bs,result:Ie}).strict(),Gn=(e)=>Ru.safeParse(e).success;var j;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(j||(j={}));var Ou=R({jsonrpc:Z(xs),id:bs.optional(),error:R({code:ne().int(),message:_(),data:pe().optional()})}).strict();var Lm=(e)=>Ou.safeParse(e).success;var Fm=de([Mm,Dm,Ru,Ou]),UA=de([Ru,Ou]),$s=Ie.strict(),uw=rt.extend({requestId:bs.optional(),reason:_().optional()}),ws=nt.extend({method:Z("notifications/cancelled"),params:uw}),lw=R({src:_(),mimeType:_().optional(),sizes:W(_()).optional(),theme:Ae(["light","dark"]).optional()}),Wn=R({icons:W(lw).optional()}),Fr=R({name:_(),title:_().optional()}),Um=Fr.extend({...Fr.shape,...Wn.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),dw=_s(R({applyDefaults:Te().optional()}),le(_(),pe())),pw=zu((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},_s(R({form:dw.optional(),url:ze.optional()}),le(_(),pe()).optional())),fw=Ze({list:ze.optional(),cancel:ze.optional(),requests:Ze({sampling:Ze({createMessage:ze.optional()}).optional(),elicitation:Ze({create:ze.optional()}).optional()}).optional()}),mw=Ze({list:ze.optional(),cancel:ze.optional(),requests:Ze({tools:Ze({call:ze.optional()}).optional()}).optional()}),hw=R({experimental:le(_(),ze).optional(),sampling:R({context:ze.optional(),tools:ze.optional()}).optional(),elicitation:pw.optional(),roots:R({listChanged:Te().optional()}).optional(),tasks:fw.optional(),extensions:le(_(),ze).optional()}),gw=et.extend({protocolVersion:_(),capabilities:hw,clientInfo:Um}),Iu=Oe.extend({method:Z("initialize"),params:gw});var _w=R({experimental:le(_(),ze).optional(),logging:ze.optional(),completions:ze.optional(),prompts:R({listChanged:Te().optional()}).optional(),resources:R({subscribe:Te().optional(),listChanged:Te().optional()}).optional(),tools:R({listChanged:Te().optional()}).optional(),tasks:mw.optional(),extensions:le(_(),ze).optional()}),yw=Ie.extend({protocolVersion:_(),capabilities:_w,serverInfo:Um,instructions:_().optional()}),Au=nt.extend({method:Z("notifications/initialized"),params:rt.optional()});var ks=Oe.extend({method:Z("ping"),params:et.optional()}),vw=R({progress:ne(),total:fe(ne()),message:fe(_())}),xw=R({...rt.shape,...vw.shape,progressToken:Nm}),Ss=nt.extend({method:Z("notifications/progress"),params:xw}),bw=et.extend({cursor:jm.optional()}),Xn=Oe.extend({params:bw.optional()}),Yn=Ie.extend({nextCursor:jm.optional()}),$w=Ae(["working","input_required","completed","failed","cancelled"]),Qn=R({taskId:_(),status:$w,ttl:de([ne(),wm()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:fe(ne()),statusMessage:fe(_())}),Ur=Ie.extend({task:Qn}),ww=rt.merge(Qn),eo=nt.extend({method:Z("notifications/tasks/status"),params:ww}),zs=Oe.extend({method:Z("tasks/get"),params:et.extend({taskId:_()})}),Ps=Ie.merge(Qn),Es=Oe.extend({method:Z("tasks/result"),params:et.extend({taskId:_()})}),VA=Ie.loose(),Ts=Xn.extend({method:Z("tasks/list")}),Rs=Yn.extend({tasks:W(Qn)}),Os=Oe.extend({method:Z("tasks/cancel"),params:et.extend({taskId:_()})}),Vm=Ie.merge(Qn),Hm=R({uri:_(),mimeType:fe(_()),_meta:le(_(),pe()).optional()}),Bm=Hm.extend({text:_()}),Cu=_().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Jm=Hm.extend({blob:Cu}),to=Ae(["user","assistant"]),Vr=R({audience:W(to).optional(),priority:ne().min(0).max(1).optional(),lastModified:iw({offset:!0}).optional()}),Km=R({...Fr.shape,...Wn.shape,uri:_(),description:fe(_()),mimeType:fe(_()),size:fe(ne()),annotations:Vr.optional(),_meta:fe(Ze({}))}),kw=R({...Fr.shape,...Wn.shape,uriTemplate:_(),description:fe(_()),mimeType:fe(_()),annotations:Vr.optional(),_meta:fe(Ze({}))}),Is=Xn.extend({method:Z("resources/list")}),Sw=Yn.extend({resources:W(Km)}),As=Xn.extend({method:Z("resources/templates/list")}),zw=Yn.extend({resourceTemplates:W(kw)}),Nu=et.extend({uri:_()}),Pw=Nu,Cs=Oe.extend({method:Z("resources/read"),params:Pw}),Ew=Ie.extend({contents:W(de([Bm,Jm]))}),Tw=nt.extend({method:Z("notifications/resources/list_changed"),params:rt.optional()}),Rw=Nu,Ow=Oe.extend({method:Z("resources/subscribe"),params:Rw}),Iw=Nu,Aw=Oe.extend({method:Z("resources/unsubscribe"),params:Iw}),Cw=rt.extend({uri:_()}),Nw=nt.extend({method:Z("notifications/resources/updated"),params:Cw}),jw=R({name:_(),description:fe(_()),required:fe(Te())}),Zw=R({...Fr.shape,...Wn.shape,description:fe(_()),arguments:fe(W(jw)),_meta:fe(Ze({}))}),Ns=Xn.extend({method:Z("prompts/list")}),Mw=Yn.extend({prompts:W(Zw)}),Dw=et.extend({name:_(),arguments:le(_(),_()).optional()}),js=Oe.extend({method:Z("prompts/get"),params:Dw}),ju=R({type:Z("text"),text:_(),annotations:Vr.optional(),_meta:le(_(),pe()).optional()}),Zu=R({type:Z("image"),data:Cu,mimeType:_(),annotations:Vr.optional(),_meta:le(_(),pe()).optional()}),Mu=R({type:Z("audio"),data:Cu,mimeType:_(),annotations:Vr.optional(),_meta:le(_(),pe()).optional()}),qw=R({type:Z("tool_use"),name:_(),id:_(),input:le(_(),pe()),_meta:le(_(),pe()).optional()}),Lw=R({type:Z("resource"),resource:de([Bm,Jm]),annotations:Vr.optional(),_meta:le(_(),pe()).optional()}),Fw=Km.extend({type:Z("resource_link")}),Du=de([ju,Zu,Mu,Fw,Lw]),Uw=R({role:to,content:Du}),Vw=Ie.extend({description:_().optional(),messages:W(Uw)}),Hw=nt.extend({method:Z("notifications/prompts/list_changed"),params:rt.optional()}),Bw=R({title:_().optional(),readOnlyHint:Te().optional(),destructiveHint:Te().optional(),idempotentHint:Te().optional(),openWorldHint:Te().optional()}),Jw=R({taskSupport:Ae(["required","optional","forbidden"]).optional()}),Gm=R({...Fr.shape,...Wn.shape,description:_().optional(),inputSchema:R({type:Z("object"),properties:le(_(),ze).optional(),required:W(_()).optional()}).catchall(pe()),outputSchema:R({type:Z("object"),properties:le(_(),ze).optional(),required:W(_()).optional()}).catchall(pe()).optional(),annotations:Bw.optional(),execution:Jw.optional(),_meta:le(_(),pe()).optional()}),Zs=Xn.extend({method:Z("tools/list")}),Kw=Yn.extend({tools:W(Gm)}),Ms=Ie.extend({content:W(Du).default([]),structuredContent:le(_(),pe()).optional(),isError:Te().optional()}),HA=Ms.or(Ie.extend({toolResult:pe()})),Gw=Kn.extend({name:_(),arguments:le(_(),pe()).optional()}),Hr=Oe.extend({method:Z("tools/call"),params:Gw}),Ww=nt.extend({method:Z("notifications/tools/list_changed"),params:rt.optional()}),BA=R({autoRefresh:Te().default(!0),debounceMs:ne().int().nonnegative().default(300)}),ro=Ae(["debug","info","notice","warning","error","critical","alert","emergency"]),Xw=et.extend({level:ro}),qu=Oe.extend({method:Z("logging/setLevel"),params:Xw}),Yw=rt.extend({level:ro,logger:_().optional(),data:pe()}),Qw=nt.extend({method:Z("notifications/message"),params:Yw}),ek=R({name:_().optional()}),tk=R({hints:W(ek).optional(),costPriority:ne().min(0).max(1).optional(),speedPriority:ne().min(0).max(1).optional(),intelligencePriority:ne().min(0).max(1).optional()}),rk=R({mode:Ae(["auto","required","none"]).optional()}),nk=R({type:Z("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:W(Du).default([]),structuredContent:R({}).loose().optional(),isError:Te().optional(),_meta:le(_(),pe()).optional()}),ok=Su("type",[ju,Zu,Mu]),vs=Su("type",[ju,Zu,Mu,qw,nk]),sk=R({role:to,content:de([vs,W(vs)]),_meta:le(_(),pe()).optional()}),ik=Kn.extend({messages:W(sk),modelPreferences:tk.optional(),systemPrompt:_().optional(),includeContext:Ae(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:W(_()).optional(),metadata:ze.optional(),tools:W(Gm).optional(),toolChoice:rk.optional()}),ak=Oe.extend({method:Z("sampling/createMessage"),params:ik}),no=Ie.extend({model:_(),stopReason:fe(Ae(["endTurn","stopSequence","maxTokens"]).or(_())),role:to,content:ok}),Lu=Ie.extend({model:_(),stopReason:fe(Ae(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:to,content:de([vs,W(vs)])}),ck=R({type:Z("boolean"),title:_().optional(),description:_().optional(),default:Te().optional()}),uk=R({type:Z("string"),title:_().optional(),description:_().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:Ae(["email","uri","date","date-time"]).optional(),default:_().optional()}),lk=R({type:Ae(["number","integer"]),title:_().optional(),description:_().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),dk=R({type:Z("string"),title:_().optional(),description:_().optional(),enum:W(_()),default:_().optional()}),pk=R({type:Z("string"),title:_().optional(),description:_().optional(),oneOf:W(R({const:_(),title:_()})),default:_().optional()}),fk=R({type:Z("string"),title:_().optional(),description:_().optional(),enum:W(_()),enumNames:W(_()).optional(),default:_().optional()}),mk=de([dk,pk]),hk=R({type:Z("array"),title:_().optional(),description:_().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:R({type:Z("string"),enum:W(_())}),default:W(_()).optional()}),gk=R({type:Z("array"),title:_().optional(),description:_().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:R({anyOf:W(R({const:_(),title:_()}))}),default:W(_()).optional()}),_k=de([hk,gk]),yk=de([fk,mk,_k]),vk=de([yk,ck,uk,lk]),xk=Kn.extend({mode:Z("form").optional(),message:_(),requestedSchema:R({type:Z("object"),properties:le(_(),vk),required:W(_()).optional()})}),bk=Kn.extend({mode:Z("url"),message:_(),elicitationId:_(),url:_().url()}),$k=de([xk,bk]),wk=Oe.extend({method:Z("elicitation/create"),params:$k}),kk=rt.extend({elicitationId:_()}),Sk=nt.extend({method:Z("notifications/elicitation/complete"),params:kk}),Br=Ie.extend({action:Ae(["accept","decline","cancel"]),content:zu((e)=>e===null?void 0:e,le(_(),de([_(),ne(),Te(),W(_())])).optional())}),zk=R({type:Z("ref/resource"),uri:_()});var Pk=R({type:Z("ref/prompt"),name:_()}),Ek=et.extend({ref:de([Pk,zk]),argument:R({name:_(),value:_()}),context:R({arguments:le(_(),_()).optional()}).optional()}),Ds=Oe.extend({method:Z("completion/complete"),params:Ek});function Wm(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Xm(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var Tk=Ie.extend({completion:Ze({values:W(_()).max(100),total:fe(ne().int()),hasMore:fe(Te())})}),Rk=R({uri:_().startsWith("file://"),name:_().optional(),_meta:le(_(),pe()).optional()}),Ok=Oe.extend({method:Z("roots/list"),params:et.optional()}),Fu=Ie.extend({roots:W(Rk)}),Ik=nt.extend({method:Z("notifications/roots/list_changed"),params:rt.optional()}),JA=de([ks,Iu,Ds,qu,js,Ns,Is,As,Cs,Ow,Aw,Hr,Zs,zs,Es,Ts,Os]),KA=de([ws,Ss,Au,Ik,eo]),GA=de([$s,no,Lu,Br,Fu,Ps,Rs,Ur]),WA=de([ks,ak,wk,Ok,zs,Es,Ts,Os]),XA=de([ws,Ss,Qw,Nw,Tw,Ww,Hw,eo,Sk]),YA=de([$s,yw,Tk,Vw,Mw,Sw,zw,Ew,Ms,Kw,Ps,Rs,Ur]);class A extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===j.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new Ym(n.elicitations,t)}return new A(e,t,r)}}class Ym extends A{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(j.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}var Ak=10485760;class Uu{constructor(e){this._maxBufferSize=e?.maxBufferSize??Ak}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
65
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref")s(i)}}if(e.external)e.sharedDefsExtractedFor=e.external}function kf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;kf(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let s=n.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!=="string")return;if(!r.includes(i))r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Sf=new Set(["type","properties","required","additionalProperties"]),$f=["oneOf","anyOf"];function wf(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Xc(e){let t=[];for(let s of e){if(typeof s!=="object"||s.type!=="object")return null;for(let i in s)if(!Sf.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??wf(u);if(l===null||l===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(l)))a.push(l)}let c=a.length===1?a[0]:Xc(a)??{allOf:a};Ge(r,i,c)}for(let i of s.required??[])n.add(i)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((s)=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let a=wf(i);if(a&&!s.some((c)=>JSON.stringify(c)===JSON.stringify(a)))s.push(a)}if(s.length===1)o.additionalProperties=s[0];else if(s.length>1)o.additionalProperties={allOf:s}}return o}function d0(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Sf)if(o in e)return;let r=t.filter((o)=>$f.some((s)=>Array.isArray(o[s]))),n=null;if(!r.length)n=Xc(t);else{let o=r[0],s=$f.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let i=t.filter((c)=>c!==o),a=o[s].map((c)=>Xc([...i,c]));if(a.some((c)=>!c))return;n={[s]:a}}if(!n)return;delete e.allOf,Fn(e,n)}function Bn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){n(d);let p=e.seen.get(d),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(f);else Fn(u,f);if(Fn(u,l),a._zod.parent===d)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(!(g in l))delete u[g]}if(f.$ref&&p.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in p.def&&JSON.stringify(u[g])===JSON.stringify(p.def[g]))delete u[g]}}let m=a._zod.parent;if(m&&m!==d){n(m);let p=e.seen.get(m);if(p?.schema.$ref){if(u.$ref=p.schema.$ref,p.def)for(let f in u){if(f==="$ref"||f==="allOf")continue;if(f in p.def&&JSON.stringify(u[f])===JSON.stringify(p.def[f]))delete u[f]}}}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())kf(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);if(d)d.push(u);else a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])d0(u)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Fn(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;Ge(i,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")o.$defs=i;else o.definitions=i;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Un(t,"input",e.processors),output:Un(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function je(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return je(n.element,r);if(n.type==="set")return je(n.valueType,r);if(n.type==="lazy")return je(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"||n.type==="catch")return je(n.innerType,r);if(n.type==="intersection")return je(n.left,r)||je(n.right,r);if(n.type==="record"||n.type==="map")return je(n.keyType,r)||je(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return je(n.in,r)||je(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(je(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(je(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(je(o,r))return!0;if(n.rest&&je(n.rest,r))return!0;return!1}return!1}var zf=(e,t={})=>(r)=>{let n=Vn({...r,processors:t});return ce(e,n),Hn(n,e),Bn(n,e)},Un=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=Vn({...o??{},target:s,io:t,processors:r});return ce(e,i),Hn(i,e),Bn(i,e)};var qr=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Lr=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Pf=(e,t)=>{qr(e,"minimum",t),Lr(e,"maximum",t)},If=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Af=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Cf=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Nf=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Ef=(e,t)=>qr(e,"minimum",t.minimum),Tf=(e,t)=>Lr(e,"maximum",t.maximum),Rf=(e)=>(t,r)=>{Nf(t,r.format);let[n,o]=e[r.format];qr(t,"minimum",n),Lr(t,"maximum",o)},p0={greater_than:(e,t)=>qr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Lr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>If(e,t.value),number_format:Rf(Do),bigint_format:Rf(Xi),min_length:Ef,max_length:Tf,length_equals:(e,t)=>Pf(e,t.length),min_size:Ef,max_size:Tf,size_equals:(e,t)=>Pf(e,t.size),string_format:(e,t)=>{if(Nf(e,t.format),t.pattern)Af(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Cf(e,t.mime)};function Ue(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of n)p0[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)qr(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)qr(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)Lr(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)Lr(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)If(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)Cf(t,o.mime);for(let s of o.patterns??[])Af(t,s);return t}var f0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},m0=new Map([[Ra,hp],[Yo,gp]]),jf=(e)=>m0.get(e)??e,eu=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=Ue(e);if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(a){if(o.format=f0[a]??a,o.format==="")delete o.format;if(a==="time"||l)delete o.format}if(u)o.contentEncoding=u;if(c&&c.size>0){let d=[...c].map(jf);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},tu=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=Ue(e);o.type=l?"integer":"number";let d=typeof u==="number"&&u>=(s??Number.NEGATIVE_INFINITY),m=typeof c==="number"&&c<=(i??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(p)o.minimum=u,o.exclusiveMinimum=!0;else o.exclusiveMinimum=u;else if(typeof s==="number")o.minimum=s;if(m)if(p)o.maximum=c,o.exclusiveMaximum=!0;else o.exclusiveMaximum=c;else if(typeof i==="number")o.maximum=i;if(a){let f=new Set;for(let v of a)if(Number.isFinite(v)&&v!==0)f.add(Math.abs(v));else Ee(e,t,o,n,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[h,...g]=f;if(h!==void 0)o.multipleOf=h;if(g.length)o.allOf=[...o.allOf??[],...g.map((v)=>({multipleOf:v}))]}},ru=(e,t,r,n)=>{r.type="boolean"},Zf=(e,t,r,n)=>{Ee(e,t,r,n,"BigInt cannot be represented in JSON Schema")},Mf=(e,t,r,n)=>{Ee(e,t,r,n,"Symbols cannot be represented in JSON Schema")},nu=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},Df=(e,t,r,n)=>{Ee(e,t,r,n,"Undefined cannot be represented in JSON Schema")},qf=(e,t,r,n)=>{Ee(e,t,r,n,"Void cannot be represented in JSON Schema")},ou=(e,t,r,n)=>{r.not={}},Lf=(e,t,r,n)=>{},su=(e,t,r,n)=>{},Ff=(e,t,r,n)=>{Ee(e,t,r,n,"Date cannot be represented in JSON Schema")},iu=(e,t,r,n)=>{let o=e._zod.def,s=wn(o.entries);if(s.length===0){r.not={};return}if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},au=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(Ee(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i==="bigint"){if(Ee(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}},Uf=(e,t,r,n)=>{Ee(e,t,r,n,"NaN cannot be represented in JSON Schema")},Vf=(e,t,r,n)=>{let o=r,s=e._zod.pattern;if(!s)throw Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},Hf=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:s,maximum:i,mime:a}=Ue(e);if(s!==void 0)o.minLength=s;if(i!==void 0)o.maxLength=i;if(!a)return;if(a.length===0)o.not={};else if(a.length===1)o.contentMediaType=a[0];else o.anyOf=a.map((c)=>({contentMediaType:c}))},Bf=(e,t,r,n)=>{r.type="boolean"},cu=(e,t,r,n)=>{Ee(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Jf=(e,t,r,n)=>{Ee(e,t,r,n,"Function types cannot be represented in JSON Schema")},uu=(e,t,r,n)=>{Ee(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Kf=(e,t,r,n)=>{Ee(e,t,r,n,"Map cannot be represented in JSON Schema")},Gf=(e,t,r,n)=>{Ee(e,t,r,n,"Set cannot be represented in JSON Schema")},lu=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=Ue(e);if(typeof i==="number")o.minItems=i;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=ce(s.element,t,{...n,path:[...n.path,"items"]})};function Jn(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Jn(t.out);if(t.type==="catch")return Jn(t.innerType);return e._zod.optin}var du=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&Ee(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in i)Ge(o.properties,u,ce(i[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];if(t.io==="input"?Jn(l)===void 0:l._zod.optout===void 0)c.push(u)}if(c.length>0)o.required=c;if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=ce(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},pu=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>ce(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));if(s)r.oneOf=i;else r.anyOf=i},fu=(e,t,r,n)=>{let o=e._zod.def,s=ce(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=ce(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)},Wf=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((h,g)=>ce(h,t,{...n,path:[...n.path,i,g]})),u=s.rest?ce(s.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null,l=s.items.length;while(l>0){let h=s.items[l-1];if(!(t.io==="input"?Jn(h)!==void 0:h._zod.optout==="optional"))break;l--}let d=s.items.length,m=!s.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=c,m)o.items=!1;else if(u)o.items=u;if(l>0)o.minItems=l;if(m)o.maxItems=d}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},u)o.items.anyOf.push(u);if(l>0)o.minItems=l;if(m)o.maxItems=d}else{if(o.items=c,m)o.additionalItems=!1;else if(u)o.additionalItems=u;if(l>0)o.minItems=l;if(m)o.maxItems=d}let{minimum:p,maximum:f}=Ue(e);if(typeof p==="number")o.minItems=p;if(typeof f==="number")o.maxItems=f};function Yc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let f=e.get(t)?.def;if(!f)return t;let h=Yc(e,f,r);return h===f?t:h}for(let f of["anyOf","oneOf"]){let h=t[f];if(!Array.isArray(h))continue;let g=h.map((v)=>Yc(e,v,r));if(g.some((v,T)=>v!==h[T]))t={...t,[f]:g}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((f)=>f==="number"||f==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some((f)=>typeof f==="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:m,...p}=t;if(p.enum)p.enum=p.enum.map((f)=>typeof f==="number"?String(f):f);else if(typeof p.const==="number")p.const=String(p.const);if(!o)return p;if(p.type="string",!s)p.pattern=(n.includes("number")?Nn:ca).source;return p}var Qc=new WeakMap;function h0(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of Qc.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Yc(t,s,new Set);if(i!==s)r.set(s,i)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let s=o&&r.get(o.propertyNames);if(s)o.propertyNames=s}}var mu=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,a=Ue(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=ce(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)Ge(o.patternProperties,jf(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=ce(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Qc.get(t);if(!l)l=[],Qc.set(t,l),t.deferred.push(()=>h0(t));l.push(e)}o.additionalProperties=ce(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&Jn(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter((d)=>typeof d==="string"||typeof d==="number");if(l.length>0)o.required=l.map(String)}},hu=(e,t,r,n)=>{let o=e._zod.def,s=ce(o.innerType,t,n),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},gu=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},_u=Symbol();function Xf(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return s=!0,null});if(!s)return JSON.parse(i);return Ee(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),_u}var yu=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=Xf(o.defaultValue,e,t,r,n);if(i!==_u)r.default=i},vu=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=Xf(o.defaultValue,e,t,r,n);if(i!==_u)r._prefault=i},xu=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{Ee(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},bu=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;ce(i,t,n);let a=t.seen.get(e);a.ref=i},$u=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0},Yf=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},fs=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Qf=(e,t,r,n)=>{let o=e._zod.innerType;ce(o,t,n);let s=t.seen.get(e);s.ref=o},Of={string:eu,number:tu,boolean:ru,bigint:Zf,symbol:Mf,null:nu,undefined:Df,void:qf,never:ou,any:Lf,unknown:su,date:Ff,enum:iu,literal:au,nan:Uf,template_literal:Vf,file:Hf,success:Bf,custom:cu,function:Jf,transform:uu,map:Kf,set:Gf,array:lu,object:du,union:pu,intersection:fu,tuple:Wf,record:mu,nullable:hu,nonoptional:gu,default:yu,prefault:vu,catch:xu,pipe:bu,readonly:$u,promise:Yf,optional:fs,lazy:Qf};function wu(e,t){if("_idmap"in e){let n=e,o=Vn({...t,processors:Of}),s={};for(let c of n._idmap.entries()){let[u,l]=c;ce(l,o)}let i={},a={registry:n,uri:t?.uri,defs:s};o.external=a;for(let c of n._idmap.entries()){let[u,l]=c;Hn(o,l),Ge(i,u,Bn(o,l))}if(Object.keys(s).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:s}}return{schemas:i}}let r=Vn({...t,processors:Of});return ce(e,r),Hn(r,e),Bn(r,e)}var tm=new WeakSet([Object.prototype,Error.prototype]);function ms(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var w0=(e,t)=>{Fd.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(tm.has(r))return;tm.add(r),ms(r,"format",(n)=>(o)=>Vd(n,o)),ms(r,"flatten",(n)=>(o)=>Ud(n,o)),ms(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,kn,2)}),ms(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,kn,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var Qe=y("ZodError",w0,void 0,{Parent:Error});var rm=Tn(Qe),nm=Rn(Qe),om=On(Qe),sm=An(Qe),im=Bd(Qe),am=Jd(Qe),cm=Kd(Qe),um=Gd(Qe),lm=Wd(Qe),dm=Xd(Qe),pm=Yd(Qe),fm=Qd(Qe);function h$(){if(!Fe.localeError)Ye(oc())}function gs(){if(!Fe.memoizer)Ye({memoizer:gf()})}var me=y("ZodType",(e,t)=>(h$(),ae.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Le(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return We(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ow(e,t))},superRefine(e,t){return this.check(sw(e,t))},overwrite(e){return this.check(Bt(e))},optional(){return fe(this)},exactOptional(){return B$(this)},nullable(){return gm(this)},nullish(){return fe(gm(this))},nonoptional(e){return Y$(this,e)},array(){return W(this)},or(e){return de([this,e])},and(e){return _s(this,e)},transform(e){return _m(this,zm(e))},default(e){return G$(this,e)},prefault(e){return X$(this,e)},catch(e){return ew(this,e)},pipe(e){return _m(this,e)},readonly(){return nw(this)},describe(e){let t=this.clone();return wr.add(t,{description:e}),t},meta(...e){if(e.length===0)return wr.get(this);let t=this.clone();return wr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Vo(this,"~standard",{...ma(this),jsonSchema:{input:Un(this,"input"),output:Un(this,"output")}})},set "~standard"(e){ut(this,"~standard",e)},parse:function e(t,r){return rm(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await nm(this,t,r,{callee:e})},safeParse(e,t){return om(this,e,t)},async safeParseAsync(e,t){return sm(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ut(this,"spa",e)},validate(e,t){return Bo(this,e,t)},validateAsync(e,t){return Jo(this,e,t)},encode:function e(t,r){return im(this,t,r,{callee:e})},decode:function e(t,r){return am(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await cm(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await um(this,t,r,{callee:e})},safeEncode(e,t){return lm(this,e,t)},safeDecode(e,t){return dm(this,e,t)},async safeEncodeAsync(e,t){return pm(this,e,t)},async safeDecodeAsync(e,t){return fm(this,e,t)},toJSONSchema(e){return zf(this,{})(e)},get description(){return wr.get(this)?.description},get _def(){return this._zod.def}}),ym=y("_ZodString",(e,t)=>{Zn.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eu(e,r,n,o)},jd({format:(e)=>Ue(e).format??null,minLength:(e)=>Ue(e).minimum??null,maxLength:(e)=>Ue(e).maximum??null},{regex(...e){return this.check(Zc(...e))},includes(...e){return this.check(qc(...e))},startsWith(...e){return this.check(Lc(...e))},endsWith(...e){return this.check(Fc(...e))},min(...e){return this.check(Dr(...e))},max(...e){return this.check(ds(...e))},length(...e){return this.check(ps(...e))},nonempty(...e){return this.check(Dr(1,...e))},lowercase(e){return this.check(Mc(e))},uppercase(e){return this.check(Dc(e))},trim(){return this.check(Vc())},normalize(...e){return this.check(Uc(...e))},toLowerCase(){return this.check(Hc())},toUpperCase(){return this.check(Bc())},slugify(){return this.check(Jc())}})),g$=y("ZodString",(e,t)=>{Zn.init(e,t),ym.init(e,t)},{email(e){return this.check(ic(_$,e))},url(e){return this.check(pc(v$,e))},jwt(e){return this.check(Pc(C$,e))},emoji(e){return this.check(fc(x$,e))},guid(e){return this.check(ac(y$,e))},uuid(e){return this.check(cc(hs,e))},uuidv4(e){return this.check(uc(hs,e))},uuidv6(e){return this.check(lc(hs,e))},uuidv7(e){return this.check(dc(hs,e))},nanoid(e){return this.check(mc(b$,e))},cuid(e){return this.check(hc($$,e))},cuid2(e){return this.check(gc(w$,e))},ulid(e){return this.check(_c(k$,e))},base64(e){return this.check(kc(O$,e))},base64url(e){return this.check(Sc(I$,e))},xid(e){return this.check(yc(S$,e))},ksuid(e){return this.check(vc(z$,e))},ipv4(e){return this.check(xc(P$,e))},ipv6(e){return this.check(bc(E$,e))},cidrv4(e){return this.check($c(T$,e))},cidrv6(e){return this.check(wc(R$,e))},e164(e){return this.check(zc(A$,e))},datetime(e){return this.check(as(Su,e))},date(e){return this.check(Ec(vm,e))},time(e){return this.check(Tc(xm,e))},duration(e){return this.check(Rc(bm,e))}});function _(e){return sc(g$,e)}var _e=y("ZodStringFormat",(e,t)=>{ue.init(e,t),ym.init(e,t)}),Su=y("ZodISODateTime",(e,t)=>{tf.init(e,t),_e.init(e,t)}),vm=y("ZodISODate",(e,t)=>{rf.init(e,t),_e.init(e,t)}),xm=y("ZodISOTime",(e,t)=>{nf.init(e,t),_e.init(e,t)}),bm=y("ZodISODuration",(e,t)=>{of.init(e,t),_e.init(e,t)}),_$=y("ZodEmail",(e,t)=>{_a.init(e,t),_e.init(e,t)});var y$=y("ZodGUID",(e,t)=>{ha.init(e,t),_e.init(e,t)});var hs=y("ZodUUID",(e,t)=>{ga.init(e,t),_e.init(e,t)});var v$=y("ZodURL",(e,t)=>{ya.init(e,t),_e.init(e,t)});var x$=y("ZodEmoji",(e,t)=>{va.init(e,t),_e.init(e,t)});var b$=y("ZodNanoID",(e,t)=>{xa.init(e,t),_e.init(e,t)});var $$=y("ZodCUID",(e,t)=>{ba.init(e,t),_e.init(e,t)});var w$=y("ZodCUID2",(e,t)=>{$a.init(e,t),_e.init(e,t)});var k$=y("ZodULID",(e,t)=>{wa.init(e,t),_e.init(e,t)});var S$=y("ZodXID",(e,t)=>{ka.init(e,t),_e.init(e,t)});var z$=y("ZodKSUID",(e,t)=>{Sa.init(e,t),_e.init(e,t)});var P$=y("ZodIPv4",(e,t)=>{za.init(e,t),_e.init(e,t)});var E$=y("ZodIPv6",(e,t)=>{Pa.init(e,t),_e.init(e,t)});var T$=y("ZodCIDRv4",(e,t)=>{Ea.init(e,t),_e.init(e,t)});var R$=y("ZodCIDRv6",(e,t)=>{Ta.init(e,t),_e.init(e,t)});var O$=y("ZodBase64",(e,t)=>{Oa.init(e,t),_e.init(e,t)});var I$=y("ZodBase64URL",(e,t)=>{Ia.init(e,t),_e.init(e,t)});var A$=y("ZodE164",(e,t)=>{Aa.init(e,t),_e.init(e,t)});var C$=y("ZodJWT",(e,t)=>{Ca.init(e,t),_e.init(e,t)});var $m=y("ZodNumber",(e,t)=>{Qo.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tu(e,r,n,o),e.isFinite=!0},jd({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=Ue(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=Ue(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=Ue(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>Ue(e).format??null},{gt(e,t){return this.check(us(e,t))},gte(e,t){return this.check(Ln(e,t))},min(e,t){return this.check(Ln(e,t))},lt(e,t){return this.check(cs(e,t))},lte(e,t){return this.check(qn(e,t))},max(e,t){return this.check(qn(e,t))},int(e){return this.check(mm(e))},safe(e){return this.check(mm(e))},positive(e){return this.check(us(0,e))},nonnegative(e){return this.check(Ln(0,e))},negative(e){return this.check(cs(0,e))},nonpositive(e){return this.check(qn(0,e))},multipleOf(e,t){return this.check(ls(e,t))},step(e,t){return this.check(ls(e,t))},finite(){return this}}));function ne(e){return Oc($m,e)}var N$=y("ZodNumberFormat",(e,t)=>{Na.init(e,t),$m.init(e,t)});function mm(e){return Ic(N$,e)}var j$=y("ZodBoolean",(e,t)=>{ja.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ru(e,r,n,o)});function Te(e){return Ac(j$,e)}var Z$=y("ZodNull",(e,t)=>{Za.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nu(e,r,n,o)});function wm(e){return Cc(Z$,e)}var M$=y("ZodUnknown",(e,t)=>{Ma.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>su(e,r,n,o)});function pe(){return Nc(M$)}var D$=y("ZodNever",(e,t)=>{Da.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ou(e,r,n,o)});function q$(e){return jc(D$,e)}var L$=y("ZodArray",(e,t)=>{gs(),qa.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lu(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Dr(e,t))},nonempty(e){return this.check(Dr(1,e))},max(e,t){return this.check(ds(e,t))},length(e,t){return this.check(ps(e,t))},unwrap(){return this.element}});function W(e,t){return xf(L$,e,t)}var km=y("ZodObject",(e,t)=>{gs(),lf.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>du(e,r,n,o),ea(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Ae(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Le(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Le(this._zod.def,{catchall:pe()}))},loose(){return this.clone(Le(this._zod.def,{catchall:pe()}))},strict(){return this.clone(Le(this._zod.def,{catchall:q$()}))},strip(){return this.clone(Le(this._zod.def,{catchall:void 0}))},extend(e){return Ed(this,e)},safeExtend(e){return Rd(this,e)},merge(e){return Od(this,e)},pick(e){return zd(this,e)},omit(e){return Pd(this,e)},partial(...e){return Yi(ys,this,e[0])},exactPartial(...e){return Yi(Pm,this,e[0],"exactPartial")},required(...e){return Id(Em,this,e[0])}});function R(e,t){let r={type:"object",shape:e??{},...I(t)};return new km(r)}function Ze(e,t){return new km({type:"object",shape:e,catchall:pe(),...I(t)})}var Sm=y("ZodUnion",(e,t)=>{es.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pu(e,r,n,o),e.options=t.options});function de(e,t){return new Sm({type:"union",options:e,...I(t)})}var F$=y("ZodDiscriminatedUnion",(e,t)=>{Sm.init(e,t),Fa.init(e,t)});function zu(e,t,r){return new F$({type:"union",options:t,discriminator:e,...I(r)})}var U$=y("ZodIntersection",(e,t)=>{Ua.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fu(e,r,n,o)});function _s(e,t){return new U$({type:"intersection",left:e,right:t})}var hm=y("ZodRecord",(e,t)=>{gs(),Va.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mu(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function le(e,t,r){if(!t||!t._zod)return new hm({type:"record",keyType:_(),valueType:e,...I(t)});return new hm({type:"record",keyType:e,valueType:t,...I(r)})}var ku=y("ZodEnum",(e,t)=>{Ha.init(e,t),me.init(e,t),e._zod.processJSONSchema=(n,o,s)=>iu(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new ku({...t,checks:[],...I(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new ku({...t,checks:[],...I(o),entries:s})}});function Ae(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new ku({type:"enum",entries:r,...I(t)})}var V$=y("ZodLiteral",(e,t)=>{Ba.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>au(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Z(e,t){return new V$({type:"literal",values:Array.isArray(e)?e:[e],...I(t)})}var H$=y("ZodTransform",(e,t)=>{gs(),Ja.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uu(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pn(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push($r(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=e),r.issues.push($r(i))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r));return r.value=o,r}});function zm(e){return new H$({type:"transform",transform:e})}var ys=y("ZodOptional",(e,t)=>{ts.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fe(e){return new ys({type:"optional",innerType:e})}var Pm=y("ZodExactOptional",(e,t)=>{Ka.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function B$(e){return new Pm({type:"optional",innerType:e})}var J$=y("ZodNullable",(e,t)=>{Ga.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gm(e){return new J$({type:"nullable",innerType:e})}var K$=y("ZodDefault",(e,t)=>{Wa.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function G$(e,t){return new K$({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Mo(t)}})}var W$=y("ZodPrefault",(e,t)=>{Xa.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function X$(e,t){return new W$({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Mo(t)}})}var Em=y("ZodNonOptional",(e,t)=>{Ya.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Y$(e,t){return new Em({type:"nonoptional",innerType:e,...I(t)})}var Q$=y("ZodCatch",(e,t)=>{Qa.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ew(e,t){return new Q$({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Zd(t)})}var Tm=y("ZodPipe",(e,t)=>{rs.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bu(e,r,n,o),e.in=t.in,e.out=t.out});function _m(e,t){return new Tm({type:"pipe",in:e,out:t})}var tw=y("ZodPreprocess",(e,t)=>{Tm.init(e,t),df.init(e,t)}),rw=y("ZodReadonly",(e,t)=>{ec.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$u(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function nw(e){return new rw({type:"readonly",innerType:e})}var Rm=y("ZodCustom",(e,t)=>{tc.init(e,t),me.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cu(e,r,n,o)});function Om(e,t){return Kc(Rm,e??(()=>!0),t)}function ow(e,t={}){return Gc(Rm,e,t)}function sw(e,t){return Wc(e,t)}function Pu(e,t){return new tw({type:"pipe",in:zm(e),out:t})}function iw(e){return as(Su,e)}var Eu="2025-11-25";var Cm=[Eu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Jt="io.modelcontextprotocol/related-task",xs="2.0",ze=Om((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),Nm=de([_(),ne().int()]),jm=_(),HA=Ze({ttl:ne().optional(),pollInterval:ne().optional()}),aw=R({ttl:ne().optional()}),cw=R({taskId:_()}),Tu=Ze({progressToken:Nm.optional(),[Jt]:cw.optional()}),et=R({_meta:Tu.optional()}),Kn=et.extend({task:aw.optional()}),Zm=(e)=>Kn.safeParse(e).success,Oe=R({method:_(),params:et.loose().optional()}),rt=R({_meta:Tu.optional()}),nt=R({method:_(),params:rt.loose().optional()}),Ie=Ze({_meta:Tu.optional()}),bs=de([_(),ne().int()]),Mm=R({jsonrpc:Z(xs),id:bs,...Oe.shape}).strict(),Ru=(e)=>Mm.safeParse(e).success,Dm=R({jsonrpc:Z(xs),...nt.shape}).strict(),qm=(e)=>Dm.safeParse(e).success,Ou=R({jsonrpc:Z(xs),id:bs,result:Ie}).strict(),Gn=(e)=>Ou.safeParse(e).success;var j;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(j||(j={}));var Iu=R({jsonrpc:Z(xs),id:bs.optional(),error:R({code:ne().int(),message:_(),data:pe().optional()})}).strict();var Lm=(e)=>Iu.safeParse(e).success;var Fm=de([Mm,Dm,Ou,Iu]),BA=de([Ou,Iu]),$s=Ie.strict(),uw=rt.extend({requestId:bs.optional(),reason:_().optional()}),ws=nt.extend({method:Z("notifications/cancelled"),params:uw}),lw=R({src:_(),mimeType:_().optional(),sizes:W(_()).optional(),theme:Ae(["light","dark"]).optional()}),Wn=R({icons:W(lw).optional()}),Fr=R({name:_(),title:_().optional()}),Um=Fr.extend({...Fr.shape,...Wn.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),dw=_s(R({applyDefaults:Te().optional()}),le(_(),pe())),pw=Pu((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},_s(R({form:dw.optional(),url:ze.optional()}),le(_(),pe()).optional())),fw=Ze({list:ze.optional(),cancel:ze.optional(),requests:Ze({sampling:Ze({createMessage:ze.optional()}).optional(),elicitation:Ze({create:ze.optional()}).optional()}).optional()}),mw=Ze({list:ze.optional(),cancel:ze.optional(),requests:Ze({tools:Ze({call:ze.optional()}).optional()}).optional()}),hw=R({experimental:le(_(),ze).optional(),sampling:R({context:ze.optional(),tools:ze.optional()}).optional(),elicitation:pw.optional(),roots:R({listChanged:Te().optional()}).optional(),tasks:fw.optional(),extensions:le(_(),ze).optional()}),gw=et.extend({protocolVersion:_(),capabilities:hw,clientInfo:Um}),Au=Oe.extend({method:Z("initialize"),params:gw});var _w=R({experimental:le(_(),ze).optional(),logging:ze.optional(),completions:ze.optional(),prompts:R({listChanged:Te().optional()}).optional(),resources:R({subscribe:Te().optional(),listChanged:Te().optional()}).optional(),tools:R({listChanged:Te().optional()}).optional(),tasks:mw.optional(),extensions:le(_(),ze).optional()}),yw=Ie.extend({protocolVersion:_(),capabilities:_w,serverInfo:Um,instructions:_().optional()}),Cu=nt.extend({method:Z("notifications/initialized"),params:rt.optional()});var ks=Oe.extend({method:Z("ping"),params:et.optional()}),vw=R({progress:ne(),total:fe(ne()),message:fe(_())}),xw=R({...rt.shape,...vw.shape,progressToken:Nm}),Ss=nt.extend({method:Z("notifications/progress"),params:xw}),bw=et.extend({cursor:jm.optional()}),Xn=Oe.extend({params:bw.optional()}),Yn=Ie.extend({nextCursor:jm.optional()}),$w=Ae(["working","input_required","completed","failed","cancelled"]),Qn=R({taskId:_(),status:$w,ttl:de([ne(),wm()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:fe(ne()),statusMessage:fe(_())}),Ur=Ie.extend({task:Qn}),ww=rt.merge(Qn),eo=nt.extend({method:Z("notifications/tasks/status"),params:ww}),zs=Oe.extend({method:Z("tasks/get"),params:et.extend({taskId:_()})}),Ps=Ie.merge(Qn),Es=Oe.extend({method:Z("tasks/result"),params:et.extend({taskId:_()})}),JA=Ie.loose(),Ts=Xn.extend({method:Z("tasks/list")}),Rs=Yn.extend({tasks:W(Qn)}),Os=Oe.extend({method:Z("tasks/cancel"),params:et.extend({taskId:_()})}),Vm=Ie.merge(Qn),Hm=R({uri:_(),mimeType:fe(_()),_meta:le(_(),pe()).optional()}),Bm=Hm.extend({text:_()}),Nu=_().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Jm=Hm.extend({blob:Nu}),to=Ae(["user","assistant"]),Vr=R({audience:W(to).optional(),priority:ne().min(0).max(1).optional(),lastModified:iw({offset:!0}).optional()}),Km=R({...Fr.shape,...Wn.shape,uri:_(),description:fe(_()),mimeType:fe(_()),size:fe(ne()),annotations:Vr.optional(),_meta:fe(Ze({}))}),kw=R({...Fr.shape,...Wn.shape,uriTemplate:_(),description:fe(_()),mimeType:fe(_()),annotations:Vr.optional(),_meta:fe(Ze({}))}),Is=Xn.extend({method:Z("resources/list")}),Sw=Yn.extend({resources:W(Km)}),As=Xn.extend({method:Z("resources/templates/list")}),zw=Yn.extend({resourceTemplates:W(kw)}),ju=et.extend({uri:_()}),Pw=ju,Cs=Oe.extend({method:Z("resources/read"),params:Pw}),Ew=Ie.extend({contents:W(de([Bm,Jm]))}),Tw=nt.extend({method:Z("notifications/resources/list_changed"),params:rt.optional()}),Rw=ju,Ow=Oe.extend({method:Z("resources/subscribe"),params:Rw}),Iw=ju,Aw=Oe.extend({method:Z("resources/unsubscribe"),params:Iw}),Cw=rt.extend({uri:_()}),Nw=nt.extend({method:Z("notifications/resources/updated"),params:Cw}),jw=R({name:_(),description:fe(_()),required:fe(Te())}),Zw=R({...Fr.shape,...Wn.shape,description:fe(_()),arguments:fe(W(jw)),_meta:fe(Ze({}))}),Ns=Xn.extend({method:Z("prompts/list")}),Mw=Yn.extend({prompts:W(Zw)}),Dw=et.extend({name:_(),arguments:le(_(),_()).optional()}),js=Oe.extend({method:Z("prompts/get"),params:Dw}),Zu=R({type:Z("text"),text:_(),annotations:Vr.optional(),_meta:le(_(),pe()).optional()}),Mu=R({type:Z("image"),data:Nu,mimeType:_(),annotations:Vr.optional(),_meta:le(_(),pe()).optional()}),Du=R({type:Z("audio"),data:Nu,mimeType:_(),annotations:Vr.optional(),_meta:le(_(),pe()).optional()}),qw=R({type:Z("tool_use"),name:_(),id:_(),input:le(_(),pe()),_meta:le(_(),pe()).optional()}),Lw=R({type:Z("resource"),resource:de([Bm,Jm]),annotations:Vr.optional(),_meta:le(_(),pe()).optional()}),Fw=Km.extend({type:Z("resource_link")}),qu=de([Zu,Mu,Du,Fw,Lw]),Uw=R({role:to,content:qu}),Vw=Ie.extend({description:_().optional(),messages:W(Uw)}),Hw=nt.extend({method:Z("notifications/prompts/list_changed"),params:rt.optional()}),Bw=R({title:_().optional(),readOnlyHint:Te().optional(),destructiveHint:Te().optional(),idempotentHint:Te().optional(),openWorldHint:Te().optional()}),Jw=R({taskSupport:Ae(["required","optional","forbidden"]).optional()}),Gm=R({...Fr.shape,...Wn.shape,description:_().optional(),inputSchema:R({type:Z("object"),properties:le(_(),ze).optional(),required:W(_()).optional()}).catchall(pe()),outputSchema:R({type:Z("object"),properties:le(_(),ze).optional(),required:W(_()).optional()}).catchall(pe()).optional(),annotations:Bw.optional(),execution:Jw.optional(),_meta:le(_(),pe()).optional()}),Zs=Xn.extend({method:Z("tools/list")}),Kw=Yn.extend({tools:W(Gm)}),Ms=Ie.extend({content:W(qu).default([]),structuredContent:le(_(),pe()).optional(),isError:Te().optional()}),KA=Ms.or(Ie.extend({toolResult:pe()})),Gw=Kn.extend({name:_(),arguments:le(_(),pe()).optional()}),Hr=Oe.extend({method:Z("tools/call"),params:Gw}),Ww=nt.extend({method:Z("notifications/tools/list_changed"),params:rt.optional()}),GA=R({autoRefresh:Te().default(!0),debounceMs:ne().int().nonnegative().default(300)}),ro=Ae(["debug","info","notice","warning","error","critical","alert","emergency"]),Xw=et.extend({level:ro}),Lu=Oe.extend({method:Z("logging/setLevel"),params:Xw}),Yw=rt.extend({level:ro,logger:_().optional(),data:pe()}),Qw=nt.extend({method:Z("notifications/message"),params:Yw}),ek=R({name:_().optional()}),tk=R({hints:W(ek).optional(),costPriority:ne().min(0).max(1).optional(),speedPriority:ne().min(0).max(1).optional(),intelligencePriority:ne().min(0).max(1).optional()}),rk=R({mode:Ae(["auto","required","none"]).optional()}),nk=R({type:Z("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:W(qu).default([]),structuredContent:R({}).loose().optional(),isError:Te().optional(),_meta:le(_(),pe()).optional()}),ok=zu("type",[Zu,Mu,Du]),vs=zu("type",[Zu,Mu,Du,qw,nk]),sk=R({role:to,content:de([vs,W(vs)]),_meta:le(_(),pe()).optional()}),ik=Kn.extend({messages:W(sk),modelPreferences:tk.optional(),systemPrompt:_().optional(),includeContext:Ae(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:W(_()).optional(),metadata:ze.optional(),tools:W(Gm).optional(),toolChoice:rk.optional()}),ak=Oe.extend({method:Z("sampling/createMessage"),params:ik}),no=Ie.extend({model:_(),stopReason:fe(Ae(["endTurn","stopSequence","maxTokens"]).or(_())),role:to,content:ok}),Fu=Ie.extend({model:_(),stopReason:fe(Ae(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:to,content:de([vs,W(vs)])}),ck=R({type:Z("boolean"),title:_().optional(),description:_().optional(),default:Te().optional()}),uk=R({type:Z("string"),title:_().optional(),description:_().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:Ae(["email","uri","date","date-time"]).optional(),default:_().optional()}),lk=R({type:Ae(["number","integer"]),title:_().optional(),description:_().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),dk=R({type:Z("string"),title:_().optional(),description:_().optional(),enum:W(_()),default:_().optional()}),pk=R({type:Z("string"),title:_().optional(),description:_().optional(),oneOf:W(R({const:_(),title:_()})),default:_().optional()}),fk=R({type:Z("string"),title:_().optional(),description:_().optional(),enum:W(_()),enumNames:W(_()).optional(),default:_().optional()}),mk=de([dk,pk]),hk=R({type:Z("array"),title:_().optional(),description:_().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:R({type:Z("string"),enum:W(_())}),default:W(_()).optional()}),gk=R({type:Z("array"),title:_().optional(),description:_().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:R({anyOf:W(R({const:_(),title:_()}))}),default:W(_()).optional()}),_k=de([hk,gk]),yk=de([fk,mk,_k]),vk=de([yk,ck,uk,lk]),xk=Kn.extend({mode:Z("form").optional(),message:_(),requestedSchema:R({type:Z("object"),properties:le(_(),vk),required:W(_()).optional()})}),bk=Kn.extend({mode:Z("url"),message:_(),elicitationId:_(),url:_().url()}),$k=de([xk,bk]),wk=Oe.extend({method:Z("elicitation/create"),params:$k}),kk=rt.extend({elicitationId:_()}),Sk=nt.extend({method:Z("notifications/elicitation/complete"),params:kk}),Br=Ie.extend({action:Ae(["accept","decline","cancel"]),content:Pu((e)=>e===null?void 0:e,le(_(),de([_(),ne(),Te(),W(_())])).optional())}),zk=R({type:Z("ref/resource"),uri:_()});var Pk=R({type:Z("ref/prompt"),name:_()}),Ek=et.extend({ref:de([Pk,zk]),argument:R({name:_(),value:_()}),context:R({arguments:le(_(),_()).optional()}).optional()}),Ds=Oe.extend({method:Z("completion/complete"),params:Ek});function Wm(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Xm(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var Tk=Ie.extend({completion:Ze({values:W(_()).max(100),total:fe(ne().int()),hasMore:fe(Te())})}),Rk=R({uri:_().startsWith("file://"),name:_().optional(),_meta:le(_(),pe()).optional()}),Ok=Oe.extend({method:Z("roots/list"),params:et.optional()}),Uu=Ie.extend({roots:W(Rk)}),Ik=nt.extend({method:Z("notifications/roots/list_changed"),params:rt.optional()}),WA=de([ks,Au,Ds,Lu,js,Ns,Is,As,Cs,Ow,Aw,Hr,Zs,zs,Es,Ts,Os]),XA=de([ws,Ss,Cu,Ik,eo]),YA=de([$s,no,Fu,Br,Uu,Ps,Rs,Ur]),QA=de([ks,ak,wk,Ok,zs,Es,Ts,Os]),eC=de([ws,Ss,Qw,Nw,Tw,Ww,Hw,eo,Sk]),tC=de([$s,yw,Tk,Vw,Mw,Sw,zw,Ew,Ms,Kw,Ps,Rs,Ur]);class A extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===j.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new Ym(n.elicitations,t)}return new A(e,t,r)}}class Ym extends A{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(j.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}var Ak=10485760;class Vu{constructor(e){this._maxBufferSize=e?.maxBufferSize??Ak}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
66
66
|
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Ck(t)}clear(){this._buffer=void 0}}function Ck(e){return Fm.parse(JSON.parse(e))}function Qm(e){return JSON.stringify(e)+`
|
|
67
|
-
`}class Vu{constructor(e=eh.stdin,t=eh.stdout,r){this._stdin=e,this._stdout=t,this._started=!1,this._ondata=(n)=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}},this._onerror=(n)=>{this.onerror?.(n)},this._readBuffer=new Uu({maxBufferSize:r?.maxBufferSize})}async start(){if(this._started)throw 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(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(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((t)=>{let r=Qm(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var G;(function(e){e.assertEqual=(o)=>{};function t(o){}e.assertIs=t;function r(o){throw Error()}e.assertNever=r,e.arrayToEnum=(o)=>{let s={};for(let i of o)s[i]=i;return s},e.getValidEnumValues=(o)=>{let s=e.objectKeys(o).filter((a)=>typeof o[o[a]]!=="number"),i={};for(let a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=(o)=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys==="function"?(o)=>Object.keys(o):(o)=>{let s=[];for(let i in o)if(Object.prototype.hasOwnProperty.call(o,i))s.push(i);return s},e.find=(o,s)=>{for(let i of o)if(s(i))return i;return},e.isInteger=typeof Number.isInteger==="function"?(o)=>Number.isInteger(o):(o)=>typeof o==="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map((i)=>typeof i==="string"?`'${i}'`:i).join(s)}e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>{if(typeof s==="bigint")return s.toString();return s}})(G||(G={}));var th;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(th||(th={}));var P=G.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Nt=(e)=>{switch(typeof e){case"undefined":return P.undefined;case"string":return P.string;case"number":return Number.isNaN(e)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":if(Array.isArray(e))return P.array;if(e===null)return P.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return P.promise;if(typeof Map<"u"&&e instanceof Map)return P.map;if(typeof Set<"u"&&e instanceof Set)return P.set;if(typeof Date<"u"&&e instanceof Date)return P.date;return P.object;default:return P.unknown}};var b=G.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"]);class tt extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},n=(o)=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;while(a<s.path.length){let c=s.path[a],u=a===s.path.length-1;if(c==="_errors"){if(u)i._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(i,c))if(c==="__proto__")Object.defineProperty(i,c,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0});else i[c]={_errors:[]};if(i=i[c],u)i._errors.push(t(s));a++}}};return n(this),r}static assert(e){if(!(e instanceof tt))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,G.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t=Object.create(null),r=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];t[o]=t[o]||[],t[o].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}tt.create=(e)=>new tt(e);var Nk=(e,t)=>{let r;switch(e.code){case b.invalid_type:if(e.received===P.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case b.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,G.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:r=`Unrecognized key(s) in object: ${G.joinValues(e.keys,", ")}`;break;case b.invalid_union:r="Invalid input";break;case b.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${G.joinValues(e.options)}`;break;case b.invalid_enum_value:r=`Invalid enum value. Expected ${G.joinValues(e.options)}, received '${e.received}'`;break;case b.invalid_arguments:r="Invalid function arguments";break;case b.invalid_return_type:r="Invalid function return type";break;case b.invalid_date:r="Invalid date";break;case b.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else G.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case b.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case b.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case b.custom:r="Invalid input";break;case b.invalid_intersection_types:r="Intersection results could not be merged";break;case b.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case b.not_finite:r="Number must be finite";break;default:r=t.defaultError,G.assertNever(e)}return{message:r}},Kt=Nk;var jk=Kt;function oo(){return jk}var qs=(e)=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}};function S(e,t){let r=oo(),n=qs({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Kt?void 0:Kt].filter((o)=>!!o)});e.common.issues.push(n)}class Ce{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return L;if(n.status==="dirty")e.dirty();r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let o=await n.key,s=await n.value;r.push({key:o,value:s})}return Ce.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:o,value:s}=n;if(o.status==="aborted")return L;if(s.status==="aborted")return L;if(o.status==="dirty")e.dirty();if(s.status==="dirty")e.dirty();if(o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet))r[o.value]=s.value}return{status:e.value,value:r}}}var L=Object.freeze({status:"aborted"}),Jr=(e)=>({status:"dirty",value:e}),Me=(e)=>({status:"valid",value:e}),Hu=(e)=>e.status==="aborted",Bu=(e)=>e.status==="dirty",Sr=(e)=>e.status==="valid",so=(e)=>typeof Promise<"u"&&e instanceof Promise;var N;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(N||(N={}));class lt{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var rh=(e,t)=>{if(Sr(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new tt(e.common.issues);return this._error=r,this._error}}}};function V(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:o};return{errorMap:(i,a)=>{let{message:c}=e;if(i.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??n??a.defaultError};if(i.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:o}}class J{get description(){return this._def.description}_getType(e){return Nt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ce,ctx:{common:e.parent.common,data:e.data,parsedType:Nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(so(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)},n=this._parseSync({data:e,path:r.path,parent:r});return rh(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Sr(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>Sr(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)},n=this._parse({data:e,path:r.path,parent:r}),o=await(so(n)?n:Promise.resolve(n));return rh(r,o)}refine(e,t){let r=(n)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(n);else return t};return this._refinement((n,o)=>{let s=e(n),i=()=>o.addIssue({code:b.custom,...r(n)});if(typeof Promise<"u"&&s instanceof Promise)return s.then((a)=>{if(!a)return i(),!1;else return!0});if(!s)return i(),!1;else return!0})}refinement(e,t){return this._refinement((r,n)=>{if(!e(r))return n.addIssue(typeof t==="function"?t(r,n):t),!1;else return!0})}_refinement(e){return new vt({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return yt.create(this,this._def)}nullable(){return Gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _t.create(this)}promise(){return Yr.create(this,this._def)}or(e){return lo.create([this,e],this._def)}and(e){return po.create(this,e,this._def)}transform(e){return new vt({...V(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new go({...V(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new Wu({typeName:w.ZodBranded,type:this,...V(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new _o({...V(this._def),innerType:this,catchValue:t,typeName:w.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Ks.create(this,e)}readonly(){return yo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var Zk=/^c[^\s-]{8,}$/i,Mk=/^[0-9a-z]+$/,Dk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qk=/^[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,Lk=/^[a-z0-9_-]{21}$/i,Fk=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Uk=/^[-+]?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)?)??$/,Vk=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hk="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",Ju,Bk=/^(?:(?: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])$/,Jk=/^(?:(?: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])$/,Kk=/^(([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]))$/,Gk=/^(([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])$/,Wk=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nh="((\\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])))",Yk=new RegExp(`^${nh}$`);function oh(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Qk(e){return new RegExp(`^${oh(e)}$`)}function eS(e){let t=`${nh}T${oh(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function tS(e,t){if((t==="v4"||!t)&&Bk.test(e))return!0;if((t==="v6"||!t)&&Kk.test(e))return!0;return!1}function rS(e,t){if(!Fk.test(e))return!1;try{let[r]=e.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));if(typeof o!=="object"||o===null)return!1;if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&o.alg!==t)return!1;return!0}catch{return!1}}function nS(e,t){if((t==="v4"||!t)&&Jk.test(e))return!0;if((t==="v6"||!t)&&Gk.test(e))return!0;return!1}class Zt extends J{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==P.string){let o=this._getOrReturnCtx(e);return S(o,{code:b.invalid_type,expected:P.string,received:o.parsedType}),L}let r=new Ce,n=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.length<o.value)n=this._getOrReturnCtx(e,n),S(n,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="max"){if(e.data.length>o.value)n=this._getOrReturnCtx(e,n),S(n,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="length"){let s=e.data.length>o.value,i=e.data.length<o.value;if(s||i){if(n=this._getOrReturnCtx(e,n),s)S(n,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});else if(i)S(n,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});r.dirty()}}else if(o.kind==="email"){if(!Vk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="emoji"){if(!Ju)Ju=new RegExp(Hk,"u");if(!Ju.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="uuid"){if(!qk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="nanoid"){if(!Lk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cuid"){if(!Zk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cuid2"){if(!Mk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="ulid"){if(!Dk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"ulid",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),S(n,{validation:"url",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="regex"){if(o.regex.lastIndex=0,!o.regex.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"regex",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="trim")e.data=e.data.trim();else if(o.kind==="includes"){if(!e.data.includes(o.value,o.position))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()}else if(o.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(o.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(o.kind==="startsWith"){if(!e.data.startsWith(o.value))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()}else if(o.kind==="endsWith"){if(!e.data.endsWith(o.value))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()}else if(o.kind==="datetime"){if(!eS(o).test(e.data))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()}else if(o.kind==="date"){if(!Yk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()}else if(o.kind==="time"){if(!Qk(o).test(e.data))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()}else if(o.kind==="duration"){if(!Uk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="ip"){if(!tS(e.data,o.version))n=this._getOrReturnCtx(e,n),S(n,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="jwt"){if(!rS(e.data,o.alg))n=this._getOrReturnCtx(e,n),S(n,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cidr"){if(!nS(e.data,o.version))n=this._getOrReturnCtx(e,n),S(n,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="base64"){if(!Wk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="base64url"){if(!Xk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()}else G.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((n)=>e.test(n),{validation:t,code:b.invalid_string,...N.errToObj(r)})}_addCheck(e){return new Zt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new Zt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Zt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Zt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}Zt.create=(e)=>new Zt({checks:[],typeName:w.ZodString,coerce:e?.coerce??!1,...V(e)});function oS(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class Gr extends J{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);if(this._getType(e)!==P.number){let o=this._getOrReturnCtx(e);return S(o,{code:b.invalid_type,expected:P.number,received:o.parsedType}),L}let r=void 0,n=new Ce;for(let o of this._def.checks)if(o.kind==="int"){if(!G.isInteger(e.data))r=this._getOrReturnCtx(e,r),S(r,{code:b.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()}else if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)r=this._getOrReturnCtx(e,r),S(r,{code:b.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)r=this._getOrReturnCtx(e,r),S(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="multipleOf"){if(oS(e.data,o.value)!==0)r=this._getOrReturnCtx(e,r),S(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()}else if(o.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),S(r,{code:b.not_finite,message:o.message}),n.dirty()}else G.assertNever(o);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,n){return new Gr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(n)}]})}_addCheck(e){return new Gr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&G.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}Gr.create=(e)=>new Gr({checks:[],typeName:w.ZodNumber,coerce:e?.coerce||!1,...V(e)});class Wr extends J{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)!==P.bigint)return this._getInvalidInput(e);let r=void 0,n=new Ce;for(let o of this._def.checks)if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)r=this._getOrReturnCtx(e,r),S(r,{code:b.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)r=this._getOrReturnCtx(e,r),S(r,{code:b.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()}else if(o.kind==="multipleOf"){if(e.data%o.value!==BigInt(0))r=this._getOrReturnCtx(e,r),S(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()}else G.assertNever(o);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:P.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,n){return new Wr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(n)}]})}_addCheck(e){return new Wr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}Wr.create=(e)=>new Wr({checks:[],typeName:w.ZodBigInt,coerce:e?.coerce??!1,...V(e)});class Ls extends J{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==P.boolean){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.boolean,received:r.parsedType}),L}return Me(e.data)}}Ls.create=(e)=>new Ls({typeName:w.ZodBoolean,coerce:e?.coerce||!1,...V(e)});class ao extends J{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==P.date){let o=this._getOrReturnCtx(e);return S(o,{code:b.invalid_type,expected:P.date,received:o.parsedType}),L}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return S(o,{code:b.invalid_date}),L}let r=new Ce,n=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.getTime()<o.value)n=this._getOrReturnCtx(e,n),S(n,{code:b.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()}else if(o.kind==="max"){if(e.data.getTime()>o.value)n=this._getOrReturnCtx(e,n),S(n,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()}else G.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ao({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}ao.create=(e)=>new ao({checks:[],coerce:e?.coerce||!1,typeName:w.ZodDate,...V(e)});class Fs extends J{_parse(e){if(this._getType(e)!==P.symbol){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.symbol,received:r.parsedType}),L}return Me(e.data)}}Fs.create=(e)=>new Fs({typeName:w.ZodSymbol,...V(e)});class co extends J{_parse(e){if(this._getType(e)!==P.undefined){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.undefined,received:r.parsedType}),L}return Me(e.data)}}co.create=(e)=>new co({typeName:w.ZodUndefined,...V(e)});class uo extends J{_parse(e){if(this._getType(e)!==P.null){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.null,received:r.parsedType}),L}return Me(e.data)}}uo.create=(e)=>new uo({typeName:w.ZodNull,...V(e)});class Us extends J{constructor(){super(...arguments);this._any=!0}_parse(e){return Me(e.data)}}Us.create=(e)=>new Us({typeName:w.ZodAny,...V(e)});class zr extends J{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Me(e.data)}}zr.create=(e)=>new zr({typeName:w.ZodUnknown,...V(e)});class Mt extends J{_parse(e){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:P.never,received:t.parsedType}),L}}Mt.create=(e)=>new Mt({typeName:w.ZodNever,...V(e)});class Vs extends J{_parse(e){if(this._getType(e)!==P.undefined){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.void,received:r.parsedType}),L}return Me(e.data)}}Vs.create=(e)=>new Vs({typeName:w.ZodVoid,...V(e)});class _t extends J{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==P.array)return S(t,{code:b.invalid_type,expected:P.array,received:t.parsedType}),L;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;if(s||i)S(t,{code:s?b.too_big:b.too_small,minimum:i?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty()}if(n.minLength!==null){if(t.data.length<n.minLength.value)S(t,{code:b.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()}if(n.maxLength!==null){if(t.data.length>n.maxLength.value)S(t,{code:b.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((s,i)=>n.type._parseAsync(new lt(t,s,t.path,i)))).then((s)=>Ce.mergeArray(r,s));let o=[...t.data].map((s,i)=>n.type._parseSync(new lt(t,s,t.path,i)));return Ce.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new _t({...this._def,minLength:{value:e,message:N.toString(t)}})}max(e,t){return new _t({...this._def,maxLength:{value:e,message:N.toString(t)}})}length(e,t){return new _t({...this._def,exactLength:{value:e,message:N.toString(t)}})}nonempty(e){return this.min(1,e)}}_t.create=(e,t)=>new _t({type:e,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...V(t)});function Kr(e){if(e instanceof ye){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=yt.create(Kr(n))}return new ye({...e._def,shape:()=>t})}else if(e instanceof _t)return new _t({...e._def,type:Kr(e.element)});else if(e instanceof yt)return yt.create(Kr(e.unwrap()));else if(e instanceof Gt)return Gt.create(Kr(e.unwrap()));else if(e instanceof Dt)return Dt.create(e.items.map((t)=>Kr(t)));else return e}class ye extends J{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=G.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==P.object){let c=this._getOrReturnCtx(e);return S(c,{code:b.invalid_type,expected:P.object,received:c.parsedType}),L}let{status:r,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof Mt&&this._def.unknownKeys==="strip")){for(let c in n.data)if(!s.includes(c))i.push(c)}let a=[];for(let c of s){let u=o[c],l=n.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new lt(n,l,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Mt){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of i)a.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict"){if(i.length>0)S(n,{code:b.unrecognized_keys,keys:i}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of i){let l=n.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new lt(n,l,n.path,u)),alwaysSet:u in n.data})}}if(n.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let l=await u.key,d=await u.value;c.push({key:l,value:d,alwaysSet:u.alwaysSet})}return c}).then((c)=>Ce.mergeObjectSync(r,c));else return Ce.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new ye({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:N.errToObj(e).message??n};return{message:n}}}:{}})}strip(){return new ye({...this._def,unknownKeys:"strip"})}passthrough(){return new ye({...this._def,unknownKeys:"passthrough"})}extend(e){return new ye({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ye({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ye({...this._def,catchall:e})}pick(e){let t={};for(let r of G.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new ye({...this._def,shape:()=>t})}omit(e){let t={};for(let r of G.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new ye({...this._def,shape:()=>t})}deepPartial(){return Kr(this)}partial(e){let t={};for(let r of G.objectKeys(this.shape)){let n=this.shape[r];if(e&&!e[r])t[r]=n;else t[r]=n.optional()}return new ye({...this._def,shape:()=>t})}required(e){let t={};for(let r of G.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];while(o instanceof yt)o=o._def.innerType;t[r]=o}return new ye({...this._def,shape:()=>t})}keyof(){return sh(G.objectKeys(this.shape))}}ye.create=(e,t)=>new ye({shape:()=>e,unknownKeys:"strip",catchall:Mt.create(),typeName:w.ZodObject,...V(t)});ye.strictCreate=(e,t)=>new ye({shape:()=>e,unknownKeys:"strict",catchall:Mt.create(),typeName:w.ZodObject,...V(t)});ye.lazycreate=(e,t)=>new ye({shape:e,unknownKeys:"strip",catchall:Mt.create(),typeName:w.ZodObject,...V(t)});class lo extends J{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map((i)=>new tt(i.ctx.common.issues));return S(t,{code:b.invalid_union,unionErrors:s}),L}if(t.common.async)return Promise.all(r.map(async(o)=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);else{let o=void 0,s=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!o)o={result:u,ctx:c};if(c.common.issues.length)s.push(c.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map((a)=>new tt(a));return S(t,{code:b.invalid_union,unionErrors:i}),L}}get options(){return this._def.options}}lo.create=(e,t)=>new lo({options:e,typeName:w.ZodUnion,...V(t)});var jt=(e)=>{if(e instanceof fo)return jt(e.schema);else if(e instanceof vt)return jt(e.innerType());else if(e instanceof mo)return[e.value];else if(e instanceof Pr)return e.options;else if(e instanceof ho)return G.objectValues(e.enum);else if(e instanceof go)return jt(e._def.innerType);else if(e instanceof co)return[void 0];else if(e instanceof uo)return[null];else if(e instanceof yt)return[void 0,...jt(e.unwrap())];else if(e instanceof Gt)return[null,...jt(e.unwrap())];else if(e instanceof Wu)return jt(e.unwrap());else if(e instanceof yo)return jt(e.unwrap());else if(e instanceof _o)return jt(e._def.innerType);else return[]};class Gu extends J{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.object)return S(t,{code:b.invalid_type,expected:P.object,received:t.parsedType}),L;let r=this.discriminator,n=t.data[r],o=this.optionsMap.get(n);if(!o)return S(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),L;if(t.common.async)return o._parseAsync({data:t.data,path:t.path,parent:t});else return o._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let o of t){let s=jt(o.shape[e]);if(!s.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,o)}}return new Gu({typeName:w.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...V(r)})}}function Ku(e,t){let r=Nt(e),n=Nt(t);if(e===t)return{valid:!0,data:e};else if(r===P.object&&n===P.object){let o=G.objectKeys(t),s=G.objectKeys(e).filter((a)=>o.indexOf(a)!==-1),i={...e,...t};if(Object.prototype.hasOwnProperty.call(i,"__proto__"))delete i.__proto__;for(let a of s){if(a==="__proto__")continue;let c=Ku(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===P.array&&n===P.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let s=0;s<e.length;s++){let i=e[s],a=t[s],c=Ku(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else if(r===P.date&&n===P.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class po extends J{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(o,s)=>{if(Hu(o)||Hu(s))return L;let i=Ku(o.value,s.value);if(!i.valid)return S(r,{code:b.invalid_intersection_types}),L;if(Bu(o)||Bu(s))t.dirty();return{status:t.value,value:i.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>n(o,s));else return n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}po.create=(e,t,r)=>new po({left:e,right:t,typeName:w.ZodIntersection,...V(r)});class Dt extends J{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.array)return S(r,{code:b.invalid_type,expected:P.array,received:r.parsedType}),L;if(r.data.length<this._def.items.length)return S(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),L;if(!this._def.rest&&r.data.length>this._def.items.length)S(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let o=[...r.data].map((s,i)=>{let a=this._def.items[i]||this._def.rest;if(!a)return null;return a._parse(new lt(r,s,r.path,i))}).filter((s)=>!!s);if(r.common.async)return Promise.all(o).then((s)=>Ce.mergeArray(t,s));else return Ce.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new Dt({...this._def,rest:e})}}Dt.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:e,typeName:w.ZodTuple,rest:null,...V(t)})};class Hs extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.object)return S(r,{code:b.invalid_type,expected:P.object,received:r.parsedType}),L;let n=[],o=this._def.keyType,s=this._def.valueType;for(let i in r.data)n.push({key:o._parse(new lt(r,i,r.path,i)),value:s._parse(new lt(r,r.data[i],r.path,i)),alwaysSet:i in r.data});if(r.common.async)return Ce.mergeObjectAsync(t,n);else return Ce.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof J)return new Hs({keyType:e,valueType:t,typeName:w.ZodRecord,...V(r)});return new Hs({keyType:Zt.create(),valueType:e,typeName:w.ZodRecord,...V(t)})}}class Bs extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.map)return S(r,{code:b.invalid_type,expected:P.map,received:r.parsedType}),L;let n=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([i,a],c)=>({key:n._parse(new lt(r,i,r.path,[c,"key"])),value:o._parse(new lt(r,a,r.path,[c,"value"]))}));if(r.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let a of s){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return L;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let a of s){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return L;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}}}}Bs.create=(e,t,r)=>new Bs({valueType:t,keyType:e,typeName:w.ZodMap,...V(r)});class Xr extends J{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.set)return S(r,{code:b.invalid_type,expected:P.set,received:r.parsedType}),L;let n=this._def;if(n.minSize!==null){if(r.data.size<n.minSize.value)S(r,{code:b.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()}if(n.maxSize!==null){if(r.data.size>n.maxSize.value)S(r,{code:b.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty()}let o=this._def.valueType;function s(a){let c=new Set;for(let u of a){if(u.status==="aborted")return L;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let i=[...r.data.values()].map((a,c)=>o._parse(new lt(r,a,r.path,c)));if(r.common.async)return Promise.all(i).then((a)=>s(a));else return s(i)}min(e,t){return new Xr({...this._def,minSize:{value:e,message:N.toString(t)}})}max(e,t){return new Xr({...this._def,maxSize:{value:e,message:N.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Xr.create=(e,t)=>new Xr({valueType:e,minSize:null,maxSize:null,typeName:w.ZodSet,...V(t)});class io extends J{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.function)return S(t,{code:b.invalid_type,expected:P.function,received:t.parsedType}),L;function r(i,a){return qs({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,oo(),Kt].filter((c)=>!!c),issueData:{code:b.invalid_arguments,argumentsError:a}})}function n(i,a){return qs({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,oo(),Kt].filter((c)=>!!c),issueData:{code:b.invalid_return_type,returnTypeError:a}})}let o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Yr){let i=this;return Me(async function(...a){let c=new tt([]),u=await i._def.args.parseAsync(a,o).catch((m)=>{throw c.addIssue(r(a,m)),c}),l=await Reflect.apply(s,this,u);return await i._def.returns._def.type.parseAsync(l,o).catch((m)=>{throw c.addIssue(n(l,m)),c})})}else{let i=this;return Me(function(...a){let c=i._def.args.safeParse(a,o);if(!c.success)throw new tt([r(a,c.error)]);let u=Reflect.apply(s,this,c.data),l=i._def.returns.safeParse(u,o);if(!l.success)throw new tt([n(u,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new io({...this._def,args:Dt.create(e).rest(zr.create())})}returns(e){return new io({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new io({args:e?e:Dt.create([]).rest(zr.create()),returns:t||zr.create(),typeName:w.ZodFunction,...V(r)})}}class fo extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}fo.create=(e,t)=>new fo({getter:e,typeName:w.ZodLazy,...V(t)});class mo extends J{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return S(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),L}return{status:"valid",value:e.data}}get value(){return this._def.value}}mo.create=(e,t)=>new mo({value:e,typeName:w.ZodLiteral,...V(t)});function sh(e,t){return new Pr({values:e,typeName:w.ZodEnum,...V(t)})}class Pr extends J{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return S(t,{expected:G.joinValues(r),received:t.parsedType,code:b.invalid_type}),L}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return S(t,{received:t.data,code:b.invalid_enum_value,options:r}),L}return Me(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Pr.create(e,{...this._def,...t})}exclude(e,t=this._def){return Pr.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}Pr.create=sh;class ho extends J{_parse(e){let t=G.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==P.string&&r.parsedType!==P.number){let n=G.objectValues(t);return S(r,{expected:G.joinValues(n),received:r.parsedType,code:b.invalid_type}),L}if(!this._cache)this._cache=new Set(G.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let n=G.objectValues(t);return S(r,{received:r.data,code:b.invalid_enum_value,options:n}),L}return Me(e.data)}get enum(){return this._def.values}}ho.create=(e,t)=>new ho({values:e,typeName:w.ZodNativeEnum,...V(t)});class Yr extends J{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.promise&&t.common.async===!1)return S(t,{code:b.invalid_type,expected:P.promise,received:t.parsedType}),L;let r=t.parsedType===P.promise?t.data:Promise.resolve(t.data);return Me(r.then((n)=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Yr.create=(e,t)=>new Yr({type:e,typeName:w.ZodPromise,...V(t)});class vt extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:(s)=>{if(S(r,s),s.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async(i)=>{if(t.value==="aborted")return L;let a=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});if(a.status==="aborted")return L;if(a.status==="dirty")return Jr(a.value);if(t.value==="dirty")return Jr(a.value);return a});else{if(t.value==="aborted")return L;let i=this._def.schema._parseSync({data:s,path:r.path,parent:r});if(i.status==="aborted")return L;if(i.status==="dirty")return Jr(i.value);if(t.value==="dirty")return Jr(i.value);return i}}if(n.type==="refinement"){let s=(i)=>{let a=n.refinement(i,o);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return L;if(i.status==="dirty")t.dirty();return s(i.value),{status:t.value,value:i.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(i.status==="aborted")return L;if(i.status==="dirty")t.dirty();return s(i.value).then(()=>({status:t.value,value:i.value}))})}if(n.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Sr(s))return L;let i=n.transform(s.value,o);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(!Sr(s))return L;return Promise.resolve(n.transform(s.value,o)).then((i)=>({status:t.value,value:i}))});G.assertNever(n)}}vt.create=(e,t,r)=>new vt({schema:e,typeName:w.ZodEffects,effect:t,...V(r)});vt.createWithPreprocess=(e,t,r)=>new vt({schema:t,effect:{type:"preprocess",transform:e},typeName:w.ZodEffects,...V(r)});class yt extends J{_parse(e){if(this._getType(e)===P.undefined)return Me(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}yt.create=(e,t)=>new yt({innerType:e,typeName:w.ZodOptional,...V(t)});class Gt extends J{_parse(e){if(this._getType(e)===P.null)return Me(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Gt.create=(e,t)=>new Gt({innerType:e,typeName:w.ZodNullable,...V(t)});class go extends J{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===P.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}go.create=(e,t)=>new go({innerType:e,typeName:w.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...V(t)});class _o extends J{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(so(n))return n.then((o)=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tt(r.common.issues)},input:r.data})}));else return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new tt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}_o.create=(e,t)=>new _o({innerType:e,typeName:w.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...V(t)});class Js extends J{_parse(e){if(this._getType(e)!==P.nan){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.nan,received:r.parsedType}),L}return{status:"valid",value:e.data}}}Js.create=(e)=>new Js({typeName:w.ZodNaN,...V(e)});var $C=Symbol("zod_brand");class Wu extends J{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ks extends J{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(o.status==="aborted")return L;if(o.status==="dirty")return t.dirty(),Jr(o.value);else return this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();else{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return L;if(n.status==="dirty")return t.dirty(),{status:"dirty",value:n.value};else return this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new Ks({in:e,out:t,typeName:w.ZodPipeline})}}class yo extends J{_parse(e){let t=this._def.innerType._parse(e),r=(n)=>{if(Sr(n))n.value=Object.freeze(n.value);return n};return so(t)?t.then((n)=>r(n)):r(t)}unwrap(){return this._def.innerType}}yo.create=(e,t)=>new yo({innerType:e,typeName:w.ZodReadonly,...V(t)});var wC={object:ye.lazycreate},w;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(w||(w={}));var kC=Zt.create,SC=Gr.create,zC=Js.create,PC=Wr.create,EC=Ls.create,TC=ao.create,RC=Fs.create,OC=co.create,IC=uo.create,AC=Us.create,CC=zr.create,NC=Mt.create,jC=Vs.create,ZC=_t.create,{create:ih,strictCreate:MC}=ye,DC=lo.create,qC=Gu.create,LC=po.create,FC=Dt.create,UC=Hs.create,VC=Bs.create,HC=Xr.create,BC=io.create,JC=fo.create,KC=mo.create,GC=Pr.create,WC=ho.create,XC=Yr.create,YC=vt.create,QC=yt.create,eN=Gt.create,tN=vt.createWithPreprocess,rN=Ks.create;var iS=y("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");ae.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){ut(this,"with",e)},parse(e,t){return na(this,e,t,{callee:this.parse})},parseAsync(e,t){return oa(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return In(this,e,t)},safeParseAsync(e,t){return Cn(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(e,t){return We(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}});var aS=y("ZodMiniObject",(e,t)=>{qa.init(e,t),iS.init(e,t),Qi(e,"shape",(r)=>r._zod.def.shape,!1)});function Xu(e,t){let r={type:"object",shape:e??{},...I(t)};return new aS(r)}function xt(e){return!!e._zod}function Er(e){let t=Object.values(e);if(t.length===0)return Xu({});let r=t.every(xt),n=t.every((o)=>!xt(o));if(r)return Xu(e);if(n)return ih(e);throw Error("Mixed Zod versions detected in object shape.")}function Wt(e,t){if(xt(e))return In(e,t);return e.safeParse(t)}async function Gs(e,t){if(xt(e))return await Cn(e,t);return await e.safeParseAsync(t)}function Xt(e){if(!e)return;let t;if(xt(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function Qr(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let n=Object.values(e);if(n.length>0&&n.every((o)=>typeof o==="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse==="function")))return Er(e)}}if(xt(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function uS(e){if(e.length===0)return"object root";return e.reduce((t,r,n)=>{if(n===0)return String(r);if(typeof r==="number")return`${t}[${r}]`;return`${t}.${r}`},"")}function Ws(e){if(e&&typeof e==="object"){if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0)return e.issues.map((t)=>{if(!t.path?.length)return t.message;return`${t.message} at ${uS(t.path)}`}).join(`
|
|
68
|
-
`);if("message"in e&&typeof e.message==="string")return e.message;try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function ah(e){return e.description}function ch(e){if(xt(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function en(e){if(xt(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._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=e.value;if(n!==void 0)return n;return}function Yt(e){return e==="completed"||e==="failed"||e==="cancelled"}var lh=Symbol("Let zodToJsonSchema decide on which parser to use");var uh={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},dh=(e)=>typeof e==="string"?{...uh,name:e}:{...uh,...e};var ph=(e)=>{let t=dh(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function Yu(e,t,r,n){if(!n?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function X(e,t,r,n,o){e[t]=r,Yu(e,t,n,o)}var Xs=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function he(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Xs(t,e.currentPath):t.join("/")}}function fh(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==w.ZodAny)r.items=F(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)X(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)X(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)X(r,"minItems",e.exactLength.value,e.exactLength.message,t),X(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function mh(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":if(t.target==="jsonSchema7")if(n.inclusive)X(r,"minimum",n.value,n.message,t);else X(r,"exclusiveMinimum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMinimum=!0;X(r,"minimum",n.value,n.message,t)}break;case"max":if(t.target==="jsonSchema7")if(n.inclusive)X(r,"maximum",n.value,n.message,t);else X(r,"exclusiveMaximum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMaximum=!0;X(r,"maximum",n.value,n.message,t)}break;case"multipleOf":X(r,"multipleOf",n.value,n.message,t);break}return r}function hh(){return{type:"boolean"}}function Ys(e,t){return F(e.type._def,t)}var gh=(e,t)=>F(e.innerType._def,t);function Qu(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Qu(e,t,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return lS(e,t)}}var lS=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":X(r,"minimum",n.value,n.message,t);break;case"max":X(r,"maximum",n.value,n.message,t);break}return r};function _h(e,t){return{...F(e.innerType._def,t),default:e.defaultValue()}}function yh(e,t){return t.effectStrategy==="input"?F(e.schema._def,t):he(t)}function vh(e){return{type:"string",enum:Array.from(e.values)}}var dS=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function xh(e,t){let r=[F(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),F(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((s)=>!!s),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach((s)=>{if(dS(s)){if(o.push(...s.allOf),s.unevaluatedProperties===void 0)n=void 0}else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function bh(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var el=void 0,dt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(el===void 0)el=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return el},uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Qs(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":X(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":X(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":pt(r,"email",n.message,t);break;case"format:idn-email":pt(r,"idn-email",n.message,t);break;case"pattern:zod":De(r,dt.email,n.message,t);break}break;case"url":pt(r,"uri",n.message,t);break;case"uuid":pt(r,"uuid",n.message,t);break;case"regex":De(r,n.regex,n.message,t);break;case"cuid":De(r,dt.cuid,n.message,t);break;case"cuid2":De(r,dt.cuid2,n.message,t);break;case"startsWith":De(r,RegExp(`^${tl(n.value,t)}`),n.message,t);break;case"endsWith":De(r,RegExp(`${tl(n.value,t)}$`),n.message,t);break;case"datetime":pt(r,"date-time",n.message,t);break;case"date":pt(r,"date",n.message,t);break;case"time":pt(r,"time",n.message,t);break;case"duration":pt(r,"duration",n.message,t);break;case"length":X(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value,n.message,t),X(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{De(r,RegExp(tl(n.value,t)),n.message,t);break}case"ip":{if(n.version!=="v6")pt(r,"ipv4",n.message,t);if(n.version!=="v4")pt(r,"ipv6",n.message,t);break}case"base64url":De(r,dt.base64url,n.message,t);break;case"jwt":De(r,dt.jwt,n.message,t);break;case"cidr":{if(n.version!=="v6")De(r,dt.ipv4Cidr,n.message,t);if(n.version!=="v4")De(r,dt.ipv6Cidr,n.message,t);break}case"emoji":De(r,dt.emoji(),n.message,t);break;case"ulid":{De(r,dt.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{pt(r,"binary",n.message,t);break}case"contentEncoding:base64":{X(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{De(r,dt.base64,n.message,t);break}}break}case"nanoid":De(r,dt.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((o)=>{})(n)}return r}function tl(e,t){return t.patternStrategy==="escape"?fS(e):e}var pS=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function fS(e){let t="";for(let r=0;r<e.length;r++){if(!pS.has(e[r]))t+="\\";t+=e[r]}return t}function pt(e,t,r,n){if(e.format||e.anyOf?.some((o)=>o.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})}else X(e,"format",t,r,n)}function De(e,t,r,n){if(e.pattern||e.allOf?.some((o)=>o.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:$h(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})}else X(e,"pattern",$h(t,n),r,n)}function $h(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){if(a)o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1;else if(n[c+1]==="-"&&n[c+2]?.match(/[a-z]/))o+=n[c],a=!0;else o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
|
|
67
|
+
`}class Hu{constructor(e=eh.stdin,t=eh.stdout,r){this._stdin=e,this._stdout=t,this._started=!1,this._ondata=(n)=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}},this._onerror=(n)=>{this.onerror?.(n)},this._readBuffer=new Vu({maxBufferSize:r?.maxBufferSize})}async start(){if(this._started)throw 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(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(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((t)=>{let r=Qm(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var G;(function(e){e.assertEqual=(o)=>{};function t(o){}e.assertIs=t;function r(o){throw Error()}e.assertNever=r,e.arrayToEnum=(o)=>{let s={};for(let i of o)s[i]=i;return s},e.getValidEnumValues=(o)=>{let s=e.objectKeys(o).filter((a)=>typeof o[o[a]]!=="number"),i={};for(let a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=(o)=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys==="function"?(o)=>Object.keys(o):(o)=>{let s=[];for(let i in o)if(Object.prototype.hasOwnProperty.call(o,i))s.push(i);return s},e.find=(o,s)=>{for(let i of o)if(s(i))return i;return},e.isInteger=typeof Number.isInteger==="function"?(o)=>Number.isInteger(o):(o)=>typeof o==="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map((i)=>typeof i==="string"?`'${i}'`:i).join(s)}e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>{if(typeof s==="bigint")return s.toString();return s}})(G||(G={}));var th;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(th||(th={}));var P=G.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Nt=(e)=>{switch(typeof e){case"undefined":return P.undefined;case"string":return P.string;case"number":return Number.isNaN(e)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":if(Array.isArray(e))return P.array;if(e===null)return P.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return P.promise;if(typeof Map<"u"&&e instanceof Map)return P.map;if(typeof Set<"u"&&e instanceof Set)return P.set;if(typeof Date<"u"&&e instanceof Date)return P.date;return P.object;default:return P.unknown}};var b=G.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"]);class tt extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},n=(o)=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;while(a<s.path.length){let c=s.path[a],u=a===s.path.length-1;if(c==="_errors"){if(u)i._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(i,c))if(c==="__proto__")Object.defineProperty(i,c,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0});else i[c]={_errors:[]};if(i=i[c],u)i._errors.push(t(s));a++}}};return n(this),r}static assert(e){if(!(e instanceof tt))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,G.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t=Object.create(null),r=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];t[o]=t[o]||[],t[o].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}tt.create=(e)=>new tt(e);var Nk=(e,t)=>{let r;switch(e.code){case b.invalid_type:if(e.received===P.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case b.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,G.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:r=`Unrecognized key(s) in object: ${G.joinValues(e.keys,", ")}`;break;case b.invalid_union:r="Invalid input";break;case b.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${G.joinValues(e.options)}`;break;case b.invalid_enum_value:r=`Invalid enum value. Expected ${G.joinValues(e.options)}, received '${e.received}'`;break;case b.invalid_arguments:r="Invalid function arguments";break;case b.invalid_return_type:r="Invalid function return type";break;case b.invalid_date:r="Invalid date";break;case b.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else G.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case b.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case b.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case b.custom:r="Invalid input";break;case b.invalid_intersection_types:r="Intersection results could not be merged";break;case b.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case b.not_finite:r="Number must be finite";break;default:r=t.defaultError,G.assertNever(e)}return{message:r}},Kt=Nk;var jk=Kt;function oo(){return jk}var qs=(e)=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}};function S(e,t){let r=oo(),n=qs({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Kt?void 0:Kt].filter((o)=>!!o)});e.common.issues.push(n)}class Ce{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return L;if(n.status==="dirty")e.dirty();r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let o=await n.key,s=await n.value;r.push({key:o,value:s})}return Ce.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:o,value:s}=n;if(o.status==="aborted")return L;if(s.status==="aborted")return L;if(o.status==="dirty")e.dirty();if(s.status==="dirty")e.dirty();if(o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet))r[o.value]=s.value}return{status:e.value,value:r}}}var L=Object.freeze({status:"aborted"}),Jr=(e)=>({status:"dirty",value:e}),Me=(e)=>({status:"valid",value:e}),Bu=(e)=>e.status==="aborted",Ju=(e)=>e.status==="dirty",Sr=(e)=>e.status==="valid",so=(e)=>typeof Promise<"u"&&e instanceof Promise;var N;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(N||(N={}));class lt{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var rh=(e,t)=>{if(Sr(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new tt(e.common.issues);return this._error=r,this._error}}}};function V(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:o};return{errorMap:(i,a)=>{let{message:c}=e;if(i.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??n??a.defaultError};if(i.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:o}}class J{get description(){return this._def.description}_getType(e){return Nt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ce,ctx:{common:e.parent.common,data:e.data,parsedType:Nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(so(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)},n=this._parseSync({data:e,path:r.path,parent:r});return rh(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Sr(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>Sr(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)},n=this._parse({data:e,path:r.path,parent:r}),o=await(so(n)?n:Promise.resolve(n));return rh(r,o)}refine(e,t){let r=(n)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(n);else return t};return this._refinement((n,o)=>{let s=e(n),i=()=>o.addIssue({code:b.custom,...r(n)});if(typeof Promise<"u"&&s instanceof Promise)return s.then((a)=>{if(!a)return i(),!1;else return!0});if(!s)return i(),!1;else return!0})}refinement(e,t){return this._refinement((r,n)=>{if(!e(r))return n.addIssue(typeof t==="function"?t(r,n):t),!1;else return!0})}_refinement(e){return new vt({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return yt.create(this,this._def)}nullable(){return Gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _t.create(this)}promise(){return Yr.create(this,this._def)}or(e){return lo.create([this,e],this._def)}and(e){return po.create(this,e,this._def)}transform(e){return new vt({...V(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new go({...V(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new Xu({typeName:w.ZodBranded,type:this,...V(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new _o({...V(this._def),innerType:this,catchValue:t,typeName:w.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Ks.create(this,e)}readonly(){return yo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var Zk=/^c[^\s-]{8,}$/i,Mk=/^[0-9a-z]+$/,Dk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qk=/^[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,Lk=/^[a-z0-9_-]{21}$/i,Fk=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Uk=/^[-+]?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)?)??$/,Vk=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hk="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",Ku,Bk=/^(?:(?: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])$/,Jk=/^(?:(?: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])$/,Kk=/^(([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]))$/,Gk=/^(([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])$/,Wk=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nh="((\\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])))",Yk=new RegExp(`^${nh}$`);function oh(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Qk(e){return new RegExp(`^${oh(e)}$`)}function eS(e){let t=`${nh}T${oh(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function tS(e,t){if((t==="v4"||!t)&&Bk.test(e))return!0;if((t==="v6"||!t)&&Kk.test(e))return!0;return!1}function rS(e,t){if(!Fk.test(e))return!1;try{let[r]=e.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));if(typeof o!=="object"||o===null)return!1;if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&o.alg!==t)return!1;return!0}catch{return!1}}function nS(e,t){if((t==="v4"||!t)&&Jk.test(e))return!0;if((t==="v6"||!t)&&Gk.test(e))return!0;return!1}class Zt extends J{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==P.string){let o=this._getOrReturnCtx(e);return S(o,{code:b.invalid_type,expected:P.string,received:o.parsedType}),L}let r=new Ce,n=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.length<o.value)n=this._getOrReturnCtx(e,n),S(n,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="max"){if(e.data.length>o.value)n=this._getOrReturnCtx(e,n),S(n,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="length"){let s=e.data.length>o.value,i=e.data.length<o.value;if(s||i){if(n=this._getOrReturnCtx(e,n),s)S(n,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});else if(i)S(n,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});r.dirty()}}else if(o.kind==="email"){if(!Vk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="emoji"){if(!Ku)Ku=new RegExp(Hk,"u");if(!Ku.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="uuid"){if(!qk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="nanoid"){if(!Lk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cuid"){if(!Zk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cuid2"){if(!Mk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="ulid"){if(!Dk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"ulid",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),S(n,{validation:"url",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="regex"){if(o.regex.lastIndex=0,!o.regex.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"regex",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="trim")e.data=e.data.trim();else if(o.kind==="includes"){if(!e.data.includes(o.value,o.position))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()}else if(o.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(o.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(o.kind==="startsWith"){if(!e.data.startsWith(o.value))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()}else if(o.kind==="endsWith"){if(!e.data.endsWith(o.value))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()}else if(o.kind==="datetime"){if(!eS(o).test(e.data))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()}else if(o.kind==="date"){if(!Yk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()}else if(o.kind==="time"){if(!Qk(o).test(e.data))n=this._getOrReturnCtx(e,n),S(n,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()}else if(o.kind==="duration"){if(!Uk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="ip"){if(!tS(e.data,o.version))n=this._getOrReturnCtx(e,n),S(n,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="jwt"){if(!rS(e.data,o.alg))n=this._getOrReturnCtx(e,n),S(n,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cidr"){if(!nS(e.data,o.version))n=this._getOrReturnCtx(e,n),S(n,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="base64"){if(!Wk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="base64url"){if(!Xk.test(e.data))n=this._getOrReturnCtx(e,n),S(n,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()}else G.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((n)=>e.test(n),{validation:t,code:b.invalid_string,...N.errToObj(r)})}_addCheck(e){return new Zt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new Zt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Zt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Zt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}Zt.create=(e)=>new Zt({checks:[],typeName:w.ZodString,coerce:e?.coerce??!1,...V(e)});function oS(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class Gr extends J{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);if(this._getType(e)!==P.number){let o=this._getOrReturnCtx(e);return S(o,{code:b.invalid_type,expected:P.number,received:o.parsedType}),L}let r=void 0,n=new Ce;for(let o of this._def.checks)if(o.kind==="int"){if(!G.isInteger(e.data))r=this._getOrReturnCtx(e,r),S(r,{code:b.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()}else if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)r=this._getOrReturnCtx(e,r),S(r,{code:b.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)r=this._getOrReturnCtx(e,r),S(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="multipleOf"){if(oS(e.data,o.value)!==0)r=this._getOrReturnCtx(e,r),S(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()}else if(o.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),S(r,{code:b.not_finite,message:o.message}),n.dirty()}else G.assertNever(o);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,n){return new Gr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(n)}]})}_addCheck(e){return new Gr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&G.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}Gr.create=(e)=>new Gr({checks:[],typeName:w.ZodNumber,coerce:e?.coerce||!1,...V(e)});class Wr extends J{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)!==P.bigint)return this._getInvalidInput(e);let r=void 0,n=new Ce;for(let o of this._def.checks)if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)r=this._getOrReturnCtx(e,r),S(r,{code:b.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)r=this._getOrReturnCtx(e,r),S(r,{code:b.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()}else if(o.kind==="multipleOf"){if(e.data%o.value!==BigInt(0))r=this._getOrReturnCtx(e,r),S(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()}else G.assertNever(o);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:P.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,n){return new Wr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(n)}]})}_addCheck(e){return new Wr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}Wr.create=(e)=>new Wr({checks:[],typeName:w.ZodBigInt,coerce:e?.coerce??!1,...V(e)});class Ls extends J{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==P.boolean){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.boolean,received:r.parsedType}),L}return Me(e.data)}}Ls.create=(e)=>new Ls({typeName:w.ZodBoolean,coerce:e?.coerce||!1,...V(e)});class ao extends J{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==P.date){let o=this._getOrReturnCtx(e);return S(o,{code:b.invalid_type,expected:P.date,received:o.parsedType}),L}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return S(o,{code:b.invalid_date}),L}let r=new Ce,n=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.getTime()<o.value)n=this._getOrReturnCtx(e,n),S(n,{code:b.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()}else if(o.kind==="max"){if(e.data.getTime()>o.value)n=this._getOrReturnCtx(e,n),S(n,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()}else G.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ao({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}ao.create=(e)=>new ao({checks:[],coerce:e?.coerce||!1,typeName:w.ZodDate,...V(e)});class Fs extends J{_parse(e){if(this._getType(e)!==P.symbol){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.symbol,received:r.parsedType}),L}return Me(e.data)}}Fs.create=(e)=>new Fs({typeName:w.ZodSymbol,...V(e)});class co extends J{_parse(e){if(this._getType(e)!==P.undefined){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.undefined,received:r.parsedType}),L}return Me(e.data)}}co.create=(e)=>new co({typeName:w.ZodUndefined,...V(e)});class uo extends J{_parse(e){if(this._getType(e)!==P.null){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.null,received:r.parsedType}),L}return Me(e.data)}}uo.create=(e)=>new uo({typeName:w.ZodNull,...V(e)});class Us extends J{constructor(){super(...arguments);this._any=!0}_parse(e){return Me(e.data)}}Us.create=(e)=>new Us({typeName:w.ZodAny,...V(e)});class zr extends J{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Me(e.data)}}zr.create=(e)=>new zr({typeName:w.ZodUnknown,...V(e)});class Mt extends J{_parse(e){let t=this._getOrReturnCtx(e);return S(t,{code:b.invalid_type,expected:P.never,received:t.parsedType}),L}}Mt.create=(e)=>new Mt({typeName:w.ZodNever,...V(e)});class Vs extends J{_parse(e){if(this._getType(e)!==P.undefined){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.void,received:r.parsedType}),L}return Me(e.data)}}Vs.create=(e)=>new Vs({typeName:w.ZodVoid,...V(e)});class _t extends J{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==P.array)return S(t,{code:b.invalid_type,expected:P.array,received:t.parsedType}),L;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;if(s||i)S(t,{code:s?b.too_big:b.too_small,minimum:i?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty()}if(n.minLength!==null){if(t.data.length<n.minLength.value)S(t,{code:b.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()}if(n.maxLength!==null){if(t.data.length>n.maxLength.value)S(t,{code:b.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((s,i)=>n.type._parseAsync(new lt(t,s,t.path,i)))).then((s)=>Ce.mergeArray(r,s));let o=[...t.data].map((s,i)=>n.type._parseSync(new lt(t,s,t.path,i)));return Ce.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new _t({...this._def,minLength:{value:e,message:N.toString(t)}})}max(e,t){return new _t({...this._def,maxLength:{value:e,message:N.toString(t)}})}length(e,t){return new _t({...this._def,exactLength:{value:e,message:N.toString(t)}})}nonempty(e){return this.min(1,e)}}_t.create=(e,t)=>new _t({type:e,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...V(t)});function Kr(e){if(e instanceof ye){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=yt.create(Kr(n))}return new ye({...e._def,shape:()=>t})}else if(e instanceof _t)return new _t({...e._def,type:Kr(e.element)});else if(e instanceof yt)return yt.create(Kr(e.unwrap()));else if(e instanceof Gt)return Gt.create(Kr(e.unwrap()));else if(e instanceof Dt)return Dt.create(e.items.map((t)=>Kr(t)));else return e}class ye extends J{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=G.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==P.object){let c=this._getOrReturnCtx(e);return S(c,{code:b.invalid_type,expected:P.object,received:c.parsedType}),L}let{status:r,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof Mt&&this._def.unknownKeys==="strip")){for(let c in n.data)if(!s.includes(c))i.push(c)}let a=[];for(let c of s){let u=o[c],l=n.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new lt(n,l,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Mt){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of i)a.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict"){if(i.length>0)S(n,{code:b.unrecognized_keys,keys:i}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of i){let l=n.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new lt(n,l,n.path,u)),alwaysSet:u in n.data})}}if(n.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let l=await u.key,d=await u.value;c.push({key:l,value:d,alwaysSet:u.alwaysSet})}return c}).then((c)=>Ce.mergeObjectSync(r,c));else return Ce.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new ye({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:N.errToObj(e).message??n};return{message:n}}}:{}})}strip(){return new ye({...this._def,unknownKeys:"strip"})}passthrough(){return new ye({...this._def,unknownKeys:"passthrough"})}extend(e){return new ye({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ye({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ye({...this._def,catchall:e})}pick(e){let t={};for(let r of G.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new ye({...this._def,shape:()=>t})}omit(e){let t={};for(let r of G.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new ye({...this._def,shape:()=>t})}deepPartial(){return Kr(this)}partial(e){let t={};for(let r of G.objectKeys(this.shape)){let n=this.shape[r];if(e&&!e[r])t[r]=n;else t[r]=n.optional()}return new ye({...this._def,shape:()=>t})}required(e){let t={};for(let r of G.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];while(o instanceof yt)o=o._def.innerType;t[r]=o}return new ye({...this._def,shape:()=>t})}keyof(){return sh(G.objectKeys(this.shape))}}ye.create=(e,t)=>new ye({shape:()=>e,unknownKeys:"strip",catchall:Mt.create(),typeName:w.ZodObject,...V(t)});ye.strictCreate=(e,t)=>new ye({shape:()=>e,unknownKeys:"strict",catchall:Mt.create(),typeName:w.ZodObject,...V(t)});ye.lazycreate=(e,t)=>new ye({shape:e,unknownKeys:"strip",catchall:Mt.create(),typeName:w.ZodObject,...V(t)});class lo extends J{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map((i)=>new tt(i.ctx.common.issues));return S(t,{code:b.invalid_union,unionErrors:s}),L}if(t.common.async)return Promise.all(r.map(async(o)=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);else{let o=void 0,s=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!o)o={result:u,ctx:c};if(c.common.issues.length)s.push(c.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map((a)=>new tt(a));return S(t,{code:b.invalid_union,unionErrors:i}),L}}get options(){return this._def.options}}lo.create=(e,t)=>new lo({options:e,typeName:w.ZodUnion,...V(t)});var jt=(e)=>{if(e instanceof fo)return jt(e.schema);else if(e instanceof vt)return jt(e.innerType());else if(e instanceof mo)return[e.value];else if(e instanceof Pr)return e.options;else if(e instanceof ho)return G.objectValues(e.enum);else if(e instanceof go)return jt(e._def.innerType);else if(e instanceof co)return[void 0];else if(e instanceof uo)return[null];else if(e instanceof yt)return[void 0,...jt(e.unwrap())];else if(e instanceof Gt)return[null,...jt(e.unwrap())];else if(e instanceof Xu)return jt(e.unwrap());else if(e instanceof yo)return jt(e.unwrap());else if(e instanceof _o)return jt(e._def.innerType);else return[]};class Wu extends J{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.object)return S(t,{code:b.invalid_type,expected:P.object,received:t.parsedType}),L;let r=this.discriminator,n=t.data[r],o=this.optionsMap.get(n);if(!o)return S(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),L;if(t.common.async)return o._parseAsync({data:t.data,path:t.path,parent:t});else return o._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let o of t){let s=jt(o.shape[e]);if(!s.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,o)}}return new Wu({typeName:w.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...V(r)})}}function Gu(e,t){let r=Nt(e),n=Nt(t);if(e===t)return{valid:!0,data:e};else if(r===P.object&&n===P.object){let o=G.objectKeys(t),s=G.objectKeys(e).filter((a)=>o.indexOf(a)!==-1),i={...e,...t};if(Object.prototype.hasOwnProperty.call(i,"__proto__"))delete i.__proto__;for(let a of s){if(a==="__proto__")continue;let c=Gu(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===P.array&&n===P.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let s=0;s<e.length;s++){let i=e[s],a=t[s],c=Gu(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else if(r===P.date&&n===P.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class po extends J{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(o,s)=>{if(Bu(o)||Bu(s))return L;let i=Gu(o.value,s.value);if(!i.valid)return S(r,{code:b.invalid_intersection_types}),L;if(Ju(o)||Ju(s))t.dirty();return{status:t.value,value:i.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>n(o,s));else return n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}po.create=(e,t,r)=>new po({left:e,right:t,typeName:w.ZodIntersection,...V(r)});class Dt extends J{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.array)return S(r,{code:b.invalid_type,expected:P.array,received:r.parsedType}),L;if(r.data.length<this._def.items.length)return S(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),L;if(!this._def.rest&&r.data.length>this._def.items.length)S(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let o=[...r.data].map((s,i)=>{let a=this._def.items[i]||this._def.rest;if(!a)return null;return a._parse(new lt(r,s,r.path,i))}).filter((s)=>!!s);if(r.common.async)return Promise.all(o).then((s)=>Ce.mergeArray(t,s));else return Ce.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new Dt({...this._def,rest:e})}}Dt.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:e,typeName:w.ZodTuple,rest:null,...V(t)})};class Hs extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.object)return S(r,{code:b.invalid_type,expected:P.object,received:r.parsedType}),L;let n=[],o=this._def.keyType,s=this._def.valueType;for(let i in r.data)n.push({key:o._parse(new lt(r,i,r.path,i)),value:s._parse(new lt(r,r.data[i],r.path,i)),alwaysSet:i in r.data});if(r.common.async)return Ce.mergeObjectAsync(t,n);else return Ce.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof J)return new Hs({keyType:e,valueType:t,typeName:w.ZodRecord,...V(r)});return new Hs({keyType:Zt.create(),valueType:e,typeName:w.ZodRecord,...V(t)})}}class Bs extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.map)return S(r,{code:b.invalid_type,expected:P.map,received:r.parsedType}),L;let n=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([i,a],c)=>({key:n._parse(new lt(r,i,r.path,[c,"key"])),value:o._parse(new lt(r,a,r.path,[c,"value"]))}));if(r.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let a of s){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return L;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let a of s){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return L;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}}}}Bs.create=(e,t,r)=>new Bs({valueType:t,keyType:e,typeName:w.ZodMap,...V(r)});class Xr extends J{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.set)return S(r,{code:b.invalid_type,expected:P.set,received:r.parsedType}),L;let n=this._def;if(n.minSize!==null){if(r.data.size<n.minSize.value)S(r,{code:b.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()}if(n.maxSize!==null){if(r.data.size>n.maxSize.value)S(r,{code:b.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty()}let o=this._def.valueType;function s(a){let c=new Set;for(let u of a){if(u.status==="aborted")return L;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let i=[...r.data.values()].map((a,c)=>o._parse(new lt(r,a,r.path,c)));if(r.common.async)return Promise.all(i).then((a)=>s(a));else return s(i)}min(e,t){return new Xr({...this._def,minSize:{value:e,message:N.toString(t)}})}max(e,t){return new Xr({...this._def,maxSize:{value:e,message:N.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Xr.create=(e,t)=>new Xr({valueType:e,minSize:null,maxSize:null,typeName:w.ZodSet,...V(t)});class io extends J{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.function)return S(t,{code:b.invalid_type,expected:P.function,received:t.parsedType}),L;function r(i,a){return qs({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,oo(),Kt].filter((c)=>!!c),issueData:{code:b.invalid_arguments,argumentsError:a}})}function n(i,a){return qs({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,oo(),Kt].filter((c)=>!!c),issueData:{code:b.invalid_return_type,returnTypeError:a}})}let o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Yr){let i=this;return Me(async function(...a){let c=new tt([]),u=await i._def.args.parseAsync(a,o).catch((m)=>{throw c.addIssue(r(a,m)),c}),l=await Reflect.apply(s,this,u);return await i._def.returns._def.type.parseAsync(l,o).catch((m)=>{throw c.addIssue(n(l,m)),c})})}else{let i=this;return Me(function(...a){let c=i._def.args.safeParse(a,o);if(!c.success)throw new tt([r(a,c.error)]);let u=Reflect.apply(s,this,c.data),l=i._def.returns.safeParse(u,o);if(!l.success)throw new tt([n(u,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new io({...this._def,args:Dt.create(e).rest(zr.create())})}returns(e){return new io({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new io({args:e?e:Dt.create([]).rest(zr.create()),returns:t||zr.create(),typeName:w.ZodFunction,...V(r)})}}class fo extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}fo.create=(e,t)=>new fo({getter:e,typeName:w.ZodLazy,...V(t)});class mo extends J{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return S(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),L}return{status:"valid",value:e.data}}get value(){return this._def.value}}mo.create=(e,t)=>new mo({value:e,typeName:w.ZodLiteral,...V(t)});function sh(e,t){return new Pr({values:e,typeName:w.ZodEnum,...V(t)})}class Pr extends J{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return S(t,{expected:G.joinValues(r),received:t.parsedType,code:b.invalid_type}),L}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return S(t,{received:t.data,code:b.invalid_enum_value,options:r}),L}return Me(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Pr.create(e,{...this._def,...t})}exclude(e,t=this._def){return Pr.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}Pr.create=sh;class ho extends J{_parse(e){let t=G.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==P.string&&r.parsedType!==P.number){let n=G.objectValues(t);return S(r,{expected:G.joinValues(n),received:r.parsedType,code:b.invalid_type}),L}if(!this._cache)this._cache=new Set(G.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let n=G.objectValues(t);return S(r,{received:r.data,code:b.invalid_enum_value,options:n}),L}return Me(e.data)}get enum(){return this._def.values}}ho.create=(e,t)=>new ho({values:e,typeName:w.ZodNativeEnum,...V(t)});class Yr extends J{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.promise&&t.common.async===!1)return S(t,{code:b.invalid_type,expected:P.promise,received:t.parsedType}),L;let r=t.parsedType===P.promise?t.data:Promise.resolve(t.data);return Me(r.then((n)=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Yr.create=(e,t)=>new Yr({type:e,typeName:w.ZodPromise,...V(t)});class vt extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:(s)=>{if(S(r,s),s.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async(i)=>{if(t.value==="aborted")return L;let a=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});if(a.status==="aborted")return L;if(a.status==="dirty")return Jr(a.value);if(t.value==="dirty")return Jr(a.value);return a});else{if(t.value==="aborted")return L;let i=this._def.schema._parseSync({data:s,path:r.path,parent:r});if(i.status==="aborted")return L;if(i.status==="dirty")return Jr(i.value);if(t.value==="dirty")return Jr(i.value);return i}}if(n.type==="refinement"){let s=(i)=>{let a=n.refinement(i,o);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return L;if(i.status==="dirty")t.dirty();return s(i.value),{status:t.value,value:i.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(i.status==="aborted")return L;if(i.status==="dirty")t.dirty();return s(i.value).then(()=>({status:t.value,value:i.value}))})}if(n.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Sr(s))return L;let i=n.transform(s.value,o);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(!Sr(s))return L;return Promise.resolve(n.transform(s.value,o)).then((i)=>({status:t.value,value:i}))});G.assertNever(n)}}vt.create=(e,t,r)=>new vt({schema:e,typeName:w.ZodEffects,effect:t,...V(r)});vt.createWithPreprocess=(e,t,r)=>new vt({schema:t,effect:{type:"preprocess",transform:e},typeName:w.ZodEffects,...V(r)});class yt extends J{_parse(e){if(this._getType(e)===P.undefined)return Me(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}yt.create=(e,t)=>new yt({innerType:e,typeName:w.ZodOptional,...V(t)});class Gt extends J{_parse(e){if(this._getType(e)===P.null)return Me(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Gt.create=(e,t)=>new Gt({innerType:e,typeName:w.ZodNullable,...V(t)});class go extends J{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===P.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}go.create=(e,t)=>new go({innerType:e,typeName:w.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...V(t)});class _o extends J{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(so(n))return n.then((o)=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tt(r.common.issues)},input:r.data})}));else return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new tt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}_o.create=(e,t)=>new _o({innerType:e,typeName:w.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...V(t)});class Js extends J{_parse(e){if(this._getType(e)!==P.nan){let r=this._getOrReturnCtx(e);return S(r,{code:b.invalid_type,expected:P.nan,received:r.parsedType}),L}return{status:"valid",value:e.data}}}Js.create=(e)=>new Js({typeName:w.ZodNaN,...V(e)});var SC=Symbol("zod_brand");class Xu extends J{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ks extends J{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(o.status==="aborted")return L;if(o.status==="dirty")return t.dirty(),Jr(o.value);else return this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();else{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return L;if(n.status==="dirty")return t.dirty(),{status:"dirty",value:n.value};else return this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new Ks({in:e,out:t,typeName:w.ZodPipeline})}}class yo extends J{_parse(e){let t=this._def.innerType._parse(e),r=(n)=>{if(Sr(n))n.value=Object.freeze(n.value);return n};return so(t)?t.then((n)=>r(n)):r(t)}unwrap(){return this._def.innerType}}yo.create=(e,t)=>new yo({innerType:e,typeName:w.ZodReadonly,...V(t)});var zC={object:ye.lazycreate},w;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(w||(w={}));var PC=Zt.create,EC=Gr.create,TC=Js.create,RC=Wr.create,OC=Ls.create,IC=ao.create,AC=Fs.create,CC=co.create,NC=uo.create,jC=Us.create,ZC=zr.create,MC=Mt.create,DC=Vs.create,qC=_t.create,{create:ih,strictCreate:LC}=ye,FC=lo.create,UC=Wu.create,VC=po.create,HC=Dt.create,BC=Hs.create,JC=Bs.create,KC=Xr.create,GC=io.create,WC=fo.create,XC=mo.create,YC=Pr.create,QC=ho.create,eN=Yr.create,tN=vt.create,rN=yt.create,nN=Gt.create,oN=vt.createWithPreprocess,sN=Ks.create;var iS=y("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");ae.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){ut(this,"with",e)},parse(e,t){return oa(this,e,t,{callee:this.parse})},parseAsync(e,t){return sa(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return In(this,e,t)},safeParseAsync(e,t){return Cn(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(e,t){return We(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}});var aS=y("ZodMiniObject",(e,t)=>{La.init(e,t),iS.init(e,t),ea(e,"shape",(r)=>r._zod.def.shape,!1)});function Yu(e,t){let r={type:"object",shape:e??{},...I(t)};return new aS(r)}function xt(e){return!!e._zod}function Er(e){let t=Object.values(e);if(t.length===0)return Yu({});let r=t.every(xt),n=t.every((o)=>!xt(o));if(r)return Yu(e);if(n)return ih(e);throw Error("Mixed Zod versions detected in object shape.")}function Wt(e,t){if(xt(e))return In(e,t);return e.safeParse(t)}async function Gs(e,t){if(xt(e))return await Cn(e,t);return await e.safeParseAsync(t)}function Xt(e){if(!e)return;let t;if(xt(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function Qr(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let n=Object.values(e);if(n.length>0&&n.every((o)=>typeof o==="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse==="function")))return Er(e)}}if(xt(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function uS(e){if(e.length===0)return"object root";return e.reduce((t,r,n)=>{if(n===0)return String(r);if(typeof r==="number")return`${t}[${r}]`;return`${t}.${r}`},"")}function Ws(e){if(e&&typeof e==="object"){if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0)return e.issues.map((t)=>{if(!t.path?.length)return t.message;return`${t.message} at ${uS(t.path)}`}).join(`
|
|
68
|
+
`);if("message"in e&&typeof e.message==="string")return e.message;try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function ah(e){return e.description}function ch(e){if(xt(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function en(e){if(xt(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._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=e.value;if(n!==void 0)return n;return}function Yt(e){return e==="completed"||e==="failed"||e==="cancelled"}var lh=Symbol("Let zodToJsonSchema decide on which parser to use");var uh={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},dh=(e)=>typeof e==="string"?{...uh,name:e}:{...uh,...e};var ph=(e)=>{let t=dh(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function Qu(e,t,r,n){if(!n?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function X(e,t,r,n,o){e[t]=r,Qu(e,t,n,o)}var Xs=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function he(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Xs(t,e.currentPath):t.join("/")}}function fh(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==w.ZodAny)r.items=F(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)X(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)X(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)X(r,"minItems",e.exactLength.value,e.exactLength.message,t),X(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function mh(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":if(t.target==="jsonSchema7")if(n.inclusive)X(r,"minimum",n.value,n.message,t);else X(r,"exclusiveMinimum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMinimum=!0;X(r,"minimum",n.value,n.message,t)}break;case"max":if(t.target==="jsonSchema7")if(n.inclusive)X(r,"maximum",n.value,n.message,t);else X(r,"exclusiveMaximum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMaximum=!0;X(r,"maximum",n.value,n.message,t)}break;case"multipleOf":X(r,"multipleOf",n.value,n.message,t);break}return r}function hh(){return{type:"boolean"}}function Ys(e,t){return F(e.type._def,t)}var gh=(e,t)=>F(e.innerType._def,t);function el(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>el(e,t,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return lS(e,t)}}var lS=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":X(r,"minimum",n.value,n.message,t);break;case"max":X(r,"maximum",n.value,n.message,t);break}return r};function _h(e,t){return{...F(e.innerType._def,t),default:e.defaultValue()}}function yh(e,t){return t.effectStrategy==="input"?F(e.schema._def,t):he(t)}function vh(e){return{type:"string",enum:Array.from(e.values)}}var dS=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function xh(e,t){let r=[F(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),F(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((s)=>!!s),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach((s)=>{if(dS(s)){if(o.push(...s.allOf),s.unevaluatedProperties===void 0)n=void 0}else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function bh(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var tl=void 0,dt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(tl===void 0)tl=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return tl},uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Qs(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":X(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":X(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":pt(r,"email",n.message,t);break;case"format:idn-email":pt(r,"idn-email",n.message,t);break;case"pattern:zod":De(r,dt.email,n.message,t);break}break;case"url":pt(r,"uri",n.message,t);break;case"uuid":pt(r,"uuid",n.message,t);break;case"regex":De(r,n.regex,n.message,t);break;case"cuid":De(r,dt.cuid,n.message,t);break;case"cuid2":De(r,dt.cuid2,n.message,t);break;case"startsWith":De(r,RegExp(`^${rl(n.value,t)}`),n.message,t);break;case"endsWith":De(r,RegExp(`${rl(n.value,t)}$`),n.message,t);break;case"datetime":pt(r,"date-time",n.message,t);break;case"date":pt(r,"date",n.message,t);break;case"time":pt(r,"time",n.message,t);break;case"duration":pt(r,"duration",n.message,t);break;case"length":X(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value,n.message,t),X(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{De(r,RegExp(rl(n.value,t)),n.message,t);break}case"ip":{if(n.version!=="v6")pt(r,"ipv4",n.message,t);if(n.version!=="v4")pt(r,"ipv6",n.message,t);break}case"base64url":De(r,dt.base64url,n.message,t);break;case"jwt":De(r,dt.jwt,n.message,t);break;case"cidr":{if(n.version!=="v6")De(r,dt.ipv4Cidr,n.message,t);if(n.version!=="v4")De(r,dt.ipv6Cidr,n.message,t);break}case"emoji":De(r,dt.emoji(),n.message,t);break;case"ulid":{De(r,dt.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{pt(r,"binary",n.message,t);break}case"contentEncoding:base64":{X(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{De(r,dt.base64,n.message,t);break}}break}case"nanoid":De(r,dt.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((o)=>{})(n)}return r}function rl(e,t){return t.patternStrategy==="escape"?fS(e):e}var pS=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function fS(e){let t="";for(let r=0;r<e.length;r++){if(!pS.has(e[r]))t+="\\";t+=e[r]}return t}function pt(e,t,r,n){if(e.format||e.anyOf?.some((o)=>o.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})}else X(e,"format",t,r,n)}function De(e,t,r,n){if(e.pattern||e.allOf?.some((o)=>o.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:$h(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})}else X(e,"pattern",$h(t,n),r,n)}function $h(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){if(a)o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1;else if(n[c+1]==="-"&&n[c+2]?.match(/[a-z]/))o+=n[c],a=!0;else o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
|
|
69
69
|
]))`;continue}else if(n[c]==="$"){o+=`($|(?=[\r
|
|
70
70
|
]))`;continue}}if(r.s&&n[c]==="."){o+=i?`${n[c]}\r
|
|
71
71
|
`:`[${n[c]}\r
|
|
72
|
-
]`;continue}if(o+=n[c],n[c]==="\\")s=!0;else if(i&&n[c]==="]")i=!1;else if(!i&&n[c]==="[")i=!0}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function ei(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===w.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,o)=>({...n,[o]:F(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??he(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:F(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===w.ZodString&&e.keyType._def.checks?.length){let{type:n,...o}=Qs(e.keyType._def,t);return{...r,propertyNames:o}}else if(e.keyType?._def.typeName===w.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===w.ZodBranded&&e.keyType._def.type._def.typeName===w.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...o}=Ys(e.keyType._def,t);return{...r,propertyNames:o}}return r}function wh(e,t){if(t.mapStrategy==="record")return ei(e,t);let r=F(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||he(t),n=F(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||he(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function kh(e){let t=e.values,n=Object.keys(e.values).filter((s)=>typeof t[t[s]]!=="number").map((s)=>t[s]),o=Array.from(new Set(n.map((s)=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function Sh(e){return e.target==="openAi"?void 0:{not:he({...e,currentPath:[...e.currentPath,"not"]})}}function zh(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var vo={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Eh(e,t){if(t.target==="openApi3")return Ph(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((n)=>(n._def.typeName in vo)&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,s)=>{let i=vo[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every((n)=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every((n)=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter((s)=>!n.includes(s))],[])};return Ph(e,t)}var Ph=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>F(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter((n)=>!!n&&(!t.strictUnions||typeof n==="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Th(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:vo[e.innerType._def.typeName],nullable:!0};return{type:[vo[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let n=F(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(n&&"$ref"in n)return{allOf:[n],nullable:!0};return n&&{...n,nullable:!0}}let r=F(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Rh(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",Yu(r,"type",n.message,t);break;case"min":if(t.target==="jsonSchema7")if(n.inclusive)X(r,"minimum",n.value,n.message,t);else X(r,"exclusiveMinimum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMinimum=!0;X(r,"minimum",n.value,n.message,t)}break;case"max":if(t.target==="jsonSchema7")if(n.inclusive)X(r,"maximum",n.value,n.message,t);else X(r,"exclusiveMaximum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMaximum=!0;X(r,"maximum",n.value,n.message,t)}break;case"multipleOf":X(r,"multipleOf",n.value,n.message,t);break}return r}function Oh(e,t){let r=t.target==="openAi",n={type:"object",properties:{}},o=[],s=e.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let u=hS(c);if(u&&r){if(c._def.typeName==="ZodOptional")c=c._def.innerType;if(!c.isNullable())c=c.nullable();u=!1}let l=F(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});if(l===void 0)continue;if(n.properties[a]=l,!u)o.push(a)}if(o.length)n.required=o;let i=mS(e,t);if(i!==void 0)n.additionalProperties=i;return n}function mS(e,t){if(e.catchall._def.typeName!=="ZodNever")return F(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function hS(e){try{return e.isOptional()}catch{return!0}}var Ih=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return F(e.innerType._def,t);let r=F(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:he(t)},r]}:he(t)};var Ah=(e,t)=>{if(t.pipeStrategy==="input")return F(e.in._def,t);else if(t.pipeStrategy==="output")return F(e.out._def,t);let r=F(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=F(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter((o)=>o!==void 0)}};function Ch(e,t){return F(e.type._def,t)}function Nh(e,t){let n={type:"array",uniqueItems:!0,items:F(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)X(n,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)X(n,"maxItems",e.maxSize.value,e.maxSize.message,t);return n}function jh(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>F(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:F(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>F(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Zh(e){return{not:he(e)}}function Mh(e){return he(e)}var Dh=(e,t)=>F(e.innerType._def,t);var qh=(e,t,r)=>{switch(t){case w.ZodString:return Qs(e,r);case w.ZodNumber:return Rh(e,r);case w.ZodObject:return Oh(e,r);case w.ZodBigInt:return mh(e,r);case w.ZodBoolean:return hh();case w.ZodDate:return Qu(e,r);case w.ZodUndefined:return Zh(r);case w.ZodNull:return zh(r);case w.ZodArray:return fh(e,r);case w.ZodUnion:case w.ZodDiscriminatedUnion:return Eh(e,r);case w.ZodIntersection:return xh(e,r);case w.ZodTuple:return jh(e,r);case w.ZodRecord:return ei(e,r);case w.ZodLiteral:return bh(e,r);case w.ZodEnum:return vh(e);case w.ZodNativeEnum:return kh(e);case w.ZodNullable:return Th(e,r);case w.ZodOptional:return Ih(e,r);case w.ZodMap:return wh(e,r);case w.ZodSet:return Nh(e,r);case w.ZodLazy:return()=>e.getter()._def;case w.ZodPromise:return Ch(e,r);case w.ZodNaN:case w.ZodNever:return Sh(r);case w.ZodEffects:return yh(e,r);case w.ZodAny:return he(r);case w.ZodUnknown:return Mh(r);case w.ZodDefault:return _h(e,r);case w.ZodBranded:return Ys(e,r);case w.ZodReadonly:return Dh(e,r);case w.ZodCatch:return gh(e,r);case w.ZodPipeline:return Ah(e,r);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return((n)=>{return})(t)}};function F(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==lh)return a}if(n&&!r){let a=gS(n,t);if(a!==void 0)return a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let s=qh(e,e.typeName,t),i=typeof s==="function"?F(s(),t):s;if(i)_S(e,t,i);if(t.postProcess){let a=t.postProcess(i,e,t);return o.jsonSchema=i,a}return o.jsonSchema=i,i}var gS=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Xs(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),he(t);return t.$refStrategy==="seen"?he(t):void 0}}},_S=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var rl=(e,t)=>{let r=ph(t),n=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,l])=>({...c,[u]:F(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??he(r)}),{}):void 0,o=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,s=F(e._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??he(r),i=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(i!==void 0)s.title=i;if(r.flags.hasReferencedOpenAiAnyType){if(!n)n={};if(!n[r.openAiAnyTypeName])n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let a=o===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:s}};if(r.target==="jsonSchema7")a.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")a.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in a)||("oneOf"in a)||("allOf"in a)||("type"in a)&&Array.isArray(a.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return a};function yS(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function nl(e,t){if(xt(e))return $u(e,{target:yS(t?.target),io:t?.pipeStrategy??"input"});return rl(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function ol(e){let r=Xt(e)?.method;if(!r)throw Error("Schema is missing a method literal");let n=en(r);if(typeof n!=="string")throw Error("Schema method literal must be a string");return n}function sl(e,t){let r=Wt(e,t);if(!r.success)throw r.error;return r.data}var vS=60000;class il{constructor(e){if(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(ws,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Ss,(t)=>{this._onprogress(t)}),this.setRequestHandler(ks,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(zs,async(t,r)=>{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new A(j.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Es,async(t,r)=>{let n=async()=>{let o=t.params.taskId;if(!await this._taskStore.getTask(o,r.sessionId))throw new A(j.InvalidParams,`Task not found: ${o}`);if(this._taskMessageQueue){let i;while(i=await this._taskMessageQueue.dequeue(o,r.sessionId)){if(i.type==="response"||i.type==="error"){let a=i.message,c=a.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),i.type==="response")u(a);else{let l=a,d=new A(l.error.code,l.error.message,l.error.data);u(d)}else{let l=i.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${c}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(o,r.sessionId);if(!s)throw new A(j.InvalidParams,`Task not found: ${o}`);if(!Yt(s.status))return await this._waitForTaskUpdate(o,r.signal,r.sessionId),await n();if(Yt(s.status)){let i=await this._taskStore.getTaskResult(o,r.sessionId);return this._clearTaskQueue(o,r.sessionId),{...i,_meta:{...i._meta,[Jt]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler(Ts,async(t,r)=>{try{let{tasks:n,nextCursor:o}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new A(j.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Os,async(t,r)=>{try{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new A(j.InvalidParams,`Task not found: ${t.params.taskId}`);if(Yt(n.status))throw new A(j.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId,r.sessionId);let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new A(j.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(n){if(n instanceof A)throw n;throw new A(j.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),A.fromError(j.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw 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 t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(o)=>{r?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{if(n?.(o,s),Gn(o)||Lm(o))this._onresponse(o);else if(Tu(o))this._onrequest(o,s);else if(qm(o))this._onnotification(o);else this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=A.fromError(j.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,o=e.params?._meta?.[Jt]?.taskId,s=n?.sessionId,i=this._taskStore,a=!0,c;if(o&&i&&this._taskMessageQueue&&s!==void 0)a=!1,c=(async()=>{if(!await i.getTask(o,s))throw new A(j.InvalidParams,`Task not found: ${o}`);a=!0})();if(r===void 0){let p={jsonrpc:"2.0",id:e.id,error:{code:j.MethodNotFound,message:"Method not found"}};if(o&&c){let f={type:"error",message:p,timestamp:Date.now()};c.then(()=>this._enqueueTaskMessage(o,f,s),()=>n?.send(p)).catch((h)=>this._onerror(Error(`Failed to send an error response: ${h}`)))}else if(o&&this._taskMessageQueue)this._enqueueTaskMessage(o,{type:"error",message:p,timestamp:Date.now()},n?.sessionId).catch((f)=>this._onerror(Error(`Failed to enqueue error response: ${f}`)));else n?.send(p).catch((f)=>this._onerror(Error(`Failed to send an error response: ${f}`)));return}let u=new AbortController;this._requestHandlerAbortControllers.set(e.id,u);let l=Zm(e.params)?e.params.task:void 0,d=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,m={signal:u.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async(p)=>{if(u.signal.aborted)return;let f={relatedRequestId:e.id};if(o)f.relatedTask={taskId:o};await this.notification(p,f)},sendRequest:async(p,f,h)=>{if(u.signal.aborted)throw new A(j.ConnectionClosed,"Request was cancelled");let g={...h,relatedRequestId:e.id};if(o&&!g.relatedTask)g.relatedTask={taskId:o};let v=g.relatedTask?.taskId??o;if(v&&d)await d.updateTaskStatus(v,"input_required");return await this.request(p,f,g)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:d,taskRequestedTtl:l?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};(c??Promise.resolve()).then(()=>{if(c&&u.signal.aborted)throw new A(j.ConnectionClosed,"Request was cancelled");if(l)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,m)).then(async(p)=>{if(u.signal.aborted)return;let f={result:p,jsonrpc:"2.0",id:e.id};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"response",message:f,timestamp:Date.now()},n?.sessionId);else await n?.send(f)},async(p)=>{if(u.signal.aborted)return;let f={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(p.code)?p.code:j.InternalError,message:p.message??"Internal error",...p.data!==void 0&&{data:p.data}}};if(o&&this._taskMessageQueue&&a)await this._enqueueTaskMessage(o,{type:"error",message:f,timestamp:Date.now()},n?.sessionId);else await n?.send(f)}).catch((p)=>this._onerror(Error(`Failed to send response: ${p}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===u)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(n),i=this._timeoutInfo.get(n);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(a){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),s(a);return}o(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),Gn(e))r(e);else{let s=new A(e.error.code,e.error.message,e.error.data);r(s)}return}let n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(Gn(e)&&e.result&&typeof e.result==="object"){let s=e.result;if(s.task&&typeof s.task==="object"){let i=s.task;if(typeof i.taskId==="string")o=!0,this._taskProgressTokens.set(i.taskId,t)}}if(!o)this._progressHandlers.delete(t);if(Gn(e))n(e);else{let s=A.fromError(e.error.code,e.error.message,e.error.data);n(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:n}=r??{};if(!n){try{yield{type:"result",result:await this.request(e,t,r)}}catch(s){yield{type:"error",error:s instanceof A?s:new A(j.InternalError,String(s))}}return}let o;try{let s=await this.request(e,Ur,r);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new A(j.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:o},r);if(yield{type:"taskStatus",task:i},Yt(i.status)){if(i.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:o},t,r)};else if(i.status==="failed")yield{type:"error",error:new A(j.InternalError,`Task ${o} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new A(j.InternalError,`Task ${o} was cancelled`)};return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},t,r)};return}let a=i.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((c)=>setTimeout(c,a)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof A?s:new A(j.InternalError,String(s))}}}request(e,t,r){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:i,relatedTask:a}=r??{};return new Promise((c,u)=>{let l=(v)=>{u(v)};if(!this._transport){l(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),i)this.assertTaskCapability(e.method)}catch(v){l(v);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:d};if(r?.onprogress)this._progressHandlers.set(d,r.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}};if(i)m.params={...m.params,task:i};if(a)m.params={...m.params,_meta:{...m.params?._meta||{},[Jt]:a}};let p=(v)=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(v)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((M)=>this._onerror(Error(`Failed to send cancellation: ${M}`)));let T=v instanceof A?v:new A(j.RequestTimeout,String(v));u(T)};this._responseHandlers.set(d,(v)=>{if(r?.signal?.aborted)return;if(v instanceof Error)return u(v);try{let T=Wt(t,v.result);if(!T.success)u(T.error);else c(T.data)}catch(T){u(T)}}),r?.signal?.addEventListener("abort",()=>{p(r?.signal?.reason)});let f=r?.timeout??vS,h=()=>p(A.fromError(j.RequestTimeout,"Request timed out",{timeout:f}));this._setupTimeout(d,f,r?.maxTotalTimeout,h,r?.resetTimeoutOnProgress??!1);let g=a?.taskId;if(g){let v=(T)=>{let M=this._responseHandlers.get(d);if(M)M(T);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,v),this._enqueueTaskMessage(g,{type:"request",message:m,timestamp:Date.now()}).catch((T)=>{this._cleanupTimeout(d),u(T)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((v)=>{this._cleanupTimeout(d),u(v)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Ps,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Rs,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Vm,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Jt]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.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 i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Jt]:t.relatedTask}}};this._transport?.send(i,t).catch((a)=>this._onerror(a))});return}let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Jt]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=ol(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(n,o)=>{let s=sl(e,n);return Promise.resolve(t(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=ol(e);this._notificationHandlers.set(r,(n)=>{let o=sl(e,n);return Promise.resolve(t(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r??this._transport?.sessionId,n)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let n of r)if(n.type==="request"&&Tu(n.message)){let o=n.message.id,s=this._requestResolvers.get(o);if(s)s(new A(j.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o);else this._onerror(Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t,r){let n=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e,r);if(o?.pollInterval)n=o.pollInterval}catch{}return new Promise((o,s)=>{if(t.aborted){s(new A(j.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);t.addEventListener("abort",()=>{clearTimeout(i),s(new A(j.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(n)=>{if(!e)throw Error("No request provided");return await r.createTask(n,e.id,{method:e.method,params:e.params},t)},getTask:async(n)=>{let o=await r.getTask(n,t);if(!o)throw new A(j.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(n,o,s)=>{await r.storeTaskResult(n,o,s,t);let i=await r.getTask(n,t);if(i){let a=eo.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),Yt(i.status))this._cleanupTaskProgressHandler(n)}},getTaskResult:(n)=>r.getTaskResult(n,t),updateTaskStatus:async(n,o,s)=>{let i=await r.getTask(n,t);if(!i)throw new A(j.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(Yt(i.status))throw new A(j.InvalidParams,`Cannot update task "${n}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(n,o,s,t);let a=await r.getTask(n,t);if(a){let c=eo.parse({method:"notifications/tasks/status",params:a});if(await this.notification(c),Yt(a.status))this._cleanupTaskProgressHandler(n)}},listTasks:(n)=>r.listTasks(n,t)}}}function Lh(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Fh(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];if(Lh(i)&&Lh(s))r[o]={...i,...s};else r[o]=s}return r}var tb=hd(Gl(),1),rb=hd(eb(),1);function f1(){let e=new tb.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return rb.default(e),e}class od{constructor(e){this._ajv=e??f1()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class sd{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw 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],s=o.some((u)=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some((u)=>u.type==="tool_use");if(s){if(o.some((u)=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!c)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.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 Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},no,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let o=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Br,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function nb(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function ob(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class id extends il{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(ro.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let o=this._loggingLevels.get(n);return o?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new od,this.setRequestHandler(Iu,(r)=>this._oninitialize(r)),this.setNotificationHandler(Au,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(qu,async(r,n)=>{let o=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=ro.safeParse(s);if(i.success)this._loggingLevels.set(o,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new sd(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Fh(this._capabilities,e)}setRequestHandler(e,t){let n=Xt(e)?.method;if(!n)throw Error("Schema is missing a method literal");let o=en(n);if(typeof o!=="string")throw Error("Schema method literal must be a string");if(o==="tools/call"){let i=async(a,c)=>{let u=Wt(Hr,a);if(!u.success){let p=u.error instanceof Error?u.error.message:String(u.error);throw new A(j.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:l}=u.data,d=await Promise.resolve(t(a,c));if(l.task){let p=Wt(Ur,d);if(!p.success){let f=p.error instanceof Error?p.error.message:String(p.error);throw new A(j.InvalidParams,`Invalid task creation result: ${f}`)}return p.data}let m=Wt(Ms,d);if(!m.success){let p=m.error instanceof Error?m.error.message:String(m.error);throw new A(j.InvalidParams,`Invalid tools/call result: ${p}`)}return m.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw 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 Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw 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 Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw 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 Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){ob(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;nb(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Cm.includes(t)?t:Pu,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"},$s)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],n=Array.isArray(r.content)?r.content:[r.content],o=n.some((c)=>c.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],a=i.some((c)=>c.type==="tool_use");if(o){if(n.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let c=new Set(i.filter((l)=>l.type==="tool_use").map((l)=>l.id)),u=new Set(n.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(c.size!==u.size||![...c].every((l)=>u.has(l)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},Lu,t);return this.request({method:"sampling/createMessage",params:e},no,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},Br,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:n},Br,t);if(o.action==="accept"&&o.content&&n.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!i.valid)throw new A(j.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof A)throw s;throw new A(j.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},Fu,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))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 ib=Symbol.for("mcp.completable");function ad(e){return!!e&&typeof e==="object"&&ib in e}function ab(e){return e[ib]?.complete}var sb;(function(e){e.Completable="McpCompletable"})(sb||(sb={}));var m1=/^[A-Za-z0-9._-]{1,128}$/;function h1(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!m1.test(e)){let r=e.split("").filter((n)=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,s)=>s.indexOf(n)===o);return t.push(`Tool name contains invalid characters: ${r.map((n)=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function g1(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function cd(e){let t=h1(e);return g1(e,t.warnings),t.isValid}class ud{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let n={taskSupport:"required",...t.execution};if(n.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,n,t._meta,r)}}function _1(e,t){let r=0,n=[e];while(n.length>0){let o=n.pop();if(o===null||typeof o!=="object")continue;if(Array.isArray(o))for(let s of o){if(++r>t)return r;if(s!==null&&typeof s==="object")n.push(s)}else for(let s in o){if(!Object.prototype.hasOwnProperty.call(o,s))continue;if(++r>t)return r;let i=o[s];if(i!==null&&typeof i==="object")n.push(i)}}return r}function y1(e){if(e===void 0||e===1/0)return;if(typeof e!=="number"||Number.isNaN(e)||e<1)throw RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(e)}`);return e}class dd{constructor(e,t){if(this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new id(e,t),this._maxToolInputElements=y1(t?.maxToolInputElements),t?.capabilities?.tools)this.setToolRequestHandlers();if(t?.capabilities?.resources)this.setResourceRequestHandlers();if(t?.capabilities?.prompts)this.setPromptRequestHandlers()}get experimental(){if(!this._experimental)this._experimental={tasks:new ud(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(yr(Zs)),this.server.assertCanSetRequestHandler(yr(Hr)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Zs,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let n=Qr(t.inputSchema);return n?nl(n,{strictUnions:!0,pipeStrategy:"input"}):v1})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let n=Qr(t.outputSchema);if(n)r.outputSchema=nl(n,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(Hr,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new A(j.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new A(j.InvalidParams,`Tool ${e.params.name} disabled`);let n=!!e.params.task,o=r.execution?.taskSupport,s="createTask"in r.handler;if((o==="required"||o==="optional")&&!s)throw new A(j.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!n)throw new A(j.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!n&&s)return await this.handleAutomaticTaskPolling(r,e,t);let i=await this.validateToolInput(r,e.params.arguments,e.params.name),a=await this.executeToolHandler(r,i,t);if(n)return a;return await this.validateToolOutput(r,a,e.params.name),a}catch(r){if(r instanceof A){if(r.code===j.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(this._maxToolInputElements!==void 0&&_1(t,this._maxToolInputElements)>this._maxToolInputElements)throw new A(j.InvalidParams,`Invalid arguments for tool ${r}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!e.inputSchema)return;let o=Qr(e.inputSchema)??e.inputSchema,s=await Gs(o,t??{});if(!s.success){let i="error"in s?s.error:"Unknown error",a=Ws(i);throw new A(j.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a}`)}return s.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new A(j.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let n=Qr(e.outputSchema),o=await Gs(n,t.structuredContent);if(!o.success){let s="error"in o?o.error:"Unknown error",i=Ws(s);throw new A(j.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${i}`)}}async executeToolHandler(e,t,r){let n=e.handler;if("createTask"in n){if(!r.taskStore)throw Error("No task store provided.");let s={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(n.createTask(t,s));else return await Promise.resolve(n.createTask(s))}if(e.inputSchema)return await Promise.resolve(n(t,r));else return await Promise.resolve(n(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(e,t.params.arguments,t.params.name),o=e.handler,s={...r,taskStore:r.taskStore},i=n?await Promise.resolve(o.createTask(n,s)):await Promise.resolve(o.createTask(s)),a=i.task.taskId,c=i.task,u=c.pollInterval??5000;while(c.status!=="completed"&&c.status!=="failed"&&c.status!=="cancelled"){await new Promise((d)=>setTimeout(d,u));let l=await r.taskStore.getTask(a);if(!l)throw new A(j.InternalError,`Task ${a} not found during polling`);c=l}return await r.taskStore.getTaskResult(a)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(yr(Ds)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Ds,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return Wm(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return Xm(e),this.handleResourceCompletion(e,e.params.ref);default:throw new A(j.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new A(j.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new A(j.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Ao;let o=Xt(r.argsSchema)?.[e.params.argument.name];if(!ad(o))return Ao;let s=ab(o);if(!s)return Ao;let i=await s(e.params.argument.value,e.params.context);return ub(i)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((s)=>s.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return Ao;throw new A(j.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=r.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return Ao;let o=await n(e.params.argument.value,e.params.context);return ub(o)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(yr(Is)),this.server.assertCanSetRequestHandler(yr(As)),this.server.assertCanSetRequestHandler(yr(Cs)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Is,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),n=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(t);for(let i of s.resources)n.push({...o.metadata,...i})}return{resources:[...r,...n]}}),this.server.setRequestHandler(As,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(Cs,async(e,t)=>{let r=new URL(e.params.uri),n=this._registeredResources[r.toString()];if(n){if(!n.enabled)throw new A(j.InvalidParams,`Resource ${r} disabled`);return n.readCallback(r,t)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(r.toString());if(s)return o.readCallback(r,s,t)}throw new A(j.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(yr(Ns)),this.server.assertCanSetRequestHandler(yr(js)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Ns,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?x1(t.argsSchema):void 0}))})),this.server.setRequestHandler(js,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new A(j.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new A(j.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let n=Qr(r.argsSchema),o=await Gs(n,e.params.arguments??{});if(!o.success){let a="error"in o?o.error:"Unknown error",c=Ws(a);throw new A(j.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${c}`)}let s=o.data,i=r.callback;return await Promise.resolve(i(s,t))}else{let n=r.callback;return await Promise.resolve(n(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let n;if(typeof r[0]==="object")n=r.shift();let o=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let s=this._createRegisteredResource(e,void 0,t,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,t,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,t,r,n){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,r.title,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,r.title,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,r,n,o){let s={name:e,title:t,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:(i)=>{if(typeof i.uri<"u"&&i.uri!==r){if(delete this._registeredResources[r],i.uri)this._registeredResources[i.uri]=s}if(typeof i.name<"u")s.name=i.name;if(typeof i.title<"u")s.title=i.title;if(typeof i.metadata<"u")s.metadata=i.metadata;if(typeof i.callback<"u")s.readCallback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,n,o){let s={resourceTemplate:r,title:t,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(c)=>{if(typeof c.name<"u"&&c.name!==e){if(delete this._registeredResourceTemplates[e],c.name)this._registeredResourceTemplates[c.name]=s}if(typeof c.title<"u")s.title=c.title;if(typeof c.template<"u")s.resourceTemplate=c.template;if(typeof c.metadata<"u")s.metadata=c.metadata;if(typeof c.callback<"u")s.readCallback=c.callback;if(typeof c.enabled<"u")s.enabled=c.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=r.uriTemplate.variableNames;if(Array.isArray(i)&&i.some((c)=>!!r.completeCallback(c)))this.setCompletionRequestHandler();return s}_createRegisteredPrompt(e,t,r,n,o){let s={title:t,description:r,argsSchema:n===void 0?void 0:Er(n),callback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(i)=>{if(typeof i.name<"u"&&i.name!==e){if(delete this._registeredPrompts[e],i.name)this._registeredPrompts[i.name]=s}if(typeof i.title<"u")s.title=i.title;if(typeof i.description<"u")s.description=i.description;if(typeof i.argsSchema<"u")s.argsSchema=Er(i.argsSchema);if(typeof i.callback<"u")s.callback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=s,n){if(Object.values(n).some((a)=>{let c=a instanceof ys?a._def?.innerType:a;return ad(c)}))this.setCompletionRequestHandler()}return s}_createRegisteredTool(e,t,r,n,o,s,i,a,c){cd(e);let u={title:t,description:r,inputSchema:cb(n),outputSchema:cb(o),annotations:s,execution:i,_meta:a,handler:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:(l)=>{if(typeof l.name<"u"&&l.name!==e){if(typeof l.name==="string")cd(l.name);if(delete this._registeredTools[e],l.name)this._registeredTools[l.name]=u}if(typeof l.title<"u")u.title=l.title;if(typeof l.description<"u")u.description=l.description;if(typeof l.paramsSchema<"u")u.inputSchema=Er(l.paramsSchema);if(typeof l.outputSchema<"u")u.outputSchema=Er(l.outputSchema);if(typeof l.callback<"u")u.handler=l.callback;if(typeof l.annotations<"u")u.annotations=l.annotations;if(typeof l._meta<"u")u._meta=l._meta;if(typeof l.enabled<"u")u.enabled=l.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,n,o,s;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let a=t[0];if(ld(a)){if(n=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!ld(t[0]))s=t.shift()}else if(typeof a==="object"&&a!==null){if(Object.values(a).some((c)=>typeof c==="object"&&c!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=t.shift()}}let i=t[0];return this._createRegisteredTool(e,void 0,r,n,o,s,{taskSupport:"forbidden"},void 0,i)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:n,description:o,inputSchema:s,outputSchema:i,annotations:a,_meta:c}=t;return this._createRegisteredTool(e,n,o,s,i,a,{taskSupport:"forbidden"},c,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let n;if(t.length>1)n=t.shift();let o=t[0],s=this._createRegisteredPrompt(e,void 0,r,n,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:n,description:o,argsSchema:s}=t,i=this._createRegisteredPrompt(e,n,o,s,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var v1={type:"object",properties:{}};function lb(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function db(e){return"_def"in e||"_zod"in e||lb(e)}function ld(e){if(typeof e!=="object"||e===null)return!1;if(db(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(lb)}function cb(e){if(!e)return;if(ld(e))return Er(e);if(!db(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function x1(e){let t=Xt(e);if(!t)return[];return Object.entries(t).map(([r,n])=>{let o=ah(n),s=ch(n);return{name:r,description:o,required:!s}})}function yr(e){let r=Xt(e)?.method;if(!r)throw Error("Schema is missing a method literal");let n=en(r);if(typeof n==="string")return n;throw Error("Schema method literal must be a string")}function ub(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Ao={completion:{values:[],hasMore:!1}};var pb=["Actions","Forms","Navigation","Overlays","Feedback","Display","Layout","Appearance","Media","Utilities"];function pd(e){return Object.entries(e).map(([t,[r,n]])=>({slug:t,name:t.charAt(0).toUpperCase()+t.slice(1).replaceAll("-"," "),description:n,category:r}))}var fb={blocks:{label:"Blocks",description:"App-level pieces the apps shared copies of.",docs:pd({"accent-toggle":["Appearance","The accent presets: a swatch strip on desktop, labelled rows on phones."],"auth-shell":["Layout","Centered sign-in layout: heading, optional brand and footer."],"bottom-nav":["Navigation","The phone tab bar: top-level destinations, the current one lit."],"copy-field":["Forms","Monospace value with a copy button and a promise toast."],"document-title":["Layout","The tab's <title> from the page title, suffixed with the app."],"empty-state":["Feedback","Icon, title, subtitle and an action for an empty list."],"error-page":["Layout","Status, message and error id, with a link back home."],fab:["Actions","Floating action button above the phone tab bar, with a haptic tap."],"icon-button":["Actions","Round icon button whose tooltip is its accessible name."],"install-prompt":["Overlays","One-time PWA install sheet: native prompt or the steps."],"music-player":["Media","An audio player bar with a queue: play, skip, seek and volume."],"nav-cards":["Navigation","Phone-only list of a section's tabs as cards."],"new-password-fields":["Forms","New password with a reveal button, a strength meter and the rules it must pass."],"option-group":["Forms","Radio cards for a settings choice, each with an icon or swatch."],"otp-field":["Forms","A one-time code: digits only, autofilled from SMS, posted as one field."],"password-input":["Forms","A password field with a button to reveal what was typed."],"responsive-sheet":["Overlays","A dialog on desktop, a bottom drawer on phones."],"setting-switch":["Forms","Labelled switch row for settings forms."],"stat-card":["Display","Glass card with an icon, a value and a hint, optionally a link."],"tab-nav":["Navigation","Pill tab bar of links, the current page's tab highlighted."],"tab-section":["Navigation","Tabbed section layout: tabs on desktop, nav cards on phones."],"theme-picker":["Appearance","System, light and dark as radio cards."],"theme-toggle":["Appearance","System, light and dark: an icon strip on desktop, three rows on phones."],"top-loading-bar":["Feedback","Progress bar during SvelteKit navigations."],"video-player":["Media","A video player: scrubbing, chapters, subtitles, speed, fullscreen, gestures and shortcuts."]})},primitives:{label:"Primitives",description:"The shadcn-svelte components, as the apps customised them.",docs:pd({accordion:["Display","Stacked sections that expand one or several at a time."],alert:["Feedback","A callout for something the reader should notice."],"alert-dialog":["Overlays","A modal that asks to confirm before something drastic."],avatar:["Display","A user's picture, falling back to initials."],badge:["Display","A small label for a status or a count."],breadcrumb:["Navigation","The path from the root to the current page."],button:["Actions","Every button variant and size."],"button-group":["Actions","Buttons joined into one control."],calendar:["Forms","A month grid to pick a date."],card:["Display","A surface with a header, content and footer."],checkbox:["Forms","A checkbox, with a label through Field."],command:["Overlays","A searchable list of commands, also as a palette."],"context-menu":["Overlays","A menu on right click or long press."],dialog:["Overlays","A modal window over the page."],drawer:["Overlays","A panel sliding up from the bottom, made for phones."],"dropdown-menu":["Overlays","A menu opened from a button."],empty:["Feedback","The parts of an empty state, to compose your own."],field:["Forms","Label, control, description and error, laid out together."],input:["Forms","A text input; password managers stay off unless asked."],"input-group":["Forms","An input with addons: icons, text or buttons."],"input-otp":["Forms","One box per digit for a one-time code."],label:["Forms","A label for a form control."],menubar:["Navigation","A desktop-style bar of menus."],pagination:["Navigation","Links to the pages of a long list."],popover:["Overlays","Floating content anchored to a trigger."],progress:["Feedback","How far along something is."],"radio-group":["Forms","Pick one of a few options."],"range-calendar":["Forms","A month grid to pick a start and an end date."],resizable:["Layout","Panes split by a draggable handle."],"scroll-area":["Layout","A scrolling box with a styled scrollbar."],select:["Forms","Pick one option from a list."],separator:["Layout","A line between groups of content."],sheet:["Overlays","A panel sliding in from a side of the screen."],sidebar:["Navigation","The app sidebar: groups, menus, collapsing to icons."],skeleton:["Feedback","Placeholder shapes while content loads."],slider:["Forms","Pick a value or a range by dragging."],sonner:["Feedback","Toasts, styled by the theme."],spinner:["Feedback","An indeterminate loading indicator."],switch:["Forms","An on or off toggle."],table:["Display","Rows and columns of data."],tabs:["Navigation","In-page tabs that switch panels without navigating."],textarea:["Forms","A multi-line text input."],toggle:["Actions","A button that stays pressed."],"toggle-group":["Actions","Toggles where one or several stay pressed."],tooltip:["Overlays","A hint on hover or focus."]})},modules:{label:"Modules",description:"Helpers for toasts, titles, appearance and haptics.",docs:pd({appearance:["Appearance","Apply a saved accent, theme, font and corners to <html>."],haptics:["Feedback","A short vibration on tap, success or error."],"page-title":["Layout","One page title for the app bar, the header and the tab."],password:["Forms","The password rules and strength score, for the form and the server alike."],toast:["Feedback","Narrate a form action through one promise toast."],utils:["Utilities","cn to merge Tailwind classes, and the prop helper types."]})}};function Hi(){return Object.entries(fb).flatMap(([e,{docs:t}])=>t.map((r)=>({group:e,doc:r})))}function hb(e){return Hi().find(({doc:t})=>t.slug===e)}function gb(e){let t=e.toLowerCase().split(/\s+/).filter(Boolean);return Hi().filter(({doc:r})=>{let n=`${r.slug} ${r.category} ${r.description}`.toLowerCase();return t.every((o)=>n.includes(o))})}function b1(e,t){let r=Object.entries(e.files);if(t==="tab-section")return r.filter(([s])=>s.startsWith("routes/section/")).map(([s,i])=>({name:s.slice(7),code:mb(i)}));let n=e.files[`examples/${t}.svelte`],o=r.flatMap(([s,i])=>s.startsWith(`examples/${t}.`)&&s!==`examples/${t}.svelte`?[{name:s.slice(`examples/${t}.`.length),code:i}]:[]);if(n?.includes("<script"))o.unshift({name:"Example.svelte",code:n});return o.map(({name:s,code:i})=>({name:s,code:mb(i)}))}function mb(e){return e.replaceAll(/#lib\/components\/ui\/([\w-]+)\/index\.js/g,"@orochibraru/ui/$1").replaceAll(/#lib\/components\/blocks\/([\w-]+)\.svelte/g,"@orochibraru/ui/blocks/$1").replaceAll(/#lib\/([\w-]+)(?:\.svelte)?\.js/g,"@orochibraru/ui/$1")}function _b(e,{group:t,doc:r}){let n=t==="blocks"?`blocks/${r.slug}`:r.slug,o=b1(e,r.slug).map((s)=>`### ${s.name}
|
|
72
|
+
]`;continue}if(o+=n[c],n[c]==="\\")s=!0;else if(i&&n[c]==="]")i=!1;else if(!i&&n[c]==="[")i=!0}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function ei(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===w.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,o)=>({...n,[o]:F(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??he(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:F(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===w.ZodString&&e.keyType._def.checks?.length){let{type:n,...o}=Qs(e.keyType._def,t);return{...r,propertyNames:o}}else if(e.keyType?._def.typeName===w.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===w.ZodBranded&&e.keyType._def.type._def.typeName===w.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...o}=Ys(e.keyType._def,t);return{...r,propertyNames:o}}return r}function wh(e,t){if(t.mapStrategy==="record")return ei(e,t);let r=F(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||he(t),n=F(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||he(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function kh(e){let t=e.values,n=Object.keys(e.values).filter((s)=>typeof t[t[s]]!=="number").map((s)=>t[s]),o=Array.from(new Set(n.map((s)=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function Sh(e){return e.target==="openAi"?void 0:{not:he({...e,currentPath:[...e.currentPath,"not"]})}}function zh(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var vo={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Eh(e,t){if(t.target==="openApi3")return Ph(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((n)=>(n._def.typeName in vo)&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,s)=>{let i=vo[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every((n)=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every((n)=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter((s)=>!n.includes(s))],[])};return Ph(e,t)}var Ph=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>F(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter((n)=>!!n&&(!t.strictUnions||typeof n==="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Th(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:vo[e.innerType._def.typeName],nullable:!0};return{type:[vo[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let n=F(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(n&&"$ref"in n)return{allOf:[n],nullable:!0};return n&&{...n,nullable:!0}}let r=F(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Rh(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",Qu(r,"type",n.message,t);break;case"min":if(t.target==="jsonSchema7")if(n.inclusive)X(r,"minimum",n.value,n.message,t);else X(r,"exclusiveMinimum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMinimum=!0;X(r,"minimum",n.value,n.message,t)}break;case"max":if(t.target==="jsonSchema7")if(n.inclusive)X(r,"maximum",n.value,n.message,t);else X(r,"exclusiveMaximum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMaximum=!0;X(r,"maximum",n.value,n.message,t)}break;case"multipleOf":X(r,"multipleOf",n.value,n.message,t);break}return r}function Oh(e,t){let r=t.target==="openAi",n={type:"object",properties:{}},o=[],s=e.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let u=hS(c);if(u&&r){if(c._def.typeName==="ZodOptional")c=c._def.innerType;if(!c.isNullable())c=c.nullable();u=!1}let l=F(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});if(l===void 0)continue;if(n.properties[a]=l,!u)o.push(a)}if(o.length)n.required=o;let i=mS(e,t);if(i!==void 0)n.additionalProperties=i;return n}function mS(e,t){if(e.catchall._def.typeName!=="ZodNever")return F(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function hS(e){try{return e.isOptional()}catch{return!0}}var Ih=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return F(e.innerType._def,t);let r=F(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:he(t)},r]}:he(t)};var Ah=(e,t)=>{if(t.pipeStrategy==="input")return F(e.in._def,t);else if(t.pipeStrategy==="output")return F(e.out._def,t);let r=F(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=F(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter((o)=>o!==void 0)}};function Ch(e,t){return F(e.type._def,t)}function Nh(e,t){let n={type:"array",uniqueItems:!0,items:F(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)X(n,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)X(n,"maxItems",e.maxSize.value,e.maxSize.message,t);return n}function jh(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>F(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:F(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>F(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Zh(e){return{not:he(e)}}function Mh(e){return he(e)}var Dh=(e,t)=>F(e.innerType._def,t);var qh=(e,t,r)=>{switch(t){case w.ZodString:return Qs(e,r);case w.ZodNumber:return Rh(e,r);case w.ZodObject:return Oh(e,r);case w.ZodBigInt:return mh(e,r);case w.ZodBoolean:return hh();case w.ZodDate:return el(e,r);case w.ZodUndefined:return Zh(r);case w.ZodNull:return zh(r);case w.ZodArray:return fh(e,r);case w.ZodUnion:case w.ZodDiscriminatedUnion:return Eh(e,r);case w.ZodIntersection:return xh(e,r);case w.ZodTuple:return jh(e,r);case w.ZodRecord:return ei(e,r);case w.ZodLiteral:return bh(e,r);case w.ZodEnum:return vh(e);case w.ZodNativeEnum:return kh(e);case w.ZodNullable:return Th(e,r);case w.ZodOptional:return Ih(e,r);case w.ZodMap:return wh(e,r);case w.ZodSet:return Nh(e,r);case w.ZodLazy:return()=>e.getter()._def;case w.ZodPromise:return Ch(e,r);case w.ZodNaN:case w.ZodNever:return Sh(r);case w.ZodEffects:return yh(e,r);case w.ZodAny:return he(r);case w.ZodUnknown:return Mh(r);case w.ZodDefault:return _h(e,r);case w.ZodBranded:return Ys(e,r);case w.ZodReadonly:return Dh(e,r);case w.ZodCatch:return gh(e,r);case w.ZodPipeline:return Ah(e,r);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return((n)=>{return})(t)}};function F(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==lh)return a}if(n&&!r){let a=gS(n,t);if(a!==void 0)return a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let s=qh(e,e.typeName,t),i=typeof s==="function"?F(s(),t):s;if(i)_S(e,t,i);if(t.postProcess){let a=t.postProcess(i,e,t);return o.jsonSchema=i,a}return o.jsonSchema=i,i}var gS=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Xs(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),he(t);return t.$refStrategy==="seen"?he(t):void 0}}},_S=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var nl=(e,t)=>{let r=ph(t),n=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,l])=>({...c,[u]:F(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??he(r)}),{}):void 0,o=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,s=F(e._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??he(r),i=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(i!==void 0)s.title=i;if(r.flags.hasReferencedOpenAiAnyType){if(!n)n={};if(!n[r.openAiAnyTypeName])n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let a=o===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:s}};if(r.target==="jsonSchema7")a.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")a.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in a)||("oneOf"in a)||("allOf"in a)||("type"in a)&&Array.isArray(a.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return a};function yS(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function ol(e,t){if(xt(e))return wu(e,{target:yS(t?.target),io:t?.pipeStrategy??"input"});return nl(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function sl(e){let r=Xt(e)?.method;if(!r)throw Error("Schema is missing a method literal");let n=en(r);if(typeof n!=="string")throw Error("Schema method literal must be a string");return n}function il(e,t){let r=Wt(e,t);if(!r.success)throw r.error;return r.data}var vS=60000;class al{constructor(e){if(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(ws,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Ss,(t)=>{this._onprogress(t)}),this.setRequestHandler(ks,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(zs,async(t,r)=>{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new A(j.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Es,async(t,r)=>{let n=async()=>{let o=t.params.taskId;if(!await this._taskStore.getTask(o,r.sessionId))throw new A(j.InvalidParams,`Task not found: ${o}`);if(this._taskMessageQueue){let i;while(i=await this._taskMessageQueue.dequeue(o,r.sessionId)){if(i.type==="response"||i.type==="error"){let a=i.message,c=a.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),i.type==="response")u(a);else{let l=a,d=new A(l.error.code,l.error.message,l.error.data);u(d)}else{let l=i.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${c}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(o,r.sessionId);if(!s)throw new A(j.InvalidParams,`Task not found: ${o}`);if(!Yt(s.status))return await this._waitForTaskUpdate(o,r.signal,r.sessionId),await n();if(Yt(s.status)){let i=await this._taskStore.getTaskResult(o,r.sessionId);return this._clearTaskQueue(o,r.sessionId),{...i,_meta:{...i._meta,[Jt]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler(Ts,async(t,r)=>{try{let{tasks:n,nextCursor:o}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new A(j.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Os,async(t,r)=>{try{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new A(j.InvalidParams,`Task not found: ${t.params.taskId}`);if(Yt(n.status))throw new A(j.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId,r.sessionId);let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new A(j.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(n){if(n instanceof A)throw n;throw new A(j.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),A.fromError(j.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw 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 t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(o)=>{r?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{if(n?.(o,s),Gn(o)||Lm(o))this._onresponse(o);else if(Ru(o))this._onrequest(o,s);else if(qm(o))this._onnotification(o);else this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=A.fromError(j.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,o=e.params?._meta?.[Jt]?.taskId,s=n?.sessionId,i=this._taskStore,a=!0,c;if(o&&i&&this._taskMessageQueue&&s!==void 0)a=!1,c=(async()=>{if(!await i.getTask(o,s))throw new A(j.InvalidParams,`Task not found: ${o}`);a=!0})();if(r===void 0){let p={jsonrpc:"2.0",id:e.id,error:{code:j.MethodNotFound,message:"Method not found"}};if(o&&c){let f={type:"error",message:p,timestamp:Date.now()};c.then(()=>this._enqueueTaskMessage(o,f,s),()=>n?.send(p)).catch((h)=>this._onerror(Error(`Failed to send an error response: ${h}`)))}else if(o&&this._taskMessageQueue)this._enqueueTaskMessage(o,{type:"error",message:p,timestamp:Date.now()},n?.sessionId).catch((f)=>this._onerror(Error(`Failed to enqueue error response: ${f}`)));else n?.send(p).catch((f)=>this._onerror(Error(`Failed to send an error response: ${f}`)));return}let u=new AbortController;this._requestHandlerAbortControllers.set(e.id,u);let l=Zm(e.params)?e.params.task:void 0,d=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,m={signal:u.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async(p)=>{if(u.signal.aborted)return;let f={relatedRequestId:e.id};if(o)f.relatedTask={taskId:o};await this.notification(p,f)},sendRequest:async(p,f,h)=>{if(u.signal.aborted)throw new A(j.ConnectionClosed,"Request was cancelled");let g={...h,relatedRequestId:e.id};if(o&&!g.relatedTask)g.relatedTask={taskId:o};let v=g.relatedTask?.taskId??o;if(v&&d)await d.updateTaskStatus(v,"input_required");return await this.request(p,f,g)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:d,taskRequestedTtl:l?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};(c??Promise.resolve()).then(()=>{if(c&&u.signal.aborted)throw new A(j.ConnectionClosed,"Request was cancelled");if(l)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,m)).then(async(p)=>{if(u.signal.aborted)return;let f={result:p,jsonrpc:"2.0",id:e.id};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"response",message:f,timestamp:Date.now()},n?.sessionId);else await n?.send(f)},async(p)=>{if(u.signal.aborted)return;let f={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(p.code)?p.code:j.InternalError,message:p.message??"Internal error",...p.data!==void 0&&{data:p.data}}};if(o&&this._taskMessageQueue&&a)await this._enqueueTaskMessage(o,{type:"error",message:f,timestamp:Date.now()},n?.sessionId);else await n?.send(f)}).catch((p)=>this._onerror(Error(`Failed to send response: ${p}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===u)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(n),i=this._timeoutInfo.get(n);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(a){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),s(a);return}o(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),Gn(e))r(e);else{let s=new A(e.error.code,e.error.message,e.error.data);r(s)}return}let n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(Gn(e)&&e.result&&typeof e.result==="object"){let s=e.result;if(s.task&&typeof s.task==="object"){let i=s.task;if(typeof i.taskId==="string")o=!0,this._taskProgressTokens.set(i.taskId,t)}}if(!o)this._progressHandlers.delete(t);if(Gn(e))n(e);else{let s=A.fromError(e.error.code,e.error.message,e.error.data);n(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:n}=r??{};if(!n){try{yield{type:"result",result:await this.request(e,t,r)}}catch(s){yield{type:"error",error:s instanceof A?s:new A(j.InternalError,String(s))}}return}let o;try{let s=await this.request(e,Ur,r);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new A(j.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:o},r);if(yield{type:"taskStatus",task:i},Yt(i.status)){if(i.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:o},t,r)};else if(i.status==="failed")yield{type:"error",error:new A(j.InternalError,`Task ${o} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new A(j.InternalError,`Task ${o} was cancelled`)};return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},t,r)};return}let a=i.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((c)=>setTimeout(c,a)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof A?s:new A(j.InternalError,String(s))}}}request(e,t,r){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:i,relatedTask:a}=r??{};return new Promise((c,u)=>{let l=(v)=>{u(v)};if(!this._transport){l(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),i)this.assertTaskCapability(e.method)}catch(v){l(v);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:d};if(r?.onprogress)this._progressHandlers.set(d,r.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}};if(i)m.params={...m.params,task:i};if(a)m.params={...m.params,_meta:{...m.params?._meta||{},[Jt]:a}};let p=(v)=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(v)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((M)=>this._onerror(Error(`Failed to send cancellation: ${M}`)));let T=v instanceof A?v:new A(j.RequestTimeout,String(v));u(T)};this._responseHandlers.set(d,(v)=>{if(r?.signal?.aborted)return;if(v instanceof Error)return u(v);try{let T=Wt(t,v.result);if(!T.success)u(T.error);else c(T.data)}catch(T){u(T)}}),r?.signal?.addEventListener("abort",()=>{p(r?.signal?.reason)});let f=r?.timeout??vS,h=()=>p(A.fromError(j.RequestTimeout,"Request timed out",{timeout:f}));this._setupTimeout(d,f,r?.maxTotalTimeout,h,r?.resetTimeoutOnProgress??!1);let g=a?.taskId;if(g){let v=(T)=>{let M=this._responseHandlers.get(d);if(M)M(T);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,v),this._enqueueTaskMessage(g,{type:"request",message:m,timestamp:Date.now()}).catch((T)=>{this._cleanupTimeout(d),u(T)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((v)=>{this._cleanupTimeout(d),u(v)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Ps,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Rs,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Vm,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Jt]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.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 i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Jt]:t.relatedTask}}};this._transport?.send(i,t).catch((a)=>this._onerror(a))});return}let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Jt]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=sl(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(n,o)=>{let s=il(e,n);return Promise.resolve(t(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=sl(e);this._notificationHandlers.set(r,(n)=>{let o=il(e,n);return Promise.resolve(t(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r??this._transport?.sessionId,n)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let n of r)if(n.type==="request"&&Ru(n.message)){let o=n.message.id,s=this._requestResolvers.get(o);if(s)s(new A(j.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o);else this._onerror(Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t,r){let n=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e,r);if(o?.pollInterval)n=o.pollInterval}catch{}return new Promise((o,s)=>{if(t.aborted){s(new A(j.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);t.addEventListener("abort",()=>{clearTimeout(i),s(new A(j.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(n)=>{if(!e)throw Error("No request provided");return await r.createTask(n,e.id,{method:e.method,params:e.params},t)},getTask:async(n)=>{let o=await r.getTask(n,t);if(!o)throw new A(j.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(n,o,s)=>{await r.storeTaskResult(n,o,s,t);let i=await r.getTask(n,t);if(i){let a=eo.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),Yt(i.status))this._cleanupTaskProgressHandler(n)}},getTaskResult:(n)=>r.getTaskResult(n,t),updateTaskStatus:async(n,o,s)=>{let i=await r.getTask(n,t);if(!i)throw new A(j.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(Yt(i.status))throw new A(j.InvalidParams,`Cannot update task "${n}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(n,o,s,t);let a=await r.getTask(n,t);if(a){let c=eo.parse({method:"notifications/tasks/status",params:a});if(await this.notification(c),Yt(a.status))this._cleanupTaskProgressHandler(n)}},listTasks:(n)=>r.listTasks(n,t)}}}function Lh(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Fh(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];if(Lh(i)&&Lh(s))r[o]={...i,...s};else r[o]=s}return r}var tb=hd(Wl(),1),rb=hd(eb(),1);function f1(){let e=new tb.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return rb.default(e),e}class sd{constructor(e){this._ajv=e??f1()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class id{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw 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],s=o.some((u)=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some((u)=>u.type==="tool_use");if(s){if(o.some((u)=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!c)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.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 Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},no,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let o=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Br,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function nb(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function ob(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class ad extends al{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(ro.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let o=this._loggingLevels.get(n);return o?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new sd,this.setRequestHandler(Au,(r)=>this._oninitialize(r)),this.setNotificationHandler(Cu,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(Lu,async(r,n)=>{let o=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=ro.safeParse(s);if(i.success)this._loggingLevels.set(o,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new id(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Fh(this._capabilities,e)}setRequestHandler(e,t){let n=Xt(e)?.method;if(!n)throw Error("Schema is missing a method literal");let o=en(n);if(typeof o!=="string")throw Error("Schema method literal must be a string");if(o==="tools/call"){let i=async(a,c)=>{let u=Wt(Hr,a);if(!u.success){let p=u.error instanceof Error?u.error.message:String(u.error);throw new A(j.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:l}=u.data,d=await Promise.resolve(t(a,c));if(l.task){let p=Wt(Ur,d);if(!p.success){let f=p.error instanceof Error?p.error.message:String(p.error);throw new A(j.InvalidParams,`Invalid task creation result: ${f}`)}return p.data}let m=Wt(Ms,d);if(!m.success){let p=m.error instanceof Error?m.error.message:String(m.error);throw new A(j.InvalidParams,`Invalid tools/call result: ${p}`)}return m.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw 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 Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw 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 Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw 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 Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){ob(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;nb(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Cm.includes(t)?t:Eu,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"},$s)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],n=Array.isArray(r.content)?r.content:[r.content],o=n.some((c)=>c.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],a=i.some((c)=>c.type==="tool_use");if(o){if(n.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let c=new Set(i.filter((l)=>l.type==="tool_use").map((l)=>l.id)),u=new Set(n.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(c.size!==u.size||![...c].every((l)=>u.has(l)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},Fu,t);return this.request({method:"sampling/createMessage",params:e},no,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},Br,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:n},Br,t);if(o.action==="accept"&&o.content&&n.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!i.valid)throw new A(j.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof A)throw s;throw new A(j.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},Uu,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))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 ib=Symbol.for("mcp.completable");function cd(e){return!!e&&typeof e==="object"&&ib in e}function ab(e){return e[ib]?.complete}var sb;(function(e){e.Completable="McpCompletable"})(sb||(sb={}));var m1=/^[A-Za-z0-9._-]{1,128}$/;function h1(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!m1.test(e)){let r=e.split("").filter((n)=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,s)=>s.indexOf(n)===o);return t.push(`Tool name contains invalid characters: ${r.map((n)=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function g1(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function ud(e){let t=h1(e);return g1(e,t.warnings),t.isValid}class ld{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let n={taskSupport:"required",...t.execution};if(n.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,n,t._meta,r)}}function _1(e,t){let r=0,n=[e];while(n.length>0){let o=n.pop();if(o===null||typeof o!=="object")continue;if(Array.isArray(o))for(let s of o){if(++r>t)return r;if(s!==null&&typeof s==="object")n.push(s)}else for(let s in o){if(!Object.prototype.hasOwnProperty.call(o,s))continue;if(++r>t)return r;let i=o[s];if(i!==null&&typeof i==="object")n.push(i)}}return r}function y1(e){if(e===void 0||e===1/0)return;if(typeof e!=="number"||Number.isNaN(e)||e<1)throw RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(e)}`);return e}class pd{constructor(e,t){if(this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new ad(e,t),this._maxToolInputElements=y1(t?.maxToolInputElements),t?.capabilities?.tools)this.setToolRequestHandlers();if(t?.capabilities?.resources)this.setResourceRequestHandlers();if(t?.capabilities?.prompts)this.setPromptRequestHandlers()}get experimental(){if(!this._experimental)this._experimental={tasks:new ld(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(yr(Zs)),this.server.assertCanSetRequestHandler(yr(Hr)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Zs,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let n=Qr(t.inputSchema);return n?ol(n,{strictUnions:!0,pipeStrategy:"input"}):v1})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let n=Qr(t.outputSchema);if(n)r.outputSchema=ol(n,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(Hr,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new A(j.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new A(j.InvalidParams,`Tool ${e.params.name} disabled`);let n=!!e.params.task,o=r.execution?.taskSupport,s="createTask"in r.handler;if((o==="required"||o==="optional")&&!s)throw new A(j.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!n)throw new A(j.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!n&&s)return await this.handleAutomaticTaskPolling(r,e,t);let i=await this.validateToolInput(r,e.params.arguments,e.params.name),a=await this.executeToolHandler(r,i,t);if(n)return a;return await this.validateToolOutput(r,a,e.params.name),a}catch(r){if(r instanceof A){if(r.code===j.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(this._maxToolInputElements!==void 0&&_1(t,this._maxToolInputElements)>this._maxToolInputElements)throw new A(j.InvalidParams,`Invalid arguments for tool ${r}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!e.inputSchema)return;let o=Qr(e.inputSchema)??e.inputSchema,s=await Gs(o,t??{});if(!s.success){let i="error"in s?s.error:"Unknown error",a=Ws(i);throw new A(j.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a}`)}return s.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new A(j.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let n=Qr(e.outputSchema),o=await Gs(n,t.structuredContent);if(!o.success){let s="error"in o?o.error:"Unknown error",i=Ws(s);throw new A(j.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${i}`)}}async executeToolHandler(e,t,r){let n=e.handler;if("createTask"in n){if(!r.taskStore)throw Error("No task store provided.");let s={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(n.createTask(t,s));else return await Promise.resolve(n.createTask(s))}if(e.inputSchema)return await Promise.resolve(n(t,r));else return await Promise.resolve(n(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(e,t.params.arguments,t.params.name),o=e.handler,s={...r,taskStore:r.taskStore},i=n?await Promise.resolve(o.createTask(n,s)):await Promise.resolve(o.createTask(s)),a=i.task.taskId,c=i.task,u=c.pollInterval??5000;while(c.status!=="completed"&&c.status!=="failed"&&c.status!=="cancelled"){await new Promise((d)=>setTimeout(d,u));let l=await r.taskStore.getTask(a);if(!l)throw new A(j.InternalError,`Task ${a} not found during polling`);c=l}return await r.taskStore.getTaskResult(a)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(yr(Ds)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Ds,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return Wm(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return Xm(e),this.handleResourceCompletion(e,e.params.ref);default:throw new A(j.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new A(j.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new A(j.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Ao;let o=Xt(r.argsSchema)?.[e.params.argument.name];if(!cd(o))return Ao;let s=ab(o);if(!s)return Ao;let i=await s(e.params.argument.value,e.params.context);return ub(i)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((s)=>s.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return Ao;throw new A(j.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=r.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return Ao;let o=await n(e.params.argument.value,e.params.context);return ub(o)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(yr(Is)),this.server.assertCanSetRequestHandler(yr(As)),this.server.assertCanSetRequestHandler(yr(Cs)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Is,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),n=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(t);for(let i of s.resources)n.push({...o.metadata,...i})}return{resources:[...r,...n]}}),this.server.setRequestHandler(As,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(Cs,async(e,t)=>{let r=new URL(e.params.uri),n=this._registeredResources[r.toString()];if(n){if(!n.enabled)throw new A(j.InvalidParams,`Resource ${r} disabled`);return n.readCallback(r,t)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(r.toString());if(s)return o.readCallback(r,s,t)}throw new A(j.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(yr(Ns)),this.server.assertCanSetRequestHandler(yr(js)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Ns,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?x1(t.argsSchema):void 0}))})),this.server.setRequestHandler(js,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new A(j.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new A(j.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let n=Qr(r.argsSchema),o=await Gs(n,e.params.arguments??{});if(!o.success){let a="error"in o?o.error:"Unknown error",c=Ws(a);throw new A(j.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${c}`)}let s=o.data,i=r.callback;return await Promise.resolve(i(s,t))}else{let n=r.callback;return await Promise.resolve(n(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let n;if(typeof r[0]==="object")n=r.shift();let o=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let s=this._createRegisteredResource(e,void 0,t,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,t,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,t,r,n){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,r.title,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,r.title,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,r,n,o){let s={name:e,title:t,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:(i)=>{if(typeof i.uri<"u"&&i.uri!==r){if(delete this._registeredResources[r],i.uri)this._registeredResources[i.uri]=s}if(typeof i.name<"u")s.name=i.name;if(typeof i.title<"u")s.title=i.title;if(typeof i.metadata<"u")s.metadata=i.metadata;if(typeof i.callback<"u")s.readCallback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,n,o){let s={resourceTemplate:r,title:t,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(c)=>{if(typeof c.name<"u"&&c.name!==e){if(delete this._registeredResourceTemplates[e],c.name)this._registeredResourceTemplates[c.name]=s}if(typeof c.title<"u")s.title=c.title;if(typeof c.template<"u")s.resourceTemplate=c.template;if(typeof c.metadata<"u")s.metadata=c.metadata;if(typeof c.callback<"u")s.readCallback=c.callback;if(typeof c.enabled<"u")s.enabled=c.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=r.uriTemplate.variableNames;if(Array.isArray(i)&&i.some((c)=>!!r.completeCallback(c)))this.setCompletionRequestHandler();return s}_createRegisteredPrompt(e,t,r,n,o){let s={title:t,description:r,argsSchema:n===void 0?void 0:Er(n),callback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(i)=>{if(typeof i.name<"u"&&i.name!==e){if(delete this._registeredPrompts[e],i.name)this._registeredPrompts[i.name]=s}if(typeof i.title<"u")s.title=i.title;if(typeof i.description<"u")s.description=i.description;if(typeof i.argsSchema<"u")s.argsSchema=Er(i.argsSchema);if(typeof i.callback<"u")s.callback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=s,n){if(Object.values(n).some((a)=>{let c=a instanceof ys?a._def?.innerType:a;return cd(c)}))this.setCompletionRequestHandler()}return s}_createRegisteredTool(e,t,r,n,o,s,i,a,c){ud(e);let u={title:t,description:r,inputSchema:cb(n),outputSchema:cb(o),annotations:s,execution:i,_meta:a,handler:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:(l)=>{if(typeof l.name<"u"&&l.name!==e){if(typeof l.name==="string")ud(l.name);if(delete this._registeredTools[e],l.name)this._registeredTools[l.name]=u}if(typeof l.title<"u")u.title=l.title;if(typeof l.description<"u")u.description=l.description;if(typeof l.paramsSchema<"u")u.inputSchema=Er(l.paramsSchema);if(typeof l.outputSchema<"u")u.outputSchema=Er(l.outputSchema);if(typeof l.callback<"u")u.handler=l.callback;if(typeof l.annotations<"u")u.annotations=l.annotations;if(typeof l._meta<"u")u._meta=l._meta;if(typeof l.enabled<"u")u.enabled=l.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,n,o,s;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let a=t[0];if(dd(a)){if(n=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!dd(t[0]))s=t.shift()}else if(typeof a==="object"&&a!==null){if(Object.values(a).some((c)=>typeof c==="object"&&c!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=t.shift()}}let i=t[0];return this._createRegisteredTool(e,void 0,r,n,o,s,{taskSupport:"forbidden"},void 0,i)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:n,description:o,inputSchema:s,outputSchema:i,annotations:a,_meta:c}=t;return this._createRegisteredTool(e,n,o,s,i,a,{taskSupport:"forbidden"},c,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let n;if(t.length>1)n=t.shift();let o=t[0],s=this._createRegisteredPrompt(e,void 0,r,n,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:n,description:o,argsSchema:s}=t,i=this._createRegisteredPrompt(e,n,o,s,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var v1={type:"object",properties:{}};function lb(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function db(e){return"_def"in e||"_zod"in e||lb(e)}function dd(e){if(typeof e!=="object"||e===null)return!1;if(db(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(lb)}function cb(e){if(!e)return;if(dd(e))return Er(e);if(!db(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function x1(e){let t=Xt(e);if(!t)return[];return Object.entries(t).map(([r,n])=>{let o=ah(n),s=ch(n);return{name:r,description:o,required:!s}})}function yr(e){let r=Xt(e)?.method;if(!r)throw Error("Schema is missing a method literal");let n=en(r);if(typeof n==="string")return n;throw Error("Schema method literal must be a string")}function ub(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Ao={completion:{values:[],hasMore:!1}};var pb=["Actions","Forms","Navigation","Overlays","Feedback","Display","Charts","Layout","Appearance","Media","Utilities","Server"];function Hi(e){return Object.entries(e).toSorted(([t],[r])=>t.localeCompare(r)).map(([t,[r,n]])=>({slug:t,name:t.charAt(0).toUpperCase()+t.slice(1).replaceAll("-"," "),description:n,category:r}))}var fb={blocks:{label:"Blocks",description:"App-level pieces the apps shared copies of.",docs:Hi({"accent-toggle":["Appearance","The accent presets: a swatch strip on desktop, labelled rows on phones."],"auth-shell":["Layout","Centered sign-in layout: heading, optional brand and footer."],"bottom-nav":["Navigation","The phone tab bar: top-level destinations, the current one lit."],"command-palette":["Overlays","A ⌘K search over pages and actions: a dialog on desktop, a tall drawer on phones."],"copy-field":["Forms","Monospace value with a copy button and a promise toast."],"document-title":["Layout","The tab's <title> from the page title, suffixed with the app."],"empty-state":["Feedback","Icon, title, subtitle and an action for an empty list."],"error-page":["Layout","Status, message and error id, with a link back home."],fab:["Actions","Floating action button above the phone tab bar, with a haptic tap."],"icon-button":["Actions","Round icon button whose tooltip is its accessible name."],"install-prompt":["Overlays","One-time PWA install sheet: native prompt or the steps."],"music-player":["Media","An audio player bar with a queue: play, skip, seek and volume."],"nav-cards":["Navigation","Phone-only list of a section's tabs as cards."],"new-password-fields":["Forms","New password with a reveal button, a strength meter and the rules it must pass."],"option-group":["Forms","Radio cards for a settings choice, each with an icon or swatch."],"otp-field":["Forms","A one-time code: digits only, autofilled from SMS, posted as one field."],"password-input":["Forms","A password field with a button to reveal what was typed."],"responsive-sheet":["Overlays","A dialog on desktop, a bottom drawer on phones."],"setting-switch":["Forms","Labelled switch row for settings forms."],"stat-card":["Display","Glass card with an icon, a value and a hint, optionally a link."],stepper:["Navigation","A multi-step flow: labelled markers on desktop, a progress bar and the current step on phones."],"tab-nav":["Navigation","Pill tab bar of links, the current page's tab highlighted."],"tab-section":["Navigation","Tabbed section layout: tabs on desktop, nav cards on phones."],"time-range-picker":["Charts","Time range presets, plus a custom range in a calendar popover or a phone drawer."],"time-series-chart":["Charts","Line, area or bar chart over time: axes, readout, touch scrubbing and a data table."],"theme-picker":["Appearance","System, light and dark as radio cards."],"theme-toggle":["Appearance","System, light and dark: an icon strip on desktop, three rows on phones."],"top-loading-bar":["Feedback","Progress bar during SvelteKit navigations."],"video-player":["Media","A video player: scrubbing, chapters, subtitles, speed, fullscreen, gestures and shortcuts."]})},components:{label:"Components",description:"One import, data in: the everyday controls without assembling primitives.",docs:Hi({"file-dropzone":["Forms","Drop or pick files, folders too: type and size limits, a list to review, posted with the form."],breadcrumbs:["Navigation","A trail of pages from an array, collapsing the middle into a menu on phones."],"confirm-dialog":["Overlays","Ask before acting: waits on an async confirm, a drawer on phones."],menu:["Overlays","Actions from an array: a dropdown on desktop, a drawer of big rows on phones."],pagination:["Navigation","Page numbers from a total and a page size, prev and next on phones."],tabs:["Navigation","Tabs from an array, scrolling sideways when they run out of room."],form:["Forms","Fields from an array, laid out and posted to a form action, with errors under each field."],checkbox:["Forms","One checkbox with its label and description, the whole row tappable."],"checkbox-list":["Forms","Options in, a labelled group of checkboxes out, posting every checked value."],"radio-list":["Forms","Pick one option from a list or from cards, with a legend and errors."],"segmented-control":["Forms","A single choice as equal segments that fold to icons when space runs out."],switch:["Forms","A labelled switch row that posts true when on."],accordion:["Display","Questions and answers from an array: plain text or a snippet per item."],"avatar-group":["Display","Overlapping avatars with initials, a +N count and names in tooltips."],"bar-list":["Charts","A ranked list with proportional bars, links and a show-more toggle."],"data-table":["Display","Columns and rows in, a sortable table out: cards on phones, links per row."],"date-field":["Forms","A date with its label: calendar in a popover, a drawer on phones, ISO value."],select:["Forms","Options in, a labelled select out: searchable, and a drawer on phones."],"status-badge":["Feedback","A status pill with a tone, a dot and an optional pulse for live states."],textarea:["Forms","A multi-line field with its label, error and an optional character counter."],input:["Forms","A text field with its label, description and error in one: passwords get a reveal button."]})},primitives:{label:"Primitives",description:"The shadcn-svelte components, as the apps customised them.",docs:Hi({accordion:["Display","Stacked sections that expand one or several at a time."],alert:["Feedback","A callout for something the reader should notice."],"alert-dialog":["Overlays","A modal that asks to confirm before something drastic."],avatar:["Display","A user's picture, falling back to initials."],badge:["Display","A small label for a status or a count."],breadcrumb:["Navigation","The path from the root to the current page."],button:["Actions","Every button variant and size."],"button-group":["Actions","Buttons joined into one control."],calendar:["Forms","A month grid to pick a date."],card:["Display","A surface with a header, content and footer."],checkbox:["Forms","A checkbox, with a label through Field."],command:["Overlays","A searchable list of commands, also as a palette."],"context-menu":["Overlays","A menu on right click or long press."],dialog:["Overlays","A modal window over the page."],drawer:["Overlays","A panel sliding up from the bottom, made for phones."],"dropdown-menu":["Overlays","A menu opened from a button."],empty:["Feedback","The parts of an empty state, to compose your own."],field:["Forms","Label, control, description and error, laid out together."],input:["Forms","A text input; password managers stay off unless asked."],"input-group":["Forms","An input with addons: icons, text or buttons."],"input-otp":["Forms","One box per digit for a one-time code."],label:["Forms","A label for a form control."],menubar:["Navigation","A desktop-style bar of menus."],pagination:["Navigation","Links to the pages of a long list."],popover:["Overlays","Floating content anchored to a trigger."],progress:["Feedback","How far along something is."],"radio-group":["Forms","Pick one of a few options."],"range-calendar":["Forms","A month grid to pick a start and an end date."],resizable:["Layout","Panes split by a draggable handle."],"scroll-area":["Layout","A scrolling box with a styled scrollbar."],select:["Forms","Pick one option from a list."],separator:["Layout","A line between groups of content."],sheet:["Overlays","A panel sliding in from a side of the screen."],sidebar:["Navigation","The app sidebar: groups, menus, collapsing to icons."],skeleton:["Feedback","Placeholder shapes while content loads."],slider:["Forms","Pick a value or a range by dragging."],sonner:["Feedback","Toasts, styled by the theme."],spinner:["Feedback","An indeterminate loading indicator."],switch:["Forms","An on or off toggle."],table:["Display","Rows and columns of data."],tabs:["Navigation","In-page tabs that switch panels without navigating."],textarea:["Forms","A multi-line text input."],toggle:["Actions","A button that stays pressed."],"toggle-group":["Actions","Toggles where one or several stay pressed."],tooltip:["Overlays","A hint on hover or focus."]})},modules:{label:"Modules",description:"Helpers for toasts, titles, appearance and haptics, and the server side: logs, traces and hooks.",docs:Hi({hooks:["Server","SvelteKit hooks: one log line per request, and unexpected errors logged, traced and given an id."],logger:["Server","Scoped server logs as coloured text or JSON lines that carry the active trace id."],telemetry:["Server","OpenTelemetry tracing over OTLP, with SvelteKit's own handle, load and action spans."],appearance:["Appearance","Apply a saved accent, theme, font and corners to <html>."],haptics:["Feedback","A short vibration on tap, success or error."],"page-title":["Layout","One page title for the app bar, the header and the tab."],password:["Forms","The password rules and strength score, for the form and the server alike."],toast:["Feedback","Narrate a form action through one promise toast."],utils:["Utilities","cn to merge Tailwind classes, and the prop helper types."]})}};function Bi(){return Object.entries(fb).flatMap(([e,{docs:t}])=>t.map((r)=>({group:e,doc:r})))}function hb(e){let[t,r]=e.includes("/")?e.split("/",2):[void 0,e];return Bi().find((n)=>n.doc.slug===r&&(!t||n.group===t))}function b1(e,t){return e==="components"?`examples/components/${t}`:`examples/${t}`}function $1(e,t){if(e==="blocks"||e==="components")return`${e}/${t}`;return w1.has(t)?`server/${t}`:t}var w1=new Set(["hooks","logger","telemetry"]);function gb(e){let t=e.toLowerCase().split(/\s+/).filter(Boolean);return Bi().filter(({doc:r})=>{let n=`${r.slug} ${r.category} ${r.description}`.toLowerCase();return t.every((o)=>n.includes(o))})}function k1(e,t,r){let n=Object.entries(e.files);if(r==="tab-section")return n.filter(([a])=>a.startsWith("routes/section/")).map(([a,c])=>({name:a.slice(7),code:mb(c)}));let o=b1(t,r),s=e.files[`${o}.svelte`],i=n.flatMap(([a,c])=>a.startsWith(`${o}.`)&&a!==`${o}.svelte`?[{name:a.slice(`${o}.`.length),code:c}]:[]);if(s?.includes("<script"))i.unshift({name:"Example.svelte",code:s});return i.map(({name:a,code:c})=>({name:a,code:mb(c)}))}function mb(e){return e.replaceAll(/#lib\/components\/ui\/([\w-]+)\/index\.js/g,"@orochibraru/ui/$1").replaceAll(/#lib\/components\/blocks\/([\w-]+)\.svelte/g,"@orochibraru/ui/blocks/$1").replaceAll(/#lib\/components\/kit\/([\w-]+)\.svelte/g,"@orochibraru/ui/components/$1").replaceAll(/#lib\/((?:server\/)?[\w-]+)(?:\.svelte)?\.js/g,"@orochibraru/ui/$1")}function _b(e,{group:t,doc:r}){let n=$1(t,r.slug),o=k1(e,t,r.slug).map((s)=>`### ${s.name}
|
|
73
73
|
|
|
74
74
|
\`\`\`${s.name.endsWith(".ts")?"ts":"svelte"}
|
|
75
75
|
${s.code.trimEnd()}
|
|
@@ -80,4 +80,4 @@ ${o.join(`
|
|
|
80
80
|
`)}`:""].filter(Boolean).join(`
|
|
81
81
|
|
|
82
82
|
`)}function yb(e){return e.map(({group:t,doc:r})=>`${t}/${r.slug} (${r.category}): ${r.description}`).join(`
|
|
83
|
-
`)}function Co(e){return{content:[{type:"text",text:e}]}}function vb(e){let t=new
|
|
83
|
+
`)}function Co(e){return{content:[{type:"text",text:e}]}}function vb(e){let t=new pd({name:"orochibraru-ui",version:e.version},{instructions:"Docs for @orochibraru/ui, the Svelte 5 components and theme shared by the orochibraru apps. Start with get_setup to install it, list_components or search_components to find one, then get_component for its usage code."});return t.registerTool("get_setup",{description:"How to install @orochibraru/ui, import the theme, theme an app and use the blocks and modules.",annotations:{readOnlyHint:!0}},()=>Co(e.readme)),t.registerTool("list_components",{description:"Every block, primitive and module, one per line as group/slug (category): description.",inputSchema:{group:Ae(["blocks","components","primitives","modules"]).optional().describe("Only this group."),category:Ae(pb).optional().describe("Only this category.")},annotations:{readOnlyHint:!0}},({group:r,category:n})=>Co(yb(Bi().filter((o)=>(!r||o.group===r)&&(!n||o.doc.category===n))))),t.registerTool("search_components",{description:"Find components whose slug, category or description contains every word of the query.",inputSchema:{query:_().min(1).describe("Words to look for.")},annotations:{readOnlyHint:!0}},({query:r})=>{let n=gb(r);return Co(n.length>0?yb(n):"No component matches.")}),t.registerTool("get_component",{description:"One component's docs: what it is, its import path and its usage code.",inputSchema:{slug:_().describe("The component as group/slug from list_components, like components/select, or a slug that only one group has.")},annotations:{readOnlyHint:!0}},({slug:r})=>{let n=hb(r);return n?Co(_b(e,n)):{...Co(`No component "${r}". Call list_components for the slugs.`),isError:!0}}),t}var z1=JSON.parse(S1(new URL("./mcp-content.json",import.meta.url),"utf8"));await vb(z1).connect(new Hu);
|