react-semaphor 0.1.55 → 0.1.56

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
- "use strict";const e=require("react/jsx-runtime"),s=require("./index-DU6R1IHW.js"),w=require("react"),xt=require("react-dom");function pt(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(a,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return a.default=t,Object.freeze(a)}const Ue=pt(w);/**
1
+ "use strict";const e=require("react/jsx-runtime"),s=require("./index-BW7gx4di.js"),w=require("react"),xt=require("react-dom");function pt(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(a,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return a.default=t,Object.freeze(a)}const Ue=pt(w);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,5 +1,5 @@
1
1
  import { jsxs as a, jsx as e, Fragment as X } from "react/jsx-runtime";
2
- import { c as ue, a3 as Es, u as _, a4 as It, a5 as Et, B as R, a6 as At, a7 as Ye, a8 as As, $ as at, a9 as $e, aa as rt, ab as Kn, ac as Ve, ad as lt, ae as it, af as ot, ag as bt, ah as B, ai as Ce, aj as qt, I as me, ak as Fs, al as da, am as Tl, an as hn, ao as _n, f as K, ap as Ms, aq as Il, ar as Jn, as as El, at as Al, au as Os, av as te, x as pn, aw as Fl, ax as Ml, ay as pt, a1 as T, az as vt, aA as za, aB as Ra, aC as Hn, aD as Qn, aE as Fe, aF as ft, aG as Ol, aH as Pl, aI as Mt, aJ as Ot, aK as Le, aL as gt, aM as ea, aN as ct, aO as fs, aP as Kt, aQ as gs, aR as We, aS as Wn, aT as Yn, aU as _t, aV as Ll, aW as ja, aX as Ba, aY as $a, aZ as qa, a_ as Ga, a$ as Ua, b0 as Ka, b1 as _a, b2 as Vl, b3 as Ja, b4 as fa, a2 as ae, b5 as zl, b6 as xt, b7 as Rl, b8 as Re, o as Jt, b9 as Xn, ba as Me, bb as Ie, bc as jl, bd as Ha, be as Fa, bf as Ps, bg as Da, bh as Ls, bi as Vs, bj as Bl, bk as Zn, bl as $l, R as oa, bm as ql, bn as Gl, bo as Ul, bp as Ta, w as Kl, bq as _l, br as Ma, bs as er, bt as Jl, s as zs, bu as Qa, bv as Hl, bw as Xe, bx as Ql, by as Wl, bz as Ia, bA as Yl, bB as Ea, bC as Aa, bD as Wa, X as ga, G as fn, T as gn, L as tr, K as ar, z as St, A as Xl, H as Zl, V as ei, bE as ti, bF as xn, bG as bn, bH as sr, bI as nr, bJ as rr, bK as ai, bL as Ya, bM as Xa, bN as si, bO as ut, bP as je, bQ as Be, bR as Ue, bS as Ht, bT as Za, bU as Ne, bV as xa, bW as ni, bX as Oa, bY as Ft, bZ as lr, b_ as Rs, b$ as ri, c0 as ir, c1 as tt, c2 as xe, c3 as be, c4 as ve, c5 as or, c6 as ua, c7 as ie, c8 as oe, c9 as ce, ca as de, cb as W, cc as cr, cd as dr, ce as ur, cf as mr, cg as ba, g as Pt, ch as vn, ci as hr, cj as Tt, ck as li, cl as xs, cm as pr, cn as js, co as fr, cp as kt, cq as yn, cr as ii, cs as oi, ct as ci, cu as gr, cv as va, cw as di, cx as ui, cy as xr, cz as mi, cA as es, cB as hi, cC as pi, cD as bs, cE as Gt, cF as Qe, cG as Ut, cH as fi, cI as gi, cJ as br, cK as ts, cL as vs, cM as xi, cN as Bs, cO as bi, cP as $s, cQ as vi, cR as vr, cS as yr, cT as yi, cU as Ni, cV as Ci, cW as qs, cX as wi, cY as Si, cZ as Nn, c_ as ki, E as ya, b as Gs, c$ as Di, d0 as Ti, d1 as Ii, d2 as Ei, d3 as Ai, d4 as Fi, d5 as Nr, d6 as ys, d7 as Us, d8 as Cr, d9 as wr, da as Sr, db as kr, dc as Dr, dd as Ks, de as _s, df as Tr, dg as Ir, dh as Er, di as Js, dj as as, dk as ss, dl as Mi, P as Lt, e as Vt, dm as Oi, dn as Bt, dp as Pi, dq as Li, dr as Vi, ds as zi, dt as Ri, du as ji, dv as Ar, dw as et, dx as ma, dy as Pa, dz as Dt, h as Qt, dA as Bi, dB as $i, dC as qi, dD as Gi, dE as Ui, dF as Fr, dG as Ki, i as ns, j as rs, k as ls, l as is, m as Zt, n as Na, dH as _i, dI as nt, dJ as Ca, dK as Cn, dL as Ji, dM as wn, dN as Hi, dO as Qi, dP as Wi, dQ as Yi, dR as Sn, dS as Xi, dT as Zi, dU as eo, dV as to, dW as ao, Q as kn, dX as Dn, dY as so, dZ as no, d_ as Mr, d$ as ro, e0 as Or, e1 as lo, e2 as io, e3 as oo, e4 as co, e5 as uo, e6 as mo, e7 as ho, e8 as po, e9 as fo, ea as go, eb as Pr, ec as xo, ed as bo, ee as vo, ef as yo, eg as No, eh as Co, ei as Lr, ej as ds, ek as Hs, el as Vr, em as zr, en as wo, eo as So, ep as ko, eq as Tn, er as Do, es as To, et as Io, eu as ta, ev as aa, ew as Eo, ex as Rr, ey as Ao, ez as Ns, eA as Fo, eB as Mo, eC as La, eD as $t, eE as Cs, eF as ws, eG as Va, eH as jr, eI as sa, eJ as na, eK as Qs, eL as Oo, eM as Po, eN as Lo, eO as Vo, eP as zo, eQ as Ro, eR as jo, eS as us, eT as Bo, eU as $o, eV as qo, F as Br, eW as Go, eX as Uo, eY as Ko, eZ as In, e_ as _o, e$ as Jo, f0 as Ho, f1 as Qo, f2 as $r, f3 as qr, f4 as Wo, f5 as Yo, f6 as Xo, f7 as Zo, f8 as ec, f9 as tc, fa as ac, S as sc, fb as nc, U as rc, fc as lc, C as ic } from "./index-DgxiixWp.js";
2
+ import { c as ue, a3 as Es, u as _, a4 as It, a5 as Et, B as R, a6 as At, a7 as Ye, a8 as As, $ as at, a9 as $e, aa as rt, ab as Kn, ac as Ve, ad as lt, ae as it, af as ot, ag as bt, ah as B, ai as Ce, aj as qt, I as me, ak as Fs, al as da, am as Tl, an as hn, ao as _n, f as K, ap as Ms, aq as Il, ar as Jn, as as El, at as Al, au as Os, av as te, x as pn, aw as Fl, ax as Ml, ay as pt, a1 as T, az as vt, aA as za, aB as Ra, aC as Hn, aD as Qn, aE as Fe, aF as ft, aG as Ol, aH as Pl, aI as Mt, aJ as Ot, aK as Le, aL as gt, aM as ea, aN as ct, aO as fs, aP as Kt, aQ as gs, aR as We, aS as Wn, aT as Yn, aU as _t, aV as Ll, aW as ja, aX as Ba, aY as $a, aZ as qa, a_ as Ga, a$ as Ua, b0 as Ka, b1 as _a, b2 as Vl, b3 as Ja, b4 as fa, a2 as ae, b5 as zl, b6 as xt, b7 as Rl, b8 as Re, o as Jt, b9 as Xn, ba as Me, bb as Ie, bc as jl, bd as Ha, be as Fa, bf as Ps, bg as Da, bh as Ls, bi as Vs, bj as Bl, bk as Zn, bl as $l, R as oa, bm as ql, bn as Gl, bo as Ul, bp as Ta, w as Kl, bq as _l, br as Ma, bs as er, bt as Jl, s as zs, bu as Qa, bv as Hl, bw as Xe, bx as Ql, by as Wl, bz as Ia, bA as Yl, bB as Ea, bC as Aa, bD as Wa, X as ga, G as fn, T as gn, L as tr, K as ar, z as St, A as Xl, H as Zl, V as ei, bE as ti, bF as xn, bG as bn, bH as sr, bI as nr, bJ as rr, bK as ai, bL as Ya, bM as Xa, bN as si, bO as ut, bP as je, bQ as Be, bR as Ue, bS as Ht, bT as Za, bU as Ne, bV as xa, bW as ni, bX as Oa, bY as Ft, bZ as lr, b_ as Rs, b$ as ri, c0 as ir, c1 as tt, c2 as xe, c3 as be, c4 as ve, c5 as or, c6 as ua, c7 as ie, c8 as oe, c9 as ce, ca as de, cb as W, cc as cr, cd as dr, ce as ur, cf as mr, cg as ba, g as Pt, ch as vn, ci as hr, cj as Tt, ck as li, cl as xs, cm as pr, cn as js, co as fr, cp as kt, cq as yn, cr as ii, cs as oi, ct as ci, cu as gr, cv as va, cw as di, cx as ui, cy as xr, cz as mi, cA as es, cB as hi, cC as pi, cD as bs, cE as Gt, cF as Qe, cG as Ut, cH as fi, cI as gi, cJ as br, cK as ts, cL as vs, cM as xi, cN as Bs, cO as bi, cP as $s, cQ as vi, cR as vr, cS as yr, cT as yi, cU as Ni, cV as Ci, cW as qs, cX as wi, cY as Si, cZ as Nn, c_ as ki, E as ya, b as Gs, c$ as Di, d0 as Ti, d1 as Ii, d2 as Ei, d3 as Ai, d4 as Fi, d5 as Nr, d6 as ys, d7 as Us, d8 as Cr, d9 as wr, da as Sr, db as kr, dc as Dr, dd as Ks, de as _s, df as Tr, dg as Ir, dh as Er, di as Js, dj as as, dk as ss, dl as Mi, P as Lt, e as Vt, dm as Oi, dn as Bt, dp as Pi, dq as Li, dr as Vi, ds as zi, dt as Ri, du as ji, dv as Ar, dw as et, dx as ma, dy as Pa, dz as Dt, h as Qt, dA as Bi, dB as $i, dC as qi, dD as Gi, dE as Ui, dF as Fr, dG as Ki, i as ns, j as rs, k as ls, l as is, m as Zt, n as Na, dH as _i, dI as nt, dJ as Ca, dK as Cn, dL as Ji, dM as wn, dN as Hi, dO as Qi, dP as Wi, dQ as Yi, dR as Sn, dS as Xi, dT as Zi, dU as eo, dV as to, dW as ao, Q as kn, dX as Dn, dY as so, dZ as no, d_ as Mr, d$ as ro, e0 as Or, e1 as lo, e2 as io, e3 as oo, e4 as co, e5 as uo, e6 as mo, e7 as ho, e8 as po, e9 as fo, ea as go, eb as Pr, ec as xo, ed as bo, ee as vo, ef as yo, eg as No, eh as Co, ei as Lr, ej as ds, ek as Hs, el as Vr, em as zr, en as wo, eo as So, ep as ko, eq as Tn, er as Do, es as To, et as Io, eu as ta, ev as aa, ew as Eo, ex as Rr, ey as Ao, ez as Ns, eA as Fo, eB as Mo, eC as La, eD as $t, eE as Cs, eF as ws, eG as Va, eH as jr, eI as sa, eJ as na, eK as Qs, eL as Oo, eM as Po, eN as Lo, eO as Vo, eP as zo, eQ as Ro, eR as jo, eS as us, eT as Bo, eU as $o, eV as qo, F as Br, eW as Go, eX as Uo, eY as Ko, eZ as In, e_ as _o, e$ as Jo, f0 as Ho, f1 as Qo, f2 as $r, f3 as qr, f4 as Wo, f5 as Yo, f6 as Xo, f7 as Zo, f8 as ec, f9 as tc, fa as ac, S as sc, fb as nc, U as rc, fc as lc, C as ic } from "./index-CbRnLd27.js";
3
3
  import * as Ss from "react";
4
4
  import ha, { useRef as mt, useEffect as ge, useState as z, useMemo as Ze, useCallback as ye, useContext as Ws, Suspense as Gr } from "react";
5
5
  import { createPortal as oc } from "react-dom";
@@ -860,7 +860,7 @@ Valid keys: `+JSON.stringify(Object.keys(A),null," "));var X=ee(U,Z,W,q,Y+"."+Z
860
860
  margin-left: auto;
861
861
  }
862
862
  }
863
- `}}),c.jsxs("div",{className:"semaphor-pagination-container",children:[c.jsxs("div",{className:"semaphor-pagination-info hidden flex-1 items-center gap-2 text-sm text-muted-foreground",children:[s>0&&c.jsxs(c.Fragment,{children:[s," of ",x," row(s) selected"," "]}),s===0&&c.jsxs(c.Fragment,{children:[x," rows"]}),s>0&&c.jsx(se,{variant:"outline",size:"sm",style:{borderRadius:p},onClick:f,className:"h-8 text-foreground",children:"Clear"})]}),c.jsxs("div",{className:"semaphor-pagination-pagesize hidden items-center gap-2",children:[c.jsx(le,{htmlFor:"rows-per-page",className:"semaphor-pagination-pagesize-label text-sm font-normal text-muted-foreground",children:"Rows per page"}),c.jsxs(it,{value:`${n}`,onValueChange:b,children:[c.jsx(nt,{style:{borderRadius:p},className:`h-8 w-16 ${Ur}`,id:"rows-per-page",children:c.jsx(ut,{placeholder:n})}),c.jsx(rt,{side:"top",children:[10,20,50,100,500,1e3].map(y=>c.jsx(pe,{value:`${y}`,children:y},y))})]})]}),c.jsxs("div",{className:"semaphor-pagination-page-info flex w-fit items-center justify-center text-sm font-normal text-muted-foreground",children:["Page ",t+1," of ",e]}),c.jsxs("div",{className:"semaphor-pagination-nav-container ml-auto flex items-center gap-2 md:ml-0",children:[c.jsxs(se,{style:{borderRadius:p},variant:"outline",className:"semaphor-pagination-nav-extended hidden h-8 w-8 p-0",onClick:()=>o(0),disabled:!a,children:[c.jsx("span",{className:"sr-only",children:"Go to first page"}),c.jsx(one,{className:"h-4 w-4"})]}),c.jsxs(se,{style:{borderRadius:p},variant:"outline",className:"h-8 w-8 p-0",onClick:u,disabled:!a,children:[c.jsx("span",{className:"sr-only",children:"Go to previous page"}),c.jsx(aL,{className:"h-4 w-4"})]}),c.jsxs(se,{style:{borderRadius:p},variant:"outline",className:"h-8 w-8 p-0",onClick:d,disabled:!l,children:[c.jsx("span",{className:"sr-only",children:"Go to next page"}),c.jsx(Za,{className:"h-4 w-4"})]}),c.jsxs(se,{style:{borderRadius:p},variant:"outline",className:"semaphor-pagination-nav-extended hidden h-8 w-8 p-0",onClick:()=>o(e-1),disabled:!l,children:[c.jsx("span",{className:"sr-only",children:"Go to last page"}),c.jsx(ine,{className:"h-4 w-4"})]})]})]})]})}function HC({color:e,onChange:t,className:n}){return c.jsxs("div",{className:`flex items-center gap-2 ${n}`,children:[c.jsxs(Th,{children:[c.jsx(Mh,{asChild:!0,children:c.jsx(se,{variant:"outline",className:"h-8 w-8 p-0",style:{backgroundColor:e},children:c.jsx("span",{className:"sr-only",children:"Pick a color"})})}),c.jsxs(bd,{align:"start",children:[c.jsx("div",{className:"grid grid-cols-5 gap-1 p-1",children:lCe.map(r=>c.jsx(se,{variant:"outline",className:"h-6 w-6 border p-0",style:{backgroundColor:r},onClick:()=>t(r),children:c.jsx("span",{className:"sr-only",children:r})},r))}),c.jsx(Hu,{}),c.jsxs("div",{className:"p-2",children:[c.jsx(le,{htmlFor:"custom-color",className:"mb-1 block text-xs",children:"Custom color"}),c.jsx(Vn,{id:"custom-color",type:"text",value:e,onChange:r=>t(r.target.value),className:"h-8",placeholder:"#RRGGBB"})]})]})]}),c.jsx(Vn,{type:"text",value:e,onChange:r=>t(r.target.value),className:"h-8 flex-1"})]})}const KU=[{label:"Date Only",formats:[{label:"MM/DD/YYYY",value:"MM/dd/yyyy"},{label:"DD/MM/YYYY",value:"dd/MM/yyyy"},{label:"YYYY-MM-DD",value:"yyyy-MM-dd"},{label:"Month DD, YYYY",value:"LLLL dd, yyyy"},{label:"DD Month YYYY",value:"dd LLLL yyyy"},{label:"MM-DD-YYYY",value:"MM-dd-yyyy"},{label:"YYYY/MM/DD",value:"yyyy/MM/dd"},{label:"DD.MM.YYYY",value:"dd.MM.yyyy"},{label:"DD Month YY",value:"dd LLL yy"}]},{label:"Date & Time",formats:[{label:"MM/DD/YYYY HH:mm",value:"MM/dd/yyyy HH:mm"},{label:"DD/MM/YYYY HH:mm",value:"dd/MM/yyyy HH:mm"},{label:"YYYY-MM-DD HH:mm:ss",value:"yyyy-MM-dd HH:mm:ss"},{label:"Month DD, YYYY at HH:mm",value:"LLLL dd, yyyy 'at' HH:mm"},{label:"DD Month YYYY HH:mm",value:"dd LLLL yyyy HH:mm"},{label:"MM/DD/YYYY h:mm a",value:"MM/dd/yyyy h:mm a"},{label:"Month DD, YYYY h:mm a",value:"LLLL dd, yyyy h:mm a"}]},{label:"Date & Time with Timezone",formats:[{label:"MM/DD/YYYY HH:mm z",value:"MM/dd/yyyy HH:mm zzz"},{label:"YYYY-MM-DD HH:mm:ss z",value:"yyyy-MM-dd HH:mm:ss zzz"},{label:"Month DD, YYYY at HH:mm z",value:"LLLL dd, yyyy 'at' HH:mm zzz"},{label:"MM/DD/YYYY h:mm a z",value:"MM/dd/yyyy h:mm a zzz"}]},{label:"ISO Standards",formats:[{label:"ISO 8601",value:"yyyy-MM-dd'T'HH:mm:ss"},{label:"ISO 8601 with TZ",value:"yyyy-MM-dd'T'HH:mm:ssXXX"}]}];[...KU.flatMap(e=>e.formats)];const eF=[{label:"Auto (Use dashboard/browser timezone)",value:"auto"},{label:"UTC",value:"UTC"},{label:"Eastern Time (US)",value:"America/New_York"},{label:"Central Time (US)",value:"America/Chicago"},{label:"Mountain Time (US)",value:"America/Denver"},{label:"Pacific Time (US)",value:"America/Los_Angeles"},{label:"São Paulo",value:"America/Sao_Paulo"},{label:"Buenos Aires",value:"America/Argentina/Buenos_Aires"},{label:"London",value:"Europe/London"},{label:"Paris/Berlin",value:"Europe/Paris"},{label:"Moscow",value:"Europe/Moscow"},{label:"Dubai",value:"Asia/Dubai"},{label:"Mumbai",value:"Asia/Kolkata"},{label:"Singapore",value:"Asia/Singapore"},{label:"Hong Kong",value:"Asia/Hong_Kong"},{label:"Shanghai/Beijing",value:"Asia/Shanghai"},{label:"Tokyo",value:"Asia/Tokyo"},{label:"Seoul",value:"Asia/Seoul"},{label:"Sydney",value:"Australia/Sydney"},{label:"Auckland",value:"Pacific/Auckland"}],$Ne=[{value:"absolute",label:"Absolute"},{value:"relative",label:"Relative"}];function pR({column:e,settings:t,onSettingsChange:n,onApply:r,onReset:s,onResetAll:o,open:i,onOpenChange:a}){var b;const[l,u]=C.useState(qO()),{tokenProps:d}=Ke(),f=(b=d==null?void 0:d.params)==null?void 0:b.timeZone,h=Intl.DateTimeFormat().resolvedOptions().timeZone,p=()=>t.dateFormat.timezone&&t.dateFormat.timezone!=="auto"?t.dateFormat.timezone:f||h,m=()=>{n({...t,colorRanges:[...t.colorRanges,{...l}]}),u(qO())},g=x=>{const y=[...t.colorRanges];y.splice(x,1),n({...t,colorRanges:y})};return c.jsx(rs,{open:i,onOpenChange:a,children:c.jsxs(Lr,{className:"max-w-2xl",children:[c.jsxs(zr,{children:[c.jsx(Br,{children:"Display Settings"}),c.jsxs(Cs,{children:["Display settings for '",e==null?void 0:e.id,"'"]})]}),t.type==="number"||t.type==="date"?c.jsxs(Ns,{defaultValue:"general",children:[c.jsxs(ss,{className:`grid ${t.type==="number"?"grid-cols-3":t.type==="date"?"grid-cols-2":"grid-cols-1"}`,children:[c.jsx(Qt,{value:"general",children:"General"}),t.type==="number"&&c.jsx(Qt,{value:"number",children:"Number Format"}),t.type==="date"&&c.jsx(Qt,{value:"date",children:"Date Format"}),t.type==="number"&&c.jsx(Qt,{value:"color-ranges",children:"Color Ranges"})]}),c.jsx(Wn,{value:"general",className:"mt-4",children:c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"column-type",className:"text-right",children:"Type"}),c.jsxs(it,{value:t.type,onValueChange:x=>n({...t,type:x}),children:[c.jsx(nt,{id:"column-type",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select type"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"none",children:"None"}),c.jsx(pe,{value:"text",children:"Text"}),c.jsx(pe,{value:"number",children:"Number"}),c.jsx(pe,{value:"date",children:"Date"}),c.jsx(pe,{value:"badge",children:"Badge"}),c.jsx(pe,{value:"link",children:"Link"}),c.jsx(pe,{value:"progress",children:"Progress"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"text-align",className:"text-right",children:"Text Align"}),c.jsxs(it,{value:t.textAlign,onValueChange:x=>n({...t,textAlign:x}),children:[c.jsx(nt,{id:"text-align",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select alignment"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"left",children:"Left"}),c.jsx(pe,{value:"center",children:"Center"}),c.jsx(pe,{value:"right",children:"Right"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"text-wrap",className:"text-right",children:"Text Wrap"}),c.jsxs(it,{value:t.textWrap,onValueChange:x=>n({...t,textWrap:x}),children:[c.jsx(nt,{id:"text-wrap",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select text wrapping"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"nowrap",children:"No Wrap (Ellipsis)"}),c.jsx(pe,{value:"wrap",children:"Wrap Text"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"column-width",className:"text-right",children:"Width (px)"}),c.jsx(Vn,{id:"column-width",type:"number",value:t.width,onChange:x=>n({...t,width:parseInt(x.target.value)||150}),className:`col-span-3 ${bf}`,placeholder:"150"})]})]})}),t.type==="date"&&c.jsx(Wn,{value:"date",className:"mt-4",children:c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"date-format-type",className:"text-right",children:"Format Type"}),c.jsxs(it,{value:t.dateFormat.useRelativeTime?"relative":"absolute",onValueChange:x=>{n({...t,dateFormat:{...t.dateFormat,useRelativeTime:x==="relative"}})},children:[c.jsx(nt,{id:"date-format-type",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select format type"})}),c.jsx(rt,{children:$Ne.map(x=>c.jsx(pe,{value:x.value,children:x.label},x.value))})]})]}),!t.dateFormat.useRelativeTime&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"date-format",className:"text-right",children:"Date Format"}),c.jsxs(it,{value:t.dateFormat.useCustomFormat?"custom":t.dateFormat.format,onValueChange:x=>{n(x==="custom"?{...t,dateFormat:{...t.dateFormat,useCustomFormat:!0}}:{...t,dateFormat:{...t.dateFormat,format:x,useCustomFormat:!1}})},children:[c.jsx(nt,{id:"date-format",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select date format"})}),c.jsxs(rt,{children:[KU.map(x=>c.jsxs(ZV,{children:[c.jsx(xD,{className:"bg-muted",children:x.label}),x.formats.map(y=>c.jsx(pe,{value:y.value,children:y.label},y.value))]},x.label)),c.jsx(pe,{value:"custom",children:"Custom"})]})]})]}),t.dateFormat.useCustomFormat&&c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"custom-format",className:"text-right",children:"Custom Format"}),c.jsxs("div",{className:"col-span-3 space-y-2",children:[c.jsx(Vn,{className:`${bf}`,id:"custom-format",value:t.dateFormat.customFormat,onChange:x=>n({...t,dateFormat:{...t.dateFormat,customFormat:x.target.value}}),placeholder:"yyyy-MM-dd'T'HH:mm:ss"}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[c.jsx("p",{children:"Format tokens:"}),c.jsxs("ul",{className:"mt-1 grid grid-cols-2 gap-1",children:[c.jsx("li",{children:"yyyy: Full year (2023)"}),c.jsx("li",{children:"yy: Short year (23)"}),c.jsx("li",{children:"MMMM: Full month (January)"}),c.jsx("li",{children:"MMM: Short month (Jan)"}),c.jsx("li",{children:"MM: Month number with leading zero (01-12)"}),c.jsx("li",{children:"M: Month number (1-12)"}),c.jsx("li",{children:"dd: Day with leading zero (01-31)"}),c.jsx("li",{children:"d: Day (1-31)"}),c.jsx("li",{children:"HH: Hour with leading zero (00-23)"}),c.jsx("li",{children:"H: Hour (0-23)"}),c.jsx("li",{children:"mm: Minute with leading zero (00-59)"}),c.jsx("li",{children:"m: Minute (0-59)"}),c.jsx("li",{children:"ss: Second with leading zero (00-59)"}),c.jsx("li",{children:"s: Second (0-59)"})]})]})]})]})]}),t.dateFormat.useRelativeTime&&c.jsx("div",{className:"grid grid-cols-4 items-center gap-4",children:c.jsx("div",{className:"col-span-4",children:c.jsxs("div",{className:"rounded-md bg-muted p-3",children:[c.jsx("h4",{className:"mb-2 text-sm font-medium",children:"Relative Time Format"}),c.jsx("p",{className:"mb-2 text-sm text-muted-foreground",children:'Displays dates as relative time, like "just now" or "5 minutes ago".'}),c.jsxs("div",{className:"space-y-1 text-sm",children:[c.jsx("p",{children:"⏱ Time ranges:"}),c.jsxs("ul",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:[c.jsx("li",{children:"< 1 minute: just now"}),c.jsx("li",{children:"< 1 hour: x minutes ago"}),c.jsx("li",{children:"< 24 hours: x hours ago"}),c.jsx("li",{children:"< 7 days: x days ago"}),c.jsx("li",{children:"< 30 days: x weeks ago"}),c.jsx("li",{children:"< 1 year: x months ago"}),c.jsx("li",{children:"≥ 1 year: x years ago"})]})]})]})})}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"timezone",className:"text-right",children:"Display Timezone"}),c.jsxs(it,{value:t.dateFormat.timezone||"auto",onValueChange:x=>{n({...t,dateFormat:{...t.dateFormat,timezone:x}})},children:[c.jsx(nt,{id:"timezone",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select timezone"})}),c.jsx(rt,{children:eF.map(x=>c.jsx(pe,{value:x.value,children:x.value==="auto"?`Auto (${f?`Dashboard: ${f}`:`Browser: ${h}`})`:x.label},x.value))})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"source-timezone",className:"text-right",children:"Source Timezone"}),c.jsxs(it,{value:t.dateFormat.sourceTimezone||"auto",onValueChange:x=>{n({...t,dateFormat:{...t.dateFormat,sourceTimezone:x}})},children:[c.jsx(nt,{id:"source-timezone",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select source timezone"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"auto",children:"Auto (UTC if not specified)"}),c.jsx(pe,{value:"UTC",children:"Always UTC"}),c.jsx(pe,{value:"local",children:"Browser Local Time"}),eF.slice(2).map(x=>c.jsx(pe,{value:x.value,children:x.label},x.value))]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[c.jsx("div",{className:"col-span-1"}),c.jsx("div",{className:"col-span-3",children:c.jsx("p",{className:"text-xs text-muted-foreground",children:'How to interpret dates without timezone information. "Auto" uses explicit timezone if present, otherwise assumes UTC.'})})]}),c.jsx("div",{className:"mt-4 grid grid-cols-4 items-center gap-4",children:c.jsx("div",{className:"col-span-4",children:c.jsxs("div",{className:"rounded-md bg-muted p-3",children:[c.jsx("h4",{className:"mb-2 text-sm font-medium",children:"Preview"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:"Sample:"}),c.jsx("span",{className:"text-sm font-medium",children:t.dateFormat.useRelativeTime?h1("2023-05-15T14:30:45Z"):Eb("2023-05-15T14:30:45Z",t.dateFormat.useCustomFormat?t.dateFormat.customFormat:t.dateFormat.format,p(),t.dateFormat.sourceTimezone||"auto")})]}),c.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Timezone: ",p()]})]})})})]})}),t.type==="number"&&c.jsx(Wn,{value:"number",className:"mt-4",children:c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"number-style",className:"text-right",children:"Number Style"}),c.jsxs(it,{value:t.numberFormat.style,onValueChange:x=>n({...t,numberFormat:{...t.numberFormat,style:x}}),children:[c.jsx(nt,{id:"number-style",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select number style"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"decimal",children:"Decimal"}),c.jsx(pe,{value:"currency",children:"Currency"}),c.jsx(pe,{value:"percent",children:"Percentage"})]})]})]}),t.numberFormat.style==="currency"&&c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"currency",className:"text-right",children:"Currency"}),c.jsxs(it,{value:t.numberFormat.currency,onValueChange:x=>n({...t,numberFormat:{...t.numberFormat,currency:x}}),children:[c.jsx(nt,{id:"currency",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select currency"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"USD",children:"USD ($)"}),c.jsx(pe,{value:"EUR",children:"EUR (€)"}),c.jsx(pe,{value:"GBP",children:"GBP (£)"}),c.jsx(pe,{value:"JPY",children:"JPY (¥)"}),c.jsx(pe,{value:"CAD",children:"CAD (C$)"}),c.jsx(pe,{value:"AUD",children:"AUD (A$)"}),c.jsx(pe,{value:"CNY",children:"CNY (¥)"}),c.jsx(pe,{value:"INR",children:"INR (₹)"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"locale",className:"text-right",children:"Locale"}),c.jsxs(it,{value:t.numberFormat.locale,onValueChange:x=>n({...t,numberFormat:{...t.numberFormat,locale:x}}),children:[c.jsx(nt,{id:"locale",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select locale"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"en-US",children:"English (US)"}),c.jsx(pe,{value:"en-GB",children:"English (UK)"}),c.jsx(pe,{value:"fr-FR",children:"French"}),c.jsx(pe,{value:"de-DE",children:"German"}),c.jsx(pe,{value:"es-ES",children:"Spanish"}),c.jsx(pe,{value:"ja-JP",children:"Japanese"}),c.jsx(pe,{value:"zh-CN",children:"Chinese (Simplified)"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"decimal-places",className:"text-right",children:"Decimal Places"}),c.jsx("div",{className:"col-span-3",children:c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("div",{className:"flex-1",children:[c.jsx(le,{htmlFor:"min-decimals",className:"mb-1 block text-xs",children:"Minimum"}),c.jsxs(it,{value:t.numberFormat.minimumFractionDigits.toString(),onValueChange:x=>n({...t,numberFormat:{...t.numberFormat,minimumFractionDigits:Number.parseInt(x)}}),children:[c.jsx(nt,{id:"min-decimals",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{})}),c.jsx(rt,{children:[0,1,2,3,4].map(x=>c.jsx(pe,{value:x.toString(),children:x},x))})]})]}),c.jsxs("div",{className:"flex-1",children:[c.jsx(le,{htmlFor:"max-decimals",className:"mb-1 block text-xs",children:"Maximum"}),c.jsxs(it,{value:t.numberFormat.maximumFractionDigits.toString(),onValueChange:x=>n({...t,numberFormat:{...t.numberFormat,maximumFractionDigits:Number.parseInt(x)}}),children:[c.jsx(nt,{className:Ur,id:"max-decimals",children:c.jsx(ut,{})}),c.jsx(rt,{children:[0,1,2,3,4,5,6].map(x=>c.jsx(pe,{value:x.toString(),children:x},x))})]})]})]})})]}),c.jsx(ho,{className:"my-2"}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("h4",{className:"text-sm font-medium",children:"Data Bar Visualization"}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"show-databar",className:"text-right",children:"Show as Data Bar"}),c.jsxs("div",{className:"col-span-3 flex items-center",children:[c.jsx(on,{id:"show-databar",checked:t.numberFormat.showDataBar,onCheckedChange:x=>n({...t,numberFormat:{...t.numberFormat,showDataBar:!!x}})}),c.jsx(le,{htmlFor:"show-databar",className:"ml-2",children:"Display value with a data bar"})]})]}),t.numberFormat.showDataBar&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"databar-color",className:"text-right",children:"Bar Color"}),c.jsx("div",{className:"col-span-3",children:c.jsx(HC,{color:t.numberFormat.dataBarColor,onChange:x=>n({...t,numberFormat:{...t.numberFormat,dataBarColor:x}})})})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"min-value",className:"text-right",children:"Min Value"}),c.jsx(Vn,{id:"min-value",type:"number",value:t.numberFormat.dataBarMinValue!==void 0?t.numberFormat.dataBarMinValue:"",onChange:x=>n({...t,numberFormat:{...t.numberFormat,dataBarMinValue:x.target.value===""?void 0:Number(x.target.value)}}),className:"col-span-3",placeholder:"Auto (use minimum value in data)"})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"max-value",className:"text-right",children:"Max Value"}),c.jsx(Vn,{id:"max-value",type:"number",value:t.numberFormat.dataBarMaxValue!==void 0?t.numberFormat.dataBarMaxValue:"",onChange:x=>n({...t,numberFormat:{...t.numberFormat,dataBarMaxValue:x.target.value===""?void 0:Number(x.target.value)}}),className:"col-span-3",placeholder:"Auto (use maximum value in data)"})]})]})]})]})}),t.type==="number"&&c.jsx(Wn,{value:"color-ranges",className:"mt-4",children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"text-sm font-medium",children:"Color Ranges"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"Highlight cells or rows based on value ranges"})]}),t.colorRanges.length>0?c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"grid grid-cols-12 gap-2 px-2 text-xs font-medium text-muted-foreground",children:[c.jsx("div",{className:"col-span-2",children:"Min Value"}),c.jsx("div",{className:"col-span-2",children:"Max Value"}),c.jsx("div",{className:"col-span-3",children:"Color"}),c.jsx("div",{className:"col-span-4",children:"Apply To"}),c.jsx("div",{className:"col-span-1"})]}),c.jsx(ho,{}),t.colorRanges.map((x,y)=>c.jsxs("div",{className:"grid grid-cols-12 items-center gap-2",children:[c.jsx("div",{className:"col-span-2",children:c.jsx(Vn,{type:"number",value:x.min,onChange:v=>{const w=[...t.colorRanges];w[y].min=Number(v.target.value),n({...t,colorRanges:w})},className:"h-8"})}),c.jsx("div",{className:"col-span-2",children:c.jsx(Vn,{type:"number",value:x.max,onChange:v=>{const w=[...t.colorRanges];w[y].max=Number(v.target.value),n({...t,colorRanges:w})},className:"h-8"})}),c.jsx("div",{className:"col-span-3",children:c.jsx(HC,{color:x.color,onChange:v=>{const w=[...t.colorRanges];w[y].color=v,n({...t,colorRanges:w})}})}),c.jsx("div",{className:"col-span-4 flex items-center",children:c.jsxs(na,{value:x.applyTo,onValueChange:v=>{const w=[...t.colorRanges];w[y].applyTo=v,n({...t,colorRanges:w})},className:"flex gap-4",children:[c.jsxs("div",{className:"flex items-center space-x-1",children:[c.jsx(yr,{value:"cell",id:`cell-${y}`}),c.jsx(le,{htmlFor:`cell-${y}`,className:"text-xs",children:"Cell only"})]}),c.jsxs("div",{className:"flex items-center space-x-1",children:[c.jsx(yr,{value:"row",id:`row-${y}`}),c.jsx(le,{htmlFor:`row-${y}`,className:"text-xs",children:"Entire row"})]})]})}),c.jsx("div",{className:"col-span-1",children:c.jsx(se,{variant:"ghost",size:"icon",onClick:()=>g(y),className:"h-8 w-8",children:c.jsx(fd,{className:"h-4 w-4"})})})]},y))]}):c.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"No color ranges defined yet. Add one below."}),c.jsxs("div",{className:"mt-4 border-t pt-4",children:[c.jsx("h4",{className:"mb-2 text-sm font-medium",children:"Add New Color Range"}),c.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[c.jsxs("div",{className:"col-span-2",children:[c.jsx(le,{htmlFor:"new-min",className:"mb-1 block text-xs",children:"Min Value"}),c.jsx(Vn,{id:"new-min",type:"number",value:l.min,onChange:x=>u({...l,min:Number(x.target.value)}),className:"h-8"})]}),c.jsxs("div",{className:"col-span-2",children:[c.jsx(le,{htmlFor:"new-max",className:"mb-1 block text-xs",children:"Max Value"}),c.jsx(Vn,{id:"new-max",type:"number",value:l.max,onChange:x=>u({...l,max:Number(x.target.value)}),className:"h-8"})]}),c.jsxs("div",{className:"col-span-3",children:[c.jsx(le,{htmlFor:"new-color",className:"mb-1 block text-xs",children:"Color"}),c.jsx(HC,{color:l.color,onChange:x=>u({...l,color:x})})]}),c.jsxs("div",{className:"col-span-4",children:[c.jsx(le,{className:"mb-3 block text-xs",children:"Apply To"}),c.jsxs(na,{value:l.applyTo,onValueChange:x=>u({...l,applyTo:x}),className:"flex gap-4",children:[c.jsxs("div",{className:"flex items-center space-x-1",children:[c.jsx(yr,{value:"cell",id:"new-cell"}),c.jsx(le,{htmlFor:"new-cell",className:"text-xs",children:"Cell only"})]}),c.jsxs("div",{className:"flex items-center space-x-1",children:[c.jsx(yr,{value:"row",id:"new-row"}),c.jsx(le,{htmlFor:"new-row",className:"text-xs",children:"Entire row"})]})]})]}),c.jsxs("div",{className:"col-span-1",children:[c.jsx(le,{className:"mb-1 block text-xs opacity-0",children:"Spacer"}),c.jsx(se,{variant:"outline",size:"sm",onClick:m,className:"h-8 w-full p-0 sm:px-2",children:c.jsx(Sr,{className:"h-4 w-4"})})]})]})]})]})})]}):c.jsx("div",{className:"mt-4",children:c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"column-type",className:"text-right",children:"Type"}),c.jsxs(it,{value:t.type,onValueChange:x=>n({...t,type:x}),children:[c.jsx(nt,{id:"column-type",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select type"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"none",children:"None"}),c.jsx(pe,{value:"text",children:"Text"}),c.jsx(pe,{value:"number",children:"Number"}),c.jsx(pe,{value:"date",children:"Date"}),c.jsx(pe,{value:"badge",children:"Badge"}),c.jsx(pe,{value:"link",children:"Link"}),c.jsx(pe,{value:"progress",children:"Progress"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"text-align",className:"text-right",children:"Align"}),c.jsxs(it,{value:t.textAlign,onValueChange:x=>n({...t,textAlign:x}),children:[c.jsx(nt,{id:"text-align",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select alignment"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"left",children:"Left"}),c.jsx(pe,{value:"center",children:"Center"}),c.jsx(pe,{value:"right",children:"Right"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"text-wrap",className:"text-right",children:"Wrap"}),c.jsxs(it,{value:t.textWrap,onValueChange:x=>n({...t,textWrap:x}),children:[c.jsx(nt,{id:"text-wrap",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select text wrapping"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"nowrap",children:"No Wrap (Ellipsis)"}),c.jsx(pe,{value:"wrap",children:"Wrap Text"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"column-width",className:"text-right",children:"Width (px)"}),c.jsx(Vn,{id:"column-width",type:"number",value:t.width,onChange:x=>n({...t,width:parseInt(x.target.value)||150}),className:`col-span-3 ${bf}`,placeholder:"150"})]})]})}),c.jsxs(Ss,{className:"flex justify-between",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx(se,{variant:"outline",onClick:o,children:"Reset All Column Settings"}),c.jsx(se,{variant:"outline",onClick:s,children:"Reset"})]}),c.jsx(se,{onClick:r,children:"Apply"})]})]})})}function Zc({header:e,isResizing:t=!1}){const{column:n}=e;return n.getCanResize()?c.jsx("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),onDoubleClick:()=>n.resetSize(),className:K("absolute right-0 top-0 h-full w-0.5 cursor-col-resize select-none touch-none","hover:bg-primary/50 hover:w-1","group",t&&"bg-primary w-1"),style:{userSelect:"none",touchAction:"none"},title:"Drag to resize column. Double-click to auto-fit.",children:c.jsx("div",{className:K("absolute inset-y-0 -left-1 -right-1 z-10")})}):null}function LNe(e){var n,r;const t={};return(n=e==null?void 0:e.metricColumns)==null||n.forEach(s=>{const o=s.alias??s.name??s.label;t[o]={dataType:s.dataType,isMetric:!0}}),(r=e==null?void 0:e.groupByColumns)==null||r.forEach(s=>{const o=s.alias??s.name??s.label;t[o]={dataType:s.dataType,isMetric:!1}}),t}function zNe(e,t,n){var a,l,u;if((a=n==null?void 0:n[e])!=null&&a.metricId)return"number";if((l=n==null?void 0:n[e])!=null&&l.dataType){const d=oa(n[e].dataType);return d==="number"?"number":d==="date"?"date":"text"}const r=Math.min(10,t.length);let s=0,o=0,i=0;for(let d=0;d<t.length&&s<r;d++){const f=(u=t[d])==null?void 0:u[e];f!=null&&f!==""&&(s++,typeof f=="number"&&!isNaN(f)?o++:typeof f=="string"&&BNe(f)&&i++)}return o>s*.7?"number":i>s*.7?"date":"text"}function BNe(e){if(![/^\d{4}-\d{2}-\d{2}/,/^\d{2}\/\d{2}\/\d{4}/,/^\d{4}\/\d{2}\/\d{2}/,/^\d{2}-\d{2}-\d{4}/].some(s=>s.test(e)))return!1;const r=Date.parse(e);return!isNaN(r)}function fg(e,t,n,r){const s=Ao(),i={...r?LNe(r):{},...n};switch(zNe(e,t,i)){case"number":return{...s,type:"number",textAlign:"right",numberFormat:{...s.numberFormat,style:"decimal",minimumFractionDigits:0,maximumFractionDigits:2}};case"date":return{...s,type:"date",textAlign:"left",dateFormat:{...s.dateFormat,format:"MMM dd, yyyy"}};default:return{...s,type:"text",textAlign:"left"}}}function VNe({data:e,sorting:t,columnSettings:n,selectColumnVisible:r=!0,onOpenColumnSettings:s,isVisualEditing:o,contextTimezone:i,browserTimezone:a=Intl.DateTimeFormat().resolvedOptions().timeZone,card:l}){if(e.length===0)return[];const u={id:"select",header:({table:h})=>c.jsx("div",{className:"flex items-center justify-start pl-3",children:c.jsx(on,{checked:h.getIsAllPageRowsSelected()||h.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:p=>h.toggleAllPageRowsSelected(!!p),"aria-label":"Select all rows"})}),cell:({row:h})=>c.jsx("div",{className:"flex items-center justify-start pl-3",onClick:p=>p.stopPropagation(),children:c.jsx(on,{checked:h.getIsSelected(),onCheckedChange:p=>h.toggleSelected(!!p),"aria-label":"Select row"})}),size:32,minSize:32,maxSize:32,enableSorting:!1,enableHiding:!1,enableResizing:!1},{keys:d}=fr(e),f=d==null?void 0:d.map(h=>{const p=n[h],m=p!=null&&p.width&&typeof p.width=="number"?p.width:150,g=(p==null?void 0:p.minWidth)??50,b=(p==null?void 0:p.maxWidth)??500;return{accessorKey:h,enableGlobalFilter:!0,size:m,minSize:g,maxSize:b,enableResizing:!0,header:({column:x})=>{const y=t.findIndex(O=>O.id===x.id),w=y!==-1?t[y].desc?"desc":"asc":null,S=n[x.id]||fg(h,e,void 0,l==null?void 0:l.config),N=S.textAlign||"left",j=N==="right",_=N==="center",E=S,D=(E==null?void 0:E.type)==="date";let R,T=!1;return D&&(E!=null&&E.dateFormat)&&(E.dateFormat.timezone&&E.dateFormat.timezone!=="auto"?R=E.dateFormat.timezone:R=i||a,T=R!==a),j?c.jsxs("div",{className:"group/table-head relative flex w-full select-none items-center justify-end",style:{overflow:"hidden"},children:[c.jsxs("div",{className:K("flex items-center cursor-pointer transition-all duration-200",o&&"group-hover/table-head:mr-7"),onClick:O=>{O.preventDefault();const M=O.shiftKey;x.toggleSorting(x.getIsSorted()==="asc",M)},children:[c.jsxs("span",{className:"truncate",children:[h.charAt(0).toUpperCase()+h.slice(1),T&&c.jsxs("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["(",ff(R),")"]})]}),w&&c.jsx("div",{className:"ml-2 flex items-center",children:w==="asc"?c.jsxs(c.Fragment,{children:[c.jsx(rm,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ls,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]})})]}),o&&c.jsxs(se,{variant:"ghost",size:"icon",className:"absolute right-0 hidden h-6 w-6 group-hover/table-head:flex",onClick:O=>{O.stopPropagation(),s(x.id)},children:[c.jsx(bu,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Column settings"})]})]}):_?c.jsxs("div",{className:"group/table-head flex select-none items-center justify-between",style:{overflow:"hidden"},children:[c.jsxs("div",{className:"flex w-full items-center justify-center",onClick:O=>{O.preventDefault();const M=O.shiftKey;x.toggleSorting(x.getIsSorted()==="asc",M)},children:[c.jsxs("span",{className:"truncate",children:[h.charAt(0).toUpperCase()+h.slice(1),T&&c.jsxs("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["(",ff(R),")"]})]}),c.jsx("div",{className:"ml-2 flex cursor-pointer",children:w==="asc"?c.jsxs("div",{className:"flex items-center",children:[c.jsx(rm,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]}):w==="desc"?c.jsxs("div",{className:"flex items-center",children:[c.jsx(Ls,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]}):null})]}),o&&c.jsxs(se,{variant:"ghost",size:"icon",className:"absolute right-1 h-6 w-6 opacity-0 transition-opacity group-hover/table-head:opacity-100",onClick:O=>{O.stopPropagation(),s(x.id)},children:[c.jsx(bu,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Column settings"})]})]}):c.jsxs("div",{className:"group/table-head flex select-none items-center justify-between",style:{overflow:"hidden"},children:[c.jsxs("div",{className:"flex items-center",onClick:O=>{O.preventDefault();const M=O.shiftKey;x.toggleSorting(x.getIsSorted()==="asc",M)},children:[c.jsxs("span",{className:"truncate",children:[h.charAt(0).toUpperCase()+h.slice(1),T&&c.jsxs("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["(",ff(R),")"]})]}),c.jsx("div",{className:"ml-2 flex cursor-pointer",children:w==="asc"?c.jsxs("div",{className:"flex items-center",children:[c.jsx(rm,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]}):w==="desc"?c.jsxs("div",{className:"flex items-center",children:[c.jsx(Ls,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]}):null})]}),o&&c.jsxs(se,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 transition-opacity group-hover/table-head:opacity-100",onClick:O=>{O.stopPropagation(),s(x.id)},children:[c.jsx(bu,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Column settings"})]})]})},cell:({row:x,column:y})=>{const v=x.getValue(h),w=n[y.id]||fg(h,e,void 0,l==null?void 0:l.config);if(v==null){const E=w.textAlign==="center"?"justify-center":w.textAlign==="right"?"justify-end":"justify-start";return c.jsx("div",{className:`flex items-center ${E}`,children:c.jsx(qc,{className:"h-4 w-4 text-muted-foreground/50"})})}const S=w.textAlign==="center"?"text-center":w.textAlign==="right"?"text-right":"text-left",N=w.textWrap==="wrap"?"whitespace-normal break-words":"truncate",j={width:"100%",display:"block"};if(w.type==="number"&&typeof v=="number"&&w.colorRanges.length>0){const E=w.colorRanges.find(D=>v>=D.min&&v<=D.max);E&&(E.applyTo==="cell"&&(j.backgroundColor=E.color,j.color=tR(E.color),j.padding="0.25rem 0.5rem",j.borderRadius="0.25rem"),E.applyTo==="row"&&(x.columnFilters[y.id]=!0,x.rowColor=E.color))}let _;if(w.type==="badge"||w.type==="none"&&typeof v=="string"&&["department","role"].includes(h))_=c.jsx(Ae,{variant:"outline",className:"px-1.5 text-muted-foreground",children:String(v)});else if(w.type==="number"&&typeof v=="number"){let E;try{E=new Intl.NumberFormat(w.numberFormat.locale,{style:w.numberFormat.style,currency:w.numberFormat.style==="currency"?w.numberFormat.currency:void 0,minimumFractionDigits:w.numberFormat.minimumFractionDigits,maximumFractionDigits:w.numberFormat.maximumFractionDigits}).format(v)}catch{E=v.toLocaleString()}if(w.numberFormat.showDataBar){const D=e.map(P=>{const F=P[h];return typeof F=="number"?F:null}).filter(P=>P!==null),R=w.numberFormat.dataBarMinValue!==void 0?w.numberFormat.dataBarMinValue:Math.min(...D),O=(w.numberFormat.dataBarMaxValue!==void 0?w.numberFormat.dataBarMaxValue:Math.max(...D))-R,M=O<=0?0:Math.min(Math.max(0,(v-R)/O*100),100);_=c.jsxs("div",{className:"relative flex h-5 w-full items-center",children:[c.jsx("div",{className:"absolute inset-0 flex items-center",children:c.jsx("div",{className:"h-4 rounded-sm",style:{width:`${M}%`,backgroundColor:w.numberFormat.dataBarColor,opacity:.7}})}),c.jsx("div",{className:"relative px-1.5 text-sm",children:E})]})}else _=E}else if(w.type==="date"&&v)try{if(w.dateFormat.useRelativeTime)_=h1(String(v));else{let E;w.dateFormat.timezone==="auto"||!w.dateFormat.timezone?E=i||a:E=w.dateFormat.timezone;const D=w.dateFormat.useCustomFormat?w.dateFormat.customFormat:w.dateFormat.format,R=Eb(String(v),D,E,w.dateFormat.sourceTimezone||"auto");_=c.jsx("span",{title:`${av(E||a)} (${ff(E||a)})`,children:R})}}catch{_=String(v)}else if(w.type==="link"&&v){let E=String(v);!E.startsWith("http://")&&!E.startsWith("https://")&&(E="https://"+E),_=c.jsx("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",onClick:D=>D.stopPropagation(),children:String(v)})}else if(w.type==="progress"&&typeof v=="number"){const E=Math.min(Math.max(0,v),100);let D="#ef4444";E>=70?D="#22c55e":E>=40&&(D="#eab308"),_=c.jsxs("div",{className:"flex w-full items-center gap-2",children:[c.jsx("div",{className:"h-2.5 flex-1 overflow-hidden rounded-full bg-muted",children:c.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${E}%`,backgroundColor:D}})}),c.jsxs("span",{className:"whitespace-nowrap text-xs font-medium",children:[E,"%"]})]})}else _=String(v);return c.jsx("div",{className:`${S} ${N}`,style:j,children:_})}}});return r?[u,...f]:f}function XU(e){var $t,Se,Dt,wn;const{data:t,pageSize:n,columnSettings:r,columnVisibility:s,initialColumnVisibility:o,defaultSelectColumnVisible:i,onSelectColumnVisibleChange:a,onInitializeColumnVisibility:l,onUpdateAllColumnVisibility:u,onColumnSettingsChange:d,onColumnVisibilityChange:f,onSortChange:h,sortState:p,columnSizing:m,onColumnSizingChange:g,card:b,paginationMetadata:x,onPaginationChange:y}=e,{displayPreferences:v}=fc(),[w,S]=C.useState([]),[N,j]=C.useState([]),[_,E]=C.useState(""),[D,R]=C.useState({}),T=v.mode==="table-print",O=b?jU(b,v.mode):T?"disabled":"client",M=O==="disabled"?Number.MAX_SAFE_INTEGER:n||50,[P,F]=C.useState({pageIndex:x&&O==="server"?x.page-1:0,pageSize:M});C.useEffect(()=>{b&&b.type==="table"&&b.config&&!b.paginationConfig&&y&&y(0,M)},[b==null?void 0:b.id]);const[H,V]=C.useState(!1),[L,A]=C.useState(null),[B,z]=C.useState({}),I=r||B,[W,q]=C.useState(Ao()),[Y,U]=C.useState(i||!1);C.useEffect(()=>{a||U(i??!1)},[i,a]);const $=a?i!==void 0?i:!1:Y,[G,Z]=C.useState(o||{}),ee=s||G,X=C.useRef(null),ne=C.useRef(!1),ie=te(he=>he.themeStyle);te(he=>he.isDashboardEditing);const fe=te(he=>he.isVisualEditing),{tokenProps:ce}=Ke(),je=($t=ce==null?void 0:ce.params)==null?void 0:$t.timeZone,ve=Intl.DateTimeFormat().resolvedOptions().timeZone,Oe=VNe({data:t,sorting:w,columnSettings:I,selectColumnVisible:$,isVisualEditing:fe,onOpenColumnSettings:he=>{A(he);let we=I[he];we||(we=t&&t.length>0?fg(he,t,void 0,b==null?void 0:b.config):Ao()),q(we),V(!0)},contextTimezone:je,browserTimezone:ve,card:b}),qe=he=>{const we=typeof he=="function"?he(w):he;S(we),h==null||h(we)},be=he=>{const we=typeof he=="function"?he(P):he;F(we),O==="server"&&y&&y(we.pageIndex,we.pageSize)},ae=fR({data:t,columns:Oe,getCoreRowModel:uR(),onSortingChange:qe,getSortedRowModel:TNe(),onColumnFiltersChange:j,getFilteredRowModel:RNe(),getPaginationRowModel:O==="client"?dR():void 0,onRowSelectionChange:R,onPaginationChange:O==="disabled"?void 0:be,manualPagination:O==="server"||O==="disabled",pageCount:O==="server"&&x?x.pageCount:void 0,onColumnVisibilityChange:he=>{if(ne.current)return;let we={};if(typeof he=="function"){const Fe=ae.getState().columnVisibility;try{we=he(Fe)}catch(De){console.error("Failed to resolve visibility function:",De);return}}else we=he;if(u)u(we);else if(f){const Fe=ae.getState().columnVisibility;Object.entries(we).forEach(([De,Ye])=>{Fe[De]!==Ye&&f(De,Ye)})}else Z(we)},state:{sorting:w,columnFilters:N,globalFilter:_,rowSelection:D,pagination:P,columnVisibility:ee,columnSizing:m||{}},enableColumnResizing:!0,columnResizeMode:"onChange",onColumnSizingChange:g,enableMultiSort:!0,enableRowSelection:!0}),ye=(Se=ae==null?void 0:ae.getAllColumns())==null?void 0:Se.length,Be=(wn=(Dt=ae==null?void 0:ae.getCoreRowModel())==null?void 0:Dt.rows)==null?void 0:wn.length;X.current=ae,C.useEffect(()=>{p&&S(p)},[p]),C.useEffect(()=>{O==="server"&&x&&F(he=>({...he,pageIndex:x.page-1}))},[x,O]),C.useEffect(()=>{if(f&&l){const we=ae.getAllColumns().filter(De=>De.id!=="select").map(De=>De.id).filter(De=>typeof De=="string");(!s||Object.keys(s).length===0)&&l(we)}},[]);const Re=(he,we)=>{ne.current=!0;try{f?f(he,we):(console.log("Updating internal state",he,we),Z(De=>({...De,[he]:we})));const Fe=ae.getColumn(he);Fe&&Fe.toggleVisibility(we)}finally{ne.current=!1}},re=()=>{if(L){const he={...I,[L]:{...W}};d?d(he):z(he),V(!1)}},de=()=>{L&&(q(Ao()),ae.getRowModel().rows.forEach(he=>{he.columnFilters[L]&&delete he.columnFilters[L]}))},Te=()=>{d?d({}):z({}),q(Ao()),ae.getRowModel().rows.forEach(he=>{he.columnFilters={}}),V(!1)},Le=he=>{a?a(he):U(he)},Me=he=>{for(const we of he.getVisibleCells()){const Fe=we.column.id;if(he.columnFilters[Fe]&&he.columnFilters[Fe].color)return{backgroundColor:he.columnFilters[Fe].color,color:tR(he.columnFilters[Fe].color)}}return{}},at=Object.keys(D).length,Rt={rows:ae.getFilteredRowModel().rows.map(he=>{const we={};return ae.getAllColumns().filter(Fe=>Fe.id!=="select"&&Fe.getIsVisible()).forEach(Fe=>{const De=Fe.id;we[De]=he.getValue(De)}),we}),selectedRows:ae.getFilteredSelectedRowModel().rows.map(he=>{const we={};return ae.getAllColumns().filter(Fe=>Fe.id!=="select"&&Fe.getIsVisible()).forEach(Fe=>{const De=Fe.id;we[De]=he.getValue(De)}),we}),visibleColumns:ae.getAllColumns().filter(he=>he.id!=="select"&&he.getIsVisible()).map(he=>he.id),columnSettings:I,contextTimezone:je,browserTimezone:ve},pt=C.useRef(fe);return C.useEffect(()=>{!fe&&pt.current&&(Z(o||{}),O!=="server"&&O!=="disabled"&&F({pageIndex:0,pageSize:M})),pt.current=fe},[o,fe,O,M]),C.useEffect(()=>{if(s&&Object.keys(s).length>0){if(ne.current)return;ne.current=!0;try{const he=X.current;if(!he)return;he.getAllColumns().forEach(we=>{if(we.id!=="select"&&we.getCanHide()&&typeof we.id=="string"){const Fe=s[we.id]!==void 0?s[we.id]:!0;we.getIsVisible()!==Fe&&we.toggleVisibility(Fe)}})}finally{ne.current=!1}}},[s]),{table:ae,columnSettingsToUse:I,selectColumnVisible:$,columnVisibilityToUse:ee,handleColumnVisibilityChange:Re,applyColumnSettings:re,resetColumnSettings:de,resetAllColumnSettings:Te,handleSelectColumnVisibleChange:Le,selectedRowsCount:at,exportData:Rt,globalFilter:_,setGlobalFilter:E,setRowSelection:R,columnSettingsOpen:H,activeColumnId:L,tempColumnSettings:W,isHandlingVisibilityChange:ne,themeStyle:ie,tableRef:X,internalColumnSettings:B,internalSelectColumnVisible:Y,getRowStyle:Me,setTempColumnSettings:q,setColumnSettingsOpen:V,columns:Oe,internalColumnVisibility:G,totalColumns:ye,totalRows:Be,onSortChange:h,paginationMode:O,paginationMetadata:x,contextTimezone:je,browserTimezone:ve}}function ed({size:e="md",color:t="muted",className:n=""}){const r={xs:"w-0.5 h-0.5",sm:"w-1 h-1",md:"w-2 h-2",lg:"w-3 h-3"},s={muted:"bg-muted-foreground/70",primary:"bg-primary",secondary:"bg-secondary-foreground",accent:"bg-accent-foreground",destructive:"bg-destructive",gray:"bg-gray-400 dark:bg-gray-500",blue:"bg-blue-500 dark:bg-blue-400",green:"bg-green-500 dark:bg-green-400",red:"bg-red-500 dark:bg-red-400"},o=K(r[e],s[t],"rounded-full animate-pulse");return c.jsxs("div",{className:K("flex items-center gap-1",n),children:[c.jsx("div",{className:o,style:{animationDelay:"0ms",animationDuration:"1.4s"}}),c.jsx("div",{className:o,style:{animationDelay:"200ms",animationDuration:"1.4s"}}),c.jsx("div",{className:o,style:{animationDelay:"400ms",animationDuration:"1.4s"}})]})}function mR({card:e}){var p,m;const t=te(g=>g.isVisualEditing),{updateCurrentDashboardCard:n}=Jt(),r=$e(g=>{var b;return(b=g.actions)==null?void 0:b.updateColumnSizing}),s=C.useMemo(()=>{var g,b;return((b=(g=e==null?void 0:e.preferences)==null?void 0:g.tablePrefs)==null?void 0:b.columnSizing)||{}},[(m=(p=e==null?void 0:e.preferences)==null?void 0:p.tablePrefs)==null?void 0:m.columnSizing]),[o,i]=C.useState(s),a=C.useRef(!1),l=C.useRef({}),u=C.useRef(null),d=C.useCallback((g,b)=>{const x=Object.keys(g),y=Object.keys(b);if(x.length!==y.length)return!1;for(const v of x)if(g[v]!==b[v])return!1;return!0},[]);C.useEffect(()=>{!a.current&&s&&(d(s,o)||i(s))},[s,d,o]);const f=C.useCallback(g=>{var v;const b=g||{},y=Object.keys(b).length>0?b:l.current;!y||Object.keys(y).length===0||(t&&r?r(y):n({...e,preferences:{...e.preferences,tablePrefs:{...(v=e.preferences)==null?void 0:v.tablePrefs,columnSizing:y}}}))},[t,r,n,e]),h=C.useCallback(g=>{const b=typeof g=="function"?g(o):g;a.current=!0,i(b),b&&Object.keys(b).length>0&&(l.current={...b}),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{f(b),u.current=null},250)},[o,f]);return C.useEffect(()=>{const g=()=>{a.current&&(a.current=!1,u.current&&(clearTimeout(u.current),u.current=null),f(o))};return window.addEventListener("mouseup",g),window.addEventListener("touchend",g),()=>{window.removeEventListener("mouseup",g),window.removeEventListener("touchend",g)}},[o,f]),C.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]),{columnSizing:o,onColumnSizingChange:h}}const HNe=w9,UNe=S9,WNe=C9,qNe=bce,QU=k.forwardRef(({className:e,sideOffset:t=4,...n},r)=>c.jsx(Tw,{ref:r,sideOffset:t,className:K("z-50 overflow-hidden rounded-md bg-foreground px-3 py-1.5 text-sm text-background shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));QU.displayName=Tw.displayName;function tF({resolvedCardConfig:e,card:t,row:n}){const{groupByColumns:r=[],metricColumns:s=[]}=e||t.config,o=[];for(const a of r){const l=n.getValue(a.label);l!=null&&o.push({field:a,operator:"=",value:String(l)})}if(o.length===0)return;const i=[];for(const a of s){const l=n.getValue(a.label);l!=null&&i.push({field:a,value:Number(l)})}return{conditions:o,metrics:i.length>0?i:void 0}}function nF(e){return e.mode==="clickFilter"}function YNe(e,t){if(!t||t.type==="metric")return e;if(t.type==="attribute"){const n=e.find(r=>r.field.id===t.field.id);return n?[n]:[]}return e}function GNe(e){var I;const{card:t,isLoading:n,frameId:r,sheetId:s,onMultipleInteractions:o}=e,{columnSizing:i,onColumnSizingChange:a}=mR({card:t}),l=te(W=>W.themeStyle),{displayPreferences:u,shouldShowElement:d}=fc(),f=u.mode==="table-print",h=C.useMemo(()=>ti(t.interactionConfig),[t.interactionConfig]),p=C.useMemo(()=>h.filter(nF),[h]),m=p.length>0,{table:g,columnSettingsToUse:b,getRowStyle:x,activeColumnId:y,tempColumnSettings:v,applyColumnSettings:w,resetColumnSettings:S,resetAllColumnSettings:N,columnSettingsOpen:j,setTempColumnSettings:_,columns:E,setColumnSettingsOpen:D,totalColumns:R,totalRows:T,paginationMode:O,paginationMetadata:M,contextTimezone:P,browserTimezone:F}=XU({...e,columnSizing:i,onColumnSizingChange:a,defaultSelectColumnVisible:m&&!f}),H=fk(t),{handlePointerInteraction:V}=r$(t,r||"",s||"",o),L=C.useMemo(()=>h.some(W=>W.trigger!==void 0&&W.mode!=="clickFilter"),[h]),A=Ut(W=>W.interactionStates[t.id]);C.useEffect(()=>{const W=(A==null?void 0:A.appliedClickFilters)||[],q=g.getFilteredSelectedRowModel().rows.length;W.length===0&&q>0&&g.resetRowSelection()},[A==null?void 0:A.appliedClickFilters,g]);const B=C.useRef("");C.useEffect(()=>{if(!m||!r||!s)return;const W=g.getState().rowSelection,q=JSON.stringify(W);if(q===B.current)return;B.current=q;const U=g.getFilteredSelectedRowModel().rows.map($=>{var ie;const G=tF({resolvedCardConfig:H,card:t,row:$});if(!G)return null;const ee=Qv(h,{conditions:G.conditions,metrics:G.metrics}).find(nF)??p[0];if(!ee)return null;const X=YNe(G.conditions,ee.trigger);return{interactionMode:"clickFilter",sourceCardId:t.id,filterGroups:[{filters:X}],metric:(ie=G.metrics)==null?void 0:ie[0],applyToCardIds:ee.applyToCardIds,excludeCardIds:ee.excludeCardIds}}).filter($=>!!$);Ut.getState().setInteractionState(t.id,{...A??Ro(),appliedClickFilters:U})});const z=(W,q)=>{if(W.stopPropagation(),!L||!r||!s)return;const Y=tF({resolvedCardConfig:H,card:t,row:q});Y&&V({context:Y,gesture:"leftClick",modifierKeys:{shift:W.shiftKey,ctrl:W.ctrlKey,meta:W.metaKey},position:{x:W.clientX,y:W.clientY}})};return c.jsx(HNe,{children:c.jsxs("div",{onMouseDown:W=>W.stopPropagation(),className:"flex w-full flex-col gap-4",children:[c.jsxs(jd,{style:{borderRadius:l==null?void 0:l.cardBorderRadius},className:K("relative h-full rounded-none border",f&&"border-gray-300 print:border-gray-400"),children:[n&&O==="server"&&c.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/50",children:c.jsx(ed,{size:"md",color:"muted","aria-label":"Loading data"})}),c.jsxs("table",{className:K("w-full text-sm",f&&"print:break-inside-avoid"),"data-table-type":"data","data-total-rows":T,"data-total-columns":R,children:[c.jsx(x1,{className:K(!f&&"sticky top-0 z-10 bg-muted",f&&"bg-gray-50 text-foreground print:table-header-group print:bg-gray-100"),children:g.getHeaderGroups().map(W=>c.jsx(xs,{children:W.headers.map(q=>c.jsx(wo,{colSpan:q.colSpan,"data-column-id":q.id,style:{width:q.getSize(),minWidth:q.getSize(),maxWidth:q.getSize(),position:"relative",transition:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},className:K("h-10",f&&"border-r border-gray-300 text-foreground last:border-r-0 print:border-gray-400"),children:q.isPlaceholder?null:c.jsxs(c.Fragment,{children:[c.jsxs(UNe,{children:[c.jsx(WNe,{asChild:!0,children:c.jsx("span",{className:"block overflow-hidden text-ellipsis",children:$s(q.column.columnDef.header,q.getContext())})}),c.jsxs(QU,{side:"top",children:[c.jsx(qNe,{className:"fill-foreground"}),$s(q.column.columnDef.header,q.getContext())]})]}),c.jsx(Zc,{header:q,isResizing:q.column.getIsResizing()})]})},q.id))},W.id))}),c.jsx(dg,{children:(I=g.getRowModel().rows)!=null&&I.length?g.getRowModel().rows.map(W=>{const q=W.getIsSelected(),Y=g.getFilteredSelectedRowModel().rows.length>0;return c.jsx(xs,{onClick:U=>z(U,W),"data-state":q?"selected":void 0,className:K("border-border/50 transition-all duration-150",q?"border-primary/50 bg-primary/10 hover:bg-primary/15":Y?"opacity-40 hover:opacity-60":"hover:bg-muted/30",f&&"border-gray-300 print:break-inside-avoid print:border-gray-400",L&&"cursor-pointer"),style:x(W),children:W.getVisibleCells().map(U=>c.jsx(Hn,{"data-column-id":U.column.id,style:{width:U.column.getSize(),minWidth:U.column.getSize(),maxWidth:U.column.getSize(),transition:"none",overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden py-2",f&&"border-r border-gray-300 last:border-r-0 print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(U.column.columnDef.cell,U.getContext())})},U.id))},W.id)}):c.jsx(xs,{children:c.jsx(Hn,{colSpan:E.length,className:"h-24 text-center",children:n?c.jsx(c.Fragment,{}):"No results."})})})]}),c.jsx(tl,{orientation:"horizontal"})]}),(()=>{if(Object.entries(b).some(([q,Y])=>Y.type!=="date"||!Y.dateFormat?!1:(Y.dateFormat.timezone==="auto"||!Y.dateFormat.timezone?P||F:Y.dateFormat.timezone)!==F)){const q=new Set;Object.entries(b).forEach(([U,$])=>{if($.type==="date"&&$.dateFormat){const G=$.dateFormat.timezone==="auto"||!$.dateFormat.timezone?P||F:$.dateFormat.timezone;G&&G!==F&&q.add(G)}});const Y=Array.from(q).map(U=>`${av(U)} (${ff(U)})`).join(", ");return c.jsx("div",{className:"flex items-center justify-center px-4 py-2 text-xs text-muted-foreground",children:c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Dj,{className:"h-3 w-3"}),"Date/time values displayed in: ",Y]})})}return null})(),!f&&d("showPagination")&&(O==="server"||g.getFilteredRowModel().rows.length>10)&&c.jsx(hR,{totalColumns:R,pageCount:O==="server"&&M?M.pageCount:g.getPageCount(),pageIndex:g.getState().pagination.pageIndex,pageSize:g.getState().pagination.pageSize,rowCount:O==="server"&&M?M.totalCount:g.getFilteredRowModel().rows.length,selectedRowCount:g.getFilteredSelectedRowModel().rows.length,setPageIndex:g.setPageIndex,setPageSize:g.setPageSize,canPreviousPage:O==="server"&&M?M.hasPrevPage:g.getCanPreviousPage(),canNextPage:O==="server"&&M?M.hasNextPage:g.getCanNextPage(),previousPage:g.previousPage,nextPage:g.nextPage,onClearSelection:()=>{g.resetRowSelection(),((A==null?void 0:A.appliedClickFilters)||[]).filter(Y=>Y.sourceCardId===t.id).forEach(Y=>{Ut.getState().toggleClickFilter(t.id,Y)})},paginationMode:O}),d("showColumnSettings")&&c.jsx(pR,{column:y?g.getColumn(y)??null:null,settings:v,onSettingsChange:_,onApply:w,onReset:S,onResetAll:N,open:j,onOpenChange:D})]})})}function kb({data:e,card:t,onSortChange:n,sortState:r,paginationMetadata:s,onPaginationChange:o,isLoading:i,frameId:a,sheetId:l,onMultipleInteractions:u}){var _,E,D,R,T,O,M,P,F,H;const d=te(V=>V.isVisualEditing),f=(E=(_=t==null?void 0:t.preferences)==null?void 0:_.tablePrefs)==null?void 0:E.columnSettingsMap,h=(R=(D=t==null?void 0:t.preferences)==null?void 0:D.tablePrefs)==null?void 0:R.columnVisibility,p=(O=(T=t==null?void 0:t.preferences)==null?void 0:T.tablePrefs)==null?void 0:O.columnSizing,m=(P=(M=t==null?void 0:t.preferences)==null?void 0:M.tablePrefs)==null?void 0:P.selectColumnVisible,g=(H=(F=t==null?void 0:t.preferences)==null?void 0:F.tablePrefs)==null?void 0:H.pageSize,{updateColumnSettingsMap:b,updateColumnVisibility:x,updateColumnSizing:y,showAllColumns:v,hideAllColumns:w,toggleSelectColumn:S}=$e(V=>V.actions),N={card:t,data:e,pageSize:g,columnSettings:f,onColumnSettingsChange:b,columnVisibility:h,onColumnVisibilityChange:x,columnSizing:p,onColumnSizingChange:y,onShowAllColumns:v,onHideAllColumns:w,defaultSelectColumnVisible:m,onSelectColumnVisibleChange:S,exportFileName:"export",paginationMetadata:s,onPaginationChange:o,isLoading:i,frameId:a,sheetId:l,onMultipleInteractions:u},j={card:t,data:e,pageSize:g,columnSettings:f,columnSizing:p,initialColumnVisibility:h,defaultSelectColumnVisible:m,exportFileName:"export",paginationMetadata:s,onPaginationChange:o,isLoading:i,frameId:a,sheetId:l,onMultipleInteractions:u};return c.jsx(GNe,{sortState:r,onSortChange:n,...d?N:j})}function ZNe(e,t){var b,x;const n=te(y=>y.isVisualEditing),{updateCurrentDashboardCard:r}=Jt(),s=$e(y=>{var v;return(v=y.actions)==null?void 0:v.updateColumnSettingsMap}),o=C.useMemo(()=>{var y,v;return((v=(y=e==null?void 0:e.preferences)==null?void 0:y.tablePrefs)==null?void 0:v.columnSettingsMap)||{}},[(x=(b=e==null?void 0:e.preferences)==null?void 0:b.tablePrefs)==null?void 0:x.columnSettingsMap]),[i,a]=C.useState(!1),[l,u]=C.useState(null),[d,f]=C.useState(Ao()),h=C.useCallback(y=>{u(y);let v=o[y];v||(v=t&&t.length>0?fg(y,t):Ao()),f(v),a(!0)},[o,t]),p=C.useCallback(()=>{var y;if(l&&d){const v={...o,[l]:d};if(n&&s)s(v);else if(r){const w={...e,preferences:{...e.preferences,tablePrefs:{...(y=e.preferences)==null?void 0:y.tablePrefs,columnSettingsMap:v}}};r(w)}}a(!1)},[l,d,o,n,s,r,e]),m=C.useCallback(()=>{l&&f(Ao())},[l]),g=C.useCallback(()=>{var y;if(n&&s)s({});else if(r){const v={...e,preferences:{...e.preferences,tablePrefs:{...(y=e.preferences)==null?void 0:y.tablePrefs,columnSettingsMap:{}}}};r(v)}a(!1)},[n,s,r,e]);return{columnSettings:o,columnSettingsOpen:i,activeColumnId:l,tempColumnSettings:d,isVisualEditing:n,openColumnSettings:h,applyColumnSettings:p,resetColumnSettings:m,resetAllColumnSettings:g,setColumnSettingsOpen:a,setTempColumnSettings:f}}function hg(e,t,n){return e==null?c.jsx(qc,{className:"h-4 w-4 text-muted-foreground"}):n?n.type==="badge"?KNe(e):n.type==="link"&&e?XNe(e):n.type==="progress"&&typeof e=="number"?QNe(e):n.type==="number"&&typeof e=="number"?JNe(e,n):n.type==="date"&&e?eje(e):String(e):typeof e=="number"?e.toLocaleString():String(e)}function KNe(e){return c.jsx(Ae,{variant:"outline",className:"px-1.5 text-muted-foreground",children:String(e)})}function XNe(e){let t=String(e);return!t.startsWith("http://")&&!t.startsWith("https://")&&(t="https://"+t),c.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 underline hover:text-blue-700",onClick:n=>n.stopPropagation(),children:String(e)})}function QNe(e){const t=Math.min(Math.max(0,e),100);let n="#ef4444";return t>=70?n="#22c55e":t>=40&&(n="#eab308"),c.jsxs("div",{className:"relative flex h-5 w-full items-center",children:[c.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-gray-200",children:c.jsx("div",{className:"h-full transition-all duration-300",style:{width:`${t}%`,backgroundColor:n}})}),c.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-xs font-medium",children:[t,"%"]})]})}function JNe(e,t){const{numberFormat:n}=t;let r;try{n.style==="percent"?r=new Intl.NumberFormat(n.locale||"en-US",{style:"percent",minimumFractionDigits:n.minimumFractionDigits??0,maximumFractionDigits:n.maximumFractionDigits??2}).format(e/100):n.style==="currency"?r=new Intl.NumberFormat(n.locale||"en-US",{style:"currency",currency:n.currency||"USD",minimumFractionDigits:n.minimumFractionDigits??0,maximumFractionDigits:n.maximumFractionDigits??2}).format(e):r=new Intl.NumberFormat(n.locale||"en-US",{minimumFractionDigits:n.minimumFractionDigits??0,maximumFractionDigits:n.maximumFractionDigits??2}).format(e)}catch(s){console.error("Error formatting number:",s),r=e.toLocaleString()}if(n.showDataBar){const s=n.dataBarMinValue??0,o=n.dataBarMaxValue??100,i=(e-s)/(o-s)*100,a=Math.min(Math.max(0,i),100),l=n.dataBarColor||"#3b82f6";return c.jsxs("div",{className:"relative flex items-center",children:[c.jsx("div",{className:"absolute inset-y-0 left-0 bg-opacity-20",style:{width:`${a}%`,backgroundColor:l}}),c.jsx("span",{className:"relative px-2",children:r})]})}if(t.colorRanges&&t.colorRanges.length>0){for(const s of t.colorRanges)if(e>=s.min&&e<=s.max){const i=tR(s.color);return c.jsx("span",{style:{backgroundColor:s.color,color:i,padding:"2px 6px",borderRadius:"4px"},children:r})}}return r}function eje(e,t){return String(e)}function Yp({columnName:e,groupByFields:t,pivotByFields:n,currentAggregation:r,onAggregationChange:s,onOpenChange:o}){const i=[{value:"SUM",label:"Sum"},{value:"MAX",label:"Max"},{value:"MIN",label:"Min"},{value:"AVG",label:"Avg"},{value:"MEDIAN",label:"Median"}],a=(u,d,f)=>{s({function:u,rowLevel:d,columnLevel:f})},l=(u,d,f)=>{if(!r)return!1;if(d!==void 0&&f===void 0){if(r.rowAggregates){const h=d==="all"?"ALL":d;return r.rowAggregates.some(p=>p.function===u&&p.groupLevel===h)}return!1}if(f!==void 0&&d===void 0){if(r.columnAggregates){const h=f==="all"?"ALL":f;return r.columnAggregates.some(p=>p.function===u&&p.pivotLevel===h)}return!1}return!1};return c.jsxs(Th,{modal:!1,onOpenChange:o,children:[c.jsx(Mh,{asChild:!0,children:c.jsx(se,{variant:"ghost",size:"icon",className:"h-6 w-6 p-0 hover:bg-accent hover:text-accent-foreground",children:c.jsx(iw,{className:"size-3"})})}),c.jsxs(bd,{align:"start",className:"w-56",children:[c.jsx(wf,{className:"text-xs font-normal text-muted-foreground",children:"AGGREGATE"}),i.map(u=>{var p,m;const d=((p=r==null?void 0:r.rowAggregates)==null?void 0:p.some(g=>g.function===u.value))||!1,f=((m=r==null?void 0:r.columnAggregates)==null?void 0:m.some(g=>g.function===u.value))||!1,h=d||f;return c.jsxs(yie,{children:[c.jsx(pz,{className:"text-xs",children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsx("span",{children:u.label}),h&&c.jsxs("div",{className:"ml-2 flex items-center gap-1 text-xs",children:[d&&c.jsx("span",{className:"rounded bg-blue-100 px-1 py-0.5 text-blue-700 dark:bg-blue-900 dark:text-blue-300",children:"R"}),f&&c.jsx("span",{className:"rounded bg-green-100 px-1 py-0.5 text-green-700 dark:bg-green-900 dark:text-green-300",children:"C"})]})]})}),c.jsxs(mz,{className:"w-48",children:[c.jsx(wf,{className:"text-xs font-normal text-muted-foreground",children:"ROWS"}),c.jsx(ri,{className:"text-xs",onClick:()=>a(u.value,"all"),children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsx("span",{children:"of all rows"}),l(u.value,"all")&&c.jsx(Dr,{className:"h-4 w-4"})]})}),t.map(g=>c.jsx(ri,{className:"text-xs",onClick:()=>a(u.value,g.id),children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsxs("span",{children:["within ",g.label||g.name]}),l(u.value,g.id)&&c.jsx(Dr,{className:"h-4 w-4"})]})},g.id)),n.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(Hu,{}),c.jsx(wf,{className:"text-xs font-normal text-muted-foreground",children:"COLUMNS"}),c.jsx(ri,{className:"text-xs",onClick:()=>a(u.value,void 0,"all"),children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsx("span",{children:"of all columns"}),l(u.value,void 0,"all")&&c.jsx(Dr,{className:"h-4 w-4"})]})}),n.map(g=>c.jsx(ri,{className:"text-xs",onClick:()=>a(u.value,void 0,g.id),children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsxs("span",{children:["within ",g.label||g.name]}),l(u.value,void 0,g.id)&&c.jsx(Dr,{className:"h-4 w-4"})]})},g.id))]})]})]},`${u.value}-${u.label}`)})]})]})}function tje({columnId:e,label:t,alignment:n,isVisualEditing:r,isTablePrintDisplayMode:s,groupByColumns:o,card:i,onOpenColumnSettings:a,onAggregationChange:l}){var u,d;return c.jsxs("div",{className:"group/table-head relative flex items-center justify-between",children:[r&&c.jsxs(se,{variant:"ghost",size:"icon",className:"absolute left-0 z-10 h-6 w-6 opacity-0 transition-opacity group-hover/table-head:opacity-100",onClick:f=>{f.stopPropagation(),a(e)},children:[c.jsx(Ch,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Column settings"})]}),c.jsx("span",{className:K("flex-1",n==="right"?"text-right":n==="center"?"text-center":"text-left",r&&"pl-8"),children:t}),l&&!s&&c.jsx("div",{className:"ml-2",children:c.jsx(Yp,{columnName:t,groupByFields:o,pivotByFields:[],currentAggregation:{rowAggregates:((u=i==null?void 0:i.config)==null?void 0:u.rowAggregates)||[],columnAggregates:((d=i==null?void 0:i.config)==null?void 0:d.columnAggregates)||[]},onAggregationChange:l})})]})}function nje({columnId:e,displayLabel:t,isVisualEditing:n,onOpenColumnSettings:r}){return c.jsxs("div",{className:"group/table-head relative flex items-center justify-end",children:[n&&c.jsxs(se,{variant:"ghost",size:"icon",className:"absolute left-0 z-10 h-6 w-6 opacity-0 transition-opacity group-hover/table-head:opacity-100",onClick:s=>{s.stopPropagation(),r(e)},children:[c.jsx(Ch,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Column settings"})]}),c.jsx("span",{className:K("flex-1 text-right",n&&"pl-8"),children:t})]})}function rje({row:e,columnId:t,columnAlias:n,groupByColumns:r,card:s,settings:o,alignment:i,idx:a}){var f,h,p;const l=e;if(l.isGrandTotal)return c.jsx(c.Fragment,{children:a===0?"Grand Total":""});if(l.isSubtotal){if(l.subtotalContext){const g=l.subtotalLevel,b=r.findIndex(x=>x.alias===g);if(a===b){const x=l.aggregate||"SUM",y=(p=(h=(f=s==null?void 0:s.config)==null?void 0:f.rowAggregates)==null?void 0:h.find(v=>v.groupLevel===l.subtotalLevel&&v.function===x))==null?void 0:p.label;return c.jsx(c.Fragment,{children:iU(l,n,x,y)})}else if(a<b){const x=l[n];if(x&&x!=="__TOTAL__"){const y=hg(x,t,o);return c.jsx("div",{className:K(i==="right"?"text-right":i==="center"?"text-center":"text-left"),children:y})}}}return c.jsx(c.Fragment,{})}const u=l[n],d=hg(u,t,o);return c.jsx("div",{className:K(i==="right"?"text-right":i==="center"?"text-center":"text-left",u==null?"flex items-center":"",u==null?i==="right"?"justify-end":i==="center"?"justify-center":"justify-start":""),children:d})}function JU(e,t,n="left"){const r=t[e]||Ao(),s=(r==null?void 0:r.textAlign)||n,o=r!=null&&r.width&&typeof r.width=="number"?r.width:150,i=(r==null?void 0:r.minWidth)??50,a=(r==null?void 0:r.maxWidth)??500;return{settings:r,alignment:s,size:o,minSize:i,maxSize:a}}function sje({groupByColumns:e,pivotSchema:t,columnSettings:n,card:r,isVisualEditing:s,isTablePrintDisplayMode:o,onOpenColumnSettings:i,onAggregationChange:a}){const l=[],u=oje({groupByColumns:e,columnSettings:n,card:r,isVisualEditing:s,isTablePrintDisplayMode:o,onOpenColumnSettings:i,onAggregationChange:a});l.push(...u);const d=ije({pivotSchema:t,columnSettings:n,card:r,isVisualEditing:s,isTablePrintDisplayMode:o,onOpenColumnSettings:i,onAggregationChange:a,groupByColumns:e});return l.push(...d),l}function oje({groupByColumns:e,columnSettings:t,card:n,isVisualEditing:r,isTablePrintDisplayMode:s,onOpenColumnSettings:o,onAggregationChange:i}){return e.map((a,l)=>{const u=a.alias||a.name,{settings:d,alignment:f,size:h,minSize:p,maxSize:m}=JU(u,t,"left");return{id:u,accessorFn:g=>g[u],size:h,minSize:p,maxSize:m,enableResizing:!0,header:()=>c.jsx(tje,{columnId:u,label:a.label||a.name,alignment:f,isVisualEditing:r,isTablePrintDisplayMode:s,groupByColumns:e,card:n,idx:l,onOpenColumnSettings:o,onAggregationChange:i}),cell:({row:g})=>c.jsx(rje,{row:g.original,columnId:u,columnAlias:a.alias||a.name,groupByColumns:e,card:n,settings:d,alignment:f,idx:l})}})}function ije({pivotSchema:e,columnSettings:t,card:n,isVisualEditing:r,isTablePrintDisplayMode:s,onOpenColumnSettings:o,onAggregationChange:i,groupByColumns:a}){return e.filter(l=>l.isMetricColumn).map(l=>{const u=l.alias,{settings:d,size:f,minSize:h,maxSize:p}=JU(u,t,"right"),m="right";return{id:u,accessorFn:g=>g[u],size:f,minSize:h,maxSize:p,enableResizing:!0,header:()=>c.jsx(nje,{columnId:u,metricName:l.metricName,displayLabel:l.displayLabel||l.metricLabel||l.metricName,alignment:m,isVisualEditing:r,isTablePrintDisplayMode:s,groupByColumns:a,card:n,onOpenColumnSettings:o,onAggregationChange:i}),cell:({row:g})=>{const b=g.original[u],x=hg(b,u,d);return c.jsx("div",{className:K("text-right",b==null?"flex items-center justify-end":""),children:x})}}})}function aje({table:e,columns:t,groupByColumns:n,columnSettings:r,isTablePrintDisplayMode:s}){const o=e.getRowModel().rows;return o!=null&&o.length?c.jsx(dg,{children:o.map((i,a)=>{const l=i.original,u=l.isSubtotal&&!l.isGrandTotal;return c.jsx(xs,{"data-row-type":u?"subtotal":"data","data-subtotal-level":u?l.subtotalLevel:void 0,className:K("border-b",u&&!s&&"border-t border-t-border/50 bg-muted/70 font-medium",u&&s&&"print:bg-gray-150 border-t-2 border-gray-300 bg-gray-100 font-semibold text-foreground print:border-gray-400",s&&"border-gray-300 print:break-inside-avoid print:border-gray-400"),children:i.getVisibleCells().map((d,f)=>{const h=f<n.length;return u?c.jsx(lje,{cell:d,cellIndex:f,originalRow:l,groupByColumns:n,columnSettings:r,isGroupByColumn:h,isTablePrintDisplayMode:s},d.id):c.jsx(cje,{cell:d,cellIndex:f,visibleRowIndex:a,originalRow:l,rows:o,groupByColumns:n,columnSettings:r,isGroupByColumn:h,isTablePrintDisplayMode:s},d.id)})},i.id)})}):c.jsx(dg,{children:c.jsx(xs,{children:c.jsx(Hn,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})}function lje({cell:e,cellIndex:t,originalRow:n,groupByColumns:r,columnSettings:s,isGroupByColumn:o,isTablePrintDisplayMode:i}){const a=r.findIndex(l=>l.alias===n.subtotalLevel);if(t===a){const l=r.length-a;return c.jsx(Hn,{colSpan:l,style:{overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2.5 text-sm font-medium",i&&"border-gray-300 font-semibold text-foreground print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id)}else{if(t<a)return c.jsx(Hn,{style:{overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2.5 text-sm font-medium",i&&"border-gray-300 font-semibold text-foreground print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id);if(o&&t>a)return null}if(!o){const l=e.column.id,u=s[l],d=(u==null?void 0:u.textAlign)||"right";return c.jsx(Hn,{style:{overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2.5 font-semibold last:border-r-0",d==="right"?"text-right":d==="center"?"text-center":"text-left",i&&"border-gray-300 text-foreground print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id)}return null}function cje({cell:e,cellIndex:t,visibleRowIndex:n,originalRow:r,rows:s,groupByColumns:o,columnSettings:i,isGroupByColumn:a,isTablePrintDisplayMode:l}){const u=e.column.id,d=i[u],f=(d==null?void 0:d.textAlign)||(a?"left":"right");if(a){if(l)return c.jsx(Hn,{style:{width:e.column.getSize(),minWidth:e.column.getSize(),maxWidth:e.column.getSize(),transition:"none",overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2 last:border-r-0","align-top",l&&"border-gray-300 print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id);let h=!0,p=1;if(n>0){const g=o.map(x=>x.alias||x.name),b=s[n-1].original;if(!b.isSubtotal&&!b.isGrandTotal){let x=!0;for(let y=0;y<=t;y++)if(r[g[y]]!==b[g[y]]){x=!1;break}x&&(h=!1)}}if(!h)return null;const m=o.map(g=>g.alias||g.name);for(let g=n+1;g<s.length;g++){const b=s[g].original;if(b.isSubtotal||b.isGrandTotal)break;let x=!0;for(let y=0;y<=t;y++)if(r[m[y]]!==b[m[y]]){x=!1;break}if(x)p++;else break}return c.jsx(Hn,{rowSpan:p,style:{width:e.column.getSize(),minWidth:e.column.getSize(),maxWidth:e.column.getSize(),transition:"none",overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2 last:border-r-0","align-top",l&&"border-gray-300 print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id)}return c.jsx(Hn,{style:{width:e.column.getSize(),minWidth:e.column.getSize(),maxWidth:e.column.getSize(),transition:"none",overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2 last:border-r-0",f==="right"?"text-right":f==="center"?"text-center":"text-left",l&&"border-gray-300 print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id)}function rF({grandTotalRow:e,groupByColumns:t,pivotSchema:n,columnSettings:r,card:s,isTablePrintDisplayMode:o}){var d,f;if(!e)return null;const i=e.aggregate||"SUM",a=(f=(d=s==null?void 0:s.config)==null?void 0:d.rowAggregates)==null?void 0:f.find(h=>h.groupLevel==="ALL"),l=a==null?void 0:a.label,u=aU(i,l);return o?c.jsxs(xs,{className:K("border-t-2 border-gray-300 bg-gray-100 font-semibold","print:break-inside-avoid print:border-gray-400 print:bg-gray-200"),children:[c.jsx(Hn,{colSpan:t.length,className:K("border-r px-4 py-3 font-semibold","border-gray-300 text-foreground print:border-gray-400"),children:u}),n.filter(h=>h.isMetricColumn).map(h=>{const p=h.alias,m=e[p],g=r[p],b=hg(m,p,g);return c.jsx(Hn,{className:K("border-r px-4 py-3 font-semibold last:border-r-0","text-right","border-gray-300 text-foreground print:border-gray-400"),children:b},p)})]}):c.jsx("tfoot",{className:"sticky bottom-0 bg-muted",children:c.jsxs(xs,{className:"border-t-2",children:[c.jsx(Hn,{colSpan:t.length,className:"border-r px-4 py-3 font-semibold",children:u}),n.filter(h=>h.isMetricColumn).map(h=>{const p=h.alias,m=e[p],g=r[p],b=hg(m,p,g);return c.jsx(Hn,{className:K("border-r px-4 py-3 font-semibold last:border-r-0","text-right"),children:b},p)})]})})}function y1({card:e,data:t,groupByColumns:n=[],pivotSchema:r=[],paginationMetadata:s,onPaginationChange:o,onAggregationChange:i,isLoading:a}){const l=te(A=>A.themeStyle),{displayPreferences:u,shouldShowElement:d}=fc(),f=u.mode==="table-print",{columnSettings:h,columnSettingsOpen:p,activeColumnId:m,tempColumnSettings:g,isVisualEditing:b,openColumnSettings:x,applyColumnSettings:y,resetColumnSettings:v,resetAllColumnSettings:w,setColumnSettingsOpen:S,setTempColumnSettings:N}=ZNe(e,t),{columnSizing:j,onColumnSizingChange:_}=mR({card:e}),E=C.useMemo(()=>ZD(t,n),[t,n]),D=C.useMemo(()=>KD(t),[t]),R=C.useMemo(()=>sje({groupByColumns:n,pivotSchema:r,columnSettings:h,card:e,isVisualEditing:b,isTablePrintDisplayMode:f,onOpenColumnSettings:x,onAggregationChange:i}),[n,r,h,e,b,f,x,i]),[{pageIndex:T,pageSize:O},M]=C.useState({pageIndex:0,pageSize:f?Number.MAX_SAFE_INTEGER:50}),P=f?Number.MAX_SAFE_INTEGER:O,F=!!s&&!f,H=fR({data:E,columns:R,getCoreRowModel:uR(),getPaginationRowModel:!F&&!f?dR():void 0,manualPagination:F||f,pageCount:F?s.pageCount:void 0,enableColumnResizing:!0,columnResizeMode:"onChange",onColumnSizingChange:_,state:{pagination:F?{pageIndex:(s.page||1)-1,pageSize:s.pageSize||50}:{pageIndex:T,pageSize:O},columnSizing:j},onPaginationChange:F?void 0:M}),{setRowSelection:V,paginationMode:L}=XU({data:E,card:e,pageSize:P,paginationMetadata:s,onPaginationChange:o});return!t||t.length===0?c.jsx("div",{className:"flex h-full w-full items-center justify-center",children:c.jsx(ed,{size:"md",color:"muted","aria-label":"Loading data"})}):c.jsxs("div",{className:"flex h-full w-full flex-col gap-4",children:[c.jsxs(jd,{style:{borderRadius:l==null?void 0:l.cardBorderRadius},className:K("relative h-full rounded-none border",f&&"overflow-visible"),onMouseDown:A=>A.stopPropagation(),children:[a&&L==="server"&&c.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/50",children:c.jsx(ed,{size:"md",color:"muted","aria-label":"Loading data"})}),c.jsx("div",{className:K("relative",f&&"border border-gray-300 print:border-gray-400"),children:c.jsxs("table",{className:K("w-full text-sm",f&&"print:break-inside-avoid"),onMouseDown:A=>A.stopPropagation(),"data-table-type":"aggregate","data-group-by-count":n.length,"data-has-grand-total":!!D,children:[c.jsx(x1,{className:K(!f&&"sticky top-0 z-10 bg-muted",f&&"bg-gray-50 text-foreground print:table-header-group print:bg-gray-100"),children:H.getHeaderGroups().map(A=>c.jsx(xs,{children:A.headers.map(B=>c.jsx(wo,{colSpan:B.colSpan,style:{width:B.getSize(),minWidth:B.getSize(),maxWidth:B.getSize(),position:"relative",transition:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},className:K("h-9 border-r px-4 py-2 last:border-r-0",f&&"border-gray-300 font-semibold text-foreground print:border-gray-400"),children:B.isPlaceholder?null:c.jsxs(c.Fragment,{children:[$s(B.column.columnDef.header,B.getContext()),c.jsx(Zc,{header:B,isResizing:B.column.getIsResizing()})]})},B.id))},A.id))}),c.jsx(aje,{table:H,columns:R,groupByColumns:n,columnSettings:h,isTablePrintDisplayMode:f}),f&&c.jsx(rF,{grandTotalRow:D,groupByColumns:n,pivotSchema:r,columnSettings:h,card:e,isTablePrintDisplayMode:f}),!f&&D&&c.jsx(rF,{grandTotalRow:D,groupByColumns:n,pivotSchema:r,columnSettings:h,card:e,isTablePrintDisplayMode:f})]})}),!f&&c.jsx(tl,{orientation:"horizontal"})]}),!f&&d("showPagination")&&(L==="server"||H.getFilteredRowModel().rows.length>10)&&c.jsx(hR,{totalColumns:R.length,pageCount:L==="server"&&s?s.pageCount||0:H.getPageCount(),pageIndex:H.getState().pagination.pageIndex,pageSize:H.getState().pagination.pageSize,rowCount:L==="server"&&s?s.totalCount||0:H.getFilteredRowModel().rows.length,selectedRowCount:H.getFilteredSelectedRowModel().rows.length,setPageIndex:H.setPageIndex,setPageSize:H.setPageSize,canPreviousPage:L==="server"&&s?s.hasPrevPage??!1:H.getCanPreviousPage(),canNextPage:L==="server"&&s?s.hasNextPage??!1:H.getCanNextPage(),previousPage:H.previousPage,nextPage:H.nextPage,onClearSelection:()=>V({}),paginationMode:L}),d("showColumnSettings")&&c.jsx(pR,{column:m?H.getColumn(m)??null:null,settings:g,onSettingsChange:N,onApply:y,onReset:v,onResetAll:w,open:p,onOpenChange:S})]})}const uje=e=>{const t=window.getSelection();if(!t||t.rangeCount===0)return 0;const n=t.getRangeAt(0),r=n.cloneRange();return r.selectNodeContents(e),r.setEnd(n.endContainer,n.endOffset),r.toString().length},dje=(e,t)=>{var i,a;const n=window.getSelection(),r=document.createRange();let s=0;const o=l=>{var u;if(l.nodeType===Node.TEXT_NODE){const d=((u=l.textContent)==null?void 0:u.length)||0;if(s+d>=t)return r.setStart(l,t-s),r.setEnd(l,t-s),!0;s+=d}else for(let d=0;d<l.childNodes.length;d++)if(o(l.childNodes[d]))return!0;return!1};if(!o(e)&&e.childNodes.length>0){const l=e.childNodes[e.childNodes.length-1];l.nodeType===Node.TEXT_NODE&&(r.setStart(l,((i=l.textContent)==null?void 0:i.length)||0),r.setEnd(l,((a=l.textContent)==null?void 0:a.length)||0))}n==null||n.removeAllRanges(),n==null||n.addRange(r)};function sF({value:e,onSave:t,placeholder:n="Click to add content...",className:r,disabled:s=!1,isDynamicText:o=!1}){const i=C.useRef(null),[a,l]=C.useState(!1),[u,d]=C.useState(!1),f=C.useRef(),h=C.useRef(e),[p,m]=C.useState(e),g=C.useRef(!1),x=te(_=>_.isDashboardEditing)&&!s&&!o;C.useEffect(()=>{!g.current&&i.current&&(i.current.innerHTML=e||"",g.current=!0)},[e]),C.useEffect(()=>{!a&&e!==p&&(m(e),i.current&&g.current&&(i.current.innerHTML=e||""),h.current=e)},[e,a,p]);const y=C.useCallback(()=>{if(!i.current||!x)return;d(!0);const _=i.current.innerHTML;m(_),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{var D;const E=((D=i.current)==null?void 0:D.innerHTML)||"";if(E!==h.current){const R=i.current?uje(i.current):0;t(E),h.current=E,m(E),d(!1),setTimeout(()=>{i.current&&a&&(i.current.focus(),dje(i.current,R))},0)}},500)},[x,t,a]),v=C.useCallback(_=>{_.preventDefault();const E=_.clipboardData.getData("text/plain"),D=_.clipboardData.getData("text/html");let R="";if(D&&!E){const P=document.createElement("div");P.innerHTML=D,P.querySelectorAll("script, style").forEach(F=>F.remove()),P.querySelectorAll("p, div, br").forEach(F=>{if(F.tagName==="BR")F.replaceWith(`
863
+ `}}),c.jsxs("div",{className:"semaphor-pagination-container",children:[c.jsxs("div",{className:"semaphor-pagination-info hidden flex-1 items-center gap-2 text-sm text-muted-foreground",children:[s>0&&c.jsxs(c.Fragment,{children:[s," of ",x," row(s) selected"," "]}),s===0&&c.jsxs(c.Fragment,{children:[x," rows"]}),s>0&&c.jsx(se,{variant:"outline",size:"sm",style:{borderRadius:p},onClick:f,className:"h-8 text-foreground",children:"Clear"})]}),c.jsxs("div",{className:"semaphor-pagination-pagesize hidden items-center gap-2",children:[c.jsx(le,{htmlFor:"rows-per-page",className:"semaphor-pagination-pagesize-label text-sm font-normal text-muted-foreground",children:"Rows per page"}),c.jsxs(it,{value:`${n}`,onValueChange:b,children:[c.jsx(nt,{style:{borderRadius:p},className:`h-8 w-16 ${Ur}`,id:"rows-per-page",children:c.jsx(ut,{placeholder:n})}),c.jsx(rt,{side:"top",children:[10,20,50,100,500,1e3].map(y=>c.jsx(pe,{value:`${y}`,children:y},y))})]})]}),c.jsxs("div",{className:"semaphor-pagination-page-info flex w-fit items-center justify-center text-sm font-normal text-muted-foreground",children:["Page ",t+1," of ",e]}),c.jsxs("div",{className:"semaphor-pagination-nav-container ml-auto flex items-center gap-2 md:ml-0",children:[c.jsxs(se,{style:{borderRadius:p},variant:"outline",className:"semaphor-pagination-nav-extended hidden h-8 w-8 p-0",onClick:()=>o(0),disabled:!a,children:[c.jsx("span",{className:"sr-only",children:"Go to first page"}),c.jsx(one,{className:"h-4 w-4"})]}),c.jsxs(se,{style:{borderRadius:p},variant:"outline",className:"h-8 w-8 p-0",onClick:u,disabled:!a,children:[c.jsx("span",{className:"sr-only",children:"Go to previous page"}),c.jsx(aL,{className:"h-4 w-4"})]}),c.jsxs(se,{style:{borderRadius:p},variant:"outline",className:"h-8 w-8 p-0",onClick:d,disabled:!l,children:[c.jsx("span",{className:"sr-only",children:"Go to next page"}),c.jsx(Za,{className:"h-4 w-4"})]}),c.jsxs(se,{style:{borderRadius:p},variant:"outline",className:"semaphor-pagination-nav-extended hidden h-8 w-8 p-0",onClick:()=>o(e-1),disabled:!l,children:[c.jsx("span",{className:"sr-only",children:"Go to last page"}),c.jsx(ine,{className:"h-4 w-4"})]})]})]})]})}function HC({color:e,onChange:t,className:n}){return c.jsxs("div",{className:`flex items-center gap-2 ${n}`,children:[c.jsxs(Th,{children:[c.jsx(Mh,{asChild:!0,children:c.jsx(se,{variant:"outline",className:"h-8 w-8 p-0",style:{backgroundColor:e},children:c.jsx("span",{className:"sr-only",children:"Pick a color"})})}),c.jsxs(bd,{align:"start",children:[c.jsx("div",{className:"grid grid-cols-5 gap-1 p-1",children:lCe.map(r=>c.jsx(se,{variant:"outline",className:"h-6 w-6 border p-0",style:{backgroundColor:r},onClick:()=>t(r),children:c.jsx("span",{className:"sr-only",children:r})},r))}),c.jsx(Hu,{}),c.jsxs("div",{className:"p-2",children:[c.jsx(le,{htmlFor:"custom-color",className:"mb-1 block text-xs",children:"Custom color"}),c.jsx(Vn,{id:"custom-color",type:"text",value:e,onChange:r=>t(r.target.value),className:"h-8",placeholder:"#RRGGBB"})]})]})]}),c.jsx(Vn,{type:"text",value:e,onChange:r=>t(r.target.value),className:"h-8 flex-1"})]})}const KU=[{label:"Date Only",formats:[{label:"MM/DD/YYYY",value:"MM/dd/yyyy"},{label:"DD/MM/YYYY",value:"dd/MM/yyyy"},{label:"YYYY-MM-DD",value:"yyyy-MM-dd"},{label:"Month DD, YYYY",value:"LLLL dd, yyyy"},{label:"DD Month YYYY",value:"dd LLLL yyyy"},{label:"MM-DD-YYYY",value:"MM-dd-yyyy"},{label:"YYYY/MM/DD",value:"yyyy/MM/dd"},{label:"DD.MM.YYYY",value:"dd.MM.yyyy"},{label:"DD Month YY",value:"dd LLL yy"}]},{label:"Date & Time",formats:[{label:"MM/DD/YYYY HH:mm",value:"MM/dd/yyyy HH:mm"},{label:"DD/MM/YYYY HH:mm",value:"dd/MM/yyyy HH:mm"},{label:"YYYY-MM-DD HH:mm:ss",value:"yyyy-MM-dd HH:mm:ss"},{label:"Month DD, YYYY at HH:mm",value:"LLLL dd, yyyy 'at' HH:mm"},{label:"DD Month YYYY HH:mm",value:"dd LLLL yyyy HH:mm"},{label:"MM/DD/YYYY h:mm a",value:"MM/dd/yyyy h:mm a"},{label:"Month DD, YYYY h:mm a",value:"LLLL dd, yyyy h:mm a"}]},{label:"Date & Time with Timezone",formats:[{label:"MM/DD/YYYY HH:mm z",value:"MM/dd/yyyy HH:mm zzz"},{label:"YYYY-MM-DD HH:mm:ss z",value:"yyyy-MM-dd HH:mm:ss zzz"},{label:"Month DD, YYYY at HH:mm z",value:"LLLL dd, yyyy 'at' HH:mm zzz"},{label:"MM/DD/YYYY h:mm a z",value:"MM/dd/yyyy h:mm a zzz"}]},{label:"ISO Standards",formats:[{label:"ISO 8601",value:"yyyy-MM-dd'T'HH:mm:ss"},{label:"ISO 8601 with TZ",value:"yyyy-MM-dd'T'HH:mm:ssXXX"}]}];[...KU.flatMap(e=>e.formats)];const eF=[{label:"Auto (Use dashboard/browser timezone)",value:"auto"},{label:"UTC",value:"UTC"},{label:"Eastern Time (US)",value:"America/New_York"},{label:"Central Time (US)",value:"America/Chicago"},{label:"Mountain Time (US)",value:"America/Denver"},{label:"Pacific Time (US)",value:"America/Los_Angeles"},{label:"São Paulo",value:"America/Sao_Paulo"},{label:"Buenos Aires",value:"America/Argentina/Buenos_Aires"},{label:"London",value:"Europe/London"},{label:"Paris/Berlin",value:"Europe/Paris"},{label:"Moscow",value:"Europe/Moscow"},{label:"Dubai",value:"Asia/Dubai"},{label:"Mumbai",value:"Asia/Kolkata"},{label:"Singapore",value:"Asia/Singapore"},{label:"Hong Kong",value:"Asia/Hong_Kong"},{label:"Shanghai/Beijing",value:"Asia/Shanghai"},{label:"Tokyo",value:"Asia/Tokyo"},{label:"Seoul",value:"Asia/Seoul"},{label:"Sydney",value:"Australia/Sydney"},{label:"Auckland",value:"Pacific/Auckland"}],$Ne=[{value:"absolute",label:"Absolute"},{value:"relative",label:"Relative"}];function pR({column:e,settings:t,onSettingsChange:n,onApply:r,onReset:s,onResetAll:o,open:i,onOpenChange:a}){var b;const[l,u]=C.useState(qO()),{tokenProps:d}=Ke(),f=(b=d==null?void 0:d.params)==null?void 0:b.timeZone,h=Intl.DateTimeFormat().resolvedOptions().timeZone,p=()=>t.dateFormat.timezone&&t.dateFormat.timezone!=="auto"?t.dateFormat.timezone:f||h,m=()=>{n({...t,colorRanges:[...t.colorRanges,{...l}]}),u(qO())},g=x=>{const y=[...t.colorRanges];y.splice(x,1),n({...t,colorRanges:y})};return c.jsx(rs,{open:i,onOpenChange:a,children:c.jsxs(Lr,{className:"max-w-2xl",children:[c.jsxs(zr,{children:[c.jsx(Br,{children:"Display Settings"}),c.jsxs(Cs,{children:["Display settings for '",e==null?void 0:e.id,"'"]})]}),t.type==="number"||t.type==="date"?c.jsxs(Ns,{defaultValue:"general",children:[c.jsxs(ss,{className:`grid ${t.type==="number"?"grid-cols-3":t.type==="date"?"grid-cols-2":"grid-cols-1"}`,children:[c.jsx(Qt,{value:"general",children:"General"}),t.type==="number"&&c.jsx(Qt,{value:"number",children:"Number Format"}),t.type==="date"&&c.jsx(Qt,{value:"date",children:"Date Format"}),t.type==="number"&&c.jsx(Qt,{value:"color-ranges",children:"Color Ranges"})]}),c.jsx(Wn,{value:"general",className:"mt-4",children:c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"column-type",className:"text-right",children:"Type"}),c.jsxs(it,{value:t.type,onValueChange:x=>n({...t,type:x}),children:[c.jsx(nt,{id:"column-type",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select type"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"none",children:"None"}),c.jsx(pe,{value:"text",children:"Text"}),c.jsx(pe,{value:"number",children:"Number"}),c.jsx(pe,{value:"date",children:"Date"}),c.jsx(pe,{value:"badge",children:"Badge"}),c.jsx(pe,{value:"link",children:"Link"}),c.jsx(pe,{value:"progress",children:"Progress"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"text-align",className:"text-right",children:"Text Align"}),c.jsxs(it,{value:t.textAlign,onValueChange:x=>n({...t,textAlign:x}),children:[c.jsx(nt,{id:"text-align",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select alignment"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"left",children:"Left"}),c.jsx(pe,{value:"center",children:"Center"}),c.jsx(pe,{value:"right",children:"Right"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"text-wrap",className:"text-right",children:"Text Wrap"}),c.jsxs(it,{value:t.textWrap,onValueChange:x=>n({...t,textWrap:x}),children:[c.jsx(nt,{id:"text-wrap",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select text wrapping"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"nowrap",children:"No Wrap (Ellipsis)"}),c.jsx(pe,{value:"wrap",children:"Wrap Text"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"column-width",className:"text-right",children:"Width (px)"}),c.jsx(Vn,{id:"column-width",type:"number",value:t.width,onChange:x=>n({...t,width:parseInt(x.target.value)||150}),className:`col-span-3 ${bf}`,placeholder:"150"})]})]})}),t.type==="date"&&c.jsx(Wn,{value:"date",className:"mt-4",children:c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"date-format-type",className:"text-right",children:"Format Type"}),c.jsxs(it,{value:t.dateFormat.useRelativeTime?"relative":"absolute",onValueChange:x=>{n({...t,dateFormat:{...t.dateFormat,useRelativeTime:x==="relative"}})},children:[c.jsx(nt,{id:"date-format-type",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select format type"})}),c.jsx(rt,{children:$Ne.map(x=>c.jsx(pe,{value:x.value,children:x.label},x.value))})]})]}),!t.dateFormat.useRelativeTime&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"date-format",className:"text-right",children:"Date Format"}),c.jsxs(it,{value:t.dateFormat.useCustomFormat?"custom":t.dateFormat.format,onValueChange:x=>{n(x==="custom"?{...t,dateFormat:{...t.dateFormat,useCustomFormat:!0}}:{...t,dateFormat:{...t.dateFormat,format:x,useCustomFormat:!1}})},children:[c.jsx(nt,{id:"date-format",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select date format"})}),c.jsxs(rt,{children:[KU.map(x=>c.jsxs(ZV,{children:[c.jsx(xD,{className:"bg-muted",children:x.label}),x.formats.map(y=>c.jsx(pe,{value:y.value,children:y.label},y.value))]},x.label)),c.jsx(pe,{value:"custom",children:"Custom"})]})]})]}),t.dateFormat.useCustomFormat&&c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"custom-format",className:"text-right",children:"Custom Format"}),c.jsxs("div",{className:"col-span-3 space-y-2",children:[c.jsx(Vn,{className:`${bf}`,id:"custom-format",value:t.dateFormat.customFormat,onChange:x=>n({...t,dateFormat:{...t.dateFormat,customFormat:x.target.value}}),placeholder:"yyyy-MM-dd'T'HH:mm:ss"}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[c.jsx("p",{children:"Format tokens:"}),c.jsxs("ul",{className:"mt-1 grid grid-cols-2 gap-1",children:[c.jsx("li",{children:"yyyy: Full year (2023)"}),c.jsx("li",{children:"yy: Short year (23)"}),c.jsx("li",{children:"MMMM: Full month (January)"}),c.jsx("li",{children:"MMM: Short month (Jan)"}),c.jsx("li",{children:"MM: Month number with leading zero (01-12)"}),c.jsx("li",{children:"M: Month number (1-12)"}),c.jsx("li",{children:"dd: Day with leading zero (01-31)"}),c.jsx("li",{children:"d: Day (1-31)"}),c.jsx("li",{children:"HH: Hour with leading zero (00-23)"}),c.jsx("li",{children:"H: Hour (0-23)"}),c.jsx("li",{children:"mm: Minute with leading zero (00-59)"}),c.jsx("li",{children:"m: Minute (0-59)"}),c.jsx("li",{children:"ss: Second with leading zero (00-59)"}),c.jsx("li",{children:"s: Second (0-59)"})]})]})]})]})]}),t.dateFormat.useRelativeTime&&c.jsx("div",{className:"grid grid-cols-4 items-center gap-4",children:c.jsx("div",{className:"col-span-4",children:c.jsxs("div",{className:"rounded-md bg-muted p-3",children:[c.jsx("h4",{className:"mb-2 text-sm font-medium",children:"Relative Time Format"}),c.jsx("p",{className:"mb-2 text-sm text-muted-foreground",children:'Displays dates as relative time, like "just now" or "5 minutes ago".'}),c.jsxs("div",{className:"space-y-1 text-sm",children:[c.jsx("p",{children:"⏱ Time ranges:"}),c.jsxs("ul",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:[c.jsx("li",{children:"< 1 minute: just now"}),c.jsx("li",{children:"< 1 hour: x minutes ago"}),c.jsx("li",{children:"< 24 hours: x hours ago"}),c.jsx("li",{children:"< 7 days: x days ago"}),c.jsx("li",{children:"< 30 days: x weeks ago"}),c.jsx("li",{children:"< 1 year: x months ago"}),c.jsx("li",{children:"≥ 1 year: x years ago"})]})]})]})})}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"timezone",className:"text-right",children:"Display Timezone"}),c.jsxs(it,{value:t.dateFormat.timezone||"auto",onValueChange:x=>{n({...t,dateFormat:{...t.dateFormat,timezone:x}})},children:[c.jsx(nt,{id:"timezone",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select timezone"})}),c.jsx(rt,{children:eF.map(x=>c.jsx(pe,{value:x.value,children:x.value==="auto"?`Auto (${f?`Dashboard: ${f}`:`Browser: ${h}`})`:x.label},x.value))})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"source-timezone",className:"text-right",children:"Source Timezone"}),c.jsxs(it,{value:t.dateFormat.sourceTimezone||"auto",onValueChange:x=>{n({...t,dateFormat:{...t.dateFormat,sourceTimezone:x}})},children:[c.jsx(nt,{id:"source-timezone",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select source timezone"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"auto",children:"Auto (UTC if not specified)"}),c.jsx(pe,{value:"UTC",children:"Always UTC"}),c.jsx(pe,{value:"local",children:"Browser Local Time"}),eF.slice(2).map(x=>c.jsx(pe,{value:x.value,children:x.label},x.value))]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[c.jsx("div",{className:"col-span-1"}),c.jsx("div",{className:"col-span-3",children:c.jsx("p",{className:"text-xs text-muted-foreground",children:'How to interpret dates without timezone information. "Auto" uses explicit timezone if present, otherwise assumes UTC.'})})]}),c.jsx("div",{className:"mt-4 grid grid-cols-4 items-center gap-4",children:c.jsx("div",{className:"col-span-4",children:c.jsxs("div",{className:"rounded-md bg-muted p-3",children:[c.jsx("h4",{className:"mb-2 text-sm font-medium",children:"Preview"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:"Sample:"}),c.jsx("span",{className:"text-sm font-medium",children:t.dateFormat.useRelativeTime?h1("2023-05-15T14:30:45Z"):Eb("2023-05-15T14:30:45Z",t.dateFormat.useCustomFormat?t.dateFormat.customFormat:t.dateFormat.format,p(),t.dateFormat.sourceTimezone||"auto")})]}),c.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Timezone: ",p()]})]})})})]})}),t.type==="number"&&c.jsx(Wn,{value:"number",className:"mt-4",children:c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"number-style",className:"text-right",children:"Number Style"}),c.jsxs(it,{value:t.numberFormat.style,onValueChange:x=>n({...t,numberFormat:{...t.numberFormat,style:x}}),children:[c.jsx(nt,{id:"number-style",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select number style"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"decimal",children:"Decimal"}),c.jsx(pe,{value:"currency",children:"Currency"}),c.jsx(pe,{value:"percent",children:"Percentage"})]})]})]}),t.numberFormat.style==="currency"&&c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"currency",className:"text-right",children:"Currency"}),c.jsxs(it,{value:t.numberFormat.currency,onValueChange:x=>n({...t,numberFormat:{...t.numberFormat,currency:x}}),children:[c.jsx(nt,{id:"currency",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select currency"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"USD",children:"USD ($)"}),c.jsx(pe,{value:"EUR",children:"EUR (€)"}),c.jsx(pe,{value:"GBP",children:"GBP (£)"}),c.jsx(pe,{value:"JPY",children:"JPY (¥)"}),c.jsx(pe,{value:"CAD",children:"CAD (C$)"}),c.jsx(pe,{value:"AUD",children:"AUD (A$)"}),c.jsx(pe,{value:"CNY",children:"CNY (¥)"}),c.jsx(pe,{value:"INR",children:"INR (₹)"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"locale",className:"text-right",children:"Locale"}),c.jsxs(it,{value:t.numberFormat.locale,onValueChange:x=>n({...t,numberFormat:{...t.numberFormat,locale:x}}),children:[c.jsx(nt,{id:"locale",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select locale"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"en-US",children:"English (US)"}),c.jsx(pe,{value:"en-GB",children:"English (UK)"}),c.jsx(pe,{value:"fr-FR",children:"French"}),c.jsx(pe,{value:"de-DE",children:"German"}),c.jsx(pe,{value:"es-ES",children:"Spanish"}),c.jsx(pe,{value:"ja-JP",children:"Japanese"}),c.jsx(pe,{value:"zh-CN",children:"Chinese (Simplified)"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"decimal-places",className:"text-right",children:"Decimal Places"}),c.jsx("div",{className:"col-span-3",children:c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("div",{className:"flex-1",children:[c.jsx(le,{htmlFor:"min-decimals",className:"mb-1 block text-xs",children:"Minimum"}),c.jsxs(it,{value:t.numberFormat.minimumFractionDigits.toString(),onValueChange:x=>n({...t,numberFormat:{...t.numberFormat,minimumFractionDigits:Number.parseInt(x)}}),children:[c.jsx(nt,{id:"min-decimals",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{})}),c.jsx(rt,{children:[0,1,2,3,4].map(x=>c.jsx(pe,{value:x.toString(),children:x},x))})]})]}),c.jsxs("div",{className:"flex-1",children:[c.jsx(le,{htmlFor:"max-decimals",className:"mb-1 block text-xs",children:"Maximum"}),c.jsxs(it,{value:t.numberFormat.maximumFractionDigits.toString(),onValueChange:x=>n({...t,numberFormat:{...t.numberFormat,maximumFractionDigits:Number.parseInt(x)}}),children:[c.jsx(nt,{className:Ur,id:"max-decimals",children:c.jsx(ut,{})}),c.jsx(rt,{children:[0,1,2,3,4,5,6].map(x=>c.jsx(pe,{value:x.toString(),children:x},x))})]})]})]})})]}),c.jsx(ho,{className:"my-2"}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("h4",{className:"text-sm font-medium",children:"Data Bar Visualization"}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"show-databar",className:"text-right",children:"Show as Data Bar"}),c.jsxs("div",{className:"col-span-3 flex items-center",children:[c.jsx(on,{id:"show-databar",checked:t.numberFormat.showDataBar,onCheckedChange:x=>n({...t,numberFormat:{...t.numberFormat,showDataBar:!!x}})}),c.jsx(le,{htmlFor:"show-databar",className:"ml-2",children:"Display value with a data bar"})]})]}),t.numberFormat.showDataBar&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"databar-color",className:"text-right",children:"Bar Color"}),c.jsx("div",{className:"col-span-3",children:c.jsx(HC,{color:t.numberFormat.dataBarColor,onChange:x=>n({...t,numberFormat:{...t.numberFormat,dataBarColor:x}})})})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"min-value",className:"text-right",children:"Min Value"}),c.jsx(Vn,{id:"min-value",type:"number",value:t.numberFormat.dataBarMinValue!==void 0?t.numberFormat.dataBarMinValue:"",onChange:x=>n({...t,numberFormat:{...t.numberFormat,dataBarMinValue:x.target.value===""?void 0:Number(x.target.value)}}),className:"col-span-3",placeholder:"Auto (use minimum value in data)"})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"max-value",className:"text-right",children:"Max Value"}),c.jsx(Vn,{id:"max-value",type:"number",value:t.numberFormat.dataBarMaxValue!==void 0?t.numberFormat.dataBarMaxValue:"",onChange:x=>n({...t,numberFormat:{...t.numberFormat,dataBarMaxValue:x.target.value===""?void 0:Number(x.target.value)}}),className:"col-span-3",placeholder:"Auto (use maximum value in data)"})]})]})]})]})}),t.type==="number"&&c.jsx(Wn,{value:"color-ranges",className:"mt-4",children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"text-sm font-medium",children:"Color Ranges"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"Highlight cells or rows based on value ranges"})]}),t.colorRanges.length>0?c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"grid grid-cols-12 gap-2 px-2 text-xs font-medium text-muted-foreground",children:[c.jsx("div",{className:"col-span-2",children:"Min Value"}),c.jsx("div",{className:"col-span-2",children:"Max Value"}),c.jsx("div",{className:"col-span-3",children:"Color"}),c.jsx("div",{className:"col-span-4",children:"Apply To"}),c.jsx("div",{className:"col-span-1"})]}),c.jsx(ho,{}),t.colorRanges.map((x,y)=>c.jsxs("div",{className:"grid grid-cols-12 items-center gap-2",children:[c.jsx("div",{className:"col-span-2",children:c.jsx(Vn,{type:"number",value:x.min,onChange:v=>{const w=[...t.colorRanges];w[y].min=Number(v.target.value),n({...t,colorRanges:w})},className:"h-8"})}),c.jsx("div",{className:"col-span-2",children:c.jsx(Vn,{type:"number",value:x.max,onChange:v=>{const w=[...t.colorRanges];w[y].max=Number(v.target.value),n({...t,colorRanges:w})},className:"h-8"})}),c.jsx("div",{className:"col-span-3",children:c.jsx(HC,{color:x.color,onChange:v=>{const w=[...t.colorRanges];w[y].color=v,n({...t,colorRanges:w})}})}),c.jsx("div",{className:"col-span-4 flex items-center",children:c.jsxs(na,{value:x.applyTo,onValueChange:v=>{const w=[...t.colorRanges];w[y].applyTo=v,n({...t,colorRanges:w})},className:"flex gap-4",children:[c.jsxs("div",{className:"flex items-center space-x-1",children:[c.jsx(yr,{value:"cell",id:`cell-${y}`}),c.jsx(le,{htmlFor:`cell-${y}`,className:"text-xs",children:"Cell only"})]}),c.jsxs("div",{className:"flex items-center space-x-1",children:[c.jsx(yr,{value:"row",id:`row-${y}`}),c.jsx(le,{htmlFor:`row-${y}`,className:"text-xs",children:"Entire row"})]})]})}),c.jsx("div",{className:"col-span-1",children:c.jsx(se,{variant:"ghost",size:"icon",onClick:()=>g(y),className:"h-8 w-8",children:c.jsx(fd,{className:"h-4 w-4"})})})]},y))]}):c.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"No color ranges defined yet. Add one below."}),c.jsxs("div",{className:"mt-4 border-t pt-4",children:[c.jsx("h4",{className:"mb-2 text-sm font-medium",children:"Add New Color Range"}),c.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[c.jsxs("div",{className:"col-span-2",children:[c.jsx(le,{htmlFor:"new-min",className:"mb-1 block text-xs",children:"Min Value"}),c.jsx(Vn,{id:"new-min",type:"number",value:l.min,onChange:x=>u({...l,min:Number(x.target.value)}),className:"h-8"})]}),c.jsxs("div",{className:"col-span-2",children:[c.jsx(le,{htmlFor:"new-max",className:"mb-1 block text-xs",children:"Max Value"}),c.jsx(Vn,{id:"new-max",type:"number",value:l.max,onChange:x=>u({...l,max:Number(x.target.value)}),className:"h-8"})]}),c.jsxs("div",{className:"col-span-3",children:[c.jsx(le,{htmlFor:"new-color",className:"mb-1 block text-xs",children:"Color"}),c.jsx(HC,{color:l.color,onChange:x=>u({...l,color:x})})]}),c.jsxs("div",{className:"col-span-4",children:[c.jsx(le,{className:"mb-3 block text-xs",children:"Apply To"}),c.jsxs(na,{value:l.applyTo,onValueChange:x=>u({...l,applyTo:x}),className:"flex gap-4",children:[c.jsxs("div",{className:"flex items-center space-x-1",children:[c.jsx(yr,{value:"cell",id:"new-cell"}),c.jsx(le,{htmlFor:"new-cell",className:"text-xs",children:"Cell only"})]}),c.jsxs("div",{className:"flex items-center space-x-1",children:[c.jsx(yr,{value:"row",id:"new-row"}),c.jsx(le,{htmlFor:"new-row",className:"text-xs",children:"Entire row"})]})]})]}),c.jsxs("div",{className:"col-span-1",children:[c.jsx(le,{className:"mb-1 block text-xs opacity-0",children:"Spacer"}),c.jsx(se,{variant:"outline",size:"sm",onClick:m,className:"h-8 w-full p-0 sm:px-2",children:c.jsx(Sr,{className:"h-4 w-4"})})]})]})]})]})})]}):c.jsx("div",{className:"mt-4",children:c.jsxs("div",{className:"grid gap-4",children:[c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"column-type",className:"text-right",children:"Type"}),c.jsxs(it,{value:t.type,onValueChange:x=>n({...t,type:x}),children:[c.jsx(nt,{id:"column-type",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select type"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"none",children:"None"}),c.jsx(pe,{value:"text",children:"Text"}),c.jsx(pe,{value:"number",children:"Number"}),c.jsx(pe,{value:"date",children:"Date"}),c.jsx(pe,{value:"badge",children:"Badge"}),c.jsx(pe,{value:"link",children:"Link"}),c.jsx(pe,{value:"progress",children:"Progress"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"text-align",className:"text-right",children:"Align"}),c.jsxs(it,{value:t.textAlign,onValueChange:x=>n({...t,textAlign:x}),children:[c.jsx(nt,{id:"text-align",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select alignment"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"left",children:"Left"}),c.jsx(pe,{value:"center",children:"Center"}),c.jsx(pe,{value:"right",children:"Right"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"text-wrap",className:"text-right",children:"Wrap"}),c.jsxs(it,{value:t.textWrap,onValueChange:x=>n({...t,textWrap:x}),children:[c.jsx(nt,{id:"text-wrap",className:`col-span-3 ${Ur}`,children:c.jsx(ut,{placeholder:"Select text wrapping"})}),c.jsxs(rt,{children:[c.jsx(pe,{value:"nowrap",children:"No Wrap (Ellipsis)"}),c.jsx(pe,{value:"wrap",children:"Wrap Text"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[c.jsx(le,{htmlFor:"column-width",className:"text-right",children:"Width (px)"}),c.jsx(Vn,{id:"column-width",type:"number",value:t.width,onChange:x=>n({...t,width:parseInt(x.target.value)||150}),className:`col-span-3 ${bf}`,placeholder:"150"})]})]})}),c.jsxs(Ss,{className:"flex justify-between",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx(se,{variant:"outline",onClick:o,children:"Reset All Column Settings"}),c.jsx(se,{variant:"outline",onClick:s,children:"Reset"})]}),c.jsx(se,{onClick:r,children:"Apply"})]})]})})}function Zc({header:e,isResizing:t=!1}){const{column:n}=e;return n.getCanResize()?c.jsx("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),onDoubleClick:()=>n.resetSize(),className:K("absolute right-0 top-0 h-full w-0.5 cursor-col-resize select-none touch-none","hover:bg-primary/50 hover:w-1","group",t&&"bg-primary w-1"),style:{userSelect:"none",touchAction:"none"},title:"Drag to resize column. Double-click to auto-fit.",children:c.jsx("div",{className:K("absolute inset-y-0 -left-1 -right-1 z-10")})}):null}function LNe(e){var n,r;const t={};return(n=e==null?void 0:e.metricColumns)==null||n.forEach(s=>{const o=s.alias??s.name??s.label;t[o]={dataType:s.dataType,isMetric:!0}}),(r=e==null?void 0:e.groupByColumns)==null||r.forEach(s=>{const o=s.alias??s.name??s.label;t[o]={dataType:s.dataType,isMetric:!1}}),t}function zNe(e,t,n){var a,l,u;if((a=n==null?void 0:n[e])!=null&&a.metricId)return"number";if((l=n==null?void 0:n[e])!=null&&l.dataType){const d=oa(n[e].dataType);return d==="number"?"number":d==="date"?"date":"text"}const r=Math.min(10,t.length);let s=0,o=0,i=0;for(let d=0;d<t.length&&s<r;d++){const f=(u=t[d])==null?void 0:u[e];f!=null&&f!==""&&(s++,typeof f=="number"&&!isNaN(f)?o++:typeof f=="string"&&BNe(f)&&i++)}return o>s*.7?"number":i>s*.7?"date":"text"}function BNe(e){if(![/^\d{4}-\d{2}-\d{2}/,/^\d{2}\/\d{2}\/\d{4}/,/^\d{4}\/\d{2}\/\d{2}/,/^\d{2}-\d{2}-\d{4}/].some(s=>s.test(e)))return!1;const r=Date.parse(e);return!isNaN(r)}function fg(e,t,n,r){const s=Ao(),i={...r?LNe(r):{},...n};switch(zNe(e,t,i)){case"number":return{...s,type:"number",textAlign:"right",numberFormat:{...s.numberFormat,style:"decimal",minimumFractionDigits:0,maximumFractionDigits:2}};case"date":return{...s,type:"date",textAlign:"left",dateFormat:{...s.dateFormat,format:"MMM dd, yyyy"}};default:return{...s,type:"text",textAlign:"left"}}}function VNe({data:e,sorting:t,columnSettings:n,selectColumnVisible:r=!0,onOpenColumnSettings:s,isVisualEditing:o,contextTimezone:i,browserTimezone:a=Intl.DateTimeFormat().resolvedOptions().timeZone,card:l}){if(e.length===0)return[];const u={id:"select",header:({table:h})=>c.jsx("div",{className:"flex items-center justify-start pl-3",children:c.jsx(on,{checked:h.getIsAllPageRowsSelected()||h.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:p=>h.toggleAllPageRowsSelected(!!p),"aria-label":"Select all rows"})}),cell:({row:h})=>c.jsx("div",{className:"flex items-center justify-start pl-3",onClick:p=>p.stopPropagation(),children:c.jsx(on,{checked:h.getIsSelected(),onCheckedChange:p=>h.toggleSelected(!!p),"aria-label":"Select row"})}),size:32,minSize:32,maxSize:32,enableSorting:!1,enableHiding:!1,enableResizing:!1},{keys:d}=fr(e),f=d==null?void 0:d.map(h=>{const p=n[h],m=p!=null&&p.width&&typeof p.width=="number"?p.width:150,g=(p==null?void 0:p.minWidth)??50,b=(p==null?void 0:p.maxWidth)??500;return{accessorKey:h,enableGlobalFilter:!0,size:m,minSize:g,maxSize:b,enableResizing:!0,header:({column:x})=>{const y=t.findIndex(O=>O.id===x.id),w=y!==-1?t[y].desc?"desc":"asc":null,S=n[x.id]||fg(h,e,void 0,l==null?void 0:l.config),N=S.textAlign||"left",j=N==="right",_=N==="center",E=S,D=(E==null?void 0:E.type)==="date";let R,T=!1;return D&&(E!=null&&E.dateFormat)&&(E.dateFormat.timezone&&E.dateFormat.timezone!=="auto"?R=E.dateFormat.timezone:R=i||a,T=R!==a),j?c.jsxs("div",{className:"group/table-head relative flex w-full select-none items-center justify-end",style:{overflow:"hidden"},children:[c.jsxs("div",{className:K("flex items-center justify-end cursor-pointer transition-all duration-200",o&&"group-hover/table-head:mr-7"),onClick:O=>{O.preventDefault();const M=O.shiftKey;x.toggleSorting(x.getIsSorted()==="asc",M)},children:[c.jsxs("span",{className:"break-words text-right min-w-0",children:[h.charAt(0).toUpperCase()+h.slice(1),T&&c.jsxs("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["(",ff(R),")"]})]}),w&&c.jsx("div",{className:"ml-2 flex items-center",children:w==="asc"?c.jsxs(c.Fragment,{children:[c.jsx(rm,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ls,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]})})]}),o&&c.jsxs(se,{variant:"ghost",size:"icon",className:"absolute right-0 h-6 w-6 hidden group-hover/table-head:flex",onClick:O=>{O.stopPropagation(),s(x.id)},children:[c.jsx(bu,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Column settings"})]})]}):_?c.jsxs("div",{className:"group/table-head flex select-none items-center justify-between",style:{overflow:"hidden"},children:[c.jsxs("div",{className:"flex w-full items-center justify-center",onClick:O=>{O.preventDefault();const M=O.shiftKey;x.toggleSorting(x.getIsSorted()==="asc",M)},children:[c.jsxs("span",{className:"break-words min-w-0",children:[h.charAt(0).toUpperCase()+h.slice(1),T&&c.jsxs("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["(",ff(R),")"]})]}),c.jsx("div",{className:"ml-2 flex cursor-pointer",children:w==="asc"?c.jsxs("div",{className:"flex items-center",children:[c.jsx(rm,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]}):w==="desc"?c.jsxs("div",{className:"flex items-center",children:[c.jsx(Ls,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]}):null})]}),o&&c.jsxs(se,{variant:"ghost",size:"icon",className:"absolute right-1 h-6 w-6 opacity-0 transition-opacity group-hover/table-head:opacity-100",onClick:O=>{O.stopPropagation(),s(x.id)},children:[c.jsx(bu,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Column settings"})]})]}):c.jsxs("div",{className:"group/table-head flex select-none items-center justify-between",style:{overflow:"hidden"},children:[c.jsxs("div",{className:"flex items-center",onClick:O=>{O.preventDefault();const M=O.shiftKey;x.toggleSorting(x.getIsSorted()==="asc",M)},children:[c.jsxs("span",{className:"break-words min-w-0",children:[h.charAt(0).toUpperCase()+h.slice(1),T&&c.jsxs("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["(",ff(R),")"]})]}),c.jsx("div",{className:"ml-2 flex cursor-pointer",children:w==="asc"?c.jsxs("div",{className:"flex items-center",children:[c.jsx(rm,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]}):w==="desc"?c.jsxs("div",{className:"flex items-center",children:[c.jsx(Ls,{className:"h-4 w-4"}),y>0&&c.jsx("span",{className:"ml-1 text-xs font-medium",children:y+1})]}):null})]}),o&&c.jsxs(se,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 transition-opacity group-hover/table-head:opacity-100",onClick:O=>{O.stopPropagation(),s(x.id)},children:[c.jsx(bu,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Column settings"})]})]})},cell:({row:x,column:y})=>{const v=x.getValue(h),w=n[y.id]||fg(h,e,void 0,l==null?void 0:l.config);if(v==null){const E=w.textAlign==="center"?"justify-center":w.textAlign==="right"?"justify-end":"justify-start";return c.jsx("div",{className:`flex items-center ${E}`,children:c.jsx(qc,{className:"h-4 w-4 text-muted-foreground/50"})})}const S=w.textAlign==="center"?"text-center":w.textAlign==="right"?"text-right":"text-left",N=w.textWrap==="wrap"?"whitespace-normal break-words":"truncate",j={width:"100%",display:"block"};if(w.type==="number"&&typeof v=="number"&&w.colorRanges.length>0){const E=w.colorRanges.find(D=>v>=D.min&&v<=D.max);E&&(E.applyTo==="cell"&&(j.backgroundColor=E.color,j.color=tR(E.color),j.padding="0.25rem 0.5rem",j.borderRadius="0.25rem"),E.applyTo==="row"&&(x.columnFilters[y.id]=!0,x.rowColor=E.color))}let _;if(w.type==="badge"||w.type==="none"&&typeof v=="string"&&["department","role"].includes(h))_=c.jsx(Ae,{variant:"outline",className:"px-1.5 text-muted-foreground",children:String(v)});else if(w.type==="number"&&typeof v=="number"){let E;try{E=new Intl.NumberFormat(w.numberFormat.locale,{style:w.numberFormat.style,currency:w.numberFormat.style==="currency"?w.numberFormat.currency:void 0,minimumFractionDigits:w.numberFormat.minimumFractionDigits,maximumFractionDigits:w.numberFormat.maximumFractionDigits}).format(v)}catch{E=v.toLocaleString()}if(w.numberFormat.showDataBar){const D=e.map(P=>{const F=P[h];return typeof F=="number"?F:null}).filter(P=>P!==null),R=w.numberFormat.dataBarMinValue!==void 0?w.numberFormat.dataBarMinValue:Math.min(...D),O=(w.numberFormat.dataBarMaxValue!==void 0?w.numberFormat.dataBarMaxValue:Math.max(...D))-R,M=O<=0?0:Math.min(Math.max(0,(v-R)/O*100),100);_=c.jsxs("div",{className:"relative flex h-5 w-full items-center",children:[c.jsx("div",{className:"absolute inset-0 flex items-center",children:c.jsx("div",{className:"h-4 rounded-sm",style:{width:`${M}%`,backgroundColor:w.numberFormat.dataBarColor,opacity:.7}})}),c.jsx("div",{className:"relative px-1.5 text-sm",children:E})]})}else _=E}else if(w.type==="date"&&v)try{if(w.dateFormat.useRelativeTime)_=h1(String(v));else{let E;w.dateFormat.timezone==="auto"||!w.dateFormat.timezone?E=i||a:E=w.dateFormat.timezone;const D=w.dateFormat.useCustomFormat?w.dateFormat.customFormat:w.dateFormat.format,R=Eb(String(v),D,E,w.dateFormat.sourceTimezone||"auto");_=c.jsx("span",{title:`${av(E||a)} (${ff(E||a)})`,children:R})}}catch{_=String(v)}else if(w.type==="link"&&v){let E=String(v);!E.startsWith("http://")&&!E.startsWith("https://")&&(E="https://"+E),_=c.jsx("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",onClick:D=>D.stopPropagation(),children:String(v)})}else if(w.type==="progress"&&typeof v=="number"){const E=Math.min(Math.max(0,v),100);let D="#ef4444";E>=70?D="#22c55e":E>=40&&(D="#eab308"),_=c.jsxs("div",{className:"flex w-full items-center gap-2",children:[c.jsx("div",{className:"h-2.5 flex-1 overflow-hidden rounded-full bg-muted",children:c.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${E}%`,backgroundColor:D}})}),c.jsxs("span",{className:"whitespace-nowrap text-xs font-medium",children:[E,"%"]})]})}else _=String(v);return c.jsx("div",{className:`${S} ${N}`,style:j,children:_})}}});return r?[u,...f]:f}function XU(e){var $t,Se,Dt,wn;const{data:t,pageSize:n,columnSettings:r,columnVisibility:s,initialColumnVisibility:o,defaultSelectColumnVisible:i,onSelectColumnVisibleChange:a,onInitializeColumnVisibility:l,onUpdateAllColumnVisibility:u,onColumnSettingsChange:d,onColumnVisibilityChange:f,onSortChange:h,sortState:p,columnSizing:m,onColumnSizingChange:g,card:b,paginationMetadata:x,onPaginationChange:y}=e,{displayPreferences:v}=fc(),[w,S]=C.useState([]),[N,j]=C.useState([]),[_,E]=C.useState(""),[D,R]=C.useState({}),T=v.mode==="table-print",O=b?jU(b,v.mode):T?"disabled":"client",M=O==="disabled"?Number.MAX_SAFE_INTEGER:n||50,[P,F]=C.useState({pageIndex:x&&O==="server"?x.page-1:0,pageSize:M});C.useEffect(()=>{b&&b.type==="table"&&b.config&&!b.paginationConfig&&y&&y(0,M)},[b==null?void 0:b.id]);const[H,V]=C.useState(!1),[L,A]=C.useState(null),[B,z]=C.useState({}),I=r||B,[W,q]=C.useState(Ao()),[Y,U]=C.useState(i||!1);C.useEffect(()=>{a||U(i??!1)},[i,a]);const $=a?i!==void 0?i:!1:Y,[G,Z]=C.useState(o||{}),ee=s||G,X=C.useRef(null),ne=C.useRef(!1),ie=te(he=>he.themeStyle);te(he=>he.isDashboardEditing);const fe=te(he=>he.isVisualEditing),{tokenProps:ce}=Ke(),je=($t=ce==null?void 0:ce.params)==null?void 0:$t.timeZone,ve=Intl.DateTimeFormat().resolvedOptions().timeZone,Oe=VNe({data:t,sorting:w,columnSettings:I,selectColumnVisible:$,isVisualEditing:fe,onOpenColumnSettings:he=>{A(he);let we=I[he];we||(we=t&&t.length>0?fg(he,t,void 0,b==null?void 0:b.config):Ao()),q(we),V(!0)},contextTimezone:je,browserTimezone:ve,card:b}),qe=he=>{const we=typeof he=="function"?he(w):he;S(we),h==null||h(we)},be=he=>{const we=typeof he=="function"?he(P):he;F(we),O==="server"&&y&&y(we.pageIndex,we.pageSize)},ae=fR({data:t,columns:Oe,getCoreRowModel:uR(),onSortingChange:qe,getSortedRowModel:TNe(),onColumnFiltersChange:j,getFilteredRowModel:RNe(),getPaginationRowModel:O==="client"?dR():void 0,onRowSelectionChange:R,onPaginationChange:O==="disabled"?void 0:be,manualPagination:O==="server"||O==="disabled",pageCount:O==="server"&&x?x.pageCount:void 0,onColumnVisibilityChange:he=>{if(ne.current)return;let we={};if(typeof he=="function"){const Fe=ae.getState().columnVisibility;try{we=he(Fe)}catch(De){console.error("Failed to resolve visibility function:",De);return}}else we=he;if(u)u(we);else if(f){const Fe=ae.getState().columnVisibility;Object.entries(we).forEach(([De,Ye])=>{Fe[De]!==Ye&&f(De,Ye)})}else Z(we)},state:{sorting:w,columnFilters:N,globalFilter:_,rowSelection:D,pagination:P,columnVisibility:ee,columnSizing:m||{}},enableColumnResizing:!0,columnResizeMode:"onChange",onColumnSizingChange:g,enableMultiSort:!0,enableRowSelection:!0}),ye=(Se=ae==null?void 0:ae.getAllColumns())==null?void 0:Se.length,Be=(wn=(Dt=ae==null?void 0:ae.getCoreRowModel())==null?void 0:Dt.rows)==null?void 0:wn.length;X.current=ae,C.useEffect(()=>{p&&S(p)},[p]),C.useEffect(()=>{O==="server"&&x&&F(he=>({...he,pageIndex:x.page-1}))},[x,O]),C.useEffect(()=>{if(f&&l){const we=ae.getAllColumns().filter(De=>De.id!=="select").map(De=>De.id).filter(De=>typeof De=="string");(!s||Object.keys(s).length===0)&&l(we)}},[]);const Re=(he,we)=>{ne.current=!0;try{f?f(he,we):(console.log("Updating internal state",he,we),Z(De=>({...De,[he]:we})));const Fe=ae.getColumn(he);Fe&&Fe.toggleVisibility(we)}finally{ne.current=!1}},re=()=>{if(L){const he={...I,[L]:{...W}};d?d(he):z(he),V(!1)}},de=()=>{L&&(q(Ao()),ae.getRowModel().rows.forEach(he=>{he.columnFilters[L]&&delete he.columnFilters[L]}))},Te=()=>{d?d({}):z({}),q(Ao()),ae.getRowModel().rows.forEach(he=>{he.columnFilters={}}),V(!1)},Le=he=>{a?a(he):U(he)},Me=he=>{for(const we of he.getVisibleCells()){const Fe=we.column.id;if(he.columnFilters[Fe]&&he.columnFilters[Fe].color)return{backgroundColor:he.columnFilters[Fe].color,color:tR(he.columnFilters[Fe].color)}}return{}},at=Object.keys(D).length,Rt={rows:ae.getFilteredRowModel().rows.map(he=>{const we={};return ae.getAllColumns().filter(Fe=>Fe.id!=="select"&&Fe.getIsVisible()).forEach(Fe=>{const De=Fe.id;we[De]=he.getValue(De)}),we}),selectedRows:ae.getFilteredSelectedRowModel().rows.map(he=>{const we={};return ae.getAllColumns().filter(Fe=>Fe.id!=="select"&&Fe.getIsVisible()).forEach(Fe=>{const De=Fe.id;we[De]=he.getValue(De)}),we}),visibleColumns:ae.getAllColumns().filter(he=>he.id!=="select"&&he.getIsVisible()).map(he=>he.id),columnSettings:I,contextTimezone:je,browserTimezone:ve},pt=C.useRef(fe);return C.useEffect(()=>{!fe&&pt.current&&(Z(o||{}),O!=="server"&&O!=="disabled"&&F({pageIndex:0,pageSize:M})),pt.current=fe},[o,fe,O,M]),C.useEffect(()=>{if(s&&Object.keys(s).length>0){if(ne.current)return;ne.current=!0;try{const he=X.current;if(!he)return;he.getAllColumns().forEach(we=>{if(we.id!=="select"&&we.getCanHide()&&typeof we.id=="string"){const Fe=s[we.id]!==void 0?s[we.id]:!0;we.getIsVisible()!==Fe&&we.toggleVisibility(Fe)}})}finally{ne.current=!1}}},[s]),{table:ae,columnSettingsToUse:I,selectColumnVisible:$,columnVisibilityToUse:ee,handleColumnVisibilityChange:Re,applyColumnSettings:re,resetColumnSettings:de,resetAllColumnSettings:Te,handleSelectColumnVisibleChange:Le,selectedRowsCount:at,exportData:Rt,globalFilter:_,setGlobalFilter:E,setRowSelection:R,columnSettingsOpen:H,activeColumnId:L,tempColumnSettings:W,isHandlingVisibilityChange:ne,themeStyle:ie,tableRef:X,internalColumnSettings:B,internalSelectColumnVisible:Y,getRowStyle:Me,setTempColumnSettings:q,setColumnSettingsOpen:V,columns:Oe,internalColumnVisibility:G,totalColumns:ye,totalRows:Be,onSortChange:h,paginationMode:O,paginationMetadata:x,contextTimezone:je,browserTimezone:ve}}function ed({size:e="md",color:t="muted",className:n=""}){const r={xs:"w-0.5 h-0.5",sm:"w-1 h-1",md:"w-2 h-2",lg:"w-3 h-3"},s={muted:"bg-muted-foreground/70",primary:"bg-primary",secondary:"bg-secondary-foreground",accent:"bg-accent-foreground",destructive:"bg-destructive",gray:"bg-gray-400 dark:bg-gray-500",blue:"bg-blue-500 dark:bg-blue-400",green:"bg-green-500 dark:bg-green-400",red:"bg-red-500 dark:bg-red-400"},o=K(r[e],s[t],"rounded-full animate-pulse");return c.jsxs("div",{className:K("flex items-center gap-1",n),children:[c.jsx("div",{className:o,style:{animationDelay:"0ms",animationDuration:"1.4s"}}),c.jsx("div",{className:o,style:{animationDelay:"200ms",animationDuration:"1.4s"}}),c.jsx("div",{className:o,style:{animationDelay:"400ms",animationDuration:"1.4s"}})]})}function mR({card:e}){var p,m;const t=te(g=>g.isVisualEditing),{updateCurrentDashboardCard:n}=Jt(),r=$e(g=>{var b;return(b=g.actions)==null?void 0:b.updateColumnSizing}),s=C.useMemo(()=>{var g,b;return((b=(g=e==null?void 0:e.preferences)==null?void 0:g.tablePrefs)==null?void 0:b.columnSizing)||{}},[(m=(p=e==null?void 0:e.preferences)==null?void 0:p.tablePrefs)==null?void 0:m.columnSizing]),[o,i]=C.useState(s),a=C.useRef(!1),l=C.useRef({}),u=C.useRef(null),d=C.useCallback((g,b)=>{const x=Object.keys(g),y=Object.keys(b);if(x.length!==y.length)return!1;for(const v of x)if(g[v]!==b[v])return!1;return!0},[]);C.useEffect(()=>{!a.current&&s&&(d(s,o)||i(s))},[s,d,o]);const f=C.useCallback(g=>{var v;const b=g||{},y=Object.keys(b).length>0?b:l.current;!y||Object.keys(y).length===0||(t&&r?r(y):n({...e,preferences:{...e.preferences,tablePrefs:{...(v=e.preferences)==null?void 0:v.tablePrefs,columnSizing:y}}}))},[t,r,n,e]),h=C.useCallback(g=>{const b=typeof g=="function"?g(o):g;a.current=!0,i(b),b&&Object.keys(b).length>0&&(l.current={...b}),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{f(b),u.current=null},250)},[o,f]);return C.useEffect(()=>{const g=()=>{a.current&&(a.current=!1,u.current&&(clearTimeout(u.current),u.current=null),f(o))};return window.addEventListener("mouseup",g),window.addEventListener("touchend",g),()=>{window.removeEventListener("mouseup",g),window.removeEventListener("touchend",g)}},[o,f]),C.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]),{columnSizing:o,onColumnSizingChange:h}}const HNe=w9,UNe=S9,WNe=C9,qNe=bce,QU=k.forwardRef(({className:e,sideOffset:t=4,...n},r)=>c.jsx(Tw,{ref:r,sideOffset:t,className:K("z-50 overflow-hidden rounded-md bg-foreground px-3 py-1.5 text-sm text-background shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));QU.displayName=Tw.displayName;function tF({resolvedCardConfig:e,card:t,row:n}){const{groupByColumns:r=[],metricColumns:s=[]}=e||t.config,o=[];for(const a of r){const l=n.getValue(a.label);l!=null&&o.push({field:a,operator:"=",value:String(l)})}if(o.length===0)return;const i=[];for(const a of s){const l=n.getValue(a.label);l!=null&&i.push({field:a,value:Number(l)})}return{conditions:o,metrics:i.length>0?i:void 0}}function nF(e){return e.mode==="clickFilter"}function YNe(e,t){if(!t||t.type==="metric")return e;if(t.type==="attribute"){const n=e.find(r=>r.field.id===t.field.id);return n?[n]:[]}return e}function GNe(e){var I;const{card:t,isLoading:n,frameId:r,sheetId:s,onMultipleInteractions:o}=e,{columnSizing:i,onColumnSizingChange:a}=mR({card:t}),l=te(W=>W.themeStyle),{displayPreferences:u,shouldShowElement:d}=fc(),f=u.mode==="table-print",h=C.useMemo(()=>ti(t.interactionConfig),[t.interactionConfig]),p=C.useMemo(()=>h.filter(nF),[h]),m=p.length>0,{table:g,columnSettingsToUse:b,getRowStyle:x,activeColumnId:y,tempColumnSettings:v,applyColumnSettings:w,resetColumnSettings:S,resetAllColumnSettings:N,columnSettingsOpen:j,setTempColumnSettings:_,columns:E,setColumnSettingsOpen:D,totalColumns:R,totalRows:T,paginationMode:O,paginationMetadata:M,contextTimezone:P,browserTimezone:F}=XU({...e,columnSizing:i,onColumnSizingChange:a,defaultSelectColumnVisible:m&&!f}),H=fk(t),{handlePointerInteraction:V}=r$(t,r||"",s||"",o),L=C.useMemo(()=>h.some(W=>W.trigger!==void 0&&W.mode!=="clickFilter"),[h]),A=Ut(W=>W.interactionStates[t.id]);C.useEffect(()=>{const W=(A==null?void 0:A.appliedClickFilters)||[],q=g.getFilteredSelectedRowModel().rows.length;W.length===0&&q>0&&g.resetRowSelection()},[A==null?void 0:A.appliedClickFilters,g]);const B=C.useRef("");C.useEffect(()=>{if(!m||!r||!s)return;const W=g.getState().rowSelection,q=JSON.stringify(W);if(q===B.current)return;B.current=q;const U=g.getFilteredSelectedRowModel().rows.map($=>{var ie;const G=tF({resolvedCardConfig:H,card:t,row:$});if(!G)return null;const ee=Qv(h,{conditions:G.conditions,metrics:G.metrics}).find(nF)??p[0];if(!ee)return null;const X=YNe(G.conditions,ee.trigger);return{interactionMode:"clickFilter",sourceCardId:t.id,filterGroups:[{filters:X}],metric:(ie=G.metrics)==null?void 0:ie[0],applyToCardIds:ee.applyToCardIds,excludeCardIds:ee.excludeCardIds}}).filter($=>!!$);Ut.getState().setInteractionState(t.id,{...A??Ro(),appliedClickFilters:U})});const z=(W,q)=>{if(W.stopPropagation(),!L||!r||!s)return;const Y=tF({resolvedCardConfig:H,card:t,row:q});Y&&V({context:Y,gesture:"leftClick",modifierKeys:{shift:W.shiftKey,ctrl:W.ctrlKey,meta:W.metaKey},position:{x:W.clientX,y:W.clientY}})};return c.jsx(HNe,{children:c.jsxs("div",{onMouseDown:W=>W.stopPropagation(),className:"flex w-full flex-col gap-4",children:[c.jsxs(jd,{style:{borderRadius:l==null?void 0:l.cardBorderRadius},className:K("relative h-full rounded-none border",f&&"border-gray-300 print:border-gray-400"),children:[n&&O==="server"&&c.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/50",children:c.jsx(ed,{size:"md",color:"muted","aria-label":"Loading data"})}),c.jsxs("table",{className:K("w-full text-sm",f&&"print:break-inside-avoid"),"data-table-type":"data","data-total-rows":T,"data-total-columns":R,children:[c.jsx(x1,{className:K(!f&&"sticky top-0 z-10 bg-muted",f&&"bg-gray-50 text-foreground print:table-header-group print:bg-gray-100"),children:g.getHeaderGroups().map(W=>c.jsx(xs,{children:W.headers.map(q=>c.jsx(wo,{colSpan:q.colSpan,"data-column-id":q.id,style:{width:q.getSize(),minWidth:q.getSize(),maxWidth:q.getSize(),position:"relative",transition:"none"},className:K("h-10 border-r border-border/30 last:border-r-0",f&&"border-gray-300 text-foreground print:border-gray-400"),children:q.isPlaceholder?null:c.jsxs(c.Fragment,{children:[c.jsxs(UNe,{children:[c.jsx(WNe,{asChild:!0,children:c.jsx("span",{className:"block",children:$s(q.column.columnDef.header,q.getContext())})}),c.jsxs(QU,{side:"top",children:[c.jsx(qNe,{className:"fill-foreground"}),$s(q.column.columnDef.header,q.getContext())]})]}),c.jsx(Zc,{header:q,isResizing:q.column.getIsResizing()})]})},q.id))},W.id))}),c.jsx(dg,{children:(I=g.getRowModel().rows)!=null&&I.length?g.getRowModel().rows.map(W=>{const q=W.getIsSelected(),Y=g.getFilteredSelectedRowModel().rows.length>0;return c.jsx(xs,{onClick:U=>z(U,W),"data-state":q?"selected":void 0,className:K("border-border/50 transition-all duration-150",q?"border-primary/50 bg-primary/10 hover:bg-primary/15":Y?"opacity-40 hover:opacity-60":"hover:bg-muted/30",f&&"border-gray-300 print:break-inside-avoid print:border-gray-400",L&&"cursor-pointer"),style:x(W),children:W.getVisibleCells().map(U=>c.jsx(Hn,{"data-column-id":U.column.id,style:{width:U.column.getSize(),minWidth:U.column.getSize(),maxWidth:U.column.getSize(),transition:"none",overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden py-2 border-r border-border/30 last:border-r-0",f&&"border-gray-300 print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(U.column.columnDef.cell,U.getContext())})},U.id))},W.id)}):c.jsx(xs,{children:c.jsx(Hn,{colSpan:E.length,className:"h-24 text-center",children:n?c.jsx(c.Fragment,{}):"No results."})})})]}),c.jsx(tl,{orientation:"horizontal"})]}),(()=>{if(Object.entries(b).some(([q,Y])=>Y.type!=="date"||!Y.dateFormat?!1:(Y.dateFormat.timezone==="auto"||!Y.dateFormat.timezone?P||F:Y.dateFormat.timezone)!==F)){const q=new Set;Object.entries(b).forEach(([U,$])=>{if($.type==="date"&&$.dateFormat){const G=$.dateFormat.timezone==="auto"||!$.dateFormat.timezone?P||F:$.dateFormat.timezone;G&&G!==F&&q.add(G)}});const Y=Array.from(q).map(U=>`${av(U)} (${ff(U)})`).join(", ");return c.jsx("div",{className:"flex items-center justify-center px-4 py-2 text-xs text-muted-foreground",children:c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Dj,{className:"h-3 w-3"}),"Date/time values displayed in: ",Y]})})}return null})(),!f&&d("showPagination")&&(O==="server"||g.getFilteredRowModel().rows.length>10)&&c.jsx(hR,{totalColumns:R,pageCount:O==="server"&&M?M.pageCount:g.getPageCount(),pageIndex:g.getState().pagination.pageIndex,pageSize:g.getState().pagination.pageSize,rowCount:O==="server"&&M?M.totalCount:g.getFilteredRowModel().rows.length,selectedRowCount:g.getFilteredSelectedRowModel().rows.length,setPageIndex:g.setPageIndex,setPageSize:g.setPageSize,canPreviousPage:O==="server"&&M?M.hasPrevPage:g.getCanPreviousPage(),canNextPage:O==="server"&&M?M.hasNextPage:g.getCanNextPage(),previousPage:g.previousPage,nextPage:g.nextPage,onClearSelection:()=>{g.resetRowSelection(),((A==null?void 0:A.appliedClickFilters)||[]).filter(Y=>Y.sourceCardId===t.id).forEach(Y=>{Ut.getState().toggleClickFilter(t.id,Y)})},paginationMode:O}),d("showColumnSettings")&&c.jsx(pR,{column:y?g.getColumn(y)??null:null,settings:v,onSettingsChange:_,onApply:w,onReset:S,onResetAll:N,open:j,onOpenChange:D})]})})}function kb({data:e,card:t,onSortChange:n,sortState:r,paginationMetadata:s,onPaginationChange:o,isLoading:i,frameId:a,sheetId:l,onMultipleInteractions:u}){var _,E,D,R,T,O,M,P,F,H;const d=te(V=>V.isVisualEditing),f=(E=(_=t==null?void 0:t.preferences)==null?void 0:_.tablePrefs)==null?void 0:E.columnSettingsMap,h=(R=(D=t==null?void 0:t.preferences)==null?void 0:D.tablePrefs)==null?void 0:R.columnVisibility,p=(O=(T=t==null?void 0:t.preferences)==null?void 0:T.tablePrefs)==null?void 0:O.columnSizing,m=(P=(M=t==null?void 0:t.preferences)==null?void 0:M.tablePrefs)==null?void 0:P.selectColumnVisible,g=(H=(F=t==null?void 0:t.preferences)==null?void 0:F.tablePrefs)==null?void 0:H.pageSize,{updateColumnSettingsMap:b,updateColumnVisibility:x,updateColumnSizing:y,showAllColumns:v,hideAllColumns:w,toggleSelectColumn:S}=$e(V=>V.actions),N={card:t,data:e,pageSize:g,columnSettings:f,onColumnSettingsChange:b,columnVisibility:h,onColumnVisibilityChange:x,columnSizing:p,onColumnSizingChange:y,onShowAllColumns:v,onHideAllColumns:w,defaultSelectColumnVisible:m,onSelectColumnVisibleChange:S,exportFileName:"export",paginationMetadata:s,onPaginationChange:o,isLoading:i,frameId:a,sheetId:l,onMultipleInteractions:u},j={card:t,data:e,pageSize:g,columnSettings:f,columnSizing:p,initialColumnVisibility:h,defaultSelectColumnVisible:m,exportFileName:"export",paginationMetadata:s,onPaginationChange:o,isLoading:i,frameId:a,sheetId:l,onMultipleInteractions:u};return c.jsx(GNe,{sortState:r,onSortChange:n,...d?N:j})}function ZNe(e,t){var b,x;const n=te(y=>y.isVisualEditing),{updateCurrentDashboardCard:r}=Jt(),s=$e(y=>{var v;return(v=y.actions)==null?void 0:v.updateColumnSettingsMap}),o=C.useMemo(()=>{var y,v;return((v=(y=e==null?void 0:e.preferences)==null?void 0:y.tablePrefs)==null?void 0:v.columnSettingsMap)||{}},[(x=(b=e==null?void 0:e.preferences)==null?void 0:b.tablePrefs)==null?void 0:x.columnSettingsMap]),[i,a]=C.useState(!1),[l,u]=C.useState(null),[d,f]=C.useState(Ao()),h=C.useCallback(y=>{u(y);let v=o[y];v||(v=t&&t.length>0?fg(y,t):Ao()),f(v),a(!0)},[o,t]),p=C.useCallback(()=>{var y;if(l&&d){const v={...o,[l]:d};if(n&&s)s(v);else if(r){const w={...e,preferences:{...e.preferences,tablePrefs:{...(y=e.preferences)==null?void 0:y.tablePrefs,columnSettingsMap:v}}};r(w)}}a(!1)},[l,d,o,n,s,r,e]),m=C.useCallback(()=>{l&&f(Ao())},[l]),g=C.useCallback(()=>{var y;if(n&&s)s({});else if(r){const v={...e,preferences:{...e.preferences,tablePrefs:{...(y=e.preferences)==null?void 0:y.tablePrefs,columnSettingsMap:{}}}};r(v)}a(!1)},[n,s,r,e]);return{columnSettings:o,columnSettingsOpen:i,activeColumnId:l,tempColumnSettings:d,isVisualEditing:n,openColumnSettings:h,applyColumnSettings:p,resetColumnSettings:m,resetAllColumnSettings:g,setColumnSettingsOpen:a,setTempColumnSettings:f}}function hg(e,t,n){return e==null?c.jsx(qc,{className:"h-4 w-4 text-muted-foreground"}):n?n.type==="badge"?KNe(e):n.type==="link"&&e?XNe(e):n.type==="progress"&&typeof e=="number"?QNe(e):n.type==="number"&&typeof e=="number"?JNe(e,n):n.type==="date"&&e?eje(e):String(e):typeof e=="number"?e.toLocaleString():String(e)}function KNe(e){return c.jsx(Ae,{variant:"outline",className:"px-1.5 text-muted-foreground",children:String(e)})}function XNe(e){let t=String(e);return!t.startsWith("http://")&&!t.startsWith("https://")&&(t="https://"+t),c.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 underline hover:text-blue-700",onClick:n=>n.stopPropagation(),children:String(e)})}function QNe(e){const t=Math.min(Math.max(0,e),100);let n="#ef4444";return t>=70?n="#22c55e":t>=40&&(n="#eab308"),c.jsxs("div",{className:"relative flex h-5 w-full items-center",children:[c.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-gray-200",children:c.jsx("div",{className:"h-full transition-all duration-300",style:{width:`${t}%`,backgroundColor:n}})}),c.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-xs font-medium",children:[t,"%"]})]})}function JNe(e,t){const{numberFormat:n}=t;let r;try{n.style==="percent"?r=new Intl.NumberFormat(n.locale||"en-US",{style:"percent",minimumFractionDigits:n.minimumFractionDigits??0,maximumFractionDigits:n.maximumFractionDigits??2}).format(e/100):n.style==="currency"?r=new Intl.NumberFormat(n.locale||"en-US",{style:"currency",currency:n.currency||"USD",minimumFractionDigits:n.minimumFractionDigits??0,maximumFractionDigits:n.maximumFractionDigits??2}).format(e):r=new Intl.NumberFormat(n.locale||"en-US",{minimumFractionDigits:n.minimumFractionDigits??0,maximumFractionDigits:n.maximumFractionDigits??2}).format(e)}catch(s){console.error("Error formatting number:",s),r=e.toLocaleString()}if(n.showDataBar){const s=n.dataBarMinValue??0,o=n.dataBarMaxValue??100,i=(e-s)/(o-s)*100,a=Math.min(Math.max(0,i),100),l=n.dataBarColor||"#3b82f6";return c.jsxs("div",{className:"relative flex items-center",children:[c.jsx("div",{className:"absolute inset-y-0 left-0 bg-opacity-20",style:{width:`${a}%`,backgroundColor:l}}),c.jsx("span",{className:"relative px-2",children:r})]})}if(t.colorRanges&&t.colorRanges.length>0){for(const s of t.colorRanges)if(e>=s.min&&e<=s.max){const i=tR(s.color);return c.jsx("span",{style:{backgroundColor:s.color,color:i,padding:"2px 6px",borderRadius:"4px"},children:r})}}return r}function eje(e,t){return String(e)}function Yp({columnName:e,groupByFields:t,pivotByFields:n,currentAggregation:r,onAggregationChange:s,onOpenChange:o}){const i=[{value:"SUM",label:"Sum"},{value:"MAX",label:"Max"},{value:"MIN",label:"Min"},{value:"AVG",label:"Avg"},{value:"MEDIAN",label:"Median"}],a=(u,d,f)=>{s({function:u,rowLevel:d,columnLevel:f})},l=(u,d,f)=>{if(!r)return!1;if(d!==void 0&&f===void 0){if(r.rowAggregates){const h=d==="all"?"ALL":d;return r.rowAggregates.some(p=>p.function===u&&p.groupLevel===h)}return!1}if(f!==void 0&&d===void 0){if(r.columnAggregates){const h=f==="all"?"ALL":f;return r.columnAggregates.some(p=>p.function===u&&p.pivotLevel===h)}return!1}return!1};return c.jsxs(Th,{modal:!1,onOpenChange:o,children:[c.jsx(Mh,{asChild:!0,children:c.jsx(se,{variant:"ghost",size:"icon",className:"h-6 w-6 p-0 hover:bg-accent hover:text-accent-foreground",children:c.jsx(iw,{className:"size-3"})})}),c.jsxs(bd,{align:"start",className:"w-56",children:[c.jsx(wf,{className:"text-xs font-normal text-muted-foreground",children:"AGGREGATE"}),i.map(u=>{var p,m;const d=((p=r==null?void 0:r.rowAggregates)==null?void 0:p.some(g=>g.function===u.value))||!1,f=((m=r==null?void 0:r.columnAggregates)==null?void 0:m.some(g=>g.function===u.value))||!1,h=d||f;return c.jsxs(yie,{children:[c.jsx(pz,{className:"text-xs",children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsx("span",{children:u.label}),h&&c.jsxs("div",{className:"ml-2 flex items-center gap-1 text-xs",children:[d&&c.jsx("span",{className:"rounded bg-blue-100 px-1 py-0.5 text-blue-700 dark:bg-blue-900 dark:text-blue-300",children:"R"}),f&&c.jsx("span",{className:"rounded bg-green-100 px-1 py-0.5 text-green-700 dark:bg-green-900 dark:text-green-300",children:"C"})]})]})}),c.jsxs(mz,{className:"w-48",children:[c.jsx(wf,{className:"text-xs font-normal text-muted-foreground",children:"ROWS"}),c.jsx(ri,{className:"text-xs",onClick:()=>a(u.value,"all"),children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsx("span",{children:"of all rows"}),l(u.value,"all")&&c.jsx(Dr,{className:"h-4 w-4"})]})}),t.map(g=>c.jsx(ri,{className:"text-xs",onClick:()=>a(u.value,g.id),children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsxs("span",{children:["within ",g.label||g.name]}),l(u.value,g.id)&&c.jsx(Dr,{className:"h-4 w-4"})]})},g.id)),n.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(Hu,{}),c.jsx(wf,{className:"text-xs font-normal text-muted-foreground",children:"COLUMNS"}),c.jsx(ri,{className:"text-xs",onClick:()=>a(u.value,void 0,"all"),children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsx("span",{children:"of all columns"}),l(u.value,void 0,"all")&&c.jsx(Dr,{className:"h-4 w-4"})]})}),n.map(g=>c.jsx(ri,{className:"text-xs",onClick:()=>a(u.value,void 0,g.id),children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsxs("span",{children:["within ",g.label||g.name]}),l(u.value,void 0,g.id)&&c.jsx(Dr,{className:"h-4 w-4"})]})},g.id))]})]})]},`${u.value}-${u.label}`)})]})]})}function tje({columnId:e,label:t,alignment:n,isVisualEditing:r,isTablePrintDisplayMode:s,groupByColumns:o,card:i,onOpenColumnSettings:a,onAggregationChange:l}){var u,d;return c.jsxs("div",{className:"group/table-head relative flex items-center justify-between",children:[r&&c.jsxs(se,{variant:"ghost",size:"icon",className:"absolute left-0 z-10 h-6 w-6 opacity-0 transition-opacity group-hover/table-head:opacity-100",onClick:f=>{f.stopPropagation(),a(e)},children:[c.jsx(Ch,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Column settings"})]}),c.jsx("span",{className:K("flex-1",n==="right"?"text-right":n==="center"?"text-center":"text-left",r&&"pl-8"),children:t}),l&&!s&&c.jsx("div",{className:"ml-2",children:c.jsx(Yp,{columnName:t,groupByFields:o,pivotByFields:[],currentAggregation:{rowAggregates:((u=i==null?void 0:i.config)==null?void 0:u.rowAggregates)||[],columnAggregates:((d=i==null?void 0:i.config)==null?void 0:d.columnAggregates)||[]},onAggregationChange:l})})]})}function nje({columnId:e,displayLabel:t,isVisualEditing:n,onOpenColumnSettings:r}){return c.jsxs("div",{className:"group/table-head relative flex items-center justify-end",children:[n&&c.jsxs(se,{variant:"ghost",size:"icon",className:"absolute left-0 z-10 h-6 w-6 opacity-0 transition-opacity group-hover/table-head:opacity-100",onClick:s=>{s.stopPropagation(),r(e)},children:[c.jsx(Ch,{className:"h-3 w-3"}),c.jsx("span",{className:"sr-only",children:"Column settings"})]}),c.jsx("span",{className:K("flex-1 text-right",n&&"pl-8"),children:t})]})}function rje({row:e,columnId:t,columnAlias:n,groupByColumns:r,card:s,settings:o,alignment:i,idx:a}){var f,h,p;const l=e;if(l.isGrandTotal)return c.jsx(c.Fragment,{children:a===0?"Grand Total":""});if(l.isSubtotal){if(l.subtotalContext){const g=l.subtotalLevel,b=r.findIndex(x=>x.alias===g);if(a===b){const x=l.aggregate||"SUM",y=(p=(h=(f=s==null?void 0:s.config)==null?void 0:f.rowAggregates)==null?void 0:h.find(v=>v.groupLevel===l.subtotalLevel&&v.function===x))==null?void 0:p.label;return c.jsx(c.Fragment,{children:iU(l,n,x,y)})}else if(a<b){const x=l[n];if(x&&x!=="__TOTAL__"){const y=hg(x,t,o);return c.jsx("div",{className:K(i==="right"?"text-right":i==="center"?"text-center":"text-left"),children:y})}}}return c.jsx(c.Fragment,{})}const u=l[n],d=hg(u,t,o);return c.jsx("div",{className:K(i==="right"?"text-right":i==="center"?"text-center":"text-left",u==null?"flex items-center":"",u==null?i==="right"?"justify-end":i==="center"?"justify-center":"justify-start":""),children:d})}function JU(e,t,n="left"){const r=t[e]||Ao(),s=(r==null?void 0:r.textAlign)||n,o=r!=null&&r.width&&typeof r.width=="number"?r.width:150,i=(r==null?void 0:r.minWidth)??50,a=(r==null?void 0:r.maxWidth)??500;return{settings:r,alignment:s,size:o,minSize:i,maxSize:a}}function sje({groupByColumns:e,pivotSchema:t,columnSettings:n,card:r,isVisualEditing:s,isTablePrintDisplayMode:o,onOpenColumnSettings:i,onAggregationChange:a}){const l=[],u=oje({groupByColumns:e,columnSettings:n,card:r,isVisualEditing:s,isTablePrintDisplayMode:o,onOpenColumnSettings:i,onAggregationChange:a});l.push(...u);const d=ije({pivotSchema:t,columnSettings:n,card:r,isVisualEditing:s,isTablePrintDisplayMode:o,onOpenColumnSettings:i,onAggregationChange:a,groupByColumns:e});return l.push(...d),l}function oje({groupByColumns:e,columnSettings:t,card:n,isVisualEditing:r,isTablePrintDisplayMode:s,onOpenColumnSettings:o,onAggregationChange:i}){return e.map((a,l)=>{const u=a.alias||a.name,{settings:d,alignment:f,size:h,minSize:p,maxSize:m}=JU(u,t,"left");return{id:u,accessorFn:g=>g[u],size:h,minSize:p,maxSize:m,enableResizing:!0,header:()=>c.jsx(tje,{columnId:u,label:a.label||a.name,alignment:f,isVisualEditing:r,isTablePrintDisplayMode:s,groupByColumns:e,card:n,idx:l,onOpenColumnSettings:o,onAggregationChange:i}),cell:({row:g})=>c.jsx(rje,{row:g.original,columnId:u,columnAlias:a.alias||a.name,groupByColumns:e,card:n,settings:d,alignment:f,idx:l})}})}function ije({pivotSchema:e,columnSettings:t,card:n,isVisualEditing:r,isTablePrintDisplayMode:s,onOpenColumnSettings:o,onAggregationChange:i,groupByColumns:a}){return e.filter(l=>l.isMetricColumn).map(l=>{const u=l.alias,{settings:d,size:f,minSize:h,maxSize:p}=JU(u,t,"right"),m="right";return{id:u,accessorFn:g=>g[u],size:f,minSize:h,maxSize:p,enableResizing:!0,header:()=>c.jsx(nje,{columnId:u,metricName:l.metricName,displayLabel:l.displayLabel||l.metricLabel||l.metricName,alignment:m,isVisualEditing:r,isTablePrintDisplayMode:s,groupByColumns:a,card:n,onOpenColumnSettings:o,onAggregationChange:i}),cell:({row:g})=>{const b=g.original[u],x=hg(b,u,d);return c.jsx("div",{className:K("text-right",b==null?"flex items-center justify-end":""),children:x})}}})}function aje({table:e,columns:t,groupByColumns:n,columnSettings:r,isTablePrintDisplayMode:s}){const o=e.getRowModel().rows;return o!=null&&o.length?c.jsx(dg,{children:o.map((i,a)=>{const l=i.original,u=l.isSubtotal&&!l.isGrandTotal;return c.jsx(xs,{"data-row-type":u?"subtotal":"data","data-subtotal-level":u?l.subtotalLevel:void 0,className:K("border-b",u&&!s&&"border-t border-t-border/50 bg-muted/70 font-medium",u&&s&&"print:bg-gray-150 border-t-2 border-gray-300 bg-gray-100 font-semibold text-foreground print:border-gray-400",s&&"border-gray-300 print:break-inside-avoid print:border-gray-400"),children:i.getVisibleCells().map((d,f)=>{const h=f<n.length;return u?c.jsx(lje,{cell:d,cellIndex:f,originalRow:l,groupByColumns:n,columnSettings:r,isGroupByColumn:h,isTablePrintDisplayMode:s},d.id):c.jsx(cje,{cell:d,cellIndex:f,visibleRowIndex:a,originalRow:l,rows:o,groupByColumns:n,columnSettings:r,isGroupByColumn:h,isTablePrintDisplayMode:s},d.id)})},i.id)})}):c.jsx(dg,{children:c.jsx(xs,{children:c.jsx(Hn,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})}function lje({cell:e,cellIndex:t,originalRow:n,groupByColumns:r,columnSettings:s,isGroupByColumn:o,isTablePrintDisplayMode:i}){const a=r.findIndex(l=>l.alias===n.subtotalLevel);if(t===a){const l=r.length-a;return c.jsx(Hn,{colSpan:l,style:{overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2.5 text-sm font-medium",i&&"border-gray-300 font-semibold text-foreground print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id)}else{if(t<a)return c.jsx(Hn,{style:{overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2.5 text-sm font-medium",i&&"border-gray-300 font-semibold text-foreground print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id);if(o&&t>a)return null}if(!o){const l=e.column.id,u=s[l],d=(u==null?void 0:u.textAlign)||"right";return c.jsx(Hn,{style:{overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2.5 font-semibold last:border-r-0",d==="right"?"text-right":d==="center"?"text-center":"text-left",i&&"border-gray-300 text-foreground print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id)}return null}function cje({cell:e,cellIndex:t,visibleRowIndex:n,originalRow:r,rows:s,groupByColumns:o,columnSettings:i,isGroupByColumn:a,isTablePrintDisplayMode:l}){const u=e.column.id,d=i[u],f=(d==null?void 0:d.textAlign)||(a?"left":"right");if(a){if(l)return c.jsx(Hn,{style:{width:e.column.getSize(),minWidth:e.column.getSize(),maxWidth:e.column.getSize(),transition:"none",overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2 last:border-r-0","align-top",l&&"border-gray-300 print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id);let h=!0,p=1;if(n>0){const g=o.map(x=>x.alias||x.name),b=s[n-1].original;if(!b.isSubtotal&&!b.isGrandTotal){let x=!0;for(let y=0;y<=t;y++)if(r[g[y]]!==b[g[y]]){x=!1;break}x&&(h=!1)}}if(!h)return null;const m=o.map(g=>g.alias||g.name);for(let g=n+1;g<s.length;g++){const b=s[g].original;if(b.isSubtotal||b.isGrandTotal)break;let x=!0;for(let y=0;y<=t;y++)if(r[m[y]]!==b[m[y]]){x=!1;break}if(x)p++;else break}return c.jsx(Hn,{rowSpan:p,style:{width:e.column.getSize(),minWidth:e.column.getSize(),maxWidth:e.column.getSize(),transition:"none",overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2 last:border-r-0","align-top",l&&"border-gray-300 print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id)}return c.jsx(Hn,{style:{width:e.column.getSize(),minWidth:e.column.getSize(),maxWidth:e.column.getSize(),transition:"none",overflow:"hidden",textOverflow:"ellipsis"},className:K("overflow-hidden border-r px-4 py-2 last:border-r-0",f==="right"?"text-right":f==="center"?"text-center":"text-left",l&&"border-gray-300 print:border-gray-400"),children:c.jsx("div",{className:"overflow-hidden text-ellipsis",children:$s(e.column.columnDef.cell,e.getContext())})},e.id)}function rF({grandTotalRow:e,groupByColumns:t,pivotSchema:n,columnSettings:r,card:s,isTablePrintDisplayMode:o}){var d,f;if(!e)return null;const i=e.aggregate||"SUM",a=(f=(d=s==null?void 0:s.config)==null?void 0:d.rowAggregates)==null?void 0:f.find(h=>h.groupLevel==="ALL"),l=a==null?void 0:a.label,u=aU(i,l);return o?c.jsxs(xs,{className:K("border-t-2 border-gray-300 bg-gray-100 font-semibold","print:break-inside-avoid print:border-gray-400 print:bg-gray-200"),children:[c.jsx(Hn,{colSpan:t.length,className:K("border-r px-4 py-3 font-semibold","border-gray-300 text-foreground print:border-gray-400"),children:u}),n.filter(h=>h.isMetricColumn).map(h=>{const p=h.alias,m=e[p],g=r[p],b=hg(m,p,g);return c.jsx(Hn,{className:K("border-r px-4 py-3 font-semibold last:border-r-0","text-right","border-gray-300 text-foreground print:border-gray-400"),children:b},p)})]}):c.jsx("tfoot",{className:"sticky bottom-0 bg-muted",children:c.jsxs(xs,{className:"border-t-2",children:[c.jsx(Hn,{colSpan:t.length,className:"border-r px-4 py-3 font-semibold",children:u}),n.filter(h=>h.isMetricColumn).map(h=>{const p=h.alias,m=e[p],g=r[p],b=hg(m,p,g);return c.jsx(Hn,{className:K("border-r px-4 py-3 font-semibold last:border-r-0","text-right"),children:b},p)})]})})}function y1({card:e,data:t,groupByColumns:n=[],pivotSchema:r=[],paginationMetadata:s,onPaginationChange:o,onAggregationChange:i,isLoading:a}){const l=te(A=>A.themeStyle),{displayPreferences:u,shouldShowElement:d}=fc(),f=u.mode==="table-print",{columnSettings:h,columnSettingsOpen:p,activeColumnId:m,tempColumnSettings:g,isVisualEditing:b,openColumnSettings:x,applyColumnSettings:y,resetColumnSettings:v,resetAllColumnSettings:w,setColumnSettingsOpen:S,setTempColumnSettings:N}=ZNe(e,t),{columnSizing:j,onColumnSizingChange:_}=mR({card:e}),E=C.useMemo(()=>ZD(t,n),[t,n]),D=C.useMemo(()=>KD(t),[t]),R=C.useMemo(()=>sje({groupByColumns:n,pivotSchema:r,columnSettings:h,card:e,isVisualEditing:b,isTablePrintDisplayMode:f,onOpenColumnSettings:x,onAggregationChange:i}),[n,r,h,e,b,f,x,i]),[{pageIndex:T,pageSize:O},M]=C.useState({pageIndex:0,pageSize:f?Number.MAX_SAFE_INTEGER:50}),P=f?Number.MAX_SAFE_INTEGER:O,F=!!s&&!f,H=fR({data:E,columns:R,getCoreRowModel:uR(),getPaginationRowModel:!F&&!f?dR():void 0,manualPagination:F||f,pageCount:F?s.pageCount:void 0,enableColumnResizing:!0,columnResizeMode:"onChange",onColumnSizingChange:_,state:{pagination:F?{pageIndex:(s.page||1)-1,pageSize:s.pageSize||50}:{pageIndex:T,pageSize:O},columnSizing:j},onPaginationChange:F?void 0:M}),{setRowSelection:V,paginationMode:L}=XU({data:E,card:e,pageSize:P,paginationMetadata:s,onPaginationChange:o});return!t||t.length===0?c.jsx("div",{className:"flex h-full w-full items-center justify-center",children:c.jsx(ed,{size:"md",color:"muted","aria-label":"Loading data"})}):c.jsxs("div",{className:"flex h-full w-full flex-col gap-4",children:[c.jsxs(jd,{style:{borderRadius:l==null?void 0:l.cardBorderRadius},className:K("relative h-full rounded-none border",f&&"overflow-visible"),onMouseDown:A=>A.stopPropagation(),children:[a&&L==="server"&&c.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/50",children:c.jsx(ed,{size:"md",color:"muted","aria-label":"Loading data"})}),c.jsx("div",{className:K("relative",f&&"border border-gray-300 print:border-gray-400"),children:c.jsxs("table",{className:K("w-full text-sm",f&&"print:break-inside-avoid"),onMouseDown:A=>A.stopPropagation(),"data-table-type":"aggregate","data-group-by-count":n.length,"data-has-grand-total":!!D,children:[c.jsx(x1,{className:K(!f&&"sticky top-0 z-10 bg-muted",f&&"bg-gray-50 text-foreground print:table-header-group print:bg-gray-100"),children:H.getHeaderGroups().map(A=>c.jsx(xs,{children:A.headers.map(B=>c.jsx(wo,{colSpan:B.colSpan,style:{width:B.getSize(),minWidth:B.getSize(),maxWidth:B.getSize(),position:"relative",transition:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},className:K("h-9 border-r px-4 py-2 last:border-r-0",f&&"border-gray-300 font-semibold text-foreground print:border-gray-400"),children:B.isPlaceholder?null:c.jsxs(c.Fragment,{children:[$s(B.column.columnDef.header,B.getContext()),c.jsx(Zc,{header:B,isResizing:B.column.getIsResizing()})]})},B.id))},A.id))}),c.jsx(aje,{table:H,columns:R,groupByColumns:n,columnSettings:h,isTablePrintDisplayMode:f}),f&&c.jsx(rF,{grandTotalRow:D,groupByColumns:n,pivotSchema:r,columnSettings:h,card:e,isTablePrintDisplayMode:f}),!f&&D&&c.jsx(rF,{grandTotalRow:D,groupByColumns:n,pivotSchema:r,columnSettings:h,card:e,isTablePrintDisplayMode:f})]})}),!f&&c.jsx(tl,{orientation:"horizontal"})]}),!f&&d("showPagination")&&(L==="server"||H.getFilteredRowModel().rows.length>10)&&c.jsx(hR,{totalColumns:R.length,pageCount:L==="server"&&s?s.pageCount||0:H.getPageCount(),pageIndex:H.getState().pagination.pageIndex,pageSize:H.getState().pagination.pageSize,rowCount:L==="server"&&s?s.totalCount||0:H.getFilteredRowModel().rows.length,selectedRowCount:H.getFilteredSelectedRowModel().rows.length,setPageIndex:H.setPageIndex,setPageSize:H.setPageSize,canPreviousPage:L==="server"&&s?s.hasPrevPage??!1:H.getCanPreviousPage(),canNextPage:L==="server"&&s?s.hasNextPage??!1:H.getCanNextPage(),previousPage:H.previousPage,nextPage:H.nextPage,onClearSelection:()=>V({}),paginationMode:L}),d("showColumnSettings")&&c.jsx(pR,{column:m?H.getColumn(m)??null:null,settings:g,onSettingsChange:N,onApply:y,onReset:v,onResetAll:w,open:p,onOpenChange:S})]})}const uje=e=>{const t=window.getSelection();if(!t||t.rangeCount===0)return 0;const n=t.getRangeAt(0),r=n.cloneRange();return r.selectNodeContents(e),r.setEnd(n.endContainer,n.endOffset),r.toString().length},dje=(e,t)=>{var i,a;const n=window.getSelection(),r=document.createRange();let s=0;const o=l=>{var u;if(l.nodeType===Node.TEXT_NODE){const d=((u=l.textContent)==null?void 0:u.length)||0;if(s+d>=t)return r.setStart(l,t-s),r.setEnd(l,t-s),!0;s+=d}else for(let d=0;d<l.childNodes.length;d++)if(o(l.childNodes[d]))return!0;return!1};if(!o(e)&&e.childNodes.length>0){const l=e.childNodes[e.childNodes.length-1];l.nodeType===Node.TEXT_NODE&&(r.setStart(l,((i=l.textContent)==null?void 0:i.length)||0),r.setEnd(l,((a=l.textContent)==null?void 0:a.length)||0))}n==null||n.removeAllRanges(),n==null||n.addRange(r)};function sF({value:e,onSave:t,placeholder:n="Click to add content...",className:r,disabled:s=!1,isDynamicText:o=!1}){const i=C.useRef(null),[a,l]=C.useState(!1),[u,d]=C.useState(!1),f=C.useRef(),h=C.useRef(e),[p,m]=C.useState(e),g=C.useRef(!1),x=te(_=>_.isDashboardEditing)&&!s&&!o;C.useEffect(()=>{!g.current&&i.current&&(i.current.innerHTML=e||"",g.current=!0)},[e]),C.useEffect(()=>{!a&&e!==p&&(m(e),i.current&&g.current&&(i.current.innerHTML=e||""),h.current=e)},[e,a,p]);const y=C.useCallback(()=>{if(!i.current||!x)return;d(!0);const _=i.current.innerHTML;m(_),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{var D;const E=((D=i.current)==null?void 0:D.innerHTML)||"";if(E!==h.current){const R=i.current?uje(i.current):0;t(E),h.current=E,m(E),d(!1),setTimeout(()=>{i.current&&a&&(i.current.focus(),dje(i.current,R))},0)}},500)},[x,t,a]),v=C.useCallback(_=>{_.preventDefault();const E=_.clipboardData.getData("text/plain"),D=_.clipboardData.getData("text/html");let R="";if(D&&!E){const P=document.createElement("div");P.innerHTML=D,P.querySelectorAll("script, style").forEach(F=>F.remove()),P.querySelectorAll("p, div, br").forEach(F=>{if(F.tagName==="BR")F.replaceWith(`
864
864
  `);else{const H=F.textContent||"";H&&F.replaceWith(H+`
865
865
  `)}}),R=P.innerHTML.replace(/\n\n+/g,`
866
866
  `).replace(/^\n+|\n+$/g,"").replace(/\n/g,"<br>")}else R=E.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/\n/g,"<br>");const T=window.getSelection();if(!(T!=null&&T.rangeCount))return;const O=T.getRangeAt(0);O.deleteContents();const M=document.createRange().createContextualFragment(R);O.insertNode(M),O.collapse(!1),T.removeAllRanges(),T.addRange(O),y()},[y]),w=C.useCallback(()=>{x&&l(!0)},[x]),S=C.useCallback(()=>{if(l(!1),f.current&&clearTimeout(f.current),u&&i.current){const _=i.current.innerHTML||"";_!==h.current&&(t(_),h.current=_,d(!1))}},[u,t]),N=C.useCallback(_=>{const E=window.getSelection();if(!E||E.rangeCount===0)return;const D=E.toString();D&&(_.clipboardData.setData("text/plain",D),_.clipboardData.setData("text/html",E.getRangeAt(0).cloneContents().textContent||""),_.preventDefault())},[]),j=C.useCallback(_=>{var E,D;if(x){if(_.key==="Escape"&&((E=i.current)==null||E.blur()),_.key==="Backspace"){const R=window.getSelection();if(!(R!=null&&R.rangeCount))return;const T=R.getRangeAt(0);if(T.collapsed&&T.startContainer.nodeType===Node.TEXT_NODE&&T.startOffset===1&&T.startContainer.textContent==="​"){_.preventDefault();const O=T.startContainer.previousSibling;if(O&&O.nodeName==="BR"){O.remove(),(D=T.startContainer.parentNode)==null||D.removeChild(T.startContainer);const M=document.createRange(),P=i.current;P.lastChild?(M.selectNodeContents(P.lastChild),M.collapse(!1)):(M.selectNodeContents(P),M.collapse(!1)),R.removeAllRanges(),R.addRange(M),y()}}}if(_.key==="Enter"){_.preventDefault();const R=window.getSelection();if(!(R!=null&&R.rangeCount))return;const T=R.getRangeAt(0);T.deleteContents();const O=document.createElement("br");T.insertNode(O),T.setStartAfter(O),T.setEndAfter(O);const M=document.createTextNode("​");T.insertNode(M),T.selectNodeContents(M),R.removeAllRanges(),R.addRange(T),y()}_.key==="Tab"&&(_.preventDefault(),document.execCommand("insertHTML",!1,"&nbsp;&nbsp;&nbsp;&nbsp;"),y())}},[x,y]);return C.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),c.jsx("div",{ref:i,contentEditable:x,suppressContentEditableWarning:!0,onInput:y,onPaste:v,onCopy:N,onFocus:w,onBlur:S,onKeyDown:j,className:K("outline-none transition-all duration-200","min-h-full whitespace-pre-wrap break-words rounded-md leading-relaxed","text-sm text-foreground/80",x?"px-3 py-3":"px-2 py-1",x&&"cursor-text",x&&!a&&"border border-dashed border-muted-foreground/20",x&&!a&&"hover:border-solid hover:border-primary/30 hover:bg-muted/50",a&&"border border-solid border-primary/40 bg-muted/30",!x&&"cursor-default",u&&"border-blue-500/40 bg-blue-50/20",r),"data-placeholder":n})}if(typeof document<"u"&&!document.getElementById("content-editable-text-styles")){const t=document.createElement("style");t.id="content-editable-text-styles",t.textContent=`
@@ -53751,7 +53751,7 @@ function VCe({
53751
53751
  "div",
53752
53752
  {
53753
53753
  className: X(
53754
- "flex items-center cursor-pointer transition-all duration-200",
53754
+ "flex items-center justify-end cursor-pointer transition-all duration-200",
53755
53755
  i && "group-hover/table-head:mr-7"
53756
53756
  ),
53757
53757
  onClick: (F) => {
@@ -53763,7 +53763,7 @@ function VCe({
53763
53763
  );
53764
53764
  },
53765
53765
  children: [
53766
- /* @__PURE__ */ S("span", { className: "truncate", children: [
53766
+ /* @__PURE__ */ S("span", { className: "break-words text-right min-w-0", children: [
53767
53767
  h.charAt(0).toUpperCase() + h.slice(1),
53768
53768
  M && /* @__PURE__ */ S("span", { className: "ml-1 text-xs font-normal text-muted-foreground", children: [
53769
53769
  "(",
@@ -53786,7 +53786,7 @@ function VCe({
53786
53786
  {
53787
53787
  variant: "ghost",
53788
53788
  size: "icon",
53789
- className: "absolute right-0 hidden h-6 w-6 group-hover/table-head:flex",
53789
+ className: "absolute right-0 h-6 w-6 hidden group-hover/table-head:flex",
53790
53790
  onClick: (F) => {
53791
53791
  F.stopPropagation(), o(y.id);
53792
53792
  },
@@ -53817,7 +53817,7 @@ function VCe({
53817
53817
  );
53818
53818
  },
53819
53819
  children: [
53820
- /* @__PURE__ */ S("span", { className: "truncate", children: [
53820
+ /* @__PURE__ */ S("span", { className: "break-words min-w-0", children: [
53821
53821
  h.charAt(0).toUpperCase() + h.slice(1),
53822
53822
  M && /* @__PURE__ */ S("span", { className: "ml-1 text-xs font-normal text-muted-foreground", children: [
53823
53823
  "(",
@@ -53871,7 +53871,7 @@ function VCe({
53871
53871
  );
53872
53872
  },
53873
53873
  children: [
53874
- /* @__PURE__ */ S("span", { className: "truncate", children: [
53874
+ /* @__PURE__ */ S("span", { className: "break-words min-w-0", children: [
53875
53875
  h.charAt(0).toUpperCase() + h.slice(1),
53876
53876
  M && /* @__PURE__ */ S("span", { className: "ml-1 text-xs font-normal text-muted-foreground", children: [
53877
53877
  "(",
@@ -54627,18 +54627,15 @@ function YCe(e) {
54627
54627
  minWidth: q.getSize(),
54628
54628
  maxWidth: q.getSize(),
54629
54629
  position: "relative",
54630
- transition: "none",
54631
- overflow: "hidden",
54632
- textOverflow: "ellipsis",
54633
- whiteSpace: "nowrap"
54630
+ transition: "none"
54634
54631
  },
54635
54632
  className: X(
54636
- "h-10",
54637
- d && "border-r border-gray-300 text-foreground last:border-r-0 print:border-gray-400"
54633
+ "h-10 border-r border-border/30 last:border-r-0",
54634
+ d && "border-gray-300 text-foreground print:border-gray-400"
54638
54635
  ),
54639
54636
  children: q.isPlaceholder ? null : /* @__PURE__ */ S(_e, { children: [
54640
54637
  /* @__PURE__ */ S(HCe, { children: [
54641
- /* @__PURE__ */ f(UCe, { asChild: !0, children: /* @__PURE__ */ f("span", { className: "block overflow-hidden text-ellipsis", children: Wo(
54638
+ /* @__PURE__ */ f(UCe, { asChild: !0, children: /* @__PURE__ */ f("span", { className: "block", children: Wo(
54642
54639
  q.column.columnDef.header,
54643
54640
  q.getContext()
54644
54641
  ) }) }),
@@ -54704,8 +54701,8 @@ function YCe(e) {
54704
54701
  textOverflow: "ellipsis"
54705
54702
  },
54706
54703
  className: X(
54707
- "overflow-hidden py-2",
54708
- d && "border-r border-gray-300 last:border-r-0 print:border-gray-400"
54704
+ "overflow-hidden py-2 border-r border-border/30 last:border-r-0",
54705
+ d && "border-gray-300 print:border-gray-400"
54709
54706
  ),
54710
54707
  children: /* @__PURE__ */ f("div", { className: "overflow-hidden text-ellipsis", children: Wo(
54711
54708
  U.column.columnDef.cell,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DU6R1IHW.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-BW7gx4di.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as a } from "../chunks/index-DgxiixWp.js";
1
+ import { D as a } from "../chunks/index-CbRnLd27.js";
2
2
  import { EMPTY_SELECTION as e } from "../types/index.js";
3
3
  export {
4
4
  a as Dashboard,
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-DU6R1IHW.js"),v=require("./types/index.cjs"),u=require("./chunks/dashboard-plus-DemHXmak.js"),a=require("react/jsx-runtime"),x=require("react");require("react-dom");function j(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return t.default=r,Object.freeze(t)}const p=j(x);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-BW7gx4di.js"),v=require("./types/index.cjs"),u=require("./chunks/dashboard-plus-BwGUy3z6.js"),a=require("react/jsx-runtime"),x=require("react");require("react-dom");function j(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return t.default=r,Object.freeze(t)}const p=j(x);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { c as x, E as v, F as N, S as w, U as A, a as L, C as _, u as E, b as g, d as P, P as k, e as W, B as F, f as M, g as R, h as V, i as B, j as O, I as Q, k as I, l as j, m as q, n as U, o as z } from "./chunks/index-DgxiixWp.js";
2
- import { D as ne, v as ie, R as de, r as le, r as ce, s as Ye, a0 as ue, L as he, x as pe, z as fe, N as me, M as Me, T as Ce, V as De, K as ge, w as ve, J as ye, O as be, H as Te, G as Se, A as xe, W as Ne, Q as we, t as Ae, Y as Le, _ as _e, Z as Ee, $ as Pe, y as ke, p as We, a2 as Fe, X as Re, a1 as Ve, q as Be } from "./chunks/index-DgxiixWp.js";
1
+ import { c as x, E as v, F as N, S as w, U as A, a as L, C as _, u as E, b as g, d as P, P as k, e as W, B as F, f as M, g as R, h as V, i as B, j as O, I as Q, k as I, l as j, m as q, n as U, o as z } from "./chunks/index-CbRnLd27.js";
2
+ import { D as ne, v as ie, R as de, r as le, r as ce, s as Ye, a0 as ue, L as he, x as pe, z as fe, N as me, M as Me, T as Ce, V as De, K as ge, w as ve, J as ye, O as be, H as Te, G as Se, A as xe, W as Ne, Q as we, t as Ae, Y as Le, _ as _e, Z as Ee, $ as Pe, y as ke, p as We, a2 as Fe, X as Re, a1 as Ve, q as Be } from "./chunks/index-CbRnLd27.js";
3
3
  import { EMPTY_SELECTION as Qe } from "./types/index.js";
4
- import { A as je, R as qe, S as Ue, D as ze, a as Ge, V as He, c as $e, g as Ke } from "./chunks/dashboard-plus-DNmZgxfx.js";
4
+ import { A as je, R as qe, S as Ue, D as ze, a as Ge, V as He, c as $e, g as Ke } from "./chunks/dashboard-plus-DUhnn1r1.js";
5
5
  import { jsx as e, jsxs as d } from "react/jsx-runtime";
6
6
  import * as h from "react";
7
7
  import { useMemo as G } from "react";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-plus-DemHXmak.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-plus-BwGUy3z6.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as f } from "../chunks/dashboard-plus-DNmZgxfx.js";
1
+ import { D as f } from "../chunks/dashboard-plus-DUhnn1r1.js";
2
2
  import { EMPTY_SELECTION as a } from "../types/index.js";
3
3
  export {
4
4
  a as EMPTY_SELECTION,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.55",
8
+ "version": "0.1.56",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",