react-semaphor 0.1.603 → 0.1.605

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 (208) hide show
  1. package/dist/activity/index.js +1 -73
  2. package/dist/analytics-protocol/index.js +1 -1491
  3. package/dist/appearance/index.js +1 -12
  4. package/dist/appearance-runtime/index.js +1 -5
  5. package/dist/assistant-context/index.js +1 -11
  6. package/dist/assistant-protocol/index.js +1 -152
  7. package/dist/brand-studio/index.js +3 -1598
  8. package/dist/briefings/index.js +1 -70
  9. package/dist/chunks/add-to-dashboard-CEmZUf9o.js +12 -0
  10. package/dist/chunks/analytics-base-schemas-DMFrDqn_.js +1 -0
  11. package/dist/chunks/appearance-provider-CfoAVQuG.js +608 -0
  12. package/dist/chunks/appearance-runtime-provider-Bx8H-moR.js +1 -0
  13. package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
  14. package/dist/chunks/assistant-chat-DgUaCE9k.js +51 -0
  15. package/dist/chunks/attachment-filter-line-C_zHMhGh.js +1 -0
  16. package/dist/chunks/attribution-BEFSsbNn.js +1 -0
  17. package/dist/chunks/availability-3AIOf6Z-.js +1 -0
  18. package/dist/chunks/bookmark-impact-BAtemeyK.js +1 -0
  19. package/dist/chunks/bookmark-state-DScd31KT.js +1 -0
  20. package/dist/chunks/brand-C9APUFaP.js +1 -0
  21. package/dist/chunks/card-filter-builder-ClWrXB7P.js +11 -0
  22. package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
  23. package/dist/chunks/comparison-window-caption-tguyN24S.js +1 -0
  24. package/dist/chunks/context-CntvtZwC.js +2 -0
  25. package/dist/chunks/conversation-JMK2kyTK.js +1 -0
  26. package/dist/chunks/dashboard-ChIcbVTx.js +1 -0
  27. package/dist/chunks/dashboard-briefing-launcher-CwMlhkxV.js +42 -0
  28. package/dist/chunks/dashboard-controls-UCSAFCGA.js +42 -0
  29. package/dist/chunks/dashboard-json-B120hYDa.js +1 -0
  30. package/dist/chunks/dashboard-temporal-snapshot-BFJKbp_6.js +1 -0
  31. package/dist/chunks/edit-dashboard-visual-DvHp03h_.js +73 -0
  32. package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
  33. package/dist/chunks/filter-line-WwUV5JzN.js +1 -0
  34. package/dist/chunks/filter-reach-preview-C5M5_hf_.js +1 -0
  35. package/dist/chunks/filter-value-text-DqTHe_vu.js +1 -0
  36. package/dist/chunks/index-DViPGDFj.js +1 -0
  37. package/dist/chunks/index-bkP6SnYu.js +1 -0
  38. package/dist/chunks/kpi-trend-rule-B87LNzcz.js +1 -0
  39. package/dist/chunks/layout-grid-CFzqJ7GC.js +6 -0
  40. package/dist/chunks/matrix-analytical-definition-5T-2euHZ.js +1 -0
  41. package/dist/chunks/matrix-member-presentation-vVAv-aqg.js +1 -0
  42. package/dist/chunks/matrix-operation-contract-CWvcEsQ0.js +1 -0
  43. package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
  44. package/dist/chunks/numeric-range-options-C8tr-Bls.js +1 -0
  45. package/dist/chunks/palette-NvEIuXHN.js +6 -0
  46. package/dist/chunks/pivot-result-contract-expectations-BNWhS8mv.js +1 -0
  47. package/dist/chunks/pivot-result-identity-B0eWVMXg.js +1 -0
  48. package/dist/chunks/raw-temporal-value-BHQ-ldpW.js +1 -0
  49. package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
  50. package/dist/chunks/report-preferences-dialog-Bseb2Rlg.js +1 -0
  51. package/dist/chunks/report-runtime-context-Cd1b5pku.js +1 -0
  52. package/dist/chunks/resolve-dashboard-input-context-BDY7KwRe.js +8 -0
  53. package/dist/chunks/resolver-CjsW8Rz0.js +1 -0
  54. package/dist/chunks/saved-dashboard-context-C3lWc4Dx.js +1 -0
  55. package/dist/chunks/schema-O1Y3WTGF.js +4 -0
  56. package/dist/chunks/selection-filter-compiler-kYsRugss.js +1 -0
  57. package/dist/chunks/semaphor-ready-indicator-BQarSo6S.js +612 -0
  58. package/dist/chunks/set-6mOnfQeH.js +1 -0
  59. package/dist/chunks/slider-BPnHdMGq.js +4 -0
  60. package/dist/chunks/stored-dashboard-DfrxDLhR.js +1 -0
  61. package/dist/chunks/table-export-sheet-xaczzWZF.js +2 -0
  62. package/dist/chunks/token-types-1vzMWjI-.js +1 -0
  63. package/dist/chunks/validators-Dg2kyF4_.js +1 -0
  64. package/dist/chunks/variable-draft-B4_xqr4Y.js +1 -0
  65. package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
  66. package/dist/dashboard/index.js +1 -7
  67. package/dist/dashboard-authoring/index.js +1 -4614
  68. package/dist/format-utils/index.js +1 -425
  69. package/dist/index.js +1 -554
  70. package/dist/layouts/index.js +1 -7
  71. package/dist/live-channel/index.js +1 -124
  72. package/dist/pdf-export-policy/index.js +1 -92
  73. package/dist/pdf-table-layout/index.js +1 -993
  74. package/dist/report-runtime-context/index.js +1 -9
  75. package/dist/shared/index.js +1 -6
  76. package/dist/style.css +1 -1
  77. package/dist/surfboard/index.js +1 -9
  78. package/dist/types/brand-studio/brand-studio-draft.d.ts +45 -13
  79. package/dist/types/brand-studio/brand-studio-editor.d.ts +13 -2
  80. package/dist/types/components/index.d.ts +1 -0
  81. package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +17 -6
  82. package/dist/types/components/visual/data-table/types/data-table.d.ts +52 -42
  83. package/dist/types/index.js +1 -88
  84. package/dist/types/lib/appearance/aliases.d.ts +3 -0
  85. package/dist/types/lib/appearance/index.d.ts +1 -0
  86. package/dist/types/lib/appearance/table-density.d.ts +18 -0
  87. package/dist/types/lib/appearance/types.d.ts +39 -1
  88. package/dist/types/lib/dashboard-viewer/column-header-actions.d.ts +100 -0
  89. package/dist/types/lib/dashboard-viewer/table-view-edit.d.ts +0 -27
  90. package/dist/types/lib/dashboard-viewer/table-view.d.ts +26 -2
  91. package/dist/types/lib/dashboard-viewer/use-table-view.d.ts +2 -0
  92. package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
  93. package/dist/types/lib/hooks/use-add-new-frame.d.ts +7 -0
  94. package/dist/types/lib/hooks/use-dashboard-card.d.ts +4 -0
  95. package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +8 -0
  96. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
  97. package/dist/types/lib/stores/dashboard-store.d.ts +14 -2
  98. package/dist/types/lib/stores/explorer-actions.d.ts +7 -10
  99. package/dist/types/lib/types/common-types.d.ts +1 -2
  100. package/dist/types/lib/types/semantic-types.d.ts +6 -10
  101. package/dist/types/lib/utils/card-config-utils.d.ts +13 -0
  102. package/dist/types/lib/utils/field-placement.d.ts +17 -0
  103. package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
  104. package/dist/types/shared/analytics-protocol/analytics-refusal.d.ts +21 -1
  105. package/dist/types/shared/analytics-protocol/field-provenance.d.ts +7 -4
  106. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
  107. package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
  108. package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
  109. package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
  110. package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
  111. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
  112. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +180 -0
  113. package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
  114. package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
  115. package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
  116. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +2 -8
  117. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  118. package/dist/types/shared/dashboard-authoring/card-settings/column-display-values.d.ts +5 -0
  119. package/dist/types/shared/dashboard-authoring/card-settings/column-display.d.ts +52 -0
  120. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +1 -0
  121. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +9 -0
  122. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +4 -0
  123. package/dist/types/shared/dashboard-authoring/card-settings/table-viewer-switches.d.ts +15 -0
  124. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +5 -0
  125. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
  126. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +132 -3
  127. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +3 -1
  128. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  129. package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +10 -1
  130. package/dist/types/shared/dashboard-authoring/field-aggregations.d.ts +9 -2
  131. package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +116 -0
  132. package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
  133. package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
  134. package/dist/types/shared/dashboard-authoring/index.d.ts +7 -1
  135. package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +2 -0
  136. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +7 -2
  137. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +6 -2
  138. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +2 -0
  139. package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
  140. package/dist/types/shared/dashboard-authoring/sheet-kinds.d.ts +36 -0
  141. package/dist/types/shared/dashboard-authoring/table-sheet-shape.d.ts +140 -0
  142. package/dist/types/shared/dashboard-viewer/table-column-move.d.ts +15 -0
  143. package/dist/types/shared/dashboard-viewer/table-settings.d.ts +8 -2
  144. package/dist/types/shared/format-utils/types/format-types.d.ts +1 -1
  145. package/dist/usage-events/index.js +1 -285
  146. package/dist/value-format-preferences/index.js +1 -635
  147. package/package.json +5 -2
  148. package/dist/chunks/add-to-dashboard-CFF-wFU-.js +0 -291
  149. package/dist/chunks/analytics-base-schemas-DsUh5Q3C.js +0 -680
  150. package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
  151. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
  152. package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
  153. package/dist/chunks/assistant-chat-B6hNQI1t.js +0 -6115
  154. package/dist/chunks/attribution-BvoKvhcj.js +0 -32
  155. package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
  156. package/dist/chunks/bookmark-impact-Ba2PLcGp.js +0 -76
  157. package/dist/chunks/bookmark-state-n7AaNzR_.js +0 -1667
  158. package/dist/chunks/brand-BoUV0iHF.js +0 -54
  159. package/dist/chunks/card-filter-builder-Y22HizVx.js +0 -4069
  160. package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
  161. package/dist/chunks/comparison-window-caption-Ck2TIbnR.js +0 -741
  162. package/dist/chunks/context-UCQ7sere.js +0 -369
  163. package/dist/chunks/conversation-sQiWYUOb.js +0 -16
  164. package/dist/chunks/dashboard-BghI99oY.js +0 -14
  165. package/dist/chunks/dashboard-briefing-launcher-DtBAnGiH.js +0 -4875
  166. package/dist/chunks/dashboard-controls-CtFXlyjV.js +0 -2290
  167. package/dist/chunks/dashboard-json-DfGBUtCd.js +0 -66
  168. package/dist/chunks/dates-BnrXF4bb.js +0 -185
  169. package/dist/chunks/edit-9df1zOWe.js +0 -226
  170. package/dist/chunks/edit-dashboard-visual-oxt3x1wb.js +0 -18397
  171. package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
  172. package/dist/chunks/filter-line-Cy5YYqRL.js +0 -703
  173. package/dist/chunks/filter-reach-copy-CE_ZX147.js +0 -5111
  174. package/dist/chunks/filter-value-text-fWvSDwkl.js +0 -153
  175. package/dist/chunks/index-BVKzKl5d.js +0 -90
  176. package/dist/chunks/index-CV_Kzou0.js +0 -595
  177. package/dist/chunks/index-D5rxbtS4.js +0 -2795
  178. package/dist/chunks/layout-grid-9LndRoLa.js +0 -16
  179. package/dist/chunks/matrix-analytical-definition-CCp48UCw.js +0 -1233
  180. package/dist/chunks/matrix-member-presentation-zNehruXR.js +0 -391
  181. package/dist/chunks/matrix-operation-contract-DPBj69D8.js +0 -1413
  182. package/dist/chunks/metric-comparison-B0FR-Q8I.js +0 -600
  183. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
  184. package/dist/chunks/paintbrush-58FQYY-y.js +0 -27
  185. package/dist/chunks/palette-Be62Tkoa.js +0 -23
  186. package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
  187. package/dist/chunks/pivot-result-contract-expectations-BYqAmG9n.js +0 -5092
  188. package/dist/chunks/pivot-result-identity-CAP4--iq.js +0 -77
  189. package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +0 -3778
  190. package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
  191. package/dist/chunks/report-preferences-dialog-uJp9GBTM.js +0 -1651
  192. package/dist/chunks/report-runtime-context-c77_KF9v.js +0 -388
  193. package/dist/chunks/resolve-dashboard-input-context-Rtl1ffmE.js +0 -25324
  194. package/dist/chunks/resolver-DG_tfEpt.js +0 -156
  195. package/dist/chunks/save-C5A0JnEV.js +0 -21
  196. package/dist/chunks/saved-dashboard-context-tcyTU8jm.js +0 -618
  197. package/dist/chunks/schema-C9NPiIru.js +0 -2568
  198. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +0 -150
  199. package/dist/chunks/semaphor-ready-indicator-FBvunj6S.js +0 -145603
  200. package/dist/chunks/shelf-drop-preview-context-QKStrcK9.js +0 -2466
  201. package/dist/chunks/stored-dashboard-CHozcAY9.js +0 -4075
  202. package/dist/chunks/style-sheet-parts-CDCG-8Ej.js +0 -8681
  203. package/dist/chunks/table-export-sheet-ZFIvs6Sj.js +0 -949
  204. package/dist/chunks/token-types-XbM6QByy.js +0 -8
  205. package/dist/chunks/upload-H15d7uHK.js +0 -15
  206. package/dist/chunks/validators-Baf3VIf5.js +0 -3686
  207. package/dist/chunks/variable-draft-C2y8Jp6Z.js +0 -242
  208. package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
@@ -1,2466 +0,0 @@
1
- import { jsxs as Ne, jsx as N, Fragment as ft } from "react/jsx-runtime";
2
- import * as T from "react";
3
- import zn, { forwardRef as Fe, createElement as xe, useContext as rt, createContext as xt, useRef as O, useLayoutEffect as Pn, useImperativeHandle as zt, useEffect as ne, useState as de, useCallback as G, useMemo as W, memo as wn, Suspense as Cn, useSyncExternalStore as En } from "react";
4
- import { b1 as In, am as ie, b2 as Pt, b3 as Rn, an as wt, b4 as ot, b5 as Ct, b6 as Et, b7 as Dn, b8 as An, b9 as Nn, ba as Mn, u as Re, bb as Ln, bc as _n, bd as kn, be as Tn, bf as Hn, bg as Vn, bh as $n, bi as Fn, bj as Kn } from "./semaphor-ready-indicator-FBvunj6S.js";
5
- import { C as It, G as Rt, H as ze, J as me, K as Dt, M as Bn, O as qn, Q as Pe, U as On, V as At, W as Gn, Y as Un } from "./style-sheet-parts-CDCG-8Ej.js";
6
- import { $ as Wn, a0 as Nt, a2 as Mt, a3 as Je, a4 as Te, a5 as Yn, a6 as jn, a7 as Xn, a1 as Qn } from "./resolve-dashboard-input-context-Rtl1ffmE.js";
7
- import { c as we } from "./pickers-DkqmtnTL.js";
8
- import "./validators-Baf3VIf5.js";
9
- import "./matrix-operation-contract-DPBj69D8.js";
10
- import "./analytics-base-schemas-DsUh5Q3C.js";
11
- import "../value-format-preferences/index.js";
12
- import { u as Jn } from "./appearance-context-BwBp25ZG.js";
13
- const So = zn.memo(function({
14
- context: t = "editor"
15
- } = {}) {
16
- return /* @__PURE__ */ Ne(
17
- "div",
18
- {
19
- "data-content": "fields-section",
20
- className: "flex h-full grow flex-col items-center overflow-hidden",
21
- children: [
22
- " ",
23
- /* @__PURE__ */ N(In, { context: t }),
24
- " "
25
- ]
26
- }
27
- );
28
- }), Ke = xt(null);
29
- Ke.displayName = "PanelGroupContext";
30
- const q = {
31
- group: "data-panel-group",
32
- groupDirection: "data-panel-group-direction",
33
- groupId: "data-panel-group-id",
34
- panel: "data-panel",
35
- panelCollapsible: "data-panel-collapsible",
36
- panelId: "data-panel-id",
37
- panelSize: "data-panel-size",
38
- resizeHandle: "data-resize-handle",
39
- resizeHandleActive: "data-resize-handle-active",
40
- resizeHandleEnabled: "data-panel-resize-handle-enabled",
41
- resizeHandleId: "data-panel-resize-handle-id",
42
- resizeHandleState: "data-resize-handle-state"
43
- }, it = 10, ge = Pn, pt = T.useId, Zn = typeof pt == "function" ? pt : () => null;
44
- let er = 0;
45
- function st(e = null) {
46
- const t = Zn(), n = O(e || t || null);
47
- return n.current === null && (n.current = "" + er++), e ?? n.current;
48
- }
49
- function Lt({
50
- children: e,
51
- className: t = "",
52
- collapsedSize: n,
53
- collapsible: r,
54
- defaultSize: i,
55
- forwardedRef: o,
56
- id: s,
57
- maxSize: l,
58
- minSize: a,
59
- onCollapse: d,
60
- onExpand: f,
61
- onResize: u,
62
- order: c,
63
- style: m,
64
- tagName: p = "div",
65
- ...g
66
- }) {
67
- const y = rt(Ke);
68
- if (y === null)
69
- throw Error("Panel components must be rendered within a PanelGroup container");
70
- const {
71
- collapsePanel: h,
72
- expandPanel: A,
73
- getPanelSize: x,
74
- getPanelStyle: R,
75
- groupId: D,
76
- isPanelCollapsed: L,
77
- reevaluatePanelConstraints: C,
78
- registerPanel: j,
79
- resizePanel: J,
80
- unregisterPanel: K
81
- } = y, M = st(s), _ = O({
82
- callbacks: {
83
- onCollapse: d,
84
- onExpand: f,
85
- onResize: u
86
- },
87
- constraints: {
88
- collapsedSize: n,
89
- collapsible: r,
90
- defaultSize: i,
91
- maxSize: l,
92
- minSize: a
93
- },
94
- id: M,
95
- idIsFromProps: s !== void 0,
96
- order: c
97
- });
98
- O({
99
- didLogMissingDefaultSizeWarning: !1
100
- }), ge(() => {
101
- const {
102
- callbacks: B,
103
- constraints: $
104
- } = _.current, F = {
105
- ...$
106
- };
107
- _.current.id = M, _.current.idIsFromProps = s !== void 0, _.current.order = c, B.onCollapse = d, B.onExpand = f, B.onResize = u, $.collapsedSize = n, $.collapsible = r, $.defaultSize = i, $.maxSize = l, $.minSize = a, (F.collapsedSize !== $.collapsedSize || F.collapsible !== $.collapsible || F.maxSize !== $.maxSize || F.minSize !== $.minSize) && C(_.current, F);
108
- }), ge(() => {
109
- const B = _.current;
110
- return j(B), () => {
111
- K(B);
112
- };
113
- }, [c, M, j, K]), zt(o, () => ({
114
- collapse: () => {
115
- h(_.current);
116
- },
117
- expand: (B) => {
118
- A(_.current, B);
119
- },
120
- getId() {
121
- return M;
122
- },
123
- getSize() {
124
- return x(_.current);
125
- },
126
- isCollapsed() {
127
- return L(_.current);
128
- },
129
- isExpanded() {
130
- return !L(_.current);
131
- },
132
- resize: (B) => {
133
- J(_.current, B);
134
- }
135
- }), [h, A, x, L, M, J]);
136
- const U = R(_.current, i);
137
- return xe(p, {
138
- ...g,
139
- children: e,
140
- className: t,
141
- id: M,
142
- style: {
143
- ...U,
144
- ...m
145
- },
146
- // CSS selectors
147
- [q.groupId]: D,
148
- [q.panel]: "",
149
- [q.panelCollapsible]: r || void 0,
150
- [q.panelId]: M,
151
- [q.panelSize]: parseFloat("" + U.flexGrow).toFixed(1)
152
- });
153
- }
154
- const tr = Fe((e, t) => xe(Lt, {
155
- ...e,
156
- forwardedRef: t
157
- }));
158
- Lt.displayName = "Panel";
159
- tr.displayName = "forwardRef(Panel)";
160
- let Ze = null, He = -1, ue = null;
161
- function nr(e, t) {
162
- if (t) {
163
- const n = (t & Vt) !== 0, r = (t & $t) !== 0, i = (t & Ft) !== 0, o = (t & Kt) !== 0;
164
- if (n)
165
- return i ? "se-resize" : o ? "ne-resize" : "e-resize";
166
- if (r)
167
- return i ? "sw-resize" : o ? "nw-resize" : "w-resize";
168
- if (i)
169
- return "s-resize";
170
- if (o)
171
- return "n-resize";
172
- }
173
- switch (e) {
174
- case "horizontal":
175
- return "ew-resize";
176
- case "intersection":
177
- return "move";
178
- case "vertical":
179
- return "ns-resize";
180
- }
181
- }
182
- function rr() {
183
- ue !== null && (document.head.removeChild(ue), Ze = null, ue = null, He = -1);
184
- }
185
- function We(e, t) {
186
- var n, r;
187
- const i = nr(e, t);
188
- if (Ze !== i) {
189
- if (Ze = i, ue === null && (ue = document.createElement("style"), document.head.appendChild(ue)), He >= 0) {
190
- var o;
191
- (o = ue.sheet) === null || o === void 0 || o.removeRule(He);
192
- }
193
- He = (n = (r = ue.sheet) === null || r === void 0 ? void 0 : r.insertRule(`*{cursor: ${i} !important;}`)) !== null && n !== void 0 ? n : -1;
194
- }
195
- }
196
- function _t(e) {
197
- return e.type === "keydown";
198
- }
199
- function kt(e) {
200
- return e.type.startsWith("pointer");
201
- }
202
- function Tt(e) {
203
- return e.type.startsWith("mouse");
204
- }
205
- function Be(e) {
206
- if (kt(e)) {
207
- if (e.isPrimary)
208
- return {
209
- x: e.clientX,
210
- y: e.clientY
211
- };
212
- } else if (Tt(e))
213
- return {
214
- x: e.clientX,
215
- y: e.clientY
216
- };
217
- return {
218
- x: 1 / 0,
219
- y: 1 / 0
220
- };
221
- }
222
- function or() {
223
- if (typeof matchMedia == "function")
224
- return matchMedia("(pointer:coarse)").matches ? "coarse" : "fine";
225
- }
226
- function ir(e, t, n) {
227
- return e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y;
228
- }
229
- function sr(e, t) {
230
- if (e === t) throw new Error("Cannot compare node with itself");
231
- const n = {
232
- a: ht(e),
233
- b: ht(t)
234
- };
235
- let r;
236
- for (; n.a.at(-1) === n.b.at(-1); )
237
- e = n.a.pop(), t = n.b.pop(), r = e;
238
- I(r, "Stacking order can only be calculated for elements with a common ancestor");
239
- const i = {
240
- a: gt(mt(n.a)),
241
- b: gt(mt(n.b))
242
- };
243
- if (i.a === i.b) {
244
- const o = r.childNodes, s = {
245
- a: n.a.at(-1),
246
- b: n.b.at(-1)
247
- };
248
- let l = o.length;
249
- for (; l--; ) {
250
- const a = o[l];
251
- if (a === s.a) return 1;
252
- if (a === s.b) return -1;
253
- }
254
- }
255
- return Math.sign(i.a - i.b);
256
- }
257
- const lr = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
258
- function ar(e) {
259
- var t;
260
- const n = getComputedStyle((t = Ht(e)) !== null && t !== void 0 ? t : e).display;
261
- return n === "flex" || n === "inline-flex";
262
- }
263
- function cr(e) {
264
- const t = getComputedStyle(e);
265
- return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || ar(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || lr.test(t.willChange) || t.webkitOverflowScrolling === "touch");
266
- }
267
- function mt(e) {
268
- let t = e.length;
269
- for (; t--; ) {
270
- const n = e[t];
271
- if (I(n, "Missing node"), cr(n)) return n;
272
- }
273
- return null;
274
- }
275
- function gt(e) {
276
- return e && Number(getComputedStyle(e).zIndex) || 0;
277
- }
278
- function ht(e) {
279
- const t = [];
280
- for (; e; )
281
- t.push(e), e = Ht(e);
282
- return t;
283
- }
284
- function Ht(e) {
285
- const {
286
- parentNode: t
287
- } = e;
288
- return t && t instanceof ShadowRoot ? t.host : t;
289
- }
290
- const Vt = 1, $t = 2, Ft = 4, Kt = 8, ur = or() === "coarse";
291
- let se = [], Se = !1, pe = /* @__PURE__ */ new Map(), qe = /* @__PURE__ */ new Map();
292
- const Me = /* @__PURE__ */ new Set();
293
- function dr(e, t, n, r, i) {
294
- var o;
295
- const {
296
- ownerDocument: s
297
- } = t, l = {
298
- direction: n,
299
- element: t,
300
- hitAreaMargins: r,
301
- setResizeHandlerState: i
302
- }, a = (o = pe.get(s)) !== null && o !== void 0 ? o : 0;
303
- return pe.set(s, a + 1), Me.add(l), Ve(), function() {
304
- var f;
305
- qe.delete(e), Me.delete(l);
306
- const u = (f = pe.get(s)) !== null && f !== void 0 ? f : 1;
307
- if (pe.set(s, u - 1), Ve(), u === 1 && pe.delete(s), se.includes(l)) {
308
- const c = se.indexOf(l);
309
- c >= 0 && se.splice(c, 1), at(), i("up", !0, null);
310
- }
311
- };
312
- }
313
- function fr(e) {
314
- const {
315
- target: t
316
- } = e, {
317
- x: n,
318
- y: r
319
- } = Be(e);
320
- Se = !0, lt({
321
- target: t,
322
- x: n,
323
- y: r
324
- }), Ve(), se.length > 0 && ($e("down", e), e.preventDefault(), Bt(t) || e.stopImmediatePropagation());
325
- }
326
- function Ye(e) {
327
- const {
328
- x: t,
329
- y: n
330
- } = Be(e);
331
- if (Se && e.buttons === 0 && (Se = !1, $e("up", e)), !Se) {
332
- const {
333
- target: r
334
- } = e;
335
- lt({
336
- target: r,
337
- x: t,
338
- y: n
339
- });
340
- }
341
- $e("move", e), at(), se.length > 0 && e.preventDefault();
342
- }
343
- function je(e) {
344
- const {
345
- target: t
346
- } = e, {
347
- x: n,
348
- y: r
349
- } = Be(e);
350
- qe.clear(), Se = !1, se.length > 0 && (e.preventDefault(), Bt(t) || e.stopImmediatePropagation()), $e("up", e), lt({
351
- target: t,
352
- x: n,
353
- y: r
354
- }), at(), Ve();
355
- }
356
- function Bt(e) {
357
- let t = e;
358
- for (; t; ) {
359
- if (t.hasAttribute(q.resizeHandle))
360
- return !0;
361
- t = t.parentElement;
362
- }
363
- return !1;
364
- }
365
- function lt({
366
- target: e,
367
- x: t,
368
- y: n
369
- }) {
370
- se.splice(0);
371
- let r = null;
372
- (e instanceof HTMLElement || e instanceof SVGElement) && (r = e), Me.forEach((i) => {
373
- const {
374
- element: o,
375
- hitAreaMargins: s
376
- } = i, l = o.getBoundingClientRect(), {
377
- bottom: a,
378
- left: d,
379
- right: f,
380
- top: u
381
- } = l, c = ur ? s.coarse : s.fine;
382
- if (t >= d - c && t <= f + c && n >= u - c && n <= a + c) {
383
- if (r !== null && document.contains(r) && o !== r && !o.contains(r) && !r.contains(o) && // Calculating stacking order has a cost, so we should avoid it if possible
384
- // That is why we only check potentially intersecting handles,
385
- // and why we skip if the event target is within the handle's DOM
386
- sr(r, o) > 0) {
387
- let p = r, g = !1;
388
- for (; p && !p.contains(o); ) {
389
- if (ir(p.getBoundingClientRect(), l)) {
390
- g = !0;
391
- break;
392
- }
393
- p = p.parentElement;
394
- }
395
- if (g)
396
- return;
397
- }
398
- se.push(i);
399
- }
400
- });
401
- }
402
- function Xe(e, t) {
403
- qe.set(e, t);
404
- }
405
- function at() {
406
- let e = !1, t = !1;
407
- se.forEach((r) => {
408
- const {
409
- direction: i
410
- } = r;
411
- i === "horizontal" ? e = !0 : t = !0;
412
- });
413
- let n = 0;
414
- qe.forEach((r) => {
415
- n |= r;
416
- }), e && t ? We("intersection", n) : e ? We("horizontal", n) : t ? We("vertical", n) : rr();
417
- }
418
- let Qe = new AbortController();
419
- function Ve() {
420
- Qe.abort(), Qe = new AbortController();
421
- const e = {
422
- capture: !0,
423
- signal: Qe.signal
424
- };
425
- Me.size && (Se ? (se.length > 0 && pe.forEach((t, n) => {
426
- const {
427
- body: r
428
- } = n;
429
- t > 0 && (r.addEventListener("contextmenu", je, e), r.addEventListener("pointerleave", Ye, e), r.addEventListener("pointermove", Ye, e));
430
- }), window.addEventListener("pointerup", je, e), window.addEventListener("pointercancel", je, e)) : pe.forEach((t, n) => {
431
- const {
432
- body: r
433
- } = n;
434
- t > 0 && (r.addEventListener("pointerdown", fr, e), r.addEventListener("pointermove", Ye, e));
435
- }));
436
- }
437
- function $e(e, t) {
438
- Me.forEach((n) => {
439
- const {
440
- setResizeHandlerState: r
441
- } = n, i = se.includes(n);
442
- r(e, i, t);
443
- });
444
- }
445
- function pr() {
446
- const [e, t] = de(0);
447
- return G(() => t((n) => n + 1), []);
448
- }
449
- function I(e, t) {
450
- if (!e)
451
- throw console.error(t), Error(t);
452
- }
453
- function he(e, t, n = it) {
454
- return e.toFixed(n) === t.toFixed(n) ? 0 : e > t ? 1 : -1;
455
- }
456
- function ae(e, t, n = it) {
457
- return he(e, t, n) === 0;
458
- }
459
- function ee(e, t, n) {
460
- return he(e, t, n) === 0;
461
- }
462
- function mr(e, t, n) {
463
- if (e.length !== t.length)
464
- return !1;
465
- for (let r = 0; r < e.length; r++) {
466
- const i = e[r], o = t[r];
467
- if (!ee(i, o, n))
468
- return !1;
469
- }
470
- return !0;
471
- }
472
- function be({
473
- panelConstraints: e,
474
- panelIndex: t,
475
- size: n
476
- }) {
477
- const r = e[t];
478
- I(r != null, `Panel constraints not found for index ${t}`);
479
- let {
480
- collapsedSize: i = 0,
481
- collapsible: o,
482
- maxSize: s = 100,
483
- minSize: l = 0
484
- } = r;
485
- if (he(n, l) < 0)
486
- if (o) {
487
- const a = (i + l) / 2;
488
- he(n, a) < 0 ? n = i : n = l;
489
- } else
490
- n = l;
491
- return n = Math.min(s, n), n = parseFloat(n.toFixed(it)), n;
492
- }
493
- function De({
494
- delta: e,
495
- initialLayout: t,
496
- panelConstraints: n,
497
- pivotIndices: r,
498
- prevLayout: i,
499
- trigger: o
500
- }) {
501
- if (ee(e, 0))
502
- return t;
503
- const s = [...t], [l, a] = r;
504
- I(l != null, "Invalid first pivot index"), I(a != null, "Invalid second pivot index");
505
- let d = 0;
506
- if (o === "keyboard") {
507
- {
508
- const u = e < 0 ? a : l, c = n[u];
509
- I(c, `Panel constraints not found for index ${u}`);
510
- const {
511
- collapsedSize: m = 0,
512
- collapsible: p,
513
- minSize: g = 0
514
- } = c;
515
- if (p) {
516
- const y = t[u];
517
- if (I(y != null, `Previous layout not found for panel index ${u}`), ee(y, m)) {
518
- const h = g - y;
519
- he(h, Math.abs(e)) > 0 && (e = e < 0 ? 0 - h : h);
520
- }
521
- }
522
- }
523
- {
524
- const u = e < 0 ? l : a, c = n[u];
525
- I(c, `No panel constraints found for index ${u}`);
526
- const {
527
- collapsedSize: m = 0,
528
- collapsible: p,
529
- minSize: g = 0
530
- } = c;
531
- if (p) {
532
- const y = t[u];
533
- if (I(y != null, `Previous layout not found for panel index ${u}`), ee(y, g)) {
534
- const h = y - m;
535
- he(h, Math.abs(e)) > 0 && (e = e < 0 ? 0 - h : h);
536
- }
537
- }
538
- }
539
- }
540
- {
541
- const u = e < 0 ? 1 : -1;
542
- let c = e < 0 ? a : l, m = 0;
543
- for (; ; ) {
544
- const g = t[c];
545
- I(g != null, `Previous layout not found for panel index ${c}`);
546
- const h = be({
547
- panelConstraints: n,
548
- panelIndex: c,
549
- size: 100
550
- }) - g;
551
- if (m += h, c += u, c < 0 || c >= n.length)
552
- break;
553
- }
554
- const p = Math.min(Math.abs(e), Math.abs(m));
555
- e = e < 0 ? 0 - p : p;
556
- }
557
- {
558
- let c = e < 0 ? l : a;
559
- for (; c >= 0 && c < n.length; ) {
560
- const m = Math.abs(e) - Math.abs(d), p = t[c];
561
- I(p != null, `Previous layout not found for panel index ${c}`);
562
- const g = p - m, y = be({
563
- panelConstraints: n,
564
- panelIndex: c,
565
- size: g
566
- });
567
- if (!ee(p, y) && (d += p - y, s[c] = y, d.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3), void 0, {
568
- numeric: !0
569
- }) >= 0))
570
- break;
571
- e < 0 ? c-- : c++;
572
- }
573
- }
574
- if (mr(i, s))
575
- return i;
576
- {
577
- const u = e < 0 ? a : l, c = t[u];
578
- I(c != null, `Previous layout not found for panel index ${u}`);
579
- const m = c + d, p = be({
580
- panelConstraints: n,
581
- panelIndex: u,
582
- size: m
583
- });
584
- if (s[u] = p, !ee(p, m)) {
585
- let g = m - p, h = e < 0 ? a : l;
586
- for (; h >= 0 && h < n.length; ) {
587
- const A = s[h];
588
- I(A != null, `Previous layout not found for panel index ${h}`);
589
- const x = A + g, R = be({
590
- panelConstraints: n,
591
- panelIndex: h,
592
- size: x
593
- });
594
- if (ee(A, R) || (g -= R - A, s[h] = R), ee(g, 0))
595
- break;
596
- e > 0 ? h-- : h++;
597
- }
598
- }
599
- }
600
- const f = s.reduce((u, c) => c + u, 0);
601
- return ee(f, 100) ? s : i;
602
- }
603
- function gr({
604
- layout: e,
605
- panelsArray: t,
606
- pivotIndices: n
607
- }) {
608
- let r = 0, i = 100, o = 0, s = 0;
609
- const l = n[0];
610
- I(l != null, "No pivot index found"), t.forEach((u, c) => {
611
- const {
612
- constraints: m
613
- } = u, {
614
- maxSize: p = 100,
615
- minSize: g = 0
616
- } = m;
617
- c === l ? (r = g, i = p) : (o += g, s += p);
618
- });
619
- const a = Math.min(i, 100 - o), d = Math.max(r, 100 - s), f = e[l];
620
- return {
621
- valueMax: a,
622
- valueMin: d,
623
- valueNow: f
624
- };
625
- }
626
- function Le(e, t = document) {
627
- return Array.from(t.querySelectorAll(`[${q.resizeHandleId}][data-panel-group-id="${e}"]`));
628
- }
629
- function qt(e, t, n = document) {
630
- const i = Le(e, n).findIndex((o) => o.getAttribute(q.resizeHandleId) === t);
631
- return i ?? null;
632
- }
633
- function Ot(e, t, n) {
634
- const r = qt(e, t, n);
635
- return r != null ? [r, r + 1] : [-1, -1];
636
- }
637
- function Gt(e, t = document) {
638
- var n;
639
- if (t instanceof HTMLElement && (t == null || (n = t.dataset) === null || n === void 0 ? void 0 : n.panelGroupId) == e)
640
- return t;
641
- const r = t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);
642
- return r || null;
643
- }
644
- function Oe(e, t = document) {
645
- const n = t.querySelector(`[${q.resizeHandleId}="${e}"]`);
646
- return n || null;
647
- }
648
- function hr(e, t, n, r = document) {
649
- var i, o, s, l;
650
- const a = Oe(t, r), d = Le(e, r), f = a ? d.indexOf(a) : -1, u = (i = (o = n[f]) === null || o === void 0 ? void 0 : o.id) !== null && i !== void 0 ? i : null, c = (s = (l = n[f + 1]) === null || l === void 0 ? void 0 : l.id) !== null && s !== void 0 ? s : null;
651
- return [u, c];
652
- }
653
- function yr({
654
- committedValuesRef: e,
655
- eagerValuesRef: t,
656
- groupId: n,
657
- layout: r,
658
- panelDataArray: i,
659
- panelGroupElement: o,
660
- setLayout: s
661
- }) {
662
- O({
663
- didWarnAboutMissingResizeHandle: !1
664
- }), ge(() => {
665
- if (!o)
666
- return;
667
- const l = Le(n, o);
668
- for (let a = 0; a < i.length - 1; a++) {
669
- const {
670
- valueMax: d,
671
- valueMin: f,
672
- valueNow: u
673
- } = gr({
674
- layout: r,
675
- panelsArray: i,
676
- pivotIndices: [a, a + 1]
677
- }), c = l[a];
678
- if (c != null) {
679
- const m = i[a];
680
- I(m, `No panel data found for index "${a}"`), c.setAttribute("aria-controls", m.id), c.setAttribute("aria-valuemax", "" + Math.round(d)), c.setAttribute("aria-valuemin", "" + Math.round(f)), c.setAttribute("aria-valuenow", u != null ? "" + Math.round(u) : "");
681
- }
682
- }
683
- return () => {
684
- l.forEach((a, d) => {
685
- a.removeAttribute("aria-controls"), a.removeAttribute("aria-valuemax"), a.removeAttribute("aria-valuemin"), a.removeAttribute("aria-valuenow");
686
- });
687
- };
688
- }, [n, r, i, o]), ne(() => {
689
- if (!o)
690
- return;
691
- const l = t.current;
692
- I(l, "Eager values not found");
693
- const {
694
- panelDataArray: a
695
- } = l, d = Gt(n, o);
696
- I(d != null, `No group found for id "${n}"`);
697
- const f = Le(n, o);
698
- I(f, `No resize handles found for group id "${n}"`);
699
- const u = f.map((c) => {
700
- const m = c.getAttribute(q.resizeHandleId);
701
- I(m, "Resize handle element has no handle id attribute");
702
- const [p, g] = hr(n, m, a, o);
703
- if (p == null || g == null)
704
- return () => {
705
- };
706
- const y = (h) => {
707
- if (!h.defaultPrevented)
708
- switch (h.key) {
709
- case "Enter": {
710
- h.preventDefault();
711
- const A = a.findIndex((x) => x.id === p);
712
- if (A >= 0) {
713
- const x = a[A];
714
- I(x, `No panel data found for index ${A}`);
715
- const R = r[A], {
716
- collapsedSize: D = 0,
717
- collapsible: L,
718
- minSize: C = 0
719
- } = x.constraints;
720
- if (R != null && L) {
721
- const j = De({
722
- delta: ee(R, D) ? C - D : D - R,
723
- initialLayout: r,
724
- panelConstraints: a.map((J) => J.constraints),
725
- pivotIndices: Ot(n, m, o),
726
- prevLayout: r,
727
- trigger: "keyboard"
728
- });
729
- r !== j && s(j);
730
- }
731
- }
732
- break;
733
- }
734
- }
735
- };
736
- return c.addEventListener("keydown", y), () => {
737
- c.removeEventListener("keydown", y);
738
- };
739
- });
740
- return () => {
741
- u.forEach((c) => c());
742
- };
743
- }, [o, e, t, n, r, i, s]);
744
- }
745
- function yt(e, t) {
746
- if (e.length !== t.length)
747
- return !1;
748
- for (let n = 0; n < e.length; n++)
749
- if (e[n] !== t[n])
750
- return !1;
751
- return !0;
752
- }
753
- function Ut(e, t) {
754
- const n = e === "horizontal", {
755
- x: r,
756
- y: i
757
- } = Be(t);
758
- return n ? r : i;
759
- }
760
- function vr(e, t, n, r, i) {
761
- const o = n === "horizontal", s = Oe(t, i);
762
- I(s, `No resize handle element found for id "${t}"`);
763
- const l = s.getAttribute(q.groupId);
764
- I(l, "Resize handle element has no group id attribute");
765
- let {
766
- initialCursorPosition: a
767
- } = r;
768
- const d = Ut(n, e), f = Gt(l, i);
769
- I(f, `No group element found for id "${l}"`);
770
- const u = f.getBoundingClientRect(), c = o ? u.width : u.height;
771
- return (d - a) / c * 100;
772
- }
773
- function br(e, t, n, r, i, o) {
774
- if (_t(e)) {
775
- const s = n === "horizontal";
776
- let l = 0;
777
- e.shiftKey ? l = 100 : i != null ? l = i : l = 10;
778
- let a = 0;
779
- switch (e.key) {
780
- case "ArrowDown":
781
- a = s ? 0 : l;
782
- break;
783
- case "ArrowLeft":
784
- a = s ? -l : 0;
785
- break;
786
- case "ArrowRight":
787
- a = s ? l : 0;
788
- break;
789
- case "ArrowUp":
790
- a = s ? 0 : -l;
791
- break;
792
- case "End":
793
- a = 100;
794
- break;
795
- case "Home":
796
- a = -100;
797
- break;
798
- }
799
- return a;
800
- } else
801
- return r == null ? 0 : vr(e, t, n, r, o);
802
- }
803
- function Sr({
804
- panelDataArray: e
805
- }) {
806
- const t = Array(e.length), n = e.map((o) => o.constraints);
807
- let r = 0, i = 100;
808
- for (let o = 0; o < e.length; o++) {
809
- const s = n[o];
810
- I(s, `Panel constraints not found for index ${o}`);
811
- const {
812
- defaultSize: l
813
- } = s;
814
- l != null && (r++, t[o] = l, i -= l);
815
- }
816
- for (let o = 0; o < e.length; o++) {
817
- const s = n[o];
818
- I(s, `Panel constraints not found for index ${o}`);
819
- const {
820
- defaultSize: l
821
- } = s;
822
- if (l != null)
823
- continue;
824
- const a = e.length - r, d = i / a;
825
- r++, t[o] = d, i -= d;
826
- }
827
- return t;
828
- }
829
- function ye(e, t, n) {
830
- t.forEach((r, i) => {
831
- const o = e[i];
832
- I(o, `Panel data not found for index ${i}`);
833
- const {
834
- callbacks: s,
835
- constraints: l,
836
- id: a
837
- } = o, {
838
- collapsedSize: d = 0,
839
- collapsible: f
840
- } = l, u = n[a];
841
- if (u == null || r !== u) {
842
- n[a] = r;
843
- const {
844
- onCollapse: c,
845
- onExpand: m,
846
- onResize: p
847
- } = s;
848
- p && p(r, u), f && (c || m) && (m && (u == null || ae(u, d)) && !ae(r, d) && m(), c && (u == null || !ae(u, d)) && ae(r, d) && c());
849
- }
850
- });
851
- }
852
- function ke(e, t) {
853
- if (e.length !== t.length)
854
- return !1;
855
- for (let n = 0; n < e.length; n++)
856
- if (e[n] != t[n])
857
- return !1;
858
- return !0;
859
- }
860
- function xr({
861
- defaultSize: e,
862
- dragState: t,
863
- layout: n,
864
- panelData: r,
865
- panelIndex: i,
866
- precision: o = 3
867
- }) {
868
- const s = n[i];
869
- let l;
870
- return s == null ? l = e != null ? e.toPrecision(o) : "1" : r.length === 1 ? l = "1" : l = s.toPrecision(o), {
871
- flexBasis: 0,
872
- flexGrow: l,
873
- flexShrink: 1,
874
- // Without this, Panel sizes may be unintentionally overridden by their content
875
- overflow: "hidden",
876
- // Disable pointer events inside of a panel during resize
877
- // This avoid edge cases like nested iframes
878
- pointerEvents: t !== null ? "none" : void 0
879
- };
880
- }
881
- function zr(e, t = 10) {
882
- let n = null;
883
- return (...i) => {
884
- n !== null && clearTimeout(n), n = setTimeout(() => {
885
- e(...i);
886
- }, t);
887
- };
888
- }
889
- function vt(e) {
890
- try {
891
- if (typeof localStorage < "u")
892
- e.getItem = (t) => localStorage.getItem(t), e.setItem = (t, n) => {
893
- localStorage.setItem(t, n);
894
- };
895
- else
896
- throw new Error("localStorage not supported in this environment");
897
- } catch (t) {
898
- console.error(t), e.getItem = () => null, e.setItem = () => {
899
- };
900
- }
901
- }
902
- function Wt(e) {
903
- return `react-resizable-panels:${e}`;
904
- }
905
- function Yt(e) {
906
- return e.map((t) => {
907
- const {
908
- constraints: n,
909
- id: r,
910
- idIsFromProps: i,
911
- order: o
912
- } = t;
913
- return i ? r : o ? `${o}:${JSON.stringify(n)}` : JSON.stringify(n);
914
- }).sort((t, n) => t.localeCompare(n)).join(",");
915
- }
916
- function jt(e, t) {
917
- try {
918
- const n = Wt(e), r = t.getItem(n);
919
- if (r) {
920
- const i = JSON.parse(r);
921
- if (typeof i == "object" && i != null)
922
- return i;
923
- }
924
- } catch {
925
- }
926
- return null;
927
- }
928
- function Pr(e, t, n) {
929
- var r, i;
930
- const o = (r = jt(e, n)) !== null && r !== void 0 ? r : {}, s = Yt(t);
931
- return (i = o[s]) !== null && i !== void 0 ? i : null;
932
- }
933
- function wr(e, t, n, r, i) {
934
- var o;
935
- const s = Wt(e), l = Yt(t), a = (o = jt(e, i)) !== null && o !== void 0 ? o : {};
936
- a[l] = {
937
- expandToSizes: Object.fromEntries(n.entries()),
938
- layout: r
939
- };
940
- try {
941
- i.setItem(s, JSON.stringify(a));
942
- } catch (d) {
943
- console.error(d);
944
- }
945
- }
946
- function bt({
947
- layout: e,
948
- panelConstraints: t
949
- }) {
950
- const n = [...e], r = n.reduce((o, s) => o + s, 0);
951
- if (n.length !== t.length)
952
- throw Error(`Invalid ${t.length} panel layout: ${n.map((o) => `${o}%`).join(", ")}`);
953
- if (!ee(r, 100) && n.length > 0)
954
- for (let o = 0; o < t.length; o++) {
955
- const s = n[o];
956
- I(s != null, `No layout data found for index ${o}`);
957
- const l = 100 / r * s;
958
- n[o] = l;
959
- }
960
- let i = 0;
961
- for (let o = 0; o < t.length; o++) {
962
- const s = n[o];
963
- I(s != null, `No layout data found for index ${o}`);
964
- const l = be({
965
- panelConstraints: t,
966
- panelIndex: o,
967
- size: s
968
- });
969
- s != l && (i += s - l, n[o] = l);
970
- }
971
- if (!ee(i, 0))
972
- for (let o = 0; o < t.length; o++) {
973
- const s = n[o];
974
- I(s != null, `No layout data found for index ${o}`);
975
- const l = s + i, a = be({
976
- panelConstraints: t,
977
- panelIndex: o,
978
- size: l
979
- });
980
- if (s !== a && (i -= a - s, n[o] = a, ee(i, 0)))
981
- break;
982
- }
983
- return n;
984
- }
985
- const Cr = 100, Ae = {
986
- getItem: (e) => (vt(Ae), Ae.getItem(e)),
987
- setItem: (e, t) => {
988
- vt(Ae), Ae.setItem(e, t);
989
- }
990
- }, St = {};
991
- function Xt({
992
- autoSaveId: e = null,
993
- children: t,
994
- className: n = "",
995
- direction: r,
996
- forwardedRef: i,
997
- id: o = null,
998
- onLayout: s = null,
999
- keyboardResizeBy: l = null,
1000
- storage: a = Ae,
1001
- style: d,
1002
- tagName: f = "div",
1003
- ...u
1004
- }) {
1005
- const c = st(o), m = O(null), [p, g] = de(null), [y, h] = de([]), A = pr(), x = O({}), R = O(/* @__PURE__ */ new Map()), D = O(0), L = O({
1006
- autoSaveId: e,
1007
- direction: r,
1008
- dragState: p,
1009
- id: c,
1010
- keyboardResizeBy: l,
1011
- onLayout: s,
1012
- storage: a
1013
- }), C = O({
1014
- layout: y,
1015
- panelDataArray: [],
1016
- panelDataArrayChanged: !1
1017
- });
1018
- O({
1019
- didLogIdAndOrderWarning: !1,
1020
- didLogPanelConstraintsWarning: !1,
1021
- prevPanelIds: []
1022
- }), zt(i, () => ({
1023
- getId: () => L.current.id,
1024
- getLayout: () => {
1025
- const {
1026
- layout: v
1027
- } = C.current;
1028
- return v;
1029
- },
1030
- setLayout: (v) => {
1031
- const {
1032
- onLayout: P
1033
- } = L.current, {
1034
- layout: E,
1035
- panelDataArray: z
1036
- } = C.current, b = bt({
1037
- layout: v,
1038
- panelConstraints: z.map((w) => w.constraints)
1039
- });
1040
- yt(E, b) || (h(b), C.current.layout = b, P && P(b), ye(z, b, x.current));
1041
- }
1042
- }), []), ge(() => {
1043
- L.current.autoSaveId = e, L.current.direction = r, L.current.dragState = p, L.current.id = c, L.current.onLayout = s, L.current.storage = a;
1044
- }), yr({
1045
- committedValuesRef: L,
1046
- eagerValuesRef: C,
1047
- groupId: c,
1048
- layout: y,
1049
- panelDataArray: C.current.panelDataArray,
1050
- setLayout: h,
1051
- panelGroupElement: m.current
1052
- }), ne(() => {
1053
- const {
1054
- panelDataArray: v
1055
- } = C.current;
1056
- if (e) {
1057
- if (y.length === 0 || y.length !== v.length)
1058
- return;
1059
- let P = St[e];
1060
- P == null && (P = zr(wr, Cr), St[e] = P);
1061
- const E = [...v], z = new Map(R.current);
1062
- P(e, E, z, y, a);
1063
- }
1064
- }, [e, y, a]), ne(() => {
1065
- });
1066
- const j = G((v) => {
1067
- const {
1068
- onLayout: P
1069
- } = L.current, {
1070
- layout: E,
1071
- panelDataArray: z
1072
- } = C.current;
1073
- if (v.constraints.collapsible) {
1074
- const b = z.map((H) => H.constraints), {
1075
- collapsedSize: w = 0,
1076
- panelSize: k,
1077
- pivotIndices: S
1078
- } = fe(z, v, E);
1079
- if (I(k != null, `Panel size not found for panel "${v.id}"`), !ae(k, w)) {
1080
- R.current.set(v.id, k);
1081
- const Q = ve(z, v) === z.length - 1 ? k - w : w - k, V = De({
1082
- delta: Q,
1083
- initialLayout: E,
1084
- panelConstraints: b,
1085
- pivotIndices: S,
1086
- prevLayout: E,
1087
- trigger: "imperative-api"
1088
- });
1089
- ke(E, V) || (h(V), C.current.layout = V, P && P(V), ye(z, V, x.current));
1090
- }
1091
- }
1092
- }, []), J = G((v, P) => {
1093
- const {
1094
- onLayout: E
1095
- } = L.current, {
1096
- layout: z,
1097
- panelDataArray: b
1098
- } = C.current;
1099
- if (v.constraints.collapsible) {
1100
- const w = b.map((oe) => oe.constraints), {
1101
- collapsedSize: k = 0,
1102
- panelSize: S = 0,
1103
- minSize: H = 0,
1104
- pivotIndices: Q
1105
- } = fe(b, v, z), V = P ?? H;
1106
- if (ae(S, k)) {
1107
- const oe = R.current.get(v.id), Ee = oe != null && oe >= V ? oe : V, Ue = ve(b, v) === b.length - 1 ? S - Ee : Ee - S, Z = De({
1108
- delta: Ue,
1109
- initialLayout: z,
1110
- panelConstraints: w,
1111
- pivotIndices: Q,
1112
- prevLayout: z,
1113
- trigger: "imperative-api"
1114
- });
1115
- ke(z, Z) || (h(Z), C.current.layout = Z, E && E(Z), ye(b, Z, x.current));
1116
- }
1117
- }
1118
- }, []), K = G((v) => {
1119
- const {
1120
- layout: P,
1121
- panelDataArray: E
1122
- } = C.current, {
1123
- panelSize: z
1124
- } = fe(E, v, P);
1125
- return I(z != null, `Panel size not found for panel "${v.id}"`), z;
1126
- }, []), M = G((v, P) => {
1127
- const {
1128
- panelDataArray: E
1129
- } = C.current, z = ve(E, v);
1130
- return xr({
1131
- defaultSize: P,
1132
- dragState: p,
1133
- layout: y,
1134
- panelData: E,
1135
- panelIndex: z
1136
- });
1137
- }, [p, y]), _ = G((v) => {
1138
- const {
1139
- layout: P,
1140
- panelDataArray: E
1141
- } = C.current, {
1142
- collapsedSize: z = 0,
1143
- collapsible: b,
1144
- panelSize: w
1145
- } = fe(E, v, P);
1146
- return I(w != null, `Panel size not found for panel "${v.id}"`), b === !0 && ae(w, z);
1147
- }, []), U = G((v) => {
1148
- const {
1149
- layout: P,
1150
- panelDataArray: E
1151
- } = C.current, {
1152
- collapsedSize: z = 0,
1153
- collapsible: b,
1154
- panelSize: w
1155
- } = fe(E, v, P);
1156
- return I(w != null, `Panel size not found for panel "${v.id}"`), !b || he(w, z) > 0;
1157
- }, []), B = G((v) => {
1158
- const {
1159
- panelDataArray: P
1160
- } = C.current;
1161
- P.push(v), P.sort((E, z) => {
1162
- const b = E.order, w = z.order;
1163
- return b == null && w == null ? 0 : b == null ? -1 : w == null ? 1 : b - w;
1164
- }), C.current.panelDataArrayChanged = !0, A();
1165
- }, [A]);
1166
- ge(() => {
1167
- if (C.current.panelDataArrayChanged) {
1168
- C.current.panelDataArrayChanged = !1;
1169
- const {
1170
- autoSaveId: v,
1171
- onLayout: P,
1172
- storage: E
1173
- } = L.current, {
1174
- layout: z,
1175
- panelDataArray: b
1176
- } = C.current;
1177
- let w = null;
1178
- if (v) {
1179
- const S = Pr(v, b, E);
1180
- S && (R.current = new Map(Object.entries(S.expandToSizes)), w = S.layout);
1181
- }
1182
- w == null && (w = Sr({
1183
- panelDataArray: b
1184
- }));
1185
- const k = bt({
1186
- layout: w,
1187
- panelConstraints: b.map((S) => S.constraints)
1188
- });
1189
- yt(z, k) || (h(k), C.current.layout = k, P && P(k), ye(b, k, x.current));
1190
- }
1191
- }), ge(() => {
1192
- const v = C.current;
1193
- return () => {
1194
- v.layout = [];
1195
- };
1196
- }, []);
1197
- const $ = G((v) => {
1198
- let P = !1;
1199
- const E = m.current;
1200
- return E && window.getComputedStyle(E, null).getPropertyValue("direction") === "rtl" && (P = !0), function(b) {
1201
- b.preventDefault();
1202
- const w = m.current;
1203
- if (!w)
1204
- return () => null;
1205
- const {
1206
- direction: k,
1207
- dragState: S,
1208
- id: H,
1209
- keyboardResizeBy: Q,
1210
- onLayout: V
1211
- } = L.current, {
1212
- layout: oe,
1213
- panelDataArray: Ee
1214
- } = C.current, {
1215
- initialLayout: _e
1216
- } = S ?? {}, Ue = Ot(H, v, w);
1217
- let Z = br(b, v, k, S, Q, w);
1218
- const ut = k === "horizontal";
1219
- ut && P && (Z = -Z);
1220
- const Sn = Ee.map((xn) => xn.constraints), Ie = De({
1221
- delta: Z,
1222
- initialLayout: _e ?? oe,
1223
- panelConstraints: Sn,
1224
- pivotIndices: Ue,
1225
- prevLayout: oe,
1226
- trigger: _t(b) ? "keyboard" : "mouse-or-touch"
1227
- }), dt = !ke(oe, Ie);
1228
- (kt(b) || Tt(b)) && D.current != Z && (D.current = Z, !dt && Z !== 0 ? ut ? Xe(v, Z < 0 ? Vt : $t) : Xe(v, Z < 0 ? Ft : Kt) : Xe(v, 0)), dt && (h(Ie), C.current.layout = Ie, V && V(Ie), ye(Ee, Ie, x.current));
1229
- };
1230
- }, []), F = G((v, P) => {
1231
- const {
1232
- onLayout: E
1233
- } = L.current, {
1234
- layout: z,
1235
- panelDataArray: b
1236
- } = C.current, w = b.map((oe) => oe.constraints), {
1237
- panelSize: k,
1238
- pivotIndices: S
1239
- } = fe(b, v, z);
1240
- I(k != null, `Panel size not found for panel "${v.id}"`);
1241
- const Q = ve(b, v) === b.length - 1 ? k - P : P - k, V = De({
1242
- delta: Q,
1243
- initialLayout: z,
1244
- panelConstraints: w,
1245
- pivotIndices: S,
1246
- prevLayout: z,
1247
- trigger: "imperative-api"
1248
- });
1249
- ke(z, V) || (h(V), C.current.layout = V, E && E(V), ye(b, V, x.current));
1250
- }, []), X = G((v, P) => {
1251
- const {
1252
- layout: E,
1253
- panelDataArray: z
1254
- } = C.current, {
1255
- collapsedSize: b = 0,
1256
- collapsible: w
1257
- } = P, {
1258
- collapsedSize: k = 0,
1259
- collapsible: S,
1260
- maxSize: H = 100,
1261
- minSize: Q = 0
1262
- } = v.constraints, {
1263
- panelSize: V
1264
- } = fe(z, v, E);
1265
- V != null && (w && S && ae(V, b) ? ae(b, k) || F(v, k) : V < Q ? F(v, Q) : V > H && F(v, H));
1266
- }, [F]), Y = G((v, P) => {
1267
- const {
1268
- direction: E
1269
- } = L.current, {
1270
- layout: z
1271
- } = C.current;
1272
- if (!m.current)
1273
- return;
1274
- const b = Oe(v, m.current);
1275
- I(b, `Drag handle element not found for id "${v}"`);
1276
- const w = Ut(E, P);
1277
- g({
1278
- dragHandleId: v,
1279
- dragHandleRect: b.getBoundingClientRect(),
1280
- initialCursorPosition: w,
1281
- initialLayout: z
1282
- });
1283
- }, []), te = G(() => {
1284
- g(null);
1285
- }, []), ce = G((v) => {
1286
- const {
1287
- panelDataArray: P
1288
- } = C.current, E = ve(P, v);
1289
- E >= 0 && (P.splice(E, 1), delete x.current[v.id], C.current.panelDataArrayChanged = !0, A());
1290
- }, [A]), le = W(() => ({
1291
- collapsePanel: j,
1292
- direction: r,
1293
- dragState: p,
1294
- expandPanel: J,
1295
- getPanelSize: K,
1296
- getPanelStyle: M,
1297
- groupId: c,
1298
- isPanelCollapsed: _,
1299
- isPanelExpanded: U,
1300
- reevaluatePanelConstraints: X,
1301
- registerPanel: B,
1302
- registerResizeHandle: $,
1303
- resizePanel: F,
1304
- startDragging: Y,
1305
- stopDragging: te,
1306
- unregisterPanel: ce,
1307
- panelGroupElement: m.current
1308
- }), [j, p, r, J, K, M, c, _, U, X, B, $, F, Y, te, ce]), re = {
1309
- display: "flex",
1310
- flexDirection: r === "horizontal" ? "row" : "column",
1311
- height: "100%",
1312
- overflow: "hidden",
1313
- width: "100%"
1314
- };
1315
- return xe(Ke.Provider, {
1316
- value: le
1317
- }, xe(f, {
1318
- ...u,
1319
- children: t,
1320
- className: n,
1321
- id: o,
1322
- ref: m,
1323
- style: {
1324
- ...re,
1325
- ...d
1326
- },
1327
- // CSS selectors
1328
- [q.group]: "",
1329
- [q.groupDirection]: r,
1330
- [q.groupId]: c
1331
- }));
1332
- }
1333
- const Er = Fe((e, t) => xe(Xt, {
1334
- ...e,
1335
- forwardedRef: t
1336
- }));
1337
- Xt.displayName = "PanelGroup";
1338
- Er.displayName = "forwardRef(PanelGroup)";
1339
- function ve(e, t) {
1340
- return e.findIndex((n) => n === t || n.id === t.id);
1341
- }
1342
- function fe(e, t, n) {
1343
- const r = ve(e, t), o = r === e.length - 1 ? [r - 1, r] : [r, r + 1], s = n[r];
1344
- return {
1345
- ...t.constraints,
1346
- panelSize: s,
1347
- pivotIndices: o
1348
- };
1349
- }
1350
- function Ir({
1351
- disabled: e,
1352
- handleId: t,
1353
- resizeHandler: n,
1354
- panelGroupElement: r
1355
- }) {
1356
- ne(() => {
1357
- if (e || n == null || r == null)
1358
- return;
1359
- const i = Oe(t, r);
1360
- if (i == null)
1361
- return;
1362
- const o = (s) => {
1363
- if (!s.defaultPrevented)
1364
- switch (s.key) {
1365
- case "ArrowDown":
1366
- case "ArrowLeft":
1367
- case "ArrowRight":
1368
- case "ArrowUp":
1369
- case "End":
1370
- case "Home": {
1371
- s.preventDefault(), n(s);
1372
- break;
1373
- }
1374
- case "F6": {
1375
- s.preventDefault();
1376
- const l = i.getAttribute(q.groupId);
1377
- I(l, `No group element found for id "${l}"`);
1378
- const a = Le(l, r), d = qt(l, t, r);
1379
- I(d !== null, `No resize element found for id "${t}"`);
1380
- const f = s.shiftKey ? d > 0 ? d - 1 : a.length - 1 : d + 1 < a.length ? d + 1 : 0;
1381
- a[f].focus();
1382
- break;
1383
- }
1384
- }
1385
- };
1386
- return i.addEventListener("keydown", o), () => {
1387
- i.removeEventListener("keydown", o);
1388
- };
1389
- }, [r, e, t, n]);
1390
- }
1391
- function Rr({
1392
- children: e = null,
1393
- className: t = "",
1394
- disabled: n = !1,
1395
- hitAreaMargins: r,
1396
- id: i,
1397
- onBlur: o,
1398
- onClick: s,
1399
- onDragging: l,
1400
- onFocus: a,
1401
- onPointerDown: d,
1402
- onPointerUp: f,
1403
- style: u = {},
1404
- tabIndex: c = 0,
1405
- tagName: m = "div",
1406
- ...p
1407
- }) {
1408
- var g, y;
1409
- const h = O(null), A = O({
1410
- onClick: s,
1411
- onDragging: l,
1412
- onPointerDown: d,
1413
- onPointerUp: f
1414
- });
1415
- ne(() => {
1416
- A.current.onClick = s, A.current.onDragging = l, A.current.onPointerDown = d, A.current.onPointerUp = f;
1417
- });
1418
- const x = rt(Ke);
1419
- if (x === null)
1420
- throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");
1421
- const {
1422
- direction: R,
1423
- groupId: D,
1424
- registerResizeHandle: L,
1425
- startDragging: C,
1426
- stopDragging: j,
1427
- panelGroupElement: J
1428
- } = x, K = st(i), [M, _] = de("inactive"), [U, B] = de(!1), [$, F] = de(null), X = O({
1429
- state: M
1430
- });
1431
- ge(() => {
1432
- X.current.state = M;
1433
- }), ne(() => {
1434
- if (n)
1435
- F(null);
1436
- else {
1437
- const le = L(K);
1438
- F(() => le);
1439
- }
1440
- }, [n, K, L]);
1441
- const Y = (g = r == null ? void 0 : r.coarse) !== null && g !== void 0 ? g : 15, te = (y = r == null ? void 0 : r.fine) !== null && y !== void 0 ? y : 5;
1442
- return ne(() => {
1443
- if (n || $ == null)
1444
- return;
1445
- const le = h.current;
1446
- I(le, "Element ref not attached");
1447
- let re = !1;
1448
- return dr(K, le, R, {
1449
- coarse: Y,
1450
- fine: te
1451
- }, (P, E, z) => {
1452
- if (!E) {
1453
- _("inactive");
1454
- return;
1455
- }
1456
- switch (P) {
1457
- case "down": {
1458
- _("drag"), re = !1, I(z, 'Expected event to be defined for "down" action'), C(K, z);
1459
- const {
1460
- onDragging: b,
1461
- onPointerDown: w
1462
- } = A.current;
1463
- b == null || b(!0), w == null || w();
1464
- break;
1465
- }
1466
- case "move": {
1467
- const {
1468
- state: b
1469
- } = X.current;
1470
- re = !0, b !== "drag" && _("hover"), I(z, 'Expected event to be defined for "move" action'), $(z);
1471
- break;
1472
- }
1473
- case "up": {
1474
- _("hover"), j();
1475
- const {
1476
- onClick: b,
1477
- onDragging: w,
1478
- onPointerUp: k
1479
- } = A.current;
1480
- w == null || w(!1), k == null || k(), re || b == null || b();
1481
- break;
1482
- }
1483
- }
1484
- });
1485
- }, [Y, R, n, te, L, K, $, C, j]), Ir({
1486
- disabled: n,
1487
- handleId: K,
1488
- resizeHandler: $,
1489
- panelGroupElement: J
1490
- }), xe(m, {
1491
- ...p,
1492
- children: e,
1493
- className: t,
1494
- id: i,
1495
- onBlur: () => {
1496
- B(!1), o == null || o();
1497
- },
1498
- onFocus: () => {
1499
- B(!0), a == null || a();
1500
- },
1501
- ref: h,
1502
- role: "separator",
1503
- style: {
1504
- ...{
1505
- touchAction: "none",
1506
- userSelect: "none"
1507
- },
1508
- ...u
1509
- },
1510
- tabIndex: c,
1511
- // CSS selectors
1512
- [q.groupDirection]: R,
1513
- [q.groupId]: D,
1514
- [q.resizeHandle]: "",
1515
- [q.resizeHandleActive]: M === "drag" ? "pointer" : U ? "keyboard" : void 0,
1516
- [q.resizeHandleEnabled]: !n,
1517
- [q.resizeHandleId]: K,
1518
- [q.resizeHandleState]: M
1519
- });
1520
- }
1521
- Rr.displayName = "PanelResizeHandle";
1522
- function Qt() {
1523
- var a, d;
1524
- const e = ie((f) => f.card), t = ie((f) => f.frame), n = W(
1525
- () => Wn(t, e),
1526
- [t, e]
1527
- ), { manifest: r } = Pt(
1528
- ((a = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : a.url) || ""
1529
- ), i = W(
1530
- () => {
1531
- var f;
1532
- return (f = r == null ? void 0 : r.visuals) == null ? void 0 : f.find(
1533
- (u) => {
1534
- var c;
1535
- return u.name === ((c = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : c.componentName);
1536
- }
1537
- );
1538
- },
1539
- [r, (d = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : d.componentName]
1540
- ), o = Nt(n, i), s = W(
1541
- () => Mt({
1542
- frame: t,
1543
- configCard: n,
1544
- isMultiInputVisual: o === "multiple"
1545
- }),
1546
- [t, n, o]
1547
- ), l = W(() => {
1548
- const f = s.findIndex(
1549
- (u) => (u == null ? void 0 : u.id) === e.id
1550
- );
1551
- return f < 0 ? -1 : Je(e, f);
1552
- }, [s, e]);
1553
- return W(() => !n || o !== "multiple" || l < 0 ? e.type : Te(
1554
- e,
1555
- l,
1556
- i == null ? void 0 : i.slots
1557
- ) ?? e.type, [n, o, l, e, i == null ? void 0 : i.slots]);
1558
- }
1559
- function Jt({
1560
- storeValue: e,
1561
- defaultValue: t = "",
1562
- onStoreUpdate: n,
1563
- delay: r = 300
1564
- }) {
1565
- const [i, o] = de(e ?? t), s = O(null), l = O(i), a = O(e), d = O(!1), f = G(() => {
1566
- s.current && (clearTimeout(s.current), s.current = null), d.current && l.current !== (a.current ?? t) && (n(l.current), a.current = l.current);
1567
- }, [t, n]);
1568
- ne(() => {
1569
- if (e !== a.current) {
1570
- s.current && (clearTimeout(s.current), s.current = null);
1571
- const c = e ?? t;
1572
- o(c), l.current = c, a.current = e, d.current = !1;
1573
- }
1574
- }, [e, t]), ne(() => {
1575
- if (d.current)
1576
- return s.current = setTimeout(() => {
1577
- f();
1578
- }, r), () => {
1579
- s.current && (clearTimeout(s.current), s.current = null);
1580
- };
1581
- }, [r, f, i]), ne(() => () => {
1582
- s.current && clearTimeout(s.current);
1583
- }, []);
1584
- const u = G(
1585
- (c) => {
1586
- const m = c ?? t;
1587
- d.current = !0, l.current = m, o(m);
1588
- },
1589
- [t]
1590
- );
1591
- return { value: i, onChange: u, flush: f };
1592
- }
1593
- function Zt({
1594
- queryClient: e,
1595
- readQueryKey: t,
1596
- setRunSql: n
1597
- }) {
1598
- Rn(), setTimeout(() => {
1599
- e.resetQueries({ queryKey: t(), exact: !0 }), n(!0);
1600
- }, 0);
1601
- }
1602
- const Dr = 300;
1603
- function Ar({ className: e }, t) {
1604
- const n = ie((x) => x.card.sql), r = ie((x) => x.sqlGen), i = ie((x) => x.card), o = Qt(), { setCardSql: s, setSqlGen: l, setRunSql: a } = wt(), d = W(() => o !== i.type ? { ...i, type: o } : i, [i, o]), { queryKey: f } = ot(d), u = Ct(), c = O(f);
1605
- c.current = f;
1606
- const m = O(r);
1607
- m.current = r;
1608
- const p = G(
1609
- (x) => {
1610
- s(x);
1611
- },
1612
- [s]
1613
- ), {
1614
- value: g,
1615
- onChange: y,
1616
- flush: h
1617
- } = Jt({
1618
- storeValue: n,
1619
- defaultValue: "",
1620
- onStoreUpdate: p,
1621
- delay: Dr
1622
- });
1623
- ne(() => Et(h), [h]);
1624
- function A(x) {
1625
- y(x), Yn(m.current) || l({});
1626
- }
1627
- return /* @__PURE__ */ N("div", { className: "relative h-full w-full", children: /* @__PURE__ */ N(
1628
- It,
1629
- {
1630
- ref: t,
1631
- value: g ?? "",
1632
- onValueChange: A,
1633
- language: "sql-jinja",
1634
- embedded: !0,
1635
- hideLineNumbers: !0,
1636
- wrapLines: !0,
1637
- placeholder: "Write your SQL here",
1638
- className: e,
1639
- onKeyDown: (x) => {
1640
- x.key === "Enter" && x.shiftKey && (x.preventDefault(), Zt({
1641
- queryClient: u,
1642
- readQueryKey: () => c.current,
1643
- setRunSql: a
1644
- }));
1645
- }
1646
- }
1647
- ) });
1648
- }
1649
- const xo = Fe(Ar), Nr = 300, Mr = `# 'data' holds the SQL result.
1650
- # Set 'result' to a list of dicts to replace it, for example:
1651
- # import pandas as pd
1652
- # result = pd.DataFrame(data).to_dict('records')`;
1653
- function Lr({ className: e }, t) {
1654
- const n = ie((p) => p.card.python), r = ie((p) => p.card), i = Qt(), { setCardPython: o, setRunSql: s } = wt(), l = W(() => i !== r.type ? { ...r, type: i } : r, [r, i]), { queryKey: a } = ot(l), d = Ct(), f = O(a);
1655
- f.current = a;
1656
- const { value: u, onChange: c, flush: m } = Jt({
1657
- storeValue: n,
1658
- onStoreUpdate: o,
1659
- delay: Nr
1660
- });
1661
- return ne(() => Et(m), [m]), /* @__PURE__ */ N(
1662
- It,
1663
- {
1664
- ref: t,
1665
- value: u ?? "",
1666
- onValueChange: c,
1667
- language: "python",
1668
- placeholder: Mr,
1669
- ariaLabel: "Python code",
1670
- embedded: !0,
1671
- hideLineNumbers: !0,
1672
- wrapLines: !0,
1673
- className: we(
1674
- "[&_.code-editor-pre]:!pt-2 [&_.code-editor-textarea]:!pt-2",
1675
- e
1676
- ),
1677
- onKeyDown: (p) => {
1678
- p.key === "Enter" && p.shiftKey && (p.preventDefault(), Zt({
1679
- queryClient: d,
1680
- readQueryKey: () => f.current,
1681
- setRunSql: s
1682
- }));
1683
- }
1684
- }
1685
- );
1686
- }
1687
- const zo = Fe(Lr);
1688
- function _r({ card: e }) {
1689
- var E, z, b, w, k;
1690
- const t = Dn(), [n, r] = de({}), { authToken: i } = An(), o = jn(i == null ? void 0 : i.accessToken), { compiledAppearance: s } = Jn(), l = W(
1691
- () => Nn(s),
1692
- [s]
1693
- ), a = ie((S) => S.frame), d = ie(
1694
- (S) => S.inlineFilterValuesMap[e.id]
1695
- ), f = ie(
1696
- (S) => S.actions.setCardInlineFilterValue
1697
- ), u = ie(
1698
- (S) => S.actions.removeCardInlineFilterValue
1699
- ), c = e, { getCard: m, manifest: p } = Pt(
1700
- ((E = c.customCardPreferences) == null ? void 0 : E.url) || ""
1701
- ), g = (z = p == null ? void 0 : p.visuals) == null ? void 0 : z.find(
1702
- (S) => {
1703
- var H;
1704
- return S.name === ((H = c.customCardPreferences) == null ? void 0 : H.componentName);
1705
- }
1706
- ), y = Nt(c, g) ?? "single", h = W(
1707
- () => Mt({
1708
- frame: a,
1709
- configCard: c,
1710
- isMultiInputVisual: y === "multiple"
1711
- }),
1712
- [a, c, y]
1713
- ), A = W(() => {
1714
- const S = h.findIndex(
1715
- (H) => (H == null ? void 0 : H.id) === e.id
1716
- );
1717
- return S < 0 ? -1 : Je(e, S);
1718
- }, [h, e]), x = W(() => y !== "multiple" || A < 0 ? e.type : Te(
1719
- e,
1720
- A,
1721
- g == null ? void 0 : g.slots
1722
- ) ?? e.type, [y, A, e, g == null ? void 0 : g.slots]), R = W(() => y === "multiple" ? {
1723
- ...e,
1724
- connectionId: void 0,
1725
- dataSource: void 0,
1726
- sql: "",
1727
- python: "",
1728
- config: void 0,
1729
- queryConfig: void 0
1730
- } : x !== e.type ? { ...e, type: x } : e, [e, x, y]), { data: D, effectiveCardConfig: L, renderCard: C } = ot(R), j = Mn(), J = Re((S) => S.dashboard), K = Re(
1731
- (S) => S.dashboardInputValues
1732
- ), M = Re(
1733
- (S) => S.adHocFilterValues
1734
- ), _ = Re(
1735
- (S) => {
1736
- var H;
1737
- return ((H = S.reportContext) == null ? void 0 : H.calendar) ?? null;
1738
- }
1739
- ), U = Re((S) => S.selectedSheetId), B = W(
1740
- () => Ln({
1741
- card: e,
1742
- sheetId: U || "",
1743
- inlineFilterValues: d,
1744
- setInlineFilterValue: (S) => f(e.id, S),
1745
- removeInlineFilterValue: (S) => u(e.id, S)
1746
- }),
1747
- [
1748
- e,
1749
- U,
1750
- d,
1751
- f,
1752
- u
1753
- ]
1754
- ), {
1755
- filterInputs: $,
1756
- filters: F,
1757
- filterValues: X
1758
- } = W(
1759
- () => _n({
1760
- dashboard: J,
1761
- card: e,
1762
- sheetId: U,
1763
- dashboardInputValues: K,
1764
- adHocFilterValues: M,
1765
- transientContexts: j,
1766
- calendar: _
1767
- }),
1768
- [
1769
- M,
1770
- e,
1771
- K,
1772
- _,
1773
- J,
1774
- U,
1775
- j
1776
- ]
1777
- ), Y = G(
1778
- (S, H) => {
1779
- const Q = Xn(H);
1780
- r((V) => ({
1781
- ...V,
1782
- [S]: Q
1783
- }));
1784
- },
1785
- []
1786
- ), te = (b = c.customCardPreferences) == null ? void 0 : b.componentName, ce = te ? m(te) : null, le = kn(
1787
- (w = c.customCardPreferences) == null ? void 0 : w.settings,
1788
- c
1789
- ), re = W(
1790
- () => Qn(h),
1791
- [h]
1792
- ), v = W(
1793
- () => re.map(
1794
- (S, H) => Te(
1795
- S,
1796
- H,
1797
- g == null ? void 0 : g.slots
1798
- )
1799
- ),
1800
- [re, g == null ? void 0 : g.slots]
1801
- ), P = W(
1802
- () => Tn(
1803
- y === "multiple" ? Hn({
1804
- slotOrderedCards: re,
1805
- multiInputData: n,
1806
- valueFormatPreferences: t
1807
- }) : [
1808
- {
1809
- card: e,
1810
- cardConfig: L,
1811
- columns: D == null ? void 0 : D.columns,
1812
- columnKeyMap: D == null ? void 0 : D.columnKeyMap,
1813
- valueFormatPreferences: t
1814
- }
1815
- ]
1816
- ),
1817
- [
1818
- e,
1819
- D == null ? void 0 : D.columnKeyMap,
1820
- D == null ? void 0 : D.columns,
1821
- L,
1822
- n,
1823
- re,
1824
- y,
1825
- t
1826
- ]
1827
- );
1828
- return te ? /* @__PURE__ */ N("div", { className: "semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto", children: /* @__PURE__ */ Ne(
1829
- Cn,
1830
- {
1831
- fallback: /* @__PURE__ */ N(ft, {}),
1832
- children: [
1833
- ce && y === "single" && /* @__PURE__ */ N(
1834
- ce,
1835
- {
1836
- editing: !0,
1837
- params: o,
1838
- theme: l,
1839
- settings: le,
1840
- cardMetadata: Vn({
1841
- // Its formats as its rows render, live model formats included (CF-D17).
1842
- card: C,
1843
- dataMetadata: D == null ? void 0 : D.metadata
1844
- }),
1845
- onDataChange: Y,
1846
- data: (D == null ? void 0 : D.records) || [],
1847
- columns: (D == null ? void 0 : D.columns) || [],
1848
- formatTemporalBucketValue: P,
1849
- filterInputs: $,
1850
- filters: F,
1851
- filterValues: [
1852
- ...X || [],
1853
- ...d || []
1854
- ],
1855
- inlineFilters: B
1856
- }
1857
- ),
1858
- ce && y === "multiple" && /* @__PURE__ */ Ne(ft, { children: [
1859
- h.map((S, H) => {
1860
- if (!S) return null;
1861
- const Q = Je(S, H), V = Te(
1862
- S,
1863
- Q,
1864
- g == null ? void 0 : g.slots
1865
- );
1866
- return /* @__PURE__ */ N(
1867
- $n,
1868
- {
1869
- onDataChange: Y,
1870
- card: S,
1871
- effectiveCardType: V
1872
- },
1873
- `${S.id}-${Q}`
1874
- );
1875
- }),
1876
- /* @__PURE__ */ N("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ N(
1877
- ce,
1878
- {
1879
- editing: !0,
1880
- onDataChange: Y,
1881
- ...Fn({
1882
- configCard: c,
1883
- slotOrderedCards: re,
1884
- slotTypes: v,
1885
- multiInputData: n,
1886
- params: o,
1887
- theme: l,
1888
- chartSettings: le,
1889
- filterInputs: $,
1890
- filters: F,
1891
- filterValues: [
1892
- ...X || [],
1893
- ...d || []
1894
- ],
1895
- inlineFilters: B,
1896
- formatTemporalBucketValue: P
1897
- })
1898
- }
1899
- ) })
1900
- ] })
1901
- ]
1902
- },
1903
- (k = c.customCardPreferences) == null ? void 0 : k.componentName
1904
- ) }) : null;
1905
- }
1906
- const Po = wn(_r);
1907
- var en = "Toggle", tn = T.forwardRef((e, t) => {
1908
- const { pressed: n, defaultPressed: r, onPressedChange: i, ...o } = e, [s, l] = Rt({
1909
- prop: n,
1910
- onChange: i,
1911
- defaultProp: r ?? !1,
1912
- caller: en
1913
- });
1914
- return /* @__PURE__ */ N(
1915
- ze.button,
1916
- {
1917
- type: "button",
1918
- "aria-pressed": s,
1919
- "data-state": s ? "on" : "off",
1920
- "data-disabled": e.disabled ? "" : void 0,
1921
- ...o,
1922
- ref: t,
1923
- onClick: me(e.onClick, () => {
1924
- e.disabled || l(!s);
1925
- })
1926
- }
1927
- );
1928
- });
1929
- tn.displayName = en;
1930
- var nn = tn;
1931
- const kr = Dt(
1932
- "inline-flex items-center justify-center rounded-control text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
1933
- {
1934
- variants: {
1935
- variant: {
1936
- default: "bg-transparent",
1937
- outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"
1938
- },
1939
- size: {
1940
- default: "h-10 px-3",
1941
- sm: "h-9 px-2.5",
1942
- lg: "h-11 px-5"
1943
- }
1944
- },
1945
- defaultVariants: {
1946
- variant: "default",
1947
- size: "default"
1948
- }
1949
- }
1950
- ), Tr = T.forwardRef(({ className: e, variant: t, size: n, ...r }, i) => /* @__PURE__ */ N(
1951
- nn,
1952
- {
1953
- ref: i,
1954
- className: we(kr({ variant: t, size: n, className: e })),
1955
- ...r
1956
- }
1957
- ));
1958
- Tr.displayName = nn.displayName;
1959
- const Hr = Dt(
1960
- "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
1961
- {
1962
- variants: {
1963
- variant: {
1964
- default: "bg-background text-foreground",
1965
- destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
1966
- }
1967
- },
1968
- defaultVariants: {
1969
- variant: "default"
1970
- }
1971
- }
1972
- ), Vr = T.forwardRef(({ className: e, variant: t, ...n }, r) => /* @__PURE__ */ N(
1973
- "div",
1974
- {
1975
- ref: r,
1976
- role: "alert",
1977
- className: we(Hr({ variant: t }), e),
1978
- ...n
1979
- }
1980
- ));
1981
- Vr.displayName = "Alert";
1982
- const $r = T.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ N(
1983
- "h5",
1984
- {
1985
- ref: n,
1986
- className: we("mb-1 font-medium leading-none tracking-tight", e),
1987
- ...t
1988
- }
1989
- ));
1990
- $r.displayName = "AlertTitle";
1991
- const Fr = T.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ N(
1992
- "div",
1993
- {
1994
- ref: n,
1995
- className: we("text-sm [&_p]:leading-relaxed", e),
1996
- ...t
1997
- }
1998
- ));
1999
- Fr.displayName = "AlertDescription";
2000
- var rn = ["PageUp", "PageDown"], on = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], sn = {
2001
- "from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
2002
- "from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
2003
- "from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
2004
- "from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
2005
- }, Ce = "Slider", [et, Kr, Br] = qn(Ce), [ln] = Bn(Ce, [
2006
- Br
2007
- ]), [qr, Ge] = ln(Ce), an = T.forwardRef(
2008
- (e, t) => {
2009
- const {
2010
- name: n,
2011
- min: r = 0,
2012
- max: i = 100,
2013
- step: o = 1,
2014
- orientation: s = "horizontal",
2015
- disabled: l = !1,
2016
- minStepsBetweenThumbs: a = 0,
2017
- defaultValue: d = [r],
2018
- value: f,
2019
- onValueChange: u = () => {
2020
- },
2021
- onValueCommit: c = () => {
2022
- },
2023
- inverted: m = !1,
2024
- form: p,
2025
- ...g
2026
- } = e, y = T.useRef(/* @__PURE__ */ new Set()), h = T.useRef(0), x = s === "horizontal" ? Or : Gr, [R = [], D] = Rt({
2027
- prop: f,
2028
- defaultProp: d,
2029
- onChange: (M) => {
2030
- var U;
2031
- (U = [...y.current][h.current]) == null || U.focus(), u(M);
2032
- }
2033
- }), L = T.useRef(R);
2034
- function C(M) {
2035
- const _ = Xr(R, M);
2036
- K(M, _);
2037
- }
2038
- function j(M) {
2039
- K(M, h.current);
2040
- }
2041
- function J() {
2042
- const M = L.current[h.current];
2043
- R[h.current] !== M && c(R);
2044
- }
2045
- function K(M, _, { commit: U } = { commit: !1 }) {
2046
- const B = eo(o), $ = to(Math.round((M - r) / o) * o + r, B), F = At($, [r, i]);
2047
- D((X = []) => {
2048
- const Y = Yr(X, F, _);
2049
- if (Zr(Y, a * o)) {
2050
- h.current = Y.indexOf(F);
2051
- const te = String(Y) !== String(X);
2052
- return te && U && c(Y), te ? Y : X;
2053
- } else
2054
- return X;
2055
- });
2056
- }
2057
- return /* @__PURE__ */ N(
2058
- qr,
2059
- {
2060
- scope: e.__scopeSlider,
2061
- name: n,
2062
- disabled: l,
2063
- min: r,
2064
- max: i,
2065
- valueIndexToChangeRef: h,
2066
- thumbs: y.current,
2067
- values: R,
2068
- orientation: s,
2069
- form: p,
2070
- children: /* @__PURE__ */ N(et.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ N(et.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ N(
2071
- x,
2072
- {
2073
- "aria-disabled": l,
2074
- "data-disabled": l ? "" : void 0,
2075
- ...g,
2076
- ref: t,
2077
- onPointerDown: me(g.onPointerDown, () => {
2078
- l || (L.current = R);
2079
- }),
2080
- min: r,
2081
- max: i,
2082
- inverted: m,
2083
- onSlideStart: l ? void 0 : C,
2084
- onSlideMove: l ? void 0 : j,
2085
- onSlideEnd: l ? void 0 : J,
2086
- onHomeKeyDown: () => !l && K(r, 0, { commit: !0 }),
2087
- onEndKeyDown: () => !l && K(i, R.length - 1, { commit: !0 }),
2088
- onStepKeyDown: ({ event: M, direction: _ }) => {
2089
- if (!l) {
2090
- const $ = rn.includes(M.key) || M.shiftKey && on.includes(M.key) ? 10 : 1, F = h.current, X = R[F], Y = o * $ * _;
2091
- K(X + Y, F, { commit: !0 });
2092
- }
2093
- }
2094
- }
2095
- ) }) })
2096
- }
2097
- );
2098
- }
2099
- );
2100
- an.displayName = Ce;
2101
- var [cn, un] = ln(Ce, {
2102
- startEdge: "left",
2103
- endEdge: "right",
2104
- size: "width",
2105
- direction: 1
2106
- }), Or = T.forwardRef(
2107
- (e, t) => {
2108
- const {
2109
- min: n,
2110
- max: r,
2111
- dir: i,
2112
- inverted: o,
2113
- onSlideStart: s,
2114
- onSlideMove: l,
2115
- onSlideEnd: a,
2116
- onStepKeyDown: d,
2117
- ...f
2118
- } = e, [u, c] = T.useState(null), m = Pe(t, (x) => c(x)), p = T.useRef(void 0), g = On(i), y = g === "ltr", h = y && !o || !y && o;
2119
- function A(x) {
2120
- const R = p.current || u.getBoundingClientRect(), D = [0, R.width], C = ct(D, h ? [n, r] : [r, n]);
2121
- return p.current = R, C(x - R.left);
2122
- }
2123
- return /* @__PURE__ */ N(
2124
- cn,
2125
- {
2126
- scope: e.__scopeSlider,
2127
- startEdge: h ? "left" : "right",
2128
- endEdge: h ? "right" : "left",
2129
- direction: h ? 1 : -1,
2130
- size: "width",
2131
- children: /* @__PURE__ */ N(
2132
- dn,
2133
- {
2134
- dir: g,
2135
- "data-orientation": "horizontal",
2136
- ...f,
2137
- ref: m,
2138
- style: {
2139
- ...f.style,
2140
- "--radix-slider-thumb-transform": "translateX(-50%)"
2141
- },
2142
- onSlideStart: (x) => {
2143
- const R = A(x.clientX);
2144
- s == null || s(R);
2145
- },
2146
- onSlideMove: (x) => {
2147
- const R = A(x.clientX);
2148
- l == null || l(R);
2149
- },
2150
- onSlideEnd: () => {
2151
- p.current = void 0, a == null || a();
2152
- },
2153
- onStepKeyDown: (x) => {
2154
- const D = sn[h ? "from-left" : "from-right"].includes(x.key);
2155
- d == null || d({ event: x, direction: D ? -1 : 1 });
2156
- }
2157
- }
2158
- )
2159
- }
2160
- );
2161
- }
2162
- ), Gr = T.forwardRef(
2163
- (e, t) => {
2164
- const {
2165
- min: n,
2166
- max: r,
2167
- inverted: i,
2168
- onSlideStart: o,
2169
- onSlideMove: s,
2170
- onSlideEnd: l,
2171
- onStepKeyDown: a,
2172
- ...d
2173
- } = e, f = T.useRef(null), u = Pe(t, f), c = T.useRef(void 0), m = !i;
2174
- function p(g) {
2175
- const y = c.current || f.current.getBoundingClientRect(), h = [0, y.height], x = ct(h, m ? [r, n] : [n, r]);
2176
- return c.current = y, x(g - y.top);
2177
- }
2178
- return /* @__PURE__ */ N(
2179
- cn,
2180
- {
2181
- scope: e.__scopeSlider,
2182
- startEdge: m ? "bottom" : "top",
2183
- endEdge: m ? "top" : "bottom",
2184
- size: "height",
2185
- direction: m ? 1 : -1,
2186
- children: /* @__PURE__ */ N(
2187
- dn,
2188
- {
2189
- "data-orientation": "vertical",
2190
- ...d,
2191
- ref: u,
2192
- style: {
2193
- ...d.style,
2194
- "--radix-slider-thumb-transform": "translateY(50%)"
2195
- },
2196
- onSlideStart: (g) => {
2197
- const y = p(g.clientY);
2198
- o == null || o(y);
2199
- },
2200
- onSlideMove: (g) => {
2201
- const y = p(g.clientY);
2202
- s == null || s(y);
2203
- },
2204
- onSlideEnd: () => {
2205
- c.current = void 0, l == null || l();
2206
- },
2207
- onStepKeyDown: (g) => {
2208
- const h = sn[m ? "from-bottom" : "from-top"].includes(g.key);
2209
- a == null || a({ event: g, direction: h ? -1 : 1 });
2210
- }
2211
- }
2212
- )
2213
- }
2214
- );
2215
- }
2216
- ), dn = T.forwardRef(
2217
- (e, t) => {
2218
- const {
2219
- __scopeSlider: n,
2220
- onSlideStart: r,
2221
- onSlideMove: i,
2222
- onSlideEnd: o,
2223
- onHomeKeyDown: s,
2224
- onEndKeyDown: l,
2225
- onStepKeyDown: a,
2226
- ...d
2227
- } = e, f = Ge(Ce, n);
2228
- return /* @__PURE__ */ N(
2229
- ze.span,
2230
- {
2231
- ...d,
2232
- ref: t,
2233
- onKeyDown: me(e.onKeyDown, (u) => {
2234
- u.key === "Home" ? (s(u), u.preventDefault()) : u.key === "End" ? (l(u), u.preventDefault()) : rn.concat(on).includes(u.key) && (a(u), u.preventDefault());
2235
- }),
2236
- onPointerDown: me(e.onPointerDown, (u) => {
2237
- const c = u.target;
2238
- c.setPointerCapture(u.pointerId), u.preventDefault(), f.thumbs.has(c) ? c.focus() : r(u);
2239
- }),
2240
- onPointerMove: me(e.onPointerMove, (u) => {
2241
- u.target.hasPointerCapture(u.pointerId) && i(u);
2242
- }),
2243
- onPointerUp: me(e.onPointerUp, (u) => {
2244
- const c = u.target;
2245
- c.hasPointerCapture(u.pointerId) && (c.releasePointerCapture(u.pointerId), o(u));
2246
- })
2247
- }
2248
- );
2249
- }
2250
- ), fn = "SliderTrack", pn = T.forwardRef(
2251
- (e, t) => {
2252
- const { __scopeSlider: n, ...r } = e, i = Ge(fn, n);
2253
- return /* @__PURE__ */ N(
2254
- ze.span,
2255
- {
2256
- "data-disabled": i.disabled ? "" : void 0,
2257
- "data-orientation": i.orientation,
2258
- ...r,
2259
- ref: t
2260
- }
2261
- );
2262
- }
2263
- );
2264
- pn.displayName = fn;
2265
- var tt = "SliderRange", mn = T.forwardRef(
2266
- (e, t) => {
2267
- const { __scopeSlider: n, ...r } = e, i = Ge(tt, n), o = un(tt, n), s = T.useRef(null), l = Pe(t, s), a = i.values.length, d = i.values.map(
2268
- (c) => yn(c, i.min, i.max)
2269
- ), f = a > 1 ? Math.min(...d) : 0, u = 100 - Math.max(...d);
2270
- return /* @__PURE__ */ N(
2271
- ze.span,
2272
- {
2273
- "data-orientation": i.orientation,
2274
- "data-disabled": i.disabled ? "" : void 0,
2275
- ...r,
2276
- ref: l,
2277
- style: {
2278
- ...e.style,
2279
- [o.startEdge]: f + "%",
2280
- [o.endEdge]: u + "%"
2281
- }
2282
- }
2283
- );
2284
- }
2285
- );
2286
- mn.displayName = tt;
2287
- var nt = "SliderThumb", gn = T.forwardRef(
2288
- (e, t) => {
2289
- const n = Kr(e.__scopeSlider), [r, i] = T.useState(null), o = Pe(t, (l) => i(l)), s = T.useMemo(
2290
- () => r ? n().findIndex((l) => l.ref.current === r) : -1,
2291
- [n, r]
2292
- );
2293
- return /* @__PURE__ */ N(Ur, { ...e, ref: o, index: s });
2294
- }
2295
- ), Ur = T.forwardRef(
2296
- (e, t) => {
2297
- const { __scopeSlider: n, index: r, name: i, ...o } = e, s = Ge(nt, n), l = un(nt, n), [a, d] = T.useState(null), f = Pe(t, (A) => d(A)), u = a ? s.form || !!a.closest("form") : !0, c = Gn(a), m = s.values[r], p = m === void 0 ? 0 : yn(m, s.min, s.max), g = jr(r, s.values.length), y = c == null ? void 0 : c[l.size], h = y ? Qr(y, p, l.direction) : 0;
2298
- return T.useEffect(() => {
2299
- if (a)
2300
- return s.thumbs.add(a), () => {
2301
- s.thumbs.delete(a);
2302
- };
2303
- }, [a, s.thumbs]), /* @__PURE__ */ Ne(
2304
- "span",
2305
- {
2306
- style: {
2307
- transform: "var(--radix-slider-thumb-transform)",
2308
- position: "absolute",
2309
- [l.startEdge]: `calc(${p}% + ${h}px)`
2310
- },
2311
- children: [
2312
- /* @__PURE__ */ N(et.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ N(
2313
- ze.span,
2314
- {
2315
- role: "slider",
2316
- "aria-label": e["aria-label"] || g,
2317
- "aria-valuemin": s.min,
2318
- "aria-valuenow": m,
2319
- "aria-valuemax": s.max,
2320
- "aria-orientation": s.orientation,
2321
- "data-orientation": s.orientation,
2322
- "data-disabled": s.disabled ? "" : void 0,
2323
- tabIndex: s.disabled ? void 0 : 0,
2324
- ...o,
2325
- ref: f,
2326
- style: m === void 0 ? { display: "none" } : e.style,
2327
- onFocus: me(e.onFocus, () => {
2328
- s.valueIndexToChangeRef.current = r;
2329
- })
2330
- }
2331
- ) }),
2332
- u && /* @__PURE__ */ N(
2333
- hn,
2334
- {
2335
- name: i ?? (s.name ? s.name + (s.values.length > 1 ? "[]" : "") : void 0),
2336
- form: s.form,
2337
- value: m
2338
- },
2339
- r
2340
- )
2341
- ]
2342
- }
2343
- );
2344
- }
2345
- );
2346
- gn.displayName = nt;
2347
- var Wr = "RadioBubbleInput", hn = T.forwardRef(
2348
- ({ __scopeSlider: e, value: t, ...n }, r) => {
2349
- const i = T.useRef(null), o = Pe(i, r), s = Un(t);
2350
- return T.useEffect(() => {
2351
- const l = i.current;
2352
- if (!l) return;
2353
- const a = window.HTMLInputElement.prototype, f = Object.getOwnPropertyDescriptor(a, "value").set;
2354
- if (s !== t && f) {
2355
- const u = new Event("input", { bubbles: !0 });
2356
- f.call(l, t), l.dispatchEvent(u);
2357
- }
2358
- }, [s, t]), /* @__PURE__ */ N(
2359
- ze.input,
2360
- {
2361
- style: { display: "none" },
2362
- ...n,
2363
- ref: o,
2364
- defaultValue: t
2365
- }
2366
- );
2367
- }
2368
- );
2369
- hn.displayName = Wr;
2370
- function Yr(e = [], t, n) {
2371
- const r = [...e];
2372
- return r[n] = t, r.sort((i, o) => i - o);
2373
- }
2374
- function yn(e, t, n) {
2375
- const o = 100 / (n - t) * (e - t);
2376
- return At(o, [0, 100]);
2377
- }
2378
- function jr(e, t) {
2379
- return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
2380
- }
2381
- function Xr(e, t) {
2382
- if (e.length === 1) return 0;
2383
- const n = e.map((i) => Math.abs(i - t)), r = Math.min(...n);
2384
- return n.indexOf(r);
2385
- }
2386
- function Qr(e, t, n) {
2387
- const r = e / 2, o = ct([0, 50], [0, r]);
2388
- return (r - o(t) * n) * n;
2389
- }
2390
- function Jr(e) {
2391
- return e.slice(0, -1).map((t, n) => e[n + 1] - t);
2392
- }
2393
- function Zr(e, t) {
2394
- if (t > 0) {
2395
- const n = Jr(e);
2396
- return Math.min(...n) >= t;
2397
- }
2398
- return !0;
2399
- }
2400
- function ct(e, t) {
2401
- return (n) => {
2402
- if (e[0] === e[1] || t[0] === t[1]) return t[0];
2403
- const r = (t[1] - t[0]) / (e[1] - e[0]);
2404
- return t[0] + r * (n - e[0]);
2405
- };
2406
- }
2407
- function eo(e) {
2408
- return (String(e).split(".")[1] || "").length;
2409
- }
2410
- function to(e, t) {
2411
- const n = Math.pow(10, t);
2412
- return Math.round(e * n) / n;
2413
- }
2414
- var vn = an, no = pn, ro = mn, oo = gn;
2415
- const io = T.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ Ne(
2416
- vn,
2417
- {
2418
- ref: n,
2419
- className: we(
2420
- "relative flex w-full touch-none select-none items-center",
2421
- e
2422
- ),
2423
- ...t,
2424
- children: [
2425
- /* @__PURE__ */ N(no, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ N(ro, { className: "absolute h-full bg-primary" }) }),
2426
- /* @__PURE__ */ N(oo, { className: "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" })
2427
- ]
2428
- }
2429
- ));
2430
- io.displayName = vn.displayName;
2431
- const so = xt(null), lo = Kn();
2432
- function bn(e) {
2433
- const t = rt(so) ?? lo;
2434
- return En(t.subscribe, () => e(t.get()), () => e(null));
2435
- }
2436
- function wo(e) {
2437
- return bn(
2438
- G((t) => (t == null ? void 0 : t.slot.zone) === e ? t.outcome : null, [e])
2439
- );
2440
- }
2441
- function Co(e, t, n) {
2442
- return bn(
2443
- G(
2444
- (r) => (r == null ? void 0 : r.slot.zone) !== e || r.outcome.kind === "refused" ? null : r.slot.beforeId === t ? "top" : !r.slot.beforeId && n ? "bottom" : null,
2445
- [e, t, n]
2446
- )
2447
- );
2448
- }
2449
- export {
2450
- Vr as A,
2451
- Po as E,
2452
- So as F,
2453
- tr as P,
2454
- xo as S,
2455
- Tr as T,
2456
- Er as a,
2457
- Rr as b,
2458
- zo as c,
2459
- Fr as d,
2460
- io as e,
2461
- wo as f,
2462
- Co as g,
2463
- so as h,
2464
- Zt as r,
2465
- Qt as u
2466
- };