react-semaphor 0.1.49 → 0.1.50

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-CAgfnOtu.js"),E=require("react"),Lt=require("react-dom");function Mt(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const es=Mt(E);/**
1
+ "use strict";const e=require("react/jsx-runtime"),s=require("./index-Ds-28cos.js"),E=require("react"),Lt=require("react-dom");function Mt(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const es=Mt(E);/**
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 J } from "react/jsx-runtime";
2
- import { c as ue, a2 as Xs, u as W, a3 as St, a4 as kt, B as V, a5 as Tt, a6 as Ye, a7 as Zs, _ as ot, a8 as Ze, a9 as nt, aa as Al, ab as We, ac as lt, ad as rt, ae as it, af as gt, ag as G, ah as Ie, ai as Dt, I as ge, aj as en, ak as Xt, al as ui, am as Hn, an as tn, f as B, ao as an, ap as mi, aq as Il, ar as hi, as as pi, at as ma, au as le, w as Qn, av as fi, aw as gi, ax as Zt, ay as qe, az as re, aA as Ae, aB as Ct, aC as $e, aD as ya, aE as sa, aF as ba, aG as vi, aH as na, aI as vt, aJ as Je, aK as He, aL as Ca, aM as Xe, aN as Ee, aO as tt, aP as sn, aQ as Ya, aR as ha, aS as $t, aT as jt, aU as nn, aV as ln, aW as xi, aX as Ra, aY as rn, aZ as on, a_ as cn, a$ as dn, R as Rt, b0 as Ol, b1 as Ni, b2 as un, b3 as Ma, b4 as mn, b5 as hn, b6 as wa, b7 as Sa, b8 as ka, b9 as pn, ba as rs, bb as fn, bc as Rl, bd as Ml, be as gn, bf as me, bg as he, bh as pe, bi as fe, bj as Z, bk as Fl, bl as Pl, bm as yi, bn as bi, bo as Mt, bp as Ci, bq as wi, br as Ft, bs as Pt, bt as Ve, bu as ut, bv as bt, a0 as M, bw as Et, bx as is, by as os, bz as vn, bA as Si, bB as ht, bC as _s, bD as Gt, bE as Us, bF as Ll, bG as zl, bH as ki, bI as cs, bJ as ds, bK as us, bL as ms, bM as hs, bN as ps, bO as fs, bP as gs, bQ as Ti, bR as vs, bS as Fa, a1 as oe, bT as Di, bU as wt, bV as Ei, o as la, bW as Vl, bX as je, bY as Ai, bZ as xs, b_ as Xa, b$ as xn, c0 as Ka, c1 as Pa, c2 as Nn, c3 as Ii, c4 as Oi, c5 as Ri, c6 as Mi, c7 as Fi, v as Pi, c8 as Za, c9 as _l, ca as Li, cb as Ns, cc as zi, cd as dt, ce as Vi, cf as _i, cg as Wa, ch as Ui, ci as Ja, cj as Ha, ck as ys, W as La, A as Yn, Q as Xn, K as Ul, J as $l, y as Vt, z as $i, G as ji, T as Gi, cl as Bi, cm as Zn, cn as el, co as qi, cp as bs, cq as Cs, cr as Ki, cs as za, ct as Wi, cu as es, cv as Ut, cw as jl, cx as ws, cy as Ji, cz as Gl, cA as pt, cB as Se, cC as ke, cD as Te, cE as Bl, cF as Ea, cG as ql, cH as Kl, cI as Va, g as Bt, cJ as tl, cK as Wl, cL as Hi, cM as $s, cN as Jl, cO as yn, cP as Hl, cQ as Aa, cR as al, cS as Qi, cT as Yi, cU as Xi, cV as Ql, cW as Zi, cX as eo, cY as Yl, cZ as to, c_ as Ss, c$ as ao, d0 as so, d1 as js, d2 as ea, d3 as st, d4 as ta, d5 as no, d6 as lo, d7 as ks, d8 as ro, d9 as bn, da as io, db as Cn, dc as oo, dd as Xl, de as Qa, df as Zl, dg as co, dh as uo, di as mo, dj as wn, dk as ho, dl as po, dm as sl, dn as fo, E as _a, b as Sn, dp as go, dq as vo, dr as xo, ds as No, dt as yo, du as bo, dv as er, dw as Gs, dx as kn, dy as tr, dz as ar, dA as sr, dB as nr, dC as lr, dD as Tn, dE as Dn, dF as rr, dG as ir, dH as or, dI as En, dJ as Ts, dK as Ds, dL as Co, P as qt, e as Kt, dM as wo, dN as Ht, dO as So, dP as ko, dQ as To, dR as Do, dS as Eo, dT as Ao, dU as cr, dV as mt, dW as Ia, dX as ts, dY as _t, h as ra, dZ as Io, d_ as Oo, d$ as Ro, e0 as Mo, e1 as Fo, e2 as dr, e3 as Po, i as Es, j as As, k as Is, l as Os, m as ua, n as Ua, e4 as Lo, e5 as ft, e6 as ja, e7 as nl, e8 as zo, e9 as ll, ea as Vo, eb as _o, ec as Uo, ed as $o, ee as rl, ef as jo, eg as Go, eh as Bo, ei as qo, ej as Ko, ek as Wo, O as il, el as ol, em as Jo, en as Ho, eo as ur, ep as Qo, eq as mr, er as Yo, es as Xo, et as Zo, eu as ec, ev as tc, ew as ac, ex as sc, ey as nc, ez as lc, eA as rc, eB as ic, eC as oc, eD as cc, eE as dc, eF as uc, eG as mc, eH as hr, eI as Fs, eJ as An, eK as pr, eL as In, eM as hc, eN as pc, eO as fc, eP as cl, eQ as gc, eR as vc, eS as pa, eT as fa, eU as xc, eV as fr, eW as Nc, eX as Bs, eY as yc, eZ as bc, e_ as as, e$ as Qt, f0 as qs, f1 as Ks, f2 as ss, f3 as gr, f4 as ga, f5 as va, f6 as On, f7 as Cc, f8 as wc, f9 as Sc, fa as kc, fb as Tc, fc as Dc, fd as Ec, fe as Ac, ff as Ps, fg as Ic, fh as Oc, fi as Rc, F as vr, fj as Mc, fk as Fc, fl as Pc, fm as xr, fn as Nr, fo as Lc, fp as yr, fq as zc, fr as Vc, fs as _c, ft as Uc, fu as $c, S as jc, fv as Gc, U as Bc, fw as qc, C as Kc } from "./index-n8_6ESse.js";
2
+ import { c as ue, a2 as Xs, u as W, a3 as St, a4 as kt, B as V, a5 as Tt, a6 as Ye, a7 as Zs, _ as ot, a8 as Ze, a9 as nt, aa as Al, ab as We, ac as lt, ad as rt, ae as it, af as gt, ag as G, ah as Ie, ai as Dt, I as ge, aj as en, ak as Xt, al as ui, am as Hn, an as tn, f as B, ao as an, ap as mi, aq as Il, ar as hi, as as pi, at as ma, au as le, w as Qn, av as fi, aw as gi, ax as Zt, ay as qe, az as re, aA as Ae, aB as Ct, aC as $e, aD as ya, aE as sa, aF as ba, aG as vi, aH as na, aI as vt, aJ as Je, aK as He, aL as Ca, aM as Xe, aN as Ee, aO as tt, aP as sn, aQ as Ya, aR as ha, aS as $t, aT as jt, aU as nn, aV as ln, aW as xi, aX as Ra, aY as rn, aZ as on, a_ as cn, a$ as dn, R as Rt, b0 as Ol, b1 as Ni, b2 as un, b3 as Ma, b4 as mn, b5 as hn, b6 as wa, b7 as Sa, b8 as ka, b9 as pn, ba as rs, bb as fn, bc as Rl, bd as Ml, be as gn, bf as me, bg as he, bh as pe, bi as fe, bj as Z, bk as Fl, bl as Pl, bm as yi, bn as bi, bo as Mt, bp as Ci, bq as wi, br as Ft, bs as Pt, bt as Ve, bu as ut, bv as bt, a0 as M, bw as Et, bx as is, by as os, bz as vn, bA as Si, bB as ht, bC as _s, bD as Gt, bE as Us, bF as Ll, bG as zl, bH as ki, bI as cs, bJ as ds, bK as us, bL as ms, bM as hs, bN as ps, bO as fs, bP as gs, bQ as Ti, bR as vs, bS as Fa, a1 as oe, bT as Di, bU as wt, bV as Ei, o as la, bW as Vl, bX as je, bY as Ai, bZ as xs, b_ as Xa, b$ as xn, c0 as Ka, c1 as Pa, c2 as Nn, c3 as Ii, c4 as Oi, c5 as Ri, c6 as Mi, c7 as Fi, v as Pi, c8 as Za, c9 as _l, ca as Li, cb as Ns, cc as zi, cd as dt, ce as Vi, cf as _i, cg as Wa, ch as Ui, ci as Ja, cj as Ha, ck as ys, W as La, A as Yn, Q as Xn, K as Ul, J as $l, y as Vt, z as $i, G as ji, T as Gi, cl as Bi, cm as Zn, cn as el, co as qi, cp as bs, cq as Cs, cr as Ki, cs as za, ct as Wi, cu as es, cv as Ut, cw as jl, cx as ws, cy as Ji, cz as Gl, cA as pt, cB as Se, cC as ke, cD as Te, cE as Bl, cF as Ea, cG as ql, cH as Kl, cI as Va, g as Bt, cJ as tl, cK as Wl, cL as Hi, cM as $s, cN as Jl, cO as yn, cP as Hl, cQ as Aa, cR as al, cS as Qi, cT as Yi, cU as Xi, cV as Ql, cW as Zi, cX as eo, cY as Yl, cZ as to, c_ as Ss, c$ as ao, d0 as so, d1 as js, d2 as ea, d3 as st, d4 as ta, d5 as no, d6 as lo, d7 as ks, d8 as ro, d9 as bn, da as io, db as Cn, dc as oo, dd as Xl, de as Qa, df as Zl, dg as co, dh as uo, di as mo, dj as wn, dk as ho, dl as po, dm as sl, dn as fo, E as _a, b as Sn, dp as go, dq as vo, dr as xo, ds as No, dt as yo, du as bo, dv as er, dw as Gs, dx as kn, dy as tr, dz as ar, dA as sr, dB as nr, dC as lr, dD as Tn, dE as Dn, dF as rr, dG as ir, dH as or, dI as En, dJ as Ts, dK as Ds, dL as Co, P as qt, e as Kt, dM as wo, dN as Ht, dO as So, dP as ko, dQ as To, dR as Do, dS as Eo, dT as Ao, dU as cr, dV as mt, dW as Ia, dX as ts, dY as _t, h as ra, dZ as Io, d_ as Oo, d$ as Ro, e0 as Mo, e1 as Fo, e2 as dr, e3 as Po, i as Es, j as As, k as Is, l as Os, m as ua, n as Ua, e4 as Lo, e5 as ft, e6 as ja, e7 as nl, e8 as zo, e9 as ll, ea as Vo, eb as _o, ec as Uo, ed as $o, ee as rl, ef as jo, eg as Go, eh as Bo, ei as qo, ej as Ko, ek as Wo, O as il, el as ol, em as Jo, en as Ho, eo as ur, ep as Qo, eq as mr, er as Yo, es as Xo, et as Zo, eu as ec, ev as tc, ew as ac, ex as sc, ey as nc, ez as lc, eA as rc, eB as ic, eC as oc, eD as cc, eE as dc, eF as uc, eG as mc, eH as hr, eI as Fs, eJ as An, eK as pr, eL as In, eM as hc, eN as pc, eO as fc, eP as cl, eQ as gc, eR as vc, eS as pa, eT as fa, eU as xc, eV as fr, eW as Nc, eX as Bs, eY as yc, eZ as bc, e_ as as, e$ as Qt, f0 as qs, f1 as Ks, f2 as ss, f3 as gr, f4 as ga, f5 as va, f6 as On, f7 as Cc, f8 as wc, f9 as Sc, fa as kc, fb as Tc, fc as Dc, fd as Ec, fe as Ac, ff as Ps, fg as Ic, fh as Oc, fi as Rc, F as vr, fj as Mc, fk as Fc, fl as Pc, fm as xr, fn as Nr, fo as Lc, fp as yr, fq as zc, fr as Vc, fs as _c, ft as Uc, fu as $c, S as jc, fv as Gc, U as Bc, fw as qc, C as Kc } from "./index-DKZUZy-b.js";
3
3
  import * as Ws from "react";
4
4
  import Ke, { useState as _, useRef as Nt, useEffect as Ne, useMemo as et, useCallback as Ce, useContext as Rn, Suspense as br } from "react";
5
5
  import { createPortal as Wc } from "react-dom";
@@ -68746,11 +68746,13 @@ function PRe({
68746
68746
  }) {
68747
68747
  var x;
68748
68748
  const [t, n] = te(">="), [r, o] = te(""), [i, a] = te(""), [s, l] = te(""), [c, u] = te(!0), d = we(!1), f = cm(r, 300), p = cm(i, 300), m = cm(s, 300), g = re((w) => w.filterValues), b = re((w) => w.themeStyle), { addOrUpdateFilterValue: y, removeFilterValues: v } = on();
68749
- return de(() => {
68749
+ return de(() => () => {
68750
+ d.current = !1;
68751
+ }, []), de(() => {
68750
68752
  const w = g == null ? void 0 : g.find((S) => S.filterId === e.id);
68751
68753
  if (w && w.operation !== "in") {
68752
68754
  const S = ARe(w.operation);
68753
- if (d.current || n(S), S === "between" || S === "not between") {
68755
+ if (t !== S && (d.current = !1), d.current || n(S), S === "between" || S === "not between") {
68754
68756
  const N = w.values[0], k = w.values[1];
68755
68757
  a(N != null ? String(N) : ""), l(k != null ? String(k) : ""), o("");
68756
68758
  } else {
@@ -68758,7 +68760,7 @@ function PRe({
68758
68760
  o(N != null ? String(N) : ""), a(""), l("");
68759
68761
  }
68760
68762
  } else
68761
- d.current || n(">="), o(""), a(""), l(""), u(!1);
68763
+ d.current || (n(">="), o(""), a(""), l("")), u(!1);
68762
68764
  }, [g, e.id]), de(() => {
68763
68765
  c && (t === "between" || t === "not between" ? p === i && m === s && u(!1) : f === r && u(!1));
68764
68766
  }, [c, t, r, f, i, s, p, m]), de(() => {
@@ -68766,7 +68768,7 @@ function PRe({
68766
68768
  if (t === "between" || t === "not between") {
68767
68769
  const w = p && p.trim() !== "", S = m && m.trim() !== "";
68768
68770
  if (!w || !S) {
68769
- !w && !S && (v(e.id), d.current = !1);
68771
+ !w && !S && v(e.id);
68770
68772
  return;
68771
68773
  }
68772
68774
  const N = Number(p), k = Number(m);
@@ -907,7 +907,7 @@ Defaulting to \`null\`.`}const OW=IW,lMe=sMe,tM=E.forwardRef(({className:e,value
907
907
  font-size: .6rem;
908
908
  font-weight: bold;
909
909
  color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(l=n==null?void 0:n.onChange)==null||l.call(n,s),s}}function VC(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const DTe=(e,t)=>Math.abs(e-t)<1,MTe=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}},TTe=e=>e,RTe=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let s=t;s<=n;s++)r.push(s);return r},ITe=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=i=>{const{width:a,height:l}=i;t({width:Math.round(a),height:Math.round(l)})};if(s(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(i=>{const a=()=>{const l=i[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(n.getBoundingClientRect())};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},uF={passive:!0},dF=typeof window>"u"?!0:"onscrollend"in window,ATe=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let s=0;const o=e.options.useScrollendEvent&&dF?()=>{}:MTe(r,()=>{t(s,!1)},e.options.isScrollingResetDelay),i=d=>()=>{const{horizontal:f,isRtl:h}=e.options;s=f?n.scrollLeft*(h&&-1||1):n.scrollTop,o(),t(s,d)},a=i(!0),l=i(!1);l(),n.addEventListener("scroll",a,uF);const c=e.options.useScrollendEvent&&dF;return c&&n.addEventListener("scrollend",l,uF),()=>{n.removeEventListener("scroll",a),c&&n.removeEventListener("scrollend",l)}},PTe=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},OTe=(e,{adjustments:t=0,behavior:n},r)=>{var s,o;const i=e+t;(o=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||o.call(s,{[r.options.horizontal?"left":"top"]:i,behavior:n})};class FTe{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(o=>{const i=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var o;return(o=r())==null?void 0:o.observe(s,{box:"border-box"})},unobserve:s=>{var o;return(o=r())==null?void 0:o.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:TTe,rangeExtractor:RTe,onChange:()=>{},measureElement:PTe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!0,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=jd(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,o=new Map;for(let i=r-1;i>=0;i--){const a=n[i];if(s.has(a.lane))continue;const l=o.get(a.lane);if(l==null||a.end>l.end?o.set(a.lane,a):a.end<l.end&&s.set(a.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=jd(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,s,o,i)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i}),{key:!1}),this.getMeasurements=jd(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i},a)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const c=this.measurementsCache.slice(0,l);for(let d=l;d<n;d++){const f=o(d),h=this.options.lanes===1?c[d-1]:this.getFurthestMeasurement(c,d),p=h?h.end+this.options.gap:r+s,m=a.get(f),g=typeof m=="number"?m:this.options.estimateSize(d),b=p+g,y=h?h.lane:d%this.options.lanes;c[d]={index:d,start:p,size:g,end:b,key:f,lane:y}}return this.measurementsCache=c,c},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=jd(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,o)=>this.range=n.length>0&&r>0?$Te({measurements:n,outerSize:r,scrollOffset:s,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=jd(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,o,i)=>o===null||i===null?[]:n({startIndex:o,endIndex:i,overscan:r,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const s=this.indexFromElement(n),o=this.measurementsCache[s];if(!o)return;const i=o.key,a=this.elementsCache.get(i);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(i,n)),n.isConnected&&this.resizeItem(s,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const s=this.measurementsCache[n];if(!s)return;const o=this.itemSizeCache.get(s.key)??s.size,i=r-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,i,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(n,void 0)},this.getVirtualItems=jd(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let o=0,i=n.length;o<i;o++){const a=n[o],l=r[a];s.push(l)}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return VC(r[bq(0,r.length-1,s=>VC(r[s]).start,n)])},this.getOffsetForAlignment=(n,r,s=0)=>{const o=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+o?"end":"start"),r==="center"?n+=(s-o)/2:r==="end"&&(n-=o);const a=this.options.horizontal?"scrollWidth":"scrollHeight",c=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[a]:this.scrollElement[a]:0)-o;return Math.max(Math.min(c,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.measurementsCache[n];if(!s)return;const o=this.getSize(),i=this.getScrollOffset();if(r==="auto")if(s.end>=i+o-this.options.scrollPaddingEnd)r="end";else if(s.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];const a=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:r="start",behavior:s}={})=>{this.cancelScrollToIndex(),s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(n,{align:r="auto",behavior:s}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const o=this.getOffsetForIndex(n,r);if(!o)return;const[i,a]=o;this._scrollToOffset(i,{adjustments:void 0,behavior:s}),s!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[c]=VC(this.getOffsetForIndex(n,a));DTe(c,this.getScrollOffset())||this.scrollToIndex(n,{align:a,behavior:s})}else this.scrollToIndex(n,{align:a,behavior:s})}))},this.scrollBy=(n,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;return r.length===0?s=this.options.paddingStart:s=this.options.lanes===1?((n=r[r.length-1])==null?void 0:n.end)??0:Math.max(...r.slice(-this.options.lanes).map(o=>o.end)),Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const bq=(e,t,n,r)=>{for(;e<=t;){const s=(e+t)/2|0,o=n(s);if(o<r)e=s+1;else if(o>r)t=s-1;else return s}return e>0?e-1:0};function $Te({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const s=e.length-1;let i=bq(0,s,l=>e[l].start,n),a=i;for(;a<s&&e[a].end<n+t;)a++;return r>1&&(i=Math.max(0,i-i%r),a=Math.min(s,a+(r-1-a%r))),{startIndex:i,endIndex:a}}const fF=typeof document<"u"?E.useLayoutEffect:E.useEffect;function LTe(e){const t=E.useReducer(()=>({}),{})[1],n={...e,onChange:(s,o)=>{var i;o?_n.flushSync(t):t(),(i=e.onChange)==null||i.call(e,s,o)}},[r]=E.useState(()=>new FTe(n));return r.setOptions(n),fF(()=>r._didMount(),[]),fF(()=>r._willUpdate()),r}function zTe(e){return LTe({observeElementRect:ITe,observeElementOffset:ATe,scrollToFn:OTe,...e})}function BTe(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function VTe(e=BTe){return C.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function HTe(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function hF(e,t=!1){let[n,r]=C.useReducer(()=>({}),{}),s=C.useMemo(()=>HTe(e),[e,n]);return Bn(()=>{if(!e)return;let o=new ResizeObserver(r);return o.observe(e),()=>{o.disconnect()}},[e]),t?{width:`${s.width}px`,height:`${s.height}px`}:s}let UTe=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};function yq(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(s){return r.add(s),()=>r.delete(s)},dispatch(s,...o){let i=t[s].call(n,...o);i&&(n=i,r.forEach(a=>a()))}}}function xq(e){return C.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}let WTe=new UTe(()=>yq(()=>[],{ADD(e){return this.includes(e)?this:[...this,e]},REMOVE(e){let t=this.indexOf(e);if(t===-1)return this;let n=this.slice();return n.splice(t,1),n}}));function fM(e,t){let n=WTe.get(t),r=C.useId(),s=xq(n);if(Bn(()=>{if(e)return n.dispatch("ADD",r),()=>n.dispatch("REMOVE",r)},[n,e]),!e)return!1;let o=s.indexOf(r),i=s.length;return o===-1&&(o=i,i+=1),o===i-1}let Kk=new Map,im=new Map;function pF(e){var t;let n=(t=im.get(e))!=null?t:0;return im.set(e,n+1),n!==0?()=>mF(e):(Kk.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>mF(e))}function mF(e){var t;let n=(t=im.get(e))!=null?t:1;if(n===1?im.delete(e):im.set(e,n-1),n!==1)return;let r=Kk.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Kk.delete(e))}function qTe(e,{allowed:t,disallowed:n}={}){let r=fM(e,"inert-others");Bn(()=>{var s,o;if(!r)return;let i=Yi();for(let l of(s=n==null?void 0:n())!=null?s:[])l&&i.add(pF(l));let a=(o=t==null?void 0:t())!=null?o:[];for(let l of a){if(!l)continue;let c=cb(l);if(!c)continue;let d=l.parentElement;for(;d&&d!==c.body;){for(let f of d.children)a.some(h=>f.contains(h))||i.add(pF(f));d=d.parentElement}}return i.dispose},[r,t,n])}function YTe(e,t,n){let r=ld(s=>{let o=s.getBoundingClientRect();o.x===0&&o.y===0&&o.width===0&&o.height===0&&n()});C.useEffect(()=>{if(!e)return;let s=t===null?null:t instanceof HTMLElement?t:t.current;if(!s)return;let o=Yi();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(s));i.observe(s),o.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(s));i.observe(s),o.add(()=>i.disconnect())}return()=>o.dispose()},[t,r,e])}let Xk=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var GTe=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(GTe||{}),ZTe=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(ZTe||{}),KTe=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(KTe||{}),vq=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(vq||{});function XTe(e,t=0){var n;return e===((n=cb(e))==null?void 0:n.body)?!1:Fa(t,{0(){return e.matches(Xk)},1(){let r=e;for(;r!==null;){if(r.matches(Xk))return!0;r=r.parentElement}return!1}})}var QTe=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(QTe||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function JTe(e,t=n=>n){return e.slice().sort((n,r)=>{let s=t(n),o=t(r);if(s===null||o===null)return 0;let i=s.compareDocumentPosition(o);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function wq(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function eRe(){return/Android/gi.test(window.navigator.userAgent)}function Sq(){return wq()||eRe()}function sp(e,t,n,r){let s=ld(n);C.useEffect(()=>{if(!e)return;function o(i){s.current(i)}return document.addEventListener(t,o,r),()=>document.removeEventListener(t,o,r)},[e,t,r])}function tRe(e,t,n,r){let s=ld(n);C.useEffect(()=>{if(!e)return;function o(i){s.current(i)}return window.addEventListener(t,o,r),()=>window.removeEventListener(t,o,r)},[e,t,r])}const gF=30;function nRe(e,t,n){let r=fM(e,"outside-click"),s=ld(n),o=C.useCallback(function(l,c){if(l.defaultPrevented)return;let d=c(l);if(d===null||!d.getRootNode().contains(d)||!d.isConnected)return;let f=function h(p){return typeof p=="function"?h(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let h of f)if(h!==null&&(h.contains(d)||l.composed&&l.composedPath().includes(h)))return;return!XTe(d,vq.Loose)&&d.tabIndex!==-1&&l.preventDefault(),s.current(l,d)},[s,t]),i=C.useRef(null);sp(r,"pointerdown",l=>{var c,d;i.current=((d=(c=l.composedPath)==null?void 0:c.call(l))==null?void 0:d[0])||l.target},!0),sp(r,"mousedown",l=>{var c,d;i.current=((d=(c=l.composedPath)==null?void 0:c.call(l))==null?void 0:d[0])||l.target},!0),sp(r,"click",l=>{Sq()||i.current&&(o(l,()=>i.current),i.current=null)},!0);let a=C.useRef({x:0,y:0});sp(r,"touchstart",l=>{a.current.x=l.touches[0].clientX,a.current.y=l.touches[0].clientY},!0),sp(r,"touchend",l=>{let c={x:l.changedTouches[0].clientX,y:l.changedTouches[0].clientY};if(!(Math.abs(c.x-a.current.x)>=gF||Math.abs(c.y-a.current.y)>=gF))return o(l,()=>l.target instanceof HTMLElement?l.target:null)},!0),tRe(r,"blur",l=>o(l,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function i1(...e){return C.useMemo(()=>cb(...e),[...e])}function rRe(e,t,n,r){let s=ld(n);C.useEffect(()=>{e=e??window;function o(i){s.current(i)}return e.addEventListener(t,o,r),()=>e.removeEventListener(t,o,r)},[e,t,r])}function Cq(e){let t=C.useRef({value:"",selectionStart:null,selectionEnd:null});return rRe(e,"blur",n=>{let r=n.target;r instanceof HTMLInputElement&&(t.current={value:r.value,selectionStart:r.selectionStart,selectionEnd:r.selectionEnd})}),yt(()=>{if(document.activeElement!==e&&e instanceof HTMLInputElement&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==t.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:n,selectionEnd:r}=t.current;n!==null&&r!==null&&e.setSelectionRange(n,r)}t.current={value:"",selectionStart:null,selectionEnd:null}}})}function sRe(e,t){return C.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function oRe(){let e;return{before({doc:t}){var n;let r=t.documentElement,s=(n=t.defaultView)!=null?n:window;e=Math.max(0,s.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,s=Math.max(0,r.clientWidth-r.offsetWidth),o=Math.max(0,e-s);n.style(r,"paddingRight",`${o}px`)}}}function iRe(){return wq()?{before({doc:e,d:t,meta:n}){function r(s){return n.containers.flatMap(o=>o()).some(o=>o.contains(s))}t.microTask(()=>{var s;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let a=Yi();a.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>a.dispose()))}let o=(s=window.scrollY)!=null?s:window.pageYOffset,i=null;t.addEventListener(e,"click",a=>{if(a.target instanceof HTMLElement)try{let l=a.target.closest("a");if(!l)return;let{hash:c}=new URL(l.href),d=e.querySelector(c);d&&!r(d)&&(i=d)}catch{}},!0),t.addEventListener(e,"touchstart",a=>{if(a.target instanceof HTMLElement)if(r(a.target)){let l=a.target;for(;l.parentElement&&r(l.parentElement);)l=l.parentElement;t.style(l,"overscrollBehavior","contain")}else t.style(a.target,"touchAction","none")}),t.addEventListener(e,"touchmove",a=>{if(a.target instanceof HTMLElement){if(a.target.tagName==="INPUT")return;if(r(a.target)){let l=a.target;for(;l.parentElement&&l.dataset.headlessuiPortal!==""&&!(l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth);)l=l.parentElement;l.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),t.add(()=>{var a;let l=(a=window.scrollY)!=null?a:window.pageYOffset;o!==l&&window.scrollTo(0,o),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function aRe(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function lRe(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Gc=yq(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Yi(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:lRe(n)},s=[iRe(),oRe(),aRe()];s.forEach(({before:o})=>o==null?void 0:o(r)),s.forEach(({after:o})=>o==null?void 0:o(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Gc.subscribe(()=>{let e=Gc.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",s=n.count!==0;(s&&!r||!s&&r)&&Gc.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Gc.dispatch("TEARDOWN",n)}});function cRe(e,t,n=()=>({containers:[]})){let r=xq(Gc),s=t?r.get(t):void 0,o=s?s.count>0:!1;return Bn(()=>{if(!(!t||!e))return Gc.dispatch("PUSH",t,n),()=>Gc.dispatch("POP",t,n)},[e,t]),o}function uRe(e,t,n=()=>[document.body]){let r=fM(e,"scroll-lock");cRe(r,t,s=>{var o;return{containers:[...(o=s.containers)!=null?o:[],n]}})}function bF(e){return[e.screenX,e.screenY]}function dRe(){let e=C.useRef([-1,-1]);return{wasMoved(t){let n=bF(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=bF(t)}}}function fRe(e=0){let[t,n]=C.useState(e),r=C.useCallback(l=>n(l),[t]),s=C.useCallback(l=>n(c=>c|l),[t]),o=C.useCallback(l=>(t&l)===l,[t]),i=C.useCallback(l=>n(c=>c&~l),[n]),a=C.useCallback(l=>n(c=>c^l),[n]);return{flags:t,setFlag:r,addFlag:s,hasFlag:o,removeFlag:i,toggleFlag:a}}var yF,xF;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((yF=process==null?void 0:process.env)==null?void 0:yF.NODE_ENV)==="test"&&typeof((xF=Element==null?void 0:Element.prototype)==null?void 0:xF.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
910
- `)),[]});var hRe=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(hRe||{});function pRe(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function mRe(e,t,n,r){let[s,o]=C.useState(n),{hasFlag:i,addFlag:a,removeFlag:l}=fRe(e&&s?3:0),c=C.useRef(!1),d=C.useRef(!1),f=ub();return Bn(()=>{var h;if(e){if(n&&o(!0),!t){n&&a(3);return}return(h=void 0)==null||h.call(r,n),gRe(t,{inFlight:c,prepare(){d.current?d.current=!1:d.current=c.current,c.current=!0,!d.current&&(n?(a(3),l(4)):(a(4),l(2)))},run(){d.current?n?(l(3),a(4)):(l(4),a(3)):n?l(1):a(1)},done(){var p;d.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,l(7),n||o(!1),(p=void 0)==null||p.call(r,n))}})}},[e,n,t,f]),e?[s,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function gRe(e,{prepare:t,run:n,done:r,inFlight:s}){let o=Yi();return yRe(e,{prepare:t,inFlight:s}),o.nextFrame(()=>{n(),o.requestAnimationFrame(()=>{o.add(bRe(e,r))})}),o.dispose}function bRe(e,t){var n,r;let s=Yi();if(!e)return s.dispose;let o=!1;s.add(()=>{o=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),s.dispose):(Promise.allSettled(i.map(a=>a.finished)).then(()=>{o||t()}),s.dispose)}function yRe(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function xRe(e,{container:t,accept:n,walk:r}){let s=C.useRef(n),o=C.useRef(r);C.useEffect(()=>{s.current=n,o.current=r},[n,r]),Bn(()=>{if(!t||!e)return;let i=cb(t);if(!i)return;let a=s.current,l=o.current,c=Object.assign(f=>a(f),{acceptNode:a}),d=i.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;d.nextNode();)l(d.currentNode)},[t,e,s,o])}function vF(e,t){let n=C.useRef([]),r=yt(e);C.useEffect(()=>{let s=[...n.current];for(let[o,i]of t.entries())if(n.current[o]!==i){let a=r(t,s);return n.current=t,a}},[r,...t])}function vRe(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const Nq={...E},wRe=Nq.useInsertionEffect,SRe=wRe||(e=>e());function kq(e){const t=E.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return SRe(()=>{t.current=e}),E.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}var Qk=typeof document<"u"?C.useLayoutEffect:C.useEffect;let wF=!1,CRe=0;const SF=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+CRe++;function NRe(){const[e,t]=E.useState(()=>wF?SF():void 0);return Qk(()=>{e==null&&t(SF())},[]),E.useEffect(()=>{wF=!0},[]),e}const kRe=Nq.useId,ERe=kRe||NRe;let Jm;process.env.NODE_ENV!=="production"&&(Jm=new Set);function jRe(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const s="Floating UI: "+n.join(" ");if(!((e=Jm)!=null&&e.has(s))){var o;(o=Jm)==null||o.add(s),console.warn(s)}}function _Re(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const s="Floating UI: "+n.join(" ");if(!((e=Jm)!=null&&e.has(s))){var o;(o=Jm)==null||o.add(s),console.error(s)}}function DRe(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(s=>s(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(s=>s!==n))||[])}}}const MRe=E.createContext(null),TRe=E.createContext(null),RRe=()=>{var e;return((e=E.useContext(MRe))==null?void 0:e.id)||null},IRe=()=>E.useContext(TRe),ARe="data-floating-ui-focusable";function PRe(e){const{open:t=!1,onOpenChange:n,elements:r}=e,s=ERe(),o=E.useRef({}),[i]=E.useState(()=>DRe()),a=RRe()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!Ur(p)&&_Re("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[l,c]=E.useState(r.reference),d=kq((p,m,g)=>{o.current.openEvent=p?m:void 0,i.emit("openchange",{open:p,event:m,reason:g,nested:a}),n==null||n(p,m,g)}),f=E.useMemo(()=>({setPositionReference:c}),[]),h=E.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return E.useMemo(()=>({dataRef:o,open:t,onOpenChange:d,elements:h,events:i,floatingId:s,refs:f}),[t,d,h,i,s,f])}function ORe(e){e===void 0&&(e={});const{nodeId:t}=e,n=PRe({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,s=r.elements,[o,i]=E.useState(null),[a,l]=E.useState(null),d=(s==null?void 0:s.domReference)||o,f=E.useRef(null),h=IRe();Qk(()=>{d&&(f.current=d)},[d]);const p=Az({...e,elements:{...s,...a&&{reference:a}}}),m=E.useCallback(v=>{const w=Ur(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),contextElement:v}:v;l(w),p.refs.setReference(w)},[p.refs]),g=E.useCallback(v=>{(Ur(v)||v===null)&&(f.current=v,i(v)),(Ur(p.refs.reference.current)||p.refs.reference.current===null||v!==null&&!Ur(v))&&p.refs.setReference(v)},[p.refs]),b=E.useMemo(()=>({...p.refs,setReference:g,setPositionReference:m,domReference:f}),[p.refs,g,m]),y=E.useMemo(()=>({...p.elements,domReference:d}),[p.elements,d]),x=E.useMemo(()=>({...p,...r,refs:b,elements:y,nodeId:t}),[p,b,y,t,r]);return Qk(()=>{r.dataRef.current.floatingContext=x;const v=h==null?void 0:h.nodesRef.current.find(w=>w.id===t);v&&(v.context=x)}),E.useMemo(()=>({...p,context:x,refs:b,elements:y}),[p,b,y,x])}const CF="active",NF="selected";function HC(e,t,n){const r=new Map,s=n==="item";let o=e;if(s&&e){const{[CF]:i,[NF]:a,...l}=e;o=l}return{...n==="floating"&&{tabIndex:-1,[ARe]:""},...o,...t.map(i=>{const a=i?i[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((i,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(s&&[CF,NF].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof d=="function"){var f;(f=r.get(c))==null||f.push(d),i[c]=function(){for(var h,p=arguments.length,m=new Array(p),g=0;g<p;g++)m[g]=arguments[g];return(h=r.get(c))==null?void 0:h.map(b=>b(...m)).find(b=>b!==void 0)}}}else i[c]=d}),i),{})}}function FRe(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),s=E.useCallback(a=>HC(a,e,"reference"),t),o=E.useCallback(a=>HC(a,e,"floating"),n),i=E.useCallback(a=>HC(a,e,"item"),r);return E.useMemo(()=>({getReferenceProps:s,getFloatingProps:o,getItemProps:i}),[s,o,i])}function kF(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const $Re=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:s,offset:o=0,index:i=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...d}=Hi(e,t),{rects:f,elements:{floating:h}}=t,p=n.current[i],m=(c==null?void 0:c.current)||h,g=h.clientTop||m.clientTop,b=h.clientTop!==0,y=m.clientTop!==0,x=h===m;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||jRe('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const v={...t,...await d_(-p.offsetTop-h.clientTop-f.reference.height/2-p.offsetHeight/2-o).fn(t)},w=await IS(kF(v,m.scrollHeight+g+h.clientTop),d),S=await IS(v,{...d,elementContext:"reference"}),N=Hr(0,w.top),k=v.y+N,D=(m.scrollHeight>m.clientHeight?M=>M:jm)(Hr(0,m.scrollHeight+(b&&x||y?g*2:0)-N-Hr(0,w.bottom)));if(m.style.maxHeight=D+"px",m.scrollTop=N,s){const M=m.offsetHeight<p.offsetHeight*Ua(a,n.current.length)-1||S.top>=-l||S.bottom>=-l;zl.flushSync(()=>s(M))}return r&&(r.current=await IS(kF({...v,y:k},m.offsetHeight+g+h.clientTop),d)),{y:k}}});function LRe(e,t){const{open:n,elements:r}=e,{enabled:s=!0,overflowRef:o,scrollRef:i,onChange:a}=t,l=kq(a),c=E.useRef(!1),d=E.useRef(null),f=E.useRef(null);E.useEffect(()=>{if(!s)return;function p(g){if(g.ctrlKey||!m||o.current==null)return;const b=g.deltaY,y=o.current.top>=-.5,x=o.current.bottom>=-.5,v=m.scrollHeight-m.clientHeight,w=b<0?-1:1,S=b<0?"max":"min";m.scrollHeight<=m.clientHeight||(!y&&b>0||!x&&b<0?(g.preventDefault(),zl.flushSync(()=>{l(N=>N+Math[S](b,v*w))})):/firefox/i.test(vRe())&&(m.scrollTop+=b))}const m=(i==null?void 0:i.current)||r.floating;if(n&&m)return m.addEventListener("wheel",p),requestAnimationFrame(()=>{d.current=m.scrollTop,o.current!=null&&(f.current={...o.current})}),()=>{d.current=null,f.current=null,m.removeEventListener("wheel",p)}},[s,n,r.floating,o,i,l]);const h=E.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const p=(i==null?void 0:i.current)||r.floating;if(!(!o.current||!p||!c.current)){if(d.current!==null){const m=p.scrollTop-d.current;(o.current.bottom<-.5&&m<-1||o.current.top<-.5&&m>1)&&zl.flushSync(()=>l(g=>g+m))}requestAnimationFrame(()=>{d.current=p.scrollTop})}}}),[r.floating,l,o,i]);return E.useMemo(()=>s?{floating:h}:{},[s,h])}let db=C.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});db.displayName="FloatingContext";let hM=C.createContext(null);hM.displayName="PlacementContext";function zRe(e){return C.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function BRe(){return C.useContext(db).setReference}function VRe(){let{getFloatingProps:e,slot:t}=C.useContext(db);return C.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function HRe(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=C.useContext(hM),n=C.useMemo(()=>e,[JSON.stringify(e,(s,o)=>{var i;return(i=o==null?void 0:o.outerHTML)!=null?i:o})]);Bn(()=>{t==null||t(n??null)},[t,n]);let r=C.useContext(db);return C.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let EF=4;function URe({children:e,enabled:t=!0}){let[n,r]=C.useState(null),[s,o]=C.useState(0),i=C.useRef(null),[a,l]=C.useState(null);WRe(a);let c=t&&n!==null&&a!==null,{to:d="bottom",gap:f=0,offset:h=0,padding:p=0,inner:m}=qRe(n,a),[g,b="center"]=d.split(" ");Bn(()=>{c&&o(0)},[c]);let{refs:y,floatingStyles:x,context:v}=ORe({open:c,placement:g==="selection"?b==="center"?"bottom":`bottom-${b}`:b==="center"?`${g}`:`${g}-${b}`,strategy:"absolute",transform:!1,middleware:[d_({mainAxis:g==="selection"?0:f,crossAxis:h}),Pz({padding:p}),g!=="selection"&&Oz({padding:p}),g==="selection"&&m?$Re({...m,padding:p,overflowRef:i,offset:s,minItemsVisible:EF,referenceOverflowThreshold:p,onFallbackChange(M){var T,O;if(!M)return;let A=v.elements.floating;if(!A)return;let P=parseFloat(getComputedStyle(A).scrollPaddingBottom)||0,F=Math.min(EF,A.childElementCount),V=0,H=0;for(let $ of(O=(T=v.elements.floating)==null?void 0:T.childNodes)!=null?O:[])if($ instanceof HTMLElement){let I=$.offsetTop,B=I+$.clientHeight+P,L=A.scrollTop,R=L+A.clientHeight;if(I>=L&&B<=R)F--;else{H=Math.max(0,Math.min(B,R)-Math.max(I,L)),V=$.clientHeight;break}}F>=1&&o($=>{let I=V*F-H+P;return $>=I?$:I})}}):null,Fz({padding:p,apply({availableWidth:M,availableHeight:T,elements:O}){Object.assign(O.floating.style,{overflow:"auto",maxWidth:`${M}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${T}px)`})}})].filter(Boolean),whileElementsMounted:Rz}),[w=g,S=b]=v.placement.split("-");g==="selection"&&(w="selection");let N=C.useMemo(()=>({anchor:[w,S].filter(Boolean).join(" ")}),[w,S]),k=LRe(v,{overflowRef:i,onChange:o}),{getReferenceProps:j,getFloatingProps:_}=FRe([k]),D=yt(M=>{l(M),y.setFloating(M)});return E.createElement(hM.Provider,{value:r},E.createElement(db.Provider,{value:{setFloating:D,setReference:y.setReference,styles:x,getReferenceProps:j,getFloatingProps:_,slot:N}},e))}function WRe(e){Bn(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let s=parseInt(n);isNaN(s)||r!==s&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function qRe(e,t){var n,r,s;let o=UC((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=UC((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),a=UC((s=e==null?void 0:e.padding)!=null?s:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:i,padding:a}}function UC(e,t,n=void 0){let r=ub(),s=yt((l,c)=>{if(l==null)return[n,null];if(typeof l=="number")return[l,null];if(typeof l=="string"){if(!c)return[n,null];let d=jF(l,c);return[d,f=>{let h=Eq(l);{let p=h.map(m=>window.getComputedStyle(c).getPropertyValue(m));r.requestAnimationFrame(function m(){r.nextFrame(m);let g=!1;for(let[y,x]of h.entries()){let v=window.getComputedStyle(c).getPropertyValue(x);if(p[y]!==v){p[y]=v,g=!0;break}}if(!g)return;let b=jF(l,c);d!==b&&(f(b),d=b)})}return r.dispose}]}return[n,null]}),o=C.useMemo(()=>s(e,t)[0],[e,t]),[i=o,a]=C.useState();return Bn(()=>{let[l,c]=s(e,t);if(a(l),!!c)return c(a)},[e,t]),i}function Eq(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),s=t[1].slice(n+1).trim();return s?[r,...Eq(s)]:[r]}return[]}function jF(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function YRe({children:e,freeze:t}){let n=Jk(t,e);return C.createElement(C.Fragment,null,n)}function Jk(e,t){let[n,r]=C.useState(t);return!e&&n!==t&&r(t),e?n:t}let pM=C.createContext(null);pM.displayName="OpenClosedContext";var eg=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(eg||{});function GRe(){return C.useContext(pM)}function ZRe({value:e,children:t}){return C.createElement(pM.Provider,{value:e},t)}function KRe(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let zc=[];KRe(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||zc[0]===t.target)return;let n=t.target;n=n.closest(Xk),zc.unshift(n??t.target),zc=zc.filter(r=>r!=null&&r.isConnected),zc.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function XRe(e){throw new Error("Unexpected object: "+e)}var lr=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(lr||{});function _F(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),s=r??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 1:{s===-1&&(s=n.length);for(let o=s-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 2:{for(let o=s+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return r}case 5:return null;default:XRe(e)}}var mM=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(mM||{});function QRe(e){let t=yt(e),n=C.useRef(!1);C.useEffect(()=>(n.current=!1,()=>{n.current=!0,aq(()=>{n.current&&t()})}),[t])}function JRe(){let e=typeof document>"u";return"useSyncExternalStore"in E?(t=>t.useSyncExternalStore)(E)(()=>()=>{},()=>!1,()=>!e):!1}function eIe(){let e=JRe(),[t,n]=E.useState(wu.isHandoffComplete);return t&&wu.isHandoffComplete===!1&&n(!1),E.useEffect(()=>{t!==!0&&n(!0)},[t]),E.useEffect(()=>wu.handoff(),[]),e?!1:t}let tIe=C.createContext(!1);function nIe(){return C.useContext(tIe)}function rIe(e){let t=nIe(),n=C.useContext(_q),r=i1(e),[s,o]=C.useState(()=>{var i;if(!t&&n!==null)return(i=n.current)!=null?i:null;if(wu.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let l=r.createElement("div");return l.setAttribute("id","headlessui-portal-root"),r.body.appendChild(l)});return C.useEffect(()=>{s!==null&&(r!=null&&r.body.contains(s)||r==null||r.body.appendChild(s))},[s,r]),C.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),s}let jq=C.Fragment,sIe=pi(function(e,t){let n=e,r=C.useRef(null),s=tl(xTe(f=>{r.current=f}),t),o=i1(r),i=rIe(r),[a]=C.useState(()=>{var f;return wu.isServer?null:(f=o==null?void 0:o.createElement("div"))!=null?f:null}),l=C.useContext(lIe),c=eIe();Bn(()=>{!i||!a||i.contains(a)||(a.setAttribute("data-headlessui-portal",""),i.appendChild(a))},[i,a]),Bn(()=>{if(a&&l)return l.register(a)},[l,a]),QRe(()=>{var f;!i||!a||(a instanceof Node&&i.contains(a)&&i.removeChild(a),i.childNodes.length<=0&&((f=i.parentElement)==null||f.removeChild(i)))});let d=hi();return c?!i||!a?null:_n.createPortal(d({ourProps:{ref:s},theirProps:n,slot:{},defaultTag:jq,name:"Portal"}),a):null});function oIe(e,t){let n=tl(t),{enabled:r=!0,...s}=e,o=hi();return r?C.createElement(sIe,{...s,ref:n}):o({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:jq,name:"Portal"})}let iIe=C.Fragment,_q=C.createContext(null);function aIe(e,t){let{target:n,...r}=e,s={ref:tl(t)},o=hi();return C.createElement(_q.Provider,{value:n},o({ourProps:s,theirProps:r,defaultTag:iIe,name:"Popover.Group"}))}let lIe=C.createContext(null),cIe=pi(oIe),uIe=pi(aIe),dIe=Object.assign(cIe,{Group:uIe});var fIe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(fIe||{}),hIe=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(hIe||{}),pIe=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(pIe||{}),mIe=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=7]="UpdateVirtualConfiguration",e[e.SetInputElement=8]="SetInputElement",e[e.SetButtonElement=9]="SetButtonElement",e[e.SetOptionsElement=10]="SetOptionsElement",e))(mIe||{});function WC(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),s=r.length>0&&r[0].dataRef.current.order!==null?r.sort((i,a)=>i.dataRef.current.order-a.dataRef.current.order):JTe(r,i=>i.dataRef.current.domRef.current),o=n?s.indexOf(n):null;return o===-1&&(o=null),{options:s,activeOptionIndex:o}}let gIe={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0,__demoMode:!1}}return{...e,comboboxState:0,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var n,r,s,o;if((n=e.dataRef.current)!=null&&n.disabled||e.optionsElement&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:c,disabled:d}=e.virtual,f=t.focus===lr.Specific?t.idx:_F(t,{resolveItems:()=>c,resolveActiveIndex:()=>{var p,m;return(m=(p=e.activeOptionIndex)!=null?p:c.findIndex(g=>!d(g)))!=null?m:null},resolveDisabled:d,resolveId(){throw new Error("Function not implemented.")}}),h=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===f&&e.activationTrigger===h?e:{...e,activeOptionIndex:f,activationTrigger:h,isTyping:!1,__demoMode:!1}}let i=WC(e);if(i.activeOptionIndex===null){let c=i.options.findIndex(d=>!d.dataRef.current.disabled);c!==-1&&(i.activeOptionIndex=c)}let a=t.focus===lr.Specific?t.idx:_F(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled}),l=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===a&&e.activationTrigger===l?e:{...e,...i,isTyping:!1,activeOptionIndex:a,activationTrigger:l,__demoMode:!1}},4:(e,t)=>{var n,r,s;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,i=WC(e,l=>(l.push(o),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(i.activeOptionIndex=i.options.indexOf(o));let a={...e,...i,activationTrigger:2};return(s=e.dataRef.current)!=null&&s.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},5:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(s=>s.id!==t.id)};let r=WC(e,s=>{let o=s.findIndex(i=>i.id===t.id);return o!==-1&&s.splice(o,1),s});return{...e,...r,activationTrigger:2}},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n,r;if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:(n=t.disabled)!=null?n:()=>!1}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let s=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?s=o:s=null}return{...e,activeOptionIndex:s,virtual:{options:t.options,disabled:(r=t.disabled)!=null?r:()=>!1}}},8:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},9:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},10:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},gM=C.createContext(null);gM.displayName="ComboboxActionsContext";function fb(e){let t=C.useContext(gM);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,fb),n}return t}let Dq=C.createContext(null);function bIe(e){let t=Rh("VirtualProvider"),{options:n}=t.virtual,[r,s]=C.useMemo(()=>{let c=t.optionsElement;if(!c)return[0,0];let d=window.getComputedStyle(c);return[parseFloat(d.paddingBlockStart||d.paddingTop),parseFloat(d.paddingBlockEnd||d.paddingBottom)]},[t.optionsElement]),o=zTe({enabled:n.length!==0,scrollPaddingStart:r,scrollPaddingEnd:s,count:n.length,estimateSize(){return 40},getScrollElement(){return t.optionsElement},overscan:12}),[i,a]=C.useState(0);Bn(()=>{a(c=>c+1)},[n]);let l=o.getVirtualItems();return l.length===0?null:C.createElement(Dq.Provider,{value:o},C.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:c=>{c&&t.activationTrigger!==0&&t.activeOptionIndex!==null&&n.length>t.activeOptionIndex&&o.scrollToIndex(t.activeOptionIndex)}},l.map(c=>{var d;return C.createElement(C.Fragment,{key:c.key},C.cloneElement((d=e.children)==null?void 0:d.call(e,{...e.slot,option:n[c.index]}),{key:`${i}-${c.key}`,"data-index":c.index,"aria-setsize":n.length,"aria-posinset":c.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${c.start}px)`,overflowAnchor:"none"}}))})))}let tg=C.createContext(null);tg.displayName="ComboboxDataContext";function Rh(e){let t=C.useContext(tg);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Rh),n}return t}function yIe(e,t){return Fa(t.type,gIe,e,t)}let xIe=C.Fragment;function vIe(e,t){var n,r;let s=lM(),{value:o,defaultValue:i,onChange:a,form:l,name:c,by:d,disabled:f=s||!1,onClose:h,__demoMode:p=!1,multiple:m=!1,immediate:g=!1,virtual:b=null,nullable:y,...x}=e,v=cTe(i),[w=m?[]:void 0,S]=lTe(o,a,v),[N,k]=C.useReducer(yIe,{dataRef:C.createRef(),comboboxState:p?0:1,isTyping:!1,options:[],virtual:b?{options:b.options,disabled:(n=b.disabled)!=null?n:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:p}),j=C.useRef(!1),_=C.useRef({static:!1,hold:!1}),D=VTe(d),M=yt(oe=>b?d===null?b.options.indexOf(oe):b.options.findIndex(de=>D(de,oe)):N.options.findIndex(de=>D(de.dataRef.current.value,oe))),T=C.useCallback(oe=>Fa(A.mode,{1:()=>w.some(de=>D(de,oe)),0:()=>D(w,oe)}),[w]),O=yt(oe=>N.activeOptionIndex===M(oe)),A=C.useMemo(()=>({...N,immediate:g,optionsPropsRef:_,value:w,defaultValue:v,disabled:f,mode:m?1:0,virtual:b?N.virtual:null,get activeOptionIndex(){if(j.current&&N.activeOptionIndex===null&&(b?b.options.length>0:N.options.length>0)){if(b){let de=b.options.findIndex(le=>{var ke,ye;return!((ye=(ke=b.disabled)==null?void 0:ke.call(b,le))!=null&&ye)});if(de!==-1)return de}let oe=N.options.findIndex(de=>!de.dataRef.current.disabled);if(oe!==-1)return oe}return N.activeOptionIndex},calculateIndex:M,compare:D,isSelected:T,isActive:O}),[w,v,f,m,p,N,b]);Bn(()=>{var oe;b&&k({type:7,options:b.options,disabled:(oe=b.disabled)!=null?oe:null})},[b,b==null?void 0:b.options,b==null?void 0:b.disabled]),Bn(()=>{N.dataRef.current=A},[A]);let P=A.comboboxState===0;nRe(P,[A.buttonElement,A.inputElement,A.optionsElement],()=>z.closeCombobox());let F=C.useMemo(()=>{var oe,de,le;return{open:A.comboboxState===0,disabled:f,activeIndex:A.activeOptionIndex,activeOption:A.activeOptionIndex===null?null:A.virtual?A.virtual.options[(oe=A.activeOptionIndex)!=null?oe:0]:(le=(de=A.options[A.activeOptionIndex])==null?void 0:de.dataRef.current.value)!=null?le:null,value:w}},[A,f,w]),V=yt(()=>{if(A.activeOptionIndex!==null){if(z.setIsTyping(!1),A.virtual)R(A.virtual.options[A.activeOptionIndex]);else{let{dataRef:oe}=A.options[A.activeOptionIndex];R(oe.current.value)}z.goToOption(lr.Specific,A.activeOptionIndex)}}),H=yt(()=>{k({type:0}),j.current=!0}),$=yt(()=>{k({type:1}),j.current=!1,h==null||h()}),I=yt(oe=>{k({type:3,isTyping:oe})}),B=yt((oe,de,le)=>(j.current=!1,oe===lr.Specific?k({type:2,focus:lr.Specific,idx:de,trigger:le}):k({type:2,focus:oe,trigger:le}))),L=yt((oe,de)=>(k({type:4,payload:{id:oe,dataRef:de}}),()=>{A.isActive(de.current.value)&&(j.current=!0),k({type:5,id:oe})})),R=yt(oe=>Fa(A.mode,{0(){return S==null?void 0:S(oe)},1(){let de=A.value.slice(),le=de.findIndex(ke=>D(ke,oe));return le===-1?de.push(oe):de.splice(le,1),S==null?void 0:S(de)}})),W=yt(oe=>{k({type:6,trigger:oe})}),Y=yt(oe=>{k({type:8,element:oe})}),Z=yt(oe=>{k({type:9,element:oe})}),U=yt(oe=>{k({type:10,element:oe})}),z=C.useMemo(()=>({onChange:R,registerOption:L,goToOption:B,setIsTyping:I,closeCombobox:$,openCombobox:H,setActivationTrigger:W,selectActiveOption:V,setInputElement:Y,setButtonElement:Z,setOptionsElement:U}),[]),[q,G]=NTe(),ee=t===null?{}:{ref:t},Q=C.useCallback(()=>{if(v!==void 0)return S==null?void 0:S(v)},[S,v]),ne=hi();return C.createElement(G,{value:q,props:{htmlFor:(r=A.inputElement)==null?void 0:r.id},slot:{open:A.comboboxState===0,disabled:f}},C.createElement(URe,null,C.createElement(gM.Provider,{value:z},C.createElement(tg.Provider,{value:A},C.createElement(ZRe,{value:Fa(A.comboboxState,{0:eg.Open,1:eg.Closed})},c!=null&&C.createElement(pTe,{disabled:f,data:w!=null?{[c]:w}:{},form:l,onReset:Q}),ne({ourProps:ee,theirProps:x,slot:F,defaultTag:xIe,name:"Combobox"}))))))}let wIe="input";function SIe(e,t){var n,r,s,o,i;let a=Rh("Combobox.Input"),l=fb("Combobox.Input"),c=C.useId(),d=hq(),{id:f=d||`headlessui-combobox-input-${c}`,onChange:h,displayValue:p,disabled:m=a.disabled||!1,autoFocus:g=!1,type:b="text",...y}=e,x=C.useRef(null),v=tl(x,t,BRe(),l.setInputElement),w=i1(a.inputElement),S=ub(),N=yt(()=>{l.onChange(null),a.optionsElement&&(a.optionsElement.scrollTop=0),l.goToOption(lr.Nothing)}),k=C.useMemo(()=>{var R;return typeof p=="function"&&a.value!==void 0?(R=p(a.value))!=null?R:"":typeof a.value=="string"?a.value:""},[a.value,p]);vF(([R,W],[Y,Z])=>{if(a.isTyping)return;let U=x.current;U&&((Z===0&&W===1||R!==Y)&&(U.value=R),requestAnimationFrame(()=>{if(a.isTyping||!U||(w==null?void 0:w.activeElement)!==U)return;let{selectionStart:z,selectionEnd:q}=U;Math.abs((q??0)-(z??0))===0&&z===0&&U.setSelectionRange(U.value.length,U.value.length)}))},[k,a.comboboxState,w,a.isTyping]),vF(([R],[W])=>{if(R===0&&W===1){if(a.isTyping)return;let Y=x.current;if(!Y)return;let Z=Y.value,{selectionStart:U,selectionEnd:z,selectionDirection:q}=Y;Y.value="",Y.value=Z,q!==null?Y.setSelectionRange(U,z,q):Y.setSelectionRange(U,z)}},[a.comboboxState]);let j=C.useRef(!1),_=yt(()=>{j.current=!0}),D=yt(()=>{S.nextFrame(()=>{j.current=!1})}),M=yt(R=>{switch(l.setIsTyping(!0),R.key){case as.Enter:if(a.comboboxState!==0||j.current)return;if(R.preventDefault(),R.stopPropagation(),a.activeOptionIndex===null){l.closeCombobox();return}l.selectActiveOption(),a.mode===0&&l.closeCombobox();break;case as.ArrowDown:return R.preventDefault(),R.stopPropagation(),Fa(a.comboboxState,{0:()=>l.goToOption(lr.Next),1:()=>l.openCombobox()});case as.ArrowUp:return R.preventDefault(),R.stopPropagation(),Fa(a.comboboxState,{0:()=>l.goToOption(lr.Previous),1:()=>{_n.flushSync(()=>l.openCombobox()),a.value||l.goToOption(lr.Last)}});case as.Home:if(R.shiftKey)break;return R.preventDefault(),R.stopPropagation(),l.goToOption(lr.First);case as.PageUp:return R.preventDefault(),R.stopPropagation(),l.goToOption(lr.First);case as.End:if(R.shiftKey)break;return R.preventDefault(),R.stopPropagation(),l.goToOption(lr.Last);case as.PageDown:return R.preventDefault(),R.stopPropagation(),l.goToOption(lr.Last);case as.Escape:return a.comboboxState!==0?void 0:(R.preventDefault(),a.optionsElement&&!a.optionsPropsRef.current.static&&R.stopPropagation(),a.mode===0&&a.value===null&&N(),l.closeCombobox());case as.Tab:if(a.comboboxState!==0)return;a.mode===0&&a.activationTrigger!==1&&l.selectActiveOption(),l.closeCombobox();break}}),T=yt(R=>{h==null||h(R),a.mode===0&&R.target.value===""&&N(),l.openCombobox()}),O=yt(R=>{var W,Y,Z;let U=(W=R.relatedTarget)!=null?W:zc.find(z=>z!==R.currentTarget);if(!((Y=a.optionsElement)!=null&&Y.contains(U))&&!((Z=a.buttonElement)!=null&&Z.contains(U))&&a.comboboxState===0)return R.preventDefault(),a.mode===0&&a.value===null&&N(),l.closeCombobox()}),A=yt(R=>{var W,Y,Z;let U=(W=R.relatedTarget)!=null?W:zc.find(z=>z!==R.currentTarget);(Y=a.buttonElement)!=null&&Y.contains(U)||(Z=a.optionsElement)!=null&&Z.contains(U)||a.disabled||a.immediate&&a.comboboxState!==0&&S.microTask(()=>{_n.flushSync(()=>l.openCombobox()),l.setActivationTrigger(1)})}),P=o1(),F=vTe(),{isFocused:V,focusProps:H}=iq({autoFocus:g}),{isHovered:$,hoverProps:I}=oq({isDisabled:m}),B=C.useMemo(()=>({open:a.comboboxState===0,disabled:m,hover:$,focus:V,autofocus:g}),[a,$,V,g,m]),L=cM({ref:v,id:f,role:"combobox",type:b,"aria-controls":(n=a.optionsElement)==null?void 0:n.id,"aria-expanded":a.comboboxState===0,"aria-activedescendant":a.activeOptionIndex===null?void 0:a.virtual?(r=a.options.find(R=>!R.dataRef.current.disabled&&a.compare(R.dataRef.current.value,a.virtual.options[a.activeOptionIndex])))==null?void 0:r.id:(s=a.options[a.activeOptionIndex])==null?void 0:s.id,"aria-labelledby":P,"aria-describedby":F,"aria-autocomplete":"list",defaultValue:(i=(o=e.defaultValue)!=null?o:a.defaultValue!==void 0?p==null?void 0:p(a.defaultValue):null)!=null?i:a.defaultValue,disabled:m||void 0,autoFocus:g,onCompositionStart:_,onCompositionEnd:D,onKeyDown:M,onChange:T,onFocus:A,onBlur:O},H,I);return hi()({ourProps:L,theirProps:y,slot:B,defaultTag:wIe,name:"Combobox.Input"})}let CIe="button";function NIe(e,t){var n;let r=Rh("Combobox.Button"),s=fb("Combobox.Button"),o=tl(t,s.setButtonElement),i=C.useId(),{id:a=`headlessui-combobox-button-${i}`,disabled:l=r.disabled||!1,autoFocus:c=!1,...d}=e,f=Cq(r.inputElement),h=yt(k=>{switch(k.key){case as.Space:case as.Enter:k.preventDefault(),k.stopPropagation(),r.comboboxState===1&&_n.flushSync(()=>s.openCombobox()),f();return;case as.ArrowDown:k.preventDefault(),k.stopPropagation(),r.comboboxState===1&&(_n.flushSync(()=>s.openCombobox()),r.value||s.goToOption(lr.First)),f();return;case as.ArrowUp:k.preventDefault(),k.stopPropagation(),r.comboboxState===1&&(_n.flushSync(()=>s.openCombobox()),r.value||s.goToOption(lr.Last)),f();return;case as.Escape:if(r.comboboxState!==0)return;k.preventDefault(),r.optionsElement&&!r.optionsPropsRef.current.static&&k.stopPropagation(),_n.flushSync(()=>s.closeCombobox()),f();return;default:return}}),p=yt(k=>{k.preventDefault(),!bTe(k.currentTarget)&&(k.button===mM.Left&&(r.comboboxState===0?s.closeCombobox():s.openCombobox()),f())}),m=o1([a]),{isFocusVisible:g,focusProps:b}=iq({autoFocus:c}),{isHovered:y,hoverProps:x}=oq({isDisabled:l}),{pressed:v,pressProps:w}=tTe({disabled:l}),S=C.useMemo(()=>({open:r.comboboxState===0,active:v||r.comboboxState===0,disabled:l,value:r.value,hover:y,focus:g}),[r,y,g,v,l]),N=cM({ref:o,id:a,type:sRe(e,r.buttonElement),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsElement)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":m,disabled:l||void 0,autoFocus:c,onMouseDown:p,onKeyDown:h},b,x,w);return hi()({ourProps:N,theirProps:d,slot:S,defaultTag:CIe,name:"Combobox.Button"})}let kIe="div",EIe=Zk.RenderStrategy|Zk.Static;function jIe(e,t){var n,r,s;let o=C.useId(),{id:i=`headlessui-combobox-options-${o}`,hold:a=!1,anchor:l,portal:c=!1,modal:d=!0,transition:f=!1,...h}=e,p=Rh("Combobox.Options"),m=fb("Combobox.Options"),g=zRe(l);g&&(c=!0);let[b,y]=HRe(g),[x,v]=C.useState(null),w=VRe(),S=tl(t,g?b:null,m.setOptionsElement,v),N=i1(p.optionsElement),k=GRe(),[j,_]=mRe(f,x,k!==null?(k&eg.Open)===eg.Open:p.comboboxState===0);YTe(j,p.inputElement,m.closeCombobox);let D=p.__demoMode?!1:d&&p.comboboxState===0;uRe(D,N);let M=p.__demoMode?!1:d&&p.comboboxState===0;qTe(M,{allowed:C.useCallback(()=>[p.inputElement,p.buttonElement,p.optionsElement],[p.inputElement,p.buttonElement,p.optionsElement])}),Bn(()=>{var L;p.optionsPropsRef.current.static=(L=e.static)!=null?L:!1},[p.optionsPropsRef,e.static]),Bn(()=>{p.optionsPropsRef.current.hold=a},[p.optionsPropsRef,a]),xRe(p.comboboxState===0,{container:p.optionsElement,accept(L){return L.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:L.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(L){L.setAttribute("role","none")}});let T=o1([(n=p.buttonElement)==null?void 0:n.id]),O=C.useMemo(()=>({open:p.comboboxState===0,option:void 0}),[p.comboboxState]),A=yt(()=>{m.setActivationTrigger(0)}),P=yt(L=>{L.preventDefault(),m.setActivationTrigger(0)}),F=cM(g?w():{},{"aria-labelledby":T,role:"listbox","aria-multiselectable":p.mode===1?!0:void 0,id:i,ref:S,style:{...h.style,...y,"--input-width":hF(p.inputElement,!0).width,"--button-width":hF(p.buttonElement,!0).width},onWheel:p.activationTrigger===0?void 0:A,onMouseDown:P,...pRe(_)}),V=j&&p.comboboxState===1,H=Jk(V,(r=p.virtual)==null?void 0:r.options),$=Jk(V,p.value),I=yt(L=>p.compare($,L));if(p.virtual){if(H===void 0)throw new Error("Missing `options` in virtual mode");Object.assign(h,{children:C.createElement(tg.Provider,{value:H!==p.virtual.options?{...p,virtual:{...p.virtual,options:H}}:p},C.createElement(bIe,{slot:O},h.children))})}let B=hi();return C.createElement(dIe,{enabled:c?e.static||j:!1},C.createElement(tg.Provider,{value:p.mode===1?p:{...p,isSelected:I}},B({ourProps:F,theirProps:{...h,children:C.createElement(YRe,{freeze:V},typeof h.children=="function"?(s=h.children)==null?void 0:s.call(h,O):h.children)},slot:O,defaultTag:kIe,features:EIe,visible:j,name:"Combobox.Options"})))}let _Ie="div";function DIe(e,t){var n,r,s,o;let i=Rh("Combobox.Option"),a=fb("Combobox.Option"),l=C.useId(),{id:c=`headlessui-combobox-option-${l}`,value:d,disabled:f=(s=(r=(n=i.virtual)==null?void 0:n.disabled)==null?void 0:r.call(n,d))!=null?s:!1,order:h=null,...p}=e,m=Cq(i.inputElement),g=i.virtual?i.activeOptionIndex===i.calculateIndex(d):i.activeOptionIndex===null?!1:((o=i.options[i.activeOptionIndex])==null?void 0:o.id)===c,b=i.isSelected(d),y=C.useRef(null),x=ld({disabled:f,value:d,domRef:y,order:h}),v=C.useContext(Dq),w=tl(t,y,v?v.measureElement:null),S=yt(()=>{a.setIsTyping(!1),a.onChange(d)});Bn(()=>a.registerOption(c,x),[x,c]);let N=C.useRef(!(i.virtual||i.__demoMode));Bn(()=>{if(!i.virtual&&!i.__demoMode)return Yi().requestAnimationFrame(()=>{N.current=!0})},[i.virtual,i.__demoMode]),Bn(()=>{if(N.current&&i.comboboxState===0&&g&&i.activationTrigger!==0)return Yi().requestAnimationFrame(()=>{var P,F;(F=(P=y.current)==null?void 0:P.scrollIntoView)==null||F.call(P,{block:"nearest"})})},[y,g,i.comboboxState,i.activationTrigger,i.activeOptionIndex]);let k=yt(P=>{P.preventDefault(),P.button===mM.Left&&(f||(S(),Sq()||requestAnimationFrame(()=>m()),i.mode===0&&a.closeCombobox()))}),j=yt(()=>{if(f)return a.goToOption(lr.Nothing);let P=i.calculateIndex(d);a.goToOption(lr.Specific,P)}),_=dRe(),D=yt(P=>_.update(P)),M=yt(P=>{if(!_.wasMoved(P)||f||g)return;let F=i.calculateIndex(d);a.goToOption(lr.Specific,F,0)}),T=yt(P=>{_.wasMoved(P)&&(f||g&&(i.optionsPropsRef.current.hold||a.goToOption(lr.Nothing)))}),O=C.useMemo(()=>({active:g,focus:g,selected:b,disabled:f}),[g,b,f]),A={id:c,ref:w,role:"option",tabIndex:f===!0?void 0:-1,"aria-disabled":f===!0?!0:void 0,"aria-selected":b,disabled:void 0,onMouseDown:k,onFocus:j,onPointerEnter:D,onMouseEnter:D,onPointerMove:M,onMouseMove:M,onPointerLeave:T,onMouseLeave:T};return hi()({ourProps:A,theirProps:p,slot:O,defaultTag:_Ie,name:"Combobox.Option"})}let MIe=pi(vIe),Mq=pi(NIe),Tq=pi(SIe),TIe=_Te,Rq=pi(jIe),Iq=pi(DIe),RIe=Object.assign(MIe,{Input:Tq,Button:Mq,Label:TIe,Options:Rq,Option:Iq});function IIe({elementId:e}){const t=C.useRef(!1);return C.useEffect(()=>{if(t.current)return;const n=document.getElementById(e);return n&&(n.classList.add("semaphor-scope"),t.current=!0),()=>{n&&(n.classList.remove("semaphor-scope"),t.current=!1)}},[e]),null}const AIe=C.memo(({option:e,currentStyle:t})=>u.jsxs(Iq,{style:{borderRadius:t==null?void 0:t.controlInputRadius},value:e,className:"group flex cursor-default select-none items-start gap-2 rounded-sm px-3 py-1.5 data-[focus]:bg-muted",children:[u.jsx(Er,{className:"invisible size-4 shrink-0 group-data-[selected]:visible"}),e.value]},e.id),(e,t)=>e.option.id===t.option.id&&e.option.value===t.option.value);function PIe({options:e,onChange:t,selectedOptions:n,multiple:r=!0,externalFilteredOptions:s,selectAllChecked:o,onSelectAllCheckedChange:i,inputClassName:a,renderFilterModeButton:l,showNegativeIndicator:c,isSearching:d,resultSource:f="local",searchError:h,query:p,onQueryChange:m,filterDataType:g,onEnterKey:b,activeFilterValue:y}){const[x,v]=C.useState(""),w=p!==void 0?p:x,S=m||v,N=te(A=>A.themeStyle),k=s||e;function j(A,P){if(P)return"";const F=[">","<",">=","<=","="];return(g?La(g):!1)&&y&&F.includes(y.operation)?`${y.operation}${y.values[0]}`:A!=null&&A.length?A==null?void 0:A.map(H=>H.value).join(", "):""}function _(A){Array.isArray(A)||(A=[A]),t(A)}function D(){return d||k&&k.length>0?null:u.jsx("div",{className:"relative cursor-default select-none px-4 py-2",children:"No records found."})}function M(){return d?u.jsxs("div",{className:"flex items-center gap-2 border-b border-b-muted px-4 py-2 text-xs text-muted-foreground",children:[u.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Searching..."]}):h&&w?u.jsx("div",{className:"border-b border-b-muted px-4 py-2 text-xs text-amber-600",children:"Search unavailable. Showing available results."}):null}function T(){return w||!(e!=null&&e.length)?null:u.jsxs("div",{className:"border-b border-b-muted px-4 py-2 text-xs text-muted-foreground",children:["Showing top ",e.length," values. Type to search more..."]})}function O(){return!r||!(k!=null&&k.length)?null:u.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-b-muted px-4 py-2",children:[l==null?void 0:l(),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{children:"All"}),u.jsx(dn,{className:"border-muted-foreground/50",checked:o,onCheckedChange:i})]})]})}return u.jsx(RIe,{multiple:r,value:n,onChange:_,onClose:()=>{S("")},by:(A,P)=>Array.isArray(A)||Array.isArray(P)?!1:!A||!P?A===P:A.id===P.id,children:({open:A})=>u.jsxs("div",{children:[u.jsxs("div",{className:"relative flex items-center gap-0.5",children:[c&&u.jsx("div",{className:"h-8 w-0.5 bg-red-400"}),u.jsx(Tq,{className:K("h-8 w-full rounded-sm border border-border bg-background py-1.5 pl-3 pr-8 text-sm","data-[focus]:outline-border-none focus:outline-none data-[focus]:outline-none data-[focus]:-outline-offset-2",a),style:{borderRadius:N==null?void 0:N.controlInputRadius},displayValue:P=>j(P,A),onChange:P=>S(P.target.value),onKeyDown:P=>{if(P.key==="Enter"&&b){const F=/^(>=|<=|>|<|=)/.test(w.trim()),V=g?La(g):!1;F&&V&&(P.preventDefault(),b()&&P.target.blur())}}}),u.jsx(Mq,{className:"group absolute inset-y-0 right-0 px-2.5",children:u.jsx(Rs,{className:"size-4 text-muted-foreground hover:text-foreground"})})]}),u.jsxs(Rq,{anchor:"bottom",transition:!0,style:{borderRadius:N==null?void 0:N.controlInputRadius},className:Nu("mt-1 !max-h-60 w-[var(--input-width)] overflow-y-auto rounded-sm border border-border bg-background p-1 text-sm [--anchor-gap:var(--spacing-1)] empty:invisible","transition duration-100 ease-in data-[leave]:data-[closed]:opacity-0"),children:[A&&u.jsx(IIe,{elementId:"headlessui-portal-root"}),M(),T(),D(),O(),k==null?void 0:k.map(P=>u.jsx(AIe,{option:P,currentStyle:N},P.id))]})]})})}const DF=[{value:"=",label:"Equal to",symbol:"="},{value:">",label:"Greater than",symbol:">"},{value:">=",label:"Greater than or equal",symbol:"≥"},{value:"<",label:"Less than",symbol:"<"},{value:"<=",label:"Less than or equal",symbol:"≤"},{value:"between",label:"Between",symbol:"⟷"},{value:"not between",label:"Not Between",symbol:"⇎"}],OIe=new Set(["=",">","<",">=","<=","between","not between"]);function FIe(e){return OIe.has(e)?e:">="}function $Ie({filter:e}){var v;const[t,n]=C.useState(">="),[r,s]=C.useState(""),[o,i]=C.useState(""),[a,l]=C.useState(""),[c,d]=C.useState(!0),f=C.useRef(!1),h=sm(r,300),p=sm(o,300),m=sm(a,300),g=te(w=>w.filterValues),b=te(w=>w.themeStyle),{addOrUpdateFilterValue:y,removeFilterValues:x}=Wt();return C.useEffect(()=>{const w=g==null?void 0:g.find(S=>S.filterId===e.id);if(w&&w.operation!=="in"){const S=FIe(w.operation);if(f.current||n(S),S==="between"||S==="not between"){const N=w.values[0],k=w.values[1];i(N!=null?String(N):""),l(k!=null?String(k):""),s("")}else{const N=w.values[0];s(N!=null?String(N):""),i(""),l("")}}else f.current||n(">="),s(""),i(""),l(""),d(!1)},[g,e.id]),C.useEffect(()=>{c&&(t==="between"||t==="not between"?p===o&&m===a&&d(!1):h===r&&d(!1))},[c,t,r,h,o,a,p,m]),C.useEffect(()=>{if(!c)if(t==="between"||t==="not between"){const w=p&&p.trim()!=="",S=m&&m.trim()!=="";if(!w||!S){!w&&!S&&(x(e.id),f.current=!1);return}const N=Number(p),k=Number(m);if(isNaN(N)||isNaN(k))return;const j={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:Ti(e),operation:t,values:[N,k]};y(j),f.current=!1}else{if(!h||h.trim()===""){x(e.id),f.current=!1;return}const w=Number(h);if(isNaN(w))return;const S={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:Ti(e),operation:t,values:[w]};y(S),f.current=!1}},[t,h,p,m,e.id,e.column,e.database,c,y,x,e]),u.jsxs("div",{className:"flex gap-2",children:[u.jsxs(lt,{value:t,onValueChange:w=>{f.current=!0,n(w)},children:[u.jsx(ot,{className:"h-8 w-16",style:{borderRadius:b==null?void 0:b.controlInputRadius},children:u.jsx("span",{className:"font-mono text-base",children:(v=DF.find(w=>w.value===t))==null?void 0:v.symbol})}),u.jsx(it,{children:DF.map(w=>u.jsx(me,{value:w.value,children:u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"font-mono",children:w.symbol}),u.jsx("span",{children:w.label})]})},w.value))})]}),t==="between"||t==="not between"?u.jsxs(u.Fragment,{children:[u.jsx(Un,{type:"number",placeholder:"Min",value:o,onChange:w=>i(w.target.value),className:"h-8 flex-1",style:{borderRadius:b==null?void 0:b.controlInputRadius}}),u.jsx(Un,{type:"number",placeholder:"Max",value:a,onChange:w=>l(w.target.value),className:"h-8 flex-1",style:{borderRadius:b==null?void 0:b.controlInputRadius}})]}):u.jsx(Un,{type:"number",placeholder:"Value",value:r,onChange:w=>s(w.target.value),className:"h-8 flex-1",style:{borderRadius:b==null?void 0:b.controlInputRadius}})]})}function LIe({filter:e}){const t=e.searchMode==="numeric",n=te(v=>v.themeStyle),{filteredRecords:r,isSingleSelect:s,allSelected:o,handleChange:i,handleSelectAll:a,handleApplyOperatorExpression:l,query:c,setQuery:d,isLoading:f,isFetching:h,isError:p,selectedRecords:m,isSearching:g,searchError:b,resultSource:y,activeFilterValue:x}=iM(e,{enableServerSearch:!0,searchDebounceMs:300,minSearchLength:2,searchThreshold:5});return f||h?u.jsx(Aa,{style:{borderRadius:n==null?void 0:n.controlInputRadius},className:"h-8 w-full bg-foreground/10"}):p?u.jsx("div",{className:"flex h-8 w-full items-center bg-muted px-2 text-sm",children:"Error"}):t?u.jsx($Ie,{filter:e}):u.jsx(PIe,{showNegativeIndicator:e.operation==="not in",renderFilterModeButton:()=>u.jsx(zIe,{filter:e}),inputClassName:"h-8",options:r,selectedOptions:m,onChange:i,multiple:!s,selectAllChecked:o,onSelectAllCheckedChange:a,isSearching:g,resultSource:y,searchError:b,query:c,onQueryChange:d,filterDataType:e.dataType,activeFilterValue:x,onEnterKey:l})}function zIe({filter:e}){const t=e.operation==="in"?"include":"exclude",{setFilterMode:n}=Wt();function r(){t==="include"?n(e.id,"exclude"):n(e.id,"include")}return u.jsx(ie,{onClick:r,variant:"secondary",size:"sm",className:K("h-6 text-xs hover:underline",{}),children:_v(t)})}function BIe({filter:e}){var o;const{filteredRecords:t,handleChange:n,selectedRecords:r}=iM(e);function s(i){n([{value:i,id:i}])}return u.jsx(qa,{onValueChange:s,value:((o=r==null?void 0:r[0])==null?void 0:o.value)||"",className:"mt-2 flex gap-3 overflow-x-auto",children:t==null?void 0:t.map(i=>u.jsxs("div",{className:"flex gap-2",children:[u.jsx(Cr,{value:i.value,id:"r1"}),u.jsx(ae,{className:"text-muted-foreground",htmlFor:"r1",children:i.value})]},i.value))})}function bM({filter:e}){return Zu(e.dataType)?u.jsx(MMe,{filter:e}):e.uiType==="radio"&&e.type==="single"?u.jsx(BIe,{filter:e}):u.jsx(LIe,{filter:e})}function VIe({frame:e}){const[t,n]=C.useState(!1),r=e==null?void 0:e.cards[0],{data:s,isPending:o,isError:i}=Ha(r),a=e==null?void 0:e.cards[1],{data:l,isLoading:c,isFetching:d}=Ha(a);return(a==null?void 0:a.type)!=="text"?u.jsx(Qm,{card:r,data:(s==null?void 0:s.records)||[],isPending:o,isError:i}):u.jsxs(Fs,{className:K("group relative overflow-y-auto",t?"m-4":"mx-0"),children:[t?u.jsx("div",{className:"overflow-y-auto break-words p-1",children:u.jsx(Xf,{card:a,data:(l==null?void 0:l.records)||[],isLoading:!1})}):u.jsx(Qm,{card:r,data:(s==null?void 0:s.records)||[],isPending:o,isError:i}),u.jsx("div",{className:K("fixed z-10",{"invisible bottom-4 right-4 group-hover:visible":t,"right-6 top-6":!t}),children:u.jsx(ib,{disabled:c||d,className:K("h-7 p-1"),pressed:t,onPressedChange:n,"aria-label":"Toggle bold",children:t?u.jsx(xte,{className:"size-4 text-muted-foreground/70"}):u.jsx(vte,{className:"size-4 text-muted-foreground/70"})})})]})}function Y0(e){return{clickFilter:Na,drillToDetail:Tg,drillThrough:Vx,drillToURL:Mg,drillDown:Cte,drillUp:Nte,dynamicDrill:nc,inlineDrill:Iv}[e]||Na}function cd(e){return{clickFilter:"Filter Dashboard",drillToDetail:"Show Details",drillThrough:"Navigate to Dashboard",drillToURL:"Open External Link",drillDown:"Drill Down",drillUp:"Drill Up",dynamicDrill:"Explore Field",inlineDrill:"Drill"}[e]||"Interaction"}function HIe(e,t,n,r,s){const o=Y0(e.mode),i=e.label||cd(e.mode),a=UIe(e,t,n,r,s);return{label:i,icon:o,targetInfo:a,interaction:e}}function UIe(e,t,n=0,r,s){var o,i,a,l,c,d;switch(e.mode){case"clickFilter":{if((o=e.applyToCardIds)!=null&&o.length){const f=e.applyToCardIds.length;return`Apply to ${f} ${f===1?"card":"cards"}`}return(i=e.excludeCardIds)!=null&&i.length?"Apply to all cards":"Apply to other cards"}case"drillToDetail":{if(e.targetInsightId)return"Drill into Insight";const f=((a=e.detailFields)==null?void 0:a.length)||0;return f>0?`Show ${f} detail ${f===1?"field":"fields"}`:"Show detail table"}case"drillThrough":return e.targetDashboardId,"Navigate to dashboard";case"drillToURL":{if(e.urlTemplate)try{return`Open ${new URL(e.urlTemplate).hostname}`}catch{return"Open external link"}return"Open external link"}case"drillDown":{if(e.hierarchyId&&t){const f=t.find(h=>h.id===e.hierarchyId);if(f&&f.steps.length>0){let h;if((f.type==="date"||f.baseField)&&r&&f.baseField){const p=zE(f,r,s),m=LE(f,p);h=m==null?void 0:m.field}else h=(l=f.steps[n])==null?void 0:l.field;return h?h.label:n>=f.steps.length?"End of path":f.label||"Drill by hierarchy"}}return"Drill to next level"}case"drillUp":{if(n>0&&e.hierarchyId&&t){const f=t.find(h=>h.id===e.hierarchyId);if(f&&f.steps.length>0){const h=(c=f.steps[n-2])==null?void 0:c.field;return h?`Back to ${h.label}`:`Back to All: ${f.label||"Data"}`}}return"Go back one level"}case"dynamicDrill":{if(e.drillField)return`Drill into ${e.drillField.label} data`;if((d=e.availableFields)!=null&&d.length){const f=e.availableFields.length;return`Choose from ${f} ${f===1?"dimension":"dimensions"}`}return"Explore dimension"}case"inlineDrill":{const f=e.inlineLimit||100,h=e.displayMode||"table";return`Show ${f} records as ${h}`}default:return""}}function WIe(e,t,n,r,s){return e.map(o=>HIe(o,t,n,r,s))}function qIe({open:e,onOpenChange:t,position:n,interactions:r,selectedConditions:s,onSelectInteraction:o,drillHierarchies:i,cardId:a,card:l}){const{currentDepth:c,breadcrumbs:d}=Xt(w=>{var S,N,k;return{currentDepth:a?((N=(S=w.interactionStates[a])==null?void 0:S.breadcrumbs)==null?void 0:N.length)??0:0,breadcrumbs:a?((k=w.interactionStates[a])==null?void 0:k.breadcrumbs)??[]:[]}}),f=E.useMemo(()=>WIe(r,i,c,l,d),[r,i,c,l,d]),h=E.useMemo(()=>{if(s.length===0)return"";const w=s[0];if(w.label){const S=w.label.split(/[=><]/);if(S.length>1)return S[1].trim()}return String(w.value)},[s]);if(E.useEffect(()=>{if(!e)return;const w=S=>{S.key==="Escape"&&t(!1)};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[e,t]),!e||!n)return null;const p=280,m=80+f.length*60,g=window.innerWidth,b=window.innerHeight;let y=n.x,x=n.y+8;y+p>g&&(y=Math.max(8,g-p-8)),x+m>b&&(x=Math.max(8,n.y-m-8));const v=u.jsxs("div",{className:"semaphor-scope",style:{position:"fixed",inset:0,pointerEvents:"none",background:"transparent"},children:[u.jsx("div",{className:"fixed inset-0",style:{zIndex:50,pointerEvents:"auto",background:"transparent"},onClick:()=>t(!1),"aria-hidden":"true"}),u.jsxs("div",{className:K("fixed rounded-lg border bg-popover shadow-lg","animate-in fade-in-0 zoom-in-95"),style:{left:`${y}px`,top:`${x}px`,zIndex:51,width:`${p}px`,maxHeight:"400px",pointerEvents:"auto"},role:"menu","aria-label":"Select interaction",children:[h&&u.jsxs("div",{className:"border-b px-4 py-3",children:[u.jsx("p",{className:"text-xs text-muted-foreground",children:"Selected"}),u.jsx("p",{className:"text-sm font-medium",children:h})]}),u.jsx("div",{className:"max-h-80 overflow-y-auto py-1",children:f.map((w,S)=>{var j;const N=w.icon,k=w.interaction.mode==="dynamicDrill"&&(S===0||((j=f[S-1])==null?void 0:j.interaction.mode)!=="dynamicDrill");return u.jsxs(E.Fragment,{children:[k&&u.jsx("div",{className:"border-t px-4 py-2",children:u.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"⚡ Explore Other Fields"})}),u.jsxs("button",{className:K("flex w-full items-start gap-3 px-4 py-3","hover:bg-accent hover:text-accent-foreground","cursor-pointer transition-colors","border-b text-left last:border-b-0"),onClick:()=>{o(w.interaction),t(!1)},role:"menuitem",children:[u.jsx("div",{className:"mt-0.5 flex-shrink-0",children:u.jsx(N,{className:"h-4 w-4 text-muted-foreground"})}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("p",{className:"mb-1 text-sm font-medium leading-none",children:w.label}),w.targetInfo&&u.jsx("p",{className:"text-xs text-muted-foreground",children:w.targetInfo})]})]})]},S)})})]})]});return _n.createPortal(v,document.body)}function YIe(e){const t=C.useRef([]),n=C.useRef(null),r=C.useRef(null),o=Di(e.interactionConfig).some(h=>h.mode==="clickFilter"&&h.trigger!==void 0),i=Ap(h=>h.registerClearBlurCallback),a=Ap(h=>h.unregisterCard);C.useEffect(()=>{const h=()=>{r.current&&f(r.current)};return i(e.id,h),()=>{a(e.id)}},[e.id,i,a]);function l({chart:h,selectedSegments:p,storedOriginalColorsRef:m}){if(!h||!h.canvas||!h.canvas.ownerDocument){console.warn("Chart or canvas is null when trying to toggle blur segments");return}const g=h.data.datasets;m.current||(m.current=g.map((y,x)=>h.getDatasetMeta(x).data.map(w=>w.options.backgroundColor)));const b=m.current;g.forEach((y,x)=>{const v=b[x];if(p.length===0){y.backgroundColor=[...v];return}y.backgroundColor=v.map((w,S)=>p.some(k=>k.datasetIndex===x&&k.dataIndex===S)?w:c(w,.2))});try{h.update()}catch(y){console.warn("Failed to update chart during blur toggle:",y)}}function c(h,p=.2){if(h.startsWith("rgba"))return h.replace(/[\d.]+\)$/g,`${p})`);if(h.startsWith("#")){const m=parseInt(h.slice(1,3),16),g=parseInt(h.slice(3,5),16),b=parseInt(h.slice(5,7),16);return`rgba(${m}, ${g}, ${b}, ${p})`}return h}function d(h,p){var v;if(!o||!p)return;r.current=p;const m=p.getElementsAtEventForMode(h,"nearest",{intersect:!0},!0);if(!m.length)return;const{datasetIndex:g,index:b}=m[0],y={datasetIndex:g,dataIndex:b};if(((v=h.native)==null?void 0:v.shiftKey)||h.shiftKey){const w=t.current.findIndex(S=>S.datasetIndex===g&&S.dataIndex===b);w>=0?t.current.splice(w,1):t.current.push(y)}else{const w=t.current.length===1&&t.current[0].datasetIndex===g&&t.current[0].dataIndex===b;t.current=w?[]:[y]}l({chart:p,selectedSegments:t.current,storedOriginalColorsRef:n})}function f(h){h&&(t.current=[],n.current&&l({chart:h,selectedSegments:[],storedOriginalColorsRef:n}))}return{handleChartClick:d,clearBlur:f}}function GIe({resolvedCardConfig:e,card:t,records:n,chart:r,clickEvent:s}){var c,d,f,h,p,m,g,b,y,x;const o=r==null?void 0:r.getElementsAtEventForMode(s,"nearest",{intersect:!0},!0);if(!o.length)return;const i=o[0].datasetIndex,a=o[0].index,l=(d=(c=o[0].element)==null?void 0:c.$context)==null?void 0:d.raw;console.log("datasetIndex",i),console.log("clickIndex",a),console.log("value",l);try{if(!(n!=null&&n.length))return;const{keys:v}=Qn(n),{groupByColumns:w=[],pivotByColumns:S=[],metricColumns:N=[]}=e||t.config,k=j=>w.find(_=>_.label===j)||S.find(_=>_.label===j)||N.find(_=>_.label===j);if(t.type==="map"){const j=v[0],_=((h=(f=l==null?void 0:l.feature)==null?void 0:f.properties)==null?void 0:h.name)||((m=(p=l==null?void 0:l.feature)==null?void 0:p.properties)==null?void 0:m.NAME),D=k(j);return!D||_==null?void 0:{conditions:[{field:D,operator:"=",value:_}]}}if(["pie","funnel","doughnut"].includes(t.type)){const j=v[0],_=v==null?void 0:v[1+i],D=k(j),M=k(_),T=(g=n==null?void 0:n[a])==null?void 0:g[j];if(!D||T==null){console.log("no dim field or value",j,T);return}return{conditions:[{field:D,operator:"=",value:T}],metrics:M?[{field:M,value:l}]:void 0}}if(["stackedBar","bar","line"].includes(t.type)){const j=v[0],_=k(j),D=(b=n==null?void 0:n[a])==null?void 0:b[j];if(!_||D==null){console.log("no dim field or value for stacked bar",j,D);return}const M=N[i]||N[0];if(!M){console.log("no metric field found");return}const T=S[0],A=Object.keys(n[0]).filter(H=>H!==j)[i],F=(A?(y=n==null?void 0:n[a])==null?void 0:y[A]:(x=n==null?void 0:n[a])==null?void 0:x[M.label])??l,V=[{field:_,operator:"=",value:D}];return T&&A&&V.push({field:T,operator:"=",value:A}),{conditions:V,metrics:[{field:M,value:F}]}}}catch(v){console.error("getClickContextFromChart error",v)}}function ZIe(e){return e&&typeof e=="object"&&"field"in e&&"operator"in e}function KIe(e){return e&&typeof e=="object"&&"filterId"in e&&"operation"in e&&"values"in e}function Aq({filters:e,filterDefinitions:t,contextMode:n,className:r,showLabel:s=!0,labelText:o="Applied Filters:",icon:i}){if(!e||e.length===0)return n==="none"?u.jsx("div",{className:"px-6 pb-4",children:u.jsx("span",{className:"text-xs text-muted-foreground",children:"No filters applied"})}):null;const l=e.map(c=>{var d,f;if(ZIe(c))return{fieldName:((d=c.field)==null?void 0:d.label)||((f=c.field)==null?void 0:f.name)||"Unknown",operator:c.operator,value:QIe(c)};if(KIe(c)){const h=t==null?void 0:t.find(p=>p.id===c.filterId);return{fieldName:(h==null?void 0:h.title)||c.name,operator:c.operation,value:XIe(c)}}else return{fieldName:"Unknown",operator:"=",value:String(c)}}).reduce((c,d)=>(c[d.fieldName]||(c[d.fieldName]=[]),c[d.fieldName].push(d),c),{});return u.jsxs("div",{className:r||"px-6 pb-4 border-b",children:[u.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s&&i&&u.jsxs("div",{className:"flex items-center gap-2 text-foreground/80",children:[i,u.jsx("span",{className:"text-sm font-medium whitespace-nowrap",children:o})]}),s&&!i&&u.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:o}),u.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(l).map(([c,d])=>u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsxs("span",{className:"text-sm font-medium",children:[c,":"]}),d.map((f,h)=>u.jsx(kt,{variant:"secondary",className:"border border-primary/20 bg-primary/10 text-primary",children:f.value},`${c}-${h}`))]},c))})]}),n&&u.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[n==="interactionFilters"&&u.jsx("span",{children:"Showing data filtered by interaction only"}),n==="full"&&u.jsx("span",{children:"Showing data with all dashboard filters + interaction filters"}),n==="none"&&u.jsx("span",{children:"Showing all data (no filters applied)"})]})]})}function XIe(e){const{values:t,operation:n}=e;return!t||t.length===0?"":n==="="||n==="!="||n===">"||n==="<"||n===">="||n==="<="?String(t[0]):n==="in"||n==="not in"?t.map(r=>String(r)).join(", "):(n==="between"||n==="not between")&&t.length===2?`${t[0]} - ${t[1]}`:String(t[0])}function QIe(e){const{operator:t,value:n}=e;if(e.label){const r=e.label.split(/[=><]/);if(r.length>1)return r[1].trim()}switch(t){case"=":return String(n);case"!=":return`≠ ${n}`;case">":return`> ${n}`;case"<":return`< ${n}`;case">=":return`≥ ${n}`;case"<=":return`≤ ${n}`;case"in":return Array.isArray(n)?n.join(", "):String(n);case"not in":return`not ${Array.isArray(n)?n.join(", "):n}`;case"contains":return`contains ${n}`;case"startsWith":return`starts with ${n}`;case"endsWith":return`ends with ${n}`;case"between":return Array.isArray(n)?`between ${n[0]} and ${n[1]}`:String(n);case"not between":return Array.isArray(n)?`not between ${n[0]} and ${n[1]}`:String(n);case"isNull":return"is null";case"isNotNull":return"is not null";default:return String(n)}}function JIe({cardId:e,className:t}){const n=Xt(d=>d.interactionStates[e]),r=Xt(d=>d.popInteractionStep),s=Xt(d=>d.resetInteractionState),o=(n==null?void 0:n.breadcrumbs)??[];if(n==null||n.hierarchyId,o.length===0)return null;const i=d=>{const f=o.length-d-1;for(let h=0;h<f;h++)r(e)},a=()=>{s(e)},l=d=>(d.sourceFilterGroups[0],d.toField?d.toField.label||d.toField.name:"Drill Step"),c=d=>{const f=d.sourceFilterGroups.flatMap(h=>h.filters);return u.jsxs("div",{className:"max-w-xs space-y-2 text-sm",children:[f.length>0&&u.jsx(Aq,{filters:f,className:"pb-2",labelText:"Drill Down Filters:",icon:u.jsx(Ete,{className:"h-4 w-4 text-foreground/80"})}),d.granularity&&u.jsxs("div",{className:"flex items-center gap-2 pb-2",children:[u.jsx(so,{className:"h-4 w-4 text-foreground/80"}),u.jsxs("span",{className:"text-sm font-medium text-foreground/80",children:["Granularity: ",d.granularity]})]}),d.metric&&u.jsxs("div",{className:"flex items-center gap-2 pb-2",children:[u.jsx(fte,{className:"h-4 w-4 text-foreground/80"}),u.jsxs("span",{className:"text-sm font-medium text-foreground/80",children:["Value:"," ",d.metric.formattedValue||d.metric.value]})]})]})};return u.jsx(Yr,{children:u.jsxs("div",{className:K("flex items-center gap-1 text-sm",t),children:[u.jsx(er,{children:u.jsx(tr,{asChild:!0,children:u.jsx("button",{className:"flex items-center p-0 text-muted-foreground hover:text-foreground",onClick:a,"aria-label":"Reset drill path",children:u.jsx($$,{className:"h-3.5 w-3.5"})})})}),u.jsx(Ba,{className:"ml-0.5 h-3 w-3 text-muted-foreground"}),u.jsx("div",{className:"flex items-center",children:o.map((d,f)=>u.jsxs("div",{className:"flex items-center",children:[f>0&&u.jsx(Ba,{className:"mx-1 h-3 w-3 text-muted-foreground"}),u.jsxs(er,{delayDuration:0,children:[u.jsx(tr,{asChild:!0,children:u.jsx(ie,{variant:"link",size:"sm",className:"h-6 px-1 text-muted-foreground no-underline hover:text-foreground hover:no-underline",onClick:()=>i(f),"aria-label":`Go back to: ${l(d)}`,children:l(d)})}),u.jsx(eM,{className:"ml-4",side:"bottom",children:c(d)})]})]},f))})]})})}function eAe(e){switch(e){case"content-only":return{showHeader:!1,showTitle:!1,showDescription:!1,showTabs:!1,showFooter:!1,showFilters:!1,showBreadcrumbs:!1,showRefreshIndicator:!1,showFilterInfo:!1};case"print":return{showHeader:!0,showTitle:!0,showDescription:!0,showTabs:!1,showFilters:!1,showBreadcrumbs:!1,showRefreshIndicator:!1,showFilterInfo:!1,showTableToolbar:!1,showColumnSettings:!1};case"embed":return{showHeader:!1,showTitle:!0,showDescription:!1,showTabs:!0,showFooter:!1,showFilters:!1,showBreadcrumbs:!1,showRefreshIndicator:!1,showFilterInfo:!1};case"table-print":return{showHeader:!1,showTitle:!0,showDescription:!1,showTabs:!1,showFooter:!1,showFilters:!1,showBreadcrumbs:!1,showRefreshIndicator:!1,showFilterInfo:!1,showPagination:!1,showTableToolbar:!1,showColumnSettings:!1};case"full":default:return{showHeader:!0,showTitle:!0,showDescription:!0,showTabs:!0,showFooter:!0,showFilters:!0,showBreadcrumbs:!0,showRefreshIndicator:!0,showFilterInfo:!0}}}function yM({children:e,displayPreferences:t={mode:"full"},currentUser:n}){const r=C.useMemo(()=>{const s=t.mode||"full",o=eAe(s),i=lz(n||null),a={mode:s,overrides:{...o,...i,...t.overrides}};return{displayPreferences:a,shouldShowElement:c=>{var d;return((d=a.overrides)==null?void 0:d[c])??!0}}},[t,n]);return u.jsx(rz.Provider,{value:r,children:e})}function MF({card:e,frame:t}){var ne,oe,de,le,ke,ye,Pe,Ve,dt;const{customCards:n,placeholders:r,tokenProps:s}=Ye(),{shouldShowElement:o}=sc(),i=Xt(ue=>ue.interactionStates[e.id]),a=((ne=i==null?void 0:i.breadcrumbs)==null?void 0:ne.length)>0,l=te(ue=>ue.themeStyle),c=te(ue=>ue.selectedSheetId),d=te(ue=>ue.isDashboardEditing);te(ue=>ue.selectedLensId);const f=te(ue=>ue.dashboard.filters),h=f==null?void 0:f.find(ue=>ue.id===t.filterId&&!ue.hide),{setCardTitle:p,setCardDescription:m,setSelectedFrameId:g,updateFilter:b}=Wt(),{updateFrame:y}=Wt(),{handleChartClick:x}=YIe(e),v=o("showHeader")&&(((oe=e.customCardPreferences)==null?void 0:oe.showCardHeader)??!0),{isError:w,isLoading:S,isFetching:N,cfg:k,isPending:j,data:_,handleDatapointClick:D,pagination:M}=qg(e),[T,O]=C.useState({open:!1,position:null,interactions:[],context:null}),{breadcrumbs:A,hierarchyId:P}=Xt(ue=>{var Ne,et;return{breadcrumbs:((Ne=ue.interactionStates[e.id])==null?void 0:Ne.breadcrumbs)??[],hierarchyId:(et=ue.interactionStates[e.id])==null?void 0:et.hierarchyId}}),F=(ue,Ne,et)=>{var Oe;const We=A.length>0?[{mode:"drillUp",trigger:(Oe=ue[0])==null?void 0:Oe.trigger,label:"Drill Up",hierarchyId:P}]:[],re=[];for(const Me of ue)if(Me.mode==="dynamicDrill"&&Me.availableFields){const nt=Me.availableFields.filter(Dt=>!A.some(ft=>{var Ot;return((Ot=ft.toField)==null?void 0:Ot.id)===Dt.id}));for(const Dt of nt)re.push({mode:"dynamicDrill",trigger:Me.trigger,drillField:Dt,label:Dt.label,availableFields:Me.availableFields})}const fe=ue.filter(Me=>Me.mode!=="dynamicDrill"),De=[...We,...fe,...re];O({open:!0,position:et||{x:0,y:0},interactions:De,context:Ne})},{handlePointerInteraction:V,applySelectedInteraction:H}=eee(e,t.id,c||"",F),$=E3(e),I=C.useMemo(()=>{var ue;return e.type!=="pivotTable"||!((ue=_==null?void 0:_.records)!=null&&ue.length)?null:{records:_.records,columnSubtotalMeta:_.columnSubtotalMeta,subtotalColumns:_.subtotalColumns||[],pivotSchema:_.pivotSchema||[],groupByColumns:_.groupByColumns}},[e.type,_==null?void 0:_.records,_==null?void 0:_.columnSubtotalMeta,_==null?void 0:_.subtotalColumns,_==null?void 0:_.pivotSchema,_==null?void 0:_.groupByColumns]),B=Nh(e,I),L=(ue,Ne)=>{const et={...e,paginationConfig:{page:ue+1,pageSize:Ne}},We={...t,cards:t.cards.map(re=>re.id===e.id?et:re)};c&&y(c,We)};function R(ue,Ne){ue.stopPropagation();const et=GIe({resolvedCardConfig:$,card:e,records:(_==null?void 0:_.records)||[],chart:Ne,clickEvent:ue.nativeEvent});if(!et)return;const We=Di(e.interactionConfig),re=BE(We,et),fe=re.length===1&&re[0].mode==="clickFilter",De=re.some(nt=>nt.mode==="dynamicDrill"),Oe=re.length>1||De;ue.button===0&&fe&&!Oe&&x(ue.nativeEvent,Ne);const Me={shift:ue.shiftKey,ctrl:ue.ctrlKey,meta:ue.metaKey};ue.button===0?V({context:et,gesture:"leftClick",modifierKeys:Me,position:{x:ue.clientX,y:ue.clientY}}):ue.button===2&&V({context:et,gesture:"rightClick",modifierKeys:Me,position:{x:ue.clientX,y:ue.clientY}})}function W(){var ue,Ne,et;if(n&&n.length>0){const We=n.find(re=>re.cardId===e.id);if(We&&We.replaceDefault){const re=We.content;if(re)return u.jsx(re,{card:e})}}if(e.type==="kpi"){if(((ue=t==null?void 0:t.cards)==null?void 0:ue.length)===1)return u.jsx(Qm,{card:e,data:w?[]:(_==null?void 0:_.records)||[],isPending:j,isError:w});if(((Ne=t==null?void 0:t.cards)==null?void 0:Ne.length)>1)return u.jsx(VIe,{frame:t})}return e.type==="text"&&((et=t==null?void 0:t.cards)==null?void 0:et.length)===1?u.jsx(Fs,{className:"my-4 overflow-y-auto break-words px-4",children:u.jsx(Xf,{isLoading:S||N,card:e,data:(_==null?void 0:_.records)||[]})}):ee}function Y(){if(w)return u.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[u.jsx(Pv,{className:"size-8 text-destructive"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Error fetching data. Check your card settings."})]});if((S||N)&&e.type!=="table")return u.jsx("div",{className:"flex h-full w-full items-center justify-center",children:u.jsx($u,{size:"md",color:"muted","aria-label":"Loading data"})});if(_!=null&&_.records&&(_==null?void 0:_.records.length)===0)return r!=null&&r.NoRecords?u.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:r.NoRecords}):u.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[u.jsx(uj,{className:"size-8 text-muted-foreground"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"No results to display"})]});if(e.type==="table")return u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(Jg,{card:e,data:(_==null?void 0:_.records)||[],paginationMetadata:M,onPaginationChange:L,isLoading:S||N})});if(e.type==="pivotTable"&&B)return u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(tb,{card:e,data:B.data,options:B.options,onAggregationChange:ue=>{const Ne=Uk(ue,e.config),et={...e,config:Ne},We={...t,cards:t.cards.map(re=>re.id===e.id?et:re)};c&&y(c,We)},onAggregationLabelChange:ue=>{const Ne=YW(ue,e.config),et={...e,config:Ne},We={...t,cards:t.cards.map(re=>re.id===e.id?et:re)};c&&y(c,We)}})});if(e.type==="aggregateTable")return u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(Lw,{card:e,data:(_==null?void 0:_.records)||[],groupByColumns:_==null?void 0:_.groupByColumns,pivotSchema:_==null?void 0:_.pivotSchema,paginationMetadata:M,onPaginationChange:L,onAggregationChange:ue=>{const Ne=Uk(ue,e.config),et={...e,config:Ne},We={...t,cards:t.cards.map(re=>re.id===e.id?et:re)};c&&y(c,We)},isLoading:S||N})});if(e.type==="text")return u.jsx(Fs,{className:"overflow-y-auto break-words pr-2",children:u.jsx(Xf,{isLoading:S||N,card:e,data:(_==null?void 0:_.records)||[]})});if(e.type==="custom")return u.jsx(hc,{FallbackComponent:Vw,children:u.jsx(LD,{frame:t,card:e})});if(n&&n.length>0){const ue=n.find(Ne=>Ne.cardId===e.id);if(ue&&ue.content){const Ne=ue.content;return u.jsx(Ne,{card:e})}}if(k)return u.jsx(eb,{cfg:k,onChartClick:R,onDatapointClick:D})}function Z(){if(n&&n.length>0){const ue=n.find(Ne=>Ne.cardId===e.id);if(ue&&ue.footer){const Ne=ue.footer;if(Ne)return u.jsx(Ne,{card:e})}}return null}function U(){var et;const ue=t.cards.filter(We=>{var re;return!((re=We.tabTitle)!=null&&re.endsWith("__Header"))&&(We.displayTab===!0||We.displayTab===void 0)}),Ne=l==null?void 0:l.controlInputRadius;return u.jsx(fo,{value:t.activeCardId,className:"flex items-center justify-end gap-3",onValueChange:We=>{const re={...t,activeCardId:We};y(c,re)},children:u.jsx(Ls,{style:{borderRadius:l==null?void 0:l.controlInputRadius},className:"flex-end flex h-9 flex-wrap items-center border border-border bg-background p-0",children:(et=t.cards.filter(We=>{var re;return!((re=We.tabTitle)!=null&&re.endsWith("__Header"))&&(We.displayTab===!0||We.displayTab===void 0)}))==null?void 0:et.map((We,re)=>u.jsx(bn,{className:K("h-full items-center rounded-none data-[state=active]:bg-muted data-[state=active]:shadow-none",{"border-r":re!==ue.length-1}),style:{borderTopLeftRadius:re===0?Ne:0,borderTopRightRadius:re===ue.length-1?Ne:0,borderBottomLeftRadius:re===0?Ne:0,borderBottomRightRadius:re===ue.length-1?Ne:0},value:We.id,children:We.tabTitle||We.title},We.id))})})}function z(){var Ne,et,We,re;let ue=t.cards.find(fe=>fe.type==="kpi"&&fe.tabTitle===`${e.tabTitle}__Header`);return ue||(ue=t.cards.find(fe=>fe.type==="kpi"&&fe.tabTitle==="All__Header")),ue?u.jsx("div",{className:"flex items-end gap-2",children:u.jsx(CMe,{renderFilterInfo:()=>{var fe,De,Oe,Me;return o("showFilterInfo")&&((De=(fe=e.preferences)==null?void 0:fe.displayOptions)==null?void 0:De.showFilterInfo)!==!1?u.jsx(Hk,{cardId:e.id,cardFilters:(Oe=e.config)==null?void 0:Oe.filters,cardFilterCount:U0(((Me=e.config)==null?void 0:Me.filters)||null)}):null},card:ue})}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{role:"card-title-container",className:"flex h-7 items-center gap-2",children:[o("showTitle")&&u.jsx(Vi,{className:K("text-base",{}),children:u.jsx(Ro,{value:e.title,onSave:fe=>p(c,e.id,fe),isEditable:d,placeholder:"Add title",displayClassName:"text-base font-semibold",inputClassName:"text-base font-semibold"})}),o("showTitle")&&(d||e.info)&&u.jsx(qW,{card:e}),o("showRefreshIndicator")&&e.refreshInterval&&u.jsxs(er,{children:[u.jsx(tr,{className:"pr-1",children:u.jsx("div",{className:K("h-2 w-2 rounded-full bg-green-500 transition-opacity",{"opacity-10":S||N})})}),u.jsx(fr,{side:"right",align:"center",children:u.jsx("p",{className:"text-xs",children:`Realtime (${e==null?void 0:e.refreshInterval})`})})]}),o("showFilterInfo")&&((et=(Ne=e.preferences)==null?void 0:Ne.displayOptions)==null?void 0:et.showFilterInfo)!==!1&&u.jsx(Hk,{cardId:e.id,cardFilters:(We=e.config)==null?void 0:We.filters,cardFilterCount:U0(((re=e.config)==null?void 0:re.filters)||null)})]}),u.jsxs("div",{"data-content":"card-description-and-breadcrumb",className:"flex h-6 items-center overflow-y-auto",children:[!a&&o("showDescription")&&u.jsx("div",{className:K("text-sm text-muted-foreground",{}),children:u.jsx(Ro,{value:(e==null?void 0:e.description)||"",onSave:fe=>m(c,e.id,fe),isEditable:d,placeholder:"Add description",displayClassName:"text-sm text-muted-foreground",inputClassName:"text-sm"})}),a&&o("showBreadcrumbs")&&u.jsx(JIe,{cardId:e.id})]})]})}if(!e.id)return null;const q=((le=(de=e.preferences)==null?void 0:de.displayOptions)==null?void 0:le.showChrome)??!0,G=((ye=(ke=e.preferences)==null?void 0:ke.displayOptions)==null?void 0:ye.allowScroll)??!0,ee=q?u.jsxs(u.Fragment,{children:[v?u.jsx(Bi,{children:u.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[u.jsx("div",{className:"flex-1 basis-0 scroll-pb-2 overflow-x-auto",role:"header-container",children:z()}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx("div",{children:h&&o("showFilters")&&u.jsxs("div",{style:{borderRadius:(Ve=(Pe=l==null?void 0:l.chart)==null?void 0:Pe.options)==null?void 0:Ve.borderRadius},"data-content":"frame-filter-container",className:"flex shrink-0 items-center",children:[!Zu(h.dataType)&&u.jsx(ae,{className:"my-1 shrink-0 px-3",children:u.jsx(Ro,{value:h.title||h.column,onSave:ue=>b({...h,title:ue}),isEditable:d,placeholder:"Filter",displayClassName:"text-sm",inputClassName:"text-sm"})}),u.jsx(bM,{filter:h})]})}),t.cards.length>1&&o("showTabs")&&U()]})]})}):u.jsx("div",{className:"h-8"}),u.jsx(za,{"data-role":"card-content",className:"relative flex min-h-0 grow flex-col",children:Y()}),o("showFooter")&&u.jsx(f$,{children:Z()})]}):Y(),Q=()=>q&&G?"flex h-full flex-col":q&&!G?"flex h-full flex-col overflow-hidden":!q&&!G?"h-full":"h-full overflow-auto";return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:K(Q(),{"animate-pulse":S||N}),children:W()}),T.context&&u.jsx(qIe,{open:T.open,onOpenChange:ue=>{O(Ne=>({...Ne,open:ue}))},position:T.position,interactions:T.interactions,selectedConditions:T.context.conditions,drillHierarchies:(dt=e.interactionConfig)==null?void 0:dt.drillHierarchies,cardId:e.id,card:e,onSelectInteraction:ue=>{T.context&&H(ue,T.context),O({open:!1,position:null,interactions:[],context:null})}})]})}function Pq({card:e,frame:t}){return e.displayPreferences?u.jsx(yM,{displayPreferences:e.displayPreferences,children:u.jsx(MF,{card:e,frame:t})}):u.jsx(MF,{card:e,frame:t})}function tAe({card:e,frame:t,showTitle:n=!0}){const{isError:r,isLoading:s,isFetching:o,cfg:i,data:a,pagination:l}=qg(e),c=C.useMemo(()=>{var h;return e.type!=="pivotTable"||!((h=a==null?void 0:a.records)!=null&&h.length)?null:{records:a.records,columnSubtotalMeta:a.columnSubtotalMeta,subtotalColumns:a.subtotalColumns||[],pivotSchema:a.pivotSchema||[],groupByColumns:a.groupByColumns}},[e.type,a==null?void 0:a.records,a==null?void 0:a.columnSubtotalMeta,a==null?void 0:a.subtotalColumns,a==null?void 0:a.pivotSchema,a==null?void 0:a.groupByColumns]),d=Nh(e,c);if(s||o)return u.jsxs("div",{className:"flex h-full grow flex-col items-center justify-center gap-4 p-12",children:[u.jsx(fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading visual..."})]});if(r)return u.jsx("div",{className:"flex flex-col items-center justify-center gap-2 p-12",children:u.jsx("p",{className:"text-sm font-medium text-destructive",children:"Failed to load visual"})});function f(){return e.type==="kpi"?u.jsx(Qm,{card:e,data:(a==null?void 0:a.records)||[],isPending:s||o}):e.type==="table"?u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(Jg,{card:e,data:(a==null?void 0:a.records)||[],isLoading:s||o,paginationMetadata:l})}):e.type==="pivotTable"&&d?u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(tb,{card:e,data:(a==null?void 0:a.records)||[],onAggregationChange:()=>{},onAggregationLabelChange:()=>{}})}):e.type==="aggregateTable"?u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(Lw,{card:e,data:(a==null?void 0:a.records)||[],groupByColumns:a==null?void 0:a.groupByColumns,pivotSchema:a==null?void 0:a.pivotSchema,paginationMetadata:l,onAggregationChange:()=>{},isLoading:s||o})}):e.type==="text"?u.jsx(Fs,{className:"overflow-y-auto break-words pr-2",children:u.jsx(Xf,{isLoading:s||o,card:e,data:(a==null?void 0:a.records)||[]})}):e.type==="custom"?u.jsx(hc,{FallbackComponent:Vw,children:u.jsx(LD,{frame:t,card:e})}):i?u.jsx(eb,{cfg:i,onChartClick:()=>{},onDatapointClick:()=>{}}):null}return u.jsxs("div",{className:"flex h-full w-full flex-col",children:[n&&e.title&&u.jsxs("div",{className:"border-b px-4 py-2",children:[u.jsx("h3",{className:"text-lg font-medium",children:e.title}),e.description&&u.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:e.description})]}),u.jsx("div",{className:"min-h-0 flex-1 p-4",children:f()})]})}function Oq({insightId:e,filters:t,contextMode:n}){const{data:r,isLoading:s,isError:o,error:i}=pj(e,{enabled:!!e}),a=Xt(f=>f.setInteractionState),l=Xt(f=>f.resetInteractionState),c=C.useMemo(()=>{var h;if(!r)return null;const f=(r==null?void 0:r.frameObject)??((h=r==null?void 0:r.visual)==null?void 0:h.frameObject);if(!f)return null;if(typeof f=="string")try{return JSON.parse(f)}catch{return null}return f},[r]),d=C.useMemo(()=>{var f;return(f=c==null?void 0:c.cards)!=null&&f.length?c.activeCardId&&c.cards.find(h=>h.id===c.activeCardId)||c.cards[0]:null},[c]);return C.useEffect(()=>{if(!d)return;if(n==="none"||!(t!=null&&t.length)){const m={...Go(),contextMode:n};a(d.id,m);return}const h={sourceCardId:"drill-to-insight",interactionMode:"clickFilter",filterGroups:[{filters:t}],applyToCardIds:[d.id]},p={...Go(),appliedClickFilters:[h],contextMode:n};return a(d.id,p),()=>{l(d.id)}},[d,t,n,a,l]),s?u.jsxs("div",{className:"flex h-full grow flex-col items-center justify-center gap-4 p-12",children:[u.jsx(fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading visual..."})]}):o?u.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 p-12",children:[u.jsx("p",{className:"text-sm font-medium text-destructive",children:"Failed to load insight"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:i instanceof Error?i.message:"Unknown error"})]}):!c||!d?u.jsx("div",{className:"flex items-center justify-center p-12",children:u.jsx("p",{className:"text-sm text-muted-foreground",children:"This insight has no visual data to display"})}):u.jsx("div",{className:"h-full w-full",children:u.jsx(tAe,{card:d,frame:c,showTitle:!1})})}function nAe({filters:e,contextMode:t}){if(!e||e.length===0)return t==="none"?u.jsxs(kt,{variant:"outline",className:"gap-1 whitespace-nowrap",children:[u.jsx(Na,{className:"h-3 w-3"}),"No filters"]}):null;const n=e.reduce((s,o)=>{var a,l;const i=((a=o.field)==null?void 0:a.label)||((l=o.field)==null?void 0:l.name)||"Unknown";return s[i]||(s[i]=[]),s[i].push(o),s},{});e.length;const r=Object.keys(n).length;return u.jsx(Yr,{children:u.jsxs(er,{delayDuration:200,children:[u.jsx(tr,{asChild:!0,children:u.jsxs(kt,{variant:"secondary",className:"cursor-help gap-1 whitespace-nowrap border border-blue-500/20 bg-blue-500/10 text-blue-700 dark:text-blue-300",children:[u.jsx(Na,{className:"h-3 w-3"}),r," ",r===1?"filter":"filters"]})}),u.jsx(fr,{side:"bottom",align:"start",className:"max-w-md",children:u.jsxs("div",{className:"space-y-2",children:[u.jsx("div",{className:"text-sm font-medium",children:"Applied Filters"}),u.jsx("div",{className:"space-y-1.5",children:Object.entries(n).map(([s,o])=>u.jsxs("div",{className:"text-xs",children:[u.jsxs("span",{className:"font-medium",children:[s,":"]})," ",o.map((i,a)=>u.jsxs("span",{children:[rAe(i),a<o.length-1?", ":""]},a))]},s))}),t&&u.jsx("div",{className:"border-t pt-2 text-xs text-muted-foreground",children:sAe(t)})]})})]})})}function rAe(e){const{operator:t,value:n}=e;if(e.label){const r=e.label.split(/[=><]/);if(r.length>1)return r[1].trim()}switch(t){case"=":return String(n);case"!=":return`≠ ${n}`;case">":return`> ${n}`;case"<":return`< ${n}`;case">=":return`≥ ${n}`;case"<=":return`≤ ${n}`;case"in":return Array.isArray(n)?n.join(", "):String(n);case"not in":return`not ${Array.isArray(n)?n.join(", "):n}`;case"contains":return`contains ${n}`;case"startsWith":return`starts with ${n}`;case"endsWith":return`ends with ${n}`;case"between":return Array.isArray(n)?`${n[0]}-${n[1]}`:String(n);case"not between":return Array.isArray(n)?`not ${n[0]}-${n[1]}`:String(n);case"isNull":return"is null";case"isNotNull":return"is not null";default:return String(n)}}function sAe(e){switch(e){case"filters":case"interactionFilters":return"Showing data filtered by interaction only";case"full":return"Showing data with all dashboard filters + interaction filters";case"none":return"Showing all data (no filters applied)"}}function Fq(e,t={}){const{enabled:n=!0}=t,{data:r}=pj(e,{enabled:n&&!!e});return C.useMemo(()=>{var l,c;if(!r)return{title:"",description:void 0};const o=(r==null?void 0:r.frameObject)??((l=r==null?void 0:r.visual)==null?void 0:l.frameObject);if(!o)return{title:"",description:void 0};let i=null;if(typeof o=="string")try{i=JSON.parse(o)}catch{return{title:"",description:void 0}}else i=o;if(!((c=i==null?void 0:i.cards)!=null&&c.length))return{title:"",description:void 0};const a=i.activeCardId&&i.cards.find(d=>d.id===i.activeCardId)||i.cards[0];return{title:a.title,description:a.description}},[r])}function oAe({cardId:e,children:t}){const n=Xt(o=>o.replacedCards[e]),r=Xt(o=>o.restoreCard),s=Fq((n==null?void 0:n.insightId)||"",{enabled:!!(n!=null&&n.insightId)});return n?u.jsxs("div",{className:"flex h-full w-full flex-col",children:[u.jsxs("div",{className:"border-b bg-muted/30",children:[u.jsx("div",{className:"flex items-baseline gap-2 px-5 pb-2 pt-4",children:s.title&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"truncate text-sm font-semibold",children:s.title}),s.description&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"text-muted-foreground",children:"-"}),u.jsx("span",{className:"truncate text-xs text-muted-foreground",children:s.description})]})]})}),u.jsxs("div",{className:"flex items-center gap-3 px-4 pb-2",children:[u.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>r(e),className:"flex-shrink-0 gap-1",children:[u.jsx(p$,{className:"h-4 w-4"}),"Back"]}),u.jsx(nAe,{filters:n.filters,contextMode:n.contextMode})]})]}),u.jsx("div",{className:"min-h-0 flex-1",children:u.jsx(Oq,{insightId:n.insightId,filters:n.filters,contextMode:n.contextMode})})]}):u.jsx(u.Fragment,{children:t})}function iAe({frame:e,footer:t,className:n,...r}){var w,S;const s=C.useRef(null),[o,i]=C.useState(!1),a=te(N=>N.themeStyle),l=te(N=>N.isVisualEditing),c=te(N=>N.selectedFrameId),d=te(N=>N.isDashboardEditing),{setSelectedFrameId:f}=Wt(),{clearSelectedVisual:h}=_g(),{setSelectedConnectionId:p,setSelectedDatabaseName:m,setSelectedSchemaName:g,setSelectedTableName:b,setCard:y}=Kr();C.useEffect(()=>{if(c===e.id&&d&&!l){const N=s==null?void 0:s.current;N==null||N.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}},[c,e.id,d,l,s]);const x=e.cards.find(N=>N.id===e.activeCardId);function v(N){N.stopPropagation(),f(e.id),h(),x&&y(x),x!=null&&x.connectionId&&p(x==null?void 0:x.connectionId),x!=null&&x.lastSelectedDatabase&&m(x==null?void 0:x.lastSelectedDatabase),x!=null&&x.lastSelectedSchema&&g(x==null?void 0:x.lastSelectedSchema),x!=null&&x.lastSelectedTable&&b(x==null?void 0:x.lastSelectedTable)}return u.jsx(hc,{FallbackComponent:zD,children:u.jsxs("div",{tabIndex:-1,ref:s,role:"card-frame","data-frame-id":e.id,"data-active-card-id":x==null?void 0:x.id,onClick:v,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{borderRadius:a==null?void 0:a.cardBorderRadius},className:K("relative flex h-full flex-col rounded-sm border bg-background shadow-sm",{"border-dashed border-foreground/50":c===e.id&&d},a==null?void 0:a.dashboardCard,n,"semaphor-card-frame"),...r,children:[(d||((S=(w=x==null?void 0:x.preferences)==null?void 0:w.displayOptions)==null?void 0:S.showCardToolbar)!==!1)&&u.jsx(jW,{frame:e,isHovered:o}),x&&u.jsx(oAe,{cardId:x.id,children:u.jsx(Pq,{card:x,frame:e},x.id)})]})})}function aAe({label:e,onCheckedChange:t,checked:n}){return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(dn,{onCheckedChange:t,id:"terms",checked:n}),u.jsx("label",{htmlFor:"terms",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})]})}function xM(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,o;for(o=0;o<r.length;o++)s=r[o],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var lAe=["color"],cAe=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=xM(e,lAe);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),uAe=["color"],$q=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=xM(e,uAe);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),dAe=["color"],fAe=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=xM(e,dAe);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});function nh({text:e,className:t}){const[n,r]=C.useState(!1);return u.jsx(ie,{className:K("h-7 w-fit px-1 font-mono text-xs text-muted-foreground/70",t),variant:"ghost",size:"icon",onClick:()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>{r(!1)},1e3)},children:n?u.jsx($q,{className:"size-3.5"}):u.jsx(nj,{className:"size-3.5"})})}function hAe({filter:e,onUpdate:t}){const[n,r]=C.useState(""),s=te(x=>x.dashboard.sheets)||[],o=te(x=>x.selectedSheetId),i=C.useMemo(()=>{const x=[];return s==null||s.forEach(v=>{var w;(w=v.frames)==null||w.forEach(S=>{var N;(N=S.cards)==null||N.forEach(k=>{x.push({...k,sheetId:v.id,sheetTitle:v.title||v.id})})})}),x},[s]),a=()=>e.applyToSheetIds!==void 0?"specific-sheets":e.excludeSheetIds!==void 0?"all-except-specific":"all-sheets",l=()=>e.applyToCardIds!==void 0?"specific-cards":e.excludeCardIds!==void 0?"all-except-specific":"all-cards",c=x=>{const v={};switch(x){case"all-sheets":v.applyToSheetIds=void 0,v.excludeSheetIds=void 0;break;case"specific-sheets":v.applyToSheetIds=[],v.excludeSheetIds=void 0;break;case"all-except-specific":v.applyToSheetIds=void 0,v.excludeSheetIds=[];break}t(v)},d=x=>{const v={};switch(x){case"all-cards":v.applyToCardIds=void 0,v.excludeCardIds=void 0;break;case"specific-cards":v.applyToCardIds=[],v.excludeCardIds=void 0;break;case"all-except-specific":v.applyToCardIds=void 0,v.excludeCardIds=[];break}t(v)},f=(x,v)=>{if(v==="specific-sheets"){const w=e.applyToSheetIds||[],S=w.includes(x)?w.filter(N=>N!==x):[...w,x];t({applyToSheetIds:S})}else if(v==="all-except-specific"){const w=e.excludeSheetIds||[],S=w.includes(x)?w.filter(N=>N!==x):[...w,x];t({excludeSheetIds:S})}},h=(x,v)=>{if(v==="specific-cards"){const w=e.applyToCardIds||[],S=w.includes(x)?w.filter(N=>N!==x):[...w,x];t({applyToCardIds:S})}else if(v==="all-except-specific"){const w=e.excludeCardIds||[],S=w.includes(x)?w.filter(N=>N!==x):[...w,x];t({excludeCardIds:S})}},p=()=>{const x=a();return x==="specific-sheets"?e.applyToSheetIds||[]:x==="all-except-specific"?(s==null?void 0:s.filter(v=>{var w;return!((w=e.excludeSheetIds)!=null&&w.includes(v.id))}).map(v=>v.id))||[]:(s==null?void 0:s.map(v=>v.id))||[]},m=C.useMemo(()=>{const x=p();return i.filter(v=>x.includes(v.sheetId))},[i,e.applyToSheetIds,e.excludeSheetIds]),g=C.useMemo(()=>{if(!n.trim())return m;const x=n.toLowerCase();return m.filter(v=>{var w;return(w=v==null?void 0:v.title)==null?void 0:w.toLowerCase().includes(x)})},[n,m]),b=a(),y=l();return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Sheet Scope"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Which sheets should display this filter?"})]}),u.jsxs(qa,{value:b,onValueChange:x=>c(x),className:"space-y-3",children:[u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-sheets",id:"all-sheets",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-sheets",className:"cursor-pointer text-sm font-medium",children:"All sheets"}),u.jsxs("p",{className:"text-xs text-muted-foreground",children:["Display filter on all sheets (",(s==null?void 0:s.length)||0," sheets)"]})]})]}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"specific-sheets",id:"specific-sheets",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"specific-sheets",className:"cursor-pointer text-sm font-medium",children:"Only specific sheets"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Display filter on selected sheets only"})]})]}),b==="specific-sheets"&&u.jsx("div",{className:"ml-7 space-y-2",children:u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:s==null?void 0:s.map(x=>{const v=(e.applyToSheetIds||[]).includes(x.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`sheet-${x.id}`,checked:v,onCheckedChange:()=>f(x.id,"specific-sheets")}),u.jsxs(ae,{htmlFor:`sheet-${x.id}`,className:"cursor-pointer text-sm font-medium",children:[x.title||x.id,x.id===o&&u.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground",children:"(this sheet)"})]})]},x.id)})})}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-except-specific",id:"all-sheets-except",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-sheets-except",className:"cursor-pointer text-sm font-medium",children:"All sheets except specific ones"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Display filter on all sheets except selected ones"})]})]}),b==="all-except-specific"&&u.jsx("div",{className:"ml-7 space-y-2",children:u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:s==null?void 0:s.map(x=>{const v=(e.excludeSheetIds||[]).includes(x.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`sheet-exclude-${x.id}`,checked:v,onCheckedChange:()=>f(x.id,"all-except-specific")}),u.jsxs(ae,{htmlFor:`sheet-exclude-${x.id}`,className:"cursor-pointer text-sm font-medium",children:[x.title||x.id,x.id===o&&u.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground",children:"(this sheet)"})]})]},x.id)})})})]})]}),u.jsxs("div",{className:"space-y-3 border-t pt-4",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Card Scope"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Which cards should receive this filter?"})]}),u.jsxs(qa,{value:y,onValueChange:x=>d(x),className:"space-y-3",children:[u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-cards",id:"all-cards",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-cards",className:"cursor-pointer text-sm font-medium",children:"All cards"}),u.jsxs("p",{className:"text-xs text-muted-foreground",children:["Apply filter to all cards in applicable sheets (",m.length," cards)"]})]})]}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"specific-cards",id:"specific-cards",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"specific-cards",className:"cursor-pointer text-sm font-medium",children:"Only specific cards"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Apply filter to selected cards only"})]})]}),y==="specific-cards"&&u.jsxs("div",{className:"ml-7 space-y-2",children:[u.jsx(Sn,{placeholder:"Search cards...",value:n,onChange:x=>r(x.target.value),className:"mb-2"}),u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:g.length>0?g.map(x=>{const v=(e.applyToCardIds||[]).includes(x.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`card-${x.id}`,checked:v,onCheckedChange:()=>h(x.id,"specific-cards")}),u.jsxs("div",{className:"flex-1",children:[u.jsx(ae,{htmlFor:`card-${x.id}`,className:"cursor-pointer text-sm font-medium",children:x.title}),u.jsx("p",{className:"text-xs text-muted-foreground",children:x.sheetTitle})]})]},x.id)}):u.jsxs("p",{className:"py-4 text-center text-sm text-muted-foreground",children:['No cards found matching "',n,'"']})})]}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-except-specific",id:"all-cards-except",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-cards-except",className:"cursor-pointer text-sm font-medium",children:"All cards except specific ones"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Apply filter to all cards except selected ones"})]})]}),y==="all-except-specific"&&u.jsxs("div",{className:"ml-7 space-y-2",children:[u.jsx(Sn,{placeholder:"Search cards...",value:n,onChange:x=>r(x.target.value),className:"mb-2"}),u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:g.length>0?g.map(x=>{const v=(e.excludeCardIds||[]).includes(x.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`card-exclude-${x.id}`,checked:v,onCheckedChange:()=>h(x.id,"all-except-specific")}),u.jsxs("div",{className:"flex-1",children:[u.jsx(ae,{htmlFor:`card-exclude-${x.id}`,className:"cursor-pointer text-sm font-medium",children:x.title}),u.jsx("p",{className:"text-xs text-muted-foreground",children:x.sheetTitle})]})]},x.id)}):u.jsxs("p",{className:"py-4 text-center text-sm text-muted-foreground",children:['No cards found matching "',n,'"']})})]})]})]}),u.jsx("div",{className:"rounded-md bg-blue-50 p-3 text-xs text-blue-900 dark:bg-blue-950 dark:text-blue-100",children:"ℹ️ Cards are filtered based on sheet scope selection. Only cards from applicable sheets are shown in card scope."})]})}function pAe({filter:e}){const[t,n]=C.useState(e.sql),[r,s]=C.useState(!1),[o,i]=C.useState({}),[a,l]=C.useState(e.title||""),[c,d]=C.useState(e.column),[f,h]=C.useState(e.searchMode||"auto"),p=te(v=>v.selectedSheetId),{updateFilter:m}=Wt();function g(){const v=a.trim(),w=c.trim(),S={sql:t,...o},N=w||e.column;w&&w!==e.column&&(S.column=N),S.title=v||N,La(e.dataType)&&(S.searchMode=f);const k={...e,...S};m(k),i({}),s(!1)}C.useEffect(()=>{r&&(i({}),n(e.sql),l(e.title===e.column?"":e.title||""),d(e.column),h(e.searchMode||"auto"))},[r,e.sql,e.title,e.column,e.searchMode]);function b(v){const w={...e,type:v};m(w)}function y(v){const w={...e,uiType:v};m(w)}function x(v){if(!p)return;const w={...e,sheetId:v?p:void 0};m(w)}return u.jsxs(As,{open:r,onOpenChange:s,children:[u.jsx(Ps,{children:u.jsx(au,{className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),u.jsx(Os,{onMouseDown:v=>v.stopPropagation(),onDoubleClick:v=>v.stopPropagation(),className:"z-50 m-2 h-[600px] w-[500px] overflow-hidden",children:u.jsxs("div",{className:"flex h-full flex-col",children:[u.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[u.jsx("h4",{className:"font-medium leading-none",title:e.column,children:e.column.split(".").pop()}),u.jsx(kt,{variant:"secondary",className:"flex-shrink-0 text-xs font-normal",children:e.dataType})]}),u.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Customize filter settings and scope"}),u.jsxs(fo,{defaultValue:"scope",className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[u.jsxs(Ls,{className:"grid w-full flex-shrink-0 grid-cols-2",children:[u.jsx(bn,{value:"scope",children:"Scope"}),u.jsx(bn,{value:"advanced",children:"Configuration"})]}),u.jsx(ur,{value:"scope",className:"mt-4 flex-1 overflow-y-auto",children:u.jsx(hAe,{filter:{...e,...o},onUpdate:v=>{i(w=>({...w,...v}))}})}),u.jsxs(ur,{value:"advanced",className:"mt-4 flex-1 space-y-5 overflow-y-auto",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Custom Title (optional)"}),u.jsx(Yr,{children:u.jsxs(er,{delayDuration:0,children:[u.jsx(tr,{asChild:!0,children:u.jsx(ls,{className:"h-3.5 w-3.5 cursor-help text-muted-foreground"})}),u.jsx(fr,{side:"right",className:"max-w-xs",children:u.jsxs("div",{className:"space-y-2",children:[u.jsx("p",{className:"text-xs",children:"Leave empty to use the column name. Provide a custom title to override it."}),u.jsxs("div",{className:"space-y-1 border-t pt-2",children:[u.jsx("p",{className:"text-xs font-medium",children:"Filter ID"}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("p",{className:"break-all font-mono text-xs text-muted-foreground",children:e.id}),u.jsx(nh,{text:e.id})]})]})]})})]})})]}),u.jsx(Un,{value:a,onChange:v=>l(v.target.value),placeholder:e.column,className:"h-8 text-sm"})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Column Name"}),u.jsx(Un,{value:c,onChange:v=>d(v.target.value),placeholder:"Enter column name",className:"h-8 font-mono text-xs"})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Selection Type"}),u.jsxs(lt,{value:e.type||"multiple",onValueChange:b,children:[u.jsx(ot,{className:"h-8",children:u.jsx(pt,{})}),u.jsxs(it,{children:[u.jsx(me,{value:"multiple",children:"Multiple"}),u.jsx(me,{value:"single",children:"Single"})]})]})]}),e.type==="single"&&u.jsxs("div",{className:"space-y-1",children:[u.jsx(ae,{className:"text-sm font-medium",children:"UI Component"}),u.jsxs(lt,{value:e.uiType||"dropdown",onValueChange:y,children:[u.jsx(ot,{className:"h-8",children:u.jsx(pt,{})}),u.jsxs(it,{children:[u.jsx(me,{value:"dropdown",children:"Dropdown"}),u.jsx(me,{value:"radio",children:"Radio"})]})]})]}),La(e.dataType)&&u.jsxs("div",{className:"space-y-1",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Search Mode"}),u.jsx(Yr,{children:u.jsxs(er,{delayDuration:0,children:[u.jsx(tr,{asChild:!0,children:u.jsx(ls,{className:"h-3.5 w-3.5 cursor-help text-muted-foreground"})}),u.jsx(fr,{side:"right",className:"max-w-xs",children:u.jsxs("div",{className:"space-y-2 text-xs",children:[u.jsxs("p",{children:[u.jsx("strong",{children:"Text Search:"}),' Treats numbers as text (e.g., ZIP codes, IDs). Search for "90210".']}),u.jsxs("p",{children:[u.jsx("strong",{children:"Numeric Operators:"})," Supports comparison operators (e.g., >100, <=50, =100) for quantities, prices."]}),u.jsxs("p",{children:[u.jsx("strong",{children:"Auto-detect:"})," Tries numeric first, falls back to text search."]})]})})]})})]}),u.jsxs(lt,{value:f,onValueChange:v=>h(v),children:[u.jsx(ot,{className:"h-8",children:u.jsx(pt,{})}),u.jsxs(it,{children:[u.jsx(me,{value:"text",children:"Text Search"}),u.jsx(me,{value:"numeric",children:"Numeric Operators"}),u.jsx(me,{value:"auto",children:"Auto-detect"})]})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"SQL"}),u.jsx(Yr,{children:u.jsxs(er,{delayDuration:0,children:[u.jsx(tr,{asChild:!0,children:u.jsx(ls,{className:"h-3.5 w-3.5 cursor-help text-muted-foreground"})}),u.jsx(fr,{side:"right",className:"max-w-xs",children:u.jsx("p",{className:"text-xs",children:"This SQL will be used to fetch the filter values"})})]})})]}),u.jsx(uh,{onKeyDown:v=>{v.stopPropagation()},value:t,onChange:v=>n(v.target.value),className:`h-32 w-full resize-none break-all font-mono text-xs ${Qd}`,placeholder:"SELECT column FROM table..."})]}),u.jsx("div",{className:"border-t pt-2",children:u.jsx(aAe,{label:"Local to sheet",onCheckedChange:x,checked:!!e.sheetId})})]})]}),u.jsx("div",{className:"mt-3 flex justify-end gap-2 border-t pt-3",children:u.jsxs(ie,{onClick:g,size:"sm",variant:"outline",children:[u.jsx(Er,{className:"mr-2 size-4"}),"Accept"]})})]})})]})}const Lq=C.createContext(void 0);function hb(){const e=C.useContext(Lq);return e||{preferences:{},isLocalDev:!1,isConsoleMode:!1}}function zq({filter:e}){var c;const t=te(d=>d.isDashboardEditing),{preferences:n}=hb(),r=((c=n==null?void 0:n.cardDisplay)==null?void 0:c.mode)==="print",s=te(d=>d.filterValues),o=s==null?void 0:s.some(d=>d.filterId===e.id),{removeFilterValues:i,removeFilter:a,updateFilter:l}=Wt();return u.jsxs("div",{className:"group mb-1 flex h-5 items-center justify-between",children:[u.jsxs("div",{className:"flex grow items-center gap-2",children:[u.jsx(ae,{className:"my-1 inline-block text-sm",children:u.jsx(Ro,{value:e.title||e.column,onSave:d=>l({...e,title:d}),isEditable:t,placeholder:"Filter",displayClassName:"text-sm",inputClassName:"text-sm"})}),o&&!r&&u.jsx("button",{onClick:()=>i(e.id),className:"text-muted-foreground",children:u.jsx(yte,{className:"size-3.5"})}),t&&u.jsx("button",{className:"invisible group-hover:visible",onClick:()=>{l({...e,hide:!e.hide})},children:e.hide?u.jsx(ih,{className:"size-3.5 text-muted-foreground hover:text-foreground"}):u.jsx(Rv,{className:"size-3.5 text-muted-foreground hover:text-foreground"})}),t&&u.jsx(pAe,{filter:e})]}),u.jsx("div",{className:"flex items-center gap-2",children:t&&u.jsx(Qt,{onClick:()=>{i(e.id),a(e.id)},className:"size-3 cursor-pointer text-muted-foreground hover:cursor-pointer hover:text-foreground"})})]})}function Bq(){var g;const e=te(b=>b.isDashboardEditing),t=te(b=>b.selectedSheetId),n=te(b=>b.dashboard),r=n==null?void 0:n.sheets,s=r==null?void 0:r.find(b=>b.id===t),o=Ae(b=>b.card),i=Ae(b=>b.selectedConnectionId),{addFrame:a,setSelectedFrameId:l,setIsVisualEditing:c}=Wt(),{setFrame:d,setCard:f,setActiveTabCardId:h}=Kr();function p(){var v,w;const b=o==null?void 0:o.dataSource;if(b)return b;const y=(w=(v=n==null?void 0:n.aiContext)==null?void 0:v.selectedEntities)==null?void 0:w[0],x=y==null?void 0:y.type;if(y)return{connectionId:y.connectionId,connectionType:y.connectionType,type:x,selectedEntities:[y]}}function m(b){const y=(b==null?void 0:b.sheetId)||t,x=r==null?void 0:r.find(k=>k.id===y);if(!x){console.warn("Cannot add frame: No sheet found");return}if(!(!x.frames||x.frames.length===0)&&!e){console.warn("Cannot add frame: Dashboard not in editing mode");return}const w=p(),S={id:Nr(),title:"Title",type:"bar",connectionId:i||"",dataSource:w,preferences:{onClickFilter:[{columnIndex:0,expression:""}]},sql:"",data:[]},N={id:Nr(),cards:[S],activeCardId:S.id};return y&&(a(y,N),l(N.id)),b!=null&&b.openVisualEditor&&(d(N),f(S),h(S.id),c(!0)),N}return{handleAddNewFrame:m,canAddFrame:e||!((g=s==null?void 0:s.frames)!=null&&g.length)}}function mAe({sheetId:e}){const{handleAddNewFrame:t}=Bq(),n=te(s=>s.themeStyle),r=()=>{t({openVisualEditor:!0,sheetId:e})};return u.jsx("div",{className:"flex h-full min-h-[400px] items-start justify-start p-4",children:u.jsxs("button",{onClick:r,style:{borderRadius:n==null?void 0:n.cardBorderRadius},className:"group flex h-96 w-[600px] flex-col items-center justify-center gap-3 rounded-lg border-2 border-dashed border-muted-foreground/25 bg-background transition-all hover:border-muted-foreground/50 hover:bg-muted/50",children:[u.jsx("div",{className:"rounded-full bg-primary/10 p-3 transition-colors group-hover:bg-primary/20",children:u.jsx(yr,{className:"h-6 w-6 text-primary"})}),u.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Add new Visual"})]})})}function G0(e){const t=(e||"").toLowerCase(),n=Ka(t);return n==="string"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-blue-100 text-xs text-blue-700 dark:bg-blue-950 dark:text-blue-300",children:u.jsx(Z$,{className:"h-3 w-3"})}):n==="number"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-green-100 text-xs text-green-700 dark:bg-green-950 dark:text-green-300",children:u.jsx(F$,{className:"h-3 w-3"})}):n==="date"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-purple-100 text-xs text-purple-700 dark:bg-purple-950 dark:text-purple-300",children:u.jsx(so,{className:"h-3 w-3"})}):n==="boolean"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-orange-100 text-xs text-orange-700 dark:bg-orange-950 dark:text-orange-300",children:u.jsx(Y$,{className:"h-3 w-3"})}):n==="json"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-gray-100 text-xs text-gray-700 dark:bg-gray-950 dark:text-gray-300",children:u.jsx(M$,{className:"h-3 w-3"})}):n==="geo"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-orange-100 text-xs text-orange-700 dark:bg-orange-950 dark:text-orange-300",children:u.jsx(wte,{className:"h-3 w-3"})}):n==="calculated"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-gray-100 text-xs text-gray-700 dark:bg-gray-950 dark:text-gray-300",children:u.jsx(b$,{className:"h-3 w-3"})}):null}function gAe({value:e,onChange:t,metrics:n,attributes:r}){const s=(o,i)=>(e==null?void 0:e.field.id)===o.id&&(e==null?void 0:e.type)===i;return u.jsx(Yr,{children:u.jsxs("div",{className:"space-y-4",children:[n.length>0&&u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase",children:"Value of Metric"}),u.jsxs(er,{children:[u.jsx(tr,{asChild:!0,children:u.jsx(ls,{className:"h-3.5 w-3.5 text-muted-foreground"})}),u.jsxs(fr,{className:"max-w-xs",children:[u.jsx("p",{className:"text-xs font-medium mb-1",children:"Captures intersection of all dimensions"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:`Example: Clicking a bar segment in "Sales by Country, stacked by State" captures both Country='USA' AND State='California'`})]})]})]}),u.jsx("div",{className:"space-y-1",children:n.map(o=>{const i=s(o,"metric");return u.jsxs(ie,{variant:i?"default":"outline",size:"sm",className:K("w-full justify-start font-normal",i&&"bg-primary text-primary-foreground"),onClick:()=>t({type:"metric",field:o}),children:[i&&u.jsx(Er,{className:"mr-2 h-4 w-4"}),G0(o.dataType),u.jsx("span",{className:"ml-2",children:o.label})]},o.id)})})]}),r.length>0&&u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase",children:"Value of Attribute"}),u.jsxs(er,{children:[u.jsx(tr,{asChild:!0,children:u.jsx(ls,{className:"h-3.5 w-3.5 text-muted-foreground"})}),u.jsxs(fr,{className:"max-w-xs",children:[u.jsx("p",{className:"text-xs font-medium mb-1",children:"Captures only this dimension"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:`Example: If configured on "State", clicking a bar in "Sales by Country, stacked by State" captures only State='California' (Country is not included)`})]})]})]}),u.jsx("div",{className:"space-y-1",children:r.map(o=>{const i=s(o,"attribute");return u.jsxs(ie,{variant:i?"default":"outline",size:"sm",className:K("w-full justify-start font-normal",i&&"bg-primary text-primary-foreground"),onClick:()=>t({type:"attribute",field:o}),children:[i&&u.jsx(Er,{className:"mr-2 h-4 w-4"}),G0(o.dataType),u.jsx("span",{className:"ml-2",children:o.label})]},o.id)})})]}),n.length===0&&r.length===0&&u.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No metrics or attributes available in this chart"})]})})}const TF=[{value:"clickFilter",label:"Cross filter",description:"Filter other cards on the dashboard"},{value:"drillDown",label:"Drill down",description:"Navigate through a hierarchy of dimensions"},{value:"dynamicDrill",label:"Explore dimensions",description:"Let users explore any dimension dynamically"},{value:"drillThrough",label:"Drill into dashboard",description:"Navigate to another dashboard"},{value:"drillToDetail",label:"Drill into insight",description:"Navigate to a saved insight"},{value:"drillToURL",label:"Drill into URL",description:"Navigate to a custom URL"}];function bAe({value:e,onChange:t}){const n=TF.find(r=>r.value===e);return u.jsx("div",{className:"space-y-2",children:u.jsxs(lt,{value:e,onValueChange:t,children:[u.jsx(ot,{className:"w-full",children:u.jsx(pt,{placeholder:"Choose action...",children:n&&u.jsxs("div",{className:"flex items-center gap-2",children:[(()=>{const r=Y0(n.value);return u.jsx(r,{className:"h-4 w-4"})})(),u.jsx("span",{children:n.label})]})})}),u.jsx(it,{children:TF.map(r=>{const s=Y0(r.value);return u.jsx(me,{value:r.value,children:u.jsxs("div",{className:"flex items-start gap-2 py-1",children:[u.jsx(s,{className:"mt-0.5 h-4 w-4 shrink-0"}),u.jsxs("div",{className:"flex flex-col",children:[u.jsx("span",{className:"font-medium",children:r.label}),u.jsx("span",{className:"text-xs text-muted-foreground",children:r.description})]})]})},r.value)})})]})})}function yAe({interaction:e,onUpdate:t}){const[n,r]=C.useState(""),s=P3(),o=()=>e.applyToCardIds!==void 0?"specific-cards":e.excludeCardIds!==void 0?"all-except-specific":"all-cards",i=d=>{const f={};switch(d){case"all-cards":f.applyToCardIds=void 0,f.excludeCardIds=void 0;break;case"specific-cards":f.applyToCardIds=[],f.excludeCardIds=void 0;break;case"all-except-specific":f.applyToCardIds=void 0,f.excludeCardIds=[];break}t({...e,...f})},a=(d,f)=>{if(f==="specific-cards"){const h=e.applyToCardIds||[],p=h.includes(d)?h.filter(m=>m!==d):[...h,d];t({...e,applyToCardIds:p})}else if(f==="all-except-specific"){const h=e.excludeCardIds||[],p=h.includes(d)?h.filter(m=>m!==d):[...h,d];t({...e,excludeCardIds:p})}},l=C.useMemo(()=>{if(!n.trim())return s;const d=n.toLowerCase();return s==null?void 0:s.filter(f=>{var h;return(h=f==null?void 0:f.title)==null?void 0:h.toLowerCase().includes(d)})},[n,s]),c=o();return u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Filter scope"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose which cards should receive the filter"})]}),u.jsxs(qa,{value:c,onValueChange:d=>i(d),className:"space-y-2",children:[u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-cards",id:"all-cards",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-cards",className:"cursor-pointer text-sm font-medium",children:"All cards"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Apply filter to all cards in the dashboard"})]})]}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"specific-cards",id:"specific-cards",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"specific-cards",className:"cursor-pointer text-sm font-medium",children:"Only specific cards"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Apply filter to selected cards only"})]})]}),c==="specific-cards"&&u.jsxs("div",{className:"ml-7 space-y-2",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Cards to filter"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Select which cards should receive the filter"})]}),u.jsx(Sn,{placeholder:"Search cards...",value:n,onChange:d=>r(d.target.value),className:"mb-2"}),u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:l&&l.length>0?l.map(d=>{const f=(e.applyToCardIds||[]).includes(d.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`card-${d.id}`,checked:f,onCheckedChange:()=>a(d.id,"specific-cards")}),u.jsxs("div",{className:"flex-1",children:[u.jsx(ae,{htmlFor:`card-${d.id}`,className:"cursor-pointer text-sm font-medium",children:d.title}),d.description&&u.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:d.description})]})]},d.id)}):u.jsx("p",{className:"py-4 text-center text-sm text-muted-foreground",children:n?`No cards found matching "${n}"`:"No cards available"})})]}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-except-specific",id:"all-except-specific",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-except-specific",className:"cursor-pointer text-sm font-medium",children:"All cards except specific ones"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Apply filter to all cards, excluding selected ones"})]})]}),c==="all-except-specific"&&u.jsxs("div",{className:"ml-7 space-y-2",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Cards to exclude"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Select which cards should be excluded from filtering"})]}),u.jsx(Sn,{placeholder:"Search cards...",value:n,onChange:d=>r(d.target.value),className:"mb-2"}),u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:l&&l.length>0?l.map(d=>{const f=(e.excludeCardIds||[]).includes(d.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`card-exclude-${d.id}`,checked:f,onCheckedChange:()=>a(d.id,"all-except-specific")}),u.jsxs("div",{className:"flex-1",children:[u.jsx(ae,{htmlFor:`card-exclude-${d.id}`,className:"cursor-pointer text-sm font-medium",children:d.title}),d.description&&u.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:d.description})]})]},d.id)}):u.jsx("p",{className:"py-4 text-center text-sm text-muted-foreground",children:n?`No cards found matching "${n}"`:"No cards available"})})]})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Menu label"}),u.jsx(Sn,{value:e.label||"",onChange:d=>t({...e,label:d.target.value}),placeholder:cd(e.mode)}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"How this interaction appears when multiple actions are available"})]})]})}var vM="Collapsible",[xAe,Vq]=vr(vM),[vAe,wM]=xAe(vM),Hq=E.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...a}=e,[l=!1,c]=Ir({prop:r,defaultProp:s,onChange:i});return u.jsx(vAe,{scope:n,disabled:o,contentId:Gn(),open:l,onOpenToggle:E.useCallback(()=>c(d=>!d),[c]),children:u.jsx(Re.div,{"data-state":kM(l),"data-disabled":o?"":void 0,...a,ref:t})})});Hq.displayName=vM;var Uq="CollapsibleTrigger",SM=E.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=wM(Uq,n);return u.jsx(Re.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":kM(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:we(e.onClick,s.onOpenToggle)})});SM.displayName=Uq;var CM="CollapsibleContent",NM=E.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=wM(CM,e.__scopeCollapsible);return u.jsx(Zn,{present:n||s.open,children:({present:o})=>u.jsx(wAe,{...r,ref:t,present:o})})});NM.displayName=CM;var wAe=E.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=e,i=wM(CM,n),[a,l]=E.useState(r),c=E.useRef(null),d=ut(t,c),f=E.useRef(0),h=f.current,p=E.useRef(0),m=p.current,g=i.open||a,b=E.useRef(g),y=E.useRef(void 0);return E.useEffect(()=>{const x=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(x)},[]),Rr(()=>{const x=c.current;if(x){y.current=y.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const v=x.getBoundingClientRect();f.current=v.height,p.current=v.width,b.current||(x.style.transitionDuration=y.current.transitionDuration,x.style.animationName=y.current.animationName),l(r)}},[i.open,r]),u.jsx(Re.div,{"data-state":kM(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!g,...o,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:g&&s})});function kM(e){return e?"open":"closed"}var Wq=Hq,SAe=SM,CAe=NM;const Vu=Wq,Hu=SM,Uu=NM;function NAe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return C.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const a1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ih(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function EM(e){return"nodeType"in e}function ys(e){var t,n;return e?Ih(e)?e:EM(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function jM(e){const{Document:t}=ys(e);return e instanceof t}function pb(e){return Ih(e)?!1:e instanceof ys(e).HTMLElement}function qq(e){return e instanceof ys(e).SVGElement}function Ah(e){return e?Ih(e)?e.document:EM(e)?jM(e)?e:pb(e)||qq(e)?e.ownerDocument:document:document:document}const ai=a1?C.useLayoutEffect:C.useEffect;function l1(e){const t=C.useRef(e);return ai(()=>{t.current=e}),C.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function kAe(){const e=C.useRef(null),t=C.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=C.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ng(e,t){t===void 0&&(t=[e]);const n=C.useRef(e);return ai(()=>{n.current!==e&&(n.current=e)},t),n}function mb(e,t){const n=C.useRef();return C.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Z0(e){const t=l1(e),n=C.useRef(null),r=C.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function K0(e){const t=C.useRef();return C.useEffect(()=>{t.current=e},[e]),t.current}let qC={};function gb(e,t){return C.useMemo(()=>{if(t)return t;const n=qC[e]==null?0:qC[e]+1;return qC[e]=n,e+"-"+n},[e,t])}function Yq(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((o,i)=>{const a=Object.entries(i);for(const[l,c]of a){const d=o[l];d!=null&&(o[l]=d+e*c)}return o},{...t})}}const ff=Yq(1),rg=Yq(-1);function EAe(e){return"clientX"in e&&"clientY"in e}function c1(e){if(!e)return!1;const{KeyboardEvent:t}=ys(e.target);return t&&e instanceof t}function jAe(e){if(!e)return!1;const{TouchEvent:t}=ys(e.target);return t&&e instanceof t}function X0(e){if(jAe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return EAe(e)?{x:e.clientX,y:e.clientY}:null}const Gi=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Gi.Translate.toString(e),Gi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),RF="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function _Ae(e){return e.matches(RF)?e:e.querySelector(RF)}const DAe={display:"none"};function MAe(e){let{id:t,value:n}=e;return C.createElement("div",{id:t,style:DAe},n)}function TAe(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return C.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function RAe(){const[e,t]=C.useState("");return{announce:C.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Gq=C.createContext(null);function IAe(e){const t=C.useContext(Gq);C.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function AAe(){const[e]=C.useState(()=>new Set),t=C.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[C.useCallback(r=>{let{type:s,event:o}=r;e.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[e]),t]}const PAe={draggable:`
910
+ `)),[]});var hRe=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(hRe||{});function pRe(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function mRe(e,t,n,r){let[s,o]=C.useState(n),{hasFlag:i,addFlag:a,removeFlag:l}=fRe(e&&s?3:0),c=C.useRef(!1),d=C.useRef(!1),f=ub();return Bn(()=>{var h;if(e){if(n&&o(!0),!t){n&&a(3);return}return(h=void 0)==null||h.call(r,n),gRe(t,{inFlight:c,prepare(){d.current?d.current=!1:d.current=c.current,c.current=!0,!d.current&&(n?(a(3),l(4)):(a(4),l(2)))},run(){d.current?n?(l(3),a(4)):(l(4),a(3)):n?l(1):a(1)},done(){var p;d.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,l(7),n||o(!1),(p=void 0)==null||p.call(r,n))}})}},[e,n,t,f]),e?[s,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function gRe(e,{prepare:t,run:n,done:r,inFlight:s}){let o=Yi();return yRe(e,{prepare:t,inFlight:s}),o.nextFrame(()=>{n(),o.requestAnimationFrame(()=>{o.add(bRe(e,r))})}),o.dispose}function bRe(e,t){var n,r;let s=Yi();if(!e)return s.dispose;let o=!1;s.add(()=>{o=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),s.dispose):(Promise.allSettled(i.map(a=>a.finished)).then(()=>{o||t()}),s.dispose)}function yRe(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function xRe(e,{container:t,accept:n,walk:r}){let s=C.useRef(n),o=C.useRef(r);C.useEffect(()=>{s.current=n,o.current=r},[n,r]),Bn(()=>{if(!t||!e)return;let i=cb(t);if(!i)return;let a=s.current,l=o.current,c=Object.assign(f=>a(f),{acceptNode:a}),d=i.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;d.nextNode();)l(d.currentNode)},[t,e,s,o])}function vF(e,t){let n=C.useRef([]),r=yt(e);C.useEffect(()=>{let s=[...n.current];for(let[o,i]of t.entries())if(n.current[o]!==i){let a=r(t,s);return n.current=t,a}},[r,...t])}function vRe(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const Nq={...E},wRe=Nq.useInsertionEffect,SRe=wRe||(e=>e());function kq(e){const t=E.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return SRe(()=>{t.current=e}),E.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}var Qk=typeof document<"u"?C.useLayoutEffect:C.useEffect;let wF=!1,CRe=0;const SF=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+CRe++;function NRe(){const[e,t]=E.useState(()=>wF?SF():void 0);return Qk(()=>{e==null&&t(SF())},[]),E.useEffect(()=>{wF=!0},[]),e}const kRe=Nq.useId,ERe=kRe||NRe;let Jm;process.env.NODE_ENV!=="production"&&(Jm=new Set);function jRe(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const s="Floating UI: "+n.join(" ");if(!((e=Jm)!=null&&e.has(s))){var o;(o=Jm)==null||o.add(s),console.warn(s)}}function _Re(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const s="Floating UI: "+n.join(" ");if(!((e=Jm)!=null&&e.has(s))){var o;(o=Jm)==null||o.add(s),console.error(s)}}function DRe(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(s=>s(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(s=>s!==n))||[])}}}const MRe=E.createContext(null),TRe=E.createContext(null),RRe=()=>{var e;return((e=E.useContext(MRe))==null?void 0:e.id)||null},IRe=()=>E.useContext(TRe),ARe="data-floating-ui-focusable";function PRe(e){const{open:t=!1,onOpenChange:n,elements:r}=e,s=ERe(),o=E.useRef({}),[i]=E.useState(()=>DRe()),a=RRe()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!Ur(p)&&_Re("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[l,c]=E.useState(r.reference),d=kq((p,m,g)=>{o.current.openEvent=p?m:void 0,i.emit("openchange",{open:p,event:m,reason:g,nested:a}),n==null||n(p,m,g)}),f=E.useMemo(()=>({setPositionReference:c}),[]),h=E.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return E.useMemo(()=>({dataRef:o,open:t,onOpenChange:d,elements:h,events:i,floatingId:s,refs:f}),[t,d,h,i,s,f])}function ORe(e){e===void 0&&(e={});const{nodeId:t}=e,n=PRe({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,s=r.elements,[o,i]=E.useState(null),[a,l]=E.useState(null),d=(s==null?void 0:s.domReference)||o,f=E.useRef(null),h=IRe();Qk(()=>{d&&(f.current=d)},[d]);const p=Az({...e,elements:{...s,...a&&{reference:a}}}),m=E.useCallback(v=>{const w=Ur(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),contextElement:v}:v;l(w),p.refs.setReference(w)},[p.refs]),g=E.useCallback(v=>{(Ur(v)||v===null)&&(f.current=v,i(v)),(Ur(p.refs.reference.current)||p.refs.reference.current===null||v!==null&&!Ur(v))&&p.refs.setReference(v)},[p.refs]),b=E.useMemo(()=>({...p.refs,setReference:g,setPositionReference:m,domReference:f}),[p.refs,g,m]),y=E.useMemo(()=>({...p.elements,domReference:d}),[p.elements,d]),x=E.useMemo(()=>({...p,...r,refs:b,elements:y,nodeId:t}),[p,b,y,t,r]);return Qk(()=>{r.dataRef.current.floatingContext=x;const v=h==null?void 0:h.nodesRef.current.find(w=>w.id===t);v&&(v.context=x)}),E.useMemo(()=>({...p,context:x,refs:b,elements:y}),[p,b,y,x])}const CF="active",NF="selected";function HC(e,t,n){const r=new Map,s=n==="item";let o=e;if(s&&e){const{[CF]:i,[NF]:a,...l}=e;o=l}return{...n==="floating"&&{tabIndex:-1,[ARe]:""},...o,...t.map(i=>{const a=i?i[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((i,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(s&&[CF,NF].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof d=="function"){var f;(f=r.get(c))==null||f.push(d),i[c]=function(){for(var h,p=arguments.length,m=new Array(p),g=0;g<p;g++)m[g]=arguments[g];return(h=r.get(c))==null?void 0:h.map(b=>b(...m)).find(b=>b!==void 0)}}}else i[c]=d}),i),{})}}function FRe(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),s=E.useCallback(a=>HC(a,e,"reference"),t),o=E.useCallback(a=>HC(a,e,"floating"),n),i=E.useCallback(a=>HC(a,e,"item"),r);return E.useMemo(()=>({getReferenceProps:s,getFloatingProps:o,getItemProps:i}),[s,o,i])}function kF(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const $Re=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:s,offset:o=0,index:i=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...d}=Hi(e,t),{rects:f,elements:{floating:h}}=t,p=n.current[i],m=(c==null?void 0:c.current)||h,g=h.clientTop||m.clientTop,b=h.clientTop!==0,y=m.clientTop!==0,x=h===m;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||jRe('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const v={...t,...await d_(-p.offsetTop-h.clientTop-f.reference.height/2-p.offsetHeight/2-o).fn(t)},w=await IS(kF(v,m.scrollHeight+g+h.clientTop),d),S=await IS(v,{...d,elementContext:"reference"}),N=Hr(0,w.top),k=v.y+N,D=(m.scrollHeight>m.clientHeight?M=>M:jm)(Hr(0,m.scrollHeight+(b&&x||y?g*2:0)-N-Hr(0,w.bottom)));if(m.style.maxHeight=D+"px",m.scrollTop=N,s){const M=m.offsetHeight<p.offsetHeight*Ua(a,n.current.length)-1||S.top>=-l||S.bottom>=-l;zl.flushSync(()=>s(M))}return r&&(r.current=await IS(kF({...v,y:k},m.offsetHeight+g+h.clientTop),d)),{y:k}}});function LRe(e,t){const{open:n,elements:r}=e,{enabled:s=!0,overflowRef:o,scrollRef:i,onChange:a}=t,l=kq(a),c=E.useRef(!1),d=E.useRef(null),f=E.useRef(null);E.useEffect(()=>{if(!s)return;function p(g){if(g.ctrlKey||!m||o.current==null)return;const b=g.deltaY,y=o.current.top>=-.5,x=o.current.bottom>=-.5,v=m.scrollHeight-m.clientHeight,w=b<0?-1:1,S=b<0?"max":"min";m.scrollHeight<=m.clientHeight||(!y&&b>0||!x&&b<0?(g.preventDefault(),zl.flushSync(()=>{l(N=>N+Math[S](b,v*w))})):/firefox/i.test(vRe())&&(m.scrollTop+=b))}const m=(i==null?void 0:i.current)||r.floating;if(n&&m)return m.addEventListener("wheel",p),requestAnimationFrame(()=>{d.current=m.scrollTop,o.current!=null&&(f.current={...o.current})}),()=>{d.current=null,f.current=null,m.removeEventListener("wheel",p)}},[s,n,r.floating,o,i,l]);const h=E.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const p=(i==null?void 0:i.current)||r.floating;if(!(!o.current||!p||!c.current)){if(d.current!==null){const m=p.scrollTop-d.current;(o.current.bottom<-.5&&m<-1||o.current.top<-.5&&m>1)&&zl.flushSync(()=>l(g=>g+m))}requestAnimationFrame(()=>{d.current=p.scrollTop})}}}),[r.floating,l,o,i]);return E.useMemo(()=>s?{floating:h}:{},[s,h])}let db=C.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});db.displayName="FloatingContext";let hM=C.createContext(null);hM.displayName="PlacementContext";function zRe(e){return C.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function BRe(){return C.useContext(db).setReference}function VRe(){let{getFloatingProps:e,slot:t}=C.useContext(db);return C.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function HRe(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=C.useContext(hM),n=C.useMemo(()=>e,[JSON.stringify(e,(s,o)=>{var i;return(i=o==null?void 0:o.outerHTML)!=null?i:o})]);Bn(()=>{t==null||t(n??null)},[t,n]);let r=C.useContext(db);return C.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let EF=4;function URe({children:e,enabled:t=!0}){let[n,r]=C.useState(null),[s,o]=C.useState(0),i=C.useRef(null),[a,l]=C.useState(null);WRe(a);let c=t&&n!==null&&a!==null,{to:d="bottom",gap:f=0,offset:h=0,padding:p=0,inner:m}=qRe(n,a),[g,b="center"]=d.split(" ");Bn(()=>{c&&o(0)},[c]);let{refs:y,floatingStyles:x,context:v}=ORe({open:c,placement:g==="selection"?b==="center"?"bottom":`bottom-${b}`:b==="center"?`${g}`:`${g}-${b}`,strategy:"absolute",transform:!1,middleware:[d_({mainAxis:g==="selection"?0:f,crossAxis:h}),Pz({padding:p}),g!=="selection"&&Oz({padding:p}),g==="selection"&&m?$Re({...m,padding:p,overflowRef:i,offset:s,minItemsVisible:EF,referenceOverflowThreshold:p,onFallbackChange(M){var T,O;if(!M)return;let A=v.elements.floating;if(!A)return;let P=parseFloat(getComputedStyle(A).scrollPaddingBottom)||0,F=Math.min(EF,A.childElementCount),V=0,H=0;for(let $ of(O=(T=v.elements.floating)==null?void 0:T.childNodes)!=null?O:[])if($ instanceof HTMLElement){let I=$.offsetTop,B=I+$.clientHeight+P,L=A.scrollTop,R=L+A.clientHeight;if(I>=L&&B<=R)F--;else{H=Math.max(0,Math.min(B,R)-Math.max(I,L)),V=$.clientHeight;break}}F>=1&&o($=>{let I=V*F-H+P;return $>=I?$:I})}}):null,Fz({padding:p,apply({availableWidth:M,availableHeight:T,elements:O}){Object.assign(O.floating.style,{overflow:"auto",maxWidth:`${M}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${T}px)`})}})].filter(Boolean),whileElementsMounted:Rz}),[w=g,S=b]=v.placement.split("-");g==="selection"&&(w="selection");let N=C.useMemo(()=>({anchor:[w,S].filter(Boolean).join(" ")}),[w,S]),k=LRe(v,{overflowRef:i,onChange:o}),{getReferenceProps:j,getFloatingProps:_}=FRe([k]),D=yt(M=>{l(M),y.setFloating(M)});return E.createElement(hM.Provider,{value:r},E.createElement(db.Provider,{value:{setFloating:D,setReference:y.setReference,styles:x,getReferenceProps:j,getFloatingProps:_,slot:N}},e))}function WRe(e){Bn(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let s=parseInt(n);isNaN(s)||r!==s&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function qRe(e,t){var n,r,s;let o=UC((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=UC((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),a=UC((s=e==null?void 0:e.padding)!=null?s:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:i,padding:a}}function UC(e,t,n=void 0){let r=ub(),s=yt((l,c)=>{if(l==null)return[n,null];if(typeof l=="number")return[l,null];if(typeof l=="string"){if(!c)return[n,null];let d=jF(l,c);return[d,f=>{let h=Eq(l);{let p=h.map(m=>window.getComputedStyle(c).getPropertyValue(m));r.requestAnimationFrame(function m(){r.nextFrame(m);let g=!1;for(let[y,x]of h.entries()){let v=window.getComputedStyle(c).getPropertyValue(x);if(p[y]!==v){p[y]=v,g=!0;break}}if(!g)return;let b=jF(l,c);d!==b&&(f(b),d=b)})}return r.dispose}]}return[n,null]}),o=C.useMemo(()=>s(e,t)[0],[e,t]),[i=o,a]=C.useState();return Bn(()=>{let[l,c]=s(e,t);if(a(l),!!c)return c(a)},[e,t]),i}function Eq(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),s=t[1].slice(n+1).trim();return s?[r,...Eq(s)]:[r]}return[]}function jF(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function YRe({children:e,freeze:t}){let n=Jk(t,e);return C.createElement(C.Fragment,null,n)}function Jk(e,t){let[n,r]=C.useState(t);return!e&&n!==t&&r(t),e?n:t}let pM=C.createContext(null);pM.displayName="OpenClosedContext";var eg=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(eg||{});function GRe(){return C.useContext(pM)}function ZRe({value:e,children:t}){return C.createElement(pM.Provider,{value:e},t)}function KRe(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let zc=[];KRe(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||zc[0]===t.target)return;let n=t.target;n=n.closest(Xk),zc.unshift(n??t.target),zc=zc.filter(r=>r!=null&&r.isConnected),zc.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function XRe(e){throw new Error("Unexpected object: "+e)}var lr=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(lr||{});function _F(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),s=r??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 1:{s===-1&&(s=n.length);for(let o=s-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 2:{for(let o=s+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return r}case 5:return null;default:XRe(e)}}var mM=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(mM||{});function QRe(e){let t=yt(e),n=C.useRef(!1);C.useEffect(()=>(n.current=!1,()=>{n.current=!0,aq(()=>{n.current&&t()})}),[t])}function JRe(){let e=typeof document>"u";return"useSyncExternalStore"in E?(t=>t.useSyncExternalStore)(E)(()=>()=>{},()=>!1,()=>!e):!1}function eIe(){let e=JRe(),[t,n]=E.useState(wu.isHandoffComplete);return t&&wu.isHandoffComplete===!1&&n(!1),E.useEffect(()=>{t!==!0&&n(!0)},[t]),E.useEffect(()=>wu.handoff(),[]),e?!1:t}let tIe=C.createContext(!1);function nIe(){return C.useContext(tIe)}function rIe(e){let t=nIe(),n=C.useContext(_q),r=i1(e),[s,o]=C.useState(()=>{var i;if(!t&&n!==null)return(i=n.current)!=null?i:null;if(wu.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let l=r.createElement("div");return l.setAttribute("id","headlessui-portal-root"),r.body.appendChild(l)});return C.useEffect(()=>{s!==null&&(r!=null&&r.body.contains(s)||r==null||r.body.appendChild(s))},[s,r]),C.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),s}let jq=C.Fragment,sIe=pi(function(e,t){let n=e,r=C.useRef(null),s=tl(xTe(f=>{r.current=f}),t),o=i1(r),i=rIe(r),[a]=C.useState(()=>{var f;return wu.isServer?null:(f=o==null?void 0:o.createElement("div"))!=null?f:null}),l=C.useContext(lIe),c=eIe();Bn(()=>{!i||!a||i.contains(a)||(a.setAttribute("data-headlessui-portal",""),i.appendChild(a))},[i,a]),Bn(()=>{if(a&&l)return l.register(a)},[l,a]),QRe(()=>{var f;!i||!a||(a instanceof Node&&i.contains(a)&&i.removeChild(a),i.childNodes.length<=0&&((f=i.parentElement)==null||f.removeChild(i)))});let d=hi();return c?!i||!a?null:_n.createPortal(d({ourProps:{ref:s},theirProps:n,slot:{},defaultTag:jq,name:"Portal"}),a):null});function oIe(e,t){let n=tl(t),{enabled:r=!0,...s}=e,o=hi();return r?C.createElement(sIe,{...s,ref:n}):o({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:jq,name:"Portal"})}let iIe=C.Fragment,_q=C.createContext(null);function aIe(e,t){let{target:n,...r}=e,s={ref:tl(t)},o=hi();return C.createElement(_q.Provider,{value:n},o({ourProps:s,theirProps:r,defaultTag:iIe,name:"Popover.Group"}))}let lIe=C.createContext(null),cIe=pi(oIe),uIe=pi(aIe),dIe=Object.assign(cIe,{Group:uIe});var fIe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(fIe||{}),hIe=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(hIe||{}),pIe=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(pIe||{}),mIe=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=7]="UpdateVirtualConfiguration",e[e.SetInputElement=8]="SetInputElement",e[e.SetButtonElement=9]="SetButtonElement",e[e.SetOptionsElement=10]="SetOptionsElement",e))(mIe||{});function WC(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),s=r.length>0&&r[0].dataRef.current.order!==null?r.sort((i,a)=>i.dataRef.current.order-a.dataRef.current.order):JTe(r,i=>i.dataRef.current.domRef.current),o=n?s.indexOf(n):null;return o===-1&&(o=null),{options:s,activeOptionIndex:o}}let gIe={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0,__demoMode:!1}}return{...e,comboboxState:0,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var n,r,s,o;if((n=e.dataRef.current)!=null&&n.disabled||e.optionsElement&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:c,disabled:d}=e.virtual,f=t.focus===lr.Specific?t.idx:_F(t,{resolveItems:()=>c,resolveActiveIndex:()=>{var p,m;return(m=(p=e.activeOptionIndex)!=null?p:c.findIndex(g=>!d(g)))!=null?m:null},resolveDisabled:d,resolveId(){throw new Error("Function not implemented.")}}),h=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===f&&e.activationTrigger===h?e:{...e,activeOptionIndex:f,activationTrigger:h,isTyping:!1,__demoMode:!1}}let i=WC(e);if(i.activeOptionIndex===null){let c=i.options.findIndex(d=>!d.dataRef.current.disabled);c!==-1&&(i.activeOptionIndex=c)}let a=t.focus===lr.Specific?t.idx:_F(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled}),l=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===a&&e.activationTrigger===l?e:{...e,...i,isTyping:!1,activeOptionIndex:a,activationTrigger:l,__demoMode:!1}},4:(e,t)=>{var n,r,s;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,i=WC(e,l=>(l.push(o),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(i.activeOptionIndex=i.options.indexOf(o));let a={...e,...i,activationTrigger:2};return(s=e.dataRef.current)!=null&&s.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},5:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(s=>s.id!==t.id)};let r=WC(e,s=>{let o=s.findIndex(i=>i.id===t.id);return o!==-1&&s.splice(o,1),s});return{...e,...r,activationTrigger:2}},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n,r;if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:(n=t.disabled)!=null?n:()=>!1}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let s=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?s=o:s=null}return{...e,activeOptionIndex:s,virtual:{options:t.options,disabled:(r=t.disabled)!=null?r:()=>!1}}},8:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},9:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},10:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},gM=C.createContext(null);gM.displayName="ComboboxActionsContext";function fb(e){let t=C.useContext(gM);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,fb),n}return t}let Dq=C.createContext(null);function bIe(e){let t=Rh("VirtualProvider"),{options:n}=t.virtual,[r,s]=C.useMemo(()=>{let c=t.optionsElement;if(!c)return[0,0];let d=window.getComputedStyle(c);return[parseFloat(d.paddingBlockStart||d.paddingTop),parseFloat(d.paddingBlockEnd||d.paddingBottom)]},[t.optionsElement]),o=zTe({enabled:n.length!==0,scrollPaddingStart:r,scrollPaddingEnd:s,count:n.length,estimateSize(){return 40},getScrollElement(){return t.optionsElement},overscan:12}),[i,a]=C.useState(0);Bn(()=>{a(c=>c+1)},[n]);let l=o.getVirtualItems();return l.length===0?null:C.createElement(Dq.Provider,{value:o},C.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:c=>{c&&t.activationTrigger!==0&&t.activeOptionIndex!==null&&n.length>t.activeOptionIndex&&o.scrollToIndex(t.activeOptionIndex)}},l.map(c=>{var d;return C.createElement(C.Fragment,{key:c.key},C.cloneElement((d=e.children)==null?void 0:d.call(e,{...e.slot,option:n[c.index]}),{key:`${i}-${c.key}`,"data-index":c.index,"aria-setsize":n.length,"aria-posinset":c.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${c.start}px)`,overflowAnchor:"none"}}))})))}let tg=C.createContext(null);tg.displayName="ComboboxDataContext";function Rh(e){let t=C.useContext(tg);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Rh),n}return t}function yIe(e,t){return Fa(t.type,gIe,e,t)}let xIe=C.Fragment;function vIe(e,t){var n,r;let s=lM(),{value:o,defaultValue:i,onChange:a,form:l,name:c,by:d,disabled:f=s||!1,onClose:h,__demoMode:p=!1,multiple:m=!1,immediate:g=!1,virtual:b=null,nullable:y,...x}=e,v=cTe(i),[w=m?[]:void 0,S]=lTe(o,a,v),[N,k]=C.useReducer(yIe,{dataRef:C.createRef(),comboboxState:p?0:1,isTyping:!1,options:[],virtual:b?{options:b.options,disabled:(n=b.disabled)!=null?n:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:p}),j=C.useRef(!1),_=C.useRef({static:!1,hold:!1}),D=VTe(d),M=yt(oe=>b?d===null?b.options.indexOf(oe):b.options.findIndex(de=>D(de,oe)):N.options.findIndex(de=>D(de.dataRef.current.value,oe))),T=C.useCallback(oe=>Fa(A.mode,{1:()=>w.some(de=>D(de,oe)),0:()=>D(w,oe)}),[w]),O=yt(oe=>N.activeOptionIndex===M(oe)),A=C.useMemo(()=>({...N,immediate:g,optionsPropsRef:_,value:w,defaultValue:v,disabled:f,mode:m?1:0,virtual:b?N.virtual:null,get activeOptionIndex(){if(j.current&&N.activeOptionIndex===null&&(b?b.options.length>0:N.options.length>0)){if(b){let de=b.options.findIndex(le=>{var ke,ye;return!((ye=(ke=b.disabled)==null?void 0:ke.call(b,le))!=null&&ye)});if(de!==-1)return de}let oe=N.options.findIndex(de=>!de.dataRef.current.disabled);if(oe!==-1)return oe}return N.activeOptionIndex},calculateIndex:M,compare:D,isSelected:T,isActive:O}),[w,v,f,m,p,N,b]);Bn(()=>{var oe;b&&k({type:7,options:b.options,disabled:(oe=b.disabled)!=null?oe:null})},[b,b==null?void 0:b.options,b==null?void 0:b.disabled]),Bn(()=>{N.dataRef.current=A},[A]);let P=A.comboboxState===0;nRe(P,[A.buttonElement,A.inputElement,A.optionsElement],()=>z.closeCombobox());let F=C.useMemo(()=>{var oe,de,le;return{open:A.comboboxState===0,disabled:f,activeIndex:A.activeOptionIndex,activeOption:A.activeOptionIndex===null?null:A.virtual?A.virtual.options[(oe=A.activeOptionIndex)!=null?oe:0]:(le=(de=A.options[A.activeOptionIndex])==null?void 0:de.dataRef.current.value)!=null?le:null,value:w}},[A,f,w]),V=yt(()=>{if(A.activeOptionIndex!==null){if(z.setIsTyping(!1),A.virtual)R(A.virtual.options[A.activeOptionIndex]);else{let{dataRef:oe}=A.options[A.activeOptionIndex];R(oe.current.value)}z.goToOption(lr.Specific,A.activeOptionIndex)}}),H=yt(()=>{k({type:0}),j.current=!0}),$=yt(()=>{k({type:1}),j.current=!1,h==null||h()}),I=yt(oe=>{k({type:3,isTyping:oe})}),B=yt((oe,de,le)=>(j.current=!1,oe===lr.Specific?k({type:2,focus:lr.Specific,idx:de,trigger:le}):k({type:2,focus:oe,trigger:le}))),L=yt((oe,de)=>(k({type:4,payload:{id:oe,dataRef:de}}),()=>{A.isActive(de.current.value)&&(j.current=!0),k({type:5,id:oe})})),R=yt(oe=>Fa(A.mode,{0(){return S==null?void 0:S(oe)},1(){let de=A.value.slice(),le=de.findIndex(ke=>D(ke,oe));return le===-1?de.push(oe):de.splice(le,1),S==null?void 0:S(de)}})),W=yt(oe=>{k({type:6,trigger:oe})}),Y=yt(oe=>{k({type:8,element:oe})}),Z=yt(oe=>{k({type:9,element:oe})}),U=yt(oe=>{k({type:10,element:oe})}),z=C.useMemo(()=>({onChange:R,registerOption:L,goToOption:B,setIsTyping:I,closeCombobox:$,openCombobox:H,setActivationTrigger:W,selectActiveOption:V,setInputElement:Y,setButtonElement:Z,setOptionsElement:U}),[]),[q,G]=NTe(),ee=t===null?{}:{ref:t},Q=C.useCallback(()=>{if(v!==void 0)return S==null?void 0:S(v)},[S,v]),ne=hi();return C.createElement(G,{value:q,props:{htmlFor:(r=A.inputElement)==null?void 0:r.id},slot:{open:A.comboboxState===0,disabled:f}},C.createElement(URe,null,C.createElement(gM.Provider,{value:z},C.createElement(tg.Provider,{value:A},C.createElement(ZRe,{value:Fa(A.comboboxState,{0:eg.Open,1:eg.Closed})},c!=null&&C.createElement(pTe,{disabled:f,data:w!=null?{[c]:w}:{},form:l,onReset:Q}),ne({ourProps:ee,theirProps:x,slot:F,defaultTag:xIe,name:"Combobox"}))))))}let wIe="input";function SIe(e,t){var n,r,s,o,i;let a=Rh("Combobox.Input"),l=fb("Combobox.Input"),c=C.useId(),d=hq(),{id:f=d||`headlessui-combobox-input-${c}`,onChange:h,displayValue:p,disabled:m=a.disabled||!1,autoFocus:g=!1,type:b="text",...y}=e,x=C.useRef(null),v=tl(x,t,BRe(),l.setInputElement),w=i1(a.inputElement),S=ub(),N=yt(()=>{l.onChange(null),a.optionsElement&&(a.optionsElement.scrollTop=0),l.goToOption(lr.Nothing)}),k=C.useMemo(()=>{var R;return typeof p=="function"&&a.value!==void 0?(R=p(a.value))!=null?R:"":typeof a.value=="string"?a.value:""},[a.value,p]);vF(([R,W],[Y,Z])=>{if(a.isTyping)return;let U=x.current;U&&((Z===0&&W===1||R!==Y)&&(U.value=R),requestAnimationFrame(()=>{if(a.isTyping||!U||(w==null?void 0:w.activeElement)!==U)return;let{selectionStart:z,selectionEnd:q}=U;Math.abs((q??0)-(z??0))===0&&z===0&&U.setSelectionRange(U.value.length,U.value.length)}))},[k,a.comboboxState,w,a.isTyping]),vF(([R],[W])=>{if(R===0&&W===1){if(a.isTyping)return;let Y=x.current;if(!Y)return;let Z=Y.value,{selectionStart:U,selectionEnd:z,selectionDirection:q}=Y;Y.value="",Y.value=Z,q!==null?Y.setSelectionRange(U,z,q):Y.setSelectionRange(U,z)}},[a.comboboxState]);let j=C.useRef(!1),_=yt(()=>{j.current=!0}),D=yt(()=>{S.nextFrame(()=>{j.current=!1})}),M=yt(R=>{switch(l.setIsTyping(!0),R.key){case as.Enter:if(a.comboboxState!==0||j.current)return;if(R.preventDefault(),R.stopPropagation(),a.activeOptionIndex===null){l.closeCombobox();return}l.selectActiveOption(),a.mode===0&&l.closeCombobox();break;case as.ArrowDown:return R.preventDefault(),R.stopPropagation(),Fa(a.comboboxState,{0:()=>l.goToOption(lr.Next),1:()=>l.openCombobox()});case as.ArrowUp:return R.preventDefault(),R.stopPropagation(),Fa(a.comboboxState,{0:()=>l.goToOption(lr.Previous),1:()=>{_n.flushSync(()=>l.openCombobox()),a.value||l.goToOption(lr.Last)}});case as.Home:if(R.shiftKey)break;return R.preventDefault(),R.stopPropagation(),l.goToOption(lr.First);case as.PageUp:return R.preventDefault(),R.stopPropagation(),l.goToOption(lr.First);case as.End:if(R.shiftKey)break;return R.preventDefault(),R.stopPropagation(),l.goToOption(lr.Last);case as.PageDown:return R.preventDefault(),R.stopPropagation(),l.goToOption(lr.Last);case as.Escape:return a.comboboxState!==0?void 0:(R.preventDefault(),a.optionsElement&&!a.optionsPropsRef.current.static&&R.stopPropagation(),a.mode===0&&a.value===null&&N(),l.closeCombobox());case as.Tab:if(a.comboboxState!==0)return;a.mode===0&&a.activationTrigger!==1&&l.selectActiveOption(),l.closeCombobox();break}}),T=yt(R=>{h==null||h(R),a.mode===0&&R.target.value===""&&N(),l.openCombobox()}),O=yt(R=>{var W,Y,Z;let U=(W=R.relatedTarget)!=null?W:zc.find(z=>z!==R.currentTarget);if(!((Y=a.optionsElement)!=null&&Y.contains(U))&&!((Z=a.buttonElement)!=null&&Z.contains(U))&&a.comboboxState===0)return R.preventDefault(),a.mode===0&&a.value===null&&N(),l.closeCombobox()}),A=yt(R=>{var W,Y,Z;let U=(W=R.relatedTarget)!=null?W:zc.find(z=>z!==R.currentTarget);(Y=a.buttonElement)!=null&&Y.contains(U)||(Z=a.optionsElement)!=null&&Z.contains(U)||a.disabled||a.immediate&&a.comboboxState!==0&&S.microTask(()=>{_n.flushSync(()=>l.openCombobox()),l.setActivationTrigger(1)})}),P=o1(),F=vTe(),{isFocused:V,focusProps:H}=iq({autoFocus:g}),{isHovered:$,hoverProps:I}=oq({isDisabled:m}),B=C.useMemo(()=>({open:a.comboboxState===0,disabled:m,hover:$,focus:V,autofocus:g}),[a,$,V,g,m]),L=cM({ref:v,id:f,role:"combobox",type:b,"aria-controls":(n=a.optionsElement)==null?void 0:n.id,"aria-expanded":a.comboboxState===0,"aria-activedescendant":a.activeOptionIndex===null?void 0:a.virtual?(r=a.options.find(R=>!R.dataRef.current.disabled&&a.compare(R.dataRef.current.value,a.virtual.options[a.activeOptionIndex])))==null?void 0:r.id:(s=a.options[a.activeOptionIndex])==null?void 0:s.id,"aria-labelledby":P,"aria-describedby":F,"aria-autocomplete":"list",defaultValue:(i=(o=e.defaultValue)!=null?o:a.defaultValue!==void 0?p==null?void 0:p(a.defaultValue):null)!=null?i:a.defaultValue,disabled:m||void 0,autoFocus:g,onCompositionStart:_,onCompositionEnd:D,onKeyDown:M,onChange:T,onFocus:A,onBlur:O},H,I);return hi()({ourProps:L,theirProps:y,slot:B,defaultTag:wIe,name:"Combobox.Input"})}let CIe="button";function NIe(e,t){var n;let r=Rh("Combobox.Button"),s=fb("Combobox.Button"),o=tl(t,s.setButtonElement),i=C.useId(),{id:a=`headlessui-combobox-button-${i}`,disabled:l=r.disabled||!1,autoFocus:c=!1,...d}=e,f=Cq(r.inputElement),h=yt(k=>{switch(k.key){case as.Space:case as.Enter:k.preventDefault(),k.stopPropagation(),r.comboboxState===1&&_n.flushSync(()=>s.openCombobox()),f();return;case as.ArrowDown:k.preventDefault(),k.stopPropagation(),r.comboboxState===1&&(_n.flushSync(()=>s.openCombobox()),r.value||s.goToOption(lr.First)),f();return;case as.ArrowUp:k.preventDefault(),k.stopPropagation(),r.comboboxState===1&&(_n.flushSync(()=>s.openCombobox()),r.value||s.goToOption(lr.Last)),f();return;case as.Escape:if(r.comboboxState!==0)return;k.preventDefault(),r.optionsElement&&!r.optionsPropsRef.current.static&&k.stopPropagation(),_n.flushSync(()=>s.closeCombobox()),f();return;default:return}}),p=yt(k=>{k.preventDefault(),!bTe(k.currentTarget)&&(k.button===mM.Left&&(r.comboboxState===0?s.closeCombobox():s.openCombobox()),f())}),m=o1([a]),{isFocusVisible:g,focusProps:b}=iq({autoFocus:c}),{isHovered:y,hoverProps:x}=oq({isDisabled:l}),{pressed:v,pressProps:w}=tTe({disabled:l}),S=C.useMemo(()=>({open:r.comboboxState===0,active:v||r.comboboxState===0,disabled:l,value:r.value,hover:y,focus:g}),[r,y,g,v,l]),N=cM({ref:o,id:a,type:sRe(e,r.buttonElement),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsElement)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":m,disabled:l||void 0,autoFocus:c,onMouseDown:p,onKeyDown:h},b,x,w);return hi()({ourProps:N,theirProps:d,slot:S,defaultTag:CIe,name:"Combobox.Button"})}let kIe="div",EIe=Zk.RenderStrategy|Zk.Static;function jIe(e,t){var n,r,s;let o=C.useId(),{id:i=`headlessui-combobox-options-${o}`,hold:a=!1,anchor:l,portal:c=!1,modal:d=!0,transition:f=!1,...h}=e,p=Rh("Combobox.Options"),m=fb("Combobox.Options"),g=zRe(l);g&&(c=!0);let[b,y]=HRe(g),[x,v]=C.useState(null),w=VRe(),S=tl(t,g?b:null,m.setOptionsElement,v),N=i1(p.optionsElement),k=GRe(),[j,_]=mRe(f,x,k!==null?(k&eg.Open)===eg.Open:p.comboboxState===0);YTe(j,p.inputElement,m.closeCombobox);let D=p.__demoMode?!1:d&&p.comboboxState===0;uRe(D,N);let M=p.__demoMode?!1:d&&p.comboboxState===0;qTe(M,{allowed:C.useCallback(()=>[p.inputElement,p.buttonElement,p.optionsElement],[p.inputElement,p.buttonElement,p.optionsElement])}),Bn(()=>{var L;p.optionsPropsRef.current.static=(L=e.static)!=null?L:!1},[p.optionsPropsRef,e.static]),Bn(()=>{p.optionsPropsRef.current.hold=a},[p.optionsPropsRef,a]),xRe(p.comboboxState===0,{container:p.optionsElement,accept(L){return L.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:L.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(L){L.setAttribute("role","none")}});let T=o1([(n=p.buttonElement)==null?void 0:n.id]),O=C.useMemo(()=>({open:p.comboboxState===0,option:void 0}),[p.comboboxState]),A=yt(()=>{m.setActivationTrigger(0)}),P=yt(L=>{L.preventDefault(),m.setActivationTrigger(0)}),F=cM(g?w():{},{"aria-labelledby":T,role:"listbox","aria-multiselectable":p.mode===1?!0:void 0,id:i,ref:S,style:{...h.style,...y,"--input-width":hF(p.inputElement,!0).width,"--button-width":hF(p.buttonElement,!0).width},onWheel:p.activationTrigger===0?void 0:A,onMouseDown:P,...pRe(_)}),V=j&&p.comboboxState===1,H=Jk(V,(r=p.virtual)==null?void 0:r.options),$=Jk(V,p.value),I=yt(L=>p.compare($,L));if(p.virtual){if(H===void 0)throw new Error("Missing `options` in virtual mode");Object.assign(h,{children:C.createElement(tg.Provider,{value:H!==p.virtual.options?{...p,virtual:{...p.virtual,options:H}}:p},C.createElement(bIe,{slot:O},h.children))})}let B=hi();return C.createElement(dIe,{enabled:c?e.static||j:!1},C.createElement(tg.Provider,{value:p.mode===1?p:{...p,isSelected:I}},B({ourProps:F,theirProps:{...h,children:C.createElement(YRe,{freeze:V},typeof h.children=="function"?(s=h.children)==null?void 0:s.call(h,O):h.children)},slot:O,defaultTag:kIe,features:EIe,visible:j,name:"Combobox.Options"})))}let _Ie="div";function DIe(e,t){var n,r,s,o;let i=Rh("Combobox.Option"),a=fb("Combobox.Option"),l=C.useId(),{id:c=`headlessui-combobox-option-${l}`,value:d,disabled:f=(s=(r=(n=i.virtual)==null?void 0:n.disabled)==null?void 0:r.call(n,d))!=null?s:!1,order:h=null,...p}=e,m=Cq(i.inputElement),g=i.virtual?i.activeOptionIndex===i.calculateIndex(d):i.activeOptionIndex===null?!1:((o=i.options[i.activeOptionIndex])==null?void 0:o.id)===c,b=i.isSelected(d),y=C.useRef(null),x=ld({disabled:f,value:d,domRef:y,order:h}),v=C.useContext(Dq),w=tl(t,y,v?v.measureElement:null),S=yt(()=>{a.setIsTyping(!1),a.onChange(d)});Bn(()=>a.registerOption(c,x),[x,c]);let N=C.useRef(!(i.virtual||i.__demoMode));Bn(()=>{if(!i.virtual&&!i.__demoMode)return Yi().requestAnimationFrame(()=>{N.current=!0})},[i.virtual,i.__demoMode]),Bn(()=>{if(N.current&&i.comboboxState===0&&g&&i.activationTrigger!==0)return Yi().requestAnimationFrame(()=>{var P,F;(F=(P=y.current)==null?void 0:P.scrollIntoView)==null||F.call(P,{block:"nearest"})})},[y,g,i.comboboxState,i.activationTrigger,i.activeOptionIndex]);let k=yt(P=>{P.preventDefault(),P.button===mM.Left&&(f||(S(),Sq()||requestAnimationFrame(()=>m()),i.mode===0&&a.closeCombobox()))}),j=yt(()=>{if(f)return a.goToOption(lr.Nothing);let P=i.calculateIndex(d);a.goToOption(lr.Specific,P)}),_=dRe(),D=yt(P=>_.update(P)),M=yt(P=>{if(!_.wasMoved(P)||f||g)return;let F=i.calculateIndex(d);a.goToOption(lr.Specific,F,0)}),T=yt(P=>{_.wasMoved(P)&&(f||g&&(i.optionsPropsRef.current.hold||a.goToOption(lr.Nothing)))}),O=C.useMemo(()=>({active:g,focus:g,selected:b,disabled:f}),[g,b,f]),A={id:c,ref:w,role:"option",tabIndex:f===!0?void 0:-1,"aria-disabled":f===!0?!0:void 0,"aria-selected":b,disabled:void 0,onMouseDown:k,onFocus:j,onPointerEnter:D,onMouseEnter:D,onPointerMove:M,onMouseMove:M,onPointerLeave:T,onMouseLeave:T};return hi()({ourProps:A,theirProps:p,slot:O,defaultTag:_Ie,name:"Combobox.Option"})}let MIe=pi(vIe),Mq=pi(NIe),Tq=pi(SIe),TIe=_Te,Rq=pi(jIe),Iq=pi(DIe),RIe=Object.assign(MIe,{Input:Tq,Button:Mq,Label:TIe,Options:Rq,Option:Iq});function IIe({elementId:e}){const t=C.useRef(!1);return C.useEffect(()=>{if(t.current)return;const n=document.getElementById(e);return n&&(n.classList.add("semaphor-scope"),t.current=!0),()=>{n&&(n.classList.remove("semaphor-scope"),t.current=!1)}},[e]),null}const AIe=C.memo(({option:e,currentStyle:t})=>u.jsxs(Iq,{style:{borderRadius:t==null?void 0:t.controlInputRadius},value:e,className:"group flex cursor-default select-none items-start gap-2 rounded-sm px-3 py-1.5 data-[focus]:bg-muted",children:[u.jsx(Er,{className:"invisible size-4 shrink-0 group-data-[selected]:visible"}),e.value]},e.id),(e,t)=>e.option.id===t.option.id&&e.option.value===t.option.value);function PIe({options:e,onChange:t,selectedOptions:n,multiple:r=!0,externalFilteredOptions:s,selectAllChecked:o,onSelectAllCheckedChange:i,inputClassName:a,renderFilterModeButton:l,showNegativeIndicator:c,isSearching:d,resultSource:f="local",searchError:h,query:p,onQueryChange:m,filterDataType:g,onEnterKey:b,activeFilterValue:y}){const[x,v]=C.useState(""),w=p!==void 0?p:x,S=m||v,N=te(A=>A.themeStyle),k=s||e;function j(A,P){if(P)return"";const F=[">","<",">=","<=","="];return(g?La(g):!1)&&y&&F.includes(y.operation)?`${y.operation}${y.values[0]}`:A!=null&&A.length?A==null?void 0:A.map(H=>H.value).join(", "):""}function _(A){Array.isArray(A)||(A=[A]),t(A)}function D(){return d||k&&k.length>0?null:u.jsx("div",{className:"relative cursor-default select-none px-4 py-2",children:"No records found."})}function M(){return d?u.jsxs("div",{className:"flex items-center gap-2 border-b border-b-muted px-4 py-2 text-xs text-muted-foreground",children:[u.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Searching..."]}):h&&w?u.jsx("div",{className:"border-b border-b-muted px-4 py-2 text-xs text-amber-600",children:"Search unavailable. Showing available results."}):null}function T(){return w||!(e!=null&&e.length)?null:u.jsxs("div",{className:"border-b border-b-muted px-4 py-2 text-xs text-muted-foreground",children:["Showing top ",e.length," values. Type to search more..."]})}function O(){return!r||!(k!=null&&k.length)?null:u.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-b-muted px-4 py-2",children:[l==null?void 0:l(),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{children:"All"}),u.jsx(dn,{className:"border-muted-foreground/50",checked:o,onCheckedChange:i})]})]})}return u.jsx(RIe,{multiple:r,value:n,onChange:_,onClose:()=>{S("")},by:(A,P)=>Array.isArray(A)||Array.isArray(P)?!1:!A||!P?A===P:A.id===P.id,children:({open:A})=>u.jsxs("div",{children:[u.jsxs("div",{className:"relative flex items-center gap-0.5",children:[c&&u.jsx("div",{className:"h-8 w-0.5 bg-red-400"}),u.jsx(Tq,{className:K("h-8 w-full rounded-sm border border-border bg-background py-1.5 pl-3 pr-8 text-sm","data-[focus]:outline-border-none focus:outline-none data-[focus]:outline-none data-[focus]:-outline-offset-2",a),style:{borderRadius:N==null?void 0:N.controlInputRadius},displayValue:P=>j(P,A),onChange:P=>S(P.target.value),onKeyDown:P=>{if(P.key==="Enter"&&b){const F=/^(>=|<=|>|<|=)/.test(w.trim()),V=g?La(g):!1;F&&V&&(P.preventDefault(),b()&&P.target.blur())}}}),u.jsx(Mq,{className:"group absolute inset-y-0 right-0 px-2.5",children:u.jsx(Rs,{className:"size-4 text-muted-foreground hover:text-foreground"})})]}),u.jsxs(Rq,{anchor:"bottom",transition:!0,style:{borderRadius:N==null?void 0:N.controlInputRadius},className:Nu("mt-1 !max-h-60 w-[var(--input-width)] overflow-y-auto rounded-sm border border-border bg-background p-1 text-sm [--anchor-gap:var(--spacing-1)] empty:invisible","transition duration-100 ease-in data-[leave]:data-[closed]:opacity-0"),children:[A&&u.jsx(IIe,{elementId:"headlessui-portal-root"}),M(),T(),D(),O(),k==null?void 0:k.map(P=>u.jsx(AIe,{option:P,currentStyle:N},P.id))]})]})})}const DF=[{value:"=",label:"Equal to",symbol:"="},{value:">",label:"Greater than",symbol:">"},{value:">=",label:"Greater than or equal",symbol:"≥"},{value:"<",label:"Less than",symbol:"<"},{value:"<=",label:"Less than or equal",symbol:"≤"},{value:"between",label:"Between",symbol:"⟷"},{value:"not between",label:"Not Between",symbol:"⇎"}],OIe=new Set(["=",">","<",">=","<=","between","not between"]);function FIe(e){return OIe.has(e)?e:">="}function $Ie({filter:e}){var v;const[t,n]=C.useState(">="),[r,s]=C.useState(""),[o,i]=C.useState(""),[a,l]=C.useState(""),[c,d]=C.useState(!0),f=C.useRef(!1),h=sm(r,300),p=sm(o,300),m=sm(a,300),g=te(w=>w.filterValues),b=te(w=>w.themeStyle),{addOrUpdateFilterValue:y,removeFilterValues:x}=Wt();return C.useEffect(()=>()=>{f.current=!1},[]),C.useEffect(()=>{const w=g==null?void 0:g.find(S=>S.filterId===e.id);if(w&&w.operation!=="in"){const S=FIe(w.operation);if(t!==S&&(f.current=!1),f.current||n(S),S==="between"||S==="not between"){const N=w.values[0],k=w.values[1];i(N!=null?String(N):""),l(k!=null?String(k):""),s("")}else{const N=w.values[0];s(N!=null?String(N):""),i(""),l("")}}else f.current||(n(">="),s(""),i(""),l("")),d(!1)},[g,e.id]),C.useEffect(()=>{c&&(t==="between"||t==="not between"?p===o&&m===a&&d(!1):h===r&&d(!1))},[c,t,r,h,o,a,p,m]),C.useEffect(()=>{if(!c)if(t==="between"||t==="not between"){const w=p&&p.trim()!=="",S=m&&m.trim()!=="";if(!w||!S){!w&&!S&&x(e.id);return}const N=Number(p),k=Number(m);if(isNaN(N)||isNaN(k))return;const j={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:Ti(e),operation:t,values:[N,k]};y(j),f.current=!1}else{if(!h||h.trim()===""){x(e.id),f.current=!1;return}const w=Number(h);if(isNaN(w))return;const S={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:Ti(e),operation:t,values:[w]};y(S),f.current=!1}},[t,h,p,m,e.id,e.column,e.database,c,y,x,e]),u.jsxs("div",{className:"flex gap-2",children:[u.jsxs(lt,{value:t,onValueChange:w=>{f.current=!0,n(w)},children:[u.jsx(ot,{className:"h-8 w-16",style:{borderRadius:b==null?void 0:b.controlInputRadius},children:u.jsx("span",{className:"font-mono text-base",children:(v=DF.find(w=>w.value===t))==null?void 0:v.symbol})}),u.jsx(it,{children:DF.map(w=>u.jsx(me,{value:w.value,children:u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"font-mono",children:w.symbol}),u.jsx("span",{children:w.label})]})},w.value))})]}),t==="between"||t==="not between"?u.jsxs(u.Fragment,{children:[u.jsx(Un,{type:"number",placeholder:"Min",value:o,onChange:w=>i(w.target.value),className:"h-8 flex-1",style:{borderRadius:b==null?void 0:b.controlInputRadius}}),u.jsx(Un,{type:"number",placeholder:"Max",value:a,onChange:w=>l(w.target.value),className:"h-8 flex-1",style:{borderRadius:b==null?void 0:b.controlInputRadius}})]}):u.jsx(Un,{type:"number",placeholder:"Value",value:r,onChange:w=>s(w.target.value),className:"h-8 flex-1",style:{borderRadius:b==null?void 0:b.controlInputRadius}})]})}function LIe({filter:e}){const t=e.searchMode==="numeric",n=te(v=>v.themeStyle),{filteredRecords:r,isSingleSelect:s,allSelected:o,handleChange:i,handleSelectAll:a,handleApplyOperatorExpression:l,query:c,setQuery:d,isLoading:f,isFetching:h,isError:p,selectedRecords:m,isSearching:g,searchError:b,resultSource:y,activeFilterValue:x}=iM(e,{enableServerSearch:!0,searchDebounceMs:300,minSearchLength:2,searchThreshold:5});return f||h?u.jsx(Aa,{style:{borderRadius:n==null?void 0:n.controlInputRadius},className:"h-8 w-full bg-foreground/10"}):p?u.jsx("div",{className:"flex h-8 w-full items-center bg-muted px-2 text-sm",children:"Error"}):t?u.jsx($Ie,{filter:e}):u.jsx(PIe,{showNegativeIndicator:e.operation==="not in",renderFilterModeButton:()=>u.jsx(zIe,{filter:e}),inputClassName:"h-8",options:r,selectedOptions:m,onChange:i,multiple:!s,selectAllChecked:o,onSelectAllCheckedChange:a,isSearching:g,resultSource:y,searchError:b,query:c,onQueryChange:d,filterDataType:e.dataType,activeFilterValue:x,onEnterKey:l})}function zIe({filter:e}){const t=e.operation==="in"?"include":"exclude",{setFilterMode:n}=Wt();function r(){t==="include"?n(e.id,"exclude"):n(e.id,"include")}return u.jsx(ie,{onClick:r,variant:"secondary",size:"sm",className:K("h-6 text-xs hover:underline",{}),children:_v(t)})}function BIe({filter:e}){var o;const{filteredRecords:t,handleChange:n,selectedRecords:r}=iM(e);function s(i){n([{value:i,id:i}])}return u.jsx(qa,{onValueChange:s,value:((o=r==null?void 0:r[0])==null?void 0:o.value)||"",className:"mt-2 flex gap-3 overflow-x-auto",children:t==null?void 0:t.map(i=>u.jsxs("div",{className:"flex gap-2",children:[u.jsx(Cr,{value:i.value,id:"r1"}),u.jsx(ae,{className:"text-muted-foreground",htmlFor:"r1",children:i.value})]},i.value))})}function bM({filter:e}){return Zu(e.dataType)?u.jsx(MMe,{filter:e}):e.uiType==="radio"&&e.type==="single"?u.jsx(BIe,{filter:e}):u.jsx(LIe,{filter:e})}function VIe({frame:e}){const[t,n]=C.useState(!1),r=e==null?void 0:e.cards[0],{data:s,isPending:o,isError:i}=Ha(r),a=e==null?void 0:e.cards[1],{data:l,isLoading:c,isFetching:d}=Ha(a);return(a==null?void 0:a.type)!=="text"?u.jsx(Qm,{card:r,data:(s==null?void 0:s.records)||[],isPending:o,isError:i}):u.jsxs(Fs,{className:K("group relative overflow-y-auto",t?"m-4":"mx-0"),children:[t?u.jsx("div",{className:"overflow-y-auto break-words p-1",children:u.jsx(Xf,{card:a,data:(l==null?void 0:l.records)||[],isLoading:!1})}):u.jsx(Qm,{card:r,data:(s==null?void 0:s.records)||[],isPending:o,isError:i}),u.jsx("div",{className:K("fixed z-10",{"invisible bottom-4 right-4 group-hover:visible":t,"right-6 top-6":!t}),children:u.jsx(ib,{disabled:c||d,className:K("h-7 p-1"),pressed:t,onPressedChange:n,"aria-label":"Toggle bold",children:t?u.jsx(xte,{className:"size-4 text-muted-foreground/70"}):u.jsx(vte,{className:"size-4 text-muted-foreground/70"})})})]})}function Y0(e){return{clickFilter:Na,drillToDetail:Tg,drillThrough:Vx,drillToURL:Mg,drillDown:Cte,drillUp:Nte,dynamicDrill:nc,inlineDrill:Iv}[e]||Na}function cd(e){return{clickFilter:"Filter Dashboard",drillToDetail:"Show Details",drillThrough:"Navigate to Dashboard",drillToURL:"Open External Link",drillDown:"Drill Down",drillUp:"Drill Up",dynamicDrill:"Explore Field",inlineDrill:"Drill"}[e]||"Interaction"}function HIe(e,t,n,r,s){const o=Y0(e.mode),i=e.label||cd(e.mode),a=UIe(e,t,n,r,s);return{label:i,icon:o,targetInfo:a,interaction:e}}function UIe(e,t,n=0,r,s){var o,i,a,l,c,d;switch(e.mode){case"clickFilter":{if((o=e.applyToCardIds)!=null&&o.length){const f=e.applyToCardIds.length;return`Apply to ${f} ${f===1?"card":"cards"}`}return(i=e.excludeCardIds)!=null&&i.length?"Apply to all cards":"Apply to other cards"}case"drillToDetail":{if(e.targetInsightId)return"Drill into Insight";const f=((a=e.detailFields)==null?void 0:a.length)||0;return f>0?`Show ${f} detail ${f===1?"field":"fields"}`:"Show detail table"}case"drillThrough":return e.targetDashboardId,"Navigate to dashboard";case"drillToURL":{if(e.urlTemplate)try{return`Open ${new URL(e.urlTemplate).hostname}`}catch{return"Open external link"}return"Open external link"}case"drillDown":{if(e.hierarchyId&&t){const f=t.find(h=>h.id===e.hierarchyId);if(f&&f.steps.length>0){let h;if((f.type==="date"||f.baseField)&&r&&f.baseField){const p=zE(f,r,s),m=LE(f,p);h=m==null?void 0:m.field}else h=(l=f.steps[n])==null?void 0:l.field;return h?h.label:n>=f.steps.length?"End of path":f.label||"Drill by hierarchy"}}return"Drill to next level"}case"drillUp":{if(n>0&&e.hierarchyId&&t){const f=t.find(h=>h.id===e.hierarchyId);if(f&&f.steps.length>0){const h=(c=f.steps[n-2])==null?void 0:c.field;return h?`Back to ${h.label}`:`Back to All: ${f.label||"Data"}`}}return"Go back one level"}case"dynamicDrill":{if(e.drillField)return`Drill into ${e.drillField.label} data`;if((d=e.availableFields)!=null&&d.length){const f=e.availableFields.length;return`Choose from ${f} ${f===1?"dimension":"dimensions"}`}return"Explore dimension"}case"inlineDrill":{const f=e.inlineLimit||100,h=e.displayMode||"table";return`Show ${f} records as ${h}`}default:return""}}function WIe(e,t,n,r,s){return e.map(o=>HIe(o,t,n,r,s))}function qIe({open:e,onOpenChange:t,position:n,interactions:r,selectedConditions:s,onSelectInteraction:o,drillHierarchies:i,cardId:a,card:l}){const{currentDepth:c,breadcrumbs:d}=Xt(w=>{var S,N,k;return{currentDepth:a?((N=(S=w.interactionStates[a])==null?void 0:S.breadcrumbs)==null?void 0:N.length)??0:0,breadcrumbs:a?((k=w.interactionStates[a])==null?void 0:k.breadcrumbs)??[]:[]}}),f=E.useMemo(()=>WIe(r,i,c,l,d),[r,i,c,l,d]),h=E.useMemo(()=>{if(s.length===0)return"";const w=s[0];if(w.label){const S=w.label.split(/[=><]/);if(S.length>1)return S[1].trim()}return String(w.value)},[s]);if(E.useEffect(()=>{if(!e)return;const w=S=>{S.key==="Escape"&&t(!1)};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[e,t]),!e||!n)return null;const p=280,m=80+f.length*60,g=window.innerWidth,b=window.innerHeight;let y=n.x,x=n.y+8;y+p>g&&(y=Math.max(8,g-p-8)),x+m>b&&(x=Math.max(8,n.y-m-8));const v=u.jsxs("div",{className:"semaphor-scope",style:{position:"fixed",inset:0,pointerEvents:"none",background:"transparent"},children:[u.jsx("div",{className:"fixed inset-0",style:{zIndex:50,pointerEvents:"auto",background:"transparent"},onClick:()=>t(!1),"aria-hidden":"true"}),u.jsxs("div",{className:K("fixed rounded-lg border bg-popover shadow-lg","animate-in fade-in-0 zoom-in-95"),style:{left:`${y}px`,top:`${x}px`,zIndex:51,width:`${p}px`,maxHeight:"400px",pointerEvents:"auto"},role:"menu","aria-label":"Select interaction",children:[h&&u.jsxs("div",{className:"border-b px-4 py-3",children:[u.jsx("p",{className:"text-xs text-muted-foreground",children:"Selected"}),u.jsx("p",{className:"text-sm font-medium",children:h})]}),u.jsx("div",{className:"max-h-80 overflow-y-auto py-1",children:f.map((w,S)=>{var j;const N=w.icon,k=w.interaction.mode==="dynamicDrill"&&(S===0||((j=f[S-1])==null?void 0:j.interaction.mode)!=="dynamicDrill");return u.jsxs(E.Fragment,{children:[k&&u.jsx("div",{className:"border-t px-4 py-2",children:u.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"⚡ Explore Other Fields"})}),u.jsxs("button",{className:K("flex w-full items-start gap-3 px-4 py-3","hover:bg-accent hover:text-accent-foreground","cursor-pointer transition-colors","border-b text-left last:border-b-0"),onClick:()=>{o(w.interaction),t(!1)},role:"menuitem",children:[u.jsx("div",{className:"mt-0.5 flex-shrink-0",children:u.jsx(N,{className:"h-4 w-4 text-muted-foreground"})}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("p",{className:"mb-1 text-sm font-medium leading-none",children:w.label}),w.targetInfo&&u.jsx("p",{className:"text-xs text-muted-foreground",children:w.targetInfo})]})]})]},S)})})]})]});return _n.createPortal(v,document.body)}function YIe(e){const t=C.useRef([]),n=C.useRef(null),r=C.useRef(null),o=Di(e.interactionConfig).some(h=>h.mode==="clickFilter"&&h.trigger!==void 0),i=Ap(h=>h.registerClearBlurCallback),a=Ap(h=>h.unregisterCard);C.useEffect(()=>{const h=()=>{r.current&&f(r.current)};return i(e.id,h),()=>{a(e.id)}},[e.id,i,a]);function l({chart:h,selectedSegments:p,storedOriginalColorsRef:m}){if(!h||!h.canvas||!h.canvas.ownerDocument){console.warn("Chart or canvas is null when trying to toggle blur segments");return}const g=h.data.datasets;m.current||(m.current=g.map((y,x)=>h.getDatasetMeta(x).data.map(w=>w.options.backgroundColor)));const b=m.current;g.forEach((y,x)=>{const v=b[x];if(p.length===0){y.backgroundColor=[...v];return}y.backgroundColor=v.map((w,S)=>p.some(k=>k.datasetIndex===x&&k.dataIndex===S)?w:c(w,.2))});try{h.update()}catch(y){console.warn("Failed to update chart during blur toggle:",y)}}function c(h,p=.2){if(h.startsWith("rgba"))return h.replace(/[\d.]+\)$/g,`${p})`);if(h.startsWith("#")){const m=parseInt(h.slice(1,3),16),g=parseInt(h.slice(3,5),16),b=parseInt(h.slice(5,7),16);return`rgba(${m}, ${g}, ${b}, ${p})`}return h}function d(h,p){var v;if(!o||!p)return;r.current=p;const m=p.getElementsAtEventForMode(h,"nearest",{intersect:!0},!0);if(!m.length)return;const{datasetIndex:g,index:b}=m[0],y={datasetIndex:g,dataIndex:b};if(((v=h.native)==null?void 0:v.shiftKey)||h.shiftKey){const w=t.current.findIndex(S=>S.datasetIndex===g&&S.dataIndex===b);w>=0?t.current.splice(w,1):t.current.push(y)}else{const w=t.current.length===1&&t.current[0].datasetIndex===g&&t.current[0].dataIndex===b;t.current=w?[]:[y]}l({chart:p,selectedSegments:t.current,storedOriginalColorsRef:n})}function f(h){h&&(t.current=[],n.current&&l({chart:h,selectedSegments:[],storedOriginalColorsRef:n}))}return{handleChartClick:d,clearBlur:f}}function GIe({resolvedCardConfig:e,card:t,records:n,chart:r,clickEvent:s}){var c,d,f,h,p,m,g,b,y,x;const o=r==null?void 0:r.getElementsAtEventForMode(s,"nearest",{intersect:!0},!0);if(!o.length)return;const i=o[0].datasetIndex,a=o[0].index,l=(d=(c=o[0].element)==null?void 0:c.$context)==null?void 0:d.raw;console.log("datasetIndex",i),console.log("clickIndex",a),console.log("value",l);try{if(!(n!=null&&n.length))return;const{keys:v}=Qn(n),{groupByColumns:w=[],pivotByColumns:S=[],metricColumns:N=[]}=e||t.config,k=j=>w.find(_=>_.label===j)||S.find(_=>_.label===j)||N.find(_=>_.label===j);if(t.type==="map"){const j=v[0],_=((h=(f=l==null?void 0:l.feature)==null?void 0:f.properties)==null?void 0:h.name)||((m=(p=l==null?void 0:l.feature)==null?void 0:p.properties)==null?void 0:m.NAME),D=k(j);return!D||_==null?void 0:{conditions:[{field:D,operator:"=",value:_}]}}if(["pie","funnel","doughnut"].includes(t.type)){const j=v[0],_=v==null?void 0:v[1+i],D=k(j),M=k(_),T=(g=n==null?void 0:n[a])==null?void 0:g[j];if(!D||T==null){console.log("no dim field or value",j,T);return}return{conditions:[{field:D,operator:"=",value:T}],metrics:M?[{field:M,value:l}]:void 0}}if(["stackedBar","bar","line"].includes(t.type)){const j=v[0],_=k(j),D=(b=n==null?void 0:n[a])==null?void 0:b[j];if(!_||D==null){console.log("no dim field or value for stacked bar",j,D);return}const M=N[i]||N[0];if(!M){console.log("no metric field found");return}const T=S[0],A=Object.keys(n[0]).filter(H=>H!==j)[i],F=(A?(y=n==null?void 0:n[a])==null?void 0:y[A]:(x=n==null?void 0:n[a])==null?void 0:x[M.label])??l,V=[{field:_,operator:"=",value:D}];return T&&A&&V.push({field:T,operator:"=",value:A}),{conditions:V,metrics:[{field:M,value:F}]}}}catch(v){console.error("getClickContextFromChart error",v)}}function ZIe(e){return e&&typeof e=="object"&&"field"in e&&"operator"in e}function KIe(e){return e&&typeof e=="object"&&"filterId"in e&&"operation"in e&&"values"in e}function Aq({filters:e,filterDefinitions:t,contextMode:n,className:r,showLabel:s=!0,labelText:o="Applied Filters:",icon:i}){if(!e||e.length===0)return n==="none"?u.jsx("div",{className:"px-6 pb-4",children:u.jsx("span",{className:"text-xs text-muted-foreground",children:"No filters applied"})}):null;const l=e.map(c=>{var d,f;if(ZIe(c))return{fieldName:((d=c.field)==null?void 0:d.label)||((f=c.field)==null?void 0:f.name)||"Unknown",operator:c.operator,value:QIe(c)};if(KIe(c)){const h=t==null?void 0:t.find(p=>p.id===c.filterId);return{fieldName:(h==null?void 0:h.title)||c.name,operator:c.operation,value:XIe(c)}}else return{fieldName:"Unknown",operator:"=",value:String(c)}}).reduce((c,d)=>(c[d.fieldName]||(c[d.fieldName]=[]),c[d.fieldName].push(d),c),{});return u.jsxs("div",{className:r||"px-6 pb-4 border-b",children:[u.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s&&i&&u.jsxs("div",{className:"flex items-center gap-2 text-foreground/80",children:[i,u.jsx("span",{className:"text-sm font-medium whitespace-nowrap",children:o})]}),s&&!i&&u.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:o}),u.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(l).map(([c,d])=>u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsxs("span",{className:"text-sm font-medium",children:[c,":"]}),d.map((f,h)=>u.jsx(kt,{variant:"secondary",className:"border border-primary/20 bg-primary/10 text-primary",children:f.value},`${c}-${h}`))]},c))})]}),n&&u.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[n==="interactionFilters"&&u.jsx("span",{children:"Showing data filtered by interaction only"}),n==="full"&&u.jsx("span",{children:"Showing data with all dashboard filters + interaction filters"}),n==="none"&&u.jsx("span",{children:"Showing all data (no filters applied)"})]})]})}function XIe(e){const{values:t,operation:n}=e;return!t||t.length===0?"":n==="="||n==="!="||n===">"||n==="<"||n===">="||n==="<="?String(t[0]):n==="in"||n==="not in"?t.map(r=>String(r)).join(", "):(n==="between"||n==="not between")&&t.length===2?`${t[0]} - ${t[1]}`:String(t[0])}function QIe(e){const{operator:t,value:n}=e;if(e.label){const r=e.label.split(/[=><]/);if(r.length>1)return r[1].trim()}switch(t){case"=":return String(n);case"!=":return`≠ ${n}`;case">":return`> ${n}`;case"<":return`< ${n}`;case">=":return`≥ ${n}`;case"<=":return`≤ ${n}`;case"in":return Array.isArray(n)?n.join(", "):String(n);case"not in":return`not ${Array.isArray(n)?n.join(", "):n}`;case"contains":return`contains ${n}`;case"startsWith":return`starts with ${n}`;case"endsWith":return`ends with ${n}`;case"between":return Array.isArray(n)?`between ${n[0]} and ${n[1]}`:String(n);case"not between":return Array.isArray(n)?`not between ${n[0]} and ${n[1]}`:String(n);case"isNull":return"is null";case"isNotNull":return"is not null";default:return String(n)}}function JIe({cardId:e,className:t}){const n=Xt(d=>d.interactionStates[e]),r=Xt(d=>d.popInteractionStep),s=Xt(d=>d.resetInteractionState),o=(n==null?void 0:n.breadcrumbs)??[];if(n==null||n.hierarchyId,o.length===0)return null;const i=d=>{const f=o.length-d-1;for(let h=0;h<f;h++)r(e)},a=()=>{s(e)},l=d=>(d.sourceFilterGroups[0],d.toField?d.toField.label||d.toField.name:"Drill Step"),c=d=>{const f=d.sourceFilterGroups.flatMap(h=>h.filters);return u.jsxs("div",{className:"max-w-xs space-y-2 text-sm",children:[f.length>0&&u.jsx(Aq,{filters:f,className:"pb-2",labelText:"Drill Down Filters:",icon:u.jsx(Ete,{className:"h-4 w-4 text-foreground/80"})}),d.granularity&&u.jsxs("div",{className:"flex items-center gap-2 pb-2",children:[u.jsx(so,{className:"h-4 w-4 text-foreground/80"}),u.jsxs("span",{className:"text-sm font-medium text-foreground/80",children:["Granularity: ",d.granularity]})]}),d.metric&&u.jsxs("div",{className:"flex items-center gap-2 pb-2",children:[u.jsx(fte,{className:"h-4 w-4 text-foreground/80"}),u.jsxs("span",{className:"text-sm font-medium text-foreground/80",children:["Value:"," ",d.metric.formattedValue||d.metric.value]})]})]})};return u.jsx(Yr,{children:u.jsxs("div",{className:K("flex items-center gap-1 text-sm",t),children:[u.jsx(er,{children:u.jsx(tr,{asChild:!0,children:u.jsx("button",{className:"flex items-center p-0 text-muted-foreground hover:text-foreground",onClick:a,"aria-label":"Reset drill path",children:u.jsx($$,{className:"h-3.5 w-3.5"})})})}),u.jsx(Ba,{className:"ml-0.5 h-3 w-3 text-muted-foreground"}),u.jsx("div",{className:"flex items-center",children:o.map((d,f)=>u.jsxs("div",{className:"flex items-center",children:[f>0&&u.jsx(Ba,{className:"mx-1 h-3 w-3 text-muted-foreground"}),u.jsxs(er,{delayDuration:0,children:[u.jsx(tr,{asChild:!0,children:u.jsx(ie,{variant:"link",size:"sm",className:"h-6 px-1 text-muted-foreground no-underline hover:text-foreground hover:no-underline",onClick:()=>i(f),"aria-label":`Go back to: ${l(d)}`,children:l(d)})}),u.jsx(eM,{className:"ml-4",side:"bottom",children:c(d)})]})]},f))})]})})}function eAe(e){switch(e){case"content-only":return{showHeader:!1,showTitle:!1,showDescription:!1,showTabs:!1,showFooter:!1,showFilters:!1,showBreadcrumbs:!1,showRefreshIndicator:!1,showFilterInfo:!1};case"print":return{showHeader:!0,showTitle:!0,showDescription:!0,showTabs:!1,showFilters:!1,showBreadcrumbs:!1,showRefreshIndicator:!1,showFilterInfo:!1,showTableToolbar:!1,showColumnSettings:!1};case"embed":return{showHeader:!1,showTitle:!0,showDescription:!1,showTabs:!0,showFooter:!1,showFilters:!1,showBreadcrumbs:!1,showRefreshIndicator:!1,showFilterInfo:!1};case"table-print":return{showHeader:!1,showTitle:!0,showDescription:!1,showTabs:!1,showFooter:!1,showFilters:!1,showBreadcrumbs:!1,showRefreshIndicator:!1,showFilterInfo:!1,showPagination:!1,showTableToolbar:!1,showColumnSettings:!1};case"full":default:return{showHeader:!0,showTitle:!0,showDescription:!0,showTabs:!0,showFooter:!0,showFilters:!0,showBreadcrumbs:!0,showRefreshIndicator:!0,showFilterInfo:!0}}}function yM({children:e,displayPreferences:t={mode:"full"},currentUser:n}){const r=C.useMemo(()=>{const s=t.mode||"full",o=eAe(s),i=lz(n||null),a={mode:s,overrides:{...o,...i,...t.overrides}};return{displayPreferences:a,shouldShowElement:c=>{var d;return((d=a.overrides)==null?void 0:d[c])??!0}}},[t,n]);return u.jsx(rz.Provider,{value:r,children:e})}function MF({card:e,frame:t}){var ne,oe,de,le,ke,ye,Pe,Ve,dt;const{customCards:n,placeholders:r,tokenProps:s}=Ye(),{shouldShowElement:o}=sc(),i=Xt(ue=>ue.interactionStates[e.id]),a=((ne=i==null?void 0:i.breadcrumbs)==null?void 0:ne.length)>0,l=te(ue=>ue.themeStyle),c=te(ue=>ue.selectedSheetId),d=te(ue=>ue.isDashboardEditing);te(ue=>ue.selectedLensId);const f=te(ue=>ue.dashboard.filters),h=f==null?void 0:f.find(ue=>ue.id===t.filterId&&!ue.hide),{setCardTitle:p,setCardDescription:m,setSelectedFrameId:g,updateFilter:b}=Wt(),{updateFrame:y}=Wt(),{handleChartClick:x}=YIe(e),v=o("showHeader")&&(((oe=e.customCardPreferences)==null?void 0:oe.showCardHeader)??!0),{isError:w,isLoading:S,isFetching:N,cfg:k,isPending:j,data:_,handleDatapointClick:D,pagination:M}=qg(e),[T,O]=C.useState({open:!1,position:null,interactions:[],context:null}),{breadcrumbs:A,hierarchyId:P}=Xt(ue=>{var Ne,et;return{breadcrumbs:((Ne=ue.interactionStates[e.id])==null?void 0:Ne.breadcrumbs)??[],hierarchyId:(et=ue.interactionStates[e.id])==null?void 0:et.hierarchyId}}),F=(ue,Ne,et)=>{var Oe;const We=A.length>0?[{mode:"drillUp",trigger:(Oe=ue[0])==null?void 0:Oe.trigger,label:"Drill Up",hierarchyId:P}]:[],re=[];for(const Me of ue)if(Me.mode==="dynamicDrill"&&Me.availableFields){const nt=Me.availableFields.filter(Dt=>!A.some(ft=>{var Ot;return((Ot=ft.toField)==null?void 0:Ot.id)===Dt.id}));for(const Dt of nt)re.push({mode:"dynamicDrill",trigger:Me.trigger,drillField:Dt,label:Dt.label,availableFields:Me.availableFields})}const fe=ue.filter(Me=>Me.mode!=="dynamicDrill"),De=[...We,...fe,...re];O({open:!0,position:et||{x:0,y:0},interactions:De,context:Ne})},{handlePointerInteraction:V,applySelectedInteraction:H}=eee(e,t.id,c||"",F),$=E3(e),I=C.useMemo(()=>{var ue;return e.type!=="pivotTable"||!((ue=_==null?void 0:_.records)!=null&&ue.length)?null:{records:_.records,columnSubtotalMeta:_.columnSubtotalMeta,subtotalColumns:_.subtotalColumns||[],pivotSchema:_.pivotSchema||[],groupByColumns:_.groupByColumns}},[e.type,_==null?void 0:_.records,_==null?void 0:_.columnSubtotalMeta,_==null?void 0:_.subtotalColumns,_==null?void 0:_.pivotSchema,_==null?void 0:_.groupByColumns]),B=Nh(e,I),L=(ue,Ne)=>{const et={...e,paginationConfig:{page:ue+1,pageSize:Ne}},We={...t,cards:t.cards.map(re=>re.id===e.id?et:re)};c&&y(c,We)};function R(ue,Ne){ue.stopPropagation();const et=GIe({resolvedCardConfig:$,card:e,records:(_==null?void 0:_.records)||[],chart:Ne,clickEvent:ue.nativeEvent});if(!et)return;const We=Di(e.interactionConfig),re=BE(We,et),fe=re.length===1&&re[0].mode==="clickFilter",De=re.some(nt=>nt.mode==="dynamicDrill"),Oe=re.length>1||De;ue.button===0&&fe&&!Oe&&x(ue.nativeEvent,Ne);const Me={shift:ue.shiftKey,ctrl:ue.ctrlKey,meta:ue.metaKey};ue.button===0?V({context:et,gesture:"leftClick",modifierKeys:Me,position:{x:ue.clientX,y:ue.clientY}}):ue.button===2&&V({context:et,gesture:"rightClick",modifierKeys:Me,position:{x:ue.clientX,y:ue.clientY}})}function W(){var ue,Ne,et;if(n&&n.length>0){const We=n.find(re=>re.cardId===e.id);if(We&&We.replaceDefault){const re=We.content;if(re)return u.jsx(re,{card:e})}}if(e.type==="kpi"){if(((ue=t==null?void 0:t.cards)==null?void 0:ue.length)===1)return u.jsx(Qm,{card:e,data:w?[]:(_==null?void 0:_.records)||[],isPending:j,isError:w});if(((Ne=t==null?void 0:t.cards)==null?void 0:Ne.length)>1)return u.jsx(VIe,{frame:t})}return e.type==="text"&&((et=t==null?void 0:t.cards)==null?void 0:et.length)===1?u.jsx(Fs,{className:"my-4 overflow-y-auto break-words px-4",children:u.jsx(Xf,{isLoading:S||N,card:e,data:(_==null?void 0:_.records)||[]})}):ee}function Y(){if(w)return u.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[u.jsx(Pv,{className:"size-8 text-destructive"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Error fetching data. Check your card settings."})]});if((S||N)&&e.type!=="table")return u.jsx("div",{className:"flex h-full w-full items-center justify-center",children:u.jsx($u,{size:"md",color:"muted","aria-label":"Loading data"})});if(_!=null&&_.records&&(_==null?void 0:_.records.length)===0)return r!=null&&r.NoRecords?u.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:r.NoRecords}):u.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[u.jsx(uj,{className:"size-8 text-muted-foreground"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"No results to display"})]});if(e.type==="table")return u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(Jg,{card:e,data:(_==null?void 0:_.records)||[],paginationMetadata:M,onPaginationChange:L,isLoading:S||N})});if(e.type==="pivotTable"&&B)return u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(tb,{card:e,data:B.data,options:B.options,onAggregationChange:ue=>{const Ne=Uk(ue,e.config),et={...e,config:Ne},We={...t,cards:t.cards.map(re=>re.id===e.id?et:re)};c&&y(c,We)},onAggregationLabelChange:ue=>{const Ne=YW(ue,e.config),et={...e,config:Ne},We={...t,cards:t.cards.map(re=>re.id===e.id?et:re)};c&&y(c,We)}})});if(e.type==="aggregateTable")return u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(Lw,{card:e,data:(_==null?void 0:_.records)||[],groupByColumns:_==null?void 0:_.groupByColumns,pivotSchema:_==null?void 0:_.pivotSchema,paginationMetadata:M,onPaginationChange:L,onAggregationChange:ue=>{const Ne=Uk(ue,e.config),et={...e,config:Ne},We={...t,cards:t.cards.map(re=>re.id===e.id?et:re)};c&&y(c,We)},isLoading:S||N})});if(e.type==="text")return u.jsx(Fs,{className:"overflow-y-auto break-words pr-2",children:u.jsx(Xf,{isLoading:S||N,card:e,data:(_==null?void 0:_.records)||[]})});if(e.type==="custom")return u.jsx(hc,{FallbackComponent:Vw,children:u.jsx(LD,{frame:t,card:e})});if(n&&n.length>0){const ue=n.find(Ne=>Ne.cardId===e.id);if(ue&&ue.content){const Ne=ue.content;return u.jsx(Ne,{card:e})}}if(k)return u.jsx(eb,{cfg:k,onChartClick:R,onDatapointClick:D})}function Z(){if(n&&n.length>0){const ue=n.find(Ne=>Ne.cardId===e.id);if(ue&&ue.footer){const Ne=ue.footer;if(Ne)return u.jsx(Ne,{card:e})}}return null}function U(){var et;const ue=t.cards.filter(We=>{var re;return!((re=We.tabTitle)!=null&&re.endsWith("__Header"))&&(We.displayTab===!0||We.displayTab===void 0)}),Ne=l==null?void 0:l.controlInputRadius;return u.jsx(fo,{value:t.activeCardId,className:"flex items-center justify-end gap-3",onValueChange:We=>{const re={...t,activeCardId:We};y(c,re)},children:u.jsx(Ls,{style:{borderRadius:l==null?void 0:l.controlInputRadius},className:"flex-end flex h-9 flex-wrap items-center border border-border bg-background p-0",children:(et=t.cards.filter(We=>{var re;return!((re=We.tabTitle)!=null&&re.endsWith("__Header"))&&(We.displayTab===!0||We.displayTab===void 0)}))==null?void 0:et.map((We,re)=>u.jsx(bn,{className:K("h-full items-center rounded-none data-[state=active]:bg-muted data-[state=active]:shadow-none",{"border-r":re!==ue.length-1}),style:{borderTopLeftRadius:re===0?Ne:0,borderTopRightRadius:re===ue.length-1?Ne:0,borderBottomLeftRadius:re===0?Ne:0,borderBottomRightRadius:re===ue.length-1?Ne:0},value:We.id,children:We.tabTitle||We.title},We.id))})})}function z(){var Ne,et,We,re;let ue=t.cards.find(fe=>fe.type==="kpi"&&fe.tabTitle===`${e.tabTitle}__Header`);return ue||(ue=t.cards.find(fe=>fe.type==="kpi"&&fe.tabTitle==="All__Header")),ue?u.jsx("div",{className:"flex items-end gap-2",children:u.jsx(CMe,{renderFilterInfo:()=>{var fe,De,Oe,Me;return o("showFilterInfo")&&((De=(fe=e.preferences)==null?void 0:fe.displayOptions)==null?void 0:De.showFilterInfo)!==!1?u.jsx(Hk,{cardId:e.id,cardFilters:(Oe=e.config)==null?void 0:Oe.filters,cardFilterCount:U0(((Me=e.config)==null?void 0:Me.filters)||null)}):null},card:ue})}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{role:"card-title-container",className:"flex h-7 items-center gap-2",children:[o("showTitle")&&u.jsx(Vi,{className:K("text-base",{}),children:u.jsx(Ro,{value:e.title,onSave:fe=>p(c,e.id,fe),isEditable:d,placeholder:"Add title",displayClassName:"text-base font-semibold",inputClassName:"text-base font-semibold"})}),o("showTitle")&&(d||e.info)&&u.jsx(qW,{card:e}),o("showRefreshIndicator")&&e.refreshInterval&&u.jsxs(er,{children:[u.jsx(tr,{className:"pr-1",children:u.jsx("div",{className:K("h-2 w-2 rounded-full bg-green-500 transition-opacity",{"opacity-10":S||N})})}),u.jsx(fr,{side:"right",align:"center",children:u.jsx("p",{className:"text-xs",children:`Realtime (${e==null?void 0:e.refreshInterval})`})})]}),o("showFilterInfo")&&((et=(Ne=e.preferences)==null?void 0:Ne.displayOptions)==null?void 0:et.showFilterInfo)!==!1&&u.jsx(Hk,{cardId:e.id,cardFilters:(We=e.config)==null?void 0:We.filters,cardFilterCount:U0(((re=e.config)==null?void 0:re.filters)||null)})]}),u.jsxs("div",{"data-content":"card-description-and-breadcrumb",className:"flex h-6 items-center overflow-y-auto",children:[!a&&o("showDescription")&&u.jsx("div",{className:K("text-sm text-muted-foreground",{}),children:u.jsx(Ro,{value:(e==null?void 0:e.description)||"",onSave:fe=>m(c,e.id,fe),isEditable:d,placeholder:"Add description",displayClassName:"text-sm text-muted-foreground",inputClassName:"text-sm"})}),a&&o("showBreadcrumbs")&&u.jsx(JIe,{cardId:e.id})]})]})}if(!e.id)return null;const q=((le=(de=e.preferences)==null?void 0:de.displayOptions)==null?void 0:le.showChrome)??!0,G=((ye=(ke=e.preferences)==null?void 0:ke.displayOptions)==null?void 0:ye.allowScroll)??!0,ee=q?u.jsxs(u.Fragment,{children:[v?u.jsx(Bi,{children:u.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[u.jsx("div",{className:"flex-1 basis-0 scroll-pb-2 overflow-x-auto",role:"header-container",children:z()}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx("div",{children:h&&o("showFilters")&&u.jsxs("div",{style:{borderRadius:(Ve=(Pe=l==null?void 0:l.chart)==null?void 0:Pe.options)==null?void 0:Ve.borderRadius},"data-content":"frame-filter-container",className:"flex shrink-0 items-center",children:[!Zu(h.dataType)&&u.jsx(ae,{className:"my-1 shrink-0 px-3",children:u.jsx(Ro,{value:h.title||h.column,onSave:ue=>b({...h,title:ue}),isEditable:d,placeholder:"Filter",displayClassName:"text-sm",inputClassName:"text-sm"})}),u.jsx(bM,{filter:h})]})}),t.cards.length>1&&o("showTabs")&&U()]})]})}):u.jsx("div",{className:"h-8"}),u.jsx(za,{"data-role":"card-content",className:"relative flex min-h-0 grow flex-col",children:Y()}),o("showFooter")&&u.jsx(f$,{children:Z()})]}):Y(),Q=()=>q&&G?"flex h-full flex-col":q&&!G?"flex h-full flex-col overflow-hidden":!q&&!G?"h-full":"h-full overflow-auto";return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:K(Q(),{"animate-pulse":S||N}),children:W()}),T.context&&u.jsx(qIe,{open:T.open,onOpenChange:ue=>{O(Ne=>({...Ne,open:ue}))},position:T.position,interactions:T.interactions,selectedConditions:T.context.conditions,drillHierarchies:(dt=e.interactionConfig)==null?void 0:dt.drillHierarchies,cardId:e.id,card:e,onSelectInteraction:ue=>{T.context&&H(ue,T.context),O({open:!1,position:null,interactions:[],context:null})}})]})}function Pq({card:e,frame:t}){return e.displayPreferences?u.jsx(yM,{displayPreferences:e.displayPreferences,children:u.jsx(MF,{card:e,frame:t})}):u.jsx(MF,{card:e,frame:t})}function tAe({card:e,frame:t,showTitle:n=!0}){const{isError:r,isLoading:s,isFetching:o,cfg:i,data:a,pagination:l}=qg(e),c=C.useMemo(()=>{var h;return e.type!=="pivotTable"||!((h=a==null?void 0:a.records)!=null&&h.length)?null:{records:a.records,columnSubtotalMeta:a.columnSubtotalMeta,subtotalColumns:a.subtotalColumns||[],pivotSchema:a.pivotSchema||[],groupByColumns:a.groupByColumns}},[e.type,a==null?void 0:a.records,a==null?void 0:a.columnSubtotalMeta,a==null?void 0:a.subtotalColumns,a==null?void 0:a.pivotSchema,a==null?void 0:a.groupByColumns]),d=Nh(e,c);if(s||o)return u.jsxs("div",{className:"flex h-full grow flex-col items-center justify-center gap-4 p-12",children:[u.jsx(fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading visual..."})]});if(r)return u.jsx("div",{className:"flex flex-col items-center justify-center gap-2 p-12",children:u.jsx("p",{className:"text-sm font-medium text-destructive",children:"Failed to load visual"})});function f(){return e.type==="kpi"?u.jsx(Qm,{card:e,data:(a==null?void 0:a.records)||[],isPending:s||o}):e.type==="table"?u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(Jg,{card:e,data:(a==null?void 0:a.records)||[],isLoading:s||o,paginationMetadata:l})}):e.type==="pivotTable"&&d?u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(tb,{card:e,data:(a==null?void 0:a.records)||[],onAggregationChange:()=>{},onAggregationLabelChange:()=>{}})}):e.type==="aggregateTable"?u.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:u.jsx(Lw,{card:e,data:(a==null?void 0:a.records)||[],groupByColumns:a==null?void 0:a.groupByColumns,pivotSchema:a==null?void 0:a.pivotSchema,paginationMetadata:l,onAggregationChange:()=>{},isLoading:s||o})}):e.type==="text"?u.jsx(Fs,{className:"overflow-y-auto break-words pr-2",children:u.jsx(Xf,{isLoading:s||o,card:e,data:(a==null?void 0:a.records)||[]})}):e.type==="custom"?u.jsx(hc,{FallbackComponent:Vw,children:u.jsx(LD,{frame:t,card:e})}):i?u.jsx(eb,{cfg:i,onChartClick:()=>{},onDatapointClick:()=>{}}):null}return u.jsxs("div",{className:"flex h-full w-full flex-col",children:[n&&e.title&&u.jsxs("div",{className:"border-b px-4 py-2",children:[u.jsx("h3",{className:"text-lg font-medium",children:e.title}),e.description&&u.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:e.description})]}),u.jsx("div",{className:"min-h-0 flex-1 p-4",children:f()})]})}function Oq({insightId:e,filters:t,contextMode:n}){const{data:r,isLoading:s,isError:o,error:i}=pj(e,{enabled:!!e}),a=Xt(f=>f.setInteractionState),l=Xt(f=>f.resetInteractionState),c=C.useMemo(()=>{var h;if(!r)return null;const f=(r==null?void 0:r.frameObject)??((h=r==null?void 0:r.visual)==null?void 0:h.frameObject);if(!f)return null;if(typeof f=="string")try{return JSON.parse(f)}catch{return null}return f},[r]),d=C.useMemo(()=>{var f;return(f=c==null?void 0:c.cards)!=null&&f.length?c.activeCardId&&c.cards.find(h=>h.id===c.activeCardId)||c.cards[0]:null},[c]);return C.useEffect(()=>{if(!d)return;if(n==="none"||!(t!=null&&t.length)){const m={...Go(),contextMode:n};a(d.id,m);return}const h={sourceCardId:"drill-to-insight",interactionMode:"clickFilter",filterGroups:[{filters:t}],applyToCardIds:[d.id]},p={...Go(),appliedClickFilters:[h],contextMode:n};return a(d.id,p),()=>{l(d.id)}},[d,t,n,a,l]),s?u.jsxs("div",{className:"flex h-full grow flex-col items-center justify-center gap-4 p-12",children:[u.jsx(fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading visual..."})]}):o?u.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 p-12",children:[u.jsx("p",{className:"text-sm font-medium text-destructive",children:"Failed to load insight"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:i instanceof Error?i.message:"Unknown error"})]}):!c||!d?u.jsx("div",{className:"flex items-center justify-center p-12",children:u.jsx("p",{className:"text-sm text-muted-foreground",children:"This insight has no visual data to display"})}):u.jsx("div",{className:"h-full w-full",children:u.jsx(tAe,{card:d,frame:c,showTitle:!1})})}function nAe({filters:e,contextMode:t}){if(!e||e.length===0)return t==="none"?u.jsxs(kt,{variant:"outline",className:"gap-1 whitespace-nowrap",children:[u.jsx(Na,{className:"h-3 w-3"}),"No filters"]}):null;const n=e.reduce((s,o)=>{var a,l;const i=((a=o.field)==null?void 0:a.label)||((l=o.field)==null?void 0:l.name)||"Unknown";return s[i]||(s[i]=[]),s[i].push(o),s},{});e.length;const r=Object.keys(n).length;return u.jsx(Yr,{children:u.jsxs(er,{delayDuration:200,children:[u.jsx(tr,{asChild:!0,children:u.jsxs(kt,{variant:"secondary",className:"cursor-help gap-1 whitespace-nowrap border border-blue-500/20 bg-blue-500/10 text-blue-700 dark:text-blue-300",children:[u.jsx(Na,{className:"h-3 w-3"}),r," ",r===1?"filter":"filters"]})}),u.jsx(fr,{side:"bottom",align:"start",className:"max-w-md",children:u.jsxs("div",{className:"space-y-2",children:[u.jsx("div",{className:"text-sm font-medium",children:"Applied Filters"}),u.jsx("div",{className:"space-y-1.5",children:Object.entries(n).map(([s,o])=>u.jsxs("div",{className:"text-xs",children:[u.jsxs("span",{className:"font-medium",children:[s,":"]})," ",o.map((i,a)=>u.jsxs("span",{children:[rAe(i),a<o.length-1?", ":""]},a))]},s))}),t&&u.jsx("div",{className:"border-t pt-2 text-xs text-muted-foreground",children:sAe(t)})]})})]})})}function rAe(e){const{operator:t,value:n}=e;if(e.label){const r=e.label.split(/[=><]/);if(r.length>1)return r[1].trim()}switch(t){case"=":return String(n);case"!=":return`≠ ${n}`;case">":return`> ${n}`;case"<":return`< ${n}`;case">=":return`≥ ${n}`;case"<=":return`≤ ${n}`;case"in":return Array.isArray(n)?n.join(", "):String(n);case"not in":return`not ${Array.isArray(n)?n.join(", "):n}`;case"contains":return`contains ${n}`;case"startsWith":return`starts with ${n}`;case"endsWith":return`ends with ${n}`;case"between":return Array.isArray(n)?`${n[0]}-${n[1]}`:String(n);case"not between":return Array.isArray(n)?`not ${n[0]}-${n[1]}`:String(n);case"isNull":return"is null";case"isNotNull":return"is not null";default:return String(n)}}function sAe(e){switch(e){case"filters":case"interactionFilters":return"Showing data filtered by interaction only";case"full":return"Showing data with all dashboard filters + interaction filters";case"none":return"Showing all data (no filters applied)"}}function Fq(e,t={}){const{enabled:n=!0}=t,{data:r}=pj(e,{enabled:n&&!!e});return C.useMemo(()=>{var l,c;if(!r)return{title:"",description:void 0};const o=(r==null?void 0:r.frameObject)??((l=r==null?void 0:r.visual)==null?void 0:l.frameObject);if(!o)return{title:"",description:void 0};let i=null;if(typeof o=="string")try{i=JSON.parse(o)}catch{return{title:"",description:void 0}}else i=o;if(!((c=i==null?void 0:i.cards)!=null&&c.length))return{title:"",description:void 0};const a=i.activeCardId&&i.cards.find(d=>d.id===i.activeCardId)||i.cards[0];return{title:a.title,description:a.description}},[r])}function oAe({cardId:e,children:t}){const n=Xt(o=>o.replacedCards[e]),r=Xt(o=>o.restoreCard),s=Fq((n==null?void 0:n.insightId)||"",{enabled:!!(n!=null&&n.insightId)});return n?u.jsxs("div",{className:"flex h-full w-full flex-col",children:[u.jsxs("div",{className:"border-b bg-muted/30",children:[u.jsx("div",{className:"flex items-baseline gap-2 px-5 pb-2 pt-4",children:s.title&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"truncate text-sm font-semibold",children:s.title}),s.description&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"text-muted-foreground",children:"-"}),u.jsx("span",{className:"truncate text-xs text-muted-foreground",children:s.description})]})]})}),u.jsxs("div",{className:"flex items-center gap-3 px-4 pb-2",children:[u.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>r(e),className:"flex-shrink-0 gap-1",children:[u.jsx(p$,{className:"h-4 w-4"}),"Back"]}),u.jsx(nAe,{filters:n.filters,contextMode:n.contextMode})]})]}),u.jsx("div",{className:"min-h-0 flex-1",children:u.jsx(Oq,{insightId:n.insightId,filters:n.filters,contextMode:n.contextMode})})]}):u.jsx(u.Fragment,{children:t})}function iAe({frame:e,footer:t,className:n,...r}){var w,S;const s=C.useRef(null),[o,i]=C.useState(!1),a=te(N=>N.themeStyle),l=te(N=>N.isVisualEditing),c=te(N=>N.selectedFrameId),d=te(N=>N.isDashboardEditing),{setSelectedFrameId:f}=Wt(),{clearSelectedVisual:h}=_g(),{setSelectedConnectionId:p,setSelectedDatabaseName:m,setSelectedSchemaName:g,setSelectedTableName:b,setCard:y}=Kr();C.useEffect(()=>{if(c===e.id&&d&&!l){const N=s==null?void 0:s.current;N==null||N.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}},[c,e.id,d,l,s]);const x=e.cards.find(N=>N.id===e.activeCardId);function v(N){N.stopPropagation(),f(e.id),h(),x&&y(x),x!=null&&x.connectionId&&p(x==null?void 0:x.connectionId),x!=null&&x.lastSelectedDatabase&&m(x==null?void 0:x.lastSelectedDatabase),x!=null&&x.lastSelectedSchema&&g(x==null?void 0:x.lastSelectedSchema),x!=null&&x.lastSelectedTable&&b(x==null?void 0:x.lastSelectedTable)}return u.jsx(hc,{FallbackComponent:zD,children:u.jsxs("div",{tabIndex:-1,ref:s,role:"card-frame","data-frame-id":e.id,"data-active-card-id":x==null?void 0:x.id,onClick:v,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{borderRadius:a==null?void 0:a.cardBorderRadius},className:K("relative flex h-full flex-col rounded-sm border bg-background shadow-sm",{"border-dashed border-foreground/50":c===e.id&&d},a==null?void 0:a.dashboardCard,n,"semaphor-card-frame"),...r,children:[(d||((S=(w=x==null?void 0:x.preferences)==null?void 0:w.displayOptions)==null?void 0:S.showCardToolbar)!==!1)&&u.jsx(jW,{frame:e,isHovered:o}),x&&u.jsx(oAe,{cardId:x.id,children:u.jsx(Pq,{card:x,frame:e},x.id)})]})})}function aAe({label:e,onCheckedChange:t,checked:n}){return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(dn,{onCheckedChange:t,id:"terms",checked:n}),u.jsx("label",{htmlFor:"terms",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})]})}function xM(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,o;for(o=0;o<r.length;o++)s=r[o],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var lAe=["color"],cAe=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=xM(e,lAe);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),uAe=["color"],$q=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=xM(e,uAe);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),dAe=["color"],fAe=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=xM(e,dAe);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});function nh({text:e,className:t}){const[n,r]=C.useState(!1);return u.jsx(ie,{className:K("h-7 w-fit px-1 font-mono text-xs text-muted-foreground/70",t),variant:"ghost",size:"icon",onClick:()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>{r(!1)},1e3)},children:n?u.jsx($q,{className:"size-3.5"}):u.jsx(nj,{className:"size-3.5"})})}function hAe({filter:e,onUpdate:t}){const[n,r]=C.useState(""),s=te(x=>x.dashboard.sheets)||[],o=te(x=>x.selectedSheetId),i=C.useMemo(()=>{const x=[];return s==null||s.forEach(v=>{var w;(w=v.frames)==null||w.forEach(S=>{var N;(N=S.cards)==null||N.forEach(k=>{x.push({...k,sheetId:v.id,sheetTitle:v.title||v.id})})})}),x},[s]),a=()=>e.applyToSheetIds!==void 0?"specific-sheets":e.excludeSheetIds!==void 0?"all-except-specific":"all-sheets",l=()=>e.applyToCardIds!==void 0?"specific-cards":e.excludeCardIds!==void 0?"all-except-specific":"all-cards",c=x=>{const v={};switch(x){case"all-sheets":v.applyToSheetIds=void 0,v.excludeSheetIds=void 0;break;case"specific-sheets":v.applyToSheetIds=[],v.excludeSheetIds=void 0;break;case"all-except-specific":v.applyToSheetIds=void 0,v.excludeSheetIds=[];break}t(v)},d=x=>{const v={};switch(x){case"all-cards":v.applyToCardIds=void 0,v.excludeCardIds=void 0;break;case"specific-cards":v.applyToCardIds=[],v.excludeCardIds=void 0;break;case"all-except-specific":v.applyToCardIds=void 0,v.excludeCardIds=[];break}t(v)},f=(x,v)=>{if(v==="specific-sheets"){const w=e.applyToSheetIds||[],S=w.includes(x)?w.filter(N=>N!==x):[...w,x];t({applyToSheetIds:S})}else if(v==="all-except-specific"){const w=e.excludeSheetIds||[],S=w.includes(x)?w.filter(N=>N!==x):[...w,x];t({excludeSheetIds:S})}},h=(x,v)=>{if(v==="specific-cards"){const w=e.applyToCardIds||[],S=w.includes(x)?w.filter(N=>N!==x):[...w,x];t({applyToCardIds:S})}else if(v==="all-except-specific"){const w=e.excludeCardIds||[],S=w.includes(x)?w.filter(N=>N!==x):[...w,x];t({excludeCardIds:S})}},p=()=>{const x=a();return x==="specific-sheets"?e.applyToSheetIds||[]:x==="all-except-specific"?(s==null?void 0:s.filter(v=>{var w;return!((w=e.excludeSheetIds)!=null&&w.includes(v.id))}).map(v=>v.id))||[]:(s==null?void 0:s.map(v=>v.id))||[]},m=C.useMemo(()=>{const x=p();return i.filter(v=>x.includes(v.sheetId))},[i,e.applyToSheetIds,e.excludeSheetIds]),g=C.useMemo(()=>{if(!n.trim())return m;const x=n.toLowerCase();return m.filter(v=>{var w;return(w=v==null?void 0:v.title)==null?void 0:w.toLowerCase().includes(x)})},[n,m]),b=a(),y=l();return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Sheet Scope"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Which sheets should display this filter?"})]}),u.jsxs(qa,{value:b,onValueChange:x=>c(x),className:"space-y-3",children:[u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-sheets",id:"all-sheets",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-sheets",className:"cursor-pointer text-sm font-medium",children:"All sheets"}),u.jsxs("p",{className:"text-xs text-muted-foreground",children:["Display filter on all sheets (",(s==null?void 0:s.length)||0," sheets)"]})]})]}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"specific-sheets",id:"specific-sheets",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"specific-sheets",className:"cursor-pointer text-sm font-medium",children:"Only specific sheets"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Display filter on selected sheets only"})]})]}),b==="specific-sheets"&&u.jsx("div",{className:"ml-7 space-y-2",children:u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:s==null?void 0:s.map(x=>{const v=(e.applyToSheetIds||[]).includes(x.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`sheet-${x.id}`,checked:v,onCheckedChange:()=>f(x.id,"specific-sheets")}),u.jsxs(ae,{htmlFor:`sheet-${x.id}`,className:"cursor-pointer text-sm font-medium",children:[x.title||x.id,x.id===o&&u.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground",children:"(this sheet)"})]})]},x.id)})})}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-except-specific",id:"all-sheets-except",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-sheets-except",className:"cursor-pointer text-sm font-medium",children:"All sheets except specific ones"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Display filter on all sheets except selected ones"})]})]}),b==="all-except-specific"&&u.jsx("div",{className:"ml-7 space-y-2",children:u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:s==null?void 0:s.map(x=>{const v=(e.excludeSheetIds||[]).includes(x.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`sheet-exclude-${x.id}`,checked:v,onCheckedChange:()=>f(x.id,"all-except-specific")}),u.jsxs(ae,{htmlFor:`sheet-exclude-${x.id}`,className:"cursor-pointer text-sm font-medium",children:[x.title||x.id,x.id===o&&u.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground",children:"(this sheet)"})]})]},x.id)})})})]})]}),u.jsxs("div",{className:"space-y-3 border-t pt-4",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Card Scope"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Which cards should receive this filter?"})]}),u.jsxs(qa,{value:y,onValueChange:x=>d(x),className:"space-y-3",children:[u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-cards",id:"all-cards",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-cards",className:"cursor-pointer text-sm font-medium",children:"All cards"}),u.jsxs("p",{className:"text-xs text-muted-foreground",children:["Apply filter to all cards in applicable sheets (",m.length," cards)"]})]})]}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"specific-cards",id:"specific-cards",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"specific-cards",className:"cursor-pointer text-sm font-medium",children:"Only specific cards"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Apply filter to selected cards only"})]})]}),y==="specific-cards"&&u.jsxs("div",{className:"ml-7 space-y-2",children:[u.jsx(Sn,{placeholder:"Search cards...",value:n,onChange:x=>r(x.target.value),className:"mb-2"}),u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:g.length>0?g.map(x=>{const v=(e.applyToCardIds||[]).includes(x.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`card-${x.id}`,checked:v,onCheckedChange:()=>h(x.id,"specific-cards")}),u.jsxs("div",{className:"flex-1",children:[u.jsx(ae,{htmlFor:`card-${x.id}`,className:"cursor-pointer text-sm font-medium",children:x.title}),u.jsx("p",{className:"text-xs text-muted-foreground",children:x.sheetTitle})]})]},x.id)}):u.jsxs("p",{className:"py-4 text-center text-sm text-muted-foreground",children:['No cards found matching "',n,'"']})})]}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-except-specific",id:"all-cards-except",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-cards-except",className:"cursor-pointer text-sm font-medium",children:"All cards except specific ones"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Apply filter to all cards except selected ones"})]})]}),y==="all-except-specific"&&u.jsxs("div",{className:"ml-7 space-y-2",children:[u.jsx(Sn,{placeholder:"Search cards...",value:n,onChange:x=>r(x.target.value),className:"mb-2"}),u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:g.length>0?g.map(x=>{const v=(e.excludeCardIds||[]).includes(x.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`card-exclude-${x.id}`,checked:v,onCheckedChange:()=>h(x.id,"all-except-specific")}),u.jsxs("div",{className:"flex-1",children:[u.jsx(ae,{htmlFor:`card-exclude-${x.id}`,className:"cursor-pointer text-sm font-medium",children:x.title}),u.jsx("p",{className:"text-xs text-muted-foreground",children:x.sheetTitle})]})]},x.id)}):u.jsxs("p",{className:"py-4 text-center text-sm text-muted-foreground",children:['No cards found matching "',n,'"']})})]})]})]}),u.jsx("div",{className:"rounded-md bg-blue-50 p-3 text-xs text-blue-900 dark:bg-blue-950 dark:text-blue-100",children:"ℹ️ Cards are filtered based on sheet scope selection. Only cards from applicable sheets are shown in card scope."})]})}function pAe({filter:e}){const[t,n]=C.useState(e.sql),[r,s]=C.useState(!1),[o,i]=C.useState({}),[a,l]=C.useState(e.title||""),[c,d]=C.useState(e.column),[f,h]=C.useState(e.searchMode||"auto"),p=te(v=>v.selectedSheetId),{updateFilter:m}=Wt();function g(){const v=a.trim(),w=c.trim(),S={sql:t,...o},N=w||e.column;w&&w!==e.column&&(S.column=N),S.title=v||N,La(e.dataType)&&(S.searchMode=f);const k={...e,...S};m(k),i({}),s(!1)}C.useEffect(()=>{r&&(i({}),n(e.sql),l(e.title===e.column?"":e.title||""),d(e.column),h(e.searchMode||"auto"))},[r,e.sql,e.title,e.column,e.searchMode]);function b(v){const w={...e,type:v};m(w)}function y(v){const w={...e,uiType:v};m(w)}function x(v){if(!p)return;const w={...e,sheetId:v?p:void 0};m(w)}return u.jsxs(As,{open:r,onOpenChange:s,children:[u.jsx(Ps,{children:u.jsx(au,{className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),u.jsx(Os,{onMouseDown:v=>v.stopPropagation(),onDoubleClick:v=>v.stopPropagation(),className:"z-50 m-2 h-[600px] w-[500px] overflow-hidden",children:u.jsxs("div",{className:"flex h-full flex-col",children:[u.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[u.jsx("h4",{className:"font-medium leading-none",title:e.column,children:e.column.split(".").pop()}),u.jsx(kt,{variant:"secondary",className:"flex-shrink-0 text-xs font-normal",children:e.dataType})]}),u.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Customize filter settings and scope"}),u.jsxs(fo,{defaultValue:"scope",className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[u.jsxs(Ls,{className:"grid w-full flex-shrink-0 grid-cols-2",children:[u.jsx(bn,{value:"scope",children:"Scope"}),u.jsx(bn,{value:"advanced",children:"Configuration"})]}),u.jsx(ur,{value:"scope",className:"mt-4 flex-1 overflow-y-auto",children:u.jsx(hAe,{filter:{...e,...o},onUpdate:v=>{i(w=>({...w,...v}))}})}),u.jsxs(ur,{value:"advanced",className:"mt-4 flex-1 space-y-5 overflow-y-auto",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Custom Title (optional)"}),u.jsx(Yr,{children:u.jsxs(er,{delayDuration:0,children:[u.jsx(tr,{asChild:!0,children:u.jsx(ls,{className:"h-3.5 w-3.5 cursor-help text-muted-foreground"})}),u.jsx(fr,{side:"right",className:"max-w-xs",children:u.jsxs("div",{className:"space-y-2",children:[u.jsx("p",{className:"text-xs",children:"Leave empty to use the column name. Provide a custom title to override it."}),u.jsxs("div",{className:"space-y-1 border-t pt-2",children:[u.jsx("p",{className:"text-xs font-medium",children:"Filter ID"}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("p",{className:"break-all font-mono text-xs text-muted-foreground",children:e.id}),u.jsx(nh,{text:e.id})]})]})]})})]})})]}),u.jsx(Un,{value:a,onChange:v=>l(v.target.value),placeholder:e.column,className:"h-8 text-sm"})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Column Name"}),u.jsx(Un,{value:c,onChange:v=>d(v.target.value),placeholder:"Enter column name",className:"h-8 font-mono text-xs"})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Selection Type"}),u.jsxs(lt,{value:e.type||"multiple",onValueChange:b,children:[u.jsx(ot,{className:"h-8",children:u.jsx(pt,{})}),u.jsxs(it,{children:[u.jsx(me,{value:"multiple",children:"Multiple"}),u.jsx(me,{value:"single",children:"Single"})]})]})]}),e.type==="single"&&u.jsxs("div",{className:"space-y-1",children:[u.jsx(ae,{className:"text-sm font-medium",children:"UI Component"}),u.jsxs(lt,{value:e.uiType||"dropdown",onValueChange:y,children:[u.jsx(ot,{className:"h-8",children:u.jsx(pt,{})}),u.jsxs(it,{children:[u.jsx(me,{value:"dropdown",children:"Dropdown"}),u.jsx(me,{value:"radio",children:"Radio"})]})]})]}),La(e.dataType)&&u.jsxs("div",{className:"space-y-1",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Search Mode"}),u.jsx(Yr,{children:u.jsxs(er,{delayDuration:0,children:[u.jsx(tr,{asChild:!0,children:u.jsx(ls,{className:"h-3.5 w-3.5 cursor-help text-muted-foreground"})}),u.jsx(fr,{side:"right",className:"max-w-xs",children:u.jsxs("div",{className:"space-y-2 text-xs",children:[u.jsxs("p",{children:[u.jsx("strong",{children:"Text Search:"}),' Treats numbers as text (e.g., ZIP codes, IDs). Search for "90210".']}),u.jsxs("p",{children:[u.jsx("strong",{children:"Numeric Operators:"})," Supports comparison operators (e.g., >100, <=50, =100) for quantities, prices."]}),u.jsxs("p",{children:[u.jsx("strong",{children:"Auto-detect:"})," Tries numeric first, falls back to text search."]})]})})]})})]}),u.jsxs(lt,{value:f,onValueChange:v=>h(v),children:[u.jsx(ot,{className:"h-8",children:u.jsx(pt,{})}),u.jsxs(it,{children:[u.jsx(me,{value:"text",children:"Text Search"}),u.jsx(me,{value:"numeric",children:"Numeric Operators"}),u.jsx(me,{value:"auto",children:"Auto-detect"})]})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"SQL"}),u.jsx(Yr,{children:u.jsxs(er,{delayDuration:0,children:[u.jsx(tr,{asChild:!0,children:u.jsx(ls,{className:"h-3.5 w-3.5 cursor-help text-muted-foreground"})}),u.jsx(fr,{side:"right",className:"max-w-xs",children:u.jsx("p",{className:"text-xs",children:"This SQL will be used to fetch the filter values"})})]})})]}),u.jsx(uh,{onKeyDown:v=>{v.stopPropagation()},value:t,onChange:v=>n(v.target.value),className:`h-32 w-full resize-none break-all font-mono text-xs ${Qd}`,placeholder:"SELECT column FROM table..."})]}),u.jsx("div",{className:"border-t pt-2",children:u.jsx(aAe,{label:"Local to sheet",onCheckedChange:x,checked:!!e.sheetId})})]})]}),u.jsx("div",{className:"mt-3 flex justify-end gap-2 border-t pt-3",children:u.jsxs(ie,{onClick:g,size:"sm",variant:"outline",children:[u.jsx(Er,{className:"mr-2 size-4"}),"Accept"]})})]})})]})}const Lq=C.createContext(void 0);function hb(){const e=C.useContext(Lq);return e||{preferences:{},isLocalDev:!1,isConsoleMode:!1}}function zq({filter:e}){var c;const t=te(d=>d.isDashboardEditing),{preferences:n}=hb(),r=((c=n==null?void 0:n.cardDisplay)==null?void 0:c.mode)==="print",s=te(d=>d.filterValues),o=s==null?void 0:s.some(d=>d.filterId===e.id),{removeFilterValues:i,removeFilter:a,updateFilter:l}=Wt();return u.jsxs("div",{className:"group mb-1 flex h-5 items-center justify-between",children:[u.jsxs("div",{className:"flex grow items-center gap-2",children:[u.jsx(ae,{className:"my-1 inline-block text-sm",children:u.jsx(Ro,{value:e.title||e.column,onSave:d=>l({...e,title:d}),isEditable:t,placeholder:"Filter",displayClassName:"text-sm",inputClassName:"text-sm"})}),o&&!r&&u.jsx("button",{onClick:()=>i(e.id),className:"text-muted-foreground",children:u.jsx(yte,{className:"size-3.5"})}),t&&u.jsx("button",{className:"invisible group-hover:visible",onClick:()=>{l({...e,hide:!e.hide})},children:e.hide?u.jsx(ih,{className:"size-3.5 text-muted-foreground hover:text-foreground"}):u.jsx(Rv,{className:"size-3.5 text-muted-foreground hover:text-foreground"})}),t&&u.jsx(pAe,{filter:e})]}),u.jsx("div",{className:"flex items-center gap-2",children:t&&u.jsx(Qt,{onClick:()=>{i(e.id),a(e.id)},className:"size-3 cursor-pointer text-muted-foreground hover:cursor-pointer hover:text-foreground"})})]})}function Bq(){var g;const e=te(b=>b.isDashboardEditing),t=te(b=>b.selectedSheetId),n=te(b=>b.dashboard),r=n==null?void 0:n.sheets,s=r==null?void 0:r.find(b=>b.id===t),o=Ae(b=>b.card),i=Ae(b=>b.selectedConnectionId),{addFrame:a,setSelectedFrameId:l,setIsVisualEditing:c}=Wt(),{setFrame:d,setCard:f,setActiveTabCardId:h}=Kr();function p(){var v,w;const b=o==null?void 0:o.dataSource;if(b)return b;const y=(w=(v=n==null?void 0:n.aiContext)==null?void 0:v.selectedEntities)==null?void 0:w[0],x=y==null?void 0:y.type;if(y)return{connectionId:y.connectionId,connectionType:y.connectionType,type:x,selectedEntities:[y]}}function m(b){const y=(b==null?void 0:b.sheetId)||t,x=r==null?void 0:r.find(k=>k.id===y);if(!x){console.warn("Cannot add frame: No sheet found");return}if(!(!x.frames||x.frames.length===0)&&!e){console.warn("Cannot add frame: Dashboard not in editing mode");return}const w=p(),S={id:Nr(),title:"Title",type:"bar",connectionId:i||"",dataSource:w,preferences:{onClickFilter:[{columnIndex:0,expression:""}]},sql:"",data:[]},N={id:Nr(),cards:[S],activeCardId:S.id};return y&&(a(y,N),l(N.id)),b!=null&&b.openVisualEditor&&(d(N),f(S),h(S.id),c(!0)),N}return{handleAddNewFrame:m,canAddFrame:e||!((g=s==null?void 0:s.frames)!=null&&g.length)}}function mAe({sheetId:e}){const{handleAddNewFrame:t}=Bq(),n=te(s=>s.themeStyle),r=()=>{t({openVisualEditor:!0,sheetId:e})};return u.jsx("div",{className:"flex h-full min-h-[400px] items-start justify-start p-4",children:u.jsxs("button",{onClick:r,style:{borderRadius:n==null?void 0:n.cardBorderRadius},className:"group flex h-96 w-[600px] flex-col items-center justify-center gap-3 rounded-lg border-2 border-dashed border-muted-foreground/25 bg-background transition-all hover:border-muted-foreground/50 hover:bg-muted/50",children:[u.jsx("div",{className:"rounded-full bg-primary/10 p-3 transition-colors group-hover:bg-primary/20",children:u.jsx(yr,{className:"h-6 w-6 text-primary"})}),u.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Add new Visual"})]})})}function G0(e){const t=(e||"").toLowerCase(),n=Ka(t);return n==="string"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-blue-100 text-xs text-blue-700 dark:bg-blue-950 dark:text-blue-300",children:u.jsx(Z$,{className:"h-3 w-3"})}):n==="number"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-green-100 text-xs text-green-700 dark:bg-green-950 dark:text-green-300",children:u.jsx(F$,{className:"h-3 w-3"})}):n==="date"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-purple-100 text-xs text-purple-700 dark:bg-purple-950 dark:text-purple-300",children:u.jsx(so,{className:"h-3 w-3"})}):n==="boolean"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-orange-100 text-xs text-orange-700 dark:bg-orange-950 dark:text-orange-300",children:u.jsx(Y$,{className:"h-3 w-3"})}):n==="json"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-gray-100 text-xs text-gray-700 dark:bg-gray-950 dark:text-gray-300",children:u.jsx(M$,{className:"h-3 w-3"})}):n==="geo"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-orange-100 text-xs text-orange-700 dark:bg-orange-950 dark:text-orange-300",children:u.jsx(wte,{className:"h-3 w-3"})}):n==="calculated"?u.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-gray-100 text-xs text-gray-700 dark:bg-gray-950 dark:text-gray-300",children:u.jsx(b$,{className:"h-3 w-3"})}):null}function gAe({value:e,onChange:t,metrics:n,attributes:r}){const s=(o,i)=>(e==null?void 0:e.field.id)===o.id&&(e==null?void 0:e.type)===i;return u.jsx(Yr,{children:u.jsxs("div",{className:"space-y-4",children:[n.length>0&&u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase",children:"Value of Metric"}),u.jsxs(er,{children:[u.jsx(tr,{asChild:!0,children:u.jsx(ls,{className:"h-3.5 w-3.5 text-muted-foreground"})}),u.jsxs(fr,{className:"max-w-xs",children:[u.jsx("p",{className:"text-xs font-medium mb-1",children:"Captures intersection of all dimensions"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:`Example: Clicking a bar segment in "Sales by Country, stacked by State" captures both Country='USA' AND State='California'`})]})]})]}),u.jsx("div",{className:"space-y-1",children:n.map(o=>{const i=s(o,"metric");return u.jsxs(ie,{variant:i?"default":"outline",size:"sm",className:K("w-full justify-start font-normal",i&&"bg-primary text-primary-foreground"),onClick:()=>t({type:"metric",field:o}),children:[i&&u.jsx(Er,{className:"mr-2 h-4 w-4"}),G0(o.dataType),u.jsx("span",{className:"ml-2",children:o.label})]},o.id)})})]}),r.length>0&&u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase",children:"Value of Attribute"}),u.jsxs(er,{children:[u.jsx(tr,{asChild:!0,children:u.jsx(ls,{className:"h-3.5 w-3.5 text-muted-foreground"})}),u.jsxs(fr,{className:"max-w-xs",children:[u.jsx("p",{className:"text-xs font-medium mb-1",children:"Captures only this dimension"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:`Example: If configured on "State", clicking a bar in "Sales by Country, stacked by State" captures only State='California' (Country is not included)`})]})]})]}),u.jsx("div",{className:"space-y-1",children:r.map(o=>{const i=s(o,"attribute");return u.jsxs(ie,{variant:i?"default":"outline",size:"sm",className:K("w-full justify-start font-normal",i&&"bg-primary text-primary-foreground"),onClick:()=>t({type:"attribute",field:o}),children:[i&&u.jsx(Er,{className:"mr-2 h-4 w-4"}),G0(o.dataType),u.jsx("span",{className:"ml-2",children:o.label})]},o.id)})})]}),n.length===0&&r.length===0&&u.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No metrics or attributes available in this chart"})]})})}const TF=[{value:"clickFilter",label:"Cross filter",description:"Filter other cards on the dashboard"},{value:"drillDown",label:"Drill down",description:"Navigate through a hierarchy of dimensions"},{value:"dynamicDrill",label:"Explore dimensions",description:"Let users explore any dimension dynamically"},{value:"drillThrough",label:"Drill into dashboard",description:"Navigate to another dashboard"},{value:"drillToDetail",label:"Drill into insight",description:"Navigate to a saved insight"},{value:"drillToURL",label:"Drill into URL",description:"Navigate to a custom URL"}];function bAe({value:e,onChange:t}){const n=TF.find(r=>r.value===e);return u.jsx("div",{className:"space-y-2",children:u.jsxs(lt,{value:e,onValueChange:t,children:[u.jsx(ot,{className:"w-full",children:u.jsx(pt,{placeholder:"Choose action...",children:n&&u.jsxs("div",{className:"flex items-center gap-2",children:[(()=>{const r=Y0(n.value);return u.jsx(r,{className:"h-4 w-4"})})(),u.jsx("span",{children:n.label})]})})}),u.jsx(it,{children:TF.map(r=>{const s=Y0(r.value);return u.jsx(me,{value:r.value,children:u.jsxs("div",{className:"flex items-start gap-2 py-1",children:[u.jsx(s,{className:"mt-0.5 h-4 w-4 shrink-0"}),u.jsxs("div",{className:"flex flex-col",children:[u.jsx("span",{className:"font-medium",children:r.label}),u.jsx("span",{className:"text-xs text-muted-foreground",children:r.description})]})]})},r.value)})})]})})}function yAe({interaction:e,onUpdate:t}){const[n,r]=C.useState(""),s=P3(),o=()=>e.applyToCardIds!==void 0?"specific-cards":e.excludeCardIds!==void 0?"all-except-specific":"all-cards",i=d=>{const f={};switch(d){case"all-cards":f.applyToCardIds=void 0,f.excludeCardIds=void 0;break;case"specific-cards":f.applyToCardIds=[],f.excludeCardIds=void 0;break;case"all-except-specific":f.applyToCardIds=void 0,f.excludeCardIds=[];break}t({...e,...f})},a=(d,f)=>{if(f==="specific-cards"){const h=e.applyToCardIds||[],p=h.includes(d)?h.filter(m=>m!==d):[...h,d];t({...e,applyToCardIds:p})}else if(f==="all-except-specific"){const h=e.excludeCardIds||[],p=h.includes(d)?h.filter(m=>m!==d):[...h,d];t({...e,excludeCardIds:p})}},l=C.useMemo(()=>{if(!n.trim())return s;const d=n.toLowerCase();return s==null?void 0:s.filter(f=>{var h;return(h=f==null?void 0:f.title)==null?void 0:h.toLowerCase().includes(d)})},[n,s]),c=o();return u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Filter scope"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose which cards should receive the filter"})]}),u.jsxs(qa,{value:c,onValueChange:d=>i(d),className:"space-y-2",children:[u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-cards",id:"all-cards",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-cards",className:"cursor-pointer text-sm font-medium",children:"All cards"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Apply filter to all cards in the dashboard"})]})]}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"specific-cards",id:"specific-cards",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"specific-cards",className:"cursor-pointer text-sm font-medium",children:"Only specific cards"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Apply filter to selected cards only"})]})]}),c==="specific-cards"&&u.jsxs("div",{className:"ml-7 space-y-2",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Cards to filter"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Select which cards should receive the filter"})]}),u.jsx(Sn,{placeholder:"Search cards...",value:n,onChange:d=>r(d.target.value),className:"mb-2"}),u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:l&&l.length>0?l.map(d=>{const f=(e.applyToCardIds||[]).includes(d.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`card-${d.id}`,checked:f,onCheckedChange:()=>a(d.id,"specific-cards")}),u.jsxs("div",{className:"flex-1",children:[u.jsx(ae,{htmlFor:`card-${d.id}`,className:"cursor-pointer text-sm font-medium",children:d.title}),d.description&&u.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:d.description})]})]},d.id)}):u.jsx("p",{className:"py-4 text-center text-sm text-muted-foreground",children:n?`No cards found matching "${n}"`:"No cards available"})})]}),u.jsxs("div",{className:"flex items-start space-x-3 rounded-md border bg-background p-3",children:[u.jsx(Cr,{value:"all-except-specific",id:"all-except-specific",className:"mt-0.5"}),u.jsxs("div",{className:"flex-1 space-y-1",children:[u.jsx(ae,{htmlFor:"all-except-specific",className:"cursor-pointer text-sm font-medium",children:"All cards except specific ones"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Apply filter to all cards, excluding selected ones"})]})]}),c==="all-except-specific"&&u.jsxs("div",{className:"ml-7 space-y-2",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Cards to exclude"}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Select which cards should be excluded from filtering"})]}),u.jsx(Sn,{placeholder:"Search cards...",value:n,onChange:d=>r(d.target.value),className:"mb-2"}),u.jsx("div",{className:"grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-md border bg-muted/20 p-3",children:l&&l.length>0?l.map(d=>{const f=(e.excludeCardIds||[]).includes(d.id);return u.jsxs("div",{className:"flex items-center space-x-3 rounded p-2 hover:bg-background/50",children:[u.jsx(dn,{id:`card-exclude-${d.id}`,checked:f,onCheckedChange:()=>a(d.id,"all-except-specific")}),u.jsxs("div",{className:"flex-1",children:[u.jsx(ae,{htmlFor:`card-exclude-${d.id}`,className:"cursor-pointer text-sm font-medium",children:d.title}),d.description&&u.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:d.description})]})]},d.id)}):u.jsx("p",{className:"py-4 text-center text-sm text-muted-foreground",children:n?`No cards found matching "${n}"`:"No cards available"})})]})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(ae,{className:"text-sm font-medium",children:"Menu label"}),u.jsx(Sn,{value:e.label||"",onChange:d=>t({...e,label:d.target.value}),placeholder:cd(e.mode)}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"How this interaction appears when multiple actions are available"})]})]})}var vM="Collapsible",[xAe,Vq]=vr(vM),[vAe,wM]=xAe(vM),Hq=E.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...a}=e,[l=!1,c]=Ir({prop:r,defaultProp:s,onChange:i});return u.jsx(vAe,{scope:n,disabled:o,contentId:Gn(),open:l,onOpenToggle:E.useCallback(()=>c(d=>!d),[c]),children:u.jsx(Re.div,{"data-state":kM(l),"data-disabled":o?"":void 0,...a,ref:t})})});Hq.displayName=vM;var Uq="CollapsibleTrigger",SM=E.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=wM(Uq,n);return u.jsx(Re.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":kM(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:we(e.onClick,s.onOpenToggle)})});SM.displayName=Uq;var CM="CollapsibleContent",NM=E.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=wM(CM,e.__scopeCollapsible);return u.jsx(Zn,{present:n||s.open,children:({present:o})=>u.jsx(wAe,{...r,ref:t,present:o})})});NM.displayName=CM;var wAe=E.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=e,i=wM(CM,n),[a,l]=E.useState(r),c=E.useRef(null),d=ut(t,c),f=E.useRef(0),h=f.current,p=E.useRef(0),m=p.current,g=i.open||a,b=E.useRef(g),y=E.useRef(void 0);return E.useEffect(()=>{const x=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(x)},[]),Rr(()=>{const x=c.current;if(x){y.current=y.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const v=x.getBoundingClientRect();f.current=v.height,p.current=v.width,b.current||(x.style.transitionDuration=y.current.transitionDuration,x.style.animationName=y.current.animationName),l(r)}},[i.open,r]),u.jsx(Re.div,{"data-state":kM(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!g,...o,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:g&&s})});function kM(e){return e?"open":"closed"}var Wq=Hq,SAe=SM,CAe=NM;const Vu=Wq,Hu=SM,Uu=NM;function NAe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return C.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const a1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ih(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function EM(e){return"nodeType"in e}function ys(e){var t,n;return e?Ih(e)?e:EM(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function jM(e){const{Document:t}=ys(e);return e instanceof t}function pb(e){return Ih(e)?!1:e instanceof ys(e).HTMLElement}function qq(e){return e instanceof ys(e).SVGElement}function Ah(e){return e?Ih(e)?e.document:EM(e)?jM(e)?e:pb(e)||qq(e)?e.ownerDocument:document:document:document}const ai=a1?C.useLayoutEffect:C.useEffect;function l1(e){const t=C.useRef(e);return ai(()=>{t.current=e}),C.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function kAe(){const e=C.useRef(null),t=C.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=C.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ng(e,t){t===void 0&&(t=[e]);const n=C.useRef(e);return ai(()=>{n.current!==e&&(n.current=e)},t),n}function mb(e,t){const n=C.useRef();return C.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Z0(e){const t=l1(e),n=C.useRef(null),r=C.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function K0(e){const t=C.useRef();return C.useEffect(()=>{t.current=e},[e]),t.current}let qC={};function gb(e,t){return C.useMemo(()=>{if(t)return t;const n=qC[e]==null?0:qC[e]+1;return qC[e]=n,e+"-"+n},[e,t])}function Yq(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((o,i)=>{const a=Object.entries(i);for(const[l,c]of a){const d=o[l];d!=null&&(o[l]=d+e*c)}return o},{...t})}}const ff=Yq(1),rg=Yq(-1);function EAe(e){return"clientX"in e&&"clientY"in e}function c1(e){if(!e)return!1;const{KeyboardEvent:t}=ys(e.target);return t&&e instanceof t}function jAe(e){if(!e)return!1;const{TouchEvent:t}=ys(e.target);return t&&e instanceof t}function X0(e){if(jAe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return EAe(e)?{x:e.clientX,y:e.clientY}:null}const Gi=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Gi.Translate.toString(e),Gi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),RF="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function _Ae(e){return e.matches(RF)?e:e.querySelector(RF)}const DAe={display:"none"};function MAe(e){let{id:t,value:n}=e;return C.createElement("div",{id:t,style:DAe},n)}function TAe(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return C.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function RAe(){const[e,t]=C.useState("");return{announce:C.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Gq=C.createContext(null);function IAe(e){const t=C.useContext(Gq);C.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function AAe(){const[e]=C.useState(()=>new Set),t=C.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[C.useCallback(r=>{let{type:s,event:o}=r;e.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[e]),t]}const PAe={draggable:`
911
911
  To pick up a draggable item, press the space bar.
912
912
  While dragging, use the arrow keys to move the item.
913
913
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CAgfnOtu.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-Ds-28cos.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-n8_6ESse.js";
1
+ import { D as a } from "../chunks/index-DKZUZy-b.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-CAgfnOtu.js"),v=require("./types/index.cjs"),u=require("./chunks/dashboard-plus-BrMPtskP.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-Ds-28cos.js"),v=require("./types/index.cjs"),u=require("./chunks/dashboard-plus-C9660lUy.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-n8_6ESse.js";
2
- import { D as ne, t as ie, R as de, r as le, r as ce, $ as Ye, K as ue, w as he, y as pe, M as fe, L as me, Q as Me, T as Ce, J as De, v as ge, H as ve, N as ye, G as be, A as Te, z as Se, V as xe, O as Ne, s as we, X as Ae, Z as Le, Y as _e, _ as Ee, x as Pe, p as ke, a1 as We, W as Fe, a0 as Re, q as Ve } from "./chunks/index-n8_6ESse.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-DKZUZy-b.js";
2
+ import { D as ne, t as ie, R as de, r as le, r as ce, $ as Ye, K as ue, w as he, y as pe, M as fe, L as me, Q as Me, T as Ce, J as De, v as ge, H as ve, N as ye, G as be, A as Te, z as Se, V as xe, O as Ne, s as we, X as Ae, Z as Le, Y as _e, _ as Ee, x as Pe, p as ke, a1 as We, W as Fe, a0 as Re, q as Ve } from "./chunks/index-DKZUZy-b.js";
3
3
  import { EMPTY_SELECTION as Oe } from "./types/index.js";
4
- import { A as Ie, R as je, b as qe, S as Ue, D as ze, a as Ge, V as He, c as $e, g as Ke } from "./chunks/dashboard-plus-DtYeDrpG.js";
4
+ import { A as Ie, R as je, b as qe, S as Ue, D as ze, a as Ge, V as He, c as $e, g as Ke } from "./chunks/dashboard-plus-DtPMm1bK.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-BrMPtskP.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-C9660lUy.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-DtYeDrpG.js";
1
+ import { D as f } from "../chunks/dashboard-plus-DtPMm1bK.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.49",
8
+ "version": "0.1.50",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",