react-semaphor 0.1.139 → 0.1.140

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.
Files changed (24) hide show
  1. package/dist/chunks/{dashboard-controls-FAtMQrth.js → dashboard-controls-DCdXE-1I.js} +3 -3
  2. package/dist/chunks/{dashboard-controls-CycUpkzN.js → dashboard-controls-ZLM2lY1W.js} +1 -1
  3. package/dist/chunks/{dashboard-export-dialog-BOeaIkB4.js → dashboard-export-dialog-BDIPA0iP.js} +3 -3
  4. package/dist/chunks/{dashboard-export-dialog-BkGfu2Ur.js → dashboard-export-dialog-DtrfJ9Js.js} +1 -1
  5. package/dist/chunks/{dashboard-json-vWf6j3ir.js → dashboard-json-C5mUnJ_6.js} +1 -1
  6. package/dist/chunks/{dashboard-json-CUnn97AA.js → dashboard-json-CjX2S2P5.js} +1 -1
  7. package/dist/chunks/{edit-dashboard-visual-WvBAW290.js → edit-dashboard-visual-BEAVr2Mh.js} +1331 -1262
  8. package/dist/chunks/{edit-dashboard-visual-QX1EfVIC.js → edit-dashboard-visual-Drzczr6I.js} +3 -3
  9. package/dist/chunks/{editor-action-buttons-BaYDKpMq.js → editor-action-buttons-5G0hV-FE.js} +1 -1
  10. package/dist/chunks/{editor-action-buttons-hyOjCHRm.js → editor-action-buttons-DgFLwd7e.js} +2 -2
  11. package/dist/chunks/{index-BAZxSdVh.js → index-COVj17uo.js} +111 -111
  12. package/dist/chunks/{index-C0aUsTJw.js → index-CnzyKX5P.js} +119 -117
  13. package/dist/chunks/{resource-management-panel-B2XgOmvv.js → resource-management-panel-4U6ulEyR.js} +2 -2
  14. package/dist/chunks/{resource-management-panel-Chg6-H5n.js → resource-management-panel-CBeNy1ff.js} +1 -1
  15. package/dist/chunks/{use-visual-utils-DIuorLLH.js → use-visual-utils-C2iWEneY.js} +1 -1
  16. package/dist/chunks/{use-visual-utils-DyjCJ47j.js → use-visual-utils-Cyhtukxh.js} +1 -1
  17. package/dist/dashboard/index.cjs +1 -1
  18. package/dist/dashboard/index.js +1 -1
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +4 -4
  21. package/dist/style.css +1 -1
  22. package/dist/surfboard/index.cjs +1 -1
  23. package/dist/surfboard/index.js +1 -1
  24. package/package.json +1 -1
@@ -114530,10 +114530,10 @@ function gJe() {
114530
114530
  }
114531
114531
  );
114532
114532
  }
114533
- const bJe = Zw(() => import("./dashboard-controls-FAtMQrth.js")), yJe = Zw(
114534
- () => import("./edit-dashboard-visual-WvBAW290.js")
114535
- ), vJe = Zw(() => import("./dashboard-json-vWf6j3ir.js")), xJe = Zw(
114536
- () => import("./resource-management-panel-B2XgOmvv.js").then(
114533
+ const bJe = Zw(() => import("./dashboard-controls-DCdXE-1I.js")), yJe = Zw(
114534
+ () => import("./edit-dashboard-visual-BEAVr2Mh.js")
114535
+ ), vJe = Zw(() => import("./dashboard-json-C5mUnJ_6.js")), xJe = Zw(
114536
+ () => import("./resource-management-panel-4U6ulEyR.js").then(
114537
114537
  (e) => ({ default: e.ResourceManagementPanel })
114538
114538
  )
114539
114539
  );
@@ -116397,7 +116397,7 @@ export {
116397
116397
  jd as cy,
116398
116398
  md as cz,
116399
116399
  jet as d,
116400
- xne as d$,
116400
+ va as d$,
116401
116401
  cz as d0,
116402
116402
  G3e as d1,
116403
116403
  fS as d2,
@@ -116431,10 +116431,10 @@ export {
116431
116431
  yJ as dU,
116432
116432
  vJ as dV,
116433
116433
  xJ as dW,
116434
- Du as dX,
116435
- Dae as dY,
116436
- va as dZ,
116437
- vc as d_,
116434
+ tje as dX,
116435
+ vWe as dY,
116436
+ Du as dZ,
116437
+ Dae as d_,
116438
116438
  Tb as da,
116439
116439
  kg as db,
116440
116440
  Iie as dc,
@@ -116461,115 +116461,117 @@ export {
116461
116461
  Av as dy,
116462
116462
  fI as dz,
116463
116463
  Sr as e,
116464
- ktt as e$,
116465
- RT as e0,
116466
- Hie as e1,
116467
- WQe as e2,
116468
- lK as e3,
116469
- hnt as e4,
116470
- w$e as e5,
116471
- ax as e6,
116472
- Pn as e7,
116473
- Att as e8,
116474
- Cp as e9,
116475
- a0 as eA,
116476
- LU as eB,
116477
- $U as eC,
116478
- nQe as eD,
116479
- NQe as eE,
116480
- CQe as eF,
116481
- SQe as eG,
116482
- kQe as eH,
116483
- oz as eI,
116484
- OD as eJ,
116485
- LD as eK,
116486
- nu as eL,
116487
- UWe as eM,
116488
- HWe as eN,
116489
- WWe as eO,
116490
- rQe as eP,
116491
- wQe as eQ,
116492
- QQ as eR,
116493
- XI as eS,
116494
- ZR as eT,
116495
- D_ as eU,
116496
- fnt as eV,
116497
- Sw as eW,
116498
- xn as eX,
116499
- gD as eY,
116500
- Yr as eZ,
116501
- Ctt as e_,
116502
- hO as ea,
116503
- Ktt as eb,
116504
- Uet as ec,
116505
- Zb as ed,
116506
- yO as ee,
116507
- bO as ef,
116508
- bpe as eg,
116509
- uV as eh,
116510
- xpe as ei,
116511
- T1 as ej,
116512
- A1e as ek,
116513
- O5 as el,
116514
- Q8 as em,
116515
- wtt as en,
116516
- Rs as eo,
116517
- XXe as ep,
116518
- YQ as eq,
116519
- jCe as er,
116520
- eQe as es,
116521
- bnt as et,
116522
- gnt as eu,
116523
- mnt as ev,
116524
- JXe as ew,
116525
- Z6 as ex,
116526
- i0 as ey,
116527
- CM as ez,
116464
+ Yr as e$,
116465
+ vc as e0,
116466
+ xne as e1,
116467
+ RT as e2,
116468
+ Hie as e3,
116469
+ WQe as e4,
116470
+ lK as e5,
116471
+ hnt as e6,
116472
+ w$e as e7,
116473
+ ax as e8,
116474
+ Pn as e9,
116475
+ i0 as eA,
116476
+ CM as eB,
116477
+ a0 as eC,
116478
+ LU as eD,
116479
+ $U as eE,
116480
+ nQe as eF,
116481
+ NQe as eG,
116482
+ CQe as eH,
116483
+ SQe as eI,
116484
+ kQe as eJ,
116485
+ oz as eK,
116486
+ OD as eL,
116487
+ LD as eM,
116488
+ nu as eN,
116489
+ UWe as eO,
116490
+ HWe as eP,
116491
+ WWe as eQ,
116492
+ rQe as eR,
116493
+ wQe as eS,
116494
+ QQ as eT,
116495
+ XI as eU,
116496
+ ZR as eV,
116497
+ D_ as eW,
116498
+ fnt as eX,
116499
+ Sw as eY,
116500
+ xn as eZ,
116501
+ gD as e_,
116502
+ Att as ea,
116503
+ Cp as eb,
116504
+ hO as ec,
116505
+ Ktt as ed,
116506
+ Uet as ee,
116507
+ Zb as ef,
116508
+ yO as eg,
116509
+ bO as eh,
116510
+ bpe as ei,
116511
+ uV as ej,
116512
+ xpe as ek,
116513
+ T1 as el,
116514
+ A1e as em,
116515
+ O5 as en,
116516
+ Q8 as eo,
116517
+ wtt as ep,
116518
+ Rs as eq,
116519
+ XXe as er,
116520
+ YQ as es,
116521
+ jCe as et,
116522
+ eQe as eu,
116523
+ bnt as ev,
116524
+ gnt as ew,
116525
+ mnt as ex,
116526
+ JXe as ey,
116527
+ Z6 as ez,
116528
116528
  Oe as f,
116529
- pI as f0,
116530
- jQe as f1,
116531
- ks as f2,
116532
- Jtt as f3,
116533
- p8e as f4,
116534
- pne as f5,
116535
- Qie as f6,
116536
- s6e as f7,
116537
- BQe as f8,
116538
- uae as f9,
116539
- X9 as fA,
116540
- N6e as fB,
116541
- x6e as fC,
116542
- Ea as fD,
116543
- uh as fE,
116544
- zCe as fF,
116545
- BCe as fG,
116546
- VCe as fH,
116547
- pae as fa,
116548
- Y8 as fb,
116549
- $ie as fc,
116550
- RS as fd,
116551
- YG as fe,
116552
- XY as ff,
116553
- gK as fg,
116554
- _w as fh,
116555
- VK as fi,
116556
- _S as fj,
116557
- DS as fk,
116558
- S_ as fl,
116559
- cae as fm,
116560
- nJ as fn,
116561
- cSe as fo,
116562
- fSe as fp,
116563
- pH as fq,
116564
- lSe as fr,
116565
- aSe as fs,
116566
- VQe as ft,
116567
- oDe as fu,
116568
- H3 as fv,
116569
- K3e as fw,
116570
- GI as fx,
116571
- Iue as fy,
116572
- Z9 as fz,
116529
+ Ctt as f0,
116530
+ ktt as f1,
116531
+ pI as f2,
116532
+ jQe as f3,
116533
+ ks as f4,
116534
+ Jtt as f5,
116535
+ p8e as f6,
116536
+ pne as f7,
116537
+ Qie as f8,
116538
+ s6e as f9,
116539
+ Iue as fA,
116540
+ Z9 as fB,
116541
+ X9 as fC,
116542
+ N6e as fD,
116543
+ x6e as fE,
116544
+ Ea as fF,
116545
+ uh as fG,
116546
+ zCe as fH,
116547
+ BCe as fI,
116548
+ VCe as fJ,
116549
+ BQe as fa,
116550
+ uae as fb,
116551
+ pae as fc,
116552
+ Y8 as fd,
116553
+ $ie as fe,
116554
+ RS as ff,
116555
+ YG as fg,
116556
+ XY as fh,
116557
+ gK as fi,
116558
+ _w as fj,
116559
+ VK as fk,
116560
+ _S as fl,
116561
+ DS as fm,
116562
+ S_ as fn,
116563
+ cae as fo,
116564
+ nJ as fp,
116565
+ cSe as fq,
116566
+ fSe as fr,
116567
+ pH as fs,
116568
+ lSe as ft,
116569
+ aSe as fu,
116570
+ VQe as fv,
116571
+ oDe as fw,
116572
+ H3 as fx,
116573
+ K3e as fy,
116574
+ GI as fz,
116573
116575
  rn as g,
116574
116576
  Ii as h,
116575
116577
  ztt as i,
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as a, Fragment as me } from "react/jsx-runtime";
2
- import { b as We, u as de, f as qe, ao as ne, b5 as Je, b6 as Qe, c as ee, b7 as Ye, aG as Xe, aH as Ze, B as G, aI as $e, aJ as ke, aK as Q, b8 as ce, L as ie, b9 as et, ba as tt, bb as st, bc as Ne, bd as pe, be as at, bf as nt, I as it, bg as we, bh as re, bi as ye, bj as Ce, bk as rt, K as ve, R as Se, bl as Ve, aO as Ee, aP as Le, aQ as Te, aS as Ae, aT as Oe, aU as Pe, aV as Re, aW as Ie, bm as ot, bn as lt, bo as Ue, bp as je, bq as Me, br as dt, bs as Fe, bt as ct, aE as ae, an as ut, bu as ht, bv as Be, bw as mt, bx as pt, as as ft, at as gt, au as Dt, av as xt, aw as Nt, ax as be, ay as ue, aB as bt, by as wt, bz as yt, bA as Ct, bB as vt } from "./index-C0aUsTJw.js";
2
+ import { b as We, u as de, f as qe, ao as ne, b5 as Je, b6 as Qe, c as ee, b7 as Ye, aG as Xe, aH as Ze, B as G, aI as $e, aJ as ke, aK as Q, b8 as ce, L as ie, b9 as et, ba as tt, bb as st, bc as Ne, bd as pe, be as at, bf as nt, I as it, bg as we, bh as re, bi as ye, bj as Ce, bk as rt, K as ve, R as Se, bl as Ve, aO as Ee, aP as Le, aQ as Te, aS as Ae, aT as Oe, aU as Pe, aV as Re, aW as Ie, bm as ot, bn as lt, bo as Ue, bp as je, bq as Me, br as dt, bs as Fe, bt as ct, aE as ae, an as ut, bu as ht, bv as Be, bw as mt, bx as pt, as as ft, at as gt, au as Dt, av as xt, aw as Nt, ax as be, ay as ue, aB as bt, by as wt, bz as yt, bA as Ct, bB as vt } from "./index-CnzyKX5P.js";
3
3
  import St, { useState as g, useEffect as he } from "react";
4
- import { a as ze } from "./use-visual-utils-DIuorLLH.js";
4
+ import { a as ze } from "./use-visual-utils-C2iWEneY.js";
5
5
  import { u as Vt } from "./use-click-outside-CMeO_QFI.js";
6
6
  /**
7
7
  * @license lucide-react v0.453.0 - ISC
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-BAZxSdVh.js"),m=require("react"),re=require("./use-visual-utils-DyjCJ47j.js"),ue=require("./use-click-outside-B9T3lmcw.js");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-COVj17uo.js"),m=require("react"),re=require("./use-visual-utils-Cyhtukxh.js"),ue=require("./use-click-outside-B9T3lmcw.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import { am as G, an as z, h as Y, i as J, ao as K, e as _, g as X, u as U, ap as Z, aq as q, l as v, ar as ee, f as h } from "./index-C0aUsTJw.js";
1
+ import { am as G, an as z, h as Y, i as J, ao as K, e as _, g as X, u as U, ap as Z, aq as q, l as v, ar as ee, f as h } from "./index-CnzyKX5P.js";
2
2
  import { useState as T, useEffect as te, useCallback as V } from "react";
3
3
  function re(e) {
4
4
  const o = e.toUpperCase().indexOf("WHERE"), r = e.toUpperCase().indexOf("GROUP BY"), t = e.toUpperCase().indexOf("LIMIT"), i = e.toUpperCase().indexOf("ORDER BY");
@@ -1 +1 @@
1
- "use strict";const o=require("./index-BAZxSdVh.js"),b=require("react");function _(e){const a=e.toUpperCase().indexOf("WHERE"),r=e.toUpperCase().indexOf("GROUP BY"),t=e.toUpperCase().indexOf("LIMIT"),d=e.toUpperCase().indexOf("ORDER BY");let c=e.length;if(d!==-1&&(c=d),t!==-1&&t<c&&(c=t),a!==-1){const n=e.substring(0,a),s=e.substring(a);return`${n} {{ filters | where }} AND ${s.substring(6)}`}else if(r!==-1){const n=e.substring(0,r),s=e.substring(r);return`${n} {{ filters | where }} ${s}`}else{const n=e.substring(0,c),s=e.substring(c);return console.log("beforeClause",n),console.log("afterClause",s),s?`${n} {{ filters | where }} ${s}`:`${n.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,r]=b.useState(null),[t,d]=b.useState(null),c=o.useEnsureReactGlobals();return b.useEffect(()=>{if(!e||e.trim()===""){r(null),d(null);return}if(!c)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const l=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(l,{method:"HEAD"})).ok)throw new Error(`Module not found at ${l}`)}catch{}const m=await import(l);if(typeof m.useChartStore!="function")throw new Error("useChartStore is not a function");r(()=>m.useChartStore),d(null)}catch(s){const l=s instanceof Error?s.message:"Unknown error";console.error("Failed to load remote chart store:",l),d(l),r(null)}})()},[e,c]),a}function H(e,a){if(e.length===0)return"";if(a){const r=e.find(t=>t.id===a);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const c=t.split("__")[0],n=e.find(s=>s.tabTitle===c);return n?n.id:e[0].id}return a}}return e[0].id}async function j(e,a,r,t){if(!a||!r)throw new Error("Missing auth token or visual ID");const d=["resource-by-id","visual",r],c=t.getQueryData(d);if(c)return console.log("Using cached visual data for:",r),{data:c,fromCache:!0};console.log("Fetching visual data from network for:",r);const n=o.ue.loading("Loading visual...",{position:"top-center"});try{const s=await fetch(`${e}/management/v1/visuals/${r}`,{headers:{Authorization:`Bearer ${a}`}});if(!s.ok)throw new Error("Failed to load visual");const l=await s.json();return t.setQueryData(d,l),o.ue.dismiss(n),{data:l,fromCache:!1}}catch(s){throw o.ue.dismiss(n),s}}function T(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function Q(e,a){var c,n;const r=(e==null?void 0:e.frameObject)??((c=e==null?void 0:e.visual)==null?void 0:c.frameObject);if(!r)return!1;const t=T(r);if(!(t!=null&&t.cards)||t.cards.length===0)return!1;const d=(n=t.cards)==null?void 0:n.find(s=>s.id===t.activeCardId);return d?(o.setupEditorWithCard({...a,frame:t,card:d,visualId:(e==null?void 0:e.id)||t.visualId}),!0):!1}function G(){var g;const{setCardSql:e}=o.useEditorActions(),a=o.useEditorStore(i=>i.frame),r=o.useEditorStore(i=>i.card),t=B(((g=r.customCardPreferences)==null?void 0:g.url)||""),d=o.useEditorStore(i=>i.selectedSchemaName),c=o.useEditorStore(i=>i.selectedDatamodelId),n=o.useEditorStore(i=>i.selectedDatabaseName),s=o.useEditorStore(i=>i.selectedTableName),l=o.useEditorStore(i=>i.selectedConnectionId),m=o.useEditorStore(i=>i.isShowingVisual),f=r.sql;return{getUpdatedFrame:b.useCallback(()=>{var E;let i=f;f&&!f.includes("{{")&&(i=_(f),e(i));const C=(E=t==null?void 0:t.getState())==null?void 0:E.settings,U={...r,dataSource:r.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:c,lastSelectedDatabase:n,lastSelectedTable:s,connectionId:l,sql:i,customCfg:m?r.customCfg:null,preferences:r.preferences,...C&&{customCardPreferences:{...r.customCardPreferences,settings:C}}},w=a.cards.map(S=>S.id===r.id?U:S);return{...a,cards:w,activeCardId:H(w,a.activeCardId)}},[r,a,m,d,c,n,s,l,e,t,f])}}function z(){const{authToken:e,tokenProps:a}=o.useSemaphorContext(),r=o.useQueryClient(),t=o.useSelectedVisual(),{selectVisual:d}=o.useManagementActions(),{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E}=o.useEditorActions(),{setIsDashboardEditing:S,setIsVisualEditing:$,setSelectedFrameId:v,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=o.useDashboardActions(),I=o.useDashboardStore(u=>u.selectedSheetId),D=o.useDashboardStore(u=>u.selectedFrameId),O=o.useDashboardStore(u=>u.dashboard),x=o.useDashboardStore(u=>u.filterValues),y=o.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),M=b.useCallback(async u=>{try{d(u),A();const{data:p,fromCache:h}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r);if(!Q(p,{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E,setIsDashboardEditing:S,setIsVisualEditing:$,dashboard:O,selectedSheetId:I,selectedFrameId:D,filterValues:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:h}}catch(p){return console.error("Error editing visual:",p),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,c,n,S,$,s,l,m,f,V,g,i,C,U,w,E,A,O,I,D,x]),k=b.useCallback(async u=>{var p;try{if(d(u),!I)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:h,fromCache:W}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r),L=(h==null?void 0:h.frameObject)??((p=h==null?void 0:h.visual)==null?void 0:p.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const F=T(L);if(!(F!=null&&F.cards)||F.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...o.cloneFrameWithNewIds(F),visualId:u.id};return N(I,P,"end"),S(!0),v(P.id),R(!1),{success:!0,fromCache:W}}catch(h){return console.error("Error adding visual:",h),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,I,N,S,v,R]);return{visual:y.data,isLoading:y.isLoading,isError:y.isError,error:y.error,handleEditLibraryVisual:M,handleAddLibraryVisual:k,getUpdatedFrame:G().getUpdatedFrame,refetch:y.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=z;
1
+ "use strict";const o=require("./index-COVj17uo.js"),b=require("react");function _(e){const a=e.toUpperCase().indexOf("WHERE"),r=e.toUpperCase().indexOf("GROUP BY"),t=e.toUpperCase().indexOf("LIMIT"),d=e.toUpperCase().indexOf("ORDER BY");let c=e.length;if(d!==-1&&(c=d),t!==-1&&t<c&&(c=t),a!==-1){const n=e.substring(0,a),s=e.substring(a);return`${n} {{ filters | where }} AND ${s.substring(6)}`}else if(r!==-1){const n=e.substring(0,r),s=e.substring(r);return`${n} {{ filters | where }} ${s}`}else{const n=e.substring(0,c),s=e.substring(c);return console.log("beforeClause",n),console.log("afterClause",s),s?`${n} {{ filters | where }} ${s}`:`${n.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,r]=b.useState(null),[t,d]=b.useState(null),c=o.useEnsureReactGlobals();return b.useEffect(()=>{if(!e||e.trim()===""){r(null),d(null);return}if(!c)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const l=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(l,{method:"HEAD"})).ok)throw new Error(`Module not found at ${l}`)}catch{}const m=await import(l);if(typeof m.useChartStore!="function")throw new Error("useChartStore is not a function");r(()=>m.useChartStore),d(null)}catch(s){const l=s instanceof Error?s.message:"Unknown error";console.error("Failed to load remote chart store:",l),d(l),r(null)}})()},[e,c]),a}function H(e,a){if(e.length===0)return"";if(a){const r=e.find(t=>t.id===a);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const c=t.split("__")[0],n=e.find(s=>s.tabTitle===c);return n?n.id:e[0].id}return a}}return e[0].id}async function j(e,a,r,t){if(!a||!r)throw new Error("Missing auth token or visual ID");const d=["resource-by-id","visual",r],c=t.getQueryData(d);if(c)return console.log("Using cached visual data for:",r),{data:c,fromCache:!0};console.log("Fetching visual data from network for:",r);const n=o.ue.loading("Loading visual...",{position:"top-center"});try{const s=await fetch(`${e}/management/v1/visuals/${r}`,{headers:{Authorization:`Bearer ${a}`}});if(!s.ok)throw new Error("Failed to load visual");const l=await s.json();return t.setQueryData(d,l),o.ue.dismiss(n),{data:l,fromCache:!1}}catch(s){throw o.ue.dismiss(n),s}}function T(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function Q(e,a){var c,n;const r=(e==null?void 0:e.frameObject)??((c=e==null?void 0:e.visual)==null?void 0:c.frameObject);if(!r)return!1;const t=T(r);if(!(t!=null&&t.cards)||t.cards.length===0)return!1;const d=(n=t.cards)==null?void 0:n.find(s=>s.id===t.activeCardId);return d?(o.setupEditorWithCard({...a,frame:t,card:d,visualId:(e==null?void 0:e.id)||t.visualId}),!0):!1}function G(){var g;const{setCardSql:e}=o.useEditorActions(),a=o.useEditorStore(i=>i.frame),r=o.useEditorStore(i=>i.card),t=B(((g=r.customCardPreferences)==null?void 0:g.url)||""),d=o.useEditorStore(i=>i.selectedSchemaName),c=o.useEditorStore(i=>i.selectedDatamodelId),n=o.useEditorStore(i=>i.selectedDatabaseName),s=o.useEditorStore(i=>i.selectedTableName),l=o.useEditorStore(i=>i.selectedConnectionId),m=o.useEditorStore(i=>i.isShowingVisual),f=r.sql;return{getUpdatedFrame:b.useCallback(()=>{var E;let i=f;f&&!f.includes("{{")&&(i=_(f),e(i));const C=(E=t==null?void 0:t.getState())==null?void 0:E.settings,U={...r,dataSource:r.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:c,lastSelectedDatabase:n,lastSelectedTable:s,connectionId:l,sql:i,customCfg:m?r.customCfg:null,preferences:r.preferences,...C&&{customCardPreferences:{...r.customCardPreferences,settings:C}}},w=a.cards.map(S=>S.id===r.id?U:S);return{...a,cards:w,activeCardId:H(w,a.activeCardId)}},[r,a,m,d,c,n,s,l,e,t,f])}}function z(){const{authToken:e,tokenProps:a}=o.useSemaphorContext(),r=o.useQueryClient(),t=o.useSelectedVisual(),{selectVisual:d}=o.useManagementActions(),{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E}=o.useEditorActions(),{setIsDashboardEditing:S,setIsVisualEditing:$,setSelectedFrameId:v,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=o.useDashboardActions(),I=o.useDashboardStore(u=>u.selectedSheetId),D=o.useDashboardStore(u=>u.selectedFrameId),O=o.useDashboardStore(u=>u.dashboard),x=o.useDashboardStore(u=>u.filterValues),y=o.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),M=b.useCallback(async u=>{try{d(u),A();const{data:p,fromCache:h}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r);if(!Q(p,{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E,setIsDashboardEditing:S,setIsVisualEditing:$,dashboard:O,selectedSheetId:I,selectedFrameId:D,filterValues:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:h}}catch(p){return console.error("Error editing visual:",p),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,c,n,S,$,s,l,m,f,V,g,i,C,U,w,E,A,O,I,D,x]),k=b.useCallback(async u=>{var p;try{if(d(u),!I)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:h,fromCache:W}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r),L=(h==null?void 0:h.frameObject)??((p=h==null?void 0:h.visual)==null?void 0:p.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const F=T(L);if(!(F!=null&&F.cards)||F.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...o.cloneFrameWithNewIds(F),visualId:u.id};return N(I,P,"end"),S(!0),v(P.id),R(!1),{success:!0,fromCache:W}}catch(h){return console.error("Error adding visual:",h),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,I,N,S,v,R]);return{visual:y.data,isLoading:y.isLoading,isError:y.isError,error:y.error,handleEditLibraryVisual:M,handleAddLibraryVisual:k,getUpdatedFrame:G().getUpdatedFrame,refetch:y.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=z;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-BAZxSdVh.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-COVj17uo.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-C0aUsTJw.js";
1
+ import { D as a } from "../chunks/index-CnzyKX5P.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-BAZxSdVh.js"),S=require("./types/index.cjs"),a=require("react/jsx-runtime"),g=require("react"),j=require("./chunks/resource-management-panel-Chg6-H5n.js"),c=require("./chunks/dashboard-export-dialog-BkGfu2Ur.js");require("react-dom");function P(r){const o=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(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const C=P(g);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-COVj17uo.js"),S=require("./types/index.cjs"),a=require("react/jsx-runtime"),g=require("react"),j=require("./chunks/resource-management-panel-CBeNy1ff.js"),c=require("./chunks/dashboard-export-dialog-DtrfJ9Js.js");require("react-dom");function P(r){const o=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(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const C=P(g);/**
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,11 +1,11 @@
1
- import { b as S, E as g, F as P, S as w, U as M, m as k, n as A, u as F, o as y, p as L, P as R, q as I, B as V, c as v, r as _, s as U, t as B, v as W, I as j, w as q, x as z, y as O, z as Q, C as G } from "./chunks/index-C0aUsTJw.js";
2
- import { Z as oa, _ as na, D as ta, N as ia, a2 as la, R as da, J as ca, J as ua, K as ha, a as pa, T as fa, al as ma, a9 as Ca, W as va, O as ba, Q as Da, a3 as ya, ab as ga, aa as xa, ae as Ea, af as Na, a8 as Ta, V as Sa, a7 as Pa, a0 as wa, a1 as Ma, $ as ka, ac as Aa, a6 as Fa, a5 as La, a4 as Ra, ag as Ia, ad as Va, M as _a, ai as Ua, ak as Ba, aj as Wa, g as ja, A as qa, Y as za, G as Oa, e as Qa, ah as Ga, f as Ha, H as Ka } from "./chunks/index-C0aUsTJw.js";
1
+ import { b as S, E as g, F as P, S as w, U as M, m as k, n as A, u as F, o as y, p as L, P as R, q as I, B as V, c as v, r as _, s as U, t as B, v as W, I as j, w as q, x as z, y as O, z as Q, C as G } from "./chunks/index-CnzyKX5P.js";
2
+ import { Z as oa, _ as na, D as ta, N as ia, a2 as la, R as da, J as ca, J as ua, K as ha, a as pa, T as fa, al as ma, a9 as Ca, W as va, O as ba, Q as Da, a3 as ya, ab as ga, aa as xa, ae as Ea, af as Na, a8 as Ta, V as Sa, a7 as Pa, a0 as wa, a1 as Ma, $ as ka, ac as Aa, a6 as Fa, a5 as La, a4 as Ra, ag as Ia, ad as Va, M as _a, ai as Ua, ak as Ba, aj as Wa, g as ja, A as qa, Y as za, G as Oa, e as Qa, ah as Ga, f as Ha, H as Ka } from "./chunks/index-CnzyKX5P.js";
3
3
  import { EMPTY_SELECTION as $a } from "./types/index.js";
4
4
  import { jsx as a, jsxs as l } from "react/jsx-runtime";
5
5
  import * as p from "react";
6
6
  import { useMemo as H } from "react";
7
- import { ResourceManagementPanel as Xa } from "./chunks/resource-management-panel-B2XgOmvv.js";
8
- import { A as ae, D as ee, S as se, U as re, V as oe, u as ne } from "./chunks/dashboard-export-dialog-BOeaIkB4.js";
7
+ import { ResourceManagementPanel as Xa } from "./chunks/resource-management-panel-4U6ulEyR.js";
8
+ import { A as ae, D as ee, S as se, U as re, V as oe, u as ne } from "./chunks/dashboard-export-dialog-BDIPA0iP.js";
9
9
  import "react-dom";
10
10
  /**
11
11
  * @license lucide-react v0.453.0 - ISC