react-semaphor 0.0.518 → 0.0.519

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.
@@ -1,5 +1,5 @@
1
1
  import { jsxs as s, jsx as e, Fragment as ne } from "react/jsx-runtime";
2
- import { C as _, E as Kn, v as G, z as Mt, F as st, G as rn, H as Za, I as R, P as ke, J as ln, K as on, L as cn, M as dn, N as K, O as we, Q as Xa, R as es, T as ts, U as ae, V as ns, W as as, X as ss, Y as zr, Z as Fa, _ as Fr, $ as q, a0 as Un, a1 as Ee, a2 as Lr, a3 as oe, a4 as ce, a5 as de, a6 as ue, a7 as ot, a8 as ct, a9 as U, aa as rs, ab as Ge, ac as Je, ad as Vr, ae as Tt, af as Qe, ag as ft, ah as gt, ai as Dt, aj as yt, ak as et, al as is, am as Pt, an as Qn, ao as ls, ap as Wn, aq as jn, ar as jr, A as S, as as os, at as Zn, au as Ct, av as Ft, aw as xt, ax as un, ay as mn, az as hn, aA as pn, aB as fn, aC as gn, aD as qt, aE as Lt, t as Ve, aF as cs, aG as ds, aH as us, aI as ms, l as hs, k as ps, f as Le, aJ as Br, e as Pe, aK as Pr, g as ht, h as qe, aL as fs, j as qr, aM as Rr, aN as _r, aO as at, aP as tt, aQ as gs, aR as $r, B as X, d as ys, aS as Vt, aT as We, aU as Gr, aV as Bn, aW as xs, aX as Xn, aY as Rt, aZ as _e, a_ as vs, r as Wt, p as La, a$ as Se, b0 as Jr, b1 as bs, b2 as vt, b3 as Hr, b4 as Yr, b5 as Kr, b6 as Ur, b7 as Ns, b8 as Qr, b9 as yn, ba as Wr, bb as Zr, bc as Xr, bd as Pn, be as ve, bf as Ze, bg as Ce, bh as Xe, bi as ei, bj as ea, bk as Cs, bl as ws, bm as ti, bn as ni, bo as ai, bp as si, bq as Tn, br as ri, bs as Va, bt as ii, bu as ja, bv as li, bw as oi, bx as ci, by as di, bz as ks, bA as ui, bB as ta, bC as Ss, bD as xn, bE as Ms, bF as Ut, bG as Ts, bH as mi, bI as Ds, bJ as vn, bK as hi, bL as pi, bM as fi, bN as Is, bO as Os, bP as bn, bQ as Es, bR as gi, bS as _t, bT as $t, bU as Me, bV as Qt, bW as yi, bX as xi, bY as vi, bZ as na, b_ as As, b$ as bi, c0 as Ba, c1 as zs, c2 as Zt, c3 as aa, c4 as Nn, c5 as Cn, c6 as Ni, c7 as Ci, c8 as wi, c9 as Fs, ca as rt, cb as me, cc as he, cd as pe, ce as sa, cf as ki, cg as Si, ch as Mi, ci as Ti, q as Di, cj as Pa, ck as Ls, cl as Ii, cm as Oi, cn as Ei, co as Vs, cp as ra, cq as It, cr as ia, cs as $e, ct as Ai, cu as Ot, cv as js, cw as zi, cx as Fi, cy as Li, cz as Vi, cA as ji, cB as qa, cC as Bi, cD as Pi, cE as qi, cF as Ri, cG as _i, cH as $i, cI as Gi, cJ as Ji, cK as Hi, cL as Yi, cM as Ki, cN as Ui, cO as Qi, cP as Wi, cQ as Bs, cR as qn, cS as Dn, cT as Re, cU as la, cV as ge, cW as Zi, cX as Xi, cY as el, cZ as wt, c_ as Gt, c$ as Xt, d0 as Te, d1 as tl, d2 as oa, d3 as nl, d4 as al, d5 as sl, d6 as Rn, d7 as rl, d8 as Ra, d9 as _n, da as $n, db as en, dc as kt, dd as jt, de as _a, df as il, dg as Ps, dh as ll, di as ol, dj as cl, dk as dl, dl as ul, dm as ml } from "./index-Bb5ixhkS.js";
2
+ import { C as _, E as Kn, v as G, z as Mt, F as st, G as rn, H as Za, I as R, P as ke, J as ln, K as on, L as cn, M as dn, N as K, O as we, Q as Xa, R as es, T as ts, U as ae, V as ns, W as as, X as ss, Y as zr, Z as Fa, _ as Fr, $ as q, a0 as Un, a1 as Ee, a2 as Lr, a3 as oe, a4 as ce, a5 as de, a6 as ue, a7 as ot, a8 as ct, a9 as U, aa as rs, ab as Ge, ac as Je, ad as Vr, ae as Tt, af as Qe, ag as ft, ah as gt, ai as Dt, aj as yt, ak as et, al as is, am as Pt, an as Qn, ao as ls, ap as Wn, aq as jn, ar as jr, A as S, as as os, at as Zn, au as Ct, av as Ft, aw as xt, ax as un, ay as mn, az as hn, aA as pn, aB as fn, aC as gn, aD as qt, aE as Lt, t as Ve, aF as cs, aG as ds, aH as us, aI as ms, l as hs, k as ps, f as Le, aJ as Br, e as Pe, aK as Pr, g as ht, h as qe, aL as fs, j as qr, aM as Rr, aN as _r, aO as at, aP as tt, aQ as gs, aR as $r, B as X, d as ys, aS as Vt, aT as We, aU as Gr, aV as Bn, aW as xs, aX as Xn, aY as Rt, aZ as _e, a_ as vs, r as Wt, p as La, a$ as Se, b0 as Jr, b1 as bs, b2 as vt, b3 as Hr, b4 as Yr, b5 as Kr, b6 as Ur, b7 as Ns, b8 as Qr, b9 as yn, ba as Wr, bb as Zr, bc as Xr, bd as Pn, be as ve, bf as Ze, bg as Ce, bh as Xe, bi as ei, bj as ea, bk as Cs, bl as ws, bm as ti, bn as ni, bo as ai, bp as si, bq as Tn, br as ri, bs as Va, bt as ii, bu as ja, bv as li, bw as oi, bx as ci, by as di, bz as ks, bA as ui, bB as ta, bC as Ss, bD as xn, bE as Ms, bF as Ut, bG as Ts, bH as mi, bI as Ds, bJ as vn, bK as hi, bL as pi, bM as fi, bN as Is, bO as Os, bP as bn, bQ as Es, bR as gi, bS as _t, bT as $t, bU as Me, bV as Qt, bW as yi, bX as xi, bY as vi, bZ as na, b_ as As, b$ as bi, c0 as Ba, c1 as zs, c2 as Zt, c3 as aa, c4 as Nn, c5 as Cn, c6 as Ni, c7 as Ci, c8 as wi, c9 as Fs, ca as rt, cb as me, cc as he, cd as pe, ce as sa, cf as ki, cg as Si, ch as Mi, ci as Ti, q as Di, cj as Pa, ck as Ls, cl as Ii, cm as Oi, cn as Ei, co as Vs, cp as ra, cq as It, cr as ia, cs as $e, ct as Ai, cu as Ot, cv as js, cw as zi, cx as Fi, cy as Li, cz as Vi, cA as ji, cB as qa, cC as Bi, cD as Pi, cE as qi, cF as Ri, cG as _i, cH as $i, cI as Gi, cJ as Ji, cK as Hi, cL as Yi, cM as Ki, cN as Ui, cO as Qi, cP as Wi, cQ as Bs, cR as qn, cS as Dn, cT as Re, cU as la, cV as ge, cW as Zi, cX as Xi, cY as el, cZ as wt, c_ as Gt, c$ as Xt, d0 as Te, d1 as tl, d2 as oa, d3 as nl, d4 as al, d5 as sl, d6 as Rn, d7 as rl, d8 as Ra, d9 as _n, da as $n, db as en, dc as kt, dd as jt, de as _a, df as il, dg as Ps, dh as ll, di as ol, dj as cl, dk as dl, dl as ul, dm as ml } from "./index-CIiZToL_.js";
3
3
  import * as lt from "react";
4
4
  import Oe, { useState as B, useMemo as nt, useRef as pt, useCallback as fe, useEffect as xe, Suspense as hl } from "react";
5
5
  import "react-dom";
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("react/jsx-runtime"),t=require("./index-0e5ek9VV.js"),L=require("react");require("react-dom");function Ss(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(a,n,r.get?r:{enumerable:!0,get:()=>s[n]})}}return a.default=s,Object.freeze(a)}const he=Ss(L);/**
1
+ "use strict";const e=require("react/jsx-runtime"),t=require("./index-mAN4JUt2.js"),L=require("react");require("react-dom");function Ss(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(a,n,r.get?r:{enumerable:!0,get:()=>s[n]})}}return a.default=s,Object.freeze(a)}const he=Ss(L);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -4227,7 +4227,7 @@ const oe = hc()(
4227
4227
  n.isSessionExpired = !1, n.currentBreakpoint = "lg", n.dashboard = {
4228
4228
  id: "",
4229
4229
  style: Ug
4230
- }, n.showContext = !1, n.selectedSheetId = null, n.selectedCardId = null, n.selectedFrameId = null, n.selectedCard = null, n.showFilters = !1, n.isDashboardEditing = !0, n.isVisualEditing = !1, n.showDashboardJSON = !1, n.filteringCards = [], n.selectedLensId = void 0, n.filterValues = void 0;
4230
+ }, n.showContext = !1, n.selectedSheetId = null, n.selectedCardId = null, n.selectedFrameId = null, n.selectedCard = null, n.showFilters = !1, n.isDashboardEditing = !1, n.isVisualEditing = !1, n.showDashboardJSON = !1, n.filteringCards = [], n.selectedLensId = void 0, n.filterValues = void 0;
4231
4231
  });
4232
4232
  },
4233
4233
  setAiContext: (n) => {
@@ -33,7 +33,7 @@
33
33
  */var lN;function Zq(){return lN||(lN=1,process.env.NODE_ENV!=="production"&&function(){function e(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=k,n=rE(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;kv.useSyncExternalStoreWithSelector=function(c,u,d,h,p){var m=i(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=a(function(){function y(S){if(!v){if(v=!0,x=S,S=h(S),p!==void 0&&g.hasValue){var C=g.value;if(p(C,S))return E=C}return E=S}if(C=E,r(x,S))return C;var R=h(S);return p!==void 0&&p(C,R)?(x=S,C):(x=S,E=R)}var v=!1,x,E,_=d===void 0?null:d;return[function(){return y(u())},_===null?void 0:function(){return y(_())}]},[u,d,h,p]);var b=o(c,m[0],m[1]);return s(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),kv}process.env.NODE_ENV==="production"?Xw.exports=Qq():Xw.exports=Zq();var Jq=Xw.exports;const eG=ka(Jq),pA={},{useDebugValue:tG}=k,{useSyncExternalStoreWithSelector:nG}=eG;let cN=!1;const rG=e=>e;function oG(e,t=rG,n){(pA?"production":void 0)!=="production"&&n&&!cN&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),cN=!0);const r=nG(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return tG(r),r}const uN=e=>{(pA?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Yq(e):e,n=(r,o)=>oG(t,r,o);return Object.assign(n,t),n},rc=e=>e?uN(e):uN;var mA=Symbol.for("immer-nothing"),dN=Symbol.for("immer-draftable"),so=Symbol.for("immer-state"),iG=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Fr(e,...t){if(process.env.NODE_ENV!=="production"){const n=iG[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Du=Object.getPrototypeOf;function Mu(e){return!!e&&!!e[so]}function Ol(e){var t;return e?gA(e)||Array.isArray(e)||!!e[dN]||!!((t=e.constructor)!=null&&t[dN])||m0(e)||g0(e):!1}var sG=Object.prototype.constructor.toString();function gA(e){if(!e||typeof e!="object")return!1;const t=Du(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===sG}function zg(e,t){p0(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function p0(e){const t=e[so];return t?t.type_:Array.isArray(e)?1:m0(e)?2:g0(e)?3:0}function Qw(e,t){return p0(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function bA(e,t,n){const r=p0(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function aG(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function m0(e){return e instanceof Map}function g0(e){return e instanceof Set}function Qa(e){return e.copy_||e.base_}function Zw(e,t){if(m0(e))return new Map(e);if(g0(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=gA(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[so];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){const s=o[i],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Du(e),r)}else{const r=Du(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function oE(e,t=!1){return b0(e)||Mu(e)||!Ol(e)||(p0(e)>1&&(e.set=e.add=e.clear=e.delete=lG),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>oE(r,!0))),e}function lG(){Fr(2)}function b0(e){return Object.isFrozen(e)}var cG={};function Fl(e){const t=cG[e];return t||Fr(0,e),t}var Uf;function yA(){return Uf}function uG(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function fN(e,t){t&&(Fl("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Jw(e){e1(e),e.drafts_.forEach(dG),e.drafts_=null}function e1(e){e===Uf&&(Uf=e.parent_)}function hN(e){return Uf=uG(Uf,e)}function dG(e){const t=e[so];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function pN(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[so].modified_&&(Jw(t),Fr(4)),Ol(e)&&(e=Bg(t,e),t.parent_||Vg(t,e)),t.patches_&&Fl("Patches").generateReplacementPatches_(n[so].base_,e,t.patches_,t.inversePatches_)):e=Bg(t,n,[]),Jw(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==mA?e:void 0}function Bg(e,t,n){if(b0(t))return t;const r=t[so];if(!r)return zg(t,(o,i)=>mN(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Vg(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),zg(i,(a,l)=>mN(e,r,o,a,l,n,s)),Vg(e,o,!1),n&&e.patches_&&Fl("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function mN(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&Fr(5),Mu(o)){const a=i&&t&&t.type_!==3&&!Qw(t.assigned_,r)?i.concat(r):void 0,l=Bg(e,o,a);if(bA(n,r,l),Mu(l))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(Ol(o)&&!b0(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Bg(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Vg(e,o)}}function Vg(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&oE(t,n)}function fG(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:yA(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=iE;n&&(o=[r],i=qf);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var iE={get(e,t){if(t===so)return e;const n=Qa(e);if(!Qw(n,t))return hG(e,n,t);const r=n[t];return e.finalized_||!Ol(r)?r:r===Rv(e.base_,t)?(Nv(e),e.copy_[t]=n1(r,e)):r},has(e,t){return t in Qa(e)},ownKeys(e){return Reflect.ownKeys(Qa(e))},set(e,t,n){const r=vA(Qa(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Rv(Qa(e),t),i=o==null?void 0:o[so];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(aG(n,o)&&(n!==void 0||Qw(e.base_,t)))return!0;Nv(e),t1(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Rv(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Nv(e),t1(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Qa(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Fr(11)},getPrototypeOf(e){return Du(e.base_)},setPrototypeOf(){Fr(12)}},qf={};zg(iE,(e,t)=>{qf[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});qf.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Fr(13),qf.set.call(this,e,t,void 0)};qf.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Fr(14),iE.set.call(this,e[0],t,n,e[0])};function Rv(e,t){const n=e[so];return(n?Qa(n):e)[t]}function hG(e,t,n){var o;const r=vA(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function vA(e,t){if(!(t in e))return;let n=Du(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Du(n)}}function t1(e){e.modified_||(e.modified_=!0,e.parent_&&t1(e.parent_))}function Nv(e){e.copy_||(e.copy_=Zw(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var pG=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...c){return s.produce(l,u=>n.call(this,u,...c))}}typeof n!="function"&&Fr(6),r!==void 0&&typeof r!="function"&&Fr(7);let o;if(Ol(t)){const i=hN(this),s=n1(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Jw(i):e1(i)}return fN(i,r),pN(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===mA&&(o=void 0),this.autoFreeze_&&oE(o,!0),r){const i=[],s=[];Fl("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else Fr(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Ol(e)||Fr(8),Mu(e)&&(e=mG(e));const t=hN(this),n=n1(e,void 0);return n[so].isManual_=!0,e1(t),n}finishDraft(e,t){const n=e&&e[so];(!n||!n.isManual_)&&Fr(9);const{scope_:r}=n;return fN(r,t),pN(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=Fl("Patches").applyPatches_;return Mu(e)?r(e,t):this.produce(e,o=>r(o,t))}};function n1(e,t){const n=m0(e)?Fl("MapSet").proxyMap_(e,t):g0(e)?Fl("MapSet").proxySet_(e,t):fG(e,t);return(t?t.scope_:yA()).drafts_.push(n),n}function mG(e){return Mu(e)||Fr(10,e),xA(e)}function xA(e){if(!Ol(e)||b0(e))return e;const t=e[so];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Zw(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Zw(e,!0);return zg(n,(r,o)=>{bA(n,r,xA(o))}),t&&(t.finalized_=!1),n}var ao=new pG,gG=ao.produce;ao.produceWithPatches.bind(ao);ao.setAutoFreeze.bind(ao);ao.setUseStrictShallowCopy.bind(ao);ao.applyPatches.bind(ao);ao.createDraft.bind(ao);ao.finishDraft.bind(ao);const bG=e=>(t,n,r)=>(r.setState=(o,i,...s)=>{const a=typeof o=="function"?gG(o):o;return t(a,i,...s)},e(r.setState,n,r)),sE=bG;var r1,tm=rn;if(process.env.NODE_ENV==="production")r1=tm.createRoot,tm.hydrateRoot;else{var gN=tm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;r1=function(e,t){gN.usingClientEntryPoint=!0;try{return tm.createRoot(e,t)}finally{gN.usingClientEntryPoint=!1}}}var wA={},CA={},aE={exports:{}},tt=String,SA=function(){return{isColorSupported:!1,reset:tt,bold:tt,dim:tt,italic:tt,underline:tt,inverse:tt,hidden:tt,strikethrough:tt,black:tt,red:tt,green:tt,yellow:tt,blue:tt,magenta:tt,cyan:tt,white:tt,gray:tt,bgBlack:tt,bgRed:tt,bgGreen:tt,bgYellow:tt,bgBlue:tt,bgMagenta:tt,bgCyan:tt,bgWhite:tt,blackBright:tt,redBright:tt,greenBright:tt,yellowBright:tt,blueBright:tt,magentaBright:tt,cyanBright:tt,whiteBright:tt,bgBlackBright:tt,bgRedBright:tt,bgGreenBright:tt,bgYellowBright:tt,bgBlueBright:tt,bgMagentaBright:tt,bgCyanBright:tt,bgWhiteBright:tt}};aE.exports=SA();aE.exports.createColors=SA;var yG=aE.exports;(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(l,c){for(var u in c)Object.defineProperty(l,u,{enumerable:!0,get:c[u]})}t(e,{dim:function(){return s},default:function(){return a}});const n=r(yG);function r(l){return l&&l.__esModule?l:{default:l}}let o=new Set;function i(l,c,u){typeof process<"u"&&process.env.JEST_WORKER_ID||u&&o.has(u)||(u&&o.add(u),console.warn(""),c.forEach(d=>console.warn(l,"-",d)))}function s(l){return n.default.dim(l)}const a={info(l,c){i(n.default.bold(n.default.cyan("info")),...Array.isArray(l)?[l]:[c,l])},warn(l,c){i(n.default.bold(n.default.yellow("warn")),...Array.isArray(l)?[l]:[c,l])},risk(l,c){i(n.default.bold(n.default.magenta("risk")),...Array.isArray(l)?[l]:[c,l])}}})(CA);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const t=n(CA);function n(i){return i&&i.__esModule?i:{default:i}}function r({version:i,from:s,to:a}){t.default.warn(`${s}-color-renamed`,[`As of Tailwind CSS ${i}, \`${s}\` has been renamed to \`${a}\`.`,"Update your configuration file to silence this warning."])}const o={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},get lightBlue(){return r({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return r({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return r({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return r({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return r({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}})(wA);let Dv=wA;var vG=(Dv.__esModule?Dv:{default:Dv}).default;const Pt=ka(vG),Hg=!1,lE=`import pandas as pd
34
34
  df = pd.DataFrame(data) # 'data' contains the query result
35
35
  result = df.to_dict('records') # must return 'result' as [dict] type
36
- `,EA=["_forecast"],Wg="dm",Gf=[{locale:"en-US",currency:"USD",currencyName:"US Dollar"},{locale:"en-GB",currency:"GBP",currencyName:"British Pound"},{locale:"en-CA",currency:"CAD",currencyName:"Canadian Dollar"},{locale:"en-AU",currency:"AUD",currencyName:"Australian Dollar"},{locale:"en-IN",currency:"INR",currencyName:"Indian Rupee"},{locale:"ja-JP",currency:"JPY",currencyName:"Japanese Yen"},{locale:"de-DE",currency:"EUR",currencyName:"Germany (Eurozone)"},{locale:"fr-FR",currency:"EUR",currencyName:"France (Eurozone)"},{locale:"es-ES",currency:"EUR",currencyName:"Spain (Eurozone)"},{locale:"it-IT",currency:"EUR",currencyName:"Italy (Eurozone)"},{locale:"fi-FI",currency:"EUR",currencyName:"Finland (Eurozone)"},{locale:"nl-NL",currency:"EUR",currencyName:"Netherlands (Eurozone)"},{locale:"zh-CN",currency:"CNY",currencyName:"Chinese Yuan"},{locale:"ru-RU",currency:"RUB",currencyName:"Russian Ruble"},{locale:"pt-BR",currency:"BRL",currencyName:"Brazilian Real"},{locale:"ko-KR",currency:"KRW",currencyName:"South Korean Won"},{locale:"ar-SA",currency:"SAR",currencyName:"Saudi Riyal"},{locale:"sv-SE",currency:"SEK",currencyName:"Swedish Krona"},{locale:"no-NO",currency:"NOK",currencyName:"Norwegian Krone"},{locale:"da-DK",currency:"DKK",currencyName:"Danish Krone"},{locale:"pl-PL",currency:"PLN",currencyName:"Polish Zloty"},{locale:"tr-TR",currency:"TRY",currencyName:"Turkish Lira"},{locale:"he-IL",currency:"ILS",currencyName:"Israeli Shekel"},{locale:"th-TH",currency:"THB",currencyName:"Thai Baht"},{locale:"vi-VN",currency:"VND",currencyName:"Vietnamese Dong"},{locale:"id-ID",currency:"IDR",currencyName:"Indonesian Rupiah"},{locale:"mx-MX",currency:"MXN",currencyName:"Mexican Peso"},{locale:"za-ZA",currency:"ZAR",currencyName:"South African Rand"},{locale:"sg-SG",currency:"SGD",currencyName:"Singapore Dollar"},{locale:"hk-HK",currency:"HKD",currencyName:"Hong Kong Dollar"},{locale:"ch-CH",currency:"CHF",currencyName:"Swiss Franc"},{locale:"my-MY",currency:"MYR",currencyName:"Malaysian Ringgit"},{locale:"ph-PH",currency:"PHP",currencyName:"Philippine Peso"},{locale:"eg-EG",currency:"EGP",currencyName:"Egyptian Pound"},{locale:"nz-NZ",currency:"NZD",currencyName:"New Zealand Dollar"}],xG=[{label:"English",locales:[{code:"en-US",name:"US English"},{code:"en-GB",name:"British English"},{code:"en-AU",name:"Australian English"},{code:"en-CA",name:"Canadian English"}]},{label:"French",locales:[{code:"fr-FR",name:"France French"},{code:"fr-CA",name:"Canadian French"}]},{label:"Spanish",locales:[{code:"es-ES",name:"Spain Spanish"},{code:"es-MX",name:"Mexican Spanish"},{code:"es-419",name:"Latin American Spanish"}]},{label:"German",locales:[{code:"de-DE",name:"Germany German"},{code:"de-CH",name:"Swiss German"}]},{label:"Chinese",locales:[{code:"zh-CN",name:"Simplified Chinese (China)"},{code:"zh-TW",name:"Traditional Chinese (Taiwan)"},{code:"zh-HK",name:"Hong Kong Chinese"}]},{label:"Japanese",locales:[{code:"ja-JP",name:"Japanese"}]},{label:"Arabic",locales:[{code:"ar-EG",name:"Egypt Arabic"},{code:"ar-SA",name:"Saudi Arabia Arabic"}]},{label:"Russian",locales:[{code:"ru-RU",name:"Russian"}]},{label:"Portuguese",locales:[{code:"pt-PT",name:"Portugal Portuguese"},{code:"pt-BR",name:"Brazil Portuguese"}]},{label:"Indian Languages",locales:[{code:"hi-IN",name:"Hindi (India)"},{code:"ta-IN",name:"Tamil (India)"}]},{label:"Korean",locales:[{code:"ko-KR",name:"Korean"}]},{label:"Italian",locales:[{code:"it-IT",name:"Italian (Italy)"}]},{label:"Dutch",locales:[{code:"nl-NL",name:"Dutch (Netherlands)"}]},{label:"Swedish",locales:[{code:"sv-SE",name:"Swedish (Sweden)"}]},{label:"Turkish",locales:[{code:"tr-TR",name:"Turkish (Turkey)"}]},{label:"Hebrew",locales:[{code:"he-IL",name:"Hebrew (Israel)"}]},{label:"Thai",locales:[{code:"th-TH",name:"Thai (Thailand)"}]},{label:"Polish",locales:[{code:"pl-PL",name:"Polish (Poland)"}]},{label:"Greek",locales:[{code:"el-GR",name:"Greek (Greece)"}]},{label:"Norwegian",locales:[{code:"no-NO",name:"Norwegian (Norway)"}]}],cE=["lg","md","sm","xs","xxs"],Ug={default:{dashboardPanel:"",dashboardTabsContainer:"",gridLayout:{className:""},chart:{font:{family:"Open Sans, Arial, sans-serif"},dataset:{backgroundColor:[Pt.teal[500],Pt.teal[300],Pt.gray[700],Pt.gray[500],Pt.gray[300]],borderColor:[Pt.teal[500],Pt.teal[300],Pt.gray[700],Pt.gray[500],Pt.gray[300]]},options:{interaction:{mode:"index"},plugins:{datalabels:{display:!1,color:o1},title:{display:!0},tooltip:{backgroundColor:"#fff",bodyColor:"#000",borderWidth:.25,titleColor:"#000",borderColor:"rgb(128,131,139)",cornerRadius:4,usePointStyle:!0,pointStyle:"rectRounded",boxPadding:4},legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},scales:{y:{grid:{display:!0},title:{display:!0,text:""},beginAtZero:!0,ticks:{precision:0}},x:{grid:{display:!0},title:{display:!0}}},layout:{padding:{top:-40}},borderRadius:2,responsive:!0,maintainAspectRatio:!1}}},dark:{chart:{dataset:{datalables:{color:o1},backgroundColor:[Pt.teal[500],Pt.teal[300],Pt.gray[700],Pt.gray[500],Pt.gray[300]],borderColor:[Pt.teal[500],Pt.teal[300],Pt.gray[700],Pt.gray[500],Pt.gray[300]]},options:{plugins:{tooltip:{backgroundColor:"#000",bodyColor:"#fff",borderWidth:.25,titleColor:"#fff",borderColor:"rgb(128,131,139)",cornerRadius:2,boxPadding:4}},datalabels:{display:!1},scales:{x:{grid:{display:!0,color:Pt.slate[800]}},y:{grid:{display:!0,color:Pt.slate[800]}}}}}}};function o1(e){var r,o,i,s,a,l;const t=(a=(s=(i=(o=(r=e==null?void 0:e.chart)==null?void 0:r.config)==null?void 0:o._config)==null?void 0:i.options)==null?void 0:s.plugins)==null?void 0:a.datalabels;let n=(l=e==null?void 0:e.dataset)==null?void 0:l.backgroundColor;return(t==null?void 0:t.align)==="end"&&(t==null?void 0:t.anchor)==="end"&&(n=Yf()),(t==null?void 0:t.align)==="start"&&(t==null?void 0:t.anchor)==="start"&&(n=Yf()),Pu(n)}function Yf(){return re.getState().theme==="dark"?"#000000":"#FFFFFF"}function Pu(e){let t=0,n=0,r=0,o=0;const i=u=>{if(!u)return Pt.gray[500];const d=u.replace("#",""),h=parseInt(d.substring(0,2),16),p=parseInt(d.substring(2,4),16),m=parseInt(d.substring(4,6),16);t+=h,n+=p,r+=m,o++};Array.isArray(e)?e.forEach(u=>{i(u)}):i(e);const s=t/o,a=n/o,l=r/o;return(s*299+a*587+l*114)/1e3>=180?"black":"white"}const wG=["text","nullable(string)","name","enum","varchar","nvarchar","nvarchar2","char","character","longtext","nchar","char varying","nchar varying","character varying","string"],CG=["number","integer","int","int64","bigint","smallint","tinyint","byteint","numeric","decimal","dec","double","real","double precision","float","float4","float8","float64"],SG=["date","datetime","time","timestamp","timestamp without time zone","timestamp_ns"],EG=["boolean"];function uE(e){return e.match(/[A-Z]/)?`"${e}"`:e}function y0(e){return wG.includes(e.toLowerCase())||/varchar/i.test(e)}function Xh(e){return CG.includes(e.toLowerCase())||/int|decimal|float|double/i.test(e)}function oc(e){return SG.includes(e.toLowerCase())||/date|time|timestamp/i.test(e)}function dE(e){return EG.includes(e.toLowerCase())||/boolean/i.test(e)}function _G(e,t,n,r,o,i){const{measures:s,dimensions:a}=e,l=s==null?void 0:s.map(h=>`${h.calc}(${h.name}) as ${h.calc}_${h.name.replace(/"/g,"")}`).join(", "),c=(a==null?void 0:a.join(", "))||"";let u="";const d=r?`${Wg}.${r}`:fE({schemaName:t,tableName:n,connectionType:o,databaseName:i});if(l&&c)return u=`SELECT ${c}, COUNT(*) as count, ${l} FROM ${d} GROUP BY ${c} ORDER BY ${c} DESC LIMIT 100`,u;if(!l&&c)return u=`SELECT ${c}, COUNT(*) as count FROM ${d} GROUP BY ${c} ORDER BY ${c} DESC LIMIT 100`,u;if(l&&!c)return u=`SELECT ${l} FROM ${d} LIMIT 100`,u}function kG(e,t,n="AVG"){var i,s,a,l;let r={};const o=uE(e.column_name);return y0(e.data_type)&&(((i=t.dimensions)==null?void 0:i.includes(o))?r={...t,dimensions:(s=t.dimensions)==null?void 0:s.filter(u=>u!==o)}:r={...t,dimensions:[...t.dimensions||[],o]}),Xh(e.data_type)&&(((a=t.measures)==null?void 0:a.some(u=>u.name===o&&u.calc===n))?r={...t,measures:(l=t.measures)==null?void 0:l.filter(u=>!(u.name===o&&u.calc===n))}:r={...t,measures:[...t.measures||[],{name:o,calc:n||"SUM"}]}),r}function tu(e){return y0(e.dataType)?"string":Xh(e.dataType)?"number":oc(e.dataType)?"date":dE(e.dataType)?"boolean":"string"}function RG(e){let t;const n=e.data_type.toLowerCase();return y0(n)?t="T":Xh(n)?t="#":oc(n)?t="D":dE(n)?t="B":t="?",t}function NG(e,t){const{dimensions:n,measures:r}=t,o=n==null?void 0:n.includes(e.column_name),i=r==null?void 0:r.some(s=>s.name===e.column_name);return o||i}function _A(e){return e?e!=null&&e.startsWith(`${Wg}.`)?e:`${Wg}.${e}`:""}function kA({schemaName:e,tableName:t,modelName:n,connectionType:r,databaseName:o}){let i=fE({schemaName:e,tableName:t,connectionType:r,databaseName:o});n&&(i=_A(n));let s=i;return(l=>/[A-Z]/.test(l))(t)&&(s=s.split(".").map(c=>`"${c}"`).join(".")),s}function fE({schemaName:e,tableName:t,connectionType:n,databaseName:r}){return t==="api"||e===uE("NA")||n==="S3"||n==="API"?t:n==="S3Tables"?`${r}.${e}.${t}`:e?`${e}.${t}`:`${t}`}const DG=e=>{const t=new Date(e);return!isNaN(t.getTime())},MG=e=>!isNaN(Number(e))&&!isNaN(parseFloat(e)),v0=e=>{let t;return typeof e=="number"?t="number":typeof e=="string"?DG(e)?t="date":MG(e)?t="number":t="string":typeof e=="boolean"?t="boolean":e instanceof Date?t="date":t="unknown",t};function PG({get:e,dataPoint:t,card:n}){var h;const{addOrUpdateFilterValue:r,addFilteringCard:o,removeFilterValues:i,replaceFilterValue:s,removeFilteringCard:a}=e().actions,l=e().filteringCards,{columnName:c,columnValue:u}=t,d={filterId:n.id,connectionId:n==null?void 0:n.connectionId,tableName:n.lastSelectedTable,name:c,expression:(h=n.preferences)==null?void 0:h.filterOnClickField,valueType:v0(u),operation:"=",values:[u]};if(l!=null&&l.find(p=>p.id===n.id)){const p=n.id;if(u==null){a(n),i(p);return}else s(d)}o(n),r(d)}function bN({id:e,layouts:t,initialHeight:n,y:r,x:o,w:i,minH:s}){const a={i:e,x:o??0,y:r??1/0,w:i||20,h:n||35,minW:6,minH:s||10},l=t?{...t}:{};return cE.forEach(c=>{l[c]||(l[c]=[]);const u=l[c].reduce((d,h)=>Math.max(d,h.y+h.h),0);a.y=a.y===1/0?u:a.y,l[c].push({...a})}),l}function yN(e,t){if(!t)return;const n={...t};return cE.forEach(r=>{n[r]&&(n[r]=n[r].filter(o=>o.i!==e))}),n}function RA(e){const t=re.getState().dashboard.globalCacheConfig,{card:n,filter:r}=e;return t}const re=rc()(sE((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:Ug},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{setInitStore:()=>{e(n=>{n.isSessionExpired=!1,n.currentBreakpoint="lg",n.dashboard={id:"",style:Ug},n.showContext=!1,n.selectedSheetId=null,n.selectedCardId=null,n.selectedFrameId=null,n.selectedCard=null,n.showFilters=!1,n.isDashboardEditing=!0,n.isVisualEditing=!1,n.showDashboardJSON=!1,n.filteringCards=[],n.selectedLensId=void 0,n.filterValues=void 0})},setAiContext:n=>{e(r=>{r.dashboard.aiContext=n})},setHandleOpenAssistantProfile:n=>{e(r=>{r.handleOpenAssistantProfile=n})},setFilterMode:(n,r)=>{const o=r==="exclude"?"not in":"in";e(i=>{var a,l,c;const s=(a=i.dashboard.filters)==null?void 0:a.find(u=>u.id===n);s&&(s.operation=o,i.dashboard.filters=(l=i.dashboard.filters)==null?void 0:l.map(u=>u.id===n?s:u),i.filterValues&&i.filterValues.length>0&&(i.filterValues=(c=i.filterValues)==null?void 0:c.map(u=>u.filterId===n?{...u,operation:o}:u)))})},updateEmailSettings:n=>{e(r=>{r.dashboard.emailSettings=n})},setDefaultFilterValues:n=>{e(r=>{r.dashboard.defaultFilterValues=n})},setIsDownloadingPdf:n=>{e(r=>{r.isDownloadingPdf=n})},setGlobalCacheConfig:n=>{e(r=>{r.dashboard.globalCacheConfig=n})},setLenses:n=>{e(r=>{r.lenses=n})},setSelectedLensId:n=>{e(r=>{r.selectedLensId=n})},deleteSheet:n=>{e(r=>{var i,s,a,l,c,u,d,h;const o=(i=r.dashboard.sheets)==null?void 0:i.findIndex(p=>p.id===n);if(o!==void 0&&o>-1){(s=r.dashboard.sheets)==null||s.splice(o,1);const p=(a=r.dashboard.filters)==null?void 0:a.filter(g=>g.sheetId===n),m=(l=r.filterValues)==null?void 0:l.filter(g=>p==null?void 0:p.some(b=>b.id===g.filterId));r.filterValues=(c=r.filterValues)==null?void 0:c.filter(g=>!(m!=null&&m.some(b=>b.filterId===g.filterId))),r.dashboard.filters=(u=r.dashboard.filters)==null?void 0:u.filter(g=>g.sheetId!==n),r.selectedSheetId=(h=(d=r.dashboard.sheets)==null?void 0:d[0])==null?void 0:h.id}})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const o=r.dashboard.filters;let i={};o==null||o.forEach(a=>{cE.forEach(l=>{i!=null&&i[l]||(i={...i,[l]:[]});const c={i:a.id,x:0,y:0,w:10,h:8};i[l].push(c)})});const s={...n,layouts:i};r.dashboard.sheets.push(s)})},setGlobalStyle:n=>{e(r=>{r.dashboard.globalStyle=n})},setAIScopeTables:n=>{e(r=>{r.dashboard.aiScopeTables=n})},addToAIScope:n=>{e(r=>{const{connectionId:o,connectionType:i,databaseName:s,schemaName:a,tableName:l,datamodelName:c,datamodelId:u}=n,d={connectionId:o||"",connectionType:i||"",databaseName:s||"",schemaName:a||"",tableName:l||"",datamodelName:c||"",datamodelId:u||""};let p=[...r.dashboard.aiScopeTables||[],d];p=p.filter((m,g,b)=>b.findIndex(y=>y.tableName===m.tableName&&y.datamodelName===m.datamodelName)===g),r.dashboard.aiScopeTables=p})},removeFromAIScope:n=>{e(r=>{const{connectionId:o,tableName:i,datamodelName:s}=n,a=r.dashboard.aiScopeTables||[];if(s){const l=a.filter(c=>!(c.datamodelName===s&&c.connectionId===o));r.dashboard.aiScopeTables=l}else if(i){const l=a.filter(c=>!(c.tableName===i&&c.connectionId===o));r.dashboard.aiScopeTables=l}})},setIsSessionExpired:n=>{e(()=>({isSessionExpired:n}))},setCardPython:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===o.selectedSheetId);i&&((l=i==null?void 0:i.frames)==null||l.forEach(c=>{var d;const u=(d=c.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.python=r)}))})},addBaseQuery:n=>{e(r=>{var o;r.dashboard.baseQueries||(r.dashboard.baseQueries=[]),(o=r.dashboard.baseQueries)==null||o.push(n)})},removeBaseQuery:n=>{e(r=>{var i,s;const o=(i=r.dashboard.baseQueries)==null?void 0:i.findIndex(a=>a.id===n);o!=null&&o>-1&&((s=r.dashboard.baseQueries)==null||s.splice(o,1))})},setBaseQueries:n=>{e(r=>{r.dashboard.baseQueries=n})},setCurrentBreakpoint:n=>{e(()=>({currentBreakpoint:n}))},setFilteringCards:n=>{e(()=>({filteringCards:n}))},addFilteringCard:n=>{e(r=>{var o;(o=r.filteringCards)==null||o.push(n)})},removeFilteringCard:n=>{e(r=>{var i,s;const o=(i=r.filteringCards)==null?void 0:i.findIndex(a=>a.id===n.id);o!==void 0&&o>-1&&((s=r.filteringCards)==null||s.splice(o,1))})},setCustomCards:n=>{e(r=>{r.dashboard.customCards=n})},setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setDashboard:n=>e({dashboard:n}),setDashboardWithFilterValues:(n,r)=>{e(o=>{o.dashboard=n,o.filterValues=r})},setDashboardTheme:n=>{e(r=>{r.theme=n})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setSheetTitle:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.title=r)})},setCardTitle:(n,r,o)=>{e(i=>{var a,l,c;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&((c=s==null?void 0:s.frames)==null||c.forEach(u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.title=o)}))})},setCardInfo:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===o.selectedSheetId);i&&((l=i==null?void 0:i.frames)==null||l.forEach(c=>{var d;const u=(d=c.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.info=r)}))})},setCardDescription:(n,r,o)=>{e(i=>{var a,l,c;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&((c=s==null?void 0:s.frames)==null||c.forEach(u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.description=o)}))})},setCardSql:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){const d=(c=s.cards)==null?void 0:c.find(h=>h.id===r);d&&(d.sql=o,(u=i.onUpdateCard)==null||u.call(i,d,n))}})},setSheetLayout:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layout=r)})},setSheetLayouts:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layouts=r)})},setShowContext:n=>{e(()=>({showContext:n}))},setShowFilters:n=>{e(()=>({showFilters:n}))},setFilterValues:n=>{e(()=>({filterValues:n}))},addOrUpdateFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1?r.filterValues.splice(o,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},addOrUpdateFilterValues:n=>{e(r=>{r.filterValues?n.forEach(o=>{var s,a,l,c;const i=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(u=>u.filterId===o.filterId);if(o.values.length===0){r.filterValues=(a=r.filterValues)==null?void 0:a.filter(u=>u.filterId!==o.filterId);return}i!==void 0&&i>-1?(l=r.filterValues)==null||l.splice(i,1,o):(c=r.filterValues)==null||c.push(o)}):r.filterValues=n})},removeFilterValues:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.filter(i=>i.filterId!==n&&!i.filterId.startsWith(n));r.filterValues=o}})},replaceFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1&&r.filterValues.splice(o,1,n)}})},addFilter:n=>{e(r=>{var i,s;r.dashboard.filters?(i=r.dashboard.filters)==null||i.push(n):r.dashboard.filters=[n],(s=r.dashboard.sheets)==null||s.find(a=>a.id===r.selectedSheetId);const o=r.dashboard.sheets;o==null||o.forEach(a=>{bN({id:n.id,layouts:a.layouts,y:0,initialHeight:8,minH:7,w:10})})})},removeFilter:n=>{e(r=>{var o,i,s;if(r.dashboard.filters){const a=(o=r.dashboard.filters)==null?void 0:o.findIndex(l=>l.id===n);if(a>-1){(i=r.dashboard.filters)==null||i.splice(a,1),(s=r.dashboard.sheets)==null||s.find(c=>c.id===r.selectedSheetId);const l=r.dashboard.sheets;l==null||l.forEach(c=>{const u=yN(n,c.layouts);c.layouts=u})}}})},updateCurrentDashboardCard:n=>{e(r=>{var a,l,c,u,d;const o=(l=(a=r.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===r.selectedSheetId),i=(c=o==null?void 0:o.frames)==null?void 0:c.find(h=>h.id===r.selectedFrameId),s=(u=i==null?void 0:i.cards)==null?void 0:u.findIndex(h=>h.id===n.id);typeof s=="number"&&s>=0&&((d=i==null?void 0:i.cards)==null||d.splice(s,1,n))})},updateFrameCard:(n,r,o)=>{e(i=>{var l,c,u,d,h;const s=(c=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(p=>p.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(p=>p.id===r);if(a){const p=(d=a.cards)==null?void 0:d.findIndex(m=>m.id===o.id);p>-1&&((h=a.cards)==null||h.splice(p,1,o))}})},updateFilter:n=>{e(r=>{var o,i;if(r.dashboard.filters){const s=(o=r.dashboard.filters)==null?void 0:o.findIndex(a=>a.id===n.id);s>-1&&((i=r.dashboard.filters)==null||i.splice(s,1,n))}})},updateFilterId:(n,r)=>{e(o=>{var a,l;const i=(a=o.dashboard.filters)==null?void 0:a.find(c=>c.id===n),s=(l=o.dashboard.filters)==null?void 0:l.some(c=>c.id===r);i&&!s&&(i.id=r)})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addFrame:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let d=1/0;const h=0;o==="start"&&(d=0);const p=bN({id:r.id,layouts:s.layouts,minH:10,x:h,y:d});s.layouts=p,(u=i.onAddFrame)==null||u.call(i,r,n)}})},removeFrame:(n,r)=>{e(o=>{var s,a,l,c,u;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(d=>d.id===n);if(i){const d=(l=i.frames)==null?void 0:l.findIndex(h=>h.id===r);console.log(d),typeof d=="number"&&d>-1&&((c=i.frames)==null||c.splice(d,1),(u=i.layout)==null||u.splice(d,1),yN(r,i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,c,u,d;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.frames)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.frames)==null||u.splice(s,1,r)),(d=o.onAcceptChanges)==null||d.call(o,r,o.dashboard)})},updateCard:(n,r)=>{e(o=>{var a,l,c,u,d;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.cards)==null||u.splice(s,1,r),(d=o.onUpdateCard)==null||d.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,c,u,d,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(p=>p.id===r.id);i&&((u=i.cards)==null||u.splice(s,1),(d=i.layout)==null||d.splice(s,1),(h=o.onRemoveCard)==null||h.call(o,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===n);i&&(((l=i.cards)==null?void 0:l.find(u=>u.id===r))?o.selectedCardId=r:o.selectedCardId=null)})},setSelectedFrameId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId))&&(r.selectedFrameId=n)})},setSelectedSheetId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===n))&&(r.selectedSheetId=n)})},setOnSaveFunction:n=>{e(()=>({onSaveFunction:n}))},setOnAddCard:n=>{e(()=>({onAddCard:n}))},setOnAcceptChanges:n=>{e(()=>({onAcceptChanges:n}))},setOnUpdateCard:n=>{e(()=>({onUpdateCard:n}))},setOnRemoveCard:n=>{e(()=>({onRemoveCard:n}))},setOnEvent:n=>{e(()=>({onEvent:n}))},getDashboard:()=>t().dashboard,getSelectedSheet:()=>{var n,r;return(r=(n=t().dashboard)==null?void 0:n.sheets)==null?void 0:r.find(o=>o.id===t().selectedSheetId)},getCardFrame:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a){for(let l=0;l<a.length;l++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return a[l]}}},getSelectedFrame:()=>{var r,o,i;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(s=>s.id===t().selectedSheetId);return(i=n==null?void 0:n.frames)==null?void 0:i.find(s=>s.id===t().selectedFrameId)},getCard:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a)for(let l=0;l<a.length;l++){const c=(i=a[l].cards)==null?void 0:i.find(u=>u.id===n);if(c)return c}}},getSelectedSheetLayout:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layout},getSelectedSheetLayouts:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layouts},getStyle:()=>{var n;return(n=t().dashboard)==null?void 0:n.style},getCardSheet(n){var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a){for(let l=0;l<a.length;l++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return r[s]}}},handleDataPointClickAction:(n,r)=>{PG({card:n,dataPoint:r,get:t})}}}))),NA=()=>re(t=>{var i,s,a,l,c;const n=(s=(i=t.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(u=>u.id===t.selectedSheetId),r=(a=n==null?void 0:n.frames)==null?void 0:a.find(u=>u.id===t.selectedFrameId);return((l=r==null?void 0:r.cards)==null?void 0:l.find(u=>u.id===(r==null?void 0:r.activeCardId)))||((c=r==null?void 0:r.cards)==null?void 0:c[0])}),DA=()=>{var n;const e=re(r=>{var o,i;return(i=(o=r.dashboard)==null?void 0:o.sheets)==null?void 0:i.find(s=>s.id===r.selectedSheetId)});return(((n=e==null?void 0:e.frames)==null?void 0:n.map(r=>{var o;return(o=r.cards)==null?void 0:o.find(i=>i.id===r.activeCardId)}))||[]).filter(r=>r!==void 0)},MA=()=>{var t,n,r;const e=NA();return{metricFields:((t=e==null?void 0:e.config)==null?void 0:t.metricColumns)||[],groupByFields:((n=e==null?void 0:e.config)==null?void 0:n.groupByColumns)||[],pivotByFields:((r=e==null?void 0:e.config)==null?void 0:r.pivotByColumns)||[]}},on=()=>re(e=>e.actions);async function IG(e,t){const n=t.slice(0,16),r=new TextEncoder,o=await window.crypto.subtle.importKey("raw",r.encode(n),{name:"PBKDF2"},!1,["deriveKey"]),i=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r.encode(n),iterations:1e5,hash:"SHA-256"},o,{name:"AES-GCM",length:256},!1,["encrypt"]),s=window.crypto.getRandomValues(new Uint8Array(12)),a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:s},i,r.encode(e)),l=new Uint8Array(s.length+a.byteLength);return l.set(s,0),l.set(new Uint8Array(a),s.length),{payload:btoa(String.fromCharCode(...l))}}async function PA(e,t){const n=t.slice(0,16),r=new TextEncoder,o=new TextDecoder,i=await window.crypto.subtle.importKey("raw",r.encode(n),{name:"PBKDF2"},!1,["deriveKey"]),s=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r.encode(n),iterations:1e5,hash:"SHA-256"},i,{name:"AES-GCM",length:256},!1,["decrypt"]),a=Uint8Array.from(atob(e),h=>h.charCodeAt(0)),l=a.slice(0,12),c=a.slice(a.length-16),u=a.slice(12,a.length-16),d=new Uint8Array(u.length+c.length);d.set(u),d.set(c,u.length);try{const h=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:l},s,d);return{decryptedData:o.decode(h)}}catch(h){throw new Error(`Decryption failed: ${h}`)}}function oe(...e){return Wq(Al(e))}const jG=e=>Object.keys(e).length===0;async function vr(e,t,n={}){try{const r=new URLSearchParams(n).toString(),o=`${e}?${r}`,i=await fetch(o,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!i.ok){const a=await i.json();throw new Error((a==null?void 0:a.error)||`HTTP error! status: ${i.status}`)}return await i.json()}catch(r){throw console.error("Error during fetch:",r),r}}async function IA(e,t,n={}){try{const r=JSON.stringify(n),o=await IG(r,t),i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(o)});if(!i.ok)return i.json().then(a=>{throw console.log(a.detail||"Unknown error occurred"),new Error((a==null?void 0:a.error)||`HTTP error! status: ${i.status}`)});const s=await i.json();if(s.payload){const a=await PA(s.payload,t);return JSON.parse(a.decryptedData)}return s}catch(r){throw console.error("Error during fetch:",r),r}}async function jA(e,t,n={}){try{const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n)});return r.ok?await r.json():r.json().then(i=>{throw console.log(i.detail||"Unknown error occurred"),new Error((i==null?void 0:i.error)||`HTTP error! status: ${r.status}`)})}catch(r){throw console.error("Error during fetch:",r),r}}function TG(e){if(!e)return{tenantId:"",endUserId:""};const t=Kh(e);return{tenantId:t==null?void 0:t.tenantId,endUserId:t==null?void 0:t.endUserId}}function AG(e){return e?Kh(e).assistantProfileId:void 0}function OG(e){if(!e)return;const t=Kh(e);if(t.params&&t.params.currencyFormat)return t.params.currencyFormat}function TA(e){return e?Kh(e).params:void 0}function hE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function AA(e){return e.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substring(1).toLowerCase())}function OA(e){return e.replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase())}const Mr="focus:ring-1 focus:ring-offset-0 focus-visible:ring-1 focus-visible:ring-offset-0",hs="focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 focus:ring-0 focus:ring-ring focus:ring-offset-0";async function FG(){var o,i;const e=(i=(o=re.getState())==null?void 0:o.authToken)==null?void 0:i.accessToken;if(!e)return;const n=await fetch("https://semaphor.cloud/api/v1/invalidate-token",{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!n.ok)throw new Error("Failed to invalidate token");const r=await n.json();return console.log("invalidateToken",r),r}async function LG(e,t={}){if(!e)return null;let n="https://semaphor.cloud/api/v1/dashboard";const r=Object.fromEntries(Object.entries(t).filter(([a,l])=>l!==void 0)),o=new URLSearchParams(r).toString();o&&(n+=`?${o}`);let s=await(await fetch(n,{headers:{Authorization:`Bearer ${e}`}})).json();if("payload"in s){const a=await PA(atob(s.payload),e);s=JSON.parse(a.decryptedData)}return s}async function $G(e){return e?await(await fetch("https://semaphor.cloud/api/v1/plugins",{headers:{Authorization:`Bearer ${e}`}})).json():null}const FA=e=>/boolean/i.test(e)?"boolean":/date|timestamp/i.test(e)?"date":/int|decimal|float|double|num/i.test(e)?"number":/json/i.test(e)?"json":/geo|geography|geometry/i.test(e)?"geo":"string";var qg={exports:{}};qg.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=800,i=16,s=9007199254740991,a="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",d="[object Date]",h="[object Error]",p="[object Function]",m="[object GeneratorFunction]",g="[object Map]",b="[object Number]",y="[object Null]",v="[object Object]",x="[object Proxy]",E="[object RegExp]",_="[object Set]",S="[object String]",C="[object Undefined]",R="[object WeakMap]",N="[object ArrayBuffer]",D="[object DataView]",I="[object Float32Array]",P="[object Float64Array]",A="[object Int8Array]",F="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",$="[object Uint8ClampedArray]",V="[object Uint16Array]",z="[object Uint32Array]",j=/[\\^$.*+?()[\]{}|]/g,W=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,M={};M[I]=M[P]=M[A]=M[F]=M[T]=M[O]=M[$]=M[V]=M[z]=!0,M[a]=M[l]=M[N]=M[u]=M[D]=M[d]=M[h]=M[p]=M[g]=M[b]=M[v]=M[E]=M[_]=M[S]=M[R]=!1;var H=typeof as=="object"&&as&&as.Object===Object&&as,B=typeof self=="object"&&self&&self.Object===Object&&self,G=H||B||Function("return this")(),q=t&&!t.nodeType&&t,Y=q&&!0&&e&&!e.nodeType&&e,K=Y&&Y.exports===q,Z=K&&H.process,ne=function(){try{var U=Y&&Y.require&&Y.require("util").types;return U||Z&&Z.binding&&Z.binding("util")}catch{}}(),Q=ne&&ne.isTypedArray;function ie(U,J,se){switch(se.length){case 0:return U.call(J);case 1:return U.call(J,se[0]);case 2:return U.call(J,se[0],se[1]);case 3:return U.call(J,se[0],se[1],se[2])}return U.apply(J,se)}function te(U,J){for(var se=-1,Ne=Array(U);++se<U;)Ne[se]=J(se);return Ne}function ue(U){return function(J){return U(J)}}function de(U,J){return U==null?void 0:U[J]}function Re(U,J){return function(se){return U(J(se))}}var xe=Array.prototype,Se=Function.prototype,Pe=Object.prototype,Ye=G["__core-js_shared__"],Rt=Se.toString,ge=Pe.hasOwnProperty,Ae=function(){var U=/[^.]+$/.exec(Ye&&Ye.keys&&Ye.keys.IE_PROTO||"");return U?"Symbol(src)_1."+U:""}(),Ie=Pe.toString,ee=Rt.call(Object),le=RegExp("^"+Rt.call(ge).replace(j,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ke=K?G.Buffer:void 0,Me=G.Symbol,Ue=G.Uint8Array;ke&&ke.allocUnsafe;var At=Re(Object.getPrototypeOf,Object),Rn=Object.create,mn=Pe.propertyIsEnumerable,ye=xe.splice,gn=Me?Me.toStringTag:void 0,Ot=function(){try{var U=hv(Object,"defineProperty");return U({},"",{}),U}catch{}}(),uo=ke?ke.isBuffer:void 0,Fn=Math.max,Cc=Date.now,La=hv(G,"Map"),Hi=hv(Object,"create"),an=function(){function U(){}return function(J){if(!Ba(J))return{};if(Rn)return Rn(J);U.prototype=J;var se=new U;return U.prototype=void 0,se}}();function Nt(U){var J=-1,se=U==null?0:U.length;for(this.clear();++J<se;){var Ne=U[J];this.set(Ne[0],Ne[1])}}function Ln(){this.__data__=Hi?Hi(null):{},this.size=0}function je(U){var J=this.has(U)&&delete this.__data__[U];return this.size-=J?1:0,J}function qe(U){var J=this.__data__;if(Hi){var se=J[U];return se===r?void 0:se}return ge.call(J,U)?J[U]:void 0}function rt(U){var J=this.__data__;return Hi?J[U]!==void 0:ge.call(J,U)}function Jt(U,J){var se=this.__data__;return this.size+=this.has(U)?0:1,se[U]=Hi&&J===void 0?r:J,this}Nt.prototype.clear=Ln,Nt.prototype.delete=je,Nt.prototype.get=qe,Nt.prototype.has=rt,Nt.prototype.set=Jt;function Ft(U){var J=-1,se=U==null?0:U.length;for(this.clear();++J<se;){var Ne=U[J];this.set(Ne[0],Ne[1])}}function Lt(){this.__data__=[],this.size=0}function Pn(U){var J=this.__data__,se=Kp(J,U);if(se<0)return!1;var Ne=J.length-1;return se==Ne?J.pop():ye.call(J,se,1),--this.size,!0}function en(U){var J=this.__data__,se=Kp(J,U);return se<0?void 0:J[se][1]}function bn(U){return Kp(this.__data__,U)>-1}function $a(U,J){var se=this.__data__,Ne=Kp(se,U);return Ne<0?(++this.size,se.push([U,J])):se[Ne][1]=J,this}Ft.prototype.clear=Lt,Ft.prototype.delete=Pn,Ft.prototype.get=en,Ft.prototype.has=bn,Ft.prototype.set=$a;function fo(U){var J=-1,se=U==null?0:U.length;for(this.clear();++J<se;){var Ne=U[J];this.set(Ne[0],Ne[1])}}function oi(){this.size=0,this.__data__={hash:new Nt,map:new(La||Ft),string:new Nt}}function za(U){var J=Qp(this,U).delete(U);return this.size-=J?1:0,J}function Id(U){return Qp(this,U).get(U)}function EU(U){return Qp(this,U).has(U)}function _U(U,J){var se=Qp(this,U),Ne=se.size;return se.set(U,J),this.size+=se.size==Ne?0:1,this}fo.prototype.clear=oi,fo.prototype.delete=za,fo.prototype.get=Id,fo.prototype.has=EU,fo.prototype.set=_U;function Sc(U){var J=this.__data__=new Ft(U);this.size=J.size}function kU(){this.__data__=new Ft,this.size=0}function RU(U){var J=this.__data__,se=J.delete(U);return this.size=J.size,se}function NU(U){return this.__data__.get(U)}function DU(U){return this.__data__.has(U)}function MU(U,J){var se=this.__data__;if(se instanceof Ft){var Ne=se.__data__;if(!La||Ne.length<n-1)return Ne.push([U,J]),this.size=++se.size,this;se=this.__data__=new fo(Ne)}return se.set(U,J),this.size=se.size,this}Sc.prototype.clear=kU,Sc.prototype.delete=RU,Sc.prototype.get=NU,Sc.prototype.has=DU,Sc.prototype.set=MU;function PU(U,J){var se=gv(U),Ne=!se&&mv(U),mt=!se&&!Ne&&GR(U),Bt=!se&&!Ne&&!mt&&KR(U),tn=se||Ne||mt||Bt,Ct=tn?te(U.length,String):[],nn=Ct.length;for(var Io in U)tn&&(Io=="length"||mt&&(Io=="offset"||Io=="parent")||Bt&&(Io=="buffer"||Io=="byteLength"||Io=="byteOffset")||UR(Io,nn))||Ct.push(Io);return Ct}function dv(U,J,se){(se!==void 0&&!Zp(U[J],se)||se===void 0&&!(J in U))&&fv(U,J,se)}function IU(U,J,se){var Ne=U[J];(!(ge.call(U,J)&&Zp(Ne,se))||se===void 0&&!(J in U))&&fv(U,J,se)}function Kp(U,J){for(var se=U.length;se--;)if(Zp(U[se][0],J))return se;return-1}function fv(U,J,se){J=="__proto__"&&Ot?Ot(U,J,{configurable:!0,enumerable:!0,value:se,writable:!0}):U[J]=se}var jU=qU();function Xp(U){return U==null?U===void 0?C:y:gn&&gn in Object(U)?GU(U):JU(U)}function HR(U){return jd(U)&&Xp(U)==a}function TU(U){if(!Ba(U)||QU(U))return!1;var J=yv(U)?le:W;return J.test(rq(U))}function AU(U){return jd(U)&&YR(U.length)&&!!M[Xp(U)]}function OU(U){if(!Ba(U))return ZU(U);var J=qR(U),se=[];for(var Ne in U)Ne=="constructor"&&(J||!ge.call(U,Ne))||se.push(Ne);return se}function WR(U,J,se,Ne,mt){U!==J&&jU(J,function(Bt,tn){if(mt||(mt=new Sc),Ba(Bt))FU(U,J,tn,se,WR,Ne,mt);else{var Ct=Ne?Ne(pv(U,tn),Bt,tn+"",U,J,mt):void 0;Ct===void 0&&(Ct=Bt),dv(U,tn,Ct)}},XR)}function FU(U,J,se,Ne,mt,Bt,tn){var Ct=pv(U,se),nn=pv(J,se),Io=tn.get(nn);if(Io){dv(U,se,Io);return}var Gr=Bt?Bt(Ct,nn,se+"",U,J,tn):void 0,Td=Gr===void 0;if(Td){var vv=gv(nn),xv=!vv&&GR(nn),ZR=!vv&&!xv&&KR(nn);Gr=nn,vv||xv||ZR?gv(Ct)?Gr=Ct:oq(Ct)?Gr=HU(Ct):xv?(Td=!1,Gr=zU(nn)):ZR?(Td=!1,Gr=VU(nn)):Gr=[]:iq(nn)||mv(nn)?(Gr=Ct,mv(Ct)?Gr=sq(Ct):(!Ba(Ct)||yv(Ct))&&(Gr=YU(nn))):Td=!1}Td&&(tn.set(nn,Gr),mt(Gr,nn,Ne,Bt,tn),tn.delete(nn)),dv(U,se,Gr)}function LU(U,J){return tq(eq(U,J,QR),U+"")}var $U=Ot?function(U,J){return Ot(U,"toString",{configurable:!0,enumerable:!1,value:lq(J),writable:!0})}:QR;function zU(U,J){return U.slice()}function BU(U){var J=new U.constructor(U.byteLength);return new Ue(J).set(new Ue(U)),J}function VU(U,J){var se=BU(U.buffer);return new U.constructor(se,U.byteOffset,U.length)}function HU(U,J){var se=-1,Ne=U.length;for(J||(J=Array(Ne));++se<Ne;)J[se]=U[se];return J}function WU(U,J,se,Ne){var mt=!se;se||(se={});for(var Bt=-1,tn=J.length;++Bt<tn;){var Ct=J[Bt],nn=void 0;nn===void 0&&(nn=U[Ct]),mt?fv(se,Ct,nn):IU(se,Ct,nn)}return se}function UU(U){return LU(function(J,se){var Ne=-1,mt=se.length,Bt=mt>1?se[mt-1]:void 0,tn=mt>2?se[2]:void 0;for(Bt=U.length>3&&typeof Bt=="function"?(mt--,Bt):void 0,tn&&KU(se[0],se[1],tn)&&(Bt=mt<3?void 0:Bt,mt=1),J=Object(J);++Ne<mt;){var Ct=se[Ne];Ct&&U(J,Ct,Ne,Bt)}return J})}function qU(U){return function(J,se,Ne){for(var mt=-1,Bt=Object(J),tn=Ne(J),Ct=tn.length;Ct--;){var nn=tn[++mt];if(se(Bt[nn],nn,Bt)===!1)break}return J}}function Qp(U,J){var se=U.__data__;return XU(J)?se[typeof J=="string"?"string":"hash"]:se.map}function hv(U,J){var se=de(U,J);return TU(se)?se:void 0}function GU(U){var J=ge.call(U,gn),se=U[gn];try{U[gn]=void 0;var Ne=!0}catch{}var mt=Ie.call(U);return Ne&&(J?U[gn]=se:delete U[gn]),mt}function YU(U){return typeof U.constructor=="function"&&!qR(U)?an(At(U)):{}}function UR(U,J){var se=typeof U;return J=J??s,!!J&&(se=="number"||se!="symbol"&&L.test(U))&&U>-1&&U%1==0&&U<J}function KU(U,J,se){if(!Ba(se))return!1;var Ne=typeof J;return(Ne=="number"?bv(se)&&UR(J,se.length):Ne=="string"&&J in se)?Zp(se[J],U):!1}function XU(U){var J=typeof U;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?U!=="__proto__":U===null}function QU(U){return!!Ae&&Ae in U}function qR(U){var J=U&&U.constructor,se=typeof J=="function"&&J.prototype||Pe;return U===se}function ZU(U){var J=[];if(U!=null)for(var se in Object(U))J.push(se);return J}function JU(U){return Ie.call(U)}function eq(U,J,se){return J=Fn(J===void 0?U.length-1:J,0),function(){for(var Ne=arguments,mt=-1,Bt=Fn(Ne.length-J,0),tn=Array(Bt);++mt<Bt;)tn[mt]=Ne[J+mt];mt=-1;for(var Ct=Array(J+1);++mt<J;)Ct[mt]=Ne[mt];return Ct[J]=se(tn),ie(U,this,Ct)}}function pv(U,J){if(!(J==="constructor"&&typeof U[J]=="function")&&J!="__proto__")return U[J]}var tq=nq($U);function nq(U){var J=0,se=0;return function(){var Ne=Cc(),mt=i-(Ne-se);if(se=Ne,mt>0){if(++J>=o)return arguments[0]}else J=0;return U.apply(void 0,arguments)}}function rq(U){if(U!=null){try{return Rt.call(U)}catch{}try{return U+""}catch{}}return""}function Zp(U,J){return U===J||U!==U&&J!==J}var mv=HR(function(){return arguments}())?HR:function(U){return jd(U)&&ge.call(U,"callee")&&!mn.call(U,"callee")},gv=Array.isArray;function bv(U){return U!=null&&YR(U.length)&&!yv(U)}function oq(U){return jd(U)&&bv(U)}var GR=uo||cq;function yv(U){if(!Ba(U))return!1;var J=Xp(U);return J==p||J==m||J==c||J==x}function YR(U){return typeof U=="number"&&U>-1&&U%1==0&&U<=s}function Ba(U){var J=typeof U;return U!=null&&(J=="object"||J=="function")}function jd(U){return U!=null&&typeof U=="object"}function iq(U){if(!jd(U)||Xp(U)!=v)return!1;var J=At(U);if(J===null)return!0;var se=ge.call(J,"constructor")&&J.constructor;return typeof se=="function"&&se instanceof se&&Rt.call(se)==ee}var KR=Q?ue(Q):AU;function sq(U){return WU(U,XR(U))}function XR(U){return bv(U)?PU(U):OU(U)}var aq=UU(function(U,J,se){WR(U,J,se)});function lq(U){return function(){return U}}function QR(U){return U}function cq(){return!1}e.exports=aq})(qg,qg.exports);var zG=qg.exports;const Kf=ka(zG),BG={theme:"system",setTheme:()=>null},LA=k.createContext(BG);function VG({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,i]=k.useState(()=>localStorage.getItem(n)||t);k.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),o==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(o)},[o]);const s={theme:o,setTheme:a=>{localStorage.setItem(n,a),i(a)}};return f.jsx(LA.Provider,{...r,value:s,children:e})}const $A=()=>{const e=k.useContext(LA);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};var od=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ll=typeof window>"u"||"Deno"in globalThis;function bo(){}function HG(e,t){return typeof e=="function"?e(t):e}function i1(e){return typeof e=="number"&&e>=0&&e!==1/0}function zA(e,t){return Math.max(e+(t||0)-Date.now(),0)}function nu(e,t){return typeof e=="function"?e(t):e}function Lo(e,t){return typeof e=="function"?e(t):e}function vN(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==pE(s,t.options))return!1}else if(!Qf(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function xN(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Xf(t.options.mutationKey)!==Xf(i))return!1}else if(!Qf(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function pE(e,t){return((t==null?void 0:t.queryKeyHashFn)||Xf)(e)}function Xf(e){return JSON.stringify(e,(t,n)=>a1(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Qf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Qf(e[n],t[n])):!1}function Gg(e,t){if(e===t)return e;const n=wN(e)&&wN(t);if(n||a1(e)&&a1(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let c=0;c<s;c++){const u=n?c:i[c];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(a[u]=void 0,l++):(a[u]=Gg(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function s1(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function wN(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function a1(e){if(!CN(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!CN(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function CN(e){return Object.prototype.toString.call(e)==="[object Object]"}function WG(e){return new Promise(t=>{setTimeout(t,e)})}function l1(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Gg(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return Gg(e,t)}return t}function UG(e){return e}function qG(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function GG(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Yg=Symbol();function BA(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Yg&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Yg?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var fl,Ws,pu,ZT,YG=(ZT=class extends od{constructor(){super();De(this,fl);De(this,Ws);De(this,pu);we(this,pu,t=>{if(!Ll&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){X(this,Ws)||this.setEventListener(X(this,pu))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,Ws))==null||t.call(this),we(this,Ws,void 0))}setEventListener(t){var n;we(this,pu,t),(n=X(this,Ws))==null||n.call(this),we(this,Ws,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){X(this,fl)!==t&&(we(this,fl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof X(this,fl)=="boolean"?X(this,fl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},fl=new WeakMap,Ws=new WeakMap,pu=new WeakMap,ZT),mE=new YG,mu,Us,gu,JT,KG=(JT=class extends od{constructor(){super();De(this,mu,!0);De(this,Us);De(this,gu);we(this,gu,t=>{if(!Ll&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){X(this,Us)||this.setEventListener(X(this,gu))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,Us))==null||t.call(this),we(this,Us,void 0))}setEventListener(t){var n;we(this,gu,t),(n=X(this,Us))==null||n.call(this),we(this,Us,t(this.setOnline.bind(this)))}setOnline(t){X(this,mu)!==t&&(we(this,mu,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return X(this,mu)}},mu=new WeakMap,Us=new WeakMap,gu=new WeakMap,JT),Kg=new KG;function c1(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function XG(e){return Math.min(1e3*2**e,3e4)}function VA(e){return(e??"online")==="online"?Kg.isOnline():!0}var HA=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Mv(e){return e instanceof HA}function WA(e){let t=!1,n=0,r=!1,o;const i=c1(),s=g=>{var b;r||(h(new HA(g)),(b=e.abort)==null||b.call(e))},a=()=>{t=!0},l=()=>{t=!1},c=()=>mE.isFocused()&&(e.networkMode==="always"||Kg.isOnline())&&e.canRun(),u=()=>VA(e.networkMode)&&e.canRun(),d=g=>{var b;r||(r=!0,(b=e.onSuccess)==null||b.call(e,g),o==null||o(),i.resolve(g))},h=g=>{var b;r||(r=!0,(b=e.onError)==null||b.call(e,g),o==null||o(),i.reject(g))},p=()=>new Promise(g=>{var b;o=y=>{(r||c())&&g(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var g;o=void 0,r||(g=e.onContinue)==null||g.call(e)}),m=()=>{if(r)return;let g;const b=n===0?e.initialPromise:void 0;try{g=b??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(d).catch(y=>{var S;if(r)return;const v=e.retry??(Ll?0:3),x=e.retryDelay??XG,E=typeof x=="function"?x(n,y):x,_=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,y);if(t||!_){h(y);return}n++,(S=e.onFail)==null||S.call(e,n,y),WG(E).then(()=>c()?void 0:p()).then(()=>{t?h(y):m()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?m():p().then(m),i)}}function QG(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Sn=QG(),hl,eA,UA=(eA=class{constructor(){De(this,hl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),i1(this.gcTime)&&we(this,hl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ll?1/0:5*60*1e3))}clearGcTimeout(){X(this,hl)&&(clearTimeout(X(this,hl)),we(this,hl,void 0))}},hl=new WeakMap,eA),bu,yu,po,pl,Xn,Vh,ml,Oo,Ki,tA,ZG=(tA=class extends UA{constructor(t){super();De(this,Oo);De(this,bu);De(this,yu);De(this,po);De(this,pl);De(this,Xn);De(this,Vh);De(this,ml);we(this,ml,!1),we(this,Vh,t.defaultOptions),this.setOptions(t.options),this.observers=[],we(this,pl,t.client),we(this,po,X(this,pl).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,we(this,bu,JG(this.options)),this.state=t.state??X(this,bu),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=X(this,Xn))==null?void 0:t.promise}setOptions(t){this.options={...X(this,Vh),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&X(this,po).remove(this)}setData(t,n){const r=l1(this.state.data,t,this.options);return He(this,Oo,Ki).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){He(this,Oo,Ki).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=X(this,Xn))==null?void 0:r.promise;return(o=X(this,Xn))==null||o.cancel(t),n?n.then(bo).catch(bo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(X(this,bu))}isActive(){return this.observers.some(t=>Lo(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Yg||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!zA(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=X(this,Xn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=X(this,Xn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),X(this,po).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(X(this,Xn)&&(X(this,ml)?X(this,Xn).cancel({revert:!0}):X(this,Xn).cancelRetry()),this.scheduleGc()),X(this,po).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||He(this,Oo,Ki).call(this,{type:"invalidate"})}fetch(t,n){var l,c,u;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(X(this,Xn))return X(this,Xn).continueRetry(),X(this,Xn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(h=>h.options.queryFn);d&&this.setOptions(d.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(we(this,ml,!0),r.signal)})},i=()=>{const d=BA(this.options,n),h={client:X(this,pl),queryKey:this.queryKey,meta:this.meta};return o(h),we(this,ml,!1),this.options.persister?this.options.persister(d,h,this):d(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:X(this,pl),state:this.state,fetchFn:i};o(s),(l=this.options.behavior)==null||l.onFetch(s,this),we(this,yu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=s.fetchOptions)==null?void 0:c.meta))&&He(this,Oo,Ki).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta});const a=d=>{var h,p,m,g;Mv(d)&&d.silent||He(this,Oo,Ki).call(this,{type:"error",error:d}),Mv(d)||((p=(h=X(this,po).config).onError)==null||p.call(h,d,this),(g=(m=X(this,po).config).onSettled)==null||g.call(m,this.state.data,d,this)),this.scheduleGc()};return we(this,Xn,WA({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var h,p,m,g;if(d===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(b){a(b);return}(p=(h=X(this,po).config).onSuccess)==null||p.call(h,d,this),(g=(m=X(this,po).config).onSettled)==null||g.call(m,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,h)=>{He(this,Oo,Ki).call(this,{type:"failed",failureCount:d,error:h})},onPause:()=>{He(this,Oo,Ki).call(this,{type:"pause"})},onContinue:()=>{He(this,Oo,Ki).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),X(this,Xn).start()}},bu=new WeakMap,yu=new WeakMap,po=new WeakMap,pl=new WeakMap,Xn=new WeakMap,Vh=new WeakMap,ml=new WeakMap,Oo=new WeakSet,Ki=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...qA(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Mv(o)&&o.revert&&X(this,yu)?{...X(this,yu),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Sn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),X(this,po).notify({query:this,type:"updated",action:t})})},tA);function qA(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:VA(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function JG(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var li,nA,GA=(nA=class extends od{constructor(t={}){super();De(this,li);this.config=t,we(this,li,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??pE(o,n);let s=this.get(i);return s||(s=new ZG({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){X(this,li).has(t.queryHash)||(X(this,li).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=X(this,li).get(t.queryHash);n&&(t.destroy(),n===t&&X(this,li).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Sn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return X(this,li).get(t)}getAll(){return[...X(this,li).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>vN(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>vN(t,r)):n}notify(t){Sn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Sn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Sn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},li=new WeakMap,nA),ci,dr,gl,ui,Fs,rA,eY=(rA=class extends UA{constructor(t){super();De(this,ui);De(this,ci);De(this,dr);De(this,gl);this.mutationId=t.mutationId,we(this,dr,t.mutationCache),we(this,ci,[]),this.state=t.state||tY(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){X(this,ci).includes(t)||(X(this,ci).push(t),this.clearGcTimeout(),X(this,dr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){we(this,ci,X(this,ci).filter(n=>n!==t)),this.scheduleGc(),X(this,dr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){X(this,ci).length||(this.state.status==="pending"?this.scheduleGc():X(this,dr).remove(this))}continue(){var t;return((t=X(this,gl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,c,u,d,h,p,m,g,b,y,v,x,E,_,S,C;we(this,gl,WA({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(R,N)=>{He(this,ui,Fs).call(this,{type:"failed",failureCount:R,error:N})},onPause:()=>{He(this,ui,Fs).call(this,{type:"pause"})},onContinue:()=>{He(this,ui,Fs).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>X(this,dr).canRun(this)}));const n=this.state.status==="pending",r=!X(this,gl).canStart();try{if(!n){He(this,ui,Fs).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=X(this,dr).config).onMutate)==null?void 0:i.call(o,t,this));const N=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));N!==this.state.context&&He(this,ui,Fs).call(this,{type:"pending",context:N,variables:t,isPaused:r})}const R=await X(this,gl).start();return await((c=(l=X(this,dr).config).onSuccess)==null?void 0:c.call(l,R,t,this.state.context,this)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,R,t,this.state.context)),await((p=(h=X(this,dr).config).onSettled)==null?void 0:p.call(h,R,null,this.state.variables,this.state.context,this)),await((g=(m=this.options).onSettled)==null?void 0:g.call(m,R,null,t,this.state.context)),He(this,ui,Fs).call(this,{type:"success",data:R}),R}catch(R){try{throw await((y=(b=X(this,dr).config).onError)==null?void 0:y.call(b,R,t,this.state.context,this)),await((x=(v=this.options).onError)==null?void 0:x.call(v,R,t,this.state.context)),await((_=(E=X(this,dr).config).onSettled)==null?void 0:_.call(E,void 0,R,this.state.variables,this.state.context,this)),await((C=(S=this.options).onSettled)==null?void 0:C.call(S,void 0,R,t,this.state.context)),R}finally{He(this,ui,Fs).call(this,{type:"error",error:R})}}finally{X(this,dr).runNext(this)}}},ci=new WeakMap,dr=new WeakMap,gl=new WeakMap,ui=new WeakSet,Fs=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Sn.batch(()=>{X(this,ci).forEach(r=>{r.onMutationUpdate(t)}),X(this,dr).notify({mutation:this,type:"updated",action:t})})},rA);function tY(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ts,Fo,Hh,oA,nY=(oA=class extends od{constructor(t={}){super();De(this,ts);De(this,Fo);De(this,Hh);this.config=t,we(this,ts,new Set),we(this,Fo,new Map),we(this,Hh,0)}build(t,n,r){const o=new eY({mutationCache:this,mutationId:++Jp(this,Hh)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){X(this,ts).add(t);const n=nm(t);if(typeof n=="string"){const r=X(this,Fo).get(n);r?r.push(t):X(this,Fo).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(X(this,ts).delete(t)){const n=nm(t);if(typeof n=="string"){const r=X(this,Fo).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&X(this,Fo).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=nm(t);if(typeof n=="string"){const r=X(this,Fo).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=nm(t);if(typeof n=="string"){const o=(r=X(this,Fo).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Sn.batch(()=>{X(this,ts).forEach(t=>{this.notify({type:"removed",mutation:t})}),X(this,ts).clear(),X(this,Fo).clear()})}getAll(){return Array.from(X(this,ts))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>xN(n,r))}findAll(t={}){return this.getAll().filter(n=>xN(t,n))}notify(t){Sn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Sn.batch(()=>Promise.all(t.map(n=>n.continue().catch(bo))))}},ts=new WeakMap,Fo=new WeakMap,Hh=new WeakMap,oA);function nm(e){var t;return(t=e.options.scope)==null?void 0:t.id}function SN(e){return{onFetch:(t,n)=>{var u,d,h,p,m;const r=t.options,o=(h=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],s=((m=t.state.data)==null?void 0:m.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let g=!1;const b=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},y=BA(t.options,t.fetchOptions),v=async(x,E,_)=>{if(g)return Promise.reject();if(E==null&&x.pages.length)return Promise.resolve(x);const S={client:t.client,queryKey:t.queryKey,pageParam:E,direction:_?"backward":"forward",meta:t.options.meta};b(S);const C=await y(S),{maxPages:R}=t.options,N=_?GG:qG;return{pages:N(x.pages,C,R),pageParams:N(x.pageParams,E,R)}};if(o&&i.length){const x=o==="backward",E=x?rY:EN,_={pages:i,pageParams:s},S=E(r,_);a=await v(_,S,x)}else{const x=e??i.length;do{const E=l===0?s[0]??r.initialPageParam:EN(r,a);if(l>0&&E==null)break;a=await v(a,E),l++}while(l<x)}return a};t.options.persister?t.fetchFn=()=>{var g,b;return(b=(g=t.options).persister)==null?void 0:b.call(g,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function EN(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function rY(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var ln,qs,Gs,vu,xu,Ys,wu,Cu,iA,oY=(iA=class{constructor(e={}){De(this,ln);De(this,qs);De(this,Gs);De(this,vu);De(this,xu);De(this,Ys);De(this,wu);De(this,Cu);we(this,ln,e.queryCache||new GA),we(this,qs,e.mutationCache||new nY),we(this,Gs,e.defaultOptions||{}),we(this,vu,new Map),we(this,xu,new Map),we(this,Ys,0)}mount(){Jp(this,Ys)._++,X(this,Ys)===1&&(we(this,wu,mE.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,ln).onFocus())})),we(this,Cu,Kg.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,ln).onOnline())})))}unmount(){var e,t;Jp(this,Ys)._--,X(this,Ys)===0&&((e=X(this,wu))==null||e.call(this),we(this,wu,void 0),(t=X(this,Cu))==null||t.call(this),we(this,Cu,void 0))}isFetching(e){return X(this,ln).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return X(this,qs).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=X(this,ln).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=X(this,ln).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(nu(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return X(this,ln).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=X(this,ln).get(r.queryHash),i=o==null?void 0:o.state.data,s=HG(t,i);if(s!==void 0)return X(this,ln).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Sn.batch(()=>X(this,ln).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=X(this,ln).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=X(this,ln);Sn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=X(this,ln);return Sn.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Sn.batch(()=>X(this,ln).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(bo).catch(bo)}invalidateQueries(e,t={}){return Sn.batch(()=>(X(this,ln).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Sn.batch(()=>X(this,ln).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(bo)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(bo)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=X(this,ln).build(this,t);return n.isStaleByTime(nu(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(bo).catch(bo)}fetchInfiniteQuery(e){return e.behavior=SN(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(bo).catch(bo)}ensureInfiniteQueryData(e){return e.behavior=SN(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Kg.isOnline()?X(this,qs).resumePausedMutations():Promise.resolve()}getQueryCache(){return X(this,ln)}getMutationCache(){return X(this,qs)}getDefaultOptions(){return X(this,Gs)}setDefaultOptions(e){we(this,Gs,e)}setQueryDefaults(e,t){X(this,vu).set(Xf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...X(this,vu).values()],n={};return t.forEach(r=>{Qf(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){X(this,xu).set(Xf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...X(this,xu).values()],n={};return t.forEach(r=>{Qf(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...X(this,Gs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=pE(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Yg&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...X(this,Gs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){X(this,ln).clear(),X(this,qs).clear()}},ln=new WeakMap,qs=new WeakMap,Gs=new WeakMap,vu=new WeakMap,xu=new WeakMap,Ys=new WeakMap,wu=new WeakMap,Cu=new WeakMap,iA),Tr,ft,Wh,fr,bl,Su,Ks,di,Uh,Eu,_u,yl,vl,Xs,ku,jt,ef,u1,d1,f1,h1,p1,m1,g1,YA,sA,gE=(sA=class extends od{constructor(t,n){super();De(this,jt);De(this,Tr);De(this,ft);De(this,Wh);De(this,fr);De(this,bl);De(this,Su);De(this,Ks);De(this,di);De(this,Uh);De(this,Eu);De(this,_u);De(this,yl);De(this,vl);De(this,Xs);De(this,ku,new Set);this.options=n,we(this,Tr,t),we(this,di,null),we(this,Ks,c1()),this.options.experimental_prefetchInRender||X(this,Ks).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(X(this,ft).addObserver(this),_N(X(this,ft),this.options)?He(this,jt,ef).call(this):this.updateResult(),He(this,jt,h1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return b1(X(this,ft),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return b1(X(this,ft),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,He(this,jt,p1).call(this),He(this,jt,m1).call(this),X(this,ft).removeObserver(this)}setOptions(t,n){const r=this.options,o=X(this,ft);if(this.options=X(this,Tr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Lo(this.options.enabled,X(this,ft))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");He(this,jt,g1).call(this),X(this,ft).setOptions(this.options),r._defaulted&&!s1(this.options,r)&&X(this,Tr).getQueryCache().notify({type:"observerOptionsUpdated",query:X(this,ft),observer:this});const i=this.hasListeners();i&&kN(X(this,ft),o,this.options,r)&&He(this,jt,ef).call(this),this.updateResult(n),i&&(X(this,ft)!==o||Lo(this.options.enabled,X(this,ft))!==Lo(r.enabled,X(this,ft))||nu(this.options.staleTime,X(this,ft))!==nu(r.staleTime,X(this,ft)))&&He(this,jt,u1).call(this);const s=He(this,jt,d1).call(this);i&&(X(this,ft)!==o||Lo(this.options.enabled,X(this,ft))!==Lo(r.enabled,X(this,ft))||s!==X(this,Xs))&&He(this,jt,f1).call(this,s)}getOptimisticResult(t){const n=X(this,Tr).getQueryCache().build(X(this,Tr),t),r=this.createResult(n,t);return sY(this,r)&&(we(this,fr,r),we(this,Su,this.options),we(this,bl,X(this,ft).state)),r}getCurrentResult(){return X(this,fr)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){X(this,ku).add(t)}getCurrentQuery(){return X(this,ft)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=X(this,Tr).defaultQueryOptions(t),r=X(this,Tr).getQueryCache().build(X(this,Tr),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return He(this,jt,ef).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),X(this,fr)))}createResult(t,n){var R;const r=X(this,ft),o=this.options,i=X(this,fr),s=X(this,bl),a=X(this,Su),c=t!==r?t.state:X(this,Wh),{state:u}=t;let d={...u},h=!1,p;if(n._optimisticResults){const N=this.hasListeners(),D=!N&&_N(t,n),I=N&&kN(t,r,n,o);(D||I)&&(d={...d,...qA(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:b}=d;if(n.select&&d.data!==void 0)if(i&&d.data===(s==null?void 0:s.data)&&n.select===X(this,Uh))p=X(this,Eu);else try{we(this,Uh,n.select),p=n.select(d.data),p=l1(i==null?void 0:i.data,p,n),we(this,Eu,p),we(this,di,null)}catch(N){we(this,di,N)}else p=d.data;if(n.placeholderData!==void 0&&p===void 0&&b==="pending"){let N;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))N=i.data;else if(N=typeof n.placeholderData=="function"?n.placeholderData((R=X(this,_u))==null?void 0:R.state.data,X(this,_u)):n.placeholderData,n.select&&N!==void 0)try{N=n.select(N),we(this,di,null)}catch(D){we(this,di,D)}N!==void 0&&(b="success",p=l1(i==null?void 0:i.data,N,n),h=!0)}X(this,di)&&(m=X(this,di),p=X(this,Eu),g=Date.now(),b="error");const y=d.fetchStatus==="fetching",v=b==="pending",x=b==="error",E=v&&y,_=p!==void 0,C={status:b,fetchStatus:d.fetchStatus,isPending:v,isSuccess:b==="success",isError:x,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:y,isRefetching:y&&!v,isLoadingError:x&&!_,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:x&&_,isStale:bE(t,n),refetch:this.refetch,promise:X(this,Ks)};if(this.options.experimental_prefetchInRender){const N=P=>{C.status==="error"?P.reject(C.error):C.data!==void 0&&P.resolve(C.data)},D=()=>{const P=we(this,Ks,C.promise=c1());N(P)},I=X(this,Ks);switch(I.status){case"pending":t.queryHash===r.queryHash&&N(I);break;case"fulfilled":(C.status==="error"||C.data!==I.value)&&D();break;case"rejected":(C.status!=="error"||C.error!==I.reason)&&D();break}}return C}updateResult(t){const n=X(this,fr),r=this.createResult(X(this,ft),this.options);if(we(this,bl,X(this,ft).state),we(this,Su,this.options),X(this,bl).data!==void 0&&we(this,_u,X(this,ft)),s1(r,n))return;we(this,fr,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!X(this,ku).size)return!0;const l=new Set(a??X(this,ku));return this.options.throwOnError&&l.add("error"),Object.keys(X(this,fr)).some(c=>{const u=c;return X(this,fr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),He(this,jt,YA).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&He(this,jt,h1).call(this)}},Tr=new WeakMap,ft=new WeakMap,Wh=new WeakMap,fr=new WeakMap,bl=new WeakMap,Su=new WeakMap,Ks=new WeakMap,di=new WeakMap,Uh=new WeakMap,Eu=new WeakMap,_u=new WeakMap,yl=new WeakMap,vl=new WeakMap,Xs=new WeakMap,ku=new WeakMap,jt=new WeakSet,ef=function(t){He(this,jt,g1).call(this);let n=X(this,ft).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(bo)),n},u1=function(){He(this,jt,p1).call(this);const t=nu(this.options.staleTime,X(this,ft));if(Ll||X(this,fr).isStale||!i1(t))return;const r=zA(X(this,fr).dataUpdatedAt,t)+1;we(this,yl,setTimeout(()=>{X(this,fr).isStale||this.updateResult()},r))},d1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(X(this,ft)):this.options.refetchInterval)??!1},f1=function(t){He(this,jt,m1).call(this),we(this,Xs,t),!(Ll||Lo(this.options.enabled,X(this,ft))===!1||!i1(X(this,Xs))||X(this,Xs)===0)&&we(this,vl,setInterval(()=>{(this.options.refetchIntervalInBackground||mE.isFocused())&&He(this,jt,ef).call(this)},X(this,Xs)))},h1=function(){He(this,jt,u1).call(this),He(this,jt,f1).call(this,He(this,jt,d1).call(this))},p1=function(){X(this,yl)&&(clearTimeout(X(this,yl)),we(this,yl,void 0))},m1=function(){X(this,vl)&&(clearInterval(X(this,vl)),we(this,vl,void 0))},g1=function(){const t=X(this,Tr).getQueryCache().build(X(this,Tr),this.options);if(t===X(this,ft))return;const n=X(this,ft);we(this,ft,t),we(this,Wh,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},YA=function(t){Sn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(X(this,fr))}),X(this,Tr).getQueryCache().notify({query:X(this,ft),type:"observerResultsUpdated"})})},sA);function iY(e,t){return Lo(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function _N(e,t){return iY(e,t)||e.state.data!==void 0&&b1(e,t,t.refetchOnMount)}function b1(e,t,n){if(Lo(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&bE(e,t)}return!1}function kN(e,t,n,r){return(e!==t||Lo(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&bE(e,n)}function bE(e,t){return Lo(t.enabled,e)!==!1&&e.isStaleByTime(nu(t.staleTime,e))}function sY(e,t){return!s1(e.getCurrentResult(),t)}function RN(e,t){return e.filter(n=>!t.includes(n))}function aY(e,t,n){const r=e.slice(0);return r[t]=n,r}var xl,mo,Ru,Nu,go,Qs,qh,Gh,Yh,qn,y1,v1,x1,w1,C1,aA,lY=(aA=class extends od{constructor(t,n,r){super();De(this,qn);De(this,xl);De(this,mo);De(this,Ru);De(this,Nu);De(this,go);De(this,Qs);De(this,qh);De(this,Gh);De(this,Yh,[]);we(this,xl,t),we(this,Nu,r),we(this,Ru,[]),we(this,go,[]),we(this,mo,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&X(this,go).forEach(t=>{t.subscribe(n=>{He(this,qn,w1).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,X(this,go).forEach(t=>{t.destroy()})}setQueries(t,n,r){if(we(this,Ru,t),we(this,Nu,n),process.env.NODE_ENV!=="production"){const o=t.map(i=>X(this,xl).defaultQueryOptions(i).queryHash);new Set(o).size!==o.length&&console.warn("[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.")}Sn.batch(()=>{const o=X(this,go),i=He(this,qn,x1).call(this,X(this,Ru));we(this,Yh,i),i.forEach(c=>c.observer.setOptions(c.defaultedQueryOptions,r));const s=i.map(c=>c.observer),a=s.map(c=>c.getCurrentResult()),l=s.some((c,u)=>c!==o[u]);o.length===s.length&&!l||(we(this,go,s),we(this,mo,a),this.hasListeners()&&(RN(o,s).forEach(c=>{c.destroy()}),RN(s,o).forEach(c=>{c.subscribe(u=>{He(this,qn,w1).call(this,c,u)})}),He(this,qn,C1).call(this)))})}getCurrentResult(){return X(this,mo)}getQueries(){return X(this,go).map(t=>t.getCurrentQuery())}getObservers(){return X(this,go)}getOptimisticResult(t,n){const r=He(this,qn,x1).call(this,t),o=r.map(i=>i.observer.getOptimisticResult(i.defaultedQueryOptions));return[o,i=>He(this,qn,v1).call(this,i??o,n),()=>He(this,qn,y1).call(this,o,r)]}},xl=new WeakMap,mo=new WeakMap,Ru=new WeakMap,Nu=new WeakMap,go=new WeakMap,Qs=new WeakMap,qh=new WeakMap,Gh=new WeakMap,Yh=new WeakMap,qn=new WeakSet,y1=function(t,n){return n.map((r,o)=>{const i=t[o];return r.defaultedQueryOptions.notifyOnChangeProps?i:r.observer.trackResult(i,s=>{n.forEach(a=>{a.observer.trackProp(s)})})})},v1=function(t,n){return n?((!X(this,Qs)||X(this,mo)!==X(this,Gh)||n!==X(this,qh))&&(we(this,qh,n),we(this,Gh,X(this,mo)),we(this,Qs,Gg(X(this,Qs),n(t)))),X(this,Qs)):t},x1=function(t){const n=new Map(X(this,go).map(o=>[o.options.queryHash,o])),r=[];return t.forEach(o=>{const i=X(this,xl).defaultQueryOptions(o),s=n.get(i.queryHash);s?r.push({defaultedQueryOptions:i,observer:s}):r.push({defaultedQueryOptions:i,observer:new gE(X(this,xl),i)})}),r},w1=function(t,n){const r=X(this,go).indexOf(t);r!==-1&&(we(this,mo,aY(X(this,mo),r,n)),He(this,qn,C1).call(this))},C1=function(){var t;if(this.hasListeners()){const n=X(this,Qs),r=He(this,qn,y1).call(this,X(this,mo),X(this,Yh)),o=He(this,qn,v1).call(this,r,(t=X(this,Nu))==null?void 0:t.combine);n!==o&&Sn.batch(()=>{this.listeners.forEach(i=>{i(X(this,mo))})})}},aA),yE=w.createContext(void 0),ic=e=>{const t=w.useContext(yE);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},cY=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(yE.Provider,{value:e,children:t})),KA=w.createContext(!1),XA=()=>w.useContext(KA);KA.Provider;function uY(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var dY=w.createContext(uY()),QA=()=>w.useContext(dY);function fY(e,t){return typeof e=="function"?e(...t):!!e}function S1(){}var ZA=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},JA=e=>{w.useEffect(()=>{e.clearReset()},[e])},eO=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||fY(n,[e.error,r])),tO=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},nO=(e,t)=>e.isLoading&&e.isFetching&&!t,E1=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Xg=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function hY({queries:e,...t},n){const r=ic(),o=XA(),i=QA(),s=w.useMemo(()=>e.map(g=>{const b=r.defaultQueryOptions(g);return b._optimisticResults=o?"isRestoring":"optimistic",b}),[e,r,o]);s.forEach(g=>{tO(g),ZA(g,i)}),JA(i);const[a]=w.useState(()=>new lY(r,s,t)),[l,c,u]=a.getOptimisticResult(s,t.combine),d=!o&&t.subscribed!==!1;w.useSyncExternalStore(w.useCallback(g=>d?a.subscribe(Sn.batchCalls(g)):S1,[a,d]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),w.useEffect(()=>{a.setQueries(s,t,{listeners:!1})},[s,t,a]);const p=l.some((g,b)=>E1(s[b],g))?l.flatMap((g,b)=>{const y=s[b];if(y){const v=new gE(r,y);if(E1(y,g))return Xg(y,v,i);nO(g,o)&&Xg(y,v,i)}return[]}):[];if(p.length>0)throw Promise.all(p);const m=l.find((g,b)=>{const y=s[b];return y&&eO({result:g,errorResetBoundary:i,throwOnError:y.throwOnError,query:r.getQueryCache().get(y.queryHash),suspense:y.suspense})});if(m!=null&&m.error)throw m.error;return c(u())}function pY(e,t,n){var d,h,p,m,g;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=ic(),o=XA(),i=QA(),s=r.defaultQueryOptions(e);(h=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=o?"isRestoring":"optimistic",tO(s),ZA(s,i),JA(i);const a=!r.getQueryCache().get(s.queryHash),[l]=w.useState(()=>new t(r,s)),c=l.getOptimisticResult(s),u=!o&&e.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(b=>{const y=u?l.subscribe(Sn.batchCalls(b)):S1;return l.updateResult(),y},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),w.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),E1(s,c))throw Xg(s,l,i);if(eO({result:c,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw c.error;if((m=(p=r.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||m.call(p,s,c),s.experimental_prefetchInRender&&!Ll&&nO(c,o)){const b=a?Xg(s,l,i):(g=r.getQueryCache().get(s.queryHash))==null?void 0:g.promise;b==null||b.catch(S1).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?c:l.trackResult(c)}function Tn(e,t){return pY(e,gE)}function mY(){const e=k.useContext(yE);if(e&&e.isSemaphorClient)return e}function rO({children:e}){const{setIsSessionExpired:t}=on(),n=mY(),[r]=k.useState(()=>{const o=new oY({queryCache:new GA({onError:i=>{i instanceof Error?(console.error(`Something went wrong: ${i.message}`),i.message==="invalid token"&&t(!0)):console.error("Something went wrong:",i)}}),defaultOptions:{queries:{gcTime:36e5,staleTime:3e5,refetchOnWindowFocus:!1,retry:1}}});return o.isSemaphorClient=!0,o});return n?f.jsx(f.Fragment,{children:e}):f.jsx(cY,{client:r,children:e})}const Jo=k.forwardRef(({children:e,className:t,...n},r)=>f.jsx("div",{className:oe("semaphor-scope",t),ref:r,...n,children:e})),gY={id:"",authToken:void 0,tokenProps:{}},vE=k.createContext(gY),oO=({children:e,dashboardProps:t})=>{const n=k.useMemo(()=>{let r={};const o=t.authToken;return o&&(r=Kh(o.accessToken)),{...t,tokenProps:r}},[t]);return f.jsx(rO,{children:f.jsx(vE.Provider,{value:n,children:f.jsx(Jo,{style:{height:"100%"},children:e})})})};function ar(){const e=k.useContext(vE);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function bY(){const{authToken:e,version:t}=ar(),n=re(l=>l.selectedLensId);function r(){if(!(e!=null&&e.accessToken))return!1}const{data:o,isLoading:i,isFetching:s,isError:a}=Tn({queryKey:["dashboard",n,e==null?void 0:e.accessToken],queryFn:()=>LG(e==null?void 0:e.accessToken,{lensId:n,version:t}),enabled:r()});return{data:o,isLoading:i,isFetching:s,isError:a}}function yY(){const{authToken:e}=ar(),t=re(r=>r.authToken),{setAuthToken:n}=on();return k.useEffect(()=>{e&&(e==null?void 0:e.toString())!==(t==null?void 0:t.toString())&&n(e)},[e,t,n]),e}const iO=(e,t)=>{const n={};if(e===null||t===null)return t;const r=new Set([...Object.keys(e),...Object.keys(t)]);for(const o of r){if(!(o in e)&&o in t){n[o]=t[o];continue}if(o in e&&!(o in t)){n[o]=void 0;continue}const i=e[o],s=t[o];if(!_1(i,s))if(Array.isArray(i)&&Array.isArray(s))n[o]=s;else if(NN(i)&&NN(s)){const a=iO(i,s);Object.keys(a).length>0&&(n[o]=a)}else n[o]=s}return n},_1=(e,t)=>{if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,i)=>_1(o,t[i]));const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(o=>_1(e[o],t[o]))}return!1},NN=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Zf=e=>{if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(n=>Zf(n));const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=Zf(e[n]));return t};function sO(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function DN(e,t){const n=sO(e);return n==="dark"?Kf({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function vY({customStyle:e,currentTheme:t,onSave:n,onEvent:r,defaultFilterValues:o,selectedSheetId:i,onFilterValuesChange:s}){const{authToken:a}=ar();yY();const l=re(O=>O.selectedLensId),{data:c,isLoading:u,isFetching:d,isError:h}=bY(),[p,m]=k.useState(o||[]),{theme:g,setTheme:b}=$A(),y=re(O=>O.dashboard.globalStyle),{setDashboard:v,setDashboardWithFilterValues:x,setSelectedSheetId:E,setStyle:_,setOnSaveFunction:S,setLenses:C,setSelectedLensId:R,setInitStore:N}=on();re(O=>O.actions.setCustomCards);const D=re(O=>O.actions.setFilterValues),I=re(O=>O.filterValues),P=re(O=>O.actions.setThemeStyle),A=re(O=>O.actions.setDashboardTheme),F=re(O=>O.actions.setOnEvent);k.useEffect(()=>{a&&N()},[a,N]),k.useEffect(()=>{if(g){const O=sO(g);A(O)}},[g,A]),k.useEffect(()=>{t&&b(t)},[t,b]);const T=k.useCallback(()=>{const O=Zf(Ug),$=Kf(O,y);if(e){const V=Kf($,e),z=DN(g,V);P(z),_(V)}else{const V=DN(g,$);P(V),_(Ug)}},[g,e,y,P,_]);return k.useEffect(()=>{c&&c.dashboard&&T()},[g,e,y,T,c]),k.useEffect(()=>{var L,M;function O(H,B){const G=H.filters||[],q=[];for(const Y of B){const K=G.find(Z=>Z.id===Y.filterId);K&&q.push({filterId:Y.filterId,connectionType:K.database==="NA"?"api":"database",name:K.column,operation:K.operation,valueType:tu(K),values:Y.values})}return q}if(!c||!c.dashboard)return;const{dashboard:$,filterValues:V,defaultLensId:z,lenses:j}=c;function W(){var B;if(V&&(V==null?void 0:V.length)>0)return V;const H=O($,p||[]);return H&&(H==null?void 0:H.length)>0?H:$.defaultFilterValues&&((B=$.defaultFilterValues)==null?void 0:B.length)>0?$.defaultFilterValues:[]}x($,W()),j&&C(j),z&&R(z),E(i||((M=(L=$==null?void 0:$.sheets)==null?void 0:L[0])==null?void 0:M.id)||null)},[c,v,E,D,l,C,x,R,p,i]),k.useEffect(()=>{s&&I&&s(I)},[I,s]),k.useEffect(()=>{n&&S(n),r&&F(r)},[n,S,r,F]),{isFetching:d,isLoading:u,isError:h}}function ps({className:e,...t}){return f.jsx("div",{className:oe("animate-pulse rounded-md bg-muted",e),...t})}const Qg=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:oe("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Qg.displayName="Card";const Iu=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:oe("flex flex-col space-y-1.5 p-6",e),...t}));Iu.displayName="CardHeader";const ua=w.forwardRef(({className:e,...t},n)=>f.jsx("h3",{ref:n,className:oe("text-2xl font-semibold leading-none tracking-tight",e),...t}));ua.displayName="CardTitle";const xE=w.forwardRef(({className:e,...t},n)=>f.jsx("p",{ref:n,className:oe("text-sm text-muted-foreground",e),...t}));xE.displayName="CardDescription";const Jf=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:oe("px-6 pt-0",e),...t}));Jf.displayName="CardContent";const aO=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:oe("flex items-center p-6 pt-0",e),...t}));aO.displayName="CardFooter";function lO({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:d,showAssistant:h,defaultFilterValues:p,onFilterValuesChange:m,selectedSheetId:g,eventHandlers:b,...y}){const{placeholders:v}=ar(),x=re(C=>C.themeStyle),E=re(C=>C.isSessionExpired),{isLoading:_,isError:S}=vY({customStyle:t,currentTheme:c,onSave:n,onEvent:r,defaultFilterValues:p,onFilterValuesChange:m,selectedSheetId:g});return _||!l?(r==null||r({type:"info",message:"Loading dashboard"}),o?f.jsx(o,{message:"loading"}):f.jsx("div",{className:"flex items-center gap-3",children:f.jsx(ps,{className:"h-1 w-full dark:h-[2px]"})})):S?(r==null||r({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),f.jsx(i,{})):f.jsx("div",{children:"Error"})):E?(r==null||r({type:"error",message:"Session Expired"}),v!=null&&v.SessionExpired?f.jsx("div",{className:"flex h-full items-center justify-center",children:f.jsx("div",{children:v.SessionExpired})}):f.jsx("div",{className:"flex h-full items-center justify-center",children:f.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[f.jsx(ua,{children:"Session Expired"}),f.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):f.jsx("div",{className:oe("isolate flex h-full flex-col justify-between",x==null?void 0:x.dashboardPanel,e),style:{},"data-role":"dashboard-panel",...y})}function fe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function xY(e,t){const n=w.createContext(t),r=i=>{const{children:s,...a}=i,l=w.useMemo(()=>a,Object.values(a));return f.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=w.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function Mn(e,t=[]){let n=[];function r(i,s){const a=w.createContext(s),l=n.length;n=[...n,s];const c=d=>{var y;const{scope:h,children:p,...m}=d,g=((y=h==null?void 0:h[e])==null?void 0:y[l])||a,b=w.useMemo(()=>m,Object.values(m));return f.jsx(g.Provider,{value:b,children:p})};c.displayName=i+"Provider";function u(d,h){var g;const p=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,m=w.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>w.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,wY(o,...t)]}function wY(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function MN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wr(...e){return t=>{let n=!1;const r=e.map(o=>{const i=MN(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():MN(e[o],null)}}}}function Ve(...e){return w.useCallback(wr(...e),e)}var k1=w.forwardRef((e,t)=>{const{children:n,...r}=e,o=w.Children.toArray(n),i=o.find(SY);if(i){const s=i.props.children,a=o.map(l=>l===i?w.Children.count(s)>1?w.Children.only(null):w.isValidElement(s)?s.props.children:null:l);return f.jsx(R1,{...r,ref:t,children:w.isValidElement(s)?w.cloneElement(s,void 0,a):null})}return f.jsx(R1,{...r,ref:t,children:n})});k1.displayName="Slot";var R1=w.forwardRef((e,t)=>{const{children:n,...r}=e;if(w.isValidElement(n)){const o=_Y(n),i=EY(r,n.props);return n.type!==w.Fragment&&(i.ref=t?wr(t,o):o),w.cloneElement(n,i)}return w.Children.count(n)>1?w.Children.only(null):null});R1.displayName="SlotClone";var CY=({children:e})=>f.jsx(f.Fragment,{children:e});function SY(e){return w.isValidElement(e)&&e.type===CY}function EY(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function _Y(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function x0(e){const t=e+"CollectionProvider",[n,r]=Mn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:m,children:g}=p,b=k.useRef(null),y=k.useRef(new Map).current;return f.jsx(o,{scope:m,itemMap:y,collectionRef:b,children:g})};s.displayName=t;const a=e+"CollectionSlot",l=k.forwardRef((p,m)=>{const{scope:g,children:b}=p,y=i(a,g),v=Ve(m,y.collectionRef);return f.jsx(k1,{ref:v,children:b})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=k.forwardRef((p,m)=>{const{scope:g,children:b,...y}=p,v=k.useRef(null),x=Ve(m,v),E=i(c,g);return k.useEffect(()=>(E.itemMap.set(v,{ref:v,...y}),()=>void E.itemMap.delete(v))),f.jsx(k1,{[u]:"",ref:x,children:b})});d.displayName=c;function h(p){const m=i(e+"CollectionConsumer",p);return k.useCallback(()=>{const b=m.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((E,_)=>y.indexOf(E.ref.current)-y.indexOf(_.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:d},h,r]}var Hn=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},kY=w.useId||(()=>{}),RY=0;function _n(e){const[t,n]=w.useState(kY());return Hn(()=>{n(r=>r??String(RY++))},[e]),t?`radix-${t}`:""}var cO=w.forwardRef((e,t)=>{const{children:n,...r}=e,o=w.Children.toArray(n),i=o.find(DY);if(i){const s=i.props.children,a=o.map(l=>l===i?w.Children.count(s)>1?w.Children.only(null):w.isValidElement(s)?s.props.children:null:l);return f.jsx(N1,{...r,ref:t,children:w.isValidElement(s)?w.cloneElement(s,void 0,a):null})}return f.jsx(N1,{...r,ref:t,children:n})});cO.displayName="Slot";var N1=w.forwardRef((e,t)=>{const{children:n,...r}=e;if(w.isValidElement(n)){const o=PY(n),i=MY(r,n.props);return n.type!==w.Fragment&&(i.ref=t?wr(t,o):o),w.cloneElement(n,i)}return w.Children.count(n)>1?w.Children.only(null):null});N1.displayName="SlotClone";var NY=({children:e})=>f.jsx(f.Fragment,{children:e});function DY(e){return w.isValidElement(e)&&e.type===NY}function MY(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function PY(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var IY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_e=IY.reduce((e,t)=>{const n=w.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?cO:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function uO(e,t){e&&ys.flushSync(()=>e.dispatchEvent(t))}function Dn(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ir({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=jY({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Dn(n),l=w.useCallback(c=>{if(i){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else o(c)},[i,e,o,a]);return[s,l]}function jY({defaultProp:e,onChange:t}){const n=w.useState(e),[r]=n,o=w.useRef(r),i=Dn(t);return w.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var TY=w.createContext(void 0);function sc(e){const t=w.useContext(TY);return e||t||"ltr"}var Pv="rovingFocusGroup.onEntryFocus",AY={bubbles:!1,cancelable:!0},w0="RovingFocusGroup",[D1,dO,OY]=x0(w0),[FY,id]=Mn(w0,[OY]),[LY,$Y]=FY(w0),fO=w.forwardRef((e,t)=>f.jsx(D1.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(D1.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(zY,{...e,ref:t})})}));fO.displayName=w0;var zY=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=w.useRef(null),p=Ve(t,h),m=sc(i),[g=null,b]=ir({prop:s,defaultProp:a,onChange:l}),[y,v]=w.useState(!1),x=Dn(c),E=dO(n),_=w.useRef(!1),[S,C]=w.useState(0);return w.useEffect(()=>{const R=h.current;if(R)return R.addEventListener(Pv,x),()=>R.removeEventListener(Pv,x)},[x]),f.jsx(LY,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:g,onItemFocus:w.useCallback(R=>b(R),[b]),onItemShiftTab:w.useCallback(()=>v(!0),[]),onFocusableItemAdd:w.useCallback(()=>C(R=>R+1),[]),onFocusableItemRemove:w.useCallback(()=>C(R=>R-1),[]),children:f.jsx(_e.div,{tabIndex:y||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:fe(e.onMouseDown,()=>{_.current=!0}),onFocus:fe(e.onFocus,R=>{const N=!_.current;if(R.target===R.currentTarget&&N&&!y){const D=new CustomEvent(Pv,AY);if(R.currentTarget.dispatchEvent(D),!D.defaultPrevented){const I=E().filter(O=>O.focusable),P=I.find(O=>O.active),A=I.find(O=>O.id===g),T=[P,A,...I].filter(Boolean).map(O=>O.ref.current);mO(T,u)}}_.current=!1}),onBlur:fe(e.onBlur,()=>v(!1))})})}),hO="RovingFocusGroupItem",pO=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=_n(),l=i||a,c=$Y(hO,n),u=c.currentTabStopId===l,d=dO(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=c;return w.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),f.jsx(D1.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:f.jsx(_e.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:fe(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:fe(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:fe(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const g=HY(m,c.orientation,c.dir);if(g!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let y=d().filter(v=>v.focusable).map(v=>v.ref.current);if(g==="last")y.reverse();else if(g==="prev"||g==="next"){g==="prev"&&y.reverse();const v=y.indexOf(m.currentTarget);y=c.loop?WY(y,v+1):y.slice(v+1)}setTimeout(()=>mO(y))}})})})});pO.displayName=hO;var BY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function VY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function HY(e,t,n){const r=VY(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return BY[r]}function mO(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function WY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var wE=fO,CE=pO;function UY(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var fn=e=>{const{present:t,children:n}=e,r=qY(t),o=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Ve(r.ref,GY(o));return typeof n=="function"||r.isPresent?w.cloneElement(o,{ref:i}):null};fn.displayName="Presence";function qY(e){const[t,n]=w.useState(),r=w.useRef({}),o=w.useRef(e),i=w.useRef("none"),s=e?"mounted":"unmounted",[a,l]=UY(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const c=rm(r.current);i.current=a==="mounted"?c:"none"},[a]),Hn(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,p=rm(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Hn(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const g=rm(r.current).includes(p.animationName);if(p.target===t&&g&&(l("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(i.current=rm(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function rm(e){return(e==null?void 0:e.animationName)||"none"}function GY(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var SE="Tabs",[YY,Y4e]=Mn(SE,[id]),gO=id(),[KY,EE]=YY(SE),bO=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=sc(a),[d,h]=ir({prop:r,onChange:o,defaultProp:i});return f.jsx(KY,{scope:n,baseId:_n(),value:d,onValueChange:h,orientation:s,dir:u,activationMode:l,children:f.jsx(_e.div,{dir:u,"data-orientation":s,...c,ref:t})})});bO.displayName=SE;var yO="TabsList",vO=w.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=EE(yO,n),s=gO(n);return f.jsx(wE,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:f.jsx(_e.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});vO.displayName=yO;var xO="TabsTrigger",wO=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=EE(xO,n),a=gO(n),l=EO(s.baseId,r),c=_O(s.baseId,r),u=r===s.value;return f.jsx(CE,{asChild:!0,...a,focusable:!o,active:u,children:f.jsx(_e.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:fe(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:fe(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:fe(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!o&&d&&s.onValueChange(r)})})})});wO.displayName=xO;var CO="TabsContent",SO=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=EE(CO,n),l=EO(a.baseId,r),c=_O(a.baseId,r),u=r===a.value,d=w.useRef(u);return w.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),f.jsx(fn,{present:o||u,children:({present:h})=>f.jsx(_e.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&i})})});SO.displayName=CO;function EO(e,t){return`${e}-trigger-${t}`}function _O(e,t){return`${e}-content-${t}`}var XY=bO,kO=vO,RO=wO,NO=SO;const sd=XY,ac=w.forwardRef(({className:e,...t},n)=>f.jsx(kO,{ref:n,className:oe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ac.displayName=kO.displayName;const to=w.forwardRef(({className:e,...t},n)=>f.jsx(RO,{ref:n,className:oe("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));to.displayName=RO.displayName;const gi=w.forwardRef(({className:e,...t},n)=>f.jsx(NO,{ref:n,className:oe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));gi.displayName=NO.displayName;var DO={exports:{}},Qh={},M1={exports:{}};(function(e,t){(function(n,r){r(t)})(as,function(n){function r(Y){return function(Z,ne,Q,ie,te,ue,de){return Y(Z,ne,de)}}function o(Y){return function(Z,ne,Q,ie){if(!Z||!ne||typeof Z!="object"||typeof ne!="object")return Y(Z,ne,Q,ie);var te=ie.get(Z),ue=ie.get(ne);if(te&&ue)return te===ne&&ue===Z;ie.set(Z,ne),ie.set(ne,Z);var de=Y(Z,ne,Q,ie);return ie.delete(Z),ie.delete(ne),de}}function i(Y,K){var Z={};for(var ne in Y)Z[ne]=Y[ne];for(var ne in K)Z[ne]=K[ne];return Z}function s(Y){return Y.constructor===Object||Y.constructor==null}function a(Y){return typeof Y.then=="function"}function l(Y,K){return Y===K||Y!==Y&&K!==K}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",h="[object RegExp]",p="[object Map]",m="[object Number]",g="[object Object]",b="[object Set]",y="[object String]",v=Object.prototype.toString;function x(Y){var K=Y.areArraysEqual,Z=Y.areDatesEqual,ne=Y.areMapsEqual,Q=Y.areObjectsEqual,ie=Y.areRegExpsEqual,te=Y.areSetsEqual,ue=Y.createIsNestedEqual,de=ue(Re);function Re(xe,Se,Pe){if(xe===Se)return!0;if(!xe||!Se||typeof xe!="object"||typeof Se!="object")return xe!==xe&&Se!==Se;if(s(xe)&&s(Se))return Q(xe,Se,de,Pe);var Ye=Array.isArray(xe),Rt=Array.isArray(Se);if(Ye||Rt)return Ye===Rt&&K(xe,Se,de,Pe);var ge=v.call(xe);return ge!==v.call(Se)?!1:ge===d?Z(xe,Se,de,Pe):ge===h?ie(xe,Se,de,Pe):ge===p?ne(xe,Se,de,Pe):ge===b?te(xe,Se,de,Pe):ge===g||ge===c?a(xe)||a(Se)?!1:Q(xe,Se,de,Pe):ge===u||ge===m||ge===y?l(xe.valueOf(),Se.valueOf()):!1}return Re}function E(Y,K,Z,ne){var Q=Y.length;if(K.length!==Q)return!1;for(;Q-- >0;)if(!Z(Y[Q],K[Q],Q,Q,Y,K,ne))return!1;return!0}var _=o(E);function S(Y,K){return l(Y.valueOf(),K.valueOf())}function C(Y,K,Z,ne){var Q=Y.size===K.size;if(!Q)return!1;if(!Y.size)return!0;var ie={},te=0;return Y.forEach(function(ue,de){if(Q){var Re=!1,xe=0;K.forEach(function(Se,Pe){!Re&&!ie[xe]&&(Re=Z(de,Pe,te,xe,Y,K,ne)&&Z(ue,Se,de,Pe,Y,K,ne))&&(ie[xe]=!0),xe++}),te++,Q=Re}}),Q}var R=o(C),N="_owner",D=Object.prototype.hasOwnProperty;function I(Y,K,Z,ne){var Q=Object.keys(Y),ie=Q.length;if(Object.keys(K).length!==ie)return!1;for(var te;ie-- >0;){if(te=Q[ie],te===N){var ue=!!Y.$$typeof,de=!!K.$$typeof;if((ue||de)&&ue!==de)return!1}if(!D.call(K,te)||!Z(Y[te],K[te],te,te,Y,K,ne))return!1}return!0}var P=o(I);function A(Y,K){return Y.source===K.source&&Y.flags===K.flags}function F(Y,K,Z,ne){var Q=Y.size===K.size;if(!Q)return!1;if(!Y.size)return!0;var ie={};return Y.forEach(function(te,ue){if(Q){var de=!1,Re=0;K.forEach(function(xe,Se){!de&&!ie[Re]&&(de=Z(te,xe,ue,Se,Y,K,ne))&&(ie[Re]=!0),Re++}),Q=de}}),Q}var T=o(F),O=Object.freeze({areArraysEqual:E,areDatesEqual:S,areMapsEqual:C,areObjectsEqual:I,areRegExpsEqual:A,areSetsEqual:F,createIsNestedEqual:r}),$=Object.freeze({areArraysEqual:_,areDatesEqual:S,areMapsEqual:R,areObjectsEqual:P,areRegExpsEqual:A,areSetsEqual:T,createIsNestedEqual:r}),V=x(O);function z(Y,K){return V(Y,K,void 0)}var j=x(i(O,{createIsNestedEqual:function(){return l}}));function W(Y,K){return j(Y,K,void 0)}var L=x($);function M(Y,K){return L(Y,K,new WeakMap)}var H=x(i($,{createIsNestedEqual:function(){return l}}));function B(Y,K){return H(Y,K,new WeakMap)}function G(Y){return x(i(O,Y(O)))}function q(Y){var K=x(i($,Y($)));return function(Z,ne,Q){return Q===void 0&&(Q=new WeakMap),K(Z,ne,Q)}}n.circularDeepEqual=M,n.circularShallowEqual=B,n.createCustomCircularEqual=q,n.createCustomEqual=G,n.deepEqual=z,n.sameValueZeroEqual=l,n.shallowEqual=W,Object.defineProperty(n,"__esModule",{value:!0})})})(M1,M1.exports);var _E=M1.exports;const kE=nE(fq);var lt={},QY=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(lt,"__esModule",{value:!0});lt.bottom=RE;lt.childrenEqual=tK;lt.cloneLayout=MO;lt.cloneLayoutItem=wl;lt.collides=C0;lt.compact=IO;lt.compactItem=jO;lt.compactType=pK;lt.correctBounds=TO;lt.fastPositionEqual=nK;lt.fastRGLPropsEqual=void 0;lt.getAllCollisions=AO;lt.getFirstCollision=il;lt.getLayoutItem=NE;lt.getStatics=DE;lt.modifyLayout=PO;lt.moveElement=nf;lt.moveElementAwayFromCollision=I1;lt.noop=void 0;lt.perc=oK;lt.resizeItemInDirection=uK;lt.setTopLeft=fK;lt.setTransform=dK;lt.sortLayoutItems=AE;lt.sortLayoutItemsByColRow=zO;lt.sortLayoutItemsByRowCol=$O;lt.synchronizeLayoutWithChildren=hK;lt.validateLayout=BO;lt.withLayoutItem=eK;var PN=_E,tf=ZY(k);function ZY(e){return e&&e.__esModule?e:{default:e}}const JY=process.env.NODE_ENV==="production";function RE(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function MO(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=wl(e[n]);return t}function PO(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function eK(e,t,n){let r=NE(e,t);return r?(r=n(wl(r)),e=PO(e,r),[e,r]):[e,null]}function wl(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function tK(e,t){return(0,PN.deepEqual)(tf.default.Children.map(e,n=>n==null?void 0:n.key),tf.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,PN.deepEqual)(tf.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),tf.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}lt.fastRGLPropsEqual=QY;function nK(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function C0(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function IO(e,t,n,r){const o=DE(e),i=AE(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let c=wl(i[a]);c.static||(c=jO(o,c,t,n,i,r),o.push(c)),s[e.indexOf(i[a])]=c,c.moved=!1}return s}const rK={x:"w",y:"h"};function P1(e,t,n,r){const o=rK[r];t[r]+=1;const i=e.map(s=>s.i).indexOf(t.i);for(let s=i+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;C0(t,a)&&P1(e,a,n+t[o],r)}}t[r]=n}function jO(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(RE(e),t.y);t.y>0&&!il(e,t);)t.y--;else if(a)for(;t.x>0&&!il(e,t);)t.x--;let l;for(;(l=il(e,t))&&!(n===null&&i);)if(a?P1(o,t,l.x+l.w,"x"):P1(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!il(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function TO(e,t){const n=DE(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;il(n,i);)i.y++}return e}function NE(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function il(e,t){for(let n=0,r=e.length;n<r;n++)if(C0(e[n],t))return e[n]}function AO(e,t){return e.filter(n=>C0(n,t))}function DE(e){return e.filter(t=>t.static)}function nf(e,t,n,r,o,i,s,a,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${t.y}`;const c=t.x,u=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let d=AE(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(d=d.reverse());const p=AO(d,t),m=p.length>0;if(m&&l)return MO(e);if(m&&i)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let g=0,b=p.length;g<b;g++){const y=p[g];`${t.i}${t.x}${t.y}${y.i}${y.x}${y.y}`,!y.moved&&(y.static?e=I1(e,y,t,o,s):e=I1(e,t,y,o,s))}return e}function I1(e,t,n,r,o,i){const s=o==="horizontal",a=o==="vertical",l=t.static;if(r){r=!1;const d={x:s?Math.max(t.x-n.w,0):n.x,y:a?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},h=il(e,d),p=h&&h.y+h.h>t.y,m=h&&t.x+t.w>h.x;if(h){if(p&&a)return nf(e,n,void 0,t.y+1,r,l,o);if(p&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(m&&s)return nf(e,t,n.x,void 0,r,l,o)}else return`${n.i}${d.x}${d.y}`,nf(e,n,s?d.x:void 0,a?d.y:void 0,r,l,o)}const c=s?n.x+1:void 0,u=a?n.y+1:void 0;return c==null&&u==null?e:nf(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function oK(e){return e*100+"%"}const OO=(e,t,n,r)=>e+n>r?t:n,FO=(e,t,n)=>e<0?t:n,LO=e=>Math.max(0,e),ME=e=>Math.max(0,e),PE=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:FO(s,e.height,o),top:ME(s)}},IE=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:OO(e.left,e.width,s,n),left:LO(o)}},jE=(e,t,n)=>{let{top:r,height:o,width:i}=t;const s=e.left-(i-e.width);return{height:o,width:s<0?e.width:OO(e.left,e.width,i,n),top:ME(r),left:LO(s)}},TE=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:FO(r,e.height,i),top:ME(r)}},iK=function(){return PE(arguments.length<=0?void 0:arguments[0],IE(...arguments))},sK=function(){return PE(arguments.length<=0?void 0:arguments[0],jE(...arguments))},aK=function(){return TE(arguments.length<=0?void 0:arguments[0],IE(...arguments))},lK=function(){return TE(arguments.length<=0?void 0:arguments[0],jE(...arguments))},cK={n:PE,ne:iK,e:IE,se:aK,s:TE,sw:lK,w:jE,nw:sK};function uK(e,t,n,r){const o=cK[e];return o?o(t,{...t,...n},r):n}function dK(e){let{top:t,left:n,width:r,height:o}=e;const i=`translate(${n}px,${t}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function fK(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function AE(e,t){return t==="horizontal"?zO(e):t==="vertical"?$O(e):e}function $O(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function zO(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function hK(e,t,n,r,o){e=e||[];const i=[];tf.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=NE(e,String(a.key)),c=a.props["data-grid"];l&&c==null?i.push(wl(l)):c?(JY||BO([c],"ReactGridLayout.children"),i.push(wl({...c,i:a.key}))):i.push(wl({w:1,h:1,x:0,y:RE(i),i:String(a.key)}))});const s=TO(i,{cols:n});return o?s:IO(s,r,n)}function BO(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let s=0;s<n.length;s++){const a=n[s],l=i[a];if(typeof l!="number"||Number.isNaN(l))throw new Error(`ReactGridLayout: ${t}[${r}].${a} must be a number! Received: ${l} (${typeof l})`)}if(typeof i.i<"u"&&typeof i.i!="string")throw new Error(`ReactGridLayout: ${t}[${r}].i must be a string! Received: ${i.i} (${typeof i.i})`)}}function pK(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const mK=()=>{};lt.noop=mK;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.calcGridColWidth=S0;Ti.calcGridItemPosition=gK;Ti.calcGridItemWHPx=j1;Ti.calcWH=yK;Ti.calcXY=bK;Ti.clamp=sl;function S0(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function j1(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function gK(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,c=S0(e),u={};return i&&i.resizing?(u.width=Math.round(i.resizing.width),u.height=Math.round(i.resizing.height)):(u.width=j1(r,c,s[0]),u.height=j1(o,l,s[1])),i&&i.dragging?(u.top=Math.round(i.dragging.top),u.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(u.top=Math.round(i.resizing.top),u.left=Math.round(i.resizing.left)):(u.top=Math.round((l+s[1])*n+a[1]),u.left=Math.round((c+s[0])*t+a[0])),u}function bK(e,t,n,r,o){const{margin:i,containerPadding:s,cols:a,rowHeight:l,maxRows:c}=e,u=S0(e);let d=Math.round((n-s[0])/(u+i[0])),h=Math.round((t-s[1])/(l+i[1]));return d=sl(d,0,a-r),h=sl(h,0,c-o),{x:d,y:h}}function yK(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=S0(e);let d=Math.round((t+s[0])/(u+s[0])),h=Math.round((n+s[1])/(c+s[1])),p=sl(d,0,l-r),m=sl(h,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(p=sl(d,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(m=sl(h,0,a)),{w:p,h:m}}function sl(e,t,n){return Math.max(Math.min(e,n),t)}var E0={},T1={exports:{}},om={exports:{}},Dt={};/** @license React v16.13.1
36
+ `,EA=["_forecast"],Wg="dm",Gf=[{locale:"en-US",currency:"USD",currencyName:"US Dollar"},{locale:"en-GB",currency:"GBP",currencyName:"British Pound"},{locale:"en-CA",currency:"CAD",currencyName:"Canadian Dollar"},{locale:"en-AU",currency:"AUD",currencyName:"Australian Dollar"},{locale:"en-IN",currency:"INR",currencyName:"Indian Rupee"},{locale:"ja-JP",currency:"JPY",currencyName:"Japanese Yen"},{locale:"de-DE",currency:"EUR",currencyName:"Germany (Eurozone)"},{locale:"fr-FR",currency:"EUR",currencyName:"France (Eurozone)"},{locale:"es-ES",currency:"EUR",currencyName:"Spain (Eurozone)"},{locale:"it-IT",currency:"EUR",currencyName:"Italy (Eurozone)"},{locale:"fi-FI",currency:"EUR",currencyName:"Finland (Eurozone)"},{locale:"nl-NL",currency:"EUR",currencyName:"Netherlands (Eurozone)"},{locale:"zh-CN",currency:"CNY",currencyName:"Chinese Yuan"},{locale:"ru-RU",currency:"RUB",currencyName:"Russian Ruble"},{locale:"pt-BR",currency:"BRL",currencyName:"Brazilian Real"},{locale:"ko-KR",currency:"KRW",currencyName:"South Korean Won"},{locale:"ar-SA",currency:"SAR",currencyName:"Saudi Riyal"},{locale:"sv-SE",currency:"SEK",currencyName:"Swedish Krona"},{locale:"no-NO",currency:"NOK",currencyName:"Norwegian Krone"},{locale:"da-DK",currency:"DKK",currencyName:"Danish Krone"},{locale:"pl-PL",currency:"PLN",currencyName:"Polish Zloty"},{locale:"tr-TR",currency:"TRY",currencyName:"Turkish Lira"},{locale:"he-IL",currency:"ILS",currencyName:"Israeli Shekel"},{locale:"th-TH",currency:"THB",currencyName:"Thai Baht"},{locale:"vi-VN",currency:"VND",currencyName:"Vietnamese Dong"},{locale:"id-ID",currency:"IDR",currencyName:"Indonesian Rupiah"},{locale:"mx-MX",currency:"MXN",currencyName:"Mexican Peso"},{locale:"za-ZA",currency:"ZAR",currencyName:"South African Rand"},{locale:"sg-SG",currency:"SGD",currencyName:"Singapore Dollar"},{locale:"hk-HK",currency:"HKD",currencyName:"Hong Kong Dollar"},{locale:"ch-CH",currency:"CHF",currencyName:"Swiss Franc"},{locale:"my-MY",currency:"MYR",currencyName:"Malaysian Ringgit"},{locale:"ph-PH",currency:"PHP",currencyName:"Philippine Peso"},{locale:"eg-EG",currency:"EGP",currencyName:"Egyptian Pound"},{locale:"nz-NZ",currency:"NZD",currencyName:"New Zealand Dollar"}],xG=[{label:"English",locales:[{code:"en-US",name:"US English"},{code:"en-GB",name:"British English"},{code:"en-AU",name:"Australian English"},{code:"en-CA",name:"Canadian English"}]},{label:"French",locales:[{code:"fr-FR",name:"France French"},{code:"fr-CA",name:"Canadian French"}]},{label:"Spanish",locales:[{code:"es-ES",name:"Spain Spanish"},{code:"es-MX",name:"Mexican Spanish"},{code:"es-419",name:"Latin American Spanish"}]},{label:"German",locales:[{code:"de-DE",name:"Germany German"},{code:"de-CH",name:"Swiss German"}]},{label:"Chinese",locales:[{code:"zh-CN",name:"Simplified Chinese (China)"},{code:"zh-TW",name:"Traditional Chinese (Taiwan)"},{code:"zh-HK",name:"Hong Kong Chinese"}]},{label:"Japanese",locales:[{code:"ja-JP",name:"Japanese"}]},{label:"Arabic",locales:[{code:"ar-EG",name:"Egypt Arabic"},{code:"ar-SA",name:"Saudi Arabia Arabic"}]},{label:"Russian",locales:[{code:"ru-RU",name:"Russian"}]},{label:"Portuguese",locales:[{code:"pt-PT",name:"Portugal Portuguese"},{code:"pt-BR",name:"Brazil Portuguese"}]},{label:"Indian Languages",locales:[{code:"hi-IN",name:"Hindi (India)"},{code:"ta-IN",name:"Tamil (India)"}]},{label:"Korean",locales:[{code:"ko-KR",name:"Korean"}]},{label:"Italian",locales:[{code:"it-IT",name:"Italian (Italy)"}]},{label:"Dutch",locales:[{code:"nl-NL",name:"Dutch (Netherlands)"}]},{label:"Swedish",locales:[{code:"sv-SE",name:"Swedish (Sweden)"}]},{label:"Turkish",locales:[{code:"tr-TR",name:"Turkish (Turkey)"}]},{label:"Hebrew",locales:[{code:"he-IL",name:"Hebrew (Israel)"}]},{label:"Thai",locales:[{code:"th-TH",name:"Thai (Thailand)"}]},{label:"Polish",locales:[{code:"pl-PL",name:"Polish (Poland)"}]},{label:"Greek",locales:[{code:"el-GR",name:"Greek (Greece)"}]},{label:"Norwegian",locales:[{code:"no-NO",name:"Norwegian (Norway)"}]}],cE=["lg","md","sm","xs","xxs"],Ug={default:{dashboardPanel:"",dashboardTabsContainer:"",gridLayout:{className:""},chart:{font:{family:"Open Sans, Arial, sans-serif"},dataset:{backgroundColor:[Pt.teal[500],Pt.teal[300],Pt.gray[700],Pt.gray[500],Pt.gray[300]],borderColor:[Pt.teal[500],Pt.teal[300],Pt.gray[700],Pt.gray[500],Pt.gray[300]]},options:{interaction:{mode:"index"},plugins:{datalabels:{display:!1,color:o1},title:{display:!0},tooltip:{backgroundColor:"#fff",bodyColor:"#000",borderWidth:.25,titleColor:"#000",borderColor:"rgb(128,131,139)",cornerRadius:4,usePointStyle:!0,pointStyle:"rectRounded",boxPadding:4},legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},scales:{y:{grid:{display:!0},title:{display:!0,text:""},beginAtZero:!0,ticks:{precision:0}},x:{grid:{display:!0},title:{display:!0}}},layout:{padding:{top:-40}},borderRadius:2,responsive:!0,maintainAspectRatio:!1}}},dark:{chart:{dataset:{datalables:{color:o1},backgroundColor:[Pt.teal[500],Pt.teal[300],Pt.gray[700],Pt.gray[500],Pt.gray[300]],borderColor:[Pt.teal[500],Pt.teal[300],Pt.gray[700],Pt.gray[500],Pt.gray[300]]},options:{plugins:{tooltip:{backgroundColor:"#000",bodyColor:"#fff",borderWidth:.25,titleColor:"#fff",borderColor:"rgb(128,131,139)",cornerRadius:2,boxPadding:4}},datalabels:{display:!1},scales:{x:{grid:{display:!0,color:Pt.slate[800]}},y:{grid:{display:!0,color:Pt.slate[800]}}}}}}};function o1(e){var r,o,i,s,a,l;const t=(a=(s=(i=(o=(r=e==null?void 0:e.chart)==null?void 0:r.config)==null?void 0:o._config)==null?void 0:i.options)==null?void 0:s.plugins)==null?void 0:a.datalabels;let n=(l=e==null?void 0:e.dataset)==null?void 0:l.backgroundColor;return(t==null?void 0:t.align)==="end"&&(t==null?void 0:t.anchor)==="end"&&(n=Yf()),(t==null?void 0:t.align)==="start"&&(t==null?void 0:t.anchor)==="start"&&(n=Yf()),Pu(n)}function Yf(){return re.getState().theme==="dark"?"#000000":"#FFFFFF"}function Pu(e){let t=0,n=0,r=0,o=0;const i=u=>{if(!u)return Pt.gray[500];const d=u.replace("#",""),h=parseInt(d.substring(0,2),16),p=parseInt(d.substring(2,4),16),m=parseInt(d.substring(4,6),16);t+=h,n+=p,r+=m,o++};Array.isArray(e)?e.forEach(u=>{i(u)}):i(e);const s=t/o,a=n/o,l=r/o;return(s*299+a*587+l*114)/1e3>=180?"black":"white"}const wG=["text","nullable(string)","name","enum","varchar","nvarchar","nvarchar2","char","character","longtext","nchar","char varying","nchar varying","character varying","string"],CG=["number","integer","int","int64","bigint","smallint","tinyint","byteint","numeric","decimal","dec","double","real","double precision","float","float4","float8","float64"],SG=["date","datetime","time","timestamp","timestamp without time zone","timestamp_ns"],EG=["boolean"];function uE(e){return e.match(/[A-Z]/)?`"${e}"`:e}function y0(e){return wG.includes(e.toLowerCase())||/varchar/i.test(e)}function Xh(e){return CG.includes(e.toLowerCase())||/int|decimal|float|double/i.test(e)}function oc(e){return SG.includes(e.toLowerCase())||/date|time|timestamp/i.test(e)}function dE(e){return EG.includes(e.toLowerCase())||/boolean/i.test(e)}function _G(e,t,n,r,o,i){const{measures:s,dimensions:a}=e,l=s==null?void 0:s.map(h=>`${h.calc}(${h.name}) as ${h.calc}_${h.name.replace(/"/g,"")}`).join(", "),c=(a==null?void 0:a.join(", "))||"";let u="";const d=r?`${Wg}.${r}`:fE({schemaName:t,tableName:n,connectionType:o,databaseName:i});if(l&&c)return u=`SELECT ${c}, COUNT(*) as count, ${l} FROM ${d} GROUP BY ${c} ORDER BY ${c} DESC LIMIT 100`,u;if(!l&&c)return u=`SELECT ${c}, COUNT(*) as count FROM ${d} GROUP BY ${c} ORDER BY ${c} DESC LIMIT 100`,u;if(l&&!c)return u=`SELECT ${l} FROM ${d} LIMIT 100`,u}function kG(e,t,n="AVG"){var i,s,a,l;let r={};const o=uE(e.column_name);return y0(e.data_type)&&(((i=t.dimensions)==null?void 0:i.includes(o))?r={...t,dimensions:(s=t.dimensions)==null?void 0:s.filter(u=>u!==o)}:r={...t,dimensions:[...t.dimensions||[],o]}),Xh(e.data_type)&&(((a=t.measures)==null?void 0:a.some(u=>u.name===o&&u.calc===n))?r={...t,measures:(l=t.measures)==null?void 0:l.filter(u=>!(u.name===o&&u.calc===n))}:r={...t,measures:[...t.measures||[],{name:o,calc:n||"SUM"}]}),r}function tu(e){return y0(e.dataType)?"string":Xh(e.dataType)?"number":oc(e.dataType)?"date":dE(e.dataType)?"boolean":"string"}function RG(e){let t;const n=e.data_type.toLowerCase();return y0(n)?t="T":Xh(n)?t="#":oc(n)?t="D":dE(n)?t="B":t="?",t}function NG(e,t){const{dimensions:n,measures:r}=t,o=n==null?void 0:n.includes(e.column_name),i=r==null?void 0:r.some(s=>s.name===e.column_name);return o||i}function _A(e){return e?e!=null&&e.startsWith(`${Wg}.`)?e:`${Wg}.${e}`:""}function kA({schemaName:e,tableName:t,modelName:n,connectionType:r,databaseName:o}){let i=fE({schemaName:e,tableName:t,connectionType:r,databaseName:o});n&&(i=_A(n));let s=i;return(l=>/[A-Z]/.test(l))(t)&&(s=s.split(".").map(c=>`"${c}"`).join(".")),s}function fE({schemaName:e,tableName:t,connectionType:n,databaseName:r}){return t==="api"||e===uE("NA")||n==="S3"||n==="API"?t:n==="S3Tables"?`${r}.${e}.${t}`:e?`${e}.${t}`:`${t}`}const DG=e=>{const t=new Date(e);return!isNaN(t.getTime())},MG=e=>!isNaN(Number(e))&&!isNaN(parseFloat(e)),v0=e=>{let t;return typeof e=="number"?t="number":typeof e=="string"?DG(e)?t="date":MG(e)?t="number":t="string":typeof e=="boolean"?t="boolean":e instanceof Date?t="date":t="unknown",t};function PG({get:e,dataPoint:t,card:n}){var h;const{addOrUpdateFilterValue:r,addFilteringCard:o,removeFilterValues:i,replaceFilterValue:s,removeFilteringCard:a}=e().actions,l=e().filteringCards,{columnName:c,columnValue:u}=t,d={filterId:n.id,connectionId:n==null?void 0:n.connectionId,tableName:n.lastSelectedTable,name:c,expression:(h=n.preferences)==null?void 0:h.filterOnClickField,valueType:v0(u),operation:"=",values:[u]};if(l!=null&&l.find(p=>p.id===n.id)){const p=n.id;if(u==null){a(n),i(p);return}else s(d)}o(n),r(d)}function bN({id:e,layouts:t,initialHeight:n,y:r,x:o,w:i,minH:s}){const a={i:e,x:o??0,y:r??1/0,w:i||20,h:n||35,minW:6,minH:s||10},l=t?{...t}:{};return cE.forEach(c=>{l[c]||(l[c]=[]);const u=l[c].reduce((d,h)=>Math.max(d,h.y+h.h),0);a.y=a.y===1/0?u:a.y,l[c].push({...a})}),l}function yN(e,t){if(!t)return;const n={...t};return cE.forEach(r=>{n[r]&&(n[r]=n[r].filter(o=>o.i!==e))}),n}function RA(e){const t=re.getState().dashboard.globalCacheConfig,{card:n,filter:r}=e;return t}const re=rc()(sE((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:Ug},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{setInitStore:()=>{e(n=>{n.isSessionExpired=!1,n.currentBreakpoint="lg",n.dashboard={id:"",style:Ug},n.showContext=!1,n.selectedSheetId=null,n.selectedCardId=null,n.selectedFrameId=null,n.selectedCard=null,n.showFilters=!1,n.isDashboardEditing=!1,n.isVisualEditing=!1,n.showDashboardJSON=!1,n.filteringCards=[],n.selectedLensId=void 0,n.filterValues=void 0})},setAiContext:n=>{e(r=>{r.dashboard.aiContext=n})},setHandleOpenAssistantProfile:n=>{e(r=>{r.handleOpenAssistantProfile=n})},setFilterMode:(n,r)=>{const o=r==="exclude"?"not in":"in";e(i=>{var a,l,c;const s=(a=i.dashboard.filters)==null?void 0:a.find(u=>u.id===n);s&&(s.operation=o,i.dashboard.filters=(l=i.dashboard.filters)==null?void 0:l.map(u=>u.id===n?s:u),i.filterValues&&i.filterValues.length>0&&(i.filterValues=(c=i.filterValues)==null?void 0:c.map(u=>u.filterId===n?{...u,operation:o}:u)))})},updateEmailSettings:n=>{e(r=>{r.dashboard.emailSettings=n})},setDefaultFilterValues:n=>{e(r=>{r.dashboard.defaultFilterValues=n})},setIsDownloadingPdf:n=>{e(r=>{r.isDownloadingPdf=n})},setGlobalCacheConfig:n=>{e(r=>{r.dashboard.globalCacheConfig=n})},setLenses:n=>{e(r=>{r.lenses=n})},setSelectedLensId:n=>{e(r=>{r.selectedLensId=n})},deleteSheet:n=>{e(r=>{var i,s,a,l,c,u,d,h;const o=(i=r.dashboard.sheets)==null?void 0:i.findIndex(p=>p.id===n);if(o!==void 0&&o>-1){(s=r.dashboard.sheets)==null||s.splice(o,1);const p=(a=r.dashboard.filters)==null?void 0:a.filter(g=>g.sheetId===n),m=(l=r.filterValues)==null?void 0:l.filter(g=>p==null?void 0:p.some(b=>b.id===g.filterId));r.filterValues=(c=r.filterValues)==null?void 0:c.filter(g=>!(m!=null&&m.some(b=>b.filterId===g.filterId))),r.dashboard.filters=(u=r.dashboard.filters)==null?void 0:u.filter(g=>g.sheetId!==n),r.selectedSheetId=(h=(d=r.dashboard.sheets)==null?void 0:d[0])==null?void 0:h.id}})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const o=r.dashboard.filters;let i={};o==null||o.forEach(a=>{cE.forEach(l=>{i!=null&&i[l]||(i={...i,[l]:[]});const c={i:a.id,x:0,y:0,w:10,h:8};i[l].push(c)})});const s={...n,layouts:i};r.dashboard.sheets.push(s)})},setGlobalStyle:n=>{e(r=>{r.dashboard.globalStyle=n})},setAIScopeTables:n=>{e(r=>{r.dashboard.aiScopeTables=n})},addToAIScope:n=>{e(r=>{const{connectionId:o,connectionType:i,databaseName:s,schemaName:a,tableName:l,datamodelName:c,datamodelId:u}=n,d={connectionId:o||"",connectionType:i||"",databaseName:s||"",schemaName:a||"",tableName:l||"",datamodelName:c||"",datamodelId:u||""};let p=[...r.dashboard.aiScopeTables||[],d];p=p.filter((m,g,b)=>b.findIndex(y=>y.tableName===m.tableName&&y.datamodelName===m.datamodelName)===g),r.dashboard.aiScopeTables=p})},removeFromAIScope:n=>{e(r=>{const{connectionId:o,tableName:i,datamodelName:s}=n,a=r.dashboard.aiScopeTables||[];if(s){const l=a.filter(c=>!(c.datamodelName===s&&c.connectionId===o));r.dashboard.aiScopeTables=l}else if(i){const l=a.filter(c=>!(c.tableName===i&&c.connectionId===o));r.dashboard.aiScopeTables=l}})},setIsSessionExpired:n=>{e(()=>({isSessionExpired:n}))},setCardPython:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===o.selectedSheetId);i&&((l=i==null?void 0:i.frames)==null||l.forEach(c=>{var d;const u=(d=c.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.python=r)}))})},addBaseQuery:n=>{e(r=>{var o;r.dashboard.baseQueries||(r.dashboard.baseQueries=[]),(o=r.dashboard.baseQueries)==null||o.push(n)})},removeBaseQuery:n=>{e(r=>{var i,s;const o=(i=r.dashboard.baseQueries)==null?void 0:i.findIndex(a=>a.id===n);o!=null&&o>-1&&((s=r.dashboard.baseQueries)==null||s.splice(o,1))})},setBaseQueries:n=>{e(r=>{r.dashboard.baseQueries=n})},setCurrentBreakpoint:n=>{e(()=>({currentBreakpoint:n}))},setFilteringCards:n=>{e(()=>({filteringCards:n}))},addFilteringCard:n=>{e(r=>{var o;(o=r.filteringCards)==null||o.push(n)})},removeFilteringCard:n=>{e(r=>{var i,s;const o=(i=r.filteringCards)==null?void 0:i.findIndex(a=>a.id===n.id);o!==void 0&&o>-1&&((s=r.filteringCards)==null||s.splice(o,1))})},setCustomCards:n=>{e(r=>{r.dashboard.customCards=n})},setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setDashboard:n=>e({dashboard:n}),setDashboardWithFilterValues:(n,r)=>{e(o=>{o.dashboard=n,o.filterValues=r})},setDashboardTheme:n=>{e(r=>{r.theme=n})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setSheetTitle:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.title=r)})},setCardTitle:(n,r,o)=>{e(i=>{var a,l,c;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&((c=s==null?void 0:s.frames)==null||c.forEach(u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.title=o)}))})},setCardInfo:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===o.selectedSheetId);i&&((l=i==null?void 0:i.frames)==null||l.forEach(c=>{var d;const u=(d=c.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.info=r)}))})},setCardDescription:(n,r,o)=>{e(i=>{var a,l,c;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&((c=s==null?void 0:s.frames)==null||c.forEach(u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.description=o)}))})},setCardSql:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){const d=(c=s.cards)==null?void 0:c.find(h=>h.id===r);d&&(d.sql=o,(u=i.onUpdateCard)==null||u.call(i,d,n))}})},setSheetLayout:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layout=r)})},setSheetLayouts:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layouts=r)})},setShowContext:n=>{e(()=>({showContext:n}))},setShowFilters:n=>{e(()=>({showFilters:n}))},setFilterValues:n=>{e(()=>({filterValues:n}))},addOrUpdateFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1?r.filterValues.splice(o,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},addOrUpdateFilterValues:n=>{e(r=>{r.filterValues?n.forEach(o=>{var s,a,l,c;const i=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(u=>u.filterId===o.filterId);if(o.values.length===0){r.filterValues=(a=r.filterValues)==null?void 0:a.filter(u=>u.filterId!==o.filterId);return}i!==void 0&&i>-1?(l=r.filterValues)==null||l.splice(i,1,o):(c=r.filterValues)==null||c.push(o)}):r.filterValues=n})},removeFilterValues:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.filter(i=>i.filterId!==n&&!i.filterId.startsWith(n));r.filterValues=o}})},replaceFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1&&r.filterValues.splice(o,1,n)}})},addFilter:n=>{e(r=>{var i,s;r.dashboard.filters?(i=r.dashboard.filters)==null||i.push(n):r.dashboard.filters=[n],(s=r.dashboard.sheets)==null||s.find(a=>a.id===r.selectedSheetId);const o=r.dashboard.sheets;o==null||o.forEach(a=>{bN({id:n.id,layouts:a.layouts,y:0,initialHeight:8,minH:7,w:10})})})},removeFilter:n=>{e(r=>{var o,i,s;if(r.dashboard.filters){const a=(o=r.dashboard.filters)==null?void 0:o.findIndex(l=>l.id===n);if(a>-1){(i=r.dashboard.filters)==null||i.splice(a,1),(s=r.dashboard.sheets)==null||s.find(c=>c.id===r.selectedSheetId);const l=r.dashboard.sheets;l==null||l.forEach(c=>{const u=yN(n,c.layouts);c.layouts=u})}}})},updateCurrentDashboardCard:n=>{e(r=>{var a,l,c,u,d;const o=(l=(a=r.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===r.selectedSheetId),i=(c=o==null?void 0:o.frames)==null?void 0:c.find(h=>h.id===r.selectedFrameId),s=(u=i==null?void 0:i.cards)==null?void 0:u.findIndex(h=>h.id===n.id);typeof s=="number"&&s>=0&&((d=i==null?void 0:i.cards)==null||d.splice(s,1,n))})},updateFrameCard:(n,r,o)=>{e(i=>{var l,c,u,d,h;const s=(c=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(p=>p.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(p=>p.id===r);if(a){const p=(d=a.cards)==null?void 0:d.findIndex(m=>m.id===o.id);p>-1&&((h=a.cards)==null||h.splice(p,1,o))}})},updateFilter:n=>{e(r=>{var o,i;if(r.dashboard.filters){const s=(o=r.dashboard.filters)==null?void 0:o.findIndex(a=>a.id===n.id);s>-1&&((i=r.dashboard.filters)==null||i.splice(s,1,n))}})},updateFilterId:(n,r)=>{e(o=>{var a,l;const i=(a=o.dashboard.filters)==null?void 0:a.find(c=>c.id===n),s=(l=o.dashboard.filters)==null?void 0:l.some(c=>c.id===r);i&&!s&&(i.id=r)})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addFrame:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let d=1/0;const h=0;o==="start"&&(d=0);const p=bN({id:r.id,layouts:s.layouts,minH:10,x:h,y:d});s.layouts=p,(u=i.onAddFrame)==null||u.call(i,r,n)}})},removeFrame:(n,r)=>{e(o=>{var s,a,l,c,u;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(d=>d.id===n);if(i){const d=(l=i.frames)==null?void 0:l.findIndex(h=>h.id===r);console.log(d),typeof d=="number"&&d>-1&&((c=i.frames)==null||c.splice(d,1),(u=i.layout)==null||u.splice(d,1),yN(r,i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,c,u,d;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.frames)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.frames)==null||u.splice(s,1,r)),(d=o.onAcceptChanges)==null||d.call(o,r,o.dashboard)})},updateCard:(n,r)=>{e(o=>{var a,l,c,u,d;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.cards)==null||u.splice(s,1,r),(d=o.onUpdateCard)==null||d.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,c,u,d,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(p=>p.id===r.id);i&&((u=i.cards)==null||u.splice(s,1),(d=i.layout)==null||d.splice(s,1),(h=o.onRemoveCard)==null||h.call(o,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===n);i&&(((l=i.cards)==null?void 0:l.find(u=>u.id===r))?o.selectedCardId=r:o.selectedCardId=null)})},setSelectedFrameId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId))&&(r.selectedFrameId=n)})},setSelectedSheetId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===n))&&(r.selectedSheetId=n)})},setOnSaveFunction:n=>{e(()=>({onSaveFunction:n}))},setOnAddCard:n=>{e(()=>({onAddCard:n}))},setOnAcceptChanges:n=>{e(()=>({onAcceptChanges:n}))},setOnUpdateCard:n=>{e(()=>({onUpdateCard:n}))},setOnRemoveCard:n=>{e(()=>({onRemoveCard:n}))},setOnEvent:n=>{e(()=>({onEvent:n}))},getDashboard:()=>t().dashboard,getSelectedSheet:()=>{var n,r;return(r=(n=t().dashboard)==null?void 0:n.sheets)==null?void 0:r.find(o=>o.id===t().selectedSheetId)},getCardFrame:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a){for(let l=0;l<a.length;l++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return a[l]}}},getSelectedFrame:()=>{var r,o,i;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(s=>s.id===t().selectedSheetId);return(i=n==null?void 0:n.frames)==null?void 0:i.find(s=>s.id===t().selectedFrameId)},getCard:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a)for(let l=0;l<a.length;l++){const c=(i=a[l].cards)==null?void 0:i.find(u=>u.id===n);if(c)return c}}},getSelectedSheetLayout:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layout},getSelectedSheetLayouts:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layouts},getStyle:()=>{var n;return(n=t().dashboard)==null?void 0:n.style},getCardSheet(n){var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a){for(let l=0;l<a.length;l++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return r[s]}}},handleDataPointClickAction:(n,r)=>{PG({card:n,dataPoint:r,get:t})}}}))),NA=()=>re(t=>{var i,s,a,l,c;const n=(s=(i=t.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(u=>u.id===t.selectedSheetId),r=(a=n==null?void 0:n.frames)==null?void 0:a.find(u=>u.id===t.selectedFrameId);return((l=r==null?void 0:r.cards)==null?void 0:l.find(u=>u.id===(r==null?void 0:r.activeCardId)))||((c=r==null?void 0:r.cards)==null?void 0:c[0])}),DA=()=>{var n;const e=re(r=>{var o,i;return(i=(o=r.dashboard)==null?void 0:o.sheets)==null?void 0:i.find(s=>s.id===r.selectedSheetId)});return(((n=e==null?void 0:e.frames)==null?void 0:n.map(r=>{var o;return(o=r.cards)==null?void 0:o.find(i=>i.id===r.activeCardId)}))||[]).filter(r=>r!==void 0)},MA=()=>{var t,n,r;const e=NA();return{metricFields:((t=e==null?void 0:e.config)==null?void 0:t.metricColumns)||[],groupByFields:((n=e==null?void 0:e.config)==null?void 0:n.groupByColumns)||[],pivotByFields:((r=e==null?void 0:e.config)==null?void 0:r.pivotByColumns)||[]}},on=()=>re(e=>e.actions);async function IG(e,t){const n=t.slice(0,16),r=new TextEncoder,o=await window.crypto.subtle.importKey("raw",r.encode(n),{name:"PBKDF2"},!1,["deriveKey"]),i=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r.encode(n),iterations:1e5,hash:"SHA-256"},o,{name:"AES-GCM",length:256},!1,["encrypt"]),s=window.crypto.getRandomValues(new Uint8Array(12)),a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:s},i,r.encode(e)),l=new Uint8Array(s.length+a.byteLength);return l.set(s,0),l.set(new Uint8Array(a),s.length),{payload:btoa(String.fromCharCode(...l))}}async function PA(e,t){const n=t.slice(0,16),r=new TextEncoder,o=new TextDecoder,i=await window.crypto.subtle.importKey("raw",r.encode(n),{name:"PBKDF2"},!1,["deriveKey"]),s=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r.encode(n),iterations:1e5,hash:"SHA-256"},i,{name:"AES-GCM",length:256},!1,["decrypt"]),a=Uint8Array.from(atob(e),h=>h.charCodeAt(0)),l=a.slice(0,12),c=a.slice(a.length-16),u=a.slice(12,a.length-16),d=new Uint8Array(u.length+c.length);d.set(u),d.set(c,u.length);try{const h=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:l},s,d);return{decryptedData:o.decode(h)}}catch(h){throw new Error(`Decryption failed: ${h}`)}}function oe(...e){return Wq(Al(e))}const jG=e=>Object.keys(e).length===0;async function vr(e,t,n={}){try{const r=new URLSearchParams(n).toString(),o=`${e}?${r}`,i=await fetch(o,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!i.ok){const a=await i.json();throw new Error((a==null?void 0:a.error)||`HTTP error! status: ${i.status}`)}return await i.json()}catch(r){throw console.error("Error during fetch:",r),r}}async function IA(e,t,n={}){try{const r=JSON.stringify(n),o=await IG(r,t),i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(o)});if(!i.ok)return i.json().then(a=>{throw console.log(a.detail||"Unknown error occurred"),new Error((a==null?void 0:a.error)||`HTTP error! status: ${i.status}`)});const s=await i.json();if(s.payload){const a=await PA(s.payload,t);return JSON.parse(a.decryptedData)}return s}catch(r){throw console.error("Error during fetch:",r),r}}async function jA(e,t,n={}){try{const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n)});return r.ok?await r.json():r.json().then(i=>{throw console.log(i.detail||"Unknown error occurred"),new Error((i==null?void 0:i.error)||`HTTP error! status: ${r.status}`)})}catch(r){throw console.error("Error during fetch:",r),r}}function TG(e){if(!e)return{tenantId:"",endUserId:""};const t=Kh(e);return{tenantId:t==null?void 0:t.tenantId,endUserId:t==null?void 0:t.endUserId}}function AG(e){return e?Kh(e).assistantProfileId:void 0}function OG(e){if(!e)return;const t=Kh(e);if(t.params&&t.params.currencyFormat)return t.params.currencyFormat}function TA(e){return e?Kh(e).params:void 0}function hE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function AA(e){return e.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substring(1).toLowerCase())}function OA(e){return e.replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase())}const Mr="focus:ring-1 focus:ring-offset-0 focus-visible:ring-1 focus-visible:ring-offset-0",hs="focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 focus:ring-0 focus:ring-ring focus:ring-offset-0";async function FG(){var o,i;const e=(i=(o=re.getState())==null?void 0:o.authToken)==null?void 0:i.accessToken;if(!e)return;const n=await fetch("https://semaphor.cloud/api/v1/invalidate-token",{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!n.ok)throw new Error("Failed to invalidate token");const r=await n.json();return console.log("invalidateToken",r),r}async function LG(e,t={}){if(!e)return null;let n="https://semaphor.cloud/api/v1/dashboard";const r=Object.fromEntries(Object.entries(t).filter(([a,l])=>l!==void 0)),o=new URLSearchParams(r).toString();o&&(n+=`?${o}`);let s=await(await fetch(n,{headers:{Authorization:`Bearer ${e}`}})).json();if("payload"in s){const a=await PA(atob(s.payload),e);s=JSON.parse(a.decryptedData)}return s}async function $G(e){return e?await(await fetch("https://semaphor.cloud/api/v1/plugins",{headers:{Authorization:`Bearer ${e}`}})).json():null}const FA=e=>/boolean/i.test(e)?"boolean":/date|timestamp/i.test(e)?"date":/int|decimal|float|double|num/i.test(e)?"number":/json/i.test(e)?"json":/geo|geography|geometry/i.test(e)?"geo":"string";var qg={exports:{}};qg.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=800,i=16,s=9007199254740991,a="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",d="[object Date]",h="[object Error]",p="[object Function]",m="[object GeneratorFunction]",g="[object Map]",b="[object Number]",y="[object Null]",v="[object Object]",x="[object Proxy]",E="[object RegExp]",_="[object Set]",S="[object String]",C="[object Undefined]",R="[object WeakMap]",N="[object ArrayBuffer]",D="[object DataView]",I="[object Float32Array]",P="[object Float64Array]",A="[object Int8Array]",F="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",$="[object Uint8ClampedArray]",V="[object Uint16Array]",z="[object Uint32Array]",j=/[\\^$.*+?()[\]{}|]/g,W=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,M={};M[I]=M[P]=M[A]=M[F]=M[T]=M[O]=M[$]=M[V]=M[z]=!0,M[a]=M[l]=M[N]=M[u]=M[D]=M[d]=M[h]=M[p]=M[g]=M[b]=M[v]=M[E]=M[_]=M[S]=M[R]=!1;var H=typeof as=="object"&&as&&as.Object===Object&&as,B=typeof self=="object"&&self&&self.Object===Object&&self,G=H||B||Function("return this")(),q=t&&!t.nodeType&&t,Y=q&&!0&&e&&!e.nodeType&&e,K=Y&&Y.exports===q,Z=K&&H.process,ne=function(){try{var U=Y&&Y.require&&Y.require("util").types;return U||Z&&Z.binding&&Z.binding("util")}catch{}}(),Q=ne&&ne.isTypedArray;function ie(U,J,se){switch(se.length){case 0:return U.call(J);case 1:return U.call(J,se[0]);case 2:return U.call(J,se[0],se[1]);case 3:return U.call(J,se[0],se[1],se[2])}return U.apply(J,se)}function te(U,J){for(var se=-1,Ne=Array(U);++se<U;)Ne[se]=J(se);return Ne}function ue(U){return function(J){return U(J)}}function de(U,J){return U==null?void 0:U[J]}function Re(U,J){return function(se){return U(J(se))}}var xe=Array.prototype,Se=Function.prototype,Pe=Object.prototype,Ye=G["__core-js_shared__"],Rt=Se.toString,ge=Pe.hasOwnProperty,Ae=function(){var U=/[^.]+$/.exec(Ye&&Ye.keys&&Ye.keys.IE_PROTO||"");return U?"Symbol(src)_1."+U:""}(),Ie=Pe.toString,ee=Rt.call(Object),le=RegExp("^"+Rt.call(ge).replace(j,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ke=K?G.Buffer:void 0,Me=G.Symbol,Ue=G.Uint8Array;ke&&ke.allocUnsafe;var At=Re(Object.getPrototypeOf,Object),Rn=Object.create,mn=Pe.propertyIsEnumerable,ye=xe.splice,gn=Me?Me.toStringTag:void 0,Ot=function(){try{var U=hv(Object,"defineProperty");return U({},"",{}),U}catch{}}(),uo=ke?ke.isBuffer:void 0,Fn=Math.max,Cc=Date.now,La=hv(G,"Map"),Hi=hv(Object,"create"),an=function(){function U(){}return function(J){if(!Ba(J))return{};if(Rn)return Rn(J);U.prototype=J;var se=new U;return U.prototype=void 0,se}}();function Nt(U){var J=-1,se=U==null?0:U.length;for(this.clear();++J<se;){var Ne=U[J];this.set(Ne[0],Ne[1])}}function Ln(){this.__data__=Hi?Hi(null):{},this.size=0}function je(U){var J=this.has(U)&&delete this.__data__[U];return this.size-=J?1:0,J}function qe(U){var J=this.__data__;if(Hi){var se=J[U];return se===r?void 0:se}return ge.call(J,U)?J[U]:void 0}function rt(U){var J=this.__data__;return Hi?J[U]!==void 0:ge.call(J,U)}function Jt(U,J){var se=this.__data__;return this.size+=this.has(U)?0:1,se[U]=Hi&&J===void 0?r:J,this}Nt.prototype.clear=Ln,Nt.prototype.delete=je,Nt.prototype.get=qe,Nt.prototype.has=rt,Nt.prototype.set=Jt;function Ft(U){var J=-1,se=U==null?0:U.length;for(this.clear();++J<se;){var Ne=U[J];this.set(Ne[0],Ne[1])}}function Lt(){this.__data__=[],this.size=0}function Pn(U){var J=this.__data__,se=Kp(J,U);if(se<0)return!1;var Ne=J.length-1;return se==Ne?J.pop():ye.call(J,se,1),--this.size,!0}function en(U){var J=this.__data__,se=Kp(J,U);return se<0?void 0:J[se][1]}function bn(U){return Kp(this.__data__,U)>-1}function $a(U,J){var se=this.__data__,Ne=Kp(se,U);return Ne<0?(++this.size,se.push([U,J])):se[Ne][1]=J,this}Ft.prototype.clear=Lt,Ft.prototype.delete=Pn,Ft.prototype.get=en,Ft.prototype.has=bn,Ft.prototype.set=$a;function fo(U){var J=-1,se=U==null?0:U.length;for(this.clear();++J<se;){var Ne=U[J];this.set(Ne[0],Ne[1])}}function oi(){this.size=0,this.__data__={hash:new Nt,map:new(La||Ft),string:new Nt}}function za(U){var J=Qp(this,U).delete(U);return this.size-=J?1:0,J}function Id(U){return Qp(this,U).get(U)}function EU(U){return Qp(this,U).has(U)}function _U(U,J){var se=Qp(this,U),Ne=se.size;return se.set(U,J),this.size+=se.size==Ne?0:1,this}fo.prototype.clear=oi,fo.prototype.delete=za,fo.prototype.get=Id,fo.prototype.has=EU,fo.prototype.set=_U;function Sc(U){var J=this.__data__=new Ft(U);this.size=J.size}function kU(){this.__data__=new Ft,this.size=0}function RU(U){var J=this.__data__,se=J.delete(U);return this.size=J.size,se}function NU(U){return this.__data__.get(U)}function DU(U){return this.__data__.has(U)}function MU(U,J){var se=this.__data__;if(se instanceof Ft){var Ne=se.__data__;if(!La||Ne.length<n-1)return Ne.push([U,J]),this.size=++se.size,this;se=this.__data__=new fo(Ne)}return se.set(U,J),this.size=se.size,this}Sc.prototype.clear=kU,Sc.prototype.delete=RU,Sc.prototype.get=NU,Sc.prototype.has=DU,Sc.prototype.set=MU;function PU(U,J){var se=gv(U),Ne=!se&&mv(U),mt=!se&&!Ne&&GR(U),Bt=!se&&!Ne&&!mt&&KR(U),tn=se||Ne||mt||Bt,Ct=tn?te(U.length,String):[],nn=Ct.length;for(var Io in U)tn&&(Io=="length"||mt&&(Io=="offset"||Io=="parent")||Bt&&(Io=="buffer"||Io=="byteLength"||Io=="byteOffset")||UR(Io,nn))||Ct.push(Io);return Ct}function dv(U,J,se){(se!==void 0&&!Zp(U[J],se)||se===void 0&&!(J in U))&&fv(U,J,se)}function IU(U,J,se){var Ne=U[J];(!(ge.call(U,J)&&Zp(Ne,se))||se===void 0&&!(J in U))&&fv(U,J,se)}function Kp(U,J){for(var se=U.length;se--;)if(Zp(U[se][0],J))return se;return-1}function fv(U,J,se){J=="__proto__"&&Ot?Ot(U,J,{configurable:!0,enumerable:!0,value:se,writable:!0}):U[J]=se}var jU=qU();function Xp(U){return U==null?U===void 0?C:y:gn&&gn in Object(U)?GU(U):JU(U)}function HR(U){return jd(U)&&Xp(U)==a}function TU(U){if(!Ba(U)||QU(U))return!1;var J=yv(U)?le:W;return J.test(rq(U))}function AU(U){return jd(U)&&YR(U.length)&&!!M[Xp(U)]}function OU(U){if(!Ba(U))return ZU(U);var J=qR(U),se=[];for(var Ne in U)Ne=="constructor"&&(J||!ge.call(U,Ne))||se.push(Ne);return se}function WR(U,J,se,Ne,mt){U!==J&&jU(J,function(Bt,tn){if(mt||(mt=new Sc),Ba(Bt))FU(U,J,tn,se,WR,Ne,mt);else{var Ct=Ne?Ne(pv(U,tn),Bt,tn+"",U,J,mt):void 0;Ct===void 0&&(Ct=Bt),dv(U,tn,Ct)}},XR)}function FU(U,J,se,Ne,mt,Bt,tn){var Ct=pv(U,se),nn=pv(J,se),Io=tn.get(nn);if(Io){dv(U,se,Io);return}var Gr=Bt?Bt(Ct,nn,se+"",U,J,tn):void 0,Td=Gr===void 0;if(Td){var vv=gv(nn),xv=!vv&&GR(nn),ZR=!vv&&!xv&&KR(nn);Gr=nn,vv||xv||ZR?gv(Ct)?Gr=Ct:oq(Ct)?Gr=HU(Ct):xv?(Td=!1,Gr=zU(nn)):ZR?(Td=!1,Gr=VU(nn)):Gr=[]:iq(nn)||mv(nn)?(Gr=Ct,mv(Ct)?Gr=sq(Ct):(!Ba(Ct)||yv(Ct))&&(Gr=YU(nn))):Td=!1}Td&&(tn.set(nn,Gr),mt(Gr,nn,Ne,Bt,tn),tn.delete(nn)),dv(U,se,Gr)}function LU(U,J){return tq(eq(U,J,QR),U+"")}var $U=Ot?function(U,J){return Ot(U,"toString",{configurable:!0,enumerable:!1,value:lq(J),writable:!0})}:QR;function zU(U,J){return U.slice()}function BU(U){var J=new U.constructor(U.byteLength);return new Ue(J).set(new Ue(U)),J}function VU(U,J){var se=BU(U.buffer);return new U.constructor(se,U.byteOffset,U.length)}function HU(U,J){var se=-1,Ne=U.length;for(J||(J=Array(Ne));++se<Ne;)J[se]=U[se];return J}function WU(U,J,se,Ne){var mt=!se;se||(se={});for(var Bt=-1,tn=J.length;++Bt<tn;){var Ct=J[Bt],nn=void 0;nn===void 0&&(nn=U[Ct]),mt?fv(se,Ct,nn):IU(se,Ct,nn)}return se}function UU(U){return LU(function(J,se){var Ne=-1,mt=se.length,Bt=mt>1?se[mt-1]:void 0,tn=mt>2?se[2]:void 0;for(Bt=U.length>3&&typeof Bt=="function"?(mt--,Bt):void 0,tn&&KU(se[0],se[1],tn)&&(Bt=mt<3?void 0:Bt,mt=1),J=Object(J);++Ne<mt;){var Ct=se[Ne];Ct&&U(J,Ct,Ne,Bt)}return J})}function qU(U){return function(J,se,Ne){for(var mt=-1,Bt=Object(J),tn=Ne(J),Ct=tn.length;Ct--;){var nn=tn[++mt];if(se(Bt[nn],nn,Bt)===!1)break}return J}}function Qp(U,J){var se=U.__data__;return XU(J)?se[typeof J=="string"?"string":"hash"]:se.map}function hv(U,J){var se=de(U,J);return TU(se)?se:void 0}function GU(U){var J=ge.call(U,gn),se=U[gn];try{U[gn]=void 0;var Ne=!0}catch{}var mt=Ie.call(U);return Ne&&(J?U[gn]=se:delete U[gn]),mt}function YU(U){return typeof U.constructor=="function"&&!qR(U)?an(At(U)):{}}function UR(U,J){var se=typeof U;return J=J??s,!!J&&(se=="number"||se!="symbol"&&L.test(U))&&U>-1&&U%1==0&&U<J}function KU(U,J,se){if(!Ba(se))return!1;var Ne=typeof J;return(Ne=="number"?bv(se)&&UR(J,se.length):Ne=="string"&&J in se)?Zp(se[J],U):!1}function XU(U){var J=typeof U;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?U!=="__proto__":U===null}function QU(U){return!!Ae&&Ae in U}function qR(U){var J=U&&U.constructor,se=typeof J=="function"&&J.prototype||Pe;return U===se}function ZU(U){var J=[];if(U!=null)for(var se in Object(U))J.push(se);return J}function JU(U){return Ie.call(U)}function eq(U,J,se){return J=Fn(J===void 0?U.length-1:J,0),function(){for(var Ne=arguments,mt=-1,Bt=Fn(Ne.length-J,0),tn=Array(Bt);++mt<Bt;)tn[mt]=Ne[J+mt];mt=-1;for(var Ct=Array(J+1);++mt<J;)Ct[mt]=Ne[mt];return Ct[J]=se(tn),ie(U,this,Ct)}}function pv(U,J){if(!(J==="constructor"&&typeof U[J]=="function")&&J!="__proto__")return U[J]}var tq=nq($U);function nq(U){var J=0,se=0;return function(){var Ne=Cc(),mt=i-(Ne-se);if(se=Ne,mt>0){if(++J>=o)return arguments[0]}else J=0;return U.apply(void 0,arguments)}}function rq(U){if(U!=null){try{return Rt.call(U)}catch{}try{return U+""}catch{}}return""}function Zp(U,J){return U===J||U!==U&&J!==J}var mv=HR(function(){return arguments}())?HR:function(U){return jd(U)&&ge.call(U,"callee")&&!mn.call(U,"callee")},gv=Array.isArray;function bv(U){return U!=null&&YR(U.length)&&!yv(U)}function oq(U){return jd(U)&&bv(U)}var GR=uo||cq;function yv(U){if(!Ba(U))return!1;var J=Xp(U);return J==p||J==m||J==c||J==x}function YR(U){return typeof U=="number"&&U>-1&&U%1==0&&U<=s}function Ba(U){var J=typeof U;return U!=null&&(J=="object"||J=="function")}function jd(U){return U!=null&&typeof U=="object"}function iq(U){if(!jd(U)||Xp(U)!=v)return!1;var J=At(U);if(J===null)return!0;var se=ge.call(J,"constructor")&&J.constructor;return typeof se=="function"&&se instanceof se&&Rt.call(se)==ee}var KR=Q?ue(Q):AU;function sq(U){return WU(U,XR(U))}function XR(U){return bv(U)?PU(U):OU(U)}var aq=UU(function(U,J,se){WR(U,J,se)});function lq(U){return function(){return U}}function QR(U){return U}function cq(){return!1}e.exports=aq})(qg,qg.exports);var zG=qg.exports;const Kf=ka(zG),BG={theme:"system",setTheme:()=>null},LA=k.createContext(BG);function VG({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,i]=k.useState(()=>localStorage.getItem(n)||t);k.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),o==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(o)},[o]);const s={theme:o,setTheme:a=>{localStorage.setItem(n,a),i(a)}};return f.jsx(LA.Provider,{...r,value:s,children:e})}const $A=()=>{const e=k.useContext(LA);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};var od=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ll=typeof window>"u"||"Deno"in globalThis;function bo(){}function HG(e,t){return typeof e=="function"?e(t):e}function i1(e){return typeof e=="number"&&e>=0&&e!==1/0}function zA(e,t){return Math.max(e+(t||0)-Date.now(),0)}function nu(e,t){return typeof e=="function"?e(t):e}function Lo(e,t){return typeof e=="function"?e(t):e}function vN(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==pE(s,t.options))return!1}else if(!Qf(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function xN(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Xf(t.options.mutationKey)!==Xf(i))return!1}else if(!Qf(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function pE(e,t){return((t==null?void 0:t.queryKeyHashFn)||Xf)(e)}function Xf(e){return JSON.stringify(e,(t,n)=>a1(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Qf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Qf(e[n],t[n])):!1}function Gg(e,t){if(e===t)return e;const n=wN(e)&&wN(t);if(n||a1(e)&&a1(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let c=0;c<s;c++){const u=n?c:i[c];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(a[u]=void 0,l++):(a[u]=Gg(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function s1(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function wN(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function a1(e){if(!CN(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!CN(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function CN(e){return Object.prototype.toString.call(e)==="[object Object]"}function WG(e){return new Promise(t=>{setTimeout(t,e)})}function l1(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Gg(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return Gg(e,t)}return t}function UG(e){return e}function qG(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function GG(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Yg=Symbol();function BA(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Yg&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Yg?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var fl,Ws,pu,ZT,YG=(ZT=class extends od{constructor(){super();De(this,fl);De(this,Ws);De(this,pu);we(this,pu,t=>{if(!Ll&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){X(this,Ws)||this.setEventListener(X(this,pu))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,Ws))==null||t.call(this),we(this,Ws,void 0))}setEventListener(t){var n;we(this,pu,t),(n=X(this,Ws))==null||n.call(this),we(this,Ws,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){X(this,fl)!==t&&(we(this,fl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof X(this,fl)=="boolean"?X(this,fl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},fl=new WeakMap,Ws=new WeakMap,pu=new WeakMap,ZT),mE=new YG,mu,Us,gu,JT,KG=(JT=class extends od{constructor(){super();De(this,mu,!0);De(this,Us);De(this,gu);we(this,gu,t=>{if(!Ll&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){X(this,Us)||this.setEventListener(X(this,gu))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,Us))==null||t.call(this),we(this,Us,void 0))}setEventListener(t){var n;we(this,gu,t),(n=X(this,Us))==null||n.call(this),we(this,Us,t(this.setOnline.bind(this)))}setOnline(t){X(this,mu)!==t&&(we(this,mu,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return X(this,mu)}},mu=new WeakMap,Us=new WeakMap,gu=new WeakMap,JT),Kg=new KG;function c1(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function XG(e){return Math.min(1e3*2**e,3e4)}function VA(e){return(e??"online")==="online"?Kg.isOnline():!0}var HA=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Mv(e){return e instanceof HA}function WA(e){let t=!1,n=0,r=!1,o;const i=c1(),s=g=>{var b;r||(h(new HA(g)),(b=e.abort)==null||b.call(e))},a=()=>{t=!0},l=()=>{t=!1},c=()=>mE.isFocused()&&(e.networkMode==="always"||Kg.isOnline())&&e.canRun(),u=()=>VA(e.networkMode)&&e.canRun(),d=g=>{var b;r||(r=!0,(b=e.onSuccess)==null||b.call(e,g),o==null||o(),i.resolve(g))},h=g=>{var b;r||(r=!0,(b=e.onError)==null||b.call(e,g),o==null||o(),i.reject(g))},p=()=>new Promise(g=>{var b;o=y=>{(r||c())&&g(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var g;o=void 0,r||(g=e.onContinue)==null||g.call(e)}),m=()=>{if(r)return;let g;const b=n===0?e.initialPromise:void 0;try{g=b??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(d).catch(y=>{var S;if(r)return;const v=e.retry??(Ll?0:3),x=e.retryDelay??XG,E=typeof x=="function"?x(n,y):x,_=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,y);if(t||!_){h(y);return}n++,(S=e.onFail)==null||S.call(e,n,y),WG(E).then(()=>c()?void 0:p()).then(()=>{t?h(y):m()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?m():p().then(m),i)}}function QG(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Sn=QG(),hl,eA,UA=(eA=class{constructor(){De(this,hl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),i1(this.gcTime)&&we(this,hl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ll?1/0:5*60*1e3))}clearGcTimeout(){X(this,hl)&&(clearTimeout(X(this,hl)),we(this,hl,void 0))}},hl=new WeakMap,eA),bu,yu,po,pl,Xn,Vh,ml,Oo,Ki,tA,ZG=(tA=class extends UA{constructor(t){super();De(this,Oo);De(this,bu);De(this,yu);De(this,po);De(this,pl);De(this,Xn);De(this,Vh);De(this,ml);we(this,ml,!1),we(this,Vh,t.defaultOptions),this.setOptions(t.options),this.observers=[],we(this,pl,t.client),we(this,po,X(this,pl).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,we(this,bu,JG(this.options)),this.state=t.state??X(this,bu),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=X(this,Xn))==null?void 0:t.promise}setOptions(t){this.options={...X(this,Vh),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&X(this,po).remove(this)}setData(t,n){const r=l1(this.state.data,t,this.options);return He(this,Oo,Ki).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){He(this,Oo,Ki).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=X(this,Xn))==null?void 0:r.promise;return(o=X(this,Xn))==null||o.cancel(t),n?n.then(bo).catch(bo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(X(this,bu))}isActive(){return this.observers.some(t=>Lo(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Yg||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!zA(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=X(this,Xn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=X(this,Xn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),X(this,po).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(X(this,Xn)&&(X(this,ml)?X(this,Xn).cancel({revert:!0}):X(this,Xn).cancelRetry()),this.scheduleGc()),X(this,po).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||He(this,Oo,Ki).call(this,{type:"invalidate"})}fetch(t,n){var l,c,u;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(X(this,Xn))return X(this,Xn).continueRetry(),X(this,Xn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(h=>h.options.queryFn);d&&this.setOptions(d.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(we(this,ml,!0),r.signal)})},i=()=>{const d=BA(this.options,n),h={client:X(this,pl),queryKey:this.queryKey,meta:this.meta};return o(h),we(this,ml,!1),this.options.persister?this.options.persister(d,h,this):d(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:X(this,pl),state:this.state,fetchFn:i};o(s),(l=this.options.behavior)==null||l.onFetch(s,this),we(this,yu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=s.fetchOptions)==null?void 0:c.meta))&&He(this,Oo,Ki).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta});const a=d=>{var h,p,m,g;Mv(d)&&d.silent||He(this,Oo,Ki).call(this,{type:"error",error:d}),Mv(d)||((p=(h=X(this,po).config).onError)==null||p.call(h,d,this),(g=(m=X(this,po).config).onSettled)==null||g.call(m,this.state.data,d,this)),this.scheduleGc()};return we(this,Xn,WA({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var h,p,m,g;if(d===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(b){a(b);return}(p=(h=X(this,po).config).onSuccess)==null||p.call(h,d,this),(g=(m=X(this,po).config).onSettled)==null||g.call(m,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,h)=>{He(this,Oo,Ki).call(this,{type:"failed",failureCount:d,error:h})},onPause:()=>{He(this,Oo,Ki).call(this,{type:"pause"})},onContinue:()=>{He(this,Oo,Ki).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),X(this,Xn).start()}},bu=new WeakMap,yu=new WeakMap,po=new WeakMap,pl=new WeakMap,Xn=new WeakMap,Vh=new WeakMap,ml=new WeakMap,Oo=new WeakSet,Ki=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...qA(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Mv(o)&&o.revert&&X(this,yu)?{...X(this,yu),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Sn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),X(this,po).notify({query:this,type:"updated",action:t})})},tA);function qA(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:VA(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function JG(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var li,nA,GA=(nA=class extends od{constructor(t={}){super();De(this,li);this.config=t,we(this,li,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??pE(o,n);let s=this.get(i);return s||(s=new ZG({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){X(this,li).has(t.queryHash)||(X(this,li).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=X(this,li).get(t.queryHash);n&&(t.destroy(),n===t&&X(this,li).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Sn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return X(this,li).get(t)}getAll(){return[...X(this,li).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>vN(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>vN(t,r)):n}notify(t){Sn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Sn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Sn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},li=new WeakMap,nA),ci,dr,gl,ui,Fs,rA,eY=(rA=class extends UA{constructor(t){super();De(this,ui);De(this,ci);De(this,dr);De(this,gl);this.mutationId=t.mutationId,we(this,dr,t.mutationCache),we(this,ci,[]),this.state=t.state||tY(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){X(this,ci).includes(t)||(X(this,ci).push(t),this.clearGcTimeout(),X(this,dr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){we(this,ci,X(this,ci).filter(n=>n!==t)),this.scheduleGc(),X(this,dr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){X(this,ci).length||(this.state.status==="pending"?this.scheduleGc():X(this,dr).remove(this))}continue(){var t;return((t=X(this,gl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,c,u,d,h,p,m,g,b,y,v,x,E,_,S,C;we(this,gl,WA({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(R,N)=>{He(this,ui,Fs).call(this,{type:"failed",failureCount:R,error:N})},onPause:()=>{He(this,ui,Fs).call(this,{type:"pause"})},onContinue:()=>{He(this,ui,Fs).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>X(this,dr).canRun(this)}));const n=this.state.status==="pending",r=!X(this,gl).canStart();try{if(!n){He(this,ui,Fs).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=X(this,dr).config).onMutate)==null?void 0:i.call(o,t,this));const N=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));N!==this.state.context&&He(this,ui,Fs).call(this,{type:"pending",context:N,variables:t,isPaused:r})}const R=await X(this,gl).start();return await((c=(l=X(this,dr).config).onSuccess)==null?void 0:c.call(l,R,t,this.state.context,this)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,R,t,this.state.context)),await((p=(h=X(this,dr).config).onSettled)==null?void 0:p.call(h,R,null,this.state.variables,this.state.context,this)),await((g=(m=this.options).onSettled)==null?void 0:g.call(m,R,null,t,this.state.context)),He(this,ui,Fs).call(this,{type:"success",data:R}),R}catch(R){try{throw await((y=(b=X(this,dr).config).onError)==null?void 0:y.call(b,R,t,this.state.context,this)),await((x=(v=this.options).onError)==null?void 0:x.call(v,R,t,this.state.context)),await((_=(E=X(this,dr).config).onSettled)==null?void 0:_.call(E,void 0,R,this.state.variables,this.state.context,this)),await((C=(S=this.options).onSettled)==null?void 0:C.call(S,void 0,R,t,this.state.context)),R}finally{He(this,ui,Fs).call(this,{type:"error",error:R})}}finally{X(this,dr).runNext(this)}}},ci=new WeakMap,dr=new WeakMap,gl=new WeakMap,ui=new WeakSet,Fs=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Sn.batch(()=>{X(this,ci).forEach(r=>{r.onMutationUpdate(t)}),X(this,dr).notify({mutation:this,type:"updated",action:t})})},rA);function tY(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ts,Fo,Hh,oA,nY=(oA=class extends od{constructor(t={}){super();De(this,ts);De(this,Fo);De(this,Hh);this.config=t,we(this,ts,new Set),we(this,Fo,new Map),we(this,Hh,0)}build(t,n,r){const o=new eY({mutationCache:this,mutationId:++Jp(this,Hh)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){X(this,ts).add(t);const n=nm(t);if(typeof n=="string"){const r=X(this,Fo).get(n);r?r.push(t):X(this,Fo).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(X(this,ts).delete(t)){const n=nm(t);if(typeof n=="string"){const r=X(this,Fo).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&X(this,Fo).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=nm(t);if(typeof n=="string"){const r=X(this,Fo).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=nm(t);if(typeof n=="string"){const o=(r=X(this,Fo).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Sn.batch(()=>{X(this,ts).forEach(t=>{this.notify({type:"removed",mutation:t})}),X(this,ts).clear(),X(this,Fo).clear()})}getAll(){return Array.from(X(this,ts))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>xN(n,r))}findAll(t={}){return this.getAll().filter(n=>xN(t,n))}notify(t){Sn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Sn.batch(()=>Promise.all(t.map(n=>n.continue().catch(bo))))}},ts=new WeakMap,Fo=new WeakMap,Hh=new WeakMap,oA);function nm(e){var t;return(t=e.options.scope)==null?void 0:t.id}function SN(e){return{onFetch:(t,n)=>{var u,d,h,p,m;const r=t.options,o=(h=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],s=((m=t.state.data)==null?void 0:m.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let g=!1;const b=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},y=BA(t.options,t.fetchOptions),v=async(x,E,_)=>{if(g)return Promise.reject();if(E==null&&x.pages.length)return Promise.resolve(x);const S={client:t.client,queryKey:t.queryKey,pageParam:E,direction:_?"backward":"forward",meta:t.options.meta};b(S);const C=await y(S),{maxPages:R}=t.options,N=_?GG:qG;return{pages:N(x.pages,C,R),pageParams:N(x.pageParams,E,R)}};if(o&&i.length){const x=o==="backward",E=x?rY:EN,_={pages:i,pageParams:s},S=E(r,_);a=await v(_,S,x)}else{const x=e??i.length;do{const E=l===0?s[0]??r.initialPageParam:EN(r,a);if(l>0&&E==null)break;a=await v(a,E),l++}while(l<x)}return a};t.options.persister?t.fetchFn=()=>{var g,b;return(b=(g=t.options).persister)==null?void 0:b.call(g,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function EN(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function rY(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var ln,qs,Gs,vu,xu,Ys,wu,Cu,iA,oY=(iA=class{constructor(e={}){De(this,ln);De(this,qs);De(this,Gs);De(this,vu);De(this,xu);De(this,Ys);De(this,wu);De(this,Cu);we(this,ln,e.queryCache||new GA),we(this,qs,e.mutationCache||new nY),we(this,Gs,e.defaultOptions||{}),we(this,vu,new Map),we(this,xu,new Map),we(this,Ys,0)}mount(){Jp(this,Ys)._++,X(this,Ys)===1&&(we(this,wu,mE.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,ln).onFocus())})),we(this,Cu,Kg.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,ln).onOnline())})))}unmount(){var e,t;Jp(this,Ys)._--,X(this,Ys)===0&&((e=X(this,wu))==null||e.call(this),we(this,wu,void 0),(t=X(this,Cu))==null||t.call(this),we(this,Cu,void 0))}isFetching(e){return X(this,ln).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return X(this,qs).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=X(this,ln).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=X(this,ln).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(nu(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return X(this,ln).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=X(this,ln).get(r.queryHash),i=o==null?void 0:o.state.data,s=HG(t,i);if(s!==void 0)return X(this,ln).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Sn.batch(()=>X(this,ln).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=X(this,ln).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=X(this,ln);Sn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=X(this,ln);return Sn.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Sn.batch(()=>X(this,ln).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(bo).catch(bo)}invalidateQueries(e,t={}){return Sn.batch(()=>(X(this,ln).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Sn.batch(()=>X(this,ln).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(bo)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(bo)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=X(this,ln).build(this,t);return n.isStaleByTime(nu(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(bo).catch(bo)}fetchInfiniteQuery(e){return e.behavior=SN(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(bo).catch(bo)}ensureInfiniteQueryData(e){return e.behavior=SN(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Kg.isOnline()?X(this,qs).resumePausedMutations():Promise.resolve()}getQueryCache(){return X(this,ln)}getMutationCache(){return X(this,qs)}getDefaultOptions(){return X(this,Gs)}setDefaultOptions(e){we(this,Gs,e)}setQueryDefaults(e,t){X(this,vu).set(Xf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...X(this,vu).values()],n={};return t.forEach(r=>{Qf(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){X(this,xu).set(Xf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...X(this,xu).values()],n={};return t.forEach(r=>{Qf(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...X(this,Gs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=pE(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Yg&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...X(this,Gs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){X(this,ln).clear(),X(this,qs).clear()}},ln=new WeakMap,qs=new WeakMap,Gs=new WeakMap,vu=new WeakMap,xu=new WeakMap,Ys=new WeakMap,wu=new WeakMap,Cu=new WeakMap,iA),Tr,ft,Wh,fr,bl,Su,Ks,di,Uh,Eu,_u,yl,vl,Xs,ku,jt,ef,u1,d1,f1,h1,p1,m1,g1,YA,sA,gE=(sA=class extends od{constructor(t,n){super();De(this,jt);De(this,Tr);De(this,ft);De(this,Wh);De(this,fr);De(this,bl);De(this,Su);De(this,Ks);De(this,di);De(this,Uh);De(this,Eu);De(this,_u);De(this,yl);De(this,vl);De(this,Xs);De(this,ku,new Set);this.options=n,we(this,Tr,t),we(this,di,null),we(this,Ks,c1()),this.options.experimental_prefetchInRender||X(this,Ks).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(X(this,ft).addObserver(this),_N(X(this,ft),this.options)?He(this,jt,ef).call(this):this.updateResult(),He(this,jt,h1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return b1(X(this,ft),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return b1(X(this,ft),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,He(this,jt,p1).call(this),He(this,jt,m1).call(this),X(this,ft).removeObserver(this)}setOptions(t,n){const r=this.options,o=X(this,ft);if(this.options=X(this,Tr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Lo(this.options.enabled,X(this,ft))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");He(this,jt,g1).call(this),X(this,ft).setOptions(this.options),r._defaulted&&!s1(this.options,r)&&X(this,Tr).getQueryCache().notify({type:"observerOptionsUpdated",query:X(this,ft),observer:this});const i=this.hasListeners();i&&kN(X(this,ft),o,this.options,r)&&He(this,jt,ef).call(this),this.updateResult(n),i&&(X(this,ft)!==o||Lo(this.options.enabled,X(this,ft))!==Lo(r.enabled,X(this,ft))||nu(this.options.staleTime,X(this,ft))!==nu(r.staleTime,X(this,ft)))&&He(this,jt,u1).call(this);const s=He(this,jt,d1).call(this);i&&(X(this,ft)!==o||Lo(this.options.enabled,X(this,ft))!==Lo(r.enabled,X(this,ft))||s!==X(this,Xs))&&He(this,jt,f1).call(this,s)}getOptimisticResult(t){const n=X(this,Tr).getQueryCache().build(X(this,Tr),t),r=this.createResult(n,t);return sY(this,r)&&(we(this,fr,r),we(this,Su,this.options),we(this,bl,X(this,ft).state)),r}getCurrentResult(){return X(this,fr)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){X(this,ku).add(t)}getCurrentQuery(){return X(this,ft)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=X(this,Tr).defaultQueryOptions(t),r=X(this,Tr).getQueryCache().build(X(this,Tr),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return He(this,jt,ef).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),X(this,fr)))}createResult(t,n){var R;const r=X(this,ft),o=this.options,i=X(this,fr),s=X(this,bl),a=X(this,Su),c=t!==r?t.state:X(this,Wh),{state:u}=t;let d={...u},h=!1,p;if(n._optimisticResults){const N=this.hasListeners(),D=!N&&_N(t,n),I=N&&kN(t,r,n,o);(D||I)&&(d={...d,...qA(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:b}=d;if(n.select&&d.data!==void 0)if(i&&d.data===(s==null?void 0:s.data)&&n.select===X(this,Uh))p=X(this,Eu);else try{we(this,Uh,n.select),p=n.select(d.data),p=l1(i==null?void 0:i.data,p,n),we(this,Eu,p),we(this,di,null)}catch(N){we(this,di,N)}else p=d.data;if(n.placeholderData!==void 0&&p===void 0&&b==="pending"){let N;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))N=i.data;else if(N=typeof n.placeholderData=="function"?n.placeholderData((R=X(this,_u))==null?void 0:R.state.data,X(this,_u)):n.placeholderData,n.select&&N!==void 0)try{N=n.select(N),we(this,di,null)}catch(D){we(this,di,D)}N!==void 0&&(b="success",p=l1(i==null?void 0:i.data,N,n),h=!0)}X(this,di)&&(m=X(this,di),p=X(this,Eu),g=Date.now(),b="error");const y=d.fetchStatus==="fetching",v=b==="pending",x=b==="error",E=v&&y,_=p!==void 0,C={status:b,fetchStatus:d.fetchStatus,isPending:v,isSuccess:b==="success",isError:x,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:y,isRefetching:y&&!v,isLoadingError:x&&!_,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:x&&_,isStale:bE(t,n),refetch:this.refetch,promise:X(this,Ks)};if(this.options.experimental_prefetchInRender){const N=P=>{C.status==="error"?P.reject(C.error):C.data!==void 0&&P.resolve(C.data)},D=()=>{const P=we(this,Ks,C.promise=c1());N(P)},I=X(this,Ks);switch(I.status){case"pending":t.queryHash===r.queryHash&&N(I);break;case"fulfilled":(C.status==="error"||C.data!==I.value)&&D();break;case"rejected":(C.status!=="error"||C.error!==I.reason)&&D();break}}return C}updateResult(t){const n=X(this,fr),r=this.createResult(X(this,ft),this.options);if(we(this,bl,X(this,ft).state),we(this,Su,this.options),X(this,bl).data!==void 0&&we(this,_u,X(this,ft)),s1(r,n))return;we(this,fr,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!X(this,ku).size)return!0;const l=new Set(a??X(this,ku));return this.options.throwOnError&&l.add("error"),Object.keys(X(this,fr)).some(c=>{const u=c;return X(this,fr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),He(this,jt,YA).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&He(this,jt,h1).call(this)}},Tr=new WeakMap,ft=new WeakMap,Wh=new WeakMap,fr=new WeakMap,bl=new WeakMap,Su=new WeakMap,Ks=new WeakMap,di=new WeakMap,Uh=new WeakMap,Eu=new WeakMap,_u=new WeakMap,yl=new WeakMap,vl=new WeakMap,Xs=new WeakMap,ku=new WeakMap,jt=new WeakSet,ef=function(t){He(this,jt,g1).call(this);let n=X(this,ft).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(bo)),n},u1=function(){He(this,jt,p1).call(this);const t=nu(this.options.staleTime,X(this,ft));if(Ll||X(this,fr).isStale||!i1(t))return;const r=zA(X(this,fr).dataUpdatedAt,t)+1;we(this,yl,setTimeout(()=>{X(this,fr).isStale||this.updateResult()},r))},d1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(X(this,ft)):this.options.refetchInterval)??!1},f1=function(t){He(this,jt,m1).call(this),we(this,Xs,t),!(Ll||Lo(this.options.enabled,X(this,ft))===!1||!i1(X(this,Xs))||X(this,Xs)===0)&&we(this,vl,setInterval(()=>{(this.options.refetchIntervalInBackground||mE.isFocused())&&He(this,jt,ef).call(this)},X(this,Xs)))},h1=function(){He(this,jt,u1).call(this),He(this,jt,f1).call(this,He(this,jt,d1).call(this))},p1=function(){X(this,yl)&&(clearTimeout(X(this,yl)),we(this,yl,void 0))},m1=function(){X(this,vl)&&(clearInterval(X(this,vl)),we(this,vl,void 0))},g1=function(){const t=X(this,Tr).getQueryCache().build(X(this,Tr),this.options);if(t===X(this,ft))return;const n=X(this,ft);we(this,ft,t),we(this,Wh,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},YA=function(t){Sn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(X(this,fr))}),X(this,Tr).getQueryCache().notify({query:X(this,ft),type:"observerResultsUpdated"})})},sA);function iY(e,t){return Lo(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function _N(e,t){return iY(e,t)||e.state.data!==void 0&&b1(e,t,t.refetchOnMount)}function b1(e,t,n){if(Lo(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&bE(e,t)}return!1}function kN(e,t,n,r){return(e!==t||Lo(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&bE(e,n)}function bE(e,t){return Lo(t.enabled,e)!==!1&&e.isStaleByTime(nu(t.staleTime,e))}function sY(e,t){return!s1(e.getCurrentResult(),t)}function RN(e,t){return e.filter(n=>!t.includes(n))}function aY(e,t,n){const r=e.slice(0);return r[t]=n,r}var xl,mo,Ru,Nu,go,Qs,qh,Gh,Yh,qn,y1,v1,x1,w1,C1,aA,lY=(aA=class extends od{constructor(t,n,r){super();De(this,qn);De(this,xl);De(this,mo);De(this,Ru);De(this,Nu);De(this,go);De(this,Qs);De(this,qh);De(this,Gh);De(this,Yh,[]);we(this,xl,t),we(this,Nu,r),we(this,Ru,[]),we(this,go,[]),we(this,mo,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&X(this,go).forEach(t=>{t.subscribe(n=>{He(this,qn,w1).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,X(this,go).forEach(t=>{t.destroy()})}setQueries(t,n,r){if(we(this,Ru,t),we(this,Nu,n),process.env.NODE_ENV!=="production"){const o=t.map(i=>X(this,xl).defaultQueryOptions(i).queryHash);new Set(o).size!==o.length&&console.warn("[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.")}Sn.batch(()=>{const o=X(this,go),i=He(this,qn,x1).call(this,X(this,Ru));we(this,Yh,i),i.forEach(c=>c.observer.setOptions(c.defaultedQueryOptions,r));const s=i.map(c=>c.observer),a=s.map(c=>c.getCurrentResult()),l=s.some((c,u)=>c!==o[u]);o.length===s.length&&!l||(we(this,go,s),we(this,mo,a),this.hasListeners()&&(RN(o,s).forEach(c=>{c.destroy()}),RN(s,o).forEach(c=>{c.subscribe(u=>{He(this,qn,w1).call(this,c,u)})}),He(this,qn,C1).call(this)))})}getCurrentResult(){return X(this,mo)}getQueries(){return X(this,go).map(t=>t.getCurrentQuery())}getObservers(){return X(this,go)}getOptimisticResult(t,n){const r=He(this,qn,x1).call(this,t),o=r.map(i=>i.observer.getOptimisticResult(i.defaultedQueryOptions));return[o,i=>He(this,qn,v1).call(this,i??o,n),()=>He(this,qn,y1).call(this,o,r)]}},xl=new WeakMap,mo=new WeakMap,Ru=new WeakMap,Nu=new WeakMap,go=new WeakMap,Qs=new WeakMap,qh=new WeakMap,Gh=new WeakMap,Yh=new WeakMap,qn=new WeakSet,y1=function(t,n){return n.map((r,o)=>{const i=t[o];return r.defaultedQueryOptions.notifyOnChangeProps?i:r.observer.trackResult(i,s=>{n.forEach(a=>{a.observer.trackProp(s)})})})},v1=function(t,n){return n?((!X(this,Qs)||X(this,mo)!==X(this,Gh)||n!==X(this,qh))&&(we(this,qh,n),we(this,Gh,X(this,mo)),we(this,Qs,Gg(X(this,Qs),n(t)))),X(this,Qs)):t},x1=function(t){const n=new Map(X(this,go).map(o=>[o.options.queryHash,o])),r=[];return t.forEach(o=>{const i=X(this,xl).defaultQueryOptions(o),s=n.get(i.queryHash);s?r.push({defaultedQueryOptions:i,observer:s}):r.push({defaultedQueryOptions:i,observer:new gE(X(this,xl),i)})}),r},w1=function(t,n){const r=X(this,go).indexOf(t);r!==-1&&(we(this,mo,aY(X(this,mo),r,n)),He(this,qn,C1).call(this))},C1=function(){var t;if(this.hasListeners()){const n=X(this,Qs),r=He(this,qn,y1).call(this,X(this,mo),X(this,Yh)),o=He(this,qn,v1).call(this,r,(t=X(this,Nu))==null?void 0:t.combine);n!==o&&Sn.batch(()=>{this.listeners.forEach(i=>{i(X(this,mo))})})}},aA),yE=w.createContext(void 0),ic=e=>{const t=w.useContext(yE);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},cY=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(yE.Provider,{value:e,children:t})),KA=w.createContext(!1),XA=()=>w.useContext(KA);KA.Provider;function uY(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var dY=w.createContext(uY()),QA=()=>w.useContext(dY);function fY(e,t){return typeof e=="function"?e(...t):!!e}function S1(){}var ZA=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},JA=e=>{w.useEffect(()=>{e.clearReset()},[e])},eO=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||fY(n,[e.error,r])),tO=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},nO=(e,t)=>e.isLoading&&e.isFetching&&!t,E1=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Xg=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function hY({queries:e,...t},n){const r=ic(),o=XA(),i=QA(),s=w.useMemo(()=>e.map(g=>{const b=r.defaultQueryOptions(g);return b._optimisticResults=o?"isRestoring":"optimistic",b}),[e,r,o]);s.forEach(g=>{tO(g),ZA(g,i)}),JA(i);const[a]=w.useState(()=>new lY(r,s,t)),[l,c,u]=a.getOptimisticResult(s,t.combine),d=!o&&t.subscribed!==!1;w.useSyncExternalStore(w.useCallback(g=>d?a.subscribe(Sn.batchCalls(g)):S1,[a,d]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),w.useEffect(()=>{a.setQueries(s,t,{listeners:!1})},[s,t,a]);const p=l.some((g,b)=>E1(s[b],g))?l.flatMap((g,b)=>{const y=s[b];if(y){const v=new gE(r,y);if(E1(y,g))return Xg(y,v,i);nO(g,o)&&Xg(y,v,i)}return[]}):[];if(p.length>0)throw Promise.all(p);const m=l.find((g,b)=>{const y=s[b];return y&&eO({result:g,errorResetBoundary:i,throwOnError:y.throwOnError,query:r.getQueryCache().get(y.queryHash),suspense:y.suspense})});if(m!=null&&m.error)throw m.error;return c(u())}function pY(e,t,n){var d,h,p,m,g;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=ic(),o=XA(),i=QA(),s=r.defaultQueryOptions(e);(h=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=o?"isRestoring":"optimistic",tO(s),ZA(s,i),JA(i);const a=!r.getQueryCache().get(s.queryHash),[l]=w.useState(()=>new t(r,s)),c=l.getOptimisticResult(s),u=!o&&e.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(b=>{const y=u?l.subscribe(Sn.batchCalls(b)):S1;return l.updateResult(),y},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),w.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),E1(s,c))throw Xg(s,l,i);if(eO({result:c,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw c.error;if((m=(p=r.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||m.call(p,s,c),s.experimental_prefetchInRender&&!Ll&&nO(c,o)){const b=a?Xg(s,l,i):(g=r.getQueryCache().get(s.queryHash))==null?void 0:g.promise;b==null||b.catch(S1).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?c:l.trackResult(c)}function Tn(e,t){return pY(e,gE)}function mY(){const e=k.useContext(yE);if(e&&e.isSemaphorClient)return e}function rO({children:e}){const{setIsSessionExpired:t}=on(),n=mY(),[r]=k.useState(()=>{const o=new oY({queryCache:new GA({onError:i=>{i instanceof Error?(console.error(`Something went wrong: ${i.message}`),i.message==="invalid token"&&t(!0)):console.error("Something went wrong:",i)}}),defaultOptions:{queries:{gcTime:36e5,staleTime:3e5,refetchOnWindowFocus:!1,retry:1}}});return o.isSemaphorClient=!0,o});return n?f.jsx(f.Fragment,{children:e}):f.jsx(cY,{client:r,children:e})}const Jo=k.forwardRef(({children:e,className:t,...n},r)=>f.jsx("div",{className:oe("semaphor-scope",t),ref:r,...n,children:e})),gY={id:"",authToken:void 0,tokenProps:{}},vE=k.createContext(gY),oO=({children:e,dashboardProps:t})=>{const n=k.useMemo(()=>{let r={};const o=t.authToken;return o&&(r=Kh(o.accessToken)),{...t,tokenProps:r}},[t]);return f.jsx(rO,{children:f.jsx(vE.Provider,{value:n,children:f.jsx(Jo,{style:{height:"100%"},children:e})})})};function ar(){const e=k.useContext(vE);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function bY(){const{authToken:e,version:t}=ar(),n=re(l=>l.selectedLensId);function r(){if(!(e!=null&&e.accessToken))return!1}const{data:o,isLoading:i,isFetching:s,isError:a}=Tn({queryKey:["dashboard",n,e==null?void 0:e.accessToken],queryFn:()=>LG(e==null?void 0:e.accessToken,{lensId:n,version:t}),enabled:r()});return{data:o,isLoading:i,isFetching:s,isError:a}}function yY(){const{authToken:e}=ar(),t=re(r=>r.authToken),{setAuthToken:n}=on();return k.useEffect(()=>{e&&(e==null?void 0:e.toString())!==(t==null?void 0:t.toString())&&n(e)},[e,t,n]),e}const iO=(e,t)=>{const n={};if(e===null||t===null)return t;const r=new Set([...Object.keys(e),...Object.keys(t)]);for(const o of r){if(!(o in e)&&o in t){n[o]=t[o];continue}if(o in e&&!(o in t)){n[o]=void 0;continue}const i=e[o],s=t[o];if(!_1(i,s))if(Array.isArray(i)&&Array.isArray(s))n[o]=s;else if(NN(i)&&NN(s)){const a=iO(i,s);Object.keys(a).length>0&&(n[o]=a)}else n[o]=s}return n},_1=(e,t)=>{if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,i)=>_1(o,t[i]));const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(o=>_1(e[o],t[o]))}return!1},NN=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Zf=e=>{if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(n=>Zf(n));const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=Zf(e[n]));return t};function sO(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function DN(e,t){const n=sO(e);return n==="dark"?Kf({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function vY({customStyle:e,currentTheme:t,onSave:n,onEvent:r,defaultFilterValues:o,selectedSheetId:i,onFilterValuesChange:s}){const{authToken:a}=ar();yY();const l=re(O=>O.selectedLensId),{data:c,isLoading:u,isFetching:d,isError:h}=bY(),[p,m]=k.useState(o||[]),{theme:g,setTheme:b}=$A(),y=re(O=>O.dashboard.globalStyle),{setDashboard:v,setDashboardWithFilterValues:x,setSelectedSheetId:E,setStyle:_,setOnSaveFunction:S,setLenses:C,setSelectedLensId:R,setInitStore:N}=on();re(O=>O.actions.setCustomCards);const D=re(O=>O.actions.setFilterValues),I=re(O=>O.filterValues),P=re(O=>O.actions.setThemeStyle),A=re(O=>O.actions.setDashboardTheme),F=re(O=>O.actions.setOnEvent);k.useEffect(()=>{a&&N()},[a,N]),k.useEffect(()=>{if(g){const O=sO(g);A(O)}},[g,A]),k.useEffect(()=>{t&&b(t)},[t,b]);const T=k.useCallback(()=>{const O=Zf(Ug),$=Kf(O,y);if(e){const V=Kf($,e),z=DN(g,V);P(z),_(V)}else{const V=DN(g,$);P(V),_(Ug)}},[g,e,y,P,_]);return k.useEffect(()=>{c&&c.dashboard&&T()},[g,e,y,T,c]),k.useEffect(()=>{var L,M;function O(H,B){const G=H.filters||[],q=[];for(const Y of B){const K=G.find(Z=>Z.id===Y.filterId);K&&q.push({filterId:Y.filterId,connectionType:K.database==="NA"?"api":"database",name:K.column,operation:K.operation,valueType:tu(K),values:Y.values})}return q}if(!c||!c.dashboard)return;const{dashboard:$,filterValues:V,defaultLensId:z,lenses:j}=c;function W(){var B;if(V&&(V==null?void 0:V.length)>0)return V;const H=O($,p||[]);return H&&(H==null?void 0:H.length)>0?H:$.defaultFilterValues&&((B=$.defaultFilterValues)==null?void 0:B.length)>0?$.defaultFilterValues:[]}x($,W()),j&&C(j),z&&R(z),E(i||((M=(L=$==null?void 0:$.sheets)==null?void 0:L[0])==null?void 0:M.id)||null)},[c,v,E,D,l,C,x,R,p,i]),k.useEffect(()=>{s&&I&&s(I)},[I,s]),k.useEffect(()=>{n&&S(n),r&&F(r)},[n,S,r,F]),{isFetching:d,isLoading:u,isError:h}}function ps({className:e,...t}){return f.jsx("div",{className:oe("animate-pulse rounded-md bg-muted",e),...t})}const Qg=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:oe("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Qg.displayName="Card";const Iu=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:oe("flex flex-col space-y-1.5 p-6",e),...t}));Iu.displayName="CardHeader";const ua=w.forwardRef(({className:e,...t},n)=>f.jsx("h3",{ref:n,className:oe("text-2xl font-semibold leading-none tracking-tight",e),...t}));ua.displayName="CardTitle";const xE=w.forwardRef(({className:e,...t},n)=>f.jsx("p",{ref:n,className:oe("text-sm text-muted-foreground",e),...t}));xE.displayName="CardDescription";const Jf=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:oe("px-6 pt-0",e),...t}));Jf.displayName="CardContent";const aO=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:oe("flex items-center p-6 pt-0",e),...t}));aO.displayName="CardFooter";function lO({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:d,showAssistant:h,defaultFilterValues:p,onFilterValuesChange:m,selectedSheetId:g,eventHandlers:b,...y}){const{placeholders:v}=ar(),x=re(C=>C.themeStyle),E=re(C=>C.isSessionExpired),{isLoading:_,isError:S}=vY({customStyle:t,currentTheme:c,onSave:n,onEvent:r,defaultFilterValues:p,onFilterValuesChange:m,selectedSheetId:g});return _||!l?(r==null||r({type:"info",message:"Loading dashboard"}),o?f.jsx(o,{message:"loading"}):f.jsx("div",{className:"flex items-center gap-3",children:f.jsx(ps,{className:"h-1 w-full dark:h-[2px]"})})):S?(r==null||r({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),f.jsx(i,{})):f.jsx("div",{children:"Error"})):E?(r==null||r({type:"error",message:"Session Expired"}),v!=null&&v.SessionExpired?f.jsx("div",{className:"flex h-full items-center justify-center",children:f.jsx("div",{children:v.SessionExpired})}):f.jsx("div",{className:"flex h-full items-center justify-center",children:f.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[f.jsx(ua,{children:"Session Expired"}),f.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):f.jsx("div",{className:oe("isolate flex h-full flex-col justify-between",x==null?void 0:x.dashboardPanel,e),style:{},"data-role":"dashboard-panel",...y})}function fe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function xY(e,t){const n=w.createContext(t),r=i=>{const{children:s,...a}=i,l=w.useMemo(()=>a,Object.values(a));return f.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=w.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function Mn(e,t=[]){let n=[];function r(i,s){const a=w.createContext(s),l=n.length;n=[...n,s];const c=d=>{var y;const{scope:h,children:p,...m}=d,g=((y=h==null?void 0:h[e])==null?void 0:y[l])||a,b=w.useMemo(()=>m,Object.values(m));return f.jsx(g.Provider,{value:b,children:p})};c.displayName=i+"Provider";function u(d,h){var g;const p=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,m=w.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>w.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,wY(o,...t)]}function wY(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function MN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wr(...e){return t=>{let n=!1;const r=e.map(o=>{const i=MN(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():MN(e[o],null)}}}}function Ve(...e){return w.useCallback(wr(...e),e)}var k1=w.forwardRef((e,t)=>{const{children:n,...r}=e,o=w.Children.toArray(n),i=o.find(SY);if(i){const s=i.props.children,a=o.map(l=>l===i?w.Children.count(s)>1?w.Children.only(null):w.isValidElement(s)?s.props.children:null:l);return f.jsx(R1,{...r,ref:t,children:w.isValidElement(s)?w.cloneElement(s,void 0,a):null})}return f.jsx(R1,{...r,ref:t,children:n})});k1.displayName="Slot";var R1=w.forwardRef((e,t)=>{const{children:n,...r}=e;if(w.isValidElement(n)){const o=_Y(n),i=EY(r,n.props);return n.type!==w.Fragment&&(i.ref=t?wr(t,o):o),w.cloneElement(n,i)}return w.Children.count(n)>1?w.Children.only(null):null});R1.displayName="SlotClone";var CY=({children:e})=>f.jsx(f.Fragment,{children:e});function SY(e){return w.isValidElement(e)&&e.type===CY}function EY(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function _Y(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function x0(e){const t=e+"CollectionProvider",[n,r]=Mn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:m,children:g}=p,b=k.useRef(null),y=k.useRef(new Map).current;return f.jsx(o,{scope:m,itemMap:y,collectionRef:b,children:g})};s.displayName=t;const a=e+"CollectionSlot",l=k.forwardRef((p,m)=>{const{scope:g,children:b}=p,y=i(a,g),v=Ve(m,y.collectionRef);return f.jsx(k1,{ref:v,children:b})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=k.forwardRef((p,m)=>{const{scope:g,children:b,...y}=p,v=k.useRef(null),x=Ve(m,v),E=i(c,g);return k.useEffect(()=>(E.itemMap.set(v,{ref:v,...y}),()=>void E.itemMap.delete(v))),f.jsx(k1,{[u]:"",ref:x,children:b})});d.displayName=c;function h(p){const m=i(e+"CollectionConsumer",p);return k.useCallback(()=>{const b=m.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((E,_)=>y.indexOf(E.ref.current)-y.indexOf(_.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:d},h,r]}var Hn=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},kY=w.useId||(()=>{}),RY=0;function _n(e){const[t,n]=w.useState(kY());return Hn(()=>{n(r=>r??String(RY++))},[e]),t?`radix-${t}`:""}var cO=w.forwardRef((e,t)=>{const{children:n,...r}=e,o=w.Children.toArray(n),i=o.find(DY);if(i){const s=i.props.children,a=o.map(l=>l===i?w.Children.count(s)>1?w.Children.only(null):w.isValidElement(s)?s.props.children:null:l);return f.jsx(N1,{...r,ref:t,children:w.isValidElement(s)?w.cloneElement(s,void 0,a):null})}return f.jsx(N1,{...r,ref:t,children:n})});cO.displayName="Slot";var N1=w.forwardRef((e,t)=>{const{children:n,...r}=e;if(w.isValidElement(n)){const o=PY(n),i=MY(r,n.props);return n.type!==w.Fragment&&(i.ref=t?wr(t,o):o),w.cloneElement(n,i)}return w.Children.count(n)>1?w.Children.only(null):null});N1.displayName="SlotClone";var NY=({children:e})=>f.jsx(f.Fragment,{children:e});function DY(e){return w.isValidElement(e)&&e.type===NY}function MY(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function PY(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var IY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_e=IY.reduce((e,t)=>{const n=w.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?cO:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function uO(e,t){e&&ys.flushSync(()=>e.dispatchEvent(t))}function Dn(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ir({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=jY({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Dn(n),l=w.useCallback(c=>{if(i){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else o(c)},[i,e,o,a]);return[s,l]}function jY({defaultProp:e,onChange:t}){const n=w.useState(e),[r]=n,o=w.useRef(r),i=Dn(t);return w.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var TY=w.createContext(void 0);function sc(e){const t=w.useContext(TY);return e||t||"ltr"}var Pv="rovingFocusGroup.onEntryFocus",AY={bubbles:!1,cancelable:!0},w0="RovingFocusGroup",[D1,dO,OY]=x0(w0),[FY,id]=Mn(w0,[OY]),[LY,$Y]=FY(w0),fO=w.forwardRef((e,t)=>f.jsx(D1.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(D1.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(zY,{...e,ref:t})})}));fO.displayName=w0;var zY=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=w.useRef(null),p=Ve(t,h),m=sc(i),[g=null,b]=ir({prop:s,defaultProp:a,onChange:l}),[y,v]=w.useState(!1),x=Dn(c),E=dO(n),_=w.useRef(!1),[S,C]=w.useState(0);return w.useEffect(()=>{const R=h.current;if(R)return R.addEventListener(Pv,x),()=>R.removeEventListener(Pv,x)},[x]),f.jsx(LY,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:g,onItemFocus:w.useCallback(R=>b(R),[b]),onItemShiftTab:w.useCallback(()=>v(!0),[]),onFocusableItemAdd:w.useCallback(()=>C(R=>R+1),[]),onFocusableItemRemove:w.useCallback(()=>C(R=>R-1),[]),children:f.jsx(_e.div,{tabIndex:y||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:fe(e.onMouseDown,()=>{_.current=!0}),onFocus:fe(e.onFocus,R=>{const N=!_.current;if(R.target===R.currentTarget&&N&&!y){const D=new CustomEvent(Pv,AY);if(R.currentTarget.dispatchEvent(D),!D.defaultPrevented){const I=E().filter(O=>O.focusable),P=I.find(O=>O.active),A=I.find(O=>O.id===g),T=[P,A,...I].filter(Boolean).map(O=>O.ref.current);mO(T,u)}}_.current=!1}),onBlur:fe(e.onBlur,()=>v(!1))})})}),hO="RovingFocusGroupItem",pO=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=_n(),l=i||a,c=$Y(hO,n),u=c.currentTabStopId===l,d=dO(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=c;return w.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),f.jsx(D1.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:f.jsx(_e.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:fe(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:fe(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:fe(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const g=HY(m,c.orientation,c.dir);if(g!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let y=d().filter(v=>v.focusable).map(v=>v.ref.current);if(g==="last")y.reverse();else if(g==="prev"||g==="next"){g==="prev"&&y.reverse();const v=y.indexOf(m.currentTarget);y=c.loop?WY(y,v+1):y.slice(v+1)}setTimeout(()=>mO(y))}})})})});pO.displayName=hO;var BY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function VY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function HY(e,t,n){const r=VY(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return BY[r]}function mO(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function WY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var wE=fO,CE=pO;function UY(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var fn=e=>{const{present:t,children:n}=e,r=qY(t),o=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Ve(r.ref,GY(o));return typeof n=="function"||r.isPresent?w.cloneElement(o,{ref:i}):null};fn.displayName="Presence";function qY(e){const[t,n]=w.useState(),r=w.useRef({}),o=w.useRef(e),i=w.useRef("none"),s=e?"mounted":"unmounted",[a,l]=UY(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const c=rm(r.current);i.current=a==="mounted"?c:"none"},[a]),Hn(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,p=rm(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Hn(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const g=rm(r.current).includes(p.animationName);if(p.target===t&&g&&(l("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(i.current=rm(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function rm(e){return(e==null?void 0:e.animationName)||"none"}function GY(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var SE="Tabs",[YY,Y4e]=Mn(SE,[id]),gO=id(),[KY,EE]=YY(SE),bO=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=sc(a),[d,h]=ir({prop:r,onChange:o,defaultProp:i});return f.jsx(KY,{scope:n,baseId:_n(),value:d,onValueChange:h,orientation:s,dir:u,activationMode:l,children:f.jsx(_e.div,{dir:u,"data-orientation":s,...c,ref:t})})});bO.displayName=SE;var yO="TabsList",vO=w.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=EE(yO,n),s=gO(n);return f.jsx(wE,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:f.jsx(_e.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});vO.displayName=yO;var xO="TabsTrigger",wO=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=EE(xO,n),a=gO(n),l=EO(s.baseId,r),c=_O(s.baseId,r),u=r===s.value;return f.jsx(CE,{asChild:!0,...a,focusable:!o,active:u,children:f.jsx(_e.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:fe(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:fe(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:fe(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!o&&d&&s.onValueChange(r)})})})});wO.displayName=xO;var CO="TabsContent",SO=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=EE(CO,n),l=EO(a.baseId,r),c=_O(a.baseId,r),u=r===a.value,d=w.useRef(u);return w.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),f.jsx(fn,{present:o||u,children:({present:h})=>f.jsx(_e.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&i})})});SO.displayName=CO;function EO(e,t){return`${e}-trigger-${t}`}function _O(e,t){return`${e}-content-${t}`}var XY=bO,kO=vO,RO=wO,NO=SO;const sd=XY,ac=w.forwardRef(({className:e,...t},n)=>f.jsx(kO,{ref:n,className:oe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ac.displayName=kO.displayName;const to=w.forwardRef(({className:e,...t},n)=>f.jsx(RO,{ref:n,className:oe("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));to.displayName=RO.displayName;const gi=w.forwardRef(({className:e,...t},n)=>f.jsx(NO,{ref:n,className:oe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));gi.displayName=NO.displayName;var DO={exports:{}},Qh={},M1={exports:{}};(function(e,t){(function(n,r){r(t)})(as,function(n){function r(Y){return function(Z,ne,Q,ie,te,ue,de){return Y(Z,ne,de)}}function o(Y){return function(Z,ne,Q,ie){if(!Z||!ne||typeof Z!="object"||typeof ne!="object")return Y(Z,ne,Q,ie);var te=ie.get(Z),ue=ie.get(ne);if(te&&ue)return te===ne&&ue===Z;ie.set(Z,ne),ie.set(ne,Z);var de=Y(Z,ne,Q,ie);return ie.delete(Z),ie.delete(ne),de}}function i(Y,K){var Z={};for(var ne in Y)Z[ne]=Y[ne];for(var ne in K)Z[ne]=K[ne];return Z}function s(Y){return Y.constructor===Object||Y.constructor==null}function a(Y){return typeof Y.then=="function"}function l(Y,K){return Y===K||Y!==Y&&K!==K}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",h="[object RegExp]",p="[object Map]",m="[object Number]",g="[object Object]",b="[object Set]",y="[object String]",v=Object.prototype.toString;function x(Y){var K=Y.areArraysEqual,Z=Y.areDatesEqual,ne=Y.areMapsEqual,Q=Y.areObjectsEqual,ie=Y.areRegExpsEqual,te=Y.areSetsEqual,ue=Y.createIsNestedEqual,de=ue(Re);function Re(xe,Se,Pe){if(xe===Se)return!0;if(!xe||!Se||typeof xe!="object"||typeof Se!="object")return xe!==xe&&Se!==Se;if(s(xe)&&s(Se))return Q(xe,Se,de,Pe);var Ye=Array.isArray(xe),Rt=Array.isArray(Se);if(Ye||Rt)return Ye===Rt&&K(xe,Se,de,Pe);var ge=v.call(xe);return ge!==v.call(Se)?!1:ge===d?Z(xe,Se,de,Pe):ge===h?ie(xe,Se,de,Pe):ge===p?ne(xe,Se,de,Pe):ge===b?te(xe,Se,de,Pe):ge===g||ge===c?a(xe)||a(Se)?!1:Q(xe,Se,de,Pe):ge===u||ge===m||ge===y?l(xe.valueOf(),Se.valueOf()):!1}return Re}function E(Y,K,Z,ne){var Q=Y.length;if(K.length!==Q)return!1;for(;Q-- >0;)if(!Z(Y[Q],K[Q],Q,Q,Y,K,ne))return!1;return!0}var _=o(E);function S(Y,K){return l(Y.valueOf(),K.valueOf())}function C(Y,K,Z,ne){var Q=Y.size===K.size;if(!Q)return!1;if(!Y.size)return!0;var ie={},te=0;return Y.forEach(function(ue,de){if(Q){var Re=!1,xe=0;K.forEach(function(Se,Pe){!Re&&!ie[xe]&&(Re=Z(de,Pe,te,xe,Y,K,ne)&&Z(ue,Se,de,Pe,Y,K,ne))&&(ie[xe]=!0),xe++}),te++,Q=Re}}),Q}var R=o(C),N="_owner",D=Object.prototype.hasOwnProperty;function I(Y,K,Z,ne){var Q=Object.keys(Y),ie=Q.length;if(Object.keys(K).length!==ie)return!1;for(var te;ie-- >0;){if(te=Q[ie],te===N){var ue=!!Y.$$typeof,de=!!K.$$typeof;if((ue||de)&&ue!==de)return!1}if(!D.call(K,te)||!Z(Y[te],K[te],te,te,Y,K,ne))return!1}return!0}var P=o(I);function A(Y,K){return Y.source===K.source&&Y.flags===K.flags}function F(Y,K,Z,ne){var Q=Y.size===K.size;if(!Q)return!1;if(!Y.size)return!0;var ie={};return Y.forEach(function(te,ue){if(Q){var de=!1,Re=0;K.forEach(function(xe,Se){!de&&!ie[Re]&&(de=Z(te,xe,ue,Se,Y,K,ne))&&(ie[Re]=!0),Re++}),Q=de}}),Q}var T=o(F),O=Object.freeze({areArraysEqual:E,areDatesEqual:S,areMapsEqual:C,areObjectsEqual:I,areRegExpsEqual:A,areSetsEqual:F,createIsNestedEqual:r}),$=Object.freeze({areArraysEqual:_,areDatesEqual:S,areMapsEqual:R,areObjectsEqual:P,areRegExpsEqual:A,areSetsEqual:T,createIsNestedEqual:r}),V=x(O);function z(Y,K){return V(Y,K,void 0)}var j=x(i(O,{createIsNestedEqual:function(){return l}}));function W(Y,K){return j(Y,K,void 0)}var L=x($);function M(Y,K){return L(Y,K,new WeakMap)}var H=x(i($,{createIsNestedEqual:function(){return l}}));function B(Y,K){return H(Y,K,new WeakMap)}function G(Y){return x(i(O,Y(O)))}function q(Y){var K=x(i($,Y($)));return function(Z,ne,Q){return Q===void 0&&(Q=new WeakMap),K(Z,ne,Q)}}n.circularDeepEqual=M,n.circularShallowEqual=B,n.createCustomCircularEqual=q,n.createCustomEqual=G,n.deepEqual=z,n.sameValueZeroEqual=l,n.shallowEqual=W,Object.defineProperty(n,"__esModule",{value:!0})})})(M1,M1.exports);var _E=M1.exports;const kE=nE(fq);var lt={},QY=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(lt,"__esModule",{value:!0});lt.bottom=RE;lt.childrenEqual=tK;lt.cloneLayout=MO;lt.cloneLayoutItem=wl;lt.collides=C0;lt.compact=IO;lt.compactItem=jO;lt.compactType=pK;lt.correctBounds=TO;lt.fastPositionEqual=nK;lt.fastRGLPropsEqual=void 0;lt.getAllCollisions=AO;lt.getFirstCollision=il;lt.getLayoutItem=NE;lt.getStatics=DE;lt.modifyLayout=PO;lt.moveElement=nf;lt.moveElementAwayFromCollision=I1;lt.noop=void 0;lt.perc=oK;lt.resizeItemInDirection=uK;lt.setTopLeft=fK;lt.setTransform=dK;lt.sortLayoutItems=AE;lt.sortLayoutItemsByColRow=zO;lt.sortLayoutItemsByRowCol=$O;lt.synchronizeLayoutWithChildren=hK;lt.validateLayout=BO;lt.withLayoutItem=eK;var PN=_E,tf=ZY(k);function ZY(e){return e&&e.__esModule?e:{default:e}}const JY=process.env.NODE_ENV==="production";function RE(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function MO(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=wl(e[n]);return t}function PO(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function eK(e,t,n){let r=NE(e,t);return r?(r=n(wl(r)),e=PO(e,r),[e,r]):[e,null]}function wl(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function tK(e,t){return(0,PN.deepEqual)(tf.default.Children.map(e,n=>n==null?void 0:n.key),tf.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,PN.deepEqual)(tf.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),tf.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}lt.fastRGLPropsEqual=QY;function nK(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function C0(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function IO(e,t,n,r){const o=DE(e),i=AE(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let c=wl(i[a]);c.static||(c=jO(o,c,t,n,i,r),o.push(c)),s[e.indexOf(i[a])]=c,c.moved=!1}return s}const rK={x:"w",y:"h"};function P1(e,t,n,r){const o=rK[r];t[r]+=1;const i=e.map(s=>s.i).indexOf(t.i);for(let s=i+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;C0(t,a)&&P1(e,a,n+t[o],r)}}t[r]=n}function jO(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(RE(e),t.y);t.y>0&&!il(e,t);)t.y--;else if(a)for(;t.x>0&&!il(e,t);)t.x--;let l;for(;(l=il(e,t))&&!(n===null&&i);)if(a?P1(o,t,l.x+l.w,"x"):P1(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!il(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function TO(e,t){const n=DE(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;il(n,i);)i.y++}return e}function NE(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function il(e,t){for(let n=0,r=e.length;n<r;n++)if(C0(e[n],t))return e[n]}function AO(e,t){return e.filter(n=>C0(n,t))}function DE(e){return e.filter(t=>t.static)}function nf(e,t,n,r,o,i,s,a,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${t.y}`;const c=t.x,u=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let d=AE(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(d=d.reverse());const p=AO(d,t),m=p.length>0;if(m&&l)return MO(e);if(m&&i)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let g=0,b=p.length;g<b;g++){const y=p[g];`${t.i}${t.x}${t.y}${y.i}${y.x}${y.y}`,!y.moved&&(y.static?e=I1(e,y,t,o,s):e=I1(e,t,y,o,s))}return e}function I1(e,t,n,r,o,i){const s=o==="horizontal",a=o==="vertical",l=t.static;if(r){r=!1;const d={x:s?Math.max(t.x-n.w,0):n.x,y:a?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},h=il(e,d),p=h&&h.y+h.h>t.y,m=h&&t.x+t.w>h.x;if(h){if(p&&a)return nf(e,n,void 0,t.y+1,r,l,o);if(p&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(m&&s)return nf(e,t,n.x,void 0,r,l,o)}else return`${n.i}${d.x}${d.y}`,nf(e,n,s?d.x:void 0,a?d.y:void 0,r,l,o)}const c=s?n.x+1:void 0,u=a?n.y+1:void 0;return c==null&&u==null?e:nf(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function oK(e){return e*100+"%"}const OO=(e,t,n,r)=>e+n>r?t:n,FO=(e,t,n)=>e<0?t:n,LO=e=>Math.max(0,e),ME=e=>Math.max(0,e),PE=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:FO(s,e.height,o),top:ME(s)}},IE=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:OO(e.left,e.width,s,n),left:LO(o)}},jE=(e,t,n)=>{let{top:r,height:o,width:i}=t;const s=e.left-(i-e.width);return{height:o,width:s<0?e.width:OO(e.left,e.width,i,n),top:ME(r),left:LO(s)}},TE=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:FO(r,e.height,i),top:ME(r)}},iK=function(){return PE(arguments.length<=0?void 0:arguments[0],IE(...arguments))},sK=function(){return PE(arguments.length<=0?void 0:arguments[0],jE(...arguments))},aK=function(){return TE(arguments.length<=0?void 0:arguments[0],IE(...arguments))},lK=function(){return TE(arguments.length<=0?void 0:arguments[0],jE(...arguments))},cK={n:PE,ne:iK,e:IE,se:aK,s:TE,sw:lK,w:jE,nw:sK};function uK(e,t,n,r){const o=cK[e];return o?o(t,{...t,...n},r):n}function dK(e){let{top:t,left:n,width:r,height:o}=e;const i=`translate(${n}px,${t}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function fK(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function AE(e,t){return t==="horizontal"?zO(e):t==="vertical"?$O(e):e}function $O(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function zO(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function hK(e,t,n,r,o){e=e||[];const i=[];tf.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=NE(e,String(a.key)),c=a.props["data-grid"];l&&c==null?i.push(wl(l)):c?(JY||BO([c],"ReactGridLayout.children"),i.push(wl({...c,i:a.key}))):i.push(wl({w:1,h:1,x:0,y:RE(i),i:String(a.key)}))});const s=TO(i,{cols:n});return o?s:IO(s,r,n)}function BO(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let s=0;s<n.length;s++){const a=n[s],l=i[a];if(typeof l!="number"||Number.isNaN(l))throw new Error(`ReactGridLayout: ${t}[${r}].${a} must be a number! Received: ${l} (${typeof l})`)}if(typeof i.i<"u"&&typeof i.i!="string")throw new Error(`ReactGridLayout: ${t}[${r}].i must be a string! Received: ${i.i} (${typeof i.i})`)}}function pK(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const mK=()=>{};lt.noop=mK;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.calcGridColWidth=S0;Ti.calcGridItemPosition=gK;Ti.calcGridItemWHPx=j1;Ti.calcWH=yK;Ti.calcXY=bK;Ti.clamp=sl;function S0(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function j1(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function gK(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,c=S0(e),u={};return i&&i.resizing?(u.width=Math.round(i.resizing.width),u.height=Math.round(i.resizing.height)):(u.width=j1(r,c,s[0]),u.height=j1(o,l,s[1])),i&&i.dragging?(u.top=Math.round(i.dragging.top),u.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(u.top=Math.round(i.resizing.top),u.left=Math.round(i.resizing.left)):(u.top=Math.round((l+s[1])*n+a[1]),u.left=Math.round((c+s[0])*t+a[0])),u}function bK(e,t,n,r,o){const{margin:i,containerPadding:s,cols:a,rowHeight:l,maxRows:c}=e,u=S0(e);let d=Math.round((n-s[0])/(u+i[0])),h=Math.round((t-s[1])/(l+i[1]));return d=sl(d,0,a-r),h=sl(h,0,c-o),{x:d,y:h}}function yK(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=S0(e);let d=Math.round((t+s[0])/(u+s[0])),h=Math.round((n+s[1])/(c+s[1])),p=sl(d,0,l-r),m=sl(h,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(p=sl(d,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(m=sl(h,0,a)),{w:p,h:m}}function sl(e,t,n){return Math.max(Math.min(e,n),t)}var E0={},T1={exports:{}},om={exports:{}},Dt={};/** @license React v16.13.1
37
37
  * react-is.production.min.js
38
38
  *
39
39
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-0e5ek9VV.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-mAN4JUt2.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as a } from "../chunks/index-Bb5ixhkS.js";
1
+ import { D as a } from "../chunks/index-CIiZToL_.js";
2
2
  import { EMPTY_SELECTION as e } from "../types/index.js";
3
3
  export {
4
4
  a as Dashboard,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-0e5ek9VV.js"),t=require("./types/index.cjs"),a=require("./chunks/dashboard-plus-DI4Qb6iN.js");require("react/jsx-runtime");require("react");require("react-dom");const r=["MM-DD-YYYY","YYYY-MM-DD","MM/DD/YYYY","DD/MM/YYYY","MMMM DD, YYYY","MMM DD, YYYY","DD MMM YYYY","YYYY-MM","MMMM YYYY","custom"];exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.createSqlGenConfig=e.createSqlGenConfig;exports.fmt=e.fmt;exports.getColumnDataType=e.getColumnDataType;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useCard=e.useCard;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=t.EMPTY_SELECTION;exports.ScheduleDashboard=a.ScheduleDashboard;exports.SelectComponent=a.SelectComponent;exports.Surfboard=a.DashboardPlus;exports.cleanCard=a.cleanCard;exports.downloadPdf=a.downloadPdf;exports.getDashbaordStateWithoutData=a.getDashbaordStateWithoutData;exports.DATE_FORMAT_VALUES=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-mAN4JUt2.js"),t=require("./types/index.cjs"),a=require("./chunks/dashboard-plus-g5PiBLSc.js");require("react/jsx-runtime");require("react");require("react-dom");const r=["MM-DD-YYYY","YYYY-MM-DD","MM/DD/YYYY","DD/MM/YYYY","MMMM DD, YYYY","MMM DD, YYYY","DD MMM YYYY","YYYY-MM","MMMM YYYY","custom"];exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.createSqlGenConfig=e.createSqlGenConfig;exports.fmt=e.fmt;exports.getColumnDataType=e.getColumnDataType;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useCard=e.useCard;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=t.EMPTY_SELECTION;exports.ScheduleDashboard=a.ScheduleDashboard;exports.SelectComponent=a.SelectComponent;exports.Surfboard=a.DashboardPlus;exports.cleanCard=a.cleanCard;exports.downloadPdf=a.downloadPdf;exports.getDashbaordStateWithoutData=a.getDashbaordStateWithoutData;exports.DATE_FORMAT_VALUES=r;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { D as Y, c as D, S as i, S as u, l as d, f as M, n as l, m as n, p as m, q as p, k as C, i as S, j as T, o as c, h, g as b, e as f, s as g, r as y, b as A, w as E, y as v, x, z as F, v as N, d as k, u as q, B as P, t as Q, A as _, a as w } from "./chunks/index-Bb5ixhkS.js";
1
+ import { D as Y, c as D, S as i, S as u, l as d, f as M, n as l, m as n, p as m, q as p, k as C, i as S, j as T, o as c, h, g as b, e as f, s as g, r as y, b as A, w as E, y as v, x, z as F, v as N, d as k, u as q, B as P, t as Q, A as _, a as w } from "./chunks/index-CIiZToL_.js";
2
2
  import { EMPTY_SELECTION as G } from "./types/index.js";
3
- import { S as I, a as L, D as O, c as V, d as W, g as j } from "./chunks/dashboard-plus-DzPDyise.js";
3
+ import { S as I, a as L, D as O, c as V, d as W, g as j } from "./chunks/dashboard-plus-Duk4pSYK.js";
4
4
  import "react/jsx-runtime";
5
5
  import "react";
6
6
  import "react-dom";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-plus-DI4Qb6iN.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-plus-g5PiBLSc.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as f } from "../chunks/dashboard-plus-DzPDyise.js";
1
+ import { D as f } from "../chunks/dashboard-plus-Duk4pSYK.js";
2
2
  import { EMPTY_SELECTION as a } from "../types/index.js";
3
3
  export {
4
4
  a as EMPTY_SELECTION,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.0.518",
8
+ "version": "0.0.519",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",