@synnaxlabs/drift 0.39.0 → 0.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/electron.cjs +1 -1
- package/dist/electron.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/{selectors-ChR2waHK.js → selectors-CVXi0LBk.js} +1 -1
- package/dist/{selectors-BOlMfPQR.cjs → selectors-DsoUWQIE.cjs} +1 -1
- package/dist/src/window.d.ts.map +1 -1
- package/dist/{state-B4NiJdX7.js → state-B_nrpWi0.js} +6 -0
- package/dist/{state-5JemPjJN.cjs → state-u8UjvjPJ.cjs} +5 -5
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +24 -9
- package/package.json +5 -6
package/dist/electron.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var R=Object.defineProperty;var B=(t,e,o)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var _=(t,e,o)=>B(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./state-
|
|
1
|
+
"use strict";var R=Object.defineProperty;var B=(t,e,o)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var _=(t,e,o)=>B(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./state-u8UjvjPJ.cjs"),H=require("./debounce-BUAIXXZt.cjs"),E="drift://action",p="drift://create",w="drift://focus",b="drift://close",I="drift://set-minimized",N="drift://set-maximized",z="drift://set-visible",y="drift://set-fullscreen",M="drift://center",O="drift://set-position",A="drift://set-size",g="drift://set-min-size",V="drift://set-max-size",x="drift://set-resizable",W="drift://set-skip-taskbar",P="drift://set-always-on-top",k="drift://set-title",L="drift://set-decorations",S="drift://get-props",D="drift://get-label",Z=[E,p,w,b,I,N,z,y,M,O,A,g,V,x,W,P,k,L,S],q=t=>{if(!Z.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},F=[E],U=t=>{if(!F.includes(t))throw new Error(`Event ${t} is not on the list of allowed events`)},$=[S,D],G=t=>{if(!$.includes(t))throw new Error(`Command ${t} is not on the list of allowed commands`)},J=t=>{var e,o,r,l,u,d,m,f;return{x:(e=t.position)==null?void 0:e.x,y:(o=t.position)==null?void 0:o.y,width:(r=t.size)==null?void 0:r.width,height:(l=t.size)==null?void 0:l.height,center:t.center,minHeight:(u=t.minSize)==null?void 0:u.height,minWidth:(d=t.minSize)==null?void 0:d.width,maxHeight:(m=t.maxSize)==null?void 0:m.height,maxWidth:(f=t.maxSize)==null?void 0:f.width,resizable:t.resizable,fullscreen:t.fullscreen,skipTaskbar:t.skipTaskbar,title:t.title,show:t.visible,transparent:t.transparent,alwaysOnTop:t.alwaysOnTop}},K=t=>{const[e,o]=t.getSize(),[r,l]=t.getPosition();return{size:{width:e,height:o},position:{x:r,y:l},minimized:t.isMinimized(),maximized:t.isMaximized(),fullscreen:t.isFullScreen(),visible:t.isVisible(),resizable:t.isResizable(),skipTaskbar:!1,title:t.getTitle(),alwaysOnTop:t.isAlwaysOnTop(),decorations:!1}},X=({mainWindow:t,createWindow:e})=>{const o=new Map,r=new Map;o.set(h.MAIN_WINDOW,t.id),r.set(t.id,h.MAIN_WINDOW);const{ipcMain:l,BrowserWindow:u}=require("electron"),d=(s,i)=>l.on(s,(n,a)=>{const c=u.fromWebContents(n.sender);c!=null&&i(c,a)});l.on(b,(s,i)=>{const n=o.get(i);if(n==null)return;const a=u.fromId(n);a!=null&&(a.close(),o.delete(i),r.delete(n))}),l.handle(S,s=>{const i=u.fromWebContents(s.sender);return i==null?void 0:{...K(i),label:r.get(i.id)}}),l.handle(D,s=>{const i=u.fromWebContents(s.sender);if(i!=null)return r.get(i.id)});const m=(s,i,n)=>{s.on(i,H.o(n,500))},f=s=>{var i;for(const n of r.keys())(i=u.fromId(n))==null||i.webContents.send(E,s)},C=(s,i)=>{const n=(a,c)=>{m(i,a,()=>{f({action:h.runtimeSetWindowProps({label:s,...c(i)}),emitter:"WHITELIST"})})};n("resize",a=>{const[c,v]=a.getSize();return{size:{width:c,height:v}}}),n("move",()=>{const[a,c]=i.getPosition();return{position:{x:a,y:c}}}),n("minimize",()=>({minimized:!0})),n("restore",()=>({minimized:!1})),n("maximize",()=>({maximized:!0})),n("unmaximize",()=>({maximized:!1})),n("enter-full-screen",a=>(a.setWindowButtonVisibility(!0),{fullscreen:!0})),n("leave-full-screen",()=>(i.setWindowButtonVisibility(!1),{fullscreen:!1}))};C(h.MAIN_WINDOW,t),d(w,s=>s.focus()),d(I,s=>s.minimize()),d(N,s=>s.maximize()),d(z,(s,i)=>i?s.show():s.hide()),d(y,s=>s.setFullScreen(!0)),d(M,s=>s.center()),d(O,(s,{x:i,y:n})=>{s.setPosition(Math.round(i),Math.round(n))}),d(A,(s,{width:i,height:n})=>{s.setSize(Math.round(i),Math.round(n))}),d(g,(s,{width:i,height:n})=>s.setMinimumSize(Math.round(i),Math.round(n))),d(V,(s,{width:i,height:n})=>s.setMaximumSize(Math.round(i),Math.round(n))),d(x,(s,i)=>s.setResizable(i)),d(W,(s,i)=>s.setSkipTaskbar(i)),d(P,(s,i)=>s.setAlwaysOnTop(i)),d(k,(s,i)=>s.setTitle(i)),l.on(p,(s,i,n)=>{const a=e(J(n));o.set(i,a.id),r.set(a.id,i),C(i,a)}),l.on(E,(s,i,n)=>{if(i==null)return;if(n==null)return f(i);const a=o.get(n);if(a==null)return;const c=u.fromId(a);c!=null&&c.webContents.send(E,i)})},T="driftAPI",j=()=>{const{ipcRenderer:t,contextBridge:e}=require("electron"),o={send:(r,...l)=>{q(r),t.send(r,...l)},invoke:async(r,...l)=>(G(r),await t.invoke(r,...l)),on:(r,l)=>{U(r),t.on(r,l)}};e.exposeInMainWorld(T,o)},Y=async()=>{if(!(T in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");return await window[T].invoke(D)};class Q{constructor(){_(this,"_label","");_(this,"props",null);_(this,"api");if(!(T in window))throw new Error("Drift API not found. Make sure to call configurePreload in your preload script.");this.api=window[T]}async configure(){const{label:e,...o}=await this.api.invoke(S);this._label=e,this.props=o}label(){return this._label}isMain(){return this._label===h.MAIN_WINDOW}release(){}async emit(e,o){this.api.send(E,{...e,emitter:this.label()},o)}async subscribe(e){this.api.on(E,(o,r)=>e(r))}onCloseRequested(){}async create(e,o){this.api.send(p,e,JSON.parse(JSON.stringify(o)))}async close(e){this.api.send(b,e)}async listLabels(){return[]}async focus(){this.api.send(w)}async setMinimized(e){this.api.send(I,e)}async setMaximized(e){this.api.send(N,e)}async setVisible(e){this.api.send(z,e)}async setFullscreen(e){this.api.send(y,e)}async center(){this.api.send(M)}async setPosition(e){this.api.send(O,e)}async setSize(e){this.api.send(A,e)}async setMinSize(e){this.api.send(g,e)}async setMaxSize(e){this.api.send(V,e)}async setResizable(e){this.api.send(x,e)}async setSkipTaskbar(e){this.api.send(W,e)}async setAlwaysOnTop(e){this.api.send(P,e)}async setTitle(e){this.api.send(k,e)}async setDecorations(e){this.api.send(L,e)}async getProps(){if(this.props!=null)return this.props;throw new Error("Window not found")}}exports.ElectronRuntime=Q;exports.exposeAPI=j;exports.getWindowLabel=Y;exports.listenOnMain=X;
|
package/dist/electron.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var R = Object.defineProperty;
|
|
2
2
|
var B = (t, e, o) => e in t ? R(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
3
|
var m = (t, e, o) => B(t, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
-
import { M as _, r as H } from "./state-
|
|
4
|
+
import { M as _, r as H } from "./state-B_nrpWi0.js";
|
|
5
5
|
import { o as Z } from "./debounce-DOZKRZa9.js";
|
|
6
6
|
const E = "drift://action", S = "drift://create", w = "drift://focus", z = "drift://close", b = "drift://set-minimized", y = "drift://set-maximized", I = "drift://set-visible", N = "drift://set-fullscreen", M = "drift://center", O = "drift://set-position", g = "drift://set-size", A = "drift://set-min-size", V = "drift://set-max-size", x = "drift://set-resizable", k = "drift://set-skip-taskbar", C = "drift://set-always-on-top", P = "drift://set-title", L = "drift://set-decorations", p = "drift://get-props", W = "drift://get-label", F = [
|
|
7
7
|
E,
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("@reduxjs/toolkit"),t=require("./state-5JemPjJN.cjs"),f=require("./selectors-BOlMfPQR.cjs"),A=new Error("request for lock canceled");var C=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(o.next(c))}catch(w){r(w)}}function d(c){try{u(o.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class L{constructor(e,s=A){this._value=e,this._cancelError=s,this._queue=[],this._weightedWaiters=[]}acquire(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((o,n)=>{const a={resolve:o,reject:n,weight:e,priority:s},r=E(this._queue,l=>s<=l.priority);r===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(r+1,0,a)})}runExclusive(e){return C(this,arguments,void 0,function*(s,o=1,n=0){const[a,r]=yield this.acquire(o,n);try{return yield s(a)}finally{r()}})}waitForUnlock(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,s)?Promise.resolve():new Promise(o=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),N(this._weightedWaiters[e-1],{resolve:o,priority:s})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const s=this._value;this._value-=e.weight,e.resolve([s,this._newReleaser(e.weight)])}_newReleaser(e){let s=!1;return()=>{s||(s=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const s=this._weightedWaiters[e-1];s&&(s.forEach(o=>o.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let s=this._value;s>0;s--){const o=this._weightedWaiters[s-1];if(!o)continue;const n=o.findIndex(a=>a.priority<=e);(n===-1?o:o.splice(0,n)).forEach(a=>a.resolve())}}}_couldLockImmediately(e,s){return(this._queue.length===0||this._queue[0].priority<s)&&e<=this._value}}function N(i,e){const s=E(i,o=>e.priority<=o.priority);i.splice(s+1,0,e)}function E(i,e){for(let s=i.length-1;s>=0;s--)if(e(i[s]))return s;return-1}var P=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(o.next(c))}catch(w){r(w)}}function d(c){try{u(o.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class q{constructor(e){this._semaphore=new L(1,e)}acquire(){return P(this,arguments,void 0,function*(e=0){const[,s]=yield this._semaphore.acquire(1,e);return s})}runExclusive(e,s=0){return this._semaphore.runExclusive(()=>e(),1,s)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const D=i=>[...new Set(i)],R=(i,e,s=!0)=>{const o=new Map;return i.forEach(n=>{const a=e(n);if(o.has(a)){if(s)return;o.delete(a)}o.set(a,n)}),Array.from(o.values())},F=Object.freeze(Object.defineProperty({__proto__:null,by:R,unique:D},Symbol.toStringTag,{value:"Module"})),T="DA@",I="://",V=(i,e)=>T.concat(e,I,i),j=i=>{const[e,s]=i.split(I);if(s==null)return[i,""];const[,o]=e.split(T);return[s,o]},b=(i,e)=>({...i,type:V(i.type,e)}),Z=i=>{const[e,s]=j(i.type);return{emitted:s!=null&&s.length>0,emitter:s,action:{...i,type:e}}},U=i=>{const{centerCount:e,processCount:s,focusCount:o,stage:n,key:a,prerenderLabel:r,reserved:l,minimized:d,...u}=i;return u},K=async(i,e,s,o)=>{const n=(await s.listLabels()).filter(c=>c!==t.MAIN_WINDOW),a=Object.keys(i.windows).filter(c=>c!==t.MAIN_WINDOW);t.group(o,"syncInitial"),t.log(o,"existing windows in runtime",n.sort()),t.log(o,"non-main windows in state",a.sort()),t.groupEnd(o);const r=F.unique([...n,...a]);for(const c of r)!n.includes(c)&&s.isMain()?(t.log(o,"state window not in runtime, creating",c),await k(s,c,i.windows[c],o)):a.includes(c)||(t.log(o,"runtime window not in state, closing",c),await p(s,c,o));const l=s.label(),d=i.windows[l];if(d==null)return;const u={...t.INITIAL_WINDOW_STATE};await M(u,d,s,o),e(t.runtimeSetWindowProps({label:s.label(),...await s.getProps()}))},Q=async(i,e,s,o)=>{t.log(o,"sync",i,e),s.isMain()&&await X(i,e,s,o);const n=i.windows[s.label()],a=e.windows[s.label()];n==null||a==null||await M(n,a,s,o)},M=async(i,e,s,o)=>{const n=[];e.title!=null&&e.title!==i.title&&n.push(["title",{prev:i.title,next:e.title},async()=>s.setTitle(e.title)]);const a=e.visible!=null&&e.visible!==i.visible,r=e.visible===!1,l=()=>n.push(["visible",{prev:i.visible,next:e.visible},async()=>{if(await s.setVisible(e.visible),e.visible===!1)return;let d=e.position;d??(d=(await s.getProps()).position),await s.setPosition(t.G.translate(d,{x:1,y:1})),await s.setPosition(d)}]);if(a&&r&&l(),e.skipTaskbar!=null&&e.skipTaskbar!==i.skipTaskbar&&n.push(["skipTaskbar",{prev:i.skipTaskbar,next:e.skipTaskbar},async()=>await s.setSkipTaskbar(e.skipTaskbar)]),e.maximized!=null&&e.maximized!==i.maximized&&n.push(["maximized",{prev:i.maximized,next:e.maximized},async()=>await s.setMaximized(e.maximized)]),e.fullscreen!=null&&e.fullscreen!==i.fullscreen&&n.push(["fullscreen",{prev:i.fullscreen,next:e.fullscreen},async()=>await s.setFullscreen(e.fullscreen)]),e.centerCount!==i.centerCount&&n.push(["center",{prev:i.centerCount,next:e.centerCount},async()=>s.center()]),e.minimized!=null&&e.minimized!==i.minimized&&n.push(["minimized",{prev:i.minimized,next:e.minimized},async()=>await s.setMinimized(e.minimized)]),e.resizable!=null&&e.resizable!==i.resizable&&n.push(["resizable",{prev:i.resizable,next:e.resizable},async()=>await s.setResizable(e.resizable)]),e.minSize!=null&&!t._.equals(e.minSize,i.minSize)&&n.push(["minSize",{prev:i.minSize,next:e.minSize},async()=>await s.setMinSize(e.minSize)]),e.maxSize!=null&&!t._.equals(e.maxSize,i.maxSize)&&n.push(["maxSize",{prev:i.maxSize,next:e.maxSize},async()=>await s.setMaxSize(e.maxSize)]),e.size!=null&&!t._.equals(e.size,i.size)&&n.push(["size",{prev:i.size,next:e.size},async()=>await s.setSize(e.size)]),e.position!=null&&!t._.equals(e.position,i.position)&&n.push(["position",{prev:i.position,next:e.position},async()=>await s.setPosition(e.position)]),e.focusCount!==i.focusCount&&n.push(["setVisible",{prev:i.visible,next:e.visible},async()=>await s.setVisible(!0)],["focus",{prev:i.focusCount,next:e.focusCount},async()=>await s.focus()]),e.decorations!=null&&e.decorations!==i.decorations&&n.push(["decorations",{prev:i.decorations,next:e.decorations},async()=>await s.setDecorations(e.decorations)]),e.alwaysOnTop!=null&&e.alwaysOnTop!==i.alwaysOnTop&&n.push(["alwaysOnTop",{prev:i.alwaysOnTop,next:e.alwaysOnTop},async()=>await s.setAlwaysOnTop(e.alwaysOnTop)]),a&&!r&&l(),n.length!==0){t.group(o,`syncCurrent, label: ${s.label()}, key: ${e.key}`);for(const[d,{prev:u,next:c}]of n)t.log(o,d,u,"->",c);t.groupEnd(o);for(const[,,d]of n)await d()}},X=async(i,e,s,o)=>{const n=Object.keys(i.windows).filter(l=>!(l in e.windows)),a=Object.keys(e.windows).filter(l=>!(l in i.windows)),r=s.isMain();if(r&&n.length>0)for(const l of n)t.log(o,"syncMain","closing",l),l===t.MAIN_WINDOW&&await Promise.all(Object.keys(e.windows).filter(d=>d!==t.MAIN_WINDOW).map(async d=>await p(s,d,o))),await p(s,l,o);if(r&&a.length>0)for(const l of a)await k(s,l,e.windows[l],o)},k=async(i,e,s,o)=>(t.log(o,"createWindow",s),await i.create(e,U(s))),p=async(i,e,s)=>(t.log(s,"closeWindow",e),await i.close(e)),z="[drift] - unexpected undefined action",m="[drift] - unexpected undefined action type",y=i=>{if(i.emitted??(i.emitted=!1),i.action==null)throw console.warn(z,i),new Error(z);if(i.action.type==null||i.action.type.length===0)throw console.warn(m,i),new Error(m)},$=new q,G=[t.runtimeSetWindowProps.type,t.reloadWindow.type],Y=(i,e=!1)=>s=>o=>n=>{let{action:a,emitted:r,emitter:l}=Z(n);const d=i.label();y({action:n,emitted:r,emitter:l});const u=t.isDriftAction(a.type);if(u&&t.log(e,"[drift] - middleware",{action:a,emitted:r,emitter:l,host:d}),l===i.label())return;const c=u&&!G.includes(a.type);let w=null;u&&(w=s.getState().drift,a=t.assignLabel(a,w));const h=o(a),_=c?s.getState().drift:null,W=t.shouldEmit(r,a.type);return $.runExclusive(async()=>{try{w!==null&&_!==null&&await Q(w,_,i,e),W&&await i.emit({action:a})}catch(S){t.log(e,"[drift] - ERROR",{error:S.message,action:a,emitted:r,emitter:l,host:d}),s.dispatch(t.setWindowError({key:d,message:S.message}))}}),h},B=(i,e,s=!1)=>o=>{const n=i!=null?typeof i=="function"?i(o):i:o();return[Y(e,s),...n]},H=async({runtime:i,preloadedState:e,middleware:s,debug:o=!1,enablePrerender:n=!0,defaultWindowProps:a,...r})=>{await i.configure();let l;l=O.configureStore({...r,preloadedState:await J(o,i,()=>l,a,e),middleware:B(s,i,o)}),await K(l.getState().drift,l.dispatch,i,o);const d=i.label();return l.dispatch(t.internalSetInitial({enablePrerender:n,defaultWindowProps:a,debug:o,label:d})),l.dispatch(t.setWindowStage({stage:"created"})),i.onCloseRequested(()=>l==null?void 0:l.dispatch(t.closeWindow({}))),l},J=async(i,e,s,o,n)=>e.isMain()?(await e.subscribe(({action:r,emitter:l,sendState:d})=>{const u=s();if(u==null)return;if(r!=null){y({action:r,emitter:l}),u.dispatch(b(r,l));return}const c=u.getState();d===!0&&e.emit({state:c},l)}),typeof n=="function"?g(o,i,await n()):g(o,i,n)):await new Promise((r,l)=>{(async()=>{try{await e.subscribe(({action:u,emitter:c,state:w})=>{const h=s();if(h==null)return w!=null?r(w):void 0;u!=null&&(y({action:u,emitter:c}),h.dispatch(b(u,c)))}),await e.emit({sendState:!0},t.MAIN_WINDOW)}catch(u){l(u)}})()}),v=H,g=(i,e,s)=>{if(s==null)return s;const o=s[t.SLICE_NAME];return o.config.debug=e??o.config.debug,o.windows=Object.fromEntries(Object.entries(o.windows).filter(([,n])=>n.reserved).map(([n,a])=>((i==null?void 0:i.visible)!=null&&(a.visible=i.visible),a.focusCount=0,a.centerCount=0,a.processCount=0,[n,a]))),s},x=Object.freeze(Object.defineProperty({__proto__:null,MAIN_WINDOW:t.MAIN_WINDOW,SLICE_NAME:t.SLICE_NAME,ZERO_SLICE_STATE:t.ZERO_SLICE_STATE,closeWindow:t.closeWindow,completeProcess:t.completeProcess,configureStore:v,createWindow:t.createWindow,focusWindow:t.focusWindow,reducer:t.reducer,registerProcess:t.registerProcess,reloadWindow:t.reloadWindow,selectSliceState:f.selectSliceState,selectWindow:f.selectWindow,selectWindowAttribute:f.selectWindowAttribute,selectWindowKey:f.selectWindowKey,selectWindowLabel:f.selectWindowLabel,selectWindows:f.selectWindows,setWindowAlwaysOnTop:t.setWindowAlwaysOnTop,setWindowDecorations:t.setWindowDecorations,setWindowFullscreen:t.setWindowFullscreen,setWindowMaxSize:t.setWindowMaxSize,setWindowMaximized:t.setWindowMaximized,setWindowMinSize:t.setWindowMinSize,setWindowMinimized:t.setWindowMinimized,setWindowPosition:t.setWindowPosition,setWindowProps:t.setWindowProps,setWindowResizable:t.setWindowResizable,setWindowSize:t.setWindowSize,setWindowSkipTaskbar:t.setWindowSkipTaskbar,setWindowStage:t.setWindowStage,setWindowTitle:t.setWindowTitle,setWindowVisible:t.setWindowVisible,windowPropsZ:t.windowPropsZ},Symbol.toStringTag,{value:"Module"}));exports.MAIN_WINDOW=t.MAIN_WINDOW;exports.SLICE_NAME=t.SLICE_NAME;exports.ZERO_SLICE_STATE=t.ZERO_SLICE_STATE;exports.closeWindow=t.closeWindow;exports.completeProcess=t.completeProcess;exports.createWindow=t.createWindow;exports.focusWindow=t.focusWindow;exports.reducer=t.reducer;exports.registerProcess=t.registerProcess;exports.reloadWindow=t.reloadWindow;exports.setWindowAlwaysOnTop=t.setWindowAlwaysOnTop;exports.setWindowDecorations=t.setWindowDecorations;exports.setWindowFullscreen=t.setWindowFullscreen;exports.setWindowMaxSize=t.setWindowMaxSize;exports.setWindowMaximized=t.setWindowMaximized;exports.setWindowMinSize=t.setWindowMinSize;exports.setWindowMinimized=t.setWindowMinimized;exports.setWindowPosition=t.setWindowPosition;exports.setWindowProps=t.setWindowProps;exports.setWindowResizable=t.setWindowResizable;exports.setWindowSize=t.setWindowSize;exports.setWindowSkipTaskbar=t.setWindowSkipTaskbar;exports.setWindowStage=t.setWindowStage;exports.setWindowTitle=t.setWindowTitle;exports.setWindowVisible=t.setWindowVisible;exports.windowPropsZ=t.windowPropsZ;exports.selectSliceState=f.selectSliceState;exports.selectWindow=f.selectWindow;exports.selectWindowAttribute=f.selectWindowAttribute;exports.selectWindowKey=f.selectWindowKey;exports.selectWindowLabel=f.selectWindowLabel;exports.selectWindows=f.selectWindows;exports.Drift=x;exports.configureStore=v;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("@reduxjs/toolkit"),t=require("./state-u8UjvjPJ.cjs"),f=require("./selectors-DsoUWQIE.cjs"),A=new Error("request for lock canceled");var C=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(o.next(c))}catch(w){r(w)}}function d(c){try{u(o.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class L{constructor(e,s=A){this._value=e,this._cancelError=s,this._queue=[],this._weightedWaiters=[]}acquire(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((o,n)=>{const a={resolve:o,reject:n,weight:e,priority:s},r=E(this._queue,l=>s<=l.priority);r===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(r+1,0,a)})}runExclusive(e){return C(this,arguments,void 0,function*(s,o=1,n=0){const[a,r]=yield this.acquire(o,n);try{return yield s(a)}finally{r()}})}waitForUnlock(e=1,s=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,s)?Promise.resolve():new Promise(o=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),N(this._weightedWaiters[e-1],{resolve:o,priority:s})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const s=this._value;this._value-=e.weight,e.resolve([s,this._newReleaser(e.weight)])}_newReleaser(e){let s=!1;return()=>{s||(s=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const s=this._weightedWaiters[e-1];s&&(s.forEach(o=>o.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let s=this._value;s>0;s--){const o=this._weightedWaiters[s-1];if(!o)continue;const n=o.findIndex(a=>a.priority<=e);(n===-1?o:o.splice(0,n)).forEach(a=>a.resolve())}}}_couldLockImmediately(e,s){return(this._queue.length===0||this._queue[0].priority<s)&&e<=this._value}}function N(i,e){const s=E(i,o=>e.priority<=o.priority);i.splice(s+1,0,e)}function E(i,e){for(let s=i.length-1;s>=0;s--)if(e(i[s]))return s;return-1}var P=function(i,e,s,o){function n(a){return a instanceof s?a:new s(function(r){r(a)})}return new(s||(s=Promise))(function(a,r){function l(c){try{u(o.next(c))}catch(w){r(w)}}function d(c){try{u(o.throw(c))}catch(w){r(w)}}function u(c){c.done?a(c.value):n(c.value).then(l,d)}u((o=o.apply(i,e||[])).next())})};class q{constructor(e){this._semaphore=new L(1,e)}acquire(){return P(this,arguments,void 0,function*(e=0){const[,s]=yield this._semaphore.acquire(1,e);return s})}runExclusive(e,s=0){return this._semaphore.runExclusive(()=>e(),1,s)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const D=i=>[...new Set(i)],R=(i,e,s=!0)=>{const o=new Map;return i.forEach(n=>{const a=e(n);if(o.has(a)){if(s)return;o.delete(a)}o.set(a,n)}),Array.from(o.values())},F=Object.freeze(Object.defineProperty({__proto__:null,by:R,unique:D},Symbol.toStringTag,{value:"Module"})),T="DA@",I="://",V=(i,e)=>T.concat(e,I,i),j=i=>{const[e,s]=i.split(I);if(s==null)return[i,""];const[,o]=e.split(T);return[s,o]},b=(i,e)=>({...i,type:V(i.type,e)}),Z=i=>{const[e,s]=j(i.type);return{emitted:s!=null&&s.length>0,emitter:s,action:{...i,type:e}}},U=i=>{const{centerCount:e,processCount:s,focusCount:o,stage:n,key:a,prerenderLabel:r,reserved:l,minimized:d,...u}=i;return u},K=async(i,e,s,o)=>{const n=(await s.listLabels()).filter(c=>c!==t.MAIN_WINDOW),a=Object.keys(i.windows).filter(c=>c!==t.MAIN_WINDOW);t.group(o,"syncInitial"),t.log(o,"existing windows in runtime",n.sort()),t.log(o,"non-main windows in state",a.sort()),t.groupEnd(o);const r=F.unique([...n,...a]);for(const c of r)!n.includes(c)&&s.isMain()?(t.log(o,"state window not in runtime, creating",c),await k(s,c,i.windows[c],o)):a.includes(c)||(t.log(o,"runtime window not in state, closing",c),await p(s,c,o));const l=s.label(),d=i.windows[l];if(d==null)return;const u={...t.INITIAL_WINDOW_STATE};await M(u,d,s,o),e(t.runtimeSetWindowProps({label:s.label(),...await s.getProps()}))},Q=async(i,e,s,o)=>{t.log(o,"sync",i,e),s.isMain()&&await X(i,e,s,o);const n=i.windows[s.label()],a=e.windows[s.label()];n==null||a==null||await M(n,a,s,o)},M=async(i,e,s,o)=>{const n=[];e.title!=null&&e.title!==i.title&&n.push(["title",{prev:i.title,next:e.title},async()=>s.setTitle(e.title)]);const a=e.visible!=null&&e.visible!==i.visible,r=e.visible===!1,l=()=>n.push(["visible",{prev:i.visible,next:e.visible},async()=>{if(await s.setVisible(e.visible),e.visible===!1)return;let d=e.position;d??(d=(await s.getProps()).position),await s.setPosition(t.G.translate(d,{x:1,y:1})),await s.setPosition(d)}]);if(a&&r&&l(),e.skipTaskbar!=null&&e.skipTaskbar!==i.skipTaskbar&&n.push(["skipTaskbar",{prev:i.skipTaskbar,next:e.skipTaskbar},async()=>await s.setSkipTaskbar(e.skipTaskbar)]),e.maximized!=null&&e.maximized!==i.maximized&&n.push(["maximized",{prev:i.maximized,next:e.maximized},async()=>await s.setMaximized(e.maximized)]),e.fullscreen!=null&&e.fullscreen!==i.fullscreen&&n.push(["fullscreen",{prev:i.fullscreen,next:e.fullscreen},async()=>await s.setFullscreen(e.fullscreen)]),e.centerCount!==i.centerCount&&n.push(["center",{prev:i.centerCount,next:e.centerCount},async()=>s.center()]),e.minimized!=null&&e.minimized!==i.minimized&&n.push(["minimized",{prev:i.minimized,next:e.minimized},async()=>await s.setMinimized(e.minimized)]),e.resizable!=null&&e.resizable!==i.resizable&&n.push(["resizable",{prev:i.resizable,next:e.resizable},async()=>await s.setResizable(e.resizable)]),e.minSize!=null&&!t._.equals(e.minSize,i.minSize)&&n.push(["minSize",{prev:i.minSize,next:e.minSize},async()=>await s.setMinSize(e.minSize)]),e.maxSize!=null&&!t._.equals(e.maxSize,i.maxSize)&&n.push(["maxSize",{prev:i.maxSize,next:e.maxSize},async()=>await s.setMaxSize(e.maxSize)]),e.size!=null&&!t._.equals(e.size,i.size)&&n.push(["size",{prev:i.size,next:e.size},async()=>await s.setSize(e.size)]),e.position!=null&&!t._.equals(e.position,i.position)&&n.push(["position",{prev:i.position,next:e.position},async()=>await s.setPosition(e.position)]),e.focusCount!==i.focusCount&&n.push(["setVisible",{prev:i.visible,next:e.visible},async()=>await s.setVisible(!0)],["focus",{prev:i.focusCount,next:e.focusCount},async()=>await s.focus()]),e.decorations!=null&&e.decorations!==i.decorations&&n.push(["decorations",{prev:i.decorations,next:e.decorations},async()=>await s.setDecorations(e.decorations)]),e.alwaysOnTop!=null&&e.alwaysOnTop!==i.alwaysOnTop&&n.push(["alwaysOnTop",{prev:i.alwaysOnTop,next:e.alwaysOnTop},async()=>await s.setAlwaysOnTop(e.alwaysOnTop)]),a&&!r&&l(),n.length!==0){t.group(o,`syncCurrent, label: ${s.label()}, key: ${e.key}`);for(const[d,{prev:u,next:c}]of n)t.log(o,d,u,"->",c);t.groupEnd(o);for(const[,,d]of n)await d()}},X=async(i,e,s,o)=>{const n=Object.keys(i.windows).filter(l=>!(l in e.windows)),a=Object.keys(e.windows).filter(l=>!(l in i.windows)),r=s.isMain();if(r&&n.length>0)for(const l of n)t.log(o,"syncMain","closing",l),l===t.MAIN_WINDOW&&await Promise.all(Object.keys(e.windows).filter(d=>d!==t.MAIN_WINDOW).map(async d=>await p(s,d,o))),await p(s,l,o);if(r&&a.length>0)for(const l of a)await k(s,l,e.windows[l],o)},k=async(i,e,s,o)=>(t.log(o,"createWindow",s),await i.create(e,U(s))),p=async(i,e,s)=>(t.log(s,"closeWindow",e),await i.close(e)),z="[drift] - unexpected undefined action",m="[drift] - unexpected undefined action type",y=i=>{if(i.emitted??(i.emitted=!1),i.action==null)throw console.warn(z,i),new Error(z);if(i.action.type==null||i.action.type.length===0)throw console.warn(m,i),new Error(m)},$=new q,G=[t.runtimeSetWindowProps.type,t.reloadWindow.type],Y=(i,e=!1)=>s=>o=>n=>{let{action:a,emitted:r,emitter:l}=Z(n);const d=i.label();y({action:n,emitted:r,emitter:l});const u=t.isDriftAction(a.type);if(u&&t.log(e,"[drift] - middleware",{action:a,emitted:r,emitter:l,host:d}),l===i.label())return;const c=u&&!G.includes(a.type);let w=null;u&&(w=s.getState().drift,a=t.assignLabel(a,w));const h=o(a),_=c?s.getState().drift:null,W=t.shouldEmit(r,a.type);return $.runExclusive(async()=>{try{w!==null&&_!==null&&await Q(w,_,i,e),W&&await i.emit({action:a})}catch(S){t.log(e,"[drift] - ERROR",{error:S.message,action:a,emitted:r,emitter:l,host:d}),s.dispatch(t.setWindowError({key:d,message:S.message}))}}),h},B=(i,e,s=!1)=>o=>{const n=i!=null?typeof i=="function"?i(o):i:o();return[Y(e,s),...n]},H=async({runtime:i,preloadedState:e,middleware:s,debug:o=!1,enablePrerender:n=!0,defaultWindowProps:a,...r})=>{await i.configure();let l;l=O.configureStore({...r,preloadedState:await J(o,i,()=>l,a,e),middleware:B(s,i,o)}),await K(l.getState().drift,l.dispatch,i,o);const d=i.label();return l.dispatch(t.internalSetInitial({enablePrerender:n,defaultWindowProps:a,debug:o,label:d})),l.dispatch(t.setWindowStage({stage:"created"})),i.onCloseRequested(()=>l==null?void 0:l.dispatch(t.closeWindow({}))),l},J=async(i,e,s,o,n)=>e.isMain()?(await e.subscribe(({action:r,emitter:l,sendState:d})=>{const u=s();if(u==null)return;if(r!=null){y({action:r,emitter:l}),u.dispatch(b(r,l));return}const c=u.getState();d===!0&&e.emit({state:c},l)}),typeof n=="function"?g(o,i,await n()):g(o,i,n)):await new Promise((r,l)=>{(async()=>{try{await e.subscribe(({action:u,emitter:c,state:w})=>{const h=s();if(h==null)return w!=null?r(w):void 0;u!=null&&(y({action:u,emitter:c}),h.dispatch(b(u,c)))}),await e.emit({sendState:!0},t.MAIN_WINDOW)}catch(u){l(u)}})()}),v=H,g=(i,e,s)=>{if(s==null)return s;const o=s[t.SLICE_NAME];return o.config.debug=e??o.config.debug,o.windows=Object.fromEntries(Object.entries(o.windows).filter(([,n])=>n.reserved).map(([n,a])=>((i==null?void 0:i.visible)!=null&&(a.visible=i.visible),a.focusCount=0,a.centerCount=0,a.processCount=0,[n,a]))),s},x=Object.freeze(Object.defineProperty({__proto__:null,MAIN_WINDOW:t.MAIN_WINDOW,SLICE_NAME:t.SLICE_NAME,ZERO_SLICE_STATE:t.ZERO_SLICE_STATE,closeWindow:t.closeWindow,completeProcess:t.completeProcess,configureStore:v,createWindow:t.createWindow,focusWindow:t.focusWindow,reducer:t.reducer,registerProcess:t.registerProcess,reloadWindow:t.reloadWindow,selectSliceState:f.selectSliceState,selectWindow:f.selectWindow,selectWindowAttribute:f.selectWindowAttribute,selectWindowKey:f.selectWindowKey,selectWindowLabel:f.selectWindowLabel,selectWindows:f.selectWindows,setWindowAlwaysOnTop:t.setWindowAlwaysOnTop,setWindowDecorations:t.setWindowDecorations,setWindowFullscreen:t.setWindowFullscreen,setWindowMaxSize:t.setWindowMaxSize,setWindowMaximized:t.setWindowMaximized,setWindowMinSize:t.setWindowMinSize,setWindowMinimized:t.setWindowMinimized,setWindowPosition:t.setWindowPosition,setWindowProps:t.setWindowProps,setWindowResizable:t.setWindowResizable,setWindowSize:t.setWindowSize,setWindowSkipTaskbar:t.setWindowSkipTaskbar,setWindowStage:t.setWindowStage,setWindowTitle:t.setWindowTitle,setWindowVisible:t.setWindowVisible,windowPropsZ:t.windowPropsZ},Symbol.toStringTag,{value:"Module"}));exports.MAIN_WINDOW=t.MAIN_WINDOW;exports.SLICE_NAME=t.SLICE_NAME;exports.ZERO_SLICE_STATE=t.ZERO_SLICE_STATE;exports.closeWindow=t.closeWindow;exports.completeProcess=t.completeProcess;exports.createWindow=t.createWindow;exports.focusWindow=t.focusWindow;exports.reducer=t.reducer;exports.registerProcess=t.registerProcess;exports.reloadWindow=t.reloadWindow;exports.setWindowAlwaysOnTop=t.setWindowAlwaysOnTop;exports.setWindowDecorations=t.setWindowDecorations;exports.setWindowFullscreen=t.setWindowFullscreen;exports.setWindowMaxSize=t.setWindowMaxSize;exports.setWindowMaximized=t.setWindowMaximized;exports.setWindowMinSize=t.setWindowMinSize;exports.setWindowMinimized=t.setWindowMinimized;exports.setWindowPosition=t.setWindowPosition;exports.setWindowProps=t.setWindowProps;exports.setWindowResizable=t.setWindowResizable;exports.setWindowSize=t.setWindowSize;exports.setWindowSkipTaskbar=t.setWindowSkipTaskbar;exports.setWindowStage=t.setWindowStage;exports.setWindowTitle=t.setWindowTitle;exports.setWindowVisible=t.setWindowVisible;exports.windowPropsZ=t.windowPropsZ;exports.selectSliceState=f.selectSliceState;exports.selectWindow=f.selectWindow;exports.selectWindowAttribute=f.selectWindowAttribute;exports.selectWindowKey=f.selectWindowKey;exports.selectWindowLabel=f.selectWindowLabel;exports.selectWindows=f.selectWindows;exports.Drift=x;exports.configureStore=v;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { configureStore as j } from "@reduxjs/toolkit";
|
|
2
|
-
import { M as w, g, l as d, a as T, r as E, _ as p, G as F, I as N, b as I, i as V, c as $, s as U, d as Q, e as Z, f as C, h as q, S as M, Z as K, j as X, k as B, m as G, n as Y, o as H, p as J, q as x, t as W, u as ee, v as se, w as ie, x as te, y as ae, z as oe, A as ne, B as le, C as re, D as ce, E as ue, F as fe } from "./state-
|
|
3
|
-
import { s as de, a as we, b as he, c as pe, d as ye, e as _e } from "./selectors-
|
|
2
|
+
import { M as w, g, l as d, a as T, r as E, _ as p, G as F, I as N, b as I, i as V, c as $, s as U, d as Q, e as Z, f as C, h as q, S as M, Z as K, j as X, k as B, m as G, n as Y, o as H, p as J, q as x, t as W, u as ee, v as se, w as ie, x as te, y as ae, z as oe, A as ne, B as le, C as re, D as ce, E as ue, F as fe } from "./state-B_nrpWi0.js";
|
|
3
|
+
import { s as de, a as we, b as he, c as pe, d as ye, e as _e } from "./selectors-CVXi0LBk.js";
|
|
4
4
|
const be = new Error("request for lock canceled");
|
|
5
5
|
var me = function(i, e, s, t) {
|
|
6
6
|
function a(o) {
|
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("react-redux"),a=require("proxy-memoize"),d=require("./selectors-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("react-redux"),a=require("proxy-memoize"),d=require("./selectors-DsoUWQIE.cjs"),i=require("./state-u8UjvjPJ.cjs"),y=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindow(s,e)),[e])),w=()=>u.useSelector(n.useCallback(a.memoize(d.selectWindows),[])),S=e=>u.useSelector(n.useCallback(a.memoize(s=>d.selectWindowKey(s,e)),[e])),W=(e,s)=>u.useSelector(n.useCallback(a.memoize(t=>d.selectWindowAttribute(t,e,s)),[e,s])),m=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null);n.useEffect(()=>{if(t==null)return;const{stage:r}=t;if(r==="created"&&c.current==null){const l=e();l!=null&&(c.current=l),o(i.registerProcess({key:t.key}))}else(r==="closing"||r==="reloading")&&c.current!=null&&(c.current(),c.current=null,o(i.completeProcess({key:t.key})))},[t])},h=(e,s)=>{const t=y(s),o=u.useDispatch(),c=n.useRef(null),r=n.useRef(!1);n.useEffect(()=>{if(t==null)return;const{stage:l}=t;if(l==="created"&&c.current==null)r.current=!0,e().then(f=>{c.current=f??(async()=>{}),o(i.registerProcess({key:t.key}))}).catch(console.error).finally(()=>{r.current=!1});else if((l==="closing"||l==="reloading")&&c.current!=null){const f=c.current;c.current=null,f().then(()=>{c.current=null}).catch(console.error).finally(()=>{o(i.completeProcess({key:t.key}))})}},[t])},g=({store:e,emptyContent:s=null,children:t})=>{const[o,c]=n.useState(null),[r,l]=n.useState(null);if(r!=null)throw l(null),r;return o==null?(e instanceof Promise?e.then(c).catch(l):c(e),s):n.createElement(u.Provider,{store:o},t)};exports.Provider=g;exports.useAsyncWindowLifecycle=h;exports.useSelectWindow=y;exports.useSelectWindowAttribute=W;exports.useSelectWindowKey=S;exports.useSelectWindows=w;exports.useWindowLifecycle=m;
|
package/dist/react.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useCallback as l, useRef as f, useEffect as m, useState as d, createElement as W } from "react";
|
|
2
2
|
import { useSelector as u, useDispatch as y, Provider as g } from "react-redux";
|
|
3
3
|
import { memoize as i } from "proxy-memoize";
|
|
4
|
-
import { a as k, e as S, c as P, b as v } from "./selectors-
|
|
5
|
-
import { o as w, j as p } from "./state-
|
|
4
|
+
import { a as k, e as S, c as P, b as v } from "./selectors-CVXi0LBk.js";
|
|
5
|
+
import { o as w, j as p } from "./state-B_nrpWi0.js";
|
|
6
6
|
const h = (e) => u(
|
|
7
7
|
l(
|
|
8
8
|
i((r) => k(r, e)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("./state-
|
|
1
|
+
"use strict";const i=require("./state-u8UjvjPJ.cjs"),s=n=>n.drift,r=n=>Object.values(s(n).windows),c=(n,e)=>{const t=s(n);if(e==null)return t.windows[t.label];let l=t.windows[e];if(l!=null)return l;const o=t.keyLabels[e];return l=t.windows[o],l==null&&e!=null?null:l??t.windows[t.label]},u=(n,e)=>{const t=s(n);if(e==null)return t.labelKeys[t.label];const l=t.labelKeys[e];return l==null&&e==i.MAIN_WINDOW?i.MAIN_WINDOW:l},w=(n,e,t)=>{var l;return((l=c(n,e))==null?void 0:l[t])??null},d=(n,e)=>s(n).keyLabels[e];exports.selectSliceState=s;exports.selectWindow=c;exports.selectWindowAttribute=w;exports.selectWindowKey=u;exports.selectWindowLabel=d;exports.selectWindows=r;
|
package/dist/src/window.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/window.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,0DAA0D;AAC1D,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEtF,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C,MAAM,WAAW,yBAAyB;IACxC,sBAAsB;IACtB,KAAK,EAAE,WAAW,CAAC;IACnB,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,oBAAoB,EAAE,yBAMlC,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,WAI5C,CAAC;AAEF,0CAA0C;AAC1C,MAAM,WAAW,WAAY,SAAQ,WAAW,EAAE,yBAAyB;CAAG;AAE9E;;GAEG;AACH,MAAM,WAAW,WAAW;IAE1B,GAAG,EAAE,MAAM,CAAC;IAEZ,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;IAEjB,IAAI,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC;IAE7B,OAAO,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC;IAEhC,OAAO,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC;IAEhC,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/window.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,0DAA0D;AAC1D,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEtF,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C,MAAM,WAAW,yBAAyB;IACxC,sBAAsB;IACtB,KAAK,EAAE,WAAW,CAAC;IACnB,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,oBAAoB,EAAE,yBAMlC,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,WAI5C,CAAC;AAEF,0CAA0C;AAC1C,MAAM,WAAW,WAAY,SAAQ,WAAW,EAAE,yBAAyB;CAAG;AAE9E;;GAEG;AACH,MAAM,WAAW,WAAW;IAE1B,GAAG,EAAE,MAAM,CAAC;IAEZ,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;IAEjB,IAAI,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC;IAE7B,OAAO,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC;IAEhC,OAAO,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC;IAEhC,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBvB,CAAC"}
|
|
@@ -3949,6 +3949,12 @@ const ca = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", la
|
|
|
3949
3949
|
get milliseconds() {
|
|
3950
3950
|
return Number(this.valueOf()) / Number(w.MILLISECOND.valueOf());
|
|
3951
3951
|
}
|
|
3952
|
+
get microseconds() {
|
|
3953
|
+
return Number(this.valueOf()) / Number(w.MICROSECOND.valueOf());
|
|
3954
|
+
}
|
|
3955
|
+
get nanoseconds() {
|
|
3956
|
+
return Number(this.valueOf());
|
|
3957
|
+
}
|
|
3952
3958
|
/** @returns the integer year that the timestamp corresponds to. */
|
|
3953
3959
|
get year() {
|
|
3954
3960
|
return this.date().getFullYear();
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";const Er=require("@reduxjs/toolkit"),je=(n=!1,...e)=>{n&&console.log(...e)},
|
|
1
|
+
"use strict";const Er=require("@reduxjs/toolkit"),je=(n=!1,...e)=>{n&&console.log(...e)},Rn=(n=!1,...e)=>{n&&console.group(...e)},Dt=n=>{n&&console.groupEnd()},$r=n=>{const e=n.replace(/_[a-z]/g,t=>t[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},jn=n=>{const e=(t,r=Ut)=>{if(typeof t=="string")return n(t);if(Array.isArray(t))return t.map(a=>e(a,r));if(!jt(t))return t;r=Rr(r);const s={},i=t;return Object.keys(i).forEach(a=>{let o=i[a];const c=n(a);r.recursive&&(jt(o)?yn(o,r.keepTypesOnRecursion)||(o=e(o,r)):r.recursiveInArray&&mn(o)&&(o=[...o].map(l=>{let p=l;return jt(l)?yn(p,r.keepTypesOnRecursion)||(p=e(l,r)):mn(l)&&(p=e({key:l},r).key),p}))),s[c]=o}),s};return e},Zn=jn($r),Mr=n=>n.replace(/([a-z0-9])([A-Z])/g,(e,t,r)=>`${t}_${r.toLowerCase()}`),Cr=jn(Mr),Ut={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},Rr=(n=Ut)=>(n.recursive==null?n=Ut:n.recursiveInArray??(n.recursiveInArray=!1),n),mn=n=>n!=null&&Array.isArray(n),jt=n=>n!=null&&typeof n=="object"&&!Array.isArray(n),yn=(n,e)=>(e||[]).some(t=>n instanceof t),Ge=n=>n!=null&&typeof n=="object"&&!Array.isArray(n);var jr=Object.defineProperty,Zr=(n,e,t)=>e in n?jr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Je=(n,e,t)=>Zr(n,typeof e!="symbol"?e+"":e,t);let Br=class{constructor(){Je(this,"contentType","application/json"),Je(this,"decoder"),Je(this,"encoder"),this.decoder=new TextDecoder,this.encoder=new TextEncoder}encode(e){return this.encoder.encode(this.encodeString(e)).buffer}decode(e,t){return this.decodeString(this.decoder.decode(e),t)}decodeString(e,t){const r=JSON.parse(e),s=Zn(r);return t!=null?t.parse(s):s}encodeString(e){const t=Cr(e);return JSON.stringify(t,(r,s)=>ArrayBuffer.isView(s)?Array.from(s):Ge(s)&&"encode_value"in s?typeof s.value=="bigint"?s.value.toString():s.value:typeof s=="bigint"?s.toString():s)}static registerCustomType(){}},Dr=class{constructor(){Je(this,"contentType","text/csv")}encode(e){const t=this.encodeString(e);return new TextEncoder().encode(t).buffer}decode(e,t){const r=new TextDecoder().decode(e);return this.decodeString(r,t)}encodeString(e){if(!Array.isArray(e)||e.length===0||!Ge(e[0]))throw new Error("Payload must be an array of objects");const t=Object.keys(e[0]),r=[t.join(",")];return e.forEach(s=>{const i=t.map(a=>JSON.stringify(s[a]??""));r.push(i.join(","))}),r.join(`
|
|
2
2
|
`)}decodeString(e,t){const[r,...s]=e.trim().split(`
|
|
3
|
-
`).map(o=>o.trim());if(r.length===0)return t!=null?t.parse({}):{};const i=r.split(",").map(o=>o.trim()),a={};return i.forEach(o=>{a[o]=[]}),s.forEach(o=>{const c=o.split(",").map(l=>l.trim());i.forEach((l,p)=>{const y=this.parseValue(c[p]);y!=null&&a[l].push(y)})}),t!=null?t.parse(a):a}parseValue(e){if(e==null||e.length===0)return null;const t=Number(e);return isNaN(t)?e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e:t}static registerCustomType(){}},Dr=class{constructor(){Je(this,"contentType","text/plain")}encode(e){return new TextEncoder().encode(e).buffer}decode(e,t){const r=new TextDecoder().decode(e);return t!=null?t.parse(r):r}};const pt=new Br;new Ur;new Dr;var S;(function(n){n.assertEqual=s=>s;function e(s){}n.assertIs=e;function t(s){throw new Error}n.assertNever=t,n.arrayToEnum=s=>{const i={};for(const a of s)i[a]=a;return i},n.getValidEnumValues=s=>{const i=n.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),a={};for(const o of i)a[o]=s[o];return n.objectValues(a)},n.objectValues=s=>n.objectKeys(s).map(function(i){return s[i]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const a in s)Object.prototype.hasOwnProperty.call(s,a)&&i.push(a);return i},n.find=(s,i)=>{for(const a of s)if(i(a))return a},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}n.joinValues=r,n.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(S||(S={}));var Pt;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Pt||(Pt={}));const g=S.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),se=n=>{switch(typeof n){case"undefined":return g.undefined;case"string":return g.string;case"number":return isNaN(n)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(n)?g.array:n===null?g.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?g.promise:typeof Map<"u"&&n instanceof Map?g.map:typeof Set<"u"&&n instanceof Set?g.set:typeof Date<"u"&&n instanceof Date?g.date:g.object;default:return g.unknown}},f=S.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"]),Pr=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");class z extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)r._errors.push(t(a));else{let o=r,c=0;for(;c<a.path.length;){const l=a.path[c];c===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(a))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return s(this),r}static assert(e){if(!(e instanceof z))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,S.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];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))):r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}z.create=n=>new z(n);const $e=(n,e)=>{let t;switch(n.code){case f.invalid_type:n.received===g.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,S.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${S.joinValues(n.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${S.joinValues(n.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${S.joinValues(n.options)}, received '${n.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:S.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case f.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case f.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,S.assertNever(n)}return{message:t}};let Bn=$e;function Lr(n){Bn=n}function bt(){return Bn}const xt=n=>{const{data:e,path:t,errorMaps:r,issueData:s}=n,i=[...t,...s.path||[]],a={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let o="";const c=r.filter(l=>!!l).slice().reverse();for(const l of c)o=l(a,{data:e,defaultError:o}).message;return{...s,path:i,message:o}},Wr=[];function m(n,e){const t=bt(),r=xt({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===$e?void 0:$e].filter(s=>!!s)});n.common.issues.push(r)}class P{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const s of t){if(s.status==="aborted")return x;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const s of t){const i=await s.key,a=await s.value;r.push({key:i,value:a})}return P.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const s of t){const{key:i,value:a}=s;if(i.status==="aborted"||a.status==="aborted")return x;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(r[i.value]=a.value)}return{status:e.value,value:r}}}const x=Object.freeze({status:"aborted"}),Ae=n=>({status:"dirty",value:n}),W=n=>({status:"valid",value:n}),Lt=n=>n.status==="aborted",Wt=n=>n.status==="dirty",Te=n=>n.status==="valid",He=n=>typeof Promise<"u"&&n instanceof Promise;function _t(n,e,t,r){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function Un(n,e,t,r,s){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}var v;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(v||(v={}));var Ze,Be;class K{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,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 gn=(n,e)=>{if(Te(e))return{success:!0,data:e.value};if(!n.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 z(n.common.issues);return this._error=t,this._error}}};function _(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:s}=n;if(e&&(t||r))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,o)=>{var c,l;const{message:p}=n;return a.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:(c=p??r)!==null&&c!==void 0?c:o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:(l=p??t)!==null&&l!==void 0?l:o.defaultError}},description:s}}class O{get description(){return this._def.description}_getType(e){return se(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:se(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new P,ctx:{common:e.parent.common,data:e.data,parsedType:se(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(He(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const s={common:{issues:[],async:(r=t==null?void 0:t.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:se(e)},i=this._parseSync({data:e,path:s.path,parent:s});return gn(s,i)}"~validate"(e){var t,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:se(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:s});return Te(i)?{value:i.value}:{issues:s.common.issues}}catch(i){!((r=(t=i==null?void 0:i.message)===null||t===void 0?void 0:t.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(i=>Te(i)?{value:i.value}:{issues:s.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={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:se(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(He(s)?s:Promise.resolve(s));return gn(r,i)}refine(e,t){const r=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,i)=>{const a=e(s),o=()=>i.addIssue({code:f.custom,...r(s)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof t=="function"?t(r,s):t),!1))}_refinement(e){return new Y({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return X.create(this,this._def)}nullable(){return pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return F.create(this)}promise(){return Re.create(this,this._def)}or(e){return et.create([this,e],this._def)}and(e){return tt.create(this,e,this._def)}transform(e){return new Y({..._(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new at({..._(this._def),innerType:this,defaultValue:t,typeName:b.ZodDefault})}brand(){return new en({typeName:b.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ot({..._(this._def),innerType:this,catchValue:t,typeName:b.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return dt.create(this,e)}readonly(){return ut.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zr=/^c[^\s-]{8,}$/i,Vr=/^[0-9a-z]+$/,qr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Fr=/^[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,Yr=/^[a-z0-9_-]{21}$/i,Gr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Jr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Hr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Zt;const Kr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,es=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ts=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ns=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Dn="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ss=new RegExp(`^${Dn}$`);function Pn(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function is(n){return new RegExp(`^${Pn(n)}$`)}function Ln(n){let e=`${Dn}T${Pn(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function as(n,e){return!!((e==="v4"||!e)&&Kr.test(n)||(e==="v6"||!e)&&es.test(n))}function os(n,e){if(!Gr.test(n))return!1;try{const[t]=n.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function us(n,e){return!!((e==="v4"||!e)&&Qr.test(n)||(e==="v6"||!e)&&ts.test(n))}class q extends O{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const i=this._getOrReturnCtx(e);return m(i,{code:f.invalid_type,expected:g.string,received:i.parsedType}),x}const r=new P;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(s=this._getOrReturnCtx(e,s),a?m(s,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&m(s,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Hr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"email",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Zt||(Zt=new RegExp(Xr,"u")),Zt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"emoji",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Fr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"uuid",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Yr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"nanoid",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")zr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Vr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid2",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")qr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ulid",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),m(s,{validation:"url",code:f.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"regex",code:f.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Ln(i).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?ss.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?is(i).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Jr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:f.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?as(e.data,i.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ip",code:f.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?os(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"jwt",code:f.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?us(e.data,i.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cidr",code:f.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?ns.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:f.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?rs.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64url",code:f.invalid_string,message:i.message}),r.dirty()):S.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(s=>e.test(s),{validation:t,code:f.invalid_string,...v.errToObj(r)})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errToObj(e)})}datetime(e){var t,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!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,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...v.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...v.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...v.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}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 isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}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 isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}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}}q.create=n=>{var e;return new q({checks:[],typeName:b.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,..._(n)})};function cs(n,e){const t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=t>r?t:r,i=parseInt(n.toFixed(s).replace(".","")),a=parseInt(e.toFixed(s).replace(".",""));return i%a/Math.pow(10,s)}class de extends O{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)!==g.number){const i=this._getOrReturnCtx(e);return m(i,{code:f.invalid_type,expected:g.number,received:i.parsedType}),x}let r;const s=new P;for(const i of this._def.checks)i.kind==="int"?S.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:f.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?cs(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:f.not_finite,message:i.message}),s.dirty()):S.assertNever(i);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,r,s){return new de({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:v.toString(s)}]})}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.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"&&S.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}de.create=n=>new de({checks:[],typeName:b.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,..._(n)});class he extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let r;const s=new P;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):S.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:g.bigint,received:t.parsedType}),x}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,r,s){return new he({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:v.toString(s)}]})}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.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}}he.create=n=>{var e;return new he({checks:[],typeName:b.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,..._(n)})};class Xe extends O{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.boolean){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.boolean,received:r.parsedType}),x}return W(e.data)}}Xe.create=n=>new Xe({typeName:b.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,..._(n)});class Oe extends O{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const i=this._getOrReturnCtx(e);return m(i,{code:f.invalid_type,expected:g.date,received:i.parsedType}),x}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return m(i,{code:f.invalid_date}),x}const r=new P;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:f.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:f.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):S.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Oe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.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}}Oe.create=n=>new Oe({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:b.ZodDate,..._(n)});class Tt extends O{_parse(e){if(this._getType(e)!==g.symbol){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.symbol,received:r.parsedType}),x}return W(e.data)}}Tt.create=n=>new Tt({typeName:b.ZodSymbol,..._(n)});class Ke extends O{_parse(e){if(this._getType(e)!==g.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.undefined,received:r.parsedType}),x}return W(e.data)}}Ke.create=n=>new Ke({typeName:b.ZodUndefined,..._(n)});class Qe extends O{_parse(e){if(this._getType(e)!==g.null){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.null,received:r.parsedType}),x}return W(e.data)}}Qe.create=n=>new Qe({typeName:b.ZodNull,..._(n)});class Me extends O{constructor(){super(...arguments),this._any=!0}_parse(e){return W(e.data)}}Me.create=n=>new Me({typeName:b.ZodAny,..._(n)});class we extends O{constructor(){super(...arguments),this._unknown=!0}_parse(e){return W(e.data)}}we.create=n=>new we({typeName:b.ZodUnknown,..._(n)});class ae extends O{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:g.never,received:t.parsedType}),x}}ae.create=n=>new ae({typeName:b.ZodNever,..._(n)});class Ot extends O{_parse(e){if(this._getType(e)!==g.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.void,received:r.parsedType}),x}return W(e.data)}}Ot.create=n=>new Ot({typeName:b.ZodVoid,..._(n)});class F extends O{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==g.array)return m(t,{code:f.invalid_type,expected:g.array,received:t.parsedType}),x;if(s.exactLength!==null){const a=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(a||o)&&(m(t,{code:a?f.too_big:f.too_small,minimum:o?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(m(t,{code:f.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(m(t,{code:f.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>s.type._parseAsync(new K(t,a,t.path,o)))).then(a=>P.mergeArray(r,a));const i=[...t.data].map((a,o)=>s.type._parseSync(new K(t,a,t.path,o)));return P.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new F({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new F({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new F({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}}F.create=(n,e)=>new F({type:n,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,..._(e)});function ke(n){if(n instanceof R){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=X.create(ke(r))}return new R({...n._def,shape:()=>e})}else return n instanceof F?new F({...n._def,type:ke(n.element)}):n instanceof X?X.create(ke(n.unwrap())):n instanceof pe?pe.create(ke(n.unwrap())):n instanceof Q?Q.create(n.items.map(e=>ke(e))):n}class R extends O{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=S.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==g.object){const l=this._getOrReturnCtx(e);return m(l,{code:f.invalid_type,expected:g.object,received:l.parsedType}),x}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof ae&&this._def.unknownKeys==="strip"))for(const l in s.data)a.includes(l)||o.push(l);const c=[];for(const l of a){const p=i[l],y=s.data[l];c.push({key:{status:"valid",value:l},value:p._parse(new K(s,y,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof ae){const l=this._def.unknownKeys;if(l==="passthrough")for(const p of o)c.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(l==="strict")o.length>0&&(m(s,{code:f.unrecognized_keys,keys:o}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const p of o){const y=s.data[p];c.push({key:{status:"valid",value:p},value:l._parse(new K(s,y,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const p of c){const y=await p.key,j=await p.value;l.push({key:y,value:j,alwaysSet:p.alwaysSet})}return l}).then(l=>P.mergeObjectSync(r,l)):P.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new R({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var s,i,a,o;const c=(a=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.call(s,t,r).message)!==null&&a!==void 0?a:r.defaultError;return t.code==="unrecognized_keys"?{message:(o=v.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new R({...this._def,unknownKeys:"strip"})}passthrough(){return new R({...this._def,unknownKeys:"passthrough"})}extend(e){return new R({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new R({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:b.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new R({...this._def,catchall:e})}pick(e){const t={};return S.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new R({...this._def,shape:()=>t})}omit(e){const t={};return S.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new R({...this._def,shape:()=>t})}deepPartial(){return ke(this)}partial(e){const t={};return S.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}),new R({...this._def,shape:()=>t})}required(e){const t={};return S.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof X;)i=i._def.innerType;t[r]=i}}),new R({...this._def,shape:()=>t})}keyof(){return Wn(S.objectKeys(this.shape))}}R.create=(n,e)=>new R({shape:()=>n,unknownKeys:"strip",catchall:ae.create(),typeName:b.ZodObject,..._(e)});R.strictCreate=(n,e)=>new R({shape:()=>n,unknownKeys:"strict",catchall:ae.create(),typeName:b.ZodObject,..._(e)});R.lazycreate=(n,e)=>new R({shape:n,unknownKeys:"strip",catchall:ae.create(),typeName:b.ZodObject,..._(e)});class et extends O{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function s(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new z(o.ctx.common.issues));return m(t,{code:f.invalid_union,unionErrors:a}),x}if(t.common.async)return Promise.all(r.map(async i=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(s);{let i;const a=[];for(const c of r){const l={...t,common:{...t.common,issues:[]},parent:null},p=c._parseSync({data:t.data,path:t.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(c=>new z(c));return m(t,{code:f.invalid_union,unionErrors:o}),x}}get options(){return this._def.options}}et.create=(n,e)=>new et({options:n,typeName:b.ZodUnion,..._(e)});const ne=n=>n instanceof rt?ne(n.schema):n instanceof Y?ne(n.innerType()):n instanceof st?[n.value]:n instanceof fe?n.options:n instanceof it?S.objectValues(n.enum):n instanceof at?ne(n._def.innerType):n instanceof Ke?[void 0]:n instanceof Qe?[null]:n instanceof X?[void 0,...ne(n.unwrap())]:n instanceof pe?[null,...ne(n.unwrap())]:n instanceof en||n instanceof ut?ne(n.unwrap()):n instanceof ot?ne(n._def.innerType):[];class At extends O{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.object)return m(t,{code:f.invalid_type,expected:g.object,received:t.parsedType}),x;const r=this.discriminator,s=t.data[r],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(m(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const s=new Map;for(const i of t){const a=ne(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,i)}}return new At({typeName:b.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(r)})}}function zt(n,e){const t=se(n),r=se(e);if(n===e)return{valid:!0,data:n};if(t===g.object&&r===g.object){const s=S.objectKeys(e),i=S.objectKeys(n).filter(o=>s.indexOf(o)!==-1),a={...n,...e};for(const o of i){const c=zt(n[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(t===g.array&&r===g.array){if(n.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<n.length;i++){const a=n[i],o=e[i],c=zt(a,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===g.date&&r===g.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class tt extends O{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=(i,a)=>{if(Lt(i)||Lt(a))return x;const o=zt(i.value,a.value);return o.valid?((Wt(i)||Wt(a))&&t.dirty(),{status:t.value,value:o.data}):(m(r,{code:f.invalid_intersection_types}),x)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>s(i,a)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}tt.create=(n,e,t)=>new tt({left:n,right:e,typeName:b.ZodIntersection,..._(t)});class Q extends O{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.array)return m(r,{code:f.invalid_type,expected:g.array,received:r.parsedType}),x;if(r.data.length<this._def.items.length)return m(r,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&r.data.length>this._def.items.length&&(m(r,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...r.data].map((a,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new K(r,a,r.path,o)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>P.mergeArray(t,a)):P.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new Q({...this._def,rest:e})}}Q.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Q({items:n,typeName:b.ZodTuple,rest:null,..._(e)})};class nt extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.object)return m(r,{code:f.invalid_type,expected:g.object,received:r.parsedType}),x;const s=[],i=this._def.keyType,a=this._def.valueType;for(const o in r.data)s.push({key:i._parse(new K(r,o,r.path,o)),value:a._parse(new K(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?P.mergeObjectAsync(t,s):P.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof O?new nt({keyType:e,valueType:t,typeName:b.ZodRecord,..._(r)}):new nt({keyType:q.create(),valueType:e,typeName:b.ZodRecord,..._(t)})}}class St extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.map)return m(r,{code:f.invalid_type,expected:g.map,received:r.parsedType}),x;const s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([o,c],l)=>({key:s._parse(new K(r,o,r.path,[l,"key"])),value:i._parse(new K(r,c,r.path,[l,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of a){const l=await c.key,p=await c.value;if(l.status==="aborted"||p.status==="aborted")return x;(l.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(l.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of a){const l=c.key,p=c.value;if(l.status==="aborted"||p.status==="aborted")return x;(l.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(l.value,p.value)}return{status:t.value,value:o}}}}St.create=(n,e,t)=>new St({valueType:e,keyType:n,typeName:b.ZodMap,..._(t)});class Se extends O{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.set)return m(r,{code:f.invalid_type,expected:g.set,received:r.parsedType}),x;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(m(r,{code:f.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(m(r,{code:f.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const i=this._def.valueType;function a(c){const l=new Set;for(const p of c){if(p.status==="aborted")return x;p.status==="dirty"&&t.dirty(),l.add(p.value)}return{status:t.value,value:l}}const o=[...r.data.values()].map((c,l)=>i._parse(new K(r,c,r.path,l)));return r.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,t){return new Se({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new Se({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Se.create=(n,e)=>new Se({valueType:n,minSize:null,maxSize:null,typeName:b.ZodSet,..._(e)});class Ee extends O{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.function)return m(t,{code:f.invalid_type,expected:g.function,received:t.parsedType}),x;function r(o,c){return xt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bt(),$e].filter(l=>!!l),issueData:{code:f.invalid_arguments,argumentsError:c}})}function s(o,c){return xt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bt(),$e].filter(l=>!!l),issueData:{code:f.invalid_return_type,returnTypeError:c}})}const i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Re){const o=this;return W(async function(...c){const l=new z([]),p=await o._def.args.parseAsync(c,i).catch(U=>{throw l.addIssue(r(c,U)),l}),y=await Reflect.apply(a,this,p);return await o._def.returns._def.type.parseAsync(y,i).catch(U=>{throw l.addIssue(s(y,U)),l})})}else{const o=this;return W(function(...c){const l=o._def.args.safeParse(c,i);if(!l.success)throw new z([r(c,l.error)]);const p=Reflect.apply(a,this,l.data),y=o._def.returns.safeParse(p,i);if(!y.success)throw new z([s(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ee({...this._def,args:Q.create(e).rest(we.create())})}returns(e){return new Ee({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Ee({args:e||Q.create([]).rest(we.create()),returns:t||we.create(),typeName:b.ZodFunction,..._(r)})}}class rt extends O{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})}}rt.create=(n,e)=>new rt({getter:n,typeName:b.ZodLazy,..._(e)});class st extends O{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}}st.create=(n,e)=>new st({value:n,typeName:b.ZodLiteral,..._(e)});function Wn(n,e){return new fe({values:n,typeName:b.ZodEnum,..._(e)})}class fe extends O{constructor(){super(...arguments),Ze.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{expected:S.joinValues(r),received:t.parsedType,code:f.invalid_type}),x}if(_t(this,Ze)||Un(this,Ze,new Set(this._def.values)),!_t(this,Ze).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{received:t.data,code:f.invalid_enum_value,options:r}),x}return W(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,t=this._def){return fe.create(e,{...this._def,...t})}exclude(e,t=this._def){return fe.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}Ze=new WeakMap;fe.create=Wn;class it extends O{constructor(){super(...arguments),Be.set(this,void 0)}_parse(e){const t=S.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==g.string&&r.parsedType!==g.number){const s=S.objectValues(t);return m(r,{expected:S.joinValues(s),received:r.parsedType,code:f.invalid_type}),x}if(_t(this,Be)||Un(this,Be,new Set(S.getValidEnumValues(this._def.values))),!_t(this,Be).has(e.data)){const s=S.objectValues(t);return m(r,{received:r.data,code:f.invalid_enum_value,options:s}),x}return W(e.data)}get enum(){return this._def.values}}Be=new WeakMap;it.create=(n,e)=>new it({values:n,typeName:b.ZodNativeEnum,..._(e)});class Re extends O{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&t.common.async===!1)return m(t,{code:f.invalid_type,expected:g.promise,received:t.parsedType}),x;const r=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return W(r.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Re.create=(n,e)=>new Re({type:n,typeName:b.ZodPromise,..._(e)});class Y extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:a=>{m(r,a),a.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const a=s.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return x;const c=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return c.status==="aborted"?x:c.status==="dirty"||t.value==="dirty"?Ae(c.value):c});{if(t.value==="aborted")return x;const o=this._def.schema._parseSync({data:a,path:r.path,parent:r});return o.status==="aborted"?x:o.status==="dirty"||t.value==="dirty"?Ae(o.value):o}}if(s.type==="refinement"){const a=o=>{const c=s.refinement(o,i);if(r.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(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?x:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?x:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Te(a))return a;const o=s.transform(a.value,i);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:r.data,path:r.path,parent:r}).then(a=>Te(a)?Promise.resolve(s.transform(a.value,i)).then(o=>({status:t.value,value:o})):a);S.assertNever(s)}}Y.create=(n,e,t)=>new Y({schema:n,typeName:b.ZodEffects,effect:e,..._(t)});Y.createWithPreprocess=(n,e,t)=>new Y({schema:e,effect:{type:"preprocess",transform:n},typeName:b.ZodEffects,..._(t)});class X extends O{_parse(e){return this._getType(e)===g.undefined?W(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}X.create=(n,e)=>new X({innerType:n,typeName:b.ZodOptional,..._(e)});class pe extends O{_parse(e){return this._getType(e)===g.null?W(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pe.create=(n,e)=>new pe({innerType:n,typeName:b.ZodNullable,..._(e)});class at extends O{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===g.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}at.create=(n,e)=>new at({innerType:n,typeName:b.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class ot extends O{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return He(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new z(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new z(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ot.create=(n,e)=>new ot({innerType:n,typeName:b.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class Nt extends O{_parse(e){if(this._getType(e)!==g.nan){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.nan,received:r.parsedType}),x}return{status:"valid",value:e.data}}}Nt.create=n=>new Nt({typeName:b.ZodNaN,..._(n)});const ls=Symbol("zod_brand");class en extends O{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class dt extends O{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?x:i.status==="dirty"?(t.dirty(),Ae(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?x:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,t){return new dt({in:e,out:t,typeName:b.ZodPipeline})}}class ut extends O{_parse(e){const t=this._def.innerType._parse(e),r=s=>(Te(s)&&(s.value=Object.freeze(s.value)),s);return He(t)?t.then(s=>r(s)):r(t)}unwrap(){return this._def.innerType}}ut.create=(n,e)=>new ut({innerType:n,typeName:b.ZodReadonly,..._(e)});function vn(n,e){const t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function zn(n,e={},t){return n?Me.create().superRefine((r,s)=>{var i,a;const o=n(r);if(o instanceof Promise)return o.then(c=>{var l,p;if(!c){const y=vn(e,r),j=(p=(l=y.fatal)!==null&&l!==void 0?l:t)!==null&&p!==void 0?p:!0;s.addIssue({code:"custom",...y,fatal:j})}});if(!o){const c=vn(e,r),l=(a=(i=c.fatal)!==null&&i!==void 0?i:t)!==null&&a!==void 0?a:!0;s.addIssue({code:"custom",...c,fatal:l})}}):Me.create()}const ds={object:R.lazycreate};var b;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(b||(b={}));const hs=(n,e={message:`Input not instance of ${n.name}`})=>zn(t=>t instanceof n,e),Vn=q.create,qn=de.create,fs=Nt.create,ps=he.create,Fn=Xe.create,ms=Oe.create,ys=Tt.create,gs=Ke.create,vs=Qe.create,ws=Me.create,bs=we.create,xs=ae.create,_s=Ot.create,Ts=F.create,Os=R.create,Ss=R.strictCreate,Ns=et.create,Is=At.create,ks=tt.create,As=Q.create,Es=nt.create,$s=St.create,Ms=Se.create,Rs=Ee.create,Cs=rt.create,js=st.create,Zs=fe.create,Bs=it.create,Us=Re.create,wn=Y.create,Ds=X.create,Ps=pe.create,Ls=Y.createWithPreprocess,Ws=dt.create,zs=()=>Vn().optional(),Vs=()=>qn().optional(),qs=()=>Fn().optional(),Fs={string:n=>q.create({...n,coerce:!0}),number:n=>de.create({...n,coerce:!0}),boolean:n=>Xe.create({...n,coerce:!0}),bigint:n=>he.create({...n,coerce:!0}),date:n=>Oe.create({...n,coerce:!0})},Ys=x;var u=Object.freeze({__proto__:null,defaultErrorMap:$e,setErrorMap:Lr,getErrorMap:bt,makeIssue:xt,EMPTY_PATH:Wr,addIssueToContext:m,ParseStatus:P,INVALID:x,DIRTY:Ae,OK:W,isAborted:Lt,isDirty:Wt,isValid:Te,isAsync:He,get util(){return S},get objectUtil(){return Pt},ZodParsedType:g,getParsedType:se,ZodType:O,datetimeRegex:Ln,ZodString:q,ZodNumber:de,ZodBigInt:he,ZodBoolean:Xe,ZodDate:Oe,ZodSymbol:Tt,ZodUndefined:Ke,ZodNull:Qe,ZodAny:Me,ZodUnknown:we,ZodNever:ae,ZodVoid:Ot,ZodArray:F,ZodObject:R,ZodUnion:et,ZodDiscriminatedUnion:At,ZodIntersection:tt,ZodTuple:Q,ZodRecord:nt,ZodMap:St,ZodSet:Se,ZodFunction:Ee,ZodLazy:rt,ZodLiteral:st,ZodEnum:fe,ZodNativeEnum:it,ZodPromise:Re,ZodEffects:Y,ZodTransformer:Y,ZodOptional:X,ZodNullable:pe,ZodDefault:at,ZodCatch:ot,ZodNaN:Nt,BRAND:ls,ZodBranded:en,ZodPipeline:dt,ZodReadonly:ut,custom:zn,Schema:O,ZodSchema:O,late:ds,get ZodFirstPartyTypeKind(){return b},coerce:Fs,any:ws,array:Ts,bigint:ps,boolean:Fn,date:ms,discriminatedUnion:Is,effect:wn,enum:Zs,function:Rs,instanceof:hs,intersection:ks,lazy:Cs,literal:js,map:$s,nan:fs,nativeEnum:Bs,never:xs,null:vs,nullable:Ps,number:qn,object:Os,oboolean:qs,onumber:Vs,optional:Ds,ostring:zs,pipeline:Ws,preprocess:Ls,promise:Us,record:Es,set:Ms,strictObject:Ss,string:Vn,symbol:ys,transformer:wn,tuple:As,undefined:gs,union:Ns,unknown:bs,void:_s,NEVER:Ys,ZodIssueCode:f,quotelessJson:Pr,ZodError:z});const Gs=n=>n!=null&&typeof n=="object"&&"toString"in n,Js=(n,e=!1)=>{const t=Gs(n)?"stringer":typeof n;let r;switch(t){case"string":r=(s,i)=>s.localeCompare(i);break;case"stringer":r=(s,i)=>s.toString().localeCompare(i.toString());break;case"number":r=(s,i)=>Number(s)-Number(i);break;case"bigint":r=(s,i)=>BigInt(s)-BigInt(i)>0n?1:-1;break;case"boolean":r=(s,i)=>Number(s)-Number(i);break;case"undefined":r=()=>0;break;default:return console.warn(`sortFunc: unknown type ${t}`),()=>-1}return e?Hs(r):r},Hs=n=>(e,t)=>n(t,e),Et=u.tuple([u.number(),u.number()]);u.tuple([u.bigint(),u.bigint()]);const tn=u.object({width:u.number(),height:u.number()}),Xs=u.object({signedWidth:u.number(),signedHeight:u.number()}),Ks=["width","height"];u.enum(Ks);const Qs=["start","center","end"],ei=["signedWidth","signedHeight"];u.enum(ei);const ct=u.object({x:u.number(),y:u.number()}),Yn=u.object({clientX:u.number(),clientY:u.number()}),Gn=["x","y"],Jn=u.enum(Gn),Hn=["top","right","bottom","left"];u.enum(Hn);const nn=["left","right"],Xn=u.enum(nn),rn=["top","bottom"],Kn=u.enum(rn),Qn=["center"],bn=u.enum(Qn),ti=[...Hn,...Qn],er=u.enum(ti);u.enum(Qs);const ni=["first","last"];u.enum(ni);const ri=u.object({lower:u.number(),upper:u.number()}),si=u.object({lower:u.bigint(),upper:u.bigint()});u.union([ri,Et]);u.union([si,Et]);u.enum([...Jn.options,...er.options]);u.union([Jn,er,u.instanceof(String)]);const ii=n=>typeof n=="bigint"||n instanceof BigInt,Ie=(n,e)=>ii(n)?n.valueOf()*BigInt(e.valueOf()):n.valueOf()*Number(e.valueOf()),be=(n,e)=>{const t={};if(typeof n=="number"||typeof n=="bigint")e!=null?(t.lower=n,t.upper=e):(t.lower=typeof n=="bigint"?0n:0,t.upper=n);else if(Array.isArray(n)){if(n.length!==2)throw new Error("bounds: expected array of length 2");[t.lower,t.upper]=n}else return xn(n);return xn(t)},xn=n=>n.lower>n.upper?{lower:n.upper,upper:n.lower}:n,_n=(n,e)=>{const t=be(n);return e<t.lower?t.lower:e>=t.upper?t.upper-(typeof t.upper=="number"?1:1n):e},sn=n=>Gn.includes(n)?n:rn.includes(n)?"y":"x";u.object({x:Xn.or(bn),y:Kn.or(bn)});const ai=u.object({x:Xn,y:Kn}),an=Object.freeze({x:"left",y:"top"}),oi=Object.freeze({x:"right",y:"top"}),tr=Object.freeze({x:"left",y:"bottom"}),ui=Object.freeze({x:"right",y:"bottom"}),nr=(n,e)=>n.x===e.x&&n.y===e.y,ci=n=>[n.x,n.y],Vt=u.union([u.number(),ct,Et,tn,Xs,Yn]),M=(n,e)=>{if(typeof n=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return n==="x"?{x:e,y:0}:{x:0,y:e}}return typeof n=="number"?{x:n,y:e??n}:Array.isArray(n)?{x:n[0],y:n[1]}:"signedWidth"in n?{x:n.signedWidth,y:n.signedHeight}:"clientX"in n?{x:n.clientX,y:n.clientY}:"width"in n?{x:n.width,y:n.height}:{x:n.x,y:n.y}},ee=Object.freeze({x:0,y:0}),rr=Object.freeze({x:1,y:1}),li=Object.freeze({x:1/0,y:1/0}),di=Object.freeze({x:NaN,y:NaN}),It=(n,e,t=0)=>{const r=M(n),s=M(e);return t===0?r.x===s.x&&r.y===s.y:Math.abs(r.x-s.x)<=t&&Math.abs(r.y-s.y)<=t},hi=n=>It(n,ee),on=(n,e,t)=>{const r=M(n),s=M(e,t);return{x:r.x*s.x,y:r.y*s.y}},sr=(n,e)=>{const t=M(n);return{x:t.x+e,y:t.y}},ir=(n,e)=>{const t=M(n);return{x:t.x,y:t.y+e}},lt=(n,e,t,...r)=>typeof e=="string"&&typeof t=="number"?e==="x"?sr(n,t):ir(n,t):[n,e,t??ee,...r].reduce((s,i)=>{const a=M(i);return{x:s.x+a.x,y:s.y+a.y}},ee),fi=(n,e,t)=>{const r=M(n);return e==="x"?{x:t,y:r.y}:{x:r.x,y:t}},pi=(n,e)=>{const t=M(n),r=M(e);return Math.sqrt((t.x-r.x)**2+(t.y-r.y)**2)},mi=(n,e)=>{const t=M(n),r=M(e);return{x:r.x-t.x,y:r.y-t.y}},yi=n=>{const e=M(n);return Number.isNaN(e.x)||Number.isNaN(e.y)},gi=n=>{const e=M(n);return Number.isFinite(e.x)&&Number.isFinite(e.y)},vi=n=>{const e=M(n);return[e.x,e.y]},wi=n=>{const e=M(n);return{left:e.x,top:e.y}},qt=(n,e=0)=>{const t=M(n);return{x:Number(t.x.toFixed(e)),y:Number(t.y.toFixed(e))}},Ue=(n,e)=>{const t=M(n),r=M(e);return{x:t.x-r.x,y:t.y-r.y}},De=n=>{const e=M(n),t=Math.hypot(e.x,e.y);return t===0?{x:0,y:0}:{x:-e.y/t,y:e.x/t}},ar=n=>{const e=M(n),t=Math.hypot(e.x,e.y);return t===0?{x:0,y:0}:{x:e.x/t,y:e.y/t}},or=(...n)=>{const e=n.reduce((t,r)=>lt(t,r),ee);return on(e,1/n.length)},bi=(n,e)=>{const t=[];for(let r=0;r<n.length;r++){const s=n[r];let i,a,o,c;if(r===0){const l=n[r+1],p=Ue(l,s);a=De(p),o=a,c=e}else if(r===n.length-1){const l=n[r-1],p=Ue(s,l);i=De(p),o=i,c=e}else{const l=n[r-1],p=n[r+1],y=Ue(s,l),j=Ue(p,s);i=De(y),a=De(j);const U=Math.acos((y.x*j.x+y.y*j.y)/(Math.hypot(y.x,y.y)*Math.hypot(j.x,j.y))),Ce=Math.sin(U/2);Ce===0?c=e:c=e/Ce,o=ar(or(i,a))}t.push(on(o,c))}return t},kt=Object.freeze(Object.defineProperty({__proto__:null,INFINITY:li,NAN:di,ONE:rr,ZERO:ee,average:or,calculateMiters:bi,clientXY:Yn,construct:M,couple:vi,crudeZ:Vt,css:wi,distance:pi,equals:It,isFinite:gi,isNan:yi,isZero:hi,normal:De,normalize:ar,scale:on,set:fi,sub:Ue,translate:lt,translateX:sr,translateY:ir,translation:mi,truncate:qt,xy:ct},Symbol.toStringTag,{value:"Module"})),ft=u.union([u.number(),u.string()]),xi=u.object({top:ft,left:ft,width:ft,height:ft}),_i=u.object({left:u.number(),top:u.number(),right:u.number(),bottom:u.number()}),Ti=u.object({one:ct,two:ct,root:ai}),ur={one:ee,two:ee,root:an},Oi={one:ee,two:rr,root:tr},cr=(n,e)=>({one:n.one,two:n.two,root:e??n.root}),$=(n,e,t=0,r=0,s)=>{const i={one:{...ee},two:{...ee},root:s??an};if(typeof n=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return i.one={x:n,y:e},i.two={x:i.one.x+t,y:i.one.y+r},i}return"one"in n&&"two"in n&&"root"in n?{...n,root:s??n.root}:("getBoundingClientRect"in n&&(n=n.getBoundingClientRect()),"left"in n?(i.one={x:n.left,y:n.top},i.two={x:n.right,y:n.bottom},i):(i.one=n,e==null?i.two={x:i.one.x+t,y:i.one.y+r}:typeof e=="number"?i.two={x:i.one.x+e,y:i.one.y+t}:"width"in e?i.two={x:i.one.x+e.width,y:i.one.y+e.height}:"signedWidth"in e?i.two={x:i.one.x+e.signedWidth,y:i.one.y+e.signedHeight}:i.two=e,i))},Si=(n,e,t)=>{const r=$(n);if(typeof e=="string"){if(t==null)throw new Error("Invalid arguments for resize");const s=sn(e);return $(r.one,void 0,s==="x"?t:me(r),s==="y"?t:ye(r),r.root)}return $(r.one,e,void 0,void 0,r.root)},Ni=(n,e,t=!0)=>{const r=$(n);let s=(i,a)=>i<a;return t&&(s=(i,a)=>i<=a),"one"in e?s(ce(r),ce(e))&&s(xe(e),xe(r))&&s(le(r),le(e))&&s(_e(e),_e(r)):s(ce(r),e.x)&&s(e.x,xe(r))&&s(le(r),e.y)&&s(e.y,_e(r))},Ii=(n,e)=>It(n.one,e.one)&&It(n.two,e.two)&&nr(n.root,e.root),lr=n=>({width:me(n),height:ye(n)}),ki=n=>({signedWidth:$t(n),signedHeight:Mt(n)}),Ai=n=>({top:le(n),left:ce(n),width:me(n),height:ye(n)}),un=(n,e,t=!1)=>{const r=sn(e)==="y"?Mt(n):$t(n);return t?r:Math.abs(r)},ht=(n,e)=>{const t=$(n);return{x:e.x==="center"?Ft(t).x:Ne(t,e.x),y:e.y==="center"?Ft(t).y:Ne(t,e.y)}},Ne=(n,e)=>{const t=$(n),r=ci(t.root).includes(e)?Math.min:Math.max;return nn.includes(e)?r(t.one.x,t.two.x):r(t.one.y,t.two.y)},Ei=n=>n.one.x===n.two.x&&n.one.y===n.two.y,me=n=>un(n,"x"),ye=n=>un(n,"y"),$t=n=>{const e=$(n);return e.two.x-e.one.x},Mt=n=>{const e=$(n);return e.two.y-e.one.y},dr=n=>ht(n,an),$i=n=>ht(n,oi),Mi=n=>ht(n,tr),Ri=n=>ht(n,ui),xe=n=>Ne(n,"right"),_e=n=>Ne(n,"bottom"),ce=n=>Ne(n,"left"),le=n=>Ne(n,"top"),Ft=n=>lt(dr(n),{x:$t(n)/2,y:Mt(n)/2}),cn=n=>{const e=$(n);return e.root.x==="left"?ce(e):xe(e)},ln=n=>{const e=$(n);return e.root.y==="top"?le(e):_e(e)},Ci=n=>({x:cn(n),y:ln(n)}),mt=n=>{const e=$(n);return{lower:e.one.x,upper:e.two.x}},yt=n=>{const e=$(n);return{lower:e.one.y,upper:e.two.y}},ji=(n,e)=>cr(n,e),Zi=(n,e)=>{const t=$(n),r=nn.includes(e)?"x":rn.includes(e)?"y":null;if(r===null)throw new Error(`Invalid location: ${e}`);const s=e==="top"||e==="left"?Math.min:Math.max,i={...t.one},a={...t.two};return i[r]=s(t.one[r],t.two[r]),a[r]=s(t.one[r],t.two[r]),[i,a]},Bi=(n,e)=>{const t=$(n),r=$(e),s=cn(r)+(me(r)-me(t))/2,i=ln(r)+(ye(r)-ye(t))/2;return $({x:s,y:i},lr(t))},hr=n=>typeof n!="object"||n==null?!1:"one"in n&&"two"in n&&"root"in n,Ui=n=>me(n)/ye(n),Di=(n,e,t)=>{if(typeof e=="string"){if(t==null)throw new Error("Undefined amount passed into box.translate");const s=sn(e);e=M(s,t)}const r=$(n);return $(lt(r.one,e),lt(r.two,e),void 0,void 0,r.root)},Pi=(n,e)=>{const t=Math.max(ce(n),ce(e)),r=Math.max(le(n),le(e)),s=Math.min(xe(n),xe(e)),i=Math.min(_e(n),_e(e));return t>s||r>i?ur:$({x:t,y:r},{x:s,y:i},void 0,void 0,n.root)},Li=n=>me(n)*ye(n),Wi=(n,e)=>{const t=$(n);return $(qt(t.one,e),qt(t.two,e),void 0,void 0,t.root)},zi=(n,e,t,r,s,i)=>{const a={x:n,y:e},o={x:n+t,y:e+r};return s.x!==i.x&&(s.x==="center"?(a.x-=t/2,o.x-=t/2):(a.x-=t,o.x-=t)),s.y!==i.y&&(s.y==="center"?(a.y-=r/2,o.y-=r/2):(a.y-=r,o.y-=r)),$(a,o,void 0,void 0,i)},Pe=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:Oi,ZERO:ur,area:Li,areaIsZero:Ei,aspect:Ui,bottom:_e,bottomLeft:Mi,bottomRight:Ri,box:Ti,center:Ft,construct:$,constructWithAlternateRoot:zi,contains:Ni,copy:cr,css:Ai,cssBox:xi,dim:un,dims:lr,domRect:_i,edgePoints:Zi,equals:Ii,height:ye,intersection:Pi,isBox:hr,left:ce,loc:Ne,positionInCenter:Bi,reRoot:ji,resize:Si,right:xe,root:Ci,signedDims:ki,signedHeight:Mt,signedWidth:$t,top:le,topLeft:dr,topRight:$i,translate:Di,truncate:Wi,width:me,x:cn,xBounds:mt,xyLoc:ht,y:ln,yBounds:yt},Symbol.toStringTag,{value:"Module"})),fr=u.object({signedWidth:u.number(),signedHeight:u.number()}),Vi=u.union([tn,fr,ct,Et]),qi={width:0,height:0},Fi={width:1,height:1},G=(n,e)=>typeof n=="number"?{width:n,height:e??n}:Array.isArray(n)?{width:n[0],height:n[1]}:"x"in n?{width:n.x,height:n.y}:"signedWidth"in n?{width:n.signedWidth,height:n.signedHeight}:{...n},Yi=(n,e)=>{if(e==null)return!1;const t=G(n),r=G(e);return t.width===r.width&&t.height===r.height},Gi=n=>{const e=G(n);return{width:e.height,height:e.width}},Ji=n=>{const e=G(n);return`0 0 ${e.width} ${e.height}`},Hi=n=>{const e=G(n);return[e.width,e.height]},Xi=n=>({width:Math.max(...n.map(e=>G(e).width)),height:Math.max(...n.map(e=>G(e).height))}),Ki=n=>({width:Math.min(...n.map(e=>G(e).width)),height:Math.min(...n.map(e=>G(e).height))}),Qi=(n,e)=>{const t=G(n);return{width:t.width*e,height:t.height*e}},gt=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:Fi,ZERO:qi,construct:G,couple:Hi,crude:Vi,dimensions:tn,equals:Yi,max:Xi,min:Ki,scale:Qi,signed:fr,svgViewBox:Ji,swap:Gi},Symbol.toStringTag,{value:"Module"}));var ea=Object.defineProperty,ta=(n,e,t)=>e in n?ea(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ie=(n,e,t)=>ta(n,typeof e!="symbol"?e+"":e,t);const na=(n,e,t)=>e!==void 0&&n<e?e:t!==void 0&&n>t?t:n;u.object({offset:Vt,scale:Vt});u.object({offset:u.number(),scale:u.number()});const ra=n=>(e,t,r,s)=>t==="dimension"?[e,r]:[e,s?r-n:r+n],sa=n=>(e,t,r,s)=>[e,s?r/n:r*n],ia=n=>(e,t,r)=>{if(e===null)return[n,r];const{lower:s,upper:i}=e,{lower:a,upper:o}=n,c=i-s,l=o-a;if(t==="dimension")return[n,r*(l/c)];const p=(r-s)*(l/c)+a;return[n,p]},aa=n=>(e,t,r)=>[n,r],oa=()=>(n,e,t)=>{if(n===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[n,t];const{lower:r,upper:s}=n;return[n,s-(t-r)]},ua=n=>(e,t,r)=>{const{lower:s,upper:i}=n;return r=na(r,s,i),[e,r]},Yt=class Le{constructor(){ie(this,"ops",[]),ie(this,"currBounds",null),ie(this,"currType",null),ie(this,"reversed",!1),this.ops=[]}static translate(e){return new Le().translate(e)}static magnify(e){return new Le().magnify(e)}static scale(e,t){return new Le().scale(e,t)}translate(e){const t=this.new(),r=ra(e);return r.type="translate",t.ops.push(r),t}magnify(e){const t=this.new(),r=sa(e);return r.type="magnify",t.ops.push(r),t}scale(e,t){const r=be(e,t),s=this.new(),i=ia(r);return i.type="scale",s.ops.push(i),s}clamp(e,t){const r=be(e,t),s=this.new(),i=ua(r);return i.type="clamp",s.ops.push(i),s}reBound(e,t){const r=be(e,t),s=this.new(),i=aa(r);return i.type="re-bound",s.ops.push(i),s}invert(){const e=oa();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 Le;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([r,s],i)=>i(r,e,s,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((r,s)=>{if(r.type==="scale"||t.some(([a,o])=>s>=a&&s<=o))return;const i=e.ops.findIndex((a,o)=>a.type==="scale"&&o>s);i!==-1&&t.push([s,i])}),t.forEach(([r,s])=>{const i=e.ops.slice(r,s);i.unshift(e.ops[s]),e.ops.splice(r,s-r+1,...i)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};ie(Yt,"IDENTITY",new Yt);let Tn=Yt;const On=class re{constructor(e=new Tn,t=new Tn,r=null){ie(this,"x"),ie(this,"y"),ie(this,"currRoot"),this.x=e,this.y=t,this.currRoot=r}static translate(e,t){return new re().translate(e,t)}static translateX(e){return new re().translateX(e)}static translateY(e){return new re().translateY(e)}static clamp(e){return new re().clamp(e)}static magnify(e){return new re().magnify(e)}static scale(e){return new re().scale(e)}static reBound(e){return new re().reBound(e)}translate(e,t){const r=M(e,t),s=this.copy();return s.x=this.x.translate(r.x),s.y=this.y.translate(r.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(hr(e)){const r=this.currRoot;return t.currRoot=e.root,r!=null&&!nr(r,e.root)&&(r.x!==e.root.x&&(t.x=t.x.invert()),r.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(mt(e)),t.y=t.y.scale(yt(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(mt(e)),t.y=this.y.reBound(yt(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(mt(e)),t.y=this.y.clamp(yt(e)),t}copy(){const e=new re;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return $(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}};ie(On,"IDENTITY",new On);var ca=Object.defineProperty,la=(n,e,t)=>e in n?ca(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,h=(n,e,t)=>la(n,typeof e!="symbol"?e+"":e,t);let da=(n,e=21)=>(t=e)=>{let r="",s=t|0;for(;s--;)r+=n[Math.random()*n.length|0];return r};const ha="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",fa=da(ha,11),pr=()=>fa(),Gt=Object.freeze(Object.defineProperty({__proto__:null,create:pr},Symbol.toStringTag,{value:"Module"})),pa=u.enum(["static","dynamic"]),mr=(n,e)=>{const t=new E(e);if(![A.DAY,A.HOUR,A.MINUTE,A.SECOND,A.MILLISECOND,A.MICROSECOND,A.NANOSECOND].some(s=>s.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const r=n.valueOf()%t.valueOf();return n instanceof E?new E(r):new A(r)},I=class w{constructor(e,t="UTC"){if(h(this,"value"),h(this,"encodeValue",!0),e==null)this.value=w.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*w.MILLISECOND.valueOf();else if(typeof e=="string")this.value=w.parseDateTimeString(e,t).valueOf();else if(Array.isArray(e))this.value=w.parseDate(e);else{let r=BigInt(0);e instanceof Number&&(e=e.valueOf()),t==="local"&&(r=w.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=w.MAX:e=w.MIN)),this.value=BigInt(e.valueOf())+r}}static parseDate([e=1970,t=1,r=1]){const s=new Date(e,t-1,r,0,0,0,0);return new w(BigInt(s.getTime())*w.MILLISECOND.valueOf()).truncate(w.DAY).valueOf()}encode(){return this.value.toString()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[r,s,i]=e.split(":");let a="00",o="00";i!=null&&([a,o]=i.split("."));let c=w.hours(parseInt(r??"00")).add(w.minutes(parseInt(s??"00"))).add(w.seconds(parseInt(a??"00"))).add(w.milliseconds(parseInt(o??"00")));return t==="local"&&(c=c.add(w.utcOffset)),c.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return w.parseTimeString(e,t);const r=new Date(e);return e.includes(":")||r.setUTCHours(0,0,0,0),new w(BigInt(r.getTime())*w.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();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(w.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const r=this.toISOString(t);return e?r.slice(11,23):r.slice(11,19)}dateString(){const e=this.date(),t=e.toLocaleString("default",{month:"short"}),r=e.toLocaleString("default",{day:"numeric"});return`${t} ${r}`}static get utcOffset(){return new A(BigInt(new Date().getTimezoneOffset())*w.MINUTE.valueOf())}static since(e){return new w().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new w(e).valueOf()}span(e){return this.range(e).span}range(e){return new dn(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new w(e).valueOf()}afterEq(e){return this.valueOf()>=new w(e).valueOf()}before(e){return this.valueOf()<new w(e).valueOf()}beforeEq(e){return this.valueOf()<=new w(e).valueOf()}add(e){return new w(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new w(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(A.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(A.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(A.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(A.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(w.MILLISECOND.valueOf())}get year(){return this.date().getFullYear()}setYear(e){const t=this.date();return t.setFullYear(e),new w(t)}get month(){return this.date().getMonth()}setMonth(e){const t=this.date();return t.setMonth(e),new w(t)}get day(){return this.date().getDate()}setDay(e){const t=this.date();return t.setDate(e),new w(t)}get hour(){return this.date().getHours()}setHour(e){const t=this.date();return t.setHours(e),new w(t)}get minute(){return this.date().getMinutes()}setMinute(e){const t=this.date();return t.setMinutes(e),new w(t)}get second(){return this.date().getSeconds()}setSecond(e){const t=this.date();return t.setSeconds(e),new w(t)}get millisecond(){return this.date().getMilliseconds()}setMillisecond(e){const t=this.date();return t.setMilliseconds(e),new w(t)}toString(){return this.date().toISOString()}remainder(e){return mr(this,e)}get isToday(){return this.truncate(A.DAY).equals(w.now().truncate(A.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new w(new Date)}static max(...e){let t=w.MIN;for(const r of e){const s=new w(r);s.after(t)&&(t=s)}return t}static min(...e){let t=w.MAX;for(const r of e){const s=new w(r);s.before(t)&&(t=s)}return t}static nanoseconds(e){return new w(e)}static microseconds(e){return w.nanoseconds(e*1e3)}static milliseconds(e){return w.microseconds(e*1e3)}static seconds(e){return w.milliseconds(e*1e3)}static minutes(e){return w.seconds(e*60)}static hours(e){return w.minutes(e*60)}static days(e){return w.hours(e*24)}};h(I,"NANOSECOND",I.nanoseconds(1)),h(I,"MICROSECOND",I.microseconds(1)),h(I,"MILLISECOND",I.milliseconds(1)),h(I,"SECOND",I.seconds(1)),h(I,"MINUTE",I.minutes(1)),h(I,"HOUR",I.hours(1)),h(I,"DAY",I.days(1)),h(I,"MAX",new I((1n<<63n)-1n)),h(I,"MIN",new I(0)),h(I,"ZERO",new I(0)),h(I,"z",u.union([u.object({value:u.bigint()}).transform(n=>new I(n.value)),u.string().transform(n=>new I(BigInt(n))),u.instanceof(Number).transform(n=>new I(n)),u.number().transform(n=>new I(n)),u.instanceof(I)]));let E=I;const k=class T{constructor(e){h(this,"value"),h(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}static fromSeconds(e){return e instanceof T?e:e instanceof Sn?e.period:e instanceof E?new T(e):["number","bigint"].includes(typeof e)?T.seconds(e):new T(e)}static fromMilliseconds(e){return e instanceof T?e:e instanceof Sn?e.period:e instanceof E?new T(e):["number","bigint"].includes(typeof e)?T.milliseconds(e):new T(e)}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(e){return this.valueOf()<new T(e).valueOf()}greaterThan(e){return this.valueOf()>new T(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new T(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new T(e).valueOf()}remainder(e){return mr(this,e)}truncate(e){return new T(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(T.DAY),t=this.truncate(T.HOUR),r=this.truncate(T.MINUTE),s=this.truncate(T.SECOND),i=this.truncate(T.MILLISECOND),a=this.truncate(T.MICROSECOND),o=this.truncate(T.NANOSECOND),c=e,l=t.sub(e),p=r.sub(t),y=s.sub(r),j=i.sub(s),U=a.sub(i),Ce=o.sub(a);let oe="";return c.isZero||(oe+=`${c.days}d `),l.isZero||(oe+=`${l.hours}h `),p.isZero||(oe+=`${p.minutes}m `),y.isZero||(oe+=`${y.seconds}s `),j.isZero||(oe+=`${j.milliseconds}ms `),U.isZero||(oe+=`${U.microseconds}µs `),Ce.isZero||(oe+=`${Ce.nanoseconds}ns`),oe.trim()}mult(e){return new T(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(T.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(T.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(T.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(T.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(T.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(T.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new T(e).valueOf()}add(e){return new T(this.valueOf()+new T(e).valueOf())}sub(e){return new T(this.valueOf()-new T(e).valueOf())}static nanoseconds(e=1){return new T(e)}static microseconds(e=1){return T.nanoseconds(Ie(e,1e3))}static milliseconds(e=1){return T.microseconds(Ie(e,1e3))}static seconds(e=1){return T.milliseconds(Ie(e,1e3))}static minutes(e=1){return T.seconds(Ie(e,60))}static hours(e){return T.minutes(Ie(e,60))}static days(e){return T.hours(Ie(e,24))}};h(k,"NANOSECOND",k.nanoseconds(1)),h(k,"MICROSECOND",k.microseconds(1)),h(k,"MILLISECOND",k.milliseconds(1)),h(k,"SECOND",k.seconds(1)),h(k,"MINUTE",k.minutes(1)),h(k,"HOUR",k.hours(1)),h(k,"DAY",k.days(1)),h(k,"MAX",new k((1n<<63n)-1n)),h(k,"MIN",new k(0)),h(k,"ZERO",new k(0)),h(k,"z",u.union([u.object({value:u.bigint()}).transform(n=>new k(n.value)),u.string().transform(n=>new k(BigInt(n))),u.instanceof(Number).transform(n=>new k(n)),u.number().transform(n=>new k(n)),u.instanceof(k)]));let A=k;const We=class vt extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new vt(e).valueOf()}get period(){return A.seconds(1/this.valueOf())}sampleCount(e){return new A(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new L(t).valueOf()}span(e){return A.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new vt(e)}static khz(e){return vt.hz(e*1e3)}};h(We,"z",u.union([u.number().transform(n=>new We(n)),u.instanceof(Number).transform(n=>new We(n)),u.instanceof(We)]));let Sn=We;const B=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Jt(e*this.valueOf())}};h(B,"UNKNOWN",new B(0)),h(B,"BIT128",new B(16)),h(B,"BIT64",new B(8)),h(B,"BIT32",new B(4)),h(B,"BIT16",new B(2)),h(B,"BIT8",new B(1)),h(B,"z",u.union([u.number().transform(n=>new B(n)),u.instanceof(Number).transform(n=>new B(n)),u.instanceof(B)]));let L=B;const J=class wt{constructor(e,t){h(this,"start"),h(this,"end"),typeof e=="object"&&"start"in e?(this.start=new E(e.start),this.end=new E(e.end)):(this.start=new E(e),this.end=new E(t))}get span(){return new A(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new wt(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,t=A.ZERO){e=e.makeValid();const r=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(r.start)||r.end.equals(e.start))return!1;const s=E.max(r.start,e.start),i=E.min(r.end,e.end);return i.before(s)?!1:new A(i.sub(s)).greaterThanOrEqual(t)}roughlyEquals(e,t){let r=this.start.sub(e.start).valueOf(),s=this.end.sub(e.end).valueOf();return r<0&&(r=-r),s<0&&(s=-s),r<=t.valueOf()&&s<=t.valueOf()}contains(e){return e instanceof wt?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new wt(this.start,this.end);return e.start.after(this.start)&&(t.start=e.start),e.start.after(this.end)&&(t.end=e.start),e.end.before(this.end)&&(t.end=e.end),e.end.before(this.start)&&(t.start=e.end),t}};h(J,"MAX",new J(E.MIN,E.MAX)),h(J,"MIN",new J(E.MAX,E.MIN)),h(J,"ZERO",new J(E.ZERO,E.ZERO)),h(J,"z",u.union([u.object({start:E.z,end:E.z}).transform(n=>new J(n.start,n.end)),u.instanceof(J)]));let dn=J;const d=class C extends String{constructor(e){if(e instanceof C||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}const t=C.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}throw super(C.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=C.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(t=>this.equals(t))}toString(){return this.valueOf()}get isVariable(){return this.equals(C.JSON)||this.equals(C.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(C.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=C.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsigned(){return this.equals(C.UINT8)||this.equals(C.UINT16)||this.equals(C.UINT32)||this.equals(C.UINT64)}get isSigned(){return this.equals(C.INT8)||this.equals(C.INT16)||this.equals(C.INT32)||this.equals(C.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsigned&&e.isSigned?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(C.INT32)&&e.equals(C.FLOAT64)||this.equals(C.INT8)&&e.equals(C.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsigned===e.isUnsigned:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return C.BIG_INT_TYPES.some(e=>e.equals(this))}};h(d,"UNKNOWN",new d("unknown")),h(d,"FLOAT64",new d("float64")),h(d,"FLOAT32",new d("float32")),h(d,"INT64",new d("int64")),h(d,"INT32",new d("int32")),h(d,"INT16",new d("int16")),h(d,"INT8",new d("int8")),h(d,"UINT64",new d("uint64")),h(d,"UINT32",new d("uint32")),h(d,"UINT16",new d("uint16")),h(d,"UINT8",new d("uint8")),h(d,"BOOLEAN",d.UINT8),h(d,"TIMESTAMP",new d("timestamp")),h(d,"UUID",new d("uuid")),h(d,"STRING",new d("string")),h(d,"JSON",new d("json")),h(d,"ARRAY_CONSTRUCTORS",new Map([[d.UINT8.toString(),Uint8Array],[d.UINT16.toString(),Uint16Array],[d.UINT32.toString(),Uint32Array],[d.UINT64.toString(),BigUint64Array],[d.FLOAT32.toString(),Float32Array],[d.FLOAT64.toString(),Float64Array],[d.INT8.toString(),Int8Array],[d.INT16.toString(),Int16Array],[d.INT32.toString(),Int32Array],[d.INT64.toString(),BigInt64Array],[d.TIMESTAMP.toString(),BigInt64Array],[d.STRING.toString(),Uint8Array],[d.JSON.toString(),Uint8Array],[d.UUID.toString(),Uint8Array]])),h(d,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,d.UINT8],[Uint16Array.name,d.UINT16],[Uint32Array.name,d.UINT32],[BigUint64Array.name,d.UINT64],[Float32Array.name,d.FLOAT32],[Float64Array.name,d.FLOAT64],[Int8Array.name,d.INT8],[Int16Array.name,d.INT16],[Int32Array.name,d.INT32],[BigInt64Array.name,d.INT64]])),h(d,"DENSITIES",new Map([[d.UINT8.toString(),L.BIT8],[d.UINT16.toString(),L.BIT16],[d.UINT32.toString(),L.BIT32],[d.UINT64.toString(),L.BIT64],[d.FLOAT32.toString(),L.BIT32],[d.FLOAT64.toString(),L.BIT64],[d.INT8.toString(),L.BIT8],[d.INT16.toString(),L.BIT16],[d.INT32.toString(),L.BIT32],[d.INT64.toString(),L.BIT64],[d.TIMESTAMP.toString(),L.BIT64],[d.STRING.toString(),L.UNKNOWN],[d.JSON.toString(),L.UNKNOWN],[d.UUID.toString(),L.BIT128]])),h(d,"ALL",[d.UNKNOWN,d.FLOAT64,d.FLOAT32,d.INT64,d.INT32,d.INT16,d.INT8,d.UINT64,d.UINT32,d.UINT16,d.UINT8,d.TIMESTAMP,d.UUID,d.STRING,d.JSON]),h(d,"BIG_INT_TYPES",[d.INT64,d.UINT64,d.TIMESTAMP]),h(d,"z",u.union([u.string().transform(n=>new d(n)),u.instanceof(d)]));let N=d;const D=class Z extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Z.bytes(this.valueOf()+e.valueOf())}sub(e){return Z.bytes(this.valueOf()-e.valueOf())}truncate(e){return new Z(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return Z.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/Z.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/Z.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/Z.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/Z.TERABYTE.valueOf()}toString(){const e=this.truncate(Z.TERABYTE),t=this.truncate(Z.GIGABYTE),r=this.truncate(Z.MEGABYTE),s=this.truncate(Z.KILOBYTE),i=this.truncate(Z.BYTE),a=e,o=t.sub(e),c=r.sub(t),l=s.sub(r),p=i.sub(s);let y="";return a.isZero||(y+=`${a.terabytes}TB `),o.isZero||(y+=`${o.gigabytes}GB `),c.isZero||(y+=`${c.megabytes}MB `),l.isZero||(y+=`${l.kilobytes}KB `),(!p.isZero||y==="")&&(y+=`${p.valueOf()}B`),y.trim()}static bytes(e=1){return new Z(e)}static kilobytes(e=1){return Z.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Z.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Z.megabytes(e.valueOf()*1e3)}static terabytes(e){return Z.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};h(D,"BYTE",new D(1)),h(D,"KILOBYTE",D.kilobytes(1)),h(D,"MEGABYTE",D.megabytes(1)),h(D,"GIGABYTE",D.gigabytes(1)),h(D,"TERABYTE",D.terabytes(1)),h(D,"ZERO",new D(0)),h(D,"z",u.union([u.number().transform(n=>new D(n)),u.instanceof(D)]));let Jt=D;u.union([u.instanceof(Uint8Array),u.instanceof(Uint16Array),u.instanceof(Uint32Array),u.instanceof(BigUint64Array),u.instanceof(Float32Array),u.instanceof(Float64Array),u.instanceof(Int8Array),u.instanceof(Int16Array),u.instanceof(Int32Array),u.instanceof(BigInt64Array)]);const yr=n=>{const e=typeof n;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||n instanceof E||n instanceof A||n instanceof Date},ma=(n,e,t,r=0)=>n.usesBigInt&&!e.usesBigInt?Number(t)-Number(r):!n.usesBigInt&&e.usesBigInt?BigInt(t.valueOf())-BigInt(r.valueOf()):ze(t,-r).valueOf(),ze=(n,e)=>typeof n=="bigint"&&typeof e=="bigint"||typeof n=="number"&&typeof e=="number"?n+e:e===0?n:n===0?e:Number(n)+Number(e),ya=n=>n==null?!1:Array.isArray(n)||n instanceof ArrayBuffer||ArrayBuffer.isView(n)&&!(n instanceof DataView)||n instanceof wa?!0:yr(n),ue=-1,ga=u.string().transform(n=>new Uint8Array(atob(n).split("").map(e=>e.charCodeAt(0))).buffer),va=u.union([u.null(),u.undefined()]).transform(()=>new Uint8Array().buffer),Ht=10,Ve=class H{constructor(e){h(this,"key",""),h(this,"isSynnaxSeries",!0),h(this,"dataType"),h(this,"sampleOffset"),h(this,"gl"),h(this,"_data"),h(this,"_timeRange"),h(this,"alignment",0n),h(this,"_cachedMin"),h(this,"_cachedMax"),h(this,"writePos",ue),h(this,"_refCount",0),h(this,"_cachedLength"),h(this,"_cachedIndexes"),ya(e)&&(e={data:e});const{dataType:t,timeRange:r,sampleOffset:s=0,glBufferUsage:i="static",alignment:a=0n,key:o=pr()}=e,c=e.data??[];if(c instanceof H||typeof c=="object"&&"isSynnaxSeries"in c&&c.isSynnaxSeries===!0){const y=c;this.key=y.key,this.dataType=y.dataType,this.sampleOffset=y.sampleOffset,this.gl=y.gl,this._data=y._data,this._timeRange=y._timeRange,this.alignment=y.alignment,this._cachedMin=y._cachedMin,this._cachedMax=y._cachedMax,this.writePos=y.writePos,this._refCount=y._refCount,this._cachedLength=y._cachedLength;return}const l=yr(c),p=Array.isArray(c);if(t!=null)this.dataType=new N(t);else{if(c instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(p||l){let y=c;if(!l){if(c.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");y=c[0]}if(typeof y=="string")this.dataType=N.STRING;else if(typeof y=="number")this.dataType=N.FLOAT64;else if(typeof y=="bigint")this.dataType=N.INT64;else if(typeof y=="boolean")this.dataType=N.BOOLEAN;else if(y instanceof E||y instanceof Date||y instanceof E)this.dataType=N.TIMESTAMP;else if(typeof y=="object")this.dataType=N.JSON;else throw new Error(`cannot infer data type of ${typeof y} when constructing a Series from a JS array`)}else this.dataType=new N(c)}if(!p&&!l)this._data=c;else{let y=l?[c]:c;const j=y[0];(j instanceof E||j instanceof Date||j instanceof A)&&(y=y.map(U=>new E(U).valueOf())),this.dataType.equals(N.STRING)?(this._cachedLength=y.length,this._data=new TextEncoder().encode(`${y.join(`
|
|
3
|
+
`).map(o=>o.trim());if(r.length===0)return t!=null?t.parse({}):{};const i=r.split(",").map(o=>o.trim()),a={};return i.forEach(o=>{a[o]=[]}),s.forEach(o=>{const c=o.split(",").map(l=>l.trim());i.forEach((l,p)=>{const y=this.parseValue(c[p]);y!=null&&a[l].push(y)})}),t!=null?t.parse(a):a}parseValue(e){if(e==null||e.length===0)return null;const t=Number(e);return isNaN(t)?e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e:t}static registerCustomType(){}},Ur=class{constructor(){Je(this,"contentType","text/plain")}encode(e){return new TextEncoder().encode(e).buffer}decode(e,t){const r=new TextDecoder().decode(e);return t!=null?t.parse(r):r}};const pt=new Br;new Dr;new Ur;var S;(function(n){n.assertEqual=s=>s;function e(s){}n.assertIs=e;function t(s){throw new Error}n.assertNever=t,n.arrayToEnum=s=>{const i={};for(const a of s)i[a]=a;return i},n.getValidEnumValues=s=>{const i=n.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),a={};for(const o of i)a[o]=s[o];return n.objectValues(a)},n.objectValues=s=>n.objectKeys(s).map(function(i){return s[i]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const a in s)Object.prototype.hasOwnProperty.call(s,a)&&i.push(a);return i},n.find=(s,i)=>{for(const a of s)if(i(a))return a},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}n.joinValues=r,n.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(S||(S={}));var Pt;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Pt||(Pt={}));const g=S.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),se=n=>{switch(typeof n){case"undefined":return g.undefined;case"string":return g.string;case"number":return isNaN(n)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(n)?g.array:n===null?g.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?g.promise:typeof Map<"u"&&n instanceof Map?g.map:typeof Set<"u"&&n instanceof Set?g.set:typeof Date<"u"&&n instanceof Date?g.date:g.object;default:return g.unknown}},f=S.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"]),Pr=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");class z extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)r._errors.push(t(a));else{let o=r,c=0;for(;c<a.path.length;){const l=a.path[c];c===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(a))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return s(this),r}static assert(e){if(!(e instanceof z))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,S.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];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))):r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}z.create=n=>new z(n);const $e=(n,e)=>{let t;switch(n.code){case f.invalid_type:n.received===g.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,S.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${S.joinValues(n.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${S.joinValues(n.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${S.joinValues(n.options)}, received '${n.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:S.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case f.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case f.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,S.assertNever(n)}return{message:t}};let Bn=$e;function Lr(n){Bn=n}function bt(){return Bn}const xt=n=>{const{data:e,path:t,errorMaps:r,issueData:s}=n,i=[...t,...s.path||[]],a={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let o="";const c=r.filter(l=>!!l).slice().reverse();for(const l of c)o=l(a,{data:e,defaultError:o}).message;return{...s,path:i,message:o}},Wr=[];function m(n,e){const t=bt(),r=xt({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===$e?void 0:$e].filter(s=>!!s)});n.common.issues.push(r)}class P{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const s of t){if(s.status==="aborted")return x;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const s of t){const i=await s.key,a=await s.value;r.push({key:i,value:a})}return P.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const s of t){const{key:i,value:a}=s;if(i.status==="aborted"||a.status==="aborted")return x;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(r[i.value]=a.value)}return{status:e.value,value:r}}}const x=Object.freeze({status:"aborted"}),Ae=n=>({status:"dirty",value:n}),W=n=>({status:"valid",value:n}),Lt=n=>n.status==="aborted",Wt=n=>n.status==="dirty",Te=n=>n.status==="valid",He=n=>typeof Promise<"u"&&n instanceof Promise;function _t(n,e,t,r){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function Dn(n,e,t,r,s){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}var v;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(v||(v={}));var Ze,Be;class K{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,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 gn=(n,e)=>{if(Te(e))return{success:!0,data:e.value};if(!n.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 z(n.common.issues);return this._error=t,this._error}}};function _(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:s}=n;if(e&&(t||r))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,o)=>{var c,l;const{message:p}=n;return a.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:(c=p??r)!==null&&c!==void 0?c:o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:(l=p??t)!==null&&l!==void 0?l:o.defaultError}},description:s}}class O{get description(){return this._def.description}_getType(e){return se(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:se(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new P,ctx:{common:e.parent.common,data:e.data,parsedType:se(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(He(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const s={common:{issues:[],async:(r=t==null?void 0:t.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:se(e)},i=this._parseSync({data:e,path:s.path,parent:s});return gn(s,i)}"~validate"(e){var t,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:se(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:s});return Te(i)?{value:i.value}:{issues:s.common.issues}}catch(i){!((r=(t=i==null?void 0:i.message)===null||t===void 0?void 0:t.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(i=>Te(i)?{value:i.value}:{issues:s.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={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:se(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(He(s)?s:Promise.resolve(s));return gn(r,i)}refine(e,t){const r=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,i)=>{const a=e(s),o=()=>i.addIssue({code:f.custom,...r(s)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof t=="function"?t(r,s):t),!1))}_refinement(e){return new Y({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return X.create(this,this._def)}nullable(){return pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return F.create(this)}promise(){return Ce.create(this,this._def)}or(e){return et.create([this,e],this._def)}and(e){return tt.create(this,e,this._def)}transform(e){return new Y({..._(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new at({..._(this._def),innerType:this,defaultValue:t,typeName:b.ZodDefault})}brand(){return new en({typeName:b.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ot({..._(this._def),innerType:this,catchValue:t,typeName:b.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return dt.create(this,e)}readonly(){return ut.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zr=/^c[^\s-]{8,}$/i,Vr=/^[0-9a-z]+$/,qr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Fr=/^[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,Yr=/^[a-z0-9_-]{21}$/i,Gr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Jr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Hr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Zt;const Kr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,es=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ts=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ns=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Un="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ss=new RegExp(`^${Un}$`);function Pn(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function is(n){return new RegExp(`^${Pn(n)}$`)}function Ln(n){let e=`${Un}T${Pn(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function as(n,e){return!!((e==="v4"||!e)&&Kr.test(n)||(e==="v6"||!e)&&es.test(n))}function os(n,e){if(!Gr.test(n))return!1;try{const[t]=n.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function us(n,e){return!!((e==="v4"||!e)&&Qr.test(n)||(e==="v6"||!e)&&ts.test(n))}class q extends O{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const i=this._getOrReturnCtx(e);return m(i,{code:f.invalid_type,expected:g.string,received:i.parsedType}),x}const r=new P;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(s=this._getOrReturnCtx(e,s),a?m(s,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&m(s,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Hr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"email",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Zt||(Zt=new RegExp(Xr,"u")),Zt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"emoji",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Fr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"uuid",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Yr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"nanoid",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")zr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Vr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid2",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")qr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ulid",code:f.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),m(s,{validation:"url",code:f.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"regex",code:f.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Ln(i).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?ss.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?is(i).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:f.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?Jr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:f.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?as(e.data,i.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ip",code:f.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?os(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"jwt",code:f.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?us(e.data,i.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cidr",code:f.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?ns.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:f.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?rs.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64url",code:f.invalid_string,message:i.message}),r.dirty()):S.assertNever(i);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(s=>e.test(s),{validation:t,code:f.invalid_string,...v.errToObj(r)})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errToObj(e)})}datetime(e){var t,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!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,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...v.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...v.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...v.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}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 isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}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 isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}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}}q.create=n=>{var e;return new q({checks:[],typeName:b.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,..._(n)})};function cs(n,e){const t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=t>r?t:r,i=parseInt(n.toFixed(s).replace(".","")),a=parseInt(e.toFixed(s).replace(".",""));return i%a/Math.pow(10,s)}class de extends O{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)!==g.number){const i=this._getOrReturnCtx(e);return m(i,{code:f.invalid_type,expected:g.number,received:i.parsedType}),x}let r;const s=new P;for(const i of this._def.checks)i.kind==="int"?S.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:f.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?cs(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:f.not_finite,message:i.message}),s.dirty()):S.assertNever(i);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,r,s){return new de({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:v.toString(s)}]})}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.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"&&S.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}de.create=n=>new de({checks:[],typeName:b.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,..._(n)});class he extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let r;const s=new P;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),m(r,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):S.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:g.bigint,received:t.parsedType}),x}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,r,s){return new he({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:v.toString(s)}]})}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.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}}he.create=n=>{var e;return new he({checks:[],typeName:b.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,..._(n)})};class Xe extends O{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.boolean){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.boolean,received:r.parsedType}),x}return W(e.data)}}Xe.create=n=>new Xe({typeName:b.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,..._(n)});class Oe extends O{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const i=this._getOrReturnCtx(e);return m(i,{code:f.invalid_type,expected:g.date,received:i.parsedType}),x}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return m(i,{code:f.invalid_date}),x}const r=new P;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:f.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:f.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):S.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Oe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.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}}Oe.create=n=>new Oe({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:b.ZodDate,..._(n)});class Tt extends O{_parse(e){if(this._getType(e)!==g.symbol){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.symbol,received:r.parsedType}),x}return W(e.data)}}Tt.create=n=>new Tt({typeName:b.ZodSymbol,..._(n)});class Ke extends O{_parse(e){if(this._getType(e)!==g.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.undefined,received:r.parsedType}),x}return W(e.data)}}Ke.create=n=>new Ke({typeName:b.ZodUndefined,..._(n)});class Qe extends O{_parse(e){if(this._getType(e)!==g.null){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.null,received:r.parsedType}),x}return W(e.data)}}Qe.create=n=>new Qe({typeName:b.ZodNull,..._(n)});class Me extends O{constructor(){super(...arguments),this._any=!0}_parse(e){return W(e.data)}}Me.create=n=>new Me({typeName:b.ZodAny,..._(n)});class we extends O{constructor(){super(...arguments),this._unknown=!0}_parse(e){return W(e.data)}}we.create=n=>new we({typeName:b.ZodUnknown,..._(n)});class ae extends O{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:g.never,received:t.parsedType}),x}}ae.create=n=>new ae({typeName:b.ZodNever,..._(n)});class Ot extends O{_parse(e){if(this._getType(e)!==g.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.void,received:r.parsedType}),x}return W(e.data)}}Ot.create=n=>new Ot({typeName:b.ZodVoid,..._(n)});class F extends O{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==g.array)return m(t,{code:f.invalid_type,expected:g.array,received:t.parsedType}),x;if(s.exactLength!==null){const a=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(a||o)&&(m(t,{code:a?f.too_big:f.too_small,minimum:o?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(m(t,{code:f.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(m(t,{code:f.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>s.type._parseAsync(new K(t,a,t.path,o)))).then(a=>P.mergeArray(r,a));const i=[...t.data].map((a,o)=>s.type._parseSync(new K(t,a,t.path,o)));return P.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new F({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new F({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new F({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}}F.create=(n,e)=>new F({type:n,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,..._(e)});function ke(n){if(n instanceof C){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=X.create(ke(r))}return new C({...n._def,shape:()=>e})}else return n instanceof F?new F({...n._def,type:ke(n.element)}):n instanceof X?X.create(ke(n.unwrap())):n instanceof pe?pe.create(ke(n.unwrap())):n instanceof Q?Q.create(n.items.map(e=>ke(e))):n}class C extends O{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=S.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==g.object){const l=this._getOrReturnCtx(e);return m(l,{code:f.invalid_type,expected:g.object,received:l.parsedType}),x}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof ae&&this._def.unknownKeys==="strip"))for(const l in s.data)a.includes(l)||o.push(l);const c=[];for(const l of a){const p=i[l],y=s.data[l];c.push({key:{status:"valid",value:l},value:p._parse(new K(s,y,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof ae){const l=this._def.unknownKeys;if(l==="passthrough")for(const p of o)c.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(l==="strict")o.length>0&&(m(s,{code:f.unrecognized_keys,keys:o}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const p of o){const y=s.data[p];c.push({key:{status:"valid",value:p},value:l._parse(new K(s,y,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const p of c){const y=await p.key,j=await p.value;l.push({key:y,value:j,alwaysSet:p.alwaysSet})}return l}).then(l=>P.mergeObjectSync(r,l)):P.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new C({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var s,i,a,o;const c=(a=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.call(s,t,r).message)!==null&&a!==void 0?a:r.defaultError;return t.code==="unrecognized_keys"?{message:(o=v.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new C({...this._def,unknownKeys:"strip"})}passthrough(){return new C({...this._def,unknownKeys:"passthrough"})}extend(e){return new C({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new C({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:b.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new C({...this._def,catchall:e})}pick(e){const t={};return S.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new C({...this._def,shape:()=>t})}omit(e){const t={};return S.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new C({...this._def,shape:()=>t})}deepPartial(){return ke(this)}partial(e){const t={};return S.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}),new C({...this._def,shape:()=>t})}required(e){const t={};return S.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof X;)i=i._def.innerType;t[r]=i}}),new C({...this._def,shape:()=>t})}keyof(){return Wn(S.objectKeys(this.shape))}}C.create=(n,e)=>new C({shape:()=>n,unknownKeys:"strip",catchall:ae.create(),typeName:b.ZodObject,..._(e)});C.strictCreate=(n,e)=>new C({shape:()=>n,unknownKeys:"strict",catchall:ae.create(),typeName:b.ZodObject,..._(e)});C.lazycreate=(n,e)=>new C({shape:n,unknownKeys:"strip",catchall:ae.create(),typeName:b.ZodObject,..._(e)});class et extends O{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function s(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new z(o.ctx.common.issues));return m(t,{code:f.invalid_union,unionErrors:a}),x}if(t.common.async)return Promise.all(r.map(async i=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(s);{let i;const a=[];for(const c of r){const l={...t,common:{...t.common,issues:[]},parent:null},p=c._parseSync({data:t.data,path:t.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(c=>new z(c));return m(t,{code:f.invalid_union,unionErrors:o}),x}}get options(){return this._def.options}}et.create=(n,e)=>new et({options:n,typeName:b.ZodUnion,..._(e)});const ne=n=>n instanceof rt?ne(n.schema):n instanceof Y?ne(n.innerType()):n instanceof st?[n.value]:n instanceof fe?n.options:n instanceof it?S.objectValues(n.enum):n instanceof at?ne(n._def.innerType):n instanceof Ke?[void 0]:n instanceof Qe?[null]:n instanceof X?[void 0,...ne(n.unwrap())]:n instanceof pe?[null,...ne(n.unwrap())]:n instanceof en||n instanceof ut?ne(n.unwrap()):n instanceof ot?ne(n._def.innerType):[];class At extends O{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.object)return m(t,{code:f.invalid_type,expected:g.object,received:t.parsedType}),x;const r=this.discriminator,s=t.data[r],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(m(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const s=new Map;for(const i of t){const a=ne(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,i)}}return new At({typeName:b.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(r)})}}function zt(n,e){const t=se(n),r=se(e);if(n===e)return{valid:!0,data:n};if(t===g.object&&r===g.object){const s=S.objectKeys(e),i=S.objectKeys(n).filter(o=>s.indexOf(o)!==-1),a={...n,...e};for(const o of i){const c=zt(n[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(t===g.array&&r===g.array){if(n.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<n.length;i++){const a=n[i],o=e[i],c=zt(a,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===g.date&&r===g.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class tt extends O{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=(i,a)=>{if(Lt(i)||Lt(a))return x;const o=zt(i.value,a.value);return o.valid?((Wt(i)||Wt(a))&&t.dirty(),{status:t.value,value:o.data}):(m(r,{code:f.invalid_intersection_types}),x)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>s(i,a)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}tt.create=(n,e,t)=>new tt({left:n,right:e,typeName:b.ZodIntersection,..._(t)});class Q extends O{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.array)return m(r,{code:f.invalid_type,expected:g.array,received:r.parsedType}),x;if(r.data.length<this._def.items.length)return m(r,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&r.data.length>this._def.items.length&&(m(r,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...r.data].map((a,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new K(r,a,r.path,o)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>P.mergeArray(t,a)):P.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new Q({...this._def,rest:e})}}Q.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Q({items:n,typeName:b.ZodTuple,rest:null,..._(e)})};class nt extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.object)return m(r,{code:f.invalid_type,expected:g.object,received:r.parsedType}),x;const s=[],i=this._def.keyType,a=this._def.valueType;for(const o in r.data)s.push({key:i._parse(new K(r,o,r.path,o)),value:a._parse(new K(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?P.mergeObjectAsync(t,s):P.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof O?new nt({keyType:e,valueType:t,typeName:b.ZodRecord,..._(r)}):new nt({keyType:q.create(),valueType:e,typeName:b.ZodRecord,..._(t)})}}class St extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.map)return m(r,{code:f.invalid_type,expected:g.map,received:r.parsedType}),x;const s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([o,c],l)=>({key:s._parse(new K(r,o,r.path,[l,"key"])),value:i._parse(new K(r,c,r.path,[l,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of a){const l=await c.key,p=await c.value;if(l.status==="aborted"||p.status==="aborted")return x;(l.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(l.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of a){const l=c.key,p=c.value;if(l.status==="aborted"||p.status==="aborted")return x;(l.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(l.value,p.value)}return{status:t.value,value:o}}}}St.create=(n,e,t)=>new St({valueType:e,keyType:n,typeName:b.ZodMap,..._(t)});class Se extends O{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.set)return m(r,{code:f.invalid_type,expected:g.set,received:r.parsedType}),x;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(m(r,{code:f.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(m(r,{code:f.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const i=this._def.valueType;function a(c){const l=new Set;for(const p of c){if(p.status==="aborted")return x;p.status==="dirty"&&t.dirty(),l.add(p.value)}return{status:t.value,value:l}}const o=[...r.data.values()].map((c,l)=>i._parse(new K(r,c,r.path,l)));return r.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,t){return new Se({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new Se({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Se.create=(n,e)=>new Se({valueType:n,minSize:null,maxSize:null,typeName:b.ZodSet,..._(e)});class Ee extends O{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.function)return m(t,{code:f.invalid_type,expected:g.function,received:t.parsedType}),x;function r(o,c){return xt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bt(),$e].filter(l=>!!l),issueData:{code:f.invalid_arguments,argumentsError:c}})}function s(o,c){return xt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bt(),$e].filter(l=>!!l),issueData:{code:f.invalid_return_type,returnTypeError:c}})}const i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Ce){const o=this;return W(async function(...c){const l=new z([]),p=await o._def.args.parseAsync(c,i).catch(D=>{throw l.addIssue(r(c,D)),l}),y=await Reflect.apply(a,this,p);return await o._def.returns._def.type.parseAsync(y,i).catch(D=>{throw l.addIssue(s(y,D)),l})})}else{const o=this;return W(function(...c){const l=o._def.args.safeParse(c,i);if(!l.success)throw new z([r(c,l.error)]);const p=Reflect.apply(a,this,l.data),y=o._def.returns.safeParse(p,i);if(!y.success)throw new z([s(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ee({...this._def,args:Q.create(e).rest(we.create())})}returns(e){return new Ee({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Ee({args:e||Q.create([]).rest(we.create()),returns:t||we.create(),typeName:b.ZodFunction,..._(r)})}}class rt extends O{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})}}rt.create=(n,e)=>new rt({getter:n,typeName:b.ZodLazy,..._(e)});class st extends O{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}}st.create=(n,e)=>new st({value:n,typeName:b.ZodLiteral,..._(e)});function Wn(n,e){return new fe({values:n,typeName:b.ZodEnum,..._(e)})}class fe extends O{constructor(){super(...arguments),Ze.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{expected:S.joinValues(r),received:t.parsedType,code:f.invalid_type}),x}if(_t(this,Ze)||Dn(this,Ze,new Set(this._def.values)),!_t(this,Ze).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return m(t,{received:t.data,code:f.invalid_enum_value,options:r}),x}return W(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,t=this._def){return fe.create(e,{...this._def,...t})}exclude(e,t=this._def){return fe.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}Ze=new WeakMap;fe.create=Wn;class it extends O{constructor(){super(...arguments),Be.set(this,void 0)}_parse(e){const t=S.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==g.string&&r.parsedType!==g.number){const s=S.objectValues(t);return m(r,{expected:S.joinValues(s),received:r.parsedType,code:f.invalid_type}),x}if(_t(this,Be)||Dn(this,Be,new Set(S.getValidEnumValues(this._def.values))),!_t(this,Be).has(e.data)){const s=S.objectValues(t);return m(r,{received:r.data,code:f.invalid_enum_value,options:s}),x}return W(e.data)}get enum(){return this._def.values}}Be=new WeakMap;it.create=(n,e)=>new it({values:n,typeName:b.ZodNativeEnum,..._(e)});class Ce extends O{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&t.common.async===!1)return m(t,{code:f.invalid_type,expected:g.promise,received:t.parsedType}),x;const r=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return W(r.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ce.create=(n,e)=>new Ce({type:n,typeName:b.ZodPromise,..._(e)});class Y extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:a=>{m(r,a),a.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const a=s.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return x;const c=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return c.status==="aborted"?x:c.status==="dirty"||t.value==="dirty"?Ae(c.value):c});{if(t.value==="aborted")return x;const o=this._def.schema._parseSync({data:a,path:r.path,parent:r});return o.status==="aborted"?x:o.status==="dirty"||t.value==="dirty"?Ae(o.value):o}}if(s.type==="refinement"){const a=o=>{const c=s.refinement(o,i);if(r.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(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?x:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?x:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Te(a))return a;const o=s.transform(a.value,i);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:r.data,path:r.path,parent:r}).then(a=>Te(a)?Promise.resolve(s.transform(a.value,i)).then(o=>({status:t.value,value:o})):a);S.assertNever(s)}}Y.create=(n,e,t)=>new Y({schema:n,typeName:b.ZodEffects,effect:e,..._(t)});Y.createWithPreprocess=(n,e,t)=>new Y({schema:e,effect:{type:"preprocess",transform:n},typeName:b.ZodEffects,..._(t)});class X extends O{_parse(e){return this._getType(e)===g.undefined?W(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}X.create=(n,e)=>new X({innerType:n,typeName:b.ZodOptional,..._(e)});class pe extends O{_parse(e){return this._getType(e)===g.null?W(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pe.create=(n,e)=>new pe({innerType:n,typeName:b.ZodNullable,..._(e)});class at extends O{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===g.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}at.create=(n,e)=>new at({innerType:n,typeName:b.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class ot extends O{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return He(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new z(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new z(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ot.create=(n,e)=>new ot({innerType:n,typeName:b.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class Nt extends O{_parse(e){if(this._getType(e)!==g.nan){const r=this._getOrReturnCtx(e);return m(r,{code:f.invalid_type,expected:g.nan,received:r.parsedType}),x}return{status:"valid",value:e.data}}}Nt.create=n=>new Nt({typeName:b.ZodNaN,..._(n)});const ls=Symbol("zod_brand");class en extends O{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class dt extends O{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?x:i.status==="dirty"?(t.dirty(),Ae(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?x:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,t){return new dt({in:e,out:t,typeName:b.ZodPipeline})}}class ut extends O{_parse(e){const t=this._def.innerType._parse(e),r=s=>(Te(s)&&(s.value=Object.freeze(s.value)),s);return He(t)?t.then(s=>r(s)):r(t)}unwrap(){return this._def.innerType}}ut.create=(n,e)=>new ut({innerType:n,typeName:b.ZodReadonly,..._(e)});function vn(n,e){const t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function zn(n,e={},t){return n?Me.create().superRefine((r,s)=>{var i,a;const o=n(r);if(o instanceof Promise)return o.then(c=>{var l,p;if(!c){const y=vn(e,r),j=(p=(l=y.fatal)!==null&&l!==void 0?l:t)!==null&&p!==void 0?p:!0;s.addIssue({code:"custom",...y,fatal:j})}});if(!o){const c=vn(e,r),l=(a=(i=c.fatal)!==null&&i!==void 0?i:t)!==null&&a!==void 0?a:!0;s.addIssue({code:"custom",...c,fatal:l})}}):Me.create()}const ds={object:C.lazycreate};var b;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(b||(b={}));const hs=(n,e={message:`Input not instance of ${n.name}`})=>zn(t=>t instanceof n,e),Vn=q.create,qn=de.create,fs=Nt.create,ps=he.create,Fn=Xe.create,ms=Oe.create,ys=Tt.create,gs=Ke.create,vs=Qe.create,ws=Me.create,bs=we.create,xs=ae.create,_s=Ot.create,Ts=F.create,Os=C.create,Ss=C.strictCreate,Ns=et.create,Is=At.create,ks=tt.create,As=Q.create,Es=nt.create,$s=St.create,Ms=Se.create,Cs=Ee.create,Rs=rt.create,js=st.create,Zs=fe.create,Bs=it.create,Ds=Ce.create,wn=Y.create,Us=X.create,Ps=pe.create,Ls=Y.createWithPreprocess,Ws=dt.create,zs=()=>Vn().optional(),Vs=()=>qn().optional(),qs=()=>Fn().optional(),Fs={string:n=>q.create({...n,coerce:!0}),number:n=>de.create({...n,coerce:!0}),boolean:n=>Xe.create({...n,coerce:!0}),bigint:n=>he.create({...n,coerce:!0}),date:n=>Oe.create({...n,coerce:!0})},Ys=x;var u=Object.freeze({__proto__:null,defaultErrorMap:$e,setErrorMap:Lr,getErrorMap:bt,makeIssue:xt,EMPTY_PATH:Wr,addIssueToContext:m,ParseStatus:P,INVALID:x,DIRTY:Ae,OK:W,isAborted:Lt,isDirty:Wt,isValid:Te,isAsync:He,get util(){return S},get objectUtil(){return Pt},ZodParsedType:g,getParsedType:se,ZodType:O,datetimeRegex:Ln,ZodString:q,ZodNumber:de,ZodBigInt:he,ZodBoolean:Xe,ZodDate:Oe,ZodSymbol:Tt,ZodUndefined:Ke,ZodNull:Qe,ZodAny:Me,ZodUnknown:we,ZodNever:ae,ZodVoid:Ot,ZodArray:F,ZodObject:C,ZodUnion:et,ZodDiscriminatedUnion:At,ZodIntersection:tt,ZodTuple:Q,ZodRecord:nt,ZodMap:St,ZodSet:Se,ZodFunction:Ee,ZodLazy:rt,ZodLiteral:st,ZodEnum:fe,ZodNativeEnum:it,ZodPromise:Ce,ZodEffects:Y,ZodTransformer:Y,ZodOptional:X,ZodNullable:pe,ZodDefault:at,ZodCatch:ot,ZodNaN:Nt,BRAND:ls,ZodBranded:en,ZodPipeline:dt,ZodReadonly:ut,custom:zn,Schema:O,ZodSchema:O,late:ds,get ZodFirstPartyTypeKind(){return b},coerce:Fs,any:ws,array:Ts,bigint:ps,boolean:Fn,date:ms,discriminatedUnion:Is,effect:wn,enum:Zs,function:Cs,instanceof:hs,intersection:ks,lazy:Rs,literal:js,map:$s,nan:fs,nativeEnum:Bs,never:xs,null:vs,nullable:Ps,number:qn,object:Os,oboolean:qs,onumber:Vs,optional:Us,ostring:zs,pipeline:Ws,preprocess:Ls,promise:Ds,record:Es,set:Ms,strictObject:Ss,string:Vn,symbol:ys,transformer:wn,tuple:As,undefined:gs,union:Ns,unknown:bs,void:_s,NEVER:Ys,ZodIssueCode:f,quotelessJson:Pr,ZodError:z});const Gs=n=>n!=null&&typeof n=="object"&&"toString"in n,Js=(n,e=!1)=>{const t=Gs(n)?"stringer":typeof n;let r;switch(t){case"string":r=(s,i)=>s.localeCompare(i);break;case"stringer":r=(s,i)=>s.toString().localeCompare(i.toString());break;case"number":r=(s,i)=>Number(s)-Number(i);break;case"bigint":r=(s,i)=>BigInt(s)-BigInt(i)>0n?1:-1;break;case"boolean":r=(s,i)=>Number(s)-Number(i);break;case"undefined":r=()=>0;break;default:return console.warn(`sortFunc: unknown type ${t}`),()=>-1}return e?Hs(r):r},Hs=n=>(e,t)=>n(t,e),Et=u.tuple([u.number(),u.number()]);u.tuple([u.bigint(),u.bigint()]);const tn=u.object({width:u.number(),height:u.number()}),Xs=u.object({signedWidth:u.number(),signedHeight:u.number()}),Ks=["width","height"];u.enum(Ks);const Qs=["start","center","end"],ei=["signedWidth","signedHeight"];u.enum(ei);const ct=u.object({x:u.number(),y:u.number()}),Yn=u.object({clientX:u.number(),clientY:u.number()}),Gn=["x","y"],Jn=u.enum(Gn),Hn=["top","right","bottom","left"];u.enum(Hn);const nn=["left","right"],Xn=u.enum(nn),rn=["top","bottom"],Kn=u.enum(rn),Qn=["center"],bn=u.enum(Qn),ti=[...Hn,...Qn],er=u.enum(ti);u.enum(Qs);const ni=["first","last"];u.enum(ni);const ri=u.object({lower:u.number(),upper:u.number()}),si=u.object({lower:u.bigint(),upper:u.bigint()});u.union([ri,Et]);u.union([si,Et]);u.enum([...Jn.options,...er.options]);u.union([Jn,er,u.instanceof(String)]);const ii=n=>typeof n=="bigint"||n instanceof BigInt,Ie=(n,e)=>ii(n)?n.valueOf()*BigInt(e.valueOf()):n.valueOf()*Number(e.valueOf()),be=(n,e)=>{const t={};if(typeof n=="number"||typeof n=="bigint")e!=null?(t.lower=n,t.upper=e):(t.lower=typeof n=="bigint"?0n:0,t.upper=n);else if(Array.isArray(n)){if(n.length!==2)throw new Error("bounds: expected array of length 2");[t.lower,t.upper]=n}else return xn(n);return xn(t)},xn=n=>n.lower>n.upper?{lower:n.upper,upper:n.lower}:n,_n=(n,e)=>{const t=be(n);return e<t.lower?t.lower:e>=t.upper?t.upper-(typeof t.upper=="number"?1:1n):e},sn=n=>Gn.includes(n)?n:rn.includes(n)?"y":"x";u.object({x:Xn.or(bn),y:Kn.or(bn)});const ai=u.object({x:Xn,y:Kn}),an=Object.freeze({x:"left",y:"top"}),oi=Object.freeze({x:"right",y:"top"}),tr=Object.freeze({x:"left",y:"bottom"}),ui=Object.freeze({x:"right",y:"bottom"}),nr=(n,e)=>n.x===e.x&&n.y===e.y,ci=n=>[n.x,n.y],Vt=u.union([u.number(),ct,Et,tn,Xs,Yn]),M=(n,e)=>{if(typeof n=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return n==="x"?{x:e,y:0}:{x:0,y:e}}return typeof n=="number"?{x:n,y:e??n}:Array.isArray(n)?{x:n[0],y:n[1]}:"signedWidth"in n?{x:n.signedWidth,y:n.signedHeight}:"clientX"in n?{x:n.clientX,y:n.clientY}:"width"in n?{x:n.width,y:n.height}:{x:n.x,y:n.y}},ee=Object.freeze({x:0,y:0}),rr=Object.freeze({x:1,y:1}),li=Object.freeze({x:1/0,y:1/0}),di=Object.freeze({x:NaN,y:NaN}),It=(n,e,t=0)=>{const r=M(n),s=M(e);return t===0?r.x===s.x&&r.y===s.y:Math.abs(r.x-s.x)<=t&&Math.abs(r.y-s.y)<=t},hi=n=>It(n,ee),on=(n,e,t)=>{const r=M(n),s=M(e,t);return{x:r.x*s.x,y:r.y*s.y}},sr=(n,e)=>{const t=M(n);return{x:t.x+e,y:t.y}},ir=(n,e)=>{const t=M(n);return{x:t.x,y:t.y+e}},lt=(n,e,t,...r)=>typeof e=="string"&&typeof t=="number"?e==="x"?sr(n,t):ir(n,t):[n,e,t??ee,...r].reduce((s,i)=>{const a=M(i);return{x:s.x+a.x,y:s.y+a.y}},ee),fi=(n,e,t)=>{const r=M(n);return e==="x"?{x:t,y:r.y}:{x:r.x,y:t}},pi=(n,e)=>{const t=M(n),r=M(e);return Math.sqrt((t.x-r.x)**2+(t.y-r.y)**2)},mi=(n,e)=>{const t=M(n),r=M(e);return{x:r.x-t.x,y:r.y-t.y}},yi=n=>{const e=M(n);return Number.isNaN(e.x)||Number.isNaN(e.y)},gi=n=>{const e=M(n);return Number.isFinite(e.x)&&Number.isFinite(e.y)},vi=n=>{const e=M(n);return[e.x,e.y]},wi=n=>{const e=M(n);return{left:e.x,top:e.y}},qt=(n,e=0)=>{const t=M(n);return{x:Number(t.x.toFixed(e)),y:Number(t.y.toFixed(e))}},De=(n,e)=>{const t=M(n),r=M(e);return{x:t.x-r.x,y:t.y-r.y}},Ue=n=>{const e=M(n),t=Math.hypot(e.x,e.y);return t===0?{x:0,y:0}:{x:-e.y/t,y:e.x/t}},ar=n=>{const e=M(n),t=Math.hypot(e.x,e.y);return t===0?{x:0,y:0}:{x:e.x/t,y:e.y/t}},or=(...n)=>{const e=n.reduce((t,r)=>lt(t,r),ee);return on(e,1/n.length)},bi=(n,e)=>{const t=[];for(let r=0;r<n.length;r++){const s=n[r];let i,a,o,c;if(r===0){const l=n[r+1],p=De(l,s);a=Ue(p),o=a,c=e}else if(r===n.length-1){const l=n[r-1],p=De(s,l);i=Ue(p),o=i,c=e}else{const l=n[r-1],p=n[r+1],y=De(s,l),j=De(p,s);i=Ue(y),a=Ue(j);const D=Math.acos((y.x*j.x+y.y*j.y)/(Math.hypot(y.x,y.y)*Math.hypot(j.x,j.y))),Re=Math.sin(D/2);Re===0?c=e:c=e/Re,o=ar(or(i,a))}t.push(on(o,c))}return t},kt=Object.freeze(Object.defineProperty({__proto__:null,INFINITY:li,NAN:di,ONE:rr,ZERO:ee,average:or,calculateMiters:bi,clientXY:Yn,construct:M,couple:vi,crudeZ:Vt,css:wi,distance:pi,equals:It,isFinite:gi,isNan:yi,isZero:hi,normal:Ue,normalize:ar,scale:on,set:fi,sub:De,translate:lt,translateX:sr,translateY:ir,translation:mi,truncate:qt,xy:ct},Symbol.toStringTag,{value:"Module"})),ft=u.union([u.number(),u.string()]),xi=u.object({top:ft,left:ft,width:ft,height:ft}),_i=u.object({left:u.number(),top:u.number(),right:u.number(),bottom:u.number()}),Ti=u.object({one:ct,two:ct,root:ai}),ur={one:ee,two:ee,root:an},Oi={one:ee,two:rr,root:tr},cr=(n,e)=>({one:n.one,two:n.two,root:e??n.root}),$=(n,e,t=0,r=0,s)=>{const i={one:{...ee},two:{...ee},root:s??an};if(typeof n=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return i.one={x:n,y:e},i.two={x:i.one.x+t,y:i.one.y+r},i}return"one"in n&&"two"in n&&"root"in n?{...n,root:s??n.root}:("getBoundingClientRect"in n&&(n=n.getBoundingClientRect()),"left"in n?(i.one={x:n.left,y:n.top},i.two={x:n.right,y:n.bottom},i):(i.one=n,e==null?i.two={x:i.one.x+t,y:i.one.y+r}:typeof e=="number"?i.two={x:i.one.x+e,y:i.one.y+t}:"width"in e?i.two={x:i.one.x+e.width,y:i.one.y+e.height}:"signedWidth"in e?i.two={x:i.one.x+e.signedWidth,y:i.one.y+e.signedHeight}:i.two=e,i))},Si=(n,e,t)=>{const r=$(n);if(typeof e=="string"){if(t==null)throw new Error("Invalid arguments for resize");const s=sn(e);return $(r.one,void 0,s==="x"?t:me(r),s==="y"?t:ye(r),r.root)}return $(r.one,e,void 0,void 0,r.root)},Ni=(n,e,t=!0)=>{const r=$(n);let s=(i,a)=>i<a;return t&&(s=(i,a)=>i<=a),"one"in e?s(ce(r),ce(e))&&s(xe(e),xe(r))&&s(le(r),le(e))&&s(_e(e),_e(r)):s(ce(r),e.x)&&s(e.x,xe(r))&&s(le(r),e.y)&&s(e.y,_e(r))},Ii=(n,e)=>It(n.one,e.one)&&It(n.two,e.two)&&nr(n.root,e.root),lr=n=>({width:me(n),height:ye(n)}),ki=n=>({signedWidth:$t(n),signedHeight:Mt(n)}),Ai=n=>({top:le(n),left:ce(n),width:me(n),height:ye(n)}),un=(n,e,t=!1)=>{const r=sn(e)==="y"?Mt(n):$t(n);return t?r:Math.abs(r)},ht=(n,e)=>{const t=$(n);return{x:e.x==="center"?Ft(t).x:Ne(t,e.x),y:e.y==="center"?Ft(t).y:Ne(t,e.y)}},Ne=(n,e)=>{const t=$(n),r=ci(t.root).includes(e)?Math.min:Math.max;return nn.includes(e)?r(t.one.x,t.two.x):r(t.one.y,t.two.y)},Ei=n=>n.one.x===n.two.x&&n.one.y===n.two.y,me=n=>un(n,"x"),ye=n=>un(n,"y"),$t=n=>{const e=$(n);return e.two.x-e.one.x},Mt=n=>{const e=$(n);return e.two.y-e.one.y},dr=n=>ht(n,an),$i=n=>ht(n,oi),Mi=n=>ht(n,tr),Ci=n=>ht(n,ui),xe=n=>Ne(n,"right"),_e=n=>Ne(n,"bottom"),ce=n=>Ne(n,"left"),le=n=>Ne(n,"top"),Ft=n=>lt(dr(n),{x:$t(n)/2,y:Mt(n)/2}),cn=n=>{const e=$(n);return e.root.x==="left"?ce(e):xe(e)},ln=n=>{const e=$(n);return e.root.y==="top"?le(e):_e(e)},Ri=n=>({x:cn(n),y:ln(n)}),mt=n=>{const e=$(n);return{lower:e.one.x,upper:e.two.x}},yt=n=>{const e=$(n);return{lower:e.one.y,upper:e.two.y}},ji=(n,e)=>cr(n,e),Zi=(n,e)=>{const t=$(n),r=nn.includes(e)?"x":rn.includes(e)?"y":null;if(r===null)throw new Error(`Invalid location: ${e}`);const s=e==="top"||e==="left"?Math.min:Math.max,i={...t.one},a={...t.two};return i[r]=s(t.one[r],t.two[r]),a[r]=s(t.one[r],t.two[r]),[i,a]},Bi=(n,e)=>{const t=$(n),r=$(e),s=cn(r)+(me(r)-me(t))/2,i=ln(r)+(ye(r)-ye(t))/2;return $({x:s,y:i},lr(t))},hr=n=>typeof n!="object"||n==null?!1:"one"in n&&"two"in n&&"root"in n,Di=n=>me(n)/ye(n),Ui=(n,e,t)=>{if(typeof e=="string"){if(t==null)throw new Error("Undefined amount passed into box.translate");const s=sn(e);e=M(s,t)}const r=$(n);return $(lt(r.one,e),lt(r.two,e),void 0,void 0,r.root)},Pi=(n,e)=>{const t=Math.max(ce(n),ce(e)),r=Math.max(le(n),le(e)),s=Math.min(xe(n),xe(e)),i=Math.min(_e(n),_e(e));return t>s||r>i?ur:$({x:t,y:r},{x:s,y:i},void 0,void 0,n.root)},Li=n=>me(n)*ye(n),Wi=(n,e)=>{const t=$(n);return $(qt(t.one,e),qt(t.two,e),void 0,void 0,t.root)},zi=(n,e,t,r,s,i)=>{const a={x:n,y:e},o={x:n+t,y:e+r};return s.x!==i.x&&(s.x==="center"?(a.x-=t/2,o.x-=t/2):(a.x-=t,o.x-=t)),s.y!==i.y&&(s.y==="center"?(a.y-=r/2,o.y-=r/2):(a.y-=r,o.y-=r)),$(a,o,void 0,void 0,i)},Pe=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:Oi,ZERO:ur,area:Li,areaIsZero:Ei,aspect:Di,bottom:_e,bottomLeft:Mi,bottomRight:Ci,box:Ti,center:Ft,construct:$,constructWithAlternateRoot:zi,contains:Ni,copy:cr,css:Ai,cssBox:xi,dim:un,dims:lr,domRect:_i,edgePoints:Zi,equals:Ii,height:ye,intersection:Pi,isBox:hr,left:ce,loc:Ne,positionInCenter:Bi,reRoot:ji,resize:Si,right:xe,root:Ri,signedDims:ki,signedHeight:Mt,signedWidth:$t,top:le,topLeft:dr,topRight:$i,translate:Ui,truncate:Wi,width:me,x:cn,xBounds:mt,xyLoc:ht,y:ln,yBounds:yt},Symbol.toStringTag,{value:"Module"})),fr=u.object({signedWidth:u.number(),signedHeight:u.number()}),Vi=u.union([tn,fr,ct,Et]),qi={width:0,height:0},Fi={width:1,height:1},G=(n,e)=>typeof n=="number"?{width:n,height:e??n}:Array.isArray(n)?{width:n[0],height:n[1]}:"x"in n?{width:n.x,height:n.y}:"signedWidth"in n?{width:n.signedWidth,height:n.signedHeight}:{...n},Yi=(n,e)=>{if(e==null)return!1;const t=G(n),r=G(e);return t.width===r.width&&t.height===r.height},Gi=n=>{const e=G(n);return{width:e.height,height:e.width}},Ji=n=>{const e=G(n);return`0 0 ${e.width} ${e.height}`},Hi=n=>{const e=G(n);return[e.width,e.height]},Xi=n=>({width:Math.max(...n.map(e=>G(e).width)),height:Math.max(...n.map(e=>G(e).height))}),Ki=n=>({width:Math.min(...n.map(e=>G(e).width)),height:Math.min(...n.map(e=>G(e).height))}),Qi=(n,e)=>{const t=G(n);return{width:t.width*e,height:t.height*e}},gt=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:Fi,ZERO:qi,construct:G,couple:Hi,crude:Vi,dimensions:tn,equals:Yi,max:Xi,min:Ki,scale:Qi,signed:fr,svgViewBox:Ji,swap:Gi},Symbol.toStringTag,{value:"Module"}));var ea=Object.defineProperty,ta=(n,e,t)=>e in n?ea(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ie=(n,e,t)=>ta(n,typeof e!="symbol"?e+"":e,t);const na=(n,e,t)=>e!==void 0&&n<e?e:t!==void 0&&n>t?t:n;u.object({offset:Vt,scale:Vt});u.object({offset:u.number(),scale:u.number()});const ra=n=>(e,t,r,s)=>t==="dimension"?[e,r]:[e,s?r-n:r+n],sa=n=>(e,t,r,s)=>[e,s?r/n:r*n],ia=n=>(e,t,r)=>{if(e===null)return[n,r];const{lower:s,upper:i}=e,{lower:a,upper:o}=n,c=i-s,l=o-a;if(t==="dimension")return[n,r*(l/c)];const p=(r-s)*(l/c)+a;return[n,p]},aa=n=>(e,t,r)=>[n,r],oa=()=>(n,e,t)=>{if(n===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[n,t];const{lower:r,upper:s}=n;return[n,s-(t-r)]},ua=n=>(e,t,r)=>{const{lower:s,upper:i}=n;return r=na(r,s,i),[e,r]},Yt=class Le{constructor(){ie(this,"ops",[]),ie(this,"currBounds",null),ie(this,"currType",null),ie(this,"reversed",!1),this.ops=[]}static translate(e){return new Le().translate(e)}static magnify(e){return new Le().magnify(e)}static scale(e,t){return new Le().scale(e,t)}translate(e){const t=this.new(),r=ra(e);return r.type="translate",t.ops.push(r),t}magnify(e){const t=this.new(),r=sa(e);return r.type="magnify",t.ops.push(r),t}scale(e,t){const r=be(e,t),s=this.new(),i=ia(r);return i.type="scale",s.ops.push(i),s}clamp(e,t){const r=be(e,t),s=this.new(),i=ua(r);return i.type="clamp",s.ops.push(i),s}reBound(e,t){const r=be(e,t),s=this.new(),i=aa(r);return i.type="re-bound",s.ops.push(i),s}invert(){const e=oa();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 Le;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([r,s],i)=>i(r,e,s,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((r,s)=>{if(r.type==="scale"||t.some(([a,o])=>s>=a&&s<=o))return;const i=e.ops.findIndex((a,o)=>a.type==="scale"&&o>s);i!==-1&&t.push([s,i])}),t.forEach(([r,s])=>{const i=e.ops.slice(r,s);i.unshift(e.ops[s]),e.ops.splice(r,s-r+1,...i)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};ie(Yt,"IDENTITY",new Yt);let Tn=Yt;const On=class re{constructor(e=new Tn,t=new Tn,r=null){ie(this,"x"),ie(this,"y"),ie(this,"currRoot"),this.x=e,this.y=t,this.currRoot=r}static translate(e,t){return new re().translate(e,t)}static translateX(e){return new re().translateX(e)}static translateY(e){return new re().translateY(e)}static clamp(e){return new re().clamp(e)}static magnify(e){return new re().magnify(e)}static scale(e){return new re().scale(e)}static reBound(e){return new re().reBound(e)}translate(e,t){const r=M(e,t),s=this.copy();return s.x=this.x.translate(r.x),s.y=this.y.translate(r.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(hr(e)){const r=this.currRoot;return t.currRoot=e.root,r!=null&&!nr(r,e.root)&&(r.x!==e.root.x&&(t.x=t.x.invert()),r.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(mt(e)),t.y=t.y.scale(yt(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(mt(e)),t.y=this.y.reBound(yt(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(mt(e)),t.y=this.y.clamp(yt(e)),t}copy(){const e=new re;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return $(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}};ie(On,"IDENTITY",new On);var ca=Object.defineProperty,la=(n,e,t)=>e in n?ca(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,h=(n,e,t)=>la(n,typeof e!="symbol"?e+"":e,t);let da=(n,e=21)=>(t=e)=>{let r="",s=t|0;for(;s--;)r+=n[Math.random()*n.length|0];return r};const ha="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",fa=da(ha,11),pr=()=>fa(),Gt=Object.freeze(Object.defineProperty({__proto__:null,create:pr},Symbol.toStringTag,{value:"Module"})),pa=u.enum(["static","dynamic"]),mr=(n,e)=>{const t=new E(e);if(![A.DAY,A.HOUR,A.MINUTE,A.SECOND,A.MILLISECOND,A.MICROSECOND,A.NANOSECOND].some(s=>s.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const r=n.valueOf()%t.valueOf();return n instanceof E?new E(r):new A(r)},I=class w{constructor(e,t="UTC"){if(h(this,"value"),h(this,"encodeValue",!0),e==null)this.value=w.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*w.MILLISECOND.valueOf();else if(typeof e=="string")this.value=w.parseDateTimeString(e,t).valueOf();else if(Array.isArray(e))this.value=w.parseDate(e);else{let r=BigInt(0);e instanceof Number&&(e=e.valueOf()),t==="local"&&(r=w.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=w.MAX:e=w.MIN)),this.value=BigInt(e.valueOf())+r}}static parseDate([e=1970,t=1,r=1]){const s=new Date(e,t-1,r,0,0,0,0);return new w(BigInt(s.getTime())*w.MILLISECOND.valueOf()).truncate(w.DAY).valueOf()}encode(){return this.value.toString()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[r,s,i]=e.split(":");let a="00",o="00";i!=null&&([a,o]=i.split("."));let c=w.hours(parseInt(r??"00")).add(w.minutes(parseInt(s??"00"))).add(w.seconds(parseInt(a??"00"))).add(w.milliseconds(parseInt(o??"00")));return t==="local"&&(c=c.add(w.utcOffset)),c.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return w.parseTimeString(e,t);const r=new Date(e);return e.includes(":")||r.setUTCHours(0,0,0,0),new w(BigInt(r.getTime())*w.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();case"preciseDate":return`${this.dateString()} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString()} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(w.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const r=this.toISOString(t);return e?r.slice(11,23):r.slice(11,19)}dateString(){const e=this.date(),t=e.toLocaleString("default",{month:"short"}),r=e.toLocaleString("default",{day:"numeric"});return`${t} ${r}`}static get utcOffset(){return new A(BigInt(new Date().getTimezoneOffset())*w.MINUTE.valueOf())}static since(e){return new w().span(e)}date(){return new Date(this.milliseconds)}equals(e){return this.valueOf()===new w(e).valueOf()}span(e){return this.range(e).span}range(e){return new dn(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new w(e).valueOf()}afterEq(e){return this.valueOf()>=new w(e).valueOf()}before(e){return this.valueOf()<new w(e).valueOf()}beforeEq(e){return this.valueOf()<=new w(e).valueOf()}add(e){return new w(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new w(this.valueOf()-BigInt(e.valueOf()))}get hours(){return Number(this.valueOf())/Number(A.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(A.MINUTE.valueOf())}get days(){return Number(this.valueOf())/Number(A.DAY.valueOf())}get seconds(){return Number(this.valueOf())/Number(A.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(w.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(w.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get year(){return this.date().getFullYear()}setYear(e){const t=this.date();return t.setFullYear(e),new w(t)}get month(){return this.date().getMonth()}setMonth(e){const t=this.date();return t.setMonth(e),new w(t)}get day(){return this.date().getDate()}setDay(e){const t=this.date();return t.setDate(e),new w(t)}get hour(){return this.date().getHours()}setHour(e){const t=this.date();return t.setHours(e),new w(t)}get minute(){return this.date().getMinutes()}setMinute(e){const t=this.date();return t.setMinutes(e),new w(t)}get second(){return this.date().getSeconds()}setSecond(e){const t=this.date();return t.setSeconds(e),new w(t)}get millisecond(){return this.date().getMilliseconds()}setMillisecond(e){const t=this.date();return t.setMilliseconds(e),new w(t)}toString(){return this.date().toISOString()}remainder(e){return mr(this,e)}get isToday(){return this.truncate(A.DAY).equals(w.now().truncate(A.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new w(new Date)}static max(...e){let t=w.MIN;for(const r of e){const s=new w(r);s.after(t)&&(t=s)}return t}static min(...e){let t=w.MAX;for(const r of e){const s=new w(r);s.before(t)&&(t=s)}return t}static nanoseconds(e){return new w(e)}static microseconds(e){return w.nanoseconds(e*1e3)}static milliseconds(e){return w.microseconds(e*1e3)}static seconds(e){return w.milliseconds(e*1e3)}static minutes(e){return w.seconds(e*60)}static hours(e){return w.minutes(e*60)}static days(e){return w.hours(e*24)}};h(I,"NANOSECOND",I.nanoseconds(1)),h(I,"MICROSECOND",I.microseconds(1)),h(I,"MILLISECOND",I.milliseconds(1)),h(I,"SECOND",I.seconds(1)),h(I,"MINUTE",I.minutes(1)),h(I,"HOUR",I.hours(1)),h(I,"DAY",I.days(1)),h(I,"MAX",new I((1n<<63n)-1n)),h(I,"MIN",new I(0)),h(I,"ZERO",new I(0)),h(I,"z",u.union([u.object({value:u.bigint()}).transform(n=>new I(n.value)),u.string().transform(n=>new I(BigInt(n))),u.instanceof(Number).transform(n=>new I(n)),u.number().transform(n=>new I(n)),u.instanceof(I)]));let E=I;const k=class T{constructor(e){h(this,"value"),h(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}static fromSeconds(e){return e instanceof T?e:e instanceof Sn?e.period:e instanceof E?new T(e):["number","bigint"].includes(typeof e)?T.seconds(e):new T(e)}static fromMilliseconds(e){return e instanceof T?e:e instanceof Sn?e.period:e instanceof E?new T(e):["number","bigint"].includes(typeof e)?T.milliseconds(e):new T(e)}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(e){return this.valueOf()<new T(e).valueOf()}greaterThan(e){return this.valueOf()>new T(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new T(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new T(e).valueOf()}remainder(e){return mr(this,e)}truncate(e){return new T(BigInt(Math.trunc(Number(this.valueOf()/e.valueOf())))*e.valueOf())}toString(){const e=this.truncate(T.DAY),t=this.truncate(T.HOUR),r=this.truncate(T.MINUTE),s=this.truncate(T.SECOND),i=this.truncate(T.MILLISECOND),a=this.truncate(T.MICROSECOND),o=this.truncate(T.NANOSECOND),c=e,l=t.sub(e),p=r.sub(t),y=s.sub(r),j=i.sub(s),D=a.sub(i),Re=o.sub(a);let oe="";return c.isZero||(oe+=`${c.days}d `),l.isZero||(oe+=`${l.hours}h `),p.isZero||(oe+=`${p.minutes}m `),y.isZero||(oe+=`${y.seconds}s `),j.isZero||(oe+=`${j.milliseconds}ms `),D.isZero||(oe+=`${D.microseconds}µs `),Re.isZero||(oe+=`${Re.nanoseconds}ns`),oe.trim()}mult(e){return new T(this.valueOf()*BigInt(e))}get days(){return Number(this.valueOf())/Number(T.DAY.valueOf())}get hours(){return Number(this.valueOf())/Number(T.HOUR.valueOf())}get minutes(){return Number(this.valueOf())/Number(T.MINUTE.valueOf())}get seconds(){return Number(this.valueOf())/Number(T.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf())/Number(T.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf())/Number(T.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(0)}equals(e){return this.valueOf()===new T(e).valueOf()}add(e){return new T(this.valueOf()+new T(e).valueOf())}sub(e){return new T(this.valueOf()-new T(e).valueOf())}static nanoseconds(e=1){return new T(e)}static microseconds(e=1){return T.nanoseconds(Ie(e,1e3))}static milliseconds(e=1){return T.microseconds(Ie(e,1e3))}static seconds(e=1){return T.milliseconds(Ie(e,1e3))}static minutes(e=1){return T.seconds(Ie(e,60))}static hours(e){return T.minutes(Ie(e,60))}static days(e){return T.hours(Ie(e,24))}};h(k,"NANOSECOND",k.nanoseconds(1)),h(k,"MICROSECOND",k.microseconds(1)),h(k,"MILLISECOND",k.milliseconds(1)),h(k,"SECOND",k.seconds(1)),h(k,"MINUTE",k.minutes(1)),h(k,"HOUR",k.hours(1)),h(k,"DAY",k.days(1)),h(k,"MAX",new k((1n<<63n)-1n)),h(k,"MIN",new k(0)),h(k,"ZERO",new k(0)),h(k,"z",u.union([u.object({value:u.bigint()}).transform(n=>new k(n.value)),u.string().transform(n=>new k(BigInt(n))),u.instanceof(Number).transform(n=>new k(n)),u.number().transform(n=>new k(n)),u.instanceof(k)]));let A=k;const We=class vt extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new vt(e).valueOf()}get period(){return A.seconds(1/this.valueOf())}sampleCount(e){return new A(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new L(t).valueOf()}span(e){return A.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new vt(e)}static khz(e){return vt.hz(e*1e3)}};h(We,"z",u.union([u.number().transform(n=>new We(n)),u.instanceof(Number).transform(n=>new We(n)),u.instanceof(We)]));let Sn=We;const B=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Jt(e*this.valueOf())}};h(B,"UNKNOWN",new B(0)),h(B,"BIT128",new B(16)),h(B,"BIT64",new B(8)),h(B,"BIT32",new B(4)),h(B,"BIT16",new B(2)),h(B,"BIT8",new B(1)),h(B,"z",u.union([u.number().transform(n=>new B(n)),u.instanceof(Number).transform(n=>new B(n)),u.instanceof(B)]));let L=B;const J=class wt{constructor(e,t){h(this,"start"),h(this,"end"),typeof e=="object"&&"start"in e?(this.start=new E(e.start),this.end=new E(e.end)):(this.start=new E(e),this.end=new E(t))}get span(){return new A(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}get numeric(){return{start:Number(this.start.valueOf()),end:Number(this.end.valueOf())}}swap(){return new wt(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,t=A.ZERO){e=e.makeValid();const r=this.makeValid();if(this.equals(e))return!0;if(e.end.equals(r.start)||r.end.equals(e.start))return!1;const s=E.max(r.start,e.start),i=E.min(r.end,e.end);return i.before(s)?!1:new A(i.sub(s)).greaterThanOrEqual(t)}roughlyEquals(e,t){let r=this.start.sub(e.start).valueOf(),s=this.end.sub(e.end).valueOf();return r<0&&(r=-r),s<0&&(s=-s),r<=t.valueOf()&&s<=t.valueOf()}contains(e){return e instanceof wt?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new wt(this.start,this.end);return e.start.after(this.start)&&(t.start=e.start),e.start.after(this.end)&&(t.end=e.start),e.end.before(this.end)&&(t.end=e.end),e.end.before(this.start)&&(t.start=e.end),t}};h(J,"MAX",new J(E.MIN,E.MAX)),h(J,"MIN",new J(E.MAX,E.MIN)),h(J,"ZERO",new J(E.ZERO,E.ZERO)),h(J,"z",u.union([u.object({start:E.z,end:E.z}).transform(n=>new J(n.start,n.end)),u.instanceof(J)]));let dn=J;const d=class R extends String{constructor(e){if(e instanceof R||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}const t=R.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}throw super(R.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=R.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}matches(...e){return e.some(t=>this.equals(t))}toString(){return this.valueOf()}get isVariable(){return this.equals(R.JSON)||this.equals(R.STRING)}get isNumeric(){return!this.isVariable&&!this.equals(R.UUID)}get isInteger(){const e=this.toString();return e.startsWith("int")||e.startsWith("uint")}get isFloat(){return this.toString().startsWith("float")}get density(){const e=R.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}get isUnsigned(){return this.equals(R.UINT8)||this.equals(R.UINT16)||this.equals(R.UINT32)||this.equals(R.UINT64)}get isSigned(){return this.equals(R.INT8)||this.equals(R.INT16)||this.equals(R.INT32)||this.equals(R.INT64)}canSafelyCastTo(e){return this.equals(e)?!0:!this.isNumeric||!e.isNumeric||this.isVariable||e.isVariable||this.isUnsigned&&e.isSigned?!1:this.isFloat?e.isFloat&&this.density.valueOf()<=e.density.valueOf():this.equals(R.INT32)&&e.equals(R.FLOAT64)||this.equals(R.INT8)&&e.equals(R.FLOAT32)?!0:this.isInteger&&e.isInteger?this.density.valueOf()<=e.density.valueOf()&&this.isUnsigned===e.isUnsigned:!1}canCastTo(e){return this.isNumeric&&e.isNumeric?!0:this.equals(e)}checkArray(e){return e.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return R.BIG_INT_TYPES.some(e=>e.equals(this))}};h(d,"UNKNOWN",new d("unknown")),h(d,"FLOAT64",new d("float64")),h(d,"FLOAT32",new d("float32")),h(d,"INT64",new d("int64")),h(d,"INT32",new d("int32")),h(d,"INT16",new d("int16")),h(d,"INT8",new d("int8")),h(d,"UINT64",new d("uint64")),h(d,"UINT32",new d("uint32")),h(d,"UINT16",new d("uint16")),h(d,"UINT8",new d("uint8")),h(d,"BOOLEAN",d.UINT8),h(d,"TIMESTAMP",new d("timestamp")),h(d,"UUID",new d("uuid")),h(d,"STRING",new d("string")),h(d,"JSON",new d("json")),h(d,"ARRAY_CONSTRUCTORS",new Map([[d.UINT8.toString(),Uint8Array],[d.UINT16.toString(),Uint16Array],[d.UINT32.toString(),Uint32Array],[d.UINT64.toString(),BigUint64Array],[d.FLOAT32.toString(),Float32Array],[d.FLOAT64.toString(),Float64Array],[d.INT8.toString(),Int8Array],[d.INT16.toString(),Int16Array],[d.INT32.toString(),Int32Array],[d.INT64.toString(),BigInt64Array],[d.TIMESTAMP.toString(),BigInt64Array],[d.STRING.toString(),Uint8Array],[d.JSON.toString(),Uint8Array],[d.UUID.toString(),Uint8Array]])),h(d,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,d.UINT8],[Uint16Array.name,d.UINT16],[Uint32Array.name,d.UINT32],[BigUint64Array.name,d.UINT64],[Float32Array.name,d.FLOAT32],[Float64Array.name,d.FLOAT64],[Int8Array.name,d.INT8],[Int16Array.name,d.INT16],[Int32Array.name,d.INT32],[BigInt64Array.name,d.INT64]])),h(d,"DENSITIES",new Map([[d.UINT8.toString(),L.BIT8],[d.UINT16.toString(),L.BIT16],[d.UINT32.toString(),L.BIT32],[d.UINT64.toString(),L.BIT64],[d.FLOAT32.toString(),L.BIT32],[d.FLOAT64.toString(),L.BIT64],[d.INT8.toString(),L.BIT8],[d.INT16.toString(),L.BIT16],[d.INT32.toString(),L.BIT32],[d.INT64.toString(),L.BIT64],[d.TIMESTAMP.toString(),L.BIT64],[d.STRING.toString(),L.UNKNOWN],[d.JSON.toString(),L.UNKNOWN],[d.UUID.toString(),L.BIT128]])),h(d,"ALL",[d.UNKNOWN,d.FLOAT64,d.FLOAT32,d.INT64,d.INT32,d.INT16,d.INT8,d.UINT64,d.UINT32,d.UINT16,d.UINT8,d.TIMESTAMP,d.UUID,d.STRING,d.JSON]),h(d,"BIG_INT_TYPES",[d.INT64,d.UINT64,d.TIMESTAMP]),h(d,"z",u.union([u.string().transform(n=>new d(n)),u.instanceof(d)]));let N=d;const U=class Z extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return Z.bytes(this.valueOf()+e.valueOf())}sub(e){return Z.bytes(this.valueOf()-e.valueOf())}truncate(e){return new Z(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return Z.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/Z.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/Z.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/Z.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/Z.TERABYTE.valueOf()}toString(){const e=this.truncate(Z.TERABYTE),t=this.truncate(Z.GIGABYTE),r=this.truncate(Z.MEGABYTE),s=this.truncate(Z.KILOBYTE),i=this.truncate(Z.BYTE),a=e,o=t.sub(e),c=r.sub(t),l=s.sub(r),p=i.sub(s);let y="";return a.isZero||(y+=`${a.terabytes}TB `),o.isZero||(y+=`${o.gigabytes}GB `),c.isZero||(y+=`${c.megabytes}MB `),l.isZero||(y+=`${l.kilobytes}KB `),(!p.isZero||y==="")&&(y+=`${p.valueOf()}B`),y.trim()}static bytes(e=1){return new Z(e)}static kilobytes(e=1){return Z.bytes(e.valueOf()*1e3)}static megabytes(e=1){return Z.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return Z.megabytes(e.valueOf()*1e3)}static terabytes(e){return Z.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};h(U,"BYTE",new U(1)),h(U,"KILOBYTE",U.kilobytes(1)),h(U,"MEGABYTE",U.megabytes(1)),h(U,"GIGABYTE",U.gigabytes(1)),h(U,"TERABYTE",U.terabytes(1)),h(U,"ZERO",new U(0)),h(U,"z",u.union([u.number().transform(n=>new U(n)),u.instanceof(U)]));let Jt=U;u.union([u.instanceof(Uint8Array),u.instanceof(Uint16Array),u.instanceof(Uint32Array),u.instanceof(BigUint64Array),u.instanceof(Float32Array),u.instanceof(Float64Array),u.instanceof(Int8Array),u.instanceof(Int16Array),u.instanceof(Int32Array),u.instanceof(BigInt64Array)]);const yr=n=>{const e=typeof n;return e==="string"||e==="number"||e==="boolean"||e==="bigint"||n instanceof E||n instanceof A||n instanceof Date},ma=(n,e,t,r=0)=>n.usesBigInt&&!e.usesBigInt?Number(t)-Number(r):!n.usesBigInt&&e.usesBigInt?BigInt(t.valueOf())-BigInt(r.valueOf()):ze(t,-r).valueOf(),ze=(n,e)=>typeof n=="bigint"&&typeof e=="bigint"||typeof n=="number"&&typeof e=="number"?n+e:e===0?n:n===0?e:Number(n)+Number(e),ya=n=>n==null?!1:Array.isArray(n)||n instanceof ArrayBuffer||ArrayBuffer.isView(n)&&!(n instanceof DataView)||n instanceof wa?!0:yr(n),ue=-1,ga=u.string().transform(n=>new Uint8Array(atob(n).split("").map(e=>e.charCodeAt(0))).buffer),va=u.union([u.null(),u.undefined()]).transform(()=>new Uint8Array().buffer),Ht=10,Ve=class H{constructor(e){h(this,"key",""),h(this,"isSynnaxSeries",!0),h(this,"dataType"),h(this,"sampleOffset"),h(this,"gl"),h(this,"_data"),h(this,"_timeRange"),h(this,"alignment",0n),h(this,"_cachedMin"),h(this,"_cachedMax"),h(this,"writePos",ue),h(this,"_refCount",0),h(this,"_cachedLength"),h(this,"_cachedIndexes"),ya(e)&&(e={data:e});const{dataType:t,timeRange:r,sampleOffset:s=0,glBufferUsage:i="static",alignment:a=0n,key:o=pr()}=e,c=e.data??[];if(c instanceof H||typeof c=="object"&&"isSynnaxSeries"in c&&c.isSynnaxSeries===!0){const y=c;this.key=y.key,this.dataType=y.dataType,this.sampleOffset=y.sampleOffset,this.gl=y.gl,this._data=y._data,this._timeRange=y._timeRange,this.alignment=y.alignment,this._cachedMin=y._cachedMin,this._cachedMax=y._cachedMax,this.writePos=y.writePos,this._refCount=y._refCount,this._cachedLength=y._cachedLength;return}const l=yr(c),p=Array.isArray(c);if(t!=null)this.dataType=new N(t);else{if(c instanceof ArrayBuffer)throw new Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");if(p||l){let y=c;if(!l){if(c.length===0)throw new Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");y=c[0]}if(typeof y=="string")this.dataType=N.STRING;else if(typeof y=="number")this.dataType=N.FLOAT64;else if(typeof y=="bigint")this.dataType=N.INT64;else if(typeof y=="boolean")this.dataType=N.BOOLEAN;else if(y instanceof E||y instanceof Date||y instanceof E)this.dataType=N.TIMESTAMP;else if(typeof y=="object")this.dataType=N.JSON;else throw new Error(`cannot infer data type of ${typeof y} when constructing a Series from a JS array`)}else this.dataType=new N(c)}if(!p&&!l)this._data=c;else{let y=l?[c]:c;const j=y[0];(j instanceof E||j instanceof Date||j instanceof A)&&(y=y.map(D=>new E(D).valueOf())),this.dataType.equals(N.STRING)?(this._cachedLength=y.length,this._data=new TextEncoder().encode(`${y.join(`
|
|
4
4
|
`)}
|
|
5
|
-
`).buffer):this.dataType.equals(N.JSON)?(this._cachedLength=y.length,this._data=new TextEncoder().encode(`${y.map(
|
|
5
|
+
`).buffer):this.dataType.equals(N.JSON)?(this._cachedLength=y.length,this._data=new TextEncoder().encode(`${y.map(D=>pt.encodeString(D)).join(`
|
|
6
6
|
`)}
|
|
7
|
-
`).buffer):this.dataType.usesBigInt&&typeof j=="number"?this._data=new this.dataType.Array(y.map(
|
|
7
|
+
`).buffer):this.dataType.usesBigInt&&typeof j=="number"?this._data=new this.dataType.Array(y.map(D=>BigInt(Math.round(D)))).buffer:!this.dataType.usesBigInt&&typeof j=="bigint"?this._data=new this.dataType.Array(y.map(D=>Number(D))).buffer:this._data=new this.dataType.Array(y).buffer}this.key=o,this.alignment=a,this.sampleOffset=s??0,this._timeRange=r,this.gl={control:null,buffer:null,prevBuffer:0,bufferUsage:i}}static alloc({capacity:e,dataType:t,...r}){if(e===0)throw new Error("[Series] - cannot allocate an array of length 0");const s=new new N(t).Array(e),i=new H({data:s.buffer,dataType:t,...r});return i.writePos=0,i}static createTimestamps(e,t,r){const s=r.spanRange(t.span(e)),i=new BigInt64Array(e);for(let a=0;a<e;a++)i[a]=BigInt(r.add(t.span(a)).valueOf());return new H({data:i,dataType:N.TIMESTAMP,timeRange:s})}get refCount(){return this._refCount}static fromStrings(e,t){const r=new TextEncoder().encode(`${e.join(`
|
|
8
8
|
`)}
|
|
9
9
|
`);return new H({data:r,dataType:N.STRING,timeRange:t})}static fromJSON(e,t){const r=new TextEncoder().encode(`${e.map(s=>pt.encodeString(s)).join(`
|
|
10
10
|
`)}
|
|
11
11
|
`);return new H({data:r,dataType:N.JSON,timeRange:t})}acquire(e){this._refCount++,e!=null&&this.updateGLBuffer(e)}release(){if(this._refCount--,this._refCount===0&&this.gl.control!=null)this.maybeGarbageCollectGLBuffer(this.gl.control);else if(this._refCount<0)throw new Error("cannot release an array with a negative reference count")}write(e){if(!e.dataType.equals(this.dataType))throw new Error("buffer must be of the same type as this array");return this.dataType.isVariable?this.writeVariable(e):this.writeFixed(e)}writeVariable(e){if(this.writePos===ue)return 0;const t=this.byteCapacity.valueOf()-this.writePos,r=e.subBytes(0,t);return this.writeToUnderlyingData(r),this.writePos+=r.byteLength.valueOf(),this._cachedLength!=null&&(this._cachedLength+=r.length,this.calculateCachedLength()),r.length}writeFixed(e){if(this.writePos===ue)return 0;const t=this.capacity-this.writePos,r=e.sub(0,t);return this.writeToUnderlyingData(r),this._cachedLength=void 0,this.maybeRecomputeMinMax(r),this.writePos+=r.length,r.length}writeToUnderlyingData(e){this.underlyingData.set(e.data,this.writePos)}get buffer(){return typeof this._data=="object"&&"buffer"in this._data?this._data.buffer:this._data}get underlyingData(){return new this.dataType.Array(this._data)}get data(){return this.writePos===ue?this.underlyingData:new this.dataType.Array(this._data,0,this.writePos)}toStrings(){if(!this.dataType.matches(N.STRING,N.UUID))throw new Error("cannot convert non-string series to strings");return new TextDecoder().decode(this.underlyingData).split(`
|
|
12
12
|
`).slice(0,-1)}toUUIDs(){if(!this.dataType.equals(N.UUID))throw new Error("cannot convert non-uuid series to uuids");const e=N.UUID.density.valueOf(),t=Array(this.length);for(let r=0;r<this.length;r++){const s=this.underlyingData.slice(r*e,(r+1)*e),i=Array.from(new Uint8Array(s.buffer),a=>a.toString(16).padStart(2,"0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5");t[r]=i}return t}parseJSON(e){if(!this.dataType.equals(N.JSON))throw new Error("cannot parse non-JSON series as JSON");return new TextDecoder().decode(this.underlyingData).split(`
|
|
13
|
-
`).slice(0,-1).map(t=>e.parse(pt.decodeString(t)))}get timeRange(){if(this._timeRange==null)throw new Error("time range not set on series");return this._timeRange}get byteCapacity(){return new Jt(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===ue?this.byteCapacity:this.dataType.isVariable?new Jt(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===ue?this.data.length:this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const t=[0];return this.data.forEach((r,s)=>{r===Ht&&(e++,t.push(s+1))}),this._cachedIndexes=t,this._cachedLength=e,e}convert(e,t=0){if(this.dataType.equals(e))return this;const r=new e.Array(this.length);for(let s=0;s<this.length;s++)r[s]=ma(this.dataType,e,this.data[s],t);return new H({data:r.buffer,dataType:e,timeRange:this._timeRange,sampleOffset:t,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(N.TIMESTAMP))this._cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMax=e.reduce((t,r)=>t>r?t:r)}else{const e=this.data;this._cachedMax=e.reduce((t,r)=>t>r?t:r)}return this._cachedMax}get max(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this._cachedMax??(this._cachedMax=this.calcRawMax()),ze(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(N.TIMESTAMP))this._cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMin=e.reduce((t,r)=>t<r?t:r)}else{const e=this.data;this._cachedMin=e.reduce((t,r)=>t<r?t:r)}return this._cachedMin}get min(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this._cachedMin??(this._cachedMin=this.calcRawMin()),ze(this._cachedMin,this.sampleOffset))}get bounds(){return be(Number(this.min),Number(this.max))}maybeRecomputeMinMax(e){if(this._cachedMin!=null){const t=e._cachedMin??e.calcRawMin();t<this._cachedMin&&(this._cachedMin=t)}if(this._cachedMax!=null){const t=e._cachedMax??e.calcRawMax();t>this._cachedMax&&(this._cachedMax=t)}}enrich(){this.max,this.min}get range(){return ze(this.max,-this.min)}atAlignment(e,t){const r=Number(e-this.alignment);if(r<0||r>=this.length){if(t===!0)throw new Error(`[series] - no value at index ${r}`);return}return this.at(r,t)}at(e,t){if(this.dataType.isVariable)return this.atVariable(e,t??!1);e<0&&(e=this.length+e);const r=this.data[e];if(r==null){if(t===!0)throw new Error(`[series] - no value at index ${e}`);return}return ze(r,this.sampleOffset)}atVariable(e,t){let r=0,s=0;if(this._cachedIndexes!=null)r=this._cachedIndexes[e],s=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let a=0;a<this.data.length;a++)if(this.data[a]===Ht){if(e===0){s=a;break}r=a+1,e--}if(s===0&&(s=this.data.length),r>=s||e>0){if(t)throw new Error(`[series] - no value at index ${e}`);return}}const i=this.data.slice(r,s);return this.dataType.equals(N.STRING)?new TextDecoder().decode(i):Zn(JSON.parse(new TextDecoder().decode(i)))}binarySearch(e){let t=0,r=this.length-1;const s=Js(e);for(;t<=r;){const i=Math.floor((t+r)/2),a=s(this.at(i,!0),e);if(a===0)return i;a<0?t=i+1:r=i-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(N.FLOAT32)&&!this.dataType.equals(N.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:t,bufferUsage:r,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!==ue){s===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const i=this.dataType.density.size(s).valueOf(),a=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,i,a.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,r==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=ue}as(e){if(e==="string"){if(!this.dataType.equals(N.STRING))throw new Error(`cannot convert series of type ${this.dataType.toString()} to string`);return this}if(e==="number"){if(!this.dataType.isNumeric)throw new Error(`cannot convert series of type ${this.dataType.toString()} to number`);return this}if(e==="bigint"){if(!this.dataType.equals(N.INT64))throw new Error(`cannot convert series of type ${this.dataType.toString()} to bigint`);return this}throw new Error(`cannot convert series to ${e}`)}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:$n(this.alignmentBounds.lower),upper:$n(this.alignmentBounds.upper)},timeRange:(e=this._timeRange)==null?void 0:e.toString(),length:this.length,capacity:this.capacity}}get memInfo(){return{key:this.key,length:this.length,byteLength:this.byteLength,glBuffer:this.gl.buffer!=null}}get alignmentBounds(){return be(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const e=new ba(this);return this.dataType.equals(N.JSON)?new xa(e):e}return new _a(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new Nn(this,e,t??this.length)}subAlignmentIterator(e,t){return new Nn(this,Number(e-this.alignment),Number(t-this.alignment))}subBytes(e,t){if(e>=0&&(t==null||t>=this.byteLength.valueOf()))return this;const r=this.data.subarray(e,t);return new H({data:r,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,t,r){if(t<=0&&(r==null||r>=this.length))return this;let s;return e?s=this.data.subarray(t,r):s=this.data.slice(t,r),new H({data:s,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(e){return new H({data:this.buffer,dataType:this.dataType,timeRange:dn.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}};h(Ve,"crudeZ",u.object({timeRange:dn.z.optional(),dataType:N.z,alignment:u.coerce.bigint().optional(),data:u.union([ga,va,u.instanceof(ArrayBuffer),u.instanceof(Uint8Array)]),glBufferUsage:pa.optional().default("static").optional()})),h(Ve,"z",Ve.crudeZ.transform(n=>new Ve(n)));let wa=Ve;class Nn{constructor(e,t,r){h(this,"series"),h(this,"end"),h(this,"index"),this.series=e;const s=be(0,e.length);this.end=_n(s,r),this.index=_n(s,t)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}}class ba{constructor(e){if(h(this,"series"),h(this,"index"),h(this,"decoder"),!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,t=this.series.data;for(;this.index<t.length&&t[this.index]!==Ht;)this.index++;const r=this.index;return e===r?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,r))})}[Symbol.iterator](){return this}}var In,kn;class xa{constructor(e){h(this,"wrapped"),h(this,In,"JSONSeriesIterator"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:pt.decodeString(e.value)}}[(kn=Symbol.iterator,In=Symbol.toStringTag,kn)](){return this}}var An,En;class _a{constructor(e){h(this,"series"),h(this,"index"),h(this,An,"SeriesIterator"),this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[(En=Symbol.iterator,An=Symbol.toStringTag,En)](){return this}}const $n=n=>{const e=n>>32n,t=n&0xffffffffn;return{domain:e,sample:t}},Ta=(n,e,t=".")=>{const r=n.split(t);return r.map((s,i)=>{const a=e(s,i,r);return a==null?null:typeof a=="string"?a:a.join(t)}).filter(s=>s!=null).join(t)},gr=(n,e,t={optional:!1,separator:"."})=>{t.separator??(t.separator=".");const{optional:r,getter:s=(o,c)=>o[c]}=t,i=e.split(t.separator);if(i.length===1&&i[0]==="")return n;let a=n;for(const o of i){const c=s(a,o);if(c==null){if(r)return null;throw new Error(`Path ${e} does not exist. ${o} is null`)}a=c}return a},Oa=(n,e,t)=>{const r=e.split(".");let s=n;for(let i=0;i<r.length-1;i++){const a=r[i];s[a]??(s[a]={}),s=s[a]}try{s[r[r.length-1]]=t}catch(i){throw console.error("failed to set value",t,"at path",e,"on object",n),i}},Sa=(n,e)=>{const t=e.split(".");let r=n;for(let s=0;s<t.length-1;s++){const i=t[s];if(r[i]==null)return;r=r[i]}if(Array.isArray(r)){const s=parseInt(t[t.length-1]);if(isNaN(s))return;r.splice(s,1);return}delete r[t[t.length-1]]},Na=(n,e)=>{const t=n.split(".");return e<0?t[t.length+e]:t[e]},Ia=(n,e)=>{try{return gr(n,e),!0}catch{return!1}},ka=(n,e)=>{if(e.length===0)return!0;const t=n.split("."),r=e.split(".");if(r.length>t.length)return!1;for(let s=0;s<r.length;s++){const i=t[s],a=r[s];if(a!=="*"&&i!==a)return!1}return!0},Aa=n=>JSON.parse(JSON.stringify(n)),Ea=(n,...e)=>(e.forEach(t=>{let r=n;const s=t.split(".");s.forEach((i,a)=>{a===s.length-1?delete r[i]:i in r&&(r=r[i])})}),n),$a=(n,e,t="")=>{const r={},s=(i,a,o)=>{if(typeof i!=typeof a||i===null||a===null){r[o]=[i,a];return}if(typeof i=="object"&&typeof a=="object")if(Array.isArray(i)&&Array.isArray(a)){if(i.length!==a.length){r[o]=[i,a];return}for(let c=0;c<i.length;c++)s(i[c],a[c],`${o}[${c}]`)}else new Set([...Object.keys(i),...Object.keys(a)]).forEach(c=>{s(i[c],a[c],o!==""?`${o}.${c}`:c)});else i!==a&&(r[o]=[i,a])};return s(n,e,t),r},Xt=(n,e)=>{const t=Array.isArray(n),r=Array.isArray(e);if(t!==r)return!1;if(t&&r){const a=n,o=e;if(a.length!==o.length)return!1;for(let c=0;c<a.length;c++)if(!Xt(a[c],o[c]))return!1;return!0}if(n==null||e==null||typeof n!="object"||typeof e!="object")return n===e;if("equals"in n)return n.equals(e);const s=Object.keys(n),i=Object.keys(e);if(s.length!==i.length)return!1;for(const a of s){const o=n[a],c=e[a];if(typeof o=="object"&&typeof c=="object"){if(!Xt(o,c))return!1}else if(o!==c)return!1}return!0},vr=(n,e)=>{if(typeof n!="object"||n==null)return n===e;const t=Object.keys(n),r=Object.keys(e);if(r.length>t.length)return!1;for(const s of r){const i=n[s],a=e[s];if(typeof i=="object"&&typeof a=="object"){if(!vr(i,a))return!1}else if(i!==a)return!1}return!0},Kt=(n,...e)=>{if(e.length===0)return n;const t=e.shift();if(Ge(n)&&Ge(t))for(const r in t)try{Ge(t[r])?(r in n||Object.assign(n,{[r]:{}}),Kt(n[r],t[r])):Object.assign(n,{[r]:t[r]})}catch(s){throw s instanceof TypeError?new TypeError(`.${r}: ${s.message}`):s}return Kt(n,...e)},Ma=(n,e,t)=>{const r=(s,i,a)=>{for(const o in i){const c=i[o],l=wr(a);if(l!=null&&l[o]){const p=l[o].safeParse(c);p.success&&(s[o]=p.data)}else typeof c=="object"&&!Array.isArray(c)&&c!==null&&a&&a.shape&&a.shape[o]&&(s[o]||(s[o]={}),r(s[o],c,a.shape[o]))}return s};return r({...n},e,t)},wr=n=>{var e;return((e=n._def)==null?void 0:e.typeName)==="ZodEffects"?wr(n._def.schema):n==null?void 0:n.shape},hn=Object.freeze(Object.defineProperty({__proto__:null,copy:Aa,deleteD:Ea,difference:$a,element:Na,equal:Xt,get:gr,has:Ia,override:Kt,overrideValidItems:Ma,partialEqual:vr,pathsMatch:ka,remove:Sa,set:Oa,transformPath:Ta},Symbol.toStringTag,{value:"Module"}));u.object({key:u.string(),value:u.string()});u.record(u.union([u.number(),u.string(),u.symbol()]),u.unknown());const br=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Ra=br(),xr=["macOS","Windows","Linux"],Ca=["macos","windows","linux"],ja={macos:"macOS",windows:"Windows",linux:"Linux"},Za=u.enum(xr).or(u.enum(Ca).transform(n=>ja[n])),Ba=()=>{if(typeof window>"u")return;const n=window.navigator.userAgent.toLowerCase();if(n.includes("mac"))return"macOS";if(n.includes("win"))return"Windows";if(n.includes("linux"))return"Linux"};let Bt;const Ua=(n={})=>{const{force:e,default:t}=n;return e??Bt??(Bt=Ba(),Bt??t)},Da=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:xr,RUNTIME:Ra,detect:br,getOS:Ua,osZ:Za},Symbol.toStringTag,{value:"Module"}));var Pa=Object.defineProperty,La=(n,e,t)=>e in n?Pa(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,qe=(n,e,t)=>La(n,typeof e!="symbol"?e+"":e,t);const Wa=(...n)=>n.map(_r).join(""),_r=n=>(n.endsWith("/")||(n+="/"),n.startsWith("/")&&(n=n.slice(1)),n),za=n=>n.endsWith("/")?n.slice(0,-1):n,Mn=class Qt{constructor({host:e,port:t,protocol:r="",pathPrefix:s=""}){qe(this,"protocol"),qe(this,"host"),qe(this,"port"),qe(this,"path"),this.protocol=r,this.host=e,this.port=t,this.path=_r(s)}replace(e){return new Qt({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Qt({...this,pathPrefix:Wa(this.path,e)})}toString(){return za(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};qe(Mn,"UNKNOWN",new Mn({host:"unknown",port:0}));const Va=-128,qa=127;u.number().int().min(Va).max(qa);const Fa=-32768,Ya=32767;u.number().int().min(Fa).max(Ya);const Ga=-2147483648,Ja=2147483647;u.number().int().min(Ga).max(Ja);const Ha=-9223372036854775808n,Xa=9223372036854775807n;u.bigint().min(Ha).max(Xa);const Ka=255;u.number().int().min(0).max(Ka);const Qa=65535;u.number().int().min(0).max(Qa);const eo=4294967295;u.number().int().min(0).max(eo);const to=18446744073709551615n;u.bigint().min(0n).max(to);var no=Object.defineProperty,ro=(n,e,t)=>e in n?no(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Fe=(n,e,t)=>ro(n,typeof e!="symbol"?e+"":e,t);u.object({interval:A.z.optional(),maxRetries:u.number().optional(),scale:u.number().optional()});const te=class extends Number{};Fe(te,"ABSOLUTE",255),Fe(te,"MINIMUM",0),Fe(te,"BOUNDS",{lower:te.MINIMUM,upper:te.ABSOLUTE+1}),Fe(te,"z",u.union([u.instanceof(te),u.number().int().min(0).max(255).transform(n=>new te(n)),u.instanceof(Number).transform(n=>new te(n))]));u.object({name:u.string(),key:u.string()});const Tr=class Ye extends Error{constructor(){super(Ye.MESSAGE)}matches(e){return typeof e=="string"?e.includes(Ye.MESSAGE):e instanceof Ye||e.message.includes(Ye.MESSAGE)}};Fe(Tr,"MESSAGE","canceled");let so=Tr;new so;u.string().regex(/^\d+\.\d+\.\d+$/);const ve="main",fn="prerender",Rt={stage:"creating",processCount:0,reserved:!1,focusCount:0,centerCount:0},Or={...Rt,key:fn,visible:!1},io=u.object({key:u.string(),url:u.string().optional(),title:u.string().optional(),center:u.boolean().optional(),position:kt.xy.optional(),size:gt.dimensions.optional(),minSize:gt.dimensions.optional(),maxSize:gt.dimensions.optional(),resizable:u.boolean().optional(),fullscreen:u.boolean().optional(),focus:u.boolean().optional(),maximized:u.boolean().optional(),visible:u.boolean().optional(),minimized:u.boolean().optional(),decorations:u.boolean().optional(),skipTaskbar:u.boolean().optional(),fileDropEnabled:u.boolean().optional(),transparent:u.boolean().optional(),alwaysOnTop:u.boolean().optional()}),ao=A.milliseconds(50),Sr=()=>setTimeout(()=>window.location.reload(),ao.milliseconds),Nr={label:ve,config:{enablePrerender:!0,debug:!1,defaultWindowProps:{}},windows:{main:{...Rt,key:ve,reserved:!0}},labelKeys:{main:ve},keyLabels:{main:ve}},oo=(n,e)=>{if(n.type===kr.type)return e.label!==ve||(n.payload.label=Gt.create(),n.payload.prerenderLabel=Gt.create()),n;if("label"in n.payload)return n;let t=e.label;const r=n.payload;return r.key!=null&&(r.key in e.windows?t=r.key:t=e.keyLabels[r.key]),n.payload={...n.payload,label:t},n},V=n=>(e,t)=>{if(!("label"in t.payload))throw new Error("Missing label");n(e,t)},ge=(n,e=!1)=>V((t,r)=>{let s=e;const i=t.windows[r.payload.label];if(i!=null){if(r.payload.value!=null)s=r.payload.value;else{const a=i[n];a!=null&&(s=!a)}t.windows[r.payload.label]={...i,[n]:s}}}),Ct=(n,e=!1)=>(t,r)=>{const s=t.windows[r.payload.label];s!=null&&(t.windows[r.payload.label]={...s,[n]:s[n]+(e?-1:1)})},uo=n=>Object.values(n.windows).some(e=>e.key===fn&&!e.reserved),pn="drift",co=(n,e,t)=>n.position!=null&&n.size!=null&&e==null?Pe.topLeft(Pe.positionInCenter(Pe.construct(kt.ZERO,t??kt.ZERO),Pe.construct(n.position,n.size))):e,lo=(n,{payload:e})=>{if(e.key===fn)return;const{key:t,label:r,prerenderLabel:s}=e;if(r==null||s==null)throw new Error("[drift] - bug - missing label and prerender label");console.log(n.config.debug),Cn(n.config.debug,"reducer create window");const i=n.windows.main;if(e.position=co(i,e.position,e.size),t in n.keyLabels){je(n.config.debug,"window already exists, un-minimize and focus it");const c=n.keyLabels[e.key];n.windows[c].visible=!0,n.windows[c].focusCount+=1,n.windows[c].minimized=!1,n.windows[c].position=e.position,Ut(n.config.debug);return}const[a,o]=Object.entries(n.windows).find(([,c])=>!c.reserved)??[null,null];a!=null?(je(n.config.debug,"using available pre-rendered window"),n.windows[a]={...o,visible:!0,reserved:!0,focusCount:1,focus:!0,...e},n.labelKeys[a]=e.key,n.keyLabels[e.key]=a):(je(n.config.debug,"creating new window"),n.windows[r]={...n.config.defaultWindowProps,...Rt,...e,reserved:!0},n.labelKeys[r]=t,n.keyLabels[t]=r),n.config.enablePrerender&&!uo(n)&&(je(n.config.debug,"creating pre-render window"),n.windows[s]=hn.copy({...n.config.defaultWindowProps,...Or})),Ut(n.config.debug)},ho=V((n,e)=>{const t=n.windows[e.payload.label];t!=null&&(t.stage=e.payload.stage)}),fo=V((n,{payload:{label:e}})=>{const t=n.windows[e];t==null||t.processCount>0||(t.stage="closing",delete n.windows[e],delete n.labelKeys[e],delete n.keyLabels[t.key])}),po=V((n,e)=>{const t=n.windows[e.payload.label];t==null||t.processCount>0||(t.stage="reloading",Sr())}),mo=V(Ct("processCount")),yo=V((n,e)=>{Ct("processCount",!0)(n,e);const t=n.windows[e.payload.label];t!=null&&t.processCount===0&&(t.stage==="reloading"?Sr():(n.windows[e.payload.label].visible=!1,delete n.windows[e.payload.label],delete n.labelKeys[e.payload.label],delete n.keyLabels[t.key]))}),go=(n,e)=>{const t=n.windows[e.payload.key];t!=null&&(t.error=e.payload.message)},vo=V((n,e)=>{const t=n.windows[e.payload.label];t!=null&&(t.visible!==!0&&(t.visible=!0),Ct("focusCount")(n,e))}),wo=ge("minimized"),bo=ge("maximized"),xo=ge("visible",!0),_o=ge("fullscreen",!0),To=V(Ct("centerCount")),Oo=V((n,e)=>{n.windows[e.payload.label].position=e.payload.position}),So=V((n,e)=>{n.windows[e.payload.label].size=e.payload.size}),No=V((n,e)=>{n.windows[e.payload.label].minSize=e.payload.size}),Io=V((n,e)=>{n.windows[e.payload.label].maxSize=e.payload.size}),ko=ge("resizable"),Ao=ge("skipTaskbar"),Eo=ge("alwaysOnTop"),$o=V((n,e)=>{n.windows[e.payload.label].title=e.payload.title}),Mo=ge("decorations"),Rn=(n,e)=>{const t=n.windows[e.payload.label];hn.partialEqual(t,e.payload)||(n.windows[e.payload.label]={...t,...e.payload})},Ro=(n,e)=>{if(n.config={...n.config,...e.payload},n.label=e.payload.label,n.label===ve&&n.config.enablePrerender){const t=Gt.create();n.windows[t]={...n.config.defaultWindowProps,...Or}}},Ir=Er.createSlice({name:pn,initialState:Nr,reducers:{internalSetInitial:Ro,createWindow:lo,setWindowStage:ho,closeWindow:fo,registerProcess:mo,completeProcess:yo,setWindowError:go,focusWindow:vo,reloadWindow:po,setWindowMinimized:wo,setWindowMaximized:bo,setWindowVisible:xo,setWindowFullscreen:_o,centerWindow:To,setWindowPosition:Oo,setWindowSize:So,setWindowMinSize:No,setWindowMaxSize:Io,setWindowResizable:ko,setWindowSkipTaskbar:Ao,setWindowAlwaysOnTop:Eo,setWindowTitle:$o,setWindowDecorations:Mo,runtimeSetWindowProps:Rn,setWindowProps:Rn}}),{actions:{runtimeSetWindowProps:Co,setWindowProps:jo,createWindow:kr,internalSetInitial:Ar,setWindowStage:Zo,closeWindow:Bo,registerProcess:Uo,completeProcess:Do,setWindowError:Po,focusWindow:Lo,reloadWindow:Wo,setWindowMinimized:zo,setWindowMaximized:Vo,setWindowVisible:qo,setWindowFullscreen:Fo,centerWindow:du,setWindowPosition:Yo,setWindowSize:Go,setWindowMinSize:Jo,setWindowMaxSize:Ho,setWindowResizable:Xo,setWindowSkipTaskbar:Ko,setWindowAlwaysOnTop:Qo,setWindowTitle:eu,setWindowDecorations:tu}}=Ir,nu=Ir.reducer,ru=n=>n.startsWith(pn),su=[Ar.type],iu=(n,e)=>!n&&!su.includes(e);exports.G=kt;exports.I=hn;exports.INITIAL_WINDOW_STATE=Rt;exports.MAIN_WINDOW=ve;exports.Mo=Pe;exports.S=Da;exports.SLICE_NAME=pn;exports.ZERO_SLICE_STATE=Nr;exports._=gt;exports.assignLabel=oo;exports.closeWindow=Bo;exports.completeProcess=Do;exports.createWindow=kr;exports.focusWindow=Lo;exports.group=Cn;exports.groupEnd=Ut;exports.internalSetInitial=Ar;exports.isDriftAction=ru;exports.log=je;exports.reducer=nu;exports.registerProcess=Uo;exports.reloadWindow=Wo;exports.runtimeSetWindowProps=Co;exports.setWindowAlwaysOnTop=Qo;exports.setWindowDecorations=tu;exports.setWindowError=Po;exports.setWindowFullscreen=Fo;exports.setWindowMaxSize=Ho;exports.setWindowMaximized=Vo;exports.setWindowMinSize=Jo;exports.setWindowMinimized=zo;exports.setWindowPosition=Yo;exports.setWindowProps=jo;exports.setWindowResizable=Xo;exports.setWindowSize=Go;exports.setWindowSkipTaskbar=Ko;exports.setWindowStage=Zo;exports.setWindowTitle=eu;exports.setWindowVisible=qo;exports.shouldEmit=iu;exports.windowPropsZ=io;exports.y=A;
|
|
13
|
+
`).slice(0,-1).map(t=>e.parse(pt.decodeString(t)))}get timeRange(){if(this._timeRange==null)throw new Error("time range not set on series");return this._timeRange}get byteCapacity(){return new Jt(this.underlyingData.byteLength)}get capacity(){return this.dataType.isVariable?this.byteCapacity.valueOf():this.dataType.density.length(this.byteCapacity)}get byteLength(){return this.writePos===ue?this.byteCapacity:this.dataType.isVariable?new Jt(this.writePos):this.dataType.density.size(this.writePos)}get length(){return this._cachedLength!=null?this._cachedLength:this.dataType.isVariable?this.calculateCachedLength():this.writePos===ue?this.data.length:this.writePos}calculateCachedLength(){if(!this.dataType.isVariable)throw new Error("cannot calculate length of a non-variable length data type");let e=0;const t=[0];return this.data.forEach((r,s)=>{r===Ht&&(e++,t.push(s+1))}),this._cachedIndexes=t,this._cachedLength=e,e}convert(e,t=0){if(this.dataType.equals(e))return this;const r=new e.Array(this.length);for(let s=0;s<this.length;s++)r[s]=ma(this.dataType,e,this.data[s],t);return new H({data:r.buffer,dataType:e,timeRange:this._timeRange,sampleOffset:t,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment})}calcRawMax(){if(this.length===0)return-1/0;if(this.dataType.equals(N.TIMESTAMP))this._cachedMax=this.data[this.data.length-1];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMax=e.reduce((t,r)=>t>r?t:r)}else{const e=this.data;this._cachedMax=e.reduce((t,r)=>t>r?t:r)}return this._cachedMax}get max(){if(this.dataType.isVariable)throw new Error("cannot calculate maximum on a variable length data type");return this.writePos===0?-1/0:(this._cachedMax??(this._cachedMax=this.calcRawMax()),ze(this._cachedMax,this.sampleOffset))}calcRawMin(){if(this.length===0)return 1/0;if(this.dataType.equals(N.TIMESTAMP))this._cachedMin=this.data[0];else if(this.dataType.usesBigInt){const e=this.data;this._cachedMin=e.reduce((t,r)=>t<r?t:r)}else{const e=this.data;this._cachedMin=e.reduce((t,r)=>t<r?t:r)}return this._cachedMin}get min(){if(this.dataType.isVariable)throw new Error("cannot calculate minimum on a variable length data type");return this.writePos===0?1/0:(this._cachedMin??(this._cachedMin=this.calcRawMin()),ze(this._cachedMin,this.sampleOffset))}get bounds(){return be(Number(this.min),Number(this.max))}maybeRecomputeMinMax(e){if(this._cachedMin!=null){const t=e._cachedMin??e.calcRawMin();t<this._cachedMin&&(this._cachedMin=t)}if(this._cachedMax!=null){const t=e._cachedMax??e.calcRawMax();t>this._cachedMax&&(this._cachedMax=t)}}enrich(){this.max,this.min}get range(){return ze(this.max,-this.min)}atAlignment(e,t){const r=Number(e-this.alignment);if(r<0||r>=this.length){if(t===!0)throw new Error(`[series] - no value at index ${r}`);return}return this.at(r,t)}at(e,t){if(this.dataType.isVariable)return this.atVariable(e,t??!1);e<0&&(e=this.length+e);const r=this.data[e];if(r==null){if(t===!0)throw new Error(`[series] - no value at index ${e}`);return}return ze(r,this.sampleOffset)}atVariable(e,t){let r=0,s=0;if(this._cachedIndexes!=null)r=this._cachedIndexes[e],s=this._cachedIndexes[e+1]-1;else{e<0&&(e=this.length+e);for(let a=0;a<this.data.length;a++)if(this.data[a]===Ht){if(e===0){s=a;break}r=a+1,e--}if(s===0&&(s=this.data.length),r>=s||e>0){if(t)throw new Error(`[series] - no value at index ${e}`);return}}const i=this.data.slice(r,s);return this.dataType.equals(N.STRING)?new TextDecoder().decode(i):Zn(JSON.parse(new TextDecoder().decode(i)))}binarySearch(e){let t=0,r=this.length-1;const s=Js(e);for(;t<=r;){const i=Math.floor((t+r)/2),a=s(this.at(i,!0),e);if(a===0)return i;a<0?t=i+1:r=i-1}return t}updateGLBuffer(e){if(this.gl.control=e,!this.dataType.equals(N.FLOAT32)&&!this.dataType.equals(N.UINT8))throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");const{buffer:t,bufferUsage:r,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!==ue){s===0&&e.bufferData(e.ARRAY_BUFFER,this.byteCapacity.valueOf(),e.STATIC_DRAW);const i=this.dataType.density.size(s).valueOf(),a=this.underlyingData.slice(this.gl.prevBuffer,this.writePos);e.bufferSubData(e.ARRAY_BUFFER,i,a.buffer),this.gl.prevBuffer=this.writePos}else e.bufferData(e.ARRAY_BUFFER,this.buffer,r==="static"?e.STATIC_DRAW:e.DYNAMIC_DRAW),this.gl.prevBuffer=ue}as(e){if(e==="string"){if(!this.dataType.equals(N.STRING))throw new Error(`cannot convert series of type ${this.dataType.toString()} to string`);return this}if(e==="number"){if(!this.dataType.isNumeric)throw new Error(`cannot convert series of type ${this.dataType.toString()} to number`);return this}if(e==="bigint"){if(!this.dataType.equals(N.INT64))throw new Error(`cannot convert series of type ${this.dataType.toString()} to bigint`);return this}throw new Error(`cannot convert series to ${e}`)}get digest(){var e;return{key:this.key,dataType:this.dataType.toString(),sampleOffset:this.sampleOffset,alignment:{lower:$n(this.alignmentBounds.lower),upper:$n(this.alignmentBounds.upper)},timeRange:(e=this._timeRange)==null?void 0:e.toString(),length:this.length,capacity:this.capacity}}get memInfo(){return{key:this.key,length:this.length,byteLength:this.byteLength,glBuffer:this.gl.buffer!=null}}get alignmentBounds(){return be(this.alignment,this.alignment+BigInt(this.length))}maybeGarbageCollectGLBuffer(e){this.gl.buffer!=null&&(e.deleteBuffer(this.gl.buffer),this.gl.buffer=null,this.gl.prevBuffer=0,this.gl.control=null)}get glBuffer(){if(this.gl.buffer==null)throw new Error("gl buffer not initialized");return this.gl.prevBuffer!==this.writePos&&console.warn("buffer not updated"),this.gl.buffer}[Symbol.iterator](){if(this.dataType.isVariable){const e=new ba(this);return this.dataType.equals(N.JSON)?new xa(e):e}return new _a(this)}slice(e,t){return this.sliceSub(!1,e,t)}sub(e,t){return this.sliceSub(!0,e,t)}subIterator(e,t){return new Nn(this,e,t??this.length)}subAlignmentIterator(e,t){return new Nn(this,Number(e-this.alignment),Number(t-this.alignment))}subBytes(e,t){if(e>=0&&(t==null||t>=this.byteLength.valueOf()))return this;const r=this.data.subarray(e,t);return new H({data:r,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(e)})}sliceSub(e,t,r){if(t<=0&&(r==null||r>=this.length))return this;let s;return e?s=this.data.subarray(t,r):s=this.data.slice(t,r),new H({data:s,dataType:this.dataType,timeRange:this._timeRange,sampleOffset:this.sampleOffset,glBufferUsage:this.gl.bufferUsage,alignment:this.alignment+BigInt(t)})}reAlign(e){return new H({data:this.buffer,dataType:this.dataType,timeRange:dn.ZERO,sampleOffset:this.sampleOffset,glBufferUsage:"static",alignment:e})}};h(Ve,"crudeZ",u.object({timeRange:dn.z.optional(),dataType:N.z,alignment:u.coerce.bigint().optional(),data:u.union([ga,va,u.instanceof(ArrayBuffer),u.instanceof(Uint8Array)]),glBufferUsage:pa.optional().default("static").optional()})),h(Ve,"z",Ve.crudeZ.transform(n=>new Ve(n)));let wa=Ve;class Nn{constructor(e,t,r){h(this,"series"),h(this,"end"),h(this,"index"),this.series=e;const s=be(0,e.length);this.end=_n(s,r),this.index=_n(s,t)}next(){return this.index>=this.end?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[Symbol.iterator](){return this}}class ba{constructor(e){if(h(this,"series"),h(this,"index"),h(this,"decoder"),!e.dataType.isVariable)throw new Error("cannot create a variable series iterator for a non-variable series");this.series=e,this.index=0,this.decoder=new TextDecoder}next(){const e=this.index,t=this.series.data;for(;this.index<t.length&&t[this.index]!==Ht;)this.index++;const r=this.index;return e===r?{done:!0,value:void 0}:(this.index++,{done:!1,value:this.decoder.decode(this.series.buffer.slice(e,r))})}[Symbol.iterator](){return this}}var In,kn;class xa{constructor(e){h(this,"wrapped"),h(this,In,"JSONSeriesIterator"),this.wrapped=e}next(){const e=this.wrapped.next();return e.done===!0?{done:!0,value:void 0}:{done:!1,value:pt.decodeString(e.value)}}[(kn=Symbol.iterator,In=Symbol.toStringTag,kn)](){return this}}var An,En;class _a{constructor(e){h(this,"series"),h(this,"index"),h(this,An,"SeriesIterator"),this.series=e,this.index=0}next(){return this.index>=this.series.length?{done:!0,value:void 0}:{done:!1,value:this.series.at(this.index++,!0)}}[(En=Symbol.iterator,An=Symbol.toStringTag,En)](){return this}}const $n=n=>{const e=n>>32n,t=n&0xffffffffn;return{domain:e,sample:t}},Ta=(n,e,t=".")=>{const r=n.split(t);return r.map((s,i)=>{const a=e(s,i,r);return a==null?null:typeof a=="string"?a:a.join(t)}).filter(s=>s!=null).join(t)},gr=(n,e,t={optional:!1,separator:"."})=>{t.separator??(t.separator=".");const{optional:r,getter:s=(o,c)=>o[c]}=t,i=e.split(t.separator);if(i.length===1&&i[0]==="")return n;let a=n;for(const o of i){const c=s(a,o);if(c==null){if(r)return null;throw new Error(`Path ${e} does not exist. ${o} is null`)}a=c}return a},Oa=(n,e,t)=>{const r=e.split(".");let s=n;for(let i=0;i<r.length-1;i++){const a=r[i];s[a]??(s[a]={}),s=s[a]}try{s[r[r.length-1]]=t}catch(i){throw console.error("failed to set value",t,"at path",e,"on object",n),i}},Sa=(n,e)=>{const t=e.split(".");let r=n;for(let s=0;s<t.length-1;s++){const i=t[s];if(r[i]==null)return;r=r[i]}if(Array.isArray(r)){const s=parseInt(t[t.length-1]);if(isNaN(s))return;r.splice(s,1);return}delete r[t[t.length-1]]},Na=(n,e)=>{const t=n.split(".");return e<0?t[t.length+e]:t[e]},Ia=(n,e)=>{try{return gr(n,e),!0}catch{return!1}},ka=(n,e)=>{if(e.length===0)return!0;const t=n.split("."),r=e.split(".");if(r.length>t.length)return!1;for(let s=0;s<r.length;s++){const i=t[s],a=r[s];if(a!=="*"&&i!==a)return!1}return!0},Aa=n=>JSON.parse(JSON.stringify(n)),Ea=(n,...e)=>(e.forEach(t=>{let r=n;const s=t.split(".");s.forEach((i,a)=>{a===s.length-1?delete r[i]:i in r&&(r=r[i])})}),n),$a=(n,e,t="")=>{const r={},s=(i,a,o)=>{if(typeof i!=typeof a||i===null||a===null){r[o]=[i,a];return}if(typeof i=="object"&&typeof a=="object")if(Array.isArray(i)&&Array.isArray(a)){if(i.length!==a.length){r[o]=[i,a];return}for(let c=0;c<i.length;c++)s(i[c],a[c],`${o}[${c}]`)}else new Set([...Object.keys(i),...Object.keys(a)]).forEach(c=>{s(i[c],a[c],o!==""?`${o}.${c}`:c)});else i!==a&&(r[o]=[i,a])};return s(n,e,t),r},Xt=(n,e)=>{const t=Array.isArray(n),r=Array.isArray(e);if(t!==r)return!1;if(t&&r){const a=n,o=e;if(a.length!==o.length)return!1;for(let c=0;c<a.length;c++)if(!Xt(a[c],o[c]))return!1;return!0}if(n==null||e==null||typeof n!="object"||typeof e!="object")return n===e;if("equals"in n)return n.equals(e);const s=Object.keys(n),i=Object.keys(e);if(s.length!==i.length)return!1;for(const a of s){const o=n[a],c=e[a];if(typeof o=="object"&&typeof c=="object"){if(!Xt(o,c))return!1}else if(o!==c)return!1}return!0},vr=(n,e)=>{if(typeof n!="object"||n==null)return n===e;const t=Object.keys(n),r=Object.keys(e);if(r.length>t.length)return!1;for(const s of r){const i=n[s],a=e[s];if(typeof i=="object"&&typeof a=="object"){if(!vr(i,a))return!1}else if(i!==a)return!1}return!0},Kt=(n,...e)=>{if(e.length===0)return n;const t=e.shift();if(Ge(n)&&Ge(t))for(const r in t)try{Ge(t[r])?(r in n||Object.assign(n,{[r]:{}}),Kt(n[r],t[r])):Object.assign(n,{[r]:t[r]})}catch(s){throw s instanceof TypeError?new TypeError(`.${r}: ${s.message}`):s}return Kt(n,...e)},Ma=(n,e,t)=>{const r=(s,i,a)=>{for(const o in i){const c=i[o],l=wr(a);if(l!=null&&l[o]){const p=l[o].safeParse(c);p.success&&(s[o]=p.data)}else typeof c=="object"&&!Array.isArray(c)&&c!==null&&a&&a.shape&&a.shape[o]&&(s[o]||(s[o]={}),r(s[o],c,a.shape[o]))}return s};return r({...n},e,t)},wr=n=>{var e;return((e=n._def)==null?void 0:e.typeName)==="ZodEffects"?wr(n._def.schema):n==null?void 0:n.shape},hn=Object.freeze(Object.defineProperty({__proto__:null,copy:Aa,deleteD:Ea,difference:$a,element:Na,equal:Xt,get:gr,has:Ia,override:Kt,overrideValidItems:Ma,partialEqual:vr,pathsMatch:ka,remove:Sa,set:Oa,transformPath:Ta},Symbol.toStringTag,{value:"Module"}));u.object({key:u.string(),value:u.string()});u.record(u.union([u.number(),u.string(),u.symbol()]),u.unknown());const br=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Ca=br(),xr=["macOS","Windows","Linux"],Ra=["macos","windows","linux"],ja={macos:"macOS",windows:"Windows",linux:"Linux"},Za=u.enum(xr).or(u.enum(Ra).transform(n=>ja[n])),Ba=()=>{if(typeof window>"u")return;const n=window.navigator.userAgent.toLowerCase();if(n.includes("mac"))return"macOS";if(n.includes("win"))return"Windows";if(n.includes("linux"))return"Linux"};let Bt;const Da=(n={})=>{const{force:e,default:t}=n;return e??Bt??(Bt=Ba(),Bt??t)},Ua=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:xr,RUNTIME:Ca,detect:br,getOS:Da,osZ:Za},Symbol.toStringTag,{value:"Module"}));var Pa=Object.defineProperty,La=(n,e,t)=>e in n?Pa(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,qe=(n,e,t)=>La(n,typeof e!="symbol"?e+"":e,t);const Wa=(...n)=>n.map(_r).join(""),_r=n=>(n.endsWith("/")||(n+="/"),n.startsWith("/")&&(n=n.slice(1)),n),za=n=>n.endsWith("/")?n.slice(0,-1):n,Mn=class Qt{constructor({host:e,port:t,protocol:r="",pathPrefix:s=""}){qe(this,"protocol"),qe(this,"host"),qe(this,"port"),qe(this,"path"),this.protocol=r,this.host=e,this.port=t,this.path=_r(s)}replace(e){return new Qt({host:e.host??this.host,port:e.port??this.port,protocol:e.protocol??this.protocol,pathPrefix:e.pathPrefix??this.path})}child(e){return new Qt({...this,pathPrefix:Wa(this.path,e)})}toString(){return za(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}};qe(Mn,"UNKNOWN",new Mn({host:"unknown",port:0}));const Va=-128,qa=127;u.number().int().min(Va).max(qa);const Fa=-32768,Ya=32767;u.number().int().min(Fa).max(Ya);const Ga=-2147483648,Ja=2147483647;u.number().int().min(Ga).max(Ja);const Ha=-9223372036854775808n,Xa=9223372036854775807n;u.bigint().min(Ha).max(Xa);const Ka=255;u.number().int().min(0).max(Ka);const Qa=65535;u.number().int().min(0).max(Qa);const eo=4294967295;u.number().int().min(0).max(eo);const to=18446744073709551615n;u.bigint().min(0n).max(to);var no=Object.defineProperty,ro=(n,e,t)=>e in n?no(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Fe=(n,e,t)=>ro(n,typeof e!="symbol"?e+"":e,t);u.object({interval:A.z.optional(),maxRetries:u.number().optional(),scale:u.number().optional()});const te=class extends Number{};Fe(te,"ABSOLUTE",255),Fe(te,"MINIMUM",0),Fe(te,"BOUNDS",{lower:te.MINIMUM,upper:te.ABSOLUTE+1}),Fe(te,"z",u.union([u.instanceof(te),u.number().int().min(0).max(255).transform(n=>new te(n)),u.instanceof(Number).transform(n=>new te(n))]));u.object({name:u.string(),key:u.string()});const Tr=class Ye extends Error{constructor(){super(Ye.MESSAGE)}matches(e){return typeof e=="string"?e.includes(Ye.MESSAGE):e instanceof Ye||e.message.includes(Ye.MESSAGE)}};Fe(Tr,"MESSAGE","canceled");let so=Tr;new so;u.string().regex(/^\d+\.\d+\.\d+$/);const ve="main",fn="prerender",Ct={stage:"creating",processCount:0,reserved:!1,focusCount:0,centerCount:0},Or={...Ct,key:fn,visible:!1},io=u.object({key:u.string(),url:u.string().optional(),title:u.string().optional(),center:u.boolean().optional(),position:kt.xy.optional(),size:gt.dimensions.optional(),minSize:gt.dimensions.optional(),maxSize:gt.dimensions.optional(),resizable:u.boolean().optional(),fullscreen:u.boolean().optional(),focus:u.boolean().optional(),maximized:u.boolean().optional(),visible:u.boolean().optional(),minimized:u.boolean().optional(),decorations:u.boolean().optional(),skipTaskbar:u.boolean().optional(),fileDropEnabled:u.boolean().optional(),transparent:u.boolean().optional(),alwaysOnTop:u.boolean().optional()}),ao=A.milliseconds(50),Sr=()=>setTimeout(()=>window.location.reload(),ao.milliseconds),Nr={label:ve,config:{enablePrerender:!0,debug:!1,defaultWindowProps:{}},windows:{main:{...Ct,key:ve,reserved:!0}},labelKeys:{main:ve},keyLabels:{main:ve}},oo=(n,e)=>{if(n.type===kr.type)return e.label!==ve||(n.payload.label=Gt.create(),n.payload.prerenderLabel=Gt.create()),n;if("label"in n.payload)return n;let t=e.label;const r=n.payload;return r.key!=null&&(r.key in e.windows?t=r.key:t=e.keyLabels[r.key]),n.payload={...n.payload,label:t},n},V=n=>(e,t)=>{if(!("label"in t.payload))throw new Error("Missing label");n(e,t)},ge=(n,e=!1)=>V((t,r)=>{let s=e;const i=t.windows[r.payload.label];if(i!=null){if(r.payload.value!=null)s=r.payload.value;else{const a=i[n];a!=null&&(s=!a)}t.windows[r.payload.label]={...i,[n]:s}}}),Rt=(n,e=!1)=>(t,r)=>{const s=t.windows[r.payload.label];s!=null&&(t.windows[r.payload.label]={...s,[n]:s[n]+(e?-1:1)})},uo=n=>Object.values(n.windows).some(e=>e.key===fn&&!e.reserved),pn="drift",co=(n,e,t)=>n.position!=null&&n.size!=null&&e==null?Pe.topLeft(Pe.positionInCenter(Pe.construct(kt.ZERO,t??kt.ZERO),Pe.construct(n.position,n.size))):e,lo=(n,{payload:e})=>{if(e.key===fn)return;const{key:t,label:r,prerenderLabel:s}=e;if(r==null||s==null)throw new Error("[drift] - bug - missing label and prerender label");console.log(n.config.debug),Rn(n.config.debug,"reducer create window");const i=n.windows.main;if(e.position=co(i,e.position,e.size),t in n.keyLabels){je(n.config.debug,"window already exists, un-minimize and focus it");const c=n.keyLabels[e.key];n.windows[c].visible=!0,n.windows[c].focusCount+=1,n.windows[c].minimized=!1,n.windows[c].position=e.position,Dt(n.config.debug);return}const[a,o]=Object.entries(n.windows).find(([,c])=>!c.reserved)??[null,null];a!=null?(je(n.config.debug,"using available pre-rendered window"),n.windows[a]={...o,visible:!0,reserved:!0,focusCount:1,focus:!0,...e},n.labelKeys[a]=e.key,n.keyLabels[e.key]=a):(je(n.config.debug,"creating new window"),n.windows[r]={...n.config.defaultWindowProps,...Ct,...e,reserved:!0},n.labelKeys[r]=t,n.keyLabels[t]=r),n.config.enablePrerender&&!uo(n)&&(je(n.config.debug,"creating pre-render window"),n.windows[s]=hn.copy({...n.config.defaultWindowProps,...Or})),Dt(n.config.debug)},ho=V((n,e)=>{const t=n.windows[e.payload.label];t!=null&&(t.stage=e.payload.stage)}),fo=V((n,{payload:{label:e}})=>{const t=n.windows[e];t==null||t.processCount>0||(t.stage="closing",delete n.windows[e],delete n.labelKeys[e],delete n.keyLabels[t.key])}),po=V((n,e)=>{const t=n.windows[e.payload.label];t==null||t.processCount>0||(t.stage="reloading",Sr())}),mo=V(Rt("processCount")),yo=V((n,e)=>{Rt("processCount",!0)(n,e);const t=n.windows[e.payload.label];t!=null&&t.processCount===0&&(t.stage==="reloading"?Sr():(n.windows[e.payload.label].visible=!1,delete n.windows[e.payload.label],delete n.labelKeys[e.payload.label],delete n.keyLabels[t.key]))}),go=(n,e)=>{const t=n.windows[e.payload.key];t!=null&&(t.error=e.payload.message)},vo=V((n,e)=>{const t=n.windows[e.payload.label];t!=null&&(t.visible!==!0&&(t.visible=!0),Rt("focusCount")(n,e))}),wo=ge("minimized"),bo=ge("maximized"),xo=ge("visible",!0),_o=ge("fullscreen",!0),To=V(Rt("centerCount")),Oo=V((n,e)=>{n.windows[e.payload.label].position=e.payload.position}),So=V((n,e)=>{n.windows[e.payload.label].size=e.payload.size}),No=V((n,e)=>{n.windows[e.payload.label].minSize=e.payload.size}),Io=V((n,e)=>{n.windows[e.payload.label].maxSize=e.payload.size}),ko=ge("resizable"),Ao=ge("skipTaskbar"),Eo=ge("alwaysOnTop"),$o=V((n,e)=>{n.windows[e.payload.label].title=e.payload.title}),Mo=ge("decorations"),Cn=(n,e)=>{const t=n.windows[e.payload.label];hn.partialEqual(t,e.payload)||(n.windows[e.payload.label]={...t,...e.payload})},Co=(n,e)=>{if(n.config={...n.config,...e.payload},n.label=e.payload.label,n.label===ve&&n.config.enablePrerender){const t=Gt.create();n.windows[t]={...n.config.defaultWindowProps,...Or}}},Ir=Er.createSlice({name:pn,initialState:Nr,reducers:{internalSetInitial:Co,createWindow:lo,setWindowStage:ho,closeWindow:fo,registerProcess:mo,completeProcess:yo,setWindowError:go,focusWindow:vo,reloadWindow:po,setWindowMinimized:wo,setWindowMaximized:bo,setWindowVisible:xo,setWindowFullscreen:_o,centerWindow:To,setWindowPosition:Oo,setWindowSize:So,setWindowMinSize:No,setWindowMaxSize:Io,setWindowResizable:ko,setWindowSkipTaskbar:Ao,setWindowAlwaysOnTop:Eo,setWindowTitle:$o,setWindowDecorations:Mo,runtimeSetWindowProps:Cn,setWindowProps:Cn}}),{actions:{runtimeSetWindowProps:Ro,setWindowProps:jo,createWindow:kr,internalSetInitial:Ar,setWindowStage:Zo,closeWindow:Bo,registerProcess:Do,completeProcess:Uo,setWindowError:Po,focusWindow:Lo,reloadWindow:Wo,setWindowMinimized:zo,setWindowMaximized:Vo,setWindowVisible:qo,setWindowFullscreen:Fo,centerWindow:du,setWindowPosition:Yo,setWindowSize:Go,setWindowMinSize:Jo,setWindowMaxSize:Ho,setWindowResizable:Xo,setWindowSkipTaskbar:Ko,setWindowAlwaysOnTop:Qo,setWindowTitle:eu,setWindowDecorations:tu}}=Ir,nu=Ir.reducer,ru=n=>n.startsWith(pn),su=[Ar.type],iu=(n,e)=>!n&&!su.includes(e);exports.G=kt;exports.I=hn;exports.INITIAL_WINDOW_STATE=Ct;exports.MAIN_WINDOW=ve;exports.Mo=Pe;exports.S=Ua;exports.SLICE_NAME=pn;exports.ZERO_SLICE_STATE=Nr;exports._=gt;exports.assignLabel=oo;exports.closeWindow=Bo;exports.completeProcess=Uo;exports.createWindow=kr;exports.focusWindow=Lo;exports.group=Rn;exports.groupEnd=Dt;exports.internalSetInitial=Ar;exports.isDriftAction=ru;exports.log=je;exports.reducer=nu;exports.registerProcess=Do;exports.reloadWindow=Wo;exports.runtimeSetWindowProps=Ro;exports.setWindowAlwaysOnTop=Qo;exports.setWindowDecorations=tu;exports.setWindowError=Po;exports.setWindowFullscreen=Fo;exports.setWindowMaxSize=Ho;exports.setWindowMaximized=Vo;exports.setWindowMinSize=Jo;exports.setWindowMinimized=zo;exports.setWindowPosition=Yo;exports.setWindowProps=jo;exports.setWindowResizable=Xo;exports.setWindowSize=Go;exports.setWindowSkipTaskbar=Ko;exports.setWindowStage=Zo;exports.setWindowTitle=eu;exports.setWindowVisible=qo;exports.shouldEmit=iu;exports.windowPropsZ=io;exports.y=A;
|
package/dist/tauri.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var X=Object.defineProperty;var ee=(t,e,i)=>e in t?X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var W=(t,e,i)=>ee(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./state-5JemPjJN.cjs"),ie=require("./debounce-BUAIXXZt.cjs");function te(t,e,i,n){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?n:i==="a"?n.call(t):n?n.value:e.get(t)}function ne(t,e,i,n,l){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var O;const h="__TAURI_TO_IPC_KEY__";function se(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},i){return window.__TAURI_INTERNALS__.invoke(t,e,i)}class le{get rid(){return te(this,O,"f")}constructor(e){O.set(this,void 0),ne(this,O,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}O=new WeakMap;var o;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(o||(o={}));async function U(t,e){await s("plugin:event|unlisten",{event:t,eventId:e})}async function f(t,e,i){var n;const l=typeof(i==null?void 0:i.target)=="string"?{kind:"AnyLabel",label:i.target}:(n=i==null?void 0:i.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:se(e)}).then(r=>async()=>U(t,r))}async function A(t,e,i){return f(t,n=>{U(t,n.id),e(n)},i)}async function L(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function H(t,e,i){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:i})}class _{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new b(this.width*e,this.height*e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class b{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new _(this.width/e,this.height/e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class w{constructor(e){this.size=e}toLogical(e){return this.size instanceof _?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof b?this.size:this.size.toPhysical(e)}[h](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[h]()}}class N{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new u(this.x*e,this.y*e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class u{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new N(this.x/e,this.y/e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class y{constructor(e){this.position=e}toLogical(e){return this.position instanceof N?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[h](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[h]()}}class v extends le{constructor(e){super(e)}static async new(e,i,n){return s("plugin:image|new",{rgba:S(e),width:i,height:n}).then(l=>new v(l))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:S(e)}).then(i=>new v(i))}static async fromPath(e){return s("plugin:image|from_path",{path:e}).then(i=>new v(i))}async rgba(){return s("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return s("plugin:image|size",{rid:this.rid})}}function S(t){return t==null?null:typeof t=="string"?t:t instanceof v?t.rid:t}var x;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(x||(x={}));class ae{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var C;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(C||(C={}));function j(){return new E(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function I(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new E(e,{skip:!0})))}const R=["tauri://created","tauri://error"];class E{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:window|create",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await I()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return j()}static async getAll(){return I()}static async getFocusedWindow(){for(const e of await I())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Window",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:A(e,i,{target:{kind:"Window",label:this.label}})}async emit(e,i){if(R.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return L(e,i)}async emitTo(e,i,n){if(R.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return H(e,i,n)}_handleTauriEvent(e,i){return R.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async scaleFactor(){return s("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return s("plugin:window|inner_position",{label:this.label}).then(e=>new u(e))}async outerPosition(){return s("plugin:window|outer_position",{label:this.label}).then(e=>new u(e))}async innerSize(){return s("plugin:window|inner_size",{label:this.label}).then(e=>new b(e))}async outerSize(){return s("plugin:window|outer_size",{label:this.label}).then(e=>new b(e))}async isFullscreen(){return s("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return s("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return s("plugin:window|is_maximized",{label:this.label})}async isFocused(){return s("plugin:window|is_focused",{label:this.label})}async isDecorated(){return s("plugin:window|is_decorated",{label:this.label})}async isResizable(){return s("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return s("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return s("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return s("plugin:window|is_closable",{label:this.label})}async isVisible(){return s("plugin:window|is_visible",{label:this.label})}async title(){return s("plugin:window|title",{label:this.label})}async theme(){return s("plugin:window|theme",{label:this.label})}async center(){return s("plugin:window|center",{label:this.label})}async requestUserAttention(e){let i=null;return e&&(e===x.Critical?i={type:"Critical"}:i={type:"Informational"}),s("plugin:window|request_user_attention",{label:this.label,value:i})}async setResizable(e){return s("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return s("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return s("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return s("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return s("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return s("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return s("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return s("plugin:window|maximize",{label:this.label})}async unmaximize(){return s("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return s("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return s("plugin:window|minimize",{label:this.label})}async unminimize(){return s("plugin:window|unminimize",{label:this.label})}async show(){return s("plugin:window|show",{label:this.label})}async hide(){return s("plugin:window|hide",{label:this.label})}async close(){return s("plugin:window|close",{label:this.label})}async destroy(){return s("plugin:window|destroy",{label:this.label})}async setDecorations(e){return s("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return s("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return s("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return s("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return s("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return s("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return s("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return s("plugin:window|set_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setSizeConstraints(e){function i(n){return n?{Logical:n}:null}return s("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:i(e==null?void 0:e.minWidth),minHeight:i(e==null?void 0:e.minHeight),maxWidth:i(e==null?void 0:e.maxWidth),maxHeight:i(e==null?void 0:e.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFullscreen(e){return s("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return s("plugin:window|set_focus",{label:this.label})}async setIcon(e){return s("plugin:window|set_icon",{label:this.label,value:S(e)})}async setSkipTaskbar(e){return s("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return s("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return s("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return s("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return s("plugin:window|set_cursor_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setIgnoreCursorEvents(e){return s("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return s("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return s("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return s("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return s("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return s("plugin:window|set_overlay_icon",{label:this.label,value:e?S(e):void 0})}async setProgressBar(e){return s("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return s("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return s("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return s("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(o.WINDOW_RESIZED,i=>{i.payload=new b(i.payload),e(i)})}async onMoved(e){return this.listen(o.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(o.WINDOW_CLOSE_REQUESTED,async i=>{const n=new ae(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}async onFocusChanged(e){const i=await this.listen(o.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(o.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(o.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(o.WINDOW_THEME_CHANGED,e)}}var M;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(M||(M={}));var F;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(F||(F={}));var B;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(B||(B={}));function re(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new b(t.size)}}async function oe(){return s("plugin:window|available_monitors").then(t=>t.map(re))}function q(){return new T(j(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function V(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new T(new E(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const k=["tauri://created","tauri://error"];class T{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n!=null&&n.skip||s("plugin:webview|create_webview",{windowLabel:e.label,label:i,options:n}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await V()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return q()}static async getAll(){return V()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Webview",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:A(e,i,{target:{kind:"Webview",label:this.label}})}async emit(e,i){if(k.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return L(e,i)}async emitTo(e,i,n){if(k.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return H(e,i,n)}_handleTauriEvent(e,i){return k.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new u(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new b(e))}async close(){return s("plugin:webview|close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}}function J(){const t=q();return new d(t.label,{skip:!0})}async function z(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new d(e,{skip:!0})))}class d{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:webview|create_webview_window",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;const n=(i=(await z()).find(l=>l.label===e))!==null&&i!==void 0?i:null;return n?new d(n.label,{skip:!0}):null}static getCurrent(){return J()}static async getAll(){return z()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:A(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e}).then(()=>s("plugin:webview|set_webview_background_color",{color:e}))}}ue(d,[E,T]);function ue(t,e){(Array.isArray(e)?e:[e]).forEach(i=>{Object.getOwnPropertyNames(i.prototype).forEach(n=>{var l;typeof t.prototype=="object"&&t.prototype&&n in t.prototype||Object.defineProperty(t.prototype,n,(l=Object.getOwnPropertyDescriptor(i.prototype,n))!==null&&l!==void 0?l:Object.create(null))})})}const ce=t=>JSON.stringify(t),he=t=>JSON.parse(t),D="drift://action",we="tauri://error",de="tauri://created",be=t=>new Error(`Window not found: ${t}`),p=250,ye=c.y.seconds(1),m=t=>{if(t!=null)return{width:Math.max(t.width,p),height:Math.max(t.height,p)}},pe=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:m(i),size:m(e)}},ge=async()=>(await oe()).map(e=>{const i=P(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return c.Mo.construct(i,n)}),G=async t=>(await ge()).some(i=>c.Mo.contains(i,t));class _e{constructor(e){W(this,"win");W(this,"unsubscribe");W(this,"fullscreenPoll",null);this.win=e??J(),this.unsubscribe={}}async configure(){await this.startFullscreenPoll()}async startFullscreenPoll(){if(c.S.getOS()!=="macOS")return;let e=(await this.getProps()).fullscreen;this.fullscreenPoll=setInterval(()=>{this.win.isFullscreen().then(i=>{i!==e&&(e=i,this.emit({action:c.runtimeSetWindowProps({label:this.win.label,fullscreen:i})},void 0,"WHITELIST").catch(console.error))}).catch(console.error)},ye.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===c.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e==null?void 0:e()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=ce({...e,emitter:n});if(i==null)return await L(D,l);const r=await d.getByLabel(i);if(r==null)throw be(i);await r.emit(D,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[D]=await f(D,n=>e(he(n.payload)));const i=ve();for(const{key:n,handler:l,debounce:r}of i)this.unsubscribe[n]=await this.win.listen(n,ie.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},r))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=c.I.copy(i);const{size:n,minSize:l,maxSize:r,position:a,...$}=pe(i);(n==null?void 0:n.width)!=null&&(n.width=Math.max(n.width,p)),(n==null?void 0:n.height)!=null&&(n.height=Math.max(n.height,p)),(r==null?void 0:r.width)!=null&&(r.width=Math.max(r.width,p)),(r==null?void 0:r.height)!=null&&(r.height=Math.max(r.height,p)),a!=null&&(await G(a)||(a.x=0,a.y=0));try{const g=new d(e,{x:a==null?void 0:a.x,y:a==null?void 0:a.y,width:n==null?void 0:n.width,height:n==null?void 0:n.height,minWidth:l==null?void 0:l.width,minHeight:l==null?void 0:l.height,maxWidth:r==null?void 0:r.width,maxHeight:r==null?void 0:r.height,titleBarStyle:"overlay",dragDropEnabled:!1,...$});return await new Promise((Q,Y)=>{g.once(we,K=>Y(new Error(JSON.stringify(K.payload)))),g.once(de,()=>Q())})}catch(g){console.error(g)}}async close(e){const i=await d.getByLabel(e);if(i!=null)try{await i.destroy()}catch(n){console.error(n,e)}else{const n=await z();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await z()).map(i=>i.label)}async focus(){return await this.win.setFocus()}async setMinimized(e){return e?await this.win.minimize():await this.win.unminimize()}async setMaximized(e){return e?await this.win.maximize():await this.win.unmaximize()}async setVisible(e){return e?await this.win.show():await this.win.hide()}async setFullscreen(e){await this.win.setFullscreen(e)}async center(){return await this.win.center()}async setPosition(e){const i=new N(e.x,e.y);await G(e)||(i.x=0,i.y=0),await this.win.setPosition(i)}async setSize(e){e=m(e),await this.win.setSize(new _(e.width,e.height))}async setMinSize(e){e=m(e),await this.win.setMinSize(new _(e.width,e.height))}async setMaxSize(e){e=m(e),await this.win.setMaxSize(new _(e.width,e.height))}async setResizable(e){var i,n;return o.WINDOW_RESIZED in this.unsubscribe&&!e&&((n=(i=this.unsubscribe)[o.WINDOW_RESIZED])==null||n.call(i),delete this.unsubscribe[o.WINDOW_RESIZED]),await this.win.setResizable(e)}async setSkipTaskbar(e){return await this.win.setSkipTaskbar(e)}async setAlwaysOnTop(e){return await this.win.setAlwaysOnTop(e)}async setTitle(e){return await this.win.setTitle(e)}async setDecorations(e){return await this.win.setDecorations(e)}async getProps(){const e=await this.win.scaleFactor(),i=await this.win.isVisible();return{position:P(await this.win.innerPosition(),e),size:Z(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const ve=()=>[{key:o.WINDOW_RESIZED,debounce:200,handler:async t=>{const e=await t.scaleFactor(),i=await t.isVisible(),n={label:t.label,maximized:await t.isMaximized(),visible:i,minimized:!i,position:P(await t.innerPosition(),e),size:Z(await t.innerSize(),e)};return c.runtimeSetWindowProps(n)}},{key:o.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await(t==null?void 0:t.scaleFactor());if(e==null)return null;const i=P(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return c.runtimeSetWindowProps(l)}},{key:o.WINDOW_BLUR,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!1,label:t.label})},{key:o.WINDOW_FOCUS,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],P=(t,e)=>c.G.scale(t,1/e),Z=(t,e)=>c._.scale(t,1/e);exports.TauriRuntime=_e;
|
|
1
|
+
"use strict";var X=Object.defineProperty;var ee=(t,e,i)=>e in t?X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var W=(t,e,i)=>ee(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./state-u8UjvjPJ.cjs"),ie=require("./debounce-BUAIXXZt.cjs");function te(t,e,i,n){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?n:i==="a"?n.call(t):n?n.value:e.get(t)}function ne(t,e,i,n,l){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var O;const h="__TAURI_TO_IPC_KEY__";function se(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},i){return window.__TAURI_INTERNALS__.invoke(t,e,i)}class le{get rid(){return te(this,O,"f")}constructor(e){O.set(this,void 0),ne(this,O,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}O=new WeakMap;var o;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(o||(o={}));async function U(t,e){await s("plugin:event|unlisten",{event:t,eventId:e})}async function f(t,e,i){var n;const l=typeof(i==null?void 0:i.target)=="string"?{kind:"AnyLabel",label:i.target}:(n=i==null?void 0:i.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:se(e)}).then(r=>async()=>U(t,r))}async function x(t,e,i){return f(t,n=>{U(t,n.id),e(n)},i)}async function L(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function H(t,e,i){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:i})}class _{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new d(this.width*e,this.height*e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class d{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new _(this.width/e,this.height/e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class w{constructor(e){this.size=e}toLogical(e){return this.size instanceof _?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof d?this.size:this.size.toPhysical(e)}[h](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[h]()}}class N{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new u(this.x*e,this.y*e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class u{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new N(this.x/e,this.y/e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class y{constructor(e){this.position=e}toLogical(e){return this.position instanceof N?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[h](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[h]()}}class v extends le{constructor(e){super(e)}static async new(e,i,n){return s("plugin:image|new",{rgba:S(e),width:i,height:n}).then(l=>new v(l))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:S(e)}).then(i=>new v(i))}static async fromPath(e){return s("plugin:image|from_path",{path:e}).then(i=>new v(i))}async rgba(){return s("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return s("plugin:image|size",{rid:this.rid})}}function S(t){return t==null?null:typeof t=="string"?t:t instanceof v?t.rid:t}var k;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(k||(k={}));class ae{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var C;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(C||(C={}));function j(){return new E(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function I(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new E(e,{skip:!0})))}const R=["tauri://created","tauri://error"];class E{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:window|create",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await I()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return j()}static async getAll(){return I()}static async getFocusedWindow(){for(const e of await I())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Window",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:x(e,i,{target:{kind:"Window",label:this.label}})}async emit(e,i){if(R.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return L(e,i)}async emitTo(e,i,n){if(R.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return H(e,i,n)}_handleTauriEvent(e,i){return R.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async scaleFactor(){return s("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return s("plugin:window|inner_position",{label:this.label}).then(e=>new u(e))}async outerPosition(){return s("plugin:window|outer_position",{label:this.label}).then(e=>new u(e))}async innerSize(){return s("plugin:window|inner_size",{label:this.label}).then(e=>new d(e))}async outerSize(){return s("plugin:window|outer_size",{label:this.label}).then(e=>new d(e))}async isFullscreen(){return s("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return s("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return s("plugin:window|is_maximized",{label:this.label})}async isFocused(){return s("plugin:window|is_focused",{label:this.label})}async isDecorated(){return s("plugin:window|is_decorated",{label:this.label})}async isResizable(){return s("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return s("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return s("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return s("plugin:window|is_closable",{label:this.label})}async isVisible(){return s("plugin:window|is_visible",{label:this.label})}async title(){return s("plugin:window|title",{label:this.label})}async theme(){return s("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return s("plugin:window|is_always_on_top",{label:this.label})}async center(){return s("plugin:window|center",{label:this.label})}async requestUserAttention(e){let i=null;return e&&(e===k.Critical?i={type:"Critical"}:i={type:"Informational"}),s("plugin:window|request_user_attention",{label:this.label,value:i})}async setResizable(e){return s("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return s("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return s("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return s("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return s("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return s("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return s("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return s("plugin:window|maximize",{label:this.label})}async unmaximize(){return s("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return s("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return s("plugin:window|minimize",{label:this.label})}async unminimize(){return s("plugin:window|unminimize",{label:this.label})}async show(){return s("plugin:window|show",{label:this.label})}async hide(){return s("plugin:window|hide",{label:this.label})}async close(){return s("plugin:window|close",{label:this.label})}async destroy(){return s("plugin:window|destroy",{label:this.label})}async setDecorations(e){return s("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return s("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return s("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return s("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return s("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return s("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return s("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return s("plugin:window|set_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setSizeConstraints(e){function i(n){return n?{Logical:n}:null}return s("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:i(e==null?void 0:e.minWidth),minHeight:i(e==null?void 0:e.minHeight),maxWidth:i(e==null?void 0:e.maxWidth),maxHeight:i(e==null?void 0:e.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFullscreen(e){return s("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return s("plugin:window|set_focus",{label:this.label})}async setIcon(e){return s("plugin:window|set_icon",{label:this.label,value:S(e)})}async setSkipTaskbar(e){return s("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return s("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return s("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return s("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return s("plugin:window|set_cursor_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setIgnoreCursorEvents(e){return s("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return s("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return s("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return s("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return s("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return s("plugin:window|set_overlay_icon",{label:this.label,value:e?S(e):void 0})}async setProgressBar(e){return s("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return s("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return s("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return s("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(o.WINDOW_RESIZED,i=>{i.payload=new d(i.payload),e(i)})}async onMoved(e){return this.listen(o.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(o.WINDOW_CLOSE_REQUESTED,async i=>{const n=new ae(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}async onFocusChanged(e){const i=await this.listen(o.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(o.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(o.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(o.WINDOW_THEME_CHANGED,e)}}var M;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(M||(M={}));var F;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(F||(F={}));var B;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(B||(B={}));function re(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new d(t.size)}}async function oe(){return s("plugin:window|available_monitors").then(t=>t.map(re))}function q(){return new T(j(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function V(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new T(new E(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const A=["tauri://created","tauri://error"];class T{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n!=null&&n.skip||s("plugin:webview|create_webview",{windowLabel:e.label,label:i,options:n}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await V()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return q()}static async getAll(){return V()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Webview",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:x(e,i,{target:{kind:"Webview",label:this.label}})}async emit(e,i){if(A.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return L(e,i)}async emitTo(e,i,n){if(A.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return H(e,i,n)}_handleTauriEvent(e,i){return A.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new u(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new d(e))}async close(){return s("plugin:webview|webview_close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}}function J(){const t=q();return new b(t.label,{skip:!0})}async function z(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new b(e,{skip:!0})))}class b{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=null&&i.skip||s("plugin:webview|create_webview_window",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;const n=(i=(await z()).find(l=>l.label===e))!==null&&i!==void 0?i:null;return n?new b(n.label,{skip:!0}):null}static getCurrent(){return J()}static async getAll(){return z()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:x(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e}).then(()=>s("plugin:webview|set_webview_background_color",{color:e}))}}ue(b,[E,T]);function ue(t,e){(Array.isArray(e)?e:[e]).forEach(i=>{Object.getOwnPropertyNames(i.prototype).forEach(n=>{var l;typeof t.prototype=="object"&&t.prototype&&n in t.prototype||Object.defineProperty(t.prototype,n,(l=Object.getOwnPropertyDescriptor(i.prototype,n))!==null&&l!==void 0?l:Object.create(null))})})}const ce=t=>JSON.stringify(t),he=t=>JSON.parse(t),D="drift://action",we="tauri://error",be="tauri://created",de=t=>new Error(`Window not found: ${t}`),p=250,ye=c.y.seconds(1),m=t=>{if(t!=null)return{width:Math.max(t.width,p),height:Math.max(t.height,p)}},pe=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:m(i),size:m(e)}},ge=async()=>(await oe()).map(e=>{const i=P(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return c.Mo.construct(i,n)}),G=async t=>(await ge()).some(i=>c.Mo.contains(i,t));class _e{constructor(e){W(this,"win");W(this,"unsubscribe");W(this,"fullscreenPoll",null);this.win=e??J(),this.unsubscribe={}}async configure(){await this.startFullscreenPoll()}async startFullscreenPoll(){if(c.S.getOS()!=="macOS")return;let e=(await this.getProps()).fullscreen;this.fullscreenPoll=setInterval(()=>{this.win.isFullscreen().then(i=>{i!==e&&(e=i,this.emit({action:c.runtimeSetWindowProps({label:this.win.label,fullscreen:i})},void 0,"WHITELIST").catch(console.error))}).catch(console.error)},ye.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===c.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e==null?void 0:e()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=ce({...e,emitter:n});if(i==null)return await L(D,l);const r=await b.getByLabel(i);if(r==null)throw de(i);await r.emit(D,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[D]=await f(D,n=>e(he(n.payload)));const i=ve();for(const{key:n,handler:l,debounce:r}of i)this.unsubscribe[n]=await this.win.listen(n,ie.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},r))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=c.I.copy(i);const{size:n,minSize:l,maxSize:r,position:a,...$}=pe(i);(n==null?void 0:n.width)!=null&&(n.width=Math.max(n.width,p)),(n==null?void 0:n.height)!=null&&(n.height=Math.max(n.height,p)),(r==null?void 0:r.width)!=null&&(r.width=Math.max(r.width,p)),(r==null?void 0:r.height)!=null&&(r.height=Math.max(r.height,p)),a!=null&&(await G(a)||(a.x=0,a.y=0));try{const g=new b(e,{x:a==null?void 0:a.x,y:a==null?void 0:a.y,width:n==null?void 0:n.width,height:n==null?void 0:n.height,minWidth:l==null?void 0:l.width,minHeight:l==null?void 0:l.height,maxWidth:r==null?void 0:r.width,maxHeight:r==null?void 0:r.height,titleBarStyle:"overlay",dragDropEnabled:!1,...$});return await new Promise((Q,Y)=>{g.once(we,K=>Y(new Error(JSON.stringify(K.payload)))),g.once(be,()=>Q())})}catch(g){console.error(g)}}async close(e){const i=await b.getByLabel(e);if(i!=null)try{await i.destroy()}catch(n){console.error(n,e)}else{const n=await z();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await z()).map(i=>i.label)}async focus(){return await this.win.setFocus()}async setMinimized(e){return e?await this.win.minimize():await this.win.unminimize()}async setMaximized(e){return e?await this.win.maximize():await this.win.unmaximize()}async setVisible(e){return e?await this.win.show():await this.win.hide()}async setFullscreen(e){await this.win.setFullscreen(e)}async center(){return await this.win.center()}async setPosition(e){const i=new N(e.x,e.y);await G(e)||(i.x=0,i.y=0),await this.win.setPosition(i)}async setSize(e){e=m(e),await this.win.setSize(new _(e.width,e.height))}async setMinSize(e){e=m(e),await this.win.setMinSize(new _(e.width,e.height))}async setMaxSize(e){e=m(e),await this.win.setMaxSize(new _(e.width,e.height))}async setResizable(e){var i,n;return o.WINDOW_RESIZED in this.unsubscribe&&!e&&((n=(i=this.unsubscribe)[o.WINDOW_RESIZED])==null||n.call(i),delete this.unsubscribe[o.WINDOW_RESIZED]),await this.win.setResizable(e)}async setSkipTaskbar(e){return await this.win.setSkipTaskbar(e)}async setAlwaysOnTop(e){return await this.win.setAlwaysOnTop(e)}async setTitle(e){return await this.win.setTitle(e)}async setDecorations(e){return await this.win.setDecorations(e)}async getProps(){const e=await this.win.scaleFactor(),i=await this.win.isVisible();return{position:P(await this.win.innerPosition(),e),size:Z(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const ve=()=>[{key:o.WINDOW_RESIZED,debounce:200,handler:async t=>{const e=await t.scaleFactor(),i=await t.isVisible(),n={label:t.label,maximized:await t.isMaximized(),visible:i,minimized:!i,position:P(await t.innerPosition(),e),size:Z(await t.innerSize(),e)};return c.runtimeSetWindowProps(n)}},{key:o.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await(t==null?void 0:t.scaleFactor());if(e==null)return null;const i=P(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return c.runtimeSetWindowProps(l)}},{key:o.WINDOW_BLUR,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!1,label:t.label})},{key:o.WINDOW_FOCUS,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],P=(t,e)=>c.G.scale(t,1/e),Z=(t,e)=>c._.scale(t,1/e);exports.TauriRuntime=_e;
|
package/dist/tauri.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var ee = Object.defineProperty;
|
|
2
2
|
var ie = (t, e, i) => e in t ? ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
3
|
var D = (t, e, i) => ie(t, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
-
import { H as te, J as ne, r as g, M as se, K as le, _ as ae, G as re, L as H } from "./state-
|
|
4
|
+
import { H as te, J as ne, r as g, M as se, K as le, _ as ae, G as re, L as H } from "./state-B_nrpWi0.js";
|
|
5
5
|
import { o as oe } from "./debounce-DOZKRZa9.js";
|
|
6
6
|
function ue(t, e, i, n) {
|
|
7
7
|
if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
@@ -56,7 +56,7 @@ async function m(t, e, i) {
|
|
|
56
56
|
handler: he(e)
|
|
57
57
|
}).then((r) => async () => U(t, r));
|
|
58
58
|
}
|
|
59
|
-
async function
|
|
59
|
+
async function k(t, e, i) {
|
|
60
60
|
return m(t, (n) => {
|
|
61
61
|
U(t, n.id), e(n);
|
|
62
62
|
}, i);
|
|
@@ -306,10 +306,10 @@ class v extends we {
|
|
|
306
306
|
function z(t) {
|
|
307
307
|
return t == null ? null : typeof t == "string" ? t : t instanceof v ? t.rid : t;
|
|
308
308
|
}
|
|
309
|
-
var
|
|
309
|
+
var A;
|
|
310
310
|
(function(t) {
|
|
311
311
|
t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
|
|
312
|
-
})(
|
|
312
|
+
})(A || (A = {}));
|
|
313
313
|
class be {
|
|
314
314
|
constructor(e) {
|
|
315
315
|
this._preventDefault = !1, this.event = e.event, this.id = e.id;
|
|
@@ -459,7 +459,7 @@ class S {
|
|
|
459
459
|
return this._handleTauriEvent(e, i) ? () => {
|
|
460
460
|
const n = this.listeners[e];
|
|
461
461
|
n.splice(n.indexOf(i), 1);
|
|
462
|
-
} :
|
|
462
|
+
} : k(e, i, {
|
|
463
463
|
target: { kind: "Window", label: this.label }
|
|
464
464
|
});
|
|
465
465
|
}
|
|
@@ -788,6 +788,21 @@ class S {
|
|
|
788
788
|
label: this.label
|
|
789
789
|
});
|
|
790
790
|
}
|
|
791
|
+
/**
|
|
792
|
+
* Whether the window is configured to be always on top of other windows or not.
|
|
793
|
+
* @example
|
|
794
|
+
* ```typescript
|
|
795
|
+
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
796
|
+
* const alwaysOnTop = await getCurrentWindow().isAlwaysOnTop();
|
|
797
|
+
* ```
|
|
798
|
+
*
|
|
799
|
+
* @returns Whether the window is visible or not.
|
|
800
|
+
*/
|
|
801
|
+
async isAlwaysOnTop() {
|
|
802
|
+
return s("plugin:window|is_always_on_top", {
|
|
803
|
+
label: this.label
|
|
804
|
+
});
|
|
805
|
+
}
|
|
791
806
|
// Setters
|
|
792
807
|
/**
|
|
793
808
|
* Centers the window.
|
|
@@ -826,7 +841,7 @@ class S {
|
|
|
826
841
|
*/
|
|
827
842
|
async requestUserAttention(e) {
|
|
828
843
|
let i = null;
|
|
829
|
-
return e && (e ===
|
|
844
|
+
return e && (e === A.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
|
|
830
845
|
label: this.label,
|
|
831
846
|
value: i
|
|
832
847
|
});
|
|
@@ -2013,7 +2028,7 @@ class C {
|
|
|
2013
2028
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2014
2029
|
const n = this.listeners[e];
|
|
2015
2030
|
n.splice(n.indexOf(i), 1);
|
|
2016
|
-
} :
|
|
2031
|
+
} : k(e, i, {
|
|
2017
2032
|
target: { kind: "Webview", label: this.label }
|
|
2018
2033
|
});
|
|
2019
2034
|
}
|
|
@@ -2114,7 +2129,7 @@ class C {
|
|
|
2114
2129
|
* @returns A promise indicating the success or failure of the operation.
|
|
2115
2130
|
*/
|
|
2116
2131
|
async close() {
|
|
2117
|
-
return s("plugin:webview|
|
|
2132
|
+
return s("plugin:webview|webview_close", {
|
|
2118
2133
|
label: this.label
|
|
2119
2134
|
});
|
|
2120
2135
|
}
|
|
@@ -2441,7 +2456,7 @@ class w {
|
|
|
2441
2456
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2442
2457
|
const n = this.listeners[e];
|
|
2443
2458
|
n.splice(n.indexOf(i), 1);
|
|
2444
|
-
} :
|
|
2459
|
+
} : k(e, i, {
|
|
2445
2460
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2446
2461
|
});
|
|
2447
2462
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/drift",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.1",
|
|
4
4
|
"description": "State synchronization and Redux state synchronization for Tauri Apps",
|
|
5
5
|
"repository": "https://github.com/synnaxlabs/synnax/tree/main/drift",
|
|
6
6
|
"type": "module",
|
|
@@ -15,17 +15,16 @@
|
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@reduxjs/toolkit": "^2.6.1",
|
|
18
|
-
"@tauri-apps/api": "^2.
|
|
18
|
+
"@tauri-apps/api": "^2.4.1",
|
|
19
19
|
"async-mutex": "^0.5.0",
|
|
20
20
|
"proxy-memoize": "2.0.3",
|
|
21
21
|
"react": "^19.0.0",
|
|
22
22
|
"react-dom": "^19.0.0",
|
|
23
23
|
"react-redux": "^9.2.0",
|
|
24
24
|
"zod": "^3.24.2",
|
|
25
|
-
"@synnaxlabs/x": "0.
|
|
25
|
+
"@synnaxlabs/x": "0.40.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@tauri-apps/api": "^2.1.1",
|
|
29
28
|
"@types/react": "^19.0.10",
|
|
30
29
|
"@vitejs/plugin-react": "^4.3.4",
|
|
31
30
|
"electron": "^33.4.4",
|
|
@@ -36,9 +35,9 @@
|
|
|
36
35
|
"typescript": "^5.8.2",
|
|
37
36
|
"vite": "^6.2.1",
|
|
38
37
|
"vitest": "^2.1.9",
|
|
39
|
-
"
|
|
38
|
+
"eslint-config-synnaxlabs": "0.0.1",
|
|
40
39
|
"@synnaxlabs/vite-plugin": "0.0.1",
|
|
41
|
-
"
|
|
40
|
+
"@synnaxlabs/tsconfig": "0.0.2"
|
|
42
41
|
},
|
|
43
42
|
"files": [
|
|
44
43
|
"dist"
|