@dcs-tech/ui 0.10.0 → 0.11.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.
Files changed (170) hide show
  1. package/CHANGELOG.md +362 -0
  2. package/README.md +3 -2
  3. package/THIRD_PARTY_NOTICES.md +23 -0
  4. package/dist/ChartImageMenu-sB2QNQzd.js +9673 -0
  5. package/dist/ChartView-BstZkP1g.js +1942 -0
  6. package/dist/{SummaryChart-i6fOdrDM.js → SummaryChart-B5ibDNOZ.js} +11 -10
  7. package/dist/{SummaryImage-CCt5ozD9.js → SummaryImage-CRP7X2Nl.js} +2 -2
  8. package/dist/SummarySeeAll-CtYRGV4G.js +101 -0
  9. package/dist/assets/fileTask.worker-D97s2vRV.js +1 -0
  10. package/dist/{columnValue-74XDBcVF.js → columnValue-BOn9NC8X.js} +86 -79
  11. package/dist/exportContext-CMzuzRjc.js +274 -0
  12. package/dist/{exportEngine-BmDly7iw.js → exportEngine-CYDN8Ty-.js} +167 -137
  13. package/dist/file-worker.js +1 -1
  14. package/dist/{fileActions-CFNO14Aj.js → fileActions-DkPEWE-t.js} +1 -1
  15. package/dist/{geometry-DG134nYI.js → geometry-CFS5If1N.js} +769 -466
  16. package/dist/index.js +21095 -12669
  17. package/dist/{labels-BPItSeRU.js → labels-mukFhYkc.js} +124 -1
  18. package/dist/{runFileTask-BIZTFnZP.js → runFileTask-DI_39TjR.js} +17 -0
  19. package/dist/scrollArea-B52kugL1.js +291 -0
  20. package/dist/style.css +1 -1
  21. package/dist/{summaryChartData-BiQYJbYZ.js → summaryChartData-D15kw64n.js} +6 -5
  22. package/dist/types/components/Charts/BarList.d.ts +4 -3
  23. package/dist/types/components/Charts/CalendarHeatmap.d.ts +4 -2
  24. package/dist/types/components/Charts/Chart.d.ts +3 -2
  25. package/dist/types/components/Charts/ChartView.d.ts +3 -2
  26. package/dist/types/components/Charts/ColumnChart.d.ts +4 -3
  27. package/dist/types/components/Charts/Donut.d.ts +3 -2
  28. package/dist/types/components/Charts/Funnel.d.ts +3 -2
  29. package/dist/types/components/Charts/Gauge.d.ts +3 -2
  30. package/dist/types/components/Charts/LineChart.d.ts +4 -3
  31. package/dist/types/components/Charts/NumberTrend.d.ts +4 -3
  32. package/dist/types/components/Charts/Progress.d.ts +3 -2
  33. package/dist/types/components/Charts/StackedBar.d.ts +3 -2
  34. package/dist/types/components/Charts/Treemap.d.ts +3 -2
  35. package/dist/types/components/Charts/chartData.d.ts +6 -0
  36. package/dist/types/components/Charts/chartImage.d.ts +2 -0
  37. package/dist/types/components/Charts/geometry.d.ts +3 -0
  38. package/dist/types/components/Charts/index.d.ts +2 -0
  39. package/dist/types/components/Charts/palette.d.ts +1 -0
  40. package/dist/types/components/Charts/parts.d.ts +14 -0
  41. package/dist/types/components/Charts/useChartMotion.d.ts +8 -0
  42. package/dist/types/components/DataTable/DataTable.d.ts +3 -1
  43. package/dist/types/components/DataTable/DisplayPopover.d.ts +1 -0
  44. package/dist/types/components/DataTable/HeaderMenu.d.ts +1 -0
  45. package/dist/types/components/DataTable/TableColumnModal.d.ts +4 -1
  46. package/dist/types/components/DataTable/TableToolbar.d.ts +20 -1
  47. package/dist/types/components/DataTable/TableView.d.ts +18 -2
  48. package/dist/types/components/DataTable/cards/CardView.d.ts +25 -5
  49. package/dist/types/components/DataTable/cards/rowParts.d.ts +1 -0
  50. package/dist/types/components/DataTable/cellSelection/CellRangeBar.d.ts +16 -0
  51. package/dist/types/components/DataTable/cellSelection/cellRangeStore.d.ts +18 -0
  52. package/dist/types/components/DataTable/cellSelection/paintRanges.d.ts +2 -0
  53. package/dist/types/components/DataTable/cellSelection/useCellSelection.d.ts +63 -0
  54. package/dist/types/components/DataTable/data/listDelta.d.ts +27 -0
  55. package/dist/types/components/DataTable/data/rowLineage.d.ts +3 -0
  56. package/dist/types/components/DataTable/data/rowModels.d.ts +9 -0
  57. package/dist/types/components/DataTable/data/rowTransaction.d.ts +9 -0
  58. package/dist/types/components/DataTable/data/useServerData.d.ts +3 -1
  59. package/dist/types/components/DataTable/export/exportCells.d.ts +5 -2
  60. package/dist/types/components/DataTable/export/exportEngine.d.ts +7 -2
  61. package/dist/types/components/DataTable/export/useTableExport.d.ts +17 -1
  62. package/dist/types/components/DataTable/filters/filterRowModel.d.ts +1 -0
  63. package/dist/types/components/DataTable/grouping/groupModel.d.ts +11 -0
  64. package/dist/types/components/DataTable/index.d.ts +1 -1
  65. package/dist/types/components/DataTable/keyboard/ShortcutsDialog.d.ts +4 -1
  66. package/dist/types/components/DataTable/keyboard/useGridKeyboard.d.ts +8 -0
  67. package/dist/types/components/DataTable/labels.d.ts +128 -0
  68. package/dist/types/components/DataTable/layout/LayoutSwitcher.d.ts +10 -2
  69. package/dist/types/components/DataTable/layout/useFitWidths.d.ts +7 -0
  70. package/dist/types/components/DataTable/menu/RowMenu.d.ts +1 -0
  71. package/dist/types/components/DataTable/menu/buildRowMenu.d.ts +6 -3
  72. package/dist/types/components/DataTable/motion/RowChangeNotice.d.ts +19 -0
  73. package/dist/types/components/DataTable/motion/rowChanges.d.ts +25 -0
  74. package/dist/types/components/DataTable/motion/useNoticeInsets.d.ts +2 -0
  75. package/dist/types/components/DataTable/motion/useRowChangeNotices.d.ts +35 -0
  76. package/dist/types/components/DataTable/motion/useRowMotion.d.ts +29 -3
  77. package/dist/types/components/DataTable/persistence/reconcile.d.ts +4 -0
  78. package/dist/types/components/DataTable/persistence/useColumnPersistence.d.ts +5 -1
  79. package/dist/types/components/DataTable/pivot/PivotPanel.d.ts +11 -0
  80. package/dist/types/components/DataTable/pivot/PivotView.d.ts +22 -0
  81. package/dist/types/components/DataTable/pivot/pivotModel.d.ts +54 -0
  82. package/dist/types/components/DataTable/pivot/usePivot.d.ts +44 -0
  83. package/dist/types/components/DataTable/rows/PressRow.d.ts +1 -0
  84. package/dist/types/components/DataTable/rows/RowLead.d.ts +23 -0
  85. package/dist/types/components/DataTable/rows/rowPress.d.ts +2 -0
  86. package/dist/types/components/DataTable/rows/usePinnedRows.d.ts +34 -0
  87. package/dist/types/components/DataTable/rows/useRowDrag.d.ts +44 -0
  88. package/dist/types/components/DataTable/split/SplitView.d.ts +4 -2
  89. package/dist/types/components/DataTable/summary/SummaryChart.d.ts +2 -1
  90. package/dist/types/components/DataTable/summary/TableSummary.d.ts +2 -1
  91. package/dist/types/components/DataTable/summary/summaryModel.d.ts +28 -6
  92. package/dist/types/components/DataTable/summary/useTableSummary.d.ts +3 -0
  93. package/dist/types/components/DataTable/toolbar/ToolbarMore.d.ts +14 -0
  94. package/dist/types/components/DataTable/toolbar/useToolbarFit.d.ts +10 -0
  95. package/dist/types/components/DataTable/tree/TreeChips.d.ts +5 -0
  96. package/dist/types/components/DataTable/tree/treeExport.d.ts +54 -0
  97. package/dist/types/components/DataTable/tree/treeMove.d.ts +1 -0
  98. package/dist/types/components/DataTable/tree/useTreeChildren.d.ts +15 -0
  99. package/dist/types/components/DataTable/tree/useTreeData.d.ts +60 -0
  100. package/dist/types/components/DataTable/types.d.ts +272 -4
  101. package/dist/types/components/DataTable/useDataChangeTracker.d.ts +11 -4
  102. package/dist/types/components/DataTable/useTable.d.ts +13 -1
  103. package/dist/types/components/DataTable/virtual/useVirtualLines.d.ts +1 -0
  104. package/dist/types/components/EventCalendar/EventCalendar.d.ts +46 -0
  105. package/dist/types/components/EventCalendar/eventParts.d.ts +10 -0
  106. package/dist/types/components/EventCalendar/index.d.ts +3 -0
  107. package/dist/types/components/EventCalendar/useCalendarEdit.d.ts +40 -0
  108. package/dist/types/components/Icon/Icon.d.ts +36 -0
  109. package/dist/types/components/Icon/Icon.storyData.d.ts +6 -0
  110. package/dist/types/components/Icon/IconContext.d.ts +7 -0
  111. package/dist/types/components/Icon/icons.d.ts +223 -0
  112. package/dist/types/components/Icon/index.d.ts +7 -0
  113. package/dist/types/components/Icon/useIconDone.d.ts +5 -0
  114. package/dist/types/components/Popover/Popover.d.ts +1 -0
  115. package/dist/types/components/Popover/floatingPosition.d.ts +22 -2
  116. package/dist/types/components/ReorderList/ReorderList.d.ts +2 -1
  117. package/dist/types/components/Scroll/ui.d.ts +1 -0
  118. package/dist/types/components/SlidingHighlight/index.d.ts +2 -0
  119. package/dist/types/components/SlidingHighlight/useSlidingHighlight.d.ts +20 -0
  120. package/dist/types/components/Suggest/SuggestionList.d.ts +1 -0
  121. package/dist/types/components/UIProvider/UILabelsContext.d.ts +34 -0
  122. package/dist/types/components/UIProvider/UIProvider.d.ts +2 -0
  123. package/dist/types/core/hooks/index.d.ts +1 -1
  124. package/dist/types/core/hooks/usePresence.d.ts +1 -0
  125. package/dist/types/core/icons/actions.icons.d.ts +37 -0
  126. package/dist/types/core/icons/commerce.icons.d.ts +16 -0
  127. package/dist/types/core/icons/communication.icons.d.ts +10 -0
  128. package/dist/types/core/icons/delivery.icons.d.ts +13 -0
  129. package/dist/types/core/icons/devices.icons.d.ts +16 -0
  130. package/dist/types/core/icons/files.icons.d.ts +13 -0
  131. package/dist/types/core/icons/general.icons.d.ts +24 -0
  132. package/dist/types/core/icons/index.d.ts +14 -0
  133. package/dist/types/core/icons/media.icons.d.ts +11 -0
  134. package/dist/types/core/icons/navigation.icons.d.ts +25 -0
  135. package/dist/types/core/icons/people.icons.d.ts +13 -0
  136. package/dist/types/core/icons/registry.d.ts +2 -0
  137. package/dist/types/core/icons/state.icons.d.ts +14 -0
  138. package/dist/types/core/icons/status.icons.d.ts +10 -0
  139. package/dist/types/core/icons/table.icons.d.ts +22 -0
  140. package/dist/types/core/icons/text.icons.d.ts +13 -0
  141. package/dist/types/core/logic/cellRange.logic.d.ts +66 -0
  142. package/dist/types/core/logic/cellTouch.logic.d.ts +16 -0
  143. package/dist/types/core/logic/columnGroups.logic.d.ts +31 -0
  144. package/dist/types/core/logic/dropdownSide.logic.d.ts +19 -0
  145. package/dist/types/core/logic/eventCalendar.logic.d.ts +225 -0
  146. package/dist/types/core/logic/fitColumns.logic.d.ts +7 -0
  147. package/dist/types/core/logic/icon.logic.d.ts +24 -0
  148. package/dist/types/core/logic/index.d.ts +16 -0
  149. package/dist/types/core/logic/pivot.logic.d.ts +100 -0
  150. package/dist/types/core/logic/rowActions.logic.d.ts +7 -0
  151. package/dist/types/core/logic/rowDrag.logic.d.ts +36 -0
  152. package/dist/types/core/logic/rowPinning.logic.d.ts +12 -0
  153. package/dist/types/core/logic/slidingHighlight.logic.d.ts +20 -0
  154. package/dist/types/core/logic/toolbarOverflow.logic.d.ts +21 -0
  155. package/dist/types/core/logic/treeData.logic.d.ts +44 -0
  156. package/dist/types/core/logic/treeDrag.logic.d.ts +63 -0
  157. package/dist/types/core/logic/tween.logic.d.ts +33 -0
  158. package/dist/types/core/logic/visualViewport.logic.d.ts +13 -0
  159. package/dist/types/core/types/eventCalendar.types.d.ts +18 -0
  160. package/dist/types/core/types/fileEngine.types.d.ts +6 -0
  161. package/dist/types/core/types/icon.types.d.ts +109 -0
  162. package/dist/types/core/types/index.d.ts +2 -0
  163. package/dist/types/index.d.ts +7 -0
  164. package/package.json +4 -4
  165. package/dist/ChartImageMenu-3OfqNFyt.js +0 -1510
  166. package/dist/ChartView-n4G5_2ro.js +0 -1707
  167. package/dist/SummarySeeAll-BY8knsRe.js +0 -101
  168. package/dist/assets/fileTask.worker--Q3rI3Bn.js +0 -1
  169. package/dist/exportContext-C52ZuHd8.js +0 -166
  170. package/dist/scrollArea-D84Cwm4o.js +0 -310
@@ -1,1510 +0,0 @@
1
- "use client";
2
- import { A as e, C as t, Cn as n, Dn as r, E as i, En as a, F as o, J as s, L as c, N as l, Nn as u, O as d, P as f, Q as p, R as m, S as h, T as g, Tn as _, Y as v, _ as y, b, c as x, d as S, et as C, ft as w, g as T, h as E, i as D, j as ee, kn as te, l as ne, r as re, rt as ie, st as O, ut as ae, w as oe, y as se } from "./geometry-DG134nYI.js";
3
- import { a as ce, l as le, n as ue, o as de, u as fe } from "./fileActions-CFNO14Aj.js";
4
- import { t as pe } from "./runFileTask-BIZTFnZP.js";
5
- import me, { cloneElement as he, createContext as ge, forwardRef as _e, useCallback as k, useContext as ve, useEffect as A, useId as ye, useLayoutEffect as be, useMemo as xe, useRef as j, useState as M, useSyncExternalStore as Se } from "react";
6
- import { Fragment as Ce, jsx as N, jsxs as P } from "react/jsx-runtime";
7
- import { createPortal as we } from "react-dom";
8
- // src/core/logic/button.logic.ts
9
- function Te(e) {
10
- let t = e.isIconOnly && e.shape === "rounded" ? "circle" : e.shape, n = [
11
- "root",
12
- `variant_${e.variant}`,
13
- `size_${e.size}`,
14
- `color_${e.color}`,
15
- `shape_${t}`
16
- ];
17
- return e.disabled && n.push("disabled"), e.loading && (n.push("loading"), n.push(`loading_${e.loadingPosition}`)), e.fullWidth && n.push("fullWidth"), e.disableTextTransform && n.push("disableTextTransform"), e.disableElevation && n.push("disableElevation"), e.showFocusRing && n.push("showFocusRing"), e.isIconOnly && n.push("iconOnly"), n;
18
- }
19
- function Ee(e) {
20
- let t = ["group", `orientation_${e.orientation}`];
21
- return e.fullWidth && t.push("groupFullWidth"), t;
22
- }
23
- // src/core/logic/press.logic.ts
24
- function De(e, t) {
25
- let n = t ? Math.min(Math.max(t.x, 0), e.width) : e.width / 2, r = t ? Math.min(Math.max(t.y, 0), e.height) : e.height / 2, i = Math.max(n, e.width - n), a = Math.max(r, e.height - r);
26
- return {
27
- x: n,
28
- y: r,
29
- size: 2 * Math.hypot(i, a)
30
- };
31
- }
32
- function Oe(e, t = 150) {
33
- return Math.max(0, t - e);
34
- }
35
- // src/core/logic/fileQueue.logic.ts
36
- var ke = {
37
- concurrency: 2,
38
- maxQueued: 20,
39
- timeoutMs: 12e4,
40
- keepFinished: 10,
41
- workers: "auto"
42
- };
43
- function Ae(e = {}) {
44
- let t = (e, t, n) => typeof e == "number" && Number.isFinite(e) && e >= n ? Math.floor(e) : t;
45
- return {
46
- concurrency: t(e.concurrency, ke.concurrency, 1),
47
- maxQueued: t(e.maxQueued, ke.maxQueued, 0),
48
- timeoutMs: t(e.timeoutMs, ke.timeoutMs, 1),
49
- keepFinished: t(e.keepFinished, ke.keepFinished, 0),
50
- workers: e.workers === "off" ? "off" : "auto"
51
- };
52
- }
53
- var F = {
54
- high: 0,
55
- normal: 1,
56
- low: 2
57
- }, je = /* @__PURE__ */ new Set([
58
- "delivered",
59
- "failed",
60
- "cancelled"
61
- ]), I = (e) => je.has(e.status), Me = (e) => e.status === "queued" || e.status === "running";
62
- function L(e, t) {
63
- let n = e.filter((e) => e.status === "running").length, r = Math.max(0, t - n);
64
- return r === 0 ? [] : e.filter((e) => e.status === "queued").sort((e, t) => F[e.priority] - F[t.priority] || e.seq - t.seq).slice(0, r).map((e) => e.id);
65
- }
66
- function Ne(e, t, n) {
67
- let r = t.dedupeKey ? e.filter((e) => e.dedupeKey === t.dedupeKey && Me(e)) : [];
68
- if (r.length && !t.replace) return {
69
- kind: "reuse",
70
- id: r[0].id
71
- };
72
- let i = t.replace ? r.map((e) => e.id) : [];
73
- return e.filter((e) => e.status === "queued" && !i.includes(e.id)).length >= n ? {
74
- kind: "reject",
75
- reason: "queue-full"
76
- } : {
77
- kind: "add",
78
- cancel: i
79
- };
80
- }
81
- var Pe = (e) => e.attempts <= e.retry;
82
- function Fe(e, t) {
83
- if (!Number.isFinite(t)) return null;
84
- let n = Math.min(1, Math.max(e, t));
85
- return n === e || n < 1 && n - e < .01 ? null : n;
86
- }
87
- function Ie(e, t) {
88
- return e === "download" || e === "none" ? "now" : t.activationActive === void 0 ? t.sinceSubmitMs <= 4e3 ? "now" : "wait" : t.activationActive ? "now" : "wait";
89
- }
90
- function Le(e, t) {
91
- return e.filter(I).sort((e, t) => (t.finishedAt ?? 0) - (e.finishedAt ?? 0) || t.seq - e.seq).slice(t).map((e) => e.id);
92
- }
93
- // src/core/logic/useMergeRefs.ts
94
- function Re(...e) {
95
- let t = j(e);
96
- return t.current = e, k((e) => {
97
- for (let n of t.current) n && (typeof n == "function" ? n(e) : n.current = e);
98
- }, []);
99
- }
100
- var R = {
101
- tooltip: "_tooltip_16wxf_14",
102
- open: "_open_16wxf_42",
103
- tone_info: "_tone_info_16wxf_53",
104
- tone_success: "_tone_success_16wxf_54",
105
- tone_warning: "_tone_warning_16wxf_55",
106
- tone_danger: "_tone_danger_16wxf_56",
107
- instant: "_instant_16wxf_82",
108
- placement_top: "_placement_top_16wxf_93",
109
- placement_bottom: "_placement_bottom_16wxf_94",
110
- placement_left: "_placement_left_16wxf_95",
111
- placement_right: "_placement_right_16wxf_96",
112
- measured: "_measured_16wxf_102",
113
- helpIcon: "_helpIcon_16wxf_110",
114
- disabledAnchor: "_disabledAnchor_16wxf_143"
115
- }, ze = 500, Be = 100, z = 8, Ve = 16, He = 300, Ue = 0, B = null, V = () => B !== null || Date.now() - Ue < He, We = () => V(), Ge = () => {
116
- B?.hide(!0);
117
- }, Ke = () => {
118
- Ue = Date.now();
119
- }, qe = 0, Je = () => {
120
- Ue = qe = Date.now();
121
- }, Ye = 50, Xe = () => typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --probe"), Ze = () => typeof HTMLElement < "u" && Object.prototype.hasOwnProperty.call(HTMLElement.prototype, "popover");
122
- function Qe(e) {
123
- let t = r(e), n = `tooltip-${ye().replace(/:/g, "")}`, [i, o] = M(!1), [s, c] = M(t?.placement || "top"), [l, u] = M(!1), [d, f] = M(!1), p = j(null), m = j(null), h = j(void 0), g = j(void 0), _ = j(null), v = j("pointer"), y = t?.placement || "top", b = t?.anchorTo || "auto", x = t?.delay ?? ze, S = t?.closeDelay ?? Be, C = k(() => {
124
- let e = p.current, t = m.current;
125
- if (!e || !t) return;
126
- let n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), i = _.current, o = !!i && te({
127
- anchorTo: b,
128
- openedBy: v.current,
129
- anchorWidth: n.width,
130
- tooltipWidth: r.width
131
- }), s = a({
132
- anchor: o && i ? {
133
- top: i.y - Ve / 2,
134
- left: i.x - Ve / 2,
135
- width: Ve,
136
- height: Ve
137
- } : {
138
- top: n.top,
139
- left: n.left,
140
- width: n.width,
141
- height: n.height
142
- },
143
- tooltip: {
144
- width: r.width,
145
- height: r.height
146
- },
147
- viewport: {
148
- width: window.innerWidth,
149
- height: window.innerHeight
150
- },
151
- placement: y,
152
- offset: z
153
- });
154
- e.style.top = `${s.top}px`, e.style.left = `${s.left}px`, c(s.placement);
155
- }, [y, b]), w = () => {
156
- window.clearTimeout(h.current), window.clearTimeout(g.current);
157
- }, T = k((e = !1) => {
158
- w(), f(e), o(!1), B === E.current && (Ue = Date.now(), B = null);
159
- }, []), E = j({ hide: (e) => T(e) }), D = k((e, t, r) => {
160
- B && B !== E.current && B.hide(!0), B = E.current, f(r), m.current = e, v.current = t, u(t === "pointer" && b !== "element"), Xe() && e.style.setProperty("anchor-name", `--${n}`), o(!0);
161
- }, [n, b]), ee = k((e, t) => {
162
- if (w(), V()) {
163
- let n = B !== null && B !== E.current;
164
- D(e, t, n || Date.now() - qe < Ye);
165
- } else h.current = window.setTimeout(() => D(e, t, !1), x);
166
- }, [x, D]), ne = k(() => {
167
- w(), g.current = window.setTimeout(() => T(), S);
168
- }, [S, T]);
169
- return A(() => {
170
- let e = p.current;
171
- if (!e) return;
172
- if (!i) {
173
- Ze() && e.matches(":popover-open") && e.hidePopover();
174
- return;
175
- }
176
- if (Ze() && !e.matches(":popover-open") && e.showPopover(), Xe() && !l) return;
177
- C();
178
- let t = () => C();
179
- return window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), () => {
180
- window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t);
181
- };
182
- }, [
183
- i,
184
- l,
185
- C
186
- ]), A(() => {
187
- if (!i) return;
188
- let e = (e) => {
189
- e.key === "Escape" && T();
190
- };
191
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
192
- }, [i, T]), A(() => () => {
193
- w(), B === E.current && (B = null);
194
- }, []), t ? {
195
- hasTooltip: !0,
196
- tooltipNode: /* @__PURE__ */ N("div", {
197
- ref: p,
198
- id: n,
199
- role: "tooltip",
200
- popover: Ze() ? "manual" : void 0,
201
- className: [
202
- R.tooltip,
203
- R[`placement_${s}`],
204
- t.tone && t.tone !== "default" ? R[`tone_${t.tone}`] : "",
205
- i ? R.open : "",
206
- d ? R.instant : "",
207
- l ? R.measured : "",
208
- t.className || ""
209
- ].filter(Boolean).join(" "),
210
- style: { "--tooltip-anchor": `--${n}` },
211
- children: t.content
212
- }),
213
- triggerProps: {
214
- onPointerEnter: (e) => {
215
- e.pointerType !== "touch" && (_.current = {
216
- x: e.clientX,
217
- y: e.clientY
218
- }, ee(e.currentTarget, "pointer"));
219
- },
220
- onPointerMove: (e) => {
221
- e.pointerType === "touch" || i || h.current === void 0 || (_.current = {
222
- x: e.clientX,
223
- y: e.clientY
224
- });
225
- },
226
- onPointerLeave: ne,
227
- onFocus: (e) => {
228
- e.currentTarget.matches(":focus-visible") && (_.current = null, ee(e.currentTarget, "focus"));
229
- },
230
- onBlur: ne,
231
- "aria-describedby": i ? n : void 0
232
- }
233
- } : {
234
- triggerProps: {
235
- onPointerEnter: () => {},
236
- onPointerMove: () => {},
237
- onPointerLeave: () => {},
238
- onFocus: () => {},
239
- onBlur: () => {}
240
- },
241
- tooltipNode: null,
242
- hasTooltip: !1
243
- };
244
- }
245
- var $e = {
246
- press: "_press_1iawn_23",
247
- ripple: "_ripple_1iawn_60",
248
- rippleHost: "_rippleHost_1iawn_70",
249
- wave: "_wave_1iawn_82",
250
- waveGrow: "_waveGrow_1iawn_1",
251
- waveFade: "_waveFade_1iawn_1",
252
- waveAppear: "_waveAppear_1iawn_1"
253
- }, et = 1500;
254
- function tt(e) {
255
- let t = e.querySelector(":scope > [data-press-ripples]");
256
- if (t) return t;
257
- let n = document.createElement("span");
258
- return n.className = $e.rippleHost, n.setAttribute("data-press-ripples", ""), n.setAttribute("aria-hidden", "true"), e.appendChild(n), n;
259
- }
260
- function nt(e, t) {
261
- let n = e.getBoundingClientRect(), r = De(n, t && {
262
- x: t.x - n.left,
263
- y: t.y - n.top
264
- }), i = document.createElement("span");
265
- return i.className = $e.wave, i.style.left = `${r.x - r.size / 2}px`, i.style.top = `${r.y - r.size / 2}px`, i.style.width = `${r.size}px`, i.style.height = `${r.size}px`, i.appendChild(document.createElement("span")), tt(e).appendChild(i), () => {
266
- i.setAttribute("data-leaving", "");
267
- let e = () => i.remove();
268
- i.firstElementChild?.addEventListener("animationend", e, { once: !0 }), setTimeout(e, et);
269
- };
270
- }
271
- function rt({ enabled: e = !0, ripple: t = !1, centered: n = !1, target: r } = {}) {
272
- let i = j(null);
273
- A(() => () => {
274
- i.current && clearTimeout(i.current);
275
- }, []);
276
- let a = k((e, n) => {
277
- if (e.matches(":disabled, [aria-disabled=\"true\"]")) return () => void 0;
278
- i.current && clearTimeout(i.current);
279
- let r = performance.now();
280
- e.setAttribute("data-pressed", "");
281
- let a = t ? nt(e, n) : null, o = !1;
282
- return () => {
283
- o || (o = !0, a?.(), i.current = setTimeout(() => e.removeAttribute("data-pressed"), Oe(performance.now() - r)));
284
- };
285
- }, [t]), o = k((t) => {
286
- if (!e || t.button !== 0) return;
287
- let i = t.currentTarget, o = a(r?.current ?? i, n ? null : {
288
- x: t.clientX,
289
- y: t.clientY
290
- });
291
- window.addEventListener("pointerup", o, { once: !0 }), window.addEventListener("pointercancel", o, { once: !0 }), i.addEventListener("pointerleave", o, { once: !0 });
292
- }, [
293
- e,
294
- n,
295
- r,
296
- a
297
- ]), s = k((t) => {
298
- if (!e || t.repeat || t.key !== " " && t.key !== "Enter") return;
299
- let n = t.currentTarget, i = a(r?.current ?? n, null);
300
- t.key === "Enter" ? i() : n.addEventListener("keyup", i, { once: !0 });
301
- }, [
302
- e,
303
- r,
304
- a
305
- ]);
306
- return xe(() => ({
307
- onPointerDown: o,
308
- onKeyDown: s
309
- }), [o, s]);
310
- }
311
- // src/components/Button/ButtonGroupContext.ts
312
- var it = ge(null);
313
- function at() {
314
- return ve(it);
315
- }
316
- var H = {
317
- root: "_root_bkmn0_6",
318
- size_xxs: "_size_xxs_bkmn0_45",
319
- size_xs: "_size_xs_bkmn0_52",
320
- size_small: "_size_small_bkmn0_59",
321
- size_medium: "_size_medium_bkmn0_66",
322
- size_large: "_size_large_bkmn0_73",
323
- size_xl: "_size_xl_bkmn0_80",
324
- iconOnly: "_iconOnly_bkmn0_89",
325
- icon: "_icon_bkmn0_89",
326
- shape_rectangle: "_shape_rectangle_bkmn0_107",
327
- shape_rounded: "_shape_rounded_bkmn0_111",
328
- shape_pill: "_shape_pill_bkmn0_115",
329
- shape_circle: "_shape_circle_bkmn0_119",
330
- shape_square: "_shape_square_bkmn0_131",
331
- color_primary: "_color_primary_bkmn0_149",
332
- color_secondary: "_color_secondary_bkmn0_159",
333
- color_success: "_color_success_bkmn0_169",
334
- color_error: "_color_error_bkmn0_179",
335
- color_warning: "_color_warning_bkmn0_189",
336
- color_info: "_color_info_bkmn0_199",
337
- color_neutral: "_color_neutral_bkmn0_209",
338
- variant_filled: "_variant_filled_bkmn0_220",
339
- disabled: "_disabled_bkmn0_226",
340
- disableElevation: "_disableElevation_bkmn0_234",
341
- variant_outlined: "_variant_outlined_bkmn0_244",
342
- variant_text: "_variant_text_bkmn0_263",
343
- variant_elevated: "_variant_elevated_bkmn0_279",
344
- variant_tonal: "_variant_tonal_bkmn0_297",
345
- loading: "_loading_bkmn0_321",
346
- fullWidth: "_fullWidth_bkmn0_325",
347
- disableTextTransform: "_disableTextTransform_bkmn0_329",
348
- showFocusRing: "_showFocusRing_bkmn0_340",
349
- content: "_content_bkmn0_347",
350
- loading_overlay: "_loading_overlay_bkmn0_355",
351
- loading_center: "_loading_center_bkmn0_356",
352
- loadingWrapper: "_loadingWrapper_bkmn0_374",
353
- loading_start: "_loading_start_bkmn0_386",
354
- loading_end: "_loading_end_bkmn0_387",
355
- spinner: "_spinner_bkmn0_392",
356
- spin: "_spin_bkmn0_392",
357
- srOnly: "_srOnly_bkmn0_403",
358
- group: "_group_bkmn0_423",
359
- orientation_horizontal: "_orientation_horizontal_bkmn0_428",
360
- orientation_vertical: "_orientation_vertical_bkmn0_432",
361
- groupFullWidth: "_groupFullWidth_bkmn0_436"
362
- }, ot = () => {
363
- let e = u();
364
- return /* @__PURE__ */ N("span", {
365
- className: H.spinner,
366
- role: "status",
367
- "aria-label": e.common.loading,
368
- children: /* @__PURE__ */ N("span", {
369
- className: H.srOnly,
370
- children: e.common.loading
371
- })
372
- });
373
- }, st = _e(({ type: e = "button", name: t, value: n, onClick: i, onFocus: a, onBlur: o, onMouseEnter: s, onMouseLeave: c, onPointerEnter: l, onPointerMove: u, onPointerLeave: d, onKeyDown: f, children: p, label: m, startIcon: h, endIcon: g, icon: _, tooltip: v, tooltipTrigger: y, disabled: b = !1, loading: x = !1, loadingPosition: S = "center", loadingIndicator: C, autoFocus: w = !1, tabIndex: T, preventDefault: E = !1, stopPropagation: D = !1, variant: ee = "elevated", size: te = "small", color: ne = "primary", shape: re = "rounded", className: ie = "", style: O = {}, fullWidth: ae = !1, disableTextTransform: oe = !1, disableElevation: se = !1, ripple: ce, feedback: le, showFocusRing: ue = !0, id: de, buttonRef: fe, href: pe, target: he, rel: ge, download: _e, component: ve, componentProps: A = {}, "aria-label": be, "aria-labelledby": M, "aria-describedby": Se, "aria-pressed": we, "aria-expanded": Ee, "aria-controls": De, "aria-haspopup": Oe, role: ke }, Ae) => {
374
- let F = at(), je = F?.size || te, I = F?.variant || ee, Me = F?.color || ne, L = F?.disabled || b, Ne = ye(), Pe = de || Ne, Fe = j(null), Ie = Re(Ae, fe, Fe);
375
- me.useEffect(() => {
376
- w && Fe.current && Fe.current.focus();
377
- }, [w]);
378
- let Le = !!_ && !p && !m, ze = p || m || "", Be = k((e) => {
379
- L || x || (E && e.preventDefault(), D && e.stopPropagation(), i?.(e));
380
- }, [
381
- L,
382
- x,
383
- E,
384
- D,
385
- i
386
- ]), z = le ?? (ce === !1 ? "none" : "ripple"), Ve = xe(() => {
387
- let e = Te({
388
- variant: I,
389
- size: je,
390
- color: Me,
391
- shape: re,
392
- isIconOnly: Le,
393
- disabled: L,
394
- loading: x,
395
- loadingPosition: S,
396
- fullWidth: ae,
397
- disableTextTransform: oe,
398
- disableElevation: se,
399
- showFocusRing: ue
400
- }).map((e) => H[e]).filter(Boolean);
401
- return z !== "none" && e.push($e.press), z === "ripple" && e.push($e.ripple), ie && e.push(ie), e.join(" ");
402
- }, [
403
- I,
404
- je,
405
- Me,
406
- re,
407
- Le,
408
- L,
409
- x,
410
- S,
411
- ae,
412
- oe,
413
- se,
414
- ue,
415
- ie,
416
- z
417
- ]), He = rt({
418
- enabled: z !== "none",
419
- ripple: z === "ripple"
420
- }), Ue = k((e) => {
421
- He.onPointerDown(e), A.onPointerDown?.(e);
422
- }, [He, A]), B = k((e) => {
423
- He.onKeyDown(e), f?.(e);
424
- }, [He, f]), { triggerProps: V, tooltipNode: We, hasTooltip: Ge } = Qe(v), Ke = r(v), qe = typeof Ke?.content == "string" ? Ke.content : void 0, Je = (L || x) && Ge, Ye = k((e) => {
425
- a?.(e), V.onFocus(e);
426
- }, [a, V]), Xe = k((e) => {
427
- o?.(e), V.onBlur();
428
- }, [o, V]), Ze = k((e) => {
429
- l?.(e), V.onPointerEnter(e);
430
- }, [l, V]), et = k((e) => {
431
- u?.(e), V.onPointerMove(e);
432
- }, [u, V]), tt = k((e) => {
433
- d?.(e), V.onPointerLeave();
434
- }, [d, V]), nt = C || /* @__PURE__ */ N(ot, {}), it = () => S === "overlay" || S === "center" ? /* @__PURE__ */ N("span", {
435
- className: `${H.loadingWrapper} ${H[`loading_${S}`] || ""}`,
436
- children: nt
437
- }) : nt, st = () => Le ? /* @__PURE__ */ N("span", {
438
- className: H.icon,
439
- children: _
440
- }) : /* @__PURE__ */ P("span", {
441
- className: H.content,
442
- children: [
443
- x && S === "start" && /* @__PURE__ */ N("span", {
444
- className: `${H.loadingWrapper} ${H.loading_start || ""}`,
445
- children: it()
446
- }),
447
- h && !x && /* @__PURE__ */ N("span", {
448
- className: `${H.icon} ${H.iconStart || ""}`,
449
- children: h
450
- }),
451
- ze && /* @__PURE__ */ N("span", { children: ze }),
452
- g && !x && /* @__PURE__ */ N("span", {
453
- className: `${H.icon} ${H.iconEnd || ""}`,
454
- children: g
455
- }),
456
- x && S === "end" && /* @__PURE__ */ N("span", {
457
- className: `${H.loadingWrapper} ${H.loading_end || ""}`,
458
- children: it()
459
- })
460
- ]
461
- }), U = x && (S === "overlay" || S === "center"), ct = {
462
- ref: Ie,
463
- id: Pe,
464
- name: t,
465
- value: n,
466
- disabled: L || x,
467
- tabIndex: T,
468
- className: Ve,
469
- style: O,
470
- onClick: Be,
471
- onFocus: Ye,
472
- onBlur: Xe,
473
- onMouseEnter: s,
474
- onMouseLeave: c,
475
- onKeyDown: B,
476
- "aria-label": be || (Le ? qe : void 0),
477
- "aria-labelledby": M,
478
- "aria-describedby": V["aria-describedby"] || Se,
479
- onPointerEnter: Ze,
480
- onPointerMove: et,
481
- onPointerLeave: tt,
482
- "aria-pressed": we,
483
- "aria-expanded": Ee,
484
- "aria-controls": De,
485
- "aria-haspopup": Oe,
486
- "aria-busy": x || void 0,
487
- "aria-disabled": L || void 0,
488
- role: ke || (pe ? "link" : void 0),
489
- ...A,
490
- onPointerDown: Ue
491
- }, W = /* @__PURE__ */ P(Ce, { children: [st(), U && it()] }), lt = () => {
492
- if (pe) {
493
- let { disabled: e, ref: t, ...n } = ct;
494
- return /* @__PURE__ */ N("a", {
495
- ...n,
496
- href: pe,
497
- target: he,
498
- rel: ge || (he === "_blank" ? "noopener noreferrer" : void 0),
499
- download: _e,
500
- children: W
501
- });
502
- }
503
- return N(ve || "button", {
504
- ...ct,
505
- type: e,
506
- children: W
507
- });
508
- };
509
- return Ge ? /* @__PURE__ */ P(Ce, { children: [Je ? /* @__PURE__ */ N("span", {
510
- className: R.disabledAnchor,
511
- onPointerEnter: V.onPointerEnter,
512
- onPointerLeave: V.onPointerLeave,
513
- children: lt()
514
- }) : lt(), We] }) : lt();
515
- });
516
- st.displayName = "Button";
517
- // src/file/workerPool.ts
518
- var U = class extends Error {
519
- constructor(e, t) {
520
- super(t), this.name = "WorkerFallback", this.reason = e;
521
- }
522
- };
523
- function ct(e) {
524
- let t = [], n = /* @__PURE__ */ new Set(), r = !1, i = 0, a = () => {
525
- let t = e.create();
526
- return e.init !== void 0 && t.postMessage(e.init), {
527
- worker: t,
528
- started: !1
529
- };
530
- }, o = (r) => {
531
- n.delete(r), t.length < e.size ? t.push(r) : r.worker.terminate();
532
- }, s = (e) => {
533
- n.delete(e), e.worker.terminate();
534
- };
535
- return {
536
- get broken() {
537
- return r;
538
- },
539
- run(e, { signal: c, progress: l }) {
540
- return new Promise((u, d) => {
541
- if (r) return d(new U("unavailable", "Workers are unavailable"));
542
- if (c.aborted) return d(new DOMException("Aborted", "AbortError"));
543
- let f;
544
- try {
545
- f = t.pop() ?? a();
546
- } catch (e) {
547
- return r = !0, d(new U("unavailable", `Worker could not be created: ${String(e)}`));
548
- }
549
- n.add(f);
550
- let p = ++i, m = () => {
551
- f.worker.removeEventListener("message", h), f.worker.removeEventListener("error", g), f.worker.removeEventListener("messageerror", _), c.removeEventListener("abort", v);
552
- }, h = (e) => {
553
- let t = e.data;
554
- if (t && t.id === p) {
555
- if (f.started = !0, t.type === "progress") return l(t.fraction);
556
- m(), o(f), t.type === "done" ? u(t.buffer) : d(Error(t.message));
557
- }
558
- }, g = (e) => {
559
- e.preventDefault?.(), m(), s(f), f.started ? d(Error(e.message || "The file worker stopped unexpectedly")) : (r = !0, d(new U("unavailable", e.message || "The file worker failed to start")));
560
- }, _ = () => {
561
- m(), s(f), d(/* @__PURE__ */ Error("The file worker sent a message that could not be read"));
562
- }, v = () => {
563
- m(), s(f), d(c.reason ?? new DOMException("Aborted", "AbortError"));
564
- };
565
- f.worker.addEventListener("message", h), f.worker.addEventListener("error", g), f.worker.addEventListener("messageerror", _), c.addEventListener("abort", v);
566
- try {
567
- f.worker.postMessage({
568
- type: "run",
569
- id: p,
570
- task: e
571
- });
572
- } catch (e) {
573
- m(), o(f), d(new U("uncloneable", e instanceof Error ? e.message : String(e)));
574
- }
575
- });
576
- },
577
- dispose() {
578
- for (let e of [...t, ...n]) e.worker.terminate();
579
- t.length = 0, n.clear();
580
- }
581
- };
582
- }
583
- // src/file/fileEngine.ts
584
- var W = class extends Error {
585
- constructor(e, t) {
586
- super(t), this.name = "FileEngineError", this.code = e;
587
- }
588
- }, lt = (e, t, n) => ce(e, fe(t.filename) + de(t.format), t.format, n, t.title ?? t.filename), ut = () => typeof navigator > "u" ? void 0 : navigator.userActivation?.isActive, dt = (e) => e instanceof Error ? e.message : String(e), ft = () => new Worker(new URL("./assets/fileTask.worker--Q3rI3Bn.js", import.meta.url), { type: "module" }), pt = () => typeof Worker < "u", mt = 0;
589
- function ht(e = {}) {
590
- let t = Ae(e), n = e.deliver ?? lt, r = `file-${++mt}-`, i = [], a = 0, o = !1, s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(), d = null, f = t.workers === "auto" && (!!e.createWorker || pt()), p = () => {
591
- if (!f) return null;
592
- if (!d) {
593
- let n = typeof navigator < "u" && navigator.hardwareConcurrency ? navigator.hardwareConcurrency : t.concurrency;
594
- d = ct({
595
- size: Math.max(1, Math.min(t.concurrency, n)),
596
- create: e.createWorker ?? ft,
597
- ...e.pdfFonts ? { init: {
598
- type: "init",
599
- pdfFonts: e.pdfFonts
600
- } } : {}
601
- });
602
- }
603
- return d;
604
- }, m = async (t, n, r) => {
605
- let i = p(), a;
606
- if (i && !i.broken) try {
607
- a = await i.run(t, r);
608
- } catch (n) {
609
- if (!(n instanceof U)) throw n;
610
- a = await pe(t, {
611
- ...r,
612
- pdfFonts: e.pdfFonts
613
- });
614
- }
615
- else a = await pe(t, {
616
- ...r,
617
- pdfFonts: e.pdfFonts
618
- });
619
- return new Blob([a], { type: ue[n] });
620
- }, h = (e) => i.find((t) => t.id === e), g = () => u.forEach((e) => e()), _ = (e, t) => {
621
- i = i.map((n) => n.id === e ? {
622
- ...n,
623
- ...t
624
- } : n);
625
- }, v = (e) => {
626
- if (!e.length) return;
627
- let t = new Set(e);
628
- i = i.filter((e) => !t.has(e.id)), e.forEach((e) => {
629
- s.delete(e), c.delete(e);
630
- });
631
- }, y = (e, t) => {
632
- let n = l.get(e);
633
- n && (clearTimeout(n.timer), l.delete(e), t !== void 0 && n.controller.abort(t));
634
- }, b = () => {
635
- v(Le(i, t.keepFinished)), o || L(i, t.concurrency).forEach(S), g();
636
- }, x = (e, t) => {
637
- let n = h(e);
638
- n && (Pe(n) ? _(e, {
639
- status: "queued",
640
- progress: 0,
641
- error: dt(t)
642
- }) : _(e, {
643
- status: "failed",
644
- finishedAt: Date.now(),
645
- error: dt(t)
646
- }));
647
- }, S = (e) => {
648
- let n = s.get(e), r = h(e);
649
- if (!n || !r) return;
650
- let i = new AbortController(), a = setTimeout(() => {
651
- if (!l.has(e)) return;
652
- let n = new W("timeout", `Timed out after ${t.timeoutMs} ms`);
653
- y(e, n), x(e, n), b();
654
- }, t.timeoutMs);
655
- l.set(e, {
656
- controller: i,
657
- timer: a
658
- }), _(e, {
659
- status: "running",
660
- attempts: r.attempts + 1,
661
- startedAt: Date.now(),
662
- progress: 0,
663
- error: void 0
664
- });
665
- let o = () => l.get(e)?.controller === i, u = (t) => {
666
- if (!o()) return;
667
- let n = h(e), r = n ? Fe(n.progress, t) : null;
668
- r !== null && (_(e, { progress: r }), g());
669
- }, d;
670
- try {
671
- let e = {
672
- signal: i.signal,
673
- progress: u
674
- };
675
- d = n.task ? m(n.task, r.format, e) : n.build(e);
676
- } catch (e) {
677
- d = Promise.reject(e);
678
- }
679
- Promise.resolve(d).then((e) => e instanceof Blob ? e : le(r.format, e)).then((t) => {
680
- if (!o()) return;
681
- y(e), c.set(e, t);
682
- let i = Ie(r.action ?? "download", {
683
- activationActive: ut(),
684
- sinceSubmitMs: Date.now() - r.createdAt
685
- });
686
- _(e, {
687
- status: "ready",
688
- progress: 1,
689
- finishedAt: Date.now(),
690
- awaitingClick: i === "wait"
691
- });
692
- let a = h(e);
693
- try {
694
- n.onReady?.(t, a);
695
- } catch {}
696
- b(), i === "now" && C.deliver(e);
697
- }).catch((t) => {
698
- o() && (y(e), x(e, t), b());
699
- });
700
- }, C = {
701
- submit(e) {
702
- if (o) throw new W("disposed", "The file engine has been disposed");
703
- let n = Ne(i, e, t.maxQueued);
704
- if (n.kind === "reject") throw new W("queue-full", `The file queue is full (${t.maxQueued} waiting)`);
705
- if (n.kind === "reuse") return n.id;
706
- n.cancel.forEach((e) => C.cancel(e));
707
- let c = r + ++a, l = Number.isInteger(e.retry) && e.retry > 0 ? e.retry : 0;
708
- return s.set(c, e), i = [...i, {
709
- id: c,
710
- format: e.task ? e.task.kind : e.format,
711
- filename: e.filename,
712
- ...e.title ? { title: e.title } : {},
713
- action: e.action ?? "download",
714
- priority: e.priority ?? "normal",
715
- ...e.dedupeKey ? { dedupeKey: e.dedupeKey } : {},
716
- status: "queued",
717
- progress: 0,
718
- attempts: 0,
719
- retry: l,
720
- notify: e.notify ?? "all",
721
- seq: a,
722
- createdAt: Date.now()
723
- }], b(), c;
724
- },
725
- cancel(e) {
726
- let t = h(e);
727
- t && !I(t) && (y(e, new DOMException("Cancelled", "AbortError")), c.delete(e), _(e, {
728
- status: "cancelled",
729
- finishedAt: Date.now(),
730
- awaitingClick: !1
731
- }), b());
732
- },
733
- retry(e) {
734
- let t = h(e);
735
- t && s.has(e) && (t.status === "failed" || t.status === "cancelled") && (_(e, {
736
- status: "queued",
737
- attempts: 0,
738
- progress: 0,
739
- error: void 0,
740
- finishedAt: void 0,
741
- seq: ++a
742
- }), b());
743
- },
744
- async deliver(e, t) {
745
- let r = h(e), i = c.get(e);
746
- if (!r || r.status !== "ready" || !i) return;
747
- let a = t ?? r.action;
748
- try {
749
- if (a !== "none" && await n(i, r, a), h(e)?.status !== "ready") return;
750
- c.delete(e), _(e, {
751
- status: "delivered",
752
- finishedAt: Date.now(),
753
- awaitingClick: !1
754
- });
755
- } catch (t) {
756
- if (h(e)?.status !== "ready") return;
757
- c.delete(e), _(e, {
758
- status: "failed",
759
- finishedAt: Date.now(),
760
- error: dt(t),
761
- awaitingClick: !1
762
- });
763
- }
764
- b();
765
- },
766
- wait(e) {
767
- let t = () => {
768
- let t = h(e);
769
- if (t) return I(t) || t.status === "ready" && t.awaitingClick ? t : null;
770
- }, n = t();
771
- return n === null ? new Promise((e) => {
772
- let n = C.subscribe(() => {
773
- let r = t();
774
- r !== null && (n(), e(r));
775
- });
776
- }) : Promise.resolve(n);
777
- },
778
- clear(e) {
779
- v(i.filter((t) => (I(t) || e && t.status === "ready") && (!e || e(t))).map((e) => e.id)), g();
780
- },
781
- getJobs: () => i,
782
- subscribe(e) {
783
- return u.add(e), () => {
784
- u.delete(e);
785
- };
786
- },
787
- dispose() {
788
- if (!o) {
789
- o = !0;
790
- for (let e of [...l.keys()]) y(e, new DOMException("Disposed", "AbortError")), _(e, {
791
- status: "cancelled",
792
- finishedAt: Date.now()
793
- });
794
- i.filter((e) => e.status === "queued").forEach((e) => _(e.id, {
795
- status: "cancelled",
796
- finishedAt: Date.now()
797
- })), d?.dispose(), g(), u.clear();
798
- }
799
- }
800
- };
801
- return C;
802
- }
803
- // src/components/FileEngine/FileEngineContext.ts
804
- var gt = ge(null), _t = null;
805
- function vt() {
806
- return _t ||= ht(), _t;
807
- }
808
- function yt() {
809
- return ve(gt) ?? vt();
810
- }
811
- function bt() {
812
- let e = yt();
813
- return {
814
- jobs: Se(e.subscribe, e.getJobs, e.getJobs),
815
- submit: k((t) => e.submit(t), [e]),
816
- cancel: k((t) => e.cancel(t), [e]),
817
- retry: k((t) => e.retry(t), [e]),
818
- deliver: k((t, n) => e.deliver(t, n), [e]),
819
- wait: k((t) => e.wait(t), [e]),
820
- clear: k((t) => e.clear(t), [e]),
821
- engine: e
822
- };
823
- }
824
- function xt(e) {
825
- let t = yt(), n = k(() => e ? t.getJobs().find((t) => t.id === e) : void 0, [t, e]);
826
- return Se(t.subscribe, n, n);
827
- }
828
- // src/components/Charts/menuPlacement.ts
829
- function St(e, t, n, { align: r = "end", offset: i = 4, margin: a = 8 } = {}) {
830
- let o = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), s = e.top + e.height, c = n.height - a - (s + i), l = e.top - i - a, u = t.height <= c || c >= l ? "below" : "above", d = u === "below" ? s + i : e.top - i - t.height;
831
- return {
832
- left: o(r === "end" ? e.left + e.width - t.width : e.left, a, n.width - t.width - a),
833
- top: o(d, a, n.height - t.height - a),
834
- side: u
835
- };
836
- }
837
- function Ct(e, t, n) {
838
- return {
839
- x: e.left - t,
840
- y: e.top - n
841
- };
842
- }
843
- // src/components/Charts/AnchoredMenu.tsx
844
- var wt = () => ({
845
- width: document.documentElement.clientWidth || window.innerWidth,
846
- height: document.documentElement.clientHeight || window.innerHeight
847
- });
848
- function Tt({ trigger: e, items: t, onSelect: n, align: r = "end", "aria-label": i }) {
849
- let a = _(), o = j(null), s = j(null), c = j([]), [l, u] = M(!1), [d, f] = M(-1), p = k((e) => {
850
- u(!1), f(-1), e && o.current?.querySelector("button")?.focus({ preventScroll: !0 });
851
- }, []), m = k(() => {
852
- let e = o.current, t = s.current;
853
- if (!e || !t) return;
854
- let n = Ct(t.getBoundingClientRect(), parseFloat(t.style.left) || 0, parseFloat(t.style.top) || 0), i = St(e.getBoundingClientRect(), {
855
- width: t.offsetWidth,
856
- height: t.offsetHeight
857
- }, wt(), { align: r });
858
- t.style.left = `${Math.round(i.left - n.x)}px`, t.style.top = `${Math.round(i.top - n.y)}px`, t.style.visibility = "visible", t.dataset.side = i.side;
859
- }, [r]);
860
- be(() => {
861
- l && m();
862
- }, [
863
- l,
864
- m,
865
- t.length
866
- ]), A(() => {
867
- if (!l) return;
868
- let e = 0, t = () => {
869
- cancelAnimationFrame(e), e = requestAnimationFrame(m);
870
- }, n = (e) => {
871
- let t = e.target;
872
- !s.current?.contains(t) && !o.current?.contains(t) && p(!1);
873
- };
874
- return window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), document.addEventListener("pointerdown", n, !0), () => {
875
- cancelAnimationFrame(e), window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t), document.removeEventListener("pointerdown", n, !0);
876
- };
877
- }, [
878
- l,
879
- m,
880
- p
881
- ]), A(() => {
882
- l && d >= 0 && c.current[d]?.focus({ preventScroll: !0 });
883
- }, [l, d]);
884
- let h = (e) => {
885
- u(!0), f(e && t.length ? 0 : -1);
886
- }, g = (e) => f((n) => n < 0 ? e > 0 ? 0 : t.length - 1 : (n + e + t.length) % t.length);
887
- return /* @__PURE__ */ P(Ce, { children: [/* @__PURE__ */ N("span", {
888
- ref: o,
889
- className: "chart-menu-anchor",
890
- children: he(e, {
891
- "aria-haspopup": "menu",
892
- "aria-expanded": l,
893
- onClick: (t) => {
894
- e.props.onClick?.(t), l ? p(!1) : h(!1);
895
- },
896
- onKeyDown: (t) => {
897
- e.props.onKeyDown?.(t), l || t.key !== "ArrowDown" && t.key !== "Enter" && t.key !== " " || (t.preventDefault(), h(!0));
898
- }
899
- })
900
- }), l && a && we(/* @__PURE__ */ N("div", {
901
- ref: s,
902
- className: "chart-menu",
903
- role: "menu",
904
- "aria-label": i,
905
- tabIndex: -1,
906
- style: {
907
- left: 0,
908
- top: 0,
909
- visibility: "hidden"
910
- },
911
- onKeyDown: (e) => {
912
- switch (e.key) {
913
- case "ArrowDown":
914
- e.preventDefault(), g(1);
915
- break;
916
- case "ArrowUp":
917
- e.preventDefault(), g(-1);
918
- break;
919
- case "Home":
920
- e.preventDefault(), f(0);
921
- break;
922
- case "End":
923
- e.preventDefault(), f(t.length - 1);
924
- break;
925
- case "Escape":
926
- e.preventDefault(), e.stopPropagation(), p(!0);
927
- break;
928
- case "Tab": p(!1);
929
- }
930
- },
931
- children: t.map((e, t) => /* @__PURE__ */ P("button", {
932
- ref: (e) => {
933
- c.current[t] = e;
934
- },
935
- type: "button",
936
- role: "menuitem",
937
- tabIndex: d === t ? 0 : -1,
938
- className: `chart-menu-item${d === t ? " chart-menu-item--cursor" : ""}`,
939
- onMouseEnter: () => f(t),
940
- onClick: () => {
941
- p(!0), n(e.value);
942
- },
943
- children: [e.icon && /* @__PURE__ */ N("span", {
944
- className: "chart-menu-item-icon",
945
- "aria-hidden": !0,
946
- children: e.icon
947
- }), e.label]
948
- }, e.value))
949
- }), a)] });
950
- }
951
- // src/components/Charts/chartImage.ts
952
- var G = {
953
- background: "#ffffff",
954
- text: "#0f0f0f",
955
- muted: "#616161",
956
- faint: "#737373",
957
- line: "#e6e6e6",
958
- track: "#ebebeb",
959
- slots: ie.light,
960
- heat: C.light
961
- }, K = 28, q = 16, Et = 22, Dt = 14, Ot = 12, J = 20, Y = 28, X = 220, kt = 220, At = 44, jt = 80, Mt = 300, Nt = 36, Pt = 3, Ft = 10, It = 50, Z = 664, Lt = (e) => ({
962
- title: `700 ${Et}px ${e}`,
963
- report: `600 ${Dt}px ${e}`,
964
- big: `700 ${At}px ${e}`,
965
- bold: `700 ${Dt}px ${e}`,
966
- text: `400 ${Dt}px ${e}`,
967
- small: `400 ${Ot}px ${e}`
968
- });
969
- function Rt(e) {
970
- if (e.format) return e.format;
971
- let t;
972
- try {
973
- t = new Intl.NumberFormat(e.locale);
974
- } catch {
975
- t = new Intl.NumberFormat();
976
- }
977
- return (e) => t.format(e);
978
- }
979
- function zt(e, t) {
980
- try {
981
- return new Intl.DateTimeFormat(t, {
982
- dateStyle: "medium",
983
- timeStyle: "short"
984
- }).format(e);
985
- } catch {
986
- return e.toLocaleString();
987
- }
988
- }
989
- var Bt = (e, t) => {
990
- let n = e.reduce((e, t) => e + t.value, 0);
991
- return e.map((e) => ({
992
- slot: e.slot,
993
- label: e.label,
994
- value: `${t(e.value)} · ${s(l(e.value, n))}`
995
- }));
996
- };
997
- function Vt(e) {
998
- switch (e.kind) {
999
- case "donut":
1000
- case "pie": return Math.max(X, e.slices.length * Y);
1001
- case "stacked": return 48 + Math.ceil(e.slices.length / 2) * Y;
1002
- case "bars": return (e.series.length > 1 ? Y : 0) + Math.max(1, e.data.length) * Y;
1003
- case "columns": return (e.series.length > 1 ? 44 + Math.ceil(e.series.length / 2) * Y : 0) + kt + J + 8;
1004
- case "line": return 264 + Math.ceil(e.series.length / 2) * Y;
1005
- case "progress": return Math.max(1, e.rows.length) * It;
1006
- case "number": return At + ((e.points?.length ?? 0) > 1 ? 116 : 0) + (e.previous === void 0 ? 0 : 24);
1007
- case "gauge": return Wt(e.rows.length, e.variant ?? "half").height + 8 + 40;
1008
- case "funnel": return Math.max(1, e.steps.length) * Nt;
1009
- case "treemap": return 316 + Math.ceil(e.nodes.length / 2) * Y;
1010
- case "calendar": {
1011
- let { cell: t } = Ut(S(e.days).weeks);
1012
- return J + 7 * (t + Ht) + q + Y;
1013
- }
1014
- }
1015
- }
1016
- var Ht = 3;
1017
- function Ut(e) {
1018
- return { cell: Math.max(4, Math.min(16, 608 / Math.max(1, e) - Ht)) };
1019
- }
1020
- function Wt(e, t) {
1021
- let n = Z / Math.max(1, e), r = D[t], i = Math.min(t === "half" ? 260 : 200, n - 24);
1022
- return {
1023
- cell: n,
1024
- width: i,
1025
- height: i * r.height / r.width,
1026
- k: i / r.width
1027
- };
1028
- }
1029
- function Q(e, t, n) {
1030
- if (e.measureText(t).width <= n) return t;
1031
- let r = 0, i = t.length;
1032
- for (; r < i;) {
1033
- let a = Math.ceil((r + i) / 2);
1034
- e.measureText(`${t.slice(0, a)}…`).width <= n ? r = a : i = a - 1;
1035
- }
1036
- return `${t.slice(0, r)}…`;
1037
- }
1038
- function Gt(e, t, n, r = Pt) {
1039
- if (r <= 1 || e.measureText(t).width <= n) return [Q(e, t, n)];
1040
- let i = t.split(" "), a = "", o = 0;
1041
- for (; o < i.length; o++) {
1042
- let t = a ? `${a} ${i[o]}` : i[o];
1043
- if (e.measureText(t).width > n) break;
1044
- a = t;
1045
- }
1046
- return a ? [a, ...Gt(e, i.slice(o).join(" "), n, r - 1)] : [Q(e, t, n)];
1047
- }
1048
- function Kt(e, t, n, r) {
1049
- e.fillStyle = O(r, "light"), e.fillRect(t, n - 6, 12, 12);
1050
- }
1051
- function $(e, t, n, r, i, a, o) {
1052
- let s = (a - (o - 1) * q) / o;
1053
- t.forEach((t, a) => {
1054
- let c = r + a % o * (s + q), l = i + Math.floor(a / o) * Y + Y / 2;
1055
- Kt(e, c, l, t.slot), e.font = n.bold, e.textAlign = "right", e.fillStyle = G.text, e.fillText(t.value, c + s, l);
1056
- let u = e.measureText(t.value).width;
1057
- e.font = n.text, e.textAlign = "left", e.fillText(Q(e, t.label, s - 20 - u - 10), c + 20, l);
1058
- });
1059
- }
1060
- function qt(e, n, r, i, a, o) {
1061
- let c = X / 100, u = r + X / 2, d = 40 * c;
1062
- e.lineWidth = 16 * c, e.lineCap = "butt";
1063
- let f = (e) => -Math.PI / 2 + e / re * 2 * Math.PI, p = t(n);
1064
- p.length || (e.globalAlpha = .5, e.strokeStyle = G.slots.rest, e.beginPath(), e.arc(138, u, d, 0, 2 * Math.PI), e.stroke(), e.globalAlpha = 1);
1065
- for (let t of p) e.strokeStyle = O(t.slice.slot, "light"), e.beginPath(), e.arc(138, u, d, f(t.start), f(t.start + t.length)), e.stroke();
1066
- let m = n.reduce((e, t) => e + t.value, 0), h = n[0];
1067
- e.textAlign = "center", m > 0 && h ? (e.font = o.title, e.fillStyle = G.text, e.fillText(s(l(h.value, m)), 138, u - 6), e.font = o.small, e.fillStyle = G.muted, e.fillText(Q(e, h.label.toLowerCase(), d * 1.3), 138, u + 16)) : (e.font = o.small, e.fillStyle = G.muted, e.fillText(a.empty, 138, u));
1068
- let g = Bt(n, i);
1069
- $(e, g, o, 276, r + Math.max(0, (X - g.length * Y) / 2), 416, 1);
1070
- }
1071
- var Jt = (e) => e - Math.PI / 2;
1072
- function Yt(t, n, r, i, a, o) {
1073
- let c = X / 100, l = r + X / 2, u = e(n);
1074
- u.length || (t.globalAlpha = .5, t.fillStyle = G.slots.rest, t.beginPath(), t.arc(138, l, 48 * c, 0, 2 * Math.PI), t.fill(), t.globalAlpha = 1, t.font = o.small, t.textAlign = "center", t.fillStyle = G.text, t.fillText(a.empty, 138, l)), t.lineWidth = 2, t.lineJoin = "round";
1075
- for (let e of u) t.fillStyle = O(e.slice.slot, "light"), t.strokeStyle = G.background, t.beginPath(), u.length > 1 && t.moveTo(138, l), t.arc(138, l, 48 * c, Jt(e.a0), Jt(e.a1)), t.closePath(), t.fill(), u.length > 1 && t.stroke();
1076
- t.font = o.bold, t.textAlign = "center";
1077
- for (let e of u) e.label && (t.fillStyle = ae(O(e.slice.slot, "light")), t.fillText(s(e.share), K + e.label.x * c, r + e.label.y * c));
1078
- let d = Bt(n, i);
1079
- $(t, d, o, 276, r + Math.max(0, (X - d.length * Y) / 2), 416, 1);
1080
- }
1081
- function Xt(e, t, n, r, i) {
1082
- let a = t.reduce((e, t) => e + t.value, 0), o = t.filter((e) => e.value > 0), s = Math.max(0, o.length - 1) * 2, c = K;
1083
- e.fillStyle = G.track, a || e.fillRect(K, n, Z, 32);
1084
- for (let t of o) {
1085
- let r = (Z - s) * t.value / a;
1086
- e.fillStyle = O(t.slot, "light"), e.fillRect(c, n, r, 32), c += r + 2;
1087
- }
1088
- $(e, Bt(t, r), i, K, n + 32 + q, Z, 2);
1089
- }
1090
- function Zt(e, t, n, r) {
1091
- let i = K;
1092
- e.font = r.text, e.textAlign = "left";
1093
- for (let r of t) Kt(e, i, n, r.slot), e.fillStyle = G.text, e.fillText(r.label, i + 18, n), i += 18 + e.measureText(r.label).width + 24;
1094
- }
1095
- function Qt(e, t, n, r, i, a, o) {
1096
- let c = r;
1097
- n.length > 1 && (Zt(e, n, c + Y / 2, o), c += Y);
1098
- let u = t.map((e) => se(e, n)), d = u.reduce((e, t) => e + t, 0);
1099
- if (!d) {
1100
- e.font = o.text, e.fillStyle = G.muted, e.textAlign = "left", e.fillText(a.empty, K, c + Y / 2);
1101
- return;
1102
- }
1103
- let f = ne(u), p = Math.min(200, Z * .3), m = 239.2, h = 310.8;
1104
- t.forEach((t, r) => {
1105
- let a = c + r * Y + Y / 2;
1106
- e.font = o.text, e.textAlign = "left", e.fillStyle = G.text, e.fillText(Q(e, t.fullLabel ?? t.label, p), K, a), e.fillStyle = G.track, e.fillRect(m, a - 7, h, 14);
1107
- let g = m;
1108
- for (let r of n) {
1109
- let i = t.values[r.key] ?? 0;
1110
- if (!i) continue;
1111
- let o = i / f * h;
1112
- e.fillStyle = O(n.length === 1 && t.slot ? t.slot : r.slot, "light"), e.fillRect(g, a - 7, o, 14), g += o;
1113
- }
1114
- e.font = o.bold, e.textAlign = "right", e.fillStyle = G.text, e.fillText(n.length === 1 ? `${i(u[r])} · ${s(l(u[r], d))}` : i(u[r]), 692, a);
1115
- });
1116
- }
1117
- function $t(e, t, n, r, i, a) {
1118
- let o = r + kt;
1119
- e.font = a.small, e.textAlign = "right", e.lineWidth = 1;
1120
- for (let r of t) {
1121
- let t = o - r / n * 204;
1122
- e.fillStyle = G.faint, e.fillText(i(r), 76, t), e.strokeStyle = G.line, e.setLineDash(r === 0 ? [] : [4, 4]), e.beginPath(), e.moveTo(84, t), e.lineTo(692, t), e.stroke();
1123
- }
1124
- return e.setLineDash([]), {
1125
- plotX: 84,
1126
- plotW: 608,
1127
- bottom: o,
1128
- plotH: 204
1129
- };
1130
- }
1131
- function en(e, t, n, r, i, a, o, c) {
1132
- let u = t.flatMap((e) => n.map((t) => e.values[t.key] ?? 0)), { max: f, ticks: p } = T(u), { plotX: m, plotW: h, bottom: g, plotH: _ } = $t(e, p, f, i, a, c);
1133
- if (!u.some((e) => e > 0)) e.textAlign = "center", e.fillStyle = G.muted, e.fillText(o.empty, m + h / 2, i + kt / 2);
1134
- else {
1135
- e.lineWidth = 2, e.lineJoin = "round";
1136
- for (let i of n) {
1137
- let n = d(t.map((e) => e.values[i.key] ?? 0), h, _, f).map((e) => ({
1138
- x: m + e.x,
1139
- y: g - _ + e.y
1140
- })), a = O(i.slot, "light");
1141
- r && n.length && (e.globalAlpha = .14, e.fillStyle = a, e.beginPath(), n.forEach((t, n) => n ? e.lineTo(t.x, t.y) : e.moveTo(t.x, t.y)), e.lineTo(n[n.length - 1].x, g), e.lineTo(n[0].x, g), e.closePath(), e.fill(), e.globalAlpha = 1), e.strokeStyle = a, e.beginPath(), n.forEach((t, n) => n ? e.lineTo(t.x, t.y) : e.moveTo(t.x, t.y)), e.stroke();
1142
- }
1143
- }
1144
- e.font = c.small, e.fillStyle = G.muted;
1145
- let v = x(t.length, 6);
1146
- for (let n of v) {
1147
- let r = m + ee(n, t.length, h);
1148
- e.textAlign = n === 0 ? "left" : n === t.length - 1 ? "right" : "center", e.fillText(Q(e, t[n].label, h / v.length), r, g + J / 2 + 4);
1149
- }
1150
- let y = n.map((e) => t.reduce((t, n) => t + (n.values[e.key] ?? 0), 0)), b = y.reduce((e, t) => e + t, 0);
1151
- $(e, n.map((e, t) => ({
1152
- slot: e.slot,
1153
- label: e.label,
1154
- value: n.length > 1 ? `${a(y[t])} · ${s(l(y[t], b))}` : `${o.total}: ${a(y[t])}`
1155
- })), c, K, g + J + 8 + q, Z, 2);
1156
- }
1157
- function tn(e, t, n, r, a, o, c, u) {
1158
- let d = a;
1159
- n.length > 1 && (Zt(e, n, d + Y / 2, u), d += Y);
1160
- let p = r === "grouped" && n.length > 1, m = t.map((e) => se(e, n)), { max: h, ticks: g } = T(y(t, n, p ? "grouped" : "stacked")), { plotX: _, plotW: v, bottom: b } = $t(e, g, h, d, o, u);
1161
- if (!m.some((e) => e > 0)) {
1162
- e.textAlign = "center", e.fillStyle = G.muted, e.fillText(c.empty, _ + v / 2, d + kt / 2);
1163
- return;
1164
- }
1165
- if (n.length > 1) {
1166
- let r = n.map((e) => t.reduce((t, n) => t + (n.values[e.key] ?? 0), 0)), i = r.reduce((e, t) => e + t, 0);
1167
- $(e, n.map((e, t) => ({
1168
- slot: e.slot,
1169
- label: e.label,
1170
- value: `${o(r[t])} · ${s(l(r[t], i))}`
1171
- })), u, K, b + J + 8 + q, Z, 2);
1172
- }
1173
- let x = v / Math.max(1, t.length), S = p ? Math.min(24 * n.length, x * .8) : Math.min(48, x * .6), C = i(n.length, S, 2);
1174
- t.forEach((r, i) => {
1175
- let a = _ + i * x + (x - S) / 2, s = b;
1176
- n.forEach((t, n) => {
1177
- let i = r.values[t.key] ?? 0;
1178
- if (!i) return;
1179
- let o = i / h * 204;
1180
- e.fillStyle = O(t.slot, "light"), p ? (e.fillRect(a + C[n].x, b - o, C[n].width, o), s = Math.min(s, b - o)) : (e.fillRect(a, s - o, S, o), s -= o);
1181
- }), e.textAlign = "center", m[i] && (e.font = u.small, e.fillStyle = G.text, e.fillText(o(m[i]), a + S / 2, s - 8)), f(i, t.length) && (e.font = u.small, e.fillStyle = G.muted, e.fillText(Q(e, r.label, x - 4), a + S / 2, b + J / 2 + 4));
1182
- });
1183
- }
1184
- function nn(e, t, n) {
1185
- e.beginPath(), t.forEach((t, n) => n ? e.lineTo(t.x, t.y) : e.moveTo(t.x, t.y)), n !== void 0 && t.length && (e.lineTo(t[t.length - 1].x, n), e.lineTo(t[0].x, n), e.closePath());
1186
- }
1187
- function rn(e, t, n, r, i, a) {
1188
- let c = t.points ?? [];
1189
- e.textAlign = "left", e.font = a.big, e.fillStyle = G.text;
1190
- let l = r(t.value);
1191
- e.fillText(l, K, n + At / 2);
1192
- let u = e.measureText(l).width, d = n + At;
1193
- if (t.previous !== void 0) {
1194
- let r = m(t.current ?? c.reduce((e, t) => e + t.value, 0), t.previous), o = h(r.direction, t.good ?? "up"), l = r.direction === "up" ? "▲" : r.direction === "down" ? "▼" : "=";
1195
- e.font = a.bold, e.fillStyle = O(o, "light"), e.fillText(`${l} ${r.percent === null ? i.deltaNew : s(Math.abs(r.percent))}`, K + u + 16, n + At / 2 + 6);
1196
- }
1197
- if (c.length > 1) {
1198
- d += q;
1199
- let n = O(t.slot ?? 1, "light"), r = o(c.map((e) => e.value), Z, jt).map((e) => ({
1200
- x: K + e.x,
1201
- y: d + e.y
1202
- }));
1203
- e.globalAlpha = .14, e.fillStyle = n, nn(e, r, d + jt), e.fill(), e.globalAlpha = 1, e.strokeStyle = n, e.lineWidth = 2, e.lineJoin = "round", nn(e, r), e.stroke(), d += jt, e.font = a.small, e.fillStyle = G.muted, e.fillText(c[0].label, K, d + J / 2), e.textAlign = "right", e.fillText(c[c.length - 1].label, 692, d + J / 2), e.textAlign = "left", d += J;
1204
- }
1205
- t.previous !== void 0 && (e.font = a.small, e.fillStyle = G.faint, e.fillText(i.vsPrevious, K, d + 4 + J / 2));
1206
- }
1207
- function an(e, t, n, r, i, a) {
1208
- if (t.reduce((e, t) => e + Math.max(0, t.value), 0) <= 0) {
1209
- e.font = a.text, e.fillStyle = G.muted, e.textAlign = "left", e.fillText(i.empty, K, n + J / 2);
1210
- return;
1211
- }
1212
- let o = c(t, Z, Mt);
1213
- for (let t of o) {
1214
- let i = t.parent ?? t.node, o = O(i.slot, "light"), s = !!t.node.children?.some((e) => e.value > 0);
1215
- t.parent && (e.globalAlpha = E(t.parent.children.filter((e) => e.value > 0).indexOf(t.node))), e.fillStyle = o, e.fillRect(K + t.rect.x + 1, n + t.rect.y + 1, Math.max(0, t.rect.w - 2), Math.max(0, t.rect.h - 2)), e.globalAlpha = 1, t.label && (e.textAlign = "left", e.fillStyle = ae(o), e.font = a.bold, e.fillText(Q(e, t.node.label, t.rect.w - 12), K + t.rect.x + 6, n + t.rect.y + (s ? 9 : 12)), s || (e.font = a.small, e.fillText(Q(e, r(t.node.value), t.rect.w - 12), K + t.rect.x + 6, n + t.rect.y + 28)));
1216
- }
1217
- $(e, Bt(t, r), a, K, n + Mt + q, Z, 2);
1218
- }
1219
- function on(e, t) {
1220
- try {
1221
- return new Intl.DateTimeFormat(e, {
1222
- ...t,
1223
- timeZone: "UTC"
1224
- });
1225
- } catch {
1226
- return new Intl.DateTimeFormat(void 0, {
1227
- ...t,
1228
- timeZone: "UTC"
1229
- });
1230
- }
1231
- }
1232
- function sn(e, t, n, r, i, a, o) {
1233
- let s = S(t), { cell: c } = Ut(s.weeks), l = c + Ht, u = n + J;
1234
- e.font = a.small, e.textAlign = "left", e.fillStyle = G.muted;
1235
- let d = on(o, { month: "short" });
1236
- for (let t of s.months) e.fillText(d.format(b(`${t.month}-01`)), 84 + t.week * l, n + J / 2);
1237
- let f = on(o, { weekday: "short" });
1238
- for (let t = 0; t < 7; t += 2) e.fillText(Q(e, f.format(Date.UTC(2024, 0, 1 + t)), 50), K, u + t * l + c / 2);
1239
- for (let t of s.cells) e.fillStyle = G.heat[t.level], e.fillRect(84 + t.week * l, u + t.weekday * l, c, c);
1240
- let p = u + 7 * l + q + Y / 2;
1241
- e.fillStyle = G.muted, e.fillText(i.less, K, p);
1242
- let m = K + e.measureText(i.less).width + 8;
1243
- for (let t of G.heat) e.fillStyle = t, e.fillRect(m, p - 6, 12, 12), m += 15;
1244
- e.fillStyle = G.muted, e.fillText(i.more, m + 5, p);
1245
- let h = s.cells.reduce((e, t) => t.count > (e?.count ?? 0) ? t : e, null);
1246
- e.textAlign = "right", e.font = a.bold, e.fillStyle = G.text;
1247
- let g = on(o, { dateStyle: "medium" });
1248
- e.fillText(`${i.total}: ${r(s.total)}${h ? ` · ${i.busiest}: ${g.format(b(h.day))} (${r(h.count)})` : ""}`, 692, p);
1249
- }
1250
- function cn(e, t, n, r, i, a, o) {
1251
- if (!t.some((e) => e.value > 0)) {
1252
- e.font = o.text, e.fillStyle = G.muted, e.textAlign = "left", e.fillText(a.empty, K, r + J / 2);
1253
- return;
1254
- }
1255
- let c = Math.min(180, Z * .26), l = 317.36;
1256
- oe(t).forEach(({ step: t, width: a, ofFirst: u, drop: d }, f) => {
1257
- let p = r + f * Nt + Nt / 2;
1258
- e.font = o.bold, e.textAlign = "left", e.fillStyle = G.text, e.fillText(Q(e, t.label, c), K, p);
1259
- let m = Math.max(2, l * a), h = 212.64000000000001 + (l - m) / 2, g = O(t.slot, "light");
1260
- e.fillStyle = g, e.fillRect(h, p - 13, m, 26), e.textAlign = "center";
1261
- let _ = i(t.value);
1262
- e.measureText(_).width + 12 <= m ? (e.fillStyle = ae(g), e.fillText(_, h + m / 2, p)) : (e.fillStyle = G.text, e.textAlign = "left", e.fillText(_, h + m + 6, p)), e.textAlign = "right", n && d !== null && (e.fillStyle = d === 0 ? G.muted : O(d > 0 ? "negative" : "positive", "light"), e.fillText(v(d), 692, p - 7)), e.font = o.small, e.fillStyle = G.muted, n && e.fillText(s(u), 692, d === null ? p : p + 8);
1263
- });
1264
- }
1265
- function ln(e, t, n, r, i, a, o) {
1266
- let { cell: c, width: u, height: d, k: f } = Wt(t.length, n), p = D[n];
1267
- t.length ? t.forEach((t, m) => {
1268
- let h = K + m * c + (c - u) / 2 + p.cx * f, _ = r + p.cy * f, v = l(t.value, t.total), { a0: y, a1: b, end: x } = g(n, v);
1269
- e.lineWidth = 12 * f, e.lineCap = "round", e.strokeStyle = G.track, e.beginPath(), e.arc(h, _, p.r * f, Jt(y), Jt(b)), e.stroke(), v > 0 && (e.strokeStyle = O(w(t.color ?? 1, v), "light"), e.beginPath(), e.arc(h, _, p.r * f, Jt(y), Jt(Math.max(x, y + .01))), e.stroke()), e.lineCap = "butt", e.textAlign = "center", e.font = o.title, e.fillStyle = G.text, e.fillText(s(v), h, n === "half" ? _ - Et / 2 : _);
1270
- let S = K + m * c + c / 2;
1271
- e.font = o.bold, e.fillText(Q(e, t.label, c - 8), S, r + d + 8 + J / 2), e.font = o.text, e.fillStyle = G.muted, e.fillText(Q(e, `${a.ofTotal(i(t.value), i(t.total))} · ${s(v)}`, c - 8), S, r + d + 8 + J * 1.5);
1272
- }) : (e.font = o.text, e.fillStyle = G.muted, e.textAlign = "left", e.fillText(a.empty, K, r + J / 2));
1273
- }
1274
- function un(e, t, n, r, i, a) {
1275
- t.length ? t.forEach((t, o) => {
1276
- let c = n + o * It, l = t.total > 0 ? t.value / t.total * 100 : 0, u = `${i.ofTotal(r(t.value), r(t.total))} · ${s(l)}`;
1277
- e.font = a.bold, e.textAlign = "right", e.fillStyle = G.text, e.fillText(u, 692, c + J / 2);
1278
- let d = e.measureText(u).width;
1279
- e.font = a.text, e.textAlign = "left", e.fillText(Q(e, t.label, Z - d - 16), K, c + J / 2);
1280
- let f = c + J + 4;
1281
- e.fillStyle = G.track, e.fillRect(K, f, Z, Ft), e.fillStyle = O(w(t.color ?? 1, l), "light"), l > 0 && e.fillRect(K, f, Z * Math.min(100, l) / 100, Ft);
1282
- }) : (e.font = a.text, e.fillStyle = G.muted, e.textAlign = "left", e.fillText(i.empty, K, n + J / 2));
1283
- }
1284
- function dn(e, t, n) {
1285
- let r = e.getContext("2d");
1286
- if (!r) throw Error("No 2D canvas");
1287
- let i = Lt(n.fontFamily), a = {
1288
- ...p,
1289
- ...t.labels
1290
- }, o = Rt(t), s = n.pixelRatio ?? 2;
1291
- r.font = i.text;
1292
- let c = t.context ? Gt(r, t.context, Z) : [], l = K + ((t.report ? 24 : 0) + Et + 8 + c.length * J) + q + Vt(t.chart) + q + J + K;
1293
- e.width = 720 * s, e.height = l * s, r.setTransform(s, 0, 0, s, 0, 0), r.textBaseline = "middle", r.fillStyle = G.background, r.fillRect(0, 0, 720, l);
1294
- let u = K;
1295
- r.textAlign = "left", t.report && (r.font = i.report, r.fillStyle = G.muted, r.fillText(Q(r, t.report, Z), K, u + J / 2), u += 24), r.font = i.title, r.fillStyle = G.text, r.fillText(Q(r, t.title, Z), K, u + Et / 2), u += 30, r.font = i.text, r.fillStyle = G.muted;
1296
- for (let e of c) r.fillText(e, K, u + J / 2), u += J;
1297
- u += q;
1298
- let d = t.chart;
1299
- switch (d.kind) {
1300
- case "donut":
1301
- qt(r, d.slices, u, o, a, i);
1302
- break;
1303
- case "pie":
1304
- Yt(r, d.slices, u, o, a, i);
1305
- break;
1306
- case "stacked":
1307
- Xt(r, d.slices, u, o, i);
1308
- break;
1309
- case "bars":
1310
- Qt(r, d.data, d.series, u, o, a, i);
1311
- break;
1312
- case "progress":
1313
- un(r, d.rows, u, o, a, i);
1314
- break;
1315
- case "columns":
1316
- tn(r, d.data, d.series, d.mode ?? "stacked", u, o, a, i);
1317
- break;
1318
- case "line":
1319
- en(r, d.data, d.series, !!d.area, u, o, a, i);
1320
- break;
1321
- case "number":
1322
- rn(r, d, u, o, a, i);
1323
- break;
1324
- case "gauge":
1325
- ln(r, d.rows, d.variant ?? "half", u, o, a, i);
1326
- break;
1327
- case "funnel":
1328
- cn(r, d.steps, d.showChange !== !1, u, o, a, i);
1329
- break;
1330
- case "calendar":
1331
- sn(r, d.days, u, o, a, i, t.locale);
1332
- break;
1333
- case "treemap": an(r, d.nodes, u, o, a, i);
1334
- }
1335
- u += Vt(d) + q, r.font = i.small, r.fillStyle = G.faint, r.textAlign = "left", r.fillText(zt(t.at ?? /* @__PURE__ */ new Date(), t.locale), K, u + J / 2), t.branding && (r.textAlign = "right", r.fillText(Q(r, t.branding, Z / 2), 692, u + J / 2));
1336
- }
1337
- function fn(e) {
1338
- return [
1339
- e.report ?? "",
1340
- e.title,
1341
- e.context ?? "",
1342
- e.branding ?? "",
1343
- ...pn(e.chart)
1344
- ].join(" ");
1345
- }
1346
- function pn(e) {
1347
- switch (e.kind) {
1348
- case "donut":
1349
- case "pie":
1350
- case "stacked": return e.slices.map((e) => e.label);
1351
- case "funnel": return e.steps.map((e) => e.label);
1352
- case "calendar": return [];
1353
- case "treemap": return e.nodes.flatMap((e) => [e.label, ...(e.children ?? []).map((e) => e.label)]);
1354
- case "progress":
1355
- case "gauge": return e.rows.map((e) => e.label);
1356
- case "number": return (e.points ?? []).map((e) => e.label);
1357
- case "bars":
1358
- case "columns":
1359
- case "line": return [...e.data.map((e) => e.fullLabel ?? e.label), ...e.series.map((e) => e.label)];
1360
- }
1361
- }
1362
- async function mn(e, t = {}) {
1363
- let n = t.fontFamily || (typeof document < "u" ? getComputedStyle(document.body).fontFamily : "") || "sans-serif", r = Lt(n);
1364
- if (typeof document < "u" && document.fonts) {
1365
- let t = fn(e);
1366
- await Promise.all([
1367
- r.report,
1368
- r.title,
1369
- r.bold,
1370
- r.text
1371
- ].map((e) => document.fonts.load(e, t).catch(() => []))), await document.fonts.ready;
1372
- }
1373
- let i = document.createElement("canvas");
1374
- return dn(i, e, { fontFamily: n }), new Promise((e, t) => i.toBlob((n) => n ? e(n) : t(/* @__PURE__ */ Error("No image")), "image/png"));
1375
- }
1376
- function hn(e, t = /* @__PURE__ */ new Date(), n) {
1377
- let r = [n, e].filter(Boolean).join(" ").trim().toLowerCase().replace(/[^\p{L}\p{M}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "") || "chart", i = (e) => String(e).padStart(2, "0");
1378
- return `${r}-${t.getFullYear()}-${i(t.getMonth() + 1)}-${i(t.getDate())}-${i(t.getHours())}${i(t.getMinutes())}.png`;
1379
- }
1380
- // src/components/Charts/ChartImageMenu.tsx
1381
- var gn = 2e3;
1382
- function _n() {
1383
- if (typeof navigator > "u") return {
1384
- copy: !1,
1385
- share: !1
1386
- };
1387
- let e = typeof navigator.clipboard?.write == "function" && typeof ClipboardItem < "u", t = !1;
1388
- try {
1389
- t = typeof navigator.share == "function" && typeof navigator.canShare == "function" && navigator.canShare({ files: [new File([], "chart.png", { type: "image/png" })] });
1390
- } catch {
1391
- t = !1;
1392
- }
1393
- return {
1394
- copy: e,
1395
- share: t
1396
- };
1397
- }
1398
- var vn = (e) => /* @__PURE__ */ N("svg", {
1399
- width: "16",
1400
- height: "16",
1401
- viewBox: "0 0 24 24",
1402
- fill: "none",
1403
- stroke: "currentColor",
1404
- strokeWidth: "2",
1405
- strokeLinecap: "round",
1406
- strokeLinejoin: "round",
1407
- "aria-hidden": !0,
1408
- children: /* @__PURE__ */ N("path", { d: e })
1409
- }), yn = () => vn("M12 4v11M7 10l5 5 5-5M5 20h14"), bn = () => vn("M9 9h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V10a1 1 0 0 1 1-1zM5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1"), xn = () => /* @__PURE__ */ N("svg", {
1410
- width: "16",
1411
- height: "16",
1412
- viewBox: "0 0 24 24",
1413
- fill: "none",
1414
- stroke: "currentColor",
1415
- strokeWidth: "2",
1416
- strokeLinecap: "round",
1417
- strokeLinejoin: "round",
1418
- "aria-hidden": !0,
1419
- children: /* @__PURE__ */ N("path", { d: "M4 12v7a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-7M16 6l-4-4-4 4M12 2v13" })
1420
- });
1421
- function Sn(e) {
1422
- let t = {
1423
- ...p,
1424
- ...u().charts,
1425
- ...e.labels
1426
- }, r = yt(), i = n().locale, a = xe(_n, []), o = j(null), [s, c] = M(null);
1427
- A(() => {
1428
- if (!s) return;
1429
- let e = setTimeout(() => c(null), gn);
1430
- return () => clearTimeout(e);
1431
- }, [s]);
1432
- let l = [
1433
- {
1434
- value: "download",
1435
- label: t.imageDownload,
1436
- icon: /* @__PURE__ */ N(yn, {})
1437
- },
1438
- ...a.copy ? [{
1439
- value: "copy",
1440
- label: t.imageCopy,
1441
- icon: /* @__PURE__ */ N(bn, {})
1442
- }] : [],
1443
- ...a.share ? [{
1444
- value: "share",
1445
- label: t.imageShare,
1446
- icon: /* @__PURE__ */ N(xn, {})
1447
- }] : []
1448
- ], d = async (n) => {
1449
- c(null);
1450
- let a = /* @__PURE__ */ new Date(), s = hn(e.title, a, e.report), l = () => mn({
1451
- ...e,
1452
- locale: e.locale ?? i,
1453
- at: a
1454
- }, { fontFamily: o.current ? getComputedStyle(o.current).fontFamily : void 0 });
1455
- try {
1456
- if (n === "copy") {
1457
- await navigator.clipboard.write([new ClipboardItem({ "image/png": l() })]), c({
1458
- tone: "done",
1459
- text: t.imageCopied
1460
- });
1461
- return;
1462
- }
1463
- let i = r.submit({
1464
- format: "png",
1465
- filename: s.replace(/\.png$/i, ""),
1466
- title: e.title,
1467
- action: n,
1468
- dedupeKey: `dcs-chart-image:${s}:${n}`,
1469
- notify: "awaiting-click",
1470
- build: () => l()
1471
- });
1472
- (await r.wait(i))?.status === "failed" && c({
1473
- tone: "failed",
1474
- text: t.imageFailed
1475
- });
1476
- } catch (e) {
1477
- e?.name !== "AbortError" && c({
1478
- tone: "failed",
1479
- text: t.imageFailed
1480
- });
1481
- }
1482
- };
1483
- return /* @__PURE__ */ P("span", {
1484
- ref: o,
1485
- className: "chart-root chart-image-menu",
1486
- children: [/* @__PURE__ */ N(Tt, {
1487
- "aria-label": t.imageMenu,
1488
- items: l,
1489
- onSelect: (e) => void d(e),
1490
- trigger: /* @__PURE__ */ N(st, {
1491
- variant: "text",
1492
- color: "neutral",
1493
- size: "xs",
1494
- startIcon: /* @__PURE__ */ N(xn, {}),
1495
- "aria-label": `${t.imageMenu}: ${e.title}`,
1496
- tooltip: t.imageMenu
1497
- })
1498
- }), /* @__PURE__ */ N("span", {
1499
- className: "chart-image-status",
1500
- role: "status",
1501
- "aria-live": "polite",
1502
- "data-tone": s?.tone,
1503
- children: s && /* @__PURE__ */ P(Ce, { children: [s.tone === "done" && /* @__PURE__ */ N("span", {
1504
- "aria-hidden": !0,
1505
- children: "✓"
1506
- }), s.text] })
1507
- })]
1508
- });
1509
- }
1510
- export { Qe as C, Ee as D, Re as E, We as S, R as T, it as _, dn as a, Ge as b, St as c, yt as d, xt as f, H as g, st as h, hn as i, gt as l, ht as m, G as n, Tt as o, W as p, mn as r, Ct as s, Sn as t, bt as u, rt as v, Ke as w, Je as x, $e as y };