@synnaxlabs/drift 0.42.3 → 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-B00IQPYW.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-CGCIf0Ac.cjs +0 -1
- package/dist/src/noop/index.d.ts.map +0 -1
- package/dist/state-BX_5GHgM.js +0 -406
- package/dist/state-xseZCh_u.cjs +0 -1
- package/dist/window-Bj8OM9F9.cjs +0 -41
- package/dist/window-DwJfMpbK.js +0 -8620
package/dist/window-Bj8OM9F9.cjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";const Qc=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)},ho=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=tl(r);const i={},o=n;return Object.keys(o).forEach(s=>{let a=o[s];const l=t(s);r.recursive&&(xn(a)?Ai(a,r.keepTypesOnRecursion)||(a=e(a,r)):r.recursiveInArray&&Ui(a)&&(a=[...a].map(u=>{let h=u;return xn(u)?Ai(h,r.keepTypesOnRecursion)||(h=e(u,r)):Ui(u)&&(h=e({key:u},r).key),h}))),i[l]=a}),i};return e},Yn=ho(Qc),el=t=>t.replace(/([a-z0-9])([A-Z])/g,(e,n,r)=>`${n}_${r.toLowerCase()}`),fo=ho(el),On={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},tl=(t=On)=>(t.recursive==null?t=On:t.recursiveInArray??(t.recursiveInArray=!1),t),Ui=t=>t!=null&&Array.isArray(t),xn=t=>t!=null&&typeof t=="object"&&!Array.isArray(t),Ai=(t,e)=>(e||[]).some(n=>t instanceof n),Xt=t=>t!=null&&typeof t=="object"&&!Array.isArray(t);var nl=Object.defineProperty,rl=(t,e,n)=>e in t?nl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Le=(t,e,n)=>rl(t,typeof e!="symbol"?e+"":e,n);function il(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 ol(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 sl=new TextEncoder,al=50;function ul(t,e,n){sl.encodeInto(t,e.subarray(n))}function cl(t,e,n){t.length>al?ul(t,e,n):ol(t,e,n)}const ll=4096;function po(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>=ll&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}const hl=new TextDecoder,dl=200;function fl(t,e,n){const r=t.subarray(e,e+n);return hl.decode(r)}function pl(t,e,n){return n>dl?fl(t,e,n):po(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 ml(t,e,n){const r=n/4294967296,i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function mo(t,e,n){const r=Math.floor(n/4294967296),i=n;t.setUint32(e,r),t.setUint32(e+4,i)}function go(t,e){const n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}function gl(t,e){const n=t.getUint32(e),r=t.getUint32(e+4);return n*4294967296+r}const yl=-1,wl=4294967296-1,vl=17179869184-1;function bl({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=vl)if(e===0&&t<=wl){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),mo(r,4,t),n}}function _l(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=_l(t);return bl(e)}else return null}function Il(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=go(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 xl(t){const e=Il(t);return new Date(e.sec*1e3+e.nsec/1e6)}const zl={type:yl,encode:$l,decode:xl};let pt=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(zl)}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 Sl(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):Sl(t)?new Uint8Array(t):Uint8Array.from(t)}const Ol=100,Tl=2048;let kl=class yo{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)??Ol,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??Tl,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 yo({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=il(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),cl(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),ml(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),mo(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 kl(e).encodeSharedRef(t)}function zn(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}const Nl=16,El=16;class Ul{constructor(e=Nl,n=El){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=po(e,n,r),s=Uint8Array.prototype.slice.call(e,n,n+r);return this.store(s,o),o}}const Nn="array",dt="map_key",wo="map_value",Al=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 Zl{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===wo){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)),Bl=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 Zi=new RangeError("Insufficient data"),Dl=new Ul;let Ml=class vo{constructor(e){this.totalPos=0,this.pos=0,this.view=Jn,this.bytes=Bl,this.headByte=et,this.stack=new Zl,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:Dl,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??Al}clone(){return new vo({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=wo;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 Zi;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=pl(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 Zi;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=gl(this.view,this.pos);return this.pos+=8,e}readI64(){const e=go(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 bo(t,e){return new Ml(e).decode(t)}let Pl=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=fo(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(){}},jl=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(){}},Rl=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=>bo(t,{extensionCodec:ye})});let Cl=class{constructor(){Le(this,"contentType","application/msgpack")}encode(e){const n=fo(e);return nt(n,{extensionCodec:ye}).slice()}decode(e,n){const r=bo(e,{extensionCodec:ye}),i=Yn(r);return n!=null?n.parse(i):i}static registerCustomType(){}};const Pt=new Pl;new jl;new Rl;new Cl;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 _o=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 Ll(t){return t}function Fl(t){return t}function Wl(t){}function ql(t){throw new Error}function Vl(t){}function Yl(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 Io(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 Jl(t,e){return e?e.reduce((n,r)=>n==null?void 0:n[r],t):t}function Kl(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 xo=pe(()=>{try{return new Function(""),!0}catch{return!1}});function Ft(t){return typeof t=="object"&&t!==null&&Object.getPrototypeOf(t)===Object.prototype}function Gl(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}const Hl=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"]),zo=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 Xl(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 Ql(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 eh(t){return Object.keys(t).filter(e=>e.endsWith("?")).map(e=>e.replace(/\?$/,""))}function So(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=So(o);n[a]=s,e[a]=o}return{shape:n,keyMap:e,optional:r,defaulted:i}}const Oo={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]},To={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 ko(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 th(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 nh=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:To,NUMBER_FORMAT_RANGES:Oo,aborted:Fe,allowsEval:xo,assert:Vl,assertEqual:Ll,assertIs:Wl,assertNever:ql,assertNotEqual:Fl,assignProp:ae,cached:pe,cleanInterfaceKey:So,cleanInterfaceShape:ze,cleanRegex:Qt,clone:ne,createTransparentProxy:Ql,defineLazy:le,esc:Ce,escapeRegex:_e,extend:ko,extendObjectLike:mt,finalizeIssue:H,floatSafeRemainder:Io,getElementAtPath:Jl,getLengthableOrigin:sn,getParsedType:Hl,getSizableOrigin:on,getValidEnumValues:Yl,isObject:Gn,isPlainObject:Ft,issue:Ye,joinValues:Ee,jsonStringifyReplacer:$o,mergeObjectLike:Oe,normalizeObjectLikeDef:th,normalizeParams:f,nullish:Be,numKeys:Gl,omit:tn,optionalInterfaceKeys:eh,optionalObjectKeys:De,partialObjectLike:nn,pick:en,prefixIssues:X,primitiveTypes:zo,promiseAllObject:Kl,propertyKeyTypes:Wt,randomString:Kn,requiredObjectLike:rn,splitChecksAndParams:Xl,stringifyPrimitive:$t,unwrapMessage:rt},Symbol.toStringTag,{value:"Module"})),Bi=Symbol.for("{{zod.error}}");class ue{get message(){return JSON.stringify(this.issues,$o,2)}constructor(e){Object.defineProperty(this,"_tag",{value:Bi,enumerable:!1}),Object.defineProperty(this,"name",{value:"$ZodError",enumerable:!1}),this.issues=e}static[Symbol.hasInstance](e){return(e==null?void 0:e._tag)===Bi}}function No(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 Eo(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 Uo(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 Ao(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 Zo(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 ${Ao(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 rh=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 ih=er.bind({Error:ue}),Bo=/^[cC][^\s-]{8,}$/,Do=/^[0-9a-z]+$/,Mo=/^[0-9A-HJKMNP-TV-Z]{26}$/,Po=/^[0-9a-vA-V]{20}$/,jo=/^[A-Za-z0-9]{27}$/,Ro=/^[a-zA-Z0-9_-]{21}$/,Co=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,oh=/^[-+]?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)?)??$/,Lo=/^([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)$/,sh=Je(4),ah=Je(6),uh=Je(7),Fo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ch=/^[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])?)*$/,lh=/^(([^<>()\[\]\\.,;:\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,}))$/,hh=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,dh=/^[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])?)*$/,Wo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function qo(){return new RegExp(Wo,"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})$/,Vo=/^((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])$/,Yo=/^(([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])$/,fh=new RegExp(`(${tr.source})|(${nr.source})`),Jo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ko=/^([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])$/,Go=/^\+(?:[0-9]){6,14}[0-9]$/,Ho="((\\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])))",Xo=new RegExp(`^${Ho}$`);function Qo(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 es(t){return new RegExp(`^${Qo(t)}$`)}function ts(t){let e=`${Ho}T${Qo(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 ns=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}$`)},rs=/^\d+n?$/,is=/^\d+$/,os=/^-?\d+(?:\.\d+)?/i,ss=/true|false/i,as=/null/i,us=/undefined/i,cs=/^[^A-Z]*$/,ls=/^[^a-z]*$/,hs=Object.freeze(Object.defineProperty({__proto__:null,_emoji:Wo,base64:Jo,base64url:Ko,bigint:rs,boolean:ss,browserEmail:dh,cidrv4:Vo,cidrv6:Yo,cuid:Bo,cuid2:Do,date:Xo,datetime:ts,duration:Co,e164:Go,email:Fo,emoji:qo,extendedDuration:oh,guid:Lo,hostname:Zn,html5Email:ch,integer:is,ip:fh,ipv4:tr,ipv6:nr,ksuid:jo,lowercase:cs,nanoid:Ro,null:as,number:os,rfc5322Email:lh,string:ns,time:es,ulid:Mo,undefined:us,unicodeEmail:hh,uppercase:ls,uuid:Je,uuid4:sh,uuid6:ah,uuid7:uh,xid:Po},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=[])}),ds={number:"number",bigint:"bigint",object:"date"},rr=c("$ZodCheckLessThan",(t,e)=>{C.init(t,e);const n=ds[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=ds[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})}}),fs=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):Io(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})}}),ps=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]=Oo[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=is)}),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})}}),ms=c("$ZodCheckBigIntFormat",(t,e)=>{C.init(t,e);const[n,r]=To[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})}}),gs=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})}}),ys=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})}}),ws=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})}}),vs=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})}}),bs=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})}}),_s=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})}}),Is=c("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=cs),It.init(t,e)}),xs=c("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=ls),It.init(t,e)}),zs=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})}}),Ss=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})}}),Os=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 Di(t,e,n){t.issues.length&&e.issues.push(...X(n,t.issues))}const Ts=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=>Di(i,n,e.property));Di(r,n,e.property)}}),ks=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})}}),Ns=c("$ZodCheckOverwrite",(t,e)=>{C.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class Es{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 Us={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=Us;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)??ns(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)}),As=c("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Lo),D.init(t,e)}),Zs=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)}),Bs=c("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Fo),D.init(t,e)}),Ds=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})}}}),Ms=c("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=qo()),D.init(t,e)}),Ps=c("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Ro),D.init(t,e)}),js=c("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Bo),D.init(t,e)}),Rs=c("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Do),D.init(t,e)}),Cs=c("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Mo),D.init(t,e)}),Ls=c("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Po),D.init(t,e)}),Fs=c("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=jo),D.init(t,e)}),Ws=c("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=ts(e)),D.init(t,e)}),qs=c("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Xo),D.init(t,e)}),Vs=c("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=es(e)),D.init(t,e)}),Ys=c("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Co),D.init(t,e)}),Js=c("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=tr),D.init(t,e),t._zod.onattach.push(n=>{n._zod.computed.format="ipv4"})}),Ks=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})}}}),Gs=c("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Vo),D.init(t,e)}),Hs=c("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Yo),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})}}}),Xs=c("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Jo),D.init(t,e),t._zod.onattach.push(n=>{n._zod.computed.contentEncoding="base64"})}),Qs=c("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ko),D.init(t,e),t._zod.onattach.push(n=>{n._zod.computed.contentEncoding="base64url"})}),ea=c("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Go),D.init(t,e)});function ta(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 na=c("$ZodJWT",(t,e)=>{D.init(t,e),t._zod.check=n=>{ta(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??os,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}}),ra=c("$ZodNumber",(t,e)=>{ps.init(t,e),sr.init(t,e)}),ar=c("$ZodBoolean",(t,e)=>{b.init(t,e),t._zod.pattern=ss,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=rs,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}}),ia=c("$ZodBigInt",(t,e)=>{ms.init(t,e),ur.init(t,e)}),oa=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}}),sa=c("$ZodUndefined",(t,e)=>{b.init(t,e),t._zod.pattern=us,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}}),aa=c("$ZodNull",(t,e)=>{b.init(t,e),t._zod.pattern=as,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}}),ua=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)}),ca=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}}),la=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 Mi(t,e,n){t.issues.length&&e.issues.push(...X(n,t.issues)),e.value[n]=t.value}const ha=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=>Mi(u,n,s))):Mi(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 Pi(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 Es(["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=xo.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),Ni=Pe.has(Q);Ut instanceof Promise?y.push(Ut.then(Ei=>Ni?Pi(Ei,u,Q,d):Zt(Ei,u,Q))):Ni?Pi(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)}),da=c("$ZodObject",(t,e)=>{un.init(t,e)});function ph(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 ph(o,r,t,i)}});function fa(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)fa(o,s)||(n=!1)}return n}const pa=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)?fa(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)}}),ma=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])=>ji(n,l,u)):ji(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 ji(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 ga=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}}),ya=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])=>{Ri(h,d,n,s,i,t,r)})):Ri(l,u,n,s,i,t,r)}return o.length?Promise.all(o).then(()=>n):n}});function Ri(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 wa=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=>Ci(l,n))):Ci(a,n)}return o.length?Promise.all(o).then(()=>n):n}});function Ci(t,e){t.issues.length?e.issues.push(...t.issues):e.value.add(t.value)}const va=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}}),ba=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}}),_a=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}}),Ia=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)}),xa=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)}),za=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=>Li(o,e)):Li(i,e)}});function Li(t,e){return t.value===void 0&&(t.value=e.defaultValue()),t}const Sa=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=>Fi(o,t)):Fi(i,t)}});function Fi(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 Oa=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)}}),Ta=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)}}),ka=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=>Wi(o,e,r)):Wi(i,e,r)}});function Wi(t,e,n){return Fe(t)?t:e.out._zod.run({value:t.value,issues:t.issues},n)}const Na=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(qi):qi(i)}});function qi(t){return t.value=Object.freeze(t.value),t}const Ea=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||zo.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)}),Ua=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))}),Aa=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)}),Za=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=>Vi(o,n,r,t));Vi(i,n,r,t)}});function Vi(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 mh={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 Yi(t){return mh[t]??null}const gh=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},yh={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"},wh=t=>{switch(t.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${t.expected}, daxil olan ${gh(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=Yi(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=Yi(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ış ${yh[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 vh(){return{localeError:wh}}const bh={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 Ji(t){return bh[t]??null}const _h=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"},Ih=t=>{switch(t.code){case"invalid_type":return`Invalid input: expected ${t.expected}, received ${_h(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=Ji(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=Ji(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 Ba(){return{localeError:Ih}}const xh={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function Ki(t){return xh[t]??null}const zh=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},Sh={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"},Oh=t=>{switch(t.code){case"invalid_type":return`Entrada inválida: se esperaba ${t.expected}, recibido ${zh(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=Ki(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=Ki(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 ${Sh[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 Th(){return{localeError:Oh}}const Da=Object.freeze(Object.defineProperty({__proto__:null,az:vh,en:Ba,es:Th},Symbol.toStringTag,{value:"Module"})),Ma=Symbol("ZodOutput"),Pa=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 ja(t,e){return new t({type:"string",...f(e)})}function Ra(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 Ca(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(e)})}function La(t,e){return new t({type:"string",format:"date",check:"string_format",...f(e)})}function Fa(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...f(e)})}function Wa(t,e){return new t({type:"string",format:"duration",check:"string_format",...f(e)})}function qa(t,e){return new t({type:"number",checks:[],...f(e)})}function Va(t,e){return new t({type:"number",coerce:!0,checks:[],...f(e)})}function Ya(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...f(e)})}function Ja(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...f(e)})}function Ka(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...f(e)})}function Ga(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...f(e)})}function Ha(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...f(e)})}function Xa(t,e){return new t({type:"boolean",...f(e)})}function Qa(t,e){return new t({type:"boolean",coerce:!0,...f(e)})}function eu(t,e){return new t({type:"bigint",...f(e)})}function tu(t,e){return new t({type:"bigint",coerce:!0,...f(e)})}function nu(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...f(e)})}function ru(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...f(e)})}function iu(t,e){return new t({type:"symbol",...f(e)})}function ou(t,e){return new t({type:"undefined",...f(e)})}function su(t,e){return new t({type:"null",...f(e)})}function au(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 uu(t,e){return new t({type:"void",...f(e)})}function cu(t,e){return new t({type:"date",...f(e)})}function lu(t,e){return new t({type:"date",coerce:!0,...f(e)})}function hu(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 du(t){return Ae(0,t)}function fu(t){return Ue(0,t)}function pu(t){return ee(0,t)}function mu(t){return G(0,t)}function gt(t,e){return new fs({check:"multiple_of",...f(e),value:t})}function dn(t,e){return new gs({check:"max_size",...f(e),maximum:t})}function yt(t,e){return new ys({check:"min_size",...f(e),minimum:t})}function Zr(t,e){return new ws({check:"size_equals",...f(e),size:t})}function fn(t,e){return new vs({check:"max_length",...f(e),maximum:t})}function Ke(t,e){return new bs({check:"min_length",...f(e),minimum:t})}function pn(t,e){return new _s({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 Is({check:"string_format",format:"lowercase",...f(t)})}function Mr(t){return new xs({check:"string_format",format:"uppercase",...f(t)})}function Pr(t,e){return new zs({check:"string_format",format:"includes",...f(e),includes:t})}function jr(t,e){return new Ss({check:"string_format",format:"starts_with",...f(e),prefix:t})}function Rr(t,e){return new Os({check:"string_format",format:"ends_with",...f(e),suffix:t})}function gu(t,e,n){return new Ts({check:"property",property:t,schema:e,...f(n)})}function Cr(t,e){return new ks({check:"mime_type",mime:t,...f(e)})}function Me(t){return new Ns({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 yu(t,e,n){return new t({type:"array",element:e,...f(n)})}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},...f(n)};return new t(i)}function Nh(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 Eh(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 Uh(t,e,n){const r={type:"object",shape:e??{},get optional(){return De(e??{})},...f(n)};return new t(r)}function Ah(t,e,n){return new t({type:"object",shape:e,get optional(){return De(e)},catchall:hn(an),...f(n)})}function Zh(t,e,n){return new t({type:"object",shape:e,get optional(){return De(e)},catchall:ln(xt),...f(n)})}function Bh(t,e,n){return new t({type:"union",options:e,...f(n)})}function Dh(t,e,n){return new t({type:"union",options:e,...f(n)})}function Mh(t,e,n,r){return new t({type:"intersection",left:e,right:n,...f(r)})}function wu(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 Ph(t,e,n,r){return new t({type:"record",keyType:e,valueType:n,...f(r)})}function jh(t,e,n,r){return new t({type:"map",keyType:e,valueType:n,...f(r)})}function Rh(t,e,n){return new t({type:"set",valueType:e,...f(n)})}function Ch(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 Lh(t,e,n){return new t({type:"enum",entries:e,...f(n)})}function Fh(t,e,n){return new t({type:"literal",values:Array.isArray(e)?e:[e],...f(n)})}function vu(t,e){return new t({type:"file",...f(e)})}function Wh(t,e,n){return new t({type:"transform",transform:e,...f(n)})}function qh(t,e,n){return new t({type:"optional",innerType:e,...f(n)})}function Vh(t,e,n){return new t({type:"nullable",innerType:e,...f(n)})}function Yh(t,e,n,r){return new t({type:"default",defaultValue:typeof n=="function"?n:()=>n,innerType:e,...f(r)})}function Jh(t,e,n){return new t({type:"nonoptional",innerType:e,...f(n)})}function Kh(t,e,n){return new t({type:"success",innerType:e,...f(n)})}function Gh(t,e,n,r){return new t({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n,...f(r)})}function Hh(t,e,n,r){return new t({type:"pipe",in:e,out:n,...f(r)})}function Xh(t,e,n){return new t({type:"readonly",innerType:e,...f(n)})}function Qh(t,e,n){return new t({type:"template_literal",parts:e,...f(n)})}function ed(t,e,n){return new t({type:"lazy",getter:e,...f(n)})}function td(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 nd(t,e,n={}){return mn(t,e,n)}function bu(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 _u(t){return new We({type:"function",input:Array.isArray(t==null?void 0:t.input)?wu(cn,t==null?void 0:t.input):(t==null?void 0:t.input)??null,output:(t==null?void 0:t.output)??null})}const rd={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=rd[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),id(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 id(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 od=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),sd=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:ua,$ZodArray:ha,$ZodAsyncError:Ve,$ZodBase64:Xs,$ZodBase64URL:Qs,$ZodBigInt:ur,$ZodBigIntFormat:ia,$ZodBoolean:ar,$ZodCIDRv4:Gs,$ZodCIDRv6:Hs,$ZodCUID:js,$ZodCUID2:Rs,$ZodCatch:Ta,$ZodCheck:C,$ZodCheckBigIntFormat:ms,$ZodCheckEndsWith:Os,$ZodCheckGreaterThan:ir,$ZodCheckIncludes:zs,$ZodCheckLengthEquals:_s,$ZodCheckLessThan:rr,$ZodCheckLowerCase:Is,$ZodCheckMaxLength:vs,$ZodCheckMaxSize:gs,$ZodCheckMimeType:ks,$ZodCheckMinLength:bs,$ZodCheckMinSize:ys,$ZodCheckMultipleOf:fs,$ZodCheckNumberFormat:ps,$ZodCheckOverwrite:Ns,$ZodCheckProperty:Ts,$ZodCheckRegex:$s,$ZodCheckSizeEquals:ws,$ZodCheckStartsWith:Ss,$ZodCheckStringFormat:It,$ZodCheckUpperCase:xs,$ZodCustom:Za,$ZodDate:la,$ZodDefault:za,$ZodDiscriminatedUnion:pa,$ZodE164:ea,$ZodEmail:Bs,$ZodEmoji:Ms,$ZodEnum:va,$ZodError:ue,$ZodFile:_a,$ZodFunction:We,$ZodGUID:As,$ZodIPv4:Js,$ZodIPv6:Ks,$ZodISODate:qs,$ZodISODateTime:Ws,$ZodISODuration:Ys,$ZodISOTime:Vs,$ZodInterface:Bn,$ZodIntersection:ma,$ZodJWT:na,$ZodKSUID:Fs,$ZodLazy:Aa,$ZodLiteral:ba,$ZodMap:ya,$ZodNaN:ka,$ZodNanoID:Ps,$ZodNever:an,$ZodNonOptional:Sa,$ZodNull:aa,$ZodNullable:xa,$ZodNumber:sr,$ZodNumberFormat:ra,$ZodObject:da,$ZodObjectLike:un,$ZodOptional:Ia,$ZodPipe:lr,$ZodPromise:Ua,$ZodReadonly:Na,$ZodRecord:ga,$ZodRegistry:hr,$ZodSet:wa,$ZodString:or,$ZodStringFormat:D,$ZodSuccess:Oa,$ZodSymbol:oa,$ZodTemplateLiteral:Ea,$ZodTransform:$a,$ZodTuple:cn,$ZodType:b,$ZodULID:Cs,$ZodURL:Ds,$ZodUUID:Zs,$ZodUndefined:sa,$ZodUnion:cr,$ZodUnknown:xt,$ZodVoid:ca,$ZodXID:Ls,$brand:_o,$constructor:c,$input:Pa,$output:Ma,Doc:Es,JSONSchema:od,JSONSchemaGenerator:Mn,_any:au,_array:yu,_base64:Nr,_base64url:Er,_bigint:eu,_boolean:Xa,_catch:Gh,_cidrv4:Tr,_cidrv6:kr,_coercedBigint:tu,_coercedBoolean:Qa,_coercedDate:lu,_coercedNumber:Va,_coercedString:Ra,_cuid:_r,_cuid2:$r,_custom:mn,_date:cu,_default:Yh,_discriminatedUnion:Dh,_e164:Ur,_email:fr,_emoji:vr,_endsWith:Rr,_enum:Ch,_file:vu,_float32:Ja,_float64:Ka,_gt:Ae,_gte:G,_guid:qt,_includes:Pr,_int:Ya,_int32:Ga,_int64:nu,_interface:kh,_intersection:Mh,_ipv4:Sr,_ipv6:Or,_isoDate:La,_isoDateTime:Ca,_isoDuration:Wa,_isoTime:Fa,_jwt:Ar,_ksuid:zr,_lazy:ed,_length:pn,_literal:Fh,_looseInterface:Eh,_looseObject:Zh,_lowercase:Dr,_lt:Ue,_lte:ee,_map:jh,_max:ee,_maxLength:fn,_maxSize:dn,_mime:Cr,_min:G,_minLength:Ke,_minSize:yt,_multipleOf:gt,_nan:hu,_nanoid:br,_nativeEnum:Lh,_negative:fu,_never:hn,_nonnegative:mu,_nonoptional:Jh,_nonpositive:pu,_normalize:Lr,_null:su,_nullable:Vh,_number:qa,_object:Uh,_optional:qh,_overwrite:Me,_parse:Hn,_parseAsync:Qn,_pipe:Hh,_positive:du,_promise:td,_property:gu,_readonly:Xh,_record:Ph,_refine:nd,_regex:Br,_safeParse:Xn,_safeParseAsync:er,_set:Rh,_size:Zr,_startsWith:jr,_strictInterface:Nh,_strictObject:Ah,_string:ja,_stringbool:bu,_success:Kh,_symbol:iu,_templateLiteral:Qh,_toLowerCase:Wr,_toUpperCase:qr,_transform:Wh,_trim:Fr,_tuple:wu,_uint32:Ha,_uint64:ru,_ulid:Ir,_undefined:ou,_union:Bh,_unknown:ln,_uppercase:Mr,_url:wr,_uuid:pr,_uuidv4:mr,_uuidv6:gr,_uuidv7:yr,_void:uu,_xid:xr,clone:ne,config:V,flattenError:No,formatError:Eo,function:_u,globalConfig:En,globalRegistry:we,isValidJWT:ta,locales:Da,parse:Un,parseAsync:An,prettifyError:Zo,regexes:hs,registry:dr,safeParse:rh,safeParseAsync:ih,toDotPath:Ao,toJSONSchema:$u,treeifyError:Uo,util:nh,version:Us},Symbol.toStringTag,{value:"Module"})),Iu=c("ZodISODateTime",(t,e)=>{Ws.init(t,e),P.init(t,e)});function xu(t){return Ca(Iu,t)}const zu=c("ZodISODate",(t,e)=>{qs.init(t,e),P.init(t,e)});function Su(t){return La(zu,t)}const Ou=c("ZodISOTime",(t,e)=>{Vs.init(t,e),P.init(t,e)});function Tu(t){return Fa(Ou,t)}const ku=c("ZodISODuration",(t,e)=>{Ys.init(t,e),P.init(t,e)});function Nu(t){return Wa(ku,t)}const ad=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:zu,ZodISODateTime:Iu,ZodISODuration:ku,ZodISOTime:Ou,date:Su,datetime:xu,duration:Nu,time:Tu},Symbol.toStringTag,{value:"Module"}));class zt extends ue{format(e){return Eo(this,e)}flatten(e){return No(this,e)}addIssue(e){this.issues.push(e)}addIssues(e){this.issues.push(...e)}get isEmpty(){return this.issues.length===0}}const Eu=Hn.bind({Error:zt}),Uu=Xn.bind({Error:zt}),Au=Qn.bind({Error:zt}),Zu=er.bind({Error:zt});function ud(t){return Ra(gn,t)}function cd(t){return Va(ci,t)}function ld(t){return Qa(yn,t)}function Bu(t){return tu(wn,t)}function hd(t){return lu(di,t)}const dd=Object.freeze(Object.defineProperty({__proto__:null,bigint:Bu,boolean:ld,date:hd,number:cd,string:ud},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)=>Eu(t,n,r),t.safeParse=(n,r)=>Uu(t,n,r),t.parseAsync=async(n,r)=>Au(t,n,r),t.safeParseAsync=async(n,r)=>Zu(t,n,r),t.spa=t.safeParseAsync,t.refine=(n,r)=>t.check(yc(n,r)),t.superRefine=n=>t.check(wc(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=>oc(t,n),t.array=()=>Ot(t),t.or=n=>j([t,n]),t.and=n=>Ju(t,n),t.transform=n=>Kt(t,mi(n)),t.default=(n,r)=>ic(t,n,r),t.catch=n=>uc(t,n),t.pipe=n=>Kt(t,n),t.readonly=()=>hc(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(xu(n)),t.date=n=>t.check(Su(n)),t.time=n=>t.check(Tu(n)),t.duration=n=>t.check(Nu(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 ja(gn,t)}const P=c("ZodStringFormat",(t,e)=>{D.init(t,e),gn.init(t,e)}),Vr=c("ZodEmail",(t,e)=>{Bs.init(t,e),P.init(t,e)});function fd(t){return fr(Vr,t)}const Vt=c("ZodGUID",(t,e)=>{As.init(t,e),P.init(t,e)});function pd(t){return qt(Vt,t)}const he=c("ZodUUID",(t,e)=>{Zs.init(t,e),P.init(t,e)});function md(t){return pr(he,t)}function gd(t){return mr(he,t)}function yd(t){return gr(he,t)}function wd(t){return yr(he,t)}const Yr=c("ZodURL",(t,e)=>{Ds.init(t,e),P.init(t,e)});function vd(t){return wr(Yr,t)}const Jr=c("ZodEmoji",(t,e)=>{Ms.init(t,e),P.init(t,e)});function bd(t){return vr(Jr,t)}const Kr=c("ZodNanoID",(t,e)=>{Ps.init(t,e),P.init(t,e)});function _d(t){return br(Kr,t)}const Gr=c("ZodCUID",(t,e)=>{js.init(t,e),P.init(t,e)});function $d(t){return _r(Gr,t)}const Hr=c("ZodCUID2",(t,e)=>{Rs.init(t,e),P.init(t,e)});function Id(t){return $r(Hr,t)}const Xr=c("ZodULID",(t,e)=>{Cs.init(t,e),P.init(t,e)});function xd(t){return Ir(Xr,t)}const Qr=c("ZodXID",(t,e)=>{Ls.init(t,e),P.init(t,e)});function zd(t){return xr(Qr,t)}const ei=c("ZodKSUID",(t,e)=>{Fs.init(t,e),P.init(t,e)});function Sd(t){return zr(ei,t)}const ti=c("ZodIPv4",(t,e)=>{Js.init(t,e),P.init(t,e)});function Od(t){return Sr(ti,t)}const ni=c("ZodIPv6",(t,e)=>{Ks.init(t,e),P.init(t,e)});function Td(t){return Or(ni,t)}const ri=c("ZodCIDRv4",(t,e)=>{Gs.init(t,e),P.init(t,e)});function kd(t){return Tr(ri,t)}const ii=c("ZodCIDRv6",(t,e)=>{Hs.init(t,e),P.init(t,e)});function Nd(t){return kr(ii,t)}const oi=c("ZodBase64",(t,e)=>{Xs.init(t,e),P.init(t,e)});function Ed(t){return Nr(oi,t)}const si=c("ZodBase64URL",(t,e)=>{Qs.init(t,e),P.init(t,e)});function Ud(t){return Er(si,t)}const ai=c("ZodE164",(t,e)=>{ea.init(t,e),P.init(t,e)});function Ad(t){return Ur(ai,t)}const ui=c("ZodJWT",(t,e)=>{na.init(t,e),P.init(t,e)});function Zd(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 qa(ci,t)}const Ge=c("ZodNumberFormat",(t,e)=>{ra.init(t,e),$.init(t,e)});function jn(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)}function Pd(t){return Ha(Ge,t)}const yn=c("ZodBoolean",(t,e)=>{ar.init(t,e),$.init(t,e)});function K(t){return Xa(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 eu(wn,t)}const li=c("ZodBigIntFormat",(t,e)=>{ia.init(t,e),wn.init(t,e)});function jd(t){return nu(li,t)}function Rd(t){return ru(li,t)}const Du=c("ZodSymbol",(t,e)=>{oa.init(t,e),$.init(t,e)});function Mu(t){return iu(Du,t)}const Pu=c("ZodUndefined",(t,e)=>{sa.init(t,e),$.init(t,e)});function ju(t){return ou(Pu,t)}const Ru=c("ZodNull",(t,e)=>{aa.init(t,e),$.init(t,e)});function St(t){return su(Ru,t)}const Cu=c("ZodAny",(t,e)=>{ua.init(t,e),$.init(t,e)});function wt(t){return au(Cu,t)}const hi=c("ZodUnknown",(t,e)=>{xt.init(t,e),$.init(t,e)});function $e(t){return ln(hi,t)}const Lu=c("ZodNever",(t,e)=>{an.init(t,e),$.init(t,e)});function He(t){return hn(Lu,t)}const Fu=c("ZodVoid",(t,e)=>{ca.init(t,e),$.init(t,e)});function Cd(t){return uu(Fu,t)}const di=c("ZodDate",(t,e)=>{la.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 Ld(t){return cu(di,t)}const Wu=c("ZodArray",(t,e)=>{ha.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 yu(Wu,t,e)}const Fd=c("ZodObjectLike",(t,e)=>{un.init(t,e),$.init(t,e)});function Wd(t){const e=t._zod.def.type==="interface"?ze(t._zod.def.shape).shape:t._zod.def.shape;return Qu(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 qd(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 Vd(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)=>{da.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 Yd(t,e){return new Xe({type:"object",shape:t,get optional(){return De(t)},catchall:He(),...f(e)})}function Jd(t,e){return new Xe({type:"object",shape:t,get optional(){return De(t)},catchall:$e(),...f(e)})}function Kd(t,e){return e instanceof b?Oe(t,e):t instanceof Tt?Oe(t,fi(e)):t instanceof Xe?Oe(t,x(e)):ko(t,e)}function Gd(t,e){return Oe(t,e)}function Hd(t,e){return en(t,e)}function Xd(t,e){return tn(t,e)}function Qd(t,e){return nn(Nt,t,e)}function ef(t,e){return rn(Et,t,e)}const qu=c("ZodUnion",(t,e)=>{cr.init(t,e),$.init(t,e),t.options=e.options});function j(t,e){return new qu({type:"union",options:t,...f(e)})}const Vu=c("ZodDiscriminatedUnion",(t,e)=>{pa.init(t,e),$.init(t,e)});function tf(...t){typeof t[0]=="string"&&(t=t.slice(1));const[e,n]=t;return new Vu({type:"union",options:e,...f(n)})}const Yu=c("ZodIntersection",(t,e)=>{ma.init(t,e),$.init(t,e)});function Ju(t,e,n){return new Yu({type:"intersection",left:t,right:e,...f(n)})}const Ku=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 Ku({type:"tuple",items:t,rest:o,...f(i)})}const pi=c("ZodRecord",(t,e)=>{ga.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 nf(t,e,n){return new pi({type:"record",keyType:j([t,He()]),valueType:e,...f(n)})}const Gu=c("ZodMap",(t,e)=>{ya.init(t,e),$.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function rf(t,e,n){return new Gu({type:"map",keyType:t,valueType:e,...f(n)})}const Hu=c("ZodSet",(t,e)=>{wa.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 of(t,e){return new Hu({type:"set",valueType:t,...f(e)})}const vt=c("ZodEnum",(t,e)=>{va.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 sf(t,e){return new vt({type:"enum",entries:t,...f(e)})}const Xu=c("ZodLiteral",(t,e)=>{ba.init(t,e),$.init(t,e),t.values=new Set(e.values)});function Qu(t,e){return new Xu({type:"literal",values:Array.isArray(t)?t:[t],...f(e)})}const ec=c("ZodFile",(t,e)=>{_a.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 af(t){return vu(ec,t)}const tc=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 tc({type:"transform",transform:t,...f(e)})}const Nt=c("ZodOptional",(t,e)=>{Ia.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 nc=c("ZodNullable",(t,e)=>{xa.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Jt(t,e){return new nc({type:"nullable",innerType:t,...f(e)})}function uf(t){return Yt(Jt(t))}const rc=c("ZodDefault",(t,e)=>{za.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function ic(t,e,n){return new rc({type:"default",defaultValue:typeof e=="function"?e:()=>e,innerType:t,...f(n)})}const Et=c("ZodNonOptional",(t,e)=>{Sa.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType});function oc(t,e){return new Et({type:"nonoptional",innerType:t,...f(e)})}const sc=c("ZodSuccess",(t,e)=>{Oa.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cf(t,e){return new sc({type:"success",innerType:t,...f(e)})}const ac=c("ZodCatch",(t,e)=>{Ta.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function uc(t,e,n){return new ac({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e,...f(n)})}const cc=c("ZodNaN",(t,e)=>{ka.init(t,e),$.init(t,e)});function lf(t){return hu(cc,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 lc=c("ZodReadonly",(t,e)=>{Na.init(t,e),$.init(t,e)});function hc(t,e){return new lc({type:"readonly",innerType:t,...f(e)})}const dc=c("ZodTemplateLiteral",(t,e)=>{Ea.init(t,e),$.init(t,e)});function hf(t,e){return new dc({type:"template_literal",parts:t,...f(e)})}const fc=c("ZodLazy",(t,e)=>{Aa.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.getter()});function pc(t){return new fc({type:"lazy",getter:t})}const mc=c("ZodPromise",(t,e)=>{Ua.init(t,e),$.init(t,e),t.unwrap=()=>t._zod.def.innerType});function df(t,e){return new mc({type:"promise",innerType:t,...f(e)})}const bn=c("ZodCustom",(t,e)=>{Za.init(t,e),$.init(t,e)});function gc(t,e){const n=new C({check:"custom",...f(e)});return n._zod.check=t,n}function ff(t,e){return mn(bn,t??(()=>!0),e)}function yc(t,e={}){return mn(bn,t,e)}function wc(t,e){const n=gc(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 pf=bu.bind(null,{Pipe:gi,Boolean:yn,Unknown:hi});function mf(t){const e=pc(()=>j([N(t),_(),K(),St(),Ot(e),vn(N(),e)]));return e}function gf(t,e,n){return Kt(mi(t,n),e,n)}const yf={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"},wf=Object.freeze({status:"aborted"}),vf=wf;function bf(t){V({customError:t})}function _f(){return V().customError}V(Ba());const je=Object.freeze(Object.defineProperty({__proto__:null,$brand:_o,$input:Pa,$output:Ma,NEVER:vf,ZodAny:Cu,ZodArray:Wu,ZodBase64:oi,ZodBase64URL:si,ZodBigInt:wn,ZodBigIntFormat:li,ZodBoolean:yn,ZodCIDRv4:ri,ZodCIDRv6:ii,ZodCUID:Gr,ZodCUID2:Hr,ZodCatch:ac,ZodCustom:bn,ZodDate:di,ZodDefault:rc,ZodDiscriminatedUnion:Vu,ZodE164:ai,ZodEmail:Vr,ZodEmoji:Jr,ZodEnum:vt,ZodError:zt,ZodFile:ec,ZodGUID:Vt,ZodIPv4:ti,ZodIPv6:ni,ZodInterface:Tt,ZodIntersection:Yu,ZodIssueCode:yf,ZodJWT:ui,ZodKSUID:ei,ZodLazy:fc,ZodLiteral:Xu,ZodMap:Gu,ZodNaN:cc,ZodNanoID:Kr,ZodNever:Lu,ZodNonOptional:Et,ZodNull:Ru,ZodNullable:nc,ZodNumber:ci,ZodNumberFormat:Ge,ZodObject:Xe,ZodObjectLike:Fd,ZodOptional:Nt,ZodPipe:gi,ZodPromise:mc,ZodReadonly:lc,ZodRecord:pi,ZodSet:Hu,ZodString:gn,ZodStringFormat:P,ZodSuccess:sc,ZodSymbol:Du,ZodTemplateLiteral:dc,ZodTransform:tc,ZodTuple:Ku,ZodType:$,ZodULID:Xr,ZodURL:Yr,ZodUUID:he,ZodUndefined:Pu,ZodUnion:qu,ZodUnknown:hi,ZodVoid:Fu,ZodXID:Qr,_default:ic,any:wt,array:Ot,base64:Ed,base64url:Ud,bigint:fe,boolean:K,catch:uc,check:gc,cidrv4:kd,cidrv6:Nd,clone:ne,coerce:dd,config:V,core:sd,cuid:$d,cuid2:Id,custom:ff,date:Ld,discriminatedUnion:tf,e164:Ad,email:fd,emoji:bd,endsWith:Rr,enum:F,extend:Kd,file:af,float32:Bd,float64:Dd,function:_u,getErrorMap:_f,globalRegistry:we,gt:Ae,gte:G,guid:pd,includes:Pr,instanceof:Z,int:jn,int32:Md,int64:jd,interface:fi,intersection:Ju,ipv4:Od,ipv6:Td,iso:ad,json:mf,jwt:Zd,keyof:Wd,ksuid:Sd,lazy:pc,length:pn,literal:Qu,locales:Da,looseInterface:Vd,looseObject:Jd,lowercase:Dr,lt:Ue,lte:ee,map:rf,maxLength:fn,maxSize:dn,merge:Gd,mime:Cr,minLength:Ke,minSize:yt,multipleOf:gt,nan:lf,nanoid:_d,nativeEnum:sf,negative:fu,never:He,nonnegative:mu,nonoptional:oc,nonpositive:pu,normalize:Lr,null:St,nullable:Jt,nullish:uf,number:_,object:x,omit:Xd,optional:Yt,overwrite:Me,parse:Eu,parseAsync:Au,partial:Qd,partialRecord:nf,pick:Hd,pipe:Kt,positive:du,preprocess:gf,prettifyError:Zo,promise:df,property:gu,readonly:hc,record:vn,refine:yc,regex:Br,regexes:hs,registry:dr,required:ef,safeParse:Uu,safeParseAsync:Zu,set:of,setErrorMap:bf,size:Zr,startsWith:jr,strictInterface:qd,strictObject:Yd,string:N,stringbool:pf,success:cf,superRefine:wc,symbol:Mu,templateLiteral:hf,toJSONSchema:$u,toLowerCase:Wr,toUpperCase:qr,transform:mi,treeifyError:Uo,trim:Fr,tuple:kt,uint32:Pd,uint64:Rd,ulid:xd,undefined:ju,union:j,unknown:$e,uppercase:Mr,url:vd,uuid:md,uuidv4:gd,uuidv6:yd,uuidv7:wd,void:Cd,xid:zd},Symbol.toStringTag,{value:"Module"})),$f=t=>t!=null&&typeof t=="object"&&"toString"in t,If=(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?xf(r):r},xf=t=>(e,n)=>t(n,e),_n=kt([_(),_()]);kt([fe(),fe()]);const yi=x({width:_(),height:_()}),zf=x({signedWidth:_(),signedHeight:_()}),Sf=["width","height"];F(Sf);const Of=["start","center","end"],Tf=["signedWidth","signedHeight"];F(Tf);const bt=x({x:_(),y:_()}),vc=x({clientX:_(),clientY:_()}),bc=["x","y"],_c=F(bc),$c=["top","right","bottom","left"];F($c);const wi=["left","right"],Ic=F(wi),vi=["top","bottom"],xc=F(vi),zc=["center"],Gi=F(zc),kf=[...$c,...zc],Sc=F(kf);F(Of);const Nf=["first","last"];F(Nf);const Ef=x({lower:_(),upper:_()}),Uf=x({lower:fe(),upper:fe()});j([Ef,_n]);j([Uf,_n]);F([..._c.options,...Sc.options]);j([_c,Sc,Z(String)]);const Af=t=>typeof t=="bigint"||t instanceof BigInt,Re=(t,e)=>Af(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 Hi(t);return Hi(n)},Hi=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t,Xi=(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=>bc.includes(t)?t:vi.includes(t)?"y":"x";x({x:Ic.or(Gi),y:xc.or(Gi)});const Zf=x({x:Ic,y:xc}),_i=Object.freeze({x:"left",y:"top"}),Bf=Object.freeze({x:"right",y:"top"}),Oc=Object.freeze({x:"left",y:"bottom"}),Df=Object.freeze({x:"right",y:"bottom"}),Mf=Object.freeze({x:"center",y:"top"}),Pf=Object.freeze({x:"center",y:"bottom"}),jf=Object.freeze({x:"right",y:"center"}),Rf=Object.freeze({x:"left",y:"center"}),Tc=(t,e)=>t.x===e.x&&t.y===e.y,Cf=t=>[t.x,t.y],Rn=j([_(),bt,_n,yi,zf,vc]),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}),kc=Object.freeze({x:1,y:1}),Lf=Object.freeze({x:1/0,y:1/0}),Ff=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},Wf=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}},Nc=(t,e)=>{const n=B(t);return{x:n.x+e,y:n.y}},Ec=(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"?Nc(t,n):Ec(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),qf=(t,e,n)=>{const r=B(t);return e==="x"?{x:n,y:r.y}:{x:r.x,y:n}},Vf=(t,e)=>{const n=B(t),r=B(e);return Math.sqrt((n.x-r.x)**2+(n.y-r.y)**2)},Yf=(t,e)=>{const n=B(t),r=B(e);return{x:r.x-n.x,y:r.y-n.y}},Jf=t=>{const e=B(t);return Number.isNaN(e.x)||Number.isNaN(e.y)},Kf=t=>{const e=B(t);return Number.isFinite(e.x)&&Number.isFinite(e.y)},Gf=t=>{const e=B(t);return[e.x,e.y]},Hf=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}},Uc=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}},Ac=(...t)=>{const e=t.reduce((n,r)=>_t(n,r),se);return $i(e,1/t.length)},Xf=(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=Uc(Ac(o,s))}n.push($i(a,l))}return n},Qf=t=>{const e=B(t);return{x:e.y,y:e.x}},Zc=Object.freeze(Object.defineProperty({__proto__:null,INFINITY:Lf,NAN:Ff,ONE:kc,ZERO:se,average:Ac,calculateMiters:Xf,clientXY:vc,construct:B,couple:Gf,crudeZ:Rn,css:Hf,distance:Vf,equals:Gt,isFinite:Kf,isNan:Jf,isZero:Wf,normal:ot,normalize:Uc,scale:$i,set:qf,sub:it,swap:Qf,translate:_t,translateX:Nc,translateY:Ec,translation:Yf,truncate:Cn,xy:bt},Symbol.toStringTag,{value:"Module"})),Dt=j([_(),N()]),ep=x({top:Dt,left:Dt,width:Dt,height:Dt}),tp=x({left:_(),top:_(),right:_(),bottom:_()}),np=x({one:bt,two:bt,root:Zf}),Bc={one:se,two:se,root:_i},rp={one:se,two:kc,root:Oc},Dc=(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))},ip=(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)},op=(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))},sp=(t,e)=>Gt(t.one,e.one)&&Gt(t.two,e.two)&&Tc(t.root,e.root),Mc=t=>({width:Ie(t),height:xe(t)}),ap=t=>({signedWidth:$n(t),signedHeight:In(t)}),up=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=Cf(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)},cp=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},Pc=t=>me(t,_i),lp=t=>me(t,Mf),hp=t=>me(t,Bf),dp=t=>me(t,Oc),fp=t=>me(t,Pf),pp=t=>me(t,Df),mp=t=>me(t,Rf),gp=t=>me(t,jf),ke=t=>Ze(t,"right"),Ne=t=>Ze(t,"bottom"),ve=t=>Ze(t,"left"),be=t=>Ze(t,"top"),Ln=t=>_t(Pc(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)},yp=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}},wp=(t,e)=>Dc(t,e),vp=(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]},bp=(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},Mc(n))},jc=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,_p=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)},Ip=(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?Bc:M({x:n,y:r},{x:i,y:o},void 0,void 0,t.root)},xp=t=>Ie(t)*xe(t),zp=(t,e)=>{const n=M(t);return M(Cn(n.one,e),Cn(n.two,e),void 0,void 0,n.root)},Sp=(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)},Op=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:rp,ZERO:Bc,area:xp,areaIsZero:cp,aspect:_p,bottom:Ne,bottomCenter:fp,bottomLeft:dp,bottomRight:pp,box:np,center:Ln,centerLeft:mp,centerRight:gp,construct:M,constructWithAlternateRoot:Sp,contains:op,copy:Dc,css:up,cssBox:ep,dim:Ii,dims:Mc,domRect:tp,edgePoints:vp,equals:sp,height:xe,intersection:Ip,isBox:jc,left:ve,loc:Ze,positionInCenter:bp,reRoot:wp,resize:ip,right:ke,root:yp,signedDims:ap,signedHeight:In,signedWidth:$n,top:be,topCenter:lp,topLeft:Pc,topRight:hp,translate:$p,truncate:zp,width:Ie,x:xi,xBounds:jt,xyLoc:me,y:zi,yBounds:Rt},Symbol.toStringTag,{value:"Module"})),Rc=x({signedWidth:_(),signedHeight:_()}),Tp=j([yi,Rc,bt,_n]),kp={width:0,height:0},Np={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},Ep=(t,e)=>{if(e==null)return!1;const n=te(t),r=te(e);return n.width===r.width&&n.height===r.height},Up=t=>{const e=te(t);return{width:e.height,height:e.width}},Ap=t=>{const e=te(t);return`0 0 ${e.width} ${e.height}`},Zp=t=>{const e=te(t);return[e.width,e.height]},Bp=t=>({width:Math.max(...t.map(e=>te(e).width)),height:Math.max(...t.map(e=>te(e).height))}),Dp=t=>({width:Math.min(...t.map(e=>te(e).width)),height:Math.min(...t.map(e=>te(e).height))}),Mp=(t,e)=>{const n=te(t);return{width:n.width*e,height:n.height*e}},Ct=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:Np,ZERO:kp,construct:te,couple:Zp,crude:Tp,dimensions:yi,equals:Ep,max:Bp,min:Dp,scale:Mp,signed:Rc,svgViewBox:Ap,swap:Up},Symbol.toStringTag,{value:"Module"}));var Pp=Object.defineProperty,jp=(t,e,n)=>e in t?Pp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,de=(t,e,n)=>jp(t,typeof e!="symbol"?e+"":e,n);const Rp=(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 Cp=t=>(e,n,r,i)=>n==="dimension"?[e,r]:[e,i?r-t:r+t],Lp=t=>(e,n,r,i)=>[e,i?r/t:r*t],Fp=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]},Wp=t=>(e,n,r)=>[t,r],qp=()=>(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)]},Vp=t=>(e,n,r)=>{const{lower:i,upper:o}=t;return r=Rp(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=Cp(e);return r.type="translate",n.ops.push(r),n}magnify(e){const n=this.new(),r=Lp(e);return r.type="magnify",n.ops.push(r),n}scale(e,n){const r=Te(e,n),i=this.new(),o=Fp(r);return o.type="scale",i.ops.push(o),i}clamp(e,n){const r=Te(e,n),i=this.new(),o=Vp(r);return o.type="clamp",i.ops.push(o),i}reBound(e,n){const r=Te(e,n),i=this.new(),o=Wp(r);return o.type="re-bound",i.ops.push(o),i}invert(){const e=qp();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 Qi=Fn;const eo=class ce{constructor(e=new Qi,n=new Qi,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(jc(e)){const r=this.currRoot;return n.currRoot=e.root,r!=null&&!Tc(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(eo,"IDENTITY",new eo);var Yp=Object.defineProperty,Jp=(t,e,n)=>e in t?Yp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,p=(t,e,n)=>Jp(t,typeof e!="symbol"?e+"":e,n);let Kp=(t,e=21)=>(n=e)=>{let r="",i=n|0;for(;i--;)r+=t[Math.random()*t.length|0];return r};const Gp="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Hp=Kp(Gp,11),Cc=()=>Hp(),Xp=Object.freeze(Object.defineProperty({__proto__:null,create:Cc},Symbol.toStringTag,{value:"Module"})),Qp=F(["static","dynamic"]),Lc=(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 Lc(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 to?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 to?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 Lc(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 to=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 Fc=t=>{const e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||t instanceof U||t instanceof A||t instanceof Date},em=(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),tm=t=>t==null?!1:Array.isArray(t)||t instanceof ArrayBuffer||ArrayBuffer.isView(t)&&!(t instanceof DataView)||t instanceof om?!0:Fc(t),ge=-1,nm=N().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer),rm=j([St(),ju()]).transform(()=>new Uint8Array().buffer),qn=10,im=(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"),tm(e)&&(e={data:e});const{dataType:n,timeRange:r,sampleOffset:i=0,glBufferUsage:o="static",alignment:s=0n,key:a=Cc()}=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=Fc(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]=em(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=If(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 im(e,this.dataType),this}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:ao(this.alignmentBounds.lower),upper:ao(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 sm(this);return this.dataType.equals(E.JSON)?new am(e):e}return new um(this)}slice(e,n){return this.sliceSub(!1,e,n)}sub(e,n){return this.sliceSub(!0,e,n)}subIterator(e,n){return new no(this,e,n??this.length)}subAlignmentIterator(e,n){return new no(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:Bu().optional(),data:j([nm,rm,Z(ArrayBuffer),Z(Uint8Array)]),glBufferUsage:Qp.optional().default("static").optional()})),p(lt,"z",lt.crudeZ.transform(t=>new lt(t)));let om=lt,no=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=Xi(i,r),this.index=Xi(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 sm{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 ro,io;const Wc=class qc{constructor(e){p(this,"wrapped"),p(this,ro,"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,qc.SCHEMA)}}[(io=Symbol.iterator,ro=Symbol.toStringTag,io)](){return this}};p(Wc,"SCHEMA",vn(N(),$e()));let am=Wc;var oo,so;class um{constructor(e){p(this,"series"),p(this,"index"),p(this,oo,"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)}}[(so=Symbol.iterator,oo=Symbol.toStringTag,so)](){return this}}const ao=t=>{const e=t>>32n,n=t&0xffffffffn;return{domain:e,sample:n}};x({key:N(),value:N()});vn(j([_(),N(),Mu()]),$e());const Vc=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",cm=Vc(),Yc=["macOS","Windows","Linux"],lm=["macos","windows","linux"],hm={macos:"macOS",windows:"Windows",linux:"Linux"},dm=F(Yc).or(F(lm).transform(t=>hm[t])),fm=()=>{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 pm=(t={})=>{const{force:e,default:n}=t;return e??Sn??(Sn=fm(),Sn??n)},mm=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:Yc,RUNTIME:cm,detect:Vc,getOS:pm,osZ:dm},Symbol.toStringTag,{value:"Module"}));var gm=Object.defineProperty,ym=(t,e,n)=>e in t?gm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ht=(t,e,n)=>ym(t,typeof e!="symbol"?e+"":e,n);const wm=(...t)=>t.map(Jc).join(""),Jc=t=>(t.endsWith("/")||(t+="/"),t.startsWith("/")&&(t=t.slice(1)),t),vm=t=>t.endsWith("/")?t.slice(0,-1):t,uo=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=Jc(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:wm(this.path,e)})}toString(){return vm(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};ht(uo,"UNKNOWN",new uo({host:"unknown",port:0}));const bm=-128,_m=127;_().int().min(bm).max(_m);const $m=-32768,Im=32767;_().int().min($m).max(Im);const xm=-2147483648,zm=2147483647;_().int().min(xm).max(zm);const Sm=-9223372036854775808n,Om=9223372036854775807n;fe().min(Sm).max(Om);const Tm=255;_().int().min(0).max(Tm);const km=65535;_().int().min(0).max(km);const Nm=4294967295;_().int().min(0).max(Nm);const Em=18446744073709551615n;fe().min(0n).max(Em);var Um=Object.defineProperty,Am=(t,e,n)=>e in t?Um(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Se=(t,e,n)=>Am(t,typeof e!="symbol"?e+"":e,n);x({baseInterval:A.z.optional(),maxRetries:_().optional(),scale:_().optional()});const Zm=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,Si=N().regex(Zm),qe=_().min(0).max(255),Bm=_().min(0).max(1),Oi=kt([qe,qe,qe,Bm]),Kc=kt([qe,qe,qe]),Gc=x({rgba255:Oi}),Ti=(t,e=1)=>{if(typeof t=="string")return Mm(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}if(typeof t=="object"&&"rgba255"in t)return t.rgba255;throw new Error(`Invalid color: ${JSON.stringify(t)}`)},Dm=j([Si,Oi,Kc,Gc]).transform(t=>Ti(t)),Mm=(t,e=1)=>{if(!Si.safeParse(t).success)throw new Error(`Invalid hex color: ${t}`);return t=Pm(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),Pm=t=>t.startsWith("#")?t.slice(1):t,jm=j([Si,Oi,N(),Kc,Gc]);Ti("#000000");Ti("#ffffff");const Rm=x({key:N(),color:jm,position:_(),switched:K().optional()});Ot(Rm);const Cm=x({key:N(),name:N(),color:Dm});x({key:N(),name:N(),swatches:Ot(Cm)});const Lm=_().int().min(0).max(255),Fm=x({name:N(),key:N()}),Ht=t=>x({subject:Fm,resource:t,authority:Lm}),Wm=x({from:Ht(wt()),to:St()}),qm=x({from:St(),to:Ht(wt())});j([Wm,qm,x({from:Ht(wt()),to:Ht(wt())})]);const Vm=t=>Object.getOwnPropertySymbols(globalThis).includes(t),Ym=(t,e)=>{const n=Symbol.for(t);if(!Vm(n)){const r=e();Object.defineProperty(globalThis,n,{value:r})}return()=>globalThis[n]},Jm=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),ki=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 ki(`${t}.${n}`)}},Se(e,"discriminator","FreighterError"),Se(e,"TYPE",t),Se(e,"matches",Jm(t)),e},Km=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",co="nil";class Gm{constructor(){Se(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:co,data:""};if(Km(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===co)return null;if(e.type===tt)return new lo(e.data);for(const n of this.providers){const r=n.decode(e);if(r!=null)return r}return new lo(e.data)}}Ym("synnax-error-registry",()=>new Gm);class lo extends ki("unknown"){}x({type:N(),data:N()});class lg extends ki("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 Hm=["standard","scientific","engineering"];F(Hm);const Xm="main",Hc="prerender",Xc={stage:"creating",processCount:0,reserved:!1,focusCount:0,centerCount:0},Qm={...Xc,key:Hc,visible:!1},eg=x({key:N(),url:N().optional(),title:N().optional(),center:K().optional(),position:Zc.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=Op;exports.INITIAL_PRERENDER_WINDOW_STATE=Qm;exports.INITIAL_WINDOW_STATE=Xc;exports.J=Zc;exports.Lt=Xp;exports.MAIN_WINDOW=Xm;exports.O=A;exports.PRERENDER_WINDOW=Hc;exports.S=mm;exports._=Ct;exports.o=Xt;exports.windowPropsZ=eg;
|