@tenorlab/react-dashboard 1.6.3 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3089 +0,0 @@
1
- import { create as vt } from "zustand";
2
- import { blankDashboardConfig as we, dashboardStoreUtils as ge, getDistinctCssClasses as Z, ensureZoomScaleIsWithinRange as xt, parseContainerTitle as it, getWidgetMetaFromCatalog as Ct, dashboardSettingsUtils as wt } from "./core.es.js";
3
- import xe, { useState as oe, useCallback as ce, useMemo as fe, useRef as at, useEffect as Oe, forwardRef as se, Suspense as St } from "react";
4
- import { jsxs as _, jsx as t } from "react/jsx-runtime";
5
- import st from "react-dom";
6
- const Dt = (e) => (s, n, r) => {
7
- const d = r.subscribe;
8
- return r.subscribe = ((c, f, w) => {
9
- let b = c;
10
- if (f) {
11
- const v = w?.equalityFn || Object.is;
12
- let l = c(r.getState());
13
- b = (y) => {
14
- const p = c(y);
15
- if (!v(l, p)) {
16
- const T = l;
17
- f(l = p, T);
18
- }
19
- }, w?.fireImmediately && f(l, l);
20
- }
21
- return d(b);
22
- }), e(s, n, r);
23
- }, Tt = Dt, Nt = (e, s) => ({
24
- isLoading: !1,
25
- isEditing: !1,
26
- allDashboardConfigs: [we],
27
- currentDashboardConfig: we,
28
- targetContainerKey: void 0,
29
- getNextContainerKey: (n) => ge.getNextContainerKey(s().currentDashboardConfig, n),
30
- setIsLoading: (n) => (e(() => ({ isLoading: n })), n),
31
- setIsEditing: (n) => {
32
- let r = s().targetContainerKey;
33
- return n || (r = void 0), e(() => ({ isEditing: n, targetContainerKey: r })), n;
34
- },
35
- setTargetContainerKey: (n) => (e(() => ({ targetContainerKey: n })), n),
36
- setAllDashboardConfigs: (n) => (e(() => ({ allDashboardConfigs: n })), s().allDashboardConfigs),
37
- setCurrentDashboardConfig: (n) => {
38
- const r = s(), d = [
39
- ...r.allDashboardConfigs.filter((o) => o.dashboardId !== n.dashboardId),
40
- n
41
- ];
42
- return e(() => ({
43
- ...r,
44
- allDashboardConfigs: d,
45
- currentDashboardConfig: n
46
- })), d;
47
- },
48
- addDashboardConfig: (n) => {
49
- const r = s(), d = [
50
- ...r.allDashboardConfigs.filter((o) => o.dashboardId !== n.dashboardId),
51
- n
52
- ];
53
- return e(() => ({
54
- ...r,
55
- allDashboardConfigs: d,
56
- currentDashboardConfig: n
57
- })), d;
58
- },
59
- deleteDashboardConfigById: (n) => {
60
- const r = s(), d = [...r.allDashboardConfigs.filter((o) => o.dashboardId !== n)];
61
- return e(() => ({
62
- ...r,
63
- allDashboardConfigs: d,
64
- currentDashboardConfig: d[0] || we
65
- })), d;
66
- },
67
- selectDashboardById: (n) => (e(() => {
68
- const r = s(), d = r.allDashboardConfigs.find((o) => o.dashboardId === n);
69
- return d ? {
70
- currentDashboardConfig: d
71
- } : {
72
- ...r
73
- };
74
- }), s().currentDashboardConfig),
75
- addWidget: (n) => {
76
- const r = s(), d = ge.addWidget({
77
- dashboardConfig: r.currentDashboardConfig,
78
- ...n
79
- }), o = [
80
- ...r.allDashboardConfigs.filter(
81
- (c) => c.dashboardId !== d.updatedDashboardConfig.dashboardId
82
- ),
83
- d.updatedDashboardConfig
84
- ];
85
- return d.success && e(() => ({
86
- allDashboardConfigs: o,
87
- currentDashboardConfig: d.updatedDashboardConfig
88
- })), {
89
- ...d,
90
- allUpdatedDashboardConfigs: o
91
- };
92
- },
93
- removeWidget: (n, r) => {
94
- const d = s(), o = ge.removeWidget(
95
- d.currentDashboardConfig,
96
- n,
97
- r
98
- ), c = [
99
- ...d.allDashboardConfigs.filter(
100
- (f) => f.dashboardId !== o.updatedDashboardConfig.dashboardId
101
- ),
102
- o.updatedDashboardConfig
103
- ];
104
- return o.success && e(() => ({
105
- allDashboardConfigs: c,
106
- currentDashboardConfig: o.updatedDashboardConfig
107
- })), {
108
- ...o,
109
- allUpdatedDashboardConfigs: c
110
- };
111
- },
112
- moveWidget: (n, r, d) => {
113
- const o = s(), c = ge.moveWidget(
114
- o.currentDashboardConfig,
115
- n,
116
- r,
117
- d
118
- ), f = [
119
- ...o.allDashboardConfigs.filter(
120
- (w) => w.dashboardId !== c.updatedDashboardConfig.dashboardId
121
- ),
122
- c.updatedDashboardConfig
123
- ];
124
- return c.success && e(() => ({
125
- allDashboardConfigs: f,
126
- currentDashboardConfig: c.updatedDashboardConfig
127
- })), {
128
- ...c,
129
- allUpdatedDashboardConfigs: f
130
- };
131
- }
132
- }), gn = vt()(
133
- Tt((...e) => ({
134
- ...Nt(...e)
135
- }))
136
- ), mn = () => {
137
- const [e, s] = oe({}), [n, r] = oe({}), d = ce((v) => {
138
- const l = v.dashboardId;
139
- s((y) => {
140
- const p = {
141
- undoIndex: 0,
142
- config: v
143
- };
144
- return r((T) => ({
145
- ...T,
146
- [l]: 0
147
- })), {
148
- ...y,
149
- [l]: [p]
150
- // Forces a reset to just this one entry
151
- };
152
- });
153
- }, []), o = ce(
154
- (v) => {
155
- s((l) => {
156
- const y = v.dashboardId, p = l[y] || [], T = n[y] ?? -1, h = p.slice(0, T + 1), g = {
157
- undoIndex: h.length,
158
- // New index based on trimmed length
159
- config: v
160
- }, x = [...h, g];
161
- return r((N) => ({
162
- ...N,
163
- [y]: x.length - 1
164
- // Index is now the last element's index
165
- })), {
166
- ...l,
167
- [y]: x
168
- };
169
- });
170
- },
171
- [n]
172
- ), c = ce((v) => {
173
- s((l) => {
174
- if (!l[v])
175
- return l;
176
- const { [v]: y, ...p } = l;
177
- return p;
178
- }), r((l) => {
179
- const { [v]: y, ...p } = l;
180
- return p;
181
- });
182
- }, []), f = ce(
183
- (v) => {
184
- r((l) => {
185
- const y = l[v] ?? -1, p = Math.max(0, y - 1);
186
- return p !== y ? { ...l, [v]: p } : l;
187
- });
188
- },
189
- [
190
- //loadConfigFromHistory
191
- ]
192
- ), w = ce(
193
- (v) => {
194
- r((l) => {
195
- const y = e[v]?.length || 0, p = l[v] ?? -1, T = Math.min(y - 1, p + 1);
196
- return T !== p ? { ...l, [v]: T } : l;
197
- });
198
- },
199
- [
200
- e
201
- //loadConfigFromHistory,
202
- ]
203
- );
204
- return {
205
- initializeHistoryForDashboard: d,
206
- resetAllHistory: () => s({}),
207
- addUndoEntry: o,
208
- removeUndoHistoryForDashboard: c,
209
- undo: f,
210
- redo: w,
211
- getUndoStatus: (v) => {
212
- const l = n[v] ?? -1, y = e[v]?.length || 0, p = l <= 0, T = l >= y - 1;
213
- return { isUndoDisabled: p, isRedoDisabled: T };
214
- },
215
- undoHistory: e,
216
- historyIndex: n
217
- // (Optional: You might expose undoHistory and historyIndex if needed for debugging)
218
- };
219
- };
220
- function z({
221
- children: e,
222
- className: s
223
- }) {
224
- return /* @__PURE__ */ t(
225
- "svg",
226
- {
227
- xmlns: "http://www.w3.org/2000/svg",
228
- width: "24",
229
- height: "24",
230
- viewBox: "0 0 24 24",
231
- fill: "none",
232
- stroke: "currentColor",
233
- strokeWidth: "2",
234
- strokeLinecap: "round",
235
- strokeLinejoin: "round",
236
- className: s,
237
- children: e
238
- }
239
- );
240
- }
241
- function lt({ className: e }) {
242
- return /* @__PURE__ */ _(z, { className: `lucide lucide-circle-plus-icon lucide-circle-plus ${e}`, children: [
243
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
244
- /* @__PURE__ */ t("path", { d: "M8 12h8" }),
245
- /* @__PURE__ */ t("path", { d: "M12 8v8" })
246
- ] });
247
- }
248
- const pn = lt;
249
- function Et({ className: e }) {
250
- return /* @__PURE__ */ _(z, { className: `lucide lucide-circle-minus-icon lucide-circle-minus ${e}`, children: [
251
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
252
- /* @__PURE__ */ t("path", { d: "M8 12h8" })
253
- ] });
254
- }
255
- function yn({ className: e }) {
256
- return /* @__PURE__ */ _(z, { className: `lucide lucide-trash2-icon lucide-trash-2 ${e}`, children: [
257
- /* @__PURE__ */ t("path", { d: "M10 11v6" }),
258
- /* @__PURE__ */ t("path", { d: "M14 11v6" }),
259
- /* @__PURE__ */ t("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }),
260
- /* @__PURE__ */ t("path", { d: "M3 6h18" }),
261
- /* @__PURE__ */ t("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
262
- ] });
263
- }
264
- function bn({ className: e }) {
265
- return /* @__PURE__ */ _(z, { className: `lucide lucide-square-pen-icon lucide-square-pen ${e}`, children: [
266
- /* @__PURE__ */ t("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
267
- /* @__PURE__ */ t("path", { d: "M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z" })
268
- ] });
269
- }
270
- function vn({ className: e }) {
271
- return /* @__PURE__ */ _(
272
- z,
273
- {
274
- className: `lucide lucide-text-cursor-input-icon lucide-text-cursor-input ${e}`,
275
- children: [
276
- /* @__PURE__ */ t("path", { d: "M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6" }),
277
- /* @__PURE__ */ t("path", { d: "M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7" }),
278
- /* @__PURE__ */ t("path", { d: "M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1" }),
279
- /* @__PURE__ */ t("path", { d: "M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1" }),
280
- /* @__PURE__ */ t("path", { d: "M9 6v12" })
281
- ]
282
- }
283
- );
284
- }
285
- function xn({ className: e }) {
286
- return /* @__PURE__ */ _(z, { className: `lucide lucide-grid3x3-icon lucide-grid-3x3 ${e}`, children: [
287
- /* @__PURE__ */ t("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
288
- /* @__PURE__ */ t("path", { d: "M3 9h18" }),
289
- /* @__PURE__ */ t("path", { d: "M3 15h18" }),
290
- /* @__PURE__ */ t("path", { d: "M9 3v18" }),
291
- /* @__PURE__ */ t("path", { d: "M15 3v18" })
292
- ] });
293
- }
294
- function Cn({ className: e }) {
295
- return /* @__PURE__ */ _(z, { className: `lucide lucide-monitor-icon lucide-monitor ${e}`, children: [
296
- /* @__PURE__ */ t("rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }),
297
- /* @__PURE__ */ t("line", { x1: "8", x2: "16", y1: "21", y2: "21" }),
298
- /* @__PURE__ */ t("line", { x1: "12", x2: "12", y1: "17", y2: "21" })
299
- ] });
300
- }
301
- function wn({ className: e }) {
302
- return /* @__PURE__ */ _(
303
- z,
304
- {
305
- className: `lucide lucide-monitor-smartphone-icon lucide-monitor-smartphone ${e}`,
306
- children: [
307
- /* @__PURE__ */ t("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }),
308
- /* @__PURE__ */ t("path", { d: "M10 19v-3.96 3.15" }),
309
- /* @__PURE__ */ t("path", { d: "M7 19h5" }),
310
- /* @__PURE__ */ t("rect", { width: "6", height: "10", x: "16", y: "12", rx: "2" })
311
- ]
312
- }
313
- );
314
- }
315
- function ct({ className: e }) {
316
- return /* @__PURE__ */ _(
317
- z,
318
- {
319
- className: `lucide lucide-circle-arrow-left-icon lucide-circle-arrow-left ${e}`,
320
- children: [
321
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
322
- /* @__PURE__ */ t("path", { d: "m12 8-4 4 4 4" }),
323
- /* @__PURE__ */ t("path", { d: "M16 12H8" })
324
- ]
325
- }
326
- );
327
- }
328
- function dt({ className: e }) {
329
- return /* @__PURE__ */ _(
330
- z,
331
- {
332
- className: `lucide lucide-circle-arrow-right-icon lucide-circle-arrow-right ${e}`,
333
- children: [
334
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
335
- /* @__PURE__ */ t("path", { d: "m12 16 4-4-4-4" }),
336
- /* @__PURE__ */ t("path", { d: "M8 12h8" })
337
- ]
338
- }
339
- );
340
- }
341
- function _t({ className: e }) {
342
- return /* @__PURE__ */ _(z, { className: `lucide lucide-settings-icon lucide-settings ${e}`, children: [
343
- /* @__PURE__ */ t("path", { d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" }),
344
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "3" })
345
- ] });
346
- }
347
- function Sn({ className: e }) {
348
- return /* @__PURE__ */ _(
349
- z,
350
- {
351
- className: `lucide lucide-tablet-smartphone-icon lucide-tablet-smartphone ${e}`,
352
- children: [
353
- /* @__PURE__ */ t("rect", { width: "10", height: "14", x: "3", y: "8", rx: "2" }),
354
- /* @__PURE__ */ t("path", { d: "M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4" }),
355
- /* @__PURE__ */ t("path", { d: "M8 18h.01" })
356
- ]
357
- }
358
- );
359
- }
360
- function ut({ className: e }) {
361
- return /* @__PURE__ */ _(z, { className: `lucide lucide-circle-x-icon lucide-circle-x ${e}`, children: [
362
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
363
- /* @__PURE__ */ t("path", { d: "m15 9-6 6" }),
364
- /* @__PURE__ */ t("path", { d: "m9 9 6 6" })
365
- ] });
366
- }
367
- function Dn({ className: e }) {
368
- return /* @__PURE__ */ _(z, { className: `lucide lucide-zoom-in-icon lucide-zoom-in ${e}`, children: [
369
- /* @__PURE__ */ t("circle", { cx: "11", cy: "11", r: "8" }),
370
- /* @__PURE__ */ t("line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65" }),
371
- /* @__PURE__ */ t("line", { x1: "11", x2: "11", y1: "8", y2: "14" }),
372
- /* @__PURE__ */ t("line", { x1: "8", x2: "14", y1: "11", y2: "11" })
373
- ] });
374
- }
375
- function Tn({ className: e }) {
376
- return /* @__PURE__ */ _(z, { className: `lucide lucide-zoom-out-icon lucide-zoom-out ${e}`, children: [
377
- /* @__PURE__ */ t("circle", { cx: "11", cy: "11", r: "8" }),
378
- /* @__PURE__ */ t("line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65" }),
379
- /* @__PURE__ */ t("line", { x1: "8", x2: "14", y1: "11", y2: "11" })
380
- ] });
381
- }
382
- function Mt({ className: e }) {
383
- return /* @__PURE__ */ _(z, { className: `lucide lucide-timer-reset-icon lucide-timer-reset ${e}`, children: [
384
- /* @__PURE__ */ t("path", { d: "M10 2h4" }),
385
- /* @__PURE__ */ t("path", { d: "M12 14v-4" }),
386
- /* @__PURE__ */ t("path", { d: "M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6" }),
387
- /* @__PURE__ */ t("path", { d: "M9 17H4v5" })
388
- ] });
389
- }
390
- function Pt({ className: e }) {
391
- return /* @__PURE__ */ _(z, { className: `lucide lucide-undo-icon lucide-undo ${e}`, children: [
392
- /* @__PURE__ */ t("path", { d: "M3 7v6h6" }),
393
- /* @__PURE__ */ t("path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13" })
394
- ] });
395
- }
396
- function It({ className: e }) {
397
- return /* @__PURE__ */ _(z, { className: `lucide lucide-redo-icon lucide-redo ${e}`, children: [
398
- /* @__PURE__ */ t("path", { d: "M21 7v6h-6" }),
399
- /* @__PURE__ */ t("path", { d: "M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7" })
400
- ] });
401
- }
402
- function $t({ className: e }) {
403
- return /* @__PURE__ */ _(z, { className: `lucide lucide-hand-icon lucide-hand ${e}`, children: [
404
- /* @__PURE__ */ t("path", { d: "M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2" }),
405
- /* @__PURE__ */ t("path", { d: "M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2" }),
406
- /* @__PURE__ */ t("path", { d: "M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8" }),
407
- /* @__PURE__ */ t("path", { d: "M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15" })
408
- ] });
409
- }
410
- function Rt({ className: e }) {
411
- return /* @__PURE__ */ _(z, { className: `lucide lucide-hand-grab-icon lucide-hand-grab ${e}`, children: [
412
- /* @__PURE__ */ t("path", { d: "M18 11.5V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4" }),
413
- /* @__PURE__ */ t("path", { d: "M14 10V8a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2" }),
414
- /* @__PURE__ */ t("path", { d: "M10 9.9V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5" }),
415
- /* @__PURE__ */ t("path", { d: "M6 14a2 2 0 0 0-2-2a2 2 0 0 0-2 2" }),
416
- /* @__PURE__ */ t("path", { d: "M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-4a8 8 0 0 1-8-8 2 2 0 1 1 4 0" })
417
- ] });
418
- }
419
- function Ot({ className: e }) {
420
- return /* @__PURE__ */ _(z, { className: `lucide lucide-crosshair-icon lucide-crosshair ${e}`, children: [
421
- /* @__PURE__ */ t("line", { x1: "22", x2: "18", y1: "12", y2: "12" }),
422
- /* @__PURE__ */ t("line", { x1: "6", x2: "2", y1: "12", y2: "12" }),
423
- /* @__PURE__ */ t("line", { x1: "12", x2: "12", y1: "6", y2: "2" }),
424
- /* @__PURE__ */ t("line", { x1: "12", x2: "12", y1: "22", y2: "18" })
425
- ] });
426
- }
427
- function Nn({ className: e }) {
428
- return /* @__PURE__ */ _(z, { className: `lucide lucide-target-icon lucide-target ${e}`, children: [
429
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
430
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "6" }),
431
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "2" })
432
- ] });
433
- }
434
- function kt({ className: e }) {
435
- return /* @__PURE__ */ _(
436
- z,
437
- {
438
- className: `lucide lucide-file-question-mark-icon lucide-file-question-mark ${e}`,
439
- children: [
440
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
441
- /* @__PURE__ */ t("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
442
- /* @__PURE__ */ t("path", { d: "M12 17h.01" })
443
- ]
444
- }
445
- );
446
- }
447
- function ft({ className: e }) {
448
- return /* @__PURE__ */ t(z, { className: `lucide lucide-chevron-down-icon lucide-chevron-down ${e}`, children: /* @__PURE__ */ t("path", { d: "m6 9 6 6 6-6" }) });
449
- }
450
- const ht = ({
451
- label: e,
452
- className: s,
453
- size: n = "medium",
454
- value: r,
455
- onChange: d,
456
- onKeyDown: o,
457
- placeholder: c = ""
458
- }) => {
459
- const f = fe(() => n === "small" ? "py-1.5 px-3 text-sm" : "py-2.5 px-4 text-base", [n]), w = Z("flex flex-col gap-1", s || ""), v = `${Z(`
460
- block w-full rounded-md px-3 py-1.5 text-base
461
- bg-formfield content-formfield
462
- outline-1 -outline-offset-1 outline-primary
463
- placeholder:text-disabled
464
- focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-200 sm:text-sm/6
465
- `)} ${f}`;
466
- return /* @__PURE__ */ _("div", { className: w, children: [
467
- (e || "").trim().length > 0 && /* @__PURE__ */ t("label", { htmlFor: e, className: "block text-sm/6 font-medium", children: e }),
468
- /* @__PURE__ */ t(
469
- "input",
470
- {
471
- id: e,
472
- type: "text",
473
- value: r,
474
- onChange: d,
475
- onKeyDown: (l) => o && o(l),
476
- placeholder: c,
477
- className: v,
478
- "aria-label": e
479
- }
480
- )
481
- ] });
482
- }, Se = /* @__PURE__ */ new Map([
483
- [
484
- "normal",
485
- "group bg-[category] content-[category] hover:bg-[category] group-hover:bg-[category] focus:outline-[category] focus:outline-offset-[category]"
486
- ],
487
- [
488
- "ghost",
489
- "group bg-transparent border-[category] text-[category] hover:text-[category] group-hover:text-[category] focus:outline-[category] focus:outline-offset-[category]"
490
- ]
491
- ]);
492
- function ee(e) {
493
- const {
494
- tooltip: s,
495
- disabled: n,
496
- isIconButton: r,
497
- className: d,
498
- buttonType: o,
499
- category: c,
500
- px: f,
501
- py: w,
502
- children: b,
503
- ...v
504
- } = e, l = () => {
505
- const p = e.isIconButton || !1, T = e.category || "primary", h = e.buttonType || "normal", g = e.disabled || !1, x = e.className || "", N = e.font || "semibold", S = Number((e.border || 0) > 0 ? e.border : 0);
506
- let D = (e.borderColor || "").trim();
507
- D = D.length > 0 ? D : "";
508
- const a = Number((e.borderHover || 0) > 0 ? e.borderHover : 0), P = e.shadow || "sm", i = e.shadowHover || "md", u = (e.addCss || "").trim(), M = e.justifyCss || "justify-center";
509
- if (p)
510
- return Z(
511
- "flex flex-row items-center",
512
- g ? "text-disabled" : `text-${T} hover:brightness-110 cursor-pointer`,
513
- x || ""
514
- );
515
- const $ = [
516
- "relative cursor-pointer",
517
- "rounded-sm focus:outline-none focus:ring focus:ring-offset",
518
- "transition-all duration-150",
519
- "text-sm",
520
- `font-${N}`
521
- ];
522
- if (g)
523
- h === "ghost" ? $.push("text-disabled border-disabled cursor-not-allowed") : $.push("bg-disabled content-disabled border-disabled cursor-not-allowed");
524
- else {
525
- $.push("cursor-pointer");
526
- let R = "";
527
- Se.has(h) ? R = `${Se.get(h)}` : R = `${Se.get("normal")}`, S < 1 && (R = R.replace("border-[category]", ""));
528
- const V = R.replace(/\[category\]/g, T).trim();
529
- $.push(V);
530
- }
531
- return S > 0 ? ($.push(`border-[${S}px]`), $.push(`border-${D}`)) : ($.push("border-[1px]"), $.push("border-transparent")), a > 0 ? ($.push(`hover:border-[${a}px] group-hover:border-[${a}px]`), $.push(`hover:border-${D} group-hover:border-${D}`)) : $.push("hover:border-[1px] group-hover:border-[1px]"), $.push(`shadow-${P}`), $.push(`hover:shadow-${i} group-hover:shadow-${i}`), u.length > 0 && $.push(u), u.indexOf("hidden") === -1 && $.push("inline-flex"), $.push(M), $.join(" ").trim();
532
- }, y = () => {
533
- const p = e.px || 0.7, T = e.py || 0.25;
534
- return {
535
- padding: r ? 0 : `${T}rem ${p}rem `
536
- };
537
- };
538
- return /* @__PURE__ */ t("button", { type: "button", disabled: n, className: l(), style: y(), ...v, children: b });
539
- }
540
- const Wt = ({
541
- testid: e = "not-set",
542
- label: s = "",
543
- hideLabel: n = !1,
544
- showChevron: r = !1,
545
- hide: d = !1,
546
- enabled: o,
547
- isMenuOpen: c,
548
- toggleOpen: f,
549
- icon: w,
550
- children: b
551
- }) => {
552
- const v = at(null), [l, y] = oe(c);
553
- Oe(() => {
554
- c && y(!0);
555
- }, [c]);
556
- const p = () => {
557
- c || y(!1);
558
- };
559
- Oe(() => {
560
- const g = (x) => {
561
- v.current && !v.current.contains(x.target) && f(!1);
562
- };
563
- return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
564
- }, [f]);
565
- const T = fe(
566
- () => `
567
- group max-w-xs p-1 sm:p-2 rounded-full flex items-center text-sm
568
- focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary
569
- content-topbar ${o ? "hover:text-primary cursor-pointer" : "opacity-50"}
570
- `.trim(),
571
- [o]
572
- ), h = `
573
- absolute flex flex-col right-0 z-50 mt-2 w-56 origin-top-right
574
- rounded-md shadow-md ring-1 ring-black ring-opacity-5 focus:outline-none
575
- bg-formfield content-formfield transition transform duration-100
576
- ${c ? "ease-out opacity-100 scale-100" : "ease-in opacity-0 scale-95 pointer-events-none"}
577
- `.trim();
578
- return d ? null : /* @__PURE__ */ _("div", { ref: v, className: "relative inline-block text-left", "data-testid": e, children: [
579
- /* @__PURE__ */ _(
580
- "button",
581
- {
582
- type: "button",
583
- className: T,
584
- onClick: (g) => {
585
- g.stopPropagation(), f(!c);
586
- },
587
- children: [
588
- w,
589
- /* @__PURE__ */ t("span", { className: n ? "sr-only" : "hidden ml-3 text-sm font-medium lg:block", children: s }),
590
- r && /* @__PURE__ */ t(ft, { className: "hidden shrink-0 ml-1 size-4 lg:block" })
591
- ]
592
- }
593
- ),
594
- (c || l) && /* @__PURE__ */ t(
595
- "div",
596
- {
597
- className: h,
598
- onTransitionEnd: p,
599
- role: "menu",
600
- tabIndex: -1,
601
- children: /* @__PURE__ */ t("div", { className: "form-dropdown-menu overflow-clip flex flex-col grow rounded-md justify-center w-full h-full bg-sidebar content-sidebar bg-opacity-95 p-0", children: b })
602
- }
603
- )
604
- ] });
605
- }, jt = (e) => e.direction === "row" ? Z("flex flex-row items-center gap-2", e.classNames || "") : Z("flex flex-col gap-2 w-full", e.classNames || "");
606
- function At(e) {
607
- const { children: s, testId: n, classNames: r, direction: d, ...o } = e, c = jt(e);
608
- return /* @__PURE__ */ t("div", { "data-testid": n || "not-set", className: c, ...o, children: s });
609
- }
610
- const En = se(
611
- (e, s) => {
612
- const { classNames: n, innerClass: r, ...d } = e, o = Z(n || "", "w-full"), c = Z(
613
- `w-full flex overflow-hidden justify-between items-center gap-0
614
- rounded-md border`,
615
- r || ""
616
- );
617
- return /* @__PURE__ */ t(At, { direction: "row", classNames: o, ...d, children: /* @__PURE__ */ t("div", { className: c, children: e.children }) });
618
- }
619
- ), _n = se((e, s) => /* @__PURE__ */ t(
620
- "div",
621
- {
622
- "data-testid": e.testId || "not-set",
623
- className: "flex items-center justify-center",
624
- style: {
625
- flexShrink: 0,
626
- padding: "0.75rem 0 0.75rem 0.75rem"
627
- },
628
- children: e.children
629
- }
630
- )), Mn = se(
631
- (e, s) => /* @__PURE__ */ t(
632
- "div",
633
- {
634
- "data-testid": e.testId || "not-set",
635
- className: "flex-1 flex flex-col gap-0 truncate p-2",
636
- children: e.children
637
- }
638
- )
639
- ), Pn = se((e, s) => /* @__PURE__ */ t(
640
- "div",
641
- {
642
- "data-testid": e.testId || "not-set",
643
- className: "flex flex-row items-center justify-between gap-1 h-full",
644
- style: {
645
- flexShrink: 0,
646
- paddingRight: "0.65rem"
647
- },
648
- children: e.children
649
- }
650
- ));
651
- function Lt(e) {
652
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
653
- }
654
- var de = { exports: {} }, De = {}, me = { exports: {} }, pe = { exports: {} }, Y = {};
655
- var Le;
656
- function qt() {
657
- if (Le) return Y;
658
- Le = 1;
659
- var e = typeof Symbol == "function" && Symbol.for, s = e ? /* @__PURE__ */ Symbol.for("react.element") : 60103, n = e ? /* @__PURE__ */ Symbol.for("react.portal") : 60106, r = e ? /* @__PURE__ */ Symbol.for("react.fragment") : 60107, d = e ? /* @__PURE__ */ Symbol.for("react.strict_mode") : 60108, o = e ? /* @__PURE__ */ Symbol.for("react.profiler") : 60114, c = e ? /* @__PURE__ */ Symbol.for("react.provider") : 60109, f = e ? /* @__PURE__ */ Symbol.for("react.context") : 60110, w = e ? /* @__PURE__ */ Symbol.for("react.async_mode") : 60111, b = e ? /* @__PURE__ */ Symbol.for("react.concurrent_mode") : 60111, v = e ? /* @__PURE__ */ Symbol.for("react.forward_ref") : 60112, l = e ? /* @__PURE__ */ Symbol.for("react.suspense") : 60113, y = e ? /* @__PURE__ */ Symbol.for("react.suspense_list") : 60120, p = e ? /* @__PURE__ */ Symbol.for("react.memo") : 60115, T = e ? /* @__PURE__ */ Symbol.for("react.lazy") : 60116, h = e ? /* @__PURE__ */ Symbol.for("react.block") : 60121, g = e ? /* @__PURE__ */ Symbol.for("react.fundamental") : 60117, x = e ? /* @__PURE__ */ Symbol.for("react.responder") : 60118, N = e ? /* @__PURE__ */ Symbol.for("react.scope") : 60119;
660
- function S(a) {
661
- if (typeof a == "object" && a !== null) {
662
- var P = a.$$typeof;
663
- switch (P) {
664
- case s:
665
- switch (a = a.type, a) {
666
- case w:
667
- case b:
668
- case r:
669
- case o:
670
- case d:
671
- case l:
672
- return a;
673
- default:
674
- switch (a = a && a.$$typeof, a) {
675
- case f:
676
- case v:
677
- case T:
678
- case p:
679
- case c:
680
- return a;
681
- default:
682
- return P;
683
- }
684
- }
685
- case n:
686
- return P;
687
- }
688
- }
689
- }
690
- function D(a) {
691
- return S(a) === b;
692
- }
693
- return Y.AsyncMode = w, Y.ConcurrentMode = b, Y.ContextConsumer = f, Y.ContextProvider = c, Y.Element = s, Y.ForwardRef = v, Y.Fragment = r, Y.Lazy = T, Y.Memo = p, Y.Portal = n, Y.Profiler = o, Y.StrictMode = d, Y.Suspense = l, Y.isAsyncMode = function(a) {
694
- return D(a) || S(a) === w;
695
- }, Y.isConcurrentMode = D, Y.isContextConsumer = function(a) {
696
- return S(a) === f;
697
- }, Y.isContextProvider = function(a) {
698
- return S(a) === c;
699
- }, Y.isElement = function(a) {
700
- return typeof a == "object" && a !== null && a.$$typeof === s;
701
- }, Y.isForwardRef = function(a) {
702
- return S(a) === v;
703
- }, Y.isFragment = function(a) {
704
- return S(a) === r;
705
- }, Y.isLazy = function(a) {
706
- return S(a) === T;
707
- }, Y.isMemo = function(a) {
708
- return S(a) === p;
709
- }, Y.isPortal = function(a) {
710
- return S(a) === n;
711
- }, Y.isProfiler = function(a) {
712
- return S(a) === o;
713
- }, Y.isStrictMode = function(a) {
714
- return S(a) === d;
715
- }, Y.isSuspense = function(a) {
716
- return S(a) === l;
717
- }, Y.isValidElementType = function(a) {
718
- return typeof a == "string" || typeof a == "function" || a === r || a === b || a === o || a === d || a === l || a === y || typeof a == "object" && a !== null && (a.$$typeof === T || a.$$typeof === p || a.$$typeof === c || a.$$typeof === f || a.$$typeof === v || a.$$typeof === g || a.$$typeof === x || a.$$typeof === N || a.$$typeof === h);
719
- }, Y.typeOf = S, Y;
720
- }
721
- var F = {};
722
- var qe;
723
- function Ut() {
724
- return qe || (qe = 1, process.env.NODE_ENV !== "production" && (function() {
725
- var e = typeof Symbol == "function" && Symbol.for, s = e ? /* @__PURE__ */ Symbol.for("react.element") : 60103, n = e ? /* @__PURE__ */ Symbol.for("react.portal") : 60106, r = e ? /* @__PURE__ */ Symbol.for("react.fragment") : 60107, d = e ? /* @__PURE__ */ Symbol.for("react.strict_mode") : 60108, o = e ? /* @__PURE__ */ Symbol.for("react.profiler") : 60114, c = e ? /* @__PURE__ */ Symbol.for("react.provider") : 60109, f = e ? /* @__PURE__ */ Symbol.for("react.context") : 60110, w = e ? /* @__PURE__ */ Symbol.for("react.async_mode") : 60111, b = e ? /* @__PURE__ */ Symbol.for("react.concurrent_mode") : 60111, v = e ? /* @__PURE__ */ Symbol.for("react.forward_ref") : 60112, l = e ? /* @__PURE__ */ Symbol.for("react.suspense") : 60113, y = e ? /* @__PURE__ */ Symbol.for("react.suspense_list") : 60120, p = e ? /* @__PURE__ */ Symbol.for("react.memo") : 60115, T = e ? /* @__PURE__ */ Symbol.for("react.lazy") : 60116, h = e ? /* @__PURE__ */ Symbol.for("react.block") : 60121, g = e ? /* @__PURE__ */ Symbol.for("react.fundamental") : 60117, x = e ? /* @__PURE__ */ Symbol.for("react.responder") : 60118, N = e ? /* @__PURE__ */ Symbol.for("react.scope") : 60119;
726
- function S(E) {
727
- return typeof E == "string" || typeof E == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
728
- E === r || E === b || E === o || E === d || E === l || E === y || typeof E == "object" && E !== null && (E.$$typeof === T || E.$$typeof === p || E.$$typeof === c || E.$$typeof === f || E.$$typeof === v || E.$$typeof === g || E.$$typeof === x || E.$$typeof === N || E.$$typeof === h);
729
- }
730
- function D(E) {
731
- if (typeof E == "object" && E !== null) {
732
- var ne = E.$$typeof;
733
- switch (ne) {
734
- case s:
735
- var he = E.type;
736
- switch (he) {
737
- case w:
738
- case b:
739
- case r:
740
- case o:
741
- case d:
742
- case l:
743
- return he;
744
- default:
745
- var Ae = he && he.$$typeof;
746
- switch (Ae) {
747
- case f:
748
- case v:
749
- case T:
750
- case p:
751
- case c:
752
- return Ae;
753
- default:
754
- return ne;
755
- }
756
- }
757
- case n:
758
- return ne;
759
- }
760
- }
761
- }
762
- var a = w, P = b, i = f, u = c, M = s, $ = v, R = r, V = T, G = p, X = n, Q = o, m = d, B = l, te = !1;
763
- function le(E) {
764
- return te || (te = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), C(E) || D(E) === w;
765
- }
766
- function C(E) {
767
- return D(E) === b;
768
- }
769
- function I(E) {
770
- return D(E) === f;
771
- }
772
- function A(E) {
773
- return D(E) === c;
774
- }
775
- function W(E) {
776
- return typeof E == "object" && E !== null && E.$$typeof === s;
777
- }
778
- function O(E) {
779
- return D(E) === v;
780
- }
781
- function L(E) {
782
- return D(E) === r;
783
- }
784
- function k(E) {
785
- return D(E) === T;
786
- }
787
- function j(E) {
788
- return D(E) === p;
789
- }
790
- function q(E) {
791
- return D(E) === n;
792
- }
793
- function K(E) {
794
- return D(E) === o;
795
- }
796
- function U(E) {
797
- return D(E) === d;
798
- }
799
- function J(E) {
800
- return D(E) === l;
801
- }
802
- F.AsyncMode = a, F.ConcurrentMode = P, F.ContextConsumer = i, F.ContextProvider = u, F.Element = M, F.ForwardRef = $, F.Fragment = R, F.Lazy = V, F.Memo = G, F.Portal = X, F.Profiler = Q, F.StrictMode = m, F.Suspense = B, F.isAsyncMode = le, F.isConcurrentMode = C, F.isContextConsumer = I, F.isContextProvider = A, F.isElement = W, F.isForwardRef = O, F.isFragment = L, F.isLazy = k, F.isMemo = j, F.isPortal = q, F.isProfiler = K, F.isStrictMode = U, F.isSuspense = J, F.isValidElementType = S, F.typeOf = D;
803
- })()), F;
804
- }
805
- var Ue;
806
- function gt() {
807
- return Ue || (Ue = 1, process.env.NODE_ENV === "production" ? pe.exports = qt() : pe.exports = Ut()), pe.exports;
808
- }
809
- var Te, Ye;
810
- function Yt() {
811
- if (Ye) return Te;
812
- Ye = 1;
813
- var e = Object.getOwnPropertySymbols, s = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
814
- function r(o) {
815
- if (o == null)
816
- throw new TypeError("Object.assign cannot be called with null or undefined");
817
- return Object(o);
818
- }
819
- function d() {
820
- try {
821
- if (!Object.assign)
822
- return !1;
823
- var o = new String("abc");
824
- if (o[5] = "de", Object.getOwnPropertyNames(o)[0] === "5")
825
- return !1;
826
- for (var c = {}, f = 0; f < 10; f++)
827
- c["_" + String.fromCharCode(f)] = f;
828
- var w = Object.getOwnPropertyNames(c).map(function(v) {
829
- return c[v];
830
- });
831
- if (w.join("") !== "0123456789")
832
- return !1;
833
- var b = {};
834
- return "abcdefghijklmnopqrst".split("").forEach(function(v) {
835
- b[v] = v;
836
- }), Object.keys(Object.assign({}, b)).join("") === "abcdefghijklmnopqrst";
837
- } catch {
838
- return !1;
839
- }
840
- }
841
- return Te = d() ? Object.assign : function(o, c) {
842
- for (var f, w = r(o), b, v = 1; v < arguments.length; v++) {
843
- f = Object(arguments[v]);
844
- for (var l in f)
845
- s.call(f, l) && (w[l] = f[l]);
846
- if (e) {
847
- b = e(f);
848
- for (var y = 0; y < b.length; y++)
849
- n.call(f, b[y]) && (w[b[y]] = f[b[y]]);
850
- }
851
- }
852
- return w;
853
- }, Te;
854
- }
855
- var Ne, Fe;
856
- function ke() {
857
- if (Fe) return Ne;
858
- Fe = 1;
859
- var e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
860
- return Ne = e, Ne;
861
- }
862
- var Ee, Ke;
863
- function mt() {
864
- return Ke || (Ke = 1, Ee = Function.call.bind(Object.prototype.hasOwnProperty)), Ee;
865
- }
866
- var _e, ze;
867
- function Ft() {
868
- if (ze) return _e;
869
- ze = 1;
870
- var e = function() {
871
- };
872
- if (process.env.NODE_ENV !== "production") {
873
- var s = /* @__PURE__ */ ke(), n = {}, r = /* @__PURE__ */ mt();
874
- e = function(o) {
875
- var c = "Warning: " + o;
876
- typeof console < "u" && console.error(c);
877
- try {
878
- throw new Error(c);
879
- } catch {
880
- }
881
- };
882
- }
883
- function d(o, c, f, w, b) {
884
- if (process.env.NODE_ENV !== "production") {
885
- for (var v in o)
886
- if (r(o, v)) {
887
- var l;
888
- try {
889
- if (typeof o[v] != "function") {
890
- var y = Error(
891
- (w || "React class") + ": " + f + " type `" + v + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof o[v] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
892
- );
893
- throw y.name = "Invariant Violation", y;
894
- }
895
- l = o[v](c, v, w, f, null, s);
896
- } catch (T) {
897
- l = T;
898
- }
899
- if (l && !(l instanceof Error) && e(
900
- (w || "React class") + ": type specification of " + f + " `" + v + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof l + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
901
- ), l instanceof Error && !(l.message in n)) {
902
- n[l.message] = !0;
903
- var p = b ? b() : "";
904
- e(
905
- "Failed " + f + " type: " + l.message + (p ?? "")
906
- );
907
- }
908
- }
909
- }
910
- }
911
- return d.resetWarningCache = function() {
912
- process.env.NODE_ENV !== "production" && (n = {});
913
- }, _e = d, _e;
914
- }
915
- var Me, Be;
916
- function Kt() {
917
- if (Be) return Me;
918
- Be = 1;
919
- var e = gt(), s = Yt(), n = /* @__PURE__ */ ke(), r = /* @__PURE__ */ mt(), d = /* @__PURE__ */ Ft(), o = function() {
920
- };
921
- process.env.NODE_ENV !== "production" && (o = function(f) {
922
- var w = "Warning: " + f;
923
- typeof console < "u" && console.error(w);
924
- try {
925
- throw new Error(w);
926
- } catch {
927
- }
928
- });
929
- function c() {
930
- return null;
931
- }
932
- return Me = function(f, w) {
933
- var b = typeof Symbol == "function" && Symbol.iterator, v = "@@iterator";
934
- function l(C) {
935
- var I = C && (b && C[b] || C[v]);
936
- if (typeof I == "function")
937
- return I;
938
- }
939
- var y = "<<anonymous>>", p = {
940
- array: x("array"),
941
- bigint: x("bigint"),
942
- bool: x("boolean"),
943
- func: x("function"),
944
- number: x("number"),
945
- object: x("object"),
946
- string: x("string"),
947
- symbol: x("symbol"),
948
- any: N(),
949
- arrayOf: S,
950
- element: D(),
951
- elementType: a(),
952
- instanceOf: P,
953
- node: $(),
954
- objectOf: u,
955
- oneOf: i,
956
- oneOfType: M,
957
- shape: V,
958
- exact: G
959
- };
960
- function T(C, I) {
961
- return C === I ? C !== 0 || 1 / C === 1 / I : C !== C && I !== I;
962
- }
963
- function h(C, I) {
964
- this.message = C, this.data = I && typeof I == "object" ? I : {}, this.stack = "";
965
- }
966
- h.prototype = Error.prototype;
967
- function g(C) {
968
- if (process.env.NODE_ENV !== "production")
969
- var I = {}, A = 0;
970
- function W(L, k, j, q, K, U, J) {
971
- if (q = q || y, U = U || j, J !== n) {
972
- if (w) {
973
- var E = new Error(
974
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
975
- );
976
- throw E.name = "Invariant Violation", E;
977
- } else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
978
- var ne = q + ":" + j;
979
- !I[ne] && // Avoid spamming the console because they are often not actionable except for lib authors
980
- A < 3 && (o(
981
- "You are manually calling a React.PropTypes validation function for the `" + U + "` prop on `" + q + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
982
- ), I[ne] = !0, A++);
983
- }
984
- }
985
- return k[j] == null ? L ? k[j] === null ? new h("The " + K + " `" + U + "` is marked as required " + ("in `" + q + "`, but its value is `null`.")) : new h("The " + K + " `" + U + "` is marked as required in " + ("`" + q + "`, but its value is `undefined`.")) : null : C(k, j, q, K, U);
986
- }
987
- var O = W.bind(null, !1);
988
- return O.isRequired = W.bind(null, !0), O;
989
- }
990
- function x(C) {
991
- function I(A, W, O, L, k, j) {
992
- var q = A[W], K = m(q);
993
- if (K !== C) {
994
- var U = B(q);
995
- return new h(
996
- "Invalid " + L + " `" + k + "` of type " + ("`" + U + "` supplied to `" + O + "`, expected ") + ("`" + C + "`."),
997
- { expectedType: C }
998
- );
999
- }
1000
- return null;
1001
- }
1002
- return g(I);
1003
- }
1004
- function N() {
1005
- return g(c);
1006
- }
1007
- function S(C) {
1008
- function I(A, W, O, L, k) {
1009
- if (typeof C != "function")
1010
- return new h("Property `" + k + "` of component `" + O + "` has invalid PropType notation inside arrayOf.");
1011
- var j = A[W];
1012
- if (!Array.isArray(j)) {
1013
- var q = m(j);
1014
- return new h("Invalid " + L + " `" + k + "` of type " + ("`" + q + "` supplied to `" + O + "`, expected an array."));
1015
- }
1016
- for (var K = 0; K < j.length; K++) {
1017
- var U = C(j, K, O, L, k + "[" + K + "]", n);
1018
- if (U instanceof Error)
1019
- return U;
1020
- }
1021
- return null;
1022
- }
1023
- return g(I);
1024
- }
1025
- function D() {
1026
- function C(I, A, W, O, L) {
1027
- var k = I[A];
1028
- if (!f(k)) {
1029
- var j = m(k);
1030
- return new h("Invalid " + O + " `" + L + "` of type " + ("`" + j + "` supplied to `" + W + "`, expected a single ReactElement."));
1031
- }
1032
- return null;
1033
- }
1034
- return g(C);
1035
- }
1036
- function a() {
1037
- function C(I, A, W, O, L) {
1038
- var k = I[A];
1039
- if (!e.isValidElementType(k)) {
1040
- var j = m(k);
1041
- return new h("Invalid " + O + " `" + L + "` of type " + ("`" + j + "` supplied to `" + W + "`, expected a single ReactElement type."));
1042
- }
1043
- return null;
1044
- }
1045
- return g(C);
1046
- }
1047
- function P(C) {
1048
- function I(A, W, O, L, k) {
1049
- if (!(A[W] instanceof C)) {
1050
- var j = C.name || y, q = le(A[W]);
1051
- return new h("Invalid " + L + " `" + k + "` of type " + ("`" + q + "` supplied to `" + O + "`, expected ") + ("instance of `" + j + "`."));
1052
- }
1053
- return null;
1054
- }
1055
- return g(I);
1056
- }
1057
- function i(C) {
1058
- if (!Array.isArray(C))
1059
- return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? o(
1060
- "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
1061
- ) : o("Invalid argument supplied to oneOf, expected an array.")), c;
1062
- function I(A, W, O, L, k) {
1063
- for (var j = A[W], q = 0; q < C.length; q++)
1064
- if (T(j, C[q]))
1065
- return null;
1066
- var K = JSON.stringify(C, function(J, E) {
1067
- var ne = B(E);
1068
- return ne === "symbol" ? String(E) : E;
1069
- });
1070
- return new h("Invalid " + L + " `" + k + "` of value `" + String(j) + "` " + ("supplied to `" + O + "`, expected one of " + K + "."));
1071
- }
1072
- return g(I);
1073
- }
1074
- function u(C) {
1075
- function I(A, W, O, L, k) {
1076
- if (typeof C != "function")
1077
- return new h("Property `" + k + "` of component `" + O + "` has invalid PropType notation inside objectOf.");
1078
- var j = A[W], q = m(j);
1079
- if (q !== "object")
1080
- return new h("Invalid " + L + " `" + k + "` of type " + ("`" + q + "` supplied to `" + O + "`, expected an object."));
1081
- for (var K in j)
1082
- if (r(j, K)) {
1083
- var U = C(j, K, O, L, k + "." + K, n);
1084
- if (U instanceof Error)
1085
- return U;
1086
- }
1087
- return null;
1088
- }
1089
- return g(I);
1090
- }
1091
- function M(C) {
1092
- if (!Array.isArray(C))
1093
- return process.env.NODE_ENV !== "production" && o("Invalid argument supplied to oneOfType, expected an instance of array."), c;
1094
- for (var I = 0; I < C.length; I++) {
1095
- var A = C[I];
1096
- if (typeof A != "function")
1097
- return o(
1098
- "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + te(A) + " at index " + I + "."
1099
- ), c;
1100
- }
1101
- function W(O, L, k, j, q) {
1102
- for (var K = [], U = 0; U < C.length; U++) {
1103
- var J = C[U], E = J(O, L, k, j, q, n);
1104
- if (E == null)
1105
- return null;
1106
- E.data && r(E.data, "expectedType") && K.push(E.data.expectedType);
1107
- }
1108
- var ne = K.length > 0 ? ", expected one of type [" + K.join(", ") + "]" : "";
1109
- return new h("Invalid " + j + " `" + q + "` supplied to " + ("`" + k + "`" + ne + "."));
1110
- }
1111
- return g(W);
1112
- }
1113
- function $() {
1114
- function C(I, A, W, O, L) {
1115
- return X(I[A]) ? null : new h("Invalid " + O + " `" + L + "` supplied to " + ("`" + W + "`, expected a ReactNode."));
1116
- }
1117
- return g(C);
1118
- }
1119
- function R(C, I, A, W, O) {
1120
- return new h(
1121
- (C || "React class") + ": " + I + " type `" + A + "." + W + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + O + "`."
1122
- );
1123
- }
1124
- function V(C) {
1125
- function I(A, W, O, L, k) {
1126
- var j = A[W], q = m(j);
1127
- if (q !== "object")
1128
- return new h("Invalid " + L + " `" + k + "` of type `" + q + "` " + ("supplied to `" + O + "`, expected `object`."));
1129
- for (var K in C) {
1130
- var U = C[K];
1131
- if (typeof U != "function")
1132
- return R(O, L, k, K, B(U));
1133
- var J = U(j, K, O, L, k + "." + K, n);
1134
- if (J)
1135
- return J;
1136
- }
1137
- return null;
1138
- }
1139
- return g(I);
1140
- }
1141
- function G(C) {
1142
- function I(A, W, O, L, k) {
1143
- var j = A[W], q = m(j);
1144
- if (q !== "object")
1145
- return new h("Invalid " + L + " `" + k + "` of type `" + q + "` " + ("supplied to `" + O + "`, expected `object`."));
1146
- var K = s({}, A[W], C);
1147
- for (var U in K) {
1148
- var J = C[U];
1149
- if (r(C, U) && typeof J != "function")
1150
- return R(O, L, k, U, B(J));
1151
- if (!J)
1152
- return new h(
1153
- "Invalid " + L + " `" + k + "` key `" + U + "` supplied to `" + O + "`.\nBad object: " + JSON.stringify(A[W], null, " ") + `
1154
- Valid keys: ` + JSON.stringify(Object.keys(C), null, " ")
1155
- );
1156
- var E = J(j, U, O, L, k + "." + U, n);
1157
- if (E)
1158
- return E;
1159
- }
1160
- return null;
1161
- }
1162
- return g(I);
1163
- }
1164
- function X(C) {
1165
- switch (typeof C) {
1166
- case "number":
1167
- case "string":
1168
- case "undefined":
1169
- return !0;
1170
- case "boolean":
1171
- return !C;
1172
- case "object":
1173
- if (Array.isArray(C))
1174
- return C.every(X);
1175
- if (C === null || f(C))
1176
- return !0;
1177
- var I = l(C);
1178
- if (I) {
1179
- var A = I.call(C), W;
1180
- if (I !== C.entries) {
1181
- for (; !(W = A.next()).done; )
1182
- if (!X(W.value))
1183
- return !1;
1184
- } else
1185
- for (; !(W = A.next()).done; ) {
1186
- var O = W.value;
1187
- if (O && !X(O[1]))
1188
- return !1;
1189
- }
1190
- } else
1191
- return !1;
1192
- return !0;
1193
- default:
1194
- return !1;
1195
- }
1196
- }
1197
- function Q(C, I) {
1198
- return C === "symbol" ? !0 : I ? I["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && I instanceof Symbol : !1;
1199
- }
1200
- function m(C) {
1201
- var I = typeof C;
1202
- return Array.isArray(C) ? "array" : C instanceof RegExp ? "object" : Q(I, C) ? "symbol" : I;
1203
- }
1204
- function B(C) {
1205
- if (typeof C > "u" || C === null)
1206
- return "" + C;
1207
- var I = m(C);
1208
- if (I === "object") {
1209
- if (C instanceof Date)
1210
- return "date";
1211
- if (C instanceof RegExp)
1212
- return "regexp";
1213
- }
1214
- return I;
1215
- }
1216
- function te(C) {
1217
- var I = B(C);
1218
- switch (I) {
1219
- case "array":
1220
- case "object":
1221
- return "an " + I;
1222
- case "boolean":
1223
- case "date":
1224
- case "regexp":
1225
- return "a " + I;
1226
- default:
1227
- return I;
1228
- }
1229
- }
1230
- function le(C) {
1231
- return !C.constructor || !C.constructor.name ? y : C.constructor.name;
1232
- }
1233
- return p.checkPropTypes = d, p.resetWarningCache = d.resetWarningCache, p.PropTypes = p, p;
1234
- }, Me;
1235
- }
1236
- var Pe, He;
1237
- function zt() {
1238
- if (He) return Pe;
1239
- He = 1;
1240
- var e = /* @__PURE__ */ ke();
1241
- function s() {
1242
- }
1243
- function n() {
1244
- }
1245
- return n.resetWarningCache = s, Pe = function() {
1246
- function r(c, f, w, b, v, l) {
1247
- if (l !== e) {
1248
- var y = new Error(
1249
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
1250
- );
1251
- throw y.name = "Invariant Violation", y;
1252
- }
1253
- }
1254
- r.isRequired = r;
1255
- function d() {
1256
- return r;
1257
- }
1258
- var o = {
1259
- array: r,
1260
- bigint: r,
1261
- bool: r,
1262
- func: r,
1263
- number: r,
1264
- object: r,
1265
- string: r,
1266
- symbol: r,
1267
- any: r,
1268
- arrayOf: d,
1269
- element: r,
1270
- elementType: r,
1271
- instanceOf: d,
1272
- node: r,
1273
- objectOf: d,
1274
- oneOf: d,
1275
- oneOfType: d,
1276
- shape: d,
1277
- exact: d,
1278
- checkPropTypes: n,
1279
- resetWarningCache: s
1280
- };
1281
- return o.PropTypes = o, o;
1282
- }, Pe;
1283
- }
1284
- var Ve;
1285
- function pt() {
1286
- if (Ve) return me.exports;
1287
- if (Ve = 1, process.env.NODE_ENV !== "production") {
1288
- var e = gt(), s = !0;
1289
- me.exports = /* @__PURE__ */ Kt()(e.isElement, s);
1290
- } else
1291
- me.exports = /* @__PURE__ */ zt()();
1292
- return me.exports;
1293
- }
1294
- var ye = { exports: {} }, Xe;
1295
- function Bt() {
1296
- if (Xe) return ye.exports;
1297
- Xe = 1;
1298
- function e(n) {
1299
- var r, d, o = "";
1300
- if (typeof n == "string" || typeof n == "number") o += n;
1301
- else if (typeof n == "object") if (Array.isArray(n)) {
1302
- var c = n.length;
1303
- for (r = 0; r < c; r++) n[r] && (d = e(n[r])) && (o && (o += " "), o += d);
1304
- } else for (d in n) n[d] && (o && (o += " "), o += d);
1305
- return o;
1306
- }
1307
- function s() {
1308
- for (var n, r, d = 0, o = "", c = arguments.length; d < c; d++) (n = arguments[d]) && (r = e(n)) && (o && (o += " "), o += r);
1309
- return o;
1310
- }
1311
- return ye.exports = s, ye.exports.clsx = s, ye.exports;
1312
- }
1313
- var H = {}, ie = {}, Ge;
1314
- function Ce() {
1315
- if (Ge) return ie;
1316
- Ge = 1, Object.defineProperty(ie, "__esModule", {
1317
- value: !0
1318
- }), ie.dontSetMe = d, ie.findInArray = e, ie.int = r, ie.isFunction = s, ie.isNum = n;
1319
- function e(o, c) {
1320
- for (let f = 0, w = o.length; f < w; f++)
1321
- if (c.apply(c, [o[f], f, o])) return o[f];
1322
- }
1323
- function s(o) {
1324
- return typeof o == "function" || Object.prototype.toString.call(o) === "[object Function]";
1325
- }
1326
- function n(o) {
1327
- return typeof o == "number" && !isNaN(o);
1328
- }
1329
- function r(o) {
1330
- return parseInt(o, 10);
1331
- }
1332
- function d(o, c, f) {
1333
- if (o[c])
1334
- return new Error(`Invalid prop ${c} passed to ${f} - do not set this, set it on the child.`);
1335
- }
1336
- return ie;
1337
- }
1338
- var ae = {}, Ze;
1339
- function Ht() {
1340
- if (Ze) return ae;
1341
- Ze = 1, Object.defineProperty(ae, "__esModule", {
1342
- value: !0
1343
- }), ae.browserPrefixToKey = n, ae.browserPrefixToStyle = r, ae.default = void 0, ae.getPrefix = s;
1344
- const e = ["Moz", "Webkit", "O", "ms"];
1345
- function s() {
1346
- let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "transform";
1347
- if (typeof window > "u") return "";
1348
- const c = window.document?.documentElement?.style;
1349
- if (!c || o in c) return "";
1350
- for (let f = 0; f < e.length; f++)
1351
- if (n(o, e[f]) in c) return e[f];
1352
- return "";
1353
- }
1354
- function n(o, c) {
1355
- return c ? `${c}${d(o)}` : o;
1356
- }
1357
- function r(o, c) {
1358
- return c ? `-${c.toLowerCase()}-${o}` : o;
1359
- }
1360
- function d(o) {
1361
- let c = "", f = !0;
1362
- for (let w = 0; w < o.length; w++)
1363
- f ? (c += o[w].toUpperCase(), f = !1) : o[w] === "-" ? f = !0 : c += o[w];
1364
- return c;
1365
- }
1366
- return ae.default = s(), ae;
1367
- }
1368
- var Je;
1369
- function We() {
1370
- if (Je) return H;
1371
- Je = 1, Object.defineProperty(H, "__esModule", {
1372
- value: !0
1373
- }), H.addClassName = a, H.addEvent = c, H.addUserSelectStyles = N, H.createCSSTransform = p, H.createSVGTransform = T, H.getTouch = g, H.getTouchIdentifier = x, H.getTranslation = h, H.innerHeight = v, H.innerWidth = l, H.matchesSelector = d, H.matchesSelectorAndParentsTo = o, H.offsetXYFromParent = y, H.outerHeight = w, H.outerWidth = b, H.removeClassName = P, H.removeEvent = f, H.scheduleRemoveUserSelectStyles = S;
1374
- var e = Ce(), s = n(Ht());
1375
- function n(i, u) {
1376
- if (typeof WeakMap == "function") var M = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap();
1377
- return (n = function(R, V) {
1378
- if (!V && R && R.__esModule) return R;
1379
- var G, X, Q = { __proto__: null, default: R };
1380
- if (R === null || typeof R != "object" && typeof R != "function") return Q;
1381
- if (G = V ? $ : M) {
1382
- if (G.has(R)) return G.get(R);
1383
- G.set(R, Q);
1384
- }
1385
- for (const m in R) m !== "default" && {}.hasOwnProperty.call(R, m) && ((X = (G = Object.defineProperty) && Object.getOwnPropertyDescriptor(R, m)) && (X.get || X.set) ? G(Q, m, X) : Q[m] = R[m]);
1386
- return Q;
1387
- })(i, u);
1388
- }
1389
- let r = "";
1390
- function d(i, u) {
1391
- return r || (r = (0, e.findInArray)(["matches", "webkitMatchesSelector", "mozMatchesSelector", "msMatchesSelector", "oMatchesSelector"], function(M) {
1392
- return (0, e.isFunction)(i[M]);
1393
- })), (0, e.isFunction)(i[r]) ? i[r](u) : !1;
1394
- }
1395
- function o(i, u, M) {
1396
- let $ = i;
1397
- do {
1398
- if (d($, u)) return !0;
1399
- if ($ === M) return !1;
1400
- $ = $.parentNode;
1401
- } while ($);
1402
- return !1;
1403
- }
1404
- function c(i, u, M, $) {
1405
- if (!i) return;
1406
- const R = {
1407
- capture: !0,
1408
- ...$
1409
- };
1410
- i.addEventListener ? i.addEventListener(u, M, R) : i.attachEvent ? i.attachEvent("on" + u, M) : i["on" + u] = M;
1411
- }
1412
- function f(i, u, M, $) {
1413
- if (!i) return;
1414
- const R = {
1415
- capture: !0,
1416
- ...$
1417
- };
1418
- i.removeEventListener ? i.removeEventListener(u, M, R) : i.detachEvent ? i.detachEvent("on" + u, M) : i["on" + u] = null;
1419
- }
1420
- function w(i) {
1421
- let u = i.clientHeight;
1422
- const M = i.ownerDocument.defaultView.getComputedStyle(i);
1423
- return u += (0, e.int)(M.borderTopWidth), u += (0, e.int)(M.borderBottomWidth), u;
1424
- }
1425
- function b(i) {
1426
- let u = i.clientWidth;
1427
- const M = i.ownerDocument.defaultView.getComputedStyle(i);
1428
- return u += (0, e.int)(M.borderLeftWidth), u += (0, e.int)(M.borderRightWidth), u;
1429
- }
1430
- function v(i) {
1431
- let u = i.clientHeight;
1432
- const M = i.ownerDocument.defaultView.getComputedStyle(i);
1433
- return u -= (0, e.int)(M.paddingTop), u -= (0, e.int)(M.paddingBottom), u;
1434
- }
1435
- function l(i) {
1436
- let u = i.clientWidth;
1437
- const M = i.ownerDocument.defaultView.getComputedStyle(i);
1438
- return u -= (0, e.int)(M.paddingLeft), u -= (0, e.int)(M.paddingRight), u;
1439
- }
1440
- function y(i, u, M) {
1441
- const R = u === u.ownerDocument.body ? {
1442
- left: 0,
1443
- top: 0
1444
- } : u.getBoundingClientRect(), V = (i.clientX + u.scrollLeft - R.left) / M, G = (i.clientY + u.scrollTop - R.top) / M;
1445
- return {
1446
- x: V,
1447
- y: G
1448
- };
1449
- }
1450
- function p(i, u) {
1451
- const M = h(i, u, "px");
1452
- return {
1453
- [(0, s.browserPrefixToKey)("transform", s.default)]: M
1454
- };
1455
- }
1456
- function T(i, u) {
1457
- return h(i, u, "");
1458
- }
1459
- function h(i, u, M) {
1460
- let {
1461
- x: $,
1462
- y: R
1463
- } = i, V = `translate(${$}${M},${R}${M})`;
1464
- if (u) {
1465
- const G = `${typeof u.x == "string" ? u.x : u.x + M}`, X = `${typeof u.y == "string" ? u.y : u.y + M}`;
1466
- V = `translate(${G}, ${X})` + V;
1467
- }
1468
- return V;
1469
- }
1470
- function g(i, u) {
1471
- return i.targetTouches && (0, e.findInArray)(i.targetTouches, (M) => u === M.identifier) || i.changedTouches && (0, e.findInArray)(i.changedTouches, (M) => u === M.identifier);
1472
- }
1473
- function x(i) {
1474
- if (i.targetTouches && i.targetTouches[0]) return i.targetTouches[0].identifier;
1475
- if (i.changedTouches && i.changedTouches[0]) return i.changedTouches[0].identifier;
1476
- }
1477
- function N(i) {
1478
- if (!i) return;
1479
- let u = i.getElementById("react-draggable-style-el");
1480
- u || (u = i.createElement("style"), u.type = "text/css", u.id = "react-draggable-style-el", u.innerHTML = `.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
1481
- `, u.innerHTML += `.react-draggable-transparent-selection *::selection {all: inherit;}
1482
- `, i.getElementsByTagName("head")[0].appendChild(u)), i.body && a(i.body, "react-draggable-transparent-selection");
1483
- }
1484
- function S(i) {
1485
- window.requestAnimationFrame ? window.requestAnimationFrame(() => {
1486
- D(i);
1487
- }) : D(i);
1488
- }
1489
- function D(i) {
1490
- if (i)
1491
- try {
1492
- if (i.body && P(i.body, "react-draggable-transparent-selection"), i.selection)
1493
- i.selection.empty();
1494
- else {
1495
- const u = (i.defaultView || window).getSelection();
1496
- u && u.type !== "Caret" && u.removeAllRanges();
1497
- }
1498
- } catch {
1499
- }
1500
- }
1501
- function a(i, u) {
1502
- i.classList ? i.classList.add(u) : i.className.match(new RegExp(`(?:^|\\s)${u}(?!\\S)`)) || (i.className += ` ${u}`);
1503
- }
1504
- function P(i, u) {
1505
- i.classList ? i.classList.remove(u) : i.className = i.className.replace(new RegExp(`(?:^|\\s)${u}(?!\\S)`, "g"), "");
1506
- }
1507
- return H;
1508
- }
1509
- var re = {}, Qe;
1510
- function yt() {
1511
- if (Qe) return re;
1512
- Qe = 1, Object.defineProperty(re, "__esModule", {
1513
- value: !0
1514
- }), re.canDragX = d, re.canDragY = o, re.createCoreData = f, re.createDraggableData = w, re.getBoundPosition = n, re.getControlPosition = c, re.snapToGrid = r;
1515
- var e = Ce(), s = We();
1516
- function n(l, y, p) {
1517
- if (!l.props.bounds) return [y, p];
1518
- let {
1519
- bounds: T
1520
- } = l.props;
1521
- T = typeof T == "string" ? T : b(T);
1522
- const h = v(l);
1523
- if (typeof T == "string") {
1524
- const {
1525
- ownerDocument: g
1526
- } = h, x = g.defaultView;
1527
- let N;
1528
- if (T === "parent" ? N = h.parentNode : N = h.getRootNode().querySelector(T), !(N instanceof x.HTMLElement))
1529
- throw new Error('Bounds selector "' + T + '" could not find an element.');
1530
- const S = N, D = x.getComputedStyle(h), a = x.getComputedStyle(S);
1531
- T = {
1532
- left: -h.offsetLeft + (0, e.int)(a.paddingLeft) + (0, e.int)(D.marginLeft),
1533
- top: -h.offsetTop + (0, e.int)(a.paddingTop) + (0, e.int)(D.marginTop),
1534
- right: (0, s.innerWidth)(S) - (0, s.outerWidth)(h) - h.offsetLeft + (0, e.int)(a.paddingRight) - (0, e.int)(D.marginRight),
1535
- bottom: (0, s.innerHeight)(S) - (0, s.outerHeight)(h) - h.offsetTop + (0, e.int)(a.paddingBottom) - (0, e.int)(D.marginBottom)
1536
- };
1537
- }
1538
- return (0, e.isNum)(T.right) && (y = Math.min(y, T.right)), (0, e.isNum)(T.bottom) && (p = Math.min(p, T.bottom)), (0, e.isNum)(T.left) && (y = Math.max(y, T.left)), (0, e.isNum)(T.top) && (p = Math.max(p, T.top)), [y, p];
1539
- }
1540
- function r(l, y, p) {
1541
- const T = Math.round(y / l[0]) * l[0], h = Math.round(p / l[1]) * l[1];
1542
- return [T, h];
1543
- }
1544
- function d(l) {
1545
- return l.props.axis === "both" || l.props.axis === "x";
1546
- }
1547
- function o(l) {
1548
- return l.props.axis === "both" || l.props.axis === "y";
1549
- }
1550
- function c(l, y, p) {
1551
- const T = typeof y == "number" ? (0, s.getTouch)(l, y) : null;
1552
- if (typeof y == "number" && !T) return null;
1553
- const h = v(p), g = p.props.offsetParent || h.offsetParent || h.ownerDocument.body;
1554
- return (0, s.offsetXYFromParent)(T || l, g, p.props.scale);
1555
- }
1556
- function f(l, y, p) {
1557
- const T = !(0, e.isNum)(l.lastX), h = v(l);
1558
- return T ? {
1559
- node: h,
1560
- deltaX: 0,
1561
- deltaY: 0,
1562
- lastX: y,
1563
- lastY: p,
1564
- x: y,
1565
- y: p
1566
- } : {
1567
- node: h,
1568
- deltaX: y - l.lastX,
1569
- deltaY: p - l.lastY,
1570
- lastX: l.lastX,
1571
- lastY: l.lastY,
1572
- x: y,
1573
- y: p
1574
- };
1575
- }
1576
- function w(l, y) {
1577
- const p = l.props.scale;
1578
- return {
1579
- node: y.node,
1580
- x: l.state.x + y.deltaX / p,
1581
- y: l.state.y + y.deltaY / p,
1582
- deltaX: y.deltaX / p,
1583
- deltaY: y.deltaY / p,
1584
- lastX: l.state.x,
1585
- lastY: l.state.y
1586
- };
1587
- }
1588
- function b(l) {
1589
- return {
1590
- left: l.left,
1591
- top: l.top,
1592
- right: l.right,
1593
- bottom: l.bottom
1594
- };
1595
- }
1596
- function v(l) {
1597
- const y = l.findDOMNode();
1598
- if (!y)
1599
- throw new Error("<DraggableCore>: Unmounted during event!");
1600
- return y;
1601
- }
1602
- return re;
1603
- }
1604
- var ue = {}, be = {}, et;
1605
- function bt() {
1606
- if (et) return be;
1607
- et = 1, Object.defineProperty(be, "__esModule", {
1608
- value: !0
1609
- }), be.default = e;
1610
- function e() {
1611
- }
1612
- return be;
1613
- }
1614
- var tt;
1615
- function Vt() {
1616
- if (tt) return ue;
1617
- tt = 1, Object.defineProperty(ue, "__esModule", {
1618
- value: !0
1619
- }), ue.default = void 0;
1620
- var e = w(xe), s = f(/* @__PURE__ */ pt()), n = f(st), r = We(), d = yt(), o = Ce(), c = f(bt());
1621
- function f(h) {
1622
- return h && h.__esModule ? h : { default: h };
1623
- }
1624
- function w(h, g) {
1625
- if (typeof WeakMap == "function") var x = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap();
1626
- return (w = function(S, D) {
1627
- if (!D && S && S.__esModule) return S;
1628
- var a, P, i = { __proto__: null, default: S };
1629
- if (S === null || typeof S != "object" && typeof S != "function") return i;
1630
- if (a = D ? N : x) {
1631
- if (a.has(S)) return a.get(S);
1632
- a.set(S, i);
1633
- }
1634
- for (const u in S) u !== "default" && {}.hasOwnProperty.call(S, u) && ((P = (a = Object.defineProperty) && Object.getOwnPropertyDescriptor(S, u)) && (P.get || P.set) ? a(i, u, P) : i[u] = S[u]);
1635
- return i;
1636
- })(h, g);
1637
- }
1638
- function b(h, g, x) {
1639
- return (g = v(g)) in h ? Object.defineProperty(h, g, { value: x, enumerable: !0, configurable: !0, writable: !0 }) : h[g] = x, h;
1640
- }
1641
- function v(h) {
1642
- var g = l(h, "string");
1643
- return typeof g == "symbol" ? g : g + "";
1644
- }
1645
- function l(h, g) {
1646
- if (typeof h != "object" || !h) return h;
1647
- var x = h[Symbol.toPrimitive];
1648
- if (x !== void 0) {
1649
- var N = x.call(h, g);
1650
- if (typeof N != "object") return N;
1651
- throw new TypeError("@@toPrimitive must return a primitive value.");
1652
- }
1653
- return (g === "string" ? String : Number)(h);
1654
- }
1655
- const y = {
1656
- touch: {
1657
- start: "touchstart",
1658
- move: "touchmove",
1659
- stop: "touchend"
1660
- },
1661
- mouse: {
1662
- start: "mousedown",
1663
- move: "mousemove",
1664
- stop: "mouseup"
1665
- }
1666
- };
1667
- let p = y.mouse, T = class extends e.Component {
1668
- constructor() {
1669
- super(...arguments), b(this, "dragging", !1), b(this, "lastX", NaN), b(this, "lastY", NaN), b(this, "touchIdentifier", null), b(this, "mounted", !1), b(this, "handleDragStart", (g) => {
1670
- if (this.props.onMouseDown(g), !this.props.allowAnyClick && typeof g.button == "number" && g.button !== 0) return !1;
1671
- const x = this.findDOMNode();
1672
- if (!x || !x.ownerDocument || !x.ownerDocument.body)
1673
- throw new Error("<DraggableCore> not mounted on DragStart!");
1674
- const {
1675
- ownerDocument: N
1676
- } = x;
1677
- if (this.props.disabled || !(g.target instanceof N.defaultView.Node) || this.props.handle && !(0, r.matchesSelectorAndParentsTo)(g.target, this.props.handle, x) || this.props.cancel && (0, r.matchesSelectorAndParentsTo)(g.target, this.props.cancel, x))
1678
- return;
1679
- g.type === "touchstart" && !this.props.allowMobileScroll && g.preventDefault();
1680
- const S = (0, r.getTouchIdentifier)(g);
1681
- this.touchIdentifier = S;
1682
- const D = (0, d.getControlPosition)(g, S, this);
1683
- if (D == null) return;
1684
- const {
1685
- x: a,
1686
- y: P
1687
- } = D, i = (0, d.createCoreData)(this, a, P);
1688
- (0, c.default)("DraggableCore: handleDragStart: %j", i), (0, c.default)("calling", this.props.onStart), !(this.props.onStart(g, i) === !1 || this.mounted === !1) && (this.props.enableUserSelectHack && (0, r.addUserSelectStyles)(N), this.dragging = !0, this.lastX = a, this.lastY = P, (0, r.addEvent)(N, p.move, this.handleDrag), (0, r.addEvent)(N, p.stop, this.handleDragStop));
1689
- }), b(this, "handleDrag", (g) => {
1690
- const x = (0, d.getControlPosition)(g, this.touchIdentifier, this);
1691
- if (x == null) return;
1692
- let {
1693
- x: N,
1694
- y: S
1695
- } = x;
1696
- if (Array.isArray(this.props.grid)) {
1697
- let P = N - this.lastX, i = S - this.lastY;
1698
- if ([P, i] = (0, d.snapToGrid)(this.props.grid, P, i), !P && !i) return;
1699
- N = this.lastX + P, S = this.lastY + i;
1700
- }
1701
- const D = (0, d.createCoreData)(this, N, S);
1702
- if ((0, c.default)("DraggableCore: handleDrag: %j", D), this.props.onDrag(g, D) === !1 || this.mounted === !1) {
1703
- try {
1704
- this.handleDragStop(new MouseEvent("mouseup"));
1705
- } catch {
1706
- const i = document.createEvent("MouseEvents");
1707
- i.initMouseEvent("mouseup", !0, !0, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), this.handleDragStop(i);
1708
- }
1709
- return;
1710
- }
1711
- this.lastX = N, this.lastY = S;
1712
- }), b(this, "handleDragStop", (g) => {
1713
- if (!this.dragging) return;
1714
- const x = (0, d.getControlPosition)(g, this.touchIdentifier, this);
1715
- if (x == null) return;
1716
- let {
1717
- x: N,
1718
- y: S
1719
- } = x;
1720
- if (Array.isArray(this.props.grid)) {
1721
- let i = N - this.lastX || 0, u = S - this.lastY || 0;
1722
- [i, u] = (0, d.snapToGrid)(this.props.grid, i, u), N = this.lastX + i, S = this.lastY + u;
1723
- }
1724
- const D = (0, d.createCoreData)(this, N, S);
1725
- if (this.props.onStop(g, D) === !1 || this.mounted === !1) return !1;
1726
- const P = this.findDOMNode();
1727
- P && this.props.enableUserSelectHack && (0, r.scheduleRemoveUserSelectStyles)(P.ownerDocument), (0, c.default)("DraggableCore: handleDragStop: %j", D), this.dragging = !1, this.lastX = NaN, this.lastY = NaN, P && ((0, c.default)("DraggableCore: Removing handlers"), (0, r.removeEvent)(P.ownerDocument, p.move, this.handleDrag), (0, r.removeEvent)(P.ownerDocument, p.stop, this.handleDragStop));
1728
- }), b(this, "onMouseDown", (g) => (p = y.mouse, this.handleDragStart(g))), b(this, "onMouseUp", (g) => (p = y.mouse, this.handleDragStop(g))), b(this, "onTouchStart", (g) => (p = y.touch, this.handleDragStart(g))), b(this, "onTouchEnd", (g) => (p = y.touch, this.handleDragStop(g)));
1729
- }
1730
- componentDidMount() {
1731
- this.mounted = !0;
1732
- const g = this.findDOMNode();
1733
- g && (0, r.addEvent)(g, y.touch.start, this.onTouchStart, {
1734
- passive: !1
1735
- });
1736
- }
1737
- componentWillUnmount() {
1738
- this.mounted = !1;
1739
- const g = this.findDOMNode();
1740
- if (g) {
1741
- const {
1742
- ownerDocument: x
1743
- } = g;
1744
- (0, r.removeEvent)(x, y.mouse.move, this.handleDrag), (0, r.removeEvent)(x, y.touch.move, this.handleDrag), (0, r.removeEvent)(x, y.mouse.stop, this.handleDragStop), (0, r.removeEvent)(x, y.touch.stop, this.handleDragStop), (0, r.removeEvent)(g, y.touch.start, this.onTouchStart, {
1745
- passive: !1
1746
- }), this.props.enableUserSelectHack && (0, r.scheduleRemoveUserSelectStyles)(x);
1747
- }
1748
- }
1749
- // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
1750
- // the underlying DOM node ourselves. See the README for more information.
1751
- findDOMNode() {
1752
- return this.props?.nodeRef ? this.props?.nodeRef?.current : n.default.findDOMNode(this);
1753
- }
1754
- render() {
1755
- return /* @__PURE__ */ e.cloneElement(e.Children.only(this.props.children), {
1756
- // Note: mouseMove handler is attached to document so it will still function
1757
- // when the user drags quickly and leaves the bounds of the element.
1758
- onMouseDown: this.onMouseDown,
1759
- onMouseUp: this.onMouseUp,
1760
- // onTouchStart is added on `componentDidMount` so they can be added with
1761
- // {passive: false}, which allows it to cancel. See
1762
- // https://developers.google.com/web/updates/2017/01/scrolling-intervention
1763
- onTouchEnd: this.onTouchEnd
1764
- });
1765
- }
1766
- };
1767
- return ue.default = T, b(T, "displayName", "DraggableCore"), b(T, "propTypes", {
1768
- /**
1769
- * `allowAnyClick` allows dragging using any mouse button.
1770
- * By default, we only accept the left button.
1771
- *
1772
- * Defaults to `false`.
1773
- */
1774
- allowAnyClick: s.default.bool,
1775
- /**
1776
- * `allowMobileScroll` turns off cancellation of the 'touchstart' event
1777
- * on mobile devices. Only enable this if you are having trouble with click
1778
- * events. Prefer using 'handle' / 'cancel' instead.
1779
- *
1780
- * Defaults to `false`.
1781
- */
1782
- allowMobileScroll: s.default.bool,
1783
- children: s.default.node.isRequired,
1784
- /**
1785
- * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
1786
- * with the exception of `onMouseDown`, will not fire.
1787
- */
1788
- disabled: s.default.bool,
1789
- /**
1790
- * By default, we add 'user-select:none' attributes to the document body
1791
- * to prevent ugly text selection during drag. If this is causing problems
1792
- * for your app, set this to `false`.
1793
- */
1794
- enableUserSelectHack: s.default.bool,
1795
- /**
1796
- * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
1797
- * instead of using the parent node.
1798
- */
1799
- offsetParent: function(h, g) {
1800
- if (h[g] && h[g].nodeType !== 1)
1801
- throw new Error("Draggable's offsetParent must be a DOM Node.");
1802
- },
1803
- /**
1804
- * `grid` specifies the x and y that dragging should snap to.
1805
- */
1806
- grid: s.default.arrayOf(s.default.number),
1807
- /**
1808
- * `handle` specifies a selector to be used as the handle that initiates drag.
1809
- *
1810
- * Example:
1811
- *
1812
- * ```jsx
1813
- * let App = React.createClass({
1814
- * render: function () {
1815
- * return (
1816
- * <Draggable handle=".handle">
1817
- * <div>
1818
- * <div className="handle">Click me to drag</div>
1819
- * <div>This is some other content</div>
1820
- * </div>
1821
- * </Draggable>
1822
- * );
1823
- * }
1824
- * });
1825
- * ```
1826
- */
1827
- handle: s.default.string,
1828
- /**
1829
- * `cancel` specifies a selector to be used to prevent drag initialization.
1830
- *
1831
- * Example:
1832
- *
1833
- * ```jsx
1834
- * let App = React.createClass({
1835
- * render: function () {
1836
- * return(
1837
- * <Draggable cancel=".cancel">
1838
- * <div>
1839
- * <div className="cancel">You can't drag from here</div>
1840
- * <div>Dragging here works fine</div>
1841
- * </div>
1842
- * </Draggable>
1843
- * );
1844
- * }
1845
- * });
1846
- * ```
1847
- */
1848
- cancel: s.default.string,
1849
- /* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
1850
- * Unfortunately, in order for <Draggable> to work properly, we need raw access
1851
- * to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
1852
- * as in this example:
1853
- *
1854
- * function MyComponent() {
1855
- * const nodeRef = React.useRef(null);
1856
- * return (
1857
- * <Draggable nodeRef={nodeRef}>
1858
- * <div ref={nodeRef}>Example Target</div>
1859
- * </Draggable>
1860
- * );
1861
- * }
1862
- *
1863
- * This can be used for arbitrarily nested components, so long as the ref ends up
1864
- * pointing to the actual child DOM node and not a custom component.
1865
- */
1866
- nodeRef: s.default.object,
1867
- /**
1868
- * Called when dragging starts.
1869
- * If this function returns the boolean false, dragging will be canceled.
1870
- */
1871
- onStart: s.default.func,
1872
- /**
1873
- * Called while dragging.
1874
- * If this function returns the boolean false, dragging will be canceled.
1875
- */
1876
- onDrag: s.default.func,
1877
- /**
1878
- * Called when dragging stops.
1879
- * If this function returns the boolean false, the drag will remain active.
1880
- */
1881
- onStop: s.default.func,
1882
- /**
1883
- * A workaround option which can be passed if onMouseDown needs to be accessed,
1884
- * since it'll always be blocked (as there is internal use of onMouseDown)
1885
- */
1886
- onMouseDown: s.default.func,
1887
- /**
1888
- * `scale`, if set, applies scaling while dragging an element
1889
- */
1890
- scale: s.default.number,
1891
- /**
1892
- * These properties should be defined on the child, not here.
1893
- */
1894
- className: o.dontSetMe,
1895
- style: o.dontSetMe,
1896
- transform: o.dontSetMe
1897
- }), b(T, "defaultProps", {
1898
- allowAnyClick: !1,
1899
- // by default only accept left click
1900
- allowMobileScroll: !1,
1901
- disabled: !1,
1902
- enableUserSelectHack: !0,
1903
- onStart: function() {
1904
- },
1905
- onDrag: function() {
1906
- },
1907
- onStop: function() {
1908
- },
1909
- onMouseDown: function() {
1910
- },
1911
- scale: 1
1912
- }), ue;
1913
- }
1914
- var nt;
1915
- function Xt() {
1916
- return nt || (nt = 1, (function(e) {
1917
- Object.defineProperty(e, "__esModule", {
1918
- value: !0
1919
- }), Object.defineProperty(e, "DraggableCore", {
1920
- enumerable: !0,
1921
- get: function() {
1922
- return w.default;
1923
- }
1924
- }), e.default = void 0;
1925
- var s = l(xe), n = v(/* @__PURE__ */ pt()), r = v(st), d = Bt(), o = We(), c = yt(), f = Ce(), w = v(Vt()), b = v(bt());
1926
- function v(x) {
1927
- return x && x.__esModule ? x : { default: x };
1928
- }
1929
- function l(x, N) {
1930
- if (typeof WeakMap == "function") var S = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap();
1931
- return (l = function(a, P) {
1932
- if (!P && a && a.__esModule) return a;
1933
- var i, u, M = { __proto__: null, default: a };
1934
- if (a === null || typeof a != "object" && typeof a != "function") return M;
1935
- if (i = P ? D : S) {
1936
- if (i.has(a)) return i.get(a);
1937
- i.set(a, M);
1938
- }
1939
- for (const $ in a) $ !== "default" && {}.hasOwnProperty.call(a, $) && ((u = (i = Object.defineProperty) && Object.getOwnPropertyDescriptor(a, $)) && (u.get || u.set) ? i(M, $, u) : M[$] = a[$]);
1940
- return M;
1941
- })(x, N);
1942
- }
1943
- function y() {
1944
- return y = Object.assign ? Object.assign.bind() : function(x) {
1945
- for (var N = 1; N < arguments.length; N++) {
1946
- var S = arguments[N];
1947
- for (var D in S) ({}).hasOwnProperty.call(S, D) && (x[D] = S[D]);
1948
- }
1949
- return x;
1950
- }, y.apply(null, arguments);
1951
- }
1952
- function p(x, N, S) {
1953
- return (N = T(N)) in x ? Object.defineProperty(x, N, { value: S, enumerable: !0, configurable: !0, writable: !0 }) : x[N] = S, x;
1954
- }
1955
- function T(x) {
1956
- var N = h(x, "string");
1957
- return typeof N == "symbol" ? N : N + "";
1958
- }
1959
- function h(x, N) {
1960
- if (typeof x != "object" || !x) return x;
1961
- var S = x[Symbol.toPrimitive];
1962
- if (S !== void 0) {
1963
- var D = S.call(x, N);
1964
- if (typeof D != "object") return D;
1965
- throw new TypeError("@@toPrimitive must return a primitive value.");
1966
- }
1967
- return (N === "string" ? String : Number)(x);
1968
- }
1969
- class g extends s.Component {
1970
- // React 16.3+
1971
- // Arity (props, state)
1972
- static getDerivedStateFromProps(N, S) {
1973
- let {
1974
- position: D
1975
- } = N, {
1976
- prevPropsPosition: a
1977
- } = S;
1978
- return D && (!a || D.x !== a.x || D.y !== a.y) ? ((0, b.default)("Draggable: getDerivedStateFromProps %j", {
1979
- position: D,
1980
- prevPropsPosition: a
1981
- }), {
1982
- x: D.x,
1983
- y: D.y,
1984
- prevPropsPosition: {
1985
- ...D
1986
- }
1987
- }) : null;
1988
- }
1989
- constructor(N) {
1990
- super(N), p(this, "onDragStart", (S, D) => {
1991
- if ((0, b.default)("Draggable: onDragStart: %j", D), this.props.onStart(S, (0, c.createDraggableData)(this, D)) === !1) return !1;
1992
- this.setState({
1993
- dragging: !0,
1994
- dragged: !0
1995
- });
1996
- }), p(this, "onDrag", (S, D) => {
1997
- if (!this.state.dragging) return !1;
1998
- (0, b.default)("Draggable: onDrag: %j", D);
1999
- const a = (0, c.createDraggableData)(this, D), P = {
2000
- x: a.x,
2001
- y: a.y,
2002
- slackX: 0,
2003
- slackY: 0
2004
- };
2005
- if (this.props.bounds) {
2006
- const {
2007
- x: u,
2008
- y: M
2009
- } = P;
2010
- P.x += this.state.slackX, P.y += this.state.slackY;
2011
- const [$, R] = (0, c.getBoundPosition)(this, P.x, P.y);
2012
- P.x = $, P.y = R, P.slackX = this.state.slackX + (u - P.x), P.slackY = this.state.slackY + (M - P.y), a.x = P.x, a.y = P.y, a.deltaX = P.x - this.state.x, a.deltaY = P.y - this.state.y;
2013
- }
2014
- if (this.props.onDrag(S, a) === !1) return !1;
2015
- this.setState(P);
2016
- }), p(this, "onDragStop", (S, D) => {
2017
- if (!this.state.dragging || this.props.onStop(S, (0, c.createDraggableData)(this, D)) === !1) return !1;
2018
- (0, b.default)("Draggable: onDragStop: %j", D);
2019
- const P = {
2020
- dragging: !1,
2021
- slackX: 0,
2022
- slackY: 0
2023
- };
2024
- if (!!this.props.position) {
2025
- const {
2026
- x: u,
2027
- y: M
2028
- } = this.props.position;
2029
- P.x = u, P.y = M;
2030
- }
2031
- this.setState(P);
2032
- }), this.state = {
2033
- // Whether or not we are currently dragging.
2034
- dragging: !1,
2035
- // Whether or not we have been dragged before.
2036
- dragged: !1,
2037
- // Current transform x and y.
2038
- x: N.position ? N.position.x : N.defaultPosition.x,
2039
- y: N.position ? N.position.y : N.defaultPosition.y,
2040
- prevPropsPosition: {
2041
- ...N.position
2042
- },
2043
- // Used for compensating for out-of-bounds drags
2044
- slackX: 0,
2045
- slackY: 0,
2046
- // Can only determine if SVG after mounting
2047
- isElementSVG: !1
2048
- }, N.position && !(N.onDrag || N.onStop) && console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.");
2049
- }
2050
- componentDidMount() {
2051
- typeof window.SVGElement < "u" && this.findDOMNode() instanceof window.SVGElement && this.setState({
2052
- isElementSVG: !0
2053
- });
2054
- }
2055
- componentWillUnmount() {
2056
- this.state.dragging && this.setState({
2057
- dragging: !1
2058
- });
2059
- }
2060
- // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
2061
- // the underlying DOM node ourselves. See the README for more information.
2062
- findDOMNode() {
2063
- return this.props?.nodeRef?.current ?? r.default.findDOMNode(this);
2064
- }
2065
- render() {
2066
- const {
2067
- axis: N,
2068
- bounds: S,
2069
- children: D,
2070
- defaultPosition: a,
2071
- defaultClassName: P,
2072
- defaultClassNameDragging: i,
2073
- defaultClassNameDragged: u,
2074
- position: M,
2075
- positionOffset: $,
2076
- scale: R,
2077
- ...V
2078
- } = this.props;
2079
- let G = {}, X = null;
2080
- const m = !!!M || this.state.dragging, B = M || a, te = {
2081
- // Set left if horizontal drag is enabled
2082
- x: (0, c.canDragX)(this) && m ? this.state.x : B.x,
2083
- // Set top if vertical drag is enabled
2084
- y: (0, c.canDragY)(this) && m ? this.state.y : B.y
2085
- };
2086
- this.state.isElementSVG ? X = (0, o.createSVGTransform)(te, $) : G = (0, o.createCSSTransform)(te, $);
2087
- const le = (0, d.clsx)(D.props.className || "", P, {
2088
- [i]: this.state.dragging,
2089
- [u]: this.state.dragged
2090
- });
2091
- return /* @__PURE__ */ s.createElement(w.default, y({}, V, {
2092
- onStart: this.onDragStart,
2093
- onDrag: this.onDrag,
2094
- onStop: this.onDragStop
2095
- }), /* @__PURE__ */ s.cloneElement(s.Children.only(D), {
2096
- className: le,
2097
- style: {
2098
- ...D.props.style,
2099
- ...G
2100
- },
2101
- transform: X
2102
- }));
2103
- }
2104
- }
2105
- e.default = g, p(g, "displayName", "Draggable"), p(g, "propTypes", {
2106
- // Accepts all props <DraggableCore> accepts.
2107
- ...w.default.propTypes,
2108
- /**
2109
- * `axis` determines which axis the draggable can move.
2110
- *
2111
- * Note that all callbacks will still return data as normal. This only
2112
- * controls flushing to the DOM.
2113
- *
2114
- * 'both' allows movement horizontally and vertically.
2115
- * 'x' limits movement to horizontal axis.
2116
- * 'y' limits movement to vertical axis.
2117
- * 'none' limits all movement.
2118
- *
2119
- * Defaults to 'both'.
2120
- */
2121
- axis: n.default.oneOf(["both", "x", "y", "none"]),
2122
- /**
2123
- * `bounds` determines the range of movement available to the element.
2124
- * Available values are:
2125
- *
2126
- * 'parent' restricts movement within the Draggable's parent node.
2127
- *
2128
- * Alternatively, pass an object with the following properties, all of which are optional:
2129
- *
2130
- * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
2131
- *
2132
- * All values are in px.
2133
- *
2134
- * Example:
2135
- *
2136
- * ```jsx
2137
- * let App = React.createClass({
2138
- * render: function () {
2139
- * return (
2140
- * <Draggable bounds={{right: 300, bottom: 300}}>
2141
- * <div>Content</div>
2142
- * </Draggable>
2143
- * );
2144
- * }
2145
- * });
2146
- * ```
2147
- */
2148
- bounds: n.default.oneOfType([n.default.shape({
2149
- left: n.default.number,
2150
- right: n.default.number,
2151
- top: n.default.number,
2152
- bottom: n.default.number
2153
- }), n.default.string, n.default.oneOf([!1])]),
2154
- defaultClassName: n.default.string,
2155
- defaultClassNameDragging: n.default.string,
2156
- defaultClassNameDragged: n.default.string,
2157
- /**
2158
- * `defaultPosition` specifies the x and y that the dragged item should start at
2159
- *
2160
- * Example:
2161
- *
2162
- * ```jsx
2163
- * let App = React.createClass({
2164
- * render: function () {
2165
- * return (
2166
- * <Draggable defaultPosition={{x: 25, y: 25}}>
2167
- * <div>I start with transformX: 25px and transformY: 25px;</div>
2168
- * </Draggable>
2169
- * );
2170
- * }
2171
- * });
2172
- * ```
2173
- */
2174
- defaultPosition: n.default.shape({
2175
- x: n.default.number,
2176
- y: n.default.number
2177
- }),
2178
- positionOffset: n.default.shape({
2179
- x: n.default.oneOfType([n.default.number, n.default.string]),
2180
- y: n.default.oneOfType([n.default.number, n.default.string])
2181
- }),
2182
- /**
2183
- * `position`, if present, defines the current position of the element.
2184
- *
2185
- * This is similar to how form elements in React work - if no `position` is supplied, the component
2186
- * is uncontrolled.
2187
- *
2188
- * Example:
2189
- *
2190
- * ```jsx
2191
- * let App = React.createClass({
2192
- * render: function () {
2193
- * return (
2194
- * <Draggable position={{x: 25, y: 25}}>
2195
- * <div>I start with transformX: 25px and transformY: 25px;</div>
2196
- * </Draggable>
2197
- * );
2198
- * }
2199
- * });
2200
- * ```
2201
- */
2202
- position: n.default.shape({
2203
- x: n.default.number,
2204
- y: n.default.number
2205
- }),
2206
- /**
2207
- * These properties should be defined on the child, not here.
2208
- */
2209
- className: f.dontSetMe,
2210
- style: f.dontSetMe,
2211
- transform: f.dontSetMe
2212
- }), p(g, "defaultProps", {
2213
- ...w.default.defaultProps,
2214
- axis: "both",
2215
- bounds: !1,
2216
- defaultClassName: "react-draggable",
2217
- defaultClassNameDragging: "react-draggable-dragging",
2218
- defaultClassNameDragged: "react-draggable-dragged",
2219
- defaultPosition: {
2220
- x: 0,
2221
- y: 0
2222
- },
2223
- scale: 1
2224
- });
2225
- })(De)), De;
2226
- }
2227
- var rt;
2228
- function Gt() {
2229
- if (rt) return de.exports;
2230
- rt = 1;
2231
- const {
2232
- default: e,
2233
- DraggableCore: s
2234
- } = Xt();
2235
- return de.exports = e, de.exports.default = e, de.exports.DraggableCore = s, de.exports;
2236
- }
2237
- var Zt = Gt();
2238
- const Jt = /* @__PURE__ */ Lt(Zt), Qt = se((e, s) => {
2239
- const d = {
2240
- ...{
2241
- // 1. Take it out of the document flow
2242
- position: "fixed",
2243
- // 2. Set initial viewport position (e.g., top right)
2244
- top: "6rem",
2245
- right: "1rem",
2246
- // 3. Ensure it stacks above other content
2247
- zIndex: typeof e.zIndex < "u" ? Number(e.zIndex) : 99999,
2248
- // Add your layout/appearance styles
2249
- width: "360px",
2250
- minHeight: "360px",
2251
- borderStyle: "solid",
2252
- borderWidth: "3px",
2253
- boxShadow: "rgba(0, 0, 0, 0.5) 7px 7px 10px 0px"
2254
- },
2255
- ...e.style || {}
2256
- }, o = e.testId || "not-set", c = e.className || "panel", f = at(null);
2257
- return (
2258
- // 3. Pass the internal ref to the Draggable component via 'nodeRef'
2259
- /* @__PURE__ */ t(
2260
- Jt,
2261
- {
2262
- nodeRef: f,
2263
- "data-testid": o,
2264
- axis: "both",
2265
- handle: ".handle",
2266
- onStart: (v, l) => {
2267
- e.onDraggingChange?.(!0);
2268
- },
2269
- onStop: (v, l) => {
2270
- setTimeout(() => {
2271
- e.onDraggingChange?.(!1);
2272
- }, 100);
2273
- },
2274
- children: /* @__PURE__ */ t("div", { ref: f, className: c, style: d, children: e.children })
2275
- }
2276
- )
2277
- );
2278
- });
2279
- function $n({ children: e, addCssClasses: s }) {
2280
- const n = Z(
2281
- "w-full h-full flex-1 flex flex-col",
2282
- (s || "gap-2 items-end justify-end content-end").trim()
2283
- );
2284
- return /* @__PURE__ */ t(
2285
- "div",
2286
- {
2287
- className: n,
2288
- style: {
2289
- minHeight: "140px"
2290
- },
2291
- children: e
2292
- }
2293
- );
2294
- }
2295
- function Rn({ children: e, addCssClasses: s }) {
2296
- const n = Z(
2297
- "w-full flex flex-col",
2298
- (s || "items-end").trim()
2299
- );
2300
- return /* @__PURE__ */ t("div", { className: n, children: e });
2301
- }
2302
- const On = (e) => {
2303
- console.warn("showToast TODO", e);
2304
- }, en = (e) => e < 0.8 ? 1 : e <= 1 ? 0 : e > 1 ? -1 : 0, kn = se((e, s) => {
2305
- let n = xt(Number(e.zoomScale || 0));
2306
- const r = e.responsiveGrid || !1, d = e.isEditing || !1, o = {
2307
- "--bwj-dashboard-transform-scale": n,
2308
- "--bwj-dashboard-add-cols": en(n)
2309
- }, c = Z(
2310
- "dashboard-main-grid w-full",
2311
- d ? "editing" : "",
2312
- r ? "responsive-grid" : "",
2313
- `border border-dashed ${d ? "border-primary border-opacity-50" : "border-transparent"}`
2314
- );
2315
- return /* @__PURE__ */ t("div", { className: c, style: o, children: e.children });
2316
- }), Ie = "size-5", tn = (e) => {
2317
- if ((e.overrideCssClasses || "").trim().length > 0)
2318
- return (e.overrideCssClasses || "").trim();
2319
- const s = e.direction || "column", n = e.noBorder;
2320
- let r = `dashboard-widget direction-${s} ${e.isEditing ? "editing" : ""} border border-solid`;
2321
- return ["large", "xlarge"].indexOf(e.size || "") > -1 && (r = `${r} ${e.size}-widget`), n ? r = `${r} border-transparent border-opacity-0` : (e.borderCssClasses || "").trim().length > 0 ? r = `${r} ${e.borderCssClasses}` : r = `${r} border-card-invert border-opacity-20`, e.noShadow && (r = `${r} no-shadow`), e.noPadding && (r = `${r} no-padding p-0`), (e.backgroundCssClasses || "").trim().length > 0 ? r = `${r} ${e.backgroundCssClasses}`.trim() : r = `${r} bg-card content-card`, (e.addCssClasses || "").trim().length > 0 && (r = `${r} ${e.addCssClasses}`.trim()), r;
2322
- }, nn = (e, s) => {
2323
- const n = e.hideTitle && !e.isEditing, r = Z(tn(e)), d = () => {
2324
- e.onRemoveClick && e.widgetKey && e.onRemoveClick(e.widgetKey, e.parentWidgetKey);
2325
- }, o = (f) => {
2326
- e.onMoveClick && e.widgetKey && e.onMoveClick(f, e.widgetKey, e.parentWidgetKey);
2327
- }, c = Z(
2328
- "widget-header",
2329
- n ? "hidden" : "flex items-center justify-between border-b border-solid border-card-invert",
2330
- n ? "border-opacity-0" : "border-opacity-20"
2331
- );
2332
- return /* @__PURE__ */ _("div", { className: r, children: [
2333
- /* @__PURE__ */ _("div", { className: c, children: [
2334
- /* @__PURE__ */ _("div", { className: "widget-title-wrapper w-full flex flex-row gap-2 items-center justify-between", children: [
2335
- /* @__PURE__ */ _("h2", { className: "widget-title", children: [
2336
- e.title,
2337
- " "
2338
- ] }),
2339
- /* @__PURE__ */ t("div", {})
2340
- ] }),
2341
- /* @__PURE__ */ t("div", { "data-testid": "collapse-and-other-actions", children: /* @__PURE__ */ _("div", { className: "actions-inner", children: [
2342
- /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t("span", { className: "hidden", children: "Widget" }) }),
2343
- /* @__PURE__ */ _("div", { className: "actions-buttons-container", children: [
2344
- /* @__PURE__ */ t(
2345
- ee,
2346
- {
2347
- "data-testid": `move-widget-left_${e.title}`,
2348
- isIconButton: !0,
2349
- disabled: e.index < 1,
2350
- tooltip: {
2351
- placement: "top",
2352
- title: `${e.index < 1 ? "Already at min position" : "Move Widget to the left/up"}`
2353
- },
2354
- onClick: () => o(-1),
2355
- children: /* @__PURE__ */ t(ct, { className: Ie })
2356
- }
2357
- ),
2358
- /* @__PURE__ */ t(
2359
- ee,
2360
- {
2361
- "data-testid": `move-widget-right_${e.title}`,
2362
- isIconButton: !0,
2363
- disabled: e.index >= e.maxIndex,
2364
- tooltip: {
2365
- placement: "top",
2366
- title: `${e.index >= e.maxIndex ? "Already at max position" : "Move Widget to the right/down"}`
2367
- },
2368
- onClick: () => o(1),
2369
- children: /* @__PURE__ */ t(dt, { className: Ie })
2370
- }
2371
- ),
2372
- /* @__PURE__ */ t(
2373
- ee,
2374
- {
2375
- "data-testid": `remove-container_${e.title}`,
2376
- isIconButton: !0,
2377
- tooltip: {
2378
- placement: "top",
2379
- title: "Remove Widget"
2380
- },
2381
- onClick: () => d(),
2382
- children: /* @__PURE__ */ t(ut, { className: Ie })
2383
- }
2384
- )
2385
- ] })
2386
- ] }) })
2387
- ] }),
2388
- /* @__PURE__ */ t("div", { className: "widget-inner", children: e.children })
2389
- ] });
2390
- }, rn = se(nn);
2391
- function ot(e) {
2392
- const { widgetKey: s, parentWidgetKey: n, index: r, maxIndex: d, isEditing: o, onRemoveClick: c, onMoveClick: f } = e, w = e.extraProps;
2393
- return /* @__PURE__ */ t(
2394
- rn,
2395
- {
2396
- widgetKey: s,
2397
- title: "Widget Error",
2398
- parentWidgetKey: n,
2399
- index: r,
2400
- maxIndex: d,
2401
- isEditing: o,
2402
- onRemoveClick: c,
2403
- onMoveClick: f,
2404
- children: /* @__PURE__ */ _("div", { className: "p-4 border border-dashed border-danger", children: [
2405
- /* @__PURE__ */ _("span", { className: "font-bold", children: [
2406
- 'Failed to load "',
2407
- s,
2408
- '"'
2409
- ] }),
2410
- w?.versionMismatch && /* @__PURE__ */ _("div", { className: "flex flex-col", children: [
2411
- /* @__PURE__ */ _("span", { className: "font-bold text-sm", children: [
2412
- "Version Mismatch: ",
2413
- s
2414
- ] }),
2415
- /* @__PURE__ */ _("div", { className: "flex flex-col text-xs", children: [
2416
- /* @__PURE__ */ _("span", { children: [
2417
- "Widget requires: Vue ",
2418
- w?.requiredVer,
2419
- "."
2420
- ] }),
2421
- /* @__PURE__ */ _("span", { children: [
2422
- "Host version: ",
2423
- w?.hostVer,
2424
- "."
2425
- ] })
2426
- ] }),
2427
- /* @__PURE__ */ _("div", { className: "flex flex-col mt-3", children: [
2428
- /* @__PURE__ */ t("h5", { children: "Externals:" }),
2429
- /* @__PURE__ */ t("dl", { className: "ml-2 flex flex-col text-xs", children: w?.externalDependencies.map((b, v) => /* @__PURE__ */ _("dd", { children: [
2430
- "- ",
2431
- b
2432
- ] }, `dep-${v}`)) })
2433
- ] })
2434
- ] }),
2435
- !w?.versionMismatch && /* @__PURE__ */ _("div", { className: "flex flex-col", children: [
2436
- /* @__PURE__ */ t("div", { className: "flex flex-col text-xs italic", children: /* @__PURE__ */ t("span", { children: "The remote plugin is unavailable." }) }),
2437
- /* @__PURE__ */ t("span", { className: "font-bold text-sm", children: "Error Details:" }),
2438
- /* @__PURE__ */ _("div", { className: "flex flex-col mt-3", children: [
2439
- /* @__PURE__ */ t("h5", { children: "Details:" }),
2440
- /* @__PURE__ */ t("div", { className: "text-xs break-all", children: w?.errorMessage || "Unknown error occurred." })
2441
- ] })
2442
- ] })
2443
- ] })
2444
- }
2445
- );
2446
- }
2447
- const on = (e, s) => {
2448
- const n = (o) => o.replace(/[^0-9.]/g, ""), r = n(e).split(".").map(Number), d = n(s).split(".").map(Number);
2449
- return !(r[0] !== d[0] || r[1] < d[1]);
2450
- };
2451
- function an(e) {
2452
- return /* @__PURE__ */ t("div", { className: "dashboard-widget", children: /* @__PURE__ */ _("div", { className: "absolute inset-0 bg-black flex flex-col items-center justify-center text-center", children: [
2453
- /* @__PURE__ */ t("div", { className: "w-full absolute opacity-100 text-primary", children: e.title }),
2454
- /* @__PURE__ */ t("div", { className: "animate-ping rounded-full h-32 w-32 border-8 border-white" })
2455
- ] }) });
2456
- }
2457
- function sn({
2458
- index: e,
2459
- maxIndex: s,
2460
- widgetKey: n,
2461
- parentWidgetKey: r,
2462
- targetContainerKey: d,
2463
- childWidgetsConfig: o,
2464
- widgetCatalog: c,
2465
- isEditing: f,
2466
- // for additional props passed to all widget from the dashboard through the DynamicWidgetLoader:
2467
- extraProps: w,
2468
- onRemoveClick: b,
2469
- onMoveClick: v,
2470
- selectContainer: l
2471
- }) {
2472
- const y = `${n}`.split("_"), p = y.length > 1, T = p ? y[0] : n, h = c.get(T);
2473
- if (!h)
2474
- return /* @__PURE__ */ t("div", { className: "flex", children: /* @__PURE__ */ _("p", { children: [
2475
- "Widget not found in catalog: ",
2476
- T
2477
- ] }) });
2478
- let g = null, x = !1;
2479
- const N = !!h.isContainer, S = p ? it(n) : "", D = N ? (o || []).filter((i) => i.parentWidgetKey === n) : [], a = {
2480
- index: e,
2481
- maxIndex: s,
2482
- widgetKey: n,
2483
- parentWidgetKey: r,
2484
- isEditing: f,
2485
- extraProps: w,
2486
- title: p ? S : h.title,
2487
- onRemoveClick: b,
2488
- onMoveClick: v
2489
- };
2490
- if (h.component ? (g = h.component, x = !1) : h.loader && (x = !0, g = fe(() => {
2491
- if (!h) return null;
2492
- const i = typeof __HOST_REACT_VERSION__ < "u" ? __HOST_REACT_VERSION__ : "19.2.3", u = h.meta?.externalDependencies || [], M = u.find(($) => $.startsWith("react@"));
2493
- if (M) {
2494
- const $ = M.split("@")[1];
2495
- if (!on(i, $)) {
2496
- const R = {
2497
- ...a.extraProps,
2498
- hostVer: i,
2499
- requiredVer: $,
2500
- externalDependencies: u,
2501
- errorMessage: `Incompatible React version. Required: ${$}, Host: ${i}`,
2502
- versionMismatch: !0
2503
- };
2504
- return a.extraProps = {
2505
- ...a.extraProps,
2506
- ...R
2507
- }, xe.lazy(async () => ({
2508
- default: () => /* @__PURE__ */ t(ot, { ...a })
2509
- }));
2510
- }
2511
- }
2512
- if (h.component)
2513
- return h.component;
2514
- if (h.loader) {
2515
- const $ = async () => {
2516
- try {
2517
- return await h.loader();
2518
- } catch (R) {
2519
- console.error(`Widget Load Error [${n}]:`, R);
2520
- const V = {
2521
- ...a.extraProps,
2522
- hostVer: i,
2523
- requiredVer: M ? M.split("@")[1] : "Unknown",
2524
- externalDependencies: u,
2525
- errorMessage: R.message,
2526
- versionMismatch: !1
2527
- };
2528
- return a.extraProps = {
2529
- ...a.extraProps,
2530
- ...V
2531
- }, {
2532
- default: () => /* @__PURE__ */ t(ot, { ...a })
2533
- };
2534
- }
2535
- };
2536
- return xe.lazy($);
2537
- }
2538
- return null;
2539
- }, [h, n])), !g)
2540
- return /* @__PURE__ */ t("div", { className: "flex", children: /* @__PURE__ */ _("p", { children: [
2541
- "Widget definition incomplete: ",
2542
- T
2543
- ] }) });
2544
- const P = N ? {
2545
- highlight: d === n,
2546
- selectContainer: l,
2547
- // The children prop is the recursive call back to DynamicWidgetLoader
2548
- children: D.map((i, u) => /* @__PURE__ */ t(
2549
- sn,
2550
- {
2551
- index: u,
2552
- maxIndex: D.length - 1,
2553
- widgetKey: i.widgetKey,
2554
- parentWidgetKey: i.parentWidgetKey,
2555
- widgetCatalog: c,
2556
- isEditing: f,
2557
- extraProps: w,
2558
- onRemoveClick: b,
2559
- onMoveClick: v
2560
- },
2561
- `${i.widgetKey}_${u}`
2562
- ))
2563
- } : {};
2564
- return x ? /* @__PURE__ */ t(St, { fallback: /* @__PURE__ */ t(an, { title: `Loading ${h.title}` }), children: /* @__PURE__ */ t(g, { ...a, ...P }) }) : /* @__PURE__ */ t(g, { ...a, ...P });
2565
- }
2566
- const ve = "size-5";
2567
- function je(e) {
2568
- const s = e.highlight || !1, n = e.direction || "column", r = e.children.length > 0, d = e.isEditing || !1;
2569
- let f = s ? "border-transparent" : d && !r ? "border-card-invert" : "border-transparent";
2570
- const w = ["large", "xlarge"].includes(e.size || "");
2571
- let b = "";
2572
- ["large", "xlarge"].indexOf(e.size || "") > -1 && (b = `${e.size}-widget`);
2573
- let v = "";
2574
- n === "row" && !r ? v = "min-h-48" : n === "column" && !r && (v = "min-h-96");
2575
- let l = Z(
2576
- "dashboard-widget-container relative ",
2577
- r ? "" : "has-no-children",
2578
- d ? "editing" : "",
2579
- v,
2580
- b,
2581
- w ? "widget-container-grid" : "widget-container-flex",
2582
- `direction-${n}`,
2583
- `border ${f}`,
2584
- `${s ? "highlight-container" : ""} ${f}`
2585
- ), y = `widget-container-header direction-${n} flex items-center border-1 ${f}`;
2586
- const p = () => {
2587
- e.onRemoveClick && e.widgetKey && e.onRemoveClick(e.widgetKey);
2588
- }, T = (g) => {
2589
- e.onMoveClick && e.widgetKey && e.onMoveClick(g, e.widgetKey, e.parentWidgetKey);
2590
- }, h = () => {
2591
- e.selectContainer && e.widgetKey && e.selectContainer(e.widgetKey);
2592
- };
2593
- return /* @__PURE__ */ _("div", { "data-testid": `container_${e.widgetKey}`, className: l, children: [
2594
- /* @__PURE__ */ _("div", { className: y, children: [
2595
- /* @__PURE__ */ t(
2596
- "div",
2597
- {
2598
- className: "widget-title-wrapper w-full flex whitespace-nowrap",
2599
- onClick: h,
2600
- children: /* @__PURE__ */ t("span", { className: "text-sm font-semibold capitalize", children: e.title })
2601
- }
2602
- ),
2603
- /* @__PURE__ */ t("div", { "data-testid": "collapse-and-other-actions", children: /* @__PURE__ */ t("div", { className: "actions-inner", children: /* @__PURE__ */ _("div", { className: "actions-buttons-container", children: [
2604
- /* @__PURE__ */ t(
2605
- ee,
2606
- {
2607
- "data-testid": `open-widgets-catalog-from-container_${e.title}`,
2608
- isIconButton: !0,
2609
- className: "whitespace-nowrap",
2610
- tooltip: {
2611
- placement: "top",
2612
- title: "Target this Container"
2613
- },
2614
- onClick: h,
2615
- children: /* @__PURE__ */ t(
2616
- Ot,
2617
- {
2618
- className: `${ve} ${s ? "text-success" : "text-disabled"}`
2619
- }
2620
- )
2621
- }
2622
- ),
2623
- /* @__PURE__ */ t(
2624
- ee,
2625
- {
2626
- "data-testid": `move-container-left_${e.title}`,
2627
- isIconButton: !0,
2628
- disabled: e.index < 1,
2629
- tooltip: {
2630
- placement: "top",
2631
- title: `${e.index < 1 ? "Already at min position" : "Move Container to the left/up"}`
2632
- },
2633
- onClick: () => T(-1),
2634
- children: /* @__PURE__ */ t(ct, { className: ve })
2635
- }
2636
- ),
2637
- /* @__PURE__ */ t(
2638
- ee,
2639
- {
2640
- "data-testid": `move-container-right_${e.title}`,
2641
- isIconButton: !0,
2642
- disabled: e.index >= e.maxIndex,
2643
- tooltip: {
2644
- placement: "top",
2645
- title: `${e.index >= e.maxIndex ? "Already at max position" : "Move Container to the right/down"}`
2646
- },
2647
- onClick: () => T(1),
2648
- children: /* @__PURE__ */ t(dt, { className: ve })
2649
- }
2650
- ),
2651
- /* @__PURE__ */ t(
2652
- ee,
2653
- {
2654
- "data-testid": `remove-container_${e.title}`,
2655
- isIconButton: !0,
2656
- tooltip: {
2657
- placement: "top",
2658
- title: "Remove Container"
2659
- },
2660
- onClick: () => p(),
2661
- children: /* @__PURE__ */ t(ut, { className: ve })
2662
- }
2663
- )
2664
- ] }) }) })
2665
- ] }),
2666
- /* @__PURE__ */ t("div", { "data-testid": `childrenwrapper_${e.widgetKey}`, className: "widget-container-inner", children: e.children })
2667
- ] });
2668
- }
2669
- function Wn(e) {
2670
- const { direction: s, ...n } = e;
2671
- return /* @__PURE__ */ t(je, { direction: "column", ...n });
2672
- }
2673
- function jn(e) {
2674
- const { size: s, ...n } = e;
2675
- return /* @__PURE__ */ t(je, { size: "large", ...n });
2676
- }
2677
- function An(e) {
2678
- const { direction: s, ...n } = e;
2679
- return /* @__PURE__ */ t(je, { direction: "row", ...n });
2680
- }
2681
- function $e({
2682
- // widgetKey,
2683
- metaData: e,
2684
- alreadyAdded: s,
2685
- addWidget: n
2686
- }) {
2687
- const [r, d] = oe(!1), o = e.icon || kt, c = e.name || "Unknown", f = e.description || "---", b = (e.noDuplicatedWidgets || !1) && s, v = Z(`
2688
- flex flex-row gap-2 p-2 rounded-md border text-sm bg-card content-card backdrop-opacity-100
2689
- ${b ? "border-disabled fill-disabled text-disabled" : "cursor-pointer border-primary fill-danger hover:fill-primary content-primary hover:brightness-110"}
2690
- `), l = () => {
2691
- b || n();
2692
- }, y = (p) => {
2693
- p.stopPropagation(), p.preventDefault(), d(!r);
2694
- };
2695
- return /* @__PURE__ */ _("div", { className: v, style: { width: "calc(100% - 1rem)" }, onClick: l, children: [
2696
- /* @__PURE__ */ t(o, { className: "" }),
2697
- /* @__PURE__ */ _("div", { className: "w-full", children: [
2698
- /* @__PURE__ */ _("div", { className: "flex flex-row items-center gap-2 justify-between", children: [
2699
- /* @__PURE__ */ t("span", { className: "font-bold", children: c }),
2700
- /* @__PURE__ */ t("div", { className: "text-xs", children: b ? "(Added)" : "" })
2701
- ] }),
2702
- /* @__PURE__ */ _("div", { className: "flex flex-col text-xs", children: [
2703
- /* @__PURE__ */ t("div", { children: f }),
2704
- r && e.externalDependencies.length > 0 && /* @__PURE__ */ _("div", { className: "mt-3 cursor-pointer", onClick: y, children: [
2705
- "Externals:",
2706
- /* @__PURE__ */ t("dl", { className: "ml-2 flex flex-col text-xs", children: e.externalDependencies.map((p, T) => /* @__PURE__ */ _("dd", { children: [
2707
- "- ",
2708
- p
2709
- ] }, T)) })
2710
- ] })
2711
- ] })
2712
- ] })
2713
- ] });
2714
- }
2715
- function ln({ item: e, onSettingItemChanged: s }) {
2716
- const n = e.name || "Unknown", r = e.description || "---", d = Z(`
2717
- flex flex-row gap-2 px-2 text-sm backdrop-opacity-100
2718
- `), o = (w) => {
2719
- const b = wt.incrementOrDecrementValue(e, w);
2720
- s(b);
2721
- }, c = (w) => {
2722
- const b = w.key;
2723
- ["ArrowUp", "ArrowDown"].includes(b) && (w.preventDefault(), o(b === "ArrowUp" ? 1 : -1));
2724
- }, f = (w) => {
2725
- s({
2726
- ...e,
2727
- value: w.target.value || ""
2728
- });
2729
- };
2730
- return /* @__PURE__ */ t("div", { className: d, style: { width: "calc(100% - 1rem)" }, children: /* @__PURE__ */ _("div", { className: "w-full flex flex-col", children: [
2731
- /* @__PURE__ */ t("h6", { className: "font-bold", children: n }),
2732
- /* @__PURE__ */ t("p", { className: "flex flex-col text-xs", children: r }),
2733
- /* @__PURE__ */ _("div", { className: "mt-1 flex flex-row gap-2 items-center", children: [
2734
- /* @__PURE__ */ t(
2735
- ht,
2736
- {
2737
- label: "",
2738
- size: "small",
2739
- className: "w-full",
2740
- value: e.value,
2741
- onChange: f,
2742
- onKeyDown: c
2743
- }
2744
- ),
2745
- /* @__PURE__ */ t(
2746
- ee,
2747
- {
2748
- "data-testid": `setting-decrease_${e.key}`,
2749
- isIconButton: !0,
2750
- tooltip: {
2751
- placement: "bottom",
2752
- title: "Decrease Value"
2753
- },
2754
- onClick: () => o(-1),
2755
- children: /* @__PURE__ */ t(Et, {})
2756
- }
2757
- ),
2758
- /* @__PURE__ */ t(
2759
- ee,
2760
- {
2761
- "data-testid": `setting-increase_${e.key}`,
2762
- isIconButton: !0,
2763
- tooltip: {
2764
- placement: "bottom",
2765
- title: "Increase Value"
2766
- },
2767
- onClick: () => o(1),
2768
- children: /* @__PURE__ */ t(lt, {})
2769
- }
2770
- )
2771
- ] })
2772
- ] }) });
2773
- }
2774
- const Re = (e, s) => [
2775
- ...s.widgets.filter((r) => r.indexOf("Container") === -1),
2776
- ...s.childWidgetsConfig.map((r) => r.widgetKey)
2777
- ].includes(e);
2778
- function Ln(e) {
2779
- const {
2780
- currentDashboardConfig: s,
2781
- undoStatus: n,
2782
- addContainer: r,
2783
- onResetToDefaultDashboardClick: d,
2784
- onUndoOrRedo: o,
2785
- onDoneClick: c
2786
- } = e, [f, w] = oe("Editing"), [b, v] = oe(0), [l, y] = oe(""), [p, T] = oe(!1), g = Array.from(e.widgetsCatalog.keys()).map((m) => ({
2787
- widgetKey: m,
2788
- metaData: Ct(m, e.widgetsCatalog)
2789
- })), x = !!e.targetContainerKey, N = (m) => {
2790
- y(m.target.value);
2791
- }, S = (m) => {
2792
- const B = l.trim().toLowerCase();
2793
- return B.length < 1 ? !0 : m.name.trim().toLowerCase().includes(B) || m.description.toLowerCase().includes(B) || m.categories.some((te) => te.toLowerCase().includes(B));
2794
- }, D = (m) => {
2795
- const B = l.trim().toLowerCase();
2796
- return B.length < 1 ? !0 : m.name.trim().toLowerCase().includes(B) || m.description.toLowerCase().includes(B);
2797
- }, a = (m, B) => Z(
2798
- "px-4 py-2 font-medium cursor-pointer",
2799
- `${B ? "" : "border-b-2"} border-transparent hover:border-primary focus:outline-none`,
2800
- m === b ? "text-primary border-primary" : ""
2801
- ), P = (m) => Z(
2802
- "w-full flex items-center gap-2 px-2 py-1 text-left text-sm cursor-pointer border",
2803
- m !== b ? "border-transparent content-topbar hover:bg-primary hover:content-primary" : "border-primary text-primary"
2804
- ), i = (m) => {
2805
- x ? e.addWidget(m, e.targetContainerKey) : e.addWidget(m);
2806
- }, u = (m) => {
2807
- const B = (e.currentDashboardConfig.cssSettings || []).map((te) => te.key === m.key ? m : te);
2808
- e.onSettingItemsUpdated(B);
2809
- }, M = (m) => {
2810
- T(m);
2811
- }, $ = (m) => {
2812
- v(m), T(!1);
2813
- }, [R, V] = oe(!1), G = (m) => {
2814
- V(m);
2815
- };
2816
- Oe(() => {
2817
- if (e.targetContainerKey) {
2818
- $(0);
2819
- const m = it(e.targetContainerKey);
2820
- w(`Editing ${m}`);
2821
- } else
2822
- w("Widget Catalog");
2823
- }, [e.targetContainerKey]);
2824
- const X = fe(() => {
2825
- const m = [
2826
- {
2827
- id: 0,
2828
- label: "Widgets"
2829
- },
2830
- {
2831
- id: 1,
2832
- label: "Charts"
2833
- }
2834
- ];
2835
- return x || (m.push({
2836
- id: 2,
2837
- label: "Containers"
2838
- }), m.push({
2839
- id: 3,
2840
- label: "CSS Settings",
2841
- hideLabel: !0,
2842
- icon: /* @__PURE__ */ t(_t, {})
2843
- })), m;
2844
- }, [x]), Q = fe(() => X.find((m) => m.id === b)?.label || "Category...", [b]);
2845
- return /* @__PURE__ */ t(
2846
- Qt,
2847
- {
2848
- testId: "dashboard-catalog-flyout",
2849
- className: "bg-body content-body bg-opacity-70 border-2 border-primary max-w-72 sm:max-w-90",
2850
- zIndex: e.zIndex,
2851
- style: {
2852
- // width: '360px',
2853
- // minWidth: '360px',
2854
- // maxWidth: '360px',
2855
- // minHeight: '360px',
2856
- backdropFilter: "blur(8px)"
2857
- },
2858
- onDraggingChange: G,
2859
- children: /* @__PURE__ */ _("div", { className: "flex flex-col gap-2 p-2", children: [
2860
- /* @__PURE__ */ _("div", { className: "flex flex-row gap-2 justify-between", children: [
2861
- /* @__PURE__ */ _("div", { className: "handle flex-1 flex gap-2 w-full hover:text-primary cursor-grab", children: [
2862
- R ? /* @__PURE__ */ t(Rt, { className: "size-5" }) : /* @__PURE__ */ t($t, { className: "size-5" }),
2863
- /* @__PURE__ */ t(
2864
- "h2",
2865
- {
2866
- className: "flex-1 text-base margin-0 capitalize",
2867
- title: x ? f : `Editing dashboard: ${s.dashboardName}`,
2868
- children: f
2869
- }
2870
- )
2871
- ] }),
2872
- /* @__PURE__ */ _("div", { className: "flex flex-row items-center gap-2", children: [
2873
- /* @__PURE__ */ t(
2874
- ee,
2875
- {
2876
- "data-testid": "undo-dashboard-config-change",
2877
- isIconButton: !0,
2878
- tooltip: {
2879
- placement: "bottom",
2880
- title: "Undo"
2881
- },
2882
- disabled: n.isUndoDisabled,
2883
- onClick: () => o("Undo"),
2884
- children: /* @__PURE__ */ t(Pt, { className: "size-5" })
2885
- }
2886
- ),
2887
- /* @__PURE__ */ t(
2888
- ee,
2889
- {
2890
- "data-testid": "redo-dashboard-config-change",
2891
- isIconButton: !0,
2892
- tooltip: {
2893
- placement: "bottom",
2894
- title: "Redo"
2895
- },
2896
- disabled: n.isRedoDisabled,
2897
- onClick: () => o("Redo"),
2898
- children: /* @__PURE__ */ t(It, { className: "size-5" })
2899
- }
2900
- ),
2901
- /* @__PURE__ */ t(
2902
- ee,
2903
- {
2904
- "data-testid": "reset-dashboard-to-default",
2905
- isIconButton: !0,
2906
- tooltip: {
2907
- placement: "bottom",
2908
- title: "Reset this dashboard to the default configuration"
2909
- },
2910
- onClick: d,
2911
- children: /* @__PURE__ */ t(Mt, { className: "size-5" })
2912
- }
2913
- )
2914
- ] })
2915
- ] }),
2916
- /* @__PURE__ */ t("div", { className: "hidden sm:flex sm:flex-row sm:items-center sm:gap-1", children: X.map((m) => /* @__PURE__ */ _(
2917
- "button",
2918
- {
2919
- className: a(m.id, m.id === 3),
2920
- onClick: () => $(m.id),
2921
- children: [
2922
- /* @__PURE__ */ t("span", { className: m.hideLabel ? "sr-only" : "", children: m.label }),
2923
- m.icon
2924
- ]
2925
- },
2926
- m.id
2927
- )) }),
2928
- /* @__PURE__ */ t("div", { className: "flex flex-col gap-1 sm:hidden", children: /* @__PURE__ */ t(
2929
- Wt,
2930
- {
2931
- enabled: !0,
2932
- showChevron: !0,
2933
- isMenuOpen: p,
2934
- toggleOpen: M,
2935
- icon: /* @__PURE__ */ _("div", { className: "group flex items-center gap-2 text-primary group-hover:text-primary-inverse", children: [
2936
- /* @__PURE__ */ t("h5", { className: "py-2 font-bold", children: Q }),
2937
- /* @__PURE__ */ t(ft, { className: "shrink-0 ml-1 size-4" })
2938
- ] }),
2939
- children: /* @__PURE__ */ _("div", { className: "p-2 rounded-md border border-primary", children: [
2940
- /* @__PURE__ */ t("h6", { className: "font-semibold", children: "Category:" }),
2941
- X.map((m) => /* @__PURE__ */ t(
2942
- "button",
2943
- {
2944
- type: "button",
2945
- className: P(m.id),
2946
- role: "menuitem",
2947
- tabIndex: -1,
2948
- onClick: () => $(m.id),
2949
- children: /* @__PURE__ */ t("span", { children: m.label })
2950
- },
2951
- m.id
2952
- ))
2953
- ] })
2954
- }
2955
- ) }),
2956
- /* @__PURE__ */ t("div", { className: "sm:mt-2 flex flex-col gap-1 w-full", children: /* @__PURE__ */ t(
2957
- ht,
2958
- {
2959
- label: "",
2960
- placeholder: "Find...",
2961
- size: "small",
2962
- className: "w-full",
2963
- value: l,
2964
- onChange: N
2965
- }
2966
- ) }),
2967
- /* @__PURE__ */ _(
2968
- "div",
2969
- {
2970
- className: "flex flex-col gap-2 overflow-x-hidden overflow-y-auto",
2971
- style: {
2972
- maxHeight: "360px"
2973
- },
2974
- children: [
2975
- b === 3 && /* @__PURE__ */ _("div", { className: "hidden px-2 w-full sm:flex", children: [
2976
- Q,
2977
- ":"
2978
- ] }),
2979
- b === 0 && g.filter(
2980
- (m) => m.metaData.categories.includes("Widget") && S(m.metaData)
2981
- ).map((m) => /* @__PURE__ */ t(
2982
- $e,
2983
- {
2984
- widgetKey: m.widgetKey,
2985
- metaData: m.metaData,
2986
- alreadyAdded: Re(m.widgetKey, s),
2987
- addWidget: () => i(m.widgetKey)
2988
- },
2989
- m.widgetKey
2990
- )),
2991
- b === 1 && g.filter(
2992
- (m) => m.metaData.categories.includes("Chart") && S(m.metaData)
2993
- ).map((m) => /* @__PURE__ */ t(
2994
- $e,
2995
- {
2996
- widgetKey: m.widgetKey,
2997
- metaData: m.metaData,
2998
- alreadyAdded: Re(m.widgetKey, s),
2999
- addWidget: () => i(m.widgetKey)
3000
- },
3001
- m.widgetKey
3002
- )),
3003
- !x && b === 2 && g.filter((m) => m.metaData.categories.includes("Container")).map((m) => /* @__PURE__ */ t(
3004
- $e,
3005
- {
3006
- widgetKey: m.widgetKey,
3007
- metaData: m.metaData,
3008
- alreadyAdded: Re(m.widgetKey, s),
3009
- addWidget: () => r(m.widgetKey)
3010
- },
3011
- m.widgetKey
3012
- )),
3013
- !x && b === 3 && (s.cssSettings || []).filter(D).map((m) => /* @__PURE__ */ t(
3014
- ln,
3015
- {
3016
- item: m,
3017
- onSettingItemChanged: u
3018
- },
3019
- m.key
3020
- ))
3021
- ]
3022
- }
3023
- ),
3024
- /* @__PURE__ */ t("div", { className: "mt-4 w-full flex flex-row justify-end pt-1", children: /* @__PURE__ */ t(
3025
- ee,
3026
- {
3027
- className: "bg-opacity-100",
3028
- tooltip: {
3029
- placement: "bottom",
3030
- title: "Click to exit edit mode"
3031
- },
3032
- onClick: c,
3033
- children: "Done"
3034
- }
3035
- ) })
3036
- ] })
3037
- }
3038
- );
3039
- }
3040
- export {
3041
- pn as AddIcon,
3042
- ee as Button,
3043
- ft as ChevronDownIcon,
3044
- kt as CircleQuestionMark,
3045
- Ot as CrosshairIcon,
3046
- kn as DashboardGrid,
3047
- rn as DashboardWidgetBase,
3048
- yn as DeleteIcon,
3049
- Qt as DraggablePanel,
3050
- Wt as Dropdown,
3051
- sn as DynamicWidgetLoader,
3052
- bn as EditIcon,
3053
- xn as GridIcon,
3054
- Rt as HandGrabIcon,
3055
- $t as HandIcon,
3056
- En as ListItem,
3057
- _n as ListItemLeftChild,
3058
- Mn as ListItemMiddleChild,
3059
- Pn as ListItemRightChild,
3060
- Et as MinusCircleIcon,
3061
- Cn as MonitorIcon,
3062
- wn as MonitorSmartphoneIcon,
3063
- ct as MoveLeftIcon,
3064
- dt as MoveRightIcon,
3065
- lt as PlusCircleIcon,
3066
- It as RedoIcon,
3067
- vn as RenameIcon,
3068
- _t as SettingsIcon,
3069
- At as Stack,
3070
- z as SvgBaseWrapper,
3071
- Sn as TabletSmartphoneIcon,
3072
- Nn as TargetIcon,
3073
- ht as TextField,
3074
- Mt as TimerResetIcon,
3075
- Pt as UndoIcon,
3076
- Wn as WidgetContainerColumn,
3077
- jn as WidgetContainerLarge,
3078
- An as WidgetContainerRow,
3079
- Ln as WidgetsCatalogFlyout,
3080
- $n as WrapperColumnContent,
3081
- Rn as WrapperColumnContentListItem,
3082
- ut as XCircleIcon,
3083
- Dn as ZoomInIcon,
3084
- Tn as ZoomOutIcon,
3085
- on as _isVersionCompatible,
3086
- On as showToast,
3087
- gn as useDashboardStore,
3088
- mn as useDashboardUndoService
3089
- };