@embeddable.com/remarkable-ui 0.1.18 → 0.1.19

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.
Files changed (81) hide show
  1. package/dist/BarChartDefaultHorizontalPro.js +3 -3
  2. package/dist/BarChartDefaultPro.js +3 -3
  3. package/dist/BarChartGroupedHorizontalPro.js +3 -3
  4. package/dist/BarChartGroupedPro.js +3 -3
  5. package/dist/BarChartStackedHorizontalPro.js +3 -3
  6. package/dist/BarChartStackedPro.js +3 -3
  7. package/dist/{BaseButton-BKojrsLP.js → BaseButton-CuifBVsc.js} +2 -2
  8. package/dist/{BaseButton-BKojrsLP.js.map → BaseButton-CuifBVsc.js.map} +1 -1
  9. package/dist/{ChartCard-DLb6o61U.js → ChartCard-BkrK3C4a.js} +28 -28
  10. package/dist/{ChartCard-DLb6o61U.js.map → ChartCard-BkrK3C4a.js.map} +1 -1
  11. package/dist/{ComparisonPeriod.type.emb-BK3kHVRE.js → ComparisonPeriod.type.emb-Cli9Gpzq.js} +2 -2
  12. package/dist/{ComparisonPeriod.type.emb-BK3kHVRE.js.map → ComparisonPeriod.type.emb-Cli9Gpzq.js.map} +1 -1
  13. package/dist/ComparisonPeriodSelectFieldPro.js +6 -6
  14. package/dist/DateRangeSelectFieldPro.js +2 -2
  15. package/dist/DonutChartPro.js +2 -2
  16. package/dist/DonutLabelChartPro.js +2 -2
  17. package/dist/{EditorCard-COw7ouX6.js → EditorCard-BQnDPFzf.js} +10 -10
  18. package/dist/{EditorCard-COw7ouX6.js.map → EditorCard-BQnDPFzf.js.map} +1 -1
  19. package/dist/{KpiChart-DhPJaw1n.js → KpiChart-ClxfTTJ4.js} +2 -2
  20. package/dist/{KpiChart-DhPJaw1n.js.map → KpiChart-ClxfTTJ4.js.map} +1 -1
  21. package/dist/KpiChartNumberComparisonPro.js +17 -17
  22. package/dist/KpiChartNumberPro.js +4 -4
  23. package/dist/MultiSelectFieldPro.js +2 -2
  24. package/dist/PieChartPro.js +2 -2
  25. package/dist/{SingleSelectField-BaBjHlCf.js → SingleSelectField-BAEvpk7-.js} +3 -3
  26. package/dist/{SingleSelectField-BaBjHlCf.js.map → SingleSelectField-BAEvpk7-.js.map} +1 -1
  27. package/dist/SingleSelectFieldPro.js +2 -2
  28. package/dist/charts.fillGaps.hooks-BvYoaRpE.js +584 -0
  29. package/dist/charts.fillGaps.hooks-BvYoaRpE.js.map +1 -0
  30. package/dist/{component.constants-DuGM1FcK.js → component.constants-CL4mGURD.js} +386 -375
  31. package/dist/{component.constants-DuGM1FcK.js.map → component.constants-CL4mGURD.js.map} +1 -1
  32. package/dist/embeddable-components.json +7 -7
  33. package/dist/embeddable-theme-2b917.js +4 -0
  34. package/dist/{formatter.utils-C_jDZCA9.js → formatter.utils-BaAiNARZ.js} +2 -2
  35. package/dist/{formatter.utils-C_jDZCA9.js.map → formatter.utils-BaAiNARZ.js.map} +1 -1
  36. package/dist/{index-0JzvLdB-.js → index-9t6SPE91.js} +9 -9
  37. package/dist/{index-0JzvLdB-.js.map → index-9t6SPE91.js.map} +1 -1
  38. package/dist/{index-CmclYpTi.js → index-BSbQYCwI.js} +11 -11
  39. package/dist/{index-CmclYpTi.js.map → index-BSbQYCwI.js.map} +1 -1
  40. package/dist/{index-FhjiEcWR.js → index-BUwm0Ul3.js} +6 -6
  41. package/dist/{index-FhjiEcWR.js.map → index-BUwm0Ul3.js.map} +1 -1
  42. package/dist/{index-C9-xJxxS.js → index-BehaWXq-.js} +4 -4
  43. package/dist/{index-C9-xJxxS.js.map → index-BehaWXq-.js.map} +1 -1
  44. package/dist/{index-7huUm47f.js → index-CAGJqsS8.js} +8 -8
  45. package/dist/{index-7huUm47f.js.map → index-CAGJqsS8.js.map} +1 -1
  46. package/dist/{index-CIbTA8lC.js → index-RqtiYv1c.js} +13 -13
  47. package/dist/{index-CIbTA8lC.js.map → index-RqtiYv1c.js.map} +1 -1
  48. package/dist/index.js +46 -44
  49. package/dist/index.js.map +1 -1
  50. package/dist/{object.utils-BKb2quG8.js → object.utils-CaoDr05j.js} +7 -3
  51. package/dist/object.utils-CaoDr05j.js.map +1 -0
  52. package/dist/{pies.utils-X76GGOGG.js → pies.utils-hekLAU_r.js} +4 -4
  53. package/dist/{pies.utils-X76GGOGG.js.map → pies.utils-hekLAU_r.js.map} +1 -1
  54. package/dist/remarkable-pro/index.d.ts +1 -0
  55. package/dist/remarkable-pro/index.d.ts.map +1 -1
  56. package/dist/remarkable-ui/charts/bars/BarChart.d.ts.map +1 -1
  57. package/dist/remarkable-ui/charts/bars/BarChart.stories.d.ts +18 -0
  58. package/dist/remarkable-ui/charts/bars/BarChart.stories.d.ts.map +1 -1
  59. package/dist/remarkable-ui/charts/bars/bars.utils.d.ts +1 -1
  60. package/dist/remarkable-ui/charts/bars/bars.utils.d.ts.map +1 -1
  61. package/dist/remarkable-ui/charts/chartjs.cartesian.constants.d.ts +10 -0
  62. package/dist/remarkable-ui/charts/chartjs.cartesian.constants.d.ts.map +1 -0
  63. package/dist/remarkable-ui/charts/chartjs.constants.d.ts +1 -0
  64. package/dist/remarkable-ui/charts/chartjs.constants.d.ts.map +1 -1
  65. package/dist/remarkable-ui/charts/lines/LineChart.d.ts +5 -0
  66. package/dist/remarkable-ui/charts/lines/LineChart.d.ts.map +1 -0
  67. package/dist/remarkable-ui/charts/lines/LineChart.stories.d.ts +8 -0
  68. package/dist/remarkable-ui/charts/lines/LineChart.stories.d.ts.map +1 -0
  69. package/dist/remarkable-ui/charts/lines/lines.types.d.ts +18 -0
  70. package/dist/remarkable-ui/charts/lines/lines.types.d.ts.map +1 -0
  71. package/dist/remarkable-ui/charts/lines/lines.utils.d.ts +5 -0
  72. package/dist/remarkable-ui/charts/lines/lines.utils.d.ts.map +1 -0
  73. package/dist/remarkable-ui/styles/styles.constants.d.ts +4 -0
  74. package/dist/remarkable-ui/styles/styles.constants.d.ts.map +1 -1
  75. package/dist/remarkable-ui.css +4 -0
  76. package/package.json +1 -1
  77. package/dist/charts.fillGaps.hooks-GDTZT5bi.js +0 -586
  78. package/dist/charts.fillGaps.hooks-GDTZT5bi.js.map +0 -1
  79. package/dist/object.utils-BKb2quG8.js.map +0 -1
  80. package/dist/remarkable-ui/charts/bars/bars.constants.d.ts +0 -3
  81. package/dist/remarkable-ui/charts/bars/bars.constants.d.ts.map +0 -1
@@ -1,586 +0,0 @@
1
- import { B as h, C as v, D as Q, m as A, E as R, F as J, G as X, L as tt, H as et, I as at, J as rt, K as st, M as nt, j as B, N as ot, O as lt, P as it, Q as L } from "./component.constants-DuGM1FcK.js";
2
- import { useRef as ct, useMemo as dt } from "react";
3
- import { r as ut, g as W, a as mt, b as H } from "./object.utils-BKb2quG8.js";
4
- import { g as N } from "./formatter.utils-C_jDZCA9.js";
5
- import { d as D } from "./utc-B2gCnkBk.js";
6
- import { useTheme as ft } from "@embeddable.com/react";
7
- const j = {
8
- ...Q,
9
- scales: {
10
- x: {
11
- title: {
12
- display: !0,
13
- color: v("--em-chart-grid-font-color-default"),
14
- font: {
15
- size: h("--em-chart-grid-font-title-size"),
16
- weight: h("--em-chart-grid-font-title-weight"),
17
- // TODO: fix family on dedicated ticket
18
- // family: getStyle('--em-chart-grid-font-font-family'),
19
- lineHeight: `${h("--em-chart-grid-font-line-height")}px`
20
- }
21
- },
22
- ticks: {
23
- font: {
24
- size: h("--em-chart-grid-font-subtitle-size"),
25
- weight: h("--em-chart-grid-font-label-weight"),
26
- // TODO: fix family on dedicated ticket
27
- // family: getStyle('--em-chart-grid-font-font-family'),
28
- lineHeight: `${h("--em-chart-grid-font-line-height")}px`
29
- }
30
- },
31
- grid: {
32
- display: !1,
33
- color: v("--em-chart-grid-line-color-light"),
34
- lineWidth: h("--em-chart-grid-line-width-default")
35
- },
36
- border: {
37
- display: !1
38
- }
39
- },
40
- y: {
41
- title: {
42
- display: !0,
43
- color: v("--em-chart-grid-font-color-default"),
44
- font: {
45
- size: h("--em-chart-grid-font-title-size"),
46
- weight: h("--em-chart-grid-font-title-weight"),
47
- // TODO: fix family on dedicated ticket
48
- // family: getStyle('--em-chart-grid-font-font-family'),
49
- lineHeight: `${h("--em-chart-grid-font-line-height")}px`
50
- }
51
- },
52
- ticks: {
53
- font: {
54
- size: h("--em-chart-grid-font-subtitle-size"),
55
- weight: h("--em-chart-grid-font-label-weight"),
56
- // TODO: fix family on dedicated ticket
57
- // family: getStyle('--em-chart-grid-font-font-family'),
58
- lineHeight: `${h("--em-chart-grid-font-line-height")}px`
59
- }
60
- },
61
- grid: {
62
- display: !1,
63
- color: v("--em-chart-grid-line-color-light"),
64
- lineWidth: h("--em-chart-grid-line-width-default")
65
- },
66
- border: {
67
- display: !1
68
- }
69
- }
70
- }
71
- }, ht = (t) => {
72
- var e;
73
- return {
74
- ...t,
75
- datasets: (e = t.datasets) == null ? void 0 : e.map((a, n) => {
76
- const r = R[n % R.length], s = {
77
- ...a,
78
- backgroundColor: r,
79
- borderColor: r
80
- };
81
- return A(s, a);
82
- })
83
- };
84
- }, G = (t, e) => e && t.datasetIndex === t.chart.data.datasets.length - 1 ? "auto" : !1, z = (t, e) => {
85
- const { datasets: a } = e.chart.data, n = e.dataIndex, r = a.reduce((s, i) => {
86
- const l = i.data[n];
87
- return s + (l || 0);
88
- }, 0);
89
- return r > 0 ? r : "";
90
- }, gt = (t) => A(j, {
91
- indexAxis: "x",
92
- plugins: {
93
- datalabels: {
94
- labels: {
95
- total: {
96
- anchor: (e) => e.dataset.data[e.dataIndex] >= 0 ? "end" : "start",
97
- align: (e) => e.dataset.data[e.dataIndex] >= 0 ? "top" : "bottom",
98
- display: (e) => G(e, t.showTotalLabels),
99
- formatter: z
100
- },
101
- value: {
102
- anchor: (e) => t.stacked ? "center" : e.dataset.data[e.dataIndex] >= 0 ? "end" : "start",
103
- align: (e) => t.stacked ? "center" : e.dataset.data[e.dataIndex] >= 0 ? "top" : "bottom"
104
- }
105
- }
106
- }
107
- },
108
- scales: {
109
- y: {
110
- stacked: t.stacked,
111
- grid: { display: !0 },
112
- ticks: {
113
- color: v("--em-chart-grid-font-color-muted")
114
- // ...(config.stacked === 'percentage' && {
115
- // callback: (value: number | string) => value + '%',
116
- // }),
117
- },
118
- min: t.yAxisRangeMin,
119
- // max: config.stacked === 'percentage' ? 100 : config.yAxisRangeMax,
120
- max: t.yAxisRangeMax,
121
- type: t.showLogarithmicScale ? "logarithmic" : "linear",
122
- title: {
123
- text: t.yAxisLabel ?? ""
124
- }
125
- },
126
- x: {
127
- stacked: t.stacked,
128
- ticks: {
129
- color: v("--em-chart-grid-font-color-default")
130
- },
131
- reverse: t.reverseXAxis,
132
- title: {
133
- text: t.xAxisLabel ?? ""
134
- }
135
- }
136
- }
137
- }), pt = (t) => A(j, {
138
- indexAxis: "y",
139
- plugins: {
140
- datalabels: {
141
- labels: {
142
- total: {
143
- anchor: (e) => e.dataset.data[e.dataIndex] >= 0 ? "end" : "start",
144
- align: (e) => e.dataset.data[e.dataIndex] >= 0 ? "right" : "left",
145
- display: (e) => G(e, t.showTotalLabels),
146
- formatter: z
147
- },
148
- value: {
149
- anchor: (e) => t.stacked ? "center" : e.dataset.data[e.dataIndex] >= 0 ? "end" : "start",
150
- align: (e) => t.stacked ? "center" : e.dataset.data[e.dataIndex] >= 0 ? "right" : "left"
151
- }
152
- }
153
- }
154
- },
155
- scales: {
156
- x: {
157
- stacked: t.stacked,
158
- grid: { display: !0 },
159
- ticks: {
160
- color: v("--em-chart-grid-font-color-muted")
161
- // ...(config.stacked === 'percentage' && {
162
- // callback: (value: number | string) => value + '%',
163
- // }),
164
- },
165
- min: t.xAxisRangeMin,
166
- // max: config.stacked === 'percentage' ? 100 : config.xAxisRangeMax,
167
- max: t.xAxisRangeMax,
168
- type: t.showLogarithmicScale ? "logarithmic" : "linear",
169
- title: {
170
- text: t.xAxisLabel ?? ""
171
- }
172
- },
173
- y: {
174
- stacked: t.stacked,
175
- ticks: {
176
- color: v("--em-chart-grid-font-color-default")
177
- },
178
- reverse: t.reverseYAxis,
179
- title: {
180
- text: t.yAxisLabel ?? ""
181
- }
182
- }
183
- }
184
- }), Dt = (t) => {
185
- const {
186
- horizontal: e = !1,
187
- showLegend: a = !1,
188
- showTooltips: n = !0,
189
- showValueLabels: r = !1,
190
- showTotalLabels: s = !1
191
- } = t, l = (e ? pt : gt)(t);
192
- return A(l, {
193
- layout: {
194
- padding: {
195
- // Hack: dataLabels can get cut off if they are at the edge of the chart
196
- top: !e && (r || s) ? 30 : 0,
197
- right: e && (r || s) ? 30 : 0
198
- }
199
- },
200
- elements: {
201
- bar: {
202
- borderRadius: h("--em-chart-style-border-radius-default")
203
- // stacked === 'percentage' ? 0 : getStyleNumber('--em-chart-style-border-radius-default'),
204
- }
205
- },
206
- plugins: {
207
- legend: { display: a },
208
- datalabels: {
209
- display: (o) => r && o.dataset.data[o.dataIndex] !== 0 ? "auto" : !1
210
- },
211
- tooltip: {
212
- enabled: n
213
- }
214
- }
215
- });
216
- };
217
- J.register(X, tt, et, at, rt, st, nt);
218
- const Lt = ({ data: t, onSegmentClick: e, options: a = {}, ...n }) => {
219
- const r = ct(null), s = A(Dt(n), a), i = (l) => {
220
- const o = it(l, r);
221
- e == null || e(o);
222
- };
223
- return /* @__PURE__ */ B.jsx("div", { className: ot.chartContainer, children: /* @__PURE__ */ B.jsx(
224
- lt,
225
- {
226
- ref: r,
227
- data: ht(t),
228
- options: s,
229
- onClick: i
230
- }
231
- ) });
232
- }, Ut = (t, e) => {
233
- const a = N(e), { data: n = [], dimension: r, groupDimension: s, measure: i } = t, l = [...new Set(n.map((u) => u[r.name]).filter(Boolean))].sort(), o = [...new Set(n.map((u) => u[s.name]))], d = W(e), m = o.map((u, T) => {
234
- const S = H(
235
- `${d}.charts.backgroundColors`,
236
- `${s.name}.${u}`,
237
- e.charts.backgroundColors ?? R,
238
- T
239
- ), C = H(
240
- `${d}.charts.borderColors`,
241
- `${s.name}.${u}`,
242
- e.charts.borderColors ?? R,
243
- T
244
- );
245
- return {
246
- label: a.data(s, u),
247
- rawLabel: u,
248
- backgroundColor: S,
249
- borderColor: C,
250
- data: l.map((k) => {
251
- const w = n.find(
252
- (O) => O[s.name] === u && O[r.name] === k
253
- );
254
- return w ? Number(w[i.name]) : 0;
255
- })
256
- };
257
- });
258
- return {
259
- labels: l,
260
- datasets: m
261
- };
262
- }, _t = (t, e = ut) => {
263
- const a = N(e);
264
- if (!t.data)
265
- return {
266
- labels: [],
267
- datasets: [{ data: [] }]
268
- };
269
- const n = W(e), r = mt(t.data, t.dimension, t.measures, t.maxItems);
270
- return {
271
- labels: r.map((s) => s[t.dimension.name]),
272
- datasets: t.measures.map((s, i) => {
273
- const l = H(
274
- `${n}.charts.backgroundColors`,
275
- s.name,
276
- e.charts.backgroundColors ?? L,
277
- i
278
- ), o = H(
279
- `${n}.charts.borderColors`,
280
- s.name,
281
- e.charts.borderColors ?? L,
282
- i
283
- );
284
- return {
285
- label: a.dimensionOrMeasureTitle(s),
286
- data: r.map((d) => d[s.name]),
287
- backgroundColor: l,
288
- borderColor: o
289
- };
290
- })
291
- };
292
- }, bt = (t, e) => {
293
- const { datasets: a } = t.chart.data, n = t.dataIndex, r = a.reduce((s, i) => {
294
- const l = i.data[n];
295
- return s + (l || 0);
296
- }, 0);
297
- return e(r);
298
- }, $t = (t, e) => {
299
- const { onBarClicked: a, measure: n, dimension: r, horizontal: s, data: i } = t, l = N(e);
300
- return {
301
- plugins: {
302
- legend: { position: e.charts.legendPosition ?? "bottom" },
303
- datalabels: {
304
- labels: {
305
- total: {
306
- formatter: (o, d) => bt(
307
- d,
308
- (m) => l.data(t.measure, m)
309
- )
310
- },
311
- value: {
312
- formatter: (o) => l.data(t.measure, o)
313
- }
314
- }
315
- },
316
- tooltip: {
317
- callbacks: {
318
- title: (o) => {
319
- var m;
320
- const d = (m = o[0]) == null ? void 0 : m.label;
321
- return l.data(r, d);
322
- },
323
- label: (o) => {
324
- const d = o.raw;
325
- return `${l.data(r, o.dataset.label) || ""}: ${l.data(n, d)}`;
326
- }
327
- }
328
- }
329
- },
330
- scales: {
331
- x: {
332
- ticks: {
333
- callback: (o) => {
334
- if (s)
335
- return l.data(n, o);
336
- if (!i || !i.labels) return;
337
- const d = i.labels[Number(o)];
338
- return l.data(r, d);
339
- }
340
- }
341
- },
342
- y: {
343
- ticks: {
344
- callback: (o) => {
345
- if (!s)
346
- return l.data(n, o);
347
- if (!i || !i.labels) return;
348
- const d = i.labels[Number(o)];
349
- return l.data(r, d);
350
- }
351
- }
352
- }
353
- },
354
- onClick: (o, d, m) => {
355
- var C;
356
- const u = d[0], T = u ? m.data.labels[u.index] : null, S = u ? (C = m.data.datasets[u.datasetIndex]) == null ? void 0 : C.rawLabel : null;
357
- a({
358
- axisDimensionValue: T,
359
- groupingDimensionValue: S
360
- });
361
- }
362
- };
363
- }, y = {
364
- DEFAULT: "YYYY-MM-DDTHH:mm:ss.SSS",
365
- WITH_TIMEZONE: "YYYY-MM-DDTHH:mm:ss.SSS[Z]",
366
- WITHOUT_TIMEZONE: "YYYY-MM-DDTHH:mm:ss.SSS",
367
- WITHOUT_MILLISECONDS: "YYYY-MM-DDTHH:mm:ss"
368
- }, U = {
369
- second: "second",
370
- minute: "minute",
371
- hour: "hour",
372
- day: "day",
373
- week: "week",
374
- month: "month",
375
- quarter: "month",
376
- // Will be handled specially
377
- year: "year"
378
- }, yt = (t) => `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}`, Tt = (t) => `${t.getUTCFullYear()}-${String(t.getUTCMonth() + 1).padStart(2, "0")}-${String(t.getUTCDate()).padStart(2, "0")}`, St = (t) => t.toISOString().includes("Z"), _ = (t) => St(t) ? Tt(t) : yt(t), Ot = (t) => t.startOf("month").month(Math.floor(t.month() / 3) * 3).startOf("month"), $ = (t, e) => {
379
- const a = K(e);
380
- return e === "week" ? t.startOf("week") : e === "quarter" ? Ot(t) : t.startOf(a);
381
- }, xt = (t, e) => {
382
- var r, s;
383
- const a = (r = t.inputs) == null ? void 0 : r.dateBounds;
384
- if (!a) return;
385
- if (a.from && a.to)
386
- return a;
387
- const n = a.relativeTimeString;
388
- if (n) {
389
- const l = (((s = e == null ? void 0 : e.defaults) == null ? void 0 : s.dateRangesOptions) ?? []).find((o) => o.value === n);
390
- if (l) {
391
- const o = l.getRange();
392
- return {
393
- from: o.from,
394
- to: o.to,
395
- relativeTimeString: n
396
- };
397
- }
398
- }
399
- }, vt = (t, e) => {
400
- const { dimension: a, granularity: n = "day", sortOrder: r = "asc", dateBounds: s, theme: i } = e, l = s || xt(a, i);
401
- if (!t || t.length === 0)
402
- return t;
403
- if (!(a != null && a.name))
404
- throw new Error("dimension.name is required");
405
- const o = Ct(a.name, n, t), d = t.map((c) => {
406
- const f = c[o];
407
- if (typeof f != "string")
408
- return null;
409
- const g = D(f);
410
- return g.isValid() ? { ...c, _parsedDate: g } : null;
411
- }).filter(
412
- (c) => c !== null
413
- );
414
- if (d.length === 0)
415
- return console.warn("fillGaps: No valid dates found in data"), t;
416
- let m, u;
417
- if (l) {
418
- const c = l.from instanceof Date ? l.from : new Date(l.from), f = l.to instanceof Date ? l.to : new Date(l.to);
419
- if (n === "second" || n === "minute" || n === "hour")
420
- m = D(c), u = D(f);
421
- else {
422
- const g = _(c), p = _(f);
423
- m = D(g), u = D(p);
424
- }
425
- m = $(m, n), u = $(u, n);
426
- } else {
427
- const c = d[0];
428
- if (!c)
429
- return t;
430
- let f = c._parsedDate, g = c._parsedDate;
431
- for (let p = 1; p < d.length; p++) {
432
- const M = d[p];
433
- if (M) {
434
- const x = M._parsedDate;
435
- x.isBefore(f) && (f = x), x.isAfter(g) && (g = x);
436
- }
437
- }
438
- m = f, u = g;
439
- }
440
- const T = [], S = K(n), C = m.startOf(S), k = u.startOf(S);
441
- if (n === "week") {
442
- let c = C;
443
- for (; c.isBefore(k) || c.isSame(k, "day"); )
444
- T.push(c), c = c.add(7, "day");
445
- } else {
446
- let c = C;
447
- for (; c.isBefore(k) || c.isSame(k, S); )
448
- T.push(c), n === "quarter" ? c = c.add(3, "month") : c = c.add(1, S);
449
- }
450
- const w = /* @__PURE__ */ new Map();
451
- d.forEach((c) => {
452
- const f = F(c._parsedDate);
453
- w.set(f, c);
454
- });
455
- const O = [];
456
- return T.forEach((c) => {
457
- const f = F(c), g = w.get(f);
458
- if (g) {
459
- const p = { ...g };
460
- delete p._parsedDate, O.push(p);
461
- } else {
462
- const p = kt(t), M = wt(c, p), x = {
463
- [o]: M
464
- }, V = a.name, Y = t[0];
465
- if (Y)
466
- for (const E of Object.keys(Y))
467
- E !== o && (E.startsWith(V) && E !== o ? x[E] = M : x[E] = null);
468
- O.push(x);
469
- }
470
- }), r === "desc" ? O.sort(
471
- (c, f) => D(f[o]).valueOf() - D(c[o]).valueOf()
472
- ) : O.sort(
473
- (c, f) => D(c[o]).valueOf() - D(f[o]).valueOf()
474
- ), O;
475
- }, F = (t) => t.format("YYYY-MM-DDTHH:mm:ss"), Ct = (t, e, a) => {
476
- if (!a || a.length === 0) return t;
477
- const n = a[0];
478
- if (!n) return t;
479
- const r = `${t}.${e}`;
480
- return r in n ? r : t;
481
- }, kt = (t) => {
482
- if (!(t != null && t.length)) return y.DEFAULT;
483
- const e = t[0];
484
- if (!e) return y.DEFAULT;
485
- for (const a of Object.values(e))
486
- if (typeof a == "string" && a.includes("T") && a.includes(":"))
487
- return a.endsWith("Z") ? y.WITH_TIMEZONE : a.includes(".") ? y.WITHOUT_TIMEZONE : y.WITHOUT_MILLISECONDS;
488
- return y.DEFAULT;
489
- }, wt = (t, e) => e.includes("[Z]") ? t.format(y.WITH_TIMEZONE) : e.includes(".SSS") ? t.format(y.WITHOUT_TIMEZONE) : t.format(y.WITHOUT_MILLISECONDS), K = (t) => U[t] || U.day, Ft = (t, e) => {
490
- const a = ft(), n = dt(() => {
491
- var d, m;
492
- const r = t.data;
493
- if (e.nativeType !== "time" || !r || r.length === 0)
494
- return r;
495
- const s = ((d = e.inputs) == null ? void 0 : d.granularity) || Et(r, e);
496
- if (!s || !(((m = e.inputs) == null ? void 0 : m.dateBounds) ?? Mt(r, e, s)))
497
- return r;
498
- const o = {
499
- dimension: e,
500
- granularity: s,
501
- sortOrder: "asc",
502
- theme: a
503
- };
504
- try {
505
- return vt(r, o);
506
- } catch (u) {
507
- return console.warn("Failed to apply fillGaps to chart data:", u), r;
508
- }
509
- }, [t.data, e, a]);
510
- return {
511
- ...t,
512
- data: n
513
- };
514
- }, Mt = (t, e, a) => {
515
- if (!t || t.length < 2)
516
- return !1;
517
- const n = e.name, r = t.map((i) => i[n]).filter(Boolean).map((i) => new Date(i)).filter((i) => !isNaN(i.getTime())).sort((i, l) => i.getTime() - l.getTime());
518
- if (r.length < 2)
519
- return !1;
520
- const s = It(a);
521
- for (let i = 1; i < r.length; i++) {
522
- const l = r[i], o = r[i - 1];
523
- if (l && o && l.getTime() - o.getTime() > s * 1.5)
524
- return !0;
525
- }
526
- return !1;
527
- }, Et = (t, e) => {
528
- if (!t || t.length === 0) return null;
529
- const a = t[0];
530
- if (!a) return null;
531
- const n = e.name, r = Object.keys(a).filter(
532
- (s) => s.startsWith(n) && s !== n
533
- );
534
- for (const s of r) {
535
- if (s.includes(".second")) return "second";
536
- if (s.includes(".minute")) return "minute";
537
- if (s.includes(".hour")) return "hour";
538
- if (s.includes(".day")) return "day";
539
- if (s.includes(".week")) return "week";
540
- if (s.includes(".month")) return "month";
541
- if (s.includes(".quarter")) return "quarter";
542
- if (s.includes(".year")) return "year";
543
- }
544
- return null;
545
- }, Z = 1e3, q = 60 * Z, P = 60 * q, I = 24 * P, b = {
546
- SECOND: Z,
547
- MINUTE: q,
548
- HOUR: P,
549
- DAY: I,
550
- WEEK: 7 * I,
551
- MONTH: 30 * I,
552
- // Approximate
553
- QUARTER: 90 * I,
554
- // Approximate
555
- YEAR: 365 * I
556
- // Approximate
557
- }, It = (t) => {
558
- switch (t) {
559
- case "second":
560
- return b.SECOND;
561
- case "minute":
562
- return b.MINUTE;
563
- case "hour":
564
- return b.HOUR;
565
- case "day":
566
- return b.DAY;
567
- case "week":
568
- return b.WEEK;
569
- case "month":
570
- return b.MONTH;
571
- case "quarter":
572
- return b.QUARTER;
573
- case "year":
574
- return b.YEAR;
575
- default:
576
- return b.DAY;
577
- }
578
- };
579
- export {
580
- Lt as B,
581
- $t as a,
582
- Ut as b,
583
- _t as g,
584
- Ft as u
585
- };
586
- //# sourceMappingURL=charts.fillGaps.hooks-GDTZT5bi.js.map