react-semaphor 0.0.166 → 0.0.167
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.
- package/dist/chunks/dashboard-plus-F8Qcpt0u.js +228 -0
- package/dist/chunks/{dashboard-plus-wejLSIU3.js → dashboard-plus-lCKn8oec.js} +1485 -1476
- package/dist/chunks/index-4QmGFtgB.js +364 -0
- package/dist/chunks/{index-W0tbqq57.js → index-kCkDBaJC.js} +6516 -6486
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/dashboard-plus-3yyvwjLC.js +0 -228
- package/dist/chunks/index-qttr0XCK.js +0 -364
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";const t=require("./index-4QmGFtgB.js"),T=require("react");/**
|
|
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 ui=t.createLucideIcon("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
|
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 ci=t.createLucideIcon("AreaChart",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M7 12v5h12V8l-5 5-4-4Z",key:"zxz28u"}]]);/**
|
|
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 $t=t.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"}]]);/**
|
|
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 pi=t.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 xi=t.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 di=t.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"}]]);/**
|
|
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 sr=t.createLucideIcon("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
|
|
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 mi=t.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"}]]);/**
|
|
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 hi=t.createLucideIcon("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
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 fi=t.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 gi=t.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 ji=t.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 Kt=t.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 yi=t.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 Ei=t.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 bi=t.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 Si=t.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"}]]);/**
|
|
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 ki=t.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"}]]);/**
|
|
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 or=t.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"}]]);/**
|
|
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 lr=t.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"}]]);/**
|
|
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 Ri=t.createLucideIcon("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 Ci=t.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"}]]);/**
|
|
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 ar=t.createLucideIcon("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 wi=t.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 ur=t.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 vi=t.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 Ni=t.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"}]]);/**
|
|
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 Wt=t.createLucideIcon("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
|
|
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 Ii=t.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 Ai=t.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 Ti=t.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 Li=t.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 zi(){const[e,n]=T.useState(""),[r,i]=T.useState(!1),[s,l]=T.useState(!1),o=t.useDashboardStore(u=>u.dashboard);function a(){const u=t.getDashbaordStateWithoutData(o),c=t.getBookmarkKey(o.id),x=JSON.parse(localStorage.getItem(c)||"[]");if(x.some(m=>m.name===e)){i(!0);return}x.push({name:e,template:u}),localStorage.setItem(c,JSON.stringify(x)),l(!1)}return t.jsxRuntimeExports.jsxs(t.Dialog,{open:s,onOpenChange:l,children:[t.jsxRuntimeExports.jsx(t.DialogTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsxs(t.Button,{variant:"outline",className:"h-7 p-2",size:"sm",children:[t.jsxRuntimeExports.jsx(ar,{className:" mr-2 h-4 w-4",strokeWidth:1.5}),"Add Lens"]})}),t.jsxRuntimeExports.jsxs(t.DialogContent,{className:"sm:max-w-[425px]",children:[t.jsxRuntimeExports.jsxs(t.DialogHeader,{children:[t.jsxRuntimeExports.jsx(t.DialogTitle,{children:"Add a Lens"}),t.jsxRuntimeExports.jsx(t.DialogDescription,{children:"Lenses are private by default and are only visible to you."})]}),t.jsxRuntimeExports.jsx("div",{className:"grid gap-4 py-4",children:t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"text-right",children:"Name"}),t.jsxRuntimeExports.jsx(t.Input,{value:e,onChange:u=>{r&&i(!1),n(u.target.value)},id:"name",className:"col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"})]})}),r&&t.jsxRuntimeExports.jsx("p",{className:"text-sm",children:"The bookmark name already exists. Use a differnet name."}),t.jsxRuntimeExports.jsx(t.DialogFooter,{children:t.jsxRuntimeExports.jsx(t.Button,{variant:"outline",type:"submit",disabled:!e,onClick:a,children:"Save"})})]})]})}function Oi(){const[e,n]=T.useState(!1),[r,i]=T.useState(""),s=t.useDashboardStore(d=>d.dashboard),l=t.useDashboardStore(d=>d.bookmarkKey),[o,a]=T.useState([]),u=t.useDashboardStore(d=>d.actions.setDashboard),c=t.useDashboardStore(d=>d.actions.setFilterValues),x=t.useDashboardStore(d=>d.actions.setBookmarkKey);T.useEffect(()=>{const d=t.getBookmarkKey(s.id),g=JSON.parse(localStorage.getItem(d)||"[]");a(g);const E=g.find(k=>k.default);E&&E.name===l&&i(E.name)},[e,s,l]);function p(d){if(d===r)return;const g=o.find(k=>k.name===d),E=g==null?void 0:g.template;E&&(u(E),c(g.filterValues||[]),x(d==="Original"?"":d)),i(d)}function m(d){const g=t.getBookmarkKey(s.id),k=JSON.parse(localStorage.getItem(g)||"[]").filter(y=>y.name!==d);localStorage.setItem(g,JSON.stringify(k)),a(k)}return t.jsxRuntimeExports.jsxs(t.DropdownMenu,{open:e,onOpenChange:n,children:[t.jsxRuntimeExports.jsx(t.DropdownMenuTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.Button,{variant:"outline",className:"h-7 p-2",children:t.jsxRuntimeExports.jsx(mi,{className:"h-4 w-4",strokeWidth:1.5})})}),t.jsxRuntimeExports.jsxs(t.DropdownMenuContent,{className:"w-56",children:[t.jsxRuntimeExports.jsx(t.DropdownMenuLabel,{children:"Lenses"}),t.jsxRuntimeExports.jsx(t.DropdownMenuSeparator,{}),t.jsxRuntimeExports.jsxs(t.DropdownMenuRadioGroup,{value:r,onValueChange:p,children:[t.jsxRuntimeExports.jsx(t.DropdownMenuRadioItem,{value:"Original",children:"Original"}),o.filter(d=>d.name!="Original").map((d,g)=>t.jsxRuntimeExports.jsxs(t.DropdownMenuRadioItem,{className:"xbg-red-100 flex justify-between",value:d.name,defaultChecked:d.name===l,children:[t.jsxRuntimeExports.jsx("p",{children:d.name}),t.jsxRuntimeExports.jsx(t.Cross2Icon,{onClick:E=>{E.preventDefault(),m(d.name)},className:"h-3 w-3 hover:cursor-pointer",strokeWidth:1.5})]},g))]})]})]})}function Di(){const[e,n]=T.useState(!1),r=t.useDashboardStore(l=>l.dashboard),i=t.useDashboardStore(l=>l.bookmarkKey);T.useEffect(()=>{if(!i){n(!1);return}const l=t.getBookmarkKey(r.id),a=JSON.parse(localStorage.getItem(l)||"[]").find(u=>u.name===i);n(a?a.default:!1)},[i,r.id]);function s(l){if(n(l),!i)return;const o=t.getBookmarkKey(r.id),u=JSON.parse(localStorage.getItem(o)||"[]").map(c=>(c.name===i?c.default=l:c.default=!1,c));console.log(u),localStorage.setItem(o,JSON.stringify(u))}return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.Checkbox,{checked:e,onCheckedChange:s,id:"terms"}),t.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 Fi(){const e=t.useDashboardStore(y=>y.bookmarkKey),n=t.useDashboardStore(y=>y.dashboard);t.useDashboardStore(y=>y.selectedSheetId);const r=t.useDashboardStore(y=>y.isDashboardEditing),i=t.useDashboardStore(y=>y.filterValues),s=t.useDashboardStore(y=>y.isVisualEditing),l=t.useDashboardStore(y=>y.showFilters);t.useDashboardStore(y=>y.showDashboardJSON);const o=t.useDashboardStore(y=>y.onSaveFunction),a=t.useDashboardStore(y=>y.actions.setShowFilters),{addFrame:u,setSelectedFrameId:c}=t.useDashboardStore(y=>y.actions),{getSelectedSheet:x,setIsDashboardEditing:p,setShowDashboardJSON:m}=t.useDashboardStore(y=>y.actions),d=x(),g=()=>{if(!r||!d)return;const y={id:t.v4(),title:"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}]},type:"bar",sql:"select COUNT(*) from YOUR_TABLE",data:[]},w={id:t.v4(),cards:[y],activeCardId:y.id};u(d.id,w),c(w.id)},E=()=>{p(!0)};function k(){if(!e||e==="")return;const y=t.getDashbaordStateWithoutData(n),w=t.getBookmarkKey(n.id),R=JSON.parse(localStorage.getItem(w)||"[]"),I=R.findIndex(O=>O.name===e);I!==-1?R[I]={name:e,template:y,default:R[I].default,filterValues:i}:R.push({name:e,template:y,filterValues:i}),localStorage.setItem(w,JSON.stringify(R)),o==null||o(y)}return s?null:t.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pt-2",role:"dashboard-controls",children:[!s&&t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxRuntimeExports.jsx(t.Label,{children:e}),!!e&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("span",{className:"text-muted-foreground",children:"|"}),t.jsxRuntimeExports.jsx(Di,{})]})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[r&&!s&&t.jsxRuntimeExports.jsx(zi,{}),!s&&t.jsxRuntimeExports.jsx(Oi,{}),r&&!s&&t.jsxRuntimeExports.jsxs(t.Button,{variant:"outline",className:"h-7 p-2",size:"sm",disabled:!r,onClick:g,children:[t.jsxRuntimeExports.jsx(ar,{className:"mr-2 h-4 w-4",strokeWidth:1.5}),"Add Frame"]}),!r&&t.jsxRuntimeExports.jsx(t.Button,{variant:"outline",className:"h-7 p-2",onClick:E,size:"sm",children:t.jsxRuntimeExports.jsx(or,{className:"h-4 w-4",strokeWidth:1.5})}),r&&!s&&t.jsxRuntimeExports.jsx(t.Button,{variant:"outline",role:"close",className:"h-7 p-2",onClick:()=>{p(!1),m(!1)},size:"sm",children:t.jsxRuntimeExports.jsx(t.Cross2Icon,{className:"h-4 w-4",strokeWidth:1.5})}),r&&!s&&t.jsxRuntimeExports.jsx(t.Button,{className:"h-7 p-2",variant:"outline",onClick:k,size:"sm",children:t.jsxRuntimeExports.jsx(wi,{className:"h-4 w-4",strokeWidth:1.5})}),!l&&!s&&r&&t.jsxRuntimeExports.jsx(t.Button,{className:"h-7 p-2",variant:"outline",onClick:()=>a(!0),size:"sm",children:t.jsxRuntimeExports.jsx(sr,{className:"h-4 w-4",strokeWidth:1.5})}),!s&&r&&!1,!s&&!1]})]})}function Xe({title:e,items:n,value:r,isLoading:i,isError:s,connectionTooltip:l,onChange:o,className:a,showIcon:u=!0,disabled:c=!1}){const x=i?"Loading...":s?"Error":r;function p(){if(e==="Connection")return t.jsxRuntimeExports.jsx(Ci,{className:"size-4 rotate-90"});if(e==="Database")return t.jsxRuntimeExports.jsx(xi,{className:"size-4"});if(e==="Schema")return t.jsxRuntimeExports.jsx(ki,{className:"size-4"});if(e==="Table")return t.jsxRuntimeExports.jsx(Wt,{className:"size-4"})}return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[u&&t.jsxRuntimeExports.jsx("div",{className:"shrink-0",children:l?t.jsxRuntimeExports.jsxs(t.Tooltip,{children:[t.jsxRuntimeExports.jsx(t.TooltipTrigger,{children:p()}),t.jsxRuntimeExports.jsx(t.TooltipContent,{className:"text-xs",align:"start",children:l})]}):p()}),t.jsxRuntimeExports.jsxs(t.Select,{disabled:c,value:x,onValueChange:o,children:[t.jsxRuntimeExports.jsx(t.SelectTrigger,{className:t.cn("h-9 w-[190px] focus:ring-1 focus:ring-offset-0",a),children:t.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:i?"Loading...":s?"Error":`Select ${e}`})}),t.jsxRuntimeExports.jsx(t.SelectContent,{children:t.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[i?t.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Loading..."}):t.jsxRuntimeExports.jsx(t.SelectLabel,{children:e}),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:n&&n.map((m,d)=>t.jsxRuntimeExports.jsx(t.SelectItem,{value:m.id,children:m.name},d))}),(i||s)&&t.jsxRuntimeExports.jsx(t.SelectItem,{value:x,children:x})]})})]})]})}function Mi({column:e}){const[n,r]=T.useState(!1),i=t.useEditorStore(x=>x.selectedTableName),s=t.useEditorStore(x=>x.selectedSchemaName),l=t.useEditorStore(x=>x.sqlGen),o=t.useEditorStore(x=>x.actions.setSqlGen),a=t.useEditorStore(x=>x.actions.setCardSql),u=t.useEditorStore(x=>x.actions.setRunSql);function c(x,p){const m=t.createSqlGenConfig(x,l,p);o(m);const d=t.getSql(m,t.fmt(s||""),t.fmt(i));d&&(a(d),u(!0)),r(!1)}return t.jsxRuntimeExports.jsxs(t.Popover,{open:n,onOpenChange:r,children:[t.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.ChevronDown,{className:"h-4 w-4 cursor-pointer text-foreground/40"})}),t.jsxRuntimeExports.jsx(t.PopoverContent,{align:"center",className:"w-18 rounded-md p-0 shadow-none",children:t.jsxRuntimeExports.jsxs("ul",{className:"text-xs",children:[t.jsxRuntimeExports.jsx("li",{onClick:()=>c(e,"COUNT"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Count"}),t.jsxRuntimeExports.jsx("li",{onClick:()=>c(e,"AVG"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Avg"}),t.jsxRuntimeExports.jsx("li",{onClick:()=>c(e,"SUM"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Sum"}),t.jsxRuntimeExports.jsx("li",{onClick:()=>c(e,"MAX"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Max"}),t.jsxRuntimeExports.jsx("li",{onClick:()=>c(e,"MIN"),className:"cursor-pointer p-1 px-3 transition-colors hover:bg-muted",children:"Min"})]})})]})}function cr({column:e}){return t.jsxRuntimeExports.jsxs(t.Tooltip,{children:[t.jsxRuntimeExports.jsx(t.$a093c7e1ec25a057$export$8c610744efcf8a1d,{asChild:!0,children:t.TEXT_DATA_TYPES.includes(e.data_type.toLowerCase())?t.jsxRuntimeExports.jsx(Ti,{className:"size-3"}):t.NUMBER_DATA_TYPES.includes(e.data_type.toLowerCase())?t.jsxRuntimeExports.jsx(gi,{className:"size-3"}):t.DATE_DATA_TYPES.includes(e.data_type.toLowerCase())?t.jsxRuntimeExports.jsx(t.Calendar,{className:"size-3"}):t.BOOLEAN_DATA_TYPES.includes(e.data_type.toLowerCase())?t.jsxRuntimeExports.jsx(Ai,{className:"size-3"}):t.jsxRuntimeExports.jsx(vi,{className:"size-3"})}),t.jsxRuntimeExports.jsx(t.TooltipContent,{children:t.jsxRuntimeExports.jsx("p",{className:"font-mono text-xs",children:e.data_type})})]})}function Pi({schemaName:e,tableName:n,columns:r,status:i}){const s=t.useEditorStore(p=>p.sqlGen),l=t.useEditorStore(p=>p.actions.setRunSql),o=t.useEditorStore(p=>p.actions.setSqlGen),a=t.useEditorStore(p=>p.actions.setIsShowingVisual),u=t.useEditorStore(p=>p.actions.setCardSql);function c(p){const m=t.createSqlGenConfig(p,s);o(m);const d=t.getSql(m,t.fmt(e),t.fmt(n));d&&(u(d),l(!0))}function x(){let m=t.getQualifiedTableName(e,n);(g=>g.charAt(0)===g.charAt(0).toUpperCase())(n)&&(m=`"${n}"`),a(!1),u(`SELECT * FROM ${m} LIMIT 10`),l(!0)}return t.jsxRuntimeExports.jsxs("div",{className:"flex grow flex-col space-y-4 px-6",children:[t.jsxRuntimeExports.jsx("div",{className:"font-medium",children:t.jsxRuntimeExports.jsxs(t.Button,{disabled:i!=="Success",onClick:x,size:"sm",variant:"secondary",className:"flex w-full",children:[i!=="Success"?t.jsxRuntimeExports.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"}):t.jsxRuntimeExports.jsx(Ni,{className:"mr-2 size-4"}),"Show top 10 rows"]})}),t.jsxRuntimeExports.jsxs(t.ScrollArea,{className:"flex-1 basis-0 overflow-y-auto border-b border-t border-muted py-3",children:[r==null?void 0:r.map(p=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>c(p),className:t.cn("mx-3 flex cursor-pointer items-center justify-between rounded px-2 py-[6px] text-sm transition-colors hover:bg-muted/50",{"bg-muted":t.isColumnInSqlGen(p,s)}),children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(cr,{column:p}),t.jsxRuntimeExports.jsx("span",{children:p.column_name})]}),t.NUMBER_DATA_TYPES.includes(p.data_type)&&t.jsxRuntimeExports.jsx("div",{onClick:m=>m.stopPropagation(),className:"flex items-center justify-end",children:t.jsxRuntimeExports.jsx(Mi,{column:p})})]},p.column_name)),t.jsxRuntimeExports.jsx(t.ScrollBar,{orientation:"vertical"}),t.jsxRuntimeExports.jsx(t.ScrollBar,{orientation:"horizontal"})]})]})}function pr(e,n){var qe,be,Ve,Te;let r=T.useMemo(()=>[],[]);const i=t.useSemaphorContext().authToken||e,s=t.useEditorStore(z=>z.selectedConnectionId),l=t.useEditorStore(z=>z.selectedDatabaseName),o=t.useEditorStore(z=>z.selectedSchemaName),a=t.useEditorStore(z=>z.selectedTableName),u=t.useEditorStore(z=>z.actions.setCurrentColumns),c=t.useEditorStore(z=>z.actions.setSelectedConnectionId),x=t.useEditorStore(z=>z.actions.setSelectedDatabaseName),p=t.useEditorStore(z=>z.actions.setSelectedSchemaName),m=t.useEditorStore(z=>z.actions.setSelectedTableName),d=t.useEditorStore(z=>z.actions.setCardSql);function g(z){return s&&l&&o&&l!=="NA"?!0:s&&z==="API"?!1:!!(s&&z==="S3")}function E(z){return!!(s&&l&&l!=="NA"&&o&&a||s&&(z==="S3"||z==="API"))}function k(z){return s&&z?!(z==="API"||z==="S3"):!1}const{data:y,isLoading:w,isError:R}=t.useQuery({queryKey:["connections"],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/connections",(i==null?void 0:i.accessToken)||""),enabled:!!(i!=null&&i.accessToken)}),I=y==null?void 0:y.connections.find(z=>z.id===s),O=I==null?void 0:I.type,b=(I==null?void 0:I.type)==="API"||(I==null?void 0:I.type)==="S3",{data:D,isLoading:W,isFetching:H,isError:V,refetch:A}=t.useQuery({queryKey:["databases",s],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/databases",(i==null?void 0:i.accessToken)||"",{connection_id:s}),enabled:k(O)}),{data:v,isLoading:$,isFetching:K,isError:B,refetch:G}=t.useQuery({queryKey:["schemas",s,l],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/schemas",(i==null?void 0:i.accessToken)||"",{connection_id:s,database_name:l}),enabled:!!s&&!!l&&!b&&l!=="NA"}),{data:L,isLoading:M,isFetching:N,isError:h,refetch:J}=t.useQuery({queryKey:["tables",s,l,o],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/tables",(i==null?void 0:i.accessToken)||"",{connection_id:s,database_name:l,schema_name:o}),enabled:g(O)}),{data:X,isLoading:f,isFetching:ne,isError:ue}=t.useQuery({queryKey:["columns",s,l,o,a],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/columns",(i==null?void 0:i.accessToken)||"",{connection_id:s,database_name:l,schema_name:o,table_name:a}),enabled:E(O)});T.useEffect(()=>{u(r)},[X,u,r]),T.useEffect(()=>{},[b,d,m,p,x,I]);const ee=(I==null?void 0:I.type)==="API"?(qe=I==null?void 0:I.type)==null?void 0:qe.toLowerCase():a||"",xe=b?"":o||"";function oe(z){p(z),m("")}function ie(z){x(z),p(""),m("")}function le(z){c(z)}D&&((be=D==null?void 0:D.databases)==null?void 0:be.length)>0,v&&((Ve=v==null?void 0:v.schemas)==null?void 0:Ve.length)>0,X&&((Te=X==null?void 0:X.columns)==null?void 0:Te.length)>0&&(r=X.columns.map(z=>({...z,data_type:z.data_type.toLowerCase()}))),V&&(r=[]),(ue||R)&&(r=[]);const Ee=y==null?void 0:y.connections.map(z=>({id:z.id,name:z.name,type:z.type})),_e=D==null?void 0:D.databases.map(z=>({id:z.database_name,name:z.database_name})),Ie=v==null?void 0:v.schemas.map(z=>({id:z.schema_name,name:z.schema_name})),Ae=L==null?void 0:L.tables.map(z=>({id:z.table_name,name:z.table_name}));return{connectionItems:Ee,isConnectionsLoading:w,isConnectionsError:R,databaseItems:_e,isDatabasesLoadingOrFetching:W||H,isDatabaseError:V,schemaItems:Ie,isSchemaLoadingOrFetching:$||K,isSchemaError:B,tableItems:Ae,isTableLoadingOrFetching:M||N,isTableError:h,columns:r,isColumnsLoadingOrFetching:f||ne,isColumnsError:ue,isNonDbConnection:b,connectionType:O,tableName:ee,schemaName:xe,handleConnectionChange:le,handleDatabaseChange:ie,handleSchemaChange:oe}}function xr({ColumnsComponent:e}){var L;const n=t.useEditorStore(M=>M.selectedConnectionId),r=t.useEditorStore(M=>M.selectedDatabaseName),i=t.useEditorStore(M=>M.selectedSchemaName),s=t.useEditorStore(M=>M.selectedTableName),l=t.useEditorStore(M=>M.actions.setSelectedTableName),{connectionItems:o,schemaItems:a,databaseItems:u,tableItems:c,columns:x,isConnectionsLoading:p,isConnectionsError:m,isDatabasesLoadingOrFetching:d,isDatabaseError:g,isSchemaLoadingOrFetching:E,isSchemaError:k,isColumnsError:y,isColumnsLoadingOrFetching:w,isTableLoadingOrFetching:R,isTableError:I,connectionType:O,isNonDbConnection:b,handleConnectionChange:D,handleDatabaseChange:W,handleSchemaChange:H,tableName:V,schemaName:A}=pr();function v(){return e?e(A,V,x):t.jsxRuntimeExports.jsx(Pi,{schemaName:A,tableName:V,columns:x,status:w?"Loading...":y?"Error":"Success"})}function $(){window.location.href="mailto:support@semaphor.cloud?subject=Help&body=I need help with..."}function K(){return O==="S3"||O==="API"?null:t.jsxRuntimeExports.jsx(Xe,{onChange:W,isError:g,isLoading:d,items:u,value:r||"",title:"Database"})}function B(){return O==="S3"||O==="API"?null:t.jsxRuntimeExports.jsx(Xe,{onChange:H,isError:k,isLoading:E,items:a,value:i||"",title:"Schema"})}function G(){return O==="API"?null:t.jsxRuntimeExports.jsx(Xe,{onChange:l,isError:I,items:c,isLoading:R,value:s||"",title:"Table"})}return t.jsxRuntimeExports.jsxs("aside",{className:"xbg-red-100 flex grow flex-col justify-between",children:[t.jsxRuntimeExports.jsxs("section",{className:"space-y-3 px-6 py-4",children:[t.jsxRuntimeExports.jsx(Xe,{items:o,title:"Connection",value:n||"",onChange:D,isLoading:p,isError:m,connectionTooltip:((L=o==null?void 0:o.find(M=>M.id===n))==null?void 0:L.type)||""}),K(),B(),G()]}),v(),t.jsxRuntimeExports.jsx("div",{className:"flex items-end justify-center px-6 py-4",children:t.jsxRuntimeExports.jsxs(t.Button,{onClick:$,size:"sm",variant:"secondary",className:"w-full",children:[t.jsxRuntimeExports.jsx(Si,{className:"mr-2 size-4"}),"Help"]})})]})}const Ot=({className:e,...n})=>t.jsxRuntimeExports.jsx(t.PanelGroup,{className:t.cn("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),Ue=t.Panel,Dt=({withHandle:e,className:n,...r})=>t.jsxRuntimeExports.jsx(t.PanelResizeHandle,{className:t.cn("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",n),...r,children:e&&t.jsxRuntimeExports.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:t.jsxRuntimeExports.jsx(hi,{className:"h-2.5 w-2.5"})})});function Bi(e){const n=e.toUpperCase().indexOf("WHERE"),r=e.toUpperCase().indexOf("GROUP BY"),i=e.toUpperCase().indexOf("LIMIT"),s=e.toUpperCase().indexOf("ORDER BY");let l=e.length;if(s!==-1&&(l=s),i!==-1&&i<l&&(l=i),n!==-1){const o=e.substring(0,n),a=e.substring(n);return`${o} {{ filters | where }} AND ${a.substring(6)}`}else if(r!==-1){const o=e.substring(0,r),a=e.substring(r);return`${o} {{ filters | where }} ${a}`}else{const o=e.substring(0,l),a=e.substring(l);return`${o} {{ filters | where }} ${a}`}}function _i({error:e,setShowAIDialog:n,setUserInputforAI:r,setTriggerAIRun:i}){return t.jsxRuntimeExports.jsxs(t.HoverCard,{openDelay:0,children:[t.jsxRuntimeExports.jsx(t.HoverCardTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.Button,{variant:"link",className:" p-0 h-5",children:t.jsxRuntimeExports.jsx(pi,{className:"h-4 w-4 text-red-500"})})}),t.jsxRuntimeExports.jsx(t.HoverCardContent,{align:"start",className:" min-w-fit max-w-[500px]",children:t.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:t.jsxRuntimeExports.jsxs("div",{className:"grow space-y-1 flex flex-col ",children:[t.jsxRuntimeExports.jsxs(t.Button,{onClick:()=>{n(!0),r(e),i(!0)},size:"sm",variant:"outline",children:[t.jsxRuntimeExports.jsx(fi,{className:"h-4 w-4 mr-2"}),"Fix It"]}),t.jsxRuntimeExports.jsx(t.ScrollArea,{className:" min-h-0 max-h-[250px] overflow-scroll ",children:t.jsxRuntimeExports.jsx("p",{className:" overflow-auto text-sm leading-relaxed font-mono ",children:e})})]})})})]})}function qi({text:e,onCheckedChange:n,checked:r}){return t.jsxRuntimeExports.jsxs("div",{className:"xbg-red-100 ml-6 flex items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Checkbox,{checked:r,onCheckedChange:n}),t.jsxRuntimeExports.jsx("label",{className:"text-xs leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})]})}function Vi(){const{authToken:e}=t.useSemaphorContext(),n=T.useRef(null),r=t.useEditorStore(a=>a.applyFilters),[i,s]=T.useState(""),l=t.useEditorStore(a=>a.filterValues),o=t.useEditorStore(a=>a.card.sql);return t.jsxRuntimeExports.jsxs(t.HoverCard,{openDelay:0,onOpenChange:async a=>{if(!a)return;console.log("onOpenChange");const u=await t.postRequest("https://semaphor.cloud/api/v1/filter-sql",(e==null?void 0:e.accessToken)||"",{sql:o,active_filters:l});console.log(u),u.sql?(console.log(u.records),s(u.sql)):s("Error")},children:[t.jsxRuntimeExports.jsx(t.HoverCardTrigger,{asChild:!0,children:r&&t.jsxRuntimeExports.jsx("p",{className:"p-0 text-xs hover:cursor-pointer",children:"| Filter Query"})}),t.jsxRuntimeExports.jsxs(t.HoverCardContent,{align:"end",className:"w-[600px]",children:[t.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:t.jsxRuntimeExports.jsx("div",{className:"rounded-sm bg-muted p-2",children:t.jsxRuntimeExports.jsxs("code",{ref:n,className:"font-mono text-sm",children:[i,t.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{onClick:()=>t.copyToClipboard(n),className:"ml-3 inline-block h-4 w-4 opacity-70 hover:cursor-pointer hover:opacity-100"})]})})}),t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[t.jsxRuntimeExports.jsx(t.InfoCircledIcon,{className:"h-4 w-4 opacity-70"}),t.jsxRuntimeExports.jsx("span",{className:"text-xs text-muted-foreground",children:"A preview of the query with filters applied."})]})]})]})}function Hi(e,n){const r=n||{};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Ui=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$i=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ki={};function pn(e,n){return((n||Ki).jsx?$i:Ui).test(e)}const Wi=/[ \t\n\f\r]/g;function Qi(e){return typeof e=="object"?e.type==="text"?xn(e.value):!1:xn(e)}function xn(e){return e.replace(Wi,"")===""}class tt{constructor(n,r,i){this.property=n,this.normal=r,i&&(this.space=i)}}tt.prototype.property={};tt.prototype.normal={};tt.prototype.space=null;function dr(e,n){const r={},i={};let s=-1;for(;++s<e.length;)Object.assign(r,e[s].property),Object.assign(i,e[s].normal);return new tt(r,i,n)}function Ft(e){return e.toLowerCase()}class je{constructor(n,r){this.property=n,this.attribute=r}}je.prototype.space=null;je.prototype.boolean=!1;je.prototype.booleanish=!1;je.prototype.overloadedBoolean=!1;je.prototype.number=!1;je.prototype.commaSeparated=!1;je.prototype.spaceSeparated=!1;je.prototype.commaOrSpaceSeparated=!1;je.prototype.mustUseProperty=!1;je.prototype.defined=!1;let Gi=0;const q=Pe(),se=Pe(),mr=Pe(),C=Pe(),Y=Pe(),$e=Pe(),he=Pe();function Pe(){return 2**++Gi}const Mt=Object.freeze(Object.defineProperty({__proto__:null,boolean:q,booleanish:se,commaOrSpaceSeparated:he,commaSeparated:$e,number:C,overloadedBoolean:mr,spaceSeparated:Y},Symbol.toStringTag,{value:"Module"})),kt=Object.keys(Mt);class Qt extends je{constructor(n,r,i,s){let l=-1;if(super(n,r),dn(this,"space",s),typeof i=="number")for(;++l<kt.length;){const o=kt[l];dn(this,kt[l],(i&Mt[o])===Mt[o])}}}Qt.prototype.defined=!0;function dn(e,n,r){r&&(e[n]=r)}const Ji={}.hasOwnProperty;function We(e){const n={},r={};let i;for(i in e.properties)if(Ji.call(e.properties,i)){const s=e.properties[i],l=new Qt(i,e.transform(e.attributes||{},i),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(l.mustUseProperty=!0),n[i]=l,r[Ft(i)]=i,r[Ft(l.attribute)]=i}return new tt(n,r,e.space)}const hr=We({space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),fr=We({space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function gr(e,n){return n in e?e[n]:n}function jr(e,n){return gr(e,n.toLowerCase())}const yr=We({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:jr,properties:{xmlns:null,xmlnsXLink:null}}),Er=We({transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:se,ariaAutoComplete:null,ariaBusy:se,ariaChecked:se,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:Y,ariaCurrent:null,ariaDescribedBy:Y,ariaDetails:null,ariaDisabled:se,ariaDropEffect:Y,ariaErrorMessage:null,ariaExpanded:se,ariaFlowTo:Y,ariaGrabbed:se,ariaHasPopup:null,ariaHidden:se,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Y,ariaLevel:C,ariaLive:null,ariaModal:se,ariaMultiLine:se,ariaMultiSelectable:se,ariaOrientation:null,ariaOwns:Y,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:se,ariaReadOnly:se,ariaRelevant:null,ariaRequired:se,ariaRoleDescription:Y,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:se,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null}}),Xi=We({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:jr,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$e,acceptCharset:Y,accessKey:Y,action:null,allow:null,allowFullScreen:q,allowPaymentRequest:q,allowUserMedia:q,alt:null,as:null,async:q,autoCapitalize:null,autoComplete:Y,autoFocus:q,autoPlay:q,blocking:Y,capture:null,charSet:null,checked:q,cite:null,className:Y,cols:C,colSpan:null,content:null,contentEditable:se,controls:q,controlsList:Y,coords:C|$e,crossOrigin:null,data:null,dateTime:null,decoding:null,default:q,defer:q,dir:null,dirName:null,disabled:q,download:mr,draggable:se,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:q,formTarget:null,headers:Y,height:C,hidden:q,high:C,href:null,hrefLang:null,htmlFor:Y,httpEquiv:Y,id:null,imageSizes:null,imageSrcSet:null,inert:q,inputMode:null,integrity:null,is:null,isMap:q,itemId:null,itemProp:Y,itemRef:Y,itemScope:q,itemType:Y,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:q,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:q,muted:q,name:null,nonce:null,noModule:q,noValidate:q,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:q,optimum:C,pattern:null,ping:Y,placeholder:null,playsInline:q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:q,referrerPolicy:null,rel:Y,required:q,reversed:q,rows:C,rowSpan:C,sandbox:Y,scope:null,scoped:q,seamless:q,selected:q,shadowRootDelegatesFocus:q,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:se,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:q,useMap:null,value:se,width:C,wrap:null,align:null,aLink:null,archive:Y,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:q,declare:q,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:q,noHref:q,noShade:q,noWrap:q,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:se,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:q,disableRemotePlayback:q,prefix:null,property:null,results:C,security:null,unselectable:null}}),Yi=We({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:gr,properties:{about:he,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:Y,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:q,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:$e,g2:$e,glyphName:$e,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:he,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Y,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:he,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:he,rev:he,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:he,requiredFeatures:he,requiredFonts:he,requiredFormats:he,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:he,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:he,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:he,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),Zi=/^data[-\w.:]+$/i,mn=/-[a-z]/g,es=/[A-Z]/g;function ts(e,n){const r=Ft(n);let i=n,s=je;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Zi.test(n)){if(n.charAt(4)==="-"){const l=n.slice(5).replace(mn,rs);i="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=n.slice(4);if(!mn.test(l)){let o=l.replace(es,ns);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}s=Qt}return new s(i,n)}function ns(e){return"-"+e.toLowerCase()}function rs(e){return e.charAt(1).toUpperCase()}const is={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},ss=dr([fr,hr,yr,Er,Xi],"html"),Gt=dr([fr,hr,yr,Er,Yi],"svg");function os(e){return e.join(" ").trim()}var br={},hn=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,ls=/\n/g,as=/^\s*/,us=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,cs=/^:\s*/,ps=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,xs=/^[;\s]*/,ds=/^\s+|\s+$/g,ms=`
|
|
162
|
+
`,fn="/",gn="*",Me="",hs="comment",fs="declaration",gs=function(e,n){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];n=n||{};var r=1,i=1;function s(g){var E=g.match(ls);E&&(r+=E.length);var k=g.lastIndexOf(ms);i=~k?g.length-k:i+g.length}function l(){var g={line:r,column:i};return function(E){return E.position=new o(g),c(),E}}function o(g){this.start=g,this.end={line:r,column:i},this.source=n.source}o.prototype.content=e;function a(g){var E=new Error(n.source+":"+r+":"+i+": "+g);if(E.reason=g,E.filename=n.source,E.line=r,E.column=i,E.source=e,!n.silent)throw E}function u(g){var E=g.exec(e);if(E){var k=E[0];return s(k),e=e.slice(k.length),E}}function c(){u(as)}function x(g){var E;for(g=g||[];E=p();)E!==!1&&g.push(E);return g}function p(){var g=l();if(!(fn!=e.charAt(0)||gn!=e.charAt(1))){for(var E=2;Me!=e.charAt(E)&&(gn!=e.charAt(E)||fn!=e.charAt(E+1));)++E;if(E+=2,Me===e.charAt(E-1))return a("End of comment missing");var k=e.slice(2,E-2);return i+=2,s(k),e=e.slice(E),i+=2,g({type:hs,comment:k})}}function m(){var g=l(),E=u(us);if(E){if(p(),!u(cs))return a("property missing ':'");var k=u(ps),y=g({type:fs,property:jn(E[0].replace(hn,Me)),value:k?jn(k[0].replace(hn,Me)):Me});return u(xs),y}}function d(){var g=[];x(g);for(var E;E=m();)E!==!1&&(g.push(E),x(g));return g}return c(),d()};function jn(e){return e?e.replace(ds,Me):Me}var js=t.commonjsGlobal&&t.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(br,"__esModule",{value:!0});var ys=js(gs);function Es(e,n){var r=null;if(!e||typeof e!="string")return r;var i=(0,ys.default)(e),s=typeof n=="function";return i.forEach(function(l){if(l.type==="declaration"){var o=l.property,a=l.value;s?n(o,a,l):a&&(r=r||{},r[o]=a)}}),r}var yn=br.default=Es;const bs=yn.default||yn,Sr=kr("end"),Jt=kr("start");function kr(e){return n;function n(r){const i=r&&r.position&&r.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Ss(e){const n=Jt(e),r=Sr(e);if(n&&r)return{start:n,end:r}}function Ye(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?En(e.position):"start"in e||"end"in e?En(e):"line"in e||"column"in e?Pt(e):""}function Pt(e){return bn(e&&e.line)+":"+bn(e&&e.column)}function En(e){return Pt(e&&e.start)+"-"+Pt(e&&e.end)}function bn(e){return e&&typeof e=="number"?e:1}class ae extends Error{constructor(n,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let s="",l={},o=!1;if(r&&("line"in r&&"column"in r?l={place:r}:"start"in r&&"end"in r?l={place:r}:"type"in r?l={ancestors:[r],place:r.position}:l={...r}),typeof n=="string"?s=n:!l.cause&&n&&(o=!0,s=n.message,l.cause=n),!l.ruleId&&!l.source&&typeof i=="string"){const u=i.indexOf(":");u===-1?l.ruleId=i:(l.source=i.slice(0,u),l.ruleId=i.slice(u+1))}if(!l.place&&l.ancestors&&l.ancestors){const u=l.ancestors[l.ancestors.length-1];u&&(l.place=u.position)}const a=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=s,this.line=a?a.line:void 0,this.name=Ye(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=o&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual,this.expected,this.note,this.url}}ae.prototype.file="";ae.prototype.name="";ae.prototype.reason="";ae.prototype.message="";ae.prototype.stack="";ae.prototype.column=void 0;ae.prototype.line=void 0;ae.prototype.ancestors=void 0;ae.prototype.cause=void 0;ae.prototype.fatal=void 0;ae.prototype.place=void 0;ae.prototype.ruleId=void 0;ae.prototype.source=void 0;const Xt={}.hasOwnProperty,ks=new Map,Rs=/[A-Z]/g,Cs=/-([a-z])/g,ws=new Set(["table","tbody","thead","tfoot","tr"]),vs=new Set(["td","th"]),Rr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Ns(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let i;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Fs(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=Ds(r,n.jsx,n.jsxs)}const s={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:i,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Gt:ss,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},l=Cr(s,e,void 0);return l&&typeof l!="string"?l:s.create(e,s.Fragment,{children:l||void 0},void 0)}function Cr(e,n,r){if(n.type==="element")return Is(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return As(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Ls(e,n,r);if(n.type==="mdxjsEsm")return Ts(e,n);if(n.type==="root")return zs(e,n,r);if(n.type==="text")return Os(e,n)}function Is(e,n,r){const i=e.schema;let s=i;n.tagName.toLowerCase()==="svg"&&i.space==="html"&&(s=Gt,e.schema=s),e.ancestors.push(n);const l=vr(e,n.tagName,!1),o=Ms(e,n);let a=Zt(e,n);return ws.has(n.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!Qi(u):!0})),wr(e,o,l,n),Yt(o,a),e.ancestors.pop(),e.schema=i,e.create(n,l,o,r)}function As(e,n){if(n.data&&n.data.estree&&e.evaluater){const i=n.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}et(e,n.position)}function Ts(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);et(e,n.position)}function Ls(e,n,r){const i=e.schema;let s=i;n.name==="svg"&&i.space==="html"&&(s=Gt,e.schema=s),e.ancestors.push(n);const l=n.name===null?e.Fragment:vr(e,n.name,!0),o=Ps(e,n),a=Zt(e,n);return wr(e,o,l,n),Yt(o,a),e.ancestors.pop(),e.schema=i,e.create(n,l,o,r)}function zs(e,n,r){const i={};return Yt(i,Zt(e,n)),e.create(n,e.Fragment,i,r)}function Os(e,n){return n.value}function wr(e,n,r,i){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=i)}function Yt(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function Ds(e,n,r){return i;function i(s,l,o,a){const c=Array.isArray(o.children)?r:n;return a?c(l,o,a):c(l,o)}}function Fs(e,n){return r;function r(i,s,l,o){const a=Array.isArray(l.children),u=Jt(i);return n(s,l,o,a,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Ms(e,n){const r={};let i,s;for(s in n.properties)if(s!=="children"&&Xt.call(n.properties,s)){const l=Bs(e,s,n.properties[s]);if(l){const[o,a]=l;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&vs.has(n.tagName)?i=a:r[o]=a}}if(i){const l=r.style||(r.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Ps(e,n){const r={};for(const i of n.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const l=i.data.estree.body[0];l.type;const o=l.expression;o.type;const a=o.properties[0];a.type,Object.assign(r,e.evaluater.evaluateExpression(a.argument))}else et(e,n.position);else{const s=i.name;let l;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const a=i.value.data.estree.body[0];a.type,l=e.evaluater.evaluateExpression(a.expression)}else et(e,n.position);else l=i.value===null?!0:i.value;r[s]=l}return r}function Zt(e,n){const r=[];let i=-1;const s=e.passKeys?new Map:ks;for(;++i<n.children.length;){const l=n.children[i];let o;if(e.passKeys){const u=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(u){const c=s.get(u)||0;o=u+"-"+c,s.set(u,c+1)}}const a=Cr(e,l,o);a!==void 0&&r.push(a)}return r}function Bs(e,n,r){const i=ts(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?Hi(r):os(r)),i.property==="style"){let s=typeof r=="object"?r:_s(e,String(r));return e.stylePropertyNameCase==="css"&&(s=qs(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&i.space?is[i.property]||i.property:i.attribute,r]}}function _s(e,n){const r={};try{bs(n,i)}catch(s){if(!e.ignoreInvalidStyle){const l=s,o=new ae("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=Rr+"#cannot-parse-style-attribute",o}}return r;function i(s,l){let o=s;o.slice(0,2)!=="--"&&(o.slice(0,4)==="-ms-"&&(o="ms-"+o.slice(4)),o=o.replace(Cs,Hs)),r[o]=l}}function vr(e,n,r){let i;if(!r)i={type:"Literal",value:n};else if(n.includes(".")){const s=n.split(".");let l=-1,o;for(;++l<s.length;){const a=pn(s[l])?{type:"Identifier",name:s[l]}:{type:"Literal",value:s[l]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(l&&a.type==="Literal"),optional:!1}:a}i=o}else i=pn(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(i.type==="Literal"){const s=i.value;return Xt.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(i);et(e)}function et(e,n){const r=new ae("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Rr+"#cannot-handle-mdx-estrees-without-createevaluater",r}function qs(e){const n={};let r;for(r in e)Xt.call(e,r)&&(n[Vs(r)]=e[r]);return n}function Vs(e){let n=e.replace(Rs,Us);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function Hs(e,n){return n.toUpperCase()}function Us(e){return"-"+e.toLowerCase()}const Rt={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},$s={};function Ks(e,n){const r=n||$s,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Nr(e,i,s)}function Nr(e,n,r){if(Ws(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Sn(e.children,n,r)}return Array.isArray(e)?Sn(e,n,r):""}function Sn(e,n,r){const i=[];let s=-1;for(;++s<e.length;)i[s]=Nr(e[s],n,r);return i.join("")}function Ws(e){return!!(e&&typeof e=="object")}const kn=document.createElement("i");function en(e){const n="&"+e+";";kn.innerHTML=n;const r=kn.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function Re(e,n,r,i){const s=e.length;let l=0,o;if(n<0?n=-n>s?0:s+n:n=n>s?s:n,r=r>0?r:0,i.length<1e4)o=Array.from(i),o.unshift(n,r),e.splice(...o);else for(r&&e.splice(n,r);l<i.length;)o=i.slice(l,l+1e4),o.unshift(n,0),e.splice(...o),l+=1e4,n+=1e4}function ge(e,n){return e.length>0?(Re(e,e.length,0,n),e):n}const Rn={}.hasOwnProperty;function Qs(e){const n={};let r=-1;for(;++r<e.length;)Gs(n,e[r]);return n}function Gs(e,n){let r;for(r in n){const s=(Rn.call(e,r)?e[r]:void 0)||(e[r]={}),l=n[r];let o;if(l)for(o in l){Rn.call(s,o)||(s[o]=[]);const a=l[o];Js(s[o],Array.isArray(a)?a:a?[a]:[])}}}function Js(e,n){let r=-1;const i=[];for(;++r<n.length;)(n[r].add==="after"?e:i).push(n[r]);Re(e,0,0,i)}function Ir(e,n){const r=Number.parseInt(e,n);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Ke(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Xs=Oe(new RegExp("\\p{P}","u")),ke=Oe(/[A-Za-z]/),fe=Oe(/[\dA-Za-z]/),Ys=Oe(/[#-'*+\--9=?A-Z^-~]/);function Bt(e){return e!==null&&(e<32||e===127)}const _t=Oe(/\d/),Zs=Oe(/[\dA-Fa-f]/),Ar=Oe(/[!-/:-@[-`{-~]/);function P(e){return e!==null&&e<-2}function pe(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}function eo(e){return Ar(e)||Xs(e)}const to=Oe(/\s/);function Oe(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Qe(e){const n=[];let r=-1,i=0,s=0;for(;++r<e.length;){const l=e.charCodeAt(r);let o="";if(l===37&&fe(e.charCodeAt(r+1))&&fe(e.charCodeAt(r+2)))s=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(o=String.fromCharCode(l));else if(l>55295&&l<57344){const a=e.charCodeAt(r+1);l<56320&&a>56319&&a<57344?(o=String.fromCharCode(l,a),s=1):o="�"}else o=String.fromCharCode(l);o&&(n.push(e.slice(i,r),encodeURIComponent(o)),i=r+s+1,o=""),s&&(r+=s,s=0)}return n.join("")+e.slice(i)}function Z(e,n,r,i){const s=i?i-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(u){return Q(u)?(e.enter(r),a(u)):n(u)}function a(u){return Q(u)&&l++<s?(e.consume(u),a):(e.exit(r),n(u))}}const no={tokenize:ro};function ro(e){const n=e.attempt(this.parser.constructs.contentInitial,i,s);let r;return n;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Z(e,n,"linePrefix")}function s(a){return e.enter("paragraph"),l(a)}function l(a){const u=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=u),r=u,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return P(a)?(e.consume(a),e.exit("chunkText"),l):(e.consume(a),o)}}const io={tokenize:so},Cn={tokenize:oo};function so(e){const n=this,r=[];let i=0,s,l,o;return a;function a(R){if(i<r.length){const I=r[i];return n.containerState=I[1],e.attempt(I[0].continuation,u,c)(R)}return c(R)}function u(R){if(i++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,s&&w();const I=n.events.length;let O=I,b;for(;O--;)if(n.events[O][0]==="exit"&&n.events[O][1].type==="chunkFlow"){b=n.events[O][1].end;break}y(i);let D=I;for(;D<n.events.length;)n.events[D][1].end=Object.assign({},b),D++;return Re(n.events,O+1,0,n.events.slice(I)),n.events.length=D,c(R)}return a(R)}function c(R){if(i===r.length){if(!s)return m(R);if(s.currentConstruct&&s.currentConstruct.concrete)return g(R);n.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(Cn,x,p)(R)}function x(R){return s&&w(),y(i),m(R)}function p(R){return n.parser.lazy[n.now().line]=i!==r.length,o=n.now().offset,g(R)}function m(R){return n.containerState={},e.attempt(Cn,d,g)(R)}function d(R){return i++,r.push([n.currentConstruct,n.containerState]),m(R)}function g(R){if(R===null){s&&w(),y(0),e.consume(R);return}return s=s||n.parser.flow(n.now()),e.enter("chunkFlow",{contentType:"flow",previous:l,_tokenizer:s}),E(R)}function E(R){if(R===null){k(e.exit("chunkFlow"),!0),y(0),e.consume(R);return}return P(R)?(e.consume(R),k(e.exit("chunkFlow")),i=0,n.interrupt=void 0,a):(e.consume(R),E)}function k(R,I){const O=n.sliceStream(R);if(I&&O.push(null),R.previous=l,l&&(l.next=R),l=R,s.defineSkip(R.start),s.write(O),n.parser.lazy[R.start.line]){let b=s.events.length;for(;b--;)if(s.events[b][1].start.offset<o&&(!s.events[b][1].end||s.events[b][1].end.offset>o))return;const D=n.events.length;let W=D,H,V;for(;W--;)if(n.events[W][0]==="exit"&&n.events[W][1].type==="chunkFlow"){if(H){V=n.events[W][1].end;break}H=!0}for(y(i),b=D;b<n.events.length;)n.events[b][1].end=Object.assign({},V),b++;Re(n.events,W+1,0,n.events.slice(D)),n.events.length=b}}function y(R){let I=r.length;for(;I-- >R;){const O=r[I];n.containerState=O[1],O[0].exit.call(n,e)}r.length=R}function w(){s.write([null]),l=void 0,s=void 0,n.containerState._closeFlow=void 0}}function oo(e,n,r){return Z(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function wn(e){if(e===null||pe(e)||to(e))return 1;if(eo(e))return 2}function tn(e,n,r){const i=[];let s=-1;for(;++s<e.length;){const l=e[s].resolveAll;l&&!i.includes(l)&&(n=l(n,r),i.push(l))}return n}const qt={name:"attention",tokenize:ao,resolveAll:lo};function lo(e,n){let r=-1,i,s,l,o,a,u,c,x;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(i=r;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&n.sliceSerialize(e[i][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[i][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;u=e[i][1].end.offset-e[i][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const p=Object.assign({},e[i][1].end),m=Object.assign({},e[r][1].start);vn(p,-u),vn(m,u),o={type:u>1?"strongSequence":"emphasisSequence",start:p,end:Object.assign({},e[i][1].end)},a={type:u>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[r][1].start),end:m},l={type:u>1?"strongText":"emphasisText",start:Object.assign({},e[i][1].end),end:Object.assign({},e[r][1].start)},s={type:u>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},a.end)},e[i][1].end=Object.assign({},o.start),e[r][1].start=Object.assign({},a.end),c=[],e[i][1].end.offset-e[i][1].start.offset&&(c=ge(c,[["enter",e[i][1],n],["exit",e[i][1],n]])),c=ge(c,[["enter",s,n],["enter",o,n],["exit",o,n],["enter",l,n]]),c=ge(c,tn(n.parser.constructs.insideSpan.null,e.slice(i+1,r),n)),c=ge(c,[["exit",l,n],["enter",a,n],["exit",a,n],["exit",s,n]]),e[r][1].end.offset-e[r][1].start.offset?(x=2,c=ge(c,[["enter",e[r][1],n],["exit",e[r][1],n]])):x=0,Re(e,i-1,r-i+3,c),r=i+c.length-x-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function ao(e,n){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,s=wn(i);let l;return o;function o(u){return l=u,e.enter("attentionSequence"),a(u)}function a(u){if(u===l)return e.consume(u),a;const c=e.exit("attentionSequence"),x=wn(u),p=!x||x===2&&s||r.includes(u),m=!s||s===2&&x||r.includes(i);return c._open=!!(l===42?p:p&&(s||!m)),c._close=!!(l===42?m:m&&(x||!p)),n(u)}}function vn(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const uo={name:"autolink",tokenize:co};function co(e,n,r){let i=0;return s;function s(d){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(d){return ke(d)?(e.consume(d),o):c(d)}function o(d){return d===43||d===45||d===46||fe(d)?(i=1,a(d)):c(d)}function a(d){return d===58?(e.consume(d),i=0,u):(d===43||d===45||d===46||fe(d))&&i++<32?(e.consume(d),a):(i=0,c(d))}function u(d){return d===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),n):d===null||d===32||d===60||Bt(d)?r(d):(e.consume(d),u)}function c(d){return d===64?(e.consume(d),x):Ys(d)?(e.consume(d),c):r(d)}function x(d){return fe(d)?p(d):r(d)}function p(d){return d===46?(e.consume(d),i=0,x):d===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),n):m(d)}function m(d){if((d===45||fe(d))&&i++<63){const g=d===45?m:p;return e.consume(d),g}return r(d)}}const mt={tokenize:po,partial:!0};function po(e,n,r){return i;function i(l){return Q(l)?Z(e,s,"linePrefix")(l):s(l)}function s(l){return l===null||P(l)?n(l):r(l)}}const Tr={name:"blockQuote",tokenize:xo,continuation:{tokenize:mo},exit:ho};function xo(e,n,r){const i=this;return s;function s(o){if(o===62){const a=i.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),l}return r(o)}function l(o){return Q(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(o))}}function mo(e,n,r){const i=this;return s;function s(o){return Q(o)?Z(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):l(o)}function l(o){return e.attempt(Tr,n,r)(o)}}function ho(e){e.exit("blockQuote")}const Lr={name:"characterEscape",tokenize:fo};function fo(e,n,r){return i;function i(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),s}function s(l){return Ar(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(l)}}const zr={name:"characterReference",tokenize:go};function go(e,n,r){const i=this;let s=0,l,o;return a;function a(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),u}function u(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),l=31,o=fe,x(p))}function c(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,o=Zs,x):(e.enter("characterReferenceValue"),l=7,o=_t,x(p))}function x(p){if(p===59&&s){const m=e.exit("characterReferenceValue");return o===fe&&!en(i.sliceSerialize(m))?r(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return o(p)&&s++<l?(e.consume(p),x):r(p)}}const Nn={tokenize:yo,partial:!0},In={name:"codeFenced",tokenize:jo,concrete:!0};function jo(e,n,r){const i=this,s={tokenize:O,partial:!0};let l=0,o=0,a;return u;function u(b){return c(b)}function c(b){const D=i.events[i.events.length-1];return l=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,a=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),x(b)}function x(b){return b===a?(o++,e.consume(b),x):o<3?r(b):(e.exit("codeFencedFenceSequence"),Q(b)?Z(e,p,"whitespace")(b):p(b))}function p(b){return b===null||P(b)?(e.exit("codeFencedFence"),i.interrupt?n(b):e.check(Nn,E,I)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||P(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(b)):Q(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Z(e,d,"whitespace")(b)):b===96&&b===a?r(b):(e.consume(b),m)}function d(b){return b===null||P(b)?p(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||P(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(b)):b===96&&b===a?r(b):(e.consume(b),g)}function E(b){return e.attempt(s,I,k)(b)}function k(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),y}function y(b){return l>0&&Q(b)?Z(e,w,"linePrefix",l+1)(b):w(b)}function w(b){return b===null||P(b)?e.check(Nn,E,I)(b):(e.enter("codeFlowValue"),R(b))}function R(b){return b===null||P(b)?(e.exit("codeFlowValue"),w(b)):(e.consume(b),R)}function I(b){return e.exit("codeFenced"),n(b)}function O(b,D,W){let H=0;return V;function V(B){return b.enter("lineEnding"),b.consume(B),b.exit("lineEnding"),A}function A(B){return b.enter("codeFencedFence"),Q(B)?Z(b,v,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):v(B)}function v(B){return B===a?(b.enter("codeFencedFenceSequence"),$(B)):W(B)}function $(B){return B===a?(H++,b.consume(B),$):H>=o?(b.exit("codeFencedFenceSequence"),Q(B)?Z(b,K,"whitespace")(B):K(B)):W(B)}function K(B){return B===null||P(B)?(b.exit("codeFencedFence"),D(B)):W(B)}}}function yo(e,n,r){const i=this;return s;function s(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return i.parser.lazy[i.now().line]?r(o):n(o)}}const Ct={name:"codeIndented",tokenize:bo},Eo={tokenize:So,partial:!0};function bo(e,n,r){const i=this;return s;function s(c){return e.enter("codeIndented"),Z(e,l,"linePrefix",5)(c)}function l(c){const x=i.events[i.events.length-1];return x&&x[1].type==="linePrefix"&&x[2].sliceSerialize(x[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?u(c):P(c)?e.attempt(Eo,o,u)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||P(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function u(c){return e.exit("codeIndented"),n(c)}}function So(e,n,r){const i=this;return s;function s(o){return i.parser.lazy[i.now().line]?r(o):P(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):Z(e,l,"linePrefix",5)(o)}function l(o){const a=i.events[i.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):P(o)?s(o):r(o)}}const ko={name:"codeText",tokenize:wo,resolve:Ro,previous:Co};function Ro(e){let n=e.length-4,r=3,i,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(i=r;++i<n;)if(e[i][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(i=r-1,n++;++i<=n;)s===void 0?i!==n&&e[i][1].type!=="lineEnding"&&(s=i):(i===n||e[i][1].type==="lineEnding")&&(e[s][1].type="codeTextData",i!==s+2&&(e[s][1].end=e[i-1][1].end,e.splice(s+2,i-s-2),n-=i-s-2,i=s+2),s=void 0);return e}function Co(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wo(e,n,r){let i=0,s,l;return o;function o(p){return e.enter("codeText"),e.enter("codeTextSequence"),a(p)}function a(p){return p===96?(e.consume(p),i++,a):(e.exit("codeTextSequence"),u(p))}function u(p){return p===null?r(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),u):p===96?(l=e.enter("codeTextSequence"),s=0,x(p)):P(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(p))}function c(p){return p===null||p===32||p===96||P(p)?(e.exit("codeTextData"),u(p)):(e.consume(p),c)}function x(p){return p===96?(e.consume(p),s++,x):s===i?(e.exit("codeTextSequence"),e.exit("codeText"),n(p)):(l.type="codeTextData",c(p))}}function Or(e){const n={};let r=-1,i,s,l,o,a,u,c;for(;++r<e.length;){for(;r in n;)r=n[r];if(i=e[r],r&&i[1].type==="chunkFlow"&&e[r-1][1].type==="listItemPrefix"&&(u=i[1]._tokenizer.events,l=0,l<u.length&&u[l][1].type==="lineEndingBlank"&&(l+=2),l<u.length&&u[l][1].type==="content"))for(;++l<u.length&&u[l][1].type!=="content";)u[l][1].type==="chunkText"&&(u[l][1]._isInFirstContentOfListItem=!0,l++);if(i[0]==="enter")i[1].contentType&&(Object.assign(n,vo(e,r)),r=n[r],c=!0);else if(i[1]._container){for(l=r,s=void 0;l--&&(o=e[l],o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(s&&(e[s][1].type="lineEndingBlank"),o[1].type="lineEnding",s=l);s&&(i[1].end=Object.assign({},e[s][1].start),a=e.slice(s,r),a.unshift(i),Re(e,s,r-s+1,a))}}return!c}function vo(e,n){const r=e[n][1],i=e[n][2];let s=n-1;const l=[],o=r._tokenizer||i.parser[r.contentType](r.start),a=o.events,u=[],c={};let x,p,m=-1,d=r,g=0,E=0;const k=[E];for(;d;){for(;e[++s][1]!==d;);l.push(s),d._tokenizer||(x=i.sliceStream(d),d.next||x.push(null),p&&o.defineSkip(d.start),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(x),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),p=d,d=d.next}for(d=r;++m<a.length;)a[m][0]==="exit"&&a[m-1][0]==="enter"&&a[m][1].type===a[m-1][1].type&&a[m][1].start.line!==a[m][1].end.line&&(E=m+1,k.push(E),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(o.events=[],d?(d._tokenizer=void 0,d.previous=void 0):k.pop(),m=k.length;m--;){const y=a.slice(k[m],k[m+1]),w=l.pop();u.unshift([w,w+y.length-1]),Re(e,w,2,y)}for(m=-1;++m<u.length;)c[g+u[m][0]]=g+u[m][1],g+=u[m][1]-u[m][0]-1;return c}const No={tokenize:To,resolve:Ao},Io={tokenize:Lo,partial:!0};function Ao(e){return Or(e),e}function To(e,n){let r;return i;function i(a){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?l(a):P(a)?e.check(Io,o,l)(a):(e.consume(a),s)}function l(a){return e.exit("chunkContent"),e.exit("content"),n(a)}function o(a){return e.consume(a),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function Lo(e,n,r){const i=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Z(e,l,"linePrefix")}function l(o){if(o===null||P(o))return r(o);const a=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):e.interrupt(i.parser.constructs.flow,r,n)(o)}}function Dr(e,n,r,i,s,l,o,a,u){const c=u||Number.POSITIVE_INFINITY;let x=0;return p;function p(y){return y===60?(e.enter(i),e.enter(s),e.enter(l),e.consume(y),e.exit(l),m):y===null||y===32||y===41||Bt(y)?r(y):(e.enter(i),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),E(y))}function m(y){return y===62?(e.enter(l),e.consume(y),e.exit(l),e.exit(s),e.exit(i),n):(e.enter(a),e.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===62?(e.exit("chunkString"),e.exit(a),m(y)):y===null||y===60||P(y)?r(y):(e.consume(y),y===92?g:d)}function g(y){return y===60||y===62||y===92?(e.consume(y),d):d(y)}function E(y){return!x&&(y===null||y===41||pe(y))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(i),n(y)):x<c&&y===40?(e.consume(y),x++,E):y===41?(e.consume(y),x--,E):y===null||y===32||y===40||Bt(y)?r(y):(e.consume(y),y===92?k:E)}function k(y){return y===40||y===41||y===92?(e.consume(y),E):E(y)}}function Fr(e,n,r,i,s,l){const o=this;let a=0,u;return c;function c(d){return e.enter(i),e.enter(s),e.consume(d),e.exit(s),e.enter(l),x}function x(d){return a>999||d===null||d===91||d===93&&!u||d===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(d):d===93?(e.exit(l),e.enter(s),e.consume(d),e.exit(s),e.exit(i),n):P(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),x):(e.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===null||d===91||d===93||P(d)||a++>999?(e.exit("chunkString"),x(d)):(e.consume(d),u||(u=!Q(d)),d===92?m:p)}function m(d){return d===91||d===92||d===93?(e.consume(d),a++,p):p(d)}}function Mr(e,n,r,i,s,l){let o;return a;function a(m){return m===34||m===39||m===40?(e.enter(i),e.enter(s),e.consume(m),e.exit(s),o=m===40?41:m,u):r(m)}function u(m){return m===o?(e.enter(s),e.consume(m),e.exit(s),e.exit(i),n):(e.enter(l),c(m))}function c(m){return m===o?(e.exit(l),u(o)):m===null?r(m):P(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Z(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),x(m))}function x(m){return m===o||m===null||P(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?p:x)}function p(m){return m===o||m===92?(e.consume(m),x):x(m)}}function Ze(e,n){let r;return i;function i(s){return P(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,i):Q(s)?Z(e,i,r?"linePrefix":"lineSuffix")(s):n(s)}}const zo={name:"definition",tokenize:Do},Oo={tokenize:Fo,partial:!0};function Do(e,n,r){const i=this;let s;return l;function l(d){return e.enter("definition"),o(d)}function o(d){return Fr.call(i,e,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return s=Ke(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),u):r(d)}function u(d){return pe(d)?Ze(e,c)(d):c(d)}function c(d){return Dr(e,x,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function x(d){return e.attempt(Oo,p,p)(d)}function p(d){return Q(d)?Z(e,m,"whitespace")(d):m(d)}function m(d){return d===null||P(d)?(e.exit("definition"),i.parser.defined.push(s),n(d)):r(d)}}function Fo(e,n,r){return i;function i(a){return pe(a)?Ze(e,s)(a):r(a)}function s(a){return Mr(e,l,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function l(a){return Q(a)?Z(e,o,"whitespace")(a):o(a)}function o(a){return a===null||P(a)?n(a):r(a)}}const Mo={name:"hardBreakEscape",tokenize:Po};function Po(e,n,r){return i;function i(l){return e.enter("hardBreakEscape"),e.consume(l),s}function s(l){return P(l)?(e.exit("hardBreakEscape"),n(l)):r(l)}}const Bo={name:"headingAtx",tokenize:qo,resolve:_o};function _o(e,n){let r=e.length-2,i=3,s,l;return e[i][1].type==="whitespace"&&(i+=2),r-2>i&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&e[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(s={type:"atxHeadingText",start:e[i][1].start,end:e[r][1].end},l={type:"chunkText",start:e[i][1].start,end:e[r][1].end,contentType:"text"},Re(e,i,r-i+1,[["enter",s,n],["enter",l,n],["exit",l,n],["exit",s,n]])),e}function qo(e,n,r){let i=0;return s;function s(x){return e.enter("atxHeading"),l(x)}function l(x){return e.enter("atxHeadingSequence"),o(x)}function o(x){return x===35&&i++<6?(e.consume(x),o):x===null||pe(x)?(e.exit("atxHeadingSequence"),a(x)):r(x)}function a(x){return x===35?(e.enter("atxHeadingSequence"),u(x)):x===null||P(x)?(e.exit("atxHeading"),n(x)):Q(x)?Z(e,a,"whitespace")(x):(e.enter("atxHeadingText"),c(x))}function u(x){return x===35?(e.consume(x),u):(e.exit("atxHeadingSequence"),a(x))}function c(x){return x===null||x===35||pe(x)?(e.exit("atxHeadingText"),a(x)):(e.consume(x),c)}}const Vo=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],An=["pre","script","style","textarea"],Ho={name:"htmlFlow",tokenize:Wo,resolveTo:Ko,concrete:!0},Uo={tokenize:Go,partial:!0},$o={tokenize:Qo,partial:!0};function Ko(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function Wo(e,n,r){const i=this;let s,l,o,a,u;return c;function c(f){return x(f)}function x(f){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(f),p}function p(f){return f===33?(e.consume(f),m):f===47?(e.consume(f),l=!0,E):f===63?(e.consume(f),s=3,i.interrupt?n:h):ke(f)?(e.consume(f),o=String.fromCharCode(f),k):r(f)}function m(f){return f===45?(e.consume(f),s=2,d):f===91?(e.consume(f),s=5,a=0,g):ke(f)?(e.consume(f),s=4,i.interrupt?n:h):r(f)}function d(f){return f===45?(e.consume(f),i.interrupt?n:h):r(f)}function g(f){const ne="CDATA[";return f===ne.charCodeAt(a++)?(e.consume(f),a===ne.length?i.interrupt?n:v:g):r(f)}function E(f){return ke(f)?(e.consume(f),o=String.fromCharCode(f),k):r(f)}function k(f){if(f===null||f===47||f===62||pe(f)){const ne=f===47,ue=o.toLowerCase();return!ne&&!l&&An.includes(ue)?(s=1,i.interrupt?n(f):v(f)):Vo.includes(o.toLowerCase())?(s=6,ne?(e.consume(f),y):i.interrupt?n(f):v(f)):(s=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(f):l?w(f):R(f))}return f===45||fe(f)?(e.consume(f),o+=String.fromCharCode(f),k):r(f)}function y(f){return f===62?(e.consume(f),i.interrupt?n:v):r(f)}function w(f){return Q(f)?(e.consume(f),w):V(f)}function R(f){return f===47?(e.consume(f),V):f===58||f===95||ke(f)?(e.consume(f),I):Q(f)?(e.consume(f),R):V(f)}function I(f){return f===45||f===46||f===58||f===95||fe(f)?(e.consume(f),I):O(f)}function O(f){return f===61?(e.consume(f),b):Q(f)?(e.consume(f),O):R(f)}function b(f){return f===null||f===60||f===61||f===62||f===96?r(f):f===34||f===39?(e.consume(f),u=f,D):Q(f)?(e.consume(f),b):W(f)}function D(f){return f===u?(e.consume(f),u=null,H):f===null||P(f)?r(f):(e.consume(f),D)}function W(f){return f===null||f===34||f===39||f===47||f===60||f===61||f===62||f===96||pe(f)?O(f):(e.consume(f),W)}function H(f){return f===47||f===62||Q(f)?R(f):r(f)}function V(f){return f===62?(e.consume(f),A):r(f)}function A(f){return f===null||P(f)?v(f):Q(f)?(e.consume(f),A):r(f)}function v(f){return f===45&&s===2?(e.consume(f),G):f===60&&s===1?(e.consume(f),L):f===62&&s===4?(e.consume(f),J):f===63&&s===3?(e.consume(f),h):f===93&&s===5?(e.consume(f),N):P(f)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(Uo,X,$)(f)):f===null||P(f)?(e.exit("htmlFlowData"),$(f)):(e.consume(f),v)}function $(f){return e.check($o,K,X)(f)}function K(f){return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),B}function B(f){return f===null||P(f)?$(f):(e.enter("htmlFlowData"),v(f))}function G(f){return f===45?(e.consume(f),h):v(f)}function L(f){return f===47?(e.consume(f),o="",M):v(f)}function M(f){if(f===62){const ne=o.toLowerCase();return An.includes(ne)?(e.consume(f),J):v(f)}return ke(f)&&o.length<8?(e.consume(f),o+=String.fromCharCode(f),M):v(f)}function N(f){return f===93?(e.consume(f),h):v(f)}function h(f){return f===62?(e.consume(f),J):f===45&&s===2?(e.consume(f),h):v(f)}function J(f){return f===null||P(f)?(e.exit("htmlFlowData"),X(f)):(e.consume(f),J)}function X(f){return e.exit("htmlFlow"),n(f)}}function Qo(e,n,r){const i=this;return s;function s(o){return P(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):r(o)}function l(o){return i.parser.lazy[i.now().line]?r(o):n(o)}}function Go(e,n,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(mt,n,r)}}const Jo={name:"htmlText",tokenize:Xo};function Xo(e,n,r){const i=this;let s,l,o;return a;function a(h){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(h),u}function u(h){return h===33?(e.consume(h),c):h===47?(e.consume(h),O):h===63?(e.consume(h),R):ke(h)?(e.consume(h),W):r(h)}function c(h){return h===45?(e.consume(h),x):h===91?(e.consume(h),l=0,g):ke(h)?(e.consume(h),w):r(h)}function x(h){return h===45?(e.consume(h),d):r(h)}function p(h){return h===null?r(h):h===45?(e.consume(h),m):P(h)?(o=p,L(h)):(e.consume(h),p)}function m(h){return h===45?(e.consume(h),d):p(h)}function d(h){return h===62?G(h):h===45?m(h):p(h)}function g(h){const J="CDATA[";return h===J.charCodeAt(l++)?(e.consume(h),l===J.length?E:g):r(h)}function E(h){return h===null?r(h):h===93?(e.consume(h),k):P(h)?(o=E,L(h)):(e.consume(h),E)}function k(h){return h===93?(e.consume(h),y):E(h)}function y(h){return h===62?G(h):h===93?(e.consume(h),y):E(h)}function w(h){return h===null||h===62?G(h):P(h)?(o=w,L(h)):(e.consume(h),w)}function R(h){return h===null?r(h):h===63?(e.consume(h),I):P(h)?(o=R,L(h)):(e.consume(h),R)}function I(h){return h===62?G(h):R(h)}function O(h){return ke(h)?(e.consume(h),b):r(h)}function b(h){return h===45||fe(h)?(e.consume(h),b):D(h)}function D(h){return P(h)?(o=D,L(h)):Q(h)?(e.consume(h),D):G(h)}function W(h){return h===45||fe(h)?(e.consume(h),W):h===47||h===62||pe(h)?H(h):r(h)}function H(h){return h===47?(e.consume(h),G):h===58||h===95||ke(h)?(e.consume(h),V):P(h)?(o=H,L(h)):Q(h)?(e.consume(h),H):G(h)}function V(h){return h===45||h===46||h===58||h===95||fe(h)?(e.consume(h),V):A(h)}function A(h){return h===61?(e.consume(h),v):P(h)?(o=A,L(h)):Q(h)?(e.consume(h),A):H(h)}function v(h){return h===null||h===60||h===61||h===62||h===96?r(h):h===34||h===39?(e.consume(h),s=h,$):P(h)?(o=v,L(h)):Q(h)?(e.consume(h),v):(e.consume(h),K)}function $(h){return h===s?(e.consume(h),s=void 0,B):h===null?r(h):P(h)?(o=$,L(h)):(e.consume(h),$)}function K(h){return h===null||h===34||h===39||h===60||h===61||h===96?r(h):h===47||h===62||pe(h)?H(h):(e.consume(h),K)}function B(h){return h===47||h===62||pe(h)?H(h):r(h)}function G(h){return h===62?(e.consume(h),e.exit("htmlTextData"),e.exit("htmlText"),n):r(h)}function L(h){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),M}function M(h){return Q(h)?Z(e,N,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):N(h)}function N(h){return e.enter("htmlTextData"),o(h)}}const nn={name:"labelEnd",tokenize:rl,resolveTo:nl,resolveAll:tl},Yo={tokenize:il},Zo={tokenize:sl},el={tokenize:ol};function tl(e){let n=-1;for(;++n<e.length;){const r=e[n][1];(r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd")&&(e.splice(n+1,r.type==="labelImage"?4:2),r.type="data",n++)}return e}function nl(e,n){let r=e.length,i=0,s,l,o,a;for(;r--;)if(s=e[r][1],l){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(l=r,s.type!=="labelLink")){i=2;break}}else s.type==="labelEnd"&&(o=r);const u={type:e[l][1].type==="labelLink"?"link":"image",start:Object.assign({},e[l][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[l][1].start),end:Object.assign({},e[o][1].end)},x={type:"labelText",start:Object.assign({},e[l+i+2][1].end),end:Object.assign({},e[o-2][1].start)};return a=[["enter",u,n],["enter",c,n]],a=ge(a,e.slice(l+1,l+i+3)),a=ge(a,[["enter",x,n]]),a=ge(a,tn(n.parser.constructs.insideSpan.null,e.slice(l+i+4,o-3),n)),a=ge(a,[["exit",x,n],e[o-2],e[o-1],["exit",c,n]]),a=ge(a,e.slice(o+1)),a=ge(a,[["exit",u,n]]),Re(e,l,e.length,a),e}function rl(e,n,r){const i=this;let s=i.events.length,l,o;for(;s--;)if((i.events[s][1].type==="labelImage"||i.events[s][1].type==="labelLink")&&!i.events[s][1]._balanced){l=i.events[s][1];break}return a;function a(m){return l?l._inactive?p(m):(o=i.parser.defined.includes(Ke(i.sliceSerialize({start:l.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),u):r(m)}function u(m){return m===40?e.attempt(Yo,x,o?x:p)(m):m===91?e.attempt(Zo,x,o?c:p)(m):o?x(m):p(m)}function c(m){return e.attempt(el,x,p)(m)}function x(m){return n(m)}function p(m){return l._balanced=!0,r(m)}}function il(e,n,r){return i;function i(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return pe(p)?Ze(e,l)(p):l(p)}function l(p){return p===41?x(p):Dr(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return pe(p)?Ze(e,u)(p):x(p)}function a(p){return r(p)}function u(p){return p===34||p===39||p===40?Mr(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):x(p)}function c(p){return pe(p)?Ze(e,x)(p):x(p)}function x(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),n):r(p)}}function sl(e,n,r){const i=this;return s;function s(a){return Fr.call(i,e,l,o,"reference","referenceMarker","referenceString")(a)}function l(a){return i.parser.defined.includes(Ke(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?n(a):r(a)}function o(a){return r(a)}}function ol(e,n,r){return i;function i(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),s}function s(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),n):r(l)}}const ll={name:"labelStartImage",tokenize:al,resolveAll:nn.resolveAll};function al(e,n,r){const i=this;return s;function s(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),l}function l(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):r(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(a):n(a)}}const ul={name:"labelStartLink",tokenize:cl,resolveAll:nn.resolveAll};function cl(e,n,r){const i=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),l}function l(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(o):n(o)}}const wt={name:"lineEnding",tokenize:pl};function pl(e,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Z(e,n,"linePrefix")}}const lt={name:"thematicBreak",tokenize:xl};function xl(e,n,r){let i=0,s;return l;function l(c){return e.enter("thematicBreak"),o(c)}function o(c){return s=c,a(c)}function a(c){return c===s?(e.enter("thematicBreakSequence"),u(c)):i>=3&&(c===null||P(c))?(e.exit("thematicBreak"),n(c)):r(c)}function u(c){return c===s?(e.consume(c),i++,u):(e.exit("thematicBreakSequence"),Q(c)?Z(e,a,"whitespace")(c):a(c))}}const ce={name:"list",tokenize:hl,continuation:{tokenize:fl},exit:jl},dl={tokenize:yl,partial:!0},ml={tokenize:gl,partial:!0};function hl(e,n,r){const i=this,s=i.events[i.events.length-1];let l=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(d){const g=i.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!i.containerState.marker||d===i.containerState.marker:_t(d)){if(i.containerState.type||(i.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),d===42||d===45?e.check(lt,r,c)(d):c(d);if(!i.interrupt||d===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(d)}return r(d)}function u(d){return _t(d)&&++o<10?(e.consume(d),u):(!i.interrupt||o<2)&&(i.containerState.marker?d===i.containerState.marker:d===41||d===46)?(e.exit("listItemValue"),c(d)):r(d)}function c(d){return e.enter("listItemMarker"),e.consume(d),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||d,e.check(mt,i.interrupt?r:x,e.attempt(dl,m,p))}function x(d){return i.containerState.initialBlankLine=!0,l++,m(d)}function p(d){return Q(d)?(e.enter("listItemPrefixWhitespace"),e.consume(d),e.exit("listItemPrefixWhitespace"),m):r(d)}function m(d){return i.containerState.size=l+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(d)}}function fl(e,n,r){const i=this;return i.containerState._closeFlow=void 0,e.check(mt,s,l);function s(a){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Z(e,n,"listItemIndent",i.containerState.size+1)(a)}function l(a){return i.containerState.furtherBlankLines||!Q(a)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(a)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(ml,n,o)(a))}function o(a){return i.containerState._closeFlow=!0,i.interrupt=void 0,Z(e,e.attempt(ce,n,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function gl(e,n,r){const i=this;return Z(e,s,"listItemIndent",i.containerState.size+1);function s(l){const o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?n(l):r(l)}}function jl(e){e.exit(this.containerState.type)}function yl(e,n,r){const i=this;return Z(e,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(l){const o=i.events[i.events.length-1];return!Q(l)&&o&&o[1].type==="listItemPrefixWhitespace"?n(l):r(l)}}const Tn={name:"setextUnderline",tokenize:bl,resolveTo:El};function El(e,n){let r=e.length,i,s,l;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(s=r)}else e[r][1].type==="content"&&e.splice(r,1),!l&&e[r][1].type==="definition"&&(l=r);const o={type:"setextHeading",start:Object.assign({},e[s][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[s][1].type="setextHeadingText",l?(e.splice(s,0,["enter",o,n]),e.splice(l+1,0,["exit",e[i][1],n]),e[i][1].end=Object.assign({},e[l][1].end)):e[i][1]=o,e.push(["exit",o,n]),e}function bl(e,n,r){const i=this;let s;return l;function l(c){let x=i.events.length,p;for(;x--;)if(i.events[x][1].type!=="lineEnding"&&i.events[x][1].type!=="linePrefix"&&i.events[x][1].type!=="content"){p=i.events[x][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||p)?(e.enter("setextHeadingLine"),s=c,o(c)):r(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===s?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Q(c)?Z(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||P(c)?(e.exit("setextHeadingLine"),n(c)):r(c)}}const Sl={tokenize:kl};function kl(e){const n=this,r=e.attempt(mt,i,e.attempt(this.parser.constructs.flowInitial,s,Z(e,e.attempt(this.parser.constructs.flow,s,e.attempt(No,s)),"linePrefix")));return r;function i(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const Rl={resolveAll:Br()},Cl=Pr("string"),wl=Pr("text");function Pr(e){return{tokenize:n,resolveAll:Br(e==="text"?vl:void 0)};function n(r){const i=this,s=this.parser.constructs[e],l=r.attempt(s,o,a);return o;function o(x){return c(x)?l(x):a(x)}function a(x){if(x===null){r.consume(x);return}return r.enter("data"),r.consume(x),u}function u(x){return c(x)?(r.exit("data"),l(x)):(r.consume(x),u)}function c(x){if(x===null)return!0;const p=s[x];let m=-1;if(p)for(;++m<p.length;){const d=p[m];if(!d.previous||d.previous.call(i,i.previous))return!0}return!1}}}function Br(e){return n;function n(r,i){let s=-1,l;for(;++s<=r.length;)l===void 0?r[s]&&r[s][1].type==="data"&&(l=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==l+2&&(r[l][1].end=r[s-1][1].end,r.splice(l+2,s-l-2),s=l+2),l=void 0);return e?e(r,i):r}}function vl(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],s=n.sliceStream(i);let l=s.length,o=-1,a=0,u;for(;l--;){const c=s[l];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)u=!0,a++;else if(c!==-1){l++;break}}if(a){const c={type:r===e.length||u||a<2?"lineSuffix":"hardBreakTrailing",start:{line:i.end.line,column:i.end.column-a,offset:i.end.offset-a,_index:i.start._index+l,_bufferIndex:l?o:i.start._bufferIndex+o},end:Object.assign({},i.end)};i.end=Object.assign({},c.start),i.start.offset===i.end.offset?Object.assign(i,c):(e.splice(r,0,["enter",c,n],["exit",c,n]),r+=2)}r++}return e}function Nl(e,n,r){let i=Object.assign(r?Object.assign({},r):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const s={},l=[];let o=[],a=[];const u={consume:w,enter:R,exit:I,attempt:D(O),check:D(b),interrupt:D(b,{interrupt:!0})},c={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:d,sliceSerialize:m,now:g,defineSkip:E,write:p};let x=n.tokenize.call(c,u);return n.resolveAll&&l.push(n),c;function p(A){return o=ge(o,A),k(),o[o.length-1]!==null?[]:(W(n,0),c.events=tn(l,c.events,c),c.events)}function m(A,v){return Al(d(A),v)}function d(A){return Il(o,A)}function g(){const{line:A,column:v,offset:$,_index:K,_bufferIndex:B}=i;return{line:A,column:v,offset:$,_index:K,_bufferIndex:B}}function E(A){s[A.line]=A.column,V()}function k(){let A;for(;i._index<o.length;){const v=o[i._index];if(typeof v=="string")for(A=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===A&&i._bufferIndex<v.length;)y(v.charCodeAt(i._bufferIndex));else y(v)}}function y(A){x=x(A)}function w(A){P(A)?(i.line++,i.column=1,i.offset+=A===-3?2:1,V()):A!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===o[i._index].length&&(i._bufferIndex=-1,i._index++)),c.previous=A}function R(A,v){const $=v||{};return $.type=A,$.start=g(),c.events.push(["enter",$,c]),a.push($),$}function I(A){const v=a.pop();return v.end=g(),c.events.push(["exit",v,c]),v}function O(A,v){W(A,v.from)}function b(A,v){v.restore()}function D(A,v){return $;function $(K,B,G){let L,M,N,h;return Array.isArray(K)?X(K):"tokenize"in K?X([K]):J(K);function J(ee){return xe;function xe(oe){const ie=oe!==null&&ee[oe],le=oe!==null&&ee.null,Ee=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(le)?le:le?[le]:[]];return X(Ee)(oe)}}function X(ee){return L=ee,M=0,ee.length===0?G:f(ee[M])}function f(ee){return xe;function xe(oe){return h=H(),N=ee,ee.partial||(c.currentConstruct=ee),ee.name&&c.parser.constructs.disable.null.includes(ee.name)?ue():ee.tokenize.call(v?Object.assign(Object.create(c),v):c,u,ne,ue)(oe)}}function ne(ee){return A(N,h),B}function ue(ee){return h.restore(),++M<L.length?f(L[M]):G}}}function W(A,v){A.resolveAll&&!l.includes(A)&&l.push(A),A.resolve&&Re(c.events,v,c.events.length-v,A.resolve(c.events.slice(v),c)),A.resolveTo&&(c.events=A.resolveTo(c.events,c))}function H(){const A=g(),v=c.previous,$=c.currentConstruct,K=c.events.length,B=Array.from(a);return{restore:G,from:K};function G(){i=A,c.previous=v,c.currentConstruct=$,c.events.length=K,a=B,V()}}function V(){i.line in s&&i.column<2&&(i.column=s[i.line],i.offset+=s[i.line]-1)}}function Il(e,n){const r=n.start._index,i=n.start._bufferIndex,s=n.end._index,l=n.end._bufferIndex;let o;if(r===s)o=[e[r].slice(i,l)];else{if(o=e.slice(r,s),i>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(i):o.shift()}l>0&&o.push(e[s].slice(0,l))}return o}function Al(e,n){let r=-1;const i=[];let s;for(;++r<e.length;){const l=e[r];let o;if(typeof l=="string")o=l;else switch(l){case-5:{o="\r";break}case-4:{o=`
|
|
163
|
+
`;break}case-3:{o=`\r
|
|
164
|
+
`;break}case-2:{o=n?" ":" ";break}case-1:{if(!n&&s)continue;o=" ";break}default:o=String.fromCharCode(l)}s=l===-2,i.push(o)}return i.join("")}const Tl={42:ce,43:ce,45:ce,48:ce,49:ce,50:ce,51:ce,52:ce,53:ce,54:ce,55:ce,56:ce,57:ce,62:Tr},Ll={91:zo},zl={[-2]:Ct,[-1]:Ct,32:Ct},Ol={35:Bo,42:lt,45:[Tn,lt],60:Ho,61:Tn,95:lt,96:In,126:In},Dl={38:zr,92:Lr},Fl={[-5]:wt,[-4]:wt,[-3]:wt,33:ll,38:zr,42:qt,60:[uo,Jo],91:ul,92:[Mo,Lr],93:nn,95:qt,96:ko},Ml={null:[qt,Rl]},Pl={null:[42,95]},Bl={null:[]},_l=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Pl,contentInitial:Ll,disable:Bl,document:Tl,flow:Ol,flowInitial:zl,insideSpan:Ml,string:Dl,text:Fl},Symbol.toStringTag,{value:"Module"}));function ql(e){const r=Qs([_l,...(e||{}).extensions||[]]),i={defined:[],lazy:{},constructs:r,content:s(no),document:s(io),flow:s(Sl),string:s(Cl),text:s(wl)};return i;function s(l){return o;function o(a){return Nl(i,l,a)}}}function Vl(e){for(;!Or(e););return e}const Ln=/[\0\t\n\r]/g;function Hl(){let e=1,n="",r=!0,i;return s;function s(l,o,a){const u=[];let c,x,p,m,d;for(l=n+(typeof l=="string"?l.toString():new TextDecoder(o||void 0).decode(l)),p=0,n="",r&&(l.charCodeAt(0)===65279&&p++,r=void 0);p<l.length;){if(Ln.lastIndex=p,c=Ln.exec(l),m=c&&c.index!==void 0?c.index:l.length,d=l.charCodeAt(m),!c){n=l.slice(p);break}if(d===10&&p===m&&i)u.push(-3),i=void 0;else switch(i&&(u.push(-5),i=void 0),p<m&&(u.push(l.slice(p,m)),e+=m-p),d){case 0:{u.push(65533),e++;break}case 9:{for(x=Math.ceil(e/4)*4,u.push(-2);e++<x;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:i=!0,e=1}p=m+1}return a&&(i&&u.push(-5),n&&u.push(n),u.push(null)),u}}const Ul=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $l(e){return e.replace(Ul,Kl)}function Kl(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),l=s===120||s===88;return Ir(r.slice(l?2:1),l?16:10)}return en(r)||e}const _r={}.hasOwnProperty;function Wl(e,n,r){return typeof n!="string"&&(r=n,n=void 0),Ql(r)(Vl(ql(r).document().write(Hl()(e,n,!0))))}function Ql(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Te),autolinkProtocol:H,autolinkEmail:H,atxHeading:l(Ae),blockQuote:l(ie),characterEscape:H,characterReference:H,codeFenced:l(le),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:l(le,o),codeText:l(Ee,o),codeTextData:H,data:H,codeFlowValue:H,definition:l(_e),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:l(Ie),hardBreakEscape:l(qe),hardBreakTrailing:l(qe),htmlFlow:l(be,o),htmlFlowData:H,htmlText:l(be,o),htmlTextData:H,image:l(Ve),label:o,link:l(Te),listItem:l(gt),listItemValue:m,listOrdered:l(z,p),listUnordered:l(z),paragraph:l(jt),reference:f,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:l(Ae),strong:l(yt),thematicBreak:l(Et)},exit:{atxHeading:u(),atxHeadingSequence:O,autolink:u(),autolinkEmail:oe,autolinkProtocol:xe,blockQuote:u(),characterEscapeValue:V,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:ee,codeFenced:u(k),codeFencedFence:E,codeFencedFenceInfo:d,codeFencedFenceMeta:g,codeFlowValue:V,codeIndented:u(y),codeText:u(B),codeTextData:V,data:V,definition:u(),definitionDestinationString:I,definitionLabelString:w,definitionTitleString:R,emphasis:u(),hardBreakEscape:u(v),hardBreakTrailing:u(v),htmlFlow:u($),htmlFlowData:V,htmlText:u(K),htmlTextData:V,image:u(L),label:N,labelText:M,lineEnding:A,link:u(G),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ne,resourceDestinationString:h,resourceTitleString:J,resource:X,setextHeading:u(W),setextHeadingLineSequence:D,setextHeadingText:b,strong:u(),thematicBreak:u()}};qr(n,(e||{}).mdastExtensions||[]);const r={};return i;function i(S){let j={type:"root",children:[]};const F={stack:[j],tokenStack:[],config:n,enter:a,exit:c,buffer:o,resume:x,data:r},_=[];let U=-1;for(;++U<S.length;)if(S[U][1].type==="listOrdered"||S[U][1].type==="listUnordered")if(S[U][0]==="enter")_.push(U);else{const te=_.pop();U=s(S,te,U)}for(U=-1;++U<S.length;){const te=n[S[U][0]];_r.call(te,S[U][1].type)&&te[S[U][1].type].call(Object.assign({sliceSerialize:S[U][2].sliceSerialize},F),S[U][1])}if(F.tokenStack.length>0){const te=F.tokenStack[F.tokenStack.length-1];(te[1]||zn).call(F,void 0,te[0])}for(j.position={start:ze(S.length>0?S[0][1].start:{line:1,column:1,offset:0}),end:ze(S.length>0?S[S.length-2][1].end:{line:1,column:1,offset:0})},U=-1;++U<n.transforms.length;)j=n.transforms[U](j)||j;return j}function s(S,j,F){let _=j-1,U=-1,te=!1,Ce,ye,De,Le;for(;++_<=F;){const re=S[_];switch(re[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{re[0]==="enter"?U++:U--,Le=void 0;break}case"lineEndingBlank":{re[0]==="enter"&&(Ce&&!Le&&!U&&!De&&(De=_),Le=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Le=void 0}if(!U&&re[0]==="enter"&&re[1].type==="listItemPrefix"||U===-1&&re[0]==="exit"&&(re[1].type==="listUnordered"||re[1].type==="listOrdered")){if(Ce){let de=_;for(ye=void 0;de--;){const me=S[de];if(me[1].type==="lineEnding"||me[1].type==="lineEndingBlank"){if(me[0]==="exit")continue;ye&&(S[ye][1].type="lineEndingBlank",te=!0),me[1].type="lineEnding",ye=de}else if(!(me[1].type==="linePrefix"||me[1].type==="blockQuotePrefix"||me[1].type==="blockQuotePrefixWhitespace"||me[1].type==="blockQuoteMarker"||me[1].type==="listItemIndent"))break}De&&(!ye||De<ye)&&(Ce._spread=!0),Ce.end=Object.assign({},ye?S[ye][1].start:re[1].end),S.splice(ye||_,0,["exit",Ce,re[2]]),_++,F++}if(re[1].type==="listItemPrefix"){const de={type:"listItem",_spread:!1,start:Object.assign({},re[1].start),end:void 0};Ce=de,S.splice(_,0,["enter",de,re[2]]),_++,F++,De=void 0,Le=!0}}}return S[j][1]._spread=te,F}function l(S,j){return F;function F(_){a.call(this,S(_),_),j&&j.call(this,_)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(S,j,F){this.stack[this.stack.length-1].children.push(S),this.stack.push(S),this.tokenStack.push([j,F]),S.position={start:ze(j.start),end:void 0}}function u(S){return j;function j(F){S&&S.call(this,F),c.call(this,F)}}function c(S,j){const F=this.stack.pop(),_=this.tokenStack.pop();if(_)_[0].type!==S.type&&(j?j.call(this,S,_[0]):(_[1]||zn).call(this,S,_[0]));else throw new Error("Cannot close `"+S.type+"` ("+Ye({start:S.start,end:S.end})+"): it’s not open");F.position.end=ze(S.end)}function x(){return Ks(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(S){if(this.data.expectingFirstListItemValue){const j=this.stack[this.stack.length-2];j.start=Number.parseInt(this.sliceSerialize(S),10),this.data.expectingFirstListItemValue=void 0}}function d(){const S=this.resume(),j=this.stack[this.stack.length-1];j.lang=S}function g(){const S=this.resume(),j=this.stack[this.stack.length-1];j.meta=S}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const S=this.resume(),j=this.stack[this.stack.length-1];j.value=S.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const S=this.resume(),j=this.stack[this.stack.length-1];j.value=S.replace(/(\r?\n|\r)$/g,"")}function w(S){const j=this.resume(),F=this.stack[this.stack.length-1];F.label=j,F.identifier=Ke(this.sliceSerialize(S)).toLowerCase()}function R(){const S=this.resume(),j=this.stack[this.stack.length-1];j.title=S}function I(){const S=this.resume(),j=this.stack[this.stack.length-1];j.url=S}function O(S){const j=this.stack[this.stack.length-1];if(!j.depth){const F=this.sliceSerialize(S).length;j.depth=F}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function D(S){const j=this.stack[this.stack.length-1];j.depth=this.sliceSerialize(S).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function H(S){const F=this.stack[this.stack.length-1].children;let _=F[F.length-1];(!_||_.type!=="text")&&(_=rt(),_.position={start:ze(S.start),end:void 0},F.push(_)),this.stack.push(_)}function V(S){const j=this.stack.pop();j.value+=this.sliceSerialize(S),j.position.end=ze(S.end)}function A(S){const j=this.stack[this.stack.length-1];if(this.data.atHardBreak){const F=j.children[j.children.length-1];F.position.end=ze(S.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(j.type)&&(H.call(this,S),V.call(this,S))}function v(){this.data.atHardBreak=!0}function $(){const S=this.resume(),j=this.stack[this.stack.length-1];j.value=S}function K(){const S=this.resume(),j=this.stack[this.stack.length-1];j.value=S}function B(){const S=this.resume(),j=this.stack[this.stack.length-1];j.value=S}function G(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const j=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=j,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function L(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const j=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=j,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function M(S){const j=this.sliceSerialize(S),F=this.stack[this.stack.length-2];F.label=$l(j),F.identifier=Ke(j).toLowerCase()}function N(){const S=this.stack[this.stack.length-1],j=this.resume(),F=this.stack[this.stack.length-1];if(this.data.inReference=!0,F.type==="link"){const _=S.children;F.children=_}else F.alt=j}function h(){const S=this.resume(),j=this.stack[this.stack.length-1];j.url=S}function J(){const S=this.resume(),j=this.stack[this.stack.length-1];j.title=S}function X(){this.data.inReference=void 0}function f(){this.data.referenceType="collapsed"}function ne(S){const j=this.resume(),F=this.stack[this.stack.length-1];F.label=j,F.identifier=Ke(this.sliceSerialize(S)).toLowerCase(),this.data.referenceType="full"}function ue(S){this.data.characterReferenceType=S.type}function ee(S){const j=this.sliceSerialize(S),F=this.data.characterReferenceType;let _;F?(_=Ir(j,F==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):_=en(j);const U=this.stack.pop();U.value+=_,U.position.end=ze(S.end)}function xe(S){V.call(this,S);const j=this.stack[this.stack.length-1];j.url=this.sliceSerialize(S)}function oe(S){V.call(this,S);const j=this.stack[this.stack.length-1];j.url="mailto:"+this.sliceSerialize(S)}function ie(){return{type:"blockquote",children:[]}}function le(){return{type:"code",lang:null,meta:null,value:""}}function Ee(){return{type:"inlineCode",value:""}}function _e(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ie(){return{type:"emphasis",children:[]}}function Ae(){return{type:"heading",depth:0,children:[]}}function qe(){return{type:"break"}}function be(){return{type:"html",value:""}}function Ve(){return{type:"image",title:null,url:"",alt:null}}function Te(){return{type:"link",title:null,url:"",children:[]}}function z(S){return{type:"list",ordered:S.type==="listOrdered",start:null,spread:S._spread,children:[]}}function gt(S){return{type:"listItem",spread:S._spread,checked:null,children:[]}}function jt(){return{type:"paragraph",children:[]}}function yt(){return{type:"strong",children:[]}}function rt(){return{type:"text",value:""}}function Et(){return{type:"thematicBreak"}}}function ze(e){return{line:e.line,column:e.column,offset:e.offset}}function qr(e,n){let r=-1;for(;++r<n.length;){const i=n[r];Array.isArray(i)?qr(e,i):Gl(e,i)}}function Gl(e,n){let r;for(r in n)if(_r.call(n,r))switch(r){case"canContainEols":{const i=n[r];i&&e[r].push(...i);break}case"transforms":{const i=n[r];i&&e[r].push(...i);break}case"enter":case"exit":{const i=n[r];i&&Object.assign(e[r],i);break}}}function zn(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Ye({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Ye({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Ye({start:n.start,end:n.end})+") is still open")}function Jl(e){const n=this;n.parser=r;function r(i){return Wl(i,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function Xl(e,n){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,r),e.applyData(n,r)}function Yl(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
|
|
165
|
+
`}]}function Zl(e,n){const r=n.value?n.value+`
|
|
166
|
+
`:"",i={};n.lang&&(i.className=["language-"+n.lang]);let s={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return n.meta&&(s.data={meta:n.meta}),e.patch(n,s),s=e.applyData(n,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(n,s),s}function ea(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ta(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function na(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(n.identifier).toUpperCase(),s=Qe(i.toLowerCase()),l=e.footnoteOrder.indexOf(i);let o,a=e.footnoteCounts.get(i);a===void 0?(a=0,e.footnoteOrder.push(i),o=e.footnoteOrder.length):o=l+1,a+=1,e.footnoteCounts.set(i,a);const u={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(n,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(n,c),e.applyData(n,c)}function ra(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ia(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function Vr(e,n){const r=n.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+i}];const s=e.all(n),l=s[0];l&&l.type==="text"?l.value="["+l.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=i:s.push({type:"text",value:i}),s}function sa(e,n){const r=String(n.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return Vr(e,n);const s={src:Qe(i.url||""),alt:n.alt};i.title!==null&&i.title!==void 0&&(s.title=i.title);const l={type:"element",tagName:"img",properties:s,children:[]};return e.patch(n,l),e.applyData(n,l)}function oa(e,n){const r={src:Qe(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,i),e.applyData(n,i)}function la(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,i),e.applyData(n,i)}function aa(e,n){const r=String(n.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return Vr(e,n);const s={href:Qe(i.url||"")};i.title!==null&&i.title!==void 0&&(s.title=i.title);const l={type:"element",tagName:"a",properties:s,children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function ua(e,n){const r={href:Qe(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const i={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function ca(e,n,r){const i=e.all(n),s=r?pa(r):Hr(n),l={},o=[];if(typeof n.checked=="boolean"){const x=i[0];let p;x&&x.type==="element"&&x.tagName==="p"?p=x:(p={type:"element",tagName:"p",properties:{},children:[]},i.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let a=-1;for(;++a<i.length;){const x=i[a];(s||a!==0||x.type!=="element"||x.tagName!=="p")&&o.push({type:"text",value:`
|
|
167
|
+
`}),x.type==="element"&&x.tagName==="p"&&!s?o.push(...x.children):o.push(x)}const u=i[i.length-1];u&&(s||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
168
|
+
`});const c={type:"element",tagName:"li",properties:l,children:o};return e.patch(n,c),e.applyData(n,c)}function pa(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let i=-1;for(;!n&&++i<r.length;)n=Hr(r[i])}return n}function Hr(e){const n=e.spread;return n??e.children.length>1}function xa(e,n){const r={},i=e.all(n);let s=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++s<i.length;){const o=i[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const l={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(i,!0)};return e.patch(n,l),e.applyData(n,l)}function da(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ma(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function ha(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function fa(e,n){const r=e.all(n),i=r.shift(),s=[];if(i){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(n.children[0],o),s.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},a=Jt(n.children[1]),u=Sr(n.children[n.children.length-1]);a&&u&&(o.position={start:a,end:u}),s.push(o)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(n,l),e.applyData(n,l)}function ga(e,n,r){const i=r?r.children:void 0,l=(i?i.indexOf(n):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,a=o?o.length:n.children.length;let u=-1;const c=[];for(;++u<a;){const p=n.children[u],m={},d=o?o[u]:void 0;d&&(m.align=d);let g={type:"element",tagName:l,properties:m,children:[]};p&&(g.children=e.all(p),e.patch(p,g),g=e.applyData(p,g)),c.push(g)}const x={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(n,x),e.applyData(n,x)}function ja(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const On=9,Dn=32;function ya(e){const n=String(e),r=/\r?\n|\r/g;let i=r.exec(n),s=0;const l=[];for(;i;)l.push(Fn(n.slice(s,i.index),s>0,!0),i[0]),s=i.index+i[0].length,i=r.exec(n);return l.push(Fn(n.slice(s),s>0,!1)),l.join("")}function Fn(e,n,r){let i=0,s=e.length;if(n){let l=e.codePointAt(i);for(;l===On||l===Dn;)i++,l=e.codePointAt(i)}if(r){let l=e.codePointAt(s-1);for(;l===On||l===Dn;)s--,l=e.codePointAt(s-1)}return s>i?e.slice(i,s):""}function Ea(e,n){const r={type:"text",value:ya(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function ba(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const Sa={blockquote:Xl,break:Yl,code:Zl,delete:ea,emphasis:ta,footnoteReference:na,heading:ra,html:ia,imageReference:sa,image:oa,inlineCode:la,linkReference:aa,link:ua,listItem:ca,list:xa,paragraph:da,root:ma,strong:ha,table:fa,tableCell:ja,tableRow:ga,text:Ea,thematicBreak:ba,toml:it,yaml:it,definition:it,footnoteDefinition:it};function it(){}const Ur=-1,ht=0,ut=1,ct=2,rn=3,sn=4,on=5,ln=6,$r=7,Kr=8,Mn=typeof self=="object"?self:globalThis,ka=(e,n)=>{const r=(s,l)=>(e.set(l,s),s),i=s=>{if(e.has(s))return e.get(s);const[l,o]=n[s];switch(l){case ht:case Ur:return r(o,s);case ut:{const a=r([],s);for(const u of o)a.push(i(u));return a}case ct:{const a=r({},s);for(const[u,c]of o)a[i(u)]=i(c);return a}case rn:return r(new Date(o),s);case sn:{const{source:a,flags:u}=o;return r(new RegExp(a,u),s)}case on:{const a=r(new Map,s);for(const[u,c]of o)a.set(i(u),i(c));return a}case ln:{const a=r(new Set,s);for(const u of o)a.add(i(u));return a}case $r:{const{name:a,message:u}=o;return r(new Mn[a](u),s)}case Kr:return r(BigInt(o),s);case"BigInt":return r(Object(BigInt(o)),s)}return r(new Mn[l](o),s)};return i},Pn=e=>ka(new Map,e)(0),He="",{toString:Ra}={},{keys:Ca}=Object,Je=e=>{const n=typeof e;if(n!=="object"||!e)return[ht,n];const r=Ra.call(e).slice(8,-1);switch(r){case"Array":return[ut,He];case"Object":return[ct,He];case"Date":return[rn,He];case"RegExp":return[sn,He];case"Map":return[on,He];case"Set":return[ln,He]}return r.includes("Array")?[ut,r]:r.includes("Error")?[$r,r]:[ct,r]},st=([e,n])=>e===ht&&(n==="function"||n==="symbol"),wa=(e,n,r,i)=>{const s=(o,a)=>{const u=i.push(o)-1;return r.set(a,u),u},l=o=>{if(r.has(o))return r.get(o);let[a,u]=Je(o);switch(a){case ht:{let x=o;switch(u){case"bigint":a=Kr,x=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);x=null;break;case"undefined":return s([Ur],o)}return s([a,x],o)}case ut:{if(u)return s([u,[...o]],o);const x=[],p=s([a,x],o);for(const m of o)x.push(l(m));return p}case ct:{if(u)switch(u){case"BigInt":return s([u,o.toString()],o);case"Boolean":case"Number":case"String":return s([u,o.valueOf()],o)}if(n&&"toJSON"in o)return l(o.toJSON());const x=[],p=s([a,x],o);for(const m of Ca(o))(e||!st(Je(o[m])))&&x.push([l(m),l(o[m])]);return p}case rn:return s([a,o.toISOString()],o);case sn:{const{source:x,flags:p}=o;return s([a,{source:x,flags:p}],o)}case on:{const x=[],p=s([a,x],o);for(const[m,d]of o)(e||!(st(Je(m))||st(Je(d))))&&x.push([l(m),l(d)]);return p}case ln:{const x=[],p=s([a,x],o);for(const m of o)(e||!st(Je(m)))&&x.push(l(m));return p}}const{message:c}=o;return s([a,{name:u,message:c}],o)};return l},Bn=(e,{json:n,lossy:r}={})=>{const i=[];return wa(!(n||r),!!n,new Map,i)(e),i},pt=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?Pn(Bn(e,n)):structuredClone(e):(e,n)=>Pn(Bn(e,n));function va(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function Na(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function Ia(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||va,i=e.options.footnoteBackLabel||Na,s=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let u=-1;for(;++u<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[u]);if(!c)continue;const x=e.all(c),p=String(c.identifier).toUpperCase(),m=Qe(p.toLowerCase());let d=0;const g=[],E=e.footnoteCounts.get(p);for(;E!==void 0&&++d<=E;){g.length>0&&g.push({type:"text",value:" "});let w=typeof r=="string"?r:r(u,d);typeof w=="string"&&(w={type:"text",value:w}),g.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+m+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(u,d),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const k=x[x.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const w=k.children[k.children.length-1];w&&w.type==="text"?w.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...g)}else x.push(...g);const y={type:"element",tagName:"li",properties:{id:n+"fn-"+m},children:e.wrap(x,!0)};e.patch(c,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...pt(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
169
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
170
|
+
`}]}}const Wr=function(e){if(e==null)return za;if(typeof e=="function")return ft(e);if(typeof e=="object")return Array.isArray(e)?Aa(e):Ta(e);if(typeof e=="string")return La(e);throw new Error("Expected function, string, or object as test")};function Aa(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Wr(e[r]);return ft(i);function i(...s){let l=-1;for(;++l<n.length;)if(n[l].apply(this,s))return!0;return!1}}function Ta(e){const n=e;return ft(r);function r(i){const s=i;let l;for(l in e)if(s[l]!==n[l])return!1;return!0}}function La(e){return ft(n);function n(r){return r&&r.type===e}}function ft(e){return n;function n(r,i,s){return!!(Oa(r)&&e.call(this,r,typeof i=="number"?i:void 0,s||void 0))}}function za(){return!0}function Oa(e){return e!==null&&typeof e=="object"&&"type"in e}const Qr=[],Da=!0,_n=!1,Fa="skip";function Ma(e,n,r,i){let s;typeof n=="function"&&typeof r!="function"?(i=r,r=n):s=n;const l=Wr(s),o=i?-1:1;a(e,void 0,[])();function a(u,c,x){const p=u&&typeof u=="object"?u:{};if(typeof p.type=="string"){const d=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(u.type+(d?"<"+d+">":""))+")"})}return m;function m(){let d=Qr,g,E,k;if((!n||l(u,c,x[x.length-1]||void 0))&&(d=Pa(r(u,x)),d[0]===_n))return d;if("children"in u&&u.children){const y=u;if(y.children&&d[0]!==Fa)for(E=(i?y.children.length:-1)+o,k=x.concat(y);E>-1&&E<y.children.length;){const w=y.children[E];if(g=a(w,E,k)(),g[0]===_n)return g;E=typeof g[1]=="number"?g[1]:E+o}}return d}}}function Pa(e){return Array.isArray(e)?e:typeof e=="number"?[Da,e]:e==null?Qr:[e]}function Gr(e,n,r,i){let s,l,o;typeof n=="function"&&typeof r!="function"?(l=void 0,o=n,s=r):(l=n,o=r,s=i),Ma(e,l,a,s);function a(u,c){const x=c[c.length-1],p=x?x.children.indexOf(u):void 0;return o(u,p,x)}}const Vt={}.hasOwnProperty,Ba={};function _a(e,n){const r=n||Ba,i=new Map,s=new Map,l=new Map,o={...Sa,...r.handlers},a={all:c,applyData:Va,definitionById:i,footnoteById:s,footnoteCounts:l,footnoteOrder:[],handlers:o,one:u,options:r,patch:qa,wrap:Ua};return Gr(e,function(x){if(x.type==="definition"||x.type==="footnoteDefinition"){const p=x.type==="definition"?i:s,m=String(x.identifier).toUpperCase();p.has(m)||p.set(m,x)}}),a;function u(x,p){const m=x.type,d=a.handlers[m];if(Vt.call(a.handlers,m)&&d)return d(a,x,p);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in x){const{children:E,...k}=x,y=pt(k);return y.children=a.all(x),y}return pt(x)}return(a.options.unknownHandler||Ha)(a,x,p)}function c(x){const p=[];if("children"in x){const m=x.children;let d=-1;for(;++d<m.length;){const g=a.one(m[d],x);if(g){if(d&&m[d-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=qn(g.value)),!Array.isArray(g)&&g.type==="element")){const E=g.children[0];E&&E.type==="text"&&(E.value=qn(E.value))}Array.isArray(g)?p.push(...g):p.push(g)}}}return p}}function qa(e,n){e.position&&(n.position=Ss(e))}function Va(e,n){let r=n;if(e&&e.data){const i=e.data.hName,s=e.data.hChildren,l=e.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const o="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:o}}r.type==="element"&&l&&Object.assign(r.properties,pt(l)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function Ha(e,n){const r=n.data||{},i="value"in n&&!(Vt.call(r,"hProperties")||Vt.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function Ua(e,n){const r=[];let i=-1;for(n&&r.push({type:"text",value:`
|
|
171
|
+
`});++i<e.length;)i&&r.push({type:"text",value:`
|
|
172
|
+
`}),r.push(e[i]);return n&&e.length>0&&r.push({type:"text",value:`
|
|
173
|
+
`}),r}function qn(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function Vn(e,n){const r=_a(e,n),i=r.one(e,void 0),s=Ia(r),l=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return s&&l.children.push({type:"text",value:`
|
|
174
|
+
`},s),l}function $a(e,n){return e&&"run"in e?async function(r,i){const s=Vn(r,{file:i,...n});await e.run(s,i)}:function(r,i){return Vn(r,{file:i,...n||e})}}function Hn(e){if(e)throw e}var at=Object.prototype.hasOwnProperty,Jr=Object.prototype.toString,Un=Object.defineProperty,$n=Object.getOwnPropertyDescriptor,Kn=function(n){return typeof Array.isArray=="function"?Array.isArray(n):Jr.call(n)==="[object Array]"},Wn=function(n){if(!n||Jr.call(n)!=="[object Object]")return!1;var r=at.call(n,"constructor"),i=n.constructor&&n.constructor.prototype&&at.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!r&&!i)return!1;var s;for(s in n);return typeof s>"u"||at.call(n,s)},Qn=function(n,r){Un&&r.name==="__proto__"?Un(n,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):n[r.name]=r.newValue},Gn=function(n,r){if(r==="__proto__")if(at.call(n,r)){if($n)return $n(n,r).value}else return;return n[r]},Ka=function e(){var n,r,i,s,l,o,a=arguments[0],u=1,c=arguments.length,x=!1;for(typeof a=="boolean"&&(x=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});u<c;++u)if(n=arguments[u],n!=null)for(r in n)i=Gn(a,r),s=Gn(n,r),a!==s&&(x&&s&&(Wn(s)||(l=Kn(s)))?(l?(l=!1,o=i&&Kn(i)?i:[]):o=i&&Wn(i)?i:{},Qn(a,{name:r,newValue:e(x,o,s)})):typeof s<"u"&&Qn(a,{name:r,newValue:s}));return a};const vt=t.getDefaultExportFromCjs(Ka);function Ht(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Wa(){const e=[],n={run:r,use:i};return n;function r(...s){let l=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(u,...c){const x=e[++l];let p=-1;if(u){o(u);return}for(;++p<s.length;)(c[p]===null||c[p]===void 0)&&(c[p]=s[p]);s=c,x?Qa(x,a)(...c):o(null,...c)}}function i(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),n}}function Qa(e,n){let r;return i;function i(...o){const a=e.length>o.length;let u;a&&o.push(s);try{u=e.apply(this,o)}catch(c){const x=c;if(a&&r)throw x;return s(x)}a||(u instanceof Promise?u.then(l,s):u instanceof Error?s(u):l(u))}function s(o,...a){r||(r=!0,n(o,...a))}function l(o){s(null,o)}}const Se={basename:Ga,dirname:Ja,extname:Xa,join:Ya,sep:"/"};function Ga(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');nt(e);let r=0,i=-1,s=e.length,l;if(n===void 0||n.length===0||n.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(l){r=s+1;break}}else i<0&&(l=!0,i=s+1);return i<0?"":e.slice(r,i)}if(n===e)return"";let o=-1,a=n.length-1;for(;s--;)if(e.codePointAt(s)===47){if(l){r=s+1;break}}else o<0&&(l=!0,o=s+1),a>-1&&(e.codePointAt(s)===n.codePointAt(a--)?a<0&&(i=s):(a=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)}function Ja(e){if(nt(e),e.length===0)return".";let n=-1,r=e.length,i;for(;--r;)if(e.codePointAt(r)===47){if(i){n=r;break}}else i||(i=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function Xa(e){nt(e);let n=e.length,r=-1,i=0,s=-1,l=0,o;for(;n--;){const a=e.codePointAt(n);if(a===47){if(o){i=n+1;break}continue}r<0&&(o=!0,r=n+1),a===46?s<0?s=n:l!==1&&(l=1):s>-1&&(l=-1)}return s<0||r<0||l===0||l===1&&s===r-1&&s===i+1?"":e.slice(s,r)}function Ya(...e){let n=-1,r;for(;++n<e.length;)nt(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":Za(r)}function Za(e){nt(e);const n=e.codePointAt(0)===47;let r=eu(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function eu(e,n){let r="",i=0,s=-1,l=0,o=-1,a,u;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||l===1))if(s!==o-1&&l===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(u=r.lastIndexOf("/"),u!==r.length-1){u<0?(r="",i=0):(r=r.slice(0,u),i=r.length-1-r.lastIndexOf("/")),s=o,l=0;continue}}else if(r.length>0){r="",i=0,s=o,l=0;continue}}n&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+e.slice(s+1,o):r=e.slice(s+1,o),i=o-s-1;s=o,l=0}else a===46&&l>-1?l++:l=-1}return r}function nt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const tu={cwd:nu};function nu(){return"/"}function Ut(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ru(e){if(typeof e=="string")e=new URL(e);else if(!Ut(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return iu(e)}function iu(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const i=n.codePointAt(r+2);if(i===70||i===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(n)}const Nt=["history","path","basename","stem","extname","dirname"];class Xr{constructor(n){let r;n?Ut(n)?r={path:n}:typeof n=="string"||su(n)?r={value:n}:r=n:r={},this.cwd=tu.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Nt.length;){const l=Nt[i];l in r&&r[l]!==void 0&&r[l]!==null&&(this[l]=l==="history"?[...r[l]]:r[l])}let s;for(s in r)Nt.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?Se.basename(this.path):void 0}set basename(n){At(n,"basename"),It(n,"basename"),this.path=Se.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?Se.dirname(this.path):void 0}set dirname(n){Jn(this.basename,"dirname"),this.path=Se.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?Se.extname(this.path):void 0}set extname(n){if(It(n,"extname"),Jn(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Se.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Ut(n)&&(n=ru(n)),At(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?Se.basename(this.path,this.extname):void 0}set stem(n){At(n,"stem"),It(n,"stem"),this.path=Se.join(this.dirname||"",n+(this.extname||""))}fail(n,r,i){const s=this.message(n,r,i);throw s.fatal=!0,s}info(n,r,i){const s=this.message(n,r,i);return s.fatal=void 0,s}message(n,r,i){const s=new ae(n,r,i);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function It(e,n){if(e&&e.includes(Se.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+Se.sep+"`")}function At(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function Jn(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function su(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ou=function(e){const i=this.constructor.prototype,s=i[e],l=function(){return s.apply(l,arguments)};Object.setPrototypeOf(l,i);const o=Object.getOwnPropertyNames(s);for(const a of o){const u=Object.getOwnPropertyDescriptor(s,a);u&&Object.defineProperty(l,a,u)}return l},lu={}.hasOwnProperty;class an extends ou{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Wa()}copy(){const n=new an;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];n.use(...i)}return n.data(vt(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(zt("data",this.frozen),this.namespace[n]=r,this):lu.call(this.namespace,n)&&this.namespace[n]||void 0:n?(zt("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const s=r.call(n,...i);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=ot(n),i=this.parser||this.Parser;return Tt("parse",i),i(String(r),r)}process(n,r){const i=this;return this.freeze(),Tt("process",this.parser||this.Parser),Lt("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(l,o){const a=ot(n),u=i.parse(a);i.run(u,a,function(x,p,m){if(x||!p||!m)return c(x);const d=p,g=i.stringify(d,m);cu(g)?m.value=g:m.result=g,c(x,m)});function c(x,p){x||!p?o(x):l?l(p):r(void 0,p)}}}processSync(n){let r=!1,i;return this.freeze(),Tt("processSync",this.parser||this.Parser),Lt("processSync",this.compiler||this.Compiler),this.process(n,s),Yn("processSync","process",r),i;function s(l,o){r=!0,Hn(l),i=o}}run(n,r,i){Xn(n),this.freeze();const s=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?l(void 0,i):new Promise(l);function l(o,a){const u=ot(r);s.run(n,u,c);function c(x,p,m){const d=p||n;x?a(x):o?o(d):i(void 0,d,m)}}}runSync(n,r){let i=!1,s;return this.run(n,r,l),Yn("runSync","run",i),s;function l(o,a){Hn(o),s=a,i=!0}}stringify(n,r){this.freeze();const i=ot(r),s=this.compiler||this.Compiler;return Lt("stringify",s),Xn(n),s(n,i)}use(n,...r){const i=this.attachers,s=this.namespace;if(zt("use",this.frozen),n!=null)if(typeof n=="function")u(n,r);else if(typeof n=="object")Array.isArray(n)?a(n):o(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function l(c){if(typeof c=="function")u(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[x,...p]=c;u(x,p)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(s.settings=vt(!0,s.settings,c.settings))}function a(c){let x=-1;if(c!=null)if(Array.isArray(c))for(;++x<c.length;){const p=c[x];l(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,x){let p=-1,m=-1;for(;++p<i.length;)if(i[p][0]===c){m=p;break}if(m===-1)i.push([c,...x]);else if(x.length>0){let[d,...g]=x;const E=i[m][1];Ht(E)&&Ht(d)&&(d=vt(!0,E,d)),i[m]=[c,d,...g]}}}}const au=new an().freeze();function Tt(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Lt(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function zt(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Xn(e){if(!Ht(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Yn(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function ot(e){return uu(e)?e:new Xr(e)}function uu(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function cu(e){return typeof e=="string"||pu(e)}function pu(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const xu="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Zn=[],er={allowDangerousHtml:!0},du=/^(https?|ircs?|mailto|xmpp)$/i,mu=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function hu(e){const n=e.allowedElements,r=e.allowElement,i=e.children||"",s=e.className,l=e.components,o=e.disallowedElements,a=e.rehypePlugins||Zn,u=e.remarkPlugins||Zn,c=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...er}:er,x=e.skipHtml,p=e.unwrapDisallowed,m=e.urlTransform||fu,d=au().use(Jl).use(u).use($a,c).use(a),g=new Xr;typeof i=="string"&&(g.value=i);for(const w of mu)Object.hasOwn(e,w.from)&&(""+w.from+(w.to?"use `"+w.to+"` instead":"remove it")+xu+w.id,void 0);const E=d.parse(g);let k=d.runSync(E,g);return s&&(k={type:"element",tagName:"div",properties:{className:s},children:k.type==="root"?k.children:[k]}),Gr(k,y),Ns(k,{Fragment:t.jsxRuntimeExports.Fragment,components:l,ignoreInvalidStyle:!0,jsx:t.jsxRuntimeExports.jsx,jsxs:t.jsxRuntimeExports.jsxs,passKeys:!0,passNode:!0});function y(w,R,I){if(w.type==="raw"&&I&&typeof R=="number")return x?I.children.splice(R,1):I.children[R]={type:"text",value:w.value},R;if(w.type==="element"){let O;for(O in Rt)if(Object.hasOwn(Rt,O)&&Object.hasOwn(w.properties,O)){const b=w.properties[O],D=Rt[O];(D===null||D.includes(w.tagName))&&(w.properties[O]=m(String(b||""),O,w))}}if(w.type==="element"){let O=n?!n.includes(w.tagName):o?o.includes(w.tagName):!1;if(!O&&r&&typeof R=="number"&&(O=!r(w,R,I)),O&&I&&typeof R=="number")return p&&w.children?I.children.splice(R,1,...w.children):I.children.splice(R,1),R}}}function fu(e){const n=e.indexOf(":"),r=e.indexOf("?"),i=e.indexOf("#"),s=e.indexOf("/");return n<0||s>-1&&n>s||r>-1&&n>r||i>-1&&n>i||du.test(e.slice(0,n))?e:""}const gu=`
|
|
175
|
+
|
|
176
|
+
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.
|
|
177
|
+
|
|
178
|
+
Bar / Line Chart:
|
|
179
|
+
|
|
180
|
+
SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table
|
|
181
|
+
|
|
182
|
+
- X-axis - Category
|
|
183
|
+
- Y-axis - Number
|
|
184
|
+
|
|
185
|
+
Stacked Chart:
|
|
186
|
+
|
|
187
|
+
SELECT x-axis, stack-by, y-axis FROM table
|
|
188
|
+
|
|
189
|
+
- X-axis - Category
|
|
190
|
+
- Stack by - Category
|
|
191
|
+
- Y-axis - Number
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
Scatter Chart:
|
|
195
|
+
|
|
196
|
+
SELECT label, x-axis, y-axis FROM table
|
|
197
|
+
|
|
198
|
+
- Label - Category
|
|
199
|
+
- Group (opt) - Category
|
|
200
|
+
- X-axis - Number
|
|
201
|
+
- Y-axis - Number
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
Bubble Chart:
|
|
205
|
+
|
|
206
|
+
SELECT label, x-axis, y-axis, radius FROM table
|
|
207
|
+
|
|
208
|
+
- Label - Category
|
|
209
|
+
- Bubble Group (opt) - Category
|
|
210
|
+
- X-axis - Number
|
|
211
|
+
- Y-axis - Number
|
|
212
|
+
- Radius - Number
|
|
213
|
+
|
|
214
|
+
Pie / Dougnut Chart:
|
|
215
|
+
|
|
216
|
+
SELECT label, measure FROM table
|
|
217
|
+
|
|
218
|
+
- Label - Category
|
|
219
|
+
- Measure - Number
|
|
220
|
+
`;function ju({open:e,setOpen:n,userInput:r,setUserInput:i,triggerAIRun:s,setTriggerAIRun:l}){const o=T.useRef(null),a=T.useRef(null),{authToken:u}=t.useSemaphorContext(),[c,x]=T.useState(!1),p=t.useEditorStore(N=>N.actions.setCardSql),m=t.useDashboardStore(N=>N.dashboard.baseQueries),d=t.useEditorStore(N=>N.actions.setRunSql),g=t.useEditorStore(N=>N.actions.setCardType),[E,k]=T.useState([]),y=t.useEditorStore(N=>N.currentColumns),w=t.useEditorStore(N=>N.card.sql),R=t.useEditorStore(N=>N.selectedTableName),I=`
|
|
221
|
+
${r}
|
|
222
|
+
|
|
223
|
+
Database Query Dialect: ${R==="api"||R==="s3"?"DuckDb":""}
|
|
224
|
+
Table Name: ${R}
|
|
225
|
+
Table Columns: ${y==null?void 0:y.map(N=>`${N.column_name} | ${N.data_type}`).join(", ")}
|
|
226
|
+
User SQL: ${w}
|
|
227
|
+
${m&&`Base Queries: ${JSON.stringify(m)} `}`,O=` 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.
|
|
228
|
+
Visual Query Syntax: ${gu}`,{data:b,isLoading:D,isFetching:W,isError:H,refetch:V}=t.useQuery({queryKey:["ai-query"],queryFn:()=>t.getRequest("https://semaphor.cloud/api/v1/ai",(u==null?void 0:u.accessToken)||"",{user_content:`userContent: ${I} ${c?O:""}`}),enabled:!1});function A(N){if(N.toLowerCase().includes("bar"))g("bar");else if(N.toLowerCase().includes("line"))g("line");else if(N.toLowerCase().includes("bubble"))g("bubble");else if(N.toLowerCase().includes("scatter"))g("scatter");else if(N.toLowerCase().includes("stacked"))g("stackedBar");else if(N.toLowerCase().includes("pie"))g("pie");else if(N.toLowerCase().includes("donut")||N.toLowerCase().includes("doughnut"))g("doughnut");else if(N.toLowerCase().includes("radar"))g("radar");else return g("bar"),!1;return!0}T.useEffect(()=>{b&&k(N=>[...N,{role:"ai",content:b.response}])},[b]),T.useEffect(()=>{const N=setTimeout(()=>{var h;a.current&&(a.current.scroll({top:a.current.scrollHeight,behavior:"smooth"}),(h=o.current)==null||h.focus())},100);return()=>clearTimeout(N)},[E]);function v(){r&&(k(N=>[...N,{role:"user",content:r}]),A(r)&&x(!0),i(""),V())}T.useEffect(()=>{s&&(v(),l(!1))},[s,l]);const $={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,width:"100%"},K={fontFamily:"monospace",fontSize:14,lineHeight:1.6},B={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,padding:"2px 0",marginLeft:20,listStyleType:"disc"},G={p:({node:N,...h})=>t.jsxRuntimeExports.jsx("p",{style:$,...h}),code:({node:N,...h})=>t.jsxRuntimeExports.jsx("code",{className:"rounded-sm bg-muted px-2 py-1 text-sm",...h}),pre:({node:N,...h})=>t.jsxRuntimeExports.jsxs("pre",{className:"space-y-2 rounded-sm bg-muted/50 p-3",style:K,children:[t.jsxRuntimeExports.jsx("code",{className:"whitespace-normal text-sm",children:h.children}),t.jsxRuntimeExports.jsxs("div",{className:"flex justify-start gap-2",children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:L,size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:J=>{const X=L(J);X&&(n(!1),p(X),d(!0))},size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(t.PlayIcon,{})})]})]}),li:({node:N,...h})=>t.jsxRuntimeExports.jsx("li",{style:B,...h})};function L(N){const h=N.currentTarget.closest("pre");if(!h)return;const J=h.textContent||h.innerText;return navigator.clipboard.writeText(J).then(()=>console.log("Text copied to clipboard")).catch(X=>console.error("Error in copying text: ",X)),J}function M(){return E==null?void 0:E.map((N,h)=>N.role==="user"?t.jsxRuntimeExports.jsxs("div",{className:"flex items-start rounded-md bg-muted p-3 text-sm",children:[t.jsxRuntimeExports.jsx(Li,{className:"mr-2 h-5 w-5"}),t.jsxRuntimeExports.jsx("div",{children:N.content})]},h):N.role==="ai"?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(hu,{className:"w-full overflow-auto py-1",components:G,children:b==null?void 0:b.response},h)}):t.jsxRuntimeExports.jsx("div",{},h))}return t.jsxRuntimeExports.jsxs(t.Dialog,{open:e,onOpenChange:n,children:[t.jsxRuntimeExports.jsx(t.DialogTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.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..."})}),t.jsxRuntimeExports.jsxs(t.DialogContent,{className:"flex flex-col justify-between overflow-auto sm:max-w-[425px] md:max-h-[625px] md:min-w-[625px]",children:[t.jsxRuntimeExports.jsxs(t.DialogHeader,{children:[t.jsxRuntimeExports.jsx(t.DialogTitle,{children:"Assistant"}),t.jsxRuntimeExports.jsx(t.DialogDescription,{children:"What can I help you with?"})]}),t.jsxRuntimeExports.jsx("div",{ref:a,className:"h-[625px] w-full overflow-auto border-t border-t-muted",children:t.jsxRuntimeExports.jsx("div",{className:"space-y-4 py-2 pr-3",role:"messages",children:M()})}),t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center rounded-md border",children:[t.jsxRuntimeExports.jsx(t.Textarea,{autoFocus:!0,ref:o,onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),i(""),v())},placeholder:"Type your question here...",onFocus:N=>{const h=N.target,J=h.value.length;h.setSelectionRange(J,J)},className:t.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:D||W,value:r,onChange:N=>i(N.target.value)})," ",t.jsxRuntimeExports.jsx(t.Button,{className:"h-8",size:"sm",variant:"ghost",onClick:v,children:!D&&!W?t.jsxRuntimeExports.jsx(t.PaperPlaneIcon,{}):t.jsxRuntimeExports.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"})})]})})]})]})}var Yr={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},tr=T.createContext&&T.createContext(Yr),yu=["attr","size","title"];function Eu(e,n){if(e==null)return{};var r=bu(e,n),i,s;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s<l.length;s++)i=l[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function bu(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,l;for(l=0;l<i.length;l++)s=i[l],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}function xt(){return xt=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},xt.apply(this,arguments)}function nr(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function dt(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?nr(Object(r),!0).forEach(function(i){Su(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nr(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Su(e,n,r){return n=ku(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function ku(e){var n=Ru(e,"string");return typeof n=="symbol"?n:String(n)}function Ru(e,n){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Zr(e){return e&&e.map((n,r)=>T.createElement(n.tag,dt({key:r},n.attr),Zr(n.child)))}function Be(e){return n=>T.createElement(Cu,xt({attr:dt({},e.attr)},n),Zr(e.child))}function Cu(e){var n=r=>{var{attr:i,size:s,title:l}=e,o=Eu(e,yu),a=s||r.size||"1em",u;return r.className&&(u=r.className),e.className&&(u=(u?u+" ":"")+e.className),T.createElement("svg",xt({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,i,o,{className:u,style:dt(dt({color:e.color||r.color},r.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),l&&T.createElement("title",null,l),e.children)};return tr!==void 0?T.createElement(tr.Consumer,null,r=>n(r)):n(Yr)}function wu(e){return Be({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:[]}]})(e)}function vu(){const{theme:e}=t.useTheme(),n=T.useRef(),r=T.useRef(),[i,s]=T.useState(!1),[l,o]=T.useState(!1),[a,u]=T.useState(!1),[c,x]=T.useState(""),[p,m]=T.useState(!1),{authToken:d}=t.useSemaphorContext();t.useDashboardStore(j=>j.selectedSheetId);const g=t.useDashboardStore(j=>j.dashboard.baseQueries),E=t.useEditorStore(j=>j.card),k=t.useDashboardStore(j=>j.theme),y=t.useEditorStore(j=>j.isShowingVisual),w=t.useEditorStore(j=>j.selectedConnectionId),R=t.useEditorStore(j=>j.selectedDatabaseName),I=t.useEditorStore(j=>j.selectedSchemaName);t.useDashboardStore(j=>j.actions.updateFrameCard);const O=t.useEditorStore(j=>j.selectedTableName),b=t.useEditorStore(j=>j.card.sql),D=t.useEditorStore(j=>j.card.python),W=t.resolveBaseQuery(b,g),H=t.useEditorStore(j=>j.selectedConnectionId),V=t.useEditorStore(j=>j.frame),A=t.useEditorStore(j=>j.filterValues),v=t.useEditorStore(j=>j.applyFilters),{setCardCustomCfg:$,setQueryResultColumns:K,setFilterValues:B,setCardSql:G,setCardPython:L,setQueryError:M,setPythonStdOut:N,setCardPreferences:h}=t.useEditorStore(j=>j.actions),J=t.useEditorStore(j=>j.onSave),X=t.useEditorStore(j=>j.actions.setApplyFilters),f=t.useEditorStore(j=>j.onClose),ne=t.useEditorStore(j=>j.actions.setCardData),ue=t.useEditorStore(j=>j.actions.setSqlGen),ee=t.useEditorStore(j=>j.runSql),xe=t.useEditorStore(j=>j.actions.setRunSql),oe=t.useEditorStore(j=>j.actions.setIsSqlRunning),{data:ie,isLoading:le,isFetching:Ee,isSuccess:_e,isError:Ie,error:Ae,status:qe,refetch:be}=t.useQuery({queryKey:[W,D],queryFn:()=>t.postRequest("https://semaphor.cloud/api/v1/query",(d==null?void 0:d.accessToken)||"",{connection_id:H,sql:W,python:D===t.PYTHON_DEFAULT_CODE?"":D,active_filters:v?A:[]}),enabled:!1,retry:!1});T.useEffect(()=>{if(ie&&(ne(ie.records),N((ie==null?void 0:ie.output)||""),ie.records.length>0)){const{dimensionKeys:j}=t.getKeys(ie.records);K(j)}},[ie,ne,K,N]),T.useEffect(()=>{ee&&(be(),xe(!1))},[ee,be,xe]),T.useEffect(()=>{(le||Ee)&&oe(!0),(Ie||_e)&&oe(!1),Ie?(M(Ae.message),ne([]),K([]),N("")):M("")},[le,Ee,ie,N,Ie,_e,oe,ne,K,M,Ae]);function Ve(){G(""),ne([]),ue({}),$(""),h({})}const Te=j=>{r.current=j};function z(){let j=b;b&&!b.includes("{{")&&(j=Bi(b),G(j));const F={...E,lastSelectedSchema:I,lastSelectedDatabase:R,lastSelectedTable:O,connectionId:w,type:y?E.type:"table",sql:j,customCfg:y?E.customCfg:null},_=V.cards.map(U=>U.id===E.id?F:U);J==null||J({...V,cards:_})}function gt(){f==null||f()}function jt(j){const F=getComputedStyle(document.documentElement).getPropertyValue(j);return yt(F)}function yt(j){const[F,_,U]=j.split(" "),te=parseFloat(F),Ce=parseFloat(_),ye=parseFloat(U),De=Ce/100,Le=ye/100,re=(1-Math.abs(2*Le-1))*De,de=re*(1-Math.abs(te/60%2-1)),me=Le-re/2;let we=0,ve=0,Ne=0;0<=te&&te<60?(we=re,ve=de,Ne=0):60<=te&&te<120?(we=de,ve=re,Ne=0):120<=te&&te<180?(we=0,ve=re,Ne=de):180<=te&&te<240?(we=0,ve=de,Ne=re):240<=te&&te<300?(we=de,ve=0,Ne=re):300<=te&&te<360&&(we=re,ve=0,Ne=de),we=Math.round((we+me)*255),ve=Math.round((ve+me)*255),Ne=Math.round((Ne+me)*255);const bt=ai=>{const St=ai.toString(16);return St.length==1?"0"+St:St};return`#${bt(we)}${bt(ve)}${bt(Ne)}`}T.useEffect(()=>{const j=n.current,F=r.current;if(j){const _=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",U=k==="system"?_:k;j.editor.defineTheme("default",{base:U==="light"?"vs":"vs-dark",inherit:!0,rules:[],colors:{"editor.background":U==="light"?"#ffffff":jt("--background")}}),j.editor.setTheme("default")}return F&&j&&F.addCommand(j.KeyMod.Shift|j.KeyCode.Enter,function(){return console.log("Executing query..."),be(),!1}),()=>{}},[e,k,n.current]);function rt(j){n.current=j}function Et(){return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[l&&t.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:t.jsxRuntimeExports.jsxs("div",{className:"w-[99%]",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[t.jsxRuntimeExports.jsx(qi,{checked:v,onCheckedChange:()=>X(!v),text:"Apply Filters"}),t.jsxRuntimeExports.jsx(Vi,{}),A&&l&&t.jsxRuntimeExports.jsx(t.Cross2Icon,{onClick:()=>o(!1),className:"bg-background/50 text-foreground/50 hover:cursor-pointer hover:text-foreground"})]}),t.jsxRuntimeExports.jsx(t.Ft,{theme:"default",onChange:j=>{if(j)try{JSON.parse(j),B(JSON.parse(j))}catch{}},defaultLanguage:"json",className:"mt-1 min-h-[220px]",value:JSON.stringify(A,null,2),options:{readOnly:!0,minimap:{enabled:!1},lineNumbers:"off",glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}),A&&!l&&t.jsxRuntimeExports.jsx(sr,{onClick:()=>o(!0),className:t.cn("absolute bottom-4 right-6 h-3 w-3 text-foreground/50 hover:cursor-pointer hover:text-foreground",{"font-bold text-red-800":v})})]})}function S(){return t.jsxRuntimeExports.jsxs(Ot,{className:"flex grow pb-1",direction:"vertical",role:"editor-resizable-group",children:[t.jsxRuntimeExports.jsxs(Ue,{id:"1",order:1,defaultSize:i?20:100,className:"relative flex grow",children:[t.jsxRuntimeExports.jsx("div",{role:"sql-container",className:"relative flex w-[99%]",children:t.jsxRuntimeExports.jsx(t.Ft,{theme:"default",className:"pt-3",onChange:j=>{G(j)},value:b,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"sql",defaultValue:"SELECT * FROM table",beforeMount:rt,onMount:Te})}),i&&t.jsxRuntimeExports.jsx("code",{className:"absolute right-6 top-3 text-sm text-muted-foreground/70",children:"sql"})]}),i&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Dt,{withHandle:!0,className:"border"}),t.jsxRuntimeExports.jsxs(Ue,{id:"2",order:2,defaultSize:80,className:"relative flex grow",children:[t.jsxRuntimeExports.jsx("div",{role:"python-container",className:"relative flex w-[99%] pt-0",children:t.jsxRuntimeExports.jsx(t.Ft,{className:"pt-3",theme:"default",onChange:j=>{L(j&&j.trim()||"")},value:D||t.PYTHON_DEFAULT_CODE,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"python",beforeMount:rt,onMount:Te})}),t.jsxRuntimeExports.jsx("code",{className:"absolute right-6 top-3 text-sm text-muted-foreground/70",children:"python"})]})]})]})}return t.jsxRuntimeExports.jsxs("section",{role:"editor-section",className:"flex grow flex-col justify-end",children:[t.jsxRuntimeExports.jsxs("div",{role:"sql-editor",className:"relative flex grow justify-between overflow-y-scroll",children:[S(),Et()]}),t.jsxRuntimeExports.jsxs("div",{role:"editor-controls",className:"item-center flex flex-wrap justify-between gap-2 px-6 py-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex grow items-center gap-2",children:[t.jsxRuntimeExports.jsxs(t.Button,{disabled:le||Ee,onClick:()=>{be()},className:"shrink-0",size:"sm",variant:"outline",children:[le||Ee?t.jsxRuntimeExports.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin text-foreground/50"}):t.jsxRuntimeExports.jsx(Ri,{className:"mr-2 h-4 w-4"}),"Run"]}),Ie&&t.jsxRuntimeExports.jsx(_i,{error:Ae.message,setShowAIDialog:u,setTriggerAIRun:m,setUserInputforAI:x}),t.jsxRuntimeExports.jsxs(t.Button,{onClick:Ve,className:"",size:"sm",variant:"outline",children:[t.jsxRuntimeExports.jsx(di,{className:"mr-2 size-4"}),"Clear"]}),t.jsxRuntimeExports.jsx(t.Toggle,{pressed:i,onPressedChange:j=>s(j),className:"",size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(wu,{className:"size-4 text-foreground/70"})}),t.jsxRuntimeExports.jsx(ju,{open:a,setOpen:u,userInput:c,triggerAIRun:p,setTriggerAIRun:m,setUserInput:j=>x(j)})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex items-end gap-2",children:[t.jsxRuntimeExports.jsxs(t.Button,{onClick:z,size:"sm",variant:"outline",children:[t.jsxRuntimeExports.jsx(t.Check,{className:"mr-2 size-4 font-bold text-green-600"}),"Accept"]}),t.jsxRuntimeExports.jsxs(t.Button,{onClick:gt,className:"w-full",size:"sm",variant:"outline",children:[t.jsxRuntimeExports.jsx(t.Cross2Icon,{className:"mr-2 size-4"}),"Close"]})]})]})]})}function Nu({data:e}){var o;const[n,r]=T.useState([]),s=Object.keys(e[0]).map(a=>({accessorKey:a,header:({column:u})=>{const c=u.getIsSorted();return t.jsxRuntimeExports.jsx("div",{className:"flex gap-2",children:t.jsxRuntimeExports.jsxs("div",{className:"flex cursor-pointer items-center",onClick:()=>u.toggleSorting(u.getIsSorted()==="asc"),children:[a,c==="asc"?t.jsxRuntimeExports.jsx(t.TriangleUpIcon,{className:"ml-2 h-5 w-5"}):c==="desc"?t.jsxRuntimeExports.jsx(t.TriangleDownIcon,{className:"ml-2 h-5 w-5"}):null]})})}})),l=t.useReactTable({data:e,columns:s,getCoreRowModel:t.getCoreRowModel(),getPaginationRowModel:t.getPaginationRowModel(),onSortingChange:r,getSortedRowModel:t.getSortedRowModel(),manualPagination:!0,state:{sorting:n}});return t.jsxRuntimeExports.jsxs(t.Table,{children:[t.jsxRuntimeExports.jsx(t.TableHeader,{children:l.getHeaderGroups().map(a=>t.jsxRuntimeExports.jsx(t.TableRow,{children:a.headers.map(u=>t.jsxRuntimeExports.jsx(t.TableHead,{className:"sticky top-0 bg-muted",children:u.isPlaceholder?null:t.flexRender(u.column.columnDef.header,u.getContext())},u.id))},a.id))}),t.jsxRuntimeExports.jsx(t.TableBody,{children:(o=l.getRowModel().rows)!=null&&o.length?l.getRowModel().rows.map(a=>t.jsxRuntimeExports.jsx(t.TableRow,{className:"whitespace-nowrap py-2","data-state":a.getIsSelected()&&"selected",children:a.getVisibleCells().map(u=>t.jsxRuntimeExports.jsx(t.TableCell,{children:t.flexRender(u.column.columnDef.cell,u.getContext())},u.id))},a.id)):t.jsxRuntimeExports.jsx(t.TableRow,{children:t.jsxRuntimeExports.jsx(t.TableCell,{colSpan:s.length,className:"h-24 text-center",children:"No results."})})})]})}function ei({className:e,...n}){T.useState(0);const r=t.useDashboardStore(o=>o.themeStyle),i=t.useEditorStore(o=>o.card),s=t.useEditorStore(o=>o.actions.setCard);if(T.useEffect(()=>{},[i.data,i.type,i.cfg,i.customCfg,r,i.preferences]),!i.id)return null;let l;return i.data&&i.data.length>0&&(l=t.createChartConfig({data:i.data,cardType:i.type,cfg:i.cfg,customCfg:i.customCfg,preferences:i.preferences})),t.jsxRuntimeExports.jsxs(t.Card,{role:"editor-visual-card",className:t.cn("relative flex h-full flex-col rounded-none",e),...n,children:[t.jsxRuntimeExports.jsxs(t.CardHeader,{className:"py-4",children:[t.jsxRuntimeExports.jsx(t.Editable,{text:i.title,onSave:o=>s({...i,title:o}),children:t.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:t.jsxRuntimeExports.jsx(t.CardTitle,{className:"text-base",children:i.title})})},i.title),t.jsxRuntimeExports.jsx(t.Editable,{text:i.description||"",onSave:o=>s({...i,description:o}),children:t.jsxRuntimeExports.jsxs(t.CardDescription,{children:[" ",i.description]})},i.description)]}),t.jsxRuntimeExports.jsxs(t.CardContent,{className:"flex grow flex-col pb-3",children:[i.type!=="table"&&l&&t.jsxRuntimeExports.jsx(t.ChartJsVisual,{cfg:l},JSON.stringify(l)+JSON.stringify(i.preferences)),i.type==="table"&&i.data&&i.data.length>0&&t.jsxRuntimeExports.jsx(t.$57acba87d6e25586$export$ccf8d8d7bbf3c2cc,{className:"flex min-h-0 flex-1 grow basis-0",children:t.jsxRuntimeExports.jsx(t.TableVisual,{card:i,data:i==null?void 0:i.data})})]})]})}function Iu(){const[e,n]=T.useState(!1),[r,i]=T.useState(""),[s,l]=T.useState(""),[o,a]=T.useState(""),u=t.useEditorStore(k=>k.card),c=t.useEditorStore(k=>k.card.customCfg),x=t.useEditorStore(k=>k.actions.setCardCustomCfg);function p(k){var R,I;const y={...k,data:{...k==null?void 0:k.data,datasets:(I=(R=k==null?void 0:k.data)==null?void 0:R.datasets)==null?void 0:I.map(O=>({...O,data:[]}))}};return JSON.stringify(y,null,1)}function m(){if(!u.data||u.data.length===0)return;const k=t.createChartConfig({data:u.data,cardType:u.type,cfg:u.cfg,preferences:u.preferences});k&&(i(JSON.stringify(k,null,1)),c&&l(JSON.stringify(c,null,1)))}function d(){if(s)try{const k=JSON.parse(s);return k?(x(k),a(""),l(""),k):void 0}catch(k){console.log(k),a("Invalid JSON")}}function g(){l(""),x(null)}function E(){let k;if(c){const y=t._.cloneDeep(u.cfg),w=t._.merge(y,c);return k=p(w),k}return r?(k=p(JSON.parse(r)),k):""}return t.jsxRuntimeExports.jsxs(t.Dialog,{open:e,onOpenChange:n,children:[t.jsxRuntimeExports.jsx(t.DialogTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.Button,{onClick:m,className:` ${c&&"border-foreground/50 dark:border-foreground/70"}`,size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(t.Settings,{className:"h-4 w-4"})})}),t.jsxRuntimeExports.jsxs(t.DialogContent,{className:"max-h-[70vh] min-h-[70vh] min-w-[900px] overflow-auto",children:[t.jsxRuntimeExports.jsxs(t.DialogHeader,{className:"",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.DialogTitle,{children:"Customize Card"}),t.jsxRuntimeExports.jsxs(t.Tooltip,{children:[t.jsxRuntimeExports.jsx(t.TooltipTrigger,{children:t.jsxRuntimeExports.jsx(ji,{onClick:()=>{navigator.clipboard.writeText(u.id)},className:"size-3 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),t.jsxRuntimeExports.jsx(t.TooltipContent,{side:"right",align:"center",children:t.jsxRuntimeExports.jsx("p",{className:"text-xs",children:"Copy Card ID"})})]})]}),t.jsxRuntimeExports.jsxs(t.DialogDescription,{children:["See the configuration options and documentation",t.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."})]})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex grow gap-2",children:[t.jsxRuntimeExports.jsx(ei,{className:"w-1/2 rounded shadow-none"}),t.jsxRuntimeExports.jsxs(t.Tabs,{defaultValue:"custom-config",className:"flex w-1/2 flex-col",children:[t.jsxRuntimeExports.jsxs(t.TabsList,{className:"justify-start rounded-sm rounded-b-none border border-b-0",children:[t.jsxRuntimeExports.jsxs(t.TabsTrigger,{value:"custom-config",children:[c&&t.jsxRuntimeExports.jsx(t.CheckIcon,{className:"mr-1 h-5 w-5 text-green-600"}),c?"Custom Config":"Default Config"]}),t.jsxRuntimeExports.jsx(t.TabsTrigger,{className:"",value:"output",children:"Output"})]}),t.jsxRuntimeExports.jsx(t.TabsContent,{className:"bg-red-x mt-0 grow rounded-b border border-t-0 p-2",value:"output",children:t.jsxRuntimeExports.jsx(t.Textarea,{disabled:!0,value:r,className:"h-full resize-none border-none font-mono focus-visible:ring-0 focus-visible:ring-offset-0"})}),t.jsxRuntimeExports.jsx(t.TabsContent,{className:"mt-0 grow rounded-b border border-t-0",value:"custom-config",children:t.jsxRuntimeExports.jsx(t.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:E(),onChange:k=>l(k)})})]})]}),t.jsxRuntimeExports.jsxs(t.DialogFooter,{className:"flex items-center",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"mr-2 text-red-500",children:o}),t.jsxRuntimeExports.jsx(t.Button,{disabled:!c,onClick:g,variant:"outline",children:"Reset"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:d,variant:"outline",children:"Apply"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>n(!1),variant:"outline",children:"Close"})]})]})]})}function ti(e){return Be({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:[]}]})(e)}function ni(e){return Be({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:[]}]})(e)}function ri(e){return Be({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:[]}]})(e)}function ii(e){return Be({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:[]}]})(e)}function si(e){return Be({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:[]}]})(e)}function oi(e){return Be({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:[]}]})(e)}function Au(){const[e,n]=T.useState(!1),r=t.useEditorStore(a=>a.card.type),{setCardType:i,setCardPreferences:s}=t.useEditorStore(a=>a.actions),l=t.useEditorStore(a=>a.actions.setCardCustomCfg);function o(a){i(a),l(null),s({}),n(!1)}return t.jsxRuntimeExports.jsxs(t.Popover,{open:e,onOpenChange:n,children:[t.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(Tu,{className:"h-4 w-4",chartType:r})})}),t.jsxRuntimeExports.jsx(t.PopoverContent,{className:"w-50",children:t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 place-items-center",children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("bar"),className:"font-normal",variant:"ghost",children:t.jsxRuntimeExports.jsx($t,{className:"size-5"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("line"),variant:"ghost",children:t.jsxRuntimeExports.jsx(Kt,{className:"size-5"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("stackedBar"),variant:"ghost",children:t.jsxRuntimeExports.jsx(si,{className:"size-5",strokeWidth:0})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("scatter"),variant:"ghost",children:t.jsxRuntimeExports.jsx(ur,{className:"size-5"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("bubble"),variant:"ghost",children:t.jsxRuntimeExports.jsx(ii,{className:"size-4"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("pie"),variant:"ghost",children:t.jsxRuntimeExports.jsx(lr,{className:"size-5"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("doughnut"),variant:"ghost",children:t.jsxRuntimeExports.jsx(ni,{className:"size-5",strokeWidth:1})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("radar"),variant:"ghost",children:t.jsxRuntimeExports.jsx(ti,{className:"size-5 font-extralight",strokeWidth:.5})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("polarArea"),variant:"ghost",children:t.jsxRuntimeExports.jsx(ri,{className:"size-5"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("table"),variant:"ghost",children:t.jsxRuntimeExports.jsx(Wt,{className:"size-5"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("kpi"),variant:"ghost",children:t.jsxRuntimeExports.jsx(oi,{className:"size-6"})})]})})]})}function Tu({chartType:e,className:n}){switch(e){case"bar":return t.jsxRuntimeExports.jsx($t,{className:n});case"line":return t.jsxRuntimeExports.jsx(Kt,{className:n});case"pie":return t.jsxRuntimeExports.jsx(lr,{className:n});case"radar":return t.jsxRuntimeExports.jsx(ti,{className:n});case"scatter":return t.jsxRuntimeExports.jsx(ur,{className:n});case"bubble":return t.jsxRuntimeExports.jsx(ii,{className:n});case"doughnut":return t.jsxRuntimeExports.jsx(ni,{className:n});case"stackedBar":return t.jsxRuntimeExports.jsx(si,{className:"size-4 text-foreground/70"});case"polarArea":return t.jsxRuntimeExports.jsx(ri,{className:n});case"kpi":return t.jsxRuntimeExports.jsx(oi,{className:n});default:return t.jsxRuntimeExports.jsx(Wt,{className:n})}}function Lu(){const e=t.useEditorStore(r=>r.card.refreshInterval),n=t.useEditorStore(r=>r.actions.setCardRefreshInterval);return t.jsxRuntimeExports.jsxs(t.Popover,{children:[t.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"outline",children:t.jsxRuntimeExports.jsx(ui,{className:"w-4 h-4"})})}),t.jsxRuntimeExports.jsx(t.PopoverContent,{className:"w-[200px]",children:t.jsxRuntimeExports.jsx("div",{className:"grid gap-4",children:t.jsxRuntimeExports.jsx("div",{className:"grid gap-2",children:t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-5 items-center gap-1",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"col-span-3",htmlFor:"width",children:"Refresh Every"}),t.jsxRuntimeExports.jsx(t.Input,{value:e||"",onChange:r=>n(r.target.value),id:"width",placeholder:"30s",className:"col-span-2 h-7 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0"})]})})})})]})}function rr(){t.useEditorStore(o=>o.frame);const e=t.useEditorStore(o=>o.card),n=t.useEditorStore(o=>o.card.data),r=t.useEditorStore(o=>o.isShowingVisual),i=t.useEditorStore(o=>o.isSqlRunning),s=t.useEditorStore(o=>o.queryError),l=t.useEditorStore(o=>o.pythonStdOut);return t.useEditorStore(o=>o.onSave),t.useEditorStore(o=>o.onClose),t.useEditorStore(o=>o.actions.setCardSql),t.useEditorStore(o=>o.actions.setCardType),t.useEditorStore(o=>o.actions.setSqlGen),e?t.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full flex-col pt-3",children:[i&&t.jsxRuntimeExports.jsx(t.LoaderCircle,{className:"absolute bottom-0 left-0 right-0 top-0 z-10 m-auto h-10 w-10 animate-spin text-foreground/10"}),t.jsxRuntimeExports.jsxs("div",{className:"mb-0 flex min-h-10 items-center justify-end gap-2 px-6",children:[r&&t.jsxRuntimeExports.jsxs("div",{className:"flex grow items-center gap-2",children:[t.jsxRuntimeExports.jsx(Au,{}),t.jsxRuntimeExports.jsx(Iu,{}),t.jsxRuntimeExports.jsx(Lu,{})]}),t.jsxRuntimeExports.jsx(Ou,{})]}),r?e.type==="kpi"?t.jsxRuntimeExports.jsx("div",{className:"flex grow items-center justify-center",children:t.jsxRuntimeExports.jsx("div",{className:"w-1/2 rounded-md border",children:t.jsxRuntimeExports.jsx(t.KPICard,{isLoading:i,card:e})})}):t.jsxRuntimeExports.jsx(ei,{className:"grow border-none shadow-none"}):t.jsxRuntimeExports.jsxs("div",{className:"flex min-h-0 w-full flex-1 grow basis-0 px-6",children:[l&&t.jsxRuntimeExports.jsx(zu,{}),e.data&&e.data.length>0&&t.jsxRuntimeExports.jsx(Nu,{data:n||[]}),s&&t.jsxRuntimeExports.jsx("span",{className:"font-mono text-sm",children:s})]})]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:"No Active Card"})}function zu(){const e=t.useEditorStore(r=>r.pythonStdOut);if(!e)return null;const n=e.replace(/\n/g,"<br>");return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("p",{className:"font-mono text-sm",children:"Output:"}),t.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:n},className:"bg-muted p-2 font-mono text-sm"}),t.jsxRuntimeExports.jsx(t.Separator,{className:"mb-2"})]})}function Ou(){const e=t.useEditorStore(r=>r.isShowingVisual),n=t.useEditorStore(r=>r.actions.setIsShowingVisual);return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.Label,{htmlFor:"visualize",children:"Chart"}),t.jsxRuntimeExports.jsx(t.Switch,{checked:e,onCheckedChange:()=>n(!e),id:"visualize",className:"data-[state=checked]:bg-foreground/50"})]})}function Ge(){const[e,n]=T.useState([]);t.useEditorStore(x=>x.card.cfg);const r=t.useEditorStore(x=>x.card.preferences),{setCardCfg:i,setFilterOnClickColumnIndex:s,setCardPreferences:l}=t.useEditorStore(x=>x.actions),o=t.useEditorStore(x=>x.queryResultColumns);t.useEditorStore(x=>{var p;return(p=x.card.preferences)==null?void 0:p.filterOnClickColumnIndex}),T.useEffect(()=>{o&&n(new Array(o.length).fill(!1))},[o]);function a(x,p){var m,d;p?r!=null&&r.onClickFilter&&((m=r==null?void 0:r.onClickFilter)==null?void 0:m.length)>0?l({...r,onClickFilter:[...r.onClickFilter,{columnIndex:x,expression:""}]}):l({...r,onClickFilter:[{columnIndex:x,expression:""}]}):(l({...r,onClickFilter:(d=r==null?void 0:r.onClickFilter)==null?void 0:d.filter(g=>g.columnIndex!==x)}),n(g=>{const E=[...g];return E[x]=!1,E}))}function u(x,p){var d;const m=(d=r==null?void 0:r.onClickFilter)==null?void 0:d.map(g=>g.columnIndex===x?{...g,expression:p.target.value}:g);l({...r,onClickFilter:m})}function c(x){var p,m,d,g;if(e!=null&&e[x]||(m=(p=r==null?void 0:r.onClickFilter)==null?void 0:p.find(E=>E.columnIndex===x))!=null&&m.expression)return t.jsxRuntimeExports.jsx(t.Input,{value:(g=(d=r==null?void 0:r.onClickFilter)==null?void 0:d.find(E=>E.columnIndex===x))==null?void 0:g.expression,onChange:E=>u(x,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 t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:o==null?void 0:o.map((x,p)=>{var m,d;return t.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between space-y-2 xbg-red-100 group",children:t.jsxRuntimeExports.jsxs("div",{className:" grow",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center py-2 space-x-2",children:[t.jsxRuntimeExports.jsx(t.Checkbox,{checked:!!((m=r==null?void 0:r.onClickFilter)!=null&&m.find(g=>g.columnIndex===p)),onCheckedChange:g=>a(p,g)}),t.jsxRuntimeExports.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:x}),t.jsxRuntimeExports.jsx("div",{className:"flex gap-2 items-center ",children:((d=r==null?void 0:r.onClickFilter)==null?void 0:d.find(g=>g.columnIndex===p))&&t.jsxRuntimeExports.jsx(or,{onClick:()=>{n(g=>{const E=[...g];return E[p]=!g[p],E})},className:" invisible group-hover:visible size-3 text-gray-400 cursor-pointer"})})]}),c(p)]})},x)})})}function un(){var l,o;const e=t.useEditorStore(a=>a.card.preferences),n=t.useEditorStore(a=>a.card.cfg),{setCardCfg:r,setCardPreferences:i}=t.useEditorStore(a=>a.actions);(l=n==null?void 0:n.options)!=null&&l.indexAxis;function s(a){var x,p,m,d,g,E;let u={};(x=e==null?void 0:e.chartOptions)!=null&&x.scales&&(u={x:(m=(p=e==null?void 0:e.chartOptions)==null?void 0:p.scales)==null?void 0:m.y,y:(g=(d=e==null?void 0:e.chartOptions)==null?void 0:d.scales)==null?void 0:g.x});const c={...e,chartOptions:{...e==null?void 0:e.chartOptions,scales:{...(E=e==null?void 0:e.chartOptions)==null?void 0:E.scales,...u},indexAxis:a}};i(c)}return t.jsxRuntimeExports.jsxs(t.RadioGroup,{value:((o=e==null?void 0:e.chartOptions)==null?void 0:o.indexAxis)||"x",onValueChange:s,className:"flex gap-3",defaultValue:"x",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.RadioGroupItem,{value:"x",id:"r1"}),t.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Vertical"})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.RadioGroupItem,{value:"y",id:"r2"}),t.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Horizontal"})]})]})}const Fe="focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0";function ir(e){var r,i,s;const n=t.getNumberAxis(e);return((s=(i=(r=e==null?void 0:e.chartOptions)==null?void 0:r.scales)==null?void 0:i[n])==null?void 0:s.type)||"linear"}function Du(){var A,v,$,K,B,G;const[e,n]=T.useState(!1),r=t.useEditorStore(L=>{var M;return(M=L.card)==null?void 0:M.preferences}),i=t.getNumberAxis(r),[s,l]=T.useState(ir(r)),[o,a]=T.useState((($=(v=(A=r==null?void 0:r.chartOptions)==null?void 0:A.scales)==null?void 0:v[i])==null?void 0:$.min)||""),[u,c]=T.useState(((G=(B=(K=r==null?void 0:r.chartOptions)==null?void 0:K.scales)==null?void 0:B[i])==null?void 0:G.max)||""),[x,p]=T.useState(o||u?"custom":"auto"),[m,d]=T.useState(""),[g,E]=T.useState(""),[k,y]=T.useState(""),[w,R]=T.useState(""),[I,O]=T.useState(""),b=t.useEditorStore(L=>L.actions.setCardPreferences);T.useEffect(()=>{var L,M,N,h,J,X,f,ne,ue,ee,xe,oe,ie,le;l(ir(r)),a(((N=(M=(L=r==null?void 0:r.chartOptions)==null?void 0:L.scales)==null?void 0:M[i])==null?void 0:N.min)===0?0:""),c(((X=(J=(h=r==null?void 0:r.chartOptions)==null?void 0:h.scales)==null?void 0:J[i])==null?void 0:X.max)||""),d(((ee=(ue=(ne=(f=r==null?void 0:r.chartOptions)==null?void 0:f.scales)==null?void 0:ne[i])==null?void 0:ue.ticks)==null?void 0:ee.stepSize)||""),E(((xe=r==null?void 0:r.numberAxisFormat)==null?void 0:xe.format)||""),y(((oe=r==null?void 0:r.numberAxisFormat)==null?void 0:oe.suffix)||""),R(((ie=r==null?void 0:r.numberAxisFormat)==null?void 0:ie.currency)||""),O(((le=r==null?void 0:r.numberAxisFormat)==null?void 0:le.locale)||"")},[e,r,i]);function D(L,M){return M===""||/^[0-9\b]+$/.test(M)?Number(M):Number(L)}function W(){return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-9 items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"col-span-3",htmlFor:"format",children:"Format"}),t.jsxRuntimeExports.jsx(t.Input,{value:g,placeholder:"000,0.00",onChange:L=>E(L.target.value),id:"format",className:`col-span-4 h-8 w-full tracking-wide ${Fe}`}),t.jsxRuntimeExports.jsx(t.Input,{value:k,placeholder:"M",onChange:L=>y(L.target.value),id:"unit",className:`col-span-2 h-8 w-full ${Fe}`})]}),t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-6 items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"col-span-2 hover:cursor-pointer hover:underline",htmlFor:"currency",children:t.jsxRuntimeExports.jsx("a",{target:"_blank",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat",children:"Currency"})}),t.jsxRuntimeExports.jsx(t.Input,{value:w,placeholder:"USD",onChange:L=>R(L.target.value),id:"currency",className:`col-span-2 h-8 w-full ${Fe}`}),t.jsxRuntimeExports.jsx(t.Input,{value:I,placeholder:"en-US",onChange:L=>O(L.target.value),id:"locale",className:`col-span-2 h-8 w-full ${Fe}`})]})]})}function H(){return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Label,{htmlFor:"range",children:"Range"}),t.jsxRuntimeExports.jsx(t.Input,{id:"min",value:o,onChange:L=>a(M=>D(M,L.target.value)),className:`col-span-1 h-8 w-full ${Fe}`}),t.jsxRuntimeExports.jsx(t.Input,{value:u,onChange:L=>c(M=>D(M,L.target.value)),id:"max",className:`col-span-1 h-8 w-full ${Fe}`})]}),t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Label,{htmlFor:"step-size",children:"Step Size"}),t.jsxRuntimeExports.jsx(t.Input,{value:m,onChange:L=>d(M=>D(M,L.target.value)),id:"step-size",className:`col-span-1 h-8 w-full ${Fe}`})]})]})}function V(){var N;let L={};x==="custom"&&(L={min:o,max:u,ticks:{stepSize:m}});const M={...r||{},chartOptions:{...r==null?void 0:r.chartOptions,scales:{...(N=r==null?void 0:r.chartOptions)==null?void 0:N.scales,[i]:{type:s,...s==="linear"?L:{}}}},numberAxisFormat:{format:g,suffix:k,currency:w,locale:I}};b(M)}return t.jsxRuntimeExports.jsxs(t.Popover,{onOpenChange:L=>n(L),children:[t.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(t.SliderIcon,{className:"size-4 cursor-pointer text-muted-foreground hover:text-foreground"})}),t.jsxRuntimeExports.jsx(t.PopoverContent,{align:"center",className:"max-w-65",children:t.jsxRuntimeExports.jsxs("div",{className:"grid gap-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.jsxRuntimeExports.jsx("h4",{className:"font-medium leading-none",children:"Scale Options"}),t.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the scale for the number axis"})]}),t.jsxRuntimeExports.jsxs("div",{className:"grid gap-2",children:[t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Label,{htmlFor:"scale",children:"Type"}),t.jsxRuntimeExports.jsxs(t.Select,{value:s,onValueChange:L=>l(L),children:[t.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0",children:t.jsxRuntimeExports.jsx(t.SelectValue,{})}),t.jsxRuntimeExports.jsx(t.SelectContent,{id:"type",children:t.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[t.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Option"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"linear",children:"Linear"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"logarithmic",children:"Logarithmic"})]})})]})]}),s=="linear"&&t.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-3 items-center gap-2 py-1",children:[t.jsxRuntimeExports.jsx(t.Label,{htmlFor:"scale-option",children:"Setup"}),t.jsxRuntimeExports.jsxs(t.RadioGroup,{id:"scale-option",value:x,onValueChange:L=>p(L),className:"col-span-2 flex gap-3",defaultValue:"x",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.RadioGroupItem,{value:"auto",id:"r1"}),t.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Auto"})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxRuntimeExports.jsx(t.RadioGroupItem,{value:"custom",id:"r2"}),t.jsxRuntimeExports.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Custom"})]})]})]}),x==="custom"&&s=="linear"&&H(),W(),t.jsxRuntimeExports.jsx(t.SelectSeparator,{}),t.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3",children:t.jsxRuntimeExports.jsx(t.Button,{onClick:V,variant:"secondary",className:"col-span-1 col-start-3 h-8 w-full",children:"Apply"})})]})]})})]})}function Fu({idx:e}){var a;const n=t.useEditorStore(u=>{var c;return(c=u.card)==null?void 0:c.preferences}),r=t.useEditorStore(u=>{var c;return(c=u.card.preferences)==null?void 0:c.datasetOptions}),i=t.useEditorStore(u=>u.actions.setCardPreferences),s=(a=n==null?void 0:n.chartOptions)==null?void 0:a.indexAxis,l=r==null?void 0:r.find(u=>u.idx===e);function o(u,c){(u==="end"||u==="start")&&t.getContrastColor(t.getCanvasBackgroundColor());const x={display:u!=="none",align:u,anchor:u,clamp:!0};if(!l)i({...n,datasetOptions:[...r||[],{idx:c,datalabels:x}]});else{const p={...l};p.datalabels=x;const m=r==null?void 0:r.map(d=>d.idx===c?p:d);i({...n,datasetOptions:m})}}return t.jsxRuntimeExports.jsxs(t.Popover,{children:[t.jsxRuntimeExports.jsx(t.PopoverTrigger,{children:t.jsxRuntimeExports.jsx(Ii,{className:"invisible size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),t.jsxRuntimeExports.jsx(t.PopoverContent,{className:"w-fit p-1",children:t.jsxRuntimeExports.jsxs("div",{className:"flex gap-1",children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("none",e),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:t.jsxRuntimeExports.jsx(t.X,{className:"size-4"})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("start",e),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:t.jsxRuntimeExports.jsx(yi,{className:t.cn("h-4 w-4",{"rotate-90":s==="y"})})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("center",e),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:t.jsxRuntimeExports.jsx(bi,{className:t.cn("h-4 w-4",{"rotate-90":s==="y"})})}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>o("end",e),size:"sm",variant:"secondary",className:"h-7 p-1 text-xs font-normal",children:t.jsxRuntimeExports.jsx(Ei,{className:t.cn("h-4 w-4",{"rotate-90":s==="y"})})})]})})]})}function li(){const e=t.useEditorStore(u=>u.card),n=t.useEditorStore(u=>{var c,x,p;return(p=(x=(c=u==null?void 0:u.card)==null?void 0:c.preferences)==null?void 0:x.chartOptions)==null?void 0:p.indexAxis}),r=n==="y"?"Y axis":"X axis",i=n==="y"?"X axis":"Y axis",{keys:s,metricKeys:l,dimensionKeys:o}=t.getKeys(e.data||[]);let a=l;if(e.type==="stackedBar"){const u=t.pivotData({dataArray:e.data||[],groupKey:o[0],pivotKey:o[1],valueKey:a[0]}),{metricKeys:c}=t.getKeys(u);a=c}return s.length===0?null:t.jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.jsxRuntimeExports.jsx(t.Label,{children:r}),t.jsxRuntimeExports.jsx("div",{className:"my-1 space-y-1",children:t.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-muted/70 px-2 py-1 hover:bg-muted",children:t.jsxRuntimeExports.jsx("p",{children:o[0]})})})]}),t.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-5",children:[t.jsxRuntimeExports.jsx(t.Label,{children:i}),t.jsxRuntimeExports.jsx(Du,{})]}),t.jsxRuntimeExports.jsx("div",{className:"my-1 space-y-1",children:a.map((u,c)=>t.jsxRuntimeExports.jsx(Mu,{col:u,idx:c},u))})]})]})}function Mu({col:e,idx:n}){const r=t.useEditorStore(a=>{var u;return(u=a.card)==null?void 0:u.preferences}),i=t.useEditorStore(a=>{var u;return(u=a.card.preferences)==null?void 0:u.datasetOptions}),s=i==null?void 0:i.find(a=>a.idx===n),{setCardPreferences:l}=t.useEditorStore(a=>a.actions);function o(a){if(!s)l({...r,datasetOptions:[...i||[],{idx:n,type:a==="area"?"line":a,fill:a==="area"?"origin":""}]});else{const u={...s};u.type=a==="area"?"line":a,u.fill=a==="area"?"origin":"";const c=i==null?void 0:i.map(x=>x.idx===n?u:x);l({...r,datasetOptions:c})}}return t.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:[t.jsxRuntimeExports.jsx("p",{children:e}),t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[t.jsxRuntimeExports.jsx($t,{onClick:()=>o("bar"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),t.jsxRuntimeExports.jsx(Kt,{onClick:()=>o("line"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),t.jsxRuntimeExports.jsx(ci,{onClick:()=>o("area"),className:"invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"}),t.jsxRuntimeExports.jsx(t.Separator,{orientation:"vertical",className:"invisible size-4 cursor-pointer py-2 text-muted-foreground hover:text-foreground group-hover:visible"}),t.jsxRuntimeExports.jsx(Fu,{idx:n})]})]})}function Pu({cardType:e}){return t.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:t.jsxRuntimeExports.jsxs(t.Accordion,{defaultValue:["item-2"],type:"multiple",children:[t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:`${t.titleCase(e)} Chart`}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:"space-y-4 font-mono text-xs",children:[t.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"}),t.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[t.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),t.jsxRuntimeExports.jsx("li",{children:"y-axis1 - number"}),t.jsxRuntimeExports.jsx("li",{children:"y-axis2 - number"})]}),t.jsxRuntimeExports.jsxs("div",{children:["See ",t.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:n=>n.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#line-chart",children:"example"})," in the docs."]})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-2",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Settings"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:"space-y-4 px-2",children:[t.jsxRuntimeExports.jsx(un,{}),t.jsxRuntimeExports.jsx(li,{})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Filter on click"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(Ge,{})})]})]})})}function cn(){var i,s,l;const e=t.useEditorStore(o=>o.card.cfg),n=t.useEditorStore(o=>o.actions.setCardCfg);function r(o){var c;const a={datalabels:{display:o!=="none",align:o,anchor:o,clamp:!0}},u={...e,options:{...e==null?void 0:e.options,plugins:{...(c=e==null?void 0:e.options)==null?void 0:c.plugins,...a}}};n(u),console.log(o)}return t.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.jsxRuntimeExports.jsx("label",{className:"font-medium",children:"Data Labels"}),t.jsxRuntimeExports.jsxs(t.Select,{value:(l=(s=(i=e==null?void 0:e.options)==null?void 0:i.plugins)==null?void 0:s.datalabels)==null?void 0:l.anchor,onValueChange:r,defaultValue:"none",children:[t.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-8 w-[180px] focus:ring-1 focus:ring-offset-0",children:t.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select position"})}),t.jsxRuntimeExports.jsx(t.SelectContent,{children:t.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[t.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Data Labels"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"none",children:"None"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"start",children:"Start"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"center",children:"Center"}),t.jsxRuntimeExports.jsx(t.SelectItem,{value:"end",children:"End"})]})})]})]})}function Bu({cardType:e}){function n(r){const i="SELECT label, [group], x-axis, y-axis, radius FROM table",s="SELECT label, [group], x-axis, y-axis FROM table";return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded text-xs",children:r==="bubble"?i:s}),t.jsxRuntimeExports.jsxs("ul",{className:" ml-6 list-disc [&>li]:mt-2 text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"label - category"}),t.jsxRuntimeExports.jsx("li",{children:"group - category"}),t.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),t.jsxRuntimeExports.jsx("li",{children:"y-axis - category"}),r==="bubble"&&t.jsxRuntimeExports.jsx("li",{children:"radius - number"})]}),t.jsxRuntimeExports.jsxs("div",{children:["See ",t.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:l=>l.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#pie-chart",children:"example"})," in the docs."]})]})}return t.jsxRuntimeExports.jsx("div",{className:"px-6 py-2 space-y-6",children:t.jsxRuntimeExports.jsxs(t.Accordion,{defaultValue:["item-2"],type:"multiple",children:[t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:`${t.titleCase(e)} Chart`}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:" space-y-4 font-mono text-xs ",children:n(e)})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-2",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Settings"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(cn,{})})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Filter on click"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(Ge,{})})]})]})})}const _u={datasets:[{type:"line",label:"Sum_sales",data:[]},{type:"bar",label:"Sum_profit",data:[]}]},qu={datasets:[{fill:"origin",type:"line",label:"Sum_sales",data:[]}]};function Vu(){const e=t.useEditorStore(n=>n.card.type);return t.jsxRuntimeExports.jsxs("div",{className:"p-6 space-y-6",children:[t.jsxRuntimeExports.jsx(t.Accordion,{className:" ",type:"single",collapsible:!0,children:Hu(e)}),t.jsxRuntimeExports.jsx("section",{className:"",children:["line","bar"].includes(e)&&t.jsxRuntimeExports.jsx(un,{})}),t.jsxRuntimeExports.jsx("div",{children:!["kpi"].includes(e)&&t.jsxRuntimeExports.jsx(cn,{})}),t.jsxRuntimeExports.jsx("div",{children:!["kpi"].includes(e)&&t.jsxRuntimeExports.jsx(Ge,{})})]})}function Hu(e){if(["line","bar"].includes(e))return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:t.jsxRuntimeExports.jsx("p",{children:"Chart Query"})}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" ",children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"X-axis - Category (ex. city)"}),t.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. population)"})]})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-2",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:"Mixed Chart"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" text-xs space-y-2",children:[t.jsxRuntimeExports.jsxs("p",{children:["Click ",t.jsxRuntimeExports.jsx("b",{children:"Customize"})," and change the `type` property in the dataset."]}),t.jsxRuntimeExports.jsx("pre",{children:JSON.stringify(_u,null,2)})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:"Area Chart"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" text-xs space-y-2",children:[t.jsxRuntimeExports.jsxs("p",{children:["Click ",t.jsxRuntimeExports.jsx("b",{children:"Customize"})," and add `fill` property to the dataset. See",t.jsxRuntimeExports.jsx("a",{className:"text-blue-500 hover:underline mx-1",href:"https://www.chartjs.org/docs/latest/samples/area/line-boundaries.html",target:"_blank",children:"docs"}),"for more options."]}),t.jsxRuntimeExports.jsx("pre",{children:JSON.stringify(qu,null,2)})]})]})]});if(e==="bubble")return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:t.jsxRuntimeExports.jsxs("p",{children:["How to create a ",t.jsxRuntimeExports.jsx("span",{children:e})," chart query?"]})}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" ",children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, x-axis, y-axis, radius FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),t.jsxRuntimeExports.jsx("li",{children:"Bubble Group (opt) - Category (ex. state)"}),t.jsxRuntimeExports.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),t.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"}),t.jsxRuntimeExports.jsx("li",{children:"Radius - Number (ex. population)"})]})]})]})});if(e==="scatter")return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:t.jsxRuntimeExports.jsxs("p",{children:["How to create a ",t.jsxRuntimeExports.jsx("span",{children:e})," chart query?"]})}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" ",children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, x-axis, y-axis FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),t.jsxRuntimeExports.jsx("li",{children:"Group (opt) - Category (ex. state)"}),t.jsxRuntimeExports.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),t.jsxRuntimeExports.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"})]})]})]})});if(["pie","doughnut","polarArea"].includes(e))return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:" font-normal",children:t.jsxRuntimeExports.jsxs("p",{children:[t.jsxRuntimeExports.jsx("span",{children:e==="polarArea"?"Polar":e.charAt(0).toUpperCase()+e.slice(1)})," ","chart query"]})}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" ",children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, measure FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"Label - Category (ex. city)"}),t.jsxRuntimeExports.jsx("li",{children:"Measure - Number (ex. population)"})]})]})]})})}function Uu(){var o,a,u;const e=t.useEditorStore(c=>c.card.preferences),n=t.useEditorStore(c=>c.actions.setCardPreferences),r=t.useEditorStore(c=>c.actions.setNumberFormat),i=t.useEditorStore(c=>{var x,p;return(p=(x=c.card.preferences)==null?void 0:x.formatNumber)==null?void 0:p.format}),s=t.useEditorStore(c=>{var x,p;return(p=(x=c.card.preferences)==null?void 0:x.formatNumber)==null?void 0:p.locale}),l=t.useEditorStore(c=>{var x,p;return(p=(x=c.card.preferences)==null?void 0:x.formatNumber)==null?void 0:p.currency});return t.useEditorStore(c=>c.actions.setFilterOnClickField),t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[t.jsxRuntimeExports.jsx(t.Checkbox,{checked:!!((o=e==null?void 0:e.formatNumber)!=null&&o.enabled),onCheckedChange:c=>{n({...e,formatNumber:{...e==null?void 0:e.formatNumber,enabled:c}})}}),t.jsxRuntimeExports.jsx(t.Label,{children:"Format Number"})]}),((a=e==null?void 0:e.formatNumber)==null?void 0:a.enabled)===!0&&t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(t.Label,{className:"text-xs",children:"Currency"}),t.jsxRuntimeExports.jsxs("div",{className:"flex gap-1",children:[t.jsxRuntimeExports.jsx(t.Input,{value:l||"",className:"h-7 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"USD",onChange:c=>{var x,p,m;return r(((x=e==null?void 0:e.formatNumber)==null?void 0:x.format)||"",c.target.value,((p=e==null?void 0:e.formatNumber)==null?void 0:p.locale)||"",((m=e==null?void 0:e.formatNumber)==null?void 0:m.suffix)||"")}}),t.jsxRuntimeExports.jsx(t.Input,{value:s||"",className:"h-7 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"en-US",onChange:c=>{var x,p,m;return r(((x=e==null?void 0:e.formatNumber)==null?void 0:x.format)||"",((p=e==null?void 0:e.formatNumber)==null?void 0:p.currency)||"",c.target.value,((m=e==null?void 0:e.formatNumber)==null?void 0:m.suffix)||"")}})]})]}),t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsxs("div",{className:"flex gap-1",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"text-xs",children:"Format"}),t.jsxRuntimeExports.jsxs(t.Tooltip,{children:[t.jsxRuntimeExports.jsx(t.TooltipTrigger,{children:t.jsxRuntimeExports.jsx(t.InfoCircledIcon,{strokeWidth:1,className:"h-3 w-3 opacity-70"})}),t.jsxRuntimeExports.jsx(t.TooltipContent,{children:t.jsxRuntimeExports.jsxs("div",{className:"max-w-[200px]",children:["Format number",t.jsxRuntimeExports.jsx("div",{className:"mt-1 font-mono text-xs",children:"#.## for 123.43"})]})})]})]}),t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Input,{value:i||"",className:"h-7 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"###,###.##",onChange:c=>{var x,p,m;return r(c.target.value,((x=e==null?void 0:e.formatNumber)==null?void 0:x.currency)||"",((p=e==null?void 0:e.formatNumber)==null?void 0:p.locale)||"",((m=e==null?void 0:e.formatNumber)==null?void 0:m.suffix)||"")}})})]}),t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(t.Label,{className:"text-xs",children:"Suffix"}),t.jsxRuntimeExports.jsx(t.Input,{value:((u=e==null?void 0:e.formatNumber)==null?void 0:u.suffix)||"",className:"h-7 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"K, M, B",onChange:c=>{var x,p,m;return r(((x=e==null?void 0:e.formatNumber)==null?void 0:x.format)||"",((p=e==null?void 0:e.formatNumber)==null?void 0:p.currency)||"",((m=e==null?void 0:e.formatNumber)==null?void 0:m.locale)||"",c.target.value)}})]})]})]})}function $u(){return t.jsxRuntimeExports.jsxs("div",{className:"space-y-6 px-6 py-2",children:[t.jsxRuntimeExports.jsx(t.Accordion,{type:"single",collapsible:!0,children:t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{className:"",children:"KPI Query"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:"font-mono",children:[t.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs",children:"SELECT current, previous FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs [&>li]:mt-2",children:[t.jsxRuntimeExports.jsx("li",{children:"current - number"}),t.jsxRuntimeExports.jsx("li",{children:"previous - number"})]}),t.jsxRuntimeExports.jsxs("div",{children:["See ",t.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:e=>e.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#kpi",children:"example"})," in the docs."]})]})]})}),t.jsxRuntimeExports.jsx("section",{className:"",children:t.jsxRuntimeExports.jsx(Uu,{})}),t.jsxRuntimeExports.jsx("div",{}),t.jsxRuntimeExports.jsx("div",{})]})}function Ku({cardType:e}){return t.jsxRuntimeExports.jsx("div",{className:"px-6 py-2 space-y-6",children:t.jsxRuntimeExports.jsxs(t.Accordion,{defaultValue:["item-2"],type:"multiple",children:[t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:`${t.titleCase(e)} Chart`}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:" space-y-4 font-mono text-xs ",children:[t.jsxRuntimeExports.jsx("div",{className:"bg-muted px-2 py-1 rounded text-xs",children:"SELECT label, measure FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:" ml-6 list-disc [&>li]:mt-2 text-xs",children:[t.jsxRuntimeExports.jsx("li",{children:"label - category"}),t.jsxRuntimeExports.jsx("li",{children:"measure - number"})]}),t.jsxRuntimeExports.jsxs("div",{children:["See ",t.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."]})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-2",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Settings"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(cn,{})})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Filter on click"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(Ge,{})})]})]})})}function Wu(){return t.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:t.jsxRuntimeExports.jsxs(t.Accordion,{defaultValue:["item-2"],type:"multiple",children:[t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-1",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Stacked Chart"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:"space-y-4 font-mono text-xs",children:[t.jsxRuntimeExports.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT x-axis, stack-by, y-axis FROM table"}),t.jsxRuntimeExports.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[t.jsxRuntimeExports.jsx("li",{children:"x-axis - category"}),t.jsxRuntimeExports.jsx("li",{children:"stack by - category"}),t.jsxRuntimeExports.jsx("li",{children:"y-axis - number"})]}),t.jsxRuntimeExports.jsxs("div",{children:["See ",t.jsxRuntimeExports.jsx("a",{target:"_blank",onClick:e=>e.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/concepts/visuals#stacked-chart",children:"example"})," in the docs."]})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-2",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Settings"}),t.jsxRuntimeExports.jsxs(t.AccordionContent,{className:"space-y-4 px-2",children:[t.jsxRuntimeExports.jsx(un,{}),t.jsxRuntimeExports.jsx(li,{})]})]}),t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Filter on click"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(Ge,{})})]})]})})}function Qu({cardType:e}){return console.log("TableVisualSettings",e),t.jsxRuntimeExports.jsx("div",{className:"space-y-6 px-6 py-2",children:t.jsxRuntimeExports.jsx(t.Accordion,{defaultValue:["item-3"],type:"multiple",children:t.jsxRuntimeExports.jsxs(t.AccordionItem,{value:"item-3",children:[t.jsxRuntimeExports.jsx(t.AccordionTrigger,{children:"Filter on click"}),t.jsxRuntimeExports.jsx(t.AccordionContent,{className:"px-2",children:t.jsxRuntimeExports.jsx(Ge,{})})]})})})}function Gu(){const e=t.useEditorStore(r=>r.card.type);function n(r){switch(r){case"stackedBar":return t.jsxRuntimeExports.jsx(Wu,{});case"kpi":return t.jsxRuntimeExports.jsx($u,{});case"line":case"bar":return t.jsxRuntimeExports.jsx(Pu,{cardType:r});case"pie":case"doughnut":case"polarArea":case"radar":return t.jsxRuntimeExports.jsx(Ku,{cardType:r});case"bubble":case"scatter":return t.jsxRuntimeExports.jsx(Bu,{cardType:r});case"table":return t.jsxRuntimeExports.jsx(Qu,{cardType:r});default:return t.jsxRuntimeExports.jsx(Vu,{})}}return t.jsxRuntimeExports.jsx(t.ScrollArea,{className:"h-full w-full text-sm",children:n(e)})}function Ju(){const e=t.useEditorStore(n=>n.isShowingVisual);return t.jsxRuntimeExports.jsxs(Ot,{direction:"vertical",className:"min-w-full max-w-lg min-h-[250px]",children:[t.jsxRuntimeExports.jsx(Ue,{role:"query-section",className:"flex",minSize:20,defaultSize:40,children:t.jsxRuntimeExports.jsx(vu,{})}),t.jsxRuntimeExports.jsx(Dt,{withHandle:!0,className:"border "}),t.jsxRuntimeExports.jsx(Ue,{className:"pb-1",role:"visual-section",minSize:0,defaultSize:60,children:e?t.jsxRuntimeExports.jsxs(Ot,{direction:"horizontal",children:[t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(Ue,{className:"flex min-w-[275px]",minSize:20,defaultSize:25,maxSize:30,children:t.jsxRuntimeExports.jsx(Gu,{})})}),t.jsxRuntimeExports.jsx(Dt,{className:"border "}),t.jsxRuntimeExports.jsx(Ue,{minSize:40,defaultSize:75,maxSize:100,children:t.jsxRuntimeExports.jsx(rr,{})})]}):t.jsxRuntimeExports.jsx(rr,{})})]})}function Xu({authToken:e,onSave:n,onClose:r}){const i=t.useEditorStore(o=>o.actions.setOnSave),s=t.useEditorStore(o=>o.actions.setOnClose),l=t.useDashboardStore(o=>o.actions.setAuthToken);return T.useEffect(()=>{n&&i(n),r&&s(r)},[n,i,r,s]),T.useEffect(()=>{e&&e.accessToken&&l(e)},[e,l]),t.jsxRuntimeExports.jsxs(t.EditorPanel,{className:"rounded-none",role:"editor-panel",children:[t.jsxRuntimeExports.jsx(t.EditorAside,{className:"rounded-none border-r-[1.5px]",children:t.jsxRuntimeExports.jsx(xr,{})}),t.jsxRuntimeExports.jsx(t.EditorMain,{children:t.jsxRuntimeExports.jsx(Ju,{})})]})}function Yu(){t.useDashboardStore(o=>o.selectedCardId);const e=t.useDashboardStore(o=>o.selectedSheetId),{setIsVisualEditing:n}=t.useDashboardStore(o=>o.actions),r=t.useDashboardStore(o=>o.isVisualEditing),i=t.useDashboardStore(o=>o.actions.updateFrame);function s(o){e&&(i(e,o),n(!1))}function l(){n(!1)}return t.jsxRuntimeExports.jsx("div",{role:"editor-container",className:t.cn("flex grow",{block:r,hidden:!r}),children:t.jsxRuntimeExports.jsx(Xu,{onSave:s,onClose:l})})}function Zu({columns:e,tableName:n}){const r=t.useEditorStore(p=>p.selectedConnectionId),i=t.useEditorStore(p=>p.selectedDatabaseName),s=t.useEditorStore(p=>p.selectedSchemaName),l=t.useEditorStore(p=>p.selectedTableName),o=t.useDashboardStore(p=>p.dashboard.filters)||[],a=t.useDashboardStore(p=>p.actions.addFilter),u=t.useDashboardStore(p=>p.actions.removeFilter),c=t.useDashboardStore(p=>p.actions.removeFilterValue);function x(p){const m=t.fmt(p.column_name),d=t.fmt(i||""),g=t.fmt(s||""),E=t.fmt(n),k=t.getQualifiedTableName(g,E),y=`${k}.${m}`;console.log("find",y,E,d);const w=o==null?void 0:o.find(R=>R.column===y&&R.table===E&&(R.database===d||R.database===i));if(w)c(w.id),u(w.id);else{if(n==="api"&&r){a({id:t.v4(),column:y,title:p.column_name,dataType:p.data_type,table:"api",database:"",connectionId:r,operation:"in",sql:t.getDefaultFilterSql(p.data_type,k,m)});return}a({id:t.v4(),column:`${k}.${m}`,title:p.column_name,dataType:p.data_type,table:l||"",database:i||"",connectionId:r||"",operation:"in",sql:t.getDefaultFilterSql(p.data_type,k,m)})}}return t.jsxRuntimeExports.jsx("div",{className:"xbg-red-100 flex-1 basis-0 flex-col overflow-scroll px-3",children:e==null?void 0:e.map(p=>{const m=o==null?void 0:o.find(d=>d.column===t.fmt(p.column_name)&&d.table===l&&d.database===i);return t.jsxRuntimeExports.jsx("div",{onClick:()=>x(p),className:t.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":m}),children:t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxRuntimeExports.jsx(cr,{column:p}),t.jsxRuntimeExports.jsx("span",{children:p.column_name})]})},p.column_name)})})}function ec(){t.useDashboardStore(n=>n.showFilters);const e=t.useDashboardStore(n=>n.actions.setShowFilters);return t.jsxRuntimeExports.jsxs("section",{className:"relative flex grow flex-col border-l px-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"mt-4 flex items-center justify-between gap-2 px-3",children:[t.jsxRuntimeExports.jsx(t.Label,{className:"text-lg",children:"Filters"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>e(!1),className:"h-7 w-7 p-0",variant:"ghost",children:t.jsxRuntimeExports.jsx(t.Cross2Icon,{})})]}),t.jsxRuntimeExports.jsx("div",{className:"flex grow",children:t.jsxRuntimeExports.jsx(xr,{ColumnsComponent:(n,r,i)=>t.jsxRuntimeExports.jsx(Zu,{schemaName:n,tableName:r,columns:i})})})]})}function tc(){t.useDashboardStore(r=>r.dashboard);const e=t.useDashboardStore(r=>r.showFilters),n=t.useDashboardStore(r=>r.isVisualEditing);return t.useDashboardStore(r=>r.bookmarkKey),t.jsxRuntimeExports.jsxs("div",{role:"dashboard-plus-main",className:t.cn("grow",{hidden:n,flex:!n}),children:[t.jsxRuntimeExports.jsx(t.DashboardTabs,{}),e&&t.jsxRuntimeExports.jsx("div",{role:"filter-aside-container",className:"flex",children:t.jsxRuntimeExports.jsx(ec,{})})]})}function nc(){const e=t.useDashboardStore(i=>i.dashboard),n=t.useDashboardStore(i=>i.actions.setDashboard),r=t.useDashboardStore(i=>i.showDashboardJSON);return t.useDashboardStore(i=>i.actions.setShowDashboardJSON),t.jsxRuntimeExports.jsx("div",{className:t.cn(" p-2",{hidden:!r}),children:t.jsxRuntimeExports.jsx(t.de,{onChange:i=>{if(i)try{JSON.parse(i),n(JSON.parse(i))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto ",value:JSON.stringify(e,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})})}function rc({showControls:e=!1,showFooter:n=!0,...r}){return t.jsxRuntimeExports.jsx(t.SemaphorContextProvider,{dashboardProps:r,children:t.jsxRuntimeExports.jsxs(t.UXProvider,{children:[t.jsxRuntimeExports.jsx(nc,{}),t.jsxRuntimeExports.jsxs(t.DashboardPanel,{...r,children:[e&&t.jsxRuntimeExports.jsx(Fi,{}),t.jsxRuntimeExports.jsx(Yu,{}),t.jsxRuntimeExports.jsx(tc,{})]})]})})}exports.DashboardPlus=rc;exports.SelectComponent=Xe;exports.useEditorAside=pr;
|