@actionexec/dashboards 0.14.1 → 0.16.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.
@@ -1,42 +1,42 @@
1
- import { jsx as u, jsxs as E } from "react/jsx-runtime";
2
- import te from "react-datepicker";
3
- import { useState as x, useRef as U, useMemo as G, useLayoutEffect as ae, useEffect as ne } from "react";
4
- import { createPortal as re } from "react-dom";
5
- const se = "https://action-data-api-7mbrztperq-rj.a.run.app", W = "/external/dashboards", C = "/external/statements";
6
- let H = se;
7
- function Ae(e) {
8
- H = e.replace(/\/$/, "");
9
- }
10
- class oe extends Error {
11
- constructor(t, a, n) {
12
- super(t), this.status = a, this.payload = n, this.name = "ApiError";
1
+ import { jsx as u, jsxs as S } from "react/jsx-runtime";
2
+ import se from "react-datepicker";
3
+ import { useState as R, useRef as H, useMemo as j, useLayoutEffect as oe, useEffect as ce } from "react";
4
+ import { createPortal as ie } from "react-dom";
5
+ const le = "https://action-data-api-7mbrztperq-rj.a.run.app", V = "/external/dashboards", C = "/external/statements";
6
+ let J = le;
7
+ function Fe(e) {
8
+ J = e.replace(/\/$/, "");
9
+ }
10
+ class ue extends Error {
11
+ constructor(t, n, a) {
12
+ super(t), this.status = n, this.payload = a, this.name = "ApiError";
13
13
  }
14
14
  }
15
- async function B(e, t, a, n) {
16
- const r = new URL(`${H}${e}${t}`);
17
- if (n)
18
- for (const [c, l] of Object.entries(n)) r.searchParams.set(c, l);
19
- const o = await fetch(r.toString(), {
20
- headers: { Authorization: `Bearer ${a}` }
15
+ async function X(e, t, n, a) {
16
+ const r = new URL(`${J}${e}${t}`);
17
+ if (a)
18
+ for (const [c, i] of Object.entries(a)) r.searchParams.set(c, i);
19
+ const s = await fetch(r.toString(), {
20
+ headers: { Authorization: `Bearer ${n}` }
21
21
  });
22
- if (!o.ok) {
22
+ if (!s.ok) {
23
23
  let c;
24
24
  try {
25
- c = await o.json();
25
+ c = await s.json();
26
26
  } catch {
27
27
  }
28
- throw new oe(
29
- `Requisicao falhou (${o.status}) em ${t}`,
30
- o.status,
28
+ throw new ue(
29
+ `Requisicao falhou (${s.status}) em ${t}`,
30
+ s.status,
31
31
  c
32
32
  );
33
33
  }
34
- return o;
34
+ return s;
35
35
  }
36
- async function O(e, t, a, n) {
37
- return await (await B(e, t, a, n)).json();
36
+ async function x(e, t, n, a) {
37
+ return await (await X(e, t, n, a)).json();
38
38
  }
39
- const Me = (e) => O(W, "/layout", e), Oe = (e, t) => O(W, "/render", e, t), Re = (e) => O(C, "/layout", e), xe = (e, t) => O(C, "/render", e, t), Pe = async (e, t) => (await B(C, "/pdf", e, t)).blob(), d = {
39
+ const Ie = (e) => x(V, "/layout", e), Ce = (e, t) => x(V, "/render", e, t), ke = (e) => x(C, "/layout", e), ve = (e, t) => x(C, "/render", e, t), Ue = async (e, t) => (await X(C, "/pdf", e, t)).blob(), d = {
40
40
  series0: 0,
41
41
  series1: 1,
42
42
  series2: 2,
@@ -54,7 +54,7 @@ const Me = (e) => O(W, "/layout", e), Oe = (e, t) => O(W, "/render", e, t), Re =
54
54
  // trocar a cor de uma serie mudar o significado semantico de "atencao".
55
55
  warning: 13,
56
56
  info: 14
57
- }, ce = 5, A = 15, ie = {
57
+ }, fe = 5, O = 15, de = {
58
58
  series0: "Série 1",
59
59
  series1: "Série 2",
60
60
  series2: "Série 3",
@@ -70,7 +70,7 @@ const Me = (e) => O(W, "/layout", e), Oe = (e, t) => O(W, "/render", e, t), Re =
70
70
  error: "Erro",
71
71
  warning: "Alerta",
72
72
  info: "Informação"
73
- }, M = {
73
+ }, $ = {
74
74
  action: {
75
75
  label: "Action",
76
76
  colors: [
@@ -171,20 +171,20 @@ const Me = (e) => O(W, "/layout", e), Oe = (e, t) => O(W, "/render", e, t), Re =
171
171
  "#8b5cf6"
172
172
  ]
173
173
  }
174
- }, j = M.action.colors;
175
- function N(e) {
176
- const t = j;
174
+ }, B = $.action.colors;
175
+ function M(e) {
176
+ const t = B;
177
177
  if (!e || e.length === 0) return [...t];
178
- if (e.length >= A) return e.slice(0, A);
179
- const a = [...e];
180
- for (let n = e.length; n < A; n++) a.push(t[n]);
181
- return a;
178
+ if (e.length >= O) return e.slice(0, O);
179
+ const n = [...e];
180
+ for (let a = e.length; a < O; a++) n.push(t[a]);
181
+ return n;
182
182
  }
183
- function le(e) {
184
- return N(e).slice(0, ce);
183
+ function ge(e) {
184
+ return M(e).slice(0, fe);
185
185
  }
186
- function Ce(e) {
187
- const t = N(e);
186
+ function Ye(e) {
187
+ const t = M(e);
188
188
  return {
189
189
  "--bg-dark": t[d.bgDark],
190
190
  "--bg-paper": t[d.bgPaper],
@@ -202,11 +202,11 @@ function Ce(e) {
202
202
  "--action-green": t[d.success]
203
203
  };
204
204
  }
205
- const ue = j, fe = 30, de = 10, Ie = {
206
- gridColumns: fe,
207
- gridRows: de,
205
+ const me = B, pe = 30, be = 10, Ge = {
206
+ gridColumns: pe,
207
+ gridRows: be,
208
208
  widgets: []
209
- }, Fe = {
209
+ }, We = {
210
210
  kpi_card: "Card",
211
211
  gauge: "Gauge",
212
212
  chart: "Gráfico",
@@ -215,39 +215,39 @@ const ue = j, fe = 30, de = 10, Ie = {
215
215
  filter: "Filtro",
216
216
  variable: "Variável",
217
217
  color_palette: "Paleta de Cores"
218
- }, ve = ["kpi_card", "gauge", "chart", "composition", "table"], $e = ["filter", "variable", "color_palette"], ke = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), Ue = {
218
+ }, He = ["kpi_card", "gauge", "chart", "composition", "table"], je = ["filter", "variable", "color_palette"], ze = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), qe = {
219
219
  day: ["dia", "dias"],
220
220
  week: ["semana", "semanas"],
221
221
  month: ["mês", "meses"],
222
222
  quarter: ["trimestre", "trimestres"],
223
223
  year: ["ano", "anos"]
224
- }, Ge = ["período", "períodos"], Ye = {
224
+ }, Ve = ["período", "períodos"], Je = {
225
225
  sum: "Soma",
226
226
  avg: "Média",
227
227
  count: "Contagem",
228
228
  min: "Mínimo",
229
229
  max: "Máximo",
230
230
  count_distinct: "Contagem Distinta"
231
- }, ge = {
231
+ }, _e = {
232
232
  currency: "Moeda (R$)",
233
233
  number: "Número",
234
234
  integer: "Inteiro",
235
235
  percentage: "Porcentagem",
236
236
  date: "Data",
237
237
  text: "Texto"
238
- }, We = Object.entries(ge).filter(([e]) => e !== "date" && e !== "text"), He = {
238
+ }, Xe = Object.entries(_e).filter(([e]) => e !== "date" && e !== "text"), Be = {
239
239
  variance: "Variação %",
240
240
  difference: "Diferença",
241
241
  ratio: "Proporção",
242
242
  value: "Base"
243
- }, Be = {
243
+ }, Ke = {
244
244
  scroll: "Rolar",
245
245
  clip: "Cortar"
246
- }, je = {
246
+ }, Qe = {
247
247
  higher: "Positivo",
248
248
  lower: "Negativo",
249
249
  neutral: "Neutro"
250
- }, ze = {
250
+ }, Ze = {
251
251
  eq: "Igual a",
252
252
  neq: "Diferente de",
253
253
  in: "Está entre os valores",
@@ -261,21 +261,21 @@ const ue = j, fe = 30, de = 10, Ie = {
261
261
  not_contains: "Não contém",
262
262
  is_empty: "Está vazio",
263
263
  not_empty: "Não está vazio"
264
- }, qe = ["is_empty", "not_empty"], Ve = ["in", "not_in"], Je = {
264
+ }, et = ["is_empty", "not_empty"], tt = ["in", "not_in"], nt = {
265
265
  bar: "Barras",
266
266
  line: "Linhas",
267
267
  area: "Área"
268
- }, Xe = {
268
+ }, at = {
269
269
  pie: "Pizza",
270
270
  bridge: "Ponte"
271
- }, Ke = {
271
+ }, rt = {
272
272
  descending: "Descendente",
273
273
  ascending: "Ascendente"
274
- }, Qe = {
274
+ }, st = {
275
275
  date_range: "Periodo",
276
276
  select: "Seleção Única",
277
277
  multi_select: "Seleção Múltipla"
278
- }, Y = "", Ze = {
278
+ }, z = "", ot = {
279
279
  kpi_card: { x: 0, y: 0, w: 6, h: 3 },
280
280
  gauge: { x: 0, y: 0, w: 6, h: 5 },
281
281
  chart: { x: 0, y: 0, w: 6, h: 6 },
@@ -284,7 +284,7 @@ const ue = j, fe = 30, de = 10, Ie = {
284
284
  filter: { x: 0, y: 0, w: 4, h: 2 },
285
285
  variable: { x: 0, y: 0, w: 4, h: 2 },
286
286
  color_palette: { x: 0, y: 0, w: 4, h: 2 }
287
- }, et = {
287
+ }, ct = {
288
288
  kpi_card: { label: "Novo card", aggregation: "sum", format: "number" },
289
289
  gauge: { label: "Novo Gauge", aggregation: "sum" },
290
290
  chart: { label: "Novo gráfico", chartType: "bar", xAxis: { column: "", granularity: "day" }, series: [] },
@@ -297,59 +297,59 @@ const ue = j, fe = 30, de = 10, Ie = {
297
297
  table: { label: "Nova Tabela", columns: [] },
298
298
  filter: { label: "Novo Filtro", filterType: "select" },
299
299
  variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
300
- color_palette: { label: "Paleta de Cores", paletteColors: ue, locked: !1 }
301
- }, I = 6, F = 16, v = 1, P = 24, me = 80, pe = (e, t, a) => Math.min(Math.max(e, t), a), S = (e) => Number.isFinite(e) && e > 0;
302
- function tt(e, t, a = I, n = F) {
303
- if (!S(t) || !Number.isFinite(e)) return 0;
304
- const r = e - n * 2 - a * (t - 1);
300
+ color_palette: { label: "Paleta de Cores", paletteColors: me, locked: !1 }
301
+ }, k = 6, v = 16, U = 1, I = 24, he = 80, Ee = (e, t, n) => Math.min(Math.max(e, t), n), T = (e) => Number.isFinite(e) && e > 0;
302
+ function it(e, t, n = k, a = v) {
303
+ if (!T(t) || !Number.isFinite(e)) return 0;
304
+ const r = e - a * 2 - n * (t - 1);
305
305
  return Math.max(0, r / t);
306
306
  }
307
- function at(e, t = v) {
308
- return !S(e) || !S(t) ? P : pe(e / t, P, me);
307
+ function lt(e, t = U) {
308
+ return !T(e) || !T(t) ? I : Ee(e / t, I, he);
309
309
  }
310
- function nt(e, t, a = I, n = F) {
311
- return e <= 0 ? n * 2 : e * t + (e - 1) * a + n * 2;
310
+ function ut(e, t, n = k, a = v) {
311
+ return e <= 0 ? a * 2 : e * t + (e - 1) * n + a * 2;
312
312
  }
313
- function rt(e, t, a = v) {
314
- return !S(e) || !S(t) || !S(a) ? 1 : e * a / t;
313
+ function ft(e, t, n = U) {
314
+ return !T(e) || !T(t) || !T(n) ? 1 : e * n / t;
315
315
  }
316
- function st(e, t = v, a = I, n = F) {
317
- return !S(e) || !S(t) ? 0 : P * t * e + a * (e - 1) + n * 2;
316
+ function dt(e, t = U, n = k, a = v) {
317
+ return !T(e) || !T(t) ? 0 : I * t * e + n * (e - 1) + a * 2;
318
318
  }
319
- const D = "pt-BR", be = 100, _e = /* @__PURE__ */ new Set(["currency", "number", "integer", "percentage"]);
320
- function ot(e) {
321
- return !!e && _e.has(e);
319
+ const A = "pt-BR", Se = 100, Te = /* @__PURE__ */ new Set(["currency", "number", "integer", "percentage"]);
320
+ function gt(e) {
321
+ return !!e && Te.has(e);
322
322
  }
323
- function z(e) {
323
+ function K(e) {
324
324
  if (e == null || e === "") return null;
325
325
  const t = typeof e == "number" ? e : Number(e);
326
326
  return Number.isFinite(t) ? t : null;
327
327
  }
328
- function he(e, t, a = "-") {
329
- if (e == null || e === "") return a;
330
- const n = z(e);
331
- if (n === null) return String(e);
328
+ function we(e, t, n = "-") {
329
+ if (e == null || e === "") return n;
330
+ const a = K(e);
331
+ if (a === null) return String(e);
332
332
  switch (t) {
333
333
  case "currency":
334
- return n.toLocaleString(D, { style: "currency", currency: "BRL" });
334
+ return a.toLocaleString(A, { style: "currency", currency: "BRL" });
335
335
  case "integer":
336
- return Math.round(n).toLocaleString(D);
336
+ return Math.round(a).toLocaleString(A);
337
337
  case "percentage":
338
- return `${(n * be).toLocaleString(D, { maximumFractionDigits: 1 })}%`;
338
+ return `${(a * Se).toLocaleString(A, { maximumFractionDigits: 1 })}%`;
339
339
  case "number":
340
- return n.toLocaleString(D, { maximumFractionDigits: 2 });
340
+ return a.toLocaleString(A, { maximumFractionDigits: 2 });
341
341
  default:
342
342
  return String(e);
343
343
  }
344
344
  }
345
- function ct(e, t) {
346
- const a = z(e);
347
- if (a === null) return "-";
348
- if (t === "percentage") return he(a, "percentage");
349
- const n = t === "currency" ? "R$ " : "", r = Math.abs(a);
350
- 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(D, { maximumFractionDigits: 2 })}`;
345
+ function mt(e, t) {
346
+ const n = K(e);
347
+ if (n === null) return "-";
348
+ if (t === "percentage") return we(n, "percentage");
349
+ const a = t === "currency" ? "R$ " : "", r = Math.abs(n);
350
+ return r >= 1e9 ? `${a}${(n / 1e9).toFixed(1)}B` : r >= 1e6 ? `${a}${(n / 1e6).toFixed(1)}M` : r >= 1e3 ? `${a}${(n / 1e3).toFixed(1)}K` : `${a}${n.toLocaleString(A, { maximumFractionDigits: 2 })}`;
351
351
  }
352
- const it = [
352
+ const ye = [
353
353
  "Jan",
354
354
  "Fev",
355
355
  "Mar",
@@ -362,7 +362,7 @@ const it = [
362
362
  "Out",
363
363
  "Nov",
364
364
  "Dez"
365
- ], lt = [
365
+ ], pt = [
366
366
  "Janeiro",
367
367
  "Fevereiro",
368
368
  "Marco",
@@ -376,105 +376,155 @@ const it = [
376
376
  "Novembro",
377
377
  "Dezembro"
378
378
  ];
379
- function ut(e) {
379
+ function bt(e) {
380
380
  return { start: `${e}-01-01`, end: `${e}-12-31` };
381
381
  }
382
- function ft(e) {
382
+ function _t(e) {
383
383
  if (!e) return null;
384
384
  const t = e.match(/^(\d{4})/);
385
385
  return t ? { year: parseInt(t[1]) } : null;
386
386
  }
387
- function dt(e, t) {
388
- const a = new Date(e, t, 0).getDate(), n = (r) => String(r).padStart(2, "0");
387
+ function De(e, t) {
388
+ const n = new Date(e, t, 0).getDate(), a = (r) => String(r).padStart(2, "0");
389
389
  return {
390
- start: `${e}-${n(t)}-01`,
391
- end: `${e}-${n(t)}-${n(a)}`
390
+ start: `${e}-${a(t)}-01`,
391
+ end: `${e}-${a(t)}-${a(n)}`
392
392
  };
393
393
  }
394
- function q(e) {
394
+ function Y(e) {
395
395
  const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()));
396
396
  t.setUTCDate(t.getUTCDate() + 4 - (t.getUTCDay() || 7));
397
- const a = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
398
- return Math.ceil(((t.getTime() - a.getTime()) / 864e5 + 1) / 7);
399
- }
400
- function gt(e, t) {
401
- 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), c = new Date(o.getTime() + 6 * 864e5), l = (b) => String(b).padStart(2, "0"), g = (b) => `${b.getFullYear()}-${l(b.getMonth() + 1)}-${l(b.getDate())}`;
402
- return { start: g(o), end: g(c) };
403
- }
404
- function mt(e, t) {
405
- const a = /* @__PURE__ */ new Set(), n = new Date(e, t, 0).getDate();
406
- for (let r = 1; r <= n; r++)
407
- a.add(q(new Date(e, t - 1, r)));
408
- return Array.from(a).sort((r, o) => r - o);
409
- }
410
- function pt(e, t) {
411
- const a = new Date(e, t, 0).getDate(), n = (l) => String(l).padStart(2, "0"), r = [];
412
- let o = 1, c = 1;
413
- for (; o <= a; ) {
414
- const l = o, g = Math.min(o + 6, a), b = `${e}-${n(t)}-${n(l)}`, i = `${e}-${n(t)}-${n(g)}`, f = `${c}° Semana (${n(l)}/${n(t)} - ${n(g)}/${n(t)})`;
415
- r.push({ index: c, startDay: l, endDay: g, start: b, end: i, label: f }), o = g + 1, c++;
397
+ const n = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
398
+ return Math.ceil(((t.getTime() - n.getTime()) / 864e5 + 1) / 7);
399
+ }
400
+ function ht(e, t) {
401
+ const n = new Date(e, 0, 4), a = (n.getDay() + 6) % 7, r = new Date(n.getTime() - a * 864e5), s = new Date(r.getTime() + (t - 1) * 7 * 864e5), c = new Date(s.getTime() + 6 * 864e5), i = (b) => String(b).padStart(2, "0"), g = (b) => `${b.getFullYear()}-${i(b.getMonth() + 1)}-${i(b.getDate())}`;
402
+ return { start: g(s), end: g(c) };
403
+ }
404
+ function Et(e, t) {
405
+ const n = /* @__PURE__ */ new Set(), a = new Date(e, t, 0).getDate();
406
+ for (let r = 1; r <= a; r++)
407
+ n.add(Y(new Date(e, t - 1, r)));
408
+ return Array.from(n).sort((r, s) => r - s);
409
+ }
410
+ function St(e, t) {
411
+ const n = new Date(e, t, 0).getDate(), a = (i) => String(i).padStart(2, "0"), r = [];
412
+ let s = 1, c = 1;
413
+ for (; s <= n; ) {
414
+ const i = s, g = Math.min(s + 6, n), b = `${e}-${a(t)}-${a(i)}`, l = `${e}-${a(t)}-${a(g)}`, f = `${c}° Semana (${a(i)}/${a(t)} - ${a(g)}/${a(t)})`;
415
+ r.push({ index: c, startDay: i, endDay: g, start: b, end: l, label: f }), s = g + 1, c++;
416
416
  }
417
417
  return r;
418
418
  }
419
- function bt(e, t, a) {
419
+ function Tt(e, t, n) {
420
420
  if (!e) return 1;
421
- const n = (c) => String(c).padStart(2, "0"), r = e.match(new RegExp(`^${t}-${n(a)}-(\\d{2})`));
421
+ const a = (c) => String(c).padStart(2, "0"), r = e.match(new RegExp(`^${t}-${a(n)}-(\\d{2})`));
422
422
  if (!r) return 1;
423
- const o = parseInt(r[1]);
424
- return Math.ceil(o / 7);
423
+ const s = parseInt(r[1]);
424
+ return Math.ceil(s / 7);
425
425
  }
426
- function _t(e) {
426
+ function wt(e) {
427
427
  if (!e) return null;
428
428
  const t = e.match(/^(\d{4})-(\d{2})/);
429
429
  return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
430
430
  }
431
- function ht(e) {
431
+ function yt(e) {
432
432
  if (!e) return null;
433
433
  const t = /* @__PURE__ */ new Date(e + "T00:00:00");
434
- return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: q(t) };
434
+ return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: Y(t) };
435
435
  }
436
- function Et(e) {
437
- 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 = [];
438
- for (let o = n; o >= a; o--) r.push(o);
436
+ function Dt(e) {
437
+ const t = /* @__PURE__ */ new Date(), n = e != null && e.min ? parseInt(e.min.slice(0, 4)) : t.getFullYear() - 2, a = e != null && e.max ? parseInt(e.max.slice(0, 4)) : t.getFullYear(), r = [];
438
+ for (let s = a; s >= n; s--) r.push(s);
439
439
  return r;
440
440
  }
441
- function y(e) {
441
+ const h = (e) => String(e).padStart(2, "0");
442
+ function L(e) {
443
+ return `${e.getFullYear()}-${h(e.getMonth() + 1)}-${h(e.getDate())}`;
444
+ }
445
+ function F(e) {
446
+ const [t, n, a] = e.split("-").map(Number);
447
+ return new Date(t, (n || 1) - 1, a || 1);
448
+ }
449
+ function q(e, t) {
450
+ const n = e.getFullYear();
451
+ if (t === "year")
452
+ return { key: `${n}`, label: `${n}`, start: `${n}-01-01`, end: `${n}-12-31` };
453
+ if (t === "month") {
454
+ const a = e.getMonth() + 1, r = De(n, a);
455
+ return {
456
+ key: `${n}-${h(a)}`,
457
+ label: `${ye[a - 1].toLowerCase()}/${h(n % 100)}`,
458
+ ...r
459
+ };
460
+ }
461
+ if (t === "week") {
462
+ const a = new Date(e.getTime() - (e.getDay() + 6) % 7 * 864e5), r = new Date(a.getTime() + 6 * 864e5), s = Y(a);
463
+ return {
464
+ key: `${a.getFullYear()}-W${h(s)}`,
465
+ label: `S${h(s)}/${h(a.getFullYear() % 100)}`,
466
+ start: L(a),
467
+ end: L(r)
468
+ };
469
+ }
470
+ return {
471
+ key: L(e),
472
+ label: `${h(e.getDate())}/${h(e.getMonth() + 1)}/${h(n % 100)}`,
473
+ start: L(e),
474
+ end: L(e)
475
+ };
476
+ }
477
+ const Le = 400;
478
+ function Lt(e, t) {
479
+ const n = /* @__PURE__ */ new Date(), a = t != null && t.min ? F(t.min) : new Date(n.getFullYear() - 1, 0, 1), r = t != null && t.max ? F(t.max) : n;
480
+ if (a > r) return [];
481
+ const s = [];
482
+ let c = q(r, e);
483
+ for (; s.length < Le; ) {
484
+ s.push(c);
485
+ const i = F(c.start);
486
+ if (i.setDate(i.getDate() - 1), i < a) break;
487
+ c = q(i, e);
488
+ }
489
+ return s;
490
+ }
491
+ function N(e) {
442
492
  if (!e) return null;
443
- const [t, a, n] = e.split("-").map(Number);
444
- return !t || !a || !n ? null : new Date(t, a - 1, n);
493
+ const [t, n, a] = e.split("-").map(Number);
494
+ return !t || !n || !a ? null : new Date(t, n - 1, a);
445
495
  }
446
- function Ee(e) {
496
+ function Ne(e) {
447
497
  if (!e) return "";
448
- const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
449
- return `${t}-${a}-${n}`;
498
+ const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), a = String(e.getDate()).padStart(2, "0");
499
+ return `${t}-${n}-${a}`;
450
500
  }
451
- function St({
501
+ function Nt({
452
502
  value: e,
453
503
  onChange: t,
454
- minIso: a,
455
- maxIso: n,
504
+ minIso: n,
505
+ maxIso: a,
456
506
  placeholder: r,
457
- selectsStart: o,
507
+ selectsStart: s,
458
508
  selectsEnd: c,
459
- startIso: l,
509
+ startIso: i,
460
510
  endIso: g,
461
511
  className: b,
462
- disabled: i
512
+ disabled: l
463
513
  }) {
464
514
  return /* @__PURE__ */ u("div", { className: `ddp-field ${b ?? ""}`, children: /* @__PURE__ */ u(
465
- te,
515
+ se,
466
516
  {
467
- selected: y(e),
468
- onChange: (f) => t(Ee(f)),
469
- selectsStart: o,
517
+ selected: N(e),
518
+ onChange: (f) => t(Ne(f)),
519
+ selectsStart: s,
470
520
  selectsEnd: c,
471
- startDate: y(l) ?? void 0,
472
- endDate: y(g) ?? void 0,
473
- minDate: y(a) ?? void 0,
474
- maxDate: y(n) ?? void 0,
521
+ startDate: N(i) ?? void 0,
522
+ endDate: N(g) ?? void 0,
523
+ minDate: N(n) ?? void 0,
524
+ maxDate: N(a) ?? void 0,
475
525
  dateFormat: "dd/MM/yyyy",
476
526
  placeholderText: r ?? "Selecione...",
477
- disabled: i,
527
+ disabled: l,
478
528
  portalId: "ddp-portal",
479
529
  popperPlacement: "bottom-start",
480
530
  popperModifiers: [
@@ -487,54 +537,54 @@ function St({
487
537
  }
488
538
  ) });
489
539
  }
490
- function Tt({ options: e, value: t, multi: a, onChange: n }) {
491
- const [r, o] = x(!1), [c, l] = x(""), [g, b] = x(null), i = U(null), f = U(null), m = G(
492
- () => t ? t.split(Y).filter(Boolean) : [],
540
+ function At({ options: e, value: t, multi: n, onChange: a }) {
541
+ const [r, s] = R(!1), [c, i] = R(""), [g, b] = R(null), l = H(null), f = H(null), m = j(
542
+ () => t ? t.split(z).filter(Boolean) : [],
493
543
  [t]
494
- ), _ = G(() => {
495
- const s = c.trim().toLowerCase();
496
- return s ? e.filter((p) => p.toLowerCase().includes(s)) : e;
497
- }, [e, c]), T = () => {
498
- const s = i.current;
499
- if (!s) return;
500
- const p = s.getBoundingClientRect(), h = 4, L = window.innerHeight - p.bottom - h, w = p.top - h, k = L < 200 && w > L, ee = Math.max(150, Math.min(360, k ? w : L));
544
+ ), _ = j(() => {
545
+ const o = c.trim().toLowerCase();
546
+ return o ? e.filter((p) => p.toLowerCase().includes(o)) : e;
547
+ }, [e, c]), w = () => {
548
+ const o = l.current;
549
+ if (!o) return;
550
+ const p = o.getBoundingClientRect(), E = 4, y = window.innerHeight - p.bottom - E, D = p.top - E, W = y < 200 && D > y, re = Math.max(150, Math.min(360, W ? D : y));
501
551
  b({
502
552
  left: p.left,
503
553
  width: p.width,
504
- maxHeight: ee,
505
- ...k ? { bottom: window.innerHeight - p.top + h } : { top: p.bottom + h }
554
+ maxHeight: re,
555
+ ...W ? { bottom: window.innerHeight - p.top + E } : { top: p.bottom + E }
506
556
  });
507
557
  };
508
- ae(() => {
558
+ oe(() => {
509
559
  if (!r) return;
510
- T();
511
- const s = () => T();
512
- return window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
513
- window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
560
+ w();
561
+ const o = () => w();
562
+ return window.addEventListener("scroll", o, !0), window.addEventListener("resize", o), () => {
563
+ window.removeEventListener("scroll", o, !0), window.removeEventListener("resize", o);
514
564
  };
515
- }, [r]), ne(() => {
565
+ }, [r]), ce(() => {
516
566
  if (!r) return;
517
- const s = (p) => {
518
- var L, w;
519
- const h = p.target;
520
- (L = i.current) != null && L.contains(h) || (w = f.current) != null && w.contains(h) || o(!1);
567
+ const o = (p) => {
568
+ var y, D;
569
+ const E = p.target;
570
+ (y = l.current) != null && y.contains(E) || (D = f.current) != null && D.contains(E) || s(!1);
521
571
  };
522
- return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
572
+ return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
523
573
  }, [r]);
524
- const V = () => {
525
- o(!1), l("");
526
- }, R = (s) => {
574
+ const Q = () => {
575
+ s(!1), i("");
576
+ }, P = (o) => {
527
577
  var p;
528
- n(s), l(""), o(!1), (p = i.current) == null || p.blur();
529
- }, $ = (s) => {
530
- const p = m.includes(s) ? m.filter((h) => h !== s) : [...m, s];
531
- n(p.join(Y));
532
- }, J = () => {
533
- o(!0), a || l("");
534
- }, X = (s) => {
578
+ a(o), i(""), s(!1), (p = l.current) == null || p.blur();
579
+ }, G = (o) => {
580
+ const p = m.includes(o) ? m.filter((E) => E !== o) : [...m, o];
581
+ a(p.join(z));
582
+ }, Z = () => {
583
+ s(!0), n || i("");
584
+ }, ee = (o) => {
535
585
  var p;
536
- s.key === "Escape" ? (V(), (p = i.current) == null || p.blur()) : s.key === "Enter" && _.length > 0 && (s.preventDefault(), a ? ($(_[0]), l("")) : R(_[0]));
537
- }, K = a || r ? c : t || "", Q = a && m.length > 0 ? `${m.length} selecionado(s)` : r ? "Buscar..." : "Todos", Z = r && g ? re(
586
+ o.key === "Escape" ? (Q(), (p = l.current) == null || p.blur()) : o.key === "Enter" && _.length > 0 && (o.preventDefault(), n ? (G(_[0]), i("")) : P(_[0]));
587
+ }, te = n || r ? c : t || "", ne = n && m.length > 0 ? `${m.length} selecionado(s)` : r ? "Buscar..." : "Todos", ae = r && g ? ie(
538
588
  /* @__PURE__ */ u(
539
589
  "div",
540
590
  {
@@ -548,22 +598,22 @@ function Tt({ options: e, value: t, multi: a, onChange: n }) {
548
598
  bottom: g.bottom,
549
599
  maxHeight: g.maxHeight
550
600
  },
551
- children: /* @__PURE__ */ E("div", { className: "widget-filter__search-list", children: [
552
- a && m.length > 0 && /* @__PURE__ */ u(
601
+ children: /* @__PURE__ */ S("div", { className: "widget-filter__search-list", children: [
602
+ n && m.length > 0 && /* @__PURE__ */ u(
553
603
  "button",
554
604
  {
555
605
  type: "button",
556
606
  className: "widget-filter__search-clear",
557
- onClick: () => n(""),
607
+ onClick: () => a(""),
558
608
  children: "Limpar seleção"
559
609
  }
560
610
  ),
561
- !a && /* @__PURE__ */ E(
611
+ !n && /* @__PURE__ */ S(
562
612
  "button",
563
613
  {
564
614
  type: "button",
565
615
  className: `widget-filter__search-option${t ? "" : " is-selected"}`,
566
- onClick: () => R(""),
616
+ onClick: () => P(""),
567
617
  children: [
568
618
  /* @__PURE__ */ u("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ? "" : "✓" }),
569
619
  "Todos"
@@ -571,35 +621,35 @@ function Tt({ options: e, value: t, multi: a, onChange: n }) {
571
621
  }
572
622
  ),
573
623
  _.length === 0 ? /* @__PURE__ */ u("span", { className: "widget-filter__search-empty", children: "Nenhuma opção" }) : _.map(
574
- (s) => a ? /* @__PURE__ */ E(
624
+ (o) => n ? /* @__PURE__ */ S(
575
625
  "label",
576
626
  {
577
- className: `widget-filter__search-option${m.includes(s) ? " is-selected" : ""}`,
627
+ className: `widget-filter__search-option${m.includes(o) ? " is-selected" : ""}`,
578
628
  children: [
579
629
  /* @__PURE__ */ u(
580
630
  "input",
581
631
  {
582
632
  type: "checkbox",
583
- checked: m.includes(s),
584
- onChange: () => $(s)
633
+ checked: m.includes(o),
634
+ onChange: () => G(o)
585
635
  }
586
636
  ),
587
- s
637
+ o
588
638
  ]
589
639
  },
590
- s
591
- ) : /* @__PURE__ */ E(
640
+ o
641
+ ) : /* @__PURE__ */ S(
592
642
  "button",
593
643
  {
594
644
  type: "button",
595
- className: `widget-filter__search-option${t === s ? " is-selected" : ""}`,
596
- onClick: () => R(s),
645
+ className: `widget-filter__search-option${t === o ? " is-selected" : ""}`,
646
+ onClick: () => P(o),
597
647
  children: [
598
- /* @__PURE__ */ u("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t === s ? "✓" : "" }),
599
- s
648
+ /* @__PURE__ */ u("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t === o ? "✓" : "" }),
649
+ o
600
650
  ]
601
651
  },
602
- s
652
+ o
603
653
  )
604
654
  )
605
655
  ] })
@@ -607,76 +657,76 @@ function Tt({ options: e, value: t, multi: a, onChange: n }) {
607
657
  ),
608
658
  document.body
609
659
  ) : null;
610
- return /* @__PURE__ */ E("div", { className: "widget-filter__search", children: [
660
+ return /* @__PURE__ */ S("div", { className: "widget-filter__search", children: [
611
661
  /* @__PURE__ */ u(
612
662
  "input",
613
663
  {
614
- ref: i,
664
+ ref: l,
615
665
  type: "text",
616
666
  className: "widget-filter__search-field",
617
- value: K,
618
- placeholder: Q,
619
- onFocus: J,
620
- onClick: () => o(!0),
621
- onChange: (s) => {
622
- l(s.target.value), o(!0);
667
+ value: te,
668
+ placeholder: ne,
669
+ onFocus: Z,
670
+ onClick: () => s(!0),
671
+ onChange: (o) => {
672
+ i(o.target.value), s(!0);
623
673
  },
624
- onKeyDown: X
674
+ onKeyDown: ee
625
675
  }
626
676
  ),
627
- Z
677
+ ae
628
678
  ] });
629
679
  }
630
- const Se = [
680
+ const Ae = [
631
681
  d.bgDark,
632
682
  d.bgPaper,
633
683
  d.bgElevated,
634
684
  d.accent,
635
685
  d.success
636
686
  ];
637
- function Te(e) {
687
+ function Me(e) {
638
688
  if (!e) return !0;
639
- const t = N(e);
640
- return Object.values(M).some(
641
- (a) => JSON.stringify(a.colors) === JSON.stringify(t)
689
+ const t = M(e);
690
+ return Object.values($).some(
691
+ (n) => JSON.stringify(n.colors) === JSON.stringify(t)
642
692
  );
643
693
  }
644
- const Le = [
694
+ const Oe = [
645
695
  { label: "Series", slots: ["series0", "series1", "series2", "series3", "series4"] },
646
696
  { label: "Tema", slots: ["bgDark", "bgPaper", "bgElevated", "textPrimary", "textMuted"] },
647
697
  { label: "Estados", slots: ["accent", "success", "error"] }
648
698
  ];
649
- function Lt({
699
+ function Mt({
650
700
  selected: e,
651
701
  onSelect: t,
652
- customMode: a,
653
- onCustomModeChange: n,
702
+ customMode: n,
703
+ onCustomModeChange: a,
654
704
  disabled: r
655
705
  }) {
656
706
  var b;
657
- const o = a ?? !Te(e), c = N(e), l = o || (b = Object.entries(M).find(
658
- ([, i]) => JSON.stringify(i.colors) === JSON.stringify(c)
659
- )) == null ? void 0 : b[0], g = (i, f) => {
707
+ const s = n ?? !Me(e), c = M(e), i = s || (b = Object.entries($).find(
708
+ ([, l]) => JSON.stringify(l.colors) === JSON.stringify(c)
709
+ )) == null ? void 0 : b[0], g = (l, f) => {
660
710
  const m = [...c];
661
- for (; m.length < A; ) m.push("#000000");
662
- m[i] = f, t(m);
711
+ for (; m.length < O; ) m.push("#000000");
712
+ m[l] = f, t(m);
663
713
  };
664
- return /* @__PURE__ */ E("div", { className: `palette-selector ${r ? "palette-selector--disabled" : ""}`, children: [
665
- n && /* @__PURE__ */ E("label", { className: "config-panel__checkbox", children: [
714
+ return /* @__PURE__ */ S("div", { className: `palette-selector ${r ? "palette-selector--disabled" : ""}`, children: [
715
+ a && /* @__PURE__ */ S("label", { className: "config-panel__checkbox", children: [
666
716
  /* @__PURE__ */ u(
667
717
  "input",
668
718
  {
669
719
  type: "checkbox",
670
- checked: o,
671
- onChange: (i) => n(i.target.checked),
720
+ checked: s,
721
+ onChange: (l) => a(l.target.checked),
672
722
  disabled: r
673
723
  }
674
724
  ),
675
725
  "Customizar"
676
726
  ] }),
677
- o ? /* @__PURE__ */ u("div", { className: "palette-selector__custom", children: Le.map((i) => /* @__PURE__ */ E("div", { className: "palette-selector__row", children: [
678
- /* @__PURE__ */ u("span", { className: "palette-selector__row-label", children: i.label }),
679
- /* @__PURE__ */ u("div", { className: "palette-selector__row-slots", children: i.slots.map((f) => {
727
+ s ? /* @__PURE__ */ u("div", { className: "palette-selector__custom", children: Oe.map((l) => /* @__PURE__ */ S("div", { className: "palette-selector__row", children: [
728
+ /* @__PURE__ */ u("span", { className: "palette-selector__row-label", children: l.label }),
729
+ /* @__PURE__ */ u("div", { className: "palette-selector__row-slots", children: l.slots.map((f) => {
680
730
  const m = d[f];
681
731
  return /* @__PURE__ */ u(
682
732
  "input",
@@ -686,117 +736,118 @@ function Lt({
686
736
  value: c[m] || "#000000",
687
737
  onChange: (_) => g(m, _.target.value),
688
738
  disabled: r,
689
- title: ie[f]
739
+ title: de[f]
690
740
  },
691
741
  f
692
742
  );
693
743
  }) })
694
- ] }, i.label)) }) : /* @__PURE__ */ u("div", { className: "palette-selector__options", children: Object.entries(M).map(([i, f]) => {
695
- const m = N(f.colors);
696
- return /* @__PURE__ */ E(
744
+ ] }, l.label)) }) : /* @__PURE__ */ u("div", { className: "palette-selector__options", children: Object.entries($).map(([l, f]) => {
745
+ const m = M(f.colors);
746
+ return /* @__PURE__ */ S(
697
747
  "button",
698
748
  {
699
- className: `palette-selector__option ${l === i ? "palette-selector__option--active" : ""}`,
749
+ className: `palette-selector__option ${i === l ? "palette-selector__option--active" : ""}`,
700
750
  onClick: () => t(f.colors),
701
751
  disabled: r,
702
752
  children: [
703
- /* @__PURE__ */ u("div", { className: "palette-selector__bar", children: le(f.colors).map((_, T) => /* @__PURE__ */ u(
753
+ /* @__PURE__ */ u("div", { className: "palette-selector__bar", children: ge(f.colors).map((_, w) => /* @__PURE__ */ u(
704
754
  "span",
705
755
  {
706
756
  className: "palette-selector__swatch",
707
757
  style: { backgroundColor: _ }
708
758
  },
709
- T
759
+ w
710
760
  )) }),
711
- /* @__PURE__ */ u("div", { className: "palette-selector__bar palette-selector__bar--theme", children: Se.map((_, T) => /* @__PURE__ */ u(
761
+ /* @__PURE__ */ u("div", { className: "palette-selector__bar palette-selector__bar--theme", children: Ae.map((_, w) => /* @__PURE__ */ u(
712
762
  "span",
713
763
  {
714
764
  className: "palette-selector__swatch",
715
765
  style: { backgroundColor: m[_] }
716
766
  },
717
- T
767
+ w
718
768
  )) }),
719
769
  /* @__PURE__ */ u("span", { className: "palette-selector__label", children: f.label })
720
770
  ]
721
771
  },
722
- i
772
+ l
723
773
  );
724
774
  }) })
725
775
  ] });
726
776
  }
727
777
  export {
728
- Ve as $,
729
- Pe as A,
730
- oe as B,
731
- Lt as C,
732
- St as D,
733
- Ue as E,
734
- Ye as F,
735
- F as G,
736
- Ke as H,
737
- Je as I,
738
- He as J,
739
- Xe as K,
740
- $e as L,
741
- Y as M,
742
- ve as N,
743
- et as O,
744
- Ze as P,
745
- fe as Q,
746
- de as R,
747
- Tt as S,
748
- Ge as T,
749
- ue as U,
750
- j as V,
751
- Ie as W,
752
- ze as X,
753
- Qe as Y,
754
- ge as Z,
755
- je as _,
756
- Oe as a,
757
- me as a0,
758
- lt as a1,
759
- We as a2,
760
- M as a3,
761
- ce as a4,
762
- d as a5,
763
- ie as a6,
764
- Be as a7,
765
- A as a8,
766
- qe as a9,
767
- Fe as aa,
768
- Ee as ab,
769
- N as ac,
770
- q as ad,
771
- gt as ae,
772
- mt as af,
773
- y as ag,
774
- ht as ah,
775
- Ae as ai,
776
- tt as b,
777
- at as c,
778
- st as d,
779
- ct as e,
780
- Me as f,
781
- he as g,
782
- Et as h,
783
- ot as i,
784
- _t as j,
785
- it as k,
786
- pt as l,
787
- bt as m,
788
- dt as n,
789
- ut as o,
790
- ft as p,
791
- le as q,
792
- Ce as r,
793
- ke as s,
794
- nt as t,
795
- rt as u,
796
- I as v,
797
- v as w,
798
- P as x,
799
- Re as y,
800
- xe as z
778
+ Qe as $,
779
+ ve as A,
780
+ Ue as B,
781
+ Mt as C,
782
+ Nt as D,
783
+ ue as E,
784
+ qe as F,
785
+ v as G,
786
+ Je as H,
787
+ rt as I,
788
+ nt as J,
789
+ Be as K,
790
+ at as L,
791
+ z as M,
792
+ je as N,
793
+ He as O,
794
+ ct as P,
795
+ ot as Q,
796
+ pe as R,
797
+ At as S,
798
+ Ve as T,
799
+ be as U,
800
+ me as V,
801
+ B as W,
802
+ Ge as X,
803
+ Ze as Y,
804
+ st as Z,
805
+ _e as _,
806
+ Ce as a,
807
+ tt as a0,
808
+ he as a1,
809
+ pt as a2,
810
+ Xe as a3,
811
+ $ as a4,
812
+ fe as a5,
813
+ d as a6,
814
+ de as a7,
815
+ Ke as a8,
816
+ O as a9,
817
+ et as aa,
818
+ We as ab,
819
+ Ne as ac,
820
+ M as ad,
821
+ Y as ae,
822
+ ht as af,
823
+ Et as ag,
824
+ N as ah,
825
+ yt as ai,
826
+ Fe as aj,
827
+ it as b,
828
+ lt as c,
829
+ dt as d,
830
+ mt as e,
831
+ Ie as f,
832
+ we as g,
833
+ Dt as h,
834
+ gt as i,
835
+ wt as j,
836
+ ye as k,
837
+ St as l,
838
+ Tt as m,
839
+ De as n,
840
+ bt as o,
841
+ _t as p,
842
+ ge as q,
843
+ Lt as r,
844
+ Ye as s,
845
+ ze as t,
846
+ ut as u,
847
+ ft as v,
848
+ k as w,
849
+ U as x,
850
+ I as y,
851
+ ke as z
801
852
  };
802
- //# sourceMappingURL=ColorPaletteSelector-CZP3HDNJ.js.map
853
+ //# sourceMappingURL=ColorPaletteSelector-CxUQv9E9.js.map