@archbase/layout 3.0.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.
package/dist/index.js ADDED
@@ -0,0 +1,1977 @@
1
+ import { Menu as at, ActionIcon as Zt } from "@mantine/core";
2
+ import { Card as gi, Container as bi, Group as pi, Stack as zi } from "@mantine/core";
3
+ import { jsx as c, jsxs as G, Fragment as Nt } from "react/jsx-runtime";
4
+ import * as d from "prop-types";
5
+ import * as M from "react";
6
+ import J, { useRef as it, useState as V, useEffect as et, useMemo as kt, useCallback as Gt } from "react";
7
+ import { ResizeSensor as Yt } from "css-element-queries";
8
+ import { useWindowSize as Kt } from "usehooks-ts";
9
+ import { useArchbaseTranslation as Ht } from "@archbase/core";
10
+ import { useElementSize as Qt } from "@mantine/hooks";
11
+ import { Split as Bt } from "@gfazioli/mantine-split-pane";
12
+ import { IconPinnedOff as te, IconPinned as ee } from "@tabler/icons-react";
13
+ import { DockviewReact as ie } from "dockview-react";
14
+ function ei({ children: t }) {
15
+ return /* @__PURE__ */ c("form", { children: t });
16
+ }
17
+ var A = /* @__PURE__ */ ((t) => (t.ViewPort = "viewport", t.Fixed = "fixed", t.Fill = "fill", t.Positioned = "positioned", t.Anchored = "anchored", t.Custom = "custom", t))(A || {}), C = /* @__PURE__ */ ((t) => (t.Left = "anchor-left", t.Right = "anchor-right", t.Top = "anchor-top", t.Bottom = "anchor-bottom", t))(C || {}), mt = /* @__PURE__ */ ((t) => (t[t.Horizontal = 0] = "Horizontal", t[t.Vertical = 1] = "Vertical", t))(mt || {}), p = /* @__PURE__ */ ((t) => (t.All = "resize-all", t.Left = "resize-left", t.Right = "resize-right", t.Top = "resize-top", t.Bottom = "resize-bottom", t.TopLeft = "resize-topleft", t.TopRight = "resize-topright", t.BottomLeft = "resize-bottomleft", t.BottomRight = "resize-bottomright", t))(p || {}), rt = /* @__PURE__ */ ((t) => (t.OverlayInside = "overlay-inside", t.Inside = "inside", t.OverlayBoundary = "overlay-boundary", t))(rt || {}), st = /* @__PURE__ */ ((t) => (t.None = "none", t.Vertical = "vertical", t.HorizontalVertical = "horizontalVertical", t))(st || {}), zt = /* @__PURE__ */ ((t) => (t.Mouse = "mousemove", t.Touch = "touchmove", t))(zt || {}), wt = /* @__PURE__ */ ((t) => (t.Mouse = "mouseup", t.Touch = "touchend", t))(wt || {});
18
+ function oe(t, ...i) {
19
+ const o = /* @__PURE__ */ Object.create(null);
20
+ i.forEach((f) => {
21
+ o[f] = !0;
22
+ });
23
+ const n = /* @__PURE__ */ Object.create(null);
24
+ return Object.keys(t).forEach((f) => {
25
+ o[f] || (n[f] = t[f]);
26
+ }), n;
27
+ }
28
+ function ne() {
29
+ let t = Math.random() * 46656 | 0, i = Math.random() * 46656 | 0;
30
+ return ("000" + t.toString(36)).slice(-3) + ("000" + i.toString(36)).slice(-3);
31
+ }
32
+ function $t(t) {
33
+ return typeof t == "string" ? t : `${t}px`;
34
+ }
35
+ function v(t, i) {
36
+ if (t.size === 0 && t.adjusted.length === 0 && t.resized === 0)
37
+ return "0px";
38
+ const o = [];
39
+ if (t.size !== void 0 && o.push($t(t.size)), t.adjusted.forEach((n) => o.push($t(n))), t.resized !== 0 && o.push($t(t.resized)), o.length !== 0)
40
+ return o.length === 1 ? o[0] : i ? o.join(" + ") : `calc(${o.join(" + ")})`;
41
+ }
42
+ function Z(...t) {
43
+ return t.find((i) => i != null);
44
+ }
45
+ function Ct(t, i) {
46
+ if (t.length !== i.length)
47
+ return !1;
48
+ for (var o = 0, n = t.length; o < n; o++)
49
+ if (t[o] !== i[o])
50
+ return !1;
51
+ return !0;
52
+ }
53
+ function re(t, i) {
54
+ var o = !1;
55
+ return function(...n) {
56
+ o || (t(...n), o = !0, setTimeout(function() {
57
+ o = !1;
58
+ }, i));
59
+ };
60
+ }
61
+ function se(t) {
62
+ const i = [], o = {
63
+ position: t.position,
64
+ left: v(t.left),
65
+ top: v(t.top),
66
+ right: v(t.right),
67
+ bottom: v(t.bottom),
68
+ width: v(t.width),
69
+ height: v(t.height),
70
+ zIndex: t.zIndex
71
+ }, n = [];
72
+ o.position && n.push(`position: ${o.position};`), o.left && n.push(`left: ${o.left};`), o.top && n.push(`top: ${o.top};`), o.right && n.push(`right: ${o.right};`), o.bottom && n.push(`bottom: ${o.bottom};`), o.width && n.push(`width: ${o.width};`), o.height && n.push(`height: ${o.height};`), o.zIndex && n.push(`z-index: ${o.zIndex};`), t.allowOverflow && n.push("overflow: visible;"), n.length > 0 && i.push(`#${t.id} { ${n.join(" ")} }`), t.scrollable && i.push(`#${t.id} > .spaces-space-inner { overflow: auto; touch-action: auto; }`);
73
+ let f = 0;
74
+ const h = `${t.handleSize}px`, s = `-${t.touchHandleSize / 2 - t.handleSize / 2}px`, y = `${t.touchHandleSize / 2 - t.handleSize / 2}px`;
75
+ switch (t.handlePlacement) {
76
+ case rt.Inside:
77
+ case rt.OverlayInside:
78
+ f = t.handleSize, t.type === A.Positioned && (f = 0);
79
+ break;
80
+ case rt.OverlayBoundary:
81
+ f = t.handleSize / 2;
82
+ break;
83
+ }
84
+ const e = `${f}px`, a = (r, g) => {
85
+ const u = [];
86
+ g.left && u.push(`left: ${g.left}`), g.top && u.push(`top: ${g.top}`), g.right && u.push(`right: ${g.right}`), g.bottom && u.push(`bottom: ${g.bottom}`), g.width && u.push(`width: ${g.width}`), g.height && u.push(`height: ${g.height}`), i.push(`#${t.id}-${r} { ${u.join("; ")}}`);
87
+ }, b = () => t.type === A.Positioned ? t.width.size && t.height.size : t.orientation == mt.Horizontal ? t.width.size : t.height.size;
88
+ return t.canResizeLeft && (t.anchor ? a("ml", {
89
+ right: `calc(${v(t.right, !0)} + ${v(t.width)} - ${e})`,
90
+ top: "0",
91
+ bottom: "0",
92
+ width: h
93
+ }) : a("ml", {
94
+ left: `calc(${v(t.left, !0)} - ${e})`,
95
+ top: v(t.top),
96
+ bottom: v(t.bottom),
97
+ width: h,
98
+ height: v(t.height)
99
+ }), a("ml:after", {
100
+ left: s,
101
+ right: s,
102
+ top: s,
103
+ bottom: s
104
+ })), t.canResizeTop && (t.anchor ? (a("mt", {
105
+ left: "0",
106
+ right: "0",
107
+ bottom: `calc(${v(t.bottom)} + ${v(t.height)} - ${e})`,
108
+ height: h
109
+ }), a("mt:after", {
110
+ top: s,
111
+ bottom: s,
112
+ left: s,
113
+ width: v(t.width),
114
+ right: s
115
+ })) : (a("mt", {
116
+ top: `calc(${v(t.top, !0)} - ${e})`,
117
+ left: v(t.left),
118
+ right: v(t.right),
119
+ width: v(t.width),
120
+ height: h
121
+ }), b() ? a("mt:after", {
122
+ top: s,
123
+ bottom: s,
124
+ left: s,
125
+ width: `calc(${v(t.width, !0)} - ${e}) + ${y}`,
126
+ right: s
127
+ }) : a("mt:after", {
128
+ top: s,
129
+ bottom: s,
130
+ left: s,
131
+ width: v(t.width),
132
+ right: s
133
+ }))), t.canResizeRight && (b() ? a("mr", {
134
+ left: `calc(${v(t.left, !0)} + ${v(t.width, !0)} - ${h} + ${e})`,
135
+ top: v(t.top),
136
+ bottom: v(t.bottom),
137
+ width: h,
138
+ height: v(t.height)
139
+ }) : a("mr", {
140
+ right: `calc(${v(t.right, !0)} - ${e})`,
141
+ top: v(t.top),
142
+ bottom: v(t.bottom),
143
+ width: h,
144
+ height: v(t.height)
145
+ }), a("mr:after", {
146
+ left: s,
147
+ right: s,
148
+ top: s,
149
+ bottom: s
150
+ })), t.canResizeBottom && (b() ? a("mb", {
151
+ top: `calc(${v(t.top, !0)} + ${v(t.height, !0)} - ${h} + ${e})`,
152
+ left: v(t.left),
153
+ right: v(t.right),
154
+ width: v(t.width),
155
+ height: h
156
+ }) : a("mb", {
157
+ bottom: `calc(${v(t.bottom, !0)} - ${e})`,
158
+ left: v(t.left),
159
+ right: v(t.right),
160
+ width: v(t.width),
161
+ height: h
162
+ }), a("mb:after", {
163
+ top: s,
164
+ bottom: s,
165
+ left: s,
166
+ right: s
167
+ })), t.canResizeTopLeft && (a("mtl", {
168
+ left: `calc(${v(t.left, !0)} - ${e})`,
169
+ top: v(t.top),
170
+ width: h,
171
+ height: h
172
+ }), a("mtl:after", {
173
+ top: s,
174
+ bottom: s,
175
+ left: s,
176
+ right: s
177
+ })), t.canResizeTopRight && (b() ? a("mtr", {
178
+ left: `calc(${v(t.left, !0)} + ${v(t.width, !0)} - ${h} + ${e})`,
179
+ top: v(t.top),
180
+ width: h,
181
+ height: h
182
+ }) : a("mtr", {
183
+ right: `calc(${v(t.right, !0)} - ${e})`,
184
+ top: v(t.top),
185
+ width: h,
186
+ height: h
187
+ }), a("mtr:after", {
188
+ top: s,
189
+ bottom: s,
190
+ left: s,
191
+ right: s
192
+ })), t.canResizeBottomLeft && (b() ? a("mbl", {
193
+ top: `calc(${v(t.top, !0)} + ${v(t.height, !0)} - ${h} + ${e})`,
194
+ left: v(t.left),
195
+ width: h,
196
+ height: h
197
+ }) : a("mbl", {
198
+ bottom: `calc(${v(t.bottom, !0)} - ${e})`,
199
+ left: v(t.left),
200
+ width: h,
201
+ height: h
202
+ }), a("mbl:after", {
203
+ top: s,
204
+ bottom: s,
205
+ left: s,
206
+ right: s
207
+ })), t.canResizeBottomRight && (b() ? a("mbr", {
208
+ left: `calc(${v(t.left, !0)} + ${v(t.width, !0)} - ${h} + ${e})`,
209
+ top: `calc(${v(t.top, !0)} + ${v(t.height, !0)} - ${h} + ${e})`,
210
+ width: h,
211
+ height: h
212
+ }) : a("mbr", {
213
+ right: `calc(${v(t.right, !0)} - ${e})`,
214
+ bottom: `calc(${v(t.bottom, !0)} - ${e})`,
215
+ width: h,
216
+ height: h
217
+ }), a("mbr:after", {
218
+ top: s,
219
+ bottom: s,
220
+ left: s,
221
+ right: s
222
+ })), i.join(" ");
223
+ }
224
+ function Rt(t) {
225
+ const i = se(t);
226
+ if (Wt())
227
+ t.ssrStyle = i;
228
+ else {
229
+ const o = document.getElementById(`style_${t.id}`);
230
+ if (o)
231
+ o.innerHTML !== i && (o.innerHTML = i);
232
+ else {
233
+ const n = document.createElement("style");
234
+ n.id = `style_${t.id}`, n.innerHTML = i, document.head.appendChild(n);
235
+ }
236
+ }
237
+ }
238
+ function le(t) {
239
+ const i = document.getElementById(`style_${t.id}`);
240
+ i && document.head.removeChild(i);
241
+ }
242
+ function Wt() {
243
+ return !(typeof document < "u" && document);
244
+ }
245
+ function vt(t) {
246
+ return t === p.Left || t === p.Right;
247
+ }
248
+ function Q(t, i, o, n, f, h) {
249
+ const s = i === p.Right || i === p.Bottom ? (u) => -u : (u) => u, y = vt(i) ? n.width : n.height, e = o.resized, a = y.resized, b = vt(i) ? t.width : t.height, r = Z(n.minimumSize, 20) - b + 0, g = n.maximumSize ? n.maximumSize - b + 0 : void 0;
250
+ return (u, z) => {
251
+ let l = (vt(i) ? f : h) - (vt(i) ? u : z), m = s(l);
252
+ n.type !== A.Positioned && (m = Math.max(s(l), r), m < r && (m = r), typeof g == "number" && m > g && (m = g)), o.size !== void 0 ? (o.resized = s(-l) + e, y.size && (y.resized = s(l) + a)) : y.resized = m + a;
253
+ };
254
+ }
255
+ function ae(t, i, o, n) {
256
+ const f = i.element.getBoundingClientRect();
257
+ switch (t) {
258
+ case p.Left:
259
+ return Q(f, t, i.left, i, o, n);
260
+ case p.Right:
261
+ return Q(f, t, i.right, i, o, n);
262
+ case p.Bottom:
263
+ return Q(f, t, i.bottom, i, o, n);
264
+ case p.Top:
265
+ return Q(f, t, i.top, i, o, n);
266
+ case p.TopLeft:
267
+ const h = Q(f, p.Top, i.top, i, o, n), s = Q(f, p.Left, i.left, i, o, n);
268
+ return (u, z) => {
269
+ h(u, z), s(u, z);
270
+ };
271
+ case p.TopRight:
272
+ const y = Q(f, p.Top, i.top, i, o, n), e = Q(f, p.Right, i.right, i, o, n);
273
+ return (u, z) => {
274
+ y(u, z), e(u, z);
275
+ };
276
+ case p.BottomLeft:
277
+ const a = Q(f, p.Bottom, i.bottom, i, o, n), b = Q(f, p.Left, i.left, i, o, n);
278
+ return (u, z) => {
279
+ a(u, z), b(u, z);
280
+ };
281
+ case p.BottomRight:
282
+ const r = Q(f, p.Bottom, i.bottom, i, o, n), g = Q(f, p.Right, i.right, i, o, n);
283
+ return (u, z) => {
284
+ r(u, z), g(u, z);
285
+ };
286
+ default:
287
+ throw `Resize type ${t} not supported`;
288
+ }
289
+ }
290
+ function de(t) {
291
+ return {
292
+ startResize(i, o, n, f, h, s, y) {
293
+ if (n.onResizeStart) {
294
+ const m = n.onResizeStart(o);
295
+ if (typeof m == "boolean" && !m)
296
+ return;
297
+ }
298
+ const e = s(i), a = ae(o, n, e.x, e.y);
299
+ n.resizing = !0, n.updateParent();
300
+ let b = 0, r = 0, g = !1;
301
+ const u = (m, R) => {
302
+ a(m, R), t.updateStyles(n);
303
+ }, z = (m) => {
304
+ g = !0;
305
+ const R = s(m);
306
+ b = R.x, r = R.y, m.preventDefault(), window.requestAnimationFrame(() => {
307
+ n.resizing && u(b, r);
308
+ });
309
+ }, l = () => {
310
+ n.resizing = !1, g && u(b, r), window.removeEventListener(h, z), window.removeEventListener(f, l), n.updateParent();
311
+ const m = y || n.onResizeEnd;
312
+ if (m) {
313
+ const R = n.element.getBoundingClientRect();
314
+ m(Math.floor(vt(o) ? R.width : R.height), R, o);
315
+ }
316
+ };
317
+ window.addEventListener(h, z), window.addEventListener(f, l);
318
+ }
319
+ };
320
+ }
321
+ function ce(t) {
322
+ function i(o, n, f, h, s) {
323
+ const y = -(n - h), e = -(f - s);
324
+ o.left.adjusted = [y], o.top.adjusted = [e], o.right.size && (o.right.adjusted = [-y]), o.bottom.size && (o.bottom.adjusted = [-e]), t.updateStyles(o);
325
+ }
326
+ return {
327
+ startDrag(o, n, f, h, s, y) {
328
+ if (n.element) {
329
+ const e = s(o), a = n.left.adjusted.length === 0 ? 0 : n.left.adjusted[0], b = n.top.adjusted.length === 0 ? 0 : n.top.adjusted[0], r = e.x - a, g = e.y - b;
330
+ let u = 0, z = 0, l = !1;
331
+ const m = (I, B) => i(n, r, g, I, B), R = re(m, 5), S = (I) => {
332
+ l = !0;
333
+ const B = s(I);
334
+ u = B.x, z = B.y, I.preventDefault(), R(u, z);
335
+ }, w = () => {
336
+ if (l && m(u, z), window.removeEventListener(h, S), window.removeEventListener(f, w), y) {
337
+ const I = n.parentId && t.getSpace(n.parentId)?.element.getBoundingClientRect() || {
338
+ left: 0,
339
+ top: 0
340
+ }, B = (({ left: P, top: x, right: T, bottom: _, width: k, height: N }) => ({ left: P, top: x, right: T, bottom: _, width: k, height: N }))(
341
+ n.element.getBoundingClientRect()
342
+ );
343
+ y(
344
+ {
345
+ ...B,
346
+ left: B.left - I.left,
347
+ top: B.top - I.top
348
+ },
349
+ l
350
+ );
351
+ }
352
+ };
353
+ window.addEventListener(h, S), window.addEventListener(f, w);
354
+ }
355
+ }
356
+ };
357
+ }
358
+ const bt = {
359
+ id: "",
360
+ zIndex: 0,
361
+ scrollable: !1,
362
+ resizing: !1,
363
+ allowOverflow: !1,
364
+ centerContent: "none",
365
+ dimension: { left: 0, top: 0, right: 0, bottom: 0, width: 0, height: 0, x: 0, y: 0, toJSON: () => "" },
366
+ handleSize: 5,
367
+ touchHandleSize: 5,
368
+ handlePlacement: rt.OverlayInside,
369
+ adjustLeft: () => !1,
370
+ adjustRight: () => !1,
371
+ adjustTop: () => !1,
372
+ adjustBottom: () => !1,
373
+ adjustEdge: () => !1,
374
+ anchoredChildren: () => []
375
+ }, he = [C.Left, C.Top, C.Right, C.Bottom];
376
+ function Et(t) {
377
+ return t === A.ViewPort ? "fixed" : t === A.Fixed ? "relative" : "absolute";
378
+ }
379
+ function Pt(t) {
380
+ return t === C.Bottom || t === C.Top ? mt.Vertical : mt.Horizontal;
381
+ }
382
+ function ue(t) {
383
+ return [
384
+ {
385
+ anchor: C.Left,
386
+ update: t.adjustLeft
387
+ },
388
+ {
389
+ anchor: C.Top,
390
+ update: t.adjustTop
391
+ },
392
+ {
393
+ anchor: C.Right,
394
+ update: t.adjustRight
395
+ },
396
+ {
397
+ anchor: C.Bottom,
398
+ update: t.adjustBottom
399
+ }
400
+ ];
401
+ }
402
+ function ut(t) {
403
+ return { size: t, adjusted: [], resized: 0 };
404
+ }
405
+ function fe() {
406
+ let t = [];
407
+ const i = (e) => {
408
+ t = e;
409
+ }, o = (e) => n().find((a) => a.id === e), n = () => t, f = (e) => {
410
+ const a = (z, l, m) => m.indexOf(z) === l, r = ((z) => {
411
+ let l = [];
412
+ return he.forEach((m) => {
413
+ const R = z.filter((w) => w.anchor !== void 0 && w.anchor === m);
414
+ R.map((w) => w.zIndex).filter(a).forEach((w) => {
415
+ const I = R.filter((T) => T.zIndex === w), B = I.filter((T) => T.order !== void 0), P = I.filter((T) => T.order === void 0);
416
+ var x = B.length > 0 ? B.map((T) => T.order).reduce((T, _) => Math.max(T, _)) : 0;
417
+ l = [...l, ...B, ...P.map((T, _) => ({ ...T, order: x + _ + 1 }))];
418
+ });
419
+ }), [...l, ...z.filter((m) => m.anchor === void 0)];
420
+ })(e.children);
421
+ for (var g = 0, u = r.length; g < u; g++) {
422
+ const z = r[g];
423
+ let l = !1;
424
+ if (z.type === A.Fill)
425
+ ue(z).forEach((m) => {
426
+ const R = [];
427
+ e.anchoredChildren(r, m.anchor, z.zIndex).forEach((w) => {
428
+ w.orientation === mt.Vertical ? (w.height.size && R.push(w.height.size), w.height.resized && R.push(w.height.resized)) : (w.width.size && R.push(w.width.size), w.width.resized && R.push(w.width.resized));
429
+ }), m.update(R) && (l = !0);
430
+ });
431
+ else if (z.type === A.Anchored) {
432
+ const m = [];
433
+ e.anchoredChildren(r, z.anchor, z.zIndex).filter((S) => S.id !== z.id && S.order <= z.order).forEach((S) => {
434
+ S.orientation === mt.Vertical ? (S.height.size && m.push(S.height.size), S.height.resized && m.push(S.height.resized)) : (S.width.size && m.push(S.width.size), S.width.resized && m.push(S.width.resized));
435
+ }), z.adjustEdge(m) && (l = !0);
436
+ }
437
+ l && Rt(z);
438
+ }
439
+ }, h = {
440
+ getSpaces: n,
441
+ getSpace: o,
442
+ addSpace: (e) => {
443
+ if (n().push(e), e.parentId) {
444
+ const a = o(e.parentId);
445
+ a && (a.children.push(e), f(a));
446
+ }
447
+ Rt(e);
448
+ },
449
+ removeSpace: (e) => {
450
+ if (i(n().filter((a) => a.id !== e.id)), e.parentId) {
451
+ const a = o(e.parentId);
452
+ a && (a.children = a.children.filter((b) => b.id !== e.id), f(a));
453
+ }
454
+ le(e);
455
+ },
456
+ updateStyles: (e) => {
457
+ if (e.parentId) {
458
+ const a = o(e.parentId);
459
+ a && f(a);
460
+ }
461
+ Rt(e);
462
+ },
463
+ updateSpace: (e, a) => {
464
+ const {
465
+ type: b,
466
+ anchor: r,
467
+ order: g,
468
+ zIndex: u,
469
+ scrollable: z,
470
+ position: l,
471
+ centerContent: m,
472
+ minimumSize: R,
473
+ maximumSize: S,
474
+ handleSize: w,
475
+ touchHandleSize: I,
476
+ handlePlacement: B,
477
+ allowOverflow: P
478
+ } = a, x = l && l.leftResizable || !1, T = l && l.rightResizable || !1, _ = l && l.topResizable || !1, k = l && l.bottomResizable || !1, N = l && l.topLeftResizable || !1, q = l && l.topRightResizable || !1, D = l && l.bottomLeftResizable || !1, ot = l && l.bottomRightResizable || !1;
479
+ let L = !1;
480
+ if (e.type !== b && (e.type = b, e.position = Et(b), L = !0), e.anchor !== r && (e.anchor = r, e.orientation = Pt(r), L = !0, b === A.Anchored && (r === C.Left ? e.adjustEdge = e.adjustLeft : r === C.Top ? e.adjustEdge = e.adjustTop : r === C.Right ? e.adjustEdge = e.adjustRight : r === C.Bottom && (e.adjustEdge = e.adjustBottom))), e.left.size !== (l && l.left) && (e.left.size = l && l.left, e.left.resized = 0, e.left.adjusted = [], L = !0), e.right.size !== (l && l.right) && (e.right.size = l && l.right, e.right.resized = 0, e.right.adjusted = [], L = !0), e.top.size !== (l && l.top) && (e.top.size = l && l.top, e.top.resized = 0, e.top.adjusted = [], L = !0), e.bottom.size !== (l && l.bottom) && (e.bottom.size = l && l.bottom, e.bottom.resized = 0, e.bottom.adjusted = [], L = !0), e.width.size !== (l && l.width) && (e.width.size = l && l.width, e.width.resized = 0, e.width.adjusted = [], L = !0), e.height.size !== (l && l.height) && (e.height.size = l && l.height, e.height.resized = 0, e.height.adjusted = [], L = !0), Z(e.order, 0) !== Z(g, 0) && (e.order = Z(g, 0), L = !0), Z(e.zIndex, 0) !== Z(u, 0) && (e.zIndex = Z(u, 0), L = !0), Z(e.scrollable, !1) !== Z(z, !1) && (e.scrollable = Z(z, !1), L = !0), e.minimumSize !== R && (e.minimumSize = R, L = !0), e.maximumSize !== S && (e.maximumSize = S, L = !0), Z(e.centerContent, st.None) !== Z(m, st.None) && (e.centerContent = Z(m, st.None), L = !0), e.handleSize !== w && (e.handleSize = w || bt.handleSize, L = !0), e.touchHandleSize !== I && (e.touchHandleSize = I || bt.touchHandleSize, L = !0), e.handlePlacement !== B && (e.handlePlacement = B || bt.handlePlacement, L = !0), e.canResizeBottom !== k && (e.canResizeBottom = k, L = !0), e.canResizeTop !== _ && (e.canResizeTop = _, L = !0), e.canResizeLeft !== x && (e.canResizeLeft = x, L = !0), e.canResizeRight !== T && (e.canResizeRight = T, L = !0), e.canResizeTopLeft !== N && (e.canResizeTopLeft = N, L = !0), e.canResizeTopRight !== q && (e.canResizeTopRight = q, L = !0), e.canResizeBottomLeft !== D && (e.canResizeBottomLeft = D, L = !0), e.canResizeBottomRight !== ot && (e.canResizeBottomRight = ot, L = !0), e.allowOverflow !== P && (e.allowOverflow = P || bt.allowOverflow, L = !0), L) {
481
+ if (e.parentId) {
482
+ const F = o(e.parentId);
483
+ F && f(F);
484
+ }
485
+ Rt(e);
486
+ }
487
+ },
488
+ createSpace: () => ({}),
489
+ startMouseResize: () => null,
490
+ startTouchResize: () => null,
491
+ startMouseDrag: () => null,
492
+ startTouchDrag: () => null
493
+ }, s = de(h), y = ce(h);
494
+ return h.createSpace = (e, a, b) => {
495
+ const { position: r, anchor: g, type: u, ...z } = a, l = r && r.rightResizable || !1, m = r && r.leftResizable || !1, R = r && r.bottomResizable || !1, S = r && r.topResizable || !1, w = r && r.topLeftResizable || !1, I = r && r.topRightResizable || !1, B = r && r.bottomLeftResizable || !1, P = r && r.bottomRightResizable || !1, x = {
496
+ ...bt,
497
+ ...z,
498
+ store: h,
499
+ update: b,
500
+ updateParent: () => {
501
+ if (e) {
502
+ const T = h.getSpace(e);
503
+ T && T.update();
504
+ }
505
+ },
506
+ parentId: e,
507
+ children: [],
508
+ anchor: g,
509
+ type: u,
510
+ orientation: Pt(g),
511
+ position: Et(u),
512
+ left: ut(r && r.left),
513
+ right: ut(r && r.right),
514
+ top: ut(r && r.top),
515
+ bottom: ut(r && r.bottom),
516
+ width: ut(r && r.width),
517
+ height: ut(r && r.height),
518
+ canResizeLeft: l,
519
+ canResizeRight: m,
520
+ canResizeTop: R,
521
+ canResizeBottom: S,
522
+ canResizeTopLeft: w,
523
+ canResizeTopRight: I,
524
+ canResizeBottomLeft: B,
525
+ canResizeBottomRight: P
526
+ };
527
+ return x.anchoredChildren = (T, _, k) => T.filter((N) => N.type === A.Anchored && N.anchor === _ && N.zIndex === k), x.adjustLeft = (T) => Ct(x.left.adjusted, T) ? !1 : (x.left.adjusted = T, !0), x.adjustRight = (T) => Ct(x.right.adjusted, T) ? !1 : (x.right.adjusted = T, !0), x.adjustTop = (T) => Ct(x.top.adjusted, T) ? !1 : (x.top.adjusted = T, !0), x.adjustBottom = (T) => Ct(x.bottom.adjusted, T) ? !1 : (x.bottom.adjusted = T, !0), u === A.Anchored && (g === C.Left ? x.adjustEdge = x.adjustLeft : g === C.Top ? x.adjustEdge = x.adjustTop : g === C.Right ? x.adjustEdge = x.adjustRight : g === C.Bottom && (x.adjustEdge = x.adjustBottom)), x;
528
+ }, h.startMouseResize = (e, a, b, r) => {
529
+ s.startResize(
530
+ b,
531
+ e,
532
+ a,
533
+ wt.Mouse,
534
+ zt.Mouse,
535
+ (g) => ({
536
+ x: g.clientX,
537
+ y: g.clientY
538
+ }),
539
+ r
540
+ );
541
+ }, h.startTouchResize = (e, a, b, r) => {
542
+ s.startResize(
543
+ b,
544
+ e,
545
+ a,
546
+ wt.Touch,
547
+ zt.Touch,
548
+ (g) => ({
549
+ x: g.touches[0].clientX,
550
+ y: g.touches[0].clientY
551
+ }),
552
+ r
553
+ );
554
+ }, h.startMouseDrag = (e, a, b) => {
555
+ y.startDrag(
556
+ a,
557
+ e,
558
+ wt.Mouse,
559
+ zt.Mouse,
560
+ (r) => ({
561
+ x: r.clientX,
562
+ y: r.clientY
563
+ }),
564
+ b
565
+ );
566
+ }, h.startTouchDrag = (e, a, b) => {
567
+ y.startDrag(
568
+ a,
569
+ e,
570
+ wt.Touch,
571
+ zt.Touch,
572
+ (r) => ({
573
+ x: r.touches[0].clientX,
574
+ y: r.touches[0].clientY
575
+ }),
576
+ b
577
+ );
578
+ }, h;
579
+ }
580
+ const Ft = (t) => {
581
+ const i = it(void 0), o = it(!1), n = it(!1), [f, h] = V(0);
582
+ o.current && (n.current = !0), et(() => (o.current || (i.current = t(), o.current = !0), h((s) => s + 1), () => {
583
+ n.current && i.current && i.current();
584
+ }), []);
585
+ }, jt = M.createContext(void 0), Ot = M.createContext(void 0), At = M.createContext(void 0), Vt = M.createContext({}), qt = fe(), yt = {
586
+ id: d.string,
587
+ className: d.string,
588
+ style: d.oneOfType([d.object, d.array]),
589
+ as: d.any,
590
+ centerContent: d.oneOf([st.None, st.Vertical, st.HorizontalVertical]),
591
+ zIndex: d.number,
592
+ scrollable: d.bool,
593
+ trackSize: d.bool,
594
+ allowOverflow: d.bool,
595
+ handleRender: d.func,
596
+ onClick: d.func,
597
+ onDoubleClick: d.func,
598
+ onMouseDown: d.func,
599
+ onMouseEnter: d.func,
600
+ onMouseLeave: d.func,
601
+ onMouseMove: d.func,
602
+ onTouchStart: d.func,
603
+ onTouchMove: d.func,
604
+ onTouchEnd: d.func
605
+ };
606
+ function me() {
607
+ const [, t] = M.useState(0);
608
+ return M.useCallback(() => {
609
+ t((i) => i + 1);
610
+ }, []);
611
+ }
612
+ function Ut() {
613
+ if (ft) {
614
+ if (M.version && M.version.startsWith("18"))
615
+ return `s${M.useId().replace(/\:/g, "")}`;
616
+ if (typeof M.useId == "function")
617
+ return `s${M.useId().replace(/\:/g, "")}`;
618
+ }
619
+ return `s${ne()}`;
620
+ }
621
+ function ge(t) {
622
+ const i = qt, o = me(), n = M.useContext(jt), f = M.useContext(At), { debug: h } = M.useContext(Vt), s = Ut(), [y] = M.useState(t.id || s), e = M.useRef(null), a = M.useRef(void 0), [b, r] = M.useState();
623
+ let g = i.getSpace(y);
624
+ h && console.table(i.getSpaces());
625
+ const u = {
626
+ ...t,
627
+ id: y,
628
+ zIndex: Z(t.zIndex, f)
629
+ };
630
+ g ? i.updateSpace(g, u) : (g = i.createSpace(n, u, o), i.addSpace(g));
631
+ const z = pe(i, g);
632
+ return Ft(() => {
633
+ const l = e.current ? e.current.getBoundingClientRect() : new DOMRect();
634
+ return g.dimension = {
635
+ ...l,
636
+ left: Math.floor(l.left),
637
+ top: Math.floor(l.top),
638
+ right: Math.floor(l.right),
639
+ bottom: Math.floor(l.bottom),
640
+ width: Math.floor(l.width),
641
+ height: Math.floor(l.height),
642
+ x: Math.floor(l.x),
643
+ y: Math.floor(l.y)
644
+ }, r(g.dimension), t.trackSize && (a.current = new Yt(e.current, (m) => {
645
+ g.dimension = {
646
+ ...l,
647
+ width: Math.floor(m.width),
648
+ height: Math.floor(m.height)
649
+ }, r(g.dimension);
650
+ })), () => {
651
+ a.current && a.current.detach(), i.removeSpace(g);
652
+ };
653
+ }), { space: g, resizeHandles: z, domRect: b, elementRef: e };
654
+ }
655
+ const be = [
656
+ { id: "ml", className: "resize-left", resizeType: p.Left, condition: (t) => t.canResizeLeft },
657
+ { id: "mr", className: "resize-right", resizeType: p.Right, condition: (t) => t.canResizeRight },
658
+ { id: "mt", className: "resize-top", resizeType: p.Top, condition: (t) => t.canResizeTop },
659
+ { id: "mb", className: "resize-bottom", resizeType: p.Bottom, condition: (t) => t.canResizeBottom },
660
+ { id: "mtl", className: "resize-top-left", resizeType: p.TopLeft, condition: (t) => t.canResizeTopLeft },
661
+ { id: "mtr", className: "resize-top-right", resizeType: p.TopRight, condition: (t) => t.canResizeTopRight },
662
+ {
663
+ id: "mbl",
664
+ className: "resize-bottom-left",
665
+ resizeType: p.BottomLeft,
666
+ condition: (t) => t.canResizeBottomLeft
667
+ },
668
+ {
669
+ id: "mbr",
670
+ className: "resize-bottom-right",
671
+ resizeType: p.BottomRight,
672
+ condition: (t) => t.canResizeBottomRight
673
+ }
674
+ ];
675
+ function pe(t, i) {
676
+ const o = [], n = (f, h, s) => {
677
+ o.push({
678
+ id: `${i.id}-${f}`,
679
+ key: f,
680
+ className: `spaces-resize-handle ${h}`,
681
+ onMouseDown: (y) => t.startMouseResize(s, i, y),
682
+ onTouchStart: (y) => t.startTouchResize(s, i, y)
683
+ });
684
+ };
685
+ return be.forEach((f) => {
686
+ f.condition(i) && n(f.id, f.className, f.resizeType);
687
+ }), {
688
+ mouseHandles: o
689
+ };
690
+ }
691
+ function ii() {
692
+ const t = qt, i = M.useContext(jt), o = i ? t.getSpace(i) : void 0, n = M.useContext(Ot), f = M.useContext(At), h = M.useCallback(
693
+ (b, r) => o ? t.startMouseDrag(o, b, r) : null,
694
+ [i]
695
+ ), s = M.useCallback(
696
+ (b, r) => o ? t.startTouchDrag(o, b, r) : null,
697
+ [i]
698
+ ), y = M.useCallback(() => o ? t.updateStyles(o) : null, [i]);
699
+ return {
700
+ size: {
701
+ ...{ width: 0, height: 0, x: 0, y: 0 },
702
+ ...n
703
+ },
704
+ layer: f || 0,
705
+ startMouseDrag: h,
706
+ startTouchDrag: s,
707
+ forceUpdate: y
708
+ };
709
+ }
710
+ let ft = !1;
711
+ function oi() {
712
+ ft = !0;
713
+ }
714
+ const ze = (t) => /* @__PURE__ */ c("div", { className: "spaces-centered", children: t.children }), we = (t) => /* @__PURE__ */ c("div", { className: "spaces-centered-vertically", children: t.children });
715
+ function Re(t, i) {
716
+ switch (i) {
717
+ case st.Vertical:
718
+ return /* @__PURE__ */ c(we, { children: t });
719
+ case st.HorizontalVertical:
720
+ return /* @__PURE__ */ c(ze, { children: t });
721
+ }
722
+ return t;
723
+ }
724
+ class K extends M.Component {
725
+ _react_spaces_uniqueid;
726
+ render() {
727
+ return /* @__PURE__ */ c(ve, { ...this.props, wrapperInstance: this });
728
+ }
729
+ }
730
+ const ve = (t) => {
731
+ let i = t.id ?? t.wrapperInstance._react_spaces_uniqueid;
732
+ const [o, n] = M.useState(!!ft), f = Ut();
733
+ i || (t.wrapperInstance._react_spaces_uniqueid = f, i = t.wrapperInstance._react_spaces_uniqueid);
734
+ const {
735
+ style: h,
736
+ className: s,
737
+ onClick: y,
738
+ onDoubleClick: e,
739
+ onMouseDown: a,
740
+ onMouseEnter: b,
741
+ onMouseLeave: r,
742
+ onMouseMove: g,
743
+ onTouchStart: u,
744
+ onTouchMove: z,
745
+ onTouchEnd: l,
746
+ children: m,
747
+ handleRender: R
748
+ } = t, S = {
749
+ onClick: y,
750
+ onDoubleClick: e,
751
+ onMouseDown: a,
752
+ onMouseEnter: b,
753
+ onMouseLeave: r,
754
+ onMouseMove: g,
755
+ onTouchStart: u,
756
+ onTouchMove: z,
757
+ onTouchEnd: l
758
+ }, { space: w, domRect: I, elementRef: B, resizeHandles: P } = ge({
759
+ ...t,
760
+ id: i
761
+ });
762
+ if (ft && !Wt()) {
763
+ const D = document.getElementById(`style_${i}_ssr`);
764
+ D && (w.ssrStyle = D.innerHTML), Rt(w);
765
+ }
766
+ Ft(() => {
767
+ w.element = B.current, ft && o && n(!1);
768
+ });
769
+ const x = s ? s.split(" ").map((D) => D.trim()) : [], T = [
770
+ "spaces-space",
771
+ w.children.find((D) => D.resizing) ? "spaces-resizing" : void 0,
772
+ w.type === A.Fixed ? "spaces-fixedsize-layout" : void 0,
773
+ w.type === A.ViewPort ? "spaces-fullpage-layout" : void 0,
774
+ ...x.map((D) => `${D}-container`)
775
+ ].filter((D) => D), _ = ["spaces-space-inner", ...x];
776
+ let k = h;
777
+ w.handlePlacement === rt.Inside && (k = {
778
+ ...h,
779
+ left: w.anchor === C.Right ? w.handleSize : void 0,
780
+ right: w.anchor === C.Left ? w.handleSize : void 0,
781
+ top: w.anchor === C.Bottom ? w.handleSize : void 0,
782
+ bottom: w.anchor === C.Top ? w.handleSize : void 0
783
+ });
784
+ const N = Re(m, t.centerContent), q = {
785
+ id: w.id,
786
+ ref: B,
787
+ className: T.join(" "),
788
+ ...S
789
+ };
790
+ return /* @__PURE__ */ G(Nt, { children: [
791
+ P.mouseHandles.map((D) => R?.(D) || /* @__PURE__ */ c("div", { ...D })),
792
+ ft && w.ssrStyle && o && /* @__PURE__ */ c("style", { id: `style_${w.id}_ssr`, children: w.ssrStyle }),
793
+ M.createElement(
794
+ t.as || "div",
795
+ q,
796
+ /* @__PURE__ */ c("div", { className: _.join(" "), style: k, children: /* @__PURE__ */ c(jt.Provider, { value: w.id, children: /* @__PURE__ */ c(At.Provider, { value: void 0, children: /* @__PURE__ */ c(Ot.Provider, { value: I, children: N }) }) }) })
797
+ )
798
+ ] });
799
+ }, St = {
800
+ ...yt,
801
+ size: d.oneOfType([d.string, d.number]).isRequired,
802
+ order: d.number,
803
+ handleSize: d.number,
804
+ touchHandleSize: d.number,
805
+ handlePlacement: d.oneOf([
806
+ rt.Inside,
807
+ rt.OverlayBoundary,
808
+ rt.OverlayInside
809
+ ]),
810
+ handleRender: d.func,
811
+ minimumSize: d.number,
812
+ maximumSize: d.number,
813
+ onResizeStart: d.func,
814
+ onResizeEnd: d.func
815
+ }, Tt = {
816
+ ...St,
817
+ resizable: d.bool
818
+ }, ye = ({ children: t, size: i, ...o }) => /* @__PURE__ */ c(
819
+ K,
820
+ {
821
+ ...o,
822
+ type: A.Anchored,
823
+ anchor: C.Left,
824
+ position: { left: 0, top: 0, bottom: 0, rightResizable: !0, width: i },
825
+ children: t
826
+ }
827
+ );
828
+ ye.propTypes = St;
829
+ const Se = ({ size: t, children: i, resizable: o, ...n }) => /* @__PURE__ */ c(
830
+ K,
831
+ {
832
+ ...n,
833
+ type: A.Anchored,
834
+ anchor: C.Left,
835
+ position: { left: 0, top: 0, bottom: 0, rightResizable: o, width: t },
836
+ children: i
837
+ }
838
+ );
839
+ Se.propTypes = Tt;
840
+ const Te = ({ children: t, size: i, ...o }) => /* @__PURE__ */ c(
841
+ K,
842
+ {
843
+ ...o,
844
+ type: A.Anchored,
845
+ anchor: C.Top,
846
+ position: { left: 0, top: 0, right: 0, bottomResizable: !0, height: i },
847
+ children: t
848
+ }
849
+ );
850
+ Te.propTypes = St;
851
+ const xe = ({ size: t, children: i, resizable: o, ...n }) => /* @__PURE__ */ c(
852
+ K,
853
+ {
854
+ ...n,
855
+ type: A.Anchored,
856
+ anchor: C.Top,
857
+ position: { left: 0, top: 0, right: 0, bottomResizable: o, height: t },
858
+ children: i
859
+ }
860
+ );
861
+ xe.propTypes = Tt;
862
+ const Ce = ({ children: t, size: i, ...o }) => /* @__PURE__ */ c(
863
+ K,
864
+ {
865
+ ...o,
866
+ type: A.Anchored,
867
+ anchor: C.Right,
868
+ position: { bottom: 0, top: 0, right: 0, leftResizable: !0, width: i },
869
+ children: t
870
+ }
871
+ );
872
+ Ce.propTypes = St;
873
+ const Ae = ({ size: t, children: i, resizable: o, ...n }) => /* @__PURE__ */ c(
874
+ K,
875
+ {
876
+ ...n,
877
+ type: A.Anchored,
878
+ anchor: C.Right,
879
+ position: { bottom: 0, top: 0, right: 0, leftResizable: o, width: t },
880
+ children: i
881
+ }
882
+ );
883
+ Ae.propTypes = Tt;
884
+ const Le = ({ children: t, size: i, ...o }) => /* @__PURE__ */ c(
885
+ K,
886
+ {
887
+ ...o,
888
+ type: A.Anchored,
889
+ anchor: C.Bottom,
890
+ position: { bottom: 0, left: 0, right: 0, topResizable: !0, height: i },
891
+ children: t
892
+ }
893
+ );
894
+ Le.propTypes = St;
895
+ const $e = ({ size: t, children: i, resizable: o, ...n }) => /* @__PURE__ */ c(
896
+ K,
897
+ {
898
+ ...n,
899
+ type: A.Anchored,
900
+ anchor: C.Bottom,
901
+ position: { bottom: 0, left: 0, right: 0, topResizable: o, height: t },
902
+ children: i
903
+ }
904
+ );
905
+ $e.propTypes = Tt;
906
+ const Be = oe(
907
+ {
908
+ ...Tt,
909
+ type: d.oneOf([A.Positioned, A.Fill, A.Anchored]),
910
+ anchor: d.oneOf([C.Left, C.Top, C.Right, C.Bottom]),
911
+ anchorSize: d.oneOfType([d.string, d.number]),
912
+ left: d.oneOfType([d.string, d.number]),
913
+ top: d.oneOfType([d.string, d.number]),
914
+ right: d.oneOfType([d.string, d.number]),
915
+ bottom: d.oneOfType([d.string, d.number]),
916
+ width: d.oneOfType([d.string, d.number]),
917
+ height: d.oneOfType([d.string, d.number]),
918
+ resizeTypes: d.array
919
+ },
920
+ "size"
921
+ ), je = ({
922
+ children: t,
923
+ type: i,
924
+ left: o,
925
+ top: n,
926
+ right: f,
927
+ bottom: h,
928
+ width: s,
929
+ height: y,
930
+ anchorSize: e,
931
+ anchor: a,
932
+ resizable: b,
933
+ resizeTypes: r,
934
+ ...g
935
+ }) => {
936
+ let u;
937
+ return i = i || A.Fill, i === A.Positioned ? u = {
938
+ left: o,
939
+ top: n,
940
+ right: f,
941
+ bottom: h,
942
+ width: s,
943
+ height: y,
944
+ leftResizable: r && (r.includes(p.Left) || r.includes(p.All)),
945
+ topResizable: r && (r.includes(p.Top) || r.includes(p.All)),
946
+ rightResizable: r && (r.includes(p.Right) || r.includes(p.All)),
947
+ bottomResizable: r && (r.includes(p.Bottom) || r.includes(p.All)),
948
+ topLeftResizable: r && (r.includes(p.TopLeft) || r.includes(p.All)),
949
+ topRightResizable: r && (r.includes(p.TopRight) || r.includes(p.All)),
950
+ bottomLeftResizable: r && (r.includes(p.BottomLeft) || r.includes(p.All)),
951
+ bottomRightResizable: r && (r.includes(p.BottomRight) || r.includes(p.All))
952
+ } : a === C.Left ? (u = { left: 0, top: 0, bottom: 0, width: e, rightResizable: b }, i = A.Anchored) : a === C.Right ? (u = { right: 0, top: 0, bottom: 0, width: e, leftResizable: b }, i = A.Anchored) : a === C.Top ? (u = { left: 0, top: 0, right: 0, height: e, bottomResizable: b }, i = A.Anchored) : a === C.Bottom ? (u = { left: 0, bottom: 0, right: 0, height: e, topResizable: b }, i = A.Anchored) : (u = {
953
+ left: 0,
954
+ top: 0,
955
+ bottom: 0,
956
+ right: 0
957
+ }, i = A.Fill), /* @__PURE__ */ c(K, { ...g, type: i, anchor: a, position: u, children: t });
958
+ };
959
+ je.propTypes = Be;
960
+ const Oe = (t) => /* @__PURE__ */ c(K, { ...t, type: A.Fill, position: { left: 0, top: 0, right: 0, bottom: 0 }, children: t.children });
961
+ Oe.propTypes = yt;
962
+ const Me = ({ width: t, height: i, children: o, ...n }) => /* @__PURE__ */ c(K, { ...n, type: A.Fixed, position: { width: t, height: i }, children: o });
963
+ Me.propTypes = {
964
+ ...yt,
965
+ width: d.oneOfType([d.string, d.number]),
966
+ height: d.oneOfType([d.string, d.number]).isRequired
967
+ };
968
+ const Ie = (t) => /* @__PURE__ */ c(At.Provider, { value: t.zIndex, children: t.children });
969
+ Ie.propTypes = {
970
+ zIndex: d.number.isRequired
971
+ };
972
+ const De = ({ left: t, top: i, right: o, bottom: n, width: f, height: h, resizable: s, ...y }) => {
973
+ const e = s || [];
974
+ return /* @__PURE__ */ c(
975
+ K,
976
+ {
977
+ ...y,
978
+ type: A.Positioned,
979
+ position: {
980
+ left: t,
981
+ top: i,
982
+ right: o,
983
+ bottom: n,
984
+ leftResizable: e.includes(p.Left) || e.includes(p.All),
985
+ topResizable: e.includes(p.Top) || e.includes(p.All),
986
+ rightResizable: e.includes(p.Right) || e.includes(p.All),
987
+ bottomResizable: e.includes(p.Bottom) || e.includes(p.All),
988
+ topLeftResizable: e.includes(p.TopLeft) || e.includes(p.All),
989
+ topRightResizable: e.includes(p.TopRight) || e.includes(p.All),
990
+ bottomLeftResizable: e.includes(p.BottomLeft) || e.includes(p.All),
991
+ bottomRightResizable: e.includes(p.BottomRight) || e.includes(p.All),
992
+ width: f,
993
+ height: h
994
+ },
995
+ children: y.children
996
+ }
997
+ );
998
+ };
999
+ De.propTypes = {
1000
+ ...yt,
1001
+ left: d.oneOfType([d.string, d.number]),
1002
+ top: d.oneOfType([d.string, d.number]),
1003
+ right: d.oneOfType([d.string, d.number]),
1004
+ bottom: d.oneOfType([d.string, d.number]),
1005
+ width: d.oneOfType([d.string, d.number]),
1006
+ height: d.oneOfType([d.string, d.number]),
1007
+ resizable: d.array
1008
+ };
1009
+ const ni = (t) => {
1010
+ const i = M.useContext(Ot);
1011
+ return i ? t.children(i) : t.children({ left: 0, top: 0, right: 0, bottom: 0, width: 0, height: 0, x: 0, y: 0, toJSON: () => "" });
1012
+ }, Ee = ({ left: t, top: i, right: o, bottom: n, children: f, ...h }) => /* @__PURE__ */ c(K, { ...h, type: A.ViewPort, position: { left: t || 0, top: i || 0, right: o || 0, bottom: n || 0 }, children: f });
1013
+ Ee.propTypes = {
1014
+ ...yt,
1015
+ left: d.oneOfType([d.string, d.number]),
1016
+ top: d.oneOfType([d.string, d.number]),
1017
+ right: d.oneOfType([d.string, d.number]),
1018
+ bottom: d.oneOfType([d.string, d.number])
1019
+ };
1020
+ const ri = ({ children: t, ...i }) => /* @__PURE__ */ c(Vt.Provider, { value: i, children: t }), Pe = (t) => {
1021
+ const {
1022
+ favicon: i,
1023
+ title: o,
1024
+ customTitle: n,
1025
+ activeTab: f,
1026
+ position: h,
1027
+ contentWidth: s,
1028
+ onClick: y,
1029
+ onClose: e,
1030
+ setDragging: a,
1031
+ tabsContentWidth: b,
1032
+ animateTabMove: r,
1033
+ isDragging: g,
1034
+ index: u,
1035
+ sorting: z,
1036
+ showButtonClose: l,
1037
+ onCloseAllTabs: m,
1038
+ onCloseLeftTabs: R,
1039
+ onCloseRightTabs: S,
1040
+ onCloseOtherTabs: w,
1041
+ totalTabs: I
1042
+ } = t, { t: B } = Ht(), [P, x] = V(0), [T, _] = V(!1), [k, N] = V(null), [q, D] = V(null), [ot, L] = V(!1), [F, tt] = V(0), [nt, U] = V(!1), lt = it(null), $ = 9, E = 84, H = 60, W = 48;
1043
+ et(() => (document.addEventListener("mousemove", j), document.addEventListener("mouseup", O), () => {
1044
+ document.removeEventListener("mousemove", j), document.addEventListener("mouseup", O);
1045
+ })), et(() => {
1046
+ T || setTimeout(() => _(!0), 500);
1047
+ }, [T]), et(() => {
1048
+ x(s + 2 * $);
1049
+ }, [s]);
1050
+ const X = (Y) => {
1051
+ Y.button === 0 && (a(!0), D(Y.pageX), L(!1), tt(h));
1052
+ }, j = (Y) => {
1053
+ if (q != null && g) {
1054
+ let ht = F - $ + (Y.pageX - q);
1055
+ ht < 0 && (ht = 0), ht > b - P && (ht = b - P), N(ht), !z && r(ht);
1056
+ }
1057
+ }, O = (Y) => {
1058
+ q != null && g && (D(null), N(null), a(!1), L(!0));
1059
+ }, [dt, ct] = V(h - $);
1060
+ et(() => {
1061
+ ct(h ? h - $ : 0);
1062
+ }, [u, h]);
1063
+ const gt = () => {
1064
+ w && w(t.id), U(!1);
1065
+ }, xt = () => {
1066
+ R && R(t.id), U(!1);
1067
+ }, Lt = () => {
1068
+ S && S(t.id), U(!1);
1069
+ }, Xt = () => {
1070
+ m && m(), U(!1);
1071
+ }, Jt = (Y) => {
1072
+ Y.preventDefault(), U(!0);
1073
+ }, Mt = u > 0, It = I !== void 0 && u < I - 1, Dt = (I || 0) > 1;
1074
+ return /* @__PURE__ */ G(
1075
+ "div",
1076
+ {
1077
+ className: `archbase_tab ${T ? "" : " archbase_tab-was-just-added"}${q == null && !f ? " archbase_tab-was-just-dragged" : ""}`,
1078
+ style: {
1079
+ transform: `translate3d(${k ?? dt}px, 0, 0)`,
1080
+ width: `${P}px`
1081
+ },
1082
+ "tab-active": f !== !1 ? "" : null,
1083
+ "is-small": s < E ? "" : null,
1084
+ "is-smaller": s < H ? "" : null,
1085
+ "is-mini": s < W ? "" : null,
1086
+ ref: lt,
1087
+ onContextMenu: Jt,
1088
+ children: [
1089
+ /* @__PURE__ */ c("div", { className: "archbase_tab-dividers" }),
1090
+ /* @__PURE__ */ c("div", { className: "archbase_tab-background", children: /* @__PURE__ */ G("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: [
1091
+ /* @__PURE__ */ G("defs", { children: [
1092
+ /* @__PURE__ */ c("symbol", { id: "archbase_tab-geometry-left", viewBox: "0 0 214 36", children: /* @__PURE__ */ c("path", { d: "M17 0h197v36H0v-2c4.5 0 9-3.5 9-8V8c0-4.5 3.5-8 8-8z" }) }),
1093
+ /* @__PURE__ */ c("symbol", { id: "archbase_tab-geometry-right", viewBox: "0 0 214 36", children: /* @__PURE__ */ c("use", { xlinkHref: "#archbase_tab-geometry-left" }) }),
1094
+ /* @__PURE__ */ c("clipPath", { id: "crop", children: /* @__PURE__ */ c("rect", { className: "mask", width: "100%", height: "100%", x: "0" }) })
1095
+ ] }),
1096
+ /* @__PURE__ */ c("svg", { width: "52%", height: "100%", children: /* @__PURE__ */ c("use", { xlinkHref: "#archbase_tab-geometry-left", width: "214", height: "36", className: "archbase_tab-geometry" }) }),
1097
+ /* @__PURE__ */ c("g", { transform: "scale(-1, 1)", children: /* @__PURE__ */ c("svg", { width: "52%", height: "100%", x: "-100%", y: "0", children: /* @__PURE__ */ c("use", { xlinkHref: "#archbase_tab-geometry-right", width: "214", height: "36", className: "archbase_tab-geometry" }) }) })
1098
+ ] }) }),
1099
+ /* @__PURE__ */ G("div", { className: "archbase_tab-content", children: [
1100
+ !!i && /* @__PURE__ */ c("div", { className: "archbase_tab-favicon", style: { backgroundImage: `url(${i})` } }),
1101
+ /* @__PURE__ */ c("div", { className: "archbase_tab-title", children: n ?? o }),
1102
+ /* @__PURE__ */ c("div", { className: "archbase_tab-drag-handle", title: n ?? o, onClick: y, onPointerDown: (Y) => y(Y), onMouseUp: O, onMouseMove: j, onMouseDown: X }),
1103
+ (m || R || S || w) && /* @__PURE__ */ G(at, { shadow: "md", width: 200, opened: nt, onChange: U, position: "bottom-end", children: [
1104
+ /* @__PURE__ */ c(at.Target, { children: /* @__PURE__ */ c("div", { className: "archbase_tab-dropdown", onClick: (Y) => {
1105
+ Y.stopPropagation(), U(!nt);
1106
+ } }) }),
1107
+ /* @__PURE__ */ G(at.Dropdown, { children: [
1108
+ Dt && /* @__PURE__ */ c(at.Item, { onClick: gt, children: String(B("tabs.closeOthers")) }),
1109
+ Mt && /* @__PURE__ */ c(at.Item, { onClick: xt, children: String(B("tabs.closeLeft")) }),
1110
+ It && /* @__PURE__ */ c(at.Item, { onClick: Lt, children: String(B("tabs.closeRight")) }),
1111
+ (Dt || Mt || It) && /* @__PURE__ */ c(at.Divider, {}),
1112
+ /* @__PURE__ */ c(at.Item, { onClick: Xt, children: String(B("tabs.closeAll")) })
1113
+ ] })
1114
+ ] }),
1115
+ l ? /* @__PURE__ */ c("div", { className: "archbase_tab-close", onClick: (Y) => {
1116
+ e(Y);
1117
+ } }) : null
1118
+ ] })
1119
+ ]
1120
+ }
1121
+ );
1122
+ }, si = (t) => {
1123
+ const { currentTabs: i, onTabChange: o, activeTab: n, onTabClose: f, className: h, style: s, dark: y, onClick: e, buttonCloseOnlyActiveTab: a = !1, onCloseAllTabs: b, onCloseLeftTabs: r, onCloseRightTabs: g, onCloseOtherTabs: u } = t, [z, l] = V([]), [m, R] = V([]), [S, w] = V(i || []), [I, B] = V(!1), [P, x] = V(!1), T = it(null), { width: _, height: k } = Kt(), N = 9, q = 1, D = 24, ot = 240;
1124
+ et(() => {
1125
+ l(F()), R(tt(F()));
1126
+ }, []), et(() => {
1127
+ L();
1128
+ }, [JSON.stringify(S), _, k]), et(() => {
1129
+ i && w(i);
1130
+ }, [JSON.stringify(i)]);
1131
+ const L = () => {
1132
+ const $ = F();
1133
+ $ && (l($), R(tt($)));
1134
+ }, F = () => {
1135
+ const $ = [];
1136
+ if (T.current) {
1137
+ const E = S.length, H = T.current.clientWidth, W = (E - 1) * q, X = (H - 2 * N + W) / E, j = Math.max(D, Math.min(ot, X)), O = Math.floor(j), dt = O * E + 2 * N - W;
1138
+ let gt = H - dt;
1139
+ for (let xt = 0; xt < E; xt += 1) {
1140
+ const Lt = O < ot && gt > 0 ? 1 : 0;
1141
+ $.push(O + Lt), gt > 0 && (gt -= 1);
1142
+ }
1143
+ }
1144
+ return $;
1145
+ }, tt = ($) => {
1146
+ const E = [], H = $ || z;
1147
+ let W = N;
1148
+ return H.forEach((X, j) => {
1149
+ const O = j * q;
1150
+ E.push(W - O), W += X;
1151
+ }), E;
1152
+ }, nt = ($, E) => {
1153
+ B(!0);
1154
+ let H = 1 / 0, W = -1, X = [];
1155
+ m.forEach((j, O) => {
1156
+ Math.abs($ - j) < H && (H = Math.abs($ - j), W = O);
1157
+ }), W = Math.max(0, Math.min(m.length, W)), E != W && (m.forEach((j, O) => {
1158
+ O == E ? X[O] = S[W > E ? O + 1 : O - 1] : E > O && O >= W ? X[O] = S[O + 1] : E < O && O <= W ? X[O] = S[O - 1] : X[O] = S[O];
1159
+ }), U(X) && o(X)), B(!1);
1160
+ }, U = ($) => new Set($).size === $.length, lt = ($) => {
1161
+ f ? f($) : o(S.filter((E, H) => H != $));
1162
+ };
1163
+ return /* @__PURE__ */ c("div", { className: h, style: s, children: /* @__PURE__ */ G(
1164
+ "div",
1165
+ {
1166
+ className: `archbase_tabs${y ? " archbase_tabs-dark-theme" : ""}${P ? "" : " archbase_tabs-is-sorting"}`,
1167
+ children: [
1168
+ /* @__PURE__ */ c("div", { className: "archbase_tabs_content", ref: T, children: !!S && S.map(($, E) => !!m[E] && /* @__PURE__ */ c(
1169
+ Pe,
1170
+ {
1171
+ favicon: $.favicon,
1172
+ title: $.title,
1173
+ customTitle: $.customTitle,
1174
+ activeTab: n === $.key,
1175
+ position: m[E],
1176
+ contentWidth: z[E],
1177
+ onClick: (H) => e($.key),
1178
+ onClose: (H) => lt($.key),
1179
+ setDragging: x,
1180
+ showButtonClose: a ? n === $.key : !0,
1181
+ tabsContentWidth: T.current && T.current.clientWidth,
1182
+ animateTabMove: (H) => nt(H, E),
1183
+ isDragging: P,
1184
+ id: $.key,
1185
+ index: E,
1186
+ sorting: I,
1187
+ onCloseAllTabs: b,
1188
+ onCloseLeftTabs: r,
1189
+ onCloseRightTabs: g,
1190
+ onCloseOtherTabs: u,
1191
+ totalTabs: S.length
1192
+ },
1193
+ $.key
1194
+ )) }),
1195
+ /* @__PURE__ */ c("div", { className: "archbase_tabs-bottom-bar" })
1196
+ ]
1197
+ }
1198
+ ) });
1199
+ }, pt = () => {
1200
+ let t = 0;
1201
+ return document.querySelectorAll(".archbase-window-container").forEach((o) => {
1202
+ const n = parseInt(o.style.zIndex);
1203
+ t = Math.max(isNaN(n) ? 0 : n, t);
1204
+ }), t + 1;
1205
+ }, li = (t) => {
1206
+ const i = Object.assign(
1207
+ {
1208
+ id: t.id && t.id.length ? t.id : Date.now().toString(),
1209
+ children: null,
1210
+ height: 0,
1211
+ width: 0,
1212
+ top: 0,
1213
+ left: 0,
1214
+ resizable: !1,
1215
+ titleBar: Object.assign(
1216
+ {
1217
+ icon: " ",
1218
+ title: "Untitled window",
1219
+ buttons: Object.assign(
1220
+ {
1221
+ minimize: !0,
1222
+ maximize: !0,
1223
+ close: !0
1224
+ },
1225
+ t.titleBar && t.titleBar.buttons || {}
1226
+ )
1227
+ },
1228
+ t.titleBar
1229
+ ),
1230
+ style: {}
1231
+ },
1232
+ t
1233
+ );
1234
+ i.id || (i.id = Date.now().toString()), Object.freeze(i);
1235
+ const [o, n] = J.useState(i.height), [f, h] = J.useState(i.width), [s, y] = J.useState(i.top || 0), [e, a] = J.useState(i.left || 0), [b, r] = J.useState(0), [g, u] = J.useState(0), [z, l] = J.useState(!1), [m, R] = J.useState(!1), [S, w] = J.useState("▁"), [I, B] = J.useState("□"), [P, x] = J.useState(""), [T, _] = J.useState(pt()), [k, N] = J.useState(1), { ref: q, width: D, height: ot } = Qt(), L = J.useRef(null), F = it(o), tt = it(f), nt = it(s), U = it(e), lt = 500, $ = (j) => {
1236
+ u(j.clientY - s), r(j.clientX - e), _(pt()), N(0.5);
1237
+ }, E = (j) => {
1238
+ a((j.clientX || j.screenX || e + b) - b), y((j.clientY || j.screenY || s + g) - g);
1239
+ }, H = (j) => {
1240
+ a((j.clientX || j.screenX) - b), y((j.clientY || j.screenY) - g), N(1);
1241
+ }, W = () => {
1242
+ if (x(`${lt}ms ease-in-out`), z)
1243
+ F.current = o, y(nt.current || 0), a(U.current || 0), l(!1), w("▁"), R(!1);
1244
+ else {
1245
+ F.current = 32, m || (U.current = e, nt.current = s);
1246
+ const j = document.getElementById(i.id)?.parentElement;
1247
+ tt.current = f;
1248
+ let O = (j?.clientHeight || window.innerHeight) - F.current - 4;
1249
+ const dt = (j?.clientWidth || window.innerWidth) - tt.current - 4, ct = document.elementFromPoint(
1250
+ dt + tt.current / 2,
1251
+ O + F.current / 2
1252
+ );
1253
+ ct && ["archbase-window-container", "windowTitle"].includes(ct?.className || "") && (O -= ct?.clientHeight + 4), y(O), a(dt), l(!0), w("◰"), R(!1);
1254
+ }
1255
+ _(pt()), setTimeout(x, lt + 1, "");
1256
+ }, X = () => {
1257
+ x(`${lt}ms ease-in-out`);
1258
+ const j = document.getElementById(i.id)?.parentElement;
1259
+ m ? (F.current = o, tt.current = f, y(nt.current || 0), a(U.current || 0), R(!1), B("□"), l(!1), w("▁")) : (F.current = j?.clientHeight || window.innerHeight, tt.current = j?.clientWidth || window.innerWidth, z || (U.current = e, nt.current = s), y(j?.offsetTop || 0), a(j?.offsetLeft || 0), R(!0), B("❐"), l(!1), w("▁")), _(pt()), setTimeout(x, lt + 1, "");
1260
+ };
1261
+ return et(() => {
1262
+ !m && !z && (h(D), n(ot));
1263
+ }, [D, ot, m, z]), /* @__PURE__ */ G(
1264
+ "div",
1265
+ {
1266
+ id: i.id,
1267
+ className: "archbase-window-container",
1268
+ style: {
1269
+ height: F.current,
1270
+ width: tt.current,
1271
+ top: s,
1272
+ left: e,
1273
+ resize: i.resizable ? "both" : "none",
1274
+ transition: P,
1275
+ zIndex: T,
1276
+ opacity: k
1277
+ },
1278
+ ref: q,
1279
+ onClick: () => {
1280
+ _(pt());
1281
+ },
1282
+ children: [
1283
+ i.titleBar && /* @__PURE__ */ G(
1284
+ "div",
1285
+ {
1286
+ className: "title-bar",
1287
+ "data-parent": i.id,
1288
+ style: {
1289
+ opacity: k
1290
+ },
1291
+ children: [
1292
+ i.titleBar.icon && /* @__PURE__ */ c("span", { className: "icon", children: i.titleBar.icon }),
1293
+ /* @__PURE__ */ c(
1294
+ "span",
1295
+ {
1296
+ className: "windowTitle",
1297
+ draggable: !0,
1298
+ onDragStart: $,
1299
+ onDrag: E,
1300
+ onDragEnd: H,
1301
+ style: { opacity: Math.floor(k) },
1302
+ ref: L,
1303
+ children: i.titleBar.title
1304
+ }
1305
+ ),
1306
+ i.titleBar.buttons && /* @__PURE__ */ G("span", { className: "buttonContainer", children: [
1307
+ i.titleBar.buttons.minimize && /* @__PURE__ */ c("span", { className: "windowButton", onClick: W, children: S }),
1308
+ i.titleBar.buttons.maximize && /* @__PURE__ */ c("span", { className: "windowButton", onClick: X, children: I }),
1309
+ !!i.titleBar.buttons.close && /* @__PURE__ */ c("span", { className: "windowButton", onClick: i.titleBar.buttons.close, children: "⨯" })
1310
+ ] })
1311
+ ]
1312
+ }
1313
+ ),
1314
+ /* @__PURE__ */ c(
1315
+ "div",
1316
+ {
1317
+ className: "content",
1318
+ draggable: "false",
1319
+ ref: t.innerRef,
1320
+ style: {
1321
+ height: "100%",
1322
+ opacity: k,
1323
+ ...i.style
1324
+ },
1325
+ children: i.children
1326
+ }
1327
+ )
1328
+ ]
1329
+ }
1330
+ );
1331
+ }, ai = ({
1332
+ children: t,
1333
+ direction: i = "row",
1334
+ splitterSize: o = 4,
1335
+ splitterColor: n,
1336
+ splitterHoverColor: f,
1337
+ splitterRadius: h,
1338
+ withKnob: s = !1,
1339
+ opacity: y,
1340
+ style: e,
1341
+ className: a
1342
+ }) => /* @__PURE__ */ c(
1343
+ Bt,
1344
+ {
1345
+ orientation: i === "row" ? "horizontal" : "vertical",
1346
+ size: o,
1347
+ color: n,
1348
+ hoverColor: f,
1349
+ radius: h,
1350
+ withKnob: s,
1351
+ opacity: y,
1352
+ style: e,
1353
+ className: a,
1354
+ children: t
1355
+ }
1356
+ ), di = ({
1357
+ children: t,
1358
+ minSize: i,
1359
+ maxSize: o,
1360
+ defaultSize: n,
1361
+ style: f,
1362
+ className: h
1363
+ }) => /* @__PURE__ */ c(
1364
+ Bt.Pane,
1365
+ {
1366
+ initialWidth: n,
1367
+ initialHeight: n,
1368
+ minWidth: i,
1369
+ minHeight: i,
1370
+ maxWidth: o,
1371
+ maxHeight: o,
1372
+ style: f,
1373
+ className: h,
1374
+ children: t
1375
+ }
1376
+ ), ci = ({
1377
+ style: t,
1378
+ className: i
1379
+ }) => /* @__PURE__ */ c(Bt.Resizer, { style: t, className: i }), hi = ({
1380
+ children: t,
1381
+ title: i,
1382
+ reducedTitle: o,
1383
+ containerWidth: n = "300px",
1384
+ backgroundColor: f = "transparent",
1385
+ hiddenBackgroundColor: h = "#ccc",
1386
+ withBorder: s = !1,
1387
+ hiddenWidth: y = "30px",
1388
+ position: e = "right",
1389
+ onShow: a,
1390
+ onHide: b,
1391
+ defaultIsDocked: r = !1,
1392
+ defaultIsVisible: g = !1
1393
+ }) => {
1394
+ const [u, z] = V(r), [l, m] = V(g), R = () => z(!u), S = () => {
1395
+ !u && !l && (m(!0), a && a());
1396
+ }, w = () => {
1397
+ !u && l && (m(!1), b && b());
1398
+ };
1399
+ et(() => {
1400
+ g ? S() : w();
1401
+ }, [g]);
1402
+ const I = {
1403
+ writingMode: "vertical-rl",
1404
+ transform: "rotate(360deg)",
1405
+ margin: "10px 0",
1406
+ alignSelf: "flex-center",
1407
+ cursor: "pointer"
1408
+ }, B = {
1409
+ writingMode: "vertical-rl",
1410
+ transform: "rotate(180deg)",
1411
+ margin: "10px 0",
1412
+ alignSelf: "flex-center",
1413
+ cursor: "pointer"
1414
+ }, P = s ? "1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4))" : "none";
1415
+ return /* @__PURE__ */ G(
1416
+ "div",
1417
+ {
1418
+ style: {
1419
+ position: "absolute",
1420
+ [e]: 0,
1421
+ top: 0,
1422
+ height: "100vh",
1423
+ display: "flex",
1424
+ flexDirection: e === "left" ? "row-reverse" : "row"
1425
+ },
1426
+ children: [
1427
+ /* @__PURE__ */ c(
1428
+ "div",
1429
+ {
1430
+ onMouseOver: S,
1431
+ style: {
1432
+ width: l || u ? "0px" : y,
1433
+ height: "100%",
1434
+ backgroundColor: h,
1435
+ cursor: "pointer",
1436
+ border: P,
1437
+ display: "flex",
1438
+ flexDirection: "column",
1439
+ justifyContent: "flex-start",
1440
+ alignItems: "center"
1441
+ },
1442
+ children: !l && !u && // @ts-ignore
1443
+ /* @__PURE__ */ c("span", { style: e === "right" ? I : B, children: o })
1444
+ }
1445
+ ),
1446
+ /* @__PURE__ */ c(
1447
+ "div",
1448
+ {
1449
+ onMouseLeave: w,
1450
+ style: {
1451
+ width: l || u ? n : "0px",
1452
+ height: "100%",
1453
+ overflow: "hidden",
1454
+ transition: "width 0.3s ease-in-out",
1455
+ backgroundColor: f,
1456
+ padding: l || u ? "10px" : "0px",
1457
+ border: l || u ? P : 0
1458
+ },
1459
+ children: l || u ? /* @__PURE__ */ G(Nt, { children: [
1460
+ /* @__PURE__ */ G(
1461
+ "div",
1462
+ {
1463
+ style: {
1464
+ display: "flex",
1465
+ alignItems: "center",
1466
+ justifyContent: "space-between",
1467
+ marginBottom: "10px"
1468
+ },
1469
+ children: [
1470
+ /* @__PURE__ */ c("span", { children: i }),
1471
+ /* @__PURE__ */ c(Zt, { onClick: R, children: u ? /* @__PURE__ */ c(te, { size: 16 }) : /* @__PURE__ */ c(ee, { size: 16 }) })
1472
+ ]
1473
+ }
1474
+ ),
1475
+ t
1476
+ ] }) : null
1477
+ }
1478
+ )
1479
+ ]
1480
+ }
1481
+ );
1482
+ };
1483
+ function _e({
1484
+ components: t,
1485
+ defaultLayout: i,
1486
+ watermark: o,
1487
+ hideBorders: n = !1,
1488
+ autoHideHeaders: f = !1,
1489
+ onLayoutChange: h,
1490
+ onPanelClose: s,
1491
+ onPanelOpen: y,
1492
+ style: e,
1493
+ className: a,
1494
+ height: b = "600px",
1495
+ disabled: r = !1
1496
+ }) {
1497
+ const { t: g } = Ht(), u = it(null), z = kt(() => {
1498
+ const m = {};
1499
+ for (const R of Object.values(t))
1500
+ m[R.id] = (S) => /* @__PURE__ */ c(
1501
+ Ne,
1502
+ {
1503
+ component: R,
1504
+ api: S.api,
1505
+ onClose: () => s?.(R.id)
1506
+ }
1507
+ );
1508
+ return m;
1509
+ }, [t, s]), l = Gt((m) => {
1510
+ if (u.current = m.api, i && typeof i != "string")
1511
+ try {
1512
+ m.api.fromJSON(i);
1513
+ } catch (R) {
1514
+ console.warn("Failed to load default layout:", R);
1515
+ }
1516
+ if (!i && Object.keys(t).length > 0) {
1517
+ const R = Object.values(t)[0];
1518
+ try {
1519
+ m.api.addPanel({
1520
+ id: R.id,
1521
+ component: R.id,
1522
+ title: R.title
1523
+ });
1524
+ } catch (S) {
1525
+ console.warn("Failed to add initial panel:", S);
1526
+ }
1527
+ }
1528
+ }, [i, t]);
1529
+ return et(() => {
1530
+ if (!u.current)
1531
+ return;
1532
+ const m = [];
1533
+ if (h) {
1534
+ const R = u.current.onDidLayoutChange(() => {
1535
+ h(u.current.toJSON());
1536
+ });
1537
+ m.push(R);
1538
+ }
1539
+ if (s) {
1540
+ const R = u.current.onDidRemovePanel((S) => {
1541
+ s(S.panel.id);
1542
+ });
1543
+ m.push(R);
1544
+ }
1545
+ return () => {
1546
+ m.forEach((R) => R.dispose());
1547
+ };
1548
+ }, [h, s]), /* @__PURE__ */ c(
1549
+ "div",
1550
+ {
1551
+ style: {
1552
+ width: "100%",
1553
+ height: b,
1554
+ ...e
1555
+ },
1556
+ className: a,
1557
+ children: /* @__PURE__ */ c(
1558
+ ie,
1559
+ {
1560
+ components: z,
1561
+ onReady: l,
1562
+ hideBorders: n,
1563
+ watermarkComponent: o ? () => /* @__PURE__ */ c("div", { style: {
1564
+ display: "flex",
1565
+ alignItems: "center",
1566
+ justifyContent: "center",
1567
+ height: "100%",
1568
+ opacity: 0.1,
1569
+ fontSize: "2rem",
1570
+ fontWeight: "bold"
1571
+ }, children: o }) : void 0
1572
+ }
1573
+ )
1574
+ }
1575
+ );
1576
+ }
1577
+ function Ne({ component: t, api: i, onClose: o }) {
1578
+ const n = t.component;
1579
+ return /* @__PURE__ */ c("div", { style: { height: "100%", overflow: "auto" }, children: /* @__PURE__ */ c(
1580
+ n,
1581
+ {
1582
+ api: i,
1583
+ onClose: o,
1584
+ params: t.params
1585
+ }
1586
+ ) });
1587
+ }
1588
+ function ui({
1589
+ preset: t,
1590
+ components: i = {},
1591
+ onPanelClose: o,
1592
+ onPanelOpen: n,
1593
+ style: f,
1594
+ className: h,
1595
+ height: s
1596
+ }) {
1597
+ const { layout: y, components: e } = kt(() => ke(t, i), [t, i]);
1598
+ return /* @__PURE__ */ c(
1599
+ _e,
1600
+ {
1601
+ components: e,
1602
+ defaultLayout: y,
1603
+ onPanelClose: o,
1604
+ onPanelOpen: n,
1605
+ style: f,
1606
+ className: h,
1607
+ height: s
1608
+ }
1609
+ );
1610
+ }
1611
+ function ke(t, i) {
1612
+ const o = {
1613
+ ...He(),
1614
+ ...i
1615
+ };
1616
+ let n;
1617
+ switch (t) {
1618
+ case "dashboard":
1619
+ n = _t(o);
1620
+ break;
1621
+ case "ide":
1622
+ n = We(o);
1623
+ break;
1624
+ case "explorer":
1625
+ n = Fe(o);
1626
+ break;
1627
+ case "analytics":
1628
+ n = Ve(o);
1629
+ break;
1630
+ default:
1631
+ n = _t(o);
1632
+ }
1633
+ return { layout: n, components: o };
1634
+ }
1635
+ function He() {
1636
+ return {
1637
+ // Dashboard
1638
+ overview: {
1639
+ id: "overview",
1640
+ title: "Overview",
1641
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Overview Panel" })
1642
+ },
1643
+ charts: {
1644
+ id: "charts",
1645
+ title: "Charts",
1646
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Charts Panel" })
1647
+ },
1648
+ details: {
1649
+ id: "details",
1650
+ title: "Details",
1651
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Details Panel" })
1652
+ },
1653
+ recent: {
1654
+ id: "recent",
1655
+ title: "Recent Activity",
1656
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Recent Activity" })
1657
+ },
1658
+ // IDE
1659
+ explorer: {
1660
+ id: "explorer",
1661
+ title: "Explorer",
1662
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "File Explorer" })
1663
+ },
1664
+ search: {
1665
+ id: "search",
1666
+ title: "Search",
1667
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Search Panel" })
1668
+ },
1669
+ editor: {
1670
+ id: "editor",
1671
+ title: "Editor",
1672
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Code Editor" })
1673
+ },
1674
+ terminal: {
1675
+ id: "terminal",
1676
+ title: "Terminal",
1677
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Terminal" })
1678
+ },
1679
+ output: {
1680
+ id: "output",
1681
+ title: "Output",
1682
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Output" })
1683
+ },
1684
+ problems: {
1685
+ id: "problems",
1686
+ title: "Problems",
1687
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Problems Panel" })
1688
+ },
1689
+ // Analytics
1690
+ metrics: {
1691
+ id: "metrics",
1692
+ title: "Metrics",
1693
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Metrics Dashboard" })
1694
+ },
1695
+ reports: {
1696
+ id: "reports",
1697
+ title: "Reports",
1698
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Reports Panel" })
1699
+ },
1700
+ data: {
1701
+ id: "data",
1702
+ title: "Data Source",
1703
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Data Configuration" })
1704
+ },
1705
+ filters: {
1706
+ id: "filters",
1707
+ title: "Filters",
1708
+ component: () => /* @__PURE__ */ c("div", { style: { padding: 16 }, children: "Filter Panel" })
1709
+ }
1710
+ };
1711
+ }
1712
+ function _t(t) {
1713
+ return {
1714
+ root: {
1715
+ type: "branch",
1716
+ data: [
1717
+ {
1718
+ type: "leaf",
1719
+ size: 250,
1720
+ data: [
1721
+ {
1722
+ id: t.overview.id,
1723
+ title: t.overview.title,
1724
+ component: t.overview.id
1725
+ }
1726
+ ]
1727
+ },
1728
+ {
1729
+ type: "branch",
1730
+ size: 0.7,
1731
+ data: [
1732
+ {
1733
+ type: "leaf",
1734
+ size: 0.6,
1735
+ data: [
1736
+ {
1737
+ id: t.charts.id,
1738
+ title: t.charts.title,
1739
+ component: t.charts.id
1740
+ }
1741
+ ]
1742
+ },
1743
+ {
1744
+ type: "leaf",
1745
+ size: 0.4,
1746
+ data: [
1747
+ {
1748
+ id: t.details.id,
1749
+ title: t.details.title,
1750
+ component: t.details.id
1751
+ }
1752
+ ]
1753
+ }
1754
+ ]
1755
+ },
1756
+ {
1757
+ type: "leaf",
1758
+ size: 250,
1759
+ data: [
1760
+ {
1761
+ id: t.recent.id,
1762
+ title: t.recent.title,
1763
+ component: t.recent.id
1764
+ }
1765
+ ]
1766
+ }
1767
+ ]
1768
+ }
1769
+ };
1770
+ }
1771
+ function We(t) {
1772
+ return {
1773
+ root: {
1774
+ type: "branch",
1775
+ data: [
1776
+ {
1777
+ type: "leaf",
1778
+ size: 250,
1779
+ data: [
1780
+ {
1781
+ id: t.explorer.id,
1782
+ title: t.explorer.title,
1783
+ component: t.explorer.id
1784
+ }
1785
+ ]
1786
+ },
1787
+ {
1788
+ type: "branch",
1789
+ size: 0.7,
1790
+ data: [
1791
+ {
1792
+ type: "leaf",
1793
+ size: 0.7,
1794
+ data: [
1795
+ {
1796
+ id: t.editor.id,
1797
+ title: t.editor.title,
1798
+ component: t.editor.id
1799
+ }
1800
+ ]
1801
+ },
1802
+ {
1803
+ type: "branch",
1804
+ size: 0.3,
1805
+ data: [
1806
+ {
1807
+ type: "leaf",
1808
+ size: 0.5,
1809
+ data: [
1810
+ {
1811
+ id: t.terminal.id,
1812
+ title: t.terminal.title,
1813
+ component: t.terminal.id
1814
+ }
1815
+ ]
1816
+ },
1817
+ {
1818
+ type: "leaf",
1819
+ size: 0.5,
1820
+ data: [
1821
+ {
1822
+ id: t.output.id,
1823
+ title: t.output.title,
1824
+ component: t.output.id
1825
+ }
1826
+ ]
1827
+ }
1828
+ ]
1829
+ }
1830
+ ]
1831
+ },
1832
+ {
1833
+ type: "leaf",
1834
+ size: 250,
1835
+ data: [
1836
+ {
1837
+ id: t.search.id,
1838
+ title: t.search.title,
1839
+ component: t.search.id
1840
+ },
1841
+ {
1842
+ id: t.problems.id,
1843
+ title: t.problems.title,
1844
+ component: t.problems.id
1845
+ }
1846
+ ]
1847
+ }
1848
+ ]
1849
+ }
1850
+ };
1851
+ }
1852
+ function Fe(t) {
1853
+ return {
1854
+ root: {
1855
+ type: "branch",
1856
+ data: [
1857
+ {
1858
+ type: "leaf",
1859
+ size: 300,
1860
+ data: [
1861
+ {
1862
+ id: t.explorer.id,
1863
+ title: t.explorer.title,
1864
+ component: t.explorer.id
1865
+ }
1866
+ ]
1867
+ },
1868
+ {
1869
+ type: "leaf",
1870
+ size: 0.7,
1871
+ data: [
1872
+ {
1873
+ id: t.details.id,
1874
+ title: t.details.title,
1875
+ component: t.details.id
1876
+ }
1877
+ ]
1878
+ }
1879
+ ]
1880
+ }
1881
+ };
1882
+ }
1883
+ function Ve(t) {
1884
+ return {
1885
+ root: {
1886
+ type: "branch",
1887
+ data: [
1888
+ {
1889
+ type: "leaf",
1890
+ size: 250,
1891
+ data: [
1892
+ {
1893
+ id: t.filters.id,
1894
+ title: t.filters.title,
1895
+ component: t.filters.id
1896
+ },
1897
+ {
1898
+ id: t.data.id,
1899
+ title: t.data.title,
1900
+ component: t.data.id
1901
+ }
1902
+ ]
1903
+ },
1904
+ {
1905
+ type: "branch",
1906
+ size: 0.75,
1907
+ data: [
1908
+ {
1909
+ type: "leaf",
1910
+ size: 0.6,
1911
+ data: [
1912
+ {
1913
+ id: t.metrics.id,
1914
+ title: t.metrics.title,
1915
+ component: t.metrics.id
1916
+ }
1917
+ ]
1918
+ },
1919
+ {
1920
+ type: "leaf",
1921
+ size: 0.4,
1922
+ data: [
1923
+ {
1924
+ id: t.reports.id,
1925
+ title: t.reports.title,
1926
+ component: t.reports.id
1927
+ }
1928
+ ]
1929
+ }
1930
+ ]
1931
+ }
1932
+ ]
1933
+ }
1934
+ };
1935
+ }
1936
+ export {
1937
+ C as AnchorType,
1938
+ si as ArchbaseAdvancedTabs,
1939
+ gi as ArchbaseCard,
1940
+ bi as ArchbaseContainer,
1941
+ _e as ArchbaseDockLayout,
1942
+ ui as ArchbaseDockLayoutPreset,
1943
+ hi as ArchbaseDockableContainer,
1944
+ li as ArchbaseFloatingWindow,
1945
+ ei as ArchbaseForm,
1946
+ pi as ArchbaseGroup,
1947
+ $e as ArchbaseSpaceBottom,
1948
+ Le as ArchbaseSpaceBottomResizable,
1949
+ ze as ArchbaseSpaceCentered,
1950
+ we as ArchbaseSpaceCenteredVertically,
1951
+ je as ArchbaseSpaceCustom,
1952
+ Oe as ArchbaseSpaceFill,
1953
+ Me as ArchbaseSpaceFixed,
1954
+ ni as ArchbaseSpaceInfo,
1955
+ Ie as ArchbaseSpaceLayer,
1956
+ Se as ArchbaseSpaceLeft,
1957
+ ye as ArchbaseSpaceLeftResizable,
1958
+ ri as ArchbaseSpaceOptions,
1959
+ De as ArchbaseSpacePositioned,
1960
+ Ae as ArchbaseSpaceRight,
1961
+ Ce as ArchbaseSpaceRightResizable,
1962
+ xe as ArchbaseSpaceTop,
1963
+ Te as ArchbaseSpaceTopResizable,
1964
+ Ee as ArchbaseSpaceViewPort,
1965
+ ai as ArchbaseSplitPane,
1966
+ di as ArchbaseSplitPanePane,
1967
+ ci as ArchbaseSplitPaneResizer,
1968
+ zi as ArchbaseStack,
1969
+ st as CenterType,
1970
+ rt as ResizeHandlePlacement,
1971
+ p as ResizeType,
1972
+ A as Type,
1973
+ Tt as anchoredProps,
1974
+ oi as enabledSsrSupport,
1975
+ St as resizableProps,
1976
+ ii as useArchbaseCurrentSpace
1977
+ };