@arcadeai/design-system 1.2.0 → 1.3.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 (113) hide show
  1. package/dist/arcade-49z5mR1G.js +1541 -0
  2. package/dist/assets/icons/arcade.d.ts +3 -0
  3. package/dist/assets/icons/arcade.js +33 -0
  4. package/dist/assets/icons/google-docs.js +110 -120
  5. package/dist/assets/icons/index.d.ts +1 -0
  6. package/dist/assets/icons/index.js +124 -122
  7. package/dist/assets/icons/utils.d.ts +26 -0
  8. package/dist/assets/icons/utils.js +155 -138
  9. package/dist/components/index.js +62 -48
  10. package/dist/components/ui/atoms/accordion.js +1 -1
  11. package/dist/components/ui/atoms/alert.js +2 -2
  12. package/dist/components/ui/atoms/avatar.js +1 -1
  13. package/dist/components/ui/atoms/badge.js +2 -2
  14. package/dist/components/ui/atoms/breadcrumb.js +13 -15
  15. package/dist/components/ui/atoms/button.js +2 -2
  16. package/dist/components/ui/atoms/byoc-badge.js +2 -2
  17. package/dist/components/ui/atoms/card.js +1 -1
  18. package/dist/components/ui/atoms/chart.js +1 -1
  19. package/dist/components/ui/atoms/checkbox.js +1 -1
  20. package/dist/components/ui/atoms/command.js +2 -2
  21. package/dist/components/ui/atoms/dialog.js +8 -8
  22. package/dist/components/ui/atoms/dropdown-menu.js +2 -2
  23. package/dist/components/ui/atoms/form.d.ts +1 -1
  24. package/dist/components/ui/atoms/form.js +8 -7
  25. package/dist/components/ui/atoms/hover-card.js +2 -2
  26. package/dist/components/ui/atoms/index.js +14 -13
  27. package/dist/components/ui/atoms/input.js +1 -1
  28. package/dist/components/ui/atoms/label.js +1 -1
  29. package/dist/components/ui/atoms/popover.js +2 -2
  30. package/dist/components/ui/atoms/pro-badge.js +2 -2
  31. package/dist/components/ui/atoms/progress.js +1 -1
  32. package/dist/components/ui/atoms/radio-group.js +1 -1
  33. package/dist/components/ui/atoms/resizable.js +24 -1527
  34. package/dist/components/ui/atoms/scroll-area.js +1 -1
  35. package/dist/components/ui/atoms/select.js +2 -2
  36. package/dist/components/ui/atoms/separator.js +1 -1
  37. package/dist/components/ui/atoms/sheet.js +2 -2
  38. package/dist/components/ui/atoms/sidebar.js +3 -3
  39. package/dist/components/ui/atoms/skeleton.js +1 -1
  40. package/dist/components/ui/atoms/slider.js +1 -1
  41. package/dist/components/ui/atoms/switch.js +1 -1
  42. package/dist/components/ui/atoms/table.js +1 -1
  43. package/dist/components/ui/atoms/tabs.js +1 -1
  44. package/dist/components/ui/atoms/textarea.js +1 -1
  45. package/dist/components/ui/atoms/toggle.js +2 -2
  46. package/dist/components/ui/atoms/tooltip.js +60 -60
  47. package/dist/components/ui/atoms/view-tools-control.d.ts +12 -0
  48. package/dist/components/ui/atoms/view-tools-control.js +53 -0
  49. package/dist/components/ui/index.d.ts +2 -0
  50. package/dist/components/ui/index.js +62 -48
  51. package/dist/components/ui/molecules/empty-state.d.ts +5 -0
  52. package/dist/components/ui/molecules/empty-state.js +25 -0
  53. package/dist/components/ui/molecules/index.d.ts +6 -0
  54. package/dist/components/ui/molecules/index.js +13 -0
  55. package/dist/components/ui/molecules/requirement-badges.d.ts +29 -0
  56. package/dist/components/ui/molecules/requirement-badges.js +24 -0
  57. package/dist/components/ui/molecules/tool-card.d.ts +17 -0
  58. package/dist/components/ui/molecules/tool-card.js +127 -0
  59. package/dist/components/ui/molecules/toolkit-card.d.ts +24 -0
  60. package/dist/components/ui/molecules/toolkit-card.js +13 -0
  61. package/dist/components/ui/molecules/toolkit-picker-trigger.d.ts +8 -0
  62. package/dist/components/ui/molecules/toolkit-picker-trigger.js +96 -0
  63. package/dist/components/ui/molecules/toolkit-selection-summary.d.ts +10 -0
  64. package/dist/components/ui/molecules/toolkit-selection-summary.js +117 -0
  65. package/dist/components/ui/organisms/index.d.ts +1 -0
  66. package/dist/components/ui/organisms/index.js +4 -0
  67. package/dist/components/ui/organisms/toolkit-picker/components/footer-summary.d.ts +1 -0
  68. package/dist/components/ui/organisms/toolkit-picker/components/footer-summary.js +36 -0
  69. package/dist/components/ui/organisms/toolkit-picker/components/mobile-filter-badges.d.ts +1 -0
  70. package/dist/components/ui/organisms/toolkit-picker/components/mobile-filter-badges.js +96 -0
  71. package/dist/components/ui/organisms/toolkit-picker/components/search-input.d.ts +1 -0
  72. package/dist/components/ui/organisms/toolkit-picker/components/search-input.js +36 -0
  73. package/dist/components/ui/organisms/toolkit-picker/components/select-button.d.ts +9 -0
  74. package/dist/components/ui/organisms/toolkit-picker/components/select-button.js +35 -0
  75. package/dist/components/ui/organisms/toolkit-picker/components/toolkit-card-with-selection.d.ts +9 -0
  76. package/dist/components/ui/organisms/toolkit-picker/components/toolkit-card-with-selection.js +36 -0
  77. package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-filter.test.d.ts +1 -0
  78. package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-filter.test.js +44 -0
  79. package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-search.test.d.ts +1 -0
  80. package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-search.test.js +46 -0
  81. package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-selection.test.d.ts +1 -0
  82. package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker-selection.test.js +28 -0
  83. package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker.d.ts +40 -0
  84. package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker.js +267 -0
  85. package/dist/components/ui/organisms/toolkit-picker/index.d.ts +14 -0
  86. package/dist/components/ui/organisms/toolkit-picker/index.js +16 -0
  87. package/dist/components/ui/organisms/toolkit-picker/mocks/toolkit-collection.d.ts +7 -0
  88. package/dist/components/ui/organisms/toolkit-picker/mocks/toolkit-collection.js +432 -0
  89. package/dist/components/ui/organisms/toolkit-picker/toolkit-picker.d.ts +2 -0
  90. package/dist/components/ui/organisms/toolkit-picker/toolkit-picker.js +395 -0
  91. package/dist/components/ui/organisms/toolkit-picker/toolkit-picker.test.d.ts +0 -0
  92. package/dist/components/ui/organisms/toolkit-picker/toolkit-picker.test.js +12832 -0
  93. package/dist/components/ui/utils/memo.d.ts +2 -0
  94. package/dist/components/ui/utils/memo.js +25 -0
  95. package/dist/{index-CQhYMnjT.js → index-BDE30rcJ.js} +1 -1
  96. package/dist/{index-PlrlSrPo.js → index-DEJd-dpa.js} +1 -1
  97. package/dist/{index-BSWzylXR.js → index-Ez2mlmzx.js} +2 -2
  98. package/dist/lib/arcade/arcade.d.ts +100 -0
  99. package/dist/lib/arcade/arcade.js +5 -0
  100. package/dist/lib/arcade/arcade.test.d.ts +1 -0
  101. package/dist/lib/arcade/arcade.test.js +299 -0
  102. package/dist/lib/arcade/mocks.d.ts +2 -0
  103. package/dist/lib/arcade/mocks.js +547 -0
  104. package/dist/lib/utils.d.ts +1 -0
  105. package/dist/lib/utils.js +3 -2
  106. package/dist/magic-string.es-BQ9KnLz-.js +659 -0
  107. package/dist/main.js +62 -48
  108. package/dist/react-resizable-panels.browser-ZHjTH32c.js +1509 -0
  109. package/dist/react.esm-369wBsAv.js +35565 -0
  110. package/dist/toolkit-card-GhM_oj4G.js +304 -0
  111. package/dist/{utils-CRiPKpXj.js → utils-Db4QWi-E.js} +204 -189
  112. package/dist/vi.bdSIJ99Y-CZgZQPWH.js +11996 -0
  113. package/package.json +49 -39
@@ -0,0 +1,1509 @@
1
+ import * as Pn from "react";
2
+ import { createContext as wn, forwardRef as Qe, createElement as de, useContext as en, useRef as F, useLayoutEffect as En, useImperativeHandle as nn, useState as ue, useEffect as te, useCallback as B, useMemo as In } from "react";
3
+ const Ce = wn(null);
4
+ Ce.displayName = "PanelGroupContext";
5
+ const A = {
6
+ group: "data-panel-group",
7
+ groupDirection: "data-panel-group-direction",
8
+ groupId: "data-panel-group-id",
9
+ panel: "data-panel",
10
+ panelCollapsible: "data-panel-collapsible",
11
+ panelId: "data-panel-id",
12
+ panelSize: "data-panel-size",
13
+ resizeHandle: "data-resize-handle",
14
+ resizeHandleActive: "data-resize-handle-active",
15
+ resizeHandleEnabled: "data-panel-resize-handle-enabled",
16
+ resizeHandleId: "data-panel-resize-handle-id",
17
+ resizeHandleState: "data-resize-handle-state"
18
+ }, Be = 10, re = En, Ve = Pn.useId, Cn = typeof Ve == "function" ? Ve : () => null;
19
+ let Rn = 0;
20
+ function Fe(e = null) {
21
+ const n = Cn(), t = F(e || n || null);
22
+ return t.current === null && (t.current = "" + Rn++), e ?? t.current;
23
+ }
24
+ function tn({
25
+ children: e,
26
+ className: n = "",
27
+ collapsedSize: t,
28
+ collapsible: r,
29
+ defaultSize: i,
30
+ forwardedRef: o,
31
+ id: l,
32
+ maxSize: s,
33
+ minSize: a,
34
+ onCollapse: m,
35
+ onExpand: P,
36
+ onResize: f,
37
+ order: u,
38
+ style: x,
39
+ tagName: h = "div",
40
+ ...E
41
+ }) {
42
+ const w = en(Ce);
43
+ if (w === null)
44
+ throw Error("Panel components must be rendered within a PanelGroup container");
45
+ const {
46
+ collapsePanel: S,
47
+ expandPanel: R,
48
+ getPanelSize: M,
49
+ getPanelStyle: $,
50
+ groupId: q,
51
+ isPanelCollapsed: C,
52
+ reevaluatePanelConstraints: b,
53
+ registerPanel: U,
54
+ resizePanel: J,
55
+ unregisterPanel: W
56
+ } = w, _ = Fe(l), D = F({
57
+ callbacks: {
58
+ onCollapse: m,
59
+ onExpand: P,
60
+ onResize: f
61
+ },
62
+ constraints: {
63
+ collapsedSize: t,
64
+ collapsible: r,
65
+ defaultSize: i,
66
+ maxSize: s,
67
+ minSize: a
68
+ },
69
+ id: _,
70
+ idIsFromProps: l !== void 0,
71
+ order: u
72
+ });
73
+ F({
74
+ didLogMissingDefaultSizeWarning: !1
75
+ }), re(() => {
76
+ const {
77
+ callbacks: k,
78
+ constraints: N
79
+ } = D.current, G = {
80
+ ...N
81
+ };
82
+ D.current.id = _, D.current.idIsFromProps = l !== void 0, D.current.order = u, k.onCollapse = m, k.onExpand = P, k.onResize = f, N.collapsedSize = t, N.collapsible = r, N.defaultSize = i, N.maxSize = s, N.minSize = a, (G.collapsedSize !== N.collapsedSize || G.collapsible !== N.collapsible || G.maxSize !== N.maxSize || G.minSize !== N.minSize) && b(D.current, G);
83
+ }), re(() => {
84
+ const k = D.current;
85
+ return U(k), () => {
86
+ W(k);
87
+ };
88
+ }, [u, _, U, W]), nn(o, () => ({
89
+ collapse: () => {
90
+ S(D.current);
91
+ },
92
+ expand: (k) => {
93
+ R(D.current, k);
94
+ },
95
+ getId() {
96
+ return _;
97
+ },
98
+ getSize() {
99
+ return M(D.current);
100
+ },
101
+ isCollapsed() {
102
+ return C(D.current);
103
+ },
104
+ isExpanded() {
105
+ return !C(D.current);
106
+ },
107
+ resize: (k) => {
108
+ J(D.current, k);
109
+ }
110
+ }), [S, R, M, C, _, J]);
111
+ const ee = $(D.current, i);
112
+ return de(h, {
113
+ ...E,
114
+ children: e,
115
+ className: n,
116
+ id: _,
117
+ style: {
118
+ ...ee,
119
+ ...x
120
+ },
121
+ // CSS selectors
122
+ [A.groupId]: q,
123
+ [A.panel]: "",
124
+ [A.panelCollapsible]: r || void 0,
125
+ [A.panelId]: _,
126
+ [A.panelSize]: parseFloat("" + ee.flexGrow).toFixed(1)
127
+ });
128
+ }
129
+ const Ln = Qe((e, n) => de(tn, {
130
+ ...e,
131
+ forwardedRef: n
132
+ }));
133
+ tn.displayName = "Panel";
134
+ Ln.displayName = "forwardRef(Panel)";
135
+ let Te = null, we = -1, Z = null;
136
+ function An(e, n, t) {
137
+ const r = (n & an) !== 0, i = (n & un) !== 0, o = (n & cn) !== 0, l = (n & dn) !== 0;
138
+ if (n) {
139
+ if (r)
140
+ return o ? "se-resize" : l ? "ne-resize" : "e-resize";
141
+ if (i)
142
+ return o ? "sw-resize" : l ? "nw-resize" : "w-resize";
143
+ if (o)
144
+ return "s-resize";
145
+ if (l)
146
+ return "n-resize";
147
+ }
148
+ switch (e) {
149
+ case "horizontal":
150
+ return "ew-resize";
151
+ case "intersection":
152
+ return "move";
153
+ case "vertical":
154
+ return "ns-resize";
155
+ }
156
+ }
157
+ function Dn() {
158
+ Z !== null && (document.head.removeChild(Z), Te = null, Z = null, we = -1);
159
+ }
160
+ function $e(e, n, t) {
161
+ var r, i;
162
+ const o = An(e, n);
163
+ if (Te !== o) {
164
+ if (Te = o, Z === null && (Z = document.createElement("style"), document.head.appendChild(Z)), we >= 0) {
165
+ var l;
166
+ (l = Z.sheet) === null || l === void 0 || l.removeRule(we);
167
+ }
168
+ we = (r = (i = Z.sheet) === null || i === void 0 ? void 0 : i.insertRule(`*{cursor: ${o} !important;}`)) !== null && r !== void 0 ? r : -1;
169
+ }
170
+ }
171
+ function rn(e) {
172
+ return e.type === "keydown";
173
+ }
174
+ function on(e) {
175
+ return e.type.startsWith("pointer");
176
+ }
177
+ function ln(e) {
178
+ return e.type.startsWith("mouse");
179
+ }
180
+ function Re(e) {
181
+ if (on(e)) {
182
+ if (e.isPrimary)
183
+ return {
184
+ x: e.clientX,
185
+ y: e.clientY
186
+ };
187
+ } else if (ln(e))
188
+ return {
189
+ x: e.clientX,
190
+ y: e.clientY
191
+ };
192
+ return {
193
+ x: 1 / 0,
194
+ y: 1 / 0
195
+ };
196
+ }
197
+ function Mn() {
198
+ if (typeof matchMedia == "function")
199
+ return matchMedia("(pointer:coarse)").matches ? "coarse" : "fine";
200
+ }
201
+ function Hn(e, n, t) {
202
+ return e.x < n.x + n.width && e.x + e.width > n.x && e.y < n.y + n.height && e.y + e.height > n.y;
203
+ }
204
+ function $n(e, n) {
205
+ if (e === n) throw new Error("Cannot compare node with itself");
206
+ const t = {
207
+ a: Xe(e),
208
+ b: Xe(n)
209
+ };
210
+ let r;
211
+ for (; t.a.at(-1) === t.b.at(-1); )
212
+ e = t.a.pop(), n = t.b.pop(), r = e;
213
+ y(r, "Stacking order can only be calculated for elements with a common ancestor");
214
+ const i = {
215
+ a: qe(Oe(t.a)),
216
+ b: qe(Oe(t.b))
217
+ };
218
+ if (i.a === i.b) {
219
+ const o = r.childNodes, l = {
220
+ a: t.a.at(-1),
221
+ b: t.b.at(-1)
222
+ };
223
+ let s = o.length;
224
+ for (; s--; ) {
225
+ const a = o[s];
226
+ if (a === l.a) return 1;
227
+ if (a === l.b) return -1;
228
+ }
229
+ }
230
+ return Math.sign(i.a - i.b);
231
+ }
232
+ const Nn = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
233
+ function kn(e) {
234
+ var n;
235
+ const t = getComputedStyle((n = sn(e)) !== null && n !== void 0 ? n : e).display;
236
+ return t === "flex" || t === "inline-flex";
237
+ }
238
+ function _n(e) {
239
+ const n = getComputedStyle(e);
240
+ return !!(n.position === "fixed" || n.zIndex !== "auto" && (n.position !== "static" || kn(e)) || +n.opacity < 1 || "transform" in n && n.transform !== "none" || "webkitTransform" in n && n.webkitTransform !== "none" || "mixBlendMode" in n && n.mixBlendMode !== "normal" || "filter" in n && n.filter !== "none" || "webkitFilter" in n && n.webkitFilter !== "none" || "isolation" in n && n.isolation === "isolate" || Nn.test(n.willChange) || n.webkitOverflowScrolling === "touch");
241
+ }
242
+ function Oe(e) {
243
+ let n = e.length;
244
+ for (; n--; ) {
245
+ const t = e[n];
246
+ if (y(t, "Missing node"), _n(t)) return t;
247
+ }
248
+ return null;
249
+ }
250
+ function qe(e) {
251
+ return e && Number(getComputedStyle(e).zIndex) || 0;
252
+ }
253
+ function Xe(e) {
254
+ const n = [];
255
+ for (; e; )
256
+ n.push(e), e = sn(e);
257
+ return n;
258
+ }
259
+ function sn(e) {
260
+ const {
261
+ parentNode: n
262
+ } = e;
263
+ return n && n instanceof ShadowRoot ? n.host : n;
264
+ }
265
+ const an = 1, un = 2, cn = 4, dn = 8, Gn = Mn() === "coarse";
266
+ let O = [], ce = !1, Q = /* @__PURE__ */ new Map(), Le = /* @__PURE__ */ new Map();
267
+ const ve = /* @__PURE__ */ new Set();
268
+ function Tn(e, n, t, r, i) {
269
+ var o;
270
+ const {
271
+ ownerDocument: l
272
+ } = n, s = {
273
+ direction: t,
274
+ element: n,
275
+ hitAreaMargins: r,
276
+ setResizeHandlerState: i
277
+ }, a = (o = Q.get(l)) !== null && o !== void 0 ? o : 0;
278
+ return Q.set(l, a + 1), ve.add(s), Ee(), function() {
279
+ var P;
280
+ Le.delete(e), ve.delete(s);
281
+ const f = (P = Q.get(l)) !== null && P !== void 0 ? P : 1;
282
+ if (Q.set(l, f - 1), Ee(), f === 1 && Q.delete(l), O.includes(s)) {
283
+ const u = O.indexOf(s);
284
+ u >= 0 && O.splice(u, 1), Ae(), i("up", !0, null);
285
+ }
286
+ };
287
+ }
288
+ function Bn(e) {
289
+ const {
290
+ target: n
291
+ } = e, {
292
+ x: t,
293
+ y: r
294
+ } = Re(e);
295
+ ce = !0, We({
296
+ target: n,
297
+ x: t,
298
+ y: r
299
+ }), Ee(), O.length > 0 && (Ie("down", e), Ae(), e.preventDefault(), fn(n) || e.stopImmediatePropagation());
300
+ }
301
+ function Ne(e) {
302
+ const {
303
+ x: n,
304
+ y: t
305
+ } = Re(e);
306
+ if (ce && e.buttons === 0 && (ce = !1, Ie("up", e)), !ce) {
307
+ const {
308
+ target: r
309
+ } = e;
310
+ We({
311
+ target: r,
312
+ x: n,
313
+ y: t
314
+ });
315
+ }
316
+ Ie("move", e), Ae(), O.length > 0 && e.preventDefault();
317
+ }
318
+ function ke(e) {
319
+ const {
320
+ target: n
321
+ } = e, {
322
+ x: t,
323
+ y: r
324
+ } = Re(e);
325
+ Le.clear(), ce = !1, O.length > 0 && (e.preventDefault(), fn(n) || e.stopImmediatePropagation()), Ie("up", e), We({
326
+ target: n,
327
+ x: t,
328
+ y: r
329
+ }), Ae(), Ee();
330
+ }
331
+ function fn(e) {
332
+ let n = e;
333
+ for (; n; ) {
334
+ if (n.hasAttribute(A.resizeHandle))
335
+ return !0;
336
+ n = n.parentElement;
337
+ }
338
+ return !1;
339
+ }
340
+ function We({
341
+ target: e,
342
+ x: n,
343
+ y: t
344
+ }) {
345
+ O.splice(0);
346
+ let r = null;
347
+ (e instanceof HTMLElement || e instanceof SVGElement) && (r = e), ve.forEach((i) => {
348
+ const {
349
+ element: o,
350
+ hitAreaMargins: l
351
+ } = i, s = o.getBoundingClientRect(), {
352
+ bottom: a,
353
+ left: m,
354
+ right: P,
355
+ top: f
356
+ } = s, u = Gn ? l.coarse : l.fine;
357
+ if (n >= m - u && n <= P + u && t >= f - u && t <= a + u) {
358
+ 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
359
+ // That is why we only check potentially intersecting handles,
360
+ // and why we skip if the event target is within the handle's DOM
361
+ $n(r, o) > 0) {
362
+ let h = r, E = !1;
363
+ for (; h && !h.contains(o); ) {
364
+ if (Hn(h.getBoundingClientRect(), s)) {
365
+ E = !0;
366
+ break;
367
+ }
368
+ h = h.parentElement;
369
+ }
370
+ if (E)
371
+ return;
372
+ }
373
+ O.push(i);
374
+ }
375
+ });
376
+ }
377
+ function _e(e, n) {
378
+ Le.set(e, n);
379
+ }
380
+ function Ae() {
381
+ let e = !1, n = !1;
382
+ O.forEach((r) => {
383
+ const {
384
+ direction: i
385
+ } = r;
386
+ i === "horizontal" ? e = !0 : n = !0;
387
+ });
388
+ let t = 0;
389
+ Le.forEach((r) => {
390
+ t |= r;
391
+ }), e && n ? $e("intersection", t) : e ? $e("horizontal", t) : n ? $e("vertical", t) : Dn();
392
+ }
393
+ let Ge;
394
+ function Ee() {
395
+ var e;
396
+ (e = Ge) === null || e === void 0 || e.abort(), Ge = new AbortController();
397
+ const n = {
398
+ capture: !0,
399
+ signal: Ge.signal
400
+ };
401
+ ve.size && (ce ? (O.length > 0 && Q.forEach((t, r) => {
402
+ const {
403
+ body: i
404
+ } = r;
405
+ t > 0 && (i.addEventListener("contextmenu", ke, n), i.addEventListener("pointerleave", Ne, n), i.addEventListener("pointermove", Ne, n));
406
+ }), Q.forEach((t, r) => {
407
+ const {
408
+ body: i
409
+ } = r;
410
+ i.addEventListener("pointerup", ke, n), i.addEventListener("pointercancel", ke, n);
411
+ })) : Q.forEach((t, r) => {
412
+ const {
413
+ body: i
414
+ } = r;
415
+ t > 0 && (i.addEventListener("pointerdown", Bn, n), i.addEventListener("pointermove", Ne, n));
416
+ }));
417
+ }
418
+ function Ie(e, n) {
419
+ ve.forEach((t) => {
420
+ const {
421
+ setResizeHandlerState: r
422
+ } = t, i = O.includes(t);
423
+ r(e, i, n);
424
+ });
425
+ }
426
+ function Fn() {
427
+ const [e, n] = ue(0);
428
+ return B(() => n((t) => t + 1), []);
429
+ }
430
+ function y(e, n) {
431
+ if (!e)
432
+ throw console.error(n), Error(n);
433
+ }
434
+ function oe(e, n, t = Be) {
435
+ return e.toFixed(t) === n.toFixed(t) ? 0 : e > n ? 1 : -1;
436
+ }
437
+ function Y(e, n, t = Be) {
438
+ return oe(e, n, t) === 0;
439
+ }
440
+ function K(e, n, t) {
441
+ return oe(e, n, t) === 0;
442
+ }
443
+ function Wn(e, n, t) {
444
+ if (e.length !== n.length)
445
+ return !1;
446
+ for (let r = 0; r < e.length; r++) {
447
+ const i = e[r], o = n[r];
448
+ if (!K(i, o, t))
449
+ return !1;
450
+ }
451
+ return !0;
452
+ }
453
+ function ae({
454
+ panelConstraints: e,
455
+ panelIndex: n,
456
+ size: t
457
+ }) {
458
+ const r = e[n];
459
+ y(r != null, `Panel constraints not found for index ${n}`);
460
+ let {
461
+ collapsedSize: i = 0,
462
+ collapsible: o,
463
+ maxSize: l = 100,
464
+ minSize: s = 0
465
+ } = r;
466
+ if (oe(t, s) < 0)
467
+ if (o) {
468
+ const a = (i + s) / 2;
469
+ oe(t, a) < 0 ? t = i : t = s;
470
+ } else
471
+ t = s;
472
+ return t = Math.min(l, t), t = parseFloat(t.toFixed(Be)), t;
473
+ }
474
+ function ye({
475
+ delta: e,
476
+ initialLayout: n,
477
+ panelConstraints: t,
478
+ pivotIndices: r,
479
+ prevLayout: i,
480
+ trigger: o
481
+ }) {
482
+ if (K(e, 0))
483
+ return n;
484
+ const l = [...n], [s, a] = r;
485
+ y(s != null, "Invalid first pivot index"), y(a != null, "Invalid second pivot index");
486
+ let m = 0;
487
+ if (o === "keyboard") {
488
+ {
489
+ const f = e < 0 ? a : s, u = t[f];
490
+ y(u, `Panel constraints not found for index ${f}`);
491
+ const {
492
+ collapsedSize: x = 0,
493
+ collapsible: h,
494
+ minSize: E = 0
495
+ } = u;
496
+ if (h) {
497
+ const w = n[f];
498
+ if (y(w != null, `Previous layout not found for panel index ${f}`), K(w, x)) {
499
+ const S = E - w;
500
+ oe(S, Math.abs(e)) > 0 && (e = e < 0 ? 0 - S : S);
501
+ }
502
+ }
503
+ }
504
+ {
505
+ const f = e < 0 ? s : a, u = t[f];
506
+ y(u, `No panel constraints found for index ${f}`);
507
+ const {
508
+ collapsedSize: x = 0,
509
+ collapsible: h,
510
+ minSize: E = 0
511
+ } = u;
512
+ if (h) {
513
+ const w = n[f];
514
+ if (y(w != null, `Previous layout not found for panel index ${f}`), K(w, E)) {
515
+ const S = w - x;
516
+ oe(S, Math.abs(e)) > 0 && (e = e < 0 ? 0 - S : S);
517
+ }
518
+ }
519
+ }
520
+ }
521
+ {
522
+ const f = e < 0 ? 1 : -1;
523
+ let u = e < 0 ? a : s, x = 0;
524
+ for (; ; ) {
525
+ const E = n[u];
526
+ y(E != null, `Previous layout not found for panel index ${u}`);
527
+ const S = ae({
528
+ panelConstraints: t,
529
+ panelIndex: u,
530
+ size: 100
531
+ }) - E;
532
+ if (x += S, u += f, u < 0 || u >= t.length)
533
+ break;
534
+ }
535
+ const h = Math.min(Math.abs(e), Math.abs(x));
536
+ e = e < 0 ? 0 - h : h;
537
+ }
538
+ {
539
+ let u = e < 0 ? s : a;
540
+ for (; u >= 0 && u < t.length; ) {
541
+ const x = Math.abs(e) - Math.abs(m), h = n[u];
542
+ y(h != null, `Previous layout not found for panel index ${u}`);
543
+ const E = h - x, w = ae({
544
+ panelConstraints: t,
545
+ panelIndex: u,
546
+ size: E
547
+ });
548
+ if (!K(h, w) && (m += h - w, l[u] = w, m.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3), void 0, {
549
+ numeric: !0
550
+ }) >= 0))
551
+ break;
552
+ e < 0 ? u-- : u++;
553
+ }
554
+ }
555
+ if (Wn(i, l))
556
+ return i;
557
+ {
558
+ const f = e < 0 ? a : s, u = n[f];
559
+ y(u != null, `Previous layout not found for panel index ${f}`);
560
+ const x = u + m, h = ae({
561
+ panelConstraints: t,
562
+ panelIndex: f,
563
+ size: x
564
+ });
565
+ if (l[f] = h, !K(h, x)) {
566
+ let E = x - h, S = e < 0 ? a : s;
567
+ for (; S >= 0 && S < t.length; ) {
568
+ const R = l[S];
569
+ y(R != null, `Previous layout not found for panel index ${S}`);
570
+ const M = R + E, $ = ae({
571
+ panelConstraints: t,
572
+ panelIndex: S,
573
+ size: M
574
+ });
575
+ if (K(R, $) || (E -= $ - R, l[S] = $), K(E, 0))
576
+ break;
577
+ e > 0 ? S-- : S++;
578
+ }
579
+ }
580
+ }
581
+ const P = l.reduce((f, u) => u + f, 0);
582
+ return K(P, 100) ? l : i;
583
+ }
584
+ function Kn({
585
+ layout: e,
586
+ panelsArray: n,
587
+ pivotIndices: t
588
+ }) {
589
+ let r = 0, i = 100, o = 0, l = 0;
590
+ const s = t[0];
591
+ y(s != null, "No pivot index found"), n.forEach((f, u) => {
592
+ const {
593
+ constraints: x
594
+ } = f, {
595
+ maxSize: h = 100,
596
+ minSize: E = 0
597
+ } = x;
598
+ u === s ? (r = E, i = h) : (o += E, l += h);
599
+ });
600
+ const a = Math.min(i, 100 - o), m = Math.max(r, 100 - l), P = e[s];
601
+ return {
602
+ valueMax: a,
603
+ valueMin: m,
604
+ valueNow: P
605
+ };
606
+ }
607
+ function Se(e, n = document) {
608
+ return Array.from(n.querySelectorAll(`[${A.resizeHandleId}][data-panel-group-id="${e}"]`));
609
+ }
610
+ function pn(e, n, t = document) {
611
+ const i = Se(e, t).findIndex((o) => o.getAttribute(A.resizeHandleId) === n);
612
+ return i ?? null;
613
+ }
614
+ function gn(e, n, t) {
615
+ const r = pn(e, n, t);
616
+ return r != null ? [r, r + 1] : [-1, -1];
617
+ }
618
+ function Un(e) {
619
+ return e instanceof HTMLElement ? !0 : typeof e == "object" && e !== null && "tagName" in e && "getAttribute" in e;
620
+ }
621
+ function mn(e, n = document) {
622
+ if (Un(n) && n.dataset.panelGroupId == e)
623
+ return n;
624
+ const t = n.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);
625
+ return t || null;
626
+ }
627
+ function De(e, n = document) {
628
+ const t = n.querySelector(`[${A.resizeHandleId}="${e}"]`);
629
+ return t || null;
630
+ }
631
+ function Vn(e, n, t, r = document) {
632
+ var i, o, l, s;
633
+ const a = De(n, r), m = Se(e, r), P = a ? m.indexOf(a) : -1, f = (i = (o = t[P]) === null || o === void 0 ? void 0 : o.id) !== null && i !== void 0 ? i : null, u = (l = (s = t[P + 1]) === null || s === void 0 ? void 0 : s.id) !== null && l !== void 0 ? l : null;
634
+ return [f, u];
635
+ }
636
+ function On({
637
+ committedValuesRef: e,
638
+ eagerValuesRef: n,
639
+ groupId: t,
640
+ layout: r,
641
+ panelDataArray: i,
642
+ panelGroupElement: o,
643
+ setLayout: l
644
+ }) {
645
+ F({
646
+ didWarnAboutMissingResizeHandle: !1
647
+ }), re(() => {
648
+ if (!o)
649
+ return;
650
+ const s = Se(t, o);
651
+ for (let a = 0; a < i.length - 1; a++) {
652
+ const {
653
+ valueMax: m,
654
+ valueMin: P,
655
+ valueNow: f
656
+ } = Kn({
657
+ layout: r,
658
+ panelsArray: i,
659
+ pivotIndices: [a, a + 1]
660
+ }), u = s[a];
661
+ if (u != null) {
662
+ const x = i[a];
663
+ y(x, `No panel data found for index "${a}"`), u.setAttribute("aria-controls", x.id), u.setAttribute("aria-valuemax", "" + Math.round(m)), u.setAttribute("aria-valuemin", "" + Math.round(P)), u.setAttribute("aria-valuenow", f != null ? "" + Math.round(f) : "");
664
+ }
665
+ }
666
+ return () => {
667
+ s.forEach((a, m) => {
668
+ a.removeAttribute("aria-controls"), a.removeAttribute("aria-valuemax"), a.removeAttribute("aria-valuemin"), a.removeAttribute("aria-valuenow");
669
+ });
670
+ };
671
+ }, [t, r, i, o]), te(() => {
672
+ if (!o)
673
+ return;
674
+ const s = n.current;
675
+ y(s, "Eager values not found");
676
+ const {
677
+ panelDataArray: a
678
+ } = s, m = mn(t, o);
679
+ y(m != null, `No group found for id "${t}"`);
680
+ const P = Se(t, o);
681
+ y(P, `No resize handles found for group id "${t}"`);
682
+ const f = P.map((u) => {
683
+ const x = u.getAttribute(A.resizeHandleId);
684
+ y(x, "Resize handle element has no handle id attribute");
685
+ const [h, E] = Vn(t, x, a, o);
686
+ if (h == null || E == null)
687
+ return () => {
688
+ };
689
+ const w = (S) => {
690
+ if (!S.defaultPrevented)
691
+ switch (S.key) {
692
+ case "Enter": {
693
+ S.preventDefault();
694
+ const R = a.findIndex((M) => M.id === h);
695
+ if (R >= 0) {
696
+ const M = a[R];
697
+ y(M, `No panel data found for index ${R}`);
698
+ const $ = r[R], {
699
+ collapsedSize: q = 0,
700
+ collapsible: C,
701
+ minSize: b = 0
702
+ } = M.constraints;
703
+ if ($ != null && C) {
704
+ const U = ye({
705
+ delta: K($, q) ? b - q : q - $,
706
+ initialLayout: r,
707
+ panelConstraints: a.map((J) => J.constraints),
708
+ pivotIndices: gn(t, x, o),
709
+ prevLayout: r,
710
+ trigger: "keyboard"
711
+ });
712
+ r !== U && l(U);
713
+ }
714
+ }
715
+ break;
716
+ }
717
+ }
718
+ };
719
+ return u.addEventListener("keydown", w), () => {
720
+ u.removeEventListener("keydown", w);
721
+ };
722
+ });
723
+ return () => {
724
+ f.forEach((u) => u());
725
+ };
726
+ }, [o, e, n, t, r, i, l]);
727
+ }
728
+ function je(e, n) {
729
+ if (e.length !== n.length)
730
+ return !1;
731
+ for (let t = 0; t < e.length; t++)
732
+ if (e[t] !== n[t])
733
+ return !1;
734
+ return !0;
735
+ }
736
+ function hn(e, n) {
737
+ const t = e === "horizontal", {
738
+ x: r,
739
+ y: i
740
+ } = Re(n);
741
+ return t ? r : i;
742
+ }
743
+ function qn(e, n, t, r, i) {
744
+ const o = t === "horizontal", l = De(n, i);
745
+ y(l, `No resize handle element found for id "${n}"`);
746
+ const s = l.getAttribute(A.groupId);
747
+ y(s, "Resize handle element has no group id attribute");
748
+ let {
749
+ initialCursorPosition: a
750
+ } = r;
751
+ const m = hn(t, e), P = mn(s, i);
752
+ y(P, `No group element found for id "${s}"`);
753
+ const f = P.getBoundingClientRect(), u = o ? f.width : f.height;
754
+ return (m - a) / u * 100;
755
+ }
756
+ function Xn(e, n, t, r, i, o) {
757
+ if (rn(e)) {
758
+ const l = t === "horizontal";
759
+ let s = 0;
760
+ e.shiftKey ? s = 100 : i != null ? s = i : s = 10;
761
+ let a = 0;
762
+ switch (e.key) {
763
+ case "ArrowDown":
764
+ a = l ? 0 : s;
765
+ break;
766
+ case "ArrowLeft":
767
+ a = l ? -s : 0;
768
+ break;
769
+ case "ArrowRight":
770
+ a = l ? s : 0;
771
+ break;
772
+ case "ArrowUp":
773
+ a = l ? 0 : -s;
774
+ break;
775
+ case "End":
776
+ a = 100;
777
+ break;
778
+ case "Home":
779
+ a = -100;
780
+ break;
781
+ }
782
+ return a;
783
+ } else
784
+ return r == null ? 0 : qn(e, n, t, r, o);
785
+ }
786
+ function jn({
787
+ panelDataArray: e
788
+ }) {
789
+ const n = Array(e.length), t = e.map((o) => o.constraints);
790
+ let r = 0, i = 100;
791
+ for (let o = 0; o < e.length; o++) {
792
+ const l = t[o];
793
+ y(l, `Panel constraints not found for index ${o}`);
794
+ const {
795
+ defaultSize: s
796
+ } = l;
797
+ s != null && (r++, n[o] = s, i -= s);
798
+ }
799
+ for (let o = 0; o < e.length; o++) {
800
+ const l = t[o];
801
+ y(l, `Panel constraints not found for index ${o}`);
802
+ const {
803
+ defaultSize: s
804
+ } = l;
805
+ if (s != null)
806
+ continue;
807
+ const a = e.length - r, m = i / a;
808
+ r++, n[o] = m, i -= m;
809
+ }
810
+ return n;
811
+ }
812
+ function le(e, n, t) {
813
+ n.forEach((r, i) => {
814
+ const o = e[i];
815
+ y(o, `Panel data not found for index ${i}`);
816
+ const {
817
+ callbacks: l,
818
+ constraints: s,
819
+ id: a
820
+ } = o, {
821
+ collapsedSize: m = 0,
822
+ collapsible: P
823
+ } = s, f = t[a];
824
+ if (f == null || r !== f) {
825
+ t[a] = r;
826
+ const {
827
+ onCollapse: u,
828
+ onExpand: x,
829
+ onResize: h
830
+ } = l;
831
+ h && h(r, f), P && (u || x) && (x && (f == null || Y(f, m)) && !Y(r, m) && x(), u && (f == null || !Y(f, m)) && Y(r, m) && u());
832
+ }
833
+ });
834
+ }
835
+ function Pe(e, n) {
836
+ if (e.length !== n.length)
837
+ return !1;
838
+ for (let t = 0; t < e.length; t++)
839
+ if (e[t] != n[t])
840
+ return !1;
841
+ return !0;
842
+ }
843
+ function Jn({
844
+ defaultSize: e,
845
+ dragState: n,
846
+ layout: t,
847
+ panelData: r,
848
+ panelIndex: i,
849
+ precision: o = 3
850
+ }) {
851
+ const l = t[i];
852
+ let s;
853
+ return l == null ? s = e != null ? e.toPrecision(o) : "1" : r.length === 1 ? s = "1" : s = l.toPrecision(o), {
854
+ flexBasis: 0,
855
+ flexGrow: s,
856
+ flexShrink: 1,
857
+ // Without this, Panel sizes may be unintentionally overridden by their content
858
+ overflow: "hidden",
859
+ // Disable pointer events inside of a panel during resize
860
+ // This avoid edge cases like nested iframes
861
+ pointerEvents: n !== null ? "none" : void 0
862
+ };
863
+ }
864
+ function Yn(e, n = 10) {
865
+ let t = null;
866
+ return (...i) => {
867
+ t !== null && clearTimeout(t), t = setTimeout(() => {
868
+ e(...i);
869
+ }, n);
870
+ };
871
+ }
872
+ function Je(e) {
873
+ try {
874
+ if (typeof localStorage < "u")
875
+ e.getItem = (n) => localStorage.getItem(n), e.setItem = (n, t) => {
876
+ localStorage.setItem(n, t);
877
+ };
878
+ else
879
+ throw new Error("localStorage not supported in this environment");
880
+ } catch (n) {
881
+ console.error(n), e.getItem = () => null, e.setItem = () => {
882
+ };
883
+ }
884
+ }
885
+ function zn(e) {
886
+ return `react-resizable-panels:${e}`;
887
+ }
888
+ function yn(e) {
889
+ return e.map((n) => {
890
+ const {
891
+ constraints: t,
892
+ id: r,
893
+ idIsFromProps: i,
894
+ order: o
895
+ } = n;
896
+ return i ? r : o ? `${o}:${JSON.stringify(t)}` : JSON.stringify(t);
897
+ }).sort((n, t) => n.localeCompare(t)).join(",");
898
+ }
899
+ function xn(e, n) {
900
+ try {
901
+ const t = zn(e), r = n.getItem(t);
902
+ if (r) {
903
+ const i = JSON.parse(r);
904
+ if (typeof i == "object" && i != null)
905
+ return i;
906
+ }
907
+ } catch {
908
+ }
909
+ return null;
910
+ }
911
+ function Zn(e, n, t) {
912
+ var r, i;
913
+ const o = (r = xn(e, t)) !== null && r !== void 0 ? r : {}, l = yn(n);
914
+ return (i = o[l]) !== null && i !== void 0 ? i : null;
915
+ }
916
+ function Qn(e, n, t, r, i) {
917
+ var o;
918
+ const l = zn(e), s = yn(n), a = (o = xn(e, i)) !== null && o !== void 0 ? o : {};
919
+ a[s] = {
920
+ expandToSizes: Object.fromEntries(t.entries()),
921
+ layout: r
922
+ };
923
+ try {
924
+ i.setItem(l, JSON.stringify(a));
925
+ } catch (m) {
926
+ console.error(m);
927
+ }
928
+ }
929
+ function Ye({
930
+ layout: e,
931
+ panelConstraints: n
932
+ }) {
933
+ const t = [...e], r = t.reduce((o, l) => o + l, 0);
934
+ if (t.length !== n.length)
935
+ throw Error(`Invalid ${n.length} panel layout: ${t.map((o) => `${o}%`).join(", ")}`);
936
+ if (!K(r, 100) && t.length > 0)
937
+ for (let o = 0; o < n.length; o++) {
938
+ const l = t[o];
939
+ y(l != null, `No layout data found for index ${o}`);
940
+ const s = 100 / r * l;
941
+ t[o] = s;
942
+ }
943
+ let i = 0;
944
+ for (let o = 0; o < n.length; o++) {
945
+ const l = t[o];
946
+ y(l != null, `No layout data found for index ${o}`);
947
+ const s = ae({
948
+ panelConstraints: n,
949
+ panelIndex: o,
950
+ size: l
951
+ });
952
+ l != s && (i += l - s, t[o] = s);
953
+ }
954
+ if (!K(i, 0))
955
+ for (let o = 0; o < n.length; o++) {
956
+ const l = t[o];
957
+ y(l != null, `No layout data found for index ${o}`);
958
+ const s = l + i, a = ae({
959
+ panelConstraints: n,
960
+ panelIndex: o,
961
+ size: s
962
+ });
963
+ if (l !== a && (i -= a - l, t[o] = a, K(i, 0)))
964
+ break;
965
+ }
966
+ return t;
967
+ }
968
+ const et = 100, xe = {
969
+ getItem: (e) => (Je(xe), xe.getItem(e)),
970
+ setItem: (e, n) => {
971
+ Je(xe), xe.setItem(e, n);
972
+ }
973
+ }, Ze = {};
974
+ function vn({
975
+ autoSaveId: e = null,
976
+ children: n,
977
+ className: t = "",
978
+ direction: r,
979
+ forwardedRef: i,
980
+ id: o = null,
981
+ onLayout: l = null,
982
+ keyboardResizeBy: s = null,
983
+ storage: a = xe,
984
+ style: m,
985
+ tagName: P = "div",
986
+ ...f
987
+ }) {
988
+ const u = Fe(o), x = F(null), [h, E] = ue(null), [w, S] = ue([]), R = Fn(), M = F({}), $ = F(/* @__PURE__ */ new Map()), q = F(0), C = F({
989
+ autoSaveId: e,
990
+ direction: r,
991
+ dragState: h,
992
+ id: u,
993
+ keyboardResizeBy: s,
994
+ onLayout: l,
995
+ storage: a
996
+ }), b = F({
997
+ layout: w,
998
+ panelDataArray: [],
999
+ panelDataArrayChanged: !1
1000
+ });
1001
+ F({
1002
+ didLogIdAndOrderWarning: !1,
1003
+ didLogPanelConstraintsWarning: !1,
1004
+ prevPanelIds: []
1005
+ }), nn(i, () => ({
1006
+ getId: () => C.current.id,
1007
+ getLayout: () => {
1008
+ const {
1009
+ layout: c
1010
+ } = b.current;
1011
+ return c;
1012
+ },
1013
+ setLayout: (c) => {
1014
+ const {
1015
+ onLayout: g
1016
+ } = C.current, {
1017
+ layout: v,
1018
+ panelDataArray: p
1019
+ } = b.current, d = Ye({
1020
+ layout: c,
1021
+ panelConstraints: p.map((z) => z.constraints)
1022
+ });
1023
+ je(v, d) || (S(d), b.current.layout = d, g && g(d), le(p, d, M.current));
1024
+ }
1025
+ }), []), re(() => {
1026
+ C.current.autoSaveId = e, C.current.direction = r, C.current.dragState = h, C.current.id = u, C.current.onLayout = l, C.current.storage = a;
1027
+ }), On({
1028
+ committedValuesRef: C,
1029
+ eagerValuesRef: b,
1030
+ groupId: u,
1031
+ layout: w,
1032
+ panelDataArray: b.current.panelDataArray,
1033
+ setLayout: S,
1034
+ panelGroupElement: x.current
1035
+ }), te(() => {
1036
+ const {
1037
+ panelDataArray: c
1038
+ } = b.current;
1039
+ if (e) {
1040
+ if (w.length === 0 || w.length !== c.length)
1041
+ return;
1042
+ let g = Ze[e];
1043
+ g == null && (g = Yn(Qn, et), Ze[e] = g);
1044
+ const v = [...c], p = new Map($.current);
1045
+ g(e, v, p, w, a);
1046
+ }
1047
+ }, [e, w, a]), te(() => {
1048
+ });
1049
+ const U = B((c) => {
1050
+ const {
1051
+ onLayout: g
1052
+ } = C.current, {
1053
+ layout: v,
1054
+ panelDataArray: p
1055
+ } = b.current;
1056
+ if (c.constraints.collapsible) {
1057
+ const d = p.map((X) => X.constraints), {
1058
+ collapsedSize: z = 0,
1059
+ panelSize: I,
1060
+ pivotIndices: H
1061
+ } = ne(p, c, v);
1062
+ if (y(I != null, `Panel size not found for panel "${c.id}"`), !Y(I, z)) {
1063
+ $.current.set(c.id, I);
1064
+ const j = se(p, c) === p.length - 1 ? I - z : z - I, L = ye({
1065
+ delta: j,
1066
+ initialLayout: v,
1067
+ panelConstraints: d,
1068
+ pivotIndices: H,
1069
+ prevLayout: v,
1070
+ trigger: "imperative-api"
1071
+ });
1072
+ Pe(v, L) || (S(L), b.current.layout = L, g && g(L), le(p, L, M.current));
1073
+ }
1074
+ }
1075
+ }, []), J = B((c, g) => {
1076
+ const {
1077
+ onLayout: v
1078
+ } = C.current, {
1079
+ layout: p,
1080
+ panelDataArray: d
1081
+ } = b.current;
1082
+ if (c.constraints.collapsible) {
1083
+ const z = d.map((V) => V.constraints), {
1084
+ collapsedSize: I = 0,
1085
+ panelSize: H = 0,
1086
+ minSize: X = 0,
1087
+ pivotIndices: j
1088
+ } = ne(d, c, p), L = g ?? X;
1089
+ if (Y(H, I)) {
1090
+ const V = $.current.get(c.id), he = V != null && V >= L ? V : L, He = se(d, c) === d.length - 1 ? H - he : he - H, T = ye({
1091
+ delta: He,
1092
+ initialLayout: p,
1093
+ panelConstraints: z,
1094
+ pivotIndices: j,
1095
+ prevLayout: p,
1096
+ trigger: "imperative-api"
1097
+ });
1098
+ Pe(p, T) || (S(T), b.current.layout = T, v && v(T), le(d, T, M.current));
1099
+ }
1100
+ }
1101
+ }, []), W = B((c) => {
1102
+ const {
1103
+ layout: g,
1104
+ panelDataArray: v
1105
+ } = b.current, {
1106
+ panelSize: p
1107
+ } = ne(v, c, g);
1108
+ return y(p != null, `Panel size not found for panel "${c.id}"`), p;
1109
+ }, []), _ = B((c, g) => {
1110
+ const {
1111
+ panelDataArray: v
1112
+ } = b.current, p = se(v, c);
1113
+ return Jn({
1114
+ defaultSize: g,
1115
+ dragState: h,
1116
+ layout: w,
1117
+ panelData: v,
1118
+ panelIndex: p
1119
+ });
1120
+ }, [h, w]), D = B((c) => {
1121
+ const {
1122
+ layout: g,
1123
+ panelDataArray: v
1124
+ } = b.current, {
1125
+ collapsedSize: p = 0,
1126
+ collapsible: d,
1127
+ panelSize: z
1128
+ } = ne(v, c, g);
1129
+ return y(z != null, `Panel size not found for panel "${c.id}"`), d === !0 && Y(z, p);
1130
+ }, []), ee = B((c) => {
1131
+ const {
1132
+ layout: g,
1133
+ panelDataArray: v
1134
+ } = b.current, {
1135
+ collapsedSize: p = 0,
1136
+ collapsible: d,
1137
+ panelSize: z
1138
+ } = ne(v, c, g);
1139
+ return y(z != null, `Panel size not found for panel "${c.id}"`), !d || oe(z, p) > 0;
1140
+ }, []), k = B((c) => {
1141
+ const {
1142
+ panelDataArray: g
1143
+ } = b.current;
1144
+ g.push(c), g.sort((v, p) => {
1145
+ const d = v.order, z = p.order;
1146
+ return d == null && z == null ? 0 : d == null ? -1 : z == null ? 1 : d - z;
1147
+ }), b.current.panelDataArrayChanged = !0, R();
1148
+ }, [R]);
1149
+ re(() => {
1150
+ if (b.current.panelDataArrayChanged) {
1151
+ b.current.panelDataArrayChanged = !1;
1152
+ const {
1153
+ autoSaveId: c,
1154
+ onLayout: g,
1155
+ storage: v
1156
+ } = C.current, {
1157
+ layout: p,
1158
+ panelDataArray: d
1159
+ } = b.current;
1160
+ let z = null;
1161
+ if (c) {
1162
+ const H = Zn(c, d, v);
1163
+ H && ($.current = new Map(Object.entries(H.expandToSizes)), z = H.layout);
1164
+ }
1165
+ z == null && (z = jn({
1166
+ panelDataArray: d
1167
+ }));
1168
+ const I = Ye({
1169
+ layout: z,
1170
+ panelConstraints: d.map((H) => H.constraints)
1171
+ });
1172
+ je(p, I) || (S(I), b.current.layout = I, g && g(I), le(d, I, M.current));
1173
+ }
1174
+ }), re(() => {
1175
+ const c = b.current;
1176
+ return () => {
1177
+ c.layout = [];
1178
+ };
1179
+ }, []);
1180
+ const N = B((c) => {
1181
+ let g = !1;
1182
+ const v = x.current;
1183
+ return v && window.getComputedStyle(v, null).getPropertyValue("direction") === "rtl" && (g = !0), function(d) {
1184
+ d.preventDefault();
1185
+ const z = x.current;
1186
+ if (!z)
1187
+ return () => null;
1188
+ const {
1189
+ direction: I,
1190
+ dragState: H,
1191
+ id: X,
1192
+ keyboardResizeBy: j,
1193
+ onLayout: L
1194
+ } = C.current, {
1195
+ layout: V,
1196
+ panelDataArray: he
1197
+ } = b.current, {
1198
+ initialLayout: be
1199
+ } = H ?? {}, He = gn(X, c, z);
1200
+ let T = Xn(d, c, I, H, j, z);
1201
+ const Ke = I === "horizontal";
1202
+ Ke && g && (T = -T);
1203
+ const Sn = he.map((bn) => bn.constraints), ze = ye({
1204
+ delta: T,
1205
+ initialLayout: be ?? V,
1206
+ panelConstraints: Sn,
1207
+ pivotIndices: He,
1208
+ prevLayout: V,
1209
+ trigger: rn(d) ? "keyboard" : "mouse-or-touch"
1210
+ }), Ue = !Pe(V, ze);
1211
+ (on(d) || ln(d)) && q.current != T && (q.current = T, !Ue && T !== 0 ? Ke ? _e(c, T < 0 ? an : un) : _e(c, T < 0 ? cn : dn) : _e(c, 0)), Ue && (S(ze), b.current.layout = ze, L && L(ze), le(he, ze, M.current));
1212
+ };
1213
+ }, []), G = B((c, g) => {
1214
+ const {
1215
+ onLayout: v
1216
+ } = C.current, {
1217
+ layout: p,
1218
+ panelDataArray: d
1219
+ } = b.current, z = d.map((V) => V.constraints), {
1220
+ panelSize: I,
1221
+ pivotIndices: H
1222
+ } = ne(d, c, p);
1223
+ y(I != null, `Panel size not found for panel "${c.id}"`);
1224
+ const j = se(d, c) === d.length - 1 ? I - g : g - I, L = ye({
1225
+ delta: j,
1226
+ initialLayout: p,
1227
+ panelConstraints: z,
1228
+ pivotIndices: H,
1229
+ prevLayout: p,
1230
+ trigger: "imperative-api"
1231
+ });
1232
+ Pe(p, L) || (S(L), b.current.layout = L, v && v(L), le(d, L, M.current));
1233
+ }, []), fe = B((c, g) => {
1234
+ const {
1235
+ layout: v,
1236
+ panelDataArray: p
1237
+ } = b.current, {
1238
+ collapsedSize: d = 0,
1239
+ collapsible: z
1240
+ } = g, {
1241
+ collapsedSize: I = 0,
1242
+ collapsible: H,
1243
+ maxSize: X = 100,
1244
+ minSize: j = 0
1245
+ } = c.constraints, {
1246
+ panelSize: L
1247
+ } = ne(p, c, v);
1248
+ L != null && (z && H && Y(L, d) ? Y(d, I) || G(c, I) : L < j ? G(c, j) : L > X && G(c, X));
1249
+ }, [G]), pe = B((c, g) => {
1250
+ const {
1251
+ direction: v
1252
+ } = C.current, {
1253
+ layout: p
1254
+ } = b.current;
1255
+ if (!x.current)
1256
+ return;
1257
+ const d = De(c, x.current);
1258
+ y(d, `Drag handle element not found for id "${c}"`);
1259
+ const z = hn(v, g);
1260
+ E({
1261
+ dragHandleId: c,
1262
+ dragHandleRect: d.getBoundingClientRect(),
1263
+ initialCursorPosition: z,
1264
+ initialLayout: p
1265
+ });
1266
+ }, []), ge = B(() => {
1267
+ E(null);
1268
+ }, []), Me = B((c) => {
1269
+ const {
1270
+ panelDataArray: g
1271
+ } = b.current, v = se(g, c);
1272
+ v >= 0 && (g.splice(v, 1), delete M.current[c.id], b.current.panelDataArrayChanged = !0, R());
1273
+ }, [R]), ie = In(() => ({
1274
+ collapsePanel: U,
1275
+ direction: r,
1276
+ dragState: h,
1277
+ expandPanel: J,
1278
+ getPanelSize: W,
1279
+ getPanelStyle: _,
1280
+ groupId: u,
1281
+ isPanelCollapsed: D,
1282
+ isPanelExpanded: ee,
1283
+ reevaluatePanelConstraints: fe,
1284
+ registerPanel: k,
1285
+ registerResizeHandle: N,
1286
+ resizePanel: G,
1287
+ startDragging: pe,
1288
+ stopDragging: ge,
1289
+ unregisterPanel: Me,
1290
+ panelGroupElement: x.current
1291
+ }), [U, h, r, J, W, _, u, D, ee, fe, k, N, G, pe, ge, Me]), me = {
1292
+ display: "flex",
1293
+ flexDirection: r === "horizontal" ? "row" : "column",
1294
+ height: "100%",
1295
+ overflow: "hidden",
1296
+ width: "100%"
1297
+ };
1298
+ return de(Ce.Provider, {
1299
+ value: ie
1300
+ }, de(P, {
1301
+ ...f,
1302
+ children: n,
1303
+ className: t,
1304
+ id: o,
1305
+ ref: x,
1306
+ style: {
1307
+ ...me,
1308
+ ...m
1309
+ },
1310
+ // CSS selectors
1311
+ [A.group]: "",
1312
+ [A.groupDirection]: r,
1313
+ [A.groupId]: u
1314
+ }));
1315
+ }
1316
+ const nt = Qe((e, n) => de(vn, {
1317
+ ...e,
1318
+ forwardedRef: n
1319
+ }));
1320
+ vn.displayName = "PanelGroup";
1321
+ nt.displayName = "forwardRef(PanelGroup)";
1322
+ function se(e, n) {
1323
+ return e.findIndex((t) => t === n || t.id === n.id);
1324
+ }
1325
+ function ne(e, n, t) {
1326
+ const r = se(e, n), o = r === e.length - 1 ? [r - 1, r] : [r, r + 1], l = t[r];
1327
+ return {
1328
+ ...n.constraints,
1329
+ panelSize: l,
1330
+ pivotIndices: o
1331
+ };
1332
+ }
1333
+ function tt({
1334
+ disabled: e,
1335
+ handleId: n,
1336
+ resizeHandler: t,
1337
+ panelGroupElement: r
1338
+ }) {
1339
+ te(() => {
1340
+ if (e || t == null || r == null)
1341
+ return;
1342
+ const i = De(n, r);
1343
+ if (i == null)
1344
+ return;
1345
+ const o = (l) => {
1346
+ if (!l.defaultPrevented)
1347
+ switch (l.key) {
1348
+ case "ArrowDown":
1349
+ case "ArrowLeft":
1350
+ case "ArrowRight":
1351
+ case "ArrowUp":
1352
+ case "End":
1353
+ case "Home": {
1354
+ l.preventDefault(), t(l);
1355
+ break;
1356
+ }
1357
+ case "F6": {
1358
+ l.preventDefault();
1359
+ const s = i.getAttribute(A.groupId);
1360
+ y(s, `No group element found for id "${s}"`);
1361
+ const a = Se(s, r), m = pn(s, n, r);
1362
+ y(m !== null, `No resize element found for id "${n}"`);
1363
+ const P = l.shiftKey ? m > 0 ? m - 1 : a.length - 1 : m + 1 < a.length ? m + 1 : 0;
1364
+ a[P].focus();
1365
+ break;
1366
+ }
1367
+ }
1368
+ };
1369
+ return i.addEventListener("keydown", o), () => {
1370
+ i.removeEventListener("keydown", o);
1371
+ };
1372
+ }, [r, e, n, t]);
1373
+ }
1374
+ function rt({
1375
+ children: e = null,
1376
+ className: n = "",
1377
+ disabled: t = !1,
1378
+ hitAreaMargins: r,
1379
+ id: i,
1380
+ onBlur: o,
1381
+ onClick: l,
1382
+ onDragging: s,
1383
+ onFocus: a,
1384
+ onPointerDown: m,
1385
+ onPointerUp: P,
1386
+ style: f = {},
1387
+ tabIndex: u = 0,
1388
+ tagName: x = "div",
1389
+ ...h
1390
+ }) {
1391
+ var E, w;
1392
+ const S = F(null), R = F({
1393
+ onClick: l,
1394
+ onDragging: s,
1395
+ onPointerDown: m,
1396
+ onPointerUp: P
1397
+ });
1398
+ te(() => {
1399
+ R.current.onClick = l, R.current.onDragging = s, R.current.onPointerDown = m, R.current.onPointerUp = P;
1400
+ });
1401
+ const M = en(Ce);
1402
+ if (M === null)
1403
+ throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");
1404
+ const {
1405
+ direction: $,
1406
+ groupId: q,
1407
+ registerResizeHandle: C,
1408
+ startDragging: b,
1409
+ stopDragging: U,
1410
+ panelGroupElement: J
1411
+ } = M, W = Fe(i), [_, D] = ue("inactive"), [ee, k] = ue(!1), [N, G] = ue(null), fe = F({
1412
+ state: _
1413
+ });
1414
+ re(() => {
1415
+ fe.current.state = _;
1416
+ }), te(() => {
1417
+ if (t)
1418
+ G(null);
1419
+ else {
1420
+ const ie = C(W);
1421
+ G(() => ie);
1422
+ }
1423
+ }, [t, W, C]);
1424
+ const pe = (E = r?.coarse) !== null && E !== void 0 ? E : 15, ge = (w = r?.fine) !== null && w !== void 0 ? w : 5;
1425
+ return te(() => {
1426
+ if (t || N == null)
1427
+ return;
1428
+ const ie = S.current;
1429
+ y(ie, "Element ref not attached");
1430
+ let me = !1;
1431
+ return Tn(W, ie, $, {
1432
+ coarse: pe,
1433
+ fine: ge
1434
+ }, (g, v, p) => {
1435
+ if (!v) {
1436
+ D("inactive");
1437
+ return;
1438
+ }
1439
+ switch (g) {
1440
+ case "down": {
1441
+ D("drag"), me = !1, y(p, 'Expected event to be defined for "down" action'), b(W, p);
1442
+ const {
1443
+ onDragging: d,
1444
+ onPointerDown: z
1445
+ } = R.current;
1446
+ d?.(!0), z?.();
1447
+ break;
1448
+ }
1449
+ case "move": {
1450
+ const {
1451
+ state: d
1452
+ } = fe.current;
1453
+ me = !0, d !== "drag" && D("hover"), y(p, 'Expected event to be defined for "move" action'), N(p);
1454
+ break;
1455
+ }
1456
+ case "up": {
1457
+ D("hover"), U();
1458
+ const {
1459
+ onClick: d,
1460
+ onDragging: z,
1461
+ onPointerUp: I
1462
+ } = R.current;
1463
+ z?.(!1), I?.(), me || d?.();
1464
+ break;
1465
+ }
1466
+ }
1467
+ });
1468
+ }, [pe, $, t, ge, C, W, N, b, U]), tt({
1469
+ disabled: t,
1470
+ handleId: W,
1471
+ resizeHandler: N,
1472
+ panelGroupElement: J
1473
+ }), de(x, {
1474
+ ...h,
1475
+ children: e,
1476
+ className: n,
1477
+ id: i,
1478
+ onBlur: () => {
1479
+ k(!1), o?.();
1480
+ },
1481
+ onFocus: () => {
1482
+ k(!0), a?.();
1483
+ },
1484
+ ref: S,
1485
+ role: "separator",
1486
+ style: {
1487
+ ...{
1488
+ touchAction: "none",
1489
+ userSelect: "none"
1490
+ },
1491
+ ...f
1492
+ },
1493
+ tabIndex: u,
1494
+ // CSS selectors
1495
+ [A.groupDirection]: $,
1496
+ [A.groupId]: q,
1497
+ [A.resizeHandle]: "",
1498
+ [A.resizeHandleActive]: _ === "drag" ? "pointer" : ee ? "keyboard" : void 0,
1499
+ [A.resizeHandleEnabled]: !t,
1500
+ [A.resizeHandleId]: W,
1501
+ [A.resizeHandleState]: _
1502
+ });
1503
+ }
1504
+ rt.displayName = "PanelResizeHandle";
1505
+ export {
1506
+ nt as P,
1507
+ Ln as a,
1508
+ rt as b
1509
+ };