react-semaphor 0.0.211 → 0.0.213

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,4 +1,4 @@
1
- import { P as L, b as w, j as e, Q as ys, R as vs, U as k, V as Xs, W as Ns, X as Cs, Y as Ss, Z as ks, _ as $, $ as re, a0 as Zs, J as ea, O as Le, a1 as Ra, a2 as _a, a3 as Ha, a4 as Ba, a5 as $a, a6 as Pa, a7 as Rs, a8 as _e, a9 as Pe, aa as es, T as ws, e as sa, g as zs, ab as Fe, ac as Oe, f as Y, ad as Me, ae as Te, af as He, ag as Ae, ah as W, ai as Fs, G as i, aj as Ke, ak as Ue, al as Ka, am as Ge, w as aa, v as ta, t as me, an as Ua, r as Ga, N as na, s as Ja, ao as Qa, B as Wa, ap as ra, aq as Ya, L as Be, S as Os, z as Xa, n as _s, ar as ps, A as fs, u as ts, as as ge, at as ye, au as la, av as ia, aw as oa, ax as ca, ay as da, az as Za, aA as et, aB as ha, aC as st, aD as at, aE as tt, aF as nt, aG as rt, aH as gs, aI as lt, aJ as Re, aK as js, aL as ze, aM as bs, aN as Hs, aO as it, aP as ot, aQ as ct, aR as dt, aS as ht, aT as ms, aU as mt, aV as Bs, aW as ut, aX as $s, aY as xt, aZ as pt, a_ as ft, a$ as ma, l as gt, C as jt, E as Ps, d as bt, h as yt, i as vt, o as Nt, b0 as Ct, m as St, H as kt, b1 as wt, b2 as zt, b3 as Ft, b4 as us, b5 as Ot, b6 as xs, b7 as Ks, K as Mt, b8 as Tt, b9 as Ms, ba as Lt, bb as Ts, bc as Ee, bd as ua, be as At, bf as Et, bg as Dt, bh as It, bi as Vt, bj as qt, bk as ve, bl as R, bm as _, bn as Ls, bo as H, bp as Us, bq as Rt, br as _t, bs as Ht, bt as Bt, bu as Gs, bv as $t, bw as Pt, bx as Kt, by as Ut, bz as Gt, bA as Jt } from "./index-nvObQgx0.js";
1
+ import { P as L, b as w, j as e, Q as ys, R as vs, U as k, V as Xs, W as Ns, X as Cs, Y as Ss, Z as ks, _ as $, $ as re, a0 as Zs, J as ea, O as Le, a1 as Ra, a2 as _a, a3 as Ha, a4 as Ba, a5 as $a, a6 as Pa, a7 as Rs, a8 as _e, a9 as Pe, aa as es, T as ws, e as sa, g as zs, ab as Fe, ac as Oe, f as Y, ad as Me, ae as Te, af as He, ag as Ae, ah as W, ai as Fs, G as i, aj as Ke, ak as Ue, al as Ka, am as Ge, w as aa, v as ta, t as me, an as Ua, r as Ga, N as na, s as Ja, ao as Qa, B as Wa, ap as ra, aq as Ya, L as Be, S as Os, z as Xa, n as _s, ar as ps, A as fs, u as ts, as as ge, at as ye, au as la, av as ia, aw as oa, ax as ca, ay as da, az as Za, aA as et, aB as ha, aC as st, aD as at, aE as tt, aF as nt, aG as rt, aH as gs, aI as lt, aJ as Re, aK as js, aL as ze, aM as bs, aN as Hs, aO as it, aP as ot, aQ as ct, aR as dt, aS as ht, aT as ms, aU as mt, aV as Bs, aW as ut, aX as $s, aY as xt, aZ as pt, a_ as ft, a$ as ma, l as gt, C as jt, E as Ps, d as bt, h as yt, i as vt, o as Nt, b0 as Ct, m as St, H as kt, b1 as wt, b2 as zt, b3 as Ft, b4 as us, b5 as Ot, b6 as xs, b7 as Ks, K as Mt, b8 as Tt, b9 as Ms, ba as Lt, bb as Ts, bc as Ee, bd as ua, be as At, bf as Et, bg as Dt, bh as It, bi as Vt, bj as qt, bk as ve, bl as R, bm as _, bn as Ls, bo as H, bp as Us, bq as Rt, br as _t, bs as Ht, bt as Bt, bu as Gs, bv as $t, bw as Pt, bx as Kt, by as Ut, bz as Gt, bA as Jt } from "./index-icDf4hJ3.js";
2
2
  import ue, { useState as T, useEffect as G, useMemo as Qt, useRef as $e } from "react";
3
3
  /**
4
4
  * @license lucide-react v0.379.0 - ISC
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./index-qQHxI2VY.js"),f=require("react");/**
1
+ "use strict";const e=require("./index-WM7PvYE2.js"),f=require("react");/**
2
2
  * @license lucide-react v0.379.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -85,7 +85,7 @@ __p += '`),Mt&&(Re+=`' +
85
85
  function print() { __p += __j.call(arguments, '') }
86
86
  `:`;
87
87
  `)+Re+`return __p
88
- }`;var yt=NE(function(){return jt(z,Ye+"return "+Re).apply(n,U)});if(yt.source=Re,fb(yt))throw yt;return yt}function S8(d){return Ut(d).toLowerCase()}function C8(d){return Ut(d).toUpperCase()}function E8(d,p,y){if(d=Ut(d),d&&(y||p===n))return US(d);if(!d||!(p=Vr(p)))return d;var R=jo(d),M=jo(p),z=qS(R,M),U=GS(R,M)+1;return Os(R,z,U).join("")}function R8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.slice(0,KS(d)+1);if(!d||!(p=Vr(p)))return d;var R=jo(d),M=GS(R,jo(p))+1;return Os(R,0,M).join("")}function O8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.replace(jn,"");if(!d||!(p=Vr(p)))return d;var R=jo(d),M=qS(R,jo(p));return Os(R,M).join("")}function P8(d,p){var y=A,R=L;if(wn(p)){var M="separator"in p?p.separator:M;y="length"in p?pt(p.length):y,R="omission"in p?Vr(p.omission):R}d=Ut(d);var z=d.length;if(Nl(d)){var U=jo(d);z=U.length}if(y>=z)return d;var X=y-Ll(R);if(X<1)return R;var se=U?Os(U,0,X).join(""):d.slice(0,X);if(M===n)return se+R;if(U&&(X+=se.length-X),hb(M)){if(d.slice(X).search(M)){var xe,we=se;for(M.global||(M=Tv(M.source,Ut(qe.exec(M))+"g")),M.lastIndex=0;xe=M.exec(we);)var Re=xe.index;se=se.slice(0,Re===n?X:Re)}}else if(d.indexOf(Vr(M),X)!=X){var je=se.lastIndexOf(M);je>-1&&(se=se.slice(0,je))}return se+R}function T8(d){return d=Ut(d),d&&On.test(d)?d.replace(Xt,oF):d}var D8=Wl(function(d,p,y){return d+(y?" ":"")+p.toUpperCase()}),mb=LC("toUpperCase");function IE(d,p,y){return d=Ut(d),p=y?n:p,p===n?Z3(d)?aF(d):W3(d):d.match(p)||[]}var NE=St(function(d,p){try{return zr(d,n,p)}catch(y){return fb(y)?y:new ct(y)}}),$8=Fi(function(d,p){return mo(p,function(y){y=ai(y),Ni(d,y,ub(d[y],d))}),d});function A8(d){var p=d==null?0:d.length,y=Je();return d=p?yn(d,function(R){if(typeof R[1]!="function")throw new vo(s);return[y(R[0]),R[1]]}):[],St(function(R){for(var M=-1;++M<p;){var z=d[M];if(zr(z[0],this,R))return zr(z[1],this,R)}})}function k8(d){return o7(yo(d,f))}function vb(d){return function(){return d}}function M8(d,p){return d==null||d!==d?p:d}var I8=jC(),N8=jC(!0);function Rr(d){return d}function bb(d){return gC(typeof d=="function"?d:yo(d,f))}function L8(d){return vC(yo(d,f))}function F8(d,p){return bC(d,yo(p,f))}var j8=St(function(d,p){return function(y){return Su(y,d,p)}}),z8=St(function(d,p){return function(y){return Su(d,y,p)}});function yb(d,p,y){var R=Bn(p),M=_h(p,R);y==null&&!(wn(p)&&(M.length||!R.length))&&(y=p,p=d,d=this,M=_h(p,Bn(p)));var z=!(wn(y)&&"chain"in y)||!!y.chain,U=zi(d);return mo(M,function(X){var se=p[X];d[X]=se,U&&(d.prototype[X]=function(){var xe=this.__chain__;if(z||xe){var we=d(this.__wrapped__),Re=we.__actions__=Sr(this.__actions__);return Re.push({func:se,args:arguments,thisArg:d}),we.__chain__=xe,we}return se.apply(d,ws([this.value()],arguments))})}),d}function B8(){return qn._===this&&(qn._=hF),this}function xb(){}function V8(d){return d=pt(d),St(function(p){return yC(p,d)})}var H8=Qv(yn),W8=Qv(zS),U8=Qv(_v);function LE(d){return ob(d)?Sv(ai(d)):w7(d)}function q8(d){return function(p){return d==null?n:Ea(d,p)}}var G8=BC(),Y8=BC(!0);function wb(){return[]}function _b(){return!1}function K8(){return{}}function X8(){return""}function Q8(){return!0}function J8(d,p){if(d=pt(d),d<1||d>Y)return[];var y=H,R=nr(d,H);p=Je(p),d-=H;for(var M=Rv(R,p);++y<d;)p(y);return M}function Z8(d){return ut(d)?yn(d,ai):Hr(d)?[d]:Sr(rE(Ut(d)))}function ej(d){var p=++dF;return Ut(d)+p}var tj=Ph(function(d,p){return d+p},0),nj=Jv("ceil"),rj=Ph(function(d,p){return d/p},1),oj=Jv("floor");function ij(d){return d&&d.length?wh(d,Rr,Lv):n}function sj(d,p){return d&&d.length?wh(d,Je(p,2),Lv):n}function aj(d){return HS(d,Rr)}function lj(d,p){return HS(d,Je(p,2))}function cj(d){return d&&d.length?wh(d,Rr,Bv):n}function uj(d,p){return d&&d.length?wh(d,Je(p,2),Bv):n}var dj=Ph(function(d,p){return d*p},1),fj=Jv("round"),hj=Ph(function(d,p){return d-p},0);function pj(d){return d&&d.length?Ev(d,Rr):0}function gj(d,p){return d&&d.length?Ev(d,Je(p,2)):0}return F.after=L9,F.ary=pE,F.assign=C4,F.assignIn=PE,F.assignInWith=Bh,F.assignWith=E4,F.at=R4,F.before=gE,F.bind=ub,F.bindAll=$8,F.bindKey=mE,F.castArray=K9,F.chain=dE,F.chunk=o6,F.compact=i6,F.concat=s6,F.cond=A8,F.conforms=k8,F.constant=vb,F.countBy=p9,F.create=O4,F.curry=vE,F.curryRight=bE,F.debounce=yE,F.defaults=P4,F.defaultsDeep=T4,F.defer=F9,F.delay=j9,F.difference=a6,F.differenceBy=l6,F.differenceWith=c6,F.drop=u6,F.dropRight=d6,F.dropRightWhile=f6,F.dropWhile=h6,F.fill=p6,F.filter=m9,F.flatMap=y9,F.flatMapDeep=x9,F.flatMapDepth=w9,F.flatten=aE,F.flattenDeep=g6,F.flattenDepth=m6,F.flip=z9,F.flow=I8,F.flowRight=N8,F.fromPairs=v6,F.functions=N4,F.functionsIn=L4,F.groupBy=_9,F.initial=y6,F.intersection=x6,F.intersectionBy=w6,F.intersectionWith=_6,F.invert=j4,F.invertBy=z4,F.invokeMap=C9,F.iteratee=bb,F.keyBy=E9,F.keys=Bn,F.keysIn=Er,F.map=Ih,F.mapKeys=V4,F.mapValues=H4,F.matches=L8,F.matchesProperty=F8,F.memoize=Lh,F.merge=W4,F.mergeWith=TE,F.method=j8,F.methodOf=z8,F.mixin=yb,F.negate=Fh,F.nthArg=V8,F.omit=U4,F.omitBy=q4,F.once=B9,F.orderBy=R9,F.over=H8,F.overArgs=V9,F.overEvery=W8,F.overSome=U8,F.partial=db,F.partialRight=xE,F.partition=O9,F.pick=G4,F.pickBy=DE,F.property=LE,F.propertyOf=q8,F.pull=R6,F.pullAll=cE,F.pullAllBy=O6,F.pullAllWith=P6,F.pullAt=T6,F.range=G8,F.rangeRight=Y8,F.rearg=H9,F.reject=D9,F.remove=D6,F.rest=W9,F.reverse=lb,F.sampleSize=A9,F.set=K4,F.setWith=X4,F.shuffle=k9,F.slice=$6,F.sortBy=N9,F.sortedUniq=F6,F.sortedUniqBy=j6,F.split=y8,F.spread=U9,F.tail=z6,F.take=B6,F.takeRight=V6,F.takeRightWhile=H6,F.takeWhile=W6,F.tap=i9,F.throttle=q9,F.thru=Mh,F.toArray=EE,F.toPairs=$E,F.toPairsIn=AE,F.toPath=Z8,F.toPlainObject=OE,F.transform=Q4,F.unary=G9,F.union=U6,F.unionBy=q6,F.unionWith=G6,F.uniq=Y6,F.uniqBy=K6,F.uniqWith=X6,F.unset=J4,F.unzip=cb,F.unzipWith=uE,F.update=Z4,F.updateWith=e8,F.values=Gl,F.valuesIn=t8,F.without=Q6,F.words=IE,F.wrap=Y9,F.xor=J6,F.xorBy=Z6,F.xorWith=e9,F.zip=t9,F.zipObject=n9,F.zipObjectDeep=r9,F.zipWith=o9,F.entries=$E,F.entriesIn=AE,F.extend=PE,F.extendWith=Bh,yb(F,F),F.add=tj,F.attempt=NE,F.camelCase=i8,F.capitalize=kE,F.ceil=nj,F.clamp=n8,F.clone=X9,F.cloneDeep=J9,F.cloneDeepWith=Z9,F.cloneWith=Q9,F.conformsTo=e4,F.deburr=ME,F.defaultTo=M8,F.divide=rj,F.endsWith=s8,F.eq=Bo,F.escape=a8,F.escapeRegExp=l8,F.every=g9,F.find=v9,F.findIndex=iE,F.findKey=D4,F.findLast=b9,F.findLastIndex=sE,F.findLastKey=$4,F.floor=oj,F.forEach=fE,F.forEachRight=hE,F.forIn=A4,F.forInRight=k4,F.forOwn=M4,F.forOwnRight=I4,F.get=pb,F.gt=t4,F.gte=n4,F.has=F4,F.hasIn=gb,F.head=lE,F.identity=Rr,F.includes=S9,F.indexOf=b6,F.inRange=r8,F.invoke=B4,F.isArguments=Pa,F.isArray=ut,F.isArrayBuffer=r4,F.isArrayLike=Cr,F.isArrayLikeObject=Pn,F.isBoolean=o4,F.isBuffer=Ps,F.isDate=i4,F.isElement=s4,F.isEmpty=a4,F.isEqual=l4,F.isEqualWith=c4,F.isError=fb,F.isFinite=u4,F.isFunction=zi,F.isInteger=wE,F.isLength=jh,F.isMap=_E,F.isMatch=d4,F.isMatchWith=f4,F.isNaN=h4,F.isNative=p4,F.isNil=m4,F.isNull=g4,F.isNumber=SE,F.isObject=wn,F.isObjectLike=Sn,F.isPlainObject=Tu,F.isRegExp=hb,F.isSafeInteger=v4,F.isSet=CE,F.isString=zh,F.isSymbol=Hr,F.isTypedArray=ql,F.isUndefined=b4,F.isWeakMap=y4,F.isWeakSet=x4,F.join=S6,F.kebabCase=c8,F.last=wo,F.lastIndexOf=C6,F.lowerCase=u8,F.lowerFirst=d8,F.lt=w4,F.lte=_4,F.max=ij,F.maxBy=sj,F.mean=aj,F.meanBy=lj,F.min=cj,F.minBy=uj,F.stubArray=wb,F.stubFalse=_b,F.stubObject=K8,F.stubString=X8,F.stubTrue=Q8,F.multiply=dj,F.nth=E6,F.noConflict=B8,F.noop=xb,F.now=Nh,F.pad=f8,F.padEnd=h8,F.padStart=p8,F.parseInt=g8,F.random=o8,F.reduce=P9,F.reduceRight=T9,F.repeat=m8,F.replace=v8,F.result=Y4,F.round=fj,F.runInContext=ne,F.sample=$9,F.size=M9,F.snakeCase=b8,F.some=I9,F.sortedIndex=A6,F.sortedIndexBy=k6,F.sortedIndexOf=M6,F.sortedLastIndex=I6,F.sortedLastIndexBy=N6,F.sortedLastIndexOf=L6,F.startCase=x8,F.startsWith=w8,F.subtract=hj,F.sum=pj,F.sumBy=gj,F.template=_8,F.times=J8,F.toFinite=Bi,F.toInteger=pt,F.toLength=RE,F.toLower=S8,F.toNumber=_o,F.toSafeInteger=S4,F.toString=Ut,F.toUpper=C8,F.trim=E8,F.trimEnd=R8,F.trimStart=O8,F.truncate=P8,F.unescape=T8,F.uniqueId=ej,F.upperCase=D8,F.upperFirst=mb,F.each=fE,F.eachRight=hE,F.first=lE,yb(F,function(){var d={};return ii(F,function(p,y){Qt.call(F.prototype,y)||(d[y]=p)}),d}(),{chain:!1}),F.VERSION=r,mo(["bind","bindKey","curry","curryRight","partial","partialRight"],function(d){F[d].placeholder=F}),mo(["drop","take"],function(d,p){kt.prototype[d]=function(y){y=y===n?1:Mn(pt(y),0);var R=this.__filtered__&&!p?new kt(this):this.clone();return R.__filtered__?R.__takeCount__=nr(y,R.__takeCount__):R.__views__.push({size:nr(y,H),type:d+(R.__dir__<0?"Right":"")}),R},kt.prototype[d+"Right"]=function(y){return this.reverse()[d](y).reverse()}}),mo(["filter","map","takeWhile"],function(d,p){var y=p+1,R=y==Z||y==Q;kt.prototype[d]=function(M){var z=this.clone();return z.__iteratees__.push({iteratee:Je(M,3),type:y}),z.__filtered__=z.__filtered__||R,z}}),mo(["head","last"],function(d,p){var y="take"+(p?"Right":"");kt.prototype[d]=function(){return this[y](1).value()[0]}}),mo(["initial","tail"],function(d,p){var y="drop"+(p?"":"Right");kt.prototype[d]=function(){return this.__filtered__?new kt(this):this[y](1)}}),kt.prototype.compact=function(){return this.filter(Rr)},kt.prototype.find=function(d){return this.filter(d).head()},kt.prototype.findLast=function(d){return this.reverse().find(d)},kt.prototype.invokeMap=St(function(d,p){return typeof d=="function"?new kt(this):this.map(function(y){return Su(y,d,p)})}),kt.prototype.reject=function(d){return this.filter(Fh(Je(d)))},kt.prototype.slice=function(d,p){d=pt(d);var y=this;return y.__filtered__&&(d>0||p<0)?new kt(y):(d<0?y=y.takeRight(-d):d&&(y=y.drop(d)),p!==n&&(p=pt(p),y=p<0?y.dropRight(-p):y.take(p-d)),y)},kt.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},kt.prototype.toArray=function(){return this.take(H)},ii(kt.prototype,function(d,p){var y=/^(?:filter|find|map|reject)|While$/.test(p),R=/^(?:head|last)$/.test(p),M=F[R?"take"+(p=="last"?"Right":""):p],z=R||/^find/.test(p);M&&(F.prototype[p]=function(){var U=this.__wrapped__,X=R?[1]:arguments,se=U instanceof kt,xe=X[0],we=se||ut(U),Re=function(Pt){var Mt=M.apply(F,ws([Pt],X));return R&&je?Mt[0]:Mt};we&&y&&typeof xe=="function"&&xe.length!=1&&(se=we=!1);var je=this.__chain__,Ye=!!this.__actions__.length,et=z&&!je,yt=se&&!Ye;if(!z&&we){U=yt?U:new kt(this);var tt=d.apply(U,X);return tt.__actions__.push({func:Mh,args:[Re],thisArg:n}),new bo(tt,je)}return et&&yt?d.apply(this,X):(tt=this.thru(Re),et?R?tt.value()[0]:tt.value():tt)})}),mo(["pop","push","shift","sort","splice","unshift"],function(d){var p=sh[d],y=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",R=/^(?:pop|shift)$/.test(d);F.prototype[d]=function(){var M=arguments;if(R&&!this.__chain__){var z=this.value();return p.apply(ut(z)?z:[],M)}return this[y](function(U){return p.apply(ut(U)?U:[],M)})}}),ii(kt.prototype,function(d,p){var y=F[p];if(y){var R=y.name+"";Qt.call(Bl,R)||(Bl[R]=[]),Bl[R].push({name:p,func:y})}}),Bl[Oh(n,x).name]=[{name:"wrapper",func:n}],kt.prototype.clone=TF,kt.prototype.reverse=DF,kt.prototype.value=$F,F.prototype.at=s9,F.prototype.chain=a9,F.prototype.commit=l9,F.prototype.next=c9,F.prototype.plant=d9,F.prototype.reverse=f9,F.prototype.toJSON=F.prototype.valueOf=F.prototype.value=h9,F.prototype.first=F.prototype.head,mu&&(F.prototype[mu]=u9),F},Fl=lF();xa?((xa.exports=Fl)._=Fl,bv._=Fl):qn._=Fl}).call(Vs)})(pg,pg.exports);var uc=pg.exports;const ol=nu(uc);function rR({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};return t||(t={}),yw.forEach(l=>{t!=null&&t[l]||(t={...t,[l]:[]});const c=t[l].reduce((u,f)=>Math.max(u,f.y+f.h),0);a.y=a.y===0?0:c,t[l].push(a)}),t}function oR(e,t){t&&yw.forEach(n=>{t!=null&&t[n]&&(t[n]=t[n].filter(r=>r.i!==e))})}const ke=Z2()(sD((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:_0},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!0,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{deleteSheet:n=>{e(r=>{var i,s,a,l;const o=(i=r.dashboard.sheets)==null?void 0:i.findIndex(c=>c.id===n);o!==void 0&&o>-1&&((s=r.dashboard.sheets)==null||s.splice(o,1),r.selectedSheetId=(l=(a=r.dashboard.sheets)==null?void 0:a[0])==null?void 0:l.id)})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const o=r.dashboard.filters;let i={};o==null||o.forEach(a=>{yw.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})},setIsSessionExpired:n=>{e(()=>({isSessionExpired:n}))},setCardPython:(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===o.selectedSheetId);i&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.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}))},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}),setBookmarkKey:n=>{e(()=>({bookmarkKey:n}))},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;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.title=o)})})},setCardInfo:(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===o.selectedSheetId);i&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.info=r)})})},setCardDescription:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.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(f=>f.id===n);if(s){const f=(c=s.cards)==null?void 0:c.find(h=>h.id===r);f&&(f.sql=o,(u=i.onUpdateCard)==null||u.call(i,f,n))}})},setFrameCardData:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.data=o)})})},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;const i=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(c=>c.filterId===o.filterId);i!==void 0&&i>-1?(a=r.filterValues)==null||a.splice(i,1,o):(l=r.filterValues)==null||l.push(o)}):r.filterValues=n})},removeFilterValue: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];const o=(s=r.dashboard.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId);rR({id:n.id,layouts:o==null?void 0:o.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);const l=(s=r.dashboard.sheets)==null?void 0:s.find(c=>c.id===r.selectedSheetId);oR(n,l==null?void 0:l.layouts)}}})},updateFrameCard:(n,r,o)=>{e(i=>{var l,c,u,f,h;const s=(c=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(g=>g.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(g=>g.id===r);if(a){const g=(f=a.cards)==null?void 0:f.findIndex(v=>v.id===o.id);g>-1&&((h=a.cards)==null||h.splice(g,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))}})},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(f=>f.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let f=1/0,h=0;o==="start"&&(f=0),rR({id:r.id,layouts:s.layouts,minH:10,x:h,y:f}),(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(f=>f.id===n);if(i){const f=(l=i.frames)==null?void 0:l.findIndex(h=>h.id===r);console.log(f),typeof f=="number"&&f>-1&&((c=i.frames)==null||c.splice(f,1),(u=i.layout)==null||u.splice(f,1),oR(r,i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,c,u;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n),s=(c=i==null?void 0:i.frames)==null?void 0:c.findIndex(f=>f.id===r.id);i&&((u=i.frames)==null||u.splice(s,1,r))})},updateCard:(n,r)=>{e(o=>{var a,l,c,u,f;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),(f=o.onUpdateCard)==null||f.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,c,u,f,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(g=>g.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(g=>g.id===r.id);i&&((u=i.cards)==null||u.splice(s,1),(f=i.layout)==null||f.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}))},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)},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)=>{Nz({card:n,dataPoint:r,set:e,get:t})}}}))),Mo=()=>ke(e=>e.actions);var Tf=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(){}},Hc=typeof window>"u"||"Deno"in window;function Oo(){}function Lz(e,t){return typeof e=="function"?e(t):e}function C0(e){return typeof e=="number"&&e>=0&&e!==1/0}function fD(e,t){return Math.max(e+(t||0)-Date.now(),0)}function iR(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==_w(s,t.options))return!1}else if(!$d(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||typeof o<"u"&&o!==t.state.fetchStatus||i&&!i(t))}function sR(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Dd(t.options.mutationKey)!==Dd(i))return!1}else if(!$d(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function _w(e,t){return((t==null?void 0:t.queryKeyHashFn)||Dd)(e)}function Dd(e){return JSON.stringify(e,(t,n)=>R0(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function $d(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!$d(e[n],t[n])):!1}function hD(e,t){if(e===t)return e;const n=aR(e)&&aR(t);if(n||R0(e)&&R0(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&&e[u]===void 0&&t[u]===void 0&&r.includes(u)?(a[u]=void 0,l++):(a[u]=hD(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function E0(e,t){if(e&&!t||t&&!e)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function aR(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function R0(e){if(!lR(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!lR(n)||!n.hasOwnProperty("isPrototypeOf"))}function lR(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fz(e){return new Promise(t=>{setTimeout(t,e)})}function O0(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?hD(e,t):t}function jz(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function zz(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xa,Hs,Cc,I2,Bz=(I2=class extends Tf{constructor(){super();Xe(this,Xa,void 0);Xe(this,Hs,void 0);Xe(this,Cc,void 0);Ve(this,Cc,t=>{if(!Hc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){re(this,Hs)||this.setEventListener(re(this,Cc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Hs))==null||t.call(this),Ve(this,Hs,void 0))}setEventListener(t){var n;Ve(this,Cc,t),(n=re(this,Hs))==null||n.call(this),Ve(this,Hs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){re(this,Xa)!==t&&(Ve(this,Xa,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof re(this,Xa)=="boolean"?re(this,Xa):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Xa=new WeakMap,Hs=new WeakMap,Cc=new WeakMap,I2),gg=new Bz,Ec,Ws,Rc,N2,Vz=(N2=class extends Tf{constructor(){super();Xe(this,Ec,!0);Xe(this,Ws,void 0);Xe(this,Rc,void 0);Ve(this,Rc,t=>{if(!Hc&&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(){re(this,Ws)||this.setEventListener(re(this,Rc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Ws))==null||t.call(this),Ve(this,Ws,void 0))}setEventListener(t){var n;Ve(this,Rc,t),(n=re(this,Ws))==null||n.call(this),Ve(this,Ws,t(this.setOnline.bind(this)))}setOnline(t){re(this,Ec)!==t&&(Ve(this,Ec,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return re(this,Ec)}},Ec=new WeakMap,Ws=new WeakMap,Rc=new WeakMap,N2),mg=new Vz;function Hz(e){return Math.min(1e3*2**e,3e4)}function sm(e){return(e??"online")==="online"?mg.isOnline():!0}var pD=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function $b(e){return e instanceof pD}function gD(e){let t=!1,n=0,r=!1,o,i,s;const a=new Promise((w,x)=>{i=w,s=x}),l=w=>{var x;r||(g(new pD(w)),(x=e.abort)==null||x.call(e))},c=()=>{t=!0},u=()=>{t=!1},f=()=>!gg.isFocused()||e.networkMode!=="always"&&!mg.isOnline(),h=w=>{var x;r||(r=!0,(x=e.onSuccess)==null||x.call(e,w),o==null||o(),i(w))},g=w=>{var x;r||(r=!0,(x=e.onError)==null||x.call(e,w),o==null||o(),s(w))},v=()=>new Promise(w=>{var x;o=_=>{const S=r||!f();return S&&w(_),S},(x=e.onPause)==null||x.call(e)}).then(()=>{var w;o=void 0,r||(w=e.onContinue)==null||w.call(e)}),b=()=>{if(r)return;let w;try{w=e.fn()}catch(x){w=Promise.reject(x)}Promise.resolve(w).then(h).catch(x=>{var P;if(r)return;const _=e.retry??(Hc?0:3),S=e.retryDelay??Hz,C=typeof S=="function"?S(n,x):S,E=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,x);if(t||!E){g(x);return}n++,(P=e.onFail)==null||P.call(e,n,x),Fz(C).then(()=>{if(f())return v()}).then(()=>{t?g(x):b()})})};return sm(e.networkMode)?b():v().then(b),{promise:a,cancel:l,continue:()=>(o==null?void 0:o())?a:Promise.resolve(),cancelRetry:c,continueRetry:u}}function Wz(){let e=[],t=0,n=h=>{h()},r=h=>{h()},o=h=>setTimeout(h,0);const i=h=>{o=h},s=h=>{let g;t++;try{g=h()}finally{t--,t||c()}return g},a=h=>{t?e.push(h):o(()=>{n(h)})},l=h=>(...g)=>{a(()=>{h(...g)})},c=()=>{const h=e;e=[],h.length&&o(()=>{r(()=>{h.forEach(g=>{n(g)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:h=>{n=h},setBatchNotifyFunction:h=>{r=h},setScheduler:i}}var Xn=Wz(),Qa,L2,mD=(L2=class{constructor(){Xe(this,Qa,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),C0(this.gcTime)&&Ve(this,Qa,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hc?1/0:5*60*1e3))}clearGcTimeout(){re(this,Qa)&&(clearTimeout(re(this,Qa)),Ve(this,Qa,void 0))}},Qa=new WeakMap,L2),Oc,Pc,Co,Us,Eo,Vn,gf,Ja,Tc,Xp,Go,qi,F2,Uz=(F2=class extends mD{constructor(t){super();Xe(this,Tc);Xe(this,Go);Xe(this,Oc,void 0);Xe(this,Pc,void 0);Xe(this,Co,void 0);Xe(this,Us,void 0);Xe(this,Eo,void 0);Xe(this,Vn,void 0);Xe(this,gf,void 0);Xe(this,Ja,void 0);Ve(this,Ja,!1),Ve(this,gf,t.defaultOptions),Ct(this,Tc,Xp).call(this,t.options),Ve(this,Vn,[]),Ve(this,Co,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ve(this,Oc,t.state||qz(this.options)),this.state=re(this,Oc),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!re(this,Vn).length&&this.state.fetchStatus==="idle"&&re(this,Co).remove(this)}setData(t,n){const r=O0(this.state.data,t,this.options);return Ct(this,Go,qi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ct(this,Go,qi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=re(this,Us);return(r=re(this,Eo))==null||r.cancel(t),n?n.then(Oo).catch(Oo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(re(this,Oc))}isActive(){return re(this,Vn).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||re(this,Vn).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!fD(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}onOnline(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}addObserver(t){re(this,Vn).includes(t)||(re(this,Vn).push(t),this.clearGcTimeout(),re(this,Co).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){re(this,Vn).includes(t)&&(Ve(this,Vn,re(this,Vn).filter(n=>n!==t)),re(this,Vn).length||(re(this,Eo)&&(re(this,Ja)?re(this,Eo).cancel({revert:!0}):re(this,Eo).cancelRetry()),this.scheduleGc()),re(this,Co).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return re(this,Vn).length}invalidate(){this.state.isInvalidated||Ct(this,Go,qi).call(this,{type:"invalidate"})}fetch(t,n){var c,u,f,h;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(re(this,Us))return(c=re(this,Eo))==null||c.continueRetry(),re(this,Us)}if(t&&Ct(this,Tc,Xp).call(this,t),!this.options.queryFn){const g=re(this,Vn).find(v=>v.options.queryFn);g&&Ct(this,Tc,Xp).call(this,g.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={queryKey:this.queryKey,meta:this.meta},i=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(Ve(this,Ja,!0),r.signal)})};i(o);const s=()=>this.options.queryFn?(Ve(this,Ja,!1),this.options.persister?this.options.persister(this.options.queryFn,o,this):this.options.queryFn(o)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};i(a),(u=this.options.behavior)==null||u.onFetch(a,this),Ve(this,Pc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&Ct(this,Go,qi).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=g=>{var v,b,w,x;$b(g)&&g.silent||Ct(this,Go,qi).call(this,{type:"error",error:g}),$b(g)||((b=(v=re(this,Co).config).onError)==null||b.call(v,g,this),(x=(w=re(this,Co).config).onSettled)==null||x.call(w,this.state.data,g,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return Ve(this,Eo,gD({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var v,b,w,x;if(typeof g>"u"){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}`),l(new Error(`${this.queryHash} data is undefined`));return}this.setData(g),(b=(v=re(this,Co).config).onSuccess)==null||b.call(v,g,this),(x=(w=re(this,Co).config).onSettled)==null||x.call(w,g,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(g,v)=>{Ct(this,Go,qi).call(this,{type:"failed",failureCount:g,error:v})},onPause:()=>{Ct(this,Go,qi).call(this,{type:"pause"})},onContinue:()=>{Ct(this,Go,qi).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),Ve(this,Us,re(this,Eo).promise),re(this,Us)}},Oc=new WeakMap,Pc=new WeakMap,Co=new WeakMap,Us=new WeakMap,Eo=new WeakMap,Vn=new WeakMap,gf=new WeakMap,Ja=new WeakMap,Tc=new WeakSet,Xp=function(t){this.options={...re(this,gf),...t},this.updateGcTime(this.options.gcTime)},Go=new WeakSet,qi=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,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:sm(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};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 $b(o)&&o.revert&&re(this,Pc)?{...re(this,Pc),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),Xn.batch(()=>{re(this,Vn).forEach(r=>{r.onQueryUpdate()}),re(this,Co).notify({query:this,type:"updated",action:t})})},F2);function qz(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=typeof t<"u",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 fi,j2,vD=(j2=class extends Tf{constructor(t={}){super();Xe(this,fi,void 0);this.config=t,Ve(this,fi,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??_w(o,n);let s=this.get(i);return s||(s=new Uz({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){re(this,fi).has(t.queryHash)||(re(this,fi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=re(this,fi).get(t.queryHash);n&&(t.destroy(),n===t&&re(this,fi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Xn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return re(this,fi).get(t)}getAll(){return[...re(this,fi).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>iR(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>iR(t,r)):n}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fi=new WeakMap,j2),hi,mf,Xr,Dc,pi,Ls,z2,Gz=(z2=class extends mD{constructor(t){super();Xe(this,pi);Xe(this,hi,void 0);Xe(this,mf,void 0);Xe(this,Xr,void 0);Xe(this,Dc,void 0);this.mutationId=t.mutationId,Ve(this,mf,t.defaultOptions),Ve(this,Xr,t.mutationCache),Ve(this,hi,[]),this.state=t.state||Yz(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...re(this,mf),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){re(this,hi).includes(t)||(re(this,hi).push(t),this.clearGcTimeout(),re(this,Xr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ve(this,hi,re(this,hi).filter(n=>n!==t)),this.scheduleGc(),re(this,Xr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){re(this,hi).length||(this.state.status==="pending"?this.scheduleGc():re(this,Xr).remove(this))}continue(){var t;return((t=re(this,Dc))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,c,u,f,h,g,v,b,w,x,_,S,C,E,P,$;const n=()=>(Ve(this,Dc,gD({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(k,I)=>{Ct(this,pi,Ls).call(this,{type:"failed",failureCount:k,error:I})},onPause:()=>{Ct(this,pi,Ls).call(this,{type:"pause"})},onContinue:()=>{Ct(this,pi,Ls).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),re(this,Dc).promise),r=this.state.status==="pending";try{if(!r){Ct(this,pi,Ls).call(this,{type:"pending",variables:t}),await((i=(o=re(this,Xr).config).onMutate)==null?void 0:i.call(o,t,this));const I=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));I!==this.state.context&&Ct(this,pi,Ls).call(this,{type:"pending",context:I,variables:t})}const k=await n();return await((c=(l=re(this,Xr).config).onSuccess)==null?void 0:c.call(l,k,t,this.state.context,this)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context)),await((g=(h=re(this,Xr).config).onSettled)==null?void 0:g.call(h,k,null,this.state.variables,this.state.context,this)),await((b=(v=this.options).onSettled)==null?void 0:b.call(v,k,null,t,this.state.context)),Ct(this,pi,Ls).call(this,{type:"success",data:k}),k}catch(k){try{throw await((x=(w=re(this,Xr).config).onError)==null?void 0:x.call(w,k,t,this.state.context,this)),await((S=(_=this.options).onError)==null?void 0:S.call(_,k,t,this.state.context)),await((E=(C=re(this,Xr).config).onSettled)==null?void 0:E.call(C,void 0,k,this.state.variables,this.state.context,this)),await(($=(P=this.options).onSettled)==null?void 0:$.call(P,void 0,k,t,this.state.context)),k}finally{Ct(this,pi,Ls).call(this,{type:"error",error:k})}}}},hi=new WeakMap,mf=new WeakMap,Xr=new WeakMap,Dc=new WeakMap,pi=new WeakSet,Ls=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:!sm(this.options.networkMode),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),Xn.batch(()=>{re(this,hi).forEach(r=>{r.onMutationUpdate(t)}),re(this,Xr).notify({mutation:this,type:"updated",action:t})})},z2);function Yz(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ro,vf,Za,B2,Kz=(B2=class extends Tf{constructor(t={}){super();Xe(this,Ro,void 0);Xe(this,vf,void 0);Xe(this,Za,void 0);this.config=t,Ve(this,Ro,[]),Ve(this,vf,0)}build(t,n,r){const o=new Gz({mutationCache:this,mutationId:++Vh(this,vf)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){re(this,Ro).push(t),this.notify({type:"added",mutation:t})}remove(t){Ve(this,Ro,re(this,Ro).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){Xn.batch(()=>{re(this,Ro).forEach(t=>{this.remove(t)})})}getAll(){return re(this,Ro)}find(t){const n={exact:!0,...t};return re(this,Ro).find(r=>sR(n,r))}findAll(t={}){return re(this,Ro).filter(n=>sR(t,n))}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return Ve(this,Za,(re(this,Za)??Promise.resolve()).then(()=>{const t=re(this,Ro).filter(n=>n.state.isPaused);return Xn.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Oo)),Promise.resolve()))}).then(()=>{Ve(this,Za,void 0)})),re(this,Za)}},Ro=new WeakMap,vf=new WeakMap,Za=new WeakMap,B2);function Xz(e){return{onFetch:(t,n)=>{const r=async()=>{var v,b,w,x,_;const o=t.options,i=(w=(b=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:b.fetchMore)==null?void 0:w.direction,s=((x=t.state.data)==null?void 0:x.pages)||[],a=((_=t.state.data)==null?void 0:_.pageParams)||[],l={pages:[],pageParams:[]};let c=!1;const u=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},f=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),h=async(S,C,E)=>{if(c)return Promise.reject();if(C==null&&S.pages.length)return Promise.resolve(S);const P={queryKey:t.queryKey,pageParam:C,direction:E?"backward":"forward",meta:t.options.meta};u(P);const $=await f(P),{maxPages:k}=t.options,I=E?zz:jz;return{pages:I(S.pages,$,k),pageParams:I(S.pageParams,C,k)}};let g;if(i&&s.length){const S=i==="backward",C=S?Qz:cR,E={pages:s,pageParams:a},P=C(o,E);g=await h(E,P,S)}else{g=await h(l,a[0]??o.initialPageParam);const S=e??s.length;for(let C=1;C<S;C++){const E=cR(o,g);g=await h(g,E)}}return g};t.options.persister?t.fetchFn=()=>{var o,i;return(i=(o=t.options).persister)==null?void 0:i.call(o,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function cR(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function Qz(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var In,qs,Gs,$c,Ac,Ys,kc,Mc,V2,Jz=(V2=class{constructor(e={}){Xe(this,In,void 0);Xe(this,qs,void 0);Xe(this,Gs,void 0);Xe(this,$c,void 0);Xe(this,Ac,void 0);Xe(this,Ys,void 0);Xe(this,kc,void 0);Xe(this,Mc,void 0);Ve(this,In,e.queryCache||new vD),Ve(this,qs,e.mutationCache||new Kz),Ve(this,Gs,e.defaultOptions||{}),Ve(this,$c,new Map),Ve(this,Ac,new Map),Ve(this,Ys,0)}mount(){Vh(this,Ys)._++,re(this,Ys)===1&&(Ve(this,kc,gg.subscribe(()=>{gg.isFocused()&&(this.resumePausedMutations(),re(this,In).onFocus())})),Ve(this,Mc,mg.subscribe(()=>{mg.isOnline()&&(this.resumePausedMutations(),re(this,In).onOnline())})))}unmount(){var e,t;Vh(this,Ys)._--,re(this,Ys)===0&&((e=re(this,kc))==null||e.call(this),Ve(this,kc,void 0),(t=re(this,Mc))==null||t.call(this),Ve(this,Mc,void 0))}isFetching(e){return re(this,In).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return re(this,qs).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=re(this,In).find({queryKey:e}))==null?void 0:t.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=re(this,In).find({queryKey:e}),o=r==null?void 0:r.state.data,i=Lz(t,o);if(typeof i>"u")return;const s=this.defaultQueryOptions({queryKey:e});return re(this,In).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Xn.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=re(this,In).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=re(this,In);Xn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=re(this,In),r={type:"active",...e};return Xn.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=Xn.batch(()=>re(this,In).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Oo).catch(Oo)}invalidateQueries(e={},t={}){return Xn.batch(()=>{if(re(this,In).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=Xn.batch(()=>re(this,In).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Oo)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Oo)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=re(this,In).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Oo).catch(Oo)}fetchInfiniteQuery(e){return e.behavior=Xz(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Oo).catch(Oo)}resumePausedMutations(){return re(this,qs).resumePausedMutations()}getQueryCache(){return re(this,In)}getMutationCache(){return re(this,qs)}getDefaultOptions(){return re(this,Gs)}setDefaultOptions(e){Ve(this,Gs,e)}setQueryDefaults(e,t){re(this,$c).set(Dd(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...re(this,$c).values()];let n={};return t.forEach(r=>{$d(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){re(this,Ac).set(Dd(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...re(this,Ac).values()];let n={};return t.forEach(r=>{$d(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...re(this,Gs).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=_w(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...re(this,Gs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){re(this,In).clear(),re(this,qs).clear()}},In=new WeakMap,qs=new WeakMap,Gs=new WeakMap,$c=new WeakMap,Ac=new WeakMap,Ys=new WeakMap,kc=new WeakMap,Mc=new WeakMap,V2),Ar,fn,bf,vr,el,Ic,gi,yf,Nc,Lc,tl,nl,Ks,Fc,rl,ed,xf,P0,wf,T0,_f,D0,Sf,$0,Cf,A0,Ef,k0,Rf,M0,em,bD,H2,Zz=(H2=class extends Tf{constructor(t,n){super();Xe(this,rl);Xe(this,xf);Xe(this,wf);Xe(this,_f);Xe(this,Sf);Xe(this,Cf);Xe(this,Ef);Xe(this,Rf);Xe(this,em);Xe(this,Ar,void 0);Xe(this,fn,void 0);Xe(this,bf,void 0);Xe(this,vr,void 0);Xe(this,el,void 0);Xe(this,Ic,void 0);Xe(this,gi,void 0);Xe(this,yf,void 0);Xe(this,Nc,void 0);Xe(this,Lc,void 0);Xe(this,tl,void 0);Xe(this,nl,void 0);Xe(this,Ks,void 0);Xe(this,Fc,new Set);this.options=n,Ve(this,Ar,t),Ve(this,gi,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(re(this,fn).addObserver(this),uR(re(this,fn),this.options)?Ct(this,rl,ed).call(this):this.updateResult(),Ct(this,Sf,$0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return I0(re(this,fn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return I0(re(this,fn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ct(this,Cf,A0).call(this),Ct(this,Ef,k0).call(this),re(this,fn).removeObserver(this)}setOptions(t,n){const r=this.options,o=re(this,fn);if(this.options=re(this,Ar).defaultQueryOptions(t),E0(r,this.options)||re(this,Ar).getQueryCache().notify({type:"observerOptionsUpdated",query:re(this,fn),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),Ct(this,Rf,M0).call(this);const i=this.hasListeners();i&&dR(re(this,fn),o,this.options,r)&&Ct(this,rl,ed).call(this),this.updateResult(n),i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&Ct(this,xf,P0).call(this);const s=Ct(this,wf,T0).call(this);i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||s!==re(this,Ks))&&Ct(this,_f,D0).call(this,s)}getOptimisticResult(t){const n=re(this,Ar).getQueryCache().build(re(this,Ar),t),r=this.createResult(n,t);return tB(this,r)&&(Ve(this,vr,r),Ve(this,Ic,this.options),Ve(this,el,re(this,fn).state)),r}getCurrentResult(){return re(this,vr)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(re(this,Fc).add(r),t[r])})}),n}getCurrentQuery(){return re(this,fn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=re(this,Ar).defaultQueryOptions(t),r=re(this,Ar).getQueryCache().build(re(this,Ar),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Ct(this,rl,ed).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),re(this,vr)))}createResult(t,n){var P;const r=re(this,fn),o=this.options,i=re(this,vr),s=re(this,el),a=re(this,Ic),c=t!==r?t.state:re(this,bf),{state:u}=t;let{error:f,errorUpdatedAt:h,fetchStatus:g,status:v}=u,b=!1,w;if(n._optimisticResults){const $=this.hasListeners(),k=!$&&uR(t,n),I=$&&dR(t,r,n,o);(k||I)&&(g=sm(t.options.networkMode)?"fetching":"paused",u.dataUpdatedAt||(v="pending")),n._optimisticResults==="isRestoring"&&(g="idle")}if(n.select&&typeof u.data<"u")if(i&&u.data===(s==null?void 0:s.data)&&n.select===re(this,yf))w=re(this,Nc);else try{Ve(this,yf,n.select),w=n.select(u.data),w=O0(i==null?void 0:i.data,w,n),Ve(this,Nc,w),Ve(this,gi,null)}catch($){Ve(this,gi,$)}else w=u.data;if(typeof n.placeholderData<"u"&&typeof w>"u"&&v==="pending"){let $;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))$=i.data;else if($=typeof n.placeholderData=="function"?n.placeholderData((P=re(this,Lc))==null?void 0:P.state.data,re(this,Lc)):n.placeholderData,n.select&&typeof $<"u")try{$=n.select($),Ve(this,gi,null)}catch(k){Ve(this,gi,k)}typeof $<"u"&&(v="success",w=O0(i==null?void 0:i.data,$,n),b=!0)}re(this,gi)&&(f=re(this,gi),w=re(this,Nc),h=Date.now(),v="error");const x=g==="fetching",_=v==="pending",S=v==="error",C=_&&x;return{status:v,fetchStatus:g,isPending:_,isSuccess:v==="success",isError:S,isInitialLoading:C,isLoading:C,data:w,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!_,isLoadingError:S&&u.dataUpdatedAt===0,isPaused:g==="paused",isPlaceholderData:b,isRefetchError:S&&u.dataUpdatedAt!==0,isStale:Sw(t,n),refetch:this.refetch}}updateResult(t){const n=re(this,vr),r=this.createResult(re(this,fn),this.options);if(Ve(this,el,re(this,fn).state),Ve(this,Ic,this.options),re(this,el).data!==void 0&&Ve(this,Lc,re(this,fn)),E0(r,n))return;Ve(this,vr,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!re(this,Fc).size)return!0;const l=new Set(a??re(this,Fc));return this.options.throwOnError&&l.add("error"),Object.keys(re(this,vr)).some(c=>{const u=c;return re(this,vr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),Ct(this,em,bD).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ct(this,Sf,$0).call(this)}},Ar=new WeakMap,fn=new WeakMap,bf=new WeakMap,vr=new WeakMap,el=new WeakMap,Ic=new WeakMap,gi=new WeakMap,yf=new WeakMap,Nc=new WeakMap,Lc=new WeakMap,tl=new WeakMap,nl=new WeakMap,Ks=new WeakMap,Fc=new WeakMap,rl=new WeakSet,ed=function(t){Ct(this,Rf,M0).call(this);let n=re(this,fn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Oo)),n},xf=new WeakSet,P0=function(){if(Ct(this,Cf,A0).call(this),Hc||re(this,vr).isStale||!C0(this.options.staleTime))return;const n=fD(re(this,vr).dataUpdatedAt,this.options.staleTime)+1;Ve(this,tl,setTimeout(()=>{re(this,vr).isStale||this.updateResult()},n))},wf=new WeakSet,T0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(re(this,fn)):this.options.refetchInterval)??!1},_f=new WeakSet,D0=function(t){Ct(this,Ef,k0).call(this),Ve(this,Ks,t),!(Hc||this.options.enabled===!1||!C0(re(this,Ks))||re(this,Ks)===0)&&Ve(this,nl,setInterval(()=>{(this.options.refetchIntervalInBackground||gg.isFocused())&&Ct(this,rl,ed).call(this)},re(this,Ks)))},Sf=new WeakSet,$0=function(){Ct(this,xf,P0).call(this),Ct(this,_f,D0).call(this,Ct(this,wf,T0).call(this))},Cf=new WeakSet,A0=function(){re(this,tl)&&(clearTimeout(re(this,tl)),Ve(this,tl,void 0))},Ef=new WeakSet,k0=function(){re(this,nl)&&(clearInterval(re(this,nl)),Ve(this,nl,void 0))},Rf=new WeakSet,M0=function(){const t=re(this,Ar).getQueryCache().build(re(this,Ar),this.options);if(t===re(this,fn))return;const n=re(this,fn);Ve(this,fn,t),Ve(this,bf,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},em=new WeakSet,bD=function(t){Xn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(re(this,vr))}),re(this,Ar).getQueryCache().notify({query:re(this,fn),type:"observerResultsUpdated"})})},H2);function eB(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function uR(e,t){return eB(e,t)||e.state.dataUpdatedAt>0&&I0(e,t,t.refetchOnMount)}function I0(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Sw(e,t)}return!1}function dR(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&Sw(e,n)}function Sw(e,t){return e.isStaleByTime(t.staleTime)}function tB(e,t){return!E0(e.getCurrentResult(),t)}var yD=V.createContext(void 0),xD=e=>{const t=V.useContext(yD);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},nB=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),V.createElement(yD.Provider,{value:e},t)),wD=V.createContext(!1),rB=()=>V.useContext(wD);wD.Provider;function oB(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var iB=V.createContext(oB()),sB=()=>V.useContext(iB);function aB(e,t){return typeof e=="function"?e(...t):!!e}var lB=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},cB=e=>{V.useEffect(()=>{e.clearReset()},[e])},uB=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&aB(n,[e.error,r]),dB=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},fB=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,hB=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function pB(e,t,n){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=xD(n),o=rB(),i=sB(),s=r.defaultQueryOptions(e);s._optimisticResults=o?"isRestoring":"optimistic",dB(s),lB(s,i),cB(i);const[a]=V.useState(()=>new t(r,s)),l=a.getOptimisticResult(s);if(V.useSyncExternalStore(V.useCallback(c=>{const u=o?()=>{}:a.subscribe(Xn.batchCalls(c));return a.updateResult(),u},[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),V.useEffect(()=>{a.setOptions(s,{listeners:!1})},[s,a]),fB(s,l))throw hB(s,a,i);if(uB({result:l,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw l.error;return s.notifyOnChangeProps?l:a.trackResult(l)}function Df(e,t){return pB(e,Zz,t)}const gB={theme:"system",setTheme:()=>null},_D=m.createContext(gB);function mB({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,i]=m.useState(()=>localStorage.getItem(n)||t);m.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 O.jsx(_D.Provider,{...r,value:s,children:e})}const SD=()=>{const e=m.useContext(_D);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};async function vB(e){return await(await fetch("https://semaphor.cloud/api/v1/dashboard",{headers:{Authorization:`Bearer ${e}`}})).json()}function CD(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function fR(e,t){const n=CD(e);return n==="dark"?ol.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function bB({authToken:e,customStyle:t,currentTheme:n,onSave:r,onEvent:o}){const{data:i,refetch:s,isLoading:a,isError:l}=Df({queryKey:["dashboard",e==null?void 0:e.accessToken],queryFn:()=>vB(e==null?void 0:e.accessToken),enabled:!1}),{theme:c,setTheme:u}=SD(),f=ke($=>$.dashboard.globalStyle),{setDashboard:h,setSelectedSheetId:g,setStyle:v,setOnSaveFunction:b}=ke($=>$.actions);ke($=>$.actions.setCustomCards);const w=ke($=>$.actions.setFilterValues),x=ke($=>$.actions.setBookmarkKey),_=ke($=>$.actions.setAuthToken),S=ke($=>$.actions.setThemeStyle),C=ke($=>$.actions.setDashboardTheme),E=ke($=>$.actions.setOnEvent);m.useEffect(()=>{if(c){const $=CD(c);C($)}},[c,C]),m.useEffect(()=>{n&&u(n)},[n,u]);function P(){const $=ol.cloneDeep(_0),k=ol.merge($,f);if(t){const I=ol.merge(k,t),A=fR(c,I);S(A),v(I)}else{const I=fR(c,k);S(I),v(_0)}}return m.useEffect(()=>{i&&i.dashboard&&P()},[c,t,f]),m.useEffect(()=>{var L;if(!i||!i.dashboard)return;const $=i.dashboard,k=DL($.id),I=JSON.parse(localStorage.getItem(k)||"[]"),A=I.find(j=>j.default===!0);if(A)h(A.template),P(),x(A.name),A.filterValues&&w(A.filterValues);else{h($),P();const j=I.find(K=>(K==null?void 0:K.name)==="Original");j?j.template=$:I.push({name:"Original",template:$,default:!1}),localStorage.setItem(k,JSON.stringify(I))}g((L=$.sheets)==null?void 0:L[0].id)},[i,h,g,w,x]),m.useEffect(()=>{r&&b(r),o&&E(o)},[r,b,o,E]),m.useEffect(()=>{e&&e.accessToken&&(_(e),s())},[e,s,_]),{isLoading:a,isError:l}}function am({className:e,...t}){return O.jsx("div",{className:Ce("animate-pulse rounded-md bg-muted",e),...t})}const Cw=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Cw.displayName="Card";const lm=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce("flex flex-col space-y-1.5 p-6",e),...t}));lm.displayName="CardHeader";const $f=V.forwardRef(({className:e,...t},n)=>O.jsx("h3",{ref:n,className:Ce("text-2xl font-semibold leading-none tracking-tight",e),...t}));$f.displayName="CardTitle";const Ew=V.forwardRef(({className:e,...t},n)=>O.jsx("p",{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));Ew.displayName="CardDescription";const cm=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce("px-6 pt-0",e),...t}));cm.displayName="CardContent";const Rw=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce("flex items-center p-6 pt-0",e),...t}));Rw.displayName="CardFooter";function ED({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:f,showAssistant:h,...g}){ke(_=>_.selectedSheetId);const v=ke(_=>_.themeStyle),b=ke(_=>_.isSessionExpired),{isLoading:w,isError:x}=bB({authToken:l,customStyle:t,currentTheme:c,onSave:n,onEvent:r});return w||!l?(r==null||r({type:"info",message:"Loading dashboard"}),o?O.jsx(o,{message:"loading"}):O.jsx("div",{className:"flex items-center gap-3",children:O.jsx(am,{className:"h-1 w-full dark:h-[2px]"})})):x?(r==null||r({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),O.jsx(i,{})):O.jsx("div",{children:"Error"})):b?(r==null||r({type:"error",message:"Session Expired"}),O.jsx("div",{className:"flex h-full items-center justify-center",children:O.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[O.jsx($f,{children:"Session Expired"}),O.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):O.jsx("div",{className:Ce("flex h-full flex-col justify-between",v==null?void 0:v.dashboardPanel,e),role:"dashboard-panel",...g})}function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},he.apply(this,arguments)}function Me(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 Zn(e,t=[]){let n=[];function r(i,s){const a=m.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:g,...v}=f,b=(h==null?void 0:h[e][l])||a,w=m.useMemo(()=>v,Object.values(v));return m.createElement(b.Provider,{value:w},g)}function u(f,h){const g=(h==null?void 0:h[e][l])||a,v=m.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>m.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,yB(o,...t)]}function yB(...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 f=l(i)[`__scope${c}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function xB(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function cs(...e){return t=>e.forEach(n=>xB(n,t))}function _t(...e){return m.useCallback(cs(...e),e)}const N0=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(_B);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(L0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(L0,he({},r,{ref:t}),n)});N0.displayName="Slot";const L0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...SB(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});L0.displayName="SlotClone";const wB=({children:e})=>m.createElement(m.Fragment,null,e);function _B(e){return m.isValidElement(e)&&e.type===wB}function SB(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 um(e){const t=e+"CollectionProvider",[n,r]=Zn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:v,children:b}=g,w=m.useRef(null),x=m.useRef(new Map).current;return m.createElement(o,{scope:v,itemMap:x,collectionRef:w},b)},a=e+"CollectionSlot",l=m.forwardRef((g,v)=>{const{scope:b,children:w}=g,x=i(a,b),_=_t(v,x.collectionRef);return m.createElement(N0,{ref:_},w)}),c=e+"CollectionItemSlot",u="data-radix-collection-item",f=m.forwardRef((g,v)=>{const{scope:b,children:w,...x}=g,_=m.useRef(null),S=_t(v,_),C=i(c,b);return m.useEffect(()=>(C.itemMap.set(_,{ref:_,...x}),()=>void C.itemMap.delete(_))),m.createElement(N0,{[u]:"",ref:S},w)});function h(g){const v=i(e+"CollectionConsumer",g);return m.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const x=Array.from(w.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((C,E)=>x.indexOf(C.ref.current)-x.indexOf(E.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}const ur=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},CB=V.useId||(()=>{});let EB=0;function Jo(e){const[t,n]=V.useState(CB());return ur(()=>{e||n(r=>r??String(EB++))},[e]),e||(t?`radix-${t}`:"")}const RD=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(OB);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(F0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(F0,he({},r,{ref:t}),n)});RD.displayName="Slot";const F0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...PB(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});F0.displayName="SlotClone";const RB=({children:e})=>m.createElement(m.Fragment,null,e);function OB(e){return m.isValidElement(e)&&e.type===RB}function PB(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}}const TB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Qe=TB.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?RD:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(a,he({},s,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function OD(e,t){e&&ko.flushSync(()=>e.dispatchEvent(t))}function Ln(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function wr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=DB({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Ln(n),l=m.useCallback(c=>{if(i){const f=typeof c=="function"?c(e):c;f!==e&&a(f)}else o(c)},[i,e,o,a]);return[s,l]}function DB({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),i=Ln(t);return m.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}const $B=m.createContext(void 0);function _l(e){const t=m.useContext($B);return e||t||"ltr"}const Ab="rovingFocusGroup.onEntryFocus",AB={bubbles:!1,cancelable:!0},Ow="RovingFocusGroup",[j0,PD,kB]=um(Ow),[MB,ou]=Zn(Ow,[kB]),[IB,NB]=MB(Ow),LB=m.forwardRef((e,t)=>m.createElement(j0.Provider,{scope:e.__scopeRovingFocusGroup},m.createElement(j0.Slot,{scope:e.__scopeRovingFocusGroup},m.createElement(FB,he({},e,{ref:t}))))),FB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...u}=e,f=m.useRef(null),h=_t(t,f),g=_l(i),[v=null,b]=wr({prop:s,defaultProp:a,onChange:l}),[w,x]=m.useState(!1),_=Ln(c),S=PD(n),C=m.useRef(!1),[E,P]=m.useState(0);return m.useEffect(()=>{const $=f.current;if($)return $.addEventListener(Ab,_),()=>$.removeEventListener(Ab,_)},[_]),m.createElement(IB,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:m.useCallback($=>b($),[b]),onItemShiftTab:m.useCallback(()=>x(!0),[]),onFocusableItemAdd:m.useCallback(()=>P($=>$+1),[]),onFocusableItemRemove:m.useCallback(()=>P($=>$-1),[])},m.createElement(Qe.div,he({tabIndex:w||E===0?-1:0,"data-orientation":r},u,{ref:h,style:{outline:"none",...e.style},onMouseDown:Me(e.onMouseDown,()=>{C.current=!0}),onFocus:Me(e.onFocus,$=>{const k=!C.current;if($.target===$.currentTarget&&k&&!w){const I=new CustomEvent(Ab,AB);if($.currentTarget.dispatchEvent(I),!I.defaultPrevented){const A=S().filter(B=>B.focusable),L=A.find(B=>B.active),j=A.find(B=>B.id===v),Z=[L,j,...A].filter(Boolean).map(B=>B.ref.current);TD(Z)}}C.current=!1}),onBlur:Me(e.onBlur,()=>x(!1))})))}),jB="RovingFocusGroupItem",zB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Jo(),l=i||a,c=NB(jB,n),u=c.currentTabStopId===l,f=PD(n),{onFocusableItemAdd:h,onFocusableItemRemove:g}=c;return m.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),m.createElement(j0.ItemSlot,{scope:n,id:l,focusable:r,active:o},m.createElement(Qe.span,he({tabIndex:u?0:-1,"data-orientation":c.orientation},s,{ref:t,onMouseDown:Me(e.onMouseDown,v=>{r?c.onItemFocus(l):v.preventDefault()}),onFocus:Me(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Me(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=HB(v,c.orientation,c.dir);if(b!==void 0){v.preventDefault();let x=f().filter(_=>_.focusable).map(_=>_.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const _=x.indexOf(v.currentTarget);x=c.loop?WB(x,_+1):x.slice(_+1)}setTimeout(()=>TD(x))}})})))}),BB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function VB(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function HB(e,t,n){const r=VB(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return BB[r]}function TD(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function WB(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Pw=LB,Tw=zB;function UB(e,t){return m.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const er=e=>{const{present:t,children:n}=e,r=qB(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=_t(r.ref,o.ref);return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};er.displayName="Presence";function qB(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),i=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=UB(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=qh(r.current);i.current=a==="mounted"?c:"none"},[a]),ur(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,g=qh(c);e?l("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),ur(()=>{if(t){const c=f=>{const g=qh(r.current).includes(f.animationName);f.target===t&&g&&ko.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===t&&(i.current=qh(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function qh(e){return(e==null?void 0:e.animationName)||"none"}const DD="Tabs",[GB,rye]=Zn(DD,[ou]),$D=ou(),[YB,Dw]=GB(DD),KB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=_l(a),[f,h]=wr({prop:r,onChange:o,defaultProp:i});return m.createElement(YB,{scope:n,baseId:Jo(),value:f,onValueChange:h,orientation:s,dir:u,activationMode:l},m.createElement(Qe.div,he({dir:u,"data-orientation":s},c,{ref:t})))}),XB="TabsList",QB=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Dw(XB,n),s=$D(n);return m.createElement(Pw,he({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:r}),m.createElement(Qe.div,he({role:"tablist","aria-orientation":i.orientation},o,{ref:t})))}),JB="TabsTrigger",ZB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Dw(JB,n),a=$D(n),l=AD(s.baseId,r),c=kD(s.baseId,r),u=r===s.value;return m.createElement(Tw,he({asChild:!0},a,{focusable:!o,active:u}),m.createElement(Qe.button,he({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:Me(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Me(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Me(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!o&&f&&s.onValueChange(r)})})))}),eV="TabsContent",tV=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Dw(eV,n),l=AD(a.baseId,r),c=kD(a.baseId,r),u=r===a.value,f=m.useRef(u);return m.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),m.createElement(er,{present:o||u},({present:h})=>m.createElement(Qe.div,he({"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:f.current?"0s":void 0}}),h&&i))});function AD(e,t){return`${e}-trigger-${t}`}function kD(e,t){return`${e}-content-${t}`}const nV=KB,MD=QB,ID=ZB,ND=tV,LD=nV,$w=V.forwardRef(({className:e,...t},n)=>O.jsx(MD,{ref:n,className:Ce("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));$w.displayName=MD.displayName;const Aw=V.forwardRef(({className:e,...t},n)=>O.jsx(ID,{ref:n,className:Ce("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}));Aw.displayName=ID.displayName;const kw=V.forwardRef(({className:e,...t},n)=>O.jsx(ND,{ref:n,className:Ce("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));kw.displayName=ND.displayName;var FD={exports:{}},Af={},z0={exports:{}};(function(e,t){(function(n,r){r(t)})(Vs,function(n){function r(ie){return function(ae,ye,G,be,_e,Pe,Te){return ie(ae,ye,Te)}}function o(ie){return function(ae,ye,G,be){if(!ae||!ye||typeof ae!="object"||typeof ye!="object")return ie(ae,ye,G,be);var _e=be.get(ae),Pe=be.get(ye);if(_e&&Pe)return _e===ye&&Pe===ae;be.set(ae,ye),be.set(ye,ae);var Te=ie(ae,ye,G,be);return be.delete(ae),be.delete(ye),Te}}function i(ie,te){var ae={};for(var ye in ie)ae[ye]=ie[ye];for(var ye in te)ae[ye]=te[ye];return ae}function s(ie){return ie.constructor===Object||ie.constructor==null}function a(ie){return typeof ie.then=="function"}function l(ie,te){return ie===te||ie!==ie&&te!==te}var c="[object Arguments]",u="[object Boolean]",f="[object Date]",h="[object RegExp]",g="[object Map]",v="[object Number]",b="[object Object]",w="[object Set]",x="[object String]",_=Object.prototype.toString;function S(ie){var te=ie.areArraysEqual,ae=ie.areDatesEqual,ye=ie.areMapsEqual,G=ie.areObjectsEqual,be=ie.areRegExpsEqual,_e=ie.areSetsEqual,Pe=ie.createIsNestedEqual,Te=Pe(Ue);function Ue(Be,Ie,Ke){if(Be===Ie)return!0;if(!Be||!Ie||typeof Be!="object"||typeof Ie!="object")return Be!==Be&&Ie!==Ie;if(s(Be)&&s(Ie))return G(Be,Ie,Te,Ke);var lt=Array.isArray(Be),It=Array.isArray(Ie);if(lt||It)return lt===It&&te(Be,Ie,Te,Ke);var $t=_.call(Be);return $t!==_.call(Ie)?!1:$t===f?ae(Be,Ie,Te,Ke):$t===h?be(Be,Ie,Te,Ke):$t===g?ye(Be,Ie,Te,Ke):$t===w?_e(Be,Ie,Te,Ke):$t===b||$t===c?a(Be)||a(Ie)?!1:G(Be,Ie,Te,Ke):$t===u||$t===v||$t===x?l(Be.valueOf(),Ie.valueOf()):!1}return Ue}function C(ie,te,ae,ye){var G=ie.length;if(te.length!==G)return!1;for(;G-- >0;)if(!ae(ie[G],te[G],G,G,ie,te,ye))return!1;return!0}var E=o(C);function P(ie,te){return l(ie.valueOf(),te.valueOf())}function $(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={},_e=0;return ie.forEach(function(Pe,Te){if(G){var Ue=!1,Be=0;te.forEach(function(Ie,Ke){!Ue&&!be[Be]&&(Ue=ae(Te,Ke,_e,Be,ie,te,ye)&&ae(Pe,Ie,Te,Ke,ie,te,ye))&&(be[Be]=!0),Be++}),_e++,G=Ue}}),G}var k=o($),I="_owner",A=Object.prototype.hasOwnProperty;function L(ie,te,ae,ye){var G=Object.keys(ie),be=G.length;if(Object.keys(te).length!==be)return!1;for(var _e;be-- >0;){if(_e=G[be],_e===I){var Pe=!!ie.$$typeof,Te=!!te.$$typeof;if((Pe||Te)&&Pe!==Te)return!1}if(!A.call(te,_e)||!ae(ie[_e],te[_e],_e,_e,ie,te,ye))return!1}return!0}var j=o(L);function K(ie,te){return ie.source===te.source&&ie.flags===te.flags}function Z(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={};return ie.forEach(function(_e,Pe){if(G){var Te=!1,Ue=0;te.forEach(function(Be,Ie){!Te&&!be[Ue]&&(Te=ae(_e,Be,Pe,Ie,ie,te,ye))&&(be[Ue]=!0),Ue++}),G=Te}}),G}var B=o(Z),Q=Object.freeze({areArraysEqual:C,areDatesEqual:P,areMapsEqual:$,areObjectsEqual:L,areRegExpsEqual:K,areSetsEqual:Z,createIsNestedEqual:r}),W=Object.freeze({areArraysEqual:E,areDatesEqual:P,areMapsEqual:k,areObjectsEqual:j,areRegExpsEqual:K,areSetsEqual:B,createIsNestedEqual:r}),Y=S(Q);function oe(ie,te){return Y(ie,te,void 0)}var D=S(i(Q,{createIsNestedEqual:function(){return l}}));function H(ie,te){return D(ie,te,void 0)}var J=S(W);function N(ie,te){return J(ie,te,new WeakMap)}var ce=S(i(W,{createIsNestedEqual:function(){return l}}));function le(ie,te){return ce(ie,te,new WeakMap)}function de(ie){return S(i(Q,ie(Q)))}function pe(ie){var te=S(i(W,ie(W)));return function(ae,ye,G){return G===void 0&&(G=new WeakMap),te(ae,ye,G)}}n.circularDeepEqual=N,n.circularShallowEqual=le,n.createCustomCircularEqual=pe,n.createCustomEqual=de,n.deepEqual=oe,n.sameValueZeroEqual=l,n.shallowEqual=H,Object.defineProperty(n,"__esModule",{value:!0})})})(z0,z0.exports);var Mw=z0.exports;const Iw=hw(xj);var Ot={},rV=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(Ot,"__esModule",{value:!0});Ot.bottom=Nw;Ot.childrenEqual=aV;Ot.cloneLayout=jD;Ot.cloneLayoutItem=il;Ot.collides=dm;Ot.compact=BD;Ot.compactItem=VD;Ot.compactType=wV;Ot.correctBounds=HD;Ot.fastPositionEqual=cV;Ot.fastRGLPropsEqual=void 0;Ot.getAllCollisions=WD;Ot.getFirstCollision=qa;Ot.getLayoutItem=Lw;Ot.getStatics=Fw;Ot.modifyLayout=zD;Ot.moveElement=nd;Ot.moveElementAwayFromCollision=V0;Ot.noop=void 0;Ot.perc=dV;Ot.resizeItemInDirection=vV;Ot.setTopLeft=yV;Ot.setTransform=bV;Ot.sortLayoutItems=Ww;Ot.sortLayoutItemsByColRow=KD;Ot.sortLayoutItemsByRowCol=YD;Ot.synchronizeLayoutWithChildren=xV;Ot.validateLayout=XD;Ot.withLayoutItem=sV;var hR=Mw,td=oV(m);function oV(e){return e&&e.__esModule?e:{default:e}}const iV=process.env.NODE_ENV==="production";function Nw(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 jD(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=il(e[n]);return t}function zD(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 sV(e,t,n){let r=Lw(e,t);return r?(r=n(il(r)),e=zD(e,r),[e,r]):[e,null]}function il(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 aV(e,t){return(0,hR.deepEqual)(td.default.Children.map(e,n=>n==null?void 0:n.key),td.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,hR.deepEqual)(td.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),td.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}const lV=rV;Ot.fastRGLPropsEqual=lV;function cV(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function dm(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 BD(e,t,n,r){const o=Fw(e),i=Ww(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let c=il(i[a]);c.static||(c=VD(o,c,t,n,i,r),o.push(c)),s[e.indexOf(i[a])]=c,c.moved=!1}return s}const uV={x:"w",y:"h"};function B0(e,t,n,r){const o=uV[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;dm(t,a)&&B0(e,a,n+t[o],r)}}t[r]=n}function VD(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(Nw(e),t.y);t.y>0&&!qa(e,t);)t.y--;else if(a)for(;t.x>0&&!qa(e,t);)t.x--;let l;for(;(l=qa(e,t))&&!(n===null&&i);)if(a?B0(o,t,l.x+l.w,"x"):B0(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!qa(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function HD(e,t){const n=Fw(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(;qa(n,i);)i.y++}return e}function Lw(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function qa(e,t){for(let n=0,r=e.length;n<r;n++)if(dm(e[n],t))return e[n]}function WD(e,t){return e.filter(n=>dm(n,t))}function Fw(e){return e.filter(t=>t.static)}function nd(e,t,n,r,o,i,s,a,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;"Moving element ".concat(t.i," to [").concat(String(n),",").concat(String(r),"] from [").concat(t.x,",").concat(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 f=Ww(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(f=f.reverse());const g=WD(f,t),v=g.length>0;if(v&&l)return jD(e);if(v&&i)return"Collision prevented on ".concat(t.i,", reverting."),t.x=c,t.y=u,t.moved=!1,e;for(let b=0,w=g.length;b<w;b++){const x=g[b];"Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(x.i," at [").concat(x.x,",").concat(x.y,"]"),!x.moved&&(x.static?e=V0(e,x,t,o,s):e=V0(e,t,x,o,s))}return e}function V0(e,t,n,r,o,i){const s=o==="horizontal",a=o==="vertical",l=t.static;if(r){r=!1;const f={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=qa(e,f),g=h&&h.y+h.h>t.y,v=h&&t.x+t.w>h.x;if(h){if(g&&a)return nd(e,n,void 0,t.y+1,r,l,o);if(g&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(v&&s)return nd(e,t,n.x,void 0,r,l,o)}else return"Doing reverse collision on ".concat(n.i," up to [").concat(f.x,",").concat(f.y,"]."),nd(e,n,s?f.x:void 0,a?f.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:nd(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function dV(e){return e*100+"%"}const UD=(e,t,n,r)=>e+n>r?t:n,qD=(e,t,n)=>e<0?t:n,GD=e=>Math.max(0,e),jw=e=>Math.max(0,e),zw=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:qD(s,e.height,o),top:jw(s)}},Bw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:UD(e.left,e.width,s,n),left:GD(o)}},Vw=(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:UD(e.left,e.width,i,n),top:jw(r),left:GD(s)}},Hw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:qD(r,e.height,i),top:jw(r)}},fV=function(){return zw(arguments.length<=0?void 0:arguments[0],Bw(...arguments))},hV=function(){return zw(arguments.length<=0?void 0:arguments[0],Vw(...arguments))},pV=function(){return Hw(arguments.length<=0?void 0:arguments[0],Bw(...arguments))},gV=function(){return Hw(arguments.length<=0?void 0:arguments[0],Vw(...arguments))},mV={n:zw,ne:fV,e:Bw,se:pV,s:Hw,sw:gV,w:Vw,nw:hV};function vV(e,t,n,r){const o=mV[e];return o?o(t,{...t,...n},r):n}function bV(e){let{top:t,left:n,width:r,height:o}=e;const i="translate(".concat(n,"px,").concat(t,"px)");return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function yV(e){let{top:t,left:n,width:r,height:o}=e;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function Ww(e,t){return t==="horizontal"?KD(e):t==="vertical"?YD(e):e}function YD(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 KD(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 xV(e,t,n,r,o){e=e||[];const i=[];td.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=Lw(e,String(a.key)),c=a.props["data-grid"];l&&c==null?i.push(il(l)):c?(iV||XD([c],"ReactGridLayout.children"),i.push(il({...c,i:a.key}))):i.push(il({w:1,h:1,x:0,y:Nw(i),i:String(a.key)}))});const s=HD(i,{cols:n});return o?s:BD(s,r,n)}function XD(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++)if(typeof i[n[s]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[s]+" must be a number!")}}function wV(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const _V=()=>{};Ot.noop=_V;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.calcGridColWidth=fm;Ri.calcGridItemPosition=SV;Ri.calcGridItemWHPx=H0;Ri.calcWH=EV;Ri.calcXY=CV;Ri.clamp=Ga;function fm(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function H0(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function SV(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,c=fm(e),u={};return i&&i.resizing?(u.width=Math.round(i.resizing.width),u.height=Math.round(i.resizing.height)):(u.width=H0(r,c,s[0]),u.height=H0(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 CV(e,t,n,r,o){const{margin:i,cols:s,rowHeight:a,maxRows:l}=e,c=fm(e);let u=Math.round((n-i[0])/(c+i[0])),f=Math.round((t-i[1])/(a+i[1]));return u=Ga(u,0,s-r),f=Ga(f,0,l-o),{x:u,y:f}}function EV(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=fm(e);let f=Math.round((t+s[0])/(u+s[0])),h=Math.round((n+s[1])/(c+s[1])),g=Ga(f,0,l-r),v=Ga(h,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(g=Ga(f,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(v=Ga(h,0,a)),{w:g,h:v}}function Ga(e,t,n){return Math.max(Math.min(e,n),t)}var hm={},W0={exports:{}},kb,pR;function Uw(){if(pR)return kb;pR=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return kb=e,kb}var Mb,gR;function RV(){if(gR)return Mb;gR=1;var e=Uw();function t(){}function n(){}return n.resetWarningCache=t,Mb=function(){function r(s,a,l,c,u,f){if(f!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Mb}var Gh={exports:{}},qt={};/** @license React v16.13.1
88
+ }`;var yt=NE(function(){return jt(z,Ye+"return "+Re).apply(n,U)});if(yt.source=Re,fb(yt))throw yt;return yt}function S8(d){return Ut(d).toLowerCase()}function C8(d){return Ut(d).toUpperCase()}function E8(d,p,y){if(d=Ut(d),d&&(y||p===n))return US(d);if(!d||!(p=Vr(p)))return d;var R=jo(d),M=jo(p),z=qS(R,M),U=GS(R,M)+1;return Os(R,z,U).join("")}function R8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.slice(0,KS(d)+1);if(!d||!(p=Vr(p)))return d;var R=jo(d),M=GS(R,jo(p))+1;return Os(R,0,M).join("")}function O8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.replace(jn,"");if(!d||!(p=Vr(p)))return d;var R=jo(d),M=qS(R,jo(p));return Os(R,M).join("")}function P8(d,p){var y=A,R=L;if(wn(p)){var M="separator"in p?p.separator:M;y="length"in p?pt(p.length):y,R="omission"in p?Vr(p.omission):R}d=Ut(d);var z=d.length;if(Nl(d)){var U=jo(d);z=U.length}if(y>=z)return d;var X=y-Ll(R);if(X<1)return R;var se=U?Os(U,0,X).join(""):d.slice(0,X);if(M===n)return se+R;if(U&&(X+=se.length-X),hb(M)){if(d.slice(X).search(M)){var xe,we=se;for(M.global||(M=Tv(M.source,Ut(qe.exec(M))+"g")),M.lastIndex=0;xe=M.exec(we);)var Re=xe.index;se=se.slice(0,Re===n?X:Re)}}else if(d.indexOf(Vr(M),X)!=X){var je=se.lastIndexOf(M);je>-1&&(se=se.slice(0,je))}return se+R}function T8(d){return d=Ut(d),d&&On.test(d)?d.replace(Xt,oF):d}var D8=Wl(function(d,p,y){return d+(y?" ":"")+p.toUpperCase()}),mb=LC("toUpperCase");function IE(d,p,y){return d=Ut(d),p=y?n:p,p===n?Z3(d)?aF(d):W3(d):d.match(p)||[]}var NE=St(function(d,p){try{return zr(d,n,p)}catch(y){return fb(y)?y:new ct(y)}}),$8=Fi(function(d,p){return mo(p,function(y){y=ai(y),Ni(d,y,ub(d[y],d))}),d});function A8(d){var p=d==null?0:d.length,y=Je();return d=p?yn(d,function(R){if(typeof R[1]!="function")throw new vo(s);return[y(R[0]),R[1]]}):[],St(function(R){for(var M=-1;++M<p;){var z=d[M];if(zr(z[0],this,R))return zr(z[1],this,R)}})}function k8(d){return o7(yo(d,f))}function vb(d){return function(){return d}}function M8(d,p){return d==null||d!==d?p:d}var I8=jC(),N8=jC(!0);function Rr(d){return d}function bb(d){return gC(typeof d=="function"?d:yo(d,f))}function L8(d){return vC(yo(d,f))}function F8(d,p){return bC(d,yo(p,f))}var j8=St(function(d,p){return function(y){return Su(y,d,p)}}),z8=St(function(d,p){return function(y){return Su(d,y,p)}});function yb(d,p,y){var R=Bn(p),M=_h(p,R);y==null&&!(wn(p)&&(M.length||!R.length))&&(y=p,p=d,d=this,M=_h(p,Bn(p)));var z=!(wn(y)&&"chain"in y)||!!y.chain,U=zi(d);return mo(M,function(X){var se=p[X];d[X]=se,U&&(d.prototype[X]=function(){var xe=this.__chain__;if(z||xe){var we=d(this.__wrapped__),Re=we.__actions__=Sr(this.__actions__);return Re.push({func:se,args:arguments,thisArg:d}),we.__chain__=xe,we}return se.apply(d,ws([this.value()],arguments))})}),d}function B8(){return qn._===this&&(qn._=hF),this}function xb(){}function V8(d){return d=pt(d),St(function(p){return yC(p,d)})}var H8=Qv(yn),W8=Qv(zS),U8=Qv(_v);function LE(d){return ob(d)?Sv(ai(d)):w7(d)}function q8(d){return function(p){return d==null?n:Ea(d,p)}}var G8=BC(),Y8=BC(!0);function wb(){return[]}function _b(){return!1}function K8(){return{}}function X8(){return""}function Q8(){return!0}function J8(d,p){if(d=pt(d),d<1||d>Y)return[];var y=H,R=nr(d,H);p=Je(p),d-=H;for(var M=Rv(R,p);++y<d;)p(y);return M}function Z8(d){return ut(d)?yn(d,ai):Hr(d)?[d]:Sr(rE(Ut(d)))}function ej(d){var p=++dF;return Ut(d)+p}var tj=Ph(function(d,p){return d+p},0),nj=Jv("ceil"),rj=Ph(function(d,p){return d/p},1),oj=Jv("floor");function ij(d){return d&&d.length?wh(d,Rr,Lv):n}function sj(d,p){return d&&d.length?wh(d,Je(p,2),Lv):n}function aj(d){return HS(d,Rr)}function lj(d,p){return HS(d,Je(p,2))}function cj(d){return d&&d.length?wh(d,Rr,Bv):n}function uj(d,p){return d&&d.length?wh(d,Je(p,2),Bv):n}var dj=Ph(function(d,p){return d*p},1),fj=Jv("round"),hj=Ph(function(d,p){return d-p},0);function pj(d){return d&&d.length?Ev(d,Rr):0}function gj(d,p){return d&&d.length?Ev(d,Je(p,2)):0}return F.after=L9,F.ary=pE,F.assign=C4,F.assignIn=PE,F.assignInWith=Bh,F.assignWith=E4,F.at=R4,F.before=gE,F.bind=ub,F.bindAll=$8,F.bindKey=mE,F.castArray=K9,F.chain=dE,F.chunk=o6,F.compact=i6,F.concat=s6,F.cond=A8,F.conforms=k8,F.constant=vb,F.countBy=p9,F.create=O4,F.curry=vE,F.curryRight=bE,F.debounce=yE,F.defaults=P4,F.defaultsDeep=T4,F.defer=F9,F.delay=j9,F.difference=a6,F.differenceBy=l6,F.differenceWith=c6,F.drop=u6,F.dropRight=d6,F.dropRightWhile=f6,F.dropWhile=h6,F.fill=p6,F.filter=m9,F.flatMap=y9,F.flatMapDeep=x9,F.flatMapDepth=w9,F.flatten=aE,F.flattenDeep=g6,F.flattenDepth=m6,F.flip=z9,F.flow=I8,F.flowRight=N8,F.fromPairs=v6,F.functions=N4,F.functionsIn=L4,F.groupBy=_9,F.initial=y6,F.intersection=x6,F.intersectionBy=w6,F.intersectionWith=_6,F.invert=j4,F.invertBy=z4,F.invokeMap=C9,F.iteratee=bb,F.keyBy=E9,F.keys=Bn,F.keysIn=Er,F.map=Ih,F.mapKeys=V4,F.mapValues=H4,F.matches=L8,F.matchesProperty=F8,F.memoize=Lh,F.merge=W4,F.mergeWith=TE,F.method=j8,F.methodOf=z8,F.mixin=yb,F.negate=Fh,F.nthArg=V8,F.omit=U4,F.omitBy=q4,F.once=B9,F.orderBy=R9,F.over=H8,F.overArgs=V9,F.overEvery=W8,F.overSome=U8,F.partial=db,F.partialRight=xE,F.partition=O9,F.pick=G4,F.pickBy=DE,F.property=LE,F.propertyOf=q8,F.pull=R6,F.pullAll=cE,F.pullAllBy=O6,F.pullAllWith=P6,F.pullAt=T6,F.range=G8,F.rangeRight=Y8,F.rearg=H9,F.reject=D9,F.remove=D6,F.rest=W9,F.reverse=lb,F.sampleSize=A9,F.set=K4,F.setWith=X4,F.shuffle=k9,F.slice=$6,F.sortBy=N9,F.sortedUniq=F6,F.sortedUniqBy=j6,F.split=y8,F.spread=U9,F.tail=z6,F.take=B6,F.takeRight=V6,F.takeRightWhile=H6,F.takeWhile=W6,F.tap=i9,F.throttle=q9,F.thru=Mh,F.toArray=EE,F.toPairs=$E,F.toPairsIn=AE,F.toPath=Z8,F.toPlainObject=OE,F.transform=Q4,F.unary=G9,F.union=U6,F.unionBy=q6,F.unionWith=G6,F.uniq=Y6,F.uniqBy=K6,F.uniqWith=X6,F.unset=J4,F.unzip=cb,F.unzipWith=uE,F.update=Z4,F.updateWith=e8,F.values=Gl,F.valuesIn=t8,F.without=Q6,F.words=IE,F.wrap=Y9,F.xor=J6,F.xorBy=Z6,F.xorWith=e9,F.zip=t9,F.zipObject=n9,F.zipObjectDeep=r9,F.zipWith=o9,F.entries=$E,F.entriesIn=AE,F.extend=PE,F.extendWith=Bh,yb(F,F),F.add=tj,F.attempt=NE,F.camelCase=i8,F.capitalize=kE,F.ceil=nj,F.clamp=n8,F.clone=X9,F.cloneDeep=J9,F.cloneDeepWith=Z9,F.cloneWith=Q9,F.conformsTo=e4,F.deburr=ME,F.defaultTo=M8,F.divide=rj,F.endsWith=s8,F.eq=Bo,F.escape=a8,F.escapeRegExp=l8,F.every=g9,F.find=v9,F.findIndex=iE,F.findKey=D4,F.findLast=b9,F.findLastIndex=sE,F.findLastKey=$4,F.floor=oj,F.forEach=fE,F.forEachRight=hE,F.forIn=A4,F.forInRight=k4,F.forOwn=M4,F.forOwnRight=I4,F.get=pb,F.gt=t4,F.gte=n4,F.has=F4,F.hasIn=gb,F.head=lE,F.identity=Rr,F.includes=S9,F.indexOf=b6,F.inRange=r8,F.invoke=B4,F.isArguments=Pa,F.isArray=ut,F.isArrayBuffer=r4,F.isArrayLike=Cr,F.isArrayLikeObject=Pn,F.isBoolean=o4,F.isBuffer=Ps,F.isDate=i4,F.isElement=s4,F.isEmpty=a4,F.isEqual=l4,F.isEqualWith=c4,F.isError=fb,F.isFinite=u4,F.isFunction=zi,F.isInteger=wE,F.isLength=jh,F.isMap=_E,F.isMatch=d4,F.isMatchWith=f4,F.isNaN=h4,F.isNative=p4,F.isNil=m4,F.isNull=g4,F.isNumber=SE,F.isObject=wn,F.isObjectLike=Sn,F.isPlainObject=Tu,F.isRegExp=hb,F.isSafeInteger=v4,F.isSet=CE,F.isString=zh,F.isSymbol=Hr,F.isTypedArray=ql,F.isUndefined=b4,F.isWeakMap=y4,F.isWeakSet=x4,F.join=S6,F.kebabCase=c8,F.last=wo,F.lastIndexOf=C6,F.lowerCase=u8,F.lowerFirst=d8,F.lt=w4,F.lte=_4,F.max=ij,F.maxBy=sj,F.mean=aj,F.meanBy=lj,F.min=cj,F.minBy=uj,F.stubArray=wb,F.stubFalse=_b,F.stubObject=K8,F.stubString=X8,F.stubTrue=Q8,F.multiply=dj,F.nth=E6,F.noConflict=B8,F.noop=xb,F.now=Nh,F.pad=f8,F.padEnd=h8,F.padStart=p8,F.parseInt=g8,F.random=o8,F.reduce=P9,F.reduceRight=T9,F.repeat=m8,F.replace=v8,F.result=Y4,F.round=fj,F.runInContext=ne,F.sample=$9,F.size=M9,F.snakeCase=b8,F.some=I9,F.sortedIndex=A6,F.sortedIndexBy=k6,F.sortedIndexOf=M6,F.sortedLastIndex=I6,F.sortedLastIndexBy=N6,F.sortedLastIndexOf=L6,F.startCase=x8,F.startsWith=w8,F.subtract=hj,F.sum=pj,F.sumBy=gj,F.template=_8,F.times=J8,F.toFinite=Bi,F.toInteger=pt,F.toLength=RE,F.toLower=S8,F.toNumber=_o,F.toSafeInteger=S4,F.toString=Ut,F.toUpper=C8,F.trim=E8,F.trimEnd=R8,F.trimStart=O8,F.truncate=P8,F.unescape=T8,F.uniqueId=ej,F.upperCase=D8,F.upperFirst=mb,F.each=fE,F.eachRight=hE,F.first=lE,yb(F,function(){var d={};return ii(F,function(p,y){Qt.call(F.prototype,y)||(d[y]=p)}),d}(),{chain:!1}),F.VERSION=r,mo(["bind","bindKey","curry","curryRight","partial","partialRight"],function(d){F[d].placeholder=F}),mo(["drop","take"],function(d,p){kt.prototype[d]=function(y){y=y===n?1:Mn(pt(y),0);var R=this.__filtered__&&!p?new kt(this):this.clone();return R.__filtered__?R.__takeCount__=nr(y,R.__takeCount__):R.__views__.push({size:nr(y,H),type:d+(R.__dir__<0?"Right":"")}),R},kt.prototype[d+"Right"]=function(y){return this.reverse()[d](y).reverse()}}),mo(["filter","map","takeWhile"],function(d,p){var y=p+1,R=y==Z||y==Q;kt.prototype[d]=function(M){var z=this.clone();return z.__iteratees__.push({iteratee:Je(M,3),type:y}),z.__filtered__=z.__filtered__||R,z}}),mo(["head","last"],function(d,p){var y="take"+(p?"Right":"");kt.prototype[d]=function(){return this[y](1).value()[0]}}),mo(["initial","tail"],function(d,p){var y="drop"+(p?"":"Right");kt.prototype[d]=function(){return this.__filtered__?new kt(this):this[y](1)}}),kt.prototype.compact=function(){return this.filter(Rr)},kt.prototype.find=function(d){return this.filter(d).head()},kt.prototype.findLast=function(d){return this.reverse().find(d)},kt.prototype.invokeMap=St(function(d,p){return typeof d=="function"?new kt(this):this.map(function(y){return Su(y,d,p)})}),kt.prototype.reject=function(d){return this.filter(Fh(Je(d)))},kt.prototype.slice=function(d,p){d=pt(d);var y=this;return y.__filtered__&&(d>0||p<0)?new kt(y):(d<0?y=y.takeRight(-d):d&&(y=y.drop(d)),p!==n&&(p=pt(p),y=p<0?y.dropRight(-p):y.take(p-d)),y)},kt.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},kt.prototype.toArray=function(){return this.take(H)},ii(kt.prototype,function(d,p){var y=/^(?:filter|find|map|reject)|While$/.test(p),R=/^(?:head|last)$/.test(p),M=F[R?"take"+(p=="last"?"Right":""):p],z=R||/^find/.test(p);M&&(F.prototype[p]=function(){var U=this.__wrapped__,X=R?[1]:arguments,se=U instanceof kt,xe=X[0],we=se||ut(U),Re=function(Pt){var Mt=M.apply(F,ws([Pt],X));return R&&je?Mt[0]:Mt};we&&y&&typeof xe=="function"&&xe.length!=1&&(se=we=!1);var je=this.__chain__,Ye=!!this.__actions__.length,et=z&&!je,yt=se&&!Ye;if(!z&&we){U=yt?U:new kt(this);var tt=d.apply(U,X);return tt.__actions__.push({func:Mh,args:[Re],thisArg:n}),new bo(tt,je)}return et&&yt?d.apply(this,X):(tt=this.thru(Re),et?R?tt.value()[0]:tt.value():tt)})}),mo(["pop","push","shift","sort","splice","unshift"],function(d){var p=sh[d],y=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",R=/^(?:pop|shift)$/.test(d);F.prototype[d]=function(){var M=arguments;if(R&&!this.__chain__){var z=this.value();return p.apply(ut(z)?z:[],M)}return this[y](function(U){return p.apply(ut(U)?U:[],M)})}}),ii(kt.prototype,function(d,p){var y=F[p];if(y){var R=y.name+"";Qt.call(Bl,R)||(Bl[R]=[]),Bl[R].push({name:p,func:y})}}),Bl[Oh(n,x).name]=[{name:"wrapper",func:n}],kt.prototype.clone=TF,kt.prototype.reverse=DF,kt.prototype.value=$F,F.prototype.at=s9,F.prototype.chain=a9,F.prototype.commit=l9,F.prototype.next=c9,F.prototype.plant=d9,F.prototype.reverse=f9,F.prototype.toJSON=F.prototype.valueOf=F.prototype.value=h9,F.prototype.first=F.prototype.head,mu&&(F.prototype[mu]=u9),F},Fl=lF();xa?((xa.exports=Fl)._=Fl,bv._=Fl):qn._=Fl}).call(Vs)})(pg,pg.exports);var uc=pg.exports;const ol=nu(uc);function rR({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};return t||(t={}),yw.forEach(l=>{t!=null&&t[l]||(t={...t,[l]:[]});const c=t[l].reduce((u,f)=>Math.max(u,f.y+f.h),0);a.y=a.y===0?0:c,t[l].push(a)}),t}function oR(e,t){t&&yw.forEach(n=>{t!=null&&t[n]&&(t[n]=t[n].filter(r=>r.i!==e))})}const ke=Z2()(sD((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:_0},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{deleteSheet:n=>{e(r=>{var i,s,a,l;const o=(i=r.dashboard.sheets)==null?void 0:i.findIndex(c=>c.id===n);o!==void 0&&o>-1&&((s=r.dashboard.sheets)==null||s.splice(o,1),r.selectedSheetId=(l=(a=r.dashboard.sheets)==null?void 0:a[0])==null?void 0:l.id)})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const o=r.dashboard.filters;let i={};o==null||o.forEach(a=>{yw.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})},setIsSessionExpired:n=>{e(()=>({isSessionExpired:n}))},setCardPython:(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===o.selectedSheetId);i&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.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}))},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}),setBookmarkKey:n=>{e(()=>({bookmarkKey:n}))},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;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.title=o)})})},setCardInfo:(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===o.selectedSheetId);i&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.info=r)})})},setCardDescription:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.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(f=>f.id===n);if(s){const f=(c=s.cards)==null?void 0:c.find(h=>h.id===r);f&&(f.sql=o,(u=i.onUpdateCard)==null||u.call(i,f,n))}})},setFrameCardData:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.data=o)})})},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;const i=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(c=>c.filterId===o.filterId);i!==void 0&&i>-1?(a=r.filterValues)==null||a.splice(i,1,o):(l=r.filterValues)==null||l.push(o)}):r.filterValues=n})},removeFilterValue: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];const o=(s=r.dashboard.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId);rR({id:n.id,layouts:o==null?void 0:o.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);const l=(s=r.dashboard.sheets)==null?void 0:s.find(c=>c.id===r.selectedSheetId);oR(n,l==null?void 0:l.layouts)}}})},updateFrameCard:(n,r,o)=>{e(i=>{var l,c,u,f,h;const s=(c=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(g=>g.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(g=>g.id===r);if(a){const g=(f=a.cards)==null?void 0:f.findIndex(v=>v.id===o.id);g>-1&&((h=a.cards)==null||h.splice(g,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))}})},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(f=>f.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let f=1/0,h=0;o==="start"&&(f=0),rR({id:r.id,layouts:s.layouts,minH:10,x:h,y:f}),(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(f=>f.id===n);if(i){const f=(l=i.frames)==null?void 0:l.findIndex(h=>h.id===r);console.log(f),typeof f=="number"&&f>-1&&((c=i.frames)==null||c.splice(f,1),(u=i.layout)==null||u.splice(f,1),oR(r,i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,c,u;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n),s=(c=i==null?void 0:i.frames)==null?void 0:c.findIndex(f=>f.id===r.id);i&&((u=i.frames)==null||u.splice(s,1,r))})},updateCard:(n,r)=>{e(o=>{var a,l,c,u,f;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),(f=o.onUpdateCard)==null||f.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,c,u,f,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(g=>g.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(g=>g.id===r.id);i&&((u=i.cards)==null||u.splice(s,1),(f=i.layout)==null||f.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}))},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)},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)=>{Nz({card:n,dataPoint:r,set:e,get:t})}}}))),Mo=()=>ke(e=>e.actions);var Tf=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(){}},Hc=typeof window>"u"||"Deno"in window;function Oo(){}function Lz(e,t){return typeof e=="function"?e(t):e}function C0(e){return typeof e=="number"&&e>=0&&e!==1/0}function fD(e,t){return Math.max(e+(t||0)-Date.now(),0)}function iR(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==_w(s,t.options))return!1}else if(!$d(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||typeof o<"u"&&o!==t.state.fetchStatus||i&&!i(t))}function sR(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Dd(t.options.mutationKey)!==Dd(i))return!1}else if(!$d(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function _w(e,t){return((t==null?void 0:t.queryKeyHashFn)||Dd)(e)}function Dd(e){return JSON.stringify(e,(t,n)=>R0(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function $d(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!$d(e[n],t[n])):!1}function hD(e,t){if(e===t)return e;const n=aR(e)&&aR(t);if(n||R0(e)&&R0(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&&e[u]===void 0&&t[u]===void 0&&r.includes(u)?(a[u]=void 0,l++):(a[u]=hD(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function E0(e,t){if(e&&!t||t&&!e)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function aR(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function R0(e){if(!lR(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!lR(n)||!n.hasOwnProperty("isPrototypeOf"))}function lR(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fz(e){return new Promise(t=>{setTimeout(t,e)})}function O0(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?hD(e,t):t}function jz(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function zz(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xa,Hs,Cc,I2,Bz=(I2=class extends Tf{constructor(){super();Xe(this,Xa,void 0);Xe(this,Hs,void 0);Xe(this,Cc,void 0);Ve(this,Cc,t=>{if(!Hc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){re(this,Hs)||this.setEventListener(re(this,Cc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Hs))==null||t.call(this),Ve(this,Hs,void 0))}setEventListener(t){var n;Ve(this,Cc,t),(n=re(this,Hs))==null||n.call(this),Ve(this,Hs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){re(this,Xa)!==t&&(Ve(this,Xa,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof re(this,Xa)=="boolean"?re(this,Xa):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Xa=new WeakMap,Hs=new WeakMap,Cc=new WeakMap,I2),gg=new Bz,Ec,Ws,Rc,N2,Vz=(N2=class extends Tf{constructor(){super();Xe(this,Ec,!0);Xe(this,Ws,void 0);Xe(this,Rc,void 0);Ve(this,Rc,t=>{if(!Hc&&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(){re(this,Ws)||this.setEventListener(re(this,Rc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Ws))==null||t.call(this),Ve(this,Ws,void 0))}setEventListener(t){var n;Ve(this,Rc,t),(n=re(this,Ws))==null||n.call(this),Ve(this,Ws,t(this.setOnline.bind(this)))}setOnline(t){re(this,Ec)!==t&&(Ve(this,Ec,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return re(this,Ec)}},Ec=new WeakMap,Ws=new WeakMap,Rc=new WeakMap,N2),mg=new Vz;function Hz(e){return Math.min(1e3*2**e,3e4)}function sm(e){return(e??"online")==="online"?mg.isOnline():!0}var pD=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function $b(e){return e instanceof pD}function gD(e){let t=!1,n=0,r=!1,o,i,s;const a=new Promise((w,x)=>{i=w,s=x}),l=w=>{var x;r||(g(new pD(w)),(x=e.abort)==null||x.call(e))},c=()=>{t=!0},u=()=>{t=!1},f=()=>!gg.isFocused()||e.networkMode!=="always"&&!mg.isOnline(),h=w=>{var x;r||(r=!0,(x=e.onSuccess)==null||x.call(e,w),o==null||o(),i(w))},g=w=>{var x;r||(r=!0,(x=e.onError)==null||x.call(e,w),o==null||o(),s(w))},v=()=>new Promise(w=>{var x;o=_=>{const S=r||!f();return S&&w(_),S},(x=e.onPause)==null||x.call(e)}).then(()=>{var w;o=void 0,r||(w=e.onContinue)==null||w.call(e)}),b=()=>{if(r)return;let w;try{w=e.fn()}catch(x){w=Promise.reject(x)}Promise.resolve(w).then(h).catch(x=>{var P;if(r)return;const _=e.retry??(Hc?0:3),S=e.retryDelay??Hz,C=typeof S=="function"?S(n,x):S,E=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,x);if(t||!E){g(x);return}n++,(P=e.onFail)==null||P.call(e,n,x),Fz(C).then(()=>{if(f())return v()}).then(()=>{t?g(x):b()})})};return sm(e.networkMode)?b():v().then(b),{promise:a,cancel:l,continue:()=>(o==null?void 0:o())?a:Promise.resolve(),cancelRetry:c,continueRetry:u}}function Wz(){let e=[],t=0,n=h=>{h()},r=h=>{h()},o=h=>setTimeout(h,0);const i=h=>{o=h},s=h=>{let g;t++;try{g=h()}finally{t--,t||c()}return g},a=h=>{t?e.push(h):o(()=>{n(h)})},l=h=>(...g)=>{a(()=>{h(...g)})},c=()=>{const h=e;e=[],h.length&&o(()=>{r(()=>{h.forEach(g=>{n(g)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:h=>{n=h},setBatchNotifyFunction:h=>{r=h},setScheduler:i}}var Xn=Wz(),Qa,L2,mD=(L2=class{constructor(){Xe(this,Qa,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),C0(this.gcTime)&&Ve(this,Qa,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hc?1/0:5*60*1e3))}clearGcTimeout(){re(this,Qa)&&(clearTimeout(re(this,Qa)),Ve(this,Qa,void 0))}},Qa=new WeakMap,L2),Oc,Pc,Co,Us,Eo,Vn,gf,Ja,Tc,Xp,Go,qi,F2,Uz=(F2=class extends mD{constructor(t){super();Xe(this,Tc);Xe(this,Go);Xe(this,Oc,void 0);Xe(this,Pc,void 0);Xe(this,Co,void 0);Xe(this,Us,void 0);Xe(this,Eo,void 0);Xe(this,Vn,void 0);Xe(this,gf,void 0);Xe(this,Ja,void 0);Ve(this,Ja,!1),Ve(this,gf,t.defaultOptions),Ct(this,Tc,Xp).call(this,t.options),Ve(this,Vn,[]),Ve(this,Co,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ve(this,Oc,t.state||qz(this.options)),this.state=re(this,Oc),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!re(this,Vn).length&&this.state.fetchStatus==="idle"&&re(this,Co).remove(this)}setData(t,n){const r=O0(this.state.data,t,this.options);return Ct(this,Go,qi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ct(this,Go,qi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=re(this,Us);return(r=re(this,Eo))==null||r.cancel(t),n?n.then(Oo).catch(Oo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(re(this,Oc))}isActive(){return re(this,Vn).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||re(this,Vn).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!fD(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}onOnline(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}addObserver(t){re(this,Vn).includes(t)||(re(this,Vn).push(t),this.clearGcTimeout(),re(this,Co).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){re(this,Vn).includes(t)&&(Ve(this,Vn,re(this,Vn).filter(n=>n!==t)),re(this,Vn).length||(re(this,Eo)&&(re(this,Ja)?re(this,Eo).cancel({revert:!0}):re(this,Eo).cancelRetry()),this.scheduleGc()),re(this,Co).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return re(this,Vn).length}invalidate(){this.state.isInvalidated||Ct(this,Go,qi).call(this,{type:"invalidate"})}fetch(t,n){var c,u,f,h;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(re(this,Us))return(c=re(this,Eo))==null||c.continueRetry(),re(this,Us)}if(t&&Ct(this,Tc,Xp).call(this,t),!this.options.queryFn){const g=re(this,Vn).find(v=>v.options.queryFn);g&&Ct(this,Tc,Xp).call(this,g.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={queryKey:this.queryKey,meta:this.meta},i=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(Ve(this,Ja,!0),r.signal)})};i(o);const s=()=>this.options.queryFn?(Ve(this,Ja,!1),this.options.persister?this.options.persister(this.options.queryFn,o,this):this.options.queryFn(o)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};i(a),(u=this.options.behavior)==null||u.onFetch(a,this),Ve(this,Pc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&Ct(this,Go,qi).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=g=>{var v,b,w,x;$b(g)&&g.silent||Ct(this,Go,qi).call(this,{type:"error",error:g}),$b(g)||((b=(v=re(this,Co).config).onError)==null||b.call(v,g,this),(x=(w=re(this,Co).config).onSettled)==null||x.call(w,this.state.data,g,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return Ve(this,Eo,gD({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var v,b,w,x;if(typeof g>"u"){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}`),l(new Error(`${this.queryHash} data is undefined`));return}this.setData(g),(b=(v=re(this,Co).config).onSuccess)==null||b.call(v,g,this),(x=(w=re(this,Co).config).onSettled)==null||x.call(w,g,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(g,v)=>{Ct(this,Go,qi).call(this,{type:"failed",failureCount:g,error:v})},onPause:()=>{Ct(this,Go,qi).call(this,{type:"pause"})},onContinue:()=>{Ct(this,Go,qi).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),Ve(this,Us,re(this,Eo).promise),re(this,Us)}},Oc=new WeakMap,Pc=new WeakMap,Co=new WeakMap,Us=new WeakMap,Eo=new WeakMap,Vn=new WeakMap,gf=new WeakMap,Ja=new WeakMap,Tc=new WeakSet,Xp=function(t){this.options={...re(this,gf),...t},this.updateGcTime(this.options.gcTime)},Go=new WeakSet,qi=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,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:sm(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};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 $b(o)&&o.revert&&re(this,Pc)?{...re(this,Pc),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),Xn.batch(()=>{re(this,Vn).forEach(r=>{r.onQueryUpdate()}),re(this,Co).notify({query:this,type:"updated",action:t})})},F2);function qz(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=typeof t<"u",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 fi,j2,vD=(j2=class extends Tf{constructor(t={}){super();Xe(this,fi,void 0);this.config=t,Ve(this,fi,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??_w(o,n);let s=this.get(i);return s||(s=new Uz({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){re(this,fi).has(t.queryHash)||(re(this,fi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=re(this,fi).get(t.queryHash);n&&(t.destroy(),n===t&&re(this,fi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Xn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return re(this,fi).get(t)}getAll(){return[...re(this,fi).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>iR(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>iR(t,r)):n}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fi=new WeakMap,j2),hi,mf,Xr,Dc,pi,Ls,z2,Gz=(z2=class extends mD{constructor(t){super();Xe(this,pi);Xe(this,hi,void 0);Xe(this,mf,void 0);Xe(this,Xr,void 0);Xe(this,Dc,void 0);this.mutationId=t.mutationId,Ve(this,mf,t.defaultOptions),Ve(this,Xr,t.mutationCache),Ve(this,hi,[]),this.state=t.state||Yz(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...re(this,mf),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){re(this,hi).includes(t)||(re(this,hi).push(t),this.clearGcTimeout(),re(this,Xr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ve(this,hi,re(this,hi).filter(n=>n!==t)),this.scheduleGc(),re(this,Xr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){re(this,hi).length||(this.state.status==="pending"?this.scheduleGc():re(this,Xr).remove(this))}continue(){var t;return((t=re(this,Dc))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,c,u,f,h,g,v,b,w,x,_,S,C,E,P,$;const n=()=>(Ve(this,Dc,gD({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(k,I)=>{Ct(this,pi,Ls).call(this,{type:"failed",failureCount:k,error:I})},onPause:()=>{Ct(this,pi,Ls).call(this,{type:"pause"})},onContinue:()=>{Ct(this,pi,Ls).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),re(this,Dc).promise),r=this.state.status==="pending";try{if(!r){Ct(this,pi,Ls).call(this,{type:"pending",variables:t}),await((i=(o=re(this,Xr).config).onMutate)==null?void 0:i.call(o,t,this));const I=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));I!==this.state.context&&Ct(this,pi,Ls).call(this,{type:"pending",context:I,variables:t})}const k=await n();return await((c=(l=re(this,Xr).config).onSuccess)==null?void 0:c.call(l,k,t,this.state.context,this)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context)),await((g=(h=re(this,Xr).config).onSettled)==null?void 0:g.call(h,k,null,this.state.variables,this.state.context,this)),await((b=(v=this.options).onSettled)==null?void 0:b.call(v,k,null,t,this.state.context)),Ct(this,pi,Ls).call(this,{type:"success",data:k}),k}catch(k){try{throw await((x=(w=re(this,Xr).config).onError)==null?void 0:x.call(w,k,t,this.state.context,this)),await((S=(_=this.options).onError)==null?void 0:S.call(_,k,t,this.state.context)),await((E=(C=re(this,Xr).config).onSettled)==null?void 0:E.call(C,void 0,k,this.state.variables,this.state.context,this)),await(($=(P=this.options).onSettled)==null?void 0:$.call(P,void 0,k,t,this.state.context)),k}finally{Ct(this,pi,Ls).call(this,{type:"error",error:k})}}}},hi=new WeakMap,mf=new WeakMap,Xr=new WeakMap,Dc=new WeakMap,pi=new WeakSet,Ls=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:!sm(this.options.networkMode),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),Xn.batch(()=>{re(this,hi).forEach(r=>{r.onMutationUpdate(t)}),re(this,Xr).notify({mutation:this,type:"updated",action:t})})},z2);function Yz(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ro,vf,Za,B2,Kz=(B2=class extends Tf{constructor(t={}){super();Xe(this,Ro,void 0);Xe(this,vf,void 0);Xe(this,Za,void 0);this.config=t,Ve(this,Ro,[]),Ve(this,vf,0)}build(t,n,r){const o=new Gz({mutationCache:this,mutationId:++Vh(this,vf)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){re(this,Ro).push(t),this.notify({type:"added",mutation:t})}remove(t){Ve(this,Ro,re(this,Ro).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){Xn.batch(()=>{re(this,Ro).forEach(t=>{this.remove(t)})})}getAll(){return re(this,Ro)}find(t){const n={exact:!0,...t};return re(this,Ro).find(r=>sR(n,r))}findAll(t={}){return re(this,Ro).filter(n=>sR(t,n))}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return Ve(this,Za,(re(this,Za)??Promise.resolve()).then(()=>{const t=re(this,Ro).filter(n=>n.state.isPaused);return Xn.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Oo)),Promise.resolve()))}).then(()=>{Ve(this,Za,void 0)})),re(this,Za)}},Ro=new WeakMap,vf=new WeakMap,Za=new WeakMap,B2);function Xz(e){return{onFetch:(t,n)=>{const r=async()=>{var v,b,w,x,_;const o=t.options,i=(w=(b=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:b.fetchMore)==null?void 0:w.direction,s=((x=t.state.data)==null?void 0:x.pages)||[],a=((_=t.state.data)==null?void 0:_.pageParams)||[],l={pages:[],pageParams:[]};let c=!1;const u=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},f=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),h=async(S,C,E)=>{if(c)return Promise.reject();if(C==null&&S.pages.length)return Promise.resolve(S);const P={queryKey:t.queryKey,pageParam:C,direction:E?"backward":"forward",meta:t.options.meta};u(P);const $=await f(P),{maxPages:k}=t.options,I=E?zz:jz;return{pages:I(S.pages,$,k),pageParams:I(S.pageParams,C,k)}};let g;if(i&&s.length){const S=i==="backward",C=S?Qz:cR,E={pages:s,pageParams:a},P=C(o,E);g=await h(E,P,S)}else{g=await h(l,a[0]??o.initialPageParam);const S=e??s.length;for(let C=1;C<S;C++){const E=cR(o,g);g=await h(g,E)}}return g};t.options.persister?t.fetchFn=()=>{var o,i;return(i=(o=t.options).persister)==null?void 0:i.call(o,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function cR(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function Qz(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var In,qs,Gs,$c,Ac,Ys,kc,Mc,V2,Jz=(V2=class{constructor(e={}){Xe(this,In,void 0);Xe(this,qs,void 0);Xe(this,Gs,void 0);Xe(this,$c,void 0);Xe(this,Ac,void 0);Xe(this,Ys,void 0);Xe(this,kc,void 0);Xe(this,Mc,void 0);Ve(this,In,e.queryCache||new vD),Ve(this,qs,e.mutationCache||new Kz),Ve(this,Gs,e.defaultOptions||{}),Ve(this,$c,new Map),Ve(this,Ac,new Map),Ve(this,Ys,0)}mount(){Vh(this,Ys)._++,re(this,Ys)===1&&(Ve(this,kc,gg.subscribe(()=>{gg.isFocused()&&(this.resumePausedMutations(),re(this,In).onFocus())})),Ve(this,Mc,mg.subscribe(()=>{mg.isOnline()&&(this.resumePausedMutations(),re(this,In).onOnline())})))}unmount(){var e,t;Vh(this,Ys)._--,re(this,Ys)===0&&((e=re(this,kc))==null||e.call(this),Ve(this,kc,void 0),(t=re(this,Mc))==null||t.call(this),Ve(this,Mc,void 0))}isFetching(e){return re(this,In).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return re(this,qs).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=re(this,In).find({queryKey:e}))==null?void 0:t.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=re(this,In).find({queryKey:e}),o=r==null?void 0:r.state.data,i=Lz(t,o);if(typeof i>"u")return;const s=this.defaultQueryOptions({queryKey:e});return re(this,In).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Xn.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=re(this,In).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=re(this,In);Xn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=re(this,In),r={type:"active",...e};return Xn.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=Xn.batch(()=>re(this,In).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Oo).catch(Oo)}invalidateQueries(e={},t={}){return Xn.batch(()=>{if(re(this,In).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=Xn.batch(()=>re(this,In).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Oo)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Oo)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=re(this,In).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Oo).catch(Oo)}fetchInfiniteQuery(e){return e.behavior=Xz(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Oo).catch(Oo)}resumePausedMutations(){return re(this,qs).resumePausedMutations()}getQueryCache(){return re(this,In)}getMutationCache(){return re(this,qs)}getDefaultOptions(){return re(this,Gs)}setDefaultOptions(e){Ve(this,Gs,e)}setQueryDefaults(e,t){re(this,$c).set(Dd(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...re(this,$c).values()];let n={};return t.forEach(r=>{$d(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){re(this,Ac).set(Dd(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...re(this,Ac).values()];let n={};return t.forEach(r=>{$d(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...re(this,Gs).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=_w(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...re(this,Gs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){re(this,In).clear(),re(this,qs).clear()}},In=new WeakMap,qs=new WeakMap,Gs=new WeakMap,$c=new WeakMap,Ac=new WeakMap,Ys=new WeakMap,kc=new WeakMap,Mc=new WeakMap,V2),Ar,fn,bf,vr,el,Ic,gi,yf,Nc,Lc,tl,nl,Ks,Fc,rl,ed,xf,P0,wf,T0,_f,D0,Sf,$0,Cf,A0,Ef,k0,Rf,M0,em,bD,H2,Zz=(H2=class extends Tf{constructor(t,n){super();Xe(this,rl);Xe(this,xf);Xe(this,wf);Xe(this,_f);Xe(this,Sf);Xe(this,Cf);Xe(this,Ef);Xe(this,Rf);Xe(this,em);Xe(this,Ar,void 0);Xe(this,fn,void 0);Xe(this,bf,void 0);Xe(this,vr,void 0);Xe(this,el,void 0);Xe(this,Ic,void 0);Xe(this,gi,void 0);Xe(this,yf,void 0);Xe(this,Nc,void 0);Xe(this,Lc,void 0);Xe(this,tl,void 0);Xe(this,nl,void 0);Xe(this,Ks,void 0);Xe(this,Fc,new Set);this.options=n,Ve(this,Ar,t),Ve(this,gi,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(re(this,fn).addObserver(this),uR(re(this,fn),this.options)?Ct(this,rl,ed).call(this):this.updateResult(),Ct(this,Sf,$0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return I0(re(this,fn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return I0(re(this,fn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ct(this,Cf,A0).call(this),Ct(this,Ef,k0).call(this),re(this,fn).removeObserver(this)}setOptions(t,n){const r=this.options,o=re(this,fn);if(this.options=re(this,Ar).defaultQueryOptions(t),E0(r,this.options)||re(this,Ar).getQueryCache().notify({type:"observerOptionsUpdated",query:re(this,fn),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),Ct(this,Rf,M0).call(this);const i=this.hasListeners();i&&dR(re(this,fn),o,this.options,r)&&Ct(this,rl,ed).call(this),this.updateResult(n),i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&Ct(this,xf,P0).call(this);const s=Ct(this,wf,T0).call(this);i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||s!==re(this,Ks))&&Ct(this,_f,D0).call(this,s)}getOptimisticResult(t){const n=re(this,Ar).getQueryCache().build(re(this,Ar),t),r=this.createResult(n,t);return tB(this,r)&&(Ve(this,vr,r),Ve(this,Ic,this.options),Ve(this,el,re(this,fn).state)),r}getCurrentResult(){return re(this,vr)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(re(this,Fc).add(r),t[r])})}),n}getCurrentQuery(){return re(this,fn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=re(this,Ar).defaultQueryOptions(t),r=re(this,Ar).getQueryCache().build(re(this,Ar),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Ct(this,rl,ed).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),re(this,vr)))}createResult(t,n){var P;const r=re(this,fn),o=this.options,i=re(this,vr),s=re(this,el),a=re(this,Ic),c=t!==r?t.state:re(this,bf),{state:u}=t;let{error:f,errorUpdatedAt:h,fetchStatus:g,status:v}=u,b=!1,w;if(n._optimisticResults){const $=this.hasListeners(),k=!$&&uR(t,n),I=$&&dR(t,r,n,o);(k||I)&&(g=sm(t.options.networkMode)?"fetching":"paused",u.dataUpdatedAt||(v="pending")),n._optimisticResults==="isRestoring"&&(g="idle")}if(n.select&&typeof u.data<"u")if(i&&u.data===(s==null?void 0:s.data)&&n.select===re(this,yf))w=re(this,Nc);else try{Ve(this,yf,n.select),w=n.select(u.data),w=O0(i==null?void 0:i.data,w,n),Ve(this,Nc,w),Ve(this,gi,null)}catch($){Ve(this,gi,$)}else w=u.data;if(typeof n.placeholderData<"u"&&typeof w>"u"&&v==="pending"){let $;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))$=i.data;else if($=typeof n.placeholderData=="function"?n.placeholderData((P=re(this,Lc))==null?void 0:P.state.data,re(this,Lc)):n.placeholderData,n.select&&typeof $<"u")try{$=n.select($),Ve(this,gi,null)}catch(k){Ve(this,gi,k)}typeof $<"u"&&(v="success",w=O0(i==null?void 0:i.data,$,n),b=!0)}re(this,gi)&&(f=re(this,gi),w=re(this,Nc),h=Date.now(),v="error");const x=g==="fetching",_=v==="pending",S=v==="error",C=_&&x;return{status:v,fetchStatus:g,isPending:_,isSuccess:v==="success",isError:S,isInitialLoading:C,isLoading:C,data:w,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!_,isLoadingError:S&&u.dataUpdatedAt===0,isPaused:g==="paused",isPlaceholderData:b,isRefetchError:S&&u.dataUpdatedAt!==0,isStale:Sw(t,n),refetch:this.refetch}}updateResult(t){const n=re(this,vr),r=this.createResult(re(this,fn),this.options);if(Ve(this,el,re(this,fn).state),Ve(this,Ic,this.options),re(this,el).data!==void 0&&Ve(this,Lc,re(this,fn)),E0(r,n))return;Ve(this,vr,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!re(this,Fc).size)return!0;const l=new Set(a??re(this,Fc));return this.options.throwOnError&&l.add("error"),Object.keys(re(this,vr)).some(c=>{const u=c;return re(this,vr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),Ct(this,em,bD).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ct(this,Sf,$0).call(this)}},Ar=new WeakMap,fn=new WeakMap,bf=new WeakMap,vr=new WeakMap,el=new WeakMap,Ic=new WeakMap,gi=new WeakMap,yf=new WeakMap,Nc=new WeakMap,Lc=new WeakMap,tl=new WeakMap,nl=new WeakMap,Ks=new WeakMap,Fc=new WeakMap,rl=new WeakSet,ed=function(t){Ct(this,Rf,M0).call(this);let n=re(this,fn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Oo)),n},xf=new WeakSet,P0=function(){if(Ct(this,Cf,A0).call(this),Hc||re(this,vr).isStale||!C0(this.options.staleTime))return;const n=fD(re(this,vr).dataUpdatedAt,this.options.staleTime)+1;Ve(this,tl,setTimeout(()=>{re(this,vr).isStale||this.updateResult()},n))},wf=new WeakSet,T0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(re(this,fn)):this.options.refetchInterval)??!1},_f=new WeakSet,D0=function(t){Ct(this,Ef,k0).call(this),Ve(this,Ks,t),!(Hc||this.options.enabled===!1||!C0(re(this,Ks))||re(this,Ks)===0)&&Ve(this,nl,setInterval(()=>{(this.options.refetchIntervalInBackground||gg.isFocused())&&Ct(this,rl,ed).call(this)},re(this,Ks)))},Sf=new WeakSet,$0=function(){Ct(this,xf,P0).call(this),Ct(this,_f,D0).call(this,Ct(this,wf,T0).call(this))},Cf=new WeakSet,A0=function(){re(this,tl)&&(clearTimeout(re(this,tl)),Ve(this,tl,void 0))},Ef=new WeakSet,k0=function(){re(this,nl)&&(clearInterval(re(this,nl)),Ve(this,nl,void 0))},Rf=new WeakSet,M0=function(){const t=re(this,Ar).getQueryCache().build(re(this,Ar),this.options);if(t===re(this,fn))return;const n=re(this,fn);Ve(this,fn,t),Ve(this,bf,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},em=new WeakSet,bD=function(t){Xn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(re(this,vr))}),re(this,Ar).getQueryCache().notify({query:re(this,fn),type:"observerResultsUpdated"})})},H2);function eB(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function uR(e,t){return eB(e,t)||e.state.dataUpdatedAt>0&&I0(e,t,t.refetchOnMount)}function I0(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Sw(e,t)}return!1}function dR(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&Sw(e,n)}function Sw(e,t){return e.isStaleByTime(t.staleTime)}function tB(e,t){return!E0(e.getCurrentResult(),t)}var yD=V.createContext(void 0),xD=e=>{const t=V.useContext(yD);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},nB=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),V.createElement(yD.Provider,{value:e},t)),wD=V.createContext(!1),rB=()=>V.useContext(wD);wD.Provider;function oB(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var iB=V.createContext(oB()),sB=()=>V.useContext(iB);function aB(e,t){return typeof e=="function"?e(...t):!!e}var lB=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},cB=e=>{V.useEffect(()=>{e.clearReset()},[e])},uB=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&aB(n,[e.error,r]),dB=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},fB=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,hB=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function pB(e,t,n){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=xD(n),o=rB(),i=sB(),s=r.defaultQueryOptions(e);s._optimisticResults=o?"isRestoring":"optimistic",dB(s),lB(s,i),cB(i);const[a]=V.useState(()=>new t(r,s)),l=a.getOptimisticResult(s);if(V.useSyncExternalStore(V.useCallback(c=>{const u=o?()=>{}:a.subscribe(Xn.batchCalls(c));return a.updateResult(),u},[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),V.useEffect(()=>{a.setOptions(s,{listeners:!1})},[s,a]),fB(s,l))throw hB(s,a,i);if(uB({result:l,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw l.error;return s.notifyOnChangeProps?l:a.trackResult(l)}function Df(e,t){return pB(e,Zz,t)}const gB={theme:"system",setTheme:()=>null},_D=m.createContext(gB);function mB({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,i]=m.useState(()=>localStorage.getItem(n)||t);m.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 O.jsx(_D.Provider,{...r,value:s,children:e})}const SD=()=>{const e=m.useContext(_D);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};async function vB(e){return await(await fetch("https://semaphor.cloud/api/v1/dashboard",{headers:{Authorization:`Bearer ${e}`}})).json()}function CD(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function fR(e,t){const n=CD(e);return n==="dark"?ol.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function bB({authToken:e,customStyle:t,currentTheme:n,onSave:r,onEvent:o}){const{data:i,refetch:s,isLoading:a,isError:l}=Df({queryKey:["dashboard",e==null?void 0:e.accessToken],queryFn:()=>vB(e==null?void 0:e.accessToken),enabled:!1}),{theme:c,setTheme:u}=SD(),f=ke($=>$.dashboard.globalStyle),{setDashboard:h,setSelectedSheetId:g,setStyle:v,setOnSaveFunction:b}=ke($=>$.actions);ke($=>$.actions.setCustomCards);const w=ke($=>$.actions.setFilterValues),x=ke($=>$.actions.setBookmarkKey),_=ke($=>$.actions.setAuthToken),S=ke($=>$.actions.setThemeStyle),C=ke($=>$.actions.setDashboardTheme),E=ke($=>$.actions.setOnEvent);m.useEffect(()=>{if(c){const $=CD(c);C($)}},[c,C]),m.useEffect(()=>{n&&u(n)},[n,u]);function P(){const $=ol.cloneDeep(_0),k=ol.merge($,f);if(t){const I=ol.merge(k,t),A=fR(c,I);S(A),v(I)}else{const I=fR(c,k);S(I),v(_0)}}return m.useEffect(()=>{i&&i.dashboard&&P()},[c,t,f]),m.useEffect(()=>{var L;if(!i||!i.dashboard)return;const $=i.dashboard,k=DL($.id),I=JSON.parse(localStorage.getItem(k)||"[]"),A=I.find(j=>j.default===!0);if(A)h(A.template),P(),x(A.name),A.filterValues&&w(A.filterValues);else{h($),P();const j=I.find(K=>(K==null?void 0:K.name)==="Original");j?j.template=$:I.push({name:"Original",template:$,default:!1}),localStorage.setItem(k,JSON.stringify(I))}g((L=$.sheets)==null?void 0:L[0].id)},[i,h,g,w,x]),m.useEffect(()=>{r&&b(r),o&&E(o)},[r,b,o,E]),m.useEffect(()=>{e&&e.accessToken&&(_(e),s())},[e,s,_]),{isLoading:a,isError:l}}function am({className:e,...t}){return O.jsx("div",{className:Ce("animate-pulse rounded-md bg-muted",e),...t})}const Cw=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Cw.displayName="Card";const lm=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce("flex flex-col space-y-1.5 p-6",e),...t}));lm.displayName="CardHeader";const $f=V.forwardRef(({className:e,...t},n)=>O.jsx("h3",{ref:n,className:Ce("text-2xl font-semibold leading-none tracking-tight",e),...t}));$f.displayName="CardTitle";const Ew=V.forwardRef(({className:e,...t},n)=>O.jsx("p",{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));Ew.displayName="CardDescription";const cm=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce("px-6 pt-0",e),...t}));cm.displayName="CardContent";const Rw=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce("flex items-center p-6 pt-0",e),...t}));Rw.displayName="CardFooter";function ED({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:f,showAssistant:h,...g}){ke(_=>_.selectedSheetId);const v=ke(_=>_.themeStyle),b=ke(_=>_.isSessionExpired),{isLoading:w,isError:x}=bB({authToken:l,customStyle:t,currentTheme:c,onSave:n,onEvent:r});return w||!l?(r==null||r({type:"info",message:"Loading dashboard"}),o?O.jsx(o,{message:"loading"}):O.jsx("div",{className:"flex items-center gap-3",children:O.jsx(am,{className:"h-1 w-full dark:h-[2px]"})})):x?(r==null||r({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),O.jsx(i,{})):O.jsx("div",{children:"Error"})):b?(r==null||r({type:"error",message:"Session Expired"}),O.jsx("div",{className:"flex h-full items-center justify-center",children:O.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[O.jsx($f,{children:"Session Expired"}),O.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):O.jsx("div",{className:Ce("flex h-full flex-col justify-between",v==null?void 0:v.dashboardPanel,e),role:"dashboard-panel",...g})}function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},he.apply(this,arguments)}function Me(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 Zn(e,t=[]){let n=[];function r(i,s){const a=m.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:g,...v}=f,b=(h==null?void 0:h[e][l])||a,w=m.useMemo(()=>v,Object.values(v));return m.createElement(b.Provider,{value:w},g)}function u(f,h){const g=(h==null?void 0:h[e][l])||a,v=m.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>m.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,yB(o,...t)]}function yB(...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 f=l(i)[`__scope${c}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function xB(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function cs(...e){return t=>e.forEach(n=>xB(n,t))}function _t(...e){return m.useCallback(cs(...e),e)}const N0=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(_B);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(L0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(L0,he({},r,{ref:t}),n)});N0.displayName="Slot";const L0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...SB(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});L0.displayName="SlotClone";const wB=({children:e})=>m.createElement(m.Fragment,null,e);function _B(e){return m.isValidElement(e)&&e.type===wB}function SB(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 um(e){const t=e+"CollectionProvider",[n,r]=Zn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:v,children:b}=g,w=m.useRef(null),x=m.useRef(new Map).current;return m.createElement(o,{scope:v,itemMap:x,collectionRef:w},b)},a=e+"CollectionSlot",l=m.forwardRef((g,v)=>{const{scope:b,children:w}=g,x=i(a,b),_=_t(v,x.collectionRef);return m.createElement(N0,{ref:_},w)}),c=e+"CollectionItemSlot",u="data-radix-collection-item",f=m.forwardRef((g,v)=>{const{scope:b,children:w,...x}=g,_=m.useRef(null),S=_t(v,_),C=i(c,b);return m.useEffect(()=>(C.itemMap.set(_,{ref:_,...x}),()=>void C.itemMap.delete(_))),m.createElement(N0,{[u]:"",ref:S},w)});function h(g){const v=i(e+"CollectionConsumer",g);return m.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const x=Array.from(w.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((C,E)=>x.indexOf(C.ref.current)-x.indexOf(E.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}const ur=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},CB=V.useId||(()=>{});let EB=0;function Jo(e){const[t,n]=V.useState(CB());return ur(()=>{e||n(r=>r??String(EB++))},[e]),e||(t?`radix-${t}`:"")}const RD=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(OB);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(F0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(F0,he({},r,{ref:t}),n)});RD.displayName="Slot";const F0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...PB(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});F0.displayName="SlotClone";const RB=({children:e})=>m.createElement(m.Fragment,null,e);function OB(e){return m.isValidElement(e)&&e.type===RB}function PB(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}}const TB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Qe=TB.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?RD:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(a,he({},s,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function OD(e,t){e&&ko.flushSync(()=>e.dispatchEvent(t))}function Ln(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function wr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=DB({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Ln(n),l=m.useCallback(c=>{if(i){const f=typeof c=="function"?c(e):c;f!==e&&a(f)}else o(c)},[i,e,o,a]);return[s,l]}function DB({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),i=Ln(t);return m.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}const $B=m.createContext(void 0);function _l(e){const t=m.useContext($B);return e||t||"ltr"}const Ab="rovingFocusGroup.onEntryFocus",AB={bubbles:!1,cancelable:!0},Ow="RovingFocusGroup",[j0,PD,kB]=um(Ow),[MB,ou]=Zn(Ow,[kB]),[IB,NB]=MB(Ow),LB=m.forwardRef((e,t)=>m.createElement(j0.Provider,{scope:e.__scopeRovingFocusGroup},m.createElement(j0.Slot,{scope:e.__scopeRovingFocusGroup},m.createElement(FB,he({},e,{ref:t}))))),FB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...u}=e,f=m.useRef(null),h=_t(t,f),g=_l(i),[v=null,b]=wr({prop:s,defaultProp:a,onChange:l}),[w,x]=m.useState(!1),_=Ln(c),S=PD(n),C=m.useRef(!1),[E,P]=m.useState(0);return m.useEffect(()=>{const $=f.current;if($)return $.addEventListener(Ab,_),()=>$.removeEventListener(Ab,_)},[_]),m.createElement(IB,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:m.useCallback($=>b($),[b]),onItemShiftTab:m.useCallback(()=>x(!0),[]),onFocusableItemAdd:m.useCallback(()=>P($=>$+1),[]),onFocusableItemRemove:m.useCallback(()=>P($=>$-1),[])},m.createElement(Qe.div,he({tabIndex:w||E===0?-1:0,"data-orientation":r},u,{ref:h,style:{outline:"none",...e.style},onMouseDown:Me(e.onMouseDown,()=>{C.current=!0}),onFocus:Me(e.onFocus,$=>{const k=!C.current;if($.target===$.currentTarget&&k&&!w){const I=new CustomEvent(Ab,AB);if($.currentTarget.dispatchEvent(I),!I.defaultPrevented){const A=S().filter(B=>B.focusable),L=A.find(B=>B.active),j=A.find(B=>B.id===v),Z=[L,j,...A].filter(Boolean).map(B=>B.ref.current);TD(Z)}}C.current=!1}),onBlur:Me(e.onBlur,()=>x(!1))})))}),jB="RovingFocusGroupItem",zB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Jo(),l=i||a,c=NB(jB,n),u=c.currentTabStopId===l,f=PD(n),{onFocusableItemAdd:h,onFocusableItemRemove:g}=c;return m.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),m.createElement(j0.ItemSlot,{scope:n,id:l,focusable:r,active:o},m.createElement(Qe.span,he({tabIndex:u?0:-1,"data-orientation":c.orientation},s,{ref:t,onMouseDown:Me(e.onMouseDown,v=>{r?c.onItemFocus(l):v.preventDefault()}),onFocus:Me(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Me(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=HB(v,c.orientation,c.dir);if(b!==void 0){v.preventDefault();let x=f().filter(_=>_.focusable).map(_=>_.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const _=x.indexOf(v.currentTarget);x=c.loop?WB(x,_+1):x.slice(_+1)}setTimeout(()=>TD(x))}})})))}),BB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function VB(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function HB(e,t,n){const r=VB(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return BB[r]}function TD(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function WB(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Pw=LB,Tw=zB;function UB(e,t){return m.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const er=e=>{const{present:t,children:n}=e,r=qB(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=_t(r.ref,o.ref);return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};er.displayName="Presence";function qB(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),i=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=UB(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=qh(r.current);i.current=a==="mounted"?c:"none"},[a]),ur(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,g=qh(c);e?l("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),ur(()=>{if(t){const c=f=>{const g=qh(r.current).includes(f.animationName);f.target===t&&g&&ko.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===t&&(i.current=qh(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function qh(e){return(e==null?void 0:e.animationName)||"none"}const DD="Tabs",[GB,rye]=Zn(DD,[ou]),$D=ou(),[YB,Dw]=GB(DD),KB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=_l(a),[f,h]=wr({prop:r,onChange:o,defaultProp:i});return m.createElement(YB,{scope:n,baseId:Jo(),value:f,onValueChange:h,orientation:s,dir:u,activationMode:l},m.createElement(Qe.div,he({dir:u,"data-orientation":s},c,{ref:t})))}),XB="TabsList",QB=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Dw(XB,n),s=$D(n);return m.createElement(Pw,he({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:r}),m.createElement(Qe.div,he({role:"tablist","aria-orientation":i.orientation},o,{ref:t})))}),JB="TabsTrigger",ZB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Dw(JB,n),a=$D(n),l=AD(s.baseId,r),c=kD(s.baseId,r),u=r===s.value;return m.createElement(Tw,he({asChild:!0},a,{focusable:!o,active:u}),m.createElement(Qe.button,he({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:Me(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Me(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Me(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!o&&f&&s.onValueChange(r)})})))}),eV="TabsContent",tV=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Dw(eV,n),l=AD(a.baseId,r),c=kD(a.baseId,r),u=r===a.value,f=m.useRef(u);return m.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),m.createElement(er,{present:o||u},({present:h})=>m.createElement(Qe.div,he({"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:f.current?"0s":void 0}}),h&&i))});function AD(e,t){return`${e}-trigger-${t}`}function kD(e,t){return`${e}-content-${t}`}const nV=KB,MD=QB,ID=ZB,ND=tV,LD=nV,$w=V.forwardRef(({className:e,...t},n)=>O.jsx(MD,{ref:n,className:Ce("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));$w.displayName=MD.displayName;const Aw=V.forwardRef(({className:e,...t},n)=>O.jsx(ID,{ref:n,className:Ce("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}));Aw.displayName=ID.displayName;const kw=V.forwardRef(({className:e,...t},n)=>O.jsx(ND,{ref:n,className:Ce("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));kw.displayName=ND.displayName;var FD={exports:{}},Af={},z0={exports:{}};(function(e,t){(function(n,r){r(t)})(Vs,function(n){function r(ie){return function(ae,ye,G,be,_e,Pe,Te){return ie(ae,ye,Te)}}function o(ie){return function(ae,ye,G,be){if(!ae||!ye||typeof ae!="object"||typeof ye!="object")return ie(ae,ye,G,be);var _e=be.get(ae),Pe=be.get(ye);if(_e&&Pe)return _e===ye&&Pe===ae;be.set(ae,ye),be.set(ye,ae);var Te=ie(ae,ye,G,be);return be.delete(ae),be.delete(ye),Te}}function i(ie,te){var ae={};for(var ye in ie)ae[ye]=ie[ye];for(var ye in te)ae[ye]=te[ye];return ae}function s(ie){return ie.constructor===Object||ie.constructor==null}function a(ie){return typeof ie.then=="function"}function l(ie,te){return ie===te||ie!==ie&&te!==te}var c="[object Arguments]",u="[object Boolean]",f="[object Date]",h="[object RegExp]",g="[object Map]",v="[object Number]",b="[object Object]",w="[object Set]",x="[object String]",_=Object.prototype.toString;function S(ie){var te=ie.areArraysEqual,ae=ie.areDatesEqual,ye=ie.areMapsEqual,G=ie.areObjectsEqual,be=ie.areRegExpsEqual,_e=ie.areSetsEqual,Pe=ie.createIsNestedEqual,Te=Pe(Ue);function Ue(Be,Ie,Ke){if(Be===Ie)return!0;if(!Be||!Ie||typeof Be!="object"||typeof Ie!="object")return Be!==Be&&Ie!==Ie;if(s(Be)&&s(Ie))return G(Be,Ie,Te,Ke);var lt=Array.isArray(Be),It=Array.isArray(Ie);if(lt||It)return lt===It&&te(Be,Ie,Te,Ke);var $t=_.call(Be);return $t!==_.call(Ie)?!1:$t===f?ae(Be,Ie,Te,Ke):$t===h?be(Be,Ie,Te,Ke):$t===g?ye(Be,Ie,Te,Ke):$t===w?_e(Be,Ie,Te,Ke):$t===b||$t===c?a(Be)||a(Ie)?!1:G(Be,Ie,Te,Ke):$t===u||$t===v||$t===x?l(Be.valueOf(),Ie.valueOf()):!1}return Ue}function C(ie,te,ae,ye){var G=ie.length;if(te.length!==G)return!1;for(;G-- >0;)if(!ae(ie[G],te[G],G,G,ie,te,ye))return!1;return!0}var E=o(C);function P(ie,te){return l(ie.valueOf(),te.valueOf())}function $(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={},_e=0;return ie.forEach(function(Pe,Te){if(G){var Ue=!1,Be=0;te.forEach(function(Ie,Ke){!Ue&&!be[Be]&&(Ue=ae(Te,Ke,_e,Be,ie,te,ye)&&ae(Pe,Ie,Te,Ke,ie,te,ye))&&(be[Be]=!0),Be++}),_e++,G=Ue}}),G}var k=o($),I="_owner",A=Object.prototype.hasOwnProperty;function L(ie,te,ae,ye){var G=Object.keys(ie),be=G.length;if(Object.keys(te).length!==be)return!1;for(var _e;be-- >0;){if(_e=G[be],_e===I){var Pe=!!ie.$$typeof,Te=!!te.$$typeof;if((Pe||Te)&&Pe!==Te)return!1}if(!A.call(te,_e)||!ae(ie[_e],te[_e],_e,_e,ie,te,ye))return!1}return!0}var j=o(L);function K(ie,te){return ie.source===te.source&&ie.flags===te.flags}function Z(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={};return ie.forEach(function(_e,Pe){if(G){var Te=!1,Ue=0;te.forEach(function(Be,Ie){!Te&&!be[Ue]&&(Te=ae(_e,Be,Pe,Ie,ie,te,ye))&&(be[Ue]=!0),Ue++}),G=Te}}),G}var B=o(Z),Q=Object.freeze({areArraysEqual:C,areDatesEqual:P,areMapsEqual:$,areObjectsEqual:L,areRegExpsEqual:K,areSetsEqual:Z,createIsNestedEqual:r}),W=Object.freeze({areArraysEqual:E,areDatesEqual:P,areMapsEqual:k,areObjectsEqual:j,areRegExpsEqual:K,areSetsEqual:B,createIsNestedEqual:r}),Y=S(Q);function oe(ie,te){return Y(ie,te,void 0)}var D=S(i(Q,{createIsNestedEqual:function(){return l}}));function H(ie,te){return D(ie,te,void 0)}var J=S(W);function N(ie,te){return J(ie,te,new WeakMap)}var ce=S(i(W,{createIsNestedEqual:function(){return l}}));function le(ie,te){return ce(ie,te,new WeakMap)}function de(ie){return S(i(Q,ie(Q)))}function pe(ie){var te=S(i(W,ie(W)));return function(ae,ye,G){return G===void 0&&(G=new WeakMap),te(ae,ye,G)}}n.circularDeepEqual=N,n.circularShallowEqual=le,n.createCustomCircularEqual=pe,n.createCustomEqual=de,n.deepEqual=oe,n.sameValueZeroEqual=l,n.shallowEqual=H,Object.defineProperty(n,"__esModule",{value:!0})})})(z0,z0.exports);var Mw=z0.exports;const Iw=hw(xj);var Ot={},rV=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(Ot,"__esModule",{value:!0});Ot.bottom=Nw;Ot.childrenEqual=aV;Ot.cloneLayout=jD;Ot.cloneLayoutItem=il;Ot.collides=dm;Ot.compact=BD;Ot.compactItem=VD;Ot.compactType=wV;Ot.correctBounds=HD;Ot.fastPositionEqual=cV;Ot.fastRGLPropsEqual=void 0;Ot.getAllCollisions=WD;Ot.getFirstCollision=qa;Ot.getLayoutItem=Lw;Ot.getStatics=Fw;Ot.modifyLayout=zD;Ot.moveElement=nd;Ot.moveElementAwayFromCollision=V0;Ot.noop=void 0;Ot.perc=dV;Ot.resizeItemInDirection=vV;Ot.setTopLeft=yV;Ot.setTransform=bV;Ot.sortLayoutItems=Ww;Ot.sortLayoutItemsByColRow=KD;Ot.sortLayoutItemsByRowCol=YD;Ot.synchronizeLayoutWithChildren=xV;Ot.validateLayout=XD;Ot.withLayoutItem=sV;var hR=Mw,td=oV(m);function oV(e){return e&&e.__esModule?e:{default:e}}const iV=process.env.NODE_ENV==="production";function Nw(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 jD(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=il(e[n]);return t}function zD(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 sV(e,t,n){let r=Lw(e,t);return r?(r=n(il(r)),e=zD(e,r),[e,r]):[e,null]}function il(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 aV(e,t){return(0,hR.deepEqual)(td.default.Children.map(e,n=>n==null?void 0:n.key),td.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,hR.deepEqual)(td.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),td.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}const lV=rV;Ot.fastRGLPropsEqual=lV;function cV(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function dm(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 BD(e,t,n,r){const o=Fw(e),i=Ww(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let c=il(i[a]);c.static||(c=VD(o,c,t,n,i,r),o.push(c)),s[e.indexOf(i[a])]=c,c.moved=!1}return s}const uV={x:"w",y:"h"};function B0(e,t,n,r){const o=uV[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;dm(t,a)&&B0(e,a,n+t[o],r)}}t[r]=n}function VD(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(Nw(e),t.y);t.y>0&&!qa(e,t);)t.y--;else if(a)for(;t.x>0&&!qa(e,t);)t.x--;let l;for(;(l=qa(e,t))&&!(n===null&&i);)if(a?B0(o,t,l.x+l.w,"x"):B0(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!qa(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function HD(e,t){const n=Fw(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(;qa(n,i);)i.y++}return e}function Lw(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function qa(e,t){for(let n=0,r=e.length;n<r;n++)if(dm(e[n],t))return e[n]}function WD(e,t){return e.filter(n=>dm(n,t))}function Fw(e){return e.filter(t=>t.static)}function nd(e,t,n,r,o,i,s,a,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;"Moving element ".concat(t.i," to [").concat(String(n),",").concat(String(r),"] from [").concat(t.x,",").concat(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 f=Ww(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(f=f.reverse());const g=WD(f,t),v=g.length>0;if(v&&l)return jD(e);if(v&&i)return"Collision prevented on ".concat(t.i,", reverting."),t.x=c,t.y=u,t.moved=!1,e;for(let b=0,w=g.length;b<w;b++){const x=g[b];"Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(x.i," at [").concat(x.x,",").concat(x.y,"]"),!x.moved&&(x.static?e=V0(e,x,t,o,s):e=V0(e,t,x,o,s))}return e}function V0(e,t,n,r,o,i){const s=o==="horizontal",a=o==="vertical",l=t.static;if(r){r=!1;const f={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=qa(e,f),g=h&&h.y+h.h>t.y,v=h&&t.x+t.w>h.x;if(h){if(g&&a)return nd(e,n,void 0,t.y+1,r,l,o);if(g&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(v&&s)return nd(e,t,n.x,void 0,r,l,o)}else return"Doing reverse collision on ".concat(n.i," up to [").concat(f.x,",").concat(f.y,"]."),nd(e,n,s?f.x:void 0,a?f.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:nd(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function dV(e){return e*100+"%"}const UD=(e,t,n,r)=>e+n>r?t:n,qD=(e,t,n)=>e<0?t:n,GD=e=>Math.max(0,e),jw=e=>Math.max(0,e),zw=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:qD(s,e.height,o),top:jw(s)}},Bw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:UD(e.left,e.width,s,n),left:GD(o)}},Vw=(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:UD(e.left,e.width,i,n),top:jw(r),left:GD(s)}},Hw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:qD(r,e.height,i),top:jw(r)}},fV=function(){return zw(arguments.length<=0?void 0:arguments[0],Bw(...arguments))},hV=function(){return zw(arguments.length<=0?void 0:arguments[0],Vw(...arguments))},pV=function(){return Hw(arguments.length<=0?void 0:arguments[0],Bw(...arguments))},gV=function(){return Hw(arguments.length<=0?void 0:arguments[0],Vw(...arguments))},mV={n:zw,ne:fV,e:Bw,se:pV,s:Hw,sw:gV,w:Vw,nw:hV};function vV(e,t,n,r){const o=mV[e];return o?o(t,{...t,...n},r):n}function bV(e){let{top:t,left:n,width:r,height:o}=e;const i="translate(".concat(n,"px,").concat(t,"px)");return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function yV(e){let{top:t,left:n,width:r,height:o}=e;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function Ww(e,t){return t==="horizontal"?KD(e):t==="vertical"?YD(e):e}function YD(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 KD(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 xV(e,t,n,r,o){e=e||[];const i=[];td.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=Lw(e,String(a.key)),c=a.props["data-grid"];l&&c==null?i.push(il(l)):c?(iV||XD([c],"ReactGridLayout.children"),i.push(il({...c,i:a.key}))):i.push(il({w:1,h:1,x:0,y:Nw(i),i:String(a.key)}))});const s=HD(i,{cols:n});return o?s:BD(s,r,n)}function XD(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++)if(typeof i[n[s]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[s]+" must be a number!")}}function wV(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const _V=()=>{};Ot.noop=_V;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.calcGridColWidth=fm;Ri.calcGridItemPosition=SV;Ri.calcGridItemWHPx=H0;Ri.calcWH=EV;Ri.calcXY=CV;Ri.clamp=Ga;function fm(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function H0(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function SV(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,c=fm(e),u={};return i&&i.resizing?(u.width=Math.round(i.resizing.width),u.height=Math.round(i.resizing.height)):(u.width=H0(r,c,s[0]),u.height=H0(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 CV(e,t,n,r,o){const{margin:i,cols:s,rowHeight:a,maxRows:l}=e,c=fm(e);let u=Math.round((n-i[0])/(c+i[0])),f=Math.round((t-i[1])/(a+i[1]));return u=Ga(u,0,s-r),f=Ga(f,0,l-o),{x:u,y:f}}function EV(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=fm(e);let f=Math.round((t+s[0])/(u+s[0])),h=Math.round((n+s[1])/(c+s[1])),g=Ga(f,0,l-r),v=Ga(h,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(g=Ga(f,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(v=Ga(h,0,a)),{w:g,h:v}}function Ga(e,t,n){return Math.max(Math.min(e,n),t)}var hm={},W0={exports:{}},kb,pR;function Uw(){if(pR)return kb;pR=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return kb=e,kb}var Mb,gR;function RV(){if(gR)return Mb;gR=1;var e=Uw();function t(){}function n(){}return n.resetWarningCache=t,Mb=function(){function r(s,a,l,c,u,f){if(f!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Mb}var Gh={exports:{}},qt={};/** @license React v16.13.1
89
89
  * react-is.development.js
90
90
  *
91
91
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -8508,7 +8508,7 @@ const je = BT()(
8508
8508
  selectedCard: null,
8509
8509
  showFilters: !1,
8510
8510
  //This should be false by default
8511
- isDashboardEditing: !0,
8511
+ isDashboardEditing: !1,
8512
8512
  // This should be false by defaultdashboard.
8513
8513
  isVisualEditing: !1,
8514
8514
  // This should be false by defaultdashboard.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-qQHxI2VY.js");require("react");require("react-dom");exports.Dashboard=e.Dashboard;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-WM7PvYE2.js");require("react");require("react-dom");exports.Dashboard=e.Dashboard;
@@ -1,4 +1,4 @@
1
- import { D as p } from "../chunks/index-nvObQgx0.js";
1
+ import { D as p } from "../chunks/index-icDf4hJ3.js";
2
2
  import "react";
3
3
  import "react-dom";
4
4
  export {
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-qQHxI2VY.js"),d=require("./chunks/dashboard-plus-qauJ8uMw.js"),I=require("react");require("react-dom");function N({card:t,footer:u,className:m,...c}){const{customCards:r}=e.useSemaphorContext(),h=I.useRef(null),{isError:p,isLoading:n,isFetching:i,cfg:x,visualKey:C,handleDatapointClick:f}=e.useDashboardCard(t),a=e.useDashboardStore(s=>s.themeStyle),l=e.useDashboardStore(s=>s.selectedSheetId),E=e.useDashboardStore(s=>s.selectedCardId),j=e.useDashboardStore(s=>s.isDashboardEditing),{setCardTitle:g,setCardDescription:D,setSelectedCardId:b}=e.useDashboardActions();function S(s){s.stopPropagation(),b(l,t.id)}function T(){if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.replaceDefault){const o=s.content;if(o)return e.jsxRuntimeExports.jsx(o,{card:t})}}return t.type==="kpi"?t.data&&t.data.length>0&&e.jsxRuntimeExports.jsx(e.KPICard,{isLoading:n||i,card:t}):y}function R(){if(p)return e.jsxRuntimeExports.jsx("p",{className:"text-sm",children:"Oops! It seems like something went wrong. Please review your connection or filters."});if(t.type==="table"&&t.data&&t.data.length>0)return e.jsxRuntimeExports.jsxs(e.ScrollArea,{children:[e.jsxRuntimeExports.jsx(e.TableVisual,{card:t,data:t.data}),e.jsxRuntimeExports.jsx(e.ScrollBar,{orientation:"horizontal"})]});if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.content){const o=s.content;return e.jsxRuntimeExports.jsx(o,{card:t})}}if(x)return e.jsxRuntimeExports.jsx(e.ChartJsVisual,{cfg:x,onDatapointClick:f},C)}function A(){if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.footer){const o=s.footer;if(o)return e.jsxRuntimeExports.jsx(o,{card:t})}}return u||null}if(!t.id)return null;const y=e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(e.CardHeader,{className:"pb-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Editable,{text:t.title,onSave:s=>g(l,t.id,s),children:e.jsxRuntimeExports.jsx(e.CardTitle,{className:"text-base",children:t.title})}),t.refreshInterval&&e.jsxRuntimeExports.jsxs(e.Tooltip,{children:[e.jsxRuntimeExports.jsx(e.TooltipTrigger,{className:"pr-1",children:e.jsxRuntimeExports.jsx("div",{className:e.cn("h-2 w-2 rounded-full bg-green-500 transition-opacity",{"opacity-10":n||i})})}),e.jsxRuntimeExports.jsx(e.TooltipContent,{side:"right",align:"center",children:e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:`Realtime (${t==null?void 0:t.refreshInterval})`})})]}),!t.refreshInterval&&(n||i)&&e.jsxRuntimeExports.jsx(e.LoaderCircle,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),e.jsxRuntimeExports.jsx(e.Editable,{text:(t==null?void 0:t.description)||"",onSave:s=>D(l,t.id,s),children:e.jsxRuntimeExports.jsxs(e.CardDescription,{children:[" ",t.description]})})]}),e.jsxRuntimeExports.jsx(e.CardContent,{className:"relative flex grow flex-col overflow-auto pb-0",children:R()}),e.jsxRuntimeExports.jsx(e.CardFooter,{children:A()})]});return e.jsxRuntimeExports.jsx(e.Card,{tabIndex:-1,ref:h,role:"dashboard-card",onClick:S,className:e.cn("relative flex h-full flex-col rounded-sm",{"border-dashed border-foreground/50":E===t.id&&j},a==null?void 0:a.dashboardCard,m),...c,children:T()})}exports.BOOLEAN_DATA_TYPES=e.BOOLEAN_DATA_TYPES;exports.DATE_DATA_TYPES=e.DATE_DATA_TYPES;exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.NUMBER_DATA_TYPES=e.NUMBER_DATA_TYPES;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.TEXT_DATA_TYPES=e.TEXT_DATA_TYPES;exports.cleanCard=e.cleanCard;exports.createSqlGenConfig=e.createSqlGenConfig;exports.fmt=e.fmt;exports.getBookmarkKey=e.getBookmarkKey;exports.getColumnDataType=e.getColumnDataType;exports.getDashbaordStateWithoutData=e.getDashbaordStateWithoutData;exports.getFilterValueType=e.getFilterValueType;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.resolveDataType=e.resolveDataType;exports.useCard=e.useCard;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardStore=e.useDashboardStore;exports.useEditorActions=e.useEditorActions;exports.useEditorStore=e.useEditorStore;exports.SelectComponent=d.SelectComponent;exports.Surfboard=d.DashboardPlus;exports.useEditorAside=d.useEditorAside;exports.DashboardCard=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-WM7PvYE2.js"),d=require("./chunks/dashboard-plus-Azf5X9Lv.js"),I=require("react");require("react-dom");function N({card:t,footer:u,className:m,...c}){const{customCards:r}=e.useSemaphorContext(),h=I.useRef(null),{isError:p,isLoading:n,isFetching:i,cfg:x,visualKey:C,handleDatapointClick:f}=e.useDashboardCard(t),a=e.useDashboardStore(s=>s.themeStyle),l=e.useDashboardStore(s=>s.selectedSheetId),E=e.useDashboardStore(s=>s.selectedCardId),j=e.useDashboardStore(s=>s.isDashboardEditing),{setCardTitle:g,setCardDescription:D,setSelectedCardId:b}=e.useDashboardActions();function S(s){s.stopPropagation(),b(l,t.id)}function T(){if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.replaceDefault){const o=s.content;if(o)return e.jsxRuntimeExports.jsx(o,{card:t})}}return t.type==="kpi"?t.data&&t.data.length>0&&e.jsxRuntimeExports.jsx(e.KPICard,{isLoading:n||i,card:t}):y}function R(){if(p)return e.jsxRuntimeExports.jsx("p",{className:"text-sm",children:"Oops! It seems like something went wrong. Please review your connection or filters."});if(t.type==="table"&&t.data&&t.data.length>0)return e.jsxRuntimeExports.jsxs(e.ScrollArea,{children:[e.jsxRuntimeExports.jsx(e.TableVisual,{card:t,data:t.data}),e.jsxRuntimeExports.jsx(e.ScrollBar,{orientation:"horizontal"})]});if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.content){const o=s.content;return e.jsxRuntimeExports.jsx(o,{card:t})}}if(x)return e.jsxRuntimeExports.jsx(e.ChartJsVisual,{cfg:x,onDatapointClick:f},C)}function A(){if(r&&r.length>0){const s=r.find(o=>o.cardId===t.id);if(s&&s.footer){const o=s.footer;if(o)return e.jsxRuntimeExports.jsx(o,{card:t})}}return u||null}if(!t.id)return null;const y=e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(e.CardHeader,{className:"pb-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Editable,{text:t.title,onSave:s=>g(l,t.id,s),children:e.jsxRuntimeExports.jsx(e.CardTitle,{className:"text-base",children:t.title})}),t.refreshInterval&&e.jsxRuntimeExports.jsxs(e.Tooltip,{children:[e.jsxRuntimeExports.jsx(e.TooltipTrigger,{className:"pr-1",children:e.jsxRuntimeExports.jsx("div",{className:e.cn("h-2 w-2 rounded-full bg-green-500 transition-opacity",{"opacity-10":n||i})})}),e.jsxRuntimeExports.jsx(e.TooltipContent,{side:"right",align:"center",children:e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:`Realtime (${t==null?void 0:t.refreshInterval})`})})]}),!t.refreshInterval&&(n||i)&&e.jsxRuntimeExports.jsx(e.LoaderCircle,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),e.jsxRuntimeExports.jsx(e.Editable,{text:(t==null?void 0:t.description)||"",onSave:s=>D(l,t.id,s),children:e.jsxRuntimeExports.jsxs(e.CardDescription,{children:[" ",t.description]})})]}),e.jsxRuntimeExports.jsx(e.CardContent,{className:"relative flex grow flex-col overflow-auto pb-0",children:R()}),e.jsxRuntimeExports.jsx(e.CardFooter,{children:A()})]});return e.jsxRuntimeExports.jsx(e.Card,{tabIndex:-1,ref:h,role:"dashboard-card",onClick:S,className:e.cn("relative flex h-full flex-col rounded-sm",{"border-dashed border-foreground/50":E===t.id&&j},a==null?void 0:a.dashboardCard,m),...c,children:T()})}exports.BOOLEAN_DATA_TYPES=e.BOOLEAN_DATA_TYPES;exports.DATE_DATA_TYPES=e.DATE_DATA_TYPES;exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.NUMBER_DATA_TYPES=e.NUMBER_DATA_TYPES;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.TEXT_DATA_TYPES=e.TEXT_DATA_TYPES;exports.cleanCard=e.cleanCard;exports.createSqlGenConfig=e.createSqlGenConfig;exports.fmt=e.fmt;exports.getBookmarkKey=e.getBookmarkKey;exports.getColumnDataType=e.getColumnDataType;exports.getDashbaordStateWithoutData=e.getDashbaordStateWithoutData;exports.getFilterValueType=e.getFilterValueType;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.resolveDataType=e.resolveDataType;exports.useCard=e.useCard;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardStore=e.useDashboardStore;exports.useEditorActions=e.useEditorActions;exports.useEditorStore=e.useEditorStore;exports.SelectComponent=d.SelectComponent;exports.Surfboard=d.DashboardPlus;exports.useEditorAside=d.useEditorAside;exports.DashboardCard=N;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { u as _, a as k, b as n, c as w, j as s, C as F, E as f, d as P, T as R, e as B, f as h, g as L, L as q, h as K, i as O, k as Y, l as G, K as V, S as z, m as H, n as J, o as M } from "./chunks/index-nvObQgx0.js";
2
- import { B as se, s as te, D as ae, q as oe, N as ne, I as re, r as ie, M as le, w as de, t as ue, O as ce, y as fe, J as he, x as Ce, A as xe, v as me, z as pe, F as ge, p as je, H as De, G as be } from "./chunks/index-nvObQgx0.js";
3
- import { S as Te, D as Ee, u as Ie } from "./chunks/dashboard-plus-C3UxmNVq.js";
1
+ import { u as _, a as k, b as n, c as w, j as s, C as F, E as f, d as P, T as R, e as B, f as h, g as L, L as q, h as K, i as O, k as Y, l as G, K as V, S as z, m as H, n as J, o as M } from "./chunks/index-icDf4hJ3.js";
2
+ import { B as se, s as te, D as ae, q as oe, N as ne, I as re, r as ie, M as le, w as de, t as ue, O as ce, y as fe, J as he, x as Ce, A as xe, v as me, z as pe, F as ge, p as je, H as De, G as be } from "./chunks/index-icDf4hJ3.js";
3
+ import { S as Te, D as Ee, u as Ie } from "./chunks/dashboard-plus-3lAlCfBG.js";
4
4
  import Q from "react";
5
5
  import "react-dom";
6
6
  function $({
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/dashboard-plus-qauJ8uMw.js");require("../chunks/index-qQHxI2VY.js");require("react");require("react-dom");exports.Surfboard=r.DashboardPlus;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/dashboard-plus-Azf5X9Lv.js");require("../chunks/index-WM7PvYE2.js");require("react");require("react-dom");exports.Surfboard=r.DashboardPlus;
@@ -1,5 +1,5 @@
1
- import { D as i } from "../chunks/dashboard-plus-C3UxmNVq.js";
2
- import "../chunks/index-nvObQgx0.js";
1
+ import { D as i } from "../chunks/dashboard-plus-3lAlCfBG.js";
2
+ import "../chunks/index-icDf4hJ3.js";
3
3
  import "react";
4
4
  import "react-dom";
5
5
  export {
@@ -217,7 +217,9 @@ export declare type StyleProps = {
217
217
  export declare type TBaseQuery = {
218
218
  id: string;
219
219
  name: string;
220
+ connectionId: string;
220
221
  sql: string;
222
+ context?: string;
221
223
  description?: string;
222
224
  };
223
225
 
@@ -487,7 +487,9 @@ export declare function Surfboard({ showControls, showFooter, ...rest }: Dashboa
487
487
  export declare type TBaseQuery = {
488
488
  id: string;
489
489
  name: string;
490
+ connectionId: string;
490
491
  sql: string;
492
+ context?: string;
491
493
  description?: string;
492
494
  };
493
495
 
@@ -1261,7 +1263,9 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
1261
1263
  baseQueries?: {
1262
1264
  id: string;
1263
1265
  name: string;
1266
+ connectionId: string;
1264
1267
  sql: string;
1268
+ context?: string | undefined;
1265
1269
  description?: string | undefined;
1266
1270
  }[] | undefined;
1267
1271
  aiScopeTables?: {
@@ -222,7 +222,9 @@ export declare function Surfboard({ showControls, showFooter, ...rest }: Dashboa
222
222
  export declare type TBaseQuery = {
223
223
  id: string;
224
224
  name: string;
225
+ connectionId: string;
225
226
  sql: string;
227
+ context?: string;
226
228
  description?: string;
227
229
  };
228
230
 
@@ -214,7 +214,9 @@ export declare type StyleProps = {
214
214
  export declare type TBaseQuery = {
215
215
  id: string;
216
216
  name: string;
217
+ connectionId: string;
217
218
  sql: string;
219
+ context?: string;
218
220
  description?: string;
219
221
  };
220
222
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.0.211",
8
+ "version": "0.0.213",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",