@actionexec/dashboards 0.7.0 → 0.9.0

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.
@@ -0,0 +1,792 @@
1
+ import { jsx as l, jsxs as E } from "react/jsx-runtime";
2
+ import Q from "react-datepicker";
3
+ import { useState as O, useRef as $, useMemo as k, useLayoutEffect as Z, useEffect as ee } from "react";
4
+ import { createPortal as te } from "react-dom";
5
+ const ae = "https://action-data-api-7mbrztperq-rj.a.run.app", ne = "/external/dashboards";
6
+ let G = ae;
7
+ function ye(e) {
8
+ G = e.replace(/\/$/, "");
9
+ }
10
+ class re extends Error {
11
+ constructor(t, a, n) {
12
+ super(t), this.status = a, this.payload = n, this.name = "ApiError";
13
+ }
14
+ }
15
+ async function Y(e, t, a) {
16
+ const n = new URL(`${G}${ne}${e}`);
17
+ if (a)
18
+ for (const [o, i] of Object.entries(a)) n.searchParams.set(o, i);
19
+ const r = await fetch(n.toString(), {
20
+ headers: { Authorization: `Bearer ${t}` }
21
+ });
22
+ if (!r.ok) {
23
+ let o;
24
+ try {
25
+ o = await r.json();
26
+ } catch {
27
+ }
28
+ throw new re(
29
+ `Requisicao falhou (${r.status}) em ${e}`,
30
+ r.status,
31
+ o
32
+ );
33
+ }
34
+ return await r.json();
35
+ }
36
+ const Ne = (e) => Y("/layout", e), Ae = (e, t) => Y("/render", e, t), f = {
37
+ series0: 0,
38
+ series1: 1,
39
+ series2: 2,
40
+ series3: 3,
41
+ series4: 4,
42
+ bgDark: 5,
43
+ bgPaper: 6,
44
+ bgElevated: 7,
45
+ textPrimary: 8,
46
+ textMuted: 9,
47
+ accent: 10,
48
+ success: 11,
49
+ error: 12,
50
+ // Alerta e informacao tem slot proprio: derivá-los de cores de serie fazia
51
+ // trocar a cor de uma serie mudar o significado semantico de "atencao".
52
+ warning: 13,
53
+ info: 14
54
+ }, se = 5, A = 15, oe = {
55
+ series0: "Série 1",
56
+ series1: "Série 2",
57
+ series2: "Série 3",
58
+ series3: "Série 4",
59
+ series4: "Série 5",
60
+ bgDark: "Fundo Escuro",
61
+ bgPaper: "Fundo Cartão",
62
+ bgElevated: "Fundo Elevado",
63
+ textPrimary: "Texto Primário",
64
+ textMuted: "Texto Secundário",
65
+ accent: "Destaque",
66
+ success: "Sucesso",
67
+ error: "Erro",
68
+ warning: "Alerta",
69
+ info: "Informação"
70
+ }, M = {
71
+ action: {
72
+ label: "Action",
73
+ colors: [
74
+ "#ff6b00",
75
+ "#a3e635",
76
+ "#e3f544",
77
+ "#65ffd1",
78
+ "#ff0404",
79
+ "#1a1a1a",
80
+ "#262626",
81
+ "#333333",
82
+ "#f5f5f5",
83
+ "#999999",
84
+ "#ff6b00",
85
+ "#a3e635",
86
+ "#ef4444",
87
+ "#f59e0b",
88
+ "#38bdf8"
89
+ ]
90
+ },
91
+ westCoast: {
92
+ label: "West Coast",
93
+ colors: [
94
+ "#a3b86c",
95
+ "#c89b3c",
96
+ "#8b6f47",
97
+ "#6b8e23",
98
+ "#d2691e",
99
+ "#1f1a14",
100
+ "#2a241b",
101
+ "#3a3225",
102
+ "#e8dcc4",
103
+ "#a89878",
104
+ "#c89b3c",
105
+ "#a3b86c",
106
+ "#c44536",
107
+ "#d99a2b",
108
+ "#7c9bb5"
109
+ ]
110
+ },
111
+ mono: {
112
+ label: "Monocromático",
113
+ colors: [
114
+ "#f8fafc",
115
+ "#cbd5e1",
116
+ "#94a3b8",
117
+ "#64748b",
118
+ "#475569",
119
+ "#0a0a0a",
120
+ "#171717",
121
+ "#262626",
122
+ "#fafafa",
123
+ "#a3a3a3",
124
+ "#e5e5e5",
125
+ "#cbd5e1",
126
+ "#ef4444",
127
+ "#facc15",
128
+ "#7dd3fc"
129
+ ]
130
+ },
131
+ ocean: {
132
+ label: "Ocean",
133
+ colors: [
134
+ "#0ea5e9",
135
+ "#06b6d4",
136
+ "#0891b2",
137
+ "#3b82f6",
138
+ "#22d3ee",
139
+ "#0a1929",
140
+ "#0f2740",
141
+ "#173554",
142
+ "#e0f2fe",
143
+ "#7dd3fc",
144
+ "#22d3ee",
145
+ "#10b981",
146
+ "#f43f5e",
147
+ "#fbbf24",
148
+ "#60a5fa"
149
+ ]
150
+ },
151
+ princess: {
152
+ label: "Cute Pink",
153
+ colors: [
154
+ "#ff79bc",
155
+ "#a855f7",
156
+ "#f472b6",
157
+ "#d946ef",
158
+ "#fb7185",
159
+ "#fff0f6",
160
+ "#ffe4ec",
161
+ "#ffffff",
162
+ "#ff4099",
163
+ "#ffadd5",
164
+ "#ec4899",
165
+ "#10b981",
166
+ "#e11d48",
167
+ "#f59e0b",
168
+ "#8b5cf6"
169
+ ]
170
+ }
171
+ }, W = M.action.colors;
172
+ function N(e) {
173
+ const t = W;
174
+ if (!e || e.length === 0) return [...t];
175
+ if (e.length >= A) return e.slice(0, A);
176
+ const a = [...e];
177
+ for (let n = e.length; n < A; n++) a.push(t[n]);
178
+ return a;
179
+ }
180
+ function ce(e) {
181
+ return N(e).slice(0, se);
182
+ }
183
+ function Me(e) {
184
+ const t = N(e);
185
+ return {
186
+ "--bg-dark": t[f.bgDark],
187
+ "--bg-paper": t[f.bgPaper],
188
+ "--bg-elevated": t[f.bgElevated],
189
+ "--text-primary": t[f.textPrimary],
190
+ "--text-secondary": t[f.textMuted],
191
+ "--text-muted": t[f.textMuted],
192
+ "--color-accent": t[f.accent],
193
+ "--color-success": t[f.success],
194
+ "--color-error": t[f.error],
195
+ "--color-warning": t[f.warning],
196
+ "--color-info": t[f.info],
197
+ // Aliases historicos, mantidos para nao quebrar CSS de consumidores.
198
+ "--action-orange": t[f.accent],
199
+ "--action-green": t[f.success]
200
+ };
201
+ }
202
+ const ie = W, le = 30, ue = 10, xe = {
203
+ gridColumns: le,
204
+ gridRows: ue,
205
+ widgets: []
206
+ }, Oe = {
207
+ kpi_card: "Card",
208
+ gauge: "Gauge",
209
+ chart: "Gráfico",
210
+ composition: "Composição",
211
+ table: "Tabela",
212
+ filter: "Filtro",
213
+ variable: "Variável",
214
+ color_palette: "Paleta de Cores"
215
+ }, Pe = ["kpi_card", "gauge", "chart", "composition", "table"], Re = ["filter", "variable", "color_palette"], Ce = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), Ie = {
216
+ day: ["dia", "dias"],
217
+ week: ["semana", "semanas"],
218
+ month: ["mês", "meses"],
219
+ quarter: ["trimestre", "trimestres"],
220
+ year: ["ano", "anos"]
221
+ }, Fe = ["período", "períodos"], ve = {
222
+ sum: "Soma",
223
+ avg: "Média",
224
+ count: "Contagem",
225
+ min: "Mínimo",
226
+ max: "Máximo",
227
+ count_distinct: "Contagem Distinta"
228
+ }, fe = {
229
+ currency: "Moeda (R$)",
230
+ number: "Número",
231
+ integer: "Inteiro",
232
+ percentage: "Porcentagem",
233
+ date: "Data",
234
+ text: "Texto"
235
+ }, $e = Object.entries(fe).filter(([e]) => e !== "date" && e !== "text"), ke = {
236
+ variance: "Variação %",
237
+ difference: "Diferença",
238
+ ratio: "Proporção",
239
+ value: "Valor da base"
240
+ }, Ue = {
241
+ higher: "Maior é melhor",
242
+ lower: "Menor é melhor",
243
+ neutral: "Neutro"
244
+ }, Ge = {
245
+ eq: "Igual a",
246
+ neq: "Diferente de",
247
+ in: "Está entre os valores",
248
+ not_in: "Não está entre os valores",
249
+ gt: "Maior que",
250
+ gte: "Maior ou igual a",
251
+ lt: "Menor que",
252
+ lte: "Menor ou igual a",
253
+ between: "Entre (faixa numérica)",
254
+ contains: "Contém",
255
+ not_contains: "Não contém",
256
+ is_empty: "Está vazio",
257
+ not_empty: "Não está vazio"
258
+ }, Ye = ["is_empty", "not_empty"], We = ["in", "not_in"], He = {
259
+ bar: "Barras",
260
+ line: "Linhas",
261
+ area: "Área"
262
+ }, Be = {
263
+ pie: "Pizza",
264
+ bridge: "Ponte"
265
+ }, je = {
266
+ descending: "Descendente",
267
+ ascending: "Ascendente"
268
+ }, ze = {
269
+ date_range: "Periodo",
270
+ select: "Seleção Única",
271
+ multi_select: "Seleção Múltipla"
272
+ }, U = "", Ve = {
273
+ kpi_card: { x: 0, y: 0, w: 6, h: 3 },
274
+ gauge: { x: 0, y: 0, w: 6, h: 5 },
275
+ chart: { x: 0, y: 0, w: 6, h: 6 },
276
+ composition: { x: 0, y: 0, w: 6, h: 6 },
277
+ table: { x: 0, y: 0, w: 12, h: 7 },
278
+ filter: { x: 0, y: 0, w: 4, h: 2 },
279
+ variable: { x: 0, y: 0, w: 4, h: 2 },
280
+ color_palette: { x: 0, y: 0, w: 4, h: 2 }
281
+ }, qe = {
282
+ kpi_card: { label: "Novo card", aggregation: "sum", format: "number" },
283
+ gauge: { label: "Novo Gauge", aggregation: "sum" },
284
+ chart: { label: "Novo gráfico", chartType: "bar", xAxis: { column: "", granularity: "day" }, series: [] },
285
+ composition: {
286
+ label: "Nova composição",
287
+ display: "pie",
288
+ categories: [],
289
+ direction: "descending"
290
+ },
291
+ table: { label: "Nova Tabela", columns: [] },
292
+ filter: { label: "Novo Filtro", filterType: "select" },
293
+ variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
294
+ color_palette: { label: "Paleta de Cores", paletteColors: ie, locked: !1 }
295
+ }, R = 6, C = 16, I = 1, P = 24, de = 80, ge = (e, t, a) => Math.min(Math.max(e, t), a), S = (e) => Number.isFinite(e) && e > 0;
296
+ function Je(e, t, a = R, n = C) {
297
+ if (!S(t) || !Number.isFinite(e)) return 0;
298
+ const r = e - n * 2 - a * (t - 1);
299
+ return Math.max(0, r / t);
300
+ }
301
+ function Xe(e, t = I) {
302
+ return !S(e) || !S(t) ? P : ge(e / t, P, de);
303
+ }
304
+ function Ke(e, t, a = R, n = C) {
305
+ return e <= 0 ? n * 2 : e * t + (e - 1) * a + n * 2;
306
+ }
307
+ function Qe(e, t, a = I) {
308
+ return !S(e) || !S(t) || !S(a) ? 1 : e * a / t;
309
+ }
310
+ function Ze(e, t = I, a = R, n = C) {
311
+ return !S(e) || !S(t) ? 0 : P * t * e + a * (e - 1) + n * 2;
312
+ }
313
+ const y = "pt-BR", me = 100, pe = /* @__PURE__ */ new Set(["currency", "number", "integer", "percentage"]);
314
+ function et(e) {
315
+ return !!e && pe.has(e);
316
+ }
317
+ function H(e) {
318
+ if (e == null || e === "") return null;
319
+ const t = typeof e == "number" ? e : Number(e);
320
+ return Number.isFinite(t) ? t : null;
321
+ }
322
+ function be(e, t, a = "-") {
323
+ if (e == null || e === "") return a;
324
+ const n = H(e);
325
+ if (n === null) return String(e);
326
+ switch (t) {
327
+ case "currency":
328
+ return n.toLocaleString(y, { style: "currency", currency: "BRL" });
329
+ case "integer":
330
+ return Math.round(n).toLocaleString(y);
331
+ case "percentage":
332
+ return `${(n * me).toLocaleString(y, { maximumFractionDigits: 1 })}%`;
333
+ case "number":
334
+ return n.toLocaleString(y, { maximumFractionDigits: 2 });
335
+ default:
336
+ return String(e);
337
+ }
338
+ }
339
+ function tt(e, t) {
340
+ const a = H(e);
341
+ if (a === null) return "-";
342
+ if (t === "percentage") return be(a, "percentage");
343
+ const n = t === "currency" ? "R$ " : "", r = Math.abs(a);
344
+ return r >= 1e9 ? `${n}${(a / 1e9).toFixed(1)}B` : r >= 1e6 ? `${n}${(a / 1e6).toFixed(1)}M` : r >= 1e3 ? `${n}${(a / 1e3).toFixed(1)}K` : `${n}${a.toLocaleString(y, { maximumFractionDigits: 2 })}`;
345
+ }
346
+ const at = [
347
+ "Jan",
348
+ "Fev",
349
+ "Mar",
350
+ "Abr",
351
+ "Mai",
352
+ "Jun",
353
+ "Jul",
354
+ "Ago",
355
+ "Set",
356
+ "Out",
357
+ "Nov",
358
+ "Dez"
359
+ ], nt = [
360
+ "Janeiro",
361
+ "Fevereiro",
362
+ "Marco",
363
+ "Abril",
364
+ "Maio",
365
+ "Junho",
366
+ "Julho",
367
+ "Agosto",
368
+ "Setembro",
369
+ "Outubro",
370
+ "Novembro",
371
+ "Dezembro"
372
+ ];
373
+ function rt(e) {
374
+ return { start: `${e}-01-01`, end: `${e}-12-31` };
375
+ }
376
+ function st(e) {
377
+ if (!e) return null;
378
+ const t = e.match(/^(\d{4})/);
379
+ return t ? { year: parseInt(t[1]) } : null;
380
+ }
381
+ function ot(e, t) {
382
+ const a = new Date(e, t, 0).getDate(), n = (r) => String(r).padStart(2, "0");
383
+ return {
384
+ start: `${e}-${n(t)}-01`,
385
+ end: `${e}-${n(t)}-${n(a)}`
386
+ };
387
+ }
388
+ function B(e) {
389
+ const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()));
390
+ t.setUTCDate(t.getUTCDate() + 4 - (t.getUTCDay() || 7));
391
+ const a = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
392
+ return Math.ceil(((t.getTime() - a.getTime()) / 864e5 + 1) / 7);
393
+ }
394
+ function ct(e, t) {
395
+ const a = new Date(e, 0, 4), n = (a.getDay() + 6) % 7, r = new Date(a.getTime() - n * 864e5), o = new Date(r.getTime() + (t - 1) * 7 * 864e5), i = new Date(o.getTime() + 6 * 864e5), d = (b) => String(b).padStart(2, "0"), g = (b) => `${b.getFullYear()}-${d(b.getMonth() + 1)}-${d(b.getDate())}`;
396
+ return { start: g(o), end: g(i) };
397
+ }
398
+ function it(e, t) {
399
+ const a = /* @__PURE__ */ new Set(), n = new Date(e, t, 0).getDate();
400
+ for (let r = 1; r <= n; r++)
401
+ a.add(B(new Date(e, t - 1, r)));
402
+ return Array.from(a).sort((r, o) => r - o);
403
+ }
404
+ function lt(e, t) {
405
+ const a = new Date(e, t, 0).getDate(), n = (d) => String(d).padStart(2, "0"), r = [];
406
+ let o = 1, i = 1;
407
+ for (; o <= a; ) {
408
+ const d = o, g = Math.min(o + 6, a), b = `${e}-${n(t)}-${n(d)}`, c = `${e}-${n(t)}-${n(g)}`, u = `${i}° Semana (${n(d)}/${n(t)} - ${n(g)}/${n(t)})`;
409
+ r.push({ index: i, startDay: d, endDay: g, start: b, end: c, label: u }), o = g + 1, i++;
410
+ }
411
+ return r;
412
+ }
413
+ function ut(e, t, a) {
414
+ if (!e) return 1;
415
+ const n = (i) => String(i).padStart(2, "0"), r = e.match(new RegExp(`^${t}-${n(a)}-(\\d{2})`));
416
+ if (!r) return 1;
417
+ const o = parseInt(r[1]);
418
+ return Math.ceil(o / 7);
419
+ }
420
+ function ft(e) {
421
+ if (!e) return null;
422
+ const t = e.match(/^(\d{4})-(\d{2})/);
423
+ return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
424
+ }
425
+ function dt(e) {
426
+ if (!e) return null;
427
+ const t = /* @__PURE__ */ new Date(e + "T00:00:00");
428
+ return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: B(t) };
429
+ }
430
+ function gt(e) {
431
+ const t = /* @__PURE__ */ new Date(), a = e != null && e.min ? parseInt(e.min.slice(0, 4)) : t.getFullYear() - 2, n = e != null && e.max ? parseInt(e.max.slice(0, 4)) : t.getFullYear(), r = [];
432
+ for (let o = n; o >= a; o--) r.push(o);
433
+ return r;
434
+ }
435
+ function D(e) {
436
+ if (!e) return null;
437
+ const [t, a, n] = e.split("-").map(Number);
438
+ return !t || !a || !n ? null : new Date(t, a - 1, n);
439
+ }
440
+ function _e(e) {
441
+ if (!e) return "";
442
+ const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
443
+ return `${t}-${a}-${n}`;
444
+ }
445
+ function mt({
446
+ value: e,
447
+ onChange: t,
448
+ minIso: a,
449
+ maxIso: n,
450
+ placeholder: r,
451
+ selectsStart: o,
452
+ selectsEnd: i,
453
+ startIso: d,
454
+ endIso: g,
455
+ className: b,
456
+ disabled: c
457
+ }) {
458
+ return /* @__PURE__ */ l("div", { className: `ddp-field ${b ?? ""}`, children: /* @__PURE__ */ l(
459
+ Q,
460
+ {
461
+ selected: D(e),
462
+ onChange: (u) => t(_e(u)),
463
+ selectsStart: o,
464
+ selectsEnd: i,
465
+ startDate: D(d) ?? void 0,
466
+ endDate: D(g) ?? void 0,
467
+ minDate: D(a) ?? void 0,
468
+ maxDate: D(n) ?? void 0,
469
+ dateFormat: "dd/MM/yyyy",
470
+ placeholderText: r ?? "Selecione...",
471
+ disabled: c,
472
+ portalId: "ddp-portal",
473
+ popperPlacement: "bottom-start",
474
+ popperModifiers: [
475
+ {
476
+ name: "flip",
477
+ options: { fallbackPlacements: ["bottom-end", "top-start", "top-end"] },
478
+ fn: (u) => u
479
+ }
480
+ ]
481
+ }
482
+ ) });
483
+ }
484
+ function pt({ options: e, value: t, multi: a, onChange: n }) {
485
+ const [r, o] = O(!1), [i, d] = O(""), [g, b] = O(null), c = $(null), u = $(null), m = k(
486
+ () => t ? t.split(U).filter(Boolean) : [],
487
+ [t]
488
+ ), _ = k(() => {
489
+ const s = i.trim().toLowerCase();
490
+ return s ? e.filter((p) => p.toLowerCase().includes(s)) : e;
491
+ }, [e, i]), T = () => {
492
+ const s = c.current;
493
+ if (!s) return;
494
+ const p = s.getBoundingClientRect(), h = 4, L = window.innerHeight - p.bottom - h, w = p.top - h, v = L < 200 && w > L, K = Math.max(150, Math.min(360, v ? w : L));
495
+ b({
496
+ left: p.left,
497
+ width: p.width,
498
+ maxHeight: K,
499
+ ...v ? { bottom: window.innerHeight - p.top + h } : { top: p.bottom + h }
500
+ });
501
+ };
502
+ Z(() => {
503
+ if (!r) return;
504
+ T();
505
+ const s = () => T();
506
+ return window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
507
+ window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
508
+ };
509
+ }, [r]), ee(() => {
510
+ if (!r) return;
511
+ const s = (p) => {
512
+ var L, w;
513
+ const h = p.target;
514
+ (L = c.current) != null && L.contains(h) || (w = u.current) != null && w.contains(h) || o(!1);
515
+ };
516
+ return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
517
+ }, [r]);
518
+ const j = () => {
519
+ o(!1), d("");
520
+ }, x = (s) => {
521
+ var p;
522
+ n(s), d(""), o(!1), (p = c.current) == null || p.blur();
523
+ }, F = (s) => {
524
+ const p = m.includes(s) ? m.filter((h) => h !== s) : [...m, s];
525
+ n(p.join(U));
526
+ }, z = () => {
527
+ o(!0), a || d("");
528
+ }, V = (s) => {
529
+ var p;
530
+ s.key === "Escape" ? (j(), (p = c.current) == null || p.blur()) : s.key === "Enter" && _.length > 0 && (s.preventDefault(), a ? (F(_[0]), d("")) : x(_[0]));
531
+ }, q = a || r ? i : t || "", J = a && m.length > 0 ? `${m.length} selecionado(s)` : r ? "Buscar..." : "Todos", X = r && g ? te(
532
+ /* @__PURE__ */ l(
533
+ "div",
534
+ {
535
+ ref: u,
536
+ className: "widget-filter__search-panel",
537
+ style: {
538
+ position: "fixed",
539
+ left: g.left,
540
+ width: g.width,
541
+ top: g.top,
542
+ bottom: g.bottom,
543
+ maxHeight: g.maxHeight
544
+ },
545
+ children: /* @__PURE__ */ E("div", { className: "widget-filter__search-list", children: [
546
+ a && m.length > 0 && /* @__PURE__ */ l(
547
+ "button",
548
+ {
549
+ type: "button",
550
+ className: "widget-filter__search-clear",
551
+ onClick: () => n(""),
552
+ children: "Limpar seleção"
553
+ }
554
+ ),
555
+ !a && /* @__PURE__ */ E(
556
+ "button",
557
+ {
558
+ type: "button",
559
+ className: `widget-filter__search-option${t ? "" : " is-selected"}`,
560
+ onClick: () => x(""),
561
+ children: [
562
+ /* @__PURE__ */ l("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ? "" : "✓" }),
563
+ "Todos"
564
+ ]
565
+ }
566
+ ),
567
+ _.length === 0 ? /* @__PURE__ */ l("span", { className: "widget-filter__search-empty", children: "Nenhuma opção" }) : _.map(
568
+ (s) => a ? /* @__PURE__ */ E(
569
+ "label",
570
+ {
571
+ className: `widget-filter__search-option${m.includes(s) ? " is-selected" : ""}`,
572
+ children: [
573
+ /* @__PURE__ */ l(
574
+ "input",
575
+ {
576
+ type: "checkbox",
577
+ checked: m.includes(s),
578
+ onChange: () => F(s)
579
+ }
580
+ ),
581
+ s
582
+ ]
583
+ },
584
+ s
585
+ ) : /* @__PURE__ */ E(
586
+ "button",
587
+ {
588
+ type: "button",
589
+ className: `widget-filter__search-option${t === s ? " is-selected" : ""}`,
590
+ onClick: () => x(s),
591
+ children: [
592
+ /* @__PURE__ */ l("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t === s ? "✓" : "" }),
593
+ s
594
+ ]
595
+ },
596
+ s
597
+ )
598
+ )
599
+ ] })
600
+ }
601
+ ),
602
+ document.body
603
+ ) : null;
604
+ return /* @__PURE__ */ E("div", { className: "widget-filter__search", children: [
605
+ /* @__PURE__ */ l(
606
+ "input",
607
+ {
608
+ ref: c,
609
+ type: "text",
610
+ className: "widget-filter__search-field",
611
+ value: q,
612
+ placeholder: J,
613
+ onFocus: z,
614
+ onClick: () => o(!0),
615
+ onChange: (s) => {
616
+ d(s.target.value), o(!0);
617
+ },
618
+ onKeyDown: V
619
+ }
620
+ ),
621
+ X
622
+ ] });
623
+ }
624
+ const he = [
625
+ f.bgDark,
626
+ f.bgPaper,
627
+ f.bgElevated,
628
+ f.accent,
629
+ f.success
630
+ ];
631
+ function Ee(e) {
632
+ if (!e) return !0;
633
+ const t = N(e);
634
+ return Object.values(M).some(
635
+ (a) => JSON.stringify(a.colors) === JSON.stringify(t)
636
+ );
637
+ }
638
+ const Se = [
639
+ { label: "Series", slots: ["series0", "series1", "series2", "series3", "series4"] },
640
+ { label: "Tema", slots: ["bgDark", "bgPaper", "bgElevated", "textPrimary", "textMuted"] },
641
+ { label: "Estados", slots: ["accent", "success", "error"] }
642
+ ];
643
+ function bt({
644
+ selected: e,
645
+ onSelect: t,
646
+ customMode: a,
647
+ onCustomModeChange: n,
648
+ disabled: r
649
+ }) {
650
+ var b;
651
+ const o = a ?? !Ee(e), i = N(e), d = o || (b = Object.entries(M).find(
652
+ ([, c]) => JSON.stringify(c.colors) === JSON.stringify(i)
653
+ )) == null ? void 0 : b[0], g = (c, u) => {
654
+ const m = [...i];
655
+ for (; m.length < A; ) m.push("#000000");
656
+ m[c] = u, t(m);
657
+ };
658
+ return /* @__PURE__ */ E("div", { className: `palette-selector ${r ? "palette-selector--disabled" : ""}`, children: [
659
+ n && /* @__PURE__ */ E("label", { className: "config-panel__checkbox", children: [
660
+ /* @__PURE__ */ l(
661
+ "input",
662
+ {
663
+ type: "checkbox",
664
+ checked: o,
665
+ onChange: (c) => n(c.target.checked),
666
+ disabled: r
667
+ }
668
+ ),
669
+ "Customizar"
670
+ ] }),
671
+ o ? /* @__PURE__ */ l("div", { className: "palette-selector__custom", children: Se.map((c) => /* @__PURE__ */ E("div", { className: "palette-selector__row", children: [
672
+ /* @__PURE__ */ l("span", { className: "palette-selector__row-label", children: c.label }),
673
+ /* @__PURE__ */ l("div", { className: "palette-selector__row-slots", children: c.slots.map((u) => {
674
+ const m = f[u];
675
+ return /* @__PURE__ */ l(
676
+ "input",
677
+ {
678
+ type: "color",
679
+ className: "palette-selector__color-input",
680
+ value: i[m] || "#000000",
681
+ onChange: (_) => g(m, _.target.value),
682
+ disabled: r,
683
+ title: oe[u]
684
+ },
685
+ u
686
+ );
687
+ }) })
688
+ ] }, c.label)) }) : /* @__PURE__ */ l("div", { className: "palette-selector__options", children: Object.entries(M).map(([c, u]) => {
689
+ const m = N(u.colors);
690
+ return /* @__PURE__ */ E(
691
+ "button",
692
+ {
693
+ className: `palette-selector__option ${d === c ? "palette-selector__option--active" : ""}`,
694
+ onClick: () => t(u.colors),
695
+ disabled: r,
696
+ children: [
697
+ /* @__PURE__ */ l("div", { className: "palette-selector__bar", children: ce(u.colors).map((_, T) => /* @__PURE__ */ l(
698
+ "span",
699
+ {
700
+ className: "palette-selector__swatch",
701
+ style: { backgroundColor: _ }
702
+ },
703
+ T
704
+ )) }),
705
+ /* @__PURE__ */ l("div", { className: "palette-selector__bar palette-selector__bar--theme", children: he.map((_, T) => /* @__PURE__ */ l(
706
+ "span",
707
+ {
708
+ className: "palette-selector__swatch",
709
+ style: { backgroundColor: m[_] }
710
+ },
711
+ T
712
+ )) }),
713
+ /* @__PURE__ */ l("span", { className: "palette-selector__label", children: u.label })
714
+ ]
715
+ },
716
+ c
717
+ );
718
+ }) })
719
+ ] });
720
+ }
721
+ export {
722
+ $e as $,
723
+ re as A,
724
+ je as B,
725
+ bt as C,
726
+ mt as D,
727
+ He as E,
728
+ ke as F,
729
+ C as G,
730
+ Be as H,
731
+ Re as I,
732
+ Pe as J,
733
+ qe as K,
734
+ Ve as L,
735
+ U as M,
736
+ le as N,
737
+ ue as O,
738
+ ie as P,
739
+ W as Q,
740
+ xe as R,
741
+ pt as S,
742
+ Fe as T,
743
+ Ge as U,
744
+ ze as V,
745
+ fe as W,
746
+ Ue as X,
747
+ We as Y,
748
+ de as Z,
749
+ nt as _,
750
+ Ae as a,
751
+ M as a0,
752
+ se as a1,
753
+ f as a2,
754
+ oe as a3,
755
+ A as a4,
756
+ Ye as a5,
757
+ Oe as a6,
758
+ _e as a7,
759
+ N as a8,
760
+ B as a9,
761
+ ct as aa,
762
+ it as ab,
763
+ D as ac,
764
+ dt as ad,
765
+ ye as ae,
766
+ Je as b,
767
+ Xe as c,
768
+ Ze as d,
769
+ tt as e,
770
+ Ne as f,
771
+ be as g,
772
+ gt as h,
773
+ et as i,
774
+ ft as j,
775
+ at as k,
776
+ lt as l,
777
+ ut as m,
778
+ ot as n,
779
+ rt as o,
780
+ st as p,
781
+ ce as q,
782
+ Me as r,
783
+ Ce as s,
784
+ Ke as t,
785
+ Qe as u,
786
+ R as v,
787
+ I as w,
788
+ P as x,
789
+ Ie as y,
790
+ ve as z
791
+ };
792
+ //# sourceMappingURL=ColorPaletteSelector-Ddcuobr5.js.map