semaphor 0.0.60 → 0.0.62

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,215 +0,0 @@
1
- "use strict";const e=require("./index-RE3C9jay.js"),b=require("react");function ht(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return r.default=t,Object.freeze(r)}const Be=ht(b);/**
2
- * @license lucide-react v0.379.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const jt=e.createLucideIcon("AreaChart",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M7 12v5h12V8l-5 5-4-4Z",key:"zxz28u"}]]);/**
7
- * @license lucide-react v0.379.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const ze=e.createLucideIcon("BarChart4",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17V5",key:"sfb6ij"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
12
- * @license lucide-react v0.379.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Et=e.createLucideIcon("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
17
- * @license lucide-react v0.379.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const ft=e.createLucideIcon("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
22
- * @license lucide-react v0.379.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const gt=e.createLucideIcon("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
27
- * @license lucide-react v0.379.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const $e=e.createLucideIcon("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
32
- * @license lucide-react v0.379.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const Rt=e.createLucideIcon("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
37
- * @license lucide-react v0.379.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const Ge=e.createLucideIcon("GanttChart",[["path",{d:"M8 6h10",key:"9lnwnk"}],["path",{d:"M6 12h9",key:"1g9pqf"}],["path",{d:"M11 18h7",key:"c8dzvl"}]]);/**
42
- * @license lucide-react v0.379.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const bt=e.createLucideIcon("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/**
47
- * @license lucide-react v0.379.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const St=e.createLucideIcon("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
52
- * @license lucide-react v0.379.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const yt=e.createLucideIcon("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
57
- * @license lucide-react v0.379.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const vt=e.createLucideIcon("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
62
- * @license lucide-react v0.379.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const Le=e.createLucideIcon("LineChart",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/**
67
- * @license lucide-react v0.379.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */const Ct=e.createLucideIcon("ListEnd",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M10 18H3",key:"13769t"}],["path",{d:"M21 6v10a2 2 0 0 1-2 2h-5",key:"ilrcs8"}],["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}]]);/**
72
- * @license lucide-react v0.379.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */const Nt=e.createLucideIcon("ListStart",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M10 6H3",key:"lf8lx7"}],["path",{d:"M21 18V8a2 2 0 0 0-2-2h-5",key:"1hghli"}],["path",{d:"m16 8-2-2 2-2",key:"160uvd"}]]);/**
77
- * @license lucide-react v0.379.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const kt=e.createLucideIcon("ListX",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"m19 10-4 4",key:"1tz659"}],["path",{d:"m15 10 4 4",key:"1n7nei"}]]);/**
82
- * @license lucide-react v0.379.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */const me=e.createLucideIcon("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
87
- * @license lucide-react v0.379.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */const wt=e.createLucideIcon("MessageSquareMore",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]]);/**
92
- * @license lucide-react v0.379.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const Dt=e.createLucideIcon("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
97
- * @license lucide-react v0.379.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */const Ke=e.createLucideIcon("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
102
- * @license lucide-react v0.379.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- */const Qe=e.createLucideIcon("PieChart",[["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}],["path",{d:"M22 12A10 10 0 0 0 12 2v10z",key:"1rfc4y"}]]);/**
107
- * @license lucide-react v0.379.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */const At=e.createLucideIcon("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
112
- * @license lucide-react v0.379.0 - ISC
113
- *
114
- * This source code is licensed under the ISC license.
115
- * See the LICENSE file in the root directory of this source tree.
116
- */const It=e.createLucideIcon("Plug2",[["path",{d:"M9 2v6",key:"17ngun"}],["path",{d:"M15 2v6",key:"s7yy2p"}],["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M6 11V8h12v3a6 6 0 1 1-12 0v0Z",key:"nd4hoy"}]]);/**
117
- * @license lucide-react v0.379.0 - ISC
118
- *
119
- * This source code is licensed under the ISC license.
120
- * See the LICENSE file in the root directory of this source tree.
121
- */const Tt=e.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
122
- * @license lucide-react v0.379.0 - ISC
123
- *
124
- * This source code is licensed under the ISC license.
125
- * See the LICENSE file in the root directory of this source tree.
126
- */const Je=e.createLucideIcon("ScatterChart",[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v18h18",key:"1s2lah"}]]);/**
127
- * @license lucide-react v0.379.0 - ISC
128
- *
129
- * This source code is licensed under the ISC license.
130
- * See the LICENSE file in the root directory of this source tree.
131
- */const zt=e.createLucideIcon("ShieldQuestion",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
132
- * @license lucide-react v0.379.0 - ISC
133
- *
134
- * This source code is licensed under the ISC license.
135
- * See the LICENSE file in the root directory of this source tree.
136
- */const Lt=e.createLucideIcon("Sigma",[["path",{d:"M18 7V4H6l6 8-6 8h12v-3",key:"zis8ev"}]]);/**
137
- * @license lucide-react v0.379.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */const Ft=e.createLucideIcon("SwatchBook",[["path",{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z",key:"1ldrpk"}],["path",{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7",key:"11i5po"}],["path",{d:"M 7 17h0.01",key:"10821z"}],["path",{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8",key:"o2gii7"}]]);/**
142
- * @license lucide-react v0.379.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- */const Ot=e.createLucideIcon("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
147
- * @license lucide-react v0.379.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */const Mt=e.createLucideIcon("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/**
152
- * @license lucide-react v0.379.0 - ISC
153
- *
154
- * This source code is licensed under the ISC license.
155
- * See the LICENSE file in the root directory of this source tree.
156
- */const Fe=e.createLucideIcon("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
157
- * @license lucide-react v0.379.0 - ISC
158
- *
159
- * This source code is licensed under the ISC license.
160
- * See the LICENSE file in the root directory of this source tree.
161
- */const qt=e.createLucideIcon("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);function Bt(){const[t,r]=b.useState(""),[s,n]=b.useState(!1),[o,u]=b.useState(!1),a=e.useDashboardStore(c=>c.dashboard);function l(){const c=e.getDashbaordStateWithoutData(a),p=e.getBookmarkKey(a.id),m=JSON.parse(localStorage.getItem(p)||"[]");if(m.some(j=>j.name===t)){n(!0);return}m.push({name:t,template:c}),localStorage.setItem(p,JSON.stringify(m)),u(!1)}return e.jsxRuntimeExports.jsxs(e.Dialog,{open:o,onOpenChange:u,children:[e.jsxRuntimeExports.jsx(e.DialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(e.Button,{variant:"outline",className:"h-7 p-2",size:"sm",children:[e.jsxRuntimeExports.jsx(e.Plus,{className:" mr-2 h-4 w-4",strokeWidth:1.5}),"Add Lens"]})}),e.jsxRuntimeExports.jsxs(e.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxRuntimeExports.jsxs(e.DialogHeader,{children:[e.jsxRuntimeExports.jsx(e.DialogTitle,{children:"Add a Lens"}),e.jsxRuntimeExports.jsx(e.DialogDescription,{children:"Lenses are private by default and are only visible to you."})]}),e.jsxRuntimeExports.jsx("div",{className:"grid gap-4 py-4",children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[e.jsxRuntimeExports.jsx(e.Label,{className:"text-right",children:"Name"}),e.jsxRuntimeExports.jsx(e.Input,{value:t,onChange:c=>{s&&n(!1),r(c.target.value)},id:"name",className:"col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"})]})}),s&&e.jsxRuntimeExports.jsx("p",{className:"text-sm",children:"The bookmark name already exists. Use a differnet name."}),e.jsxRuntimeExports.jsx(e.DialogFooter,{children:e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",type:"submit",disabled:!t,onClick:l,children:"Save"})})]})]})}function Vt(){const[t,r]=b.useState(!1),[s,n]=b.useState(""),o=e.useDashboardStore(x=>x.dashboard),u=e.useDashboardStore(x=>x.bookmarkKey),[a,l]=b.useState([]),c=e.useDashboardStore(x=>x.actions.setDashboard),p=e.useDashboardStore(x=>x.actions.setFilterValues),m=e.useDashboardStore(x=>x.actions.setBookmarkKey);b.useEffect(()=>{const x=e.getBookmarkKey(o.id),d=JSON.parse(localStorage.getItem(x)||"[]");l(d);const E=d.find(h=>h.default);E&&E.name===u&&n(E.name)},[t,o,u]);function f(x){if(x===s)return;const d=a.find(h=>h.name===x),E=d==null?void 0:d.template;E&&(c(E),p(d.filterValues||[]),m(x==="Original"?"":x)),n(x)}function j(x){const d=e.getBookmarkKey(o.id),h=JSON.parse(localStorage.getItem(d)||"[]").filter(R=>R.name!==x);localStorage.setItem(d,JSON.stringify(h)),l(h)}return e.jsxRuntimeExports.jsxs(e.DropdownMenu,{open:t,onOpenChange:r,children:[e.jsxRuntimeExports.jsx(e.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",className:"h-7 p-2",children:e.jsxRuntimeExports.jsx(bt,{className:"h-4 w-4",strokeWidth:1.5})})}),e.jsxRuntimeExports.jsxs(e.DropdownMenuContent,{className:"w-56",children:[e.jsxRuntimeExports.jsx(e.DropdownMenuLabel,{children:"Lenses"}),e.jsxRuntimeExports.jsx(e.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsxs(e.DropdownMenuRadioGroup,{value:s,onValueChange:f,children:[e.jsxRuntimeExports.jsx(e.DropdownMenuRadioItem,{value:"Original",children:"Original"}),a.filter(x=>x.name!="Original").map((x,d)=>e.jsxRuntimeExports.jsxs(e.DropdownMenuRadioItem,{className:"xbg-red-100 flex justify-between",value:x.name,defaultChecked:x.name===u,children:[e.jsxRuntimeExports.jsx("p",{children:x.name}),e.jsxRuntimeExports.jsx(e.Cross2Icon,{onClick:E=>{E.preventDefault(),j(x.name)},className:"h-3 w-3 hover:cursor-pointer",strokeWidth:1.5})]},d))]})]})]})}function _t(){const[t,r]=b.useState(!1),s=e.useDashboardStore(u=>u.dashboard),n=e.useDashboardStore(u=>u.bookmarkKey);b.useEffect(()=>{if(!n){r(!1);return}const u=e.getBookmarkKey(s.id),l=JSON.parse(localStorage.getItem(u)||"[]").find(c=>c.name===n);r(l?l.default:!1)},[n,s.id]);function o(u){if(r(u),!n)return;const a=e.getBookmarkKey(s.id),c=JSON.parse(localStorage.getItem(a)||"[]").map(p=>(p.name===n?p.default=u:p.default=!1,p));console.log(c),localStorage.setItem(a,JSON.stringify(c))}return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.Checkbox,{checked:t,onCheckedChange:o,id:"terms"}),e.jsxRuntimeExports.jsx("label",{htmlFor:"terms",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Set as default"})]})}function Ht(){const t=e.useDashboardStore(R=>R.bookmarkKey),r=e.useDashboardStore(R=>R.dashboard);e.useDashboardStore(R=>R.selectedSheetId);const s=e.useDashboardStore(R=>R.isDashboardEditing),n=e.useDashboardStore(R=>R.filterValues),o=e.useDashboardStore(R=>R.isVisualEditing),u=e.useDashboardStore(R=>R.showFilters);e.useDashboardStore(R=>R.showDashboardJSON);const a=e.useDashboardStore(R=>R.onSaveFunction),l=e.useDashboardStore(R=>R.actions.setShowFilters),{addFrame:c,setSelectedFrameId:p}=e.useDashboardStore(R=>R.actions),{getSelectedSheet:m,setIsDashboardEditing:f,setShowDashboardJSON:j}=e.useDashboardStore(R=>R.actions),x=m(),d=()=>{if(!s||!x)return;const R={id:e.v4(),title:"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}]},type:"bar",sql:"select COUNT(*) from YOUR_TABLE",data:[]},k={id:e.v4(),cards:[R],activeCardId:R.id};c(x.id,k),p(k.id)},E=()=>{f(!0)};function h(){if(!t||t==="")return;const R=e.getDashbaordStateWithoutData(r),k=e.getBookmarkKey(r.id),g=JSON.parse(localStorage.getItem(k)||"[]"),A=g.findIndex(I=>I.name===t);A!==-1?g[A]={name:t,template:R,default:g[A].default,filterValues:n}:g.push({name:t,template:R,filterValues:n}),localStorage.setItem(k,JSON.stringify(g)),a==null||a(R)}return o?null:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-2 border-b bg-muted/50 px-2 py-2",role:"dashboard-controls",children:[!o&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxRuntimeExports.jsx(e.Label,{children:t}),!!t&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("span",{className:"text-muted-foreground",children:"|"}),e.jsxRuntimeExports.jsx(_t,{})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[s&&!o&&e.jsxRuntimeExports.jsx(Bt,{}),!o&&e.jsxRuntimeExports.jsx(Vt,{}),s&&!o&&e.jsxRuntimeExports.jsxs(e.Button,{variant:"outline",className:"h-7 p-2",size:"sm",disabled:!s,onClick:d,children:[e.jsxRuntimeExports.jsx(e.Plus,{className:"mr-2 h-4 w-4",strokeWidth:1.5}),"Add Frame"]}),!s&&e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",className:"h-7 p-2",onClick:E,size:"sm",children:e.jsxRuntimeExports.jsx(Ke,{className:"h-4 w-4",strokeWidth:1.5})}),s&&!o&&e.jsxRuntimeExports.jsx(e.Button,{variant:"outline",role:"close",className:"h-7 p-2",onClick:()=>{f(!1),j(!1)},size:"sm",children:e.jsxRuntimeExports.jsx(e.Cross2Icon,{className:"h-4 w-4",strokeWidth:1.5})}),s&&!o&&e.jsxRuntimeExports.jsx(e.Button,{className:"h-7 p-2",variant:"outline",onClick:h,size:"sm",children:e.jsxRuntimeExports.jsx(Tt,{className:"h-4 w-4",strokeWidth:1.5})}),!u&&!o&&s&&e.jsxRuntimeExports.jsx(e.Button,{className:"h-7 p-2",variant:"outline",onClick:()=>l(!0),size:"sm",children:e.jsxRuntimeExports.jsx(e.Filter,{className:"h-4 w-4",strokeWidth:1.5})}),!o&&s&&!1,!o&&!1]})]})}function de({title:t,items:r,value:s,isLoading:n,isError:o,connectionTooltip:u,onChange:a,showNone:l=!1,className:c,showIcon:p=!0,disabled:m=!1}){const f=n?"Loading...":o?"Error":s;function j(){if(t==="Connection")return e.jsxRuntimeExports.jsx(It,{className:"size-4 rotate-90"});if(t==="Database")return e.jsxRuntimeExports.jsx(gt,{className:"size-4"});if(t==="Schema")return e.jsxRuntimeExports.jsx(Dt,{className:"size-4"});if(t==="Table")return e.jsxRuntimeExports.jsx(e.Table,{className:"size-4"});if(t==="Model")return e.jsxRuntimeExports.jsx(Et,{className:"size-4"})}return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[p&&e.jsxRuntimeExports.jsx("div",{className:"shrink-0",children:u?e.jsxRuntimeExports.jsxs(e.Tooltip,{children:[e.jsxRuntimeExports.jsx(e.TooltipTrigger,{children:j()}),e.jsxRuntimeExports.jsx(e.TooltipContent,{className:"text-xs",align:"start",children:u})]}):j()}),e.jsxRuntimeExports.jsxs(e.Select,{disabled:m,value:f,onValueChange:a,children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:e.cn("h-9 w-full focus:ring-1 focus:ring-offset-0",c),children:e.jsxRuntimeExports.jsx(e.SelectValue,{placeholder:n?"Loading...":o?"Error":`Select ${t}`})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[n?e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Loading..."}):e.jsxRuntimeExports.jsx(e.SelectLabel,{children:t}),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[l&&e.jsxRuntimeExports.jsx(e.SelectItem,{value:"none",children:"None"},"none"),r&&r.map((x,d)=>e.jsxRuntimeExports.jsx(e.SelectItem,{value:x.id,children:x.name},d))]}),(n||o)&&e.jsxRuntimeExports.jsx(e.SelectItem,{value:f,children:f})]})})]})]})}function Pt({column:t}){const[r,s]=b.useState(!1),n=e.useEditorStore(x=>x.selectedTableName),o=e.useEditorStore(x=>x.selectedSchemaName),u=e.useEditorStore(x=>x.selectedDatamodelId),a=e.useEditorStore(x=>x.sqlGen),{modelItems:l}=ae(),c=e.useEditorStore(x=>x.actions.setSqlGen),p=e.useEditorStore(x=>x.actions.setCardSql),m=e.useEditorStore(x=>x.actions.setRunSql);function f(x,d){var k;const E=e.createSqlGenConfig(x,a,d),h=(k=l==null?void 0:l.find(g=>g.id===u))==null?void 0:k.name;c(E);const R=e.getSql(E,e.fmt(o||""),e.fmt(n),h);R&&(p(R),m(!0)),s(!1)}function j(){return e.jsxRuntimeExports.jsxs("ul",{className:"text-xs",children:[e.jsxRuntimeExports.jsx("li",{onClick:()=>f(t,"COUNT"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Count"}),e.jsxRuntimeExports.jsx("li",{onClick:()=>f(t,"AVG"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Avg"}),e.jsxRuntimeExports.jsx("li",{onClick:()=>f(t,"SUM"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Sum"}),e.jsxRuntimeExports.jsx("li",{onClick:()=>f(t,"MAX"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Max"}),e.jsxRuntimeExports.jsx("li",{onClick:()=>f(t,"MIN"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Min"})]})}return e.jsxRuntimeExports.jsxs(e.HoverCard,{openDelay:0,open:r,onOpenChange:s,children:[e.jsxRuntimeExports.jsx(e.HoverCardTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx($e,{className:"invisible size-3.5 cursor-pointer text-foreground/40 group-hover:visible"})}),e.jsxRuntimeExports.jsx(e.HoverCardContent,{align:"center",className:"w-20 rounded-md p-0 shadow-none",children:j()})]})}function Ue({column:t}){return e.jsxRuntimeExports.jsxs(e.Tooltip,{children:[e.jsxRuntimeExports.jsx(e.$a093c7e1ec25a057$export$8c610744efcf8a1d,{asChild:!0,children:e.TEXT_DATA_TYPES.includes(t.data_type.toLowerCase())?e.jsxRuntimeExports.jsx(Fe,{className:"size-3"}):e.NUMBER_DATA_TYPES.includes(t.data_type.toLowerCase())?e.jsxRuntimeExports.jsx(yt,{className:"size-3"}):e.DATE_DATA_TYPES.includes(t.data_type.toLowerCase())?e.jsxRuntimeExports.jsx(e.Calendar,{className:"size-3"}):e.BOOLEAN_DATA_TYPES.includes(t.data_type.toLowerCase())?e.jsxRuntimeExports.jsx(Mt,{className:"size-3"}):e.jsxRuntimeExports.jsx(zt,{className:"size-3"})}),e.jsxRuntimeExports.jsx(e.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{className:"font-mono text-xs",children:t.data_type})})]})}function $t({schemaName:t,tableName:r,columns:s,status:n}){const o=e.useEditorStore(y=>y.sqlGen),u=e.useEditorStore(y=>y.selectedConnectionId),a=e.useEditorStore(y=>y.selectedDatabaseName),l=e.useEditorStore(y=>y.selectedSchemaName),c=e.useEditorStore(y=>y.selectedTableName),p=e.useEditorStore(y=>y.selectedDatamodelId),m=e.useDashboardStore(y=>y.dashboard.aiScopeTables),{setAIScopeTables:f}=e.useDashboardStore(y=>y.actions),j=e.useEditorStore(y=>y.actions.setRunSql),x=e.useEditorStore(y=>y.actions.setSqlGen),d=e.useEditorStore(y=>y.actions.setIsShowingVisual),E=e.useEditorStore(y=>y.actions.setCardSql),{connectionType:h,modelItems:R}=ae();function k(y){var D;const C=e.createSqlGenConfig(y,o);x(C);const L=(D=R==null?void 0:R.find(F=>F.id===p))==null?void 0:D.name,M=e.getSql(C,e.fmt(t),e.fmt(r),L);M&&(E(M),j(!0))}function g(){return(m==null?void 0:m.find(y=>y.connectinonId===u&&y.tableName===c))!==void 0}function A(y){if(y===!0&&c&&u){const C={connectinonId:u,connectionType:h,databaseName:a,schemaName:l,tableName:c},M=[...m||[],C].filter((D,F,_)=>_.findIndex(B=>B.connectinonId===D.connectinonId&&B.tableName===D.tableName)===F);f(M),e.Jt.success(`Added '${c}' to AI Scope`,{position:"top-right",duration:2500,richColors:!0})}else{const C=(m||[]).filter(L=>L.connectinonId!==u&&L.tableName!==c);f(C),e.Jt(`Removed '${c}' from AI Scope`,{position:"top-right",duration:2e3,richColors:!0})}}function I(){var D;let y=e.getQualifiedTableName(t,r);const C=(D=R==null?void 0:R.find(F=>F.id===p))==null?void 0:D.name;console.log("modelName",C),p&&p!=="none"&&(y=`${e.DATAMODEL_NAMESPCACE}.${C}`);let L=y;return(F=>/[A-Z]/.test(F))(r)&&(L=L.split(".").map(_=>`"${_}"`).join(".")),L}function z(){const y=I();d(!1);const C=h==="MSSQL"?`SELECT top 10 * FROM ${y}`:`SELECT * FROM ${y} LIMIT 10`;E(C),j(!0)}function w(){const y=I();d(!1),E(`SELECT COUNT(*) as count FROM ${y}`),j(!0)}return e.jsxRuntimeExports.jsxs("div",{className:"flex grow flex-col space-y-4 px-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center gap-1",children:[e.jsxRuntimeExports.jsx(e.Toggle,{title:`${g()?"Remove from":"Add to"} AI Scope`,pressed:g(),onPressedChange:A,variant:"outline",className:"h-9 px-2",children:e.jsxRuntimeExports.jsx(e.Bot,{className:e.cn("size-4",{"text-primary":g(),"text-muted-foreground":!g()})})}),e.jsxRuntimeExports.jsxs(e.Button,{disabled:n!=="Success",onClick:z,size:"sm",variant:"secondary",className:"flex",children:[n!=="Success"?e.jsxRuntimeExports.jsx(me,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"}):e.jsxRuntimeExports.jsx(Ft,{className:"mr-2 size-4"}),"Top 10"]}),e.jsxRuntimeExports.jsxs(e.Button,{disabled:n!=="Success",onClick:w,size:"sm",variant:"secondary",className:"flex",children:[n!=="Success"?e.jsxRuntimeExports.jsx(me,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"}):e.jsxRuntimeExports.jsx(Lt,{className:"mr-2 size-4"}),"Count"]})]}),e.jsxRuntimeExports.jsxs(e.ScrollArea,{className:"flex-1 basis-0 overflow-y-auto border-b border-t border-muted py-3",children:[s==null?void 0:s.map(y=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>k(y),className:e.cn("group mx-3 flex cursor-pointer items-center justify-between rounded px-2 py-[6px] text-sm transition-colors hover:bg-muted/50",{"bg-muted":e.isColumnInSqlGen(y,o)}),children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(Ue,{column:y}),e.jsxRuntimeExports.jsx("span",{children:y.column_name})]}),e.jsxRuntimeExports.jsx("div",{onClick:C=>C.stopPropagation(),className:"flex items-center justify-end",children:e.NUMBER_DATA_TYPES.includes(y.data_type)&&e.jsxRuntimeExports.jsx(Pt,{column:y})})]},y.column_name)),e.jsxRuntimeExports.jsx(e.ScrollBar,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(e.ScrollBar,{orientation:"horizontal"})]})]})}function ae(t,r){var ge,Re,je,be,Se;let s=b.useMemo(()=>[],[]);const n=e.useSemaphorContext().authToken||t,o=e.useEditorStore(i=>i.selectedConnectionId),u=e.useEditorStore(i=>i.selectedDatamodelId),a=e.useEditorStore(i=>i.selectedDatabaseName),l=e.useEditorStore(i=>i.selectedSchemaName),c=e.useEditorStore(i=>i.selectedTableName),p=e.useEditorStore(i=>i.actions.setCurrentColumns),m=e.useEditorStore(i=>i.actions.setSelectedConnectionId),f=e.useEditorStore(i=>i.actions.setSelectedDatamodelId),j=e.useEditorStore(i=>i.actions.setSelectedDatabaseName),x=e.useEditorStore(i=>i.actions.setSelectedSchemaName),d=e.useEditorStore(i=>i.actions.setSelectedTableName),E=e.useEditorStore(i=>i.actions.setCardSql);function h(i){return o&&a&&l&&a!=="NA"?!0:o&&i==="API"?!1:!!(o&&i==="S3")}function R(i){return!!(o&&a&&a!=="NA"&&l&&c||o&&(i==="S3"||i==="API")||u&&u)}function k(i){return o&&i?!(i==="API"||i==="S3"):!1}const{data:g,isLoading:A,isError:I}=e.useQuery({queryKey:["connections"],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/connections",(n==null?void 0:n.accessToken)||""),enabled:!!(n!=null&&n.accessToken)}),{data:z,isLoading:w,isError:y}=e.useQuery({queryKey:["models",o],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/datamodels",(n==null?void 0:n.accessToken)||"",{connection_id:o}),enabled:!!(n!=null&&n.accessToken)&&!!o}),C=g==null?void 0:g.connections.find(i=>i.id===o),L=C==null?void 0:C.type,M=(C==null?void 0:C.type)==="API"||(C==null?void 0:C.type)==="S3",{data:D,isLoading:F,isFetching:_,isError:B,refetch:K}=e.useQuery({queryKey:["databases",o],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/databases",(n==null?void 0:n.accessToken)||"",{connection_id:o}),enabled:k(L)}),{data:q,isLoading:Q,isFetching:v,isError:S,refetch:N}=e.useQuery({queryKey:["schemas",o,a],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/schemas",(n==null?void 0:n.accessToken)||"",{connection_id:o,database_name:a}),enabled:!!o&&!!a&&!M&&a!=="NA"}),{data:O,isLoading:te,isFetching:G,isError:T,refetch:H}=e.useQuery({queryKey:["tables",o,a,l],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/tables",(n==null?void 0:n.accessToken)||"",{connection_id:o,database_name:a,schema_name:l}),enabled:h(L)}),{data:$,isLoading:ne,isFetching:se,isError:V}=e.useQuery({queryKey:["columns",o,a,u,l,c],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/columns",(n==null?void 0:n.accessToken)||"",{connection_id:o,datamodel_id:u||"",database_name:a,schema_name:l,table_name:c}),enabled:R(L)});b.useEffect(()=>{p(s)},[$,p,s]),b.useEffect(()=>{},[M,E,d,x,j,C]);const J=(C==null?void 0:C.type)==="API"?(ge=C==null?void 0:C.type)==null?void 0:ge.toLowerCase():c||"",U=M?"":l||"";function oe(i){x(i),d("")}function le(i){j(i==="none"?"":i),x(""),d(""),i!=="none"&&i!==""&&f("")}function he(i){m(i)}function Me(i){f(i==="none"?"":i),i!=="none"&&i!==""&&j("")}D&&((Re=D==null?void 0:D.databases)==null?void 0:Re.length)>0,q&&((je=q==null?void 0:q.schemas)==null?void 0:je.length)>0,$&&((be=$==null?void 0:$.columns)==null?void 0:be.length)>0&&(s=$.columns.map(i=>({...i,data_type:i.data_type.toLowerCase()}))),B&&(s=[]),(V||I)&&(s=[]);const ce=g==null?void 0:g.connections.map(i=>({id:i.id,name:i.name,type:i.type})),ke=(Se=z==null?void 0:z.datamodels)==null?void 0:Se.map(i=>({id:i.id,name:i.name})),fe=D==null?void 0:D.databases.map(i=>({id:i.database_name,name:i.database_name})),we=q==null?void 0:q.schemas.map(i=>({id:i.schema_name,name:i.schema_name})),De=O==null?void 0:O.tables.map(i=>({id:i.table_name,name:i.table_name}));return{connectionItems:ce,isConnectionsLoading:A,isConnectionsError:I,modelItems:ke,isModelsLoading:w,isModelsError:y,databaseItems:fe,isDatabasesLoadingOrFetching:F||_,isDatabaseError:B,schemaItems:we,isSchemaLoadingOrFetching:Q||v,isSchemaError:S,tableItems:De,isTableLoadingOrFetching:te||G,isTableError:T,columns:s,isColumnsLoadingOrFetching:ne||se,isColumnsError:V,isNonDbConnection:M,connectionType:L,tableName:J,schemaName:U,handleConnectionChange:he,handleDatamodelChange:Me,handleDatabaseChange:le,handleSchemaChange:oe}}function We({ColumnsComponent:t}){var G;const r=e.useEditorStore(T=>T.selectedConnectionId),s=e.useEditorStore(T=>T.selectedDatamodelId),n=e.useEditorStore(T=>T.selectedDatabaseName),o=e.useEditorStore(T=>T.selectedSchemaName),u=e.useEditorStore(T=>T.selectedTableName),a=e.useEditorStore(T=>T.actions.setSelectedTableName),{connectionItems:l,modelItems:c,schemaItems:p,databaseItems:m,tableItems:f,columns:j,isConnectionsLoading:x,isModelsLoading:d,isConnectionsError:E,isModelsError:h,isDatabasesLoadingOrFetching:R,isDatabaseError:k,isSchemaLoadingOrFetching:g,isSchemaError:A,isColumnsError:I,isColumnsLoadingOrFetching:z,isTableLoadingOrFetching:w,isTableError:y,connectionType:C,isNonDbConnection:L,handleConnectionChange:M,handleDatabaseChange:D,handleSchemaChange:F,handleDatamodelChange:_,tableName:B,schemaName:K}=ae();function q(){return t?t(K,B,j):e.jsxRuntimeExports.jsx($t,{schemaName:K,tableName:B,columns:j,status:z?"Loading...":I?"Error":"Success"})}function Q(){window.location.href="mailto:support@semaphor.cloud?subject=Help&body=I need help with..."}function v(){if(!r||C==="S3"||C==="API")return null;if(!s||s==="none")return e.jsxRuntimeExports.jsx(de,{showNone:!0,onChange:D,isError:k,isLoading:R,items:m,value:n||"",title:"Database"})}function S(){if(r&&!L&&(!n||n==="none")&&(!s||s==="none"))return e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3",children:[e.jsxRuntimeExports.jsx("div",{className:"col-span-1 grid place-items-center",children:e.jsxRuntimeExports.jsx(e.Separator,{})}),e.jsxRuntimeExports.jsx("div",{className:"col-span-1 grid place-items-center",children:e.jsxRuntimeExports.jsx(e.Label,{children:"OR"})}),e.jsxRuntimeExports.jsx("div",{className:"col-span-1 grid place-items-center",children:e.jsxRuntimeExports.jsx(e.Separator,{})})]})}function N(){if(!r||C==="S3"||C==="API")return null;if(!n||n==="none")return e.jsxRuntimeExports.jsx(de,{showNone:!0,onChange:_,isError:h,isLoading:d,items:c,value:s||"",title:"Model"})}function O(){return!r||C==="S3"||C==="API"||!n||n==="none"?null:e.jsxRuntimeExports.jsx(de,{onChange:F,isError:A,isLoading:g,items:p,value:o||"",title:"Schema"})}function te(){function T(){let H=!1;return C==="API"?(H=!1,H):((C==="S3"||r&&n&&n!=="none"&&o)&&(H=!0),H)}return T()?e.jsxRuntimeExports.jsx(de,{onChange:a,isError:y,items:f,isLoading:w,value:u||"",title:"Table"}):null}return e.jsxRuntimeExports.jsxs("aside",{className:"xbg-red-100 flex grow flex-col justify-between",children:[e.jsxRuntimeExports.jsxs("section",{className:"space-y-3 px-6 py-4",children:[e.jsxRuntimeExports.jsx(de,{items:l,title:"Connection",value:r||"",onChange:M,isLoading:x,isError:E,connectionTooltip:((G=l==null?void 0:l.find(T=>T.id===r))==null?void 0:G.type)||""}),N(),S(),v(),O(),te()]}),q(),e.jsxRuntimeExports.jsx("div",{className:"flex items-end justify-center gap-2 px-6 py-4",children:e.jsxRuntimeExports.jsxs(e.Button,{onClick:Q,size:"sm",variant:"secondary",className:"w-full",children:[e.jsxRuntimeExports.jsx(wt,{className:"mr-2 size-4"}),"Help"]})})]})}function Gt(t){const r=t.toUpperCase().indexOf("WHERE"),s=t.toUpperCase().indexOf("GROUP BY"),n=t.toUpperCase().indexOf("LIMIT"),o=t.toUpperCase().indexOf("ORDER BY");let u=t.length;if(o!==-1&&(u=o),n!==-1&&n<u&&(u=n),r!==-1){const a=t.substring(0,r),l=t.substring(r);return`${a} {{ filters | where }} AND ${l.substring(6)}`}else if(s!==-1){const a=t.substring(0,s),l=t.substring(s);return`${a} {{ filters | where }} ${l}`}else{const a=t.substring(0,u),l=t.substring(u);return`${a} {{ filters | where }} ${l}`}}function Kt({error:t,setShowAIDialog:r,setUserInputforAI:s,setTriggerAIRun:n}){return e.jsxRuntimeExports.jsxs(e.HoverCard,{openDelay:0,children:[e.jsxRuntimeExports.jsx(e.HoverCardTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.Button,{variant:"link",className:"h-5 p-0",children:e.jsxRuntimeExports.jsx(ft,{className:"h-4 w-4 text-red-500"})})}),e.jsxRuntimeExports.jsx(e.HoverCardContent,{align:"start",className:"min-w-fit max-w-[500px]",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxRuntimeExports.jsxs("div",{className:"flex grow flex-col space-y-2",children:[e.jsxRuntimeExports.jsx(e.ScrollArea,{className:"max-h-[250px] min-h-0 overflow-scroll",children:e.jsxRuntimeExports.jsx("p",{className:"overflow-auto rounded-md bg-muted p-2 text-xs leading-relaxed",children:t})}),e.jsxRuntimeExports.jsxs(e.Button,{onClick:()=>{r(!0),s(t),n(!0)},size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(St,{className:"mr-2 h-4 w-4"}),"Debug with AI"]})]})})})]})}function Qt({text:t,onCheckedChange:r,checked:s}){return e.jsxRuntimeExports.jsxs("div",{className:"xbg-red-100 ml-6 flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Checkbox,{checked:s,onCheckedChange:r}),e.jsxRuntimeExports.jsx("label",{className:"text-xs leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:t})]})}function Jt(){const{authToken:t}=e.useSemaphorContext(),r=e.useEditorStore(u=>u.selectedConnectionId),{data:s}=e.useQuery({queryKey:["connections"],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/connections",(t==null?void 0:t.accessToken)||""),enabled:!!(t!=null&&t.accessToken)}),n=s==null?void 0:s.connections.find(u=>u.id===r);return n==null?void 0:n.type}function Ut(){const{authToken:t}=e.useSemaphorContext(),r=b.useRef(null),s=e.useEditorStore(c=>c.applyFilters),[n,o]=b.useState(""),u=e.useEditorStore(c=>c.filterValues),a=e.useEditorStore(c=>c.card.sql),l=Jt();return e.jsxRuntimeExports.jsxs(e.HoverCard,{openDelay:0,onOpenChange:async c=>{if(!c)return;console.log("onOpenChange");const p=await e.postRequest("https://semaphor.cloud/api/v1/filter-sql",(t==null?void 0:t.accessToken)||"",{sql:a,active_filters:u,connection_type:l});console.log(p),p.sql?(console.log(p.records),o(p.sql)):o("Error")},children:[e.jsxRuntimeExports.jsx(e.HoverCardTrigger,{asChild:!0,children:s&&e.jsxRuntimeExports.jsx("p",{className:"p-0 text-xs hover:cursor-pointer",children:"|  Filter Query"})}),e.jsxRuntimeExports.jsxs(e.HoverCardContent,{align:"end",className:"w-[600px]",children:[e.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxRuntimeExports.jsx("div",{className:"rounded-sm bg-muted p-2",children:e.jsxRuntimeExports.jsxs("code",{ref:r,className:"font-mono text-sm",children:[n,e.jsxRuntimeExports.jsx(e.ClipboardCopyIcon,{onClick:()=>e.copyToClipboard(r),className:"ml-3 inline-block h-4 w-4 opacity-70 hover:cursor-pointer hover:opacity-100"})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsx(e.InfoCircledIcon,{className:"h-4 w-4 opacity-70"}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-muted-foreground",children:"A preview of the query with filters applied."})]})]})]})}const Wt=`
162
-
163
- Use the following syntax to create a chart query. Please replace the x-axis, y-axis, stack-by, label, and measure with the actual column names of the table.
164
-
165
- Bar / Line Chart:
166
-
167
- SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table
168
-
169
- - X-axis - Category
170
- - Y-axis - Number
171
-
172
- Stacked Chart:
173
-
174
- SELECT x-axis, stack-by, y-axis FROM table
175
-
176
- - X-axis - Category
177
- - Stack by - Category
178
- - Y-axis - Number
179
-
180
-
181
- Scatter Chart:
182
-
183
- SELECT label, x-axis, y-axis FROM table
184
-
185
- - Label - Category
186
- - Group (opt) - Category
187
- - X-axis - Number
188
- - Y-axis - Number
189
-
190
-
191
- Bubble Chart:
192
-
193
- SELECT label, x-axis, y-axis, radius FROM table
194
-
195
- - Label - Category
196
- - Bubble Group (opt) - Category
197
- - X-axis - Number
198
- - Y-axis - Number
199
- - Radius - Number
200
-
201
- Pie / Dougnut Chart:
202
-
203
- SELECT label, measure FROM table
204
-
205
- - Label - Category
206
- - Measure - Number
207
- `;function Yt({open:t,setOpen:r,userInput:s,setUserInput:n,triggerAIRun:o,setTriggerAIRun:u}){const a=b.useRef(null),l=b.useRef(null),{authToken:c}=e.useSemaphorContext(),[p,m]=b.useState(!1),f=e.useEditorStore(v=>v.actions.setCardSql),j=e.useDashboardStore(v=>v.dashboard.baseQueries),x=e.useEditorStore(v=>v.actions.setRunSql),d=e.useEditorStore(v=>v.actions.setCardType),[E,h]=b.useState([]),R=e.useEditorStore(v=>v.currentColumns),k=e.useEditorStore(v=>v.card.sql),g=e.useEditorStore(v=>v.selectedTableName),A=`
208
- ${s}
209
-
210
- Database Query Dialect: ${g==="api"||g==="s3"?"DuckDb":""}
211
- Table Name: ${g}
212
- Table Columns: ${R==null?void 0:R.map(v=>`${v.column_name} | ${v.data_type}`).join(", ")}
213
- User SQL: ${k}
214
- ${j&&`Base Queries: ${JSON.stringify(j)} `}`,I=` When the user asks for a specific chart please use the following query structure to generate the chart query. Do not make up the column names. Use only the table columns provided above for the query. Replace x-axis, y-axis, and lables with the appropriate column names.
215
- Visual Query Syntax: ${Wt}`,{data:z,isLoading:w,isFetching:y,isError:C,refetch:L}=e.useQuery({queryKey:["ai-query"],queryFn:()=>e.getRequest("https://semaphor.cloud/api/v1/ai",(c==null?void 0:c.accessToken)||"",{user_content:`userContent: ${A} ${p?I:""}`}),enabled:!1});function M(v){if(v.toLowerCase().includes("bar"))d("bar");else if(v.toLowerCase().includes("line"))d("line");else if(v.toLowerCase().includes("bubble"))d("bubble");else if(v.toLowerCase().includes("scatter"))d("scatter");else if(v.toLowerCase().includes("stacked"))d("stackedBar");else if(v.toLowerCase().includes("pie"))d("pie");else if(v.toLowerCase().includes("donut")||v.toLowerCase().includes("doughnut"))d("doughnut");else if(v.toLowerCase().includes("radar"))d("radar");else return d("bar"),!1;return!0}b.useEffect(()=>{z&&h(v=>[...v,{role:"ai",content:z.response}])},[z]),b.useEffect(()=>{const v=setTimeout(()=>{var S;l.current&&(l.current.scroll({top:l.current.scrollHeight,behavior:"smooth"}),(S=a.current)==null||S.focus())},100);return()=>clearTimeout(v)},[E]);function D(){s&&(h(v=>[...v,{role:"user",content:s}]),M(s)&&m(!0),n(""),L())}b.useEffect(()=>{o&&(D(),u(!1))},[o,u]);const F={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,width:"100%"},_={fontFamily:"monospace",fontSize:14,lineHeight:1.6},B={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,padding:"2px 0",marginLeft:20,listStyleType:"disc"},K={p:({node:v,...S})=>e.jsxRuntimeExports.jsx("p",{style:F,...S}),code:({node:v,...S})=>e.jsxRuntimeExports.jsx("code",{className:"rounded-sm bg-muted px-2 py-1 text-sm",...S}),pre:({node:v,...S})=>e.jsxRuntimeExports.jsxs("pre",{className:"space-y-2 rounded-sm bg-muted/50 p-3",style:_,children:[e.jsxRuntimeExports.jsx("code",{className:"whitespace-normal text-sm",children:S.children}),e.jsxRuntimeExports.jsxs("div",{className:"flex justify-start gap-2",children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:q,size:"sm",variant:"outline",children:e.jsxRuntimeExports.jsx(e.ClipboardCopyIcon,{})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:N=>{const O=q(N);O&&(r(!1),f(O),x(!0))},size:"sm",variant:"outline",children:e.jsxRuntimeExports.jsx(e.PlayIcon,{})})]})]}),li:({node:v,...S})=>e.jsxRuntimeExports.jsx("li",{style:B,...S})};function q(v){const S=v.currentTarget.closest("pre");if(!S)return;const N=S.textContent||S.innerText;return navigator.clipboard.writeText(N).then(()=>console.log("Text copied to clipboard")).catch(O=>console.error("Error in copying text: ",O)),N}function Q(){return E==null?void 0:E.map((v,S)=>v.role==="user"?e.jsxRuntimeExports.jsxs("div",{className:"flex items-start rounded-md bg-muted p-3 text-sm",children:[e.jsxRuntimeExports.jsx(qt,{className:"mr-2 h-5 w-5"}),e.jsxRuntimeExports.jsx("div",{children:v.content})]},S):v.role==="ai"?e.jsxRuntimeExports.jsx(e.Markdown,{className:"w-full overflow-auto py-1",components:K,children:z==null?void 0:z.response.replace(/DuckDB/gi,"Semaphor")},S):e.jsxRuntimeExports.jsx("div",{},S))}return e.jsxRuntimeExports.jsxs(e.Dialog,{open:t,onOpenChange:r,children:[e.jsxRuntimeExports.jsx(e.DialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.Button,{size:"sm",className:"w-full justify-start border font-normal text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0",variant:"secondary",children:"Type your question here..."})}),e.jsxRuntimeExports.jsxs(e.DialogContent,{className:"flex flex-col justify-between overflow-auto sm:max-w-[425px] md:max-h-[625px] md:min-w-[625px]",children:[e.jsxRuntimeExports.jsxs(e.DialogHeader,{children:[e.jsxRuntimeExports.jsx(e.DialogTitle,{children:"Assistant"}),e.jsxRuntimeExports.jsx(e.DialogDescription,{children:"What can I help you with?"})]}),e.jsxRuntimeExports.jsx("div",{ref:l,className:"h-[625px] w-full overflow-auto border-t border-t-muted",children:e.jsxRuntimeExports.jsx("div",{className:"space-y-4 py-2 pr-3",role:"messages",children:Q()})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center rounded-md border",children:[e.jsxRuntimeExports.jsx(e.Textarea,{autoFocus:!0,ref:a,onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),n(""),D())},placeholder:"Type your question here...",onFocus:v=>{const S=v.target,N=S.value.length;S.setSelectionRange(N,N)},className:e.cn("max-h-10 min-h-7 resize-none border-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"),disabled:w||y,value:s,onChange:v=>n(v.target.value)})," ",e.jsxRuntimeExports.jsx(e.Button,{className:"h-8",size:"sm",variant:"ghost",onClick:D,children:!w&&!y?e.jsxRuntimeExports.jsx(e.PaperPlaneIcon,{}):e.jsxRuntimeExports.jsx(me,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"})})]})})]})]})}var Ye={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ve=b.createContext&&b.createContext(Ye),Xt=["attr","size","title"];function Zt(t,r){if(t==null)return{};var s=es(t,r),n,o;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);for(o=0;o<u.length;o++)n=u[o],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function es(t,r){if(t==null)return{};var s={},n=Object.keys(t),o,u;for(u=0;u<n.length;u++)o=n[u],!(r.indexOf(o)>=0)&&(s[o]=t[o]);return s}function ve(){return ve=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},ve.apply(this,arguments)}function _e(t,r){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),s.push.apply(s,n)}return s}function Ce(t){for(var r=1;r<arguments.length;r++){var s=arguments[r]!=null?arguments[r]:{};r%2?_e(Object(s),!0).forEach(function(n){ts(t,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):_e(Object(s)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(s,n))})}return t}function ts(t,r,s){return r=ss(r),r in t?Object.defineProperty(t,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[r]=s,t}function ss(t){var r=rs(t,"string");return typeof r=="symbol"?r:String(r)}function rs(t,r){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var n=s.call(t,r||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function Xe(t){return t&&t.map((r,s)=>b.createElement(r.tag,Ce({key:s},r.attr),Xe(r.child)))}function ee(t){return r=>b.createElement(ns,ve({attr:Ce({},t.attr)},r),Xe(t.child))}function ns(t){var r=s=>{var{attr:n,size:o,title:u}=t,a=Zt(t,Xt),l=o||s.size||"1em",c;return s.className&&(c=s.className),t.className&&(c=(c?c+" ":"")+t.className),b.createElement("svg",ve({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},s.attr,n,a,{className:c,style:Ce(Ce({color:t.color||s.color},s.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),u&&b.createElement("title",null,u),t.children)};return Ve!==void 0?b.createElement(Ve.Consumer,null,s=>r(s)):r(Ye)}function os(t){return ee({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z"},child:[]}]})(t)}function is(){const{theme:t}=e.useTheme(),r=b.useRef(),s=b.useRef(),[n,o]=b.useState(!1),[u,a]=b.useState(!1),[l,c]=b.useState(!1),[p,m]=b.useState(""),[f,j]=b.useState(!1),{authToken:x}=e.useSemaphorContext();e.useDashboardStore(i=>i.selectedSheetId);const d=e.useDashboardStore(i=>i.dashboard.baseQueries),E=e.useEditorStore(i=>i.card),h=e.useDashboardStore(i=>i.theme),R=e.useEditorStore(i=>i.isShowingVisual),k=e.useEditorStore(i=>i.selectedConnectionId),g=e.useEditorStore(i=>i.selectedDatabaseName),A=e.useEditorStore(i=>i.selectedDatamodelId),I=e.useEditorStore(i=>i.selectedSchemaName);e.useDashboardStore(i=>i.actions.updateFrameCard);const z=e.useEditorStore(i=>i.selectedTableName),w=e.useEditorStore(i=>i.card.sql),y=e.useEditorStore(i=>i.card.python),C=e.resolveBaseQuery(w,d),L=e.useEditorStore(i=>i.selectedConnectionId),M=e.useEditorStore(i=>i.frame),D=e.useDashboardStore(i=>i.filterValues),F=e.useEditorStore(i=>i.applyFilters),{setCardCustomCfg:_,setQueryResultColumns:B,setFilterValues:K,setCardSql:q,setCardPython:Q,setQueryError:v,setPythonStdOut:S,setCardPreferences:N}=e.useEditorStore(i=>i.actions),O=e.useEditorStore(i=>i.onSave),te=e.useEditorStore(i=>i.actions.setApplyFilters),G=e.useEditorStore(i=>i.onClose),T=e.useEditorStore(i=>i.actions.setCardData),H=e.useEditorStore(i=>i.actions.setSqlGen),$=e.useEditorStore(i=>i.runSql),ne=e.useEditorStore(i=>i.actions.setRunSql),se=e.useEditorStore(i=>i.actions.setIsSqlRunning),{data:V,isLoading:J,isFetching:U,isSuccess:oe,isError:le,error:he,status:Me,refetch:ce}=e.useQuery({queryKey:[C,y],queryFn:()=>e.postRequest("https://semaphor.cloud/api/v1/query",(x==null?void 0:x.accessToken)||"",{connection_id:L,sql:C,python:y===e.PYTHON_DEFAULT_CODE?"":y,active_filters:F?D:[]}),enabled:!1,retry:!1});b.useEffect(()=>{if(V&&(T(V.records),V.rowLimitExceeded&&e.Jt.error("Row limit (10,000) exceeded. Refine your query.",{position:"top-center",richColors:!0}),S((V==null?void 0:V.output)||""),V.records.length>0)){const{dimensionKeys:i}=e.getKeys(V.records);B(i)}},[V,T,B,S]),b.useEffect(()=>{$&&(ce(),ne(!1))},[$,ce,ne]),b.useEffect(()=>{(J||U)&&se(!0),(le||oe)&&se(!1),le?(v(he.message),T([]),B([]),S("")):v("")},[J,U,V,S,le,oe,se,T,B,v,he]);function ke(){q(""),T([]),H({}),_(""),N({})}const fe=i=>{s.current=i};function we(){let i=w;w&&!w.includes("{{")&&(i=Gt(w),q(i));const W={...E,lastSelectedSchema:I,lastSelectedDatamodelId:A,lastSelectedDatabase:g,lastSelectedTable:z,connectionId:k,type:R?E.type:"table",sql:i,customCfg:R?E.customCfg:null},Ee=M.cards.map(ie=>ie.id===E.id?W:ie);O==null||O({...M,cards:Ee})}function De(){G==null||G()}function ge(i){const W=getComputedStyle(document.documentElement).getPropertyValue(i);return Re(W)}function Re(i){const[W,Ee,ie]=i.split(" "),P=parseFloat(W),ut=parseFloat(Ee),dt=parseFloat(ie),mt=ut/100,qe=dt/100,re=(1-Math.abs(2*qe-1))*mt,xe=re*(1-Math.abs(P/60%2-1)),Ae=qe-re/2;let Y=0,X=0,Z=0;0<=P&&P<60?(Y=re,X=xe,Z=0):60<=P&&P<120?(Y=xe,X=re,Z=0):120<=P&&P<180?(Y=0,X=re,Z=xe):180<=P&&P<240?(Y=0,X=xe,Z=re):240<=P&&P<300?(Y=xe,X=0,Z=re):300<=P&&P<360&&(Y=re,X=0,Z=xe),Y=Math.round((Y+Ae)*255),X=Math.round((X+Ae)*255),Z=Math.round((Z+Ae)*255);const Ie=pt=>{const Te=pt.toString(16);return Te.length==1?"0"+Te:Te};return`#${Ie(Y)}${Ie(X)}${Ie(Z)}`}b.useEffect(()=>{const i=r.current,W=s.current;if(i){const Ee=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",ie=h==="system"?Ee:h;i.editor.defineTheme("default",{base:ie==="light"?"vs":"vs-dark",inherit:!0,rules:[],colors:{"editor.background":ie==="light"?"#ffffff":ge("--semaphor-background")}}),i.editor.setTheme("default")}return W&&i&&W.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,function(){return console.log("Executing query..."),ce(),!1}),()=>{}},[t,h,r.current]);function je(i){r.current=i}function be(){return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[u&&e.jsxRuntimeExports.jsx("div",{className:"xbg-yellow-100 relative flex w-1/3 min-w-0 grow overflow-hidden border-l p-1 text-xs",role:"editor-filter-container",children:e.jsxRuntimeExports.jsxs("div",{className:"w-[99%]",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[e.jsxRuntimeExports.jsx(Qt,{checked:F,onCheckedChange:()=>te(!F),text:"Apply Filters"}),e.jsxRuntimeExports.jsx(Ut,{}),D&&u&&e.jsxRuntimeExports.jsx(e.Cross2Icon,{onClick:()=>a(!1),className:"bg-background/50 text-foreground/50 hover:cursor-pointer hover:text-foreground"})]}),e.jsxRuntimeExports.jsx(e.Ft,{theme:"default",onChange:i=>{if(i)try{JSON.parse(i),K(JSON.parse(i))}catch{}},defaultLanguage:"json",className:"mt-1 min-h-[220px]",value:JSON.stringify(D,null,2),options:{readOnly:!0,minimap:{enabled:!1},lineNumbers:"off",glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}),D&&!u&&e.jsxRuntimeExports.jsx(e.Filter,{onClick:()=>a(!0),className:e.cn("absolute bottom-4 right-6 h-3 w-3 text-foreground/50 hover:cursor-pointer hover:text-foreground",{"font-bold text-red-800":F})})]})}function Se(){return e.jsxRuntimeExports.jsxs(e.ResizablePanelGroup,{className:"flex grow pb-1",direction:"vertical",role:"editor-resizable-group",children:[e.jsxRuntimeExports.jsxs(e.ResizablePanel,{id:"1",order:1,defaultSize:n?20:100,className:"relative flex grow",children:[e.jsxRuntimeExports.jsx("div",{role:"sql-container",className:"relative flex w-[99%]",children:e.jsxRuntimeExports.jsx(e.Ft,{theme:"default",className:"pt-3",onChange:i=>{q(i)},value:w,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"sql",beforeMount:je,onMount:fe})}),n&&e.jsxRuntimeExports.jsx("code",{className:"absolute right-6 top-3 text-sm text-muted-foreground/70",children:"sql"})]}),n&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.ResizableHandle,{withHandle:!0,className:"border"}),e.jsxRuntimeExports.jsxs(e.ResizablePanel,{id:"2",order:2,defaultSize:80,className:"relative flex grow",children:[e.jsxRuntimeExports.jsx("div",{role:"python-container",className:"relative flex w-[99%] pt-0",children:e.jsxRuntimeExports.jsx(e.Ft,{className:"pt-3",theme:"default",onChange:i=>{Q(i&&i.trim()||"")},value:y||e.PYTHON_DEFAULT_CODE,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"python",beforeMount:je,onMount:fe})}),e.jsxRuntimeExports.jsx("code",{className:"absolute right-6 top-3 text-sm text-muted-foreground/70",children:"python"})]})]})]})}return e.jsxRuntimeExports.jsxs("section",{role:"editor-section",className:"flex grow flex-col justify-end",children:[e.jsxRuntimeExports.jsxs("div",{role:"sql-editor",className:"relative flex grow justify-between overflow-y-scroll",children:[Se(),be()]}),e.jsxRuntimeExports.jsxs("div",{role:"editor-controls",className:"item-center flex flex-wrap justify-between gap-2 px-6 py-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex grow items-center gap-2",children:[e.jsxRuntimeExports.jsxs(e.Button,{title:"Shift + Enter",disabled:J||U,onClick:()=>{ce()},className:"shrink-0",size:"sm",variant:"outline",children:[J||U?e.jsxRuntimeExports.jsx(me,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"}):e.jsxRuntimeExports.jsx(At,{className:"mr-2 h-4 w-4"}),"Run"]}),le&&e.jsxRuntimeExports.jsx(Kt,{error:he.message,setShowAIDialog:c,setTriggerAIRun:j,setUserInputforAI:m}),e.jsxRuntimeExports.jsxs(e.Button,{onClick:ke,className:"",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(Rt,{className:"mr-2 size-4"}),"Clear"]}),e.jsxRuntimeExports.jsx(e.Toggle,{pressed:n,onPressedChange:i=>o(i),className:"",size:"sm",variant:"outline",children:e.jsxRuntimeExports.jsx(os,{className:"size-4 text-foreground/70"})}),e.jsxRuntimeExports.jsx(Yt,{open:l,setOpen:c,userInput:p,triggerAIRun:f,setTriggerAIRun:j,setUserInput:i=>m(i)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-end gap-2",children:[e.jsxRuntimeExports.jsxs(e.Button,{onClick:we,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(e.Check,{className:"mr-2 size-4 font-bold text-green-600"}),"Accept"]}),e.jsxRuntimeExports.jsxs(e.Button,{onClick:De,className:"w-full",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(e.Cross2Icon,{className:"mr-2 size-4"}),"Close"]})]})]})]})}function as({data:t}){var a;const[r,s]=b.useState([]),o=Object.keys(t[0]).map(l=>({accessorKey:l,header:({column:c})=>{const p=c.getIsSorted();return e.jsxRuntimeExports.jsx("div",{className:"flex gap-2",children:e.jsxRuntimeExports.jsxs("div",{className:"flex cursor-pointer items-center",onClick:()=>c.toggleSorting(c.getIsSorted()==="asc"),children:[l,p==="asc"?e.jsxRuntimeExports.jsx(e.TriangleUpIcon,{className:"ml-2 h-5 w-5"}):p==="desc"?e.jsxRuntimeExports.jsx(e.TriangleDownIcon,{className:"ml-2 h-5 w-5"}):null]})})}})),u=e.useReactTable({data:t,columns:o,getCoreRowModel:e.getCoreRowModel(),getPaginationRowModel:e.getPaginationRowModel(),onSortingChange:s,getSortedRowModel:e.getSortedRowModel(),manualPagination:!0,state:{sorting:r}});return e.jsxRuntimeExports.jsxs(e.Table$1,{children:[e.jsxRuntimeExports.jsx(e.TableHeader,{children:u.getHeaderGroups().map(l=>e.jsxRuntimeExports.jsx(e.TableRow,{children:l.headers.map(c=>e.jsxRuntimeExports.jsx(e.TableHead,{className:"sticky top-0 bg-muted",children:c.isPlaceholder?null:e.flexRender(c.column.columnDef.header,c.getContext())},c.id))},l.id))}),e.jsxRuntimeExports.jsx(e.TableBody,{children:(a=u.getRowModel().rows)!=null&&a.length?u.getRowModel().rows.map(l=>e.jsxRuntimeExports.jsx(e.TableRow,{className:"whitespace-nowrap py-2","data-state":l.getIsSelected()&&"selected",children:l.getVisibleCells().map(c=>e.jsxRuntimeExports.jsx(e.TableCell,{children:e.flexRender(c.column.columnDef.cell,c.getContext())},c.id))},l.id)):e.jsxRuntimeExports.jsx(e.TableRow,{children:e.jsxRuntimeExports.jsx(e.TableCell,{colSpan:o.length,className:"h-24 text-center",children:"No results."})})})]})}function Ze({showCard:t,className:r,...s}){var x;b.useState(0);const n=e.useDashboardStore(d=>d.themeStyle),o=e.useEditorStore(d=>d.card),u=e.useEditorStore(d=>d.frame),a=e.useDashboardStore(d=>d.dashboard.filters),l=e.useDashboardStore(d=>d.filterValues),c=e.useEditorStore(d=>d.actions.setRunSql),{updateFilter:p}=e.useDashboardActions(),m=a==null?void 0:a.find(d=>d.id===u.filterId),f=e.useEditorStore(d=>d.actions.setCard);if(b.useEffect(()=>{c(!0)},[l]),b.useEffect(()=>{},[o.data,o.type,o.cfg,o.customCfg,n,o.preferences]),!o.id)return null;let j;return o.data&&o.data.length>0&&(j=e.createChartConfig({data:o.data,cardType:o.type,cfg:o.cfg,customCfg:o.customCfg,preferences:o.preferences})),e.jsxRuntimeExports.jsxs(e.Card,{role:"editor-visual-card",className:e.cn("relative flex h-full flex-col rounded-none",r),...s,children:[e.jsxRuntimeExports.jsxs(e.CardHeader,{className:"flex flex-row items-start justify-between py-4",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.Editable,{text:o.title,onSave:d=>f({...o,title:d}),children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:e.jsxRuntimeExports.jsx(e.CardTitle,{className:"text-base",children:o.title})})},o.title),e.jsxRuntimeExports.jsx(e.Editable,{text:o.description||"",onSave:d=>f({...o,description:d}),children:e.jsxRuntimeExports.jsxs(e.CardDescription,{children:[" ",o.description]})},o.description)]}),m&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxRuntimeExports.jsx(e.Editable,{className:"my-1",text:m.title||m.column,onSave:d=>p({...m,title:d}),children:e.jsxRuntimeExports.jsx(e.Label,{children:m.title})}),e.getFilterComponent(m)]})]}),e.jsxRuntimeExports.jsxs(e.CardContent,{className:"flex grow flex-col pb-3",children:[o.type!=="table"&&j&&e.jsxRuntimeExports.jsx(e.ChartJsVisual,{cfg:j},JSON.stringify(j)+JSON.stringify(o.preferences)+((x=o==null?void 0:o.preferences)==null?void 0:x.customVisualCode)),o.type==="table"&&o.data&&o.data.length>0&&e.jsxRuntimeExports.jsx(e.$57acba87d6e25586$export$ccf8d8d7bbf3c2cc,{className:"flex min-h-0 flex-1 grow basis-0",children:e.jsxRuntimeExports.jsx(e.TableVisual,{card:o,data:o==null?void 0:o.data})})]})]})}function ls(){const[t,r]=b.useState(!1),[s,n]=b.useState(""),[o,u]=b.useState(""),[a,l]=b.useState(""),[c,p]=b.useState(""),m=e.useEditorStore(g=>g.card),f=e.useEditorStore(g=>g.card.customCfg),{setCardCustomCfg:j,setCustomVisualCode:x}=e.useEditorActions();function d(g){var z,w;const A={...g,data:{...g==null?void 0:g.data,datasets:(w=(z=g==null?void 0:g.data)==null?void 0:z.datasets)==null?void 0:w.map(y=>({...y,data:[]}))}};return JSON.stringify(A,null,1)}function E(){var A,I;if(!m.data||m.data.length===0)return;const g=e.createChartConfig({data:m.data,cardType:m.type,cfg:m.cfg,preferences:m.preferences});g&&(n(JSON.stringify(g,null,1)),(A=m==null?void 0:m.preferences)!=null&&A.customVisualCode&&l((I=m==null?void 0:m.preferences)==null?void 0:I.customVisualCode),f&&u(JSON.stringify(f,null,1)))}function h(){if(a&&x(a),!!o)try{const g=JSON.parse(o);return g?(j(g),p(""),u(""),g):void 0}catch(g){console.log(g),p("Invalid JSON")}}function R(){u(""),j(null)}function k(){let g;if(f){const A=e._.cloneDeep(m.cfg),I=e._.merge(A,f);return g=d(I),g}return s?(g=d(JSON.parse(s)),g):""}return e.jsxRuntimeExports.jsxs(e.Dialog,{open:t,onOpenChange:r,children:[e.jsxRuntimeExports.jsx(e.DialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.Button,{onClick:E,className:` ${f&&"border-foreground/50 dark:border-foreground/70"}`,size:"sm",variant:"outline",children:e.jsxRuntimeExports.jsx(e.Settings,{className:"h-4 w-4"})})}),e.jsxRuntimeExports.jsxs(e.DialogContent,{className:"max-h-[70vh] min-h-[70vh] overflow-auto sm:min-w-[900px] lg:min-w-[1200px]",children:[e.jsxRuntimeExports.jsxs(e.DialogHeader,{className:"",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.DialogTitle,{children:"Customize Card"}),e.jsxRuntimeExports.jsxs(e.Tooltip,{children:[e.jsxRuntimeExports.jsx(e.TooltipTrigger,{children:e.jsxRuntimeExports.jsx(vt,{onClick:()=>{navigator.clipboard.writeText(m.id)},className:"size-3 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsxRuntimeExports.jsx(e.TooltipContent,{side:"right",align:"center",children:e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:"Copy Card ID"})})]})]}),e.jsxRuntimeExports.jsxs(e.DialogDescription,{children:["See the configuration options and documentation",e.jsxRuntimeExports.jsx("a",{target:"_blank",className:"ml-1 text-blue-500 underline",href:"https://www.chartjs.org/docs/latest/samples/bar/vertical.html",children:"here."})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex grow gap-2",children:[e.jsxRuntimeExports.jsx(Ze,{className:"w-1/2 rounded shadow-none"}),e.jsxRuntimeExports.jsxs(e.Tabs,{defaultValue:"custom-config",className:"flex w-1/2 flex-col",children:[e.jsxRuntimeExports.jsxs(e.TabsList,{className:"justify-start rounded-sm rounded-b-none border border-b-0",children:[e.jsxRuntimeExports.jsxs(e.TabsTrigger,{value:"custom-config",children:[f&&e.jsxRuntimeExports.jsx(e.CheckIcon,{className:"mr-1 h-5 w-5 text-green-600"}),f?"Custom Config":"Default Config"]}),e.jsxRuntimeExports.jsx(e.TabsTrigger,{className:"",value:"output",children:"Output"}),e.jsxRuntimeExports.jsx(e.TabsTrigger,{className:"",value:"custom-code",children:"Custom Code"})]}),e.jsxRuntimeExports.jsx(e.TabsContent,{className:"bg-red-x mt-0 grow rounded-b border border-t-0 p-2",value:"output",children:e.jsxRuntimeExports.jsx(e.Textarea,{disabled:!0,value:s,className:"h-full resize-none border-none font-mono focus-visible:ring-0 focus-visible:ring-offset-0"})}),e.jsxRuntimeExports.jsx(e.TabsContent,{className:"mt-0 grow rounded-b border border-t-0",value:"custom-config",children:e.jsxRuntimeExports.jsx(e.Ft,{className:"h-full w-full overflow-hidden",theme:"default",options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"json",value:k(),onChange:g=>u(g)})}),e.jsxRuntimeExports.jsx(e.TabsContent,{className:"mt-0 grow rounded-b border border-t-0",value:"custom-code",children:e.jsxRuntimeExports.jsx(e.Ft,{className:"h-full w-full overflow-hidden",theme:"default",options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"javascript",value:a,onChange:g=>l(g||"")})})]})]}),e.jsxRuntimeExports.jsxs(e.DialogFooter,{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(e.Label,{className:"mr-2 text-red-500",children:c}),e.jsxRuntimeExports.jsx(e.Button,{disabled:!f,onClick:R,variant:"outline",children:"Reset"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:h,variant:"outline",children:"Apply"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>r(!1),variant:"outline",children:"Close"})]})]})]})}function et(t){return ee({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M926.8 397.1l-396-288a31.81 31.81 0 0 0-37.6 0l-396 288a31.99 31.99 0 0 0-11.6 35.8l151.3 466a32 32 0 0 0 30.4 22.1h489.5c13.9 0 26.1-8.9 30.4-22.1l151.3-466c4.2-13.2-.5-27.6-11.7-35.8zM838.6 417l-98.5 32-200-144.7V199.9L838.6 417zM466 567.2l-89.1 122.3-55.2-169.2L466 567.2zm-116.3-96.8L484 373.3v140.8l-134.3-43.7zM512 599.2l93.9 128.9H418.1L512 599.2zm28.1-225.9l134.2 97.1L540.1 514V373.3zM558 567.2l144.3-46.9-55.2 169.2L558 567.2zm-74-367.3v104.4L283.9 449l-98.5-32L484 199.9zM169.3 470.8l86.5 28.1 80.4 246.4-53.8 73.9-113.1-348.4zM327.1 853l50.3-69h269.3l50.3 69H327.1zm414.5-33.8l-53.8-73.9 80.4-246.4 86.5-28.1-113.1 348.4z"},child:[]}]})(t)}function tt(t){return ee({tag:"svg",attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M137.39,24.06A16,16,0,0,0,120,40V80.67a15.86,15.86,0,0,0,13.25,15.76A32,32,0,1,1,96,129.68c-.41-8.22,1.27-15,5-20.26h0a15.86,15.86,0,0,0-1.69-20.47L71.69,60.68a16,16,0,0,0-23.63,1.1A103.6,103.6,0,0,0,55,202.05,103.24,103.24,0,0,0,128,232h1.49A104.3,104.3,0,0,0,232,129.48C232.75,75.18,191.19,28.88,137.39,24.06ZM60.32,71.94l27.61,28.19,0,.06A43.29,43.29,0,0,0,80.44,120H40.36A87.13,87.13,0,0,1,60.32,71.94ZM40.37,136h40.3A48,48,0,0,0,120,175.34v40.3A88,88,0,0,1,40.37,136Zm149.77,54.14A87.45,87.45,0,0,1,136,215.61V175.34a47.55,47.55,0,0,0,24.73-12.23A48,48,0,0,0,136,80.66L136,40c45.52,4.08,80.67,43.28,80,89.25A87.45,87.45,0,0,1,190.14,190.14Z"},child:[]}]})(t)}function st(t){return ee({tag:"svg",attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm87.63,96H191.48A64.1,64.1,0,0,0,136,64.52V40.37A88.13,88.13,0,0,1,215.63,120ZM120,120H80.68A48.09,48.09,0,0,1,120,80.68Zm0,16v39.32A48.09,48.09,0,0,1,80.68,136Zm16,0h39.32A48.09,48.09,0,0,1,136,175.32Zm0-16V80.68A48.09,48.09,0,0,1,175.32,120ZM120,40.37V64.52A64.1,64.1,0,0,0,64.52,120H40.37A88.13,88.13,0,0,1,120,40.37ZM40.37,136H64.52A64.1,64.1,0,0,0,120,191.48v24.15A88.13,88.13,0,0,1,40.37,136ZM136,215.63V191.48A64.1,64.1,0,0,0,191.48,136h24.15A88.13,88.13,0,0,1,136,215.63Z"},child:[]}]})(t)}function rt(t){return ee({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},child:[]},{tag:"path",attr:{d:"M6 16m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"},child:[]},{tag:"path",attr:{d:"M16 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M14.5 7.5m-4.5 0a4.5 4.5 0 1 0 9 0a4.5 4.5 0 1 0 -9 0"},child:[]}]})(t)}function nt(t){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m2 19.99 7.5-7.51 4 4 7.09-7.97L22 9.92l-8.5 9.56-4-4-6 6.01-1.5-1.5zm1.5-4.5 6-6.01 4 4L22 3.92l-1.41-1.41-7.09 7.97-4-4L2 13.99l1.5 1.5z"},child:[]}]})(t)}function ot(t){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M4 9h4v11H4zM4 4h4v4H4zM10 7h4v4h-4zM16 10h4v4h-4zM16 15h4v5h-4zM10 12h4v8h-4z"},child:[]}]})(t)}function it(t){return ee({tag:"svg",attr:{version:"1.2",baseProfile:"tiny",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M4 18c-.552 0-1-.448-1-1v-6.382l-.553.276c-.495.248-1.095.046-1.342-.447-.247-.494-.046-1.094.448-1.342l2-1c.31-.155.678-.139.973.044.294.183.474.504.474.851v8c0 .552-.448 1-1 1zM13 18h-5c-.404 0-.769-.244-.924-.617-.155-.374-.069-.804.217-1.09l4-4c.254-.254.394-.591.394-.95 0-.358-.14-.695-.394-.949-.508-.508-1.39-.508-1.9.001-.253.252-.393.589-.393.948 0 .552-.448 1-1 1s-1-.448-1-1c0-.894.348-1.733.98-2.364 1.265-1.263 3.464-1.263 4.727.001.632.631.979 1.471.979 2.363 0 .893-.348 1.733-.979 2.364l-2.293 2.293h2.586c.552 0 1 .448 1 1s-.448 1-1 1zM20.955 12.377c.338-.457.545-1.016.545-1.627 0-1.517-1.234-2.75-2.75-2.75-1.031 0-1.966.569-2.44 1.484-.254.49-.063 1.094.428 1.348.49.254 1.094.062 1.348-.428.128-.249.383-.404.664-.404.414 0 .75.336.75.75s-.336.75-.75.75c-.552 0-1 .448-1 1s.448 1 1 1c.689 0 1.25.561 1.25 1.25s-.561 1.25-1.25 1.25-1.25-.561-1.25-1.25c0-.552-.448-1-1-1s-1 .448-1 1c0 1.792 1.458 3.25 3.25 3.25s3.25-1.458 3.25-3.25c0-.939-.406-1.779-1.045-2.373z"},child:[]}]})(t)}function at(t){return ee({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M217 25v14h78V25h-78zm0 32v46h14V71h50v32h14V57h-78zm32 32v14h14V89h-14zm-64 32v46h30v-46h-30zm48 0v14h46v-14h-46zm64 0v46h30v-46h-30zm-64 32v14h46v-14h-46zm-80 32v46h62v-46h-62zm80 0v14h46v-14h-46zm64 0v46h62v-46h-62zm-64 32v14h46v-14h-46zm-112 32v46h94v-46h-94zm112 0v14h46v-14h-46zm64 0v46h94v-46h-94zm-64 32v14h46v-14h-46zM89 313v46h126v-46H89zm144 0v14h46v-14h-46zm64 0v46h126v-46H297zm-64 32v14h46v-14h-46zM57 377v46h158v-46H57zm176 0v14h46v-14h-46zm64 0v46h158v-46H297zm-64 32v14h46v-14h-46zM25 441v46h190v-46H25zm208 0v14h46v-14h-46zm64 0v46h190v-46H297zm-64 32v14h46v-14h-46z"},child:[]}]})(t)}function cs(){const[t,r]=b.useState(!1),s=e.useEditorStore(c=>c.card.type),{setCardType:n,setCardPreferences:o,setChartOrientation:u}=e.useEditorStore(c=>c.actions),a=e.useEditorStore(c=>c.actions.setCardCustomCfg);function l(c){a(null),o({}),n(c),r(!1)}return e.jsxRuntimeExports.jsxs(e.Popover,{open:t,onOpenChange:r,children:[e.jsxRuntimeExports.jsx(e.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.Button,{size:"sm",variant:"outline",children:e.jsxRuntimeExports.jsx(xs,{className:"h-4 w-4",chartType:s})})}),e.jsxRuntimeExports.jsx(e.PopoverContent,{className:"w-50",children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 place-items-center",children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("bar"),className:"font-normal",variant:"ghost",children:e.jsxRuntimeExports.jsx(ze,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("line"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Le,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("stackedBar"),variant:"ghost",children:e.jsxRuntimeExports.jsx(ot,{className:"size-5",strokeWidth:0})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("stackedLine"),variant:"ghost",children:e.jsxRuntimeExports.jsx(nt,{className:"size-5",strokeWidth:0})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("scatter"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Je,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("bubble"),variant:"ghost",children:e.jsxRuntimeExports.jsx(rt,{className:"size-4"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("pie"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Qe,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("doughnut"),variant:"ghost",children:e.jsxRuntimeExports.jsx(tt,{className:"size-5",strokeWidth:1})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("radar"),variant:"ghost",children:e.jsxRuntimeExports.jsx(et,{className:"size-5 font-extralight",strokeWidth:.5})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("polarArea"),variant:"ghost",children:e.jsxRuntimeExports.jsx(st,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("pyramid"),variant:"ghost",children:e.jsxRuntimeExports.jsx(at,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("range"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Ge,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("table"),variant:"ghost",children:e.jsxRuntimeExports.jsx(e.Table,{className:"size-5"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("kpi"),variant:"ghost",children:e.jsxRuntimeExports.jsx(it,{className:"size-6"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>l("text"),variant:"ghost",children:e.jsxRuntimeExports.jsx(Fe,{className:"size-4"})})]})})]})}function xs({chartType:t,className:r}){switch(t){case"bar":return e.jsxRuntimeExports.jsx(ze,{className:r});case"line":return e.jsxRuntimeExports.jsx(Le,{className:r});case"pie":return e.jsxRuntimeExports.jsx(Qe,{className:r});case"radar":return e.jsxRuntimeExports.jsx(et,{className:r});case"scatter":return e.jsxRuntimeExports.jsx(Je,{className:r});case"bubble":return e.jsxRuntimeExports.jsx(rt,{className:r});case"doughnut":return e.jsxRuntimeExports.jsx(tt,{className:r});case"stackedBar":return e.jsxRuntimeExports.jsx(ot,{className:"size-4 text-foreground/70"});case"stackedLine":return e.jsxRuntimeExports.jsx(nt,{className:"size-4 text-foreground/70"});case"polarArea":return e.jsxRuntimeExports.jsx(st,{className:r});case"pyramid":return e.jsxRuntimeExports.jsx(at,{className:r});case"range":return e.jsxRuntimeExports.jsx(Ge,{className:r});case"kpi":return e.jsxRuntimeExports.jsx(it,{className:r});case"text":return e.jsxRuntimeExports.jsx(Fe,{className:r});default:return e.jsxRuntimeExports.jsx(e.Table,{className:r})}}function He(){const t=e.useEditorStore(h=>h.frame),r=e.useEditorStore(h=>h.card),s=e.useEditorStore(h=>h.card.data),n=e.useEditorStore(h=>h.isShowingVisual),o=e.useEditorStore(h=>h.isSqlRunning),u=e.useEditorStore(h=>h.queryError),a=e.useEditorStore(h=>h.pythonStdOut),l=e.useEditorStore(h=>h.actions.setRunSql);e.useEditorStore(h=>h.onSave),e.useEditorStore(h=>h.onClose),e.useEditorStore(h=>h.actions.setCardSql),e.useEditorStore(h=>h.actions.setCardType),e.useEditorStore(h=>h.actions.setSqlGen);const{setFrame:c,setCard:p,updateCardInFrame:m}=e.useEditorActions();if(!r)return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:"No Active Card"});function f(){const h={id:e.v4(),title:"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}]},type:"bar",sql:"",data:[]},R={...t,cards:[...t.cards,h],activeCardId:h.id};c(R),p(h)}function j(h){const R=t.cards.filter(A=>A.id!==h),k=R[0],g={...t,cards:R,activeCardId:k.id};c(g),p(k)}function x(h){const R={...t,cards:t.cards.map(g=>g.id===r.id?r:g),activeCardId:h};c(R);const k=R.cards.find(g=>g.id===h);p(k),k.sql&&k.data&&k.data.length===0&&l(!0)}function d(){return e.jsxRuntimeExports.jsxs(e.Tabs,{onValueChange:x,value:t.activeCardId,className:"flex grow flex-col pb-3",children:[t.cards.map(h=>e.jsxRuntimeExports.jsx(e.TabsContent,{className:"mt-0 grow",value:h.id,children:e.jsxRuntimeExports.jsx(Ze,{showCard:h,className:"grow border-none shadow-none"})},h.id)),e.jsxRuntimeExports.jsxs(e.TabsList,{className:"mx-6 justify-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[t.cards.map(h=>e.jsxRuntimeExports.jsx(e.Editable,{text:h.tabTitle||h.title,onSave:R=>{p({...r,tabTitle:R}),m({...r,tabTitle:R})},children:e.jsxRuntimeExports.jsxs(e.TabsTrigger,{className:"",value:h.id,children:[h.tabTitle||h.title,t.activeCardId===h.id&&t.cards.length>1&&e.jsxRuntimeExports.jsx(e.X,{className:"ml-2 size-3.5 text-muted-foreground hover:text-foreground",onClick:()=>j(h.id)})]})},h.id)),e.jsxRuntimeExports.jsx(e.Button,{className:"ml-1 h-8 px-2 hover:bg-muted-foreground/50",variant:"outline",onClick:f,children:e.jsxRuntimeExports.jsx(e.Plus,{className:"h-4 w-4"})})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Button,{className:"p-1",variant:"ghost",children:e.jsxRuntimeExports.jsx($e,{className:"size-4"})})})]})]})}function E(){return r.type==="kpi"?e.jsxRuntimeExports.jsx("div",{className:"flex grow items-center justify-center",children:e.jsxRuntimeExports.jsx("div",{className:"w-1/2 rounded-md border",children:e.jsxRuntimeExports.jsx(e.KPICard,{isLoading:o,card:r})})}):r.type==="text"?e.jsxRuntimeExports.jsx("div",{className:"flex grow items-center justify-center",children:e.jsxRuntimeExports.jsx("div",{className:"w-1/2 rounded-md border",children:e.jsxRuntimeExports.jsx(e.TextCard,{isLoading:o,card:r})})}):d()}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full flex-col pt-3",children:[o&&e.jsxRuntimeExports.jsx(me,{className:"absolute bottom-0 left-0 right-0 top-0 z-10 m-auto h-10 w-10 animate-spin text-foreground/10"}),e.jsxRuntimeExports.jsxs("div",{className:"mb-0 flex min-h-10 items-center justify-end gap-2 px-6",children:[n&&e.jsxRuntimeExports.jsxs("div",{className:"flex grow items-center gap-2",children:[e.jsxRuntimeExports.jsx(cs,{}),r.type!=="table"&&e.jsxRuntimeExports.jsx(ls,{})]}),e.jsxRuntimeExports.jsx(ds,{})]}),n?E():e.jsxRuntimeExports.jsxs("div",{className:"flex min-h-0 w-full flex-1 grow basis-0 px-6",children:[a&&e.jsxRuntimeExports.jsx(us,{}),r.data&&r.data.length>0&&e.jsxRuntimeExports.jsx(as,{data:s||[]}),u&&e.jsxRuntimeExports.jsx("span",{className:"font-mono text-sm",children:u})]})]})}function us(){const t=e.useEditorStore(s=>s.pythonStdOut);if(!t)return null;const r=t.replace(/\n/g,"<br>");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("p",{className:"font-mono text-sm",children:"Output:"}),e.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:r},className:"bg-muted p-2 font-mono text-sm"}),e.jsxRuntimeExports.jsx(e.Separator,{className:"mb-2"})]})}function ds(){const t=e.useEditorStore(s=>s.isShowingVisual),r=e.useEditorStore(s=>s.actions.setIsShowingVisual);return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.Label,{htmlFor:"visualize",children:"Chart"}),e.jsxRuntimeExports.jsx(e.Switch,{checked:t,onCheckedChange:()=>r(!t),id:"visualize",className:"data-[state=checked]:bg-foreground/50"})]})}function pe(){const[t,r]=b.useState([]);e.useEditorStore(m=>m.card.cfg);const s=e.useEditorStore(m=>m.card.preferences),{setCardCfg:n,setFilterOnClickColumnIndex:o,setCardPreferences:u}=e.useEditorStore(m=>m.actions),a=e.useEditorStore(m=>m.queryResultColumns);e.useEditorStore(m=>{var f;return(f=m.card.preferences)==null?void 0:f.filterOnClickColumnIndex}),b.useEffect(()=>{a&&r(new Array(a.length).fill(!1))},[a]);function l(m,f){var j,x;f?s!=null&&s.onClickFilter&&((j=s==null?void 0:s.onClickFilter)==null?void 0:j.length)>0?u({...s,onClickFilter:[...s.onClickFilter,{columnIndex:m,expression:""}]}):u({...s,onClickFilter:[{columnIndex:m,expression:""}]}):(u({...s,onClickFilter:(x=s==null?void 0:s.onClickFilter)==null?void 0:x.filter(d=>d.columnIndex!==m)}),r(d=>{const E=[...d];return E[m]=!1,E}))}function c(m,f){var x;const j=(x=s==null?void 0:s.onClickFilter)==null?void 0:x.map(d=>d.columnIndex===m?{...d,expression:f.target.value}:d);u({...s,onClickFilter:j})}function p(m){var f,j,x,d;if(t!=null&&t[m]||(j=(f=s==null?void 0:s.onClickFilter)==null?void 0:f.find(E=>E.columnIndex===m))!=null&&j.expression)return e.jsxRuntimeExports.jsx(e.Input,{value:(d=(x=s==null?void 0:s.onClickFilter)==null?void 0:x.find(E=>E.columnIndex===m))==null?void 0:d.expression,onChange:E=>c(m,E),type:"text",className:" h-9 w-full focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 font-mono text-xs",placeholder:"Expression"})}return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:a==null?void 0:a.map((m,f)=>{var j,x;return e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between space-y-2 xbg-red-100 group",children:e.jsxRuntimeExports.jsxs("div",{className:" grow",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center py-2 space-x-2",children:[e.jsxRuntimeExports.jsx(e.Checkbox,{checked:!!((j=s==null?void 0:s.onClickFilter)!=null&&j.find(d=>d.columnIndex===f)),onCheckedChange:d=>l(f,d)}),e.jsxRuntimeExports.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:m}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-2 items-center ",children:((x=s==null?void 0:s.onClickFilter)==null?void 0:x.find(d=>d.columnIndex===f))&&e.jsxRuntimeExports.jsx(Ke,{onClick:()=>{r(d=>{const E=[...d];return E[f]=!d[f],E})},className:" invisible group-hover:visible size-3 text-gray-400 cursor-pointer"})})]}),p(f)]})},m)})})}function Ne(){var a,l,c;const t=e.useEditorStore(p=>p.card.preferences),r=e.useEditorStore(p=>p.card.cfg),{setCardCfg:s,setCardPreferences:n,setChartOrientation:o}=e.useEditorStore(p=>p.actions);(a=r==null?void 0:r.options)!=null&&a.indexAxis;function u(p){o(p)}return e.jsxRuntimeExports.jsxs(e.RadioGroup,{value:((l=t==null?void 0:t.chartOptions)==null?void 0:l.indexAxis)||((c=r==null?void 0:r.options)==null?void 0:c.indexAxis)||"x",onValueChange:u,className:"flex gap-3",defaultValue:"x",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"x",id:"r1"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Vertical"})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"y",id:"r2"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Horizontal"})]})]})}const ue="focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0";function Pe(t,r){var n,o,u;const s=e.getNumberAxis(t,r);return((u=(o=(n=t==null?void 0:t.chartOptions)==null?void 0:n.scales)==null?void 0:o[s])==null?void 0:u.type)||"linear"}function lt(){var _,B,K,q,Q,v;const[t,r]=b.useState(!1),s=e.useEditorStore(S=>{var N;return(N=S.card)==null?void 0:N.preferences}),n=e.useEditorStore(S=>{var N;return(N=S.card)==null?void 0:N.cfg}),o=e.getNumberAxis(s,n),[u,a]=b.useState(Pe(s)),[l,c]=b.useState(((K=(B=(_=s==null?void 0:s.chartOptions)==null?void 0:_.scales)==null?void 0:B[o])==null?void 0:K.min)||""),[p,m]=b.useState(((v=(Q=(q=s==null?void 0:s.chartOptions)==null?void 0:q.scales)==null?void 0:Q[o])==null?void 0:v.max)||""),[f,j]=b.useState(l||p?"custom":"auto"),[x,d]=b.useState(""),[E,h]=b.useState(0),[R,k]=b.useState(""),[g,A]=b.useState(""),[I,z]=b.useState(""),w=e.useEditorStore(S=>S.actions.setCardPreferences),y=e.useEditorStore(S=>{var N;return(N=S.card)==null?void 0:N.type}),C=["pie","doughnut","polarArea"].includes(y);b.useEffect(()=>{var S,N,O,te,G,T,H,$,ne,se,V,J,U,oe;a(Pe(s)),c(((O=(N=(S=s==null?void 0:s.chartOptions)==null?void 0:S.scales)==null?void 0:N[o])==null?void 0:O.min)===0?0:""),m(((T=(G=(te=s==null?void 0:s.chartOptions)==null?void 0:te.scales)==null?void 0:G[o])==null?void 0:T.max)||""),d(((se=(ne=($=(H=s==null?void 0:s.chartOptions)==null?void 0:H.scales)==null?void 0:$[o])==null?void 0:ne.ticks)==null?void 0:se.stepSize)||""),h(((V=s==null?void 0:s.numberAxisFormat)==null?void 0:V.decimalPlaces)||0),k(((J=s==null?void 0:s.numberAxisFormat)==null?void 0:J.suffix)||""),A(((U=s==null?void 0:s.numberAxisFormat)==null?void 0:U.currency)||""),z(((oe=s==null?void 0:s.numberAxisFormat)==null?void 0:oe.locale)||"")},[t,s,o]);function L(S,N){return N===""||/^[0-9\b]+$/.test(N)?Number(N):Number(S)}function M(){return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-6 items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Label,{className:"col-span-2 hover:cursor-pointer hover:underline",htmlFor:"currency",children:e.jsxRuntimeExports.jsx("a",{target:"_blank",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat",children:"Currency"})}),e.jsxRuntimeExports.jsx(e.Input,{value:g,placeholder:"USD",onChange:S=>A(S.target.value),id:"currency",className:`col-span-2 h-8 w-full ${ue}`}),e.jsxRuntimeExports.jsx(e.Input,{value:I,placeholder:"en-US",onChange:S=>z(S.target.value),id:"locale",className:`col-span-2 h-8 w-full ${ue}`})]}),e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-9 items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Label,{className:"col-span-3",htmlFor:"format",children:"Decimals"}),e.jsxRuntimeExports.jsx(e.Input,{value:E,onChange:S=>h(Number(S.target.value)),id:"format",className:`col-span-6 h-8 w-full tracking-wide ${ue}`})]})]})}function D(){return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Label,{htmlFor:"range",children:"Range"}),e.jsxRuntimeExports.jsx(e.Input,{id:"min",value:l,onChange:S=>c(N=>L(N,S.target.value)),className:`col-span-1 h-8 w-full ${ue}`}),e.jsxRuntimeExports.jsx(e.Input,{value:p,onChange:S=>m(N=>L(N,S.target.value)),id:"max",className:`col-span-1 h-8 w-full ${ue}`})]}),e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Label,{htmlFor:"step-size",children:"Step Size"}),e.jsxRuntimeExports.jsx(e.Input,{value:x,onChange:S=>d(N=>L(N,S.target.value)),id:"step-size",className:`col-span-1 h-8 w-full ${ue}`})]})]})}function F(){var O;let S={};f==="custom"&&(S={min:l,max:p,ticks:{stepSize:x}});const N={...s||{},chartOptions:{...s==null?void 0:s.chartOptions,scales:{...(O=s==null?void 0:s.chartOptions)==null?void 0:O.scales,[o]:{type:u,...u==="linear"?S:{}}}},numberAxisFormat:{decimalPlaces:E,suffix:R,currency:g,locale:I}};console.log(N),w(N)}return e.jsxRuntimeExports.jsxs(e.Popover,{onOpenChange:S=>r(S),children:[e.jsxRuntimeExports.jsx(e.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(e.SliderIcon,{className:"size-4 cursor-pointer text-muted-foreground hover:text-foreground"})}),e.jsxRuntimeExports.jsx(e.PopoverContent,{align:"center",className:"max-w-65",children:e.jsxRuntimeExports.jsxs("div",{className:"grid gap-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsx("h4",{className:"font-medium leading-none",children:"Scale Options"}),e.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the scale for the number axis"})]}),e.jsxRuntimeExports.jsxs("div",{className:"grid gap-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Label,{htmlFor:"scale",children:"Type"}),e.jsxRuntimeExports.jsxs(e.Select,{disabled:C,value:u,onValueChange:S=>a(S),children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{})}),e.jsxRuntimeExports.jsx(e.SelectContent,{id:"type",children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Option"}),e.jsxRuntimeExports.jsx(e.SelectItem,{value:"linear",children:"Linear"}),e.jsxRuntimeExports.jsx(e.SelectItem,{value:"logarithmic",children:"Logarithmic"})]})})]})]}),u=="linear"&&e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2 py-1",children:[e.jsxRuntimeExports.jsx(e.Label,{htmlFor:"scale-option",children:"Setup"}),e.jsxRuntimeExports.jsxs(e.RadioGroup,{disabled:C,id:"scale-option",value:f,onValueChange:S=>j(S),className:"col-span-2 flex gap-3",defaultValue:"x",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"auto",id:"r1"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Auto"})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"custom",id:"r2"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Custom"})]})]})]}),f==="custom"&&u=="linear"&&D(),M(),e.jsxRuntimeExports.jsx(e.SelectSeparator,{}),e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3",children:e.jsxRuntimeExports.jsx(e.Button,{onClick:F,variant:"secondary",className:"col-span-1 col-start-3 h-8 w-full",children:"Apply"})})]})]})})]})}function ms({idx:t}){var l;const r=e.useEditorStore(c=>{var p;return(p=c.card)==null?void 0:p.preferences}),s=e.useEditorStore(c=>{var p;return(p=c.card.preferences)==null?void 0:p.datasetOptions}),n=e.useEditorStore(c=>c.actions.setCardPreferences),o=(l=r==null?void 0:r.chartOptions)==null?void 0:l.indexAxis,u=s==null?void 0:s.find(c=>c.idx===t);function a(c,p){(c==="end"||c==="start")&&e.getContrastColor(e.getCanvasBackgroundColor());const m={display:c!=="none",align:c,anchor:c,clamp:!0};if(!u)n({...r,datasetOptions:[...s||[],{idx:p,datalabels:m}]});else{const f={...u};f.datalabels=m;const j=s==null?void 0:s.map(x=>x.idx===p?f:x);n({...r,datasetOptions:j})}}return e.jsxRuntimeExports.jsxs(e.Popover,{children:[e.jsxRuntimeExports.jsx(e.PopoverTrigger,{children:e.jsxRuntimeExports.jsx(Ot,{className:"invisible size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),e.jsxRuntimeExports.jsx(e.PopoverContent,{className:"w-fit p-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex gap-1",children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>a("none",t),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:e.jsxRuntimeExports.jsx(e.X,{className:"size-4"})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>a("start",t),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:e.jsxRuntimeExports.jsx(Ct,{className:e.cn("h-4 w-4",{"rotate-90":o==="y"})})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>a("center",t),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:e.jsxRuntimeExports.jsx(kt,{className:e.cn("h-4 w-4",{"rotate-90":o==="y"})})}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>a("end",t),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:e.jsxRuntimeExports.jsx(Nt,{className:e.cn("h-4 w-4",{"rotate-90":o==="y"})})})]})})]})}function ct(){const t=e.useEditorStore(c=>c.card),r=e.useEditorStore(c=>{var p,m,f;return(f=(m=(p=c==null?void 0:c.card)==null?void 0:p.preferences)==null?void 0:m.chartOptions)==null?void 0:f.indexAxis}),s=r==="y"?"Y axis":"X axis",n=r==="y"?"X axis":"Y axis",{keys:o,metricKeys:u,dimensionKeys:a}=e.getKeys(t.data||[]);let l=u;if(["stackedBar","stackedLine"].includes(t.type)){const c=e.pivotData({dataArray:t.data||[],groupKey:a[0],pivotKey:a[1],valueKey:l[0]}),{metricKeys:p}=e.getKeys(c);l=p}return o.length===0?null:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsx(e.Label,{children:s}),e.jsxRuntimeExports.jsx("div",{className:"my-1 space-y-1",children:e.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-muted/70 px-2 py-1 hover:bg-muted",children:e.jsxRuntimeExports.jsx("p",{children:a[0]})})})]}),e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-5",children:[e.jsxRuntimeExports.jsx(e.Label,{children:n}),e.jsxRuntimeExports.jsx(lt,{})]}),e.jsxRuntimeExports.jsx("div",{className:"my-1 space-y-1",children:l.map((c,p)=>e.jsxRuntimeExports.jsx(ps,{col:c,idx:p},c))})]})]})}function ps({col:t,idx:r}){const s=e.useEditorStore(l=>{var c;return(c=l.card)==null?void 0:c.preferences}),n=e.useEditorStore(l=>{var c;return(c=l.card.preferences)==null?void 0:c.datasetOptions}),o=n==null?void 0:n.find(l=>l.idx===r),{setCardPreferences:u}=e.useEditorStore(l=>l.actions);function a(l){if(!o)u({...s,datasetOptions:[...n||[],{idx:r,type:l==="area"?"line":l,fill:l==="area"?"origin":""}]});else{const c={...o};c.type=l==="area"?"line":l,c.fill=l==="area"?"origin":"";const p=n==null?void 0:n.map(m=>m.idx===r?c:m);u({...s,datasetOptions:p})}}return e.jsxRuntimeExports.jsxs("div",{className:"group flex items-center justify-between gap-5 rounded-md bg-muted/70 px-2 py-1 hover:bg-muted",children:[e.jsxRuntimeExports.jsx("p",{children:t}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[e.jsxRuntimeExports.jsx(ze,{onClick:()=>a("bar"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),e.jsxRuntimeExports.jsx(Le,{onClick:()=>a("line"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),e.jsxRuntimeExports.jsx(jt,{onClick:()=>a("area"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),e.jsxRuntimeExports.jsx(e.Separator,{orientation:"vertical",className:"invisible size-4 cursor-pointer py-2 text-muted-foreground hover:text-foreground group-hover:visible"}),e.jsxRuntimeExports.jsx(ms,{idx:r})]})]})}function xt(){const t=e.useEditorStore(j=>j.selectedConnectionId),r=e.useEditorStore(j=>j.selectedDatamodelId),s=e.useEditorStore(j=>j.selectedDatabaseName),n=e.useEditorStore(j=>j.selectedSchemaName),o=e.useEditorStore(j=>j.selectedTableName),u=e.useDashboardStore(j=>j.dashboard.filters)||[],a=e.useDashboardStore(j=>j.actions.addFilter),l=e.useDashboardStore(j=>j.actions.removeFilter),c=e.useDashboardStore(j=>j.actions.removeFilterValue),{modelItems:p,tableName:m}=ae();function f(j,x="dashboard"){var z;const d=e.fmt(j.column_name),E=e.fmt(s||""),h=e.fmt(n||""),R=e.fmt(m);let k=e.getQualifiedTableName(h,R),g=`${k}.${d}`;const A=(z=p==null?void 0:p.find(w=>w.id===r))==null?void 0:z.name;r&&r!=="none"&&(g=`${e.DATAMODEL_NAMESPCACE}.${A}.${d}`,k=`${e.DATAMODEL_NAMESPCACE}.${A}`);const I=u==null?void 0:u.find(w=>w.column===g&&w.table===R&&(w.database===E||w.database===s));if(I)c(I.id),l(I.id);else{const w=e.v4();return m==="api"&&t?(a({location:x,id:w,column:g,title:j.column_name,dataType:j.data_type,table:"api",database:"",connectionId:t,operation:"in",sql:e.getDefaultFilterSql(j.data_type,k,d)}),w):(a({id:w,location:x,column:g,title:j.column_name,dataType:j.data_type,table:o||"",database:s||"",connectionId:t||"",operation:"in",sql:e.getDefaultFilterSql(j.data_type,k,d)}),w)}}return{assignFilter:f}}function hs(){const t=e.useDashboardStore(l=>l.dashboard.filters),r=e.useEditorStore(l=>l.frame),{setFrame:s}=e.useEditorActions(),{columns:n}=ae(),{assignFilter:o}=xt();function u(l){const c=o(l,"frame");s({...r,filterId:c})}const a=t==null?void 0:t.find(l=>l.id===r.filterId);return e.jsxRuntimeExports.jsxs("div",{className:"space-y-3",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Card Filter"}),e.jsxRuntimeExports.jsx(js,{onSelect:u,columns:n}),a&&e.jsxRuntimeExports.jsx(e.FilterHeader,{filter:a})]})}function js({columns:t,onSelect:r}){var a;const[s,n]=Be.useState(!1),[o,u]=Be.useState("");return e.jsxRuntimeExports.jsxs(e.Popover,{open:s,onOpenChange:n,children:[e.jsxRuntimeExports.jsx(e.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(e.Button,{size:"sm",variant:"outline",role:"combobox","aria-expanded":s,className:"w-full justify-between font-normal",children:[o?(a=t.find(l=>l.column_name===o))==null?void 0:a.column_name:"Select Column...",e.jsxRuntimeExports.jsx(e.CaretSortIcon,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsxRuntimeExports.jsx(e.PopoverContent,{className:"w-[200px] p-0",children:e.jsxRuntimeExports.jsxs(e.Command,{children:[e.jsxRuntimeExports.jsx(e.CommandInput,{placeholder:"Search column",className:"h-9"}),e.jsxRuntimeExports.jsxs(e.CommandList,{children:[e.jsxRuntimeExports.jsx(e.CommandEmpty,{children:"No framework found."}),e.jsxRuntimeExports.jsx(e.CommandGroup,{children:t.map(l=>e.jsxRuntimeExports.jsxs(e.CommandItem,{value:l.column_name,onSelect:c=>{const p=c===o?"":c;u(p),n(!1),p&&r(l)},children:[l.column_name,e.jsxRuntimeExports.jsx(e.CheckIcon,{className:e.cn("ml-auto h-4 w-4",o===l.column_name?"opacity-100":"opacity-0")})]},l.column_name))})]})]})})]})}function Es({cardType:t}){return e.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxRuntimeExports.jsxs(e.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:`${e.titleCase(t)} Chart`}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 font-mono text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT x-axis, y-axis-1, y-axis-2,... FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),e.jsxRuntimeExports.jsx("li",{children:"y-axis1 - number"}),e.jsxRuntimeExports.jsx("li",{children:"y-axis2 - number"})]}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:r=>r.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#line-chart",children:"example"})," in the docs."]})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-2",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Settings"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[e.jsxRuntimeExports.jsx(Ne,{}),e.jsxRuntimeExports.jsx(ct,{})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Filters"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[e.jsxRuntimeExports.jsx(pe,{}),e.jsxRuntimeExports.jsx(hs,{})]})]})]})})}function Oe(){var o,u,a;const t=e.useEditorStore(l=>l.card.cfg),r=e.useEditorStore(l=>l.actions.setCardCfg),s=e.useEditorStore(l=>l.card.type);function n(l){var m;const c={datalabels:{display:l!=="none",align:l,anchor:l,clamp:!0}},p={...t,options:{...t==null?void 0:t.options,plugins:{...(m=t==null?void 0:t.options)==null?void 0:m.plugins,...c}}};r(p),console.log(l)}return e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxRuntimeExports.jsx("label",{className:"font-medium",children:"Data Labels"}),!["pyramid"].includes(s)&&e.jsxRuntimeExports.jsx(lt,{})]}),e.jsxRuntimeExports.jsxs(e.Select,{value:(a=(u=(o=t==null?void 0:t.options)==null?void 0:o.plugins)==null?void 0:u.datalabels)==null?void 0:a.anchor,onValueChange:n,defaultValue:"none",children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{placeholder:"Select position"})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Data Labels"}),e.jsxRuntimeExports.jsx(e.SelectItem,{value:"none",children:"None"}),s!=="pyramid"&&e.jsxRuntimeExports.jsx(e.SelectItem,{value:"start",children:"Start"}),e.jsxRuntimeExports.jsx(e.SelectItem,{value:"center",children:"Center"}),s!=="pyramid"&&e.jsxRuntimeExports.jsx(e.SelectItem,{value:"end",children:"End"})]})})]})]})}function fs({cardType:t}){function r(s){const n="SELECT label, [group], x-axis, y-axis, radius FROM table",o="SELECT label, [group], x-axis, y-axis FROM table";return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:s==="bubble"?n:o}),e.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"label - category"}),e.jsxRuntimeExports.jsx("li",{children:"group - category"}),e.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),e.jsxRuntimeExports.jsx("li",{children:"y-axis - category"}),s==="bubble"&&e.jsxRuntimeExports.jsx("li",{children:"radius - number"})]}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:u=>u.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#pie-chart",children:"example"})," in the docs."]})]})}return e.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxRuntimeExports.jsxs(e.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:`${e.titleCase(t)} Chart`}),e.jsxRuntimeExports.jsx(e.AccordionContent,{className:"space-y-4 font-mono text-xs",children:r(t)})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-2",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Settings"}),e.jsxRuntimeExports.jsx(e.AccordionContent,{className:"px-2",children:e.jsxRuntimeExports.jsx(Oe,{})})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Filters"}),e.jsxRuntimeExports.jsx(e.AccordionContent,{className:"px-2",children:e.jsxRuntimeExports.jsx(pe,{})})]})]})})}const gs={datasets:[{type:"line",label:"Sum_sales",data:[]},{type:"bar",label:"Sum_profit",data:[]}]},Rs={datasets:[{fill:"origin",type:"line",label:"Sum_sales",data:[]}]};function bs(){const t=e.useEditorStore(r=>r.card.type);return e.jsxRuntimeExports.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxRuntimeExports.jsx(e.Accordion,{className:" ",type:"single",collapsible:!0,children:Ss(t)}),e.jsxRuntimeExports.jsx("section",{className:"",children:["line","bar"].includes(t)&&e.jsxRuntimeExports.jsx(Ne,{})}),e.jsxRuntimeExports.jsx("div",{children:!["kpi"].includes(t)&&e.jsxRuntimeExports.jsx(Oe,{})}),e.jsxRuntimeExports.jsx("div",{children:!["kpi"].includes(t)&&e.jsxRuntimeExports.jsx(pe,{})})]})}function Ss(t){if(["line","bar"].includes(t))return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:e.jsxRuntimeExports.jsx("p",{children:"Chart Query"})}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:" ",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"X-axis - Category (ex. city)"}),e.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. population)"})]})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-2",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:"Mixed Chart"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-2 text-xs",children:[e.jsxRuntimeExports.jsxs("p",{children:["Click ",e.jsxRuntimeExports.jsx("b",{children:"Customize"})," and change the `type` property in the dataset."]}),e.jsxRuntimeExports.jsx("pre",{children:JSON.stringify(gs,null,2)})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:"Area Chart"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-2 text-xs",children:[e.jsxRuntimeExports.jsxs("p",{children:["Click ",e.jsxRuntimeExports.jsx("b",{children:"Customize"})," and add `fill` property to the dataset. See",e.jsxRuntimeExports.jsx("a",{className:"mx-1 text-blue-500 hover:underline",href:"https://www.chartjs.org/docs/latest/samples/area/line-boundaries.html",target:"_blank",children:"docs"}),"for more options."]}),e.jsxRuntimeExports.jsx("pre",{children:JSON.stringify(Rs,null,2)})]})]})]});if(t==="bubble")return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:e.jsxRuntimeExports.jsxs("p",{children:["How to create a ",e.jsxRuntimeExports.jsx("span",{children:t})," chart query?"]})}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:" ",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT label, x-axis, y-axis, radius FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),e.jsxRuntimeExports.jsx("li",{children:"Bubble Group (opt) - Category (ex. state)"}),e.jsxRuntimeExports.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),e.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"}),e.jsxRuntimeExports.jsx("li",{children:"Radius - Number (ex. population)"})]})]})]})});if(t==="scatter")return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:e.jsxRuntimeExports.jsxs("p",{children:["How to create a ",e.jsxRuntimeExports.jsx("span",{children:t})," chart query?"]})}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:" ",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT label, x-axis, y-axis FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),e.jsxRuntimeExports.jsx("li",{children:"Group (opt) - Category (ex. state)"}),e.jsxRuntimeExports.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),e.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"})]})]})]})});if(["pie","doughnut","polarArea"].includes(t))return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"font-normal",children:e.jsxRuntimeExports.jsxs("p",{children:[e.jsxRuntimeExports.jsx("span",{children:t==="polarArea"?"Polar":t.charAt(0).toUpperCase()+t.slice(1)})," ","chart query"]})}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:" ",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT label, measure FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),e.jsxRuntimeExports.jsx("li",{children:"Measure - Number (ex. population)"})]})]})]})})}function ys(){var c,p,m,f,j;const t=e.useEditorStore(x=>x.card.preferences),r=e.useEditorStore(x=>x.actions.setCardPreferences),s=e.useEditorStore(x=>x.actions.setNumberFormat);e.useEditorStore(x=>{var d,E;return(E=(d=x.card.preferences)==null?void 0:d.formatNumber)==null?void 0:E.decimalPlaces});const n=e.useEditorStore(x=>{var d,E;return(E=(d=x.card.preferences)==null?void 0:d.formatNumber)==null?void 0:E.locale}),o=e.useEditorStore(x=>{var d,E;return(E=(d=x.card.preferences)==null?void 0:d.formatNumber)==null?void 0:E.currency});e.useEditorStore(x=>x.actions.setFilterOnClickField);const u=e.useEditorStore(x=>{var d,E;return(E=(d=x.card.preferences)==null?void 0:d.formatNumber)==null?void 0:E.colorRanges})||[],a=e.useEditorStore(x=>x.actions.setColorRanges),l=[...new Set(e.LOCALE_CURRENCY_PAIRS.map(x=>x.currency))];return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(e.Checkbox,{checked:!!((c=t==null?void 0:t.formatNumber)!=null&&c.enabled),onCheckedChange:x=>{r({...t,formatNumber:{...t==null?void 0:t.formatNumber,enabled:x}})}}),e.jsxRuntimeExports.jsx(e.Label,{children:"Format Number"})]}),((p=t==null?void 0:t.formatNumber)==null?void 0:p.enabled)===!0&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 p-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-full space-y-1",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Locale"}),e.jsxRuntimeExports.jsxs(e.Select,{value:n||"en-US",onValueChange:x=>{var d,E,h;return s(((d=t==null?void 0:t.formatNumber)==null?void 0:d.decimalPlaces)||0,((E=t==null?void 0:t.formatNumber)==null?void 0:E.currency)||"",x||"en-US",((h=t==null?void 0:t.formatNumber)==null?void 0:h.suffix)||"")},children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Format"}),e.LOCALE_CURRENCY_PAIRS.map(x=>e.jsxRuntimeExports.jsx(e.SelectItem,{value:x.locale,children:x.locale},x.locale))]})})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"w-full space-y-1",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Currency"}),e.jsxRuntimeExports.jsxs(e.Select,{value:o||"none",onValueChange:x=>{var d,E,h;return s(((d=t==null?void 0:t.formatNumber)==null?void 0:d.decimalPlaces)||0,x==="none"?"":x,((E=t==null?void 0:t.formatNumber)==null?void 0:E.locale)||"",((h=t==null?void 0:t.formatNumber)==null?void 0:h.suffix)||"")},children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:e.jsxRuntimeExports.jsxs(e.SelectGroup,{children:[e.jsxRuntimeExports.jsx(e.SelectLabel,{children:"Currency"}),e.jsxRuntimeExports.jsx(e.SelectItem,{value:"none",children:"None"},"none"),l.map(x=>e.jsxRuntimeExports.jsx(e.SelectItem,{value:x,children:x},x))]})})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-full space-y-1",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Decimals"}),e.jsxRuntimeExports.jsxs(e.Select,{value:((f=(m=t==null?void 0:t.formatNumber)==null?void 0:m.decimalPlaces)==null?void 0:f.toString())||"0",onValueChange:x=>{var d,E,h;return s(Number(x),((d=t==null?void 0:t.formatNumber)==null?void 0:d.currency)||"",((E=t==null?void 0:t.formatNumber)==null?void 0:E.locale)||"",((h=t==null?void 0:t.formatNumber)==null?void 0:h.suffix)||"")},children:[e.jsxRuntimeExports.jsx(e.SelectTrigger,{className:"col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsxRuntimeExports.jsx(e.SelectValue,{})}),e.jsxRuntimeExports.jsx(e.SelectContent,{children:["0","1","2","3","4"].map(x=>e.jsxRuntimeExports.jsx(e.SelectItem,{value:x,children:x},x))})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"w-full space-y-1",children:[e.jsxRuntimeExports.jsx(e.Label,{children:"Suffix"}),e.jsxRuntimeExports.jsx(e.Input,{value:((j=t==null?void 0:t.formatNumber)==null?void 0:j.suffix)||"",className:"h-8 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"K, M, B, %",onChange:x=>{var d,E,h;return s(((d=t==null?void 0:t.formatNumber)==null?void 0:d.decimalPlaces)||0,((E=t==null?void 0:t.formatNumber)==null?void 0:E.currency)||"",((h=t==null?void 0:t.formatNumber)==null?void 0:h.locale)||"",x.target.value)}})]})]})]})}),e.jsxRuntimeExports.jsx(e.Separator,{className:"my-3"}),e.jsxRuntimeExports.jsx(e.ColorFormat,{colorRanges:u,setColorRanges:a})]})]})}function vs(){return e.jsxRuntimeExports.jsxs("div",{className:"space-y-6 px-6 py-2",children:[e.jsxRuntimeExports.jsx(e.Accordion,{type:"single",collapsible:!0,children:e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{className:"",children:"KPI Query"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"font-mono",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs",children:"SELECT current, previous FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"current - number"}),e.jsxRuntimeExports.jsx("li",{children:"previous - number"})]}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:t=>t.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#kpi",children:"example"})," in the docs."]})]})]})}),e.jsxRuntimeExports.jsx("section",{className:"",children:e.jsxRuntimeExports.jsx(ys,{})}),e.jsxRuntimeExports.jsx("div",{}),e.jsxRuntimeExports.jsx("div",{})]})}function Cs(){var n;const t=e.useEditorStore(o=>o.card.preferences),{setCardPreferences:r}=e.useEditorStore(o=>o.actions);function s(o){r({...t,textVisualOptions:{...t==null?void 0:t.textVisualOptions,isDynamicText:o==="dynamic"}})}return e.jsxRuntimeExports.jsxs(e.RadioGroup,{value:(n=t==null?void 0:t.textVisualOptions)!=null&&n.isDynamicText?"dynamic":"static",onValueChange:s,className:"flex gap-3",defaultValue:"x",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"static",id:"r1"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Static"})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.RadioGroupItem,{value:"dynamic",id:"r2"}),e.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Dynamic"})]})]})}function ye({cardType:t,docContent:r,suffix:s="Chart"}){return e.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxRuntimeExports.jsxs(e.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:`${e.titleCase(t)} ${s}`}),e.jsxRuntimeExports.jsx(e.AccordionContent,{children:r||e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT label, measure FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"label - category"}),e.jsxRuntimeExports.jsx("li",{children:"measure - number"})]}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:n=>n.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#pie-chart",children:"example"})," in the docs."]})]})})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-2",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Settings"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[t==="range"&&e.jsxRuntimeExports.jsx(Ne,{}),t!=="text"&&e.jsxRuntimeExports.jsx(Oe,{}),t==="text"&&e.jsxRuntimeExports.jsx(Cs,{})]})]}),!["range","text"].includes(t)&&e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Filters"}),e.jsxRuntimeExports.jsx(e.AccordionContent,{className:"px-2",children:e.jsxRuntimeExports.jsx(pe,{})})]})]})})}function Ns(){return e.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxRuntimeExports.jsxs(e.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-1",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Stacked Chart"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 font-mono text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT x-axis, stack-by, y-axis FROM table"}),e.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),e.jsxRuntimeExports.jsx("li",{children:"stack by - category"}),e.jsxRuntimeExports.jsx("li",{children:"y-axis - number"})]}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:t=>t.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#stacked-chart",children:"example"})," in the docs."]})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-2",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Settings"}),e.jsxRuntimeExports.jsxs(e.AccordionContent,{className:"space-y-4 px-2",children:[e.jsxRuntimeExports.jsx(Ne,{}),e.jsxRuntimeExports.jsx(ct,{})]})]}),e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Filters"}),e.jsxRuntimeExports.jsx(e.AccordionContent,{className:"px-2",children:e.jsxRuntimeExports.jsx(pe,{})})]})]})})}function ks({}){const t=e.useEditorStore(n=>{var o;return(o=n.card)==null?void 0:o.preferences}),r=e.useEditorStore(n=>n.actions.setCardPreferences),s=n=>{r({...t,allowDownload:n})};return e.jsxRuntimeExports.jsxs("div",{className:"space-y-6 px-6 py-2",children:[e.jsxRuntimeExports.jsx(e.Accordion,{defaultValue:["item-3"],type:"multiple",children:e.jsxRuntimeExports.jsxs(e.AccordionItem,{value:"item-3",children:[e.jsxRuntimeExports.jsx(e.AccordionTrigger,{children:"Filters"}),e.jsxRuntimeExports.jsx(e.AccordionContent,{className:"px-2",children:e.jsxRuntimeExports.jsx(pe,{})})]})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(e.Checkbox,{onCheckedChange:s,id:"allow-download"}),e.jsxRuntimeExports.jsx("label",{htmlFor:"allow-download",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Allow Download"})]})]})}const ws=e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT dimension, cohort, metric FROM table"}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:t=>t.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#pyramid-chart",children:"example"})," in the docs."]})]}),Ds=e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT y-axis, label, range-from, range-to, range-value FROM table"}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:t=>t.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#range-charts",children:"example"})," in the docs."]})]}),As=e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 font-mono text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT text FROM table limit 1"}),e.jsxRuntimeExports.jsxs("div",{children:["See ",e.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:t=>t.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#text-visual",children:"example"})," in the docs."]})]});function Is(){const t=e.useEditorStore(s=>s.card.type);function r(s){switch(s){case"stackedBar":case"stackedLine":return e.jsxRuntimeExports.jsx(Ns,{});case"pyramid":return e.jsxRuntimeExports.jsx(ye,{docContent:ws,cardType:s});case"kpi":return e.jsxRuntimeExports.jsx(vs,{});case"line":case"bar":return e.jsxRuntimeExports.jsx(Es,{cardType:s});case"range":return e.jsxRuntimeExports.jsx(ye,{docContent:Ds,cardType:s});case"pie":case"doughnut":case"polarArea":case"radar":return e.jsxRuntimeExports.jsx(ye,{cardType:s});case"bubble":case"scatter":return e.jsxRuntimeExports.jsx(fs,{cardType:s});case"table":return e.jsxRuntimeExports.jsx(ks,{cardType:s});case"text":return e.jsxRuntimeExports.jsx(ye,{docContent:As,cardType:s,suffix:"Visual"});default:return e.jsxRuntimeExports.jsx(bs,{})}}return e.jsxRuntimeExports.jsx(e.ScrollArea,{className:"h-full w-full text-sm",children:r(t)})}function Ts(){const t=e.useEditorStore(r=>r.isShowingVisual);return e.jsxRuntimeExports.jsxs(e.ResizablePanelGroup,{direction:"vertical",className:"min-h-[250px] min-w-full max-w-lg",children:[e.jsxRuntimeExports.jsx(e.ResizablePanel,{role:"query-section",className:"flex",minSize:20,defaultSize:40,children:e.jsxRuntimeExports.jsx(is,{})}),e.jsxRuntimeExports.jsx(e.ResizableHandle,{withHandle:!0,className:"border"}),e.jsxRuntimeExports.jsx(e.ResizablePanel,{className:"pb-1",role:"visual-section",minSize:0,defaultSize:60,children:t?e.jsxRuntimeExports.jsxs(e.ResizablePanelGroup,{direction:"horizontal",children:[e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(e.ResizablePanel,{className:"flex min-w-[275px]",minSize:20,defaultSize:25,maxSize:30,children:e.jsxRuntimeExports.jsx(Is,{})})}),e.jsxRuntimeExports.jsx(e.ResizableHandle,{className:"border"}),e.jsxRuntimeExports.jsx(e.ResizablePanel,{minSize:40,defaultSize:75,maxSize:100,children:e.jsxRuntimeExports.jsx(He,{})})]}):e.jsxRuntimeExports.jsx(He,{})})]})}function zs({authToken:t,onSave:r,onClose:s}){const n=e.useEditorStore(a=>a.actions.setOnSave),o=e.useEditorStore(a=>a.actions.setOnClose),u=e.useDashboardStore(a=>a.actions.setAuthToken);return b.useEffect(()=>{r&&n(r),s&&o(s)},[r,n,s,o]),b.useEffect(()=>{t&&t.accessToken&&u(t)},[t,u]),e.jsxRuntimeExports.jsxs(e.EditorPanel,{className:"rounded-none",role:"editor-panel",children:[e.jsxRuntimeExports.jsx(e.EditorAside,{className:"rounded-none border-r-[1.5px]",children:e.jsxRuntimeExports.jsx(We,{})}),e.jsxRuntimeExports.jsx(e.EditorMain,{children:e.jsxRuntimeExports.jsx(Ts,{})})]})}function Ls(){e.useDashboardStore(a=>a.selectedCardId);const t=e.useDashboardStore(a=>a.selectedSheetId),{setIsVisualEditing:r}=e.useDashboardStore(a=>a.actions),s=e.useDashboardStore(a=>a.isVisualEditing),n=e.useDashboardStore(a=>a.actions.updateFrame);function o(a){t&&(n(t,a),r(!1))}function u(){r(!1)}return e.jsxRuntimeExports.jsx("div",{role:"editor-container",className:e.cn("flex grow",{block:s,hidden:!s}),children:e.jsxRuntimeExports.jsx(zs,{onSave:o,onClose:u})})}function Fs(){e.useEditorStore(a=>a.selectedConnectionId),e.useEditorStore(a=>a.selectedDatamodelId);const t=e.useEditorStore(a=>a.selectedDatabaseName);e.useEditorStore(a=>a.selectedSchemaName);const r=e.useEditorStore(a=>a.selectedTableName),s=e.useDashboardStore(a=>a.dashboard.filters)||[];e.useDashboardStore(a=>a.actions.addFilter),e.useDashboardStore(a=>a.actions.removeFilter),e.useDashboardStore(a=>a.actions.removeFilterValue);const{modelItems:n,columns:o}=ae(),{assignFilter:u}=xt();return e.jsxRuntimeExports.jsx("div",{className:"xbg-red-100 flex-1 basis-0 flex-col overflow-scroll px-3",children:o==null?void 0:o.map(a=>{const l=s==null?void 0:s.find(c=>c.column===e.fmt(a.column_name)&&c.table===r&&c.database===t);return e.jsxRuntimeExports.jsx("div",{onClick:()=>u(a),className:e.cn("group flex cursor-pointer items-center justify-between border border-dashed border-background px-3 py-[6px] text-sm transition-colors hover:bg-muted/50",{"bg-muted":l}),children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(Ue,{column:a}),e.jsxRuntimeExports.jsx("span",{children:a.column_name})]})},a.column_name)})})}function Os(){e.useDashboardStore(r=>r.showFilters);const t=e.useDashboardStore(r=>r.actions.setShowFilters);return e.jsxRuntimeExports.jsxs("section",{className:"relative flex grow flex-col border-l px-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"mt-4 flex items-center justify-between gap-2 px-3",children:[e.jsxRuntimeExports.jsx(e.Label,{className:"text-lg",children:"Filters"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>t(!1),className:"h-7 w-7 p-0",variant:"ghost",children:e.jsxRuntimeExports.jsx(e.Cross2Icon,{})})]}),e.jsxRuntimeExports.jsx("div",{className:"flex grow",children:e.jsxRuntimeExports.jsx(We,{ColumnsComponent:()=>e.jsxRuntimeExports.jsx(Fs,{})})})]})}function Ms(){e.useDashboardStore(s=>s.dashboard);const t=e.useDashboardStore(s=>s.showFilters),r=e.useDashboardStore(s=>s.isVisualEditing);return e.useDashboardStore(s=>s.bookmarkKey),e.jsxRuntimeExports.jsxs("div",{role:"dashboard-plus-main",className:e.cn("grow",{hidden:r,flex:!r}),children:[e.jsxRuntimeExports.jsx(e.DashboardTabs,{}),t&&e.jsxRuntimeExports.jsx("div",{role:"filter-aside-container",className:"flex",children:e.jsxRuntimeExports.jsx(Os,{})})]})}function qs(){const t=e.useDashboardStore(n=>n.dashboard),r=e.useDashboardStore(n=>n.actions.setDashboard),s=e.useDashboardStore(n=>n.showDashboardJSON);return e.useDashboardStore(n=>n.actions.setShowDashboardJSON),e.jsxRuntimeExports.jsx("div",{className:e.cn(" p-2",{hidden:!s}),children:e.jsxRuntimeExports.jsx(e.de,{onChange:n=>{if(n)try{JSON.parse(n),r(JSON.parse(n))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto ",value:JSON.stringify(t,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})})}function Bs({showControls:t=!1,showFooter:r=!0,...s}){return e.jsxRuntimeExports.jsxs(e.SemaphorContextProvider,{dashboardProps:s,children:[e.jsxRuntimeExports.jsx(e.Te,{}),e.jsxRuntimeExports.jsxs(e.UXProvider,{children:[e.jsxRuntimeExports.jsx(qs,{}),e.jsxRuntimeExports.jsxs(e.DashboardPanel,{...s,children:[t&&e.jsxRuntimeExports.jsx(Ht,{}),e.jsxRuntimeExports.jsx(Ls,{}),e.jsxRuntimeExports.jsx(Ms,{})]})]})]})}exports.DashboardPlus=Bs;exports.LoaderCircle=me;exports.SelectComponent=de;exports.useEditorAside=ae;