@synnaxlabs/drift 0.42.1 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -56
- package/dist/electron.cjs +1 -1
- package/dist/electron.js +9 -10
- package/dist/index.cjs +1 -1
- package/dist/index.js +219 -161
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/{selectors--wDYbFAe.js → selectors-CzAkOydY.js} +1 -1
- package/dist/selectors-DrXQNVVN.cjs +1 -0
- package/dist/src/external.d.ts +3 -3
- package/dist/src/external.d.ts.map +1 -1
- package/dist/src/{noop/index.d.ts → noop.d.ts} +13 -9
- package/dist/src/noop.d.ts.map +1 -0
- package/dist/src/runtime.d.ts.map +1 -1
- package/dist/src/sync.d.ts.map +1 -1
- package/dist/src/window.d.ts +6 -6
- package/dist/src/window.d.ts.map +1 -1
- package/dist/state-BGByXBtX.cjs +61 -0
- package/dist/state-C1PObbun.js +13735 -0
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +33 -34
- package/package.json +15 -19
- package/dist/noop.cjs +0 -1
- package/dist/noop.js +0 -68
- package/dist/selectors-jksTA_U1.cjs +0 -1
- package/dist/src/noop/index.d.ts.map +0 -1
- package/dist/state-BOplmOQD.js +0 -406
- package/dist/state-Cl8us-b9.cjs +0 -1
- package/dist/window-BIbHrbtA.js +0 -8619
- package/dist/window-DLsE0-fP.cjs +0 -41
package/dist/window-DLsE0-fP.cjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";const Xc=t=>{const e=t.replace(/_[a-z]/g,n=>n[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},lo=t=>{const e=(n,r=On)=>{if(typeof n=="string")return t(n);if(Array.isArray(n))return n.map(s=>e(s,r));if(!xn(n))return n;r=el(r);const i={},o=n;return Object.keys(o).forEach(s=>{let a=o[s];const l=t(s);r.recursive&&(xn(a)?Ui(a,r.keepTypesOnRecursion)||(a=e(a,r)):r.recursiveInArray&&Ei(a)&&(a=[...a].map(u=>{let h=u;return xn(u)?Ui(h,r.keepTypesOnRecursion)||(h=e(u,r)):Ei(u)&&(h=e({key:u},r).key),h}))),i[l]=a}),i};return e},Yn=lo(Xc),Qc=t=>t.replace(/([a-z0-9])([A-Z])/g,(e,n,r)=>`${n}_${r.toLowerCase()}`),ho=lo(Qc),On={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},el=(t=On)=>(t.recursive==null?t=On:t.recursiveInArray??(t.recursiveInArray=!1),t),Ei=t=>t!=null&&Array.isArray(t),xn=t=>t!=null&&typeof t=="object"&&!Array.isArray(t),Ui=(t,e)=>(e||[]).some(n=>t instanceof n),Xt=t=>t!=null&&typeof t=="object"&&!Array.isArray(t);var tl=Object.defineProperty,nl=(t,e,n)=>e in t?tl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Le=(t,e,n)=>nl(t,typeof e!="symbol"?e+"":e,n);function rl(t){const e=t.length;let n=0,r=0;for(;r<e;){let i=t.charCodeAt(r++);if((i&4294967168)===0){n++;continue}else if((i&4294965248)===0)n+=2;else{if(i>=55296&&i<=56319&&r<e){const o=t.charCodeAt(r);(o&64512)===56320&&(++r,i=((i&1023)<<10)+(o&1023)+65536)}(i&4294901760)===0?n+=3:n+=4}}return n}function il(t,e,n){const r=t.length;let i=n,o=0;for(;o<r;){let s=t.charCodeAt(o++);if((s&4294967168)===0){e[i++]=s;continue}else if((s&4294965248)===0)e[i++]=s>>6&31|192;else{if(s>=55296&&s<=56319&&o<r){const a=t.charCodeAt(o);(a&64512)===56320&&(++o,s=((s&1023)<<10)+(a&1023)+65536)}(s&4294901760)===0?(e[i++]=s>>12&15|224,e[i++]=s>>6&63|128):(e[i++]=s>>18&7|240,e[i++]=s>>12&63|128,e[i++]=s>>6&63|128)}e[i++]=s&63|128}}const ol=new TextEncoder,sl=50;function al(t,e,n){ol.encodeInto(t,e.subarray(n))}function ul(t,e,n){t.length>sl?al(t,e,n):il(t,e,n)}const cl=4096;function fo(t,e,n){let r=e;const i=r+n,o=[];let s="";for(;r<i;){const a=t[r++];if((a&128)===0)o.push(a);else if((a&224)===192){const l=t[r++]&63;o.push((a&31)<<6|l)}else if((a&240)===224){const l=t[r++]&63,u=t[r++]&63;o.push((a&31)<<12|l<<6|u)}else if((a&248)===240){const l=t[r++]&63,u=t[r++]&63,h=t[r++]&63;let d=(a&7)<<18|l<<12|u<<6|h;d>65535&&(d-=65536,o.push(d>>>10&1023|55296),d=56320|d&1023),o.push(d)}else o.push(a);o.length>=cl&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}const ll=new TextDecoder,hl=200;function dl(t,e,n){const r=t.subarray(e,e+n);return ll.decode(r)}function fl(t,e,n){return n>hl?dl(t,e,n):fo(t,e,n)}let At=class{constructor(e,n){this.type=e,this.data=n}},oe=class Tn extends Error{constructor(e){super(e);const n=Object.create(Tn.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Tn.name})}};const Qe=4294967295;function pl(t,e,n){const r=n/4294967296,i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function po(t,e,n){const r=Math.floor(n/4294967296),i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function mo(t,e){const n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}function ml(t,e){const n=t.getUint32(e),r=t.getUint32(e+4);return n*4294967296+r}const gl=-1,yl=4294967296-1,wl=17179869184-1;function vl({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=wl)if(e===0&&t<=yl){const n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t),n}else{const n=t/4294967296,r=t&4294967295,i=new Uint8Array(8),o=new DataView(i.buffer);return o.setUint32(0,e<<2|n&3),o.setUint32(4,r),i}else{const n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,e),po(r,4,t),n}}function bl(t){const e=t.getTime(),n=Math.floor(e/1e3),r=(e-n*1e3)*1e6,i=Math.floor(r/1e9);return{sec:n+i,nsec:r-i*1e9}}function _l(t){if(t instanceof Date){const e=bl(t);return vl(e)}else return null}function $l(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const n=e.getUint32(0),r=e.getUint32(4),i=(n&3)*4294967296+r,o=n>>>2;return{sec:i,nsec:o}}case 12:{const n=mo(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new oe(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function Il(t){const e=$l(t);return new Date(e.sec*1e3+e.nsec/1e6)}const xl={type:gl,encode:_l,decode:Il};let pt=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(xl)}register({type:e,encode:n,decode:r}){if(e>=0)this.encoders[e]=n,this.decoders[e]=r;else{const i=-1-e;this.builtInEncoders[i]=n,this.builtInDecoders[i]=r}}tryToEncode(e,n){for(let r=0;r<this.builtInEncoders.length;r++){const i=this.builtInEncoders[r];if(i!=null){const o=i(e,n);if(o!=null){const s=-1-r;return new At(s,o)}}}for(let r=0;r<this.encoders.length;r++){const i=this.encoders[r];if(i!=null){const o=i(e,n);if(o!=null){const s=r;return new At(s,o)}}}return e instanceof At?e:null}decode(e,n,r){const i=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return i?i(e,n,r):new At(n,e)}};pt.defaultCodec=new pt;function zl(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function kn(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):zl(t)?new Uint8Array(t):Uint8Array.from(t)}const Sl=100,Ol=2048;let Tl=class go{constructor(e){this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??pt.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.maxDepth=(e==null?void 0:e.maxDepth)??Sl,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??Ol,this.sortKeys=(e==null?void 0:e.sortKeys)??!1,this.forceFloat32=(e==null?void 0:e.forceFloat32)??!1,this.ignoreUndefined=(e==null?void 0:e.ignoreUndefined)??!1,this.forceIntegerToFloat=(e==null?void 0:e.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new go({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,n){if(n>this.maxDepth)throw new Error(`Too deep objects in depth ${n}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,n)}ensureBufferSizeToWrite(e){const n=this.pos+e;this.view.byteLength<n&&this.resizeBuffer(n*2)}resizeBuffer(e){const n=new ArrayBuffer(e),r=new Uint8Array(n),i=new DataView(n);r.set(this.bytes),this.view=i,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){const n=rl(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),ul(e,this.bytes,this.pos),this.pos+=n}encodeObject(e,n){const r=this.extensionCodec.tryToEncode(e,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,n);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,n);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){const n=e.byteLength;if(n<256)this.writeU8(196),this.writeU8(n);else if(n<65536)this.writeU8(197),this.writeU16(n);else if(n<4294967296)this.writeU8(198),this.writeU32(n);else throw new Error(`Too large binary: ${n}`);const r=kn(e);this.writeU8a(r)}encodeArray(e,n){const r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const i of e)this.doEncode(i,n+1)}countWithoutUndefined(e,n){let r=0;for(const i of n)e[i]!==void 0&&r++;return r}encodeMap(e,n){const r=Object.keys(e);this.sortKeys&&r.sort();const i=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(`Too large map object: ${i}`);for(const o of r){const s=e[o];this.ignoreUndefined&&s===void 0||(this.encodeString(o),this.doEncode(s,n+1))}}encodeExtension(e){if(typeof e.data=="function"){const r=e.data(this.pos+6),i=r.length;if(i>=4294967296)throw new Error(`Too large extension object: ${i}`);this.writeU8(201),this.writeU32(i),this.writeI8(e.type),this.writeU8a(r);return}const n=e.data.length;if(n===1)this.writeU8(212);else if(n===2)this.writeU8(213);else if(n===4)this.writeU8(214);else if(n===8)this.writeU8(215);else if(n===16)this.writeU8(216);else if(n<256)this.writeU8(199),this.writeU8(n);else if(n<65536)this.writeU8(200),this.writeU16(n);else if(n<4294967296)this.writeU8(201),this.writeU32(n);else throw new Error(`Too large extension object: ${n}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const n=e.length;this.ensureBufferSizeToWrite(n),this.bytes.set(e,this.pos),this.pos+=n}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),pl(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),po(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}};function nt(t,e){return new Tl(e).encodeSharedRef(t)}function zn(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}const kl=16,Nl=16;class El{constructor(e=kl,n=Nl){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=n,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,n,r){const i=this.caches[r-1];e:for(const o of i){const s=o.bytes;for(let a=0;a<r;a++)if(s[a]!==e[n+a])continue e;return o.str}return null}store(e,n){const r=this.caches[e.length-1],i={bytes:e,str:n};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=i:r.push(i)}decode(e,n,r){const i=this.find(e,n,r);if(i!=null)return this.hit++,i;this.miss++;const o=fo(e,n,r),s=Uint8Array.prototype.slice.call(e,n,n+r);return this.store(s,o),o}}const Nn="array",dt="map_key",yo="map_value",Ul=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new oe("The type of key must be string or number but "+typeof t)};class Al{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const n=this.getUninitializedStateFromPool();n.type=Nn,n.position=0,n.size=e,n.array=new Array(e)}pushMapState(e){const n=this.getUninitializedStateFromPool();n.type=dt,n.readCount=0,n.size=e,n.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===Nn){const n=e;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(e.type===dt||e.type===yo){const n=e;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const et=-1,Jn=new DataView(new ArrayBuffer(0)),Zl=new Uint8Array(Jn.buffer);try{Jn.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const Ai=new RangeError("Insufficient data"),Bl=new El;let Dl=class wo{constructor(e){this.totalPos=0,this.pos=0,this.view=Jn,this.bytes=Zl,this.headByte=et,this.stack=new Al,this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??pt.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.rawStrings=(e==null?void 0:e.rawStrings)??!1,this.maxStrLength=(e==null?void 0:e.maxStrLength)??Qe,this.maxBinLength=(e==null?void 0:e.maxBinLength)??Qe,this.maxArrayLength=(e==null?void 0:e.maxArrayLength)??Qe,this.maxMapLength=(e==null?void 0:e.maxMapLength)??Qe,this.maxExtLength=(e==null?void 0:e.maxExtLength)??Qe,this.keyDecoder=(e==null?void 0:e.keyDecoder)!==void 0?e.keyDecoder:Bl,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??Ul}clone(){return new wo({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=et,this.stack.reset()}setBuffer(e){const n=kn(e);this.bytes=n,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===et&&!this.hasRemaining(1))this.setBuffer(e);else{const n=this.bytes.subarray(this.pos),r=kn(e),i=new Uint8Array(n.length+r.length);i.set(n),i.set(r,n.length),this.setBuffer(i)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:n,pos:r}=this;return new RangeError(`Extra ${n.byteLength-r} of ${n.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const n=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return n}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let n=!1,r;for await(const a of e){if(n)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{r=this.doDecodeSync(),n=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(n){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}const{headByte:i,pos:o,totalPos:s}=this;throw new RangeError(`Insufficient data in parsing ${zn(i)} at ${s} (${o} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,n){if(this.entered){yield*this.clone().decodeMultiAsync(e,n);return}try{this.entered=!0;let r=n,i=-1;for await(const o of e){if(n&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),r&&(i=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(s){if(!(s instanceof RangeError))throw s}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let n;if(e>=224)n=e-256;else if(e<192)if(e<128)n=e;else if(e<144){const i=e-128;if(i!==0){this.pushMapState(i),this.complete();continue e}else n={}}else if(e<160){const i=e-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else n=[]}else{const i=e-160;n=this.decodeString(i,0)}else if(e===192)n=null;else if(e===194)n=!1;else if(e===195)n=!0;else if(e===202)n=this.readF32();else if(e===203)n=this.readF64();else if(e===204)n=this.readU8();else if(e===205)n=this.readU16();else if(e===206)n=this.readU32();else if(e===207)this.useBigInt64?n=this.readU64AsBigInt():n=this.readU64();else if(e===208)n=this.readI8();else if(e===209)n=this.readI16();else if(e===210)n=this.readI32();else if(e===211)this.useBigInt64?n=this.readI64AsBigInt():n=this.readI64();else if(e===217){const i=this.lookU8();n=this.decodeString(i,1)}else if(e===218){const i=this.lookU16();n=this.decodeString(i,2)}else if(e===219){const i=this.lookU32();n=this.decodeString(i,4)}else if(e===220){const i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else n=[]}else if(e===221){const i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue e}else n=[]}else if(e===222){const i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else n={}}else if(e===223){const i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else n={}}else if(e===196){const i=this.lookU8();n=this.decodeBinary(i,1)}else if(e===197){const i=this.lookU16();n=this.decodeBinary(i,2)}else if(e===198){const i=this.lookU32();n=this.decodeBinary(i,4)}else if(e===212)n=this.decodeExtension(1,0);else if(e===213)n=this.decodeExtension(2,0);else if(e===214)n=this.decodeExtension(4,0);else if(e===215)n=this.decodeExtension(8,0);else if(e===216)n=this.decodeExtension(16,0);else if(e===199){const i=this.lookU8();n=this.decodeExtension(i,1)}else if(e===200){const i=this.lookU16();n=this.decodeExtension(i,2)}else if(e===201){const i=this.lookU32();n=this.decodeExtension(i,4)}else throw new oe(`Unrecognized type byte: ${zn(e)}`);this.complete();const r=this.stack;for(;r.length>0;){const i=r.top();if(i.type===Nn)if(i.array[i.position]=n,i.position++,i.position===i.size)n=i.array,r.release(i);else continue e;else if(i.type===dt){if(n==="__proto__")throw new oe("The key __proto__ is not allowed");i.key=this.mapKeyConverter(n),i.type=yo;continue e}else if(i.map[i.key]=n,i.readCount++,i.readCount===i.size)n=i.map,r.release(i);else{i.key=null,i.type=dt;continue e}}return n}}readHeadByte(){return this.headByte===et&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=et}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new oe(`Unrecognized array type byte: ${zn(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new oe(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new oe(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,n){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,n):this.decodeBinary(e,n)}decodeUtf8String(e,n){var r;if(e>this.maxStrLength)throw new oe(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+n+e)throw Ai;const i=this.pos+n;let o;return this.stateIsMapKey()&&(r=this.keyDecoder)!=null&&r.canBeCached(e)?o=this.keyDecoder.decode(this.bytes,i,e):o=fl(this.bytes,i,e),this.pos+=n+e,o}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===dt:!1}decodeBinary(e,n){if(e>this.maxBinLength)throw new oe(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+n))throw Ai;const r=this.pos+n,i=this.bytes.subarray(r,r+e);return this.pos+=n+e,i}decodeExtension(e,n){if(e>this.maxExtLength)throw new oe(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+n),i=this.decodeBinary(e,n+1);return this.extensionCodec.decode(i,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=ml(this.view,this.pos);return this.pos+=8,e}readI64(){const e=mo(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}};function vo(t,e){return new Dl(e).decode(t)}let Ml=class{constructor(){Le(this,"contentType","application/json"),Le(this,"decoder"),Le(this,"encoder"),this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(e){return this.encoder.encode(this.encodeString(e))}decode(e,n){return this.decodeString(this.decoder.decode(e),n)}decodeString(e,n){const r=JSON.parse(e),i=Yn(r);return n!=null?n.parse(i):i}encodeString(e){const n=ho(e);return JSON.stringify(n,(r,i)=>ArrayBuffer.isView(i)?Array.from(i):Xt(i)&&"encode_value"in i?typeof i.value=="bigint"?i.value.toString():i.value:typeof i=="bigint"?i.toString():i)}static registerCustomType(){}},Pl=class{constructor(){Le(this,"contentType","text/csv")}encode(e){const n=this.encodeString(e);return new TextEncoder().encode(n)}decode(e,n){const r=new TextDecoder().decode(e);return this.decodeString(r,n)}encodeString(e){if(!Array.isArray(e)||e.length===0||!Xt(e[0]))throw new Error("Payload must be an array of objects");const n=Object.keys(e[0]),r=[n.join(",")];return e.forEach(i=>{const o=n.map(s=>JSON.stringify(i[s]??""));r.push(o.join(","))}),r.join(`
|
|
2
|
-
`)}decodeString(e,n){const[r,...i]=e.trim().split(`
|
|
3
|
-
`).map(a=>a.trim());if(r.length===0)return n!=null?n.parse({}):{};const o=r.split(",").map(a=>a.trim()),s={};return o.forEach(a=>{s[a]=[]}),i.forEach(a=>{const l=a.split(",").map(u=>u.trim());o.forEach((u,h)=>{const d=this.parseValue(l[h]);d!=null&&s[u].push(d)})}),n!=null?n.parse(s):s}parseValue(e){if(e==null||e.length===0)return null;const n=Number(e);return isNaN(n)?e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e:n}static registerCustomType(){}},jl=class{constructor(){Le(this,"contentType","text/plain")}encode(e){return new TextEncoder().encode(e)}decode(e,n){const r=new TextDecoder().decode(e);return n!=null?n.parse(r):r}};const ye=new pt;ye.register({type:0,encode:t=>{if(ArrayBuffer.isView(t)){const e=Array.from(t);return nt(e,{extensionCodec:ye})}return Xt(t)&&"encode_value"in t?typeof t.value=="bigint"?nt(t.value.toString(),{extensionCodec:ye}):nt(t.value,{extensionCodec:ye}):typeof t=="bigint"?nt(t.toString(),{extensionCodec:ye}):null},decode:t=>vo(t,{extensionCodec:ye})});let Rl=class{constructor(){Le(this,"contentType","application/msgpack")}encode(e){const n=ho(e);return nt(n,{extensionCodec:ye}).slice()}decode(e,n){const r=vo(e,{extensionCodec:ye}),i=Yn(r);return n!=null?n.parse(i):i}static registerCustomType(){}};const Pt=new Ml;new Pl;new jl;new Rl;function c(t,e){class n{constructor(i){var o;const s=this;n.init(s,i),(o=s._zod).deferred??(o.deferred=[]);for(const a of s._zod.deferred)a()}static init(i,o){var s;i._zod??(i._zod={}),(s=i._zod).traits??(s.traits=new Set),i._zod.traits.add(t),e(i,o);for(const a in n.prototype)Object.defineProperty(i,a,{value:n.prototype[a].bind(i)});i._zod.constr=n,i._zod.def=o}static[Symbol.hasInstance](i){var o,s;return(s=(o=i==null?void 0:i._zod)==null?void 0:o.traits)==null?void 0:s.has(t)}}return Object.defineProperty(n,"name",{value:t}),n}const bo=Symbol("zod_brand");class Ve extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const En={};function V(t){return t&&Object.assign(En,t),En}function Cl(t){return t}function Ll(t){return t}function Fl(t){}function Wl(t){throw new Error}function ql(t){}function Vl(t){const e=Object.keys(t).filter(r=>typeof t[t[r]]!="number"),n={};for(const r of e)n[r]=t[r];return Object.values(n)}function Ee(t,e="|"){return t.map(n=>$t(n)).join(e)}function _o(t,e){return typeof e=="bigint"?e.toString():e}function pe(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Be(t){return t==null}function Qt(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function $o(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function le(t,e,n){Object.defineProperty(t,e,{get(){{const r=n();return t[e]=r,r}},set(r){Object.defineProperty(t,e,{value:r})},configurable:!0})}function ae(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Yl(t,e){return e?e.reduce((n,r)=>n==null?void 0:n[r],t):t}function Jl(t){const e=Object.keys(t),n=e.map(r=>t[r]);return Promise.all(n).then(r=>{const i={};for(let o=0;o<e.length;o++)i[e[o]]=r[o];return i})}function Kn(t=10){const e="abcdefghijklmnopqrstuvwxyz";let n="";for(let r=0;r<t;r++)n+=e[Math.floor(Math.random()*e.length)];return n}function Ce(t){return JSON.stringify(t)}function Gn(t){return typeof t=="object"&&t!==null}const Io=pe(()=>{try{return new Function(""),!0}catch{return!1}});function Ft(t){return typeof t=="object"&&t!==null&&Object.getPrototypeOf(t)===Object.prototype}function Kl(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}const Gl=t=>{const e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Wt=new Set(["string","number","symbol"]),xo=new Set(["string","number","bigint","boolean","symbol","undefined"]);function _e(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ne(t,e){const n=new t._zod.constr(e??t._zod.def);return e||(n._zod.parent=t),n}function Hl(t,e){const n=Array.isArray(t)?{}:t??{};return{checks:Array.isArray(t)?t:e??[],params:n}}function f(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Xl(t){let e;return new Proxy({},{get(n,r,i){return e??(e=t()),Reflect.get(e,r,i)},set(n,r,i,o){return e??(e=t()),Reflect.set(e,r,i,o)},has(n,r){return e??(e=t()),Reflect.has(e,r)},deleteProperty(n,r){return e??(e=t()),Reflect.deleteProperty(e,r)},ownKeys(n){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(n,r){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,r)},defineProperty(n,r,i){return e??(e=t()),Reflect.defineProperty(e,r,i)}})}function $t(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function De(t){return Object.keys(t).filter(e=>t[e]._zod.qout==="true")}function Ql(t){return Object.keys(t).filter(e=>e.endsWith("?")).map(e=>e.replace(/\?$/,""))}function zo(t){return t.replace(/^\?/,"").replace(/\?$/,"")}function ze(t){const e={},n={},r=[],i=[];for(const[o,s]of Object.entries(t)){o.endsWith("?")&&r.push(o.slice(0,-1)),o.startsWith("?")&&i.push(o.slice(1));const a=zo(o);n[a]=s,e[a]=o}return{shape:n,keyMap:e,optional:r,defaulted:i}}const So={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Oo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function en(t,e){const n={},r=[],i=t._zod.def.shape,o=new Set(t._zod.def.optional);for(const s in e){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(n[s]=i[s],o.has(s)&&r.push(s))}return ne(t,{...t._zod.def,shape:n,optional:r,checks:[]})}function tn(t,e){const n={...t._zod.def.shape},r=new Set(t._zod.def.optional);for(const i in e){if(!(i in t._zod.def.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&(delete n[i],r.delete(i))}return ne(t,{...t._zod.def,shape:n,optional:[...r],checks:[]})}function To(t,e){const n={...t._zod.def,get shape(){const r={...t._zod.def.shape,...e};return ae(this,"shape",r),r},checks:[]};return le(n,"shape",()=>({...t._zod.def.shape,...e})),ne(t,n)}function Oe(t,e){const n=new Set(Object.keys(e._zod.def.shape)),r=[...t._zod.def.optional.filter(i=>!n.has(i)),...e._zod.def.optional];return ne(t,{...t._zod.def,get shape(){const i={...t._zod.def.shape,...e._zod.def.shape};return ae(this,"shape",i),i},optional:r,catchall:e._zod.def.catchall,checks:[]})}function mt(t,e){const n=new Set(Object.keys(e._zod.def.shape)),r=[...t._zod.def.optional.filter(i=>!n.has(i)),...e._zod.def.optional];return ne(t,{...t._zod.def,get shape(){const i={...t._zod.def.shape,...e._zod.def.shape};return ae(this,"shape",i),i},optional:r,checks:[]})}function nn(t,e,n){const r={...e._zod.def.shape},i=new Set(e._zod.def.optional);if(n)for(const o in n){if(!(o in r))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(r[o]=new t({type:"optional",innerType:e._zod.def.shape[o]}),i.add(o))}else for(const o in e._zod.def.shape)r[o]=new t({type:"optional",innerType:e._zod.def.shape[o]}),i.add(o);return ne(e,{...e._zod.def,shape:r,optional:[...i],checks:[]})}function rn(t,e,n){const r={...e._zod.def.shape};if(n)for(const i in n){if(!(i in r))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(r[i]=new t({type:"nonoptional",innerType:e._zod.def.shape[i]}))}else for(const i in e._zod.def.shape)r[i]=new t({type:"nonoptional",innerType:e._zod.def.shape[i]});return ne(e,{...e._zod.def,shape:r,optional:[],checks:[]})}function eh(t){if(t.type==="interface"){const e=Object.keys(t.shape),n=new Set(Object.keys(t.shape));return{shape:{...t.shape},keys:e,keySet:n,numKeys:e.length,optionalKeys:new Set(t.optional)}}if(t.type==="object"){const e=Object.keys(t.shape),n=new Set(Object.keys(t.shape));return{shape:{...t.shape},keys:e,keySet:n,numKeys:e.length,optionalKeys:new Set(t.optional)}}throw new Error("Invalid object-like type")}function Fe(t,e=0){for(let n=e;n<t.issues.length;n++)if(t.issues[n].continue!==!0)return!0;return!1}function X(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function rt(t){return typeof t=="string"?t:t==null?void 0:t.message}function H(t,e,n){var i,o,s,a,l,u;const r={...t,path:t.path??[]};if(!t.message){const h=rt((s=(o=(i=t.inst)==null?void 0:i._zod.def)==null?void 0:o.error)==null?void 0:s.call(o,t))??rt((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??rt((l=n.customError)==null?void 0:l.call(n,t))??rt((u=n.localeError)==null?void 0:u.call(n,t))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function on(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function sn(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Ye(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const th=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:Oo,NUMBER_FORMAT_RANGES:So,aborted:Fe,allowsEval:Io,assert:ql,assertEqual:Cl,assertIs:Fl,assertNever:Wl,assertNotEqual:Ll,assignProp:ae,cached:pe,cleanInterfaceKey:zo,cleanInterfaceShape:ze,cleanRegex:Qt,clone:ne,createTransparentProxy:Xl,defineLazy:le,esc:Ce,escapeRegex:_e,extend:To,extendObjectLike:mt,finalizeIssue:H,floatSafeRemainder:$o,getElementAtPath:Yl,getLengthableOrigin:sn,getParsedType:Gl,getSizableOrigin:on,getValidEnumValues:Vl,isObject:Gn,isPlainObject:Ft,issue:Ye,joinValues:Ee,jsonStringifyReplacer:_o,mergeObjectLike:Oe,normalizeObjectLikeDef:eh,normalizeParams:f,nullish:Be,numKeys:Kl,omit:tn,optionalInterfaceKeys:Ql,optionalObjectKeys:De,partialObjectLike:nn,pick:en,prefixIssues:X,primitiveTypes:xo,promiseAllObject:Jl,propertyKeyTypes:Wt,randomString:Kn,requiredObjectLike:rn,splitChecksAndParams:Hl,stringifyPrimitive:$t,unwrapMessage:rt},Symbol.toStringTag,{value:"Module"})),Zi=Symbol.for("{{zod.error}}");class ue{get message(){return JSON.stringify(this.issues,_o,2)}constructor(e){Object.defineProperty(this,"_tag",{value:Zi,enumerable:!1}),Object.defineProperty(this,"name",{value:"$ZodError",enumerable:!1}),this.issues=e}static[Symbol.hasInstance](e){return(e==null?void 0:e._tag)===Zi}}function ko(t,e=n=>n.message){const n={},r=[];for(const i of t.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}function No(t,e){const n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.errors.map(a=>i({issues:a}));else if(s.code==="invalid_key")i({issues:s.issues});else if(s.code==="invalid_element")i({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const u=s.path[l];l===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(s))):a[u]=a[u]||{_errors:[]},a=a[u],l++}}};return i(t),r}function Eo(t,e){const n=e||function(o){return o.message},r={errors:[]},i=o=>{var s,a;for(const l of o.issues)if(l.code==="invalid_union")l.errors.map(u=>i({issues:u}));else if(l.code==="invalid_key")i({issues:l.issues});else if(l.code==="invalid_element")i({issues:l.issues});else if(l.path.length===0)r.errors.push(n(l));else{let u=r,h=0;for(;h<l.path.length;){const d=l.path[h],y=h===l.path.length-1;typeof d=="string"?(u.properties??(u.properties={}),(s=u.properties)[d]??(s[d]={errors:[]}),u=u.properties[d]):(u.items??(u.items=[]),(a=u.items)[d]??(a[d]={errors:[]}),u=u.items[d]),y&&u.errors.push(n(l)),h++}}};return i(t),r}function Uo(t){const e=[];for(const n of t)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`["${String(n)}"]`):n.includes(".")?e.push(`["${n}"]`):(e.length&&e.push("."),e.push(n));return e.join("")}function Ao(t){var r;const e=[],n=[...t.issues].sort((i,o)=>i.path.length-o.path.length);for(const i of n)e.push(`✖ ${i.message}`),(r=i.path)!=null&&r.length&&e.push(` → at ${Uo(i.path)}`);return e.join(`
|
|
4
|
-
`)}function Hn(t,e,n){const r=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:e,issues:[]},r);if(i instanceof Promise)throw new Ve;if(i.issues.length)throw new((this==null?void 0:this.Error)??ue)(i.issues.map(o=>H(o,r,V())));return i.value}const Un=Hn.bind({Error:ue});function Xn(t,e,n){const r=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:e,issues:[]},r);if(i instanceof Promise)throw new Ve;return i.issues.length?{success:!1,error:new((this==null?void 0:this.Error)??ue)(i.issues.map(o=>H(o,r,V())))}:{success:!0,data:i.value}}const nh=Xn.bind({Error:ue});async function Qn(t,e,n){const r=n?{...n,async:!0}:{async:!0};let i=t._zod.run({value:e,issues:[]},r);if(i instanceof Promise&&(i=await i),i.issues.length)throw new((this==null?void 0:this.Error)??ue)(i.issues.map(o=>H(o,r,V())));return i.value}const An=Qn.bind({Error:ue});async function er(t,e,n){const r=n?{...n,async:!0}:{async:!0};let i=t._zod.run({value:e,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new((this==null?void 0:this.Error)??ue)(i.issues.map(o=>H(o,r,V())))}:{success:!0,data:i.value}}const rh=er.bind({Error:ue}),Zo=/^[cC][^\s-]{8,}$/,Bo=/^[0-9a-z]+$/,Do=/^[0-9A-HJKMNP-TV-Z]{26}$/,Mo=/^[0-9a-vA-V]{20}$/,Po=/^[A-Za-z0-9]{27}$/,jo=/^[a-zA-Z0-9_-]{21}$/,Ro=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ih=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Co=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Je=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,oh=Je(4),sh=Je(6),ah=Je(7),Lo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,uh=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ch=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,lh=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,hh=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Fo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Wo(){return new RegExp(Fo,"u")}const tr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,qo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Vo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dh=new RegExp(`(${tr.source})|(${nr.source})`),Yo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Jo=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zn=/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/,Ko=/^\+(?:[0-9]){6,14}[0-9]$/,Go="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ho=new RegExp(`^${Go}$`);function Xo(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Qo(t){return new RegExp(`^${Xo(t)}$`)}function es(t){let e=`${Go}T${Xo(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}const ts=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},ns=/^\d+n?$/,rs=/^\d+$/,is=/^-?\d+(?:\.\d+)?/i,os=/true|false/i,ss=/null/i,as=/undefined/i,us=/^[^A-Z]*$/,cs=/^[^a-z]*$/,ls=Object.freeze(Object.defineProperty({__proto__:null,_emoji:Fo,base64:Yo,base64url:Jo,bigint:ns,boolean:os,browserEmail:hh,cidrv4:qo,cidrv6:Vo,cuid:Zo,cuid2:Bo,date:Ho,datetime:es,duration:Ro,e164:Ko,email:Lo,emoji:Wo,extendedDuration:ih,guid:Co,hostname:Zn,html5Email:uh,integer:rs,ip:dh,ipv4:tr,ipv6:nr,ksuid:Po,lowercase:us,nanoid:jo,null:ss,number:is,rfc5322Email:ch,string:ts,time:Qo,ulid:Do,undefined:as,unicodeEmail:lh,uppercase:cs,uuid:Je,uuid4:oh,uuid6:sh,uuid7:ah,xid:Mo},Symbol.toStringTag,{value:"Module"})),C=c("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),hs={number:"number",bigint:"bigint",object:"date"},rr=c("$ZodCheckLessThan",(t,e)=>{C.init(t,e);const n=hs[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.computed.maximum??Number.POSITIVE_INFINITY;e.value<i&&(r._zod.computed.maximum=e.value,r._zod.computed.inclusive=e.inclusive)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ir=c("$ZodCheckGreaterThan",(t,e)=>{C.init(t,e);const n=hs[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.computed.minimum??Number.NEGATIVE_INFINITY;e.value>i&&(r._zod.computed.minimum=e.value,r._zod.computed.inclusive=e.inclusive)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ds=c("$ZodCheckMultipleOf",(t,e)=>{C.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.computed).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):$o(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),fs=c("$ZodCheckNumberFormat",(t,e)=>{var s;C.init(t,e),e.format=e.format||"float64";const n=(s=e.format)==null?void 0:s.includes("int"),r=n?"int":"number",[i,o]=So[e.format];t._zod.onattach.push(a=>{a._zod.computed.format=e.format,a._zod.computed.minimum=i,a._zod.computed.maximum=o,a._zod.computed.inclusive=!0,n&&(a._zod.computed.pattern=rs)}),t._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:e.format,code:"invalid_type",input:l,inst:t});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the the safe integer range.",inst:t,origin:r,continue:!e.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort});return}}l<i&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),l>o&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inst:t})}}),ps=c("$ZodCheckBigIntFormat",(t,e)=>{C.init(t,e);const[n,r]=Oo[e.format];t._zod.onattach.push(i=>{i._zod.computed.format=e.format,i._zod.computed.minimum=n,i._zod.computed.maximum=r}),t._zod.check=i=>{const o=i.value;o<n&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),o>r&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:r,inst:t})}}),ms=c("$ZodCheckMaxSize",(t,e)=>{C.init(t,e),t._zod.when=n=>{const r=n.value;return!Be(r)&&r.size!==void 0},t._zod.onattach.push(n=>{const r=n._zod.computed.maximum??Number.POSITIVE_INFINITY;e.maximum<r&&(n._zod.computed.maximum=e.maximum)}),t._zod.check=n=>{const r=n.value;r.size<=e.maximum||n.issues.push({origin:on(r),code:"too_big",maximum:e.maximum,input:r,inst:t,continue:!e.abort})}}),gs=c("$ZodCheckMinSize",(t,e)=>{C.init(t,e),t._zod.when=n=>{const r=n.value;return!Be(r)&&r.size!==void 0},t._zod.onattach.push(n=>{const r=n._zod.computed.minimum??Number.NEGATIVE_INFINITY;e.minimum>r&&(n._zod.computed.minimum=e.minimum)}),t._zod.check=n=>{const r=n.value;r.size>=e.minimum||n.issues.push({origin:on(r),code:"too_small",minimum:e.minimum,input:r,inst:t,continue:!e.abort})}}),ys=c("$ZodCheckSizeEquals",(t,e)=>{C.init(t,e),t._zod.when=n=>{const r=n.value;return!Be(r)&&r.size!==void 0},t._zod.onattach.push(n=>{n._zod.computed.minimum=e.size,n._zod.computed.maximum=e.size,n._zod.computed.size=e.size}),t._zod.check=n=>{const r=n.value,i=r.size;if(i===e.size)return;const o=i>e.size;n.issues.push({origin:on(r),...o?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},input:n.value,inst:t,continue:!e.abort})}}),ws=c("$ZodCheckMaxLength",(t,e)=>{C.init(t,e),t._zod.when=n=>{const r=n.value;return!Be(r)&&r.length!==void 0},t._zod.onattach.push(n=>{const r=n._zod.computed.maximum??Number.POSITIVE_INFINITY;e.maximum<r&&(n._zod.computed.maximum=e.maximum)}),t._zod.check=n=>{const r=n.value;if(r.length<=e.maximum)return;const o=sn(r);n.issues.push({origin:o,code:"too_big",maximum:e.maximum,input:r,inst:t,continue:!e.abort})}}),vs=c("$ZodCheckMinLength",(t,e)=>{C.init(t,e),t._zod.when=n=>{const r=n.value;return!Be(r)&&r.length!==void 0},t._zod.onattach.push(n=>{const r=n._zod.computed.minimum??Number.NEGATIVE_INFINITY;e.minimum>r&&(n._zod.computed.minimum=e.minimum)}),t._zod.check=n=>{const r=n.value;if(r.length>=e.minimum)return;const o=sn(r);n.issues.push({origin:o,code:"too_small",minimum:e.minimum,input:r,inst:t,continue:!e.abort})}}),bs=c("$ZodCheckLengthEquals",(t,e)=>{C.init(t,e),t._zod.when=n=>{const r=n.value;return!Be(r)&&r.length!==void 0},t._zod.onattach.push(n=>{n._zod.computed.minimum=e.length,n._zod.computed.maximum=e.length,n._zod.computed.length=e.length}),t._zod.check=n=>{const r=n.value,i=r.length;if(i===e.length)return;const o=sn(r),s=i>e.length;n.issues.push({origin:o,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},input:n.value,inst:t,continue:!e.abort})}}),It=c("$ZodCheckStringFormat",(t,e)=>{var n;C.init(t,e),t._zod.onattach.push(r=>{r._zod.computed.format=e.format,e.pattern&&(r._zod.computed.pattern=e.pattern)}),(n=t._zod).check??(n.check=r=>{if(!e.pattern)throw new Error("Not implemented.");e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:e.format,input:r.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})})}),_s=c("$ZodCheckRegex",(t,e)=>{It.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),$s=c("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=us),It.init(t,e)}),Is=c("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=cs),It.init(t,e)}),xs=c("$ZodCheckIncludes",(t,e)=>{C.init(t,e);const n=new RegExp(_e(e.includes));e.pattern=n,t._zod.onattach.push(r=>{r._zod.computed.pattern=n}),t._zod.check=r=>{r.value.includes(e.includes,e.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:r.value,inst:t,continue:!e.abort})}}),zs=c("$ZodCheckStartsWith",(t,e)=>{C.init(t,e);const n=new RegExp(`^${_e(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{r._zod.computed.pattern=n}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),Ss=c("$ZodCheckEndsWith",(t,e)=>{C.init(t,e);const n=new RegExp(`.*${_e(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{r._zod.computed.pattern=new RegExp(`.*${_e(e.suffix)}$`)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}});function Bi(t,e,n){t.issues.length&&e.issues.push(...X(n,t.issues))}const Os=c("$ZodCheckProperty",(t,e)=>{C.init(t,e),t._zod.check=n=>{const r=e.schema._zod.run({value:n.value[e.property],issues:[]},{});if(r instanceof Promise)return r.then(i=>Bi(i,n,e.property));Bi(r,n,e.property)}}),Ts=c("$ZodCheckMimeType",(t,e)=>{C.init(t,e);const n=new Set(e.mime);t._zod.onattach.push(r=>{r._zod.computed.mime=e.mime}),t._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:e.mime,input:r.value.type,path:["type"],inst:t})}}),ks=c("$ZodCheckOverwrite",(t,e)=>{C.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class Ns{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
5
|
-
`).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),o=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of o)this.content.push(s)}compile(){const e=this==null?void 0:this.args,r=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new Function(...e,r.join(`
|
|
6
|
-
`))}}const Es={major:0,minor:9,patch:0},b=c("$ZodType",(t,e)=>{var i;var n;t??(t={}),t._zod.id=e.type+"_"+Kn(10),t._zod.def=e,t._zod.computed=t._zod.computed||{},t._zod.version=Es;const r=[...t._zod.def.checks??[]];e.type,t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(const o of r)for(const s of o._zod.onattach)s(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),(i=t._zod.deferred)==null||i.push(()=>{t._zod.run=t._zod.parse});else{const o=(s,a,l)=>{let u=Fe(s),h;for(const d of a){if(d._zod.when){if(!d._zod.when(s))continue}else if(u)continue;const y=s.issues.length,g=d._zod.check(s);if(g instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Ve;if(h||g instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await g,s.issues.length!==y&&(u||(u=Fe(s,y)))});else{if(s.issues.length===y)continue;u||(u=Fe(s,y))}}return h?h.then(()=>s):s};t._zod.run=(s,a)=>{const l=t._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Ve;return l.then(u=>o(u,r,a))}return o(l,r,a)}}t["~standard"]={validate:o=>{const s=t._zod.run({value:o,issues:[]},{});return s instanceof Promise?s.then(({issues:a,value:l})=>a.length===0?{value:l}:{issues:a.map(u=>H(u,{},V()))}):s.issues.length===0?{value:s.value}:{issues:s.issues.map(a=>H(a,{},V()))}},vendor:"zod",version:1}}),or=c("$ZodString",(t,e)=>{var n;b.init(t,e),t._zod.pattern=((n=t==null?void 0:t._zod.computed)==null?void 0:n.pattern)??ts(t._zod.computed),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),D=c("$ZodStringFormat",(t,e)=>{It.init(t,e),or.init(t,e)}),Us=c("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Co),D.init(t,e)}),As=c("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Je(r))}else e.pattern??(e.pattern=Je());D.init(t,e)}),Zs=c("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Lo),D.init(t,e)}),Bs=c("$ZodURL",(t,e)=>{D.init(t,e),t._zod.check=n=>{try{const r=new URL(n.value);if(Zn.lastIndex=0,!Zn.test(r.hostname))throw new Error;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t})}}}),Ds=c("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Wo()),D.init(t,e)}),Ms=c("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=jo),D.init(t,e)}),Ps=c("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Zo),D.init(t,e)}),js=c("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Bo),D.init(t,e)}),Rs=c("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Do),D.init(t,e)}),Cs=c("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Mo),D.init(t,e)}),Ls=c("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Po),D.init(t,e)}),Fs=c("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=es(e)),D.init(t,e)}),Ws=c("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Ho),D.init(t,e)}),qs=c("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Qo(e)),D.init(t,e)}),Vs=c("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Ro),D.init(t,e)}),Ys=c("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=tr),D.init(t,e),t._zod.onattach.push(n=>{n._zod.computed.format="ipv4"})}),Js=c("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=nr),D.init(t,e),t._zod.onattach.push(n=>{n._zod.computed.format="ipv6"}),t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t})}}}),Ks=c("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=qo),D.init(t,e)}),Gs=c("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Vo),D.init(t,e),t._zod.check=n=>{const[r,i]=n.value.split("/");try{if(!i)throw new Error;const o=Number(i);if(`${o}`!==i)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t})}}}),Hs=c("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Yo),D.init(t,e),t._zod.onattach.push(n=>{n._zod.computed.contentEncoding="base64"})}),Xs=c("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Jo),D.init(t,e),t._zod.onattach.push(n=>{n._zod.computed.contentEncoding="base64url"})}),Qs=c("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Ko),D.init(t,e)});function ea(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n,i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const ta=c("$ZodJWT",(t,e)=>{D.init(t,e),t._zod.check=n=>{ea(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t})}}),sr=c("$ZodNumber",(t,e)=>{b.init(t,e),t._zod.pattern=t._zod.computed.pattern??is,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...o?{received:o}:{}}),n}}),na=c("$ZodNumber",(t,e)=>{fs.init(t,e),sr.init(t,e)}),ar=c("$ZodBoolean",(t,e)=>{b.init(t,e),t._zod.pattern=os,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),n}}),ur=c("$ZodBigInt",(t,e)=>{b.init(t,e),t._zod.pattern=ns,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=BigInt(n.value)}catch{}const{value:i}=n;return typeof i=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:i,inst:t}),n}}),ra=c("$ZodBigInt",(t,e)=>{ps.init(t,e),ur.init(t,e)}),ia=c("$ZodSymbol",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>{const{value:i}=n;return typeof i=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:t}),n}}),oa=c("$ZodUndefined",(t,e)=>{b.init(t,e),t._zod.pattern=as,t._zod.values=new Set([void 0]),t._zod.parse=(n,r)=>{const{value:i}=n;return typeof i>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:t}),n}}),sa=c("$ZodNull",(t,e)=>{b.init(t,e),t._zod.pattern=ss,t._zod.values=new Set([null]),t._zod.parse=(n,r)=>{const{value:i}=n;return i===null||n.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),n}}),aa=c("$ZodAny",(t,e)=>{b.init(t,e),t._zod.parse=n=>n}),xt=c("$ZodUnknown",(t,e)=>{b.init(t,e),t._zod.parse=n=>n}),an=c("$ZodNever",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)}),ua=c("$ZodVoid",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>{const{value:i}=n;return typeof i>"u"||n.issues.push({expected:"void",code:"invalid_type",input:i,inst:t}),n}}),ca=c("$ZodDate",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=new Date(n.value)}catch{}const i=n.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:t}),n}});function Di(t,e,n){t.issues.length&&e.issues.push(...X(n,t.issues)),e.value[n]=t.value}const la=c("$ZodArray",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),n;n.value=Array(i.length);const o=[];for(let s=0;s<i.length;s++){const a=i[s],l=e.element._zod.run({value:a,issues:[]},r);l instanceof Promise?o.push(l.then(u=>Di(u,n,s))):Di(l,n,s)}return o.length?Promise.all(o).then(()=>n):n}});function Zt(t,e,n){t.issues.length?e.issues.push(...X(n,t.issues)):e.value[n]=t.value}function Mi(t,e,n,r){t.issues.length?r[n]===void 0?n in r&&(e.value[n]=void 0):e.issues.push(...X(n,t.issues)):t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}const un=c("$ZodObjectLike",(t,e)=>{b.init(t,e);const n=pe(()=>{const u=Object.keys(e.shape);return{shape:e.shape,keys:u,keySet:new Set(u),numKeys:u.length,optionalKeys:new Set(e.optional)}});le(t._zod,"disc",()=>{const u=e.shape,h=new Map;let d=!1;for(const y in u){const g=u[y]._zod;if(g.values||g.disc){d=!0;const w={values:new Set(g.values??[]),maps:g.disc?[g.disc]:[]};h.set(y,w)}}if(d)return h});const r=u=>{const h=new Ns(["shape","payload","ctx"]),{keys:d,optionalKeys:y}=n.value,g=S=>{const O=Ce(S);return`shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`};h.write("const input = payload.value;");const w={};for(const S of d)w[S]=Kn(15);for(const S of d){if(y.has(S))continue;const O=w[S];h.write(`const ${O} = ${g(S)};`),h.write(`
|
|
7
|
-
if (${O}.issues.length) payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
|
|
8
|
-
...iss,
|
|
9
|
-
path: iss.path ? [${Ce(S)}, ...iss.path] : [${Ce(S)}]
|
|
10
|
-
})));`)}h.write("payload.value = {"),h.indented(()=>{for(const S of d){if(y.has(S))continue;const O=w[S];h.write(` ${Ce(S)}: ${O}.value,`)}}),h.write("}");for(const S of d){if(!y.has(S))continue;const O=w[S];h.write(`const ${O} = ${g(S)};`);const W=Ce(S);h.write(`
|
|
11
|
-
if (${O}.issues.length) {
|
|
12
|
-
if (input[${W}] === undefined) {
|
|
13
|
-
if (${W} in input) {
|
|
14
|
-
payload.value[${W}] = undefined;
|
|
15
|
-
}
|
|
16
|
-
} else {
|
|
17
|
-
payload.issues = payload.issues.concat(
|
|
18
|
-
${O}.issues.map((iss) => ({
|
|
19
|
-
...iss,
|
|
20
|
-
path: iss.path ? [${W}, ...iss.path] : [${W}],
|
|
21
|
-
}))
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
} else if (${O}.value === undefined) {
|
|
25
|
-
if (${W} in input) payload.value[${W}] = undefined;
|
|
26
|
-
} else {
|
|
27
|
-
payload.value[${W}] = ${O}.value;
|
|
28
|
-
}
|
|
29
|
-
`)}h.write("return payload;");const z=h.compile();return(S,O)=>z(u,S,O)};let i;const o=Io.value,s=Gn,{catchall:a}=e;let l;t._zod.parse=(u,h)=>{l??(l=n.value);const d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:t}),u;const y=[];if(o&&(h==null?void 0:h.async)===!1&&h.noPrecompilation!==!0)i||(i=r(e.shape)),u=i(u,h);else{u.value={};const{keys:O,shape:W,optionalKeys:Pe}=l;for(const Q of O){const Ut=W[Q]._zod.run({value:d[Q],issues:[]},h),ki=Pe.has(Q);Ut instanceof Promise?y.push(Ut.then(Ni=>ki?Mi(Ni,u,Q,d):Zt(Ni,u,Q))):ki?Mi(Ut,u,Q,d):Zt(Ut,u,Q)}}if(!a)return y.length?Promise.all(y).then(()=>u):u;const g=[],w=l.keySet,z=a._zod,S=z.def.type;for(const O of Object.keys(d)){if(w.has(O))continue;if(S==="never"){g.push(O);continue}const W=z.run({value:d[O],issues:[]},h);W instanceof Promise?y.push(W.then(Pe=>Zt(Pe,u,O))):Zt(W,u,O)}return g.length&&u.issues.push({code:"unrecognized_keys",keys:g,input:d,inst:t}),y.length?Promise.all(y).then(()=>u):u}}),Bn=c("$ZodInterface",(t,e)=>{un.init(t,e)}),ha=c("$ZodObject",(t,e)=>{un.init(t,e)});function fh(t,e,n,r){for(const i of t)if(i.issues.length===0)return e.value=i.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(i=>i.issues.map(o=>H(o,r,V())))}),e}const cr=c("$ZodUnion",(t,e)=>{b.init(t,e);const n=new Set;if(e.options.every(r=>r._zod.values)){for(const r of e.options)for(const i of r._zod.values)n.add(i);t._zod.values=n}if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(i=>i._zod.pattern);t._zod.pattern=new RegExp(`^(${r.map(i=>Qt(i.source)).join("|")})$`)}t._zod.parse=(r,i)=>{const o=[];for(const s of e.options){const a=s._zod.run({value:r.value,issues:[]},i);if(a instanceof Promise)o.push(a);else{if(a.issues.length===0)return a;o.push(a)}}return fh(o,r,t,i)}});function da(t,e){let n=!0;for(const[r,i]of e){const o=t==null?void 0:t[r];if(i.values.size&&!i.values.has(o)&&(n=!1),i.maps.length>0)for(const s of i.maps)da(o,s)||(n=!1)}return n}const fa=c("$ZodDiscriminatedUnion",(t,e)=>{cr.init(t,e);const n=t._zod.parse,r=new Map;for(const o of e.options){if(!o._zod.disc)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(const[s,a]of o._zod.disc){r.has(s)||r.set(s,{values:new Set,maps:[]});const l=r.get(s);for(const u of a.values)l.values.add(u);for(const u of a.maps)l.maps.push(u)}}t._zod.disc=r;const i=new Map;for(const o of e.options){const s=o._zod.disc;if(!s)throw new Error(`Invalid disciminated union element: ${o._zod.def.type}`);i.set(o,s)}t._zod.parse=(o,s)=>{const a=o.value;if(!Gn(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),o;const l=[];for(const u of e.options)i.has(u)?da(a,i.get(u))&&l.push(u):l.push(u);return l.length===1?l[0]._zod.run(o,s):e.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,inst:t}),o)}}),pa=c("$ZodIntersection",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>{const{value:i}=n,o=e.left._zod.run({value:i,issues:[]},r),s=e.right._zod.run({value:i,issues:[]},r);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([l,u])=>Pi(n,l,u)):Pi(n,o,s)}});function Dn(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Ft(t)&&Ft(e)){const n=Object.keys(e),r=Object.keys(t).filter(o=>n.indexOf(o)!==-1),i={...t,...e};for(const o of r){const s=Dn(t[o],e[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const i=t[r],o=e[r],s=Dn(i,o);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Pi(t,e,n){if(e.issues.length&&t.issues.push(...e.issues),n.issues.length&&t.issues.push(...n.issues),Fe(t))return t;const r=Dn(e.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return t.value=r.data,t}const cn=c("$ZodTuple",(t,e)=>{b.init(t,e);const n=e.items,r=n.length-[...n].reverse().findIndex(i=>i._zod.qout!=="true");t._zod.parse=(i,o)=>{const s=i.value;if(!Array.isArray(s))return i.issues.push({input:s,inst:t,expected:"tuple",code:"invalid_type"}),i;i.value=[];const a=[];if(!e.rest){const u=s.length>n.length,h=s.length<r-1;if(u||h)return i.issues.push({input:s,inst:t,origin:"array",...u?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length}}),i}let l=-1;for(const u of n){if(l++,l>=s.length&&l>=r)continue;const h=u._zod.run({value:s[l],issues:[]},o);h instanceof Promise?a.push(h.then(d=>Bt(d,i,l))):Bt(h,i,l)}if(e.rest){const u=s.slice(n.length);for(const h of u){l++;const d=e.rest._zod.run({value:h,issues:[]},o);d instanceof Promise?a.push(d.then(y=>Bt(y,i,l))):Bt(d,i,l)}}return a.length?Promise.all(a).then(()=>i):i}});function Bt(t,e,n){t.issues.length?e.issues.push(...X(n,t.issues)):e.value[n]=t.value}const ma=c("$ZodRecord",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Ft(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),n;const o=[];if(e.keyType._zod.values){const s=e.keyType._zod.values;n.value={};for(const l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){const u=e.valueType._zod.run({value:i[l],issues:[]},r);u instanceof Promise?o.push(u.then(h=>{h.issues.length&&n.issues.push(...X(l,h.issues)),n.value[l]=h.value})):(u.issues.length&&n.issues.push(...X(l,u.issues)),n.value[l]=u.value)}let a;for(const l in i)s.has(l)||(a=a??[],a.push(l));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:a})}else{n.value={};for(const s of Reflect.ownKeys(i)){if(s==="__proto__")continue;const a=e.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>H(u,r,V())),input:s,path:[s],inst:t});continue}const l=e.valueType._zod.run({value:i[s],issues:[]},r);l instanceof Promise?o.push(l.then(u=>{u.issues.length?n.issues.push(...X(s,u.issues)):n.value[a.value]=u.value})):l.issues.length?n.issues.push(...X(s,l.issues)):n.value[a.value]=l.value}}return o.length?Promise.all(o).then(()=>n):n}}),ga=c("$ZodMap",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:t}),n;const o=[];n.value=new Map;for(const[s,a]of i){const l=e.keyType._zod.run({value:s,issues:[]},r),u=e.valueType._zod.run({value:a,issues:[]},r);l instanceof Promise||u instanceof Promise?o.push(Promise.all([l,u]).then(([h,d])=>{ji(h,d,n,s,i,t,r)})):ji(l,u,n,s,i,t,r)}return o.length?Promise.all(o).then(()=>n):n}});function ji(t,e,n,r,i,o,s){t.issues.length&&(Wt.has(typeof r)?n.issues.push(...X(r,t.issues)):n.issues.push({origin:"map",code:"invalid_key",input:i,inst:o,issues:t.issues.map(a=>H(a,s,V()))})),e.issues.length?Wt.has(typeof r)?n.issues.push(...X(r,e.issues)):n.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:r,issues:e.issues.map(a=>H(a,s,V()))}):n.value.set(t.value,e.value)}const ya=c("$ZodSet",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:t,expected:"set",code:"invalid_type"}),n;const o=[];n.value=new Set;for(const s of i){const a=e.valueType._zod.run({value:s,issues:[]},r);a instanceof Promise?o.push(a.then(l=>Ri(l,n))):Ri(a,n)}return o.length?Promise.all(o).then(()=>n):n}});function Ri(t,e){t.issues.length?e.issues.push(...t.issues):e.value.add(t.value)}const wa=c("$ZodEnum",(t,e)=>{b.init(t,e);const n=Object.entries(e.entries).filter(([r,i])=>typeof e.entries[e.entries[r]]!="number").map(([r,i])=>i);t._zod.values=new Set(n),t._zod.pattern=new RegExp(`^(${n.filter(r=>Wt.has(typeof r)).map(r=>typeof r=="string"?_e(r):r.toString()).join("|")})$`),t._zod.parse=(r,i)=>{const o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:n,input:o,inst:t}),r}}),va=c("$ZodLiteral",(t,e)=>{b.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?_e(n):n?n.toString():String(n)).join("|")})$`),t._zod.parse=(n,r)=>{const i=n.value;return t._zod.values.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),ba=c("$ZodFile",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;return i instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:i,inst:t}),n}}),_a=c("$ZodTransform",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>{const i=e.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(n.value=s,n));if(i instanceof Promise)throw new Ve;return n.value=i,n}}),$a=c("$ZodOptional",(t,e)=>{b.init(t,e),t._zod.qout="true",e.innerType._zod.values&&(t._zod.values=new Set([...e.innerType._zod.values,void 0]));const n=e.innerType._zod.pattern;n&&(t._zod.pattern=new RegExp(`^(${Qt(n.source)})?$`)),t._zod.parse=(r,i)=>r.value===void 0?r:e.innerType._zod.run(r,i)}),Ia=c("$ZodNullable",(t,e)=>{b.init(t,e),t._zod.qin=e.innerType._zod.qin,t._zod.qout=e.innerType._zod.qout;const n=e.innerType._zod.pattern;n&&(t._zod.pattern=new RegExp(`^(${Qt(n.source)}|null)$`)),e.innerType._zod.values&&(t._zod.values=new Set([...e.innerType._zod.values,null])),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),xa=c("$ZodDefault",(t,e)=>{b.init(t,e),t._zod.values=e.innerType._zod.values,t._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=e.defaultValue(),n;const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Ci(o,e)):Ci(i,e)}});function Ci(t,e){return t.value===void 0&&(t.value=e.defaultValue()),t}const za=c("$ZodNonOptional",(t,e)=>{b.init(t,e),e.innerType._zod.values&&(t._zod.values=new Set([...e.innerType._zod.values].filter(n=>n!==void 0))),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Li(o,t)):Li(i,t)}});function Li(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const Sa=c("$ZodSuccess",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>(n.value=o.issues.length===0,n)):(n.value=i.issues.length===0,n)}}),Oa=c("$ZodCatch",(t,e)=>{b.init(t,e),t._zod.qout=e.innerType._zod.qout,t._zod.values=e.innerType._zod.values,t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>(o.issues.length?(n.value=e.catchValue({...n,error:{issues:o.issues.map(s=>H(s,r,V()))},input:n.value}),n.issues=[]):n.value=o.value,n)):(i.issues.length?(n.value=e.catchValue({...n,error:{issues:i.issues.map(o=>H(o,r,V()))},input:n.value}),n.issues=[]):n.value=i.value,n)}}),Ta=c("$ZodNaN",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:t,expected:"nan",code:"invalid_type"}),n)}),lr=c("$ZodPipe",(t,e)=>{b.init(t,e),t._zod.values=e.in._zod.values,t._zod.parse=(n,r)=>{const i=e.in._zod.run(n,r);return i instanceof Promise?i.then(o=>Fi(o,e,r)):Fi(i,e,r)}});function Fi(t,e,n){return Fe(t)?t:e.out._zod.run({value:t.value,issues:t.issues},n)}const ka=c("$ZodReadonly",(t,e)=>{b.init(t,e),le(t._zod,"disc",()=>e.innerType._zod.disc),t._zod.qout=e.innerType._zod.qout,t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(Wi):Wi(i)}});function Wi(t){return t.value=Object.freeze(t.value),t}const Na=c("$ZodTemplateLiteral",(t,e)=>{b.init(t,e);const n=[];for(const r of e.parts)if(r instanceof b){if(!r._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);const i=r._zod.pattern instanceof RegExp?r._zod.pattern.source:r._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${r._zod.traits}`);const o=i.startsWith("^")?1:0,s=i.endsWith("$")?i.length-1:i.length;n.push(i.slice(o,s))}else if(r===null||xo.has(typeof r))n.push(_e(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);t._zod.pattern=new RegExp(`^${n.join("")}$`),t._zod.parse=(r,i)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:t,expected:"template_literal",code:"invalid_type"}),r):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),r)}),Ea=c("$ZodPromise",(t,e)=>{b.init(t,e),t._zod.parse=(n,r)=>Promise.resolve(n.value).then(i=>e.innerType._zod.run({value:i,issues:[]},r))}),Ua=c("$ZodLazy",(t,e)=>{b.init(t,e),le(t._zod,"_getter",e.getter),le(t._zod,"pattern",()=>t._zod._getter._zod.pattern),le(t._zod,"disc",()=>t._zod._getter._zod.disc),t._zod.parse=(n,r)=>t._zod._getter._zod.run(n,r),le(t._zod,"qin",()=>t._zod._getter._zod.qin),le(t._zod,"qout",()=>t._zod._getter._zod.qout)}),Aa=c("$ZodCustom",(t,e)=>{C.init(t,e),b.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,i=e.fn(r);if(i instanceof Promise)return i.then(o=>qi(o,n,r,t));qi(i,n,r,t)}});function qi(t,e,n,r){if(!t){const i={code:"custom",input:n,inst:r,path:r._zod.def.path,continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(Ye(i))}}const ph={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function Vi(t){return ph[t]??null}const mh=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},gh={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},yh=t=>{switch(t.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${t.expected}, daxil olan ${mh(t.input)}`;case"invalid_value":return t.values.length===1?`Yanlış dəyər: gözlənilən ${$t(t.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${Ee(t.values,"|")}`;case"too_big":{const e=t.inclusive?"<=":"<",n=Vi(t.origin);return n?`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${e}${t.maximum.toString()} ${n.unit??"element"}`:`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${e}${t.maximum.toString()}`}case"too_small":{const e=t.inclusive?">=":">",n=Vi(t.origin);return n?`Çox kiçik: gözlənilən ${t.origin} ${e}${t.minimum.toString()} ${n.unit}`:`Çox kiçik: gözlənilən ${t.origin} ${e}${t.minimum.toString()}`}case"invalid_format":{const e=t;return e.format==="starts_with"?`Yanlış mətn: "${e.prefix}" ilə başlamalıdır`:e.format==="ends_with"?`Yanlış mətn: "${e.suffix}" ilə bitməlidir`:e.format==="includes"?`Yanlış mətn: "${e.includes}" daxil olmalıdır`:e.format==="regex"?`Yanlış mətn: ${e.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${gh[e.format]??t.format}`}case"not_multiple_of":return`Yanlış ədəd: ${t.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${t.keys.length>1?"lar":""}: ${Ee(t.keys,", ")}`;case"invalid_key":return`${t.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${t.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}};function wh(){return{localeError:yh}}const vh={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function Yi(t){return vh[t]??null}const bh=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},_h={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},$h=t=>{switch(t.code){case"invalid_type":return`Invalid input: expected ${t.expected}, received ${bh(t.input)}`;case"invalid_value":return t.values.length===1?`Invalid input: expected ${$t(t.values[0])}`:`Invalid option: expected one of ${Ee(t.values,"|")}`;case"too_big":{const e=t.inclusive?"<=":"<",n=Yi(t.origin);return n?`Too big: expected ${t.origin??"value"} to have ${e}${t.maximum.toString()} ${n.unit??"elements"}`:`Too big: expected ${t.origin??"value"} to be ${e}${t.maximum.toString()}`}case"too_small":{const e=t.inclusive?">=":">",n=Yi(t.origin);return n?`Too small: expected ${t.origin} to have ${e}${t.minimum.toString()} ${n.unit}`:`Too small: expected ${t.origin} to be ${e}${t.minimum.toString()}`}case"invalid_format":{const e=t;return e.format==="starts_with"?`Invalid string: must start with "${e.prefix}"`:e.format==="ends_with"?`Invalid string: must end with "${e.suffix}"`:e.format==="includes"?`Invalid string: must include "${e.includes}"`:e.format==="regex"?`Invalid string: must match pattern ${e.pattern}`:`Invalid ${_h[e.format]??t.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${t.divisor}`;case"unrecognized_keys":return`Unrecognized key${t.keys.length>1?"s":""}: ${Ee(t.keys,", ")}`;case"invalid_key":return`Invalid key in ${t.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${t.origin}`;default:return"Invalid input"}};function Za(){return{localeError:$h}}const Ih={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function Ji(t){return Ih[t]??null}const xh=t=>{const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"número";case"object":{if(Array.isArray(t))return"arreglo";if(t===null)return"nulo";if(Object.getPrototypeOf(t)!==Object.prototype)return t.constructor.name}}return e},zh={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},Sh=t=>{switch(t.code){case"invalid_type":return`Entrada inválida: se esperaba ${t.expected}, recibido ${xh(t.input)}`;case"invalid_value":return t.values.length===1?`Entrada inválida: se esperaba ${$t(t.values[0])}`:`Opción inválida: se esperaba una de ${Ee(t.values,"|")}`;case"too_big":{const e=t.inclusive?"<=":"<",n=Ji(t.origin);return n?`Demasiado grande: se esperaba que ${t.origin??"valor"} tuviera ${e}${t.maximum.toString()} ${n.unit??"elementos"}`:`Demasiado grande: se esperaba que ${t.origin??"valor"} fuera ${e}${t.maximum.toString()}`}case"too_small":{const e=t.inclusive?">=":">",n=Ji(t.origin);return n?`Demasiado pequeño: se esperaba que ${t.origin} tuviera ${e}${t.minimum.toString()} ${n.unit}`:`Demasiado pequeño: se esperaba que ${t.origin} fuera ${e}${t.minimum.toString()}`}case"invalid_format":{const e=t;return e.format==="starts_with"?`Cadena inválida: debe comenzar con "${e.prefix}"`:e.format==="ends_with"?`Cadena inválida: debe terminar en "${e.suffix}"`:e.format==="includes"?`Cadena inválida: debe incluir "${e.includes}"`:e.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${e.pattern}`:`Inválido ${zh[e.format]??t.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${t.divisor}`;case"unrecognized_keys":return`Llave${t.keys.length>1?"s":""} desconocida${t.keys.length>1?"s":""}: ${Ee(t.keys,", ")}`;case"invalid_key":return`Llave inválida en ${t.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${t.origin}`;default:return"Entrada inválida"}};function Oh(){return{localeError:Sh}}const Ba=Object.freeze(Object.defineProperty({__proto__:null,az:wh,en:Za,es:Oh},Symbol.toStringTag,{value:"Module"})),Da=Symbol("ZodOutput"),Ma=Symbol("ZodInput");class hr{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];if(this._map.set(e,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){return this._map.get(e)}has(e){return this._map.has(e)}}function dr(){return new hr}const we=dr();function Pa(t,e){return new t({type:"string",...f(e)})}function ja(t,e){return new t({type:"string",coerce:!0,...f(e)})}function fr(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...f(e)})}function qt(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...f(e)})}function pr(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...f(e)})}function mr(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f(e)})}function gr(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f(e)})}function yr(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f(e)})}function wr(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...f(e)})}function vr(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...f(e)})}function br(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...f(e)})}function _r(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...f(e)})}function $r(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...f(e)})}function Ir(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...f(e)})}function xr(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...f(e)})}function zr(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...f(e)})}function Sr(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...f(e)})}function Or(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...f(e)})}function Tr(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f(e)})}function kr(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f(e)})}function Nr(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...f(e)})}function Er(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...f(e)})}function Ur(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...f(e)})}function Ar(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...f(e)})}function Ra(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(e)})}function Ca(t,e){return new t({type:"string",format:"date",check:"string_format",...f(e)})}function La(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...f(e)})}function Fa(t,e){return new t({type:"string",format:"duration",check:"string_format",...f(e)})}function Wa(t,e){return new t({type:"number",checks:[],...f(e)})}function qa(t,e){return new t({type:"number",coerce:!0,checks:[],...f(e)})}function Va(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...f(e)})}function Ya(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...f(e)})}function Ja(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...f(e)})}function Ka(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...f(e)})}function Ga(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...f(e)})}function Ha(t,e){return new t({type:"boolean",...f(e)})}function Xa(t,e){return new t({type:"boolean",coerce:!0,...f(e)})}function Qa(t,e){return new t({type:"bigint",...f(e)})}function eu(t,e){return new t({type:"bigint",coerce:!0,...f(e)})}function tu(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...f(e)})}function nu(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...f(e)})}function ru(t,e){return new t({type:"symbol",...f(e)})}function iu(t,e){return new t({type:"undefined",...f(e)})}function ou(t,e){return new t({type:"null",...f(e)})}function su(t,e){return new t({type:"any",...f(e)})}function ln(t,e){return new t({type:"unknown",...f(e)})}function hn(t,e){return new t({type:"never",...f(e)})}function au(t,e){return new t({type:"void",...f(e)})}function uu(t,e){return new t({type:"date",...f(e)})}function cu(t,e){return new t({type:"date",coerce:!0,...f(e)})}function lu(t,e){return new t({type:"nan",...f(e)})}function Ue(t,e){return new rr({check:"less_than",...f(e),value:t,inclusive:!1})}function ee(t,e){return new rr({check:"less_than",...f(e),value:t,inclusive:!0})}function Ae(t,e){return new ir({check:"greater_than",...f(e),value:t,inclusive:!1})}function G(t,e){return new ir({check:"greater_than",...f(e),value:t,inclusive:!0})}function hu(t){return Ae(0,t)}function du(t){return Ue(0,t)}function fu(t){return ee(0,t)}function pu(t){return G(0,t)}function gt(t,e){return new ds({check:"multiple_of",...f(e),value:t})}function dn(t,e){return new ms({check:"max_size",...f(e),maximum:t})}function yt(t,e){return new gs({check:"min_size",...f(e),minimum:t})}function Zr(t,e){return new ys({check:"size_equals",...f(e),size:t})}function fn(t,e){return new ws({check:"max_length",...f(e),maximum:t})}function Ke(t,e){return new vs({check:"min_length",...f(e),minimum:t})}function pn(t,e){return new bs({check:"length_equals",...f(e),length:t})}function Br(t,e){return new _s({check:"string_format",format:"regex",...f(e),pattern:t})}function Dr(t){return new $s({check:"string_format",format:"lowercase",...f(t)})}function Mr(t){return new Is({check:"string_format",format:"uppercase",...f(t)})}function Pr(t,e){return new xs({check:"string_format",format:"includes",...f(e),includes:t})}function jr(t,e){return new zs({check:"string_format",format:"starts_with",...f(e),prefix:t})}function Rr(t,e){return new Ss({check:"string_format",format:"ends_with",...f(e),suffix:t})}function mu(t,e,n){return new Os({check:"property",property:t,schema:e,...f(n)})}function Cr(t,e){return new Ts({check:"mime_type",mime:t,...f(e)})}function Me(t){return new ks({check:"overwrite",tx:t})}function Lr(t){return Me(e=>e.normalize(t))}function Fr(){return Me(t=>t.trim())}function Wr(){return Me(t=>t.toLowerCase())}function qr(){return Me(t=>t.toUpperCase())}function gu(t,e,n){return new t({type:"array",element:e,...f(n)})}function Th(t,e,n){const r=pe(()=>ze(e)),i={type:"interface",get shape(){const o=r.value.shape;return ae(this,"shape",o),o},get optional(){return r.value.optional},...f(n)};return new t(i)}function kh(t,e,n){const r=pe(()=>ze(e)),i={type:"interface",get shape(){const o=r.value.shape;return ae(this,"shape",o),o},get optional(){return r.value.optional},catchall:hn(an),...f(n)};return new t(i)}function Nh(t,e,n){const r=pe(()=>ze(e)),i={type:"interface",get optional(){return r.value.optional},get shape(){const o=r.value.shape;return ae(this,"shape",o),o},catchall:ln(xt),...f(n)};return new t(i)}function Eh(t,e,n){const r={type:"object",shape:e??{},get optional(){return De(e??{})},...f(n)};return new t(r)}function Uh(t,e,n){return new t({type:"object",shape:e,get optional(){return De(e)},catchall:hn(an),...f(n)})}function Ah(t,e,n){return new t({type:"object",shape:e,get optional(){return De(e)},catchall:ln(xt),...f(n)})}function Zh(t,e,n){return new t({type:"union",options:e,...f(n)})}function Bh(t,e,n){return new t({type:"union",options:e,...f(n)})}function Dh(t,e,n,r){return new t({type:"intersection",left:e,right:n,...f(r)})}function yu(t,e,n,r){const i=n instanceof b,o=i?r:n,s=i?n:null;return new t({type:"tuple",items:e,rest:s,...f(o)})}function Mh(t,e,n,r){return new t({type:"record",keyType:e,valueType:n,...f(r)})}function Ph(t,e,n,r){return new t({type:"map",keyType:e,valueType:n,...f(r)})}function jh(t,e,n){return new t({type:"set",valueType:e,...f(n)})}function Rh(t,e,n){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new t({type:"enum",entries:r,...f(n)})}function Ch(t,e,n){return new t({type:"enum",entries:e,...f(n)})}function Lh(t,e,n){return new t({type:"literal",values:Array.isArray(e)?e:[e],...f(n)})}function wu(t,e){return new t({type:"file",...f(e)})}function Fh(t,e,n){return new t({type:"transform",transform:e,...f(n)})}function Wh(t,e,n){return new t({type:"optional",innerType:e,...f(n)})}function qh(t,e,n){return new t({type:"nullable",innerType:e,...f(n)})}function Vh(t,e,n,r){return new t({type:"default",defaultValue:typeof n=="function"?n:()=>n,innerType:e,...f(r)})}function Yh(t,e,n){return new t({type:"nonoptional",innerType:e,...f(n)})}function Jh(t,e,n){return new t({type:"success",innerType:e,...f(n)})}function Kh(t,e,n,r){return new t({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n,...f(r)})}function Gh(t,e,n,r){return new t({type:"pipe",in:e,out:n,...f(r)})}function Hh(t,e,n){return new t({type:"readonly",innerType:e,...f(n)})}function Xh(t,e,n){return new t({type:"template_literal",parts:e,...f(n)})}function Qh(t,e,n){return new t({type:"lazy",getter:e,...f(n)})}function ed(t,e,n){return new t({type:"promise",innerType:e,...f(n)})}function mn(t,e,n){return new t({type:"custom",check:"custom",fn:e,...f(n)})}function td(t,e,n={}){return mn(t,e,n)}function vu(t,e){const n=f(e),r=new Set((n==null?void 0:n.truthy)??["true","1","yes","on","y","enabled"]),i=new Set((n==null?void 0:n.falsy)??["false","0","no","off","n","disabled"]),o=t.Pipe??lr,s=t.Boolean??ar,a=t.Unknown??xt,l=new a({type:"unknown",checks:[{_zod:{check:u=>{if(typeof u.value=="string"){let h=u.value;(n==null?void 0:n.case)!=="sensitive"&&(h=h.toLowerCase()),r.has(h)?u.value=!0:i.has(h)?u.value=!1:u.issues.push({code:"invalid_value",expected:"stringbool",values:[...r,...i],input:u.value,inst:l})}else u.issues.push({code:"invalid_type",expected:"string",input:u.value})},def:{check:"custom"},onattach:[]}}]});return new o({type:"pipe",in:l,out:new s({type:"boolean"})})}class We{constructor(e){this._def=e}implement(e){if(typeof e!="function")throw new Error("implement() must be called with a function");return(...n)=>{const r=this._def.input?Un(this._def.input,n):n;if(!Array.isArray(r))throw new Error("Invalid arguments schema: not an array or tuple schema.");const i=e(...r);return this._def.output?Un(this._def.output,i):i}}implementAsync(e){if(typeof e!="function")throw new Error("implement() must be called with a function");return async(...n)=>{const r=this._def.input?await An(this._def.input,n):n;if(!Array.isArray(r))throw new Error("Invalid arguments schema: not an array or tuple schema.");const i=await e(...r);return this._def.output?An(this._def.output,i):i}}input(...e){return Array.isArray(e[0])?new We({type:"function",input:new cn({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output}):new We({type:"function",input:e[0],output:this._def.output})}output(e){return new We({type:"function",input:this._def.input,output:e})}}function bu(t){return new We({type:"function",input:Array.isArray(t==null?void 0:t.input)?yu(cn,t==null?void 0:t.input):(t==null?void 0:t.input)??null,output:(t==null?void 0:t.output)??null})}const nd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"};class Mn{constructor(e){this.counter=0,this.metadataRegistry=(e==null?void 0:e.metadata)??we,this.target=(e==null?void 0:e.target)??"draft-2020-12",this.unrepresentable=(e==null?void 0:e.unrepresentable)??"throw",this.override=(e==null?void 0:e.override)??(()=>{}),this.io=(e==null?void 0:e.io)??"output",this.seen=new Map}process(e,n={path:[],schemaPath:[]}){const r=e._zod.def,i=this.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.count++,i.schema;const o={schema:{},count:1,cycle:void 0};this.seen.set(e,o),e._zod.toJSONSchema&&(o.schema=e._zod.toJSONSchema());const s={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.parent)o.schema._ref=this.process(e._zod.parent,s);else{const u=o.schema;switch(r.type){case"string":{const h=u;h.type="string";const{minimum:d,maximum:y,format:g,pattern:w,contentEncoding:z}=e._zod.computed;d&&(h.minLength=d),y&&(h.maxLength=y),g&&(h.format=nd[g]??g),w&&(h.pattern=w.source),z&&(h.contentEncoding=z);break}case"number":{const h=u,{minimum:d,maximum:y,format:g,multipleOf:w,inclusive:z}=e._zod.computed;g!=null&&g.includes("int")?h.type="integer":h.type="number",d&&(z?h.minimum=d:h.exclusiveMinimum=d),y&&(z?h.maximum=y:h.exclusiveMaximum=y),w&&(h.multipleOf=w);break}case"boolean":{const h=u;h.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"undefined":{const h=u;h.type="null";break}case"null":{u.type="null";break}case"any":break;case"unknown":break;case"never":{u.not={};break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const h=u,{minimum:d,maximum:y}=e._zod.computed;d&&(h.minItems=d),y&&(h.maxItems=y),h.type="array",h.items=this.process(r.element,{...s,path:[...s.path,"items"]});break}case"object":case"interface":{const h=u;h.type="object",h.properties={};const d=r.shape;for(const z in d)h.properties[z]=this.process(d[z],{...s,path:[...s.path,"properties",z]});const y=new Set(Object.keys(d)),g=new Set(r.optional),w=new Set([...y].filter(z=>!g.has(z)));h.required=Array.from(w),r.catchall&&(h.additionalProperties=this.process(r.catchall,{...s,path:[...s.path,"additionalProperties"]}));break}case"union":{const h=u;h.anyOf=r.options.map((d,y)=>this.process(d,{...s,path:[...s.path,"anyOf",y]}));break}case"intersection":{const h=u;h.allOf=[this.process(r.left,{...s,path:[...s.path,"allOf",0]}),this.process(r.right,{...s,path:[...s.path,"allOf",1]})];break}case"tuple":{const h=u;h.type="array";const d=r.items.map((w,z)=>this.process(w,{...s,path:[...s.path,"prefixItems",z]}));if(this.target==="draft-2020-12"?h.prefixItems=d:h.items=d,r.rest){const w=this.process(r.rest,{...s,path:[...s.path,"items"]});this.target==="draft-2020-12"?h.items=w:h.additionalItems=w}r.rest&&(h.items=this.process(r.rest,{...s,path:[...s.path,"items"]}));const{minimum:y,maximum:g}=e._zod.computed;y&&(h.minItems=y),g&&(h.maxItems=g);break}case"record":{const h=u;h.type="object",h.propertyNames=this.process(r.keyType,{...s,path:[...s.path,"propertyNames"]}),h.additionalProperties=this.process(r.valueType,{...s,path:[...s.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const h=u;h.enum=Object.values(r.entries);break}case"literal":{const h=u,d=[];for(const y of r.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");d.push(Number(y))}else d.push(y);if(d.length!==0)if(d.length===1){const y=d[0];h.const=y}else h.enum=d;break}case"file":{if(this.unrepresentable==="throw")throw new Error("File cannot be represented in JSON Schema");break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const h=this.process(r.innerType,s);u.anyOf=[h,{type:"null"}];break}case"nonoptional":{const h=this.process(r.innerType,s);Object.assign(u,h);break}case"success":{const h=u;h.type="boolean";break}case"default":{const h=this.process(r.innerType,s);Object.assign(u,h),u.default=r.defaultValue();break}case"catch":{const h=this.process(r.innerType,s);Object.assign(u,h);let d;try{d=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}u.default=d;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"pipe":{const h=this.io==="input"?r.in:r.out,d=this.process(h,s);u._ref=d;break}case"readonly":{u._ref=this.process(r.innerType,s),u.readOnly=!0;break}case"template_literal":{const h=u,d=e._zod.pattern;if(!d)throw new Error("Pattern not found in template literal");h.type="string",h.pattern=d.source;break}case"promise":{const h=this.process(r.innerType,s);u._ref=h;break}case"optional":{u._ref=this.process(r.innerType,s);break}case"lazy":{const h=e._zod._getter,d=this.process(h,s);u._ref=d;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}const a=this.metadataRegistry.get(e);a&&Object.assign(o.schema,a);const l=this.seen.get(e);return this.override({zodSchema:e,jsonSchema:l.schema}),l.schema}emit(e,n){var u,h,d,y;const r={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},i=this.seen.get(e);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=g=>{var W;const w=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const Pe=(W=r.external.registry.get(g[0]))==null?void 0:W.id;if(Pe)return{ref:r.external.uri(Pe)};const Q=g[1].defId??g[1].schema.id??`schema${this.counter++}`;return g[1].defId=Q,{defId:Q,ref:`${r.external.uri("__shared")}#/${w}/${Q}`}}if(g[1]===i)return{ref:"#"};const S=`#/${w}/`,O=g[1].schema.id??`__schema${this.counter++}`;return{defId:O,ref:S+O}},s=g=>{if(g[1].schema.$ref)return;const w=g[1],{ref:z,defId:S}=o(g);w.def={...w.schema},S&&(w.defId=S),rd(w,z)};for(const g of this.seen.entries()){const w=g[1];if(e===g[0]){s(g);continue}if(r.external){const S=(u=r.external.registry.get(g[0]))==null?void 0:u.id;if(e!==g[0]&&S){s(g);continue}}if((h=this.metadataRegistry.get(g[0]))==null?void 0:h.id){s(g);continue}if(w.cycle){if(r.cycles==="throw")throw new Error(`Cycle detected: #/${(d=w.cycle)==null?void 0:d.join("/")}/<root>
|
|
30
|
-
|
|
31
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);r.cycles==="ref"&&s(g);continue}if(w.count>1&&r.reused==="ref"){s(g);continue}}for(const g of this.seen.entries()){const w=g[1];Pn(w.schema),w.def&&Pn(w.def)}const a={...i.def},l=((y=r.external)==null?void 0:y.defs)??{};for(const g of this.seen.entries()){const w=g[1];w.def&&w.defId&&(l[w.defId]=w.def)}!r.external&&Object.keys(l).length>0&&(this.target==="draft-2020-12"?a.$defs=l:a.definitions=l);try{return JSON.parse(JSON.stringify(a))}catch{throw new Error("Error converting schema to JSON.")}}}const Pn=t=>{const e={...t};t._ref&&Pn(t._ref);const n=t._ref;Object.assign(t,n),Object.assign(t,e),delete t._ref};function rd(t,e){const n=t.schema;for(const r in n)delete n[r],n.$ref=e}function _u(t,e){if(t instanceof hr){const r=new Mn(e),i={};for(const a of t._idmap.entries()){const[l,u]=a;r.process(u)}const o={},s={registry:t,uri:(e==null?void 0:e.uri)||(a=>a),defs:i};for(const a of t._idmap.entries()){const[l,u]=a;o[l]=r.emit(u,{...e,external:s})}if(Object.keys(i).length>0){const a=r.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[a]:i}}return{schemas:o}}const n=new Mn(e);return n.process(t),n.emit(t,e)}const id=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),od=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:aa,$ZodArray:la,$ZodAsyncError:Ve,$ZodBase64:Hs,$ZodBase64URL:Xs,$ZodBigInt:ur,$ZodBigIntFormat:ra,$ZodBoolean:ar,$ZodCIDRv4:Ks,$ZodCIDRv6:Gs,$ZodCUID:Ps,$ZodCUID2:js,$ZodCatch:Oa,$ZodCheck:C,$ZodCheckBigIntFormat:ps,$ZodCheckEndsWith:Ss,$ZodCheckGreaterThan:ir,$ZodCheckIncludes:xs,$ZodCheckLengthEquals:bs,$ZodCheckLessThan:rr,$ZodCheckLowerCase:$s,$ZodCheckMaxLength:ws,$ZodCheckMaxSize:ms,$ZodCheckMimeType:Ts,$ZodCheckMinLength:vs,$ZodCheckMinSize:gs,$ZodCheckMultipleOf:ds,$ZodCheckNumberFormat:fs,$ZodCheckOverwrite:ks,$ZodCheckProperty:Os,$ZodCheckRegex:_s,$ZodCheckSizeEquals:ys,$ZodCheckStartsWith:zs,$ZodCheckStringFormat:It,$ZodCheckUpperCase:Is,$ZodCustom:Aa,$ZodDate:ca,$ZodDefault:xa,$ZodDiscriminatedUnion:fa,$ZodE164:Qs,$ZodEmail:Zs,$ZodEmoji:Ds,$ZodEnum:wa,$ZodError:ue,$ZodFile:ba,$ZodFunction:We,$ZodGUID:Us,$ZodIPv4:Ys,$ZodIPv6:Js,$ZodISODate:Ws,$ZodISODateTime:Fs,$ZodISODuration:Vs,$ZodISOTime:qs,$ZodInterface:Bn,$ZodIntersection:pa,$ZodJWT:ta,$ZodKSUID:Ls,$ZodLazy:Ua,$ZodLiteral:va,$ZodMap:ga,$ZodNaN:Ta,$ZodNanoID:Ms,$ZodNever:an,$ZodNonOptional:za,$ZodNull:sa,$ZodNullable:Ia,$ZodNumber:sr,$ZodNumberFormat:na,$ZodObject:ha,$ZodObjectLike:un,$ZodOptional:$a,$ZodPipe:lr,$ZodPromise:Ea,$ZodReadonly:ka,$ZodRecord:ma,$ZodRegistry:hr,$ZodSet:ya,$ZodString:or,$ZodStringFormat:D,$ZodSuccess:Sa,$ZodSymbol:ia,$ZodTemplateLiteral:Na,$ZodTransform:_a,$ZodTuple:cn,$ZodType:b,$ZodULID:Rs,$ZodURL:Bs,$ZodUUID:As,$ZodUndefined:oa,$ZodUnion:cr,$ZodUnknown:xt,$ZodVoid:ua,$ZodXID:Cs,$brand:bo,$constructor:c,$input:Ma,$output:Da,Doc:Ns,JSONSchema:id,JSONSchemaGenerator:Mn,_any:su,_array:gu,_base64:Nr,_base64url:Er,_bigint:Qa,_boolean:Ha,_catch:Kh,_cidrv4:Tr,_cidrv6:kr,_coercedBigint:eu,_coercedBoolean:Xa,_coercedDate:cu,_coercedNumber:qa,_coercedString:ja,_cuid:_r,_cuid2:$r,_custom:mn,_date:uu,_default:Vh,_discriminatedUnion:Bh,_e164:Ur,_email:fr,_emoji:vr,_endsWith:Rr,_enum:Rh,_file:wu,_float32:Ya,_float64:Ja,_gt:Ae,_gte:G,_guid:qt,_includes:Pr,_int:Va,_int32:Ka,_int64:tu,_interface:Th,_intersection:Dh,_ipv4:Sr,_ipv6:Or,_isoDate:Ca,_isoDateTime:Ra,_isoDuration:Fa,_isoTime:La,_jwt:Ar,_ksuid:zr,_lazy:Qh,_length:pn,_literal:Lh,_looseInterface:Nh,_looseObject:Ah,_lowercase:Dr,_lt:Ue,_lte:ee,_map:Ph,_max:ee,_maxLength:fn,_maxSize:dn,_mime:Cr,_min:G,_minLength:Ke,_minSize:yt,_multipleOf:gt,_nan:lu,_nanoid:br,_nativeEnum:Ch,_negative:du,_never:hn,_nonnegative:pu,_nonoptional:Yh,_nonpositive:fu,_normalize:Lr,_null:ou,_nullable:qh,_number:Wa,_object:Eh,_optional:Wh,_overwrite:Me,_parse:Hn,_parseAsync:Qn,_pipe:Gh,_positive:hu,_promise:ed,_property:mu,_readonly:Hh,_record:Mh,_refine:td,_regex:Br,_safeParse:Xn,_safeParseAsync:er,_set:jh,_size:Zr,_startsWith:jr,_strictInterface:kh,_strictObject:Uh,_string:Pa,_stringbool:vu,_success:Jh,_symbol:ru,_templateLiteral:Xh,_toLowerCase:Wr,_toUpperCase:qr,_transform:Fh,_trim:Fr,_tuple:yu,_uint32:Ga,_uint64:nu,_ulid:Ir,_undefined:iu,_union:Zh,_unknown:ln,_uppercase:Mr,_url:wr,_uuid:pr,_uuidv4:mr,_uuidv6:gr,_uuidv7:yr,_void:au,_xid:xr,clone:ne,config:V,flattenError:ko,formatError:No,function:bu,globalConfig:En,globalRegistry:we,isValidJWT:ea,locales:Ba,parse:Un,parseAsync:An,prettifyError:Ao,regexes:ls,registry:dr,safeParse:nh,safeParseAsync:rh,toDotPath:Uo,toJSONSchema:_u,treeifyError:Eo,util:th,version:Es},Symbol.toStringTag,{value:"Module"})),$u=c("ZodISODateTime",(t,e)=>{Fs.init(t,e),P.init(t,e)});function Iu(t){return Ra($u,t)}const xu=c("ZodISODate",(t,e)=>{Ws.init(t,e),P.init(t,e)});function zu(t){return Ca(xu,t)}const Su=c("ZodISOTime",(t,e)=>{qs.init(t,e),P.init(t,e)});function Ou(t){return La(Su,t)}const Tu=c("ZodISODuration",(t,e)=>{Vs.init(t,e),P.init(t,e)});function ku(t){return Fa(Tu,t)}const sd=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:xu,ZodISODateTime:$u,ZodISODuration:Tu,ZodISOTime:Su,date:zu,datetime:Iu,duration:ku,time:Ou},Symbol.toStringTag,{value:"Module"}));class zt extends ue{format(e){return No(this,e)}flatten(e){return ko(this,e)}addIssue(e){this.issues.push(e)}addIssues(e){this.issues.push(...e)}get isEmpty(){return this.issues.length===0}}const Nu=Hn.bind({Error:zt}),Eu=Xn.bind({Error:zt}),Uu=Qn.bind({Error:zt}),Au=er.bind({Error:zt});function ad(t){return ja(gn,t)}function ud(t){return qa(ci,t)}function cd(t){return Xa(yn,t)}function Zu(t){return eu(wn,t)}function ld(t){return cu(di,t)}const hd=Object.freeze(Object.defineProperty({__proto__:null,bigint:Zu,boolean:cd,date:ld,number:ud,string:ad},Symbol.toStringTag,{value:"Module"})),$=c("ZodType",(t,e)=>(b.init(t,e),t.def=e,t._def=e,t.check=(...n)=>t.clone({...e,checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),t.clone=n=>ne(t,n),t.brand=()=>t,t.register=(n,r)=>(n.add(t,r),t),t.parse=(n,r)=>Nu(t,n,r),t.safeParse=(n,r)=>Eu(t,n,r),t.parseAsync=async(n,r)=>Uu(t,n,r),t.safeParseAsync=async(n,r)=>Au(t,n,r),t.spa=t.safeParseAsync,t.refine=(n,r)=>t.check(gc(n,r)),t.superRefine=n=>t.check(yc(n)),t.overwrite=n=>t.check(Me(n)),t.optional=n=>Yt(t,n),t.nullable=n=>Jt(t,n),t.nullish=()=>Yt(Jt(t)),t.nonoptional=n=>ic(t,n),t.array=()=>Ot(t),t.or=n=>j([t,n]),t.and=n=>Yu(t,n),t.transform=n=>Kt(t,mi(n)),t.default=(n,r)=>rc(t,n,r),t.catch=n=>ac(t,n),t.pipe=n=>Kt(t,n),t.readonly=()=>lc(t),t.describe=n=>{const r=t.clone(),i={...we.get(t)??{},description:n};return delete i.id,we.add(r,i),r},Object.defineProperty(t,"description",{get(){var n;return(n=we.get(t))==null?void 0:n.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return we.get(t);const r=t.clone();return we.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),gn=c("ZodString",(t,e)=>{or.init(t,e),$.init(t,e),t.format=t._zod.computed.format??null,t.minLength=t._zod.computed.minimum??null,t.maxLength=t._zod.computed.maximum??null,t.email=n=>t.check(fr(Vr,n)),t.url=n=>t.check(wr(Yr,n)),t.jwt=n=>t.check(Ar(ui,n)),t.emoji=n=>t.check(vr(Jr,n)),t.guid=n=>t.check(qt(Vt,n)),t.uuid=n=>t.check(pr(he,n)),t.uuidv4=n=>t.check(mr(he,n)),t.uuidv6=n=>t.check(gr(he,n)),t.uuidv7=n=>t.check(yr(he,n)),t.nanoid=n=>t.check(br(Kr,n)),t.guid=n=>t.check(qt(Vt,n)),t.cuid=n=>t.check(_r(Gr,n)),t.cuid2=n=>t.check($r(Hr,n)),t.ulid=n=>t.check(Ir(Xr,n)),t.base64=n=>t.check(Nr(oi,n)),t.base64url=n=>t.check(Er(si,n)),t.xid=n=>t.check(xr(Qr,n)),t.ksuid=n=>t.check(zr(ei,n)),t.ipv4=n=>t.check(Sr(ti,n)),t.ipv6=n=>t.check(Or(ni,n)),t.cidrv4=n=>t.check(Tr(ri,n)),t.cidrv6=n=>t.check(kr(ii,n)),t.e164=n=>t.check(Ur(ai,n)),t.datetime=n=>t.check(Iu(n)),t.date=n=>t.check(zu(n)),t.time=n=>t.check(Ou(n)),t.duration=n=>t.check(ku(n)),t.regex=(...n)=>t.check(Br(...n)),t.includes=(...n)=>t.check(Pr(...n)),t.startsWith=n=>t.check(jr(n)),t.endsWith=n=>t.check(Rr(n)),t.min=(...n)=>t.check(Ke(...n)),t.max=(...n)=>t.check(fn(...n)),t.length=(...n)=>t.check(pn(...n)),t.nonempty=(...n)=>t.check(Ke(1,...n)),t.lowercase=n=>t.check(Dr(n)),t.uppercase=n=>t.check(Mr(n)),t.trim=()=>t.check(Fr()),t.normalize=(...n)=>t.check(Lr(...n)),t.toLowerCase=()=>t.check(Wr()),t.toUpperCase=()=>t.check(qr())});function N(t){return Pa(gn,t)}const P=c("ZodStringFormat",(t,e)=>{D.init(t,e),gn.init(t,e)}),Vr=c("ZodEmail",(t,e)=>{Zs.init(t,e),P.init(t,e)});function dd(t){return fr(Vr,t)}const Vt=c("ZodGUID",(t,e)=>{Us.init(t,e),P.init(t,e)});function fd(t){return qt(Vt,t)}const he=c("ZodUUID",(t,e)=>{As.init(t,e),P.init(t,e)});function pd(t){return pr(he,t)}function md(t){return mr(he,t)}function gd(t){return gr(he,t)}function yd(t){return yr(he,t)}const Yr=c("ZodURL",(t,e)=>{Bs.init(t,e),P.init(t,e)});function wd(t){return wr(Yr,t)}const Jr=c("ZodEmoji",(t,e)=>{Ds.init(t,e),P.init(t,e)});function vd(t){return vr(Jr,t)}const Kr=c("ZodNanoID",(t,e)=>{Ms.init(t,e),P.init(t,e)});function bd(t){return br(Kr,t)}const Gr=c("ZodCUID",(t,e)=>{Ps.init(t,e),P.init(t,e)});function _d(t){return _r(Gr,t)}const Hr=c("ZodCUID2",(t,e)=>{js.init(t,e),P.init(t,e)});function $d(t){return $r(Hr,t)}const Xr=c("ZodULID",(t,e)=>{Rs.init(t,e),P.init(t,e)});function Id(t){return Ir(Xr,t)}const Qr=c("ZodXID",(t,e)=>{Cs.init(t,e),P.init(t,e)});function xd(t){return xr(Qr,t)}const ei=c("ZodKSUID",(t,e)=>{Ls.init(t,e),P.init(t,e)});function zd(t){return zr(ei,t)}const ti=c("ZodIPv4",(t,e)=>{Ys.init(t,e),P.init(t,e)});function Sd(t){return Sr(ti,t)}const ni=c("ZodIPv6",(t,e)=>{Js.init(t,e),P.init(t,e)});function Od(t){return Or(ni,t)}const ri=c("ZodCIDRv4",(t,e)=>{Ks.init(t,e),P.init(t,e)});function Td(t){return Tr(ri,t)}const ii=c("ZodCIDRv6",(t,e)=>{Gs.init(t,e),P.init(t,e)});function kd(t){return kr(ii,t)}const oi=c("ZodBase64",(t,e)=>{Hs.init(t,e),P.init(t,e)});function Nd(t){return Nr(oi,t)}const si=c("ZodBase64URL",(t,e)=>{Xs.init(t,e),P.init(t,e)});function Ed(t){return Er(si,t)}const ai=c("ZodE164",(t,e)=>{Qs.init(t,e),P.init(t,e)});function Ud(t){return Ur(ai,t)}const ui=c("ZodJWT",(t,e)=>{ta.init(t,e),P.init(t,e)});function Ad(t){return Ar(ui,t)}const ci=c("ZodNumber",(t,e)=>{sr.init(t,e),$.init(t,e),t.gt=(n,r)=>t.check(Ae(n,r)),t.gte=(n,r)=>t.check(G(n,r)),t.min=(n,r)=>t.check(G(n,r)),t.lt=(n,r)=>t.check(Ue(n,r)),t.lte=(n,r)=>t.check(ee(n,r)),t.max=(n,r)=>t.check(ee(n,r)),t.int=n=>t.check(jn(n)),t.safe=n=>t.check(jn(n)),t.positive=n=>t.check(Ae(0,n)),t.nonnegative=n=>t.check(G(0,n)),t.negative=n=>t.check(Ue(0,n)),t.nonpositive=n=>t.check(ee(0,n)),t.multipleOf=(n,r)=>t.check(gt(n,r)),t.step=(n,r)=>t.check(gt(n,r)),t.finite=()=>t,t.minValue=t._zod.computed.minimum??null,t.maxValue=t._zod.computed.maximum??null,t.isInt=(t._zod.computed.format??"").includes("int")||Number.isSafeInteger(t._zod.computed.multipleOf??.5),t.isFinite=!0,t.format=t._zod.computed.format??null});function _(t){return Wa(ci,t)}const Ge=c("ZodNumberFormat",(t,e)=>{na.init(t,e),$.init(t,e)});function jn(t){return Va(Ge,t)}function Zd(t){return Ya(Ge,t)}function Bd(t){return Ja(Ge,t)}function Dd(t){return Ka(Ge,t)}function Md(t){return Ga(Ge,t)}const yn=c("ZodBoolean",(t,e)=>{ar.init(t,e),$.init(t,e)});function K(t){return Ha(yn,t)}const wn=c("ZodBigInt",(t,e)=>{ur.init(t,e),$.init(t,e),t.gte=(n,r)=>t.check(G(n,r)),t.min=(n,r)=>t.check(G(n,r)),t.gt=(n,r)=>t.check(Ae(n,r)),t.gte=(n,r)=>t.check(G(n,r)),t.min=(n,r)=>t.check(G(n,r)),t.lt=(n,r)=>t.check(Ue(n,r)),t.lte=(n,r)=>t.check(ee(n,r)),t.max=(n,r)=>t.check(ee(n,r)),t.positive=n=>t.check(Ae(BigInt(0),n)),t.negative=n=>t.check(Ue(BigInt(0),n)),t.nonpositive=n=>t.check(ee(BigInt(0),n)),t.nonnegative=n=>t.check(G(BigInt(0),n)),t.multipleOf=(n,r)=>t.check(gt(n,r)),t.minValue=t._zod.computed.minimum??null,t.maxValue=t._zod.computed.maximum??null,t.format=t._zod.computed.format??null});function fe(t){return Qa(wn,t)}const li=c("ZodBigIntFormat",(t,e)=>{ra.init(t,e),wn.init(t,e)});function Pd(t){return tu(li,t)}function jd(t){return nu(li,t)}const Bu=c("ZodSymbol",(t,e)=>{ia.init(t,e),$.init(t,e)});function Du(t){return ru(Bu,t)}const Mu=c("ZodUndefined",(t,e)=>{oa.init(t,e),$.init(t,e)});function Pu(t){return iu(Mu,t)}const ju=c("ZodNull",(t,e)=>{sa.init(t,e),$.init(t,e)});function St(t){return ou(ju,t)}const Ru=c("ZodAny",(t,e)=>{aa.init(t,e),$.init(t,e)});function wt(t){return su(Ru,t)}const hi=c("ZodUnknown",(t,e)=>{xt.init(t,e),$.init(t,e)});function $e(t){return ln(hi,t)}const Cu=c("ZodNever",(t,e)=>{an.init(t,e),$.init(t,e)});function He(t){return hn(Cu,t)}const Lu=c("ZodVoid",(t,e)=>{ua.init(t,e),$.init(t,e)});function Rd(t){return au(Lu,t)}const di=c("ZodDate",(t,e)=>{ca.init(t,e),$.init(t,e),t.min=(r,i)=>t.check(G(r,i)),t.max=(r,i)=>t.check(ee(r,i));const n=t._zod.computed;t.minDate=n.minimum?new Date(n.minimum):null,t.maxDate=n.maximum?new Date(n.maximum):null});function Cd(t){return uu(di,t)}const Fu=c("ZodArray",(t,e)=>{la.init(t,e),$.init(t,e),t.element=e.element,t.min=(n,r)=>t.check(Ke(n,r)),t.nonempty=n=>t.check(Ke(1,n)),t.max=(n,r)=>t.check(fn(n,r)),t.length=(n,r)=>t.check(pn(n,r))});function Ot(t,e){return gu(Fu,t,e)}const Ld=c("ZodObjectLike",(t,e)=>{un.init(t,e),$.init(t,e)});function Fd(t){const e=t._zod.def.type==="interface"?ze(t._zod.def.shape).shape:t._zod.def.shape;return Xu(Object.keys(e))}const Tt=c("ZodInterface",(t,e)=>{Bn.init(t,e),$.init(t,e),t.keyof=()=>F(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.loose=()=>t.clone({...t._zod.def,catchall:$e()}),t.strict=()=>t.clone({...t._zod.def,catchall:He()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>n instanceof Bn?mt(t,n):mt(t,fi(n)),t.merge=n=>Oe(t,n),t.pick=n=>en(t,n),t.omit=n=>tn(t,n),t.partial=(...n)=>nn(Nt,t,n[0]),t.required=(...n)=>rn(Et,t,n[0])});function fi(t,e,n=Tt){const r=pe(()=>ze(t)),i={type:"interface",get shape(){const o=r.value.shape;return ae(this,"shape",o),o},get optional(){return r.value.optional},...f(e)};return new n(i)}function Wd(t,e){const n=pe(()=>ze(t)),r={type:"interface",get shape(){const i=n.value.shape;return ae(this,"shape",i),i},get optional(){return n.value.optional},catchall:He(),...f(e)};return new Tt(r)}function qd(t,e){const n=pe(()=>ze(t)),r={type:"interface",get optional(){return n.value.optional},get shape(){const i=n.value.shape;return ae(this,"shape",i),i},catchall:$e(),...f(e)};return new Tt(r)}const Xe=c("ZodObject",(t,e)=>{ha.init(t,e),$.init(t,e),t.shape=e.shape,t.keyof=()=>F(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:$e()}),t.loose=()=>t.clone({...t._zod.def,catchall:$e()}),t.strict=()=>t.clone({...t._zod.def,catchall:He()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>n instanceof Xe?mt(t,n):mt(t,x(n)),t.merge=n=>Oe(t,n),t.pick=n=>en(t,n),t.omit=n=>tn(t,n),t.partial=(...n)=>nn(Nt,t,n[0]),t.required=(...n)=>rn(Et,t,n[0])});function x(t,e){const n={type:"object",shape:t??{},get optional(){return De(t??{})},...f(e)};return new Xe(n)}function Vd(t,e){return new Xe({type:"object",shape:t,get optional(){return De(t)},catchall:He(),...f(e)})}function Yd(t,e){return new Xe({type:"object",shape:t,get optional(){return De(t)},catchall:$e(),...f(e)})}function Jd(t,e){return e instanceof b?Oe(t,e):t instanceof Tt?Oe(t,fi(e)):t instanceof Xe?Oe(t,x(e)):To(t,e)}function Kd(t,e){return Oe(t,e)}function Gd(t,e){return en(t,e)}function Hd(t,e){return tn(t,e)}function Xd(t,e){return nn(Nt,t,e)}function Qd(t,e){return rn(Et,t,e)}const Wu=c("ZodUnion",(t,e)=>{cr.init(t,e),$.init(t,e),t.options=e.options});function j(t,e){return new Wu({type:"union",options:t,...f(e)})}const qu=c("ZodDiscriminatedUnion",(t,e)=>{fa.init(t,e),$.init(t,e)});function ef(...t){typeof t[0]=="string"&&(t=t.slice(1));const[e,n]=t;return new qu({type:"union",options:e,...f(n)})}const Vu=c("ZodIntersection",(t,e)=>{pa.init(t,e),$.init(t,e)});function Yu(t,e,n){return new Vu({type:"intersection",left:t,right:e,...f(n)})}const Ju=c("ZodTuple",(t,e)=>{cn.init(t,e),$.init(t,e),t.rest=n=>t.clone({...t._zod.def,rest:n})});function kt(t,e,n){const r=e instanceof b,i=r?n:e,o=r?e:null;return new Ju({type:"tuple",items:t,rest:o,...f(i)})}const pi=c("ZodRecord",(t,e)=>{ma.init(t,e),$.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function vn(t,e,n){return new pi({type:"record",keyType:t,valueType:e,...f(n)})}function tf(t,e,n){return new pi({type:"record",keyType:j([t,He()]),valueType:e,...f(n)})}const Ku=c("ZodMap",(t,e)=>{ga.init(t,e),$.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function nf(t,e,n){return new Ku({type:"map",keyType:t,valueType:e,...f(n)})}const Gu=c("ZodSet",(t,e)=>{ya.init(t,e),$.init(t,e),t.min=(...n)=>t.check(yt(...n)),t.nonempty=n=>t.check(yt(1,n)),t.max=(...n)=>t.check(dn(...n)),t.size=(...n)=>t.check(Zr(...n))});function rf(t,e){return new Gu({type:"set",valueType:t,...f(e)})}const vt=c("ZodEnum",(t,e)=>{wa.init(t,e),$.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{const o={};for(const s of r)if(n.has(s))o[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new vt({...e,checks:[],...f(i),entries:o})},t.exclude=(r,i)=>{const o={...e.entries};for(const s of r)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new vt({...e,checks:[],...f(i),entries:o})}});function F(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new vt({type:"enum",entries:n,...f(e)})}function of(t,e){return new vt({type:"enum",entries:t,...f(e)})}const Hu=c("ZodLiteral",(t,e)=>{va.init(t,e),$.init(t,e),t.values=new Set(e.values)});function Xu(t,e){return new Hu({type:"literal",values:Array.isArray(t)?t:[t],...f(e)})}const Qu=c("ZodFile",(t,e)=>{ba.init(t,e),$.init(t,e),t.min=(n,r)=>t.check(yt(n,r)),t.max=(n,r)=>t.check(dn(n,r)),t.mime=(n,r)=>t.check(Cr(n,r))});function sf(t){return wu(Qu,t)}const ec=c("ZodTransform",(t,e)=>{_a.init(t,e),$.init(t,e),t._zod.parse=(n,r)=>{n.addIssue=o=>{if(typeof o=="string")n.issues.push(Ye(o,n.value,e));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!e.abort),n.issues.push(Ye(s))}};const i=e.transform(n.value,n);return i instanceof Promise?i.then(o=>(n.value=o,n)):(n.value=i,n)}});function mi(t,e){return new ec({type:"transform",transform:t,...f(e)})}const Nt=c("ZodOptional",(t,e)=>{$a.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Yt(t,e){return new Nt({type:"optional",innerType:t,...f(e)})}const tc=c("ZodNullable",(t,e)=>{Ia.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Jt(t,e){return new tc({type:"nullable",innerType:t,...f(e)})}function af(t){return Yt(Jt(t))}const nc=c("ZodDefault",(t,e)=>{xa.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function rc(t,e,n){return new nc({type:"default",defaultValue:typeof e=="function"?e:()=>e,innerType:t,...f(n)})}const Et=c("ZodNonOptional",(t,e)=>{za.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ic(t,e){return new Et({type:"nonoptional",innerType:t,...f(e)})}const oc=c("ZodSuccess",(t,e)=>{Sa.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType});function uf(t,e){return new oc({type:"success",innerType:t,...f(e)})}const sc=c("ZodCatch",(t,e)=>{Oa.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function ac(t,e,n){return new sc({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e,...f(n)})}const uc=c("ZodNaN",(t,e)=>{Ta.init(t,e),$.init(t,e)});function cf(t){return lu(uc,t)}const gi=c("ZodPipe",(t,e)=>{lr.init(t,e),$.init(t,e),t.in=e.in,t.out=e.out});function Kt(t,e,n){return new gi({type:"pipe",in:t,out:e,...f(n)})}const cc=c("ZodReadonly",(t,e)=>{ka.init(t,e),$.init(t,e)});function lc(t,e){return new cc({type:"readonly",innerType:t,...f(e)})}const hc=c("ZodTemplateLiteral",(t,e)=>{Na.init(t,e),$.init(t,e)});function lf(t,e){return new hc({type:"template_literal",parts:t,...f(e)})}const dc=c("ZodLazy",(t,e)=>{Ua.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.getter()});function fc(t){return new dc({type:"lazy",getter:t})}const pc=c("ZodPromise",(t,e)=>{Ea.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType});function hf(t,e){return new pc({type:"promise",innerType:t,...f(e)})}const bn=c("ZodCustom",(t,e)=>{Aa.init(t,e),$.init(t,e)});function mc(t,e){const n=new C({check:"custom",...f(e)});return n._zod.check=t,n}function df(t,e){return mn(bn,t??(()=>!0),e)}function gc(t,e={}){return mn(bn,t,e)}function yc(t,e){const n=mc(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(Ye(i,r.value,n._zod.def));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),r.issues.push(Ye(o))}},t(r.value,r)),e);return n}function Z(t,e={error:`Input not instance of ${t.name}`}){return new bn({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...f(e)})}const ff=vu.bind(null,{Pipe:gi,Boolean:yn,Unknown:hi});function pf(t){const e=fc(()=>j([N(t),_(),K(),St(),Ot(e),vn(N(),e)]));return e}function mf(t,e,n){return Kt(mi(t,n),e,n)}const gf={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},yf=Object.freeze({status:"aborted"}),wf=yf;function vf(t){V({customError:t})}function bf(){return V().customError}V(Za());const je=Object.freeze(Object.defineProperty({__proto__:null,$brand:bo,$input:Ma,$output:Da,NEVER:wf,ZodAny:Ru,ZodArray:Fu,ZodBase64:oi,ZodBase64URL:si,ZodBigInt:wn,ZodBigIntFormat:li,ZodBoolean:yn,ZodCIDRv4:ri,ZodCIDRv6:ii,ZodCUID:Gr,ZodCUID2:Hr,ZodCatch:sc,ZodCustom:bn,ZodDate:di,ZodDefault:nc,ZodDiscriminatedUnion:qu,ZodE164:ai,ZodEmail:Vr,ZodEmoji:Jr,ZodEnum:vt,ZodError:zt,ZodFile:Qu,ZodGUID:Vt,ZodIPv4:ti,ZodIPv6:ni,ZodInterface:Tt,ZodIntersection:Vu,ZodIssueCode:gf,ZodJWT:ui,ZodKSUID:ei,ZodLazy:dc,ZodLiteral:Hu,ZodMap:Ku,ZodNaN:uc,ZodNanoID:Kr,ZodNever:Cu,ZodNonOptional:Et,ZodNull:ju,ZodNullable:tc,ZodNumber:ci,ZodNumberFormat:Ge,ZodObject:Xe,ZodObjectLike:Ld,ZodOptional:Nt,ZodPipe:gi,ZodPromise:pc,ZodReadonly:cc,ZodRecord:pi,ZodSet:Gu,ZodString:gn,ZodStringFormat:P,ZodSuccess:oc,ZodSymbol:Bu,ZodTemplateLiteral:hc,ZodTransform:ec,ZodTuple:Ju,ZodType:$,ZodULID:Xr,ZodURL:Yr,ZodUUID:he,ZodUndefined:Mu,ZodUnion:Wu,ZodUnknown:hi,ZodVoid:Lu,ZodXID:Qr,_default:rc,any:wt,array:Ot,base64:Nd,base64url:Ed,bigint:fe,boolean:K,catch:ac,check:mc,cidrv4:Td,cidrv6:kd,clone:ne,coerce:hd,config:V,core:od,cuid:_d,cuid2:$d,custom:df,date:Cd,discriminatedUnion:ef,e164:Ud,email:dd,emoji:vd,endsWith:Rr,enum:F,extend:Jd,file:sf,float32:Zd,float64:Bd,function:bu,getErrorMap:bf,globalRegistry:we,gt:Ae,gte:G,guid:fd,includes:Pr,instanceof:Z,int:jn,int32:Dd,int64:Pd,interface:fi,intersection:Yu,ipv4:Sd,ipv6:Od,iso:sd,json:pf,jwt:Ad,keyof:Fd,ksuid:zd,lazy:fc,length:pn,literal:Xu,locales:Ba,looseInterface:qd,looseObject:Yd,lowercase:Dr,lt:Ue,lte:ee,map:nf,maxLength:fn,maxSize:dn,merge:Kd,mime:Cr,minLength:Ke,minSize:yt,multipleOf:gt,nan:cf,nanoid:bd,nativeEnum:of,negative:du,never:He,nonnegative:pu,nonoptional:ic,nonpositive:fu,normalize:Lr,null:St,nullable:Jt,nullish:af,number:_,object:x,omit:Hd,optional:Yt,overwrite:Me,parse:Nu,parseAsync:Uu,partial:Xd,partialRecord:tf,pick:Gd,pipe:Kt,positive:hu,preprocess:mf,prettifyError:Ao,promise:hf,property:mu,readonly:lc,record:vn,refine:gc,regex:Br,regexes:ls,registry:dr,required:Qd,safeParse:Eu,safeParseAsync:Au,set:rf,setErrorMap:vf,size:Zr,startsWith:jr,strictInterface:Wd,strictObject:Vd,string:N,stringbool:ff,success:uf,superRefine:yc,symbol:Du,templateLiteral:lf,toJSONSchema:_u,toLowerCase:Wr,toUpperCase:qr,transform:mi,treeifyError:Eo,trim:Fr,tuple:kt,uint32:Md,uint64:jd,ulid:Id,undefined:Pu,union:j,unknown:$e,uppercase:Mr,url:wd,uuid:pd,uuidv4:md,uuidv6:gd,uuidv7:yd,void:Rd,xid:xd},Symbol.toStringTag,{value:"Module"})),_f=t=>t!=null&&typeof t=="object"&&"toString"in t,$f=(t,e=!1)=>{const n=_f(t)?"stringer":typeof t;let r;switch(n){case"string":r=(i,o)=>i.localeCompare(o);break;case"stringer":r=(i,o)=>i.toString().localeCompare(o.toString());break;case"number":r=(i,o)=>Number(i)-Number(o);break;case"bigint":r=(i,o)=>BigInt(i)-BigInt(o)>0n?1:-1;break;case"boolean":r=(i,o)=>Number(i)-Number(o);break;case"undefined":r=()=>0;break;default:return console.warn(`sortFunc: unknown type ${n}`),()=>-1}return e?If(r):r},If=t=>(e,n)=>t(n,e),_n=kt([_(),_()]);kt([fe(),fe()]);const yi=x({width:_(),height:_()}),xf=x({signedWidth:_(),signedHeight:_()}),zf=["width","height"];F(zf);const Sf=["start","center","end"],Of=["signedWidth","signedHeight"];F(Of);const bt=x({x:_(),y:_()}),wc=x({clientX:_(),clientY:_()}),vc=["x","y"],bc=F(vc),_c=["top","right","bottom","left"];F(_c);const wi=["left","right"],$c=F(wi),vi=["top","bottom"],Ic=F(vi),xc=["center"],Ki=F(xc),Tf=[..._c,...xc],zc=F(Tf);F(Sf);const kf=["first","last"];F(kf);const Nf=x({lower:_(),upper:_()}),Ef=x({lower:fe(),upper:fe()});j([Nf,_n]);j([Ef,_n]);F([...bc.options,...zc.options]);j([bc,zc,Z(String)]);const Uf=t=>typeof t=="bigint"||t instanceof BigInt,Re=(t,e)=>Uf(t)?t.valueOf()*BigInt(e.valueOf()):t.valueOf()*Number(e.valueOf()),Te=(t,e)=>{const n={};if(typeof t=="number"||typeof t=="bigint")e!=null?(n.lower=t,n.upper=e):(n.lower=typeof t=="bigint"?0n:0,n.upper=t);else if(Array.isArray(t)){if(t.length!==2)throw new Error("bounds: expected array of length 2");[n.lower,n.upper]=t}else return Gi(t);return Gi(n)},Gi=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t,Hi=(t,e)=>{const n=Te(t);return e<n.lower?n.lower:e>=n.upper?n.upper-(typeof n.upper=="number"?1:1n):e},bi=t=>vc.includes(t)?t:vi.includes(t)?"y":"x";x({x:$c.or(Ki),y:Ic.or(Ki)});const Af=x({x:$c,y:Ic}),_i=Object.freeze({x:"left",y:"top"}),Zf=Object.freeze({x:"right",y:"top"}),Sc=Object.freeze({x:"left",y:"bottom"}),Bf=Object.freeze({x:"right",y:"bottom"}),Df=Object.freeze({x:"center",y:"top"}),Mf=Object.freeze({x:"center",y:"bottom"}),Pf=Object.freeze({x:"right",y:"center"}),jf=Object.freeze({x:"left",y:"center"}),Oc=(t,e)=>t.x===e.x&&t.y===e.y,Rf=t=>[t.x,t.y],Rn=j([_(),bt,_n,yi,xf,wc]),B=(t,e)=>{if(typeof t=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return t==="x"?{x:e,y:0}:{x:0,y:e}}return typeof t=="number"?{x:t,y:e??t}:Array.isArray(t)?{x:t[0],y:t[1]}:"signedWidth"in t?{x:t.signedWidth,y:t.signedHeight}:"clientX"in t?{x:t.clientX,y:t.clientY}:"width"in t?{x:t.width,y:t.height}:{x:t.x,y:t.y}},se=Object.freeze({x:0,y:0}),Tc=Object.freeze({x:1,y:1}),Cf=Object.freeze({x:1/0,y:1/0}),Lf=Object.freeze({x:NaN,y:NaN}),Gt=(t,e,n=0)=>{const r=B(t),i=B(e);return n===0?r.x===i.x&&r.y===i.y:Math.abs(r.x-i.x)<=n&&Math.abs(r.y-i.y)<=n},Ff=t=>Gt(t,se),$i=(t,e,n)=>{const r=B(t),i=B(e,n);return{x:r.x*i.x,y:r.y*i.y}},kc=(t,e)=>{const n=B(t);return{x:n.x+e,y:n.y}},Nc=(t,e)=>{const n=B(t);return{x:n.x,y:n.y+e}},_t=(t,e,n,...r)=>typeof e=="string"&&typeof n=="number"?e==="x"?kc(t,n):Nc(t,n):[t,e,n??se,...r].reduce((i,o)=>{const s=B(o);return{x:i.x+s.x,y:i.y+s.y}},se),Wf=(t,e,n)=>{const r=B(t);return e==="x"?{x:n,y:r.y}:{x:r.x,y:n}},qf=(t,e)=>{const n=B(t),r=B(e);return Math.sqrt((n.x-r.x)**2+(n.y-r.y)**2)},Vf=(t,e)=>{const n=B(t),r=B(e);return{x:r.x-n.x,y:r.y-n.y}},Yf=t=>{const e=B(t);return Number.isNaN(e.x)||Number.isNaN(e.y)},Jf=t=>{const e=B(t);return Number.isFinite(e.x)&&Number.isFinite(e.y)},Kf=t=>{const e=B(t);return[e.x,e.y]},Gf=t=>{const e=B(t);return{left:e.x,top:e.y}},Cn=(t,e=0)=>{const n=B(t);return{x:Number(n.x.toFixed(e)),y:Number(n.y.toFixed(e))}},it=(t,e)=>{const n=B(t),r=B(e);return{x:n.x-r.x,y:n.y-r.y}},ot=t=>{const e=B(t),n=Math.hypot(e.x,e.y);return n===0?{x:0,y:0}:{x:-e.y/n,y:e.x/n}},Ec=t=>{const e=B(t),n=Math.hypot(e.x,e.y);return n===0?{x:0,y:0}:{x:e.x/n,y:e.y/n}},Uc=(...t)=>{const e=t.reduce((n,r)=>_t(n,r),se);return $i(e,1/t.length)},Hf=(t,e)=>{const n=[];for(let r=0;r<t.length;r++){const i=t[r];let o,s,a,l;if(r===0){const u=t[r+1],h=it(u,i);s=ot(h),a=s,l=e}else if(r===t.length-1){const u=t[r-1],h=it(i,u);o=ot(h),a=o,l=e}else{const u=t[r-1],h=t[r+1],d=it(i,u),y=it(h,i);o=ot(d),s=ot(y);const g=Math.acos((d.x*y.x+d.y*y.y)/(Math.hypot(d.x,d.y)*Math.hypot(y.x,y.y))),w=Math.sin(g/2);w===0?l=e:l=e/w,a=Ec(Uc(o,s))}n.push($i(a,l))}return n},Xf=t=>{const e=B(t);return{x:e.y,y:e.x}},Ac=Object.freeze(Object.defineProperty({__proto__:null,INFINITY:Cf,NAN:Lf,ONE:Tc,ZERO:se,average:Uc,calculateMiters:Hf,clientXY:wc,construct:B,couple:Kf,crudeZ:Rn,css:Gf,distance:qf,equals:Gt,isFinite:Jf,isNan:Yf,isZero:Ff,normal:ot,normalize:Ec,scale:$i,set:Wf,sub:it,swap:Xf,translate:_t,translateX:kc,translateY:Nc,translation:Vf,truncate:Cn,xy:bt},Symbol.toStringTag,{value:"Module"})),Dt=j([_(),N()]),Qf=x({top:Dt,left:Dt,width:Dt,height:Dt}),ep=x({left:_(),top:_(),right:_(),bottom:_()}),tp=x({one:bt,two:bt,root:Af}),Zc={one:se,two:se,root:_i},np={one:se,two:Tc,root:Sc},Bc=(t,e)=>({one:t.one,two:t.two,root:e??t.root}),M=(t,e,n=0,r=0,i)=>{const o={one:{...se},two:{...se},root:i??_i};if(typeof t=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return o.one={x:t,y:e},o.two={x:o.one.x+n,y:o.one.y+r},o}return"one"in t&&"two"in t&&"root"in t?{...t,root:i??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(o.one={x:t.left,y:t.top},o.two={x:t.right,y:t.bottom},o):(o.one=t,e==null?o.two={x:o.one.x+n,y:o.one.y+r}:typeof e=="number"?o.two={x:o.one.x+e,y:o.one.y+n}:"width"in e?o.two={x:o.one.x+e.width,y:o.one.y+e.height}:"signedWidth"in e?o.two={x:o.one.x+e.signedWidth,y:o.one.y+e.signedHeight}:o.two=e,o))},rp=(t,e,n)=>{const r=M(t);if(typeof e=="string"){if(n==null)throw new Error("Invalid arguments for resize");const i=bi(e);return M(r.one,void 0,i==="x"?n:Ie(r),i==="y"?n:xe(r),r.root)}return M(r.one,e,void 0,void 0,r.root)},ip=(t,e,n=!0)=>{const r=M(t);let i=(o,s)=>o<s;return n&&(i=(o,s)=>o<=s),"one"in e?i(ve(r),ve(e))&&i(ke(e),ke(r))&&i(be(r),be(e))&&i(Ne(e),Ne(r)):i(ve(r),e.x)&&i(e.x,ke(r))&&i(be(r),e.y)&&i(e.y,Ne(r))},op=(t,e)=>Gt(t.one,e.one)&&Gt(t.two,e.two)&&Oc(t.root,e.root),Dc=t=>({width:Ie(t),height:xe(t)}),sp=t=>({signedWidth:$n(t),signedHeight:In(t)}),ap=t=>({top:be(t),left:ve(t),width:Ie(t),height:xe(t)}),Ii=(t,e,n=!1)=>{const r=bi(e)==="y"?In(t):$n(t);return n?r:Math.abs(r)},me=(t,e)=>{const n=M(t);return{x:e.x==="center"?Ln(n).x:Ze(n,e.x),y:e.y==="center"?Ln(n).y:Ze(n,e.y)}},Ze=(t,e)=>{const n=M(t),r=Rf(n.root).includes(e)?Math.min:Math.max;return wi.includes(e)?r(n.one.x,n.two.x):r(n.one.y,n.two.y)},up=t=>t.one.x===t.two.x&&t.one.y===t.two.y,Ie=t=>Ii(t,"x"),xe=t=>Ii(t,"y"),$n=t=>{const e=M(t);return e.two.x-e.one.x},In=t=>{const e=M(t);return e.two.y-e.one.y},Mc=t=>me(t,_i),cp=t=>me(t,Df),lp=t=>me(t,Zf),hp=t=>me(t,Sc),dp=t=>me(t,Mf),fp=t=>me(t,Bf),pp=t=>me(t,jf),mp=t=>me(t,Pf),ke=t=>Ze(t,"right"),Ne=t=>Ze(t,"bottom"),ve=t=>Ze(t,"left"),be=t=>Ze(t,"top"),Ln=t=>_t(Mc(t),{x:$n(t)/2,y:In(t)/2}),xi=t=>{const e=M(t);return e.root.x==="left"?ve(e):ke(e)},zi=t=>{const e=M(t);return e.root.y==="top"?be(e):Ne(e)},gp=t=>({x:xi(t),y:zi(t)}),jt=t=>{const e=M(t);return{lower:e.one.x,upper:e.two.x}},Rt=t=>{const e=M(t);return{lower:e.one.y,upper:e.two.y}},yp=(t,e)=>Bc(t,e),wp=(t,e)=>{const n=M(t),r=wi.includes(e)?"x":vi.includes(e)?"y":null;if(r===null)throw new Error(`Invalid location: ${e}`);const i=e==="top"||e==="left"?Math.min:Math.max,o={...n.one},s={...n.two};return o[r]=i(n.one[r],n.two[r]),s[r]=i(n.one[r],n.two[r]),[o,s]},vp=(t,e)=>{const n=M(t),r=M(e),i=xi(r)+(Ie(r)-Ie(n))/2,o=zi(r)+(xe(r)-xe(n))/2;return M({x:i,y:o},Dc(n))},Pc=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,bp=t=>Ie(t)/xe(t),_p=(t,e,n)=>{if(typeof e=="string"){if(n==null)throw new Error("Undefined amount passed into box.translate");const i=bi(e);e=B(i,n)}const r=M(t);return M(_t(r.one,e),_t(r.two,e),void 0,void 0,r.root)},$p=(t,e)=>{const n=Math.max(ve(t),ve(e)),r=Math.max(be(t),be(e)),i=Math.min(ke(t),ke(e)),o=Math.min(Ne(t),Ne(e));return n>i||r>o?Zc:M({x:n,y:r},{x:i,y:o},void 0,void 0,t.root)},Ip=t=>Ie(t)*xe(t),xp=(t,e)=>{const n=M(t);return M(Cn(n.one,e),Cn(n.two,e),void 0,void 0,n.root)},zp=(t,e,n,r,i,o)=>{const s={x:t,y:e},a={x:t+n,y:e+r};return i.x!==o.x&&(i.x==="center"?(s.x-=n/2,a.x-=n/2):(s.x-=n,a.x-=n)),i.y!==o.y&&(i.y==="center"?(s.y-=r/2,a.y-=r/2):(s.y-=r,a.y-=r)),M(s,a,void 0,void 0,o)},Sp=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:np,ZERO:Zc,area:Ip,areaIsZero:up,aspect:bp,bottom:Ne,bottomCenter:dp,bottomLeft:hp,bottomRight:fp,box:tp,center:Ln,centerLeft:pp,centerRight:mp,construct:M,constructWithAlternateRoot:zp,contains:ip,copy:Bc,css:ap,cssBox:Qf,dim:Ii,dims:Dc,domRect:ep,edgePoints:wp,equals:op,height:xe,intersection:$p,isBox:Pc,left:ve,loc:Ze,positionInCenter:vp,reRoot:yp,resize:rp,right:ke,root:gp,signedDims:sp,signedHeight:In,signedWidth:$n,top:be,topCenter:cp,topLeft:Mc,topRight:lp,translate:_p,truncate:xp,width:Ie,x:xi,xBounds:jt,xyLoc:me,y:zi,yBounds:Rt},Symbol.toStringTag,{value:"Module"})),jc=x({signedWidth:_(),signedHeight:_()}),Op=j([yi,jc,bt,_n]),Tp={width:0,height:0},kp={width:1,height:1},te=(t,e)=>typeof t=="number"?{width:t,height:e??t}:Array.isArray(t)?{width:t[0],height:t[1]}:"x"in t?{width:t.x,height:t.y}:"signedWidth"in t?{width:t.signedWidth,height:t.signedHeight}:{...t},Np=(t,e)=>{if(e==null)return!1;const n=te(t),r=te(e);return n.width===r.width&&n.height===r.height},Ep=t=>{const e=te(t);return{width:e.height,height:e.width}},Up=t=>{const e=te(t);return`0 0 ${e.width} ${e.height}`},Ap=t=>{const e=te(t);return[e.width,e.height]},Zp=t=>({width:Math.max(...t.map(e=>te(e).width)),height:Math.max(...t.map(e=>te(e).height))}),Bp=t=>({width:Math.min(...t.map(e=>te(e).width)),height:Math.min(...t.map(e=>te(e).height))}),Dp=(t,e)=>{const n=te(t);return{width:n.width*e,height:n.height*e}},Ct=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:kp,ZERO:Tp,construct:te,couple:Ap,crude:Op,dimensions:yi,equals:Np,max:Zp,min:Bp,scale:Dp,signed:jc,svgViewBox:Up,swap:Ep},Symbol.toStringTag,{value:"Module"}));var Mp=Object.defineProperty,Pp=(t,e,n)=>e in t?Mp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,de=(t,e,n)=>Pp(t,typeof e!="symbol"?e+"":e,n);const jp=(t,e,n)=>e!==void 0&&t<e?e:n!==void 0&&t>n?n:t;x({offset:Rn,scale:Rn});x({offset:_(),scale:_()});const Rp=t=>(e,n,r,i)=>n==="dimension"?[e,r]:[e,i?r-t:r+t],Cp=t=>(e,n,r,i)=>[e,i?r/t:r*t],Lp=t=>(e,n,r)=>{if(e===null)return[t,r];const{lower:i,upper:o}=e,{lower:s,upper:a}=t,l=o-i,u=a-s;if(n==="dimension")return[t,r*(u/l)];const h=(r-i)*(u/l)+s;return[t,h]},Fp=t=>(e,n,r)=>[t,r],Wp=()=>(t,e,n)=>{if(t===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[t,n];const{lower:r,upper:i}=t;return[t,i-(n-r)]},qp=t=>(e,n,r)=>{const{lower:i,upper:o}=t;return r=jp(r,i,o),[e,r]},Fn=class st{constructor(){de(this,"ops",[]),de(this,"currBounds",null),de(this,"currType",null),de(this,"reversed",!1),this.ops=[]}static translate(e){return new st().translate(e)}static magnify(e){return new st().magnify(e)}static scale(e,n){return new st().scale(e,n)}translate(e){const n=this.new(),r=Rp(e);return r.type="translate",n.ops.push(r),n}magnify(e){const n=this.new(),r=Cp(e);return r.type="magnify",n.ops.push(r),n}scale(e,n){const r=Te(e,n),i=this.new(),o=Lp(r);return o.type="scale",i.ops.push(o),i}clamp(e,n){const r=Te(e,n),i=this.new(),o=qp(r);return o.type="clamp",i.ops.push(o),i}reBound(e,n){const r=Te(e,n),i=this.new(),o=Fp(r);return o.type="re-bound",i.ops.push(o),i}invert(){const e=Wp();e.type="invert";const n=this.new();return n.ops.push(e),n}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new st;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,n){return this.currBounds=null,this.ops.reduce(([r,i],o)=>o(r,e,i,this.reversed),[null,n])[1]}reverse(){const e=this.new();e.ops.reverse();const n=[];return e.ops.forEach((r,i)=>{if(r.type==="scale"||n.some(([s,a])=>i>=s&&i<=a))return;const o=e.ops.findIndex((s,a)=>s.type==="scale"&&a>i);o!==-1&&n.push([i,o])}),n.forEach(([r,i])=>{const o=e.ops.slice(r,i);o.unshift(e.ops[i]),e.ops.splice(r,i-r+1,...o)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};de(Fn,"IDENTITY",new Fn);let Xi=Fn;const Qi=class ce{constructor(e=new Xi,n=new Xi,r=null){de(this,"x"),de(this,"y"),de(this,"currRoot"),this.x=e,this.y=n,this.currRoot=r}static translate(e,n){return new ce().translate(e,n)}static translateX(e){return new ce().translateX(e)}static translateY(e){return new ce().translateY(e)}static clamp(e){return new ce().clamp(e)}static magnify(e){return new ce().magnify(e)}static scale(e){return new ce().scale(e)}static reBound(e){return new ce().reBound(e)}translate(e,n){const r=B(e,n),i=this.copy();return i.x=this.x.translate(r.x),i.y=this.y.translate(r.y),i}translateX(e){const n=this.copy();return n.x=this.x.translate(e),n}translateY(e){const n=this.copy();return n.y=this.y.translate(e),n}magnify(e){const n=this.copy();return n.x=this.x.magnify(e.x),n.y=this.y.magnify(e.y),n}scale(e){const n=this.copy();if(Pc(e)){const r=this.currRoot;return n.currRoot=e.root,r!=null&&!Oc(r,e.root)&&(r.x!==e.root.x&&(n.x=n.x.invert()),r.y!==e.root.y&&(n.y=n.y.invert())),n.x=n.x.scale(jt(e)),n.y=n.y.scale(Rt(e)),n}return n.x=n.x.scale(e.width),n.y=n.y.scale(e.height),n}reBound(e){const n=this.copy();return n.x=this.x.reBound(jt(e)),n.y=this.y.reBound(Rt(e)),n}clamp(e){const n=this.copy();return n.x=this.x.clamp(jt(e)),n.y=this.y.clamp(Rt(e)),n}copy(){const e=new ce;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)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return M(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}};de(Qi,"IDENTITY",new Qi);var Vp=Object.defineProperty,Yp=(t,e,n)=>e in t?Vp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,p=(t,e,n)=>Yp(t,typeof e!="symbol"?e+"":e,n);let Jp=(t,e=21)=>(n=e)=>{let r="",i=n|0;for(;i--;)r+=t[Math.random()*t.length|0];return r};const Kp="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Gp=Jp(Kp,11),Rc=()=>Gp(),Hp=Object.freeze(Object.defineProperty({__proto__:null,create:Rc},Symbol.toStringTag,{value:"Module"})),Xp=F(["static","dynamic"]),Cc=(t,e)=>{const n=new U(e);if(![A.DAY,A.HOUR,A.MINUTE,A.SECOND,A.MILLISECOND,A.MICROSECOND,A.NANOSECOND].some(i=>i.equals(n)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const r=t.valueOf()%n.valueOf();return t instanceof U?new U(r):new A(r)},T=class v{constructor(e,n="UTC"){if(p(this,"value"),p(this,"encodeValue",!0),e==null)this.value=v.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*v.MILLISECOND.valueOf();else if(typeof e=="string")this.value=v.parseDateTimeString(e,n).valueOf();else if(Array.isArray(e))this.value=v.parseDate(e);else{let r=BigInt(0);e instanceof Number&&(e=e.valueOf()),n==="local"&&(r=v.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=v.MAX:e=v.MIN)),this.value=BigInt(e.valueOf())+r}}static parseDate([e=1970,n=1,r=1]){const i=new Date(e,n-1,r,0,0,0,0);return new v(BigInt(i.getTime())*v.MILLISECOND.valueOf()).truncate(v.DAY).valueOf()}valueOf(){return this.value}static parseTimeString(e,n="UTC"){const[r,i,o]=e.split(":");let s="00",a="00";o!=null&&([s,a]=o.split("."));let l=v.hours(parseInt(r??"00")).add(v.minutes(parseInt(i??"00"))).add(v.seconds(parseInt(s??"00"))).add(v.milliseconds(parseInt(a??"00")));return n==="local"&&(l=l.add(v.utcOffset)),l.valueOf()}static parseDateTimeString(e,n="UTC"){if(!e.includes("/")&&!e.includes("-"))return v.parseTimeString(e,n);const r=new Date(e);return e.includes(":")||r.setUTCHours(0,0,0,0),new v(BigInt(r.getTime())*v.MILLISECOND.valueOf(),n).valueOf()}fString(e="ISO",n="UTC"){switch(e){case"ISODate":return this.toISOString(n).slice(0,10);case"ISOTime":return this.toISOString(n).slice(11,23);case"time":return this.timeString(!1,n);case"preciseTime":return this.timeString(!0,n);case"date":return this.dateString();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,n)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,n)}`;default:return this.toISOString(n)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(v.utcOffset).date().toISOString()}timeString(e=!1,n="UTC"){const r=this.toISOString(n);return e?r.slice(11,23):r.slice(11,19)}dateString(){const e=this.date(),n=e.toLocaleString("default",{month:"short"}),r=e.toLocaleString("default",{day:"numeric"});return`${n} ${r}`}static get utcOffset(){return new A(BigInt(new Date().getTimezoneOffset())*v.MINUTE.valueOf())}static since(e){return new v().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new v(e).valueOf()}span(e){return this.range(e).span}range(e){return new ft(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new v(e).valueOf()}afterEq(e){return this.valueOf()>=new v(e).valueOf()}before(e){return this.valueOf()<new v(e).valueOf()}beforeEq(e){return this.valueOf()<=new v(e).valueOf()}add(e){return new v(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new v(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(A.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(A.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(A.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(A.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(v.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(v.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getFullYear()}setYear(e){const n=this.date();return n.setFullYear(e),new v(n)}get month(){return this.date().getUTCMonth()}setMonth(e){const n=this.date();return n.setUTCMonth(e),new v(n)}get day(){return this.date().getUTCDate()}setDay(e){const n=this.date();return n.setUTCDate(e),new v(n)}get hour(){return this.date().getUTCHours()}setHour(e){const n=this.date();return n.setUTCHours(e),new v(n,"UTC")}get minute(){return this.date().getMinutes()}setMinute(e){const n=this.date();return n.setUTCMinutes(e),new v(n)}get second(){return this.date().getSeconds()}setSecond(e){const n=this.date();return n.setUTCSeconds(e),new v(n)}get millisecond(){return this.date().getMilliseconds()}setMillisecond(e){const n=this.date();return n.setMilliseconds(e),new v(n)}toString(){return this.date().toISOString()}remainder(e){return Cc(this,e)}get isToday(){return this.truncate(A.DAY).equals(v.now().truncate(A.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new v(new Date)}static max(...e){let n=v.MIN;for(const r of e){const i=new v(r);i.after(n)&&(n=i)}return n}static min(...e){let n=v.MAX;for(const r of e){const i=new v(r);i.before(n)&&(n=i)}return n}static nanoseconds(e,n="UTC"){return new v(e,n)}static microseconds(e,n="UTC"){return v.nanoseconds(e*1e3,n)}static milliseconds(e,n="UTC"){return v.microseconds(e*1e3,n)}static seconds(e,n="UTC"){return v.milliseconds(e*1e3,n)}static minutes(e,n="UTC"){return v.seconds(e*60,n)}static hours(e,n="UTC"){return v.minutes(e*60,n)}static days(e,n="UTC"){return v.hours(e*24,n)}};p(T,"NANOSECOND",T.nanoseconds(1)),p(T,"MICROSECOND",T.microseconds(1)),p(T,"MILLISECOND",T.milliseconds(1)),p(T,"SECOND",T.seconds(1)),p(T,"MINUTE",T.minutes(1)),p(T,"HOUR",T.hours(1)),p(T,"DAY",T.days(1)),p(T,"MAX",new T((1n<<63n)-1n)),p(T,"MIN",new T(0)),p(T,"ZERO",new T(0)),p(T,"z",j([x({value:fe()}).transform(t=>new T(t.value)),N().transform(t=>new T(BigInt(t))),Z(Number).transform(t=>new T(t)),_().transform(t=>new T(t)),Z(T)]));let U=T;const k=class I{constructor(e){p(this,"value"),p(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}static fromSeconds(e){return e instanceof I?e:e instanceof eo?e.period:e instanceof U?new I(e):["number","bigint"].includes(typeof e)?I.seconds(e):new I(e)}static fromMilliseconds(e){return e instanceof I?e:e instanceof eo?e.period:e instanceof U?new I(e):["number","bigint"].includes(typeof e)?I.milliseconds(e):new I(e)}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(e){return this.valueOf()<new I(e).valueOf()}greaterThan(e){return this.valueOf()>new I(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new I(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new I(e).valueOf()}remainder(e){return Cc(this,e)}truncate(e){return new I(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(I.DAY),n=this.truncate(I.HOUR),r=this.truncate(I.MINUTE),i=this.truncate(I.SECOND),o=this.truncate(I.MILLISECOND),s=this.truncate(I.MICROSECOND),a=this.truncate(I.NANOSECOND),l=e,u=n.sub(e),h=r.sub(n),d=i.sub(r),y=o.sub(i),g=s.sub(o),w=a.sub(s);let z="";return l.isZero||(z+=`${l.days}d `),u.isZero||(z+=`${u.hours}h `),h.isZero||(z+=`${h.minutes}m `),d.isZero||(z+=`${d.seconds}s `),y.isZero||(z+=`${y.milliseconds}ms `),g.isZero||(z+=`${g.microseconds}µs `),w.isZero||(z+=`${w.nanoseconds}ns`),z.trim()}mult(e){return new I(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(I.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(I.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(I.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(I.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(I.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(I.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new I(e).valueOf()}add(e){return new I(this.valueOf()+new I(e).valueOf())}sub(e){return new I(this.valueOf()-new I(e).valueOf())}static nanoseconds(e=1){return new I(e)}static microseconds(e=1){return I.nanoseconds(Re(e,1e3))}static milliseconds(e=1){return I.microseconds(Re(e,1e3))}static seconds(e=1){return I.milliseconds(Re(e,1e3))}static minutes(e=1){return I.seconds(Re(e,60))}static hours(e){return I.minutes(Re(e,60))}static days(e){return I.hours(Re(e,24))}};p(k,"NANOSECOND",k.nanoseconds(1)),p(k,"MICROSECOND",k.microseconds(1)),p(k,"MILLISECOND",k.milliseconds(1)),p(k,"SECOND",k.seconds(1)),p(k,"MINUTE",k.minutes(1)),p(k,"HOUR",k.hours(1)),p(k,"DAY",k.days(1)),p(k,"MAX",new k((1n<<63n)-1n)),p(k,"MIN",new k(0)),p(k,"ZERO",new k(0)),p(k,"z",j([x({value:fe()}).transform(t=>new k(t.value)),N().transform(t=>new k(BigInt(t))),Z(Number).transform(t=>new k(t)),_().transform(t=>new k(t)),Z(k)]));let A=k;const at=class Lt extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Lt(e).valueOf()}get period(){return A.seconds(1/this.valueOf())}sampleCount(e){return new A(e).seconds*this.valueOf()}byteCount(e,n){return this.sampleCount(e)*new J(n).valueOf()}span(e){return A.seconds(e/this.valueOf())}byteSpan(e,n){return this.span(e.valueOf()/n.valueOf())}static hz(e){return new Lt(e)}static khz(e){return Lt.hz(e*1e3)}};p(at,"z",j([_().transform(t=>new at(t)),Z(Number).transform(t=>new at(t)),Z(at)]));let eo=at;const q=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Wn(e*this.valueOf())}};p(q,"UNKNOWN",new q(0)),p(q,"BIT128",new q(16)),p(q,"BIT64",new q(8)),p(q,"BIT32",new q(4)),p(q,"BIT16",new q(2)),p(q,"BIT8",new q(1)),p(q,"z",j([_().transform(t=>new q(t)),Z(Number).transform(t=>new q(t)),Z(q)]));let J=q;const re=class ut{constructor(e,n){p(this,"start"),p(this,"end"),typeof e=="object"&&"start"in e?(this.start=new U(e.start),this.end=new U(e.end)):(this.start=new U(e),this.end=new U(n))}get span(){return new A(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}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new ut(this.end,this.start)}get numericBounds(){return{lower:Number(this.start.valueOf()),upper:Number(this.end.valueOf())}}equals(e,n=A.ZERO){if(n.isZero)return this.start.equals(e.start)&&this.end.equals(e.end);let r=this.start.sub(e.start).valueOf(),i=this.end.sub(e.end).valueOf();return r<0&&(r=-r),i<0&&(i=-i),r<=n.valueOf()&&i<=n.valueOf()}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e,n=A.ZERO){e=e.makeValid();const r=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(r.start)||r.end.equals(e.start))return!1;const i=U.max(r.start,e.start),o=U.min(r.end,e.end);return o.before(i)?!1:new A(o.sub(i)).greaterThanOrEqual(n)}contains(e){return e instanceof ut?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const n=new ut(this.start,this.end);return e.start.after(this.start)&&(n.start=e.start),e.start.after(this.end)&&(n.end=e.start),e.end.before(this.end)&&(n.end=e.end),e.end.before(this.start)&&(n.start=e.end),n}static max(...e){return new ut(U.min(...e.map(n=>n.start)),U.max(...e.map(n=>n.end)))}};p(re,"MAX",new re(U.MIN,U.MAX)),p(re,"MIN",new re(U.MAX,U.MIN)),p(re,"ZERO",new re(U.ZERO,U.ZERO)),p(re,"z",j([x({start:U.z,end:U.z}).transform(t=>new re(t.start,t.end)),Z(re)]));let ft=re;const m=class R{constructor(e){if(p(this,"value"),p(this,"encodeValue",!0),e instanceof R||typeof e=="string"||typeof e.valueOf()=="string"){this.value=e.valueOf();return}const n=R.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(n!=null){this.value=n.valueOf();return}throw this.value=R.UNKNOWN.valueOf(),new Error(`unable to find data type for ${e.toString()}`)}valueOf(){return this.value}get Array(){const e=R.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()}matches(...e){return e.some(n=>this.equals(n))}toString(){return this.valueOf()}get isVariable(){return this.equals(R.JSON)||this.equals(R.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(R.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=R.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsigned(){return this.equals(R.UINT8)||this.equals(R.UINT16)||this.equals(R.UINT32)||this.equals(R.UINT64)}get isSigned(){return this.equals(R.INT8)||this.equals(R.INT16)||this.equals(R.INT32)||this.equals(R.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsigned&&e.isSigned?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(R.INT32)&&e.equals(R.FLOAT64)||this.equals(R.INT8)&&e.equals(R.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsigned===e.isUnsigned:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}toJSON(){return this.toString()}get usesBigInt(){return R.BIG_INT_TYPES.some(e=>e.equals(this))}};p(m,"UNKNOWN",new m("unknown")),p(m,"FLOAT64",new m("float64")),p(m,"FLOAT32",new m("float32")),p(m,"INT64",new m("int64")),p(m,"INT32",new m("int32")),p(m,"INT16",new m("int16")),p(m,"INT8",new m("int8")),p(m,"UINT64",new m("uint64")),p(m,"UINT32",new m("uint32")),p(m,"UINT16",new m("uint16")),p(m,"UINT8",new m("uint8")),p(m,"BOOLEAN",m.UINT8),p(m,"TIMESTAMP",new m("timestamp")),p(m,"UUID",new m("uuid")),p(m,"STRING",new m("string")),p(m,"JSON",new m("json")),p(m,"ARRAY_CONSTRUCTORS",new Map([[m.UINT8.toString(),Uint8Array],[m.UINT16.toString(),Uint16Array],[m.UINT32.toString(),Uint32Array],[m.UINT64.toString(),BigUint64Array],[m.FLOAT32.toString(),Float32Array],[m.FLOAT64.toString(),Float64Array],[m.INT8.toString(),Int8Array],[m.INT16.toString(),Int16Array],[m.INT32.toString(),Int32Array],[m.INT64.toString(),BigInt64Array],[m.TIMESTAMP.toString(),BigInt64Array],[m.STRING.toString(),Uint8Array],[m.JSON.toString(),Uint8Array],[m.UUID.toString(),Uint8Array]])),p(m,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,m.UINT8],[Uint16Array.name,m.UINT16],[Uint32Array.name,m.UINT32],[BigUint64Array.name,m.UINT64],[Float32Array.name,m.FLOAT32],[Float64Array.name,m.FLOAT64],[Int8Array.name,m.INT8],[Int16Array.name,m.INT16],[Int32Array.name,m.INT32],[BigInt64Array.name,m.INT64]])),p(m,"DENSITIES",new Map([[m.UINT8.toString(),J.BIT8],[m.UINT16.toString(),J.BIT16],[m.UINT32.toString(),J.BIT32],[m.UINT64.toString(),J.BIT64],[m.FLOAT32.toString(),J.BIT32],[m.FLOAT64.toString(),J.BIT64],[m.INT8.toString(),J.BIT8],[m.INT16.toString(),J.BIT16],[m.INT32.toString(),J.BIT32],[m.INT64.toString(),J.BIT64],[m.TIMESTAMP.toString(),J.BIT64],[m.STRING.toString(),J.UNKNOWN],[m.JSON.toString(),J.UNKNOWN],[m.UUID.toString(),J.BIT128]])),p(m,"ALL",[m.UNKNOWN,m.FLOAT64,m.FLOAT32,m.INT64,m.INT32,m.INT16,m.INT8,m.UINT64,m.UINT32,m.UINT16,m.UINT8,m.TIMESTAMP,m.UUID,m.STRING,m.JSON]),p(m,"BIG_INT_TYPES",[m.INT64,m.UINT64,m.TIMESTAMP]),p(m,"z",j([N().transform(t=>new m(t)),Z(m)]));let E=m;const Y=class L extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return L.bytes(this.valueOf()+e.valueOf())}sub(e){return L.bytes(this.valueOf()-e.valueOf())}truncate(e){return new L(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return L.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/L.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/L.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/L.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/L.TERABYTE.valueOf()}toString(){const e=this.truncate(L.TERABYTE),n=this.truncate(L.GIGABYTE),r=this.truncate(L.MEGABYTE),i=this.truncate(L.KILOBYTE),o=this.truncate(L.BYTE),s=e,a=n.sub(e),l=r.sub(n),u=i.sub(r),h=o.sub(i);let d="";return s.isZero||(d+=`${s.terabytes}TB `),a.isZero||(d+=`${a.gigabytes}GB `),l.isZero||(d+=`${l.megabytes}MB `),u.isZero||(d+=`${u.kilobytes}KB `),(!h.isZero||d==="")&&(d+=`${h.valueOf()}B`),d.trim()}static bytes(e=1){return new L(e)}static kilobytes(e=1){return L.bytes(e.valueOf()*1e3)}static megabytes(e=1){return L.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return L.megabytes(e.valueOf()*1e3)}static terabytes(e){return L.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};p(Y,"BYTE",new Y(1)),p(Y,"KILOBYTE",Y.kilobytes(1)),p(Y,"MEGABYTE",Y.megabytes(1)),p(Y,"GIGABYTE",Y.gigabytes(1)),p(Y,"TERABYTE",Y.terabytes(1)),p(Y,"ZERO",new Y(0)),p(Y,"z",j([_().transform(t=>new Y(t)),Z(Y)]));let Wn=Y;j([Z(Uint8Array),Z(Uint16Array),Z(Uint32Array),Z(BigUint64Array),Z(Float32Array),Z(Float64Array),Z(Int8Array),Z(Int16Array),Z(Int32Array),Z(BigInt64Array)]);const Lc=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof U||t instanceof A||t instanceof Date},Qp=(t,e,n,r=0)=>t.usesBigInt&&!e.usesBigInt?Number(n)-Number(r):!t.usesBigInt&&e.usesBigInt?BigInt(n.valueOf())-BigInt(r.valueOf()):ct(n,-r).valueOf(),ct=(t,e)=>e==0?t:t==0?e:typeof t=="bigint"&&typeof e=="bigint"||typeof t=="number"&&typeof e=="number"?t+e:Number(t)+Number(e),em=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof im?!0:Lc(t),ge=-1,tm=N().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer),nm=j([St(),Pu()]).transform(()=>new Uint8Array().buffer),qn=10,rm=(t,e)=>{if(t==="string"&&!e.isVariable)throw new Error(`cannot convert series of type ${e.toString()} to string`);if(t==="number"&&!e.isNumeric)throw new Error(`cannot convert series of type ${e.toString()} to number`);if(t==="bigint"&&!e.usesBigInt)throw new Error(`cannot convert series of type ${e.toString()} to bigint`)},lt=class ie{constructor(e){p(this,"key",""),p(this,"isSynnaxSeries",!0),p(this,"dataType"),p(this,"sampleOffset"),p(this,"gl"),p(this,"_data"),p(this,"timeRange",ft.ZERO),p(this,"alignment",0n),p(this,"_cachedMin"),p(this,"_cachedMax"),p(this,"writePos",ge),p(this,"_refCount",0),p(this,"_cachedLength"),p(this,"_cachedIndexes"),em(e)&&(e={data:e});const{dataType:n,timeRange:r,sampleOffset:i=0,glBufferUsage:o="static",alignment:s=0n,key:a=Rc()}=e,l=e.data??[];if(l instanceof ie||typeof l=="object"&&"isSynnaxSeries"in l&&l.isSynnaxSeries===!0){const d=l;this.key=d.key,this.dataType=d.dataType,this.sampleOffset=d.sampleOffset,this.gl=d.gl,this._data=d._data,this.timeRange=d.timeRange,this.alignment=d.alignment,this._cachedMin=d._cachedMin,this._cachedMax=d._cachedMax,this.writePos=d.writePos,this._refCount=d._refCount,this._cachedLength=d._cachedLength;return}const u=Lc(l),h=Array.isArray(l);if(n!=null)this.dataType=new E(n);else{if(l instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(h||u){let d=l;if(!u){if(l.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");d=l[0]}if(typeof d=="string")this.dataType=E.STRING;else if(typeof d=="number")this.dataType=E.FLOAT64;else if(typeof d=="bigint")this.dataType=E.INT64;else if(typeof d=="boolean")this.dataType=E.BOOLEAN;else if(d instanceof U||d instanceof Date||d instanceof U)this.dataType=E.TIMESTAMP;else if(typeof d=="object")this.dataType=E.JSON;else throw new Error(`cannot infer data type of ${typeof d} when constructing a Series from a JS array`)}else this.dataType=new E(l)}if(!h&&!u)this._data=l;else{let d=u?[l]:l;const y=d[0];(y instanceof U||y instanceof Date||y instanceof A)&&(d=d.map(g=>new U(g).valueOf())),this.dataType.equals(E.STRING)?(this._cachedLength=d.length,this._data=new TextEncoder().encode(`${d.join(`
|
|
32
|
-
`)}
|
|
33
|
-
`).buffer):this.dataType.equals(E.JSON)?(this._cachedLength=d.length,this._data=new TextEncoder().encode(`${d.map(g=>Pt.encodeString(g)).join(`
|
|
34
|
-
`)}
|
|
35
|
-
`).buffer):this.dataType.usesBigInt&&typeof y=="number"?this._data=new this.dataType.Array(d.map(g=>BigInt(Math.round(g)))).buffer:!this.dataType.usesBigInt&&typeof y=="bigint"?this._data=new this.dataType.Array(d.map(g=>Number(g))).buffer:this._data=new this.dataType.Array(d).buffer}this.key=a,this.alignment=s,this.sampleOffset=i??0,this.timeRange=r??ft.ZERO,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:o}}static alloc({capacity:e,dataType:n,...r}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const i=new new E(n).Array(e),o=new ie({data:i.buffer,dataType:n,...r});return o.writePos=0,o}static createTimestamps(e,n,r){const i=r.spanRange(n.span(e)),o=new BigInt64Array(e);for(let s=0;s<e;s++)o[s]=BigInt(r.add(n.span(s)).valueOf());return new ie({data:o,dataType:E.TIMESTAMP,timeRange:i})}get refCount(){return this._refCount}static fromStrings(e,n){const r=new TextEncoder().encode(`${e.join(`
|
|
36
|
-
`)}
|
|
37
|
-
`);return new ie({data:r,dataType:E.STRING,timeRange:n})}static fromJSON(e,n){const r=new TextEncoder().encode(`${e.map(i=>Pt.encodeString(i)).join(`
|
|
38
|
-
`)}
|
|
39
|
-
`);return new ie({data:r,dataType:E.JSON,timeRange:n})}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){if(this._refCount<=0){console.warn("attempted to release a series with a negative reference count");return}this._refCount--,this._refCount===0&&this.gl.control!=null&&this.maybeGarbageCollectGLBuffer(this.gl.control)}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(e):this.writeFixed(e)}writeVariable(e){if(this.writePos===ge)return 0;const n=this.byteCapacity.valueOf()-this.writePos,r=e.subBytes(0,n);return this.writeToUnderlyingData(r),this.writePos+=r.byteLength.valueOf(),this._cachedLength!=null&&(this._cachedLength+=r.length,this.calculateCachedLength()),r.length}writeFixed(e){if(this.writePos===ge)return 0;const n=this.capacity-this.writePos,r=e.sub(0,n);return this.writeToUnderlyingData(r),this._cachedLength=void 0,this.maybeRecomputeMinMax(r),this.writePos+=r.length,r.length}writeToUnderlyingData(e){this.underlyingData.set(e.data,this.writePos)}get buffer(){return typeof this._data=="object"&&"buffer"in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===ge?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.matches(E.STRING,E.UUID))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.underlyingData).split(`
|
|
40
|
-
`).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(E.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=E.UUID.density.valueOf(),n=Array(this.length);for(let r=0;r<this.length;r++){const i=this.underlyingData.slice(r*e,(r+1)*e),o=Array.from(new Uint8Array(i.buffer),s=>s.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");n[r]=o}return n}parseJSON(e){if(!this.dataType.equals(E.JSON))throw new Error("cannot parse non-JSON series as JSON");return new TextDecoder().decode(this.underlyingData).split(`
|
|
41
|
-
`).slice(0,-1).map(n=>e.parse(Pt.decodeString(n)))}get byteCapacity(){return new Wn(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===ge?this.byteCapacity:this.dataType.isVariable?new Wn(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===ge?this.data.length:this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const n=[0];return this.data.forEach((r,i)=>{r===qn&&(e++,n.push(i+1))}),this._cachedIndexes=n,this._cachedLength=e,e}convert(e,n=0){if(this.dataType.equals(e))return this;const r=new e.Array(this.length);for(let i=0;i<this.length;i++)r[i]=Qp(this.dataType,e,this.data[i],n);return new ie({data:r.buffer,dataType:e,timeRange:this.timeRange,sampleOffset:n,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(E.TIMESTAMP))this._cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMax=e.reduce((n,r)=>n>r?n:r)}else{const e=this.data;this._cachedMax=e.reduce((n,r)=>n>r?n:r)}return this._cachedMax}get max(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this._cachedMax??(this._cachedMax=this.calcRawMax()),ct(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(E.TIMESTAMP))this._cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMin=e.reduce((n,r)=>n<r?n:r)}else{const e=this.data;this._cachedMin=e.reduce((n,r)=>n<r?n:r)}return this._cachedMin}get min(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this._cachedMin??(this._cachedMin=this.calcRawMin()),ct(this._cachedMin,this.sampleOffset))}get bounds(){return Te(Number(this.min),Number(this.max))}maybeRecomputeMinMax(e){if(this._cachedMin!=null){const n=e._cachedMin??e.calcRawMin();n<this._cachedMin&&(this._cachedMin=n)}if(this._cachedMax!=null){const n=e._cachedMax??e.calcRawMax();n>this._cachedMax&&(this._cachedMax=n)}}enrich(){this.max,this.min}get range(){return ct(this.max,-this.min)}atAlignment(e,n){const r=Number(e-this.alignment);if(r<0||r>=this.length){if(n===!0)throw new Error(`[series] - no value at index ${r}`);return}return this.at(r,n)}at(e,n){if(this.dataType.isVariable)return this.atVariable(e,n??!1);e<0&&(e=this.length+e);const r=this.data[e];if(r==null){if(n===!0)throw new Error(`[series] - no value at index ${e}`);return}return ct(r,this.sampleOffset)}atVariable(e,n){let r=0,i=0;if(this._cachedIndexes!=null)r=this._cachedIndexes[e],i=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let s=0;s<this.data.length;s++)if(this.data[s]===qn){if(e===0){i=s;break}r=s+1,e--}if(i===0&&(i=this.data.length),r>=i||e>0){if(n)throw new Error(`[series] - no value at index ${e}`);return}}const o=this.data.slice(r,i);return this.dataType.equals(E.STRING)?new TextDecoder().decode(o):Yn(JSON.parse(new TextDecoder().decode(o)))}binarySearch(e){let n=0,r=this.length-1;const i=$f(e);for(;n<=r;){const o=Math.floor((n+r)/2),s=i(this.at(o,!0),e);if(s===0)return o;s<0?n=o+1:r=o-1}return n}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(E.FLOAT32)&&!this.dataType.equals(E.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:n,bufferUsage:r,prevBuffer:i}=this.gl;if(n==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==i)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==ge){i===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const o=this.dataType.density.size(i).valueOf(),s=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,o,s.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,r==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=ge}as(e){return rm(e,this.dataType),this}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:so(this.alignmentBounds.lower),upper:so(this.alignmentBounds.upper)},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 Te(this.alignment,this.alignment+BigInt(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}[Symbol.iterator](){if(this.dataType.isVariable){const e=new om(this);return this.dataType.equals(E.JSON)?new sm(e):e}return new am(this)}slice(e,n){return this.sliceSub(!1,e,n)}sub(e,n){return this.sliceSub(!0,e,n)}subIterator(e,n){return new to(this,e,n??this.length)}subAlignmentIterator(e,n){return new to(this,Number(e-this.alignment),Number(n-this.alignment))}subBytes(e,n){if(e>=0&&(n==null||n>=this.byteLength.valueOf()))return this;const r=this.data.subarray(e,n);return new ie({data:r,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,n,r){if(n<=0&&(r==null||r>=this.length))return this;let i;return e?i=this.data.subarray(n,r):i=this.data.slice(n,r),new ie({data:i,dataType:this.dataType,timeRange:this.timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(n)})}reAlign(e){return new ie({data:this.buffer,dataType:this.dataType,timeRange:ft.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}toString(){var e,n;let r=`${this.dataType.toString()} ${this.length} [`;if(this.length<=10)r+=Array.from(this).map(i=>i.toString());else{for(let i=0;i<5;i++)r+=`${(e=this.at(i))==null?void 0:e.toString()}`,i<4&&(r+=",");r+="...";for(let i=-5;i<0;i++)r+=(n=this.at(i))==null?void 0:n.toString(),i<-1&&(r+=",")}return r+="]",r}};p(lt,"crudeZ",x({timeRange:ft.z.optional(),dataType:E.z,alignment:Zu().optional(),data:j([tm,nm,Z(ArrayBuffer),Z(Uint8Array)]),glBufferUsage:Xp.optional().default("static").optional()})),p(lt,"z",lt.crudeZ.transform(t=>new lt(t)));let im=lt,to=class{constructor(e,n,r){p(this,"series"),p(this,"end"),p(this,"index"),this.series=e;const i=Te(0,e.length);this.end=Hi(i,r),this.index=Hi(i,n)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}};class om{constructor(e){if(p(this,"series"),p(this,"index"),p(this,"decoder"),!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,n=this.series.data;for(;this.index<n.length&&n[this.index]!==qn;)this.index++;const r=this.index;return e===r?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,r))})}[Symbol.iterator](){return this}}var no,ro;const Fc=class Wc{constructor(e){p(this,"wrapped"),p(this,no,"JSONSeriesIterator"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:Pt.decodeString(e.value,Wc.SCHEMA)}}[(ro=Symbol.iterator,no=Symbol.toStringTag,ro)](){return this}};p(Fc,"SCHEMA",vn(N(),$e()));let sm=Fc;var io,oo;class am{constructor(e){p(this,"series"),p(this,"index"),p(this,io,"SeriesIterator"),this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[(oo=Symbol.iterator,io=Symbol.toStringTag,oo)](){return this}}const so=t=>{const e=t>>32n,n=t&0xffffffffn;return{domain:e,sample:n}};x({key:N(),value:N()});vn(j([_(),N(),Du()]),$e());const qc=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",um=qc(),Vc=["macOS","Windows","Linux"],cm=["macos","windows","linux"],lm={macos:"macOS",windows:"Windows",linux:"Linux"},hm=F(Vc).or(F(cm).transform(t=>lm[t])),dm=()=>{if(typeof window>"u")return;const t=window.navigator.userAgent.toLowerCase();if(t.includes("mac"))return"macOS";if(t.includes("win"))return"Windows";if(t.includes("linux"))return"Linux"};let Sn;const fm=(t={})=>{const{force:e,default:n}=t;return e??Sn??(Sn=dm(),Sn??n)},pm=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:Vc,RUNTIME:um,detect:qc,getOS:fm,osZ:hm},Symbol.toStringTag,{value:"Module"}));var mm=Object.defineProperty,gm=(t,e,n)=>e in t?mm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ht=(t,e,n)=>gm(t,typeof e!="symbol"?e+"":e,n);const ym=(...t)=>t.map(Yc).join(""),Yc=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),wm=t=>t.endsWith("/")?t.slice(0,-1):t,ao=class Vn{constructor({host:e,port:n,protocol:r="",pathPrefix:i=""}){ht(this,"protocol"),ht(this,"host"),ht(this,"port"),ht(this,"path"),this.protocol=r,this.host=e,this.port=n,this.path=Yc(i)}replace(e){return new Vn({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Vn({...this,pathPrefix:ym(this.path,e)})}toString(){return wm(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};ht(ao,"UNKNOWN",new ao({host:"unknown",port:0}));const vm=-128,bm=127;_().int().min(vm).max(bm);const _m=-32768,$m=32767;_().int().min(_m).max($m);const Im=-2147483648,xm=2147483647;_().int().min(Im).max(xm);const zm=-9223372036854775808n,Sm=9223372036854775807n;fe().min(zm).max(Sm);const Om=255;_().int().min(0).max(Om);const Tm=65535;_().int().min(0).max(Tm);const km=4294967295;_().int().min(0).max(km);const Nm=18446744073709551615n;fe().min(0n).max(Nm);var Em=Object.defineProperty,Um=(t,e,n)=>e in t?Em(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Se=(t,e,n)=>Um(t,typeof e!="symbol"?e+"":e,n);x({baseInterval:A.z.optional(),maxRetries:_().optional(),scale:_().optional()});const Am=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,Si=N().regex(Am),qe=_().min(0).max(255),Zm=_().min(0).max(1),Jc=kt([qe,qe,qe,Zm]),Kc=kt([qe,qe,qe]),Oi=(t,e=1)=>{if(typeof t=="string")return Dm(t,e);if(Array.isArray(t)){if(t.length<3||t.length>4)throw new Error(`Invalid color: [${t.join(", ")}]`);return t.length===3?[...t,e]:t}throw new Error(`Invalid color: ${JSON.stringify(t)}`)},Bm=j([Si,Jc,Kc]).transform(t=>Oi(t)),Dm=(t,e=1)=>{if(!Si.safeParse(t).success)throw new Error(`Invalid hex color: ${t}`);return t=Mm(t),[Mt(t,0),Mt(t,2),Mt(t,4),t.length===8?Mt(t,6)/255:e]},Mt=(t,e)=>parseInt(t.slice(e,e+2),16),Mm=t=>t.startsWith("#")?t.slice(1):t,Pm=j([Si,Jc,N(),Kc]);Oi("#000000");Oi("#ffffff");const jm=x({key:N(),color:Pm,position:_(),switched:K().optional()});Ot(jm);const Rm=x({key:N(),name:N(),color:Bm});x({key:N(),name:N(),swatches:Ot(Rm)});const Cm=_().int().min(0).max(255),Lm=x({name:N(),key:N()}),Ht=t=>x({subject:Lm,resource:t,authority:Cm}),Fm=x({from:Ht(wt()),to:St()}),Wm=x({from:St(),to:Ht(wt())});j([Fm,Wm,x({from:Ht(wt()),to:Ht(wt())})]);const qm=t=>Object.getOwnPropertySymbols(globalThis).includes(t),Vm=(t,e)=>{const n=Symbol.for(t);if(!qm(n)){const r=e();Object.defineProperty(globalThis,n,{value:r})}return()=>globalThis[n]},Ym=t=>e=>e!=null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"?e.type.startsWith(t):e instanceof Error?e.message.startsWith(t):typeof e!="string"?!1:e.startsWith(t),Ti=t=>{var e;return e=class extends Error{constructor(n,r){super(n,r),Se(this,"discriminator",e.discriminator),Se(this,"type",e.TYPE),Se(this,"matches",e.matches),this.name=e.TYPE}static sub(n){return Ti(`${t}.${n}`)}},Se(e,"discriminator","FreighterError"),Se(e,"TYPE",t),Se(e,"matches",Ym(t)),e},Jm=t=>{if(t==null||typeof t!="object")return!1;const e=t;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},tt="unknown",uo="nil";class Km{constructor(){Se(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:uo,data:""};if(Jm(e))for(const n of this.providers){const r=n.encode(e);if(r!=null)return r}if(e instanceof Error)return{type:tt,data:e.message};if(typeof e=="string")return{type:tt,data:e};try{return{type:tt,data:JSON.stringify(e)}}catch{return{type:tt,data:"unable to encode error information"}}}decode(e){if(e==null||e.type===uo)return null;if(e.type===tt)return new co(e.data);for(const n of this.providers){const r=n.decode(e);if(r!=null)return r}return new co(e.data)}}Vm("synnax-error-registry",()=>new Km);class co extends Ti("unknown"){}x({type:N(),data:N()});class cg extends Ti("canceled"){}je.object({jsonrpc:je.string(),id:je.number().optional(),method:je.string().optional(),params:je.unknown().optional(),result:je.unknown().optional()});N().regex(/^\d+\.\d+\.\d+$/);const Gm=["standard","scientific","engineering"];F(Gm);const Hm="main",Gc="prerender",Hc={stage:"creating",processCount:0,reserved:!1,focusCount:0,centerCount:0},Xm={...Hc,key:Gc,visible:!1},Qm=x({key:N(),url:N().optional(),title:N().optional(),center:K().optional(),position:Ac.xy.optional(),size:Ct.dimensions.optional(),minSize:Ct.dimensions.optional(),maxSize:Ct.dimensions.optional(),resizable:K().optional(),fullscreen:K().optional(),focus:K().optional(),maximized:K().optional(),visible:K().optional(),minimized:K().optional(),decorations:K().optional(),skipTaskbar:K().optional(),fileDropEnabled:K().optional(),transparent:K().optional(),alwaysOnTop:K().optional()});exports.$t=Sp;exports.INITIAL_PRERENDER_WINDOW_STATE=Xm;exports.INITIAL_WINDOW_STATE=Hc;exports.J=Ac;exports.Lt=Hp;exports.MAIN_WINDOW=Hm;exports.O=A;exports.PRERENDER_WINDOW=Gc;exports.S=pm;exports._=Ct;exports.o=Xt;exports.windowPropsZ=Qm;
|