@sleep2agi/agent-node 0.3.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +12 -115
- package/package.json +5 -28
- package/dist/cli.d.ts +0 -9
- package/dist/index.d.ts +0 -38
- package/dist/index.js +0 -92
package/dist/cli.js
CHANGED
|
@@ -1,128 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as l8}from"module";import{fileURLToPath as S8}from"url";import{setMaxListeners as T8}from"events";import{spawn as f8}from"child_process";import{createInterface as x8}from"readline";import{homedir as ip}from"os";import{join as hp}from"path";import{randomUUID as $p}from"crypto";import{appendFile as tE,mkdir as eE}from"fs/promises";import{join as oh}from"path";import{realpathSync as yh}from"fs";import{cwd as sE}from"process";import{randomUUID as fc}from"crypto";import{appendFile as dE,mkdir as oE,symlink as yE,unlink as mE}from"fs/promises";import{dirname as Rc,join as Ic}from"path";import*as ct from"fs";import{mkdir as kE,open as fE,readdir as xE,readFile as ph,rename as RE,rmdir as IE,rm as vE,stat as CE,unlink as AE}from"fs/promises";import{execFile as GE}from"child_process";import{promisify as WE}from"util";var cy=Object.create,{getPrototypeOf:dy,defineProperty:B3,getOwnPropertyNames:oy}=Object,yy=Object.prototype.hasOwnProperty;function my(t){return this[t]}var py,Ey,Dh=(t,e,s)=>{var r=t!=null&&typeof t==="object";if(r){var a=e?py??=new WeakMap:Ey??=new WeakMap,n=a.get(t);if(n)return n}s=t!=null?cy(dy(t)):{};let i=e||!t||!t.__esModule?B3(s,"default",{value:t,enumerable:!0}):s;for(let h of oy(t))if(!yy.call(i,h))B3(i,h,{get:my.bind(t,h),enumerable:!0});if(r)a.set(t,i);return i},W=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),uy=(t)=>t;function ly(t,e){this[t]=uy.bind(null,e)}var me=(t,e)=>{for(var s in e)B3(t,s,{get:e[s],enumerable:!0,configurable:!0,set:ly.bind(e,s)})},Sy=Symbol.dispose||Symbol.for("Symbol.dispose"),Ty=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),Lt=(t,e,s)=>{if(e!=null){if(typeof e!=="object"&&typeof e!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var r;if(s)r=e[Ty];if(r===void 0)r=e[Sy];if(typeof r!=="function")throw TypeError("Object not disposable");t.push([s,r,e])}else if(s)t.push([s]);return e},jt=(t,e,s)=>{var r=typeof SuppressedError==="function"?SuppressedError:function(i,h,c,d){return d=Error(c),d.name="SuppressedError",d.error=i,d.suppressed=h,d},a=(i)=>e=s?new r(i,e,"An error was suppressed during disposal"):(s=!0,i),n=(i)=>{while(i=t.pop())try{var h=i[1]&&i[1].call(i[2]);if(i[0])return Promise.resolve(h).then(n,(c)=>(a(c),n()))}catch(c){a(c)}if(s)throw e};return n()},ks=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends e{constructor(o){super();if(!t.IDENTIFIER.test(o))throw Error("CodeGen: name must be a valid identifier");this.str=o}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=s;class r extends e{constructor(o){super();this._items=typeof o==="string"?[o]:o}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let o=this._items[0];return o===""||o==='""'}get str(){var o;return(o=this._str)!==null&&o!==void 0?o:this._str=this._items.reduce((u,y)=>`${u}${y}`,"")}get names(){var o;return(o=this._names)!==null&&o!==void 0?o:this._names=this._items.reduce((u,y)=>{if(y instanceof s)u[y.str]=(u[y.str]||0)+1;return u},{})}}t._Code=r,t.nil=new r("");function a(o,...u){let y=[o[0]],m=0;while(m<u.length)h(y,u[m]),y.push(o[++m]);return new r(y)}t._=a;var n=new r("+");function i(o,...u){let y=[f(o[0])],m=0;while(m<u.length)y.push(n),h(y,u[m]),y.push(n,f(o[++m]));return c(y),new r(y)}t.str=i;function h(o,u){if(u instanceof r)o.push(...u._items);else if(u instanceof s)o.push(u);else o.push(l(u))}t.addCodeArg=h;function c(o){let u=1;while(u<o.length-1){if(o[u]===n){let y=d(o[u-1],o[u+1]);if(y!==void 0){o.splice(u-1,3,y);continue}o[u++]="+"}u++}}function d(o,u){if(u==='""')return o;if(o==='""')return u;if(typeof o=="string"){if(u instanceof s||o[o.length-1]!=='"')return;if(typeof u!="string")return`${o.slice(0,-1)}${u}"`;if(u[0]==='"')return o.slice(0,-1)+u.slice(1);return}if(typeof u=="string"&&u[0]==='"'&&!(o instanceof s))return`"${o}${u.slice(1)}`;return}function E(o,u){return u.emptyStr()?o:o.emptyStr()?u:i`${o}${u}`}t.strConcat=E;function l(o){return typeof o=="number"||typeof o=="boolean"||o===null?o:f(Array.isArray(o)?o.join(","):o)}function p(o){return new r(f(o))}t.stringify=p;function f(o){return JSON.stringify(o).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=f;function I(o){return typeof o=="string"&&t.IDENTIFIER.test(o)?new r(`.${o}`):a`[${o}]`}t.getProperty=I;function v(o){if(typeof o=="string"&&t.IDENTIFIER.test(o))return new r(`${o}`);throw Error(`CodeGen: invalid export name: ${o}, use explicit $id name mapping`)}t.getEsmExportName=v;function x(o){return new r(o.toString())}t.regexpCode=x}),Mi=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;var e=ks();class s extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`);this.value=c.value}}var r;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(r||(t.UsedValueState=r={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class a{constructor({prefixes:c,parent:d}={}){this._names={},this._prefixes=c,this._parent=d}toName(c){return c instanceof e.Name?c:this.name(c)}name(c){return new e.Name(this._newName(c))}_newName(c){let d=this._names[c]||this._nameGroup(c);return`${c}${d.index++}`}_nameGroup(c){var d,E;if(((E=(d=this._parent)===null||d===void 0?void 0:d._prefixes)===null||E===void 0?void 0:E.has(c))||this._prefixes&&!this._prefixes.has(c))throw Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}}t.Scope=a;class n extends e.Name{constructor(c,d){super(d);this.prefix=c}setValue(c,{property:d,itemIndex:E}){this.value=c,this.scopePath=e._`.${new e.Name(d)}[${E}]`}}t.ValueScopeName=n;var i=e._`\n`;class h extends a{constructor(c){super(c);this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?i:e.nil}}get(){return this._scope}name(c){return new n(c,this._newName(c))}value(c,d){var E;if(d.ref===void 0)throw Error("CodeGen: ref must be passed in value");let l=this.toName(c),{prefix:p}=l,f=(E=d.key)!==null&&E!==void 0?E:d.ref,I=this._values[p];if(I){let o=I.get(f);if(o)return o}else I=this._values[p]=new Map;I.set(f,l);let v=this._scope[p]||(this._scope[p]=[]),x=v.length;return v[x]=d.ref,l.setValue(d,{property:p,itemIndex:x}),l}getValue(c,d){let E=this._values[c];if(!E)return;return E.get(d)}scopeRefs(c,d=this._values){return this._reduceValues(d,(E)=>{if(E.scopePath===void 0)throw Error(`CodeGen: name "${E}" has no value`);return e._`${c}${E.scopePath}`})}scopeCode(c=this._values,d,E){return this._reduceValues(c,(l)=>{if(l.value===void 0)throw Error(`CodeGen: name "${l}" has no value`);return l.value.code},d,E)}_reduceValues(c,d,E={},l){let p=e.nil;for(let f in c){let I=c[f];if(!I)continue;let v=E[f]=E[f]||new Map;I.forEach((x)=>{if(v.has(x))return;v.set(x,r.Started);let o=d(x);if(o){let u=this.opts.es5?t.varKinds.var:t.varKinds.const;p=e._`${p}${u} ${x} = ${o};${this.opts._n}`}else if(o=l===null||l===void 0?void 0:l(x))p=e._`${p}${o}${this.opts._n}`;else throw new s(x);v.set(x,r.Completed)})}return p}}t.ValueScope=h}),pt=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;var e=ks(),s=Mi(),r=ks();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}});var a=Mi();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return a.varKinds}}),t.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 n{optimizeNodes(){return this}optimizeNames(S,b){return this}}class i extends n{constructor(S,b,P){super();this.varKind=S,this.name=b,this.rhs=P}render({es5:S,_n:b}){let P=S?s.varKinds.var:this.varKind,X=this.rhs===void 0?"":` = ${this.rhs}`;return`${P} ${this.name}${X};`+b}optimizeNames(S,b){if(!S[this.name.str])return;if(this.rhs)this.rhs=z(this.rhs,S,b);return this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class h extends n{constructor(S,b,P){super();this.lhs=S,this.rhs=b,this.sideEffects=P}render({_n:S}){return`${this.lhs} = ${this.rhs};`+S}optimizeNames(S,b){if(this.lhs instanceof e.Name&&!S[this.lhs.str]&&!this.sideEffects)return;return this.rhs=z(this.rhs,S,b),this}get names(){let S=this.lhs instanceof e.Name?{}:{...this.lhs.names};return O(S,this.rhs)}}class c extends h{constructor(S,b,P,X){super(S,P,X);this.op=b}render({_n:S}){return`${this.lhs} ${this.op}= ${this.rhs};`+S}}class d extends n{constructor(S){super();this.label=S,this.names={}}render({_n:S}){return`${this.label}:`+S}}class E extends n{constructor(S){super();this.label=S,this.names={}}render({_n:S}){return`break${this.label?` ${this.label}`:""};`+S}}class l extends n{constructor(S){super();this.error=S}render({_n:S}){return`throw ${this.error};`+S}get names(){return this.error.names}}class p extends n{constructor(S){super();this.code=S}render({_n:S}){return`${this.code};`+S}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(S,b){return this.code=z(this.code,S,b),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class f extends n{constructor(S=[]){super();this.nodes=S}render(S){return this.nodes.reduce((b,P)=>b+P.render(S),"")}optimizeNodes(){let{nodes:S}=this,b=S.length;while(b--){let P=S[b].optimizeNodes();if(Array.isArray(P))S.splice(b,1,...P);else if(P)S[b]=P;else S.splice(b,1)}return S.length>0?this:void 0}optimizeNames(S,b){let{nodes:P}=this,X=P.length;while(X--){let at=P[X];if(at.optimizeNames(S,b))continue;K(S,at.names),P.splice(X,1)}return P.length>0?this:void 0}get names(){return this.nodes.reduce((S,b)=>N(S,b.names),{})}}class I extends f{render(S){return"{"+S._n+super.render(S)+"}"+S._n}}class v extends f{}class x extends I{}x.kind="else";class o extends I{constructor(S,b){super(b);this.condition=S}render(S){let b=`if(${this.condition})`+super.render(S);if(this.else)b+="else "+this.else.render(S);return b}optimizeNodes(){super.optimizeNodes();let S=this.condition;if(S===!0)return this.nodes;let b=this.else;if(b){let P=b.optimizeNodes();b=this.else=Array.isArray(P)?new x(P):P}if(b){if(S===!1)return b instanceof o?b:b.nodes;if(this.nodes.length)return this;return new o(Mt(S),b instanceof o?[b]:b.nodes)}if(S===!1||!this.nodes.length)return;return this}optimizeNames(S,b){var P;if(this.else=(P=this.else)===null||P===void 0?void 0:P.optimizeNames(S,b),!(super.optimizeNames(S,b)||this.else))return;return this.condition=z(this.condition,S,b),this}get names(){let S=super.names;if(O(S,this.condition),this.else)N(S,this.else.names);return S}}o.kind="if";class u extends I{}u.kind="for";class y extends u{constructor(S){super();this.iteration=S}render(S){return`for(${this.iteration})`+super.render(S)}optimizeNames(S,b){if(!super.optimizeNames(S,b))return;return this.iteration=z(this.iteration,S,b),this}get names(){return N(super.names,this.iteration.names)}}class m extends u{constructor(S,b,P,X){super();this.varKind=S,this.name=b,this.from=P,this.to=X}render(S){let b=S.es5?s.varKinds.var:this.varKind,{name:P,from:X,to:at}=this;return`for(${b} ${P}=${X}; ${P}<${at}; ${P}++)`+super.render(S)}get names(){let S=O(super.names,this.from);return O(S,this.to)}}class k extends u{constructor(S,b,P,X){super();this.loop=S,this.varKind=b,this.name=P,this.iterable=X}render(S){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(S)}optimizeNames(S,b){if(!super.optimizeNames(S,b))return;return this.iterable=z(this.iterable,S,b),this}get names(){return N(super.names,this.iterable.names)}}class T extends I{constructor(S,b,P){super();this.name=S,this.args=b,this.async=P}render(S){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(S)}}T.kind="func";class R extends f{render(S){return"return "+super.render(S)}}R.kind="return";class C extends I{render(S){let b="try"+super.render(S);if(this.catch)b+=this.catch.render(S);if(this.finally)b+=this.finally.render(S);return b}optimizeNodes(){var S,b;return super.optimizeNodes(),(S=this.catch)===null||S===void 0||S.optimizeNodes(),(b=this.finally)===null||b===void 0||b.optimizeNodes(),this}optimizeNames(S,b){var P,X;return super.optimizeNames(S,b),(P=this.catch)===null||P===void 0||P.optimizeNames(S,b),(X=this.finally)===null||X===void 0||X.optimizeNames(S,b),this}get names(){let S=super.names;if(this.catch)N(S,this.catch.names);if(this.finally)N(S,this.finally.names);return S}}class F extends I{constructor(S){super();this.error=S}render(S){return`catch(${this.error})`+super.render(S)}}F.kind="catch";class B extends I{render(S){return"finally"+super.render(S)}}B.kind="finally";class _{constructor(S,b={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...b,_n:b.lines?`
|
|
3
|
-
`:""},this._extScope=S,this._scope=new s.Scope({parent:S}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(S){return this._scope.name(S)}scopeName(S){return this._extScope.name(S)}scopeValue(S,b){let P=this._extScope.value(S,b);return(this._values[P.prefix]||(this._values[P.prefix]=new Set)).add(P),P}getScopeValue(S,b){return this._extScope.getValue(S,b)}scopeRefs(S){return this._extScope.scopeRefs(S,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(S,b,P,X){let at=this._scope.toName(b);if(P!==void 0&&X)this._constants[at.str]=P;return this._leafNode(new i(S,at,P)),at}const(S,b,P){return this._def(s.varKinds.const,S,b,P)}let(S,b,P){return this._def(s.varKinds.let,S,b,P)}var(S,b,P){return this._def(s.varKinds.var,S,b,P)}assign(S,b,P){return this._leafNode(new h(S,b,P))}add(S,b){return this._leafNode(new c(S,t.operators.ADD,b))}code(S){if(typeof S=="function")S();else if(S!==e.nil)this._leafNode(new p(S));return this}object(...S){let b=["{"];for(let[P,X]of S){if(b.length>1)b.push(",");if(b.push(P),P!==X||this.opts.es5)b.push(":"),(0,e.addCodeArg)(b,X)}return b.push("}"),new e._Code(b)}if(S,b,P){if(this._blockNode(new o(S)),b&&P)this.code(b).else().code(P).endIf();else if(b)this.code(b).endIf();else if(P)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(S){return this._elseNode(new o(S))}else(){return this._elseNode(new x)}endIf(){return this._endBlockNode(o,x)}_for(S,b){if(this._blockNode(S),b)this.code(b).endFor();return this}for(S,b){return this._for(new y(S),b)}forRange(S,b,P,X,at=this.opts.es5?s.varKinds.var:s.varKinds.let){let lt=this._scope.toName(S);return this._for(new m(at,lt,b,P),()=>X(lt))}forOf(S,b,P,X=s.varKinds.const){let at=this._scope.toName(S);if(this.opts.es5){let lt=b instanceof e.Name?b:this.var("_arr",b);return this.forRange("_i",0,e._`${lt}.length`,(rt)=>{this.var(at,e._`${lt}[${rt}]`),P(at)})}return this._for(new k("of",X,at,b),()=>P(at))}forIn(S,b,P,X=this.opts.es5?s.varKinds.var:s.varKinds.const){if(this.opts.ownProperties)return this.forOf(S,e._`Object.keys(${b})`,P);let at=this._scope.toName(S);return this._for(new k("in",X,at,b),()=>P(at))}endFor(){return this._endBlockNode(u)}label(S){return this._leafNode(new d(S))}break(S){return this._leafNode(new E(S))}return(S){let b=new R;if(this._blockNode(b),this.code(S),b.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(R)}try(S,b,P){if(!b&&!P)throw Error('CodeGen: "try" without "catch" and "finally"');let X=new C;if(this._blockNode(X),this.code(S),b){let at=this.name("e");this._currNode=X.catch=new F(at),b(at)}if(P)this._currNode=X.finally=new B,this.code(P);return this._endBlockNode(F,B)}throw(S){return this._leafNode(new l(S))}block(S,b){if(this._blockStarts.push(this._nodes.length),S)this.code(S).endBlock(b);return this}endBlock(S){let b=this._blockStarts.pop();if(b===void 0)throw Error("CodeGen: not in self-balancing block");let P=this._nodes.length-b;if(P<0||S!==void 0&&P!==S)throw Error(`CodeGen: wrong number of nodes: ${P} vs ${S} expected`);return this._nodes.length=b,this}func(S,b=e.nil,P,X){if(this._blockNode(new T(S,b,P)),X)this.code(X).endFunc();return this}endFunc(){return this._endBlockNode(T)}optimize(S=1){while(S-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(S){return this._currNode.nodes.push(S),this}_blockNode(S){this._currNode.nodes.push(S),this._nodes.push(S)}_endBlockNode(S,b){let P=this._currNode;if(P instanceof S||b&&P instanceof b)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${b?`${S.kind}/${b.kind}`:S.kind}"`)}_elseNode(S){let b=this._currNode;if(!(b instanceof o))throw Error('CodeGen: "else" without "if"');return this._currNode=b.else=S,this}get _root(){return this._nodes[0]}get _currNode(){let S=this._nodes;return S[S.length-1]}set _currNode(S){let b=this._nodes;b[b.length-1]=S}}t.CodeGen=_;function N(S,b){for(let P in b)S[P]=(S[P]||0)+(b[P]||0);return S}function O(S,b){return b instanceof e._CodeOrName?N(S,b.names):S}function z(S,b,P){if(S instanceof e.Name)return X(S);if(!at(S))return S;return new e._Code(S._items.reduce((lt,rt)=>{if(rt instanceof e.Name)rt=X(rt);if(rt instanceof e._Code)lt.push(...rt._items);else lt.push(rt);return lt},[]));function X(lt){let rt=P[lt.str];if(rt===void 0||b[lt.str]!==1)return lt;return delete b[lt.str],rt}function at(lt){return lt instanceof e._Code&<._items.some((rt)=>rt instanceof e.Name&&b[rt.str]===1&&P[rt.str]!==void 0)}}function K(S,b){for(let P in b)S[P]=(S[P]||0)-(b[P]||0)}function Mt(S){return typeof S=="boolean"||typeof S=="number"||S===null?!S:e._`!${V(S)}`}t.not=Mt;var Ot=L(t.operators.AND);function Ut(...S){return S.reduce(Ot)}t.and=Ut;var St=L(t.operators.OR);function Z(...S){return S.reduce(St)}t.or=Z;function L(S){return(b,P)=>b===e.nil?P:P===e.nil?b:e._`${V(b)} ${S} ${V(P)}`}function V(S){return S instanceof e.Name?S:e._`(${S})`}}),Rt=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;var e=pt(),s=ks();function r(T){let R={};for(let C of T)R[C]=!0;return R}t.toHash=r;function a(T,R){if(typeof R=="boolean")return R;if(Object.keys(R).length===0)return!0;return n(T,R),!i(R,T.self.RULES.all)}t.alwaysValidSchema=a;function n(T,R=T.schema){let{opts:C,self:F}=T;if(!C.strictSchema)return;if(typeof R==="boolean")return;let B=F.RULES.keywords;for(let _ in R)if(!B[_])k(T,`unknown keyword: "${_}"`)}t.checkUnknownRules=n;function i(T,R){if(typeof T=="boolean")return!T;for(let C in T)if(R[C])return!0;return!1}t.schemaHasRules=i;function h(T,R){if(typeof T=="boolean")return!T;for(let C in T)if(C!=="$ref"&&R.all[C])return!0;return!1}t.schemaHasRulesButRef=h;function c({topSchemaRef:T,schemaPath:R},C,F,B){if(!B){if(typeof C=="number"||typeof C=="boolean")return C;if(typeof C=="string")return e._`${C}`}return e._`${T}${R}${(0,e.getProperty)(F)}`}t.schemaRefOrVal=c;function d(T){return p(decodeURIComponent(T))}t.unescapeFragment=d;function E(T){return encodeURIComponent(l(T))}t.escapeFragment=E;function l(T){if(typeof T=="number")return`${T}`;return T.replace(/~/g,"~0").replace(/\//g,"~1")}t.escapeJsonPointer=l;function p(T){return T.replace(/~1/g,"/").replace(/~0/g,"~")}t.unescapeJsonPointer=p;function f(T,R){if(Array.isArray(T))for(let C of T)R(C);else R(T)}t.eachItem=f;function I({mergeNames:T,mergeToName:R,mergeValues:C,resultToName:F}){return(B,_,N,O)=>{let z=N===void 0?_:N instanceof e.Name?(_ instanceof e.Name?T(B,_,N):R(B,_,N),N):_ instanceof e.Name?(R(B,N,_),_):C(_,N);return O===e.Name&&!(z instanceof e.Name)?F(B,z):z}}t.mergeEvaluated={props:I({mergeNames:(T,R,C)=>T.if(e._`${C} !== true && ${R} !== undefined`,()=>{T.if(e._`${R} === true`,()=>T.assign(C,!0),()=>T.assign(C,e._`${C} || {}`).code(e._`Object.assign(${C}, ${R})`))}),mergeToName:(T,R,C)=>T.if(e._`${C} !== true`,()=>{if(R===!0)T.assign(C,!0);else T.assign(C,e._`${C} || {}`),x(T,C,R)}),mergeValues:(T,R)=>T===!0?!0:{...T,...R},resultToName:v}),items:I({mergeNames:(T,R,C)=>T.if(e._`${C} !== true && ${R} !== undefined`,()=>T.assign(C,e._`${R} === true ? true : ${C} > ${R} ? ${C} : ${R}`)),mergeToName:(T,R,C)=>T.if(e._`${C} !== true`,()=>T.assign(C,R===!0?!0:e._`${C} > ${R} ? ${C} : ${R}`)),mergeValues:(T,R)=>T===!0?!0:Math.max(T,R),resultToName:(T,R)=>T.var("items",R)})};function v(T,R){if(R===!0)return T.var("props",!0);let C=T.var("props",e._`{}`);if(R!==void 0)x(T,C,R);return C}t.evaluatedPropsToName=v;function x(T,R,C){Object.keys(C).forEach((F)=>T.assign(e._`${R}${(0,e.getProperty)(F)}`,!0))}t.setEvaluated=x;var o={};function u(T,R){return T.scopeValue("func",{ref:R,code:o[R.code]||(o[R.code]=new s._Code(R.code))})}t.useFunc=u;var y;(function(T){T[T.Num=0]="Num",T[T.Str=1]="Str"})(y||(t.Type=y={}));function m(T,R,C){if(T instanceof e.Name){let F=R===y.Num;return C?F?e._`"[" + ${T} + "]"`:e._`"['" + ${T} + "']"`:F?e._`"/" + ${T}`:e._`"/" + ${T}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return C?(0,e.getProperty)(T).toString():"/"+l(T)}t.getErrorPath=m;function k(T,R,C=T.opts.strictSchema){if(!C)return;if(R=`strict mode: ${R}`,C===!0)throw Error(R);T.self.logger.warn(R)}t.checkStrictMode=k}),$0=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};t.default=s}),Us=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;var e=pt(),s=Rt(),r=$0();t.keywordError={message:({keyword:x})=>e.str`must pass "${x}" keyword validation`},t.keyword$DataError={message:({keyword:x,schemaType:o})=>o?e.str`"${x}" keyword must be ${o} ($data)`:e.str`"${x}" keyword is invalid ($data)`};function a(x,o=t.keywordError,u,y){let{it:m}=x,{gen:k,compositeRule:T,allErrors:R}=m,C=l(x,o,u);if(y!==null&&y!==void 0?y:T||R)c(k,C);else d(m,e._`[${C}]`)}t.reportError=a;function n(x,o=t.keywordError,u){let{it:y}=x,{gen:m,compositeRule:k,allErrors:T}=y,R=l(x,o,u);if(c(m,R),!(k||T))d(y,r.default.vErrors)}t.reportExtraError=n;function i(x,o){x.assign(r.default.errors,o),x.if(e._`${r.default.vErrors} !== null`,()=>x.if(o,()=>x.assign(e._`${r.default.vErrors}.length`,o),()=>x.assign(r.default.vErrors,null)))}t.resetErrorsCount=i;function h({gen:x,keyword:o,schemaValue:u,data:y,errsCount:m,it:k}){if(m===void 0)throw Error("ajv implementation error");let T=x.name("err");x.forRange("i",m,r.default.errors,(R)=>{if(x.const(T,e._`${r.default.vErrors}[${R}]`),x.if(e._`${T}.instancePath === undefined`,()=>x.assign(e._`${T}.instancePath`,(0,e.strConcat)(r.default.instancePath,k.errorPath))),x.assign(e._`${T}.schemaPath`,e.str`${k.errSchemaPath}/${o}`),k.opts.verbose)x.assign(e._`${T}.schema`,u),x.assign(e._`${T}.data`,y)})}t.extendErrors=h;function c(x,o){let u=x.const("err",o);x.if(e._`${r.default.vErrors} === null`,()=>x.assign(r.default.vErrors,e._`[${u}]`),e._`${r.default.vErrors}.push(${u})`),x.code(e._`${r.default.errors}++`)}function d(x,o){let{gen:u,validateName:y,schemaEnv:m}=x;if(m.$async)u.throw(e._`new ${x.ValidationError}(${o})`);else u.assign(e._`${y}.errors`,o),u.return(!1)}var E={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function l(x,o,u){let{createErrors:y}=x.it;if(y===!1)return e._`{}`;return p(x,o,u)}function p(x,o,u={}){let{gen:y,it:m}=x,k=[f(m,u),I(x,u)];return v(x,o,k),y.object(...k)}function f({errorPath:x},{instancePath:o}){let u=o?e.str`${x}${(0,s.getErrorPath)(o,s.Type.Str)}`:x;return[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,u)]}function I({keyword:x,it:{errSchemaPath:o}},{schemaPath:u,parentSchema:y}){let m=y?o:e.str`${o}/${x}`;if(u)m=e.str`${m}${(0,s.getErrorPath)(u,s.Type.Str)}`;return[E.schemaPath,m]}function v(x,{params:o,message:u},y){let{keyword:m,data:k,schemaValue:T,it:R}=x,{opts:C,propertyName:F,topSchemaRef:B,schemaPath:_}=R;if(y.push([E.keyword,m],[E.params,typeof o=="function"?o(x):o||e._`{}`]),C.messages)y.push([E.message,typeof u=="function"?u(x):u]);if(C.verbose)y.push([E.schema,T],[E.parentSchema,e._`${B}${_}`],[r.default.data,k]);if(F)y.push([E.propertyName,F])}}),ky=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;var e=Us(),s=pt(),r=$0(),a={message:"boolean schema is false"};function n(c){let{gen:d,schema:E,validateName:l}=c;if(E===!1)h(c,!1);else if(typeof E=="object"&&E.$async===!0)d.return(r.default.data);else d.assign(s._`${l}.errors`,null),d.return(!0)}t.topBoolOrEmptySchema=n;function i(c,d){let{gen:E,schema:l}=c;if(l===!1)E.var(d,!1),h(c);else E.var(d,!0)}t.boolOrEmptySchema=i;function h(c,d){let{gen:E,data:l}=c,p={gen:E,keyword:"false schema",data:l,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,e.reportError)(p,a,void 0,d)}}),Bh=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;var e=["string","number","integer","boolean","null","object","array"],s=new Set(e);function r(n){return typeof n=="string"&&s.has(n)}t.isJSONType=r;function a(){let n={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...n,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},n.number,n.string,n.array,n.object],post:{rules:[]},all:{},keywords:{}}}t.getRules=a}),Vh=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0;function e({schema:a,self:n},i){let h=n.RULES.types[i];return h&&h!==!0&&s(a,h)}t.schemaHasRulesForType=e;function s(a,n){return n.rules.some((i)=>r(a,i))}t.shouldUseGroup=s;function r(a,n){var i;return a[n.keyword]!==void 0||((i=n.definition.implements)===null||i===void 0?void 0:i.some((h)=>a[h]!==void 0))}t.shouldUseRule=r}),fs=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;var e=Bh(),s=Vh(),r=Us(),a=pt(),n=Rt(),i;(function(y){y[y.Correct=0]="Correct",y[y.Wrong=1]="Wrong"})(i||(t.DataType=i={}));function h(y){let m=c(y.type);if(m.includes("null")){if(y.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!m.length&&y.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(y.nullable===!0)m.push("null")}return m}t.getSchemaTypes=h;function c(y){let m=Array.isArray(y)?y:y?[y]:[];if(m.every(e.isJSONType))return m;throw Error("type must be JSONType or JSONType[]: "+m.join(","))}t.getJSONTypes=c;function d(y,m){let{gen:k,data:T,opts:R}=y,C=l(m,R.coerceTypes),F=m.length>0&&!(C.length===0&&m.length===1&&(0,s.schemaHasRulesForType)(y,m[0]));if(F){let B=v(m,T,R.strictNumbers,i.Wrong);k.if(B,()=>{if(C.length)p(y,m,C);else o(y)})}return F}t.coerceAndCheckDataType=d;var E=new Set(["string","number","integer","boolean","null"]);function l(y,m){return m?y.filter((k)=>E.has(k)||m==="array"&&k==="array"):[]}function p(y,m,k){let{gen:T,data:R,opts:C}=y,F=T.let("dataType",a._`typeof ${R}`),B=T.let("coerced",a._`undefined`);if(C.coerceTypes==="array")T.if(a._`${F} == 'object' && Array.isArray(${R}) && ${R}.length == 1`,()=>T.assign(R,a._`${R}[0]`).assign(F,a._`typeof ${R}`).if(v(m,R,C.strictNumbers),()=>T.assign(B,R)));T.if(a._`${B} !== undefined`);for(let N of k)if(E.has(N)||N==="array"&&C.coerceTypes==="array")_(N);T.else(),o(y),T.endIf(),T.if(a._`${B} !== undefined`,()=>{T.assign(R,B),f(y,B)});function _(N){switch(N){case"string":T.elseIf(a._`${F} == "number" || ${F} == "boolean"`).assign(B,a._`"" + ${R}`).elseIf(a._`${R} === null`).assign(B,a._`""`);return;case"number":T.elseIf(a._`${F} == "boolean" || ${R} === null
|
|
4
|
-
|| (${F} == "string" && ${R} && ${R} == +${R})`).assign(B,a._`+${R}`);return;case"integer":T.elseIf(a._`${F} === "boolean" || ${R} === null
|
|
5
|
-
|| (${F} === "string" && ${R} && ${R} == +${R} && !(${R} % 1))`).assign(B,a._`+${R}`);return;case"boolean":T.elseIf(a._`${R} === "false" || ${R} === 0 || ${R} === null`).assign(B,!1).elseIf(a._`${R} === "true" || ${R} === 1`).assign(B,!0);return;case"null":T.elseIf(a._`${R} === "" || ${R} === 0 || ${R} === false`),T.assign(B,null);return;case"array":T.elseIf(a._`${F} === "string" || ${F} === "number"
|
|
6
|
-
|| ${F} === "boolean" || ${R} === null`).assign(B,a._`[${R}]`)}}}function f({gen:y,parentData:m,parentDataProperty:k},T){y.if(a._`${m} !== undefined`,()=>y.assign(a._`${m}[${k}]`,T))}function I(y,m,k,T=i.Correct){let R=T===i.Correct?a.operators.EQ:a.operators.NEQ,C;switch(y){case"null":return a._`${m} ${R} null`;case"array":C=a._`Array.isArray(${m})`;break;case"object":C=a._`${m} && typeof ${m} == "object" && !Array.isArray(${m})`;break;case"integer":C=F(a._`!(${m} % 1) && !isNaN(${m})`);break;case"number":C=F();break;default:return a._`typeof ${m} ${R} ${y}`}return T===i.Correct?C:(0,a.not)(C);function F(B=a.nil){return(0,a.and)(a._`typeof ${m} == "number"`,B,k?a._`isFinite(${m})`:a.nil)}}t.checkDataType=I;function v(y,m,k,T){if(y.length===1)return I(y[0],m,k,T);let R,C=(0,n.toHash)(y);if(C.array&&C.object){let F=a._`typeof ${m} != "object"`;R=C.null?F:a._`!${m} || ${F}`,delete C.null,delete C.array,delete C.object}else R=a.nil;if(C.number)delete C.integer;for(let F in C)R=(0,a.and)(R,I(F,m,k,T));return R}t.checkDataTypes=v;var x={message:({schema:y})=>`must be ${y}`,params:({schema:y,schemaValue:m})=>typeof y=="string"?a._`{type: ${y}}`:a._`{type: ${m}}`};function o(y){let m=u(y);(0,r.reportError)(m,x)}t.reportTypeError=o;function u(y){let{gen:m,data:k,schema:T}=y,R=(0,n.schemaRefOrVal)(y,T,"type");return{gen:m,keyword:"type",data:k,schema:T.type,schemaCode:R,schemaValue:R,parentSchema:T,params:{},it:y}}}),fy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;var e=pt(),s=Rt();function r(n,i){let{properties:h,items:c}=n.schema;if(i==="object"&&h)for(let d in h)a(n,d,h[d].default);else if(i==="array"&&Array.isArray(c))c.forEach((d,E)=>a(n,E,d.default))}t.assignDefaults=r;function a(n,i,h){let{gen:c,compositeRule:d,data:E,opts:l}=n;if(h===void 0)return;let p=e._`${E}${(0,e.getProperty)(i)}`;if(d){(0,s.checkStrictMode)(n,`default is ignored for: ${p}`);return}let f=e._`${p} === undefined`;if(l.useDefaults==="empty")f=e._`${f} || ${p} === null || ${p} === ""`;c.if(f,e._`${p} = ${(0,e.stringify)(h)}`)}}),M0=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;var e=pt(),s=Rt(),r=$0(),a=Rt();function n(y,m){let{gen:k,data:T,it:R}=y;k.if(l(k,T,m,R.opts.ownProperties),()=>{y.setParams({missingProperty:e._`${m}`},!0),y.error()})}t.checkReportMissingProp=n;function i({gen:y,data:m,it:{opts:k}},T,R){return(0,e.or)(...T.map((C)=>(0,e.and)(l(y,m,C,k.ownProperties),e._`${R} = ${C}`)))}t.checkMissingProp=i;function h(y,m){y.setParams({missingProperty:m},!0),y.error()}t.reportMissingProp=h;function c(y){return y.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}t.hasPropFunc=c;function d(y,m,k){return e._`${c(y)}.call(${m}, ${k})`}t.isOwnProperty=d;function E(y,m,k,T){let R=e._`${m}${(0,e.getProperty)(k)} !== undefined`;return T?e._`${R} && ${d(y,m,k)}`:R}t.propertyInData=E;function l(y,m,k,T){let R=e._`${m}${(0,e.getProperty)(k)} === undefined`;return T?(0,e.or)(R,(0,e.not)(d(y,m,k))):R}t.noPropertyInData=l;function p(y){return y?Object.keys(y).filter((m)=>m!=="__proto__"):[]}t.allSchemaProperties=p;function f(y,m){return p(m).filter((k)=>!(0,s.alwaysValidSchema)(y,m[k]))}t.schemaProperties=f;function I({schemaCode:y,data:m,it:{gen:k,topSchemaRef:T,schemaPath:R,errorPath:C},it:F},B,_,N){let O=N?e._`${y}, ${m}, ${T}${R}`:m,z=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,C)],[r.default.parentData,F.parentData],[r.default.parentDataProperty,F.parentDataProperty],[r.default.rootData,r.default.rootData]];if(F.opts.dynamicRef)z.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let K=e._`${O}, ${k.object(...z)}`;return _!==e.nil?e._`${B}.call(${_}, ${K})`:e._`${B}(${K})`}t.callValidateCode=I;var v=e._`new RegExp`;function x({gen:y,it:{opts:m}},k){let T=m.unicodeRegExp?"u":"",{regExp:R}=m.code,C=R(k,T);return y.scopeValue("pattern",{key:C.toString(),ref:C,code:e._`${R.code==="new RegExp"?v:(0,a.useFunc)(y,R)}(${k}, ${T})`})}t.usePattern=x;function o(y){let{gen:m,data:k,keyword:T,it:R}=y,C=m.name("valid");if(R.allErrors){let B=m.let("valid",!0);return F(()=>m.assign(B,!1)),B}return m.var(C,!0),F(()=>m.break()),C;function F(B){let _=m.const("len",e._`${k}.length`);m.forRange("i",0,_,(N)=>{y.subschema({keyword:T,dataProp:N,dataPropType:s.Type.Num},C),m.if((0,e.not)(C),B)})}}t.validateArray=o;function u(y){let{gen:m,schema:k,keyword:T,it:R}=y;if(!Array.isArray(k))throw Error("ajv implementation error");if(k.some((B)=>(0,s.alwaysValidSchema)(R,B))&&!R.opts.unevaluated)return;let C=m.let("valid",!1),F=m.name("_valid");m.block(()=>k.forEach((B,_)=>{let N=y.subschema({keyword:T,schemaProp:_,compositeRule:!0},F);if(m.assign(C,e._`${C} || ${F}`),!y.mergeValidEvaluated(N,F))m.if((0,e.not)(C))})),y.result(C,()=>y.reset(),()=>y.error(!0))}t.validateUnion=u}),xy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;var e=pt(),s=$0(),r=M0(),a=Us();function n(f,I){let{gen:v,keyword:x,schema:o,parentSchema:u,it:y}=f,m=I.macro.call(y.self,o,u,y),k=E(v,x,m);if(y.opts.validateSchema!==!1)y.self.validateSchema(m,!0);let T=v.name("valid");f.subschema({schema:m,schemaPath:e.nil,errSchemaPath:`${y.errSchemaPath}/${x}`,topSchemaRef:k,compositeRule:!0},T),f.pass(T,()=>f.error(!0))}t.macroKeywordCode=n;function i(f,I){var v;let{gen:x,keyword:o,schema:u,parentSchema:y,$data:m,it:k}=f;d(k,I);let T=!m&&I.compile?I.compile.call(k.self,u,y,k):I.validate,R=E(x,o,T),C=x.let("valid");f.block$data(C,F),f.ok((v=I.valid)!==null&&v!==void 0?v:C);function F(){if(I.errors===!1){if(N(),I.modifying)h(f);O(()=>f.error())}else{let z=I.async?B():_();if(I.modifying)h(f);O(()=>c(f,z))}}function B(){let z=x.let("ruleErrs",null);return x.try(()=>N(e._`await `),(K)=>x.assign(C,!1).if(e._`${K} instanceof ${k.ValidationError}`,()=>x.assign(z,e._`${K}.errors`),()=>x.throw(K))),z}function _(){let z=e._`${R}.errors`;return x.assign(z,null),N(e.nil),z}function N(z=I.async?e._`await `:e.nil){let K=k.opts.passContext?s.default.this:s.default.self,Mt=!(("compile"in I)&&!m||I.schema===!1);x.assign(C,e._`${z}${(0,r.callValidateCode)(f,R,K,Mt)}`,I.modifying)}function O(z){var K;x.if((0,e.not)((K=I.valid)!==null&&K!==void 0?K:C),z)}}t.funcKeywordCode=i;function h(f){let{gen:I,data:v,it:x}=f;I.if(x.parentData,()=>I.assign(v,e._`${x.parentData}[${x.parentDataProperty}]`))}function c(f,I){let{gen:v}=f;v.if(e._`Array.isArray(${I})`,()=>{v.assign(s.default.vErrors,e._`${s.default.vErrors} === null ? ${I} : ${s.default.vErrors}.concat(${I})`).assign(s.default.errors,e._`${s.default.vErrors}.length`),(0,a.extendErrors)(f)},()=>f.error())}function d({schemaEnv:f},I){if(I.async&&!f.$async)throw Error("async keyword in sync schema")}function E(f,I,v){if(v===void 0)throw Error(`keyword "${I}" failed to compile`);return f.scopeValue("keyword",typeof v=="function"?{ref:v}:{ref:v,code:(0,e.stringify)(v)})}function l(f,I,v=!1){return!I.length||I.some((x)=>x==="array"?Array.isArray(f):x==="object"?f&&typeof f=="object"&&!Array.isArray(f):typeof f==x||v&&typeof f>"u")}t.validSchemaType=l;function p({schema:f,opts:I,self:v,errSchemaPath:x},o,u){if(Array.isArray(o.keyword)?!o.keyword.includes(u):o.keyword!==u)throw Error("ajv implementation error");let y=o.dependencies;if(y===null||y===void 0?void 0:y.some((m)=>!Object.prototype.hasOwnProperty.call(f,m)))throw Error(`parent schema must have dependencies of ${u}: ${y.join(",")}`);if(o.validateSchema){if(!o.validateSchema(f[u])){let m=`keyword "${u}" value is invalid at path "${x}": `+v.errorsText(o.validateSchema.errors);if(I.validateSchema==="log")v.logger.error(m);else throw Error(m)}}}t.validateKeywordUsage=p}),Ry=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;var e=pt(),s=Rt();function r(i,{keyword:h,schemaProp:c,schema:d,schemaPath:E,errSchemaPath:l,topSchemaRef:p}){if(h!==void 0&&d!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(h!==void 0){let f=i.schema[h];return c===void 0?{schema:f,schemaPath:e._`${i.schemaPath}${(0,e.getProperty)(h)}`,errSchemaPath:`${i.errSchemaPath}/${h}`}:{schema:f[c],schemaPath:e._`${i.schemaPath}${(0,e.getProperty)(h)}${(0,e.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${h}/${(0,s.escapeFragment)(c)}`}}if(d!==void 0){if(E===void 0||l===void 0||p===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:d,schemaPath:E,topSchemaRef:p,errSchemaPath:l}}throw Error('either "keyword" or "schema" must be passed')}t.getSubschema=r;function a(i,h,{dataProp:c,dataPropType:d,data:E,dataTypes:l,propertyName:p}){if(E!==void 0&&c!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:f}=h;if(c!==void 0){let{errorPath:v,dataPathArr:x,opts:o}=h,u=f.let("data",e._`${h.data}${(0,e.getProperty)(c)}`,!0);I(u),i.errorPath=e.str`${v}${(0,s.getErrorPath)(c,d,o.jsPropertySyntax)}`,i.parentDataProperty=e._`${c}`,i.dataPathArr=[...x,i.parentDataProperty]}if(E!==void 0){let v=E instanceof e.Name?E:f.let("data",E,!0);if(I(v),p!==void 0)i.propertyName=p}if(l)i.dataTypes=l;function I(v){i.data=v,i.dataLevel=h.dataLevel+1,i.dataTypes=[],h.definedProperties=new Set,i.parentData=h.data,i.dataNames=[...h.dataNames,v]}}t.extendSubschemaData=a;function n(i,{jtdDiscriminator:h,jtdMetadata:c,compositeRule:d,createErrors:E,allErrors:l}){if(d!==void 0)i.compositeRule=d;if(E!==void 0)i.createErrors=E;if(l!==void 0)i.allErrors=l;i.jtdDiscriminator=h,i.jtdMetadata=c}t.extendSubschemaMode=n}),Nh=W((t,e)=>{e.exports=function s(r,a){if(r===a)return!0;if(r&&a&&typeof r=="object"&&typeof a=="object"){if(r.constructor!==a.constructor)return!1;var n,i,h;if(Array.isArray(r)){if(n=r.length,n!=a.length)return!1;for(i=n;i--!==0;)if(!s(r[i],a[i]))return!1;return!0}if(r.constructor===RegExp)return r.source===a.source&&r.flags===a.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===a.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===a.toString();if(h=Object.keys(r),n=h.length,n!==Object.keys(a).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(a,h[i]))return!1;for(i=n;i--!==0;){var c=h[i];if(!s(r[c],a[c]))return!1}return!0}return r!==r&&a!==a}}),Iy=W((t,e)=>{var s=e.exports=function(n,i,h){if(typeof i=="function")h=i,i={};h=i.cb||h;var c=typeof h=="function"?h:h.pre||function(){},d=h.post||function(){};r(i,c,d,n,"",n)};s.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},s.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},s.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},s.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 r(n,i,h,c,d,E,l,p,f,I){if(c&&typeof c=="object"&&!Array.isArray(c)){i(c,d,E,l,p,f,I);for(var v in c){var x=c[v];if(Array.isArray(x)){if(v in s.arrayKeywords)for(var o=0;o<x.length;o++)r(n,i,h,x[o],d+"/"+v+"/"+o,E,d,v,c,o)}else if(v in s.propsKeywords){if(x&&typeof x=="object")for(var u in x)r(n,i,h,x[u],d+"/"+v+"/"+a(u),E,d,v,c,u)}else if(v in s.keywords||n.allKeys&&!(v in s.skipKeywords))r(n,i,h,x,d+"/"+v,E,d,v,c)}h(c,d,E,l,p,f,I)}}function a(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}}),Gs=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;var e=Rt(),s=Nh(),r=Iy(),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function n(x,o=!0){if(typeof x=="boolean")return!0;if(o===!0)return!h(x);if(!o)return!1;return c(x)<=o}t.inlineRef=n;var i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function h(x){for(let o in x){if(i.has(o))return!0;let u=x[o];if(Array.isArray(u)&&u.some(h))return!0;if(typeof u=="object"&&h(u))return!0}return!1}function c(x){let o=0;for(let u in x){if(u==="$ref")return 1/0;if(o++,a.has(u))continue;if(typeof x[u]=="object")(0,e.eachItem)(x[u],(y)=>o+=c(y));if(o===1/0)return 1/0}return o}function d(x,o="",u){if(u!==!1)o=p(o);let y=x.parse(o);return E(x,y)}t.getFullPath=d;function E(x,o){return x.serialize(o).split("#")[0]+"#"}t._getFullPath=E;var l=/#\/?$/;function p(x){return x?x.replace(l,""):""}t.normalizeId=p;function f(x,o,u){return u=p(u),x.resolve(o,u)}t.resolveUrl=f;var I=/^[a-z_][-a-z0-9._]*$/i;function v(x,o){if(typeof x=="boolean")return{};let{schemaId:u,uriResolver:y}=this.opts,m=p(x[u]||o),k={"":m},T=d(y,m,!1),R={},C=new Set;return r(x,{allKeys:!0},(_,N,O,z)=>{if(z===void 0)return;let K=T+N,Mt=k[z];if(typeof _[u]=="string")Mt=Ot.call(this,_[u]);Ut.call(this,_.$anchor),Ut.call(this,_.$dynamicAnchor),k[N]=Mt;function Ot(St){let Z=this.opts.uriResolver.resolve;if(St=p(Mt?Z(Mt,St):St),C.has(St))throw B(St);C.add(St);let L=this.refs[St];if(typeof L=="string")L=this.refs[L];if(typeof L=="object")F(_,L.schema,St);else if(St!==p(K))if(St[0]==="#")F(_,R[St],St),R[St]=_;else this.refs[St]=K;return St}function Ut(St){if(typeof St=="string"){if(!I.test(St))throw Error(`invalid anchor "${St}"`);Ot.call(this,`#${St}`)}}}),R;function F(_,N,O){if(N!==void 0&&!s(_,N))throw B(O)}function B(_){return Error(`reference "${_}" resolves to more than one schema`)}}t.getSchemaRefs=v}),Ws=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;var e=ky(),s=fs(),r=Vh(),a=fs(),n=fy(),i=xy(),h=Ry(),c=pt(),d=$0(),E=Gs(),l=Rt(),p=Us();function f(A){if(T(A)){if(C(A),k(A)){o(A);return}}I(A,()=>(0,e.topBoolOrEmptySchema)(A))}t.validateFunctionCode=f;function I({gen:A,validateName:j,schema:D,schemaEnv:et,opts:st},mt){if(st.code.es5)A.func(j,c._`${d.default.data}, ${d.default.valCxt}`,et.$async,()=>{A.code(c._`"use strict"; ${y(D,st)}`),x(A,st),A.code(mt)});else A.func(j,c._`${d.default.data}, ${v(st)}`,et.$async,()=>A.code(y(D,st)).code(mt))}function v(A){return c._`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${A.dynamicRef?c._`, ${d.default.dynamicAnchors}={}`:c.nil}}={}`}function x(A,j){A.if(d.default.valCxt,()=>{if(A.var(d.default.instancePath,c._`${d.default.valCxt}.${d.default.instancePath}`),A.var(d.default.parentData,c._`${d.default.valCxt}.${d.default.parentData}`),A.var(d.default.parentDataProperty,c._`${d.default.valCxt}.${d.default.parentDataProperty}`),A.var(d.default.rootData,c._`${d.default.valCxt}.${d.default.rootData}`),j.dynamicRef)A.var(d.default.dynamicAnchors,c._`${d.default.valCxt}.${d.default.dynamicAnchors}`)},()=>{if(A.var(d.default.instancePath,c._`""`),A.var(d.default.parentData,c._`undefined`),A.var(d.default.parentDataProperty,c._`undefined`),A.var(d.default.rootData,d.default.data),j.dynamicRef)A.var(d.default.dynamicAnchors,c._`{}`)})}function o(A){let{schema:j,opts:D,gen:et}=A;I(A,()=>{if(D.$comment&&j.$comment)z(A);if(_(A),et.let(d.default.vErrors,null),et.let(d.default.errors,0),D.unevaluated)u(A);F(A),K(A)});return}function u(A){let{gen:j,validateName:D}=A;A.evaluated=j.const("evaluated",c._`${D}.evaluated`),j.if(c._`${A.evaluated}.dynamicProps`,()=>j.assign(c._`${A.evaluated}.props`,c._`undefined`)),j.if(c._`${A.evaluated}.dynamicItems`,()=>j.assign(c._`${A.evaluated}.items`,c._`undefined`))}function y(A,j){let D=typeof A=="object"&&A[j.schemaId];return D&&(j.code.source||j.code.process)?c._`/*# sourceURL=${D} */`:c.nil}function m(A,j){if(T(A)){if(C(A),k(A)){R(A,j);return}}(0,e.boolOrEmptySchema)(A,j)}function k({schema:A,self:j}){if(typeof A=="boolean")return!A;for(let D in A)if(j.RULES.all[D])return!0;return!1}function T(A){return typeof A.schema!="boolean"}function R(A,j){let{schema:D,gen:et,opts:st}=A;if(st.$comment&&D.$comment)z(A);N(A),O(A);let mt=et.const("_errs",d.default.errors);F(A,mt),et.var(j,c._`${mt} === ${d.default.errors}`)}function C(A){(0,l.checkUnknownRules)(A),B(A)}function F(A,j){if(A.opts.jtd)return Ot(A,[],!1,j);let D=(0,s.getSchemaTypes)(A.schema),et=(0,s.coerceAndCheckDataType)(A,D);Ot(A,D,!et,j)}function B(A){let{schema:j,errSchemaPath:D,opts:et,self:st}=A;if(j.$ref&&et.ignoreKeywordsWithRef&&(0,l.schemaHasRulesButRef)(j,st.RULES))st.logger.warn(`$ref: keywords ignored in schema at path "${D}"`)}function _(A){let{schema:j,opts:D}=A;if(j.default!==void 0&&D.useDefaults&&D.strictSchema)(0,l.checkStrictMode)(A,"default is ignored in the schema root")}function N(A){let j=A.schema[A.opts.schemaId];if(j)A.baseId=(0,E.resolveUrl)(A.opts.uriResolver,A.baseId,j)}function O(A){if(A.schema.$async&&!A.schemaEnv.$async)throw Error("async schema in sync schema")}function z({gen:A,schemaEnv:j,schema:D,errSchemaPath:et,opts:st}){let mt=D.$comment;if(st.$comment===!0)A.code(c._`${d.default.self}.logger.log(${mt})`);else if(typeof st.$comment=="function"){let Wt=c.str`${et}/$comment`,$t=A.scopeValue("root",{ref:j.root});A.code(c._`${d.default.self}.opts.$comment(${mt}, ${Wt}, ${$t}.schema)`)}}function K(A){let{gen:j,schemaEnv:D,validateName:et,ValidationError:st,opts:mt}=A;if(D.$async)j.if(c._`${d.default.errors} === 0`,()=>j.return(d.default.data),()=>j.throw(c._`new ${st}(${d.default.vErrors})`));else{if(j.assign(c._`${et}.errors`,d.default.vErrors),mt.unevaluated)Mt(A);j.return(c._`${d.default.errors} === 0`)}}function Mt({gen:A,evaluated:j,props:D,items:et}){if(D instanceof c.Name)A.assign(c._`${j}.props`,D);if(et instanceof c.Name)A.assign(c._`${j}.items`,et)}function Ot(A,j,D,et){let{gen:st,schema:mt,data:Wt,allErrors:$t,opts:Gt,self:zt}=A,{RULES:Vt}=zt;if(mt.$ref&&(Gt.ignoreKeywordsWithRef||!(0,l.schemaHasRulesButRef)(mt,Vt))){st.block(()=>lt(A,"$ref",Vt.all.$ref.definition));return}if(!Gt.jtd)St(A,j);st.block(()=>{for(let e0 of Vt.rules)E0(e0);E0(Vt.post)});function E0(e0){if(!(0,r.shouldUseGroup)(mt,e0))return;if(e0.type){if(st.if((0,a.checkDataType)(e0.type,Wt,Gt.strictNumbers)),Ut(A,e0),j.length===1&&j[0]===e0.type&&D)st.else(),(0,a.reportTypeError)(A);st.endIf()}else Ut(A,e0);if(!$t)st.if(c._`${d.default.errors} === ${et||0}`)}}function Ut(A,j){let{gen:D,schema:et,opts:{useDefaults:st}}=A;if(st)(0,n.assignDefaults)(A,j.type);D.block(()=>{for(let mt of j.rules)if((0,r.shouldUseRule)(et,mt))lt(A,mt.keyword,mt.definition,j.type)})}function St(A,j){if(A.schemaEnv.meta||!A.opts.strictTypes)return;if(Z(A,j),!A.opts.allowUnionTypes)L(A,j);V(A,A.dataTypes)}function Z(A,j){if(!j.length)return;if(!A.dataTypes.length){A.dataTypes=j;return}j.forEach((D)=>{if(!b(A.dataTypes,D))X(A,`type "${D}" not allowed by context "${A.dataTypes.join(",")}"`)}),P(A,j)}function L(A,j){if(j.length>1&&!(j.length===2&&j.includes("null")))X(A,"use allowUnionTypes to allow union type keyword")}function V(A,j){let D=A.self.RULES.all;for(let et in D){let st=D[et];if(typeof st=="object"&&(0,r.shouldUseRule)(A.schema,st)){let{type:mt}=st.definition;if(mt.length&&!mt.some((Wt)=>S(j,Wt)))X(A,`missing type "${mt.join(",")}" for keyword "${et}"`)}}}function S(A,j){return A.includes(j)||j==="number"&&A.includes("integer")}function b(A,j){return A.includes(j)||j==="integer"&&A.includes("number")}function P(A,j){let D=[];for(let et of A.dataTypes)if(b(j,et))D.push(et);else if(j.includes("integer")&&et==="number")D.push("integer");A.dataTypes=D}function X(A,j){let D=A.schemaEnv.baseId+A.errSchemaPath;j+=` at "${D}" (strictTypes)`,(0,l.checkStrictMode)(A,j,A.opts.strictTypes)}class at{constructor(A,j,D){if((0,i.validateKeywordUsage)(A,j,D),this.gen=A.gen,this.allErrors=A.allErrors,this.keyword=D,this.data=A.data,this.schema=A.schema[D],this.$data=j.$data&&A.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,l.schemaRefOrVal)(A,this.schema,D,this.$data),this.schemaType=j.schemaType,this.parentSchema=A.schema,this.params={},this.it=A,this.def=j,this.$data)this.schemaCode=A.gen.const("vSchema",C0(this.$data,A));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,j.schemaType,j.allowUndefined))throw Error(`${D} value must be ${JSON.stringify(j.schemaType)}`);if("code"in j?j.trackErrors:j.errors!==!1)this.errsCount=A.gen.const("_errs",d.default.errors)}result(A,j,D){this.failResult((0,c.not)(A),j,D)}failResult(A,j,D){if(this.gen.if(A),D)D();else this.error();if(j){if(this.gen.else(),j(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(A,j){this.failResult((0,c.not)(A),void 0,j)}fail(A){if(A===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(A),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(A){if(!this.$data)return this.fail(A);let{schemaCode:j}=this;this.fail(c._`${j} !== undefined && (${(0,c.or)(this.invalid$data(),A)})`)}error(A,j,D){if(j){this.setParams(j),this._error(A,D),this.setParams({});return}this._error(A,D)}_error(A,j){(A?p.reportExtraError:p.reportError)(this,this.def.error,j)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(A){if(!this.allErrors)this.gen.if(A)}setParams(A,j){if(j)Object.assign(this.params,A);else this.params=A}block$data(A,j,D=c.nil){this.gen.block(()=>{this.check$data(A,D),j()})}check$data(A=c.nil,j=c.nil){if(!this.$data)return;let{gen:D,schemaCode:et,schemaType:st,def:mt}=this;if(D.if((0,c.or)(c._`${et} === undefined`,j)),A!==c.nil)D.assign(A,!0);if(st.length||mt.validateSchema){if(D.elseIf(this.invalid$data()),this.$dataError(),A!==c.nil)D.assign(A,!1)}D.else()}invalid$data(){let{gen:A,schemaCode:j,schemaType:D,def:et,it:st}=this;return(0,c.or)(mt(),Wt());function mt(){if(D.length){if(!(j instanceof c.Name))throw Error("ajv implementation error");let $t=Array.isArray(D)?D:[D];return c._`${(0,a.checkDataTypes)($t,j,st.opts.strictNumbers,a.DataType.Wrong)}`}return c.nil}function Wt(){if(et.validateSchema){let $t=A.scopeValue("validate$data",{ref:et.validateSchema});return c._`!${$t}(${j})`}return c.nil}}subschema(A,j){let D=(0,h.getSubschema)(this.it,A);(0,h.extendSubschemaData)(D,this.it,A),(0,h.extendSubschemaMode)(D,A);let et={...this.it,...D,items:void 0,props:void 0};return m(et,j),et}mergeEvaluated(A,j){let{it:D,gen:et}=this;if(!D.opts.unevaluated)return;if(D.props!==!0&&A.props!==void 0)D.props=l.mergeEvaluated.props(et,A.props,D.props,j);if(D.items!==!0&&A.items!==void 0)D.items=l.mergeEvaluated.items(et,A.items,D.items,j)}mergeValidEvaluated(A,j){let{it:D,gen:et}=this;if(D.opts.unevaluated&&(D.props!==!0||D.items!==!0))return et.if(j,()=>this.mergeEvaluated(A,c.Name)),!0}}t.KeywordCxt=at;function lt(A,j,D,et){let st=new at(A,D,j);if("code"in D)D.code(st,et);else if(st.$data&&D.validate)(0,i.funcKeywordCode)(st,D);else if("macro"in D)(0,i.macroKeywordCode)(st,D);else if(D.compile||D.validate)(0,i.funcKeywordCode)(st,D)}var rt=/^\/(?:[^~]|~0|~1)*$/,Pt=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function C0(A,{dataLevel:j,dataNames:D,dataPathArr:et}){let st,mt;if(A==="")return d.default.rootData;if(A[0]==="/"){if(!rt.test(A))throw Error(`Invalid JSON-pointer: ${A}`);st=A,mt=d.default.rootData}else{let zt=Pt.exec(A);if(!zt)throw Error(`Invalid JSON-pointer: ${A}`);let Vt=+zt[1];if(st=zt[2],st==="#"){if(Vt>=j)throw Error(Gt("property/index",Vt));return et[j-Vt]}if(Vt>j)throw Error(Gt("data",Vt));if(mt=D[j-Vt],!st)return mt}let Wt=mt,$t=st.split("/");for(let zt of $t)if(zt)mt=c._`${mt}${(0,c.getProperty)((0,l.unescapeJsonPointer)(zt))}`,Wt=c._`${Wt} && ${mt}`;return Wt;function Gt(zt,Vt){return`Cannot access ${zt} ${Vt} levels up, current level is ${j}`}}t.getData=C0}),$3=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});class e extends Error{constructor(s){super("validation failed");this.errors=s,this.ajv=this.validation=!0}}t.default=e}),zs=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Gs();class s extends Error{constructor(r,a,n,i){super(i||`can't resolve reference ${n} from id ${a}`);this.missingRef=(0,e.resolveUrl)(r,a,n),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(r,this.missingRef))}}t.default=s}),tr=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;var e=pt(),s=$3(),r=$0(),a=Gs(),n=Rt(),i=Ws();class h{constructor(o){var u;this.refs={},this.dynamicAnchors={};let y;if(typeof o.schema=="object")y=o.schema;this.schema=o.schema,this.schemaId=o.schemaId,this.root=o.root||this,this.baseId=(u=o.baseId)!==null&&u!==void 0?u:(0,a.normalizeId)(y===null||y===void 0?void 0:y[o.schemaId||"$id"]),this.schemaPath=o.schemaPath,this.localRefs=o.localRefs,this.meta=o.meta,this.$async=y===null||y===void 0?void 0:y.$async,this.refs={}}}t.SchemaEnv=h;function c(o){let u=l.call(this,o);if(u)return u;let y=(0,a.getFullPath)(this.opts.uriResolver,o.root.baseId),{es5:m,lines:k}=this.opts.code,{ownProperties:T}=this.opts,R=new e.CodeGen(this.scope,{es5:m,lines:k,ownProperties:T}),C;if(o.$async)C=R.scopeValue("Error",{ref:s.default,code:e._`require("ajv/dist/runtime/validation_error").default`});let F=R.scopeName("validate");o.validateName=F;let B={gen:R,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:R.scopeValue("schema",this.opts.code.source===!0?{ref:o.schema,code:(0,e.stringify)(o.schema)}:{ref:o.schema}),validateName:F,ValidationError:C,schema:o.schema,schemaEnv:o,rootId:y,baseId:o.baseId||y,schemaPath:e.nil,errSchemaPath:o.schemaPath||(this.opts.jtd?"":"#"),errorPath:e._`""`,opts:this.opts,self:this},_;try{this._compilations.add(o),(0,i.validateFunctionCode)(B),R.optimize(this.opts.code.optimize);let N=R.toString();if(_=`${R.scopeRefs(r.default.scope)}return ${N}`,this.opts.code.process)_=this.opts.code.process(_,o);let O=Function(`${r.default.self}`,`${r.default.scope}`,_)(this,this.scope.get());if(this.scope.value(F,{ref:O}),O.errors=null,O.schema=o.schema,O.schemaEnv=o,o.$async)O.$async=!0;if(this.opts.code.source===!0)O.source={validateName:F,validateCode:N,scopeValues:R._values};if(this.opts.unevaluated){let{props:z,items:K}=B;if(O.evaluated={props:z instanceof e.Name?void 0:z,items:K instanceof e.Name?void 0:K,dynamicProps:z instanceof e.Name,dynamicItems:K instanceof e.Name},O.source)O.source.evaluated=(0,e.stringify)(O.evaluated)}return o.validate=O,o}catch(N){if(delete o.validate,delete o.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw N}finally{this._compilations.delete(o)}}t.compileSchema=c;function d(o,u,y){var m;y=(0,a.resolveUrl)(this.opts.uriResolver,u,y);let k=o.refs[y];if(k)return k;let T=f.call(this,o,y);if(T===void 0){let R=(m=o.localRefs)===null||m===void 0?void 0:m[y],{schemaId:C}=this.opts;if(R)T=new h({schema:R,schemaId:C,root:o,baseId:u})}if(T===void 0)return;return o.refs[y]=E.call(this,T)}t.resolveRef=d;function E(o){if((0,a.inlineRef)(o.schema,this.opts.inlineRefs))return o.schema;return o.validate?o:c.call(this,o)}function l(o){for(let u of this._compilations)if(p(u,o))return u}t.getCompilingSchema=l;function p(o,u){return o.schema===u.schema&&o.root===u.root&&o.baseId===u.baseId}function f(o,u){let y;while(typeof(y=this.refs[u])=="string")u=y;return y||this.schemas[u]||I.call(this,o,u)}function I(o,u){let y=this.opts.uriResolver.parse(u),m=(0,a._getFullPath)(this.opts.uriResolver,y),k=(0,a.getFullPath)(this.opts.uriResolver,o.baseId,void 0);if(Object.keys(o.schema).length>0&&m===k)return x.call(this,y,o);let T=(0,a.normalizeId)(m),R=this.refs[T]||this.schemas[T];if(typeof R=="string"){let C=I.call(this,o,R);if(typeof(C===null||C===void 0?void 0:C.schema)!=="object")return;return x.call(this,y,C)}if(typeof(R===null||R===void 0?void 0:R.schema)!=="object")return;if(!R.validate)c.call(this,R);if(T===(0,a.normalizeId)(u)){let{schema:C}=R,{schemaId:F}=this.opts,B=C[F];if(B)k=(0,a.resolveUrl)(this.opts.uriResolver,k,B);return new h({schema:C,schemaId:F,root:o,baseId:k})}return x.call(this,y,R)}t.resolveSchema=I;var v=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function x(o,{baseId:u,schema:y,root:m}){var k;if(((k=o.fragment)===null||k===void 0?void 0:k[0])!=="/")return;for(let C of o.fragment.slice(1).split("/")){if(typeof y==="boolean")return;let F=y[(0,n.unescapeFragment)(C)];if(F===void 0)return;y=F;let B=typeof y==="object"&&y[this.opts.schemaId];if(!v.has(C)&&B)u=(0,a.resolveUrl)(this.opts.uriResolver,u,B)}let T;if(typeof y!="boolean"&&y.$ref&&!(0,n.schemaHasRulesButRef)(y,this.RULES)){let C=(0,a.resolveUrl)(this.opts.uriResolver,u,y.$ref);T=I.call(this,m,C)}let{schemaId:R}=this.opts;if(T=T||new h({schema:y,schemaId:R,root:m,baseId:u}),T.schema!==T.root.schema)return T;return}}),vy=W((t,e)=>{e.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}}),Cy=W((t,e)=>{var s={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};e.exports={HEX:s}}),Ay=W((t,e)=>{var{HEX:s}=Cy(),r=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function a(o){if(d(o,".")<3)return{host:o,isIPV4:!1};let u=o.match(r)||[],[y]=u;if(y)return{host:c(y,"."),isIPV4:!0};else return{host:o,isIPV4:!1}}function n(o,u=!1){let y="",m=!0;for(let k of o){if(s[k]===void 0)return;if(k!=="0"&&m===!0)m=!1;if(!m)y+=k}if(u&&y.length===0)y="0";return y}function i(o){let u=0,y={error:!1,address:"",zone:""},m=[],k=[],T=!1,R=!1,C=!1;function F(){if(k.length){if(T===!1){let B=n(k);if(B!==void 0)m.push(B);else return y.error=!0,!1}k.length=0}return!0}for(let B=0;B<o.length;B++){let _=o[B];if(_==="["||_==="]")continue;if(_===":"){if(R===!0)C=!0;if(!F())break;if(u++,m.push(":"),u>7){y.error=!0;break}if(B-1>=0&&o[B-1]===":")R=!0;continue}else if(_==="%"){if(!F())break;T=!0}else{k.push(_);continue}}if(k.length)if(T)y.zone=k.join("");else if(C)m.push(k.join(""));else m.push(n(k));return y.address=m.join(""),y}function h(o){if(d(o,":")<2)return{host:o,isIPV6:!1};let u=i(o);if(!u.error){let{address:y,address:m}=u;if(u.zone)y+="%"+u.zone,m+="%25"+u.zone;return{host:y,escapedHost:m,isIPV6:!0}}else return{host:o,isIPV6:!1}}function c(o,u){let y="",m=!0,k=o.length;for(let T=0;T<k;T++){let R=o[T];if(R==="0"&&m){if(T+1<=k&&o[T+1]===u||T+1===k)y+=R,m=!1}else{if(R===u)m=!0;else m=!1;y+=R}}return y}function d(o,u){let y=0;for(let m=0;m<o.length;m++)if(o[m]===u)y++;return y}var E=/^\.\.?\//u,l=/^\/\.(?:\/|$)/u,p=/^\/\.\.(?:\/|$)/u,f=/^\/?(?:.|\n)*?(?=\/|$)/u;function I(o){let u=[];while(o.length)if(o.match(E))o=o.replace(E,"");else if(o.match(l))o=o.replace(l,"/");else if(o.match(p))o=o.replace(p,"/"),u.pop();else if(o==="."||o==="..")o="";else{let y=o.match(f);if(y){let m=y[0];o=o.slice(m.length),u.push(m)}else throw Error("Unexpected dot segment condition")}return u.join("")}function v(o,u){let y=u!==!0?escape:unescape;if(o.scheme!==void 0)o.scheme=y(o.scheme);if(o.userinfo!==void 0)o.userinfo=y(o.userinfo);if(o.host!==void 0)o.host=y(o.host);if(o.path!==void 0)o.path=y(o.path);if(o.query!==void 0)o.query=y(o.query);if(o.fragment!==void 0)o.fragment=y(o.fragment);return o}function x(o){let u=[];if(o.userinfo!==void 0)u.push(o.userinfo),u.push("@");if(o.host!==void 0){let y=unescape(o.host),m=a(y);if(m.isIPV4)y=m.host;else{let k=h(m.host);if(k.isIPV6===!0)y=`[${k.escapedHost}]`;else y=o.host}u.push(y)}if(typeof o.port==="number"||typeof o.port==="string")u.push(":"),u.push(String(o.port));return u.length?u.join(""):void 0}e.exports={recomposeAuthority:x,normalizeComponentEncoding:v,removeDotSegments:I,normalizeIPv4:a,normalizeIPv6:h,stringArrayToHexStripped:n}}),by=W((t,e)=>{var s=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,r=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function a(m){return typeof m.secure==="boolean"?m.secure:String(m.scheme).toLowerCase()==="wss"}function n(m){if(!m.host)m.error=m.error||"HTTP URIs must have a host.";return m}function i(m){let k=String(m.scheme).toLowerCase()==="https";if(m.port===(k?443:80)||m.port==="")m.port=void 0;if(!m.path)m.path="/";return m}function h(m){return m.secure=a(m),m.resourceName=(m.path||"/")+(m.query?"?"+m.query:""),m.path=void 0,m.query=void 0,m}function c(m){if(m.port===(a(m)?443:80)||m.port==="")m.port=void 0;if(typeof m.secure==="boolean")m.scheme=m.secure?"wss":"ws",m.secure=void 0;if(m.resourceName){let[k,T]=m.resourceName.split("?");m.path=k&&k!=="/"?k:void 0,m.query=T,m.resourceName=void 0}return m.fragment=void 0,m}function d(m,k){if(!m.path)return m.error="URN can not be parsed",m;let T=m.path.match(r);if(T){let R=k.scheme||m.scheme||"urn";m.nid=T[1].toLowerCase(),m.nss=T[2];let C=`${R}:${k.nid||m.nid}`,F=y[C];if(m.path=void 0,F)m=F.parse(m,k)}else m.error=m.error||"URN can not be parsed.";return m}function E(m,k){let T=k.scheme||m.scheme||"urn",R=m.nid.toLowerCase(),C=`${T}:${k.nid||R}`,F=y[C];if(F)m=F.serialize(m,k);let B=m,_=m.nss;return B.path=`${R||k.nid}:${_}`,k.skipEscape=!0,B}function l(m,k){let T=m;if(T.uuid=T.nss,T.nss=void 0,!k.tolerant&&(!T.uuid||!s.test(T.uuid)))T.error=T.error||"UUID is not valid.";return T}function p(m){let k=m;return k.nss=(m.uuid||"").toLowerCase(),k}var f={scheme:"http",domainHost:!0,parse:n,serialize:i},I={scheme:"https",domainHost:f.domainHost,parse:n,serialize:i},v={scheme:"ws",domainHost:!0,parse:h,serialize:c},x={scheme:"wss",domainHost:v.domainHost,parse:v.parse,serialize:v.serialize},o={scheme:"urn",parse:d,serialize:E,skipNormalize:!0},u={scheme:"urn:uuid",parse:l,serialize:p,skipNormalize:!0},y={http:f,https:I,ws:v,wss:x,urn:o,"urn:uuid":u};e.exports=y}),Zy=W((t,e)=>{var{normalizeIPv6:s,normalizeIPv4:r,removeDotSegments:a,recomposeAuthority:n,normalizeComponentEncoding:i}=Ay(),h=by();function c(u,y){if(typeof u==="string")u=p(x(u,y),y);else if(typeof u==="object")u=x(p(u,y),y);return u}function d(u,y,m){let k=Object.assign({scheme:"null"},m),T=E(x(u,k),x(y,k),k,!0);return p(T,{...k,skipEscape:!0})}function E(u,y,m,k){let T={};if(!k)u=x(p(u,m),m),y=x(p(y,m),m);if(m=m||{},!m.tolerant&&y.scheme)T.scheme=y.scheme,T.userinfo=y.userinfo,T.host=y.host,T.port=y.port,T.path=a(y.path||""),T.query=y.query;else{if(y.userinfo!==void 0||y.host!==void 0||y.port!==void 0)T.userinfo=y.userinfo,T.host=y.host,T.port=y.port,T.path=a(y.path||""),T.query=y.query;else{if(!y.path)if(T.path=u.path,y.query!==void 0)T.query=y.query;else T.query=u.query;else{if(y.path.charAt(0)==="/")T.path=a(y.path);else{if((u.userinfo!==void 0||u.host!==void 0||u.port!==void 0)&&!u.path)T.path="/"+y.path;else if(!u.path)T.path=y.path;else T.path=u.path.slice(0,u.path.lastIndexOf("/")+1)+y.path;T.path=a(T.path)}T.query=y.query}T.userinfo=u.userinfo,T.host=u.host,T.port=u.port}T.scheme=u.scheme}return T.fragment=y.fragment,T}function l(u,y,m){if(typeof u==="string")u=unescape(u),u=p(i(x(u,m),!0),{...m,skipEscape:!0});else if(typeof u==="object")u=p(i(u,!0),{...m,skipEscape:!0});if(typeof y==="string")y=unescape(y),y=p(i(x(y,m),!0),{...m,skipEscape:!0});else if(typeof y==="object")y=p(i(y,!0),{...m,skipEscape:!0});return u.toLowerCase()===y.toLowerCase()}function p(u,y){let m={host:u.host,scheme:u.scheme,userinfo:u.userinfo,port:u.port,path:u.path,query:u.query,nid:u.nid,nss:u.nss,uuid:u.uuid,fragment:u.fragment,reference:u.reference,resourceName:u.resourceName,secure:u.secure,error:""},k=Object.assign({},y),T=[],R=h[(k.scheme||m.scheme||"").toLowerCase()];if(R&&R.serialize)R.serialize(m,k);if(m.path!==void 0)if(!k.skipEscape){if(m.path=escape(m.path),m.scheme!==void 0)m.path=m.path.split("%3A").join(":")}else m.path=unescape(m.path);if(k.reference!=="suffix"&&m.scheme)T.push(m.scheme,":");let C=n(m);if(C!==void 0){if(k.reference!=="suffix")T.push("//");if(T.push(C),m.path&&m.path.charAt(0)!=="/")T.push("/")}if(m.path!==void 0){let F=m.path;if(!k.absolutePath&&(!R||!R.absolutePath))F=a(F);if(C===void 0)F=F.replace(/^\/\//u,"/%2F");T.push(F)}if(m.query!==void 0)T.push("?",m.query);if(m.fragment!==void 0)T.push("#",m.fragment);return T.join("")}var f=Array.from({length:127},(u,y)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(y)));function I(u){let y=0;for(let m=0,k=u.length;m<k;++m)if(y=u.charCodeAt(m),y>126||f[y])return!0;return!1}var v=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function x(u,y){let m=Object.assign({},y),k={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},T=u.indexOf("%")!==-1,R=!1;if(m.reference==="suffix")u=(m.scheme?m.scheme+":":"")+"//"+u;let C=u.match(v);if(C){if(k.scheme=C[1],k.userinfo=C[3],k.host=C[4],k.port=parseInt(C[5],10),k.path=C[6]||"",k.query=C[7],k.fragment=C[8],isNaN(k.port))k.port=C[5];if(k.host){let B=r(k.host);if(B.isIPV4===!1){let _=s(B.host);k.host=_.host.toLowerCase(),R=_.isIPV6}else k.host=B.host,R=!0}if(k.scheme===void 0&&k.userinfo===void 0&&k.host===void 0&&k.port===void 0&&k.query===void 0&&!k.path)k.reference="same-document";else if(k.scheme===void 0)k.reference="relative";else if(k.fragment===void 0)k.reference="absolute";else k.reference="uri";if(m.reference&&m.reference!=="suffix"&&m.reference!==k.reference)k.error=k.error||"URI is not a "+m.reference+" reference.";let F=h[(m.scheme||k.scheme||"").toLowerCase()];if(!m.unicodeSupport&&(!F||!F.unicodeSupport)){if(k.host&&(m.domainHost||F&&F.domainHost)&&R===!1&&I(k.host))try{k.host=URL.domainToASCII(k.host.toLowerCase())}catch(B){k.error=k.error||"Host's domain name can not be converted to ASCII: "+B}}if(!F||F&&!F.skipNormalize){if(T&&k.scheme!==void 0)k.scheme=unescape(k.scheme);if(T&&k.host!==void 0)k.host=unescape(k.host);if(k.path)k.path=escape(unescape(k.path));if(k.fragment)k.fragment=encodeURI(decodeURIComponent(k.fragment))}if(F&&F.parse)F.parse(k,m)}else k.error=k.error||"URI can not be parsed.";return k}var o={SCHEMES:h,normalize:c,resolve:d,resolveComponents:E,equal:l,serialize:p,parse:x};e.exports=o,e.exports.default=o,e.exports.fastUri=o}),gy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Zy();e.code='require("ajv/dist/runtime/uri").default',t.default=e}),Fy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var e=Ws();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var s=pt();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return s.CodeGen}});var r=$3(),a=zs(),n=Bh(),i=tr(),h=pt(),c=Gs(),d=fs(),E=Rt(),l=vy(),p=gy(),f=(Z,L)=>new RegExp(Z,L);f.code="new RegExp";var I=["removeAdditional","useDefaults","coerceTypes"],v=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),x={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."},o={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},u=200;function y(Z){var L,V,S,b,P,X,at,lt,rt,Pt,C0,A,j,D,et,st,mt,Wt,$t,Gt,zt,Vt,E0,e0,Ge;let L0=Z.strict,A0=(L=Z.code)===null||L===void 0?void 0:L.optimize,We=A0===!0||A0===void 0?1:A0||0,za=(S=(V=Z.code)===null||V===void 0?void 0:V.regExp)!==null&&S!==void 0?S:f,hy=(b=Z.uriResolver)!==null&&b!==void 0?b:p.default;return{strictSchema:(X=(P=Z.strictSchema)!==null&&P!==void 0?P:L0)!==null&&X!==void 0?X:!0,strictNumbers:(lt=(at=Z.strictNumbers)!==null&&at!==void 0?at:L0)!==null&<!==void 0?lt:!0,strictTypes:(Pt=(rt=Z.strictTypes)!==null&&rt!==void 0?rt:L0)!==null&&Pt!==void 0?Pt:"log",strictTuples:(A=(C0=Z.strictTuples)!==null&&C0!==void 0?C0:L0)!==null&&A!==void 0?A:"log",strictRequired:(D=(j=Z.strictRequired)!==null&&j!==void 0?j:L0)!==null&&D!==void 0?D:!1,code:Z.code?{...Z.code,optimize:We,regExp:za}:{optimize:We,regExp:za},loopRequired:(et=Z.loopRequired)!==null&&et!==void 0?et:u,loopEnum:(st=Z.loopEnum)!==null&&st!==void 0?st:u,meta:(mt=Z.meta)!==null&&mt!==void 0?mt:!0,messages:(Wt=Z.messages)!==null&&Wt!==void 0?Wt:!0,inlineRefs:($t=Z.inlineRefs)!==null&&$t!==void 0?$t:!0,schemaId:(Gt=Z.schemaId)!==null&&Gt!==void 0?Gt:"$id",addUsedSchema:(zt=Z.addUsedSchema)!==null&&zt!==void 0?zt:!0,validateSchema:(Vt=Z.validateSchema)!==null&&Vt!==void 0?Vt:!0,validateFormats:(E0=Z.validateFormats)!==null&&E0!==void 0?E0:!0,unicodeRegExp:(e0=Z.unicodeRegExp)!==null&&e0!==void 0?e0:!0,int32range:(Ge=Z.int32range)!==null&&Ge!==void 0?Ge:!0,uriResolver:hy}}class m{constructor(Z={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Z=this.opts={...Z,...y(Z)};let{es5:L,lines:V}=this.opts.code;this.scope=new h.ValueScope({scope:{},prefixes:v,es5:L,lines:V}),this.logger=N(Z.logger);let S=Z.validateFormats;if(Z.validateFormats=!1,this.RULES=(0,n.getRules)(),k.call(this,x,Z,"NOT SUPPORTED"),k.call(this,o,Z,"DEPRECATED","warn"),this._metaOpts=B.call(this),Z.formats)C.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Z.keywords)F.call(this,Z.keywords);if(typeof Z.meta=="object")this.addMetaSchema(Z.meta);R.call(this),Z.validateFormats=S}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Z,meta:L,schemaId:V}=this.opts,S=l;if(V==="id")S={...l},S.id=S.$id,delete S.$id;if(L&&Z)this.addMetaSchema(S,S[V],!1)}defaultMeta(){let{meta:Z,schemaId:L}=this.opts;return this.opts.defaultMeta=typeof Z=="object"?Z[L]||Z:void 0}validate(Z,L){let V;if(typeof Z=="string"){if(V=this.getSchema(Z),!V)throw Error(`no schema with key or ref "${Z}"`)}else V=this.compile(Z);let S=V(L);if(!("$async"in V))this.errors=V.errors;return S}compile(Z,L){let V=this._addSchema(Z,L);return V.validate||this._compileSchemaEnv(V)}compileAsync(Z,L){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:V}=this.opts;return S.call(this,Z,L);async function S(rt,Pt){await b.call(this,rt.$schema);let C0=this._addSchema(rt,Pt);return C0.validate||P.call(this,C0)}async function b(rt){if(rt&&!this.getSchema(rt))await S.call(this,{$ref:rt},!0)}async function P(rt){try{return this._compileSchemaEnv(rt)}catch(Pt){if(!(Pt instanceof a.default))throw Pt;return X.call(this,Pt),await at.call(this,Pt.missingSchema),P.call(this,rt)}}function X({missingSchema:rt,missingRef:Pt}){if(this.refs[rt])throw Error(`AnySchema ${rt} is loaded but ${Pt} cannot be resolved`)}async function at(rt){let Pt=await lt.call(this,rt);if(!this.refs[rt])await b.call(this,Pt.$schema);if(!this.refs[rt])this.addSchema(Pt,rt,L)}async function lt(rt){let Pt=this._loading[rt];if(Pt)return Pt;try{return await(this._loading[rt]=V(rt))}finally{delete this._loading[rt]}}}addSchema(Z,L,V,S=this.opts.validateSchema){if(Array.isArray(Z)){for(let P of Z)this.addSchema(P,void 0,V,S);return this}let b;if(typeof Z==="object"){let{schemaId:P}=this.opts;if(b=Z[P],b!==void 0&&typeof b!="string")throw Error(`schema ${P} must be string`)}return L=(0,c.normalizeId)(L||b),this._checkUnique(L),this.schemas[L]=this._addSchema(Z,V,L,S,!0),this}addMetaSchema(Z,L,V=this.opts.validateSchema){return this.addSchema(Z,L,!0,V),this}validateSchema(Z,L){if(typeof Z=="boolean")return!0;let V;if(V=Z.$schema,V!==void 0&&typeof V!="string")throw Error("$schema must be a string");if(V=V||this.opts.defaultMeta||this.defaultMeta(),!V)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let S=this.validate(V,Z);if(!S&&L){let b="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(b);else throw Error(b)}return S}getSchema(Z){let L;while(typeof(L=T.call(this,Z))=="string")Z=L;if(L===void 0){let{schemaId:V}=this.opts,S=new i.SchemaEnv({schema:{},schemaId:V});if(L=i.resolveSchema.call(this,S,Z),!L)return;this.refs[Z]=L}return L.validate||this._compileSchemaEnv(L)}removeSchema(Z){if(Z instanceof RegExp)return this._removeAllSchemas(this.schemas,Z),this._removeAllSchemas(this.refs,Z),this;switch(typeof Z){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let L=T.call(this,Z);if(typeof L=="object")this._cache.delete(L.schema);return delete this.schemas[Z],delete this.refs[Z],this}case"object":{let L=Z;this._cache.delete(L);let V=Z[this.opts.schemaId];if(V)V=(0,c.normalizeId)(V),delete this.schemas[V],delete this.refs[V];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(Z){for(let L of Z)this.addKeyword(L);return this}addKeyword(Z,L){let V;if(typeof Z=="string"){if(V=Z,typeof L=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),L.keyword=V}else if(typeof Z=="object"&&L===void 0){if(L=Z,V=L.keyword,Array.isArray(V)&&!V.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(z.call(this,V,L),!L)return(0,E.eachItem)(V,(b)=>K.call(this,b)),this;Ot.call(this,L);let S={...L,type:(0,d.getJSONTypes)(L.type),schemaType:(0,d.getJSONTypes)(L.schemaType)};return(0,E.eachItem)(V,S.type.length===0?(b)=>K.call(this,b,S):(b)=>S.type.forEach((P)=>K.call(this,b,S,P))),this}getKeyword(Z){let L=this.RULES.all[Z];return typeof L=="object"?L.definition:!!L}removeKeyword(Z){let{RULES:L}=this;delete L.keywords[Z],delete L.all[Z];for(let V of L.rules){let S=V.rules.findIndex((b)=>b.keyword===Z);if(S>=0)V.rules.splice(S,1)}return this}addFormat(Z,L){if(typeof L=="string")L=new RegExp(L);return this.formats[Z]=L,this}errorsText(Z=this.errors,{separator:L=", ",dataVar:V="data"}={}){if(!Z||Z.length===0)return"No errors";return Z.map((S)=>`${V}${S.instancePath} ${S.message}`).reduce((S,b)=>S+L+b)}$dataMetaSchema(Z,L){let V=this.RULES.all;Z=JSON.parse(JSON.stringify(Z));for(let S of L){let b=S.split("/").slice(1),P=Z;for(let X of b)P=P[X];for(let X in V){let at=V[X];if(typeof at!="object")continue;let{$data:lt}=at.definition,rt=P[X];if(lt&&rt)P[X]=St(rt)}}return Z}_removeAllSchemas(Z,L){for(let V in Z){let S=Z[V];if(!L||L.test(V)){if(typeof S=="string")delete Z[V];else if(S&&!S.meta)this._cache.delete(S.schema),delete Z[V]}}}_addSchema(Z,L,V,S=this.opts.validateSchema,b=this.opts.addUsedSchema){let P,{schemaId:X}=this.opts;if(typeof Z=="object")P=Z[X];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof Z!="boolean")throw Error("schema must be object or boolean");let at=this._cache.get(Z);if(at!==void 0)return at;V=(0,c.normalizeId)(P||V);let lt=c.getSchemaRefs.call(this,Z,V);if(at=new i.SchemaEnv({schema:Z,schemaId:X,meta:L,baseId:V,localRefs:lt}),this._cache.set(at.schema,at),b&&!V.startsWith("#")){if(V)this._checkUnique(V);this.refs[V]=at}if(S)this.validateSchema(Z,!0);return at}_checkUnique(Z){if(this.schemas[Z]||this.refs[Z])throw Error(`schema with key or id "${Z}" already exists`)}_compileSchemaEnv(Z){if(Z.meta)this._compileMetaSchema(Z);else i.compileSchema.call(this,Z);if(!Z.validate)throw Error("ajv implementation error");return Z.validate}_compileMetaSchema(Z){let L=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,Z)}finally{this.opts=L}}}m.ValidationError=r.default,m.MissingRefError=a.default,t.default=m;function k(Z,L,V,S="error"){for(let b in Z){let P=b;if(P in L)this.logger[S](`${V}: option ${b}. ${Z[P]}`)}}function T(Z){return Z=(0,c.normalizeId)(Z),this.schemas[Z]||this.refs[Z]}function R(){let Z=this.opts.schemas;if(!Z)return;if(Array.isArray(Z))this.addSchema(Z);else for(let L in Z)this.addSchema(Z[L],L)}function C(){for(let Z in this.opts.formats){let L=this.opts.formats[Z];if(L)this.addFormat(Z,L)}}function F(Z){if(Array.isArray(Z)){this.addVocabulary(Z);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let L in Z){let V=Z[L];if(!V.keyword)V.keyword=L;this.addKeyword(V)}}function B(){let Z={...this.opts};for(let L of I)delete Z[L];return Z}var _={log(){},warn(){},error(){}};function N(Z){if(Z===!1)return _;if(Z===void 0)return console;if(Z.log&&Z.warn&&Z.error)return Z;throw Error("logger must implement log, warn and error methods")}var O=/^[a-z_$][a-z0-9_$:-]*$/i;function z(Z,L){let{RULES:V}=this;if((0,E.eachItem)(Z,(S)=>{if(V.keywords[S])throw Error(`Keyword ${S} is already defined`);if(!O.test(S))throw Error(`Keyword ${S} has invalid name`)}),!L)return;if(L.$data&&!(("code"in L)||("validate"in L)))throw Error('$data keyword must have "code" or "validate" function')}function K(Z,L,V){var S;let b=L===null||L===void 0?void 0:L.post;if(V&&b)throw Error('keyword with "post" flag cannot have "type"');let{RULES:P}=this,X=b?P.post:P.rules.find(({type:lt})=>lt===V);if(!X)X={type:V,rules:[]},P.rules.push(X);if(P.keywords[Z]=!0,!L)return;let at={keyword:Z,definition:{...L,type:(0,d.getJSONTypes)(L.type),schemaType:(0,d.getJSONTypes)(L.schemaType)}};if(L.before)Mt.call(this,X,at,L.before);else X.rules.push(at);P.all[Z]=at,(S=L.implements)===null||S===void 0||S.forEach((lt)=>this.addKeyword(lt))}function Mt(Z,L,V){let S=Z.rules.findIndex((b)=>b.keyword===V);if(S>=0)Z.rules.splice(S,0,L);else Z.rules.push(L),this.logger.warn(`rule ${V} is not defined`)}function Ot(Z){let{metaSchema:L}=Z;if(L===void 0)return;if(Z.$data&&this.opts.$data)L=St(L);Z.validateSchema=this.compile(L,!0)}var Ut={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function St(Z){return{anyOf:[Z,Ut]}}}),My=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=e}),Py=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;var e=zs(),s=M0(),r=pt(),a=$0(),n=tr(),i=Rt(),h={keyword:"$ref",schemaType:"string",code(E){let{gen:l,schema:p,it:f}=E,{baseId:I,schemaEnv:v,validateName:x,opts:o,self:u}=f,{root:y}=v;if((p==="#"||p==="#/")&&I===y.baseId)return k();let m=n.resolveRef.call(u,y,I,p);if(m===void 0)throw new e.default(f.opts.uriResolver,I,p);if(m instanceof n.SchemaEnv)return T(m);return R(m);function k(){if(v===y)return d(E,x,v,v.$async);let C=l.scopeValue("root",{ref:y});return d(E,r._`${C}.validate`,y,y.$async)}function T(C){let F=c(E,C);d(E,F,C,C.$async)}function R(C){let F=l.scopeValue("schema",o.code.source===!0?{ref:C,code:(0,r.stringify)(C)}:{ref:C}),B=l.name("valid"),_=E.subschema({schema:C,dataTypes:[],schemaPath:r.nil,topSchemaRef:F,errSchemaPath:p},B);E.mergeEvaluated(_),E.ok(B)}}};function c(E,l){let{gen:p}=E;return l.validate?p.scopeValue("validate",{ref:l.validate}):r._`${p.scopeValue("wrapper",{ref:l})}.validate`}t.getValidate=c;function d(E,l,p,f){let{gen:I,it:v}=E,{allErrors:x,schemaEnv:o,opts:u}=v,y=u.passContext?a.default.this:r.nil;if(f)m();else k();function m(){if(!o.$async)throw Error("async schema referenced by sync schema");let C=I.let("valid");I.try(()=>{if(I.code(r._`await ${(0,s.callValidateCode)(E,l,y)}`),R(l),!x)I.assign(C,!0)},(F)=>{if(I.if(r._`!(${F} instanceof ${v.ValidationError})`,()=>I.throw(F)),T(F),!x)I.assign(C,!1)}),E.ok(C)}function k(){E.result((0,s.callValidateCode)(E,l,y),()=>R(l),()=>T(l))}function T(C){let F=r._`${C}.errors`;I.assign(a.default.vErrors,r._`${a.default.vErrors} === null ? ${F} : ${a.default.vErrors}.concat(${F})`),I.assign(a.default.errors,r._`${a.default.vErrors}.length`)}function R(C){var F;if(!v.opts.unevaluated)return;let B=(F=p===null||p===void 0?void 0:p.validate)===null||F===void 0?void 0:F.evaluated;if(v.props!==!0)if(B&&!B.dynamicProps){if(B.props!==void 0)v.props=i.mergeEvaluated.props(I,B.props,v.props)}else{let _=I.var("props",r._`${C}.evaluated.props`);v.props=i.mergeEvaluated.props(I,_,v.props,r.Name)}if(v.items!==!0)if(B&&!B.dynamicItems){if(B.items!==void 0)v.items=i.mergeEvaluated.items(I,B.items,v.items)}else{let _=I.var("items",r._`${C}.evaluated.items`);v.items=i.mergeEvaluated.items(I,_,v.items,r.Name)}}}t.callRef=d,t.default=h}),Ly=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=My(),s=Py(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,s.default];t.default=r}),jy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s=e.operators,r={maximum:{okStr:"<=",ok:s.LTE,fail:s.GT},minimum:{okStr:">=",ok:s.GTE,fail:s.LT},exclusiveMaximum:{okStr:"<",ok:s.LT,fail:s.GTE},exclusiveMinimum:{okStr:">",ok:s.GT,fail:s.LTE}},a={message:({keyword:i,schemaCode:h})=>e.str`must be ${r[i].okStr} ${h}`,params:({keyword:i,schemaCode:h})=>e._`{comparison: ${r[i].okStr}, limit: ${h}}`},n={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:a,code(i){let{keyword:h,data:c,schemaCode:d}=i;i.fail$data(e._`${c} ${r[h].fail} ${d} || isNaN(${c})`)}};t.default=n}),qy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s={message:({schemaCode:a})=>e.str`must be multiple of ${a}`,params:({schemaCode:a})=>e._`{multipleOf: ${a}}`},r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:s,code(a){let{gen:n,data:i,schemaCode:h,it:c}=a,d=c.opts.multipleOfPrecision,E=n.let("res"),l=d?e._`Math.abs(Math.round(${E}) - ${E}) > 1e-${d}`:e._`${E} !== parseInt(${E})`;a.fail$data(e._`(${h} === 0 || (${E} = ${i}/${h}, ${l}))`)}};t.default=r}),_y=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});function e(s){let r=s.length,a=0,n=0,i;while(n<r)if(a++,i=s.charCodeAt(n++),i>=55296&&i<=56319&&n<r){if(i=s.charCodeAt(n),(i&64512)===56320)n++}return a}t.default=e,e.code='require("ajv/dist/runtime/ucs2length").default'}),Dy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s=Rt(),r=_y(),a={message({keyword:i,schemaCode:h}){let c=i==="maxLength"?"more":"fewer";return e.str`must NOT have ${c} than ${h} characters`},params:({schemaCode:i})=>e._`{limit: ${i}}`},n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:a,code(i){let{keyword:h,data:c,schemaCode:d,it:E}=i,l=h==="maxLength"?e.operators.GT:e.operators.LT,p=E.opts.unicode===!1?e._`${c}.length`:e._`${(0,s.useFunc)(i.gen,r.default)}(${c})`;i.fail$data(e._`${p} ${l} ${d}`)}};t.default=n}),By=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=M0(),s=Rt(),r=pt(),a={message:({schemaCode:i})=>r.str`must match pattern "${i}"`,params:({schemaCode:i})=>r._`{pattern: ${i}}`},n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:a,code(i){let{gen:h,data:c,$data:d,schema:E,schemaCode:l,it:p}=i,f=p.opts.unicodeRegExp?"u":"";if(d){let{regExp:I}=p.opts.code,v=I.code==="new RegExp"?r._`new RegExp`:(0,s.useFunc)(h,I),x=h.let("valid");h.try(()=>h.assign(x,r._`${v}(${l}, ${f}).test(${c})`),()=>h.assign(x,!1)),i.fail$data(r._`!${x}`)}else{let I=(0,e.usePattern)(i,E);i.fail$data(r._`!${I}.test(${c})`)}}};t.default=n}),Vy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s={message({keyword:a,schemaCode:n}){let i=a==="maxProperties"?"more":"fewer";return e.str`must NOT have ${i} than ${n} properties`},params:({schemaCode:a})=>e._`{limit: ${a}}`},r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:s,code(a){let{keyword:n,data:i,schemaCode:h}=a,c=n==="maxProperties"?e.operators.GT:e.operators.LT;a.fail$data(e._`Object.keys(${i}).length ${c} ${h}`)}};t.default=r}),Ny=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=M0(),s=pt(),r=Rt(),a={message:({params:{missingProperty:i}})=>s.str`must have required property '${i}'`,params:({params:{missingProperty:i}})=>s._`{missingProperty: ${i}}`},n={keyword:"required",type:"object",schemaType:"array",$data:!0,error:a,code(i){let{gen:h,schema:c,schemaCode:d,data:E,$data:l,it:p}=i,{opts:f}=p;if(!l&&c.length===0)return;let I=c.length>=f.loopRequired;if(p.allErrors)v();else x();if(f.strictRequired){let y=i.parentSchema.properties,{definedProperties:m}=i.it;for(let k of c)if((y===null||y===void 0?void 0:y[k])===void 0&&!m.has(k)){let T=p.schemaEnv.baseId+p.errSchemaPath,R=`required property "${k}" is not defined at "${T}" (strictRequired)`;(0,r.checkStrictMode)(p,R,p.opts.strictRequired)}}function v(){if(I||l)i.block$data(s.nil,o);else for(let y of c)(0,e.checkReportMissingProp)(i,y)}function x(){let y=h.let("missing");if(I||l){let m=h.let("valid",!0);i.block$data(m,()=>u(y,m)),i.ok(m)}else h.if((0,e.checkMissingProp)(i,c,y)),(0,e.reportMissingProp)(i,y),h.else()}function o(){h.forOf("prop",d,(y)=>{i.setParams({missingProperty:y}),h.if((0,e.noPropertyInData)(h,E,y,f.ownProperties),()=>i.error())})}function u(y,m){i.setParams({missingProperty:y}),h.forOf(y,d,()=>{h.assign(m,(0,e.propertyInData)(h,E,y,f.ownProperties)),h.if((0,s.not)(m),()=>{i.error(),h.break()})},s.nil)}}};t.default=n}),wy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s={message({keyword:a,schemaCode:n}){let i=a==="maxItems"?"more":"fewer";return e.str`must NOT have ${i} than ${n} items`},params:({schemaCode:a})=>e._`{limit: ${a}}`},r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:s,code(a){let{keyword:n,data:i,schemaCode:h}=a,c=n==="maxItems"?e.operators.GT:e.operators.LT;a.fail$data(e._`${i}.length ${c} ${h}`)}};t.default=r}),er=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Nh();e.code='require("ajv/dist/runtime/equal").default',t.default=e}),Ky=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=fs(),s=pt(),r=Rt(),a=er(),n={message:({params:{i:h,j:c}})=>s.str`must NOT have duplicate items (items ## ${c} and ${h} are identical)`,params:({params:{i:h,j:c}})=>s._`{i: ${h}, j: ${c}}`},i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:n,code(h){let{gen:c,data:d,$data:E,schema:l,parentSchema:p,schemaCode:f,it:I}=h;if(!E&&!l)return;let v=c.let("valid"),x=p.items?(0,e.getSchemaTypes)(p.items):[];h.block$data(v,o,s._`${f} === false`),h.ok(v);function o(){let k=c.let("i",s._`${d}.length`),T=c.let("j");h.setParams({i:k,j:T}),c.assign(v,!0),c.if(s._`${k} > 1`,()=>(u()?y:m)(k,T))}function u(){return x.length>0&&!x.some((k)=>k==="object"||k==="array")}function y(k,T){let R=c.name("item"),C=(0,e.checkDataTypes)(x,R,I.opts.strictNumbers,e.DataType.Wrong),F=c.const("indices",s._`{}`);c.for(s._`;${k}--;`,()=>{if(c.let(R,s._`${d}[${k}]`),c.if(C,s._`continue`),x.length>1)c.if(s._`typeof ${R} == "string"`,s._`${R} += "_"`);c.if(s._`typeof ${F}[${R}] == "number"`,()=>{c.assign(T,s._`${F}[${R}]`),h.error(),c.assign(v,!1).break()}).code(s._`${F}[${R}] = ${k}`)})}function m(k,T){let R=(0,r.useFunc)(c,a.default),C=c.name("outer");c.label(C).for(s._`;${k}--;`,()=>c.for(s._`${T} = ${k}; ${T}--;`,()=>c.if(s._`${R}(${d}[${k}], ${d}[${T}])`,()=>{h.error(),c.assign(v,!1).break(C)})))}}};t.default=i}),Hy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s=Rt(),r=er(),a={message:"must be equal to constant",params:({schemaCode:i})=>e._`{allowedValue: ${i}}`},n={keyword:"const",$data:!0,error:a,code(i){let{gen:h,data:c,$data:d,schemaCode:E,schema:l}=i;if(d||l&&typeof l=="object")i.fail$data(e._`!${(0,s.useFunc)(h,r.default)}(${c}, ${E})`);else i.fail(e._`${l} !== ${c}`)}};t.default=n}),Oy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s=Rt(),r=er(),a={message:"must be equal to one of the allowed values",params:({schemaCode:i})=>e._`{allowedValues: ${i}}`},n={keyword:"enum",schemaType:"array",$data:!0,error:a,code(i){let{gen:h,data:c,$data:d,schema:E,schemaCode:l,it:p}=i;if(!d&&E.length===0)throw Error("enum must have non-empty array");let f=E.length>=p.opts.loopEnum,I,v=()=>I!==null&&I!==void 0?I:I=(0,s.useFunc)(h,r.default),x;if(f||d)x=h.let("valid"),i.block$data(x,o);else{if(!Array.isArray(E))throw Error("ajv implementation error");let y=h.const("vSchema",l);x=(0,e.or)(...E.map((m,k)=>u(y,k)))}i.pass(x);function o(){h.assign(x,!1),h.forOf("v",l,(y)=>h.if(e._`${v()}(${c}, ${y})`,()=>h.assign(x,!0).break()))}function u(y,m){let k=E[m];return typeof k==="object"&&k!==null?e._`${v()}(${c}, ${y}[${m}])`:e._`${c} === ${k}`}}};t.default=n}),Uy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=jy(),s=qy(),r=Dy(),a=By(),n=Vy(),i=Ny(),h=wy(),c=Ky(),d=Hy(),E=Oy(),l=[e.default,s.default,r.default,a.default,n.default,i.default,h.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,E.default];t.default=l}),wh=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;var e=pt(),s=Rt(),r={message:({params:{len:i}})=>e.str`must NOT have more than ${i} items`,params:({params:{len:i}})=>e._`{limit: ${i}}`},a={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:r,code(i){let{parentSchema:h,it:c}=i,{items:d}=h;if(!Array.isArray(d)){(0,s.checkStrictMode)(c,'"additionalItems" is ignored when "items" is not an array of schemas');return}n(i,d)}};function n(i,h){let{gen:c,schema:d,data:E,keyword:l,it:p}=i;p.items=!0;let f=c.const("len",e._`${E}.length`);if(d===!1)i.setParams({len:h.length}),i.pass(e._`${f} <= ${h.length}`);else if(typeof d=="object"&&!(0,s.alwaysValidSchema)(p,d)){let v=c.var("valid",e._`${f} <= ${h.length}`);c.if((0,e.not)(v),()=>I(v)),i.ok(v)}function I(v){c.forRange("i",h.length,f,(x)=>{if(i.subschema({keyword:l,dataProp:x,dataPropType:s.Type.Num},v),!p.allErrors)c.if((0,e.not)(v),()=>c.break())})}}t.validateAdditionalItems=n,t.default=a}),Kh=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;var e=pt(),s=Rt(),r=M0(),a={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){let{schema:h,it:c}=i;if(Array.isArray(h))return n(i,"additionalItems",h);if(c.items=!0,(0,s.alwaysValidSchema)(c,h))return;i.ok((0,r.validateArray)(i))}};function n(i,h,c=i.schema){let{gen:d,parentSchema:E,data:l,keyword:p,it:f}=i;if(x(E),f.opts.unevaluated&&c.length&&f.items!==!0)f.items=s.mergeEvaluated.items(d,c.length,f.items);let I=d.name("valid"),v=d.const("len",e._`${l}.length`);c.forEach((o,u)=>{if((0,s.alwaysValidSchema)(f,o))return;d.if(e._`${v} > ${u}`,()=>i.subschema({keyword:p,schemaProp:u,dataProp:u},I)),i.ok(I)});function x(o){let{opts:u,errSchemaPath:y}=f,m=c.length,k=m===o.minItems&&(m===o.maxItems||o[h]===!1);if(u.strictTuples&&!k){let T=`"${p}" is ${m}-tuple, but minItems or maxItems/${h} are not specified or different at path "${y}"`;(0,s.checkStrictMode)(f,T,u.strictTuples)}}}t.validateTuple=n,t.default=a}),Gy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Kh(),s={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(r)=>(0,e.validateTuple)(r,"items")};t.default=s}),Wy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s=Rt(),r=M0(),a=wh(),n={message:({params:{len:h}})=>e.str`must NOT have more than ${h} items`,params:({params:{len:h}})=>e._`{limit: ${h}}`},i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:n,code(h){let{schema:c,parentSchema:d,it:E}=h,{prefixItems:l}=d;if(E.items=!0,(0,s.alwaysValidSchema)(E,c))return;if(l)(0,a.validateAdditionalItems)(h,l);else h.ok((0,r.validateArray)(h))}};t.default=i}),zy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s=Rt(),r={message:({params:{min:n,max:i}})=>i===void 0?e.str`must contain at least ${n} valid item(s)`:e.str`must contain at least ${n} and no more than ${i} valid item(s)`,params:({params:{min:n,max:i}})=>i===void 0?e._`{minContains: ${n}}`:e._`{minContains: ${n}, maxContains: ${i}}`},a={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:r,code(n){let{gen:i,schema:h,parentSchema:c,data:d,it:E}=n,l,p,{minContains:f,maxContains:I}=c;if(E.opts.next)l=f===void 0?1:f,p=I;else l=1;let v=i.const("len",e._`${d}.length`);if(n.setParams({min:l,max:p}),p===void 0&&l===0){(0,s.checkStrictMode)(E,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&l>p){(0,s.checkStrictMode)(E,'"minContains" > "maxContains" is always invalid'),n.fail();return}if((0,s.alwaysValidSchema)(E,h)){let m=e._`${v} >= ${l}`;if(p!==void 0)m=e._`${m} && ${v} <= ${p}`;n.pass(m);return}E.items=!0;let x=i.name("valid");if(p===void 0&&l===1)u(x,()=>i.if(x,()=>i.break()));else if(l===0){if(i.let(x,!0),p!==void 0)i.if(e._`${d}.length > 0`,o)}else i.let(x,!1),o();n.result(x,()=>n.reset());function o(){let m=i.name("_valid"),k=i.let("count",0);u(m,()=>i.if(m,()=>y(k)))}function u(m,k){i.forRange("i",0,v,(T)=>{n.subschema({keyword:"contains",dataProp:T,dataPropType:s.Type.Num,compositeRule:!0},m),k()})}function y(m){if(i.code(e._`${m}++`),p===void 0)i.if(e._`${m} >= ${l}`,()=>i.assign(x,!0).break());else if(i.if(e._`${m} > ${p}`,()=>i.assign(x,!1).break()),l===1)i.assign(x,!0);else i.if(e._`${m} >= ${l}`,()=>i.assign(x,!0))}}};t.default=a}),Qy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;var e=pt(),s=Rt(),r=M0();t.error={message:({params:{property:c,depsCount:d,deps:E}})=>{let l=d===1?"property":"properties";return e.str`must have ${l} ${E} when property ${c} is present`},params:({params:{property:c,depsCount:d,deps:E,missingProperty:l}})=>e._`{property: ${c},
|
|
7
|
-
missingProperty: ${l},
|
|
8
|
-
depsCount: ${d},
|
|
9
|
-
deps: ${E}}`};var a={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(c){let[d,E]=n(c);i(c,d),h(c,E)}};function n({schema:c}){let d={},E={};for(let l in c){if(l==="__proto__")continue;let p=Array.isArray(c[l])?d:E;p[l]=c[l]}return[d,E]}function i(c,d=c.schema){let{gen:E,data:l,it:p}=c;if(Object.keys(d).length===0)return;let f=E.let("missing");for(let I in d){let v=d[I];if(v.length===0)continue;let x=(0,r.propertyInData)(E,l,I,p.opts.ownProperties);if(c.setParams({property:I,depsCount:v.length,deps:v.join(", ")}),p.allErrors)E.if(x,()=>{for(let o of v)(0,r.checkReportMissingProp)(c,o)});else E.if(e._`${x} && (${(0,r.checkMissingProp)(c,v,f)})`),(0,r.reportMissingProp)(c,f),E.else()}}t.validatePropertyDeps=i;function h(c,d=c.schema){let{gen:E,data:l,keyword:p,it:f}=c,I=E.name("valid");for(let v in d){if((0,s.alwaysValidSchema)(f,d[v]))continue;E.if((0,r.propertyInData)(E,l,v,f.opts.ownProperties),()=>{let x=c.subschema({keyword:p,schemaProp:v},I);c.mergeValidEvaluated(x,I)},()=>E.var(I,!0)),c.ok(I)}}t.validateSchemaDeps=h,t.default=a}),Jy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s=Rt(),r={message:"property name must be valid",params:({params:n})=>e._`{propertyName: ${n.propertyName}}`},a={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:r,code(n){let{gen:i,schema:h,data:c,it:d}=n;if((0,s.alwaysValidSchema)(d,h))return;let E=i.name("valid");i.forIn("key",c,(l)=>{n.setParams({propertyName:l}),n.subschema({keyword:"propertyNames",data:l,dataTypes:["string"],propertyName:l,compositeRule:!0},E),i.if((0,e.not)(E),()=>{if(n.error(!0),!d.allErrors)i.break()})}),n.ok(E)}};t.default=a}),Hh=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=M0(),s=pt(),r=$0(),a=Rt(),n={message:"must NOT have additional properties",params:({params:h})=>s._`{additionalProperty: ${h.additionalProperty}}`},i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:n,code(h){let{gen:c,schema:d,parentSchema:E,data:l,errsCount:p,it:f}=h;if(!p)throw Error("ajv implementation error");let{allErrors:I,opts:v}=f;if(f.props=!0,v.removeAdditional!=="all"&&(0,a.alwaysValidSchema)(f,d))return;let x=(0,e.allSchemaProperties)(E.properties),o=(0,e.allSchemaProperties)(E.patternProperties);u(),h.ok(s._`${p} === ${r.default.errors}`);function u(){c.forIn("key",l,(R)=>{if(!x.length&&!o.length)k(R);else c.if(y(R),()=>k(R))})}function y(R){let C;if(x.length>8){let F=(0,a.schemaRefOrVal)(f,E.properties,"properties");C=(0,e.isOwnProperty)(c,F,R)}else if(x.length)C=(0,s.or)(...x.map((F)=>s._`${R} === ${F}`));else C=s.nil;if(o.length)C=(0,s.or)(C,...o.map((F)=>s._`${(0,e.usePattern)(h,F)}.test(${R})`));return(0,s.not)(C)}function m(R){c.code(s._`delete ${l}[${R}]`)}function k(R){if(v.removeAdditional==="all"||v.removeAdditional&&d===!1){m(R);return}if(d===!1){if(h.setParams({additionalProperty:R}),h.error(),!I)c.break();return}if(typeof d=="object"&&!(0,a.alwaysValidSchema)(f,d)){let C=c.name("valid");if(v.removeAdditional==="failing")T(R,C,!1),c.if((0,s.not)(C),()=>{h.reset(),m(R)});else if(T(R,C),!I)c.if((0,s.not)(C),()=>c.break())}}function T(R,C,F){let B={keyword:"additionalProperties",dataProp:R,dataPropType:a.Type.Str};if(F===!1)Object.assign(B,{compositeRule:!0,createErrors:!1,allErrors:!1});h.subschema(B,C)}}};t.default=i}),Yy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Ws(),s=M0(),r=Rt(),a=Hh(),n={keyword:"properties",type:"object",schemaType:"object",code(i){let{gen:h,schema:c,parentSchema:d,data:E,it:l}=i;if(l.opts.removeAdditional==="all"&&d.additionalProperties===void 0)a.default.code(new e.KeywordCxt(l,a.default,"additionalProperties"));let p=(0,s.allSchemaProperties)(c);for(let o of p)l.definedProperties.add(o);if(l.opts.unevaluated&&p.length&&l.props!==!0)l.props=r.mergeEvaluated.props(h,(0,r.toHash)(p),l.props);let f=p.filter((o)=>!(0,r.alwaysValidSchema)(l,c[o]));if(f.length===0)return;let I=h.name("valid");for(let o of f){if(v(o))x(o);else{if(h.if((0,s.propertyInData)(h,E,o,l.opts.ownProperties)),x(o),!l.allErrors)h.else().var(I,!0);h.endIf()}i.it.definedProperties.add(o),i.ok(I)}function v(o){return l.opts.useDefaults&&!l.compositeRule&&c[o].default!==void 0}function x(o){i.subschema({keyword:"properties",schemaProp:o,dataProp:o},I)}}};t.default=n}),Xy=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=M0(),s=pt(),r=Rt(),a=Rt(),n={keyword:"patternProperties",type:"object",schemaType:"object",code(i){let{gen:h,schema:c,data:d,parentSchema:E,it:l}=i,{opts:p}=l,f=(0,e.allSchemaProperties)(c),I=f.filter((k)=>(0,r.alwaysValidSchema)(l,c[k]));if(f.length===0||I.length===f.length&&(!l.opts.unevaluated||l.props===!0))return;let v=p.strictSchema&&!p.allowMatchingProperties&&E.properties,x=h.name("valid");if(l.props!==!0&&!(l.props instanceof s.Name))l.props=(0,a.evaluatedPropsToName)(h,l.props);let{props:o}=l;u();function u(){for(let k of f){if(v)y(k);if(l.allErrors)m(k);else h.var(x,!0),m(k),h.if(x)}}function y(k){for(let T in v)if(new RegExp(k).test(T))(0,r.checkStrictMode)(l,`property ${T} matches pattern ${k} (use allowMatchingProperties)`)}function m(k){h.forIn("key",d,(T)=>{h.if(s._`${(0,e.usePattern)(i,k)}.test(${T})`,()=>{let R=I.includes(k);if(!R)i.subschema({keyword:"patternProperties",schemaProp:k,dataProp:T,dataPropType:a.Type.Str},x);if(l.opts.unevaluated&&o!==!0)h.assign(s._`${o}[${T}]`,!0);else if(!R&&!l.allErrors)h.if((0,s.not)(x),()=>h.break())})})}}};t.default=n}),$y=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Rt(),s={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(r){let{gen:a,schema:n,it:i}=r;if((0,e.alwaysValidSchema)(i,n)){r.fail();return}let h=a.name("valid");r.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},h),r.failResult(h,()=>r.reset(),()=>r.error())},error:{message:"must NOT be valid"}};t.default=s}),t8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=M0(),s={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:e.validateUnion,error:{message:"must match a schema in anyOf"}};t.default=s}),e8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s=Rt(),r={message:"must match exactly one schema in oneOf",params:({params:n})=>e._`{passingSchemas: ${n.passing}}`},a={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:r,code(n){let{gen:i,schema:h,parentSchema:c,it:d}=n;if(!Array.isArray(h))throw Error("ajv implementation error");if(d.opts.discriminator&&c.discriminator)return;let E=h,l=i.let("valid",!1),p=i.let("passing",null),f=i.name("_valid");n.setParams({passing:p}),i.block(I),n.result(l,()=>n.reset(),()=>n.error(!0));function I(){E.forEach((v,x)=>{let o;if((0,s.alwaysValidSchema)(d,v))i.var(f,!0);else o=n.subschema({keyword:"oneOf",schemaProp:x,compositeRule:!0},f);if(x>0)i.if(e._`${f} && ${l}`).assign(l,!1).assign(p,e._`[${p}, ${x}]`).else();i.if(f,()=>{if(i.assign(l,!0),i.assign(p,x),o)n.mergeEvaluated(o,e.Name)})})}}};t.default=a}),a8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Rt(),s={keyword:"allOf",schemaType:"array",code(r){let{gen:a,schema:n,it:i}=r;if(!Array.isArray(n))throw Error("ajv implementation error");let h=a.name("valid");n.forEach((c,d)=>{if((0,e.alwaysValidSchema)(i,c))return;let E=r.subschema({keyword:"allOf",schemaProp:d},h);r.ok(h),r.mergeEvaluated(E)})}};t.default=s}),s8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s=Rt(),r={message:({params:i})=>e.str`must match "${i.ifClause}" schema`,params:({params:i})=>e._`{failingKeyword: ${i.ifClause}}`},a={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:r,code(i){let{gen:h,parentSchema:c,it:d}=i;if(c.then===void 0&&c.else===void 0)(0,s.checkStrictMode)(d,'"if" without "then" and "else" is ignored');let E=n(d,"then"),l=n(d,"else");if(!E&&!l)return;let p=h.let("valid",!0),f=h.name("_valid");if(I(),i.reset(),E&&l){let x=h.let("ifClause");i.setParams({ifClause:x}),h.if(f,v("then",x),v("else",x))}else if(E)h.if(f,v("then"));else h.if((0,e.not)(f),v("else"));i.pass(p,()=>i.error(!0));function I(){let x=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);i.mergeEvaluated(x)}function v(x,o){return()=>{let u=i.subschema({keyword:x},f);if(h.assign(p,f),i.mergeValidEvaluated(u,p),o)h.assign(o,e._`${x}`);else i.setParams({ifClause:x})}}}};function n(i,h){let c=i.schema[h];return c!==void 0&&!(0,s.alwaysValidSchema)(i,c)}t.default=a}),r8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Rt(),s={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:r,parentSchema:a,it:n}){if(a.if===void 0)(0,e.checkStrictMode)(n,`"${r}" without "if" is ignored`)}};t.default=s}),n8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=wh(),s=Gy(),r=Kh(),a=Wy(),n=zy(),i=Qy(),h=Jy(),c=Hh(),d=Yy(),E=Xy(),l=$y(),p=t8(),f=e8(),I=a8(),v=s8(),x=r8();function o(u=!1){let y=[l.default,p.default,f.default,I.default,v.default,x.default,h.default,c.default,i.default,d.default,E.default];if(u)y.push(s.default,a.default);else y.push(e.default,r.default);return y.push(n.default),y}t.default=o}),i8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s={message:({schemaCode:a})=>e.str`must match format "${a}"`,params:({schemaCode:a})=>e._`{format: ${a}}`},r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:s,code(a,n){let{gen:i,data:h,$data:c,schema:d,schemaCode:E,it:l}=a,{opts:p,errSchemaPath:f,schemaEnv:I,self:v}=l;if(!p.validateFormats)return;if(c)x();else o();function x(){let u=i.scopeValue("formats",{ref:v.formats,code:p.code.formats}),y=i.const("fDef",e._`${u}[${E}]`),m=i.let("fType"),k=i.let("format");i.if(e._`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>i.assign(m,e._`${y}.type || "string"`).assign(k,e._`${y}.validate`),()=>i.assign(m,e._`"string"`).assign(k,y)),a.fail$data((0,e.or)(T(),R()));function T(){if(p.strictSchema===!1)return e.nil;return e._`${E} && !${k}`}function R(){let C=I.$async?e._`(${y}.async ? await ${k}(${h}) : ${k}(${h}))`:e._`${k}(${h})`,F=e._`(typeof ${k} == "function" ? ${C} : ${k}.test(${h}))`;return e._`${k} && ${k} !== true && ${m} === ${n} && !${F}`}}function o(){let u=v.formats[d];if(!u){T();return}if(u===!0)return;let[y,m,k]=R(u);if(y===n)a.pass(C());function T(){if(p.strictSchema===!1){v.logger.warn(F());return}throw Error(F());function F(){return`unknown format "${d}" ignored in schema at path "${f}"`}}function R(F){let B=F instanceof RegExp?(0,e.regexpCode)(F):p.code.formats?e._`${p.code.formats}${(0,e.getProperty)(d)}`:void 0,_=i.scopeValue("formats",{key:d,ref:F,code:B});if(typeof F=="object"&&!(F instanceof RegExp))return[F.type||"string",F.validate,e._`${_}.validate`];return["string",F,_]}function C(){if(typeof u=="object"&&!(u instanceof RegExp)&&u.async){if(!I.$async)throw Error("async format in sync schema");return e._`await ${k}(${h})`}return typeof m=="function"?e._`${k}(${h})`:e._`${k}.test(${h})`}}}};t.default=r}),h8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=i8(),s=[e.default];t.default=s}),c8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),d8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Ly(),s=Uy(),r=n8(),a=h8(),n=c8(),i=[e.default,s.default,(0,r.default)(),a.default,n.metadataVocabulary,n.contentVocabulary];t.default=i}),o8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0;var e;(function(s){s.Tag="tag",s.Mapping="mapping"})(e||(t.DiscrError=e={}))}),y8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pt(),s=o8(),r=tr(),a=zs(),n=Rt(),i={message:({params:{discrError:c,tagName:d}})=>c===s.DiscrError.Tag?`tag "${d}" must be string`:`value of tag "${d}" must be in oneOf`,params:({params:{discrError:c,tag:d,tagName:E}})=>e._`{error: ${c}, tag: ${E}, tagValue: ${d}}`},h={keyword:"discriminator",type:"object",schemaType:"object",error:i,code(c){let{gen:d,data:E,schema:l,parentSchema:p,it:f}=c,{oneOf:I}=p;if(!f.opts.discriminator)throw Error("discriminator: requires discriminator option");let v=l.propertyName;if(typeof v!="string")throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!I)throw Error("discriminator: requires oneOf keyword");let x=d.let("valid",!1),o=d.const("tag",e._`${E}${(0,e.getProperty)(v)}`);d.if(e._`typeof ${o} == "string"`,()=>u(),()=>c.error(!1,{discrError:s.DiscrError.Tag,tag:o,tagName:v})),c.ok(x);function u(){let k=m();d.if(!1);for(let T in k)d.elseIf(e._`${o} === ${T}`),d.assign(x,y(k[T]));d.else(),c.error(!1,{discrError:s.DiscrError.Mapping,tag:o,tagName:v}),d.endIf()}function y(k){let T=d.name("valid"),R=c.subschema({keyword:"oneOf",schemaProp:k},T);return c.mergeEvaluated(R,e.Name),T}function m(){var k;let T={},R=F(p),C=!0;for(let N=0;N<I.length;N++){let O=I[N];if((O===null||O===void 0?void 0:O.$ref)&&!(0,n.schemaHasRulesButRef)(O,f.self.RULES)){let K=O.$ref;if(O=r.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,K),O instanceof r.SchemaEnv)O=O.schema;if(O===void 0)throw new a.default(f.opts.uriResolver,f.baseId,K)}let z=(k=O===null||O===void 0?void 0:O.properties)===null||k===void 0?void 0:k[v];if(typeof z!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${v}"`);C=C&&(R||F(O)),B(z,N)}if(!C)throw Error(`discriminator: "${v}" must be required`);return T;function F({required:N}){return Array.isArray(N)&&N.includes(v)}function B(N,O){if(N.const)_(N.const,O);else if(N.enum)for(let z of N.enum)_(z,O);else throw Error(`discriminator: "properties/${v}" must have "const" or "enum"`)}function _(N,O){if(typeof N!="string"||N in T)throw Error(`discriminator: "${v}" values must be unique strings`);T[N]=O}}}};t.default=h}),m8=W((t,e)=>{e.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}}),Oh=W((t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;var s=Fy(),r=d8(),a=y8(),n=m8(),i=["/properties"],h="http://json-schema.org/draft-07/schema";class c extends s.default{_addVocabularies(){if(super._addVocabularies(),r.default.forEach((f)=>this.addVocabulary(f)),this.opts.discriminator)this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let f=this.opts.$data?this.$dataMetaSchema(n,i):n;this.addMetaSchema(f,h,!1),this.refs["http://json-schema.org/schema"]=h}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(h)?h:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var d=Ws();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var E=pt();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return E._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return E.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return E.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return E.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return E.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return E.CodeGen}});var l=$3();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return l.default}});var p=zs();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),p8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(_,N){return{validate:_,compare:N}}t.fullFormats={date:e(n,i),time:e(c(!0),d),"date-time":e(p(!0),f),"iso-time":e(c(),E),"iso-date-time":e(p(),I),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:o,"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:B,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:y,int32:{type:"number",validate:T},int64:{type:"number",validate:R},float:{type:"number",validate:C},double:{type:"number",validate:C},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,d),"date-time":e(/^\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,f),"iso-time":e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,E),"iso-date-time":e(/^\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,I),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);function s(_){return _%4===0&&(_%100!==0||_%400===0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function n(_){let N=r.exec(_);if(!N)return!1;let O=+N[1],z=+N[2],K=+N[3];return z>=1&&z<=12&&K>=1&&K<=(z===2&&s(O)?29:a[z])}function i(_,N){if(!(_&&N))return;if(_>N)return 1;if(_<N)return-1;return 0}var h=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(_){return function(N){let O=h.exec(N);if(!O)return!1;let z=+O[1],K=+O[2],Mt=+O[3],Ot=O[4],Ut=O[5]==="-"?-1:1,St=+(O[6]||0),Z=+(O[7]||0);if(St>23||Z>59||_&&!Ot)return!1;if(z<=23&&K<=59&&Mt<60)return!0;let L=K-Z*Ut,V=z-St*Ut-(L<0?1:0);return(V===23||V===-1)&&(L===59||L===-1)&&Mt<61}}function d(_,N){if(!(_&&N))return;let O=new Date("2020-01-01T"+_).valueOf(),z=new Date("2020-01-01T"+N).valueOf();if(!(O&&z))return;return O-z}function E(_,N){if(!(_&&N))return;let O=h.exec(_),z=h.exec(N);if(!(O&&z))return;if(_=O[1]+O[2]+O[3],N=z[1]+z[2]+z[3],_>N)return 1;if(_<N)return-1;return 0}var l=/t|\s/i;function p(_){let N=c(_);return function(O){let z=O.split(l);return z.length===2&&n(z[0])&&N(z[1])}}function f(_,N){if(!(_&&N))return;let O=new Date(_).valueOf(),z=new Date(N).valueOf();if(!(O&&z))return;return O-z}function I(_,N){if(!(_&&N))return;let[O,z]=_.split(l),[K,Mt]=N.split(l),Ot=i(O,K);if(Ot===void 0)return;return Ot||d(z,Mt)}var v=/\/|:/,x=/^(?:[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 o(_){return v.test(_)&&x.test(_)}var u=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(_){return u.lastIndex=0,u.test(_)}var m=-2147483648,k=2147483647;function T(_){return Number.isInteger(_)&&_<=k&&_>=m}function R(_){return Number.isInteger(_)}function C(){return!0}var F=/[^\\]\\Z/;function B(_){if(F.test(_))return!1;try{return new RegExp(_),!0}catch(N){return!1}}}),E8=W((t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;var e=Oh(),s=pt(),r=s.operators,a={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}},n={message:({keyword:h,schemaCode:c})=>s.str`should be ${a[h].okStr} ${c}`,params:({keyword:h,schemaCode:c})=>s._`{comparison: ${a[h].okStr}, limit: ${c}}`};t.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:n,code(h){let{gen:c,data:d,schemaCode:E,keyword:l,it:p}=h,{opts:f,self:I}=p;if(!f.validateFormats)return;let v=new e.KeywordCxt(p,I.RULES.all.format.definition,"format");if(v.$data)x();else o();function x(){let y=c.scopeValue("formats",{ref:I.formats,code:f.code.formats}),m=c.const("fmt",s._`${y}[${v.schemaCode}]`);h.fail$data((0,s.or)(s._`typeof ${m} != "object"`,s._`${m} instanceof RegExp`,s._`typeof ${m}.compare != "function"`,u(m)))}function o(){let y=v.schema,m=I.formats[y];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${l}": format "${y}" does not define "compare" function`);let k=c.scopeValue("formats",{key:y,ref:m,code:f.code.formats?s._`${f.code.formats}${(0,s.getProperty)(y)}`:void 0});h.fail$data(u(k))}function u(y){return s._`${y}.compare(${d}, ${E}) ${a[l].fail} 0`}},dependencies:["format"]};var i=(h)=>{return h.addKeyword(t.formatLimitDefinition),h};t.default=i}),u8=W((t,e)=>{Object.defineProperty(t,"__esModule",{value:!0});var s=p8(),r=E8(),a=pt(),n=new a.Name("fullFormats"),i=new a.Name("fastFormats"),h=(d,E={keywords:!0})=>{if(Array.isArray(E))return c(d,E,s.fullFormats,n),d;let[l,p]=E.mode==="fast"?[s.fastFormats,i]:[s.fullFormats,n],f=E.formats||s.formatNames;if(c(d,f,l,p),E.keywords)(0,r.default)(d);return d};h.get=(d,E="full")=>{let l=(E==="fast"?s.fastFormats:s.fullFormats)[d];if(!l)throw Error(`Unknown format "${d}"`);return l};function c(d,E,l,p){var f,I;(f=(I=d.opts.code).formats)!==null&&f!==void 0||(I.formats=a._`require("ajv-formats/dist/formats").${p}`);for(let v of E)d.addFormat(v,l[v])}e.exports=t=h,Object.defineProperty(t,"__esModule",{value:!0}),t.default=h}),k8=50;function Uh(t=k8){let e=new AbortController;return T8(t,e.signal),e}class j0 extends Error{}function Gh(){return process.versions.bun!==void 0}var R8=typeof global=="object"&&global&&global.Object===Object&&global,I8=R8,v8=typeof self=="object"&&self&&self.Object===Object&&self,C8=I8||v8||Function("return this")(),ar=C8,A8=ar.Symbol,xs=A8,Wh=Object.prototype,b8=Wh.hasOwnProperty,Z8=Wh.toString,ze=xs?xs.toStringTag:void 0;function g8(t){var e=b8.call(t,ze),s=t[ze];try{t[ze]=void 0;var r=!0}catch(n){}var a=Z8.call(t);if(r)if(e)t[ze]=s;else delete t[ze];return a}var F8=g8,M8=Object.prototype,P8=M8.toString;function L8(t){return P8.call(t)}var j8=L8,q8="[object Null]",_8="[object Undefined]",Pi=xs?xs.toStringTag:void 0;function D8(t){if(t==null)return t===void 0?_8:q8;return Pi&&Pi in Object(t)?F8(t):j8(t)}var B8=D8;function V8(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var zh=V8,N8="[object AsyncFunction]",w8="[object Function]",K8="[object GeneratorFunction]",H8="[object Proxy]";function O8(t){if(!zh(t))return!1;var e=B8(t);return e==w8||e==K8||e==N8||e==H8}var U8=O8,G8=ar["__core-js_shared__"],A3=G8,Li=function(){var t=/[^.]+$/.exec(A3&&A3.keys&&A3.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function W8(t){return!!Li&&Li in t}var z8=W8,Q8=Function.prototype,J8=Q8.toString;function Y8(t){if(t!=null){try{return J8.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var X8=Y8,$8=/[\\^$.*+?()[\]{}|]/g,tm=/^\[object .+?Constructor\]$/,em=Function.prototype,am=Object.prototype,sm=em.toString,rm=am.hasOwnProperty,nm=RegExp("^"+sm.call(rm).replace($8,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function im(t){if(!zh(t)||z8(t))return!1;var e=U8(t)?nm:tm;return e.test(X8(t))}var hm=im;function cm(t,e){return t==null?void 0:t[e]}var dm=cm;function om(t,e){var s=dm(t,e);return hm(s)?s:void 0}var Qh=om,ym=Qh(Object,"create"),Sa=ym;function mm(){this.__data__=Sa?Sa(null):{},this.size=0}var pm=mm;function Em(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var um=Em,lm="__lodash_hash_undefined__",Sm=Object.prototype,Tm=Sm.hasOwnProperty;function km(t){var e=this.__data__;if(Sa){var s=e[t];return s===lm?void 0:s}return Tm.call(e,t)?e[t]:void 0}var fm=km,xm=Object.prototype,Rm=xm.hasOwnProperty;function Im(t){var e=this.__data__;return Sa?e[t]!==void 0:Rm.call(e,t)}var vm=Im,Cm="__lodash_hash_undefined__";function Am(t,e){var s=this.__data__;return this.size+=this.has(t)?0:1,s[t]=Sa&&e===void 0?Cm:e,this}var bm=Am;function Be(t){var e=-1,s=t==null?0:t.length;this.clear();while(++e<s){var r=t[e];this.set(r[0],r[1])}}Be.prototype.clear=pm;Be.prototype.delete=um;Be.prototype.get=fm;Be.prototype.has=vm;Be.prototype.set=bm;var ji=Be;function Zm(){this.__data__=[],this.size=0}var gm=Zm;function Fm(t,e){return t===e||t!==t&&e!==e}var Mm=Fm;function Pm(t,e){var s=t.length;while(s--)if(Mm(t[s][0],e))return s;return-1}var Qs=Pm,Lm=Array.prototype,jm=Lm.splice;function qm(t){var e=this.__data__,s=Qs(e,t);if(s<0)return!1;var r=e.length-1;if(s==r)e.pop();else jm.call(e,s,1);return--this.size,!0}var _m=qm;function Dm(t){var e=this.__data__,s=Qs(e,t);return s<0?void 0:e[s][1]}var Bm=Dm;function Vm(t){return Qs(this.__data__,t)>-1}var Nm=Vm;function wm(t,e){var s=this.__data__,r=Qs(s,t);if(r<0)++this.size,s.push([t,e]);else s[r][1]=e;return this}var Km=wm;function Ve(t){var e=-1,s=t==null?0:t.length;this.clear();while(++e<s){var r=t[e];this.set(r[0],r[1])}}Ve.prototype.clear=gm;Ve.prototype.delete=_m;Ve.prototype.get=Bm;Ve.prototype.has=Nm;Ve.prototype.set=Km;var Hm=Ve,Om=Qh(ar,"Map"),Um=Om;function Gm(){this.size=0,this.__data__={hash:new ji,map:new(Um||Hm),string:new ji}}var Wm=Gm;function zm(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Qm=zm;function Jm(t,e){var s=t.__data__;return Qm(e)?s[typeof e=="string"?"string":"hash"]:s.map}var Js=Jm;function Ym(t){var e=Js(this,t).delete(t);return this.size-=e?1:0,e}var Xm=Ym;function $m(t){return Js(this,t).get(t)}var tp=$m;function ep(t){return Js(this,t).has(t)}var ap=ep;function sp(t,e){var s=Js(this,t),r=s.size;return s.set(t,e),this.size+=s.size==r?0:1,this}var rp=sp;function Ne(t){var e=-1,s=t==null?0:t.length;this.clear();while(++e<s){var r=t[e];this.set(r[0],r[1])}}Ne.prototype.clear=Wm;Ne.prototype.delete=Xm;Ne.prototype.get=tp;Ne.prototype.has=ap;Ne.prototype.set=rp;var Jh=Ne,np="Expected a function";function sr(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw TypeError(np);var s=function(){var r=arguments,a=e?e.apply(this,r):r[0],n=s.cache;if(n.has(a))return n.get(a);var i=t.apply(this,r);return s.cache=n.set(a,i)||n,i};return s.cache=new(sr.Cache||Jh),s}sr.Cache=Jh;var te=sr,Yh=te(()=>{return(process.env.CLAUDE_CONFIG_DIR??hp(ip(),".claude")).normalize("NFC")},()=>process.env.CLAUDE_CONFIG_DIR);function ne(t){if(!t)return!1;if(typeof t==="boolean")return t;let e=t.toLowerCase().trim();return["1","true","yes","on"].includes(e)}function Q(t,e,s,r,a){if(r==="m")throw TypeError("Private method is not writable");if(r==="a"&&!a)throw TypeError("Private accessor was defined without a setter");if(typeof e==="function"?t!==e||!a:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(t,s):a?a.value=s:e.set(t,s),s}function M(t,e,s,r){if(s==="a"&&!r)throw TypeError("Private accessor was defined without a getter");if(typeof e==="function"?t!==e||!r:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?r:s==="a"?r.call(t):r?r.value:e.get(t)}var Xh=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return Xh=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),s=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(r)=>(+r^s()&15>>+r/4).toString(16))};function Ta(t){return typeof t==="object"&&t!==null&&(("name"in t)&&t.name==="AbortError"||("message"in t)&&String(t.message).includes("FetchRequestCanceledException"))}var V3=(t)=>{if(t instanceof Error)return t;if(typeof t==="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=Error(t.message,t.cause?{cause:t.cause}:{});if(t.stack)e.stack=t.stack;if(t.cause&&!e.cause)e.cause=t.cause;if(t.name)e.name=t.name;return e}}catch{}try{return Error(JSON.stringify(t))}catch{}}return Error(t)};class ht extends Error{}class t0 extends ht{constructor(t,e,s,r,a){super(`${t0.makeMessage(t,e,s)}`);this.status=t,this.headers=r,this.requestID=r?.get("request-id"),this.error=e,this.type=a??null}static makeMessage(t,e,s){let r=e?.message?typeof e.message==="string"?e.message:JSON.stringify(e.message):e?JSON.stringify(e):s;if(t&&r)return`${t} ${r}`;if(t)return`${t} status code (no body)`;if(r)return r;return"(no status code or body)"}static generate(t,e,s,r){if(!t||!r)return new _a({message:s,cause:V3(e)});let a=e,n=a?.error?.type;if(t===400)return new nr(t,a,s,r,n);if(t===401)return new ir(t,a,s,r,n);if(t===403)return new hr(t,a,s,r,n);if(t===404)return new cr(t,a,s,r,n);if(t===409)return new dr(t,a,s,r,n);if(t===422)return new or(t,a,s,r,n);if(t===429)return new yr(t,a,s,r,n);if(t>=500)return new mr(t,a,s,r,n);return new t0(t,a,s,r,n)}}class k0 extends t0{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}}class _a extends t0{constructor({message:t,cause:e}){super(void 0,void 0,t||"Connection error.",void 0);if(e)this.cause=e}}class rr extends _a{constructor({message:t}={}){super({message:t??"Request timed out."})}}class nr extends t0{}class ir extends t0{}class hr extends t0{}class cr extends t0{}class dr extends t0{}class or extends t0{}class yr extends t0{}class mr extends t0{}var cp=/^[a-z][a-z0-9+.-]*:/i,dp=(t)=>{return cp.test(t)},N3=(t)=>(N3=Array.isArray,N3(t)),qi=N3;function w3(t){if(typeof t!=="object")return{};return t??{}}function _i(t){if(!t)return!0;for(let e in t)return!1;return!0}function op(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var yp=(t,e)=>{if(typeof e!=="number"||!Number.isInteger(e))throw new ht(`${t} must be an integer`);if(e<0)throw new ht(`${t} must be a positive integer`);return e},$h=(t)=>{try{return JSON.parse(t)}catch(e){return}},mp=(t)=>new Promise((e)=>setTimeout(e,t)),Re="0.81.0",pp=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function Ep(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var up=()=>{let t=Ep();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Re,"X-Stainless-OS":Bi(Deno.build.os),"X-Stainless-Arch":Di(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Re,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Re,"X-Stainless-OS":Bi(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Di(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=lp();if(e)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Re,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Re,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function lp(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:s}of t){let r=s.exec(navigator.userAgent);if(r){let a=r[1]||0,n=r[2]||0,i=r[3]||0;return{browser:e,version:`${a}.${n}.${i}`}}}return null}var Di=(t)=>{if(t==="x32")return"x32";if(t==="x86_64"||t==="x64")return"x64";if(t==="arm")return"arm";if(t==="aarch64"||t==="arm64")return"arm64";if(t)return`other:${t}`;return"unknown"},Bi=(t)=>{if(t=t.toLowerCase(),t.includes("ios"))return"iOS";if(t==="android")return"Android";if(t==="darwin")return"MacOS";if(t==="win32")return"Windows";if(t==="freebsd")return"FreeBSD";if(t==="openbsd")return"OpenBSD";if(t==="linux")return"Linux";if(t)return`Other:${t}`;return"Unknown"},Vi,Sp=()=>{return Vi??(Vi=up())};function Tp(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function tc(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function ec(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return tc({start(){},async pull(s){let{done:r,value:a}=await e.next();if(r)s.close();else s.enqueue(a)},async cancel(){await e.return?.()}})}function pr(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let s=await e.read();if(s?.done)e.releaseLock();return s}catch(s){throw e.releaseLock(),s}},async return(){let s=e.cancel();return e.releaseLock(),await s,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function kp(t){if(t===null||typeof t!=="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),s=e.cancel();e.releaseLock(),await s}var fp=({headers:t,body:e})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)}};function xp(t){return Object.entries(t).filter(([e,s])=>typeof s<"u").map(([e,s])=>{if(typeof s==="string"||typeof s==="number"||typeof s==="boolean")return`${encodeURIComponent(e)}=${encodeURIComponent(s)}`;if(s===null)return`${encodeURIComponent(e)}=`;throw new ht(`Cannot stringify type ${typeof s}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}function Rp(t){let e=0;for(let a of t)e+=a.length;let s=new Uint8Array(e),r=0;for(let a of t)s.set(a,r),r+=a.length;return s}var Ni;function Er(t){let e;return(Ni??(e=new globalThis.TextEncoder,Ni=e.encode.bind(e)))(t)}var wi;function Ki(t){let e;return(wi??(e=new globalThis.TextDecoder,wi=e.decode.bind(e)))(t)}var o0,y0;class we{constructor(){o0.set(this,void 0),y0.set(this,void 0),Q(this,o0,new Uint8Array,"f"),Q(this,y0,null,"f")}decode(t){if(t==null)return[];let e=t instanceof ArrayBuffer?new Uint8Array(t):typeof t==="string"?Er(t):t;Q(this,o0,Rp([M(this,o0,"f"),e]),"f");let s=[],r;while((r=Ip(M(this,o0,"f"),M(this,y0,"f")))!=null){if(r.carriage&&M(this,y0,"f")==null){Q(this,y0,r.index,"f");continue}if(M(this,y0,"f")!=null&&(r.index!==M(this,y0,"f")+1||r.carriage)){s.push(Ki(M(this,o0,"f").subarray(0,M(this,y0,"f")-1))),Q(this,o0,M(this,o0,"f").subarray(M(this,y0,"f")),"f"),Q(this,y0,null,"f");continue}let a=M(this,y0,"f")!==null?r.preceding-1:r.preceding,n=Ki(M(this,o0,"f").subarray(0,a));s.push(n),Q(this,o0,M(this,o0,"f").subarray(r.index),"f"),Q(this,y0,null,"f")}return s}flush(){if(!M(this,o0,"f").length)return[];return this.decode(`
|
|
10
|
-
`)}}o0=new WeakMap,y0=new WeakMap;we.NEWLINE_CHARS=new Set([`
|
|
11
|
-
`,"\r"]);we.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ip(t,e){for(let s=e??0;s<t.length;s++){if(t[s]===10)return{preceding:s,index:s+1,carriage:!1};if(t[s]===13)return{preceding:s,index:s+1,carriage:!0}}return null}function vp(t){for(let e=0;e<t.length-1;e++){if(t[e]===10&&t[e+1]===10)return e+2;if(t[e]===13&&t[e+1]===13)return e+2;if(t[e]===13&&t[e+1]===10&&e+3<t.length&&t[e+2]===13&&t[e+3]===10)return e+4}return-1}var Rs={off:0,error:200,warn:300,info:400,debug:500},Hi=(t,e,s)=>{if(!t)return;if(op(Rs,t))return t;a0(s).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Rs))}`);return};function ya(){}function Qa(t,e,s){if(!e||Rs[t]>Rs[s])return ya;else return e[t].bind(e)}var Cp={error:ya,warn:ya,info:ya,debug:ya},Oi=new WeakMap;function a0(t){let e=t.logger,s=t.logLevel??"off";if(!e)return Cp;let r=Oi.get(e);if(r&&r[0]===s)return r[1];let a={error:Qa("error",e,s),warn:Qa("warn",e,s),info:Qa("info",e,s),debug:Qa("debug",e,s)};return Oi.set(e,[s,a]),a}var re=(t)=>{if(t.options)t.options={...t.options},delete t.options.headers;if(t.headers)t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,s])=>[e,e.toLowerCase()==="x-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":s]));if("retryOfRequestLogID"in t){if(t.retryOfRequestLogID)t.retryOf=t.retryOfRequestLogID;delete t.retryOfRequestLogID}return t},Qe;class q0{constructor(t,e,s){this.iterator=t,Qe.set(this,void 0),this.controller=e,Q(this,Qe,s,"f")}static fromSSEResponse(t,e,s){let r=!1,a=s?a0(s):console;async function*n(){if(r)throw new ht("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let i=!1;try{for await(let h of Ap(t,e)){if(h.event==="completion")try{yield JSON.parse(h.data)}catch(c){throw a.error("Could not parse message into JSON:",h.data),a.error("From chunk:",h.raw),c}if(h.event==="message_start"||h.event==="message_delta"||h.event==="message_stop"||h.event==="content_block_start"||h.event==="content_block_delta"||h.event==="content_block_stop")try{yield JSON.parse(h.data)}catch(c){throw a.error("Could not parse message into JSON:",h.data),a.error("From chunk:",h.raw),c}if(h.event==="ping")continue;if(h.event==="error"){let c=$h(h.data)??h.data,d=c?.error?.type;throw new t0(void 0,c,void 0,t.headers,d)}}i=!0}catch(h){if(Ta(h))return;throw h}finally{if(!i)e.abort()}}return new q0(n,e,s)}static fromReadableStream(t,e,s){let r=!1;async function*a(){let i=new we,h=pr(t);for await(let c of h)for(let d of i.decode(c))yield d;for(let c of i.flush())yield c}async function*n(){if(r)throw new ht("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let i=!1;try{for await(let h of a()){if(i)continue;if(h)yield JSON.parse(h)}i=!0}catch(h){if(Ta(h))return;throw h}finally{if(!i)e.abort()}}return new q0(n,e,s)}[(Qe=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],e=[],s=this.iterator(),r=(a)=>{return{next:()=>{if(a.length===0){let n=s.next();t.push(n),e.push(n)}return a.shift()}}};return[new q0(()=>r(t),this.controller,M(this,Qe,"f")),new q0(()=>r(e),this.controller,M(this,Qe,"f"))]}toReadableStream(){let t=this,e;return tc({async start(){e=t[Symbol.asyncIterator]()},async pull(s){try{let{value:r,done:a}=await e.next();if(a)return s.close();let n=Er(JSON.stringify(r)+`
|
|
12
|
-
`);s.enqueue(n)}catch(r){s.error(r)}},async cancel(){await e.return?.()}})}}async function*Ap(t,e){if(!t.body){if(e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new ht("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new ht("Attempted to iterate over a response with no body")}let s=new ac,r=new we,a=pr(t.body);for await(let n of bp(a))for(let i of r.decode(n)){let h=s.decode(i);if(h)yield h}for(let n of r.flush()){let i=s.decode(n);if(i)yield i}}async function*bp(t){let e=new Uint8Array;for await(let s of t){if(s==null)continue;let r=s instanceof ArrayBuffer?new Uint8Array(s):typeof s==="string"?Er(s):s,a=new Uint8Array(e.length+r.length);a.set(e),a.set(r,e.length),e=a;let n;while((n=vp(e))!==-1)yield e.slice(0,n),e=e.slice(n)}if(e.length>0)yield e}class ac{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r"))t=t.substring(0,t.length-1);if(!t){if(!this.event&&!this.data.length)return null;let a={event:this.event,data:this.data.join(`
|
|
13
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],a}if(this.chunks.push(t),t.startsWith(":"))return null;let[e,s,r]=Zp(t,":");if(r.startsWith(" "))r=r.substring(1);if(e==="event")this.event=r;else if(e==="data")this.data.push(r);return null}}function Zp(t,e){let s=t.indexOf(e);if(s!==-1)return[t.substring(0,s),e,t.substring(s+e.length)];return[t,"",""]}async function sc(t,e){let{response:s,requestLogID:r,retryOfRequestLogID:a,startTime:n}=e,i=await(async()=>{if(e.options.stream){if(a0(t).debug("response",s.status,s.url,s.headers,s.body),e.options.__streamClass)return e.options.__streamClass.fromSSEResponse(s,e.controller);return q0.fromSSEResponse(s,e.controller)}if(s.status===204)return null;if(e.options.__binaryResponse)return s;let h=s.headers.get("content-type")?.split(";")[0]?.trim();if(h?.includes("application/json")||h?.endsWith("+json")){if(s.headers.get("content-length")==="0")return;let c=await s.json();return rc(c,s)}return await s.text()})();return a0(t).debug(`[${r}] response parsed`,re({retryOfRequestLogID:a,url:s.url,status:s.status,body:i,durationMs:Date.now()-n})),i}function rc(t,e){if(!t||typeof t!=="object"||Array.isArray(t))return t;return Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}var ma;class Ys extends Promise{constructor(t,e,s=sc){super((r)=>{r(null)});this.responsePromise=e,this.parseResponse=s,ma.set(this,void 0),Q(this,ma,t,"f")}_thenUnwrap(t){return new Ys(M(this,ma,"f"),this.responsePromise,async(e,s)=>rc(t(await this.parseResponse(e,s),s),s.response))}asResponse(){return this.responsePromise.then((t)=>t.response)}async withResponse(){let[t,e]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:e,request_id:e.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((t)=>this.parseResponse(M(this,ma,"f"),t));return this.parsedPromise}then(t,e){return this.parse().then(t,e)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}}ma=new WeakMap;var Ja;class ur{constructor(t,e,s,r){Ja.set(this,void 0),Q(this,Ja,t,"f"),this.options=r,this.response=e,this.body=s}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let t=this.nextPageRequestOptions();if(!t)throw new ht("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await M(this,Ja,"f").requestAPIList(this.constructor,t)}async*iterPages(){let t=this;yield t;while(t.hasNextPage())t=await t.getNextPage(),yield t}async*[(Ja=new WeakMap,Symbol.asyncIterator)](){for await(let t of this.iterPages())for(let e of t.getPaginatedItems())yield e}}class nc extends Ys{constructor(t,e,s){super(t,e,async(r,a)=>new s(r,a.response,await sc(r,a),a.options))}async*[Symbol.asyncIterator](){let t=await this;for await(let e of t)yield e}}class Ke extends ur{constructor(t,e,s,r){super(t,e,s,r);this.data=s.data||[],this.has_more=s.has_more||!1,this.first_id=s.first_id||null,this.last_id=s.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let e=this.first_id;if(!e)return null;return{...this.options,query:{...w3(this.options.query),before_id:e}}}let t=this.last_id;if(!t)return null;return{...this.options,query:{...w3(this.options.query),after_id:t}}}}class lr extends ur{constructor(t,e,s,r){super(t,e,s,r);this.data=s.data||[],this.has_more=s.has_more||!1,this.next_page=s.next_page||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let t=this.next_page;if(!t)return null;return{...this.options,query:{...w3(this.options.query),page:t}}}}var ic=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node==="string"&&parseInt(t.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function be(t,e,s){return ic(),new File(t,e??"unknown_file",s)}function Es(t,e){let s=typeof t==="object"&&t!==null&&(("name"in t)&&t.name&&String(t.name)||("url"in t)&&t.url&&String(t.url)||("filename"in t)&&t.filename&&String(t.filename)||("path"in t)&&t.path&&String(t.path))||"";return e?s.split(/[\\/]/).pop()||void 0:s}var hc=(t)=>t!=null&&typeof t==="object"&&typeof t[Symbol.asyncIterator]==="function",Sr=async(t,e,s=!0)=>{return{...t,body:await Fp(t.body,e,s)}},Ui=new WeakMap;function gp(t){let e=typeof t==="function"?t:t.fetch,s=Ui.get(e);if(s)return s;let r=(async()=>{try{let a="Response"in e?e.Response:(await e("data:,")).constructor,n=new FormData;if(n.toString()===await new a(n).text())return!1;return!0}catch{return!0}})();return Ui.set(e,r),r}var Fp=async(t,e,s=!0)=>{if(!await gp(e))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([a,n])=>K3(r,a,n,s))),r},Mp=(t)=>t instanceof Blob&&("name"in t),K3=async(t,e,s,r)=>{if(s===void 0)return;if(s==null)throw TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof s==="string"||typeof s==="number"||typeof s==="boolean")t.append(e,String(s));else if(s instanceof Response){let a={},n=s.headers.get("Content-Type");if(n)a={type:n};t.append(e,be([await s.blob()],Es(s,r),a))}else if(hc(s))t.append(e,be([await new Response(ec(s)).blob()],Es(s,r)));else if(Mp(s))t.append(e,be([s],Es(s,r),{type:s.type}));else if(Array.isArray(s))await Promise.all(s.map((a)=>K3(t,e+"[]",a,r)));else if(typeof s==="object")await Promise.all(Object.entries(s).map(([a,n])=>K3(t,`${e}[${a}]`,n,r)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${s} instead`)},cc=(t)=>t!=null&&typeof t==="object"&&typeof t.size==="number"&&typeof t.type==="string"&&typeof t.text==="function"&&typeof t.slice==="function"&&typeof t.arrayBuffer==="function",Pp=(t)=>t!=null&&typeof t==="object"&&typeof t.name==="string"&&typeof t.lastModified==="number"&&cc(t),Lp=(t)=>t!=null&&typeof t==="object"&&typeof t.url==="string"&&typeof t.blob==="function";async function jp(t,e,s){if(ic(),t=await t,e||(e=Es(t,!0)),Pp(t)){if(t instanceof File&&e==null&&s==null)return t;return be([await t.arrayBuffer()],e??t.name,{type:t.type,lastModified:t.lastModified,...s})}if(Lp(t)){let a=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),be(await H3(a),e,s)}let r=await H3(t);if(!s?.type){let a=r.find((n)=>typeof n==="object"&&("type"in n)&&n.type);if(typeof a==="string")s={...s,type:a}}return be(r,e,s)}async function H3(t){let e=[];if(typeof t==="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(cc(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(hc(t))for await(let s of t)e.push(...await H3(s));else{let s=t?.constructor?.name;throw Error(`Unexpected data type: ${typeof t}${s?`; constructor: ${s}`:""}${qp(t)}`)}return e}function qp(t){if(typeof t!=="object"||t===null)return"";return`; props: [${Object.getOwnPropertyNames(t).map((e)=>`"${e}"`).join(", ")}]`}class R0{constructor(t){this._client=t}}var dc=Symbol.for("brand.privateNullableHeaders");function*_p(t){if(!t)return;if(dc in t){let{values:r,nulls:a}=t;yield*r.entries();for(let n of a)yield[n,null];return}let e=!1,s;if(t instanceof Headers)s=t.entries();else if(qi(t))s=t;else e=!0,s=Object.entries(t??{});for(let r of s){let a=r[0];if(typeof a!=="string")throw TypeError("expected header name to be a string");let n=qi(r[1])?r[1]:[r[1]],i=!1;for(let h of n){if(h===void 0)continue;if(e&&!i)i=!0,yield[a,null];yield[a,h]}}}var ft=(t)=>{let e=new Headers,s=new Set;for(let r of t){let a=new Set;for(let[n,i]of _p(r)){let h=n.toLowerCase();if(!a.has(h))e.delete(n),a.add(h);if(i===null)e.delete(n),s.add(h);else e.append(n,i),s.delete(h)}}return{[dc]:!0,values:e,nulls:s}},ua=Symbol("anthropic.sdk.stainlessHelper");function us(t){return typeof t==="object"&&t!==null&&ua in t}function oc(t,e){let s=new Set;if(t){for(let r of t)if(us(r))s.add(r[ua])}if(e)for(let r of e){if(us(r))s.add(r[ua]);if(Array.isArray(r.content)){for(let a of r.content)if(us(a))s.add(a[ua])}}return Array.from(s)}function yc(t,e){let s=oc(t,e);if(s.length===0)return{};return{"x-stainless-helper":s.join(", ")}}function Dp(t){if(us(t))return{"x-stainless-helper":t[ua]};return{}}function mc(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Gi=Object.freeze(Object.create(null)),Bp=(t=mc)=>function(e,...s){if(e.length===1)return e[0];let r=!1,a=[],n=e.reduce((d,E,l)=>{if(/[?#]/.test(E))r=!0;let p=s[l],f=(r?encodeURIComponent:t)(""+p);if(l!==s.length&&(p==null||typeof p==="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??Gi)??Gi)?.toString))f=p+"",a.push({start:d.length+E.length,length:f.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`});return d+E+(l===s.length?"":f)},""),i=n.split(/[?#]/,1)[0],h=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;while((c=h.exec(i))!==null)a.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can't be safely passed as a path parameter`});if(a.sort((d,E)=>d.start-E.start),a.length>0){let d=0,E=a.reduce((l,p)=>{let f=" ".repeat(p.start-d),I="^".repeat(p.length);return d=p.start+p.length,l+f+I},"");throw new ht(`Path parameters result in path with invalid segments:
|
|
14
|
-
${a.map((l)=>l.error).join(`
|
|
15
|
-
`)}
|
|
16
|
-
${n}
|
|
17
|
-
${E}`)}return n},Qt=Bp(mc);class Tr extends R0{list(t={},e){let{betas:s,...r}=t??{};return this._client.getAPIList("/v1/files",Ke,{query:r,...e,headers:ft([{"anthropic-beta":[...s??[],"files-api-2025-04-14"].toString()},e?.headers])})}delete(t,e={},s){let{betas:r}=e??{};return this._client.delete(Qt`/v1/files/${t}`,{...s,headers:ft([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},s?.headers])})}download(t,e={},s){let{betas:r}=e??{};return this._client.get(Qt`/v1/files/${t}/content`,{...s,headers:ft([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},s?.headers]),__binaryResponse:!0})}retrieveMetadata(t,e={},s){let{betas:r}=e??{};return this._client.get(Qt`/v1/files/${t}`,{...s,headers:ft([{"anthropic-beta":[...r??[],"files-api-2025-04-14"].toString()},s?.headers])})}upload(t,e){let{betas:s,...r}=t;return this._client.post("/v1/files",Sr({body:r,...e,headers:ft([{"anthropic-beta":[...s??[],"files-api-2025-04-14"].toString()},Dp(r.file),e?.headers])},this._client))}}class kr extends R0{retrieve(t,e={},s){let{betas:r}=e??{};return this._client.get(Qt`/v1/models/${t}?beta=true`,{...s,headers:ft([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},s?.headers])})}list(t={},e){let{betas:s,...r}=t??{};return this._client.getAPIList("/v1/models?beta=true",Ke,{query:r,...e,headers:ft([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},e?.headers])})}}var pc={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};function Ec(t){return t?.output_format??t?.output_config?.format}function Wi(t,e,s){let r=Ec(e);if(!e||!("parse"in(r??{})))return{...t,content:t.content.map((a)=>{if(a.type==="text"){let n=Object.defineProperty({...a},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(n,"parsed",{get(){return s.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return a}),parsed_output:null};return uc(t,e,s)}function uc(t,e,s){let r=null,a=t.content.map((n)=>{if(n.type==="text"){let i=Vp(e,n.text);if(r===null)r=i;let h=Object.defineProperty({...n},"parsed_output",{value:i,enumerable:!1});return Object.defineProperty(h,"parsed",{get(){return s.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),i},enumerable:!1})}return n});return{...t,content:a,parsed_output:r}}function Vp(t,e){let s=Ec(t);if(s?.type!=="json_schema")return null;try{if("parse"in s)return s.parse(e);return JSON.parse(e)}catch(r){throw new ht(`Failed to parse structured output: ${r}`)}}var Np=(t)=>{let e=0,s=[];while(e<t.length){let r=t[e];if(r==="\\"){e++;continue}if(r==="{"){s.push({type:"brace",value:"{"}),e++;continue}if(r==="}"){s.push({type:"brace",value:"}"}),e++;continue}if(r==="["){s.push({type:"paren",value:"["}),e++;continue}if(r==="]"){s.push({type:"paren",value:"]"}),e++;continue}if(r===":"){s.push({type:"separator",value:":"}),e++;continue}if(r===","){s.push({type:"delimiter",value:","}),e++;continue}if(r==='"'){let i="",h=!1;r=t[++e];while(r!=='"'){if(e===t.length){h=!0;break}if(r==="\\"){if(e++,e===t.length){h=!0;break}i+=r+t[e],r=t[++e]}else i+=r,r=t[++e]}if(r=t[++e],!h)s.push({type:"string",value:i});continue}if(r&&/\s/.test(r)){e++;continue}let a=/[0-9]/;if(r&&a.test(r)||r==="-"||r==="."){let i="";if(r==="-")i+=r,r=t[++e];while(r&&a.test(r)||r===".")i+=r,r=t[++e];s.push({type:"number",value:i});continue}let n=/[a-z]/i;if(r&&n.test(r)){let i="";while(r&&n.test(r)){if(e===t.length)break;i+=r,r=t[++e]}if(i=="true"||i=="false"||i==="null")s.push({type:"name",value:i});else{e++;continue}continue}e++}return s},Ie=(t)=>{if(t.length===0)return t;let e=t[t.length-1];switch(e.type){case"separator":return t=t.slice(0,t.length-1),Ie(t);case"number":let s=e.value[e.value.length-1];if(s==="."||s==="-")return t=t.slice(0,t.length-1),Ie(t);case"string":let r=t[t.length-2];if(r?.type==="delimiter")return t=t.slice(0,t.length-1),Ie(t);else if(r?.type==="brace"&&r.value==="{")return t=t.slice(0,t.length-1),Ie(t);break;case"delimiter":return t=t.slice(0,t.length-1),Ie(t)}return t},wp=(t)=>{let e=[];if(t.map((s)=>{if(s.type==="brace")if(s.value==="{")e.push("}");else e.splice(e.lastIndexOf("}"),1);if(s.type==="paren")if(s.value==="[")e.push("]");else e.splice(e.lastIndexOf("]"),1)}),e.length>0)e.reverse().map((s)=>{if(s==="}")t.push({type:"brace",value:"}"});else if(s==="]")t.push({type:"paren",value:"]"})});return t},Kp=(t)=>{let e="";return t.map((s)=>{switch(s.type){case"string":e+='"'+s.value+'"';break;default:e+=s.value;break}}),e},lc=(t)=>JSON.parse(Kp(wp(Ie(Np(t))))),u0,W0,Te,Je,Ya,Ye,Xe,Xa,$e,V0,ta,$a,ts,ee,es,as,ea,b3,zi,ss,Z3,g3,F3,Qi,Ji="__json_buf";function Yi(t){return t.type==="tool_use"||t.type==="server_tool_use"||t.type==="mcp_tool_use"}class Is{constructor(t,e){u0.add(this),this.messages=[],this.receivedMessages=[],W0.set(this,void 0),Te.set(this,null),this.controller=new AbortController,Je.set(this,void 0),Ya.set(this,()=>{}),Ye.set(this,()=>{}),Xe.set(this,void 0),Xa.set(this,()=>{}),$e.set(this,()=>{}),V0.set(this,{}),ta.set(this,!1),$a.set(this,!1),ts.set(this,!1),ee.set(this,!1),es.set(this,void 0),as.set(this,void 0),ea.set(this,void 0),ss.set(this,(s)=>{if(Q(this,$a,!0,"f"),Ta(s))s=new k0;if(s instanceof k0)return Q(this,ts,!0,"f"),this._emit("abort",s);if(s instanceof ht)return this._emit("error",s);if(s instanceof Error){let r=new ht(s.message);return r.cause=s,this._emit("error",r)}return this._emit("error",new ht(String(s)))}),Q(this,Je,new Promise((s,r)=>{Q(this,Ya,s,"f"),Q(this,Ye,r,"f")}),"f"),Q(this,Xe,new Promise((s,r)=>{Q(this,Xa,s,"f"),Q(this,$e,r,"f")}),"f"),M(this,Je,"f").catch(()=>{}),M(this,Xe,"f").catch(()=>{}),Q(this,Te,t,"f"),Q(this,ea,e?.logger??console,"f")}get response(){return M(this,es,"f")}get request_id(){return M(this,as,"f")}async withResponse(){Q(this,ee,!0,"f");let t=await M(this,Je,"f");if(!t)throw Error("Could not resolve a `Response` object");return{data:this,response:t,request_id:t.headers.get("request-id")}}static fromReadableStream(t){let e=new Is(null);return e._run(()=>e._fromReadableStream(t)),e}static createMessage(t,e,s,{logger:r}={}){let a=new Is(e,{logger:r});for(let n of e.messages)a._addMessageParam(n);return Q(a,Te,{...e,stream:!0},"f"),a._run(()=>a._createMessage(t,{...e,stream:!0},{...s,headers:{...s?.headers,"X-Stainless-Helper-Method":"stream"}})),a}_run(t){t().then(()=>{this._emitFinal(),this._emit("end")},M(this,ss,"f"))}_addMessageParam(t){this.messages.push(t)}_addMessage(t,e=!0){if(this.receivedMessages.push(t),e)this._emit("message",t)}async _createMessage(t,e,s){let r=s?.signal,a;if(r){if(r.aborted)this.controller.abort();a=this.controller.abort.bind(this.controller),r.addEventListener("abort",a)}try{M(this,u0,"m",Z3).call(this);let{response:n,data:i}=await t.create({...e,stream:!0},{...s,signal:this.controller.signal}).withResponse();this._connected(n);for await(let h of i)M(this,u0,"m",g3).call(this,h);if(i.controller.signal?.aborted)throw new k0;M(this,u0,"m",F3).call(this)}finally{if(r&&a)r.removeEventListener("abort",a)}}_connected(t){if(this.ended)return;Q(this,es,t,"f"),Q(this,as,t?.headers.get("request-id"),"f"),M(this,Ya,"f").call(this,t),this._emit("connect")}get ended(){return M(this,ta,"f")}get errored(){return M(this,$a,"f")}get aborted(){return M(this,ts,"f")}abort(){this.controller.abort()}on(t,e){return(M(this,V0,"f")[t]||(M(this,V0,"f")[t]=[])).push({listener:e}),this}off(t,e){let s=M(this,V0,"f")[t];if(!s)return this;let r=s.findIndex((a)=>a.listener===e);if(r>=0)s.splice(r,1);return this}once(t,e){return(M(this,V0,"f")[t]||(M(this,V0,"f")[t]=[])).push({listener:e,once:!0}),this}emitted(t){return new Promise((e,s)=>{if(Q(this,ee,!0,"f"),t!=="error")this.once("error",s);this.once(t,e)})}async done(){Q(this,ee,!0,"f"),await M(this,Xe,"f")}get currentMessage(){return M(this,W0,"f")}async finalMessage(){return await this.done(),M(this,u0,"m",b3).call(this)}async finalText(){return await this.done(),M(this,u0,"m",zi).call(this)}_emit(t,...e){if(M(this,ta,"f"))return;if(t==="end")Q(this,ta,!0,"f"),M(this,Xa,"f").call(this);let s=M(this,V0,"f")[t];if(s)M(this,V0,"f")[t]=s.filter((r)=>!r.once),s.forEach(({listener:r})=>r(...e));if(t==="abort"){let r=e[0];if(!M(this,ee,"f")&&!s?.length)Promise.reject(r);M(this,Ye,"f").call(this,r),M(this,$e,"f").call(this,r),this._emit("end");return}if(t==="error"){let r=e[0];if(!M(this,ee,"f")&&!s?.length)Promise.reject(r);M(this,Ye,"f").call(this,r),M(this,$e,"f").call(this,r),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",M(this,u0,"m",b3).call(this))}async _fromReadableStream(t,e){let s=e?.signal,r;if(s){if(s.aborted)this.controller.abort();r=this.controller.abort.bind(this.controller),s.addEventListener("abort",r)}try{M(this,u0,"m",Z3).call(this),this._connected(null);let a=q0.fromReadableStream(t,this.controller);for await(let n of a)M(this,u0,"m",g3).call(this,n);if(a.controller.signal?.aborted)throw new k0;M(this,u0,"m",F3).call(this)}finally{if(s&&r)s.removeEventListener("abort",r)}}[(W0=new WeakMap,Te=new WeakMap,Je=new WeakMap,Ya=new WeakMap,Ye=new WeakMap,Xe=new WeakMap,Xa=new WeakMap,$e=new WeakMap,V0=new WeakMap,ta=new WeakMap,$a=new WeakMap,ts=new WeakMap,ee=new WeakMap,es=new WeakMap,as=new WeakMap,ea=new WeakMap,ss=new WeakMap,u0=new WeakSet,b3=function(){if(this.receivedMessages.length===0)throw new ht("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},zi=function(){if(this.receivedMessages.length===0)throw new ht("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((e)=>e.type==="text").map((e)=>e.text);if(t.length===0)throw new ht("stream ended without producing a content block with type=text");return t.join(" ")},Z3=function(){if(this.ended)return;Q(this,W0,void 0,"f")},g3=function(t){if(this.ended)return;let e=M(this,u0,"m",Qi).call(this,t);switch(this._emit("streamEvent",t,e),t.type){case"content_block_delta":{let s=e.content.at(-1);switch(t.delta.type){case"text_delta":{if(s.type==="text")this._emit("text",t.delta.text,s.text||"");break}case"citations_delta":{if(s.type==="text")this._emit("citation",t.delta.citation,s.citations??[]);break}case"input_json_delta":{if(Yi(s)&&s.input)this._emit("inputJson",t.delta.partial_json,s.input);break}case"thinking_delta":{if(s.type==="thinking")this._emit("thinking",t.delta.thinking,s.thinking);break}case"signature_delta":{if(s.type==="thinking")this._emit("signature",s.signature);break}case"compaction_delta":{if(s.type==="compaction"&&s.content)this._emit("compaction",s.content);break}default:Xi(t.delta)}break}case"message_stop":{this._addMessageParam(e),this._addMessage(Wi(e,M(this,Te,"f"),{logger:M(this,ea,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",e.content.at(-1));break}case"message_start":{Q(this,W0,e,"f");break}case"content_block_start":case"message_delta":break}},F3=function(){if(this.ended)throw new ht("stream has ended, this shouldn't happen");let t=M(this,W0,"f");if(!t)throw new ht("request ended without sending any chunks");return Q(this,W0,void 0,"f"),Wi(t,M(this,Te,"f"),{logger:M(this,ea,"f")})},Qi=function(t){let e=M(this,W0,"f");if(t.type==="message_start"){if(e)throw new ht(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!e)throw new ht(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return e;case"message_delta":if(e.container=t.delta.container,e.stop_reason=t.delta.stop_reason,e.stop_sequence=t.delta.stop_sequence,e.usage.output_tokens=t.usage.output_tokens,e.context_management=t.context_management,t.usage.input_tokens!=null)e.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)e.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)e.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)e.usage.server_tool_use=t.usage.server_tool_use;if(t.usage.iterations!=null)e.usage.iterations=t.usage.iterations;return e;case"content_block_start":return e.content.push(t.content_block),e;case"content_block_delta":{let s=e.content.at(t.index);switch(t.delta.type){case"text_delta":{if(s?.type==="text")e.content[t.index]={...s,text:(s.text||"")+t.delta.text};break}case"citations_delta":{if(s?.type==="text")e.content[t.index]={...s,citations:[...s.citations??[],t.delta.citation]};break}case"input_json_delta":{if(s&&Yi(s)){let r=s[Ji]||"";r+=t.delta.partial_json;let a={...s};if(Object.defineProperty(a,Ji,{value:r,enumerable:!1,writable:!0}),r)try{a.input=lc(r)}catch(n){let i=new ht(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${n}. JSON: ${r}`);M(this,ss,"f").call(this,i)}e.content[t.index]=a}break}case"thinking_delta":{if(s?.type==="thinking")e.content[t.index]={...s,thinking:s.thinking+t.delta.thinking};break}case"signature_delta":{if(s?.type==="thinking")e.content[t.index]={...s,signature:t.delta.signature};break}case"compaction_delta":{if(s?.type==="compaction")e.content[t.index]={...s,content:(s.content||"")+t.delta.content};break}default:Xi(t.delta)}return e}case"content_block_stop":return e}},Symbol.asyncIterator)](){let t=[],e=[],s=!1;return this.on("streamEvent",(r)=>{let a=e.shift();if(a)a.resolve(r);else t.push(r)}),this.on("end",()=>{s=!0;for(let r of e)r.resolve(void 0);e.length=0}),this.on("abort",(r)=>{s=!0;for(let a of e)a.reject(r);e.length=0}),this.on("error",(r)=>{s=!0;for(let a of e)a.reject(r);e.length=0}),{next:async()=>{if(!t.length){if(s)return{value:void 0,done:!0};return new Promise((r,a)=>e.push({resolve:r,reject:a})).then((r)=>r?{value:r,done:!1}:{value:void 0,done:!0})}return{value:t.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new q0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function Xi(t){}class fr extends Error{constructor(t){let e=typeof t==="string"?t:t.map((s)=>{if(s.type==="text")return s.text;return`[${s.type}]`}).join(" ");super(e);this.name="ToolError",this.content=t}}var Hp=1e5,Op=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
|
|
18
|
-
1. Task Overview
|
|
19
|
-
The user's core request and success criteria
|
|
20
|
-
Any clarifications or constraints they specified
|
|
21
|
-
2. Current State
|
|
22
|
-
What has been completed so far
|
|
23
|
-
Files created, modified, or analyzed (with paths if relevant)
|
|
24
|
-
Key outputs or artifacts produced
|
|
25
|
-
3. Important Discoveries
|
|
26
|
-
Technical constraints or requirements uncovered
|
|
27
|
-
Decisions made and their rationale
|
|
28
|
-
Errors encountered and how they were resolved
|
|
29
|
-
What approaches were tried that didn't work (and why)
|
|
30
|
-
4. Next Steps
|
|
31
|
-
Specific actions needed to complete the task
|
|
32
|
-
Any blockers or open questions to resolve
|
|
33
|
-
Priority order if multiple steps remain
|
|
34
|
-
5. Context to Preserve
|
|
35
|
-
User preferences or style requirements
|
|
36
|
-
Domain-specific details that aren't obvious
|
|
37
|
-
Any promises made to the user
|
|
38
|
-
Be concise but complete—err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
|
|
39
|
-
Wrap your summary in <summary></summary> tags.`,aa,ke,ae,Nt,sa,d0,K0,z0,ra,$i,O3;function th(){let t,e;return{promise:new Promise((s,r)=>{t=s,e=r}),resolve:t,reject:e}}class xr{constructor(t,e,s){aa.add(this),this.client=t,ke.set(this,!1),ae.set(this,!1),Nt.set(this,void 0),sa.set(this,void 0),d0.set(this,void 0),K0.set(this,void 0),z0.set(this,void 0),ra.set(this,0),Q(this,Nt,{params:{...e,messages:structuredClone(e.messages)}},"f");let r=["BetaToolRunner",...oc(e.tools,e.messages)].join(", ");Q(this,sa,{...s,headers:ft([{"x-stainless-helper":r},s?.headers])},"f"),Q(this,z0,th(),"f")}async*[(ke=new WeakMap,ae=new WeakMap,Nt=new WeakMap,sa=new WeakMap,d0=new WeakMap,K0=new WeakMap,z0=new WeakMap,ra=new WeakMap,aa=new WeakSet,$i=async function(){let t=M(this,Nt,"f").params.compactionControl;if(!t||!t.enabled)return!1;let e=0;if(M(this,d0,"f")!==void 0)try{let h=await M(this,d0,"f");e=h.usage.input_tokens+(h.usage.cache_creation_input_tokens??0)+(h.usage.cache_read_input_tokens??0)+h.usage.output_tokens}catch{return!1}let s=t.contextTokenThreshold??Hp;if(e<s)return!1;let r=t.model??M(this,Nt,"f").params.model,a=t.summaryPrompt??Op,n=M(this,Nt,"f").params.messages;if(n[n.length-1].role==="assistant"){let h=n[n.length-1];if(Array.isArray(h.content)){let c=h.content.filter((d)=>d.type!=="tool_use");if(c.length===0)n.pop();else h.content=c}}let i=await this.client.beta.messages.create({model:r,messages:[...n,{role:"user",content:[{type:"text",text:a}]}],max_tokens:M(this,Nt,"f").params.max_tokens},{headers:{"x-stainless-helper":"compaction"}});if(i.content[0]?.type!=="text")throw new ht("Expected text response for compaction");return M(this,Nt,"f").params.messages=[{role:"user",content:i.content}],!0},Symbol.asyncIterator)](){var t;if(M(this,ke,"f"))throw new ht("Cannot iterate over a consumed stream");Q(this,ke,!0,"f"),Q(this,ae,!0,"f"),Q(this,K0,void 0,"f");try{while(!0){let e;try{if(M(this,Nt,"f").params.max_iterations&&M(this,ra,"f")>=M(this,Nt,"f").params.max_iterations)break;Q(this,ae,!1,"f"),Q(this,K0,void 0,"f"),Q(this,ra,(t=M(this,ra,"f"),t++,t),"f"),Q(this,d0,void 0,"f");let{max_iterations:s,compactionControl:r,...a}=M(this,Nt,"f").params;if(a.stream)e=this.client.beta.messages.stream({...a},M(this,sa,"f")),Q(this,d0,e.finalMessage(),"f"),M(this,d0,"f").catch(()=>{}),yield e;else Q(this,d0,this.client.beta.messages.create({...a,stream:!1},M(this,sa,"f")),"f"),yield M(this,d0,"f");if(!await M(this,aa,"m",$i).call(this)){if(!M(this,ae,"f")){let{role:i,content:h}=await M(this,d0,"f");M(this,Nt,"f").params.messages.push({role:i,content:h})}let n=await M(this,aa,"m",O3).call(this,M(this,Nt,"f").params.messages.at(-1));if(n)M(this,Nt,"f").params.messages.push(n);else if(!M(this,ae,"f"))break}}finally{if(e)e.abort()}}if(!M(this,d0,"f"))throw new ht("ToolRunner concluded without a message from the server");M(this,z0,"f").resolve(await M(this,d0,"f"))}catch(e){throw Q(this,ke,!1,"f"),M(this,z0,"f").promise.catch(()=>{}),M(this,z0,"f").reject(e),Q(this,z0,th(),"f"),e}}setMessagesParams(t){if(typeof t==="function")M(this,Nt,"f").params=t(M(this,Nt,"f").params);else M(this,Nt,"f").params=t;Q(this,ae,!0,"f"),Q(this,K0,void 0,"f")}async generateToolResponse(){let t=await M(this,d0,"f")??this.params.messages.at(-1);if(!t)return null;return M(this,aa,"m",O3).call(this,t)}done(){return M(this,z0,"f").promise}async runUntilDone(){if(!M(this,ke,"f"))for await(let t of this);return this.done()}get params(){return M(this,Nt,"f").params}pushMessages(...t){this.setMessagesParams((e)=>({...e,messages:[...e.messages,...t]}))}then(t,e){return this.runUntilDone().then(t,e)}}O3=async function(t){if(M(this,K0,"f")!==void 0)return M(this,K0,"f");return Q(this,K0,Up(M(this,Nt,"f").params,t),"f"),M(this,K0,"f")};async function Up(t,e=t.messages.at(-1)){if(!e||e.role!=="assistant"||!e.content||typeof e.content==="string")return null;let s=e.content.filter((r)=>r.type==="tool_use");if(s.length===0)return null;return{role:"user",content:await Promise.all(s.map(async(r)=>{let a=t.tools.find((n)=>("name"in n?n.name:n.mcp_server_name)===r.name);if(!a||!("run"in a))return{type:"tool_result",tool_use_id:r.id,content:`Error: Tool '${r.name}' not found`,is_error:!0};try{let n=r.input;if("parse"in a&&a.parse)n=a.parse(n);let i=await a.run(n);return{type:"tool_result",tool_use_id:r.id,content:i}}catch(n){return{type:"tool_result",tool_use_id:r.id,content:n instanceof fr?n.content:`Error: ${n instanceof Error?n.message:String(n)}`,is_error:!0}}}))}}class Xs{constructor(t,e){this.iterator=t,this.controller=e}async*decoder(){let t=new we;for await(let e of this.iterator)for(let s of t.decode(e))yield JSON.parse(s);for(let e of t.flush())yield JSON.parse(e)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(t,e){if(!t.body){if(e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new ht("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new ht("Attempted to iterate over a response with no body")}return new Xs(pr(t.body),e)}}class Rr extends R0{create(t,e){let{betas:s,...r}=t;return this._client.post("/v1/messages/batches?beta=true",{body:r,...e,headers:ft([{"anthropic-beta":[...s??[],"message-batches-2024-09-24"].toString()},e?.headers])})}retrieve(t,e={},s){let{betas:r}=e??{};return this._client.get(Qt`/v1/messages/batches/${t}?beta=true`,{...s,headers:ft([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},s?.headers])})}list(t={},e){let{betas:s,...r}=t??{};return this._client.getAPIList("/v1/messages/batches?beta=true",Ke,{query:r,...e,headers:ft([{"anthropic-beta":[...s??[],"message-batches-2024-09-24"].toString()},e?.headers])})}delete(t,e={},s){let{betas:r}=e??{};return this._client.delete(Qt`/v1/messages/batches/${t}?beta=true`,{...s,headers:ft([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},s?.headers])})}cancel(t,e={},s){let{betas:r}=e??{};return this._client.post(Qt`/v1/messages/batches/${t}/cancel?beta=true`,{...s,headers:ft([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString()},s?.headers])})}async results(t,e={},s){let r=await this.retrieve(t);if(!r.results_url)throw new ht(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);let{betas:a}=e??{};return this._client.get(r.results_url,{...s,headers:ft([{"anthropic-beta":[...a??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},s?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((n,i)=>Xs.fromResponse(i.response,i.controller))}}var eh={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},Gp=["claude-opus-4-6"];class He extends R0{constructor(){super(...arguments);this.batches=new Rr(this._client)}create(t,e){let s=ah(t),{betas:r,...a}=s;if(a.model in eh)console.warn(`The model '${a.model}' is deprecated and will reach end-of-life on ${eh[a.model]}
|
|
40
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(a.model in Gp&&a.thinking&&a.thinking.type==="enabled")console.warn(`Using Claude with ${a.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let n=this._client._options.timeout;if(!a.stream&&n==null){let h=pc[a.model]??void 0;n=this._client.calculateNonstreamingTimeout(a.max_tokens,h)}let i=yc(a.tools,a.messages);return this._client.post("/v1/messages?beta=true",{body:a,timeout:n??600000,...e,headers:ft([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i,e?.headers]),stream:s.stream??!1})}parse(t,e){return e={...e,headers:ft([{"anthropic-beta":[...t.betas??[],"structured-outputs-2025-12-15"].toString()},e?.headers])},this.create(t,e).then((s)=>uc(s,t,{logger:this._client.logger??console}))}stream(t,e){return Is.createMessage(this,t,e)}countTokens(t,e){let s=ah(t),{betas:r,...a}=s;return this._client.post("/v1/messages/count_tokens?beta=true",{body:a,...e,headers:ft([{"anthropic-beta":[...r??[],"token-counting-2024-11-01"].toString()},e?.headers])})}toolRunner(t,e){return new xr(this._client,t,e)}}function ah(t){if(!t.output_format)return t;if(t.output_config?.format)throw new ht("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:e,...s}=t;return{...s,output_config:{...t.output_config,format:e}}}He.Batches=Rr;He.BetaToolRunner=xr;He.ToolError=fr;class Ir extends R0{create(t,e={},s){let{betas:r,...a}=e??{};return this._client.post(Qt`/v1/skills/${t}/versions?beta=true`,Sr({body:a,...s,headers:ft([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},s?.headers])},this._client))}retrieve(t,e,s){let{skill_id:r,betas:a}=e;return this._client.get(Qt`/v1/skills/${r}/versions/${t}?beta=true`,{...s,headers:ft([{"anthropic-beta":[...a??[],"skills-2025-10-02"].toString()},s?.headers])})}list(t,e={},s){let{betas:r,...a}=e??{};return this._client.getAPIList(Qt`/v1/skills/${t}/versions?beta=true`,lr,{query:a,...s,headers:ft([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},s?.headers])})}delete(t,e,s){let{skill_id:r,betas:a}=e;return this._client.delete(Qt`/v1/skills/${r}/versions/${t}?beta=true`,{...s,headers:ft([{"anthropic-beta":[...a??[],"skills-2025-10-02"].toString()},s?.headers])})}}class $s extends R0{constructor(){super(...arguments);this.versions=new Ir(this._client)}create(t={},e){let{betas:s,...r}=t??{};return this._client.post("/v1/skills?beta=true",Sr({body:r,...e,headers:ft([{"anthropic-beta":[...s??[],"skills-2025-10-02"].toString()},e?.headers])},this._client,!1))}retrieve(t,e={},s){let{betas:r}=e??{};return this._client.get(Qt`/v1/skills/${t}?beta=true`,{...s,headers:ft([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},s?.headers])})}list(t={},e){let{betas:s,...r}=t??{};return this._client.getAPIList("/v1/skills?beta=true",lr,{query:r,...e,headers:ft([{"anthropic-beta":[...s??[],"skills-2025-10-02"].toString()},e?.headers])})}delete(t,e={},s){let{betas:r}=e??{};return this._client.delete(Qt`/v1/skills/${t}?beta=true`,{...s,headers:ft([{"anthropic-beta":[...r??[],"skills-2025-10-02"].toString()},s?.headers])})}}$s.Versions=Ir;class pe extends R0{constructor(){super(...arguments);this.models=new kr(this._client),this.messages=new He(this._client),this.files=new Tr(this._client),this.skills=new $s(this._client)}}pe.Models=kr;pe.Messages=He;pe.Files=Tr;pe.Skills=$s;class vr extends R0{create(t,e){let{betas:s,...r}=t;return this._client.post("/v1/complete",{body:r,timeout:this._client._options.timeout??600000,...e,headers:ft([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},e?.headers]),stream:t.stream??!1})}}function Sc(t){return t?.output_config?.format}function sh(t,e,s){let r=Sc(e);if(!e||!("parse"in(r??{})))return{...t,content:t.content.map((a)=>{if(a.type==="text")return Object.defineProperty({...a},"parsed_output",{value:null,enumerable:!1});return a}),parsed_output:null};return Tc(t,e,s)}function Tc(t,e,s){let r=null,a=t.content.map((n)=>{if(n.type==="text"){let i=Wp(e,n.text);if(r===null)r=i;return Object.defineProperty({...n},"parsed_output",{value:i,enumerable:!1})}return n});return{...t,content:a,parsed_output:r}}function Wp(t,e){let s=Sc(t);if(s?.type!=="json_schema")return null;try{if("parse"in s)return s.parse(e);return JSON.parse(e)}catch(r){throw new ht(`Failed to parse structured output: ${r}`)}}var l0,Q0,fe,na,rs,ia,ha,ns,ca,N0,da,is,hs,se,cs,ds,oa,M3,rh,P3,L3,j3,q3,nh,ih="__json_buf";function hh(t){return t.type==="tool_use"||t.type==="server_tool_use"}class vs{constructor(t,e){l0.add(this),this.messages=[],this.receivedMessages=[],Q0.set(this,void 0),fe.set(this,null),this.controller=new AbortController,na.set(this,void 0),rs.set(this,()=>{}),ia.set(this,()=>{}),ha.set(this,void 0),ns.set(this,()=>{}),ca.set(this,()=>{}),N0.set(this,{}),da.set(this,!1),is.set(this,!1),hs.set(this,!1),se.set(this,!1),cs.set(this,void 0),ds.set(this,void 0),oa.set(this,void 0),P3.set(this,(s)=>{if(Q(this,is,!0,"f"),Ta(s))s=new k0;if(s instanceof k0)return Q(this,hs,!0,"f"),this._emit("abort",s);if(s instanceof ht)return this._emit("error",s);if(s instanceof Error){let r=new ht(s.message);return r.cause=s,this._emit("error",r)}return this._emit("error",new ht(String(s)))}),Q(this,na,new Promise((s,r)=>{Q(this,rs,s,"f"),Q(this,ia,r,"f")}),"f"),Q(this,ha,new Promise((s,r)=>{Q(this,ns,s,"f"),Q(this,ca,r,"f")}),"f"),M(this,na,"f").catch(()=>{}),M(this,ha,"f").catch(()=>{}),Q(this,fe,t,"f"),Q(this,oa,e?.logger??console,"f")}get response(){return M(this,cs,"f")}get request_id(){return M(this,ds,"f")}async withResponse(){Q(this,se,!0,"f");let t=await M(this,na,"f");if(!t)throw Error("Could not resolve a `Response` object");return{data:this,response:t,request_id:t.headers.get("request-id")}}static fromReadableStream(t){let e=new vs(null);return e._run(()=>e._fromReadableStream(t)),e}static createMessage(t,e,s,{logger:r}={}){let a=new vs(e,{logger:r});for(let n of e.messages)a._addMessageParam(n);return Q(a,fe,{...e,stream:!0},"f"),a._run(()=>a._createMessage(t,{...e,stream:!0},{...s,headers:{...s?.headers,"X-Stainless-Helper-Method":"stream"}})),a}_run(t){t().then(()=>{this._emitFinal(),this._emit("end")},M(this,P3,"f"))}_addMessageParam(t){this.messages.push(t)}_addMessage(t,e=!0){if(this.receivedMessages.push(t),e)this._emit("message",t)}async _createMessage(t,e,s){let r=s?.signal,a;if(r){if(r.aborted)this.controller.abort();a=this.controller.abort.bind(this.controller),r.addEventListener("abort",a)}try{M(this,l0,"m",L3).call(this);let{response:n,data:i}=await t.create({...e,stream:!0},{...s,signal:this.controller.signal}).withResponse();this._connected(n);for await(let h of i)M(this,l0,"m",j3).call(this,h);if(i.controller.signal?.aborted)throw new k0;M(this,l0,"m",q3).call(this)}finally{if(r&&a)r.removeEventListener("abort",a)}}_connected(t){if(this.ended)return;Q(this,cs,t,"f"),Q(this,ds,t?.headers.get("request-id"),"f"),M(this,rs,"f").call(this,t),this._emit("connect")}get ended(){return M(this,da,"f")}get errored(){return M(this,is,"f")}get aborted(){return M(this,hs,"f")}abort(){this.controller.abort()}on(t,e){return(M(this,N0,"f")[t]||(M(this,N0,"f")[t]=[])).push({listener:e}),this}off(t,e){let s=M(this,N0,"f")[t];if(!s)return this;let r=s.findIndex((a)=>a.listener===e);if(r>=0)s.splice(r,1);return this}once(t,e){return(M(this,N0,"f")[t]||(M(this,N0,"f")[t]=[])).push({listener:e,once:!0}),this}emitted(t){return new Promise((e,s)=>{if(Q(this,se,!0,"f"),t!=="error")this.once("error",s);this.once(t,e)})}async done(){Q(this,se,!0,"f"),await M(this,ha,"f")}get currentMessage(){return M(this,Q0,"f")}async finalMessage(){return await this.done(),M(this,l0,"m",M3).call(this)}async finalText(){return await this.done(),M(this,l0,"m",rh).call(this)}_emit(t,...e){if(M(this,da,"f"))return;if(t==="end")Q(this,da,!0,"f"),M(this,ns,"f").call(this);let s=M(this,N0,"f")[t];if(s)M(this,N0,"f")[t]=s.filter((r)=>!r.once),s.forEach(({listener:r})=>r(...e));if(t==="abort"){let r=e[0];if(!M(this,se,"f")&&!s?.length)Promise.reject(r);M(this,ia,"f").call(this,r),M(this,ca,"f").call(this,r),this._emit("end");return}if(t==="error"){let r=e[0];if(!M(this,se,"f")&&!s?.length)Promise.reject(r);M(this,ia,"f").call(this,r),M(this,ca,"f").call(this,r),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",M(this,l0,"m",M3).call(this))}async _fromReadableStream(t,e){let s=e?.signal,r;if(s){if(s.aborted)this.controller.abort();r=this.controller.abort.bind(this.controller),s.addEventListener("abort",r)}try{M(this,l0,"m",L3).call(this),this._connected(null);let a=q0.fromReadableStream(t,this.controller);for await(let n of a)M(this,l0,"m",j3).call(this,n);if(a.controller.signal?.aborted)throw new k0;M(this,l0,"m",q3).call(this)}finally{if(s&&r)s.removeEventListener("abort",r)}}[(Q0=new WeakMap,fe=new WeakMap,na=new WeakMap,rs=new WeakMap,ia=new WeakMap,ha=new WeakMap,ns=new WeakMap,ca=new WeakMap,N0=new WeakMap,da=new WeakMap,is=new WeakMap,hs=new WeakMap,se=new WeakMap,cs=new WeakMap,ds=new WeakMap,oa=new WeakMap,P3=new WeakMap,l0=new WeakSet,M3=function(){if(this.receivedMessages.length===0)throw new ht("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},rh=function(){if(this.receivedMessages.length===0)throw new ht("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((e)=>e.type==="text").map((e)=>e.text);if(t.length===0)throw new ht("stream ended without producing a content block with type=text");return t.join(" ")},L3=function(){if(this.ended)return;Q(this,Q0,void 0,"f")},j3=function(t){if(this.ended)return;let e=M(this,l0,"m",nh).call(this,t);switch(this._emit("streamEvent",t,e),t.type){case"content_block_delta":{let s=e.content.at(-1);switch(t.delta.type){case"text_delta":{if(s.type==="text")this._emit("text",t.delta.text,s.text||"");break}case"citations_delta":{if(s.type==="text")this._emit("citation",t.delta.citation,s.citations??[]);break}case"input_json_delta":{if(hh(s)&&s.input)this._emit("inputJson",t.delta.partial_json,s.input);break}case"thinking_delta":{if(s.type==="thinking")this._emit("thinking",t.delta.thinking,s.thinking);break}case"signature_delta":{if(s.type==="thinking")this._emit("signature",s.signature);break}default:ch(t.delta)}break}case"message_stop":{this._addMessageParam(e),this._addMessage(sh(e,M(this,fe,"f"),{logger:M(this,oa,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",e.content.at(-1));break}case"message_start":{Q(this,Q0,e,"f");break}case"content_block_start":case"message_delta":break}},q3=function(){if(this.ended)throw new ht("stream has ended, this shouldn't happen");let t=M(this,Q0,"f");if(!t)throw new ht("request ended without sending any chunks");return Q(this,Q0,void 0,"f"),sh(t,M(this,fe,"f"),{logger:M(this,oa,"f")})},nh=function(t){let e=M(this,Q0,"f");if(t.type==="message_start"){if(e)throw new ht(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!e)throw new ht(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return e;case"message_delta":if(e.stop_reason=t.delta.stop_reason,e.stop_sequence=t.delta.stop_sequence,e.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null)e.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)e.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)e.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)e.usage.server_tool_use=t.usage.server_tool_use;return e;case"content_block_start":return e.content.push({...t.content_block}),e;case"content_block_delta":{let s=e.content.at(t.index);switch(t.delta.type){case"text_delta":{if(s?.type==="text")e.content[t.index]={...s,text:(s.text||"")+t.delta.text};break}case"citations_delta":{if(s?.type==="text")e.content[t.index]={...s,citations:[...s.citations??[],t.delta.citation]};break}case"input_json_delta":{if(s&&hh(s)){let r=s[ih]||"";r+=t.delta.partial_json;let a={...s};if(Object.defineProperty(a,ih,{value:r,enumerable:!1,writable:!0}),r)a.input=lc(r);e.content[t.index]=a}break}case"thinking_delta":{if(s?.type==="thinking")e.content[t.index]={...s,thinking:s.thinking+t.delta.thinking};break}case"signature_delta":{if(s?.type==="thinking")e.content[t.index]={...s,signature:t.delta.signature};break}default:ch(t.delta)}return e}case"content_block_stop":return e}},Symbol.asyncIterator)](){let t=[],e=[],s=!1;return this.on("streamEvent",(r)=>{let a=e.shift();if(a)a.resolve(r);else t.push(r)}),this.on("end",()=>{s=!0;for(let r of e)r.resolve(void 0);e.length=0}),this.on("abort",(r)=>{s=!0;for(let a of e)a.reject(r);e.length=0}),this.on("error",(r)=>{s=!0;for(let a of e)a.reject(r);e.length=0}),{next:async()=>{if(!t.length){if(s)return{value:void 0,done:!0};return new Promise((r,a)=>e.push({resolve:r,reject:a})).then((r)=>r?{value:r,done:!1}:{value:void 0,done:!0})}return{value:t.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new q0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function ch(t){}class Cr extends R0{create(t,e){return this._client.post("/v1/messages/batches",{body:t,...e})}retrieve(t,e){return this._client.get(Qt`/v1/messages/batches/${t}`,e)}list(t={},e){return this._client.getAPIList("/v1/messages/batches",Ke,{query:t,...e})}delete(t,e){return this._client.delete(Qt`/v1/messages/batches/${t}`,e)}cancel(t,e){return this._client.post(Qt`/v1/messages/batches/${t}/cancel`,e)}async results(t,e){let s=await this.retrieve(t);if(!s.results_url)throw new ht(`No batch \`results_url\`; Has it finished processing? ${s.processing_status} - ${s.id}`);return this._client.get(s.results_url,{...e,headers:ft([{Accept:"application/binary"},e?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((r,a)=>Xs.fromResponse(a.response,a.controller))}}class t3 extends R0{constructor(){super(...arguments);this.batches=new Cr(this._client)}create(t,e){if(t.model in dh)console.warn(`The model '${t.model}' is deprecated and will reach end-of-life on ${dh[t.model]}
|
|
41
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(t.model in zp&&t.thinking&&t.thinking.type==="enabled")console.warn(`Using Claude with ${t.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let s=this._client._options.timeout;if(!t.stream&&s==null){let a=pc[t.model]??void 0;s=this._client.calculateNonstreamingTimeout(t.max_tokens,a)}let r=yc(t.tools,t.messages);return this._client.post("/v1/messages",{body:t,timeout:s??600000,...e,headers:ft([r,e?.headers]),stream:t.stream??!1})}parse(t,e){return this.create(t,e).then((s)=>Tc(s,t,{logger:this._client.logger??console}))}stream(t,e){return vs.createMessage(this,t,e,{logger:this._client.logger??console})}countTokens(t,e){return this._client.post("/v1/messages/count_tokens",{body:t,...e})}}var dh={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026"},zp=["claude-opus-4-6"];t3.Batches=Cr;class Ar extends R0{retrieve(t,e={},s){let{betas:r}=e??{};return this._client.get(Qt`/v1/models/${t}`,{...s,headers:ft([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},s?.headers])})}list(t={},e){let{betas:s,...r}=t??{};return this._client.getAPIList("/v1/models",Ke,{query:r,...e,headers:ft([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},e?.headers])})}}var os=(t)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim();return},U3,br,ls,kc,Qp="\\n\\nHuman:",Jp="\\n\\nAssistant:";class Dt{constructor({baseURL:t=os("ANTHROPIC_BASE_URL"),apiKey:e=os("ANTHROPIC_API_KEY")??null,authToken:s=os("ANTHROPIC_AUTH_TOKEN")??null,...r}={}){U3.add(this),ls.set(this,void 0);let a={apiKey:e,authToken:s,...r,baseURL:t||"https://api.anthropic.com"};if(!a.dangerouslyAllowBrowser&&pp())throw new ht(`It looks like you're running in a browser-like environment.
|
|
42
|
-
|
|
43
|
-
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
44
|
-
If you understand the risks and have appropriate mitigations in place,
|
|
45
|
-
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
46
|
-
|
|
47
|
-
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
48
|
-
`);this.baseURL=a.baseURL,this.timeout=a.timeout??br.DEFAULT_TIMEOUT,this.logger=a.logger??console;let n="warn";this.logLevel=n,this.logLevel=Hi(a.logLevel,"ClientOptions.logLevel",this)??Hi(os("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??n,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??Tp(),Q(this,ls,fp,"f"),this._options=a,this.apiKey=typeof e==="string"?e:null,this.authToken=s}withOptions(t){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...t})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:e}){if(t.get("x-api-key")||t.get("authorization"))return;if(this.apiKey&&t.get("x-api-key"))return;if(e.has("x-api-key"))return;if(this.authToken&&t.get("authorization"))return;if(e.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders(t){return ft([await this.apiKeyAuth(t),await this.bearerAuth(t)])}async apiKeyAuth(t){if(this.apiKey==null)return;return ft([{"X-Api-Key":this.apiKey}])}async bearerAuth(t){if(this.authToken==null)return;return ft([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(t){return xp(t)}getUserAgent(){return`${this.constructor.name}/JS ${Re}`}defaultIdempotencyKey(){return`stainless-node-retry-${Xh()}`}makeStatusError(t,e,s,r){return t0.generate(t,e,s,r)}buildURL(t,e,s){let r=!M(this,U3,"m",kc).call(this)&&s||this.baseURL,a=dp(t)?new URL(t):new URL(r+(r.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),n=this.defaultQuery(),i=Object.fromEntries(a.searchParams);if(!_i(n)||!_i(i))e={...i,...n,...e};if(typeof e==="object"&&e&&!Array.isArray(e))a.search=this.stringifyQuery(e);return a.toString()}_calculateNonstreamingTimeout(t){if(3600*t/128000>600)throw new ht("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(t){}async prepareRequest(t,{url:e,options:s}){}get(t,e){return this.methodRequest("get",t,e)}post(t,e){return this.methodRequest("post",t,e)}patch(t,e){return this.methodRequest("patch",t,e)}put(t,e){return this.methodRequest("put",t,e)}delete(t,e){return this.methodRequest("delete",t,e)}methodRequest(t,e,s){return this.request(Promise.resolve(s).then((r)=>{return{method:t,path:e,...r}}))}request(t,e=null){return new Ys(this,this.makeRequest(t,e,void 0))}async makeRequest(t,e,s){let r=await t,a=r.maxRetries??this.maxRetries;if(e==null)e=a;await this.prepareOptions(r);let{req:n,url:i,timeout:h}=await this.buildRequest(r,{retryCount:a-e});await this.prepareRequest(n,{url:i,options:r});let c="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),d=s===void 0?"":`, retryOf: ${s}`,E=Date.now();if(a0(this).debug(`[${c}] sending request`,re({retryOfRequestLogID:s,method:r.method,url:i,options:r,headers:n.headers})),r.signal?.aborted)throw new k0;let l=new AbortController,p=await this.fetchWithTimeout(i,n,h,l).catch(V3),f=Date.now();if(p instanceof globalThis.Error){let x=`retrying, ${e} attempts remaining`;if(r.signal?.aborted)throw new k0;let o=Ta(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(e)return a0(this).info(`[${c}] connection ${o?"timed out":"failed"} - ${x}`),a0(this).debug(`[${c}] connection ${o?"timed out":"failed"} (${x})`,re({retryOfRequestLogID:s,url:i,durationMs:f-E,message:p.message})),this.retryRequest(r,e,s??c);if(a0(this).info(`[${c}] connection ${o?"timed out":"failed"} - error; no more retries left`),a0(this).debug(`[${c}] connection ${o?"timed out":"failed"} (error; no more retries left)`,re({retryOfRequestLogID:s,url:i,durationMs:f-E,message:p.message})),o)throw new rr;throw new _a({cause:p})}let I=[...p.headers.entries()].filter(([x])=>x==="request-id").map(([x,o])=>", "+x+": "+JSON.stringify(o)).join(""),v=`[${c}${d}${I}] ${n.method} ${i} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${f-E}ms`;if(!p.ok){let x=await this.shouldRetry(p);if(e&&x){let k=`retrying, ${e} attempts remaining`;return await kp(p.body),a0(this).info(`${v} - ${k}`),a0(this).debug(`[${c}] response error (${k})`,re({retryOfRequestLogID:s,url:p.url,status:p.status,headers:p.headers,durationMs:f-E})),this.retryRequest(r,e,s??c,p.headers)}let o=x?"error; no more retries left":"error; not retryable";a0(this).info(`${v} - ${o}`);let u=await p.text().catch((k)=>V3(k).message),y=$h(u),m=y?void 0:u;throw a0(this).debug(`[${c}] response error (${o})`,re({retryOfRequestLogID:s,url:p.url,status:p.status,headers:p.headers,message:m,durationMs:Date.now()-E})),this.makeStatusError(p.status,y,m,p.headers)}return a0(this).info(v),a0(this).debug(`[${c}] response start`,re({retryOfRequestLogID:s,url:p.url,status:p.status,headers:p.headers,durationMs:f-E})),{response:p,options:r,controller:l,requestLogID:c,retryOfRequestLogID:s,startTime:E}}getAPIList(t,e,s){return this.requestAPIList(e,s&&"then"in s?s.then((r)=>({method:"get",path:t,...r})):{method:"get",path:t,...s})}requestAPIList(t,e){let s=this.makeRequest(e,null,void 0);return new nc(this,s,t)}async fetchWithTimeout(t,e,s,r){let{signal:a,method:n,...i}=e||{},h=this._makeAbort(r);if(a)a.addEventListener("abort",h,{once:!0});let c=setTimeout(h,s),d=globalThis.ReadableStream&&i.body instanceof globalThis.ReadableStream||typeof i.body==="object"&&i.body!==null&&Symbol.asyncIterator in i.body,E={signal:r.signal,...d?{duplex:"half"}:{},method:"GET",...i};if(n)E.method=n.toUpperCase();try{return await this.fetch.call(void 0,t,E)}finally{clearTimeout(c)}}async shouldRetry(t){let e=t.headers.get("x-should-retry");if(e==="true")return!0;if(e==="false")return!1;if(t.status===408)return!0;if(t.status===409)return!0;if(t.status===429)return!0;if(t.status>=500)return!0;return!1}async retryRequest(t,e,s,r){let a,n=r?.get("retry-after-ms");if(n){let h=parseFloat(n);if(!Number.isNaN(h))a=h}let i=r?.get("retry-after");if(i&&!a){let h=parseFloat(i);if(!Number.isNaN(h))a=h*1000;else a=Date.parse(i)-Date.now()}if(a===void 0){let h=t.maxRetries??this.maxRetries;a=this.calculateDefaultRetryTimeoutMillis(e,h)}return await mp(a),this.makeRequest(t,e-1,s)}calculateDefaultRetryTimeoutMillis(t,e){let s=e-t,r=Math.min(0.5*Math.pow(2,s),8),a=1-Math.random()*0.25;return r*a*1000}calculateNonstreamingTimeout(t,e){if(3600000*t/128000>600000||e!=null&&t>e)throw new ht("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(t,{retryCount:e=0}={}){let s={...t},{method:r,path:a,query:n,defaultBaseURL:i}=s,h=this.buildURL(a,n,i);if("timeout"in s)yp("timeout",s.timeout);s.timeout=s.timeout??this.timeout;let{bodyHeaders:c,body:d}=this.buildBody({options:s}),E=await this.buildHeaders({options:t,method:r,bodyHeaders:c,retryCount:e});return{req:{method:r,headers:E,...s.signal&&{signal:s.signal},...globalThis.ReadableStream&&d instanceof globalThis.ReadableStream&&{duplex:"half"},...d&&{body:d},...this.fetchOptions??{},...s.fetchOptions??{}},url:h,timeout:s.timeout}}async buildHeaders({options:t,method:e,bodyHeaders:s,retryCount:r}){let a={};if(this.idempotencyHeader&&e!=="get"){if(!t.idempotencyKey)t.idempotencyKey=this.defaultIdempotencyKey();a[this.idempotencyHeader]=t.idempotencyKey}let n=ft([a,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1000))}:{},...Sp(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(t),this._options.defaultHeaders,s,t.headers]);return this.validateHeaders(n),n.values}_makeAbort(t){return()=>t.abort()}buildBody({options:{body:t,headers:e}}){if(!t)return{bodyHeaders:void 0,body:void 0};let s=ft([e]);if(ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t==="string"&&s.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:t};else if(typeof t==="object"&&((Symbol.asyncIterator in t)||(Symbol.iterator in t)&&("next"in t)&&typeof t.next==="function"))return{bodyHeaders:void 0,body:ec(t)};else if(typeof t==="object"&&s.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(t)};else return M(this,ls,"f").call(this,{body:t,headers:s})}}br=Dt,ls=new WeakMap,U3=new WeakSet,kc=function(){return this.baseURL!=="https://api.anthropic.com"};Dt.Anthropic=br;Dt.HUMAN_PROMPT=Qp;Dt.AI_PROMPT=Jp;Dt.DEFAULT_TIMEOUT=600000;Dt.AnthropicError=ht;Dt.APIError=t0;Dt.APIConnectionError=_a;Dt.APIConnectionTimeoutError=rr;Dt.APIUserAbortError=k0;Dt.NotFoundError=cr;Dt.ConflictError=dr;Dt.RateLimitError=yr;Dt.BadRequestError=nr;Dt.AuthenticationError=ir;Dt.InternalServerError=mr;Dt.PermissionDeniedError=hr;Dt.UnprocessableEntityError=or;Dt.toFile=jp;class Da extends Dt{constructor(){super(...arguments);this.completions=new vr(this),this.messages=new t3(this),this.models=new Ar(this),this.beta=new pe(this)}}Da.Completions=vr;Da.Messages=t3;Da.Models=Ar;Da.Beta=pe;function Yp(t){return t instanceof Error?t:Error(String(t))}function Ss(t){return t instanceof Error?t.message:String(t)}function Ts(t){if(t&&typeof t==="object"&&"code"in t&&typeof t.code==="string")return t.code;return}function Xp(t){return Ts(t)==="ENOENT"}var Ze,xe=null;function aE(){if(xe)return xe;if(!ne(process.env.DEBUG_CLAUDE_AGENT_SDK))return Ze=null,xe=Promise.resolve(),xe;let t=oh(Yh(),"debug");return Ze=oh(t,`sdk-${$p()}.txt`),process.stderr.write(`SDK debug logs: ${Ze}
|
|
49
|
-
`),xe=eE(t,{recursive:!0}).then(()=>{}).catch(()=>{}),xe}function S0(t){if(Ze===null)return;let e=`${new Date().toISOString()} ${t}
|
|
50
|
-
`;aE().then(()=>{if(Ze)tE(Ze,e).catch(()=>{})})}function xc(){let t=new Set;return{subscribe(e){return t.add(e),()=>{t.delete(e)}},emit(...e){for(let s of t)s(...e)},clear(){t.clear()}}}function rE(){let t="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof yh==="function"){let e=sE();try{t=yh(e).normalize("NFC")}catch{t=e.normalize("NFC")}}return{originalCwd:t,projectRoot:t,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,turnHookDurationMs:0,turnToolDurationMs:0,turnClassifierDurationMs:0,turnToolCount:0,turnHookCount:0,turnClassifierCount:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:t,modelUsage:{},mainLoopModelOverride:void 0,initialMainLoopModel:null,modelStrings:null,isInteractive:!1,kairosActive:!1,strictToolResultPairing:!1,memoryToggledOff:!1,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,clientType:"cli",sessionSource:void 0,questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,apiKeyFromFd:void 0,flagSettingsPath:void 0,flagSettingsInline:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:fc(),parentSessionId:void 0,loggerProvider:null,eventLogger:null,meterProvider:null,tracerProvider:null,agentColorMap:new Map,agentColorIndex:0,lastAPIRequest:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],chromeFlagOverride:void 0,useCoworkPlugins:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionCronTasks:[],sessionCreatedTeams:new Set,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,mainThreadAgentType:void 0,isRemoteMode:!1,...!1,directConnectServerUrl:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,afkModeHeaderLatched:null,fastModeHeaderLatched:null,cacheEditingHeaderLatched:null,thinkingClearLatched:null,promptId:null,lastMainRequestId:void 0,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var nE=rE();function iE(){return nE.sessionId}var hE=xc(),mf=hE.subscribe,cE=xc(),pf=cE.subscribe;function pE({writeFn:t,flushIntervalMs:e=1000,maxBufferSize:s=100,maxBufferBytes:r=1/0,immediateMode:a=!1}){let n=[],i=0,h=null,c=null;function d(){if(h)clearTimeout(h),h=null}function E(){if(c)t(c.join("")),c=null;if(n.length===0)return;t(n.join("")),n=[],i=0,d()}function l(){if(!h)h=setTimeout(E,e)}function p(){if(c){c.push(...n),n=[],i=0,d();return}let f=n;n=[],i=0,d(),c=f,setImmediate(()=>{let I=c;if(c=null,I)t(I.join(""))})}return{write(f){if(a){t(f);return}if(n.push(f),i+=f.length,l(),n.length>=s||i>=r)p()},flush:E,dispose(){E()}}}var mh=new Set;function EE(t){return mh.add(t),()=>mh.delete(t)}var uE=te((t)=>{if(!t||t.trim()==="")return null;let e=t.split(",").map((n)=>n.trim()).filter(Boolean);if(e.length===0)return null;let s=e.some((n)=>n.startsWith("!")),r=e.some((n)=>!n.startsWith("!"));if(s&&r)return null;let a=e.map((n)=>n.replace(/^!/,"").toLowerCase());return{include:s?[]:a,exclude:s?a:[],isExclusive:s}});function lE(t){let e=[],s=t.match(/^MCP server ["']([^"']+)["']/);if(s&&s[1])e.push("mcp"),e.push(s[1].toLowerCase());else{let n=t.match(/^([^:[]+):/);if(n&&n[1])e.push(n[1].trim().toLowerCase())}let r=t.match(/^\[([^\]]+)]/);if(r&&r[1])e.push(r[1].trim().toLowerCase());if(t.toLowerCase().includes("1p event:"))e.push("1p");let a=t.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(a&&a[1]){let n=a[1].trim().toLowerCase();if(n.length<30&&!n.includes(" "))e.push(n)}return Array.from(new Set(e))}function SE(t,e){if(!e)return!0;if(t.length===0)return!1;if(e.isExclusive)return!t.some((s)=>e.exclude.includes(s));else return t.some((s)=>e.include.includes(s))}function TE(t,e){if(!e)return!0;let s=lE(t);return SE(s,e)}var bE={cwd(){return process.cwd()},existsSync(t){let e=[];try{let a=Lt(e,qt`fs.existsSync(${t})`,0);return ct.existsSync(t)}catch(a){var s=a,r=1}finally{jt(e,s,r)}},async stat(t){return CE(t)},async readdir(t){return xE(t,{withFileTypes:!0})},async unlink(t){return AE(t)},async rmdir(t){return IE(t)},async rm(t,e){return vE(t,e)},async mkdir(t,e){try{await kE(t,{recursive:!0,...e})}catch(s){if(Ts(s)!=="EEXIST")throw s}},async readFile(t,e){return ph(t,{encoding:e.encoding})},async rename(t,e){return RE(t,e)},statSync(t){let e=[];try{let a=Lt(e,qt`fs.statSync(${t})`,0);return ct.statSync(t)}catch(a){var s=a,r=1}finally{jt(e,s,r)}},lstatSync(t){let e=[];try{let a=Lt(e,qt`fs.lstatSync(${t})`,0);return ct.lstatSync(t)}catch(a){var s=a,r=1}finally{jt(e,s,r)}},readFileSync(t,e){let s=[];try{let n=Lt(s,qt`fs.readFileSync(${t})`,0);return ct.readFileSync(t,{encoding:e.encoding})}catch(n){var r=n,a=1}finally{jt(s,r,a)}},readFileBytesSync(t){let e=[];try{let a=Lt(e,qt`fs.readFileBytesSync(${t})`,0);return ct.readFileSync(t)}catch(a){var s=a,r=1}finally{jt(e,s,r)}},readSync(t,e){let s=[];try{let n=Lt(s,qt`fs.readSync(${t}, ${e.length} bytes)`,0),i=void 0;try{i=ct.openSync(t,"r");let h=Buffer.alloc(e.length),c=ct.readSync(i,h,0,e.length,0);return{buffer:h,bytesRead:c}}finally{if(i)ct.closeSync(i)}}catch(n){var r=n,a=1}finally{jt(s,r,a)}},appendFileSync(t,e,s){let r=[];try{let i=Lt(r,qt`fs.appendFileSync(${t}, ${e.length} chars)`,0);if(s?.mode!==void 0)try{let h=ct.openSync(t,"ax",s.mode);try{ct.appendFileSync(h,e)}finally{ct.closeSync(h)}return}catch(h){if(Ts(h)!=="EEXIST")throw h}ct.appendFileSync(t,e)}catch(i){var a=i,n=1}finally{jt(r,a,n)}},copyFileSync(t,e){let s=[];try{let n=Lt(s,qt`fs.copyFileSync(${t} → ${e})`,0);ct.copyFileSync(t,e)}catch(n){var r=n,a=1}finally{jt(s,r,a)}},unlinkSync(t){let e=[];try{let a=Lt(e,qt`fs.unlinkSync(${t})`,0);ct.unlinkSync(t)}catch(a){var s=a,r=1}finally{jt(e,s,r)}},renameSync(t,e){let s=[];try{let n=Lt(s,qt`fs.renameSync(${t} → ${e})`,0);ct.renameSync(t,e)}catch(n){var r=n,a=1}finally{jt(s,r,a)}},linkSync(t,e){let s=[];try{let n=Lt(s,qt`fs.linkSync(${t} → ${e})`,0);ct.linkSync(t,e)}catch(n){var r=n,a=1}finally{jt(s,r,a)}},symlinkSync(t,e,s){let r=[];try{let i=Lt(r,qt`fs.symlinkSync(${t} → ${e})`,0);ct.symlinkSync(t,e,s)}catch(i){var a=i,n=1}finally{jt(r,a,n)}},readlinkSync(t){let e=[];try{let a=Lt(e,qt`fs.readlinkSync(${t})`,0);return ct.readlinkSync(t)}catch(a){var s=a,r=1}finally{jt(e,s,r)}},realpathSync(t){let e=[];try{let a=Lt(e,qt`fs.realpathSync(${t})`,0);return ct.realpathSync(t).normalize("NFC")}catch(a){var s=a,r=1}finally{jt(e,s,r)}},mkdirSync(t,e){let s=[];try{let n=Lt(s,qt`fs.mkdirSync(${t})`,0),i={recursive:!0};if(e?.mode!==void 0)i.mode=e.mode;try{ct.mkdirSync(t,i)}catch(h){if(Ts(h)!=="EEXIST")throw h}}catch(n){var r=n,a=1}finally{jt(s,r,a)}},readdirSync(t){let e=[];try{let a=Lt(e,qt`fs.readdirSync(${t})`,0);return ct.readdirSync(t,{withFileTypes:!0})}catch(a){var s=a,r=1}finally{jt(e,s,r)}},readdirStringSync(t){let e=[];try{let a=Lt(e,qt`fs.readdirStringSync(${t})`,0);return ct.readdirSync(t)}catch(a){var s=a,r=1}finally{jt(e,s,r)}},isDirEmptySync(t){let e=[];try{let a=Lt(e,qt`fs.isDirEmptySync(${t})`,0);return this.readdirSync(t).length===0}catch(a){var s=a,r=1}finally{jt(e,s,r)}},rmdirSync(t){let e=[];try{let a=Lt(e,qt`fs.rmdirSync(${t})`,0);ct.rmdirSync(t)}catch(a){var s=a,r=1}finally{jt(e,s,r)}},rmSync(t,e){let s=[];try{let n=Lt(s,qt`fs.rmSync(${t})`,0);ct.rmSync(t,e)}catch(n){var r=n,a=1}finally{jt(s,r,a)}},createWriteStream(t){return ct.createWriteStream(t)},async readFileBytes(t,e){if(e===void 0)return ph(t);let s=await fE(t,"r");try{let{size:r}=await s.stat(),a=Math.min(r,e),n=Buffer.allocUnsafe(a),i=0;while(i<a){let{bytesRead:h}=await s.read(n,i,a-i,i);if(h===0)break;i+=h}return i<a?n.subarray(0,i):n}finally{await s.close()}}},ZE=bE;function Eh(){return ZE}function gE(t,e){if(t.destroyed)return;t.write(e)}function FE(t){gE(process.stderr,t)}var G3={verbose:0,debug:1,info:2,warn:3,error:4},ME=te(()=>{let t=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(t&&Object.hasOwn(G3,t))return t;return"debug"}),PE=!1,W3=te(()=>{return PE||ne(process.env.DEBUG)||ne(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||vc()||process.argv.some((t)=>t.startsWith("--debug="))||Cc()!==null}),LE=te(()=>{let t=process.argv.find((s)=>s.startsWith("--debug="));if(!t)return null;let e=t.substring(8);return uE(e)}),vc=te(()=>{return process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e")}),Cc=te(()=>{for(let t=0;t<process.argv.length;t++){let e=process.argv[t];if(e.startsWith("--debug-file="))return e.substring(13);if(e==="--debug-file"&&t+1<process.argv.length)return process.argv[t+1]}return null});function jE(t){if(!W3())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let e=LE();return TE(t,e)}var qE=!1,ys=null,_3=Promise.resolve();async function _E(t,e,s,r){if(t)await oE(e,{recursive:!0}).catch(()=>{});await dE(s,r),bc()}function DE(){}function BE(){if(!ys){let t=null;ys=pE({writeFn:(e)=>{let s=Ac(),r=Rc(s),a=t!==r;if(t=r,W3()){if(a)try{Eh().mkdirSync(r)}catch{}Eh().appendFileSync(s,e),bc();return}_3=_3.then(_E.bind(null,a,r,s,e)).catch(DE)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:W3()}),EE(async()=>{ys?.dispose(),await _3})}return ys}function b0(t,{level:e}={level:"debug"}){if(G3[e]<G3[ME()])return;if(!jE(t))return;if(qE&&t.includes(`
|
|
51
|
-
`))t=T0(t);let s=`${new Date().toISOString()} [${e.toUpperCase()}] ${t.trim()}
|
|
52
|
-
`;if(vc()){FE(s);return}BE().write(s)}function Ac(){return Cc()??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??Ic(Yh(),"debug",`${iE()}.txt`)}var bc=te(async()=>{try{let t=Ac(),e=Rc(t),s=Ic(e,"latest");await mE(s).catch(()=>{}),await yE(t,s)}catch{}}),Sf=(()=>{let t=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(t!==void 0){let e=Number(t);if(!Number.isNaN(e)&&e>=0)return e}return 1/0})(),VE={[Symbol.dispose](){}};function NE(){return VE}var qt=NE;function T0(t,e,s){let r=[];try{let i=Lt(r,qt`JSON.stringify(${t})`,0);return JSON.stringify(t,e,s)}catch(i){var a=i,n=1}finally{jt(r,a,n)}}var Zr=(t,e)=>{let s=[];try{let n=Lt(s,qt`JSON.parse(${t})`,0);return typeof e>"u"?JSON.parse(t):JSON.parse(t,e)}catch(n){var r=n,a=1}finally{jt(s,r,a)}};function wE(t){let e=t.trim();return e.startsWith("{")&&e.endsWith("}")}function KE(t,e){let s={...t};if(e){let r=e.enabled===!0&&e.failIfUnavailable===void 0?{...e,failIfUnavailable:!0}:e,a=s.settings;if(a&&!wE(a))throw Error("Cannot use both a settings file path and the sandbox option. Include the sandbox configuration in your settings file instead.");let n={sandbox:r};if(a)try{n={...Zr(a),sandbox:r}}catch{}s.settings=T0(n)}return s}var HE=2000;class Zc{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];processExitHandler;abortHandler;constructor(t){this.options=t,this.abortController=t.abortController||Uh(),this.initialize()}getDefaultExecutable(){return Gh()?"bun":"node"}spawnLocalProcess(t){let{command:e,args:s,cwd:r,env:a,signal:n}=t,i=ne(a.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr?"pipe":"ignore",h=f8(e,s,{cwd:r,stdio:["pipe","pipe",i],signal:n,env:a,windowsHide:!0});if(ne(a.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr)h.stderr.on("data",(c)=>{let d=c.toString();if(S0(d),this.options.stderr)this.options.stderr(d)});return{stdin:h.stdin,stdout:h.stdout,get killed(){return h.killed},get exitCode(){return h.exitCode},kill:h.kill.bind(h),on:h.on.bind(h),once:h.once.bind(h),off:h.off.bind(h)}}initialize(){try{let{additionalDirectories:t=[],agent:e,betas:s,cwd:r,executable:a=this.getDefaultExecutable(),executableArgs:n=[],extraArgs:i={},pathToClaudeCodeExecutable:h,env:c={...process.env},thinkingConfig:d,maxTurns:E,maxBudgetUsd:l,taskBudget:p,model:f,fallbackModel:I,jsonSchema:v,permissionMode:x,allowDangerouslySkipPermissions:o,permissionPromptToolName:u,continueConversation:y,resume:m,settingSources:k,allowedTools:T=[],disallowedTools:R=[],tools:C,mcpServers:F,strictMcpConfig:B,canUseTool:_,includePartialMessages:N,plugins:O,sandbox:z}=this.options,K=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(d){switch(d.type){case"enabled":if(d.budgetTokens===void 0)K.push("--thinking","adaptive");else K.push("--max-thinking-tokens",d.budgetTokens.toString());break;case"disabled":K.push("--thinking","disabled");break;case"adaptive":K.push("--thinking","adaptive");break}if(d.type!=="disabled"&&d.display)K.push("--thinking-display",d.display)}if(this.options.effort)K.push("--effort",this.options.effort);if(E)K.push("--max-turns",E.toString());if(l!==void 0)K.push("--max-budget-usd",l.toString());if(p)K.push("--task-budget",p.total.toString());if(f)K.push("--model",f);if(e)K.push("--agent",e);if(s&&s.length>0)K.push("--betas",s.join(","));if(v)K.push("--json-schema",T0(v));if(this.options.debugFile)K.push("--debug-file",this.options.debugFile);else if(this.options.debug)K.push("--debug");if(ne(c.DEBUG_CLAUDE_AGENT_SDK))K.push("--debug-to-stderr");if(_){if(u)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");K.push("--permission-prompt-tool","stdio")}else if(u)K.push("--permission-prompt-tool",u);if(y)K.push("--continue");if(m)K.push("--resume",m);if(this.options.proactive)K.push("--proactive");if(this.options.assistant)K.push("--assistant");if(this.options.channels&&this.options.channels.length>0)K.push("--channels",...this.options.channels);if(T.length>0)K.push("--allowedTools",T.join(","));if(R.length>0)K.push("--disallowedTools",R.join(","));if(C!==void 0)if(Array.isArray(C))if(C.length===0)K.push("--tools","");else K.push("--tools",C.join(","));else K.push("--tools","default");if(F&&Object.keys(F).length>0)K.push("--mcp-config",T0({mcpServers:F}));if(k!==void 0)K.push(`--setting-sources=${k.join(",")}`);if(B)K.push("--strict-mcp-config");if(x)K.push("--permission-mode",x);if(o)K.push("--allow-dangerously-skip-permissions");if(I){if(f&&I===f)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");K.push("--fallback-model",I)}if(this.options.includeHookEvents)K.push("--include-hook-events");if(N)K.push("--include-partial-messages");for(let S of t)K.push("--add-dir",S);if(O&&O.length>0)for(let S of O)if(S.type==="local")K.push("--plugin-dir",S.path);else throw Error(`Unsupported plugin type: ${S.type}`);if(this.options.forkSession)K.push("--fork-session");if(this.options.resumeSessionAt)K.push("--resume-session-at",this.options.resumeSessionAt);if(this.options.sessionId)K.push("--session-id",this.options.sessionId);if(this.options.persistSession===!1)K.push("--no-session-persistence");let Mt={...i??{}};if(this.options.settings)Mt.settings=this.options.settings;let Ot=KE(Mt,z);for(let[S,b]of Object.entries(Ot))if(b===null)K.push(`--${S}`);else K.push(`--${S}`,b);if(!c.CLAUDE_CODE_ENTRYPOINT)c.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(delete c.NODE_OPTIONS,ne(c.DEBUG_CLAUDE_AGENT_SDK))c.DEBUG="1";else delete c.DEBUG;let Ut=OE(h),St=Ut?h:a,Z=Ut?[...n,...K]:[...n,h,...K],L={command:St,args:Z,cwd:r,env:c,signal:this.abortController.signal};if(this.options.spawnClaudeCodeProcess)S0(`Spawning Claude Code (custom): ${St} ${Z.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(L);else S0(`Spawning Claude Code: ${St} ${Z.join(" ")}`),this.process=this.spawnLocalProcess(L);this.processStdin=this.process.stdin,this.processStdout=this.process.stdout;let V=()=>{if(this.process&&!this.process.killed)this.process.kill("SIGTERM")};this.processExitHandler=V,this.abortHandler=V,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.process.on("error",(S)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new j0("Claude Code process aborted by user");else if(Xp(S)){let b=Ut?`Claude Code native binary not found at ${h}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${h}. Is options.pathToClaudeCodeExecutable set?`;this.exitError=ReferenceError(b),S0(this.exitError.message)}else this.exitError=Error(`Failed to spawn Claude Code process: ${S.message}`),S0(this.exitError.message)}),this.process.on("exit",(S,b)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new j0("Claude Code process aborted by user");else{let P=this.getProcessExitError(S,b);if(P)this.exitError=P,S0(P.message)}}),this.ready=!0}catch(t){throw this.ready=!1,t}}getProcessExitError(t,e){if(t!==0&&t!==null)return Error(`Claude Code process exited with code ${t}`);else if(e)return Error(`Claude Code process terminated by signal ${e}`);return}write(t){if(this.abortController.signal.aborted)throw new j0("Operation aborted");if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.processStdin.writableEnded){S0("[ProcessTransport] Dropping write to ended stdin stream");return}if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw Error(`Cannot write to process that exited with error: ${this.exitError.message}`);S0(`[ProcessTransport] Writing to stdin: ${t.substring(0,100)}`);try{if(!this.processStdin.write(t))S0("[ProcessTransport] Write buffer full, data queued")}catch(e){throw this.ready=!1,Error(`Failed to write to process stdin: ${Ss(e)}`)}}close(){if(this.processStdin)this.processStdin.end(),this.processStdin=void 0;if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;for(let{handler:e}of this.exitListeners)this.process?.off("exit",e);this.exitListeners=[];let t=this.process;if(t&&!t.killed&&t.exitCode===null)setTimeout((e)=>{if(e.killed||e.exitCode!==null)return;e.kill("SIGTERM"),setTimeout((s)=>{if(s.exitCode===null)s.kill("SIGKILL")},5000,e).unref()},HE,t).unref(),t.once("exit",()=>{if(this.processExitHandler)process.off("exit",this.processExitHandler),this.processExitHandler=void 0});else if(this.processExitHandler)process.off("exit",this.processExitHandler),this.processExitHandler=void 0;this.ready=!1}isReady(){return this.ready}async*readMessages(){if(!this.processStdout)throw Error("ProcessTransport output stream not available");if(this.exitError)throw this.exitError;let t=x8({input:this.processStdout}),e=this.process?(()=>{let s=this.process,r=()=>t.close();return s.on("error",r),()=>s.off("error",r)})():void 0;if(this.exitError)t.close();try{for await(let s of t)if(s.trim()){let r;try{r=Zr(s)}catch(a){S0(`Non-JSON stdout: ${s}`);continue}yield r}if(this.exitError)throw this.exitError;await this.waitForExit()}catch(s){throw s}finally{e?.(),t.close()}}endInput(){if(this.processStdin)this.processStdin.end()}getInputStream(){return this.processStdin}onExit(t){if(!this.process)return()=>{};let e=(s,r)=>{let a=this.getProcessExitError(s,r);t(a)};return this.process.on("exit",e),this.exitListeners.push({callback:t,handler:e}),()=>{if(this.process)this.process.off("exit",e);let s=this.exitListeners.findIndex((r)=>r.handler===e);if(s!==-1)this.exitListeners.splice(s,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed||this.exitError){if(this.exitError)throw this.exitError;return}return new Promise((t,e)=>{let s=(a,n)=>{if(this.abortController.signal.aborted){e(new j0("Operation aborted"));return}let i=this.getProcessExitError(a,n);if(i)e(i);else t()};this.process.once("exit",s);let r=(a)=>{this.process.off("exit",s),e(a)};this.process.once("error",r),this.process.once("exit",()=>{this.process.off("error",r)})})}}function OE(t){return![".js",".mjs",".tsx",".ts",".jsx"].some((e)=>t.endsWith(e))}function UE(t,e=process.platform,s=process.arch){let r;if(e==="linux")r=[`@anthropic-ai/claude-agent-sdk-linux-${s}-musl/cli`,`@anthropic-ai/claude-agent-sdk-linux-${s}/cli`];else if(e==="win32")r=[`@anthropic-ai/claude-agent-sdk-win32-${s}/cli.exe`];else r=[`@anthropic-ai/claude-agent-sdk-${e}-${s}/cli`];for(let a of r)try{return t(a)}catch{}return null}class gr{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(t){this.returned=t}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((t,e)=>{this.readResolve=t,this.readReject=e})}enqueue(t){if(this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!1,value:t})}else this.queue.push(t)}done(){if(this.isDone=!0,this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!0,value:void 0})}}error(t){if(this.hasError=t,this.readReject){let e=this.readReject;this.readResolve=void 0,this.readReject=void 0,e(t)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}class gc{sendMcpMessage;isClosed=!1;constructor(t){this.sendMcpMessage=t}onclose;onerror;onmessage;async start(){}async send(t){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(t)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}class Fc{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new gr;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;setIsSingleUserTurn(t){this.isSingleUserTurn=t}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0}constructor(t,e,s,r,a,n=new Map,i,h,c){this.transport=t,this.isSingleUserTurn=e,this.canUseTool=s,this.hooks=r,this.abortController=a,this.jsonSchema=i,this.initConfig=h,this.onElicitation=c;for(let[d,E]of n)this.connectSdkMcpServer(d,E);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(t){this.inputStream.error(t)}async stopTask(t){await this.request({subtype:"stop_task",task_id:t})}close(){this.cleanup()}cleanup(t){if(this.cleanupPerformed)return;this.cleanupPerformed=!0;try{for(let s of this.cancelControllers.values())s.abort();this.cancelControllers.clear(),this.transport.close();let e=Error("Query closed before response received");for(let{reject:s}of this.pendingControlResponses.values())s(e);this.pendingControlResponses.clear();for(let{reject:s}of this.pendingMcpResponses.values())s(e);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let s of this.sdkMcpTransports.values())s.close().catch(()=>{});if(this.sdkMcpTransports.clear(),t)this.inputStream.error(t);else this.inputStream.done()}catch(e){}}next(...[t]){return this.sdkMessages.next(...[t])}return(t){return this.sdkMessages.return(t)}throw(t){return this.sdkMessages.throw(t)}[Symbol.asyncIterator](){return this.sdkMessages}[Symbol.asyncDispose](){return this.sdkMessages[Symbol.asyncDispose]()}async readMessages(){try{for await(let t of this.transport.readMessages()){if(t.type==="control_response"){let e=this.pendingControlResponses.get(t.response.request_id);if(e)e.handler(t.response);continue}else if(t.type==="control_request"){this.handleControlRequest(t);continue}else if(t.type==="control_cancel_request"){this.handleControlCancelRequest(t);continue}else if(t.type==="keep_alive")continue;if(t.type==="system"&&t.subtype==="post_turn_summary")continue;if(t.type==="result"){if(this.lastErrorResultText=t.is_error?t.subtype==="success"?t.result:t.errors.join("; "):void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)b0("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput()}else if(!(t.type==="system"&&t.subtype==="session_state_changed"))this.lastErrorResultText=void 0;this.inputStream.enqueue(t)}if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.done(),this.cleanup()}catch(t){if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.lastErrorResultText!==void 0&&!(t instanceof j0)){let e=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);b0(`[Query.readMessages] Replacing exit error with result text. Original: ${Ss(t)}`),this.inputStream.error(e),this.cleanup(e);return}this.inputStream.error(t),this.cleanup(t)}}async handleControlRequest(t){let e=new AbortController;this.cancelControllers.set(t.request_id,e);try{let s=await this.processControlRequest(t,e.signal);if(this.cleanupPerformed)return;let r={type:"control_response",response:{subtype:"success",request_id:t.request_id,response:s}};await Promise.resolve(this.transport.write(T0(r)+`
|
|
53
|
-
`))}catch(s){if(this.cleanupPerformed)return;let r={type:"control_response",response:{subtype:"error",request_id:t.request_id,error:Ss(s)}};try{await Promise.resolve(this.transport.write(T0(r)+`
|
|
54
|
-
`))}catch(a){b0(`[Query.handleControlRequest] Error-response write failed: ${Ss(a)}`,{level:"error"})}}finally{this.cancelControllers.delete(t.request_id)}}handleControlCancelRequest(t){let e=this.cancelControllers.get(t.request_id);if(e)e.abort(),this.cancelControllers.delete(t.request_id)}async processControlRequest(t,e){if(t.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");return{...await this.canUseTool(t.request.tool_name,t.request.input,{signal:e,suggestions:t.request.permission_suggestions,blockedPath:t.request.blocked_path,decisionReason:t.request.decision_reason,title:t.request.title,displayName:t.request.display_name,description:t.request.description,toolUseID:t.request.tool_use_id,agentID:t.request.agent_id}),toolUseID:t.request.tool_use_id}}else if(t.request.subtype==="hook_callback")return await this.handleHookCallbacks(t.request.callback_id,t.request.input,t.request.tool_use_id,e);else if(t.request.subtype==="mcp_message"){let s=t.request,r=this.sdkMcpTransports.get(s.server_name);if(!r)throw Error(`SDK MCP server not found: ${s.server_name}`);if("method"in s.message&&"id"in s.message&&s.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(s.server_name,s,r)};else{if(r.onmessage)r.onmessage(s.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}else if(t.request.subtype==="elicitation"){let s=t.request;if(this.onElicitation)return await this.onElicitation({serverName:s.mcp_server_name,message:s.message,mode:s.mode,url:s.url,elicitationId:s.elicitation_id,requestedSchema:s.requested_schema,title:s.title,displayName:s.display_name,description:s.description},{signal:e});return{action:"decline"}}throw Error("Unsupported control request subtype: "+t.request.subtype)}async*readSdkMessages(){for await(let t of this.inputStream)yield t}async initialize(){let t;if(this.hooks){t={};for(let[r,a]of Object.entries(this.hooks))if(a.length>0)t[r]=a.map((n)=>{let i=[];for(let h of n.hooks){let c=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(c,h),i.push(c)}return{matcher:n.matcher,hookCallbackIds:i,timeout:n.timeout}})}let e=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,s={subtype:"initialize",hooks:t,sdkMcpServers:e,jsonSchema:this.jsonSchema,systemPrompt:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,agents:this.initConfig?.agents,promptSuggestions:this.initConfig?.promptSuggestions,agentProgressSummaries:this.initConfig?.agentProgressSummaries};return(await this.request(s)).response}async interrupt(){await this.request({subtype:"interrupt"})}async setPermissionMode(t){await this.request({subtype:"set_permission_mode",mode:t})}async setModel(t){await this.request({subtype:"set_model",model:t})}async setMaxThinkingTokens(t){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:t})}async applyFlagSettings(t){await this.request({subtype:"apply_flag_settings",settings:t})}async getSettings(){return(await this.request({subtype:"get_settings"})).response}async rewindFiles(t,e){return(await this.request({subtype:"rewind_files",user_message_id:t,dry_run:e?.dryRun})).response}async cancelAsyncMessage(t){return(await this.request({subtype:"cancel_async_message",message_uuid:t})).response.cancelled}async seedReadState(t,e){await this.request({subtype:"seed_read_state",path:t,mtime:e})}async enableRemoteControl(t){return(await this.request({subtype:"remote_control",enabled:t})).response}async setProactive(t){await this.request({subtype:"set_proactive",enabled:t})}async generateSessionTitle(t,e){return(await this.request({subtype:"generate_session_title",description:t,persist:e?.persist})).response.title}async askSideQuestion(t){return(await this.request({subtype:"side_question",question:t})).response.response}processPendingPermissionRequests(t){for(let e of t)if(e.request.subtype==="can_use_tool")this.handleControlRequest(e).catch(()=>{})}request(t){let e=Math.random().toString(36).substring(2,15),s={request_id:e,type:"control_request",request:t};return new Promise((r,a)=>{this.pendingControlResponses.set(e,{handler:(n)=>{if(this.pendingControlResponses.delete(e),n.subtype==="success")r(n);else if(a(Error(n.error)),n.pending_permission_requests)this.processPendingPermissionRequests(n.pending_permission_requests)},reject:a}),Promise.resolve(this.transport.write(T0(s)+`
|
|
55
|
-
`)).catch((n)=>{this.pendingControlResponses.delete(e),a(n)})})}initializationResult(){return this.initialization}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async supportedAgents(){return(await this.initialization).agents}async reconnectMcpServer(t){await this.request({subtype:"mcp_reconnect",serverName:t})}async toggleMcpServer(t,e){await this.request({subtype:"mcp_toggle",serverName:t,enabled:e})}async enableChannel(t){await this.request({subtype:"channel_enable",serverName:t})}async mcpAuthenticate(t){return(await this.request({subtype:"mcp_authenticate",serverName:t})).response}async mcpClearAuth(t){return(await this.request({subtype:"mcp_clear_auth",serverName:t})).response}async mcpSubmitOAuthCallbackUrl(t,e){return(await this.request({subtype:"mcp_oauth_callback_url",serverName:t,callbackUrl:e})).response}async claudeAuthenticate(t){return(await this.request({subtype:"claude_authenticate",loginWithClaudeAi:t})).response}async claudeOAuthCallback(t,e){return(await this.request({subtype:"claude_oauth_callback",authorizationCode:t,state:e})).response}async claudeOAuthWaitForCompletion(){return(await this.request({subtype:"claude_oauth_wait_for_completion"})).response}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async getContextUsage(){return(await this.request({subtype:"get_context_usage"})).response}async reloadPlugins(){return(await this.request({subtype:"reload_plugins"})).response}async setMcpServers(t){let e={},s={};for(let[i,h]of Object.entries(t))if(h.type==="sdk"&&"instance"in h)e[i]=h.instance;else s[i]=h;let r=new Set(this.sdkMcpServerInstances.keys()),a=new Set(Object.keys(e));for(let i of r)if(!a.has(i))await this.disconnectSdkMcpServer(i);for(let[i,h]of Object.entries(e))if(!r.has(i))this.connectSdkMcpServer(i,h);let n={};for(let i of Object.keys(e))n[i]={type:"sdk",name:i};return(await this.request({subtype:"mcp_set_servers",servers:{...s,...n}})).response}async accountInfo(){return(await this.initialization).account}async streamInput(t){b0("[Query.streamInput] Starting to process input stream");try{let e=0;for await(let s of t){if(e++,b0(`[Query.streamInput] Processing message ${e}: ${s.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(T0(s)+`
|
|
56
|
-
`))}if(b0(`[Query.streamInput] Finished processing ${e} messages from input stream`),e>0&&this.hasBidirectionalNeeds())b0("[Query.streamInput] Has bidirectional needs, waiting for first result"),await this.waitForFirstResult();b0("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(e){if(!(e instanceof j0))throw e}}waitForFirstResult(){if(this.firstResultReceived)return b0("[Query.waitForFirstResult] Result already received, returning immediately"),Promise.resolve();return new Promise((t)=>{if(this.abortController?.signal.aborted){t();return}this.abortController?.signal.addEventListener("abort",()=>t(),{once:!0}),this.firstResultReceivedResolve=t})}handleHookCallbacks(t,e,s,r){let a=this.hookCallbacks.get(t);if(!a)throw Error(`No hook callback found for ID: ${t}`);return a(e,s,{signal:r})}connectSdkMcpServer(t,e){let s=new gc((r)=>this.sendMcpServerMessageToCli(t,r));this.sdkMcpTransports.set(t,s),this.sdkMcpServerInstances.set(t,e),e.connect(s).catch((r)=>{if(this.sdkMcpTransports.get(t)===s)this.sdkMcpTransports.delete(t);if(this.sdkMcpServerInstances.get(t)===e)this.sdkMcpServerInstances.delete(t);b0(`[Query.connectSdkMcpServer] Failed to connect MCP server '${t}': ${r}`,{level:"error"})})}async disconnectSdkMcpServer(t){let e=this.sdkMcpTransports.get(t);if(e)await e.close(),this.sdkMcpTransports.delete(t);this.sdkMcpServerInstances.delete(t)}sendMcpServerMessageToCli(t,e){if("id"in e&&e.id!==null&&e.id!==void 0){let r=`${t}:${e.id}`,a=this.pendingMcpResponses.get(r);if(a){a.resolve(e),this.pendingMcpResponses.delete(r);return}}let s={type:"control_request",request_id:fc(),request:{subtype:"mcp_message",server_name:t,message:e}};Promise.resolve(this.transport.write(T0(s)+`
|
|
57
|
-
`)).catch((r)=>{b0(`[Query.sendMcpServerMessageToCli] Transport write failed: ${r}`,{level:"error"})})}handleMcpControlRequest(t,e,s){let r="id"in e.message?e.message.id:null,a=`${t}:${r}`;return new Promise((n,i)=>{let h=()=>{this.pendingMcpResponses.delete(a)},c=(E)=>{h(),n(E)},d=(E)=>{h(),i(E)};if(this.pendingMcpResponses.set(a,{resolve:c,reject:d}),s.onmessage)s.onmessage(e.message);else{h(),i(Error("No message handler registered"));return}})}}var ff=WE(GE);var xf=Buffer.from('{"type":"attribution-snapshot"'),Rf=Buffer.from('{"type":"system"'),zE=10,If=Buffer.from([zE]);var xt;(function(t){t.assertEqual=(a)=>{};function e(a){}t.assertIs=e;function s(a){throw Error()}t.assertNever=s,t.arrayToEnum=(a)=>{let n={};for(let i of a)n[i]=i;return n},t.getValidEnumValues=(a)=>{let n=t.objectKeys(a).filter((h)=>typeof a[a[h]]!=="number"),i={};for(let h of n)i[h]=a[h];return t.objectValues(i)},t.objectValues=(a)=>{return t.objectKeys(a).map(function(n){return a[n]})},t.objectKeys=typeof Object.keys==="function"?(a)=>Object.keys(a):(a)=>{let n=[];for(let i in a)if(Object.prototype.hasOwnProperty.call(a,i))n.push(i);return n},t.find=(a,n)=>{for(let i of a)if(n(i))return i;return},t.isInteger=typeof Number.isInteger==="function"?(a)=>Number.isInteger(a):(a)=>typeof a==="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,n=" | "){return a.map((i)=>typeof i==="string"?`'${i}'`:i).join(n)}t.joinValues=r,t.jsonStringifyReplacer=(a,n)=>{if(typeof n==="bigint")return n.toString();return n}})(xt||(xt={}));var uh;(function(t){t.mergeShapes=(e,s)=>{return{...e,...s}}})(uh||(uh={}));var Y=xt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),J0=(t)=>{switch(typeof t){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(t)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":if(Array.isArray(t))return Y.array;if(t===null)return Y.null;if(t.then&&typeof t.then==="function"&&t.catch&&typeof t.catch==="function")return Y.promise;if(typeof Map<"u"&&t instanceof Map)return Y.map;if(typeof Set<"u"&&t instanceof Set)return Y.set;if(typeof Date<"u"&&t instanceof Date)return Y.date;return Y.object;default:return Y.unknown}},w=xt.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 x0 extends Error{get errors(){return this.issues}constructor(t){super();this.issues=[],this.addIssue=(s)=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let e=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,e);else this.__proto__=e;this.name="ZodError",this.issues=t}format(t){let e=t||function(a){return a.message},s={_errors:[]},r=(a)=>{for(let n of a.issues)if(n.code==="invalid_union")n.unionErrors.map(r);else if(n.code==="invalid_return_type")r(n.returnTypeError);else if(n.code==="invalid_arguments")r(n.argumentsError);else if(n.path.length===0)s._errors.push(e(n));else{let i=s,h=0;while(h<n.path.length){let c=n.path[h];if(h!==n.path.length-1)i[c]=i[c]||{_errors:[]};else i[c]=i[c]||{_errors:[]},i[c]._errors.push(e(n));i=i[c],h++}}};return r(this),s}static assert(t){if(!(t instanceof x0))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=(e)=>e.message){let e={},s=[];for(let r of this.issues)if(r.path.length>0){let a=r.path[0];e[a]=e[a]||[],e[a].push(t(r))}else s.push(t(r));return{formErrors:s,fieldErrors:e}}get formErrors(){return this.flatten()}}x0.create=(t)=>{return new x0(t)};var QE=(t,e)=>{let s;switch(t.code){case w.invalid_type:if(t.received===Y.undefined)s="Required";else s=`Expected ${t.expected}, received ${t.received}`;break;case w.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,xt.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:s=`Unrecognized key(s) in object: ${xt.joinValues(t.keys,", ")}`;break;case w.invalid_union:s="Invalid input";break;case w.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${xt.joinValues(t.options)}`;break;case w.invalid_enum_value:s=`Invalid enum value. Expected ${xt.joinValues(t.options)}, received '${t.received}'`;break;case w.invalid_arguments:s="Invalid function arguments";break;case w.invalid_return_type:s="Invalid function return type";break;case w.invalid_date:s="Invalid date";break;case w.invalid_string:if(typeof t.validation==="object")if("includes"in t.validation){if(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position==="number")s=`${s} at one or more positions greater than or equal to ${t.validation.position}`}else if("startsWith"in t.validation)s=`Invalid input: must start with "${t.validation.startsWith}"`;else if("endsWith"in t.validation)s=`Invalid input: must end with "${t.validation.endsWith}"`;else xt.assertNever(t.validation);else if(t.validation!=="regex")s=`Invalid ${t.validation}`;else s="Invalid";break;case w.too_small:if(t.type==="array")s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`;else if(t.type==="string")s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`;else if(t.type==="number")s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`;else if(t.type==="bigint")s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`;else if(t.type==="date")s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`;else s="Invalid input";break;case w.too_big:if(t.type==="array")s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`;else if(t.type==="string")s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`;else if(t.type==="number")s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`;else if(t.type==="bigint")s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`;else if(t.type==="date")s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`;else s="Invalid input";break;case w.custom:s="Invalid input";break;case w.invalid_intersection_types:s="Intersection results could not be merged";break;case w.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case w.not_finite:s="Number must be finite";break;default:s=e.defaultError,xt.assertNever(t)}return{message:s}},ka=QE,JE=ka;function z3(){return JE}var Q3=(t)=>{let{data:e,path:s,errorMaps:r,issueData:a}=t,n=[...s,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let h="",c=r.filter((d)=>!!d).slice().reverse();for(let d of c)h=d(i,{data:e,defaultError:h}).message;return{...a,path:n,message:h}};function G(t,e){let s=z3(),r=Q3({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,s,s===ka?void 0:ka].filter((a)=>!!a)});t.common.issues.push(r)}class r0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(t,e){let s=[];for(let r of e){if(r.status==="aborted")return nt;if(r.status==="dirty")t.dirty();s.push(r.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,e){let s=[];for(let r of e){let a=await r.key,n=await r.value;s.push({key:a,value:n})}return r0.mergeObjectSync(t,s)}static mergeObjectSync(t,e){let s={};for(let r of e){let{key:a,value:n}=r;if(a.status==="aborted")return nt;if(n.status==="aborted")return nt;if(a.status==="dirty")t.dirty();if(n.status==="dirty")t.dirty();if(a.value!=="__proto__"&&(typeof n.value<"u"||r.alwaysSet))s[a.value]=n.value}return{status:t.value,value:s}}}var nt=Object.freeze({status:"aborted"}),pa=(t)=>({status:"dirty",value:t}),i0=(t)=>({status:"valid",value:t}),lh=(t)=>t.status==="aborted",Sh=(t)=>t.status==="dirty",Fe=(t)=>t.status==="valid",Cs=(t)=>typeof Promise<"u"&&t instanceof Promise,$;(function(t){t.errToObj=(e)=>typeof e==="string"?{message:e}:e||{},t.toString=(e)=>typeof e==="string"?e:e?.message})($||($={}));class g0{constructor(t,e,s,r){this._cachedPath=[],this.parent=t,this.data=e,this._path=s,this._key=r}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 Th=(t,e)=>{if(Fe(e))return{success:!0,data:e.value};else{if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let s=new x0(t.common.issues);return this._error=s,this._error}}}};function ot(t){if(!t)return{};let{errorMap:e,invalid_type_error:s,required_error:r,description:a}=t;if(e&&(s||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(e)return{errorMap:e,description:a};return{errorMap:(n,i)=>{let{message:h}=t;if(n.code==="invalid_enum_value")return{message:h??i.defaultError};if(typeof i.data>"u")return{message:h??r??i.defaultError};if(n.code!=="invalid_type")return{message:i.defaultError};return{message:h??s??i.defaultError}},description:a}}class ut{get description(){return this._def.description}_getType(t){return J0(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:J0(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new r0,ctx:{common:t.parent.common,data:t.data,parsedType:J0(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(Cs(e))throw Error("Synchronous parse encountered promise.");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let s=this.safeParse(t,e);if(s.success)return s.data;throw s.error}safeParse(t,e){let s={common:{issues:[],async:e?.async??!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:J0(t)},r=this._parseSync({data:t,path:s.path,parent:s});return Th(s,r)}"~validate"(t){let e={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:J0(t)};if(!this["~standard"].async)try{let s=this._parseSync({data:t,path:[],parent:e});return Fe(s)?{value:s.value}:{issues:e.common.issues}}catch(s){if(s?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;e.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:e}).then((s)=>Fe(s)?{value:s.value}:{issues:e.common.issues})}async parseAsync(t,e){let s=await this.safeParseAsync(t,e);if(s.success)return s.data;throw s.error}async safeParseAsync(t,e){let s={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:J0(t)},r=this._parse({data:t,path:s.path,parent:s}),a=await(Cs(r)?r:Promise.resolve(r));return Th(s,a)}refine(t,e){let s=(r)=>{if(typeof e==="string"||typeof e>"u")return{message:e};else if(typeof e==="function")return e(r);else return e};return this._refinement((r,a)=>{let n=t(r),i=()=>a.addIssue({code:w.custom,...s(r)});if(typeof Promise<"u"&&n instanceof Promise)return n.then((h)=>{if(!h)return i(),!1;else return!0});if(!n)return i(),!1;else return!0})}refinement(t,e){return this._refinement((s,r)=>{if(!t(s))return r.addIssue(typeof e==="function"?e(s,r):e),!1;else return!0})}_refinement(t){return new B0({schema:this,typeName:it.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:(e)=>this["~validate"](e)}}optional(){return D0.create(this,this._def)}nullable(){return X0.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _0.create(this)}promise(){return je.create(this,this._def)}or(t){return Ia.create([this,t],this._def)}and(t){return va.create(this,t,this._def)}transform(t){return new B0({...ot(this._def),schema:this,typeName:it.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t==="function"?t:()=>t;return new Za({...ot(this._def),innerType:this,defaultValue:e,typeName:it.ZodDefault})}brand(){return new Mr({typeName:it.ZodBranded,type:this,...ot(this._def)})}catch(t){let e=typeof t==="function"?t:()=>t;return new ga({...ot(this._def),innerType:this,catchValue:e,typeName:it.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return e3.create(this,t)}readonly(){return Fa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var YE=/^c[^\s-]{8,}$/i,XE=/^[0-9a-z]+$/,$E=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tu=/^[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,eu=/^[a-z0-9_-]{21}$/i,au=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,su=/^[-+]?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)?)??$/,ru=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",D3,iu=/^(?:(?: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])$/,hu=/^(?:(?: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])$/,cu=/^(([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]))$/,du=/^(([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])$/,ou=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Mc="((\\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])))",mu=new RegExp(`^${Mc}$`);function Pc(t){let e="[0-5]\\d";if(t.precision)e=`${e}\\.\\d{${t.precision}}`;else if(t.precision==null)e=`${e}(\\.\\d+)?`;let s=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${s}`}function pu(t){return new RegExp(`^${Pc(t)}$`)}function Eu(t){let e=`${Mc}T${Pc(t)}`,s=[];if(s.push(t.local?"Z?":"Z"),t.offset)s.push("([+-]\\d{2}:?\\d{2})");return e=`${e}(${s.join("|")})`,new RegExp(`^${e}$`)}function uu(t,e){if((e==="v4"||!e)&&iu.test(t))return!0;if((e==="v6"||!e)&&cu.test(t))return!0;return!1}function lu(t,e){if(!au.test(t))return!1;try{let[s]=t.split(".");if(!s)return!1;let r=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),a=JSON.parse(atob(r));if(typeof a!=="object"||a===null)return!1;if("typ"in a&&a?.typ!=="JWT")return!1;if(!a.alg)return!1;if(e&&a.alg!==e)return!1;return!0}catch{return!1}}function Su(t,e){if((e==="v4"||!e)&&hu.test(t))return!0;if((e==="v6"||!e)&&du.test(t))return!0;return!1}class H0 extends ut{_parse(t){if(this._def.coerce)t.data=String(t.data);if(this._getType(t)!==Y.string){let r=this._getOrReturnCtx(t);return G(r,{code:w.invalid_type,expected:Y.string,received:r.parsedType}),nt}let e=new r0,s=void 0;for(let r of this._def.checks)if(r.kind==="min"){if(t.data.length<r.value)s=this._getOrReturnCtx(t,s),G(s,{code:w.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),e.dirty()}else if(r.kind==="max"){if(t.data.length>r.value)s=this._getOrReturnCtx(t,s),G(s,{code:w.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),e.dirty()}else if(r.kind==="length"){let a=t.data.length>r.value,n=t.data.length<r.value;if(a||n){if(s=this._getOrReturnCtx(t,s),a)G(s,{code:w.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message});else if(n)G(s,{code:w.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message});e.dirty()}}else if(r.kind==="email"){if(!ru.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{validation:"email",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="emoji"){if(!D3)D3=new RegExp(nu,"u");if(!D3.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{validation:"emoji",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="uuid"){if(!tu.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{validation:"uuid",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="nanoid"){if(!eu.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{validation:"nanoid",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="cuid"){if(!YE.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="cuid2"){if(!XE.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid2",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="ulid"){if(!$E.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{validation:"ulid",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),G(s,{validation:"url",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="regex"){if(r.regex.lastIndex=0,!r.regex.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{validation:"regex",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="trim")t.data=t.data.trim();else if(r.kind==="includes"){if(!t.data.includes(r.value,r.position))s=this._getOrReturnCtx(t,s),G(s,{code:w.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),e.dirty()}else if(r.kind==="toLowerCase")t.data=t.data.toLowerCase();else if(r.kind==="toUpperCase")t.data=t.data.toUpperCase();else if(r.kind==="startsWith"){if(!t.data.startsWith(r.value))s=this._getOrReturnCtx(t,s),G(s,{code:w.invalid_string,validation:{startsWith:r.value},message:r.message}),e.dirty()}else if(r.kind==="endsWith"){if(!t.data.endsWith(r.value))s=this._getOrReturnCtx(t,s),G(s,{code:w.invalid_string,validation:{endsWith:r.value},message:r.message}),e.dirty()}else if(r.kind==="datetime"){if(!Eu(r).test(t.data))s=this._getOrReturnCtx(t,s),G(s,{code:w.invalid_string,validation:"datetime",message:r.message}),e.dirty()}else if(r.kind==="date"){if(!mu.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{code:w.invalid_string,validation:"date",message:r.message}),e.dirty()}else if(r.kind==="time"){if(!pu(r).test(t.data))s=this._getOrReturnCtx(t,s),G(s,{code:w.invalid_string,validation:"time",message:r.message}),e.dirty()}else if(r.kind==="duration"){if(!su.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{validation:"duration",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="ip"){if(!uu(t.data,r.version))s=this._getOrReturnCtx(t,s),G(s,{validation:"ip",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="jwt"){if(!lu(t.data,r.alg))s=this._getOrReturnCtx(t,s),G(s,{validation:"jwt",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="cidr"){if(!Su(t.data,r.version))s=this._getOrReturnCtx(t,s),G(s,{validation:"cidr",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="base64"){if(!ou.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{validation:"base64",code:w.invalid_string,message:r.message}),e.dirty()}else if(r.kind==="base64url"){if(!yu.test(t.data))s=this._getOrReturnCtx(t,s),G(s,{validation:"base64url",code:w.invalid_string,message:r.message}),e.dirty()}else xt.assertNever(r);return{status:e.value,value:t.data}}_regex(t,e,s){return this.refinement((r)=>t.test(r),{validation:e,code:w.invalid_string,...$.errToObj(s)})}_addCheck(t){return new H0({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...$.errToObj(t)})}url(t){return this._addCheck({kind:"url",...$.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...$.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...$.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...$.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...$.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...$.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...$.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...$.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...$.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...$.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...$.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...$.errToObj(t)})}datetime(t){if(typeof t==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t});return this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...$.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){if(typeof t==="string")return this._addCheck({kind:"time",precision:null,message:t});return this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...$.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...$.errToObj(t)})}regex(t,e){return this._addCheck({kind:"regex",regex:t,...$.errToObj(e)})}includes(t,e){return this._addCheck({kind:"includes",value:t,position:e?.position,...$.errToObj(e?.message)})}startsWith(t,e){return this._addCheck({kind:"startsWith",value:t,...$.errToObj(e)})}endsWith(t,e){return this._addCheck({kind:"endsWith",value:t,...$.errToObj(e)})}min(t,e){return this._addCheck({kind:"min",value:t,...$.errToObj(e)})}max(t,e){return this._addCheck({kind:"max",value:t,...$.errToObj(e)})}length(t,e){return this._addCheck({kind:"length",value:t,...$.errToObj(e)})}nonempty(t){return this.min(1,$.errToObj(t))}trim(){return new H0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new H0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new H0({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((t)=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find((t)=>t.kind==="date")}get isTime(){return!!this._def.checks.find((t)=>t.kind==="time")}get isDuration(){return!!this._def.checks.find((t)=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find((t)=>t.kind==="email")}get isURL(){return!!this._def.checks.find((t)=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find((t)=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find((t)=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((t)=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((t)=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((t)=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find((t)=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find((t)=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find((t)=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find((t)=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find((t)=>t.kind==="base64url")}get minLength(){let t=null;for(let e of this._def.checks)if(e.kind==="min"){if(t===null||e.value>t)t=e.value}return t}get maxLength(){let t=null;for(let e of this._def.checks)if(e.kind==="max"){if(t===null||e.value<t)t=e.value}return t}}H0.create=(t)=>{return new H0({checks:[],typeName:it.ZodString,coerce:t?.coerce??!1,...ot(t)})};function Tu(t,e){let s=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=s>r?s:r,n=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return n%i/10**a}class Me extends ut{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce)t.data=Number(t.data);if(this._getType(t)!==Y.number){let r=this._getOrReturnCtx(t);return G(r,{code:w.invalid_type,expected:Y.number,received:r.parsedType}),nt}let e=void 0,s=new r0;for(let r of this._def.checks)if(r.kind==="int"){if(!xt.isInteger(t.data))e=this._getOrReturnCtx(t,e),G(e,{code:w.invalid_type,expected:"integer",received:"float",message:r.message}),s.dirty()}else if(r.kind==="min"){if(r.inclusive?t.data<r.value:t.data<=r.value)e=this._getOrReturnCtx(t,e),G(e,{code:w.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()}else if(r.kind==="max"){if(r.inclusive?t.data>r.value:t.data>=r.value)e=this._getOrReturnCtx(t,e),G(e,{code:w.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()}else if(r.kind==="multipleOf"){if(Tu(t.data,r.value)!==0)e=this._getOrReturnCtx(t,e),G(e,{code:w.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()}else if(r.kind==="finite"){if(!Number.isFinite(t.data))e=this._getOrReturnCtx(t,e),G(e,{code:w.not_finite,message:r.message}),s.dirty()}else xt.assertNever(r);return{status:s.value,value:t.data}}gte(t,e){return this.setLimit("min",t,!0,$.toString(e))}gt(t,e){return this.setLimit("min",t,!1,$.toString(e))}lte(t,e){return this.setLimit("max",t,!0,$.toString(e))}lt(t,e){return this.setLimit("max",t,!1,$.toString(e))}setLimit(t,e,s,r){return new Me({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:s,message:$.toString(r)}]})}_addCheck(t){return new Me({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:$.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:$.toString(e)})}finite(t){return this._addCheck({kind:"finite",message:$.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:$.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:$.toString(t)})}get minValue(){let t=null;for(let e of this._def.checks)if(e.kind==="min"){if(t===null||e.value>t)t=e.value}return t}get maxValue(){let t=null;for(let e of this._def.checks)if(e.kind==="max"){if(t===null||e.value<t)t=e.value}return t}get isInt(){return!!this._def.checks.find((t)=>t.kind==="int"||t.kind==="multipleOf"&&xt.isInteger(t.value))}get isFinite(){let t=null,e=null;for(let s of this._def.checks)if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;else if(s.kind==="min"){if(e===null||s.value>e)e=s.value}else if(s.kind==="max"){if(t===null||s.value<t)t=s.value}return Number.isFinite(e)&&Number.isFinite(t)}}Me.create=(t)=>{return new Me({checks:[],typeName:it.ZodNumber,coerce:t?.coerce||!1,...ot(t)})};class Pe extends ut{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Y.bigint)return this._getInvalidInput(t);let e=void 0,s=new r0;for(let r of this._def.checks)if(r.kind==="min"){if(r.inclusive?t.data<r.value:t.data<=r.value)e=this._getOrReturnCtx(t,e),G(e,{code:w.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()}else if(r.kind==="max"){if(r.inclusive?t.data>r.value:t.data>=r.value)e=this._getOrReturnCtx(t,e),G(e,{code:w.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()}else if(r.kind==="multipleOf"){if(t.data%r.value!==BigInt(0))e=this._getOrReturnCtx(t,e),G(e,{code:w.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()}else xt.assertNever(r);return{status:s.value,value:t.data}}_getInvalidInput(t){let e=this._getOrReturnCtx(t);return G(e,{code:w.invalid_type,expected:Y.bigint,received:e.parsedType}),nt}gte(t,e){return this.setLimit("min",t,!0,$.toString(e))}gt(t,e){return this.setLimit("min",t,!1,$.toString(e))}lte(t,e){return this.setLimit("max",t,!0,$.toString(e))}lt(t,e){return this.setLimit("max",t,!1,$.toString(e))}setLimit(t,e,s,r){return new Pe({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:s,message:$.toString(r)}]})}_addCheck(t){return new Pe({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:$.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:$.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:$.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:$.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:$.toString(e)})}get minValue(){let t=null;for(let e of this._def.checks)if(e.kind==="min"){if(t===null||e.value>t)t=e.value}return t}get maxValue(){let t=null;for(let e of this._def.checks)if(e.kind==="max"){if(t===null||e.value<t)t=e.value}return t}}Pe.create=(t)=>{return new Pe({checks:[],typeName:it.ZodBigInt,coerce:t?.coerce??!1,...ot(t)})};class As extends ut{_parse(t){if(this._def.coerce)t.data=Boolean(t.data);if(this._getType(t)!==Y.boolean){let e=this._getOrReturnCtx(t);return G(e,{code:w.invalid_type,expected:Y.boolean,received:e.parsedType}),nt}return i0(t.data)}}As.create=(t)=>{return new As({typeName:it.ZodBoolean,coerce:t?.coerce||!1,...ot(t)})};class fa extends ut{_parse(t){if(this._def.coerce)t.data=new Date(t.data);if(this._getType(t)!==Y.date){let r=this._getOrReturnCtx(t);return G(r,{code:w.invalid_type,expected:Y.date,received:r.parsedType}),nt}if(Number.isNaN(t.data.getTime())){let r=this._getOrReturnCtx(t);return G(r,{code:w.invalid_date}),nt}let e=new r0,s=void 0;for(let r of this._def.checks)if(r.kind==="min"){if(t.data.getTime()<r.value)s=this._getOrReturnCtx(t,s),G(s,{code:w.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),e.dirty()}else if(r.kind==="max"){if(t.data.getTime()>r.value)s=this._getOrReturnCtx(t,s),G(s,{code:w.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),e.dirty()}else xt.assertNever(r);return{status:e.value,value:new Date(t.data.getTime())}}_addCheck(t){return new fa({...this._def,checks:[...this._def.checks,t]})}min(t,e){return this._addCheck({kind:"min",value:t.getTime(),message:$.toString(e)})}max(t,e){return this._addCheck({kind:"max",value:t.getTime(),message:$.toString(e)})}get minDate(){let t=null;for(let e of this._def.checks)if(e.kind==="min"){if(t===null||e.value>t)t=e.value}return t!=null?new Date(t):null}get maxDate(){let t=null;for(let e of this._def.checks)if(e.kind==="max"){if(t===null||e.value<t)t=e.value}return t!=null?new Date(t):null}}fa.create=(t)=>{return new fa({checks:[],coerce:t?.coerce||!1,typeName:it.ZodDate,...ot(t)})};class bs extends ut{_parse(t){if(this._getType(t)!==Y.symbol){let e=this._getOrReturnCtx(t);return G(e,{code:w.invalid_type,expected:Y.symbol,received:e.parsedType}),nt}return i0(t.data)}}bs.create=(t)=>{return new bs({typeName:it.ZodSymbol,...ot(t)})};class xa extends ut{_parse(t){if(this._getType(t)!==Y.undefined){let e=this._getOrReturnCtx(t);return G(e,{code:w.invalid_type,expected:Y.undefined,received:e.parsedType}),nt}return i0(t.data)}}xa.create=(t)=>{return new xa({typeName:it.ZodUndefined,...ot(t)})};class Ra extends ut{_parse(t){if(this._getType(t)!==Y.null){let e=this._getOrReturnCtx(t);return G(e,{code:w.invalid_type,expected:Y.null,received:e.parsedType}),nt}return i0(t.data)}}Ra.create=(t)=>{return new Ra({typeName:it.ZodNull,...ot(t)})};class Zs extends ut{constructor(){super(...arguments);this._any=!0}_parse(t){return i0(t.data)}}Zs.create=(t)=>{return new Zs({typeName:it.ZodAny,...ot(t)})};class he extends ut{constructor(){super(...arguments);this._unknown=!0}_parse(t){return i0(t.data)}}he.create=(t)=>{return new he({typeName:it.ZodUnknown,...ot(t)})};class U0 extends ut{_parse(t){let e=this._getOrReturnCtx(t);return G(e,{code:w.invalid_type,expected:Y.never,received:e.parsedType}),nt}}U0.create=(t)=>{return new U0({typeName:it.ZodNever,...ot(t)})};class gs extends ut{_parse(t){if(this._getType(t)!==Y.undefined){let e=this._getOrReturnCtx(t);return G(e,{code:w.invalid_type,expected:Y.void,received:e.parsedType}),nt}return i0(t.data)}}gs.create=(t)=>{return new gs({typeName:it.ZodVoid,...ot(t)})};class _0 extends ut{_parse(t){let{ctx:e,status:s}=this._processInputParams(t),r=this._def;if(e.parsedType!==Y.array)return G(e,{code:w.invalid_type,expected:Y.array,received:e.parsedType}),nt;if(r.exactLength!==null){let n=e.data.length>r.exactLength.value,i=e.data.length<r.exactLength.value;if(n||i)G(e,{code:n?w.too_big:w.too_small,minimum:i?r.exactLength.value:void 0,maximum:n?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty()}if(r.minLength!==null){if(e.data.length<r.minLength.value)G(e,{code:w.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()}if(r.maxLength!==null){if(e.data.length>r.maxLength.value)G(e,{code:w.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()}if(e.common.async)return Promise.all([...e.data].map((n,i)=>{return r.type._parseAsync(new g0(e,n,e.path,i))})).then((n)=>{return r0.mergeArray(s,n)});let a=[...e.data].map((n,i)=>{return r.type._parseSync(new g0(e,n,e.path,i))});return r0.mergeArray(s,a)}get element(){return this._def.type}min(t,e){return new _0({...this._def,minLength:{value:t,message:$.toString(e)}})}max(t,e){return new _0({...this._def,maxLength:{value:t,message:$.toString(e)}})}length(t,e){return new _0({...this._def,exactLength:{value:t,message:$.toString(e)}})}nonempty(t){return this.min(1,t)}}_0.create=(t,e)=>{return new _0({type:t,minLength:null,maxLength:null,exactLength:null,typeName:it.ZodArray,...ot(e)})};function ve(t){if(t instanceof _t){let e={};for(let s in t.shape){let r=t.shape[s];e[s]=D0.create(ve(r))}return new _t({...t._def,shape:()=>e})}else if(t instanceof _0)return new _0({...t._def,type:ve(t.element)});else if(t instanceof D0)return D0.create(ve(t.unwrap()));else if(t instanceof X0)return X0.create(ve(t.unwrap()));else if(t instanceof G0)return G0.create(t.items.map((e)=>ve(e)));else return t}class _t extends ut{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),e=xt.objectKeys(t);return this._cached={shape:t,keys:e},this._cached}_parse(t){if(this._getType(t)!==Y.object){let h=this._getOrReturnCtx(t);return G(h,{code:w.invalid_type,expected:Y.object,received:h.parsedType}),nt}let{status:e,ctx:s}=this._processInputParams(t),{shape:r,keys:a}=this._getCached(),n=[];if(!(this._def.catchall instanceof U0&&this._def.unknownKeys==="strip")){for(let h in s.data)if(!a.includes(h))n.push(h)}let i=[];for(let h of a){let c=r[h],d=s.data[h];i.push({key:{status:"valid",value:h},value:c._parse(new g0(s,d,s.path,h)),alwaysSet:h in s.data})}if(this._def.catchall instanceof U0){let h=this._def.unknownKeys;if(h==="passthrough")for(let c of n)i.push({key:{status:"valid",value:c},value:{status:"valid",value:s.data[c]}});else if(h==="strict"){if(n.length>0)G(s,{code:w.unrecognized_keys,keys:n}),e.dirty()}else if(h==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let h=this._def.catchall;for(let c of n){let d=s.data[c];i.push({key:{status:"valid",value:c},value:h._parse(new g0(s,d,s.path,c)),alwaysSet:c in s.data})}}if(s.common.async)return Promise.resolve().then(async()=>{let h=[];for(let c of i){let d=await c.key,E=await c.value;h.push({key:d,value:E,alwaysSet:c.alwaysSet})}return h}).then((h)=>{return r0.mergeObjectSync(e,h)});else return r0.mergeObjectSync(e,i)}get shape(){return this._def.shape()}strict(t){return $.errToObj,new _t({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(e,s)=>{let r=this._def.errorMap?.(e,s).message??s.defaultError;if(e.code==="unrecognized_keys")return{message:$.errToObj(t).message??r};return{message:r}}}:{}})}strip(){return new _t({...this._def,unknownKeys:"strip"})}passthrough(){return new _t({...this._def,unknownKeys:"passthrough"})}extend(t){return new _t({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new _t({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:it.ZodObject})}setKey(t,e){return this.augment({[t]:e})}catchall(t){return new _t({...this._def,catchall:t})}pick(t){let e={};for(let s of xt.objectKeys(t))if(t[s]&&this.shape[s])e[s]=this.shape[s];return new _t({...this._def,shape:()=>e})}omit(t){let e={};for(let s of xt.objectKeys(this.shape))if(!t[s])e[s]=this.shape[s];return new _t({...this._def,shape:()=>e})}deepPartial(){return ve(this)}partial(t){let e={};for(let s of xt.objectKeys(this.shape)){let r=this.shape[s];if(t&&!t[s])e[s]=r;else e[s]=r.optional()}return new _t({...this._def,shape:()=>e})}required(t){let e={};for(let s of xt.objectKeys(this.shape))if(t&&!t[s])e[s]=this.shape[s];else{let r=this.shape[s];while(r instanceof D0)r=r._def.innerType;e[s]=r}return new _t({...this._def,shape:()=>e})}keyof(){return Lc(xt.objectKeys(this.shape))}}_t.create=(t,e)=>{return new _t({shape:()=>t,unknownKeys:"strip",catchall:U0.create(),typeName:it.ZodObject,...ot(e)})};_t.strictCreate=(t,e)=>{return new _t({shape:()=>t,unknownKeys:"strict",catchall:U0.create(),typeName:it.ZodObject,...ot(e)})};_t.lazycreate=(t,e)=>{return new _t({shape:t,unknownKeys:"strip",catchall:U0.create(),typeName:it.ZodObject,...ot(e)})};class Ia extends ut{_parse(t){let{ctx:e}=this._processInputParams(t),s=this._def.options;function r(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return e.common.issues.push(...i.ctx.common.issues),i.result;let n=a.map((i)=>new x0(i.ctx.common.issues));return G(e,{code:w.invalid_union,unionErrors:n}),nt}if(e.common.async)return Promise.all(s.map(async(a)=>{let n={...e,common:{...e.common,issues:[]},parent:null};return{result:await a._parseAsync({data:e.data,path:e.path,parent:n}),ctx:n}})).then(r);else{let a=void 0,n=[];for(let h of s){let c={...e,common:{...e.common,issues:[]},parent:null},d=h._parseSync({data:e.data,path:e.path,parent:c});if(d.status==="valid")return d;else if(d.status==="dirty"&&!a)a={result:d,ctx:c};if(c.common.issues.length)n.push(c.common.issues)}if(a)return e.common.issues.push(...a.ctx.common.issues),a.result;let i=n.map((h)=>new x0(h));return G(e,{code:w.invalid_union,unionErrors:i}),nt}}get options(){return this._def.options}}Ia.create=(t,e)=>{return new Ia({options:t,typeName:it.ZodUnion,...ot(e)})};var w0=(t)=>{if(t instanceof Ca)return w0(t.schema);else if(t instanceof B0)return w0(t.innerType());else if(t instanceof Aa)return[t.value];else if(t instanceof ce)return t.options;else if(t instanceof ba)return xt.objectValues(t.enum);else if(t instanceof Za)return w0(t._def.innerType);else if(t instanceof xa)return[void 0];else if(t instanceof Ra)return[null];else if(t instanceof D0)return[void 0,...w0(t.unwrap())];else if(t instanceof X0)return[null,...w0(t.unwrap())];else if(t instanceof Mr)return w0(t.unwrap());else if(t instanceof Fa)return w0(t.unwrap());else if(t instanceof ga)return w0(t._def.innerType);else return[]};class Fr extends ut{_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==Y.object)return G(e,{code:w.invalid_type,expected:Y.object,received:e.parsedType}),nt;let s=this.discriminator,r=e.data[s],a=this.optionsMap.get(r);if(!a)return G(e,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),nt;if(e.common.async)return a._parseAsync({data:e.data,path:e.path,parent:e});else return a._parseSync({data:e.data,path:e.path,parent:e})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,e,s){let r=new Map;for(let a of e){let n=w0(a.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let i of n){if(r.has(i))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(i)}`);r.set(i,a)}}return new Fr({typeName:it.ZodDiscriminatedUnion,discriminator:t,options:e,optionsMap:r,...ot(s)})}}function J3(t,e){let s=J0(t),r=J0(e);if(t===e)return{valid:!0,data:t};else if(s===Y.object&&r===Y.object){let a=xt.objectKeys(e),n=xt.objectKeys(t).filter((h)=>a.indexOf(h)!==-1),i={...t,...e};for(let h of n){let c=J3(t[h],e[h]);if(!c.valid)return{valid:!1};i[h]=c.data}return{valid:!0,data:i}}else if(s===Y.array&&r===Y.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let n=0;n<t.length;n++){let i=t[n],h=e[n],c=J3(i,h);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else if(s===Y.date&&r===Y.date&&+t===+e)return{valid:!0,data:t};else return{valid:!1}}class va extends ut{_parse(t){let{status:e,ctx:s}=this._processInputParams(t),r=(a,n)=>{if(lh(a)||lh(n))return nt;let i=J3(a.value,n.value);if(!i.valid)return G(s,{code:w.invalid_intersection_types}),nt;if(Sh(a)||Sh(n))e.dirty();return{status:e.value,value:i.data}};if(s.common.async)return Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,n])=>r(a,n));else return r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}va.create=(t,e,s)=>{return new va({left:t,right:e,typeName:it.ZodIntersection,...ot(s)})};class G0 extends ut{_parse(t){let{status:e,ctx:s}=this._processInputParams(t);if(s.parsedType!==Y.array)return G(s,{code:w.invalid_type,expected:Y.array,received:s.parsedType}),nt;if(s.data.length<this._def.items.length)return G(s,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),nt;if(!this._def.rest&&s.data.length>this._def.items.length)G(s,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),e.dirty();let r=[...s.data].map((a,n)=>{let i=this._def.items[n]||this._def.rest;if(!i)return null;return i._parse(new g0(s,a,s.path,n))}).filter((a)=>!!a);if(s.common.async)return Promise.all(r).then((a)=>{return r0.mergeArray(e,a)});else return r0.mergeArray(e,r)}get items(){return this._def.items}rest(t){return new G0({...this._def,rest:t})}}G0.create=(t,e)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new G0({items:t,typeName:it.ZodTuple,rest:null,...ot(e)})};class Fs extends ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:s}=this._processInputParams(t);if(s.parsedType!==Y.object)return G(s,{code:w.invalid_type,expected:Y.object,received:s.parsedType}),nt;let r=[],a=this._def.keyType,n=this._def.valueType;for(let i in s.data)r.push({key:a._parse(new g0(s,i,s.path,i)),value:n._parse(new g0(s,s.data[i],s.path,i)),alwaysSet:i in s.data});if(s.common.async)return r0.mergeObjectAsync(e,r);else return r0.mergeObjectSync(e,r)}get element(){return this._def.valueType}static create(t,e,s){if(e instanceof ut)return new Fs({keyType:t,valueType:e,typeName:it.ZodRecord,...ot(s)});return new Fs({keyType:H0.create(),valueType:t,typeName:it.ZodRecord,...ot(e)})}}class Ms extends ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:s}=this._processInputParams(t);if(s.parsedType!==Y.map)return G(s,{code:w.invalid_type,expected:Y.map,received:s.parsedType}),nt;let r=this._def.keyType,a=this._def.valueType,n=[...s.data.entries()].map(([i,h],c)=>{return{key:r._parse(new g0(s,i,s.path,[c,"key"])),value:a._parse(new g0(s,h,s.path,[c,"value"]))}});if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let h of n){let c=await h.key,d=await h.value;if(c.status==="aborted"||d.status==="aborted")return nt;if(c.status==="dirty"||d.status==="dirty")e.dirty();i.set(c.value,d.value)}return{status:e.value,value:i}})}else{let i=new Map;for(let h of n){let{key:c,value:d}=h;if(c.status==="aborted"||d.status==="aborted")return nt;if(c.status==="dirty"||d.status==="dirty")e.dirty();i.set(c.value,d.value)}return{status:e.value,value:i}}}}Ms.create=(t,e,s)=>{return new Ms({valueType:e,keyType:t,typeName:it.ZodMap,...ot(s)})};class Le extends ut{_parse(t){let{status:e,ctx:s}=this._processInputParams(t);if(s.parsedType!==Y.set)return G(s,{code:w.invalid_type,expected:Y.set,received:s.parsedType}),nt;let r=this._def;if(r.minSize!==null){if(s.data.size<r.minSize.value)G(s,{code:w.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),e.dirty()}if(r.maxSize!==null){if(s.data.size>r.maxSize.value)G(s,{code:w.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),e.dirty()}let a=this._def.valueType;function n(h){let c=new Set;for(let d of h){if(d.status==="aborted")return nt;if(d.status==="dirty")e.dirty();c.add(d.value)}return{status:e.value,value:c}}let i=[...s.data.values()].map((h,c)=>a._parse(new g0(s,h,s.path,c)));if(s.common.async)return Promise.all(i).then((h)=>n(h));else return n(i)}min(t,e){return new Le({...this._def,minSize:{value:t,message:$.toString(e)}})}max(t,e){return new Le({...this._def,maxSize:{value:t,message:$.toString(e)}})}size(t,e){return this.min(t,e).max(t,e)}nonempty(t){return this.min(1,t)}}Le.create=(t,e)=>{return new Le({valueType:t,minSize:null,maxSize:null,typeName:it.ZodSet,...ot(e)})};class la extends ut{constructor(){super(...arguments);this.validate=this.implement}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==Y.function)return G(e,{code:w.invalid_type,expected:Y.function,received:e.parsedType}),nt;function s(i,h){return Q3({data:i,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,z3(),ka].filter((c)=>!!c),issueData:{code:w.invalid_arguments,argumentsError:h}})}function r(i,h){return Q3({data:i,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,z3(),ka].filter((c)=>!!c),issueData:{code:w.invalid_return_type,returnTypeError:h}})}let a={errorMap:e.common.contextualErrorMap},n=e.data;if(this._def.returns instanceof je){let i=this;return i0(async function(...h){let c=new x0([]),d=await i._def.args.parseAsync(h,a).catch((l)=>{throw c.addIssue(s(h,l)),c}),E=await Reflect.apply(n,this,d);return await i._def.returns._def.type.parseAsync(E,a).catch((l)=>{throw c.addIssue(r(E,l)),c})})}else{let i=this;return i0(function(...h){let c=i._def.args.safeParse(h,a);if(!c.success)throw new x0([s(h,c.error)]);let d=Reflect.apply(n,this,c.data),E=i._def.returns.safeParse(d,a);if(!E.success)throw new x0([r(d,E.error)]);return E.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new la({...this._def,args:G0.create(t).rest(he.create())})}returns(t){return new la({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,e,s){return new la({args:t?t:G0.create([]).rest(he.create()),returns:e||he.create(),typeName:it.ZodFunction,...ot(s)})}}class Ca extends ut{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}}Ca.create=(t,e)=>{return new Ca({getter:t,typeName:it.ZodLazy,...ot(e)})};class Aa extends ut{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return G(e,{received:e.data,code:w.invalid_literal,expected:this._def.value}),nt}return{status:"valid",value:t.data}}get value(){return this._def.value}}Aa.create=(t,e)=>{return new Aa({value:t,typeName:it.ZodLiteral,...ot(e)})};function Lc(t,e){return new ce({values:t,typeName:it.ZodEnum,...ot(e)})}class ce extends ut{_parse(t){if(typeof t.data!=="string"){let e=this._getOrReturnCtx(t),s=this._def.values;return G(e,{expected:xt.joinValues(s),received:e.parsedType,code:w.invalid_type}),nt}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(t.data)){let e=this._getOrReturnCtx(t),s=this._def.values;return G(e,{received:e.data,code:w.invalid_enum_value,options:s}),nt}return i0(t.data)}get options(){return this._def.values}get enum(){let t={};for(let e of this._def.values)t[e]=e;return t}get Values(){let t={};for(let e of this._def.values)t[e]=e;return t}get Enum(){let t={};for(let e of this._def.values)t[e]=e;return t}extract(t,e=this._def){return ce.create(t,{...this._def,...e})}exclude(t,e=this._def){return ce.create(this.options.filter((s)=>!t.includes(s)),{...this._def,...e})}}ce.create=Lc;class ba extends ut{_parse(t){let e=xt.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==Y.string&&s.parsedType!==Y.number){let r=xt.objectValues(e);return G(s,{expected:xt.joinValues(r),received:s.parsedType,code:w.invalid_type}),nt}if(!this._cache)this._cache=new Set(xt.getValidEnumValues(this._def.values));if(!this._cache.has(t.data)){let r=xt.objectValues(e);return G(s,{received:s.data,code:w.invalid_enum_value,options:r}),nt}return i0(t.data)}get enum(){return this._def.values}}ba.create=(t,e)=>{return new ba({values:t,typeName:it.ZodNativeEnum,...ot(e)})};class je extends ut{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==Y.promise&&e.common.async===!1)return G(e,{code:w.invalid_type,expected:Y.promise,received:e.parsedType}),nt;let s=e.parsedType===Y.promise?e.data:Promise.resolve(e.data);return i0(s.then((r)=>{return this._def.type.parseAsync(r,{path:e.path,errorMap:e.common.contextualErrorMap})}))}}je.create=(t,e)=>{return new je({type:t,typeName:it.ZodPromise,...ot(e)})};class B0 extends ut{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===it.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:e,ctx:s}=this._processInputParams(t),r=this._def.effect||null,a={addIssue:(n)=>{if(G(s,n),n.fatal)e.abort();else e.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){let n=r.transform(s.data,a);if(s.common.async)return Promise.resolve(n).then(async(i)=>{if(e.value==="aborted")return nt;let h=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});if(h.status==="aborted")return nt;if(h.status==="dirty")return pa(h.value);if(e.value==="dirty")return pa(h.value);return h});else{if(e.value==="aborted")return nt;let i=this._def.schema._parseSync({data:n,path:s.path,parent:s});if(i.status==="aborted")return nt;if(i.status==="dirty")return pa(i.value);if(e.value==="dirty")return pa(i.value);return i}}if(r.type==="refinement"){let n=(i)=>{let h=r.refinement(i,a);if(s.common.async)return Promise.resolve(h);if(h instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(i.status==="aborted")return nt;if(i.status==="dirty")e.dirty();return n(i.value),{status:e.value,value:i.value}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((i)=>{if(i.status==="aborted")return nt;if(i.status==="dirty")e.dirty();return n(i.value).then(()=>{return{status:e.value,value:i.value}})})}if(r.type==="transform")if(s.common.async===!1){let n=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Fe(n))return nt;let i=r.transform(n.value,a);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((n)=>{if(!Fe(n))return nt;return Promise.resolve(r.transform(n.value,a)).then((i)=>({status:e.value,value:i}))});xt.assertNever(r)}}B0.create=(t,e,s)=>{return new B0({schema:t,typeName:it.ZodEffects,effect:e,...ot(s)})};B0.createWithPreprocess=(t,e,s)=>{return new B0({schema:e,effect:{type:"preprocess",transform:t},typeName:it.ZodEffects,...ot(s)})};class D0 extends ut{_parse(t){if(this._getType(t)===Y.undefined)return i0(void 0);return this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}D0.create=(t,e)=>{return new D0({innerType:t,typeName:it.ZodOptional,...ot(e)})};class X0 extends ut{_parse(t){if(this._getType(t)===Y.null)return i0(null);return this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}X0.create=(t,e)=>{return new X0({innerType:t,typeName:it.ZodNullable,...ot(e)})};class Za extends ut{_parse(t){let{ctx:e}=this._processInputParams(t),s=e.data;if(e.parsedType===Y.undefined)s=this._def.defaultValue();return this._def.innerType._parse({data:s,path:e.path,parent:e})}removeDefault(){return this._def.innerType}}Za.create=(t,e)=>{return new Za({innerType:t,typeName:it.ZodDefault,defaultValue:typeof e.default==="function"?e.default:()=>e.default,...ot(e)})};class ga extends ut{_parse(t){let{ctx:e}=this._processInputParams(t),s={...e,common:{...e.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});if(Cs(r))return r.then((a)=>{return{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new x0(s.common.issues)},input:s.data})}});else return{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new x0(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}ga.create=(t,e)=>{return new ga({innerType:t,typeName:it.ZodCatch,catchValue:typeof e.catch==="function"?e.catch:()=>e.catch,...ot(e)})};class Ps extends ut{_parse(t){if(this._getType(t)!==Y.nan){let e=this._getOrReturnCtx(t);return G(e,{code:w.invalid_type,expected:Y.nan,received:e.parsedType}),nt}return{status:"valid",value:t.data}}}Ps.create=(t)=>{return new Ps({typeName:it.ZodNaN,...ot(t)})};var vf=Symbol("zod_brand");class Mr extends ut{_parse(t){let{ctx:e}=this._processInputParams(t),s=e.data;return this._def.type._parse({data:s,path:e.path,parent:e})}unwrap(){return this._def.type}}class e3 extends ut{_parse(t){let{status:e,ctx:s}=this._processInputParams(t);if(s.common.async)return(async()=>{let r=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});if(r.status==="aborted")return nt;if(r.status==="dirty")return e.dirty(),pa(r.value);else return this._def.out._parseAsync({data:r.value,path:s.path,parent:s})})();else{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});if(r.status==="aborted")return nt;if(r.status==="dirty")return e.dirty(),{status:"dirty",value:r.value};else return this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(t,e){return new e3({in:t,out:e,typeName:it.ZodPipeline})}}class Fa extends ut{_parse(t){let e=this._def.innerType._parse(t),s=(r)=>{if(Fe(r))r.value=Object.freeze(r.value);return r};return Cs(e)?e.then((r)=>s(r)):s(e)}unwrap(){return this._def.innerType}}Fa.create=(t,e)=>{return new Fa({innerType:t,typeName:it.ZodReadonly,...ot(e)})};var Cf={object:_t.lazycreate},it;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(it||(it={}));var Af=H0.create,bf=Me.create,Zf=Ps.create,gf=Pe.create,Ff=As.create,Mf=fa.create,Pf=bs.create,Lf=xa.create,jf=Ra.create,qf=Zs.create,_f=he.create,Df=U0.create,Bf=gs.create,Vf=_0.create,Nf=_t.create,wf=_t.strictCreate,Kf=Ia.create,Hf=Fr.create,Of=va.create,Uf=G0.create,Gf=Fs.create,Wf=Ms.create,zf=Le.create,Qf=la.create,Jf=Ca.create,Yf=Aa.create,Xf=ce.create,$f=ba.create,tx=je.create,ex=B0.create,ax=D0.create,sx=X0.create,rx=B0.createWithPreprocess,nx=e3.create,jc={};me(jc,{version:()=>G6,util:()=>Tt,treeifyError:()=>Wc,toJSONSchema:()=>No,toDotPath:()=>zc,safeParseAsync:()=>Hr,safeParse:()=>wr,registry:()=>nn,regexes:()=>Or,prettifyError:()=>Qc,parseAsync:()=>_s,parse:()=>qs,locales:()=>rn,isValidJWT:()=>ld,isValidBase64URL:()=>pd,isValidBase64:()=>Qr,globalRegistry:()=>ie,globalConfig:()=>Ls,function:()=>Vo,formatError:()=>Dr,flattenError:()=>_r,config:()=>n0,clone:()=>P0,_xid:()=>Tn,_void:()=>vo,_uuidv7:()=>yn,_uuidv6:()=>on,_uuidv4:()=>dn,_uuid:()=>cn,_url:()=>mn,_uppercase:()=>Mn,_unknown:()=>Vs,_union:()=>kS,_undefined:()=>fo,_ulid:()=>Sn,_uint64:()=>To,_uint32:()=>mo,_tuple:()=>Lo,_trim:()=>Dn,_transform:()=>ZS,_toUpperCase:()=>Vn,_toLowerCase:()=>Bn,_templateLiteral:()=>DS,_symbol:()=>ko,_success:()=>LS,_stringbool:()=>Do,_stringFormat:()=>Bo,_string:()=>Xd,_startsWith:()=>Ln,_size:()=>Zn,_set:()=>vS,_safeParseAsync:()=>Kr,_safeParse:()=>Nr,_regex:()=>gn,_refine:()=>_o,_record:()=>RS,_readonly:()=>_S,_property:()=>Po,_promise:()=>VS,_positive:()=>Zo,_pipe:()=>qS,_parseAsync:()=>Vr,_parse:()=>Br,_overwrite:()=>le,_optional:()=>gS,_number:()=>no,_nullable:()=>FS,_null:()=>xo,_normalize:()=>_n,_nonpositive:()=>Fo,_nonoptional:()=>PS,_nonnegative:()=>Mo,_never:()=>Io,_negative:()=>go,_nativeEnum:()=>AS,_nanoid:()=>En,_nan:()=>bo,_multipleOf:()=>La,_minSize:()=>ja,_minLength:()=>_e,_min:()=>m0,_mime:()=>qn,_maxSize:()=>c3,_maxLength:()=>d3,_max:()=>Z0,_map:()=>IS,_lte:()=>Z0,_lt:()=>oe,_lowercase:()=>Fn,_literal:()=>bS,_length:()=>o3,_lazy:()=>BS,_ksuid:()=>kn,_jwt:()=>bn,_isoTime:()=>so,_isoDuration:()=>ro,_isoDateTime:()=>eo,_isoDate:()=>ao,_ipv6:()=>xn,_ipv4:()=>fn,_intersection:()=>xS,_int64:()=>So,_int32:()=>yo,_int:()=>ho,_includes:()=>Pn,_guid:()=>Bs,_gte:()=>m0,_gt:()=>ye,_float64:()=>oo,_float32:()=>co,_file:()=>jo,_enum:()=>CS,_endsWith:()=>jn,_emoji:()=>pn,_email:()=>hn,_e164:()=>An,_discriminatedUnion:()=>fS,_default:()=>MS,_date:()=>Co,_custom:()=>qo,_cuid2:()=>ln,_cuid:()=>un,_coercedString:()=>$d,_coercedNumber:()=>io,_coercedDate:()=>Ao,_coercedBoolean:()=>Eo,_coercedBigint:()=>lo,_cidrv6:()=>In,_cidrv4:()=>Rn,_catch:()=>jS,_boolean:()=>po,_bigint:()=>uo,_base64url:()=>Cn,_base64:()=>vn,_array:()=>Nn,_any:()=>Ro,TimePrecision:()=>to,NEVER:()=>qc,JSONSchemaGenerator:()=>Ns,JSONSchema:()=>NS,Doc:()=>zr,$output:()=>Jd,$input:()=>Yd,$constructor:()=>g,$brand:()=>_c,$ZodXID:()=>ad,$ZodVoid:()=>Ad,$ZodUnknown:()=>Ds,$ZodUnion:()=>en,$ZodUndefined:()=>Rd,$ZodUUID:()=>z6,$ZodURL:()=>J6,$ZodULID:()=>ed,$ZodType:()=>dt,$ZodTuple:()=>i3,$ZodTransform:()=>an,$ZodTemplateLiteral:()=>Ud,$ZodSymbol:()=>xd,$ZodSuccess:()=>wd,$ZodStringFormat:()=>At,$ZodString:()=>Na,$ZodSet:()=>Pd,$ZodRegistry:()=>h3,$ZodRecord:()=>Fd,$ZodRealError:()=>Ba,$ZodReadonly:()=>Od,$ZodPromise:()=>Gd,$ZodPrefault:()=>Vd,$ZodPipe:()=>sn,$ZodOptional:()=>_d,$ZodObject:()=>tn,$ZodNumberFormat:()=>kd,$ZodNumber:()=>Jr,$ZodNullable:()=>Dd,$ZodNull:()=>Id,$ZodNonOptional:()=>Nd,$ZodNever:()=>Cd,$ZodNanoID:()=>X6,$ZodNaN:()=>Hd,$ZodMap:()=>Md,$ZodLiteral:()=>jd,$ZodLazy:()=>Wd,$ZodKSUID:()=>sd,$ZodJWT:()=>Sd,$ZodIntersection:()=>gd,$ZodISOTime:()=>id,$ZodISODuration:()=>hd,$ZodISODateTime:()=>rd,$ZodISODate:()=>nd,$ZodIPv6:()=>dd,$ZodIPv4:()=>cd,$ZodGUID:()=>W6,$ZodFunction:()=>wn,$ZodFile:()=>qd,$ZodError:()=>qr,$ZodEnum:()=>Ld,$ZodEmoji:()=>Y6,$ZodEmail:()=>Q6,$ZodE164:()=>ud,$ZodDiscriminatedUnion:()=>Zd,$ZodDefault:()=>Bd,$ZodDate:()=>bd,$ZodCustomStringFormat:()=>Td,$ZodCustom:()=>zd,$ZodCheckUpperCase:()=>V6,$ZodCheckStringFormat:()=>Va,$ZodCheckStartsWith:()=>w6,$ZodCheckSizeEquals:()=>L6,$ZodCheckRegex:()=>D6,$ZodCheckProperty:()=>H6,$ZodCheckOverwrite:()=>U6,$ZodCheckNumberFormat:()=>g6,$ZodCheckMultipleOf:()=>Z6,$ZodCheckMinSize:()=>P6,$ZodCheckMinLength:()=>q6,$ZodCheckMimeType:()=>O6,$ZodCheckMaxSize:()=>M6,$ZodCheckMaxLength:()=>j6,$ZodCheckLowerCase:()=>B6,$ZodCheckLessThan:()=>Gr,$ZodCheckLengthEquals:()=>_6,$ZodCheckIncludes:()=>N6,$ZodCheckGreaterThan:()=>Wr,$ZodCheckEndsWith:()=>K6,$ZodCheckBigIntFormat:()=>F6,$ZodCheck:()=>Bt,$ZodCatch:()=>Kd,$ZodCUID2:()=>td,$ZodCUID:()=>$6,$ZodCIDRv6:()=>yd,$ZodCIDRv4:()=>od,$ZodBoolean:()=>Yr,$ZodBigIntFormat:()=>fd,$ZodBigInt:()=>Xr,$ZodBase64URL:()=>Ed,$ZodBase64:()=>md,$ZodAsyncError:()=>de,$ZodArray:()=>$r,$ZodAny:()=>vd});var qc=Object.freeze({status:"aborted"});function g(t,e,s){function r(h,c){var d;Object.defineProperty(h,"_zod",{value:h._zod??{},enumerable:!1}),(d=h._zod).traits??(d.traits=new Set),h._zod.traits.add(t),e(h,c);for(let E in i.prototype)if(!(E in h))Object.defineProperty(h,E,{value:i.prototype[E].bind(h)});h._zod.constr=i,h._zod.def=c}let a=s?.Parent??Object;class n extends a{}Object.defineProperty(n,"name",{value:t});function i(h){var c;let d=s?.Parent?new n:this;r(d,h),(c=d._zod).deferred??(c.deferred=[]);for(let E of d._zod.deferred)E();return d}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:(h)=>{if(s?.Parent&&h instanceof s.Parent)return!0;return h?._zod?.traits?.has(t)}}),Object.defineProperty(i,"name",{value:t}),i}var _c=Symbol("zod_brand");class de extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var Ls={};function n0(t){if(t)Object.assign(Ls,t);return Ls}var Tt={};me(Tt,{unwrapMessage:()=>Ea,stringifyPrimitive:()=>yt,required:()=>qu,randomString:()=>Au,propertyKeyTypes:()=>js,promiseAllObject:()=>Cu,primitiveTypes:()=>Nc,prefixIssues:()=>f0,pick:()=>Fu,partial:()=>ju,optionalKeys:()=>wc,omit:()=>Mu,numKeys:()=>bu,nullish:()=>Ee,normalizeParams:()=>H,merge:()=>Lu,jsonStringifyReplacer:()=>Dc,joinValues:()=>U,issue:()=>Oc,isPlainObject:()=>Pa,isObject:()=>Ma,getSizableOrigin:()=>r3,getParsedType:()=>Zu,getLengthableOrigin:()=>n3,getEnumValues:()=>Pr,getElementAtPath:()=>vu,floatSafeRemainder:()=>Bc,finalizeIssue:()=>F0,extend:()=>Pu,escapeRegex:()=>ue,esc:()=>Ce,defineLazy:()=>It,createTransparentProxy:()=>gu,clone:()=>P0,cleanRegex:()=>s3,cleanEnum:()=>_u,captureStackTrace:()=>jr,cached:()=>a3,assignProp:()=>Lr,assertNotEqual:()=>fu,assertNever:()=>Ru,assertIs:()=>xu,assertEqual:()=>ku,assert:()=>Iu,allowsEval:()=>Vc,aborted:()=>ge,NUMBER_FORMAT_RANGES:()=>Kc,Class:()=>Uc,BIGINT_FORMAT_RANGES:()=>Hc});function ku(t){return t}function fu(t){return t}function xu(t){}function Ru(t){throw Error()}function Iu(t){}function Pr(t){let e=Object.values(t).filter((s)=>typeof s==="number");return Object.entries(t).filter(([s,r])=>e.indexOf(+s)===-1).map(([s,r])=>r)}function U(t,e="|"){return t.map((s)=>yt(s)).join(e)}function Dc(t,e){if(typeof e==="bigint")return e.toString();return e}function a3(t){return{get value(){{let e=t();return Object.defineProperty(this,"value",{value:e}),e}throw Error("cached value already set")}}}function Ee(t){return t===null||t===void 0}function s3(t){let e=t.startsWith("^")?1:0,s=t.endsWith("$")?t.length-1:t.length;return t.slice(e,s)}function Bc(t,e){let s=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=s>r?s:r,n=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return n%i/10**a}function It(t,e,s){Object.defineProperty(t,e,{get(){{let r=s();return t[e]=r,r}throw Error("cached value already set")},set(r){Object.defineProperty(t,e,{value:r})},configurable:!0})}function Lr(t,e,s){Object.defineProperty(t,e,{value:s,writable:!0,enumerable:!0,configurable:!0})}function vu(t,e){if(!e)return t;return e.reduce((s,r)=>s?.[r],t)}function Cu(t){let e=Object.keys(t),s=e.map((r)=>t[r]);return Promise.all(s).then((r)=>{let a={};for(let n=0;n<e.length;n++)a[e[n]]=r[n];return a})}function Au(t=10){let e="";for(let s=0;s<t;s++)e+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return e}function Ce(t){return JSON.stringify(t)}var jr=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function Ma(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}var Vc=a3(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(t){return!1}});function Pa(t){if(Ma(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let s=e.prototype;if(Ma(s)===!1)return!1;if(Object.prototype.hasOwnProperty.call(s,"isPrototypeOf")===!1)return!1;return!0}function bu(t){let e=0;for(let s in t)if(Object.prototype.hasOwnProperty.call(t,s))e++;return e}var Zu=(t)=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(t))return"array";if(t===null)return"null";if(t.then&&typeof t.then==="function"&&t.catch&&typeof t.catch==="function")return"promise";if(typeof Map<"u"&&t instanceof Map)return"map";if(typeof Set<"u"&&t instanceof Set)return"set";if(typeof Date<"u"&&t instanceof Date)return"date";if(typeof File<"u"&&t instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${e}`)}},js=new Set(["string","number","symbol"]),Nc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ue(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P0(t,e,s){let r=new t._zod.constr(e??t._zod.def);if(!e||s?.parent)r._zod.parent=t;return r}function H(t){let e=t;if(!e)return{};if(typeof e==="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}if(delete e.message,typeof e.error==="string")return{...e,error:()=>e.error};return e}function gu(t){let e;return new Proxy({},{get(s,r,a){return e??(e=t()),Reflect.get(e,r,a)},set(s,r,a,n){return e??(e=t()),Reflect.set(e,r,a,n)},has(s,r){return e??(e=t()),Reflect.has(e,r)},deleteProperty(s,r){return e??(e=t()),Reflect.deleteProperty(e,r)},ownKeys(s){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(s,r){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,r)},defineProperty(s,r,a){return e??(e=t()),Reflect.defineProperty(e,r,a)}})}function yt(t){if(typeof t==="bigint")return t.toString()+"n";if(typeof t==="string")return`"${t}"`;return`${t}`}function wc(t){return Object.keys(t).filter((e)=>{return t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional"})}var Kc={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Hc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Fu(t,e){let s={},r=t._zod.def;for(let a in e){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!e[a])continue;s[a]=r.shape[a]}return P0(t,{...t._zod.def,shape:s,checks:[]})}function Mu(t,e){let s={...t._zod.def.shape},r=t._zod.def;for(let a in e){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!e[a])continue;delete s[a]}return P0(t,{...t._zod.def,shape:s,checks:[]})}function Pu(t,e){if(!Pa(e))throw Error("Invalid input to extend: expected a plain object");let s={...t._zod.def,get shape(){let r={...t._zod.def.shape,...e};return Lr(this,"shape",r),r},checks:[]};return P0(t,s)}function Lu(t,e){return P0(t,{...t._zod.def,get shape(){let s={...t._zod.def.shape,...e._zod.def.shape};return Lr(this,"shape",s),s},catchall:e._zod.def.catchall,checks:[]})}function ju(t,e,s){let r=e._zod.def.shape,a={...r};if(s)for(let n in s){if(!(n in r))throw Error(`Unrecognized key: "${n}"`);if(!s[n])continue;a[n]=t?new t({type:"optional",innerType:r[n]}):r[n]}else for(let n in r)a[n]=t?new t({type:"optional",innerType:r[n]}):r[n];return P0(e,{...e._zod.def,shape:a,checks:[]})}function qu(t,e,s){let r=e._zod.def.shape,a={...r};if(s)for(let n in s){if(!(n in a))throw Error(`Unrecognized key: "${n}"`);if(!s[n])continue;a[n]=new t({type:"nonoptional",innerType:r[n]})}else for(let n in r)a[n]=new t({type:"nonoptional",innerType:r[n]});return P0(e,{...e._zod.def,shape:a,checks:[]})}function ge(t,e=0){for(let s=e;s<t.issues.length;s++)if(t.issues[s]?.continue!==!0)return!0;return!1}function f0(t,e){return e.map((s)=>{var r;return(r=s).path??(r.path=[]),s.path.unshift(t),s})}function Ea(t){return typeof t==="string"?t:t?.message}function F0(t,e,s){let r={...t,path:t.path??[]};if(!t.message){let a=Ea(t.inst?._zod.def?.error?.(t))??Ea(e?.error?.(t))??Ea(s.customError?.(t))??Ea(s.localeError?.(t))??"Invalid input";r.message=a}if(delete r.inst,delete r.continue,!e?.reportInput)delete r.input;return r}function r3(t){if(t instanceof Set)return"set";if(t instanceof Map)return"map";if(t instanceof File)return"file";return"unknown"}function n3(t){if(Array.isArray(t))return"array";if(typeof t==="string")return"string";return"unknown"}function Oc(...t){let[e,s,r]=t;if(typeof e==="string")return{message:e,code:"custom",input:s,inst:r};return{...e}}function _u(t){return Object.entries(t).filter(([e,s])=>{return Number.isNaN(Number.parseInt(e,10))}).map((e)=>e[1])}class Uc{constructor(...t){}}var Gc=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Dc,2)},enumerable:!0})},qr=g("$ZodError",Gc),Ba=g("$ZodError",Gc,{Parent:Error});function _r(t,e=(s)=>s.message){let s={},r=[];for(let a of t.issues)if(a.path.length>0)s[a.path[0]]=s[a.path[0]]||[],s[a.path[0]].push(e(a));else r.push(e(a));return{formErrors:r,fieldErrors:s}}function Dr(t,e){let s=e||function(n){return n.message},r={_errors:[]},a=(n)=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((h)=>a({issues:h}));else if(i.code==="invalid_key")a({issues:i.issues});else if(i.code==="invalid_element")a({issues:i.issues});else if(i.path.length===0)r._errors.push(s(i));else{let h=r,c=0;while(c<i.path.length){let d=i.path[c];if(c!==i.path.length-1)h[d]=h[d]||{_errors:[]};else h[d]=h[d]||{_errors:[]},h[d]._errors.push(s(i));h=h[d],c++}}};return a(t),r}function Wc(t,e){let s=e||function(n){return n.message},r={errors:[]},a=(n,i=[])=>{var h,c;for(let d of n.issues)if(d.code==="invalid_union"&&d.errors.length)d.errors.map((E)=>a({issues:E},d.path));else if(d.code==="invalid_key")a({issues:d.issues},d.path);else if(d.code==="invalid_element")a({issues:d.issues},d.path);else{let E=[...i,...d.path];if(E.length===0){r.errors.push(s(d));continue}let l=r,p=0;while(p<E.length){let f=E[p],I=p===E.length-1;if(typeof f==="string")l.properties??(l.properties={}),(h=l.properties)[f]??(h[f]={errors:[]}),l=l.properties[f];else l.items??(l.items=[]),(c=l.items)[f]??(c[f]={errors:[]}),l=l.items[f];if(I)l.errors.push(s(d));p++}}};return a(t),r}function zc(t){let e=[];for(let s of t)if(typeof s==="number")e.push(`[${s}]`);else if(typeof s==="symbol")e.push(`[${JSON.stringify(String(s))}]`);else if(/[^\w$]/.test(s))e.push(`[${JSON.stringify(s)}]`);else{if(e.length)e.push(".");e.push(s)}return e.join("")}function Qc(t){let e=[],s=[...t.issues].sort((r,a)=>r.path.length-a.path.length);for(let r of s)if(e.push(`✖ ${r.message}`),r.path?.length)e.push(` → at ${zc(r.path)}`);return e.join(`
|
|
58
|
-
`)}var Br=(t)=>(e,s,r,a)=>{let n=r?Object.assign(r,{async:!1}):{async:!1},i=e._zod.run({value:s,issues:[]},n);if(i instanceof Promise)throw new de;if(i.issues.length){let h=new(a?.Err??t)(i.issues.map((c)=>F0(c,n,n0())));throw jr(h,a?.callee),h}return i.value},qs=Br(Ba),Vr=(t)=>async(e,s,r,a)=>{let n=r?Object.assign(r,{async:!0}):{async:!0},i=e._zod.run({value:s,issues:[]},n);if(i instanceof Promise)i=await i;if(i.issues.length){let h=new(a?.Err??t)(i.issues.map((c)=>F0(c,n,n0())));throw jr(h,a?.callee),h}return i.value},_s=Vr(Ba),Nr=(t)=>(e,s,r)=>{let a=r?{...r,async:!1}:{async:!1},n=e._zod.run({value:s,issues:[]},a);if(n instanceof Promise)throw new de;return n.issues.length?{success:!1,error:new(t??qr)(n.issues.map((i)=>F0(i,a,n0())))}:{success:!0,data:n.value}},wr=Nr(Ba),Kr=(t)=>async(e,s,r)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},n=e._zod.run({value:s,issues:[]},a);if(n instanceof Promise)n=await n;return n.issues.length?{success:!1,error:new t(n.issues.map((i)=>F0(i,a,n0())))}:{success:!0,data:n.value}},Hr=Kr(Ba),Or={};me(Or,{xid:()=>$c,uuid7:()=>Nu,uuid6:()=>Vu,uuid4:()=>Bu,uuid:()=>qe,uppercase:()=>A6,unicodeEmail:()=>Hu,undefined:()=>v6,ulid:()=>Xc,time:()=>l6,string:()=>T6,rfc5322Email:()=>Ku,number:()=>x6,null:()=>I6,nanoid:()=>e6,lowercase:()=>C6,ksuid:()=>t6,ipv6:()=>h6,ipv4:()=>i6,integer:()=>f6,html5Email:()=>wu,hostname:()=>y6,guid:()=>s6,extendedDuration:()=>Du,emoji:()=>n6,email:()=>r6,e164:()=>m6,duration:()=>a6,domain:()=>Gu,datetime:()=>S6,date:()=>E6,cuid2:()=>Yc,cuid:()=>Jc,cidrv6:()=>d6,cidrv4:()=>c6,browserEmail:()=>Ou,boolean:()=>R6,bigint:()=>k6,base64url:()=>Ur,base64:()=>o6,_emoji:()=>Uu});var Jc=/^[cC][^\s-]{8,}$/,Yc=/^[0-9a-z]+$/,Xc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$c=/^[0-9a-vA-V]{20}$/,t6=/^[A-Za-z0-9]{27}$/,e6=/^[a-zA-Z0-9_-]{21}$/,a6=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Du=/^[-+]?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)?)??$/,s6=/^([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})$/,qe=(t)=>{if(!t)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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Bu=qe(4),Vu=qe(6),Nu=qe(7),r6=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wu=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ku=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Hu=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Ou=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Uu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function n6(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var i6=/^(?:(?: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])$/,h6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,c6=/^((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])$/,d6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,o6=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ur=/^[A-Za-z0-9_-]*$/,y6=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Gu=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,m6=/^\+(?:[0-9]){6,14}[0-9]$/,p6="(?:(?:\\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])))",E6=new RegExp(`^${p6}$`);function u6(t){return typeof t.precision==="number"?t.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":t.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{${t.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function l6(t){return new RegExp(`^${u6(t)}$`)}function S6(t){let e=u6({precision:t.precision}),s=["Z"];if(t.local)s.push("");if(t.offset)s.push("([+-]\\d{2}:\\d{2})");let r=`${e}(?:${s.join("|")})`;return new RegExp(`^${p6}T(?:${r})$`)}var T6=(t)=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},k6=/^\d+n?$/,f6=/^\d+$/,x6=/^-?\d+(?:\.\d+)?/i,R6=/true|false/i,I6=/null/i,v6=/undefined/i,C6=/^[^A-Z]*$/,A6=/^[^a-z]*$/,Bt=g("$ZodCheck",(t,e)=>{var s;t._zod??(t._zod={}),t._zod.def=e,(s=t._zod).onattach??(s.onattach=[])}),b6={number:"number",bigint:"bigint",object:"date"},Gr=g("$ZodCheckLessThan",(t,e)=>{Bt.init(t,e);let s=b6[typeof e.value];t._zod.onattach.push((r)=>{let a=r._zod.bag,n=(e.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(e.value<n)if(e.inclusive)a.maximum=e.value;else a.exclusiveMaximum=e.value}),t._zod.check=(r)=>{if(e.inclusive?r.value<=e.value:r.value<e.value)return;r.issues.push({origin:s,code:"too_big",maximum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Wr=g("$ZodCheckGreaterThan",(t,e)=>{Bt.init(t,e);let s=b6[typeof e.value];t._zod.onattach.push((r)=>{let a=r._zod.bag,n=(e.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(e.value>n)if(e.inclusive)a.minimum=e.value;else a.exclusiveMinimum=e.value}),t._zod.check=(r)=>{if(e.inclusive?r.value>=e.value:r.value>e.value)return;r.issues.push({origin:s,code:"too_small",minimum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Z6=g("$ZodCheckMultipleOf",(t,e)=>{Bt.init(t,e),t._zod.onattach.push((s)=>{var r;(r=s._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=(s)=>{if(typeof s.value!==typeof e.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof s.value==="bigint"?s.value%e.value===BigInt(0):Bc(s.value,e.value)===0)return;s.issues.push({origin:typeof s.value,code:"not_multiple_of",divisor:e.value,input:s.value,inst:t,continue:!e.abort})}}),g6=g("$ZodCheckNumberFormat",(t,e)=>{Bt.init(t,e),e.format=e.format||"float64";let s=e.format?.includes("int"),r=s?"int":"number",[a,n]=Kc[e.format];t._zod.onattach.push((i)=>{let h=i._zod.bag;if(h.format=e.format,h.minimum=a,h.maximum=n,s)h.pattern=f6}),t._zod.check=(i)=>{let h=i.value;if(s){if(!Number.isInteger(h)){i.issues.push({expected:r,format:e.format,code:"invalid_type",input:h,inst:t});return}if(!Number.isSafeInteger(h)){if(h>0)i.issues.push({input:h,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort});else i.issues.push({input:h,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort});return}}if(h<a)i.issues.push({origin:"number",input:h,code:"too_small",minimum:a,inclusive:!0,inst:t,continue:!e.abort});if(h>n)i.issues.push({origin:"number",input:h,code:"too_big",maximum:n,inst:t})}}),F6=g("$ZodCheckBigIntFormat",(t,e)=>{Bt.init(t,e);let[s,r]=Hc[e.format];t._zod.onattach.push((a)=>{let n=a._zod.bag;n.format=e.format,n.minimum=s,n.maximum=r}),t._zod.check=(a)=>{let n=a.value;if(n<s)a.issues.push({origin:"bigint",input:n,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort});if(n>r)a.issues.push({origin:"bigint",input:n,code:"too_big",maximum:r,inst:t})}}),M6=g("$ZodCheckMaxSize",(t,e)=>{Bt.init(t,e),t._zod.when=(s)=>{let r=s.value;return!Ee(r)&&r.size!==void 0},t._zod.onattach.push((s)=>{let r=s._zod.bag.maximum??Number.POSITIVE_INFINITY;if(e.maximum<r)s._zod.bag.maximum=e.maximum}),t._zod.check=(s)=>{let r=s.value;if(r.size<=e.maximum)return;s.issues.push({origin:r3(r),code:"too_big",maximum:e.maximum,input:r,inst:t,continue:!e.abort})}}),P6=g("$ZodCheckMinSize",(t,e)=>{Bt.init(t,e),t._zod.when=(s)=>{let r=s.value;return!Ee(r)&&r.size!==void 0},t._zod.onattach.push((s)=>{let r=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(e.minimum>r)s._zod.bag.minimum=e.minimum}),t._zod.check=(s)=>{let r=s.value;if(r.size>=e.minimum)return;s.issues.push({origin:r3(r),code:"too_small",minimum:e.minimum,input:r,inst:t,continue:!e.abort})}}),L6=g("$ZodCheckSizeEquals",(t,e)=>{Bt.init(t,e),t._zod.when=(s)=>{let r=s.value;return!Ee(r)&&r.size!==void 0},t._zod.onattach.push((s)=>{let r=s._zod.bag;r.minimum=e.size,r.maximum=e.size,r.size=e.size}),t._zod.check=(s)=>{let r=s.value,a=r.size;if(a===e.size)return;let n=a>e.size;s.issues.push({origin:r3(r),...n?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:s.value,inst:t,continue:!e.abort})}}),j6=g("$ZodCheckMaxLength",(t,e)=>{Bt.init(t,e),t._zod.when=(s)=>{let r=s.value;return!Ee(r)&&r.length!==void 0},t._zod.onattach.push((s)=>{let r=s._zod.bag.maximum??Number.POSITIVE_INFINITY;if(e.maximum<r)s._zod.bag.maximum=e.maximum}),t._zod.check=(s)=>{let r=s.value;if(r.length<=e.maximum)return;let a=n3(r);s.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:r,inst:t,continue:!e.abort})}}),q6=g("$ZodCheckMinLength",(t,e)=>{Bt.init(t,e),t._zod.when=(s)=>{let r=s.value;return!Ee(r)&&r.length!==void 0},t._zod.onattach.push((s)=>{let r=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(e.minimum>r)s._zod.bag.minimum=e.minimum}),t._zod.check=(s)=>{let r=s.value;if(r.length>=e.minimum)return;let a=n3(r);s.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:r,inst:t,continue:!e.abort})}}),_6=g("$ZodCheckLengthEquals",(t,e)=>{Bt.init(t,e),t._zod.when=(s)=>{let r=s.value;return!Ee(r)&&r.length!==void 0},t._zod.onattach.push((s)=>{let r=s._zod.bag;r.minimum=e.length,r.maximum=e.length,r.length=e.length}),t._zod.check=(s)=>{let r=s.value,a=r.length;if(a===e.length)return;let n=n3(r),i=a>e.length;s.issues.push({origin:n,...i?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:s.value,inst:t,continue:!e.abort})}}),Va=g("$ZodCheckStringFormat",(t,e)=>{var s,r;if(Bt.init(t,e),t._zod.onattach.push((a)=>{let n=a._zod.bag;if(n.format=e.format,e.pattern)n.patterns??(n.patterns=new Set),n.patterns.add(e.pattern)}),e.pattern)(s=t._zod).check??(s.check=(a)=>{if(e.pattern.lastIndex=0,e.pattern.test(a.value))return;a.issues.push({origin:"string",code:"invalid_format",format:e.format,input:a.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})});else(r=t._zod).check??(r.check=()=>{})}),D6=g("$ZodCheckRegex",(t,e)=>{Va.init(t,e),t._zod.check=(s)=>{if(e.pattern.lastIndex=0,e.pattern.test(s.value))return;s.issues.push({origin:"string",code:"invalid_format",format:"regex",input:s.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),B6=g("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=C6),Va.init(t,e)}),V6=g("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=A6),Va.init(t,e)}),N6=g("$ZodCheckIncludes",(t,e)=>{Bt.init(t,e);let s=ue(e.includes),r=new RegExp(typeof e.position==="number"?`^.{${e.position}}${s}`:s);e.pattern=r,t._zod.onattach.push((a)=>{let n=a._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=(a)=>{if(a.value.includes(e.includes,e.position))return;a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:a.value,inst:t,continue:!e.abort})}}),w6=g("$ZodCheckStartsWith",(t,e)=>{Bt.init(t,e);let s=new RegExp(`^${ue(e.prefix)}.*`);e.pattern??(e.pattern=s),t._zod.onattach.push((r)=>{let a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(s)}),t._zod.check=(r)=>{if(r.value.startsWith(e.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),K6=g("$ZodCheckEndsWith",(t,e)=>{Bt.init(t,e);let s=new RegExp(`.*${ue(e.suffix)}$`);e.pattern??(e.pattern=s),t._zod.onattach.push((r)=>{let a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(s)}),t._zod.check=(r)=>{if(r.value.endsWith(e.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}});function kh(t,e,s){if(t.issues.length)e.issues.push(...f0(s,t.issues))}var H6=g("$ZodCheckProperty",(t,e)=>{Bt.init(t,e),t._zod.check=(s)=>{let r=e.schema._zod.run({value:s.value[e.property],issues:[]},{});if(r instanceof Promise)return r.then((a)=>kh(a,s,e.property));kh(r,s,e.property);return}}),O6=g("$ZodCheckMimeType",(t,e)=>{Bt.init(t,e);let s=new Set(e.mime);t._zod.onattach.push((r)=>{r._zod.bag.mime=e.mime}),t._zod.check=(r)=>{if(s.has(r.value.type))return;r.issues.push({code:"invalid_value",values:e.mime,input:r.value.type,inst:t})}}),U6=g("$ZodCheckOverwrite",(t,e)=>{Bt.init(t,e),t._zod.check=(s)=>{s.value=e.tx(s.value)}});class zr{constructor(t=[]){if(this.content=[],this.indent=0,this)this.args=t}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t==="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let e=t.split(`
|
|
59
|
-
`).filter((a)=>a),s=Math.min(...e.map((a)=>a.length-a.trimStart().length)),r=e.map((a)=>a.slice(s)).map((a)=>" ".repeat(this.indent*2)+a);for(let a of r)this.content.push(a)}compile(){let t=Function,e=this?.args,s=[...(this?.content??[""]).map((r)=>` ${r}`)];return new t(...e,s.join(`
|
|
60
|
-
`))}}var G6={major:4,minor:0,patch:0},dt=g("$ZodType",(t,e)=>{var s;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=G6;let r=[...t._zod.def.checks??[]];if(t._zod.traits.has("$ZodCheck"))r.unshift(t);for(let a of r)for(let n of a._zod.onattach)n(t);if(r.length===0)(s=t._zod).deferred??(s.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let a=(n,i,h)=>{let c=ge(n),d;for(let E of i){if(E._zod.when){if(!E._zod.when(n))continue}else if(c)continue;let l=n.issues.length,p=E._zod.check(n);if(p instanceof Promise&&h?.async===!1)throw new de;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await p,n.issues.length===l)return;if(!c)c=ge(n,l)});else{if(n.issues.length===l)continue;if(!c)c=ge(n,l)}}if(d)return d.then(()=>{return n});return n};t._zod.run=(n,i)=>{let h=t._zod.parse(n,i);if(h instanceof Promise){if(i.async===!1)throw new de;return h.then((c)=>a(c,r,i))}return a(h,r,i)}}t["~standard"]={validate:(a)=>{try{let n=wr(t,a);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Hr(t,a).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Na=g("$ZodString",(t,e)=>{dt.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??T6(t._zod.bag),t._zod.parse=(s,r)=>{if(e.coerce)try{s.value=String(s.value)}catch(a){}if(typeof s.value==="string")return s;return s.issues.push({expected:"string",code:"invalid_type",input:s.value,inst:t}),s}}),At=g("$ZodStringFormat",(t,e)=>{Va.init(t,e),Na.init(t,e)}),W6=g("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=s6),At.init(t,e)}),z6=g("$ZodUUID",(t,e)=>{if(e.version){let s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(s===void 0)throw Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=qe(s))}else e.pattern??(e.pattern=qe());At.init(t,e)}),Q6=g("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=r6),At.init(t,e)}),J6=g("$ZodURL",(t,e)=>{At.init(t,e),t._zod.check=(s)=>{try{let r=s.value,a=new URL(r),n=a.href;if(e.hostname){if(e.hostname.lastIndex=0,!e.hostname.test(a.hostname))s.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:y6.source,input:s.value,inst:t,continue:!e.abort})}if(e.protocol){if(e.protocol.lastIndex=0,!e.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol))s.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:s.value,inst:t,continue:!e.abort})}if(!r.endsWith("/")&&n.endsWith("/"))s.value=n.slice(0,-1);else s.value=n;return}catch(r){s.issues.push({code:"invalid_format",format:"url",input:s.value,inst:t,continue:!e.abort})}}}),Y6=g("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=n6()),At.init(t,e)}),X6=g("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=e6),At.init(t,e)}),$6=g("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Jc),At.init(t,e)}),td=g("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Yc),At.init(t,e)}),ed=g("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Xc),At.init(t,e)}),ad=g("$ZodXID",(t,e)=>{e.pattern??(e.pattern=$c),At.init(t,e)}),sd=g("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=t6),At.init(t,e)}),rd=g("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=S6(e)),At.init(t,e)}),nd=g("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=E6),At.init(t,e)}),id=g("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=l6(e)),At.init(t,e)}),hd=g("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=a6),At.init(t,e)}),cd=g("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=i6),At.init(t,e),t._zod.onattach.push((s)=>{let r=s._zod.bag;r.format="ipv4"})}),dd=g("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=h6),At.init(t,e),t._zod.onattach.push((s)=>{let r=s._zod.bag;r.format="ipv6"}),t._zod.check=(s)=>{try{new URL(`http://[${s.value}]`)}catch{s.issues.push({code:"invalid_format",format:"ipv6",input:s.value,inst:t,continue:!e.abort})}}}),od=g("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=c6),At.init(t,e)}),yd=g("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=d6),At.init(t,e),t._zod.check=(s)=>{let[r,a]=s.value.split("/");try{if(!a)throw Error();let n=Number(a);if(`${n}`!==a)throw Error();if(n<0||n>128)throw Error();new URL(`http://[${r}]`)}catch{s.issues.push({code:"invalid_format",format:"cidrv6",input:s.value,inst:t,continue:!e.abort})}}});function Qr(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var md=g("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=o6),At.init(t,e),t._zod.onattach.push((s)=>{s._zod.bag.contentEncoding="base64"}),t._zod.check=(s)=>{if(Qr(s.value))return;s.issues.push({code:"invalid_format",format:"base64",input:s.value,inst:t,continue:!e.abort})}});function pd(t){if(!Ur.test(t))return!1;let e=t.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),s=e.padEnd(Math.ceil(e.length/4)*4,"=");return Qr(s)}var Ed=g("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ur),At.init(t,e),t._zod.onattach.push((s)=>{s._zod.bag.contentEncoding="base64url"}),t._zod.check=(s)=>{if(pd(s.value))return;s.issues.push({code:"invalid_format",format:"base64url",input:s.value,inst:t,continue:!e.abort})}}),ud=g("$ZodE164",(t,e)=>{e.pattern??(e.pattern=m6),At.init(t,e)});function ld(t,e=null){try{let s=t.split(".");if(s.length!==3)return!1;let[r]=s;if(!r)return!1;let a=JSON.parse(atob(r));if("typ"in a&&a?.typ!=="JWT")return!1;if(!a.alg)return!1;if(e&&(!("alg"in a)||a.alg!==e))return!1;return!0}catch{return!1}}var Sd=g("$ZodJWT",(t,e)=>{At.init(t,e),t._zod.check=(s)=>{if(ld(s.value,e.alg))return;s.issues.push({code:"invalid_format",format:"jwt",input:s.value,inst:t,continue:!e.abort})}}),Td=g("$ZodCustomStringFormat",(t,e)=>{At.init(t,e),t._zod.check=(s)=>{if(e.fn(s.value))return;s.issues.push({code:"invalid_format",format:e.format,input:s.value,inst:t,continue:!e.abort})}}),Jr=g("$ZodNumber",(t,e)=>{dt.init(t,e),t._zod.pattern=t._zod.bag.pattern??x6,t._zod.parse=(s,r)=>{if(e.coerce)try{s.value=Number(s.value)}catch(i){}let a=s.value;if(typeof a==="number"&&!Number.isNaN(a)&&Number.isFinite(a))return s;let n=typeof a==="number"?Number.isNaN(a)?"NaN":!Number.isFinite(a)?"Infinity":void 0:void 0;return s.issues.push({expected:"number",code:"invalid_type",input:a,inst:t,...n?{received:n}:{}}),s}}),kd=g("$ZodNumber",(t,e)=>{g6.init(t,e),Jr.init(t,e)}),Yr=g("$ZodBoolean",(t,e)=>{dt.init(t,e),t._zod.pattern=R6,t._zod.parse=(s,r)=>{if(e.coerce)try{s.value=Boolean(s.value)}catch(n){}let a=s.value;if(typeof a==="boolean")return s;return s.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:t}),s}}),Xr=g("$ZodBigInt",(t,e)=>{dt.init(t,e),t._zod.pattern=k6,t._zod.parse=(s,r)=>{if(e.coerce)try{s.value=BigInt(s.value)}catch(a){}if(typeof s.value==="bigint")return s;return s.issues.push({expected:"bigint",code:"invalid_type",input:s.value,inst:t}),s}}),fd=g("$ZodBigInt",(t,e)=>{F6.init(t,e),Xr.init(t,e)}),xd=g("$ZodSymbol",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{let a=s.value;if(typeof a==="symbol")return s;return s.issues.push({expected:"symbol",code:"invalid_type",input:a,inst:t}),s}}),Rd=g("$ZodUndefined",(t,e)=>{dt.init(t,e),t._zod.pattern=v6,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(s,r)=>{let a=s.value;if(typeof a>"u")return s;return s.issues.push({expected:"undefined",code:"invalid_type",input:a,inst:t}),s}}),Id=g("$ZodNull",(t,e)=>{dt.init(t,e),t._zod.pattern=I6,t._zod.values=new Set([null]),t._zod.parse=(s,r)=>{let a=s.value;if(a===null)return s;return s.issues.push({expected:"null",code:"invalid_type",input:a,inst:t}),s}}),vd=g("$ZodAny",(t,e)=>{dt.init(t,e),t._zod.parse=(s)=>s}),Ds=g("$ZodUnknown",(t,e)=>{dt.init(t,e),t._zod.parse=(s)=>s}),Cd=g("$ZodNever",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{return s.issues.push({expected:"never",code:"invalid_type",input:s.value,inst:t}),s}}),Ad=g("$ZodVoid",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{let a=s.value;if(typeof a>"u")return s;return s.issues.push({expected:"void",code:"invalid_type",input:a,inst:t}),s}}),bd=g("$ZodDate",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{if(e.coerce)try{s.value=new Date(s.value)}catch(i){}let a=s.value,n=a instanceof Date;if(n&&!Number.isNaN(a.getTime()))return s;return s.issues.push({expected:"date",code:"invalid_type",input:a,...n?{received:"Invalid Date"}:{},inst:t}),s}});function fh(t,e,s){if(t.issues.length)e.issues.push(...f0(s,t.issues));e.value[s]=t.value}var $r=g("$ZodArray",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{let a=s.value;if(!Array.isArray(a))return s.issues.push({expected:"array",code:"invalid_type",input:a,inst:t}),s;s.value=Array(a.length);let n=[];for(let i=0;i<a.length;i++){let h=a[i],c=e.element._zod.run({value:h,issues:[]},r);if(c instanceof Promise)n.push(c.then((d)=>fh(d,s,i)));else fh(c,s,i)}if(n.length)return Promise.all(n).then(()=>s);return s}});function ms(t,e,s){if(t.issues.length)e.issues.push(...f0(s,t.issues));e.value[s]=t.value}function xh(t,e,s,r){if(t.issues.length)if(r[s]===void 0)if(s in r)e.value[s]=void 0;else e.value[s]=t.value;else e.issues.push(...f0(s,t.issues));else if(t.value===void 0){if(s in r)e.value[s]=void 0}else e.value[s]=t.value}var tn=g("$ZodObject",(t,e)=>{dt.init(t,e);let s=a3(()=>{let E=Object.keys(e.shape);for(let p of E)if(!(e.shape[p]instanceof dt))throw Error(`Invalid element at key "${p}": expected a Zod schema`);let l=wc(e.shape);return{shape:e.shape,keys:E,keySet:new Set(E),numKeys:E.length,optionalKeys:new Set(l)}});It(t._zod,"propValues",()=>{let E=e.shape,l={};for(let p in E){let f=E[p]._zod;if(f.values){l[p]??(l[p]=new Set);for(let I of f.values)l[p].add(I)}}return l});let r=(E)=>{let l=new zr(["shape","payload","ctx"]),p=s.value,f=(o)=>{let u=Ce(o);return`shape[${u}]._zod.run({ value: input[${u}], issues: [] }, ctx)`};l.write("const input = payload.value;");let I=Object.create(null),v=0;for(let o of p.keys)I[o]=`key_${v++}`;l.write("const newResult = {}");for(let o of p.keys)if(p.optionalKeys.has(o)){let u=I[o];l.write(`const ${u} = ${f(o)};`);let y=Ce(o);l.write(`
|
|
61
|
-
if (${u}.issues.length) {
|
|
62
|
-
if (input[${y}] === undefined) {
|
|
63
|
-
if (${y} in input) {
|
|
64
|
-
newResult[${y}] = undefined;
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
payload.issues = payload.issues.concat(
|
|
68
|
-
${u}.issues.map((iss) => ({
|
|
69
|
-
...iss,
|
|
70
|
-
path: iss.path ? [${y}, ...iss.path] : [${y}],
|
|
71
|
-
}))
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
} else if (${u}.value === undefined) {
|
|
75
|
-
if (${y} in input) newResult[${y}] = undefined;
|
|
76
|
-
} else {
|
|
77
|
-
newResult[${y}] = ${u}.value;
|
|
78
|
-
}
|
|
79
|
-
`)}else{let u=I[o];l.write(`const ${u} = ${f(o)};`),l.write(`
|
|
80
|
-
if (${u}.issues.length) payload.issues = payload.issues.concat(${u}.issues.map(iss => ({
|
|
81
|
-
...iss,
|
|
82
|
-
path: iss.path ? [${Ce(o)}, ...iss.path] : [${Ce(o)}]
|
|
83
|
-
})));`),l.write(`newResult[${Ce(o)}] = ${u}.value`)}l.write("payload.value = newResult;"),l.write("return payload;");let x=l.compile();return(o,u)=>x(E,o,u)},a,n=Ma,i=!Ls.jitless,h=i&&Vc.value,c=e.catchall,d;t._zod.parse=(E,l)=>{d??(d=s.value);let p=E.value;if(!n(p))return E.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),E;let f=[];if(i&&h&&l?.async===!1&&l.jitless!==!0){if(!a)a=r(e.shape);E=a(E,l)}else{E.value={};let u=d.shape;for(let y of d.keys){let m=u[y],k=m._zod.run({value:p[y],issues:[]},l),T=m._zod.optin==="optional"&&m._zod.optout==="optional";if(k instanceof Promise)f.push(k.then((R)=>T?xh(R,E,y,p):ms(R,E,y)));else if(T)xh(k,E,y,p);else ms(k,E,y)}}if(!c)return f.length?Promise.all(f).then(()=>E):E;let I=[],v=d.keySet,x=c._zod,o=x.def.type;for(let u of Object.keys(p)){if(v.has(u))continue;if(o==="never"){I.push(u);continue}let y=x.run({value:p[u],issues:[]},l);if(y instanceof Promise)f.push(y.then((m)=>ms(m,E,u)));else ms(y,E,u)}if(I.length)E.issues.push({code:"unrecognized_keys",keys:I,input:p,inst:t});if(!f.length)return E;return Promise.all(f).then(()=>{return E})}});function Rh(t,e,s,r){for(let a of t)if(a.issues.length===0)return e.value=a.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:s,errors:t.map((a)=>a.issues.map((n)=>F0(n,r,n0())))}),e}var en=g("$ZodUnion",(t,e)=>{dt.init(t,e),It(t._zod,"optin",()=>e.options.some((s)=>s._zod.optin==="optional")?"optional":void 0),It(t._zod,"optout",()=>e.options.some((s)=>s._zod.optout==="optional")?"optional":void 0),It(t._zod,"values",()=>{if(e.options.every((s)=>s._zod.values))return new Set(e.options.flatMap((s)=>Array.from(s._zod.values)));return}),It(t._zod,"pattern",()=>{if(e.options.every((s)=>s._zod.pattern)){let s=e.options.map((r)=>r._zod.pattern);return new RegExp(`^(${s.map((r)=>s3(r.source)).join("|")})$`)}return}),t._zod.parse=(s,r)=>{let a=!1,n=[];for(let i of e.options){let h=i._zod.run({value:s.value,issues:[]},r);if(h instanceof Promise)n.push(h),a=!0;else{if(h.issues.length===0)return h;n.push(h)}}if(!a)return Rh(n,s,t,r);return Promise.all(n).then((i)=>{return Rh(i,s,t,r)})}}),Zd=g("$ZodDiscriminatedUnion",(t,e)=>{en.init(t,e);let s=t._zod.parse;It(t._zod,"propValues",()=>{let a={};for(let n of e.options){let i=n._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let[h,c]of Object.entries(i)){if(!a[h])a[h]=new Set;for(let d of c)a[h].add(d)}}return a});let r=a3(()=>{let a=e.options,n=new Map;for(let i of a){let h=i._zod.propValues[e.discriminator];if(!h||h.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of h){if(n.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);n.set(c,i)}}return n});t._zod.parse=(a,n)=>{let i=a.value;if(!Ma(i))return a.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),a;let h=r.value.get(i?.[e.discriminator]);if(h)return h._zod.run(a,n);if(e.unionFallback)return s(a,n);return a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),a}}),gd=g("$ZodIntersection",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{let a=s.value,n=e.left._zod.run({value:a,issues:[]},r),i=e.right._zod.run({value:a,issues:[]},r);if(n instanceof Promise||i instanceof Promise)return Promise.all([n,i]).then(([h,c])=>{return Ih(s,h,c)});return Ih(s,n,i)}});function Y3(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t===+e)return{valid:!0,data:t};if(Pa(t)&&Pa(e)){let s=Object.keys(e),r=Object.keys(t).filter((n)=>s.indexOf(n)!==-1),a={...t,...e};for(let n of r){let i=Y3(t[n],e[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};a[n]=i.data}return{valid:!0,data:a}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let s=[];for(let r=0;r<t.length;r++){let a=t[r],n=e[r],i=Y3(a,n);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};s.push(i.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}function Ih(t,e,s){if(e.issues.length)t.issues.push(...e.issues);if(s.issues.length)t.issues.push(...s.issues);if(ge(t))return t;let r=Y3(e.value,s.value);if(!r.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return t.value=r.data,t}var i3=g("$ZodTuple",(t,e)=>{dt.init(t,e);let s=e.items,r=s.length-[...s].reverse().findIndex((a)=>a._zod.optin!=="optional");t._zod.parse=(a,n)=>{let i=a.value;if(!Array.isArray(i))return a.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),a;a.value=[];let h=[];if(!e.rest){let d=i.length>s.length,E=i.length<r-1;if(d||E)return a.issues.push({input:i,inst:t,origin:"array",...d?{code:"too_big",maximum:s.length}:{code:"too_small",minimum:s.length}}),a}let c=-1;for(let d of s){if(c++,c>=i.length){if(c>=r)continue}let E=d._zod.run({value:i[c],issues:[]},n);if(E instanceof Promise)h.push(E.then((l)=>ps(l,a,c)));else ps(E,a,c)}if(e.rest){let d=i.slice(s.length);for(let E of d){c++;let l=e.rest._zod.run({value:E,issues:[]},n);if(l instanceof Promise)h.push(l.then((p)=>ps(p,a,c)));else ps(l,a,c)}}if(h.length)return Promise.all(h).then(()=>a);return a}});function ps(t,e,s){if(t.issues.length)e.issues.push(...f0(s,t.issues));e.value[s]=t.value}var Fd=g("$ZodRecord",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{let a=s.value;if(!Pa(a))return s.issues.push({expected:"record",code:"invalid_type",input:a,inst:t}),s;let n=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;s.value={};for(let c of i)if(typeof c==="string"||typeof c==="number"||typeof c==="symbol"){let d=e.valueType._zod.run({value:a[c],issues:[]},r);if(d instanceof Promise)n.push(d.then((E)=>{if(E.issues.length)s.issues.push(...f0(c,E.issues));s.value[c]=E.value}));else{if(d.issues.length)s.issues.push(...f0(c,d.issues));s.value[c]=d.value}}let h;for(let c in a)if(!i.has(c))h=h??[],h.push(c);if(h&&h.length>0)s.issues.push({code:"unrecognized_keys",input:a,inst:t,keys:h})}else{s.value={};for(let i of Reflect.ownKeys(a)){if(i==="__proto__")continue;let h=e.keyType._zod.run({value:i,issues:[]},r);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length){s.issues.push({origin:"record",code:"invalid_key",issues:h.issues.map((d)=>F0(d,r,n0())),input:i,path:[i],inst:t}),s.value[h.value]=h.value;continue}let c=e.valueType._zod.run({value:a[i],issues:[]},r);if(c instanceof Promise)n.push(c.then((d)=>{if(d.issues.length)s.issues.push(...f0(i,d.issues));s.value[h.value]=d.value}));else{if(c.issues.length)s.issues.push(...f0(i,c.issues));s.value[h.value]=c.value}}}if(n.length)return Promise.all(n).then(()=>s);return s}}),Md=g("$ZodMap",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{let a=s.value;if(!(a instanceof Map))return s.issues.push({expected:"map",code:"invalid_type",input:a,inst:t}),s;let n=[];s.value=new Map;for(let[i,h]of a){let c=e.keyType._zod.run({value:i,issues:[]},r),d=e.valueType._zod.run({value:h,issues:[]},r);if(c instanceof Promise||d instanceof Promise)n.push(Promise.all([c,d]).then(([E,l])=>{vh(E,l,s,i,a,t,r)}));else vh(c,d,s,i,a,t,r)}if(n.length)return Promise.all(n).then(()=>s);return s}});function vh(t,e,s,r,a,n,i){if(t.issues.length)if(js.has(typeof r))s.issues.push(...f0(r,t.issues));else s.issues.push({origin:"map",code:"invalid_key",input:a,inst:n,issues:t.issues.map((h)=>F0(h,i,n0()))});if(e.issues.length)if(js.has(typeof r))s.issues.push(...f0(r,e.issues));else s.issues.push({origin:"map",code:"invalid_element",input:a,inst:n,key:r,issues:e.issues.map((h)=>F0(h,i,n0()))});s.value.set(t.value,e.value)}var Pd=g("$ZodSet",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{let a=s.value;if(!(a instanceof Set))return s.issues.push({input:a,inst:t,expected:"set",code:"invalid_type"}),s;let n=[];s.value=new Set;for(let i of a){let h=e.valueType._zod.run({value:i,issues:[]},r);if(h instanceof Promise)n.push(h.then((c)=>Ch(c,s)));else Ch(h,s)}if(n.length)return Promise.all(n).then(()=>s);return s}});function Ch(t,e){if(t.issues.length)e.issues.push(...t.issues);e.value.add(t.value)}var Ld=g("$ZodEnum",(t,e)=>{dt.init(t,e);let s=Pr(e.entries);t._zod.values=new Set(s),t._zod.pattern=new RegExp(`^(${s.filter((r)=>js.has(typeof r)).map((r)=>typeof r==="string"?ue(r):r.toString()).join("|")})$`),t._zod.parse=(r,a)=>{let n=r.value;if(t._zod.values.has(n))return r;return r.issues.push({code:"invalid_value",values:s,input:n,inst:t}),r}}),jd=g("$ZodLiteral",(t,e)=>{dt.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map((s)=>typeof s==="string"?ue(s):s?s.toString():String(s)).join("|")})$`),t._zod.parse=(s,r)=>{let a=s.value;if(t._zod.values.has(a))return s;return s.issues.push({code:"invalid_value",values:e.values,input:a,inst:t}),s}}),qd=g("$ZodFile",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{let a=s.value;if(a instanceof File)return s;return s.issues.push({expected:"file",code:"invalid_type",input:a,inst:t}),s}}),an=g("$ZodTransform",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{let a=e.transform(s.value,s);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then((n)=>{return s.value=n,s});if(a instanceof Promise)throw new de;return s.value=a,s}}),_d=g("$ZodOptional",(t,e)=>{dt.init(t,e),t._zod.optin="optional",t._zod.optout="optional",It(t._zod,"values",()=>{return e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0}),It(t._zod,"pattern",()=>{let s=e.innerType._zod.pattern;return s?new RegExp(`^(${s3(s.source)})?$`):void 0}),t._zod.parse=(s,r)=>{if(e.innerType._zod.optin==="optional")return e.innerType._zod.run(s,r);if(s.value===void 0)return s;return e.innerType._zod.run(s,r)}}),Dd=g("$ZodNullable",(t,e)=>{dt.init(t,e),It(t._zod,"optin",()=>e.innerType._zod.optin),It(t._zod,"optout",()=>e.innerType._zod.optout),It(t._zod,"pattern",()=>{let s=e.innerType._zod.pattern;return s?new RegExp(`^(${s3(s.source)}|null)$`):void 0}),It(t._zod,"values",()=>{return e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0}),t._zod.parse=(s,r)=>{if(s.value===null)return s;return e.innerType._zod.run(s,r)}}),Bd=g("$ZodDefault",(t,e)=>{dt.init(t,e),t._zod.optin="optional",It(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(s,r)=>{if(s.value===void 0)return s.value=e.defaultValue,s;let a=e.innerType._zod.run(s,r);if(a instanceof Promise)return a.then((n)=>Ah(n,e));return Ah(a,e)}});function Ah(t,e){if(t.value===void 0)t.value=e.defaultValue;return t}var Vd=g("$ZodPrefault",(t,e)=>{dt.init(t,e),t._zod.optin="optional",It(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(s,r)=>{if(s.value===void 0)s.value=e.defaultValue;return e.innerType._zod.run(s,r)}}),Nd=g("$ZodNonOptional",(t,e)=>{dt.init(t,e),It(t._zod,"values",()=>{let s=e.innerType._zod.values;return s?new Set([...s].filter((r)=>r!==void 0)):void 0}),t._zod.parse=(s,r)=>{let a=e.innerType._zod.run(s,r);if(a instanceof Promise)return a.then((n)=>bh(n,t));return bh(a,t)}});function bh(t,e){if(!t.issues.length&&t.value===void 0)t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e});return t}var wd=g("$ZodSuccess",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{let a=e.innerType._zod.run(s,r);if(a instanceof Promise)return a.then((n)=>{return s.value=n.issues.length===0,s});return s.value=a.issues.length===0,s}}),Kd=g("$ZodCatch",(t,e)=>{dt.init(t,e),t._zod.optin="optional",It(t._zod,"optout",()=>e.innerType._zod.optout),It(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(s,r)=>{let a=e.innerType._zod.run(s,r);if(a instanceof Promise)return a.then((n)=>{if(s.value=n.value,n.issues.length)s.value=e.catchValue({...s,error:{issues:n.issues.map((i)=>F0(i,r,n0()))},input:s.value}),s.issues=[];return s});if(s.value=a.value,a.issues.length)s.value=e.catchValue({...s,error:{issues:a.issues.map((n)=>F0(n,r,n0()))},input:s.value}),s.issues=[];return s}}),Hd=g("$ZodNaN",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{if(typeof s.value!=="number"||!Number.isNaN(s.value))return s.issues.push({input:s.value,inst:t,expected:"nan",code:"invalid_type"}),s;return s}}),sn=g("$ZodPipe",(t,e)=>{dt.init(t,e),It(t._zod,"values",()=>e.in._zod.values),It(t._zod,"optin",()=>e.in._zod.optin),It(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(s,r)=>{let a=e.in._zod.run(s,r);if(a instanceof Promise)return a.then((n)=>Zh(n,e,r));return Zh(a,e,r)}});function Zh(t,e,s){if(ge(t))return t;return e.out._zod.run({value:t.value,issues:t.issues},s)}var Od=g("$ZodReadonly",(t,e)=>{dt.init(t,e),It(t._zod,"propValues",()=>e.innerType._zod.propValues),It(t._zod,"values",()=>e.innerType._zod.values),It(t._zod,"optin",()=>e.innerType._zod.optin),It(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(s,r)=>{let a=e.innerType._zod.run(s,r);if(a instanceof Promise)return a.then(gh);return gh(a)}});function gh(t){return t.value=Object.freeze(t.value),t}var Ud=g("$ZodTemplateLiteral",(t,e)=>{dt.init(t,e);let s=[];for(let r of e.parts)if(r instanceof dt){if(!r._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);let a=r._zod.pattern instanceof RegExp?r._zod.pattern.source:r._zod.pattern;if(!a)throw Error(`Invalid template literal part: ${r._zod.traits}`);let n=a.startsWith("^")?1:0,i=a.endsWith("$")?a.length-1:a.length;s.push(a.slice(n,i))}else if(r===null||Nc.has(typeof r))s.push(ue(`${r}`));else throw Error(`Invalid template literal part: ${r}`);t._zod.pattern=new RegExp(`^${s.join("")}$`),t._zod.parse=(r,a)=>{if(typeof r.value!=="string")return r.issues.push({input:r.value,inst:t,expected:"template_literal",code:"invalid_type"}),r;if(t._zod.pattern.lastIndex=0,!t._zod.pattern.test(r.value))return r.issues.push({input:r.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),r;return r}}),Gd=g("$ZodPromise",(t,e)=>{dt.init(t,e),t._zod.parse=(s,r)=>{return Promise.resolve(s.value).then((a)=>e.innerType._zod.run({value:a,issues:[]},r))}}),Wd=g("$ZodLazy",(t,e)=>{dt.init(t,e),It(t._zod,"innerType",()=>e.getter()),It(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),It(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),It(t._zod,"optin",()=>t._zod.innerType._zod.optin),It(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(s,r)=>{return t._zod.innerType._zod.run(s,r)}}),zd=g("$ZodCustom",(t,e)=>{Bt.init(t,e),dt.init(t,e),t._zod.parse=(s,r)=>{return s},t._zod.check=(s)=>{let r=s.value,a=e.fn(r);if(a instanceof Promise)return a.then((n)=>Fh(n,s,r,t));Fh(a,s,r,t);return}});function Fh(t,e,s,r){if(!t){let a={code:"custom",input:s,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)a.params=r._zod.def.params;e.issues.push(Oc(a))}}var rn={};me(rn,{zhTW:()=>TS,zhCN:()=>lS,vi:()=>ES,ur:()=>mS,ua:()=>oS,tr:()=>cS,th:()=>nS,ta:()=>sS,sv:()=>eS,sl:()=>$l,ru:()=>Yl,pt:()=>Ql,ps:()=>Ul,pl:()=>Wl,ota:()=>Hl,no:()=>wl,nl:()=>Vl,ms:()=>Dl,mk:()=>ql,ko:()=>Ll,kh:()=>Ml,ja:()=>gl,it:()=>bl,id:()=>Cl,hu:()=>Il,he:()=>xl,frCA:()=>kl,fr:()=>Sl,fi:()=>ul,fa:()=>pl,es:()=>yl,eo:()=>dl,en:()=>Qd,de:()=>rl,cs:()=>al,ca:()=>tl,be:()=>Xu,az:()=>Ju,ar:()=>zu});var Wu=()=>{let t={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"number";case"object":{if(Array.isArray(a))return"array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return(a)=>{switch(a.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${a.expected}، ولكن تم إدخال ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${yt(a.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return` أكبر من اللازم: يفترض أن تكون ${a.origin??"القيمة"} ${n} ${a.maximum.toString()} ${i.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${a.origin??"القيمة"} ${n} ${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`أصغر من اللازم: يفترض لـ ${a.origin} أن يكون ${n} ${a.minimum.toString()} ${i.unit}`;return`أصغر من اللازم: يفترض لـ ${a.origin} أن يكون ${n} ${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${a.prefix}"`;if(n.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${n.suffix}"`;if(n.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${n.includes}"`;if(n.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${n.pattern}`;return`${r[n.format]??a.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${a.divisor}`;case"unrecognized_keys":return`معرف${a.keys.length>1?"ات":""} غريب${a.keys.length>1?"ة":""}: ${U(a.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${a.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${a.origin}`;default:return"مدخل غير مقبول"}}};function zu(){return{localeError:Wu()}}var Qu=()=>{let t={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"number";case"object":{if(Array.isArray(a))return"array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(a)=>{switch(a.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${a.expected}, daxil olan ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Yanlış dəyər: gözlənilən ${yt(a.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Çox böyük: gözlənilən ${a.origin??"dəyər"} ${n}${a.maximum.toString()} ${i.unit??"element"}`;return`Çox böyük: gözlənilən ${a.origin??"dəyər"} ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Çox kiçik: gözlənilən ${a.origin} ${n}${a.minimum.toString()} ${i.unit}`;return`Çox kiçik: gözlənilən ${a.origin} ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Yanlış mətn: "${n.prefix}" ilə başlamalıdır`;if(n.format==="ends_with")return`Yanlış mətn: "${n.suffix}" ilə bitməlidir`;if(n.format==="includes")return`Yanlış mətn: "${n.includes}" daxil olmalıdır`;if(n.format==="regex")return`Yanlış mətn: ${n.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${r[n.format]??a.format}`}case"not_multiple_of":return`Yanlış ədəd: ${a.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${a.keys.length>1?"lar":""}: ${U(a.keys,", ")}`;case"invalid_key":return`${a.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${a.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function Ju(){return{localeError:Qu()}}function Mh(t,e,s,r){let a=Math.abs(t),n=a%10,i=a%100;if(i>=11&&i<=19)return r;if(n===1)return e;if(n>=2&&n<=4)return s;return r}var Yu=()=>{let t={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"лік";case"object":{if(Array.isArray(a))return"масіў";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return(a)=>{switch(a.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${a.expected}, атрымана ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Няправільны ўвод: чакалася ${yt(a.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i){let h=Number(a.maximum),c=Mh(h,i.unit.one,i.unit.few,i.unit.many);return`Занадта вялікі: чакалася, што ${a.origin??"значэнне"} павінна ${i.verb} ${n}${a.maximum.toString()} ${c}`}return`Занадта вялікі: чакалася, што ${a.origin??"значэнне"} павінна быць ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i){let h=Number(a.minimum),c=Mh(h,i.unit.one,i.unit.few,i.unit.many);return`Занадта малы: чакалася, што ${a.origin} павінна ${i.verb} ${n}${a.minimum.toString()} ${c}`}return`Занадта малы: чакалася, што ${a.origin} павінна быць ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${n.prefix}"`;if(n.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${n.suffix}"`;if(n.format==="includes")return`Няправільны радок: павінен змяшчаць "${n.includes}"`;if(n.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${n.pattern}`;return`Няправільны ${r[n.format]??a.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${a.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${a.keys.length>1?"ключы":"ключ"}: ${U(a.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${a.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${a.origin}`;default:return"Няправільны ўвод"}}};function Xu(){return{localeError:Yu()}}var $u=()=>{let t={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"number";case"object":{if(Array.isArray(a))return"array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"entrada",email:"adreça electrònica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(a)=>{switch(a.code){case"invalid_type":return`Tipus invàlid: s'esperava ${a.expected}, s'ha rebut ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Valor invàlid: s'esperava ${yt(a.values[0])}`;return`Opció invàlida: s'esperava una de ${U(a.values," o ")}`;case"too_big":{let n=a.inclusive?"com a màxim":"menys de",i=e(a.origin);if(i)return`Massa gran: s'esperava que ${a.origin??"el valor"} contingués ${n} ${a.maximum.toString()} ${i.unit??"elements"}`;return`Massa gran: s'esperava que ${a.origin??"el valor"} fos ${n} ${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?"com a mínim":"més de",i=e(a.origin);if(i)return`Massa petit: s'esperava que ${a.origin} contingués ${n} ${a.minimum.toString()} ${i.unit}`;return`Massa petit: s'esperava que ${a.origin} fos ${n} ${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Format invàlid: ha de començar amb "${n.prefix}"`;if(n.format==="ends_with")return`Format invàlid: ha d'acabar amb "${n.suffix}"`;if(n.format==="includes")return`Format invàlid: ha d'incloure "${n.includes}"`;if(n.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${n.pattern}`;return`Format invàlid per a ${r[n.format]??a.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${a.divisor}`;case"unrecognized_keys":return`Clau${a.keys.length>1?"s":""} no reconeguda${a.keys.length>1?"s":""}: ${U(a.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${a.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${a.origin}`;default:return"Entrada invàlida"}}};function tl(){return{localeError:$u()}}var el=()=>{let t={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(a))return"pole";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"regulární výraz",email:"e-mailová adresa",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:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return(a)=>{switch(a.code){case"invalid_type":return`Neplatný vstup: očekáváno ${a.expected}, obdrženo ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Neplatný vstup: očekáváno ${yt(a.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Hodnota je příliš velká: ${a.origin??"hodnota"} musí mít ${n}${a.maximum.toString()} ${i.unit??"prvků"}`;return`Hodnota je příliš velká: ${a.origin??"hodnota"} musí být ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Hodnota je příliš malá: ${a.origin??"hodnota"} musí mít ${n}${a.minimum.toString()} ${i.unit??"prvků"}`;return`Hodnota je příliš malá: ${a.origin??"hodnota"} musí být ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Neplatný řetězec: musí začínat na "${n.prefix}"`;if(n.format==="ends_with")return`Neplatný řetězec: musí končit na "${n.suffix}"`;if(n.format==="includes")return`Neplatný řetězec: musí obsahovat "${n.includes}"`;if(n.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${n.pattern}`;return`Neplatný formát ${r[n.format]??a.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${a.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${U(a.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${a.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${a.origin}`;default:return"Neplatný vstup"}}};function al(){return{localeError:el()}}var sl=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"Zahl";case"object":{if(Array.isArray(a))return"Array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(a)=>{switch(a.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${a.expected}, erhalten ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Ungültige Eingabe: erwartet ${yt(a.values[0])}`;return`Ungültige Option: erwartet eine von ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Zu groß: erwartet, dass ${a.origin??"Wert"} ${n}${a.maximum.toString()} ${i.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${a.origin??"Wert"} ${n}${a.maximum.toString()} ist`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Zu klein: erwartet, dass ${a.origin} ${n}${a.minimum.toString()} ${i.unit} hat`;return`Zu klein: erwartet, dass ${a.origin} ${n}${a.minimum.toString()} ist`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Ungültiger String: muss mit "${n.prefix}" beginnen`;if(n.format==="ends_with")return`Ungültiger String: muss mit "${n.suffix}" enden`;if(n.format==="includes")return`Ungültiger String: muss "${n.includes}" enthalten`;if(n.format==="regex")return`Ungültiger String: muss dem Muster ${n.pattern} entsprechen`;return`Ungültig: ${r[n.format]??a.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${a.divisor} sein`;case"unrecognized_keys":return`${a.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${U(a.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${a.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${a.origin}`;default:return"Ungültige Eingabe"}}};function rl(){return{localeError:sl()}}var nl=(t)=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},il=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(r){return t[r]??null}let s={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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Invalid input: expected ${r.expected}, received ${nl(r.input)}`;case"invalid_value":if(r.values.length===1)return`Invalid input: expected ${yt(r.values[0])}`;return`Invalid option: expected one of ${U(r.values,"|")}`;case"too_big":{let a=r.inclusive?"<=":"<",n=e(r.origin);if(n)return`Too big: expected ${r.origin??"value"} to have ${a}${r.maximum.toString()} ${n.unit??"elements"}`;return`Too big: expected ${r.origin??"value"} to be ${a}${r.maximum.toString()}`}case"too_small":{let a=r.inclusive?">=":">",n=e(r.origin);if(n)return`Too small: expected ${r.origin} to have ${a}${r.minimum.toString()} ${n.unit}`;return`Too small: expected ${r.origin} to be ${a}${r.minimum.toString()}`}case"invalid_format":{let a=r;if(a.format==="starts_with")return`Invalid string: must start with "${a.prefix}"`;if(a.format==="ends_with")return`Invalid string: must end with "${a.suffix}"`;if(a.format==="includes")return`Invalid string: must include "${a.includes}"`;if(a.format==="regex")return`Invalid string: must match pattern ${a.pattern}`;return`Invalid ${s[a.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${U(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function Qd(){return{localeError:il()}}var hl=(t)=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},cl=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(r){return t[r]??null}let s={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(r)=>{switch(r.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${r.expected}, riceviĝis ${hl(r.input)}`;case"invalid_value":if(r.values.length===1)return`Nevalida enigo: atendiĝis ${yt(r.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${U(r.values,"|")}`;case"too_big":{let a=r.inclusive?"<=":"<",n=e(r.origin);if(n)return`Tro granda: atendiĝis ke ${r.origin??"valoro"} havu ${a}${r.maximum.toString()} ${n.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${r.origin??"valoro"} havu ${a}${r.maximum.toString()}`}case"too_small":{let a=r.inclusive?">=":">",n=e(r.origin);if(n)return`Tro malgranda: atendiĝis ke ${r.origin} havu ${a}${r.minimum.toString()} ${n.unit}`;return`Tro malgranda: atendiĝis ke ${r.origin} estu ${a}${r.minimum.toString()}`}case"invalid_format":{let a=r;if(a.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${a.prefix}"`;if(a.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${a.suffix}"`;if(a.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${a.includes}"`;if(a.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${a.pattern}`;return`Nevalida ${s[a.format]??r.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${r.divisor}`;case"unrecognized_keys":return`Nekonata${r.keys.length>1?"j":""} ŝlosilo${r.keys.length>1?"j":""}: ${U(r.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${r.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${r.origin}`;default:return"Nevalida enigo"}}};function dl(){return{localeError:cl()}}var ol=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"número";case"object":{if(Array.isArray(a))return"arreglo";if(a===null)return"nulo";if(Object.getPrototypeOf(a)!==Object.prototype)return a.constructor.name}}return n},r={regex:"entrada",email:"dirección de correo electrónico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(a)=>{switch(a.code){case"invalid_type":return`Entrada inválida: se esperaba ${a.expected}, recibido ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Entrada inválida: se esperaba ${yt(a.values[0])}`;return`Opción inválida: se esperaba una de ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Demasiado grande: se esperaba que ${a.origin??"valor"} tuviera ${n}${a.maximum.toString()} ${i.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${a.origin??"valor"} fuera ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Demasiado pequeño: se esperaba que ${a.origin} tuviera ${n}${a.minimum.toString()} ${i.unit}`;return`Demasiado pequeño: se esperaba que ${a.origin} fuera ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Cadena inválida: debe comenzar con "${n.prefix}"`;if(n.format==="ends_with")return`Cadena inválida: debe terminar en "${n.suffix}"`;if(n.format==="includes")return`Cadena inválida: debe incluir "${n.includes}"`;if(n.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${n.pattern}`;return`Inválido ${r[n.format]??a.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${a.divisor}`;case"unrecognized_keys":return`Llave${a.keys.length>1?"s":""} desconocida${a.keys.length>1?"s":""}: ${U(a.keys,", ")}`;case"invalid_key":return`Llave inválida en ${a.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${a.origin}`;default:return"Entrada inválida"}}};function yl(){return{localeError:ol()}}var ml=()=>{let t={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"عدد";case"object":{if(Array.isArray(a))return"آرایه";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return(a)=>{switch(a.code){case"invalid_type":return`ورودی نامعتبر: میبایست ${a.expected} میبود، ${s(a.input)} دریافت شد`;case"invalid_value":if(a.values.length===1)return`ورودی نامعتبر: میبایست ${yt(a.values[0])} میبود`;return`گزینه نامعتبر: میبایست یکی از ${U(a.values,"|")} میبود`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`خیلی بزرگ: ${a.origin??"مقدار"} باید ${n}${a.maximum.toString()} ${i.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${a.origin??"مقدار"} باید ${n}${a.maximum.toString()} باشد`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`خیلی کوچک: ${a.origin} باید ${n}${a.minimum.toString()} ${i.unit} باشد`;return`خیلی کوچک: ${a.origin} باید ${n}${a.minimum.toString()} باشد`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`رشته نامعتبر: باید با "${n.prefix}" شروع شود`;if(n.format==="ends_with")return`رشته نامعتبر: باید با "${n.suffix}" تمام شود`;if(n.format==="includes")return`رشته نامعتبر: باید شامل "${n.includes}" باشد`;if(n.format==="regex")return`رشته نامعتبر: باید با الگوی ${n.pattern} مطابقت داشته باشد`;return`${r[n.format]??a.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${a.divisor} باشد`;case"unrecognized_keys":return`کلید${a.keys.length>1?"های":""} ناشناس: ${U(a.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${a.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${a.origin}`;default:return"ورودی نامعتبر"}}};function pl(){return{localeError:ml()}}var El=()=>{let t={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"number";case"object":{if(Array.isArray(a))return"array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(a)=>{switch(a.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${a.expected}, oli ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Virheellinen syöte: täytyy olla ${yt(a.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Liian suuri: ${i.subject} täytyy olla ${n}${a.maximum.toString()} ${i.unit}`.trim();return`Liian suuri: arvon täytyy olla ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Liian pieni: ${i.subject} täytyy olla ${n}${a.minimum.toString()} ${i.unit}`.trim();return`Liian pieni: arvon täytyy olla ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${n.prefix}"`;if(n.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${n.suffix}"`;if(n.format==="includes")return`Virheellinen syöte: täytyy sisältää "${n.includes}"`;if(n.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${n.pattern}`;return`Virheellinen ${r[n.format]??a.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${a.divisor} monikerta`;case"unrecognized_keys":return`${a.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${U(a.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function ul(){return{localeError:El()}}var ll=()=>{let t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"nombre";case"object":{if(Array.isArray(a))return"tableau";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"entrée",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(a)=>{switch(a.code){case"invalid_type":return`Entrée invalide : ${a.expected} attendu, ${s(a.input)} reçu`;case"invalid_value":if(a.values.length===1)return`Entrée invalide : ${yt(a.values[0])} attendu`;return`Option invalide : une valeur parmi ${U(a.values,"|")} attendue`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Trop grand : ${a.origin??"valeur"} doit ${i.verb} ${n}${a.maximum.toString()} ${i.unit??"élément(s)"}`;return`Trop grand : ${a.origin??"valeur"} doit être ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Trop petit : ${a.origin} doit ${i.verb} ${n}${a.minimum.toString()} ${i.unit}`;return`Trop petit : ${a.origin} doit être ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Chaîne invalide : doit commencer par "${n.prefix}"`;if(n.format==="ends_with")return`Chaîne invalide : doit se terminer par "${n.suffix}"`;if(n.format==="includes")return`Chaîne invalide : doit inclure "${n.includes}"`;if(n.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${n.pattern}`;return`${r[n.format]??a.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${a.divisor}`;case"unrecognized_keys":return`Clé${a.keys.length>1?"s":""} non reconnue${a.keys.length>1?"s":""} : ${U(a.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${a.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${a.origin}`;default:return"Entrée invalide"}}};function Sl(){return{localeError:ll()}}var Tl=()=>{let t={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"number";case"object":{if(Array.isArray(a))return"array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"entrée",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(a)=>{switch(a.code){case"invalid_type":return`Entrée invalide : attendu ${a.expected}, reçu ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Entrée invalide : attendu ${yt(a.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"≤":"<",i=e(a.origin);if(i)return`Trop grand : attendu que ${a.origin??"la valeur"} ait ${n}${a.maximum.toString()} ${i.unit}`;return`Trop grand : attendu que ${a.origin??"la valeur"} soit ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?"≥":">",i=e(a.origin);if(i)return`Trop petit : attendu que ${a.origin} ait ${n}${a.minimum.toString()} ${i.unit}`;return`Trop petit : attendu que ${a.origin} soit ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Chaîne invalide : doit commencer par "${n.prefix}"`;if(n.format==="ends_with")return`Chaîne invalide : doit se terminer par "${n.suffix}"`;if(n.format==="includes")return`Chaîne invalide : doit inclure "${n.includes}"`;if(n.format==="regex")return`Chaîne invalide : doit correspondre au motif ${n.pattern}`;return`${r[n.format]??a.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${a.divisor}`;case"unrecognized_keys":return`Clé${a.keys.length>1?"s":""} non reconnue${a.keys.length>1?"s":""} : ${U(a.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${a.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${a.origin}`;default:return"Entrée invalide"}}};function kl(){return{localeError:Tl()}}var fl=()=>{let t={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"number";case"object":{if(Array.isArray(a))return"array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return(a)=>{switch(a.code){case"invalid_type":return`קלט לא תקין: צריך ${a.expected}, התקבל ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`קלט לא תקין: צריך ${yt(a.values[0])}`;return`קלט לא תקין: צריך אחת מהאפשרויות ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`גדול מדי: ${a.origin??"value"} צריך להיות ${n}${a.maximum.toString()} ${i.unit??"elements"}`;return`גדול מדי: ${a.origin??"value"} צריך להיות ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`קטן מדי: ${a.origin} צריך להיות ${n}${a.minimum.toString()} ${i.unit}`;return`קטן מדי: ${a.origin} צריך להיות ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`מחרוזת לא תקינה: חייבת להתחיל ב"${n.prefix}"`;if(n.format==="ends_with")return`מחרוזת לא תקינה: חייבת להסתיים ב "${n.suffix}"`;if(n.format==="includes")return`מחרוזת לא תקינה: חייבת לכלול "${n.includes}"`;if(n.format==="regex")return`מחרוזת לא תקינה: חייבת להתאים לתבנית ${n.pattern}`;return`${r[n.format]??a.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${a.divisor}`;case"unrecognized_keys":return`מפתח${a.keys.length>1?"ות":""} לא מזוה${a.keys.length>1?"ים":"ה"}: ${U(a.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${a.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${a.origin}`;default:return"קלט לא תקין"}}};function xl(){return{localeError:fl()}}var Rl=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"szám";case"object":{if(Array.isArray(a))return"tömb";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"bemenet",email:"email cím",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 időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return(a)=>{switch(a.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${a.expected}, a kapott érték ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Érvénytelen bemenet: a várt érték ${yt(a.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Túl nagy: ${a.origin??"érték"} mérete túl nagy ${n}${a.maximum.toString()} ${i.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${a.origin??"érték"} túl nagy: ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Túl kicsi: a bemeneti érték ${a.origin} mérete túl kicsi ${n}${a.minimum.toString()} ${i.unit}`;return`Túl kicsi: a bemeneti érték ${a.origin} túl kicsi ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Érvénytelen string: "${n.prefix}" értékkel kell kezdődnie`;if(n.format==="ends_with")return`Érvénytelen string: "${n.suffix}" értékkel kell végződnie`;if(n.format==="includes")return`Érvénytelen string: "${n.includes}" értéket kell tartalmaznia`;if(n.format==="regex")return`Érvénytelen string: ${n.pattern} mintának kell megfelelnie`;return`Érvénytelen ${r[n.format]??a.format}`}case"not_multiple_of":return`Érvénytelen szám: ${a.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${a.keys.length>1?"s":""}: ${U(a.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${a.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${a.origin}`;default:return"Érvénytelen bemenet"}}};function Il(){return{localeError:Rl()}}var vl=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"number";case"object":{if(Array.isArray(a))return"array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(a)=>{switch(a.code){case"invalid_type":return`Input tidak valid: diharapkan ${a.expected}, diterima ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Input tidak valid: diharapkan ${yt(a.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Terlalu besar: diharapkan ${a.origin??"value"} memiliki ${n}${a.maximum.toString()} ${i.unit??"elemen"}`;return`Terlalu besar: diharapkan ${a.origin??"value"} menjadi ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Terlalu kecil: diharapkan ${a.origin} memiliki ${n}${a.minimum.toString()} ${i.unit}`;return`Terlalu kecil: diharapkan ${a.origin} menjadi ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`String tidak valid: harus dimulai dengan "${n.prefix}"`;if(n.format==="ends_with")return`String tidak valid: harus berakhir dengan "${n.suffix}"`;if(n.format==="includes")return`String tidak valid: harus menyertakan "${n.includes}"`;if(n.format==="regex")return`String tidak valid: harus sesuai pola ${n.pattern}`;return`${r[n.format]??a.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${a.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${a.keys.length>1?"s":""}: ${U(a.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${a.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${a.origin}`;default:return"Input tidak valid"}}};function Cl(){return{localeError:vl()}}var Al=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"numero";case"object":{if(Array.isArray(a))return"vettore";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(a)=>{switch(a.code){case"invalid_type":return`Input non valido: atteso ${a.expected}, ricevuto ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Input non valido: atteso ${yt(a.values[0])}`;return`Opzione non valida: atteso uno tra ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Troppo grande: ${a.origin??"valore"} deve avere ${n}${a.maximum.toString()} ${i.unit??"elementi"}`;return`Troppo grande: ${a.origin??"valore"} deve essere ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Troppo piccolo: ${a.origin} deve avere ${n}${a.minimum.toString()} ${i.unit}`;return`Troppo piccolo: ${a.origin} deve essere ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Stringa non valida: deve iniziare con "${n.prefix}"`;if(n.format==="ends_with")return`Stringa non valida: deve terminare con "${n.suffix}"`;if(n.format==="includes")return`Stringa non valida: deve includere "${n.includes}"`;if(n.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${n.pattern}`;return`Invalid ${r[n.format]??a.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${a.divisor}`;case"unrecognized_keys":return`Chiav${a.keys.length>1?"i":"e"} non riconosciut${a.keys.length>1?"e":"a"}: ${U(a.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${a.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${a.origin}`;default:return"Input non valido"}}};function bl(){return{localeError:Al()}}var Zl=()=>{let t={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"数値";case"object":{if(Array.isArray(a))return"配列";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return(a)=>{switch(a.code){case"invalid_type":return`無効な入力: ${a.expected}が期待されましたが、${s(a.input)}が入力されました`;case"invalid_value":if(a.values.length===1)return`無効な入力: ${yt(a.values[0])}が期待されました`;return`無効な選択: ${U(a.values,"、")}のいずれかである必要があります`;case"too_big":{let n=a.inclusive?"以下である":"より小さい",i=e(a.origin);if(i)return`大きすぎる値: ${a.origin??"値"}は${a.maximum.toString()}${i.unit??"要素"}${n}必要があります`;return`大きすぎる値: ${a.origin??"値"}は${a.maximum.toString()}${n}必要があります`}case"too_small":{let n=a.inclusive?"以上である":"より大きい",i=e(a.origin);if(i)return`小さすぎる値: ${a.origin}は${a.minimum.toString()}${i.unit}${n}必要があります`;return`小さすぎる値: ${a.origin}は${a.minimum.toString()}${n}必要があります`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`無効な文字列: "${n.prefix}"で始まる必要があります`;if(n.format==="ends_with")return`無効な文字列: "${n.suffix}"で終わる必要があります`;if(n.format==="includes")return`無効な文字列: "${n.includes}"を含む必要があります`;if(n.format==="regex")return`無効な文字列: パターン${n.pattern}に一致する必要があります`;return`無効な${r[n.format]??a.format}`}case"not_multiple_of":return`無効な数値: ${a.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${a.keys.length>1?"群":""}: ${U(a.keys,"、")}`;case"invalid_key":return`${a.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${a.origin}内の無効な値`;default:return"無効な入力"}}};function gl(){return{localeError:Zl()}}var Fl=()=>{let t={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(a))return"អារេ (Array)";if(a===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return(a)=>{switch(a.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${a.expected} ប៉ុន្តែទទួលបាន ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${yt(a.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`ធំពេក៖ ត្រូវការ ${a.origin??"តម្លៃ"} ${n} ${a.maximum.toString()} ${i.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${a.origin??"តម្លៃ"} ${n} ${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`តូចពេក៖ ត្រូវការ ${a.origin} ${n} ${a.minimum.toString()} ${i.unit}`;return`តូចពេក៖ ត្រូវការ ${a.origin} ${n} ${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${n.prefix}"`;if(n.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${n.suffix}"`;if(n.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${n.includes}"`;if(n.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${n.pattern}`;return`មិនត្រឹមត្រូវ៖ ${r[n.format]??a.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${a.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${U(a.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${a.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${a.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function Ml(){return{localeError:Fl()}}var Pl=()=>{let t={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"number";case"object":{if(Array.isArray(a))return"array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return(a)=>{switch(a.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${a.expected}, 받은 타입은 ${s(a.input)}입니다`;case"invalid_value":if(a.values.length===1)return`잘못된 입력: 값은 ${yt(a.values[0])} 이어야 합니다`;return`잘못된 옵션: ${U(a.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let n=a.inclusive?"이하":"미만",i=n==="미만"?"이어야 합니다":"여야 합니다",h=e(a.origin),c=h?.unit??"요소";if(h)return`${a.origin??"값"}이 너무 큽니다: ${a.maximum.toString()}${c} ${n}${i}`;return`${a.origin??"값"}이 너무 큽니다: ${a.maximum.toString()} ${n}${i}`}case"too_small":{let n=a.inclusive?"이상":"초과",i=n==="이상"?"이어야 합니다":"여야 합니다",h=e(a.origin),c=h?.unit??"요소";if(h)return`${a.origin??"값"}이 너무 작습니다: ${a.minimum.toString()}${c} ${n}${i}`;return`${a.origin??"값"}이 너무 작습니다: ${a.minimum.toString()} ${n}${i}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`잘못된 문자열: "${n.prefix}"(으)로 시작해야 합니다`;if(n.format==="ends_with")return`잘못된 문자열: "${n.suffix}"(으)로 끝나야 합니다`;if(n.format==="includes")return`잘못된 문자열: "${n.includes}"을(를) 포함해야 합니다`;if(n.format==="regex")return`잘못된 문자열: 정규식 ${n.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${r[n.format]??a.format}`}case"not_multiple_of":return`잘못된 숫자: ${a.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${U(a.keys,", ")}`;case"invalid_key":return`잘못된 키: ${a.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${a.origin}`;default:return"잘못된 입력"}}};function Ll(){return{localeError:Pl()}}var jl=()=>{let t={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"број";case"object":{if(Array.isArray(a))return"низа";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return(a)=>{switch(a.code){case"invalid_type":return`Грешен внес: се очекува ${a.expected}, примено ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Invalid input: expected ${yt(a.values[0])}`;return`Грешана опција: се очекува една ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Премногу голем: се очекува ${a.origin??"вредноста"} да има ${n}${a.maximum.toString()} ${i.unit??"елементи"}`;return`Премногу голем: се очекува ${a.origin??"вредноста"} да биде ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Премногу мал: се очекува ${a.origin} да има ${n}${a.minimum.toString()} ${i.unit}`;return`Премногу мал: се очекува ${a.origin} да биде ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Неважечка низа: мора да започнува со "${n.prefix}"`;if(n.format==="ends_with")return`Неважечка низа: мора да завршува со "${n.suffix}"`;if(n.format==="includes")return`Неважечка низа: мора да вклучува "${n.includes}"`;if(n.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${n.pattern}`;return`Invalid ${r[n.format]??a.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${a.divisor}`;case"unrecognized_keys":return`${a.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${U(a.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${a.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${a.origin}`;default:return"Грешен внес"}}};function ql(){return{localeError:jl()}}var _l=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"nombor";case"object":{if(Array.isArray(a))return"array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(a)=>{switch(a.code){case"invalid_type":return`Input tidak sah: dijangka ${a.expected}, diterima ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Input tidak sah: dijangka ${yt(a.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Terlalu besar: dijangka ${a.origin??"nilai"} ${i.verb} ${n}${a.maximum.toString()} ${i.unit??"elemen"}`;return`Terlalu besar: dijangka ${a.origin??"nilai"} adalah ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Terlalu kecil: dijangka ${a.origin} ${i.verb} ${n}${a.minimum.toString()} ${i.unit}`;return`Terlalu kecil: dijangka ${a.origin} adalah ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`String tidak sah: mesti bermula dengan "${n.prefix}"`;if(n.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${n.suffix}"`;if(n.format==="includes")return`String tidak sah: mesti mengandungi "${n.includes}"`;if(n.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${n.pattern}`;return`${r[n.format]??a.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${a.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${U(a.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${a.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${a.origin}`;default:return"Input tidak sah"}}};function Dl(){return{localeError:_l()}}var Bl=()=>{let t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"getal";case"object":{if(Array.isArray(a))return"array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(a)=>{switch(a.code){case"invalid_type":return`Ongeldige invoer: verwacht ${a.expected}, ontving ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Ongeldige invoer: verwacht ${yt(a.values[0])}`;return`Ongeldige optie: verwacht één van ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Te lang: verwacht dat ${a.origin??"waarde"} ${n}${a.maximum.toString()} ${i.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${a.origin??"waarde"} ${n}${a.maximum.toString()} is`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Te kort: verwacht dat ${a.origin} ${n}${a.minimum.toString()} ${i.unit} bevat`;return`Te kort: verwacht dat ${a.origin} ${n}${a.minimum.toString()} is`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Ongeldige tekst: moet met "${n.prefix}" beginnen`;if(n.format==="ends_with")return`Ongeldige tekst: moet op "${n.suffix}" eindigen`;if(n.format==="includes")return`Ongeldige tekst: moet "${n.includes}" bevatten`;if(n.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${n.pattern}`;return`Ongeldig: ${r[n.format]??a.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${a.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${a.keys.length>1?"s":""}: ${U(a.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${a.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${a.origin}`;default:return"Ongeldige invoer"}}};function Vl(){return{localeError:Bl()}}var Nl=()=>{let t={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"tall";case"object":{if(Array.isArray(a))return"liste";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(a)=>{switch(a.code){case"invalid_type":return`Ugyldig input: forventet ${a.expected}, fikk ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Ugyldig verdi: forventet ${yt(a.values[0])}`;return`Ugyldig valg: forventet en av ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`For stor(t): forventet ${a.origin??"value"} til å ha ${n}${a.maximum.toString()} ${i.unit??"elementer"}`;return`For stor(t): forventet ${a.origin??"value"} til å ha ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`For lite(n): forventet ${a.origin} til å ha ${n}${a.minimum.toString()} ${i.unit}`;return`For lite(n): forventet ${a.origin} til å ha ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Ugyldig streng: må starte med "${n.prefix}"`;if(n.format==="ends_with")return`Ugyldig streng: må ende med "${n.suffix}"`;if(n.format==="includes")return`Ugyldig streng: må inneholde "${n.includes}"`;if(n.format==="regex")return`Ugyldig streng: må matche mønsteret ${n.pattern}`;return`Ugyldig ${r[n.format]??a.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${a.divisor}`;case"unrecognized_keys":return`${a.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${U(a.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${a.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${a.origin}`;default:return"Ugyldig input"}}};function wl(){return{localeError:Nl()}}var Kl=()=>{let t={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"numara";case"object":{if(Array.isArray(a))return"saf";if(a===null)return"gayb";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"giren",email:"epostagâh",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 hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return(a)=>{switch(a.code){case"invalid_type":return`Fâsit giren: umulan ${a.expected}, alınan ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Fâsit giren: umulan ${yt(a.values[0])}`;return`Fâsit tercih: mûteberler ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Fazla büyük: ${a.origin??"value"}, ${n}${a.maximum.toString()} ${i.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${a.origin??"value"}, ${n}${a.maximum.toString()} olmalıydı.`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Fazla küçük: ${a.origin}, ${n}${a.minimum.toString()} ${i.unit} sahip olmalıydı.`;return`Fazla küçük: ${a.origin}, ${n}${a.minimum.toString()} olmalıydı.`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Fâsit metin: "${n.prefix}" ile başlamalı.`;if(n.format==="ends_with")return`Fâsit metin: "${n.suffix}" ile bitmeli.`;if(n.format==="includes")return`Fâsit metin: "${n.includes}" ihtivâ etmeli.`;if(n.format==="regex")return`Fâsit metin: ${n.pattern} nakşına uymalı.`;return`Fâsit ${r[n.format]??a.format}`}case"not_multiple_of":return`Fâsit sayı: ${a.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${a.keys.length>1?"s":""}: ${U(a.keys,", ")}`;case"invalid_key":return`${a.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${a.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Hl(){return{localeError:Kl()}}var Ol=()=>{let t={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"عدد";case"object":{if(Array.isArray(a))return"ارې";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return(a)=>{switch(a.code){case"invalid_type":return`ناسم ورودي: باید ${a.expected} وای, مګر ${s(a.input)} ترلاسه شو`;case"invalid_value":if(a.values.length===1)return`ناسم ورودي: باید ${yt(a.values[0])} وای`;return`ناسم انتخاب: باید یو له ${U(a.values,"|")} څخه وای`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`ډیر لوی: ${a.origin??"ارزښت"} باید ${n}${a.maximum.toString()} ${i.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${a.origin??"ارزښت"} باید ${n}${a.maximum.toString()} وي`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`ډیر کوچنی: ${a.origin} باید ${n}${a.minimum.toString()} ${i.unit} ولري`;return`ډیر کوچنی: ${a.origin} باید ${n}${a.minimum.toString()} وي`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`ناسم متن: باید د "${n.prefix}" سره پیل شي`;if(n.format==="ends_with")return`ناسم متن: باید د "${n.suffix}" سره پای ته ورسيږي`;if(n.format==="includes")return`ناسم متن: باید "${n.includes}" ولري`;if(n.format==="regex")return`ناسم متن: باید د ${n.pattern} سره مطابقت ولري`;return`${r[n.format]??a.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${a.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${a.keys.length>1?"کلیډونه":"کلیډ"}: ${U(a.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${a.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${a.origin} کې`;default:return"ناسمه ورودي"}}};function Ul(){return{localeError:Ol()}}var Gl=()=>{let t={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"liczba";case"object":{if(Array.isArray(a))return"tablica";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"wyrażenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return(a)=>{switch(a.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${a.expected}, otrzymano ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${yt(a.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Za duża wartość: oczekiwano, że ${a.origin??"wartość"} będzie mieć ${n}${a.maximum.toString()} ${i.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${a.origin??"wartość"} będzie wynosić ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Za mała wartość: oczekiwano, że ${a.origin??"wartość"} będzie mieć ${n}${a.minimum.toString()} ${i.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${a.origin??"wartość"} będzie wynosić ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${n.prefix}"`;if(n.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${n.suffix}"`;if(n.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${n.includes}"`;if(n.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${n.pattern}`;return`Nieprawidłow(y/a/e) ${r[n.format]??a.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${a.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${a.keys.length>1?"s":""}: ${U(a.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${a.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${a.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Wl(){return{localeError:Gl()}}var zl=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"número";case"object":{if(Array.isArray(a))return"array";if(a===null)return"nulo";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"padrão",email:"endereço de e-mail",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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(a)=>{switch(a.code){case"invalid_type":return`Tipo inválido: esperado ${a.expected}, recebido ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Entrada inválida: esperado ${yt(a.values[0])}`;return`Opção inválida: esperada uma das ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Muito grande: esperado que ${a.origin??"valor"} tivesse ${n}${a.maximum.toString()} ${i.unit??"elementos"}`;return`Muito grande: esperado que ${a.origin??"valor"} fosse ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Muito pequeno: esperado que ${a.origin} tivesse ${n}${a.minimum.toString()} ${i.unit}`;return`Muito pequeno: esperado que ${a.origin} fosse ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Texto inválido: deve começar com "${n.prefix}"`;if(n.format==="ends_with")return`Texto inválido: deve terminar com "${n.suffix}"`;if(n.format==="includes")return`Texto inválido: deve incluir "${n.includes}"`;if(n.format==="regex")return`Texto inválido: deve corresponder ao padrão ${n.pattern}`;return`${r[n.format]??a.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${a.divisor}`;case"unrecognized_keys":return`Chave${a.keys.length>1?"s":""} desconhecida${a.keys.length>1?"s":""}: ${U(a.keys,", ")}`;case"invalid_key":return`Chave inválida em ${a.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${a.origin}`;default:return"Campo inválido"}}};function Ql(){return{localeError:zl()}}function Ph(t,e,s,r){let a=Math.abs(t),n=a%10,i=a%100;if(i>=11&&i<=19)return r;if(n===1)return e;if(n>=2&&n<=4)return s;return r}var Jl=()=>{let t={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"число";case"object":{if(Array.isArray(a))return"массив";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return(a)=>{switch(a.code){case"invalid_type":return`Неверный ввод: ожидалось ${a.expected}, получено ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Неверный ввод: ожидалось ${yt(a.values[0])}`;return`Неверный вариант: ожидалось одно из ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i){let h=Number(a.maximum),c=Ph(h,i.unit.one,i.unit.few,i.unit.many);return`Слишком большое значение: ожидалось, что ${a.origin??"значение"} будет иметь ${n}${a.maximum.toString()} ${c}`}return`Слишком большое значение: ожидалось, что ${a.origin??"значение"} будет ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i){let h=Number(a.minimum),c=Ph(h,i.unit.one,i.unit.few,i.unit.many);return`Слишком маленькое значение: ожидалось, что ${a.origin} будет иметь ${n}${a.minimum.toString()} ${c}`}return`Слишком маленькое значение: ожидалось, что ${a.origin} будет ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Неверная строка: должна начинаться с "${n.prefix}"`;if(n.format==="ends_with")return`Неверная строка: должна заканчиваться на "${n.suffix}"`;if(n.format==="includes")return`Неверная строка: должна содержать "${n.includes}"`;if(n.format==="regex")return`Неверная строка: должна соответствовать шаблону ${n.pattern}`;return`Неверный ${r[n.format]??a.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${a.divisor}`;case"unrecognized_keys":return`Нераспознанн${a.keys.length>1?"ые":"ый"} ключ${a.keys.length>1?"и":""}: ${U(a.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${a.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${a.origin}`;default:return"Неверные входные данные"}}};function Yl(){return{localeError:Jl()}}var Xl=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"število";case"object":{if(Array.isArray(a))return"tabela";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"vnos",email:"e-poštni naslov",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 datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return(a)=>{switch(a.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${a.expected}, prejeto ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Neveljaven vnos: pričakovano ${yt(a.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Preveliko: pričakovano, da bo ${a.origin??"vrednost"} imelo ${n}${a.maximum.toString()} ${i.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${a.origin??"vrednost"} ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Premajhno: pričakovano, da bo ${a.origin} imelo ${n}${a.minimum.toString()} ${i.unit}`;return`Premajhno: pričakovano, da bo ${a.origin} ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Neveljaven niz: mora se začeti z "${n.prefix}"`;if(n.format==="ends_with")return`Neveljaven niz: mora se končati z "${n.suffix}"`;if(n.format==="includes")return`Neveljaven niz: mora vsebovati "${n.includes}"`;if(n.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${n.pattern}`;return`Neveljaven ${r[n.format]??a.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${a.divisor}`;case"unrecognized_keys":return`Neprepoznan${a.keys.length>1?"i ključi":" ključ"}: ${U(a.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${a.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${a.origin}`;default:return"Neveljaven vnos"}}};function $l(){return{localeError:Xl()}}var tS=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"antal";case"object":{if(Array.isArray(a))return"lista";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"reguljärt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(a)=>{switch(a.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${a.expected}, fick ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Ogiltig inmatning: förväntat ${yt(a.values[0])}`;return`Ogiltigt val: förväntade en av ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`För stor(t): förväntade ${a.origin??"värdet"} att ha ${n}${a.maximum.toString()} ${i.unit??"element"}`;return`För stor(t): förväntat ${a.origin??"värdet"} att ha ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`För lite(t): förväntade ${a.origin??"värdet"} att ha ${n}${a.minimum.toString()} ${i.unit}`;return`För lite(t): förväntade ${a.origin??"värdet"} att ha ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Ogiltig sträng: måste börja med "${n.prefix}"`;if(n.format==="ends_with")return`Ogiltig sträng: måste sluta med "${n.suffix}"`;if(n.format==="includes")return`Ogiltig sträng: måste innehålla "${n.includes}"`;if(n.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${n.pattern}"`;return`Ogiltig(t) ${r[n.format]??a.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${a.divisor}`;case"unrecognized_keys":return`${a.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${U(a.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${a.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${a.origin??"värdet"}`;default:return"Ogiltig input"}}};function eS(){return{localeError:tS()}}var aS=()=>{let t={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(a))return"அணி";if(a===null)return"வெறுமை";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",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 தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return(a)=>{switch(a.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${a.expected}, பெறப்பட்டது ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${yt(a.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${U(a.values,"|")} இல் ஒன்று`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${a.origin??"மதிப்பு"} ${n}${a.maximum.toString()} ${i.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${a.origin??"மதிப்பு"} ${n}${a.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${a.origin} ${n}${a.minimum.toString()} ${i.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${a.origin} ${n}${a.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`தவறான சரம்: "${n.prefix}" இல் தொடங்க வேண்டும்`;if(n.format==="ends_with")return`தவறான சரம்: "${n.suffix}" இல் முடிவடைய வேண்டும்`;if(n.format==="includes")return`தவறான சரம்: "${n.includes}" ஐ உள்ளடக்க வேண்டும்`;if(n.format==="regex")return`தவறான சரம்: ${n.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${r[n.format]??a.format}`}case"not_multiple_of":return`தவறான எண்: ${a.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${a.keys.length>1?"கள்":""}: ${U(a.keys,", ")}`;case"invalid_key":return`${a.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${a.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function sS(){return{localeError:aS()}}var rS=()=>{let t={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(a))return"อาร์เรย์ (Array)";if(a===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return(a)=>{switch(a.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${a.expected} แต่ได้รับ ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${yt(a.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"ไม่เกิน":"น้อยกว่า",i=e(a.origin);if(i)return`เกินกำหนด: ${a.origin??"ค่า"} ควรมี${n} ${a.maximum.toString()} ${i.unit??"รายการ"}`;return`เกินกำหนด: ${a.origin??"ค่า"} ควรมี${n} ${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?"อย่างน้อย":"มากกว่า",i=e(a.origin);if(i)return`น้อยกว่ากำหนด: ${a.origin} ควรมี${n} ${a.minimum.toString()} ${i.unit}`;return`น้อยกว่ากำหนด: ${a.origin} ควรมี${n} ${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${n.prefix}"`;if(n.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${n.suffix}"`;if(n.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${n.includes}" อยู่ในข้อความ`;if(n.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${n.pattern}`;return`รูปแบบไม่ถูกต้อง: ${r[n.format]??a.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${a.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${U(a.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${a.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${a.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function nS(){return{localeError:rS()}}var iS=(t)=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},hS=()=>{let t={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function e(r){return t[r]??null}let s={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return(r)=>{switch(r.code){case"invalid_type":return`Geçersiz değer: beklenen ${r.expected}, alınan ${iS(r.input)}`;case"invalid_value":if(r.values.length===1)return`Geçersiz değer: beklenen ${yt(r.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${U(r.values,"|")}`;case"too_big":{let a=r.inclusive?"<=":"<",n=e(r.origin);if(n)return`Çok büyük: beklenen ${r.origin??"değer"} ${a}${r.maximum.toString()} ${n.unit??"öğe"}`;return`Çok büyük: beklenen ${r.origin??"değer"} ${a}${r.maximum.toString()}`}case"too_small":{let a=r.inclusive?">=":">",n=e(r.origin);if(n)return`Çok küçük: beklenen ${r.origin} ${a}${r.minimum.toString()} ${n.unit}`;return`Çok küçük: beklenen ${r.origin} ${a}${r.minimum.toString()}`}case"invalid_format":{let a=r;if(a.format==="starts_with")return`Geçersiz metin: "${a.prefix}" ile başlamalı`;if(a.format==="ends_with")return`Geçersiz metin: "${a.suffix}" ile bitmeli`;if(a.format==="includes")return`Geçersiz metin: "${a.includes}" içermeli`;if(a.format==="regex")return`Geçersiz metin: ${a.pattern} desenine uymalı`;return`Geçersiz ${s[a.format]??r.format}`}case"not_multiple_of":return`Geçersiz sayı: ${r.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${r.keys.length>1?"lar":""}: ${U(r.keys,", ")}`;case"invalid_key":return`${r.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${r.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function cS(){return{localeError:hS()}}var dS=()=>{let t={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"число";case"object":{if(Array.isArray(a))return"масив";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return(a)=>{switch(a.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${a.expected}, отримано ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Неправильні вхідні дані: очікується ${yt(a.values[0])}`;return`Неправильна опція: очікується одне з ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Занадто велике: очікується, що ${a.origin??"значення"} ${i.verb} ${n}${a.maximum.toString()} ${i.unit??"елементів"}`;return`Занадто велике: очікується, що ${a.origin??"значення"} буде ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Занадто мале: очікується, що ${a.origin} ${i.verb} ${n}${a.minimum.toString()} ${i.unit}`;return`Занадто мале: очікується, що ${a.origin} буде ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Неправильний рядок: повинен починатися з "${n.prefix}"`;if(n.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${n.suffix}"`;if(n.format==="includes")return`Неправильний рядок: повинен містити "${n.includes}"`;if(n.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${n.pattern}`;return`Неправильний ${r[n.format]??a.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${a.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${a.keys.length>1?"і":""}: ${U(a.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${a.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${a.origin}`;default:return"Неправильні вхідні дані"}}};function oS(){return{localeError:dS()}}var yS=()=>{let t={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"نمبر";case"object":{if(Array.isArray(a))return"آرے";if(a===null)return"نل";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return(a)=>{switch(a.code){case"invalid_type":return`غلط ان پٹ: ${a.expected} متوقع تھا، ${s(a.input)} موصول ہوا`;case"invalid_value":if(a.values.length===1)return`غلط ان پٹ: ${yt(a.values[0])} متوقع تھا`;return`غلط آپشن: ${U(a.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`بہت بڑا: ${a.origin??"ویلیو"} کے ${n}${a.maximum.toString()} ${i.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${a.origin??"ویلیو"} کا ${n}${a.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`بہت چھوٹا: ${a.origin} کے ${n}${a.minimum.toString()} ${i.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${a.origin} کا ${n}${a.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`غلط سٹرنگ: "${n.prefix}" سے شروع ہونا چاہیے`;if(n.format==="ends_with")return`غلط سٹرنگ: "${n.suffix}" پر ختم ہونا چاہیے`;if(n.format==="includes")return`غلط سٹرنگ: "${n.includes}" شامل ہونا چاہیے`;if(n.format==="regex")return`غلط سٹرنگ: پیٹرن ${n.pattern} سے میچ ہونا چاہیے`;return`غلط ${r[n.format]??a.format}`}case"not_multiple_of":return`غلط نمبر: ${a.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${a.keys.length>1?"ز":""}: ${U(a.keys,"، ")}`;case"invalid_key":return`${a.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${a.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function mS(){return{localeError:yS()}}var pS=()=>{let t={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"số";case"object":{if(Array.isArray(a))return"mảng";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"đầu vào",email:"địa chỉ email",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:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return(a)=>{switch(a.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${a.expected}, nhận được ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${yt(a.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`Quá lớn: mong đợi ${a.origin??"giá trị"} ${i.verb} ${n}${a.maximum.toString()} ${i.unit??"phần tử"}`;return`Quá lớn: mong đợi ${a.origin??"giá trị"} ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`Quá nhỏ: mong đợi ${a.origin} ${i.verb} ${n}${a.minimum.toString()} ${i.unit}`;return`Quá nhỏ: mong đợi ${a.origin} ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${n.prefix}"`;if(n.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${n.suffix}"`;if(n.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${n.includes}"`;if(n.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${n.pattern}`;return`${r[n.format]??a.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${a.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${U(a.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${a.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${a.origin}`;default:return"Đầu vào không hợp lệ"}}};function ES(){return{localeError:pS()}}var uS=()=>{let t={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(a))return"数组";if(a===null)return"空值(null)";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return(a)=>{switch(a.code){case"invalid_type":return`无效输入:期望 ${a.expected},实际接收 ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`无效输入:期望 ${yt(a.values[0])}`;return`无效选项:期望以下之一 ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`数值过大:期望 ${a.origin??"值"} ${n}${a.maximum.toString()} ${i.unit??"个元素"}`;return`数值过大:期望 ${a.origin??"值"} ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`数值过小:期望 ${a.origin} ${n}${a.minimum.toString()} ${i.unit}`;return`数值过小:期望 ${a.origin} ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`无效字符串:必须以 "${n.prefix}" 开头`;if(n.format==="ends_with")return`无效字符串:必须以 "${n.suffix}" 结尾`;if(n.format==="includes")return`无效字符串:必须包含 "${n.includes}"`;if(n.format==="regex")return`无效字符串:必须满足正则表达式 ${n.pattern}`;return`无效${r[n.format]??a.format}`}case"not_multiple_of":return`无效数字:必须是 ${a.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${U(a.keys,", ")}`;case"invalid_key":return`${a.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${a.origin} 中包含无效值(value)`;default:return"无效输入"}}};function lS(){return{localeError:uS()}}var SS=()=>{let t={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function e(a){return t[a]??null}let s=(a)=>{let n=typeof a;switch(n){case"number":return Number.isNaN(a)?"NaN":"number";case"object":{if(Array.isArray(a))return"array";if(a===null)return"null";if(Object.getPrototypeOf(a)!==Object.prototype&&a.constructor)return a.constructor.name}}return n},r={regex:"輸入",email:"郵件地址",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 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return(a)=>{switch(a.code){case"invalid_type":return`無效的輸入值:預期為 ${a.expected},但收到 ${s(a.input)}`;case"invalid_value":if(a.values.length===1)return`無效的輸入值:預期為 ${yt(a.values[0])}`;return`無效的選項:預期為以下其中之一 ${U(a.values,"|")}`;case"too_big":{let n=a.inclusive?"<=":"<",i=e(a.origin);if(i)return`數值過大:預期 ${a.origin??"值"} 應為 ${n}${a.maximum.toString()} ${i.unit??"個元素"}`;return`數值過大:預期 ${a.origin??"值"} 應為 ${n}${a.maximum.toString()}`}case"too_small":{let n=a.inclusive?">=":">",i=e(a.origin);if(i)return`數值過小:預期 ${a.origin} 應為 ${n}${a.minimum.toString()} ${i.unit}`;return`數值過小:預期 ${a.origin} 應為 ${n}${a.minimum.toString()}`}case"invalid_format":{let n=a;if(n.format==="starts_with")return`無效的字串:必須以 "${n.prefix}" 開頭`;if(n.format==="ends_with")return`無效的字串:必須以 "${n.suffix}" 結尾`;if(n.format==="includes")return`無效的字串:必須包含 "${n.includes}"`;if(n.format==="regex")return`無效的字串:必須符合格式 ${n.pattern}`;return`無效的 ${r[n.format]??a.format}`}case"not_multiple_of":return`無效的數字:必須為 ${a.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${a.keys.length>1?"們":""}:${U(a.keys,"、")}`;case"invalid_key":return`${a.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${a.origin} 中有無效的值`;default:return"無效的輸入值"}}};function TS(){return{localeError:SS()}}var Jd=Symbol("ZodOutput"),Yd=Symbol("ZodInput");class h3{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...e){let s=e[0];if(this._map.set(t,s),s&&typeof s==="object"&&"id"in s){if(this._idmap.has(s.id))throw Error(`ID ${s.id} already exists in the registry`);this._idmap.set(s.id,t)}return this}remove(t){return this._map.delete(t),this}get(t){let e=t._zod.parent;if(e){let s={...this.get(e)??{}};return delete s.id,{...s,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function nn(){return new h3}var ie=nn();function Xd(t,e){return new t({type:"string",...H(e)})}function $d(t,e){return new t({type:"string",coerce:!0,...H(e)})}function hn(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...H(e)})}function Bs(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...H(e)})}function cn(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...H(e)})}function dn(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...H(e)})}function on(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...H(e)})}function yn(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...H(e)})}function mn(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...H(e)})}function pn(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...H(e)})}function En(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...H(e)})}function un(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...H(e)})}function ln(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...H(e)})}function Sn(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...H(e)})}function Tn(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...H(e)})}function kn(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...H(e)})}function fn(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...H(e)})}function xn(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...H(e)})}function Rn(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...H(e)})}function In(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...H(e)})}function vn(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...H(e)})}function Cn(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...H(e)})}function An(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...H(e)})}function bn(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...H(e)})}var to={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function eo(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...H(e)})}function ao(t,e){return new t({type:"string",format:"date",check:"string_format",...H(e)})}function so(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...H(e)})}function ro(t,e){return new t({type:"string",format:"duration",check:"string_format",...H(e)})}function no(t,e){return new t({type:"number",checks:[],...H(e)})}function io(t,e){return new t({type:"number",coerce:!0,checks:[],...H(e)})}function ho(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...H(e)})}function co(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...H(e)})}function oo(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...H(e)})}function yo(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...H(e)})}function mo(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...H(e)})}function po(t,e){return new t({type:"boolean",...H(e)})}function Eo(t,e){return new t({type:"boolean",coerce:!0,...H(e)})}function uo(t,e){return new t({type:"bigint",...H(e)})}function lo(t,e){return new t({type:"bigint",coerce:!0,...H(e)})}function So(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...H(e)})}function To(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...H(e)})}function ko(t,e){return new t({type:"symbol",...H(e)})}function fo(t,e){return new t({type:"undefined",...H(e)})}function xo(t,e){return new t({type:"null",...H(e)})}function Ro(t){return new t({type:"any"})}function Vs(t){return new t({type:"unknown"})}function Io(t,e){return new t({type:"never",...H(e)})}function vo(t,e){return new t({type:"void",...H(e)})}function Co(t,e){return new t({type:"date",...H(e)})}function Ao(t,e){return new t({type:"date",coerce:!0,...H(e)})}function bo(t,e){return new t({type:"nan",...H(e)})}function oe(t,e){return new Gr({check:"less_than",...H(e),value:t,inclusive:!1})}function Z0(t,e){return new Gr({check:"less_than",...H(e),value:t,inclusive:!0})}function ye(t,e){return new Wr({check:"greater_than",...H(e),value:t,inclusive:!1})}function m0(t,e){return new Wr({check:"greater_than",...H(e),value:t,inclusive:!0})}function Zo(t){return ye(0,t)}function go(t){return oe(0,t)}function Fo(t){return Z0(0,t)}function Mo(t){return m0(0,t)}function La(t,e){return new Z6({check:"multiple_of",...H(e),value:t})}function c3(t,e){return new M6({check:"max_size",...H(e),maximum:t})}function ja(t,e){return new P6({check:"min_size",...H(e),minimum:t})}function Zn(t,e){return new L6({check:"size_equals",...H(e),size:t})}function d3(t,e){return new j6({check:"max_length",...H(e),maximum:t})}function _e(t,e){return new q6({check:"min_length",...H(e),minimum:t})}function o3(t,e){return new _6({check:"length_equals",...H(e),length:t})}function gn(t,e){return new D6({check:"string_format",format:"regex",...H(e),pattern:t})}function Fn(t){return new B6({check:"string_format",format:"lowercase",...H(t)})}function Mn(t){return new V6({check:"string_format",format:"uppercase",...H(t)})}function Pn(t,e){return new N6({check:"string_format",format:"includes",...H(e),includes:t})}function Ln(t,e){return new w6({check:"string_format",format:"starts_with",...H(e),prefix:t})}function jn(t,e){return new K6({check:"string_format",format:"ends_with",...H(e),suffix:t})}function Po(t,e,s){return new H6({check:"property",property:t,schema:e,...H(s)})}function qn(t,e){return new O6({check:"mime_type",mime:t,...H(e)})}function le(t){return new U6({check:"overwrite",tx:t})}function _n(t){return le((e)=>e.normalize(t))}function Dn(){return le((t)=>t.trim())}function Bn(){return le((t)=>t.toLowerCase())}function Vn(){return le((t)=>t.toUpperCase())}function Nn(t,e,s){return new t({type:"array",element:e,...H(s)})}function kS(t,e,s){return new t({type:"union",options:e,...H(s)})}function fS(t,e,s,r){return new t({type:"union",options:s,discriminator:e,...H(r)})}function xS(t,e,s){return new t({type:"intersection",left:e,right:s})}function Lo(t,e,s,r){let a=s instanceof dt;return new t({type:"tuple",items:e,rest:a?s:null,...H(a?r:s)})}function RS(t,e,s,r){return new t({type:"record",keyType:e,valueType:s,...H(r)})}function IS(t,e,s,r){return new t({type:"map",keyType:e,valueType:s,...H(r)})}function vS(t,e,s){return new t({type:"set",valueType:e,...H(s)})}function CS(t,e,s){let r=Array.isArray(e)?Object.fromEntries(e.map((a)=>[a,a])):e;return new t({type:"enum",entries:r,...H(s)})}function AS(t,e,s){return new t({type:"enum",entries:e,...H(s)})}function bS(t,e,s){return new t({type:"literal",values:Array.isArray(e)?e:[e],...H(s)})}function jo(t,e){return new t({type:"file",...H(e)})}function ZS(t,e){return new t({type:"transform",transform:e})}function gS(t,e){return new t({type:"optional",innerType:e})}function FS(t,e){return new t({type:"nullable",innerType:e})}function MS(t,e,s){return new t({type:"default",innerType:e,get defaultValue(){return typeof s==="function"?s():s}})}function PS(t,e,s){return new t({type:"nonoptional",innerType:e,...H(s)})}function LS(t,e){return new t({type:"success",innerType:e})}function jS(t,e,s){return new t({type:"catch",innerType:e,catchValue:typeof s==="function"?s:()=>s})}function qS(t,e,s){return new t({type:"pipe",in:e,out:s})}function _S(t,e){return new t({type:"readonly",innerType:e})}function DS(t,e,s){return new t({type:"template_literal",parts:e,...H(s)})}function BS(t,e){return new t({type:"lazy",getter:e})}function VS(t,e){return new t({type:"promise",innerType:e})}function qo(t,e,s){let r=H(s);return r.abort??(r.abort=!0),new t({type:"custom",check:"custom",fn:e,...r})}function _o(t,e,s){return new t({type:"custom",check:"custom",fn:e,...H(s)})}function Do(t,e){let s=H(e),r=s.truthy??["true","1","yes","on","y","enabled"],a=s.falsy??["false","0","no","off","n","disabled"];if(s.case!=="sensitive")r=r.map((p)=>typeof p==="string"?p.toLowerCase():p),a=a.map((p)=>typeof p==="string"?p.toLowerCase():p);let n=new Set(r),i=new Set(a),h=t.Pipe??sn,c=t.Boolean??Yr,d=t.String??Na,E=new(t.Transform??an)({type:"transform",transform:(p,f)=>{let I=p;if(s.case!=="sensitive")I=I.toLowerCase();if(n.has(I))return!0;else if(i.has(I))return!1;else return f.issues.push({code:"invalid_value",expected:"stringbool",values:[...n,...i],input:f.value,inst:E}),{}},error:s.error}),l=new h({type:"pipe",in:new d({type:"string",error:s.error}),out:E,error:s.error});return new h({type:"pipe",in:l,out:new c({type:"boolean",error:s.error}),error:s.error})}function Bo(t,e,s,r={}){let a=H(r),n={...H(r),check:"string_format",type:"string",format:e,fn:typeof s==="function"?s:(i)=>s.test(i),...a};if(s instanceof RegExp)n.pattern=s;return new t(n)}class wn{constructor(t){this._def=t,this.def=t}implement(t){if(typeof t!=="function")throw Error("implement() must be called with a function");let e=(...s)=>{let r=this._def.input?qs(this._def.input,s,void 0,{callee:e}):s;if(!Array.isArray(r))throw Error("Invalid arguments schema: not an array or tuple schema.");let a=t(...r);return this._def.output?qs(this._def.output,a,void 0,{callee:e}):a};return e}implementAsync(t){if(typeof t!=="function")throw Error("implement() must be called with a function");let e=async(...s)=>{let r=this._def.input?await _s(this._def.input,s,void 0,{callee:e}):s;if(!Array.isArray(r))throw Error("Invalid arguments schema: not an array or tuple schema.");let a=await t(...r);return this._def.output?_s(this._def.output,a,void 0,{callee:e}):a};return e}input(...t){let e=this.constructor;if(Array.isArray(t[0]))return new e({type:"function",input:new i3({type:"tuple",items:t[0],rest:t[1]}),output:this._def.output});return new e({type:"function",input:t[0],output:this._def.output})}output(t){return new this.constructor({type:"function",input:this._def.input,output:t})}}function Vo(t){return new wn({type:"function",input:Array.isArray(t?.input)?Lo(i3,t?.input):t?.input??Nn($r,Vs(Ds)),output:t?.output??Vs(Ds)})}class Ns{constructor(t){this.counter=0,this.metadataRegistry=t?.metadata??ie,this.target=t?.target??"draft-2020-12",this.unrepresentable=t?.unrepresentable??"throw",this.override=t?.override??(()=>{}),this.io=t?.io??"output",this.seen=new Map}process(t,e={path:[],schemaPath:[]}){var s;let r=t._zod.def,a={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},n=this.seen.get(t);if(n){if(n.count++,e.schemaPath.includes(t))n.cycle=e.path;return n.schema}let i={schema:{},count:1,cycle:void 0,path:e.path};this.seen.set(t,i);let h=t._zod.toJSONSchema?.();if(h)i.schema=h;else{let d={...e,schemaPath:[...e.schemaPath,t],path:e.path},E=t._zod.parent;if(E)i.ref=E,this.process(E,d),this.seen.get(E).isParent=!0;else{let l=i.schema;switch(r.type){case"string":{let p=l;p.type="string";let{minimum:f,maximum:I,format:v,patterns:x,contentEncoding:o}=t._zod.bag;if(typeof f==="number")p.minLength=f;if(typeof I==="number")p.maxLength=I;if(v){if(p.format=a[v]??v,p.format==="")delete p.format}if(o)p.contentEncoding=o;if(x&&x.size>0){let u=[...x];if(u.length===1)p.pattern=u[0].source;else if(u.length>1)i.schema.allOf=[...u.map((y)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:y.source}))]}break}case"number":{let p=l,{minimum:f,maximum:I,format:v,multipleOf:x,exclusiveMaximum:o,exclusiveMinimum:u}=t._zod.bag;if(typeof v==="string"&&v.includes("int"))p.type="integer";else p.type="number";if(typeof u==="number")p.exclusiveMinimum=u;if(typeof f==="number"){if(p.minimum=f,typeof u==="number")if(u>=f)delete p.minimum;else delete p.exclusiveMinimum}if(typeof o==="number")p.exclusiveMaximum=o;if(typeof I==="number"){if(p.maximum=I,typeof o==="number")if(o<=I)delete p.maximum;else delete p.exclusiveMaximum}if(typeof x==="number")p.multipleOf=x;break}case"boolean":{let p=l;p.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{l.type="null";break}case"any":break;case"unknown":break;case"undefined":case"never":{l.not={};break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let p=l,{minimum:f,maximum:I}=t._zod.bag;if(typeof f==="number")p.minItems=f;if(typeof I==="number")p.maxItems=I;p.type="array",p.items=this.process(r.element,{...d,path:[...d.path,"items"]});break}case"object":{let p=l;p.type="object",p.properties={};let f=r.shape;for(let x in f)p.properties[x]=this.process(f[x],{...d,path:[...d.path,"properties",x]});let I=new Set(Object.keys(f)),v=new Set([...I].filter((x)=>{let o=r.shape[x]._zod;if(this.io==="input")return o.optin===void 0;else return o.optout===void 0}));if(v.size>0)p.required=Array.from(v);if(r.catchall?._zod.def.type==="never")p.additionalProperties=!1;else if(!r.catchall){if(this.io==="output")p.additionalProperties=!1}else if(r.catchall)p.additionalProperties=this.process(r.catchall,{...d,path:[...d.path,"additionalProperties"]});break}case"union":{let p=l;p.anyOf=r.options.map((f,I)=>this.process(f,{...d,path:[...d.path,"anyOf",I]}));break}case"intersection":{let p=l,f=this.process(r.left,{...d,path:[...d.path,"allOf",0]}),I=this.process(r.right,{...d,path:[...d.path,"allOf",1]}),v=(o)=>("allOf"in o)&&Object.keys(o).length===1,x=[...v(f)?f.allOf:[f],...v(I)?I.allOf:[I]];p.allOf=x;break}case"tuple":{let p=l;p.type="array";let f=r.items.map((x,o)=>this.process(x,{...d,path:[...d.path,"prefixItems",o]}));if(this.target==="draft-2020-12")p.prefixItems=f;else p.items=f;if(r.rest){let x=this.process(r.rest,{...d,path:[...d.path,"items"]});if(this.target==="draft-2020-12")p.items=x;else p.additionalItems=x}if(r.rest)p.items=this.process(r.rest,{...d,path:[...d.path,"items"]});let{minimum:I,maximum:v}=t._zod.bag;if(typeof I==="number")p.minItems=I;if(typeof v==="number")p.maxItems=v;break}case"record":{let p=l;p.type="object",p.propertyNames=this.process(r.keyType,{...d,path:[...d.path,"propertyNames"]}),p.additionalProperties=this.process(r.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let p=l,f=Pr(r.entries);if(f.every((I)=>typeof I==="number"))p.type="number";if(f.every((I)=>typeof I==="string"))p.type="string";p.enum=f;break}case"literal":{let p=l,f=[];for(let I of r.values)if(I===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof I==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else f.push(Number(I));else f.push(I);if(f.length===0);else if(f.length===1){let I=f[0];p.type=I===null?"null":typeof I,p.const=I}else{if(f.every((I)=>typeof I==="number"))p.type="number";if(f.every((I)=>typeof I==="string"))p.type="string";if(f.every((I)=>typeof I==="boolean"))p.type="string";if(f.every((I)=>I===null))p.type="null";p.enum=f}break}case"file":{let p=l,f={type:"string",format:"binary",contentEncoding:"binary"},{minimum:I,maximum:v,mime:x}=t._zod.bag;if(I!==void 0)f.minLength=I;if(v!==void 0)f.maxLength=v;if(x)if(x.length===1)f.contentMediaType=x[0],Object.assign(p,f);else p.anyOf=x.map((o)=>{return{...f,contentMediaType:o}});else Object.assign(p,f);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let p=this.process(r.innerType,d);l.anyOf=[p,{type:"null"}];break}case"nonoptional":{this.process(r.innerType,d),i.ref=r.innerType;break}case"success":{let p=l;p.type="boolean";break}case"default":{this.process(r.innerType,d),i.ref=r.innerType,l.default=JSON.parse(JSON.stringify(r.defaultValue));break}case"prefault":{if(this.process(r.innerType,d),i.ref=r.innerType,this.io==="input")l._prefault=JSON.parse(JSON.stringify(r.defaultValue));break}case"catch":{this.process(r.innerType,d),i.ref=r.innerType;let p;try{p=r.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}l.default=p;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let p=l,f=t._zod.pattern;if(!f)throw Error("Pattern not found in template literal");p.type="string",p.pattern=f.source;break}case"pipe":{let p=this.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;this.process(p,d),i.ref=p;break}case"readonly":{this.process(r.innerType,d),i.ref=r.innerType,l.readOnly=!0;break}case"promise":{this.process(r.innerType,d),i.ref=r.innerType;break}case"optional":{this.process(r.innerType,d),i.ref=r.innerType;break}case"lazy":{let p=t._zod.innerType;this.process(p,d),i.ref=p;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}default:}}}let c=this.metadataRegistry.get(t);if(c)Object.assign(i.schema,c);if(this.io==="input"&&wt(t))delete i.schema.examples,delete i.schema.default;if(this.io==="input"&&i.schema._prefault)(s=i.schema).default??(s.default=i.schema._prefault);return delete i.schema._prefault,this.seen.get(t).schema}emit(t,e){let s={cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0},r=this.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let a=(d)=>{let E=this.target==="draft-2020-12"?"$defs":"definitions";if(s.external){let f=s.external.registry.get(d[0])?.id;if(f)return{ref:s.external.uri(f)};let I=d[1].defId??d[1].schema.id??`schema${this.counter++}`;return d[1].defId=I,{defId:I,ref:`${s.external.uri("__shared")}#/${E}/${I}`}}if(d[1]===r)return{ref:"#"};let l=`#/${E}/`,p=d[1].schema.id??`__schema${this.counter++}`;return{defId:p,ref:l+p}},n=(d)=>{if(d[1].schema.$ref)return;let E=d[1],{ref:l,defId:p}=a(d);if(E.def={...E.schema},p)E.defId=p;let f=E.schema;for(let I in f)delete f[I];f.$ref=l};for(let d of this.seen.entries()){let E=d[1];if(t===d[0]){n(d);continue}if(s.external){let l=s.external.registry.get(d[0])?.id;if(t!==d[0]&&l){n(d);continue}}if(this.metadataRegistry.get(d[0])?.id){n(d);continue}if(E.cycle){if(s.cycles==="throw")throw Error(`Cycle detected: #/${E.cycle?.join("/")}/<root>
|
|
84
|
-
|
|
85
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);else if(s.cycles==="ref")n(d);continue}if(E.count>1){if(s.reused==="ref"){n(d);continue}}}let i=(d,E)=>{let l=this.seen.get(d),p=l.def??l.schema,f={...p};if(l.ref===null)return;let I=l.ref;if(l.ref=null,I){i(I,E);let v=this.seen.get(I).schema;if(v.$ref&&E.target==="draft-7")p.allOf=p.allOf??[],p.allOf.push(v);else Object.assign(p,v),Object.assign(p,f)}if(!l.isParent)this.override({zodSchema:d,jsonSchema:p,path:l.path??[]})};for(let d of[...this.seen.entries()].reverse())i(d[0],{target:this.target});let h={};if(this.target==="draft-2020-12")h.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")h.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);Object.assign(h,r.def);let c=s.external?.defs??{};for(let d of this.seen.entries()){let E=d[1];if(E.def&&E.defId)c[E.defId]=E.def}if(!s.external&&Object.keys(c).length>0)if(this.target==="draft-2020-12")h.$defs=c;else h.definitions=c;try{return JSON.parse(JSON.stringify(h))}catch(d){throw Error("Error converting schema to JSON.")}}}function No(t,e){if(t instanceof h3){let r=new Ns(e),a={};for(let h of t._idmap.entries()){let[c,d]=h;r.process(d)}let n={},i={registry:t,uri:e?.uri||((h)=>h),defs:a};for(let h of t._idmap.entries()){let[c,d]=h;n[c]=r.emit(d,{...e,external:i})}if(Object.keys(a).length>0){let h=r.target==="draft-2020-12"?"$defs":"definitions";n.__shared={[h]:a}}return{schemas:n}}let s=new Ns(e);return s.process(t),s.emit(t,e)}function wt(t,e){let s=e??{seen:new Set};if(s.seen.has(t))return!1;s.seen.add(t);let r=t._zod.def;switch(r.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return wt(r.element,s);case"object":{for(let a in r.shape)if(wt(r.shape[a],s))return!0;return!1}case"union":{for(let a of r.options)if(wt(a,s))return!0;return!1}case"intersection":return wt(r.left,s)||wt(r.right,s);case"tuple":{for(let a of r.items)if(wt(a,s))return!0;if(r.rest&&wt(r.rest,s))return!0;return!1}case"record":return wt(r.keyType,s)||wt(r.valueType,s);case"map":return wt(r.keyType,s)||wt(r.valueType,s);case"set":return wt(r.valueType,s);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return wt(r.innerType,s);case"lazy":return wt(r.getter(),s);case"default":return wt(r.innerType,s);case"prefault":return wt(r.innerType,s);case"custom":return!1;case"transform":return!0;case"pipe":return wt(r.in,s)||wt(r.out,s);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${r.type}`)}var NS={},wS=g("ZodMiniType",(t,e)=>{if(!t._zod)throw Error("Uninitialized schema in ZodMiniType.");dt.init(t,e),t.def=e,t.parse=(s,r)=>qs(t,s,r,{callee:t.parse}),t.safeParse=(s,r)=>wr(t,s,r),t.parseAsync=async(s,r)=>_s(t,s,r,{callee:t.parseAsync}),t.safeParseAsync=async(s,r)=>Hr(t,s,r),t.check=(...s)=>{return t.clone({...e,checks:[...e.checks??[],...s.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]})},t.clone=(s,r)=>P0(t,s,r),t.brand=()=>t,t.register=(s,r)=>{return s.add(t,r),t}}),ix=g("ZodMiniObject",(t,e)=>{tn.init(t,e),wS.init(t,e),Tt.defineLazy(t,"shape",()=>e.shape)});var Ae={};me(Ae,{xid:()=>e9,void:()=>R9,uuidv7:()=>zS,uuidv6:()=>WS,uuidv4:()=>GS,uuid:()=>US,url:()=>QS,uppercase:()=>Mn,unknown:()=>gt,union:()=>Ct,undefined:()=>f9,ulid:()=>t9,uint64:()=>T9,uint32:()=>u9,tuple:()=>A9,trim:()=>Dn,treeifyError:()=>Wc,transform:()=>Si,toUpperCase:()=>Vn,toLowerCase:()=>Bn,toJSONSchema:()=>No,templateLiteral:()=>q9,symbol:()=>k9,superRefine:()=>M4,success:()=>L9,stringbool:()=>B9,stringFormat:()=>y9,string:()=>q,strictObject:()=>C9,startsWith:()=>Ln,size:()=>Zn,setErrorMap:()=>w9,set:()=>g9,safeParseAsync:()=>Qo,safeParse:()=>zo,registry:()=>nn,regexes:()=>Or,regex:()=>gn,refine:()=>F4,record:()=>bt,readonly:()=>I4,property:()=>Po,promise:()=>_9,prettifyError:()=>Qc,preprocess:()=>xi,prefault:()=>l4,positive:()=>Zo,pipe:()=>Hs,partialRecord:()=>b9,parseAsync:()=>Wo,parse:()=>Go,overwrite:()=>le,optional:()=>Ft,object:()=>J,number:()=>vt,nullish:()=>P9,nullable:()=>Ks,null:()=>u3,normalize:()=>_n,nonpositive:()=>Fo,nonoptional:()=>S4,nonnegative:()=>Mo,never:()=>l3,negative:()=>go,nativeEnum:()=>F9,nanoid:()=>YS,nan:()=>j9,multipleOf:()=>La,minSize:()=>ja,minLength:()=>_e,mime:()=>qn,maxSize:()=>c3,maxLength:()=>d3,map:()=>Z9,lte:()=>Z0,lt:()=>oe,lowercase:()=>Fn,looseObject:()=>s0,locales:()=>rn,literal:()=>tt,length:()=>o3,lazy:()=>A4,ksuid:()=>a9,keyof:()=>v9,jwt:()=>o9,json:()=>V9,iso:()=>Kn,ipv6:()=>r9,ipv4:()=>s9,intersection:()=>T3,int64:()=>S9,int32:()=>E9,int:()=>X3,instanceof:()=>D9,includes:()=>Pn,guid:()=>OS,gte:()=>m0,gt:()=>ye,globalRegistry:()=>ie,getErrorMap:()=>K9,function:()=>Vo,formatError:()=>Dr,float64:()=>p9,float32:()=>m9,flattenError:()=>_r,file:()=>M9,enum:()=>h0,endsWith:()=>jn,emoji:()=>JS,email:()=>HS,e164:()=>d9,discriminatedUnion:()=>Ei,date:()=>I9,custom:()=>g4,cuid2:()=>$S,cuid:()=>XS,core:()=>jc,config:()=>n0,coerce:()=>P4,clone:()=>P0,cidrv6:()=>i9,cidrv4:()=>n9,check:()=>Z4,catch:()=>f4,boolean:()=>Kt,bigint:()=>l9,base64url:()=>c9,base64:()=>h9,array:()=>kt,any:()=>x9,_default:()=>E4,_ZodString:()=>Wn,ZodXID:()=>ei,ZodVoid:()=>s4,ZodUnknown:()=>e4,ZodUnion:()=>pi,ZodUndefined:()=>Xo,ZodUUID:()=>O0,ZodURL:()=>Qn,ZodULID:()=>ti,ZodType:()=>Et,ZodTuple:()=>h4,ZodTransform:()=>li,ZodTemplateLiteral:()=>v4,ZodSymbol:()=>Yo,ZodSuccess:()=>T4,ZodStringFormat:()=>Zt,ZodString:()=>y3,ZodSet:()=>d4,ZodRecord:()=>ui,ZodRealError:()=>wa,ZodReadonly:()=>R4,ZodPromise:()=>b4,ZodPrefault:()=>u4,ZodPipe:()=>fi,ZodOptional:()=>Ti,ZodObject:()=>S3,ZodNumberFormat:()=>Oe,ZodNumber:()=>m3,ZodNullable:()=>m4,ZodNull:()=>$o,ZodNonOptional:()=>ki,ZodNever:()=>a4,ZodNanoID:()=>Yn,ZodNaN:()=>x4,ZodMap:()=>c4,ZodLiteral:()=>o4,ZodLazy:()=>C4,ZodKSUID:()=>ai,ZodJWT:()=>oi,ZodIssueCode:()=>N9,ZodIntersection:()=>i4,ZodISOTime:()=>Un,ZodISODuration:()=>Gn,ZodISODateTime:()=>Hn,ZodISODate:()=>On,ZodIPv6:()=>ri,ZodIPv4:()=>si,ZodGUID:()=>ws,ZodFile:()=>y4,ZodError:()=>KS,ZodEnum:()=>qa,ZodEmoji:()=>Jn,ZodEmail:()=>zn,ZodE164:()=>di,ZodDiscriminatedUnion:()=>n4,ZodDefault:()=>p4,ZodDate:()=>mi,ZodCustomStringFormat:()=>Jo,ZodCustom:()=>k3,ZodCatch:()=>k4,ZodCUID2:()=>$n,ZodCUID:()=>Xn,ZodCIDRv6:()=>ii,ZodCIDRv4:()=>ni,ZodBoolean:()=>p3,ZodBigIntFormat:()=>yi,ZodBigInt:()=>E3,ZodBase64URL:()=>ci,ZodBase64:()=>hi,ZodArray:()=>r4,ZodAny:()=>t4,TimePrecision:()=>to,NEVER:()=>qc,$output:()=>Jd,$input:()=>Yd,$brand:()=>_c});var Kn={};me(Kn,{time:()=>Ho,duration:()=>Oo,datetime:()=>wo,date:()=>Ko,ZodISOTime:()=>Un,ZodISODuration:()=>Gn,ZodISODateTime:()=>Hn,ZodISODate:()=>On});var Hn=g("ZodISODateTime",(t,e)=>{rd.init(t,e),Zt.init(t,e)});function wo(t){return eo(Hn,t)}var On=g("ZodISODate",(t,e)=>{nd.init(t,e),Zt.init(t,e)});function Ko(t){return ao(On,t)}var Un=g("ZodISOTime",(t,e)=>{id.init(t,e),Zt.init(t,e)});function Ho(t){return so(Un,t)}var Gn=g("ZodISODuration",(t,e)=>{hd.init(t,e),Zt.init(t,e)});function Oo(t){return ro(Gn,t)}var Uo=(t,e)=>{qr.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:(s)=>Dr(t,s)},flatten:{value:(s)=>_r(t,s)},addIssue:{value:(s)=>t.issues.push(s)},addIssues:{value:(s)=>t.issues.push(...s)},isEmpty:{get(){return t.issues.length===0}}})},KS=g("ZodError",Uo),wa=g("ZodError",Uo,{Parent:Error}),Go=Br(wa),Wo=Vr(wa),zo=Nr(wa),Qo=Kr(wa),Et=g("ZodType",(t,e)=>{return dt.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...s)=>{return t.clone({...e,checks:[...e.checks??[],...s.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]})},t.clone=(s,r)=>P0(t,s,r),t.brand=()=>t,t.register=(s,r)=>{return s.add(t,r),t},t.parse=(s,r)=>Go(t,s,r,{callee:t.parse}),t.safeParse=(s,r)=>zo(t,s,r),t.parseAsync=async(s,r)=>Wo(t,s,r,{callee:t.parseAsync}),t.safeParseAsync=async(s,r)=>Qo(t,s,r),t.spa=t.safeParseAsync,t.refine=(s,r)=>t.check(F4(s,r)),t.superRefine=(s)=>t.check(M4(s)),t.overwrite=(s)=>t.check(le(s)),t.optional=()=>Ft(t),t.nullable=()=>Ks(t),t.nullish=()=>Ft(Ks(t)),t.nonoptional=(s)=>S4(t,s),t.array=()=>kt(t),t.or=(s)=>Ct([t,s]),t.and=(s)=>T3(t,s),t.transform=(s)=>Hs(t,Si(s)),t.default=(s)=>E4(t,s),t.prefault=(s)=>l4(t,s),t.catch=(s)=>f4(t,s),t.pipe=(s)=>Hs(t,s),t.readonly=()=>I4(t),t.describe=(s)=>{let r=t.clone();return ie.add(r,{description:s}),r},Object.defineProperty(t,"description",{get(){return ie.get(t)?.description},configurable:!0}),t.meta=(...s)=>{if(s.length===0)return ie.get(t);let r=t.clone();return ie.add(r,s[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t}),Wn=g("_ZodString",(t,e)=>{Na.init(t,e),Et.init(t,e);let s=t._zod.bag;t.format=s.format??null,t.minLength=s.minimum??null,t.maxLength=s.maximum??null,t.regex=(...r)=>t.check(gn(...r)),t.includes=(...r)=>t.check(Pn(...r)),t.startsWith=(...r)=>t.check(Ln(...r)),t.endsWith=(...r)=>t.check(jn(...r)),t.min=(...r)=>t.check(_e(...r)),t.max=(...r)=>t.check(d3(...r)),t.length=(...r)=>t.check(o3(...r)),t.nonempty=(...r)=>t.check(_e(1,...r)),t.lowercase=(r)=>t.check(Fn(r)),t.uppercase=(r)=>t.check(Mn(r)),t.trim=()=>t.check(Dn()),t.normalize=(...r)=>t.check(_n(...r)),t.toLowerCase=()=>t.check(Bn()),t.toUpperCase=()=>t.check(Vn())}),y3=g("ZodString",(t,e)=>{Na.init(t,e),Wn.init(t,e),t.email=(s)=>t.check(hn(zn,s)),t.url=(s)=>t.check(mn(Qn,s)),t.jwt=(s)=>t.check(bn(oi,s)),t.emoji=(s)=>t.check(pn(Jn,s)),t.guid=(s)=>t.check(Bs(ws,s)),t.uuid=(s)=>t.check(cn(O0,s)),t.uuidv4=(s)=>t.check(dn(O0,s)),t.uuidv6=(s)=>t.check(on(O0,s)),t.uuidv7=(s)=>t.check(yn(O0,s)),t.nanoid=(s)=>t.check(En(Yn,s)),t.guid=(s)=>t.check(Bs(ws,s)),t.cuid=(s)=>t.check(un(Xn,s)),t.cuid2=(s)=>t.check(ln($n,s)),t.ulid=(s)=>t.check(Sn(ti,s)),t.base64=(s)=>t.check(vn(hi,s)),t.base64url=(s)=>t.check(Cn(ci,s)),t.xid=(s)=>t.check(Tn(ei,s)),t.ksuid=(s)=>t.check(kn(ai,s)),t.ipv4=(s)=>t.check(fn(si,s)),t.ipv6=(s)=>t.check(xn(ri,s)),t.cidrv4=(s)=>t.check(Rn(ni,s)),t.cidrv6=(s)=>t.check(In(ii,s)),t.e164=(s)=>t.check(An(di,s)),t.datetime=(s)=>t.check(wo(s)),t.date=(s)=>t.check(Ko(s)),t.time=(s)=>t.check(Ho(s)),t.duration=(s)=>t.check(Oo(s))});function q(t){return Xd(y3,t)}var Zt=g("ZodStringFormat",(t,e)=>{At.init(t,e),Wn.init(t,e)}),zn=g("ZodEmail",(t,e)=>{Q6.init(t,e),Zt.init(t,e)});function HS(t){return hn(zn,t)}var ws=g("ZodGUID",(t,e)=>{W6.init(t,e),Zt.init(t,e)});function OS(t){return Bs(ws,t)}var O0=g("ZodUUID",(t,e)=>{z6.init(t,e),Zt.init(t,e)});function US(t){return cn(O0,t)}function GS(t){return dn(O0,t)}function WS(t){return on(O0,t)}function zS(t){return yn(O0,t)}var Qn=g("ZodURL",(t,e)=>{J6.init(t,e),Zt.init(t,e)});function QS(t){return mn(Qn,t)}var Jn=g("ZodEmoji",(t,e)=>{Y6.init(t,e),Zt.init(t,e)});function JS(t){return pn(Jn,t)}var Yn=g("ZodNanoID",(t,e)=>{X6.init(t,e),Zt.init(t,e)});function YS(t){return En(Yn,t)}var Xn=g("ZodCUID",(t,e)=>{$6.init(t,e),Zt.init(t,e)});function XS(t){return un(Xn,t)}var $n=g("ZodCUID2",(t,e)=>{td.init(t,e),Zt.init(t,e)});function $S(t){return ln($n,t)}var ti=g("ZodULID",(t,e)=>{ed.init(t,e),Zt.init(t,e)});function t9(t){return Sn(ti,t)}var ei=g("ZodXID",(t,e)=>{ad.init(t,e),Zt.init(t,e)});function e9(t){return Tn(ei,t)}var ai=g("ZodKSUID",(t,e)=>{sd.init(t,e),Zt.init(t,e)});function a9(t){return kn(ai,t)}var si=g("ZodIPv4",(t,e)=>{cd.init(t,e),Zt.init(t,e)});function s9(t){return fn(si,t)}var ri=g("ZodIPv6",(t,e)=>{dd.init(t,e),Zt.init(t,e)});function r9(t){return xn(ri,t)}var ni=g("ZodCIDRv4",(t,e)=>{od.init(t,e),Zt.init(t,e)});function n9(t){return Rn(ni,t)}var ii=g("ZodCIDRv6",(t,e)=>{yd.init(t,e),Zt.init(t,e)});function i9(t){return In(ii,t)}var hi=g("ZodBase64",(t,e)=>{md.init(t,e),Zt.init(t,e)});function h9(t){return vn(hi,t)}var ci=g("ZodBase64URL",(t,e)=>{Ed.init(t,e),Zt.init(t,e)});function c9(t){return Cn(ci,t)}var di=g("ZodE164",(t,e)=>{ud.init(t,e),Zt.init(t,e)});function d9(t){return An(di,t)}var oi=g("ZodJWT",(t,e)=>{Sd.init(t,e),Zt.init(t,e)});function o9(t){return bn(oi,t)}var Jo=g("ZodCustomStringFormat",(t,e)=>{Td.init(t,e),Zt.init(t,e)});function y9(t,e,s={}){return Bo(Jo,t,e,s)}var m3=g("ZodNumber",(t,e)=>{Jr.init(t,e),Et.init(t,e),t.gt=(r,a)=>t.check(ye(r,a)),t.gte=(r,a)=>t.check(m0(r,a)),t.min=(r,a)=>t.check(m0(r,a)),t.lt=(r,a)=>t.check(oe(r,a)),t.lte=(r,a)=>t.check(Z0(r,a)),t.max=(r,a)=>t.check(Z0(r,a)),t.int=(r)=>t.check(X3(r)),t.safe=(r)=>t.check(X3(r)),t.positive=(r)=>t.check(ye(0,r)),t.nonnegative=(r)=>t.check(m0(0,r)),t.negative=(r)=>t.check(oe(0,r)),t.nonpositive=(r)=>t.check(Z0(0,r)),t.multipleOf=(r,a)=>t.check(La(r,a)),t.step=(r,a)=>t.check(La(r,a)),t.finite=()=>t;let s=t._zod.bag;t.minValue=Math.max(s.minimum??Number.NEGATIVE_INFINITY,s.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(s.maximum??Number.POSITIVE_INFINITY,s.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(s.format??"").includes("int")||Number.isSafeInteger(s.multipleOf??0.5),t.isFinite=!0,t.format=s.format??null});function vt(t){return no(m3,t)}var Oe=g("ZodNumberFormat",(t,e)=>{kd.init(t,e),m3.init(t,e)});function X3(t){return ho(Oe,t)}function m9(t){return co(Oe,t)}function p9(t){return oo(Oe,t)}function E9(t){return yo(Oe,t)}function u9(t){return mo(Oe,t)}var p3=g("ZodBoolean",(t,e)=>{Yr.init(t,e),Et.init(t,e)});function Kt(t){return po(p3,t)}var E3=g("ZodBigInt",(t,e)=>{Xr.init(t,e),Et.init(t,e),t.gte=(r,a)=>t.check(m0(r,a)),t.min=(r,a)=>t.check(m0(r,a)),t.gt=(r,a)=>t.check(ye(r,a)),t.gte=(r,a)=>t.check(m0(r,a)),t.min=(r,a)=>t.check(m0(r,a)),t.lt=(r,a)=>t.check(oe(r,a)),t.lte=(r,a)=>t.check(Z0(r,a)),t.max=(r,a)=>t.check(Z0(r,a)),t.positive=(r)=>t.check(ye(BigInt(0),r)),t.negative=(r)=>t.check(oe(BigInt(0),r)),t.nonpositive=(r)=>t.check(Z0(BigInt(0),r)),t.nonnegative=(r)=>t.check(m0(BigInt(0),r)),t.multipleOf=(r,a)=>t.check(La(r,a));let s=t._zod.bag;t.minValue=s.minimum??null,t.maxValue=s.maximum??null,t.format=s.format??null});function l9(t){return uo(E3,t)}var yi=g("ZodBigIntFormat",(t,e)=>{fd.init(t,e),E3.init(t,e)});function S9(t){return So(yi,t)}function T9(t){return To(yi,t)}var Yo=g("ZodSymbol",(t,e)=>{xd.init(t,e),Et.init(t,e)});function k9(t){return ko(Yo,t)}var Xo=g("ZodUndefined",(t,e)=>{Rd.init(t,e),Et.init(t,e)});function f9(t){return fo(Xo,t)}var $o=g("ZodNull",(t,e)=>{Id.init(t,e),Et.init(t,e)});function u3(t){return xo($o,t)}var t4=g("ZodAny",(t,e)=>{vd.init(t,e),Et.init(t,e)});function x9(){return Ro(t4)}var e4=g("ZodUnknown",(t,e)=>{Ds.init(t,e),Et.init(t,e)});function gt(){return Vs(e4)}var a4=g("ZodNever",(t,e)=>{Cd.init(t,e),Et.init(t,e)});function l3(t){return Io(a4,t)}var s4=g("ZodVoid",(t,e)=>{Ad.init(t,e),Et.init(t,e)});function R9(t){return vo(s4,t)}var mi=g("ZodDate",(t,e)=>{bd.init(t,e),Et.init(t,e),t.min=(r,a)=>t.check(m0(r,a)),t.max=(r,a)=>t.check(Z0(r,a));let s=t._zod.bag;t.minDate=s.minimum?new Date(s.minimum):null,t.maxDate=s.maximum?new Date(s.maximum):null});function I9(t){return Co(mi,t)}var r4=g("ZodArray",(t,e)=>{$r.init(t,e),Et.init(t,e),t.element=e.element,t.min=(s,r)=>t.check(_e(s,r)),t.nonempty=(s)=>t.check(_e(1,s)),t.max=(s,r)=>t.check(d3(s,r)),t.length=(s,r)=>t.check(o3(s,r)),t.unwrap=()=>t.element});function kt(t,e){return Nn(r4,t,e)}function v9(t){let e=t._zod.def.shape;return tt(Object.keys(e))}var S3=g("ZodObject",(t,e)=>{tn.init(t,e),Et.init(t,e),Tt.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>h0(Object.keys(t._zod.def.shape)),t.catchall=(s)=>t.clone({...t._zod.def,catchall:s}),t.passthrough=()=>t.clone({...t._zod.def,catchall:gt()}),t.loose=()=>t.clone({...t._zod.def,catchall:gt()}),t.strict=()=>t.clone({...t._zod.def,catchall:l3()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=(s)=>{return Tt.extend(t,s)},t.merge=(s)=>Tt.merge(t,s),t.pick=(s)=>Tt.pick(t,s),t.omit=(s)=>Tt.omit(t,s),t.partial=(...s)=>Tt.partial(Ti,t,s[0]),t.required=(...s)=>Tt.required(ki,t,s[0])});function J(t,e){let s={type:"object",get shape(){return Tt.assignProp(this,"shape",{...t}),this.shape},...Tt.normalizeParams(e)};return new S3(s)}function C9(t,e){return new S3({type:"object",get shape(){return Tt.assignProp(this,"shape",{...t}),this.shape},catchall:l3(),...Tt.normalizeParams(e)})}function s0(t,e){return new S3({type:"object",get shape(){return Tt.assignProp(this,"shape",{...t}),this.shape},catchall:gt(),...Tt.normalizeParams(e)})}var pi=g("ZodUnion",(t,e)=>{en.init(t,e),Et.init(t,e),t.options=e.options});function Ct(t,e){return new pi({type:"union",options:t,...Tt.normalizeParams(e)})}var n4=g("ZodDiscriminatedUnion",(t,e)=>{pi.init(t,e),Zd.init(t,e)});function Ei(t,e,s){return new n4({type:"union",options:e,discriminator:t,...Tt.normalizeParams(s)})}var i4=g("ZodIntersection",(t,e)=>{gd.init(t,e),Et.init(t,e)});function T3(t,e){return new i4({type:"intersection",left:t,right:e})}var h4=g("ZodTuple",(t,e)=>{i3.init(t,e),Et.init(t,e),t.rest=(s)=>t.clone({...t._zod.def,rest:s})});function A9(t,e,s){let r=e instanceof dt,a=r?s:e;return new h4({type:"tuple",items:t,rest:r?e:null,...Tt.normalizeParams(a)})}var ui=g("ZodRecord",(t,e)=>{Fd.init(t,e),Et.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function bt(t,e,s){return new ui({type:"record",keyType:t,valueType:e,...Tt.normalizeParams(s)})}function b9(t,e,s){return new ui({type:"record",keyType:Ct([t,l3()]),valueType:e,...Tt.normalizeParams(s)})}var c4=g("ZodMap",(t,e)=>{Md.init(t,e),Et.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Z9(t,e,s){return new c4({type:"map",keyType:t,valueType:e,...Tt.normalizeParams(s)})}var d4=g("ZodSet",(t,e)=>{Pd.init(t,e),Et.init(t,e),t.min=(...s)=>t.check(ja(...s)),t.nonempty=(s)=>t.check(ja(1,s)),t.max=(...s)=>t.check(c3(...s)),t.size=(...s)=>t.check(Zn(...s))});function g9(t,e){return new d4({type:"set",valueType:t,...Tt.normalizeParams(e)})}var qa=g("ZodEnum",(t,e)=>{Ld.init(t,e),Et.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let s=new Set(Object.keys(e.entries));t.extract=(r,a)=>{let n={};for(let i of r)if(s.has(i))n[i]=e.entries[i];else throw Error(`Key ${i} not found in enum`);return new qa({...e,checks:[],...Tt.normalizeParams(a),entries:n})},t.exclude=(r,a)=>{let n={...e.entries};for(let i of r)if(s.has(i))delete n[i];else throw Error(`Key ${i} not found in enum`);return new qa({...e,checks:[],...Tt.normalizeParams(a),entries:n})}});function h0(t,e){let s=Array.isArray(t)?Object.fromEntries(t.map((r)=>[r,r])):t;return new qa({type:"enum",entries:s,...Tt.normalizeParams(e)})}function F9(t,e){return new qa({type:"enum",entries:t,...Tt.normalizeParams(e)})}var o4=g("ZodLiteral",(t,e)=>{jd.init(t,e),Et.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function tt(t,e){return new o4({type:"literal",values:Array.isArray(t)?t:[t],...Tt.normalizeParams(e)})}var y4=g("ZodFile",(t,e)=>{qd.init(t,e),Et.init(t,e),t.min=(s,r)=>t.check(ja(s,r)),t.max=(s,r)=>t.check(c3(s,r)),t.mime=(s,r)=>t.check(qn(Array.isArray(s)?s:[s],r))});function M9(t){return jo(y4,t)}var li=g("ZodTransform",(t,e)=>{an.init(t,e),Et.init(t,e),t._zod.parse=(s,r)=>{s.addIssue=(n)=>{if(typeof n==="string")s.issues.push(Tt.issue(n,s.value,e));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=s.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),s.issues.push(Tt.issue(i))}};let a=e.transform(s.value,s);if(a instanceof Promise)return a.then((n)=>{return s.value=n,s});return s.value=a,s}});function Si(t){return new li({type:"transform",transform:t})}var Ti=g("ZodOptional",(t,e)=>{_d.init(t,e),Et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ft(t){return new Ti({type:"optional",innerType:t})}var m4=g("ZodNullable",(t,e)=>{Dd.init(t,e),Et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ks(t){return new m4({type:"nullable",innerType:t})}function P9(t){return Ft(Ks(t))}var p4=g("ZodDefault",(t,e)=>{Bd.init(t,e),Et.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function E4(t,e){return new p4({type:"default",innerType:t,get defaultValue(){return typeof e==="function"?e():e}})}var u4=g("ZodPrefault",(t,e)=>{Vd.init(t,e),Et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function l4(t,e){return new u4({type:"prefault",innerType:t,get defaultValue(){return typeof e==="function"?e():e}})}var ki=g("ZodNonOptional",(t,e)=>{Nd.init(t,e),Et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function S4(t,e){return new ki({type:"nonoptional",innerType:t,...Tt.normalizeParams(e)})}var T4=g("ZodSuccess",(t,e)=>{wd.init(t,e),Et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function L9(t){return new T4({type:"success",innerType:t})}var k4=g("ZodCatch",(t,e)=>{Kd.init(t,e),Et.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function f4(t,e){return new k4({type:"catch",innerType:t,catchValue:typeof e==="function"?e:()=>e})}var x4=g("ZodNaN",(t,e)=>{Hd.init(t,e),Et.init(t,e)});function j9(t){return bo(x4,t)}var fi=g("ZodPipe",(t,e)=>{sn.init(t,e),Et.init(t,e),t.in=e.in,t.out=e.out});function Hs(t,e){return new fi({type:"pipe",in:t,out:e})}var R4=g("ZodReadonly",(t,e)=>{Od.init(t,e),Et.init(t,e)});function I4(t){return new R4({type:"readonly",innerType:t})}var v4=g("ZodTemplateLiteral",(t,e)=>{Ud.init(t,e),Et.init(t,e)});function q9(t,e){return new v4({type:"template_literal",parts:t,...Tt.normalizeParams(e)})}var C4=g("ZodLazy",(t,e)=>{Wd.init(t,e),Et.init(t,e),t.unwrap=()=>t._zod.def.getter()});function A4(t){return new C4({type:"lazy",getter:t})}var b4=g("ZodPromise",(t,e)=>{Gd.init(t,e),Et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function _9(t){return new b4({type:"promise",innerType:t})}var k3=g("ZodCustom",(t,e)=>{zd.init(t,e),Et.init(t,e)});function Z4(t,e){let s=new Bt({check:"custom",...Tt.normalizeParams(e)});return s._zod.check=t,s}function g4(t,e){return qo(k3,t??(()=>!0),e)}function F4(t,e={}){return _o(k3,t,e)}function M4(t,e){let s=Z4((r)=>{return r.addIssue=(a)=>{if(typeof a==="string")r.issues.push(Tt.issue(a,r.value,s._zod.def));else{let n=a;if(n.fatal)n.continue=!1;n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=s),n.continue??(n.continue=!s._zod.def.abort),r.issues.push(Tt.issue(n))}},t(r.value,r)},e);return s}function D9(t,e={error:`Input not instance of ${t.name}`}){let s=new k3({type:"custom",check:"custom",fn:(r)=>r instanceof t,abort:!0,...Tt.normalizeParams(e)});return s._zod.bag.Class=t,s}var B9=(...t)=>Do({Pipe:fi,Boolean:p3,String:y3,Transform:li},...t);function V9(t){let e=A4(()=>{return Ct([q(t),vt(),Kt(),u3(),kt(e),bt(q(),e)])});return e}function xi(t,e){return Hs(Si(t),e)}var N9={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function w9(t){n0({customError:t})}function K9(){return n0().customError}var P4={};me(P4,{string:()=>H9,number:()=>O9,date:()=>W9,boolean:()=>U9,bigint:()=>G9});function H9(t){return $d(y3,t)}function O9(t){return io(m3,t)}function U9(t){return Eo(p3,t)}function G9(t){return lo(E3,t)}function W9(t){return Ao(mi,t)}n0(Qd());var z9="io.modelcontextprotocol/related-task",f3="2.0",Jt=g4((t)=>t!==null&&(typeof t==="object"||typeof t==="function")),L4=Ct([q(),vt().int()]),j4=q(),hx=s0({ttl:Ct([vt(),u3()]).optional(),pollInterval:vt().optional()}),Q9=J({ttl:vt().optional()}),J9=J({taskId:q()}),Ri=s0({progressToken:L4.optional(),[z9]:J9.optional()}),p0=J({_meta:Ri.optional()}),x3=p0.extend({task:Q9.optional()});var Yt=J({method:q(),params:p0.loose().optional()}),I0=J({_meta:Ri.optional()}),v0=J({method:q(),params:I0.loose().optional()}),Xt=s0({_meta:Ri.optional()}),R3=Ct([q(),vt().int()]),Y9=J({jsonrpc:tt(f3),id:R3,...Yt.shape}).strict();var X9=J({jsonrpc:tt(f3),...v0.shape}).strict();var q4=J({jsonrpc:tt(f3),id:R3,result:Xt}).strict();var Lh;(function(t){t[t.ConnectionClosed=-32000]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Lh||(Lh={}));var _4=J({jsonrpc:tt(f3),id:R3.optional(),error:J({code:vt().int(),message:q(),data:gt().optional()})}).strict();var cx=Ct([Y9,X9,q4,_4]),dx=Ct([q4,_4]),D4=Xt.strict(),$9=I0.extend({requestId:R3.optional(),reason:q().optional()}),B4=v0.extend({method:tt("notifications/cancelled"),params:$9}),tT=J({src:q(),mimeType:q().optional(),sizes:kt(q()).optional(),theme:h0(["light","dark"]).optional()}),Ka=J({icons:kt(tT).optional()}),De=J({name:q(),title:q().optional()}),V4=De.extend({...De.shape,...Ka.shape,version:q(),websiteUrl:q().optional(),description:q().optional()}),eT=T3(J({applyDefaults:Kt().optional()}),bt(q(),gt())),aT=xi((t)=>{if(t&&typeof t==="object"&&!Array.isArray(t)){if(Object.keys(t).length===0)return{form:{}}}return t},T3(J({form:eT.optional(),url:Jt.optional()}),bt(q(),gt()).optional())),sT=s0({list:Jt.optional(),cancel:Jt.optional(),requests:s0({sampling:s0({createMessage:Jt.optional()}).optional(),elicitation:s0({create:Jt.optional()}).optional()}).optional()}),rT=s0({list:Jt.optional(),cancel:Jt.optional(),requests:s0({tools:s0({call:Jt.optional()}).optional()}).optional()}),nT=J({experimental:bt(q(),Jt).optional(),sampling:J({context:Jt.optional(),tools:Jt.optional()}).optional(),elicitation:aT.optional(),roots:J({listChanged:Kt().optional()}).optional(),tasks:sT.optional()}),iT=p0.extend({protocolVersion:q(),capabilities:nT,clientInfo:V4}),hT=Yt.extend({method:tt("initialize"),params:iT}),cT=J({experimental:bt(q(),Jt).optional(),logging:Jt.optional(),completions:Jt.optional(),prompts:J({listChanged:Kt().optional()}).optional(),resources:J({subscribe:Kt().optional(),listChanged:Kt().optional()}).optional(),tools:J({listChanged:Kt().optional()}).optional(),tasks:rT.optional()}),dT=Xt.extend({protocolVersion:q(),capabilities:cT,serverInfo:V4,instructions:q().optional()}),oT=v0.extend({method:tt("notifications/initialized"),params:I0.optional()}),N4=Yt.extend({method:tt("ping"),params:p0.optional()}),yT=J({progress:vt(),total:Ft(vt()),message:Ft(q())}),mT=J({...I0.shape,...yT.shape,progressToken:L4}),w4=v0.extend({method:tt("notifications/progress"),params:mT}),pT=p0.extend({cursor:j4.optional()}),Ha=Yt.extend({params:pT.optional()}),Oa=Xt.extend({nextCursor:j4.optional()}),ET=h0(["working","input_required","completed","failed","cancelled"]),Ua=J({taskId:q(),status:ET,ttl:Ct([vt(),u3()]),createdAt:q(),lastUpdatedAt:q(),pollInterval:Ft(vt()),statusMessage:Ft(q())}),K4=Xt.extend({task:Ua}),uT=I0.merge(Ua),H4=v0.extend({method:tt("notifications/tasks/status"),params:uT}),O4=Yt.extend({method:tt("tasks/get"),params:p0.extend({taskId:q()})}),U4=Xt.merge(Ua),G4=Yt.extend({method:tt("tasks/result"),params:p0.extend({taskId:q()})}),ox=Xt.loose(),W4=Ha.extend({method:tt("tasks/list")}),z4=Oa.extend({tasks:kt(Ua)}),Q4=Yt.extend({method:tt("tasks/cancel"),params:p0.extend({taskId:q()})}),yx=Xt.merge(Ua),J4=J({uri:q(),mimeType:Ft(q()),_meta:bt(q(),gt()).optional()}),Y4=J4.extend({text:q()}),Ii=q().refine((t)=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),X4=J4.extend({blob:Ii}),Ga=h0(["user","assistant"]),Ue=J({audience:kt(Ga).optional(),priority:vt().min(0).max(1).optional(),lastModified:Kn.datetime({offset:!0}).optional()}),$4=J({...De.shape,...Ka.shape,uri:q(),description:Ft(q()),mimeType:Ft(q()),annotations:Ue.optional(),_meta:Ft(s0({}))}),lT=J({...De.shape,...Ka.shape,uriTemplate:q(),description:Ft(q()),mimeType:Ft(q()),annotations:Ue.optional(),_meta:Ft(s0({}))}),ST=Ha.extend({method:tt("resources/list")}),TT=Oa.extend({resources:kt($4)}),kT=Ha.extend({method:tt("resources/templates/list")}),fT=Oa.extend({resourceTemplates:kt(lT)}),vi=p0.extend({uri:q()}),xT=vi,RT=Yt.extend({method:tt("resources/read"),params:xT}),IT=Xt.extend({contents:kt(Ct([Y4,X4]))}),vT=v0.extend({method:tt("notifications/resources/list_changed"),params:I0.optional()}),CT=vi,AT=Yt.extend({method:tt("resources/subscribe"),params:CT}),bT=vi,ZT=Yt.extend({method:tt("resources/unsubscribe"),params:bT}),gT=I0.extend({uri:q()}),FT=v0.extend({method:tt("notifications/resources/updated"),params:gT}),MT=J({name:q(),description:Ft(q()),required:Ft(Kt())}),PT=J({...De.shape,...Ka.shape,description:Ft(q()),arguments:Ft(kt(MT)),_meta:Ft(s0({}))}),LT=Ha.extend({method:tt("prompts/list")}),jT=Oa.extend({prompts:kt(PT)}),qT=p0.extend({name:q(),arguments:bt(q(),q()).optional()}),_T=Yt.extend({method:tt("prompts/get"),params:qT}),Ci=J({type:tt("text"),text:q(),annotations:Ue.optional(),_meta:bt(q(),gt()).optional()}),Ai=J({type:tt("image"),data:Ii,mimeType:q(),annotations:Ue.optional(),_meta:bt(q(),gt()).optional()}),bi=J({type:tt("audio"),data:Ii,mimeType:q(),annotations:Ue.optional(),_meta:bt(q(),gt()).optional()}),DT=J({type:tt("tool_use"),name:q(),id:q(),input:bt(q(),gt()),_meta:bt(q(),gt()).optional()}),BT=J({type:tt("resource"),resource:Ct([Y4,X4]),annotations:Ue.optional(),_meta:bt(q(),gt()).optional()}),VT=$4.extend({type:tt("resource_link")}),Zi=Ct([Ci,Ai,bi,VT,BT]),NT=J({role:Ga,content:Zi}),wT=Xt.extend({description:q().optional(),messages:kt(NT)}),KT=v0.extend({method:tt("notifications/prompts/list_changed"),params:I0.optional()}),HT=J({title:q().optional(),readOnlyHint:Kt().optional(),destructiveHint:Kt().optional(),idempotentHint:Kt().optional(),openWorldHint:Kt().optional()}),OT=J({taskSupport:h0(["required","optional","forbidden"]).optional()}),ty=J({...De.shape,...Ka.shape,description:q().optional(),inputSchema:J({type:tt("object"),properties:bt(q(),Jt).optional(),required:kt(q()).optional()}).catchall(gt()),outputSchema:J({type:tt("object"),properties:bt(q(),Jt).optional(),required:kt(q()).optional()}).catchall(gt()).optional(),annotations:HT.optional(),execution:OT.optional(),_meta:bt(q(),gt()).optional()}),UT=Ha.extend({method:tt("tools/list")}),GT=Oa.extend({tools:kt(ty)}),ey=Xt.extend({content:kt(Zi).default([]),structuredContent:bt(q(),gt()).optional(),isError:Kt().optional()}),mx=ey.or(Xt.extend({toolResult:gt()})),WT=x3.extend({name:q(),arguments:bt(q(),gt()).optional()}),zT=Yt.extend({method:tt("tools/call"),params:WT}),QT=v0.extend({method:tt("notifications/tools/list_changed"),params:I0.optional()}),px=J({autoRefresh:Kt().default(!0),debounceMs:vt().int().nonnegative().default(300)}),ay=h0(["debug","info","notice","warning","error","critical","alert","emergency"]),JT=p0.extend({level:ay}),YT=Yt.extend({method:tt("logging/setLevel"),params:JT}),XT=I0.extend({level:ay,logger:q().optional(),data:gt()}),$T=v0.extend({method:tt("notifications/message"),params:XT}),tk=J({name:q().optional()}),ek=J({hints:kt(tk).optional(),costPriority:vt().min(0).max(1).optional(),speedPriority:vt().min(0).max(1).optional(),intelligencePriority:vt().min(0).max(1).optional()}),ak=J({mode:h0(["auto","required","none"]).optional()}),sk=J({type:tt("tool_result"),toolUseId:q().describe("The unique identifier for the corresponding tool call."),content:kt(Zi).default([]),structuredContent:J({}).loose().optional(),isError:Kt().optional(),_meta:bt(q(),gt()).optional()}),rk=Ei("type",[Ci,Ai,bi]),Os=Ei("type",[Ci,Ai,bi,DT,sk]),nk=J({role:Ga,content:Ct([Os,kt(Os)]),_meta:bt(q(),gt()).optional()}),ik=x3.extend({messages:kt(nk),modelPreferences:ek.optional(),systemPrompt:q().optional(),includeContext:h0(["none","thisServer","allServers"]).optional(),temperature:vt().optional(),maxTokens:vt().int(),stopSequences:kt(q()).optional(),metadata:Jt.optional(),tools:kt(ty).optional(),toolChoice:ak.optional()}),hk=Yt.extend({method:tt("sampling/createMessage"),params:ik}),ck=Xt.extend({model:q(),stopReason:Ft(h0(["endTurn","stopSequence","maxTokens"]).or(q())),role:Ga,content:rk}),dk=Xt.extend({model:q(),stopReason:Ft(h0(["endTurn","stopSequence","maxTokens","toolUse"]).or(q())),role:Ga,content:Ct([Os,kt(Os)])}),ok=J({type:tt("boolean"),title:q().optional(),description:q().optional(),default:Kt().optional()}),yk=J({type:tt("string"),title:q().optional(),description:q().optional(),minLength:vt().optional(),maxLength:vt().optional(),format:h0(["email","uri","date","date-time"]).optional(),default:q().optional()}),mk=J({type:h0(["number","integer"]),title:q().optional(),description:q().optional(),minimum:vt().optional(),maximum:vt().optional(),default:vt().optional()}),pk=J({type:tt("string"),title:q().optional(),description:q().optional(),enum:kt(q()),default:q().optional()}),Ek=J({type:tt("string"),title:q().optional(),description:q().optional(),oneOf:kt(J({const:q(),title:q()})),default:q().optional()}),uk=J({type:tt("string"),title:q().optional(),description:q().optional(),enum:kt(q()),enumNames:kt(q()).optional(),default:q().optional()}),lk=Ct([pk,Ek]),Sk=J({type:tt("array"),title:q().optional(),description:q().optional(),minItems:vt().optional(),maxItems:vt().optional(),items:J({type:tt("string"),enum:kt(q())}),default:kt(q()).optional()}),Tk=J({type:tt("array"),title:q().optional(),description:q().optional(),minItems:vt().optional(),maxItems:vt().optional(),items:J({anyOf:kt(J({const:q(),title:q()}))}),default:kt(q()).optional()}),kk=Ct([Sk,Tk]),fk=Ct([uk,lk,kk]),xk=Ct([fk,ok,yk,mk]),Rk=x3.extend({mode:tt("form").optional(),message:q(),requestedSchema:J({type:tt("object"),properties:bt(q(),xk),required:kt(q()).optional()})}),Ik=x3.extend({mode:tt("url"),message:q(),elicitationId:q(),url:q().url()}),vk=Ct([Rk,Ik]),Ck=Yt.extend({method:tt("elicitation/create"),params:vk}),Ak=I0.extend({elicitationId:q()}),bk=v0.extend({method:tt("notifications/elicitation/complete"),params:Ak}),Zk=Xt.extend({action:h0(["accept","decline","cancel"]),content:xi((t)=>t===null?void 0:t,bt(q(),Ct([q(),vt(),Kt(),kt(q())])).optional())}),gk=J({type:tt("ref/resource"),uri:q()}),Fk=J({type:tt("ref/prompt"),name:q()}),Mk=p0.extend({ref:Ct([Fk,gk]),argument:J({name:q(),value:q()}),context:J({arguments:bt(q(),q()).optional()}).optional()}),Pk=Yt.extend({method:tt("completion/complete"),params:Mk});var Lk=Xt.extend({completion:s0({values:kt(q()).max(100),total:Ft(vt().int()),hasMore:Ft(Kt())})}),jk=J({uri:q().startsWith("file://"),name:q().optional(),_meta:bt(q(),gt()).optional()}),qk=Yt.extend({method:tt("roots/list"),params:p0.optional()}),_k=Xt.extend({roots:kt(jk)}),Dk=v0.extend({method:tt("notifications/roots/list_changed"),params:I0.optional()}),Ex=Ct([N4,hT,Pk,YT,_T,LT,ST,kT,RT,AT,ZT,zT,UT,O4,G4,W4,Q4]),ux=Ct([B4,w4,oT,Dk,H4]),lx=Ct([D4,ck,dk,Zk,_k,U4,z4,K4]),Sx=Ct([N4,hk,Ck,qk,O4,G4,W4,Q4]),Tx=Ct([B4,w4,$T,FT,vT,QT,KT,H4,bk]),kx=Ct([D4,dT,Lk,wT,jT,TT,fT,IT,ey,GT,U4,z4,K4]);var fx=Symbol("Let zodToJsonSchema decide on which parser to use");var xx=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var Rx=Dh(Oh(),1),Ix=Dh(u8(),1);var jh;(function(t){t.Completable="McpCompletable"})(jh||(jh={}));function Bk(t){let e;return()=>e??=t()}var qh=15000,Vk=Bk(()=>Ae.object({session_id:Ae.string(),ws_url:Ae.string(),work_dir:Ae.string().optional(),session_key:Ae.string().optional()}));class Y0 extends Error{constructor(t){super(t);this.name="DirectConnectError"}}class Nk{options;ws;sessionId;workDir;abortController;readyState=!1;closed=!1;exitError;messages=new gr;readyPromise;readyResolve;readyReject;abortHandler;partialChunks=[];constructor(t){this.options=t,this.abortController=t.abortController??new AbortController,this.readyPromise=new Promise((e,s)=>{this.readyResolve=e,this.readyReject=s}),this.readyPromise.catch(()=>{}),this.initialize()}get ready(){return this.readyPromise}getSessionId(){return this.sessionId}getWorkDir(){return this.workDir}async initialize(){if(this.abortController.signal.aborted){this.failInit(new j0("Connection aborted"));return}this.abortHandler=()=>{this.close(),this.exitError=new j0("Connection aborted by user")},this.abortController.signal.addEventListener("abort",this.abortHandler);let t;try{let a=await wk(this.options);this.sessionId=a.sessionId,this.workDir=a.workDir,t=a.wsUrl}catch(a){this.failInit(Yp(a));return}if(this.closed){if(this.options.deleteSessionOnClose&&this.sessionId)_h(this.options.serverUrl,this.sessionId,this.options.authToken);return}let e={};if(this.options.authToken)e.authorization=`Bearer ${this.options.authToken}`;let s=new WebSocket(t,{headers:e});this.ws=s;let r=setTimeout((a,n)=>{if(!a.readyState){n.close();let i=new Y0(`WebSocket connection timeout after ${qh}ms`);a.exitError=i,a.readyReject?.(i)}},qh,this,s);s.addEventListener("open",()=>{clearTimeout(r),this.readyState=!0,S0(`[DirectConnectTransport] Connected to ${this.options.serverUrl}, session=${this.sessionId}`),this.readyResolve?.()}),s.addEventListener("message",(a)=>{let n=typeof a.data==="string"?a.data:"";if(n.indexOf(`
|
|
86
|
-
`)===-1){if(n)this.partialChunks.push(n);return}let i=this.partialChunks.join("")+n;this.partialChunks.length=0;let h=i.split(`
|
|
87
|
-
`),c=h.pop()??"";if(c)this.partialChunks.push(c);for(let d of h){if(!d)continue;let E;try{E=Zr(d)}catch(l){S0(`DirectConnect: dropped malformed JSON line (${d.length} bytes): ${l}`);continue}this.messages.enqueue(E)}}),s.addEventListener("error",()=>{clearTimeout(r);let a=new Y0("WebSocket connection error");this.exitError=a,this.readyReject?.(a),this.messages.done()}),s.addEventListener("close",(a)=>{if(this.readyState=!1,this.closed=!0,a.code!==1000&&a.code!==1001&&!this.exitError)this.exitError=new Y0(`WebSocket closed abnormally: ${a.code} ${a.reason}`);this.messages.done()})}failInit(t){this.exitError=t,this.closed=!0,this.readyReject?.(t),this.messages.done()}async write(t){if(this.abortController.signal.aborted)throw new j0("Operation aborted");if(!this.readyState)await this.readyPromise;if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Y0("Transport is not ready for writing");this.ws.send(t)}isReady(){return this.readyState&&this.ws?.readyState===WebSocket.OPEN}endInput(){}close(){if(this.closed)return;if(this.closed=!0,this.readyState=!1,this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;if(!this.abortController.signal.aborted)this.abortController.abort();if(this.ws&&this.ws.readyState===WebSocket.OPEN)this.ws.close(1000,"Normal closure");if(this.messages.done(),this.options.deleteSessionOnClose&&this.sessionId)_h(this.options.serverUrl,this.sessionId,this.options.authToken)}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}async function wk(t){let e={"content-type":"application/json"};if(t.authToken)e.authorization=`Bearer ${t.authToken}`;let s={};if(t.cwd)s.cwd=t.cwd;if(t.sessionKey)s.session_key=t.sessionKey;if(t.permissionMode)s.permission_mode=t.permissionMode;let r;try{r=await fetch(`${t.serverUrl}/sessions`,{method:"POST",headers:e,body:T0(s)})}catch(n){throw new Y0(`Failed to connect to server at ${t.serverUrl}: ${n instanceof Error?n.message:String(n)}`)}if(!r.ok){let n=await r.text().catch(()=>"");throw new Y0(`Failed to create session: ${r.status} ${r.statusText}${n?` — ${n}`:""}`)}let a=Vk().safeParse(await r.json());if(!a.success)throw new Y0(`Invalid session response: ${a.error.message}`);return{sessionId:a.data.session_id,wsUrl:a.data.ws_url,workDir:a.data.work_dir}}async function _h(t,e,s){let r={};if(s)r.authorization=`Bearer ${s}`;try{await fetch(`${t}/sessions/${e}`,{method:"DELETE",headers:r})}catch{}}function Kk(t,e){let{systemPrompt:s,settings:r,settingSources:a,sandbox:n,...i}=t??{},h,c;if(s===void 0)h="";else if(typeof s==="string")h=s;else if(s.type==="preset")c=s.append;let d=i.pathToClaudeCodeExecutable;if(!d){let L0=S8(import.meta.url),A0=l8(L0),We=UE((za)=>A0.resolve(za));if(We)d=We;else try{d=A0.resolve("./cli.js")}catch{throw Error(`Native CLI binary for ${process.platform}-${process.arch} not found. Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, or set options.pathToClaudeCodeExecutable.`)}}process.env.CLAUDE_AGENT_SDK_VERSION="0.2.96";let{abortController:E=Uh(),additionalDirectories:l=[],agent:p,agents:f,allowedTools:I=[],betas:v,canUseTool:x,continue:o,cwd:u,debug:y,debugFile:m,disallowedTools:k=[],tools:T,env:R,executable:C=Gh()?"bun":"node",executableArgs:F=[],extraArgs:B={},fallbackModel:_,enableFileCheckpointing:N,toolConfig:O,forkSession:z,hooks:K,includeHookEvents:Mt,includePartialMessages:Ot,onElicitation:Ut,persistSession:St,thinking:Z,effort:L,maxThinkingTokens:V,maxTurns:S,maxBudgetUsd:b,taskBudget:P,mcpServers:X,model:at,outputFormat:lt,permissionMode:rt="default",allowDangerouslySkipPermissions:Pt=!1,permissionPromptToolName:C0,plugins:A,workload:j,resume:D,resumeSessionAt:et,sessionId:st,stderr:mt,strictMcpConfig:Wt}=i,$t=lt?.type==="json_schema"?lt.schema:void 0,Gt=R;if(!Gt)Gt={...process.env};if(!Gt.CLAUDE_CODE_ENTRYPOINT)Gt.CLAUDE_CODE_ENTRYPOINT="sdk-ts";if(N)Gt.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true";if(O?.askUserQuestion?.previewFormat)Gt.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=O.askUserQuestion.previewFormat;let zt={},Vt=new Map;if(X)for(let[L0,A0]of Object.entries(X))if(A0.type==="sdk"&&A0.instance)Vt.set(L0,A0.instance);else zt[L0]=A0;let E0;if(Z)switch(Z.type){case"adaptive":E0={type:"adaptive",display:Z.display};break;case"enabled":E0={type:"enabled",budgetTokens:Z.budgetTokens,display:Z.display};break;case"disabled":E0={type:"disabled"};break}else if(V!==void 0)E0=V===0?{type:"disabled"}:{type:"enabled",budgetTokens:V};let e0=new Zc({abortController:E,additionalDirectories:l,agent:p,betas:v,cwd:u,debug:y,debugFile:m,executable:C,executableArgs:F,extraArgs:j?{...B,workload:j}:B,pathToClaudeCodeExecutable:d,env:Gt,forkSession:z,stderr:mt,thinkingConfig:E0,effort:L,maxTurns:S,maxBudgetUsd:b,taskBudget:P,model:at,fallbackModel:_,jsonSchema:$t,permissionMode:rt,allowDangerouslySkipPermissions:Pt,permissionPromptToolName:C0,continueConversation:o,resume:D,resumeSessionAt:et,sessionId:st,settings:typeof r==="object"?T0(r):r,settingSources:a,allowedTools:I,disallowedTools:k,tools:T,mcpServers:zt,strictMcpConfig:Wt,canUseTool:!!x,hooks:!!K,includeHookEvents:Mt,includePartialMessages:Ot,persistSession:St,plugins:A,sandbox:n,spawnClaudeCodeProcess:i.spawnClaudeCodeProcess}),Ge={systemPrompt:h,appendSystemPrompt:c,agents:f,promptSuggestions:i.promptSuggestions,agentProgressSummaries:i.agentProgressSummaries};return{queryInstance:new Fc(e0,e,x,K,E,Vt,$t,Ge,Ut),transport:e0,abortController:E}}function Hk(t,e,s,r){if(typeof s==="string")e.write(T0({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:s}]},parent_tool_use_id:null})+`
|
|
88
|
-
`);else t.streamInput(s).catch((a)=>r.abort(a))}function sy({prompt:t,options:e}){let{queryInstance:s,transport:r,abortController:a}=Kk(e,typeof t==="string");return Hk(s,r,t,a),s}import{EventEmitter as Ok}from"events";import{hostname as ry}from"os";class gi extends Ok{url;alias;token;agent;resumeId;heartbeatInterval;reconnectDelay;heartbeatTimer;sseAbort;running=!1;constructor(t){super();if(this.url=t.url.replace(/\/$/,""),this.alias=t.alias,this.token=t.token,this.agent=t.agent||"sdk",this.resumeId=`sdk-${t.alias}-${Date.now().toString(36)}`,this.heartbeatInterval=t.heartbeatInterval??180000,this.reconnectDelay=t.reconnectDelay??3000,t.autoConnect!==!1)this.connect()}log(t){console.log(`[${new Date().toTimeString().slice(0,8)}] [commhub:${this.alias}] ${t}`)}async call(t,e){let s={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};if(this.token)s.Authorization=`Bearer ${this.token}`;let r=await(await fetch(`${this.url}/mcp`,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:Date.now(),method:"tools/call",params:{name:t,arguments:e}})})).text(),a=r.match(/data: (.+)/),n=a?JSON.parse(a[1]):JSON.parse(r),i=n?.result?.content?.[0]?.text;return i?JSON.parse(i):n}async connect(){if(this.running)return;this.running=!0,await this.status("idle"),this.log("registered"),this.heartbeatTimer=setInterval(()=>{this.status("idle").catch((t)=>this.log(`heartbeat failed: ${t.message}`))},this.heartbeatInterval),this.connectSSE()}async disconnect(){if(this.running=!1,this.sseAbort?.abort(),this.heartbeatTimer)clearInterval(this.heartbeatTimer);await this.status("offline").catch(()=>{}),this.log("disconnected")}async send(t,e,s="normal"){return this.call("send_task",{alias:t,task:e,priority:s,from_session:this.alias})}async message(t,e){return this.call("send_message",{alias:t,message:e,from_session:this.alias})}async reply(t,e,s="completed"){return this.call("reply",{task_id:t,text:e,status:s})}async status(t,e){return this.call("report_status",{resume_id:this.resumeId,alias:this.alias,status:t,server:ry(),hostname:ry(),agent:this.agent,project_dir:process.cwd(),...e})}async getAllStatus(){return this.call("get_all_status",{})}async broadcast(t,e){return this.call("broadcast",{message:t,filter_server:e?.server,filter_status:e?.status})}async connectSSE(){let t=encodeURIComponent(this.alias),e=`${this.url}/events/${t}`,s=this.reconnectDelay;while(this.running){try{this.sseAbort=new AbortController;let r={Accept:"text/event-stream"};if(this.token)r.Authorization=`Bearer ${this.token}`;let a=await fetch(e,{headers:r,signal:this.sseAbort.signal});if(!a.ok||!a.body){this.log(`SSE failed: ${a.status}`),await this.sleep(s),s=Math.min(s*1.5,60000);continue}s=this.reconnectDelay;let n=a.body.getReader(),i=new TextDecoder,h="";while(this.running){let{done:c,value:d}=await n.read();if(c)break;h+=i.decode(d,{stream:!0});let E=h.split(`
|
|
89
|
-
`);h=E.pop()||"";for(let l of E){if(!l.startsWith("data: "))continue;try{let p=JSON.parse(l.slice(6));if(p.type==="connected"){this.log("SSE connected"),this.emit("connected");continue}if(p.type==="new_task"||p.type==="new_message"||p.type==="broadcast")await this.processInbox()}catch{}}}}catch(r){if(r.name==="AbortError")break;this.emit("error",r),this.log(`SSE error: ${r.message}`)}if(this.running)this.emit("disconnected"),this.log(`SSE reconnecting in ${s/1000}s...`),await this.sleep(s),s=Math.min(s*1.5,60000)}}async processInbox(){try{let t=(await this.call("get_inbox",{alias:this.alias,limit:10}))?.messages||[];for(let e of t)await this.call("ack_inbox",{alias:this.alias,message_id:e.id}),this.log(`← ${e.from_session}: ${e.content.slice(0,60)}`),this.emit("task",e),this.emit("message",e)}catch(t){this.log(`inbox error: ${t.message}`)}}sleep(t){return new Promise((e)=>setTimeout(e,t))}}class I3{config;hub;running=!1;sessionId;log;constructor(t){this.config={model:"claude-sonnet-4-6",tools:[],maxTurns:5,heartbeatInterval:180000,runtime:"claude",...t},this.hub=new gi({url:t.hub,alias:t.alias,token:t.token,agent:"agent-node",heartbeatInterval:this.config.heartbeatInterval,autoConnect:!1}),this.log=t.log||((e)=>console.log(`[${new Date().toTimeString().slice(0,8)}] [${t.alias}] ${e}`))}async processTask(t){if(this.config.onTask){let a=await this.config.onTask(t);if(typeof a==="string")return a}if(this.config.runtime==="codex")return`[codex runtime 暂未实现] 收到: ${t.content.slice(0,100)}`;let e=`你是 ${this.config.alias},收到来自 ${t.from_session} 的任务:
|
|
90
|
-
|
|
91
|
-
${t.content}
|
|
92
|
-
|
|
93
|
-
执行完后简要汇报结果。`,s={model:this.config.model,tools:this.config.tools?.length?this.config.tools:[],maxTurns:this.config.maxTurns,permissionMode:"bypassPermissions",allowDangerouslySkipPermissions:!0,env:process.env,cwd:process.cwd(),stderr:(a)=>{if(a.trim())this.log(`[stderr] ${a.trim().slice(0,200)}`)}};if(this.config.systemPrompt)s.systemPrompt=this.config.systemPrompt;if(this.sessionId)s.resume=this.sessionId;let r="";try{for await(let a of sy({prompt:e,options:s})){if(a.type==="system"&&a.subtype==="init")this.sessionId=a.session_id;if(a.type==="result")r=a.subtype==="success"?a.result:`错误: ${a.result||a.error}`}}catch(a){r=`SDK 错误: ${a.message}`,this.log(`错误: ${a.message}`)}if(this.config.onResult)await this.config.onResult(t,r);return r}async start(){this.running=!0,this.log(`启动 | Hub: ${this.config.hub} | Model: ${this.config.model} | Runtime: ${this.config.runtime}`),await this.hub.connect(),this.log("已连接 CommHub"),this.hub.on("task",async(e)=>{let s=e.from_session||"hub";this.log(`← [${s}] ${e.content?.slice(0,60)}`),await this.hub.status("working",{task:e.content?.slice(0,50)});let r=await this.processTask(e);this.log(`→ [${s}] ${r?.slice(0,60)}`),await this.hub.send(s,`[${this.config.alias}] ${r?.slice(0,2000)}`),await this.hub.status("idle")});let t=async()=>{this.log("退出..."),this.running=!1,await this.hub.disconnect(),process.exit(0)};process.on("SIGINT",t),process.on("SIGTERM",t),await new Promise(()=>{})}async stop(){this.running=!1,await this.hub.disconnect(),this.log("已停止")}}var Mx=I3;import{readFileSync as Uk,existsSync as Gk}from"fs";import{join as v3}from"path";import{homedir as Wk}from"os";var iy=Wk(),Se=process.argv.slice(2),c0={};for(let t=0;t<Se.length;t++)if(Se[t].startsWith("--")&&t+1<Se.length)c0[Se[t].slice(2)]=Se[++t];else if(Se[t]==="-h"||Se[t]==="--help")console.log(`
|
|
2
|
+
import{query as c}from"@anthropic-ai/claude-agent-sdk";import{readFileSync as I,existsSync as L}from"fs";import{join as P}from"path";import{hostname as y,homedir as u}from"os";var T=u(),Y=process.argv.slice(2),q={};for(let z=0;z<Y.length;z++){if(Y[z]==="-h"||Y[z]==="--help")console.log(`
|
|
94
3
|
@sleep2agi/agent-node — AI Agent 节点,一行命令加入 CommHub 网络
|
|
95
4
|
|
|
96
5
|
用法:
|
|
97
6
|
npx @sleep2agi/agent-node --alias "我的Agent"
|
|
98
7
|
|
|
99
|
-
配置加载:
|
|
100
|
-
1. CLI 参数 (--hub, --model, ...)
|
|
101
|
-
2. 环境变量 (COMMHUB_URL, MODEL, ...)
|
|
102
|
-
3. .anet/profiles/<alias>.json (和 anet CLI 共享)
|
|
103
|
-
4. ~/.anet/config.json (全局 hub URL)
|
|
104
|
-
5. 默认值
|
|
105
|
-
|
|
106
8
|
选项:
|
|
107
9
|
--alias <name> Agent 别名 (必需)
|
|
108
|
-
--
|
|
10
|
+
--url <url> CommHub URL (default: http://127.0.0.1:9200)
|
|
11
|
+
--hub <url> 同 --url
|
|
109
12
|
--model <name> AI 模型 (default: claude-sonnet-4-6)
|
|
110
|
-
--
|
|
111
|
-
--tools <list> 可用工具,逗号分隔
|
|
13
|
+
--tools <list> 工具列表,逗号分隔 ("all" = 全部工具)
|
|
112
14
|
--max-turns <n> 每任务最大轮次 (default: 5)
|
|
15
|
+
--max-budget <usd> 每任务预算上限 (default: 无限制)
|
|
113
16
|
--prompt <text> 自定义 System Prompt
|
|
114
|
-
--
|
|
115
|
-
--
|
|
116
|
-
|
|
17
|
+
--config <path> 配置文件 (覆盖 .anet profile 自动查找)
|
|
18
|
+
-h, --help 帮助
|
|
19
|
+
`),process.exit(0);if(Y[z].startsWith("--")&&z+1<Y.length)q[Y[z].slice(2)]=Y[++z]}function w(z){if(!L(z))return null;try{return JSON.parse(I(z,"utf-8"))}catch{return null}}var Z={};if(q.config){let z=w(P(process.cwd(),q.config));if(z)Z=z,console.log(`[agent-node] 配置: ${q.config}`)}var F=q.alias||process.env.COMMHUB_ALIAS||process.env.ALIAS||Z.alias;if(!q.config&&F){let z=w(P(process.cwd(),".anet","profiles",`${F}.json`));if(z){if(Z={...z,...Z},console.log(`[agent-node] Profile: .anet/profiles/${F}.json`),z.env&&typeof z.env==="object"){for(let[Q,W]of Object.entries(z.env))if(!process.env[Q]&&typeof W==="string")process.env[Q]=W.replace(/^~/,T)}}}var b=w(P(T,".anet","config.json"));if(b?.hub&&!Z.hub)Z.hub=b.hub;if(!q.config&&!Object.keys(Z).length){let z=w(P(process.cwd(),".agent-node.json"));if(z)Z=z,console.log("[agent-node] 配置: .agent-node.json")}if(!F)console.error(`错误: 必须指定 --alias
|
|
20
|
+
用法: npx @sleep2agi/agent-node --alias "我的Agent"`),process.exit(1);var R=q.url||q.hub||process.env.COMMHUB_URL||Z.hub||"http://127.0.0.1:9200",h=q.model||process.env.MODEL||Z.model,C=["Read","Write","Edit","Bash","Glob","Grep","WebSearch","WebFetch"],E=q.tools||(Array.isArray(Z.tools)?Z.tools.join(","):Z.tools)||"",D=E==="all"?C:E.split(",").filter(Boolean),A=parseInt(q["max-turns"]||Z.flags?.maxTurns||Z.maxTurns||"5"),H=parseFloat(q["max-budget"]||Z.flags?.maxBudgetUsd||Z.maxBudgetUsd||"0"),U=q.prompt||Z.systemPrompt||"",k=process.env.COMMHUB_TOKEN||Z.token||"",$=(z)=>console.log(`[${new Date().toTimeString().slice(0,8)}] [${F}] ${z}`);async function X(z,Q){let W={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};if(k)W.Authorization=`Bearer ${k}`;let K=await(await fetch(`${R}/mcp`,{method:"POST",headers:W,body:JSON.stringify({jsonrpc:"2.0",id:Date.now(),method:"tools/call",params:{name:z,arguments:Q}})})).text(),V=K.match(/data: (.+)/),N=V?JSON.parse(V[1]):JSON.parse(K),j=N?.result?.content?.[0]?.text;return j?JSON.parse(j):N}var O=`sdk-${F}-${Date.now().toString(36)}`;async function S(){return X("report_status",{resume_id:O,alias:F,status:"idle",server:y(),hostname:y(),agent:"agent-node",project_dir:process.cwd()})}async function B(z,Q){return X("report_status",{resume_id:O,alias:F,status:z,task:Q})}async function d(){return(await X("get_inbox",{alias:F,limit:5}))?.messages||[]}async function p(z){return X("ack_inbox",{alias:F,message_id:z})}async function m(z,Q){return X("send_task",{alias:z,task:Q,priority:"normal",from_session:F})}var x;async function f(z,Q){$(`→ processing: ${z.slice(0,80)}`),await B("working",z.slice(0,200));let W=`你是 ${F},收到来自 ${Q} 的任务:
|
|
117
21
|
|
|
118
|
-
|
|
119
|
-
# 用 anet profile(推荐)
|
|
120
|
-
anet init profile 小明1号 --alias 小明1号
|
|
121
|
-
npx @sleep2agi/agent-node --alias 小明1号
|
|
22
|
+
${z}
|
|
122
23
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
ANTHROPIC_AUTH_TOKEN=sk-xxx \\
|
|
126
|
-
npx @sleep2agi/agent-node --alias "MiniMax马" --model MiniMax-M2.7
|
|
127
|
-
`),process.exit(0);function C3(t){if(!Gk(t))return null;try{return JSON.parse(Uk(t,"utf-8"))}catch{return null}}var Ht={};if(c0.config){let t=C3(v3(process.cwd(),c0.config));if(t)Ht=t,console.log(`[agent-node] 配置: ${c0.config}`)}var Wa=c0.alias||process.env.ALIAS||Ht.alias;if(!c0.config&&Wa){let t=v3(process.cwd(),".anet","profiles",`${Wa}.json`),e=C3(t);if(e){if(Ht={...e,...Ht},console.log(`[agent-node] Profile: .anet/profiles/${Wa}.json`),e.env&&typeof e.env==="object"){for(let[s,r]of Object.entries(e.env))if(!process.env[s]&&typeof r==="string")process.env[s]=r.replace(/^~/,iy)}}}var Fi=C3(v3(iy,".anet","config.json"));if(Fi){if(!Ht.hub&&Fi.hub)Ht.hub=Fi.hub}if(!c0.config&&Object.keys(Ht).length===0){let t=C3(v3(process.cwd(),".agent-node.json"));if(t)Ht=t,console.log("[agent-node] 配置: .agent-node.json (legacy)")}if(!Wa)console.error(`错误: 必须指定 --alias
|
|
128
|
-
用法: npx @sleep2agi/agent-node --alias "我的Agent"`),process.exit(1);var ny=c0.runtime||process.env.RUNTIME||Ht.runtime||"claude",zk=ny==="agent-sdk"?"claude":ny,Qk=c0.tools||(Array.isArray(Ht.tools)?Ht.tools.join(","):Ht.tools)||"",Jk={alias:Wa,hub:c0.hub||process.env.COMMHUB_URL||Ht.hub||"http://127.0.0.1:9200",model:c0.model||process.env.MODEL||Ht.model||"claude-sonnet-4-6",runtime:zk,tools:Qk.split(",").filter(Boolean),maxTurns:parseInt(c0["max-turns"]||Ht.flags?.maxTurns||Ht.maxTurns||"5"),systemPrompt:c0.prompt||Ht.systemPrompt||"",token:c0.token||process.env.COMMHUB_TOKEN||Ht.token,heartbeatInterval:parseInt(Ht.heartbeatInterval||"180000")},Yk=new I3(Jk);Yk.start().catch((t)=>{console.error(`[agent-node] 启动失败: ${t.message}`),process.exit(1)});
|
|
24
|
+
执行完后简要汇报结果。`,G={model:h||void 0,tools:D.length?D:void 0,maxTurns:A,permissionMode:"bypassPermissions",allowDangerouslySkipPermissions:!0,env:process.env,cwd:process.cwd(),stderr:(V)=>{if(V.trim())$(`[stderr] ${V.trim().slice(0,200)}`)},hooks:{PreToolUse:[{hooks:[async(V)=>{return $(`[tool] ${V.tool_name}(${JSON.stringify(V.tool_input).slice(0,80)})`),{continue:!0}}]}]}};if(H>0)G.maxBudgetUsd=H;if(U)G.systemPrompt=U;if(x)G.resume=x;let K="";try{for await(let V of c({prompt:W,options:G})){if(V.type==="system"&&V.subtype==="init")x=V.session_id;if(V.type==="result")K=V.subtype==="success"?V.result||"任务完成":`执行出错: ${V.error||V.result||"未知错误"}`}}catch(V){K=`SDK 错误: ${V.message}`,$(`✗ error: ${V.message}`)}return await B("idle"),K}async function n(){let z=await d();if(!z.length)return;for(let Q of z){let W=Q.from_session||"hub";$(`← [${W}] ${Q.content.slice(0,60)}`),await p(Q.id);let G=await f(Q.content,W);try{await m(W,`[${F}] ${G.slice(0,2000)}`),$(`→ replied to ${W}: ${G.slice(0,60)}`)}catch(K){$(`reply failed: ${K.message}`)}}}async function g(){let z=`${R}/events/${encodeURIComponent(F)}`,Q=3000;while(!0){$(`SSE connecting: ${z}`);try{let W=await fetch(z,{headers:{Accept:"text/event-stream","Cache-Control":"no-cache"}});if(!W.ok||!W.body){$(`SSE failed: ${W.status}`),await new Promise((N)=>setTimeout(N,Q)),Q=Math.min(Q*1.5,60000);continue}Q=3000;let G=W.body.getReader(),K=new TextDecoder,V="";while(!0){let{done:N,value:j}=await G.read();if(N)break;V+=K.decode(j,{stream:!0});let _=V.split(`
|
|
25
|
+
`);V=_.pop()||"";for(let v of _){if(!v.startsWith("data: "))continue;try{let J=JSON.parse(v.slice(6));if(J.type==="connected"){$("SSE connected");continue}if(["new_task","new_message","broadcast"].includes(J.type))$(`← SSE ${J.type} from=${J.from||"?"}`),await n()}catch{}}}}catch(W){$(`SSE error: ${W.message}`)}$(`SSE reconnecting (${Q/1000}s)...`),await new Promise((W)=>setTimeout(W,Q)),Q=Math.min(Q*1.5,60000)}}$(`启动 | Hub: ${R} | Model: ${h||"(default)"} | Tools: [${D.join(",")}]`);await S();$("已注册到 CommHub");setInterval(()=>B("idle").catch(()=>{}),180000);var M=async()=>{$("shutting down..."),await B("offline").catch(()=>{}),process.exit(0)};process.on("SIGINT",M);process.on("SIGTERM",M);g();
|