@agiflowai/agent-cli 0.0.8 → 0.0.10

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.
@@ -1,10 +1,30 @@
1
1
  #!/usr/bin/env node
2
- "use strict";const Ss=require("node:fs"),cs=require("node:os"),Is=require("node:path"),ue=require("path"),le=require("fs-extra"),Et=require("os");require("node:crypto");require("@inquirer/prompts");function zt(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const oe=zt(Ss),Os=zt(cs),Oe=zt(Is);var T;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},r.getValidEnumValues=n=>{const a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(const i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(T||(T={}));var At;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(At||(At={}));const h=T.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ie=r=>{switch(typeof r){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(r)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(r)?h.array:r===null?h.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?h.promise:typeof Map<"u"&&r instanceof Map?h.map:typeof Set<"u"&&r instanceof Set?h.set:typeof Date<"u"&&r instanceof Date?h.date:h.object;default:return h.unknown}},l=T.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"]),As=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class q extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],d++}}};return n(this),s}static assert(e){if(!(e instanceof q))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,T.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}q.create=r=>new q(r);const Ne=(r,e)=>{let t;switch(r.code){case l.invalid_type:r.received===h.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case l.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,T.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:t=`Unrecognized key(s) in object: ${T.joinValues(r.keys,", ")}`;break;case l.invalid_union:t="Invalid input";break;case l.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${T.joinValues(r.options)}`;break;case l.invalid_enum_value:t=`Invalid enum value. Expected ${T.joinValues(r.options)}, received '${r.received}'`;break;case l.invalid_arguments:t="Invalid function arguments";break;case l.invalid_return_type:t="Invalid function return type";break;case l.invalid_date:t="Invalid date";break;case l.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:T.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case l.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case l.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case l.custom:t="Invalid input";break;case l.invalid_intersection_types:t="Intersection results could not be merged";break;case l.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case l.not_finite:t="Number must be finite";break;default:t=e.defaultError,T.assertNever(r)}return{message:t}};let ls=Ne;function Ns(r){ls=r}function dt(){return ls}const ft=r=>{const{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const d=s.filter(u=>!!u).slice().reverse();for(const u of d)o=u(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},Rs=[];function f(r,e){const t=dt(),s=ft({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Ne?void 0:Ne].filter(n=>!!n)});r.common.issues.push(s)}class V{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return v;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,i=await n.value;s.push({key:a,value:i})}return V.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return v;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const v=Object.freeze({status:"aborted"}),Ie=r=>({status:"dirty",value:r}),G=r=>({status:"valid",value:r}),Nt=r=>r.status==="aborted",Rt=r=>r.status==="dirty",be=r=>r.status==="valid",Fe=r=>typeof Promise<"u"&&r instanceof Promise;var m;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));class se{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const qt=(r,e)=>{if(be(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new q(r.common.issues);return this._error=t,this._error}}};function w(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{const{message:d}=r;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:d??t??o.defaultError}},description:n}}class x{get description(){return this._def.description}_getType(e){return ie(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new V,ctx:{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Fe(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},n=this._parseSync({data:e,path:s.path,parent:s});return qt(s,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return be(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>be(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(Fe(n)?n:Promise.resolve(n));return qt(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:l.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new X({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ee.create(this,this._def)}nullable(){return pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Y.create(this)}promise(){return Ce.create(this,this._def)}or(e){return Ve.create([this,e],this._def)}and(e){return Be.create(this,e,this._def)}transform(e){return new X({...w(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new He({...w(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new Lt({typeName:_.ZodBranded,type:this,...w(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new We({...w(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Xe.create(this,e)}readonly(){return Ke.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Cs=/^c[^\s-]{8,}$/i,js=/^[0-9a-z]+$/,$s=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ms=/^[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,zs=/^[a-z0-9_-]{21}$/i,Ls=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Fs=/^[-+]?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)?)??$/,Ds=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ps="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let St;const Zs=/^(?:(?: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])$/,Vs=/^(?:(?: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])$/,Bs=/^(([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]))$/,Gs=/^(([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])$/,Us=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,us="((\\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])))",Js=new RegExp(`^${us}$`);function ds(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Hs(r){return new RegExp(`^${ds(r)}$`)}function fs(r){let e=`${us}T${ds(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ws(r,e){return!!((e==="v4"||!e)&&Zs.test(r)||(e==="v6"||!e)&&Bs.test(r))}function Ks(r,e){if(!Ls.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Ys(r,e){return!!((e==="v4"||!e)&&Vs.test(r)||(e==="v6"||!e)&&Gs.test(r))}class K extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){const a=this._getOrReturnCtx(e);return f(a,{code:l.invalid_type,expected:h.string,received:a.parsedType}),v}const s=new V;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?f(n,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&f(n,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Ds.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"email",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")St||(St=new RegExp(Ps,"u")),St.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"emoji",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Ms.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"uuid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")zs.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"nanoid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Cs.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")js.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid2",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")$s.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ulid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),f(n,{validation:"url",code:l.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"regex",code:l.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),f(n,{code:l.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),f(n,{code:l.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),f(n,{code:l.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?fs(a).test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:l.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Js.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:l.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Hs(a).test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:l.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Fs.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"duration",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Ws(e.data,a.version)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ip",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Ks(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"jwt",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Ys(e.data,a.version)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cidr",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Us.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"base64",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?qs.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"base64url",code:l.invalid_string,message:a.message}),s.dirty()):T.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:l.invalid_string,...m.errToObj(s)})}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...m.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new K({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new K({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new K({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}K.create=r=>new K({checks:[],typeName:_.ZodString,coerce:r?.coerce??!1,...w(r)});function Xs(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class de extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.number){const a=this._getOrReturnCtx(e);return f(a,{code:l.invalid_type,expected:h.number,received:a.parsedType}),v}let s;const n=new V;for(const a of this._def.checks)a.kind==="int"?T.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:l.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:l.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:l.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Xs(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),f(s,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:l.not_finite,message:a.message}),n.dirty()):T.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,n){return new de({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(n)}]})}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&T.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}de.create=r=>new de({checks:[],typeName:_.ZodNumber,coerce:r?.coerce||!1,...w(r)});class fe extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let s;const n=new V;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:l.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:l.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),f(s,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):T.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return f(t,{code:l.invalid_type,expected:h.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,n){return new fe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(n)}]})}_addCheck(e){return new fe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}fe.create=r=>new fe({checks:[],typeName:_.ZodBigInt,coerce:r?.coerce??!1,...w(r)});class De extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){const s=this._getOrReturnCtx(e);return f(s,{code:l.invalid_type,expected:h.boolean,received:s.parsedType}),v}return G(e.data)}}De.create=r=>new De({typeName:_.ZodBoolean,coerce:r?.coerce||!1,...w(r)});class we extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){const a=this._getOrReturnCtx(e);return f(a,{code:l.invalid_type,expected:h.date,received:a.parsedType}),v}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return f(a,{code:l.invalid_date}),v}const s=new V;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:l.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:l.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):T.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new we({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}we.create=r=>new we({checks:[],coerce:r?.coerce||!1,typeName:_.ZodDate,...w(r)});class ht extends x{_parse(e){if(this._getType(e)!==h.symbol){const s=this._getOrReturnCtx(e);return f(s,{code:l.invalid_type,expected:h.symbol,received:s.parsedType}),v}return G(e.data)}}ht.create=r=>new ht({typeName:_.ZodSymbol,...w(r)});class Pe extends x{_parse(e){if(this._getType(e)!==h.undefined){const s=this._getOrReturnCtx(e);return f(s,{code:l.invalid_type,expected:h.undefined,received:s.parsedType}),v}return G(e.data)}}Pe.create=r=>new Pe({typeName:_.ZodUndefined,...w(r)});class Ze extends x{_parse(e){if(this._getType(e)!==h.null){const s=this._getOrReturnCtx(e);return f(s,{code:l.invalid_type,expected:h.null,received:s.parsedType}),v}return G(e.data)}}Ze.create=r=>new Ze({typeName:_.ZodNull,...w(r)});class Re extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return G(e.data)}}Re.create=r=>new Re({typeName:_.ZodAny,...w(r)});class _e extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return G(e.data)}}_e.create=r=>new _e({typeName:_.ZodUnknown,...w(r)});class ce extends x{_parse(e){const t=this._getOrReturnCtx(e);return f(t,{code:l.invalid_type,expected:h.never,received:t.parsedType}),v}}ce.create=r=>new ce({typeName:_.ZodNever,...w(r)});class pt extends x{_parse(e){if(this._getType(e)!==h.undefined){const s=this._getOrReturnCtx(e);return f(s,{code:l.invalid_type,expected:h.void,received:s.parsedType}),v}return G(e.data)}}pt.create=r=>new pt({typeName:_.ZodVoid,...w(r)});class Y extends x{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.array)return f(t,{code:l.invalid_type,expected:h.array,received:t.parsedType}),v;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(f(t,{code:i?l.too_big:l.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(f(t,{code:l.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(f(t,{code:l.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new se(t,i,t.path,o)))).then(i=>V.mergeArray(s,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new se(t,i,t.path,o)));return V.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new Y({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new Y({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new Y({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}Y.create=(r,e)=>new Y({type:r,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...w(e)});function Se(r){if(r instanceof $){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=ee.create(Se(s))}return new $({...r._def,shape:()=>e})}else return r instanceof Y?new Y({...r._def,type:Se(r.element)}):r instanceof ee?ee.create(Se(r.unwrap())):r instanceof pe?pe.create(Se(r.unwrap())):r instanceof re?re.create(r.items.map(e=>Se(e))):r}class $ extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=T.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){const u=this._getOrReturnCtx(e);return f(u,{code:l.invalid_type,expected:h.object,received:u.parsedType}),v}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ce&&this._def.unknownKeys==="strip"))for(const u in n.data)i.includes(u)||o.push(u);const d=[];for(const u of i){const g=a[u],k=n.data[u];d.push({key:{status:"valid",value:u},value:g._parse(new se(n,k,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof ce){const u=this._def.unknownKeys;if(u==="passthrough")for(const g of o)d.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(u==="strict")o.length>0&&(f(n,{code:l.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const g of o){const k=n.data[g];d.push({key:{status:"valid",value:g},value:u._parse(new se(n,k,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const u=[];for(const g of d){const k=await g.key,j=await g.value;u.push({key:k,value:j,alwaysSet:g.alwaysSet})}return u}).then(u=>V.mergeObjectSync(s,u)):V.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new $({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:m.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new $({...this._def,unknownKeys:"strip"})}passthrough(){return new $({...this._def,unknownKeys:"passthrough"})}extend(e){return new $({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new $({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new $({...this._def,catchall:e})}pick(e){const t={};for(const s of T.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new $({...this._def,shape:()=>t})}omit(e){const t={};for(const s of T.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new $({...this._def,shape:()=>t})}deepPartial(){return Se(this)}partial(e){const t={};for(const s of T.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new $({...this._def,shape:()=>t})}required(e){const t={};for(const s of T.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof ee;)a=a._def.innerType;t[s]=a}return new $({...this._def,shape:()=>t})}keyof(){return hs(T.objectKeys(this.shape))}}$.create=(r,e)=>new $({shape:()=>r,unknownKeys:"strip",catchall:ce.create(),typeName:_.ZodObject,...w(e)});$.strictCreate=(r,e)=>new $({shape:()=>r,unknownKeys:"strict",catchall:ce.create(),typeName:_.ZodObject,...w(e)});$.lazycreate=(r,e)=>new $({shape:r,unknownKeys:"strip",catchall:ce.create(),typeName:_.ZodObject,...w(e)});class Ve extends x{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new q(o.ctx.common.issues));return f(t,{code:l.invalid_union,unionErrors:i}),v}if(t.common.async)return Promise.all(s.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const d of s){const u={...t,common:{...t.common,issues:[]},parent:null},g=d._parseSync({data:t.data,path:t.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(d=>new q(d));return f(t,{code:l.invalid_union,unionErrors:o}),v}}get options(){return this._def.options}}Ve.create=(r,e)=>new Ve({options:r,typeName:_.ZodUnion,...w(e)});const ae=r=>r instanceof Ue?ae(r.schema):r instanceof X?ae(r.innerType()):r instanceof qe?[r.value]:r instanceof he?r.options:r instanceof Je?T.objectValues(r.enum):r instanceof He?ae(r._def.innerType):r instanceof Pe?[void 0]:r instanceof Ze?[null]:r instanceof ee?[void 0,...ae(r.unwrap())]:r instanceof pe?[null,...ae(r.unwrap())]:r instanceof Lt||r instanceof Ke?ae(r.unwrap()):r instanceof We?ae(r._def.innerType):[];class _t extends x{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return f(t,{code:l.invalid_type,expected:h.object,received:t.parsedType}),v;const s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(f(t,{code:l.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),v)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const a of t){const i=ae(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new _t({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...w(s)})}}function Ct(r,e){const t=ie(r),s=ie(e);if(r===e)return{valid:!0,data:r};if(t===h.object&&s===h.object){const n=T.objectKeys(e),a=T.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};for(const o of a){const d=Ct(r[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(t===h.array&&s===h.array){if(r.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],d=Ct(i,o);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return t===h.date&&s===h.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Be extends x{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(Nt(a)||Nt(i))return v;const o=Ct(a.value,i.value);return o.valid?((Rt(a)||Rt(i))&&t.dirty(),{status:t.value,value:o.data}):(f(s,{code:l.invalid_intersection_types}),v)};return s.common.async?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,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Be.create=(r,e,t)=>new Be({left:r,right:e,typeName:_.ZodIntersection,...w(t)});class re extends x{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.array)return f(s,{code:l.invalid_type,expected:h.array,received:s.parsedType}),v;if(s.data.length<this._def.items.length)return f(s,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&s.data.length>this._def.items.length&&(f(s,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,o)=>{const d=this._def.items[o]||this._def.rest;return d?d._parse(new se(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>V.mergeArray(t,i)):V.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new re({...this._def,rest:e})}}re.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new re({items:r,typeName:_.ZodTuple,rest:null,...w(e)})};class Ge extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.object)return f(s,{code:l.invalid_type,expected:h.object,received:s.parsedType}),v;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:a._parse(new se(s,o,s.path,o)),value:i._parse(new se(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?V.mergeObjectAsync(t,n):V.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof x?new Ge({keyType:e,valueType:t,typeName:_.ZodRecord,...w(s)}):new Ge({keyType:K.create(),valueType:e,typeName:_.ZodRecord,...w(t)})}}class mt extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.map)return f(s,{code:l.invalid_type,expected:h.map,received:s.parsedType}),v;const n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,d],u)=>({key:n._parse(new se(s,o,s.path,[u,"key"])),value:a._parse(new se(s,d,s.path,[u,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of i){const u=await d.key,g=await d.value;if(u.status==="aborted"||g.status==="aborted")return v;(u.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(u.value,g.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const d of i){const u=d.key,g=d.value;if(u.status==="aborted"||g.status==="aborted")return v;(u.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(u.value,g.value)}return{status:t.value,value:o}}}}mt.create=(r,e,t)=>new mt({valueType:e,keyType:r,typeName:_.ZodMap,...w(t)});class xe extends x{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.set)return f(s,{code:l.invalid_type,expected:h.set,received:s.parsedType}),v;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(f(s,{code:l.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(f(s,{code:l.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(d){const u=new Set;for(const g of d){if(g.status==="aborted")return v;g.status==="dirty"&&t.dirty(),u.add(g.value)}return{status:t.value,value:u}}const o=[...s.data.values()].map((d,u)=>a._parse(new se(s,d,s.path,u)));return s.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,t){return new xe({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new xe({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}xe.create=(r,e)=>new xe({valueType:r,minSize:null,maxSize:null,typeName:_.ZodSet,...w(e)});class Ae extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return f(t,{code:l.invalid_type,expected:h.function,received:t.parsedType}),v;function s(o,d){return ft({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),Ne].filter(u=>!!u),issueData:{code:l.invalid_arguments,argumentsError:d}})}function n(o,d){return ft({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),Ne].filter(u=>!!u),issueData:{code:l.invalid_return_type,returnTypeError:d}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ce){const o=this;return G(async function(...d){const u=new q([]),g=await o._def.args.parseAsync(d,a).catch(S=>{throw u.addIssue(s(d,S)),u}),k=await Reflect.apply(i,this,g);return await o._def.returns._def.type.parseAsync(k,a).catch(S=>{throw u.addIssue(n(k,S)),u})})}else{const o=this;return G(function(...d){const u=o._def.args.safeParse(d,a);if(!u.success)throw new q([s(d,u.error)]);const g=Reflect.apply(i,this,u.data),k=o._def.returns.safeParse(g,a);if(!k.success)throw new q([n(g,k.error)]);return k.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ae({...this._def,args:re.create(e).rest(_e.create())})}returns(e){return new Ae({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new Ae({args:e||re.create([]).rest(_e.create()),returns:t||_e.create(),typeName:_.ZodFunction,...w(s)})}}class Ue extends x{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ue.create=(r,e)=>new Ue({getter:r,typeName:_.ZodLazy,...w(e)});class qe extends x{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:l.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}}qe.create=(r,e)=>new qe({value:r,typeName:_.ZodLiteral,...w(e)});function hs(r,e){return new he({values:r,typeName:_.ZodEnum,...w(e)})}class he extends x{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{expected:T.joinValues(s),received:t.parsedType,code:l.invalid_type}),v}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{received:t.data,code:l.invalid_enum_value,options:s}),v}return G(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return he.create(e,{...this._def,...t})}exclude(e,t=this._def){return he.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}he.create=hs;class Je extends x{_parse(e){const t=T.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.string&&s.parsedType!==h.number){const n=T.objectValues(t);return f(s,{expected:T.joinValues(n),received:s.parsedType,code:l.invalid_type}),v}if(this._cache||(this._cache=new Set(T.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=T.objectValues(t);return f(s,{received:s.data,code:l.invalid_enum_value,options:n}),v}return G(e.data)}get enum(){return this._def.values}}Je.create=(r,e)=>new Je({values:r,typeName:_.ZodNativeEnum,...w(e)});class Ce extends x{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return f(t,{code:l.invalid_type,expected:h.promise,received:t.parsedType}),v;const s=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return G(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ce.create=(r,e)=>new Ce({type:r,typeName:_.ZodPromise,...w(e)});class X extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{f(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return v;const d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?v:d.status==="dirty"||t.value==="dirty"?Ie(d.value):d});{if(t.value==="aborted")return v;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?v:o.status==="dirty"||t.value==="dirty"?Ie(o.value):o}}if(n.type==="refinement"){const i=o=>{const d=n.refinement(o,a);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!be(i))return v;const o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>be(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):v);T.assertNever(n)}}X.create=(r,e,t)=>new X({schema:r,typeName:_.ZodEffects,effect:e,...w(t)});X.createWithPreprocess=(r,e,t)=>new X({schema:e,effect:{type:"preprocess",transform:r},typeName:_.ZodEffects,...w(t)});class ee extends x{_parse(e){return this._getType(e)===h.undefined?G(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ee.create=(r,e)=>new ee({innerType:r,typeName:_.ZodOptional,...w(e)});class pe extends x{_parse(e){return this._getType(e)===h.null?G(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pe.create=(r,e)=>new pe({innerType:r,typeName:_.ZodNullable,...w(e)});class He extends x{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===h.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}He.create=(r,e)=>new He({innerType:r,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...w(e)});class We extends x{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Fe(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new q(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new q(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}We.create=(r,e)=>new We({innerType:r,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...w(e)});class gt extends x{_parse(e){if(this._getType(e)!==h.nan){const s=this._getOrReturnCtx(e);return f(s,{code:l.invalid_type,expected:h.nan,received:s.parsedType}),v}return{status:"valid",value:e.data}}}gt.create=r=>new gt({typeName:_.ZodNaN,...w(r)});const Qs=Symbol("zod_brand");class Lt extends x{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Xe extends x{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?v:a.status==="dirty"?(t.dirty(),Ie(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?v:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new Xe({in:e,out:t,typeName:_.ZodPipeline})}}class Ke extends x{_parse(e){const t=this._def.innerType._parse(e),s=n=>(be(n)&&(n.value=Object.freeze(n.value)),n);return Fe(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}Ke.create=(r,e)=>new Ke({innerType:r,typeName:_.ZodReadonly,...w(e)});function Jt(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function ps(r,e={},t){return r?Re.create().superRefine((s,n)=>{const a=r(s);if(a instanceof Promise)return a.then(i=>{if(!i){const o=Jt(e,s),d=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:d})}});if(!a){const i=Jt(e,s),o=i.fatal??t??!0;n.addIssue({code:"custom",...i,fatal:o})}}):Re.create()}const er={object:$.lazycreate};var _;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(_||(_={}));const tr=(r,e={message:`Input not instance of ${r.name}`})=>ps(t=>t instanceof r,e),A=K.create,te=de.create,sr=gt.create,rr=fe.create,Qe=De.create,nr=we.create,ar=ht.create,ir=Pe.create,ms=Ze.create,me=Re.create,bt=_e.create,or=ce.create,cr=pt.create,ke=Y.create,N=$.create,lr=$.strictCreate,Te=Ve.create,ur=_t.create,dr=Be.create,fr=re.create,et=Ge.create,hr=mt.create,pr=xe.create,mr=Ae.create,gs=Ue.create,B=qe.create,wt=he.create,gr=Je.create,yr=Ce.create,Ht=X.create,vr=ee.create,_r=pe.create,br=X.createWithPreprocess,wr=Xe.create,xr=()=>A().optional(),kr=()=>te().optional(),Tr=()=>Qe().optional(),ut={string:r=>K.create({...r,coerce:!0}),number:r=>de.create({...r,coerce:!0}),boolean:r=>De.create({...r,coerce:!0}),bigint:r=>fe.create({...r,coerce:!0}),date:r=>we.create({...r,coerce:!0})},Er=v,P=Object.freeze(Object.defineProperty({__proto__:null,BRAND:Qs,DIRTY:Ie,EMPTY_PATH:Rs,INVALID:v,NEVER:Er,OK:G,ParseStatus:V,Schema:x,ZodAny:Re,ZodArray:Y,ZodBigInt:fe,ZodBoolean:De,ZodBranded:Lt,ZodCatch:We,ZodDate:we,ZodDefault:He,ZodDiscriminatedUnion:_t,ZodEffects:X,ZodEnum:he,ZodError:q,get ZodFirstPartyTypeKind(){return _},ZodFunction:Ae,ZodIntersection:Be,ZodIssueCode:l,ZodLazy:Ue,ZodLiteral:qe,ZodMap:mt,ZodNaN:gt,ZodNativeEnum:Je,ZodNever:ce,ZodNull:Ze,ZodNullable:pe,ZodNumber:de,ZodObject:$,ZodOptional:ee,ZodParsedType:h,ZodPipeline:Xe,ZodPromise:Ce,ZodReadonly:Ke,ZodRecord:Ge,ZodSchema:x,ZodSet:xe,ZodString:K,ZodSymbol:ht,ZodTransformer:X,ZodTuple:re,ZodType:x,ZodUndefined:Pe,ZodUnion:Ve,ZodUnknown:_e,ZodVoid:pt,addIssueToContext:f,any:me,array:ke,bigint:rr,boolean:Qe,coerce:ut,custom:ps,date:nr,datetimeRegex:fs,defaultErrorMap:Ne,discriminatedUnion:ur,effect:Ht,enum:wt,function:mr,getErrorMap:dt,getParsedType:ie,instanceof:tr,intersection:dr,isAborted:Nt,isAsync:Fe,isDirty:Rt,isValid:be,late:er,lazy:gs,literal:B,makeIssue:ft,map:hr,nan:sr,nativeEnum:gr,never:or,null:ms,nullable:_r,number:te,object:N,get objectUtil(){return At},oboolean:Tr,onumber:kr,optional:vr,ostring:xr,pipeline:wr,preprocess:br,promise:yr,quotelessJson:As,record:et,set:pr,setErrorMap:Ns,strictObject:lr,string:A,symbol:ar,transformer:Ht,tuple:fr,undefined:ir,union:Te,unknown:bt,get util(){return T},void:cr},Symbol.toStringTag,{value:"Module"})),ye=()=>P.preprocess(r=>{if(typeof r=="boolean")return r;if(typeof r=="number")return r===1;if(typeof r=="string"){const e=r.trim().toLowerCase();if(["1","true","yes","y","on"].includes(e))return!0;if(["0","false","no","n","off"].includes(e))return!1}},P.boolean()),Sr=()=>P.preprocess(r=>{if(typeof r=="number"&&Number.isFinite(r))return r;if(typeof r=="string"){const e=Number(r);if(Number.isFinite(e))return e}},P.number()),ys=P.object({NODE_ENV:P.enum(["development","production","test"]).default("production"),AGENT_CONTAINER_MODE:ye().default(!1),AGENT_API_KEY:P.string().optional(),AGENT_ORGANIZATION_ID:P.string().optional(),AGENT_SESSION_ID:P.string().optional(),AGENT_SERVER_URL:P.string().optional(),AGENT_TYPE:P.string().optional(),AGENT_DEVICE_GUID:P.string().optional(),CONTEXT_DATA:P.string().optional(),AGI_NETLOG_ENABLE:ye().default(!0),AGI_NETLOG_DEBUG:ye().optional(),AGI_NETLOG_FILE:P.string().optional(),AGI_NETLOG_MAX_BODY:Sr().optional(),AGI_NETLOG_REMOTE_ENABLE:ye().default(!0),AGI_NETLOG_REMOTE_FILE:P.string().optional(),DEBUG:ye().default(!1),VERBOSE:ye().default(!1),LOG_LEVEL:P.string().optional(),HOSTNAME:P.string().optional(),VITE_SAVE_RAW:ye().default(!1)});function ct(r=!1){return r?"https://agiflow.io":"https://agiflow.io"}let R=ys.parse(process.env);class ve{static refresh(){R=ys.parse(process.env)}static get isContainerMode(){return!!R.AGENT_CONTAINER_MODE}static get apiKey(){return R.AGENT_API_KEY||process.env.AGENT_API_KEY}static get organizationId(){return R.AGENT_ORGANIZATION_ID||process.env.AGENT_ORGANIZATION_ID}static get sessionId(){return R.AGENT_SESSION_ID||process.env.AGENT_SESSION_ID}static get serverUrl(){return R.AGENT_SERVER_URL||process.env.AGENT_SERVER_URL||ct(this.isContainerMode)}static get isNetlogEnabled(){return!!R.AGI_NETLOG_ENABLE}static get isNetlogDebug(){return!!R.AGI_NETLOG_DEBUG}static get isNetlogRemoteEnabled(){return!!R.AGI_NETLOG_REMOTE_ENABLE}static get isDebugMode(){return R.DEBUG}static get isVerbose(){return R.VERBOSE}static get logLevel(){return R.LOG_LEVEL??(R.DEBUG?"debug":"info")}static get nodeEnv(){return R.NODE_ENV}static get homeDir(){return process.env.HOME||process.env.USERPROFILE}static get isMacOS(){return process.platform==="darwin"}static get hostname(){return R.HOSTNAME}static get netlogMaxBody(){return R.AGI_NETLOG_MAX_BODY}static get netlogFile(){return R.AGI_NETLOG_FILE}static get netlogRemoteFile(){return R.AGI_NETLOG_REMOTE_FILE}static get agentType(){return R.AGENT_TYPE||process.env.AGENT_TYPE}static get deviceGuid(){return R.AGENT_DEVICE_GUID}static get isSaveRawEnabled(){return!!R.VITE_SAVE_RAW}static get contextData(){return R.CONTEXT_DATA||process.env.CONTEXT_DATA}static serializeEnv(){const e={...process.env};for(const[t,s]of Object.entries(R))s!==void 0&&(typeof s=="string"?e[t]=s:typeof s=="number"?e[t]=String(s):typeof s=="boolean"?e[t]=s?"true":"false":e[t]=String(s));return e}static toChildProcess(){const e=this.serializeEnv();return e.AGENT_SERVER_URL||(e.AGENT_SERVER_URL=ct(this.isContainerMode)),e.LOG_LEVEL||(e.LOG_LEVEL=this.logLevel),e}static toDocker(){const e=this.serializeEnv();return e.AGENT_CONTAINER_MODE="true",e.AGENT_SERVER_URL||(e.AGENT_SERVER_URL=ct(!0)),e.LOG_LEVEL||(e.LOG_LEVEL=this.logLevel),e}static toPty(){const e=this.serializeEnv();return e.AGENT_SERVER_URL||(e.AGENT_SERVER_URL=ct(this.isContainerMode)),e.LOG_LEVEL||(e.LOG_LEVEL=this.logLevel),e}static getEnvs(){return R}}const Wt=gs(()=>Te([ms(),A(),te(),Qe(),ke(Wt),et(Wt)])),Kt=N({toolCallId:A(),toolName:A(),args:me()}),Ir=N({toolCallId:A(),toolName:A(),args:me(),result:me()}),Or=Te([Kt.extend({state:B("partial-call"),step:te().optional()}),Kt.extend({state:B("call"),step:te().optional()}),Ir.extend({state:B("result"),step:te().optional()})]),Ar=N({type:A(),content:A()}),Nr=N({type:B("text"),text:A()}),Rr=N({type:B("reasoning"),reasoning:A(),details:ke(Te([N({type:B("text"),text:A(),signature:A().optional()}),N({type:B("redacted"),data:A()})])).optional()}),Cr=N({name:B("select"),props:N({options:ke(N({label:A(),value:Te([A(),te()]),selected:Qe().optional()}))})}),jr=N({name:B("placeholder"),props:N({})}),$r=Te([Cr,jr]),Mr=N({completed:Qe(),component:$r}),zr=N({type:B("tool-invocation"),toolInvocation:Or,input:Mr.optional(),jsx:A({description:"UI rendering"}).optional()}),Lr=N({type:B("source"),source:Ar}),Fr=N({type:B("file"),mimeType:A(),data:A()}),Dr=N({type:B("error"),text:A(),error:me().optional()}),Pr=N({type:B("step-start")}),vs=Te([Nr,Rr,zr,Lr,Fr,Dr,Pr]),Ft=wt(["input","output","error","system"]),_s=N({messageType:Ft,parts:ke(vs),metadata:et(A(),bt()).optional(),raw:me().optional()});N({id:A(),sessionId:A(),agentTypeId:A(),messageType:Ft,contentSize:te().nullable(),timestamp:ut.date(),metadata:A().nullable(),raw:me().nullable().optional(),createdAt:ut.date(),updatedAt:ut.date()});const Zr=N({messageType:wt(["output"]).default("output"),metadata:et(A(),bt()).optional()});N({id:A(),messageId:A()});const Vr=N({parts:ke(vs).optional(),metadata:et(A(),bt()).optional(),raw:me().optional()});N({messages:ke(_s)});function Br(r){return[Gr(r)]}function Yt(r){let e=r.parts;if(!e&&r.content&&(e=Br(r.content)),!e)throw new Error("Either content or parts is required for message creation");return{messageType:r.messageType,parts:e,metadata:r.metadata,raw:r.raw}}function Gr(r){return{type:"text",text:r}}const It=10,Xt=(r=0)=>e=>`\x1B[${e+r}m`,Qt=(r=0)=>e=>`\x1B[${38+r};5;${e}m`,es=(r=0)=>(e,t,s)=>`\x1B[${38+r};2;${e};${t};${s}m`,C={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(C.modifier);const Ur=Object.keys(C.color),qr=Object.keys(C.bgColor);[...Ur,...qr];function Jr(){const r=new Map;for(const[e,t]of Object.entries(C)){for(const[s,n]of Object.entries(t))C[s]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},t[s]=C[s],r.set(n[0],n[1]);Object.defineProperty(C,e,{value:t,enumerable:!1})}return Object.defineProperty(C,"codes",{value:r,enumerable:!1}),C.color.close="\x1B[39m",C.bgColor.close="\x1B[49m",C.color.ansi=Xt(),C.color.ansi256=Qt(),C.color.ansi16m=es(),C.bgColor.ansi=Xt(It),C.bgColor.ansi256=Qt(It),C.bgColor.ansi16m=es(It),Object.defineProperties(C,{rgbToAnsi256:{value(e,t,s){return e===t&&t===s?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(s/255*5)},enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[s]=t;s.length===3&&(s=[...s].map(a=>a+a).join(""));const n=Number.parseInt(s,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:e=>C.rgbToAnsi256(...C.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,s,n;if(e>=232)t=((e-232)*10+8)/255,s=t,n=t;else{e-=16;const o=e%36;t=Math.floor(e/36)/5,s=Math.floor(o/6)/5,n=o%6/5}const a=Math.max(t,s,n)*2;if(a===0)return 30;let i=30+(Math.round(n)<<2|Math.round(s)<<1|Math.round(t));return a===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,s)=>C.ansi256ToAnsi(C.rgbToAnsi256(e,t,s)),enumerable:!1},hexToAnsi:{value:e=>C.ansi256ToAnsi(C.hexToAnsi256(e)),enumerable:!1}}),C}const Q=Jr(),ts=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const r=navigator.userAgentData.brands.find(({brand:e})=>e==="Chromium");if(r&&r.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),ss=ts!==0&&{level:ts},Hr={stdout:ss,stderr:ss};function Wr(r,e,t){let s=r.indexOf(e);if(s===-1)return r;const n=e.length;let a=0,i="";do i+=r.slice(a,s)+e+t,a=s+n,s=r.indexOf(e,a);while(s!==-1);return i+=r.slice(a),i}function Kr(r,e,t,s){let n=0,a="";do{const i=r[s-1]==="\r";a+=r.slice(n,i?s-1:s)+e+(i?`\r
2
+ "use strict";const $c=require("node:os"),bc=require("node:path"),_c=require("node:fs"),_e=require("path"),be=require("fs-extra"),Qt=require("os");require("node:crypto");require("@inquirer/prompts");function fn(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const Di=fn($c),De=fn(bc),Ie=fn(_c),Ai=Object.freeze({status:"aborted"});function c(t,n,r){function o(u,s){var l;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(l=u._zod).traits??(l.traits=new Set),u._zod.traits.add(t),n(u,s);for(const m in a.prototype)m in u||Object.defineProperty(u,m,{value:a.prototype[m].bind(u)});u._zod.constr=a,u._zod.def=s}const e=r?.Parent??Object;class i extends e{}Object.defineProperty(i,"name",{value:t});function a(u){var s;const l=r?.Parent?new i:this;o(l,u),(s=l._zod).deferred??(s.deferred=[]);for(const m of l._zod.deferred)m();return l}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>r?.Parent&&u instanceof r.Parent?!0:u?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}const Pi=Symbol("zod_brand");class Oe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Dt extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`),this.name="ZodEncodeError"}}const It={};function H(t){return t&&Object.assign(It,t),It}function yc(t){return t}function wc(t){return t}function kc(t){}function Ic(t){throw new Error}function Sc(t){}function gn(t){const n=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,e])=>n.indexOf(+o)===-1).map(([o,e])=>e)}function $(t,n="|"){return t.map(r=>k(r)).join(n)}function St(t,n){return typeof n=="bigint"?n.toString():n}function tt(t){return{get value(){{const n=t();return Object.defineProperty(this,"value",{value:n}),n}}}}function Ee(t){return t==null}function At(t){const n=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(n,r)}function Zi(t,n){const r=(t.toString().split(".")[1]||"").length,o=n.toString();let e=(o.split(".")[1]||"").length;if(e===0&&/\d?e-\d?/.test(o)){const s=o.match(/\d?e-(\d?)/);s?.[1]&&(e=Number.parseInt(s[1]))}const i=r>e?r:e,a=Number.parseInt(t.toFixed(i).replace(".","")),u=Number.parseInt(n.toFixed(i).replace(".",""));return a%u/10**i}const oi=Symbol("evaluating");function O(t,n,r){let o;Object.defineProperty(t,n,{get(){if(o!==oi)return o===void 0&&(o=oi,o=r()),o},set(e){Object.defineProperty(t,n,{value:e})},configurable:!0})}function zc(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function we(t,n,r){Object.defineProperty(t,n,{value:r,writable:!0,enumerable:!0,configurable:!0})}function he(...t){const n={};for(const r of t){const o=Object.getOwnPropertyDescriptors(r);Object.assign(n,o)}return Object.defineProperties({},n)}function Oc(t){return he(t._zod.def)}function jc(t,n){return n?n.reduce((r,o)=>r?.[o],t):t}function xc(t){const n=Object.keys(t),r=n.map(o=>t[o]);return Promise.all(r).then(o=>{const e={};for(let i=0;i<n.length;i++)e[n[i]]=o[i];return e})}function Nc(t=10){const n="abcdefghijklmnopqrstuvwxyz";let r="";for(let o=0;o<t;o++)r+=n[Math.floor(Math.random()*n.length)];return r}function nn(t){return JSON.stringify(t)}const pn="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Ae(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Ri=tt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function je(t){if(Ae(t)===!1)return!1;const n=t.constructor;if(n===void 0)return!0;const r=n.prototype;return!(Ae(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Pt(t){return je(t)?{...t}:Array.isArray(t)?[...t]:t}function Ec(t){let n=0;for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&n++;return n}const Uc=t=>{const n=typeof t;switch(n){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${n}`)}},zt=new Set(["string","number","symbol"]),Fi=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ye(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ie(t,n,r){const o=new t._zod.constr(n??t._zod.def);return(!n||r?.parent)&&(o._zod.parent=t),o}function p(t){const n=t;if(!n)return{};if(typeof n=="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function Tc(t){let n;return new Proxy({},{get(r,o,e){return n??(n=t()),Reflect.get(n,o,e)},set(r,o,e,i){return n??(n=t()),Reflect.set(n,o,e,i)},has(r,o){return n??(n=t()),Reflect.has(n,o)},deleteProperty(r,o){return n??(n=t()),Reflect.deleteProperty(n,o)},ownKeys(r){return n??(n=t()),Reflect.ownKeys(n)},getOwnPropertyDescriptor(r,o){return n??(n=t()),Reflect.getOwnPropertyDescriptor(n,o)},defineProperty(r,o,e){return n??(n=t()),Reflect.defineProperty(n,o,e)}})}function k(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Li(t){return Object.keys(t).filter(n=>t[n]._zod.optin==="optional"&&t[n]._zod.optout==="optional")}const Ci={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Mi={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Gi(t,n){const r=t._zod.def,o=he(t._zod.def,{get shape(){const e={};for(const i in n){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(e[i]=r.shape[i])}return we(this,"shape",e),e},checks:[]});return ie(t,o)}function Ji(t,n){const r=t._zod.def,o=he(t._zod.def,{get shape(){const e={...t._zod.def.shape};for(const i in n){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);n[i]&&delete e[i]}return we(this,"shape",e),e},checks:[]});return ie(t,o)}function Bi(t,n){if(!je(n))throw new Error("Invalid input to extend: expected a plain object");const r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const e=he(t._zod.def,{get shape(){const i={...t._zod.def.shape,...n};return we(this,"shape",i),i},checks:[]});return ie(t,e)}function Vi(t,n){if(!je(n))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...t._zod.def,get shape(){const o={...t._zod.def.shape,...n};return we(this,"shape",o),o},checks:t._zod.def.checks};return ie(t,r)}function Ki(t,n){const r=he(t._zod.def,{get shape(){const o={...t._zod.def.shape,...n._zod.def.shape};return we(this,"shape",o),o},get catchall(){return n._zod.def.catchall},checks:[]});return ie(t,r)}function Wi(t,n,r){const o=he(n._zod.def,{get shape(){const e=n._zod.def.shape,i={...e};if(r)for(const a in r){if(!(a in e))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=t?new t({type:"optional",innerType:e[a]}):e[a])}else for(const a in e)i[a]=t?new t({type:"optional",innerType:e[a]}):e[a];return we(this,"shape",i),i},checks:[]});return ie(n,o)}function qi(t,n,r){const o=he(n._zod.def,{get shape(){const e=n._zod.def.shape,i={...e};if(r)for(const a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new t({type:"nonoptional",innerType:e[a]}))}else for(const a in e)i[a]=new t({type:"nonoptional",innerType:e[a]});return we(this,"shape",i),i},checks:[]});return ie(n,o)}function Se(t,n=0){if(t.aborted===!0)return!0;for(let r=n;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function oe(t,n){return n.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function qe(t){return typeof t=="string"?t:t?.message}function ue(t,n,r){const o={...t,path:t.path??[]};if(!t.message){const e=qe(t.inst?._zod.def?.error?.(t))??qe(n?.error?.(t))??qe(r.customError?.(t))??qe(r.localeError?.(t))??"Invalid input";o.message=e}return delete o.inst,delete o.continue,n?.reportInput||delete o.input,o}function Zt(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Rt(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Pe(...t){const[n,r,o]=t;return typeof n=="string"?{message:n,code:"custom",input:r,inst:o}:{...n}}function Dc(t){return Object.entries(t).filter(([n,r])=>Number.isNaN(Number.parseInt(n,10))).map(n=>n[1])}function Xi(t){const n=atob(t),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return r}function Hi(t){let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return btoa(n)}function Ac(t){const n=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-n.length%4)%4);return Xi(n+r)}function Pc(t){return Hi(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Zc(t){const n=t.replace(/^0x/,"");if(n.length%2!==0)throw new Error("Invalid hex string length");const r=new Uint8Array(n.length/2);for(let o=0;o<n.length;o+=2)r[o/2]=Number.parseInt(n.slice(o,o+2),16);return r}function Rc(t){return Array.from(t).map(n=>n.toString(16).padStart(2,"0")).join("")}class Fc{constructor(...n){}}const Yi=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:Mi,Class:Fc,NUMBER_FORMAT_RANGES:Ci,aborted:Se,allowsEval:Ri,assert:Sc,assertEqual:yc,assertIs:kc,assertNever:Ic,assertNotEqual:wc,assignProp:we,base64ToUint8Array:Xi,base64urlToUint8Array:Ac,cached:tt,captureStackTrace:pn,cleanEnum:Dc,cleanRegex:At,clone:ie,cloneDef:Oc,createTransparentProxy:Tc,defineLazy:O,esc:nn,escapeRegex:ye,extend:Bi,finalizeIssue:ue,floatSafeRemainder:Zi,getElementAtPath:jc,getEnumValues:gn,getLengthableOrigin:Rt,getParsedType:Uc,getSizableOrigin:Zt,hexToUint8Array:Zc,isObject:Ae,isPlainObject:je,issue:Pe,joinValues:$,jsonStringifyReplacer:St,merge:Ki,mergeDefs:he,normalizeParams:p,nullish:Ee,numKeys:Ec,objectClone:zc,omit:Ji,optionalKeys:Li,partial:Wi,pick:Gi,prefixIssues:oe,primitiveTypes:Fi,promiseAllObject:xc,propertyKeyTypes:zt,randomString:Nc,required:qi,safeExtend:Vi,shallowClone:Pt,stringifyPrimitive:k,uint8ArrayToBase64:Hi,uint8ArrayToBase64url:Pc,uint8ArrayToHex:Rc,unwrapMessage:qe},Symbol.toStringTag,{value:"Module"})),Qi=(t,n)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:n,enumerable:!1}),t.message=JSON.stringify(n,St,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},vn=c("$ZodError",Qi),te=c("$ZodError",Qi,{Parent:Error});function hn(t,n=r=>r.message){const r={},o=[];for(const e of t.issues)e.path.length>0?(r[e.path[0]]=r[e.path[0]]||[],r[e.path[0]].push(n(e))):o.push(n(e));return{formErrors:o,fieldErrors:r}}function $n(t,n=r=>r.message){const r={_errors:[]},o=e=>{for(const i of e.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)r._errors.push(n(i));else{let a=r,u=0;for(;u<i.path.length;){const s=i.path[u];u===i.path.length-1?(a[s]=a[s]||{_errors:[]},a[s]._errors.push(n(i))):a[s]=a[s]||{_errors:[]},a=a[s],u++}}};return o(t),r}function eo(t,n=r=>r.message){const r={errors:[]},o=(e,i=[])=>{var a,u;for(const s of e.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(l=>o({issues:l},s.path));else if(s.code==="invalid_key")o({issues:s.issues},s.path);else if(s.code==="invalid_element")o({issues:s.issues},s.path);else{const l=[...i,...s.path];if(l.length===0){r.errors.push(n(s));continue}let m=r,f=0;for(;f<l.length;){const b=l[f],v=f===l.length-1;typeof b=="string"?(m.properties??(m.properties={}),(a=m.properties)[b]??(a[b]={errors:[]}),m=m.properties[b]):(m.items??(m.items=[]),(u=m.items)[b]??(u[b]={errors:[]}),m=m.items[b]),v&&m.errors.push(n(s)),f++}}};return o(t),r}function to(t){const n=[],r=t.map(o=>typeof o=="object"?o.key:o);for(const o of r)typeof o=="number"?n.push(`[${o}]`):typeof o=="symbol"?n.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?n.push(`[${JSON.stringify(o)}]`):(n.length&&n.push("."),n.push(o));return n.join("")}function no(t){const n=[],r=[...t.issues].sort((o,e)=>(o.path??[]).length-(e.path??[]).length);for(const o of r)n.push(`✖ ${o.message}`),o.path?.length&&n.push(` → at ${to(o.path)}`);return n.join(`
3
+ `)}const nt=t=>(n,r,o,e)=>{const i=o?Object.assign(o,{async:!1}):{async:!1},a=n._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new Oe;if(a.issues.length){const u=new(e?.Err??t)(a.issues.map(s=>ue(s,i,H())));throw pn(u,e?.callee),u}return a.value},rn=nt(te),rt=t=>async(n,r,o,e)=>{const i=o?Object.assign(o,{async:!0}):{async:!0};let a=n._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new(e?.Err??t)(a.issues.map(s=>ue(s,i,H())));throw pn(u,e?.callee),u}return a.value},on=rt(te),it=t=>(n,r,o)=>{const e=o?{...o,async:!1}:{async:!1},i=n._zod.run({value:r,issues:[]},e);if(i instanceof Promise)throw new Oe;return i.issues.length?{success:!1,error:new(t??vn)(i.issues.map(a=>ue(a,e,H())))}:{success:!0,data:i.value}},ro=it(te),ot=t=>async(n,r,o)=>{const e=o?Object.assign(o,{async:!0}):{async:!0};let i=n._zod.run({value:r,issues:[]},e);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>ue(a,e,H())))}:{success:!0,data:i.value}},io=ot(te),bn=t=>(n,r,o)=>{const e=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return nt(t)(n,r,e)},Lc=bn(te),_n=t=>(n,r,o)=>nt(t)(n,r,o),Cc=_n(te),yn=t=>async(n,r,o)=>{const e=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return rt(t)(n,r,e)},Mc=yn(te),wn=t=>async(n,r,o)=>rt(t)(n,r,o),Gc=wn(te),kn=t=>(n,r,o)=>{const e=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return it(t)(n,r,e)},Jc=kn(te),In=t=>(n,r,o)=>it(t)(n,r,o),Bc=In(te),Sn=t=>async(n,r,o)=>{const e=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ot(t)(n,r,e)},Vc=Sn(te),zn=t=>async(n,r,o)=>ot(t)(n,r,o),Kc=zn(te),oo=/^[cC][^\s-]{8,}$/,ao=/^[0-9a-z]+$/,uo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,so=/^[0-9a-vA-V]{20}$/,co=/^[A-Za-z0-9]{27}$/,lo=/^[a-zA-Z0-9_-]{21}$/,mo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Wc=/^[-+]?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)?)??$/,fo=/^([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})$/,Ze=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,qc=Ze(4),Xc=Ze(6),Hc=Ze(7),go=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Yc=/^[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])?)*$/,Qc=/^(([^<>()\[\]\\.,;:\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,}))$/,po=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,el=po,tl=/^[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])?)*$/,nl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function vo(){return new RegExp(nl,"u")}const ho=/^(?:(?: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])$/,$o=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,bo=/^((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])$/,_o=/^(([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])$/,yo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,On=/^[A-Za-z0-9_-]*$/,jn=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,wo=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,ko=/^\+(?:[0-9]){6,14}[0-9]$/,Io="(?:(?:\\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])))",So=new RegExp(`^${Io}$`);function zo(t){const n="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${n}`:t.precision===0?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${t.precision}}`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Oo(t){return new RegExp(`^${zo(t)}$`)}function jo(t){const n=zo({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${n}(?:${r.join("|")})`;return new RegExp(`^${Io}T(?:${o})$`)}const xo=t=>{const n=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},No=/^-?\d+n?$/,Eo=/^-?\d+$/,Uo=/^-?\d+(?:\.\d+)?/,To=/^(?:true|false)$/i,Do=/^null$/i,Ao=/^undefined$/i,Po=/^[^A-Z]*$/,Zo=/^[^a-z]*$/,Ro=/^[0-9a-fA-F]*$/;function at(t,n){return new RegExp(`^[A-Za-z0-9+/]{${t}}${n}$`)}function ut(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}const rl=/^[0-9a-fA-F]{32}$/,il=at(22,"=="),ol=ut(22),al=/^[0-9a-fA-F]{40}$/,ul=at(27,"="),sl=ut(27),cl=/^[0-9a-fA-F]{64}$/,ll=at(43,"="),dl=ut(43),ml=/^[0-9a-fA-F]{96}$/,fl=at(64,""),gl=ut(64),pl=/^[0-9a-fA-F]{128}$/,vl=at(86,"=="),hl=ut(86),xn=Object.freeze(Object.defineProperty({__proto__:null,base64:yo,base64url:On,bigint:No,boolean:To,browserEmail:tl,cidrv4:bo,cidrv6:_o,cuid:oo,cuid2:ao,date:So,datetime:jo,domain:wo,duration:mo,e164:ko,email:go,emoji:vo,extendedDuration:Wc,guid:fo,hex:Ro,hostname:jn,html5Email:Yc,idnEmail:el,integer:Eo,ipv4:ho,ipv6:$o,ksuid:co,lowercase:Po,md5_base64:il,md5_base64url:ol,md5_hex:rl,nanoid:lo,null:Do,number:Uo,rfc5322Email:Qc,sha1_base64:ul,sha1_base64url:sl,sha1_hex:al,sha256_base64:ll,sha256_base64url:dl,sha256_hex:cl,sha384_base64:fl,sha384_base64url:gl,sha384_hex:ml,sha512_base64:vl,sha512_base64url:hl,sha512_hex:pl,string:xo,time:Oo,ulid:uo,undefined:Ao,unicodeEmail:po,uppercase:Zo,uuid:Ze,uuid4:qc,uuid6:Xc,uuid7:Hc,xid:so},Symbol.toStringTag,{value:"Module"})),C=c("$ZodCheck",(t,n)=>{var r;t._zod??(t._zod={}),t._zod.def=n,(r=t._zod).onattach??(r.onattach=[])}),Fo={number:"number",bigint:"bigint",object:"date"},Nn=c("$ZodCheckLessThan",(t,n)=>{C.init(t,n);const r=Fo[typeof n.value];t._zod.onattach.push(o=>{const e=o._zod.bag,i=(n.inclusive?e.maximum:e.exclusiveMaximum)??Number.POSITIVE_INFINITY;n.value<i&&(n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value)}),t._zod.check=o=>{(n.inclusive?o.value<=n.value:o.value<n.value)||o.issues.push({origin:r,code:"too_big",maximum:n.value,input:o.value,inclusive:n.inclusive,inst:t,continue:!n.abort})}}),En=c("$ZodCheckGreaterThan",(t,n)=>{C.init(t,n);const r=Fo[typeof n.value];t._zod.onattach.push(o=>{const e=o._zod.bag,i=(n.inclusive?e.minimum:e.exclusiveMinimum)??Number.NEGATIVE_INFINITY;n.value>i&&(n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value)}),t._zod.check=o=>{(n.inclusive?o.value>=n.value:o.value>n.value)||o.issues.push({origin:r,code:"too_small",minimum:n.value,input:o.value,inclusive:n.inclusive,inst:t,continue:!n.abort})}}),Lo=c("$ZodCheckMultipleOf",(t,n)=>{C.init(t,n),t._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=n.value)}),t._zod.check=r=>{if(typeof r.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%n.value===BigInt(0):Zi(r.value,n.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:n.value,input:r.value,inst:t,continue:!n.abort})}}),Co=c("$ZodCheckNumberFormat",(t,n)=>{C.init(t,n),n.format=n.format||"float64";const r=n.format?.includes("int"),o=r?"int":"number",[e,i]=Ci[n.format];t._zod.onattach.push(a=>{const u=a._zod.bag;u.format=n.format,u.minimum=e,u.maximum=i,r&&(u.pattern=Eo)}),t._zod.check=a=>{const u=a.value;if(r){if(!Number.isInteger(u)){a.issues.push({expected:o,format:n.format,code:"invalid_type",continue:!1,input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?a.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,continue:!n.abort}):a.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,continue:!n.abort});return}}u<e&&a.issues.push({origin:"number",input:u,code:"too_small",minimum:e,inclusive:!0,inst:t,continue:!n.abort}),u>i&&a.issues.push({origin:"number",input:u,code:"too_big",maximum:i,inst:t})}}),Mo=c("$ZodCheckBigIntFormat",(t,n)=>{C.init(t,n);const[r,o]=Mi[n.format];t._zod.onattach.push(e=>{const i=e._zod.bag;i.format=n.format,i.minimum=r,i.maximum=o}),t._zod.check=e=>{const i=e.value;i<r&&e.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!n.abort}),i>o&&e.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inst:t})}}),Go=c("$ZodCheckMaxSize",(t,n)=>{var r;C.init(t,n),(r=t._zod.def).when??(r.when=o=>{const e=o.value;return!Ee(e)&&e.size!==void 0}),t._zod.onattach.push(o=>{const e=o._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum<e&&(o._zod.bag.maximum=n.maximum)}),t._zod.check=o=>{const e=o.value;e.size<=n.maximum||o.issues.push({origin:Zt(e),code:"too_big",maximum:n.maximum,inclusive:!0,input:e,inst:t,continue:!n.abort})}}),Jo=c("$ZodCheckMinSize",(t,n)=>{var r;C.init(t,n),(r=t._zod.def).when??(r.when=o=>{const e=o.value;return!Ee(e)&&e.size!==void 0}),t._zod.onattach.push(o=>{const e=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>e&&(o._zod.bag.minimum=n.minimum)}),t._zod.check=o=>{const e=o.value;e.size>=n.minimum||o.issues.push({origin:Zt(e),code:"too_small",minimum:n.minimum,inclusive:!0,input:e,inst:t,continue:!n.abort})}}),Bo=c("$ZodCheckSizeEquals",(t,n)=>{var r;C.init(t,n),(r=t._zod.def).when??(r.when=o=>{const e=o.value;return!Ee(e)&&e.size!==void 0}),t._zod.onattach.push(o=>{const e=o._zod.bag;e.minimum=n.size,e.maximum=n.size,e.size=n.size}),t._zod.check=o=>{const e=o.value,i=e.size;if(i===n.size)return;const a=i>n.size;o.issues.push({origin:Zt(e),...a?{code:"too_big",maximum:n.size}:{code:"too_small",minimum:n.size},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!n.abort})}}),Vo=c("$ZodCheckMaxLength",(t,n)=>{var r;C.init(t,n),(r=t._zod.def).when??(r.when=o=>{const e=o.value;return!Ee(e)&&e.length!==void 0}),t._zod.onattach.push(o=>{const e=o._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum<e&&(o._zod.bag.maximum=n.maximum)}),t._zod.check=o=>{const e=o.value;if(e.length<=n.maximum)return;const a=Rt(e);o.issues.push({origin:a,code:"too_big",maximum:n.maximum,inclusive:!0,input:e,inst:t,continue:!n.abort})}}),Ko=c("$ZodCheckMinLength",(t,n)=>{var r;C.init(t,n),(r=t._zod.def).when??(r.when=o=>{const e=o.value;return!Ee(e)&&e.length!==void 0}),t._zod.onattach.push(o=>{const e=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>e&&(o._zod.bag.minimum=n.minimum)}),t._zod.check=o=>{const e=o.value;if(e.length>=n.minimum)return;const a=Rt(e);o.issues.push({origin:a,code:"too_small",minimum:n.minimum,inclusive:!0,input:e,inst:t,continue:!n.abort})}}),Wo=c("$ZodCheckLengthEquals",(t,n)=>{var r;C.init(t,n),(r=t._zod.def).when??(r.when=o=>{const e=o.value;return!Ee(e)&&e.length!==void 0}),t._zod.onattach.push(o=>{const e=o._zod.bag;e.minimum=n.length,e.maximum=n.length,e.length=n.length}),t._zod.check=o=>{const e=o.value,i=e.length;if(i===n.length)return;const a=Rt(e),u=i>n.length;o.issues.push({origin:a,...u?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!n.abort})}}),st=c("$ZodCheckStringFormat",(t,n)=>{var r,o;C.init(t,n),t._zod.onattach.push(e=>{const i=e._zod.bag;i.format=n.format,n.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(n.pattern))}),n.pattern?(r=t._zod).check??(r.check=e=>{n.pattern.lastIndex=0,!n.pattern.test(e.value)&&e.issues.push({origin:"string",code:"invalid_format",format:n.format,input:e.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:t,continue:!n.abort})}):(o=t._zod).check??(o.check=()=>{})}),qo=c("$ZodCheckRegex",(t,n)=>{st.init(t,n),t._zod.check=r=>{n.pattern.lastIndex=0,!n.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:n.pattern.toString(),inst:t,continue:!n.abort})}}),Xo=c("$ZodCheckLowerCase",(t,n)=>{n.pattern??(n.pattern=Po),st.init(t,n)}),Ho=c("$ZodCheckUpperCase",(t,n)=>{n.pattern??(n.pattern=Zo),st.init(t,n)}),Yo=c("$ZodCheckIncludes",(t,n)=>{C.init(t,n);const r=ye(n.includes),o=new RegExp(typeof n.position=="number"?`^.{${n.position}}${r}`:r);n.pattern=o,t._zod.onattach.push(e=>{const i=e._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),t._zod.check=e=>{e.value.includes(n.includes,n.position)||e.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:e.value,inst:t,continue:!n.abort})}}),Qo=c("$ZodCheckStartsWith",(t,n)=>{C.init(t,n);const r=new RegExp(`^${ye(n.prefix)}.*`);n.pattern??(n.pattern=r),t._zod.onattach.push(o=>{const e=o._zod.bag;e.patterns??(e.patterns=new Set),e.patterns.add(r)}),t._zod.check=o=>{o.value.startsWith(n.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:o.value,inst:t,continue:!n.abort})}}),ea=c("$ZodCheckEndsWith",(t,n)=>{C.init(t,n);const r=new RegExp(`.*${ye(n.suffix)}$`);n.pattern??(n.pattern=r),t._zod.onattach.push(o=>{const e=o._zod.bag;e.patterns??(e.patterns=new Set),e.patterns.add(r)}),t._zod.check=o=>{o.value.endsWith(n.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:o.value,inst:t,continue:!n.abort})}});function ai(t,n,r){t.issues.length&&n.issues.push(...oe(r,t.issues))}const ta=c("$ZodCheckProperty",(t,n)=>{C.init(t,n),t._zod.check=r=>{const o=n.schema._zod.run({value:r.value[n.property],issues:[]},{});if(o instanceof Promise)return o.then(e=>ai(e,r,n.property));ai(o,r,n.property)}}),na=c("$ZodCheckMimeType",(t,n)=>{C.init(t,n);const r=new Set(n.mime);t._zod.onattach.push(o=>{o._zod.bag.mime=n.mime}),t._zod.check=o=>{r.has(o.value.type)||o.issues.push({code:"invalid_value",values:n.mime,input:o.value.type,inst:t,continue:!n.abort})}}),ra=c("$ZodCheckOverwrite",(t,n)=>{C.init(t,n),t._zod.check=r=>{r.value=n.tx(r.value)}});class ia{constructor(n=[]){this.content=[],this.indent=0,this&&(this.args=n)}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n=="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}const o=n.split(`
4
+ `).filter(a=>a),e=Math.min(...o.map(a=>a.length-a.trimStart().length)),i=o.map(a=>a.slice(e)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const n=Function,r=this?.args,e=[...(this?.content??[""]).map(i=>` ${i}`)];return new n(...r,e.join(`
5
+ `))}}const oa={major:4,minor:1,patch:12},S=c("$ZodType",(t,n)=>{var r;t??(t={}),t._zod.def=n,t._zod.bag=t._zod.bag||{},t._zod.version=oa;const o=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&o.unshift(t);for(const e of o)for(const i of e._zod.onattach)i(t);if(o.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{const e=(a,u,s)=>{let l=Se(a),m;for(const f of u){if(f._zod.def.when){if(!f._zod.def.when(a))continue}else if(l)continue;const b=a.issues.length,v=f._zod.check(a);if(v instanceof Promise&&s?.async===!1)throw new Oe;if(m||v instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await v,a.issues.length!==b&&(l||(l=Se(a,b)))});else{if(a.issues.length===b)continue;l||(l=Se(a,b))}}return m?m.then(()=>a):a},i=(a,u,s)=>{if(Se(a))return a.aborted=!0,a;const l=e(u,o,s);if(l instanceof Promise){if(s.async===!1)throw new Oe;return l.then(m=>t._zod.parse(m,s))}return t._zod.parse(l,s)};t._zod.run=(a,u)=>{if(u.skipChecks)return t._zod.parse(a,u);if(u.direction==="backward"){const l=t._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(m=>i(m,a,u)):i(l,a,u)}const s=t._zod.parse(a,u);if(s instanceof Promise){if(u.async===!1)throw new Oe;return s.then(l=>e(l,o,u))}return e(s,o,u)}}t["~standard"]={validate:e=>{try{const i=ro(t,e);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return io(t,e).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),ct=c("$ZodString",(t,n)=>{S.init(t,n),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??xo(t._zod.bag),t._zod.parse=(r,o)=>{if(n.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),P=c("$ZodStringFormat",(t,n)=>{st.init(t,n),ct.init(t,n)}),aa=c("$ZodGUID",(t,n)=>{n.pattern??(n.pattern=fo),P.init(t,n)}),ua=c("$ZodUUID",(t,n)=>{if(n.version){const o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(o===void 0)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=Ze(o))}else n.pattern??(n.pattern=Ze());P.init(t,n)}),sa=c("$ZodEmail",(t,n)=>{n.pattern??(n.pattern=go),P.init(t,n)}),ca=c("$ZodURL",(t,n)=>{P.init(t,n),t._zod.check=r=>{try{const o=r.value.trim(),e=new URL(o);n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(e.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:jn.source,input:r.value,inst:t,continue:!n.abort})),n.protocol&&(n.protocol.lastIndex=0,n.protocol.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:r.value,inst:t,continue:!n.abort})),n.normalize?r.value=e.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!n.abort})}}}),la=c("$ZodEmoji",(t,n)=>{n.pattern??(n.pattern=vo()),P.init(t,n)}),da=c("$ZodNanoID",(t,n)=>{n.pattern??(n.pattern=lo),P.init(t,n)}),ma=c("$ZodCUID",(t,n)=>{n.pattern??(n.pattern=oo),P.init(t,n)}),fa=c("$ZodCUID2",(t,n)=>{n.pattern??(n.pattern=ao),P.init(t,n)}),ga=c("$ZodULID",(t,n)=>{n.pattern??(n.pattern=uo),P.init(t,n)}),pa=c("$ZodXID",(t,n)=>{n.pattern??(n.pattern=so),P.init(t,n)}),va=c("$ZodKSUID",(t,n)=>{n.pattern??(n.pattern=co),P.init(t,n)}),ha=c("$ZodISODateTime",(t,n)=>{n.pattern??(n.pattern=jo(n)),P.init(t,n)}),$a=c("$ZodISODate",(t,n)=>{n.pattern??(n.pattern=So),P.init(t,n)}),ba=c("$ZodISOTime",(t,n)=>{n.pattern??(n.pattern=Oo(n)),P.init(t,n)}),_a=c("$ZodISODuration",(t,n)=>{n.pattern??(n.pattern=mo),P.init(t,n)}),ya=c("$ZodIPv4",(t,n)=>{n.pattern??(n.pattern=ho),P.init(t,n),t._zod.onattach.push(r=>{const o=r._zod.bag;o.format="ipv4"})}),wa=c("$ZodIPv6",(t,n)=>{n.pattern??(n.pattern=$o),P.init(t,n),t._zod.onattach.push(r=>{const o=r._zod.bag;o.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!n.abort})}}}),ka=c("$ZodCIDRv4",(t,n)=>{n.pattern??(n.pattern=bo),P.init(t,n)}),Ia=c("$ZodCIDRv6",(t,n)=>{n.pattern??(n.pattern=_o),P.init(t,n),t._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[e,i]=o;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!n.abort})}}});function Un(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Sa=c("$ZodBase64",(t,n)=>{n.pattern??(n.pattern=yo),P.init(t,n),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{Un(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!n.abort})}});function za(t){if(!On.test(t))return!1;const n=t.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=n.padEnd(Math.ceil(n.length/4)*4,"=");return Un(r)}const Oa=c("$ZodBase64URL",(t,n)=>{n.pattern??(n.pattern=On),P.init(t,n),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{za(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!n.abort})}}),ja=c("$ZodE164",(t,n)=>{n.pattern??(n.pattern=ko),P.init(t,n)});function xa(t,n=null){try{const r=t.split(".");if(r.length!==3)return!1;const[o]=r;if(!o)return!1;const e=JSON.parse(atob(o));return!("typ"in e&&e?.typ!=="JWT"||!e.alg||n&&(!("alg"in e)||e.alg!==n))}catch{return!1}}const Na=c("$ZodJWT",(t,n)=>{P.init(t,n),t._zod.check=r=>{xa(r.value,n.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!n.abort})}}),Ea=c("$ZodCustomStringFormat",(t,n)=>{P.init(t,n),t._zod.check=r=>{n.fn(r.value)||r.issues.push({code:"invalid_format",format:n.format,input:r.value,inst:t,continue:!n.abort})}}),Tn=c("$ZodNumber",(t,n)=>{S.init(t,n),t._zod.pattern=t._zod.bag.pattern??Uo,t._zod.parse=(r,o)=>{if(n.coerce)try{r.value=Number(r.value)}catch{}const e=r.value;if(typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e))return r;const i=typeof e=="number"?Number.isNaN(e)?"NaN":Number.isFinite(e)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:e,inst:t,...i?{received:i}:{}}),r}}),Ua=c("$ZodNumber",(t,n)=>{Co.init(t,n),Tn.init(t,n)}),Dn=c("$ZodBoolean",(t,n)=>{S.init(t,n),t._zod.pattern=To,t._zod.parse=(r,o)=>{if(n.coerce)try{r.value=!!r.value}catch{}const e=r.value;return typeof e=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:e,inst:t}),r}}),An=c("$ZodBigInt",(t,n)=>{S.init(t,n),t._zod.pattern=No,t._zod.parse=(r,o)=>{if(n.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),Ta=c("$ZodBigInt",(t,n)=>{Mo.init(t,n),An.init(t,n)}),Da=c("$ZodSymbol",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>{const e=r.value;return typeof e=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:e,inst:t}),r}}),Aa=c("$ZodUndefined",(t,n)=>{S.init(t,n),t._zod.pattern=Ao,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,o)=>{const e=r.value;return typeof e>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:e,inst:t}),r}}),Pa=c("$ZodNull",(t,n)=>{S.init(t,n),t._zod.pattern=Do,t._zod.values=new Set([null]),t._zod.parse=(r,o)=>{const e=r.value;return e===null||r.issues.push({expected:"null",code:"invalid_type",input:e,inst:t}),r}}),Za=c("$ZodAny",(t,n)=>{S.init(t,n),t._zod.parse=r=>r}),Ra=c("$ZodUnknown",(t,n)=>{S.init(t,n),t._zod.parse=r=>r}),Fa=c("$ZodNever",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),La=c("$ZodVoid",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>{const e=r.value;return typeof e>"u"||r.issues.push({expected:"void",code:"invalid_type",input:e,inst:t}),r}}),Ca=c("$ZodDate",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>{if(n.coerce)try{r.value=new Date(r.value)}catch{}const e=r.value,i=e instanceof Date;return i&&!Number.isNaN(e.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:e,...i?{received:"Invalid Date"}:{},inst:t}),r}});function ui(t,n,r){t.issues.length&&n.issues.push(...oe(r,t.issues)),n.value[r]=t.value}const Ma=c("$ZodArray",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>{const e=r.value;if(!Array.isArray(e))return r.issues.push({expected:"array",code:"invalid_type",input:e,inst:t}),r;r.value=Array(e.length);const i=[];for(let a=0;a<e.length;a++){const u=e[a],s=n.element._zod.run({value:u,issues:[]},o);s instanceof Promise?i.push(s.then(l=>ui(l,r,a))):ui(s,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Ot(t,n,r,o){t.issues.length&&n.issues.push(...oe(r,t.issues)),t.value===void 0?r in o&&(n.value[r]=void 0):n.value[r]=t.value}function Ga(t){const n=Object.keys(t.shape);for(const o of n)if(!t.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const r=Li(t.shape);return{...t,keys:n,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(r)}}function Ja(t,n,r,o,e,i){const a=[],u=e.keySet,s=e.catchall._zod,l=s.def.type;for(const m of Object.keys(n)){if(u.has(m))continue;if(l==="never"){a.push(m);continue}const f=s.run({value:n[m],issues:[]},o);f instanceof Promise?t.push(f.then(b=>Ot(b,r,m,n))):Ot(f,r,m,n)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:n,inst:i}),t.length?Promise.all(t).then(()=>r):r}const Ba=c("$ZodObject",(t,n)=>{if(S.init(t,n),!Object.getOwnPropertyDescriptor(n,"shape")?.get){const u=n.shape;Object.defineProperty(n,"shape",{get:()=>{const s={...u};return Object.defineProperty(n,"shape",{value:s}),s}})}const o=tt(()=>Ga(n));O(t._zod,"propValues",()=>{const u=n.shape,s={};for(const l in u){const m=u[l]._zod;if(m.values){s[l]??(s[l]=new Set);for(const f of m.values)s[l].add(f)}}return s});const e=Ae,i=n.catchall;let a;t._zod.parse=(u,s)=>{a??(a=o.value);const l=u.value;if(!e(l))return u.issues.push({expected:"object",code:"invalid_type",input:l,inst:t}),u;u.value={};const m=[],f=a.shape;for(const b of a.keys){const d=f[b]._zod.run({value:l[b],issues:[]},s);d instanceof Promise?m.push(d.then(h=>Ot(h,u,b,l))):Ot(d,u,b,l)}return i?Ja(m,l,u,s,o.value,t):m.length?Promise.all(m).then(()=>u):u}}),Va=c("$ZodObjectJIT",(t,n)=>{Ba.init(t,n);const r=t._zod.parse,o=tt(()=>Ga(n)),e=b=>{const v=new ia(["shape","payload","ctx"]),d=o.value,h=T=>{const D=nn(T);return`shape[${D}]._zod.run({ value: input[${D}], issues: [] }, ctx)`};v.write("const input = payload.value;");const y=Object.create(null);let U=0;for(const T of d.keys)y[T]=`key_${U++}`;v.write("const newResult = {};");for(const T of d.keys){const D=y[T],re=nn(T);v.write(`const ${D} = ${h(T)};`),v.write(`
6
+ if (${D}.issues.length) {
7
+ payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
8
+ ...iss,
9
+ path: iss.path ? [${re}, ...iss.path] : [${re}]
10
+ })));
11
+ }
12
+
13
+
14
+ if (${D}.value === undefined) {
15
+ if (${re} in input) {
16
+ newResult[${re}] = undefined;
17
+ }
18
+ } else {
19
+ newResult[${re}] = ${D}.value;
20
+ }
21
+
22
+ `)}v.write("payload.value = newResult;"),v.write("return payload;");const x=v.compile();return(T,D)=>x(b,T,D)};let i;const a=Ae,u=!It.jitless,l=u&&Ri.value,m=n.catchall;let f;t._zod.parse=(b,v)=>{f??(f=o.value);const d=b.value;return a(d)?u&&l&&v?.async===!1&&v.jitless!==!0?(i||(i=e(n.shape)),b=i(b,v),m?Ja([],d,b,v,f,t):b):r(b,v):(b.issues.push({expected:"object",code:"invalid_type",input:d,inst:t}),b)}});function si(t,n,r,o){for(const i of t)if(i.issues.length===0)return n.value=i.value,n;const e=t.filter(i=>!Se(i));return e.length===1?(n.value=e[0].value,e[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:r,errors:t.map(i=>i.issues.map(a=>ue(a,o,H())))}),n)}const Pn=c("$ZodUnion",(t,n)=>{S.init(t,n),O(t._zod,"optin",()=>n.options.some(e=>e._zod.optin==="optional")?"optional":void 0),O(t._zod,"optout",()=>n.options.some(e=>e._zod.optout==="optional")?"optional":void 0),O(t._zod,"values",()=>{if(n.options.every(e=>e._zod.values))return new Set(n.options.flatMap(e=>Array.from(e._zod.values)))}),O(t._zod,"pattern",()=>{if(n.options.every(e=>e._zod.pattern)){const e=n.options.map(i=>i._zod.pattern);return new RegExp(`^(${e.map(i=>At(i.source)).join("|")})$`)}});const r=n.options.length===1,o=n.options[0]._zod.run;t._zod.parse=(e,i)=>{if(r)return o(e,i);let a=!1;const u=[];for(const s of n.options){const l=s._zod.run({value:e.value,issues:[]},i);if(l instanceof Promise)u.push(l),a=!0;else{if(l.issues.length===0)return l;u.push(l)}}return a?Promise.all(u).then(s=>si(s,e,t,i)):si(u,e,t,i)}}),Ka=c("$ZodDiscriminatedUnion",(t,n)=>{Pn.init(t,n);const r=t._zod.parse;O(t._zod,"propValues",()=>{const e={};for(const i of n.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(i)}"`);for(const[u,s]of Object.entries(a)){e[u]||(e[u]=new Set);for(const l of s)e[u].add(l)}}return e});const o=tt(()=>{const e=n.options,i=new Map;for(const a of e){const u=a._zod.propValues?.[n.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(a)}"`);for(const s of u){if(i.has(s))throw new Error(`Duplicate discriminator value "${String(s)}"`);i.set(s,a)}}return i});t._zod.parse=(e,i)=>{const a=e.value;if(!Ae(a))return e.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),e;const u=o.value.get(a?.[n.discriminator]);return u?u._zod.run(e,i):n.unionFallback?r(e,i):(e.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,input:a,path:[n.discriminator],inst:t}),e)}}),Wa=c("$ZodIntersection",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>{const e=r.value,i=n.left._zod.run({value:e,issues:[]},o),a=n.right._zod.run({value:e,issues:[]},o);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([s,l])=>ci(r,s,l)):ci(r,i,a)}});function an(t,n){if(t===n)return{valid:!0,data:t};if(t instanceof Date&&n instanceof Date&&+t==+n)return{valid:!0,data:t};if(je(t)&&je(n)){const r=Object.keys(n),o=Object.keys(t).filter(i=>r.indexOf(i)!==-1),e={...t,...n};for(const i of o){const a=an(t[i],n[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};e[i]=a.data}return{valid:!0,data:e}}if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let o=0;o<t.length;o++){const e=t[o],i=n[o],a=an(e,i);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ci(t,n,r){if(n.issues.length&&t.issues.push(...n.issues),r.issues.length&&t.issues.push(...r.issues),Se(t))return t;const o=an(n.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return t.value=o.data,t}const Zn=c("$ZodTuple",(t,n)=>{S.init(t,n);const r=n.items,o=r.length-[...r].reverse().findIndex(e=>e._zod.optin!=="optional");t._zod.parse=(e,i)=>{const a=e.value;if(!Array.isArray(a))return e.issues.push({input:a,inst:t,expected:"tuple",code:"invalid_type"}),e;e.value=[];const u=[];if(!n.rest){const l=a.length>r.length,m=a.length<o-1;if(l||m)return e.issues.push({...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},input:a,inst:t,origin:"array"}),e}let s=-1;for(const l of r){if(s++,s>=a.length&&s>=o)continue;const m=l._zod.run({value:a[s],issues:[]},i);m instanceof Promise?u.push(m.then(f=>ht(f,e,s))):ht(m,e,s)}if(n.rest){const l=a.slice(r.length);for(const m of l){s++;const f=n.rest._zod.run({value:m,issues:[]},i);f instanceof Promise?u.push(f.then(b=>ht(b,e,s))):ht(f,e,s)}}return u.length?Promise.all(u).then(()=>e):e}});function ht(t,n,r){t.issues.length&&n.issues.push(...oe(r,t.issues)),n.value[r]=t.value}const qa=c("$ZodRecord",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>{const e=r.value;if(!je(e))return r.issues.push({expected:"record",code:"invalid_type",input:e,inst:t}),r;const i=[];if(n.keyType._zod.values){const a=n.keyType._zod.values;r.value={};for(const s of a)if(typeof s=="string"||typeof s=="number"||typeof s=="symbol"){const l=n.valueType._zod.run({value:e[s],issues:[]},o);l instanceof Promise?i.push(l.then(m=>{m.issues.length&&r.issues.push(...oe(s,m.issues)),r.value[s]=m.value})):(l.issues.length&&r.issues.push(...oe(s,l.issues)),r.value[s]=l.value)}let u;for(const s in e)a.has(s)||(u=u??[],u.push(s));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:e,inst:t,keys:u})}else{r.value={};for(const a of Reflect.ownKeys(e)){if(a==="__proto__")continue;const u=n.keyType._zod.run({value:a,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(l=>ue(l,o,H())),input:a,path:[a],inst:t}),r.value[u.value]=u.value;continue}const s=n.valueType._zod.run({value:e[a],issues:[]},o);s instanceof Promise?i.push(s.then(l=>{l.issues.length&&r.issues.push(...oe(a,l.issues)),r.value[u.value]=l.value})):(s.issues.length&&r.issues.push(...oe(a,s.issues)),r.value[u.value]=s.value)}}return i.length?Promise.all(i).then(()=>r):r}}),Xa=c("$ZodMap",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>{const e=r.value;if(!(e instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:e,inst:t}),r;const i=[];r.value=new Map;for(const[a,u]of e){const s=n.keyType._zod.run({value:a,issues:[]},o),l=n.valueType._zod.run({value:u,issues:[]},o);s instanceof Promise||l instanceof Promise?i.push(Promise.all([s,l]).then(([m,f])=>{li(m,f,r,a,e,t,o)})):li(s,l,r,a,e,t,o)}return i.length?Promise.all(i).then(()=>r):r}});function li(t,n,r,o,e,i,a){t.issues.length&&(zt.has(typeof o)?r.issues.push(...oe(o,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:e,inst:i,issues:t.issues.map(u=>ue(u,a,H()))})),n.issues.length&&(zt.has(typeof o)?r.issues.push(...oe(o,n.issues)):r.issues.push({origin:"map",code:"invalid_element",input:e,inst:i,key:o,issues:n.issues.map(u=>ue(u,a,H()))})),r.value.set(t.value,n.value)}const Ha=c("$ZodSet",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>{const e=r.value;if(!(e instanceof Set))return r.issues.push({input:e,inst:t,expected:"set",code:"invalid_type"}),r;const i=[];r.value=new Set;for(const a of e){const u=n.valueType._zod.run({value:a,issues:[]},o);u instanceof Promise?i.push(u.then(s=>di(s,r))):di(u,r)}return i.length?Promise.all(i).then(()=>r):r}});function di(t,n){t.issues.length&&n.issues.push(...t.issues),n.value.add(t.value)}const Ya=c("$ZodEnum",(t,n)=>{S.init(t,n);const r=gn(n.entries),o=new Set(r);t._zod.values=o,t._zod.pattern=new RegExp(`^(${r.filter(e=>zt.has(typeof e)).map(e=>typeof e=="string"?ye(e):e.toString()).join("|")})$`),t._zod.parse=(e,i)=>{const a=e.value;return o.has(a)||e.issues.push({code:"invalid_value",values:r,input:a,inst:t}),e}}),Qa=c("$ZodLiteral",(t,n)=>{if(S.init(t,n),n.values.length===0)throw new Error("Cannot create literal schema with no valid values");t._zod.values=new Set(n.values),t._zod.pattern=new RegExp(`^(${n.values.map(r=>typeof r=="string"?ye(r):r?ye(r.toString()):String(r)).join("|")})$`),t._zod.parse=(r,o)=>{const e=r.value;return t._zod.values.has(e)||r.issues.push({code:"invalid_value",values:n.values,input:e,inst:t}),r}}),eu=c("$ZodFile",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>{const e=r.value;return e instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:e,inst:t}),r}}),tu=c("$ZodTransform",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Dt(t.constructor.name);const e=n.transform(r.value,r);if(o.async)return(e instanceof Promise?e:Promise.resolve(e)).then(a=>(r.value=a,r));if(e instanceof Promise)throw new Oe;return r.value=e,r}});function mi(t,n){return t.issues.length&&n===void 0?{issues:[],value:void 0}:t}const nu=c("$ZodOptional",(t,n)=>{S.init(t,n),t._zod.optin="optional",t._zod.optout="optional",O(t._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),O(t._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${At(r.source)})?$`):void 0}),t._zod.parse=(r,o)=>{if(n.innerType._zod.optin==="optional"){const e=n.innerType._zod.run(r,o);return e instanceof Promise?e.then(i=>mi(i,r.value)):mi(e,r.value)}return r.value===void 0?r:n.innerType._zod.run(r,o)}}),ru=c("$ZodNullable",(t,n)=>{S.init(t,n),O(t._zod,"optin",()=>n.innerType._zod.optin),O(t._zod,"optout",()=>n.innerType._zod.optout),O(t._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${At(r.source)}|null)$`):void 0}),O(t._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),t._zod.parse=(r,o)=>r.value===null?r:n.innerType._zod.run(r,o)}),iu=c("$ZodDefault",(t,n)=>{S.init(t,n),t._zod.optin="optional",O(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return n.innerType._zod.run(r,o);if(r.value===void 0)return r.value=n.defaultValue,r;const e=n.innerType._zod.run(r,o);return e instanceof Promise?e.then(i=>fi(i,n)):fi(e,n)}});function fi(t,n){return t.value===void 0&&(t.value=n.defaultValue),t}const ou=c("$ZodPrefault",(t,n)=>{S.init(t,n),t._zod.optin="optional",O(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=n.defaultValue),n.innerType._zod.run(r,o))}),au=c("$ZodNonOptional",(t,n)=>{S.init(t,n),O(t._zod,"values",()=>{const r=n.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),t._zod.parse=(r,o)=>{const e=n.innerType._zod.run(r,o);return e instanceof Promise?e.then(i=>gi(i,t)):gi(e,t)}});function gi(t,n){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:n}),t}const uu=c("$ZodSuccess",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Dt("ZodSuccess");const e=n.innerType._zod.run(r,o);return e instanceof Promise?e.then(i=>(r.value=i.issues.length===0,r)):(r.value=e.issues.length===0,r)}}),su=c("$ZodCatch",(t,n)=>{S.init(t,n),O(t._zod,"optin",()=>n.innerType._zod.optin),O(t._zod,"optout",()=>n.innerType._zod.optout),O(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return n.innerType._zod.run(r,o);const e=n.innerType._zod.run(r,o);return e instanceof Promise?e.then(i=>(r.value=i.value,i.issues.length&&(r.value=n.catchValue({...r,error:{issues:i.issues.map(a=>ue(a,o,H()))},input:r.value}),r.issues=[]),r)):(r.value=e.value,e.issues.length&&(r.value=n.catchValue({...r,error:{issues:e.issues.map(i=>ue(i,o,H()))},input:r.value}),r.issues=[]),r)}}),cu=c("$ZodNaN",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),lu=c("$ZodPipe",(t,n)=>{S.init(t,n),O(t._zod,"values",()=>n.in._zod.values),O(t._zod,"optin",()=>n.in._zod.optin),O(t._zod,"optout",()=>n.out._zod.optout),O(t._zod,"propValues",()=>n.in._zod.propValues),t._zod.parse=(r,o)=>{if(o.direction==="backward"){const i=n.out._zod.run(r,o);return i instanceof Promise?i.then(a=>$t(a,n.in,o)):$t(i,n.in,o)}const e=n.in._zod.run(r,o);return e instanceof Promise?e.then(i=>$t(i,n.out,o)):$t(e,n.out,o)}});function $t(t,n,r){return t.issues.length?(t.aborted=!0,t):n._zod.run({value:t.value,issues:t.issues},r)}const Rn=c("$ZodCodec",(t,n)=>{S.init(t,n),O(t._zod,"values",()=>n.in._zod.values),O(t._zod,"optin",()=>n.in._zod.optin),O(t._zod,"optout",()=>n.out._zod.optout),O(t._zod,"propValues",()=>n.in._zod.propValues),t._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){const i=n.in._zod.run(r,o);return i instanceof Promise?i.then(a=>bt(a,n,o)):bt(i,n,o)}else{const i=n.out._zod.run(r,o);return i instanceof Promise?i.then(a=>bt(a,n,o)):bt(i,n,o)}}});function bt(t,n,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){const e=n.transform(t.value,t);return e instanceof Promise?e.then(i=>_t(t,i,n.out,r)):_t(t,e,n.out,r)}else{const e=n.reverseTransform(t.value,t);return e instanceof Promise?e.then(i=>_t(t,i,n.in,r)):_t(t,e,n.in,r)}}function _t(t,n,r,o){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:n,issues:t.issues},o)}const du=c("$ZodReadonly",(t,n)=>{S.init(t,n),O(t._zod,"propValues",()=>n.innerType._zod.propValues),O(t._zod,"values",()=>n.innerType._zod.values),O(t._zod,"optin",()=>n.innerType._zod.optin),O(t._zod,"optout",()=>n.innerType._zod.optout),t._zod.parse=(r,o)=>{if(o.direction==="backward")return n.innerType._zod.run(r,o);const e=n.innerType._zod.run(r,o);return e instanceof Promise?e.then(pi):pi(e)}});function pi(t){return t.value=Object.freeze(t.value),t}const mu=c("$ZodTemplateLiteral",(t,n)=>{S.init(t,n);const r=[];for(const o of n.parts)if(typeof o=="object"&&o!==null){if(!o._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);const e=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!e)throw new Error(`Invalid template literal part: ${o._zod.traits}`);const i=e.startsWith("^")?1:0,a=e.endsWith("$")?e.length-1:e.length;r.push(e.slice(i,a))}else if(o===null||Fi.has(typeof o))r.push(ye(`${o}`));else throw new Error(`Invalid template literal part: ${o}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(o,e)=>typeof o.value!="string"?(o.issues.push({input:o.value,inst:t,expected:"template_literal",code:"invalid_type"}),o):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(o.value)||o.issues.push({input:o.value,inst:t,code:"invalid_format",format:n.format??"template_literal",pattern:t._zod.pattern.source}),o)}),fu=c("$ZodFunction",(t,n)=>(S.init(t,n),t._def=n,t._zod.def=n,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...o){const e=t._def.input?rn(t._def.input,o):o,i=Reflect.apply(r,this,e);return t._def.output?rn(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...o){const e=t._def.input?await on(t._def.input,o):o,i=await Reflect.apply(r,this,e);return t._def.output?await on(t._def.output,i):i}},t._zod.parse=(r,o)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{const o=t.constructor;return Array.isArray(r[0])?new o({type:"function",input:new Zn({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new o({type:"function",input:r[0],output:t._def.output})},t.output=r=>{const o=t.constructor;return new o({type:"function",input:t._def.input,output:r})},t)),gu=c("$ZodPromise",(t,n)=>{S.init(t,n),t._zod.parse=(r,o)=>Promise.resolve(r.value).then(e=>n.innerType._zod.run({value:e,issues:[]},o))}),pu=c("$ZodLazy",(t,n)=>{S.init(t,n),O(t._zod,"innerType",()=>n.getter()),O(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),O(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),O(t._zod,"optin",()=>t._zod.innerType._zod.optin??void 0),O(t._zod,"optout",()=>t._zod.innerType._zod.optout??void 0),t._zod.parse=(r,o)=>t._zod.innerType._zod.run(r,o)}),vu=c("$ZodCustom",(t,n)=>{C.init(t,n),S.init(t,n),t._zod.parse=(r,o)=>r,t._zod.check=r=>{const o=r.value,e=n.fn(o);if(e instanceof Promise)return e.then(i=>vi(i,r,o,t));vi(e,r,o,t)}});function vi(t,n,r,o){if(!t){const e={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),n.issues.push(Pe(e))}}const $l=()=>{const t={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${e.expected}، ولكن تم إدخال ${r(e.input)}`;case"invalid_value":return e.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${k(e.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?` أكبر من اللازم: يفترض أن تكون ${e.origin??"القيمة"} ${i} ${e.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${e.origin??"القيمة"} ${i} ${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${i} ${e.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${i} ${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${e.prefix}"`:i.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${i.suffix}"`:i.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${i.includes}"`:i.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${i.pattern}`:`${o[i.format]??e.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${e.divisor}`;case"unrecognized_keys":return`معرف${e.keys.length>1?"ات":""} غريب${e.keys.length>1?"ة":""}: ${$(e.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${e.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${e.origin}`;default:return"مدخل غير مقبول"}}};function bl(){return{localeError:$l()}}const _l=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${e.expected}, daxil olan ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Yanlış dəyər: gözlənilən ${k(e.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Çox böyük: gözlənilən ${e.origin??"dəyər"} ${i}${e.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${e.origin??"dəyər"} ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Çox kiçik: gözlənilən ${e.origin} ${i}${e.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${e.origin} ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Yanlış mətn: "${i.prefix}" ilə başlamalıdır`:i.format==="ends_with"?`Yanlış mətn: "${i.suffix}" ilə bitməlidir`:i.format==="includes"?`Yanlış mətn: "${i.includes}" daxil olmalıdır`:i.format==="regex"?`Yanlış mətn: ${i.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${o[i.format]??e.format}`}case"not_multiple_of":return`Yanlış ədəd: ${e.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${e.keys.length>1?"lar":""}: ${$(e.keys,", ")}`;case"invalid_key":return`${e.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${e.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function yl(){return{localeError:_l()}}function hi(t,n,r,o){const e=Math.abs(t),i=e%10,a=e%100;return a>=11&&a<=19?o:i===1?n:i>=2&&i<=4?r:o}const wl=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"лік";case"object":{if(Array.isArray(e))return"масіў";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${e.expected}, атрымана ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Няправільны ўвод: чакалася ${k(e.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);if(a){const u=Number(e.maximum),s=hi(u,a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${e.origin??"значэнне"} павінна ${a.verb} ${i}${e.maximum.toString()} ${s}`}return`Занадта вялікі: чакалася, што ${e.origin??"значэнне"} павінна быць ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);if(a){const u=Number(e.minimum),s=hi(u,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${e.origin} павінна ${a.verb} ${i}${e.minimum.toString()} ${s}`}return`Занадта малы: чакалася, што ${e.origin} павінна быць ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${i.prefix}"`:i.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${i.suffix}"`:i.format==="includes"?`Няправільны радок: павінен змяшчаць "${i.includes}"`:i.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${i.pattern}`:`Няправільны ${o[i.format]??e.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${e.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${e.keys.length>1?"ключы":"ключ"}: ${$(e.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${e.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${e.origin}`;default:return"Няправільны ўвод"}}};function kl(){return{localeError:wl()}}const Il=t=>{const n=typeof t;switch(n){case"number":return Number.isNaN(t)?"NaN":"число";case"object":{if(Array.isArray(t))return"масив";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return n},Sl=()=>{const t={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function n(o){return t[o]??null}const 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 o=>{switch(o.code){case"invalid_type":return`Невалиден вход: очакван ${o.expected}, получен ${Il(o.input)}`;case"invalid_value":return o.values.length===1?`Невалиден вход: очакван ${k(o.values[0])}`:`Невалидна опция: очаквано едно от ${$(o.values,"|")}`;case"too_big":{const e=o.inclusive?"<=":"<",i=n(o.origin);return i?`Твърде голямо: очаква се ${o.origin??"стойност"} да съдържа ${e}${o.maximum.toString()} ${i.unit??"елемента"}`:`Твърде голямо: очаква се ${o.origin??"стойност"} да бъде ${e}${o.maximum.toString()}`}case"too_small":{const e=o.inclusive?">=":">",i=n(o.origin);return i?`Твърде малко: очаква се ${o.origin} да съдържа ${e}${o.minimum.toString()} ${i.unit}`:`Твърде малко: очаква се ${o.origin} да бъде ${e}${o.minimum.toString()}`}case"invalid_format":{const e=o;if(e.format==="starts_with")return`Невалиден низ: трябва да започва с "${e.prefix}"`;if(e.format==="ends_with")return`Невалиден низ: трябва да завършва с "${e.suffix}"`;if(e.format==="includes")return`Невалиден низ: трябва да включва "${e.includes}"`;if(e.format==="regex")return`Невалиден низ: трябва да съвпада с ${e.pattern}`;let i="Невалиден";return e.format==="emoji"&&(i="Невалидно"),e.format==="datetime"&&(i="Невалидно"),e.format==="date"&&(i="Невалидна"),e.format==="time"&&(i="Невалидно"),e.format==="duration"&&(i="Невалидна"),`${i} ${r[e.format]??o.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${o.divisor}`;case"unrecognized_keys":return`Неразпознат${o.keys.length>1?"и":""} ключ${o.keys.length>1?"ове":""}: ${$(o.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${o.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${o.origin}`;default:return"Невалиден вход"}}};function zl(){return{localeError:Sl()}}const Ol=()=>{const t={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Tipus invàlid: s'esperava ${e.expected}, s'ha rebut ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Valor invàlid: s'esperava ${k(e.values[0])}`:`Opció invàlida: s'esperava una de ${$(e.values," o ")}`;case"too_big":{const i=e.inclusive?"com a màxim":"menys de",a=n(e.origin);return a?`Massa gran: s'esperava que ${e.origin??"el valor"} contingués ${i} ${e.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${e.origin??"el valor"} fos ${i} ${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?"com a mínim":"més de",a=n(e.origin);return a?`Massa petit: s'esperava que ${e.origin} contingués ${i} ${e.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${e.origin} fos ${i} ${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Format invàlid: ha de començar amb "${i.prefix}"`:i.format==="ends_with"?`Format invàlid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format invàlid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${i.pattern}`:`Format invàlid per a ${o[i.format]??e.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${e.divisor}`;case"unrecognized_keys":return`Clau${e.keys.length>1?"s":""} no reconeguda${e.keys.length>1?"s":""}: ${$(e.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${e.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${e.origin}`;default:return"Entrada invàlida"}}};function jl(){return{localeError:Ol()}}const xl=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"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(e))return"pole";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Neplatný vstup: očekáváno ${e.expected}, obdrženo ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Neplatný vstup: očekáváno ${k(e.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Hodnota je příliš velká: ${e.origin??"hodnota"} musí mít ${i}${e.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${e.origin??"hodnota"} musí být ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Hodnota je příliš malá: ${e.origin??"hodnota"} musí mít ${i}${e.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${e.origin??"hodnota"} musí být ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Neplatný řetězec: musí začínat na "${i.prefix}"`:i.format==="ends_with"?`Neplatný řetězec: musí končit na "${i.suffix}"`:i.format==="includes"?`Neplatný řetězec: musí obsahovat "${i.includes}"`:i.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${i.pattern}`:`Neplatný formát ${o[i.format]??e.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${e.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${$(e.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${e.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${e.origin}`;default:return"Neplatný vstup"}}};function Nl(){return{localeError:xl()}}const El=()=>{const t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},n={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function r(a){return t[a]??null}function o(a){return n[a]??a}const e=a=>{const u=typeof a;switch(u){case"number":return Number.isNaN(a)?"NaN":"tal";case"object":return Array.isArray(a)?"liste":a===null?"null":Object.getPrototypeOf(a)!==Object.prototype&&a.constructor?a.constructor.name:"objekt"}return u},i={regex:"input",email:"e-mailadresse",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 klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return a=>{switch(a.code){case"invalid_type":return`Ugyldigt input: forventede ${o(a.expected)}, fik ${o(e(a.input))}`;case"invalid_value":return a.values.length===1?`Ugyldig værdi: forventede ${k(a.values[0])}`:`Ugyldigt valg: forventede en af følgende ${$(a.values,"|")}`;case"too_big":{const u=a.inclusive?"<=":"<",s=r(a.origin),l=o(a.origin);return s?`For stor: forventede ${l??"value"} ${s.verb} ${u} ${a.maximum.toString()} ${s.unit??"elementer"}`:`For stor: forventede ${l??"value"} havde ${u} ${a.maximum.toString()}`}case"too_small":{const u=a.inclusive?">=":">",s=r(a.origin),l=o(a.origin);return s?`For lille: forventede ${l} ${s.verb} ${u} ${a.minimum.toString()} ${s.unit}`:`For lille: forventede ${l} havde ${u} ${a.minimum.toString()}`}case"invalid_format":{const u=a;return u.format==="starts_with"?`Ugyldig streng: skal starte med "${u.prefix}"`:u.format==="ends_with"?`Ugyldig streng: skal ende med "${u.suffix}"`:u.format==="includes"?`Ugyldig streng: skal indeholde "${u.includes}"`:u.format==="regex"?`Ugyldig streng: skal matche mønsteret ${u.pattern}`:`Ugyldig ${i[u.format]??a.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${a.divisor}`;case"unrecognized_keys":return`${a.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${$(a.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${a.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${a.origin}`;default:return"Ugyldigt input"}}};function Ul(){return{localeError:El()}}const Tl=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"Zahl";case"object":{if(Array.isArray(e))return"Array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${e.expected}, erhalten ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Ungültige Eingabe: erwartet ${k(e.values[0])}`:`Ungültige Option: erwartet eine von ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Zu groß: erwartet, dass ${e.origin??"Wert"} ${i}${e.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${e.origin??"Wert"} ${i}${e.maximum.toString()} ist`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Zu klein: erwartet, dass ${e.origin} ${i}${e.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${e.origin} ${i}${e.minimum.toString()} ist`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Ungültiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ungültiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ungültiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ungültiger String: muss dem Muster ${i.pattern} entsprechen`:`Ungültig: ${o[i.format]??e.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${e.divisor} sein`;case"unrecognized_keys":return`${e.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${$(e.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${e.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${e.origin}`;default:return"Ungültige Eingabe"}}};function Dl(){return{localeError:Tl()}}const Al=t=>{const n=typeof t;switch(n){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 n},Pl=()=>{const 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 n(o){return t[o]??null}const 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 o=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${Al(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${k(o.values[0])}`:`Invalid option: expected one of ${$(o.values,"|")}`;case"too_big":{const e=o.inclusive?"<=":"<",i=n(o.origin);return i?`Too big: expected ${o.origin??"value"} to have ${e}${o.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${e}${o.maximum.toString()}`}case"too_small":{const e=o.inclusive?">=":">",i=n(o.origin);return i?`Too small: expected ${o.origin} to have ${e}${o.minimum.toString()} ${i.unit}`:`Too small: expected ${o.origin} to be ${e}${o.minimum.toString()}`}case"invalid_format":{const e=o;return e.format==="starts_with"?`Invalid string: must start with "${e.prefix}"`:e.format==="ends_with"?`Invalid string: must end with "${e.suffix}"`:e.format==="includes"?`Invalid string: must include "${e.includes}"`:e.format==="regex"?`Invalid string: must match pattern ${e.pattern}`:`Invalid ${r[e.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${$(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function hu(){return{localeError:Pl()}}const Zl=t=>{const n=typeof t;switch(n){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 n},Rl=()=>{const t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function n(o){return t[o]??null}const r={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 o=>{switch(o.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${o.expected}, riceviĝis ${Zl(o.input)}`;case"invalid_value":return o.values.length===1?`Nevalida enigo: atendiĝis ${k(o.values[0])}`:`Nevalida opcio: atendiĝis unu el ${$(o.values,"|")}`;case"too_big":{const e=o.inclusive?"<=":"<",i=n(o.origin);return i?`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${e}${o.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${e}${o.maximum.toString()}`}case"too_small":{const e=o.inclusive?">=":">",i=n(o.origin);return i?`Tro malgranda: atendiĝis ke ${o.origin} havu ${e}${o.minimum.toString()} ${i.unit}`:`Tro malgranda: atendiĝis ke ${o.origin} estu ${e}${o.minimum.toString()}`}case"invalid_format":{const e=o;return e.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${e.prefix}"`:e.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${e.suffix}"`:e.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${e.includes}"`:e.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${e.pattern}`:`Nevalida ${r[e.format]??o.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${o.divisor}`;case"unrecognized_keys":return`Nekonata${o.keys.length>1?"j":""} ŝlosilo${o.keys.length>1?"j":""}: ${$(o.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${o.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${o.origin}`;default:return"Nevalida enigo"}}};function Fl(){return{localeError:Rl()}}const Ll=()=>{const t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},n={string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};function r(a){return t[a]??null}function o(a){return n[a]??a}const e=a=>{const u=typeof a;switch(u){case"number":return Number.isNaN(a)?"NaN":"number";case"object":return Array.isArray(a)?"array":a===null?"null":Object.getPrototypeOf(a)!==Object.prototype?a.constructor.name:"object"}return u},i={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 ${o(a.expected)}, recibido ${o(e(a.input))}`;case"invalid_value":return a.values.length===1?`Entrada inválida: se esperaba ${k(a.values[0])}`:`Opción inválida: se esperaba una de ${$(a.values,"|")}`;case"too_big":{const u=a.inclusive?"<=":"<",s=r(a.origin),l=o(a.origin);return s?`Demasiado grande: se esperaba que ${l??"valor"} tuviera ${u}${a.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: se esperaba que ${l??"valor"} fuera ${u}${a.maximum.toString()}`}case"too_small":{const u=a.inclusive?">=":">",s=r(a.origin),l=o(a.origin);return s?`Demasiado pequeño: se esperaba que ${l} tuviera ${u}${a.minimum.toString()} ${s.unit}`:`Demasiado pequeño: se esperaba que ${l} fuera ${u}${a.minimum.toString()}`}case"invalid_format":{const u=a;return u.format==="starts_with"?`Cadena inválida: debe comenzar con "${u.prefix}"`:u.format==="ends_with"?`Cadena inválida: debe terminar en "${u.suffix}"`:u.format==="includes"?`Cadena inválida: debe incluir "${u.includes}"`:u.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${u.pattern}`:`Inválido ${i[u.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":""}: ${$(a.keys,", ")}`;case"invalid_key":return`Llave inválida en ${o(a.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${o(a.origin)}`;default:return"Entrada inválida"}}};function Cl(){return{localeError:Ll()}}const Ml=()=>{const t={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"عدد";case"object":{if(Array.isArray(e))return"آرایه";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${e.expected} می‌بود، ${r(e.input)} دریافت شد`;case"invalid_value":return e.values.length===1?`ورودی نامعتبر: می‌بایست ${k(e.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${$(e.values,"|")} می‌بود`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`خیلی بزرگ: ${e.origin??"مقدار"} باید ${i}${e.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${e.origin??"مقدار"} باید ${i}${e.maximum.toString()} باشد`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`خیلی کوچک: ${e.origin} باید ${i}${e.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${e.origin} باید ${i}${e.minimum.toString()} باشد`}case"invalid_format":{const i=e;return i.format==="starts_with"?`رشته نامعتبر: باید با "${i.prefix}" شروع شود`:i.format==="ends_with"?`رشته نامعتبر: باید با "${i.suffix}" تمام شود`:i.format==="includes"?`رشته نامعتبر: باید شامل "${i.includes}" باشد`:i.format==="regex"?`رشته نامعتبر: باید با الگوی ${i.pattern} مطابقت داشته باشد`:`${o[i.format]??e.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${e.divisor} باشد`;case"unrecognized_keys":return`کلید${e.keys.length>1?"های":""} ناشناس: ${$(e.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${e.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${e.origin}`;default:return"ورودی نامعتبر"}}};function Gl(){return{localeError:Ml()}}const Jl=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${e.expected}, oli ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Virheellinen syöte: täytyy olla ${k(e.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${i}${e.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${i}${e.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen syöte: täytyy sisältää "${i.includes}"`:i.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${i.pattern}`:`Virheellinen ${o[i.format]??e.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${e.divisor} monikerta`;case"unrecognized_keys":return`${e.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${$(e.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 Bl(){return{localeError:Jl()}}const Vl=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"nombre";case"object":{if(Array.isArray(e))return"tableau";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Entrée invalide : ${e.expected} attendu, ${r(e.input)} reçu`;case"invalid_value":return e.values.length===1?`Entrée invalide : ${k(e.values[0])} attendu`:`Option invalide : une valeur parmi ${$(e.values,"|")} attendue`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Trop grand : ${e.origin??"valeur"} doit ${a.verb} ${i}${e.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${e.origin??"valeur"} doit être ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Trop petit : ${e.origin} doit ${a.verb} ${i}${e.minimum.toString()} ${a.unit}`:`Trop petit : ${e.origin} doit être ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Chaîne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Chaîne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Chaîne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${i.pattern}`:`${o[i.format]??e.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${e.divisor}`;case"unrecognized_keys":return`Clé${e.keys.length>1?"s":""} non reconnue${e.keys.length>1?"s":""} : ${$(e.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${e.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${e.origin}`;default:return"Entrée invalide"}}};function Kl(){return{localeError:Vl()}}const Wl=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Entrée invalide : attendu ${e.expected}, reçu ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Entrée invalide : attendu ${k(e.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"≤":"<",a=n(e.origin);return a?`Trop grand : attendu que ${e.origin??"la valeur"} ait ${i}${e.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${e.origin??"la valeur"} soit ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?"≥":">",a=n(e.origin);return a?`Trop petit : attendu que ${e.origin} ait ${i}${e.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${e.origin} soit ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Chaîne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Chaîne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Chaîne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Chaîne invalide : doit correspondre au motif ${i.pattern}`:`${o[i.format]??e.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${e.divisor}`;case"unrecognized_keys":return`Clé${e.keys.length>1?"s":""} non reconnue${e.keys.length>1?"s":""} : ${$(e.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${e.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${e.origin}`;default:return"Entrée invalide"}}};function ql(){return{localeError:Wl()}}const Xl=()=>{const t={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`קלט לא תקין: צריך ${e.expected}, התקבל ${r(e.input)}`;case"invalid_value":return e.values.length===1?`קלט לא תקין: צריך ${k(e.values[0])}`:`קלט לא תקין: צריך אחת מהאפשרויות ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`גדול מדי: ${e.origin??"value"} צריך להיות ${i}${e.maximum.toString()} ${a.unit??"elements"}`:`גדול מדי: ${e.origin??"value"} צריך להיות ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`קטן מדי: ${e.origin} צריך להיות ${i}${e.minimum.toString()} ${a.unit}`:`קטן מדי: ${e.origin} צריך להיות ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`מחרוזת לא תקינה: חייבת להתחיל ב"${i.prefix}"`:i.format==="ends_with"?`מחרוזת לא תקינה: חייבת להסתיים ב "${i.suffix}"`:i.format==="includes"?`מחרוזת לא תקינה: חייבת לכלול "${i.includes}"`:i.format==="regex"?`מחרוזת לא תקינה: חייבת להתאים לתבנית ${i.pattern}`:`${o[i.format]??e.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${e.divisor}`;case"unrecognized_keys":return`מפתח${e.keys.length>1?"ות":""} לא מזוה${e.keys.length>1?"ים":"ה"}: ${$(e.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${e.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${e.origin}`;default:return"קלט לא תקין"}}};function Hl(){return{localeError:Xl()}}const Yl=()=>{const t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"szám";case"object":{if(Array.isArray(e))return"tömb";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${e.expected}, a kapott érték ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Érvénytelen bemenet: a várt érték ${k(e.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Túl nagy: ${e.origin??"érték"} mérete túl nagy ${i}${e.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${e.origin??"érték"} túl nagy: ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Túl kicsi: a bemeneti érték ${e.origin} mérete túl kicsi ${i}${e.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${e.origin} túl kicsi ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Érvénytelen string: "${i.prefix}" értékkel kell kezdődnie`:i.format==="ends_with"?`Érvénytelen string: "${i.suffix}" értékkel kell végződnie`:i.format==="includes"?`Érvénytelen string: "${i.includes}" értéket kell tartalmaznia`:i.format==="regex"?`Érvénytelen string: ${i.pattern} mintának kell megfelelnie`:`Érvénytelen ${o[i.format]??e.format}`}case"not_multiple_of":return`Érvénytelen szám: ${e.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${e.keys.length>1?"s":""}: ${$(e.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${e.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${e.origin}`;default:return"Érvénytelen bemenet"}}};function Ql(){return{localeError:Yl()}}const ed=()=>{const t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Input tidak valid: diharapkan ${e.expected}, diterima ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Input tidak valid: diharapkan ${k(e.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Terlalu besar: diharapkan ${e.origin??"value"} memiliki ${i}${e.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${e.origin??"value"} menjadi ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Terlalu kecil: diharapkan ${e.origin} memiliki ${i}${e.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${e.origin} menjadi ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${o[i.format]??e.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${e.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${e.keys.length>1?"s":""}: ${$(e.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${e.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${e.origin}`;default:return"Input tidak valid"}}};function td(){return{localeError:ed()}}const nd=t=>{const n=typeof t;switch(n){case"number":return Number.isNaN(t)?"NaN":"númer";case"object":{if(Array.isArray(t))return"fylki";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return n},rd=()=>{const t={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function n(o){return t[o]??null}const r={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"};return o=>{switch(o.code){case"invalid_type":return`Rangt gildi: Þú slóst inn ${nd(o.input)} þar sem á að vera ${o.expected}`;case"invalid_value":return o.values.length===1?`Rangt gildi: gert ráð fyrir ${k(o.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${$(o.values,"|")}`;case"too_big":{const e=o.inclusive?"<=":"<",i=n(o.origin);return i?`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} hafi ${e}${o.maximum.toString()} ${i.unit??"hluti"}`:`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} sé ${e}${o.maximum.toString()}`}case"too_small":{const e=o.inclusive?">=":">",i=n(o.origin);return i?`Of lítið: gert er ráð fyrir að ${o.origin} hafi ${e}${o.minimum.toString()} ${i.unit}`:`Of lítið: gert er ráð fyrir að ${o.origin} sé ${e}${o.minimum.toString()}`}case"invalid_format":{const e=o;return e.format==="starts_with"?`Ógildur strengur: verður að byrja á "${e.prefix}"`:e.format==="ends_with"?`Ógildur strengur: verður að enda á "${e.suffix}"`:e.format==="includes"?`Ógildur strengur: verður að innihalda "${e.includes}"`:e.format==="regex"?`Ógildur strengur: verður að fylgja mynstri ${e.pattern}`:`Rangt ${r[e.format]??o.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${o.divisor}`;case"unrecognized_keys":return`Óþekkt ${o.keys.length>1?"ir lyklar":"ur lykill"}: ${$(o.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${o.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${o.origin}`;default:return"Rangt gildi"}}};function id(){return{localeError:rd()}}const od=()=>{const t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"numero";case"object":{if(Array.isArray(e))return"vettore";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Input non valido: atteso ${e.expected}, ricevuto ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Input non valido: atteso ${k(e.values[0])}`:`Opzione non valida: atteso uno tra ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Troppo grande: ${e.origin??"valore"} deve avere ${i}${e.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${e.origin??"valore"} deve essere ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Troppo piccolo: ${e.origin} deve avere ${i}${e.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${e.origin} deve essere ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${o[i.format]??e.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${e.divisor}`;case"unrecognized_keys":return`Chiav${e.keys.length>1?"i":"e"} non riconosciut${e.keys.length>1?"e":"a"}: ${$(e.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${e.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${e.origin}`;default:return"Input non valido"}}};function ad(){return{localeError:od()}}const ud=()=>{const t={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"数値";case"object":{if(Array.isArray(e))return"配列";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`無効な入力: ${e.expected}が期待されましたが、${r(e.input)}が入力されました`;case"invalid_value":return e.values.length===1?`無効な入力: ${k(e.values[0])}が期待されました`:`無効な選択: ${$(e.values,"、")}のいずれかである必要があります`;case"too_big":{const i=e.inclusive?"以下である":"より小さい",a=n(e.origin);return a?`大きすぎる値: ${e.origin??"値"}は${e.maximum.toString()}${a.unit??"要素"}${i}必要があります`:`大きすぎる値: ${e.origin??"値"}は${e.maximum.toString()}${i}必要があります`}case"too_small":{const i=e.inclusive?"以上である":"より大きい",a=n(e.origin);return a?`小さすぎる値: ${e.origin}は${e.minimum.toString()}${a.unit}${i}必要があります`:`小さすぎる値: ${e.origin}は${e.minimum.toString()}${i}必要があります`}case"invalid_format":{const i=e;return i.format==="starts_with"?`無効な文字列: "${i.prefix}"で始まる必要があります`:i.format==="ends_with"?`無効な文字列: "${i.suffix}"で終わる必要があります`:i.format==="includes"?`無効な文字列: "${i.includes}"を含む必要があります`:i.format==="regex"?`無効な文字列: パターン${i.pattern}に一致する必要があります`:`無効な${o[i.format]??e.format}`}case"not_multiple_of":return`無効な数値: ${e.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${e.keys.length>1?"群":""}: ${$(e.keys,"、")}`;case"invalid_key":return`${e.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${e.origin}内の無効な値`;default:return"無効な入力"}}};function sd(){return{localeError:ud()}}const cd=t=>{const n=typeof t;switch(n){case"number":return Number.isNaN(t)?"NaN":"რიცხვი";case"object":{if(Array.isArray(t))return"მასივი";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return{string:"სტრინგი",boolean:"ბულეანი",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"ფუნქცია"}[n]??n},ld=()=>{const t={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function n(o){return t[o]??null}const 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-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"};return o=>{switch(o.code){case"invalid_type":return`არასწორი შეყვანა: მოსალოდნელი ${o.expected}, მიღებული ${cd(o.input)}`;case"invalid_value":return o.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${k(o.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${$(o.values,"|")}-დან`;case"too_big":{const e=o.inclusive?"<=":"<",i=n(o.origin);return i?`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} ${i.verb} ${e}${o.maximum.toString()} ${i.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} იყოს ${e}${o.maximum.toString()}`}case"too_small":{const e=o.inclusive?">=":">",i=n(o.origin);return i?`ზედმეტად პატარა: მოსალოდნელი ${o.origin} ${i.verb} ${e}${o.minimum.toString()} ${i.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${o.origin} იყოს ${e}${o.minimum.toString()}`}case"invalid_format":{const e=o;return e.format==="starts_with"?`არასწორი სტრინგი: უნდა იწყებოდეს "${e.prefix}"-ით`:e.format==="ends_with"?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${e.suffix}"-ით`:e.format==="includes"?`არასწორი სტრინგი: უნდა შეიცავდეს "${e.includes}"-ს`:e.format==="regex"?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${e.pattern}`:`არასწორი ${r[e.format]??o.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${o.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${o.keys.length>1?"ები":"ი"}: ${$(o.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${o.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${o.origin}-ში`;default:return"არასწორი შეყვანა"}}};function dd(){return{localeError:ld()}}const md=()=>{const t={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(e))return"អារេ (Array)";if(e===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${e.expected} ប៉ុន្តែទទួលបាន ${r(e.input)}`;case"invalid_value":return e.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${k(e.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`ធំពេក៖ ត្រូវការ ${e.origin??"តម្លៃ"} ${i} ${e.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${e.origin??"តម្លៃ"} ${i} ${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`តូចពេក៖ ត្រូវការ ${e.origin} ${i} ${e.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${e.origin} ${i} ${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${i.prefix}"`:i.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${i.suffix}"`:i.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${i.includes}"`:i.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${i.pattern}`:`មិនត្រឹមត្រូវ៖ ${o[i.format]??e.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${e.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${$(e.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function $u(){return{localeError:md()}}function fd(){return $u()}const gd=()=>{const t={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${e.expected}, 받은 타입은 ${r(e.input)}입니다`;case"invalid_value":return e.values.length===1?`잘못된 입력: 값은 ${k(e.values[0])} 이어야 합니다`:`잘못된 옵션: ${$(e.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const i=e.inclusive?"이하":"미만",a=i==="미만"?"이어야 합니다":"여야 합니다",u=n(e.origin),s=u?.unit??"요소";return u?`${e.origin??"값"}이 너무 큽니다: ${e.maximum.toString()}${s} ${i}${a}`:`${e.origin??"값"}이 너무 큽니다: ${e.maximum.toString()} ${i}${a}`}case"too_small":{const i=e.inclusive?"이상":"초과",a=i==="이상"?"이어야 합니다":"여야 합니다",u=n(e.origin),s=u?.unit??"요소";return u?`${e.origin??"값"}이 너무 작습니다: ${e.minimum.toString()}${s} ${i}${a}`:`${e.origin??"값"}이 너무 작습니다: ${e.minimum.toString()} ${i}${a}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`잘못된 문자열: "${i.prefix}"(으)로 시작해야 합니다`:i.format==="ends_with"?`잘못된 문자열: "${i.suffix}"(으)로 끝나야 합니다`:i.format==="includes"?`잘못된 문자열: "${i.includes}"을(를) 포함해야 합니다`:i.format==="regex"?`잘못된 문자열: 정규식 ${i.pattern} 패턴과 일치해야 합니다`:`잘못된 ${o[i.format]??e.format}`}case"not_multiple_of":return`잘못된 숫자: ${e.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${$(e.keys,", ")}`;case"invalid_key":return`잘못된 키: ${e.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${e.origin}`;default:return"잘못된 입력"}}};function pd(){return{localeError:gd()}}const vd=t=>Xe(typeof t,t),Xe=(t,n=void 0)=>{switch(t){case"number":return Number.isNaN(n)?"NaN":"skaičius";case"bigint":return"sveikasis skaičius";case"string":return"eilutė";case"boolean":return"loginė reikšmė";case"undefined":case"void":return"neapibrėžta reikšmė";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return n===void 0?"nežinomas objektas":n===null?"nulinė reikšmė":Array.isArray(n)?"masyvas":Object.getPrototypeOf(n)!==Object.prototype&&n.constructor?n.constructor.name:"objektas";case"null":return"nulinė reikšmė"}return t},Ke=t=>t.charAt(0).toUpperCase()+t.slice(1);function $i(t){const n=Math.abs(t),r=n%10,o=n%100;return o>=11&&o<=19||r===0?"many":r===1?"one":"few"}const hd=()=>{const t={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function n(o,e,i,a){const u=t[o]??null;return u===null?u:{unit:u.unit[e],verb:u.verb[a][i?"inclusive":"notInclusive"]}}const r={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"};return o=>{switch(o.code){case"invalid_type":return`Gautas tipas ${vd(o.input)}, o tikėtasi - ${Xe(o.expected)}`;case"invalid_value":return o.values.length===1?`Privalo būti ${k(o.values[0])}`:`Privalo būti vienas iš ${$(o.values,"|")} pasirinkimų`;case"too_big":{const e=Xe(o.origin),i=n(o.origin,$i(Number(o.maximum)),o.inclusive??!1,"smaller");if(i?.verb)return`${Ke(e??o.origin??"reikšmė")} ${i.verb} ${o.maximum.toString()} ${i.unit??"elementų"}`;const a=o.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Ke(e??o.origin??"reikšmė")} turi būti ${a} ${o.maximum.toString()} ${i?.unit}`}case"too_small":{const e=Xe(o.origin),i=n(o.origin,$i(Number(o.minimum)),o.inclusive??!1,"bigger");if(i?.verb)return`${Ke(e??o.origin??"reikšmė")} ${i.verb} ${o.minimum.toString()} ${i.unit??"elementų"}`;const a=o.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Ke(e??o.origin??"reikšmė")} turi būti ${a} ${o.minimum.toString()} ${i?.unit}`}case"invalid_format":{const e=o;return e.format==="starts_with"?`Eilutė privalo prasidėti "${e.prefix}"`:e.format==="ends_with"?`Eilutė privalo pasibaigti "${e.suffix}"`:e.format==="includes"?`Eilutė privalo įtraukti "${e.includes}"`:e.format==="regex"?`Eilutė privalo atitikti ${e.pattern}`:`Neteisingas ${r[e.format]??o.format}`}case"not_multiple_of":return`Skaičius privalo būti ${o.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${o.keys.length>1?"i":"as"} rakt${o.keys.length>1?"ai":"as"}: ${$(o.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{const e=Xe(o.origin);return`${Ke(e??o.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function $d(){return{localeError:hd()}}const bd=()=>{const t={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"број";case"object":{if(Array.isArray(e))return"низа";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Грешен внес: се очекува ${e.expected}, примено ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Invalid input: expected ${k(e.values[0])}`:`Грешана опција: се очекува една ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Премногу голем: се очекува ${e.origin??"вредноста"} да има ${i}${e.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${e.origin??"вредноста"} да биде ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Премногу мал: се очекува ${e.origin} да има ${i}${e.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${e.origin} да биде ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Неважечка низа: мора да започнува со "${i.prefix}"`:i.format==="ends_with"?`Неважечка низа: мора да завршува со "${i.suffix}"`:i.format==="includes"?`Неважечка низа: мора да вклучува "${i.includes}"`:i.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${i.pattern}`:`Invalid ${o[i.format]??e.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${e.divisor}`;case"unrecognized_keys":return`${e.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${$(e.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${e.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${e.origin}`;default:return"Грешен внес"}}};function _d(){return{localeError:bd()}}const yd=()=>{const t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"nombor";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Input tidak sah: dijangka ${e.expected}, diterima ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Input tidak sah: dijangka ${k(e.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Terlalu besar: dijangka ${e.origin??"nilai"} ${a.verb} ${i}${e.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${e.origin??"nilai"} adalah ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Terlalu kecil: dijangka ${e.origin} ${a.verb} ${i}${e.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${e.origin} adalah ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${o[i.format]??e.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${e.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${$(e.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${e.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${e.origin}`;default:return"Input tidak sah"}}};function wd(){return{localeError:yd()}}const kd=()=>{const t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"getal";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Ongeldige invoer: verwacht ${e.expected}, ontving ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Ongeldige invoer: verwacht ${k(e.values[0])}`:`Ongeldige optie: verwacht één van ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Te lang: verwacht dat ${e.origin??"waarde"} ${i}${e.maximum.toString()} ${a.unit??"elementen"} bevat`:`Te lang: verwacht dat ${e.origin??"waarde"} ${i}${e.maximum.toString()} is`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Te kort: verwacht dat ${e.origin} ${i}${e.minimum.toString()} ${a.unit} bevat`:`Te kort: verwacht dat ${e.origin} ${i}${e.minimum.toString()} is`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${o[i.format]??e.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${e.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${e.keys.length>1?"s":""}: ${$(e.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${e.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${e.origin}`;default:return"Ongeldige invoer"}}};function Id(){return{localeError:kd()}}const Sd=()=>{const t={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"tall";case"object":{if(Array.isArray(e))return"liste";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Ugyldig input: forventet ${e.expected}, fikk ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Ugyldig verdi: forventet ${k(e.values[0])}`:`Ugyldig valg: forventet en av ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`For stor(t): forventet ${e.origin??"value"} til å ha ${i}${e.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${e.origin??"value"} til å ha ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`For lite(n): forventet ${e.origin} til å ha ${i}${e.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${e.origin} til å ha ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Ugyldig streng: må starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: må ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: må inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: må matche mønsteret ${i.pattern}`:`Ugyldig ${o[i.format]??e.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${e.divisor}`;case"unrecognized_keys":return`${e.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${$(e.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${e.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${e.origin}`;default:return"Ugyldig input"}}};function zd(){return{localeError:Sd()}}const Od=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"numara";case"object":{if(Array.isArray(e))return"saf";if(e===null)return"gayb";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Fâsit giren: umulan ${e.expected}, alınan ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Fâsit giren: umulan ${k(e.values[0])}`:`Fâsit tercih: mûteberler ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Fazla büyük: ${e.origin??"value"}, ${i}${e.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${e.origin??"value"}, ${i}${e.maximum.toString()} olmalıydı.`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Fazla küçük: ${e.origin}, ${i}${e.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${e.origin}, ${i}${e.minimum.toString()} olmalıydı.`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Fâsit metin: "${i.prefix}" ile başlamalı.`:i.format==="ends_with"?`Fâsit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`Fâsit metin: "${i.includes}" ihtivâ etmeli.`:i.format==="regex"?`Fâsit metin: ${i.pattern} nakşına uymalı.`:`Fâsit ${o[i.format]??e.format}`}case"not_multiple_of":return`Fâsit sayı: ${e.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${e.keys.length>1?"s":""}: ${$(e.keys,", ")}`;case"invalid_key":return`${e.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${e.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function jd(){return{localeError:Od()}}const xd=()=>{const t={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"عدد";case"object":{if(Array.isArray(e))return"ارې";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`ناسم ورودي: باید ${e.expected} وای, مګر ${r(e.input)} ترلاسه شو`;case"invalid_value":return e.values.length===1?`ناسم ورودي: باید ${k(e.values[0])} وای`:`ناسم انتخاب: باید یو له ${$(e.values,"|")} څخه وای`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`ډیر لوی: ${e.origin??"ارزښت"} باید ${i}${e.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${e.origin??"ارزښت"} باید ${i}${e.maximum.toString()} وي`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`ډیر کوچنی: ${e.origin} باید ${i}${e.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${e.origin} باید ${i}${e.minimum.toString()} وي`}case"invalid_format":{const i=e;return i.format==="starts_with"?`ناسم متن: باید د "${i.prefix}" سره پیل شي`:i.format==="ends_with"?`ناسم متن: باید د "${i.suffix}" سره پای ته ورسيږي`:i.format==="includes"?`ناسم متن: باید "${i.includes}" ولري`:i.format==="regex"?`ناسم متن: باید د ${i.pattern} سره مطابقت ولري`:`${o[i.format]??e.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${e.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${e.keys.length>1?"کلیډونه":"کلیډ"}: ${$(e.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${e.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${e.origin} کې`;default:return"ناسمه ورودي"}}};function Nd(){return{localeError:xd()}}const Ed=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"liczba";case"object":{if(Array.isArray(e))return"tablica";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${e.expected}, otrzymano ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${k(e.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Za duża wartość: oczekiwano, że ${e.origin??"wartość"} będzie mieć ${i}${e.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${e.origin??"wartość"} będzie wynosić ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Za mała wartość: oczekiwano, że ${e.origin??"wartość"} będzie mieć ${i}${e.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${e.origin??"wartość"} będzie wynosić ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${i.prefix}"`:i.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${i.suffix}"`:i.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${i.includes}"`:i.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${i.pattern}`:`Nieprawidłow(y/a/e) ${o[i.format]??e.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${e.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${e.keys.length>1?"s":""}: ${$(e.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${e.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${e.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Ud(){return{localeError:Ed()}}const Td=()=>{const t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"número";case"object":{if(Array.isArray(e))return"array";if(e===null)return"nulo";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Tipo inválido: esperado ${e.expected}, recebido ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Entrada inválida: esperado ${k(e.values[0])}`:`Opção inválida: esperada uma das ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Muito grande: esperado que ${e.origin??"valor"} tivesse ${i}${e.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${e.origin??"valor"} fosse ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Muito pequeno: esperado que ${e.origin} tivesse ${i}${e.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${e.origin} fosse ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Texto inválido: deve começar com "${i.prefix}"`:i.format==="ends_with"?`Texto inválido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inválido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inválido: deve corresponder ao padrão ${i.pattern}`:`${o[i.format]??e.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${e.divisor}`;case"unrecognized_keys":return`Chave${e.keys.length>1?"s":""} desconhecida${e.keys.length>1?"s":""}: ${$(e.keys,", ")}`;case"invalid_key":return`Chave inválida em ${e.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${e.origin}`;default:return"Campo inválido"}}};function Dd(){return{localeError:Td()}}function bi(t,n,r,o){const e=Math.abs(t),i=e%10,a=e%100;return a>=11&&a<=19?o:i===1?n:i>=2&&i<=4?r:o}const Ad=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"число";case"object":{if(Array.isArray(e))return"массив";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Неверный ввод: ожидалось ${e.expected}, получено ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Неверный ввод: ожидалось ${k(e.values[0])}`:`Неверный вариант: ожидалось одно из ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);if(a){const u=Number(e.maximum),s=bi(u,a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${e.origin??"значение"} будет иметь ${i}${e.maximum.toString()} ${s}`}return`Слишком большое значение: ожидалось, что ${e.origin??"значение"} будет ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);if(a){const u=Number(e.minimum),s=bi(u,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${e.origin} будет иметь ${i}${e.minimum.toString()} ${s}`}return`Слишком маленькое значение: ожидалось, что ${e.origin} будет ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Неверная строка: должна начинаться с "${i.prefix}"`:i.format==="ends_with"?`Неверная строка: должна заканчиваться на "${i.suffix}"`:i.format==="includes"?`Неверная строка: должна содержать "${i.includes}"`:i.format==="regex"?`Неверная строка: должна соответствовать шаблону ${i.pattern}`:`Неверный ${o[i.format]??e.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${e.divisor}`;case"unrecognized_keys":return`Нераспознанн${e.keys.length>1?"ые":"ый"} ключ${e.keys.length>1?"и":""}: ${$(e.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${e.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${e.origin}`;default:return"Неверные входные данные"}}};function Pd(){return{localeError:Ad()}}const Zd=()=>{const t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"število";case"object":{if(Array.isArray(e))return"tabela";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${e.expected}, prejeto ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Neveljaven vnos: pričakovano ${k(e.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Preveliko: pričakovano, da bo ${e.origin??"vrednost"} imelo ${i}${e.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${e.origin??"vrednost"} ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Premajhno: pričakovano, da bo ${e.origin} imelo ${i}${e.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${e.origin} ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Neveljaven niz: mora se začeti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se končati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${o[i.format]??e.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${e.divisor}`;case"unrecognized_keys":return`Neprepoznan${e.keys.length>1?"i ključi":" ključ"}: ${$(e.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${e.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${e.origin}`;default:return"Neveljaven vnos"}}};function Rd(){return{localeError:Zd()}}const Fd=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"antal";case"object":{if(Array.isArray(e))return"lista";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${e.expected}, fick ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Ogiltig inmatning: förväntat ${k(e.values[0])}`:`Ogiltigt val: förväntade en av ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`För stor(t): förväntade ${e.origin??"värdet"} att ha ${i}${e.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${e.origin??"värdet"} att ha ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`För lite(t): förväntade ${e.origin??"värdet"} att ha ${i}${e.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${e.origin??"värdet"} att ha ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Ogiltig sträng: måste börja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig sträng: måste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig sträng: måste innehålla "${i.includes}"`:i.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${i.pattern}"`:`Ogiltig(t) ${o[i.format]??e.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${e.divisor}`;case"unrecognized_keys":return`${e.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${$(e.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${e.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${e.origin??"värdet"}`;default:return"Ogiltig input"}}};function Ld(){return{localeError:Fd()}}const Cd=()=>{const t={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(e))return"அணி";if(e===null)return"வெறுமை";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${e.expected}, பெறப்பட்டது ${r(e.input)}`;case"invalid_value":return e.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${k(e.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${$(e.values,"|")} இல் ஒன்று`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??"மதிப்பு"} ${i}${e.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??"மதிப்பு"} ${i}${e.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${i}${e.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${i}${e.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const i=e;return i.format==="starts_with"?`தவறான சரம்: "${i.prefix}" இல் தொடங்க வேண்டும்`:i.format==="ends_with"?`தவறான சரம்: "${i.suffix}" இல் முடிவடைய வேண்டும்`:i.format==="includes"?`தவறான சரம்: "${i.includes}" ஐ உள்ளடக்க வேண்டும்`:i.format==="regex"?`தவறான சரம்: ${i.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${o[i.format]??e.format}`}case"not_multiple_of":return`தவறான எண்: ${e.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${e.keys.length>1?"கள்":""}: ${$(e.keys,", ")}`;case"invalid_key":return`${e.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${e.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Md(){return{localeError:Cd()}}const Gd=()=>{const t={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(e))return"อาร์เรย์ (Array)";if(e===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${e.expected} แต่ได้รับ ${r(e.input)}`;case"invalid_value":return e.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${k(e.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"ไม่เกิน":"น้อยกว่า",a=n(e.origin);return a?`เกินกำหนด: ${e.origin??"ค่า"} ควรมี${i} ${e.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${e.origin??"ค่า"} ควรมี${i} ${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?"อย่างน้อย":"มากกว่า",a=n(e.origin);return a?`น้อยกว่ากำหนด: ${e.origin} ควรมี${i} ${e.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${e.origin} ควรมี${i} ${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${i.prefix}"`:i.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${i.suffix}"`:i.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${i.includes}" อยู่ในข้อความ`:i.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${i.pattern}`:`รูปแบบไม่ถูกต้อง: ${o[i.format]??e.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${e.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${$(e.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${e.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${e.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function Jd(){return{localeError:Gd()}}const Bd=t=>{const n=typeof t;switch(n){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 n},Vd=()=>{const t={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function n(o){return t[o]??null}const r={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 o=>{switch(o.code){case"invalid_type":return`Geçersiz değer: beklenen ${o.expected}, alınan ${Bd(o.input)}`;case"invalid_value":return o.values.length===1?`Geçersiz değer: beklenen ${k(o.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${$(o.values,"|")}`;case"too_big":{const e=o.inclusive?"<=":"<",i=n(o.origin);return i?`Çok büyük: beklenen ${o.origin??"değer"} ${e}${o.maximum.toString()} ${i.unit??"öğe"}`:`Çok büyük: beklenen ${o.origin??"değer"} ${e}${o.maximum.toString()}`}case"too_small":{const e=o.inclusive?">=":">",i=n(o.origin);return i?`Çok küçük: beklenen ${o.origin} ${e}${o.minimum.toString()} ${i.unit}`:`Çok küçük: beklenen ${o.origin} ${e}${o.minimum.toString()}`}case"invalid_format":{const e=o;return e.format==="starts_with"?`Geçersiz metin: "${e.prefix}" ile başlamalı`:e.format==="ends_with"?`Geçersiz metin: "${e.suffix}" ile bitmeli`:e.format==="includes"?`Geçersiz metin: "${e.includes}" içermeli`:e.format==="regex"?`Geçersiz metin: ${e.pattern} desenine uymalı`:`Geçersiz ${r[e.format]??o.format}`}case"not_multiple_of":return`Geçersiz sayı: ${o.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${o.keys.length>1?"lar":""}: ${$(o.keys,", ")}`;case"invalid_key":return`${o.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${o.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function Kd(){return{localeError:Vd()}}const Wd=()=>{const t={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"число";case"object":{if(Array.isArray(e))return"масив";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${e.expected}, отримано ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Неправильні вхідні дані: очікується ${k(e.values[0])}`:`Неправильна опція: очікується одне з ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Занадто велике: очікується, що ${e.origin??"значення"} ${a.verb} ${i}${e.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${e.origin??"значення"} буде ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Занадто мале: очікується, що ${e.origin} ${a.verb} ${i}${e.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${e.origin} буде ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Неправильний рядок: повинен починатися з "${i.prefix}"`:i.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${i.suffix}"`:i.format==="includes"?`Неправильний рядок: повинен містити "${i.includes}"`:i.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${i.pattern}`:`Неправильний ${o[i.format]??e.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${e.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${e.keys.length>1?"і":""}: ${$(e.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${e.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${e.origin}`;default:return"Неправильні вхідні дані"}}};function bu(){return{localeError:Wd()}}function qd(){return bu()}const Xd=()=>{const t={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"نمبر";case"object":{if(Array.isArray(e))return"آرے";if(e===null)return"نل";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`غلط ان پٹ: ${e.expected} متوقع تھا، ${r(e.input)} موصول ہوا`;case"invalid_value":return e.values.length===1?`غلط ان پٹ: ${k(e.values[0])} متوقع تھا`:`غلط آپشن: ${$(e.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`بہت بڑا: ${e.origin??"ویلیو"} کے ${i}${e.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${e.origin??"ویلیو"} کا ${i}${e.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`بہت چھوٹا: ${e.origin} کے ${i}${e.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${e.origin} کا ${i}${e.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const i=e;return i.format==="starts_with"?`غلط سٹرنگ: "${i.prefix}" سے شروع ہونا چاہیے`:i.format==="ends_with"?`غلط سٹرنگ: "${i.suffix}" پر ختم ہونا چاہیے`:i.format==="includes"?`غلط سٹرنگ: "${i.includes}" شامل ہونا چاہیے`:i.format==="regex"?`غلط سٹرنگ: پیٹرن ${i.pattern} سے میچ ہونا چاہیے`:`غلط ${o[i.format]??e.format}`}case"not_multiple_of":return`غلط نمبر: ${e.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${e.keys.length>1?"ز":""}: ${$(e.keys,"، ")}`;case"invalid_key":return`${e.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${e.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function Hd(){return{localeError:Xd()}}const Yd=()=>{const 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 n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"số";case"object":{if(Array.isArray(e))return"mảng";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${e.expected}, nhận được ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Đầu vào không hợp lệ: mong đợi ${k(e.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Quá lớn: mong đợi ${e.origin??"giá trị"} ${a.verb} ${i}${e.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${e.origin??"giá trị"} ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Quá nhỏ: mong đợi ${e.origin} ${a.verb} ${i}${e.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${e.origin} ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${i.prefix}"`:i.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${i.suffix}"`:i.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${i.includes}"`:i.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${i.pattern}`:`${o[i.format]??e.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 ${e.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${$(e.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${e.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 ${e.origin}`;default:return"Đầu vào không hợp lệ"}}};function Qd(){return{localeError:Yd()}}const em=()=>{const t={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(e))return"数组";if(e===null)return"空值(null)";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`无效输入:期望 ${e.expected},实际接收 ${r(e.input)}`;case"invalid_value":return e.values.length===1?`无效输入:期望 ${k(e.values[0])}`:`无效选项:期望以下之一 ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`数值过大:期望 ${e.origin??"值"} ${i}${e.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${e.origin??"值"} ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`数值过小:期望 ${e.origin} ${i}${e.minimum.toString()} ${a.unit}`:`数值过小:期望 ${e.origin} ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`无效字符串:必须以 "${i.prefix}" 开头`:i.format==="ends_with"?`无效字符串:必须以 "${i.suffix}" 结尾`:i.format==="includes"?`无效字符串:必须包含 "${i.includes}"`:i.format==="regex"?`无效字符串:必须满足正则表达式 ${i.pattern}`:`无效${o[i.format]??e.format}`}case"not_multiple_of":return`无效数字:必须是 ${e.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${$(e.keys,", ")}`;case"invalid_key":return`${e.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${e.origin} 中包含无效值(value)`;default:return"无效输入"}}};function tm(){return{localeError:em()}}const nm=()=>{const t={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={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 e=>{switch(e.code){case"invalid_type":return`無效的輸入值:預期為 ${e.expected},但收到 ${r(e.input)}`;case"invalid_value":return e.values.length===1?`無效的輸入值:預期為 ${k(e.values[0])}`:`無效的選項:預期為以下其中之一 ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`數值過大:預期 ${e.origin??"值"} 應為 ${i}${e.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${e.origin??"值"} 應為 ${i}${e.maximum.toString()}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`數值過小:預期 ${e.origin} 應為 ${i}${e.minimum.toString()} ${a.unit}`:`數值過小:預期 ${e.origin} 應為 ${i}${e.minimum.toString()}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`無效的字串:必須以 "${i.prefix}" 開頭`:i.format==="ends_with"?`無效的字串:必須以 "${i.suffix}" 結尾`:i.format==="includes"?`無效的字串:必須包含 "${i.includes}"`:i.format==="regex"?`無效的字串:必須符合格式 ${i.pattern}`:`無效的 ${o[i.format]??e.format}`}case"not_multiple_of":return`無效的數字:必須為 ${e.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${e.keys.length>1?"們":""}:${$(e.keys,"、")}`;case"invalid_key":return`${e.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${e.origin} 中有無效的值`;default:return"無效的輸入值"}}};function rm(){return{localeError:nm()}}const im=()=>{const t={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function n(e){return t[e]??null}const r=e=>{const i=typeof e;switch(i){case"number":return Number.isNaN(e)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(e))return"akopọ";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return i},o={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",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:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return e=>{switch(e.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${e.expected}, àmọ̀ a rí ${r(e.input)}`;case"invalid_value":return e.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${k(e.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${$(e.values,"|")}`;case"too_big":{const i=e.inclusive?"<=":"<",a=n(e.origin);return a?`Tó pọ̀ jù: a ní láti jẹ́ pé ${e.origin??"iye"} ${a.verb} ${i}${e.maximum} ${a.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${i}${e.maximum}`}case"too_small":{const i=e.inclusive?">=":">",a=n(e.origin);return a?`Kéré ju: a ní láti jẹ́ pé ${e.origin} ${a.verb} ${i}${e.minimum} ${a.unit}`:`Kéré ju: a ní láti jẹ́ ${i}${e.minimum}`}case"invalid_format":{const i=e;return i.format==="starts_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${i.prefix}"`:i.format==="ends_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${i.suffix}"`:i.format==="includes"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${i.includes}"`:i.format==="regex"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${i.pattern}`:`Aṣìṣe: ${o[i.format]??e.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${e.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${$(e.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${e.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${e.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function om(){return{localeError:im()}}const _u=Object.freeze(Object.defineProperty({__proto__:null,ar:bl,az:yl,be:kl,bg:zl,ca:jl,cs:Nl,da:Ul,de:Dl,en:hu,eo:Fl,es:Cl,fa:Gl,fi:Bl,fr:Kl,frCA:ql,he:Hl,hu:Ql,id:td,is:id,it:ad,ja:sd,ka:dd,kh:fd,km:$u,ko:pd,lt:$d,mk:_d,ms:wd,nl:Id,no:zd,ota:jd,pl:Ud,ps:Nd,pt:Dd,ru:Pd,sl:Rd,sv:Ld,ta:Md,th:Jd,tr:Kd,ua:qd,uk:bu,ur:Hd,vi:Qd,yo:om,zhCN:tm,zhTW:rm},Symbol.toStringTag,{value:"Module"})),yu=Symbol("ZodOutput"),wu=Symbol("ZodInput");class Fn{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...r){const o=r[0];if(this._map.set(n,o),o&&typeof o=="object"&&"id"in o){if(this._idmap.has(o.id))throw new Error(`ID ${o.id} already exists in the registry`);this._idmap.set(o.id,n)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const r=this._map.get(n);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(n),this}get(n){const r=n._zod.parent;if(r){const o={...this.get(r)??{}};delete o.id;const e={...o,...this._map.get(n)};return Object.keys(e).length?e:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function Ln(){return new Fn}const ze=Ln();function ku(t,n){return new t({type:"string",...p(n)})}function Iu(t,n){return new t({type:"string",coerce:!0,...p(n)})}function Cn(t,n){return new t({type:"string",format:"email",check:"string_format",abort:!1,...p(n)})}function jt(t,n){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...p(n)})}function Mn(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...p(n)})}function Gn(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...p(n)})}function Jn(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...p(n)})}function Bn(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...p(n)})}function Ft(t,n){return new t({type:"string",format:"url",check:"string_format",abort:!1,...p(n)})}function Vn(t,n){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...p(n)})}function Kn(t,n){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...p(n)})}function Wn(t,n){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...p(n)})}function qn(t,n){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...p(n)})}function Xn(t,n){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...p(n)})}function Hn(t,n){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...p(n)})}function Yn(t,n){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...p(n)})}function Qn(t,n){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...p(n)})}function er(t,n){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...p(n)})}function tr(t,n){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...p(n)})}function nr(t,n){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...p(n)})}function rr(t,n){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...p(n)})}function ir(t,n){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...p(n)})}function or(t,n){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...p(n)})}function ar(t,n){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...p(n)})}const Su={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function zu(t,n){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...p(n)})}function Ou(t,n){return new t({type:"string",format:"date",check:"string_format",...p(n)})}function ju(t,n){return new t({type:"string",format:"time",check:"string_format",precision:null,...p(n)})}function xu(t,n){return new t({type:"string",format:"duration",check:"string_format",...p(n)})}function Nu(t,n){return new t({type:"number",checks:[],...p(n)})}function Eu(t,n){return new t({type:"number",coerce:!0,checks:[],...p(n)})}function Uu(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...p(n)})}function Tu(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...p(n)})}function Du(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...p(n)})}function Au(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...p(n)})}function Pu(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...p(n)})}function Zu(t,n){return new t({type:"boolean",...p(n)})}function Ru(t,n){return new t({type:"boolean",coerce:!0,...p(n)})}function Fu(t,n){return new t({type:"bigint",...p(n)})}function Lu(t,n){return new t({type:"bigint",coerce:!0,...p(n)})}function Cu(t,n){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...p(n)})}function Mu(t,n){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...p(n)})}function Gu(t,n){return new t({type:"symbol",...p(n)})}function Ju(t,n){return new t({type:"undefined",...p(n)})}function Bu(t,n){return new t({type:"null",...p(n)})}function Vu(t){return new t({type:"any"})}function Ku(t){return new t({type:"unknown"})}function Wu(t,n){return new t({type:"never",...p(n)})}function qu(t,n){return new t({type:"void",...p(n)})}function Xu(t,n){return new t({type:"date",...p(n)})}function Hu(t,n){return new t({type:"date",coerce:!0,...p(n)})}function Yu(t,n){return new t({type:"nan",...p(n)})}function xe(t,n){return new Nn({check:"less_than",...p(n),value:t,inclusive:!1})}function ae(t,n){return new Nn({check:"less_than",...p(n),value:t,inclusive:!0})}function Ne(t,n){return new En({check:"greater_than",...p(n),value:t,inclusive:!1})}function ee(t,n){return new En({check:"greater_than",...p(n),value:t,inclusive:!0})}function Qu(t){return Ne(0,t)}function es(t){return xe(0,t)}function ts(t){return ae(0,t)}function ns(t){return ee(0,t)}function He(t,n){return new Lo({check:"multiple_of",...p(n),value:t})}function Lt(t,n){return new Go({check:"max_size",...p(n),maximum:t})}function Ye(t,n){return new Jo({check:"min_size",...p(n),minimum:t})}function ur(t,n){return new Bo({check:"size_equals",...p(n),size:t})}function Ct(t,n){return new Vo({check:"max_length",...p(n),maximum:t})}function Re(t,n){return new Ko({check:"min_length",...p(n),minimum:t})}function Mt(t,n){return new Wo({check:"length_equals",...p(n),length:t})}function sr(t,n){return new qo({check:"string_format",format:"regex",...p(n),pattern:t})}function cr(t){return new Xo({check:"string_format",format:"lowercase",...p(t)})}function lr(t){return new Ho({check:"string_format",format:"uppercase",...p(t)})}function dr(t,n){return new Yo({check:"string_format",format:"includes",...p(n),includes:t})}function mr(t,n){return new Qo({check:"string_format",format:"starts_with",...p(n),prefix:t})}function fr(t,n){return new ea({check:"string_format",format:"ends_with",...p(n),suffix:t})}function rs(t,n,r){return new ta({check:"property",property:t,schema:n,...p(r)})}function gr(t,n){return new na({check:"mime_type",mime:t,...p(n)})}function Ue(t){return new ra({check:"overwrite",tx:t})}function pr(t){return Ue(n=>n.normalize(t))}function vr(){return Ue(t=>t.trim())}function hr(){return Ue(t=>t.toLowerCase())}function $r(){return Ue(t=>t.toUpperCase())}function is(t,n,r){return new t({type:"array",element:n,...p(r)})}function am(t,n,r){return new t({type:"union",options:n,...p(r)})}function um(t,n,r,o){return new t({type:"union",options:r,discriminator:n,...p(o)})}function sm(t,n,r){return new t({type:"intersection",left:n,right:r})}function cm(t,n,r,o){const e=r instanceof S,i=e?o:r,a=e?r:null;return new t({type:"tuple",items:n,rest:a,...p(i)})}function lm(t,n,r,o){return new t({type:"record",keyType:n,valueType:r,...p(o)})}function dm(t,n,r,o){return new t({type:"map",keyType:n,valueType:r,...p(o)})}function mm(t,n,r){return new t({type:"set",valueType:n,...p(r)})}function fm(t,n,r){const o=Array.isArray(n)?Object.fromEntries(n.map(e=>[e,e])):n;return new t({type:"enum",entries:o,...p(r)})}function gm(t,n,r){return new t({type:"enum",entries:n,...p(r)})}function pm(t,n,r){return new t({type:"literal",values:Array.isArray(n)?n:[n],...p(r)})}function os(t,n){return new t({type:"file",...p(n)})}function vm(t,n){return new t({type:"transform",transform:n})}function hm(t,n){return new t({type:"optional",innerType:n})}function $m(t,n){return new t({type:"nullable",innerType:n})}function bm(t,n,r){return new t({type:"default",innerType:n,get defaultValue(){return typeof r=="function"?r():Pt(r)}})}function _m(t,n,r){return new t({type:"nonoptional",innerType:n,...p(r)})}function ym(t,n){return new t({type:"success",innerType:n})}function wm(t,n,r){return new t({type:"catch",innerType:n,catchValue:typeof r=="function"?r:()=>r})}function km(t,n,r){return new t({type:"pipe",in:n,out:r})}function Im(t,n){return new t({type:"readonly",innerType:n})}function Sm(t,n,r){return new t({type:"template_literal",parts:n,...p(r)})}function zm(t,n){return new t({type:"lazy",getter:n})}function Om(t,n){return new t({type:"promise",innerType:n})}function as(t,n,r){const o=p(r);return o.abort??(o.abort=!0),new t({type:"custom",check:"custom",fn:n,...o})}function us(t,n,r){return new t({type:"custom",check:"custom",fn:n,...p(r)})}function ss(t){const n=cs(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Pe(o,r.value,n._zod.def));else{const e=o;e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=r.value),e.inst??(e.inst=n),e.continue??(e.continue=!n._zod.def.abort),r.issues.push(Pe(e))}},t(r.value,r)));return n}function cs(t,n){const r=new C({check:"custom",...p(n)});return r._zod.check=t,r}function ls(t,n){const r=p(n);let o=r.truthy??["true","1","yes","on","y","enabled"],e=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(o=o.map(v=>typeof v=="string"?v.toLowerCase():v),e=e.map(v=>typeof v=="string"?v.toLowerCase():v));const i=new Set(o),a=new Set(e),u=t.Codec??Rn,s=t.Boolean??Dn,l=t.String??ct,m=new l({type:"string",error:r.error}),f=new s({type:"boolean",error:r.error}),b=new u({type:"pipe",in:m,out:f,transform:(v,d)=>{let h=v;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:a.has(h)?!1:(d.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:d.value,inst:b,continue:!1}),{})},reverseTransform:(v,d)=>v===!0?o[0]||"true":e[0]||"false",error:r.error});return b}function lt(t,n,r,o={}){const e=p(o),i={...p(o),check:"string_format",type:"string",format:n,fn:typeof r=="function"?r:u=>r.test(u),...e};return r instanceof RegExp&&(i.pattern=r),new t(i)}class un{constructor(n){this.counter=0,this.metadataRegistry=n?.metadata??ze,this.target=n?.target??"draft-2020-12",this.unrepresentable=n?.unrepresentable??"throw",this.override=n?.override??(()=>{}),this.io=n?.io??"output",this.seen=new Map}process(n,r={path:[],schemaPath:[]}){var o;const e=n._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(n);if(a)return a.count++,r.schemaPath.includes(n)&&(a.cycle=r.path),a.schema;const u={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(n,u);const s=n._zod.toJSONSchema?.();if(s)u.schema=s;else{const f={...r,schemaPath:[...r.schemaPath,n],path:r.path},b=n._zod.parent;if(b)u.ref=b,this.process(b,f),this.seen.get(b).isParent=!0;else{const v=u.schema;switch(e.type){case"string":{const d=v;d.type="string";const{minimum:h,maximum:y,format:U,patterns:x,contentEncoding:T}=n._zod.bag;if(typeof h=="number"&&(d.minLength=h),typeof y=="number"&&(d.maxLength=y),U&&(d.format=i[U]??U,d.format===""&&delete d.format),T&&(d.contentEncoding=T),x&&x.size>0){const D=[...x];D.length===1?d.pattern=D[0].source:D.length>1&&(u.schema.allOf=[...D.map(re=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:re.source}))])}break}case"number":{const d=v,{minimum:h,maximum:y,format:U,multipleOf:x,exclusiveMaximum:T,exclusiveMinimum:D}=n._zod.bag;typeof U=="string"&&U.includes("int")?d.type="integer":d.type="number",typeof D=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(d.minimum=D,d.exclusiveMinimum=!0):d.exclusiveMinimum=D),typeof h=="number"&&(d.minimum=h,typeof D=="number"&&this.target!=="draft-4"&&(D>=h?delete d.minimum:delete d.exclusiveMinimum)),typeof T=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(d.maximum=T,d.exclusiveMaximum=!0):d.exclusiveMaximum=T),typeof y=="number"&&(d.maximum=y,typeof T=="number"&&this.target!=="draft-4"&&(T<=y?delete d.maximum:delete d.exclusiveMaximum)),typeof x=="number"&&(d.multipleOf=x);break}case"boolean":{const d=v;d.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{this.target==="openapi-3.0"?(v.type="string",v.nullable=!0,v.enum=[null]):v.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{v.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const d=v,{minimum:h,maximum:y}=n._zod.bag;typeof h=="number"&&(d.minItems=h),typeof y=="number"&&(d.maxItems=y),d.type="array",d.items=this.process(e.element,{...f,path:[...f.path,"items"]});break}case"object":{const d=v;d.type="object",d.properties={};const h=e.shape;for(const x in h)d.properties[x]=this.process(h[x],{...f,path:[...f.path,"properties",x]});const y=new Set(Object.keys(h)),U=new Set([...y].filter(x=>{const T=e.shape[x]._zod;return this.io==="input"?T.optin===void 0:T.optout===void 0}));U.size>0&&(d.required=Array.from(U)),e.catchall?._zod.def.type==="never"?d.additionalProperties=!1:e.catchall?e.catchall&&(d.additionalProperties=this.process(e.catchall,{...f,path:[...f.path,"additionalProperties"]})):this.io==="output"&&(d.additionalProperties=!1);break}case"union":{const d=v,h=e.options.map((y,U)=>this.process(y,{...f,path:[...f.path,"anyOf",U]}));d.anyOf=h;break}case"intersection":{const d=v,h=this.process(e.left,{...f,path:[...f.path,"allOf",0]}),y=this.process(e.right,{...f,path:[...f.path,"allOf",1]}),U=T=>"allOf"in T&&Object.keys(T).length===1,x=[...U(h)?h.allOf:[h],...U(y)?y.allOf:[y]];d.allOf=x;break}case"tuple":{const d=v;d.type="array";const h=this.target==="draft-2020-12"?"prefixItems":"items",y=this.target==="draft-2020-12"||this.target==="openapi-3.0"?"items":"additionalItems",U=e.items.map((re,Xt)=>this.process(re,{...f,path:[...f.path,h,Xt]})),x=e.rest?this.process(e.rest,{...f,path:[...f.path,y,...this.target==="openapi-3.0"?[e.items.length]:[]]}):null;this.target==="draft-2020-12"?(d.prefixItems=U,x&&(d.items=x)):this.target==="openapi-3.0"?(d.items={anyOf:U},x&&d.items.anyOf.push(x),d.minItems=U.length,x||(d.maxItems=U.length)):(d.items=U,x&&(d.additionalItems=x));const{minimum:T,maximum:D}=n._zod.bag;typeof T=="number"&&(d.minItems=T),typeof D=="number"&&(d.maxItems=D);break}case"record":{const d=v;d.type="object",(this.target==="draft-7"||this.target==="draft-2020-12")&&(d.propertyNames=this.process(e.keyType,{...f,path:[...f.path,"propertyNames"]})),d.additionalProperties=this.process(e.valueType,{...f,path:[...f.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const d=v,h=gn(e.entries);h.every(y=>typeof y=="number")&&(d.type="number"),h.every(y=>typeof y=="string")&&(d.type="string"),d.enum=h;break}case"literal":{const d=v,h=[];for(const y of e.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(y))}else h.push(y);if(h.length!==0)if(h.length===1){const y=h[0];d.type=y===null?"null":typeof y,this.target==="draft-4"||this.target==="openapi-3.0"?d.enum=[y]:d.const=y}else h.every(y=>typeof y=="number")&&(d.type="number"),h.every(y=>typeof y=="string")&&(d.type="string"),h.every(y=>typeof y=="boolean")&&(d.type="string"),h.every(y=>y===null)&&(d.type="null"),d.enum=h;break}case"file":{const d=v,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:U,mime:x}=n._zod.bag;y!==void 0&&(h.minLength=y),U!==void 0&&(h.maxLength=U),x?x.length===1?(h.contentMediaType=x[0],Object.assign(d,h)):d.anyOf=x.map(T=>({...h,contentMediaType:T})):Object.assign(d,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const d=this.process(e.innerType,f);this.target==="openapi-3.0"?(u.ref=e.innerType,v.nullable=!0):v.anyOf=[d,{type:"null"}];break}case"nonoptional":{this.process(e.innerType,f),u.ref=e.innerType;break}case"success":{const d=v;d.type="boolean";break}case"default":{this.process(e.innerType,f),u.ref=e.innerType,v.default=JSON.parse(JSON.stringify(e.defaultValue));break}case"prefault":{this.process(e.innerType,f),u.ref=e.innerType,this.io==="input"&&(v._prefault=JSON.parse(JSON.stringify(e.defaultValue)));break}case"catch":{this.process(e.innerType,f),u.ref=e.innerType;let d;try{d=e.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}v.default=d;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const d=v,h=n._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");d.type="string",d.pattern=h.source;break}case"pipe":{const d=this.io==="input"?e.in._zod.def.type==="transform"?e.out:e.in:e.out;this.process(d,f),u.ref=d;break}case"readonly":{this.process(e.innerType,f),u.ref=e.innerType,v.readOnly=!0;break}case"promise":{this.process(e.innerType,f),u.ref=e.innerType;break}case"optional":{this.process(e.innerType,f),u.ref=e.innerType;break}case"lazy":{const d=n._zod.innerType;this.process(d,f),u.ref=d;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema");break}}}}const l=this.metadataRegistry.get(n);return l&&Object.assign(u.schema,l),this.io==="input"&&J(n)&&(delete u.schema.examples,delete u.schema.default),this.io==="input"&&u.schema._prefault&&((o=u.schema).default??(o.default=u.schema._prefault)),delete u.schema._prefault,this.seen.get(n).schema}emit(n,r){const o={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},e=this.seen.get(n);if(!e)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=m=>{const f=this.target==="draft-2020-12"?"$defs":"definitions";if(o.external){const h=o.external.registry.get(m[0])?.id,y=o.external.uri??(x=>x);if(h)return{ref:y(h)};const U=m[1].defId??m[1].schema.id??`schema${this.counter++}`;return m[1].defId=U,{defId:U,ref:`${y("__shared")}#/${f}/${U}`}}if(m[1]===e)return{ref:"#"};const v=`#/${f}/`,d=m[1].schema.id??`__schema${this.counter++}`;return{defId:d,ref:v+d}},a=m=>{if(m[1].schema.$ref)return;const f=m[1],{ref:b,defId:v}=i(m);f.def={...f.schema},v&&(f.defId=v);const d=f.schema;for(const h in d)delete d[h];d.$ref=b};if(o.cycles==="throw")for(const m of this.seen.entries()){const f=m[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
23
+
24
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const m of this.seen.entries()){const f=m[1];if(n===m[0]){a(m);continue}if(o.external){const v=o.external.registry.get(m[0])?.id;if(n!==m[0]&&v){a(m);continue}}if(this.metadataRegistry.get(m[0])?.id){a(m);continue}if(f.cycle){a(m);continue}if(f.count>1&&o.reused==="ref"){a(m);continue}}const u=(m,f)=>{const b=this.seen.get(m),v=b.def??b.schema,d={...v};if(b.ref===null)return;const h=b.ref;if(b.ref=null,h){u(h,f);const y=this.seen.get(h).schema;y.$ref&&(f.target==="draft-7"||f.target==="draft-4"||f.target==="openapi-3.0")?(v.allOf=v.allOf??[],v.allOf.push(y)):(Object.assign(v,y),Object.assign(v,d))}b.isParent||this.override({zodSchema:m,jsonSchema:v,path:b.path??[]})};for(const m of[...this.seen.entries()].reverse())u(m[0],{target:this.target});const s={};if(this.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?s.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?s.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),o.external?.uri){const m=o.external.registry.get(n)?.id;if(!m)throw new Error("Schema is missing an `id` property");s.$id=o.external.uri(m)}Object.assign(s,e.def);const l=o.external?.defs??{};for(const m of this.seen.entries()){const f=m[1];f.def&&f.defId&&(l[f.defId]=f.def)}o.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?s.$defs=l:s.definitions=l);try{return JSON.parse(JSON.stringify(s))}catch{throw new Error("Error converting schema to JSON.")}}}function ds(t,n){if(t instanceof Fn){const o=new un(n),e={};for(const u of t._idmap.entries()){const[s,l]=u;o.process(l)}const i={},a={registry:t,uri:n?.uri,defs:e};for(const u of t._idmap.entries()){const[s,l]=u;i[s]=o.emit(l,{...n,external:a})}if(Object.keys(e).length>0){const u=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[u]:e}}return{schemas:i}}const r=new un(n);return r.process(t),r.emit(t,n)}function J(t,n){const r=n??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const e=t._zod.def;switch(e.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 J(e.element,r);case"object":{for(const i in e.shape)if(J(e.shape[i],r))return!0;return!1}case"union":{for(const i of e.options)if(J(i,r))return!0;return!1}case"intersection":return J(e.left,r)||J(e.right,r);case"tuple":{for(const i of e.items)if(J(i,r))return!0;return!!(e.rest&&J(e.rest,r))}case"record":return J(e.keyType,r)||J(e.valueType,r);case"map":return J(e.keyType,r)||J(e.valueType,r);case"set":return J(e.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return J(e.innerType,r);case"lazy":return J(e.getter(),r);case"default":return J(e.innerType,r);case"prefault":return J(e.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return J(e.in,r)||J(e.out,r);case"success":return!1;case"catch":return!1;case"function":return!1}throw new Error(`Unknown schema type: ${e.type}`)}const jm=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),xm=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:Za,$ZodArray:Ma,$ZodAsyncError:Oe,$ZodBase64:Sa,$ZodBase64URL:Oa,$ZodBigInt:An,$ZodBigIntFormat:Ta,$ZodBoolean:Dn,$ZodCIDRv4:ka,$ZodCIDRv6:Ia,$ZodCUID:ma,$ZodCUID2:fa,$ZodCatch:su,$ZodCheck:C,$ZodCheckBigIntFormat:Mo,$ZodCheckEndsWith:ea,$ZodCheckGreaterThan:En,$ZodCheckIncludes:Yo,$ZodCheckLengthEquals:Wo,$ZodCheckLessThan:Nn,$ZodCheckLowerCase:Xo,$ZodCheckMaxLength:Vo,$ZodCheckMaxSize:Go,$ZodCheckMimeType:na,$ZodCheckMinLength:Ko,$ZodCheckMinSize:Jo,$ZodCheckMultipleOf:Lo,$ZodCheckNumberFormat:Co,$ZodCheckOverwrite:ra,$ZodCheckProperty:ta,$ZodCheckRegex:qo,$ZodCheckSizeEquals:Bo,$ZodCheckStartsWith:Qo,$ZodCheckStringFormat:st,$ZodCheckUpperCase:Ho,$ZodCodec:Rn,$ZodCustom:vu,$ZodCustomStringFormat:Ea,$ZodDate:Ca,$ZodDefault:iu,$ZodDiscriminatedUnion:Ka,$ZodE164:ja,$ZodEmail:sa,$ZodEmoji:la,$ZodEncodeError:Dt,$ZodEnum:Ya,$ZodError:vn,$ZodFile:eu,$ZodFunction:fu,$ZodGUID:aa,$ZodIPv4:ya,$ZodIPv6:wa,$ZodISODate:$a,$ZodISODateTime:ha,$ZodISODuration:_a,$ZodISOTime:ba,$ZodIntersection:Wa,$ZodJWT:Na,$ZodKSUID:va,$ZodLazy:pu,$ZodLiteral:Qa,$ZodMap:Xa,$ZodNaN:cu,$ZodNanoID:da,$ZodNever:Fa,$ZodNonOptional:au,$ZodNull:Pa,$ZodNullable:ru,$ZodNumber:Tn,$ZodNumberFormat:Ua,$ZodObject:Ba,$ZodObjectJIT:Va,$ZodOptional:nu,$ZodPipe:lu,$ZodPrefault:ou,$ZodPromise:gu,$ZodReadonly:du,$ZodRealError:te,$ZodRecord:qa,$ZodRegistry:Fn,$ZodSet:Ha,$ZodString:ct,$ZodStringFormat:P,$ZodSuccess:uu,$ZodSymbol:Da,$ZodTemplateLiteral:mu,$ZodTransform:tu,$ZodTuple:Zn,$ZodType:S,$ZodULID:ga,$ZodURL:ca,$ZodUUID:ua,$ZodUndefined:Aa,$ZodUnion:Pn,$ZodUnknown:Ra,$ZodVoid:La,$ZodXID:pa,$brand:Pi,$constructor:c,$input:wu,$output:yu,Doc:ia,JSONSchema:jm,JSONSchemaGenerator:un,NEVER:Ai,TimePrecision:Su,_any:Vu,_array:is,_base64:rr,_base64url:ir,_bigint:Fu,_boolean:Zu,_catch:wm,_check:cs,_cidrv4:tr,_cidrv6:nr,_coercedBigint:Lu,_coercedBoolean:Ru,_coercedDate:Hu,_coercedNumber:Eu,_coercedString:Iu,_cuid:Wn,_cuid2:qn,_custom:as,_date:Xu,_decode:_n,_decodeAsync:wn,_default:bm,_discriminatedUnion:um,_e164:or,_email:Cn,_emoji:Vn,_encode:bn,_encodeAsync:yn,_endsWith:fr,_enum:fm,_file:os,_float32:Tu,_float64:Du,_gt:Ne,_gte:ee,_guid:jt,_includes:dr,_int:Uu,_int32:Au,_int64:Cu,_intersection:sm,_ipv4:Qn,_ipv6:er,_isoDate:Ou,_isoDateTime:zu,_isoDuration:xu,_isoTime:ju,_jwt:ar,_ksuid:Yn,_lazy:zm,_length:Mt,_literal:pm,_lowercase:cr,_lt:xe,_lte:ae,_map:dm,_max:ae,_maxLength:Ct,_maxSize:Lt,_mime:gr,_min:ee,_minLength:Re,_minSize:Ye,_multipleOf:He,_nan:Yu,_nanoid:Kn,_nativeEnum:gm,_negative:es,_never:Wu,_nonnegative:ns,_nonoptional:_m,_nonpositive:ts,_normalize:pr,_null:Bu,_nullable:$m,_number:Nu,_optional:hm,_overwrite:Ue,_parse:nt,_parseAsync:rt,_pipe:km,_positive:Qu,_promise:Om,_property:rs,_readonly:Im,_record:lm,_refine:us,_regex:sr,_safeDecode:In,_safeDecodeAsync:zn,_safeEncode:kn,_safeEncodeAsync:Sn,_safeParse:it,_safeParseAsync:ot,_set:mm,_size:ur,_startsWith:mr,_string:ku,_stringFormat:lt,_stringbool:ls,_success:ym,_superRefine:ss,_symbol:Gu,_templateLiteral:Sm,_toLowerCase:hr,_toUpperCase:$r,_transform:vm,_trim:vr,_tuple:cm,_uint32:Pu,_uint64:Mu,_ulid:Xn,_undefined:Ju,_union:am,_unknown:Ku,_uppercase:lr,_url:Ft,_uuid:Mn,_uuidv4:Gn,_uuidv6:Jn,_uuidv7:Bn,_void:qu,_xid:Hn,clone:ie,config:H,decode:Cc,decodeAsync:Gc,encode:Lc,encodeAsync:Mc,flattenError:hn,formatError:$n,globalConfig:It,globalRegistry:ze,isValidBase64:Un,isValidBase64URL:za,isValidJWT:xa,locales:_u,parse:rn,parseAsync:on,prettifyError:no,regexes:xn,registry:Ln,safeDecode:Bc,safeDecodeAsync:Kc,safeEncode:Jc,safeEncodeAsync:Vc,safeParse:ro,safeParseAsync:io,toDotPath:to,toJSONSchema:ds,treeifyError:eo,util:Yi,version:oa},Symbol.toStringTag,{value:"Module"})),br=c("ZodISODateTime",(t,n)=>{ha.init(t,n),R.init(t,n)});function ms(t){return zu(br,t)}const _r=c("ZodISODate",(t,n)=>{$a.init(t,n),R.init(t,n)});function fs(t){return Ou(_r,t)}const yr=c("ZodISOTime",(t,n)=>{ba.init(t,n),R.init(t,n)});function gs(t){return ju(yr,t)}const wr=c("ZodISODuration",(t,n)=>{_a.init(t,n),R.init(t,n)});function ps(t){return xu(wr,t)}const Nm=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:_r,ZodISODateTime:br,ZodISODuration:wr,ZodISOTime:yr,date:fs,datetime:ms,duration:ps,time:gs},Symbol.toStringTag,{value:"Module"})),vs=(t,n)=>{vn.init(t,n),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>$n(t,r)},flatten:{value:r=>hn(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,St,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,St,2)}},isEmpty:{get(){return t.issues.length===0}}})},Em=c("ZodError",vs),ne=c("ZodError",vs,{Parent:Error}),hs=nt(ne),$s=rt(ne),bs=it(ne),_s=ot(ne),ys=bn(ne),ws=_n(ne),ks=yn(ne),Is=wn(ne),Ss=kn(ne),zs=In(ne),Os=Sn(ne),js=zn(ne),z=c("ZodType",(t,n)=>(S.init(t,n),t.def=n,t.type=n.type,Object.defineProperty(t,"_def",{value:n}),t.check=(...r)=>t.clone(he(n,{checks:[...n.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]})),t.clone=(r,o)=>ie(t,r,o),t.brand=()=>t,t.register=(r,o)=>(r.add(t,o),t),t.parse=(r,o)=>hs(t,r,o,{callee:t.parse}),t.safeParse=(r,o)=>bs(t,r,o),t.parseAsync=async(r,o)=>$s(t,r,o,{callee:t.parseAsync}),t.safeParseAsync=async(r,o)=>_s(t,r,o),t.spa=t.safeParseAsync,t.encode=(r,o)=>ys(t,r,o),t.decode=(r,o)=>ws(t,r,o),t.encodeAsync=async(r,o)=>ks(t,r,o),t.decodeAsync=async(r,o)=>Is(t,r,o),t.safeEncode=(r,o)=>Ss(t,r,o),t.safeDecode=(r,o)=>zs(t,r,o),t.safeEncodeAsync=async(r,o)=>Os(t,r,o),t.safeDecodeAsync=async(r,o)=>js(t,r,o),t.refine=(r,o)=>t.check(cc(r,o)),t.superRefine=r=>t.check(lc(r)),t.overwrite=r=>t.check(Ue(r)),t.optional=()=>Nt(t),t.nullable=()=>Et(t),t.nullish=()=>Nt(Et(t)),t.nonoptional=r=>Ys(t,r),t.array=()=>de(t),t.or=r=>$e([t,r]),t.and=r=>Fs(t,r),t.transform=r=>Ut(t,Vr(r)),t.default=r=>qs(t,r),t.prefault=r=>Hs(t,r),t.catch=r=>tc(t,r),t.pipe=r=>Ut(t,r),t.readonly=()=>ic(t),t.describe=r=>{const o=t.clone();return ze.add(o,{description:r}),o},Object.defineProperty(t,"description",{get(){return ze.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return ze.get(t);const o=t.clone();return ze.add(o,r[0]),o},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),kr=c("_ZodString",(t,n)=>{ct.init(t,n),z.init(t,n);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...o)=>t.check(sr(...o)),t.includes=(...o)=>t.check(dr(...o)),t.startsWith=(...o)=>t.check(mr(...o)),t.endsWith=(...o)=>t.check(fr(...o)),t.min=(...o)=>t.check(Re(...o)),t.max=(...o)=>t.check(Ct(...o)),t.length=(...o)=>t.check(Mt(...o)),t.nonempty=(...o)=>t.check(Re(1,...o)),t.lowercase=o=>t.check(cr(o)),t.uppercase=o=>t.check(lr(o)),t.trim=()=>t.check(vr()),t.normalize=(...o)=>t.check(pr(...o)),t.toLowerCase=()=>t.check(hr()),t.toUpperCase=()=>t.check($r())}),Gt=c("ZodString",(t,n)=>{ct.init(t,n),kr.init(t,n),t.email=r=>t.check(Cn(Ir,r)),t.url=r=>t.check(Ft(Jt,r)),t.jwt=r=>t.check(ar(Fr,r)),t.emoji=r=>t.check(Vn(Sr,r)),t.guid=r=>t.check(jt(xt,r)),t.uuid=r=>t.check(Mn(ge,r)),t.uuidv4=r=>t.check(Gn(ge,r)),t.uuidv6=r=>t.check(Jn(ge,r)),t.uuidv7=r=>t.check(Bn(ge,r)),t.nanoid=r=>t.check(Kn(zr,r)),t.guid=r=>t.check(jt(xt,r)),t.cuid=r=>t.check(Wn(Or,r)),t.cuid2=r=>t.check(qn(jr,r)),t.ulid=r=>t.check(Xn(xr,r)),t.base64=r=>t.check(rr(Pr,r)),t.base64url=r=>t.check(ir(Zr,r)),t.xid=r=>t.check(Hn(Nr,r)),t.ksuid=r=>t.check(Yn(Er,r)),t.ipv4=r=>t.check(Qn(Ur,r)),t.ipv6=r=>t.check(er(Tr,r)),t.cidrv4=r=>t.check(tr(Dr,r)),t.cidrv6=r=>t.check(nr(Ar,r)),t.e164=r=>t.check(or(Rr,r)),t.datetime=r=>t.check(ms(r)),t.date=r=>t.check(fs(r)),t.time=r=>t.check(gs(r)),t.duration=r=>t.check(ps(r))});function j(t){return ku(Gt,t)}const R=c("ZodStringFormat",(t,n)=>{P.init(t,n),kr.init(t,n)}),Ir=c("ZodEmail",(t,n)=>{sa.init(t,n),R.init(t,n)});function Um(t){return Cn(Ir,t)}const xt=c("ZodGUID",(t,n)=>{aa.init(t,n),R.init(t,n)});function Tm(t){return jt(xt,t)}const ge=c("ZodUUID",(t,n)=>{ua.init(t,n),R.init(t,n)});function Dm(t){return Mn(ge,t)}function Am(t){return Gn(ge,t)}function Pm(t){return Jn(ge,t)}function Zm(t){return Bn(ge,t)}const Jt=c("ZodURL",(t,n)=>{ca.init(t,n),R.init(t,n)});function Rm(t){return Ft(Jt,t)}function Fm(t){return Ft(Jt,{protocol:/^https?$/,hostname:wo,...p(t)})}const Sr=c("ZodEmoji",(t,n)=>{la.init(t,n),R.init(t,n)});function Lm(t){return Vn(Sr,t)}const zr=c("ZodNanoID",(t,n)=>{da.init(t,n),R.init(t,n)});function Cm(t){return Kn(zr,t)}const Or=c("ZodCUID",(t,n)=>{ma.init(t,n),R.init(t,n)});function Mm(t){return Wn(Or,t)}const jr=c("ZodCUID2",(t,n)=>{fa.init(t,n),R.init(t,n)});function Gm(t){return qn(jr,t)}const xr=c("ZodULID",(t,n)=>{ga.init(t,n),R.init(t,n)});function Jm(t){return Xn(xr,t)}const Nr=c("ZodXID",(t,n)=>{pa.init(t,n),R.init(t,n)});function Bm(t){return Hn(Nr,t)}const Er=c("ZodKSUID",(t,n)=>{va.init(t,n),R.init(t,n)});function Vm(t){return Yn(Er,t)}const Ur=c("ZodIPv4",(t,n)=>{ya.init(t,n),R.init(t,n)});function Km(t){return Qn(Ur,t)}const Tr=c("ZodIPv6",(t,n)=>{wa.init(t,n),R.init(t,n)});function Wm(t){return er(Tr,t)}const Dr=c("ZodCIDRv4",(t,n)=>{ka.init(t,n),R.init(t,n)});function qm(t){return tr(Dr,t)}const Ar=c("ZodCIDRv6",(t,n)=>{Ia.init(t,n),R.init(t,n)});function Xm(t){return nr(Ar,t)}const Pr=c("ZodBase64",(t,n)=>{Sa.init(t,n),R.init(t,n)});function Hm(t){return rr(Pr,t)}const Zr=c("ZodBase64URL",(t,n)=>{Oa.init(t,n),R.init(t,n)});function Ym(t){return ir(Zr,t)}const Rr=c("ZodE164",(t,n)=>{ja.init(t,n),R.init(t,n)});function Qm(t){return or(Rr,t)}const Fr=c("ZodJWT",(t,n)=>{Na.init(t,n),R.init(t,n)});function ef(t){return ar(Fr,t)}const dt=c("ZodCustomStringFormat",(t,n)=>{Ea.init(t,n),R.init(t,n)});function tf(t,n,r={}){return lt(dt,t,n,r)}function nf(t){return lt(dt,"hostname",jn,t)}function rf(t){return lt(dt,"hex",Ro,t)}function of(t,n){const r=n?.enc??"hex",o=`${t}_${r}`,e=xn[o];if(!e)throw new Error(`Unrecognized hash format: ${o}`);return lt(dt,o,e,n)}const Bt=c("ZodNumber",(t,n)=>{Tn.init(t,n),z.init(t,n),t.gt=(o,e)=>t.check(Ne(o,e)),t.gte=(o,e)=>t.check(ee(o,e)),t.min=(o,e)=>t.check(ee(o,e)),t.lt=(o,e)=>t.check(xe(o,e)),t.lte=(o,e)=>t.check(ae(o,e)),t.max=(o,e)=>t.check(ae(o,e)),t.int=o=>t.check(sn(o)),t.safe=o=>t.check(sn(o)),t.positive=o=>t.check(Ne(0,o)),t.nonnegative=o=>t.check(ee(0,o)),t.negative=o=>t.check(xe(0,o)),t.nonpositive=o=>t.check(ae(0,o)),t.multipleOf=(o,e)=>t.check(He(o,e)),t.step=(o,e)=>t.check(He(o,e)),t.finite=()=>t;const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function ce(t){return Nu(Bt,t)}const Ce=c("ZodNumberFormat",(t,n)=>{Ua.init(t,n),Bt.init(t,n)});function sn(t){return Uu(Ce,t)}function af(t){return Tu(Ce,t)}function uf(t){return Du(Ce,t)}function sf(t){return Au(Ce,t)}function cf(t){return Pu(Ce,t)}const Vt=c("ZodBoolean",(t,n)=>{Dn.init(t,n),z.init(t,n)});function Me(t){return Zu(Vt,t)}const Kt=c("ZodBigInt",(t,n)=>{An.init(t,n),z.init(t,n),t.gte=(o,e)=>t.check(ee(o,e)),t.min=(o,e)=>t.check(ee(o,e)),t.gt=(o,e)=>t.check(Ne(o,e)),t.gte=(o,e)=>t.check(ee(o,e)),t.min=(o,e)=>t.check(ee(o,e)),t.lt=(o,e)=>t.check(xe(o,e)),t.lte=(o,e)=>t.check(ae(o,e)),t.max=(o,e)=>t.check(ae(o,e)),t.positive=o=>t.check(Ne(BigInt(0),o)),t.negative=o=>t.check(xe(BigInt(0),o)),t.nonpositive=o=>t.check(ae(BigInt(0),o)),t.nonnegative=o=>t.check(ee(BigInt(0),o)),t.multipleOf=(o,e)=>t.check(He(o,e));const r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function lf(t){return Fu(Kt,t)}const Lr=c("ZodBigIntFormat",(t,n)=>{Ta.init(t,n),Kt.init(t,n)});function df(t){return Cu(Lr,t)}function mf(t){return Mu(Lr,t)}const xs=c("ZodSymbol",(t,n)=>{Da.init(t,n),z.init(t,n)});function ff(t){return Gu(xs,t)}const Ns=c("ZodUndefined",(t,n)=>{Aa.init(t,n),z.init(t,n)});function gf(t){return Ju(Ns,t)}const Es=c("ZodNull",(t,n)=>{Pa.init(t,n),z.init(t,n)});function Cr(t){return Bu(Es,t)}const Us=c("ZodAny",(t,n)=>{Za.init(t,n),z.init(t,n)});function le(){return Vu(Us)}const Ts=c("ZodUnknown",(t,n)=>{Ra.init(t,n),z.init(t,n)});function ve(){return Ku(Ts)}const Ds=c("ZodNever",(t,n)=>{Fa.init(t,n),z.init(t,n)});function Mr(t){return Wu(Ds,t)}const As=c("ZodVoid",(t,n)=>{La.init(t,n),z.init(t,n)});function pf(t){return qu(As,t)}const Gr=c("ZodDate",(t,n)=>{Ca.init(t,n),z.init(t,n),t.min=(o,e)=>t.check(ee(o,e)),t.max=(o,e)=>t.check(ae(o,e));const r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function vf(t){return Xu(Gr,t)}const Ps=c("ZodArray",(t,n)=>{Ma.init(t,n),z.init(t,n),t.element=n.element,t.min=(r,o)=>t.check(Re(r,o)),t.nonempty=r=>t.check(Re(1,r)),t.max=(r,o)=>t.check(Ct(r,o)),t.length=(r,o)=>t.check(Mt(r,o)),t.unwrap=()=>t.element});function de(t,n){return is(Ps,t,n)}function hf(t){const n=t._zod.def.shape;return Je(Object.keys(n))}const Wt=c("ZodObject",(t,n)=>{Va.init(t,n),z.init(t,n),O(t,"shape",()=>n.shape),t.keyof=()=>Je(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ve()}),t.loose=()=>t.clone({...t._zod.def,catchall:ve()}),t.strict=()=>t.clone({...t._zod.def,catchall:Mr()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>Bi(t,r),t.safeExtend=r=>Vi(t,r),t.merge=r=>Ki(t,r),t.pick=r=>Gi(t,r),t.omit=r=>Ji(t,r),t.partial=(...r)=>Wi(Kr,t,r[0]),t.required=(...r)=>qi(Wr,t,r[0])});function A(t,n){const r={type:"object",shape:t??{},...p(n)};return new Wt(r)}function $f(t,n){return new Wt({type:"object",shape:t,catchall:Mr(),...p(n)})}function bf(t,n){return new Wt({type:"object",shape:t,catchall:ve(),...p(n)})}const Jr=c("ZodUnion",(t,n)=>{Pn.init(t,n),z.init(t,n),t.options=n.options});function $e(t,n){return new Jr({type:"union",options:t,...p(n)})}const Zs=c("ZodDiscriminatedUnion",(t,n)=>{Jr.init(t,n),Ka.init(t,n)});function _f(t,n,r){return new Zs({type:"union",options:n,discriminator:t,...p(r)})}const Rs=c("ZodIntersection",(t,n)=>{Wa.init(t,n),z.init(t,n)});function Fs(t,n){return new Rs({type:"intersection",left:t,right:n})}const Ls=c("ZodTuple",(t,n)=>{Zn.init(t,n),z.init(t,n),t.rest=r=>t.clone({...t._zod.def,rest:r})});function Cs(t,n,r){const o=n instanceof S,e=o?r:n,i=o?n:null;return new Ls({type:"tuple",items:t,rest:i,...p(e)})}const Br=c("ZodRecord",(t,n)=>{qa.init(t,n),z.init(t,n),t.keyType=n.keyType,t.valueType=n.valueType});function Ge(t,n,r){return new Br({type:"record",keyType:t,valueType:n,...p(r)})}function yf(t,n,r){const o=ie(t);return o._zod.values=void 0,new Br({type:"record",keyType:o,valueType:n,...p(r)})}const Ms=c("ZodMap",(t,n)=>{Xa.init(t,n),z.init(t,n),t.keyType=n.keyType,t.valueType=n.valueType});function wf(t,n,r){return new Ms({type:"map",keyType:t,valueType:n,...p(r)})}const Gs=c("ZodSet",(t,n)=>{Ha.init(t,n),z.init(t,n),t.min=(...r)=>t.check(Ye(...r)),t.nonempty=r=>t.check(Ye(1,r)),t.max=(...r)=>t.check(Lt(...r)),t.size=(...r)=>t.check(ur(...r))});function kf(t,n){return new Gs({type:"set",valueType:t,...p(n)})}const Qe=c("ZodEnum",(t,n)=>{Ya.init(t,n),z.init(t,n),t.enum=n.entries,t.options=Object.values(n.entries);const r=new Set(Object.keys(n.entries));t.extract=(o,e)=>{const i={};for(const a of o)if(r.has(a))i[a]=n.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Qe({...n,checks:[],...p(e),entries:i})},t.exclude=(o,e)=>{const i={...n.entries};for(const a of o)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Qe({...n,checks:[],...p(e),entries:i})}});function Je(t,n){const r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new Qe({type:"enum",entries:r,...p(n)})}function If(t,n){return new Qe({type:"enum",entries:t,...p(n)})}const Js=c("ZodLiteral",(t,n)=>{Qa.init(t,n),z.init(t,n),t.values=new Set(n.values),Object.defineProperty(t,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function X(t,n){return new Js({type:"literal",values:Array.isArray(t)?t:[t],...p(n)})}const Bs=c("ZodFile",(t,n)=>{eu.init(t,n),z.init(t,n),t.min=(r,o)=>t.check(Ye(r,o)),t.max=(r,o)=>t.check(Lt(r,o)),t.mime=(r,o)=>t.check(gr(Array.isArray(r)?r:[r],o))});function Sf(t){return os(Bs,t)}const Vs=c("ZodTransform",(t,n)=>{tu.init(t,n),z.init(t,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Dt(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Pe(i,r.value,n));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),r.issues.push(Pe(a))}};const e=n.transform(r.value,r);return e instanceof Promise?e.then(i=>(r.value=i,r)):(r.value=e,r)}});function Vr(t){return new Vs({type:"transform",transform:t})}const Kr=c("ZodOptional",(t,n)=>{nu.init(t,n),z.init(t,n),t.unwrap=()=>t._zod.def.innerType});function Nt(t){return new Kr({type:"optional",innerType:t})}const Ks=c("ZodNullable",(t,n)=>{ru.init(t,n),z.init(t,n),t.unwrap=()=>t._zod.def.innerType});function Et(t){return new Ks({type:"nullable",innerType:t})}function zf(t){return Nt(Et(t))}const Ws=c("ZodDefault",(t,n)=>{iu.init(t,n),z.init(t,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function qs(t,n){return new Ws({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():Pt(n)}})}const Xs=c("ZodPrefault",(t,n)=>{ou.init(t,n),z.init(t,n),t.unwrap=()=>t._zod.def.innerType});function Hs(t,n){return new Xs({type:"prefault",innerType:t,get defaultValue(){return typeof n=="function"?n():Pt(n)}})}const Wr=c("ZodNonOptional",(t,n)=>{au.init(t,n),z.init(t,n),t.unwrap=()=>t._zod.def.innerType});function Ys(t,n){return new Wr({type:"nonoptional",innerType:t,...p(n)})}const Qs=c("ZodSuccess",(t,n)=>{uu.init(t,n),z.init(t,n),t.unwrap=()=>t._zod.def.innerType});function Of(t){return new Qs({type:"success",innerType:t})}const ec=c("ZodCatch",(t,n)=>{su.init(t,n),z.init(t,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function tc(t,n){return new ec({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}const nc=c("ZodNaN",(t,n)=>{cu.init(t,n),z.init(t,n)});function jf(t){return Yu(nc,t)}const qr=c("ZodPipe",(t,n)=>{lu.init(t,n),z.init(t,n),t.in=n.in,t.out=n.out});function Ut(t,n){return new qr({type:"pipe",in:t,out:n})}const Xr=c("ZodCodec",(t,n)=>{qr.init(t,n),Rn.init(t,n)});function xf(t,n,r){return new Xr({type:"pipe",in:t,out:n,transform:r.decode,reverseTransform:r.encode})}const rc=c("ZodReadonly",(t,n)=>{du.init(t,n),z.init(t,n),t.unwrap=()=>t._zod.def.innerType});function ic(t){return new rc({type:"readonly",innerType:t})}const oc=c("ZodTemplateLiteral",(t,n)=>{mu.init(t,n),z.init(t,n)});function Nf(t,n){return new oc({type:"template_literal",parts:t,...p(n)})}const ac=c("ZodLazy",(t,n)=>{pu.init(t,n),z.init(t,n),t.unwrap=()=>t._zod.def.getter()});function Hr(t){return new ac({type:"lazy",getter:t})}const uc=c("ZodPromise",(t,n)=>{gu.init(t,n),z.init(t,n),t.unwrap=()=>t._zod.def.innerType});function Ef(t){return new uc({type:"promise",innerType:t})}const sc=c("ZodFunction",(t,n)=>{fu.init(t,n),z.init(t,n)});function _i(t){return new sc({type:"function",input:Array.isArray(t?.input)?Cs(t?.input):t?.input??de(ve()),output:t?.output??ve()})}const qt=c("ZodCustom",(t,n)=>{vu.init(t,n),z.init(t,n)});function Uf(t){const n=new C({check:"custom"});return n._zod.check=t,n}function Tf(t,n){return as(qt,t??(()=>!0),n)}function cc(t,n={}){return us(qt,t,n)}function lc(t){return ss(t)}function Df(t,n={error:`Input not instance of ${t.name}`}){const r=new qt({type:"custom",check:"custom",fn:o=>o instanceof t,abort:!0,...p(n)});return r._zod.bag.Class=t,r}const Af=(...t)=>ls({Codec:Xr,Boolean:Vt,String:Gt},...t);function Pf(t){const n=Hr(()=>$e([j(t),ce(),Me(),Cr(),de(n),Ge(j(),n)]));return n}function Zf(t,n){return Ut(Vr(t),n)}const Rf={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 Ff(t){H({customError:t})}function Lf(){return H().customError}var cn;cn||(cn={});function Cf(t){return Iu(Gt,t)}function Mf(t){return Eu(Bt,t)}function Gf(t){return Ru(Vt,t)}function Jf(t){return Lu(Kt,t)}function kt(t){return Hu(Gr,t)}const Bf=Object.freeze(Object.defineProperty({__proto__:null,bigint:Jf,boolean:Gf,date:kt,number:Mf,string:Cf},Symbol.toStringTag,{value:"Module"}));H(hu());const K=Object.freeze(Object.defineProperty({__proto__:null,$brand:Pi,$input:wu,$output:yu,NEVER:Ai,TimePrecision:Su,ZodAny:Us,ZodArray:Ps,ZodBase64:Pr,ZodBase64URL:Zr,ZodBigInt:Kt,ZodBigIntFormat:Lr,ZodBoolean:Vt,ZodCIDRv4:Dr,ZodCIDRv6:Ar,ZodCUID:Or,ZodCUID2:jr,ZodCatch:ec,ZodCodec:Xr,ZodCustom:qt,ZodCustomStringFormat:dt,ZodDate:Gr,ZodDefault:Ws,ZodDiscriminatedUnion:Zs,ZodE164:Rr,ZodEmail:Ir,ZodEmoji:Sr,ZodEnum:Qe,ZodError:Em,ZodFile:Bs,get ZodFirstPartyTypeKind(){return cn},ZodFunction:sc,ZodGUID:xt,ZodIPv4:Ur,ZodIPv6:Tr,ZodISODate:_r,ZodISODateTime:br,ZodISODuration:wr,ZodISOTime:yr,ZodIntersection:Rs,ZodIssueCode:Rf,ZodJWT:Fr,ZodKSUID:Er,ZodLazy:ac,ZodLiteral:Js,ZodMap:Ms,ZodNaN:nc,ZodNanoID:zr,ZodNever:Ds,ZodNonOptional:Wr,ZodNull:Es,ZodNullable:Ks,ZodNumber:Bt,ZodNumberFormat:Ce,ZodObject:Wt,ZodOptional:Kr,ZodPipe:qr,ZodPrefault:Xs,ZodPromise:uc,ZodReadonly:rc,ZodRealError:ne,ZodRecord:Br,ZodSet:Gs,ZodString:Gt,ZodStringFormat:R,ZodSuccess:Qs,ZodSymbol:xs,ZodTemplateLiteral:oc,ZodTransform:Vs,ZodTuple:Ls,ZodType:z,ZodULID:xr,ZodURL:Jt,ZodUUID:ge,ZodUndefined:Ns,ZodUnion:Jr,ZodUnknown:Ts,ZodVoid:As,ZodXID:Nr,_ZodString:kr,_default:qs,_function:_i,any:le,array:de,base64:Hm,base64url:Ym,bigint:lf,boolean:Me,catch:tc,check:Uf,cidrv4:qm,cidrv6:Xm,clone:ie,codec:xf,coerce:Bf,config:H,core:xm,cuid:Mm,cuid2:Gm,custom:Tf,date:vf,decode:ws,decodeAsync:Is,discriminatedUnion:_f,e164:Qm,email:Um,emoji:Lm,encode:ys,encodeAsync:ks,endsWith:fr,enum:Je,file:Sf,flattenError:hn,float32:af,float64:uf,formatError:$n,function:_i,getErrorMap:Lf,globalRegistry:ze,gt:Ne,gte:ee,guid:Tm,hash:of,hex:rf,hostname:nf,httpUrl:Fm,includes:dr,instanceof:Df,int:sn,int32:sf,int64:df,intersection:Fs,ipv4:Km,ipv6:Wm,iso:Nm,json:Pf,jwt:ef,keyof:hf,ksuid:Vm,lazy:Hr,length:Mt,literal:X,locales:_u,looseObject:bf,lowercase:cr,lt:xe,lte:ae,map:wf,maxLength:Ct,maxSize:Lt,mime:gr,minLength:Re,minSize:Ye,multipleOf:He,nan:jf,nanoid:Cm,nativeEnum:If,negative:es,never:Mr,nonnegative:ns,nonoptional:Ys,nonpositive:ts,normalize:pr,null:Cr,nullable:Et,nullish:zf,number:ce,object:A,optional:Nt,overwrite:Ue,parse:hs,parseAsync:$s,partialRecord:yf,pipe:Ut,positive:Qu,prefault:Hs,preprocess:Zf,prettifyError:no,promise:Ef,property:rs,readonly:ic,record:Ge,refine:cc,regex:sr,regexes:xn,registry:Ln,safeDecode:zs,safeDecodeAsync:js,safeEncode:Ss,safeEncodeAsync:Os,safeParse:bs,safeParseAsync:_s,set:kf,setErrorMap:Ff,size:ur,startsWith:mr,strictObject:$f,string:j,stringFormat:tf,stringbool:Af,success:Of,superRefine:lc,symbol:ff,templateLiteral:Nf,toJSONSchema:ds,toLowerCase:hr,toUpperCase:$r,transform:Vr,treeifyError:eo,trim:vr,tuple:Cs,uint32:cf,uint64:mf,ulid:Jm,undefined:gf,union:$e,unknown:ve,uppercase:lr,url:Rm,util:Yi,uuid:Dm,uuidv4:Am,uuidv6:Pm,uuidv7:Zm,void:pf,xid:Bm},Symbol.toStringTag,{value:"Module"})),ke=()=>K.preprocess(t=>{if(typeof t=="boolean")return t;if(typeof t=="number")return t===1;if(typeof t=="string"){const n=t.trim().toLowerCase();if(["1","true","yes","y","on"].includes(n))return!0;if(["0","false","no","n","off"].includes(n))return!1}},K.boolean().optional()),Vf=()=>K.preprocess(t=>{if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const n=Number(t);if(Number.isFinite(n))return n}},K.number()),dc=K.object({NODE_ENV:K.enum(["development","production","test"]).default("production"),AGENT_CONTAINER_MODE:ke().default(!1),AGENT_API_KEY:K.string().optional(),AGENT_ORGANIZATION_ID:K.string().optional(),AGENT_SESSION_ID:K.string().optional(),AGENT_SERVER_URL:K.string().optional(),AGENT_TYPE:K.string().optional(),AGENT_DEVICE_GUID:K.string().optional(),CONTEXT_DATA:K.string().optional(),AGI_NETLOG_ENABLE:ke().default(!0),AGI_NETLOG_DEBUG:ke().optional(),AGI_NETLOG_FILE:K.string().optional(),AGI_NETLOG_MAX_BODY:Vf().optional(),AGI_NETLOG_REMOTE_ENABLE:ke().default(!0),AGI_NETLOG_REMOTE_FILE:K.string().optional(),DEBUG:ke().default(!1),VERBOSE:ke().default(!1),LOG_LEVEL:K.string().optional(),HOSTNAME:K.string().optional(),VITE_SAVE_RAW:ke().default(!1)});function yt(t=!1){return t?"https://agiflow.io":"https://agiflow.io"}let F=dc.parse(process.env);class pe{static refresh(){F=dc.parse(process.env)}static get isContainerMode(){return!!F.AGENT_CONTAINER_MODE}static get apiKey(){return F.AGENT_API_KEY||process.env.AGENT_API_KEY}static get organizationId(){return F.AGENT_ORGANIZATION_ID||process.env.AGENT_ORGANIZATION_ID}static get sessionId(){return F.AGENT_SESSION_ID||process.env.AGENT_SESSION_ID}static get serverUrl(){return F.AGENT_SERVER_URL||process.env.AGENT_SERVER_URL||yt(this.isContainerMode)}static get isNetlogEnabled(){return!!F.AGI_NETLOG_ENABLE}static get isNetlogDebug(){return!!F.AGI_NETLOG_DEBUG}static get isNetlogRemoteEnabled(){return!!F.AGI_NETLOG_REMOTE_ENABLE}static get isDebugMode(){return F.DEBUG}static get isVerbose(){return F.VERBOSE}static get logLevel(){return F.LOG_LEVEL??(F.DEBUG?"debug":"info")}static get nodeEnv(){return F.NODE_ENV}static get homeDir(){return process.env.HOME||process.env.USERPROFILE}static get isMacOS(){return process.platform==="darwin"}static get hostname(){return F.HOSTNAME}static get netlogMaxBody(){return F.AGI_NETLOG_MAX_BODY}static get netlogFile(){return F.AGI_NETLOG_FILE}static get netlogRemoteFile(){return F.AGI_NETLOG_REMOTE_FILE}static get agentType(){return F.AGENT_TYPE||process.env.AGENT_TYPE}static get deviceGuid(){return F.AGENT_DEVICE_GUID}static get isSaveRawEnabled(){return!!F.VITE_SAVE_RAW}static get contextData(){return F.CONTEXT_DATA||process.env.CONTEXT_DATA}static serializeEnv(){const n={...process.env};for(const[r,o]of Object.entries(F))o!==void 0&&(typeof o=="string"?n[r]=o:typeof o=="number"?n[r]=String(o):typeof o=="boolean"?n[r]=o?"true":"false":n[r]=String(o));return n}static toChildProcess(){const n=this.serializeEnv();return n.AGENT_SERVER_URL||(n.AGENT_SERVER_URL=yt(this.isContainerMode)),n.LOG_LEVEL||(n.LOG_LEVEL=this.logLevel),n}static toDocker(){const n=this.serializeEnv();return n.AGENT_CONTAINER_MODE="true",n.AGENT_SERVER_URL||(n.AGENT_SERVER_URL=yt(!0)),n.LOG_LEVEL||(n.LOG_LEVEL=this.logLevel),n}static toPty(){const n=this.serializeEnv();return n.AGENT_SERVER_URL||(n.AGENT_SERVER_URL=yt(this.isContainerMode)),n.LOG_LEVEL||(n.LOG_LEVEL=this.logLevel),n}static getEnvs(){return F}}class Kf{logStream;logPath;constructor(n){this.logPath=n;const r=De.dirname(this.logPath);Ie.existsSync(r)||Ie.mkdirSync(r,{recursive:!0}),this.logStream=Ie.createWriteStream(this.logPath,{flags:"a"}),this.logStream.on("error",o=>{console.error(`[FileLogger] Error writing to log file: ${o.message}`)})}info(n,r){this.log(30,n,r)}debug(n,r){this.log(20,n,r)}warn(n,r){this.log(40,n,r)}error(n,r){this.log(50,n,r)}log(n,r,o){const e={time:new Date().toISOString(),level:n,msg:r,...o};try{this.logStream.write(JSON.stringify(e)+`
25
+ `)}catch(i){console.error(`[FileLogger] Failed to write log entry: ${i}`)}}close(){this.logStream&&!this.logStream.destroyed&&this.logStream.end()}getLogPath(){return this.logPath}static shouldDebug(){return pe.isDebugMode||pe.isNetlogDebug}}const yi=Hr(()=>$e([Cr(),j(),ce(),Me(),de(yi),Ge(j(),yi)])),wi=A({toolCallId:j(),toolName:j(),args:le()}),Wf=A({toolCallId:j(),toolName:j(),args:le(),result:le()}),qf=$e([wi.extend({state:X("partial-call"),step:ce().optional()}),wi.extend({state:X("call"),step:ce().optional()}),Wf.extend({state:X("result"),step:ce().optional()})]),Xf=A({type:j(),content:j()}),Hf=A({type:X("text"),text:j()}),Yf=A({type:X("reasoning"),reasoning:j(),details:de($e([A({type:X("text"),text:j(),signature:j().optional()}),A({type:X("redacted"),data:j()})])).optional()}),Qf=A({name:X("select"),props:A({options:de(A({label:j(),value:$e([j(),ce()]),selected:Me().optional()}))})}),eg=A({name:X("placeholder"),props:A({})}),tg=$e([Qf,eg]),mc=A({completed:Me(),component:tg}),ng=A({type:X("tool-invocation"),toolInvocation:qf,input:mc.optional(),jsx:j().describe("UI rendering").optional()}),rg=A({type:X("source"),source:Xf}),ig=A({type:X("file"),mimeType:j(),data:j()}),og=A({type:X("error"),text:j(),error:le().optional()}),ag=A({type:X("step-start")}),fc=$e([Hf,Yf,ng,rg,ig,og,ag]),Yr=Je(["input","output","error","system"]),gc=A({messageType:Yr,parts:de(fc),metadata:Ge(j(),ve()).optional(),raw:le().optional()});A({id:j(),sessionId:j(),agentTypeId:j(),messageType:Yr,contentSize:ce().nullable(),timestamp:kt(),metadata:j().nullable(),parts:j().nullable().optional(),raw:le().nullable().optional(),createdAt:kt(),updatedAt:kt()});const ug=A({messageType:Je(["output"]).default("output"),metadata:Ge(j(),ve()).optional()});A({id:j(),messageId:j()});const sg=A({parts:de(fc).optional(),metadata:Ge(j(),ve()).optional(),raw:le().optional(),toolName:j().optional(),toolResult:le().optional()});A({messages:de(gc)});const cg=A({toolName:j(),toolArgs:le(),input:mc});A({messageId:j(),success:Me()});function lg(t){return[dg(t)]}function ki(t){let n=t.parts;if(!n&&t.content&&(n=lg(t.content)),!n)throw new Error("Either content or parts is required for message creation");return{messageType:t.messageType,parts:n,metadata:t.metadata,raw:t.raw}}function dg(t){return{type:"text",text:t}}const en=10,Ii=(t=0)=>n=>`\x1B[${n+t}m`,Si=(t=0)=>n=>`\x1B[${38+t};5;${n}m`,zi=(t=0)=>(n,r,o)=>`\x1B[${38+t};2;${n};${r};${o}m`,L={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(L.modifier);const mg=Object.keys(L.color),fg=Object.keys(L.bgColor);[...mg,...fg];function gg(){const t=new Map;for(const[n,r]of Object.entries(L)){for(const[o,e]of Object.entries(r))L[o]={open:`\x1B[${e[0]}m`,close:`\x1B[${e[1]}m`},r[o]=L[o],t.set(e[0],e[1]);Object.defineProperty(L,n,{value:r,enumerable:!1})}return Object.defineProperty(L,"codes",{value:t,enumerable:!1}),L.color.close="\x1B[39m",L.bgColor.close="\x1B[49m",L.color.ansi=Ii(),L.color.ansi256=Si(),L.color.ansi16m=zi(),L.bgColor.ansi=Ii(en),L.bgColor.ansi256=Si(en),L.bgColor.ansi16m=zi(en),Object.defineProperties(L,{rgbToAnsi256:{value(n,r,o){return n===r&&r===o?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(r/255*5)+Math.round(o/255*5)},enumerable:!1},hexToRgb:{value(n){const r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(n.toString(16));if(!r)return[0,0,0];let[o]=r;o.length===3&&(o=[...o].map(i=>i+i).join(""));const e=Number.parseInt(o,16);return[e>>16&255,e>>8&255,e&255]},enumerable:!1},hexToAnsi256:{value:n=>L.rgbToAnsi256(...L.hexToRgb(n)),enumerable:!1},ansi256ToAnsi:{value(n){if(n<8)return 30+n;if(n<16)return 90+(n-8);let r,o,e;if(n>=232)r=((n-232)*10+8)/255,o=r,e=r;else{n-=16;const u=n%36;r=Math.floor(n/36)/5,o=Math.floor(u/6)/5,e=u%6/5}const i=Math.max(r,o,e)*2;if(i===0)return 30;let a=30+(Math.round(e)<<2|Math.round(o)<<1|Math.round(r));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(n,r,o)=>L.ansi256ToAnsi(L.rgbToAnsi256(n,r,o)),enumerable:!1},hexToAnsi:{value:n=>L.ansi256ToAnsi(L.hexToAnsi256(n)),enumerable:!1}}),L}const se=gg(),Oi=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const t=navigator.userAgentData.brands.find(({brand:n})=>n==="Chromium");if(t&&t.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),ji=Oi!==0&&{level:Oi},pg={stdout:ji,stderr:ji};function vg(t,n,r){let o=t.indexOf(n);if(o===-1)return t;const e=n.length;let i=0,a="";do a+=t.slice(i,o)+n+r,i=o+e,o=t.indexOf(n,i);while(o!==-1);return a+=t.slice(i),a}function hg(t,n,r,o){let e=0,i="";do{const a=t[o-1]==="\r";i+=t.slice(e,a?o-1:o)+n+(a?`\r
3
26
  `:`
4
- `)+t,n=s+1,s=r.indexOf(`
5
- `,n)}while(s!==-1);return a+=r.slice(n),a}const{stdout:rs,stderr:ns}=Hr,jt=Symbol("GENERATOR"),je=Symbol("STYLER"),Ye=Symbol("IS_EMPTY"),as=["ansi","ansi","ansi256","ansi16m"],$e=Object.create(null),Yr=(r,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const t=rs?rs.level:0;r.level=e.level===void 0?t:e.level},Xr=r=>{const e=(...t)=>t.join(" ");return Yr(e,r),Object.setPrototypeOf(e,tt.prototype),e};function tt(r){return Xr(r)}Object.setPrototypeOf(tt.prototype,Function.prototype);for(const[r,e]of Object.entries(Q))$e[r]={get(){const t=yt(this,Mt(e.open,e.close,this[je]),this[Ye]);return Object.defineProperty(this,r,{value:t}),t}};$e.visible={get(){const r=yt(this,this[je],!0);return Object.defineProperty(this,"visible",{value:r}),r}};const $t=(r,e,t,...s)=>r==="rgb"?e==="ansi16m"?Q[t].ansi16m(...s):e==="ansi256"?Q[t].ansi256(Q.rgbToAnsi256(...s)):Q[t].ansi(Q.rgbToAnsi(...s)):r==="hex"?$t("rgb",e,t,...Q.hexToRgb(...s)):Q[t][r](...s),Qr=["rgb","hex","ansi256"];for(const r of Qr){$e[r]={get(){const{level:t}=this;return function(...s){const n=Mt($t(r,as[t],"color",...s),Q.color.close,this[je]);return yt(this,n,this[Ye])}}};const e="bg"+r[0].toUpperCase()+r.slice(1);$e[e]={get(){const{level:t}=this;return function(...s){const n=Mt($t(r,as[t],"bgColor",...s),Q.bgColor.close,this[je]);return yt(this,n,this[Ye])}}}}const en=Object.defineProperties(()=>{},{...$e,level:{enumerable:!0,get(){return this[jt].level},set(r){this[jt].level=r}}}),Mt=(r,e,t)=>{let s,n;return t===void 0?(s=r,n=e):(s=t.openAll+r,n=e+t.closeAll),{open:r,close:e,openAll:s,closeAll:n,parent:t}},yt=(r,e,t)=>{const s=(...n)=>tn(s,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(s,en),s[jt]=r,s[je]=e,s[Ye]=t,s},tn=(r,e)=>{if(r.level<=0||!e)return r[Ye]?"":e;let t=r[je];if(t===void 0)return e;const{openAll:s,closeAll:n}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=Wr(e,t.close,t.open),t=t.parent;const a=e.indexOf(`
6
- `);return a!==-1&&(e=Kr(e,n,s,a)),s+e+n};Object.defineProperties(tt.prototype,$e);const z=tt();tt({level:ns?ns.level:0});function sn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Le={exports:{}},Ot,is;function rn(){if(is)return Ot;is=1;function r(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}Ot=e;function e(t,s,n){var a=n&&n.stringify||r,i=1;if(typeof t=="object"&&t!==null){var o=s.length+i;if(o===1)return t;var d=new Array(o);d[0]=a(t);for(var u=1;u<o;u++)d[u]=a(s[u]);return d.join(" ")}if(typeof t!="string")return t;var g=s.length;if(g===0)return t;for(var k="",j=1-i,S=-1,H=t&&t.length||0,I=0;I<H;){if(t.charCodeAt(I)===37&&I+1<H){switch(S=S>-1?S:0,t.charCodeAt(I+1)){case 100:case 102:if(j>=g||s[j]==null)break;S<I&&(k+=t.slice(S,I)),k+=Number(s[j]),S=I+2,I++;break;case 105:if(j>=g||s[j]==null)break;S<I&&(k+=t.slice(S,I)),k+=Math.floor(Number(s[j])),S=I+2,I++;break;case 79:case 111:case 106:if(j>=g||s[j]===void 0)break;S<I&&(k+=t.slice(S,I));var st=typeof s[j];if(st==="string"){k+="'"+s[j]+"'",S=I+2,I++;break}if(st==="function"){k+=s[j].name||"<anonymous>",S=I+2,I++;break}k+=a(s[j]),S=I+2,I++;break;case 115:if(j>=g)break;S<I&&(k+=t.slice(S,I)),k+=String(s[j]),S=I+2,I++;break;case 37:S<I&&(k+=t.slice(S,I)),k+="%",S=I+2,I++,j--;break}++j}++I}return S===-1?t:(S<H&&(k+=t.slice(S)),k)}return Ot}var os;function nn(){if(os)return Le.exports;os=1;const r=rn();Le.exports=g;const e=Es().console||{},t={mapHttpRequest:rt,mapHttpResponse:rt,wrapRequestSerializer:Tt,wrapResponseSerializer:Tt,wrapErrorSerializer:Tt,req:rt,res:rt,err:Dt,errWithCause:Dt};function s(c,p){return c==="silent"?1/0:p.levels.values[c]}const n=Symbol("pino.logFuncs"),a=Symbol("pino.hierarchy"),i={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function o(c,p){const b={logger:p,parent:c[a]};p[a]=b}function d(c,p,b){const E={};p.forEach(O=>{E[O]=b[O]?b[O]:e[O]||e[i[O]||"log"]||Ee}),c[n]=E}function u(c,p){return Array.isArray(c)?c.filter(function(E){return E!=="!stdSerializers.err"}):c===!0?Object.keys(p):!1}function g(c){c=c||{},c.browser=c.browser||{};const p=c.browser.transmit;if(p&&typeof p.send!="function")throw Error("pino: transmit option must have a send function");const b=c.browser.write||e;c.browser.write&&(c.browser.asObject=!0);const E=c.serializers||{},O=u(c.browser.serialize,E);let Z=c.browser.serialize;Array.isArray(c.browser.serialize)&&c.browser.serialize.indexOf("!stdSerializers.err")>-1&&(Z=!1);const J=Object.keys(c.customLevels||{}),M=["error","fatal","warn","info","debug","trace"].concat(J);typeof b=="function"&&M.forEach(function(W){b[W]=b}),(c.enabled===!1||c.browser.disabled)&&(c.level="silent");const U=c.level||"info",y=Object.create(b);y.log||(y.log=Ee),d(y,M,b),o({},y),Object.defineProperty(y,"levelVal",{get:nt}),Object.defineProperty(y,"level",{get:ge,set:at});const F={transmit:p,serialize:O,asObject:c.browser.asObject,formatters:c.browser.formatters,levels:M,timestamp:xs(c),messageKey:c.messageKey||"msg",onChild:c.onChild||Ee};y.levels=k(c),y.level=U,y.setMaxListeners=y.getMaxListeners=y.emit=y.addListener=y.on=y.prependListener=y.once=y.prependOnceListener=y.removeListener=y.removeAllListeners=y.listeners=y.listenerCount=y.eventNames=y.write=y.flush=Ee,y.serializers=E,y._serialize=O,y._stdErrSerialize=Z,y.child=function(...W){return Vt.call(this,F,...W)},p&&(y._logEvent=kt());function nt(){return s(this.level,this)}function ge(){return this._level}function at(W){if(W!=="silent"&&!this.levels.values[W])throw Error("unknown level "+W);this._level=W,H(this,F,y,"error"),H(this,F,y,"fatal"),H(this,F,y,"warn"),H(this,F,y,"info"),H(this,F,y,"debug"),H(this,F,y,"trace"),J.forEach(ne=>{H(this,F,y,ne)})}function Vt(W,ne,Me){if(!ne)throw new Error("missing bindings for child Pino");Me=Me||{},O&&ne.serializers&&(Me.serializers=ne.serializers);const Bt=Me.serializers;if(O&&Bt){var it=Object.assign({},E,Bt),Gt=c.browser.serialize===!0?Object.keys(it):O;delete ne.serializers,xt([ne],Gt,it,this._stdErrSerialize)}function Ut(ot){this._childLevel=(ot._childLevel|0)+1,this.bindings=ne,it&&(this.serializers=it,this._serialize=Gt),p&&(this._logEvent=kt([].concat(ot._logEvent.bindings,ne)))}Ut.prototype=this;const ze=new Ut(this);return o(this,ze),ze.child=function(...ot){return Vt.call(this,W,...ot)},ze.level=Me.level||this.level,W.onChild(ze),ze}return y}function k(c){const p=c.customLevels||{},b=Object.assign({},g.levels.values,p),E=Object.assign({},g.levels.labels,j(p));return{values:b,labels:E}}function j(c){const p={};return Object.keys(c).forEach(function(b){p[c[b]]=b}),p}g.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},g.stdSerializers=t,g.stdTimeFunctions=Object.assign({},{nullTime:Pt,epochTime:Zt,unixTime:ks,isoTime:Ts});function S(c){const p=[];c.bindings&&p.push(c.bindings);let b=c[a];for(;b.parent;)b=b.parent,b.logger.bindings&&p.push(b.logger.bindings);return p.reverse()}function H(c,p,b,E){if(Object.defineProperty(c,E,{value:s(c.level,b)>s(E,b)?Ee:b[n][E],writable:!0,enumerable:!0,configurable:!0}),c[E]===Ee){if(!p.transmit)return;const Z=p.transmit.level||c.level,J=s(Z,b);if(s(E,b)<J)return}c[E]=st(c,p,b,E);const O=S(c);O.length!==0&&(c[E]=I(O,c[E]))}function I(c,p){return function(){return p.apply(this,[...c,...arguments])}}function st(c,p,b,E){return function(O){return function(){const J=p.timestamp(),M=new Array(arguments.length),U=Object.getPrototypeOf&&Object.getPrototypeOf(this)===e?e:this;for(var y=0;y<M.length;y++)M[y]=arguments[y];var F=!1;if(p.serialize&&(xt(M,this._serialize,this.serializers,this._stdErrSerialize),F=!0),p.asObject||p.formatters?O.call(U,bs(this,E,M,J,p)):O.apply(U,M),p.transmit){const nt=p.transmit.level||c._level,ge=s(nt,b),at=s(E,b);if(at<ge)return;ws(this,{ts:J,methodLevel:E,methodValue:at,transmitValue:b.levels.values[p.transmit.level||c._level],send:p.transmit.send,val:s(c._level,b)},M,F)}}}(c[n][E])}function bs(c,p,b,E,O){const{level:Z,log:J=ge=>ge}=O.formatters||{},M=b.slice();let U=M[0];const y={};if(E&&(y.time=E),Z){const ge=Z(p,c.levels.values[p]);Object.assign(y,ge)}else y.level=c.levels.values[p];let F=(c._childLevel|0)+1;if(F<1&&(F=1),U!==null&&typeof U=="object"){for(;F--&&typeof M[0]=="object";)Object.assign(y,M.shift());U=M.length?r(M.shift(),M):void 0}else typeof U=="string"&&(U=r(M.shift(),M));return U!==void 0&&(y[O.messageKey]=U),J(y)}function xt(c,p,b,E){for(const O in c)if(E&&c[O]instanceof Error)c[O]=g.stdSerializers.err(c[O]);else if(typeof c[O]=="object"&&!Array.isArray(c[O])&&p)for(const Z in c[O])p.indexOf(Z)>-1&&Z in b&&(c[O][Z]=b[Z](c[O][Z]))}function ws(c,p,b,E=!1){const O=p.send,Z=p.ts,J=p.methodLevel,M=p.methodValue,U=p.val,y=c._logEvent.bindings;E||xt(b,c._serialize||Object.keys(c.serializers),c.serializers,c._stdErrSerialize===void 0?!0:c._stdErrSerialize),c._logEvent.ts=Z,c._logEvent.messages=b.filter(function(F){return y.indexOf(F)===-1}),c._logEvent.level.label=J,c._logEvent.level.value=M,O(J,c._logEvent,U),c._logEvent=kt(y)}function kt(c){return{ts:0,messages:[],bindings:c||[],level:{label:"",value:0}}}function Dt(c){const p={type:c.constructor.name,msg:c.message,stack:c.stack};for(const b in c)p[b]===void 0&&(p[b]=c[b]);return p}function xs(c){return typeof c.timestamp=="function"?c.timestamp:c.timestamp===!1?Pt:Zt}function rt(){return{}}function Tt(c){return c}function Ee(){}function Pt(){return!1}function Zt(){return Date.now()}function ks(){return Math.round(Date.now()/1e3)}function Ts(){return new Date(Date.now()).toISOString()}function Es(){function c(p){return typeof p<"u"&&p}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return c(self)||c(window)||c(this)||{}}}return Le.exports.default=g,Le.exports.pino=g,Le.exports}var an=nn();const lt=sn(an);class D{pino;useTerminalFormat;static instance;constructor(e={}){this.useTerminalFormat=e.useTerminalFormat??!0;const t=e.debug?"debug":e.verbose?"trace":"info";e.silent?this.pino=lt({level:"silent"}):e.logFile||e.logDir?this.pino=this.createMultiTransportLogger(t,e):this.useTerminalFormat&&process.stdout.isTTY?this.pino=lt({level:t,transport:{target:"pino-pretty",options:{colorize:!0,ignore:"pid,hostname",translateTime:"HH:MM:ss",messageFormat:"{msg}"}}}):this.pino=lt({level:t})}createMultiTransportLogger(e,t){let s;if(t.logFile)s=t.logFile;else if(t.logDir){oe.existsSync(t.logDir)||oe.mkdirSync(t.logDir,{recursive:!0});const a=new Date().toISOString().split("T")[0];s=Oe.join(t.logDir,`app-${a}.log`)}else{const a=Oe.join(Os.tmpdir(),"agiflow-agents","logs",`session-${process.pid}`);oe.existsSync(a)||oe.mkdirSync(a,{recursive:!0});const i=new Date().toISOString().split("T")[0];s=Oe.join(a,`app-${i}.log`)}const n=[];return this.useTerminalFormat&&process.stdout.isTTY?n.push({level:e,target:"pino-pretty",options:{destination:1,colorize:!0,ignore:"pid,hostname",translateTime:"HH:MM:ss",messageFormat:"{msg}"}}):n.push({level:e,target:"pino/file",options:{destination:1}}),t.maxFileSize||t.maxFiles?n.push({level:e,target:"pino-roll",options:{file:s,frequency:"daily",size:t.maxFileSize||"10m",limit:{count:t.maxFiles||7},symlink:!0,mkdir:!0}}):n.push({level:e,target:"pino/file",options:{destination:s,mkdir:!0}}),lt({level:e,transport:{targets:n}})}static getInstance(){return D.instance||(D.instance=new D),D.instance}static configure(e){D.instance=new D(e)}getLogFilePath(){const e=this.pino.transports;if(e&&Array.isArray(e)){const t=e.find(s=>s.target==="pino/file"||s.target==="pino-roll");if(t&&t.options)return t.options.destination||t.options.file}}info(e,...t){this.useTerminalFormat&&process.stdout.isTTY?console.log(z.blue("ℹ"),e,...t):this.pino.info(e,...t)}static info(e,...t){D.getInstance().info(e,...t)}success(e,...t){this.useTerminalFormat&&process.stdout.isTTY?console.log(z.green("✓"),e,...t):this.pino.info({type:"success"},e,...t)}static success(e,...t){D.getInstance().success(e,...t)}warn(e,...t){this.useTerminalFormat&&process.stdout.isTTY?console.warn(z.yellow("⚠"),e,...t):this.pino.warn(e,...t)}static warn(e,...t){D.getInstance().warn(e,...t)}error(e,t,s){let n,a;t instanceof Error?(n=t,a=s):a=t,this.useTerminalFormat&&process.stdout.isTTY?console.error(z.red("✗"),e,n||""):n?this.pino.error(n,e):this.pino.error(e),a?.exit!==void 0&&process.exit(a.exit)}static error(e,t){D.getInstance().error(e,void 0,t)}debug(e,...t){this.useTerminalFormat&&process.stdout.isTTY?(ve.isDebugMode||this.pino.level==="debug"||this.pino.level==="trace")&&console.log(z.gray("🔍"),z.gray(e),...t):this.pino.debug(e,...t)}static debug(e,...t){D.getInstance().debug(e,...t)}trace(e,...t){this.useTerminalFormat&&process.stdout.isTTY?this.pino.level==="trace"&&console.log(z.gray("..."),z.gray(e),...t):this.pino.trace(e,...t)}title(e){this.useTerminalFormat&&process.stdout.isTTY?(console.log(),console.log(z.bold.cyan(e)),console.log(z.cyan("=".repeat(e.length)))):this.pino.info({type:"title"},e)}static title(e){D.getInstance().title(e)}code(e){this.useTerminalFormat&&process.stdout.isTTY?(console.log(),console.log(z.gray(" "+e)),console.log()):this.pino.info({type:"code",code:e},"Code example")}static code(e){D.getInstance().code(e)}newLine(){this.useTerminalFormat&&process.stdout.isTTY&&console.log()}static newLine(){D.getInstance().newLine()}terminal(e,t,...s){if(!process.stdout.isTTY){this.pino[e==="success"||e==="title"||e==="code"?"info":e](t,...s);return}switch(e){case"info":console.log(z.blue("ℹ"),t,...s);break;case"success":console.log(z.green("✓"),t,...s);break;case"warn":console.warn(z.yellow("⚠"),t,...s);break;case"error":console.error(z.red("✗"),t,...s);break;case"debug":console.log(z.gray("🔍"),z.gray(t),...s);break;case"title":console.log(),console.log(z.bold.cyan(t)),console.log(z.cyan("=".repeat(t.length)));break;case"code":console.log(),console.log(z.gray(" "+t)),console.log();break}}getPino(){return this.pino}child(e){const t=new D({useTerminalFormat:this.useTerminalFormat});return t.pino=this.pino.child(e),t}}class L{static AGIFLOW_DIR=ue.join(Et.homedir(),".agiflow");static async ensureDir(e){await le.ensureDir(e)}static async exists(e){try{return await le.access(e),!0}catch{return!1}}static async readJson(e){const t=await le.readFile(e,"utf-8");return JSON.parse(t)}static async writeJson(e,t,s){await le.ensureDir(ue.dirname(e));const n=JSON.stringify(t,null,s?.spaces??2);await le.writeFile(e,n,"utf-8")}static async copy(e,t){await le.copy(e,t)}static async remove(e){await le.remove(e)}static getCurrentDirectory(){return process.cwd()}static resolvePath(...e){return ue.resolve(process.cwd(),...e)}static async getFiles(e,t){const s=await le.readdir(e);return t?s.filter(n=>t.test(n)):s}static getAbsolutePath(e){return e?e.startsWith("~/")?ue.join(Et.homedir(),e.slice(2)):e==="~"?Et.homedir():ue.isAbsolute(e)?e:ue.resolve(process.cwd(),e):process.cwd()}}class fn{static SESSIONS_FILE=ue.join(L.AGIFLOW_DIR,"sessions.json");static async getSessionSettings(e){try{return await L.exists(this.SESSIONS_FILE)&&(await L.readJson(this.SESSIONS_FILE))[e]||null}catch(t){return console.error("[SessionSettings] Failed to read session settings:",t),null}}static async setSessionSettings(e,t){try{let s={};await L.exists(this.SESSIONS_FILE)&&(s=await L.readJson(this.SESSIONS_FILE)),s[e]=t,await L.writeJson(this.SESSIONS_FILE,s,{spaces:2})}catch(s){throw console.error("[SessionSettings] Failed to write session settings:",s),s}}static async removeSessionSettings(e){try{if(!await L.exists(this.SESSIONS_FILE))return;const s=await L.readJson(this.SESSIONS_FILE);delete s[e],await L.writeJson(this.SESSIONS_FILE,s,{spaces:2})}catch(t){throw console.error("[SessionSettings] Failed to remove session settings:",t),t}}static async getAllSessions(){try{return await L.exists(this.SESSIONS_FILE)?await L.readJson(this.SESSIONS_FILE):{}}catch(e){return console.error("[SessionSettings] Failed to read all session settings:",e),{}}}static async clearAllSessions(){try{await L.writeJson(this.SESSIONS_FILE,{},{spaces:2})}catch(e){throw console.error("[SessionSettings] Failed to clear session settings:",e),e}}}class on{filePath;cache=null;dirty=!1;constructor(e){this.filePath=e||ue.join(L.AGIFLOW_DIR,"credentials.json")}async load(){if(this.cache)return this.cache;try{if(!await L.exists(this.filePath))return null;const t=await L.readJson(this.filePath);return this.cache=t,t}catch{return null}}async flush(){!this.dirty||!this.cache||(await L.ensureDir(L.AGIFLOW_DIR),await L.writeJson(this.filePath,this.cache),this.dirty=!1)}async setApiKey(e){this.cache={apiKey:e.apiKey,organizationId:e.organizationId,deviceId:e.deviceId||this.cache?.deviceId,expiresAt:e.expiresAt},this.dirty=!0,await this.flush()}async setDeviceId(e){const t=await this.load()||{apiKey:"",organizationId:""};t.deviceId=e,this.cache=t,this.dirty=!0,await this.flush()}async getApiKey(){return(await this.load())?.apiKey||null}async getAgentCreds(){const e=await this.load();if(!e)throw new Error("Cred not set");return{apiKey:e.apiKey,organizationId:e.organizationId,deviceId:e.deviceId}}async getOrganizationId(){return(await this.load())?.organizationId||null}async getDeviceId(){return(await this.load())?.deviceId||null}async isExpired(e=300*1e3){const t=await this.load();return t?.expiresAt?Date.now()>=t.expiresAt-e:!1}async clear(){this.cache=null,this.dirty=!1;try{await L.exists(this.filePath)&&await L.remove(this.filePath)}catch{}}async buildAuthHeaders(){const e=await this.load();return e?.apiKey?{"x-api-key":e.apiKey}:{}}async buildDeviceAuthHeaders(e){const t=await this.load();if(!t?.apiKey)return{};const s={"x-api-key":t.apiKey};return e&&(s["x-device-guid"]=e),t.deviceId&&(s["x-device-id"]=t.deviceId),t.organizationId&&(s["x-organization-id"]=t.organizationId),s}async buildAgentAuthHeaders(e){let t=e;if(t||(t=await this.getApiKey()||void 0),t||(t=ve.apiKey),!t)return{};const s={"x-api-key":t,"Content-Type":"application/json"},n=await this.getOrganizationId();n&&(s["x-organization-id"]=n);const a=await this.getDeviceId();return a&&(s["x-device-id"]=a),s}}N({limit:te().min(1).max(100).optional(),offset:te().min(0).optional(),messageType:Ft.optional(),sort:A().optional(),order:wt(["asc","desc"]).optional()});class cn{options;authService;credentials;logger;constructor(e){this.options=e,this.authService=e.authService,this.credentials=e.credentials??new on,this.logger=e.logger??new D({verbose:!1})}async getAuthHeaders(){let e=await this.credentials.getApiKey(),t=await this.credentials.getOrganizationId();if((!e||!t)&&this.authService){const n=await this.authService.getValidApiKey();e=n.api_key,t=n.organization_id,await this.credentials.setApiKey({apiKey:e,organizationId:t,expiresAt:n.expires_at})}if(!e&&this.options.apiKey&&(e=this.options.apiKey),!t&&this.options.organizationId&&(t=this.options.organizationId),e&&t)return this.options.organizationId=t,{"Content-Type":"application/json","x-api-key":e};const s=this.options.authToken;if(!s)throw new Error("Authentication token is required for agent message operations");if(!this.options.organizationId)throw new Error("Organization ID is required for agent message operations");return{"Content-Type":"application/json",Authorization:`Bearer ${s}`}}async makeAuthenticatedRequest(e,t,s=!0){const n=await fetch(e,t);if(n.status===401&&s&&this.authService){const a=await n.text();if(a.includes("Invalid API key")){this.logger.info("= API key expired or invalid, clearing tokens and retrying authentication..."),await this.authService.clearTokens();try{await this.credentials.clear()}catch{}this.logger.info("= Retrying authentication...");const i=await this.getAuthHeaders(),o={...t,headers:{...t.headers,...i}};return await this.makeAuthenticatedRequest(e,o,!1)}if(a.includes("Invalid or expired session")){const i=ve.isContainerMode;if(this.logger.error("🚫 Session validation failed:",new Error(`Session validation failed for ${e}. Docker mode: ${i}, Method: ${t.method||"GET"}, Timestamp: ${new Date().toISOString()}`)),i)return this.logger.warn("🐳 Docker session timing issue detected, waiting and retrying..."),await new Promise(o=>setTimeout(o,2e3)),await this.makeAuthenticatedRequest(e,t,!1)}}return n.status===429&&this.logger.warn("= Rate limit exceeded, keeping credentials but not retrying"),n}async sendMessage(e){const t=await this.getAuthHeaders(),s=this.options.organizationId;if(!s)throw new Error("Organization ID is required for sending agent messages");const n=Yt(e);try{_s.parse(n)}catch(a){throw new Error(`Invalid message payload: ${a instanceof Error?a.message:a}`)}try{const a=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${s}/agent-sessions/${e.sessionId}/messages`,{method:"POST",headers:t,body:JSON.stringify(n)});if(!a.ok){const o=await a.text();throw new Error(`Failed to send agent message: ${a.status} ${o}`)}return await a.json()}catch(a){throw new Error(`Failed to send agent message: ${a instanceof Error?a.message:a}`)}}async sendMessageBatch(e,t){const s=await this.getAuthHeaders(),n=this.options.organizationId;if(!n)throw new Error("Organization ID is required for sending agent messages");const a=(t||[]).map(i=>Yt(i));try{const i=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${n}/agent-sessions/${e}/messages/batch`,{method:"POST",headers:s,body:JSON.stringify({messages:a})});if(!i.ok){const d=await i.text();throw new Error(`Failed to send agent message batch: ${i.status} ${d}`)}return await i.json()}catch(i){throw new Error(`Failed to send agent message batch: ${i instanceof Error?i.message:i}`)}}async getSessionMessages(e,t){const s=await this.getAuthHeaders(),n=this.options.organizationId;if(!n)throw new Error("Organization ID is required for fetching agent messages");const a=new URLSearchParams;t?.limit&&a.append("limit",t.limit.toString()),t?.offset&&a.append("offset",t.offset.toString()),t?.messageType&&a.append("messageType",t.messageType),t?.sort&&a.append("sort",t.sort),t?.order&&a.append("order",t.order);const i=`${this.options.apiUrl}/api/v1/organizations/${n}/agent-sessions/${e}/messages?${a.toString()}`;try{const o=await this.makeAuthenticatedRequest(i,{method:"GET",headers:s});if(!o.ok){const u=await o.text();throw new Error(`Failed to fetch session messages: ${o.status} ${u}`)}return await o.json()}catch(o){throw new Error(`Failed to fetch session messages: ${o instanceof Error?o.message:o}`)}}async uploadMessageContent(e,t,s,n){const a=await this.getAuthHeaders(),i=this.options.organizationId;if(!i)throw new Error("Organization ID is required for uploading message content");const o=typeof s=="string"?Buffer.from(s,"utf-8"):s,d=o.length;try{const u=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${i}/agent-sessions/${e}/messages/presign`,{method:"POST",headers:a,body:JSON.stringify({messageType:t,contentSize:d})});if(!u.ok){const S=await u.text();throw new Error(`Failed to get presigned URL: ${u.status} ${S}`)}const{uploadUrl:g}=await u.json(),k=await fetch(g,{method:"PUT",body:o,headers:{"Content-Type":"application/octet-stream","Content-Length":d.toString()}});if(!k.ok)throw new Error(`Failed to upload content to R2: ${k.status}`);const j={sessionId:e,messageType:t,contentSize:d,metadata:n};return await this.sendMessage(j)}catch(u){throw new Error(`Failed to upload message content: ${u instanceof Error?u.message:u}`)}}async startMessage(e,t){const s=await this.getAuthHeaders(),n=this.options.organizationId;if(!n)throw new Error("Organization ID is required for starting agent messages");try{Zr.parse(t)}catch(a){throw new Error(`Invalid start message payload: ${a instanceof Error?a.message:a}`)}try{const a=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${n}/agent-sessions/${e}/messages/start`,{method:"POST",headers:s,body:JSON.stringify(t)});if(!a.ok){const o=await a.text();throw new Error(`Failed to start agent message: ${a.status} ${o}`)}return await a.json()}catch(a){throw new Error(`Failed to start agent message: ${a instanceof Error?a.message:a}`)}}async updateMessage(e,t,s){const n=await this.getAuthHeaders(),a=this.options.organizationId;if(!a)throw new Error("Organization ID is required for updating agent messages");try{Vr.parse(s)}catch(o){throw this.logger.error("=❌ Update message validation failed",new Error(`Update message validation failed: ${o instanceof Error?o.message:o}`)),new Error(`Invalid update message payload: ${o instanceof Error?o.message:o}`)}const i=JSON.stringify(s);try{const o=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${a}/agent-sessions/${e}/messages/${t}`,{method:"PATCH",headers:n,body:i});if(!o.ok){const u=await o.text();throw new Error(`Failed to update agent message: ${o.status} ${u}`)}return await o.json()}catch(o){throw new Error(`Failed to update agent message: ${o instanceof Error?o.message:o}`)}}async deleteSessionMessages(e){const t=await this.getAuthHeaders(),s=this.options.organizationId;if(!s)throw new Error("Organization ID is required for deleting session messages");this.logger.info(`=� Deleting all messages for session ${e}...`);try{const n=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${s}/agent-sessions/${e}/messages`,{method:"DELETE",headers:t},!1);if(!n.ok){const i=await n.text().catch(()=>"Unknown error");return this.logger.warn(`� Failed to delete session messages: ${n.status} ${i}`),0}const{deletedCount:a}=await n.json();return this.logger.success(` Deleted ${a} messages for session ${e}`),a}catch(n){return this.logger.warn("� Failed to delete session messages:",n),0}}async getAgentSession(e){const t=await this.getAuthHeaders(),s=this.options.organizationId;if(!s)throw new Error("Organization ID is required for fetching agent session");try{const n=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${s}/agent-sessions/${e}`,{method:"GET",headers:t});if(!n.ok){const i=await n.text();throw new Error(`Failed to fetch agent session: ${n.status} ${i}`)}return await n.json()}catch(n){throw new Error(`Failed to fetch agent session: ${n instanceof Error?n.message:n}`)}}async createTaskComment(e,t,s,n){try{const a=await this.getAuthHeaders(),i=this.options.organizationId;if(!i)return this.logger.warn("Organization ID is required for creating task comment"),null;const o=t&&t.length>1e4?t.substring(0,1e4):t,d=await this.getAgentSession(e);if(!d)return this.logger.warn("Agent session not found for task comment creation"),null;if(!d.taskId)return this.logger.debug("Agent session has no associated task - skipping comment creation"),null;const u=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${i}/tasks/${d.taskId}/comments`,{method:"POST",headers:a,body:JSON.stringify({content:o,assigneeId:s,info:n})});if(!u.ok){const k=await u.text();return this.logger.warn(`Failed to create task comment: ${u.status} ${k}`),null}const g=await u.json();return this.logger.debug("Task comment created successfully"),g}catch(a){return this.logger.warn(`Failed to create task comment: ${a instanceof Error?a.message:a}`),null}}async updateTaskDevInfo(e,t){try{const s=await this.getAuthHeaders(),n=this.options.organizationId;if(!n)return this.logger.warn("Organization ID is required for updating task devInfo"),null;const a=await this.getAgentSession(e);if(!a)return this.logger.warn("Agent session not found for task devInfo update"),null;if(!a.taskId)return this.logger.debug("Agent session has no associated task - skipping devInfo update"),null;const i=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${n}/tasks/${a.taskId}`,{method:"PATCH",headers:s,body:JSON.stringify({devInfo:t})});if(!i.ok){const d=await i.text();return this.logger.warn(`Failed to update task devInfo: ${i.status} ${d}`),null}const o=await i.json();return this.logger.debug("Task devInfo updated successfully"),o}catch(s){return this.logger.warn(`Failed to update task devInfo: ${s instanceof Error?s.message:s}`),null}}}const vt=Oe.join(cs.tmpdir(),"claude-posttooluse-logs"),ln=Oe.join(vt,"posttooluse.jsonl");oe.existsSync(vt)||oe.mkdirSync(vt,{recursive:!0});class un{agentHttpService=null;sessionId;currentMessageId=null;enableRemote=!1;constructor(){this.sessionId=ve.sessionId||"",this.currentMessageId=null,this.setupRemoteService()}setupRemoteService(){let e=ve.serverUrl||"";e.startsWith("wss://")?e="https://"+e.slice(6):e.startsWith("ws://")&&(e="http://"+e.slice(5));const t=ve.apiKey||"",s=ve.organizationId||"";if(this.enableRemote=!!(this.sessionId&&e&&t&&s),this.enableRemote&&e)try{this.agentHttpService=new cn({apiUrl:e,organizationId:s,apiKey:t})}catch(n){this.enableRemote=!1,this.logToFile({type:"error",message:"Failed to initialize remote service",error:n instanceof Error?n.message:String(n)})}}logToFile(e){const t={timestamp:new Date().toISOString(),sessionId:this.sessionId,...e};oe.appendFileSync(ln,JSON.stringify(t)+`
7
- `)}findMessageIdFromTranscript(e){try{const s=oe.readFileSync(e,"utf-8").trim().split(`
8
- `);let n=null;for(let a=s.length-1;a>=0;a--)try{const i=JSON.parse(s[a]);if(i.type==="assistant"&&i.message?.id){n=i.message.id;break}}catch{}return n}catch{return null}}async processToolExecution(e){try{try{this.logToFile({type:"tool-execution",tool_name:e.tool_name,tool_input:e.tool_input,tool_response:e.tool_response,cwd:e.cwd})}catch{}if(e.transcript_path&&(this.currentMessageId=this.findMessageIdFromTranscript(e.transcript_path),this.currentMessageId))try{this.logToFile({type:"message-id-found",messageId:this.currentMessageId,source:"transcript"})}catch{}if(this.enableRemote&&this.agentHttpService&&this.currentMessageId)try{const t={parts:[{type:"tool-invocation",toolInvocation:{toolCallId:`tool_${e.tool_name}_${Date.now()}`,toolName:e.tool_name,state:"result",args:e.tool_input,result:e.tool_response}}],metadata:{tool_name:e.tool_name,tool_input:e.tool_input,has_error:this.hasError(e.tool_response),response_size:JSON.stringify(e.tool_response).length,execution_time:new Date().toISOString(),cwd:e.cwd}};await this.agentHttpService.updateMessage(this.sessionId,this.currentMessageId,t);try{this.logToFile({type:"message-updated",messageId:this.currentMessageId,tool_name:e.tool_name})}catch{}}catch(t){try{this.logToFile({type:"remote-update-error",error:t instanceof Error?t.message:String(t),tool_name:e.tool_name,messageId:this.currentMessageId})}catch{}}if(this.hasError(e.tool_response))try{this.logToFile({type:"tool-error",tool_name:e.tool_name,error:this.extractErrorMessage(e.tool_response)})}catch{}}catch{}return{decision:"approve"}}hasError(e){if(e.error||e.errorMessage||e.success===!1)return!0;const t=typeof e=="string"?e:JSON.stringify(e);return!!(t.includes("Error:")||t.includes("Failed")||t.includes("Exception"))}extractErrorMessage(e){return e.error?String(e.error):e.errorMessage?String(e.errorMessage):e.message?String(e.message):typeof e=="string"?e:"Unknown error occurred"}}async function dn(){try{let r;try{const n=[];for await(const i of process.stdin)n.push(i);const a=Buffer.concat(n).toString();r=JSON.parse(a);try{oe.appendFileSync(Oe.join(vt,"raw-input.jsonl"),JSON.stringify({timestamp:new Date().toISOString(),raw:a})+`
9
- `)}catch{}}catch{console.log(JSON.stringify({decision:"approve"})),process.exit(0);return}const t=await new un().processToolExecution(r),s=Object.keys(t).length>0?t:{decision:"approve"};console.log(JSON.stringify(s)),process.exit(0)}catch{console.log(JSON.stringify({decision:"approve"})),process.exit(0)}}dn().catch(r=>{console.log(JSON.stringify({decision:"approve"})),console.error("Main execution failed:",r),process.exit(0)});
27
+ `)+r,e=o+1,o=t.indexOf(`
28
+ `,e)}while(o!==-1);return i+=t.slice(e),i}const{stdout:xi,stderr:Ni}=pg,ln=Symbol("GENERATOR"),Fe=Symbol("STYLER"),et=Symbol("IS_EMPTY"),Ei=["ansi","ansi","ansi256","ansi16m"],Le=Object.create(null),$g=(t,n={})=>{if(n.level&&!(Number.isInteger(n.level)&&n.level>=0&&n.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=xi?xi.level:0;t.level=n.level===void 0?r:n.level},bg=t=>{const n=(...r)=>r.join(" ");return $g(n,t),Object.setPrototypeOf(n,mt.prototype),n};function mt(t){return bg(t)}Object.setPrototypeOf(mt.prototype,Function.prototype);for(const[t,n]of Object.entries(se))Le[t]={get(){const r=Tt(this,mn(n.open,n.close,this[Fe]),this[et]);return Object.defineProperty(this,t,{value:r}),r}};Le.visible={get(){const t=Tt(this,this[Fe],!0);return Object.defineProperty(this,"visible",{value:t}),t}};const dn=(t,n,r,...o)=>t==="rgb"?n==="ansi16m"?se[r].ansi16m(...o):n==="ansi256"?se[r].ansi256(se.rgbToAnsi256(...o)):se[r].ansi(se.rgbToAnsi(...o)):t==="hex"?dn("rgb",n,r,...se.hexToRgb(...o)):se[r][t](...o),_g=["rgb","hex","ansi256"];for(const t of _g){Le[t]={get(){const{level:r}=this;return function(...o){const e=mn(dn(t,Ei[r],"color",...o),se.color.close,this[Fe]);return Tt(this,e,this[et])}}};const n="bg"+t[0].toUpperCase()+t.slice(1);Le[n]={get(){const{level:r}=this;return function(...o){const e=mn(dn(t,Ei[r],"bgColor",...o),se.bgColor.close,this[Fe]);return Tt(this,e,this[et])}}}}const yg=Object.defineProperties(()=>{},{...Le,level:{enumerable:!0,get(){return this[ln].level},set(t){this[ln].level=t}}}),mn=(t,n,r)=>{let o,e;return r===void 0?(o=t,e=n):(o=r.openAll+t,e=n+r.closeAll),{open:t,close:n,openAll:o,closeAll:e,parent:r}},Tt=(t,n,r)=>{const o=(...e)=>wg(o,e.length===1?""+e[0]:e.join(" "));return Object.setPrototypeOf(o,yg),o[ln]=t,o[Fe]=n,o[et]=r,o},wg=(t,n)=>{if(t.level<=0||!n)return t[et]?"":n;let r=t[Fe];if(r===void 0)return n;const{openAll:o,closeAll:e}=r;if(n.includes("\x1B"))for(;r!==void 0;)n=vg(n,r.close,r.open),r=r.parent;const i=n.indexOf(`
29
+ `);return i!==-1&&(n=hg(n,e,o,i)),o+n+e};Object.defineProperties(mt.prototype,Le);const M=mt();mt({level:Ni?Ni.level:0});function kg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var We={exports:{}},tn,Ui;function Ig(){if(Ui)return tn;Ui=1;function t(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}tn=n;function n(r,o,e){var i=e&&e.stringify||t,a=1;if(typeof r=="object"&&r!==null){var u=o.length+a;if(u===1)return r;var s=new Array(u);s[0]=i(r);for(var l=1;l<u;l++)s[l]=i(o[l]);return s.join(" ")}if(typeof r!="string")return r;var m=o.length;if(m===0)return r;for(var f="",b=1-a,v=-1,d=r&&r.length||0,h=0;h<d;){if(r.charCodeAt(h)===37&&h+1<d){switch(v=v>-1?v:0,r.charCodeAt(h+1)){case 100:case 102:if(b>=m||o[b]==null)break;v<h&&(f+=r.slice(v,h)),f+=Number(o[b]),v=h+2,h++;break;case 105:if(b>=m||o[b]==null)break;v<h&&(f+=r.slice(v,h)),f+=Math.floor(Number(o[b])),v=h+2,h++;break;case 79:case 111:case 106:if(b>=m||o[b]===void 0)break;v<h&&(f+=r.slice(v,h));var y=typeof o[b];if(y==="string"){f+="'"+o[b]+"'",v=h+2,h++;break}if(y==="function"){f+=o[b].name||"<anonymous>",v=h+2,h++;break}f+=i(o[b]),v=h+2,h++;break;case 115:if(b>=m)break;v<h&&(f+=r.slice(v,h)),f+=String(o[b]),v=h+2,h++;break;case 37:v<h&&(f+=r.slice(v,h)),f+="%",v=h+2,h++,b--;break}++b}++h}return v===-1?r:(v<d&&(f+=r.slice(v)),f)}return tn}var Ti;function Sg(){if(Ti)return We.exports;Ti=1;const t=Ig();We.exports=m;const n=hc().console||{},r={mapHttpRequest:ft,mapHttpResponse:ft,wrapRequestSerializer:Ht,wrapResponseSerializer:Ht,wrapErrorSerializer:Ht,req:ft,res:ft,err:re,errWithCause:re};function o(g,_){return g==="silent"?1/0:_.levels.values[g]}const e=Symbol("pino.logFuncs"),i=Symbol("pino.hierarchy"),a={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function u(g,_){const I={logger:_,parent:g[i]};_[i]=I}function s(g,_,I){const N={};_.forEach(E=>{N[E]=I[E]?I[E]:n[E]||n[a[E]||"log"]||Te}),g[e]=N}function l(g,_){return Array.isArray(g)?g.filter(function(N){return N!=="!stdSerializers.err"}):g===!0?Object.keys(_):!1}function m(g){g=g||{},g.browser=g.browser||{};const _=g.browser.transmit;if(_&&typeof _.send!="function")throw Error("pino: transmit option must have a send function");const I=g.browser.write||n;g.browser.write&&(g.browser.asObject=!0);const N=g.serializers||{},E=l(g.browser.serialize,N);let W=g.browser.serialize;Array.isArray(g.browser.serialize)&&g.browser.serialize.indexOf("!stdSerializers.err")>-1&&(W=!1);const Q=Object.keys(g.customLevels||{}),Z=["error","fatal","warn","info","debug","trace"].concat(Q);typeof I=="function"&&Z.forEach(function(Y){I[Y]=I}),(g.enabled===!1||g.browser.disabled)&&(g.level="silent");const q=g.level||"info",w=Object.create(I);w.log||(w.log=Te),s(w,Z,I),u({},w),Object.defineProperty(w,"levelVal",{get:me}),Object.defineProperty(w,"level",{get:Yt,set:gt});const B={transmit:_,serialize:E,asObject:g.browser.asObject,asObjectBindingsOnly:g.browser.asObjectBindingsOnly,formatters:g.browser.formatters,levels:Z,timestamp:Xt(g),messageKey:g.messageKey||"msg",onChild:g.onChild||Te};w.levels=f(g),w.level=q,w.isLevelEnabled=function(Y){return this.levels.values[Y]?this.levels.values[Y]>=this.levels.values[this.level]:!1},w.setMaxListeners=w.getMaxListeners=w.emit=w.addListener=w.on=w.prependListener=w.once=w.prependOnceListener=w.removeListener=w.removeAllListeners=w.listeners=w.listenerCount=w.eventNames=w.write=w.flush=Te,w.serializers=N,w._serialize=E,w._stdErrSerialize=W,w.child=function(...Y){return ti.call(this,B,...Y)},_&&(w._logEvent=D());function me(){return o(this.level,this)}function Yt(){return this._level}function gt(Y){if(Y!=="silent"&&!this.levels.values[Y])throw Error("unknown level "+Y);this._level=Y,d(this,B,w,"error"),d(this,B,w,"fatal"),d(this,B,w,"warn"),d(this,B,w,"info"),d(this,B,w,"debug"),d(this,B,w,"trace"),Q.forEach(fe=>{d(this,B,w,fe)})}function ti(Y,fe,Be){if(!fe)throw new Error("missing bindings for child Pino");Be=Be||{},E&&fe.serializers&&(Be.serializers=fe.serializers);const ni=Be.serializers;if(E&&ni){var pt=Object.assign({},N,ni),ri=g.browser.serialize===!0?Object.keys(pt):E;delete fe.serializers,x([fe],ri,pt,this._stdErrSerialize)}function ii(vt){this._childLevel=(vt._childLevel|0)+1,this.bindings=fe,pt&&(this.serializers=pt,this._serialize=ri),_&&(this._logEvent=D([].concat(vt._logEvent.bindings,fe)))}ii.prototype=this;const Ve=new ii(this);return u(this,Ve),Ve.child=function(...vt){return ti.call(this,Y,...vt)},Ve.level=Be.level||this.level,Y.onChild(Ve),Ve}return w}function f(g){const _=g.customLevels||{},I=Object.assign({},m.levels.values,_),N=Object.assign({},m.levels.labels,b(_));return{values:I,labels:N}}function b(g){const _={};return Object.keys(g).forEach(function(I){_[g[I]]=I}),_}m.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},m.stdSerializers=r,m.stdTimeFunctions=Object.assign({},{nullTime:Qr,epochTime:ei,unixTime:pc,isoTime:vc});function v(g){const _=[];g.bindings&&_.push(g.bindings);let I=g[i];for(;I.parent;)I=I.parent,I.logger.bindings&&_.push(I.logger.bindings);return _.reverse()}function d(g,_,I,N){if(Object.defineProperty(g,N,{value:o(g.level,I)>o(N,I)?Te:I[e][N],writable:!0,enumerable:!0,configurable:!0}),g[N]===Te){if(!_.transmit)return;const W=_.transmit.level||g.level,Q=o(W,I);if(o(N,I)<Q)return}g[N]=y(g,_,I,N);const E=v(g);E.length!==0&&(g[N]=h(E,g[N]))}function h(g,_){return function(){return _.apply(this,[...g,...arguments])}}function y(g,_,I,N){return function(E){return function(){const Q=_.timestamp(),Z=new Array(arguments.length),q=Object.getPrototypeOf&&Object.getPrototypeOf(this)===n?n:this;for(var w=0;w<Z.length;w++)Z[w]=arguments[w];var B=!1;if(_.serialize&&(x(Z,this._serialize,this.serializers,this._stdErrSerialize),B=!0),_.asObject||_.formatters?E.call(q,...U(this,N,Z,Q,_)):E.apply(q,Z),_.transmit){const me=_.transmit.level||g._level,Yt=o(me,I),gt=o(N,I);if(gt<Yt)return;T(this,{ts:Q,methodLevel:N,methodValue:gt,transmitValue:I.levels.values[_.transmit.level||g._level],send:_.transmit.send,val:o(g._level,I)},Z,B)}}}(g[e][N])}function U(g,_,I,N,E){const{level:W,log:Q=me=>me}=E.formatters||{},Z=I.slice();let q=Z[0];const w={};let B=(g._childLevel|0)+1;if(B<1&&(B=1),N&&(w.time=N),W){const me=W(_,g.levels.values[_]);Object.assign(w,me)}else w.level=g.levels.values[_];if(E.asObjectBindingsOnly){if(q!==null&&typeof q=="object")for(;B--&&typeof Z[0]=="object";)Object.assign(w,Z.shift());return[Q(w),...Z]}else{if(q!==null&&typeof q=="object"){for(;B--&&typeof Z[0]=="object";)Object.assign(w,Z.shift());q=Z.length?t(Z.shift(),Z):void 0}else typeof q=="string"&&(q=t(Z.shift(),Z));return q!==void 0&&(w[E.messageKey]=q),[Q(w)]}}function x(g,_,I,N){for(const E in g)if(N&&g[E]instanceof Error)g[E]=m.stdSerializers.err(g[E]);else if(typeof g[E]=="object"&&!Array.isArray(g[E])&&_)for(const W in g[E])_.indexOf(W)>-1&&W in I&&(g[E][W]=I[W](g[E][W]))}function T(g,_,I,N=!1){const E=_.send,W=_.ts,Q=_.methodLevel,Z=_.methodValue,q=_.val,w=g._logEvent.bindings;N||x(I,g._serialize||Object.keys(g.serializers),g.serializers,g._stdErrSerialize===void 0?!0:g._stdErrSerialize),g._logEvent.ts=W,g._logEvent.messages=I.filter(function(B){return w.indexOf(B)===-1}),g._logEvent.level.label=Q,g._logEvent.level.value=Z,E(Q,g._logEvent,q),g._logEvent=D(w)}function D(g){return{ts:0,messages:[],bindings:g||[],level:{label:"",value:0}}}function re(g){const _={type:g.constructor.name,msg:g.message,stack:g.stack};for(const I in g)_[I]===void 0&&(_[I]=g[I]);return _}function Xt(g){return typeof g.timestamp=="function"?g.timestamp:g.timestamp===!1?Qr:ei}function ft(){return{}}function Ht(g){return g}function Te(){}function Qr(){return!1}function ei(){return Date.now()}function pc(){return Math.round(Date.now()/1e3)}function vc(){return new Date(Date.now()).toISOString()}function hc(){function g(_){return typeof _<"u"&&_}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return g(self)||g(window)||g(this)||{}}}return We.exports.default=m,We.exports.pino=m,We.exports}var zg=Sg();const wt=kg(zg);class V{pino;useTerminalFormat;static instance;constructor(n={}){this.useTerminalFormat=n.useTerminalFormat??!0;const r=n.debug?"debug":n.verbose?"trace":"info";n.silent?this.pino=wt({level:"silent"}):n.logFile||n.logDir?this.pino=this.createMultiTransportLogger(r,n):this.useTerminalFormat&&process.stdout.isTTY?this.pino=wt({level:r,transport:{target:"pino-pretty",options:{colorize:!0,ignore:"pid,hostname",translateTime:"HH:MM:ss",messageFormat:"{msg}"}}}):this.pino=wt({level:r})}createMultiTransportLogger(n,r){let o;if(r.logFile)o=r.logFile;else if(r.logDir){Ie.existsSync(r.logDir)||Ie.mkdirSync(r.logDir,{recursive:!0});const i=new Date().toISOString().split("T")[0];o=De.join(r.logDir,`app-${i}.log`)}else{const i=De.join(Di.tmpdir(),"agiflow-agents","logs",`session-${process.pid}`);Ie.existsSync(i)||Ie.mkdirSync(i,{recursive:!0});const a=new Date().toISOString().split("T")[0];o=De.join(i,`app-${a}.log`)}const e=[];return this.useTerminalFormat&&process.stdout.isTTY?e.push({level:n,target:"pino-pretty",options:{destination:1,colorize:!0,ignore:"pid,hostname",translateTime:"HH:MM:ss",messageFormat:"{msg}"}}):e.push({level:n,target:"pino/file",options:{destination:1}}),r.maxFileSize||r.maxFiles?e.push({level:n,target:"pino-roll",options:{file:o,frequency:"daily",size:r.maxFileSize||"10m",limit:{count:r.maxFiles||7},symlink:!0,mkdir:!0}}):e.push({level:n,target:"pino/file",options:{destination:o,mkdir:!0}}),wt({level:n,transport:{targets:e}})}static getInstance(){return V.instance||(V.instance=new V),V.instance}static configure(n){V.instance=new V(n)}getLogFilePath(){const n=this.pino.transports;if(n&&Array.isArray(n)){const r=n.find(o=>o.target==="pino/file"||o.target==="pino-roll");if(r&&r.options)return r.options.destination||r.options.file}}info(n,...r){this.useTerminalFormat&&process.stdout.isTTY?console.log(M.blue("ℹ"),n,...r):this.pino.info(n,...r)}static info(n,...r){V.getInstance().info(n,...r)}success(n,...r){this.useTerminalFormat&&process.stdout.isTTY?console.log(M.green("✓"),n,...r):this.pino.info({type:"success"},n,...r)}static success(n,...r){V.getInstance().success(n,...r)}warn(n,...r){this.useTerminalFormat&&process.stdout.isTTY?console.warn(M.yellow("⚠"),n,...r):this.pino.warn(n,...r)}static warn(n,...r){V.getInstance().warn(n,...r)}error(n,r,o){let e,i;r instanceof Error?(e=r,i=o):i=r,this.useTerminalFormat&&process.stdout.isTTY?console.error(M.red("✗"),n,e||""):e?this.pino.error(e,n):this.pino.error(n),i?.exit!==void 0&&process.exit(i.exit)}static error(n,r){V.getInstance().error(n,void 0,r)}debug(n,...r){this.useTerminalFormat&&process.stdout.isTTY?(pe.isDebugMode||this.pino.level==="debug"||this.pino.level==="trace")&&console.log(M.gray("🔍"),M.gray(n),...r):this.pino.debug(n,...r)}static debug(n,...r){V.getInstance().debug(n,...r)}trace(n,...r){this.useTerminalFormat&&process.stdout.isTTY?this.pino.level==="trace"&&console.log(M.gray("..."),M.gray(n),...r):this.pino.trace(n,...r)}title(n){this.useTerminalFormat&&process.stdout.isTTY?(console.log(),console.log(M.bold.cyan(n)),console.log(M.cyan("=".repeat(n.length)))):this.pino.info({type:"title"},n)}static title(n){V.getInstance().title(n)}code(n){this.useTerminalFormat&&process.stdout.isTTY?(console.log(),console.log(M.gray(" "+n)),console.log()):this.pino.info({type:"code",code:n},"Code example")}static code(n){V.getInstance().code(n)}newLine(){this.useTerminalFormat&&process.stdout.isTTY&&console.log()}static newLine(){V.getInstance().newLine()}terminal(n,r,...o){if(!process.stdout.isTTY){this.pino[n==="success"||n==="title"||n==="code"?"info":n](r,...o);return}switch(n){case"info":console.log(M.blue("ℹ"),r,...o);break;case"success":console.log(M.green("✓"),r,...o);break;case"warn":console.warn(M.yellow("⚠"),r,...o);break;case"error":console.error(M.red("✗"),r,...o);break;case"debug":console.log(M.gray("🔍"),M.gray(r),...o);break;case"title":console.log(),console.log(M.bold.cyan(r)),console.log(M.cyan("=".repeat(r.length)));break;case"code":console.log(),console.log(M.gray(" "+r)),console.log();break}}getPino(){return this.pino}child(n){const r=new V({useTerminalFormat:this.useTerminalFormat});return r.pino=this.pino.child(n),r}}class G{static AGIFLOW_DIR=_e.join(Qt.homedir(),".agiflow");static async ensureDir(n){await be.ensureDir(n)}static async exists(n){try{return await be.access(n),!0}catch{return!1}}static async readJson(n){const r=await be.readFile(n,"utf-8");return JSON.parse(r)}static async writeJson(n,r,o){await be.ensureDir(_e.dirname(n));const e=JSON.stringify(r,null,o?.spaces??2);await be.writeFile(n,e,"utf-8")}static async copy(n,r){await be.copy(n,r)}static async remove(n){await be.remove(n)}static getCurrentDirectory(){return process.cwd()}static resolvePath(...n){return _e.resolve(process.cwd(),...n)}static async getFiles(n,r){const o=await be.readdir(n);return r?o.filter(e=>r.test(e)):o}static getAbsolutePath(n){return n?n.startsWith("~/")?_e.join(Qt.homedir(),n.slice(2)):n==="~"?Qt.homedir():_e.isAbsolute(n)?n:_e.resolve(process.cwd(),n):process.cwd()}}class Eg{static SESSIONS_FILE=_e.join(G.AGIFLOW_DIR,"sessions.json");static async getSessionSettings(n){try{return await G.exists(this.SESSIONS_FILE)&&(await G.readJson(this.SESSIONS_FILE))[n]||null}catch(r){return console.error("[SessionSettings] Failed to read session settings:",r),null}}static async setSessionSettings(n,r){try{let o={};await G.exists(this.SESSIONS_FILE)&&(o=await G.readJson(this.SESSIONS_FILE)),o[n]=r,await G.writeJson(this.SESSIONS_FILE,o,{spaces:2})}catch(o){throw console.error("[SessionSettings] Failed to write session settings:",o),o}}static async removeSessionSettings(n){try{if(!await G.exists(this.SESSIONS_FILE))return;const o=await G.readJson(this.SESSIONS_FILE);delete o[n],await G.writeJson(this.SESSIONS_FILE,o,{spaces:2})}catch(r){throw console.error("[SessionSettings] Failed to remove session settings:",r),r}}static async getAllSessions(){try{return await G.exists(this.SESSIONS_FILE)?await G.readJson(this.SESSIONS_FILE):{}}catch(n){return console.error("[SessionSettings] Failed to read all session settings:",n),{}}}static async clearAllSessions(){try{await G.writeJson(this.SESSIONS_FILE,{},{spaces:2})}catch(n){throw console.error("[SessionSettings] Failed to clear session settings:",n),n}}}class Og{filePath;cache=null;dirty=!1;constructor(n){this.filePath=n||_e.join(G.AGIFLOW_DIR,"credentials.json")}async load(){if(this.cache)return this.cache;try{if(!await G.exists(this.filePath))return null;const r=await G.readJson(this.filePath);return this.cache=r,r}catch{return null}}async flush(){!this.dirty||!this.cache||(await G.ensureDir(G.AGIFLOW_DIR),await G.writeJson(this.filePath,this.cache),this.dirty=!1)}async setApiKey(n){this.cache={apiKey:n.apiKey,organizationId:n.organizationId,deviceId:n.deviceId||this.cache?.deviceId,expiresAt:n.expiresAt},this.dirty=!0,await this.flush()}async setDeviceId(n){const r=await this.load()||{apiKey:"",organizationId:""};r.deviceId=n,this.cache=r,this.dirty=!0,await this.flush()}async getApiKey(){return(await this.load())?.apiKey||null}async getAgentCreds(){const n=await this.load();if(!n)throw new Error("Cred not set");return{apiKey:n.apiKey,organizationId:n.organizationId,deviceId:n.deviceId}}async getOrganizationId(){return(await this.load())?.organizationId||null}async getDeviceId(){return(await this.load())?.deviceId||null}async isExpired(n=300*1e3){const r=await this.load();return r?.expiresAt?Date.now()>=r.expiresAt-n:!1}async clear(){this.cache=null,this.dirty=!1;try{await G.exists(this.filePath)&&await G.remove(this.filePath)}catch{}}async buildAuthHeaders(){const n=await this.load();return n?.apiKey?{"x-api-key":n.apiKey}:{}}async buildDeviceAuthHeaders(n){const r=await this.load();if(!r?.apiKey)return{};const o={"x-api-key":r.apiKey};return n&&(o["x-device-guid"]=n),r.deviceId&&(o["x-device-id"]=r.deviceId),r.organizationId&&(o["x-organization-id"]=r.organizationId),o}async buildAgentAuthHeaders(n){let r=n;if(r||(r=await this.getApiKey()||void 0),r||(r=pe.apiKey),!r)return{};const o={"x-api-key":r,"Content-Type":"application/json"},e=await this.getOrganizationId();e&&(o["x-organization-id"]=e);const i=await this.getDeviceId();return i&&(o["x-device-id"]=i),o}}A({limit:ce().min(1).max(100).optional(),offset:ce().min(0).optional(),messageType:Yr.optional(),sort:j().optional(),order:Je(["asc","desc"]).optional()});class jg{options;authService;credentials;logger;constructor(n){this.options=n,this.authService=n.authService,this.credentials=n.credentials??new Og,this.logger=n.logger??new V({verbose:!1})}async getAuthHeaders(){let n=await this.credentials.getApiKey(),r=await this.credentials.getOrganizationId();if((!n||!r)&&this.authService){const e=await this.authService.getValidApiKey();n=e.api_key,r=e.organization_id,await this.credentials.setApiKey({apiKey:n,organizationId:r,expiresAt:e.expires_at})}if(!n&&this.options.apiKey&&(n=this.options.apiKey),!r&&this.options.organizationId&&(r=this.options.organizationId),n&&r)return this.options.organizationId=r,{"Content-Type":"application/json","x-api-key":n};const o=this.options.authToken;if(!o)throw new Error("Authentication token is required for agent message operations");if(!this.options.organizationId)throw new Error("Organization ID is required for agent message operations");return{"Content-Type":"application/json",Authorization:`Bearer ${o}`}}async makeAuthenticatedRequest(n,r,o=!0){const e=await fetch(n,r);if(e.status===401&&o&&this.authService){const i=await e.text();if(i.includes("Invalid API key")){this.logger.info("= API key expired or invalid, clearing tokens and retrying authentication..."),await this.authService.clearTokens();try{await this.credentials.clear()}catch{}this.logger.info("= Retrying authentication...");const a=await this.getAuthHeaders(),u={...r,headers:{...r.headers,...a}};return await this.makeAuthenticatedRequest(n,u,!1)}if(i.includes("Invalid or expired session")){const a=pe.isContainerMode;if(this.logger.error("🚫 Session validation failed:",new Error(`Session validation failed for ${n}. Docker mode: ${a}, Method: ${r.method||"GET"}, Timestamp: ${new Date().toISOString()}`)),a)return this.logger.warn("🐳 Docker session timing issue detected, waiting and retrying..."),await new Promise(u=>setTimeout(u,2e3)),await this.makeAuthenticatedRequest(n,r,!1)}}return e.status===429&&this.logger.warn("= Rate limit exceeded, keeping credentials but not retrying"),e}async sendMessage(n){const r=await this.getAuthHeaders(),o=this.options.organizationId;if(!o)throw new Error("Organization ID is required for sending agent messages");const e=ki(n);try{gc.parse(e)}catch(i){throw new Error(`Invalid message payload: ${i instanceof Error?i.message:i}`)}try{const i=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${o}/agent-sessions/${n.sessionId}/messages`,{method:"POST",headers:r,body:JSON.stringify(e)});if(!i.ok){const u=await i.text();throw new Error(`Failed to send agent message: ${i.status} ${u}`)}return await i.json()}catch(i){throw new Error(`Failed to send agent message: ${i instanceof Error?i.message:i}`)}}async sendMessageBatch(n,r){const o=await this.getAuthHeaders(),e=this.options.organizationId;if(!e)throw new Error("Organization ID is required for sending agent messages");const i=(r||[]).map(a=>ki(a));try{const a=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${e}/agent-sessions/${n}/messages/batch`,{method:"POST",headers:o,body:JSON.stringify({messages:i})});if(!a.ok){const s=await a.text();throw new Error(`Failed to send agent message batch: ${a.status} ${s}`)}return await a.json()}catch(a){throw new Error(`Failed to send agent message batch: ${a instanceof Error?a.message:a}`)}}async getMessage(n,r){const o=await this.getAuthHeaders(),e=this.options.organizationId;if(!e)throw new Error("Organization ID is required for fetching agent message");try{const i=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${e}/agent-sessions/${n}/messages/${r}`,{method:"GET",headers:o});if(!i.ok){const u=await i.text();throw new Error(`Failed to fetch message: ${i.status} ${u}`)}return await i.json()}catch(i){throw new Error(`Failed to fetch message: ${i instanceof Error?i.message:i}`)}}async getSessionMessages(n,r){const o=await this.getAuthHeaders(),e=this.options.organizationId;if(!e)throw new Error("Organization ID is required for fetching agent messages");const i=new URLSearchParams;r?.limit&&i.append("limit",r.limit.toString()),r?.offset&&i.append("offset",r.offset.toString()),r?.messageType&&i.append("messageType",r.messageType),r?.sort&&i.append("sort",r.sort),r?.order&&i.append("order",r.order);const a=`${this.options.apiUrl}/api/v1/organizations/${e}/agent-sessions/${n}/messages?${i.toString()}`;try{const u=await this.makeAuthenticatedRequest(a,{method:"GET",headers:o});if(!u.ok){const l=await u.text();throw new Error(`Failed to fetch session messages: ${u.status} ${l}`)}return await u.json()}catch(u){throw new Error(`Failed to fetch session messages: ${u instanceof Error?u.message:u}`)}}async uploadMessageContent(n,r,o,e){const i=await this.getAuthHeaders(),a=this.options.organizationId;if(!a)throw new Error("Organization ID is required for uploading message content");const u=typeof o=="string"?Buffer.from(o,"utf-8"):o,s=u.length;try{const l=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${a}/agent-sessions/${n}/messages/presign`,{method:"POST",headers:i,body:JSON.stringify({messageType:r,contentSize:s})});if(!l.ok){const v=await l.text();throw new Error(`Failed to get presigned URL: ${l.status} ${v}`)}const{uploadUrl:m}=await l.json(),f=await fetch(m,{method:"PUT",body:u,headers:{"Content-Type":"application/octet-stream","Content-Length":s.toString()}});if(!f.ok)throw new Error(`Failed to upload content to R2: ${f.status}`);const b={sessionId:n,messageType:r,contentSize:s,metadata:e};return await this.sendMessage(b)}catch(l){throw new Error(`Failed to upload message content: ${l instanceof Error?l.message:l}`)}}async startMessage(n,r){const o=await this.getAuthHeaders(),e=this.options.organizationId;if(!e)throw new Error("Organization ID is required for starting agent messages");try{ug.parse(r)}catch(i){throw new Error(`Invalid start message payload: ${i instanceof Error?i.message:i}`)}try{const i=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${e}/agent-sessions/${n}/messages/start`,{method:"POST",headers:o,body:JSON.stringify(r)});if(!i.ok){const u=await i.text();throw new Error(`Failed to start agent message: ${i.status} ${u}`)}return await i.json()}catch(i){throw new Error(`Failed to start agent message: ${i instanceof Error?i.message:i}`)}}async updateMessage(n,r,o){const e=await this.getAuthHeaders(),i=this.options.organizationId;if(!i)throw new Error("Organization ID is required for updating agent messages");try{sg.parse(o)}catch(u){throw this.logger.error("=❌ Update message validation failed",new Error(`Update message validation failed: ${u instanceof Error?u.message:u}`)),new Error(`Invalid update message payload: ${u instanceof Error?u.message:u}`)}const a=JSON.stringify(o);try{const u=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${i}/agent-sessions/${n}/messages/${r}`,{method:"PATCH",headers:e,body:a});if(!u.ok){const l=await u.text();throw new Error(`Failed to update agent message: ${u.status} ${l}`)}return await u.json()}catch(u){throw new Error(`Failed to update agent message: ${u instanceof Error?u.message:u}`)}}async requestApproval(n,r){const o=await this.getAuthHeaders(),e=this.options.organizationId;if(!e)throw new Error("Organization ID is required for requesting approval");try{cg.parse(r)}catch(i){throw new Error(`Invalid request approval payload: ${i instanceof Error?i.message:i}`)}try{const i=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${e}/agent-sessions/${n}/messages/request-approval`,{method:"POST",headers:o,body:JSON.stringify(r)});if(!i.ok){const u=await i.text();throw new Error(`Failed to request approval: ${i.status} ${u}`)}return await i.json()}catch(i){throw new Error(`Failed to request approval: ${i instanceof Error?i.message:i}`)}}async deleteSessionMessages(n){const r=await this.getAuthHeaders(),o=this.options.organizationId;if(!o)throw new Error("Organization ID is required for deleting session messages");this.logger.info(`=� Deleting all messages for session ${n}...`);try{const e=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${o}/agent-sessions/${n}/messages`,{method:"DELETE",headers:r},!1);if(!e.ok){const a=await e.text().catch(()=>"Unknown error");return this.logger.warn(`� Failed to delete session messages: ${e.status} ${a}`),0}const{deletedCount:i}=await e.json();return this.logger.success(` Deleted ${i} messages for session ${n}`),i}catch(e){return this.logger.warn("� Failed to delete session messages:",e),0}}async getAgentSession(n){const r=await this.getAuthHeaders(),o=this.options.organizationId;if(!o)throw new Error("Organization ID is required for fetching agent session");try{const e=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${o}/agent-sessions/${n}`,{method:"GET",headers:r});if(!e.ok){const a=await e.text();throw new Error(`Failed to fetch agent session: ${e.status} ${a}`)}return await e.json()}catch(e){throw new Error(`Failed to fetch agent session: ${e instanceof Error?e.message:e}`)}}async createTaskComment(n,r,o,e){try{const i=await this.getAuthHeaders(),a=this.options.organizationId;if(!a)return this.logger.warn("Organization ID is required for creating task comment"),null;const u=r&&r.length>1e4?r.substring(0,1e4):r,s=await this.getAgentSession(n);if(!s)return this.logger.warn("Agent session not found for task comment creation"),null;if(!s.taskId)return this.logger.debug("Agent session has no associated task - skipping comment creation"),null;const l=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${a}/tasks/${s.taskId}/comments`,{method:"POST",headers:i,body:JSON.stringify({content:u,assigneeId:o,info:e})});if(!l.ok){const f=await l.text();return this.logger.warn(`Failed to create task comment: ${l.status} ${f}`),null}const m=await l.json();return this.logger.debug("Task comment created successfully"),m}catch(i){return this.logger.warn(`Failed to create task comment: ${i instanceof Error?i.message:i}`),null}}async updateTaskDevInfo(n,r){try{const o=await this.getAuthHeaders(),e=this.options.organizationId;if(!e)return this.logger.warn("Organization ID is required for updating task devInfo"),null;const i=await this.getAgentSession(n);if(!i)return this.logger.warn("Agent session not found for task devInfo update"),null;if(!i.taskId)return this.logger.debug("Agent session has no associated task - skipping devInfo update"),null;const a=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${e}/tasks/${i.taskId}`,{method:"PATCH",headers:o,body:JSON.stringify({devInfo:r})});if(!a.ok){const s=await a.text();return this.logger.warn(`Failed to update task devInfo: ${a.status} ${s}`),null}const u=await a.json();return this.logger.debug("Task devInfo updated successfully"),u}catch(o){return this.logger.warn(`Failed to update task devInfo: ${o instanceof Error?o.message:o}`),null}}async updateToolApproval(n,r,o,e,i){const a=await this.getAuthHeaders(),u=this.options.organizationId;if(!u)throw new Error("Organization ID is required for updating tool approval");try{const s=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${u}/agent-sessions/${n}/messages/${r}/tool-approval`,{method:"PATCH",headers:a,body:JSON.stringify({toolName:o,approved:e,autoApprove:i||!1})});if(!s.ok){const m=await s.text();throw new Error(`Failed to update tool approval: ${s.status} ${m}`)}return await s.json()}catch(s){throw new Error(`Failed to update tool approval: ${s instanceof Error?s.message:s}`)}}async sendToolApprovalNotification(n,r,o,e){const i=await this.getAuthHeaders(),a=this.options.organizationId;if(!a)throw new Error("Organization ID is required for sending tool approval notification");try{const u=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${a}/agent-sessions/${n}/messages/tool-approval-notification`,{method:"POST",headers:i,body:JSON.stringify({notificationType:r,message:o,metadata:e})});if(!u.ok){const l=await u.text();throw new Error(`Failed to send tool approval notification: ${u.status} ${l}`)}return await u.json()}catch(u){throw new Error(`Failed to send tool approval notification: ${u instanceof Error?u.message:u}`)}}async updateToolResult(n,r,o){const e=await this.getAuthHeaders(),i=this.options.organizationId;if(!i)throw new Error("Organization ID is required for updating tool result");try{const a=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${i}/agent-sessions/${n}/messages/tool-result`,{method:"POST",headers:e,body:JSON.stringify({toolName:r,toolResult:o})});if(!a.ok){const s=await a.text();throw new Error(`Failed to update tool result: ${a.status} ${s}`)}return await a.json()}catch(a){throw new Error(`Failed to update tool result: ${a instanceof Error?a.message:a}`)}}async sendAgentSessionReady(n){const r=await this.getAuthHeaders(),o=this.options.organizationId;if(!o)throw new Error("Organization ID is required for sending agent session ready status");try{const e=await this.makeAuthenticatedRequest(`${this.options.apiUrl}/api/v1/organizations/${o}/agent-sessions/${n}/ready`,{method:"POST",headers:r,body:JSON.stringify({ready:!0,timestamp:new Date().toISOString()})});if(!e.ok){const a=await e.text();throw new Error(`Failed to send agent session ready status: ${e.status} ${a}`)}return await e.json()}catch(e){throw new Error(`Failed to send agent session ready status: ${e instanceof Error?e.message:e}`)}}}class xg{agentHttpService=null;sessionId;enableRemote=!1;logger;constructor(n){this.sessionId=pe.sessionId||"";const r=De.join(Di.tmpdir(),"agiflow-agent-cli",this.sessionId||"unknown"),o=De.join(r,"posttooluse.jsonl");this.logger=new Kf(o),this.setupRemoteService()}setupRemoteService(){let n=pe.serverUrl||"";n.startsWith("wss://")?n="https://"+n.slice(6):n.startsWith("ws://")&&(n="http://"+n.slice(5));const r=pe.apiKey||"",o=pe.organizationId||"";if(this.enableRemote=!!(this.sessionId&&n&&r&&o),this.enableRemote&&n)try{this.agentHttpService=new jg({apiUrl:n,organizationId:o,apiKey:r})}catch(e){this.enableRemote=!1,this.logger.error("Failed to initialize remote service",{error:e instanceof Error?e.message:String(e)})}}logToFile(n){this.logger.info("tool-event",{sessionId:this.sessionId,...n})}async processToolExecution(n){try{try{this.logToFile({type:"tool-execution",tool_name:n.tool_name,tool_input:n.tool_input,tool_response:n.tool_response,cwd:n.cwd})}catch{}if(this.enableRemote&&this.agentHttpService)try{await this.agentHttpService.updateToolResult(this.sessionId,n.tool_name,n.tool_response)}catch(r){try{this.logToFile({type:"remote-update-error",error:r instanceof Error?r.message:String(r),tool_name:n.tool_name})}catch{}}if(this.hasError(n.tool_response))try{this.logToFile({type:"tool-error",tool_name:n.tool_name,error:this.extractErrorMessage(n.tool_response)})}catch(r){console.error("[PostToolUse] Failed to log tool-error:",r)}}catch(r){console.error("[PostToolUse] Unexpected error in processToolExecution:",r)}return{decision:"approve"}}hasError(n){if(n.error||n.errorMessage||n.success===!1)return!0;const r=typeof n=="string"?n:JSON.stringify(n);return!!(r.includes("Error:")||r.includes("Failed")||r.includes("Exception"))}extractErrorMessage(n){return n.error?String(n.error):n.errorMessage?String(n.errorMessage):n.message?String(n.message):typeof n=="string"?n:"Unknown error occurred"}}async function Ng(){try{let t;try{const e=[];for await(const a of process.stdin)e.push(a);const i=Buffer.concat(e).toString();t=JSON.parse(i)}catch{console.log(JSON.stringify({decision:"approve"})),process.exit(0);return}const r=await new xg(t.cwd).processToolExecution(t),o=Object.keys(r).length>0?r:{decision:"approve"};console.log(JSON.stringify(o)),process.exit(0)}catch{console.log(JSON.stringify({decision:"approve"})),process.exit(0)}}Ng().catch(()=>{console.log(JSON.stringify({decision:"approve"})),process.exit(0)});
10
30
  //# sourceMappingURL=claudePostToolUse.js.map