@synnaxlabs/pluto 0.12.0 → 0.14.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/dist/Center-8mBjm1cO.js +126 -0
- package/dist/{Center-gEKkAkdh.js.map → Center-8mBjm1cO.js.map} +1 -1
- package/dist/Center-ER_owvfX.cjs +2 -0
- package/dist/{Center-ZAcURh-3.cjs.map → Center-ER_owvfX.cjs.map} +1 -1
- package/dist/Header-9CR1VnwV.js +34 -0
- package/dist/{Header-7x6367IV.js.map → Header-9CR1VnwV.js.map} +1 -1
- package/dist/Header-PpcdP7hn.cjs +2 -0
- package/dist/{Header-5YX6FUn6.cjs.map → Header-PpcdP7hn.cjs.map} +1 -1
- package/dist/Item--h4UWJZo.js +80 -0
- package/dist/{Item-owLU4Xop.js.map → Item--h4UWJZo.js.map} +1 -1
- package/dist/Item-EBiM5yGJ.cjs +2 -0
- package/dist/{Item-HWzX7RK2.cjs.map → Item-EBiM5yGJ.cjs.map} +1 -1
- package/dist/Item-_og4CdwZ.cjs +2 -0
- package/dist/{Item-rkSKzZoh.cjs.map → Item-_og4CdwZ.cjs.map} +1 -1
- package/dist/Item-kbCoFEj2.js +137 -0
- package/dist/{Item-EDdYN2NK.js.map → Item-kbCoFEj2.js.map} +1 -1
- package/dist/Keyboard-IWRXgioJ.js +14 -0
- package/dist/{Keyboard-mE03PKwA.js.map → Keyboard-IWRXgioJ.js.map} +1 -1
- package/dist/Keyboard-bXNOi0bP.cjs +2 -0
- package/dist/{Keyboard-w372197S.cjs.map → Keyboard-bXNOi0bP.cjs.map} +1 -1
- package/dist/Link-16dbGK7G.cjs +2 -0
- package/dist/{Link-xlTZan29.cjs.map → Link-16dbGK7G.cjs.map} +1 -1
- package/dist/Link-fRQvqiYx.js +11 -0
- package/dist/{Link-laNlv47N.js.map → Link-fRQvqiYx.js.map} +1 -1
- package/dist/SelectLevel-DrdlLBOs.cjs +2 -0
- package/dist/{SelectLevel-bGb0dRXh.cjs.map → SelectLevel-DrdlLBOs.cjs.map} +1 -1
- package/dist/SelectLevel-Uod3Ez6y.js +121 -0
- package/dist/{SelectLevel-cewIWtOv.js.map → SelectLevel-Uod3Ez6y.js.map} +1 -1
- package/dist/Selector-8rTHUToj.cjs +2 -0
- package/dist/{Selector-hQLSIYum.cjs.map → Selector-8rTHUToj.cjs.map} +1 -1
- package/dist/Selector-R4SumEUV.js +233 -0
- package/dist/{Selector-R3lL41_i.js.map → Selector-R4SumEUV.js.map} +1 -1
- package/dist/Swatch--Prmb5q_.cjs +2 -0
- package/dist/Swatch--Prmb5q_.cjs.map +1 -0
- package/dist/Swatch-IH4OmVdd.js +82 -0
- package/dist/Swatch-IH4OmVdd.js.map +1 -0
- package/dist/TimeRangeChip-jI9Nn9z8.js +7384 -0
- package/dist/TimeRangeChip-jI9Nn9z8.js.map +1 -0
- package/dist/TimeRangeChip-jQH9NacG.cjs +50 -0
- package/dist/TimeRangeChip-jQH9NacG.cjs.map +1 -0
- package/dist/Toggle-HVxv8bv2.js +10648 -0
- package/dist/Toggle-HVxv8bv2.js.map +1 -0
- package/dist/Toggle-QnKinMl4.cjs +73 -0
- package/dist/Toggle-QnKinMl4.cjs.map +1 -0
- package/dist/Video-iiPAk_ej.cjs +2 -0
- package/dist/{Video-a7BUKvzF.cjs.map → Video-iiPAk_ej.cjs.map} +1 -1
- package/dist/Video-vyIORMaH.js +11 -0
- package/dist/{Video-Vpwp5ao1.js.map → Video-vyIORMaH.js.map} +1 -1
- package/dist/aether.cjs +1 -89
- package/dist/aether.cjs.map +1 -1
- package/dist/aether.js +76 -80
- package/dist/aether.js.map +1 -1
- package/dist/align.cjs +1 -9
- package/dist/align.cjs.map +1 -1
- package/dist/align.js +5 -5
- package/dist/button.cjs +1 -14
- package/dist/button.cjs.map +1 -1
- package/dist/button.js +9 -8
- package/dist/button.js.map +1 -1
- package/dist/color-9QRifwqk.js +9 -0
- package/dist/color-9QRifwqk.js.map +1 -0
- package/dist/color-gJTR__ef.cjs +2 -0
- package/dist/color-gJTR__ef.cjs.map +1 -0
- package/dist/color.cjs +2 -0
- package/dist/color.cjs.map +1 -0
- package/dist/color.js +16 -0
- package/dist/color.js.map +1 -0
- package/dist/component-LA8IXGSG.js +17961 -0
- package/dist/component-LA8IXGSG.js.map +1 -0
- package/dist/component-dgLAEMbt.cjs +23 -0
- package/dist/component-dgLAEMbt.cjs.map +1 -0
- package/dist/css-5RvvUhjr.js +6414 -0
- package/dist/{css-NTD4Xm8x.js.map → css-5RvvUhjr.js.map} +1 -1
- package/dist/css-s9KpanYu.cjs +8 -0
- package/dist/{css-V3VUT_Js.cjs.map → css-s9KpanYu.cjs.map} +1 -1
- package/dist/css.cjs +2 -0
- package/dist/css.cjs.map +1 -0
- package/dist/css.js +10 -0
- package/dist/css.js.map +1 -0
- package/dist/dimensions--C45ahLe.js +20 -0
- package/dist/{dimensions-guJ5PHmb.js.map → dimensions--C45ahLe.js.map} +1 -1
- package/dist/dimensions-HfZjDJQz.cjs +2 -0
- package/dist/{dimensions-Sej0Zly9.cjs.map → dimensions-HfZjDJQz.cjs.map} +1 -1
- package/dist/dropdown.cjs +1 -12
- package/dist/dropdown.cjs.map +1 -1
- package/dist/dropdown.js +7 -6
- package/dist/dropdown.js.map +1 -1
- package/dist/external--jsfNkbo.cjs +2 -0
- package/dist/external--jsfNkbo.cjs.map +1 -0
- package/dist/external-1DGLK9F2.js +17 -0
- package/dist/external-1DGLK9F2.js.map +1 -0
- package/dist/external-4h9H4Y_N.js +21 -0
- package/dist/external-4h9H4Y_N.js.map +1 -0
- package/dist/external-4uqucf0m.js +67 -0
- package/dist/{external-QuVTCnGl.js.map → external-4uqucf0m.js.map} +1 -1
- package/dist/external-A_eQgT5T.cjs +2 -0
- package/dist/external-A_eQgT5T.cjs.map +1 -0
- package/dist/external-FCO_hdNr.js +24 -0
- package/dist/external-FCO_hdNr.js.map +1 -0
- package/dist/external-HZ6f2KvU.cjs +2 -0
- package/dist/external-HZ6f2KvU.cjs.map +1 -0
- package/dist/external-LPdjowBG.cjs +2 -0
- package/dist/external-LPdjowBG.cjs.map +1 -0
- package/dist/external-O1b3FJKI.cjs +2 -0
- package/dist/external-O1b3FJKI.cjs.map +1 -0
- package/dist/external-RGdrJX7y.cjs +2 -0
- package/dist/{external-9Ncn2J9B.cjs.map → external-RGdrJX7y.cjs.map} +1 -1
- package/dist/external-WiHGqQPA.js +30 -0
- package/dist/external-WiHGqQPA.js.map +1 -0
- package/dist/external-eWu6hCLU.cjs +2 -0
- package/dist/external-eWu6hCLU.cjs.map +1 -0
- package/dist/external-kvAz85mu.js +18 -0
- package/dist/external-kvAz85mu.js.map +1 -0
- package/dist/external-mpVdVPF1.js +88 -0
- package/dist/external-mpVdVPF1.js.map +1 -0
- package/dist/external-nTDD8IMd.cjs +2 -0
- package/dist/external-nTDD8IMd.cjs.map +1 -0
- package/dist/external-phknItOL.js +15 -0
- package/dist/external-phknItOL.js.map +1 -0
- package/dist/external-rGcWjp84.cjs +2 -0
- package/dist/{external-zBiIxeDG.cjs.map → external-rGcWjp84.cjs.map} +1 -1
- package/dist/external-r_2-tYfC.js +88 -0
- package/dist/{external-up1sE3F6.js.map → external-r_2-tYfC.js.map} +1 -1
- package/dist/external-sHbzLUrP.js +17 -0
- package/dist/external-sHbzLUrP.js.map +1 -0
- package/dist/external-tZiYBM94.cjs +2 -0
- package/dist/external-tZiYBM94.cjs.map +1 -0
- package/dist/external-tnCo64yx.cjs +2 -0
- package/dist/external-tnCo64yx.cjs.map +1 -0
- package/dist/external-uR-7_68y.js +16 -0
- package/dist/external-uR-7_68y.js.map +1 -0
- package/dist/external-uSIsCKNG.js +15 -0
- package/dist/external-uSIsCKNG.js.map +1 -0
- package/dist/external-z6BLlxur.cjs +2 -0
- package/dist/external-z6BLlxur.cjs.map +1 -0
- package/dist/font-HpLrwPSD.js +16 -0
- package/dist/{font-t7KoGNFX.js.map → font-HpLrwPSD.js.map} +1 -1
- package/dist/font-yosRgv9n.cjs +2 -0
- package/dist/{font-wlgaMRYN.cjs.map → font-yosRgv9n.cjs.map} +1 -1
- package/dist/fontString-_dtZSiPk.cjs +2 -0
- package/dist/{fontString-i24UxKCQ.cjs.map → fontString-_dtZSiPk.cjs.map} +1 -1
- package/dist/fontString-lodjYTYz.js +12 -0
- package/dist/{fontString-RKvYIr5H.js.map → fontString-lodjYTYz.js.map} +1 -1
- package/dist/header.cjs +1 -14
- package/dist/header.cjs.map +1 -1
- package/dist/header.js +9 -8
- package/dist/header.js.map +1 -1
- package/dist/index.cjs +1 -1174
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +737 -930
- package/dist/index.js.map +1 -1
- package/dist/input/Input.stories.d.ts +1 -0
- package/dist/input/TextArea.d.ts +20 -0
- package/dist/input/external.d.ts +1 -0
- package/dist/input/types.d.ts +4 -2
- package/dist/input.cjs +1 -14
- package/dist/input.cjs.map +1 -1
- package/dist/input.js +9 -8
- package/dist/input.js.map +1 -1
- package/dist/jsx-runtime-NmMXPjeo.js +632 -0
- package/dist/{jsx-runtime-rX5tAIG2.js.map → jsx-runtime-NmMXPjeo.js.map} +1 -1
- package/dist/jsx-runtime-evvPGacs.cjs +28 -0
- package/dist/{jsx-runtime-N1ikfypN.cjs.map → jsx-runtime-evvPGacs.cjs.map} +1 -1
- package/dist/list.cjs +1 -26
- package/dist/list.cjs.map +1 -1
- package/dist/list.js +21 -19
- package/dist/list.js.map +1 -1
- package/dist/menu.cjs +1 -15
- package/dist/menu.cjs.map +1 -1
- package/dist/menu.js +10 -9
- package/dist/menu.js.map +1 -1
- package/dist/style.css +1 -3119
- package/dist/table-MJysJcCC.js +10312 -0
- package/dist/table-MJysJcCC.js.map +1 -0
- package/dist/table-NIrLpFOm.cjs +69 -0
- package/dist/table-NIrLpFOm.cjs.map +1 -0
- package/dist/tabs.cjs +1 -14
- package/dist/tabs.cjs.map +1 -1
- package/dist/tabs.js +9 -8
- package/dist/tabs.js.map +1 -1
- package/dist/text.cjs +1 -16
- package/dist/text.cjs.map +1 -1
- package/dist/text.js +11 -10
- package/dist/text.js.map +1 -1
- package/dist/theming.cjs +1 -15
- package/dist/theming.cjs.map +1 -1
- package/dist/theming.js +10 -9
- package/dist/theming.js.map +1 -1
- package/dist/tree.cjs +1 -25
- package/dist/tree.cjs.map +1 -1
- package/dist/tree.js +20 -18
- package/dist/tree.js.map +1 -1
- package/dist/triggers.cjs +1 -15
- package/dist/triggers.cjs.map +1 -1
- package/dist/triggers.js +10 -9
- package/dist/triggers.js.map +1 -1
- package/dist/useDrag-4o21IpGy.js +36 -0
- package/dist/{useDrag-rQt5hv4R.js.map → useDrag-4o21IpGy.js.map} +1 -1
- package/dist/useDrag-l_moa7e3.cjs +2 -0
- package/dist/{useDrag-KRQ7DTg1.cjs.map → useDrag-l_moa7e3.cjs.map} +1 -1
- package/dist/video.cjs +1 -9
- package/dist/video.cjs.map +1 -1
- package/dist/video.js +3 -3
- package/package.json +61 -51
- package/dist/Center-ZAcURh-3.cjs +0 -148
- package/dist/Center-gEKkAkdh.js +0 -149
- package/dist/Header-5YX6FUn6.cjs +0 -35
- package/dist/Header-7x6367IV.js +0 -36
- package/dist/Item-EDdYN2NK.js +0 -171
- package/dist/Item-HWzX7RK2.cjs +0 -170
- package/dist/Item-owLU4Xop.js +0 -97
- package/dist/Item-rkSKzZoh.cjs +0 -96
- package/dist/Keyboard-mE03PKwA.js +0 -14
- package/dist/Keyboard-w372197S.cjs +0 -13
- package/dist/Link-laNlv47N.js +0 -13
- package/dist/Link-xlTZan29.cjs +0 -12
- package/dist/SelectLevel-bGb0dRXh.cjs +0 -152
- package/dist/SelectLevel-cewIWtOv.js +0 -153
- package/dist/Selector-R3lL41_i.js +0 -267
- package/dist/Selector-hQLSIYum.cjs +0 -266
- package/dist/TimeRangeChip-XXXLMCrf.cjs +0 -9316
- package/dist/TimeRangeChip-XXXLMCrf.cjs.map +0 -1
- package/dist/TimeRangeChip-eDCX5pUC.js +0 -9301
- package/dist/TimeRangeChip-eDCX5pUC.js.map +0 -1
- package/dist/Toggle-eOKYw1OT.cjs +0 -13664
- package/dist/Toggle-eOKYw1OT.cjs.map +0 -1
- package/dist/Toggle-kLunfJtR.js +0 -13665
- package/dist/Toggle-kLunfJtR.js.map +0 -1
- package/dist/Video-Vpwp5ao1.js +0 -12
- package/dist/Video-a7BUKvzF.cjs +0 -11
- package/dist/component-joFaJiQW.cjs +0 -24719
- package/dist/component-joFaJiQW.cjs.map +0 -1
- package/dist/component-k78Jq9I7.js +0 -24720
- package/dist/component-k78Jq9I7.js.map +0 -1
- package/dist/css-NTD4Xm8x.js +0 -9206
- package/dist/css-V3VUT_Js.cjs +0 -9204
- package/dist/dimensions-Sej0Zly9.cjs +0 -26
- package/dist/dimensions-guJ5PHmb.js +0 -27
- package/dist/external-2Aicsb3l.js +0 -88
- package/dist/external-2Aicsb3l.js.map +0 -1
- package/dist/external-9Ncn2J9B.cjs +0 -93
- package/dist/external-9RCzxzgZ.js +0 -30
- package/dist/external-9RCzxzgZ.js.map +0 -1
- package/dist/external-9pS8-DvV.js +0 -15
- package/dist/external-9pS8-DvV.js.map +0 -1
- package/dist/external-KxlyA74C.js +0 -20
- package/dist/external-KxlyA74C.js.map +0 -1
- package/dist/external-OSLzuRs1.cjs +0 -14
- package/dist/external-OSLzuRs1.cjs.map +0 -1
- package/dist/external-PS3nzqUn.cjs +0 -23
- package/dist/external-PS3nzqUn.cjs.map +0 -1
- package/dist/external-QRmqSjV0.js +0 -18
- package/dist/external-QRmqSjV0.js.map +0 -1
- package/dist/external-QuVTCnGl.js +0 -71
- package/dist/external-U5HRPaDI.cjs +0 -17
- package/dist/external-U5HRPaDI.cjs.map +0 -1
- package/dist/external-_CtRDtih.js +0 -17
- package/dist/external-_CtRDtih.js.map +0 -1
- package/dist/external-eQU48hM4.cjs +0 -87
- package/dist/external-eQU48hM4.cjs.map +0 -1
- package/dist/external-kbDFnfuk.js +0 -24
- package/dist/external-kbDFnfuk.js.map +0 -1
- package/dist/external-oX1JmOFf.js +0 -17
- package/dist/external-oX1JmOFf.js.map +0 -1
- package/dist/external-oZe6tF4A.cjs +0 -14
- package/dist/external-oZe6tF4A.cjs.map +0 -1
- package/dist/external-tVcmKSsT.cjs +0 -19
- package/dist/external-tVcmKSsT.cjs.map +0 -1
- package/dist/external-up1sE3F6.js +0 -94
- package/dist/external-uvx0b-Jw.cjs +0 -16
- package/dist/external-uvx0b-Jw.cjs.map +0 -1
- package/dist/external-vXBQOmKv.js +0 -15
- package/dist/external-vXBQOmKv.js.map +0 -1
- package/dist/external-yiqRIIvW.cjs +0 -16
- package/dist/external-yiqRIIvW.cjs.map +0 -1
- package/dist/external-zBiIxeDG.cjs +0 -70
- package/dist/external-zw9fckWT.cjs +0 -29
- package/dist/external-zw9fckWT.cjs.map +0 -1
- package/dist/font-t7KoGNFX.js +0 -17
- package/dist/font-wlgaMRYN.cjs +0 -16
- package/dist/fontString-RKvYIr5H.js +0 -13
- package/dist/fontString-i24UxKCQ.cjs +0 -12
- package/dist/jsx-runtime-N1ikfypN.cjs +0 -931
- package/dist/jsx-runtime-rX5tAIG2.js +0 -932
- package/dist/table-8MFXzE4C.js +0 -13664
- package/dist/table-8MFXzE4C.js.map +0 -1
- package/dist/table-VNkSG_Cj.cjs +0 -13661
- package/dist/table-VNkSG_Cj.cjs.map +0 -1
- package/dist/useDrag-KRQ7DTg1.cjs +0 -48
- package/dist/useDrag-rQt5hv4R.js +0 -49
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";var xf=Object.defineProperty;var Of=(r,e,t)=>e in r?xf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Oe=(r,e,t)=>(Of(r,typeof e!="symbol"?e+"":e,t),t);const he=require("./css-s9KpanYu.cjs"),u=require("zod"),ml=require("react");var Tf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}const lc=r=>typeof r=="function",dc=(r,e)=>lc(r)?r(e):r,Zi=r=>yl(r)?r():r,yl=r=>typeof r=="function",Ef=({initial:r,value:e,onChange:t})=>{const[n,s]=ml.useState(Zi(e??r));return e!=null&&t!=null?[e,t]:[n,s]},gl=({initial:r,value:e,onChange:t})=>{const[n,s]=ml.useState(Zi(e??r));return e!=null&&t!=null?[e,t]:[n,s]},Nf=Object.freeze(Object.defineProperty({__proto__:null,executeInitialSetter:Zi,executeSetter:dc,isInitialSetter:yl,isSetter:lc,usePassthrough:Ef,usePurePassthrough:gl},Symbol.toStringTag,{value:"Module"})),vl=["success","error","warning","info","loading","disabled"],wl=u.z.enum(vl),_l=u.z.object({key:u.z.string(),variant:wl,message:u.z.string(),time:he.TimeStamp.z,data:u.z.record(u.z.unknown()).optional()});var Af=Object.defineProperty,Cf=(r,e,t)=>e in r?Af(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,v=(r,e,t)=>(Cf(r,typeof e!="symbol"?e+"":e,t),t),qn,Cr,la,da,If=Object.defineProperty,jf=(r,e,t)=>e in r?If(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,E=(r,e,t)=>(jf(r,typeof e!="symbol"?e+"":e,t),t),xn;const Zf=r=>r!=null&&typeof r=="object"&&"toString"in r,Rf=(r,e=!1)=>{const t=Zf(r)?"stringer":typeof r;let n;switch(t){case"string":n=(s,a)=>s.localeCompare(a);break;case"stringer":n=(s,a)=>s.toString().localeCompare(a.toString());break;case"number":n=(s,a)=>s-a;break;case"bigint":n=(s,a)=>s-a>BigInt(0)?1:-1;break;case"boolean":n=(s,a)=>Number(s)-Number(a);break;default:return console.warn("sortFunc: unknown type"),()=>-1}return e?zf(n):n},zf=r=>(e,t)=>r(t,e);var be;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(be||(be={}));var So;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(So||(So={}));const U=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zr=r=>{switch(typeof r){case"undefined":return U.undefined;case"string":return U.string;case"number":return isNaN(r)?U.nan:U.number;case"boolean":return U.boolean;case"function":return U.function;case"bigint":return U.bigint;case"symbol":return U.symbol;case"object":return Array.isArray(r)?U.array:r===null?U.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?U.promise:typeof Map<"u"&&r instanceof Map?U.map:typeof Set<"u"&&r instanceof Set?U.set:typeof Date<"u"&&r instanceof Date?U.date:U.object;default:return U.unknown}},N=be.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Pf=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Mt extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,c=0;for(;c<i.path.length;){const d=i.path[c];c===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],c++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Mt.create=r=>new Mt(r);const as=(r,e)=>{let t;switch(r.code){case N.invalid_type:r.received===U.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case N.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,be.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:t=`Unrecognized key(s) in object: ${be.joinValues(r.keys,", ")}`;break;case N.invalid_union:t="Invalid input";break;case N.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${be.joinValues(r.options)}`;break;case N.invalid_enum_value:t=`Invalid enum value. Expected ${be.joinValues(r.options)}, received '${r.received}'`;break;case N.invalid_arguments:t="Invalid function arguments";break;case N.invalid_return_type:t="Invalid function return type";break;case N.invalid_date:t="Invalid date";break;case N.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:be.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case N.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case N.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case N.custom:t="Invalid input";break;case N.invalid_intersection_types:t="Intersection results could not be merged";break;case N.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case N.not_finite:t="Number must be finite";break;default:t=e.defaultError,be.assertNever(r)}return{message:t}};let bl=as;function $f(r){bl=r}function Ya(){return bl}const Ha=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const c=n.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},Df=[];function B(r,e){const t=Ha({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ya(),as].filter(n=>!!n)});r.common.issues.push(t)}class at{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t)n.push({key:await s.key,value:await s.value});return at.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return Q;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const Q=Object.freeze({status:"aborted"}),kl=r=>({status:"dirty",value:r}),ht=r=>({status:"valid",value:r}),Eo=r=>r.status==="aborted",No=r=>r.status==="dirty",is=r=>r.status==="valid",Ga=r=>typeof Promise<"u"&&r instanceof Promise;var W;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(W||(W={}));class Xt{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const fu=(r,e)=>{if(is(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Mt(r.common.issues);return this._error=t,this._error}}};function ie(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:t??o.defaultError},description:s}}class ue{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return zr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:zr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new at,ctx:{common:e.parent.common,data:e.data,parsedType:zr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ga(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zr(e)},a=this._parseSync({data:e,path:s.path,parent:s});return fu(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zr(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Ga(s)?s:Promise.resolve(s));return fu(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:N.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Ft({schema:this,typeName:H.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return kr.create(this,this._def)}nullable(){return dn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Lt.create(this,this._def)}promise(){return Zn.create(this,this._def)}or(e){return ls.create([this,e],this._def)}and(e){return ds.create(this,e,this._def)}transform(e){return new Ft({...ie(this._def),schema:this,typeName:H.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ys({...ie(this._def),innerType:this,defaultValue:t,typeName:H.ZodDefault})}brand(){return new Ol({typeName:H.ZodBranded,type:this,...ie(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ei({...ie(this._def),innerType:this,catchValue:t,typeName:H.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Xs.create(this,e)}readonly(){return ri.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Uf=/^c[^\s-]{8,}$/i,Mf=/^[a-z][a-z0-9]*$/,Lf=/^[0-9A-HJKMNP-TV-Z]{26}$/,Bf=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Vf=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ff="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let uo;const Kf=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Wf=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,qf=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Yf(r,e){return!!((e==="v4"||!e)&&Kf.test(r)||(e==="v6"||!e)&&Wf.test(r))}class Dt extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==U.string){const a=this._getOrReturnCtx(e);return B(a,{code:N.invalid_type,expected:U.string,received:a.parsedType}),Q}const n=new at;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:N.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:N.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?B(s,{code:N.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&B(s,{code:N.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Vf.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"email",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")uo||(uo=new RegExp(Ff,"u")),uo.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"emoji",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Bf.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"uuid",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Uf.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cuid",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Mf.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cuid2",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Lf.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"ulid",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),B(s,{validation:"url",code:N.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"regex",code:N.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),B(s,{code:N.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),B(s,{code:N.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),B(s,{code:N.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?qf(a).test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:N.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?Yf(e.data,a.version)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"ip",code:N.invalid_string,message:a.message}),n.dirty()):be.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:N.invalid_string,...W.errToObj(n)})}_addCheck(e){return new Dt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...W.errToObj(e)})}url(e){return this._addCheck({kind:"url",...W.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...W.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...W.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...W.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...W.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...W.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...W.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...W.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...W.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...W.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...W.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...W.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...W.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...W.errToObj(t)})}nonempty(e){return this.min(1,W.errToObj(e))}trim(){return new Dt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Dt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Dt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Dt.create=r=>{var e;return new Dt({checks:[],typeName:H.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ie(r)})};function Hf(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class Br extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==U.number){const a=this._getOrReturnCtx(e);return B(a,{code:N.invalid_type,expected:U.number,received:a.parsedType}),Q}let n;const s=new at;for(const a of this._def.checks)a.kind==="int"?be.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:N.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:N.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:N.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Hf(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:N.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:N.not_finite,message:a.message}),s.dirty()):be.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,W.toString(t))}gt(e,t){return this.setLimit("min",e,!1,W.toString(t))}lte(e,t){return this.setLimit("max",e,!0,W.toString(t))}lt(e,t){return this.setLimit("max",e,!1,W.toString(t))}setLimit(e,t,n,s){return new Br({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:W.toString(s)}]})}_addCheck(e){return new Br({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:W.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:W.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:W.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:W.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&be.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Br.create=r=>new Br({checks:[],typeName:H.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...ie(r)});class Vr extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==U.bigint){const a=this._getOrReturnCtx(e);return B(a,{code:N.invalid_type,expected:U.bigint,received:a.parsedType}),Q}let n;const s=new at;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:N.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:N.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),B(n,{code:N.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):be.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,W.toString(t))}gt(e,t){return this.setLimit("min",e,!1,W.toString(t))}lte(e,t){return this.setLimit("max",e,!0,W.toString(t))}lt(e,t){return this.setLimit("max",e,!1,W.toString(t))}setLimit(e,t,n,s){return new Vr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:W.toString(s)}]})}_addCheck(e){return new Vr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Vr.create=r=>{var e;return new Vr({checks:[],typeName:H.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ie(r)})};class os extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==U.boolean){const n=this._getOrReturnCtx(e);return B(n,{code:N.invalid_type,expected:U.boolean,received:n.parsedType}),Q}return ht(e.data)}}os.create=r=>new os({typeName:H.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...ie(r)});class un extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==U.date){const a=this._getOrReturnCtx(e);return B(a,{code:N.invalid_type,expected:U.date,received:a.parsedType}),Q}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return B(a,{code:N.invalid_date}),Q}const n=new at;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:N.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:N.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):be.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new un({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:W.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:W.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}un.create=r=>new un({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:H.ZodDate,...ie(r)});class Ja extends ue{_parse(e){if(this._getType(e)!==U.symbol){const n=this._getOrReturnCtx(e);return B(n,{code:N.invalid_type,expected:U.symbol,received:n.parsedType}),Q}return ht(e.data)}}Ja.create=r=>new Ja({typeName:H.ZodSymbol,...ie(r)});class cs extends ue{_parse(e){if(this._getType(e)!==U.undefined){const n=this._getOrReturnCtx(e);return B(n,{code:N.invalid_type,expected:U.undefined,received:n.parsedType}),Q}return ht(e.data)}}cs.create=r=>new cs({typeName:H.ZodUndefined,...ie(r)});class us extends ue{_parse(e){if(this._getType(e)!==U.null){const n=this._getOrReturnCtx(e);return B(n,{code:N.invalid_type,expected:U.null,received:n.parsedType}),Q}return ht(e.data)}}us.create=r=>new us({typeName:H.ZodNull,...ie(r)});class jn extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return ht(e.data)}}jn.create=r=>new jn({typeName:H.ZodAny,...ie(r)});class an extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ht(e.data)}}an.create=r=>new an({typeName:H.ZodUnknown,...ie(r)});class Er extends ue{_parse(e){const t=this._getOrReturnCtx(e);return B(t,{code:N.invalid_type,expected:U.never,received:t.parsedType}),Q}}Er.create=r=>new Er({typeName:H.ZodNever,...ie(r)});class Xa extends ue{_parse(e){if(this._getType(e)!==U.undefined){const n=this._getOrReturnCtx(e);return B(n,{code:N.invalid_type,expected:U.void,received:n.parsedType}),Q}return ht(e.data)}}Xa.create=r=>new Xa({typeName:H.ZodVoid,...ie(r)});class Lt extends ue{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==U.array)return B(t,{code:N.invalid_type,expected:U.array,received:t.parsedType}),Q;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(B(t,{code:i?N.too_big:N.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(B(t,{code:N.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(B(t,{code:N.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new Xt(t,i,t.path,o)))).then(i=>at.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Xt(t,i,t.path,o)));return at.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Lt({...this._def,minLength:{value:e,message:W.toString(t)}})}max(e,t){return new Lt({...this._def,maxLength:{value:e,message:W.toString(t)}})}length(e,t){return new Lt({...this._def,exactLength:{value:e,message:W.toString(t)}})}nonempty(e){return this.min(1,e)}}Lt.create=(r,e)=>new Lt({type:r,minLength:null,maxLength:null,exactLength:null,typeName:H.ZodArray,...ie(e)});function En(r){if(r instanceof Le){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=kr.create(En(n))}return new Le({...r._def,shape:()=>e})}else return r instanceof Lt?new Lt({...r._def,type:En(r.element)}):r instanceof kr?kr.create(En(r.unwrap())):r instanceof dn?dn.create(En(r.unwrap())):r instanceof Qt?Qt.create(r.items.map(e=>En(e))):r}class Le extends ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=be.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==U.object){const d=this._getOrReturnCtx(e);return B(d,{code:N.invalid_type,expected:U.object,received:d.parsedType}),Q}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Er&&this._def.unknownKeys==="strip"))for(const d in s.data)i.includes(d)||o.push(d);const c=[];for(const d of i){const w=a[d],D=s.data[d];c.push({key:{status:"valid",value:d},value:w._parse(new Xt(s,D,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof Er){const d=this._def.unknownKeys;if(d==="passthrough")for(const w of o)c.push({key:{status:"valid",value:w},value:{status:"valid",value:s.data[w]}});else if(d==="strict")o.length>0&&(B(s,{code:N.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const w of o){const D=s.data[w];c.push({key:{status:"valid",value:w},value:d._parse(new Xt(s,D,s.path,w)),alwaysSet:w in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const w of c){const D=await w.key;d.push({key:D,value:await w.value,alwaysSet:w.alwaysSet})}return d}).then(d=>at.mergeObjectSync(n,d)):at.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return W.errToObj,new Le({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const c=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=W.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new Le({...this._def,unknownKeys:"strip"})}passthrough(){return new Le({...this._def,unknownKeys:"passthrough"})}extend(e){return new Le({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Le({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:H.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Le({...this._def,catchall:e})}pick(e){const t={};return be.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Le({...this._def,shape:()=>t})}omit(e){const t={};return be.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Le({...this._def,shape:()=>t})}deepPartial(){return En(this)}partial(e){const t={};return be.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new Le({...this._def,shape:()=>t})}required(e){const t={};return be.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof kr;)a=a._def.innerType;t[n]=a}}),new Le({...this._def,shape:()=>t})}keyof(){return xl(be.objectKeys(this.shape))}}Le.create=(r,e)=>new Le({shape:()=>r,unknownKeys:"strip",catchall:Er.create(),typeName:H.ZodObject,...ie(e)});Le.strictCreate=(r,e)=>new Le({shape:()=>r,unknownKeys:"strict",catchall:Er.create(),typeName:H.ZodObject,...ie(e)});Le.lazycreate=(r,e)=>new Le({shape:r,unknownKeys:"strip",catchall:Er.create(),typeName:H.ZodObject,...ie(e)});class ls extends ue{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new Mt(o.ctx.common.issues));return B(t,{code:N.invalid_union,unionErrors:i}),Q}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const d={...t,common:{...t.common,issues:[]},parent:null},w=c._parseSync({data:t.data,path:t.path,parent:d});if(w.status==="valid")return w;w.status==="dirty"&&!a&&(a={result:w,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new Mt(c));return B(t,{code:N.invalid_union,unionErrors:o}),Q}}get options(){return this._def.options}}ls.create=(r,e)=>new ls({options:r,typeName:H.ZodUnion,...ie(e)});const ka=r=>r instanceof fs?ka(r.schema):r instanceof Ft?ka(r.innerType()):r instanceof ps?[r.value]:r instanceof Fr?r.options:r instanceof ms?Object.keys(r.enum):r instanceof ys?ka(r._def.innerType):r instanceof cs?[void 0]:r instanceof us?[null]:null;class Ri extends ue{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.object)return B(t,{code:N.invalid_type,expected:U.object,received:t.parsedType}),Q;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(B(t,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=ka(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new Ri({typeName:H.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...ie(n)})}}function Ao(r,e){const t=zr(r),n=zr(e);if(r===e)return{valid:!0,data:r};if(t===U.object&&n===U.object){const s=be.objectKeys(e),a=be.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=Ao(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===U.array&&n===U.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],c=Ao(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===U.date&&n===U.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ds extends ue{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Eo(a)||Eo(i))return Q;const o=Ao(a.value,i.value);return o.valid?((No(a)||No(i))&&t.dirty(),{status:t.value,value:o.data}):(B(n,{code:N.invalid_intersection_types}),Q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ds.create=(r,e,t)=>new ds({left:r,right:e,typeName:H.ZodIntersection,...ie(t)});class Qt extends ue{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.array)return B(n,{code:N.invalid_type,expected:U.array,received:n.parsedType}),Q;if(n.data.length<this._def.items.length)return B(n,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&n.data.length>this._def.items.length&&(B(n,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new Xt(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>at.mergeArray(t,i)):at.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Qt({...this._def,rest:e})}}Qt.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qt({items:r,typeName:H.ZodTuple,rest:null,...ie(e)})};class hs extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.object)return B(n,{code:N.invalid_type,expected:U.object,received:n.parsedType}),Q;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Xt(n,o,n.path,o)),value:i._parse(new Xt(n,n.data[o],n.path,o))});return n.common.async?at.mergeObjectAsync(t,s):at.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof ue?new hs({keyType:e,valueType:t,typeName:H.ZodRecord,...ie(n)}):new hs({keyType:Dt.create(),valueType:e,typeName:H.ZodRecord,...ie(t)})}}class Qa extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.map)return B(n,{code:N.invalid_type,expected:U.map,received:n.parsedType}),Q;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],d)=>({key:s._parse(new Xt(n,o,n.path,[d,"key"])),value:a._parse(new Xt(n,c,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const d=await c.key,w=await c.value;if(d.status==="aborted"||w.status==="aborted")return Q;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const d=c.key,w=c.value;if(d.status==="aborted"||w.status==="aborted")return Q;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}}}}Qa.create=(r,e,t)=>new Qa({valueType:e,keyType:r,typeName:H.ZodMap,...ie(t)});class ln extends ue{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==U.set)return B(n,{code:N.invalid_type,expected:U.set,received:n.parsedType}),Q;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(B(n,{code:N.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(B(n,{code:N.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const d=new Set;for(const w of c){if(w.status==="aborted")return Q;w.status==="dirty"&&t.dirty(),d.add(w.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((c,d)=>a._parse(new Xt(n,c,n.path,d)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new ln({...this._def,minSize:{value:e,message:W.toString(t)}})}max(e,t){return new ln({...this._def,maxSize:{value:e,message:W.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ln.create=(r,e)=>new ln({valueType:r,minSize:null,maxSize:null,typeName:H.ZodSet,...ie(e)});class Cn extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.function)return B(t,{code:N.invalid_type,expected:U.function,received:t.parsedType}),Q;function n(o,c){return Ha({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ya(),as].filter(d=>!!d),issueData:{code:N.invalid_arguments,argumentsError:c}})}function s(o,c){return Ha({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ya(),as].filter(d=>!!d),issueData:{code:N.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Zn){const o=this;return ht(async function(...c){const d=new Mt([]),w=await o._def.args.parseAsync(c,a).catch(ee=>{throw d.addIssue(n(c,ee)),d}),D=await Reflect.apply(i,this,w);return await o._def.returns._def.type.parseAsync(D,a).catch(ee=>{throw d.addIssue(s(D,ee)),d})})}else{const o=this;return ht(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new Mt([n(c,d.error)]);const w=Reflect.apply(i,this,d.data),D=o._def.returns.safeParse(w,a);if(!D.success)throw new Mt([s(w,D.error)]);return D.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Cn({...this._def,args:Qt.create(e).rest(an.create())})}returns(e){return new Cn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Cn({args:e||Qt.create([]).rest(an.create()),returns:t||an.create(),typeName:H.ZodFunction,...ie(n)})}}class fs extends ue{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}fs.create=(r,e)=>new fs({getter:r,typeName:H.ZodLazy,...ie(e)});class ps extends ue{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return B(t,{received:t.data,code:N.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}}ps.create=(r,e)=>new ps({value:r,typeName:H.ZodLiteral,...ie(e)});function xl(r,e){return new Fr({values:r,typeName:H.ZodEnum,...ie(e)})}class Fr extends ue{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return B(t,{expected:be.joinValues(n),received:t.parsedType,code:N.invalid_type}),Q}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return B(t,{received:t.data,code:N.invalid_enum_value,options:n}),Q}return ht(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return Fr.create(e)}exclude(e){return Fr.create(this.options.filter(t=>!e.includes(t)))}}Fr.create=xl;class ms extends ue{_parse(e){const t=be.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==U.string&&n.parsedType!==U.number){const s=be.objectValues(t);return B(n,{expected:be.joinValues(s),received:n.parsedType,code:N.invalid_type}),Q}if(t.indexOf(e.data)===-1){const s=be.objectValues(t);return B(n,{received:n.data,code:N.invalid_enum_value,options:s}),Q}return ht(e.data)}get enum(){return this._def.values}}ms.create=(r,e)=>new ms({values:r,typeName:H.ZodNativeEnum,...ie(e)});class Zn extends ue{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.promise&&t.common.async===!1)return B(t,{code:N.invalid_type,expected:U.promise,received:t.parsedType}),Q;const n=t.parsedType===U.promise?t.data:Promise.resolve(t.data);return ht(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Zn.create=(r,e)=>new Zn({type:r,typeName:H.ZodPromise,...ie(e)});class Ft extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===H.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{B(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Q:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?Q:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!is(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>is(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);be.assertNever(s)}}Ft.create=(r,e,t)=>new Ft({schema:r,typeName:H.ZodEffects,effect:e,...ie(t)});Ft.createWithPreprocess=(r,e,t)=>new Ft({schema:e,effect:{type:"preprocess",transform:r},typeName:H.ZodEffects,...ie(t)});class kr extends ue{_parse(e){return this._getType(e)===U.undefined?ht(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}kr.create=(r,e)=>new kr({innerType:r,typeName:H.ZodOptional,...ie(e)});class dn extends ue{_parse(e){return this._getType(e)===U.null?ht(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}dn.create=(r,e)=>new dn({innerType:r,typeName:H.ZodNullable,...ie(e)});class ys extends ue{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===U.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ys.create=(r,e)=>new ys({innerType:r,typeName:H.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});class ei extends ue{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ga(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Mt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Mt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ei.create=(r,e)=>new ei({innerType:r,typeName:H.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});class ti extends ue{_parse(e){if(this._getType(e)!==U.nan){const n=this._getOrReturnCtx(e);return B(n,{code:N.invalid_type,expected:U.nan,received:n.parsedType}),Q}return{status:"valid",value:e.data}}}ti.create=r=>new ti({typeName:H.ZodNaN,...ie(r)});const Gf=Symbol("zod_brand");class Ol extends ue{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Xs extends ue{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Q:a.status==="dirty"?(t.dirty(),kl(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Q:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Xs({in:e,out:t,typeName:H.ZodPipeline})}}class ri extends ue{_parse(e){const t=this._def.innerType._parse(e);return is(t)&&(t.value=Object.freeze(t.value)),t}}ri.create=(r,e)=>new ri({innerType:r,typeName:H.ZodReadonly,...ie(e)});const Tl=(r,e={},t)=>r?jn.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:c})}}):jn.create(),Jf={object:Le.lazycreate};var H;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(H||(H={}));const Xf=(r,e={message:`Input not instance of ${r.name}`})=>Tl(t=>t instanceof r,e),Sl=Dt.create,El=Br.create,Qf=ti.create,ep=Vr.create,Nl=os.create,tp=un.create,rp=Ja.create,np=cs.create,sp=us.create,ap=jn.create,ip=an.create,op=Er.create,cp=Xa.create,up=Lt.create,lp=Le.create,dp=Le.strictCreate,hp=ls.create,fp=Ri.create,pp=ds.create,mp=Qt.create,yp=hs.create,gp=Qa.create,vp=ln.create,wp=Cn.create,_p=fs.create,bp=ps.create,kp=Fr.create,xp=ms.create,Op=Zn.create,pu=Ft.create,Tp=kr.create,Sp=dn.create,Ep=Ft.createWithPreprocess,Np=Xs.create,Ap=()=>Sl().optional(),Cp=()=>El().optional(),Ip=()=>Nl().optional(),jp={string:r=>Dt.create({...r,coerce:!0}),number:r=>Br.create({...r,coerce:!0}),boolean:r=>os.create({...r,coerce:!0}),bigint:r=>Vr.create({...r,coerce:!0}),date:r=>un.create({...r,coerce:!0})},Zp=Q;var O=Object.freeze({__proto__:null,defaultErrorMap:as,setErrorMap:$f,getErrorMap:Ya,makeIssue:Ha,EMPTY_PATH:Df,addIssueToContext:B,ParseStatus:at,INVALID:Q,DIRTY:kl,OK:ht,isAborted:Eo,isDirty:No,isValid:is,isAsync:Ga,get util(){return be},get objectUtil(){return So},ZodParsedType:U,getParsedType:zr,ZodType:ue,ZodString:Dt,ZodNumber:Br,ZodBigInt:Vr,ZodBoolean:os,ZodDate:un,ZodSymbol:Ja,ZodUndefined:cs,ZodNull:us,ZodAny:jn,ZodUnknown:an,ZodNever:Er,ZodVoid:Xa,ZodArray:Lt,ZodObject:Le,ZodUnion:ls,ZodDiscriminatedUnion:Ri,ZodIntersection:ds,ZodTuple:Qt,ZodRecord:hs,ZodMap:Qa,ZodSet:ln,ZodFunction:Cn,ZodLazy:fs,ZodLiteral:ps,ZodEnum:Fr,ZodNativeEnum:ms,ZodPromise:Zn,ZodEffects:Ft,ZodTransformer:Ft,ZodOptional:kr,ZodNullable:dn,ZodDefault:ys,ZodCatch:ei,ZodNaN:ti,BRAND:Gf,ZodBranded:Ol,ZodPipeline:Xs,ZodReadonly:ri,custom:Tl,Schema:ue,ZodSchema:ue,late:Jf,get ZodFirstPartyTypeKind(){return H},coerce:jp,any:ap,array:up,bigint:ep,boolean:Nl,date:tp,discriminatedUnion:fp,effect:pu,enum:kp,function:wp,instanceof:Xf,intersection:pp,lazy:_p,literal:bp,map:gp,nan:Qf,nativeEnum:xp,never:op,null:sp,nullable:Sp,number:El,object:lp,oboolean:Ip,onumber:Cp,optional:Tp,ostring:Ap,pipeline:Np,preprocess:Ep,promise:Op,record:yp,set:vp,strictObject:dp,string:Sl,symbol:rp,transformer:pu,tuple:mp,undefined:np,union:hp,unknown:ip,void:cp,NEVER:Zp,ZodIssueCode:N,quotelessJson:Pf,ZodError:Mt});const hc=O.tuple([O.number(),O.number()]),Al=O.object({width:O.number(),height:O.number()}),Rp=O.object({signedWidth:O.number(),signedHeight:O.number()}),zp=["width","height"];O.enum(zp);const Pp=["start","center","end"],$p=["signedWidth","signedHeight"];O.enum($p);const ni=O.object({x:O.number(),y:O.number()}),Dp=O.object({clientX:O.number(),clientY:O.number()}),Up=["x","y"],Cl=O.enum(Up),Il=["top","right","bottom","left"];O.enum(Il);const Mp=["left","right"],Lp=O.enum(Mp),Bp=["top","bottom"],Vp=O.enum(Bp),jl=["center"];O.enum(jl);const Fp=[...Il,...jl],si=O.enum(Fp);O.enum(Pp);const Kp=["first","last"];O.enum(Kp);const Wp=O.object({lower:O.number(),upper:O.number()});O.union([Wp,hc]);O.union([Cl,si]);O.union([Cl,si,O.instanceof(String)]);const xa=(r,e)=>{const t={lower:0,upper:0};return typeof r=="number"?e!=null?(t.lower=r,t.upper=e):(t.lower=0,t.upper=r):Array.isArray(r)?[t.lower,t.upper]=r:(t.lower=r.lower,t.upper=r.upper),qp(t)},qp=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r;var Ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},me={},zi={};Object.defineProperty(zi,"__esModule",{value:!0});function Yp(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"$"+n}).toLowerCase().replace(/(\$)(\w)/g,function(e,t,n){return n.toUpperCase()}):""}zi.default=Yp;var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});function Hp(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"_").toLowerCase():""}Pi.default=Hp;var $i={};Object.defineProperty($i,"__esModule",{value:!0});function Gp(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"$").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"$"+n}).toLowerCase().replace(/(\$)(\w?)/g,function(e,t,n){return n.toUpperCase()}):""}$i.default=Gp;var fc={};Object.defineProperty(fc,"__esModule",{value:!0});function Jp(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,".").toLowerCase():""}fc.default=Jp;var pc={};Object.defineProperty(pc,"__esModule",{value:!0});function Xp(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"/").toLowerCase():""}pc.default=Xp;var mc={};Object.defineProperty(mc,"__esModule",{value:!0});function Qp(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase():""}mc.default=Qp;var yc={};Object.defineProperty(yc,"__esModule",{value:!0});function em(r){if(r===void 0&&(r=""),!r)return"";var e=String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(t,n,s){return n+"_"+s.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}yc.default=em;var gc={};Object.defineProperty(gc,"__esModule",{value:!0});function tm(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase().replace(/( ?)(\w+)( ?)/g,function(e,t,n,s){return t+n.charAt(0).toUpperCase()+n.slice(1)+s}):""}gc.default=tm;var Di={};Object.defineProperty(Di,"__esModule",{value:!0});function rm(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"-").toLowerCase():""}Di.default=rm;var vc={},vn={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.belongToTypes=r.isValidObject=r.isArrayObject=r.validateOptions=r.DefaultOption=void 0,r.DefaultOption={recursive:!1,recursiveInArray:!1,keepTypesOnRecursion:[]},r.validateOptions=function(e){return e===void 0&&(e=r.DefaultOption),e.recursive==null?e=r.DefaultOption:e.recursiveInArray==null&&(e.recursiveInArray=!1),e},r.isArrayObject=function(e){return e!=null&&Array.isArray(e)},r.isValidObject=function(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)},r.belongToTypes=function(e,t){return(t||[]).some(function(n){return e instanceof n})}})(vn);var nm=Ct&&Ct.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(vc,"__esModule",{value:!0});var ar=vn;function Oa(r,e){if(e===void 0&&(e=ar.DefaultOption),!ar.isValidObject(r))return null;e=ar.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toLowerCase();e.recursive&&(ar.isValidObject(s)?ar.belongToTypes(s,e.keepTypesOnRecursion)||(s=Oa(s,e)):e.recursiveInArray&&ar.isArrayObject(s)&&(s=nm(s).map(function(i){var o=i;if(ar.isValidObject(i))ar.belongToTypes(o,e.keepTypesOnRecursion)||(o=Oa(i,e));else if(ar.isArrayObject(i)){var c=Oa({key:i},e);o=c.key}return o}))),t[a]=s}),t}vc.default=Oa;var wc={},sm=Ct&&Ct.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(wc,"__esModule",{value:!0});var ir=vn;function Ta(r,e){if(e===void 0&&(e=ir.DefaultOption),!ir.isValidObject(r))return null;e=ir.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toUpperCase();e.recursive&&(ir.isValidObject(s)?ir.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ta(s,e)):e.recursiveInArray&&ir.isArrayObject(s)&&(s=sm(s).map(function(i){var o=i;if(ir.isValidObject(i))ir.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ta(i,e));else if(ir.isArrayObject(i)){var c=Ta({key:i},e);o=c.key}return o}))),t[a]=s}),t}wc.default=Ta;var _c={},am=Ct&&Ct.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(_c,"__esModule",{value:!0});var or=vn,im=zi;function Sa(r,e){if(e===void 0&&(e=or.DefaultOption),!or.isValidObject(r))return null;e=or.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=im.default(n);e.recursive&&(or.isValidObject(s)?or.belongToTypes(s,e.keepTypesOnRecursion)||(s=Sa(s,e)):e.recursiveInArray&&or.isArrayObject(s)&&(s=am(s).map(function(i){var o=i;if(or.isValidObject(i))or.belongToTypes(o,e.keepTypesOnRecursion)||(o=Sa(i,e));else if(or.isArrayObject(i)){var c=Sa({key:i},e);o=c.key}return o}))),t[a]=s}),t}_c.default=Sa;var bc={},om=Ct&&Ct.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(bc,"__esModule",{value:!0});var cr=vn,cm=Pi;function Ea(r,e){if(e===void 0&&(e=cr.DefaultOption),!cr.isValidObject(r))return null;e=cr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=cm.default(n);e.recursive&&(cr.isValidObject(s)?cr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ea(s,e)):e.recursiveInArray&&cr.isArrayObject(s)&&(s=om(s).map(function(i){var o=i;if(cr.isValidObject(i))cr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ea(i,e));else if(cr.isArrayObject(i)){var c=Ea({key:i},e);o=c.key}return o}))),t[a]=s}),t}bc.default=Ea;var kc={},um=Ct&&Ct.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(kc,"__esModule",{value:!0});var ur=vn,lm=$i;function Na(r,e){if(e===void 0&&(e=ur.DefaultOption),!ur.isValidObject(r))return null;e=ur.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=lm.default(n);e.recursive&&(ur.isValidObject(s)?ur.belongToTypes(s,e.keepTypesOnRecursion)||(s=Na(s,e)):e.recursiveInArray&&ur.isArrayObject(s)&&(s=um(s).map(function(i){var o=i;if(ur.isValidObject(i))ur.belongToTypes(o,e.keepTypesOnRecursion)||(o=Na(i,e));else if(ur.isArrayObject(i)){var c=Na({key:i},e);o=c.key}return o}))),t[a]=s}),t}kc.default=Na;var xc={},dm=Ct&&Ct.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(xc,"__esModule",{value:!0});var lr=vn,hm=Di;function Aa(r,e){if(e===void 0&&(e=lr.DefaultOption),!lr.isValidObject(r))return null;e=lr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=hm.default(n);e.recursive&&(lr.isValidObject(s)?lr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Aa(s,e)):e.recursiveInArray&&lr.isArrayObject(s)&&(s=dm(s).map(function(i){var o=i;if(lr.isValidObject(i))lr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Aa(i,e));else if(lr.isArrayObject(i)){var c=Aa({key:i},e);o=c.key}return o}))),t[a]=s}),t}xc.default=Aa;Object.defineProperty(me,"__esModule",{value:!0});me.kebabKeys=me.pascalKeys=me.snakeKeys=me.camelKeys=me.upperKeys=me.lowerKeys=me.toLowerCase=me.toUpperCase=me.toKebabCase=me.toHeaderCase=me.toSentenceCase=me.toTextCase=me.toPathCase=me.toDotCase=me.toPascalCase=me.toSnakeCase=me.toCamelCase=void 0;var Zl=zi;me.toCamelCase=Zl.default;var Rl=Pi;me.toSnakeCase=Rl.default;var zl=$i;me.toPascalCase=zl.default;var Pl=fc;me.toDotCase=Pl.default;var $l=pc;me.toPathCase=$l.default;var Dl=mc;me.toTextCase=Dl.default;var Ul=yc;me.toSentenceCase=Ul.default;var Ml=gc;me.toHeaderCase=Ml.default;var Ll=Di;me.toKebabCase=Ll.default;var Bl=vc;me.lowerKeys=Bl.default;var Vl=wc;me.upperKeys=Vl.default;var Fl=_c;me.camelKeys=Fl.default;var Kl=bc;me.snakeKeys=Kl.default;var Wl=kc;me.pascalKeys=Wl.default;var ql=xc;me.kebabKeys=ql.default;var Yl=function(r){return String(r||"").toLowerCase()};me.toLowerCase=Yl;var Hl=function(r){return String(r||"").toUpperCase()};me.toUpperCase=Hl;var fm={toCamelCase:Zl.default,toSnakeCase:Rl.default,toPascalCase:zl.default,toDotCase:Pl.default,toPathCase:$l.default,toTextCase:Dl.default,toSentenceCase:Ul.default,toHeaderCase:Ml.default,toKebabCase:Ll.default,toUpperCase:Hl,toLowerCase:Yl,lowerKeys:Bl.default,upperKeys:Vl.default,camelKeys:Fl.default,snakeKeys:Kl.default,pascalKeys:Wl.default,kebabKeys:ql.default};me.default=fm;var Gl=me;const Jl={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},pm=r=>Gl.snakeKeys(r,Jl),mm=r=>Gl.camelKeys(r,Jl);var Rn;(r=>{r.toSnake=pm,r.toCamel=mm,r.capitalize=e=>e[0].toUpperCase()+e.slice(1)})(Rn||(Rn={}));O.object({x:si,y:si});const ym=O.object({x:Lp,y:Vp}),gm={x:"left",y:"top"},vm=(r,e)=>r.x===e.x&&r.y===e.y,mu=O.union([O.number(),ni,hc,Al,Rp,Dp]),wm=(r,e)=>typeof r=="number"?{x:r,y:e??r}:Array.isArray(r)?{x:r[0],y:r[1]}:"signedWidth"in r?{x:r.signedWidth,y:r.signedHeight}:"clientX"in r?{x:r.clientX,y:r.clientY}:"width"in r?{x:r.width,y:r.height}:{...r},yu={x:0,y:0},ha=O.union([O.number(),O.string()]);O.object({top:ha,left:ha,width:ha,height:ha});O.object({left:O.number(),top:O.number(),right:O.number(),bottom:O.number()});O.object({one:ni,two:ni,root:ym});const Oc=(r,e,t=0,n=0,s)=>{const a={one:{...yu},two:{...yu},root:s??gm};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return a.one={x:r,y:e},a.two={x:a.one.x+t,y:a.one.y+n},a}return"one"in r&&"two"in r&&"root"in r?{...r,root:s??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(a.one={x:r.left,y:r.top},a.two={x:r.right,y:r.bottom},a):(a.one=r,e==null?a.two={x:a.one.x+t,y:a.one.y+n}:typeof e=="number"?a.two={x:a.one.x+e,y:a.one.y+t}:"width"in e?a.two={x:a.one.x+e.width,y:a.one.y+e.height}:"signedWidth"in e?a.two={x:a.one.x+e.signedWidth,y:a.one.y+e.signedHeight}:a.two=e,a))},lo=r=>{const e=Oc(r);return{lower:e.one.x,upper:e.two.x}},ho=r=>{const e=Oc(r);return{lower:e.one.y,upper:e.two.y}},_m=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,bm=O.object({signedWidth:O.number(),signedHeight:O.number()});O.union([Al,bm,ni,hc]);const km=(r,e,t)=>(e!=null&&(r=Math.max(r,e)),t!=null&&(r=Math.min(r,t)),r);O.object({offset:mu,scale:mu});const xm=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],Om=r=>(e,t,n,s)=>[e,s?n/r:n*r],Tm=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:i,upper:o}=r,c=a-s,d=o-i;if(t==="dimension")return[r,n*(d/c)];const w=(n-s)*(d/c)+i;return[r,w]},Sm=r=>(e,t,n)=>[r,n],Em=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:s}=r;return[r,s-(t-n)]},Nm=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=km(n,s,a),[e,n]},Co=class Xn{constructor(){E(this,"ops",[]),E(this,"currBounds",null),E(this,"currType",null),E(this,"reversed",!1),this.ops=[]}static translate(e){return new Xn().translate(e)}static magnify(e){return new Xn().magnify(e)}static scale(e,t){return new Xn().scale(e,t)}translate(e){const t=this.new(),n=xm(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Om(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=xa(e,t),s=this.new(),a=Tm(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=xa(e,t),s=this.new(),a=Nm(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=xa(e,t),s=this.new(),a=Sm(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=Em();e.type="invert";const t=this.new();return t.ops.push(e),t}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new Xn;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,s],a)=>a(n,e,s,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,s)=>{if(n.type==="scale"||t.some(([i,o])=>s>=i&&s<=o))return;const a=e.ops.findIndex((i,o)=>i.type==="scale"&&o>s);a!==-1&&t.push([s,a])}),t.forEach(([n,s])=>{const a=e.ops.slice(n,s);a.unshift(e.ops[s]),e.ops.splice(n,s-n+1,...a)}),e.reversed=!e.reversed,e}};E(Co,"IDENTITY",new Co);let gu=Co;const vu=class gr{constructor(e=new gu,t=new gu,n=null){E(this,"x"),E(this,"y"),E(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new gr().translate(e,t)}static translateX(e){return new gr().translateX(e)}static translateY(e){return new gr().translateY(e)}static clamp(e){return new gr().clamp(e)}static magnify(e){return new gr().magnify(e)}static scale(e){return new gr().scale(e)}static reBound(e){return new gr().reBound(e)}translate(e,t){const n=wm(e,t),s=this.copy();return s.x=this.x.translate(n.x),s.y=this.y.translate(n.y),s}translateX(e){const t=this.copy();return t.x=this.x.translate(e),t}translateY(e){const t=this.copy();return t.y=this.y.translate(e),t}magnify(e){const t=this.copy();return t.x=this.x.magnify(e.x),t.y=this.y.magnify(e.y),t}scale(e){const t=this.copy();if(_m(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!vm(n,e.root)&&(n.x!==e.root.x&&(t.x=t.x.invert()),n.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(lo(e)),t.y=t.y.scale(ho(e)),t}return t.x=t.x.scale(e.width),t.y=t.y.scale(e.height),t}reBound(e){const t=this.copy();return t.x=this.x.reBound(lo(e)),t.y=this.y.reBound(ho(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(lo(e)),t.y=this.y.clamp(ho(e)),t}copy(){const e=new gr;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}box(e){return Oc(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};E(vu,"IDENTITY",new vu);const Xl=(r,e)=>{const t=new De(e);if(![$e.DAY,$e.HOUR,$e.MINUTE,$e.SECOND,$e.MILLISECOND,$e.MICROSECOND,$e.NANOSECOND].some(s=>s.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof De?new De(n):new $e(n)},Ze=class fe extends Number{constructor(e,t="UTC"){if(e==null)return fe.now();if(e instanceof Date)super(e.getTime()*fe.MILLISECOND.valueOf());else if(typeof e=="string")super(fe.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(fe.parseDate(e));else{let n=0;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=fe.utcOffset.valueOf()),super(e.valueOf()+n)}}static parseDate([e=1970,t=1,n=1]){const s=new Date(e,t-1,n,0,0,0,0);return new fe(s.getTime()*fe.MILLISECOND.valueOf()).truncate(fe.DAY).valueOf()}static parseTimeString(e,t="UTC"){const[n,s,a]=e.split(":");let i="00",o="00";a!=null&&([i,o]=a.split("."));let c=fe.hours(parseInt(n??"00",10)).add(fe.minutes(parseInt(s??"00",10))).add(fe.seconds(parseInt(i??"00",10))).add(fe.milliseconds(parseInt(o??"00",10)));return t==="local"&&(c=c.add(fe.utcOffset)),c.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return fe.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new fe(n.getTime()*fe.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString(t);case"preciseDate":return`${this.dateString(t)} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString(t)} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(fe.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(e="UTC"){const t=this.date(),n=t.toLocaleString("default",{month:"short"}),s=t.toLocaleString("default",{day:"numeric"});return`${n} ${s}`}static get utcOffset(){return new $e(new Date().getTimezoneOffset()*fe.MINUTE.valueOf())}static since(e){return new fe().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new fe(e).valueOf()}span(e){return this.range(e).span}range(e){return new At(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0}after(e){return this.valueOf()>new fe(e).valueOf()}afterEq(e){return this.valueOf()>=new fe(e).valueOf()}before(e){return this.valueOf()<new fe(e).valueOf()}beforeEq(e){return this.valueOf()<=new fe(e).valueOf()}add(e){return new fe(this.valueOf()+e.valueOf())}sub(e){return new fe(this.valueOf()-e.valueOf())}milliseconds(){return this.valueOf()/fe.MILLISECOND.valueOf()}toString(){return this.date().toISOString()}remainder(e){return Xl(this,e)}get isToday(){return this.truncate($e.DAY).equals(fe.now().truncate($e.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new fe(new Date)}static nanoseconds(e){return new fe(e)}static microseconds(e){return fe.nanoseconds(e*1e3)}static milliseconds(e){return fe.microseconds(e*1e3)}static seconds(e){return fe.milliseconds(e*1e3)}static minutes(e){return fe.seconds(e*60)}static hours(e){return fe.minutes(e*60)}static days(e){return fe.hours(e*24)}};E(Ze,"NANOSECOND",Ze.nanoseconds(1));E(Ze,"MICROSECOND",Ze.microseconds(1));E(Ze,"MILLISECOND",Ze.milliseconds(1));E(Ze,"SECOND",Ze.seconds(1));E(Ze,"MINUTE",Ze.minutes(1));E(Ze,"HOUR",Ze.hours(1));E(Ze,"DAY",Ze.days(1));E(Ze,"MAX",new Ze(9122272036554776e3));E(Ze,"MIN",new Ze(0));E(Ze,"ZERO",new Ze(0));E(Ze,"z",O.union([O.instanceof(Number).transform(r=>new Ze(r)),O.number().transform(r=>new Ze(r)),O.instanceof(Ze)]));let De=Ze;const Ae=class Te extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}remainder(e){return Xl(this,e)}truncate(e){return new Te(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}toString(){const e=this.truncate(Te.DAY),t=this.truncate(Te.HOUR),n=this.truncate(Te.MINUTE),s=this.truncate(Te.SECOND),a=this.truncate(Te.MILLISECOND),i=this.truncate(Te.MICROSECOND),o=this.truncate(Te.NANOSECOND),c=e,d=t.sub(e),w=n.sub(t),D=s.sub(n),X=a.sub(s),ee=i.sub(a),Be=o.sub(i);let te="";return c.isZero||(te+=`${c.days}d `),d.isZero||(te+=`${d.hours}h `),w.isZero||(te+=`${w.minutes}m `),D.isZero||(te+=`${D.seconds}s `),X.isZero||(te+=`${X.milliseconds}ms `),ee.isZero||(te+=`${ee.microseconds}µs `),Be.isZero||(te+=`${Be.nanoseconds}ns`),te.trim()}get days(){return this.valueOf()/Te.DAY.valueOf()}get hours(){return this.valueOf()/Te.HOUR.valueOf()}get minutes(){return this.valueOf()/Te.MINUTE.valueOf()}get seconds(){return this.valueOf()/Te.SECOND.valueOf()}get milliseconds(){return this.valueOf()/Te.MILLISECOND.valueOf()}get microseconds(){return this.valueOf()/Te.MICROSECOND.valueOf()}get nanoseconds(){return this.valueOf()}get isZero(){return this.valueOf()===0}equals(e){return this.valueOf()===new Te(e).valueOf()}add(e){return new Te(this.valueOf()+new Te(e).valueOf())}sub(e){return new Te(this.valueOf()-new Te(e).valueOf())}static nanoseconds(e=1){return new Te(e)}static microseconds(e=1){return Te.nanoseconds(e*1e3)}static milliseconds(e=1){return Te.microseconds(e*1e3)}static seconds(e=1){return Te.milliseconds(e*1e3)}static minutes(e){return Te.seconds(e.valueOf()*60)}static hours(e){return Te.minutes(e*60)}static days(e){return Te.hours(e*24)}};E(Ae,"NANOSECOND",Ae.nanoseconds(1));E(Ae,"MICROSECOND",Ae.microseconds(1));E(Ae,"MILLISECOND",Ae.milliseconds(1));E(Ae,"SECOND",Ae.seconds(1));E(Ae,"MINUTE",Ae.minutes(1));E(Ae,"HOUR",Ae.hours(1));E(Ae,"DAY",Ae.days(1));E(Ae,"MAX",new Ae(Ae.MAX_SAFE_INTEGER));E(Ae,"MIN",new Ae(-Ae.MAX_SAFE_INTEGER));E(Ae,"ZERO",new Ae(0));E(Ae,"z",O.union([O.instanceof(Number).transform(r=>new Ae(r)),O.number().transform(r=>new Ae(r)),O.instanceof(Ae)]));let $e=Ae;const Qn=class Ca extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Ca(e).valueOf()}get period(){return $e.seconds(1/this.valueOf())}sampleCount(e){return new $e(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new ut(t).valueOf()}span(e){return $e.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Ca(e)}static khz(e){return Ca.hz(e*1e3)}};E(Qn,"z",O.union([O.number().transform(r=>new Qn(r)),O.instanceof(Number).transform(r=>new Qn(r)),O.instanceof(Qn)]));let Ui=Qn;const tt=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new ai(e*this.valueOf())}};E(tt,"UNKNOWN",new tt(0));E(tt,"BIT128",new tt(16));E(tt,"BIT64",new tt(8));E(tt,"BIT32",new tt(4));E(tt,"BIT16",new tt(2));E(tt,"BIT8",new tt(1));E(tt,"z",O.union([O.number().transform(r=>new tt(r)),O.instanceof(Number).transform(r=>new tt(r)),O.instanceof(tt)]));let ut=tt;const Gt=class Io{constructor(e,t){E(this,"start"),E(this,"end"),this.start=new De(e),this.end=new De(t)}get span(){return new $e(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}swap(){return new Io(this.end,this.start)}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e){e=e.makeValid();const t=this.makeValid();return e.start.equals(t.start)?!0:e.end.equals(this.start)||e.start.equals(this.end)?!1:this.contains(e.end)||this.contains(e.start)||e.contains(this.start)||e.contains(this.end)}contains(e){return e instanceof Io?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}};E(Gt,"MAX",new Gt(De.MIN,De.MAX));E(Gt,"MIN",new Gt(De.MAX,De.MIN));E(Gt,"ZERO",new Gt(De.ZERO,De.ZERO));E(Gt,"z",O.union([O.object({start:De.z,end:De.z}).transform(r=>new Gt(r.start,r.end)),O.instanceof(Gt)]));let At=Gt;const j=class tn extends String{constructor(e){if(e instanceof tn||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const t=tn.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}}throw super(tn.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=tn.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}toString(){return this.valueOf()}get density(){const e=tn.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}checkArray(e){return e.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return tn.BIG_INT_TYPES.some(e=>e.equals(this))}};E(j,"UNKNOWN",new j("unknown"));E(j,"FLOAT64",new j("float64"));E(j,"FLOAT32",new j("float32"));E(j,"INT64",new j("int64"));E(j,"INT32",new j("int32"));E(j,"INT16",new j("int16"));E(j,"INT8",new j("int8"));E(j,"UINT64",new j("uint64"));E(j,"UINT32",new j("uint32"));E(j,"UINT16",new j("uint16"));E(j,"UINT8",new j("uint8"));E(j,"TIMESTAMP",new j("timestamp"));E(j,"UUID",new j("uuid"));E(j,"STRING",new j("string"));E(j,"JSON",new j("json"));E(j,"ARRAY_CONSTRUCTORS",new Map([[j.UINT8.toString(),Uint8Array],[j.UINT16.toString(),Uint16Array],[j.UINT32.toString(),Uint32Array],[j.UINT64.toString(),BigUint64Array],[j.FLOAT32.toString(),Float32Array],[j.FLOAT64.toString(),Float64Array],[j.INT8.toString(),Int8Array],[j.INT16.toString(),Int16Array],[j.INT32.toString(),Int32Array],[j.INT64.toString(),BigInt64Array],[j.TIMESTAMP.toString(),BigInt64Array],[j.STRING.toString(),Uint8Array],[j.JSON.toString(),Uint8Array],[j.UUID.toString(),Uint8Array]]));E(j,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,j.UINT8],[Uint16Array.name,j.UINT16],[Uint32Array.name,j.UINT32],[BigUint64Array.name,j.UINT64],[Float32Array.name,j.FLOAT32],[Float64Array.name,j.FLOAT64],[Int8Array.name,j.INT8],[Int16Array.name,j.INT16],[Int32Array.name,j.INT32],[BigInt64Array.name,j.INT64]]));E(j,"DENSITIES",new Map([[j.UINT8.toString(),ut.BIT8],[j.UINT16.toString(),ut.BIT16],[j.UINT32.toString(),ut.BIT32],[j.UINT64.toString(),ut.BIT64],[j.FLOAT32.toString(),ut.BIT32],[j.FLOAT64.toString(),ut.BIT64],[j.INT8.toString(),ut.BIT8],[j.INT16.toString(),ut.BIT16],[j.INT32.toString(),ut.BIT32],[j.INT64.toString(),ut.BIT64],[j.TIMESTAMP.toString(),ut.BIT64],[j.STRING.toString(),ut.UNKNOWN],[j.JSON.toString(),ut.UNKNOWN],[j.UUID.toString(),ut.BIT128]]));E(j,"BIG_INT_TYPES",[j.INT64,j.UINT64,j.TIMESTAMP]);E(j,"z",O.union([O.string().transform(r=>new j(r)),O.instanceof(j)]));let et=j;const nt=class Ir extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Ir.bytes(this.valueOf()+e.valueOf())}sub(e){return Ir.bytes(this.valueOf()-e.valueOf())}static bytes(e=1){return new Ir(e)}static kilobytes(e=1){return Ir.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Ir.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Ir.megabytes(e.valueOf()*1e3)}static terabytes(e){return Ir.gigabytes(e.valueOf()*1e3)}isZero(){return this.valueOf()===0}};E(nt,"BYTE",new nt(1));E(nt,"KILOBYTE",nt.kilobytes(1));E(nt,"MEGABYTE",nt.megabytes(1));E(nt,"GIGABYTE",nt.gigabytes(1));E(nt,"TERABYTE",nt.terabytes(1));E(nt,"ZERO",new nt(0));E(nt,"z",O.union([O.number().transform(r=>new nt(r)),O.instanceof(nt)]));let ai=nt;O.union([O.instanceof(Uint8Array),O.instanceof(Uint16Array),O.instanceof(Uint32Array),O.instanceof(BigUint64Array),O.instanceof(Float32Array),O.instanceof(Float64Array),O.instanceof(Int8Array),O.instanceof(Int16Array),O.instanceof(Int32Array),O.instanceof(BigInt64Array)]);const Am=(r,e,t,n=0)=>r.usesBigInt&&!e.usesBigInt?Number(t)-Number(n):!r.usesBigInt&&e.usesBigInt?BigInt(t)-BigInt(n):es(t,-n),Cm=(r,e)=>{if(e==null)throw new Error(`field ${r} is null`)},Xr=-1;class $t{constructor(e,t,n,s,a="static",i=0){if(E(this,"dataType"),E(this,"sampleOffset"),E(this,"gl"),E(this,"_data"),E(this,"_timeRange"),E(this,"alignment",0),E(this,"_min"),E(this,"_max"),E(this,"writePos",Xr),E(this,"_refCount",0),t==null&&!(e instanceof ArrayBuffer))this.dataType=new et(e);else if(t!=null)this.dataType=new et(t);else throw new Error("must provide a data type when constructing a Series from a buffer");this.alignment=i,this.sampleOffset=s??0,this._data=e,this._timeRange=n,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:a}}static alloc(e,t,n,s,a="static",i=0){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const o=new new et(t).Array(e),c=new $t(o.buffer,t,n,s,a,i);return c.writePos=0,c}static generateTimestamps(e,t,n){const s=n.spanRange(t.span(e)),a=new BigInt64Array(e);for(let i=0;i<e;i++)a[i]=BigInt(n.add(t.span(i)).valueOf());return new $t(a,et.TIMESTAMP,s)}get refCount(){return this._refCount}static fromStrings(e,t){const n=new TextEncoder().encode(e.join(`
|
|
2
|
+
`)+`
|
|
3
|
+
`);return new $t(n,et.STRING,t)}static fromJSON(e,t){const n=new TextEncoder().encode(e.map(s=>JSON.stringify(s)).join(`
|
|
4
|
+
`)+`
|
|
5
|
+
`);return new $t(n,et.JSON,t)}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){if(this._refCount--,this._refCount===0&&this.gl.control!=null)this.maybeGarbageCollectGLBuffer(this.gl.control);else if(this._refCount<0)throw new Error("cannot release an array with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");if(this.writePos===Xr)return 0;const t=this.cap-this.writePos,n=t<e.length?e.slice(0,t):e;return this.underlyingData.set(n.data,this.writePos),this.maybeRecomputeMinMax(n),this.writePos+=n.length,n.length}get buffer(){return this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===Xr?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.equals(et.STRING))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.buffer).split(`
|
|
6
|
+
`).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(et.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=et.UUID.density.valueOf(),t=Array(this.length);for(let n=0;n<this.length;n++){const s=this.buffer.slice(n*e,(n+1)*e),a=Array.from(new Uint8Array(s),i=>i.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");t[n]=a}return t}parseJSON(e){if(!this.dataType.equals(et.JSON))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.buffer).split(`
|
|
7
|
+
`).slice(0,-1).map(t=>e.parse(JSON.parse(t)))}get timeRange(){return Cm("timeRange",this._timeRange),this._timeRange}get byteCap(){return new ai(this.buffer.byteLength)}get cap(){return this.dataType.density.length(this.byteCap)}get byteLength(){return this.writePos===Xr?this.byteCap:this.dataType.density.size(this.writePos)}get length(){return this.writePos===Xr?this.data.length:this.writePos}convert(e,t=0){if(this.dataType.equals(e))return this;const n=new e.Array(this.length);for(let s=0;s<this.length;s++)n[s]=Am(this.dataType,e,this.data[s],t);return new $t(n.buffer,e,this._timeRange,t,this.gl.bufferUsage,this.alignment)}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(et.TIMESTAMP))this._max=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this._max=e.reduce((t,n)=>t>n?t:n)}else{const e=this.data;this._max=e.reduce((t,n)=>t>n?t:n)}return this._max}get max(){return this.writePos===0?-1/0:(this._max==null&&(this._max=this.calcRawMax()),es(this._max,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(et.TIMESTAMP))this._min=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this._min=e.reduce((t,n)=>t<n?t:n)}else{const e=this.data;this._min=e.reduce((t,n)=>t<n?t:n)}return this._min}get min(){return this.writePos===0?1/0:(this._min==null&&(this._min=this.calcRawMin()),es(this._min,this.sampleOffset))}get bounds(){return xa(Number(this.min),Number(this.max))}maybeRecomputeMinMax(e){if(this._min!=null){const t=e._min??e.calcRawMin();t<this._min&&(this._min=t)}if(this._max!=null){const t=e._max??e.calcRawMax();t>this._max&&(this._max=t)}}enrich(){this.max,this.min}get range(){return es(this.max,-this.min)}at(e){const t=this.data[e];if(t!=null)return es(t,this.sampleOffset)}binarySearch(e){let t=0,n=this.length-1;const s=Rf(e);for(;t<=n;){const a=Math.floor((t+n)/2),i=s(this.at(a),e);if(i===0)return a;i<0?t=a+1:n=a-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(et.FLOAT32))throw new Error("Only FLOAT32 arrays can be used in WebGL");const{buffer:t,bufferUsage:n,prevBuffer:s}=this.gl;if(t==null&&(this.gl.buffer=e.createBuffer()),this.writePos!==s)if(e.bindBuffer(e.ARRAY_BUFFER,this.gl.buffer),this.writePos!==Xr){s===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCap.valueOf(),e.STATIC_DRAW);const a=this.dataType.density.size(s).valueOf(),i=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,a,i.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,n==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=Xr}get digest(){var e;return{dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:this.alignment,timeRange:(e=this._timeRange)==null?void 0:e.toString(),length:this.length}}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}slice(e,t){const n=this.data.slice(e,t);return new $t(n,this.dataType,At.ZERO,this.sampleOffset,this.gl.bufferUsage,this.alignment+e)}reAlign(e){return new $t(this.buffer,this.dataType,At.ZERO,this.sampleOffset,"static",e)}}const es=(r,e)=>typeof r=="bigint"&&typeof e=="bigint"||typeof r=="number"&&typeof e=="number"?r+e:Number(r)+Number(e),Tc=O.record(O.union([O.number(),O.string(),O.symbol()]),O.unknown()),Im=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),jm=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser";jm();const Zm=["MacOS","Windows","Linux","Docker"];O.enum(Zm);const wu=r=>[...new Set(r)],Rm=(...r)=>r.map(Ql).join(""),Ql=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),zm=r=>r.endsWith("/")?r.slice(0,-1):r;let Pm=(xn=class{constructor({host:r,port:e,protocol:t="",pathPrefix:n=""}){E(this,"protocol"),E(this,"host"),E(this,"port"),E(this,"path"),this.protocol=t,this.host=r,this.port=e,this.path=Ql(n)}replace(r){return new xn({host:r.host??this.host,port:r.port??this.port,protocol:r.protocol??this.protocol,pathPrefix:r.pathPrefix??this.path})}child(r){return new xn({...this,pathPrefix:Rm(this.path,r)})}toString(){return zm(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}},E(xn,"UNKNOWN",new xn({host:"unknown",port:0})),xn);const Ce=r=>Array.isArray(r)?r:[r];var jo;try{jo=new TextDecoder}catch{}var z,Et,h=0,ze={},we,Dr,Tt=0,Yt=0,Ge,xr,ft=[],ge,_u={useRecords:!1,mapsAsObjects:!0};class ed{}const td=new ed;td.name="MessagePack 0xC1";var Mr=!1,rd=2,bu;try{new Function("")}catch{rd=1/0}class gs{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=!1&&(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(z)return od(()=>(Ro(),this?this.unpack(e,t):gs.prototype.unpack.call(_u,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(Et=t.end||e.length,h=t.start||0):(h=0,Et=t>-1?t:e.length),Yt=0,Dr=null,Ge=null,z=e;try{ge=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw z=null,e instanceof Uint8Array?n:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof gs){if(ze=this,this.structures)return we=this.structures,fa(t);(!we||we.length>0)&&(we=[])}else ze=_u,(!we||we.length>0)&&(we=[]);return fa(t)}unpackMultiple(e,t){let n,s=0;try{Mr=!0;let a=e.length,i=this?this.unpack(e,a):Mi.unpack(e,a);if(t){if(t(i,s,h)===!1)return;for(;h<a;)if(s=h,t(fa(),s,h)===!1)return}else{for(n=[i];h<a;)s=h,n.push(fa());return n}}catch(a){throw a.lastPosition=s,a.values=n,a}finally{Mr=!1,Ro()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(n=>n.slice(0)));for(let n=0,s=e.length;n<s;n++){let a=e[n];a&&(a.isShared=!0,n>=32&&(a.highByte=n-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let s=e[n],a=t[n];a&&(s&&((e.restoreStructures||(e.restoreStructures=[]))[n]=s),e[n]=a)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function fa(r){try{if(!ze.trusted&&!Mr){let t=we.sharedLength||0;t<we.length&&(we.length=t)}let e;if(ze.randomAccessStructure&&z[h]<64&&z[h]>=32&&bu?(e=bu(z,h,Et,ze),z=null,!(r&&r.lazy)&&e&&(e=e.toJSON()),h=Et):e=Ve(),Ge&&(h=Ge.postBundlePosition,Ge=null),Mr&&(we.restoreStructures=null),h==Et)we&&we.restoreStructures&&ku(),we=null,z=null,xr&&(xr=null);else{if(h>Et)throw new Error("Unexpected end of MessagePack data");if(!Mr){let t;try{t=JSON.stringify(e,(n,s)=>typeof s=="bigint"?`${s}n`:s).slice(0,100)}catch(n){t="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+t)}}return e}catch(e){throw we&&we.restoreStructures&&ku(),Ro(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||h>Et)&&(e.incomplete=!0),e}}function ku(){for(let r in we.restoreStructures)we[r]=we.restoreStructures[r];we.restoreStructures=null}function Ve(){let r=z[h++];if(r<160)if(r<128){if(r<64)return r;{let e=we[r&63]||ze.getStructures&&nd()[r&63];return e?(e.read||(e.read=Sc(e,r&63)),e.read()):r}}else if(r<144)if(r-=128,ze.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=ad();n==="__proto__"&&(n="__proto_"),e[n]=Ve()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Ve(),Ve());return e}else{r-=144;let e=new Array(r);for(let t=0;t<r;t++)e[t]=Ve();return ze.freezeData?Object.freeze(e):e}else if(r<192){let e=r-160;if(Yt>=h)return Dr.slice(h-Tt,(h+=e)-Tt);if(Yt==0&&Et<140){let t=e<16?Ec(e):sd(e);if(t!=null)return t}return Zo(e)}else{let e;switch(r){case 192:return null;case 193:return Ge?(e=Ve(),e>0?Ge[1].slice(Ge.position1,Ge.position1+=e):Ge[0].slice(Ge.position0,Ge.position0-=e)):td;case 194:return!1;case 195:return!0;case 196:if(e=z[h++],e===void 0)throw new Error("Unexpected end of buffer");return fo(e);case 197:return e=ge.getUint16(h),h+=2,fo(e);case 198:return e=ge.getUint32(h),h+=4,fo(e);case 199:return Qr(z[h++]);case 200:return e=ge.getUint16(h),h+=2,Qr(e);case 201:return e=ge.getUint32(h),h+=4,Qr(e);case 202:if(e=ge.getFloat32(h),ze.useFloat32>2){let t=Nc[(z[h]&127)<<1|z[h+1]>>7];return h+=4,(t*e+(e>0?.5:-.5)>>0)/t}return h+=4,e;case 203:return e=ge.getFloat64(h),h+=8,e;case 204:return z[h++];case 205:return e=ge.getUint16(h),h+=2,e;case 206:return e=ge.getUint32(h),h+=4,e;case 207:return ze.int64AsType==="number"?(e=ge.getUint32(h)*4294967296,e+=ge.getUint32(h+4)):ze.int64AsType==="string"?e=ge.getBigUint64(h).toString():ze.int64AsType==="auto"?(e=ge.getBigUint64(h),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ge.getBigUint64(h),h+=8,e;case 208:return ge.getInt8(h++);case 209:return e=ge.getInt16(h),h+=2,e;case 210:return e=ge.getInt32(h),h+=4,e;case 211:return ze.int64AsType==="number"?(e=ge.getInt32(h)*4294967296,e+=ge.getUint32(h+4)):ze.int64AsType==="string"?e=ge.getBigInt64(h).toString():ze.int64AsType==="auto"?(e=ge.getBigInt64(h),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ge.getBigInt64(h),h+=8,e;case 212:if(e=z[h++],e==114)return Nu(z[h++]&63);{let t=ft[e];if(t)return t.read?(h++,t.read(Ve())):t.noBuffer?(h++,t()):t(z.subarray(h,++h));throw new Error("Unknown extension "+e)}case 213:return e=z[h],e==114?(h++,Nu(z[h++]&63,z[h++])):Qr(2);case 214:return Qr(4);case 215:return Qr(8);case 216:return Qr(16);case 217:return e=z[h++],Yt>=h?Dr.slice(h-Tt,(h+=e)-Tt):Dm(e);case 218:return e=ge.getUint16(h),h+=2,Yt>=h?Dr.slice(h-Tt,(h+=e)-Tt):Um(e);case 219:return e=ge.getUint32(h),h+=4,Yt>=h?Dr.slice(h-Tt,(h+=e)-Tt):Mm(e);case 220:return e=ge.getUint16(h),h+=2,Ou(e);case 221:return e=ge.getUint32(h),h+=4,Ou(e);case 222:return e=ge.getUint16(h),h+=2,Tu(e);case 223:return e=ge.getUint32(h),h+=4,Tu(e);default:if(r>=224)return r-256;if(r===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+r)}}}const $m=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Sc(r,e){function t(){if(t.count++>rd){let s=r.read=new Function("r","return function(){return "+(ze.freezeData?"Object.freeze":"")+"({"+r.map(a=>a==="__proto__"?"__proto_:r()":$m.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(Ve);return r.highByte===0&&(r.read=xu(e,r.read)),s()}let n={};for(let s=0,a=r.length;s<a;s++){let i=r[s];i==="__proto__"&&(i="__proto_"),n[i]=Ve()}return ze.freezeData?Object.freeze(n):n}return t.count=0,r.highByte===0?xu(e,t):t}const xu=(r,e)=>function(){let t=z[h++];if(t===0)return e();let n=r<32?-(r+(t<<5)):r+(t<<5),s=we[n]||nd()[n];if(!s)throw new Error("Record id is not defined for "+n);return s.read||(s.read=Sc(s,r)),s.read()};function nd(){let r=od(()=>(z=null,ze.getStructures()));return we=ze._mergeStructures(r,we)}var Zo=Qs,Dm=Qs,Um=Qs,Mm=Qs;function Qs(r){let e;if(r<16&&(e=Ec(r)))return e;if(r>64&&jo)return jo.decode(z.subarray(h,h+=r));const t=h+r,n=[];for(e="";h<t;){const s=z[h++];if(!(s&128))n.push(s);else if((s&224)===192){const a=z[h++]&63;n.push((s&31)<<6|a)}else if((s&240)===224){const a=z[h++]&63,i=z[h++]&63;n.push((s&31)<<12|a<<6|i)}else if((s&248)===240){const a=z[h++]&63,i=z[h++]&63,o=z[h++]&63;let c=(s&7)<<18|a<<12|i<<6|o;c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|c&1023),n.push(c)}else n.push(s);n.length>=4096&&(e+=Ye.apply(String,n),n.length=0)}return n.length>0&&(e+=Ye.apply(String,n)),e}function Ou(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=Ve();return ze.freezeData?Object.freeze(e):e}function Tu(r){if(ze.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=ad();n==="__proto__"&&(n="__proto_"),e[n]=Ve()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Ve(),Ve());return e}}var Ye=String.fromCharCode;function sd(r){let e=h,t=new Array(r);for(let n=0;n<r;n++){const s=z[h++];if((s&128)>0){h=e;return}t[n]=s}return Ye.apply(String,t)}function Ec(r){if(r<4)if(r<2){if(r===0)return"";{let e=z[h++];if((e&128)>1){h-=1;return}return Ye(e)}}else{let e=z[h++],t=z[h++];if((e&128)>0||(t&128)>0){h-=2;return}if(r<3)return Ye(e,t);let n=z[h++];if((n&128)>0){h-=3;return}return Ye(e,t,n)}else{let e=z[h++],t=z[h++],n=z[h++],s=z[h++];if((e&128)>0||(t&128)>0||(n&128)>0||(s&128)>0){h-=4;return}if(r<6){if(r===4)return Ye(e,t,n,s);{let a=z[h++];if((a&128)>0){h-=5;return}return Ye(e,t,n,s,a)}}else if(r<8){let a=z[h++],i=z[h++];if((a&128)>0||(i&128)>0){h-=6;return}if(r<7)return Ye(e,t,n,s,a,i);let o=z[h++];if((o&128)>0){h-=7;return}return Ye(e,t,n,s,a,i,o)}else{let a=z[h++],i=z[h++],o=z[h++],c=z[h++];if((a&128)>0||(i&128)>0||(o&128)>0||(c&128)>0){h-=8;return}if(r<10){if(r===8)return Ye(e,t,n,s,a,i,o,c);{let d=z[h++];if((d&128)>0){h-=9;return}return Ye(e,t,n,s,a,i,o,c,d)}}else if(r<12){let d=z[h++],w=z[h++];if((d&128)>0||(w&128)>0){h-=10;return}if(r<11)return Ye(e,t,n,s,a,i,o,c,d,w);let D=z[h++];if((D&128)>0){h-=11;return}return Ye(e,t,n,s,a,i,o,c,d,w,D)}else{let d=z[h++],w=z[h++],D=z[h++],X=z[h++];if((d&128)>0||(w&128)>0||(D&128)>0||(X&128)>0){h-=12;return}if(r<14){if(r===12)return Ye(e,t,n,s,a,i,o,c,d,w,D,X);{let ee=z[h++];if((ee&128)>0){h-=13;return}return Ye(e,t,n,s,a,i,o,c,d,w,D,X,ee)}}else{let ee=z[h++],Be=z[h++];if((ee&128)>0||(Be&128)>0){h-=14;return}if(r<15)return Ye(e,t,n,s,a,i,o,c,d,w,D,X,ee,Be);let te=z[h++];if((te&128)>0){h-=15;return}return Ye(e,t,n,s,a,i,o,c,d,w,D,X,ee,Be,te)}}}}}function Su(){let r=z[h++],e;if(r<192)e=r-160;else switch(r){case 217:e=z[h++];break;case 218:e=ge.getUint16(h),h+=2;break;case 219:e=ge.getUint32(h),h+=4;break;default:throw new Error("Expected string")}return Qs(e)}function fo(r){return ze.copyBuffers?Uint8Array.prototype.slice.call(z,h,h+=r):z.subarray(h,h+=r)}function Qr(r){let e=z[h++];if(ft[e]){let t;return ft[e](z.subarray(h,t=h+=r),n=>{h=n;try{return Ve()}finally{h=t}})}else throw new Error("Unknown extension type "+e)}var Eu=new Array(4096);function ad(){let r=z[h++];if(r>=160&&r<192){if(r=r-160,Yt>=h)return Dr.slice(h-Tt,(h+=r)-Tt);if(!(Yt==0&&Et<180))return Zo(r)}else return h--,Ve().toString();let e=(r<<5^(r>1?ge.getUint16(h):r>0?z[h]:0))&4095,t=Eu[e],n=h,s=h+r-3,a,i=0;if(t&&t.bytes==r){for(;n<s;){if(a=ge.getUint32(n),a!=t[i++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(a=z[n++],a!=t[i++]){n=1879048192;break}if(n===s)return h=n,t.string;s-=3,n=h}for(t=[],Eu[e]=t,t.bytes=r;n<s;)a=ge.getUint32(n),t.push(a),n+=4;for(s+=3;n<s;)a=z[n++],t.push(a);let o=r<16?Ec(r):sd(r);return o!=null?t.string=o:t.string=Zo(r)}const Nu=(r,e)=>{let t=Ve().map(a=>a.toString()),n=r;e!==void 0&&(r=r<32?-((e<<5)+r):(e<<5)+r,t.highByte=e);let s=we[r];return s&&(s.isShared||Mr)&&((we.restoreStructures||(we.restoreStructures=[]))[r]=s),we[r]=t,t.read=Sc(t,n),t.read()};ft[0]=()=>{};ft[0].noBuffer=!0;let Lm={Error,TypeError,ReferenceError};ft[101]=()=>{let r=Ve();return(Lm[r[0]]||Error)(r[1])};ft[105]=r=>{let e=ge.getUint32(h-4);xr||(xr=new Map);let t=z[h],n;t>=144&&t<160||t==220||t==221?n=[]:n={};let s={target:n};xr.set(e,s);let a=Ve();return s.used?Object.assign(n,a):(s.target=a,a)};ft[112]=r=>{let e=ge.getUint32(h-4),t=xr.get(e);return t.used=!0,t.target};ft[115]=()=>new Set(Ve());const id=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(r=>r+"Array");let Bm=typeof globalThis=="object"?globalThis:window;ft[116]=r=>{let e=r[0],t=id[e];if(!t)throw new Error("Could not find typed array for code "+e);return new Bm[t](Uint8Array.prototype.slice.call(r,1).buffer)};ft[120]=()=>{let r=Ve();return new RegExp(r[0],r[1])};const Vm=[];ft[98]=r=>{let e=(r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3],t=h;return h+=e-r.length,Ge=Vm,Ge=[Su(),Su()],Ge.position0=0,Ge.position1=0,Ge.postBundlePosition=h,h=t,Ve()};ft[255]=r=>r.length==4?new Date((r[0]*16777216+(r[1]<<16)+(r[2]<<8)+r[3])*1e3):r.length==8?new Date(((r[0]<<22)+(r[1]<<14)+(r[2]<<6)+(r[3]>>2))/1e6+((r[3]&3)*4294967296+r[4]*16777216+(r[5]<<16)+(r[6]<<8)+r[7])*1e3):r.length==12?new Date(((r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3])/1e6+((r[4]&128?-281474976710656:0)+r[6]*1099511627776+r[7]*4294967296+r[8]*16777216+(r[9]<<16)+(r[10]<<8)+r[11])*1e3):new Date("invalid");function od(r){let e=Et,t=h,n=Tt,s=Yt,a=Dr,i=xr,o=Ge,c=new Uint8Array(z.slice(0,Et)),d=we,w=we.slice(0,we.length),D=ze,X=Mr,ee=r();return Et=e,h=t,Tt=n,Yt=s,Dr=a,xr=i,Ge=o,z=c,Mr=X,we=d,we.splice(0,we.length,...w),ze=D,ge=new DataView(z.buffer,z.byteOffset,z.byteLength),ee}function Ro(){z=null,xr=null,we=null}function Fm(r){r.unpack?ft[r.type]=r.unpack:ft[r.type]=r}const Nc=new Array(147);for(let r=0;r<256;r++)Nc[r]=+("1e"+Math.floor(45.15-r*.30103));var Mi=new gs({useRecords:!1});const Km=Mi.unpack;Mi.unpackMultiple;Mi.unpack;let Wm=new Float32Array(1);new Uint8Array(Wm.buffer,0,4);let Ia;try{Ia=new TextEncoder}catch{}let ii,Ac;const Li=typeof Buffer<"u",pa=Li?function(r){return Buffer.allocUnsafeSlow(r)}:Uint8Array,cd=Li?Buffer:Uint8Array,Au=Li?4294967296:2144337920;let _,Yn,Se,y=0,ot,Ue=null,qm;const Ym=21760,Hm=/[\u0080-\uFFFF]/,On=Symbol("record-id");class Gm extends gs{constructor(e){super(e),this.offset=0;let t,n,s,a,i=cd.prototype.utf8Write?function(l,x){return _.utf8Write(l,x,4294967295)}:Ia&&Ia.encodeInto?function(l,x){return Ia.encodeInto(l,_.subarray(x)).written}:!1,o=this;e||(e={});let c=e&&e.sequential,d=e.structures||e.saveStructures,w=e.maxSharedStructures;if(w==null&&(w=d?32:0),w>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let D=e.maxOwnStructures;D==null&&(D=d?32:64),!this.structures&&e.useRecords!=!1&&(this.structures=[]);let X=w>32||D+w>64,ee=w+64,Be=w+D+64;if(Be>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let te=[],Hr=0,nr=0;this.pack=this.encode=function(l,x){if(_||(_=new pa(8192),Se=_.dataView||(_.dataView=new DataView(_.buffer,0,8192)),y=0),ot=_.length-10,ot-y<2048?(_=new pa(_.length),Se=_.dataView||(_.dataView=new DataView(_.buffer,0,_.length)),ot=_.length-10,y=0):y=y+7&2147483640,t=y,x&sy&&(y+=x&255),a=o.structuredClone?new Map:null,o.bundleStrings&&typeof l!="string"?(Ue=[],Ue.size=1/0):Ue=null,s=o.structures,s){s.uninitialized&&(s=o._mergeStructures(o.getStructures()));let p=s.sharedLength||0;if(p>w)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+s.sharedLength);if(!s.transitions){s.transitions=Object.create(null);for(let m=0;m<p;m++){let k=s[m];if(!k)continue;let I,$=s.transitions;for(let S=0,ne=k.length;S<ne;S++){let K=k[S];I=$[K],I||(I=$[K]=Object.create(null)),$=I}$[On]=m+64}this.lastNamedStructuresLength=p}c||(s.nextId=p+64)}n&&(n=!1);try{o.randomAccessStructure&&l&&l.constructor&&l.constructor===Object?co(l):re(l);let p=Ue;if(Ue&&ju(t,re,0),a&&a.idsToInsert){let m=a.idsToInsert.sort((S,ne)=>S.offset>ne.offset?1:-1),k=m.length,I=-1;for(;p&&k>0;){let S=m[--k].offset+t;S<p.stringsPosition+t&&I===-1&&(I=0),S>p.position+t?I>=0&&(I+=6):(I>=0&&(Se.setUint32(p.position+t,Se.getUint32(p.position+t)+I),I=-1),p=p.previous,k++)}I>=0&&p&&Se.setUint32(p.position+t,Se.getUint32(p.position+t)+I),y+=m.length*6,y>ot&&Xe(y),o.offset=y;let $=Xm(_.subarray(t,y),m);return a=null,$}return o.offset=y,x&ry?(_.start=t,_.end=y,_):_.subarray(t,y)}finally{if(s&&(Bn(),n&&o.saveStructures)){let p=s.sharedLength||0,m=_.subarray(t,y),k=ey(s,o);return o.saveStructures(k,k.isCompatible)===!1?o.pack(l,x):(o.lastNamedStructuresLength=p,m)}x&ny&&(y=t)}};const Bn=()=>{nr<10&&nr++;let l=s.sharedLength||0;if(s.length>l&&!c&&(s.length=l),Hr>1e4)s.transitions=null,nr=0,Hr=0,te.length>0&&(te=[]);else if(te.length>0&&!c){for(let x=0,p=te.length;x<p;x++)te[x][On]=0;te=[]}},Gr=l=>{var x=l.length;x<16?_[y++]=144|x:x<65536?(_[y++]=220,_[y++]=x>>8,_[y++]=x&255):(_[y++]=221,Se.setUint32(y,x),y+=4);for(let p=0;p<x;p++)re(l[p])},re=l=>{y>ot&&(_=Xe(y));var x=typeof l,p;if(x==="string"){let m=l.length;if(Ue&&m>=4&&m<4096){if((Ue.size+=m)>Ym){let S,ne=(Ue[0]?Ue[0].length*3+Ue[1].length:0)+10;y+ne>ot&&(_=Xe(y+ne));let K;Ue.position?(K=Ue,_[y]=200,y+=3,_[y++]=98,S=y-t,y+=4,ju(t,re,0),Se.setUint16(S+t-3,y-t-S)):(_[y++]=214,_[y++]=98,S=y-t,y+=4),Ue=["",""],Ue.previous=K,Ue.size=0,Ue.position=S}let $=Hm.test(l);Ue[$?0:1]+=l,_[y++]=193,re($?-m:m);return}let k;m<32?k=1:m<256?k=2:m<65536?k=3:k=5;let I=m*3;if(y+I>ot&&(_=Xe(y+I)),m<64||!i){let $,S,ne,K=y+k;for($=0;$<m;$++)S=l.charCodeAt($),S<128?_[K++]=S:S<2048?(_[K++]=S>>6|192,_[K++]=S&63|128):(S&64512)===55296&&((ne=l.charCodeAt($+1))&64512)===56320?(S=65536+((S&1023)<<10)+(ne&1023),$++,_[K++]=S>>18|240,_[K++]=S>>12&63|128,_[K++]=S>>6&63|128,_[K++]=S&63|128):(_[K++]=S>>12|224,_[K++]=S>>6&63|128,_[K++]=S&63|128);p=K-y-k}else p=i(l,y+k);p<32?_[y++]=160|p:p<256?(k<2&&_.copyWithin(y+2,y+1,y+1+p),_[y++]=217,_[y++]=p):p<65536?(k<3&&_.copyWithin(y+3,y+2,y+2+p),_[y++]=218,_[y++]=p>>8,_[y++]=p&255):(k<5&&_.copyWithin(y+5,y+3,y+3+p),_[y++]=219,Se.setUint32(y,p),y+=4),y+=p}else if(x==="number")if(l>>>0===l)l<32||l<128&&this.useRecords===!1||l<64&&!this.randomAccessStructure?_[y++]=l:l<256?(_[y++]=204,_[y++]=l):l<65536?(_[y++]=205,_[y++]=l>>8,_[y++]=l&255):(_[y++]=206,Se.setUint32(y,l),y+=4);else if(l>>0===l)l>=-32?_[y++]=256+l:l>=-128?(_[y++]=208,_[y++]=l+256):l>=-32768?(_[y++]=209,Se.setInt16(y,l),y+=2):(_[y++]=210,Se.setInt32(y,l),y+=4);else{let m;if((m=this.useFloat32)>0&&l<4294967296&&l>=-2147483648){_[y++]=202,Se.setFloat32(y,l);let k;if(m<4||(k=l*Nc[(_[y]&127)<<1|_[y+1]>>7])>>0===k){y+=4;return}else y--}_[y++]=203,Se.setFloat64(y,l),y+=8}else if(x==="object"||x==="function")if(!l)_[y++]=192;else{if(a){let k=a.get(l);if(k){if(!k.id){let I=a.idsToInsert||(a.idsToInsert=[]);k.id=I.push(k)}_[y++]=214,_[y++]=112,Se.setUint32(y,k.id),y+=4;return}else a.set(l,{offset:y-t})}let m=l.constructor;if(m===Object)sr(l,!0);else if(m===Array)Gr(l);else if(m===Map)if(this.mapAsEmptyObject)_[y++]=128;else{p=l.size,p<16?_[y++]=128|p:p<65536?(_[y++]=222,_[y++]=p>>8,_[y++]=p&255):(_[y++]=223,Se.setUint32(y,p),y+=4);for(let[k,I]of l)re(k),re(I)}else{for(let k=0,I=ii.length;k<I;k++){let $=Ac[k];if(l instanceof $){let S=ii[k];if(S.write){S.type&&(_[y++]=212,_[y++]=S.type,_[y++]=0);let Qe=S.write.call(this,l);Qe===l?Array.isArray(l)?Gr(l):sr(l):re(Qe);return}let ne=_,K=Se,Ke=y;_=null;let it;try{it=S.pack.call(this,l,Qe=>(_=ne,ne=null,y+=Qe,y>ot&&Xe(y),{target:_,targetView:Se,position:y-Qe}),re)}finally{ne&&(_=ne,Se=K,y=Ke,ot=_.length-10)}it&&(it.length+y>ot&&Xe(it.length+y),y=Jm(it,_,y,S.type));return}}if(Array.isArray(l))Gr(l);else{if(l.toJSON){const k=l.toJSON();if(k!==l)return re(k)}if(x==="function")return re(this.writeFunction&&this.writeFunction(l));sr(l,!l.hasOwnProperty)}}}else if(x==="boolean")_[y++]=l?195:194;else if(x==="bigint"){if(l<BigInt(1)<<BigInt(63)&&l>=-(BigInt(1)<<BigInt(63)))_[y++]=211,Se.setBigInt64(y,l);else if(l<BigInt(1)<<BigInt(64)&&l>0)_[y++]=207,Se.setBigUint64(y,l);else if(this.largeBigIntToFloat)_[y++]=203,Se.setFloat64(y,Number(l));else throw new RangeError(l+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");y+=8}else if(x==="undefined")this.encodeUndefinedAsNil?_[y++]=192:(_[y++]=212,_[y++]=0,_[y++]=0);else throw new Error("Unknown type: "+x)},Vn=this.variableMapSize||this.coercibleKeyAsNumber?l=>{let x=Object.keys(l),p=x.length;p<16?_[y++]=128|p:p<65536?(_[y++]=222,_[y++]=p>>8,_[y++]=p&255):(_[y++]=223,Se.setUint32(y,p),y+=4);let m;if(this.coercibleKeyAsNumber)for(let k=0;k<p;k++){m=x[k];let I=Number(m);re(isNaN(I)?m:I),re(l[m])}else for(let k=0;k<p;k++)re(m=x[k]),re(l[m])}:(l,x)=>{_[y++]=222;let p=y-t;y+=2;let m=0;for(let k in l)(x||l.hasOwnProperty(k))&&(re(k),re(l[k]),m++);_[p+++t]=m>>8,_[p+t]=m&255},Fn=this.useRecords===!1?Vn:e.progressiveRecords&&!X?(l,x)=>{let p,m=s.transitions||(s.transitions=Object.create(null)),k=y++-t,I;for(let $ in l)if(x||l.hasOwnProperty($)){if(p=m[$],p)m=p;else{let S=Object.keys(l),ne=m;m=s.transitions;let K=0;for(let Ke=0,it=S.length;Ke<it;Ke++){let Qe=S[Ke];p=m[Qe],p||(p=m[Qe]=Object.create(null),K++),m=p}k+t+1==y?(y--,Jr(m,S,K)):Wn(m,S,k,K),I=!0,m=ne[$]}re(l[$])}if(!I){let $=m[On];$?_[k+t]=$:Wn(m,Object.keys(l),k,0)}}:(l,x)=>{let p,m=s.transitions||(s.transitions=Object.create(null)),k=0;for(let $ in l)(x||l.hasOwnProperty($))&&(p=m[$],p||(p=m[$]=Object.create(null),k++),m=p);let I=m[On];I?I>=96&&X?(_[y++]=((I-=96)&31)+96,_[y++]=I>>5):_[y++]=I:Jr(m,m.__keys__||Object.keys(l),k);for(let $ in l)(x||l.hasOwnProperty($))&&re(l[$])},Kn=typeof this.useRecords=="function"&&this.useRecords,sr=Kn?(l,x)=>{Kn(l)?Fn(l,x):Vn(l,x)}:Fn,Xe=l=>{let x;if(l>16777216){if(l-t>Au)throw new Error("Packed buffer would be larger than maximum buffer size");x=Math.min(Au,Math.round(Math.max((l-t)*(l>67108864?1.25:2),4194304)/4096)*4096)}else x=(Math.max(l-t<<2,_.length-1)>>12)+1<<12;let p=new pa(x);return Se=p.dataView||(p.dataView=new DataView(p.buffer,0,x)),l=Math.min(l,_.length),_.copy?_.copy(p,0,t,l):p.set(_.slice(t,l)),y-=t,t=0,ot=p.length-10,_=p},Jr=(l,x,p)=>{let m=s.nextId;m||(m=64),m<ee&&this.shouldShareStructure&&!this.shouldShareStructure(x)?(m=s.nextOwnId,m<Be||(m=ee),s.nextOwnId=m+1):(m>=Be&&(m=ee),s.nextId=m+1);let k=x.highByte=m>=96&&X?m-96>>5:-1;l[On]=m,l.__keys__=x,s[m-64]=x,m<ee?(x.isShared=!0,s.sharedLength=m-63,n=!0,k>=0?(_[y++]=(m&31)+96,_[y++]=k):_[y++]=m):(k>=0?(_[y++]=213,_[y++]=114,_[y++]=(m&31)+96,_[y++]=k):(_[y++]=212,_[y++]=114,_[y++]=m),p&&(Hr+=nr*p),te.length>=D&&(te.shift()[On]=0),te.push(l),re(x))},Wn=(l,x,p,m)=>{let k=_,I=y,$=ot,S=t;_=Yn,y=0,t=0,_||(Yn=_=new pa(8192)),ot=_.length-10,Jr(l,x,m),Yn=_;let ne=y;if(_=k,y=I,ot=$,t=S,ne>1){let K=y+ne-1;K>ot&&Xe(K);let Ke=p+t;_.copyWithin(Ke+ne,Ke+1,y),_.set(Yn.slice(0,ne),Ke),y=K}else _[p+t]=Yn[0]},co=(l,x)=>{let p=qm(l,_,t,y,s,Xe,(m,k,I)=>{if(I)return n=!0;y=k;let $=_;return re(m),Bn(),$!==_?{position:y,targetView:Se,target:_}:y},this);if(p===0)return sr(l,!0);y=p}}useBuffer(e){_=e,Se=new DataView(_.buffer,_.byteOffset,_.byteLength),y=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}Ac=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,ed];ii=[{pack(r,e,t){let n=r.getTime()/1e3;if((this.useTimestamp32||r.getMilliseconds()===0)&&n>=0&&n<4294967296){let{target:s,targetView:a,position:i}=e(6);s[i++]=214,s[i++]=255,a.setUint32(i,n)}else if(n>0&&n<4294967296){let{target:s,targetView:a,position:i}=e(10);s[i++]=215,s[i++]=255,a.setUint32(i,r.getMilliseconds()*4e6+(n/1e3/4294967296>>0)),a.setUint32(i+4,n)}else if(isNaN(n)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:s,targetView:a,position:i}=e(3);s[i++]=212,s[i++]=255,s[i++]=255}else{let{target:s,targetView:a,position:i}=e(15);s[i++]=199,s[i++]=12,s[i++]=255,a.setUint32(i,r.getMilliseconds()*1e6),a.setBigInt64(i+4,BigInt(Math.floor(n)))}}},{pack(r,e,t){if(this.setAsEmptyObject)return e(0),t({});let n=Array.from(r),{target:s,position:a}=e(this.moreTypes?3:0);this.moreTypes&&(s[a++]=212,s[a++]=115,s[a++]=0),t(n)}},{pack(r,e,t){let{target:n,position:s}=e(this.moreTypes?3:0);this.moreTypes&&(n[s++]=212,n[s++]=101,n[s++]=0),t([r.name,r.message])}},{pack(r,e,t){let{target:n,position:s}=e(this.moreTypes?3:0);this.moreTypes&&(n[s++]=212,n[s++]=120,n[s++]=0),t([r.source,r.flags])}},{pack(r,e){this.moreTypes?Cu(r,16,e):Iu(Li?Buffer.from(r):new Uint8Array(r),e)}},{pack(r,e){let t=r.constructor;t!==cd&&this.moreTypes?Cu(r,id.indexOf(t.name),e):Iu(r,e)}},{pack(r,e){let{target:t,position:n}=e(1);t[n]=193}}];function Cu(r,e,t,n){let s=r.byteLength;if(s+1<256){var{target:a,position:i}=t(4+s);a[i++]=199,a[i++]=s+1}else if(s+1<65536){var{target:a,position:i}=t(5+s);a[i++]=200,a[i++]=s+1>>8,a[i++]=s+1&255}else{var{target:a,position:i,targetView:o}=t(7+s);a[i++]=201,o.setUint32(i,s+1),i+=4}a[i++]=116,a[i++]=e,a.set(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),i)}function Iu(r,e){let t=r.byteLength;var n,s;if(t<256){var{target:n,position:s}=e(t+2);n[s++]=196,n[s++]=t}else if(t<65536){var{target:n,position:s}=e(t+3);n[s++]=197,n[s++]=t>>8,n[s++]=t&255}else{var{target:n,position:s,targetView:a}=e(t+5);n[s++]=198,a.setUint32(s,t),s+=4}n.set(r,s)}function Jm(r,e,t,n){let s=r.length;switch(s){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:s<256?(e[t++]=199,e[t++]=s):s<65536?(e[t++]=200,e[t++]=s>>8,e[t++]=s&255):(e[t++]=201,e[t++]=s>>24,e[t++]=s>>16&255,e[t++]=s>>8&255,e[t++]=s&255)}return e[t++]=n,e.set(r,t),t+=s,t}function Xm(r,e){let t,n=e.length*6,s=r.length-n;for(;t=e.pop();){let a=t.offset,i=t.id;r.copyWithin(a+n,a,s),n-=6;let o=a+n;r[o++]=214,r[o++]=105,r[o++]=i>>24,r[o++]=i>>16&255,r[o++]=i>>8&255,r[o++]=i&255,s=a}return r}function ju(r,e,t){if(Ue.length>0){Se.setUint32(Ue.position+r,y+t-Ue.position-r),Ue.stringsPosition=y-r;let n=Ue;Ue=null,e(n[0]),e(n[1])}}function Qm(r){if(r.Class){if(!r.pack&&!r.write)throw new Error("Extension has no pack or write function");if(r.pack&&!r.type)throw new Error("Extension has no type (numeric code to identify the extension)");Ac.unshift(r.Class),ii.unshift(r)}Fm(r)}function ey(r,e){return r.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},r}let ud=new Gm({useRecords:!1});const ty=ud.pack;ud.pack;const ry=512,ny=1024,sy=2048;class Cc{constructor(){E(this,"contentType","application/msgpack")}encode(e){return ty(Rn.toSnake(e))}decode(e,t){const n=Rn.toCamel(Km(new Uint8Array(e)));return t!=null?t.parse(n):n}static registerCustomType(e){Qm({type:0,...e})}}class Ic{constructor(){E(this,"contentType","application/json")}encode(e){const t=JSON.stringify(Rn.toSnake(e),(n,s)=>ArrayBuffer.isView(s)?Array.from(s):s);return new TextEncoder().encode(t)}decode(e,t){const n=Rn.toCamel(JSON.parse(new TextDecoder().decode(e)));return t!=null?t.parse(n):n}static registerCustomType(){}}const ay=[new Cc,new Ic],ld=[Cc,Ic],iy=r=>ld.forEach(e=>{e.registerCustomType(r)}),dd=Object.freeze(Object.defineProperty({__proto__:null,ENCODERS:ay,ENCODER_CLASSES:ld,JSONEncoderDecoder:Ic,MsgpackEncoderDecoder:Cc,registerCustomTypeEncoder:iy},Symbol.toStringTag,{value:"Module"}));class oy{constructor(){E(this,"handlers"),this.handlers=new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((t,n)=>n(e))}}const oi=Object.freeze(Object.defineProperty({__proto__:null,Observer:oy},Symbol.toStringTag,{value:"Module"})),ea=u.z.number(),ta=u.z.object({name:u.z.string(),key:u.z.number(),rate:Ui.z,dataType:et.z,leaseholder:u.z.number(),index:u.z.number(),isIndex:u.z.boolean()}),hd=ta.extend({key:u.z.number().optional(),leaseholder:u.z.number().optional(),index:u.z.number().optional(),rate:Ui.z.optional(),isIndex:u.z.boolean().optional()}),fd=r=>r.map(e=>({name:e.name,dataType:new et(e.dataType),rate:new Ui(e.rate??0),leaseholder:e.leaseholder,index:e.index,isIndex:e.isIndex}));u.z.object({channels:hd.array()});const cy=u.z.object({channels:ta.array()}),pd=class md{constructor(e){v(this,"client"),this.client=e}async create(e){const t={channels:fd(e)},[n,s]=await this.client.send(md.ENDPOINT,t,cy);if(s!=null)throw s;return n.channels}};v(pd,"ENDPOINT","/channel/create");let yd=pd;var uy=Object.defineProperty,ly=(r,e,t)=>e in r?uy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,We=(r,e,t)=>(ly(r,typeof e!="symbol"?e+"":e,t),t),dy=Object.defineProperty,hy=(r,e,t)=>e in r?dy(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Z=(r,e,t)=>(hy(r,typeof e!="symbol"?e+"":e,t),t),Tn,ke;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(ke||(ke={}));var zo;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(zo||(zo={}));const M=ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pr=r=>{switch(typeof r){case"undefined":return M.undefined;case"string":return M.string;case"number":return isNaN(r)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(r)?M.array:r===null?M.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?M.promise:typeof Map<"u"&&r instanceof Map?M.map:typeof Set<"u"&&r instanceof Set?M.set:typeof Date<"u"&&r instanceof Date?M.date:M.object;default:return M.unknown}},A=ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),fy=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");let Bt=class extends Error{constructor(r){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};const e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=r}get errors(){return this.issues}format(r){const e=r||function(s){return s.message},t={_errors:[]},n=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)t._errors.push(e(a));else{let i=t,o=0;for(;o<a.path.length;){const c=a.path[o];o===a.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(e(a))):i[c]=i[c]||{_errors:[]},i=i[c],o++}}};return n(this),t}toString(){return this.message}get message(){return JSON.stringify(this.issues,ke.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(r=e=>e.message){const e={},t=[];for(const n of this.issues)n.path.length>0?(e[n.path[0]]=e[n.path[0]]||[],e[n.path[0]].push(r(n))):t.push(r(n));return{formErrors:t,fieldErrors:e}}get formErrors(){return this.flatten()}};Bt.create=r=>new Bt(r);const vs=(r,e)=>{let t;switch(r.code){case A.invalid_type:r.received===M.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case A.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,ke.jsonStringifyReplacer)}`;break;case A.unrecognized_keys:t=`Unrecognized key(s) in object: ${ke.joinValues(r.keys,", ")}`;break;case A.invalid_union:t="Invalid input";break;case A.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ke.joinValues(r.options)}`;break;case A.invalid_enum_value:t=`Invalid enum value. Expected ${ke.joinValues(r.options)}, received '${r.received}'`;break;case A.invalid_arguments:t="Invalid function arguments";break;case A.invalid_return_type:t="Invalid function return type";break;case A.invalid_date:t="Invalid date";break;case A.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:ke.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case A.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case A.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case A.custom:t="Invalid input";break;case A.invalid_intersection_types:t="Intersection results could not be merged";break;case A.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case A.not_finite:t="Number must be finite";break;default:t=e.defaultError,ke.assertNever(r)}return{message:t}};let gd=vs;function py(r){gd=r}function ci(){return gd}const ui=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const c=n.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},my=[];function V(r,e){const t=ui({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ci(),vs].filter(n=>!!n)});r.common.issues.push(t)}let vt=class vd{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return se;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t)n.push({key:await s.key,value:await s.value});return vd.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return se;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}};const se=Object.freeze({status:"aborted"}),wd=r=>({status:"dirty",value:r}),pt=r=>({status:"valid",value:r}),Po=r=>r.status==="aborted",$o=r=>r.status==="dirty",ws=r=>r.status==="valid",li=r=>typeof Promise<"u"&&r instanceof Promise;var q;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(q||(q={}));let er=class{constructor(r,e,t,n){this._cachedPath=[],this.parent=r,this.data=e,this._path=t,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const Zu=(r,e)=>{if(ws(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Bt(r.common.issues);return this._error=t,this._error}}};function oe(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,i)=>a.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.defaultError},description:s}}let le=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Pr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Pr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new vt,ctx:{common:e.parent.common,data:e.data,parsedType:Pr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(li(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pr(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Zu(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pr(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(li(s)?s:Promise.resolve(s));return Zu(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:A.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Kt({schema:this,typeName:G.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Or.create(this,this._def)}nullable(){return fn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hn.create(this,this._def)}promise(){return $n.create(this,this._def)}or(e){return Ss.create([this,e],this._def)}and(e){return Es.create(this,e,this._def)}transform(e){return new Kt({...oe(this._def),schema:this,typeName:G.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Is({...oe(this._def),innerType:this,defaultValue:t,typeName:G.ZodDefault})}brand(){return new Ed({typeName:G.ZodBranded,type:this,...oe(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new mi({...oe(this._def),innerType:this,catchValue:t,typeName:G.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return jc.create(this,e)}readonly(){return gi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const yy=/^c[^\s-]{8,}$/i,gy=/^[a-z][a-z0-9]*$/,vy=/^[0-9A-HJKMNP-TV-Z]{26}$/,wy=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,_y=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,by="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let po;const ky=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,xy=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Oy=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Ty(r,e){return!!((e==="v4"||!e)&&ky.test(r)||(e==="v6"||!e)&&xy.test(r))}let zn=class ts extends le{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==M.string){const s=this._getOrReturnCtx(e);return V(s,{code:A.invalid_type,expected:M.string,received:s.parsedType}),se}const t=new vt;let n;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:A.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:A.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(n=this._getOrReturnCtx(e,n),a?V(n,{code:A.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&V(n,{code:A.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if(s.kind==="email")_y.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"email",code:A.invalid_string,message:s.message}),t.dirty());else if(s.kind==="emoji")po||(po=new RegExp(by,"u")),po.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"emoji",code:A.invalid_string,message:s.message}),t.dirty());else if(s.kind==="uuid")wy.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"uuid",code:A.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid")yy.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"cuid",code:A.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid2")gy.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"cuid2",code:A.invalid_string,message:s.message}),t.dirty());else if(s.kind==="ulid")vy.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"ulid",code:A.invalid_string,message:s.message}),t.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),V(n,{validation:"url",code:A.invalid_string,message:s.message}),t.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"regex",code:A.invalid_string,message:s.message}),t.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),V(n,{code:A.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),V(n,{code:A.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),V(n,{code:A.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):s.kind==="datetime"?Oy(s).test(e.data)||(n=this._getOrReturnCtx(e,n),V(n,{code:A.invalid_string,validation:"datetime",message:s.message}),t.dirty()):s.kind==="ip"?Ty(e.data,s.version)||(n=this._getOrReturnCtx(e,n),V(n,{validation:"ip",code:A.invalid_string,message:s.message}),t.dirty()):ke.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:A.invalid_string,...q.errToObj(n)})}_addCheck(e){return new ts({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...q.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...q.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...q.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...q.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...q.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...q.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...q.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...q.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...q.errToObj(t)})}nonempty(e){return this.min(1,q.errToObj(e))}trim(){return new ts({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ts({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ts({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};zn.create=r=>{var e;return new zn({checks:[],typeName:G.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...oe(r)})};function Sy(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}let _s=class Do extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==M.number){const s=this._getOrReturnCtx(e);return V(s,{code:A.invalid_type,expected:M.number,received:s.parsedType}),se}let t;const n=new vt;for(const s of this._def.checks)s.kind==="int"?ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),V(t,{code:A.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:A.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:A.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?Sy(e.data,s.value)!==0&&(t=this._getOrReturnCtx(e,t),V(t,{code:A.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),V(t,{code:A.not_finite,message:s.message}),n.dirty()):ke.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,q.toString(t))}gt(e,t){return this.setLimit("min",e,!1,q.toString(t))}lte(e,t){return this.setLimit("max",e,!0,q.toString(t))}lt(e,t){return this.setLimit("max",e,!1,q.toString(t))}setLimit(e,t,n,s){return new Do({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:q.toString(s)}]})}_addCheck(e){return new Do({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:q.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:q.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ke.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};_s.create=r=>new _s({checks:[],typeName:G.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...oe(r)});let bs=class Uo extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==M.bigint){const s=this._getOrReturnCtx(e);return V(s,{code:A.invalid_type,expected:M.bigint,received:s.parsedType}),se}let t;const n=new vt;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:A.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),V(t,{code:A.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),V(t,{code:A.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):ke.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,q.toString(t))}gt(e,t){return this.setLimit("min",e,!1,q.toString(t))}lte(e,t){return this.setLimit("max",e,!0,q.toString(t))}lt(e,t){return this.setLimit("max",e,!1,q.toString(t))}setLimit(e,t,n,s){return new Uo({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:q.toString(s)}]})}_addCheck(e){return new Uo({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:q.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};bs.create=r=>{var e;return new bs({checks:[],typeName:G.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...oe(r)})};let ks=class extends le{_parse(r){if(this._def.coerce&&(r.data=!!r.data),this._getType(r)!==M.boolean){const e=this._getOrReturnCtx(r);return V(e,{code:A.invalid_type,expected:M.boolean,received:e.parsedType}),se}return pt(r.data)}};ks.create=r=>new ks({typeName:G.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...oe(r)});let xs=class _d extends le{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==M.date){const s=this._getOrReturnCtx(e);return V(s,{code:A.invalid_type,expected:M.date,received:s.parsedType}),se}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return V(s,{code:A.invalid_date}),se}const t=new vt;let n;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:A.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),V(n,{code:A.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):ke.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new _d({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:q.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:q.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};xs.create=r=>new xs({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:G.ZodDate,...oe(r)});let di=class extends le{_parse(r){if(this._getType(r)!==M.symbol){const e=this._getOrReturnCtx(r);return V(e,{code:A.invalid_type,expected:M.symbol,received:e.parsedType}),se}return pt(r.data)}};di.create=r=>new di({typeName:G.ZodSymbol,...oe(r)});let Os=class extends le{_parse(r){if(this._getType(r)!==M.undefined){const e=this._getOrReturnCtx(r);return V(e,{code:A.invalid_type,expected:M.undefined,received:e.parsedType}),se}return pt(r.data)}};Os.create=r=>new Os({typeName:G.ZodUndefined,...oe(r)});let Ts=class extends le{_parse(r){if(this._getType(r)!==M.null){const e=this._getOrReturnCtx(r);return V(e,{code:A.invalid_type,expected:M.null,received:e.parsedType}),se}return pt(r.data)}};Ts.create=r=>new Ts({typeName:G.ZodNull,...oe(r)});let Pn=class extends le{constructor(){super(...arguments),this._any=!0}_parse(r){return pt(r.data)}};Pn.create=r=>new Pn({typeName:G.ZodAny,...oe(r)});let on=class extends le{constructor(){super(...arguments),this._unknown=!0}_parse(r){return pt(r.data)}};on.create=r=>new on({typeName:G.ZodUnknown,...oe(r)});let Nr=class extends le{_parse(r){const e=this._getOrReturnCtx(r);return V(e,{code:A.invalid_type,expected:M.never,received:e.parsedType}),se}};Nr.create=r=>new Nr({typeName:G.ZodNever,...oe(r)});let hi=class extends le{_parse(r){if(this._getType(r)!==M.undefined){const e=this._getOrReturnCtx(r);return V(e,{code:A.invalid_type,expected:M.void,received:e.parsedType}),se}return pt(r.data)}};hi.create=r=>new hi({typeName:G.ZodVoid,...oe(r)});let hn=class ja extends le{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==M.array)return V(t,{code:A.invalid_type,expected:M.array,received:t.parsedType}),se;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(V(t,{code:i?A.too_big:A.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(V(t,{code:A.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(V(t,{code:A.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new er(t,i,t.path,o)))).then(i=>vt.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new er(t,i,t.path,o)));return vt.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new ja({...this._def,minLength:{value:e,message:q.toString(t)}})}max(e,t){return new ja({...this._def,maxLength:{value:e,message:q.toString(t)}})}length(e,t){return new ja({...this._def,exactLength:{value:e,message:q.toString(t)}})}nonempty(e){return this.min(1,e)}};hn.create=(r,e)=>new hn({type:r,minLength:null,maxLength:null,exactLength:null,typeName:G.ZodArray,...oe(e)});function Nn(r){if(r instanceof It){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Or.create(Nn(n))}return new It({...r._def,shape:()=>e})}else return r instanceof hn?new hn({...r._def,type:Nn(r.element)}):r instanceof Or?Or.create(Nn(r.unwrap())):r instanceof fn?fn.create(Nn(r.unwrap())):r instanceof Kr?Kr.create(r.items.map(e=>Nn(e))):r}let It=class Rt extends le{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==M.object){const c=this._getOrReturnCtx(e);return V(c,{code:A.invalid_type,expected:M.object,received:c.parsedType}),se}const{status:t,ctx:n}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Nr&&this._def.unknownKeys==="strip"))for(const c in n.data)a.includes(c)||i.push(c);const o=[];for(const c of a){const d=s[c],w=n.data[c];o.push({key:{status:"valid",value:c},value:d._parse(new er(n,w,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Nr){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of i)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(c==="strict")i.length>0&&(V(n,{code:A.unrecognized_keys,keys:i}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of i){const w=n.data[d];o.push({key:{status:"valid",value:d},value:c._parse(new er(n,w,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of o){const w=await d.key;c.push({key:w,value:await d.value,alwaysSet:d.alwaysSet})}return c}).then(c=>vt.mergeObjectSync(t,c)):vt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return q.errToObj,new Rt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const c=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=q.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Rt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Rt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:G.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Rt({...this._def,catchall:e})}pick(e){const t={};return ke.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Rt({...this._def,shape:()=>t})}omit(e){const t={};return ke.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Rt({...this._def,shape:()=>t})}deepPartial(){return Nn(this)}partial(e){const t={};return ke.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new Rt({...this._def,shape:()=>t})}required(e){const t={};return ke.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Or;)s=s._def.innerType;t[n]=s}}),new Rt({...this._def,shape:()=>t})}keyof(){return Sd(ke.objectKeys(this.shape))}};It.create=(r,e)=>new It({shape:()=>r,unknownKeys:"strip",catchall:Nr.create(),typeName:G.ZodObject,...oe(e)});It.strictCreate=(r,e)=>new It({shape:()=>r,unknownKeys:"strict",catchall:Nr.create(),typeName:G.ZodObject,...oe(e)});It.lazycreate=(r,e)=>new It({shape:r,unknownKeys:"strip",catchall:Nr.create(),typeName:G.ZodObject,...oe(e)});let Ss=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r),t=this._def.options;function n(s){for(const i of s)if(i.result.status==="valid")return i.result;for(const i of s)if(i.result.status==="dirty")return e.common.issues.push(...i.ctx.common.issues),i.result;const a=s.map(i=>new Bt(i.ctx.common.issues));return V(e,{code:A.invalid_union,unionErrors:a}),se}if(e.common.async)return Promise.all(t.map(async s=>{const a={...e,common:{...e.common,issues:[]},parent:null};return{result:await s._parseAsync({data:e.data,path:e.path,parent:a}),ctx:a}})).then(n);{let s;const a=[];for(const o of t){const c={...e,common:{...e.common,issues:[]},parent:null},d=o._parseSync({data:e.data,path:e.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return e.common.issues.push(...s.ctx.common.issues),s.result;const i=a.map(o=>new Bt(o));return V(e,{code:A.invalid_union,unionErrors:i}),se}}get options(){return this._def.options}};Ss.create=(r,e)=>new Ss({options:r,typeName:G.ZodUnion,...oe(e)});const Za=r=>r instanceof Ns?Za(r.schema):r instanceof Kt?Za(r.innerType()):r instanceof As?[r.value]:r instanceof ra?r.options:r instanceof Cs?Object.keys(r.enum):r instanceof Is?Za(r._def.innerType):r instanceof Os?[void 0]:r instanceof Ts?[null]:null;let bd=class kd extends le{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==M.object)return V(t,{code:A.invalid_type,expected:M.object,received:t.parsedType}),se;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(V(t,{code:A.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),se)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=Za(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new kd({typeName:G.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...oe(n)})}};function Mo(r,e){const t=Pr(r),n=Pr(e);if(r===e)return{valid:!0,data:r};if(t===M.object&&n===M.object){const s=ke.objectKeys(e),a=ke.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=Mo(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===M.array&&n===M.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],c=Mo(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===M.date&&n===M.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}let Es=class extends le{_parse(r){const{status:e,ctx:t}=this._processInputParams(r),n=(s,a)=>{if(Po(s)||Po(a))return se;const i=Mo(s.value,a.value);return i.valid?(($o(s)||$o(a))&&e.dirty(),{status:e.value,value:i.data}):(V(t,{code:A.invalid_intersection_types}),se)};return t.common.async?Promise.all([this._def.left._parseAsync({data:t.data,path:t.path,parent:t}),this._def.right._parseAsync({data:t.data,path:t.path,parent:t})]).then(([s,a])=>n(s,a)):n(this._def.left._parseSync({data:t.data,path:t.path,parent:t}),this._def.right._parseSync({data:t.data,path:t.path,parent:t}))}};Es.create=(r,e,t)=>new Es({left:r,right:e,typeName:G.ZodIntersection,...oe(t)});let Kr=class xd extends le{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.array)return V(n,{code:A.invalid_type,expected:M.array,received:n.parsedType}),se;if(n.data.length<this._def.items.length)return V(n,{code:A.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),se;!this._def.rest&&n.data.length>this._def.items.length&&(V(n,{code:A.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...n.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new er(n,a,n.path,i)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>vt.mergeArray(t,a)):vt.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new xd({...this._def,rest:e})}};Kr.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Kr({items:r,typeName:G.ZodTuple,rest:null,...oe(e)})};let Od=class Lo extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.object)return V(n,{code:A.invalid_type,expected:M.object,received:n.parsedType}),se;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new er(n,o,n.path,o)),value:i._parse(new er(n,n.data[o],n.path,o))});return n.common.async?vt.mergeObjectAsync(t,s):vt.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof le?new Lo({keyType:e,valueType:t,typeName:G.ZodRecord,...oe(n)}):new Lo({keyType:zn.create(),valueType:e,typeName:G.ZodRecord,...oe(t)})}},fi=class extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:e,ctx:t}=this._processInputParams(r);if(t.parsedType!==M.map)return V(t,{code:A.invalid_type,expected:M.map,received:t.parsedType}),se;const n=this._def.keyType,s=this._def.valueType,a=[...t.data.entries()].map(([i,o],c)=>({key:n._parse(new er(t,i,t.path,[c,"key"])),value:s._parse(new er(t,o,t.path,[c,"value"]))}));if(t.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const o of a){const c=await o.key,d=await o.value;if(c.status==="aborted"||d.status==="aborted")return se;(c.status==="dirty"||d.status==="dirty")&&e.dirty(),i.set(c.value,d.value)}return{status:e.value,value:i}})}else{const i=new Map;for(const o of a){const c=o.key,d=o.value;if(c.status==="aborted"||d.status==="aborted")return se;(c.status==="dirty"||d.status==="dirty")&&e.dirty(),i.set(c.value,d.value)}return{status:e.value,value:i}}}};fi.create=(r,e,t)=>new fi({valueType:e,keyType:r,typeName:G.ZodMap,...oe(t)});let pi=class Bo extends le{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.set)return V(n,{code:A.invalid_type,expected:M.set,received:n.parsedType}),se;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(V(n,{code:A.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(V(n,{code:A.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const d=new Set;for(const w of c){if(w.status==="aborted")return se;w.status==="dirty"&&t.dirty(),d.add(w.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((c,d)=>a._parse(new er(n,c,n.path,d)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new Bo({...this._def,minSize:{value:e,message:q.toString(t)}})}max(e,t){return new Bo({...this._def,maxSize:{value:e,message:q.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};pi.create=(r,e)=>new pi({valueType:r,minSize:null,maxSize:null,typeName:G.ZodSet,...oe(e)});let Td=class Ra extends le{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==M.function)return V(t,{code:A.invalid_type,expected:M.function,received:t.parsedType}),se;function n(o,c){return ui({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ci(),vs].filter(d=>!!d),issueData:{code:A.invalid_arguments,argumentsError:c}})}function s(o,c){return ui({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ci(),vs].filter(d=>!!d),issueData:{code:A.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof $n){const o=this;return pt(async function(...c){const d=new Bt([]),w=await o._def.args.parseAsync(c,a).catch(X=>{throw d.addIssue(n(c,X)),d}),D=await Reflect.apply(i,this,w);return await o._def.returns._def.type.parseAsync(D,a).catch(X=>{throw d.addIssue(s(D,X)),d})})}else{const o=this;return pt(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new Bt([n(c,d.error)]);const w=Reflect.apply(i,this,d.data),D=o._def.returns.safeParse(w,a);if(!D.success)throw new Bt([s(w,D.error)]);return D.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ra({...this._def,args:Kr.create(e).rest(on.create())})}returns(e){return new Ra({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Ra({args:e||Kr.create([]).rest(on.create()),returns:t||on.create(),typeName:G.ZodFunction,...oe(n)})}},Ns=class extends le{get schema(){return this._def.getter()}_parse(r){const{ctx:e}=this._processInputParams(r);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};Ns.create=(r,e)=>new Ns({getter:r,typeName:G.ZodLazy,...oe(e)});let As=class extends le{_parse(r){if(r.data!==this._def.value){const e=this._getOrReturnCtx(r);return V(e,{received:e.data,code:A.invalid_literal,expected:this._def.value}),se}return{status:"valid",value:r.data}}get value(){return this._def.value}};As.create=(r,e)=>new As({value:r,typeName:G.ZodLiteral,...oe(e)});function Sd(r,e){return new ra({values:r,typeName:G.ZodEnum,...oe(e)})}let ra=class Vo extends le{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return V(t,{expected:ke.joinValues(n),received:t.parsedType,code:A.invalid_type}),se}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return V(t,{received:t.data,code:A.invalid_enum_value,options:n}),se}return pt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return Vo.create(e)}exclude(e){return Vo.create(this.options.filter(t=>!e.includes(t)))}};ra.create=Sd;let Cs=class extends le{_parse(r){const e=ke.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(r);if(t.parsedType!==M.string&&t.parsedType!==M.number){const n=ke.objectValues(e);return V(t,{expected:ke.joinValues(n),received:t.parsedType,code:A.invalid_type}),se}if(e.indexOf(r.data)===-1){const n=ke.objectValues(e);return V(t,{received:t.data,code:A.invalid_enum_value,options:n}),se}return pt(r.data)}get enum(){return this._def.values}};Cs.create=(r,e)=>new Cs({values:r,typeName:G.ZodNativeEnum,...oe(e)});let $n=class extends le{unwrap(){return this._def.type}_parse(r){const{ctx:e}=this._processInputParams(r);if(e.parsedType!==M.promise&&e.common.async===!1)return V(e,{code:A.invalid_type,expected:M.promise,received:e.parsedType}),se;const t=e.parsedType===M.promise?e.data:Promise.resolve(e.data);return pt(t.then(n=>this._def.type.parseAsync(n,{path:e.path,errorMap:e.common.contextualErrorMap})))}};$n.create=(r,e)=>new $n({type:r,typeName:G.ZodPromise,...oe(e)});let Kt=class extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===G.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{V(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?se:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?se:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ws(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>ws(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);ke.assertNever(s)}};Kt.create=(r,e,t)=>new Kt({schema:r,typeName:G.ZodEffects,effect:e,...oe(t)});Kt.createWithPreprocess=(r,e,t)=>new Kt({schema:e,effect:{type:"preprocess",transform:r},typeName:G.ZodEffects,...oe(t)});let Or=class extends le{_parse(r){return this._getType(r)===M.undefined?pt(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};Or.create=(r,e)=>new Or({innerType:r,typeName:G.ZodOptional,...oe(e)});let fn=class extends le{_parse(r){return this._getType(r)===M.null?pt(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};fn.create=(r,e)=>new fn({innerType:r,typeName:G.ZodNullable,...oe(e)});let Is=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r);let t=e.data;return e.parsedType===M.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};Is.create=(r,e)=>new Is({innerType:r,typeName:G.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...oe(e)});let mi=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r),t={...e,common:{...e.common,issues:[]}},n=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return li(n)?n.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Bt(t.common.issues)},input:t.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Bt(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};mi.create=(r,e)=>new mi({innerType:r,typeName:G.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...oe(e)});let yi=class extends le{_parse(r){if(this._getType(r)!==M.nan){const e=this._getOrReturnCtx(r);return V(e,{code:A.invalid_type,expected:M.nan,received:e.parsedType}),se}return{status:"valid",value:r.data}}};yi.create=r=>new yi({typeName:G.ZodNaN,...oe(r)});const Ey=Symbol("zod_brand");let Ed=class extends le{_parse(r){const{ctx:e}=this._processInputParams(r),t=e.data;return this._def.type._parse({data:t,path:e.path,parent:e})}unwrap(){return this._def.type}},jc=class Nd extends le{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?se:s.status==="dirty"?(t.dirty(),wd(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?se:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Nd({in:e,out:t,typeName:G.ZodPipeline})}},gi=class extends le{_parse(r){const e=this._def.innerType._parse(r);return ws(e)&&(e.value=Object.freeze(e.value)),e}};gi.create=(r,e)=>new gi({innerType:r,typeName:G.ZodReadonly,...oe(e)});const Ad=(r,e={},t)=>r?Pn.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:c})}}):Pn.create(),Ny={object:It.lazycreate};var G;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(G||(G={}));const Ay=(r,e={message:`Input not instance of ${r.name}`})=>Ad(t=>t instanceof r,e),Cd=zn.create,Id=_s.create,Cy=yi.create,Iy=bs.create,jd=ks.create,jy=xs.create,Zy=di.create,Ry=Os.create,zy=Ts.create,Py=Pn.create,$y=on.create,Dy=Nr.create,Uy=hi.create,My=hn.create,Ly=It.create,By=It.strictCreate,Vy=Ss.create,Fy=bd.create,Ky=Es.create,Wy=Kr.create,qy=Od.create,Yy=fi.create,Hy=pi.create,Gy=Td.create,Jy=Ns.create,Xy=As.create,Qy=ra.create,eg=Cs.create,tg=$n.create,Ru=Kt.create,rg=Or.create,ng=fn.create,sg=Kt.createWithPreprocess,ag=jc.create,ig=()=>Cd().optional(),og=()=>Id().optional(),cg=()=>jd().optional(),ug={string:r=>zn.create({...r,coerce:!0}),number:r=>_s.create({...r,coerce:!0}),boolean:r=>ks.create({...r,coerce:!0}),bigint:r=>bs.create({...r,coerce:!0}),date:r=>xs.create({...r,coerce:!0})},lg=se;var T=Object.freeze({__proto__:null,defaultErrorMap:vs,setErrorMap:py,getErrorMap:ci,makeIssue:ui,EMPTY_PATH:my,addIssueToContext:V,ParseStatus:vt,INVALID:se,DIRTY:wd,OK:pt,isAborted:Po,isDirty:$o,isValid:ws,isAsync:li,get util(){return ke},get objectUtil(){return zo},ZodParsedType:M,getParsedType:Pr,ZodType:le,ZodString:zn,ZodNumber:_s,ZodBigInt:bs,ZodBoolean:ks,ZodDate:xs,ZodSymbol:di,ZodUndefined:Os,ZodNull:Ts,ZodAny:Pn,ZodUnknown:on,ZodNever:Nr,ZodVoid:hi,ZodArray:hn,ZodObject:It,ZodUnion:Ss,ZodDiscriminatedUnion:bd,ZodIntersection:Es,ZodTuple:Kr,ZodRecord:Od,ZodMap:fi,ZodSet:pi,ZodFunction:Td,ZodLazy:Ns,ZodLiteral:As,ZodEnum:ra,ZodNativeEnum:Cs,ZodPromise:$n,ZodEffects:Kt,ZodTransformer:Kt,ZodOptional:Or,ZodNullable:fn,ZodDefault:Is,ZodCatch:mi,ZodNaN:yi,BRAND:Ey,ZodBranded:Ed,ZodPipeline:jc,ZodReadonly:gi,custom:Ad,Schema:le,ZodSchema:le,late:Ny,get ZodFirstPartyTypeKind(){return G},coerce:ug,any:Py,array:My,bigint:Iy,boolean:jd,date:jy,discriminatedUnion:Fy,effect:Ru,enum:Qy,function:Gy,instanceof:Ay,intersection:Ky,lazy:Jy,literal:Xy,map:Yy,nan:Cy,nativeEnum:eg,never:Dy,null:zy,nullable:ng,number:Id,object:Ly,oboolean:cg,onumber:og,optional:rg,ostring:ig,pipeline:ag,preprocess:sg,promise:tg,record:qy,set:Hy,strictObject:By,string:Cd,symbol:Zy,transformer:Ru,tuple:Wy,undefined:Ry,union:Vy,unknown:$y,void:Uy,NEVER:lg,ZodIssueCode:A,quotelessJson:fy,ZodError:Bt});const Zc=T.tuple([T.number(),T.number()]),Zd=T.object({width:T.number(),height:T.number()}),dg=T.object({signedWidth:T.number(),signedHeight:T.number()}),hg=["width","height"];T.enum(hg);const fg=["start","center","end"],pg=["signedWidth","signedHeight"];T.enum(pg);const vi=T.object({x:T.number(),y:T.number()}),mg=T.object({clientX:T.number(),clientY:T.number()}),yg=["x","y"],Rd=T.enum(yg),zd=["top","right","bottom","left"];T.enum(zd);const gg=["left","right"],vg=T.enum(gg),wg=["top","bottom"],_g=T.enum(wg),Pd=["center"];T.enum(Pd);const bg=[...zd,...Pd],wi=T.enum(bg);T.enum(fg);const kg=["first","last"];T.enum(kg);const xg=T.object({lower:T.number(),upper:T.number()});T.union([xg,Zc]);T.union([Rd,wi]);T.union([Rd,wi,T.instanceof(String)]);const mo=(r,e)=>{const t={lower:0,upper:0};return typeof r=="number"?e!=null?(t.lower=r,t.upper=e):(t.lower=0,t.upper=r):Array.isArray(r)?[t.lower,t.upper]=r:(t.lower=r.lower,t.upper=r.upper),Og(t)},Og=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r;var jt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ye={},Bi={};Object.defineProperty(Bi,"__esModule",{value:!0});function Tg(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"$"+n}).toLowerCase().replace(/(\$)(\w)/g,function(e,t,n){return n.toUpperCase()}):""}Bi.default=Tg;var Vi={};Object.defineProperty(Vi,"__esModule",{value:!0});function Sg(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"_").toLowerCase():""}Vi.default=Sg;var Fi={};Object.defineProperty(Fi,"__esModule",{value:!0});function Eg(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"$").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"$"+n}).toLowerCase().replace(/(\$)(\w?)/g,function(e,t,n){return n.toUpperCase()}):""}Fi.default=Eg;var Rc={};Object.defineProperty(Rc,"__esModule",{value:!0});function Ng(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,".").toLowerCase():""}Rc.default=Ng;var zc={};Object.defineProperty(zc,"__esModule",{value:!0});function Ag(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"/").toLowerCase():""}zc.default=Ag;var Pc={};Object.defineProperty(Pc,"__esModule",{value:!0});function Cg(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase():""}Pc.default=Cg;var $c={};Object.defineProperty($c,"__esModule",{value:!0});function Ig(r){if(r===void 0&&(r=""),!r)return"";var e=String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(t,n,s){return n+"_"+s.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}$c.default=Ig;var Dc={};Object.defineProperty(Dc,"__esModule",{value:!0});function jg(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase().replace(/( ?)(\w+)( ?)/g,function(e,t,n,s){return t+n.charAt(0).toUpperCase()+n.slice(1)+s}):""}Dc.default=jg;var Ki={};Object.defineProperty(Ki,"__esModule",{value:!0});function Zg(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"-").toLowerCase():""}Ki.default=Zg;var Uc={},wn={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.belongToTypes=r.isValidObject=r.isArrayObject=r.validateOptions=r.DefaultOption=void 0,r.DefaultOption={recursive:!1,recursiveInArray:!1,keepTypesOnRecursion:[]},r.validateOptions=function(e){return e===void 0&&(e=r.DefaultOption),e.recursive==null?e=r.DefaultOption:e.recursiveInArray==null&&(e.recursiveInArray=!1),e},r.isArrayObject=function(e){return e!=null&&Array.isArray(e)},r.isValidObject=function(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)},r.belongToTypes=function(e,t){return(t||[]).some(function(n){return e instanceof n})}})(wn);var Rg=jt&&jt.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Uc,"__esModule",{value:!0});var dr=wn;function za(r,e){if(e===void 0&&(e=dr.DefaultOption),!dr.isValidObject(r))return null;e=dr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toLowerCase();e.recursive&&(dr.isValidObject(s)?dr.belongToTypes(s,e.keepTypesOnRecursion)||(s=za(s,e)):e.recursiveInArray&&dr.isArrayObject(s)&&(s=Rg(s).map(function(i){var o=i;if(dr.isValidObject(i))dr.belongToTypes(o,e.keepTypesOnRecursion)||(o=za(i,e));else if(dr.isArrayObject(i)){var c=za({key:i},e);o=c.key}return o}))),t[a]=s}),t}Uc.default=za;var Mc={},zg=jt&&jt.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Mc,"__esModule",{value:!0});var hr=wn;function Pa(r,e){if(e===void 0&&(e=hr.DefaultOption),!hr.isValidObject(r))return null;e=hr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toUpperCase();e.recursive&&(hr.isValidObject(s)?hr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Pa(s,e)):e.recursiveInArray&&hr.isArrayObject(s)&&(s=zg(s).map(function(i){var o=i;if(hr.isValidObject(i))hr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Pa(i,e));else if(hr.isArrayObject(i)){var c=Pa({key:i},e);o=c.key}return o}))),t[a]=s}),t}Mc.default=Pa;var Lc={},Pg=jt&&jt.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Lc,"__esModule",{value:!0});var fr=wn,$g=Bi;function $a(r,e){if(e===void 0&&(e=fr.DefaultOption),!fr.isValidObject(r))return null;e=fr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=$g.default(n);e.recursive&&(fr.isValidObject(s)?fr.belongToTypes(s,e.keepTypesOnRecursion)||(s=$a(s,e)):e.recursiveInArray&&fr.isArrayObject(s)&&(s=Pg(s).map(function(i){var o=i;if(fr.isValidObject(i))fr.belongToTypes(o,e.keepTypesOnRecursion)||(o=$a(i,e));else if(fr.isArrayObject(i)){var c=$a({key:i},e);o=c.key}return o}))),t[a]=s}),t}Lc.default=$a;var Bc={},Dg=jt&&jt.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Bc,"__esModule",{value:!0});var pr=wn,Ug=Vi;function Da(r,e){if(e===void 0&&(e=pr.DefaultOption),!pr.isValidObject(r))return null;e=pr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Ug.default(n);e.recursive&&(pr.isValidObject(s)?pr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Da(s,e)):e.recursiveInArray&&pr.isArrayObject(s)&&(s=Dg(s).map(function(i){var o=i;if(pr.isValidObject(i))pr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Da(i,e));else if(pr.isArrayObject(i)){var c=Da({key:i},e);o=c.key}return o}))),t[a]=s}),t}Bc.default=Da;var Vc={},Mg=jt&&jt.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Vc,"__esModule",{value:!0});var mr=wn,Lg=Fi;function Ua(r,e){if(e===void 0&&(e=mr.DefaultOption),!mr.isValidObject(r))return null;e=mr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Lg.default(n);e.recursive&&(mr.isValidObject(s)?mr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ua(s,e)):e.recursiveInArray&&mr.isArrayObject(s)&&(s=Mg(s).map(function(i){var o=i;if(mr.isValidObject(i))mr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ua(i,e));else if(mr.isArrayObject(i)){var c=Ua({key:i},e);o=c.key}return o}))),t[a]=s}),t}Vc.default=Ua;var Fc={},Bg=jt&&jt.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Fc,"__esModule",{value:!0});var yr=wn,Vg=Ki;function Ma(r,e){if(e===void 0&&(e=yr.DefaultOption),!yr.isValidObject(r))return null;e=yr.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Vg.default(n);e.recursive&&(yr.isValidObject(s)?yr.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ma(s,e)):e.recursiveInArray&&yr.isArrayObject(s)&&(s=Bg(s).map(function(i){var o=i;if(yr.isValidObject(i))yr.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ma(i,e));else if(yr.isArrayObject(i)){var c=Ma({key:i},e);o=c.key}return o}))),t[a]=s}),t}Fc.default=Ma;Object.defineProperty(ye,"__esModule",{value:!0});ye.kebabKeys=ye.pascalKeys=ye.snakeKeys=ye.camelKeys=ye.upperKeys=ye.lowerKeys=ye.toLowerCase=ye.toUpperCase=ye.toKebabCase=ye.toHeaderCase=ye.toSentenceCase=ye.toTextCase=ye.toPathCase=ye.toDotCase=ye.toPascalCase=ye.toSnakeCase=ye.toCamelCase=void 0;var $d=Bi;ye.toCamelCase=$d.default;var Dd=Vi;ye.toSnakeCase=Dd.default;var Ud=Fi;ye.toPascalCase=Ud.default;var Md=Rc;ye.toDotCase=Md.default;var Ld=zc;ye.toPathCase=Ld.default;var Bd=Pc;ye.toTextCase=Bd.default;var Vd=$c;ye.toSentenceCase=Vd.default;var Fd=Dc;ye.toHeaderCase=Fd.default;var Kd=Ki;ye.toKebabCase=Kd.default;var Wd=Uc;ye.lowerKeys=Wd.default;var qd=Mc;ye.upperKeys=qd.default;var Yd=Lc;ye.camelKeys=Yd.default;var Hd=Bc;ye.snakeKeys=Hd.default;var Gd=Vc;ye.pascalKeys=Gd.default;var Jd=Fc;ye.kebabKeys=Jd.default;var Xd=function(r){return String(r||"").toLowerCase()};ye.toLowerCase=Xd;var Qd=function(r){return String(r||"").toUpperCase()};ye.toUpperCase=Qd;var Fg={toCamelCase:$d.default,toSnakeCase:Dd.default,toPascalCase:Ud.default,toDotCase:Md.default,toPathCase:Ld.default,toTextCase:Bd.default,toSentenceCase:Vd.default,toHeaderCase:Fd.default,toKebabCase:Kd.default,toUpperCase:Qd,toLowerCase:Xd,lowerKeys:Wd.default,upperKeys:qd.default,camelKeys:Yd.default,snakeKeys:Hd.default,pascalKeys:Gd.default,kebabKeys:Jd.default};ye.default=Fg;var eh=ye;const th={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},Kg=r=>eh.snakeKeys(r,th),Wg=r=>eh.camelKeys(r,th);var Dn;(r=>{r.toSnake=Kg,r.toCamel=Wg,r.capitalize=e=>e[0].toUpperCase()+e.slice(1)})(Dn||(Dn={}));T.object({x:wi,y:wi});const qg=T.object({x:vg,y:_g}),Yg={x:"left",y:"top"},Hg=(r,e)=>r.x===e.x&&r.y===e.y,zu=T.union([T.number(),vi,Zc,Zd,dg,mg]),Gg=(r,e)=>typeof r=="number"?{x:r,y:e??r}:Array.isArray(r)?{x:r[0],y:r[1]}:"signedWidth"in r?{x:r.signedWidth,y:r.signedHeight}:"clientX"in r?{x:r.clientX,y:r.clientY}:"width"in r?{x:r.width,y:r.height}:{...r},Pu={x:0,y:0},ma=T.union([T.number(),T.string()]);T.object({top:ma,left:ma,width:ma,height:ma});T.object({left:T.number(),top:T.number(),right:T.number(),bottom:T.number()});T.object({one:vi,two:vi,root:qg});const Kc=(r,e,t=0,n=0,s)=>{const a={one:{...Pu},two:{...Pu},root:s??Yg};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return a.one={x:r,y:e},a.two={x:a.one.x+t,y:a.one.y+n},a}return"one"in r&&"two"in r&&"root"in r?{...r,root:s??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(a.one={x:r.left,y:r.top},a.two={x:r.right,y:r.bottom},a):(a.one=r,e==null?a.two={x:a.one.x+t,y:a.one.y+n}:typeof e=="number"?a.two={x:a.one.x+e,y:a.one.y+t}:"width"in e?a.two={x:a.one.x+e.width,y:a.one.y+e.height}:"signedWidth"in e?a.two={x:a.one.x+e.signedWidth,y:a.one.y+e.signedHeight}:a.two=e,a))},yo=r=>{const e=Kc(r);return{lower:e.one.x,upper:e.two.x}},go=r=>{const e=Kc(r);return{lower:e.one.y,upper:e.two.y}},Jg=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Xg=T.object({signedWidth:T.number(),signedHeight:T.number()});T.union([Zd,Xg,vi,Zc]);const Qg=(r,e,t)=>(e!=null&&(r=Math.max(r,e)),t!=null&&(r=Math.min(r,t)),r);T.object({offset:zu,scale:zu});const ev=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],tv=r=>(e,t,n,s)=>[e,s?n/r:n*r],rv=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:i,upper:o}=r,c=a-s,d=o-i;if(t==="dimension")return[r,n*(d/c)];const w=(n-s)*(d/c)+i;return[r,w]},nv=r=>(e,t,n)=>[r,n],sv=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:s}=r;return[r,s-(t-n)]},av=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=Qg(n,s,a),[e,n]},Fo=class rs{constructor(){Z(this,"ops",[]),Z(this,"currBounds",null),Z(this,"currType",null),Z(this,"reversed",!1),this.ops=[]}static translate(e){return new rs().translate(e)}static magnify(e){return new rs().magnify(e)}static scale(e,t){return new rs().scale(e,t)}translate(e){const t=this.new(),n=ev(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=tv(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=mo(e,t),s=this.new(),a=rv(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=mo(e,t),s=this.new(),a=av(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=mo(e,t),s=this.new(),a=nv(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=sv();e.type="invert";const t=this.new();return t.ops.push(e),t}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new rs;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,s],a)=>a(n,e,s,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,s)=>{if(n.type==="scale"||t.some(([i,o])=>s>=i&&s<=o))return;const a=e.ops.findIndex((i,o)=>i.type==="scale"&&o>s);a!==-1&&t.push([s,a])}),t.forEach(([n,s])=>{const a=e.ops.slice(n,s);a.unshift(e.ops[s]),e.ops.splice(n,s-n+1,...a)}),e.reversed=!e.reversed,e}};Z(Fo,"IDENTITY",new Fo);let $u=Fo;const Du=class vr{constructor(e=new $u,t=new $u,n=null){Z(this,"x"),Z(this,"y"),Z(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new vr().translate(e,t)}static translateX(e){return new vr().translateX(e)}static translateY(e){return new vr().translateY(e)}static clamp(e){return new vr().clamp(e)}static magnify(e){return new vr().magnify(e)}static scale(e){return new vr().scale(e)}static reBound(e){return new vr().reBound(e)}translate(e,t){const n=Gg(e,t),s=this.copy();return s.x=this.x.translate(n.x),s.y=this.y.translate(n.y),s}translateX(e){const t=this.copy();return t.x=this.x.translate(e),t}translateY(e){const t=this.copy();return t.y=this.y.translate(e),t}magnify(e){const t=this.copy();return t.x=this.x.magnify(e.x),t.y=this.y.magnify(e.y),t}scale(e){const t=this.copy();if(Jg(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Hg(n,e.root)&&(n.x!==e.root.x&&(t.x=t.x.invert()),n.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(yo(e)),t.y=t.y.scale(go(e)),t}return t.x=t.x.scale(e.width),t.y=t.y.scale(e.height),t}reBound(e){const t=this.copy();return t.x=this.x.reBound(yo(e)),t.y=this.y.reBound(go(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(yo(e)),t.y=this.y.clamp(go(e)),t}copy(){const e=new vr;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}box(e){return Kc(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};Z(Du,"IDENTITY",new Du);const rh=(r,e)=>{const t=new kt(e);if(![dt.DAY,dt.HOUR,dt.MINUTE,dt.SECOND,dt.MILLISECOND,dt.MICROSECOND,dt.NANOSECOND].some(s=>s.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof kt?new kt(n):new dt(n)},Re=class pe extends Number{constructor(e,t="UTC"){if(e==null)return pe.now();if(e instanceof Date)super(e.getTime()*pe.MILLISECOND.valueOf());else if(typeof e=="string")super(pe.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(pe.parseDate(e));else{let n=0;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=pe.utcOffset.valueOf()),super(e.valueOf()+n)}}static parseDate([e=1970,t=1,n=1]){const s=new Date(e,t-1,n,0,0,0,0);return new pe(s.getTime()*pe.MILLISECOND.valueOf()).truncate(pe.DAY).valueOf()}static parseTimeString(e,t="UTC"){const[n,s,a]=e.split(":");let i="00",o="00";a!=null&&([i,o]=a.split("."));let c=pe.hours(parseInt(n??"00",10)).add(pe.minutes(parseInt(s??"00",10))).add(pe.seconds(parseInt(i??"00",10))).add(pe.milliseconds(parseInt(o??"00",10)));return t==="local"&&(c=c.add(pe.utcOffset)),c.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return pe.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new pe(n.getTime()*pe.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString(t);case"preciseDate":return`${this.dateString(t)} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString(t)} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(pe.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(e="UTC"){const t=this.date(),n=t.toLocaleString("default",{month:"short"}),s=t.toLocaleString("default",{day:"numeric"});return`${n} ${s}`}static get utcOffset(){return new dt(new Date().getTimezoneOffset()*pe.MINUTE.valueOf())}static since(e){return new pe().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new pe(e).valueOf()}span(e){return this.range(e).span}range(e){return new iv(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0}after(e){return this.valueOf()>new pe(e).valueOf()}afterEq(e){return this.valueOf()>=new pe(e).valueOf()}before(e){return this.valueOf()<new pe(e).valueOf()}beforeEq(e){return this.valueOf()<=new pe(e).valueOf()}add(e){return new pe(this.valueOf()+e.valueOf())}sub(e){return new pe(this.valueOf()-e.valueOf())}milliseconds(){return this.valueOf()/pe.MILLISECOND.valueOf()}toString(){return this.date().toISOString()}remainder(e){return rh(this,e)}get isToday(){return this.truncate(dt.DAY).equals(pe.now().truncate(dt.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new pe(new Date)}static nanoseconds(e){return new pe(e)}static microseconds(e){return pe.nanoseconds(e*1e3)}static milliseconds(e){return pe.microseconds(e*1e3)}static seconds(e){return pe.milliseconds(e*1e3)}static minutes(e){return pe.seconds(e*60)}static hours(e){return pe.minutes(e*60)}static days(e){return pe.hours(e*24)}};Z(Re,"NANOSECOND",Re.nanoseconds(1));Z(Re,"MICROSECOND",Re.microseconds(1));Z(Re,"MILLISECOND",Re.milliseconds(1));Z(Re,"SECOND",Re.seconds(1));Z(Re,"MINUTE",Re.minutes(1));Z(Re,"HOUR",Re.hours(1));Z(Re,"DAY",Re.days(1));Z(Re,"MAX",new Re(9122272036554776e3));Z(Re,"MIN",new Re(0));Z(Re,"ZERO",new Re(0));Z(Re,"z",T.union([T.instanceof(Number).transform(r=>new Re(r)),T.number().transform(r=>new Re(r)),T.instanceof(Re)]));let kt=Re;const Ie=class Ee extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}remainder(e){return rh(this,e)}truncate(e){return new Ee(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}toString(){const e=this.truncate(Ee.DAY),t=this.truncate(Ee.HOUR),n=this.truncate(Ee.MINUTE),s=this.truncate(Ee.SECOND),a=this.truncate(Ee.MILLISECOND),i=this.truncate(Ee.MICROSECOND),o=this.truncate(Ee.NANOSECOND),c=e,d=t.sub(e),w=n.sub(t),D=s.sub(n),X=a.sub(s),ee=i.sub(a),Be=o.sub(i);let te="";return c.isZero||(te+=`${c.days}d `),d.isZero||(te+=`${d.hours}h `),w.isZero||(te+=`${w.minutes}m `),D.isZero||(te+=`${D.seconds}s `),X.isZero||(te+=`${X.milliseconds}ms `),ee.isZero||(te+=`${ee.microseconds}µs `),Be.isZero||(te+=`${Be.nanoseconds}ns`),te.trim()}get days(){return this.valueOf()/Ee.DAY.valueOf()}get hours(){return this.valueOf()/Ee.HOUR.valueOf()}get minutes(){return this.valueOf()/Ee.MINUTE.valueOf()}get seconds(){return this.valueOf()/Ee.SECOND.valueOf()}get milliseconds(){return this.valueOf()/Ee.MILLISECOND.valueOf()}get microseconds(){return this.valueOf()/Ee.MICROSECOND.valueOf()}get nanoseconds(){return this.valueOf()}get isZero(){return this.valueOf()===0}equals(e){return this.valueOf()===new Ee(e).valueOf()}add(e){return new Ee(this.valueOf()+new Ee(e).valueOf())}sub(e){return new Ee(this.valueOf()-new Ee(e).valueOf())}static nanoseconds(e=1){return new Ee(e)}static microseconds(e=1){return Ee.nanoseconds(e*1e3)}static milliseconds(e=1){return Ee.microseconds(e*1e3)}static seconds(e=1){return Ee.milliseconds(e*1e3)}static minutes(e){return Ee.seconds(e.valueOf()*60)}static hours(e){return Ee.minutes(e*60)}static days(e){return Ee.hours(e*24)}};Z(Ie,"NANOSECOND",Ie.nanoseconds(1));Z(Ie,"MICROSECOND",Ie.microseconds(1));Z(Ie,"MILLISECOND",Ie.milliseconds(1));Z(Ie,"SECOND",Ie.seconds(1));Z(Ie,"MINUTE",Ie.minutes(1));Z(Ie,"HOUR",Ie.hours(1));Z(Ie,"DAY",Ie.days(1));Z(Ie,"MAX",new Ie(Ie.MAX_SAFE_INTEGER));Z(Ie,"MIN",new Ie(-Ie.MAX_SAFE_INTEGER));Z(Ie,"ZERO",new Ie(0));Z(Ie,"z",T.union([T.instanceof(Number).transform(r=>new Ie(r)),T.number().transform(r=>new Ie(r)),T.instanceof(Ie)]));let dt=Ie;const ya=class La extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new La(e).valueOf()}get period(){return dt.seconds(1/this.valueOf())}sampleCount(e){return new dt(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new lt(t).valueOf()}span(e){return dt.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new La(e)}static khz(e){return La.hz(e*1e3)}};Z(ya,"z",T.union([T.number().transform(r=>new ya(r)),T.instanceof(Number).transform(r=>new ya(r)),T.instanceof(ya)]));const rt=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new ov(e*this.valueOf())}};Z(rt,"UNKNOWN",new rt(0));Z(rt,"BIT128",new rt(16));Z(rt,"BIT64",new rt(8));Z(rt,"BIT32",new rt(4));Z(rt,"BIT16",new rt(2));Z(rt,"BIT8",new rt(1));Z(rt,"z",T.union([T.number().transform(r=>new rt(r)),T.instanceof(Number).transform(r=>new rt(r)),T.instanceof(rt)]));let lt=rt;const Jt=class Ko{constructor(e,t){Z(this,"start"),Z(this,"end"),this.start=new kt(e),this.end=new kt(t)}get span(){return new dt(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}swap(){return new Ko(this.end,this.start)}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e){e=e.makeValid();const t=this.makeValid();return e.start.equals(t.start)?!0:e.end.equals(this.start)||e.start.equals(this.end)?!1:this.contains(e.end)||this.contains(e.start)||e.contains(this.start)||e.contains(this.end)}contains(e){return e instanceof Ko?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}};Z(Jt,"MAX",new Jt(kt.MIN,kt.MAX));Z(Jt,"MIN",new Jt(kt.MAX,kt.MIN));Z(Jt,"ZERO",new Jt(kt.ZERO,kt.ZERO));Z(Jt,"z",T.union([T.object({start:kt.z,end:kt.z}).transform(r=>new Jt(r.start,r.end)),T.instanceof(Jt)]));let iv=Jt;const R=class rn extends String{constructor(e){if(e instanceof rn||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const t=rn.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}}throw super(rn.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=rn.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}toString(){return this.valueOf()}get density(){const e=rn.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}checkArray(e){return e.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return rn.BIG_INT_TYPES.some(e=>e.equals(this))}};Z(R,"UNKNOWN",new R("unknown"));Z(R,"FLOAT64",new R("float64"));Z(R,"FLOAT32",new R("float32"));Z(R,"INT64",new R("int64"));Z(R,"INT32",new R("int32"));Z(R,"INT16",new R("int16"));Z(R,"INT8",new R("int8"));Z(R,"UINT64",new R("uint64"));Z(R,"UINT32",new R("uint32"));Z(R,"UINT16",new R("uint16"));Z(R,"UINT8",new R("uint8"));Z(R,"TIMESTAMP",new R("timestamp"));Z(R,"UUID",new R("uuid"));Z(R,"STRING",new R("string"));Z(R,"JSON",new R("json"));Z(R,"ARRAY_CONSTRUCTORS",new Map([[R.UINT8.toString(),Uint8Array],[R.UINT16.toString(),Uint16Array],[R.UINT32.toString(),Uint32Array],[R.UINT64.toString(),BigUint64Array],[R.FLOAT32.toString(),Float32Array],[R.FLOAT64.toString(),Float64Array],[R.INT8.toString(),Int8Array],[R.INT16.toString(),Int16Array],[R.INT32.toString(),Int32Array],[R.INT64.toString(),BigInt64Array],[R.TIMESTAMP.toString(),BigInt64Array],[R.STRING.toString(),Uint8Array],[R.JSON.toString(),Uint8Array],[R.UUID.toString(),Uint8Array]]));Z(R,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,R.UINT8],[Uint16Array.name,R.UINT16],[Uint32Array.name,R.UINT32],[BigUint64Array.name,R.UINT64],[Float32Array.name,R.FLOAT32],[Float64Array.name,R.FLOAT64],[Int8Array.name,R.INT8],[Int16Array.name,R.INT16],[Int32Array.name,R.INT32],[BigInt64Array.name,R.INT64]]));Z(R,"DENSITIES",new Map([[R.UINT8.toString(),lt.BIT8],[R.UINT16.toString(),lt.BIT16],[R.UINT32.toString(),lt.BIT32],[R.UINT64.toString(),lt.BIT64],[R.FLOAT32.toString(),lt.BIT32],[R.FLOAT64.toString(),lt.BIT64],[R.INT8.toString(),lt.BIT8],[R.INT16.toString(),lt.BIT16],[R.INT32.toString(),lt.BIT32],[R.INT64.toString(),lt.BIT64],[R.TIMESTAMP.toString(),lt.BIT64],[R.STRING.toString(),lt.UNKNOWN],[R.JSON.toString(),lt.UNKNOWN],[R.UUID.toString(),lt.BIT128]]));Z(R,"BIG_INT_TYPES",[R.INT64,R.UINT64,R.TIMESTAMP]);Z(R,"z",T.union([T.string().transform(r=>new R(r)),T.instanceof(R)]));const st=class jr extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return jr.bytes(this.valueOf()+e.valueOf())}sub(e){return jr.bytes(this.valueOf()-e.valueOf())}static bytes(e=1){return new jr(e)}static kilobytes(e=1){return jr.bytes(e.valueOf()*1e3)}static megabytes(e=1){return jr.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return jr.megabytes(e.valueOf()*1e3)}static terabytes(e){return jr.gigabytes(e.valueOf()*1e3)}isZero(){return this.valueOf()===0}};Z(st,"BYTE",new st(1));Z(st,"KILOBYTE",st.kilobytes(1));Z(st,"MEGABYTE",st.megabytes(1));Z(st,"GIGABYTE",st.gigabytes(1));Z(st,"TERABYTE",st.terabytes(1));Z(st,"ZERO",new st(0));Z(st,"z",T.union([T.number().transform(r=>new st(r)),T.instanceof(st)]));let ov=st;T.union([T.instanceof(Uint8Array),T.instanceof(Uint16Array),T.instanceof(Uint32Array),T.instanceof(BigUint64Array),T.instanceof(Float32Array),T.instanceof(Float64Array),T.instanceof(Int8Array),T.instanceof(Int16Array),T.instanceof(Int32Array),T.instanceof(BigInt64Array)]);T.record(T.union([T.number(),T.string(),T.symbol()]),T.unknown());const nh=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",cv=nh(),sh=["MacOS","Windows","Linux","Docker"],uv=T.enum(sh);let vo;const lv=()=>{if(typeof window>"u")return;const r=window.navigator.userAgent.toLowerCase();if(r.includes("mac"))return"MacOS";if(r.includes("win"))return"Windows";if(r.includes("linux"))return"Linux"},dv=(r={})=>{const{force:e,default:t}=r;return e??vo??(vo=lv(),vo??t)},ah=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:sh,RUNTIME:cv,detect:nh,getOS:dv,osZ:uv},Symbol.toStringTag,{value:"Module"})),hv=(...r)=>r.map(ih).join(""),ih=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),fv=r=>r.endsWith("/")?r.slice(0,-1):r,pv=(r,e="")=>r===null?"":"?"+Object.entries(r).filter(([,t])=>t==null?!1:Array.isArray(t)?t.length>0:!0).map(([t,n])=>`${e}${t}=${n}`).join("&");let mv=(Tn=class{constructor({host:r,port:e,protocol:t="",pathPrefix:n=""}){Z(this,"protocol"),Z(this,"host"),Z(this,"port"),Z(this,"path"),this.protocol=t,this.host=r,this.port=e,this.path=ih(n)}replace(r){return new Tn({host:r.host??this.host,port:r.port??this.port,protocol:r.protocol??this.protocol,pathPrefix:r.pathPrefix??this.path})}child(r){return new Tn({...this,pathPrefix:hv(this.path,r)})}toString(){return fv(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}},Z(Tn,"UNKNOWN",new Tn({host:"unknown",port:0})),Tn);var Wo;try{Wo=new TextDecoder}catch{}var P,Nt,f=0,Pe={},_e,Ur,St=0,Ht=0,Je,Tr,mt=[],ve,Uu={useRecords:!1,mapsAsObjects:!0};class oh{}const ch=new oh;ch.name="MessagePack 0xC1";var Lr=!1,uh=2,Mu;try{new Function("")}catch{uh=1/0}class js{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=!1&&(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(P)return ph(()=>(Yo(),this?this.unpack(e,t):js.prototype.unpack.call(Uu,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(Nt=t.end||e.length,f=t.start||0):(f=0,Nt=t>-1?t:e.length),Ht=0,Ur=null,Je=null,P=e;try{ve=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw P=null,e instanceof Uint8Array?n:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof js){if(Pe=this,this.structures)return _e=this.structures,ga(t);(!_e||_e.length>0)&&(_e=[])}else Pe=Uu,(!_e||_e.length>0)&&(_e=[]);return ga(t)}unpackMultiple(e,t){let n,s=0;try{Lr=!0;let a=e.length,i=this?this.unpack(e,a):Wi.unpack(e,a);if(t){if(t(i,s,f)===!1)return;for(;f<a;)if(s=f,t(ga(),s,f)===!1)return}else{for(n=[i];f<a;)s=f,n.push(ga());return n}}catch(a){throw a.lastPosition=s,a.values=n,a}finally{Lr=!1,Yo()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(n=>n.slice(0)));for(let n=0,s=e.length;n<s;n++){let a=e[n];a&&(a.isShared=!0,n>=32&&(a.highByte=n-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let s=e[n],a=t[n];a&&(s&&((e.restoreStructures||(e.restoreStructures=[]))[n]=s),e[n]=a)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function ga(r){try{if(!Pe.trusted&&!Lr){let t=_e.sharedLength||0;t<_e.length&&(_e.length=t)}let e;if(Pe.randomAccessStructure&&P[f]<64&&P[f]>=32&&Mu?(e=Mu(P,f,Nt,Pe),P=null,!(r&&r.lazy)&&e&&(e=e.toJSON()),f=Nt):e=Fe(),Je&&(f=Je.postBundlePosition,Je=null),Lr&&(_e.restoreStructures=null),f==Nt)_e&&_e.restoreStructures&&Lu(),_e=null,P=null,Tr&&(Tr=null);else{if(f>Nt)throw new Error("Unexpected end of MessagePack data");if(!Lr){let t;try{t=JSON.stringify(e,(n,s)=>typeof s=="bigint"?`${s}n`:s).slice(0,100)}catch(n){t="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+t)}}return e}catch(e){throw _e&&_e.restoreStructures&&Lu(),Yo(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||f>Nt)&&(e.incomplete=!0),e}}function Lu(){for(let r in _e.restoreStructures)_e[r]=_e.restoreStructures[r];_e.restoreStructures=null}function Fe(){let r=P[f++];if(r<160)if(r<128){if(r<64)return r;{let e=_e[r&63]||Pe.getStructures&&lh()[r&63];return e?(e.read||(e.read=Wc(e,r&63)),e.read()):r}}else if(r<144)if(r-=128,Pe.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=hh();n==="__proto__"&&(n="__proto_"),e[n]=Fe()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Fe(),Fe());return e}else{r-=144;let e=new Array(r);for(let t=0;t<r;t++)e[t]=Fe();return Pe.freezeData?Object.freeze(e):e}else if(r<192){let e=r-160;if(Ht>=f)return Ur.slice(f-St,(f+=e)-St);if(Ht==0&&Nt<140){let t=e<16?qc(e):dh(e);if(t!=null)return t}return qo(e)}else{let e;switch(r){case 192:return null;case 193:return Je?(e=Fe(),e>0?Je[1].slice(Je.position1,Je.position1+=e):Je[0].slice(Je.position0,Je.position0-=e)):ch;case 194:return!1;case 195:return!0;case 196:if(e=P[f++],e===void 0)throw new Error("Unexpected end of buffer");return wo(e);case 197:return e=ve.getUint16(f),f+=2,wo(e);case 198:return e=ve.getUint32(f),f+=4,wo(e);case 199:return en(P[f++]);case 200:return e=ve.getUint16(f),f+=2,en(e);case 201:return e=ve.getUint32(f),f+=4,en(e);case 202:if(e=ve.getFloat32(f),Pe.useFloat32>2){let t=Yc[(P[f]&127)<<1|P[f+1]>>7];return f+=4,(t*e+(e>0?.5:-.5)>>0)/t}return f+=4,e;case 203:return e=ve.getFloat64(f),f+=8,e;case 204:return P[f++];case 205:return e=ve.getUint16(f),f+=2,e;case 206:return e=ve.getUint32(f),f+=4,e;case 207:return Pe.int64AsType==="number"?(e=ve.getUint32(f)*4294967296,e+=ve.getUint32(f+4)):Pe.int64AsType==="string"?e=ve.getBigUint64(f).toString():Pe.int64AsType==="auto"?(e=ve.getBigUint64(f),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ve.getBigUint64(f),f+=8,e;case 208:return ve.getInt8(f++);case 209:return e=ve.getInt16(f),f+=2,e;case 210:return e=ve.getInt32(f),f+=4,e;case 211:return Pe.int64AsType==="number"?(e=ve.getInt32(f)*4294967296,e+=ve.getUint32(f+4)):Pe.int64AsType==="string"?e=ve.getBigInt64(f).toString():Pe.int64AsType==="auto"?(e=ve.getBigInt64(f),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=ve.getBigInt64(f),f+=8,e;case 212:if(e=P[f++],e==114)return qu(P[f++]&63);{let t=mt[e];if(t)return t.read?(f++,t.read(Fe())):t.noBuffer?(f++,t()):t(P.subarray(f,++f));throw new Error("Unknown extension "+e)}case 213:return e=P[f],e==114?(f++,qu(P[f++]&63,P[f++])):en(2);case 214:return en(4);case 215:return en(8);case 216:return en(16);case 217:return e=P[f++],Ht>=f?Ur.slice(f-St,(f+=e)-St):gv(e);case 218:return e=ve.getUint16(f),f+=2,Ht>=f?Ur.slice(f-St,(f+=e)-St):vv(e);case 219:return e=ve.getUint32(f),f+=4,Ht>=f?Ur.slice(f-St,(f+=e)-St):wv(e);case 220:return e=ve.getUint16(f),f+=2,Vu(e);case 221:return e=ve.getUint32(f),f+=4,Vu(e);case 222:return e=ve.getUint16(f),f+=2,Fu(e);case 223:return e=ve.getUint32(f),f+=4,Fu(e);default:if(r>=224)return r-256;if(r===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+r)}}}const yv=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Wc(r,e){function t(){if(t.count++>uh){let s=r.read=new Function("r","return function(){return "+(Pe.freezeData?"Object.freeze":"")+"({"+r.map(a=>a==="__proto__"?"__proto_:r()":yv.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(Fe);return r.highByte===0&&(r.read=Bu(e,r.read)),s()}let n={};for(let s=0,a=r.length;s<a;s++){let i=r[s];i==="__proto__"&&(i="__proto_"),n[i]=Fe()}return Pe.freezeData?Object.freeze(n):n}return t.count=0,r.highByte===0?Bu(e,t):t}const Bu=(r,e)=>function(){let t=P[f++];if(t===0)return e();let n=r<32?-(r+(t<<5)):r+(t<<5),s=_e[n]||lh()[n];if(!s)throw new Error("Record id is not defined for "+n);return s.read||(s.read=Wc(s,r)),s.read()};function lh(){let r=ph(()=>(P=null,Pe.getStructures()));return _e=Pe._mergeStructures(r,_e)}var qo=na,gv=na,vv=na,wv=na;function na(r){let e;if(r<16&&(e=qc(r)))return e;if(r>64&&Wo)return Wo.decode(P.subarray(f,f+=r));const t=f+r,n=[];for(e="";f<t;){const s=P[f++];if(!(s&128))n.push(s);else if((s&224)===192){const a=P[f++]&63;n.push((s&31)<<6|a)}else if((s&240)===224){const a=P[f++]&63,i=P[f++]&63;n.push((s&31)<<12|a<<6|i)}else if((s&248)===240){const a=P[f++]&63,i=P[f++]&63,o=P[f++]&63;let c=(s&7)<<18|a<<12|i<<6|o;c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|c&1023),n.push(c)}else n.push(s);n.length>=4096&&(e+=He.apply(String,n),n.length=0)}return n.length>0&&(e+=He.apply(String,n)),e}function Vu(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=Fe();return Pe.freezeData?Object.freeze(e):e}function Fu(r){if(Pe.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=hh();n==="__proto__"&&(n="__proto_"),e[n]=Fe()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(Fe(),Fe());return e}}var He=String.fromCharCode;function dh(r){let e=f,t=new Array(r);for(let n=0;n<r;n++){const s=P[f++];if((s&128)>0){f=e;return}t[n]=s}return He.apply(String,t)}function qc(r){if(r<4)if(r<2){if(r===0)return"";{let e=P[f++];if((e&128)>1){f-=1;return}return He(e)}}else{let e=P[f++],t=P[f++];if((e&128)>0||(t&128)>0){f-=2;return}if(r<3)return He(e,t);let n=P[f++];if((n&128)>0){f-=3;return}return He(e,t,n)}else{let e=P[f++],t=P[f++],n=P[f++],s=P[f++];if((e&128)>0||(t&128)>0||(n&128)>0||(s&128)>0){f-=4;return}if(r<6){if(r===4)return He(e,t,n,s);{let a=P[f++];if((a&128)>0){f-=5;return}return He(e,t,n,s,a)}}else if(r<8){let a=P[f++],i=P[f++];if((a&128)>0||(i&128)>0){f-=6;return}if(r<7)return He(e,t,n,s,a,i);let o=P[f++];if((o&128)>0){f-=7;return}return He(e,t,n,s,a,i,o)}else{let a=P[f++],i=P[f++],o=P[f++],c=P[f++];if((a&128)>0||(i&128)>0||(o&128)>0||(c&128)>0){f-=8;return}if(r<10){if(r===8)return He(e,t,n,s,a,i,o,c);{let d=P[f++];if((d&128)>0){f-=9;return}return He(e,t,n,s,a,i,o,c,d)}}else if(r<12){let d=P[f++],w=P[f++];if((d&128)>0||(w&128)>0){f-=10;return}if(r<11)return He(e,t,n,s,a,i,o,c,d,w);let D=P[f++];if((D&128)>0){f-=11;return}return He(e,t,n,s,a,i,o,c,d,w,D)}else{let d=P[f++],w=P[f++],D=P[f++],X=P[f++];if((d&128)>0||(w&128)>0||(D&128)>0||(X&128)>0){f-=12;return}if(r<14){if(r===12)return He(e,t,n,s,a,i,o,c,d,w,D,X);{let ee=P[f++];if((ee&128)>0){f-=13;return}return He(e,t,n,s,a,i,o,c,d,w,D,X,ee)}}else{let ee=P[f++],Be=P[f++];if((ee&128)>0||(Be&128)>0){f-=14;return}if(r<15)return He(e,t,n,s,a,i,o,c,d,w,D,X,ee,Be);let te=P[f++];if((te&128)>0){f-=15;return}return He(e,t,n,s,a,i,o,c,d,w,D,X,ee,Be,te)}}}}}function Ku(){let r=P[f++],e;if(r<192)e=r-160;else switch(r){case 217:e=P[f++];break;case 218:e=ve.getUint16(f),f+=2;break;case 219:e=ve.getUint32(f),f+=4;break;default:throw new Error("Expected string")}return na(e)}function wo(r){return Pe.copyBuffers?Uint8Array.prototype.slice.call(P,f,f+=r):P.subarray(f,f+=r)}function en(r){let e=P[f++];if(mt[e]){let t;return mt[e](P.subarray(f,t=f+=r),n=>{f=n;try{return Fe()}finally{f=t}})}else throw new Error("Unknown extension type "+e)}var Wu=new Array(4096);function hh(){let r=P[f++];if(r>=160&&r<192){if(r=r-160,Ht>=f)return Ur.slice(f-St,(f+=r)-St);if(!(Ht==0&&Nt<180))return qo(r)}else return f--,Fe().toString();let e=(r<<5^(r>1?ve.getUint16(f):r>0?P[f]:0))&4095,t=Wu[e],n=f,s=f+r-3,a,i=0;if(t&&t.bytes==r){for(;n<s;){if(a=ve.getUint32(n),a!=t[i++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(a=P[n++],a!=t[i++]){n=1879048192;break}if(n===s)return f=n,t.string;s-=3,n=f}for(t=[],Wu[e]=t,t.bytes=r;n<s;)a=ve.getUint32(n),t.push(a),n+=4;for(s+=3;n<s;)a=P[n++],t.push(a);let o=r<16?qc(r):dh(r);return o!=null?t.string=o:t.string=qo(r)}const qu=(r,e)=>{let t=Fe().map(a=>a.toString()),n=r;e!==void 0&&(r=r<32?-((e<<5)+r):(e<<5)+r,t.highByte=e);let s=_e[r];return s&&(s.isShared||Lr)&&((_e.restoreStructures||(_e.restoreStructures=[]))[r]=s),_e[r]=t,t.read=Wc(t,n),t.read()};mt[0]=()=>{};mt[0].noBuffer=!0;let _v={Error,TypeError,ReferenceError};mt[101]=()=>{let r=Fe();return(_v[r[0]]||Error)(r[1])};mt[105]=r=>{let e=ve.getUint32(f-4);Tr||(Tr=new Map);let t=P[f],n;t>=144&&t<160||t==220||t==221?n=[]:n={};let s={target:n};Tr.set(e,s);let a=Fe();return s.used?Object.assign(n,a):(s.target=a,a)};mt[112]=r=>{let e=ve.getUint32(f-4),t=Tr.get(e);return t.used=!0,t.target};mt[115]=()=>new Set(Fe());const fh=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(r=>r+"Array");let bv=typeof globalThis=="object"?globalThis:window;mt[116]=r=>{let e=r[0],t=fh[e];if(!t)throw new Error("Could not find typed array for code "+e);return new bv[t](Uint8Array.prototype.slice.call(r,1).buffer)};mt[120]=()=>{let r=Fe();return new RegExp(r[0],r[1])};const kv=[];mt[98]=r=>{let e=(r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3],t=f;return f+=e-r.length,Je=kv,Je=[Ku(),Ku()],Je.position0=0,Je.position1=0,Je.postBundlePosition=f,f=t,Fe()};mt[255]=r=>r.length==4?new Date((r[0]*16777216+(r[1]<<16)+(r[2]<<8)+r[3])*1e3):r.length==8?new Date(((r[0]<<22)+(r[1]<<14)+(r[2]<<6)+(r[3]>>2))/1e6+((r[3]&3)*4294967296+r[4]*16777216+(r[5]<<16)+(r[6]<<8)+r[7])*1e3):r.length==12?new Date(((r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3])/1e6+((r[4]&128?-281474976710656:0)+r[6]*1099511627776+r[7]*4294967296+r[8]*16777216+(r[9]<<16)+(r[10]<<8)+r[11])*1e3):new Date("invalid");function ph(r){let e=Nt,t=f,n=St,s=Ht,a=Ur,i=Tr,o=Je,c=new Uint8Array(P.slice(0,Nt)),d=_e,w=_e.slice(0,_e.length),D=Pe,X=Lr,ee=r();return Nt=e,f=t,St=n,Ht=s,Ur=a,Tr=i,Je=o,P=c,Lr=X,_e=d,_e.splice(0,_e.length,...w),Pe=D,ve=new DataView(P.buffer,P.byteOffset,P.byteLength),ee}function Yo(){P=null,Tr=null,_e=null}function xv(r){r.unpack?mt[r.type]=r.unpack:mt[r.type]=r}const Yc=new Array(147);for(let r=0;r<256;r++)Yc[r]=+("1e"+Math.floor(45.15-r*.30103));var Wi=new js({useRecords:!1});const Ov=Wi.unpack;Wi.unpackMultiple;Wi.unpack;let Tv=new Float32Array(1);new Uint8Array(Tv.buffer,0,4);let Ba;try{Ba=new TextEncoder}catch{}let _i,Hc;const qi=typeof Buffer<"u",va=qi?function(r){return Buffer.allocUnsafeSlow(r)}:Uint8Array,mh=qi?Buffer:Uint8Array,Yu=qi?4294967296:2144337920;let b,Hn,Ne,g=0,ct,Me=null,Sv;const Ev=21760,Nv=/[\u0080-\uFFFF]/,Sn=Symbol("record-id");class Av extends js{constructor(e){super(e),this.offset=0;let t,n,s,a,i=mh.prototype.utf8Write?function(l,x){return b.utf8Write(l,x,4294967295)}:Ba&&Ba.encodeInto?function(l,x){return Ba.encodeInto(l,b.subarray(x)).written}:!1,o=this;e||(e={});let c=e&&e.sequential,d=e.structures||e.saveStructures,w=e.maxSharedStructures;if(w==null&&(w=d?32:0),w>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let D=e.maxOwnStructures;D==null&&(D=d?32:64),!this.structures&&e.useRecords!=!1&&(this.structures=[]);let X=w>32||D+w>64,ee=w+64,Be=w+D+64;if(Be>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let te=[],Hr=0,nr=0;this.pack=this.encode=function(l,x){if(b||(b=new va(8192),Ne=b.dataView||(b.dataView=new DataView(b.buffer,0,8192)),g=0),ct=b.length-10,ct-g<2048?(b=new va(b.length),Ne=b.dataView||(b.dataView=new DataView(b.buffer,0,b.length)),ct=b.length-10,g=0):g=g+7&2147483640,t=g,x&$v&&(g+=x&255),a=o.structuredClone?new Map:null,o.bundleStrings&&typeof l!="string"?(Me=[],Me.size=1/0):Me=null,s=o.structures,s){s.uninitialized&&(s=o._mergeStructures(o.getStructures()));let p=s.sharedLength||0;if(p>w)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+s.sharedLength);if(!s.transitions){s.transitions=Object.create(null);for(let m=0;m<p;m++){let k=s[m];if(!k)continue;let I,$=s.transitions;for(let S=0,ne=k.length;S<ne;S++){let K=k[S];I=$[K],I||(I=$[K]=Object.create(null)),$=I}$[Sn]=m+64}this.lastNamedStructuresLength=p}c||(s.nextId=p+64)}n&&(n=!1);try{o.randomAccessStructure&&l&&l.constructor&&l.constructor===Object?co(l):re(l);let p=Me;if(Me&&Ju(t,re,0),a&&a.idsToInsert){let m=a.idsToInsert.sort((S,ne)=>S.offset>ne.offset?1:-1),k=m.length,I=-1;for(;p&&k>0;){let S=m[--k].offset+t;S<p.stringsPosition+t&&I===-1&&(I=0),S>p.position+t?I>=0&&(I+=6):(I>=0&&(Ne.setUint32(p.position+t,Ne.getUint32(p.position+t)+I),I=-1),p=p.previous,k++)}I>=0&&p&&Ne.setUint32(p.position+t,Ne.getUint32(p.position+t)+I),g+=m.length*6,g>ct&&Xe(g),o.offset=g;let $=Iv(b.subarray(t,g),m);return a=null,$}return o.offset=g,x&zv?(b.start=t,b.end=g,b):b.subarray(t,g)}finally{if(s&&(Bn(),n&&o.saveStructures)){let p=s.sharedLength||0,m=b.subarray(t,g),k=Zv(s,o);return o.saveStructures(k,k.isCompatible)===!1?o.pack(l,x):(o.lastNamedStructuresLength=p,m)}x&Pv&&(g=t)}};const Bn=()=>{nr<10&&nr++;let l=s.sharedLength||0;if(s.length>l&&!c&&(s.length=l),Hr>1e4)s.transitions=null,nr=0,Hr=0,te.length>0&&(te=[]);else if(te.length>0&&!c){for(let x=0,p=te.length;x<p;x++)te[x][Sn]=0;te=[]}},Gr=l=>{var x=l.length;x<16?b[g++]=144|x:x<65536?(b[g++]=220,b[g++]=x>>8,b[g++]=x&255):(b[g++]=221,Ne.setUint32(g,x),g+=4);for(let p=0;p<x;p++)re(l[p])},re=l=>{g>ct&&(b=Xe(g));var x=typeof l,p;if(x==="string"){let m=l.length;if(Me&&m>=4&&m<4096){if((Me.size+=m)>Ev){let S,ne=(Me[0]?Me[0].length*3+Me[1].length:0)+10;g+ne>ct&&(b=Xe(g+ne));let K;Me.position?(K=Me,b[g]=200,g+=3,b[g++]=98,S=g-t,g+=4,Ju(t,re,0),Ne.setUint16(S+t-3,g-t-S)):(b[g++]=214,b[g++]=98,S=g-t,g+=4),Me=["",""],Me.previous=K,Me.size=0,Me.position=S}let $=Nv.test(l);Me[$?0:1]+=l,b[g++]=193,re($?-m:m);return}let k;m<32?k=1:m<256?k=2:m<65536?k=3:k=5;let I=m*3;if(g+I>ct&&(b=Xe(g+I)),m<64||!i){let $,S,ne,K=g+k;for($=0;$<m;$++)S=l.charCodeAt($),S<128?b[K++]=S:S<2048?(b[K++]=S>>6|192,b[K++]=S&63|128):(S&64512)===55296&&((ne=l.charCodeAt($+1))&64512)===56320?(S=65536+((S&1023)<<10)+(ne&1023),$++,b[K++]=S>>18|240,b[K++]=S>>12&63|128,b[K++]=S>>6&63|128,b[K++]=S&63|128):(b[K++]=S>>12|224,b[K++]=S>>6&63|128,b[K++]=S&63|128);p=K-g-k}else p=i(l,g+k);p<32?b[g++]=160|p:p<256?(k<2&&b.copyWithin(g+2,g+1,g+1+p),b[g++]=217,b[g++]=p):p<65536?(k<3&&b.copyWithin(g+3,g+2,g+2+p),b[g++]=218,b[g++]=p>>8,b[g++]=p&255):(k<5&&b.copyWithin(g+5,g+3,g+3+p),b[g++]=219,Ne.setUint32(g,p),g+=4),g+=p}else if(x==="number")if(l>>>0===l)l<32||l<128&&this.useRecords===!1||l<64&&!this.randomAccessStructure?b[g++]=l:l<256?(b[g++]=204,b[g++]=l):l<65536?(b[g++]=205,b[g++]=l>>8,b[g++]=l&255):(b[g++]=206,Ne.setUint32(g,l),g+=4);else if(l>>0===l)l>=-32?b[g++]=256+l:l>=-128?(b[g++]=208,b[g++]=l+256):l>=-32768?(b[g++]=209,Ne.setInt16(g,l),g+=2):(b[g++]=210,Ne.setInt32(g,l),g+=4);else{let m;if((m=this.useFloat32)>0&&l<4294967296&&l>=-2147483648){b[g++]=202,Ne.setFloat32(g,l);let k;if(m<4||(k=l*Yc[(b[g]&127)<<1|b[g+1]>>7])>>0===k){g+=4;return}else g--}b[g++]=203,Ne.setFloat64(g,l),g+=8}else if(x==="object"||x==="function")if(!l)b[g++]=192;else{if(a){let k=a.get(l);if(k){if(!k.id){let I=a.idsToInsert||(a.idsToInsert=[]);k.id=I.push(k)}b[g++]=214,b[g++]=112,Ne.setUint32(g,k.id),g+=4;return}else a.set(l,{offset:g-t})}let m=l.constructor;if(m===Object)sr(l,!0);else if(m===Array)Gr(l);else if(m===Map)if(this.mapAsEmptyObject)b[g++]=128;else{p=l.size,p<16?b[g++]=128|p:p<65536?(b[g++]=222,b[g++]=p>>8,b[g++]=p&255):(b[g++]=223,Ne.setUint32(g,p),g+=4);for(let[k,I]of l)re(k),re(I)}else{for(let k=0,I=_i.length;k<I;k++){let $=Hc[k];if(l instanceof $){let S=_i[k];if(S.write){S.type&&(b[g++]=212,b[g++]=S.type,b[g++]=0);let Qe=S.write.call(this,l);Qe===l?Array.isArray(l)?Gr(l):sr(l):re(Qe);return}let ne=b,K=Ne,Ke=g;b=null;let it;try{it=S.pack.call(this,l,Qe=>(b=ne,ne=null,g+=Qe,g>ct&&Xe(g),{target:b,targetView:Ne,position:g-Qe}),re)}finally{ne&&(b=ne,Ne=K,g=Ke,ct=b.length-10)}it&&(it.length+g>ct&&Xe(it.length+g),g=Cv(it,b,g,S.type));return}}if(Array.isArray(l))Gr(l);else{if(l.toJSON){const k=l.toJSON();if(k!==l)return re(k)}if(x==="function")return re(this.writeFunction&&this.writeFunction(l));sr(l,!l.hasOwnProperty)}}}else if(x==="boolean")b[g++]=l?195:194;else if(x==="bigint"){if(l<BigInt(1)<<BigInt(63)&&l>=-(BigInt(1)<<BigInt(63)))b[g++]=211,Ne.setBigInt64(g,l);else if(l<BigInt(1)<<BigInt(64)&&l>0)b[g++]=207,Ne.setBigUint64(g,l);else if(this.largeBigIntToFloat)b[g++]=203,Ne.setFloat64(g,Number(l));else throw new RangeError(l+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");g+=8}else if(x==="undefined")this.encodeUndefinedAsNil?b[g++]=192:(b[g++]=212,b[g++]=0,b[g++]=0);else throw new Error("Unknown type: "+x)},Vn=this.variableMapSize||this.coercibleKeyAsNumber?l=>{let x=Object.keys(l),p=x.length;p<16?b[g++]=128|p:p<65536?(b[g++]=222,b[g++]=p>>8,b[g++]=p&255):(b[g++]=223,Ne.setUint32(g,p),g+=4);let m;if(this.coercibleKeyAsNumber)for(let k=0;k<p;k++){m=x[k];let I=Number(m);re(isNaN(I)?m:I),re(l[m])}else for(let k=0;k<p;k++)re(m=x[k]),re(l[m])}:(l,x)=>{b[g++]=222;let p=g-t;g+=2;let m=0;for(let k in l)(x||l.hasOwnProperty(k))&&(re(k),re(l[k]),m++);b[p+++t]=m>>8,b[p+t]=m&255},Fn=this.useRecords===!1?Vn:e.progressiveRecords&&!X?(l,x)=>{let p,m=s.transitions||(s.transitions=Object.create(null)),k=g++-t,I;for(let $ in l)if(x||l.hasOwnProperty($)){if(p=m[$],p)m=p;else{let S=Object.keys(l),ne=m;m=s.transitions;let K=0;for(let Ke=0,it=S.length;Ke<it;Ke++){let Qe=S[Ke];p=m[Qe],p||(p=m[Qe]=Object.create(null),K++),m=p}k+t+1==g?(g--,Jr(m,S,K)):Wn(m,S,k,K),I=!0,m=ne[$]}re(l[$])}if(!I){let $=m[Sn];$?b[k+t]=$:Wn(m,Object.keys(l),k,0)}}:(l,x)=>{let p,m=s.transitions||(s.transitions=Object.create(null)),k=0;for(let $ in l)(x||l.hasOwnProperty($))&&(p=m[$],p||(p=m[$]=Object.create(null),k++),m=p);let I=m[Sn];I?I>=96&&X?(b[g++]=((I-=96)&31)+96,b[g++]=I>>5):b[g++]=I:Jr(m,m.__keys__||Object.keys(l),k);for(let $ in l)(x||l.hasOwnProperty($))&&re(l[$])},Kn=typeof this.useRecords=="function"&&this.useRecords,sr=Kn?(l,x)=>{Kn(l)?Fn(l,x):Vn(l,x)}:Fn,Xe=l=>{let x;if(l>16777216){if(l-t>Yu)throw new Error("Packed buffer would be larger than maximum buffer size");x=Math.min(Yu,Math.round(Math.max((l-t)*(l>67108864?1.25:2),4194304)/4096)*4096)}else x=(Math.max(l-t<<2,b.length-1)>>12)+1<<12;let p=new va(x);return Ne=p.dataView||(p.dataView=new DataView(p.buffer,0,x)),l=Math.min(l,b.length),b.copy?b.copy(p,0,t,l):p.set(b.slice(t,l)),g-=t,t=0,ct=p.length-10,b=p},Jr=(l,x,p)=>{let m=s.nextId;m||(m=64),m<ee&&this.shouldShareStructure&&!this.shouldShareStructure(x)?(m=s.nextOwnId,m<Be||(m=ee),s.nextOwnId=m+1):(m>=Be&&(m=ee),s.nextId=m+1);let k=x.highByte=m>=96&&X?m-96>>5:-1;l[Sn]=m,l.__keys__=x,s[m-64]=x,m<ee?(x.isShared=!0,s.sharedLength=m-63,n=!0,k>=0?(b[g++]=(m&31)+96,b[g++]=k):b[g++]=m):(k>=0?(b[g++]=213,b[g++]=114,b[g++]=(m&31)+96,b[g++]=k):(b[g++]=212,b[g++]=114,b[g++]=m),p&&(Hr+=nr*p),te.length>=D&&(te.shift()[Sn]=0),te.push(l),re(x))},Wn=(l,x,p,m)=>{let k=b,I=g,$=ct,S=t;b=Hn,g=0,t=0,b||(Hn=b=new va(8192)),ct=b.length-10,Jr(l,x,m),Hn=b;let ne=g;if(b=k,g=I,ct=$,t=S,ne>1){let K=g+ne-1;K>ct&&Xe(K);let Ke=p+t;b.copyWithin(Ke+ne,Ke+1,g),b.set(Hn.slice(0,ne),Ke),g=K}else b[p+t]=Hn[0]},co=(l,x)=>{let p=Sv(l,b,t,g,s,Xe,(m,k,I)=>{if(I)return n=!0;g=k;let $=b;return re(m),Bn(),$!==b?{position:g,targetView:Ne,target:b}:g},this);if(p===0)return sr(l,!0);g=p}}useBuffer(e){b=e,Ne=new DataView(b.buffer,b.byteOffset,b.byteLength),g=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}Hc=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,oh];_i=[{pack(r,e,t){let n=r.getTime()/1e3;if((this.useTimestamp32||r.getMilliseconds()===0)&&n>=0&&n<4294967296){let{target:s,targetView:a,position:i}=e(6);s[i++]=214,s[i++]=255,a.setUint32(i,n)}else if(n>0&&n<4294967296){let{target:s,targetView:a,position:i}=e(10);s[i++]=215,s[i++]=255,a.setUint32(i,r.getMilliseconds()*4e6+(n/1e3/4294967296>>0)),a.setUint32(i+4,n)}else if(isNaN(n)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:s,targetView:a,position:i}=e(3);s[i++]=212,s[i++]=255,s[i++]=255}else{let{target:s,targetView:a,position:i}=e(15);s[i++]=199,s[i++]=12,s[i++]=255,a.setUint32(i,r.getMilliseconds()*1e6),a.setBigInt64(i+4,BigInt(Math.floor(n)))}}},{pack(r,e,t){if(this.setAsEmptyObject)return e(0),t({});let n=Array.from(r),{target:s,position:a}=e(this.moreTypes?3:0);this.moreTypes&&(s[a++]=212,s[a++]=115,s[a++]=0),t(n)}},{pack(r,e,t){let{target:n,position:s}=e(this.moreTypes?3:0);this.moreTypes&&(n[s++]=212,n[s++]=101,n[s++]=0),t([r.name,r.message])}},{pack(r,e,t){let{target:n,position:s}=e(this.moreTypes?3:0);this.moreTypes&&(n[s++]=212,n[s++]=120,n[s++]=0),t([r.source,r.flags])}},{pack(r,e){this.moreTypes?Hu(r,16,e):Gu(qi?Buffer.from(r):new Uint8Array(r),e)}},{pack(r,e){let t=r.constructor;t!==mh&&this.moreTypes?Hu(r,fh.indexOf(t.name),e):Gu(r,e)}},{pack(r,e){let{target:t,position:n}=e(1);t[n]=193}}];function Hu(r,e,t,n){let s=r.byteLength;if(s+1<256){var{target:a,position:i}=t(4+s);a[i++]=199,a[i++]=s+1}else if(s+1<65536){var{target:a,position:i}=t(5+s);a[i++]=200,a[i++]=s+1>>8,a[i++]=s+1&255}else{var{target:a,position:i,targetView:o}=t(7+s);a[i++]=201,o.setUint32(i,s+1),i+=4}a[i++]=116,a[i++]=e,a.set(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),i)}function Gu(r,e){let t=r.byteLength;var n,s;if(t<256){var{target:n,position:s}=e(t+2);n[s++]=196,n[s++]=t}else if(t<65536){var{target:n,position:s}=e(t+3);n[s++]=197,n[s++]=t>>8,n[s++]=t&255}else{var{target:n,position:s,targetView:a}=e(t+5);n[s++]=198,a.setUint32(s,t),s+=4}n.set(r,s)}function Cv(r,e,t,n){let s=r.length;switch(s){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:s<256?(e[t++]=199,e[t++]=s):s<65536?(e[t++]=200,e[t++]=s>>8,e[t++]=s&255):(e[t++]=201,e[t++]=s>>24,e[t++]=s>>16&255,e[t++]=s>>8&255,e[t++]=s&255)}return e[t++]=n,e.set(r,t),t+=s,t}function Iv(r,e){let t,n=e.length*6,s=r.length-n;for(;t=e.pop();){let a=t.offset,i=t.id;r.copyWithin(a+n,a,s),n-=6;let o=a+n;r[o++]=214,r[o++]=105,r[o++]=i>>24,r[o++]=i>>16&255,r[o++]=i>>8&255,r[o++]=i&255,s=a}return r}function Ju(r,e,t){if(Me.length>0){Ne.setUint32(Me.position+r,g+t-Me.position-r),Me.stringsPosition=g-r;let n=Me;Me=null,e(n[0]),e(n[1])}}function jv(r){if(r.Class){if(!r.pack&&!r.write)throw new Error("Extension has no pack or write function");if(r.pack&&!r.type)throw new Error("Extension has no type (numeric code to identify the extension)");Hc.unshift(r.Class),_i.unshift(r)}xv(r)}function Zv(r,e){return r.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},r}let yh=new Av({useRecords:!1});const Rv=yh.pack;yh.pack;const zv=512,Pv=1024,$v=2048;class Dv{constructor(){Z(this,"contentType","application/msgpack")}encode(e){return Rv(Dn.toSnake(e))}decode(e,t){const n=Dn.toCamel(Ov(new Uint8Array(e)));return t!=null?t.parse(n):n}static registerCustomType(e){jv({type:0,...e})}}class Uv{constructor(){Z(this,"contentType","application/json")}encode(e){const t=JSON.stringify(Dn.toSnake(e),(n,s)=>ArrayBuffer.isView(s)?Array.from(s):s);return new TextEncoder().encode(t)}decode(e,t){const n=Dn.toCamel(JSON.parse(new TextDecoder().decode(e)));return t!=null?t.parse(n):n}static registerCustomType(){}}new Dv,new Uv;var xe;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(xe||(xe={}));var Ho;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ho||(Ho={}));const L=xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$r=r=>{switch(typeof r){case"undefined":return L.undefined;case"string":return L.string;case"number":return isNaN(r)?L.nan:L.number;case"boolean":return L.boolean;case"function":return L.function;case"bigint":return L.bigint;case"symbol":return L.symbol;case"object":return Array.isArray(r)?L.array:r===null?L.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?L.promise:typeof Map<"u"&&r instanceof Map?L.map:typeof Set<"u"&&r instanceof Set?L.set:typeof Date<"u"&&r instanceof Date?L.date:L.object;default:return L.unknown}},C=xe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Mv=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Vt extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,c=0;for(;c<i.path.length;){const d=i.path[c];c===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],c++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Vt.create=r=>new Vt(r);const Zs=(r,e)=>{let t;switch(r.code){case C.invalid_type:r.received===L.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case C.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,xe.jsonStringifyReplacer)}`;break;case C.unrecognized_keys:t=`Unrecognized key(s) in object: ${xe.joinValues(r.keys,", ")}`;break;case C.invalid_union:t="Invalid input";break;case C.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${xe.joinValues(r.options)}`;break;case C.invalid_enum_value:t=`Invalid enum value. Expected ${xe.joinValues(r.options)}, received '${r.received}'`;break;case C.invalid_arguments:t="Invalid function arguments";break;case C.invalid_return_type:t="Invalid function return type";break;case C.invalid_date:t="Invalid date";break;case C.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:xe.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case C.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case C.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case C.custom:t="Invalid input";break;case C.invalid_intersection_types:t="Intersection results could not be merged";break;case C.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case C.not_finite:t="Number must be finite";break;default:t=e.defaultError,xe.assertNever(r)}return{message:t}};let gh=Zs;function Lv(r){gh=r}function bi(){return gh}const ki=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const c=n.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},Bv=[];function F(r,e){const t=ki({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bi(),Zs].filter(n=>!!n)});r.common.issues.push(t)}let wt=class vh{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return ae;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t)n.push({key:await s.key,value:await s.value});return vh.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return ae;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}};const ae=Object.freeze({status:"aborted"}),wh=r=>({status:"dirty",value:r}),yt=r=>({status:"valid",value:r}),Go=r=>r.status==="aborted",Jo=r=>r.status==="dirty",Rs=r=>r.status==="valid",xi=r=>typeof Promise<"u"&&r instanceof Promise;var Y;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Y||(Y={}));let tr=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const Xu=(r,e)=>{if(Rs(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Vt(r.common.issues);return this._error=t,this._error}}};function ce(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,i)=>a.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.defaultError},description:s}}let de=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return $r(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new wt,ctx:{common:e.parent.common,data:e.data,parsedType:$r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(xi(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$r(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Xu(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$r(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(xi(s)?s:Promise.resolve(s));return Xu(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:C.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Wt({schema:this,typeName:J.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sr.create(this,this._def)}nullable(){return gn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mn.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return Ds.create([this,e],this._def)}and(e){return Us.create(this,e,this._def)}transform(e){return new Wt({...ce(this._def),schema:this,typeName:J.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Fs({...ce(this._def),innerType:this,defaultValue:t,typeName:J.ZodDefault})}brand(){return new bh({typeName:J.ZodBranded,type:this,...ce(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ei({...ce(this._def),innerType:this,catchValue:t,typeName:J.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return sa.create(this,e)}readonly(){return Ai.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const Vv=/^c[^\s-]{8,}$/i,Fv=/^[a-z][a-z0-9]*$/,Kv=/^[0-9A-HJKMNP-TV-Z]{26}$/,Wv=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qv=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let _o;const Hv=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Gv=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Jv=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Xv(r,e){return!!((e==="v4"||!e)&&Hv.test(r)||(e==="v6"||!e)&&Gv.test(r))}class Ut extends de{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==L.string){const s=this._getOrReturnCtx(e);return F(s,{code:C.invalid_type,expected:L.string,received:s.parsedType}),ae}const t=new wt;let n;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:C.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:C.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(n=this._getOrReturnCtx(e,n),a?F(n,{code:C.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&F(n,{code:C.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if(s.kind==="email")qv.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"email",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="emoji")_o||(_o=new RegExp(Yv,"u")),_o.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"emoji",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="uuid")Wv.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"uuid",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid")Vv.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"cuid",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid2")Fv.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"cuid2",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="ulid")Kv.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"ulid",code:C.invalid_string,message:s.message}),t.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),F(n,{validation:"url",code:C.invalid_string,message:s.message}),t.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"regex",code:C.invalid_string,message:s.message}),t.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),F(n,{code:C.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),F(n,{code:C.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),F(n,{code:C.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):s.kind==="datetime"?Jv(s).test(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:C.invalid_string,validation:"datetime",message:s.message}),t.dirty()):s.kind==="ip"?Xv(e.data,s.version)||(n=this._getOrReturnCtx(e,n),F(n,{validation:"ip",code:C.invalid_string,message:s.message}),t.dirty()):xe.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:C.invalid_string,...Y.errToObj(n)})}_addCheck(e){return new Ut({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...Y.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Y.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Y.errToObj(t)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new Ut({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ut({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ut({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ut.create=r=>{var e;return new Ut({checks:[],typeName:J.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ce(r)})};function Qv(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class Wr extends de{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==L.number){const s=this._getOrReturnCtx(e);return F(s,{code:C.invalid_type,expected:L.number,received:s.parsedType}),ae}let t;const n=new wt;for(const s of this._def.checks)s.kind==="int"?xe.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),F(t,{code:C.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),F(t,{code:C.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),F(t,{code:C.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?Qv(e.data,s.value)!==0&&(t=this._getOrReturnCtx(e,t),F(t,{code:C.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),F(t,{code:C.not_finite,message:s.message}),n.dirty()):xe.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,n,s){return new Wr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Y.toString(s)}]})}_addCheck(e){return new Wr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&xe.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Wr.create=r=>new Wr({checks:[],typeName:J.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...ce(r)});class qr extends de{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==L.bigint){const s=this._getOrReturnCtx(e);return F(s,{code:C.invalid_type,expected:L.bigint,received:s.parsedType}),ae}let t;const n=new wt;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),F(t,{code:C.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),F(t,{code:C.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),F(t,{code:C.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):xe.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,n,s){return new qr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Y.toString(s)}]})}_addCheck(e){return new qr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}qr.create=r=>{var e;return new qr({checks:[],typeName:J.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...ce(r)})};class zs extends de{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==L.boolean){const t=this._getOrReturnCtx(e);return F(t,{code:C.invalid_type,expected:L.boolean,received:t.parsedType}),ae}return yt(e.data)}}zs.create=r=>new zs({typeName:J.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...ce(r)});class pn extends de{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==L.date){const s=this._getOrReturnCtx(e);return F(s,{code:C.invalid_type,expected:L.date,received:s.parsedType}),ae}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return F(s,{code:C.invalid_date}),ae}const t=new wt;let n;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:C.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),F(n,{code:C.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):xe.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pn({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}pn.create=r=>new pn({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:J.ZodDate,...ce(r)});class Oi extends de{_parse(e){if(this._getType(e)!==L.symbol){const t=this._getOrReturnCtx(e);return F(t,{code:C.invalid_type,expected:L.symbol,received:t.parsedType}),ae}return yt(e.data)}}Oi.create=r=>new Oi({typeName:J.ZodSymbol,...ce(r)});class Ps extends de{_parse(e){if(this._getType(e)!==L.undefined){const t=this._getOrReturnCtx(e);return F(t,{code:C.invalid_type,expected:L.undefined,received:t.parsedType}),ae}return yt(e.data)}}Ps.create=r=>new Ps({typeName:J.ZodUndefined,...ce(r)});class $s extends de{_parse(e){if(this._getType(e)!==L.null){const t=this._getOrReturnCtx(e);return F(t,{code:C.invalid_type,expected:L.null,received:t.parsedType}),ae}return yt(e.data)}}$s.create=r=>new $s({typeName:J.ZodNull,...ce(r)});class Un extends de{constructor(){super(...arguments),this._any=!0}_parse(e){return yt(e.data)}}Un.create=r=>new Un({typeName:J.ZodAny,...ce(r)});class cn extends de{constructor(){super(...arguments),this._unknown=!0}_parse(e){return yt(e.data)}}cn.create=r=>new cn({typeName:J.ZodUnknown,...ce(r)});class Ar extends de{_parse(e){const t=this._getOrReturnCtx(e);return F(t,{code:C.invalid_type,expected:L.never,received:t.parsedType}),ae}}Ar.create=r=>new Ar({typeName:J.ZodNever,...ce(r)});class Ti extends de{_parse(e){if(this._getType(e)!==L.undefined){const t=this._getOrReturnCtx(e);return F(t,{code:C.invalid_type,expected:L.void,received:t.parsedType}),ae}return yt(e.data)}}Ti.create=r=>new Ti({typeName:J.ZodVoid,...ce(r)});let mn=class Va extends de{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==L.array)return F(t,{code:C.invalid_type,expected:L.array,received:t.parsedType}),ae;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(F(t,{code:i?C.too_big:C.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(F(t,{code:C.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(F(t,{code:C.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new tr(t,i,t.path,o)))).then(i=>wt.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new tr(t,i,t.path,o)));return wt.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Va({...this._def,minLength:{value:e,message:Y.toString(t)}})}max(e,t){return new Va({...this._def,maxLength:{value:e,message:Y.toString(t)}})}length(e,t){return new Va({...this._def,exactLength:{value:e,message:Y.toString(t)}})}nonempty(e){return this.min(1,e)}};mn.create=(r,e)=>new mn({type:r,minLength:null,maxLength:null,exactLength:null,typeName:J.ZodArray,...ce(e)});function An(r){if(r instanceof Zt){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Sr.create(An(n))}return new Zt({...r._def,shape:()=>e})}else return r instanceof mn?new mn({...r._def,type:An(r.element)}):r instanceof Sr?Sr.create(An(r.unwrap())):r instanceof gn?gn.create(An(r.unwrap())):r instanceof rr?rr.create(r.items.map(e=>An(e))):r}let Zt=class zt extends de{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=xe.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==L.object){const c=this._getOrReturnCtx(e);return F(c,{code:C.invalid_type,expected:L.object,received:c.parsedType}),ae}const{status:t,ctx:n}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ar&&this._def.unknownKeys==="strip"))for(const c in n.data)a.includes(c)||i.push(c);const o=[];for(const c of a){const d=s[c],w=n.data[c];o.push({key:{status:"valid",value:c},value:d._parse(new tr(n,w,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Ar){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of i)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(c==="strict")i.length>0&&(F(n,{code:C.unrecognized_keys,keys:i}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of i){const w=n.data[d];o.push({key:{status:"valid",value:d},value:c._parse(new tr(n,w,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of o){const w=await d.key;c.push({key:w,value:await d.value,alwaysSet:d.alwaysSet})}return c}).then(c=>wt.mergeObjectSync(t,c)):wt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new zt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const c=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=Y.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new zt({...this._def,unknownKeys:"strip"})}passthrough(){return new zt({...this._def,unknownKeys:"passthrough"})}extend(e){return new zt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new zt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:J.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new zt({...this._def,catchall:e})}pick(e){const t={};return xe.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new zt({...this._def,shape:()=>t})}omit(e){const t={};return xe.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new zt({...this._def,shape:()=>t})}deepPartial(){return An(this)}partial(e){const t={};return xe.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new zt({...this._def,shape:()=>t})}required(e){const t={};return xe.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Sr;)s=s._def.innerType;t[n]=s}}),new zt({...this._def,shape:()=>t})}keyof(){return _h(xe.objectKeys(this.shape))}};Zt.create=(r,e)=>new Zt({shape:()=>r,unknownKeys:"strip",catchall:Ar.create(),typeName:J.ZodObject,...ce(e)});Zt.strictCreate=(r,e)=>new Zt({shape:()=>r,unknownKeys:"strict",catchall:Ar.create(),typeName:J.ZodObject,...ce(e)});Zt.lazycreate=(r,e)=>new Zt({shape:r,unknownKeys:"strip",catchall:Ar.create(),typeName:J.ZodObject,...ce(e)});class Ds extends de{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new Vt(o.ctx.common.issues));return F(t,{code:C.invalid_union,unionErrors:i}),ae}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const d={...t,common:{...t.common,issues:[]},parent:null},w=c._parseSync({data:t.data,path:t.path,parent:d});if(w.status==="valid")return w;w.status==="dirty"&&!a&&(a={result:w,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new Vt(c));return F(t,{code:C.invalid_union,unionErrors:o}),ae}}get options(){return this._def.options}}Ds.create=(r,e)=>new Ds({options:r,typeName:J.ZodUnion,...ce(e)});const Fa=r=>r instanceof Ls?Fa(r.schema):r instanceof Wt?Fa(r.innerType()):r instanceof Bs?[r.value]:r instanceof Yr?r.options:r instanceof Vs?Object.keys(r.enum):r instanceof Fs?Fa(r._def.innerType):r instanceof Ps?[void 0]:r instanceof $s?[null]:null;class Yi extends de{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.object)return F(t,{code:C.invalid_type,expected:L.object,received:t.parsedType}),ae;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(F(t,{code:C.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=Fa(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new Yi({typeName:J.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...ce(n)})}}function Xo(r,e){const t=$r(r),n=$r(e);if(r===e)return{valid:!0,data:r};if(t===L.object&&n===L.object){const s=xe.objectKeys(e),a=xe.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=Xo(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===L.array&&n===L.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],c=Xo(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===L.date&&n===L.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Us extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Go(a)||Go(i))return ae;const o=Xo(a.value,i.value);return o.valid?((Jo(a)||Jo(i))&&t.dirty(),{status:t.value,value:o.data}):(F(n,{code:C.invalid_intersection_types}),ae)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Us.create=(r,e,t)=>new Us({left:r,right:e,typeName:J.ZodIntersection,...ce(t)});class rr extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.array)return F(n,{code:C.invalid_type,expected:L.array,received:n.parsedType}),ae;if(n.data.length<this._def.items.length)return F(n,{code:C.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&n.data.length>this._def.items.length&&(F(n,{code:C.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...n.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new tr(n,a,n.path,i)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>wt.mergeArray(t,a)):wt.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new rr({...this._def,rest:e})}}rr.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new rr({items:r,typeName:J.ZodTuple,rest:null,...ce(e)})};class Ms extends de{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.object)return F(n,{code:C.invalid_type,expected:L.object,received:n.parsedType}),ae;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new tr(n,o,n.path,o)),value:i._parse(new tr(n,n.data[o],n.path,o))});return n.common.async?wt.mergeObjectAsync(t,s):wt.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof de?new Ms({keyType:e,valueType:t,typeName:J.ZodRecord,...ce(n)}):new Ms({keyType:Ut.create(),valueType:e,typeName:J.ZodRecord,...ce(t)})}}class Si extends de{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.map)return F(n,{code:C.invalid_type,expected:L.map,received:n.parsedType}),ae;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],d)=>({key:s._parse(new tr(n,o,n.path,[d,"key"])),value:a._parse(new tr(n,c,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const d=await c.key,w=await c.value;if(d.status==="aborted"||w.status==="aborted")return ae;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const d=c.key,w=c.value;if(d.status==="aborted"||w.status==="aborted")return ae;(d.status==="dirty"||w.status==="dirty")&&t.dirty(),o.set(d.value,w.value)}return{status:t.value,value:o}}}}Si.create=(r,e,t)=>new Si({valueType:e,keyType:r,typeName:J.ZodMap,...ce(t)});class yn extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==L.set)return F(n,{code:C.invalid_type,expected:L.set,received:n.parsedType}),ae;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(F(n,{code:C.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(F(n,{code:C.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const d=new Set;for(const w of c){if(w.status==="aborted")return ae;w.status==="dirty"&&t.dirty(),d.add(w.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((c,d)=>a._parse(new tr(n,c,n.path,d)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new yn({...this._def,minSize:{value:e,message:Y.toString(t)}})}max(e,t){return new yn({...this._def,maxSize:{value:e,message:Y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}yn.create=(r,e)=>new yn({valueType:r,minSize:null,maxSize:null,typeName:J.ZodSet,...ce(e)});class In extends de{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.function)return F(t,{code:C.invalid_type,expected:L.function,received:t.parsedType}),ae;function n(o,c){return ki({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bi(),Zs].filter(d=>!!d),issueData:{code:C.invalid_arguments,argumentsError:c}})}function s(o,c){return ki({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bi(),Zs].filter(d=>!!d),issueData:{code:C.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Mn){const o=this;return yt(async function(...c){const d=new Vt([]),w=await o._def.args.parseAsync(c,a).catch(X=>{throw d.addIssue(n(c,X)),d}),D=await Reflect.apply(i,this,w);return await o._def.returns._def.type.parseAsync(D,a).catch(X=>{throw d.addIssue(s(D,X)),d})})}else{const o=this;return yt(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new Vt([n(c,d.error)]);const w=Reflect.apply(i,this,d.data),D=o._def.returns.safeParse(w,a);if(!D.success)throw new Vt([s(w,D.error)]);return D.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new In({...this._def,args:rr.create(e).rest(cn.create())})}returns(e){return new In({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new In({args:e||rr.create([]).rest(cn.create()),returns:t||cn.create(),typeName:J.ZodFunction,...ce(n)})}}class Ls extends de{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ls.create=(r,e)=>new Ls({getter:r,typeName:J.ZodLazy,...ce(e)});class Bs extends de{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return F(t,{received:t.data,code:C.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:e.data}}get value(){return this._def.value}}Bs.create=(r,e)=>new Bs({value:r,typeName:J.ZodLiteral,...ce(e)});function _h(r,e){return new Yr({values:r,typeName:J.ZodEnum,...ce(e)})}class Yr extends de{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return F(t,{expected:xe.joinValues(n),received:t.parsedType,code:C.invalid_type}),ae}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return F(t,{received:t.data,code:C.invalid_enum_value,options:n}),ae}return yt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return Yr.create(e)}exclude(e){return Yr.create(this.options.filter(t=>!e.includes(t)))}}Yr.create=_h;class Vs extends de{_parse(e){const t=xe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==L.string&&n.parsedType!==L.number){const s=xe.objectValues(t);return F(n,{expected:xe.joinValues(s),received:n.parsedType,code:C.invalid_type}),ae}if(t.indexOf(e.data)===-1){const s=xe.objectValues(t);return F(n,{received:n.data,code:C.invalid_enum_value,options:s}),ae}return yt(e.data)}get enum(){return this._def.values}}Vs.create=(r,e)=>new Vs({values:r,typeName:J.ZodNativeEnum,...ce(e)});class Mn extends de{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.promise&&t.common.async===!1)return F(t,{code:C.invalid_type,expected:L.promise,received:t.parsedType}),ae;const n=t.parsedType===L.promise?t.data:Promise.resolve(t.data);return yt(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Mn.create=(r,e)=>new Mn({type:r,typeName:J.ZodPromise,...ce(e)});class Wt extends de{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{F(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ae:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?ae:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Rs(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Rs(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);xe.assertNever(s)}}Wt.create=(r,e,t)=>new Wt({schema:r,typeName:J.ZodEffects,effect:e,...ce(t)});Wt.createWithPreprocess=(r,e,t)=>new Wt({schema:e,effect:{type:"preprocess",transform:r},typeName:J.ZodEffects,...ce(t)});class Sr extends de{_parse(e){return this._getType(e)===L.undefined?yt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sr.create=(r,e)=>new Sr({innerType:r,typeName:J.ZodOptional,...ce(e)});class gn extends de{_parse(e){return this._getType(e)===L.null?yt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}gn.create=(r,e)=>new gn({innerType:r,typeName:J.ZodNullable,...ce(e)});class Fs extends de{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===L.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Fs.create=(r,e)=>new Fs({innerType:r,typeName:J.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ce(e)});class Ei extends de{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return xi(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Vt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Vt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ei.create=(r,e)=>new Ei({innerType:r,typeName:J.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ce(e)});class Ni extends de{_parse(e){if(this._getType(e)!==L.nan){const t=this._getOrReturnCtx(e);return F(t,{code:C.invalid_type,expected:L.nan,received:t.parsedType}),ae}return{status:"valid",value:e.data}}}Ni.create=r=>new Ni({typeName:J.ZodNaN,...ce(r)});const ew=Symbol("zod_brand");class bh extends de{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class sa extends de{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ae:s.status==="dirty"?(t.dirty(),wh(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ae:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new sa({in:e,out:t,typeName:J.ZodPipeline})}}class Ai extends de{_parse(e){const t=this._def.innerType._parse(e);return Rs(t)&&(t.value=Object.freeze(t.value)),t}}Ai.create=(r,e)=>new Ai({innerType:r,typeName:J.ZodReadonly,...ce(e)});const kh=(r,e={},t)=>r?Un.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:c})}}):Un.create(),tw={object:Zt.lazycreate};var J;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(J||(J={}));const rw=(r,e={message:`Input not instance of ${r.name}`})=>kh(t=>t instanceof r,e),xh=Ut.create,Oh=Wr.create,nw=Ni.create,sw=qr.create,Th=zs.create,aw=pn.create,iw=Oi.create,ow=Ps.create,cw=$s.create,uw=Un.create,lw=cn.create,dw=Ar.create,hw=Ti.create,fw=mn.create,pw=Zt.create,mw=Zt.strictCreate,yw=Ds.create,gw=Yi.create,vw=Us.create,ww=rr.create,_w=Ms.create,bw=Si.create,kw=yn.create,xw=In.create,Ow=Ls.create,Tw=Bs.create,Sw=Yr.create,Ew=Vs.create,Nw=Mn.create,Qu=Wt.create,Aw=Sr.create,Cw=gn.create,Iw=Wt.createWithPreprocess,jw=sa.create,Zw=()=>xh().optional(),Rw=()=>Oh().optional(),zw=()=>Th().optional(),Pw={string:r=>Ut.create({...r,coerce:!0}),number:r=>Wr.create({...r,coerce:!0}),boolean:r=>zs.create({...r,coerce:!0}),bigint:r=>qr.create({...r,coerce:!0}),date:r=>pn.create({...r,coerce:!0})},$w=ae;var _r=Object.freeze({__proto__:null,defaultErrorMap:Zs,setErrorMap:Lv,getErrorMap:bi,makeIssue:ki,EMPTY_PATH:Bv,addIssueToContext:F,ParseStatus:wt,INVALID:ae,DIRTY:wh,OK:yt,isAborted:Go,isDirty:Jo,isValid:Rs,isAsync:xi,get util(){return xe},get objectUtil(){return Ho},ZodParsedType:L,getParsedType:$r,ZodType:de,ZodString:Ut,ZodNumber:Wr,ZodBigInt:qr,ZodBoolean:zs,ZodDate:pn,ZodSymbol:Oi,ZodUndefined:Ps,ZodNull:$s,ZodAny:Un,ZodUnknown:cn,ZodNever:Ar,ZodVoid:Ti,ZodArray:mn,ZodObject:Zt,ZodUnion:Ds,ZodDiscriminatedUnion:Yi,ZodIntersection:Us,ZodTuple:rr,ZodRecord:Ms,ZodMap:Si,ZodSet:yn,ZodFunction:In,ZodLazy:Ls,ZodLiteral:Bs,ZodEnum:Yr,ZodNativeEnum:Vs,ZodPromise:Mn,ZodEffects:Wt,ZodTransformer:Wt,ZodOptional:Sr,ZodNullable:gn,ZodDefault:Fs,ZodCatch:Ei,ZodNaN:Ni,BRAND:ew,ZodBranded:bh,ZodPipeline:sa,ZodReadonly:Ai,custom:kh,Schema:de,ZodSchema:de,late:tw,get ZodFirstPartyTypeKind(){return J},coerce:Pw,any:uw,array:fw,bigint:sw,boolean:Th,date:aw,discriminatedUnion:gw,effect:Qu,enum:Sw,function:xw,instanceof:rw,intersection:vw,lazy:Ow,literal:Tw,map:bw,nan:nw,nativeEnum:Ew,never:dw,null:cw,nullable:Cw,number:Oh,object:pw,oboolean:zw,onumber:Rw,optional:Aw,ostring:Zw,pipeline:jw,preprocess:Iw,promise:Nw,record:_w,set:kw,strictObject:mw,string:xh,symbol:iw,transformer:Qu,tuple:ww,undefined:ow,union:yw,unknown:lw,void:hw,NEVER:$w,ZodIssueCode:C,quotelessJson:Mv,ZodError:Vt});class aa extends Error{constructor(e,t){super(e),We(this,"discriminator","FreighterError"),We(this,"type"),this.type=t}}const Dw=r=>{if(r==null||typeof r!="object")return!1;const e=r;if(e.discriminator!=="FreighterError")return!1;if(!("type"in e))throw new Error(`Freighter error is missing its type property: ${JSON.stringify(e)}`);return!0},Qo="unknown",el="nil",Hi="freighter",ia=_r.object({type:_r.string(),data:_r.string()});class Uw{constructor(){We(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:el,data:""};if(Dw(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}return{type:Qo,data:JSON.stringify(e)}}decode(e){if(e==null||e.type===el)return null;if(e.type===Qo)return new tl(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new tl(e.data)}}const Sh=new Uw,Eh=({encode:r,decode:e})=>Sh.register({encode:r,decode:e}),Gc=r=>Sh.decode(r);class tl extends aa{constructor(e){super(e,Qo)}}class Ks extends aa{constructor(){super("EOF",Hi)}}class Ci extends aa{constructor(){super("StreamClosed",Hi)}}class Ws extends aa{constructor(e={}){const{message:t="Unreachable",url:n=mv.UNKNOWN}=e;super(t,Hi),We(this,"url"),this.url=n}}const Ka="freighter",Mw=r=>{if(r.type!==Hi)return null;if(r instanceof Ks)return{type:Ka,data:"EOF"};if(r instanceof Ci)return{type:Ka,data:"StreamClosed"};if(r instanceof Ws)return{type:Ka,data:"Unreachable"};throw new Error(`Unknown error type: ${r.type}: ${r.message}`)},Lw=r=>{if(r.type!==Ka)return null;switch(r.data){case"EOF":return new Ks;case"StreamClosed":return new Ci;case"Unreachable":return new Ws;default:throw new Error(`Unknown error type: ${r.data}`)}};Eh({encode:Mw,decode:Lw});class Nh{constructor(){We(this,"middleware",[])}use(...e){this.middleware.push(...e)}async executeMiddleware(e,t){let n=0;const s=async a=>{if(n===this.middleware.length)return await t(a);const i=this.middleware[n];return n++,await i(a,s)};return await s(e)}}const Ah="Content-Type",rl=r=>{if(ah.RUNTIME!=="node")return fetch;const e=require("node-fetch");if(r==="http")return e;const t=require("https"),n=new t.Agent({rejectUnauthorized:!1});return async(s,a)=>await e(s,{...a,agent:n})};class Bw extends Nh{constructor(e,t,n=!1){return super(),We(this,"endpoint"),We(this,"encoder"),We(this,"fetch"),this.endpoint=e.replace({protocol:n?"https":"http"}),this.encoder=t,this.fetch=rl(this.endpoint.protocol),new Proxy(this,{get:(s,a,i)=>a==="endpoint"?this.endpoint:Reflect.get(s,a,i)})}get headers(){return{[Ah]:this.encoder.contentType}}async send(e,t,n){let s=null;const a=this.endpoint.child(e),i={};i.method="POST",i.body=this.encoder.encode(t??{});const[,o]=await this.executeMiddleware({target:a.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async c=>{const d={...c,params:{}};i.headers={...this.headers,...c.params};let w;try{w=await rl(c.protocol)(c.target,i)}catch(X){let ee=X;return ee.message==="Load failed"&&(ee=new Ws({url:a})),[d,ee]}const D=await w.arrayBuffer();if(w!=null&&w.ok)return n!=null&&(s=this.encoder.decode(D,n)),[d,null];try{if(w.status!==400)return[d,new Error(w.statusText)];const X=this.encoder.decode(D,ia),ee=Gc(X);return[d,ee]}catch(X){return[d,new Error(`[freighter] - failed to decode error: ${w.statusText}: ${X.message}`)]}});return[s,o]}}const je=async(r,e,t,n)=>{const[s,a]=await r.send(e,t,n);if(a!=null)throw a;return s},Vw=()=>ah.RUNTIME!=="node"?r=>new WebSocket(r):r=>new(require("ws")).WebSocket(r,{rejectUnauthorized:!1}),Fw=_r.object({type:_r.union([_r.literal("data"),_r.literal("close")]),payload:_r.unknown().optional(),error:_r.optional(ia)});class Kw{constructor(e,t,n,s){We(this,"encoder"),We(this,"reqSchema"),We(this,"resSchema"),We(this,"ws"),We(this,"serverClosed"),We(this,"sendClosed"),We(this,"receiveDataQueue",[]),We(this,"receiveCallbacksQueue",[]),this.encoder=t,this.reqSchema=n,this.resSchema=s,this.ws=e,this.sendClosed=!1,this.serverClosed=null,this.listenForMessages()}send(e){if(this.serverClosed!=null)return new Ks;if(this.sendClosed)throw new Ci;return this.ws.send(this.encoder.encode({type:"data",payload:e})),null}async receive(){if(this.serverClosed!=null)return[null,this.serverClosed];const e=await this.receiveMsg();if(e.type==="close"){if(e.error==null)throw new Error("Message error must be defined");return this.serverClosed=Gc(e.error),[null,this.serverClosed]}return[this.resSchema.parse(e.payload),null]}received(){return this.receiveDataQueue.length!==0}closeSend(){if(this.sendClosed||this.serverClosed!=null)return;const e={type:"close"};try{this.ws.send(this.encoder.encode(e))}finally{this.sendClosed=!0}}async receiveMsg(){return this.receiveDataQueue.shift()??await new Promise((t,n)=>this.receiveCallbacksQueue.push({resolve:t,reject:n}))}listenForMessages(){this.ws.onmessage=e=>{const t=this.encoder.decode(e.data,Fw),n=this.receiveCallbacksQueue.shift();n!=null?n.resolve(t):this.receiveDataQueue.push(t)},this.ws.onclose=e=>{this.serverClosed=Gw(e)?new Ks:new Ci}}}const Ww="freighterctx",qw=1e3,Yw=1001,Hw=[qw,Yw],Gw=r=>Hw.includes(r.code),Ch=class Ih extends Nh{constructor(e,t,n=!1){super(),We(this,"baseUrl"),We(this,"encoder"),this.baseUrl=e.replace({protocol:n?"wss":"ws"}),this.encoder=t}async stream(e,t,n){const s=Vw();let a;const[,i]=await this.executeMiddleware({target:e,protocol:"websocket",params:{},role:"client"},async o=>{const c=s(this.buildURL(e,o)),d={...o,params:{}};c.binaryType=Ih.MESSAGE_TYPE;const w=await this.wrapSocket(c,t,n);return w instanceof Error?[d,w]:(a=w,[d,null])});if(i!=null)throw i;return a}buildURL(e,t){const n=pv({[Ah]:this.encoder.contentType,...t.params},Ww);return this.baseUrl.child(e).toString()+n}async wrapSocket(e,t,n){return await new Promise(s=>{e.onopen=()=>{s(new Kw(e,this.encoder,t,n))},e.onerror=a=>{const i=a;s(new Error(i.message))}})}};We(Ch,"MESSAGE_TYPE","arraybuffer");let Jw=Ch;const wr="sy.api.";var Zr=(r=>(r.General=wr+"general",r.Parse=wr+"parse",r.Auth=wr+"auth",r.Unexpected=wr+"unexpected",r.Validation=wr+"validation",r.Query=wr+"query",r.Route=wr+"route",r))(Zr||{});class _n extends aa{constructor(e){super(e,wr)}}class br extends _n{constructor(e){var t=(...n)=>(super(...n),v(this,"fields"),this);typeof e=="string"?(t(e),this.fields=[]):Array.isArray(e)?(t(e.map(n=>`${n.field}: ${n.message}`).join(`
|
|
8
|
+
`)),this.fields=e):(t(`${e.field}: ${e.message}`),this.fields=[e])}}class Xw extends _n{}class Qw extends _n{}class jh extends _n{}class bt extends _n{constructor(e){super(`
|
|
9
|
+
Unexpected error encountered:
|
|
10
|
+
|
|
11
|
+
${e}
|
|
12
|
+
|
|
13
|
+
Please report this to the Synnax team.
|
|
14
|
+
`)}}class qt extends _n{}class e_ extends _n{constructor(e,t){super(e),v(this,"path"),this.path=t}}const t_=r=>{if(!r.type.startsWith(wr))return null;switch(r.type){case Zr.General:return new Xw(r.data);case Zr.Parse:return new Qw(r.data);case Zr.Auth:return new jh(r.data);case Zr.Unexpected:return new bt(r.data);case Zr.Validation:return new br(r.data);case Zr.Query:return new qt(r.data);case Zr.Route:return new e_(r.data,r.data);default:return new bt(r.data)}},r_=()=>{throw new Error("Not implemented")};Eh({encode:r_,decode:t_});const n_=async(r,e)=>{const[t,n]=await e(r);return n==null?[t,n]:n instanceof Ws?[t,new Ws({message:`Cannot reach cluster at ${n.url.host}:${n.url.port}`,url:n.url})]:[t,n]};u.z.object({leaseholder:u.z.number().optional(),keys:u.z.number().array().optional(),names:u.z.string().array().optional(),search:u.z.string().optional(),searchRangeKey:u.z.string().optional(),limit:u.z.number().optional(),offset:u.z.number().optional()});const s_=u.z.object({channels:ta.array()}),Zh=class Rh{constructor(e){v(this,"client"),this.client=e}async search(e,t){return await this.execute({search:e,searchRangeKey:t})}async retrieve(e){const{variant:t,normalized:n}=bn(e);return await this.execute({[t]:n})}async page(e,t){return await this.execute({offset:e,limit:t})}async execute(e){const[t,n]=await this.client.send(Rh.ENDPOINT,e,s_);if(n!=null)throw n;return t.channels}};v(Zh,"ENDPOINT","/channel/retrieve");let zh=Zh;class Ph{constructor(e){v(this,"cache"),v(this,"namesToKeys"),v(this,"wrapped"),this.cache=new Map,this.namesToKeys=new Map,this.wrapped=e}async search(e,t){return await this.wrapped.search(e,t)}async page(e,t){return await this.wrapped.page(e,t)}async retrieve(e){const{normalized:t}=bn(e),n=[],s=[];if(t.forEach(i=>{const o=this.getFromCache(i);o!=null?n.push(o):s.push(i)}),s.length===0)return n;const a=await this.wrapped.retrieve(s);return this.updateCache(a),n.concat(a)}updateCache(e){e.forEach(t=>{this.cache.set(t.key,t),this.namesToKeys.set(t.name,t.key)})}getFromCache(e){const t=typeof e=="number"?e:this.namesToKeys.get(e);if(t!=null)return this.cache.get(t)}}const bn=r=>{const e=Ce(r);if(e.length===0)throw new qt("No channels provided");return{single:!Array.isArray(r),variant:typeof e[0]=="number"?"keys":"names",normalized:e,actual:r}};class $h{constructor({dataType:e,rate:t,name:n,leaseholder:s=0,key:a=0,density:i=0,isIndex:o=!1,index:c=0,frameClient:d}){v(this,"_frameClient"),v(this,"key"),v(this,"name"),v(this,"rate"),v(this,"dataType"),v(this,"leaseholder"),v(this,"index"),v(this,"isIndex"),this.key=a,this.name=n,this.rate=new Ui(t??0),this.dataType=new et(e),this.leaseholder=s,this.index=c,this.isIndex=o,this._frameClient=d??null}get framer(){if(this._frameClient==null)throw new Error("cannot read from a channel that has not been created");return this._frameClient}get payload(){return ta.parse({key:this.key,name:this.name,rate:this.rate.valueOf(),dataType:this.dataType.valueOf(),leaseholder:this.leaseholder,index:this.index,isIndex:this.isIndex})}async read(e){return await this.framer.read(e,this.key)}async write(e,t){return await this.framer.write(this.key,e,t)}}let Dh=class{constructor(e,t,n){v(this,"frameClient"),v(this,"retriever"),v(this,"creator"),this.frameClient=e,this.retriever=t,this.creator=n}async create(e){const t=!Array.isArray(e),n=this.sugar(await this.creator.create(Ce(e)));return t?n[0]:n}async retrieve(e){const{single:t,actual:n,normalized:s}=bn(e);if(s.length===0)return[];const a=this.sugar(await this.retriever.retrieve(e));if(!t)return a;if(a.length===0)throw new qt(`channel matching ${n} not found`);if(a.length>1)throw new qt(`multiple channels matching ${n} found`);return a[0]}async search(e,t){return this.sugar(await this.retriever.search(e,t))}newSearcherUnderRange(e){return new a_(this,e)}async page(e,t){return this.sugar(await this.retriever.page(e,t))}sugar(e){const{frameClient:t}=this;return e.map(n=>new $h({...n,frameClient:t}))}};class a_{constructor(e,t){v(this,"client"),v(this,"rangeKey"),this.client=e,this.rangeKey=t}async search(e){return await this.client.search(e,this.rangeKey)}async page(e,t){return await this.client.page(e,t)}async retrieve(e){return await this.client.retrieve(e)}}const i_=Object.freeze(Object.defineProperty({__proto__:null,CacheRetriever:Ph,Channel:$h,Client:Dh,ClusterRetriever:zh,Creator:yd,analyzeParams:bn,keyZ:ea,newPayload:hd,parseChannels:fd,payload:ta},Symbol.toStringTag,{value:"Module"})),o_=u.z.object({key:u.z.string(),username:u.z.string()}),c_=r=>async(e,t)=>{try{const n=await r();e.params.Authorization=`Bearer ${n}`}catch(n){return[e,n]}return await t(e)};u.z.object({username:u.z.string(),password:u.z.string()});const u_=u.z.object({token:u.z.string(),user:o_}),l_="/auth/login";let d_=class{constructor(e,t){v(this,"token"),v(this,"client"),v(this,"authenticating"),v(this,"authenticated"),v(this,"user"),this.client=e,this.authenticated=!1,this.authenticate(t)}authenticate(e){this.authenticating=new Promise((t,n)=>{this.client.send(l_,e,u_).then(([s,a])=>{if(a!=null)return n(a);this.token=s==null?void 0:s.token,this.user=s==null?void 0:s.user,this.authenticated=!0,t()}).catch(n)})}middleware(){return c_(async()=>{if(this.authenticated||await this.authenticating,this.token==null)throw new jh("[auth] - attempting to authenticate without a token");return this.token})}};const h_=["disconnected","connecting","connected","failed"],f_=u.z.enum(h_),p_=u.z.object({status:f_,error:u.z.instanceof(Error).optional(),message:u.z.string().optional(),clusterKey:u.z.string()}),m_=u.z.object({clusterKey:u.z.string()}),Uh={clusterKey:"",status:"disconnected",error:void 0,message:"Disconnected"},Gi=class Mh{constructor(e,t=$e.seconds(30)){v(this,"_state"),v(this,"pollFrequency",$e.seconds(30)),v(this,"client"),v(this,"interval"),v(this,"onChangeHandlers",[]),this._state={...Uh},this.client=e,this.pollFrequency=t,this.check(),this.startChecking()}stopChecking(){this.interval!=null&&clearInterval(this.interval)}async check(){var e;const t=this._state.status;try{const[n,s]=await this.client.send(Mh.ENDPOINT,null,m_);if(s!=null)throw s;this._state.status="connected",this._state.message=`Connected to cluster ${n.clusterKey}`,this._state.clusterKey=n.clusterKey}catch(n){this._state.status="failed",this._state.error=n,this._state.message=(e=this.state.error)==null?void 0:e.message}return this.onChangeHandlers.length>0&&t!==this._state.status&&this.onChangeHandlers.forEach(n=>n(this.state)),this.state}get state(){return{...this._state}}onChange(e){this.onChangeHandlers.push(e)}startChecking(){this.interval=setInterval(()=>{this.check()},this.pollFrequency.milliseconds)}};v(Gi,"ENDPOINT","/connectivity/check");v(Gi,"DEFAULT",Uh);v(Gi,"connectionStateZ",p_);let Lh=Gi;const nn=class extends Number{};v(nn,"ABSOLUTE",255);v(nn,"DEFAULT",1);v(nn,"z",u.z.union([u.z.instanceof(nn),u.z.number().int().min(0).max(255).transform(r=>new nn(r)),u.z.instanceof(Number).transform(r=>new nn(r))]));let Ln=nn;const nl=r=>{const e=Ce(r);return e.length===0?null:typeof e[0]=="number"?"key":"name"},sl=(r,e)=>{const t=Ce(r);if(t.length===e.length)return;const n=nl(r);throw nl===null?new br("[Frame] - channel keys or names must be provided when constructing a frame."):new br(`[Frame] - ${n}s and arrays must be the same length.
|
|
15
|
+
Got ${t.length} ${n}s and ${e.length} arrays.`)};class gt{constructor(e=[],t=[]){if(v(this,"columns",[]),v(this,"series",[]),e instanceof gt){this.columns=e.columns,this.series=e.series;return}if(e instanceof Map){e.forEach((s,a)=>this.push(a,...Ce(s)));return}if(typeof e=="object"&&!Array.isArray(e)){if("keys"in e&&"series"in e){const s=e,a=s.series.map(i=>Vh(i));sl(s.keys,a),s.keys.forEach((i,o)=>this.push(i,a[o]))}else Object.entries(e).forEach(([s,a])=>this.push(s,...Ce(a)));return}if(Array.isArray(e)||["string","number"].includes(typeof e)){const s=Ce(t),a=Ce(e);sl(a,s),s.forEach((i,o)=>this.push(a[o],i));return}throw new br(`[Frame] - invalid frame construction parameters. data parameter ust be a frame
|
|
16
|
+
payload, a list of lazy arrays, a lazy array, a map, or a record keyed by channel
|
|
17
|
+
name. keys parameter must be a set of channel keys or channel names.`)}get colType(){return this.columns.length===0?null:typeof this.columns[0]=="string"?"name":"key"}get keys(){if(this.colType==="name")throw new bt("colType is not key");return this.columns??[]}get uniqueKeys(){return wu(this.keys)}get names(){if(this.colType==="key")throw new bt("colType is not name");return this.columns??[]}get uniqueNames(){return wu(this.names)}get uniqueColumns(){return this.colType==="key"?this.uniqueKeys:this.uniqueNames}toPayload(){return{series:this.series.map(e=>Fh(e)),keys:this.keys}}get isVertical(){return this.uniqueColumns.length===this.columns.length}get isHorizontal(){return this.uniqueColumns.length===1}get isSquare(){return this.isHorizontal&&this.isVertical}get isWeaklyAligned(){if(this.columns.length<=1)return!0;const e=this.timeRanges;return e.every(t=>t.equals(e[0]))}timeRange(e){if(e==null){if(this.columns.length===0)return At.ZERO;const n=Math.min(...this.series.map(a=>a.timeRange.start.valueOf())),s=Math.max(...this.series.map(a=>a.timeRange.end.valueOf()));return new At(n,s)}const t=this.get(e);return t==null?At.ZERO:new At(t[0].timeRange.start,t[t.length-1].timeRange.end)}get timeRanges(){return this.uniqueColumns.map(e=>this.timeRange(e))}get(e){return Array.isArray(e)?this.filter(t=>e.includes(t)):this.series.filter((t,n)=>this.columns[n]===e)}push(e,...t){if(e instanceof gt){if(this.colType!==null&&e.colType!==this.colType)throw new br("keyVariant must match");this.series.push(...e.series),this.columns.push(...e.columns)}else{if(this.series.push(...t),typeof e=="string"&&this.colType==="key")throw new br("keyVariant must match");if(typeof e!="string"&&this.colType==="name")throw new br("keyVariant must match");this.columns.push(...Array.from({length:t.length},()=>e))}}concat(e){return new gt([...this.columns,...e.columns],[...this.series,...e.series])}has(e){return typeof e=="string"&&this.colType==="key"||typeof e=="number"&&this.colType==="name"?!1:this.columns.includes(e)}map(e){const t=new gt;return this.forEach((n,s,a)=>t.push(...e(n,s,a))),t}forEach(e){this.columns.forEach((t,n)=>{const s=this.series[n];e(t,s,n)})}filter(e){const t=new gt;return this.columns.forEach((n,s)=>{const a=this.series[s];e(n,a,s)&&t.push(n,a)}),t}get byteLength(){return new ai(this.series.reduce((e,t)=>e.add(t.byteLength),ai.ZERO))}get length(){return this.series.reduce((e,t)=>e+t.length,0)}}const Bh=u.z.object({timeRange:At.z.optional(),alignment:u.z.number().optional(),dataType:et.z,data:u.z.string().transform(r=>new Uint8Array(atob(r).split("").map(e=>e.charCodeAt(0))).buffer)}),Ji=u.z.object({keys:u.z.union([u.z.null().transform(()=>[]),u.z.number().array().optional().default([])]),series:u.z.union([u.z.null().transform(()=>[]),Bh.array().optional().default([])])}),Vh=r=>{const{dataType:e,data:t,timeRange:n,alignment:s}=r;return new $t(t,e,n,0,"static",s)},Fh=r=>({timeRange:r._timeRange,dataType:r.dataType,data:new Uint8Array(r.data.buffer),alignment:r.alignment});class Xi{constructor(e){v(this,"adapter"),v(this,"retriever"),v(this,"keys"),this.retriever=e,this.adapter=null,this.keys=[]}static async open(e,t){const n=new Xi(e);return await n.update(t),n}async update(e){const{variant:t,normalized:n}=bn(e);if(t==="keys"){this.adapter=null,this.keys=n;return}const s=await this.retriever.retrieve(n),a=new Map;this.adapter=a,n.forEach(i=>{const o=s.find(c=>c.name===i);if(o==null)throw new Error(`Channel ${i} not found`);a.set(o.key,o.name)}),this.keys=Array.from(this.adapter.keys())}adapt(e){if(this.adapter==null)return e;const t=this.adapter;return e.map((n,s)=>{if(typeof n=="number"){const a=t.get(n);if(a==null)throw new Error(`Channel ${n} not found`);return[a,s]}return[n,s]})}}class Jc{constructor(e){v(this,"adapter"),v(this,"retriever"),v(this,"keys"),this.retriever=e,this.adapter=null,this.keys=[]}static async open(e,t){const n=new Jc(e);return await n.update(t),n}async update(e){const{variant:t,normalized:n}=bn(e);if(t==="keys"){this.adapter=null,this.keys=n;return}const s=await this.retriever.retrieve(n),a=new Map;this.adapter=a,n.forEach(i=>{const o=s.find(c=>c.name===i);if(o==null)throw new Error(`Channel ${i} not found`);a.set(o.name,o.key)}),this.keys=s.map(i=>i.key)}adapt(e){if(this.adapter==null)return e;const t=this.adapter;return e.map((n,s)=>{if(typeof n=="string"){const a=t.get(n);if(a==null)throw new Error(`Channel ${n} not found`);return[a,s]}return[n,s]})}}class Xc{constructor(e,t){v(this,"name"),v(this,"stream"),this.stream=t,this.name=e}async receive(){const[e,t]=await this.stream.receive();if(t!=null)throw t;return e}received(){return this.stream.received()}async closeAndAck(){this.stream.closeSend();const[e,t]=await this.stream.receive();if(e!=null)throw new bt(`${this.name} received unexpected response on closure.
|
|
18
|
+
Please report this error to the Synnax team.`);if(t==null)throw new bt(`${this.name} received unexpected null error on closure.
|
|
19
|
+
Please report this error to Synnax team.
|
|
20
|
+
`);if(!(t instanceof Ks))throw t}closeSend(){this.stream.closeSend()}send(e){const t=this.stream.send(e);if(t!=null)throw t}}const ec=new $e(-1);var Qc=(r=>(r[r.Open=0]="Open",r[r.Next=1]="Next",r[r.Prev=2]="Prev",r[r.SeekFirst=3]="SeekFirst",r[r.SeekLast=4]="SeekLast",r[r.SeekLE=5]="SeekLE",r[r.SeekGE=6]="SeekGE",r[r.Valid=7]="Valid",r[r.Error=8]="Error",r))(Qc||{}),Kh=(r=>(r[r.None=0]="None",r[r.Ack=1]="Ack",r[r.Data=2]="Data",r))(Kh||{});const y_=u.z.object({command:u.z.nativeEnum(Qc),span:$e.z.optional(),bounds:At.z.optional(),stamp:De.z.optional(),keys:u.z.number().array().optional()}),g_=u.z.object({variant:u.z.nativeEnum(Kh),ack:u.z.boolean(),command:u.z.nativeEnum(Qc),error:ia.optional().nullable(),frame:Ji.optional()}),Wh=class tc{constructor(e,t){v(this,"stream"),v(this,"adapter"),v(this,"value"),this.stream=new Xc("Iterator",e),this.value=new gt,this.adapter=t}static async _open(e,t,n,s){const a=await Xi.open(n,t),i=await s.stream(tc.ENDPOINT,y_,g_),o=new tc(i,a);return await o.execute({command:0,keys:a.keys,bounds:e}),o}async next(e=ec){return await this.execute({command:1,span:new $e(e)})}async prev(e=ec){return await this.execute({command:2,span:new $e(e)})}async seekFirst(){return await this.execute({command:3})}async seekLast(){return await this.execute({command:4})}async seekLE(e){return await this.execute({command:5,stamp:new De(e)})}async seekGE(e){return await this.execute({command:6,stamp:new De(e)})}async valid(){return await this.execute({command:7})}async close(){await this.stream.closeAndAck()}[Symbol.asyncIterator](){return new v_(this)}async execute(e){for(this.stream.send(e),this.value=new gt;;){const t=await this.stream.receive();if(t.variant===1)return t.ack;this.value.push(this.adapter.adapt(new gt(t.frame)))}}};v(Wh,"ENDPOINT","/frame/iterate");let qh=Wh;class v_{constructor(e){v(this,"iter"),v(this,"open",!1),this.iter=e}async next(){try{let e=!0;return this.open||(await this.iter.seekFirst()||(e=!1),this.open=!0),await this.iter.next()||(e=!1),e||await this.iter.close(),{done:!e,value:this.iter.value}}catch(e){throw await this.iter.close(),e}}}const w_=u.z.object({start:De.z.optional(),keys:u.z.number().array()}),__=u.z.object({frame:Ji,error:ia.optional().nullable()}),b_="/frame/stream";class Qi{constructor(e,t){v(this,"stream"),v(this,"adapter"),this.stream=new Xc("Streamer",e),this.adapter=t}get keys(){return this.adapter.keys}static async _open(e,t,n,s){const a=await Xi.open(n,t),i=await s.stream(b_,w_,__),o=new Qi(i,a);return i.send({start:new De(e),keys:a.keys}),o}async next(){try{return{done:!1,value:await this.read()}}catch{return{done:!0,value:void 0}}}async read(){return this.adapter.adapt(new gt((await this.stream.receive()).frame))}async update(e){await this.adapter.update(e),this.stream.send({keys:this.adapter.keys})}close(){this.stream.closeSend()}[Symbol.asyncIterator](){return this}}const eu=u.z.object({name:u.z.string(),key:u.z.string()}),k_=u.z.object({subject:eu,resource:u.z.number(),authority:Ln.z}),x_=(...r)=>e=>e.filter(t=>{let n=!1;return t.to!=null&&(n=r.includes(t.to.resource)),t.from!=null&&!n&&(n=r.includes(t.from.resource)),n}),O_=r=>{var e,t;return r.to==null?`${(e=r.from)==null?void 0:e.resource} - ${(t=r.from)==null?void 0:t.subject.name} -> released`:r.from==null?`${r.to.resource} - released -> ${r.to.subject.name} (${r.to.authority.toString()})`:`${r.to.resource} - ${r.from.subject.name} -> ${r.to.subject.name} (${r.to.authority.toString()})`};class tu{constructor(e){v(this,"states"),v(this,"streamer"),v(this,"ecd"),v(this,"observer"),v(this,"closePromise"),this.states=new Map,this.ecd=new dd.JSONEncoderDecoder,this.observer=new oi.Observer,this.streamer=e,this.closePromise=this.stream()}subjects(){const e=new Map;return this.states.forEach(t=>e.set(t.subject.key,t.subject)),Array.from(e.values())}onChange(e){return this.observer.onChange(e)}async close(){this.streamer.close(),await this.closePromise}static async open(e){const t=await e.newStreamer("sy_node_1_control");return new tu(t)}async stream(){for await(const e of this.streamer){const t=this.ecd.decode(e.series[0].buffer);this.merge(t),this.observer.notify(t.transfers)}}merge(e){e.transfers.forEach(t=>{t.from==null&&t.to==null&&console.warn("Invalid transfer: ",t),t.to==null?this.states.delete(t.from.resource):this.states.set(t.to.resource,t.to)})}}var ru=(r=>(r[r.Open=0]="Open",r[r.Write=1]="Write",r[r.Commit=2]="Commit",r[r.Error=3]="Error",r[r.SetAuthority=4]="SetAuthority",r))(ru||{});const T_=u.z.object({start:De.z.optional(),controlSubject:eu.optional(),keys:u.z.number().array(),authorities:Ln.z.array().optional()}),S_=u.z.object({command:u.z.nativeEnum(ru),config:T_.optional(),frame:Ji.optional()}),E_=u.z.object({ack:u.z.boolean(),command:u.z.nativeEnum(ru),error:ia.optional().nullable()});let Yh=(qn=class{constructor(r,e){v(this,"stream"),v(this,"adapter"),this.stream=new Xc("Writer",r),this.adapter=e}static async _open(r,e,{channels:t,authorities:n=Ln.ABSOLUTE,controlSubject:s,start:a}){const i=await Jc.open(r,t),o=await e.stream(qn.ENDPOINT,S_,E_),c=new qn(o,i);return await c.execute({command:0,config:{start:new De(a),keys:i.keys,controlSubject:s,authorities:Ce(n)}}),c}async write(r,e){return["string","number"].includes(typeof r)&&(r=new gt(r,new $t(e))),r=this.adapter.adapt(new gt(r)),this.stream.send({command:1,frame:r.toPayload()}),!0}async setAuthority(r){return(await this.execute({command:4,config:{keys:Object.keys(r).map(t=>Number(t)),authorities:Object.values(r)}})).ack}async commit(){return this.errorAccumulated?!1:(await this.execute({command:2})).ack}async error(){this.stream.send({command:3});const r=await this.execute({command:3});return r.error!=null?Gc(r.error):null}async close(){await this.stream.closeAndAck()}async execute(r){for(this.stream.send(r);;){const e=await this.stream.receive();if(e.command===r.command)return e;console.warn("writer received unexpected response",e)}}get errorAccumulated(){return this.stream.received()}},v(qn,"ENDPOINT","/frame/write"),qn),Hh=class{constructor(e,t){v(this,"stream"),v(this,"retriever"),this.stream=e,this.retriever=t}async newIterator(e,t){return await qh._open(e,t,this.retriever,this.stream)}async newWriter({start:e,channels:t,controlSubject:n,authorities:s=Ln.ABSOLUTE}){return await Yh._open(this.retriever,this.stream,{start:e??De.now(),controlSubject:n,channels:t,authorities:s})}async newStreamer(e,t=De.now()){return await Qi._open(t,e,this.retriever,this.stream)}async write(e,t,n){const s=await this.newWriter({start:t,channels:e});try{if(await s.write(e,n),!await s.commit())throw await s.error()}catch{await s.close()}}async read(e,t){const{single:n}=bn(t),s=await this.readFrame(e,t);return n?s.series[0]:s}async readFrame(e,t){const n=await this.newIterator(e,t),s=new gt;for await(const a of n)s.push(a);return s}};const N_=Object.freeze(Object.defineProperty({__proto__:null,AUTO_SPAN:ec,Client:Hh,Frame:gt,Iterator:qh,Streamer:Qi,Writer:Yh,frameZ:Ji,series:Bh,seriesFromPayload:Vh,seriesToPayload:Fh},Symbol.toStringTag,{value:"Module"}));class A_{constructor(e,t){v(this,"key"),v(this,"name"),this.key=t,this.name=e}get ontologyID(){return new xt({type:"group",key:this.key})}}const C_=u.z.string().uuid(),I_=u.z.object({key:C_,name:u.z.string()}),j_=u.z.object({group:I_});let Z_=(Cr=class{constructor(r){v(this,"client"),this.client=r}async create(r,e){const t={parent:r,name:e},[n,s]=await this.client.send(Cr.ENDPOINT,t,j_);if(s!=null)throw s;return n.group}async rename(r,e){const t={key:r,name:e},[,n]=await this.client.send(Cr.ENDPOINT_RENAME,t,u.z.object({}));if(n!=null)throw n}async delete(r){const e={keys:r},[,t]=await this.client.send(Cr.ENDPOINT_DELETE,e,u.z.object({}));if(t!=null)throw t}},v(Cr,"ENDPOINT","/ontology/create-group"),v(Cr,"ENDPOINT_RENAME","/ontology/rename-group"),v(Cr,"ENDPOINT_DELETE","/ontology/delete-group"),Cr),R_=class{constructor(e){v(this,"creator"),this.creator=new Z_(e)}async create(e,t){return this.sugar(await this.creator.create(e,t))}async rename(e,t){return await this.creator.rename(e,t)}async delete(...e){return await this.creator.delete(e)}sugar(e){return new A_(e.name,e.key)}};const Gh=u.z.union([u.z.literal("label"),u.z.literal("builtin"),u.z.literal("cluster"),u.z.literal("channel"),u.z.literal("node"),u.z.literal("group"),u.z.literal("range"),u.z.literal("range-alias"),u.z.literal("user"),u.z.literal("workspace"),u.z.literal("pid"),u.z.literal("lineplot")]),eo=u.z.object({type:Gh,key:u.z.string()}),z_=u.z.string().transform(r=>{const[e,t]=r.split(":");return{type:e,key:t}}),P_=u.z.union([z_,eo]),Wa=class Jh{constructor(e){if(v(this,"type"),v(this,"key"),e instanceof Jh)this.type=e.type,this.key=e.key;else if(typeof e=="string"){const[t,n]=e.split(":");this.type=t,this.key=n}else this.type=e.type,this.key=e.key}toString(){return`${this.type}:${this.key}`}get payload(){return{type:this.type,key:this.key}}};v(Wa,"z",u.z.union([P_,u.z.instanceof(Wa)]).transform(r=>new Wa(r)));let xt=Wa;new xt({type:"builtin",key:"root"});const $_=u.z.object({type:u.z.number()}),D_=u.z.object({type:Gh,fields:u.z.record($_)}),U_=u.z.object({id:xt.z,name:u.z.string(),schema:D_.optional(),data:u.z.record(u.z.unknown()).optional()}).transform(r=>({key:r.id.toString(),...r}));u.z.object({from:xt.z,type:u.z.string(),to:xt.z});const al=r=>{const[e,t,n]=r.split("->");return{from:new xt(e),type:t,to:new xt(n)}};u.z.object({ids:eo.array().optional(),children:u.z.boolean().optional(),parents:u.z.boolean().optional(),includeSchema:u.z.boolean().optional(),includeFieldData:u.z.boolean().optional(),term:u.z.string().optional()});const M_=u.z.object({resources:U_.array()});let L_=(la=class{constructor(r){v(this,"client"),this.client=r}async search(r){return await this.execute({term:r})}async retrieve(r,e=!0,t=!0){return await this.execute({ids:Ce(r).map(n=>new xt(n).payload),includeFieldData:t,includeSchema:e})}async retrieveChildren(r,e=!0,t=!0){return await this.execute({ids:Ce(r).map(n=>new xt(n).payload),children:!0,includeSchema:e,includeFieldData:t})}async retrieveParents(r,e=!0,t=!0){return await this.execute({ids:Ce(r).map(n=>new xt(n).payload),parents:!0,includeSchema:e,includeFieldData:t})}async execute(r){const[e,t]=await this.client.send(la.ENDPOINT,r,M_);if(t!=null)throw t;return e.resources}},v(la,"ENDPOINT","/ontology/retrieve"),la);const bo={ADD_CHILDREN:"/ontology/add-children",REMOVE_CHILDREN:"/ontology/remove-children",MOVE_CHILDREN:"/ontology/move-children"};let B_=class{constructor(e){v(this,"client"),this.client=e}async addChildren(e,...t){const n={id:e,children:t},[,s]=await this.client.send(bo.ADD_CHILDREN,n,u.z.object({}));if(s!=null)throw s}async removeChildren(e,...t){const n={id:e,children:t},[,s]=await this.client.send(bo.REMOVE_CHILDREN,n,u.z.object({}));if(s!=null)throw s}async moveChildren(e,t,...n){const s={from:e,to:t,children:n},[,a]=await this.client.send(bo.MOVE_CHILDREN,s,u.z.object({}));if(a!=null)throw a}};const il="sy_ontology_resource_set",ol="sy_ontology_resource_delete",cl="sy_ontology_relationship_set",ul="sy_ontology_relationship_delete";class nu{constructor(e,t){v(this,"resourceObs"),v(this,"relationshipObs"),v(this,"relationships"),v(this,"resources"),v(this,"streamer"),v(this,"retriever"),v(this,"closePromise"),this.relationshipObs=new oi.Observer,this.relationships=this.relationshipObs,this.resourceObs=new oi.Observer,this.resources=this.resourceObs,this.retriever=t,this.streamer=e,this.closePromise=this.start()}async close(){this.streamer.close(),await this.closePromise}async start(){for await(const e of this.streamer)await this.update(e)}async update(e){const t=await this.parseResourceSets(e),n=this.parseResourceDeletes(e);t.concat(n).length>0&&this.resourceObs.notify(t.concat(n));const a=this.parseRelationshipSets(e),i=this.parseRelationshipDeletes(e);a.concat(i).length>0&&this.relationshipObs.notify(a.concat(i))}parseRelationshipSets(e){const t=e.get(cl);return t.length===0?[]:t[0].toStrings().map(n=>({variant:"set",key:al(n),value:void 0}))}parseRelationshipDeletes(e){const t=e.get(ul);return t.length===0?[]:t[0].toStrings().map(n=>({variant:"delete",key:al(n)}))}async parseResourceSets(e){const t=e.get(il);if(t.length===0)return[];const n=t[0].toStrings().map(s=>new xt(s));try{return(await this.retriever.retrieve(n)).map(a=>({variant:"set",key:a.id,value:a}))}catch(s){if(s instanceof qt)return console.warn(s),[];throw s}}parseResourceDeletes(e){const t=e.get(ol);return t.length===0?[]:t[0].toStrings().map(n=>({variant:"delete",key:new xt(n)}))}static async open(e,t){const n=await e.newStreamer([il,ol,cl,ul]);return new nu(n,t)}}let V_=class{constructor(e,t){v(this,"groups"),v(this,"retriever"),v(this,"writer"),v(this,"framer"),this.retriever=new L_(e),this.writer=new B_(e),this.groups=new R_(e),this.framer=t}async search(e){return await this.retriever.search(e)}async retrieve(e,t,n){const s=await this.retriever.retrieve(e,t,n);if(Array.isArray(e))return s;if(s.length===0)throw new qt(`No resource found with ID ${e.toString()}`);return s[0]}async page(e,t){return[]}async retrieveChildren(e,t,n){return await this.retriever.retrieveChildren(e,t,n)}async retrieveParents(e,t,n){return await this.retriever.retrieveParents(e,t,n)}async addChildren(e,...t){return await this.writer.addChildren(e,...t)}async removeChildren(e,...t){return await this.writer.removeChildren(e,...t)}async moveChildren(e,t,...n){return await this.writer.moveChildren(e,t,...n)}async openChangeTracker(){return await nu.open(this.framer,this.retriever)}};const oa=u.z.string().uuid(),to=u.z.object({key:oa,name:u.z.string().min(1),color:u.z.string()});u.z.object({keys:oa.array().optional(),for:eo.optional(),search:u.z.string().optional(),offset:u.z.number().optional(),limit:u.z.number().optional()});const F_=u.z.object({labels:to.array().optional().default([])});let K_=(da=class{constructor(r){v(this,"client"),this.client=r}async retrieve(r){const e=Ce(r);return await this.execute({keys:e})}async retrieveFor(r){return await this.execute({for:r})}async search(r){return await this.execute({search:r})}async page(r,e){return await this.execute({offset:r,limit:e})}async execute(r){const[e,t]=await this.client.send(da.ENDPOINT,r,F_);if(t!=null)throw t;return e.labels}},v(da,"ENDPOINT","/label/retrieve"),da);const W_=to.extend({key:oa.optional()});u.z.object({labels:W_.array()});const q_=u.z.object({labels:to.array()});u.z.object({keys:oa.array()});u.z.object({id:eo,labels:oa.array()});const ko=u.z.object({}),ll="/label/create",Y_="/label/delete",H_="/label/set";let G_=class{constructor(e){v(this,"client"),this.client=e}async create(e){return(await je(this.client,ll,{labels:Ce(e)},q_)).labels}async delete(e){await je(this.client,Y_,{keys:Ce(e)},ko)}async set(e,t){await je(this.client,H_,{id:e,labels:t},ko)}async remove(e,t){await je(this.client,ll,{id:e,labels:t},ko)}};class ro{constructor(e,t,n,s){v(this,"streamer"),v(this,"decoder"),v(this,"base"),v(this,"closePromise"),v(this,"deleteChannel"),v(this,"setChannel"),this.streamer=e,this.decoder=t,this.base=new oi.Observer,this.closePromise=this.stream(),this.deleteChannel=s,this.setChannel=n}onChange(e){return this.base.onChange(e)}async close(){return this.streamer.close(),await this.closePromise}async stream(){for await(const e of this.streamer){const t=[];if(this.deleteChannel!=null){const n=e.get(this.deleteChannel);t.push(...n.flatMap(s=>this.decoder("delete",s)))}if(this.setChannel!=null){const n=e.get(this.setChannel);t.push(...n.flatMap(s=>this.decoder("set",s)))}this.base.notify(t)}}static async open(e,t,n,s){const a=await e.newStreamer([t,n]);return new ro(a,s,t,n)}}const J_="sy_label_set",X_="sy_label_delete";let Q_=class{constructor(e,t){v(this,"retriever"),v(this,"writer"),v(this,"frameClient"),this.writer=new G_(e),this.retriever=new K_(e),this.frameClient=t}async search(e){return await this.retriever.search(e)}async retrieve(e){const t=Array.isArray(e),n=await this.retriever.retrieve(e);return t?n:n[0]}async retrieveFor(e){return await this.retriever.retrieveFor(e)}async label(e,t){await this.writer.set(e,t)}async removeLabels(e,t){await this.writer.remove(e,t)}async page(e,t){return await this.retriever.page(e,t)}async create(e){const t=Array.isArray(e),n=await this.writer.create(e);return t?n:n[0]}async delete(e){await this.writer.delete(e)}async openChangeTracker(){return await ro.open(this.frameClient,J_,X_,eb)}};const eb=(r,e)=>r==="delete"?e.toUUIDs().map(t=>({variant:r,key:t})):e.parseJSON(to).map(t=>({variant:r,key:t.key,value:t})),Ot=u.z.string().uuid(),no=u.z.object({key:Ot,name:u.z.string().min(1),timeRange:At.z}),tb=no.extend({key:u.z.string().uuid().optional()}),Xh=r=>{const e=Ce(r);if(e.length===0)throw new Error("Range params must not be empty");const t=Ot.safeParse(e[0]).success;return{single:!Array.isArray(r),variant:t?"keys":"names",normalized:e,actual:r}},rb=u.z.object({}),nb=u.z.object({range:no}),sb=u.z.object({}),ab="/range/set-active",ib="/range/retrieve-active",ob="/range/clear-active";class cb{constructor(e){v(this,"client"),this.client=e}async setActive(e){const[,t]=await this.client.send(ab,{range:e},rb);if(t!=null)throw t}async retrieveActive(){const[e,t]=await this.client.send(ib,{},nb);if(t instanceof qt)return null;if(t!=null)throw t;return e.range}async clearActive(e){const[,t]=await this.client.send(ob,{range:e},sb);if(t!=null)throw t}}const ub="sy_range_alias_set",lb="sy_range_alias_delete";u.z.object({range:Ot,aliases:u.z.string().array()});const db=u.z.object({aliases:u.z.record(u.z.string(),ea)});u.z.object({range:Ot,aliases:u.z.record(ea,u.z.string())});u.z.unknown();u.z.object({range:Ot,channels:ea.array()});const hb=u.z.unknown();u.z.object({range:Ot});const fb=u.z.object({aliases:u.z.record(u.z.string(),u.z.string())}),ca=class ns{constructor(e,t,n){v(this,"frameClient"),v(this,"cache",new Map),v(this,"client"),v(this,"rangeKey"),this.rangeKey=e,this.cache=new Map,this.client=n,this.frameClient=t}async resolve(e){const t=[],n=typeof e=="string",s={};if(n){const i=this.cache.get(e);if(i!=null)return i;t.push(e)}else e.forEach(i=>{const o=this.cache.get(i);o!=null?s[i]=o:t.push(i)});if(t.length===0)return s;const a=await je(this.client,ns.RESOLVE_ENDPOINT,{range:this.rangeKey,aliases:t},db);return Object.entries(a.aliases).forEach(([i,o])=>this.cache.set(i,o)),n?a.aliases[t[0]]:{...s,...a.aliases}}async set(e){await je(this.client,ns.SET_ENDPOINT,{range:this.rangeKey,aliases:e},u.z.unknown())}async list(){return(await je(this.client,ns.LIST_ENDPOINT,{range:this.rangeKey},fb)).aliases}async delete(e){await je(this.client,ns.DELETE_ENDPOINT,{range:this.rangeKey,channels:e},hb)}async openChangeTracker(){return await ro.open(this.frameClient,ub,lb,gb(this.rangeKey))}};v(ca,"SET_ENDPOINT","/range/alias/set");v(ca,"RESOLVE_ENDPOINT","/range/alias/resolve");v(ca,"LIST_ENDPOINT","/range/alias/list");v(ca,"DELETE_ENDPOINT","/range/alias/delete");let pb=ca;const mb=u.z.object({range:Ot,channel:ea,alias:u.z.string()}),yb="---",gb=r=>(e,t)=>e==="delete"?t.toStrings().filter(n=>n.split(yb)[0]===r).map(n=>({variant:e,key:n,value:void 0})):t.parseJSON(mb).map(n=>({variant:e,key:n.alias,value:n}));u.z.object({range:Ot,keys:u.z.string().array()});const vb=u.z.object({pairs:u.z.record(u.z.string(),u.z.string())});u.z.object({range:Ot,pairs:u.z.record(u.z.string(),u.z.string())});u.z.object({range:Ot,keys:u.z.string().array()});const so=class qa{constructor(e,t){v(this,"rangeKey"),v(this,"client"),this.rangeKey=e,this.client=t}async get(e){const[t,n]=await this.client.send(qa.GET_ENDPOINT,{range:this.rangeKey,keys:Ce(e)},vb);if(n!=null)throw n;return Array.isArray(e)?t.pairs:t.pairs[e]}async set(e,t){await je(this.client,qa.SET_ENDPOINT,{range:this.rangeKey,pairs:Im(e)?e:{[e]:t}},u.z.unknown())}async delete(e){await je(this.client,qa.DELETE_ENDPOINT,{range:this.rangeKey,keys:Ce(e)},u.z.unknown())}};v(so,"GET_ENDPOINT","/range/kv/get");v(so,"SET_ENDPOINT","/range/kv/set");v(so,"DELETE_ENDPOINT","/range/kv/delete");let wb=so;const xo=r=>new xt({type:"range",key:r});class _b{constructor(e,t=At.ZERO,n,s,a,i,o,c){v(this,"key"),v(this,"name"),v(this,"kv"),v(this,"timeRange"),v(this,"channels"),v(this,"aliaser"),v(this,"frameClient"),v(this,"labelClient"),this.key=n,this.name=e,this.timeRange=t,this.frameClient=s,this.kv=a,this.aliaser=i,this.channels=o,this.labelClient=c}async setAlias(e,t){const n=await this.channels.retrieve(e);if(n.length===0)throw new qt(`Channel ${e} does not exist`);await this.aliaser.set({[n[0].key]:t})}async deleteAlias(...e){await this.aliaser.delete(e)}async listAliases(){return await this.aliaser.list()}async openAliasTracker(){return await this.aliaser.openChangeTracker()}async read(e){return await this.frameClient.read(this.timeRange,e)}async labels(){return await this.labelClient.retrieveFor(xo(this.key))}async addLabel(...e){await this.labelClient.label(xo(this.key),e)}async removeLabel(...e){await this.labelClient.removeLabels(xo(this.key),e)}}let bb=class{constructor(e,t,n,s,a,i){v(this,"frameClient"),v(this,"retriever"),v(this,"writer"),v(this,"unaryClient"),v(this,"channels"),v(this,"active"),v(this,"labelClient"),this.frameClient=e,this.retriever=t,this.writer=n,this.unaryClient=s,this.channels=a,this.active=new cb(s),this.labelClient=i}async create(e){const t=!Array.isArray(e),n=this.sugar(await this.writer.create(Ce(e)));return t?n[0]:n}async rename(e,t){await this.writer.rename(e,t)}async delete(e){await this.writer.delete(Ce(e))}async search(e){return this.sugar(await this.retriever.search(e))}async page(e,t){return[]}async retrieve(e){const{single:t,actual:n}=Xh(e),s=this.sugar(await this.retriever.retrieve(e));if(!t)return s;if(s.length===0)throw new qt(`range matching ${n} not found`);if(s.length>1)throw new qt(`multiple ranges matching ${n} found`);return s[0]}async setActive(e){await this.active.setActive(e)}async retrieveActive(){const e=await this.active.retrieveActive();return e==null?null:this.sugar([e])[0]}async clearActive(e){await this.active.clearActive(e)}sugar(e){return e.map(t=>new _b(t.name,t.timeRange,t.key,this.frameClient,new wb(t.key,this.unaryClient),new pb(t.key,this.frameClient,this.unaryClient),this.channels,this.labelClient))}};const kb=u.z.object({ranges:no.array()});u.z.object({ranges:tb.array()});u.z.object({keys:Ot.array()});const xb=u.z.object({});u.z.object({key:Ot,name:u.z.string()});const Ob=u.z.object({}),Tb="/range/create",Sb="/range/delete",Eb="/range/rename";let Nb=class{constructor(e){v(this,"client"),this.client=e}async rename(e,t){await je(this.client,Eb,{key:e,name:t},Ob)}async create(e){return(await je(this.client,Tb,{ranges:e},kb)).ranges}async delete(e){await je(this.client,Sb,{keys:e},xb)}};u.z.object({keys:Ot.array().optional(),names:u.z.array(u.z.string()).optional(),term:u.z.string().optional()});const Ab=u.z.object({ranges:u.z.array(no)});let Cb=class{constructor(e){v(this,"ENDPOINT","/range/retrieve"),v(this,"client"),this.client=e}async retrieve(e){const{normalized:t,variant:n}=Xh(e);return await this.execute({[n]:t})}async search(e){return await this.execute({term:e})}async execute(e){const[t,n]=await this.client.send(this.ENDPOINT,e,Ab);if(n!=null)throw n;return t.ranges}};const Ib="/api/v1/";class jb{constructor(e,t=!1){v(this,"url"),v(this,"unary"),v(this,"stream"),v(this,"secure"),this.secure=t,this.url=e.child(Ib);const n=new dd.JSONEncoderDecoder;this.unary=new Bw(this.url,n,this.secure),this.stream=new Jw(this.url,n,this.secure)}use(...e){this.unary.use(...e),this.stream.use(...e)}}const kn=u.z.string().uuid(),Qh=u.z.object({name:u.z.string(),key:kn,layout:Tc}),su=Qh.omit({layout:!0}).extend({layout:u.z.string().transform(r=>JSON.parse(r))}),au=u.z.string().uuid(),Zb=u.z.object({key:u.z.string(),name:u.z.string(),data:Tc}),iu=u.z.object({key:u.z.string(),name:u.z.string(),data:u.z.string().transform(r=>JSON.parse(r))});u.z.object({keys:u.z.string().array()});const Rb=u.z.object({linePlots:iu.array()});let zb=class{constructor(e){v(this,"ENDPOINT","/workspace/lineplot/retrieve"),v(this,"client"),this.client=e}async retrieve(e){const t=Ce(e);return await this.execute({keys:t})}async execute(e){const[t,n]=await this.client.send(this.ENDPOINT,e,Rb);if(n!=null)throw n;return t.linePlots}};Zb.partial({key:!0});const Pb=iu.partial({key:!0});u.z.object({workspace:kn,linePlots:Pb.array()});const $b=u.z.object({linePlots:iu.array()});u.z.object({keys:au.array()});const Db=u.z.object({});u.z.object({key:au,name:u.z.string()});const dl=u.z.object({});u.z.object({key:au,data:u.z.string()});u.z.object({});const Ub="/workspace/lineplot/create",Mb="/workspace/lineplot/delete",Lb="/workspace/lineplot/rename",Bb="/workspace/lineplot/set-data";let Vb=class{constructor(e){v(this,"client"),this.client=e}async create(e,t){const n={...t,data:JSON.stringify(t.data)};return(await je(this.client,Ub,{workspace:e,linePlots:[n]},$b)).linePlots[0]}async delete(e){const t=Ce(e);await je(this.client,Mb,{keys:t},Db)}async rename(e,t){await je(this.client,Lb,{key:e,name:t},dl)}async setData(e,t){await je(this.client,Bb,{key:e,data:JSON.stringify(t)},dl)}},Fb=class{constructor(e){v(this,"writer"),v(this,"retriever"),this.writer=new Vb(e),this.retriever=new zb(e)}async create(e,t){return await this.writer.create(e,t)}async rename(e,t){await this.writer.rename(e,t)}async setData(e,t){await this.writer.setData(e,t)}async retrieve(e){const t=Array.isArray(e),n=await this.retriever.retrieve(e);return t?n:n[0]}async delete(e){await this.writer.delete(e)}};const ao=u.z.string().uuid(),Kb=u.z.object({key:u.z.string(),name:u.z.string(),data:Tc,snapshot:u.z.boolean()}),io=u.z.object({key:u.z.string(),name:u.z.string(),snapshot:u.z.boolean(),data:u.z.string().transform(r=>JSON.parse(r))});u.z.object({keys:u.z.string().array()});const Wb=u.z.object({pids:io.array()});let qb=class{constructor(e){v(this,"ENDPOINT","/workspace/pid/retrieve"),v(this,"client"),this.client=e}async retrieve(e){const t=Ce(e);return await this.execute({keys:t})}async execute(e){const[t,n]=await this.client.send(this.ENDPOINT,e,Wb);if(n!=null)throw n;return t.pids}};Kb.partial({key:!0});const Yb=io.partial({key:!0,snapshot:!0});u.z.object({workspace:kn,pids:Yb.array()});const Hb=u.z.object({pids:io.array()});u.z.object({keys:ao.array()});const Gb=u.z.object({});u.z.object({key:ao,name:u.z.string()});const hl=u.z.object({});u.z.object({key:ao,data:u.z.string()});u.z.object({});u.z.object({key:ao,name:u.z.string(),snapshot:u.z.boolean()});const Jb=u.z.object({pid:io}),Xb="/workspace/pid/create",Qb="/workspace/pid/delete",e0="/workspace/pid/rename",t0="/workspace/pid/set-data",r0="/workspace/pid/copy";let n0=class{constructor(e){v(this,"client"),this.client=e}async create(e,t){const n={...t,data:JSON.stringify(t.data)};return(await je(this.client,Xb,{workspace:e,pids:[n]},Hb)).pids[0]}async copy(e,t,n){return(await je(this.client,r0,{key:e,name:t,snapshot:n},Jb)).pid}async delete(e){const t=Ce(e);await je(this.client,Qb,{keys:t},Gb)}async rename(e,t){await je(this.client,e0,{key:e,name:t},hl)}async setData(e,t){await je(this.client,t0,{key:e,data:JSON.stringify(t)},hl)}},s0=class{constructor(e){v(this,"writer"),v(this,"retriever"),this.writer=new n0(e),this.retriever=new qb(e)}async create(e,t){return await this.writer.create(e,t)}async rename(e,t){await this.writer.rename(e,t)}async setData(e,t){await this.writer.setData(e,t)}async retrieve(e){const t=Array.isArray(e),n=await this.retriever.retrieve(e);return t?n:n[0]}async delete(e){await this.writer.delete(e)}async copy(e,t,n){return await this.writer.copy(e,t,n)}};u.z.object({keys:kn.array().optional(),search:u.z.string().optional(),author:u.z.string().uuid().optional(),offset:u.z.number().optional(),limit:u.z.number().optional()});const a0=u.z.object({workspaces:su.array()}),ef=class tf{constructor(e){v(this,"client"),this.client=e}async retrieve(e){const t=Ce(e);return await this.execute({keys:t})}async retrieveByAuthor(e){return await this.execute({author:e})}async search(e){return await this.execute({search:e})}async page(e,t){return await this.execute({offset:e,limit:t})}async execute(e){const[t,n]=await this.client.send(tf.ENDPOINT,e,a0);if(n!=null)throw n;return t.workspaces}};v(ef,"ENDPOINT","/workspace/retrieve");let i0=ef;Qh.partial({key:!0});const o0=su.partial({key:!0});u.z.object({workspaces:o0.partial({key:!0}).array()});const c0=u.z.object({workspaces:su.array()});u.z.object({keys:kn.array()});const u0=u.z.object({});u.z.object({key:kn,name:u.z.string()});const l0=u.z.object({});u.z.object({key:kn,layout:u.z.string()});const d0=u.z.object({}),h0="/workspace/create",f0="/workspace/delete",p0="/workspace/rename",m0="/workspace/set-layout";class y0{constructor(e){v(this,"client"),this.client=e}async create(e){const t=Ce(e).map(s=>({...s,layout:JSON.stringify(s.layout)}));return(await je(this.client,h0,{workspaces:t},c0)).workspaces}async delete(e){await je(this.client,f0,{keys:Ce(e)},u0)}async rename(e,t){await je(this.client,p0,{key:e,name:t},l0)}async setLayout(e,t){await je(this.client,m0,{key:e,layout:JSON.stringify(t)},d0)}}class g0{constructor(e){v(this,"pid"),v(this,"linePlot"),v(this,"retriever"),v(this,"writer"),this.pid=new s0(e),this.linePlot=new Fb(e),this.retriever=new i0(e),this.writer=new y0(e)}async search(e){return await this.retriever.search(e)}async retrieveByAuthor(e){return await this.retriever.retrieveByAuthor(e)}async retrieve(e){const t=Array.isArray(e),n=await this.retriever.retrieve(e);return t?n:n[0]}async page(e,t){return await this.retriever.page(e,t)}async create(e){const t=Array.isArray(e),n=await this.writer.create(e);return t?n:n[0]}async rename(e,t){await this.writer.rename(e,t)}async setLayout(e,t){await this.writer.setLayout(e,t)}async delete(...e){await this.writer.delete(e)}}const rf=u.z.object({host:u.z.string().min(1),port:u.z.number().or(u.z.string()),username:u.z.string().optional(),password:u.z.string().optional(),connectivityPollFrequency:$e.z.default($e.seconds(30)),secure:u.z.boolean().optional().default(!1)});class nf{constructor(e){v(this,"transport"),v(this,"createdAt"),v(this,"telem"),v(this,"ranges"),v(this,"channels"),v(this,"auth"),v(this,"connectivity"),v(this,"ontology"),v(this,"props"),v(this,"workspaces"),v(this,"labels"),this.createdAt=De.now(),this.props=rf.parse(e);const{host:t,port:n,username:s,password:a,connectivityPollFrequency:i,secure:o}=this.props;this.transport=new jb(new Pm({host:t,port:Number(n)}),o),this.transport.use(n_),s!=null&&a!=null&&(this.auth=new d_(this.transport.unary,{username:s,password:a}),this.transport.use(this.auth.middleware()));const c=new Ph(new zh(this.transport.unary)),d=new yd(this.transport.unary);this.telem=new Hh(this.transport.stream,c),this.channels=new Dh(this.telem,c,d),this.connectivity=new Lh(this.transport.unary,i),this.ontology=new V_(this.transport.unary,this.telem);const w=new Cb(this.transport.unary),D=new Nb(this.transport.unary);this.labels=new Q_(this.transport.unary,this.telem),this.ranges=new bb(this.telem,w,D,this.transport.unary,c,this.labels),this.workspaces=new g0(this.transport.unary)}close(){this.connectivity.stopChecking()}}v(nf,"connectivity",Lh);const v0=Object.freeze(Object.defineProperty({__proto__:null,Authority:Ln,StateTracker:tu,filterTransfersByChannelKey:x_,stateZ:k_,subjectZ:eu,transferString:O_},Symbol.toStringTag,{value:"Module"}));let w0=(r=21)=>crypto.getRandomValues(new Uint8Array(r)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");const rc=(r,e,t="")=>{try{return r.parse(e)}catch(n){if(n instanceof u.z.ZodError){const s=n.errors.map(a=>a.path.length===0?a.message:`${a.path.join(".")}: ${a.message}`);throw new Error(`${t} - ${s.join(`
|
|
21
|
+
`)}`)}else throw n}};var _0=Object.defineProperty,b0=(r,e,t)=>e in r?_0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,qe=(r,e,t)=>(b0(r,typeof e!="symbol"?e+"":e,t),t);const nc=class sf{constructor(e,t,n="",s=!1){qe(this,"_noop",!1),qe(this,"key"),qe(this,"path"),qe(this,"serviceName"),this.key=e,this.path=t,this.serviceName=n,this._noop=s}child(e){return new sf(e,this.extendPath(e),this.serviceName)}extendPath(e){return`${this.path}.${e}`}get noop(){return this._noop}};qe(nc,"NOOP",new nc("","",""));let ou=nc;const sc=["debug","info","warn","error"],k0=r=>{const e=sc.indexOf(r);return({level:t})=>sc.indexOf(t)>=e},x0=r=>{const{include:e,exclude:t}=r;return({key:n})=>!(e!=null&&!e.includes(n)||t!=null&&t.includes(n))},ac=class af{constructor(e={}){qe(this,"meta",ou.NOOP),qe(this,"filters");const{filters:t=[]}=e;this.filters=t}filter(e){return!this.meta.noop&&this.filters.every(t=>t({key:this.meta.key,path:this.meta.path,level:e}))}child(e){const t=new af({filters:this.filters});return t.meta=e,t}debug(e,t){this.filter("debug")&&(t==null?console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e):console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e,t))}info(e,t){this.filter("info")&&(t==null?console.log("%cINFO","color: #005eff;",this.meta.path,e):console.log("%cINFO","color: #005eff;",this.meta.path,e,t))}warn(e,t){this.filter("warn")&&(t==null?console.warn("WARN",this.meta.path,e):console.warn("WARN",this.meta.path,e,t))}error(e,t){this.filter("error")&&(t==null?console.error("ERROR",this.meta.path,e):console.error("ERROR",this.meta.path,e,t))}};qe(ac,"NOOP",new ac);let of=ac;var O0=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},sn="1.6.0",fl=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function T0(r){var e=new Set([r]),t=new Set,n=r.match(fl);if(!n)return function(){return!1};var s={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(s.prerelease!=null)return function(o){return o===r};function a(o){return t.add(o),!1}function i(o){return e.add(o),!0}return function(o){if(e.has(o))return!0;if(t.has(o))return!1;var c=o.match(fl);if(!c)return a(o);var d={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return d.prerelease!=null||s.major!==d.major?a(o):s.major===0?s.minor===d.minor&&s.patch<=d.patch?i(o):a(o):s.minor<=d.minor?i(o):a(o)}}var S0=T0(sn),E0=sn.split(".")[0],qs=Symbol.for("opentelemetry.js.api."+E0),Ys=O0;function cu(r,e,t,n){var s;n===void 0&&(n=!1);var a=Ys[qs]=(s=Ys[qs])!==null&&s!==void 0?s:{version:sn};if(!n&&a[r]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+r);return t.error(i.stack||i.message),!1}if(a.version!==sn){var i=new Error("@opentelemetry/api: Registration of version v"+a.version+" for "+r+" does not match previously registered API v"+sn);return t.error(i.stack||i.message),!1}return a[r]=e,t.debug("@opentelemetry/api: Registered a global for "+r+" v"+sn+"."),!0}function Hs(r){var e,t,n=(e=Ys[qs])===null||e===void 0?void 0:e.version;if(!(!n||!S0(n)))return(t=Ys[qs])===null||t===void 0?void 0:t[r]}function uu(r,e){e.debug("@opentelemetry/api: Unregistering a global for "+r+" v"+sn+".");var t=Ys[qs];t&&delete t[r]}var N0=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),s,a=[],i;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(o){i={error:o}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},A0=function(r,e,t){if(t||arguments.length===2)for(var n=0,s=e.length,a;n<s;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},C0=function(){function r(e){this._namespace=e.namespace||"DiagComponentLogger"}return r.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Gn("debug",this._namespace,e)},r.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Gn("error",this._namespace,e)},r.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Gn("info",this._namespace,e)},r.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Gn("warn",this._namespace,e)},r.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Gn("verbose",this._namespace,e)},r}();function Gn(r,e,t){var n=Hs("diag");if(n)return t.unshift(e),n[r].apply(n,A0([],N0(t),!1))}var _t;(function(r){r[r.NONE=0]="NONE",r[r.ERROR=30]="ERROR",r[r.WARN=50]="WARN",r[r.INFO=60]="INFO",r[r.DEBUG=70]="DEBUG",r[r.VERBOSE=80]="VERBOSE",r[r.ALL=9999]="ALL"})(_t||(_t={}));function I0(r,e){r<_t.NONE?r=_t.NONE:r>_t.ALL&&(r=_t.ALL),e=e||{};function t(n,s){var a=e[n];return typeof a=="function"&&r>=s?a.bind(e):function(){}}return{error:t("error",_t.ERROR),warn:t("warn",_t.WARN),info:t("info",_t.INFO),debug:t("debug",_t.DEBUG),verbose:t("verbose",_t.VERBOSE)}}var j0=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),s,a=[],i;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(o){i={error:o}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},Z0=function(r,e,t){if(t||arguments.length===2)for(var n=0,s=e.length,a;n<s;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},R0="diag",Gs=function(){function r(){function e(s){return function(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];var o=Hs("diag");if(o)return o[s].apply(o,Z0([],j0(a),!1))}}var t=this,n=function(s,a){var i,o,c;if(a===void 0&&(a={logLevel:_t.INFO}),s===t){var d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error((i=d.stack)!==null&&i!==void 0?i:d.message),!1}typeof a=="number"&&(a={logLevel:a});var w=Hs("diag"),D=I0((o=a.logLevel)!==null&&o!==void 0?o:_t.INFO,s);if(w&&!a.suppressOverrideMessage){var X=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";w.warn("Current logger will be overwritten from "+X),D.warn("Current logger will overwrite one already registered from "+X)}return cu("diag",D,t,!0)};t.setLogger=n,t.disable=function(){uu(R0,t)},t.createComponentLogger=function(s){return new C0(s)},t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}return r.instance=function(){return this._instance||(this._instance=new r),this._instance},r}(),z0=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),s,a=[],i;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(o){i={error:o}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},P0=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},$0=function(){function r(e){this._entries=e?new Map(e):new Map}return r.prototype.getEntry=function(e){var t=this._entries.get(e);if(t)return Object.assign({},t)},r.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var t=z0(e,2),n=t[0],s=t[1];return[n,s]})},r.prototype.setEntry=function(e,t){var n=new r(this._entries);return n._entries.set(e,t),n},r.prototype.removeEntry=function(e){var t=new r(this._entries);return t._entries.delete(e),t},r.prototype.removeEntries=function(){for(var e,t,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];var a=new r(this._entries);try{for(var i=P0(n),o=i.next();!o.done;o=i.next()){var c=o.value;a._entries.delete(c)}}catch(d){e={error:d}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return a},r.prototype.clear=function(){return new r},r}();Gs.instance();function D0(r){return r===void 0&&(r={}),new $0(new Map(Object.entries(r)))}function U0(r){return Symbol.for(r)}var M0=function(){function r(e){var t=this;t._currentContext=e?new Map(e):new Map,t.getValue=function(n){return t._currentContext.get(n)},t.setValue=function(n,s){var a=new r(t._currentContext);return a._currentContext.set(n,s),a},t.deleteValue=function(n){var s=new r(t._currentContext);return s._currentContext.delete(n),s}}return r}(),L0=new M0,B0={get:function(r,e){if(r!=null)return r[e]},keys:function(r){return r==null?[]:Object.keys(r)}},V0={set:function(r,e,t){r!=null&&(r[e]=t)}},F0=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),s,a=[],i;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(o){i={error:o}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},K0=function(r,e,t){if(t||arguments.length===2)for(var n=0,s=e.length,a;n<s;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},W0=function(){function r(){}return r.prototype.active=function(){return L0},r.prototype.with=function(e,t,n){for(var s=[],a=3;a<arguments.length;a++)s[a-3]=arguments[a];return t.call.apply(t,K0([n],F0(s),!1))},r.prototype.bind=function(e,t){return t},r.prototype.enable=function(){return this},r.prototype.disable=function(){return this},r}(),q0=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),s,a=[],i;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(o){i={error:o}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return a},Y0=function(r,e,t){if(t||arguments.length===2)for(var n=0,s=e.length,a;n<s;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},Oo="context",H0=new W0,cf=function(){function r(){}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalContextManager=function(e){return cu(Oo,e,Gs.instance())},r.prototype.active=function(){return this._getContextManager().active()},r.prototype.with=function(e,t,n){for(var s,a=[],i=3;i<arguments.length;i++)a[i-3]=arguments[i];return(s=this._getContextManager()).with.apply(s,Y0([e,t,n],q0(a),!1))},r.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},r.prototype._getContextManager=function(){return Hs(Oo)||H0},r.prototype.disable=function(){this._getContextManager().disable(),uu(Oo,Gs.instance())},r}(),ic;(function(r){r[r.UNSET=0]="UNSET",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR"})(ic||(ic={}));var G0=cf.getInstance(),J0=function(){function r(){}return r.prototype.inject=function(e,t){},r.prototype.extract=function(e,t){return e},r.prototype.fields=function(){return[]},r}(),lu=U0("OpenTelemetry Baggage Key");function uf(r){return r.getValue(lu)||void 0}function X0(){return uf(cf.getInstance().active())}function Q0(r,e){return r.setValue(lu,e)}function ek(r){return r.deleteValue(lu)}var To="propagation",tk=new J0,rk=function(){function r(){this.createBaggage=D0,this.getBaggage=uf,this.getActiveBaggage=X0,this.setBaggage=Q0,this.deleteBaggage=ek}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalPropagator=function(e){return cu(To,e,Gs.instance())},r.prototype.inject=function(e,t,n){return n===void 0&&(n=V0),this._getGlobalPropagator().inject(e,t,n)},r.prototype.extract=function(e,t,n){return n===void 0&&(n=B0),this._getGlobalPropagator().extract(e,t,n)},r.prototype.fields=function(){return this._getGlobalPropagator().fields()},r.prototype.disable=function(){uu(To,Gs.instance())},r.prototype._getGlobalPropagator=function(){return Hs(To)||tk},r}(),nk=rk.getInstance();const pl=["bench","debug","prod"],sk=r=>e=>pl.indexOf(e)>=pl.indexOf(r),oc=class lf{constructor(e,t=sk("debug")){qe(this,"meta",ou.NOOP),qe(this,"tracer"),qe(this,"filter"),this.tracer=e,this.filter=t}child(e){const t=new lf(this.tracer,this.filter);return t.meta=e,t}debug(e,t){return this.trace(e,"debug",t)}bench(e,t){return this.trace(e,"bench",t)}prod(e,t){return this.trace(e,"prod",t)}trace(e,t,n){return this.meta.noop||!this.filter(t)?n(new ff(e)):this.tracer.startActiveSpan(e,s=>{const a=new hf(e,s),i=n(a);return s.end(),i})}propagate(e){if(this.meta.noop)return;const t=G0.active();nk.inject(t,e,{set:(n,s,a)=>{n[s]=a}})}};qe(oc,"NOOP",new oc);let df=oc;class hf{constructor(e,t){qe(this,"key"),qe(this,"otel"),this.key=e,this.otel=t}set(e,t){this.otel.setAttribute(e,t)}recordError(e){e!=null&&(this.otel.recordException(e),this.otel.setStatus({code:ic.ERROR}))}}class ff{constructor(e){qe(this,"key"),this.key=e}set(e,t){}recordError(e){}}const cc=class pf{constructor({key:e="",serviceName:t="",logger:n=of.NOOP,tracer:s=df.NOOP,noop:a=!1,__meta:i}){qe(this,"meta"),qe(this,"T"),qe(this,"L"),this.meta=i??new ou(e,e,t,a),this.T=s.child(this.meta),this.L=n.child(this.meta)}child(e){const t=this.meta.child(e);return new pf({__meta:t,tracer:this.T,logger:this.L})}};qe(cc,"NOOP",new cc({noop:!0}));let du=cc;const ak=du.NOOP;class oo{constructor(e,t,n=new Map){Oe(this,"providers");Oe(this,"registry");Oe(this,"sender");Oe(this,"changed");this.providers=n,this.registry=t,this.changed=!1,this.sender=e}propagateState(e,t,n=[]){this.sender.send({key:e,state:t},n)}copyAndMerge(e){const t=new oo(this.sender,this.registry,new Map);return e==null||e.providers.forEach((n,s)=>t.providers.set(s,n)),this.providers.forEach((n,s)=>t.providers.set(s,n)),t.changed=!1,t}set(e,t){this.providers.set(e,t),this.changed=!0}setIfNotHas(e,t){this.providers.has(e)||this.set(e,t)}create(e){const t=this.registry[e.type];if(t==null)throw new Error(`[AetherRoot.create] - could not find component ${e.type}`);const n=new t(e);return n.internalUpdate(e),n}getOptional(e){return this.providers.get(e)??null}has(e){return this.providers.has(e)}get(e){const t=this.getOptional(e);if(t==null)throw new Error(`[AetherRoot.get] - could not find provider ${e}`);return t}}class hu{constructor(e){Oe(this,"type");Oe(this,"key");Oe(this,"_ctx");Oe(this,"_internalState");Oe(this,"_state");Oe(this,"_prevState");Oe(this,"_deleted",!1);Oe(this,"schema");this.type=e.type,this.key=e.path[0],this._ctx=e.ctx,this._internalState={}}get _schema(){if(this.schema==null)throw new br(`[AetherLeaf] - expected subclass to define component schema, but none was found.
|
|
22
|
+
Make sure to defne a property 'schema' on the class.`);return this.schema}setState(e){const t=dc(e,this._state);this._prevState={...this._state},this._state=rc(this._schema,t,`${this.type}:${this.key}`),this.ctx.propagateState(this.key,t)}get ctx(){if(this._ctx==null)throw new bt("context not defined");return this._ctx}get state(){if(this._state==null)throw new bt("state not defined");return this._state}get internal(){return this._internalState}get prevState(){return this._prevState}get deleted(){return this._deleted}internalUpdate({variant:e,path:t,ctx:n,state:s}){if(this._ctx=n,e==="state"){this.validatePath(t);const a=rc(this._schema,s,`${this.type}:${this.key}`);this._prevState=this._state??a,this._state=a}this.afterUpdate()}internalDelete(e){this.validatePath(e),this._deleted=!0,this.afterDelete()}afterUpdate(){}afterDelete(){}validatePath(e){if(e.length===0)throw new bt(`[Leaf.setState] - ${this.type}:${this.key} received an empty path`);const t=e[e.length-1];if(e.length>1)throw new bt(`[Leaf.setState] - ${this.type}:${this.key} received a subPath ${e.join(".")} but is a leaf`);if(t!==this.key)throw new bt(`[Leaf.setState] - ${this.type}:${this.key} received a key ${t} but expected ${this.key}`)}}class ua extends hu{constructor(t){super(t);Oe(this,"_children");Oe(this,"internalMemo");this._children=[]}get children(){return this._children}internalUpdate(t){const{variant:n,path:s}=t;if(n==="context")return this._ctx=t.ctx.copyAndMerge(this._ctx),this.updateContext({...t,ctx:this.ctx});const[a,i]=this.getRequiredKey(s),o={...t,ctx:this.ctx};return i.length===0?this.updateThis(a,o):this.updateChild(i,o)}updateContext(t){super.internalUpdate(t),this.children.forEach(n=>n.internalUpdate(t))}updateChild(t,n){const s=t[0],a=this.findChild(s);if(a!=null)return a.internalUpdate({...n,path:t});if(t.length>1)throw new Error(`[Composite.setState] - ${this.type}:${this.key} could not find child with key ${s} while updating `);this._children.push(n.ctx.create({...n,path:t}))}updateThis(t,n){const s=n.ctx.copyAndMerge(this._ctx);if(t!==this.key)throw new bt(`[Composite.update] - ${this.type}:${this.key} received a key ${t} but expected ${this.key}`);super.internalUpdate({...n,ctx:s}),s.changed&&this.children.forEach(a=>a.internalUpdate({...n,ctx:this.ctx,variant:"context"}))}internalDelete(t){const[n,s]=this.getRequiredKey(t);if(s.length===0){if(n!==this.key)throw new Error(`[Composite.delete] - ${this.type}:${this.key} received a key ${n} but expected ${this.key}`);const i=this.children;this._children=[],i.forEach(o=>o.internalDelete([o.key])),super.internalDelete([this.key]);return}const a=this.findChild(s[0]);a!=null&&(s.length>1||this._children.splice(this.children.indexOf(a),1),a.internalDelete(s))}getRequiredKey(t,n){const[s,...a]=t;if(s==null)throw new Error(`Composite ${this.type}:${this.key} received an empty path`+(n!=null?` for ${n}`:""));return[s,a]}findChild(t){return this.children.find(n=>n.key===t)??null}childrenOfType(...t){return this.children.filter(n=>t.includes(n.type))}}const ik=u.z.object({}),Pt=class Pt extends ua{constructor({worker:t,registry:n,instrumentation:s}){const i={ctx:new oo(t,n,new Map),...Pt.ZERO_UPDATE};super(i);Oe(this,"wrap");Oe(this,"instrumentation");Oe(this,"schema",Pt.schema);this.internalUpdate(i),this.wrap=t,this.wrap.handle(this.handle.bind(this)),this.instrumentation=s??du.NOOP}static render(t){return new Pt(t)}handle(t){if(t.variant==="delete")this.internalDelete(t.path);else{const n={...t,variant:"state",ctx:this.ctx};this.internalUpdate(n)}}};Oe(Pt,"TYPE","root"),Oe(Pt,"KEY","root"),Oe(Pt,"ZERO_UPDATE",{path:[Pt.KEY],type:Pt.TYPE,variant:"state",state:{}}),Oe(Pt,"schema",ik);let Ii=Pt;const mf=Ii.render,ok=Object.freeze(Object.defineProperty({__proto__:null,Composite:ua,Context:oo,Leaf:hu,Root:Ii,render:mf},Symbol.toStringTag,{value:"Module"})),yf=u.z.object({statuses:_l.array()}),gf="status.aggregator";class ji extends ua{constructor(){super(...arguments);Oe(this,"schema",yf)}afterUpdate(){this.ctx.set(gf,this)}add(t){const n=he.TimeStamp.now();this.setState(s=>({...s,statuses:[...s.statuses,{time:n,key:n.toString(),...t}]}))}}Oe(ji,"TYPE","status.Aggregator");const ck=r=>{const e=r.get(gf);return e.add.bind(e)},uk={[ji.TYPE]:ji},vf=["h1","h2","h3","h4","h5","p","small"],lk=u.z.enum(vf),Rr=u.z.object({size:u.z.number(),weight:u.z.union([u.z.number(),u.z.string()]),lineHeight:u.z.number(),textTransform:u.z.string().optional()}),dk={small:"small",medium:"p",large:"h4"},hk={h1:"large",h2:"large",h3:"medium",h4:"medium",h5:"small",p:"medium",small:"small"},fk=u.z.object({l0:he.Color.z,l1:he.Color.z,l2:he.Color.z,l3:he.Color.z,l4:he.Color.z,l5:he.Color.z,l6:he.Color.z,l7:he.Color.z,l8:he.Color.z,l9:he.Color.z,l10:he.Color.z}),wf=u.z.object({name:u.z.string(),key:u.z.string(),colors:u.z.object({border:he.Color.z,primary:u.z.object({m2:he.Color.z,m1:he.Color.z,z:he.Color.z,p1:he.Color.z,p2:he.Color.z}),gray:fk,error:u.z.object({m2:he.Color.z,m1:he.Color.z,z:he.Color.z,p1:he.Color.z,p2:he.Color.z}),secondary:u.z.object({m2:he.Color.z,m1:he.Color.z,z:he.Color.z,p1:he.Color.z,p2:he.Color.z}),visualization:u.z.object({palettes:u.z.record(u.z.array(he.Color.z))}),white:he.Color.z,black:he.Color.z,text:he.Color.z,textContrast:he.Color.z,logo:u.z.string()}),sizes:u.z.object({base:u.z.number(),border:u.z.object({radius:u.z.number(),width:u.z.number()}),pid:u.z.object({elementStrokeWidth:u.z.number()})}),typography:u.z.object({family:u.z.string(),h1:Rr,h2:Rr,h3:Rr,h4:Rr,h5:Rr,p:Rr,small:Rr})}),pk="'Inter Variable', sans-serif",mk=6,wa=(r,e)=>[r[0],r[1],e,r[3]],Jn=[357,91,55,1],yk=["#FCFCFC","#F9F9F9","#F4F4F4","#ededed","#d9d9d9","#ADADAD","#878787","#616161","#404040","#1C1C1C","#050505"],_a=Object.fromEntries(yk.map((r,e)=>[`l${e}`,r])),uc={key:"synnax-base",name:"Synnax Base",colors:{primary:{m2:"#041B3D",m1:"#164FA0",z:"#3774D0",p1:"#5E94EE",p2:"#8AB8FF"},secondary:{m2:"#2D8F4E",m1:"#38B261",z:"#50C878",p1:"#73D393",p2:"#96DEAE"},gray:_a,border:_a.l3,error:{m2:he.fromHSLA(wa(Jn,30)),m1:he.fromHSLA(wa(Jn,40)),z:he.fromHSLA(Jn),p1:he.fromHSLA(wa(Jn,60)),p2:he.fromHSLA(wa(Jn,70))},visualization:{palettes:{default:["#DC136C","#20A4F3","#7AC74F","#FFC43D","#FE5F55","#8075FF","#D90429","#f7aef8","#f18f01","#791e94","#279af1","#d9fff5","#ff6b6b","#52ffb8"]}},logo:"url(#synnax-linear-gradient)",white:"#FFFFFF",black:"#000000",text:_a.l9,textContrast:_a.l0},sizes:{base:mk,border:{radius:2,width:1},pid:{elementStrokeWidth:2}},typography:{family:pk,h1:{size:5,weight:"500",lineHeight:6},h2:{size:4,weight:"medium",lineHeight:5},h3:{size:3,weight:"medium",lineHeight:4},h4:{size:2.5,weight:"medium",lineHeight:3},h5:{size:2.25,weight:"medium",lineHeight:2.5,textTransform:"uppercase"},p:{size:2.25,weight:"regular",lineHeight:3.25},small:{size:2,weight:"regular",lineHeight:2.3}}},_f={...uc,key:"synnax-light",name:"Synnax Light"},gk=["#020202","#080808","#141414","#1a1a1a","#242424","#515151","#7f7f7f","#9D9D9D","#BFBFBF","#EDEDED","#FDFDFD"],ba=Object.fromEntries(gk.map((r,e)=>[`l${e}`,r])),bf={...uc,key:"synnax-dark",name:"Synnax Dark",colors:{...uc.colors,gray:ba,logo:"var(--pluto-text-color)",border:ba.l3,text:ba.l9,textContrast:ba.l0}},vk={synnaxDark:bf,synnaxLight:_f},kf="pluto-theming-context",wk=u.z.object({theme:wf}),ss=class ss extends ua{constructor(){super(...arguments);Oe(this,"schema",ss.z)}afterUpdate(){this.ctx.set(kf,this.state.theme)}};Oe(ss,"TYPE","theming.Provider"),Oe(ss,"z",wk);let Js=ss;const _k=r=>r.get(kf),bk={[Js.TYPE]:Js},kk=["small","medium","large"],xk=u.z.enum(kk),Ok=r=>xk.safeParse(r).success;exports.Ae=ff;exports.Aggregator=ji;exports.Authority=Ln;exports.C=du;exports.ComponentSizeLevels=dk;exports.Composite=ua;exports.Ee=hf;exports.LEVELS=vf;exports.Leaf=hu;exports.LevelComponentSizes=hk;exports.Pe=x0;exports.Provider=Js;exports.QueryError=qt;exports.R=df;exports.REGISTRY=bk;exports.REGISTRY$1=uk;exports.Re=ak;exports.Series=$t;exports.Synnax=nf;exports.TimeRange=At;exports.TimeSpan=$e;exports.TimeStamp=De;exports.UnexpectedError=bt;exports.VARIANTS=vl;exports.ValidationError=br;exports.aether=ok;exports.aggregatorStateZ=yf;exports.commonjsGlobal=Tf;exports.executeInitialSetter=Zi;exports.executeSetter=dc;exports.external=v0;exports.external$5=N_;exports.external$6=i_;exports.getDefaultExportFromCjs=Sf;exports.isComponentSize=Ok;exports.isSetter=lc;exports.j=sc;exports.levelZ=lk;exports.nanoid=w0;exports.prettyParse=rc;exports.render=mf;exports.specZ=Rr;exports.specZ$1=_l;exports.state=Nf;exports.synnaxDark=bf;exports.synnaxLight=_f;exports.synnaxPropsZ=rf;exports.themeZ=wf;exports.themes=vk;exports.use=_k;exports.useAggregate=ck;exports.usePurePassthrough=gl;exports.variantZ=wl;exports.x=of;exports.xe=k0;
|
|
23
|
+
//# sourceMappingURL=component-dgLAEMbt.cjs.map
|