@synnaxlabs/freighter 0.7.1 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/freighter.cjs +2 -0
- package/dist/freighter.cjs.map +1 -0
- package/dist/{freighter.es.js → freighter.js} +1745 -1691
- package/dist/freighter.js.map +1 -0
- package/package.json +7 -7
- package/dist/freighter.cjs.js +0 -2
- package/dist/freighter.cjs.js.map +0 -1
- package/dist/freighter.es.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var ei=Object.defineProperty;var ti=(r,e,t)=>e in r?ei(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var ce=(r,e,t)=>(ti(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var ri=Object.defineProperty,ni=(r,e,t)=>e in r?ri(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,b=(r,e,t)=>(ni(r,typeof e!="symbol"?e+"":e,t),t),xt,F;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(F||(F={}));var Tn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Tn||(Tn={}));const k=F.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nt=r=>{switch(typeof r){case"undefined":return k.undefined;case"string":return k.string;case"number":return isNaN(r)?k.nan:k.number;case"boolean":return k.boolean;case"function":return k.function;case"bigint":return k.bigint;case"symbol":return k.symbol;case"object":return Array.isArray(r)?k.array:r===null?k.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?k.promise:typeof Map<"u"&&r instanceof Map?k.map:typeof Set<"u"&&r instanceof Set?k.set:typeof Date<"u"&&r instanceof Date?k.date:k.object;default:return k.unknown}},v=F.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"]),si=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");let Ae=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,l=0;for(;l<i.path.length;){const u=i.path[l];l===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,F.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Ae.create=r=>new Ae(r);const Mt=(r,e)=>{let t;switch(r.code){case v.invalid_type:r.received===k.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case v.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,F.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:t=`Unrecognized key(s) in object: ${F.joinValues(r.keys,", ")}`;break;case v.invalid_union:t="Invalid input";break;case v.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${F.joinValues(r.options)}`;break;case v.invalid_enum_value:t=`Invalid enum value. Expected ${F.joinValues(r.options)}, received '${r.received}'`;break;case v.invalid_arguments:t="Invalid function arguments";break;case v.invalid_return_type:t="Invalid function return type";break;case v.invalid_date:t="Invalid date";break;case v.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}"`:F.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case v.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==="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 v.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 v.custom:t="Invalid input";break;case v.invalid_intersection_types:t="Intersection results could not be merged";break;case v.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case v.not_finite:t="Number must be finite";break;default:t=e.defaultError,F.assertNever(r)}return{message:t}};let Ds=Mt;function ai(r){Ds=r}function Mr(){return Ds}const Ur=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const l=n.filter(u=>!!u).slice().reverse();for(const u of l)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},ii=[];function S(r,e){const t=Ur({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Mr(),Mt].filter(n=>!!n)});r.common.issues.push(t)}let Te=class Ls{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return $;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t)n.push({key:await s.key,value:await s.value});return Ls.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return $;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}};const $=Object.freeze({status:"aborted"}),Bs=r=>({status:"dirty",value:r}),we=r=>({status:"valid",value:r}),kn=r=>r.status==="aborted",On=r=>r.status==="dirty",Ut=r=>r.status==="valid",Pr=r=>typeof Promise<"u"&&r instanceof Promise;var Z;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Z||(Z={}));let Pe=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const ps=(r,e)=>{if(Ut(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 Ae(r.common.issues);return this._error=t,this._error}}};function U(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:t??o.defaultError},description:s}}let D=class{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)}get description(){return this._def.description}_getType(e){return nt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Te,ctx:{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Pr(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},a=this._parseSync({data:e,path:s.path,parent:s});return ps(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Pr(s)?s:Promise.resolve(s));return ps(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:v.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new je({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Je.create(this,this._def)}nullable(){return gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yt.create(this,this._def)}promise(){return It.create(this,this._def)}or(e){return qt.create([this,e],this._def)}and(e){return Yt.create(this,e,this._def)}transform(e){return new je({...U(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Gt({...U(this._def),innerType:this,defaultValue:t,typeName:C.ZodDefault})}brand(){return new Gs({typeName:C.ZodBranded,type:this,...U(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new zr({...U(this._def),innerType:this,catchValue:t,typeName:C.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Vn.create(this,e)}readonly(){return Yr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const oi=/^c[^\s-]{8,}$/i,ci=/^[a-z][a-z0-9]*$/,ui=/^[0-9A-HJKMNP-TV-Z]{26}$/,li=/^[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,di=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fi="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let gn;const hi=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,pi=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,mi=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function yi(r,e){return!!((e==="v4"||!e)&&hi.test(r)||(e==="v6"||!e)&&pi.test(r))}let Et=class jt extends D{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==k.string){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:k.string,received:a.parsedType}),$}const n=new Te;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?S(s,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&S(s,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")di.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"email",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")gn||(gn=new RegExp(fi,"u")),gn.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"emoji",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")li.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"uuid",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")oi.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ci.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid2",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ui.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ulid",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),S(s,{validation:"url",code:v.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"regex",code:v.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.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)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?mi(a).test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?yi(e.data,a.version)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ip",code:v.invalid_string,message:a.message}),n.dirty()):F.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:v.invalid_string,...Z.errToObj(n)})}_addCheck(e){return new jt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Z.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...Z.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Z.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Z.errToObj(t)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new jt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new jt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new jt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}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 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 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}};Et.create=r=>{var e;return new Et({checks:[],typeName:C.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...U(r)})};function gi(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}let Pt=class Sn extends D{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)!==k.number){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:k.number,received:a.parsedType}),$}let n;const s=new Te;for(const a of this._def.checks)a.kind==="int"?F.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?gi(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_finite,message:a.message}),s.dirty()):F.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,s){return new Sn({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(s)}]})}_addCheck(e){return new Sn({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.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"&&F.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Pt.create=r=>new Pt({checks:[],typeName:C.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...U(r)});let Dt=class En extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==k.bigint){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:k.bigint,received:a.parsedType}),$}let n;const s=new Te;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):F.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,s){return new En({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(s)}]})}_addCheck(e){return new En({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.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}};Dt.create=r=>{var e;return new Dt({checks:[],typeName:C.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...U(r)})};let Lt=class extends D{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==k.boolean){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:k.boolean,received:n.parsedType}),$}return we(e.data)}};Lt.create=r=>new Lt({typeName:C.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...U(r)});let Bt=class Vs extends D{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==k.date){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:k.date,received:a.parsedType}),$}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_date}),$}const n=new Te;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):F.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Vs({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Z.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}};Bt.create=r=>new Bt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:C.ZodDate,...U(r)});let Dr=class extends D{_parse(e){if(this._getType(e)!==k.symbol){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:k.symbol,received:n.parsedType}),$}return we(e.data)}};Dr.create=r=>new Dr({typeName:C.ZodSymbol,...U(r)});let Vt=class extends D{_parse(e){if(this._getType(e)!==k.undefined){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:k.undefined,received:n.parsedType}),$}return we(e.data)}};Vt.create=r=>new Vt({typeName:C.ZodUndefined,...U(r)});let zt=class extends D{_parse(e){if(this._getType(e)!==k.null){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:k.null,received:n.parsedType}),$}return we(e.data)}};zt.create=r=>new zt({typeName:C.ZodNull,...U(r)});let Nt=class extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return we(e.data)}};Nt.create=r=>new Nt({typeName:C.ZodAny,...U(r)});let pt=class extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return we(e.data)}};pt.create=r=>new pt({typeName:C.ZodUnknown,...U(r)});let Qe=class extends D{_parse(e){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:k.never,received:t.parsedType}),$}};Qe.create=r=>new Qe({typeName:C.ZodNever,...U(r)});let Lr=class extends D{_parse(e){if(this._getType(e)!==k.undefined){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:k.void,received:n.parsedType}),$}return we(e.data)}};Lr.create=r=>new Lr({typeName:C.ZodVoid,...U(r)});let yt=class xr extends D{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==k.array)return S(t,{code:v.invalid_type,expected:k.array,received:t.parsedType}),$;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(S(t,{code:i?v.too_big:v.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(S(t,{code:v.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(S(t,{code:v.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new Pe(t,i,t.path,o)))).then(i=>Te.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Pe(t,i,t.path,o)));return Te.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new xr({...this._def,minLength:{value:e,message:Z.toString(t)}})}max(e,t){return new xr({...this._def,maxLength:{value:e,message:Z.toString(t)}})}length(e,t){return new xr({...this._def,exactLength:{value:e,message:Z.toString(t)}})}nonempty(e){return this.min(1,e)}};yt.create=(r,e)=>new yt({type:r,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...U(e)});function kt(r){if(r instanceof Ee){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Je.create(kt(n))}return new Ee({...r._def,shape:()=>e})}else return r instanceof yt?new yt({...r._def,type:kt(r.element)}):r instanceof Je?Je.create(kt(r.unwrap())):r instanceof gt?gt.create(kt(r.unwrap())):r instanceof ot?ot.create(r.items.map(e=>kt(e))):r}let Ee=class Ie extends D{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=F.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==k.object){const u=this._getOrReturnCtx(e);return S(u,{code:v.invalid_type,expected:k.object,received:u.parsedType}),$}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Qe&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const l=[];for(const u of i){const p=a[u],N=s.data[u];l.push({key:{status:"valid",value:u},value:p._parse(new Pe(s,N,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Qe){const u=this._def.unknownKeys;if(u==="passthrough")for(const p of o)l.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(u==="strict")o.length>0&&(S(s,{code:v.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const p of o){const N=s.data[p];l.push({key:{status:"valid",value:p},value:u._parse(new Pe(s,N,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const p of l){const N=await p.key;u.push({key:N,value:await p.value,alwaysSet:p.alwaysSet})}return u}).then(u=>Te.mergeObjectSync(n,u)):Te.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Z.errToObj,new Ie({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const l=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=Z.errToObj(e).message)!==null&&o!==void 0?o:l}:{message:l}}}:{}})}strip(){return new Ie({...this._def,unknownKeys:"strip"})}passthrough(){return new Ie({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ie({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ie({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:C.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ie({...this._def,catchall:e})}pick(e){const t={};return F.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Ie({...this._def,shape:()=>t})}omit(e){const t={};return F.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Ie({...this._def,shape:()=>t})}deepPartial(){return kt(this)}partial(e){const t={};return F.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new Ie({...this._def,shape:()=>t})}required(e){const t={};return F.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Je;)a=a._def.innerType;t[n]=a}}),new Ie({...this._def,shape:()=>t})}keyof(){return Fs(F.objectKeys(this.shape))}};Ee.create=(r,e)=>new Ee({shape:()=>r,unknownKeys:"strip",catchall:Qe.create(),typeName:C.ZodObject,...U(e)});Ee.strictCreate=(r,e)=>new Ee({shape:()=>r,unknownKeys:"strict",catchall:Qe.create(),typeName:C.ZodObject,...U(e)});Ee.lazycreate=(r,e)=>new Ee({shape:r,unknownKeys:"strip",catchall:Qe.create(),typeName:C.ZodObject,...U(e)});let qt=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(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 Ae(o.ctx.common.issues));return S(t,{code:v.invalid_union,unionErrors:i}),$}if(t.common.async)return Promise.all(n.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(s);{let a;const i=[];for(const l of n){const u={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,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(l=>new Ae(l));return S(t,{code:v.invalid_union,unionErrors:o}),$}}get options(){return this._def.options}};qt.create=(r,e)=>new qt({options:r,typeName:C.ZodUnion,...U(e)});const Tr=r=>r instanceof Kt?Tr(r.schema):r instanceof je?Tr(r.innerType()):r instanceof Wt?[r.value]:r instanceof dr?r.options:r instanceof Ft?Object.keys(r.enum):r instanceof Gt?Tr(r._def.innerType):r instanceof Vt?[void 0]:r instanceof zt?[null]:null;let zs=class qs extends D{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.object)return S(t,{code:v.invalid_type,expected:k.object,received:t.parsedType}),$;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);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}):(S(t,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),$)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=Tr(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new qs({typeName:C.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...U(n)})}};function Nn(r,e){const t=nt(r),n=nt(e);if(r===e)return{valid:!0,data:r};if(t===k.object&&n===k.object){const s=F.objectKeys(e),a=F.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const l=Nn(r[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(t===k.array&&n===k.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],l=Nn(i,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===k.date&&n===k.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}let Yt=class extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(kn(a)||kn(i))return $;const o=Nn(a.value,i.value);return o.valid?((On(a)||On(i))&&t.dirty(),{status:t.value,value:o.data}):(S(n,{code:v.invalid_intersection_types}),$)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Yt.create=(r,e,t)=>new Yt({left:r,right:e,typeName:C.ZodIntersection,...U(t)});let ot=class Ys extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.array)return S(n,{code:v.invalid_type,expected:k.array,received:n.parsedType}),$;if(n.data.length<this._def.items.length)return S(n,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new Pe(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>Te.mergeArray(t,i)):Te.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Ys({...this._def,rest:e})}};ot.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ot({items:r,typeName:C.ZodTuple,rest:null,...U(e)})};let Ks=class In extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.object)return S(n,{code:v.invalid_type,expected:k.object,received:n.parsedType}),$;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Pe(n,o,n.path,o)),value:i._parse(new Pe(n,n.data[o],n.path,o))});return n.common.async?Te.mergeObjectAsync(t,s):Te.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof D?new In({keyType:e,valueType:t,typeName:C.ZodRecord,...U(n)}):new In({keyType:Et.create(),valueType:e,typeName:C.ZodRecord,...U(t)})}},Br=class extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.map)return S(n,{code:v.invalid_type,expected:k.map,received:n.parsedType}),$;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,l],u)=>({key:s._parse(new Pe(n,o,n.path,[u,"key"])),value:a._parse(new Pe(n,l,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,p=await l.value;if(u.status==="aborted"||p.status==="aborted")return $;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of i){const u=l.key,p=l.value;if(u.status==="aborted"||p.status==="aborted")return $;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}}}};Br.create=(r,e,t)=>new Br({valueType:e,keyType:r,typeName:C.ZodMap,...U(t)});let Vr=class Zn extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==k.set)return S(n,{code:v.invalid_type,expected:k.set,received:n.parsedType}),$;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(S(n,{code:v.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(S(n,{code:v.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(l){const u=new Set;for(const p of l){if(p.status==="aborted")return $;p.status==="dirty"&&t.dirty(),u.add(p.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((l,u)=>a._parse(new Pe(n,l,n.path,u)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new Zn({...this._def,minSize:{value:e,message:Z.toString(t)}})}max(e,t){return new Zn({...this._def,maxSize:{value:e,message:Z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Vr.create=(r,e)=>new Vr({valueType:r,minSize:null,maxSize:null,typeName:C.ZodSet,...U(e)});let Ws=class kr extends D{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.function)return S(t,{code:v.invalid_type,expected:k.function,received:t.parsedType}),$;function n(o,l){return Ur({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Mr(),Mt].filter(u=>!!u),issueData:{code:v.invalid_arguments,argumentsError:l}})}function s(o,l){return Ur({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Mr(),Mt].filter(u=>!!u),issueData:{code:v.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof It){const o=this;return we(async function(...l){const u=new Ae([]),p=await o._def.args.parseAsync(l,a).catch(J=>{throw u.addIssue(n(l,J)),u}),N=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(N,a).catch(J=>{throw u.addIssue(s(N,J)),u})})}else{const o=this;return we(function(...l){const u=o._def.args.safeParse(l,a);if(!u.success)throw new Ae([n(l,u.error)]);const p=Reflect.apply(i,this,u.data),N=o._def.returns.safeParse(p,a);if(!N.success)throw new Ae([s(p,N.error)]);return N.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new kr({...this._def,args:ot.create(e).rest(pt.create())})}returns(e){return new kr({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new kr({args:e||ot.create([]).rest(pt.create()),returns:t||pt.create(),typeName:C.ZodFunction,...U(n)})}},Kt=class extends D{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})}};Kt.create=(r,e)=>new Kt({getter:r,typeName:C.ZodLazy,...U(e)});let Wt=class extends D{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return S(t,{received:t.data,code:v.invalid_literal,expected:this._def.value}),$}return{status:"valid",value:e.data}}get value(){return this._def.value}};Wt.create=(r,e)=>new Wt({value:r,typeName:C.ZodLiteral,...U(e)});function Fs(r,e){return new dr({values:r,typeName:C.ZodEnum,...U(e)})}let dr=class An extends D{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{expected:F.joinValues(n),received:t.parsedType,code:v.invalid_type}),$}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{received:t.data,code:v.invalid_enum_value,options:n}),$}return we(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){return An.create(e)}exclude(e){return An.create(this.options.filter(t=>!e.includes(t)))}};dr.create=Fs;let Ft=class extends D{_parse(e){const t=F.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==k.string&&n.parsedType!==k.number){const s=F.objectValues(t);return S(n,{expected:F.joinValues(s),received:n.parsedType,code:v.invalid_type}),$}if(t.indexOf(e.data)===-1){const s=F.objectValues(t);return S(n,{received:n.data,code:v.invalid_enum_value,options:s}),$}return we(e.data)}get enum(){return this._def.values}};Ft.create=(r,e)=>new Ft({values:r,typeName:C.ZodNativeEnum,...U(e)});let It=class extends D{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.promise&&t.common.async===!1)return S(t,{code:v.invalid_type,expected:k.promise,received:t.parsedType}),$;const n=t.parsedType===k.promise?t.data:Promise.resolve(t.data);return we(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};It.create=(r,e)=>new It({type:r,typeName:C.ZodPromise,...U(e)});let je=class extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{S(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){const i=o=>{const l=s.refinement(o,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?$:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?$:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ut(i))return i;const o=s.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:n.data,path:n.path,parent:n}).then(i=>Ut(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);F.assertNever(s)}};je.create=(r,e,t)=>new je({schema:r,typeName:C.ZodEffects,effect:e,...U(t)});je.createWithPreprocess=(r,e,t)=>new je({schema:e,effect:{type:"preprocess",transform:r},typeName:C.ZodEffects,...U(t)});let Je=class extends D{_parse(e){return this._getType(e)===k.undefined?we(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Je.create=(r,e)=>new Je({innerType:r,typeName:C.ZodOptional,...U(e)});let gt=class extends D{_parse(e){return this._getType(e)===k.null?we(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gt.create=(r,e)=>new gt({innerType:r,typeName:C.ZodNullable,...U(e)});let Gt=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===k.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Gt.create=(r,e)=>new Gt({innerType:r,typeName:C.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...U(e)});let zr=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Pr(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ae(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ae(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};zr.create=(r,e)=>new zr({innerType:r,typeName:C.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...U(e)});let qr=class extends D{_parse(e){if(this._getType(e)!==k.nan){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:k.nan,received:n.parsedType}),$}return{status:"valid",value:e.data}}};qr.create=r=>new qr({typeName:C.ZodNaN,...U(r)});const vi=Symbol("zod_brand");let Gs=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Vn=class Js extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?$:a.status==="dirty"?(t.dirty(),Bs(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?$:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Js({in:e,out:t,typeName:C.ZodPipeline})}},Yr=class extends D{_parse(e){const t=this._def.innerType._parse(e);return Ut(t)&&(t.value=Object.freeze(t.value)),t}};Yr.create=(r,e)=>new Yr({innerType:r,typeName:C.ZodReadonly,...U(e)});const Hs=(r,e={},t)=>r?Nt.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,l=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...u,fatal:l})}}):Nt.create(),_i={object:Ee.lazycreate};var C;(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"})(C||(C={}));const wi=(r,e={message:`Input not instance of ${r.name}`})=>Hs(t=>t instanceof r,e),Xs=Et.create,Qs=Pt.create,bi=qr.create,xi=Dt.create,ea=Lt.create,Ti=Bt.create,ki=Dr.create,Oi=Vt.create,Si=zt.create,Ei=Nt.create,Ni=pt.create,Ii=Qe.create,Zi=Lr.create,Ai=yt.create,Ci=Ee.create,Ri=Ee.strictCreate,ji=qt.create,$i=zs.create,Mi=Yt.create,Ui=ot.create,Pi=Ks.create,Di=Br.create,Li=Vr.create,Bi=Ws.create,Vi=Kt.create,zi=Wt.create,qi=dr.create,Yi=Ft.create,Ki=It.create,ms=je.create,Wi=Je.create,Fi=gt.create,Gi=je.createWithPreprocess,Ji=Vn.create,Hi=()=>Xs().optional(),Xi=()=>Qs().optional(),Qi=()=>ea().optional(),eo={string:r=>Et.create({...r,coerce:!0}),number:r=>Pt.create({...r,coerce:!0}),boolean:r=>Lt.create({...r,coerce:!0}),bigint:r=>Dt.create({...r,coerce:!0}),date:r=>Bt.create({...r,coerce:!0})},to=$;var y=Object.freeze({__proto__:null,defaultErrorMap:Mt,setErrorMap:ai,getErrorMap:Mr,makeIssue:Ur,EMPTY_PATH:ii,addIssueToContext:S,ParseStatus:Te,INVALID:$,DIRTY:Bs,OK:we,isAborted:kn,isDirty:On,isValid:Ut,isAsync:Pr,get util(){return F},get objectUtil(){return Tn},ZodParsedType:k,getParsedType:nt,ZodType:D,ZodString:Et,ZodNumber:Pt,ZodBigInt:Dt,ZodBoolean:Lt,ZodDate:Bt,ZodSymbol:Dr,ZodUndefined:Vt,ZodNull:zt,ZodAny:Nt,ZodUnknown:pt,ZodNever:Qe,ZodVoid:Lr,ZodArray:yt,ZodObject:Ee,ZodUnion:qt,ZodDiscriminatedUnion:zs,ZodIntersection:Yt,ZodTuple:ot,ZodRecord:Ks,ZodMap:Br,ZodSet:Vr,ZodFunction:Ws,ZodLazy:Kt,ZodLiteral:Wt,ZodEnum:dr,ZodNativeEnum:Ft,ZodPromise:It,ZodEffects:je,ZodTransformer:je,ZodOptional:Je,ZodNullable:gt,ZodDefault:Gt,ZodCatch:zr,ZodNaN:qr,BRAND:vi,ZodBranded:Gs,ZodPipeline:Vn,ZodReadonly:Yr,custom:Hs,Schema:D,ZodSchema:D,late:_i,get ZodFirstPartyTypeKind(){return C},coerce:eo,any:Ei,array:Ai,bigint:xi,boolean:ea,date:Ti,discriminatedUnion:$i,effect:ms,enum:qi,function:Bi,instanceof:wi,intersection:Mi,lazy:Vi,literal:zi,map:Di,nan:bi,nativeEnum:Yi,never:Ii,null:Si,nullable:Fi,number:Qs,object:Ci,oboolean:Qi,onumber:Xi,optional:Wi,ostring:Hi,pipeline:Ji,preprocess:Gi,promise:Ki,record:Pi,set:Li,strictObject:Ri,string:Xs,symbol:ki,transformer:ms,tuple:Ui,undefined:Oi,union:ji,unknown:Ni,void:Zi,NEVER:to,ZodIssueCode:v,quotelessJson:si,ZodError:Ae});const zn=y.tuple([y.number(),y.number()]),ta=y.object({width:y.number(),height:y.number()}),ro=y.object({signedWidth:y.number(),signedHeight:y.number()}),no=["width","height"];y.enum(no);const so=["start","center","end"],ao=["signedWidth","signedHeight"];y.enum(ao);const Kr=y.object({x:y.number(),y:y.number()}),io=y.object({clientX:y.number(),clientY:y.number()}),oo=["x","y"],ra=y.enum(oo),na=["top","right","bottom","left"];y.enum(na);const co=["left","right"],sa=y.enum(co),uo=["top","bottom"],aa=y.enum(uo),ia=["center"],ys=y.enum(ia),lo=[...na,...ia],oa=y.enum(lo);y.enum(so);const fo=["first","last"];y.enum(fo);const ho=y.object({lower:y.number(),upper:y.number()});y.union([ho,zn]);y.union([ra,oa]);y.union([ra,oa,y.instanceof(String)]);const vn=(r,e)=>{const t={lower:0,upper:0};return typeof r=="number"?e!=null?(t.lower=r,t.upper=e):(t.lower=0,t.upper=r):Array.isArray(r)?[t.lower,t.upper]=r:(t.lower=r.lower,t.upper=r.upper),po(t)},po=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r;var Ne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},q={},sn={};Object.defineProperty(sn,"__esModule",{value:!0});function mo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"$"+n}).toLowerCase().replace(/(\$)(\w)/g,function(e,t,n){return n.toUpperCase()}):""}sn.default=mo;var an={};Object.defineProperty(an,"__esModule",{value:!0});function yo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"_").toLowerCase():""}an.default=yo;var on={};Object.defineProperty(on,"__esModule",{value:!0});function go(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"$").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"$"+n}).toLowerCase().replace(/(\$)(\w?)/g,function(e,t,n){return n.toUpperCase()}):""}on.default=go;var qn={};Object.defineProperty(qn,"__esModule",{value:!0});function vo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,".").toLowerCase():""}qn.default=vo;var Yn={};Object.defineProperty(Yn,"__esModule",{value:!0});function _o(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"/").toLowerCase():""}Yn.default=_o;var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0});function wo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase():""}Kn.default=wo;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});function bo(r){if(r===void 0&&(r=""),!r)return"";var e=String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(t,n,s){return n+"_"+s.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}Wn.default=bo;var Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});function xo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase().replace(/( ?)(\w+)( ?)/g,function(e,t,n,s){return t+n.charAt(0).toUpperCase()+n.slice(1)+s}):""}Fn.default=xo;var cn={};Object.defineProperty(cn,"__esModule",{value:!0});function To(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"-").toLowerCase():""}cn.default=To;var Gn={},bt={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.belongToTypes=r.isValidObject=r.isArrayObject=r.validateOptions=r.DefaultOption=void 0,r.DefaultOption={recursive:!1,recursiveInArray:!1,keepTypesOnRecursion:[]},r.validateOptions=function(e){return e===void 0&&(e=r.DefaultOption),e.recursive==null?e=r.DefaultOption:e.recursiveInArray==null&&(e.recursiveInArray=!1),e},r.isArrayObject=function(e){return e!=null&&Array.isArray(e)},r.isValidObject=function(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)},r.belongToTypes=function(e,t){return(t||[]).some(function(n){return e instanceof n})}})(bt);var ko=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Gn,"__esModule",{value:!0});var Ve=bt;function Or(r,e){if(e===void 0&&(e=Ve.DefaultOption),!Ve.isValidObject(r))return null;e=Ve.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toLowerCase();e.recursive&&(Ve.isValidObject(s)?Ve.belongToTypes(s,e.keepTypesOnRecursion)||(s=Or(s,e)):e.recursiveInArray&&Ve.isArrayObject(s)&&(s=ko(s).map(function(i){var o=i;if(Ve.isValidObject(i))Ve.belongToTypes(o,e.keepTypesOnRecursion)||(o=Or(i,e));else if(Ve.isArrayObject(i)){var l=Or({key:i},e);o=l.key}return o}))),t[a]=s}),t}Gn.default=Or;var Jn={},Oo=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Jn,"__esModule",{value:!0});var ze=bt;function Sr(r,e){if(e===void 0&&(e=ze.DefaultOption),!ze.isValidObject(r))return null;e=ze.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toUpperCase();e.recursive&&(ze.isValidObject(s)?ze.belongToTypes(s,e.keepTypesOnRecursion)||(s=Sr(s,e)):e.recursiveInArray&&ze.isArrayObject(s)&&(s=Oo(s).map(function(i){var o=i;if(ze.isValidObject(i))ze.belongToTypes(o,e.keepTypesOnRecursion)||(o=Sr(i,e));else if(ze.isArrayObject(i)){var l=Sr({key:i},e);o=l.key}return o}))),t[a]=s}),t}Jn.default=Sr;var Hn={},So=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Hn,"__esModule",{value:!0});var qe=bt,Eo=sn;function Er(r,e){if(e===void 0&&(e=qe.DefaultOption),!qe.isValidObject(r))return null;e=qe.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Eo.default(n);e.recursive&&(qe.isValidObject(s)?qe.belongToTypes(s,e.keepTypesOnRecursion)||(s=Er(s,e)):e.recursiveInArray&&qe.isArrayObject(s)&&(s=So(s).map(function(i){var o=i;if(qe.isValidObject(i))qe.belongToTypes(o,e.keepTypesOnRecursion)||(o=Er(i,e));else if(qe.isArrayObject(i)){var l=Er({key:i},e);o=l.key}return o}))),t[a]=s}),t}Hn.default=Er;var Xn={},No=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Xn,"__esModule",{value:!0});var Ye=bt,Io=an;function Nr(r,e){if(e===void 0&&(e=Ye.DefaultOption),!Ye.isValidObject(r))return null;e=Ye.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Io.default(n);e.recursive&&(Ye.isValidObject(s)?Ye.belongToTypes(s,e.keepTypesOnRecursion)||(s=Nr(s,e)):e.recursiveInArray&&Ye.isArrayObject(s)&&(s=No(s).map(function(i){var o=i;if(Ye.isValidObject(i))Ye.belongToTypes(o,e.keepTypesOnRecursion)||(o=Nr(i,e));else if(Ye.isArrayObject(i)){var l=Nr({key:i},e);o=l.key}return o}))),t[a]=s}),t}Xn.default=Nr;var Qn={},Zo=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Qn,"__esModule",{value:!0});var Ke=bt,Ao=on;function Ir(r,e){if(e===void 0&&(e=Ke.DefaultOption),!Ke.isValidObject(r))return null;e=Ke.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Ao.default(n);e.recursive&&(Ke.isValidObject(s)?Ke.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ir(s,e)):e.recursiveInArray&&Ke.isArrayObject(s)&&(s=Zo(s).map(function(i){var o=i;if(Ke.isValidObject(i))Ke.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ir(i,e));else if(Ke.isArrayObject(i)){var l=Ir({key:i},e);o=l.key}return o}))),t[a]=s}),t}Qn.default=Ir;var es={},Co=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(es,"__esModule",{value:!0});var We=bt,Ro=cn;function Zr(r,e){if(e===void 0&&(e=We.DefaultOption),!We.isValidObject(r))return null;e=We.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Ro.default(n);e.recursive&&(We.isValidObject(s)?We.belongToTypes(s,e.keepTypesOnRecursion)||(s=Zr(s,e)):e.recursiveInArray&&We.isArrayObject(s)&&(s=Co(s).map(function(i){var o=i;if(We.isValidObject(i))We.belongToTypes(o,e.keepTypesOnRecursion)||(o=Zr(i,e));else if(We.isArrayObject(i)){var l=Zr({key:i},e);o=l.key}return o}))),t[a]=s}),t}es.default=Zr;Object.defineProperty(q,"__esModule",{value:!0});q.kebabKeys=q.pascalKeys=q.snakeKeys=q.camelKeys=q.upperKeys=q.lowerKeys=q.toLowerCase=q.toUpperCase=q.toKebabCase=q.toHeaderCase=q.toSentenceCase=q.toTextCase=q.toPathCase=q.toDotCase=q.toPascalCase=q.toSnakeCase=q.toCamelCase=void 0;var ca=sn;q.toCamelCase=ca.default;var ua=an;q.toSnakeCase=ua.default;var la=on;q.toPascalCase=la.default;var da=qn;q.toDotCase=da.default;var fa=Yn;q.toPathCase=fa.default;var ha=Kn;q.toTextCase=ha.default;var pa=Wn;q.toSentenceCase=pa.default;var ma=Fn;q.toHeaderCase=ma.default;var ya=cn;q.toKebabCase=ya.default;var ga=Gn;q.lowerKeys=ga.default;var va=Jn;q.upperKeys=va.default;var _a=Hn;q.camelKeys=_a.default;var wa=Xn;q.snakeKeys=wa.default;var ba=Qn;q.pascalKeys=ba.default;var xa=es;q.kebabKeys=xa.default;var Ta=function(r){return String(r||"").toLowerCase()};q.toLowerCase=Ta;var ka=function(r){return String(r||"").toUpperCase()};q.toUpperCase=ka;var jo={toCamelCase:ca.default,toSnakeCase:ua.default,toPascalCase:la.default,toDotCase:da.default,toPathCase:fa.default,toTextCase:ha.default,toSentenceCase:pa.default,toHeaderCase:ma.default,toKebabCase:ya.default,toUpperCase:ka,toLowerCase:Ta,lowerKeys:ga.default,upperKeys:va.default,camelKeys:_a.default,snakeKeys:wa.default,pascalKeys:ba.default,kebabKeys:xa.default};q.default=jo;var Oa=q;const Sa={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},$o=r=>Oa.snakeKeys(r,Sa),Mo=r=>Oa.camelKeys(r,Sa);var Zt;(r=>{r.toSnake=$o,r.toCamel=Mo,r.capitalize=e=>e[0].toUpperCase()+e.slice(1)})(Zt||(Zt={}));y.object({x:sa.or(ys),y:aa.or(ys)});const Uo=y.object({x:sa,y:aa}),Po=Object.freeze({x:"left",y:"top"}),Do=(r,e)=>r.x===e.x&&r.y===e.y,gs=y.union([y.number(),Kr,zn,ta,ro,io]),Lo=(r,e)=>{if(typeof r=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return r==="x"?{x:e,y:0}:{x:0,y:e}}return typeof r=="number"?{x:r,y:e??r}:Array.isArray(r)?{x:r[0],y:r[1]}:"signedWidth"in r?{x:r.signedWidth,y:r.signedHeight}:"clientX"in r?{x:r.clientX,y:r.clientY}:"width"in r?{x:r.width,y:r.height}:{x:r.x,y:r.y}},vs={x:0,y:0},gr=y.union([y.number(),y.string()]);y.object({top:gr,left:gr,width:gr,height:gr});y.object({left:y.number(),top:y.number(),right:y.number(),bottom:y.number()});y.object({one:Kr,two:Kr,root:Uo});const ts=(r,e,t=0,n=0,s)=>{const a={one:{...vs},two:{...vs},root:s??Po};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return a.one={x:r,y:e},a.two={x:a.one.x+t,y:a.one.y+n},a}return"one"in r&&"two"in r&&"root"in r?{...r,root:s??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(a.one={x:r.left,y:r.top},a.two={x:r.right,y:r.bottom},a):(a.one=r,e==null?a.two={x:a.one.x+t,y:a.one.y+n}:typeof e=="number"?a.two={x:a.one.x+e,y:a.one.y+t}:"width"in e?a.two={x:a.one.x+e.width,y:a.one.y+e.height}:"signedWidth"in e?a.two={x:a.one.x+e.signedWidth,y:a.one.y+e.signedHeight}:a.two=e,a))},_n=r=>{const e=ts(r);return{lower:e.one.x,upper:e.two.x}},wn=r=>{const e=ts(r);return{lower:e.one.y,upper:e.two.y}},Bo=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Vo=y.object({signedWidth:y.number(),signedHeight:y.number()});y.union([ta,Vo,Kr,zn]);const zo=(r,e,t)=>(e!=null&&(r=Math.max(r,e)),t!=null&&(r=Math.min(r,t)),r);y.object({offset:gs,scale:gs});const qo=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],Yo=r=>(e,t,n,s)=>[e,s?n/r:n*r],Ko=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:i,upper:o}=r,l=a-s,u=o-i;if(t==="dimension")return[r,n*(u/l)];const p=(n-s)*(u/l)+i;return[r,p]},Wo=r=>(e,t,n)=>[r,n],Fo=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:s}=r;return[r,s-(t-n)]},Go=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=zo(n,s,a),[e,n]},Cn=class $t{constructor(){b(this,"ops",[]),b(this,"currBounds",null),b(this,"currType",null),b(this,"reversed",!1),this.ops=[]}static translate(e){return new $t().translate(e)}static magnify(e){return new $t().magnify(e)}static scale(e,t){return new $t().scale(e,t)}translate(e){const t=this.new(),n=qo(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Yo(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=vn(e,t),s=this.new(),a=Ko(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=vn(e,t),s=this.new(),a=Go(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=vn(e,t),s=this.new(),a=Wo(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=Fo();e.type="invert";const t=this.new();return t.ops.push(e),t}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new $t;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,s],a)=>a(n,e,s,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,s)=>{if(n.type==="scale"||t.some(([i,o])=>s>=i&&s<=o))return;const a=e.ops.findIndex((i,o)=>i.type==="scale"&&o>s);a!==-1&&t.push([s,a])}),t.forEach(([n,s])=>{const a=e.ops.slice(n,s);a.unshift(e.ops[s]),e.ops.splice(n,s-n+1,...a)}),e.reversed=!e.reversed,e}};b(Cn,"IDENTITY",new Cn);let _s=Cn;const ws=class Fe{constructor(e=new _s,t=new _s,n=null){b(this,"x"),b(this,"y"),b(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new Fe().translate(e,t)}static translateX(e){return new Fe().translateX(e)}static translateY(e){return new Fe().translateY(e)}static clamp(e){return new Fe().clamp(e)}static magnify(e){return new Fe().magnify(e)}static scale(e){return new Fe().scale(e)}static reBound(e){return new Fe().reBound(e)}translate(e,t){const n=Lo(e,t),s=this.copy();return s.x=this.x.translate(n.x),s.y=this.y.translate(n.y),s}translateX(e){const t=this.copy();return t.x=this.x.translate(e),t}translateY(e){const t=this.copy();return t.y=this.y.translate(e),t}magnify(e){const t=this.copy();return t.x=this.x.magnify(e.x),t.y=this.y.magnify(e.y),t}scale(e){const t=this.copy();if(Bo(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Do(n,e.root)&&(n.x!==e.root.x&&(t.x=t.x.invert()),n.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(_n(e)),t.y=t.y.scale(wn(e)),t}return t.x=t.x.scale(e.width),t.y=t.y.scale(e.height),t}reBound(e){const t=this.copy();return t.x=this.x.reBound(_n(e)),t.y=this.y.reBound(wn(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(_n(e)),t.y=this.y.clamp(wn(e)),t}copy(){const e=new Fe;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}box(e){return ts(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};b(ws,"IDENTITY",new ws);const Ea=(r,e)=>{const t=new ke(e);if(![_e.DAY,_e.HOUR,_e.MINUTE,_e.SECOND,_e.MILLISECOND,_e.MICROSECOND,_e.NANOSECOND].some(s=>s.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof ke?new ke(n):new _e(n)},ee=class z extends Number{constructor(e,t="UTC"){if(e==null)return z.now();if(e instanceof Date)super(e.getTime()*z.MILLISECOND.valueOf());else if(typeof e=="string")super(z.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(z.parseDate(e));else{let n=0;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=z.utcOffset.valueOf()),super(e.valueOf()+n)}}static parseDate([e=1970,t=1,n=1]){const s=new Date(e,t-1,n,0,0,0,0);return new z(s.getTime()*z.MILLISECOND.valueOf()).truncate(z.DAY).valueOf()}static parseTimeString(e,t="UTC"){const[n,s,a]=e.split(":");let i="00",o="00";a!=null&&([i,o]=a.split("."));let l=z.hours(parseInt(n??"00",10)).add(z.minutes(parseInt(s??"00",10))).add(z.seconds(parseInt(i??"00",10))).add(z.milliseconds(parseInt(o??"00",10)));return t==="local"&&(l=l.add(z.utcOffset)),l.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return z.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new z(n.getTime()*z.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString(t);case"preciseDate":return`${this.dateString(t)} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString(t)} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(z.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(e="UTC"){const t=this.date(),n=t.toLocaleString("default",{month:"short"}),s=t.toLocaleString("default",{day:"numeric"});return`${n} ${s}`}static get utcOffset(){return new _e(new Date().getTimezoneOffset()*z.MINUTE.valueOf())}static since(e){return new z().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new z(e).valueOf()}span(e){return this.range(e).span}range(e){return new Jo(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0}after(e){return this.valueOf()>new z(e).valueOf()}afterEq(e){return this.valueOf()>=new z(e).valueOf()}before(e){return this.valueOf()<new z(e).valueOf()}beforeEq(e){return this.valueOf()<=new z(e).valueOf()}add(e){return new z(this.valueOf()+e.valueOf())}sub(e){return new z(this.valueOf()-e.valueOf())}milliseconds(){return this.valueOf()/z.MILLISECOND.valueOf()}toString(){return this.date().toISOString()}remainder(e){return Ea(this,e)}get isToday(){return this.truncate(_e.DAY).equals(z.now().truncate(_e.DAY))}truncate(e){return this.sub(this.remainder(e))}get bigInt(){return BigInt(this.valueOf())}static now(){return new z(new Date)}static nanoseconds(e){return new z(e)}static microseconds(e){return z.nanoseconds(e*1e3)}static milliseconds(e){return z.microseconds(e*1e3)}static seconds(e){return z.milliseconds(e*1e3)}static minutes(e){return z.seconds(e*60)}static hours(e){return z.minutes(e*60)}static days(e){return z.hours(e*24)}};b(ee,"NANOSECOND",ee.nanoseconds(1));b(ee,"MICROSECOND",ee.microseconds(1));b(ee,"MILLISECOND",ee.milliseconds(1));b(ee,"SECOND",ee.seconds(1));b(ee,"MINUTE",ee.minutes(1));b(ee,"HOUR",ee.hours(1));b(ee,"DAY",ee.days(1));b(ee,"MAX",new ee(9122272036554776e3));b(ee,"MIN",new ee(0));b(ee,"ZERO",new ee(0));b(ee,"z",y.union([y.instanceof(Number).transform(r=>new ee(r)),y.number().transform(r=>new ee(r)),y.instanceof(ee)]));let ke=ee;const Q=class W extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}lessThan(e){return this.valueOf()<new W(e).valueOf()}greaterThan(e){return this.valueOf()>new W(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new W(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new W(e).valueOf()}remainder(e){return Ea(this,e)}truncate(e){return new W(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}multiply(e){return new W(this.valueOf()*e)}toString(){const e=this.truncate(W.DAY),t=this.truncate(W.HOUR),n=this.truncate(W.MINUTE),s=this.truncate(W.SECOND),a=this.truncate(W.MILLISECOND),i=this.truncate(W.MICROSECOND),o=this.truncate(W.NANOSECOND),l=e,u=t.sub(e),p=n.sub(t),N=s.sub(n),ue=a.sub(s),J=i.sub(a),pe=o.sub(i);let se="";return l.isZero||(se+=`${l.days}d `),u.isZero||(se+=`${u.hours}h `),p.isZero||(se+=`${p.minutes}m `),N.isZero||(se+=`${N.seconds}s `),ue.isZero||(se+=`${ue.milliseconds}ms `),J.isZero||(se+=`${J.microseconds}µs `),pe.isZero||(se+=`${pe.nanoseconds}ns`),se.trim()}get days(){return this.valueOf()/W.DAY.valueOf()}get hours(){return this.valueOf()/W.HOUR.valueOf()}get minutes(){return this.valueOf()/W.MINUTE.valueOf()}get seconds(){return this.valueOf()/W.SECOND.valueOf()}get milliseconds(){return this.valueOf()/W.MILLISECOND.valueOf()}get microseconds(){return this.valueOf()/W.MICROSECOND.valueOf()}get nanoseconds(){return this.valueOf()}get isZero(){return this.valueOf()===0}equals(e){return this.valueOf()===new W(e).valueOf()}add(e){return new W(this.valueOf()+new W(e).valueOf())}sub(e){return new W(this.valueOf()-new W(e).valueOf())}static nanoseconds(e=1){return new W(e)}static microseconds(e=1){return W.nanoseconds(e*1e3)}static milliseconds(e=1){return W.microseconds(e*1e3)}static seconds(e=1){return W.milliseconds(e*1e3)}static minutes(e){return W.seconds(e.valueOf()*60)}static hours(e){return W.minutes(e*60)}static days(e){return W.hours(e*24)}};b(Q,"NANOSECOND",Q.nanoseconds(1));b(Q,"MICROSECOND",Q.microseconds(1));b(Q,"MILLISECOND",Q.milliseconds(1));b(Q,"SECOND",Q.seconds(1));b(Q,"MINUTE",Q.minutes(1));b(Q,"HOUR",Q.hours(1));b(Q,"DAY",Q.days(1));b(Q,"MAX",new Q(Q.MAX_SAFE_INTEGER));b(Q,"MIN",new Q(-Q.MAX_SAFE_INTEGER));b(Q,"ZERO",new Q(0));b(Q,"z",y.union([y.instanceof(Number).transform(r=>new Q(r)),y.number().transform(r=>new Q(r)),y.instanceof(Q)]));let _e=Q;const vr=class Ar extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Ar(e).valueOf()}get period(){return _e.seconds(1/this.valueOf())}sampleCount(e){return new _e(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new ve(t).valueOf()}span(e){return _e.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Ar(e)}static khz(e){return Ar.hz(e*1e3)}};b(vr,"z",y.union([y.number().transform(r=>new vr(r)),y.instanceof(Number).transform(r=>new vr(r)),y.instanceof(vr)]));const he=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Ho(e*this.valueOf())}};b(he,"UNKNOWN",new he(0));b(he,"BIT128",new he(16));b(he,"BIT64",new he(8));b(he,"BIT32",new he(4));b(he,"BIT16",new he(2));b(he,"BIT8",new he(1));b(he,"z",y.union([y.number().transform(r=>new he(r)),y.instanceof(Number).transform(r=>new he(r)),y.instanceof(he)]));let ve=he;const Ue=class Cr{constructor(e,t){b(this,"start"),b(this,"end"),this.start=new ke(e),this.end=new ke(t)}get span(){return new _e(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}swap(){return new Cr(this.end,this.start)}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e){e=e.makeValid();const t=this.makeValid();return e.start.equals(t.start)?!0:e.end.equals(this.start)||e.start.equals(this.end)?!1:this.contains(e.end)||this.contains(e.start)||e.contains(this.start)||e.contains(this.end)}contains(e){return e instanceof Cr?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new Cr(this.start,this.end);return e.start.after(this.start)&&(t.start=e.start),e.start.after(this.end)&&(t.end=e.start),e.end.before(this.end)&&(t.end=e.end),e.end.before(this.start)&&(t.start=e.end),t}};b(Ue,"MAX",new Ue(ke.MIN,ke.MAX));b(Ue,"MIN",new Ue(ke.MAX,ke.MIN));b(Ue,"ZERO",new Ue(ke.ZERO,ke.ZERO));b(Ue,"z",y.union([y.object({start:ke.z,end:ke.z}).transform(r=>new Ue(r.start,r.end)),y.instanceof(Ue)]));let Jo=Ue;const m=class ht extends String{constructor(e){if(e instanceof ht||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const t=ht.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}}throw super(ht.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=ht.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}toString(){return this.valueOf()}get density(){const e=ht.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}checkArray(e){return e.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return ht.BIG_INT_TYPES.some(e=>e.equals(this))}};b(m,"UNKNOWN",new m("unknown"));b(m,"FLOAT64",new m("float64"));b(m,"FLOAT32",new m("float32"));b(m,"INT64",new m("int64"));b(m,"INT32",new m("int32"));b(m,"INT16",new m("int16"));b(m,"INT8",new m("int8"));b(m,"UINT64",new m("uint64"));b(m,"UINT32",new m("uint32"));b(m,"UINT16",new m("uint16"));b(m,"UINT8",new m("uint8"));b(m,"TIMESTAMP",new m("timestamp"));b(m,"UUID",new m("uuid"));b(m,"STRING",new m("string"));b(m,"JSON",new m("json"));b(m,"ARRAY_CONSTRUCTORS",new Map([[m.UINT8.toString(),Uint8Array],[m.UINT16.toString(),Uint16Array],[m.UINT32.toString(),Uint32Array],[m.UINT64.toString(),BigUint64Array],[m.FLOAT32.toString(),Float32Array],[m.FLOAT64.toString(),Float64Array],[m.INT8.toString(),Int8Array],[m.INT16.toString(),Int16Array],[m.INT32.toString(),Int32Array],[m.INT64.toString(),BigInt64Array],[m.TIMESTAMP.toString(),BigInt64Array],[m.STRING.toString(),Uint8Array],[m.JSON.toString(),Uint8Array],[m.UUID.toString(),Uint8Array]]));b(m,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,m.UINT8],[Uint16Array.name,m.UINT16],[Uint32Array.name,m.UINT32],[BigUint64Array.name,m.UINT64],[Float32Array.name,m.FLOAT32],[Float64Array.name,m.FLOAT64],[Int8Array.name,m.INT8],[Int16Array.name,m.INT16],[Int32Array.name,m.INT32],[BigInt64Array.name,m.INT64]]));b(m,"DENSITIES",new Map([[m.UINT8.toString(),ve.BIT8],[m.UINT16.toString(),ve.BIT16],[m.UINT32.toString(),ve.BIT32],[m.UINT64.toString(),ve.BIT64],[m.FLOAT32.toString(),ve.BIT32],[m.FLOAT64.toString(),ve.BIT64],[m.INT8.toString(),ve.BIT8],[m.INT16.toString(),ve.BIT16],[m.INT32.toString(),ve.BIT32],[m.INT64.toString(),ve.BIT64],[m.TIMESTAMP.toString(),ve.BIT64],[m.STRING.toString(),ve.UNKNOWN],[m.JSON.toString(),ve.UNKNOWN],[m.UUID.toString(),ve.BIT128]]));b(m,"ALL",[m.UNKNOWN,m.FLOAT64,m.FLOAT32,m.INT64,m.INT32,m.INT16,m.INT8,m.UINT64,m.UINT32,m.UINT16,m.UINT8,m.TIMESTAMP,m.UUID,m.STRING,m.JSON]);b(m,"BIG_INT_TYPES",[m.INT64,m.UINT64,m.TIMESTAMP]);b(m,"z",y.union([y.string().transform(r=>new m(r)),y.instanceof(m)]));const me=class le extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return le.bytes(this.valueOf()+e.valueOf())}sub(e){return le.bytes(this.valueOf()-e.valueOf())}truncate(e){return new le(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return le.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/le.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/le.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/le.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/le.TERABYTE.valueOf()}toString(){const e=this.truncate(le.TERABYTE),t=this.truncate(le.GIGABYTE),n=this.truncate(le.MEGABYTE),s=this.truncate(le.KILOBYTE),a=this.truncate(le.BYTE),i=e,o=t.sub(e),l=n.sub(t),u=s.sub(n),p=a.sub(s);let N="";return i.isZero||(N+=`${i.terabytes}TB `),o.isZero||(N+=`${o.gigabytes}GB `),l.isZero||(N+=`${l.megabytes}MB `),u.isZero||(N+=`${u.kilobytes}KB `),(!p.isZero||N==="")&&(N+=`${p.valueOf()}B`),N.trim()}static bytes(e=1){return new le(e)}static kilobytes(e=1){return le.bytes(e.valueOf()*1e3)}static megabytes(e=1){return le.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return le.megabytes(e.valueOf()*1e3)}static terabytes(e){return le.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};b(me,"BYTE",new me(1));b(me,"KILOBYTE",me.kilobytes(1));b(me,"MEGABYTE",me.megabytes(1));b(me,"GIGABYTE",me.gigabytes(1));b(me,"TERABYTE",me.terabytes(1));b(me,"ZERO",new me(0));b(me,"z",y.union([y.number().transform(r=>new me(r)),y.instanceof(me)]));let Ho=me;y.union([y.instanceof(Uint8Array),y.instanceof(Uint16Array),y.instanceof(Uint32Array),y.instanceof(BigUint64Array),y.instanceof(Float32Array),y.instanceof(Float64Array),y.instanceof(Int8Array),y.instanceof(Int16Array),y.instanceof(Int32Array),y.instanceof(BigInt64Array)]);y.record(y.union([y.number(),y.string(),y.symbol()]),y.unknown());const Na=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Xo=Na(),Ia=["MacOS","Windows","Linux","Docker"],Qo=y.enum(Ia);let _r;const ec=()=>{if(typeof window>"u")return;const r=window.navigator.userAgent.toLowerCase();if(r.includes("mac"))return"MacOS";if(r.includes("win"))return"Windows";if(r.includes("linux"))return"Linux"},tc=(r={})=>{const{force:e,default:t}=r;return e??_r??(_r=ec(),_r??t)},Za=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:Ia,RUNTIME:Xo,detect:Na,getOS:tc,osZ:Qo},Symbol.toStringTag,{value:"Module"})),rc=(...r)=>r.map(Aa).join(""),Aa=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),nc=r=>r.endsWith("/")?r.slice(0,-1):r,sc=(r,e="")=>r===null?"":"?"+Object.entries(r).filter(([,t])=>t==null?!1:Array.isArray(t)?t.length>0:!0).map(([t,n])=>`${e}${t}=${n}`).join("&");let ac=(xt=class{constructor({host:r,port:e,protocol:t="",pathPrefix:n=""}){b(this,"protocol"),b(this,"host"),b(this,"port"),b(this,"path"),this.protocol=t,this.host=r,this.port=e,this.path=Aa(n)}replace(r){return new xt({host:r.host??this.host,port:r.port??this.port,protocol:r.protocol??this.protocol,pathPrefix:r.pathPrefix??this.path})}child(r){return new xt({...this,pathPrefix:rc(this.path,r)})}toString(){return nc(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}},b(xt,"UNKNOWN",new xt({host:"unknown",port:0})),xt);var Rn;try{Rn=new TextDecoder}catch{}var x,Se,c=0,te={},K,at,Oe=0,Me=0,fe,He,be=[],Y,bs={useRecords:!1,mapsAsObjects:!0};class Ca{}const Ra=new Ca;Ra.name="MessagePack 0xC1";var it=!1,ja=2,xs;try{new Function("")}catch{ja=1/0}class Jt{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=!1&&(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(x)return Da(()=>($n(),this?this.unpack(e,t):Jt.prototype.unpack.call(bs,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(Se=t.end||e.length,c=t.start||0):(c=0,Se=t>-1?t:e.length),Me=0,at=null,fe=null,x=e;try{Y=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw x=null,e instanceof Uint8Array?n:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Jt){if(te=this,this.structures)return K=this.structures,wr(t);(!K||K.length>0)&&(K=[])}else te=bs,(!K||K.length>0)&&(K=[]);return wr(t)}unpackMultiple(e,t){let n,s=0;try{it=!0;let a=e.length,i=this?this.unpack(e,a):un.unpack(e,a);if(t){if(t(i,s,c)===!1)return;for(;c<a;)if(s=c,t(wr(),s,c)===!1)return}else{for(n=[i];c<a;)s=c,n.push(wr());return n}}catch(a){throw a.lastPosition=s,a.values=n,a}finally{it=!1,$n()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(n=>n.slice(0)));for(let n=0,s=e.length;n<s;n++){let a=e[n];a&&(a.isShared=!0,n>=32&&(a.highByte=n-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let s=e[n],a=t[n];a&&(s&&((e.restoreStructures||(e.restoreStructures=[]))[n]=s),e[n]=a)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function wr(r){try{if(!te.trusted&&!it){let t=K.sharedLength||0;t<K.length&&(K.length=t)}let e;if(te.randomAccessStructure&&x[c]<64&&x[c]>=32&&xs?(e=xs(x,c,Se,te),x=null,!(r&&r.lazy)&&e&&(e=e.toJSON()),c=Se):e=oe(),fe&&(c=fe.postBundlePosition,fe=null),it&&(K.restoreStructures=null),c==Se)K&&K.restoreStructures&&Ts(),K=null,x=null,He&&(He=null);else{if(c>Se)throw new Error("Unexpected end of MessagePack data");if(!it){let t;try{t=JSON.stringify(e,(n,s)=>typeof s=="bigint"?`${s}n`:s).slice(0,100)}catch(n){t="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+t)}}return e}catch(e){throw K&&K.restoreStructures&&Ts(),$n(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||c>Se)&&(e.incomplete=!0),e}}function Ts(){for(let r in K.restoreStructures)K[r]=K.restoreStructures[r];K.restoreStructures=null}function oe(){let r=x[c++];if(r<160)if(r<128){if(r<64)return r;{let e=K[r&63]||te.getStructures&&$a()[r&63];return e?(e.read||(e.read=rs(e,r&63)),e.read()):r}}else if(r<144)if(r-=128,te.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=Ua();n==="__proto__"&&(n="__proto_"),e[n]=oe()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(oe(),oe());return e}else{r-=144;let e=new Array(r);for(let t=0;t<r;t++)e[t]=oe();return te.freezeData?Object.freeze(e):e}else if(r<192){let e=r-160;if(Me>=c)return at.slice(c-Oe,(c+=e)-Oe);if(Me==0&&Se<140){let t=e<16?ns(e):Ma(e);if(t!=null)return t}return jn(e)}else{let e;switch(r){case 192:return null;case 193:return fe?(e=oe(),e>0?fe[1].slice(fe.position1,fe.position1+=e):fe[0].slice(fe.position0,fe.position0-=e)):Ra;case 194:return!1;case 195:return!0;case 196:if(e=x[c++],e===void 0)throw new Error("Unexpected end of buffer");return bn(e);case 197:return e=Y.getUint16(c),c+=2,bn(e);case 198:return e=Y.getUint32(c),c+=4,bn(e);case 199:return ft(x[c++]);case 200:return e=Y.getUint16(c),c+=2,ft(e);case 201:return e=Y.getUint32(c),c+=4,ft(e);case 202:if(e=Y.getFloat32(c),te.useFloat32>2){let t=ss[(x[c]&127)<<1|x[c+1]>>7];return c+=4,(t*e+(e>0?.5:-.5)>>0)/t}return c+=4,e;case 203:return e=Y.getFloat64(c),c+=8,e;case 204:return x[c++];case 205:return e=Y.getUint16(c),c+=2,e;case 206:return e=Y.getUint32(c),c+=4,e;case 207:return te.int64AsType==="number"?(e=Y.getUint32(c)*4294967296,e+=Y.getUint32(c+4)):te.int64AsType==="string"?e=Y.getBigUint64(c).toString():te.int64AsType==="auto"?(e=Y.getBigUint64(c),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=Y.getBigUint64(c),c+=8,e;case 208:return Y.getInt8(c++);case 209:return e=Y.getInt16(c),c+=2,e;case 210:return e=Y.getInt32(c),c+=4,e;case 211:return te.int64AsType==="number"?(e=Y.getInt32(c)*4294967296,e+=Y.getUint32(c+4)):te.int64AsType==="string"?e=Y.getBigInt64(c).toString():te.int64AsType==="auto"?(e=Y.getBigInt64(c),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=Y.getBigInt64(c),c+=8,e;case 212:if(e=x[c++],e==114)return Is(x[c++]&63);{let t=be[e];if(t)return t.read?(c++,t.read(oe())):t.noBuffer?(c++,t()):t(x.subarray(c,++c));throw new Error("Unknown extension "+e)}case 213:return e=x[c],e==114?(c++,Is(x[c++]&63,x[c++])):ft(2);case 214:return ft(4);case 215:return ft(8);case 216:return ft(16);case 217:return e=x[c++],Me>=c?at.slice(c-Oe,(c+=e)-Oe):oc(e);case 218:return e=Y.getUint16(c),c+=2,Me>=c?at.slice(c-Oe,(c+=e)-Oe):cc(e);case 219:return e=Y.getUint32(c),c+=4,Me>=c?at.slice(c-Oe,(c+=e)-Oe):uc(e);case 220:return e=Y.getUint16(c),c+=2,Os(e);case 221:return e=Y.getUint32(c),c+=4,Os(e);case 222:return e=Y.getUint16(c),c+=2,Ss(e);case 223:return e=Y.getUint32(c),c+=4,Ss(e);default:if(r>=224)return r-256;if(r===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+r)}}}const ic=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function rs(r,e){function t(){if(t.count++>ja){let s=r.read=new Function("r","return function(){return "+(te.freezeData?"Object.freeze":"")+"({"+r.map(a=>a==="__proto__"?"__proto_:r()":ic.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(oe);return r.highByte===0&&(r.read=ks(e,r.read)),s()}let n={};for(let s=0,a=r.length;s<a;s++){let i=r[s];i==="__proto__"&&(i="__proto_"),n[i]=oe()}return te.freezeData?Object.freeze(n):n}return t.count=0,r.highByte===0?ks(e,t):t}const ks=(r,e)=>function(){let t=x[c++];if(t===0)return e();let n=r<32?-(r+(t<<5)):r+(t<<5),s=K[n]||$a()[n];if(!s)throw new Error("Record id is not defined for "+n);return s.read||(s.read=rs(s,r)),s.read()};function $a(){let r=Da(()=>(x=null,te.getStructures()));return K=te._mergeStructures(r,K)}var jn=fr,oc=fr,cc=fr,uc=fr;function fr(r){let e;if(r<16&&(e=ns(r)))return e;if(r>64&&Rn)return Rn.decode(x.subarray(c,c+=r));const t=c+r,n=[];for(e="";c<t;){const s=x[c++];if(!(s&128))n.push(s);else if((s&224)===192){const a=x[c++]&63;n.push((s&31)<<6|a)}else if((s&240)===224){const a=x[c++]&63,i=x[c++]&63;n.push((s&31)<<12|a<<6|i)}else if((s&248)===240){const a=x[c++]&63,i=x[c++]&63,o=x[c++]&63;let l=(s&7)<<18|a<<12|i<<6|o;l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|l&1023),n.push(l)}else n.push(s);n.length>=4096&&(e+=de.apply(String,n),n.length=0)}return n.length>0&&(e+=de.apply(String,n)),e}function Os(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=oe();return te.freezeData?Object.freeze(e):e}function Ss(r){if(te.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=Ua();n==="__proto__"&&(n="__proto_"),e[n]=oe()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(oe(),oe());return e}}var de=String.fromCharCode;function Ma(r){let e=c,t=new Array(r);for(let n=0;n<r;n++){const s=x[c++];if((s&128)>0){c=e;return}t[n]=s}return de.apply(String,t)}function ns(r){if(r<4)if(r<2){if(r===0)return"";{let e=x[c++];if((e&128)>1){c-=1;return}return de(e)}}else{let e=x[c++],t=x[c++];if((e&128)>0||(t&128)>0){c-=2;return}if(r<3)return de(e,t);let n=x[c++];if((n&128)>0){c-=3;return}return de(e,t,n)}else{let e=x[c++],t=x[c++],n=x[c++],s=x[c++];if((e&128)>0||(t&128)>0||(n&128)>0||(s&128)>0){c-=4;return}if(r<6){if(r===4)return de(e,t,n,s);{let a=x[c++];if((a&128)>0){c-=5;return}return de(e,t,n,s,a)}}else if(r<8){let a=x[c++],i=x[c++];if((a&128)>0||(i&128)>0){c-=6;return}if(r<7)return de(e,t,n,s,a,i);let o=x[c++];if((o&128)>0){c-=7;return}return de(e,t,n,s,a,i,o)}else{let a=x[c++],i=x[c++],o=x[c++],l=x[c++];if((a&128)>0||(i&128)>0||(o&128)>0||(l&128)>0){c-=8;return}if(r<10){if(r===8)return de(e,t,n,s,a,i,o,l);{let u=x[c++];if((u&128)>0){c-=9;return}return de(e,t,n,s,a,i,o,l,u)}}else if(r<12){let u=x[c++],p=x[c++];if((u&128)>0||(p&128)>0){c-=10;return}if(r<11)return de(e,t,n,s,a,i,o,l,u,p);let N=x[c++];if((N&128)>0){c-=11;return}return de(e,t,n,s,a,i,o,l,u,p,N)}else{let u=x[c++],p=x[c++],N=x[c++],ue=x[c++];if((u&128)>0||(p&128)>0||(N&128)>0||(ue&128)>0){c-=12;return}if(r<14){if(r===12)return de(e,t,n,s,a,i,o,l,u,p,N,ue);{let J=x[c++];if((J&128)>0){c-=13;return}return de(e,t,n,s,a,i,o,l,u,p,N,ue,J)}}else{let J=x[c++],pe=x[c++];if((J&128)>0||(pe&128)>0){c-=14;return}if(r<15)return de(e,t,n,s,a,i,o,l,u,p,N,ue,J,pe);let se=x[c++];if((se&128)>0){c-=15;return}return de(e,t,n,s,a,i,o,l,u,p,N,ue,J,pe,se)}}}}}function Es(){let r=x[c++],e;if(r<192)e=r-160;else switch(r){case 217:e=x[c++];break;case 218:e=Y.getUint16(c),c+=2;break;case 219:e=Y.getUint32(c),c+=4;break;default:throw new Error("Expected string")}return fr(e)}function bn(r){return te.copyBuffers?Uint8Array.prototype.slice.call(x,c,c+=r):x.subarray(c,c+=r)}function ft(r){let e=x[c++];if(be[e]){let t;return be[e](x.subarray(c,t=c+=r),n=>{c=n;try{return oe()}finally{c=t}})}else throw new Error("Unknown extension type "+e)}var Ns=new Array(4096);function Ua(){let r=x[c++];if(r>=160&&r<192){if(r=r-160,Me>=c)return at.slice(c-Oe,(c+=r)-Oe);if(!(Me==0&&Se<180))return jn(r)}else return c--,oe().toString();let e=(r<<5^(r>1?Y.getUint16(c):r>0?x[c]:0))&4095,t=Ns[e],n=c,s=c+r-3,a,i=0;if(t&&t.bytes==r){for(;n<s;){if(a=Y.getUint32(n),a!=t[i++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(a=x[n++],a!=t[i++]){n=1879048192;break}if(n===s)return c=n,t.string;s-=3,n=c}for(t=[],Ns[e]=t,t.bytes=r;n<s;)a=Y.getUint32(n),t.push(a),n+=4;for(s+=3;n<s;)a=x[n++],t.push(a);let o=r<16?ns(r):Ma(r);return o!=null?t.string=o:t.string=jn(r)}const Is=(r,e)=>{let t=oe().map(a=>a.toString()),n=r;e!==void 0&&(r=r<32?-((e<<5)+r):(e<<5)+r,t.highByte=e);let s=K[r];return s&&(s.isShared||it)&&((K.restoreStructures||(K.restoreStructures=[]))[r]=s),K[r]=t,t.read=rs(t,n),t.read()};be[0]=()=>{};be[0].noBuffer=!0;let lc={Error,TypeError,ReferenceError};be[101]=()=>{let r=oe();return(lc[r[0]]||Error)(r[1])};be[105]=r=>{let e=Y.getUint32(c-4);He||(He=new Map);let t=x[c],n;t>=144&&t<160||t==220||t==221?n=[]:n={};let s={target:n};He.set(e,s);let a=oe();return s.used?Object.assign(n,a):(s.target=a,a)};be[112]=r=>{let e=Y.getUint32(c-4),t=He.get(e);return t.used=!0,t.target};be[115]=()=>new Set(oe());const Pa=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(r=>r+"Array");let dc=typeof globalThis=="object"?globalThis:window;be[116]=r=>{let e=r[0],t=Pa[e];if(!t)throw new Error("Could not find typed array for code "+e);return new dc[t](Uint8Array.prototype.slice.call(r,1).buffer)};be[120]=()=>{let r=oe();return new RegExp(r[0],r[1])};const fc=[];be[98]=r=>{let e=(r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3],t=c;return c+=e-r.length,fe=fc,fe=[Es(),Es()],fe.position0=0,fe.position1=0,fe.postBundlePosition=c,c=t,oe()};be[255]=r=>r.length==4?new Date((r[0]*16777216+(r[1]<<16)+(r[2]<<8)+r[3])*1e3):r.length==8?new Date(((r[0]<<22)+(r[1]<<14)+(r[2]<<6)+(r[3]>>2))/1e6+((r[3]&3)*4294967296+r[4]*16777216+(r[5]<<16)+(r[6]<<8)+r[7])*1e3):r.length==12?new Date(((r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3])/1e6+((r[4]&128?-281474976710656:0)+r[6]*1099511627776+r[7]*4294967296+r[8]*16777216+(r[9]<<16)+(r[10]<<8)+r[11])*1e3):new Date("invalid");function Da(r){let e=Se,t=c,n=Oe,s=Me,a=at,i=He,o=fe,l=new Uint8Array(x.slice(0,Se)),u=K,p=K.slice(0,K.length),N=te,ue=it,J=r();return Se=e,c=t,Oe=n,Me=s,at=a,He=i,fe=o,x=l,it=ue,K=u,K.splice(0,K.length,...p),te=N,Y=new DataView(x.buffer,x.byteOffset,x.byteLength),J}function $n(){x=null,He=null,K=null}function hc(r){r.unpack?be[r.type]=r.unpack:be[r.type]=r}const ss=new Array(147);for(let r=0;r<256;r++)ss[r]=+("1e"+Math.floor(45.15-r*.30103));var un=new Jt({useRecords:!1});const pc=un.unpack;un.unpackMultiple;un.unpack;let mc=new Float32Array(1);new Uint8Array(mc.buffer,0,4);let Rr;try{Rr=new TextEncoder}catch{}let Wr,as;const ln=typeof Buffer<"u",br=ln?function(r){return Buffer.allocUnsafeSlow(r)}:Uint8Array,La=ln?Buffer:Uint8Array,Zs=ln?4294967296:2144337920;let f,Rt,X,d=0,ge,re=null,yc;const gc=21760,vc=/[\u0080-\uFFFF]/,Tt=Symbol("record-id");class _c extends Jt{constructor(e){super(e),this.offset=0;let t,n,s,a,i=La.prototype.utf8Write?function(h,I){return f.utf8Write(h,I,4294967295)}:Rr&&Rr.encodeInto?function(h,I){return Rr.encodeInto(h,f.subarray(I)).written}:!1,o=this;e||(e={});let l=e&&e.sequential,u=e.structures||e.saveStructures,p=e.maxSharedStructures;if(p==null&&(p=u?32:0),p>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let N=e.maxOwnStructures;N==null&&(N=u?32:64),!this.structures&&e.useRecords!=!1&&(this.structures=[]);let ue=p>32||N+p>64,J=p+64,pe=p+N+64;if(pe>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let se=[],pn=0,mr=0;this.pack=this.encode=function(h,I){if(f||(f=new br(8192),X=f.dataView||(f.dataView=new DataView(f.buffer,0,8192)),d=0),ge=f.length-10,ge-d<2048?(f=new br(f.length),X=f.dataView||(f.dataView=new DataView(f.buffer,0,f.length)),ge=f.length-10,d=0):d=d+7&2147483640,t=d,I&Ec&&(d+=I&255),a=o.structuredClone?new Map:null,o.bundleStrings&&typeof h!="string"?(re=[],re.size=1/0):re=null,s=o.structures,s){s.uninitialized&&(s=o._mergeStructures(o.getStructures()));let g=s.sharedLength||0;if(g>p)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+s.sharedLength);if(!s.transitions){s.transitions=Object.create(null);for(let w=0;w<g;w++){let T=s[w];if(!T)continue;let B,V=s.transitions;for(let j=0,ie=T.length;j<ie;j++){let H=T[j];B=V[H],B||(B=V[H]=Object.create(null)),V=B}V[Tt]=w+64}this.lastNamedStructuresLength=g}l||(s.nextId=g+64)}n&&(n=!1);try{o.randomAccessStructure&&h&&h.constructor&&h.constructor===Object?Qa(h):ae(h);let g=re;if(re&&Rs(t,ae,0),a&&a.idsToInsert){let w=a.idsToInsert.sort((j,ie)=>j.offset>ie.offset?1:-1),T=w.length,B=-1;for(;g&&T>0;){let j=w[--T].offset+t;j<g.stringsPosition+t&&B===-1&&(B=0),j>g.position+t?B>=0&&(B+=6):(B>=0&&(X.setUint32(g.position+t,X.getUint32(g.position+t)+B),B=-1),g=g.previous,T++)}B>=0&&g&&X.setUint32(g.position+t,X.getUint32(g.position+t)+B),d+=w.length*6,d>ge&&tt(d),o.offset=d;let V=bc(f.subarray(t,d),w);return a=null,V}return o.offset=d,I&Oc?(f.start=t,f.end=d,f):f.subarray(t,d)}finally{if(s&&(us(),n&&o.saveStructures)){let g=s.sharedLength||0,w=f.subarray(t,d),T=Tc(s,o);return o.saveStructures(T,T.isCompatible)===!1?o.pack(h,I):(o.lastNamedStructuresLength=g,w)}I&Sc&&(d=t)}};const us=()=>{mr<10&&mr++;let h=s.sharedLength||0;if(s.length>h&&!l&&(s.length=h),pn>1e4)s.transitions=null,mr=0,pn=0,se.length>0&&(se=[]);else if(se.length>0&&!l){for(let I=0,g=se.length;I<g;I++)se[I][Tt]=0;se=[]}},mn=h=>{var I=h.length;I<16?f[d++]=144|I:I<65536?(f[d++]=220,f[d++]=I>>8,f[d++]=I&255):(f[d++]=221,X.setUint32(d,I),d+=4);for(let g=0;g<I;g++)ae(h[g])},ae=h=>{d>ge&&(f=tt(d));var I=typeof h,g;if(I==="string"){let w=h.length;if(re&&w>=4&&w<4096){if((re.size+=w)>gc){let j,ie=(re[0]?re[0].length*3+re[1].length:0)+10;d+ie>ge&&(f=tt(d+ie));let H;re.position?(H=re,f[d]=200,d+=3,f[d++]=98,j=d-t,d+=4,Rs(t,ae,0),X.setUint16(j+t-3,d-t-j)):(f[d++]=214,f[d++]=98,j=d-t,d+=4),re=["",""],re.previous=H,re.size=0,re.position=j}let V=vc.test(h);re[V?0:1]+=h,f[d++]=193,ae(V?-w:w);return}let T;w<32?T=1:w<256?T=2:w<65536?T=3:T=5;let B=w*3;if(d+B>ge&&(f=tt(d+B)),w<64||!i){let V,j,ie,H=d+T;for(V=0;V<w;V++)j=h.charCodeAt(V),j<128?f[H++]=j:j<2048?(f[H++]=j>>6|192,f[H++]=j&63|128):(j&64512)===55296&&((ie=h.charCodeAt(V+1))&64512)===56320?(j=65536+((j&1023)<<10)+(ie&1023),V++,f[H++]=j>>18|240,f[H++]=j>>12&63|128,f[H++]=j>>6&63|128,f[H++]=j&63|128):(f[H++]=j>>12|224,f[H++]=j>>6&63|128,f[H++]=j&63|128);g=H-d-T}else g=i(h,d+T);g<32?f[d++]=160|g:g<256?(T<2&&f.copyWithin(d+2,d+1,d+1+g),f[d++]=217,f[d++]=g):g<65536?(T<3&&f.copyWithin(d+3,d+2,d+2+g),f[d++]=218,f[d++]=g>>8,f[d++]=g&255):(T<5&&f.copyWithin(d+5,d+3,d+3+g),f[d++]=219,X.setUint32(d,g),d+=4),d+=g}else if(I==="number")if(h>>>0===h)h<32||h<128&&this.useRecords===!1||h<64&&!this.randomAccessStructure?f[d++]=h:h<256?(f[d++]=204,f[d++]=h):h<65536?(f[d++]=205,f[d++]=h>>8,f[d++]=h&255):(f[d++]=206,X.setUint32(d,h),d+=4);else if(h>>0===h)h>=-32?f[d++]=256+h:h>=-128?(f[d++]=208,f[d++]=h+256):h>=-32768?(f[d++]=209,X.setInt16(d,h),d+=2):(f[d++]=210,X.setInt32(d,h),d+=4);else{let w;if((w=this.useFloat32)>0&&h<4294967296&&h>=-2147483648){f[d++]=202,X.setFloat32(d,h);let T;if(w<4||(T=h*ss[(f[d]&127)<<1|f[d+1]>>7])>>0===T){d+=4;return}else d--}f[d++]=203,X.setFloat64(d,h),d+=8}else if(I==="object"||I==="function")if(!h)f[d++]=192;else{if(a){let T=a.get(h);if(T){if(!T.id){let B=a.idsToInsert||(a.idsToInsert=[]);T.id=B.push(T)}f[d++]=214,f[d++]=112,X.setUint32(d,T.id),d+=4;return}else a.set(h,{offset:d-t})}let w=h.constructor;if(w===Object)yr(h,!0);else if(w===Array)mn(h);else if(w===Map)if(this.mapAsEmptyObject)f[d++]=128;else{g=h.size,g<16?f[d++]=128|g:g<65536?(f[d++]=222,f[d++]=g>>8,f[d++]=g&255):(f[d++]=223,X.setUint32(d,g),d+=4);for(let[T,B]of h)ae(T),ae(B)}else{for(let T=0,B=Wr.length;T<B;T++){let V=as[T];if(h instanceof V){let j=Wr[T];if(j.write){j.type&&(f[d++]=212,f[d++]=j.type,f[d++]=0);let rt=j.write.call(this,h);rt===h?Array.isArray(h)?mn(h):yr(h):ae(rt);return}let ie=f,H=X,Be=d;f=null;let dt;try{dt=j.pack.call(this,h,rt=>(f=ie,ie=null,d+=rt,d>ge&&tt(d),{target:f,targetView:X,position:d-rt}),ae)}finally{ie&&(f=ie,X=H,d=Be,ge=f.length-10)}dt&&(dt.length+d>ge&&tt(dt.length+d),d=wc(dt,f,d,j.type));return}}if(Array.isArray(h))mn(h);else{if(h.toJSON){const T=h.toJSON();if(T!==h)return ae(T)}if(I==="function")return ae(this.writeFunction&&this.writeFunction(h));yr(h,!h.hasOwnProperty)}}}else if(I==="boolean")f[d++]=h?195:194;else if(I==="bigint"){if(h<BigInt(1)<<BigInt(63)&&h>=-(BigInt(1)<<BigInt(63)))f[d++]=211,X.setBigInt64(d,h);else if(h<BigInt(1)<<BigInt(64)&&h>0)f[d++]=207,X.setBigUint64(d,h);else if(this.largeBigIntToFloat)f[d++]=203,X.setFloat64(d,Number(h));else throw new RangeError(h+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");d+=8}else if(I==="undefined")this.encodeUndefinedAsNil?f[d++]=192:(f[d++]=212,f[d++]=0,f[d++]=0);else throw new Error("Unknown type: "+I)},ls=this.variableMapSize||this.coercibleKeyAsNumber?h=>{let I=Object.keys(h),g=I.length;g<16?f[d++]=128|g:g<65536?(f[d++]=222,f[d++]=g>>8,f[d++]=g&255):(f[d++]=223,X.setUint32(d,g),d+=4);let w;if(this.coercibleKeyAsNumber)for(let T=0;T<g;T++){w=I[T];let B=Number(w);ae(isNaN(B)?w:B),ae(h[w])}else for(let T=0;T<g;T++)ae(w=I[T]),ae(h[w])}:(h,I)=>{f[d++]=222;let g=d-t;d+=2;let w=0;for(let T in h)(I||h.hasOwnProperty(T))&&(ae(T),ae(h[T]),w++);f[g+++t]=w>>8,f[g+t]=w&255},ds=this.useRecords===!1?ls:e.progressiveRecords&&!ue?(h,I)=>{let g,w=s.transitions||(s.transitions=Object.create(null)),T=d++-t,B;for(let V in h)if(I||h.hasOwnProperty(V)){if(g=w[V],g)w=g;else{let j=Object.keys(h),ie=w;w=s.transitions;let H=0;for(let Be=0,dt=j.length;Be<dt;Be++){let rt=j[Be];g=w[rt],g||(g=w[rt]=Object.create(null),H++),w=g}T+t+1==d?(d--,yn(w,j,H)):hs(w,j,T,H),B=!0,w=ie[V]}ae(h[V])}if(!B){let V=w[Tt];V?f[T+t]=V:hs(w,Object.keys(h),T,0)}}:(h,I)=>{let g,w=s.transitions||(s.transitions=Object.create(null)),T=0;for(let V in h)(I||h.hasOwnProperty(V))&&(g=w[V],g||(g=w[V]=Object.create(null),T++),w=g);let B=w[Tt];B?B>=96&&ue?(f[d++]=((B-=96)&31)+96,f[d++]=B>>5):f[d++]=B:yn(w,w.__keys__||Object.keys(h),T);for(let V in h)(I||h.hasOwnProperty(V))&&ae(h[V])},fs=typeof this.useRecords=="function"&&this.useRecords,yr=fs?(h,I)=>{fs(h)?ds(h,I):ls(h,I)}:ds,tt=h=>{let I;if(h>16777216){if(h-t>Zs)throw new Error("Packed buffer would be larger than maximum buffer size");I=Math.min(Zs,Math.round(Math.max((h-t)*(h>67108864?1.25:2),4194304)/4096)*4096)}else I=(Math.max(h-t<<2,f.length-1)>>12)+1<<12;let g=new br(I);return X=g.dataView||(g.dataView=new DataView(g.buffer,0,I)),h=Math.min(h,f.length),f.copy?f.copy(g,0,t,h):g.set(f.slice(t,h)),d-=t,t=0,ge=g.length-10,f=g},yn=(h,I,g)=>{let w=s.nextId;w||(w=64),w<J&&this.shouldShareStructure&&!this.shouldShareStructure(I)?(w=s.nextOwnId,w<pe||(w=J),s.nextOwnId=w+1):(w>=pe&&(w=J),s.nextId=w+1);let T=I.highByte=w>=96&&ue?w-96>>5:-1;h[Tt]=w,h.__keys__=I,s[w-64]=I,w<J?(I.isShared=!0,s.sharedLength=w-63,n=!0,T>=0?(f[d++]=(w&31)+96,f[d++]=T):f[d++]=w):(T>=0?(f[d++]=213,f[d++]=114,f[d++]=(w&31)+96,f[d++]=T):(f[d++]=212,f[d++]=114,f[d++]=w),g&&(pn+=mr*g),se.length>=N&&(se.shift()[Tt]=0),se.push(h),ae(I))},hs=(h,I,g,w)=>{let T=f,B=d,V=ge,j=t;f=Rt,d=0,t=0,f||(Rt=f=new br(8192)),ge=f.length-10,yn(h,I,w),Rt=f;let ie=d;if(f=T,d=B,ge=V,t=j,ie>1){let H=d+ie-1;H>ge&&tt(H);let Be=g+t;f.copyWithin(Be+ie,Be+1,d),f.set(Rt.slice(0,ie),Be),d=H}else f[g+t]=Rt[0]},Qa=(h,I)=>{let g=yc(h,f,t,d,s,tt,(w,T,B)=>{if(B)return n=!0;d=T;let V=f;return ae(w),us(),V!==f?{position:d,targetView:X,target:f}:d},this);if(g===0)return yr(h,!0);d=g}}useBuffer(e){f=e,X=new DataView(f.buffer,f.byteOffset,f.byteLength),d=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}as=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Ca];Wr=[{pack(r,e,t){let n=r.getTime()/1e3;if((this.useTimestamp32||r.getMilliseconds()===0)&&n>=0&&n<4294967296){let{target:s,targetView:a,position:i}=e(6);s[i++]=214,s[i++]=255,a.setUint32(i,n)}else if(n>0&&n<4294967296){let{target:s,targetView:a,position:i}=e(10);s[i++]=215,s[i++]=255,a.setUint32(i,r.getMilliseconds()*4e6+(n/1e3/4294967296>>0)),a.setUint32(i+4,n)}else if(isNaN(n)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:s,targetView:a,position:i}=e(3);s[i++]=212,s[i++]=255,s[i++]=255}else{let{target:s,targetView:a,position:i}=e(15);s[i++]=199,s[i++]=12,s[i++]=255,a.setUint32(i,r.getMilliseconds()*1e6),a.setBigInt64(i+4,BigInt(Math.floor(n)))}}},{pack(r,e,t){if(this.setAsEmptyObject)return e(0),t({});let n=Array.from(r),{target:s,position:a}=e(this.moreTypes?3:0);this.moreTypes&&(s[a++]=212,s[a++]=115,s[a++]=0),t(n)}},{pack(r,e,t){let{target:n,position:s}=e(this.moreTypes?3:0);this.moreTypes&&(n[s++]=212,n[s++]=101,n[s++]=0),t([r.name,r.message])}},{pack(r,e,t){let{target:n,position:s}=e(this.moreTypes?3:0);this.moreTypes&&(n[s++]=212,n[s++]=120,n[s++]=0),t([r.source,r.flags])}},{pack(r,e){this.moreTypes?As(r,16,e):Cs(ln?Buffer.from(r):new Uint8Array(r),e)}},{pack(r,e){let t=r.constructor;t!==La&&this.moreTypes?As(r,Pa.indexOf(t.name),e):Cs(r,e)}},{pack(r,e){let{target:t,position:n}=e(1);t[n]=193}}];function As(r,e,t,n){let s=r.byteLength;if(s+1<256){var{target:a,position:i}=t(4+s);a[i++]=199,a[i++]=s+1}else if(s+1<65536){var{target:a,position:i}=t(5+s);a[i++]=200,a[i++]=s+1>>8,a[i++]=s+1&255}else{var{target:a,position:i,targetView:o}=t(7+s);a[i++]=201,o.setUint32(i,s+1),i+=4}a[i++]=116,a[i++]=e,a.set(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),i)}function Cs(r,e){let t=r.byteLength;var n,s;if(t<256){var{target:n,position:s}=e(t+2);n[s++]=196,n[s++]=t}else if(t<65536){var{target:n,position:s}=e(t+3);n[s++]=197,n[s++]=t>>8,n[s++]=t&255}else{var{target:n,position:s,targetView:a}=e(t+5);n[s++]=198,a.setUint32(s,t),s+=4}n.set(r,s)}function wc(r,e,t,n){let s=r.length;switch(s){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:s<256?(e[t++]=199,e[t++]=s):s<65536?(e[t++]=200,e[t++]=s>>8,e[t++]=s&255):(e[t++]=201,e[t++]=s>>24,e[t++]=s>>16&255,e[t++]=s>>8&255,e[t++]=s&255)}return e[t++]=n,e.set(r,t),t+=s,t}function bc(r,e){let t,n=e.length*6,s=r.length-n;for(;t=e.pop();){let a=t.offset,i=t.id;r.copyWithin(a+n,a,s),n-=6;let o=a+n;r[o++]=214,r[o++]=105,r[o++]=i>>24,r[o++]=i>>16&255,r[o++]=i>>8&255,r[o++]=i&255,s=a}return r}function Rs(r,e,t){if(re.length>0){X.setUint32(re.position+r,d+t-re.position-r),re.stringsPosition=d-r;let n=re;re=null,e(n[0]),e(n[1])}}function xc(r){if(r.Class){if(!r.pack&&!r.write)throw new Error("Extension has no pack or write function");if(r.pack&&!r.type)throw new Error("Extension has no type (numeric code to identify the extension)");as.unshift(r.Class),Wr.unshift(r)}hc(r)}function Tc(r,e){return r.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},r}let Ba=new _c({useRecords:!1});const kc=Ba.pack;Ba.pack;const Oc=512,Sc=1024,Ec=2048;class Nc{constructor(){b(this,"contentType","application/msgpack")}encode(e){return kc(Zt.toSnake(e))}decode(e,t){const n=Zt.toCamel(pc(new Uint8Array(e)));return t!=null?t.parse(n):n}static registerCustomType(e){xc({type:0,...e})}}class Ic{constructor(){b(this,"contentType","application/json")}encode(e){const t=JSON.stringify(Zt.toSnake(e),(n,s)=>ArrayBuffer.isView(s)?Array.from(s):s);return new TextEncoder().encode(t)}decode(e,t){const n=Zt.toCamel(JSON.parse(new TextDecoder().decode(e)));return t!=null?t.parse(n):n}static registerCustomType(){}}new Nc,new Ic;var G;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(G||(G={}));var Mn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Mn||(Mn={}));const O=G.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),st=r=>{switch(typeof r){case"undefined":return O.undefined;case"string":return O.string;case"number":return isNaN(r)?O.nan:O.number;case"boolean":return O.boolean;case"function":return O.function;case"bigint":return O.bigint;case"symbol":return O.symbol;case"object":return Array.isArray(r)?O.array:r===null?O.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?O.promise:typeof Map<"u"&&r instanceof Map?O.map:typeof Set<"u"&&r instanceof Set?O.set:typeof Date<"u"&&r instanceof Date?O.date:O.object;default:return O.unknown}},_=G.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Zc=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Ce extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,l=0;for(;l<i.path.length;){const u=i.path[l];l===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,G.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Ce.create=r=>new Ce(r);const Ht=(r,e)=>{let t;switch(r.code){case _.invalid_type:r.received===O.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case _.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,G.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:t=`Unrecognized key(s) in object: ${G.joinValues(r.keys,", ")}`;break;case _.invalid_union:t="Invalid input";break;case _.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${G.joinValues(r.options)}`;break;case _.invalid_enum_value:t=`Invalid enum value. Expected ${G.joinValues(r.options)}, received '${r.received}'`;break;case _.invalid_arguments:t="Invalid function arguments";break;case _.invalid_return_type:t="Invalid function return type";break;case _.invalid_date:t="Invalid date";break;case _.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}"`:G.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case _.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==="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 _.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 _.custom:t="Invalid input";break;case _.invalid_intersection_types:t="Intersection results could not be merged";break;case _.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case _.not_finite:t="Number must be finite";break;default:t=e.defaultError,G.assertNever(r)}return{message:t}};let Va=Ht;function Ac(r){Va=r}function Fr(){return Va}const Gr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const l=n.filter(u=>!!u).slice().reverse();for(const u of l)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},Cc=[];function E(r,e){const t=Gr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fr(),Ht].filter(n=>!!n)});r.common.issues.push(t)}class ye{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return M;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t)n.push({key:await s.key,value:await s.value});return ye.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return M;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const M=Object.freeze({status:"aborted"}),za=r=>({status:"dirty",value:r}),xe=r=>({status:"valid",value:r}),Un=r=>r.status==="aborted",Pn=r=>r.status==="dirty",Xt=r=>r.status==="valid",Jr=r=>typeof Promise<"u"&&r instanceof Promise;var A;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(A||(A={}));class De{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const js=(r,e)=>{if(Xt(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 Ce(r.common.issues);return this._error=t,this._error}}};function P(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:t??o.defaultError},description:s}}class L{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)}get description(){return this._def.description}_getType(e){return st(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:st(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ye,ctx:{common:e.parent.common,data:e.data,parsedType:st(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Jr(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:st(e)},a=this._parseSync({data:e,path:s.path,parent:s});return js(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:st(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Jr(s)?s:Promise.resolve(s));return js(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:_.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new $e({schema:this,typeName:R.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Xe.create(this,this._def)}nullable(){return wt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Re.create(this,this._def)}promise(){return Ct.create(this,this._def)}or(e){return rr.create([this,e],this._def)}and(e){return nr.create(this,e,this._def)}transform(e){return new $e({...P(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new cr({...P(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new Ya({typeName:R.ZodBranded,type:this,...P(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new en({...P(this._def),innerType:this,catchValue:t,typeName:R.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return hr.create(this,e)}readonly(){return rn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Rc=/^c[^\s-]{8,}$/i,jc=/^[a-z][a-z0-9]*$/,$c=/^[0-9A-HJKMNP-TV-Z]{26}$/,Mc=/^[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,Uc=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Pc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let xn;const Dc=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Lc=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Bc=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Vc(r,e){return!!((e==="v4"||!e)&&Dc.test(r)||(e==="v6"||!e)&&Lc.test(r))}class Ze extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){const a=this._getOrReturnCtx(e);return E(a,{code:_.invalid_type,expected:O.string,received:a.parsedType}),M}const n=new ye;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),E(s,{code:_.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),E(s,{code:_.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?E(s,{code:_.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&E(s,{code:_.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Uc.test(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{validation:"email",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")xn||(xn=new RegExp(Pc,"u")),xn.test(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{validation:"emoji",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Mc.test(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{validation:"uuid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Rc.test(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{validation:"cuid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")jc.test(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{validation:"cuid2",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")$c.test(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{validation:"ulid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),E(s,{validation:"url",code:_.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{validation:"regex",code:_.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),E(s,{code:_.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.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)||(s=this._getOrReturnCtx(e,s),E(s,{code:_.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),E(s,{code:_.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Bc(a).test(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{code:_.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?Vc(e.data,a.version)||(s=this._getOrReturnCtx(e,s),E(s,{validation:"ip",code:_.invalid_string,message:a.message}),n.dirty()):G.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:_.invalid_string,...A.errToObj(n)})}_addCheck(e){return new Ze({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...A.errToObj(e)})}url(e){return this._addCheck({kind:"url",...A.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...A.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...A.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...A.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...A.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...A.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...A.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...A.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...A.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...A.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...A.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...A.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...A.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...A.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...A.errToObj(t)})}nonempty(e){return this.min(1,A.errToObj(e))}trim(){return new Ze({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ze({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ze({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}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 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 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}}Ze.create=r=>{var e;return new Ze({checks:[],typeName:R.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...P(r)})};function zc(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class ct extends L{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)!==O.number){const a=this._getOrReturnCtx(e);return E(a,{code:_.invalid_type,expected:O.number,received:a.parsedType}),M}let n;const s=new ye;for(const a of this._def.checks)a.kind==="int"?G.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:_.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?zc(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:_.not_finite,message:a.message}),s.dirty()):G.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,n,s){return new ct({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:A.toString(s)}]})}_addCheck(e){return new ct({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:A.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:A.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.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"&&G.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ct.create=r=>new ct({checks:[],typeName:R.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...P(r)});class ut extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==O.bigint){const a=this._getOrReturnCtx(e);return E(a,{code:_.invalid_type,expected:O.bigint,received:a.parsedType}),M}let n;const s=new ye;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):G.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,n,s){return new ut({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:A.toString(s)}]})}_addCheck(e){return new ut({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.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}}ut.create=r=>{var e;return new ut({checks:[],typeName:R.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...P(r)})};class Qt extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){const n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:O.boolean,received:n.parsedType}),M}return xe(e.data)}}Qt.create=r=>new Qt({typeName:R.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...P(r)});class vt extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){const a=this._getOrReturnCtx(e);return E(a,{code:_.invalid_type,expected:O.date,received:a.parsedType}),M}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return E(a,{code:_.invalid_date}),M}const n=new ye;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),E(s,{code:_.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),E(s,{code:_.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):G.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new vt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:A.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:A.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}}vt.create=r=>new vt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:R.ZodDate,...P(r)});class Hr extends L{_parse(e){if(this._getType(e)!==O.symbol){const n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:O.symbol,received:n.parsedType}),M}return xe(e.data)}}Hr.create=r=>new Hr({typeName:R.ZodSymbol,...P(r)});class er extends L{_parse(e){if(this._getType(e)!==O.undefined){const n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:O.undefined,received:n.parsedType}),M}return xe(e.data)}}er.create=r=>new er({typeName:R.ZodUndefined,...P(r)});class tr extends L{_parse(e){if(this._getType(e)!==O.null){const n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:O.null,received:n.parsedType}),M}return xe(e.data)}}tr.create=r=>new tr({typeName:R.ZodNull,...P(r)});class At extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return xe(e.data)}}At.create=r=>new At({typeName:R.ZodAny,...P(r)});class mt extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xe(e.data)}}mt.create=r=>new mt({typeName:R.ZodUnknown,...P(r)});class et extends L{_parse(e){const t=this._getOrReturnCtx(e);return E(t,{code:_.invalid_type,expected:O.never,received:t.parsedType}),M}}et.create=r=>new et({typeName:R.ZodNever,...P(r)});class Xr extends L{_parse(e){if(this._getType(e)!==O.undefined){const n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:O.void,received:n.parsedType}),M}return xe(e.data)}}Xr.create=r=>new Xr({typeName:R.ZodVoid,...P(r)});class Re extends L{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==O.array)return E(t,{code:_.invalid_type,expected:O.array,received:t.parsedType}),M;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(E(t,{code:i?_.too_big:_.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(E(t,{code:_.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(E(t,{code:_.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new De(t,i,t.path,o)))).then(i=>ye.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new De(t,i,t.path,o)));return ye.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Re({...this._def,minLength:{value:e,message:A.toString(t)}})}max(e,t){return new Re({...this._def,maxLength:{value:e,message:A.toString(t)}})}length(e,t){return new Re({...this._def,exactLength:{value:e,message:A.toString(t)}})}nonempty(e){return this.min(1,e)}}Re.create=(r,e)=>new Re({type:r,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...P(e)});function Ot(r){if(r instanceof ne){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Xe.create(Ot(n))}return new ne({...r._def,shape:()=>e})}else return r instanceof Re?new Re({...r._def,type:Ot(r.element)}):r instanceof Xe?Xe.create(Ot(r.unwrap())):r instanceof wt?wt.create(Ot(r.unwrap())):r instanceof Le?Le.create(r.items.map(e=>Ot(e))):r}class ne extends L{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=G.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==O.object){const u=this._getOrReturnCtx(e);return E(u,{code:_.invalid_type,expected:O.object,received:u.parsedType}),M}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof et&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const l=[];for(const u of i){const p=a[u],N=s.data[u];l.push({key:{status:"valid",value:u},value:p._parse(new De(s,N,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof et){const u=this._def.unknownKeys;if(u==="passthrough")for(const p of o)l.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(u==="strict")o.length>0&&(E(s,{code:_.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const p of o){const N=s.data[p];l.push({key:{status:"valid",value:p},value:u._parse(new De(s,N,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const p of l){const N=await p.key;u.push({key:N,value:await p.value,alwaysSet:p.alwaysSet})}return u}).then(u=>ye.mergeObjectSync(n,u)):ye.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return A.errToObj,new ne({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const l=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=A.errToObj(e).message)!==null&&o!==void 0?o:l}:{message:l}}}:{}})}strip(){return new ne({...this._def,unknownKeys:"strip"})}passthrough(){return new ne({...this._def,unknownKeys:"passthrough"})}extend(e){return new ne({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ne({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ne({...this._def,catchall:e})}pick(e){const t={};return G.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new ne({...this._def,shape:()=>t})}omit(e){const t={};return G.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new ne({...this._def,shape:()=>t})}deepPartial(){return Ot(this)}partial(e){const t={};return G.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new ne({...this._def,shape:()=>t})}required(e){const t={};return G.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Xe;)a=a._def.innerType;t[n]=a}}),new ne({...this._def,shape:()=>t})}keyof(){return qa(G.objectKeys(this.shape))}}ne.create=(r,e)=>new ne({shape:()=>r,unknownKeys:"strip",catchall:et.create(),typeName:R.ZodObject,...P(e)});ne.strictCreate=(r,e)=>new ne({shape:()=>r,unknownKeys:"strict",catchall:et.create(),typeName:R.ZodObject,...P(e)});ne.lazycreate=(r,e)=>new ne({shape:r,unknownKeys:"strip",catchall:et.create(),typeName:R.ZodObject,...P(e)});class rr extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(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 Ce(o.ctx.common.issues));return E(t,{code:_.invalid_union,unionErrors:i}),M}if(t.common.async)return Promise.all(n.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(s);{let a;const i=[];for(const l of n){const u={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,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(l=>new Ce(l));return E(t,{code:_.invalid_union,unionErrors:o}),M}}get options(){return this._def.options}}rr.create=(r,e)=>new rr({options:r,typeName:R.ZodUnion,...P(e)});const jr=r=>r instanceof ar?jr(r.schema):r instanceof $e?jr(r.innerType()):r instanceof ir?[r.value]:r instanceof lt?r.options:r instanceof or?Object.keys(r.enum):r instanceof cr?jr(r._def.innerType):r instanceof er?[void 0]:r instanceof tr?[null]:null;class dn extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.object)return E(t,{code:_.invalid_type,expected:O.object,received:t.parsedType}),M;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);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}):(E(t,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),M)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=jr(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new dn({typeName:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...P(n)})}}function Dn(r,e){const t=st(r),n=st(e);if(r===e)return{valid:!0,data:r};if(t===O.object&&n===O.object){const s=G.objectKeys(e),a=G.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const l=Dn(r[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(t===O.array&&n===O.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],l=Dn(i,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===O.date&&n===O.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class nr extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Un(a)||Un(i))return M;const o=Dn(a.value,i.value);return o.valid?((Pn(a)||Pn(i))&&t.dirty(),{status:t.value,value:o.data}):(E(n,{code:_.invalid_intersection_types}),M)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}nr.create=(r,e,t)=>new nr({left:r,right:e,typeName:R.ZodIntersection,...P(t)});class Le extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.array)return E(n,{code:_.invalid_type,expected:O.array,received:n.parsedType}),M;if(n.data.length<this._def.items.length)return E(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),M;!this._def.rest&&n.data.length>this._def.items.length&&(E(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new De(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>ye.mergeArray(t,i)):ye.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Le({...this._def,rest:e})}}Le.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Le({items:r,typeName:R.ZodTuple,rest:null,...P(e)})};class sr extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.object)return E(n,{code:_.invalid_type,expected:O.object,received:n.parsedType}),M;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new De(n,o,n.path,o)),value:i._parse(new De(n,n.data[o],n.path,o))});return n.common.async?ye.mergeObjectAsync(t,s):ye.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof L?new sr({keyType:e,valueType:t,typeName:R.ZodRecord,...P(n)}):new sr({keyType:Ze.create(),valueType:e,typeName:R.ZodRecord,...P(t)})}}class Qr extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.map)return E(n,{code:_.invalid_type,expected:O.map,received:n.parsedType}),M;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,l],u)=>({key:s._parse(new De(n,o,n.path,[u,"key"])),value:a._parse(new De(n,l,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,p=await l.value;if(u.status==="aborted"||p.status==="aborted")return M;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of i){const u=l.key,p=l.value;if(u.status==="aborted"||p.status==="aborted")return M;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}}}}Qr.create=(r,e,t)=>new Qr({valueType:e,keyType:r,typeName:R.ZodMap,...P(t)});class _t extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.set)return E(n,{code:_.invalid_type,expected:O.set,received:n.parsedType}),M;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(E(n,{code:_.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(E(n,{code:_.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(l){const u=new Set;for(const p of l){if(p.status==="aborted")return M;p.status==="dirty"&&t.dirty(),u.add(p.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((l,u)=>a._parse(new De(n,l,n.path,u)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new _t({...this._def,minSize:{value:e,message:A.toString(t)}})}max(e,t){return new _t({...this._def,maxSize:{value:e,message:A.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_t.create=(r,e)=>new _t({valueType:r,minSize:null,maxSize:null,typeName:R.ZodSet,...P(e)});class St extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.function)return E(t,{code:_.invalid_type,expected:O.function,received:t.parsedType}),M;function n(o,l){return Gr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Fr(),Ht].filter(u=>!!u),issueData:{code:_.invalid_arguments,argumentsError:l}})}function s(o,l){return Gr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Fr(),Ht].filter(u=>!!u),issueData:{code:_.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ct){const o=this;return xe(async function(...l){const u=new Ce([]),p=await o._def.args.parseAsync(l,a).catch(J=>{throw u.addIssue(n(l,J)),u}),N=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(N,a).catch(J=>{throw u.addIssue(s(N,J)),u})})}else{const o=this;return xe(function(...l){const u=o._def.args.safeParse(l,a);if(!u.success)throw new Ce([n(l,u.error)]);const p=Reflect.apply(i,this,u.data),N=o._def.returns.safeParse(p,a);if(!N.success)throw new Ce([s(p,N.error)]);return N.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new St({...this._def,args:Le.create(e).rest(mt.create())})}returns(e){return new St({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new St({args:e||Le.create([]).rest(mt.create()),returns:t||mt.create(),typeName:R.ZodFunction,...P(n)})}}class ar extends L{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})}}ar.create=(r,e)=>new ar({getter:r,typeName:R.ZodLazy,...P(e)});class ir extends L{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return E(t,{received:t.data,code:_.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:e.data}}get value(){return this._def.value}}ir.create=(r,e)=>new ir({value:r,typeName:R.ZodLiteral,...P(e)});function qa(r,e){return new lt({values:r,typeName:R.ZodEnum,...P(e)})}class lt extends L{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return E(t,{expected:G.joinValues(n),received:t.parsedType,code:_.invalid_type}),M}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return E(t,{received:t.data,code:_.invalid_enum_value,options:n}),M}return xe(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){return lt.create(e)}exclude(e){return lt.create(this.options.filter(t=>!e.includes(t)))}}lt.create=qa;class or extends L{_parse(e){const t=G.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==O.string&&n.parsedType!==O.number){const s=G.objectValues(t);return E(n,{expected:G.joinValues(s),received:n.parsedType,code:_.invalid_type}),M}if(t.indexOf(e.data)===-1){const s=G.objectValues(t);return E(n,{received:n.data,code:_.invalid_enum_value,options:s}),M}return xe(e.data)}get enum(){return this._def.values}}or.create=(r,e)=>new or({values:r,typeName:R.ZodNativeEnum,...P(e)});class Ct extends L{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.promise&&t.common.async===!1)return E(t,{code:_.invalid_type,expected:O.promise,received:t.parsedType}),M;const n=t.parsedType===O.promise?t.data:Promise.resolve(t.data);return xe(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ct.create=(r,e)=>new Ct({type:r,typeName:R.ZodPromise,...P(e)});class $e extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{E(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){const i=o=>{const l=s.refinement(o,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?M:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?M:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Xt(i))return i;const o=s.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:n.data,path:n.path,parent:n}).then(i=>Xt(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);G.assertNever(s)}}$e.create=(r,e,t)=>new $e({schema:r,typeName:R.ZodEffects,effect:e,...P(t)});$e.createWithPreprocess=(r,e,t)=>new $e({schema:e,effect:{type:"preprocess",transform:r},typeName:R.ZodEffects,...P(t)});class Xe extends L{_parse(e){return this._getType(e)===O.undefined?xe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Xe.create=(r,e)=>new Xe({innerType:r,typeName:R.ZodOptional,...P(e)});class wt extends L{_parse(e){return this._getType(e)===O.null?xe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}wt.create=(r,e)=>new wt({innerType:r,typeName:R.ZodNullable,...P(e)});class cr extends L{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===O.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}cr.create=(r,e)=>new cr({innerType:r,typeName:R.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...P(e)});class en extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Jr(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}en.create=(r,e)=>new en({innerType:r,typeName:R.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...P(e)});class tn extends L{_parse(e){if(this._getType(e)!==O.nan){const n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:O.nan,received:n.parsedType}),M}return{status:"valid",value:e.data}}}tn.create=r=>new tn({typeName:R.ZodNaN,...P(r)});const qc=Symbol("zod_brand");class Ya extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class hr extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?M:a.status==="dirty"?(t.dirty(),za(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?M:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new hr({in:e,out:t,typeName:R.ZodPipeline})}}class rn extends L{_parse(e){const t=this._def.innerType._parse(e);return Xt(t)&&(t.value=Object.freeze(t.value)),t}}rn.create=(r,e)=>new rn({innerType:r,typeName:R.ZodReadonly,...P(e)});const Ka=(r,e={},t)=>r?At.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,l=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...u,fatal:l})}}):At.create(),Yc={object:ne.lazycreate};var R;(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"})(R||(R={}));const Kc=(r,e={message:`Input not instance of ${r.name}`})=>Ka(t=>t instanceof r,e),Wa=Ze.create,Fa=ct.create,Wc=tn.create,Fc=ut.create,Ga=Qt.create,Gc=vt.create,Jc=Hr.create,Hc=er.create,Xc=tr.create,Qc=At.create,eu=mt.create,tu=et.create,ru=Xr.create,nu=Re.create,su=ne.create,au=ne.strictCreate,iu=rr.create,ou=dn.create,cu=nr.create,uu=Le.create,lu=sr.create,du=Qr.create,fu=_t.create,hu=St.create,pu=ar.create,mu=ir.create,yu=lt.create,gu=or.create,vu=Ct.create,$s=$e.create,_u=Xe.create,wu=wt.create,bu=$e.createWithPreprocess,xu=hr.create,Tu=()=>Wa().optional(),ku=()=>Fa().optional(),Ou=()=>Ga().optional(),Su={string:r=>Ze.create({...r,coerce:!0}),number:r=>ct.create({...r,coerce:!0}),boolean:r=>Qt.create({...r,coerce:!0}),bigint:r=>ut.create({...r,coerce:!0}),date:r=>vt.create({...r,coerce:!0})},Eu=M;var Ge=Object.freeze({__proto__:null,defaultErrorMap:Ht,setErrorMap:Ac,getErrorMap:Fr,makeIssue:Gr,EMPTY_PATH:Cc,addIssueToContext:E,ParseStatus:ye,INVALID:M,DIRTY:za,OK:xe,isAborted:Un,isDirty:Pn,isValid:Xt,isAsync:Jr,get util(){return G},get objectUtil(){return Mn},ZodParsedType:O,getParsedType:st,ZodType:L,ZodString:Ze,ZodNumber:ct,ZodBigInt:ut,ZodBoolean:Qt,ZodDate:vt,ZodSymbol:Hr,ZodUndefined:er,ZodNull:tr,ZodAny:At,ZodUnknown:mt,ZodNever:et,ZodVoid:Xr,ZodArray:Re,ZodObject:ne,ZodUnion:rr,ZodDiscriminatedUnion:dn,ZodIntersection:nr,ZodTuple:Le,ZodRecord:sr,ZodMap:Qr,ZodSet:_t,ZodFunction:St,ZodLazy:ar,ZodLiteral:ir,ZodEnum:lt,ZodNativeEnum:or,ZodPromise:Ct,ZodEffects:$e,ZodTransformer:$e,ZodOptional:Xe,ZodNullable:wt,ZodDefault:cr,ZodCatch:en,ZodNaN:tn,BRAND:qc,ZodBranded:Ya,ZodPipeline:hr,ZodReadonly:rn,custom:Ka,Schema:L,ZodSchema:L,late:Yc,get ZodFirstPartyTypeKind(){return R},coerce:Su,any:Qc,array:nu,bigint:Fc,boolean:Ga,date:Gc,discriminatedUnion:ou,effect:$s,enum:yu,function:hu,instanceof:Kc,intersection:cu,lazy:pu,literal:mu,map:du,nan:Wc,nativeEnum:gu,never:tu,null:Xc,nullable:wu,number:Fa,object:su,oboolean:Ou,onumber:ku,optional:_u,ostring:Tu,pipeline:xu,preprocess:bu,promise:vu,record:lu,set:fu,strictObject:au,string:Wa,symbol:Jc,transformer:$s,tuple:uu,undefined:Hc,union:iu,unknown:eu,void:ru,NEVER:Eu,ZodIssueCode:_,quotelessJson:Zc,ZodError:Ce});class pr extends Error{constructor(t,n){super(t);ce(this,"discriminator","FreighterError");ce(this,"type");this.type=n}}const Nu=r=>{if(r==null||typeof r!="object")return!1;const e=r;if(e.discriminator!=="FreighterError")return!1;if(!("type"in e))throw new Error(`Freighter error is missing its type property: ${JSON.stringify(e)}`);return!0},Ln="unknown",Ms="nil",fn="freighter",is=Ge.object({type:Ge.string(),data:Ge.string()});class Iu{constructor(){ce(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Ms,data:""};if(Nu(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}return{type:Ln,data:JSON.stringify(e)}}decode(e){if(e==null||e.type===Ms)return null;if(e.type===Ln)return new Us(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new Us(e.data)}}const os=new Iu,Ja=({encode:r,decode:e})=>os.register({encode:r,decode:e}),Zu=r=>os.encode(r),cs=r=>os.decode(r);class Us extends pr{constructor(e){super(e,Ln)}}class ur extends pr{constructor(){super("EOF",fn)}}class lr extends pr{constructor(){super("StreamClosed",fn)}}class hn extends pr{constructor(t={}){const{message:n="Unreachable",url:s=ac.UNKNOWN}=t;super(n,fn);ce(this,"url");this.url=s}}const $r="freighter",Au=r=>{if(r.type!==fn)return null;if(r instanceof ur)return{type:$r,data:"EOF"};if(r instanceof lr)return{type:$r,data:"StreamClosed"};if(r instanceof hn)return{type:$r,data:"Unreachable"};throw new Error(`Unknown error type: ${r.type}: ${r.message}`)},Cu=r=>{if(r.type!==$r)return null;switch(r.data){case"EOF":return new ur;case"StreamClosed":return new lr;case"Unreachable":return new hn;default:throw new Error(`Unknown error type: ${r.data}`)}};Ja({encode:Au,decode:Cu});class Ha{constructor(){ce(this,"middleware",[])}use(...e){this.middleware.push(...e)}async executeMiddleware(e,t){let n=0;const s=async a=>{if(n===this.middleware.length)return await t(a);const i=this.middleware[n];return n++,await i(a,s)};return await s(e)}}const Xa="Content-Type",Ps=r=>{if(Za.RUNTIME!=="node")return fetch;const e=require("node-fetch");if(r==="http")return e;const t=require("https"),n=new t.Agent({rejectUnauthorized:!1});return async(s,a)=>await e(s,{...a,agent:n})};class Ru extends Ha{constructor(t,n,s=!1){super();ce(this,"endpoint");ce(this,"encoder");ce(this,"fetch");return this.endpoint=t.replace({protocol:s?"https":"http"}),this.encoder=n,this.fetch=Ps(this.endpoint.protocol),new Proxy(this,{get:(a,i,o)=>i==="endpoint"?this.endpoint:Reflect.get(a,i,o)})}get headers(){return{[Xa]:this.encoder.contentType}}async send(t,n,s){let a=null;const i=this.endpoint.child(t),o={};o.method="POST",o.body=this.encoder.encode(n??{});const[,l]=await this.executeMiddleware({target:i.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async u=>{const p={...u,params:{}};o.headers={...this.headers,...u.params};let N;try{N=await Ps(u.protocol)(u.target,o)}catch(J){let pe=J;return pe.message==="Load failed"&&(pe=new hn({url:i})),[p,pe]}const ue=await N.arrayBuffer();if(N!=null&&N.ok)return s!=null&&(a=this.encoder.decode(ue,s)),[p,null];try{if(N.status!==400)return[p,new Error(N.statusText)];const J=this.encoder.decode(ue,is),pe=cs(J);return[p,pe]}catch(J){return[p,new Error(`[freighter] - failed to decode error: ${N.statusText}: ${J.message}`)]}});return[a,l]}}const ju=async(r,e,t,n)=>{const[s,a]=await r.send(e,t,n);if(a!=null)throw a;return s},$u=()=>Za.RUNTIME!=="node"?r=>new WebSocket(r):r=>new(require("ws")).WebSocket(r,{rejectUnauthorized:!1}),Mu=Ge.object({type:Ge.union([Ge.literal("data"),Ge.literal("close")]),payload:Ge.unknown().optional(),error:Ge.optional(is)});class Uu{constructor(e,t,n,s){ce(this,"encoder");ce(this,"reqSchema");ce(this,"resSchema");ce(this,"ws");ce(this,"serverClosed");ce(this,"sendClosed");ce(this,"receiveDataQueue",[]);ce(this,"receiveCallbacksQueue",[]);this.encoder=t,this.reqSchema=n,this.resSchema=s,this.ws=e,this.sendClosed=!1,this.serverClosed=null,this.listenForMessages()}send(e){if(this.serverClosed!=null)return new ur;if(this.sendClosed)throw new lr;return this.ws.send(this.encoder.encode({type:"data",payload:e})),null}async receive(){if(this.serverClosed!=null)return[null,this.serverClosed];const e=await this.receiveMsg();if(e.type==="close"){if(e.error==null)throw new Error("Message error must be defined");return this.serverClosed=cs(e.error),[null,this.serverClosed]}return[this.resSchema.parse(e.payload),null]}received(){return this.receiveDataQueue.length!==0}closeSend(){if(this.sendClosed||this.serverClosed!=null)return;const e={type:"close"};try{this.ws.send(this.encoder.encode(e))}finally{this.sendClosed=!0}}async receiveMsg(){const e=this.receiveDataQueue.shift();return e??await new Promise((t,n)=>this.receiveCallbacksQueue.push({resolve:t,reject:n}))}listenForMessages(){this.ws.onmessage=e=>{const t=this.encoder.decode(e.data,Mu),n=this.receiveCallbacksQueue.shift();n!=null?n.resolve(t):this.receiveDataQueue.push(t)},this.ws.onclose=e=>{this.serverClosed=Vu(e)?new ur:new lr}}}const Pu="freighterctx",Du=1e3,Lu=1001,Bu=[Du,Lu],Vu=r=>Bu.includes(r.code),nn=class nn extends Ha{constructor(t,n,s=!1){super();ce(this,"baseUrl");ce(this,"encoder");this.baseUrl=t.replace({protocol:s?"wss":"ws"}),this.encoder=n}async stream(t,n,s){const a=$u();let i;const[,o]=await this.executeMiddleware({target:t,protocol:"websocket",params:{},role:"client"},async l=>{const u=a(this.buildURL(t,l)),p={...l,params:{}};u.binaryType=nn.MESSAGE_TYPE;const N=await this.wrapSocket(u,n,s);return N instanceof Error?[p,N]:(i=N,[p,null])});if(o!=null)throw o;return i}buildURL(t,n){const s=sc({[Xa]:this.encoder.contentType,...n.params},Pu);return this.baseUrl.child(t).toString()+s}async wrapSocket(t,n,s){return await new Promise(a=>{t.onopen=()=>{a(new Uu(t,this.encoder,n,s))},t.onerror=i=>{const o=i;a(new Error(o.message))}})}};ce(nn,"MESSAGE_TYPE","arraybuffer");let Bn=nn;exports.BaseTypedError=pr;exports.EOF=ur;exports.HTTPClient=Ru;exports.StreamClosed=lr;exports.Unreachable=hn;exports.WebSocketClient=Bn;exports.decodeError=cs;exports.encodeError=Zu;exports.errorZ=is;exports.registerError=Ja;exports.sendRequired=ju;
|
|
2
|
+
//# sourceMappingURL=freighter.cjs.map
|