@synnaxlabs/client 0.14.0 → 0.15.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/.turbo/turbo-build.log +5 -5
- package/dist/client.cjs.js +3 -3
- package/dist/client.cjs.js.map +1 -1
- package/dist/client.es.js +697 -672
- package/dist/client.es.js.map +1 -1
- package/dist/hardware/task/payload.d.ts +3 -3
- package/dist/workspace/lineplot/payload.d.ts +3 -2
- package/dist/workspace/lineplot/writer.d.ts +2 -2
- package/dist/workspace/payload.d.ts +3 -2
- package/dist/workspace/pid/payload.d.ts +3 -2
- package/dist/workspace/pid/writer.d.ts +2 -2
- package/dist/workspace/writer.d.ts +3 -3
- package/package.json +5 -5
- package/src/hardware/device/client.ts +9 -0
- package/src/hardware/device/device.spec.ts +9 -0
- package/src/hardware/device/external.ts +9 -0
- package/src/hardware/device/index.ts +10 -1
- package/src/hardware/device/payload.ts +9 -0
- package/src/hardware/device/writer.ts +9 -0
- package/src/hardware/rack/external.ts +10 -1
- package/src/hardware/rack/index.ts +10 -1
- package/src/hardware/rack/payload.ts +10 -1
- package/src/hardware/rack/rack.spec.ts +9 -0
- package/src/hardware/rack/retriever.ts +9 -0
package/dist/client.cjs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";var Ch=Object.defineProperty;var jh=(r,e,t)=>e in r?Ch(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var h=(r,e,t)=>(jh(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("zod");var Zh=Object.defineProperty,Rh=(r,e,t)=>e in r?Zh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,E=(r,e,t)=>(Rh(r,typeof e!="symbol"?e+"":e,t),t),wn;let zh="_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",Ph=(r=21)=>{let e="",t=r;for(;t--;)e+=zh[Math.random()*64|0];return e};const Uh=r=>r!=null&&typeof r=="object"&&"toString"in r,Dh=(r,e=!1)=>{const t=Uh(r)?"stringer":typeof r;let n;switch(t){case"string":n=(s,a)=>s.localeCompare(a);break;case"stringer":n=(s,a)=>s.toString().localeCompare(a.toString());break;case"number":n=(s,a)=>s-a;break;case"bigint":n=(s,a)=>s-a>BigInt(0)?1:-1;break;case"boolean":n=(s,a)=>Number(s)-Number(a);break;default:return console.warn("sortFunc: unknown type"),()=>-1}return e?Mh(n):n},Mh=r=>(e,t)=>r(t,e);var be;(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})(be||(be={}));var lo;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(lo||(lo={}));const M=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Cr=r=>{switch(typeof r){case"undefined":return M.undefined;case"string":return M.string;case"number":return isNaN(r)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(r)?M.array:r===null?M.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?M.promise:typeof Map<"u"&&r instanceof Map?M.map:typeof Set<"u"&&r instanceof Set?M.set:typeof Date<"u"&&r instanceof Date?M.date:M.object;default:return M.unknown}},I=be.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"]),$h=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Zt 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,c=0;for(;c<i.path.length;){const d=i.path[c];c===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],c++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.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()}}Zt.create=r=>new Zt(r);const ns=(r,e)=>{let t;switch(r.code){case I.invalid_type:r.received===M.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case I.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,be.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:t=`Unrecognized key(s) in object: ${be.joinValues(r.keys,", ")}`;break;case I.invalid_union:t="Invalid input";break;case I.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${be.joinValues(r.options)}`;break;case I.invalid_enum_value:t=`Invalid enum value. Expected ${be.joinValues(r.options)}, received '${r.received}'`;break;case I.invalid_arguments:t="Invalid function arguments";break;case I.invalid_return_type:t="Invalid function return type";break;case I.invalid_date:t="Invalid date";break;case I.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}"`:be.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case I.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 I.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 I.custom:t="Invalid input";break;case I.invalid_intersection_types:t="Intersection results could not be merged";break;case I.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case I.not_finite:t="Number must be finite";break;default:t=e.defaultError,be.assertNever(r)}return{message:t}};let Lu=ns;function Lh(r){Lu=r}function Da(){return Lu}const Ma=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const c=n.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},Bh=[];function B(r,e){const t=Ma({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Da(),ns].filter(n=>!!n)});r.common.issues.push(t)}class at{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 te;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 at.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 te;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 te=Object.freeze({status:"aborted"}),Bu=r=>({status:"dirty",value:r}),ft=r=>({status:"valid",value:r}),ho=r=>r.status==="aborted",fo=r=>r.status==="dirty",ss=r=>r.status==="valid",$a=r=>typeof Promise<"u"&&r instanceof Promise;var W;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(W||(W={}));class qt{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 Bc=(r,e)=>{if(ss(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 Zt(r.common.issues);return this._error=t,this._error}}};function ie(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 ue{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 Cr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Cr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new at,ctx:{common:e.parent.common,data:e.data,parsedType:Cr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if($a(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:Cr(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Bc(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:Cr(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await($a(s)?s:Promise.resolve(s));return Bc(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:I.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!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 Dt({schema:this,typeName:J.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return vr.create(this,this._def)}nullable(){return un.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rt.create(this,this._def)}promise(){return Rn.create(this,this._def)}or(e){return cs.create([this,e],this._def)}and(e){return us.create(this,e,this._def)}transform(e){return new Dt({...ie(this._def),schema:this,typeName:J.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ps({...ie(this._def),innerType:this,defaultValue:t,typeName:J.ZodDefault})}brand(){return new Ku({typeName:J.ZodBranded,type:this,...ie(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ka({...ie(this._def),innerType:this,catchValue:t,typeName:J.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ws.create(this,e)}readonly(){return Wa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Vh=/^c[^\s-]{8,}$/i,Kh=/^[a-z][a-z0-9]*$/,Fh=/^[0-9A-HJKMNP-TV-Z]{26}$/,Wh=/^[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,qh=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Gi;const Jh=/^(((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}))$/,Gh=/^(([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})))$/,Hh=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 Xh(r,e){return!!((e==="v4"||!e)&&Jh.test(r)||(e==="v6"||!e)&&Gh.test(r))}class It extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==M.string){const a=this._getOrReturnCtx(e);return B(a,{code:I.invalid_type,expected:M.string,received:a.parsedType}),te}const n=new at;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:I.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),B(s,{code:I.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?B(s,{code:I.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&B(s,{code:I.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")qh.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"email",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Gi||(Gi=new RegExp(Yh,"u")),Gi.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"emoji",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Wh.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"uuid",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Vh.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cuid",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Kh.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cuid2",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Fh.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"ulid",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),B(s,{validation:"url",code:I.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),B(s,{validation:"regex",code:I.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),B(s,{code:I.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),B(s,{code:I.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),B(s,{code:I.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Hh(a).test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:I.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?Xh(e.data,a.version)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"ip",code:I.invalid_string,message:a.message}),n.dirty()):be.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:I.invalid_string,...W.errToObj(n)})}_addCheck(e){return new It({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...W.errToObj(e)})}url(e){return this._addCheck({kind:"url",...W.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...W.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...W.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...W.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...W.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...W.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,...W.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...W.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...W.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...W.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...W.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...W.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...W.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...W.errToObj(t)})}nonempty(e){return this.min(1,W.errToObj(e))}trim(){return new It({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new It({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new It({...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}}It.create=r=>{var e;return new It({checks:[],typeName:J.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ie(r)})};function Qh(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 Mr extends ue{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)!==M.number){const a=this._getOrReturnCtx(e);return B(a,{code:I.invalid_type,expected:M.number,received:a.parsedType}),te}let n;const s=new at;for(const a of this._def.checks)a.kind==="int"?be.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:I.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),B(n,{code:I.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),B(n,{code:I.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Qh(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:I.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:I.not_finite,message:a.message}),s.dirty()):be.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,W.toString(t))}gt(e,t){return this.setLimit("min",e,!1,W.toString(t))}lte(e,t){return this.setLimit("max",e,!0,W.toString(t))}lt(e,t){return this.setLimit("max",e,!1,W.toString(t))}setLimit(e,t,n,s){return new Mr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:W.toString(s)}]})}_addCheck(e){return new Mr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:W.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:W.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:W.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:W.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"&&be.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)}}Mr.create=r=>new Mr({checks:[],typeName:J.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...ie(r)});class $r extends ue{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)!==M.bigint){const a=this._getOrReturnCtx(e);return B(a,{code:I.invalid_type,expected:M.bigint,received:a.parsedType}),te}let n;const s=new at;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),B(n,{code:I.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),B(n,{code:I.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),B(n,{code:I.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):be.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,W.toString(t))}gt(e,t){return this.setLimit("min",e,!1,W.toString(t))}lte(e,t){return this.setLimit("max",e,!0,W.toString(t))}lt(e,t){return this.setLimit("max",e,!1,W.toString(t))}setLimit(e,t,n,s){return new $r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:W.toString(s)}]})}_addCheck(e){return new $r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:W.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}}$r.create=r=>{var e;return new $r({checks:[],typeName:J.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ie(r)})};class as extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==M.boolean){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.boolean,received:n.parsedType}),te}return ft(e.data)}}as.create=r=>new as({typeName:J.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...ie(r)});class on extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==M.date){const a=this._getOrReturnCtx(e);return B(a,{code:I.invalid_type,expected:M.date,received:a.parsedType}),te}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return B(a,{code:I.invalid_date}),te}const n=new at;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:I.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),B(s,{code:I.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):be.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new on({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:W.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:W.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}}on.create=r=>new on({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:J.ZodDate,...ie(r)});class La extends ue{_parse(e){if(this._getType(e)!==M.symbol){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.symbol,received:n.parsedType}),te}return ft(e.data)}}La.create=r=>new La({typeName:J.ZodSymbol,...ie(r)});class is extends ue{_parse(e){if(this._getType(e)!==M.undefined){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.undefined,received:n.parsedType}),te}return ft(e.data)}}is.create=r=>new is({typeName:J.ZodUndefined,...ie(r)});class os extends ue{_parse(e){if(this._getType(e)!==M.null){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.null,received:n.parsedType}),te}return ft(e.data)}}os.create=r=>new os({typeName:J.ZodNull,...ie(r)});class Zn extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}Zn.create=r=>new Zn({typeName:J.ZodAny,...ie(r)});class rn extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}rn.create=r=>new rn({typeName:J.ZodUnknown,...ie(r)});class Tr extends ue{_parse(e){const t=this._getOrReturnCtx(e);return B(t,{code:I.invalid_type,expected:M.never,received:t.parsedType}),te}}Tr.create=r=>new Tr({typeName:J.ZodNever,...ie(r)});class Ba extends ue{_parse(e){if(this._getType(e)!==M.undefined){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.void,received:n.parsedType}),te}return ft(e.data)}}Ba.create=r=>new Ba({typeName:J.ZodVoid,...ie(r)});class Rt extends ue{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==M.array)return B(t,{code:I.invalid_type,expected:M.array,received:t.parsedType}),te;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(B(t,{code:i?I.too_big:I.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&&(B(t,{code:I.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&&(B(t,{code:I.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 qt(t,i,t.path,o)))).then(i=>at.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new qt(t,i,t.path,o)));return at.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Rt({...this._def,minLength:{value:e,message:W.toString(t)}})}max(e,t){return new Rt({...this._def,maxLength:{value:e,message:W.toString(t)}})}length(e,t){return new Rt({...this._def,exactLength:{value:e,message:W.toString(t)}})}nonempty(e){return this.min(1,e)}}Rt.create=(r,e)=>new Rt({type:r,minLength:null,maxLength:null,exactLength:null,typeName:J.ZodArray,...ie(e)});function Tn(r){if(r instanceof $e){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=vr.create(Tn(n))}return new $e({...r._def,shape:()=>e})}else return r instanceof Rt?new Rt({...r._def,type:Tn(r.element)}):r instanceof vr?vr.create(Tn(r.unwrap())):r instanceof un?un.create(Tn(r.unwrap())):r instanceof Yt?Yt.create(r.items.map(e=>Tn(e))):r}class $e extends ue{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=be.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==M.object){const d=this._getOrReturnCtx(e);return B(d,{code:I.invalid_type,expected:M.object,received:d.parsedType}),te}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Tr&&this._def.unknownKeys==="strip"))for(const d in s.data)i.includes(d)||o.push(d);const c=[];for(const d of i){const w=a[d],D=s.data[d];c.push({key:{status:"valid",value:d},value:w._parse(new qt(s,D,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof Tr){const d=this._def.unknownKeys;if(d==="passthrough")for(const w of o)c.push({key:{status:"valid",value:w},value:{status:"valid",value:s.data[w]}});else if(d==="strict")o.length>0&&(B(s,{code:I.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const w of o){const D=s.data[w];c.push({key:{status:"valid",value:w},value:d._parse(new qt(s,D,s.path,w)),alwaysSet:w in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const w of c){const D=await w.key;d.push({key:D,value:await w.value,alwaysSet:w.alwaysSet})}return d}).then(d=>at.mergeObjectSync(n,d)):at.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return W.errToObj,new $e({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const c=(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=W.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new $e({...this._def,unknownKeys:"strip"})}passthrough(){return new $e({...this._def,unknownKeys:"passthrough"})}extend(e){return new $e({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new $e({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:J.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new $e({...this._def,catchall:e})}pick(e){const t={};return be.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new $e({...this._def,shape:()=>t})}omit(e){const t={};return be.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new $e({...this._def,shape:()=>t})}deepPartial(){return Tn(this)}partial(e){const t={};return be.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new $e({...this._def,shape:()=>t})}required(e){const t={};return be.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof vr;)a=a._def.innerType;t[n]=a}}),new $e({...this._def,shape:()=>t})}keyof(){return Vu(be.objectKeys(this.shape))}}$e.create=(r,e)=>new $e({shape:()=>r,unknownKeys:"strip",catchall:Tr.create(),typeName:J.ZodObject,...ie(e)});$e.strictCreate=(r,e)=>new $e({shape:()=>r,unknownKeys:"strict",catchall:Tr.create(),typeName:J.ZodObject,...ie(e)});$e.lazycreate=(r,e)=>new $e({shape:r,unknownKeys:"strip",catchall:Tr.create(),typeName:J.ZodObject,...ie(e)});class cs extends ue{_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 Zt(o.ctx.common.issues));return B(t,{code:I.invalid_union,unionErrors:i}),te}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 c of n){const d={...t,common:{...t.common,issues:[]},parent:null},w=c._parseSync({data:t.data,path:t.path,parent:d});if(w.status==="valid")return w;w.status==="dirty"&&!a&&(a={result:w,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new Zt(c));return B(t,{code:I.invalid_union,unionErrors:o}),te}}get options(){return this._def.options}}cs.create=(r,e)=>new cs({options:r,typeName:J.ZodUnion,...ie(e)});const pa=r=>r instanceof ds?pa(r.schema):r instanceof Dt?pa(r.innerType()):r instanceof hs?[r.value]:r instanceof Lr?r.options:r instanceof fs?Object.keys(r.enum):r instanceof ps?pa(r._def.innerType):r instanceof is?[void 0]:r instanceof os?[null]:null;class Si extends ue{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==M.object)return B(t,{code:I.invalid_type,expected:M.object,received:t.parsedType}),te;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}):(B(t,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),te)}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=pa(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 Si({typeName:J.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...ie(n)})}}function po(r,e){const t=Cr(r),n=Cr(e);if(r===e)return{valid:!0,data:r};if(t===M.object&&n===M.object){const s=be.objectKeys(e),a=be.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=po(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===M.array&&n===M.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],c=po(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===M.date&&n===M.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class us extends ue{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(ho(a)||ho(i))return te;const o=po(a.value,i.value);return o.valid?((fo(a)||fo(i))&&t.dirty(),{status:t.value,value:o.data}):(B(n,{code:I.invalid_intersection_types}),te)};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}))}}us.create=(r,e,t)=>new us({left:r,right:e,typeName:J.ZodIntersection,...ie(t)});class Yt extends ue{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.array)return B(n,{code:I.invalid_type,expected:M.array,received:n.parsedType}),te;if(n.data.length<this._def.items.length)return B(n,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),te;!this._def.rest&&n.data.length>this._def.items.length&&(B(n,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new qt(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>at.mergeArray(t,i)):at.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Yt({...this._def,rest:e})}}Yt.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Yt({items:r,typeName:J.ZodTuple,rest:null,...ie(e)})};class ls extends ue{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!==M.object)return B(n,{code:I.invalid_type,expected:M.object,received:n.parsedType}),te;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new qt(n,o,n.path,o)),value:i._parse(new qt(n,n.data[o],n.path,o))});return n.common.async?at.mergeObjectAsync(t,s):at.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof ue?new ls({keyType:e,valueType:t,typeName:J.ZodRecord,...ie(n)}):new ls({keyType:It.create(),valueType:e,typeName:J.ZodRecord,...ie(t)})}}class Va extends ue{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!==M.map)return B(n,{code:I.invalid_type,expected:M.map,received:n.parsedType}),te;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],d)=>({key:s._parse(new qt(n,o,n.path,[d,"key"])),value:a._parse(new qt(n,c,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const d=await c.key,w=await c.value;if(d.status==="aborted"||w.status==="aborted")return te;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const d=c.key,w=c.value;if(d.status==="aborted"||w.status==="aborted")return te;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}}}}Va.create=(r,e,t)=>new Va({valueType:e,keyType:r,typeName:J.ZodMap,...ie(t)});class cn extends ue{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.set)return B(n,{code:I.invalid_type,expected:M.set,received:n.parsedType}),te;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(B(n,{code:I.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&&(B(n,{code:I.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(c){const d=new Set;for(const w of c){if(w.status==="aborted")return te;w.status==="dirty"&&t.dirty(),d.add(w.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((c,d)=>a._parse(new qt(n,c,n.path,d)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new cn({...this._def,minSize:{value:e,message:W.toString(t)}})}max(e,t){return new cn({...this._def,maxSize:{value:e,message:W.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}cn.create=(r,e)=>new cn({valueType:r,minSize:null,maxSize:null,typeName:J.ZodSet,...ie(e)});class En extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==M.function)return B(t,{code:I.invalid_type,expected:M.function,received:t.parsedType}),te;function n(o,c){return Ma({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Da(),ns].filter(d=>!!d),issueData:{code:I.invalid_arguments,argumentsError:c}})}function s(o,c){return Ma({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Da(),ns].filter(d=>!!d),issueData:{code:I.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Rn){const o=this;return ft(async function(...c){const d=new Zt([]),w=await o._def.args.parseAsync(c,a).catch(Q=>{throw d.addIssue(n(c,Q)),d}),D=await Reflect.apply(i,this,w);return await o._def.returns._def.type.parseAsync(D,a).catch(Q=>{throw d.addIssue(s(D,Q)),d})})}else{const o=this;return ft(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new Zt([n(c,d.error)]);const w=Reflect.apply(i,this,d.data),D=o._def.returns.safeParse(w,a);if(!D.success)throw new Zt([s(w,D.error)]);return D.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new En({...this._def,args:Yt.create(e).rest(rn.create())})}returns(e){return new En({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new En({args:e||Yt.create([]).rest(rn.create()),returns:t||rn.create(),typeName:J.ZodFunction,...ie(n)})}}class ds extends ue{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})}}ds.create=(r,e)=>new ds({getter:r,typeName:J.ZodLazy,...ie(e)});class hs extends ue{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return B(t,{received:t.data,code:I.invalid_literal,expected:this._def.value}),te}return{status:"valid",value:e.data}}get value(){return this._def.value}}hs.create=(r,e)=>new hs({value:r,typeName:J.ZodLiteral,...ie(e)});function Vu(r,e){return new Lr({values:r,typeName:J.ZodEnum,...ie(e)})}class Lr extends ue{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return B(t,{expected:be.joinValues(n),received:t.parsedType,code:I.invalid_type}),te}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return B(t,{received:t.data,code:I.invalid_enum_value,options:n}),te}return ft(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 Lr.create(e)}exclude(e){return Lr.create(this.options.filter(t=>!e.includes(t)))}}Lr.create=Vu;class fs extends ue{_parse(e){const t=be.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==M.string&&n.parsedType!==M.number){const s=be.objectValues(t);return B(n,{expected:be.joinValues(s),received:n.parsedType,code:I.invalid_type}),te}if(t.indexOf(e.data)===-1){const s=be.objectValues(t);return B(n,{received:n.data,code:I.invalid_enum_value,options:s}),te}return ft(e.data)}get enum(){return this._def.values}}fs.create=(r,e)=>new fs({values:r,typeName:J.ZodNativeEnum,...ie(e)});class Rn extends ue{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==M.promise&&t.common.async===!1)return B(t,{code:I.invalid_type,expected:M.promise,received:t.parsedType}),te;const n=t.parsedType===M.promise?t.data:Promise.resolve(t.data);return ft(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Rn.create=(r,e)=>new Rn({type:r,typeName:J.ZodPromise,...ie(e)});class Dt extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J.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=>{B(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 c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?te:(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"?te:(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(!ss(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=>ss(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);be.assertNever(s)}}Dt.create=(r,e,t)=>new Dt({schema:r,typeName:J.ZodEffects,effect:e,...ie(t)});Dt.createWithPreprocess=(r,e,t)=>new Dt({schema:e,effect:{type:"preprocess",transform:r},typeName:J.ZodEffects,...ie(t)});class vr extends ue{_parse(e){return this._getType(e)===M.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}vr.create=(r,e)=>new vr({innerType:r,typeName:J.ZodOptional,...ie(e)});class un extends ue{_parse(e){return this._getType(e)===M.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}un.create=(r,e)=>new un({innerType:r,typeName:J.ZodNullable,...ie(e)});class ps extends ue{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===M.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ps.create=(r,e)=>new ps({innerType:r,typeName:J.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});class Ka extends ue{_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 $a(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Zt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Zt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ka.create=(r,e)=>new Ka({innerType:r,typeName:J.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});class Fa extends ue{_parse(e){if(this._getType(e)!==M.nan){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.nan,received:n.parsedType}),te}return{status:"valid",value:e.data}}}Fa.create=r=>new Fa({typeName:J.ZodNaN,...ie(r)});const ef=Symbol("zod_brand");class Ku extends ue{_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 Ws extends ue{_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"?te:a.status==="dirty"?(t.dirty(),Bu(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"?te: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 Ws({in:e,out:t,typeName:J.ZodPipeline})}}class Wa extends ue{_parse(e){const t=this._def.innerType._parse(e);return ss(t)&&(t.value=Object.freeze(t.value)),t}}Wa.create=(r,e)=>new Wa({innerType:r,typeName:J.ZodReadonly,...ie(e)});const Fu=(r,e={},t)=>r?Zn.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:c})}}):Zn.create(),tf={object:$e.lazycreate};var J;(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"})(J||(J={}));const rf=(r,e={message:`Input not instance of ${r.name}`})=>Fu(t=>t instanceof r,e),Wu=It.create,qu=Mr.create,nf=Fa.create,sf=$r.create,Yu=as.create,af=on.create,of=La.create,cf=is.create,uf=os.create,lf=Zn.create,df=rn.create,hf=Tr.create,ff=Ba.create,pf=Rt.create,mf=$e.create,yf=$e.strictCreate,gf=cs.create,vf=Si.create,wf=us.create,_f=Yt.create,bf=ls.create,kf=Va.create,Tf=cn.create,xf=En.create,Of=ds.create,Sf=hs.create,Nf=Lr.create,Ef=fs.create,Af=Rn.create,Vc=Dt.create,If=vr.create,Cf=un.create,jf=Dt.createWithPreprocess,Zf=Ws.create,Rf=()=>Wu().optional(),zf=()=>qu().optional(),Pf=()=>Yu().optional(),Uf={string:r=>It.create({...r,coerce:!0}),number:r=>Mr.create({...r,coerce:!0}),boolean:r=>as.create({...r,coerce:!0}),bigint:r=>$r.create({...r,coerce:!0}),date:r=>on.create({...r,coerce:!0})},Df=te;var S=Object.freeze({__proto__:null,defaultErrorMap:ns,setErrorMap:Lh,getErrorMap:Da,makeIssue:Ma,EMPTY_PATH:Bh,addIssueToContext:B,ParseStatus:at,INVALID:te,DIRTY:Bu,OK:ft,isAborted:ho,isDirty:fo,isValid:ss,isAsync:$a,get util(){return be},get objectUtil(){return lo},ZodParsedType:M,getParsedType:Cr,ZodType:ue,ZodString:It,ZodNumber:Mr,ZodBigInt:$r,ZodBoolean:as,ZodDate:on,ZodSymbol:La,ZodUndefined:is,ZodNull:os,ZodAny:Zn,ZodUnknown:rn,ZodNever:Tr,ZodVoid:Ba,ZodArray:Rt,ZodObject:$e,ZodUnion:cs,ZodDiscriminatedUnion:Si,ZodIntersection:us,ZodTuple:Yt,ZodRecord:ls,ZodMap:Va,ZodSet:cn,ZodFunction:En,ZodLazy:ds,ZodLiteral:hs,ZodEnum:Lr,ZodNativeEnum:fs,ZodPromise:Rn,ZodEffects:Dt,ZodTransformer:Dt,ZodOptional:vr,ZodNullable:un,ZodDefault:ps,ZodCatch:Ka,ZodNaN:Fa,BRAND:ef,ZodBranded:Ku,ZodPipeline:Ws,ZodReadonly:Wa,custom:Fu,Schema:ue,ZodSchema:ue,late:tf,get ZodFirstPartyTypeKind(){return J},coerce:Uf,any:lf,array:pf,bigint:sf,boolean:Yu,date:af,discriminatedUnion:vf,effect:Vc,enum:Nf,function:xf,instanceof:rf,intersection:wf,lazy:Of,literal:Sf,map:kf,nan:nf,nativeEnum:Ef,never:hf,null:uf,nullable:Cf,number:qu,object:mf,oboolean:Pf,onumber:zf,optional:If,ostring:Rf,pipeline:Zf,preprocess:jf,promise:Af,record:bf,set:Tf,strictObject:yf,string:Wu,symbol:of,transformer:Vc,tuple:_f,undefined:cf,union:gf,unknown:df,void:ff,NEVER:Df,ZodIssueCode:I,quotelessJson:$h,ZodError:Zt});const Lo=S.tuple([S.number(),S.number()]),Ju=S.object({width:S.number(),height:S.number()}),Mf=S.object({signedWidth:S.number(),signedHeight:S.number()}),$f=["width","height"];S.enum($f);const Lf=["start","center","end"],Bf=["signedWidth","signedHeight"];S.enum(Bf);const qa=S.object({x:S.number(),y:S.number()}),Vf=S.object({clientX:S.number(),clientY:S.number()}),Kf=["x","y"],Gu=S.enum(Kf),Hu=["top","right","bottom","left"];S.enum(Hu);const Ff=["left","right"],Wf=S.enum(Ff),qf=["top","bottom"],Yf=S.enum(qf),Xu=["center"];S.enum(Xu);const Jf=[...Hu,...Xu],Ya=S.enum(Jf);S.enum(Lf);const Gf=["first","last"];S.enum(Gf);const Hf=S.object({lower:S.number(),upper:S.number()});S.union([Hf,Lo]);S.union([Gu,Ya]);S.union([Gu,Ya,S.instanceof(String)]);const ts=(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),Xf(t)},Xf=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r;var Ot=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},pe={},Ni={};Object.defineProperty(Ni,"__esModule",{value:!0});function Qf(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()}):""}Ni.default=Qf;var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});function ep(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():""}Ei.default=ep;var Ai={};Object.defineProperty(Ai,"__esModule",{value:!0});function tp(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()}):""}Ai.default=tp;var Bo={};Object.defineProperty(Bo,"__esModule",{value:!0});function rp(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():""}Bo.default=rp;var Vo={};Object.defineProperty(Vo,"__esModule",{value:!0});function np(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():""}Vo.default=np;var Ko={};Object.defineProperty(Ko,"__esModule",{value:!0});function sp(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():""}Ko.default=sp;var Fo={};Object.defineProperty(Fo,"__esModule",{value:!0});function ap(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)}Fo.default=ap;var Wo={};Object.defineProperty(Wo,"__esModule",{value:!0});function ip(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}):""}Wo.default=ip;var Ii={};Object.defineProperty(Ii,"__esModule",{value:!0});function op(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():""}Ii.default=op;var qo={},yn={};(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})}})(yn);var cp=Ot&&Ot.__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(qo,"__esModule",{value:!0});var rr=yn;function ma(r,e){if(e===void 0&&(e=rr.DefaultOption),!rr.isValidObject(r))return null;e=rr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toLowerCase();e.recursive&&(rr.isValidObject(s)?rr.belongToTypes(s,e.keepTypesOnRecursion)||(s=ma(s,e)):e.recursiveInArray&&rr.isArrayObject(s)&&(s=cp(s).map(function(i){var o=i;if(rr.isValidObject(i))rr.belongToTypes(o,e.keepTypesOnRecursion)||(o=ma(i,e));else if(rr.isArrayObject(i)){var c=ma({key:i},e);o=c.key}return o}))),t[a]=s}),t}qo.default=ma;var Yo={},up=Ot&&Ot.__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(Yo,"__esModule",{value:!0});var nr=yn;function ya(r,e){if(e===void 0&&(e=nr.DefaultOption),!nr.isValidObject(r))return null;e=nr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toUpperCase();e.recursive&&(nr.isValidObject(s)?nr.belongToTypes(s,e.keepTypesOnRecursion)||(s=ya(s,e)):e.recursiveInArray&&nr.isArrayObject(s)&&(s=up(s).map(function(i){var o=i;if(nr.isValidObject(i))nr.belongToTypes(o,e.keepTypesOnRecursion)||(o=ya(i,e));else if(nr.isArrayObject(i)){var c=ya({key:i},e);o=c.key}return o}))),t[a]=s}),t}Yo.default=ya;var Jo={},lp=Ot&&Ot.__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(Jo,"__esModule",{value:!0});var sr=yn,dp=Ni;function ga(r,e){if(e===void 0&&(e=sr.DefaultOption),!sr.isValidObject(r))return null;e=sr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=dp.default(n);e.recursive&&(sr.isValidObject(s)?sr.belongToTypes(s,e.keepTypesOnRecursion)||(s=ga(s,e)):e.recursiveInArray&&sr.isArrayObject(s)&&(s=lp(s).map(function(i){var o=i;if(sr.isValidObject(i))sr.belongToTypes(o,e.keepTypesOnRecursion)||(o=ga(i,e));else if(sr.isArrayObject(i)){var c=ga({key:i},e);o=c.key}return o}))),t[a]=s}),t}Jo.default=ga;var Go={},hp=Ot&&Ot.__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(Go,"__esModule",{value:!0});var ar=yn,fp=Ei;function va(r,e){if(e===void 0&&(e=ar.DefaultOption),!ar.isValidObject(r))return null;e=ar.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=fp.default(n);e.recursive&&(ar.isValidObject(s)?ar.belongToTypes(s,e.keepTypesOnRecursion)||(s=va(s,e)):e.recursiveInArray&&ar.isArrayObject(s)&&(s=hp(s).map(function(i){var o=i;if(ar.isValidObject(i))ar.belongToTypes(o,e.keepTypesOnRecursion)||(o=va(i,e));else if(ar.isArrayObject(i)){var c=va({key:i},e);o=c.key}return o}))),t[a]=s}),t}Go.default=va;var Ho={},pp=Ot&&Ot.__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(Ho,"__esModule",{value:!0});var ir=yn,mp=Ai;function wa(r,e){if(e===void 0&&(e=ir.DefaultOption),!ir.isValidObject(r))return null;e=ir.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=mp.default(n);e.recursive&&(ir.isValidObject(s)?ir.belongToTypes(s,e.keepTypesOnRecursion)||(s=wa(s,e)):e.recursiveInArray&&ir.isArrayObject(s)&&(s=pp(s).map(function(i){var o=i;if(ir.isValidObject(i))ir.belongToTypes(o,e.keepTypesOnRecursion)||(o=wa(i,e));else if(ir.isArrayObject(i)){var c=wa({key:i},e);o=c.key}return o}))),t[a]=s}),t}Ho.default=wa;var Xo={},yp=Ot&&Ot.__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(Xo,"__esModule",{value:!0});var or=yn,gp=Ii;function _a(r,e){if(e===void 0&&(e=or.DefaultOption),!or.isValidObject(r))return null;e=or.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=gp.default(n);e.recursive&&(or.isValidObject(s)?or.belongToTypes(s,e.keepTypesOnRecursion)||(s=_a(s,e)):e.recursiveInArray&&or.isArrayObject(s)&&(s=yp(s).map(function(i){var o=i;if(or.isValidObject(i))or.belongToTypes(o,e.keepTypesOnRecursion)||(o=_a(i,e));else if(or.isArrayObject(i)){var c=_a({key:i},e);o=c.key}return o}))),t[a]=s}),t}Xo.default=_a;Object.defineProperty(pe,"__esModule",{value:!0});pe.kebabKeys=pe.pascalKeys=pe.snakeKeys=pe.camelKeys=pe.upperKeys=pe.lowerKeys=pe.toLowerCase=pe.toUpperCase=pe.toKebabCase=pe.toHeaderCase=pe.toSentenceCase=pe.toTextCase=pe.toPathCase=pe.toDotCase=pe.toPascalCase=pe.toSnakeCase=pe.toCamelCase=void 0;var Qu=Ni;pe.toCamelCase=Qu.default;var el=Ei;pe.toSnakeCase=el.default;var tl=Ai;pe.toPascalCase=tl.default;var rl=Bo;pe.toDotCase=rl.default;var nl=Vo;pe.toPathCase=nl.default;var sl=Ko;pe.toTextCase=sl.default;var al=Fo;pe.toSentenceCase=al.default;var il=Wo;pe.toHeaderCase=il.default;var ol=Ii;pe.toKebabCase=ol.default;var cl=qo;pe.lowerKeys=cl.default;var ul=Yo;pe.upperKeys=ul.default;var ll=Jo;pe.camelKeys=ll.default;var dl=Go;pe.snakeKeys=dl.default;var hl=Ho;pe.pascalKeys=hl.default;var fl=Xo;pe.kebabKeys=fl.default;var pl=function(r){return String(r||"").toLowerCase()};pe.toLowerCase=pl;var ml=function(r){return String(r||"").toUpperCase()};pe.toUpperCase=ml;var vp={toCamelCase:Qu.default,toSnakeCase:el.default,toPascalCase:tl.default,toDotCase:rl.default,toPathCase:nl.default,toTextCase:sl.default,toSentenceCase:al.default,toHeaderCase:il.default,toKebabCase:ol.default,toUpperCase:ml,toLowerCase:pl,lowerKeys:cl.default,upperKeys:ul.default,camelKeys:ll.default,snakeKeys:dl.default,pascalKeys:hl.default,kebabKeys:fl.default};pe.default=vp;var yl=pe;const gl={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},wp=r=>yl.snakeKeys(r,gl),_p=r=>yl.camelKeys(r,gl);var zn;(r=>{r.toSnake=wp,r.toCamel=_p,r.capitalize=e=>e[0].toUpperCase()+e.slice(1)})(zn||(zn={}));S.object({x:Ya,y:Ya});const bp=S.object({x:Wf,y:Yf}),kp={x:"left",y:"top"},Tp=(r,e)=>r.x===e.x&&r.y===e.y,Kc=S.union([S.number(),qa,Lo,Ju,Mf,Vf]),xp=(r,e)=>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},Fc={x:0,y:0},oa=S.union([S.number(),S.string()]);S.object({top:oa,left:oa,width:oa,height:oa});S.object({left:S.number(),top:S.number(),right:S.number(),bottom:S.number()});S.object({one:qa,two:qa,root:bp});const Qo=(r,e,t=0,n=0,s)=>{const a={one:{...Fc},two:{...Fc},root:s??kp};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))},Hi=r=>{const e=Qo(r);return{lower:e.one.x,upper:e.two.x}},Xi=r=>{const e=Qo(r);return{lower:e.one.y,upper:e.two.y}},Op=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Sp=S.object({signedWidth:S.number(),signedHeight:S.number()});S.union([Ju,Sp,qa,Lo]);const Np=(r,e,t)=>(e!=null&&(r=Math.max(r,e)),t!=null&&(r=Math.min(r,t)),r);S.object({offset:Kc,scale:Kc});const Ep=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],Ap=r=>(e,t,n,s)=>[e,s?n/r:n*r],Ip=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:i,upper:o}=r,c=a-s,d=o-i;if(t==="dimension")return[r,n*(d/c)];const w=(n-s)*(d/c)+i;return[r,w]},Cp=r=>(e,t,n)=>[r,n],jp=()=>(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)]},Zp=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=Np(n,s,a),[e,n]},mo=class Gn{constructor(){E(this,"ops",[]),E(this,"currBounds",null),E(this,"currType",null),E(this,"reversed",!1),this.ops=[]}static translate(e){return new Gn().translate(e)}static magnify(e){return new Gn().magnify(e)}static scale(e,t){return new Gn().scale(e,t)}translate(e){const t=this.new(),n=Ep(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Ap(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=ts(e,t),s=this.new(),a=Ip(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=ts(e,t),s=this.new(),a=Zp(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=ts(e,t),s=this.new(),a=Cp(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=jp();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 Gn;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}};E(mo,"IDENTITY",new mo);let Wc=mo;const qc=class pr{constructor(e=new Wc,t=new Wc,n=null){E(this,"x"),E(this,"y"),E(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new pr().translate(e,t)}static translateX(e){return new pr().translateX(e)}static translateY(e){return new pr().translateY(e)}static clamp(e){return new pr().clamp(e)}static magnify(e){return new pr().magnify(e)}static scale(e){return new pr().scale(e)}static reBound(e){return new pr().reBound(e)}translate(e,t){const n=xp(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(Op(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Tp(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(Hi(e)),t.y=t.y.scale(Xi(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(Hi(e)),t.y=this.y.reBound(Xi(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(Hi(e)),t.y=this.y.clamp(Xi(e)),t}copy(){const e=new pr;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 Qo(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};E(qc,"IDENTITY",new qc);const vl=(r,e)=>{const t=new Ue(e);if(![Pe.DAY,Pe.HOUR,Pe.MINUTE,Pe.SECOND,Pe.MILLISECOND,Pe.MICROSECOND,Pe.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 Ue?new Ue(n):new Pe(n)},Ce=class he extends Number{constructor(e,t="UTC"){if(e==null)return he.now();if(e instanceof Date)super(e.getTime()*he.MILLISECOND.valueOf());else if(typeof e=="string")super(he.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(he.parseDate(e));else{let n=0;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=he.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 he(s.getTime()*he.MILLISECOND.valueOf()).truncate(he.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 c=he.hours(parseInt(n??"00",10)).add(he.minutes(parseInt(s??"00",10))).add(he.seconds(parseInt(i??"00",10))).add(he.milliseconds(parseInt(o??"00",10)));return t==="local"&&(c=c.add(he.utcOffset)),c.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return he.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new he(n.getTime()*he.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(he.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 Pe(new Date().getTimezoneOffset()*he.MINUTE.valueOf())}static since(e){return new he().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new he(e).valueOf()}span(e){return this.range(e).span}range(e){return new Ct(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0}after(e){return this.valueOf()>new he(e).valueOf()}afterEq(e){return this.valueOf()>=new he(e).valueOf()}before(e){return this.valueOf()<new he(e).valueOf()}beforeEq(e){return this.valueOf()<=new he(e).valueOf()}add(e){return new he(this.valueOf()+e.valueOf())}sub(e){return new he(this.valueOf()-e.valueOf())}milliseconds(){return this.valueOf()/he.MILLISECOND.valueOf()}toString(){return this.date().toISOString()}remainder(e){return vl(this,e)}get isToday(){return this.truncate(Pe.DAY).equals(he.now().truncate(Pe.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new he(new Date)}static nanoseconds(e){return new he(e)}static microseconds(e){return he.nanoseconds(e*1e3)}static milliseconds(e){return he.microseconds(e*1e3)}static seconds(e){return he.milliseconds(e*1e3)}static minutes(e){return he.seconds(e*60)}static hours(e){return he.minutes(e*60)}static days(e){return he.hours(e*24)}};E(Ce,"NANOSECOND",Ce.nanoseconds(1));E(Ce,"MICROSECOND",Ce.microseconds(1));E(Ce,"MILLISECOND",Ce.milliseconds(1));E(Ce,"SECOND",Ce.seconds(1));E(Ce,"MINUTE",Ce.minutes(1));E(Ce,"HOUR",Ce.hours(1));E(Ce,"DAY",Ce.days(1));E(Ce,"MAX",new Ce(9122272036554776e3));E(Ce,"MIN",new Ce(0));E(Ce,"ZERO",new Ce(0));E(Ce,"z",S.union([S.instanceof(Number).transform(r=>new Ce(r)),S.number().transform(r=>new Ce(r)),S.instanceof(Ce)]));let Ue=Ce;const Ae=class Oe extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}remainder(e){return vl(this,e)}truncate(e){return new Oe(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}toString(){const e=this.truncate(Oe.DAY),t=this.truncate(Oe.HOUR),n=this.truncate(Oe.MINUTE),s=this.truncate(Oe.SECOND),a=this.truncate(Oe.MILLISECOND),i=this.truncate(Oe.MICROSECOND),o=this.truncate(Oe.NANOSECOND),c=e,d=t.sub(e),w=n.sub(t),D=s.sub(n),X=a.sub(s),Q=i.sub(a),Ze=o.sub(i);let ee="";return c.isZero||(ee+=`${c.days}d `),d.isZero||(ee+=`${d.hours}h `),w.isZero||(ee+=`${w.minutes}m `),D.isZero||(ee+=`${D.seconds}s `),X.isZero||(ee+=`${X.milliseconds}ms `),Q.isZero||(ee+=`${Q.microseconds}µs `),Ze.isZero||(ee+=`${Ze.nanoseconds}ns`),ee.trim()}get days(){return this.valueOf()/Oe.DAY.valueOf()}get hours(){return this.valueOf()/Oe.HOUR.valueOf()}get minutes(){return this.valueOf()/Oe.MINUTE.valueOf()}get seconds(){return this.valueOf()/Oe.SECOND.valueOf()}get milliseconds(){return this.valueOf()/Oe.MILLISECOND.valueOf()}get microseconds(){return this.valueOf()/Oe.MICROSECOND.valueOf()}get nanoseconds(){return this.valueOf()}get isZero(){return this.valueOf()===0}equals(e){return this.valueOf()===new Oe(e).valueOf()}add(e){return new Oe(this.valueOf()+new Oe(e).valueOf())}sub(e){return new Oe(this.valueOf()-new Oe(e).valueOf())}static nanoseconds(e=1){return new Oe(e)}static microseconds(e=1){return Oe.nanoseconds(e*1e3)}static milliseconds(e=1){return Oe.microseconds(e*1e3)}static seconds(e=1){return Oe.milliseconds(e*1e3)}static minutes(e){return Oe.seconds(e.valueOf()*60)}static hours(e){return Oe.minutes(e*60)}static days(e){return Oe.hours(e*24)}};E(Ae,"NANOSECOND",Ae.nanoseconds(1));E(Ae,"MICROSECOND",Ae.microseconds(1));E(Ae,"MILLISECOND",Ae.milliseconds(1));E(Ae,"SECOND",Ae.seconds(1));E(Ae,"MINUTE",Ae.minutes(1));E(Ae,"HOUR",Ae.hours(1));E(Ae,"DAY",Ae.days(1));E(Ae,"MAX",new Ae(Ae.MAX_SAFE_INTEGER));E(Ae,"MIN",new Ae(-Ae.MAX_SAFE_INTEGER));E(Ae,"ZERO",new Ae(0));E(Ae,"z",S.union([S.instanceof(Number).transform(r=>new Ae(r)),S.number().transform(r=>new Ae(r)),S.instanceof(Ae)]));let Pe=Ae;const Hn=class ba extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new ba(e).valueOf()}get period(){return Pe.seconds(1/this.valueOf())}sampleCount(e){return new Pe(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new rt(t).valueOf()}span(e){return Pe.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new ba(e)}static khz(e){return ba.hz(e*1e3)}};E(Hn,"z",S.union([S.number().transform(r=>new Hn(r)),S.instanceof(Number).transform(r=>new Hn(r)),S.instanceof(Hn)]));let qs=Hn;const Qe=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Ja(e*this.valueOf())}};E(Qe,"UNKNOWN",new Qe(0));E(Qe,"BIT128",new Qe(16));E(Qe,"BIT64",new Qe(8));E(Qe,"BIT32",new Qe(4));E(Qe,"BIT16",new Qe(2));E(Qe,"BIT8",new Qe(1));E(Qe,"z",S.union([S.number().transform(r=>new Qe(r)),S.instanceof(Number).transform(r=>new Qe(r)),S.instanceof(Qe)]));let rt=Qe;const Ft=class ka{constructor(e,t){E(this,"start"),E(this,"end"),this.start=new Ue(e),this.end=new Ue(t)}get span(){return new Pe(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 ka(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 ka?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new ka(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}};E(Ft,"MAX",new Ft(Ue.MIN,Ue.MAX));E(Ft,"MIN",new Ft(Ue.MAX,Ue.MIN));E(Ft,"ZERO",new Ft(Ue.ZERO,Ue.ZERO));E(Ft,"z",S.union([S.object({start:Ue.z,end:Ue.z}).transform(r=>new Ft(r.start,r.end)),S.instanceof(Ft)]));let Ct=Ft;const x=class en extends String{constructor(e){if(e instanceof en||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const t=en.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}}throw super(en.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=en.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=en.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 en.BIG_INT_TYPES.some(e=>e.equals(this))}};E(x,"UNKNOWN",new x("unknown"));E(x,"FLOAT64",new x("float64"));E(x,"FLOAT32",new x("float32"));E(x,"INT64",new x("int64"));E(x,"INT32",new x("int32"));E(x,"INT16",new x("int16"));E(x,"INT8",new x("int8"));E(x,"UINT64",new x("uint64"));E(x,"UINT32",new x("uint32"));E(x,"UINT16",new x("uint16"));E(x,"UINT8",new x("uint8"));E(x,"TIMESTAMP",new x("timestamp"));E(x,"UUID",new x("uuid"));E(x,"STRING",new x("string"));E(x,"JSON",new x("json"));E(x,"ARRAY_CONSTRUCTORS",new Map([[x.UINT8.toString(),Uint8Array],[x.UINT16.toString(),Uint16Array],[x.UINT32.toString(),Uint32Array],[x.UINT64.toString(),BigUint64Array],[x.FLOAT32.toString(),Float32Array],[x.FLOAT64.toString(),Float64Array],[x.INT8.toString(),Int8Array],[x.INT16.toString(),Int16Array],[x.INT32.toString(),Int32Array],[x.INT64.toString(),BigInt64Array],[x.TIMESTAMP.toString(),BigInt64Array],[x.STRING.toString(),Uint8Array],[x.JSON.toString(),Uint8Array],[x.UUID.toString(),Uint8Array]]));E(x,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,x.UINT8],[Uint16Array.name,x.UINT16],[Uint32Array.name,x.UINT32],[BigUint64Array.name,x.UINT64],[Float32Array.name,x.FLOAT32],[Float64Array.name,x.FLOAT64],[Int8Array.name,x.INT8],[Int16Array.name,x.INT16],[Int32Array.name,x.INT32],[BigInt64Array.name,x.INT64]]));E(x,"DENSITIES",new Map([[x.UINT8.toString(),rt.BIT8],[x.UINT16.toString(),rt.BIT16],[x.UINT32.toString(),rt.BIT32],[x.UINT64.toString(),rt.BIT64],[x.FLOAT32.toString(),rt.BIT32],[x.FLOAT64.toString(),rt.BIT64],[x.INT8.toString(),rt.BIT8],[x.INT16.toString(),rt.BIT16],[x.INT32.toString(),rt.BIT32],[x.INT64.toString(),rt.BIT64],[x.TIMESTAMP.toString(),rt.BIT64],[x.STRING.toString(),rt.UNKNOWN],[x.JSON.toString(),rt.UNKNOWN],[x.UUID.toString(),rt.BIT128]]));E(x,"ALL",[x.UNKNOWN,x.FLOAT64,x.FLOAT32,x.INT64,x.INT32,x.INT16,x.INT8,x.UINT64,x.UINT32,x.UINT16,x.UINT8,x.TIMESTAMP,x.UUID,x.STRING,x.JSON]);E(x,"BIG_INT_TYPES",[x.INT64,x.UINT64,x.TIMESTAMP]);E(x,"z",S.union([S.string().transform(r=>new x(r)),S.instanceof(x)]));let Ye=x;const nt=class Sr extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Sr.bytes(this.valueOf()+e.valueOf())}sub(e){return Sr.bytes(this.valueOf()-e.valueOf())}static bytes(e=1){return new Sr(e)}static kilobytes(e=1){return Sr.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Sr.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Sr.megabytes(e.valueOf()*1e3)}static terabytes(e){return Sr.gigabytes(e.valueOf()*1e3)}isZero(){return this.valueOf()===0}};E(nt,"BYTE",new nt(1));E(nt,"KILOBYTE",nt.kilobytes(1));E(nt,"MEGABYTE",nt.megabytes(1));E(nt,"GIGABYTE",nt.gigabytes(1));E(nt,"TERABYTE",nt.terabytes(1));E(nt,"ZERO",new nt(0));E(nt,"z",S.union([S.number().transform(r=>new nt(r)),S.instanceof(nt)]));let Ja=nt;S.union([S.instanceof(Uint8Array),S.instanceof(Uint16Array),S.instanceof(Uint32Array),S.instanceof(BigUint64Array),S.instanceof(Float32Array),S.instanceof(Float64Array),S.instanceof(Int8Array),S.instanceof(Int16Array),S.instanceof(Int32Array),S.instanceof(BigInt64Array)]);const Rp=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t)-BigInt(n):Xn(t,-n),zp=(r,e)=>{if(e==null)throw new Error(`field ${r} is null`)},Hr=-1;class At{constructor({data:e,dataType:t,timeRange:n,sampleOffset:s=0,glBufferUsage:a="static",alignment:i=0,key:o=Ph()}){if(E(this,"key",""),E(this,"dataType"),E(this,"sampleOffset"),E(this,"gl"),E(this,"_data"),E(this,"_timeRange"),E(this,"alignment",0),E(this,"_min"),E(this,"_max"),E(this,"writePos",Hr),E(this,"_refCount",0),t==null&&!(e instanceof ArrayBuffer))this.dataType=new Ye(e);else if(t!=null)this.dataType=new Ye(t);else throw new Error("must provide a data type when constructing a Series from a buffer");this.key=o,this.alignment=i,this.sampleOffset=s??0,this._data=e,this._timeRange=n,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:a}}static alloc({length:e,dataType:t,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const s=new new Ye(t).Array(e),a=new At({data:s.buffer,dataType:t,...n});return a.writePos=0,a}static generateTimestamps(e,t,n){const s=n.spanRange(t.span(e)),a=new BigInt64Array(e);for(let i=0;i<e;i++)a[i]=BigInt(n.add(t.span(i)).valueOf());return new At({data:a,dataType:Ye.TIMESTAMP,timeRange:s})}get refCount(){return this._refCount}static fromStrings(e,t){const n=new TextEncoder().encode(e.join(`
|
|
1
|
+
"use strict";var Ch=Object.defineProperty;var jh=(r,e,t)=>e in r?Ch(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var h=(r,e,t)=>(jh(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("zod");var Zh=Object.defineProperty,Rh=(r,e,t)=>e in r?Zh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,E=(r,e,t)=>(Rh(r,typeof e!="symbol"?e+"":e,t),t),wn;let zh="_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",Ph=(r=21)=>{let e="",t=r;for(;t--;)e+=zh[Math.random()*64|0];return e};const Uh=r=>r!=null&&typeof r=="object"&&"toString"in r,Dh=(r,e=!1)=>{const t=Uh(r)?"stringer":typeof r;let n;switch(t){case"string":n=(s,a)=>s.localeCompare(a);break;case"stringer":n=(s,a)=>s.toString().localeCompare(a.toString());break;case"number":n=(s,a)=>s-a;break;case"bigint":n=(s,a)=>s-a>BigInt(0)?1:-1;break;case"boolean":n=(s,a)=>Number(s)-Number(a);break;default:return console.warn("sortFunc: unknown type"),()=>-1}return e?Mh(n):n},Mh=r=>(e,t)=>r(t,e);var be;(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})(be||(be={}));var lo;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(lo||(lo={}));const M=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Cr=r=>{switch(typeof r){case"undefined":return M.undefined;case"string":return M.string;case"number":return isNaN(r)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(r)?M.array:r===null?M.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?M.promise:typeof Map<"u"&&r instanceof Map?M.map:typeof Set<"u"&&r instanceof Set?M.set:typeof Date<"u"&&r instanceof Date?M.date:M.object;default:return M.unknown}},I=be.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"]),$h=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Zt 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,c=0;for(;c<i.path.length;){const d=i.path[c];c===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],c++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.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()}}Zt.create=r=>new Zt(r);const ns=(r,e)=>{let t;switch(r.code){case I.invalid_type:r.received===M.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case I.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,be.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:t=`Unrecognized key(s) in object: ${be.joinValues(r.keys,", ")}`;break;case I.invalid_union:t="Invalid input";break;case I.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${be.joinValues(r.options)}`;break;case I.invalid_enum_value:t=`Invalid enum value. Expected ${be.joinValues(r.options)}, received '${r.received}'`;break;case I.invalid_arguments:t="Invalid function arguments";break;case I.invalid_return_type:t="Invalid function return type";break;case I.invalid_date:t="Invalid date";break;case I.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}"`:be.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case I.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 I.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 I.custom:t="Invalid input";break;case I.invalid_intersection_types:t="Intersection results could not be merged";break;case I.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case I.not_finite:t="Number must be finite";break;default:t=e.defaultError,be.assertNever(r)}return{message:t}};let Lu=ns;function Lh(r){Lu=r}function Da(){return Lu}const Ma=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const c=n.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},Bh=[];function B(r,e){const t=Ma({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Da(),ns].filter(n=>!!n)});r.common.issues.push(t)}class at{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 te;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 at.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 te;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 te=Object.freeze({status:"aborted"}),Bu=r=>({status:"dirty",value:r}),ft=r=>({status:"valid",value:r}),ho=r=>r.status==="aborted",fo=r=>r.status==="dirty",ss=r=>r.status==="valid",$a=r=>typeof Promise<"u"&&r instanceof Promise;var W;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(W||(W={}));class qt{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 Bc=(r,e)=>{if(ss(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 Zt(r.common.issues);return this._error=t,this._error}}};function ie(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 ue{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 Cr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Cr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new at,ctx:{common:e.parent.common,data:e.data,parsedType:Cr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if($a(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:Cr(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Bc(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:Cr(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await($a(s)?s:Promise.resolve(s));return Bc(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:I.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!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 Dt({schema:this,typeName:J.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return vr.create(this,this._def)}nullable(){return un.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rt.create(this,this._def)}promise(){return Rn.create(this,this._def)}or(e){return cs.create([this,e],this._def)}and(e){return us.create(this,e,this._def)}transform(e){return new Dt({...ie(this._def),schema:this,typeName:J.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ps({...ie(this._def),innerType:this,defaultValue:t,typeName:J.ZodDefault})}brand(){return new Ku({typeName:J.ZodBranded,type:this,...ie(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ka({...ie(this._def),innerType:this,catchValue:t,typeName:J.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ws.create(this,e)}readonly(){return Wa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Vh=/^c[^\s-]{8,}$/i,Kh=/^[a-z][a-z0-9]*$/,Fh=/^[0-9A-HJKMNP-TV-Z]{26}$/,Wh=/^[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,qh=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Gi;const Jh=/^(((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}))$/,Gh=/^(([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})))$/,Hh=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 Xh(r,e){return!!((e==="v4"||!e)&&Jh.test(r)||(e==="v6"||!e)&&Gh.test(r))}class It extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==M.string){const a=this._getOrReturnCtx(e);return B(a,{code:I.invalid_type,expected:M.string,received:a.parsedType}),te}const n=new at;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:I.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),B(s,{code:I.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?B(s,{code:I.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&B(s,{code:I.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")qh.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"email",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Gi||(Gi=new RegExp(Yh,"u")),Gi.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"emoji",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Wh.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"uuid",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Vh.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cuid",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Kh.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cuid2",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Fh.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"ulid",code:I.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),B(s,{validation:"url",code:I.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),B(s,{validation:"regex",code:I.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),B(s,{code:I.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),B(s,{code:I.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),B(s,{code:I.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Hh(a).test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:I.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?Xh(e.data,a.version)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"ip",code:I.invalid_string,message:a.message}),n.dirty()):be.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:I.invalid_string,...W.errToObj(n)})}_addCheck(e){return new It({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...W.errToObj(e)})}url(e){return this._addCheck({kind:"url",...W.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...W.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...W.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...W.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...W.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...W.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,...W.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...W.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...W.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...W.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...W.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...W.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...W.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...W.errToObj(t)})}nonempty(e){return this.min(1,W.errToObj(e))}trim(){return new It({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new It({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new It({...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}}It.create=r=>{var e;return new It({checks:[],typeName:J.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ie(r)})};function Qh(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 Mr extends ue{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)!==M.number){const a=this._getOrReturnCtx(e);return B(a,{code:I.invalid_type,expected:M.number,received:a.parsedType}),te}let n;const s=new at;for(const a of this._def.checks)a.kind==="int"?be.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:I.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),B(n,{code:I.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),B(n,{code:I.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Qh(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:I.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:I.not_finite,message:a.message}),s.dirty()):be.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,W.toString(t))}gt(e,t){return this.setLimit("min",e,!1,W.toString(t))}lte(e,t){return this.setLimit("max",e,!0,W.toString(t))}lt(e,t){return this.setLimit("max",e,!1,W.toString(t))}setLimit(e,t,n,s){return new Mr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:W.toString(s)}]})}_addCheck(e){return new Mr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:W.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:W.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:W.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:W.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"&&be.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)}}Mr.create=r=>new Mr({checks:[],typeName:J.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...ie(r)});class $r extends ue{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)!==M.bigint){const a=this._getOrReturnCtx(e);return B(a,{code:I.invalid_type,expected:M.bigint,received:a.parsedType}),te}let n;const s=new at;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),B(n,{code:I.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),B(n,{code:I.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),B(n,{code:I.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):be.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,W.toString(t))}gt(e,t){return this.setLimit("min",e,!1,W.toString(t))}lte(e,t){return this.setLimit("max",e,!0,W.toString(t))}lt(e,t){return this.setLimit("max",e,!1,W.toString(t))}setLimit(e,t,n,s){return new $r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:W.toString(s)}]})}_addCheck(e){return new $r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:W.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}}$r.create=r=>{var e;return new $r({checks:[],typeName:J.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ie(r)})};class as extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==M.boolean){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.boolean,received:n.parsedType}),te}return ft(e.data)}}as.create=r=>new as({typeName:J.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...ie(r)});class on extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==M.date){const a=this._getOrReturnCtx(e);return B(a,{code:I.invalid_type,expected:M.date,received:a.parsedType}),te}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return B(a,{code:I.invalid_date}),te}const n=new at;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:I.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),B(s,{code:I.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):be.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new on({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:W.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:W.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}}on.create=r=>new on({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:J.ZodDate,...ie(r)});class La extends ue{_parse(e){if(this._getType(e)!==M.symbol){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.symbol,received:n.parsedType}),te}return ft(e.data)}}La.create=r=>new La({typeName:J.ZodSymbol,...ie(r)});class is extends ue{_parse(e){if(this._getType(e)!==M.undefined){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.undefined,received:n.parsedType}),te}return ft(e.data)}}is.create=r=>new is({typeName:J.ZodUndefined,...ie(r)});class os extends ue{_parse(e){if(this._getType(e)!==M.null){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.null,received:n.parsedType}),te}return ft(e.data)}}os.create=r=>new os({typeName:J.ZodNull,...ie(r)});class Zn extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}Zn.create=r=>new Zn({typeName:J.ZodAny,...ie(r)});class rn extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}rn.create=r=>new rn({typeName:J.ZodUnknown,...ie(r)});class Tr extends ue{_parse(e){const t=this._getOrReturnCtx(e);return B(t,{code:I.invalid_type,expected:M.never,received:t.parsedType}),te}}Tr.create=r=>new Tr({typeName:J.ZodNever,...ie(r)});class Ba extends ue{_parse(e){if(this._getType(e)!==M.undefined){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.void,received:n.parsedType}),te}return ft(e.data)}}Ba.create=r=>new Ba({typeName:J.ZodVoid,...ie(r)});class Rt extends ue{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==M.array)return B(t,{code:I.invalid_type,expected:M.array,received:t.parsedType}),te;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(B(t,{code:i?I.too_big:I.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&&(B(t,{code:I.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&&(B(t,{code:I.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 qt(t,i,t.path,o)))).then(i=>at.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new qt(t,i,t.path,o)));return at.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Rt({...this._def,minLength:{value:e,message:W.toString(t)}})}max(e,t){return new Rt({...this._def,maxLength:{value:e,message:W.toString(t)}})}length(e,t){return new Rt({...this._def,exactLength:{value:e,message:W.toString(t)}})}nonempty(e){return this.min(1,e)}}Rt.create=(r,e)=>new Rt({type:r,minLength:null,maxLength:null,exactLength:null,typeName:J.ZodArray,...ie(e)});function Tn(r){if(r instanceof $e){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=vr.create(Tn(n))}return new $e({...r._def,shape:()=>e})}else return r instanceof Rt?new Rt({...r._def,type:Tn(r.element)}):r instanceof vr?vr.create(Tn(r.unwrap())):r instanceof un?un.create(Tn(r.unwrap())):r instanceof Yt?Yt.create(r.items.map(e=>Tn(e))):r}class $e extends ue{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=be.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==M.object){const d=this._getOrReturnCtx(e);return B(d,{code:I.invalid_type,expected:M.object,received:d.parsedType}),te}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Tr&&this._def.unknownKeys==="strip"))for(const d in s.data)i.includes(d)||o.push(d);const c=[];for(const d of i){const w=a[d],D=s.data[d];c.push({key:{status:"valid",value:d},value:w._parse(new qt(s,D,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof Tr){const d=this._def.unknownKeys;if(d==="passthrough")for(const w of o)c.push({key:{status:"valid",value:w},value:{status:"valid",value:s.data[w]}});else if(d==="strict")o.length>0&&(B(s,{code:I.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const w of o){const D=s.data[w];c.push({key:{status:"valid",value:w},value:d._parse(new qt(s,D,s.path,w)),alwaysSet:w in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const w of c){const D=await w.key;d.push({key:D,value:await w.value,alwaysSet:w.alwaysSet})}return d}).then(d=>at.mergeObjectSync(n,d)):at.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return W.errToObj,new $e({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const c=(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=W.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new $e({...this._def,unknownKeys:"strip"})}passthrough(){return new $e({...this._def,unknownKeys:"passthrough"})}extend(e){return new $e({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new $e({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:J.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new $e({...this._def,catchall:e})}pick(e){const t={};return be.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new $e({...this._def,shape:()=>t})}omit(e){const t={};return be.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new $e({...this._def,shape:()=>t})}deepPartial(){return Tn(this)}partial(e){const t={};return be.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new $e({...this._def,shape:()=>t})}required(e){const t={};return be.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof vr;)a=a._def.innerType;t[n]=a}}),new $e({...this._def,shape:()=>t})}keyof(){return Vu(be.objectKeys(this.shape))}}$e.create=(r,e)=>new $e({shape:()=>r,unknownKeys:"strip",catchall:Tr.create(),typeName:J.ZodObject,...ie(e)});$e.strictCreate=(r,e)=>new $e({shape:()=>r,unknownKeys:"strict",catchall:Tr.create(),typeName:J.ZodObject,...ie(e)});$e.lazycreate=(r,e)=>new $e({shape:r,unknownKeys:"strip",catchall:Tr.create(),typeName:J.ZodObject,...ie(e)});class cs extends ue{_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 Zt(o.ctx.common.issues));return B(t,{code:I.invalid_union,unionErrors:i}),te}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 c of n){const d={...t,common:{...t.common,issues:[]},parent:null},w=c._parseSync({data:t.data,path:t.path,parent:d});if(w.status==="valid")return w;w.status==="dirty"&&!a&&(a={result:w,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new Zt(c));return B(t,{code:I.invalid_union,unionErrors:o}),te}}get options(){return this._def.options}}cs.create=(r,e)=>new cs({options:r,typeName:J.ZodUnion,...ie(e)});const pa=r=>r instanceof ds?pa(r.schema):r instanceof Dt?pa(r.innerType()):r instanceof hs?[r.value]:r instanceof Lr?r.options:r instanceof fs?Object.keys(r.enum):r instanceof ps?pa(r._def.innerType):r instanceof is?[void 0]:r instanceof os?[null]:null;class Si extends ue{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==M.object)return B(t,{code:I.invalid_type,expected:M.object,received:t.parsedType}),te;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}):(B(t,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),te)}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=pa(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 Si({typeName:J.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...ie(n)})}}function po(r,e){const t=Cr(r),n=Cr(e);if(r===e)return{valid:!0,data:r};if(t===M.object&&n===M.object){const s=be.objectKeys(e),a=be.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=po(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===M.array&&n===M.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],c=po(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===M.date&&n===M.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class us extends ue{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(ho(a)||ho(i))return te;const o=po(a.value,i.value);return o.valid?((fo(a)||fo(i))&&t.dirty(),{status:t.value,value:o.data}):(B(n,{code:I.invalid_intersection_types}),te)};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}))}}us.create=(r,e,t)=>new us({left:r,right:e,typeName:J.ZodIntersection,...ie(t)});class Yt extends ue{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.array)return B(n,{code:I.invalid_type,expected:M.array,received:n.parsedType}),te;if(n.data.length<this._def.items.length)return B(n,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),te;!this._def.rest&&n.data.length>this._def.items.length&&(B(n,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new qt(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>at.mergeArray(t,i)):at.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Yt({...this._def,rest:e})}}Yt.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Yt({items:r,typeName:J.ZodTuple,rest:null,...ie(e)})};class ls extends ue{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!==M.object)return B(n,{code:I.invalid_type,expected:M.object,received:n.parsedType}),te;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new qt(n,o,n.path,o)),value:i._parse(new qt(n,n.data[o],n.path,o))});return n.common.async?at.mergeObjectAsync(t,s):at.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof ue?new ls({keyType:e,valueType:t,typeName:J.ZodRecord,...ie(n)}):new ls({keyType:It.create(),valueType:e,typeName:J.ZodRecord,...ie(t)})}}class Va extends ue{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!==M.map)return B(n,{code:I.invalid_type,expected:M.map,received:n.parsedType}),te;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],d)=>({key:s._parse(new qt(n,o,n.path,[d,"key"])),value:a._parse(new qt(n,c,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const d=await c.key,w=await c.value;if(d.status==="aborted"||w.status==="aborted")return te;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const d=c.key,w=c.value;if(d.status==="aborted"||w.status==="aborted")return te;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}}}}Va.create=(r,e,t)=>new Va({valueType:e,keyType:r,typeName:J.ZodMap,...ie(t)});class cn extends ue{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.set)return B(n,{code:I.invalid_type,expected:M.set,received:n.parsedType}),te;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(B(n,{code:I.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&&(B(n,{code:I.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(c){const d=new Set;for(const w of c){if(w.status==="aborted")return te;w.status==="dirty"&&t.dirty(),d.add(w.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((c,d)=>a._parse(new qt(n,c,n.path,d)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new cn({...this._def,minSize:{value:e,message:W.toString(t)}})}max(e,t){return new cn({...this._def,maxSize:{value:e,message:W.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}cn.create=(r,e)=>new cn({valueType:r,minSize:null,maxSize:null,typeName:J.ZodSet,...ie(e)});class En extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==M.function)return B(t,{code:I.invalid_type,expected:M.function,received:t.parsedType}),te;function n(o,c){return Ma({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Da(),ns].filter(d=>!!d),issueData:{code:I.invalid_arguments,argumentsError:c}})}function s(o,c){return Ma({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Da(),ns].filter(d=>!!d),issueData:{code:I.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Rn){const o=this;return ft(async function(...c){const d=new Zt([]),w=await o._def.args.parseAsync(c,a).catch(Q=>{throw d.addIssue(n(c,Q)),d}),D=await Reflect.apply(i,this,w);return await o._def.returns._def.type.parseAsync(D,a).catch(Q=>{throw d.addIssue(s(D,Q)),d})})}else{const o=this;return ft(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new Zt([n(c,d.error)]);const w=Reflect.apply(i,this,d.data),D=o._def.returns.safeParse(w,a);if(!D.success)throw new Zt([s(w,D.error)]);return D.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new En({...this._def,args:Yt.create(e).rest(rn.create())})}returns(e){return new En({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new En({args:e||Yt.create([]).rest(rn.create()),returns:t||rn.create(),typeName:J.ZodFunction,...ie(n)})}}class ds extends ue{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})}}ds.create=(r,e)=>new ds({getter:r,typeName:J.ZodLazy,...ie(e)});class hs extends ue{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return B(t,{received:t.data,code:I.invalid_literal,expected:this._def.value}),te}return{status:"valid",value:e.data}}get value(){return this._def.value}}hs.create=(r,e)=>new hs({value:r,typeName:J.ZodLiteral,...ie(e)});function Vu(r,e){return new Lr({values:r,typeName:J.ZodEnum,...ie(e)})}class Lr extends ue{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return B(t,{expected:be.joinValues(n),received:t.parsedType,code:I.invalid_type}),te}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return B(t,{received:t.data,code:I.invalid_enum_value,options:n}),te}return ft(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 Lr.create(e)}exclude(e){return Lr.create(this.options.filter(t=>!e.includes(t)))}}Lr.create=Vu;class fs extends ue{_parse(e){const t=be.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==M.string&&n.parsedType!==M.number){const s=be.objectValues(t);return B(n,{expected:be.joinValues(s),received:n.parsedType,code:I.invalid_type}),te}if(t.indexOf(e.data)===-1){const s=be.objectValues(t);return B(n,{received:n.data,code:I.invalid_enum_value,options:s}),te}return ft(e.data)}get enum(){return this._def.values}}fs.create=(r,e)=>new fs({values:r,typeName:J.ZodNativeEnum,...ie(e)});class Rn extends ue{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==M.promise&&t.common.async===!1)return B(t,{code:I.invalid_type,expected:M.promise,received:t.parsedType}),te;const n=t.parsedType===M.promise?t.data:Promise.resolve(t.data);return ft(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Rn.create=(r,e)=>new Rn({type:r,typeName:J.ZodPromise,...ie(e)});class Dt extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J.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=>{B(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 c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?te:(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"?te:(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(!ss(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=>ss(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);be.assertNever(s)}}Dt.create=(r,e,t)=>new Dt({schema:r,typeName:J.ZodEffects,effect:e,...ie(t)});Dt.createWithPreprocess=(r,e,t)=>new Dt({schema:e,effect:{type:"preprocess",transform:r},typeName:J.ZodEffects,...ie(t)});class vr extends ue{_parse(e){return this._getType(e)===M.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}vr.create=(r,e)=>new vr({innerType:r,typeName:J.ZodOptional,...ie(e)});class un extends ue{_parse(e){return this._getType(e)===M.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}un.create=(r,e)=>new un({innerType:r,typeName:J.ZodNullable,...ie(e)});class ps extends ue{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===M.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ps.create=(r,e)=>new ps({innerType:r,typeName:J.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});class Ka extends ue{_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 $a(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Zt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Zt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ka.create=(r,e)=>new Ka({innerType:r,typeName:J.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});class Fa extends ue{_parse(e){if(this._getType(e)!==M.nan){const n=this._getOrReturnCtx(e);return B(n,{code:I.invalid_type,expected:M.nan,received:n.parsedType}),te}return{status:"valid",value:e.data}}}Fa.create=r=>new Fa({typeName:J.ZodNaN,...ie(r)});const ef=Symbol("zod_brand");class Ku extends ue{_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 Ws extends ue{_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"?te:a.status==="dirty"?(t.dirty(),Bu(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"?te: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 Ws({in:e,out:t,typeName:J.ZodPipeline})}}class Wa extends ue{_parse(e){const t=this._def.innerType._parse(e);return ss(t)&&(t.value=Object.freeze(t.value)),t}}Wa.create=(r,e)=>new Wa({innerType:r,typeName:J.ZodReadonly,...ie(e)});const Fu=(r,e={},t)=>r?Zn.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:c})}}):Zn.create(),tf={object:$e.lazycreate};var J;(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"})(J||(J={}));const rf=(r,e={message:`Input not instance of ${r.name}`})=>Fu(t=>t instanceof r,e),Wu=It.create,qu=Mr.create,nf=Fa.create,sf=$r.create,Yu=as.create,af=on.create,of=La.create,cf=is.create,uf=os.create,lf=Zn.create,df=rn.create,hf=Tr.create,ff=Ba.create,pf=Rt.create,mf=$e.create,yf=$e.strictCreate,gf=cs.create,vf=Si.create,wf=us.create,_f=Yt.create,bf=ls.create,kf=Va.create,Tf=cn.create,xf=En.create,Of=ds.create,Sf=hs.create,Nf=Lr.create,Ef=fs.create,Af=Rn.create,Vc=Dt.create,If=vr.create,Cf=un.create,jf=Dt.createWithPreprocess,Zf=Ws.create,Rf=()=>Wu().optional(),zf=()=>qu().optional(),Pf=()=>Yu().optional(),Uf={string:r=>It.create({...r,coerce:!0}),number:r=>Mr.create({...r,coerce:!0}),boolean:r=>as.create({...r,coerce:!0}),bigint:r=>$r.create({...r,coerce:!0}),date:r=>on.create({...r,coerce:!0})},Df=te;var S=Object.freeze({__proto__:null,defaultErrorMap:ns,setErrorMap:Lh,getErrorMap:Da,makeIssue:Ma,EMPTY_PATH:Bh,addIssueToContext:B,ParseStatus:at,INVALID:te,DIRTY:Bu,OK:ft,isAborted:ho,isDirty:fo,isValid:ss,isAsync:$a,get util(){return be},get objectUtil(){return lo},ZodParsedType:M,getParsedType:Cr,ZodType:ue,ZodString:It,ZodNumber:Mr,ZodBigInt:$r,ZodBoolean:as,ZodDate:on,ZodSymbol:La,ZodUndefined:is,ZodNull:os,ZodAny:Zn,ZodUnknown:rn,ZodNever:Tr,ZodVoid:Ba,ZodArray:Rt,ZodObject:$e,ZodUnion:cs,ZodDiscriminatedUnion:Si,ZodIntersection:us,ZodTuple:Yt,ZodRecord:ls,ZodMap:Va,ZodSet:cn,ZodFunction:En,ZodLazy:ds,ZodLiteral:hs,ZodEnum:Lr,ZodNativeEnum:fs,ZodPromise:Rn,ZodEffects:Dt,ZodTransformer:Dt,ZodOptional:vr,ZodNullable:un,ZodDefault:ps,ZodCatch:Ka,ZodNaN:Fa,BRAND:ef,ZodBranded:Ku,ZodPipeline:Ws,ZodReadonly:Wa,custom:Fu,Schema:ue,ZodSchema:ue,late:tf,get ZodFirstPartyTypeKind(){return J},coerce:Uf,any:lf,array:pf,bigint:sf,boolean:Yu,date:af,discriminatedUnion:vf,effect:Vc,enum:Nf,function:xf,instanceof:rf,intersection:wf,lazy:Of,literal:Sf,map:kf,nan:nf,nativeEnum:Ef,never:hf,null:uf,nullable:Cf,number:qu,object:mf,oboolean:Pf,onumber:zf,optional:If,ostring:Rf,pipeline:Zf,preprocess:jf,promise:Af,record:bf,set:Tf,strictObject:yf,string:Wu,symbol:of,transformer:Vc,tuple:_f,undefined:cf,union:gf,unknown:df,void:ff,NEVER:Df,ZodIssueCode:I,quotelessJson:$h,ZodError:Zt});const Lo=S.tuple([S.number(),S.number()]),Ju=S.object({width:S.number(),height:S.number()}),Mf=S.object({signedWidth:S.number(),signedHeight:S.number()}),$f=["width","height"];S.enum($f);const Lf=["start","center","end"],Bf=["signedWidth","signedHeight"];S.enum(Bf);const qa=S.object({x:S.number(),y:S.number()}),Vf=S.object({clientX:S.number(),clientY:S.number()}),Kf=["x","y"],Gu=S.enum(Kf),Hu=["top","right","bottom","left"];S.enum(Hu);const Ff=["left","right"],Wf=S.enum(Ff),qf=["top","bottom"],Yf=S.enum(qf),Xu=["center"];S.enum(Xu);const Jf=[...Hu,...Xu],Ya=S.enum(Jf);S.enum(Lf);const Gf=["first","last"];S.enum(Gf);const Hf=S.object({lower:S.number(),upper:S.number()});S.union([Hf,Lo]);S.union([Gu,Ya]);S.union([Gu,Ya,S.instanceof(String)]);const ts=(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),Xf(t)},Xf=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r;var Ot=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},pe={},Ni={};Object.defineProperty(Ni,"__esModule",{value:!0});function Qf(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()}):""}Ni.default=Qf;var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});function ep(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():""}Ei.default=ep;var Ai={};Object.defineProperty(Ai,"__esModule",{value:!0});function tp(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()}):""}Ai.default=tp;var Bo={};Object.defineProperty(Bo,"__esModule",{value:!0});function rp(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():""}Bo.default=rp;var Vo={};Object.defineProperty(Vo,"__esModule",{value:!0});function np(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():""}Vo.default=np;var Ko={};Object.defineProperty(Ko,"__esModule",{value:!0});function sp(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():""}Ko.default=sp;var Fo={};Object.defineProperty(Fo,"__esModule",{value:!0});function ap(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)}Fo.default=ap;var Wo={};Object.defineProperty(Wo,"__esModule",{value:!0});function ip(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}):""}Wo.default=ip;var Ii={};Object.defineProperty(Ii,"__esModule",{value:!0});function op(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():""}Ii.default=op;var qo={},yn={};(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})}})(yn);var cp=Ot&&Ot.__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(qo,"__esModule",{value:!0});var rr=yn;function ma(r,e){if(e===void 0&&(e=rr.DefaultOption),!rr.isValidObject(r))return null;e=rr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toLowerCase();e.recursive&&(rr.isValidObject(s)?rr.belongToTypes(s,e.keepTypesOnRecursion)||(s=ma(s,e)):e.recursiveInArray&&rr.isArrayObject(s)&&(s=cp(s).map(function(i){var o=i;if(rr.isValidObject(i))rr.belongToTypes(o,e.keepTypesOnRecursion)||(o=ma(i,e));else if(rr.isArrayObject(i)){var c=ma({key:i},e);o=c.key}return o}))),t[a]=s}),t}qo.default=ma;var Yo={},up=Ot&&Ot.__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(Yo,"__esModule",{value:!0});var nr=yn;function ya(r,e){if(e===void 0&&(e=nr.DefaultOption),!nr.isValidObject(r))return null;e=nr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toUpperCase();e.recursive&&(nr.isValidObject(s)?nr.belongToTypes(s,e.keepTypesOnRecursion)||(s=ya(s,e)):e.recursiveInArray&&nr.isArrayObject(s)&&(s=up(s).map(function(i){var o=i;if(nr.isValidObject(i))nr.belongToTypes(o,e.keepTypesOnRecursion)||(o=ya(i,e));else if(nr.isArrayObject(i)){var c=ya({key:i},e);o=c.key}return o}))),t[a]=s}),t}Yo.default=ya;var Jo={},lp=Ot&&Ot.__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(Jo,"__esModule",{value:!0});var sr=yn,dp=Ni;function ga(r,e){if(e===void 0&&(e=sr.DefaultOption),!sr.isValidObject(r))return null;e=sr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=dp.default(n);e.recursive&&(sr.isValidObject(s)?sr.belongToTypes(s,e.keepTypesOnRecursion)||(s=ga(s,e)):e.recursiveInArray&&sr.isArrayObject(s)&&(s=lp(s).map(function(i){var o=i;if(sr.isValidObject(i))sr.belongToTypes(o,e.keepTypesOnRecursion)||(o=ga(i,e));else if(sr.isArrayObject(i)){var c=ga({key:i},e);o=c.key}return o}))),t[a]=s}),t}Jo.default=ga;var Go={},hp=Ot&&Ot.__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(Go,"__esModule",{value:!0});var ar=yn,fp=Ei;function va(r,e){if(e===void 0&&(e=ar.DefaultOption),!ar.isValidObject(r))return null;e=ar.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=fp.default(n);e.recursive&&(ar.isValidObject(s)?ar.belongToTypes(s,e.keepTypesOnRecursion)||(s=va(s,e)):e.recursiveInArray&&ar.isArrayObject(s)&&(s=hp(s).map(function(i){var o=i;if(ar.isValidObject(i))ar.belongToTypes(o,e.keepTypesOnRecursion)||(o=va(i,e));else if(ar.isArrayObject(i)){var c=va({key:i},e);o=c.key}return o}))),t[a]=s}),t}Go.default=va;var Ho={},pp=Ot&&Ot.__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(Ho,"__esModule",{value:!0});var ir=yn,mp=Ai;function wa(r,e){if(e===void 0&&(e=ir.DefaultOption),!ir.isValidObject(r))return null;e=ir.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=mp.default(n);e.recursive&&(ir.isValidObject(s)?ir.belongToTypes(s,e.keepTypesOnRecursion)||(s=wa(s,e)):e.recursiveInArray&&ir.isArrayObject(s)&&(s=pp(s).map(function(i){var o=i;if(ir.isValidObject(i))ir.belongToTypes(o,e.keepTypesOnRecursion)||(o=wa(i,e));else if(ir.isArrayObject(i)){var c=wa({key:i},e);o=c.key}return o}))),t[a]=s}),t}Ho.default=wa;var Xo={},yp=Ot&&Ot.__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(Xo,"__esModule",{value:!0});var or=yn,gp=Ii;function _a(r,e){if(e===void 0&&(e=or.DefaultOption),!or.isValidObject(r))return null;e=or.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=gp.default(n);e.recursive&&(or.isValidObject(s)?or.belongToTypes(s,e.keepTypesOnRecursion)||(s=_a(s,e)):e.recursiveInArray&&or.isArrayObject(s)&&(s=yp(s).map(function(i){var o=i;if(or.isValidObject(i))or.belongToTypes(o,e.keepTypesOnRecursion)||(o=_a(i,e));else if(or.isArrayObject(i)){var c=_a({key:i},e);o=c.key}return o}))),t[a]=s}),t}Xo.default=_a;Object.defineProperty(pe,"__esModule",{value:!0});pe.kebabKeys=pe.pascalKeys=pe.snakeKeys=pe.camelKeys=pe.upperKeys=pe.lowerKeys=pe.toLowerCase=pe.toUpperCase=pe.toKebabCase=pe.toHeaderCase=pe.toSentenceCase=pe.toTextCase=pe.toPathCase=pe.toDotCase=pe.toPascalCase=pe.toSnakeCase=pe.toCamelCase=void 0;var Qu=Ni;pe.toCamelCase=Qu.default;var el=Ei;pe.toSnakeCase=el.default;var tl=Ai;pe.toPascalCase=tl.default;var rl=Bo;pe.toDotCase=rl.default;var nl=Vo;pe.toPathCase=nl.default;var sl=Ko;pe.toTextCase=sl.default;var al=Fo;pe.toSentenceCase=al.default;var il=Wo;pe.toHeaderCase=il.default;var ol=Ii;pe.toKebabCase=ol.default;var cl=qo;pe.lowerKeys=cl.default;var ul=Yo;pe.upperKeys=ul.default;var ll=Jo;pe.camelKeys=ll.default;var dl=Go;pe.snakeKeys=dl.default;var hl=Ho;pe.pascalKeys=hl.default;var fl=Xo;pe.kebabKeys=fl.default;var pl=function(r){return String(r||"").toLowerCase()};pe.toLowerCase=pl;var ml=function(r){return String(r||"").toUpperCase()};pe.toUpperCase=ml;var vp={toCamelCase:Qu.default,toSnakeCase:el.default,toPascalCase:tl.default,toDotCase:rl.default,toPathCase:nl.default,toTextCase:sl.default,toSentenceCase:al.default,toHeaderCase:il.default,toKebabCase:ol.default,toUpperCase:ml,toLowerCase:pl,lowerKeys:cl.default,upperKeys:ul.default,camelKeys:ll.default,snakeKeys:dl.default,pascalKeys:hl.default,kebabKeys:fl.default};pe.default=vp;var yl=pe;const gl={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},wp=r=>yl.snakeKeys(r,gl),_p=r=>yl.camelKeys(r,gl);var zn;(r=>{r.toSnake=wp,r.toCamel=_p,r.capitalize=e=>e[0].toUpperCase()+e.slice(1)})(zn||(zn={}));S.object({x:Ya,y:Ya});const bp=S.object({x:Wf,y:Yf}),kp={x:"left",y:"top"},Tp=(r,e)=>r.x===e.x&&r.y===e.y,Kc=S.union([S.number(),qa,Lo,Ju,Mf,Vf]),xp=(r,e)=>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},Fc={x:0,y:0},oa=S.union([S.number(),S.string()]);S.object({top:oa,left:oa,width:oa,height:oa});S.object({left:S.number(),top:S.number(),right:S.number(),bottom:S.number()});S.object({one:qa,two:qa,root:bp});const Qo=(r,e,t=0,n=0,s)=>{const a={one:{...Fc},two:{...Fc},root:s??kp};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))},Hi=r=>{const e=Qo(r);return{lower:e.one.x,upper:e.two.x}},Xi=r=>{const e=Qo(r);return{lower:e.one.y,upper:e.two.y}},Op=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Sp=S.object({signedWidth:S.number(),signedHeight:S.number()});S.union([Ju,Sp,qa,Lo]);const Np=(r,e,t)=>(e!=null&&(r=Math.max(r,e)),t!=null&&(r=Math.min(r,t)),r);S.object({offset:Kc,scale:Kc});const Ep=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],Ap=r=>(e,t,n,s)=>[e,s?n/r:n*r],Ip=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:i,upper:o}=r,c=a-s,d=o-i;if(t==="dimension")return[r,n*(d/c)];const w=(n-s)*(d/c)+i;return[r,w]},Cp=r=>(e,t,n)=>[r,n],jp=()=>(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)]},Zp=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=Np(n,s,a),[e,n]},mo=class Gn{constructor(){E(this,"ops",[]),E(this,"currBounds",null),E(this,"currType",null),E(this,"reversed",!1),this.ops=[]}static translate(e){return new Gn().translate(e)}static magnify(e){return new Gn().magnify(e)}static scale(e,t){return new Gn().scale(e,t)}translate(e){const t=this.new(),n=Ep(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Ap(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=ts(e,t),s=this.new(),a=Ip(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=ts(e,t),s=this.new(),a=Zp(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=ts(e,t),s=this.new(),a=Cp(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=jp();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 Gn;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}};E(mo,"IDENTITY",new mo);let Wc=mo;const qc=class pr{constructor(e=new Wc,t=new Wc,n=null){E(this,"x"),E(this,"y"),E(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new pr().translate(e,t)}static translateX(e){return new pr().translateX(e)}static translateY(e){return new pr().translateY(e)}static clamp(e){return new pr().clamp(e)}static magnify(e){return new pr().magnify(e)}static scale(e){return new pr().scale(e)}static reBound(e){return new pr().reBound(e)}translate(e,t){const n=xp(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(Op(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Tp(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(Hi(e)),t.y=t.y.scale(Xi(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(Hi(e)),t.y=this.y.reBound(Xi(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(Hi(e)),t.y=this.y.clamp(Xi(e)),t}copy(){const e=new pr;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 Qo(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};E(qc,"IDENTITY",new qc);const vl=(r,e)=>{const t=new Ue(e);if(![Pe.DAY,Pe.HOUR,Pe.MINUTE,Pe.SECOND,Pe.MILLISECOND,Pe.MICROSECOND,Pe.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 Ue?new Ue(n):new Pe(n)},Ce=class he extends Number{constructor(e,t="UTC"){if(e==null)return he.now();if(e instanceof Date)super(e.getTime()*he.MILLISECOND.valueOf());else if(typeof e=="string")super(he.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(he.parseDate(e));else{let n=0;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=he.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 he(s.getTime()*he.MILLISECOND.valueOf()).truncate(he.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 c=he.hours(parseInt(n??"00",10)).add(he.minutes(parseInt(s??"00",10))).add(he.seconds(parseInt(i??"00",10))).add(he.milliseconds(parseInt(o??"00",10)));return t==="local"&&(c=c.add(he.utcOffset)),c.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return he.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new he(n.getTime()*he.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(he.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 Pe(new Date().getTimezoneOffset()*he.MINUTE.valueOf())}static since(e){return new he().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new he(e).valueOf()}span(e){return this.range(e).span}range(e){return new Ct(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0}after(e){return this.valueOf()>new he(e).valueOf()}afterEq(e){return this.valueOf()>=new he(e).valueOf()}before(e){return this.valueOf()<new he(e).valueOf()}beforeEq(e){return this.valueOf()<=new he(e).valueOf()}add(e){return new he(this.valueOf()+e.valueOf())}sub(e){return new he(this.valueOf()-e.valueOf())}milliseconds(){return this.valueOf()/he.MILLISECOND.valueOf()}toString(){return this.date().toISOString()}remainder(e){return vl(this,e)}get isToday(){return this.truncate(Pe.DAY).equals(he.now().truncate(Pe.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new he(new Date)}static nanoseconds(e){return new he(e)}static microseconds(e){return he.nanoseconds(e*1e3)}static milliseconds(e){return he.microseconds(e*1e3)}static seconds(e){return he.milliseconds(e*1e3)}static minutes(e){return he.seconds(e*60)}static hours(e){return he.minutes(e*60)}static days(e){return he.hours(e*24)}};E(Ce,"NANOSECOND",Ce.nanoseconds(1));E(Ce,"MICROSECOND",Ce.microseconds(1));E(Ce,"MILLISECOND",Ce.milliseconds(1));E(Ce,"SECOND",Ce.seconds(1));E(Ce,"MINUTE",Ce.minutes(1));E(Ce,"HOUR",Ce.hours(1));E(Ce,"DAY",Ce.days(1));E(Ce,"MAX",new Ce(9122272036554776e3));E(Ce,"MIN",new Ce(0));E(Ce,"ZERO",new Ce(0));E(Ce,"z",S.union([S.instanceof(Number).transform(r=>new Ce(r)),S.number().transform(r=>new Ce(r)),S.instanceof(Ce)]));let Ue=Ce;const Ae=class Oe extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}remainder(e){return vl(this,e)}truncate(e){return new Oe(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}multiply(e){return new Oe(this.valueOf()*e)}toString(){const e=this.truncate(Oe.DAY),t=this.truncate(Oe.HOUR),n=this.truncate(Oe.MINUTE),s=this.truncate(Oe.SECOND),a=this.truncate(Oe.MILLISECOND),i=this.truncate(Oe.MICROSECOND),o=this.truncate(Oe.NANOSECOND),c=e,d=t.sub(e),w=n.sub(t),D=s.sub(n),X=a.sub(s),Q=i.sub(a),Ze=o.sub(i);let ee="";return c.isZero||(ee+=`${c.days}d `),d.isZero||(ee+=`${d.hours}h `),w.isZero||(ee+=`${w.minutes}m `),D.isZero||(ee+=`${D.seconds}s `),X.isZero||(ee+=`${X.milliseconds}ms `),Q.isZero||(ee+=`${Q.microseconds}µs `),Ze.isZero||(ee+=`${Ze.nanoseconds}ns`),ee.trim()}get days(){return this.valueOf()/Oe.DAY.valueOf()}get hours(){return this.valueOf()/Oe.HOUR.valueOf()}get minutes(){return this.valueOf()/Oe.MINUTE.valueOf()}get seconds(){return this.valueOf()/Oe.SECOND.valueOf()}get milliseconds(){return this.valueOf()/Oe.MILLISECOND.valueOf()}get microseconds(){return this.valueOf()/Oe.MICROSECOND.valueOf()}get nanoseconds(){return this.valueOf()}get isZero(){return this.valueOf()===0}equals(e){return this.valueOf()===new Oe(e).valueOf()}add(e){return new Oe(this.valueOf()+new Oe(e).valueOf())}sub(e){return new Oe(this.valueOf()-new Oe(e).valueOf())}static nanoseconds(e=1){return new Oe(e)}static microseconds(e=1){return Oe.nanoseconds(e*1e3)}static milliseconds(e=1){return Oe.microseconds(e*1e3)}static seconds(e=1){return Oe.milliseconds(e*1e3)}static minutes(e){return Oe.seconds(e.valueOf()*60)}static hours(e){return Oe.minutes(e*60)}static days(e){return Oe.hours(e*24)}};E(Ae,"NANOSECOND",Ae.nanoseconds(1));E(Ae,"MICROSECOND",Ae.microseconds(1));E(Ae,"MILLISECOND",Ae.milliseconds(1));E(Ae,"SECOND",Ae.seconds(1));E(Ae,"MINUTE",Ae.minutes(1));E(Ae,"HOUR",Ae.hours(1));E(Ae,"DAY",Ae.days(1));E(Ae,"MAX",new Ae(Ae.MAX_SAFE_INTEGER));E(Ae,"MIN",new Ae(-Ae.MAX_SAFE_INTEGER));E(Ae,"ZERO",new Ae(0));E(Ae,"z",S.union([S.instanceof(Number).transform(r=>new Ae(r)),S.number().transform(r=>new Ae(r)),S.instanceof(Ae)]));let Pe=Ae;const Hn=class ba extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new ba(e).valueOf()}get period(){return Pe.seconds(1/this.valueOf())}sampleCount(e){return new Pe(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new rt(t).valueOf()}span(e){return Pe.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new ba(e)}static khz(e){return ba.hz(e*1e3)}};E(Hn,"z",S.union([S.number().transform(r=>new Hn(r)),S.instanceof(Number).transform(r=>new Hn(r)),S.instanceof(Hn)]));let qs=Hn;const Qe=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Ja(e*this.valueOf())}};E(Qe,"UNKNOWN",new Qe(0));E(Qe,"BIT128",new Qe(16));E(Qe,"BIT64",new Qe(8));E(Qe,"BIT32",new Qe(4));E(Qe,"BIT16",new Qe(2));E(Qe,"BIT8",new Qe(1));E(Qe,"z",S.union([S.number().transform(r=>new Qe(r)),S.instanceof(Number).transform(r=>new Qe(r)),S.instanceof(Qe)]));let rt=Qe;const Ft=class ka{constructor(e,t){E(this,"start"),E(this,"end"),this.start=new Ue(e),this.end=new Ue(t)}get span(){return new Pe(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 ka(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 ka?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new ka(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}};E(Ft,"MAX",new Ft(Ue.MIN,Ue.MAX));E(Ft,"MIN",new Ft(Ue.MAX,Ue.MIN));E(Ft,"ZERO",new Ft(Ue.ZERO,Ue.ZERO));E(Ft,"z",S.union([S.object({start:Ue.z,end:Ue.z}).transform(r=>new Ft(r.start,r.end)),S.instanceof(Ft)]));let Ct=Ft;const x=class en extends String{constructor(e){if(e instanceof en||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const t=en.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}}throw super(en.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=en.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=en.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 en.BIG_INT_TYPES.some(e=>e.equals(this))}};E(x,"UNKNOWN",new x("unknown"));E(x,"FLOAT64",new x("float64"));E(x,"FLOAT32",new x("float32"));E(x,"INT64",new x("int64"));E(x,"INT32",new x("int32"));E(x,"INT16",new x("int16"));E(x,"INT8",new x("int8"));E(x,"UINT64",new x("uint64"));E(x,"UINT32",new x("uint32"));E(x,"UINT16",new x("uint16"));E(x,"UINT8",new x("uint8"));E(x,"TIMESTAMP",new x("timestamp"));E(x,"UUID",new x("uuid"));E(x,"STRING",new x("string"));E(x,"JSON",new x("json"));E(x,"ARRAY_CONSTRUCTORS",new Map([[x.UINT8.toString(),Uint8Array],[x.UINT16.toString(),Uint16Array],[x.UINT32.toString(),Uint32Array],[x.UINT64.toString(),BigUint64Array],[x.FLOAT32.toString(),Float32Array],[x.FLOAT64.toString(),Float64Array],[x.INT8.toString(),Int8Array],[x.INT16.toString(),Int16Array],[x.INT32.toString(),Int32Array],[x.INT64.toString(),BigInt64Array],[x.TIMESTAMP.toString(),BigInt64Array],[x.STRING.toString(),Uint8Array],[x.JSON.toString(),Uint8Array],[x.UUID.toString(),Uint8Array]]));E(x,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,x.UINT8],[Uint16Array.name,x.UINT16],[Uint32Array.name,x.UINT32],[BigUint64Array.name,x.UINT64],[Float32Array.name,x.FLOAT32],[Float64Array.name,x.FLOAT64],[Int8Array.name,x.INT8],[Int16Array.name,x.INT16],[Int32Array.name,x.INT32],[BigInt64Array.name,x.INT64]]));E(x,"DENSITIES",new Map([[x.UINT8.toString(),rt.BIT8],[x.UINT16.toString(),rt.BIT16],[x.UINT32.toString(),rt.BIT32],[x.UINT64.toString(),rt.BIT64],[x.FLOAT32.toString(),rt.BIT32],[x.FLOAT64.toString(),rt.BIT64],[x.INT8.toString(),rt.BIT8],[x.INT16.toString(),rt.BIT16],[x.INT32.toString(),rt.BIT32],[x.INT64.toString(),rt.BIT64],[x.TIMESTAMP.toString(),rt.BIT64],[x.STRING.toString(),rt.UNKNOWN],[x.JSON.toString(),rt.UNKNOWN],[x.UUID.toString(),rt.BIT128]]));E(x,"ALL",[x.UNKNOWN,x.FLOAT64,x.FLOAT32,x.INT64,x.INT32,x.INT16,x.INT8,x.UINT64,x.UINT32,x.UINT16,x.UINT8,x.TIMESTAMP,x.UUID,x.STRING,x.JSON]);E(x,"BIG_INT_TYPES",[x.INT64,x.UINT64,x.TIMESTAMP]);E(x,"z",S.union([S.string().transform(r=>new x(r)),S.instanceof(x)]));let Ye=x;const nt=class Sr extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Sr.bytes(this.valueOf()+e.valueOf())}sub(e){return Sr.bytes(this.valueOf()-e.valueOf())}static bytes(e=1){return new Sr(e)}static kilobytes(e=1){return Sr.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Sr.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Sr.megabytes(e.valueOf()*1e3)}static terabytes(e){return Sr.gigabytes(e.valueOf()*1e3)}isZero(){return this.valueOf()===0}};E(nt,"BYTE",new nt(1));E(nt,"KILOBYTE",nt.kilobytes(1));E(nt,"MEGABYTE",nt.megabytes(1));E(nt,"GIGABYTE",nt.gigabytes(1));E(nt,"TERABYTE",nt.terabytes(1));E(nt,"ZERO",new nt(0));E(nt,"z",S.union([S.number().transform(r=>new nt(r)),S.instanceof(nt)]));let Ja=nt;S.union([S.instanceof(Uint8Array),S.instanceof(Uint16Array),S.instanceof(Uint32Array),S.instanceof(BigUint64Array),S.instanceof(Float32Array),S.instanceof(Float64Array),S.instanceof(Int8Array),S.instanceof(Int16Array),S.instanceof(Int32Array),S.instanceof(BigInt64Array)]);const Rp=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t)-BigInt(n):Xn(t,-n),zp=(r,e)=>{if(e==null)throw new Error(`field ${r} is null`)},Hr=-1;class At{constructor({data:e,dataType:t,timeRange:n,sampleOffset:s=0,glBufferUsage:a="static",alignment:i=0,key:o=Ph()}){if(E(this,"key",""),E(this,"dataType"),E(this,"sampleOffset"),E(this,"gl"),E(this,"_data"),E(this,"_timeRange"),E(this,"alignment",0),E(this,"_min"),E(this,"_max"),E(this,"writePos",Hr),E(this,"_refCount",0),t==null&&!(e instanceof ArrayBuffer))this.dataType=new Ye(e);else if(t!=null)this.dataType=new Ye(t);else throw new Error("must provide a data type when constructing a Series from a buffer");this.key=o,this.alignment=i,this.sampleOffset=s??0,this._data=e,this._timeRange=n,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:a}}static alloc({capacity:e,dataType:t,...n}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const s=new new Ye(t).Array(e),a=new At({data:s.buffer,dataType:t,...n});return a.writePos=0,a}static generateTimestamps(e,t,n){const s=n.spanRange(t.span(e)),a=new BigInt64Array(e);for(let i=0;i<e;i++)a[i]=BigInt(n.add(t.span(i)).valueOf());return new At({data:a,dataType:Ye.TIMESTAMP,timeRange:s})}get refCount(){return this._refCount}static fromStrings(e,t){const n=new TextEncoder().encode(e.join(`
|
|
2
2
|
`)+`
|
|
3
3
|
`);return new At({data:n,dataType:Ye.STRING,timeRange:t})}static fromJSON(e,t){const n=new TextEncoder().encode(e.map(s=>JSON.stringify(s)).join(`
|
|
4
4
|
`)+`
|
|
5
|
-
`);return new At({data:n,dataType:Ye.JSON,timeRange:t})}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){if(this._refCount--,this._refCount===0&&this.gl.control!=null)this.maybeGarbageCollectGLBuffer(this.gl.control);else if(this._refCount<0)throw new Error("cannot release an array with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");if(this.writePos===Hr)return 0;const t=this.
|
|
5
|
+
`);return new At({data:n,dataType:Ye.JSON,timeRange:t})}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){if(this._refCount--,this._refCount===0&&this.gl.control!=null)this.maybeGarbageCollectGLBuffer(this.gl.control);else if(this._refCount<0)throw new Error("cannot release an array with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");if(this.writePos===Hr)return 0;const t=this.capacity-this.writePos,n=t<e.length?e.slice(0,t):e;return this.underlyingData.set(n.data,this.writePos),this.maybeRecomputeMinMax(n),this.writePos+=n.length,n.length}get buffer(){return this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===Hr?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.equals(Ye.STRING))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.buffer).split(`
|
|
6
6
|
`).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(Ye.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=Ye.UUID.density.valueOf(),t=Array(this.length);for(let n=0;n<this.length;n++){const s=this.buffer.slice(n*e,(n+1)*e),a=Array.from(new Uint8Array(s),i=>i.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");t[n]=a}return t}parseJSON(e){if(!this.dataType.equals(Ye.JSON))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.buffer).split(`
|
|
7
|
-
`).slice(0,-1).map(t=>e.parse(JSON.parse(t)))}get timeRange(){return zp("timeRange",this._timeRange),this._timeRange}get byteCap(){return new Ja(this.buffer.byteLength)}get cap(){return this.dataType.density.length(this.byteCap)}get byteLength(){return this.writePos===Hr?this.byteCap:this.dataType.density.size(this.writePos)}get length(){return this.writePos===Hr?this.data.length:this.writePos}convert(e,t=0){if(this.dataType.equals(e))return this;const n=new e.Array(this.length);for(let s=0;s<this.length;s++)n[s]=Rp(this.dataType,e,this.data[s],t);return new At({data:n.buffer,dataType:e,timeRange:this._timeRange,sampleOffset:t,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(Ye.TIMESTAMP))this._max=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this._max=e.reduce((t,n)=>t>n?t:n)}else{const e=this.data;this._max=e.reduce((t,n)=>t>n?t:n)}return this._max}get max(){return this.writePos===0?-1/0:(this._max==null&&(this._max=this.calcRawMax()),Xn(this._max,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(Ye.TIMESTAMP))this._min=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this._min=e.reduce((t,n)=>t<n?t:n)}else{const e=this.data;this._min=e.reduce((t,n)=>t<n?t:n)}return this._min}get min(){return this.writePos===0?1/0:(this._min==null&&(this._min=this.calcRawMin()),Xn(this._min,this.sampleOffset))}get bounds(){return ts(Number(this.min),Number(this.max))}maybeRecomputeMinMax(e){if(this._min!=null){const t=e._min??e.calcRawMin();t<this._min&&(this._min=t)}if(this._max!=null){const t=e._max??e.calcRawMax();t>this._max&&(this._max=t)}}enrich(){this.max,this.min}get range(){return Xn(this.max,-this.min)}at(e){const t=this.data[e];if(t!=null)return Xn(t,this.sampleOffset)}binarySearch(e){let t=0,n=this.length-1;const s=Dh(e);for(;t<=n;){const a=Math.floor((t+n)/2),i=s(this.at(a),e);if(i===0)return a;i<0?t=a+1:n=a-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(Ye.FLOAT32))throw new Error("Only FLOAT32 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:s}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==s)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Hr){s===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCap.valueOf(),e.STATIC_DRAW);const a=this.dataType.density.size(s).valueOf(),i=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,a,i.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,n==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=Hr}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:this.alignmentBounds,timeRange:(e=this._timeRange)==null?void 0:e.toString(),length:this.length}}get memInfo(){return{key:this.key,length:this.length,byteLength:this.byteLength,glBuffer:this.gl.buffer!=null}}get alignmentBounds(){return ts(this.alignment,this.alignment+this.length)}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}slice(e,t){if(e<=0&&(t==null||t>=this.length))return this;const n=this.data.slice(e,t);return new At({data:n,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+e})}reAlign(e){return new At({data:this.buffer,dataType:this.dataType,timeRange:Ct.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}}const Xn=(r,e)=>typeof r=="bigint"&&typeof e=="bigint"||typeof r=="number"&&typeof e=="number"?r+e:Number(r)+Number(e),ec=S.record(S.union([S.number(),S.string(),S.symbol()]),S.unknown()),Pp=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),Up=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";Up();const Dp=["MacOS","Windows","Linux","Docker"];S.enum(Dp);const Yc=r=>[...new Set(r)],Mp=(...r)=>r.map(wl).join(""),wl=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),$p=r=>r.endsWith("/")?r.slice(0,-1):r;let Lp=(wn=class{constructor({host:r,port:e,protocol:t="",pathPrefix:n=""}){E(this,"protocol"),E(this,"host"),E(this,"port"),E(this,"path"),this.protocol=t,this.host=r,this.port=e,this.path=wl(n)}replace(r){return new wn({host:r.host??this.host,port:r.port??this.port,protocol:r.protocol??this.protocol,pathPrefix:r.pathPrefix??this.path})}child(r){return new wn({...this,pathPrefix:Mp(this.path,r)})}toString(){return $p(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}},E(wn,"UNKNOWN",new wn({host:"unknown",port:0})),wn);const xe=r=>Array.isArray(r)?r:[r];var yo;try{yo=new TextDecoder}catch{}var z,Tt,f=0,Re={},ve,Rr,bt=0,Bt=0,Je,wr,pt=[],ye,Jc={useRecords:!1,mapsAsObjects:!0};class _l{}const bl=new _l;bl.name="MessagePack 0xC1";var Ur=!1,kl=2,Gc;try{new Function("")}catch{kl=1/0}class ms{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(z)return Nl(()=>(vo(),this?this.unpack(e,t):ms.prototype.unpack.call(Jc,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(Tt=t.end||e.length,f=t.start||0):(f=0,Tt=t>-1?t:e.length),Bt=0,Rr=null,Je=null,z=e;try{ye=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw z=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 ms){if(Re=this,this.structures)return ve=this.structures,ca(t);(!ve||ve.length>0)&&(ve=[])}else Re=Jc,(!ve||ve.length>0)&&(ve=[]);return ca(t)}unpackMultiple(e,t){let n,s=0;try{Ur=!0;let a=e.length,i=this?this.unpack(e,a):Ci.unpack(e,a);if(t){if(t(i,s,f)===!1)return;for(;f<a;)if(s=f,t(ca(),s,f)===!1)return}else{for(n=[i];f<a;)s=f,n.push(ca());return n}}catch(a){throw a.lastPosition=s,a.values=n,a}finally{Ur=!1,vo()}}_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 ca(r){try{if(!Re.trusted&&!Ur){let t=ve.sharedLength||0;t<ve.length&&(ve.length=t)}let e;if(Re.randomAccessStructure&&z[f]<64&&z[f]>=32&&Gc?(e=Gc(z,f,Tt,Re),z=null,!(r&&r.lazy)&&e&&(e=e.toJSON()),f=Tt):e=Be(),Je&&(f=Je.postBundlePosition,Je=null),Ur&&(ve.restoreStructures=null),f==Tt)ve&&ve.restoreStructures&&Hc(),ve=null,z=null,wr&&(wr=null);else{if(f>Tt)throw new Error("Unexpected end of MessagePack data");if(!Ur){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 ve&&ve.restoreStructures&&Hc(),vo(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||f>Tt)&&(e.incomplete=!0),e}}function Hc(){for(let r in ve.restoreStructures)ve[r]=ve.restoreStructures[r];ve.restoreStructures=null}function Be(){let r=z[f++];if(r<160)if(r<128){if(r<64)return r;{let e=ve[r&63]||Re.getStructures&&Tl()[r&63];return e?(e.read||(e.read=tc(e,r&63)),e.read()):r}}else if(r<144)if(r-=128,Re.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=Ol();n==="__proto__"&&(n="__proto_"),e[n]=Be()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Be(),Be());return e}else{r-=144;let e=new Array(r);for(let t=0;t<r;t++)e[t]=Be();return Re.freezeData?Object.freeze(e):e}else if(r<192){let e=r-160;if(Bt>=f)return Rr.slice(f-bt,(f+=e)-bt);if(Bt==0&&Tt<140){let t=e<16?rc(e):xl(e);if(t!=null)return t}return go(e)}else{let e;switch(r){case 192:return null;case 193:return Je?(e=Be(),e>0?Je[1].slice(Je.position1,Je.position1+=e):Je[0].slice(Je.position0,Je.position0-=e)):bl;case 194:return!1;case 195:return!0;case 196:if(e=z[f++],e===void 0)throw new Error("Unexpected end of buffer");return Qi(e);case 197:return e=ye.getUint16(f),f+=2,Qi(e);case 198:return e=ye.getUint32(f),f+=4,Qi(e);case 199:return Xr(z[f++]);case 200:return e=ye.getUint16(f),f+=2,Xr(e);case 201:return e=ye.getUint32(f),f+=4,Xr(e);case 202:if(e=ye.getFloat32(f),Re.useFloat32>2){let t=nc[(z[f]&127)<<1|z[f+1]>>7];return f+=4,(t*e+(e>0?.5:-.5)>>0)/t}return f+=4,e;case 203:return e=ye.getFloat64(f),f+=8,e;case 204:return z[f++];case 205:return e=ye.getUint16(f),f+=2,e;case 206:return e=ye.getUint32(f),f+=4,e;case 207:return Re.int64AsType==="number"?(e=ye.getUint32(f)*4294967296,e+=ye.getUint32(f+4)):Re.int64AsType==="string"?e=ye.getBigUint64(f).toString():Re.int64AsType==="auto"?(e=ye.getBigUint64(f),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ye.getBigUint64(f),f+=8,e;case 208:return ye.getInt8(f++);case 209:return e=ye.getInt16(f),f+=2,e;case 210:return e=ye.getInt32(f),f+=4,e;case 211:return Re.int64AsType==="number"?(e=ye.getInt32(f)*4294967296,e+=ye.getUint32(f+4)):Re.int64AsType==="string"?e=ye.getBigInt64(f).toString():Re.int64AsType==="auto"?(e=ye.getBigInt64(f),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ye.getBigInt64(f),f+=8,e;case 212:if(e=z[f++],e==114)return nu(z[f++]&63);{let t=pt[e];if(t)return t.read?(f++,t.read(Be())):t.noBuffer?(f++,t()):t(z.subarray(f,++f));throw new Error("Unknown extension "+e)}case 213:return e=z[f],e==114?(f++,nu(z[f++]&63,z[f++])):Xr(2);case 214:return Xr(4);case 215:return Xr(8);case 216:return Xr(16);case 217:return e=z[f++],Bt>=f?Rr.slice(f-bt,(f+=e)-bt):Vp(e);case 218:return e=ye.getUint16(f),f+=2,Bt>=f?Rr.slice(f-bt,(f+=e)-bt):Kp(e);case 219:return e=ye.getUint32(f),f+=4,Bt>=f?Rr.slice(f-bt,(f+=e)-bt):Fp(e);case 220:return e=ye.getUint16(f),f+=2,Qc(e);case 221:return e=ye.getUint32(f),f+=4,Qc(e);case 222:return e=ye.getUint16(f),f+=2,eu(e);case 223:return e=ye.getUint32(f),f+=4,eu(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 Bp=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function tc(r,e){function t(){if(t.count++>kl){let s=r.read=new Function("r","return function(){return "+(Re.freezeData?"Object.freeze":"")+"({"+r.map(a=>a==="__proto__"?"__proto_:r()":Bp.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(Be);return r.highByte===0&&(r.read=Xc(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]=Be()}return Re.freezeData?Object.freeze(n):n}return t.count=0,r.highByte===0?Xc(e,t):t}const Xc=(r,e)=>function(){let t=z[f++];if(t===0)return e();let n=r<32?-(r+(t<<5)):r+(t<<5),s=ve[n]||Tl()[n];if(!s)throw new Error("Record id is not defined for "+n);return s.read||(s.read=tc(s,r)),s.read()};function Tl(){let r=Nl(()=>(z=null,Re.getStructures()));return ve=Re._mergeStructures(r,ve)}var go=Ys,Vp=Ys,Kp=Ys,Fp=Ys;function Ys(r){let e;if(r<16&&(e=rc(r)))return e;if(r>64&&yo)return yo.decode(z.subarray(f,f+=r));const t=f+r,n=[];for(e="";f<t;){const s=z[f++];if(!(s&128))n.push(s);else if((s&224)===192){const a=z[f++]&63;n.push((s&31)<<6|a)}else if((s&240)===224){const a=z[f++]&63,i=z[f++]&63;n.push((s&31)<<12|a<<6|i)}else if((s&248)===240){const a=z[f++]&63,i=z[f++]&63,o=z[f++]&63;let c=(s&7)<<18|a<<12|i<<6|o;c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|c&1023),n.push(c)}else n.push(s);n.length>=4096&&(e+=We.apply(String,n),n.length=0)}return n.length>0&&(e+=We.apply(String,n)),e}function Qc(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=Be();return Re.freezeData?Object.freeze(e):e}function eu(r){if(Re.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=Ol();n==="__proto__"&&(n="__proto_"),e[n]=Be()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Be(),Be());return e}}var We=String.fromCharCode;function xl(r){let e=f,t=new Array(r);for(let n=0;n<r;n++){const s=z[f++];if((s&128)>0){f=e;return}t[n]=s}return We.apply(String,t)}function rc(r){if(r<4)if(r<2){if(r===0)return"";{let e=z[f++];if((e&128)>1){f-=1;return}return We(e)}}else{let e=z[f++],t=z[f++];if((e&128)>0||(t&128)>0){f-=2;return}if(r<3)return We(e,t);let n=z[f++];if((n&128)>0){f-=3;return}return We(e,t,n)}else{let e=z[f++],t=z[f++],n=z[f++],s=z[f++];if((e&128)>0||(t&128)>0||(n&128)>0||(s&128)>0){f-=4;return}if(r<6){if(r===4)return We(e,t,n,s);{let a=z[f++];if((a&128)>0){f-=5;return}return We(e,t,n,s,a)}}else if(r<8){let a=z[f++],i=z[f++];if((a&128)>0||(i&128)>0){f-=6;return}if(r<7)return We(e,t,n,s,a,i);let o=z[f++];if((o&128)>0){f-=7;return}return We(e,t,n,s,a,i,o)}else{let a=z[f++],i=z[f++],o=z[f++],c=z[f++];if((a&128)>0||(i&128)>0||(o&128)>0||(c&128)>0){f-=8;return}if(r<10){if(r===8)return We(e,t,n,s,a,i,o,c);{let d=z[f++];if((d&128)>0){f-=9;return}return We(e,t,n,s,a,i,o,c,d)}}else if(r<12){let d=z[f++],w=z[f++];if((d&128)>0||(w&128)>0){f-=10;return}if(r<11)return We(e,t,n,s,a,i,o,c,d,w);let D=z[f++];if((D&128)>0){f-=11;return}return We(e,t,n,s,a,i,o,c,d,w,D)}else{let d=z[f++],w=z[f++],D=z[f++],X=z[f++];if((d&128)>0||(w&128)>0||(D&128)>0||(X&128)>0){f-=12;return}if(r<14){if(r===12)return We(e,t,n,s,a,i,o,c,d,w,D,X);{let Q=z[f++];if((Q&128)>0){f-=13;return}return We(e,t,n,s,a,i,o,c,d,w,D,X,Q)}}else{let Q=z[f++],Ze=z[f++];if((Q&128)>0||(Ze&128)>0){f-=14;return}if(r<15)return We(e,t,n,s,a,i,o,c,d,w,D,X,Q,Ze);let ee=z[f++];if((ee&128)>0){f-=15;return}return We(e,t,n,s,a,i,o,c,d,w,D,X,Q,Ze,ee)}}}}}function tu(){let r=z[f++],e;if(r<192)e=r-160;else switch(r){case 217:e=z[f++];break;case 218:e=ye.getUint16(f),f+=2;break;case 219:e=ye.getUint32(f),f+=4;break;default:throw new Error("Expected string")}return Ys(e)}function Qi(r){return Re.copyBuffers?Uint8Array.prototype.slice.call(z,f,f+=r):z.subarray(f,f+=r)}function Xr(r){let e=z[f++];if(pt[e]){let t;return pt[e](z.subarray(f,t=f+=r),n=>{f=n;try{return Be()}finally{f=t}})}else throw new Error("Unknown extension type "+e)}var ru=new Array(4096);function Ol(){let r=z[f++];if(r>=160&&r<192){if(r=r-160,Bt>=f)return Rr.slice(f-bt,(f+=r)-bt);if(!(Bt==0&&Tt<180))return go(r)}else return f--,Be().toString();let e=(r<<5^(r>1?ye.getUint16(f):r>0?z[f]:0))&4095,t=ru[e],n=f,s=f+r-3,a,i=0;if(t&&t.bytes==r){for(;n<s;){if(a=ye.getUint32(n),a!=t[i++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(a=z[n++],a!=t[i++]){n=1879048192;break}if(n===s)return f=n,t.string;s-=3,n=f}for(t=[],ru[e]=t,t.bytes=r;n<s;)a=ye.getUint32(n),t.push(a),n+=4;for(s+=3;n<s;)a=z[n++],t.push(a);let o=r<16?rc(r):xl(r);return o!=null?t.string=o:t.string=go(r)}const nu=(r,e)=>{let t=Be().map(a=>a.toString()),n=r;e!==void 0&&(r=r<32?-((e<<5)+r):(e<<5)+r,t.highByte=e);let s=ve[r];return s&&(s.isShared||Ur)&&((ve.restoreStructures||(ve.restoreStructures=[]))[r]=s),ve[r]=t,t.read=tc(t,n),t.read()};pt[0]=()=>{};pt[0].noBuffer=!0;let Wp={Error,TypeError,ReferenceError};pt[101]=()=>{let r=Be();return(Wp[r[0]]||Error)(r[1])};pt[105]=r=>{let e=ye.getUint32(f-4);wr||(wr=new Map);let t=z[f],n;t>=144&&t<160||t==220||t==221?n=[]:n={};let s={target:n};wr.set(e,s);let a=Be();return s.used?Object.assign(n,a):(s.target=a,a)};pt[112]=r=>{let e=ye.getUint32(f-4),t=wr.get(e);return t.used=!0,t.target};pt[115]=()=>new Set(Be());const Sl=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(r=>r+"Array");let qp=typeof globalThis=="object"?globalThis:window;pt[116]=r=>{let e=r[0],t=Sl[e];if(!t)throw new Error("Could not find typed array for code "+e);return new qp[t](Uint8Array.prototype.slice.call(r,1).buffer)};pt[120]=()=>{let r=Be();return new RegExp(r[0],r[1])};const Yp=[];pt[98]=r=>{let e=(r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3],t=f;return f+=e-r.length,Je=Yp,Je=[tu(),tu()],Je.position0=0,Je.position1=0,Je.postBundlePosition=f,f=t,Be()};pt[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 Nl(r){let e=Tt,t=f,n=bt,s=Bt,a=Rr,i=wr,o=Je,c=new Uint8Array(z.slice(0,Tt)),d=ve,w=ve.slice(0,ve.length),D=Re,X=Ur,Q=r();return Tt=e,f=t,bt=n,Bt=s,Rr=a,wr=i,Je=o,z=c,Ur=X,ve=d,ve.splice(0,ve.length,...w),Re=D,ye=new DataView(z.buffer,z.byteOffset,z.byteLength),Q}function vo(){z=null,wr=null,ve=null}function Jp(r){r.unpack?pt[r.type]=r.unpack:pt[r.type]=r}const nc=new Array(147);for(let r=0;r<256;r++)nc[r]=+("1e"+Math.floor(45.15-r*.30103));var Ci=new ms({useRecords:!1});const Gp=Ci.unpack;Ci.unpackMultiple;Ci.unpack;let Hp=new Float32Array(1);new Uint8Array(Hp.buffer,0,4);let Ta;try{Ta=new TextEncoder}catch{}let Ga,sc;const ji=typeof Buffer<"u",ua=ji?function(r){return Buffer.allocUnsafeSlow(r)}:Uint8Array,El=ji?Buffer:Uint8Array,su=ji?4294967296:2144337920;let _,Yn,Se,g=0,ct,De=null,Xp;const Qp=21760,em=/[\u0080-\uFFFF]/,_n=Symbol("record-id");class tm extends ms{constructor(e){super(e),this.offset=0;let t,n,s,a,i=El.prototype.utf8Write?function(l,T){return _.utf8Write(l,T,4294967295)}:Ta&&Ta.encodeInto?function(l,T){return Ta.encodeInto(l,_.subarray(T)).written}:!1,o=this;e||(e={});let c=e&&e.sequential,d=e.structures||e.saveStructures,w=e.maxSharedStructures;if(w==null&&(w=d?32:0),w>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let D=e.maxOwnStructures;D==null&&(D=d?32:64),!this.structures&&e.useRecords!=!1&&(this.structures=[]);let X=w>32||D+w>64,Q=w+64,Ze=w+D+64;if(Ze>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let ee=[],Qt=0,er=0;this.pack=this.encode=function(l,T){if(_||(_=new ua(8192),Se=_.dataView||(_.dataView=new DataView(_.buffer,0,8192)),g=0),ct=_.length-10,ct-g<2048?(_=new ua(_.length),Se=_.dataView||(_.dataView=new DataView(_.buffer,0,_.length)),ct=_.length-10,g=0):g=g+7&2147483640,t=g,T&um&&(g+=T&255),a=o.structuredClone?new Map:null,o.bundleStrings&&typeof l!="string"?(De=[],De.size=1/0):De=null,s=o.structures,s){s.uninitialized&&(s=o._mergeStructures(o.getStructures()));let m=s.sharedLength||0;if(m>w)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 y=0;y<m;y++){let k=s[y];if(!k)continue;let R,U=s.transitions;for(let A=0,ne=k.length;A<ne;A++){let F=k[A];R=U[F],R||(R=U[F]=Object.create(null)),U=R}U[_n]=y+64}this.lastNamedStructuresLength=m}c||(s.nextId=m+64)}n&&(n=!1);try{o.randomAccessStructure&&l&&l.constructor&&l.constructor===Object?Ji(l):re(l);let m=De;if(De&&ou(t,re,0),a&&a.idsToInsert){let y=a.idsToInsert.sort((A,ne)=>A.offset>ne.offset?1:-1),k=y.length,R=-1;for(;m&&k>0;){let A=y[--k].offset+t;A<m.stringsPosition+t&&R===-1&&(R=0),A>m.position+t?R>=0&&(R+=6):(R>=0&&(Se.setUint32(m.position+t,Se.getUint32(m.position+t)+R),R=-1),m=m.previous,k++)}R>=0&&m&&Se.setUint32(m.position+t,Se.getUint32(m.position+t)+R),g+=y.length*6,g>ct&&He(g),o.offset=g;let U=nm(_.subarray(t,g),y);return a=null,U}return o.offset=g,T&om?(_.start=t,_.end=g,_):_.subarray(t,g)}finally{if(s&&(Vn(),n&&o.saveStructures)){let m=s.sharedLength||0,y=_.subarray(t,g),k=am(s,o);return o.saveStructures(k,k.isCompatible)===!1?o.pack(l,T):(o.lastNamedStructuresLength=m,y)}T&cm&&(g=t)}};const Vn=()=>{er<10&&er++;let l=s.sharedLength||0;if(s.length>l&&!c&&(s.length=l),Qt>1e4)s.transitions=null,er=0,Qt=0,ee.length>0&&(ee=[]);else if(ee.length>0&&!c){for(let T=0,m=ee.length;T<m;T++)ee[T][_n]=0;ee=[]}},Jr=l=>{var T=l.length;T<16?_[g++]=144|T:T<65536?(_[g++]=220,_[g++]=T>>8,_[g++]=T&255):(_[g++]=221,Se.setUint32(g,T),g+=4);for(let m=0;m<T;m++)re(l[m])},re=l=>{g>ct&&(_=He(g));var T=typeof l,m;if(T==="string"){let y=l.length;if(De&&y>=4&&y<4096){if((De.size+=y)>Qp){let A,ne=(De[0]?De[0].length*3+De[1].length:0)+10;g+ne>ct&&(_=He(g+ne));let F;De.position?(F=De,_[g]=200,g+=3,_[g++]=98,A=g-t,g+=4,ou(t,re,0),Se.setUint16(A+t-3,g-t-A)):(_[g++]=214,_[g++]=98,A=g-t,g+=4),De=["",""],De.previous=F,De.size=0,De.position=A}let U=em.test(l);De[U?0:1]+=l,_[g++]=193,re(U?-y:y);return}let k;y<32?k=1:y<256?k=2:y<65536?k=3:k=5;let R=y*3;if(g+R>ct&&(_=He(g+R)),y<64||!i){let U,A,ne,F=g+k;for(U=0;U<y;U++)A=l.charCodeAt(U),A<128?_[F++]=A:A<2048?(_[F++]=A>>6|192,_[F++]=A&63|128):(A&64512)===55296&&((ne=l.charCodeAt(U+1))&64512)===56320?(A=65536+((A&1023)<<10)+(ne&1023),U++,_[F++]=A>>18|240,_[F++]=A>>12&63|128,_[F++]=A>>6&63|128,_[F++]=A&63|128):(_[F++]=A>>12|224,_[F++]=A>>6&63|128,_[F++]=A&63|128);m=F-g-k}else m=i(l,g+k);m<32?_[g++]=160|m:m<256?(k<2&&_.copyWithin(g+2,g+1,g+1+m),_[g++]=217,_[g++]=m):m<65536?(k<3&&_.copyWithin(g+3,g+2,g+2+m),_[g++]=218,_[g++]=m>>8,_[g++]=m&255):(k<5&&_.copyWithin(g+5,g+3,g+3+m),_[g++]=219,Se.setUint32(g,m),g+=4),g+=m}else if(T==="number")if(l>>>0===l)l<32||l<128&&this.useRecords===!1||l<64&&!this.randomAccessStructure?_[g++]=l:l<256?(_[g++]=204,_[g++]=l):l<65536?(_[g++]=205,_[g++]=l>>8,_[g++]=l&255):(_[g++]=206,Se.setUint32(g,l),g+=4);else if(l>>0===l)l>=-32?_[g++]=256+l:l>=-128?(_[g++]=208,_[g++]=l+256):l>=-32768?(_[g++]=209,Se.setInt16(g,l),g+=2):(_[g++]=210,Se.setInt32(g,l),g+=4);else{let y;if((y=this.useFloat32)>0&&l<4294967296&&l>=-2147483648){_[g++]=202,Se.setFloat32(g,l);let k;if(y<4||(k=l*nc[(_[g]&127)<<1|_[g+1]>>7])>>0===k){g+=4;return}else g--}_[g++]=203,Se.setFloat64(g,l),g+=8}else if(T==="object"||T==="function")if(!l)_[g++]=192;else{if(a){let k=a.get(l);if(k){if(!k.id){let R=a.idsToInsert||(a.idsToInsert=[]);k.id=R.push(k)}_[g++]=214,_[g++]=112,Se.setUint32(g,k.id),g+=4;return}else a.set(l,{offset:g-t})}let y=l.constructor;if(y===Object)tr(l,!0);else if(y===Array)Jr(l);else if(y===Map)if(this.mapAsEmptyObject)_[g++]=128;else{m=l.size,m<16?_[g++]=128|m:m<65536?(_[g++]=222,_[g++]=m>>8,_[g++]=m&255):(_[g++]=223,Se.setUint32(g,m),g+=4);for(let[k,R]of l)re(k),re(R)}else{for(let k=0,R=Ga.length;k<R;k++){let U=sc[k];if(l instanceof U){let A=Ga[k];if(A.write){A.type&&(_[g++]=212,_[g++]=A.type,_[g++]=0);let Xe=A.write.call(this,l);Xe===l?Array.isArray(l)?Jr(l):tr(l):re(Xe);return}let ne=_,F=Se,Ke=g;_=null;let ot;try{ot=A.pack.call(this,l,Xe=>(_=ne,ne=null,g+=Xe,g>ct&&He(g),{target:_,targetView:Se,position:g-Xe}),re)}finally{ne&&(_=ne,Se=F,g=Ke,ct=_.length-10)}ot&&(ot.length+g>ct&&He(ot.length+g),g=rm(ot,_,g,A.type));return}}if(Array.isArray(l))Jr(l);else{if(l.toJSON){const k=l.toJSON();if(k!==l)return re(k)}if(T==="function")return re(this.writeFunction&&this.writeFunction(l));tr(l,!l.hasOwnProperty)}}}else if(T==="boolean")_[g++]=l?195:194;else if(T==="bigint"){if(l<BigInt(1)<<BigInt(63)&&l>=-(BigInt(1)<<BigInt(63)))_[g++]=211,Se.setBigInt64(g,l);else if(l<BigInt(1)<<BigInt(64)&&l>0)_[g++]=207,Se.setBigUint64(g,l);else if(this.largeBigIntToFloat)_[g++]=203,Se.setFloat64(g,Number(l));else throw new RangeError(l+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");g+=8}else if(T==="undefined")this.encodeUndefinedAsNil?_[g++]=192:(_[g++]=212,_[g++]=0,_[g++]=0);else throw new Error("Unknown type: "+T)},Kn=this.variableMapSize||this.coercibleKeyAsNumber?l=>{let T=Object.keys(l),m=T.length;m<16?_[g++]=128|m:m<65536?(_[g++]=222,_[g++]=m>>8,_[g++]=m&255):(_[g++]=223,Se.setUint32(g,m),g+=4);let y;if(this.coercibleKeyAsNumber)for(let k=0;k<m;k++){y=T[k];let R=Number(y);re(isNaN(R)?y:R),re(l[y])}else for(let k=0;k<m;k++)re(y=T[k]),re(l[y])}:(l,T)=>{_[g++]=222;let m=g-t;g+=2;let y=0;for(let k in l)(T||l.hasOwnProperty(k))&&(re(k),re(l[k]),y++);_[m+++t]=y>>8,_[m+t]=y&255},Fn=this.useRecords===!1?Kn:e.progressiveRecords&&!X?(l,T)=>{let m,y=s.transitions||(s.transitions=Object.create(null)),k=g++-t,R;for(let U in l)if(T||l.hasOwnProperty(U)){if(m=y[U],m)y=m;else{let A=Object.keys(l),ne=y;y=s.transitions;let F=0;for(let Ke=0,ot=A.length;Ke<ot;Ke++){let Xe=A[Ke];m=y[Xe],m||(m=y[Xe]=Object.create(null),F++),y=m}k+t+1==g?(g--,Gr(y,A,F)):qn(y,A,k,F),R=!0,y=ne[U]}re(l[U])}if(!R){let U=y[_n];U?_[k+t]=U:qn(y,Object.keys(l),k,0)}}:(l,T)=>{let m,y=s.transitions||(s.transitions=Object.create(null)),k=0;for(let U in l)(T||l.hasOwnProperty(U))&&(m=y[U],m||(m=y[U]=Object.create(null),k++),y=m);let R=y[_n];R?R>=96&&X?(_[g++]=((R-=96)&31)+96,_[g++]=R>>5):_[g++]=R:Gr(y,y.__keys__||Object.keys(l),k);for(let U in l)(T||l.hasOwnProperty(U))&&re(l[U])},Wn=typeof this.useRecords=="function"&&this.useRecords,tr=Wn?(l,T)=>{Wn(l)?Fn(l,T):Kn(l,T)}:Fn,He=l=>{let T;if(l>16777216){if(l-t>su)throw new Error("Packed buffer would be larger than maximum buffer size");T=Math.min(su,Math.round(Math.max((l-t)*(l>67108864?1.25:2),4194304)/4096)*4096)}else T=(Math.max(l-t<<2,_.length-1)>>12)+1<<12;let m=new ua(T);return Se=m.dataView||(m.dataView=new DataView(m.buffer,0,T)),l=Math.min(l,_.length),_.copy?_.copy(m,0,t,l):m.set(_.slice(t,l)),g-=t,t=0,ct=m.length-10,_=m},Gr=(l,T,m)=>{let y=s.nextId;y||(y=64),y<Q&&this.shouldShareStructure&&!this.shouldShareStructure(T)?(y=s.nextOwnId,y<Ze||(y=Q),s.nextOwnId=y+1):(y>=Ze&&(y=Q),s.nextId=y+1);let k=T.highByte=y>=96&&X?y-96>>5:-1;l[_n]=y,l.__keys__=T,s[y-64]=T,y<Q?(T.isShared=!0,s.sharedLength=y-63,n=!0,k>=0?(_[g++]=(y&31)+96,_[g++]=k):_[g++]=y):(k>=0?(_[g++]=213,_[g++]=114,_[g++]=(y&31)+96,_[g++]=k):(_[g++]=212,_[g++]=114,_[g++]=y),m&&(Qt+=er*m),ee.length>=D&&(ee.shift()[_n]=0),ee.push(l),re(T))},qn=(l,T,m,y)=>{let k=_,R=g,U=ct,A=t;_=Yn,g=0,t=0,_||(Yn=_=new ua(8192)),ct=_.length-10,Gr(l,T,y),Yn=_;let ne=g;if(_=k,g=R,ct=U,t=A,ne>1){let F=g+ne-1;F>ct&&He(F);let Ke=m+t;_.copyWithin(Ke+ne,Ke+1,g),_.set(Yn.slice(0,ne),Ke),g=F}else _[m+t]=Yn[0]},Ji=(l,T)=>{let m=Xp(l,_,t,g,s,He,(y,k,R)=>{if(R)return n=!0;g=k;let U=_;return re(y),Vn(),U!==_?{position:g,targetView:Se,target:_}:g},this);if(m===0)return tr(l,!0);g=m}}useBuffer(e){_=e,Se=new DataView(_.buffer,_.byteOffset,_.byteLength),g=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}sc=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,_l];Ga=[{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?au(r,16,e):iu(ji?Buffer.from(r):new Uint8Array(r),e)}},{pack(r,e){let t=r.constructor;t!==El&&this.moreTypes?au(r,Sl.indexOf(t.name),e):iu(r,e)}},{pack(r,e){let{target:t,position:n}=e(1);t[n]=193}}];function au(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 iu(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 rm(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 nm(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 ou(r,e,t){if(De.length>0){Se.setUint32(De.position+r,g+t-De.position-r),De.stringsPosition=g-r;let n=De;De=null,e(n[0]),e(n[1])}}function sm(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)");sc.unshift(r.Class),Ga.unshift(r)}Jp(r)}function am(r,e){return r.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},r}let Al=new tm({useRecords:!1});const im=Al.pack;Al.pack;const om=512,cm=1024,um=2048;class ac{constructor(){E(this,"contentType","application/msgpack")}encode(e){return im(zn.toSnake(e))}decode(e,t){const n=zn.toCamel(Gp(new Uint8Array(e)));return t!=null?t.parse(n):n}static registerCustomType(e){sm({type:0,...e})}}class ic{constructor(){E(this,"contentType","application/json")}encode(e){const t=JSON.stringify(zn.toSnake(e),(n,s)=>ArrayBuffer.isView(s)?Array.from(s):s);return new TextEncoder().encode(t)}decode(e,t){const n=zn.toCamel(JSON.parse(new TextDecoder().decode(e)));return t!=null?t.parse(n):n}static registerCustomType(){}}const lm=[new ac,new ic],Il=[ac,ic],dm=r=>Il.forEach(e=>{e.registerCustomType(r)}),Cl=Object.freeze(Object.defineProperty({__proto__:null,ENCODERS:lm,ENCODER_CLASSES:Il,JSONEncoderDecoder:ic,MsgpackEncoderDecoder:ac,registerCustomTypeEncoder:dm},Symbol.toStringTag,{value:"Module"}));class hm{constructor(e){E(this,"handlers"),this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((t,n)=>n(e))}}const Ha=Object.freeze(Object.defineProperty({__proto__:null,Observer:hm},Symbol.toStringTag,{value:"Module"})),Js=u.z.number(),Gs=u.z.object({name:u.z.string(),key:u.z.number(),rate:qs.z,dataType:Ye.z,leaseholder:u.z.number(),index:u.z.number(),isIndex:u.z.boolean(),alias:u.z.string().optional()}),jl=Gs.extend({key:u.z.number().optional(),leaseholder:u.z.number().optional(),index:u.z.number().optional(),rate:qs.z.optional(),isIndex:u.z.boolean().optional()}),Zl=r=>r.map(e=>({name:e.name,dataType:new Ye(e.dataType),rate:new qs(e.rate??0),leaseholder:e.leaseholder,index:e.index,isIndex:e.isIndex}));u.z.object({channels:jl.array()});const fm=u.z.object({channels:Gs.array()}),xi=class xi{constructor(e){h(this,"client");this.client=e}async create(e){const t={channels:Zl(e)},[n,s]=await this.client.send(xi.ENDPOINT,t,fm);if(s!=null)throw s;return n.channels}};h(xi,"ENDPOINT","/channel/create");let Xa=xi;u.z.object({leaseholder:u.z.number().optional(),keys:u.z.number().array().optional(),names:u.z.string().array().optional(),search:u.z.string().optional(),rangeKey:u.z.string().optional(),limit:u.z.number().optional(),offset:u.z.number().optional()});const pm=u.z.object({channels:Gs.array()}),Oi=class Oi{constructor(e){h(this,"client");this.client=e}async search(e,t){return await this.execute({search:e,rangeKey:t})}async retrieve(e,t){const{variant:n,normalized:s}=gn(e);return await this.execute({[n]:s,rangeKey:t})}async page(e,t,n){return await this.execute({offset:e,limit:t,rangeKey:n})}async execute(e){const[t,n]=await this.client.send(Oi.ENDPOINT,e,pm);if(n!=null)throw n;return t.channels}};h(Oi,"ENDPOINT","/channel/retrieve");let Qa=Oi;class Rl{constructor(e){h(this,"cache");h(this,"namesToKeys");h(this,"wrapped");this.cache=new Map,this.namesToKeys=new Map,this.wrapped=e}async search(e,t){return await this.wrapped.search(e,t)}async page(e,t,n){return await this.wrapped.page(e,t,n)}async retrieve(e){const{normalized:t}=gn(e),n=[],s=[];if(t.forEach(i=>{const o=this.getFromCache(i);o!=null?n.push(o):s.push(i)}),s.length===0)return n;const a=await this.wrapped.retrieve(s);return this.updateCache(a),n.concat(a)}updateCache(e){e.forEach(t=>{this.cache.set(t.key,t),this.namesToKeys.set(t.name,t.key)})}getFromCache(e){const t=typeof e=="number"?e:this.namesToKeys.get(e);if(t!=null)return this.cache.get(t)}}const gn=r=>{const e=xe(r).filter(t=>t!=0);return{single:!Array.isArray(r),variant:typeof e[0]=="number"?"keys":"names",normalized:e,actual:r}};var mm=Object.defineProperty,ym=(r,e,t)=>e in r?mm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Fe=(r,e,t)=>(ym(r,typeof e!="symbol"?e+"":e,t),t),gm=Object.defineProperty,vm=(r,e,t)=>e in r?gm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Z=(r,e,t)=>(vm(r,typeof e!="symbol"?e+"":e,t),t),bn,ke;(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})(ke||(ke={}));var wo;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(wo||(wo={}));const $=ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),jr=r=>{switch(typeof r){case"undefined":return $.undefined;case"string":return $.string;case"number":return isNaN(r)?$.nan:$.number;case"boolean":return $.boolean;case"function":return $.function;case"bigint":return $.bigint;case"symbol":return $.symbol;case"object":return Array.isArray(r)?$.array:r===null?$.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?$.promise:typeof Map<"u"&&r instanceof Map?$.map:typeof Set<"u"&&r instanceof Set?$.set:typeof Date<"u"&&r instanceof Date?$.date:$.object;default:return $.unknown}},C=ke.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"]),wm=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");let zt=class extends Error{constructor(r){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};const e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=r}get errors(){return this.issues}format(r){const e=r||function(s){return s.message},t={_errors:[]},n=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)t._errors.push(e(a));else{let i=t,o=0;for(;o<a.path.length;){const c=a.path[o];o===a.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(e(a))):i[c]=i[c]||{_errors:[]},i=i[c],o++}}};return n(this),t}toString(){return this.message}get message(){return JSON.stringify(this.issues,ke.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(r=e=>e.message){const e={},t=[];for(const n of this.issues)n.path.length>0?(e[n.path[0]]=e[n.path[0]]||[],e[n.path[0]].push(r(n))):t.push(r(n));return{formErrors:t,fieldErrors:e}}get formErrors(){return this.flatten()}};zt.create=r=>new zt(r);const ys=(r,e)=>{let t;switch(r.code){case C.invalid_type:r.received===$.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case C.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,ke.jsonStringifyReplacer)}`;break;case C.unrecognized_keys:t=`Unrecognized key(s) in object: ${ke.joinValues(r.keys,", ")}`;break;case C.invalid_union:t="Invalid input";break;case C.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ke.joinValues(r.options)}`;break;case C.invalid_enum_value:t=`Invalid enum value. Expected ${ke.joinValues(r.options)}, received '${r.received}'`;break;case C.invalid_arguments:t="Invalid function arguments";break;case C.invalid_return_type:t="Invalid function return type";break;case C.invalid_date:t="Invalid date";break;case C.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}"`:ke.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case C.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 C.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 C.custom:t="Invalid input";break;case C.invalid_intersection_types:t="Intersection results could not be merged";break;case C.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case C.not_finite:t="Number must be finite";break;default:t=e.defaultError,ke.assertNever(r)}return{message:t}};let zl=ys;function _m(r){zl=r}function ei(){return zl}const ti=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const c=n.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},bm=[];function V(r,e){const t=ti({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ei(),ys].filter(n=>!!n)});r.common.issues.push(t)}let vt=class Pl{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 se;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 Pl.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 se;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 se=Object.freeze({status:"aborted"}),Ul=r=>({status:"dirty",value:r}),mt=r=>({status:"valid",value:r}),_o=r=>r.status==="aborted",bo=r=>r.status==="dirty",gs=r=>r.status==="valid",ri=r=>typeof Promise<"u"&&r instanceof Promise;var q;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(q||(q={}));let Jt=class{constructor(r,e,t,n){this._cachedPath=[],this.parent=r,this.data=e,this._path=t,this._key=n}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 cu=(r,e)=>{if(gs(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 zt(r.common.issues);return this._error=t,this._error}}};function oe(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:(a,i)=>a.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.defaultError},description:s}}let le=class{constructor(r){this.spa=this.safeParseAsync,this._def=r,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(r){return jr(r.data)}_getOrReturnCtx(r,e){return e||{common:r.parent.common,data:r.data,parsedType:jr(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}_processInputParams(r){return{status:new vt,ctx:{common:r.parent.common,data:r.data,parsedType:jr(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}}_parseSync(r){const e=this._parse(r);if(ri(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(r){const e=this._parse(r);return Promise.resolve(e)}parse(r,e){const t=this.safeParse(r,e);if(t.success)return t.data;throw t.error}safeParse(r,e){var t;const n={common:{issues:[],async:(t=e==null?void 0:e.async)!==null&&t!==void 0?t:!1,contextualErrorMap:e==null?void 0:e.errorMap},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:jr(r)},s=this._parseSync({data:r,path:n.path,parent:n});return cu(n,s)}async parseAsync(r,e){const t=await this.safeParseAsync(r,e);if(t.success)return t.data;throw t.error}async safeParseAsync(r,e){const t={common:{issues:[],contextualErrorMap:e==null?void 0:e.errorMap,async:!0},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:jr(r)},n=this._parse({data:r,path:t.path,parent:t}),s=await(ri(n)?n:Promise.resolve(n));return cu(t,s)}refine(r,e){const t=n=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(n):e;return this._refinement((n,s)=>{const a=r(n),i=()=>s.addIssue({code:C.custom,...t(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(o=>o?!0:(i(),!1)):a?!0:(i(),!1)})}refinement(r,e){return this._refinement((t,n)=>r(t)?!0:(n.addIssue(typeof e=="function"?e(t,n):e),!1))}_refinement(r){return new Mt({schema:this,typeName:G.ZodEffects,effect:{type:"refinement",refinement:r}})}superRefine(r){return this._refinement(r)}optional(){return _r.create(this,this._def)}nullable(){return dn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ln.create(this,this._def)}promise(){return Dn.create(this,this._def)}or(r){return xs.create([this,r],this._def)}and(r){return Os.create(this,r,this._def)}transform(r){return new Mt({...oe(this._def),schema:this,typeName:G.ZodEffects,effect:{type:"transform",transform:r}})}default(r){const e=typeof r=="function"?r:()=>r;return new As({...oe(this._def),innerType:this,defaultValue:e,typeName:G.ZodDefault})}brand(){return new Fl({typeName:G.ZodBranded,type:this,...oe(this._def)})}catch(r){const e=typeof r=="function"?r:()=>r;return new oi({...oe(this._def),innerType:this,catchValue:e,typeName:G.ZodCatch})}describe(r){const e=this.constructor;return new e({...this._def,description:r})}pipe(r){return oc.create(this,r)}readonly(){return ui.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const km=/^c[^\s-]{8,}$/i,Tm=/^[a-z][a-z0-9]*$/,xm=/^[0-9A-HJKMNP-TV-Z]{26}$/,Om=/^[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,Sm=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Nm="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let eo;const Em=/^(((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}))$/,Am=/^(([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})))$/,Im=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 Cm(r,e){return!!((e==="v4"||!e)&&Em.test(r)||(e==="v6"||!e)&&Am.test(r))}let Pn=class Qn extends le{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==$.string){const s=this._getOrReturnCtx(e);return V(s,{code:C.invalid_type,expected:$.string,received:s.parsedType}),se}const t=new vt;let n;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:C.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:C.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(n=this._getOrReturnCtx(e,n),a?V(n,{code:C.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&V(n,{code:C.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if(s.kind==="email")Sm.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"email",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="emoji")eo||(eo=new RegExp(Nm,"u")),eo.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"emoji",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="uuid")Om.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"uuid",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid")km.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"cuid",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid2")Tm.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"cuid2",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="ulid")xm.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"ulid",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),V(n,{validation:"url",code:C.invalid_string,message:s.message}),t.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"regex",code:C.invalid_string,message:s.message}),t.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),V(n,{code:C.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),V(n,{code:C.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),V(n,{code:C.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):s.kind==="datetime"?Im(s).test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{code:C.invalid_string,validation:"datetime",message:s.message}),t.dirty()):s.kind==="ip"?Cm(e.data,s.version)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"ip",code:C.invalid_string,message:s.message}),t.dirty()):ke.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:C.invalid_string,...q.errToObj(n)})}_addCheck(e){return new Qn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...q.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,...q.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...q.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...q.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...q.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...q.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...q.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...q.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...q.errToObj(t)})}nonempty(e){return this.min(1,q.errToObj(e))}trim(){return new Qn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Qn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Qn({...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}};Pn.create=r=>{var e;return new Pn({checks:[],typeName:G.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...oe(r)})};function jm(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 vs=class ko extends le{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)!==$.number){const s=this._getOrReturnCtx(e);return V(s,{code:C.invalid_type,expected:$.number,received:s.parsedType}),se}let t;const n=new vt;for(const s of this._def.checks)s.kind==="int"?ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),V(t,{code:C.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?jm(e.data,s.value)!==0&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),V(t,{code:C.not_finite,message:s.message}),n.dirty()):ke.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,q.toString(t))}gt(e,t){return this.setLimit("min",e,!1,q.toString(t))}lte(e,t){return this.setLimit("max",e,!0,q.toString(t))}lt(e,t){return this.setLimit("max",e,!1,q.toString(t))}setLimit(e,t,n,s){return new ko({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:q.toString(s)}]})}_addCheck(e){return new ko({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:q.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:q.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"&&ke.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)}};vs.create=r=>new vs({checks:[],typeName:G.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...oe(r)});let ws=class To extends le{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)!==$.bigint){const s=this._getOrReturnCtx(e);return V(s,{code:C.invalid_type,expected:$.bigint,received:s.parsedType}),se}let t;const n=new vt;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):ke.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,q.toString(t))}gt(e,t){return this.setLimit("min",e,!1,q.toString(t))}lte(e,t){return this.setLimit("max",e,!0,q.toString(t))}lt(e,t){return this.setLimit("max",e,!1,q.toString(t))}setLimit(e,t,n,s){return new To({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:q.toString(s)}]})}_addCheck(e){return new To({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:q.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}};ws.create=r=>{var e;return new ws({checks:[],typeName:G.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...oe(r)})};let _s=class extends le{_parse(r){if(this._def.coerce&&(r.data=!!r.data),this._getType(r)!==$.boolean){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.boolean,received:e.parsedType}),se}return mt(r.data)}};_s.create=r=>new _s({typeName:G.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...oe(r)});let bs=class Dl extends le{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==$.date){const s=this._getOrReturnCtx(e);return V(s,{code:C.invalid_type,expected:$.date,received:s.parsedType}),se}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return V(s,{code:C.invalid_date}),se}const t=new vt;let n;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:C.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:C.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):ke.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Dl({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:q.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:q.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}};bs.create=r=>new bs({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:G.ZodDate,...oe(r)});let ni=class extends le{_parse(r){if(this._getType(r)!==$.symbol){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.symbol,received:e.parsedType}),se}return mt(r.data)}};ni.create=r=>new ni({typeName:G.ZodSymbol,...oe(r)});let ks=class extends le{_parse(r){if(this._getType(r)!==$.undefined){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.undefined,received:e.parsedType}),se}return mt(r.data)}};ks.create=r=>new ks({typeName:G.ZodUndefined,...oe(r)});let Ts=class extends le{_parse(r){if(this._getType(r)!==$.null){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.null,received:e.parsedType}),se}return mt(r.data)}};Ts.create=r=>new Ts({typeName:G.ZodNull,...oe(r)});let Un=class extends le{constructor(){super(...arguments),this._any=!0}_parse(r){return mt(r.data)}};Un.create=r=>new Un({typeName:G.ZodAny,...oe(r)});let nn=class extends le{constructor(){super(...arguments),this._unknown=!0}_parse(r){return mt(r.data)}};nn.create=r=>new nn({typeName:G.ZodUnknown,...oe(r)});let xr=class extends le{_parse(r){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.never,received:e.parsedType}),se}};xr.create=r=>new xr({typeName:G.ZodNever,...oe(r)});let si=class extends le{_parse(r){if(this._getType(r)!==$.undefined){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.void,received:e.parsedType}),se}return mt(r.data)}};si.create=r=>new si({typeName:G.ZodVoid,...oe(r)});let ln=class xa extends le{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==$.array)return V(t,{code:C.invalid_type,expected:$.array,received:t.parsedType}),se;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(V(t,{code:i?C.too_big:C.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&&(V(t,{code:C.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&&(V(t,{code:C.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 Jt(t,i,t.path,o)))).then(i=>vt.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Jt(t,i,t.path,o)));return vt.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new xa({...this._def,minLength:{value:e,message:q.toString(t)}})}max(e,t){return new xa({...this._def,maxLength:{value:e,message:q.toString(t)}})}length(e,t){return new xa({...this._def,exactLength:{value:e,message:q.toString(t)}})}nonempty(e){return this.min(1,e)}};ln.create=(r,e)=>new ln({type:r,minLength:null,maxLength:null,exactLength:null,typeName:G.ZodArray,...oe(e)});function xn(r){if(r instanceof St){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=_r.create(xn(n))}return new St({...r._def,shape:()=>e})}else return r instanceof ln?new ln({...r._def,type:xn(r.element)}):r instanceof _r?_r.create(xn(r.unwrap())):r instanceof dn?dn.create(xn(r.unwrap())):r instanceof Br?Br.create(r.items.map(e=>xn(e))):r}let St=class Et extends le{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=ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==$.object){const c=this._getOrReturnCtx(e);return V(c,{code:C.invalid_type,expected:$.object,received:c.parsedType}),se}const{status:t,ctx:n}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof xr&&this._def.unknownKeys==="strip"))for(const c in n.data)a.includes(c)||i.push(c);const o=[];for(const c of a){const d=s[c],w=n.data[c];o.push({key:{status:"valid",value:c},value:d._parse(new Jt(n,w,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof xr){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of i)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(c==="strict")i.length>0&&(V(n,{code:C.unrecognized_keys,keys:i}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of i){const w=n.data[d];o.push({key:{status:"valid",value:d},value:c._parse(new Jt(n,w,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of o){const w=await d.key;c.push({key:w,value:await d.value,alwaysSet:d.alwaysSet})}return c}).then(c=>vt.mergeObjectSync(t,c)):vt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return q.errToObj,new Et({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const c=(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=q.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new Et({...this._def,unknownKeys:"strip"})}passthrough(){return new Et({...this._def,unknownKeys:"passthrough"})}extend(e){return new Et({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Et({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:G.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Et({...this._def,catchall:e})}pick(e){const t={};return ke.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Et({...this._def,shape:()=>t})}omit(e){const t={};return ke.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Et({...this._def,shape:()=>t})}deepPartial(){return xn(this)}partial(e){const t={};return ke.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new Et({...this._def,shape:()=>t})}required(e){const t={};return ke.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof _r;)s=s._def.innerType;t[n]=s}}),new Et({...this._def,shape:()=>t})}keyof(){return Kl(ke.objectKeys(this.shape))}};St.create=(r,e)=>new St({shape:()=>r,unknownKeys:"strip",catchall:xr.create(),typeName:G.ZodObject,...oe(e)});St.strictCreate=(r,e)=>new St({shape:()=>r,unknownKeys:"strict",catchall:xr.create(),typeName:G.ZodObject,...oe(e)});St.lazycreate=(r,e)=>new St({shape:r,unknownKeys:"strip",catchall:xr.create(),typeName:G.ZodObject,...oe(e)});let xs=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r),t=this._def.options;function n(s){for(const i of s)if(i.result.status==="valid")return i.result;for(const i of s)if(i.result.status==="dirty")return e.common.issues.push(...i.ctx.common.issues),i.result;const a=s.map(i=>new zt(i.ctx.common.issues));return V(e,{code:C.invalid_union,unionErrors:a}),se}if(e.common.async)return Promise.all(t.map(async s=>{const a={...e,common:{...e.common,issues:[]},parent:null};return{result:await s._parseAsync({data:e.data,path:e.path,parent:a}),ctx:a}})).then(n);{let s;const a=[];for(const o of t){const c={...e,common:{...e.common,issues:[]},parent:null},d=o._parseSync({data:e.data,path:e.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return e.common.issues.push(...s.ctx.common.issues),s.result;const i=a.map(o=>new zt(o));return V(e,{code:C.invalid_union,unionErrors:i}),se}}get options(){return this._def.options}};xs.create=(r,e)=>new xs({options:r,typeName:G.ZodUnion,...oe(e)});const Oa=r=>r instanceof Ss?Oa(r.schema):r instanceof Mt?Oa(r.innerType()):r instanceof Ns?[r.value]:r instanceof Hs?r.options:r instanceof Es?Object.keys(r.enum):r instanceof As?Oa(r._def.innerType):r instanceof ks?[void 0]:r instanceof Ts?[null]:null;let Ml=class $l extends le{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==$.object)return V(t,{code:C.invalid_type,expected:$.object,received:t.parsedType}),se;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}):(V(t,{code:C.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),se)}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=Oa(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 $l({typeName:G.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...oe(n)})}};function xo(r,e){const t=jr(r),n=jr(e);if(r===e)return{valid:!0,data:r};if(t===$.object&&n===$.object){const s=ke.objectKeys(e),a=ke.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=xo(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===$.array&&n===$.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],c=xo(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===$.date&&n===$.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}let Os=class extends le{_parse(r){const{status:e,ctx:t}=this._processInputParams(r),n=(s,a)=>{if(_o(s)||_o(a))return se;const i=xo(s.value,a.value);return i.valid?((bo(s)||bo(a))&&e.dirty(),{status:e.value,value:i.data}):(V(t,{code:C.invalid_intersection_types}),se)};return t.common.async?Promise.all([this._def.left._parseAsync({data:t.data,path:t.path,parent:t}),this._def.right._parseAsync({data:t.data,path:t.path,parent:t})]).then(([s,a])=>n(s,a)):n(this._def.left._parseSync({data:t.data,path:t.path,parent:t}),this._def.right._parseSync({data:t.data,path:t.path,parent:t}))}};Os.create=(r,e,t)=>new Os({left:r,right:e,typeName:G.ZodIntersection,...oe(t)});let Br=class Ll extends le{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.array)return V(n,{code:C.invalid_type,expected:$.array,received:n.parsedType}),se;if(n.data.length<this._def.items.length)return V(n,{code:C.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),se;!this._def.rest&&n.data.length>this._def.items.length&&(V(n,{code:C.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...n.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new Jt(n,a,n.path,i)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>vt.mergeArray(t,a)):vt.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Ll({...this._def,rest:e})}};Br.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Br({items:r,typeName:G.ZodTuple,rest:null,...oe(e)})};let Bl=class Oo extends le{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!==$.object)return V(n,{code:C.invalid_type,expected:$.object,received:n.parsedType}),se;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Jt(n,o,n.path,o)),value:i._parse(new Jt(n,n.data[o],n.path,o))});return n.common.async?vt.mergeObjectAsync(t,s):vt.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof le?new Oo({keyType:e,valueType:t,typeName:G.ZodRecord,...oe(n)}):new Oo({keyType:Pn.create(),valueType:e,typeName:G.ZodRecord,...oe(t)})}},ai=class extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:e,ctx:t}=this._processInputParams(r);if(t.parsedType!==$.map)return V(t,{code:C.invalid_type,expected:$.map,received:t.parsedType}),se;const n=this._def.keyType,s=this._def.valueType,a=[...t.data.entries()].map(([i,o],c)=>({key:n._parse(new Jt(t,i,t.path,[c,"key"])),value:s._parse(new Jt(t,o,t.path,[c,"value"]))}));if(t.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const o of a){const c=await o.key,d=await o.value;if(c.status==="aborted"||d.status==="aborted")return se;(c.status==="dirty"||d.status==="dirty")&&e.dirty(),i.set(c.value,d.value)}return{status:e.value,value:i}})}else{const i=new Map;for(const o of a){const c=o.key,d=o.value;if(c.status==="aborted"||d.status==="aborted")return se;(c.status==="dirty"||d.status==="dirty")&&e.dirty(),i.set(c.value,d.value)}return{status:e.value,value:i}}}};ai.create=(r,e,t)=>new ai({valueType:e,keyType:r,typeName:G.ZodMap,...oe(t)});let ii=class So extends le{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.set)return V(n,{code:C.invalid_type,expected:$.set,received:n.parsedType}),se;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(V(n,{code:C.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&&(V(n,{code:C.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(c){const d=new Set;for(const w of c){if(w.status==="aborted")return se;w.status==="dirty"&&t.dirty(),d.add(w.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((c,d)=>a._parse(new Jt(n,c,n.path,d)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new So({...this._def,minSize:{value:e,message:q.toString(t)}})}max(e,t){return new So({...this._def,maxSize:{value:e,message:q.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ii.create=(r,e)=>new ii({valueType:r,minSize:null,maxSize:null,typeName:G.ZodSet,...oe(e)});let Vl=class Sa extends le{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==$.function)return V(t,{code:C.invalid_type,expected:$.function,received:t.parsedType}),se;function n(o,c){return ti({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ei(),ys].filter(d=>!!d),issueData:{code:C.invalid_arguments,argumentsError:c}})}function s(o,c){return ti({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ei(),ys].filter(d=>!!d),issueData:{code:C.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Dn){const o=this;return mt(async function(...c){const d=new zt([]),w=await o._def.args.parseAsync(c,a).catch(X=>{throw d.addIssue(n(c,X)),d}),D=await Reflect.apply(i,this,w);return await o._def.returns._def.type.parseAsync(D,a).catch(X=>{throw d.addIssue(s(D,X)),d})})}else{const o=this;return mt(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new zt([n(c,d.error)]);const w=Reflect.apply(i,this,d.data),D=o._def.returns.safeParse(w,a);if(!D.success)throw new zt([s(w,D.error)]);return D.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Sa({...this._def,args:Br.create(e).rest(nn.create())})}returns(e){return new Sa({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Sa({args:e||Br.create([]).rest(nn.create()),returns:t||nn.create(),typeName:G.ZodFunction,...oe(n)})}},Ss=class extends le{get schema(){return this._def.getter()}_parse(r){const{ctx:e}=this._processInputParams(r);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};Ss.create=(r,e)=>new Ss({getter:r,typeName:G.ZodLazy,...oe(e)});let Ns=class extends le{_parse(r){if(r.data!==this._def.value){const e=this._getOrReturnCtx(r);return V(e,{received:e.data,code:C.invalid_literal,expected:this._def.value}),se}return{status:"valid",value:r.data}}get value(){return this._def.value}};Ns.create=(r,e)=>new Ns({value:r,typeName:G.ZodLiteral,...oe(e)});function Kl(r,e){return new Hs({values:r,typeName:G.ZodEnum,...oe(e)})}let Hs=class No extends le{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return V(t,{expected:ke.joinValues(n),received:t.parsedType,code:C.invalid_type}),se}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return V(t,{received:t.data,code:C.invalid_enum_value,options:n}),se}return mt(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 No.create(e)}exclude(e){return No.create(this.options.filter(t=>!e.includes(t)))}};Hs.create=Kl;let Es=class extends le{_parse(r){const e=ke.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(r);if(t.parsedType!==$.string&&t.parsedType!==$.number){const n=ke.objectValues(e);return V(t,{expected:ke.joinValues(n),received:t.parsedType,code:C.invalid_type}),se}if(e.indexOf(r.data)===-1){const n=ke.objectValues(e);return V(t,{received:t.data,code:C.invalid_enum_value,options:n}),se}return mt(r.data)}get enum(){return this._def.values}};Es.create=(r,e)=>new Es({values:r,typeName:G.ZodNativeEnum,...oe(e)});let Dn=class extends le{unwrap(){return this._def.type}_parse(r){const{ctx:e}=this._processInputParams(r);if(e.parsedType!==$.promise&&e.common.async===!1)return V(e,{code:C.invalid_type,expected:$.promise,received:e.parsedType}),se;const t=e.parsedType===$.promise?e.data:Promise.resolve(e.data);return mt(t.then(n=>this._def.type.parseAsync(n,{path:e.path,errorMap:e.common.contextualErrorMap})))}};Dn.create=(r,e)=>new Dn({type:r,typeName:G.ZodPromise,...oe(e)});let Mt=class extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===G.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){const{status:e,ctx:t}=this._processInputParams(r),n=this._def.effect||null,s={addIssue:a=>{V(t,a),a.fatal?e.abort():e.dirty()},get path(){return t.path}};if(s.addIssue=s.addIssue.bind(s),n.type==="preprocess"){const a=n.transform(t.data,s);return t.common.issues.length?{status:"dirty",value:t.data}:t.common.async?Promise.resolve(a).then(i=>this._def.schema._parseAsync({data:i,path:t.path,parent:t})):this._def.schema._parseSync({data:a,path:t.path,parent:t})}if(n.type==="refinement"){const a=i=>{const o=n.refinement(i,s);if(t.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(t.common.async===!1){const i=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});return i.status==="aborted"?se:(i.status==="dirty"&&e.dirty(),a(i.value),{status:e.value,value:i.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(i=>i.status==="aborted"?se:(i.status==="dirty"&&e.dirty(),a(i.value).then(()=>({status:e.value,value:i.value}))))}if(n.type==="transform")if(t.common.async===!1){const a=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});if(!gs(a))return a;const i=n.transform(a.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:i}}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(a=>gs(a)?Promise.resolve(n.transform(a.value,s)).then(i=>({status:e.value,value:i})):a);ke.assertNever(n)}};Mt.create=(r,e,t)=>new Mt({schema:r,typeName:G.ZodEffects,effect:e,...oe(t)});Mt.createWithPreprocess=(r,e,t)=>new Mt({schema:e,effect:{type:"preprocess",transform:r},typeName:G.ZodEffects,...oe(t)});let _r=class extends le{_parse(r){return this._getType(r)===$.undefined?mt(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};_r.create=(r,e)=>new _r({innerType:r,typeName:G.ZodOptional,...oe(e)});let dn=class extends le{_parse(r){return this._getType(r)===$.null?mt(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};dn.create=(r,e)=>new dn({innerType:r,typeName:G.ZodNullable,...oe(e)});let As=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r);let t=e.data;return e.parsedType===$.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};As.create=(r,e)=>new As({innerType:r,typeName:G.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...oe(e)});let oi=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r),t={...e,common:{...e.common,issues:[]}},n=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return ri(n)?n.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new zt(t.common.issues)},input:t.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new zt(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};oi.create=(r,e)=>new oi({innerType:r,typeName:G.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...oe(e)});let ci=class extends le{_parse(r){if(this._getType(r)!==$.nan){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.nan,received:e.parsedType}),se}return{status:"valid",value:r.data}}};ci.create=r=>new ci({typeName:G.ZodNaN,...oe(r)});const Zm=Symbol("zod_brand");let Fl=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r),t=e.data;return this._def.type._parse({data:t,path:e.path,parent:e})}unwrap(){return this._def.type}},oc=class Wl extends le{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?se:s.status==="dirty"?(t.dirty(),Ul(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?se: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 Wl({in:e,out:t,typeName:G.ZodPipeline})}},ui=class extends le{_parse(r){const e=this._def.innerType._parse(r);return gs(e)&&(e.value=Object.freeze(e.value)),e}};ui.create=(r,e)=>new ui({innerType:r,typeName:G.ZodReadonly,...oe(e)});const ql=(r,e={},t)=>r?Un.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:c})}}):Un.create(),Rm={object:St.lazycreate};var G;(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"})(G||(G={}));const zm=(r,e={message:`Input not instance of ${r.name}`})=>ql(t=>t instanceof r,e),Yl=Pn.create,Jl=vs.create,Pm=ci.create,Um=ws.create,Gl=_s.create,Dm=bs.create,Mm=ni.create,$m=ks.create,Lm=Ts.create,Bm=Un.create,Vm=nn.create,Km=xr.create,Fm=si.create,Wm=ln.create,qm=St.create,Ym=St.strictCreate,Jm=xs.create,Gm=Ml.create,Hm=Os.create,Xm=Br.create,Qm=Bl.create,ey=ai.create,ty=ii.create,ry=Vl.create,ny=Ss.create,sy=Ns.create,ay=Hs.create,iy=Es.create,oy=Dn.create,uu=Mt.create,cy=_r.create,uy=dn.create,ly=Mt.createWithPreprocess,dy=oc.create,hy=()=>Yl().optional(),fy=()=>Jl().optional(),py=()=>Gl().optional(),my={string:r=>Pn.create({...r,coerce:!0}),number:r=>vs.create({...r,coerce:!0}),boolean:r=>_s.create({...r,coerce:!0}),bigint:r=>ws.create({...r,coerce:!0}),date:r=>bs.create({...r,coerce:!0})},yy=se;var N=Object.freeze({__proto__:null,defaultErrorMap:ys,setErrorMap:_m,getErrorMap:ei,makeIssue:ti,EMPTY_PATH:bm,addIssueToContext:V,ParseStatus:vt,INVALID:se,DIRTY:Ul,OK:mt,isAborted:_o,isDirty:bo,isValid:gs,isAsync:ri,get util(){return ke},get objectUtil(){return wo},ZodParsedType:$,getParsedType:jr,ZodType:le,ZodString:Pn,ZodNumber:vs,ZodBigInt:ws,ZodBoolean:_s,ZodDate:bs,ZodSymbol:ni,ZodUndefined:ks,ZodNull:Ts,ZodAny:Un,ZodUnknown:nn,ZodNever:xr,ZodVoid:si,ZodArray:ln,ZodObject:St,ZodUnion:xs,ZodDiscriminatedUnion:Ml,ZodIntersection:Os,ZodTuple:Br,ZodRecord:Bl,ZodMap:ai,ZodSet:ii,ZodFunction:Vl,ZodLazy:Ss,ZodLiteral:Ns,ZodEnum:Hs,ZodNativeEnum:Es,ZodPromise:Dn,ZodEffects:Mt,ZodTransformer:Mt,ZodOptional:_r,ZodNullable:dn,ZodDefault:As,ZodCatch:oi,ZodNaN:ci,BRAND:Zm,ZodBranded:Fl,ZodPipeline:oc,ZodReadonly:ui,custom:ql,Schema:le,ZodSchema:le,late:Rm,get ZodFirstPartyTypeKind(){return G},coerce:my,any:Bm,array:Wm,bigint:Um,boolean:Gl,date:Dm,discriminatedUnion:Gm,effect:uu,enum:ay,function:ry,instanceof:zm,intersection:Hm,lazy:ny,literal:sy,map:ey,nan:Pm,nativeEnum:iy,never:Km,null:Lm,nullable:uy,number:Jl,object:qm,oboolean:py,onumber:fy,optional:cy,ostring:hy,pipeline:dy,preprocess:ly,promise:oy,record:Qm,set:ty,strictObject:Ym,string:Yl,symbol:Mm,transformer:uu,tuple:Xm,undefined:$m,union:Jm,unknown:Vm,void:Fm,NEVER:yy,ZodIssueCode:C,quotelessJson:wm,ZodError:zt});const cc=N.tuple([N.number(),N.number()]),Hl=N.object({width:N.number(),height:N.number()}),gy=N.object({signedWidth:N.number(),signedHeight:N.number()}),vy=["width","height"];N.enum(vy);const wy=["start","center","end"],_y=["signedWidth","signedHeight"];N.enum(_y);const li=N.object({x:N.number(),y:N.number()}),by=N.object({clientX:N.number(),clientY:N.number()}),ky=["x","y"],Xl=N.enum(ky),Ql=["top","right","bottom","left"];N.enum(Ql);const Ty=["left","right"],xy=N.enum(Ty),Oy=["top","bottom"],Sy=N.enum(Oy),ed=["center"];N.enum(ed);const Ny=[...Ql,...ed],di=N.enum(Ny);N.enum(wy);const Ey=["first","last"];N.enum(Ey);const Ay=N.object({lower:N.number(),upper:N.number()});N.union([Ay,cc]);N.union([Xl,di]);N.union([Xl,di,N.instanceof(String)]);const to=(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),Iy(t)},Iy=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r;var Nt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},me={},Zi={};Object.defineProperty(Zi,"__esModule",{value:!0});function Cy(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()}):""}Zi.default=Cy;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});function jy(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():""}Ri.default=jy;var zi={};Object.defineProperty(zi,"__esModule",{value:!0});function Zy(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()}):""}zi.default=Zy;var uc={};Object.defineProperty(uc,"__esModule",{value:!0});function Ry(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():""}uc.default=Ry;var lc={};Object.defineProperty(lc,"__esModule",{value:!0});function zy(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():""}lc.default=zy;var dc={};Object.defineProperty(dc,"__esModule",{value:!0});function Py(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():""}dc.default=Py;var hc={};Object.defineProperty(hc,"__esModule",{value:!0});function Uy(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)}hc.default=Uy;var fc={};Object.defineProperty(fc,"__esModule",{value:!0});function Dy(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}):""}fc.default=Dy;var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});function My(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():""}Pi.default=My;var pc={},vn={};(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})}})(vn);var $y=Nt&&Nt.__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(pc,"__esModule",{value:!0});var cr=vn;function Na(r,e){if(e===void 0&&(e=cr.DefaultOption),!cr.isValidObject(r))return null;e=cr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toLowerCase();e.recursive&&(cr.isValidObject(s)?cr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Na(s,e)):e.recursiveInArray&&cr.isArrayObject(s)&&(s=$y(s).map(function(i){var o=i;if(cr.isValidObject(i))cr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Na(i,e));else if(cr.isArrayObject(i)){var c=Na({key:i},e);o=c.key}return o}))),t[a]=s}),t}pc.default=Na;var mc={},Ly=Nt&&Nt.__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(mc,"__esModule",{value:!0});var ur=vn;function Ea(r,e){if(e===void 0&&(e=ur.DefaultOption),!ur.isValidObject(r))return null;e=ur.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toUpperCase();e.recursive&&(ur.isValidObject(s)?ur.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ea(s,e)):e.recursiveInArray&&ur.isArrayObject(s)&&(s=Ly(s).map(function(i){var o=i;if(ur.isValidObject(i))ur.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ea(i,e));else if(ur.isArrayObject(i)){var c=Ea({key:i},e);o=c.key}return o}))),t[a]=s}),t}mc.default=Ea;var yc={},By=Nt&&Nt.__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(yc,"__esModule",{value:!0});var lr=vn,Vy=Zi;function Aa(r,e){if(e===void 0&&(e=lr.DefaultOption),!lr.isValidObject(r))return null;e=lr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Vy.default(n);e.recursive&&(lr.isValidObject(s)?lr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Aa(s,e)):e.recursiveInArray&&lr.isArrayObject(s)&&(s=By(s).map(function(i){var o=i;if(lr.isValidObject(i))lr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Aa(i,e));else if(lr.isArrayObject(i)){var c=Aa({key:i},e);o=c.key}return o}))),t[a]=s}),t}yc.default=Aa;var gc={},Ky=Nt&&Nt.__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(gc,"__esModule",{value:!0});var dr=vn,Fy=Ri;function Ia(r,e){if(e===void 0&&(e=dr.DefaultOption),!dr.isValidObject(r))return null;e=dr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Fy.default(n);e.recursive&&(dr.isValidObject(s)?dr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ia(s,e)):e.recursiveInArray&&dr.isArrayObject(s)&&(s=Ky(s).map(function(i){var o=i;if(dr.isValidObject(i))dr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ia(i,e));else if(dr.isArrayObject(i)){var c=Ia({key:i},e);o=c.key}return o}))),t[a]=s}),t}gc.default=Ia;var vc={},Wy=Nt&&Nt.__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(vc,"__esModule",{value:!0});var hr=vn,qy=zi;function Ca(r,e){if(e===void 0&&(e=hr.DefaultOption),!hr.isValidObject(r))return null;e=hr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=qy.default(n);e.recursive&&(hr.isValidObject(s)?hr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ca(s,e)):e.recursiveInArray&&hr.isArrayObject(s)&&(s=Wy(s).map(function(i){var o=i;if(hr.isValidObject(i))hr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ca(i,e));else if(hr.isArrayObject(i)){var c=Ca({key:i},e);o=c.key}return o}))),t[a]=s}),t}vc.default=Ca;var wc={},Yy=Nt&&Nt.__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(wc,"__esModule",{value:!0});var fr=vn,Jy=Pi;function ja(r,e){if(e===void 0&&(e=fr.DefaultOption),!fr.isValidObject(r))return null;e=fr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Jy.default(n);e.recursive&&(fr.isValidObject(s)?fr.belongToTypes(s,e.keepTypesOnRecursion)||(s=ja(s,e)):e.recursiveInArray&&fr.isArrayObject(s)&&(s=Yy(s).map(function(i){var o=i;if(fr.isValidObject(i))fr.belongToTypes(o,e.keepTypesOnRecursion)||(o=ja(i,e));else if(fr.isArrayObject(i)){var c=ja({key:i},e);o=c.key}return o}))),t[a]=s}),t}wc.default=ja;Object.defineProperty(me,"__esModule",{value:!0});me.kebabKeys=me.pascalKeys=me.snakeKeys=me.camelKeys=me.upperKeys=me.lowerKeys=me.toLowerCase=me.toUpperCase=me.toKebabCase=me.toHeaderCase=me.toSentenceCase=me.toTextCase=me.toPathCase=me.toDotCase=me.toPascalCase=me.toSnakeCase=me.toCamelCase=void 0;var td=Zi;me.toCamelCase=td.default;var rd=Ri;me.toSnakeCase=rd.default;var nd=zi;me.toPascalCase=nd.default;var sd=uc;me.toDotCase=sd.default;var ad=lc;me.toPathCase=ad.default;var id=dc;me.toTextCase=id.default;var od=hc;me.toSentenceCase=od.default;var cd=fc;me.toHeaderCase=cd.default;var ud=Pi;me.toKebabCase=ud.default;var ld=pc;me.lowerKeys=ld.default;var dd=mc;me.upperKeys=dd.default;var hd=yc;me.camelKeys=hd.default;var fd=gc;me.snakeKeys=fd.default;var pd=vc;me.pascalKeys=pd.default;var md=wc;me.kebabKeys=md.default;var yd=function(r){return String(r||"").toLowerCase()};me.toLowerCase=yd;var gd=function(r){return String(r||"").toUpperCase()};me.toUpperCase=gd;var Gy={toCamelCase:td.default,toSnakeCase:rd.default,toPascalCase:nd.default,toDotCase:sd.default,toPathCase:ad.default,toTextCase:id.default,toSentenceCase:od.default,toHeaderCase:cd.default,toKebabCase:ud.default,toUpperCase:gd,toLowerCase:yd,lowerKeys:ld.default,upperKeys:dd.default,camelKeys:hd.default,snakeKeys:fd.default,pascalKeys:pd.default,kebabKeys:md.default};me.default=Gy;var vd=me;const wd={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},Hy=r=>vd.snakeKeys(r,wd),Xy=r=>vd.camelKeys(r,wd);var Mn;(r=>{r.toSnake=Hy,r.toCamel=Xy,r.capitalize=e=>e[0].toUpperCase()+e.slice(1)})(Mn||(Mn={}));N.object({x:di,y:di});const Qy=N.object({x:xy,y:Sy}),eg={x:"left",y:"top"},tg=(r,e)=>r.x===e.x&&r.y===e.y,lu=N.union([N.number(),li,cc,Hl,gy,by]),rg=(r,e)=>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},du={x:0,y:0},la=N.union([N.number(),N.string()]);N.object({top:la,left:la,width:la,height:la});N.object({left:N.number(),top:N.number(),right:N.number(),bottom:N.number()});N.object({one:li,two:li,root:Qy});const _c=(r,e,t=0,n=0,s)=>{const a={one:{...du},two:{...du},root:s??eg};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))},ro=r=>{const e=_c(r);return{lower:e.one.x,upper:e.two.x}},no=r=>{const e=_c(r);return{lower:e.one.y,upper:e.two.y}},ng=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,sg=N.object({signedWidth:N.number(),signedHeight:N.number()});N.union([Hl,sg,li,cc]);const ag=(r,e,t)=>(e!=null&&(r=Math.max(r,e)),t!=null&&(r=Math.min(r,t)),r);N.object({offset:lu,scale:lu});const ig=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],og=r=>(e,t,n,s)=>[e,s?n/r:n*r],cg=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:i,upper:o}=r,c=a-s,d=o-i;if(t==="dimension")return[r,n*(d/c)];const w=(n-s)*(d/c)+i;return[r,w]},ug=r=>(e,t,n)=>[r,n],lg=()=>(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)]},dg=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=ag(n,s,a),[e,n]},Eo=class es{constructor(){Z(this,"ops",[]),Z(this,"currBounds",null),Z(this,"currType",null),Z(this,"reversed",!1),this.ops=[]}static translate(e){return new es().translate(e)}static magnify(e){return new es().magnify(e)}static scale(e,t){return new es().scale(e,t)}translate(e){const t=this.new(),n=ig(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=og(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=to(e,t),s=this.new(),a=cg(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=to(e,t),s=this.new(),a=dg(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=to(e,t),s=this.new(),a=ug(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=lg();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 es;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}};Z(Eo,"IDENTITY",new Eo);let hu=Eo;const fu=class mr{constructor(e=new hu,t=new hu,n=null){Z(this,"x"),Z(this,"y"),Z(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new mr().translate(e,t)}static translateX(e){return new mr().translateX(e)}static translateY(e){return new mr().translateY(e)}static clamp(e){return new mr().clamp(e)}static magnify(e){return new mr().magnify(e)}static scale(e){return new mr().scale(e)}static reBound(e){return new mr().reBound(e)}translate(e,t){const n=rg(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(ng(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!tg(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(ro(e)),t.y=t.y.scale(no(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(ro(e)),t.y=this.y.reBound(no(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(ro(e)),t.y=this.y.clamp(no(e)),t}copy(){const e=new mr;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 _c(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};Z(fu,"IDENTITY",new fu);const _d=(r,e)=>{const t=new _t(e);if(![dt.DAY,dt.HOUR,dt.MINUTE,dt.SECOND,dt.MILLISECOND,dt.MICROSECOND,dt.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 _t?new _t(n):new dt(n)},je=class fe extends Number{constructor(e,t="UTC"){if(e==null)return fe.now();if(e instanceof Date)super(e.getTime()*fe.MILLISECOND.valueOf());else if(typeof e=="string")super(fe.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(fe.parseDate(e));else{let n=0;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=fe.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 fe(s.getTime()*fe.MILLISECOND.valueOf()).truncate(fe.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 c=fe.hours(parseInt(n??"00",10)).add(fe.minutes(parseInt(s??"00",10))).add(fe.seconds(parseInt(i??"00",10))).add(fe.milliseconds(parseInt(o??"00",10)));return t==="local"&&(c=c.add(fe.utcOffset)),c.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return fe.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new fe(n.getTime()*fe.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(fe.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 dt(new Date().getTimezoneOffset()*fe.MINUTE.valueOf())}static since(e){return new fe().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new fe(e).valueOf()}span(e){return this.range(e).span}range(e){return new hg(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0}after(e){return this.valueOf()>new fe(e).valueOf()}afterEq(e){return this.valueOf()>=new fe(e).valueOf()}before(e){return this.valueOf()<new fe(e).valueOf()}beforeEq(e){return this.valueOf()<=new fe(e).valueOf()}add(e){return new fe(this.valueOf()+e.valueOf())}sub(e){return new fe(this.valueOf()-e.valueOf())}milliseconds(){return this.valueOf()/fe.MILLISECOND.valueOf()}toString(){return this.date().toISOString()}remainder(e){return _d(this,e)}get isToday(){return this.truncate(dt.DAY).equals(fe.now().truncate(dt.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new fe(new Date)}static nanoseconds(e){return new fe(e)}static microseconds(e){return fe.nanoseconds(e*1e3)}static milliseconds(e){return fe.microseconds(e*1e3)}static seconds(e){return fe.milliseconds(e*1e3)}static minutes(e){return fe.seconds(e*60)}static hours(e){return fe.minutes(e*60)}static days(e){return fe.hours(e*24)}};Z(je,"NANOSECOND",je.nanoseconds(1));Z(je,"MICROSECOND",je.microseconds(1));Z(je,"MILLISECOND",je.milliseconds(1));Z(je,"SECOND",je.seconds(1));Z(je,"MINUTE",je.minutes(1));Z(je,"HOUR",je.hours(1));Z(je,"DAY",je.days(1));Z(je,"MAX",new je(9122272036554776e3));Z(je,"MIN",new je(0));Z(je,"ZERO",new je(0));Z(je,"z",N.union([N.instanceof(Number).transform(r=>new je(r)),N.number().transform(r=>new je(r)),N.instanceof(je)]));let _t=je;const Ie=class Ne extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}remainder(e){return _d(this,e)}truncate(e){return new Ne(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}toString(){const e=this.truncate(Ne.DAY),t=this.truncate(Ne.HOUR),n=this.truncate(Ne.MINUTE),s=this.truncate(Ne.SECOND),a=this.truncate(Ne.MILLISECOND),i=this.truncate(Ne.MICROSECOND),o=this.truncate(Ne.NANOSECOND),c=e,d=t.sub(e),w=n.sub(t),D=s.sub(n),X=a.sub(s),Q=i.sub(a),Ze=o.sub(i);let ee="";return c.isZero||(ee+=`${c.days}d `),d.isZero||(ee+=`${d.hours}h `),w.isZero||(ee+=`${w.minutes}m `),D.isZero||(ee+=`${D.seconds}s `),X.isZero||(ee+=`${X.milliseconds}ms `),Q.isZero||(ee+=`${Q.microseconds}µs `),Ze.isZero||(ee+=`${Ze.nanoseconds}ns`),ee.trim()}get days(){return this.valueOf()/Ne.DAY.valueOf()}get hours(){return this.valueOf()/Ne.HOUR.valueOf()}get minutes(){return this.valueOf()/Ne.MINUTE.valueOf()}get seconds(){return this.valueOf()/Ne.SECOND.valueOf()}get milliseconds(){return this.valueOf()/Ne.MILLISECOND.valueOf()}get microseconds(){return this.valueOf()/Ne.MICROSECOND.valueOf()}get nanoseconds(){return this.valueOf()}get isZero(){return this.valueOf()===0}equals(e){return this.valueOf()===new Ne(e).valueOf()}add(e){return new Ne(this.valueOf()+new Ne(e).valueOf())}sub(e){return new Ne(this.valueOf()-new Ne(e).valueOf())}static nanoseconds(e=1){return new Ne(e)}static microseconds(e=1){return Ne.nanoseconds(e*1e3)}static milliseconds(e=1){return Ne.microseconds(e*1e3)}static seconds(e=1){return Ne.milliseconds(e*1e3)}static minutes(e){return Ne.seconds(e.valueOf()*60)}static hours(e){return Ne.minutes(e*60)}static days(e){return Ne.hours(e*24)}};Z(Ie,"NANOSECOND",Ie.nanoseconds(1));Z(Ie,"MICROSECOND",Ie.microseconds(1));Z(Ie,"MILLISECOND",Ie.milliseconds(1));Z(Ie,"SECOND",Ie.seconds(1));Z(Ie,"MINUTE",Ie.minutes(1));Z(Ie,"HOUR",Ie.hours(1));Z(Ie,"DAY",Ie.days(1));Z(Ie,"MAX",new Ie(Ie.MAX_SAFE_INTEGER));Z(Ie,"MIN",new Ie(-Ie.MAX_SAFE_INTEGER));Z(Ie,"ZERO",new Ie(0));Z(Ie,"z",N.union([N.instanceof(Number).transform(r=>new Ie(r)),N.number().transform(r=>new Ie(r)),N.instanceof(Ie)]));let dt=Ie;const da=class Za extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Za(e).valueOf()}get period(){return dt.seconds(1/this.valueOf())}sampleCount(e){return new dt(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new lt(t).valueOf()}span(e){return dt.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Za(e)}static khz(e){return Za.hz(e*1e3)}};Z(da,"z",N.union([N.number().transform(r=>new da(r)),N.instanceof(Number).transform(r=>new da(r)),N.instanceof(da)]));const et=class extends Number{constructor(r){r instanceof Number?super(r.valueOf()):super(r)}length(r){return r.valueOf()/this.valueOf()}size(r){return new fg(r*this.valueOf())}};Z(et,"UNKNOWN",new et(0));Z(et,"BIT128",new et(16));Z(et,"BIT64",new et(8));Z(et,"BIT32",new et(4));Z(et,"BIT16",new et(2));Z(et,"BIT8",new et(1));Z(et,"z",N.union([N.number().transform(r=>new et(r)),N.instanceof(Number).transform(r=>new et(r)),N.instanceof(et)]));let lt=et;const Wt=class Ra{constructor(e,t){Z(this,"start"),Z(this,"end"),this.start=new _t(e),this.end=new _t(t)}get span(){return new dt(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 Ra(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 Ra?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new Ra(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}};Z(Wt,"MAX",new Wt(_t.MIN,_t.MAX));Z(Wt,"MIN",new Wt(_t.MAX,_t.MIN));Z(Wt,"ZERO",new Wt(_t.ZERO,_t.ZERO));Z(Wt,"z",N.union([N.object({start:_t.z,end:_t.z}).transform(r=>new Wt(r.start,r.end)),N.instanceof(Wt)]));let hg=Wt;const O=class tn extends String{constructor(e){if(e instanceof tn||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const t=tn.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}}throw super(tn.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=tn.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=tn.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 tn.BIG_INT_TYPES.some(e=>e.equals(this))}};Z(O,"UNKNOWN",new O("unknown"));Z(O,"FLOAT64",new O("float64"));Z(O,"FLOAT32",new O("float32"));Z(O,"INT64",new O("int64"));Z(O,"INT32",new O("int32"));Z(O,"INT16",new O("int16"));Z(O,"INT8",new O("int8"));Z(O,"UINT64",new O("uint64"));Z(O,"UINT32",new O("uint32"));Z(O,"UINT16",new O("uint16"));Z(O,"UINT8",new O("uint8"));Z(O,"TIMESTAMP",new O("timestamp"));Z(O,"UUID",new O("uuid"));Z(O,"STRING",new O("string"));Z(O,"JSON",new O("json"));Z(O,"ARRAY_CONSTRUCTORS",new Map([[O.UINT8.toString(),Uint8Array],[O.UINT16.toString(),Uint16Array],[O.UINT32.toString(),Uint32Array],[O.UINT64.toString(),BigUint64Array],[O.FLOAT32.toString(),Float32Array],[O.FLOAT64.toString(),Float64Array],[O.INT8.toString(),Int8Array],[O.INT16.toString(),Int16Array],[O.INT32.toString(),Int32Array],[O.INT64.toString(),BigInt64Array],[O.TIMESTAMP.toString(),BigInt64Array],[O.STRING.toString(),Uint8Array],[O.JSON.toString(),Uint8Array],[O.UUID.toString(),Uint8Array]]));Z(O,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,O.UINT8],[Uint16Array.name,O.UINT16],[Uint32Array.name,O.UINT32],[BigUint64Array.name,O.UINT64],[Float32Array.name,O.FLOAT32],[Float64Array.name,O.FLOAT64],[Int8Array.name,O.INT8],[Int16Array.name,O.INT16],[Int32Array.name,O.INT32],[BigInt64Array.name,O.INT64]]));Z(O,"DENSITIES",new Map([[O.UINT8.toString(),lt.BIT8],[O.UINT16.toString(),lt.BIT16],[O.UINT32.toString(),lt.BIT32],[O.UINT64.toString(),lt.BIT64],[O.FLOAT32.toString(),lt.BIT32],[O.FLOAT64.toString(),lt.BIT64],[O.INT8.toString(),lt.BIT8],[O.INT16.toString(),lt.BIT16],[O.INT32.toString(),lt.BIT32],[O.INT64.toString(),lt.BIT64],[O.TIMESTAMP.toString(),lt.BIT64],[O.STRING.toString(),lt.UNKNOWN],[O.JSON.toString(),lt.UNKNOWN],[O.UUID.toString(),lt.BIT128]]));Z(O,"ALL",[O.UNKNOWN,O.FLOAT64,O.FLOAT32,O.INT64,O.INT32,O.INT16,O.INT8,O.UINT64,O.UINT32,O.UINT16,O.UINT8,O.TIMESTAMP,O.UUID,O.STRING,O.JSON]);Z(O,"BIG_INT_TYPES",[O.INT64,O.UINT64,O.TIMESTAMP]);Z(O,"z",N.union([N.string().transform(r=>new O(r)),N.instanceof(O)]));const st=class Nr extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Nr.bytes(this.valueOf()+e.valueOf())}sub(e){return Nr.bytes(this.valueOf()-e.valueOf())}static bytes(e=1){return new Nr(e)}static kilobytes(e=1){return Nr.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Nr.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Nr.megabytes(e.valueOf()*1e3)}static terabytes(e){return Nr.gigabytes(e.valueOf()*1e3)}isZero(){return this.valueOf()===0}};Z(st,"BYTE",new st(1));Z(st,"KILOBYTE",st.kilobytes(1));Z(st,"MEGABYTE",st.megabytes(1));Z(st,"GIGABYTE",st.gigabytes(1));Z(st,"TERABYTE",st.terabytes(1));Z(st,"ZERO",new st(0));Z(st,"z",N.union([N.number().transform(r=>new st(r)),N.instanceof(st)]));let fg=st;N.union([N.instanceof(Uint8Array),N.instanceof(Uint16Array),N.instanceof(Uint32Array),N.instanceof(BigUint64Array),N.instanceof(Float32Array),N.instanceof(Float64Array),N.instanceof(Int8Array),N.instanceof(Int16Array),N.instanceof(Int32Array),N.instanceof(BigInt64Array)]);N.record(N.union([N.number(),N.string(),N.symbol()]),N.unknown());const bd=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",pg=bd(),kd=["MacOS","Windows","Linux","Docker"],mg=N.enum(kd);let so;const yg=()=>{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"},gg=(r={})=>{const{force:e,default:t}=r;return e??so??(so=yg(),so??t)},Td=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:kd,RUNTIME:pg,detect:bd,getOS:gg,osZ:mg},Symbol.toStringTag,{value:"Module"})),vg=(...r)=>r.map(xd).join(""),xd=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),wg=r=>r.endsWith("/")?r.slice(0,-1):r,_g=(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 bg=(bn=class{constructor({host:r,port:e,protocol:t="",pathPrefix:n=""}){Z(this,"protocol"),Z(this,"host"),Z(this,"port"),Z(this,"path"),this.protocol=t,this.host=r,this.port=e,this.path=xd(n)}replace(r){return new bn({host:r.host??this.host,port:r.port??this.port,protocol:r.protocol??this.protocol,pathPrefix:r.pathPrefix??this.path})}child(r){return new bn({...this,pathPrefix:vg(this.path,r)})}toString(){return wg(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}},Z(bn,"UNKNOWN",new bn({host:"unknown",port:0})),bn);var Ao;try{Ao=new TextDecoder}catch{}var P,xt,p=0,ze={},we,zr,kt=0,Vt=0,Ge,br,yt=[],ge,pu={useRecords:!1,mapsAsObjects:!0};class Od{}const Sd=new Od;Sd.name="MessagePack 0xC1";var Dr=!1,Nd=2,mu;try{new Function("")}catch{Nd=1/0}class Is{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(P)return jd(()=>(Co(),this?this.unpack(e,t):Is.prototype.unpack.call(pu,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(xt=t.end||e.length,p=t.start||0):(p=0,xt=t>-1?t:e.length),Vt=0,zr=null,Ge=null,P=e;try{ge=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw P=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 Is){if(ze=this,this.structures)return we=this.structures,ha(t);(!we||we.length>0)&&(we=[])}else ze=pu,(!we||we.length>0)&&(we=[]);return ha(t)}unpackMultiple(e,t){let n,s=0;try{Dr=!0;let a=e.length,i=this?this.unpack(e,a):Ui.unpack(e,a);if(t){if(t(i,s,p)===!1)return;for(;p<a;)if(s=p,t(ha(),s,p)===!1)return}else{for(n=[i];p<a;)s=p,n.push(ha());return n}}catch(a){throw a.lastPosition=s,a.values=n,a}finally{Dr=!1,Co()}}_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 ha(r){try{if(!ze.trusted&&!Dr){let t=we.sharedLength||0;t<we.length&&(we.length=t)}let e;if(ze.randomAccessStructure&&P[p]<64&&P[p]>=32&&mu?(e=mu(P,p,xt,ze),P=null,!(r&&r.lazy)&&e&&(e=e.toJSON()),p=xt):e=Ve(),Ge&&(p=Ge.postBundlePosition,Ge=null),Dr&&(we.restoreStructures=null),p==xt)we&&we.restoreStructures&&yu(),we=null,P=null,br&&(br=null);else{if(p>xt)throw new Error("Unexpected end of MessagePack data");if(!Dr){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 we&&we.restoreStructures&&yu(),Co(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||p>xt)&&(e.incomplete=!0),e}}function yu(){for(let r in we.restoreStructures)we[r]=we.restoreStructures[r];we.restoreStructures=null}function Ve(){let r=P[p++];if(r<160)if(r<128){if(r<64)return r;{let e=we[r&63]||ze.getStructures&&Ed()[r&63];return e?(e.read||(e.read=bc(e,r&63)),e.read()):r}}else if(r<144)if(r-=128,ze.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=Id();n==="__proto__"&&(n="__proto_"),e[n]=Ve()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Ve(),Ve());return e}else{r-=144;let e=new Array(r);for(let t=0;t<r;t++)e[t]=Ve();return ze.freezeData?Object.freeze(e):e}else if(r<192){let e=r-160;if(Vt>=p)return zr.slice(p-kt,(p+=e)-kt);if(Vt==0&&xt<140){let t=e<16?kc(e):Ad(e);if(t!=null)return t}return Io(e)}else{let e;switch(r){case 192:return null;case 193:return Ge?(e=Ve(),e>0?Ge[1].slice(Ge.position1,Ge.position1+=e):Ge[0].slice(Ge.position0,Ge.position0-=e)):Sd;case 194:return!1;case 195:return!0;case 196:if(e=P[p++],e===void 0)throw new Error("Unexpected end of buffer");return ao(e);case 197:return e=ge.getUint16(p),p+=2,ao(e);case 198:return e=ge.getUint32(p),p+=4,ao(e);case 199:return Qr(P[p++]);case 200:return e=ge.getUint16(p),p+=2,Qr(e);case 201:return e=ge.getUint32(p),p+=4,Qr(e);case 202:if(e=ge.getFloat32(p),ze.useFloat32>2){let t=Tc[(P[p]&127)<<1|P[p+1]>>7];return p+=4,(t*e+(e>0?.5:-.5)>>0)/t}return p+=4,e;case 203:return e=ge.getFloat64(p),p+=8,e;case 204:return P[p++];case 205:return e=ge.getUint16(p),p+=2,e;case 206:return e=ge.getUint32(p),p+=4,e;case 207:return ze.int64AsType==="number"?(e=ge.getUint32(p)*4294967296,e+=ge.getUint32(p+4)):ze.int64AsType==="string"?e=ge.getBigUint64(p).toString():ze.int64AsType==="auto"?(e=ge.getBigUint64(p),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ge.getBigUint64(p),p+=8,e;case 208:return ge.getInt8(p++);case 209:return e=ge.getInt16(p),p+=2,e;case 210:return e=ge.getInt32(p),p+=4,e;case 211:return ze.int64AsType==="number"?(e=ge.getInt32(p)*4294967296,e+=ge.getUint32(p+4)):ze.int64AsType==="string"?e=ge.getBigInt64(p).toString():ze.int64AsType==="auto"?(e=ge.getBigInt64(p),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ge.getBigInt64(p),p+=8,e;case 212:if(e=P[p++],e==114)return ku(P[p++]&63);{let t=yt[e];if(t)return t.read?(p++,t.read(Ve())):t.noBuffer?(p++,t()):t(P.subarray(p,++p));throw new Error("Unknown extension "+e)}case 213:return e=P[p],e==114?(p++,ku(P[p++]&63,P[p++])):Qr(2);case 214:return Qr(4);case 215:return Qr(8);case 216:return Qr(16);case 217:return e=P[p++],Vt>=p?zr.slice(p-kt,(p+=e)-kt):Tg(e);case 218:return e=ge.getUint16(p),p+=2,Vt>=p?zr.slice(p-kt,(p+=e)-kt):xg(e);case 219:return e=ge.getUint32(p),p+=4,Vt>=p?zr.slice(p-kt,(p+=e)-kt):Og(e);case 220:return e=ge.getUint16(p),p+=2,vu(e);case 221:return e=ge.getUint32(p),p+=4,vu(e);case 222:return e=ge.getUint16(p),p+=2,wu(e);case 223:return e=ge.getUint32(p),p+=4,wu(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 kg=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function bc(r,e){function t(){if(t.count++>Nd){let s=r.read=new Function("r","return function(){return "+(ze.freezeData?"Object.freeze":"")+"({"+r.map(a=>a==="__proto__"?"__proto_:r()":kg.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(Ve);return r.highByte===0&&(r.read=gu(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]=Ve()}return ze.freezeData?Object.freeze(n):n}return t.count=0,r.highByte===0?gu(e,t):t}const gu=(r,e)=>function(){let t=P[p++];if(t===0)return e();let n=r<32?-(r+(t<<5)):r+(t<<5),s=we[n]||Ed()[n];if(!s)throw new Error("Record id is not defined for "+n);return s.read||(s.read=bc(s,r)),s.read()};function Ed(){let r=jd(()=>(P=null,ze.getStructures()));return we=ze._mergeStructures(r,we)}var Io=Xs,Tg=Xs,xg=Xs,Og=Xs;function Xs(r){let e;if(r<16&&(e=kc(r)))return e;if(r>64&&Ao)return Ao.decode(P.subarray(p,p+=r));const t=p+r,n=[];for(e="";p<t;){const s=P[p++];if(!(s&128))n.push(s);else if((s&224)===192){const a=P[p++]&63;n.push((s&31)<<6|a)}else if((s&240)===224){const a=P[p++]&63,i=P[p++]&63;n.push((s&31)<<12|a<<6|i)}else if((s&248)===240){const a=P[p++]&63,i=P[p++]&63,o=P[p++]&63;let c=(s&7)<<18|a<<12|i<<6|o;c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|c&1023),n.push(c)}else n.push(s);n.length>=4096&&(e+=qe.apply(String,n),n.length=0)}return n.length>0&&(e+=qe.apply(String,n)),e}function vu(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=Ve();return ze.freezeData?Object.freeze(e):e}function wu(r){if(ze.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=Id();n==="__proto__"&&(n="__proto_"),e[n]=Ve()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Ve(),Ve());return e}}var qe=String.fromCharCode;function Ad(r){let e=p,t=new Array(r);for(let n=0;n<r;n++){const s=P[p++];if((s&128)>0){p=e;return}t[n]=s}return qe.apply(String,t)}function kc(r){if(r<4)if(r<2){if(r===0)return"";{let e=P[p++];if((e&128)>1){p-=1;return}return qe(e)}}else{let e=P[p++],t=P[p++];if((e&128)>0||(t&128)>0){p-=2;return}if(r<3)return qe(e,t);let n=P[p++];if((n&128)>0){p-=3;return}return qe(e,t,n)}else{let e=P[p++],t=P[p++],n=P[p++],s=P[p++];if((e&128)>0||(t&128)>0||(n&128)>0||(s&128)>0){p-=4;return}if(r<6){if(r===4)return qe(e,t,n,s);{let a=P[p++];if((a&128)>0){p-=5;return}return qe(e,t,n,s,a)}}else if(r<8){let a=P[p++],i=P[p++];if((a&128)>0||(i&128)>0){p-=6;return}if(r<7)return qe(e,t,n,s,a,i);let o=P[p++];if((o&128)>0){p-=7;return}return qe(e,t,n,s,a,i,o)}else{let a=P[p++],i=P[p++],o=P[p++],c=P[p++];if((a&128)>0||(i&128)>0||(o&128)>0||(c&128)>0){p-=8;return}if(r<10){if(r===8)return qe(e,t,n,s,a,i,o,c);{let d=P[p++];if((d&128)>0){p-=9;return}return qe(e,t,n,s,a,i,o,c,d)}}else if(r<12){let d=P[p++],w=P[p++];if((d&128)>0||(w&128)>0){p-=10;return}if(r<11)return qe(e,t,n,s,a,i,o,c,d,w);let D=P[p++];if((D&128)>0){p-=11;return}return qe(e,t,n,s,a,i,o,c,d,w,D)}else{let d=P[p++],w=P[p++],D=P[p++],X=P[p++];if((d&128)>0||(w&128)>0||(D&128)>0||(X&128)>0){p-=12;return}if(r<14){if(r===12)return qe(e,t,n,s,a,i,o,c,d,w,D,X);{let Q=P[p++];if((Q&128)>0){p-=13;return}return qe(e,t,n,s,a,i,o,c,d,w,D,X,Q)}}else{let Q=P[p++],Ze=P[p++];if((Q&128)>0||(Ze&128)>0){p-=14;return}if(r<15)return qe(e,t,n,s,a,i,o,c,d,w,D,X,Q,Ze);let ee=P[p++];if((ee&128)>0){p-=15;return}return qe(e,t,n,s,a,i,o,c,d,w,D,X,Q,Ze,ee)}}}}}function _u(){let r=P[p++],e;if(r<192)e=r-160;else switch(r){case 217:e=P[p++];break;case 218:e=ge.getUint16(p),p+=2;break;case 219:e=ge.getUint32(p),p+=4;break;default:throw new Error("Expected string")}return Xs(e)}function ao(r){return ze.copyBuffers?Uint8Array.prototype.slice.call(P,p,p+=r):P.subarray(p,p+=r)}function Qr(r){let e=P[p++];if(yt[e]){let t;return yt[e](P.subarray(p,t=p+=r),n=>{p=n;try{return Ve()}finally{p=t}})}else throw new Error("Unknown extension type "+e)}var bu=new Array(4096);function Id(){let r=P[p++];if(r>=160&&r<192){if(r=r-160,Vt>=p)return zr.slice(p-kt,(p+=r)-kt);if(!(Vt==0&&xt<180))return Io(r)}else return p--,Ve().toString();let e=(r<<5^(r>1?ge.getUint16(p):r>0?P[p]:0))&4095,t=bu[e],n=p,s=p+r-3,a,i=0;if(t&&t.bytes==r){for(;n<s;){if(a=ge.getUint32(n),a!=t[i++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(a=P[n++],a!=t[i++]){n=1879048192;break}if(n===s)return p=n,t.string;s-=3,n=p}for(t=[],bu[e]=t,t.bytes=r;n<s;)a=ge.getUint32(n),t.push(a),n+=4;for(s+=3;n<s;)a=P[n++],t.push(a);let o=r<16?kc(r):Ad(r);return o!=null?t.string=o:t.string=Io(r)}const ku=(r,e)=>{let t=Ve().map(a=>a.toString()),n=r;e!==void 0&&(r=r<32?-((e<<5)+r):(e<<5)+r,t.highByte=e);let s=we[r];return s&&(s.isShared||Dr)&&((we.restoreStructures||(we.restoreStructures=[]))[r]=s),we[r]=t,t.read=bc(t,n),t.read()};yt[0]=()=>{};yt[0].noBuffer=!0;let Sg={Error,TypeError,ReferenceError};yt[101]=()=>{let r=Ve();return(Sg[r[0]]||Error)(r[1])};yt[105]=r=>{let e=ge.getUint32(p-4);br||(br=new Map);let t=P[p],n;t>=144&&t<160||t==220||t==221?n=[]:n={};let s={target:n};br.set(e,s);let a=Ve();return s.used?Object.assign(n,a):(s.target=a,a)};yt[112]=r=>{let e=ge.getUint32(p-4),t=br.get(e);return t.used=!0,t.target};yt[115]=()=>new Set(Ve());const Cd=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(r=>r+"Array");let Ng=typeof globalThis=="object"?globalThis:window;yt[116]=r=>{let e=r[0],t=Cd[e];if(!t)throw new Error("Could not find typed array for code "+e);return new Ng[t](Uint8Array.prototype.slice.call(r,1).buffer)};yt[120]=()=>{let r=Ve();return new RegExp(r[0],r[1])};const Eg=[];yt[98]=r=>{let e=(r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3],t=p;return p+=e-r.length,Ge=Eg,Ge=[_u(),_u()],Ge.position0=0,Ge.position1=0,Ge.postBundlePosition=p,p=t,Ve()};yt[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 jd(r){let e=xt,t=p,n=kt,s=Vt,a=zr,i=br,o=Ge,c=new Uint8Array(P.slice(0,xt)),d=we,w=we.slice(0,we.length),D=ze,X=Dr,Q=r();return xt=e,p=t,kt=n,Vt=s,zr=a,br=i,Ge=o,P=c,Dr=X,we=d,we.splice(0,we.length,...w),ze=D,ge=new DataView(P.buffer,P.byteOffset,P.byteLength),Q}function Co(){P=null,br=null,we=null}function Ag(r){r.unpack?yt[r.type]=r.unpack:yt[r.type]=r}const Tc=new Array(147);for(let r=0;r<256;r++)Tc[r]=+("1e"+Math.floor(45.15-r*.30103));var Ui=new Is({useRecords:!1});const Ig=Ui.unpack;Ui.unpackMultiple;Ui.unpack;let Cg=new Float32Array(1);new Uint8Array(Cg.buffer,0,4);let za;try{za=new TextEncoder}catch{}let hi,xc;const Di=typeof Buffer<"u",fa=Di?function(r){return Buffer.allocUnsafeSlow(r)}:Uint8Array,Zd=Di?Buffer:Uint8Array,Tu=Di?4294967296:2144337920;let b,Jn,Ee,v=0,ut,Me=null,jg;const Zg=21760,Rg=/[\u0080-\uFFFF]/,kn=Symbol("record-id");class zg extends Is{constructor(e){super(e),this.offset=0;let t,n,s,a,i=Zd.prototype.utf8Write?function(l,T){return b.utf8Write(l,T,4294967295)}:za&&za.encodeInto?function(l,T){return za.encodeInto(l,b.subarray(T)).written}:!1,o=this;e||(e={});let c=e&&e.sequential,d=e.structures||e.saveStructures,w=e.maxSharedStructures;if(w==null&&(w=d?32:0),w>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let D=e.maxOwnStructures;D==null&&(D=d?32:64),!this.structures&&e.useRecords!=!1&&(this.structures=[]);let X=w>32||D+w>64,Q=w+64,Ze=w+D+64;if(Ze>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let ee=[],Qt=0,er=0;this.pack=this.encode=function(l,T){if(b||(b=new fa(8192),Ee=b.dataView||(b.dataView=new DataView(b.buffer,0,8192)),v=0),ut=b.length-10,ut-v<2048?(b=new fa(b.length),Ee=b.dataView||(b.dataView=new DataView(b.buffer,0,b.length)),ut=b.length-10,v=0):v=v+7&2147483640,t=v,T&Vg&&(v+=T&255),a=o.structuredClone?new Map:null,o.bundleStrings&&typeof l!="string"?(Me=[],Me.size=1/0):Me=null,s=o.structures,s){s.uninitialized&&(s=o._mergeStructures(o.getStructures()));let m=s.sharedLength||0;if(m>w)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 y=0;y<m;y++){let k=s[y];if(!k)continue;let R,U=s.transitions;for(let A=0,ne=k.length;A<ne;A++){let F=k[A];R=U[F],R||(R=U[F]=Object.create(null)),U=R}U[kn]=y+64}this.lastNamedStructuresLength=m}c||(s.nextId=m+64)}n&&(n=!1);try{o.randomAccessStructure&&l&&l.constructor&&l.constructor===Object?Ji(l):re(l);let m=Me;if(Me&&Su(t,re,0),a&&a.idsToInsert){let y=a.idsToInsert.sort((A,ne)=>A.offset>ne.offset?1:-1),k=y.length,R=-1;for(;m&&k>0;){let A=y[--k].offset+t;A<m.stringsPosition+t&&R===-1&&(R=0),A>m.position+t?R>=0&&(R+=6):(R>=0&&(Ee.setUint32(m.position+t,Ee.getUint32(m.position+t)+R),R=-1),m=m.previous,k++)}R>=0&&m&&Ee.setUint32(m.position+t,Ee.getUint32(m.position+t)+R),v+=y.length*6,v>ut&&He(v),o.offset=v;let U=Ug(b.subarray(t,v),y);return a=null,U}return o.offset=v,T&Lg?(b.start=t,b.end=v,b):b.subarray(t,v)}finally{if(s&&(Vn(),n&&o.saveStructures)){let m=s.sharedLength||0,y=b.subarray(t,v),k=Mg(s,o);return o.saveStructures(k,k.isCompatible)===!1?o.pack(l,T):(o.lastNamedStructuresLength=m,y)}T&Bg&&(v=t)}};const Vn=()=>{er<10&&er++;let l=s.sharedLength||0;if(s.length>l&&!c&&(s.length=l),Qt>1e4)s.transitions=null,er=0,Qt=0,ee.length>0&&(ee=[]);else if(ee.length>0&&!c){for(let T=0,m=ee.length;T<m;T++)ee[T][kn]=0;ee=[]}},Jr=l=>{var T=l.length;T<16?b[v++]=144|T:T<65536?(b[v++]=220,b[v++]=T>>8,b[v++]=T&255):(b[v++]=221,Ee.setUint32(v,T),v+=4);for(let m=0;m<T;m++)re(l[m])},re=l=>{v>ut&&(b=He(v));var T=typeof l,m;if(T==="string"){let y=l.length;if(Me&&y>=4&&y<4096){if((Me.size+=y)>Zg){let A,ne=(Me[0]?Me[0].length*3+Me[1].length:0)+10;v+ne>ut&&(b=He(v+ne));let F;Me.position?(F=Me,b[v]=200,v+=3,b[v++]=98,A=v-t,v+=4,Su(t,re,0),Ee.setUint16(A+t-3,v-t-A)):(b[v++]=214,b[v++]=98,A=v-t,v+=4),Me=["",""],Me.previous=F,Me.size=0,Me.position=A}let U=Rg.test(l);Me[U?0:1]+=l,b[v++]=193,re(U?-y:y);return}let k;y<32?k=1:y<256?k=2:y<65536?k=3:k=5;let R=y*3;if(v+R>ut&&(b=He(v+R)),y<64||!i){let U,A,ne,F=v+k;for(U=0;U<y;U++)A=l.charCodeAt(U),A<128?b[F++]=A:A<2048?(b[F++]=A>>6|192,b[F++]=A&63|128):(A&64512)===55296&&((ne=l.charCodeAt(U+1))&64512)===56320?(A=65536+((A&1023)<<10)+(ne&1023),U++,b[F++]=A>>18|240,b[F++]=A>>12&63|128,b[F++]=A>>6&63|128,b[F++]=A&63|128):(b[F++]=A>>12|224,b[F++]=A>>6&63|128,b[F++]=A&63|128);m=F-v-k}else m=i(l,v+k);m<32?b[v++]=160|m:m<256?(k<2&&b.copyWithin(v+2,v+1,v+1+m),b[v++]=217,b[v++]=m):m<65536?(k<3&&b.copyWithin(v+3,v+2,v+2+m),b[v++]=218,b[v++]=m>>8,b[v++]=m&255):(k<5&&b.copyWithin(v+5,v+3,v+3+m),b[v++]=219,Ee.setUint32(v,m),v+=4),v+=m}else if(T==="number")if(l>>>0===l)l<32||l<128&&this.useRecords===!1||l<64&&!this.randomAccessStructure?b[v++]=l:l<256?(b[v++]=204,b[v++]=l):l<65536?(b[v++]=205,b[v++]=l>>8,b[v++]=l&255):(b[v++]=206,Ee.setUint32(v,l),v+=4);else if(l>>0===l)l>=-32?b[v++]=256+l:l>=-128?(b[v++]=208,b[v++]=l+256):l>=-32768?(b[v++]=209,Ee.setInt16(v,l),v+=2):(b[v++]=210,Ee.setInt32(v,l),v+=4);else{let y;if((y=this.useFloat32)>0&&l<4294967296&&l>=-2147483648){b[v++]=202,Ee.setFloat32(v,l);let k;if(y<4||(k=l*Tc[(b[v]&127)<<1|b[v+1]>>7])>>0===k){v+=4;return}else v--}b[v++]=203,Ee.setFloat64(v,l),v+=8}else if(T==="object"||T==="function")if(!l)b[v++]=192;else{if(a){let k=a.get(l);if(k){if(!k.id){let R=a.idsToInsert||(a.idsToInsert=[]);k.id=R.push(k)}b[v++]=214,b[v++]=112,Ee.setUint32(v,k.id),v+=4;return}else a.set(l,{offset:v-t})}let y=l.constructor;if(y===Object)tr(l,!0);else if(y===Array)Jr(l);else if(y===Map)if(this.mapAsEmptyObject)b[v++]=128;else{m=l.size,m<16?b[v++]=128|m:m<65536?(b[v++]=222,b[v++]=m>>8,b[v++]=m&255):(b[v++]=223,Ee.setUint32(v,m),v+=4);for(let[k,R]of l)re(k),re(R)}else{for(let k=0,R=hi.length;k<R;k++){let U=xc[k];if(l instanceof U){let A=hi[k];if(A.write){A.type&&(b[v++]=212,b[v++]=A.type,b[v++]=0);let Xe=A.write.call(this,l);Xe===l?Array.isArray(l)?Jr(l):tr(l):re(Xe);return}let ne=b,F=Ee,Ke=v;b=null;let ot;try{ot=A.pack.call(this,l,Xe=>(b=ne,ne=null,v+=Xe,v>ut&&He(v),{target:b,targetView:Ee,position:v-Xe}),re)}finally{ne&&(b=ne,Ee=F,v=Ke,ut=b.length-10)}ot&&(ot.length+v>ut&&He(ot.length+v),v=Pg(ot,b,v,A.type));return}}if(Array.isArray(l))Jr(l);else{if(l.toJSON){const k=l.toJSON();if(k!==l)return re(k)}if(T==="function")return re(this.writeFunction&&this.writeFunction(l));tr(l,!l.hasOwnProperty)}}}else if(T==="boolean")b[v++]=l?195:194;else if(T==="bigint"){if(l<BigInt(1)<<BigInt(63)&&l>=-(BigInt(1)<<BigInt(63)))b[v++]=211,Ee.setBigInt64(v,l);else if(l<BigInt(1)<<BigInt(64)&&l>0)b[v++]=207,Ee.setBigUint64(v,l);else if(this.largeBigIntToFloat)b[v++]=203,Ee.setFloat64(v,Number(l));else throw new RangeError(l+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");v+=8}else if(T==="undefined")this.encodeUndefinedAsNil?b[v++]=192:(b[v++]=212,b[v++]=0,b[v++]=0);else throw new Error("Unknown type: "+T)},Kn=this.variableMapSize||this.coercibleKeyAsNumber?l=>{let T=Object.keys(l),m=T.length;m<16?b[v++]=128|m:m<65536?(b[v++]=222,b[v++]=m>>8,b[v++]=m&255):(b[v++]=223,Ee.setUint32(v,m),v+=4);let y;if(this.coercibleKeyAsNumber)for(let k=0;k<m;k++){y=T[k];let R=Number(y);re(isNaN(R)?y:R),re(l[y])}else for(let k=0;k<m;k++)re(y=T[k]),re(l[y])}:(l,T)=>{b[v++]=222;let m=v-t;v+=2;let y=0;for(let k in l)(T||l.hasOwnProperty(k))&&(re(k),re(l[k]),y++);b[m+++t]=y>>8,b[m+t]=y&255},Fn=this.useRecords===!1?Kn:e.progressiveRecords&&!X?(l,T)=>{let m,y=s.transitions||(s.transitions=Object.create(null)),k=v++-t,R;for(let U in l)if(T||l.hasOwnProperty(U)){if(m=y[U],m)y=m;else{let A=Object.keys(l),ne=y;y=s.transitions;let F=0;for(let Ke=0,ot=A.length;Ke<ot;Ke++){let Xe=A[Ke];m=y[Xe],m||(m=y[Xe]=Object.create(null),F++),y=m}k+t+1==v?(v--,Gr(y,A,F)):qn(y,A,k,F),R=!0,y=ne[U]}re(l[U])}if(!R){let U=y[kn];U?b[k+t]=U:qn(y,Object.keys(l),k,0)}}:(l,T)=>{let m,y=s.transitions||(s.transitions=Object.create(null)),k=0;for(let U in l)(T||l.hasOwnProperty(U))&&(m=y[U],m||(m=y[U]=Object.create(null),k++),y=m);let R=y[kn];R?R>=96&&X?(b[v++]=((R-=96)&31)+96,b[v++]=R>>5):b[v++]=R:Gr(y,y.__keys__||Object.keys(l),k);for(let U in l)(T||l.hasOwnProperty(U))&&re(l[U])},Wn=typeof this.useRecords=="function"&&this.useRecords,tr=Wn?(l,T)=>{Wn(l)?Fn(l,T):Kn(l,T)}:Fn,He=l=>{let T;if(l>16777216){if(l-t>Tu)throw new Error("Packed buffer would be larger than maximum buffer size");T=Math.min(Tu,Math.round(Math.max((l-t)*(l>67108864?1.25:2),4194304)/4096)*4096)}else T=(Math.max(l-t<<2,b.length-1)>>12)+1<<12;let m=new fa(T);return Ee=m.dataView||(m.dataView=new DataView(m.buffer,0,T)),l=Math.min(l,b.length),b.copy?b.copy(m,0,t,l):m.set(b.slice(t,l)),v-=t,t=0,ut=m.length-10,b=m},Gr=(l,T,m)=>{let y=s.nextId;y||(y=64),y<Q&&this.shouldShareStructure&&!this.shouldShareStructure(T)?(y=s.nextOwnId,y<Ze||(y=Q),s.nextOwnId=y+1):(y>=Ze&&(y=Q),s.nextId=y+1);let k=T.highByte=y>=96&&X?y-96>>5:-1;l[kn]=y,l.__keys__=T,s[y-64]=T,y<Q?(T.isShared=!0,s.sharedLength=y-63,n=!0,k>=0?(b[v++]=(y&31)+96,b[v++]=k):b[v++]=y):(k>=0?(b[v++]=213,b[v++]=114,b[v++]=(y&31)+96,b[v++]=k):(b[v++]=212,b[v++]=114,b[v++]=y),m&&(Qt+=er*m),ee.length>=D&&(ee.shift()[kn]=0),ee.push(l),re(T))},qn=(l,T,m,y)=>{let k=b,R=v,U=ut,A=t;b=Jn,v=0,t=0,b||(Jn=b=new fa(8192)),ut=b.length-10,Gr(l,T,y),Jn=b;let ne=v;if(b=k,v=R,ut=U,t=A,ne>1){let F=v+ne-1;F>ut&&He(F);let Ke=m+t;b.copyWithin(Ke+ne,Ke+1,v),b.set(Jn.slice(0,ne),Ke),v=F}else b[m+t]=Jn[0]},Ji=(l,T)=>{let m=jg(l,b,t,v,s,He,(y,k,R)=>{if(R)return n=!0;v=k;let U=b;return re(y),Vn(),U!==b?{position:v,targetView:Ee,target:b}:v},this);if(m===0)return tr(l,!0);v=m}}useBuffer(e){b=e,Ee=new DataView(b.buffer,b.byteOffset,b.byteLength),v=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}xc=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Od];hi=[{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?xu(r,16,e):Ou(Di?Buffer.from(r):new Uint8Array(r),e)}},{pack(r,e){let t=r.constructor;t!==Zd&&this.moreTypes?xu(r,Cd.indexOf(t.name),e):Ou(r,e)}},{pack(r,e){let{target:t,position:n}=e(1);t[n]=193}}];function xu(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 Ou(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 Pg(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 Ug(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 Su(r,e,t){if(Me.length>0){Ee.setUint32(Me.position+r,v+t-Me.position-r),Me.stringsPosition=v-r;let n=Me;Me=null,e(n[0]),e(n[1])}}function Dg(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)");xc.unshift(r.Class),hi.unshift(r)}Ag(r)}function Mg(r,e){return r.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},r}let Rd=new zg({useRecords:!1});const $g=Rd.pack;Rd.pack;const Lg=512,Bg=1024,Vg=2048;class Kg{constructor(){Z(this,"contentType","application/msgpack")}encode(e){return $g(Mn.toSnake(e))}decode(e,t){const n=Mn.toCamel(Ig(new Uint8Array(e)));return t!=null?t.parse(n):n}static registerCustomType(e){Dg({type:0,...e})}}class Fg{constructor(){Z(this,"contentType","application/json")}encode(e){const t=JSON.stringify(Mn.toSnake(e),(n,s)=>ArrayBuffer.isView(s)?Array.from(s):s);return new TextEncoder().encode(t)}decode(e,t){const n=Mn.toCamel(JSON.parse(new TextDecoder().decode(e)));return t!=null?t.parse(n):n}static registerCustomType(){}}new Kg,new Fg;var Te;(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})(Te||(Te={}));var jo;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(jo||(jo={}));const L=Te.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zr=r=>{switch(typeof r){case"undefined":return L.undefined;case"string":return L.string;case"number":return isNaN(r)?L.nan:L.number;case"boolean":return L.boolean;case"function":return L.function;case"bigint":return L.bigint;case"symbol":return L.symbol;case"object":return Array.isArray(r)?L.array:r===null?L.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?L.promise:typeof Map<"u"&&r instanceof Map?L.map:typeof Set<"u"&&r instanceof Set?L.set:typeof Date<"u"&&r instanceof Date?L.date:L.object;default:return L.unknown}},j=Te.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"]),Wg=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Pt 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,c=0;for(;c<i.path.length;){const d=i.path[c];c===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],c++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,Te.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()}}Pt.create=r=>new Pt(r);const Cs=(r,e)=>{let t;switch(r.code){case j.invalid_type:r.received===L.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case j.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,Te.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:t=`Unrecognized key(s) in object: ${Te.joinValues(r.keys,", ")}`;break;case j.invalid_union:t="Invalid input";break;case j.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Te.joinValues(r.options)}`;break;case j.invalid_enum_value:t=`Invalid enum value. Expected ${Te.joinValues(r.options)}, received '${r.received}'`;break;case j.invalid_arguments:t="Invalid function arguments";break;case j.invalid_return_type:t="Invalid function return type";break;case j.invalid_date:t="Invalid date";break;case j.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}"`:Te.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case j.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 j.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 j.custom:t="Invalid input";break;case j.invalid_intersection_types:t="Intersection results could not be merged";break;case j.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case j.not_finite:t="Number must be finite";break;default:t=e.defaultError,Te.assertNever(r)}return{message:t}};let zd=Cs;function qg(r){zd=r}function fi(){return zd}const pi=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const c=n.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},Yg=[];function K(r,e){const t=pi({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,fi(),Cs].filter(n=>!!n)});r.common.issues.push(t)}class it{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 ae;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 it.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 ae;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 ae=Object.freeze({status:"aborted"}),Pd=r=>({status:"dirty",value:r}),gt=r=>({status:"valid",value:r}),Zo=r=>r.status==="aborted",Ro=r=>r.status==="dirty",js=r=>r.status==="valid",mi=r=>typeof Promise<"u"&&r instanceof Promise;var Y;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Y||(Y={}));class Gt{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 Nu=(r,e)=>{if(js(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 Pt(r.common.issues);return this._error=t,this._error}}};function ce(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:(a,i)=>a.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.defaultError},description:s}}class de{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 Zr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Zr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new it,ctx:{common:e.parent.common,data:e.data,parsedType:Zr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(mi(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:Zr(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Nu(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:Zr(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(mi(s)?s:Promise.resolve(s));return Nu(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:j.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!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 $t({schema:this,typeName:H.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return kr.create(this,this._def)}nullable(){return pn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ut.create(this,this._def)}promise(){return Ln.create(this,this._def)}or(e){return Ps.create([this,e],this._def)}and(e){return Us.create(this,e,this._def)}transform(e){return new $t({...ce(this._def),schema:this,typeName:H.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Bs({...ce(this._def),innerType:this,defaultValue:t,typeName:H.ZodDefault})}brand(){return new Dd({typeName:H.ZodBranded,type:this,...ce(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new wi({...ce(this._def),innerType:this,catchValue:t,typeName:H.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Qs.create(this,e)}readonly(){return bi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Jg=/^c[^\s-]{8,}$/i,Gg=/^[a-z][a-z0-9]*$/,Hg=/^[0-9A-HJKMNP-TV-Z]{26}$/,Xg=/^[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,Qg=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ev="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let io;const tv=/^(((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}))$/,rv=/^(([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})))$/,nv=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 sv(r,e){return!!((e==="v4"||!e)&&tv.test(r)||(e==="v6"||!e)&&rv.test(r))}class jt extends de{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==L.string){const s=this._getOrReturnCtx(e);return K(s,{code:j.invalid_type,expected:L.string,received:s.parsedType}),ae}const t=new it;let n;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),K(n,{code:j.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),K(n,{code:j.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(n=this._getOrReturnCtx(e,n),a?K(n,{code:j.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&K(n,{code:j.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if(s.kind==="email")Qg.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"email",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="emoji")io||(io=new RegExp(ev,"u")),io.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"emoji",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="uuid")Xg.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"uuid",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid")Jg.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"cuid",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid2")Gg.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"cuid2",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="ulid")Hg.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"ulid",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),K(n,{validation:"url",code:j.invalid_string,message:s.message}),t.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"regex",code:j.invalid_string,message:s.message}),t.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),K(n,{code:j.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),K(n,{code:j.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),K(n,{code:j.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):s.kind==="datetime"?nv(s).test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{code:j.invalid_string,validation:"datetime",message:s.message}),t.dirty()):s.kind==="ip"?sv(e.data,s.version)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"ip",code:j.invalid_string,message:s.message}),t.dirty()):Te.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:j.invalid_string,...Y.errToObj(n)})}_addCheck(e){return new jt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.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,...Y.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Y.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Y.errToObj(t)})}nonempty(e){return this.min(1,Y.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}}jt.create=r=>{var e;return new jt({checks:[],typeName:H.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ce(r)})};function av(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 Vr extends de{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)!==L.number){const s=this._getOrReturnCtx(e);return K(s,{code:j.invalid_type,expected:L.number,received:s.parsedType}),ae}let t;const n=new it;for(const s of this._def.checks)s.kind==="int"?Te.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),K(t,{code:j.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?av(e.data,s.value)!==0&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),K(t,{code:j.not_finite,message:s.message}),n.dirty()):Te.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,n,s){return new Vr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Y.toString(s)}]})}_addCheck(e){return new Vr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.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"&&Te.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)}}Vr.create=r=>new Vr({checks:[],typeName:H.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...ce(r)});class Kr extends de{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)!==L.bigint){const s=this._getOrReturnCtx(e);return K(s,{code:j.invalid_type,expected:L.bigint,received:s.parsedType}),ae}let t;const n=new it;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):Te.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,n,s){return new Kr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Y.toString(s)}]})}_addCheck(e){return new Kr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.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}}Kr.create=r=>{var e;return new Kr({checks:[],typeName:H.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ce(r)})};class Zs extends de{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==L.boolean){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.boolean,received:t.parsedType}),ae}return gt(e.data)}}Zs.create=r=>new Zs({typeName:H.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...ce(r)});class hn extends de{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==L.date){const s=this._getOrReturnCtx(e);return K(s,{code:j.invalid_type,expected:L.date,received:s.parsedType}),ae}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return K(s,{code:j.invalid_date}),ae}const t=new it;let n;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),K(n,{code:j.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),K(n,{code:j.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):Te.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new hn({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Y.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}}hn.create=r=>new hn({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:H.ZodDate,...ce(r)});class yi extends de{_parse(e){if(this._getType(e)!==L.symbol){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.symbol,received:t.parsedType}),ae}return gt(e.data)}}yi.create=r=>new yi({typeName:H.ZodSymbol,...ce(r)});class Rs extends de{_parse(e){if(this._getType(e)!==L.undefined){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.undefined,received:t.parsedType}),ae}return gt(e.data)}}Rs.create=r=>new Rs({typeName:H.ZodUndefined,...ce(r)});class zs extends de{_parse(e){if(this._getType(e)!==L.null){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.null,received:t.parsedType}),ae}return gt(e.data)}}zs.create=r=>new zs({typeName:H.ZodNull,...ce(r)});class $n extends de{constructor(){super(...arguments),this._any=!0}_parse(e){return gt(e.data)}}$n.create=r=>new $n({typeName:H.ZodAny,...ce(r)});class sn extends de{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gt(e.data)}}sn.create=r=>new sn({typeName:H.ZodUnknown,...ce(r)});class Or extends de{_parse(e){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.never,received:t.parsedType}),ae}}Or.create=r=>new Or({typeName:H.ZodNever,...ce(r)});class gi extends de{_parse(e){if(this._getType(e)!==L.undefined){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.void,received:t.parsedType}),ae}return gt(e.data)}}gi.create=r=>new gi({typeName:H.ZodVoid,...ce(r)});class Ut extends de{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==L.array)return K(t,{code:j.invalid_type,expected:L.array,received:t.parsedType}),ae;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(K(t,{code:i?j.too_big:j.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&&(K(t,{code:j.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&&(K(t,{code:j.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 Gt(t,i,t.path,o)))).then(i=>it.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Gt(t,i,t.path,o)));return it.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Ut({...this._def,minLength:{value:e,message:Y.toString(t)}})}max(e,t){return new Ut({...this._def,maxLength:{value:e,message:Y.toString(t)}})}length(e,t){return new Ut({...this._def,exactLength:{value:e,message:Y.toString(t)}})}nonempty(e){return this.min(1,e)}}Ut.create=(r,e)=>new Ut({type:r,minLength:null,maxLength:null,exactLength:null,typeName:H.ZodArray,...ce(e)});function On(r){if(r instanceof Le){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=kr.create(On(n))}return new Le({...r._def,shape:()=>e})}else return r instanceof Ut?new Ut({...r._def,type:On(r.element)}):r instanceof kr?kr.create(On(r.unwrap())):r instanceof pn?pn.create(On(r.unwrap())):r instanceof Ht?Ht.create(r.items.map(e=>On(e))):r}class Le extends de{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=Te.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==L.object){const c=this._getOrReturnCtx(e);return K(c,{code:j.invalid_type,expected:L.object,received:c.parsedType}),ae}const{status:t,ctx:n}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Or&&this._def.unknownKeys==="strip"))for(const c in n.data)a.includes(c)||i.push(c);const o=[];for(const c of a){const d=s[c],w=n.data[c];o.push({key:{status:"valid",value:c},value:d._parse(new Gt(n,w,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Or){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of i)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(c==="strict")i.length>0&&(K(n,{code:j.unrecognized_keys,keys:i}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of i){const w=n.data[d];o.push({key:{status:"valid",value:d},value:c._parse(new Gt(n,w,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of o){const w=await d.key;c.push({key:w,value:await d.value,alwaysSet:d.alwaysSet})}return c}).then(c=>it.mergeObjectSync(t,c)):it.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new Le({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const c=(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=Y.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new Le({...this._def,unknownKeys:"strip"})}passthrough(){return new Le({...this._def,unknownKeys:"passthrough"})}extend(e){return new Le({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Le({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:H.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Le({...this._def,catchall:e})}pick(e){const t={};return Te.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Le({...this._def,shape:()=>t})}omit(e){const t={};return Te.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Le({...this._def,shape:()=>t})}deepPartial(){return On(this)}partial(e){const t={};return Te.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new Le({...this._def,shape:()=>t})}required(e){const t={};return Te.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof kr;)s=s._def.innerType;t[n]=s}}),new Le({...this._def,shape:()=>t})}keyof(){return Ud(Te.objectKeys(this.shape))}}Le.create=(r,e)=>new Le({shape:()=>r,unknownKeys:"strip",catchall:Or.create(),typeName:H.ZodObject,...ce(e)});Le.strictCreate=(r,e)=>new Le({shape:()=>r,unknownKeys:"strict",catchall:Or.create(),typeName:H.ZodObject,...ce(e)});Le.lazycreate=(r,e)=>new Le({shape:r,unknownKeys:"strip",catchall:Or.create(),typeName:H.ZodObject,...ce(e)});class Ps extends de{_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 Pt(o.ctx.common.issues));return K(t,{code:j.invalid_union,unionErrors:i}),ae}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 c of n){const d={...t,common:{...t.common,issues:[]},parent:null},w=c._parseSync({data:t.data,path:t.path,parent:d});if(w.status==="valid")return w;w.status==="dirty"&&!a&&(a={result:w,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new Pt(c));return K(t,{code:j.invalid_union,unionErrors:o}),ae}}get options(){return this._def.options}}Ps.create=(r,e)=>new Ps({options:r,typeName:H.ZodUnion,...ce(e)});const Pa=r=>r instanceof Ms?Pa(r.schema):r instanceof $t?Pa(r.innerType()):r instanceof $s?[r.value]:r instanceof Fr?r.options:r instanceof Ls?Object.keys(r.enum):r instanceof Bs?Pa(r._def.innerType):r instanceof Rs?[void 0]:r instanceof zs?[null]:null;class Mi extends de{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.object)return K(t,{code:j.invalid_type,expected:L.object,received:t.parsedType}),ae;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}):(K(t,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ae)}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=Pa(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 Mi({typeName:H.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...ce(n)})}}function zo(r,e){const t=Zr(r),n=Zr(e);if(r===e)return{valid:!0,data:r};if(t===L.object&&n===L.object){const s=Te.objectKeys(e),a=Te.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=zo(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===L.array&&n===L.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],c=zo(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===L.date&&n===L.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Us extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Zo(a)||Zo(i))return ae;const o=zo(a.value,i.value);return o.valid?((Ro(a)||Ro(i))&&t.dirty(),{status:t.value,value:o.data}):(K(n,{code:j.invalid_intersection_types}),ae)};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}))}}Us.create=(r,e,t)=>new Us({left:r,right:e,typeName:H.ZodIntersection,...ce(t)});class Ht extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.array)return K(n,{code:j.invalid_type,expected:L.array,received:n.parsedType}),ae;if(n.data.length<this._def.items.length)return K(n,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&n.data.length>this._def.items.length&&(K(n,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...n.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new Gt(n,a,n.path,i)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>it.mergeArray(t,a)):it.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Ht({...this._def,rest:e})}}Ht.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ht({items:r,typeName:H.ZodTuple,rest:null,...ce(e)})};class Ds extends de{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!==L.object)return K(n,{code:j.invalid_type,expected:L.object,received:n.parsedType}),ae;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Gt(n,o,n.path,o)),value:i._parse(new Gt(n,n.data[o],n.path,o))});return n.common.async?it.mergeObjectAsync(t,s):it.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof de?new Ds({keyType:e,valueType:t,typeName:H.ZodRecord,...ce(n)}):new Ds({keyType:jt.create(),valueType:e,typeName:H.ZodRecord,...ce(t)})}}class vi extends de{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!==L.map)return K(n,{code:j.invalid_type,expected:L.map,received:n.parsedType}),ae;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],d)=>({key:s._parse(new Gt(n,o,n.path,[d,"key"])),value:a._parse(new Gt(n,c,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const d=await c.key,w=await c.value;if(d.status==="aborted"||w.status==="aborted")return ae;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const d=c.key,w=c.value;if(d.status==="aborted"||w.status==="aborted")return ae;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}}}}vi.create=(r,e,t)=>new vi({valueType:e,keyType:r,typeName:H.ZodMap,...ce(t)});class fn extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.set)return K(n,{code:j.invalid_type,expected:L.set,received:n.parsedType}),ae;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(K(n,{code:j.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&&(K(n,{code:j.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(c){const d=new Set;for(const w of c){if(w.status==="aborted")return ae;w.status==="dirty"&&t.dirty(),d.add(w.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((c,d)=>a._parse(new Gt(n,c,n.path,d)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new fn({...this._def,minSize:{value:e,message:Y.toString(t)}})}max(e,t){return new fn({...this._def,maxSize:{value:e,message:Y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}fn.create=(r,e)=>new fn({valueType:r,minSize:null,maxSize:null,typeName:H.ZodSet,...ce(e)});class An extends de{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.function)return K(t,{code:j.invalid_type,expected:L.function,received:t.parsedType}),ae;function n(o,c){return pi({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fi(),Cs].filter(d=>!!d),issueData:{code:j.invalid_arguments,argumentsError:c}})}function s(o,c){return pi({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fi(),Cs].filter(d=>!!d),issueData:{code:j.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ln){const o=this;return gt(async function(...c){const d=new Pt([]),w=await o._def.args.parseAsync(c,a).catch(X=>{throw d.addIssue(n(c,X)),d}),D=await Reflect.apply(i,this,w);return await o._def.returns._def.type.parseAsync(D,a).catch(X=>{throw d.addIssue(s(D,X)),d})})}else{const o=this;return gt(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new Pt([n(c,d.error)]);const w=Reflect.apply(i,this,d.data),D=o._def.returns.safeParse(w,a);if(!D.success)throw new Pt([s(w,D.error)]);return D.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new An({...this._def,args:Ht.create(e).rest(sn.create())})}returns(e){return new An({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new An({args:e||Ht.create([]).rest(sn.create()),returns:t||sn.create(),typeName:H.ZodFunction,...ce(n)})}}class Ms extends de{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})}}Ms.create=(r,e)=>new Ms({getter:r,typeName:H.ZodLazy,...ce(e)});class $s extends de{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return K(t,{received:t.data,code:j.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:e.data}}get value(){return this._def.value}}$s.create=(r,e)=>new $s({value:r,typeName:H.ZodLiteral,...ce(e)});function Ud(r,e){return new Fr({values:r,typeName:H.ZodEnum,...ce(e)})}class Fr extends de{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return K(t,{expected:Te.joinValues(n),received:t.parsedType,code:j.invalid_type}),ae}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return K(t,{received:t.data,code:j.invalid_enum_value,options:n}),ae}return gt(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 Fr.create(e)}exclude(e){return Fr.create(this.options.filter(t=>!e.includes(t)))}}Fr.create=Ud;class Ls extends de{_parse(e){const t=Te.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==L.string&&n.parsedType!==L.number){const s=Te.objectValues(t);return K(n,{expected:Te.joinValues(s),received:n.parsedType,code:j.invalid_type}),ae}if(t.indexOf(e.data)===-1){const s=Te.objectValues(t);return K(n,{received:n.data,code:j.invalid_enum_value,options:s}),ae}return gt(e.data)}get enum(){return this._def.values}}Ls.create=(r,e)=>new Ls({values:r,typeName:H.ZodNativeEnum,...ce(e)});class Ln extends de{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.promise&&t.common.async===!1)return K(t,{code:j.invalid_type,expected:L.promise,received:t.parsedType}),ae;const n=t.parsedType===L.promise?t.data:Promise.resolve(t.data);return gt(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ln.create=(r,e)=>new Ln({type:r,typeName:H.ZodPromise,...ce(e)});class $t extends de{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===H.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=>{K(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 c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ae:(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"?ae:(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(!js(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=>js(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);Te.assertNever(s)}}$t.create=(r,e,t)=>new $t({schema:r,typeName:H.ZodEffects,effect:e,...ce(t)});$t.createWithPreprocess=(r,e,t)=>new $t({schema:e,effect:{type:"preprocess",transform:r},typeName:H.ZodEffects,...ce(t)});class kr extends de{_parse(e){return this._getType(e)===L.undefined?gt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}kr.create=(r,e)=>new kr({innerType:r,typeName:H.ZodOptional,...ce(e)});class pn extends de{_parse(e){return this._getType(e)===L.null?gt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pn.create=(r,e)=>new pn({innerType:r,typeName:H.ZodNullable,...ce(e)});class Bs extends de{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===L.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Bs.create=(r,e)=>new Bs({innerType:r,typeName:H.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ce(e)});class wi extends de{_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 mi(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Pt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Pt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}wi.create=(r,e)=>new wi({innerType:r,typeName:H.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ce(e)});class _i extends de{_parse(e){if(this._getType(e)!==L.nan){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.nan,received:t.parsedType}),ae}return{status:"valid",value:e.data}}}_i.create=r=>new _i({typeName:H.ZodNaN,...ce(r)});const iv=Symbol("zod_brand");class Dd extends de{_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 Qs extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ae:s.status==="dirty"?(t.dirty(),Pd(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ae: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 Qs({in:e,out:t,typeName:H.ZodPipeline})}}class bi extends de{_parse(e){const t=this._def.innerType._parse(e);return js(t)&&(t.value=Object.freeze(t.value)),t}}bi.create=(r,e)=>new bi({innerType:r,typeName:H.ZodReadonly,...ce(e)});const Md=(r,e={},t)=>r?$n.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:c})}}):$n.create(),ov={object:Le.lazycreate};var H;(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"})(H||(H={}));const cv=(r,e={message:`Input not instance of ${r.name}`})=>Md(t=>t instanceof r,e),$d=jt.create,Ld=Vr.create,uv=_i.create,lv=Kr.create,Bd=Zs.create,dv=hn.create,hv=yi.create,fv=Rs.create,pv=zs.create,mv=$n.create,yv=sn.create,gv=Or.create,vv=gi.create,wv=Ut.create,_v=Le.create,bv=Le.strictCreate,kv=Ps.create,Tv=Mi.create,xv=Us.create,Ov=Ht.create,Sv=Ds.create,Nv=vi.create,Ev=fn.create,Av=An.create,Iv=Ms.create,Cv=$s.create,jv=Fr.create,Zv=Ls.create,Rv=Ln.create,Eu=$t.create,zv=kr.create,Pv=pn.create,Uv=$t.createWithPreprocess,Dv=Qs.create,Mv=()=>$d().optional(),$v=()=>Ld().optional(),Lv=()=>Bd().optional(),Bv={string:r=>jt.create({...r,coerce:!0}),number:r=>Vr.create({...r,coerce:!0}),boolean:r=>Zs.create({...r,coerce:!0}),bigint:r=>Kr.create({...r,coerce:!0}),date:r=>hn.create({...r,coerce:!0})},Vv=ae;var gr=Object.freeze({__proto__:null,defaultErrorMap:Cs,setErrorMap:qg,getErrorMap:fi,makeIssue:pi,EMPTY_PATH:Yg,addIssueToContext:K,ParseStatus:it,INVALID:ae,DIRTY:Pd,OK:gt,isAborted:Zo,isDirty:Ro,isValid:js,isAsync:mi,get util(){return Te},get objectUtil(){return jo},ZodParsedType:L,getParsedType:Zr,ZodType:de,ZodString:jt,ZodNumber:Vr,ZodBigInt:Kr,ZodBoolean:Zs,ZodDate:hn,ZodSymbol:yi,ZodUndefined:Rs,ZodNull:zs,ZodAny:$n,ZodUnknown:sn,ZodNever:Or,ZodVoid:gi,ZodArray:Ut,ZodObject:Le,ZodUnion:Ps,ZodDiscriminatedUnion:Mi,ZodIntersection:Us,ZodTuple:Ht,ZodRecord:Ds,ZodMap:vi,ZodSet:fn,ZodFunction:An,ZodLazy:Ms,ZodLiteral:$s,ZodEnum:Fr,ZodNativeEnum:Ls,ZodPromise:Ln,ZodEffects:$t,ZodTransformer:$t,ZodOptional:kr,ZodNullable:pn,ZodDefault:Bs,ZodCatch:wi,ZodNaN:_i,BRAND:iv,ZodBranded:Dd,ZodPipeline:Qs,ZodReadonly:bi,custom:Md,Schema:de,ZodSchema:de,late:ov,get ZodFirstPartyTypeKind(){return H},coerce:Bv,any:mv,array:wv,bigint:lv,boolean:Bd,date:dv,discriminatedUnion:Tv,effect:Eu,enum:jv,function:Av,instanceof:cv,intersection:xv,lazy:Iv,literal:Cv,map:Nv,nan:uv,nativeEnum:Zv,never:gv,null:pv,nullable:Pv,number:Ld,object:_v,oboolean:Lv,onumber:$v,optional:zv,ostring:Mv,pipeline:Dv,preprocess:Uv,promise:Rv,record:Sv,set:Ev,strictObject:bv,string:$d,symbol:hv,transformer:Eu,tuple:Ov,undefined:fv,union:kv,unknown:yv,void:vv,NEVER:Vv,ZodIssueCode:j,quotelessJson:Wg,ZodError:Pt});class ea extends Error{constructor(e,t){super(e),Fe(this,"discriminator","FreighterError"),Fe(this,"type"),this.type=t}}const Kv=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},Po="unknown",Au="nil",$i="freighter",ta=gr.object({type:gr.string(),data:gr.string()});class Fv{constructor(){Fe(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Au,data:""};if(Kv(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}return{type:Po,data:JSON.stringify(e)}}decode(e){if(e==null||e.type===Au)return null;if(e.type===Po)return new Iu(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new Iu(e.data)}}const Vd=new Fv,Kd=({encode:r,decode:e})=>Vd.register({encode:r,decode:e}),Oc=r=>Vd.decode(r);class Iu extends ea{constructor(e){super(e,Po)}}class Vs extends ea{constructor(){super("EOF",$i)}}class ki extends ea{constructor(){super("StreamClosed",$i)}}class Ks extends ea{constructor(e={}){const{message:t="Unreachable",url:n=bg.UNKNOWN}=e;super(t,$i),Fe(this,"url"),this.url=n}}const Ua="freighter",Wv=r=>{if(r.type!==$i)return null;if(r instanceof Vs)return{type:Ua,data:"EOF"};if(r instanceof ki)return{type:Ua,data:"StreamClosed"};if(r instanceof Ks)return{type:Ua,data:"Unreachable"};throw new Error(`Unknown error type: ${r.type}: ${r.message}`)},qv=r=>{if(r.type!==Ua)return null;switch(r.data){case"EOF":return new Vs;case"StreamClosed":return new ki;case"Unreachable":return new Ks;default:throw new Error(`Unknown error type: ${r.data}`)}};Kd({encode:Wv,decode:qv});class Fd{constructor(){Fe(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 Wd="Content-Type",Cu=r=>{if(Td.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 Yv extends Fd{constructor(e,t,n=!1){return super(),Fe(this,"endpoint"),Fe(this,"encoder"),Fe(this,"fetch"),this.endpoint=e.replace({protocol:n?"https":"http"}),this.encoder=t,this.fetch=Cu(this.endpoint.protocol),new Proxy(this,{get:(s,a,i)=>a==="endpoint"?this.endpoint:Reflect.get(s,a,i)})}get headers(){return{[Wd]:this.encoder.contentType}}async send(e,t,n){let s=null;const a=this.endpoint.child(e),i={};i.method="POST",i.body=this.encoder.encode(t??{});const[,o]=await this.executeMiddleware({target:a.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async c=>{const d={...c,params:{}};i.headers={...this.headers,...c.params};let w;try{w=await Cu(c.protocol)(c.target,i)}catch(X){let Q=X;return Q.message==="Load failed"&&(Q=new Ks({url:a})),[d,Q]}const D=await w.arrayBuffer();if(w!=null&&w.ok)return n!=null&&(s=this.encoder.decode(D,n)),[d,null];try{if(w.status!==400)return[d,new Error(w.statusText)];const X=this.encoder.decode(D,ta),Q=Oc(X);return[d,Q]}catch(X){return[d,new Error(`[freighter] - failed to decode error: ${w.statusText}: ${X.message}`)]}});return[s,o]}}const _e=async(r,e,t,n)=>{const[s,a]=await r.send(e,t,n);if(a!=null)throw a;return s},Jv=()=>Td.RUNTIME!=="node"?r=>new WebSocket(r):r=>new(require("ws")).WebSocket(r,{rejectUnauthorized:!1}),Gv=gr.object({type:gr.union([gr.literal("data"),gr.literal("close")]),payload:gr.unknown().optional(),error:gr.optional(ta)});class Hv{constructor(e,t,n,s){Fe(this,"encoder"),Fe(this,"reqSchema"),Fe(this,"resSchema"),Fe(this,"ws"),Fe(this,"serverClosed"),Fe(this,"sendClosed"),Fe(this,"receiveDataQueue",[]),Fe(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 Vs;if(this.sendClosed)throw new ki;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=Oc(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(){return this.receiveDataQueue.shift()??await new Promise((t,n)=>this.receiveCallbacksQueue.push({resolve:t,reject:n}))}listenForMessages(){this.ws.onmessage=e=>{const t=this.encoder.decode(e.data,Gv),n=this.receiveCallbacksQueue.shift();n!=null?n.resolve(t):this.receiveDataQueue.push(t)},this.ws.onclose=e=>{this.serverClosed=rw(e)?new Vs:new ki}}}const Xv="freighterctx",Qv=1e3,ew=1001,tw=[Qv,ew],rw=r=>tw.includes(r.code),qd=class Yd extends Fd{constructor(e,t,n=!1){super(),Fe(this,"baseUrl"),Fe(this,"encoder"),this.baseUrl=e.replace({protocol:n?"wss":"ws"}),this.encoder=t}async stream(e,t,n){const s=Jv();let a;const[,i]=await this.executeMiddleware({target:e,protocol:"websocket",params:{},role:"client"},async o=>{const c=s(this.buildURL(e,o)),d={...o,params:{}};c.binaryType=Yd.MESSAGE_TYPE;const w=await this.wrapSocket(c,t,n);return w instanceof Error?[d,w]:(a=w,[d,null])});if(i!=null)throw i;return a}buildURL(e,t){const n=_g({[Wd]:this.encoder.contentType,...t.params},Xv);return this.baseUrl.child(e).toString()+n}async wrapSocket(e,t,n){return await new Promise(s=>{e.onopen=()=>{s(new Hv(e,this.encoder,t,n))},e.onerror=a=>{const i=a;s(new Error(i.message))}})}};Fe(qd,"MESSAGE_TYPE","arraybuffer");let nw=qd;const yr="sy.api.";var Er=(r=>(r.General=yr+"general",r.Parse=yr+"parse",r.Auth=yr+"auth",r.Unexpected=yr+"unexpected",r.Validation=yr+"validation",r.Query=yr+"query",r.Route=yr+"route",r))(Er||{});class qr extends ea{constructor(e){super(e,yr)}}class Pr extends qr{constructor(t){var e=(...q0)=>(super(...q0),h(this,"fields"),this);typeof t=="string"?(e(t),this.fields=[]):Array.isArray(t)?(e(t.map(n=>`${n.field}: ${n.message}`).join(`
|
|
7
|
+
`).slice(0,-1).map(t=>e.parse(JSON.parse(t)))}get timeRange(){return zp("timeRange",this._timeRange),this._timeRange}get byteCapacity(){return new Ja(this.buffer.byteLength)}get capacity(){return this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===Hr?this.byteCapacity:this.dataType.density.size(this.writePos)}get length(){return this.writePos===Hr?this.data.length:this.writePos}convert(e,t=0){if(this.dataType.equals(e))return this;const n=new e.Array(this.length);for(let s=0;s<this.length;s++)n[s]=Rp(this.dataType,e,this.data[s],t);return new At({data:n.buffer,dataType:e,timeRange:this._timeRange,sampleOffset:t,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(Ye.TIMESTAMP))this._max=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this._max=e.reduce((t,n)=>t>n?t:n)}else{const e=this.data;this._max=e.reduce((t,n)=>t>n?t:n)}return this._max}get max(){return this.writePos===0?-1/0:(this._max==null&&(this._max=this.calcRawMax()),Xn(this._max,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(Ye.TIMESTAMP))this._min=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this._min=e.reduce((t,n)=>t<n?t:n)}else{const e=this.data;this._min=e.reduce((t,n)=>t<n?t:n)}return this._min}get min(){return this.writePos===0?1/0:(this._min==null&&(this._min=this.calcRawMin()),Xn(this._min,this.sampleOffset))}get bounds(){return ts(Number(this.min),Number(this.max))}maybeRecomputeMinMax(e){if(this._min!=null){const t=e._min??e.calcRawMin();t<this._min&&(this._min=t)}if(this._max!=null){const t=e._max??e.calcRawMax();t>this._max&&(this._max=t)}}enrich(){this.max,this.min}get range(){return Xn(this.max,-this.min)}at(e,t){e<0&&(e=this.length+e);const n=this.data[e];if(n==null){if(t)throw new Error(`[series] - no value at index ${e}`);return}return Xn(n,this.sampleOffset)}binarySearch(e){let t=0,n=this.length-1;const s=Dh(e);for(;t<=n;){const a=Math.floor((t+n)/2),i=s(this.at(a,!0),e);if(i===0)return a;i<0?t=a+1:n=a-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(Ye.FLOAT32))throw new Error("Only FLOAT32 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:s}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==s)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Hr){s===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const a=this.dataType.density.size(s).valueOf(),i=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,a,i.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,n==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=Hr}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:this.alignmentBounds,timeRange:(e=this._timeRange)==null?void 0:e.toString(),length:this.length,capacity:this.capacity}}get memInfo(){return{key:this.key,length:this.length,byteLength:this.byteLength,glBuffer:this.gl.buffer!=null}}get alignmentBounds(){return ts(this.alignment,this.alignment+this.length)}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}slice(e,t){if(e<=0&&(t==null||t>=this.length))return this;const n=this.data.slice(e,t);return new At({data:n,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+e})}reAlign(e){return new At({data:this.buffer,dataType:this.dataType,timeRange:Ct.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}}const Xn=(r,e)=>typeof r=="bigint"&&typeof e=="bigint"||typeof r=="number"&&typeof e=="number"?r+e:Number(r)+Number(e),ec=S.record(S.union([S.number(),S.string(),S.symbol()]),S.unknown()),Pp=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),Up=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";Up();const Dp=["MacOS","Windows","Linux","Docker"];S.enum(Dp);const Yc=r=>[...new Set(r)],Mp=(...r)=>r.map(wl).join(""),wl=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),$p=r=>r.endsWith("/")?r.slice(0,-1):r;let Lp=(wn=class{constructor({host:r,port:e,protocol:t="",pathPrefix:n=""}){E(this,"protocol"),E(this,"host"),E(this,"port"),E(this,"path"),this.protocol=t,this.host=r,this.port=e,this.path=wl(n)}replace(r){return new wn({host:r.host??this.host,port:r.port??this.port,protocol:r.protocol??this.protocol,pathPrefix:r.pathPrefix??this.path})}child(r){return new wn({...this,pathPrefix:Mp(this.path,r)})}toString(){return $p(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}},E(wn,"UNKNOWN",new wn({host:"unknown",port:0})),wn);const xe=r=>Array.isArray(r)?r:[r];var yo;try{yo=new TextDecoder}catch{}var z,Tt,f=0,Re={},ve,Rr,bt=0,Bt=0,Je,wr,pt=[],ye,Jc={useRecords:!1,mapsAsObjects:!0};class _l{}const bl=new _l;bl.name="MessagePack 0xC1";var Ur=!1,kl=2,Gc;try{new Function("")}catch{kl=1/0}class ms{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(z)return Nl(()=>(vo(),this?this.unpack(e,t):ms.prototype.unpack.call(Jc,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(Tt=t.end||e.length,f=t.start||0):(f=0,Tt=t>-1?t:e.length),Bt=0,Rr=null,Je=null,z=e;try{ye=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw z=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 ms){if(Re=this,this.structures)return ve=this.structures,ca(t);(!ve||ve.length>0)&&(ve=[])}else Re=Jc,(!ve||ve.length>0)&&(ve=[]);return ca(t)}unpackMultiple(e,t){let n,s=0;try{Ur=!0;let a=e.length,i=this?this.unpack(e,a):Ci.unpack(e,a);if(t){if(t(i,s,f)===!1)return;for(;f<a;)if(s=f,t(ca(),s,f)===!1)return}else{for(n=[i];f<a;)s=f,n.push(ca());return n}}catch(a){throw a.lastPosition=s,a.values=n,a}finally{Ur=!1,vo()}}_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 ca(r){try{if(!Re.trusted&&!Ur){let t=ve.sharedLength||0;t<ve.length&&(ve.length=t)}let e;if(Re.randomAccessStructure&&z[f]<64&&z[f]>=32&&Gc?(e=Gc(z,f,Tt,Re),z=null,!(r&&r.lazy)&&e&&(e=e.toJSON()),f=Tt):e=Be(),Je&&(f=Je.postBundlePosition,Je=null),Ur&&(ve.restoreStructures=null),f==Tt)ve&&ve.restoreStructures&&Hc(),ve=null,z=null,wr&&(wr=null);else{if(f>Tt)throw new Error("Unexpected end of MessagePack data");if(!Ur){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 ve&&ve.restoreStructures&&Hc(),vo(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||f>Tt)&&(e.incomplete=!0),e}}function Hc(){for(let r in ve.restoreStructures)ve[r]=ve.restoreStructures[r];ve.restoreStructures=null}function Be(){let r=z[f++];if(r<160)if(r<128){if(r<64)return r;{let e=ve[r&63]||Re.getStructures&&Tl()[r&63];return e?(e.read||(e.read=tc(e,r&63)),e.read()):r}}else if(r<144)if(r-=128,Re.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=Ol();n==="__proto__"&&(n="__proto_"),e[n]=Be()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Be(),Be());return e}else{r-=144;let e=new Array(r);for(let t=0;t<r;t++)e[t]=Be();return Re.freezeData?Object.freeze(e):e}else if(r<192){let e=r-160;if(Bt>=f)return Rr.slice(f-bt,(f+=e)-bt);if(Bt==0&&Tt<140){let t=e<16?rc(e):xl(e);if(t!=null)return t}return go(e)}else{let e;switch(r){case 192:return null;case 193:return Je?(e=Be(),e>0?Je[1].slice(Je.position1,Je.position1+=e):Je[0].slice(Je.position0,Je.position0-=e)):bl;case 194:return!1;case 195:return!0;case 196:if(e=z[f++],e===void 0)throw new Error("Unexpected end of buffer");return Qi(e);case 197:return e=ye.getUint16(f),f+=2,Qi(e);case 198:return e=ye.getUint32(f),f+=4,Qi(e);case 199:return Xr(z[f++]);case 200:return e=ye.getUint16(f),f+=2,Xr(e);case 201:return e=ye.getUint32(f),f+=4,Xr(e);case 202:if(e=ye.getFloat32(f),Re.useFloat32>2){let t=nc[(z[f]&127)<<1|z[f+1]>>7];return f+=4,(t*e+(e>0?.5:-.5)>>0)/t}return f+=4,e;case 203:return e=ye.getFloat64(f),f+=8,e;case 204:return z[f++];case 205:return e=ye.getUint16(f),f+=2,e;case 206:return e=ye.getUint32(f),f+=4,e;case 207:return Re.int64AsType==="number"?(e=ye.getUint32(f)*4294967296,e+=ye.getUint32(f+4)):Re.int64AsType==="string"?e=ye.getBigUint64(f).toString():Re.int64AsType==="auto"?(e=ye.getBigUint64(f),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ye.getBigUint64(f),f+=8,e;case 208:return ye.getInt8(f++);case 209:return e=ye.getInt16(f),f+=2,e;case 210:return e=ye.getInt32(f),f+=4,e;case 211:return Re.int64AsType==="number"?(e=ye.getInt32(f)*4294967296,e+=ye.getUint32(f+4)):Re.int64AsType==="string"?e=ye.getBigInt64(f).toString():Re.int64AsType==="auto"?(e=ye.getBigInt64(f),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ye.getBigInt64(f),f+=8,e;case 212:if(e=z[f++],e==114)return nu(z[f++]&63);{let t=pt[e];if(t)return t.read?(f++,t.read(Be())):t.noBuffer?(f++,t()):t(z.subarray(f,++f));throw new Error("Unknown extension "+e)}case 213:return e=z[f],e==114?(f++,nu(z[f++]&63,z[f++])):Xr(2);case 214:return Xr(4);case 215:return Xr(8);case 216:return Xr(16);case 217:return e=z[f++],Bt>=f?Rr.slice(f-bt,(f+=e)-bt):Vp(e);case 218:return e=ye.getUint16(f),f+=2,Bt>=f?Rr.slice(f-bt,(f+=e)-bt):Kp(e);case 219:return e=ye.getUint32(f),f+=4,Bt>=f?Rr.slice(f-bt,(f+=e)-bt):Fp(e);case 220:return e=ye.getUint16(f),f+=2,Qc(e);case 221:return e=ye.getUint32(f),f+=4,Qc(e);case 222:return e=ye.getUint16(f),f+=2,eu(e);case 223:return e=ye.getUint32(f),f+=4,eu(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 Bp=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function tc(r,e){function t(){if(t.count++>kl){let s=r.read=new Function("r","return function(){return "+(Re.freezeData?"Object.freeze":"")+"({"+r.map(a=>a==="__proto__"?"__proto_:r()":Bp.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(Be);return r.highByte===0&&(r.read=Xc(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]=Be()}return Re.freezeData?Object.freeze(n):n}return t.count=0,r.highByte===0?Xc(e,t):t}const Xc=(r,e)=>function(){let t=z[f++];if(t===0)return e();let n=r<32?-(r+(t<<5)):r+(t<<5),s=ve[n]||Tl()[n];if(!s)throw new Error("Record id is not defined for "+n);return s.read||(s.read=tc(s,r)),s.read()};function Tl(){let r=Nl(()=>(z=null,Re.getStructures()));return ve=Re._mergeStructures(r,ve)}var go=Ys,Vp=Ys,Kp=Ys,Fp=Ys;function Ys(r){let e;if(r<16&&(e=rc(r)))return e;if(r>64&&yo)return yo.decode(z.subarray(f,f+=r));const t=f+r,n=[];for(e="";f<t;){const s=z[f++];if(!(s&128))n.push(s);else if((s&224)===192){const a=z[f++]&63;n.push((s&31)<<6|a)}else if((s&240)===224){const a=z[f++]&63,i=z[f++]&63;n.push((s&31)<<12|a<<6|i)}else if((s&248)===240){const a=z[f++]&63,i=z[f++]&63,o=z[f++]&63;let c=(s&7)<<18|a<<12|i<<6|o;c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|c&1023),n.push(c)}else n.push(s);n.length>=4096&&(e+=We.apply(String,n),n.length=0)}return n.length>0&&(e+=We.apply(String,n)),e}function Qc(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=Be();return Re.freezeData?Object.freeze(e):e}function eu(r){if(Re.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=Ol();n==="__proto__"&&(n="__proto_"),e[n]=Be()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Be(),Be());return e}}var We=String.fromCharCode;function xl(r){let e=f,t=new Array(r);for(let n=0;n<r;n++){const s=z[f++];if((s&128)>0){f=e;return}t[n]=s}return We.apply(String,t)}function rc(r){if(r<4)if(r<2){if(r===0)return"";{let e=z[f++];if((e&128)>1){f-=1;return}return We(e)}}else{let e=z[f++],t=z[f++];if((e&128)>0||(t&128)>0){f-=2;return}if(r<3)return We(e,t);let n=z[f++];if((n&128)>0){f-=3;return}return We(e,t,n)}else{let e=z[f++],t=z[f++],n=z[f++],s=z[f++];if((e&128)>0||(t&128)>0||(n&128)>0||(s&128)>0){f-=4;return}if(r<6){if(r===4)return We(e,t,n,s);{let a=z[f++];if((a&128)>0){f-=5;return}return We(e,t,n,s,a)}}else if(r<8){let a=z[f++],i=z[f++];if((a&128)>0||(i&128)>0){f-=6;return}if(r<7)return We(e,t,n,s,a,i);let o=z[f++];if((o&128)>0){f-=7;return}return We(e,t,n,s,a,i,o)}else{let a=z[f++],i=z[f++],o=z[f++],c=z[f++];if((a&128)>0||(i&128)>0||(o&128)>0||(c&128)>0){f-=8;return}if(r<10){if(r===8)return We(e,t,n,s,a,i,o,c);{let d=z[f++];if((d&128)>0){f-=9;return}return We(e,t,n,s,a,i,o,c,d)}}else if(r<12){let d=z[f++],w=z[f++];if((d&128)>0||(w&128)>0){f-=10;return}if(r<11)return We(e,t,n,s,a,i,o,c,d,w);let D=z[f++];if((D&128)>0){f-=11;return}return We(e,t,n,s,a,i,o,c,d,w,D)}else{let d=z[f++],w=z[f++],D=z[f++],X=z[f++];if((d&128)>0||(w&128)>0||(D&128)>0||(X&128)>0){f-=12;return}if(r<14){if(r===12)return We(e,t,n,s,a,i,o,c,d,w,D,X);{let Q=z[f++];if((Q&128)>0){f-=13;return}return We(e,t,n,s,a,i,o,c,d,w,D,X,Q)}}else{let Q=z[f++],Ze=z[f++];if((Q&128)>0||(Ze&128)>0){f-=14;return}if(r<15)return We(e,t,n,s,a,i,o,c,d,w,D,X,Q,Ze);let ee=z[f++];if((ee&128)>0){f-=15;return}return We(e,t,n,s,a,i,o,c,d,w,D,X,Q,Ze,ee)}}}}}function tu(){let r=z[f++],e;if(r<192)e=r-160;else switch(r){case 217:e=z[f++];break;case 218:e=ye.getUint16(f),f+=2;break;case 219:e=ye.getUint32(f),f+=4;break;default:throw new Error("Expected string")}return Ys(e)}function Qi(r){return Re.copyBuffers?Uint8Array.prototype.slice.call(z,f,f+=r):z.subarray(f,f+=r)}function Xr(r){let e=z[f++];if(pt[e]){let t;return pt[e](z.subarray(f,t=f+=r),n=>{f=n;try{return Be()}finally{f=t}})}else throw new Error("Unknown extension type "+e)}var ru=new Array(4096);function Ol(){let r=z[f++];if(r>=160&&r<192){if(r=r-160,Bt>=f)return Rr.slice(f-bt,(f+=r)-bt);if(!(Bt==0&&Tt<180))return go(r)}else return f--,Be().toString();let e=(r<<5^(r>1?ye.getUint16(f):r>0?z[f]:0))&4095,t=ru[e],n=f,s=f+r-3,a,i=0;if(t&&t.bytes==r){for(;n<s;){if(a=ye.getUint32(n),a!=t[i++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(a=z[n++],a!=t[i++]){n=1879048192;break}if(n===s)return f=n,t.string;s-=3,n=f}for(t=[],ru[e]=t,t.bytes=r;n<s;)a=ye.getUint32(n),t.push(a),n+=4;for(s+=3;n<s;)a=z[n++],t.push(a);let o=r<16?rc(r):xl(r);return o!=null?t.string=o:t.string=go(r)}const nu=(r,e)=>{let t=Be().map(a=>a.toString()),n=r;e!==void 0&&(r=r<32?-((e<<5)+r):(e<<5)+r,t.highByte=e);let s=ve[r];return s&&(s.isShared||Ur)&&((ve.restoreStructures||(ve.restoreStructures=[]))[r]=s),ve[r]=t,t.read=tc(t,n),t.read()};pt[0]=()=>{};pt[0].noBuffer=!0;let Wp={Error,TypeError,ReferenceError};pt[101]=()=>{let r=Be();return(Wp[r[0]]||Error)(r[1])};pt[105]=r=>{let e=ye.getUint32(f-4);wr||(wr=new Map);let t=z[f],n;t>=144&&t<160||t==220||t==221?n=[]:n={};let s={target:n};wr.set(e,s);let a=Be();return s.used?Object.assign(n,a):(s.target=a,a)};pt[112]=r=>{let e=ye.getUint32(f-4),t=wr.get(e);return t.used=!0,t.target};pt[115]=()=>new Set(Be());const Sl=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(r=>r+"Array");let qp=typeof globalThis=="object"?globalThis:window;pt[116]=r=>{let e=r[0],t=Sl[e];if(!t)throw new Error("Could not find typed array for code "+e);return new qp[t](Uint8Array.prototype.slice.call(r,1).buffer)};pt[120]=()=>{let r=Be();return new RegExp(r[0],r[1])};const Yp=[];pt[98]=r=>{let e=(r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3],t=f;return f+=e-r.length,Je=Yp,Je=[tu(),tu()],Je.position0=0,Je.position1=0,Je.postBundlePosition=f,f=t,Be()};pt[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 Nl(r){let e=Tt,t=f,n=bt,s=Bt,a=Rr,i=wr,o=Je,c=new Uint8Array(z.slice(0,Tt)),d=ve,w=ve.slice(0,ve.length),D=Re,X=Ur,Q=r();return Tt=e,f=t,bt=n,Bt=s,Rr=a,wr=i,Je=o,z=c,Ur=X,ve=d,ve.splice(0,ve.length,...w),Re=D,ye=new DataView(z.buffer,z.byteOffset,z.byteLength),Q}function vo(){z=null,wr=null,ve=null}function Jp(r){r.unpack?pt[r.type]=r.unpack:pt[r.type]=r}const nc=new Array(147);for(let r=0;r<256;r++)nc[r]=+("1e"+Math.floor(45.15-r*.30103));var Ci=new ms({useRecords:!1});const Gp=Ci.unpack;Ci.unpackMultiple;Ci.unpack;let Hp=new Float32Array(1);new Uint8Array(Hp.buffer,0,4);let Ta;try{Ta=new TextEncoder}catch{}let Ga,sc;const ji=typeof Buffer<"u",ua=ji?function(r){return Buffer.allocUnsafeSlow(r)}:Uint8Array,El=ji?Buffer:Uint8Array,su=ji?4294967296:2144337920;let _,Yn,Ne,g=0,ct,De=null,Xp;const Qp=21760,em=/[\u0080-\uFFFF]/,_n=Symbol("record-id");class tm extends ms{constructor(e){super(e),this.offset=0;let t,n,s,a,i=El.prototype.utf8Write?function(l,T){return _.utf8Write(l,T,4294967295)}:Ta&&Ta.encodeInto?function(l,T){return Ta.encodeInto(l,_.subarray(T)).written}:!1,o=this;e||(e={});let c=e&&e.sequential,d=e.structures||e.saveStructures,w=e.maxSharedStructures;if(w==null&&(w=d?32:0),w>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let D=e.maxOwnStructures;D==null&&(D=d?32:64),!this.structures&&e.useRecords!=!1&&(this.structures=[]);let X=w>32||D+w>64,Q=w+64,Ze=w+D+64;if(Ze>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let ee=[],Qt=0,er=0;this.pack=this.encode=function(l,T){if(_||(_=new ua(8192),Ne=_.dataView||(_.dataView=new DataView(_.buffer,0,8192)),g=0),ct=_.length-10,ct-g<2048?(_=new ua(_.length),Ne=_.dataView||(_.dataView=new DataView(_.buffer,0,_.length)),ct=_.length-10,g=0):g=g+7&2147483640,t=g,T&um&&(g+=T&255),a=o.structuredClone?new Map:null,o.bundleStrings&&typeof l!="string"?(De=[],De.size=1/0):De=null,s=o.structures,s){s.uninitialized&&(s=o._mergeStructures(o.getStructures()));let m=s.sharedLength||0;if(m>w)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 y=0;y<m;y++){let k=s[y];if(!k)continue;let R,U=s.transitions;for(let A=0,ne=k.length;A<ne;A++){let F=k[A];R=U[F],R||(R=U[F]=Object.create(null)),U=R}U[_n]=y+64}this.lastNamedStructuresLength=m}c||(s.nextId=m+64)}n&&(n=!1);try{o.randomAccessStructure&&l&&l.constructor&&l.constructor===Object?Ji(l):re(l);let m=De;if(De&&ou(t,re,0),a&&a.idsToInsert){let y=a.idsToInsert.sort((A,ne)=>A.offset>ne.offset?1:-1),k=y.length,R=-1;for(;m&&k>0;){let A=y[--k].offset+t;A<m.stringsPosition+t&&R===-1&&(R=0),A>m.position+t?R>=0&&(R+=6):(R>=0&&(Ne.setUint32(m.position+t,Ne.getUint32(m.position+t)+R),R=-1),m=m.previous,k++)}R>=0&&m&&Ne.setUint32(m.position+t,Ne.getUint32(m.position+t)+R),g+=y.length*6,g>ct&&He(g),o.offset=g;let U=nm(_.subarray(t,g),y);return a=null,U}return o.offset=g,T&om?(_.start=t,_.end=g,_):_.subarray(t,g)}finally{if(s&&(Vn(),n&&o.saveStructures)){let m=s.sharedLength||0,y=_.subarray(t,g),k=am(s,o);return o.saveStructures(k,k.isCompatible)===!1?o.pack(l,T):(o.lastNamedStructuresLength=m,y)}T&cm&&(g=t)}};const Vn=()=>{er<10&&er++;let l=s.sharedLength||0;if(s.length>l&&!c&&(s.length=l),Qt>1e4)s.transitions=null,er=0,Qt=0,ee.length>0&&(ee=[]);else if(ee.length>0&&!c){for(let T=0,m=ee.length;T<m;T++)ee[T][_n]=0;ee=[]}},Jr=l=>{var T=l.length;T<16?_[g++]=144|T:T<65536?(_[g++]=220,_[g++]=T>>8,_[g++]=T&255):(_[g++]=221,Ne.setUint32(g,T),g+=4);for(let m=0;m<T;m++)re(l[m])},re=l=>{g>ct&&(_=He(g));var T=typeof l,m;if(T==="string"){let y=l.length;if(De&&y>=4&&y<4096){if((De.size+=y)>Qp){let A,ne=(De[0]?De[0].length*3+De[1].length:0)+10;g+ne>ct&&(_=He(g+ne));let F;De.position?(F=De,_[g]=200,g+=3,_[g++]=98,A=g-t,g+=4,ou(t,re,0),Ne.setUint16(A+t-3,g-t-A)):(_[g++]=214,_[g++]=98,A=g-t,g+=4),De=["",""],De.previous=F,De.size=0,De.position=A}let U=em.test(l);De[U?0:1]+=l,_[g++]=193,re(U?-y:y);return}let k;y<32?k=1:y<256?k=2:y<65536?k=3:k=5;let R=y*3;if(g+R>ct&&(_=He(g+R)),y<64||!i){let U,A,ne,F=g+k;for(U=0;U<y;U++)A=l.charCodeAt(U),A<128?_[F++]=A:A<2048?(_[F++]=A>>6|192,_[F++]=A&63|128):(A&64512)===55296&&((ne=l.charCodeAt(U+1))&64512)===56320?(A=65536+((A&1023)<<10)+(ne&1023),U++,_[F++]=A>>18|240,_[F++]=A>>12&63|128,_[F++]=A>>6&63|128,_[F++]=A&63|128):(_[F++]=A>>12|224,_[F++]=A>>6&63|128,_[F++]=A&63|128);m=F-g-k}else m=i(l,g+k);m<32?_[g++]=160|m:m<256?(k<2&&_.copyWithin(g+2,g+1,g+1+m),_[g++]=217,_[g++]=m):m<65536?(k<3&&_.copyWithin(g+3,g+2,g+2+m),_[g++]=218,_[g++]=m>>8,_[g++]=m&255):(k<5&&_.copyWithin(g+5,g+3,g+3+m),_[g++]=219,Ne.setUint32(g,m),g+=4),g+=m}else if(T==="number")if(l>>>0===l)l<32||l<128&&this.useRecords===!1||l<64&&!this.randomAccessStructure?_[g++]=l:l<256?(_[g++]=204,_[g++]=l):l<65536?(_[g++]=205,_[g++]=l>>8,_[g++]=l&255):(_[g++]=206,Ne.setUint32(g,l),g+=4);else if(l>>0===l)l>=-32?_[g++]=256+l:l>=-128?(_[g++]=208,_[g++]=l+256):l>=-32768?(_[g++]=209,Ne.setInt16(g,l),g+=2):(_[g++]=210,Ne.setInt32(g,l),g+=4);else{let y;if((y=this.useFloat32)>0&&l<4294967296&&l>=-2147483648){_[g++]=202,Ne.setFloat32(g,l);let k;if(y<4||(k=l*nc[(_[g]&127)<<1|_[g+1]>>7])>>0===k){g+=4;return}else g--}_[g++]=203,Ne.setFloat64(g,l),g+=8}else if(T==="object"||T==="function")if(!l)_[g++]=192;else{if(a){let k=a.get(l);if(k){if(!k.id){let R=a.idsToInsert||(a.idsToInsert=[]);k.id=R.push(k)}_[g++]=214,_[g++]=112,Ne.setUint32(g,k.id),g+=4;return}else a.set(l,{offset:g-t})}let y=l.constructor;if(y===Object)tr(l,!0);else if(y===Array)Jr(l);else if(y===Map)if(this.mapAsEmptyObject)_[g++]=128;else{m=l.size,m<16?_[g++]=128|m:m<65536?(_[g++]=222,_[g++]=m>>8,_[g++]=m&255):(_[g++]=223,Ne.setUint32(g,m),g+=4);for(let[k,R]of l)re(k),re(R)}else{for(let k=0,R=Ga.length;k<R;k++){let U=sc[k];if(l instanceof U){let A=Ga[k];if(A.write){A.type&&(_[g++]=212,_[g++]=A.type,_[g++]=0);let Xe=A.write.call(this,l);Xe===l?Array.isArray(l)?Jr(l):tr(l):re(Xe);return}let ne=_,F=Ne,Ke=g;_=null;let ot;try{ot=A.pack.call(this,l,Xe=>(_=ne,ne=null,g+=Xe,g>ct&&He(g),{target:_,targetView:Ne,position:g-Xe}),re)}finally{ne&&(_=ne,Ne=F,g=Ke,ct=_.length-10)}ot&&(ot.length+g>ct&&He(ot.length+g),g=rm(ot,_,g,A.type));return}}if(Array.isArray(l))Jr(l);else{if(l.toJSON){const k=l.toJSON();if(k!==l)return re(k)}if(T==="function")return re(this.writeFunction&&this.writeFunction(l));tr(l,!l.hasOwnProperty)}}}else if(T==="boolean")_[g++]=l?195:194;else if(T==="bigint"){if(l<BigInt(1)<<BigInt(63)&&l>=-(BigInt(1)<<BigInt(63)))_[g++]=211,Ne.setBigInt64(g,l);else if(l<BigInt(1)<<BigInt(64)&&l>0)_[g++]=207,Ne.setBigUint64(g,l);else if(this.largeBigIntToFloat)_[g++]=203,Ne.setFloat64(g,Number(l));else throw new RangeError(l+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");g+=8}else if(T==="undefined")this.encodeUndefinedAsNil?_[g++]=192:(_[g++]=212,_[g++]=0,_[g++]=0);else throw new Error("Unknown type: "+T)},Kn=this.variableMapSize||this.coercibleKeyAsNumber?l=>{let T=Object.keys(l),m=T.length;m<16?_[g++]=128|m:m<65536?(_[g++]=222,_[g++]=m>>8,_[g++]=m&255):(_[g++]=223,Ne.setUint32(g,m),g+=4);let y;if(this.coercibleKeyAsNumber)for(let k=0;k<m;k++){y=T[k];let R=Number(y);re(isNaN(R)?y:R),re(l[y])}else for(let k=0;k<m;k++)re(y=T[k]),re(l[y])}:(l,T)=>{_[g++]=222;let m=g-t;g+=2;let y=0;for(let k in l)(T||l.hasOwnProperty(k))&&(re(k),re(l[k]),y++);_[m+++t]=y>>8,_[m+t]=y&255},Fn=this.useRecords===!1?Kn:e.progressiveRecords&&!X?(l,T)=>{let m,y=s.transitions||(s.transitions=Object.create(null)),k=g++-t,R;for(let U in l)if(T||l.hasOwnProperty(U)){if(m=y[U],m)y=m;else{let A=Object.keys(l),ne=y;y=s.transitions;let F=0;for(let Ke=0,ot=A.length;Ke<ot;Ke++){let Xe=A[Ke];m=y[Xe],m||(m=y[Xe]=Object.create(null),F++),y=m}k+t+1==g?(g--,Gr(y,A,F)):qn(y,A,k,F),R=!0,y=ne[U]}re(l[U])}if(!R){let U=y[_n];U?_[k+t]=U:qn(y,Object.keys(l),k,0)}}:(l,T)=>{let m,y=s.transitions||(s.transitions=Object.create(null)),k=0;for(let U in l)(T||l.hasOwnProperty(U))&&(m=y[U],m||(m=y[U]=Object.create(null),k++),y=m);let R=y[_n];R?R>=96&&X?(_[g++]=((R-=96)&31)+96,_[g++]=R>>5):_[g++]=R:Gr(y,y.__keys__||Object.keys(l),k);for(let U in l)(T||l.hasOwnProperty(U))&&re(l[U])},Wn=typeof this.useRecords=="function"&&this.useRecords,tr=Wn?(l,T)=>{Wn(l)?Fn(l,T):Kn(l,T)}:Fn,He=l=>{let T;if(l>16777216){if(l-t>su)throw new Error("Packed buffer would be larger than maximum buffer size");T=Math.min(su,Math.round(Math.max((l-t)*(l>67108864?1.25:2),4194304)/4096)*4096)}else T=(Math.max(l-t<<2,_.length-1)>>12)+1<<12;let m=new ua(T);return Ne=m.dataView||(m.dataView=new DataView(m.buffer,0,T)),l=Math.min(l,_.length),_.copy?_.copy(m,0,t,l):m.set(_.slice(t,l)),g-=t,t=0,ct=m.length-10,_=m},Gr=(l,T,m)=>{let y=s.nextId;y||(y=64),y<Q&&this.shouldShareStructure&&!this.shouldShareStructure(T)?(y=s.nextOwnId,y<Ze||(y=Q),s.nextOwnId=y+1):(y>=Ze&&(y=Q),s.nextId=y+1);let k=T.highByte=y>=96&&X?y-96>>5:-1;l[_n]=y,l.__keys__=T,s[y-64]=T,y<Q?(T.isShared=!0,s.sharedLength=y-63,n=!0,k>=0?(_[g++]=(y&31)+96,_[g++]=k):_[g++]=y):(k>=0?(_[g++]=213,_[g++]=114,_[g++]=(y&31)+96,_[g++]=k):(_[g++]=212,_[g++]=114,_[g++]=y),m&&(Qt+=er*m),ee.length>=D&&(ee.shift()[_n]=0),ee.push(l),re(T))},qn=(l,T,m,y)=>{let k=_,R=g,U=ct,A=t;_=Yn,g=0,t=0,_||(Yn=_=new ua(8192)),ct=_.length-10,Gr(l,T,y),Yn=_;let ne=g;if(_=k,g=R,ct=U,t=A,ne>1){let F=g+ne-1;F>ct&&He(F);let Ke=m+t;_.copyWithin(Ke+ne,Ke+1,g),_.set(Yn.slice(0,ne),Ke),g=F}else _[m+t]=Yn[0]},Ji=(l,T)=>{let m=Xp(l,_,t,g,s,He,(y,k,R)=>{if(R)return n=!0;g=k;let U=_;return re(y),Vn(),U!==_?{position:g,targetView:Ne,target:_}:g},this);if(m===0)return tr(l,!0);g=m}}useBuffer(e){_=e,Ne=new DataView(_.buffer,_.byteOffset,_.byteLength),g=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}sc=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,_l];Ga=[{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?au(r,16,e):iu(ji?Buffer.from(r):new Uint8Array(r),e)}},{pack(r,e){let t=r.constructor;t!==El&&this.moreTypes?au(r,Sl.indexOf(t.name),e):iu(r,e)}},{pack(r,e){let{target:t,position:n}=e(1);t[n]=193}}];function au(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 iu(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 rm(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 nm(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 ou(r,e,t){if(De.length>0){Ne.setUint32(De.position+r,g+t-De.position-r),De.stringsPosition=g-r;let n=De;De=null,e(n[0]),e(n[1])}}function sm(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)");sc.unshift(r.Class),Ga.unshift(r)}Jp(r)}function am(r,e){return r.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},r}let Al=new tm({useRecords:!1});const im=Al.pack;Al.pack;const om=512,cm=1024,um=2048;class ac{constructor(){E(this,"contentType","application/msgpack")}encode(e){return im(zn.toSnake(e))}decode(e,t){const n=zn.toCamel(Gp(new Uint8Array(e)));return t!=null?t.parse(n):n}static registerCustomType(e){sm({type:0,...e})}}class ic{constructor(){E(this,"contentType","application/json")}encode(e){const t=JSON.stringify(zn.toSnake(e),(n,s)=>ArrayBuffer.isView(s)?Array.from(s):s);return new TextEncoder().encode(t)}decode(e,t){const n=zn.toCamel(JSON.parse(new TextDecoder().decode(e)));return t!=null?t.parse(n):n}static registerCustomType(){}}const lm=[new ac,new ic],Il=[ac,ic],dm=r=>Il.forEach(e=>{e.registerCustomType(r)}),Cl=Object.freeze(Object.defineProperty({__proto__:null,ENCODERS:lm,ENCODER_CLASSES:Il,JSONEncoderDecoder:ic,MsgpackEncoderDecoder:ac,registerCustomTypeEncoder:dm},Symbol.toStringTag,{value:"Module"}));class hm{constructor(e){E(this,"handlers"),this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((t,n)=>n(e))}}const Ha=Object.freeze(Object.defineProperty({__proto__:null,Observer:hm},Symbol.toStringTag,{value:"Module"})),Js=u.z.number(),Gs=u.z.object({name:u.z.string(),key:u.z.number(),rate:qs.z,dataType:Ye.z,leaseholder:u.z.number(),index:u.z.number(),isIndex:u.z.boolean(),alias:u.z.string().optional()}),jl=Gs.extend({key:u.z.number().optional(),leaseholder:u.z.number().optional(),index:u.z.number().optional(),rate:qs.z.optional(),isIndex:u.z.boolean().optional()}),Zl=r=>r.map(e=>({name:e.name,dataType:new Ye(e.dataType),rate:new qs(e.rate??0),leaseholder:e.leaseholder,index:e.index,isIndex:e.isIndex}));u.z.object({channels:jl.array()});const fm=u.z.object({channels:Gs.array()}),xi=class xi{constructor(e){h(this,"client");this.client=e}async create(e){const t={channels:Zl(e)},[n,s]=await this.client.send(xi.ENDPOINT,t,fm);if(s!=null)throw s;return n.channels}};h(xi,"ENDPOINT","/channel/create");let Xa=xi;u.z.object({leaseholder:u.z.number().optional(),keys:u.z.number().array().optional(),names:u.z.string().array().optional(),search:u.z.string().optional(),rangeKey:u.z.string().optional(),limit:u.z.number().optional(),offset:u.z.number().optional()});const pm=u.z.object({channels:Gs.array()}),Oi=class Oi{constructor(e){h(this,"client");this.client=e}async search(e,t){return await this.execute({search:e,rangeKey:t})}async retrieve(e,t){const{variant:n,normalized:s}=gn(e);return await this.execute({[n]:s,rangeKey:t})}async page(e,t,n){return await this.execute({offset:e,limit:t,rangeKey:n})}async execute(e){const[t,n]=await this.client.send(Oi.ENDPOINT,e,pm);if(n!=null)throw n;return t.channels}};h(Oi,"ENDPOINT","/channel/retrieve");let Qa=Oi;class Rl{constructor(e){h(this,"cache");h(this,"namesToKeys");h(this,"wrapped");this.cache=new Map,this.namesToKeys=new Map,this.wrapped=e}async search(e,t){return await this.wrapped.search(e,t)}async page(e,t,n){return await this.wrapped.page(e,t,n)}async retrieve(e){const{normalized:t}=gn(e),n=[],s=[];if(t.forEach(i=>{const o=this.getFromCache(i);o!=null?n.push(o):s.push(i)}),s.length===0)return n;const a=await this.wrapped.retrieve(s);return this.updateCache(a),n.concat(a)}updateCache(e){e.forEach(t=>{this.cache.set(t.key,t),this.namesToKeys.set(t.name,t.key)})}getFromCache(e){const t=typeof e=="number"?e:this.namesToKeys.get(e);if(t!=null)return this.cache.get(t)}}const gn=r=>{const e=xe(r).filter(t=>t!=0);return{single:!Array.isArray(r),variant:typeof e[0]=="number"?"keys":"names",normalized:e,actual:r}};var mm=Object.defineProperty,ym=(r,e,t)=>e in r?mm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Fe=(r,e,t)=>(ym(r,typeof e!="symbol"?e+"":e,t),t),gm=Object.defineProperty,vm=(r,e,t)=>e in r?gm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Z=(r,e,t)=>(vm(r,typeof e!="symbol"?e+"":e,t),t),bn,ke;(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})(ke||(ke={}));var wo;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(wo||(wo={}));const $=ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),jr=r=>{switch(typeof r){case"undefined":return $.undefined;case"string":return $.string;case"number":return isNaN(r)?$.nan:$.number;case"boolean":return $.boolean;case"function":return $.function;case"bigint":return $.bigint;case"symbol":return $.symbol;case"object":return Array.isArray(r)?$.array:r===null?$.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?$.promise:typeof Map<"u"&&r instanceof Map?$.map:typeof Set<"u"&&r instanceof Set?$.set:typeof Date<"u"&&r instanceof Date?$.date:$.object;default:return $.unknown}},C=ke.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"]),wm=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");let zt=class extends Error{constructor(r){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};const e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=r}get errors(){return this.issues}format(r){const e=r||function(s){return s.message},t={_errors:[]},n=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)t._errors.push(e(a));else{let i=t,o=0;for(;o<a.path.length;){const c=a.path[o];o===a.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(e(a))):i[c]=i[c]||{_errors:[]},i=i[c],o++}}};return n(this),t}toString(){return this.message}get message(){return JSON.stringify(this.issues,ke.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(r=e=>e.message){const e={},t=[];for(const n of this.issues)n.path.length>0?(e[n.path[0]]=e[n.path[0]]||[],e[n.path[0]].push(r(n))):t.push(r(n));return{formErrors:t,fieldErrors:e}}get formErrors(){return this.flatten()}};zt.create=r=>new zt(r);const ys=(r,e)=>{let t;switch(r.code){case C.invalid_type:r.received===$.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case C.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,ke.jsonStringifyReplacer)}`;break;case C.unrecognized_keys:t=`Unrecognized key(s) in object: ${ke.joinValues(r.keys,", ")}`;break;case C.invalid_union:t="Invalid input";break;case C.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ke.joinValues(r.options)}`;break;case C.invalid_enum_value:t=`Invalid enum value. Expected ${ke.joinValues(r.options)}, received '${r.received}'`;break;case C.invalid_arguments:t="Invalid function arguments";break;case C.invalid_return_type:t="Invalid function return type";break;case C.invalid_date:t="Invalid date";break;case C.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}"`:ke.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case C.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 C.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 C.custom:t="Invalid input";break;case C.invalid_intersection_types:t="Intersection results could not be merged";break;case C.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case C.not_finite:t="Number must be finite";break;default:t=e.defaultError,ke.assertNever(r)}return{message:t}};let zl=ys;function _m(r){zl=r}function ei(){return zl}const ti=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const c=n.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},bm=[];function V(r,e){const t=ti({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ei(),ys].filter(n=>!!n)});r.common.issues.push(t)}let vt=class Pl{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 se;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 Pl.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 se;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 se=Object.freeze({status:"aborted"}),Ul=r=>({status:"dirty",value:r}),mt=r=>({status:"valid",value:r}),_o=r=>r.status==="aborted",bo=r=>r.status==="dirty",gs=r=>r.status==="valid",ri=r=>typeof Promise<"u"&&r instanceof Promise;var q;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(q||(q={}));let Jt=class{constructor(r,e,t,n){this._cachedPath=[],this.parent=r,this.data=e,this._path=t,this._key=n}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 cu=(r,e)=>{if(gs(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 zt(r.common.issues);return this._error=t,this._error}}};function oe(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:(a,i)=>a.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.defaultError},description:s}}let le=class{constructor(r){this.spa=this.safeParseAsync,this._def=r,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(r){return jr(r.data)}_getOrReturnCtx(r,e){return e||{common:r.parent.common,data:r.data,parsedType:jr(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}_processInputParams(r){return{status:new vt,ctx:{common:r.parent.common,data:r.data,parsedType:jr(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}}_parseSync(r){const e=this._parse(r);if(ri(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(r){const e=this._parse(r);return Promise.resolve(e)}parse(r,e){const t=this.safeParse(r,e);if(t.success)return t.data;throw t.error}safeParse(r,e){var t;const n={common:{issues:[],async:(t=e==null?void 0:e.async)!==null&&t!==void 0?t:!1,contextualErrorMap:e==null?void 0:e.errorMap},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:jr(r)},s=this._parseSync({data:r,path:n.path,parent:n});return cu(n,s)}async parseAsync(r,e){const t=await this.safeParseAsync(r,e);if(t.success)return t.data;throw t.error}async safeParseAsync(r,e){const t={common:{issues:[],contextualErrorMap:e==null?void 0:e.errorMap,async:!0},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:jr(r)},n=this._parse({data:r,path:t.path,parent:t}),s=await(ri(n)?n:Promise.resolve(n));return cu(t,s)}refine(r,e){const t=n=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(n):e;return this._refinement((n,s)=>{const a=r(n),i=()=>s.addIssue({code:C.custom,...t(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(o=>o?!0:(i(),!1)):a?!0:(i(),!1)})}refinement(r,e){return this._refinement((t,n)=>r(t)?!0:(n.addIssue(typeof e=="function"?e(t,n):e),!1))}_refinement(r){return new Mt({schema:this,typeName:G.ZodEffects,effect:{type:"refinement",refinement:r}})}superRefine(r){return this._refinement(r)}optional(){return _r.create(this,this._def)}nullable(){return dn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ln.create(this,this._def)}promise(){return Dn.create(this,this._def)}or(r){return xs.create([this,r],this._def)}and(r){return Os.create(this,r,this._def)}transform(r){return new Mt({...oe(this._def),schema:this,typeName:G.ZodEffects,effect:{type:"transform",transform:r}})}default(r){const e=typeof r=="function"?r:()=>r;return new As({...oe(this._def),innerType:this,defaultValue:e,typeName:G.ZodDefault})}brand(){return new Fl({typeName:G.ZodBranded,type:this,...oe(this._def)})}catch(r){const e=typeof r=="function"?r:()=>r;return new oi({...oe(this._def),innerType:this,catchValue:e,typeName:G.ZodCatch})}describe(r){const e=this.constructor;return new e({...this._def,description:r})}pipe(r){return oc.create(this,r)}readonly(){return ui.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const km=/^c[^\s-]{8,}$/i,Tm=/^[a-z][a-z0-9]*$/,xm=/^[0-9A-HJKMNP-TV-Z]{26}$/,Om=/^[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,Sm=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Nm="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let eo;const Em=/^(((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}))$/,Am=/^(([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})))$/,Im=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 Cm(r,e){return!!((e==="v4"||!e)&&Em.test(r)||(e==="v6"||!e)&&Am.test(r))}let Pn=class Qn extends le{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==$.string){const s=this._getOrReturnCtx(e);return V(s,{code:C.invalid_type,expected:$.string,received:s.parsedType}),se}const t=new vt;let n;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:C.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:C.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(n=this._getOrReturnCtx(e,n),a?V(n,{code:C.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&V(n,{code:C.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if(s.kind==="email")Sm.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"email",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="emoji")eo||(eo=new RegExp(Nm,"u")),eo.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"emoji",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="uuid")Om.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"uuid",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid")km.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"cuid",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid2")Tm.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"cuid2",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="ulid")xm.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"ulid",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),V(n,{validation:"url",code:C.invalid_string,message:s.message}),t.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"regex",code:C.invalid_string,message:s.message}),t.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),V(n,{code:C.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),V(n,{code:C.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),V(n,{code:C.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):s.kind==="datetime"?Im(s).test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{code:C.invalid_string,validation:"datetime",message:s.message}),t.dirty()):s.kind==="ip"?Cm(e.data,s.version)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"ip",code:C.invalid_string,message:s.message}),t.dirty()):ke.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:C.invalid_string,...q.errToObj(n)})}_addCheck(e){return new Qn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...q.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,...q.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...q.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...q.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...q.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...q.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...q.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...q.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...q.errToObj(t)})}nonempty(e){return this.min(1,q.errToObj(e))}trim(){return new Qn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Qn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Qn({...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}};Pn.create=r=>{var e;return new Pn({checks:[],typeName:G.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...oe(r)})};function jm(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 vs=class ko extends le{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)!==$.number){const s=this._getOrReturnCtx(e);return V(s,{code:C.invalid_type,expected:$.number,received:s.parsedType}),se}let t;const n=new vt;for(const s of this._def.checks)s.kind==="int"?ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),V(t,{code:C.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?jm(e.data,s.value)!==0&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),V(t,{code:C.not_finite,message:s.message}),n.dirty()):ke.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,q.toString(t))}gt(e,t){return this.setLimit("min",e,!1,q.toString(t))}lte(e,t){return this.setLimit("max",e,!0,q.toString(t))}lt(e,t){return this.setLimit("max",e,!1,q.toString(t))}setLimit(e,t,n,s){return new ko({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:q.toString(s)}]})}_addCheck(e){return new ko({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:q.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:q.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"&&ke.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)}};vs.create=r=>new vs({checks:[],typeName:G.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...oe(r)});let ws=class To extends le{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)!==$.bigint){const s=this._getOrReturnCtx(e);return V(s,{code:C.invalid_type,expected:$.bigint,received:s.parsedType}),se}let t;const n=new vt;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),V(t,{code:C.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):ke.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,q.toString(t))}gt(e,t){return this.setLimit("min",e,!1,q.toString(t))}lte(e,t){return this.setLimit("max",e,!0,q.toString(t))}lt(e,t){return this.setLimit("max",e,!1,q.toString(t))}setLimit(e,t,n,s){return new To({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:q.toString(s)}]})}_addCheck(e){return new To({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:q.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}};ws.create=r=>{var e;return new ws({checks:[],typeName:G.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...oe(r)})};let _s=class extends le{_parse(r){if(this._def.coerce&&(r.data=!!r.data),this._getType(r)!==$.boolean){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.boolean,received:e.parsedType}),se}return mt(r.data)}};_s.create=r=>new _s({typeName:G.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...oe(r)});let bs=class Dl extends le{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==$.date){const s=this._getOrReturnCtx(e);return V(s,{code:C.invalid_type,expected:$.date,received:s.parsedType}),se}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return V(s,{code:C.invalid_date}),se}const t=new vt;let n;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:C.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:C.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):ke.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Dl({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:q.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:q.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}};bs.create=r=>new bs({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:G.ZodDate,...oe(r)});let ni=class extends le{_parse(r){if(this._getType(r)!==$.symbol){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.symbol,received:e.parsedType}),se}return mt(r.data)}};ni.create=r=>new ni({typeName:G.ZodSymbol,...oe(r)});let ks=class extends le{_parse(r){if(this._getType(r)!==$.undefined){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.undefined,received:e.parsedType}),se}return mt(r.data)}};ks.create=r=>new ks({typeName:G.ZodUndefined,...oe(r)});let Ts=class extends le{_parse(r){if(this._getType(r)!==$.null){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.null,received:e.parsedType}),se}return mt(r.data)}};Ts.create=r=>new Ts({typeName:G.ZodNull,...oe(r)});let Un=class extends le{constructor(){super(...arguments),this._any=!0}_parse(r){return mt(r.data)}};Un.create=r=>new Un({typeName:G.ZodAny,...oe(r)});let nn=class extends le{constructor(){super(...arguments),this._unknown=!0}_parse(r){return mt(r.data)}};nn.create=r=>new nn({typeName:G.ZodUnknown,...oe(r)});let xr=class extends le{_parse(r){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.never,received:e.parsedType}),se}};xr.create=r=>new xr({typeName:G.ZodNever,...oe(r)});let si=class extends le{_parse(r){if(this._getType(r)!==$.undefined){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.void,received:e.parsedType}),se}return mt(r.data)}};si.create=r=>new si({typeName:G.ZodVoid,...oe(r)});let ln=class xa extends le{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==$.array)return V(t,{code:C.invalid_type,expected:$.array,received:t.parsedType}),se;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(V(t,{code:i?C.too_big:C.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&&(V(t,{code:C.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&&(V(t,{code:C.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 Jt(t,i,t.path,o)))).then(i=>vt.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Jt(t,i,t.path,o)));return vt.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new xa({...this._def,minLength:{value:e,message:q.toString(t)}})}max(e,t){return new xa({...this._def,maxLength:{value:e,message:q.toString(t)}})}length(e,t){return new xa({...this._def,exactLength:{value:e,message:q.toString(t)}})}nonempty(e){return this.min(1,e)}};ln.create=(r,e)=>new ln({type:r,minLength:null,maxLength:null,exactLength:null,typeName:G.ZodArray,...oe(e)});function xn(r){if(r instanceof St){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=_r.create(xn(n))}return new St({...r._def,shape:()=>e})}else return r instanceof ln?new ln({...r._def,type:xn(r.element)}):r instanceof _r?_r.create(xn(r.unwrap())):r instanceof dn?dn.create(xn(r.unwrap())):r instanceof Br?Br.create(r.items.map(e=>xn(e))):r}let St=class Et extends le{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=ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==$.object){const c=this._getOrReturnCtx(e);return V(c,{code:C.invalid_type,expected:$.object,received:c.parsedType}),se}const{status:t,ctx:n}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof xr&&this._def.unknownKeys==="strip"))for(const c in n.data)a.includes(c)||i.push(c);const o=[];for(const c of a){const d=s[c],w=n.data[c];o.push({key:{status:"valid",value:c},value:d._parse(new Jt(n,w,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof xr){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of i)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(c==="strict")i.length>0&&(V(n,{code:C.unrecognized_keys,keys:i}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of i){const w=n.data[d];o.push({key:{status:"valid",value:d},value:c._parse(new Jt(n,w,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of o){const w=await d.key;c.push({key:w,value:await d.value,alwaysSet:d.alwaysSet})}return c}).then(c=>vt.mergeObjectSync(t,c)):vt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return q.errToObj,new Et({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const c=(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=q.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new Et({...this._def,unknownKeys:"strip"})}passthrough(){return new Et({...this._def,unknownKeys:"passthrough"})}extend(e){return new Et({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Et({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:G.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Et({...this._def,catchall:e})}pick(e){const t={};return ke.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Et({...this._def,shape:()=>t})}omit(e){const t={};return ke.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Et({...this._def,shape:()=>t})}deepPartial(){return xn(this)}partial(e){const t={};return ke.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new Et({...this._def,shape:()=>t})}required(e){const t={};return ke.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof _r;)s=s._def.innerType;t[n]=s}}),new Et({...this._def,shape:()=>t})}keyof(){return Kl(ke.objectKeys(this.shape))}};St.create=(r,e)=>new St({shape:()=>r,unknownKeys:"strip",catchall:xr.create(),typeName:G.ZodObject,...oe(e)});St.strictCreate=(r,e)=>new St({shape:()=>r,unknownKeys:"strict",catchall:xr.create(),typeName:G.ZodObject,...oe(e)});St.lazycreate=(r,e)=>new St({shape:r,unknownKeys:"strip",catchall:xr.create(),typeName:G.ZodObject,...oe(e)});let xs=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r),t=this._def.options;function n(s){for(const i of s)if(i.result.status==="valid")return i.result;for(const i of s)if(i.result.status==="dirty")return e.common.issues.push(...i.ctx.common.issues),i.result;const a=s.map(i=>new zt(i.ctx.common.issues));return V(e,{code:C.invalid_union,unionErrors:a}),se}if(e.common.async)return Promise.all(t.map(async s=>{const a={...e,common:{...e.common,issues:[]},parent:null};return{result:await s._parseAsync({data:e.data,path:e.path,parent:a}),ctx:a}})).then(n);{let s;const a=[];for(const o of t){const c={...e,common:{...e.common,issues:[]},parent:null},d=o._parseSync({data:e.data,path:e.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return e.common.issues.push(...s.ctx.common.issues),s.result;const i=a.map(o=>new zt(o));return V(e,{code:C.invalid_union,unionErrors:i}),se}}get options(){return this._def.options}};xs.create=(r,e)=>new xs({options:r,typeName:G.ZodUnion,...oe(e)});const Oa=r=>r instanceof Ss?Oa(r.schema):r instanceof Mt?Oa(r.innerType()):r instanceof Ns?[r.value]:r instanceof Hs?r.options:r instanceof Es?Object.keys(r.enum):r instanceof As?Oa(r._def.innerType):r instanceof ks?[void 0]:r instanceof Ts?[null]:null;let Ml=class $l extends le{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==$.object)return V(t,{code:C.invalid_type,expected:$.object,received:t.parsedType}),se;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}):(V(t,{code:C.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),se)}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=Oa(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 $l({typeName:G.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...oe(n)})}};function xo(r,e){const t=jr(r),n=jr(e);if(r===e)return{valid:!0,data:r};if(t===$.object&&n===$.object){const s=ke.objectKeys(e),a=ke.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=xo(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===$.array&&n===$.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],c=xo(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===$.date&&n===$.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}let Os=class extends le{_parse(r){const{status:e,ctx:t}=this._processInputParams(r),n=(s,a)=>{if(_o(s)||_o(a))return se;const i=xo(s.value,a.value);return i.valid?((bo(s)||bo(a))&&e.dirty(),{status:e.value,value:i.data}):(V(t,{code:C.invalid_intersection_types}),se)};return t.common.async?Promise.all([this._def.left._parseAsync({data:t.data,path:t.path,parent:t}),this._def.right._parseAsync({data:t.data,path:t.path,parent:t})]).then(([s,a])=>n(s,a)):n(this._def.left._parseSync({data:t.data,path:t.path,parent:t}),this._def.right._parseSync({data:t.data,path:t.path,parent:t}))}};Os.create=(r,e,t)=>new Os({left:r,right:e,typeName:G.ZodIntersection,...oe(t)});let Br=class Ll extends le{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.array)return V(n,{code:C.invalid_type,expected:$.array,received:n.parsedType}),se;if(n.data.length<this._def.items.length)return V(n,{code:C.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),se;!this._def.rest&&n.data.length>this._def.items.length&&(V(n,{code:C.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...n.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new Jt(n,a,n.path,i)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>vt.mergeArray(t,a)):vt.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Ll({...this._def,rest:e})}};Br.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Br({items:r,typeName:G.ZodTuple,rest:null,...oe(e)})};let Bl=class Oo extends le{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!==$.object)return V(n,{code:C.invalid_type,expected:$.object,received:n.parsedType}),se;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Jt(n,o,n.path,o)),value:i._parse(new Jt(n,n.data[o],n.path,o))});return n.common.async?vt.mergeObjectAsync(t,s):vt.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof le?new Oo({keyType:e,valueType:t,typeName:G.ZodRecord,...oe(n)}):new Oo({keyType:Pn.create(),valueType:e,typeName:G.ZodRecord,...oe(t)})}},ai=class extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:e,ctx:t}=this._processInputParams(r);if(t.parsedType!==$.map)return V(t,{code:C.invalid_type,expected:$.map,received:t.parsedType}),se;const n=this._def.keyType,s=this._def.valueType,a=[...t.data.entries()].map(([i,o],c)=>({key:n._parse(new Jt(t,i,t.path,[c,"key"])),value:s._parse(new Jt(t,o,t.path,[c,"value"]))}));if(t.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const o of a){const c=await o.key,d=await o.value;if(c.status==="aborted"||d.status==="aborted")return se;(c.status==="dirty"||d.status==="dirty")&&e.dirty(),i.set(c.value,d.value)}return{status:e.value,value:i}})}else{const i=new Map;for(const o of a){const c=o.key,d=o.value;if(c.status==="aborted"||d.status==="aborted")return se;(c.status==="dirty"||d.status==="dirty")&&e.dirty(),i.set(c.value,d.value)}return{status:e.value,value:i}}}};ai.create=(r,e,t)=>new ai({valueType:e,keyType:r,typeName:G.ZodMap,...oe(t)});let ii=class So extends le{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==$.set)return V(n,{code:C.invalid_type,expected:$.set,received:n.parsedType}),se;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(V(n,{code:C.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&&(V(n,{code:C.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(c){const d=new Set;for(const w of c){if(w.status==="aborted")return se;w.status==="dirty"&&t.dirty(),d.add(w.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((c,d)=>a._parse(new Jt(n,c,n.path,d)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new So({...this._def,minSize:{value:e,message:q.toString(t)}})}max(e,t){return new So({...this._def,maxSize:{value:e,message:q.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ii.create=(r,e)=>new ii({valueType:r,minSize:null,maxSize:null,typeName:G.ZodSet,...oe(e)});let Vl=class Sa extends le{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==$.function)return V(t,{code:C.invalid_type,expected:$.function,received:t.parsedType}),se;function n(o,c){return ti({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ei(),ys].filter(d=>!!d),issueData:{code:C.invalid_arguments,argumentsError:c}})}function s(o,c){return ti({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ei(),ys].filter(d=>!!d),issueData:{code:C.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Dn){const o=this;return mt(async function(...c){const d=new zt([]),w=await o._def.args.parseAsync(c,a).catch(X=>{throw d.addIssue(n(c,X)),d}),D=await Reflect.apply(i,this,w);return await o._def.returns._def.type.parseAsync(D,a).catch(X=>{throw d.addIssue(s(D,X)),d})})}else{const o=this;return mt(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new zt([n(c,d.error)]);const w=Reflect.apply(i,this,d.data),D=o._def.returns.safeParse(w,a);if(!D.success)throw new zt([s(w,D.error)]);return D.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Sa({...this._def,args:Br.create(e).rest(nn.create())})}returns(e){return new Sa({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Sa({args:e||Br.create([]).rest(nn.create()),returns:t||nn.create(),typeName:G.ZodFunction,...oe(n)})}},Ss=class extends le{get schema(){return this._def.getter()}_parse(r){const{ctx:e}=this._processInputParams(r);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};Ss.create=(r,e)=>new Ss({getter:r,typeName:G.ZodLazy,...oe(e)});let Ns=class extends le{_parse(r){if(r.data!==this._def.value){const e=this._getOrReturnCtx(r);return V(e,{received:e.data,code:C.invalid_literal,expected:this._def.value}),se}return{status:"valid",value:r.data}}get value(){return this._def.value}};Ns.create=(r,e)=>new Ns({value:r,typeName:G.ZodLiteral,...oe(e)});function Kl(r,e){return new Hs({values:r,typeName:G.ZodEnum,...oe(e)})}let Hs=class No extends le{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return V(t,{expected:ke.joinValues(n),received:t.parsedType,code:C.invalid_type}),se}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return V(t,{received:t.data,code:C.invalid_enum_value,options:n}),se}return mt(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 No.create(e)}exclude(e){return No.create(this.options.filter(t=>!e.includes(t)))}};Hs.create=Kl;let Es=class extends le{_parse(r){const e=ke.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(r);if(t.parsedType!==$.string&&t.parsedType!==$.number){const n=ke.objectValues(e);return V(t,{expected:ke.joinValues(n),received:t.parsedType,code:C.invalid_type}),se}if(e.indexOf(r.data)===-1){const n=ke.objectValues(e);return V(t,{received:t.data,code:C.invalid_enum_value,options:n}),se}return mt(r.data)}get enum(){return this._def.values}};Es.create=(r,e)=>new Es({values:r,typeName:G.ZodNativeEnum,...oe(e)});let Dn=class extends le{unwrap(){return this._def.type}_parse(r){const{ctx:e}=this._processInputParams(r);if(e.parsedType!==$.promise&&e.common.async===!1)return V(e,{code:C.invalid_type,expected:$.promise,received:e.parsedType}),se;const t=e.parsedType===$.promise?e.data:Promise.resolve(e.data);return mt(t.then(n=>this._def.type.parseAsync(n,{path:e.path,errorMap:e.common.contextualErrorMap})))}};Dn.create=(r,e)=>new Dn({type:r,typeName:G.ZodPromise,...oe(e)});let Mt=class extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===G.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){const{status:e,ctx:t}=this._processInputParams(r),n=this._def.effect||null,s={addIssue:a=>{V(t,a),a.fatal?e.abort():e.dirty()},get path(){return t.path}};if(s.addIssue=s.addIssue.bind(s),n.type==="preprocess"){const a=n.transform(t.data,s);return t.common.issues.length?{status:"dirty",value:t.data}:t.common.async?Promise.resolve(a).then(i=>this._def.schema._parseAsync({data:i,path:t.path,parent:t})):this._def.schema._parseSync({data:a,path:t.path,parent:t})}if(n.type==="refinement"){const a=i=>{const o=n.refinement(i,s);if(t.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(t.common.async===!1){const i=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});return i.status==="aborted"?se:(i.status==="dirty"&&e.dirty(),a(i.value),{status:e.value,value:i.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(i=>i.status==="aborted"?se:(i.status==="dirty"&&e.dirty(),a(i.value).then(()=>({status:e.value,value:i.value}))))}if(n.type==="transform")if(t.common.async===!1){const a=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});if(!gs(a))return a;const i=n.transform(a.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:i}}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(a=>gs(a)?Promise.resolve(n.transform(a.value,s)).then(i=>({status:e.value,value:i})):a);ke.assertNever(n)}};Mt.create=(r,e,t)=>new Mt({schema:r,typeName:G.ZodEffects,effect:e,...oe(t)});Mt.createWithPreprocess=(r,e,t)=>new Mt({schema:e,effect:{type:"preprocess",transform:r},typeName:G.ZodEffects,...oe(t)});let _r=class extends le{_parse(r){return this._getType(r)===$.undefined?mt(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};_r.create=(r,e)=>new _r({innerType:r,typeName:G.ZodOptional,...oe(e)});let dn=class extends le{_parse(r){return this._getType(r)===$.null?mt(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};dn.create=(r,e)=>new dn({innerType:r,typeName:G.ZodNullable,...oe(e)});let As=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r);let t=e.data;return e.parsedType===$.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};As.create=(r,e)=>new As({innerType:r,typeName:G.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...oe(e)});let oi=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r),t={...e,common:{...e.common,issues:[]}},n=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return ri(n)?n.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new zt(t.common.issues)},input:t.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new zt(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};oi.create=(r,e)=>new oi({innerType:r,typeName:G.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...oe(e)});let ci=class extends le{_parse(r){if(this._getType(r)!==$.nan){const e=this._getOrReturnCtx(r);return V(e,{code:C.invalid_type,expected:$.nan,received:e.parsedType}),se}return{status:"valid",value:r.data}}};ci.create=r=>new ci({typeName:G.ZodNaN,...oe(r)});const Zm=Symbol("zod_brand");let Fl=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r),t=e.data;return this._def.type._parse({data:t,path:e.path,parent:e})}unwrap(){return this._def.type}},oc=class Wl extends le{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?se:s.status==="dirty"?(t.dirty(),Ul(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?se: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 Wl({in:e,out:t,typeName:G.ZodPipeline})}},ui=class extends le{_parse(r){const e=this._def.innerType._parse(r);return gs(e)&&(e.value=Object.freeze(e.value)),e}};ui.create=(r,e)=>new ui({innerType:r,typeName:G.ZodReadonly,...oe(e)});const ql=(r,e={},t)=>r?Un.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:c})}}):Un.create(),Rm={object:St.lazycreate};var G;(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"})(G||(G={}));const zm=(r,e={message:`Input not instance of ${r.name}`})=>ql(t=>t instanceof r,e),Yl=Pn.create,Jl=vs.create,Pm=ci.create,Um=ws.create,Gl=_s.create,Dm=bs.create,Mm=ni.create,$m=ks.create,Lm=Ts.create,Bm=Un.create,Vm=nn.create,Km=xr.create,Fm=si.create,Wm=ln.create,qm=St.create,Ym=St.strictCreate,Jm=xs.create,Gm=Ml.create,Hm=Os.create,Xm=Br.create,Qm=Bl.create,ey=ai.create,ty=ii.create,ry=Vl.create,ny=Ss.create,sy=Ns.create,ay=Hs.create,iy=Es.create,oy=Dn.create,uu=Mt.create,cy=_r.create,uy=dn.create,ly=Mt.createWithPreprocess,dy=oc.create,hy=()=>Yl().optional(),fy=()=>Jl().optional(),py=()=>Gl().optional(),my={string:r=>Pn.create({...r,coerce:!0}),number:r=>vs.create({...r,coerce:!0}),boolean:r=>_s.create({...r,coerce:!0}),bigint:r=>ws.create({...r,coerce:!0}),date:r=>bs.create({...r,coerce:!0})},yy=se;var N=Object.freeze({__proto__:null,defaultErrorMap:ys,setErrorMap:_m,getErrorMap:ei,makeIssue:ti,EMPTY_PATH:bm,addIssueToContext:V,ParseStatus:vt,INVALID:se,DIRTY:Ul,OK:mt,isAborted:_o,isDirty:bo,isValid:gs,isAsync:ri,get util(){return ke},get objectUtil(){return wo},ZodParsedType:$,getParsedType:jr,ZodType:le,ZodString:Pn,ZodNumber:vs,ZodBigInt:ws,ZodBoolean:_s,ZodDate:bs,ZodSymbol:ni,ZodUndefined:ks,ZodNull:Ts,ZodAny:Un,ZodUnknown:nn,ZodNever:xr,ZodVoid:si,ZodArray:ln,ZodObject:St,ZodUnion:xs,ZodDiscriminatedUnion:Ml,ZodIntersection:Os,ZodTuple:Br,ZodRecord:Bl,ZodMap:ai,ZodSet:ii,ZodFunction:Vl,ZodLazy:Ss,ZodLiteral:Ns,ZodEnum:Hs,ZodNativeEnum:Es,ZodPromise:Dn,ZodEffects:Mt,ZodTransformer:Mt,ZodOptional:_r,ZodNullable:dn,ZodDefault:As,ZodCatch:oi,ZodNaN:ci,BRAND:Zm,ZodBranded:Fl,ZodPipeline:oc,ZodReadonly:ui,custom:ql,Schema:le,ZodSchema:le,late:Rm,get ZodFirstPartyTypeKind(){return G},coerce:my,any:Bm,array:Wm,bigint:Um,boolean:Gl,date:Dm,discriminatedUnion:Gm,effect:uu,enum:ay,function:ry,instanceof:zm,intersection:Hm,lazy:ny,literal:sy,map:ey,nan:Pm,nativeEnum:iy,never:Km,null:Lm,nullable:uy,number:Jl,object:qm,oboolean:py,onumber:fy,optional:cy,ostring:hy,pipeline:dy,preprocess:ly,promise:oy,record:Qm,set:ty,strictObject:Ym,string:Yl,symbol:Mm,transformer:uu,tuple:Xm,undefined:$m,union:Jm,unknown:Vm,void:Fm,NEVER:yy,ZodIssueCode:C,quotelessJson:wm,ZodError:zt});const cc=N.tuple([N.number(),N.number()]),Hl=N.object({width:N.number(),height:N.number()}),gy=N.object({signedWidth:N.number(),signedHeight:N.number()}),vy=["width","height"];N.enum(vy);const wy=["start","center","end"],_y=["signedWidth","signedHeight"];N.enum(_y);const li=N.object({x:N.number(),y:N.number()}),by=N.object({clientX:N.number(),clientY:N.number()}),ky=["x","y"],Xl=N.enum(ky),Ql=["top","right","bottom","left"];N.enum(Ql);const Ty=["left","right"],xy=N.enum(Ty),Oy=["top","bottom"],Sy=N.enum(Oy),ed=["center"];N.enum(ed);const Ny=[...Ql,...ed],di=N.enum(Ny);N.enum(wy);const Ey=["first","last"];N.enum(Ey);const Ay=N.object({lower:N.number(),upper:N.number()});N.union([Ay,cc]);N.union([Xl,di]);N.union([Xl,di,N.instanceof(String)]);const to=(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),Iy(t)},Iy=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r;var Nt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},me={},Zi={};Object.defineProperty(Zi,"__esModule",{value:!0});function Cy(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()}):""}Zi.default=Cy;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});function jy(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():""}Ri.default=jy;var zi={};Object.defineProperty(zi,"__esModule",{value:!0});function Zy(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()}):""}zi.default=Zy;var uc={};Object.defineProperty(uc,"__esModule",{value:!0});function Ry(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():""}uc.default=Ry;var lc={};Object.defineProperty(lc,"__esModule",{value:!0});function zy(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():""}lc.default=zy;var dc={};Object.defineProperty(dc,"__esModule",{value:!0});function Py(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():""}dc.default=Py;var hc={};Object.defineProperty(hc,"__esModule",{value:!0});function Uy(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)}hc.default=Uy;var fc={};Object.defineProperty(fc,"__esModule",{value:!0});function Dy(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}):""}fc.default=Dy;var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});function My(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():""}Pi.default=My;var pc={},vn={};(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})}})(vn);var $y=Nt&&Nt.__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(pc,"__esModule",{value:!0});var cr=vn;function Na(r,e){if(e===void 0&&(e=cr.DefaultOption),!cr.isValidObject(r))return null;e=cr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toLowerCase();e.recursive&&(cr.isValidObject(s)?cr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Na(s,e)):e.recursiveInArray&&cr.isArrayObject(s)&&(s=$y(s).map(function(i){var o=i;if(cr.isValidObject(i))cr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Na(i,e));else if(cr.isArrayObject(i)){var c=Na({key:i},e);o=c.key}return o}))),t[a]=s}),t}pc.default=Na;var mc={},Ly=Nt&&Nt.__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(mc,"__esModule",{value:!0});var ur=vn;function Ea(r,e){if(e===void 0&&(e=ur.DefaultOption),!ur.isValidObject(r))return null;e=ur.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toUpperCase();e.recursive&&(ur.isValidObject(s)?ur.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ea(s,e)):e.recursiveInArray&&ur.isArrayObject(s)&&(s=Ly(s).map(function(i){var o=i;if(ur.isValidObject(i))ur.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ea(i,e));else if(ur.isArrayObject(i)){var c=Ea({key:i},e);o=c.key}return o}))),t[a]=s}),t}mc.default=Ea;var yc={},By=Nt&&Nt.__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(yc,"__esModule",{value:!0});var lr=vn,Vy=Zi;function Aa(r,e){if(e===void 0&&(e=lr.DefaultOption),!lr.isValidObject(r))return null;e=lr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Vy.default(n);e.recursive&&(lr.isValidObject(s)?lr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Aa(s,e)):e.recursiveInArray&&lr.isArrayObject(s)&&(s=By(s).map(function(i){var o=i;if(lr.isValidObject(i))lr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Aa(i,e));else if(lr.isArrayObject(i)){var c=Aa({key:i},e);o=c.key}return o}))),t[a]=s}),t}yc.default=Aa;var gc={},Ky=Nt&&Nt.__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(gc,"__esModule",{value:!0});var dr=vn,Fy=Ri;function Ia(r,e){if(e===void 0&&(e=dr.DefaultOption),!dr.isValidObject(r))return null;e=dr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Fy.default(n);e.recursive&&(dr.isValidObject(s)?dr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ia(s,e)):e.recursiveInArray&&dr.isArrayObject(s)&&(s=Ky(s).map(function(i){var o=i;if(dr.isValidObject(i))dr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ia(i,e));else if(dr.isArrayObject(i)){var c=Ia({key:i},e);o=c.key}return o}))),t[a]=s}),t}gc.default=Ia;var vc={},Wy=Nt&&Nt.__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(vc,"__esModule",{value:!0});var hr=vn,qy=zi;function Ca(r,e){if(e===void 0&&(e=hr.DefaultOption),!hr.isValidObject(r))return null;e=hr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=qy.default(n);e.recursive&&(hr.isValidObject(s)?hr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ca(s,e)):e.recursiveInArray&&hr.isArrayObject(s)&&(s=Wy(s).map(function(i){var o=i;if(hr.isValidObject(i))hr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ca(i,e));else if(hr.isArrayObject(i)){var c=Ca({key:i},e);o=c.key}return o}))),t[a]=s}),t}vc.default=Ca;var wc={},Yy=Nt&&Nt.__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(wc,"__esModule",{value:!0});var fr=vn,Jy=Pi;function ja(r,e){if(e===void 0&&(e=fr.DefaultOption),!fr.isValidObject(r))return null;e=fr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Jy.default(n);e.recursive&&(fr.isValidObject(s)?fr.belongToTypes(s,e.keepTypesOnRecursion)||(s=ja(s,e)):e.recursiveInArray&&fr.isArrayObject(s)&&(s=Yy(s).map(function(i){var o=i;if(fr.isValidObject(i))fr.belongToTypes(o,e.keepTypesOnRecursion)||(o=ja(i,e));else if(fr.isArrayObject(i)){var c=ja({key:i},e);o=c.key}return o}))),t[a]=s}),t}wc.default=ja;Object.defineProperty(me,"__esModule",{value:!0});me.kebabKeys=me.pascalKeys=me.snakeKeys=me.camelKeys=me.upperKeys=me.lowerKeys=me.toLowerCase=me.toUpperCase=me.toKebabCase=me.toHeaderCase=me.toSentenceCase=me.toTextCase=me.toPathCase=me.toDotCase=me.toPascalCase=me.toSnakeCase=me.toCamelCase=void 0;var td=Zi;me.toCamelCase=td.default;var rd=Ri;me.toSnakeCase=rd.default;var nd=zi;me.toPascalCase=nd.default;var sd=uc;me.toDotCase=sd.default;var ad=lc;me.toPathCase=ad.default;var id=dc;me.toTextCase=id.default;var od=hc;me.toSentenceCase=od.default;var cd=fc;me.toHeaderCase=cd.default;var ud=Pi;me.toKebabCase=ud.default;var ld=pc;me.lowerKeys=ld.default;var dd=mc;me.upperKeys=dd.default;var hd=yc;me.camelKeys=hd.default;var fd=gc;me.snakeKeys=fd.default;var pd=vc;me.pascalKeys=pd.default;var md=wc;me.kebabKeys=md.default;var yd=function(r){return String(r||"").toLowerCase()};me.toLowerCase=yd;var gd=function(r){return String(r||"").toUpperCase()};me.toUpperCase=gd;var Gy={toCamelCase:td.default,toSnakeCase:rd.default,toPascalCase:nd.default,toDotCase:sd.default,toPathCase:ad.default,toTextCase:id.default,toSentenceCase:od.default,toHeaderCase:cd.default,toKebabCase:ud.default,toUpperCase:gd,toLowerCase:yd,lowerKeys:ld.default,upperKeys:dd.default,camelKeys:hd.default,snakeKeys:fd.default,pascalKeys:pd.default,kebabKeys:md.default};me.default=Gy;var vd=me;const wd={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},Hy=r=>vd.snakeKeys(r,wd),Xy=r=>vd.camelKeys(r,wd);var Mn;(r=>{r.toSnake=Hy,r.toCamel=Xy,r.capitalize=e=>e[0].toUpperCase()+e.slice(1)})(Mn||(Mn={}));N.object({x:di,y:di});const Qy=N.object({x:xy,y:Sy}),eg={x:"left",y:"top"},tg=(r,e)=>r.x===e.x&&r.y===e.y,lu=N.union([N.number(),li,cc,Hl,gy,by]),rg=(r,e)=>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},du={x:0,y:0},la=N.union([N.number(),N.string()]);N.object({top:la,left:la,width:la,height:la});N.object({left:N.number(),top:N.number(),right:N.number(),bottom:N.number()});N.object({one:li,two:li,root:Qy});const _c=(r,e,t=0,n=0,s)=>{const a={one:{...du},two:{...du},root:s??eg};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))},ro=r=>{const e=_c(r);return{lower:e.one.x,upper:e.two.x}},no=r=>{const e=_c(r);return{lower:e.one.y,upper:e.two.y}},ng=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,sg=N.object({signedWidth:N.number(),signedHeight:N.number()});N.union([Hl,sg,li,cc]);const ag=(r,e,t)=>(e!=null&&(r=Math.max(r,e)),t!=null&&(r=Math.min(r,t)),r);N.object({offset:lu,scale:lu});const ig=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],og=r=>(e,t,n,s)=>[e,s?n/r:n*r],cg=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:i,upper:o}=r,c=a-s,d=o-i;if(t==="dimension")return[r,n*(d/c)];const w=(n-s)*(d/c)+i;return[r,w]},ug=r=>(e,t,n)=>[r,n],lg=()=>(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)]},dg=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=ag(n,s,a),[e,n]},Eo=class es{constructor(){Z(this,"ops",[]),Z(this,"currBounds",null),Z(this,"currType",null),Z(this,"reversed",!1),this.ops=[]}static translate(e){return new es().translate(e)}static magnify(e){return new es().magnify(e)}static scale(e,t){return new es().scale(e,t)}translate(e){const t=this.new(),n=ig(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=og(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=to(e,t),s=this.new(),a=cg(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=to(e,t),s=this.new(),a=dg(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=to(e,t),s=this.new(),a=ug(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=lg();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 es;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}};Z(Eo,"IDENTITY",new Eo);let hu=Eo;const fu=class mr{constructor(e=new hu,t=new hu,n=null){Z(this,"x"),Z(this,"y"),Z(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new mr().translate(e,t)}static translateX(e){return new mr().translateX(e)}static translateY(e){return new mr().translateY(e)}static clamp(e){return new mr().clamp(e)}static magnify(e){return new mr().magnify(e)}static scale(e){return new mr().scale(e)}static reBound(e){return new mr().reBound(e)}translate(e,t){const n=rg(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(ng(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!tg(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(ro(e)),t.y=t.y.scale(no(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(ro(e)),t.y=this.y.reBound(no(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(ro(e)),t.y=this.y.clamp(no(e)),t}copy(){const e=new mr;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 _c(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};Z(fu,"IDENTITY",new fu);const _d=(r,e)=>{const t=new _t(e);if(![dt.DAY,dt.HOUR,dt.MINUTE,dt.SECOND,dt.MILLISECOND,dt.MICROSECOND,dt.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 _t?new _t(n):new dt(n)},je=class fe extends Number{constructor(e,t="UTC"){if(e==null)return fe.now();if(e instanceof Date)super(e.getTime()*fe.MILLISECOND.valueOf());else if(typeof e=="string")super(fe.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(fe.parseDate(e));else{let n=0;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=fe.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 fe(s.getTime()*fe.MILLISECOND.valueOf()).truncate(fe.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 c=fe.hours(parseInt(n??"00",10)).add(fe.minutes(parseInt(s??"00",10))).add(fe.seconds(parseInt(i??"00",10))).add(fe.milliseconds(parseInt(o??"00",10)));return t==="local"&&(c=c.add(fe.utcOffset)),c.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return fe.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new fe(n.getTime()*fe.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(fe.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 dt(new Date().getTimezoneOffset()*fe.MINUTE.valueOf())}static since(e){return new fe().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new fe(e).valueOf()}span(e){return this.range(e).span}range(e){return new hg(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0}after(e){return this.valueOf()>new fe(e).valueOf()}afterEq(e){return this.valueOf()>=new fe(e).valueOf()}before(e){return this.valueOf()<new fe(e).valueOf()}beforeEq(e){return this.valueOf()<=new fe(e).valueOf()}add(e){return new fe(this.valueOf()+e.valueOf())}sub(e){return new fe(this.valueOf()-e.valueOf())}milliseconds(){return this.valueOf()/fe.MILLISECOND.valueOf()}toString(){return this.date().toISOString()}remainder(e){return _d(this,e)}get isToday(){return this.truncate(dt.DAY).equals(fe.now().truncate(dt.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new fe(new Date)}static nanoseconds(e){return new fe(e)}static microseconds(e){return fe.nanoseconds(e*1e3)}static milliseconds(e){return fe.microseconds(e*1e3)}static seconds(e){return fe.milliseconds(e*1e3)}static minutes(e){return fe.seconds(e*60)}static hours(e){return fe.minutes(e*60)}static days(e){return fe.hours(e*24)}};Z(je,"NANOSECOND",je.nanoseconds(1));Z(je,"MICROSECOND",je.microseconds(1));Z(je,"MILLISECOND",je.milliseconds(1));Z(je,"SECOND",je.seconds(1));Z(je,"MINUTE",je.minutes(1));Z(je,"HOUR",je.hours(1));Z(je,"DAY",je.days(1));Z(je,"MAX",new je(9122272036554776e3));Z(je,"MIN",new je(0));Z(je,"ZERO",new je(0));Z(je,"z",N.union([N.instanceof(Number).transform(r=>new je(r)),N.number().transform(r=>new je(r)),N.instanceof(je)]));let _t=je;const Ie=class Se extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}remainder(e){return _d(this,e)}truncate(e){return new Se(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}multiply(e){return new Se(this.valueOf()*e)}toString(){const e=this.truncate(Se.DAY),t=this.truncate(Se.HOUR),n=this.truncate(Se.MINUTE),s=this.truncate(Se.SECOND),a=this.truncate(Se.MILLISECOND),i=this.truncate(Se.MICROSECOND),o=this.truncate(Se.NANOSECOND),c=e,d=t.sub(e),w=n.sub(t),D=s.sub(n),X=a.sub(s),Q=i.sub(a),Ze=o.sub(i);let ee="";return c.isZero||(ee+=`${c.days}d `),d.isZero||(ee+=`${d.hours}h `),w.isZero||(ee+=`${w.minutes}m `),D.isZero||(ee+=`${D.seconds}s `),X.isZero||(ee+=`${X.milliseconds}ms `),Q.isZero||(ee+=`${Q.microseconds}µs `),Ze.isZero||(ee+=`${Ze.nanoseconds}ns`),ee.trim()}get days(){return this.valueOf()/Se.DAY.valueOf()}get hours(){return this.valueOf()/Se.HOUR.valueOf()}get minutes(){return this.valueOf()/Se.MINUTE.valueOf()}get seconds(){return this.valueOf()/Se.SECOND.valueOf()}get milliseconds(){return this.valueOf()/Se.MILLISECOND.valueOf()}get microseconds(){return this.valueOf()/Se.MICROSECOND.valueOf()}get nanoseconds(){return this.valueOf()}get isZero(){return this.valueOf()===0}equals(e){return this.valueOf()===new Se(e).valueOf()}add(e){return new Se(this.valueOf()+new Se(e).valueOf())}sub(e){return new Se(this.valueOf()-new Se(e).valueOf())}static nanoseconds(e=1){return new Se(e)}static microseconds(e=1){return Se.nanoseconds(e*1e3)}static milliseconds(e=1){return Se.microseconds(e*1e3)}static seconds(e=1){return Se.milliseconds(e*1e3)}static minutes(e){return Se.seconds(e.valueOf()*60)}static hours(e){return Se.minutes(e*60)}static days(e){return Se.hours(e*24)}};Z(Ie,"NANOSECOND",Ie.nanoseconds(1));Z(Ie,"MICROSECOND",Ie.microseconds(1));Z(Ie,"MILLISECOND",Ie.milliseconds(1));Z(Ie,"SECOND",Ie.seconds(1));Z(Ie,"MINUTE",Ie.minutes(1));Z(Ie,"HOUR",Ie.hours(1));Z(Ie,"DAY",Ie.days(1));Z(Ie,"MAX",new Ie(Ie.MAX_SAFE_INTEGER));Z(Ie,"MIN",new Ie(-Ie.MAX_SAFE_INTEGER));Z(Ie,"ZERO",new Ie(0));Z(Ie,"z",N.union([N.instanceof(Number).transform(r=>new Ie(r)),N.number().transform(r=>new Ie(r)),N.instanceof(Ie)]));let dt=Ie;const da=class Za extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Za(e).valueOf()}get period(){return dt.seconds(1/this.valueOf())}sampleCount(e){return new dt(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new lt(t).valueOf()}span(e){return dt.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Za(e)}static khz(e){return Za.hz(e*1e3)}};Z(da,"z",N.union([N.number().transform(r=>new da(r)),N.instanceof(Number).transform(r=>new da(r)),N.instanceof(da)]));const et=class extends Number{constructor(r){r instanceof Number?super(r.valueOf()):super(r)}length(r){return r.valueOf()/this.valueOf()}size(r){return new fg(r*this.valueOf())}};Z(et,"UNKNOWN",new et(0));Z(et,"BIT128",new et(16));Z(et,"BIT64",new et(8));Z(et,"BIT32",new et(4));Z(et,"BIT16",new et(2));Z(et,"BIT8",new et(1));Z(et,"z",N.union([N.number().transform(r=>new et(r)),N.instanceof(Number).transform(r=>new et(r)),N.instanceof(et)]));let lt=et;const Wt=class Ra{constructor(e,t){Z(this,"start"),Z(this,"end"),this.start=new _t(e),this.end=new _t(t)}get span(){return new dt(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 Ra(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 Ra?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new Ra(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}};Z(Wt,"MAX",new Wt(_t.MIN,_t.MAX));Z(Wt,"MIN",new Wt(_t.MAX,_t.MIN));Z(Wt,"ZERO",new Wt(_t.ZERO,_t.ZERO));Z(Wt,"z",N.union([N.object({start:_t.z,end:_t.z}).transform(r=>new Wt(r.start,r.end)),N.instanceof(Wt)]));let hg=Wt;const O=class tn extends String{constructor(e){if(e instanceof tn||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const t=tn.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}}throw super(tn.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=tn.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=tn.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 tn.BIG_INT_TYPES.some(e=>e.equals(this))}};Z(O,"UNKNOWN",new O("unknown"));Z(O,"FLOAT64",new O("float64"));Z(O,"FLOAT32",new O("float32"));Z(O,"INT64",new O("int64"));Z(O,"INT32",new O("int32"));Z(O,"INT16",new O("int16"));Z(O,"INT8",new O("int8"));Z(O,"UINT64",new O("uint64"));Z(O,"UINT32",new O("uint32"));Z(O,"UINT16",new O("uint16"));Z(O,"UINT8",new O("uint8"));Z(O,"TIMESTAMP",new O("timestamp"));Z(O,"UUID",new O("uuid"));Z(O,"STRING",new O("string"));Z(O,"JSON",new O("json"));Z(O,"ARRAY_CONSTRUCTORS",new Map([[O.UINT8.toString(),Uint8Array],[O.UINT16.toString(),Uint16Array],[O.UINT32.toString(),Uint32Array],[O.UINT64.toString(),BigUint64Array],[O.FLOAT32.toString(),Float32Array],[O.FLOAT64.toString(),Float64Array],[O.INT8.toString(),Int8Array],[O.INT16.toString(),Int16Array],[O.INT32.toString(),Int32Array],[O.INT64.toString(),BigInt64Array],[O.TIMESTAMP.toString(),BigInt64Array],[O.STRING.toString(),Uint8Array],[O.JSON.toString(),Uint8Array],[O.UUID.toString(),Uint8Array]]));Z(O,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,O.UINT8],[Uint16Array.name,O.UINT16],[Uint32Array.name,O.UINT32],[BigUint64Array.name,O.UINT64],[Float32Array.name,O.FLOAT32],[Float64Array.name,O.FLOAT64],[Int8Array.name,O.INT8],[Int16Array.name,O.INT16],[Int32Array.name,O.INT32],[BigInt64Array.name,O.INT64]]));Z(O,"DENSITIES",new Map([[O.UINT8.toString(),lt.BIT8],[O.UINT16.toString(),lt.BIT16],[O.UINT32.toString(),lt.BIT32],[O.UINT64.toString(),lt.BIT64],[O.FLOAT32.toString(),lt.BIT32],[O.FLOAT64.toString(),lt.BIT64],[O.INT8.toString(),lt.BIT8],[O.INT16.toString(),lt.BIT16],[O.INT32.toString(),lt.BIT32],[O.INT64.toString(),lt.BIT64],[O.TIMESTAMP.toString(),lt.BIT64],[O.STRING.toString(),lt.UNKNOWN],[O.JSON.toString(),lt.UNKNOWN],[O.UUID.toString(),lt.BIT128]]));Z(O,"ALL",[O.UNKNOWN,O.FLOAT64,O.FLOAT32,O.INT64,O.INT32,O.INT16,O.INT8,O.UINT64,O.UINT32,O.UINT16,O.UINT8,O.TIMESTAMP,O.UUID,O.STRING,O.JSON]);Z(O,"BIG_INT_TYPES",[O.INT64,O.UINT64,O.TIMESTAMP]);Z(O,"z",N.union([N.string().transform(r=>new O(r)),N.instanceof(O)]));const st=class Nr extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Nr.bytes(this.valueOf()+e.valueOf())}sub(e){return Nr.bytes(this.valueOf()-e.valueOf())}static bytes(e=1){return new Nr(e)}static kilobytes(e=1){return Nr.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Nr.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Nr.megabytes(e.valueOf()*1e3)}static terabytes(e){return Nr.gigabytes(e.valueOf()*1e3)}isZero(){return this.valueOf()===0}};Z(st,"BYTE",new st(1));Z(st,"KILOBYTE",st.kilobytes(1));Z(st,"MEGABYTE",st.megabytes(1));Z(st,"GIGABYTE",st.gigabytes(1));Z(st,"TERABYTE",st.terabytes(1));Z(st,"ZERO",new st(0));Z(st,"z",N.union([N.number().transform(r=>new st(r)),N.instanceof(st)]));let fg=st;N.union([N.instanceof(Uint8Array),N.instanceof(Uint16Array),N.instanceof(Uint32Array),N.instanceof(BigUint64Array),N.instanceof(Float32Array),N.instanceof(Float64Array),N.instanceof(Int8Array),N.instanceof(Int16Array),N.instanceof(Int32Array),N.instanceof(BigInt64Array)]);N.record(N.union([N.number(),N.string(),N.symbol()]),N.unknown());const bd=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",pg=bd(),kd=["MacOS","Windows","Linux","Docker"],mg=N.enum(kd);let so;const yg=()=>{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"},gg=(r={})=>{const{force:e,default:t}=r;return e??so??(so=yg(),so??t)},Td=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:kd,RUNTIME:pg,detect:bd,getOS:gg,osZ:mg},Symbol.toStringTag,{value:"Module"})),vg=(...r)=>r.map(xd).join(""),xd=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),wg=r=>r.endsWith("/")?r.slice(0,-1):r,_g=(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 bg=(bn=class{constructor({host:r,port:e,protocol:t="",pathPrefix:n=""}){Z(this,"protocol"),Z(this,"host"),Z(this,"port"),Z(this,"path"),this.protocol=t,this.host=r,this.port=e,this.path=xd(n)}replace(r){return new bn({host:r.host??this.host,port:r.port??this.port,protocol:r.protocol??this.protocol,pathPrefix:r.pathPrefix??this.path})}child(r){return new bn({...this,pathPrefix:vg(this.path,r)})}toString(){return wg(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}},Z(bn,"UNKNOWN",new bn({host:"unknown",port:0})),bn);var Ao;try{Ao=new TextDecoder}catch{}var P,xt,p=0,ze={},we,zr,kt=0,Vt=0,Ge,br,yt=[],ge,pu={useRecords:!1,mapsAsObjects:!0};class Od{}const Sd=new Od;Sd.name="MessagePack 0xC1";var Dr=!1,Nd=2,mu;try{new Function("")}catch{Nd=1/0}class Is{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(P)return jd(()=>(Co(),this?this.unpack(e,t):Is.prototype.unpack.call(pu,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(xt=t.end||e.length,p=t.start||0):(p=0,xt=t>-1?t:e.length),Vt=0,zr=null,Ge=null,P=e;try{ge=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw P=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 Is){if(ze=this,this.structures)return we=this.structures,ha(t);(!we||we.length>0)&&(we=[])}else ze=pu,(!we||we.length>0)&&(we=[]);return ha(t)}unpackMultiple(e,t){let n,s=0;try{Dr=!0;let a=e.length,i=this?this.unpack(e,a):Ui.unpack(e,a);if(t){if(t(i,s,p)===!1)return;for(;p<a;)if(s=p,t(ha(),s,p)===!1)return}else{for(n=[i];p<a;)s=p,n.push(ha());return n}}catch(a){throw a.lastPosition=s,a.values=n,a}finally{Dr=!1,Co()}}_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 ha(r){try{if(!ze.trusted&&!Dr){let t=we.sharedLength||0;t<we.length&&(we.length=t)}let e;if(ze.randomAccessStructure&&P[p]<64&&P[p]>=32&&mu?(e=mu(P,p,xt,ze),P=null,!(r&&r.lazy)&&e&&(e=e.toJSON()),p=xt):e=Ve(),Ge&&(p=Ge.postBundlePosition,Ge=null),Dr&&(we.restoreStructures=null),p==xt)we&&we.restoreStructures&&yu(),we=null,P=null,br&&(br=null);else{if(p>xt)throw new Error("Unexpected end of MessagePack data");if(!Dr){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 we&&we.restoreStructures&&yu(),Co(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||p>xt)&&(e.incomplete=!0),e}}function yu(){for(let r in we.restoreStructures)we[r]=we.restoreStructures[r];we.restoreStructures=null}function Ve(){let r=P[p++];if(r<160)if(r<128){if(r<64)return r;{let e=we[r&63]||ze.getStructures&&Ed()[r&63];return e?(e.read||(e.read=bc(e,r&63)),e.read()):r}}else if(r<144)if(r-=128,ze.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=Id();n==="__proto__"&&(n="__proto_"),e[n]=Ve()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Ve(),Ve());return e}else{r-=144;let e=new Array(r);for(let t=0;t<r;t++)e[t]=Ve();return ze.freezeData?Object.freeze(e):e}else if(r<192){let e=r-160;if(Vt>=p)return zr.slice(p-kt,(p+=e)-kt);if(Vt==0&&xt<140){let t=e<16?kc(e):Ad(e);if(t!=null)return t}return Io(e)}else{let e;switch(r){case 192:return null;case 193:return Ge?(e=Ve(),e>0?Ge[1].slice(Ge.position1,Ge.position1+=e):Ge[0].slice(Ge.position0,Ge.position0-=e)):Sd;case 194:return!1;case 195:return!0;case 196:if(e=P[p++],e===void 0)throw new Error("Unexpected end of buffer");return ao(e);case 197:return e=ge.getUint16(p),p+=2,ao(e);case 198:return e=ge.getUint32(p),p+=4,ao(e);case 199:return Qr(P[p++]);case 200:return e=ge.getUint16(p),p+=2,Qr(e);case 201:return e=ge.getUint32(p),p+=4,Qr(e);case 202:if(e=ge.getFloat32(p),ze.useFloat32>2){let t=Tc[(P[p]&127)<<1|P[p+1]>>7];return p+=4,(t*e+(e>0?.5:-.5)>>0)/t}return p+=4,e;case 203:return e=ge.getFloat64(p),p+=8,e;case 204:return P[p++];case 205:return e=ge.getUint16(p),p+=2,e;case 206:return e=ge.getUint32(p),p+=4,e;case 207:return ze.int64AsType==="number"?(e=ge.getUint32(p)*4294967296,e+=ge.getUint32(p+4)):ze.int64AsType==="string"?e=ge.getBigUint64(p).toString():ze.int64AsType==="auto"?(e=ge.getBigUint64(p),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ge.getBigUint64(p),p+=8,e;case 208:return ge.getInt8(p++);case 209:return e=ge.getInt16(p),p+=2,e;case 210:return e=ge.getInt32(p),p+=4,e;case 211:return ze.int64AsType==="number"?(e=ge.getInt32(p)*4294967296,e+=ge.getUint32(p+4)):ze.int64AsType==="string"?e=ge.getBigInt64(p).toString():ze.int64AsType==="auto"?(e=ge.getBigInt64(p),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ge.getBigInt64(p),p+=8,e;case 212:if(e=P[p++],e==114)return ku(P[p++]&63);{let t=yt[e];if(t)return t.read?(p++,t.read(Ve())):t.noBuffer?(p++,t()):t(P.subarray(p,++p));throw new Error("Unknown extension "+e)}case 213:return e=P[p],e==114?(p++,ku(P[p++]&63,P[p++])):Qr(2);case 214:return Qr(4);case 215:return Qr(8);case 216:return Qr(16);case 217:return e=P[p++],Vt>=p?zr.slice(p-kt,(p+=e)-kt):Tg(e);case 218:return e=ge.getUint16(p),p+=2,Vt>=p?zr.slice(p-kt,(p+=e)-kt):xg(e);case 219:return e=ge.getUint32(p),p+=4,Vt>=p?zr.slice(p-kt,(p+=e)-kt):Og(e);case 220:return e=ge.getUint16(p),p+=2,vu(e);case 221:return e=ge.getUint32(p),p+=4,vu(e);case 222:return e=ge.getUint16(p),p+=2,wu(e);case 223:return e=ge.getUint32(p),p+=4,wu(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 kg=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function bc(r,e){function t(){if(t.count++>Nd){let s=r.read=new Function("r","return function(){return "+(ze.freezeData?"Object.freeze":"")+"({"+r.map(a=>a==="__proto__"?"__proto_:r()":kg.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(Ve);return r.highByte===0&&(r.read=gu(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]=Ve()}return ze.freezeData?Object.freeze(n):n}return t.count=0,r.highByte===0?gu(e,t):t}const gu=(r,e)=>function(){let t=P[p++];if(t===0)return e();let n=r<32?-(r+(t<<5)):r+(t<<5),s=we[n]||Ed()[n];if(!s)throw new Error("Record id is not defined for "+n);return s.read||(s.read=bc(s,r)),s.read()};function Ed(){let r=jd(()=>(P=null,ze.getStructures()));return we=ze._mergeStructures(r,we)}var Io=Xs,Tg=Xs,xg=Xs,Og=Xs;function Xs(r){let e;if(r<16&&(e=kc(r)))return e;if(r>64&&Ao)return Ao.decode(P.subarray(p,p+=r));const t=p+r,n=[];for(e="";p<t;){const s=P[p++];if(!(s&128))n.push(s);else if((s&224)===192){const a=P[p++]&63;n.push((s&31)<<6|a)}else if((s&240)===224){const a=P[p++]&63,i=P[p++]&63;n.push((s&31)<<12|a<<6|i)}else if((s&248)===240){const a=P[p++]&63,i=P[p++]&63,o=P[p++]&63;let c=(s&7)<<18|a<<12|i<<6|o;c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|c&1023),n.push(c)}else n.push(s);n.length>=4096&&(e+=qe.apply(String,n),n.length=0)}return n.length>0&&(e+=qe.apply(String,n)),e}function vu(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=Ve();return ze.freezeData?Object.freeze(e):e}function wu(r){if(ze.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=Id();n==="__proto__"&&(n="__proto_"),e[n]=Ve()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Ve(),Ve());return e}}var qe=String.fromCharCode;function Ad(r){let e=p,t=new Array(r);for(let n=0;n<r;n++){const s=P[p++];if((s&128)>0){p=e;return}t[n]=s}return qe.apply(String,t)}function kc(r){if(r<4)if(r<2){if(r===0)return"";{let e=P[p++];if((e&128)>1){p-=1;return}return qe(e)}}else{let e=P[p++],t=P[p++];if((e&128)>0||(t&128)>0){p-=2;return}if(r<3)return qe(e,t);let n=P[p++];if((n&128)>0){p-=3;return}return qe(e,t,n)}else{let e=P[p++],t=P[p++],n=P[p++],s=P[p++];if((e&128)>0||(t&128)>0||(n&128)>0||(s&128)>0){p-=4;return}if(r<6){if(r===4)return qe(e,t,n,s);{let a=P[p++];if((a&128)>0){p-=5;return}return qe(e,t,n,s,a)}}else if(r<8){let a=P[p++],i=P[p++];if((a&128)>0||(i&128)>0){p-=6;return}if(r<7)return qe(e,t,n,s,a,i);let o=P[p++];if((o&128)>0){p-=7;return}return qe(e,t,n,s,a,i,o)}else{let a=P[p++],i=P[p++],o=P[p++],c=P[p++];if((a&128)>0||(i&128)>0||(o&128)>0||(c&128)>0){p-=8;return}if(r<10){if(r===8)return qe(e,t,n,s,a,i,o,c);{let d=P[p++];if((d&128)>0){p-=9;return}return qe(e,t,n,s,a,i,o,c,d)}}else if(r<12){let d=P[p++],w=P[p++];if((d&128)>0||(w&128)>0){p-=10;return}if(r<11)return qe(e,t,n,s,a,i,o,c,d,w);let D=P[p++];if((D&128)>0){p-=11;return}return qe(e,t,n,s,a,i,o,c,d,w,D)}else{let d=P[p++],w=P[p++],D=P[p++],X=P[p++];if((d&128)>0||(w&128)>0||(D&128)>0||(X&128)>0){p-=12;return}if(r<14){if(r===12)return qe(e,t,n,s,a,i,o,c,d,w,D,X);{let Q=P[p++];if((Q&128)>0){p-=13;return}return qe(e,t,n,s,a,i,o,c,d,w,D,X,Q)}}else{let Q=P[p++],Ze=P[p++];if((Q&128)>0||(Ze&128)>0){p-=14;return}if(r<15)return qe(e,t,n,s,a,i,o,c,d,w,D,X,Q,Ze);let ee=P[p++];if((ee&128)>0){p-=15;return}return qe(e,t,n,s,a,i,o,c,d,w,D,X,Q,Ze,ee)}}}}}function _u(){let r=P[p++],e;if(r<192)e=r-160;else switch(r){case 217:e=P[p++];break;case 218:e=ge.getUint16(p),p+=2;break;case 219:e=ge.getUint32(p),p+=4;break;default:throw new Error("Expected string")}return Xs(e)}function ao(r){return ze.copyBuffers?Uint8Array.prototype.slice.call(P,p,p+=r):P.subarray(p,p+=r)}function Qr(r){let e=P[p++];if(yt[e]){let t;return yt[e](P.subarray(p,t=p+=r),n=>{p=n;try{return Ve()}finally{p=t}})}else throw new Error("Unknown extension type "+e)}var bu=new Array(4096);function Id(){let r=P[p++];if(r>=160&&r<192){if(r=r-160,Vt>=p)return zr.slice(p-kt,(p+=r)-kt);if(!(Vt==0&&xt<180))return Io(r)}else return p--,Ve().toString();let e=(r<<5^(r>1?ge.getUint16(p):r>0?P[p]:0))&4095,t=bu[e],n=p,s=p+r-3,a,i=0;if(t&&t.bytes==r){for(;n<s;){if(a=ge.getUint32(n),a!=t[i++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(a=P[n++],a!=t[i++]){n=1879048192;break}if(n===s)return p=n,t.string;s-=3,n=p}for(t=[],bu[e]=t,t.bytes=r;n<s;)a=ge.getUint32(n),t.push(a),n+=4;for(s+=3;n<s;)a=P[n++],t.push(a);let o=r<16?kc(r):Ad(r);return o!=null?t.string=o:t.string=Io(r)}const ku=(r,e)=>{let t=Ve().map(a=>a.toString()),n=r;e!==void 0&&(r=r<32?-((e<<5)+r):(e<<5)+r,t.highByte=e);let s=we[r];return s&&(s.isShared||Dr)&&((we.restoreStructures||(we.restoreStructures=[]))[r]=s),we[r]=t,t.read=bc(t,n),t.read()};yt[0]=()=>{};yt[0].noBuffer=!0;let Sg={Error,TypeError,ReferenceError};yt[101]=()=>{let r=Ve();return(Sg[r[0]]||Error)(r[1])};yt[105]=r=>{let e=ge.getUint32(p-4);br||(br=new Map);let t=P[p],n;t>=144&&t<160||t==220||t==221?n=[]:n={};let s={target:n};br.set(e,s);let a=Ve();return s.used?Object.assign(n,a):(s.target=a,a)};yt[112]=r=>{let e=ge.getUint32(p-4),t=br.get(e);return t.used=!0,t.target};yt[115]=()=>new Set(Ve());const Cd=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(r=>r+"Array");let Ng=typeof globalThis=="object"?globalThis:window;yt[116]=r=>{let e=r[0],t=Cd[e];if(!t)throw new Error("Could not find typed array for code "+e);return new Ng[t](Uint8Array.prototype.slice.call(r,1).buffer)};yt[120]=()=>{let r=Ve();return new RegExp(r[0],r[1])};const Eg=[];yt[98]=r=>{let e=(r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3],t=p;return p+=e-r.length,Ge=Eg,Ge=[_u(),_u()],Ge.position0=0,Ge.position1=0,Ge.postBundlePosition=p,p=t,Ve()};yt[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 jd(r){let e=xt,t=p,n=kt,s=Vt,a=zr,i=br,o=Ge,c=new Uint8Array(P.slice(0,xt)),d=we,w=we.slice(0,we.length),D=ze,X=Dr,Q=r();return xt=e,p=t,kt=n,Vt=s,zr=a,br=i,Ge=o,P=c,Dr=X,we=d,we.splice(0,we.length,...w),ze=D,ge=new DataView(P.buffer,P.byteOffset,P.byteLength),Q}function Co(){P=null,br=null,we=null}function Ag(r){r.unpack?yt[r.type]=r.unpack:yt[r.type]=r}const Tc=new Array(147);for(let r=0;r<256;r++)Tc[r]=+("1e"+Math.floor(45.15-r*.30103));var Ui=new Is({useRecords:!1});const Ig=Ui.unpack;Ui.unpackMultiple;Ui.unpack;let Cg=new Float32Array(1);new Uint8Array(Cg.buffer,0,4);let za;try{za=new TextEncoder}catch{}let hi,xc;const Di=typeof Buffer<"u",fa=Di?function(r){return Buffer.allocUnsafeSlow(r)}:Uint8Array,Zd=Di?Buffer:Uint8Array,Tu=Di?4294967296:2144337920;let b,Jn,Ee,v=0,ut,Me=null,jg;const Zg=21760,Rg=/[\u0080-\uFFFF]/,kn=Symbol("record-id");class zg extends Is{constructor(e){super(e),this.offset=0;let t,n,s,a,i=Zd.prototype.utf8Write?function(l,T){return b.utf8Write(l,T,4294967295)}:za&&za.encodeInto?function(l,T){return za.encodeInto(l,b.subarray(T)).written}:!1,o=this;e||(e={});let c=e&&e.sequential,d=e.structures||e.saveStructures,w=e.maxSharedStructures;if(w==null&&(w=d?32:0),w>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let D=e.maxOwnStructures;D==null&&(D=d?32:64),!this.structures&&e.useRecords!=!1&&(this.structures=[]);let X=w>32||D+w>64,Q=w+64,Ze=w+D+64;if(Ze>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let ee=[],Qt=0,er=0;this.pack=this.encode=function(l,T){if(b||(b=new fa(8192),Ee=b.dataView||(b.dataView=new DataView(b.buffer,0,8192)),v=0),ut=b.length-10,ut-v<2048?(b=new fa(b.length),Ee=b.dataView||(b.dataView=new DataView(b.buffer,0,b.length)),ut=b.length-10,v=0):v=v+7&2147483640,t=v,T&Vg&&(v+=T&255),a=o.structuredClone?new Map:null,o.bundleStrings&&typeof l!="string"?(Me=[],Me.size=1/0):Me=null,s=o.structures,s){s.uninitialized&&(s=o._mergeStructures(o.getStructures()));let m=s.sharedLength||0;if(m>w)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 y=0;y<m;y++){let k=s[y];if(!k)continue;let R,U=s.transitions;for(let A=0,ne=k.length;A<ne;A++){let F=k[A];R=U[F],R||(R=U[F]=Object.create(null)),U=R}U[kn]=y+64}this.lastNamedStructuresLength=m}c||(s.nextId=m+64)}n&&(n=!1);try{o.randomAccessStructure&&l&&l.constructor&&l.constructor===Object?Ji(l):re(l);let m=Me;if(Me&&Su(t,re,0),a&&a.idsToInsert){let y=a.idsToInsert.sort((A,ne)=>A.offset>ne.offset?1:-1),k=y.length,R=-1;for(;m&&k>0;){let A=y[--k].offset+t;A<m.stringsPosition+t&&R===-1&&(R=0),A>m.position+t?R>=0&&(R+=6):(R>=0&&(Ee.setUint32(m.position+t,Ee.getUint32(m.position+t)+R),R=-1),m=m.previous,k++)}R>=0&&m&&Ee.setUint32(m.position+t,Ee.getUint32(m.position+t)+R),v+=y.length*6,v>ut&&He(v),o.offset=v;let U=Ug(b.subarray(t,v),y);return a=null,U}return o.offset=v,T&Lg?(b.start=t,b.end=v,b):b.subarray(t,v)}finally{if(s&&(Vn(),n&&o.saveStructures)){let m=s.sharedLength||0,y=b.subarray(t,v),k=Mg(s,o);return o.saveStructures(k,k.isCompatible)===!1?o.pack(l,T):(o.lastNamedStructuresLength=m,y)}T&Bg&&(v=t)}};const Vn=()=>{er<10&&er++;let l=s.sharedLength||0;if(s.length>l&&!c&&(s.length=l),Qt>1e4)s.transitions=null,er=0,Qt=0,ee.length>0&&(ee=[]);else if(ee.length>0&&!c){for(let T=0,m=ee.length;T<m;T++)ee[T][kn]=0;ee=[]}},Jr=l=>{var T=l.length;T<16?b[v++]=144|T:T<65536?(b[v++]=220,b[v++]=T>>8,b[v++]=T&255):(b[v++]=221,Ee.setUint32(v,T),v+=4);for(let m=0;m<T;m++)re(l[m])},re=l=>{v>ut&&(b=He(v));var T=typeof l,m;if(T==="string"){let y=l.length;if(Me&&y>=4&&y<4096){if((Me.size+=y)>Zg){let A,ne=(Me[0]?Me[0].length*3+Me[1].length:0)+10;v+ne>ut&&(b=He(v+ne));let F;Me.position?(F=Me,b[v]=200,v+=3,b[v++]=98,A=v-t,v+=4,Su(t,re,0),Ee.setUint16(A+t-3,v-t-A)):(b[v++]=214,b[v++]=98,A=v-t,v+=4),Me=["",""],Me.previous=F,Me.size=0,Me.position=A}let U=Rg.test(l);Me[U?0:1]+=l,b[v++]=193,re(U?-y:y);return}let k;y<32?k=1:y<256?k=2:y<65536?k=3:k=5;let R=y*3;if(v+R>ut&&(b=He(v+R)),y<64||!i){let U,A,ne,F=v+k;for(U=0;U<y;U++)A=l.charCodeAt(U),A<128?b[F++]=A:A<2048?(b[F++]=A>>6|192,b[F++]=A&63|128):(A&64512)===55296&&((ne=l.charCodeAt(U+1))&64512)===56320?(A=65536+((A&1023)<<10)+(ne&1023),U++,b[F++]=A>>18|240,b[F++]=A>>12&63|128,b[F++]=A>>6&63|128,b[F++]=A&63|128):(b[F++]=A>>12|224,b[F++]=A>>6&63|128,b[F++]=A&63|128);m=F-v-k}else m=i(l,v+k);m<32?b[v++]=160|m:m<256?(k<2&&b.copyWithin(v+2,v+1,v+1+m),b[v++]=217,b[v++]=m):m<65536?(k<3&&b.copyWithin(v+3,v+2,v+2+m),b[v++]=218,b[v++]=m>>8,b[v++]=m&255):(k<5&&b.copyWithin(v+5,v+3,v+3+m),b[v++]=219,Ee.setUint32(v,m),v+=4),v+=m}else if(T==="number")if(l>>>0===l)l<32||l<128&&this.useRecords===!1||l<64&&!this.randomAccessStructure?b[v++]=l:l<256?(b[v++]=204,b[v++]=l):l<65536?(b[v++]=205,b[v++]=l>>8,b[v++]=l&255):(b[v++]=206,Ee.setUint32(v,l),v+=4);else if(l>>0===l)l>=-32?b[v++]=256+l:l>=-128?(b[v++]=208,b[v++]=l+256):l>=-32768?(b[v++]=209,Ee.setInt16(v,l),v+=2):(b[v++]=210,Ee.setInt32(v,l),v+=4);else{let y;if((y=this.useFloat32)>0&&l<4294967296&&l>=-2147483648){b[v++]=202,Ee.setFloat32(v,l);let k;if(y<4||(k=l*Tc[(b[v]&127)<<1|b[v+1]>>7])>>0===k){v+=4;return}else v--}b[v++]=203,Ee.setFloat64(v,l),v+=8}else if(T==="object"||T==="function")if(!l)b[v++]=192;else{if(a){let k=a.get(l);if(k){if(!k.id){let R=a.idsToInsert||(a.idsToInsert=[]);k.id=R.push(k)}b[v++]=214,b[v++]=112,Ee.setUint32(v,k.id),v+=4;return}else a.set(l,{offset:v-t})}let y=l.constructor;if(y===Object)tr(l,!0);else if(y===Array)Jr(l);else if(y===Map)if(this.mapAsEmptyObject)b[v++]=128;else{m=l.size,m<16?b[v++]=128|m:m<65536?(b[v++]=222,b[v++]=m>>8,b[v++]=m&255):(b[v++]=223,Ee.setUint32(v,m),v+=4);for(let[k,R]of l)re(k),re(R)}else{for(let k=0,R=hi.length;k<R;k++){let U=xc[k];if(l instanceof U){let A=hi[k];if(A.write){A.type&&(b[v++]=212,b[v++]=A.type,b[v++]=0);let Xe=A.write.call(this,l);Xe===l?Array.isArray(l)?Jr(l):tr(l):re(Xe);return}let ne=b,F=Ee,Ke=v;b=null;let ot;try{ot=A.pack.call(this,l,Xe=>(b=ne,ne=null,v+=Xe,v>ut&&He(v),{target:b,targetView:Ee,position:v-Xe}),re)}finally{ne&&(b=ne,Ee=F,v=Ke,ut=b.length-10)}ot&&(ot.length+v>ut&&He(ot.length+v),v=Pg(ot,b,v,A.type));return}}if(Array.isArray(l))Jr(l);else{if(l.toJSON){const k=l.toJSON();if(k!==l)return re(k)}if(T==="function")return re(this.writeFunction&&this.writeFunction(l));tr(l,!l.hasOwnProperty)}}}else if(T==="boolean")b[v++]=l?195:194;else if(T==="bigint"){if(l<BigInt(1)<<BigInt(63)&&l>=-(BigInt(1)<<BigInt(63)))b[v++]=211,Ee.setBigInt64(v,l);else if(l<BigInt(1)<<BigInt(64)&&l>0)b[v++]=207,Ee.setBigUint64(v,l);else if(this.largeBigIntToFloat)b[v++]=203,Ee.setFloat64(v,Number(l));else throw new RangeError(l+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");v+=8}else if(T==="undefined")this.encodeUndefinedAsNil?b[v++]=192:(b[v++]=212,b[v++]=0,b[v++]=0);else throw new Error("Unknown type: "+T)},Kn=this.variableMapSize||this.coercibleKeyAsNumber?l=>{let T=Object.keys(l),m=T.length;m<16?b[v++]=128|m:m<65536?(b[v++]=222,b[v++]=m>>8,b[v++]=m&255):(b[v++]=223,Ee.setUint32(v,m),v+=4);let y;if(this.coercibleKeyAsNumber)for(let k=0;k<m;k++){y=T[k];let R=Number(y);re(isNaN(R)?y:R),re(l[y])}else for(let k=0;k<m;k++)re(y=T[k]),re(l[y])}:(l,T)=>{b[v++]=222;let m=v-t;v+=2;let y=0;for(let k in l)(T||l.hasOwnProperty(k))&&(re(k),re(l[k]),y++);b[m+++t]=y>>8,b[m+t]=y&255},Fn=this.useRecords===!1?Kn:e.progressiveRecords&&!X?(l,T)=>{let m,y=s.transitions||(s.transitions=Object.create(null)),k=v++-t,R;for(let U in l)if(T||l.hasOwnProperty(U)){if(m=y[U],m)y=m;else{let A=Object.keys(l),ne=y;y=s.transitions;let F=0;for(let Ke=0,ot=A.length;Ke<ot;Ke++){let Xe=A[Ke];m=y[Xe],m||(m=y[Xe]=Object.create(null),F++),y=m}k+t+1==v?(v--,Gr(y,A,F)):qn(y,A,k,F),R=!0,y=ne[U]}re(l[U])}if(!R){let U=y[kn];U?b[k+t]=U:qn(y,Object.keys(l),k,0)}}:(l,T)=>{let m,y=s.transitions||(s.transitions=Object.create(null)),k=0;for(let U in l)(T||l.hasOwnProperty(U))&&(m=y[U],m||(m=y[U]=Object.create(null),k++),y=m);let R=y[kn];R?R>=96&&X?(b[v++]=((R-=96)&31)+96,b[v++]=R>>5):b[v++]=R:Gr(y,y.__keys__||Object.keys(l),k);for(let U in l)(T||l.hasOwnProperty(U))&&re(l[U])},Wn=typeof this.useRecords=="function"&&this.useRecords,tr=Wn?(l,T)=>{Wn(l)?Fn(l,T):Kn(l,T)}:Fn,He=l=>{let T;if(l>16777216){if(l-t>Tu)throw new Error("Packed buffer would be larger than maximum buffer size");T=Math.min(Tu,Math.round(Math.max((l-t)*(l>67108864?1.25:2),4194304)/4096)*4096)}else T=(Math.max(l-t<<2,b.length-1)>>12)+1<<12;let m=new fa(T);return Ee=m.dataView||(m.dataView=new DataView(m.buffer,0,T)),l=Math.min(l,b.length),b.copy?b.copy(m,0,t,l):m.set(b.slice(t,l)),v-=t,t=0,ut=m.length-10,b=m},Gr=(l,T,m)=>{let y=s.nextId;y||(y=64),y<Q&&this.shouldShareStructure&&!this.shouldShareStructure(T)?(y=s.nextOwnId,y<Ze||(y=Q),s.nextOwnId=y+1):(y>=Ze&&(y=Q),s.nextId=y+1);let k=T.highByte=y>=96&&X?y-96>>5:-1;l[kn]=y,l.__keys__=T,s[y-64]=T,y<Q?(T.isShared=!0,s.sharedLength=y-63,n=!0,k>=0?(b[v++]=(y&31)+96,b[v++]=k):b[v++]=y):(k>=0?(b[v++]=213,b[v++]=114,b[v++]=(y&31)+96,b[v++]=k):(b[v++]=212,b[v++]=114,b[v++]=y),m&&(Qt+=er*m),ee.length>=D&&(ee.shift()[kn]=0),ee.push(l),re(T))},qn=(l,T,m,y)=>{let k=b,R=v,U=ut,A=t;b=Jn,v=0,t=0,b||(Jn=b=new fa(8192)),ut=b.length-10,Gr(l,T,y),Jn=b;let ne=v;if(b=k,v=R,ut=U,t=A,ne>1){let F=v+ne-1;F>ut&&He(F);let Ke=m+t;b.copyWithin(Ke+ne,Ke+1,v),b.set(Jn.slice(0,ne),Ke),v=F}else b[m+t]=Jn[0]},Ji=(l,T)=>{let m=jg(l,b,t,v,s,He,(y,k,R)=>{if(R)return n=!0;v=k;let U=b;return re(y),Vn(),U!==b?{position:v,targetView:Ee,target:b}:v},this);if(m===0)return tr(l,!0);v=m}}useBuffer(e){b=e,Ee=new DataView(b.buffer,b.byteOffset,b.byteLength),v=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}xc=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Od];hi=[{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?xu(r,16,e):Ou(Di?Buffer.from(r):new Uint8Array(r),e)}},{pack(r,e){let t=r.constructor;t!==Zd&&this.moreTypes?xu(r,Cd.indexOf(t.name),e):Ou(r,e)}},{pack(r,e){let{target:t,position:n}=e(1);t[n]=193}}];function xu(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 Ou(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 Pg(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 Ug(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 Su(r,e,t){if(Me.length>0){Ee.setUint32(Me.position+r,v+t-Me.position-r),Me.stringsPosition=v-r;let n=Me;Me=null,e(n[0]),e(n[1])}}function Dg(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)");xc.unshift(r.Class),hi.unshift(r)}Ag(r)}function Mg(r,e){return r.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},r}let Rd=new zg({useRecords:!1});const $g=Rd.pack;Rd.pack;const Lg=512,Bg=1024,Vg=2048;class Kg{constructor(){Z(this,"contentType","application/msgpack")}encode(e){return $g(Mn.toSnake(e))}decode(e,t){const n=Mn.toCamel(Ig(new Uint8Array(e)));return t!=null?t.parse(n):n}static registerCustomType(e){Dg({type:0,...e})}}class Fg{constructor(){Z(this,"contentType","application/json")}encode(e){const t=JSON.stringify(Mn.toSnake(e),(n,s)=>ArrayBuffer.isView(s)?Array.from(s):s);return new TextEncoder().encode(t)}decode(e,t){const n=Mn.toCamel(JSON.parse(new TextDecoder().decode(e)));return t!=null?t.parse(n):n}static registerCustomType(){}}new Kg,new Fg;var Te;(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})(Te||(Te={}));var jo;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(jo||(jo={}));const L=Te.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zr=r=>{switch(typeof r){case"undefined":return L.undefined;case"string":return L.string;case"number":return isNaN(r)?L.nan:L.number;case"boolean":return L.boolean;case"function":return L.function;case"bigint":return L.bigint;case"symbol":return L.symbol;case"object":return Array.isArray(r)?L.array:r===null?L.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?L.promise:typeof Map<"u"&&r instanceof Map?L.map:typeof Set<"u"&&r instanceof Set?L.set:typeof Date<"u"&&r instanceof Date?L.date:L.object;default:return L.unknown}},j=Te.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"]),Wg=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Pt 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,c=0;for(;c<i.path.length;){const d=i.path[c];c===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],c++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,Te.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()}}Pt.create=r=>new Pt(r);const Cs=(r,e)=>{let t;switch(r.code){case j.invalid_type:r.received===L.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case j.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,Te.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:t=`Unrecognized key(s) in object: ${Te.joinValues(r.keys,", ")}`;break;case j.invalid_union:t="Invalid input";break;case j.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Te.joinValues(r.options)}`;break;case j.invalid_enum_value:t=`Invalid enum value. Expected ${Te.joinValues(r.options)}, received '${r.received}'`;break;case j.invalid_arguments:t="Invalid function arguments";break;case j.invalid_return_type:t="Invalid function return type";break;case j.invalid_date:t="Invalid date";break;case j.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}"`:Te.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case j.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 j.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 j.custom:t="Invalid input";break;case j.invalid_intersection_types:t="Intersection results could not be merged";break;case j.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case j.not_finite:t="Number must be finite";break;default:t=e.defaultError,Te.assertNever(r)}return{message:t}};let zd=Cs;function qg(r){zd=r}function fi(){return zd}const pi=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const c=n.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},Yg=[];function K(r,e){const t=pi({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,fi(),Cs].filter(n=>!!n)});r.common.issues.push(t)}class it{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 ae;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 it.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 ae;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 ae=Object.freeze({status:"aborted"}),Pd=r=>({status:"dirty",value:r}),gt=r=>({status:"valid",value:r}),Zo=r=>r.status==="aborted",Ro=r=>r.status==="dirty",js=r=>r.status==="valid",mi=r=>typeof Promise<"u"&&r instanceof Promise;var Y;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Y||(Y={}));class Gt{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 Nu=(r,e)=>{if(js(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 Pt(r.common.issues);return this._error=t,this._error}}};function ce(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:(a,i)=>a.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.defaultError},description:s}}class de{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 Zr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Zr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new it,ctx:{common:e.parent.common,data:e.data,parsedType:Zr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(mi(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:Zr(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Nu(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:Zr(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(mi(s)?s:Promise.resolve(s));return Nu(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:j.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!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 $t({schema:this,typeName:H.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return kr.create(this,this._def)}nullable(){return pn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ut.create(this,this._def)}promise(){return Ln.create(this,this._def)}or(e){return Ps.create([this,e],this._def)}and(e){return Us.create(this,e,this._def)}transform(e){return new $t({...ce(this._def),schema:this,typeName:H.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Bs({...ce(this._def),innerType:this,defaultValue:t,typeName:H.ZodDefault})}brand(){return new Dd({typeName:H.ZodBranded,type:this,...ce(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new wi({...ce(this._def),innerType:this,catchValue:t,typeName:H.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Qs.create(this,e)}readonly(){return bi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Jg=/^c[^\s-]{8,}$/i,Gg=/^[a-z][a-z0-9]*$/,Hg=/^[0-9A-HJKMNP-TV-Z]{26}$/,Xg=/^[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,Qg=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ev="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let io;const tv=/^(((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}))$/,rv=/^(([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})))$/,nv=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 sv(r,e){return!!((e==="v4"||!e)&&tv.test(r)||(e==="v6"||!e)&&rv.test(r))}class jt extends de{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==L.string){const s=this._getOrReturnCtx(e);return K(s,{code:j.invalid_type,expected:L.string,received:s.parsedType}),ae}const t=new it;let n;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),K(n,{code:j.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),K(n,{code:j.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(n=this._getOrReturnCtx(e,n),a?K(n,{code:j.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&K(n,{code:j.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if(s.kind==="email")Qg.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"email",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="emoji")io||(io=new RegExp(ev,"u")),io.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"emoji",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="uuid")Xg.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"uuid",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid")Jg.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"cuid",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid2")Gg.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"cuid2",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="ulid")Hg.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"ulid",code:j.invalid_string,message:s.message}),t.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),K(n,{validation:"url",code:j.invalid_string,message:s.message}),t.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"regex",code:j.invalid_string,message:s.message}),t.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),K(n,{code:j.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),K(n,{code:j.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),K(n,{code:j.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):s.kind==="datetime"?nv(s).test(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{code:j.invalid_string,validation:"datetime",message:s.message}),t.dirty()):s.kind==="ip"?sv(e.data,s.version)||(n=this._getOrReturnCtx(e,n),K(n,{validation:"ip",code:j.invalid_string,message:s.message}),t.dirty()):Te.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:j.invalid_string,...Y.errToObj(n)})}_addCheck(e){return new jt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.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,...Y.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Y.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Y.errToObj(t)})}nonempty(e){return this.min(1,Y.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}}jt.create=r=>{var e;return new jt({checks:[],typeName:H.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ce(r)})};function av(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 Vr extends de{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)!==L.number){const s=this._getOrReturnCtx(e);return K(s,{code:j.invalid_type,expected:L.number,received:s.parsedType}),ae}let t;const n=new it;for(const s of this._def.checks)s.kind==="int"?Te.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),K(t,{code:j.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?av(e.data,s.value)!==0&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),K(t,{code:j.not_finite,message:s.message}),n.dirty()):Te.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,n,s){return new Vr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Y.toString(s)}]})}_addCheck(e){return new Vr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.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"&&Te.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)}}Vr.create=r=>new Vr({checks:[],typeName:H.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...ce(r)});class Kr extends de{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)!==L.bigint){const s=this._getOrReturnCtx(e);return K(s,{code:j.invalid_type,expected:L.bigint,received:s.parsedType}),ae}let t;const n=new it;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),K(t,{code:j.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):Te.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,n,s){return new Kr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Y.toString(s)}]})}_addCheck(e){return new Kr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.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}}Kr.create=r=>{var e;return new Kr({checks:[],typeName:H.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ce(r)})};class Zs extends de{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==L.boolean){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.boolean,received:t.parsedType}),ae}return gt(e.data)}}Zs.create=r=>new Zs({typeName:H.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...ce(r)});class hn extends de{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==L.date){const s=this._getOrReturnCtx(e);return K(s,{code:j.invalid_type,expected:L.date,received:s.parsedType}),ae}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return K(s,{code:j.invalid_date}),ae}const t=new it;let n;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),K(n,{code:j.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),K(n,{code:j.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):Te.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new hn({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Y.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}}hn.create=r=>new hn({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:H.ZodDate,...ce(r)});class yi extends de{_parse(e){if(this._getType(e)!==L.symbol){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.symbol,received:t.parsedType}),ae}return gt(e.data)}}yi.create=r=>new yi({typeName:H.ZodSymbol,...ce(r)});class Rs extends de{_parse(e){if(this._getType(e)!==L.undefined){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.undefined,received:t.parsedType}),ae}return gt(e.data)}}Rs.create=r=>new Rs({typeName:H.ZodUndefined,...ce(r)});class zs extends de{_parse(e){if(this._getType(e)!==L.null){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.null,received:t.parsedType}),ae}return gt(e.data)}}zs.create=r=>new zs({typeName:H.ZodNull,...ce(r)});class $n extends de{constructor(){super(...arguments),this._any=!0}_parse(e){return gt(e.data)}}$n.create=r=>new $n({typeName:H.ZodAny,...ce(r)});class sn extends de{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gt(e.data)}}sn.create=r=>new sn({typeName:H.ZodUnknown,...ce(r)});class Or extends de{_parse(e){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.never,received:t.parsedType}),ae}}Or.create=r=>new Or({typeName:H.ZodNever,...ce(r)});class gi extends de{_parse(e){if(this._getType(e)!==L.undefined){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.void,received:t.parsedType}),ae}return gt(e.data)}}gi.create=r=>new gi({typeName:H.ZodVoid,...ce(r)});class Ut extends de{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==L.array)return K(t,{code:j.invalid_type,expected:L.array,received:t.parsedType}),ae;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(K(t,{code:i?j.too_big:j.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&&(K(t,{code:j.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&&(K(t,{code:j.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 Gt(t,i,t.path,o)))).then(i=>it.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Gt(t,i,t.path,o)));return it.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Ut({...this._def,minLength:{value:e,message:Y.toString(t)}})}max(e,t){return new Ut({...this._def,maxLength:{value:e,message:Y.toString(t)}})}length(e,t){return new Ut({...this._def,exactLength:{value:e,message:Y.toString(t)}})}nonempty(e){return this.min(1,e)}}Ut.create=(r,e)=>new Ut({type:r,minLength:null,maxLength:null,exactLength:null,typeName:H.ZodArray,...ce(e)});function On(r){if(r instanceof Le){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=kr.create(On(n))}return new Le({...r._def,shape:()=>e})}else return r instanceof Ut?new Ut({...r._def,type:On(r.element)}):r instanceof kr?kr.create(On(r.unwrap())):r instanceof pn?pn.create(On(r.unwrap())):r instanceof Ht?Ht.create(r.items.map(e=>On(e))):r}class Le extends de{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=Te.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==L.object){const c=this._getOrReturnCtx(e);return K(c,{code:j.invalid_type,expected:L.object,received:c.parsedType}),ae}const{status:t,ctx:n}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Or&&this._def.unknownKeys==="strip"))for(const c in n.data)a.includes(c)||i.push(c);const o=[];for(const c of a){const d=s[c],w=n.data[c];o.push({key:{status:"valid",value:c},value:d._parse(new Gt(n,w,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Or){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of i)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(c==="strict")i.length>0&&(K(n,{code:j.unrecognized_keys,keys:i}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of i){const w=n.data[d];o.push({key:{status:"valid",value:d},value:c._parse(new Gt(n,w,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of o){const w=await d.key;c.push({key:w,value:await d.value,alwaysSet:d.alwaysSet})}return c}).then(c=>it.mergeObjectSync(t,c)):it.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new Le({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const c=(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=Y.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new Le({...this._def,unknownKeys:"strip"})}passthrough(){return new Le({...this._def,unknownKeys:"passthrough"})}extend(e){return new Le({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Le({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:H.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Le({...this._def,catchall:e})}pick(e){const t={};return Te.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Le({...this._def,shape:()=>t})}omit(e){const t={};return Te.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Le({...this._def,shape:()=>t})}deepPartial(){return On(this)}partial(e){const t={};return Te.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new Le({...this._def,shape:()=>t})}required(e){const t={};return Te.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof kr;)s=s._def.innerType;t[n]=s}}),new Le({...this._def,shape:()=>t})}keyof(){return Ud(Te.objectKeys(this.shape))}}Le.create=(r,e)=>new Le({shape:()=>r,unknownKeys:"strip",catchall:Or.create(),typeName:H.ZodObject,...ce(e)});Le.strictCreate=(r,e)=>new Le({shape:()=>r,unknownKeys:"strict",catchall:Or.create(),typeName:H.ZodObject,...ce(e)});Le.lazycreate=(r,e)=>new Le({shape:r,unknownKeys:"strip",catchall:Or.create(),typeName:H.ZodObject,...ce(e)});class Ps extends de{_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 Pt(o.ctx.common.issues));return K(t,{code:j.invalid_union,unionErrors:i}),ae}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 c of n){const d={...t,common:{...t.common,issues:[]},parent:null},w=c._parseSync({data:t.data,path:t.path,parent:d});if(w.status==="valid")return w;w.status==="dirty"&&!a&&(a={result:w,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new Pt(c));return K(t,{code:j.invalid_union,unionErrors:o}),ae}}get options(){return this._def.options}}Ps.create=(r,e)=>new Ps({options:r,typeName:H.ZodUnion,...ce(e)});const Pa=r=>r instanceof Ms?Pa(r.schema):r instanceof $t?Pa(r.innerType()):r instanceof $s?[r.value]:r instanceof Fr?r.options:r instanceof Ls?Object.keys(r.enum):r instanceof Bs?Pa(r._def.innerType):r instanceof Rs?[void 0]:r instanceof zs?[null]:null;class Mi extends de{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.object)return K(t,{code:j.invalid_type,expected:L.object,received:t.parsedType}),ae;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}):(K(t,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ae)}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=Pa(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 Mi({typeName:H.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...ce(n)})}}function zo(r,e){const t=Zr(r),n=Zr(e);if(r===e)return{valid:!0,data:r};if(t===L.object&&n===L.object){const s=Te.objectKeys(e),a=Te.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=zo(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===L.array&&n===L.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],c=zo(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===L.date&&n===L.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Us extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Zo(a)||Zo(i))return ae;const o=zo(a.value,i.value);return o.valid?((Ro(a)||Ro(i))&&t.dirty(),{status:t.value,value:o.data}):(K(n,{code:j.invalid_intersection_types}),ae)};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}))}}Us.create=(r,e,t)=>new Us({left:r,right:e,typeName:H.ZodIntersection,...ce(t)});class Ht extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.array)return K(n,{code:j.invalid_type,expected:L.array,received:n.parsedType}),ae;if(n.data.length<this._def.items.length)return K(n,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&n.data.length>this._def.items.length&&(K(n,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...n.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new Gt(n,a,n.path,i)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>it.mergeArray(t,a)):it.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Ht({...this._def,rest:e})}}Ht.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ht({items:r,typeName:H.ZodTuple,rest:null,...ce(e)})};class Ds extends de{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!==L.object)return K(n,{code:j.invalid_type,expected:L.object,received:n.parsedType}),ae;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Gt(n,o,n.path,o)),value:i._parse(new Gt(n,n.data[o],n.path,o))});return n.common.async?it.mergeObjectAsync(t,s):it.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof de?new Ds({keyType:e,valueType:t,typeName:H.ZodRecord,...ce(n)}):new Ds({keyType:jt.create(),valueType:e,typeName:H.ZodRecord,...ce(t)})}}class vi extends de{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!==L.map)return K(n,{code:j.invalid_type,expected:L.map,received:n.parsedType}),ae;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],d)=>({key:s._parse(new Gt(n,o,n.path,[d,"key"])),value:a._parse(new Gt(n,c,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const d=await c.key,w=await c.value;if(d.status==="aborted"||w.status==="aborted")return ae;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const d=c.key,w=c.value;if(d.status==="aborted"||w.status==="aborted")return ae;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}}}}vi.create=(r,e,t)=>new vi({valueType:e,keyType:r,typeName:H.ZodMap,...ce(t)});class fn extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.set)return K(n,{code:j.invalid_type,expected:L.set,received:n.parsedType}),ae;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(K(n,{code:j.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&&(K(n,{code:j.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(c){const d=new Set;for(const w of c){if(w.status==="aborted")return ae;w.status==="dirty"&&t.dirty(),d.add(w.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((c,d)=>a._parse(new Gt(n,c,n.path,d)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new fn({...this._def,minSize:{value:e,message:Y.toString(t)}})}max(e,t){return new fn({...this._def,maxSize:{value:e,message:Y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}fn.create=(r,e)=>new fn({valueType:r,minSize:null,maxSize:null,typeName:H.ZodSet,...ce(e)});class An extends de{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.function)return K(t,{code:j.invalid_type,expected:L.function,received:t.parsedType}),ae;function n(o,c){return pi({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fi(),Cs].filter(d=>!!d),issueData:{code:j.invalid_arguments,argumentsError:c}})}function s(o,c){return pi({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fi(),Cs].filter(d=>!!d),issueData:{code:j.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ln){const o=this;return gt(async function(...c){const d=new Pt([]),w=await o._def.args.parseAsync(c,a).catch(X=>{throw d.addIssue(n(c,X)),d}),D=await Reflect.apply(i,this,w);return await o._def.returns._def.type.parseAsync(D,a).catch(X=>{throw d.addIssue(s(D,X)),d})})}else{const o=this;return gt(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new Pt([n(c,d.error)]);const w=Reflect.apply(i,this,d.data),D=o._def.returns.safeParse(w,a);if(!D.success)throw new Pt([s(w,D.error)]);return D.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new An({...this._def,args:Ht.create(e).rest(sn.create())})}returns(e){return new An({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new An({args:e||Ht.create([]).rest(sn.create()),returns:t||sn.create(),typeName:H.ZodFunction,...ce(n)})}}class Ms extends de{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})}}Ms.create=(r,e)=>new Ms({getter:r,typeName:H.ZodLazy,...ce(e)});class $s extends de{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return K(t,{received:t.data,code:j.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:e.data}}get value(){return this._def.value}}$s.create=(r,e)=>new $s({value:r,typeName:H.ZodLiteral,...ce(e)});function Ud(r,e){return new Fr({values:r,typeName:H.ZodEnum,...ce(e)})}class Fr extends de{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return K(t,{expected:Te.joinValues(n),received:t.parsedType,code:j.invalid_type}),ae}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return K(t,{received:t.data,code:j.invalid_enum_value,options:n}),ae}return gt(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 Fr.create(e)}exclude(e){return Fr.create(this.options.filter(t=>!e.includes(t)))}}Fr.create=Ud;class Ls extends de{_parse(e){const t=Te.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==L.string&&n.parsedType!==L.number){const s=Te.objectValues(t);return K(n,{expected:Te.joinValues(s),received:n.parsedType,code:j.invalid_type}),ae}if(t.indexOf(e.data)===-1){const s=Te.objectValues(t);return K(n,{received:n.data,code:j.invalid_enum_value,options:s}),ae}return gt(e.data)}get enum(){return this._def.values}}Ls.create=(r,e)=>new Ls({values:r,typeName:H.ZodNativeEnum,...ce(e)});class Ln extends de{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.promise&&t.common.async===!1)return K(t,{code:j.invalid_type,expected:L.promise,received:t.parsedType}),ae;const n=t.parsedType===L.promise?t.data:Promise.resolve(t.data);return gt(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ln.create=(r,e)=>new Ln({type:r,typeName:H.ZodPromise,...ce(e)});class $t extends de{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===H.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=>{K(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 c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ae:(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"?ae:(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(!js(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=>js(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);Te.assertNever(s)}}$t.create=(r,e,t)=>new $t({schema:r,typeName:H.ZodEffects,effect:e,...ce(t)});$t.createWithPreprocess=(r,e,t)=>new $t({schema:e,effect:{type:"preprocess",transform:r},typeName:H.ZodEffects,...ce(t)});class kr extends de{_parse(e){return this._getType(e)===L.undefined?gt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}kr.create=(r,e)=>new kr({innerType:r,typeName:H.ZodOptional,...ce(e)});class pn extends de{_parse(e){return this._getType(e)===L.null?gt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pn.create=(r,e)=>new pn({innerType:r,typeName:H.ZodNullable,...ce(e)});class Bs extends de{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===L.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Bs.create=(r,e)=>new Bs({innerType:r,typeName:H.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ce(e)});class wi extends de{_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 mi(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Pt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Pt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}wi.create=(r,e)=>new wi({innerType:r,typeName:H.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ce(e)});class _i extends de{_parse(e){if(this._getType(e)!==L.nan){const t=this._getOrReturnCtx(e);return K(t,{code:j.invalid_type,expected:L.nan,received:t.parsedType}),ae}return{status:"valid",value:e.data}}}_i.create=r=>new _i({typeName:H.ZodNaN,...ce(r)});const iv=Symbol("zod_brand");class Dd extends de{_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 Qs extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ae:s.status==="dirty"?(t.dirty(),Pd(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ae: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 Qs({in:e,out:t,typeName:H.ZodPipeline})}}class bi extends de{_parse(e){const t=this._def.innerType._parse(e);return js(t)&&(t.value=Object.freeze(t.value)),t}}bi.create=(r,e)=>new bi({innerType:r,typeName:H.ZodReadonly,...ce(e)});const Md=(r,e={},t)=>r?$n.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:c})}}):$n.create(),ov={object:Le.lazycreate};var H;(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"})(H||(H={}));const cv=(r,e={message:`Input not instance of ${r.name}`})=>Md(t=>t instanceof r,e),$d=jt.create,Ld=Vr.create,uv=_i.create,lv=Kr.create,Bd=Zs.create,dv=hn.create,hv=yi.create,fv=Rs.create,pv=zs.create,mv=$n.create,yv=sn.create,gv=Or.create,vv=gi.create,wv=Ut.create,_v=Le.create,bv=Le.strictCreate,kv=Ps.create,Tv=Mi.create,xv=Us.create,Ov=Ht.create,Sv=Ds.create,Nv=vi.create,Ev=fn.create,Av=An.create,Iv=Ms.create,Cv=$s.create,jv=Fr.create,Zv=Ls.create,Rv=Ln.create,Eu=$t.create,zv=kr.create,Pv=pn.create,Uv=$t.createWithPreprocess,Dv=Qs.create,Mv=()=>$d().optional(),$v=()=>Ld().optional(),Lv=()=>Bd().optional(),Bv={string:r=>jt.create({...r,coerce:!0}),number:r=>Vr.create({...r,coerce:!0}),boolean:r=>Zs.create({...r,coerce:!0}),bigint:r=>Kr.create({...r,coerce:!0}),date:r=>hn.create({...r,coerce:!0})},Vv=ae;var gr=Object.freeze({__proto__:null,defaultErrorMap:Cs,setErrorMap:qg,getErrorMap:fi,makeIssue:pi,EMPTY_PATH:Yg,addIssueToContext:K,ParseStatus:it,INVALID:ae,DIRTY:Pd,OK:gt,isAborted:Zo,isDirty:Ro,isValid:js,isAsync:mi,get util(){return Te},get objectUtil(){return jo},ZodParsedType:L,getParsedType:Zr,ZodType:de,ZodString:jt,ZodNumber:Vr,ZodBigInt:Kr,ZodBoolean:Zs,ZodDate:hn,ZodSymbol:yi,ZodUndefined:Rs,ZodNull:zs,ZodAny:$n,ZodUnknown:sn,ZodNever:Or,ZodVoid:gi,ZodArray:Ut,ZodObject:Le,ZodUnion:Ps,ZodDiscriminatedUnion:Mi,ZodIntersection:Us,ZodTuple:Ht,ZodRecord:Ds,ZodMap:vi,ZodSet:fn,ZodFunction:An,ZodLazy:Ms,ZodLiteral:$s,ZodEnum:Fr,ZodNativeEnum:Ls,ZodPromise:Ln,ZodEffects:$t,ZodTransformer:$t,ZodOptional:kr,ZodNullable:pn,ZodDefault:Bs,ZodCatch:wi,ZodNaN:_i,BRAND:iv,ZodBranded:Dd,ZodPipeline:Qs,ZodReadonly:bi,custom:Md,Schema:de,ZodSchema:de,late:ov,get ZodFirstPartyTypeKind(){return H},coerce:Bv,any:mv,array:wv,bigint:lv,boolean:Bd,date:dv,discriminatedUnion:Tv,effect:Eu,enum:jv,function:Av,instanceof:cv,intersection:xv,lazy:Iv,literal:Cv,map:Nv,nan:uv,nativeEnum:Zv,never:gv,null:pv,nullable:Pv,number:Ld,object:_v,oboolean:Lv,onumber:$v,optional:zv,ostring:Mv,pipeline:Dv,preprocess:Uv,promise:Rv,record:Sv,set:Ev,strictObject:bv,string:$d,symbol:hv,transformer:Eu,tuple:Ov,undefined:fv,union:kv,unknown:yv,void:vv,NEVER:Vv,ZodIssueCode:j,quotelessJson:Wg,ZodError:Pt});class ea extends Error{constructor(e,t){super(e),Fe(this,"discriminator","FreighterError"),Fe(this,"type"),this.type=t}}const Kv=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},Po="unknown",Au="nil",$i="freighter",ta=gr.object({type:gr.string(),data:gr.string()});class Fv{constructor(){Fe(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Au,data:""};if(Kv(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}return{type:Po,data:JSON.stringify(e)}}decode(e){if(e==null||e.type===Au)return null;if(e.type===Po)return new Iu(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new Iu(e.data)}}const Vd=new Fv,Kd=({encode:r,decode:e})=>Vd.register({encode:r,decode:e}),Oc=r=>Vd.decode(r);class Iu extends ea{constructor(e){super(e,Po)}}class Vs extends ea{constructor(){super("EOF",$i)}}class ki extends ea{constructor(){super("StreamClosed",$i)}}class Ks extends ea{constructor(e={}){const{message:t="Unreachable",url:n=bg.UNKNOWN}=e;super(t,$i),Fe(this,"url"),this.url=n}}const Ua="freighter",Wv=r=>{if(r.type!==$i)return null;if(r instanceof Vs)return{type:Ua,data:"EOF"};if(r instanceof ki)return{type:Ua,data:"StreamClosed"};if(r instanceof Ks)return{type:Ua,data:"Unreachable"};throw new Error(`Unknown error type: ${r.type}: ${r.message}`)},qv=r=>{if(r.type!==Ua)return null;switch(r.data){case"EOF":return new Vs;case"StreamClosed":return new ki;case"Unreachable":return new Ks;default:throw new Error(`Unknown error type: ${r.data}`)}};Kd({encode:Wv,decode:qv});class Fd{constructor(){Fe(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 Wd="Content-Type",Cu=r=>{if(Td.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 Yv extends Fd{constructor(e,t,n=!1){return super(),Fe(this,"endpoint"),Fe(this,"encoder"),Fe(this,"fetch"),this.endpoint=e.replace({protocol:n?"https":"http"}),this.encoder=t,this.fetch=Cu(this.endpoint.protocol),new Proxy(this,{get:(s,a,i)=>a==="endpoint"?this.endpoint:Reflect.get(s,a,i)})}get headers(){return{[Wd]:this.encoder.contentType}}async send(e,t,n){let s=null;const a=this.endpoint.child(e),i={};i.method="POST",i.body=this.encoder.encode(t??{});const[,o]=await this.executeMiddleware({target:a.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async c=>{const d={...c,params:{}};i.headers={...this.headers,...c.params};let w;try{w=await Cu(c.protocol)(c.target,i)}catch(X){let Q=X;return Q.message==="Load failed"&&(Q=new Ks({url:a})),[d,Q]}const D=await w.arrayBuffer();if(w!=null&&w.ok)return n!=null&&(s=this.encoder.decode(D,n)),[d,null];try{if(w.status!==400)return[d,new Error(w.statusText)];const X=this.encoder.decode(D,ta),Q=Oc(X);return[d,Q]}catch(X){return[d,new Error(`[freighter] - failed to decode error: ${w.statusText}: ${X.message}`)]}});return[s,o]}}const _e=async(r,e,t,n)=>{const[s,a]=await r.send(e,t,n);if(a!=null)throw a;return s},Jv=()=>Td.RUNTIME!=="node"?r=>new WebSocket(r):r=>new(require("ws")).WebSocket(r,{rejectUnauthorized:!1}),Gv=gr.object({type:gr.union([gr.literal("data"),gr.literal("close")]),payload:gr.unknown().optional(),error:gr.optional(ta)});class Hv{constructor(e,t,n,s){Fe(this,"encoder"),Fe(this,"reqSchema"),Fe(this,"resSchema"),Fe(this,"ws"),Fe(this,"serverClosed"),Fe(this,"sendClosed"),Fe(this,"receiveDataQueue",[]),Fe(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 Vs;if(this.sendClosed)throw new ki;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=Oc(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(){return this.receiveDataQueue.shift()??await new Promise((t,n)=>this.receiveCallbacksQueue.push({resolve:t,reject:n}))}listenForMessages(){this.ws.onmessage=e=>{const t=this.encoder.decode(e.data,Gv),n=this.receiveCallbacksQueue.shift();n!=null?n.resolve(t):this.receiveDataQueue.push(t)},this.ws.onclose=e=>{this.serverClosed=rw(e)?new Vs:new ki}}}const Xv="freighterctx",Qv=1e3,ew=1001,tw=[Qv,ew],rw=r=>tw.includes(r.code),qd=class Yd extends Fd{constructor(e,t,n=!1){super(),Fe(this,"baseUrl"),Fe(this,"encoder"),this.baseUrl=e.replace({protocol:n?"wss":"ws"}),this.encoder=t}async stream(e,t,n){const s=Jv();let a;const[,i]=await this.executeMiddleware({target:e,protocol:"websocket",params:{},role:"client"},async o=>{const c=s(this.buildURL(e,o)),d={...o,params:{}};c.binaryType=Yd.MESSAGE_TYPE;const w=await this.wrapSocket(c,t,n);return w instanceof Error?[d,w]:(a=w,[d,null])});if(i!=null)throw i;return a}buildURL(e,t){const n=_g({[Wd]:this.encoder.contentType,...t.params},Xv);return this.baseUrl.child(e).toString()+n}async wrapSocket(e,t,n){return await new Promise(s=>{e.onopen=()=>{s(new Hv(e,this.encoder,t,n))},e.onerror=a=>{const i=a;s(new Error(i.message))}})}};Fe(qd,"MESSAGE_TYPE","arraybuffer");let nw=qd;const yr="sy.api.";var Er=(r=>(r.General=yr+"general",r.Parse=yr+"parse",r.Auth=yr+"auth",r.Unexpected=yr+"unexpected",r.Validation=yr+"validation",r.Query=yr+"query",r.Route=yr+"route",r))(Er||{});class qr extends ea{constructor(e){super(e,yr)}}class Pr extends qr{constructor(t){var e=(...q0)=>(super(...q0),h(this,"fields"),this);typeof t=="string"?(e(t),this.fields=[]):Array.isArray(t)?(e(t.map(n=>`${n.field}: ${n.message}`).join(`
|
|
8
8
|
`)),this.fields=t):(e(`${t.field}: ${t.message}`),this.fields=[t])}}class Jd extends qr{}class Gd extends qr{}class Sc extends qr{}class mn extends qr{constructor(e){super(`
|
|
9
9
|
Unexpected error encountered:
|
|
10
10
|
|