react-bwin 0.3.3 → 0.3.4

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.
@@ -1,1131 +1,1051 @@
1
- import f, { useRef as A, useEffect as W, forwardRef as X, useState as Y, useImperativeHandle as j, useMemo as K } from "react";
2
- import { createPortal as V } from "react-dom";
3
- var Z = Object.defineProperty, J = (e, t, i) => t in e ? Z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i, y = (e, t, i) => J(e, typeof t != "symbol" ? t + "" : t, i);
4
- function Q(e = 0.7, t = 128) {
5
- const i = 256 - t, n = Math.floor(Math.random() * i + t), s = Math.floor(Math.random() * i + t), o = Math.floor(Math.random() * i + t), h = Math.max(0.5, Math.random() * e);
6
- return `rgba(${n}, ${s}, ${o}, ${h})`;
1
+ import e, { forwardRef as t, useEffect as n, useImperativeHandle as r, useMemo as i, useRef as a, useState as o } from "react";
2
+ import { createPortal as s } from "react-dom";
3
+ //#region node_modules/.pnpm/bwin@0.3.3/node_modules/bwin/dist/bwin.js
4
+ function c(e = .7, t = 128) {
5
+ let n = 256 - t;
6
+ return `rgba(${Math.floor(Math.random() * n + t)}, ${Math.floor(Math.random() * n + t)}, ${Math.floor(Math.random() * n + t)}, ${Math.max(.5, Math.random() * e)})`;
7
7
  }
8
- function S(e = 2, t = 3) {
9
- if (e < 0 || t < 0)
10
- throw new Error("Parameters must be non-negative numbers");
11
- const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", n = "0123456789";
12
- let s = "";
13
- for (let o = 0; o < e; o++) {
14
- const h = Math.floor(Math.random() * i.length);
15
- s += i[h];
16
- }
17
- s += "-";
18
- for (let o = 0; o < t; o++) {
19
- const h = Math.floor(Math.random() * n.length);
20
- s += n[h];
21
- }
22
- return s;
8
+ function l(e = 2, t = 3) {
9
+ if (e < 0 || t < 0) throw Error("Parameters must be non-negative numbers");
10
+ let n = "";
11
+ for (let t = 0; t < e; t++) {
12
+ let e = Math.floor(Math.random() * 26);
13
+ n += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[e];
14
+ }
15
+ n += "-";
16
+ for (let e = 0; e < t; e++) {
17
+ let e = Math.floor(Math.random() * 10);
18
+ n += "0123456789"[e];
19
+ }
20
+ return n;
23
21
  }
24
- function B(e, t) {
25
- for (; t.firstChild; )
26
- e.append(t.firstChild);
22
+ function u(e, t) {
23
+ for (; t.firstChild;) e.append(t.firstChild);
27
24
  }
28
- function tt(e, t) {
29
- const i = document.createElement("div");
30
- B(i, e), B(e, t), B(t, i);
25
+ function d(e, t) {
26
+ let n = document.createElement("div");
27
+ u(n, e), u(e, t), u(t, n);
31
28
  }
32
- function z(e) {
33
- if (typeof e == "number" && !isNaN(e))
34
- return e;
35
- if (typeof e == "string") {
36
- const t = e.trim();
37
- if (t.endsWith("%")) {
38
- const i = t.slice(0, -1);
39
- if (!i) return NaN;
40
- const n = Number(i);
41
- return isNaN(n) ? NaN : n / 100;
42
- }
43
- if (t.endsWith("px")) {
44
- const i = t.slice(0, -2);
45
- if (!i) return NaN;
46
- const n = Number(i);
47
- return isNaN(n) ? NaN : n;
48
- }
49
- return Number(t);
50
- }
51
- return NaN;
29
+ function f(e) {
30
+ if (typeof e == "number" && !isNaN(e)) return e;
31
+ if (typeof e == "string") {
32
+ let t = e.trim();
33
+ if (t.endsWith("%")) {
34
+ let e = t.slice(0, -1);
35
+ if (!e) return NaN;
36
+ let n = Number(e);
37
+ return isNaN(n) ? NaN : n / 100;
38
+ }
39
+ if (t.endsWith("px")) {
40
+ let e = t.slice(0, -2);
41
+ if (!e) return NaN;
42
+ let n = Number(e);
43
+ return isNaN(n) ? NaN : n;
44
+ }
45
+ return Number(t);
46
+ }
47
+ return NaN;
52
48
  }
53
- function et(e) {
54
- return e !== null && typeof e == "object" && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype;
49
+ function p(e) {
50
+ return typeof e == "object" && !!e && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype;
55
51
  }
56
- function it(e, t) {
57
- for (const i in t) {
58
- if (Object.hasOwn(e, i))
59
- throw new Error(`Key "${i}" already exists in target object`);
60
- e[i] = t[i];
61
- }
62
- return e;
52
+ function m(e, t) {
53
+ for (let n in t) {
54
+ if (Object.hasOwn(e, n)) throw Error(`Key "${n}" already exists in target object`);
55
+ e[n] = t[n];
56
+ }
57
+ return e;
63
58
  }
64
- function nt(e) {
65
- const t = document.createElement("template");
66
- return t.innerHTML = e.trim(), t.content;
59
+ function h(e) {
60
+ let t = document.createElement("template");
61
+ return t.innerHTML = e.trim(), t.content;
67
62
  }
68
- function N(e) {
69
- if (e == null || e === "")
70
- return null;
71
- if (typeof e == "string")
72
- try {
73
- const t = nt(e);
74
- return t.childNodes.length === 1 ? t.firstChild : t;
75
- } catch {
76
- return document.createTextNode(e);
77
- }
78
- return e instanceof Node ? e : document.createTextNode(String(e));
63
+ function g(e) {
64
+ if (e == null || e === "") return null;
65
+ if (typeof e == "string") try {
66
+ let t = h(e);
67
+ return t.childNodes.length === 1 ? t.firstChild : t;
68
+ } catch {
69
+ return document.createTextNode(e);
70
+ }
71
+ return e instanceof Node ? e : document.createTextNode(String(e));
79
72
  }
80
- function M(e) {
81
- const t = parseFloat(e.style.left) || 0, i = parseFloat(e.style.top) || 0, n = parseFloat(e.style.width) || 0, s = parseFloat(e.style.height) || 0;
82
- return { left: t, top: i, width: n, height: s };
73
+ function _(e) {
74
+ return {
75
+ left: parseFloat(e.style.left) || 0,
76
+ top: parseFloat(e.style.top) || 0,
77
+ width: parseFloat(e.style.width) || 0,
78
+ height: parseFloat(e.style.height) || 0
79
+ };
83
80
  }
84
- const a = {
85
- Top: "top",
86
- Right: "right",
87
- Bottom: "bottom",
88
- Left: "left",
89
- Center: "center",
90
- Root: "root",
91
- Unknown: "unknown",
92
- Outside: "outside"
81
+ var v = {
82
+ Top: "top",
83
+ Right: "right",
84
+ Bottom: "bottom",
85
+ Left: "left",
86
+ Center: "center",
87
+ Root: "root",
88
+ Unknown: "unknown",
89
+ Outside: "outside"
93
90
  };
94
- function st(e) {
95
- switch (e) {
96
- case a.Top:
97
- return a.Bottom;
98
- case a.Right:
99
- return a.Left;
100
- case a.Bottom:
101
- return a.Top;
102
- case a.Left:
103
- return a.Right;
104
- default:
105
- throw new Error(`[bwin] Invalid position: ${e}`);
106
- }
91
+ function y(e) {
92
+ switch (e) {
93
+ case v.Top: return v.Bottom;
94
+ case v.Right: return v.Left;
95
+ case v.Bottom: return v.Top;
96
+ case v.Left: return v.Right;
97
+ default: throw Error(`[bwin] Invalid position: ${e}`);
98
+ }
107
99
  }
108
- function ot({ width: e, height: t, x: i }) {
109
- return t / e * i;
100
+ function b({ width: e, height: t, x: n }) {
101
+ return t / e * n;
110
102
  }
111
- function ht({ width: e, height: t, y: i }) {
112
- return e / t * i;
103
+ function x({ width: e, height: t, y: n }) {
104
+ return e / t * n;
113
105
  }
114
- function rt({ width: e, height: t, x: i }) {
115
- return t - t / e * i;
106
+ function ee({ width: e, height: t, x: n }) {
107
+ return t - t / e * n;
116
108
  }
117
- function at({ width: e, height: t, y: i }) {
118
- return e - e / t * i;
109
+ function te({ width: e, height: t, y: n }) {
110
+ return e - e / t * n;
119
111
  }
120
- function lt(e, { clientX: t, clientY: i }) {
121
- const n = e.getBoundingClientRect(), { width: s, height: o } = n, h = t - n.left, r = i - n.top;
122
- if (h < 0 || h > s || r < 0 || r > o)
123
- return a.Outside;
124
- const d = 0.3, l = ot({ width: s, height: o, x: h }), c = rt({ width: s, height: o, x: h }), u = ht({ width: s, height: o, y: r }), g = at({ width: s, height: o, y: r });
125
- return h < s * (0.5 - d / 2) && r > l && r < c ? a.Left : h > s * (0.5 + d / 2) && r < l && r > c ? a.Right : r < o * (0.5 - d / 2) && h > u && h < g ? a.Top : r > o * (0.5 + d / 2) && h < u && h > g ? a.Bottom : h > s * (0.5 - d / 2) && h < s * (0.5 + d / 2) && r > o * (0.5 - d / 2) && r < o * (0.5 + d / 2) ? a.Center : a.Unknown;
112
+ function ne(e, { clientX: t, clientY: n }) {
113
+ let r = e.getBoundingClientRect(), { width: i, height: a } = r, o = t - r.left, s = n - r.top;
114
+ if (o < 0 || o > i || s < 0 || s > a) return v.Outside;
115
+ let c = .3, l = b({
116
+ width: i,
117
+ height: a,
118
+ x: o
119
+ }), u = ee({
120
+ width: i,
121
+ height: a,
122
+ x: o
123
+ }), d = x({
124
+ width: i,
125
+ height: a,
126
+ y: s
127
+ }), f = te({
128
+ width: i,
129
+ height: a,
130
+ y: s
131
+ });
132
+ return o < i * (.5 - c / 2) && s > l && s < u ? v.Left : o > i * .65 && s < l && s > u ? v.Right : s < a * (.5 - c / 2) && o > d && o < f ? v.Top : s > a * .65 && o < d && o > f ? v.Bottom : o > i * (.5 - c / 2) && o < i * .65 && s > a * (.5 - c / 2) && s < a * .65 ? v.Center : v.Unknown;
126
133
  }
127
- const dt = 100, ct = 100, v = {
128
- left: 0,
129
- top: 0,
130
- width: 150,
131
- height: 150,
132
- // Initial min values, real min width/height is calculated based on children
133
- minWidth: dt,
134
- minHeight: ct
134
+ var S = {
135
+ left: 0,
136
+ top: 0,
137
+ width: 150,
138
+ height: 150,
139
+ minWidth: 100,
140
+ minHeight: 100,
141
+ resizeStrategy: "classic"
142
+ }, C = class {
143
+ constructor({ left: e = S.left, top: t = S.top, width: n = S.width, height: r = S.height, minWidth: i = S.minWidth, minHeight: a = S.minHeight, resizeStrategy: o = S.resizeStrategy, parent: s = null, domNode: c = null, store: u = {}, position: d, id: f } = S) {
144
+ if (this.id = f ?? l(), !d) throw Error("[bwin] Sash position is required");
145
+ this.position = d, this.domNode = c, this.parent = s, this._top = t, this._left = e, this._width = n, this._height = r, this.children = [], this.minWidth = i, this.minHeight = a, this.resizeStrategy = o, this.store = u;
146
+ }
147
+ walk(e) {
148
+ this.children.forEach((t) => t.walk(e)), e(this);
149
+ }
150
+ isLeaf() {
151
+ return this.children.length === 0;
152
+ }
153
+ isSplit() {
154
+ return this.children.length > 0;
155
+ }
156
+ isLeftRightSplit() {
157
+ return this.children.some((e) => e.position === v.Left || e.position === v.Right);
158
+ }
159
+ isTopBottomSplit() {
160
+ return this.children.some((e) => e.position === v.Top || e.position === v.Bottom);
161
+ }
162
+ get leftChild() {
163
+ return this.children.find((e) => e.position === v.Left);
164
+ }
165
+ get rightChild() {
166
+ return this.children.find((e) => e.position === v.Right);
167
+ }
168
+ get topChild() {
169
+ return this.children.find((e) => e.position === v.Top);
170
+ }
171
+ get bottomChild() {
172
+ return this.children.find((e) => e.position === v.Bottom);
173
+ }
174
+ getChildren() {
175
+ let e = null, t = null, n = null, r = null;
176
+ for (let i of this.children) i.position === v.Left ? e = i : i.position === v.Right ? t = i : i.position === v.Top ? n = i : i.position === v.Bottom && (r = i);
177
+ return [
178
+ n,
179
+ t,
180
+ r,
181
+ e
182
+ ];
183
+ }
184
+ getAllLeafDescendants() {
185
+ let e = [];
186
+ return this.walk((t) => {
187
+ t.children.length === 0 && e.push(t);
188
+ }), e;
189
+ }
190
+ calcMinWidth() {
191
+ if (this.isLeaf()) return this.minWidth;
192
+ let [e, t, n, r] = this.getChildren();
193
+ if (r && t) {
194
+ let e = r.calcMinWidth() + t.calcMinWidth();
195
+ return Math.max(this.minWidth, e);
196
+ }
197
+ if (e && n) {
198
+ let t = Math.max(e.calcMinWidth(), n.calcMinWidth());
199
+ return Math.max(this.minWidth, t);
200
+ }
201
+ }
202
+ calcMinHeight() {
203
+ if (this.isLeaf()) return this.minHeight;
204
+ let [e, t, n, r] = this.getChildren();
205
+ if (r && t) {
206
+ let e = Math.max(r.calcMinHeight(), t.calcMinHeight());
207
+ return Math.max(this.minHeight, e);
208
+ }
209
+ if (e && n) {
210
+ let t = e.calcMinHeight() + n.calcMinHeight();
211
+ return Math.max(this.minHeight, t);
212
+ }
213
+ }
214
+ getById(e) {
215
+ if (this.id === e) return this;
216
+ for (let t of this.children) {
217
+ let n = t.getById(e);
218
+ if (n) return n;
219
+ }
220
+ return null;
221
+ }
222
+ swapIds(e, t) {
223
+ let n = this.getById(e), r = this.getById(t);
224
+ if (!n || !r) throw Error("[bwin] Sash not found when swapping IDs");
225
+ let i = n.id;
226
+ n.id = r.id, r.id = i;
227
+ }
228
+ getAllIds() {
229
+ let e = [this.id];
230
+ for (let t of this.children) e.push(...t.getAllIds());
231
+ return e;
232
+ }
233
+ addChild(e) {
234
+ if (this.children.length >= 2) throw Error("[bwin] Maximum 2 children allowed");
235
+ this.children.push(e);
236
+ }
237
+ getDescendantParentById(e) {
238
+ for (let t of this.children) {
239
+ if (t.id === e) return this;
240
+ let n = t.getDescendantParentById(e);
241
+ if (n) return n;
242
+ }
243
+ return null;
244
+ }
245
+ getChildSiblingById(e) {
246
+ return this.children.find((t) => t.id !== e);
247
+ }
248
+ get top() {
249
+ return this._top;
250
+ }
251
+ set top(e) {
252
+ let t = e - this._top;
253
+ this._top = e;
254
+ let [n, r, i, a] = this.getChildren();
255
+ n && i && (n.top += t, i.top += t), a && r && (a.top += t, r.top += t);
256
+ }
257
+ get left() {
258
+ return this._left;
259
+ }
260
+ set left(e) {
261
+ let t = e - this._left;
262
+ this._left = e;
263
+ let [n, r, i, a] = this.getChildren();
264
+ a && r && (a.left += t, r.left += t), n && i && (n.left += t, i.left += t);
265
+ }
266
+ get width() {
267
+ return this._width;
268
+ }
269
+ set width(e) {
270
+ let t = e - this._width;
271
+ this._width = e;
272
+ let [n, r, i, a] = this.getChildren();
273
+ if (a && r) {
274
+ let e = a.width + r.width, n = t * (a.width / e), i = e + t, o, s, c;
275
+ if (this.resizeStrategy === "natural" && this.position === v.Left ? (o = a.width, s = r.width + t, c = r.left) : this.resizeStrategy === "natural" && this.position === v.Right ? (o = a.width + t, s = r.width, c = a.left + o) : (o = a.width + n, s = i - o, c = r.left + n), t < 0) {
276
+ let e = a.calcMinWidth(), t = r.calcMinWidth();
277
+ o < e && s > t ? (o = a.width, s = i - o, c = a.left + o) : s < t && o > e && (s = r.width, o = i - s, c = a.left + o);
278
+ }
279
+ a.width = o, r.width = s, r.left = c;
280
+ }
281
+ n && i && (n.width += t, i.width += t);
282
+ }
283
+ get height() {
284
+ return this._height;
285
+ }
286
+ set height(e) {
287
+ let t = e - this._height;
288
+ this._height = e;
289
+ let [n, r, i, a] = this.getChildren();
290
+ if (n && i) {
291
+ let e = n.height + i.height, r = t * (n.height / e), a = e + t, o, s, c;
292
+ if (this.resizeStrategy === "natural" && this.position === v.Top ? (o = n.height, s = i.height + t, c = i.top) : this.resizeStrategy === "natural" && this.position === v.Bottom ? (o = n.height + t, s = i.height, c = n.top + o) : (o = n.height + r, s = a - o, c = i.top + r), t < 0) {
293
+ let e = n.calcMinHeight(), t = i.calcMinHeight();
294
+ o < e && s > t ? (o = n.height, s = a - o, c = n.top + o) : s < t && o > e && (s = i.height, o = a - s, c = n.top + o);
295
+ }
296
+ n.height = o, i.height = s, i.top = c;
297
+ }
298
+ a && r && (a.height += t, r.height += t);
299
+ }
300
+ }, w = {
301
+ size: "50%",
302
+ position: v.Left
303
+ }, T = class e {
304
+ left;
305
+ top;
306
+ width;
307
+ height;
308
+ constructor({ parentRect: e, children: t, siblingConfigNode: n, id: r, minWidth: i, minHeight: a, position: o, size: s, resizeStrategy: c, ...l }) {
309
+ this.parentRect = e, this.children = t, this.siblingConfigNode = n, this.id = r, this.minWidth = i, this.minHeight = a, this.position = this.getPosition(o), this.size = this.getSize(s), this.resizeStrategy = c, this.nonCoreData = l, this.setBounds();
310
+ }
311
+ getPosition(e) {
312
+ if (!this.siblingConfigNode) return e;
313
+ let t = y(this.siblingConfigNode.position);
314
+ if (!e) return t;
315
+ if (e !== t) throw Error("[bwin] Sibling position and current position are not opposite");
316
+ return e;
317
+ }
318
+ getSize(e) {
319
+ if (!this.siblingConfigNode) return f(e);
320
+ if (!e) {
321
+ if (this.siblingConfigNode.size < 1) return 1 - this.siblingConfigNode.size;
322
+ if (this.siblingConfigNode.position === v.Left || this.siblingConfigNode.position === v.Right) return this.parentRect.width - this.siblingConfigNode.width;
323
+ if (this.siblingConfigNode.position === v.Top || this.siblingConfigNode.position === v.Bottom) return this.parentRect.height - this.siblingConfigNode.height;
324
+ }
325
+ let t = f(e);
326
+ if (t < 1) {
327
+ if (t + this.siblingConfigNode.size !== 1) throw Error("[bwin] Sum of sibling sizes is not equal to 1");
328
+ } else {
329
+ if ((this.position === v.Left || this.position === v.Right) && t + this.siblingConfigNode.size !== this.parentRect.width) throw Error("[bwin] Sum of sibling sizes is not equal to parent width");
330
+ if ((this.position === v.Top || this.position === v.Bottom) && t + this.siblingConfigNode.size !== this.parentRect.height) throw Error("[bwin] Sum of sibling sizes is not equal to parent height");
331
+ }
332
+ return t;
333
+ }
334
+ setBounds() {
335
+ if (this.position === v.Root) this.left = 0, this.top = 0, this.width = this.parentRect.width, this.height = this.parentRect.height;
336
+ else if (this.position === v.Left) {
337
+ let e = this.size < 1 ? this.parentRect.width * this.size : this.size;
338
+ this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = e, this.height = this.parentRect.height;
339
+ } else if (this.position === v.Right) {
340
+ let e = this.size < 1 ? this.parentRect.width * this.size : this.size;
341
+ this.left = this.parentRect.left + this.parentRect.width - e, this.top = this.parentRect.top, this.width = e, this.height = this.parentRect.height;
342
+ } else if (this.position === v.Top) {
343
+ let e = this.size < 1 ? this.parentRect.height * this.size : this.size;
344
+ this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = this.parentRect.width, this.height = e;
345
+ } else if (this.position === v.Bottom) {
346
+ let e = this.size < 1 ? this.parentRect.height * this.size : this.size;
347
+ this.left = this.parentRect.left, this.top = this.parentRect.top + this.parentRect.height - e, this.width = this.parentRect.width, this.height = e;
348
+ }
349
+ }
350
+ createSash({ resizeStrategy: e } = {}) {
351
+ return new C({
352
+ left: this.left,
353
+ top: this.top,
354
+ width: this.width,
355
+ height: this.height,
356
+ position: this.position,
357
+ id: this.id,
358
+ minWidth: this.minWidth,
359
+ minHeight: this.minHeight,
360
+ resizeStrategy: e || this.resizeStrategy,
361
+ store: this.nonCoreData
362
+ });
363
+ }
364
+ normConfig(e) {
365
+ if (p(e)) return e;
366
+ if (Array.isArray(e)) return { children: e };
367
+ if (typeof e == "string" || typeof e == "number") {
368
+ let t = f(e);
369
+ if (isNaN(t)) throw Error(`[bwin] Invalid size value: ${t}`);
370
+ return { size: e };
371
+ } else if (e == null) return {};
372
+ else throw Error(`[bwin] Invalid config value: ${e}`);
373
+ }
374
+ createPrimaryConfigNode({ size: t, position: n, children: r, id: i, minWidth: a, minHeight: o, ...s }) {
375
+ return new e({
376
+ parentRect: this,
377
+ size: t ?? w.size,
378
+ position: n ?? w.position,
379
+ children: r,
380
+ id: i,
381
+ minWidth: a,
382
+ minHeight: o,
383
+ ...s
384
+ });
385
+ }
386
+ createSecondaryConfigNode({ size: t, position: n, children: r, id: i, minWidth: a, minHeight: o, ...s }, c) {
387
+ return new e({
388
+ parentRect: this,
389
+ size: t,
390
+ position: n,
391
+ children: r,
392
+ siblingConfigNode: c,
393
+ id: i,
394
+ minWidth: a,
395
+ minHeight: o,
396
+ ...s
397
+ });
398
+ }
399
+ buildSashTree({ resizeStrategy: e } = {}) {
400
+ let t = this.createSash({ resizeStrategy: e });
401
+ if (!Array.isArray(this.children) || this.children.length === 0) return t;
402
+ let n = this.normConfig(this.children[0]), r = this.normConfig(this.children.at(1)), i, a;
403
+ if (!n.size && !n.position && r ? (r.position ||= v.Right, i = this.createPrimaryConfigNode(r), a = this.createSecondaryConfigNode(n, i)) : (i = this.createPrimaryConfigNode(n), a = this.createSecondaryConfigNode(r, i)), i && a) {
404
+ let n = i.buildSashTree({ resizeStrategy: e }), r = a.buildSashTree({ resizeStrategy: e });
405
+ n.parent = t, r.parent = t, t.children.push(n), t.children.push(r);
406
+ }
407
+ return t;
408
+ }
409
+ }, E = {
410
+ width: 333,
411
+ height: 333
412
+ }, D = {
413
+ fitContainer: !1,
414
+ theme: ""
415
+ }, O = class extends T {
416
+ constructor({ id: e, children: t, width: n = E.width, height: r = E.height, fitContainer: i = D.fitContainer, theme: a = D.theme, ...o } = {
417
+ ...E,
418
+ ...D
419
+ }) {
420
+ super({
421
+ id: e,
422
+ children: t,
423
+ size: NaN,
424
+ position: v.Root,
425
+ parentRect: {
426
+ width: n,
427
+ height: r
428
+ },
429
+ ...o
430
+ }), this.fitContainer = i, this.theme = a;
431
+ }
432
+ }, re = class extends C {
433
+ constructor(e = S) {
434
+ super({
435
+ ...e,
436
+ position: v.Root
437
+ }), Object.assign(this, D);
438
+ }
135
439
  };
136
- class b {
137
- constructor({
138
- left: t = v.left,
139
- top: i = v.top,
140
- width: n = v.width,
141
- height: s = v.height,
142
- minWidth: o = v.minWidth,
143
- minHeight: h = v.minHeight,
144
- domNode: r = null,
145
- store: d = {},
146
- position: l,
147
- id: c
148
- } = v) {
149
- if (this.id = c ?? S(), !l)
150
- throw new Error("[bwin] Sash position is required");
151
- this.position = l, this.domNode = r, this._top = i, this._left = t, this._width = n, this._height = s, this.children = [], this.minWidth = o, this.minHeight = h, this.store = d;
152
- }
153
- walk(t) {
154
- this.children.forEach((i) => i.walk(t)), t(this);
155
- }
156
- isLeaf() {
157
- return this.children.length === 0;
158
- }
159
- // A sash that doesn't split is a leaf, in UI it's a pane
160
- isSplit() {
161
- return this.children.length > 0;
162
- }
163
- isLeftRightSplit() {
164
- return this.children.some(
165
- (t) => t.position === a.Left || t.position === a.Right
166
- );
167
- }
168
- isTopBottomSplit() {
169
- return this.children.some(
170
- (t) => t.position === a.Top || t.position === a.Bottom
171
- );
172
- }
173
- get leftChild() {
174
- return this.children.find((t) => t.position === a.Left);
175
- }
176
- get rightChild() {
177
- return this.children.find((t) => t.position === a.Right);
178
- }
179
- get topChild() {
180
- return this.children.find((t) => t.position === a.Top);
181
- }
182
- get bottomChild() {
183
- return this.children.find((t) => t.position === a.Bottom);
184
- }
185
- getChildren() {
186
- let t = null, i = null, n = null, s = null;
187
- for (const o of this.children)
188
- o.position === a.Left ? t = o : o.position === a.Right ? i = o : o.position === a.Top ? n = o : o.position === a.Bottom && (s = o);
189
- return [n, i, s, t];
190
- }
191
- getAllLeafDescendants() {
192
- const t = [];
193
- return this.walk((i) => {
194
- i.children.length === 0 && t.push(i);
195
- }), t;
196
- }
197
- calcMinWidth() {
198
- if (this.isLeaf())
199
- return this.minWidth;
200
- const [t, i, n, s] = this.getChildren();
201
- if (s && i) {
202
- const o = s.calcMinWidth() + i.calcMinWidth();
203
- return Math.max(this.minWidth, o);
204
- }
205
- if (t && n) {
206
- const o = Math.max(t.calcMinWidth(), n.calcMinWidth());
207
- return Math.max(this.minWidth, o);
208
- }
209
- }
210
- calcMinHeight() {
211
- if (this.isLeaf())
212
- return this.minHeight;
213
- const [t, i, n, s] = this.getChildren();
214
- if (s && i) {
215
- const o = Math.max(s.calcMinHeight(), i.calcMinHeight());
216
- return Math.max(this.minHeight, o);
217
- }
218
- if (t && n) {
219
- const o = t.calcMinHeight() + n.calcMinHeight();
220
- return Math.max(this.minHeight, o);
221
- }
222
- }
223
- // Get self or descendant by id
224
- getById(t) {
225
- if (this.id === t)
226
- return this;
227
- for (const i of this.children) {
228
- const n = i.getById(t);
229
- if (n)
230
- return n;
231
- }
232
- return null;
233
- }
234
- swapIds(t, i) {
235
- const n = this.getById(t), s = this.getById(i);
236
- if (!n || !s)
237
- throw new Error("[bwin] Sash not found when swapping IDs");
238
- const o = n.id;
239
- n.id = s.id, s.id = o;
240
- }
241
- // Get all ids of self and descendants
242
- getAllIds() {
243
- const t = [this.id];
244
- for (const i of this.children)
245
- t.push(...i.getAllIds());
246
- return t;
247
- }
248
- addChild(t) {
249
- if (this.children.length >= 2)
250
- throw new Error("[bwin] Maximum 2 children allowed");
251
- this.children.push(t);
252
- }
253
- getDescendantParentById(t) {
254
- for (const i of this.children) {
255
- if (i.id === t)
256
- return this;
257
- const n = i.getDescendantParentById(t);
258
- if (n)
259
- return n;
260
- }
261
- return null;
262
- }
263
- getChildSiblingById(t) {
264
- return this.children.find((i) => i.id !== t);
265
- }
266
- get top() {
267
- return this._top;
268
- }
269
- set top(t) {
270
- const i = t - this._top;
271
- this._top = t;
272
- const [n, s, o, h] = this.getChildren();
273
- n && o && (n.top += i, o.top += i), h && s && (h.top += i, s.top += i);
274
- }
275
- get left() {
276
- return this._left;
277
- }
278
- set left(t) {
279
- const i = t - this._left;
280
- this._left = t;
281
- const [n, s, o, h] = this.getChildren();
282
- h && s && (h.left += i, s.left += i), n && o && (n.left += i, o.left += i);
283
- }
284
- get width() {
285
- return this._width;
286
- }
287
- set width(t) {
288
- const i = t - this._width;
289
- this._width = t;
290
- const [n, s, o, h] = this.getChildren();
291
- if (h && s) {
292
- const r = h.width + s.width, d = i * (h.width / r), l = r + i;
293
- let c = h.width + d, u = l - c, g = s.left + d;
294
- const w = h.calcMinWidth(), m = s.calcMinWidth();
295
- i < 0 && (c < w && u > m ? (c = h.width, u = l - c, g = h.left + c) : u < m && c > w && (u = s.width, c = l - u, g = h.left + c)), h.width = c, s.width = u, s.left = g;
296
- }
297
- n && o && (n.width += i, o.width += i);
298
- }
299
- get height() {
300
- return this._height;
301
- }
302
- set height(t) {
303
- const i = t - this._height;
304
- this._height = t;
305
- const [n, s, o, h] = this.getChildren();
306
- if (n && o) {
307
- const r = n.height + o.height, d = i * (n.height / r), l = r + i;
308
- let c = n.height + d, u = l - c, g = o.top + d;
309
- if (i < 0) {
310
- const w = n.calcMinHeight(), m = o.calcMinHeight();
311
- c < w && u > m ? (c = n.height, u = l - c, g = n.top + c) : u < m && c > w && (u = o.height, c = l - u, g = n.top + c);
312
- }
313
- n.height = c, o.height = u, o.top = g;
314
- }
315
- h && s && (h.height += i, s.height += i);
316
- }
440
+ function ie(e) {
441
+ let t = document.createElement("bw-pane");
442
+ return t.style.top = `${e.top}px`, t.style.left = `${e.left}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.setAttribute("sash-id", e.id), t.setAttribute("position", e.position), t;
317
443
  }
318
- const H = {
319
- size: "50%",
320
- position: a.Left
321
- };
322
- class R {
323
- constructor({
324
- parentRect: t,
325
- children: i,
326
- siblingConfigNode: n,
327
- id: s,
328
- minWidth: o,
329
- minHeight: h,
330
- position: r,
331
- size: d,
332
- ...l
333
- }) {
334
- y(this, "left"), y(this, "top"), y(this, "width"), y(this, "height"), this.parentRect = t, this.children = i, this.siblingConfigNode = n, this.id = s, this.minWidth = o, this.minHeight = h, this.position = this.getPosition(r), this.size = this.getSize(d), this.nonCoreData = l, this.setBounds();
335
- }
336
- getPosition(t) {
337
- if (!this.siblingConfigNode)
338
- return t;
339
- const i = st(this.siblingConfigNode.position);
340
- if (!t)
341
- return i;
342
- if (t !== i)
343
- throw new Error("[bwin] Sibling position and current position are not opposite");
344
- return t;
345
- }
346
- getSize(t) {
347
- if (!this.siblingConfigNode)
348
- return z(t);
349
- if (!t) {
350
- if (this.siblingConfigNode.size < 1)
351
- return 1 - this.siblingConfigNode.size;
352
- if (this.siblingConfigNode.position === a.Left || this.siblingConfigNode.position === a.Right)
353
- return this.parentRect.width - this.siblingConfigNode.width;
354
- if (this.siblingConfigNode.position === a.Top || this.siblingConfigNode.position === a.Bottom)
355
- return this.parentRect.height - this.siblingConfigNode.height;
356
- }
357
- const i = z(t);
358
- if (i < 1) {
359
- if (i + this.siblingConfigNode.size !== 1)
360
- throw new Error("[bwin] Sum of sibling sizes is not equal to 1");
361
- } else {
362
- if ((this.position === a.Left || this.position === a.Right) && i + this.siblingConfigNode.size !== this.parentRect.width)
363
- throw new Error("[bwin] Sum of sibling sizes is not equal to parent width");
364
- if ((this.position === a.Top || this.position === a.Bottom) && i + this.siblingConfigNode.size !== this.parentRect.height)
365
- throw new Error("[bwin] Sum of sibling sizes is not equal to parent height");
366
- }
367
- return i;
368
- }
369
- setBounds() {
370
- if (this.position === a.Root)
371
- this.left = 0, this.top = 0, this.width = this.parentRect.width, this.height = this.parentRect.height;
372
- else if (this.position === a.Left) {
373
- const t = this.size < 1 ? this.parentRect.width * this.size : this.size;
374
- this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = t, this.height = this.parentRect.height;
375
- } else if (this.position === a.Right) {
376
- const t = this.size < 1 ? this.parentRect.width * this.size : this.size;
377
- this.left = this.parentRect.left + this.parentRect.width - t, this.top = this.parentRect.top, this.width = t, this.height = this.parentRect.height;
378
- } else if (this.position === a.Top) {
379
- const t = this.size < 1 ? this.parentRect.height * this.size : this.size;
380
- this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = this.parentRect.width, this.height = t;
381
- } else if (this.position === a.Bottom) {
382
- const t = this.size < 1 ? this.parentRect.height * this.size : this.size;
383
- this.left = this.parentRect.left, this.top = this.parentRect.top + this.parentRect.height - t, this.width = this.parentRect.width, this.height = t;
384
- }
385
- }
386
- createSash() {
387
- return new b({
388
- left: this.left,
389
- top: this.top,
390
- width: this.width,
391
- height: this.height,
392
- position: this.position,
393
- id: this.id,
394
- minWidth: this.minWidth,
395
- minHeight: this.minHeight,
396
- store: this.nonCoreData
397
- });
398
- }
399
- normConfig(t) {
400
- if (et(t))
401
- return t;
402
- if (Array.isArray(t))
403
- return {
404
- children: t
405
- };
406
- if (typeof t == "string" || typeof t == "number") {
407
- const i = z(t);
408
- if (isNaN(i))
409
- throw new Error(`[bwin] Invalid size value: ${i}`);
410
- return {
411
- size: t
412
- };
413
- } else {
414
- if (t == null)
415
- return {};
416
- throw new Error(`[bwin] Invalid config value: ${t}`);
417
- }
418
- }
419
- createPrimaryConfigNode({ size: t, position: i, children: n, id: s, minWidth: o, minHeight: h, ...r }) {
420
- return new R({
421
- parentRect: this,
422
- size: t ?? H.size,
423
- position: i ?? H.position,
424
- children: n,
425
- id: s,
426
- minWidth: o,
427
- minHeight: h,
428
- ...r
429
- });
430
- }
431
- createSecondaryConfigNode({ size: t, position: i, children: n, id: s, minWidth: o, minHeight: h, ...r }, d) {
432
- return new R({
433
- parentRect: this,
434
- size: t,
435
- position: i,
436
- children: n,
437
- siblingConfigNode: d,
438
- id: s,
439
- minWidth: o,
440
- minHeight: h,
441
- ...r
442
- });
443
- }
444
- buildSashTree() {
445
- const t = this.createSash();
446
- if (!Array.isArray(this.children) || this.children.length === 0)
447
- return t;
448
- const i = this.normConfig(this.children[0]), n = this.normConfig(this.children.at(1));
449
- let s, o;
450
- return !i.size && !i.position && n ? (n.position || (n.position = a.Right), s = this.createPrimaryConfigNode(n), o = this.createSecondaryConfigNode(
451
- i,
452
- s
453
- )) : (s = this.createPrimaryConfigNode(i), o = this.createSecondaryConfigNode(
454
- n,
455
- s
456
- )), s && o && (t.children.push(s.buildSashTree()), t.children.push(o.buildSashTree())), t;
457
- }
458
- }
459
- const L = {
460
- width: 333,
461
- height: 333
462
- }, T = {
463
- fitContainer: !1
464
- };
465
- class pt extends R {
466
- constructor({
467
- id: t,
468
- children: i,
469
- width: n = L.width,
470
- height: s = L.height,
471
- fitContainer: o = T.fitContainer,
472
- ...h
473
- } = {
474
- ...L,
475
- ...T
476
- }) {
477
- super({
478
- id: t,
479
- children: i,
480
- size: NaN,
481
- position: a.Root,
482
- parentRect: { width: n, height: s },
483
- ...h
484
- }), this.fitContainer = o;
485
- }
486
- }
487
- class ut extends b {
488
- constructor(t = v) {
489
- super({ ...t, position: a.Root }), Object.assign(this, T);
490
- }
491
- }
492
- function gt(e) {
493
- const t = document.createElement("bw-pane");
494
- return t.style.top = `${e.top}px`, t.style.left = `${e.left}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.setAttribute("sash-id", e.id), t.setAttribute("position", e.position), t;
444
+ function k(e) {
445
+ let t = e.domNode;
446
+ return t.style.top = `${e.top}px`, t.style.left = `${e.left}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.setAttribute("position", e.position), t;
495
447
  }
496
- function ft(e) {
497
- const t = e.domNode;
498
- return t.style.top = `${e.top}px`, t.style.left = `${e.left}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.setAttribute("position", e.position), t;
448
+ function A(e, { size: t, id: n }) {
449
+ let r = f(t), i = e.width / 2;
450
+ r && (i = r < 1 ? e.width * r : r);
451
+ let a = new C({
452
+ id: n,
453
+ top: e.top,
454
+ left: e.left,
455
+ width: i,
456
+ height: e.height,
457
+ position: v.Left
458
+ }), o = new C({
459
+ id: e.id,
460
+ top: e.top,
461
+ left: e.left + a.width,
462
+ width: e.width - i,
463
+ height: e.height,
464
+ position: v.Right,
465
+ domNode: e.domNode
466
+ });
467
+ return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), a;
499
468
  }
500
- function wt(e, { size: t, id: i }) {
501
- const n = z(t);
502
- let s = e.width / 2;
503
- n && (n < 1 ? s = e.width * n : s = n);
504
- const o = new b({
505
- id: i,
506
- top: e.top,
507
- left: e.left,
508
- width: s,
509
- height: e.height,
510
- position: a.Left
511
- }), h = new b({
512
- id: e.id,
513
- top: e.top,
514
- left: e.left + o.width,
515
- width: e.width - s,
516
- height: e.height,
517
- position: a.Right,
518
- domNode: e.domNode
519
- });
520
- return e.addChild(o), e.addChild(h), e.domNode = null, e.id = S(), o;
469
+ function j(e, { size: t, id: n }) {
470
+ let r = f(t), i = e.width / 2;
471
+ r && (i = r < 1 ? e.width * r : r);
472
+ let a = new C({
473
+ id: e.id,
474
+ left: e.left,
475
+ top: e.top,
476
+ width: e.width - i,
477
+ height: e.height,
478
+ position: v.Left,
479
+ domNode: e.domNode
480
+ }), o = new C({
481
+ id: n,
482
+ left: e.left + a.width,
483
+ top: e.top,
484
+ width: i,
485
+ height: e.height,
486
+ position: v.Right
487
+ });
488
+ return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), o;
521
489
  }
522
- function mt(e, { size: t, id: i }) {
523
- const n = z(t);
524
- let s = e.width / 2;
525
- n && (n < 1 ? s = e.width * n : s = n);
526
- const o = new b({
527
- id: e.id,
528
- left: e.left,
529
- top: e.top,
530
- width: e.width - s,
531
- height: e.height,
532
- position: a.Left,
533
- domNode: e.domNode
534
- }), h = new b({
535
- id: i,
536
- left: e.left + o.width,
537
- top: e.top,
538
- width: s,
539
- height: e.height,
540
- position: a.Right
541
- });
542
- return e.addChild(o), e.addChild(h), e.domNode = null, e.id = S(), h;
490
+ function M(e, { size: t, id: n }) {
491
+ let r = f(t), i = e.height / 2;
492
+ r && (i = r < 1 ? e.height * r : r);
493
+ let a = new C({
494
+ id: n,
495
+ left: e.left,
496
+ top: e.top,
497
+ width: e.width,
498
+ height: i,
499
+ position: v.Top
500
+ }), o = new C({
501
+ id: e.id,
502
+ left: e.left,
503
+ top: e.top + a.height,
504
+ width: e.width,
505
+ height: e.height - i,
506
+ position: v.Bottom,
507
+ domNode: e.domNode
508
+ });
509
+ return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), a;
543
510
  }
544
- function bt(e, { size: t, id: i }) {
545
- const n = z(t);
546
- let s = e.height / 2;
547
- n && (n < 1 ? s = e.height * n : s = n);
548
- const o = new b({
549
- id: i,
550
- left: e.left,
551
- top: e.top,
552
- width: e.width,
553
- height: s,
554
- position: a.Top
555
- }), h = new b({
556
- id: e.id,
557
- left: e.left,
558
- top: e.top + o.height,
559
- width: e.width,
560
- height: e.height - s,
561
- position: a.Bottom,
562
- domNode: e.domNode
563
- });
564
- return e.addChild(o), e.addChild(h), e.domNode = null, e.id = S(), o;
511
+ function N(e, { size: t, id: n }) {
512
+ let r = f(t), i = e.height / 2;
513
+ r && (i = r < 1 ? e.height * r : r);
514
+ let a = new C({
515
+ id: e.id,
516
+ top: e.top,
517
+ left: e.left,
518
+ width: e.width,
519
+ height: e.height - i,
520
+ position: v.Top,
521
+ domNode: e.domNode
522
+ }), o = new C({
523
+ id: n,
524
+ top: e.top + a.height,
525
+ left: e.left,
526
+ width: e.width,
527
+ height: i,
528
+ position: v.Bottom
529
+ });
530
+ return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), o;
565
531
  }
566
- function yt(e, { size: t, id: i }) {
567
- const n = z(t);
568
- let s = e.height / 2;
569
- n && (n < 1 ? s = e.height * n : s = n);
570
- const o = new b({
571
- id: e.id,
572
- top: e.top,
573
- left: e.left,
574
- width: e.width,
575
- height: e.height - s,
576
- position: a.Top,
577
- domNode: e.domNode
578
- }), h = new b({
579
- id: i,
580
- top: e.top + o.height,
581
- left: e.left,
582
- width: e.width,
583
- height: s,
584
- position: a.Bottom
585
- });
586
- return e.addChild(o), e.addChild(h), e.domNode = null, e.id = S(), h;
532
+ function P(e, { position: t, size: n, id: r, minWidth: i, minHeight: a }) {
533
+ if (t === v.Left) return A(e, {
534
+ size: n,
535
+ id: r
536
+ });
537
+ if (t === v.Right) return j(e, {
538
+ size: n,
539
+ id: r
540
+ });
541
+ if (t === v.Top) return M(e, {
542
+ size: n,
543
+ id: r
544
+ });
545
+ if (t === v.Bottom) return N(e, {
546
+ size: n,
547
+ id: r
548
+ });
587
549
  }
588
- function Et(e, { position: t, size: i, id: n, minWidth: s, minHeight: o }) {
589
- if (t === a.Left)
590
- return wt(e, { size: i, id: n });
591
- if (t === a.Right)
592
- return mt(e, { size: i, id: n });
593
- if (t === a.Top)
594
- return bt(e, { size: i, id: n });
595
- if (t === a.Bottom)
596
- return yt(e, { size: i, id: n });
550
+ function F(e) {
551
+ if (e.tagName === "BW-PANE") return e.getAttribute("sash-id");
552
+ let t = e.closest("bw-pane");
553
+ if (!t) throw Error("[bwin] Pane element not found");
554
+ return t.getAttribute("sash-id");
597
555
  }
598
- function P(e) {
599
- if (e.tagName === "BW-PANE")
600
- return e.getAttribute("sash-id");
601
- const t = e.closest("bw-pane");
602
- if (!t)
603
- throw new Error("[bwin] Pane element not found");
604
- return t.getAttribute("sash-id");
605
- }
606
- const vt = {
607
- createPane(e) {
608
- const t = gt(e);
609
- return e.store.droppable === !1 && t.setAttribute("can-drop", "false"), t;
610
- },
611
- // Intended to be overridden
612
- onPaneCreate(e, t) {
613
- t.store.content && e.append(N(t.store.content)), this != null && this.debug && (e.style.backgroundColor = Q(), e.innerHTML = "", e.append(I(e)));
614
- },
615
- updatePane(e) {
616
- return ft(e);
617
- },
618
- // Intended to be overridden
619
- onPaneUpdate(e, t) {
620
- this != null && this.debug && (e.innerHTML = "", e.append(I(e)));
621
- },
622
- /**
623
- * Add a pane into the target pane. The two panes become next to each other
624
- *
625
- * @param {string} targetPaneSashId - The Sash ID of the target pane that the new pane moves into
626
- * @param {'top'|'right'|'bottom'|'left'} position - The position of the new pane relative to the target pane
627
- * @returns {Sash} - The newly created sash
628
- */
629
- addPane(e, { position: t, size: i, id: n }) {
630
- if (!t) throw new Error("[bwin] Position is required when adding pane");
631
- const s = this.rootSash.getById(e);
632
- if (!s) throw new Error("[bwin] Parent sash not found when adding pane");
633
- const o = Et(s, { position: t, size: i, id: n });
634
- return this.update(), o;
635
- },
636
- /**
637
- * Remove a pane
638
- *
639
- * @param {string} sashId - The Sash ID of the pane to be removed
640
- */
641
- removePane(e) {
642
- const t = this.rootSash.getDescendantParentById(e);
643
- if (!t) throw new Error("[bwin] Parent sash not found when removing pane");
644
- const i = t.getChildSiblingById(e);
645
- i.children.length === 0 ? (t.id = i.id, t.domNode = i.domNode, t.domNode.setAttribute("sash-id", i.id), t.children = []) : (t.id = S(), t.children = i.children, i.position === a.Left ? i.width = t.width : i.position === a.Right ? (i.width = t.width, i.left = t.left) : i.position === a.Top ? i.height = t.height : i.position === a.Bottom && (i.height = t.height, i.top = t.top)), this.update();
646
- },
647
- swapPanes(e, t) {
648
- const i = P(e), n = P(t), s = e.getAttribute("can-drop") !== "false", o = t.getAttribute("can-drop") !== "false";
649
- this.rootSash.swapIds(i, n), tt(e, this.activeDropPaneEl), e.setAttribute("sash-id", n), t.setAttribute("sash-id", i), e.setAttribute("can-drop", o), t.setAttribute("can-drop", s);
650
- }
556
+ var I = {
557
+ createPane(e) {
558
+ let t = ie(e);
559
+ return e.store.droppable === !1 && t.setAttribute("can-drop", "false"), t;
560
+ },
561
+ onPaneCreate(e, t) {
562
+ t.store.content && e.append(g(t.store.content)), this?.debug && (e.style.backgroundColor = c(), e.innerHTML = "", e.append(L(e)));
563
+ },
564
+ updatePane(e) {
565
+ return k(e);
566
+ },
567
+ onPaneUpdate(e, t) {
568
+ this?.debug && (e.innerHTML = "", e.append(L(e)));
569
+ },
570
+ addPane(e, { position: t, size: n, id: r }) {
571
+ if (!t) throw Error("[bwin] Position is required when adding pane");
572
+ let i = this.rootSash.getById(e);
573
+ if (!i) throw Error("[bwin] Parent sash not found when adding pane");
574
+ let a = P(i, {
575
+ position: t,
576
+ size: n,
577
+ id: r
578
+ });
579
+ return this.update(), a;
580
+ },
581
+ removePane(e) {
582
+ let t = this.rootSash.getDescendantParentById(e);
583
+ if (!t) throw Error("[bwin] Parent sash not found when removing pane");
584
+ let n = t.getChildSiblingById(e);
585
+ n.children.length === 0 ? (t.id = n.id, t.domNode = n.domNode, t.domNode.setAttribute("sash-id", n.id), t.children = []) : (t.id = l(), t.children = n.children, n.position === v.Left ? n.width = t.width : n.position === v.Right ? (n.width = t.width, n.left = t.left) : n.position === v.Top ? n.height = t.height : n.position === v.Bottom && (n.height = t.height, n.top = t.top)), this.update();
586
+ },
587
+ swapPanes(e, t) {
588
+ let n = F(e), r = F(t), i = e.getAttribute("can-drop") !== "false", a = t.getAttribute("can-drop") !== "false";
589
+ this.rootSash.swapIds(n, r), d(e, this.activeDropPaneEl), e.setAttribute("sash-id", r), t.setAttribute("sash-id", n), e.setAttribute("can-drop", a), t.setAttribute("can-drop", i);
590
+ }
651
591
  };
652
- function I(e) {
653
- const t = document.createElement("pre");
654
- t.style.fontSize = "10px";
655
- const i = `
592
+ function L(e) {
593
+ let t = document.createElement("pre");
594
+ return t.style.fontSize = "10px", t.innerHTML = `
656
595
  ${e.getAttribute("sash-id")}
657
596
  ${e.getAttribute("position")}
658
597
  top: ${e.style.top}
659
598
  left: ${e.style.left}
660
599
  width: ${e.style.width}
661
600
  height: ${e.style.height}
662
- `;
663
- return t.innerHTML = i.trim(), t;
664
- }
665
- const Nt = {
666
- createWindow() {
667
- const e = document.createElement("bw-window");
668
- return e.style.width = `${this.rootSash.width}px`, e.style.height = `${this.rootSash.height}px`, e.setAttribute("root-sash-id", this.rootSash.id), e;
669
- },
670
- glaze() {
671
- this.rootSash.walk((e) => {
672
- let t = null;
673
- e.children.length > 0 ? (t = this.createMuntin(e), this.onMuntinCreate(t, e), this.windowElement.append(t)) : (t = this.createPane(e), this.onPaneCreate(t, e), this.windowElement.prepend(t)), e.domNode = t;
674
- });
675
- },
676
- update() {
677
- this.windowElement.style.width = `${this.rootSash.width}px`, this.windowElement.style.height = `${this.rootSash.height}px`;
678
- const e = this.rootSash.getAllIds(), t = [];
679
- this.windowElement.querySelectorAll("[sash-id]").forEach((i) => {
680
- const n = i.getAttribute("sash-id");
681
- t.push(n), e.includes(n) || i.remove();
682
- }), this.rootSash.walk((i) => {
683
- i.children.length > 0 ? t.includes(i.id) ? (this.updateMuntin(i), this.onMuntinUpdate(i.domNode, i)) : (i.domNode = this.createMuntin(i), this.windowElement.append(i.domNode)) : t.includes(i.id) ? (this.updatePane(i), this.onPaneUpdate(i.domNode, i)) : (i.domNode || (i.domNode = this.createPane(i)), this.windowElement.prepend(i.domNode));
684
- });
685
- }
686
- }, zt = {
687
- muntinSize: 4,
688
- createMuntin(e) {
689
- const t = document.createElement("bw-muntin"), i = e.leftChild, n = e.topChild;
690
- return i ? (t.style.width = `${this.muntinSize}px`, t.style.height = `${e.height}px`, t.style.top = `${e.top}px`, t.style.left = `${e.left + i.width - this.muntinSize / 2}px`, t.setAttribute("vertical", "")) : n && (t.style.width = `${e.width}px`, t.style.height = `${this.muntinSize}px`, t.style.top = `${e.top + n.height - this.muntinSize / 2}px`, t.style.left = `${e.left}px`, t.setAttribute("horizontal", "")), t.setAttribute("sash-id", e.id), e.store.resizable === !1 && t.setAttribute("resizable", "false"), t;
691
- },
692
- onMuntinCreate(e, t) {
693
- },
694
- updateMuntin(e) {
695
- const t = e.domNode, i = e.leftChild, n = e.topChild;
696
- i ? (t.style.height = `${e.height}px`, t.style.top = `${e.top}px`, t.style.left = `${e.left + i.width - this.muntinSize / 2}px`) : n && (t.style.width = `${e.width}px`, t.style.top = `${e.top + n.height - this.muntinSize / 2}px`, t.style.left = `${e.left}px`);
697
- },
698
- onMuntinUpdate(e, t) {
699
- }
700
- }, St = {
701
- fitContainer: !1,
702
- fit() {
703
- this.rootSash.width = this.containerElement.clientWidth, this.rootSash.height = this.containerElement.clientHeight, this.update();
704
- },
705
- enableFitContainer() {
706
- new ResizeObserver((e) => {
707
- for (const t of e)
708
- t.target === this.containerElement && this.fitContainer && this.fit();
709
- }).observe(this.containerElement);
710
- }
711
- }, Ct = {
712
- activeMuntinSash: null,
713
- isResizeStarted: !1,
714
- isDropStarted: !1,
715
- lastX: 0,
716
- lastY: 0,
717
- applyResizeStyles() {
718
- this.activeMuntinSash.domNode.hasAttribute("vertical") ? document.body.classList.add("body--bw-resize-x") : this.activeMuntinSash.domNode.hasAttribute("horizontal") && document.body.classList.add("body--bw-resize-y");
719
- },
720
- revertResizeStyles() {
721
- document.body.classList.remove("body--bw-resize-x"), document.body.classList.remove("body--bw-resize-y");
722
- },
723
- enableResize() {
724
- document.addEventListener("mousedown", (e) => {
725
- if (e.target.tagName !== "BW-MUNTIN" || e.target.getAttribute("resizable") === "false") return;
726
- const t = e.target.getAttribute("sash-id");
727
- this.activeMuntinSash = this.rootSash.getById(t), this.activeMuntinSash && (this.isResizeStarted = !0, this.lastX = e.pageX, this.lastY = e.pageY, this.applyResizeStyles());
728
- }), document.addEventListener("mousemove", (e) => {
729
- if (!this.isResizeStarted || !this.activeMuntinSash) return;
730
- const [t, i, n, s] = this.activeMuntinSash.getChildren(), o = this.activeMuntinSash.isLeftRightSplit(), h = this.activeMuntinSash.isTopBottomSplit();
731
- if (o && s && i) {
732
- const r = e.pageX - this.lastX, d = s.width + r, l = i.width - r;
733
- if (r > 0 && l <= i.calcMinWidth() || r < 0 && d <= s.calcMinWidth()) return;
734
- s.width = d, i.width = l, i.left = i.left + r, this.update(), this.lastX = e.pageX;
735
- } else if (h && t && n) {
736
- const r = e.pageY - this.lastY, d = t.height + r, l = n.height - r;
737
- if (r > 0 && l <= n.calcMinHeight() || r < 0 && d <= t.calcMinHeight()) return;
738
- t.height = d, n.height = l, n.top = n.top + r, this.update(), this.lastY = e.pageY;
739
- }
740
- }), document.addEventListener("mouseup", () => {
741
- this.isResizeStarted = !1, this.activeMuntinSash = null, this.revertResizeStyles();
742
- });
743
- }
744
- }, At = {
745
- activeDropPaneEl: null,
746
- // Intended to be overridden in `BinaryWindow` class
747
- onPaneDrop(e, t) {
748
- },
749
- enableDrop() {
750
- this.windowElement.addEventListener("dragover", (e) => {
751
- e.preventDefault();
752
- const t = e.target.matches("bw-pane") ? e.target : e.target.closest("bw-pane");
753
- if (!t || (t !== this.activeDropPaneEl && (this.activeDropPaneEl && this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = t), t.getAttribute("can-drop") === "false")) return;
754
- const i = lt(t, e);
755
- t.setAttribute("drop-area", i);
756
- }), this.windowElement.addEventListener("dragleave", (e) => {
757
- e.currentTarget.contains(e.relatedTarget) && e.currentTarget !== e.relatedTarget || this.activeDropPaneEl && (this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null);
758
- }), this.windowElement.addEventListener("drop", (e) => {
759
- if (!this.activeDropPaneEl || this.activeDropPaneEl.getAttribute("can-drop") === "false") return;
760
- const t = this.activeDropPaneEl.getAttribute("sash-id"), i = this.rootSash.getById(t);
761
- this.onPaneDrop(e, i), typeof i.store.onDrop == "function" && i.store.onDrop(e, i), this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null;
762
- });
763
- }
764
- }, Mt = !1;
765
- class G {
766
- constructor(t) {
767
- y(this, "windowElement", null), y(this, "containerElement", null), y(this, "debug", Mt);
768
- let i = null;
769
- t instanceof ut ? (i = t, this.rootSash = t) : (i = new pt(t), this.rootSash = i.buildSashTree()), this.fitContainer = i.fitContainer;
770
- }
771
- frame(t) {
772
- this.containerElement = t, this.windowElement = this.createWindow(), this.glaze(), this.containerElement.append(this.windowElement);
773
- }
774
- // Features can work independently to each other
775
- enableFeatures() {
776
- this.enableResize(), this.enableDrop(), this.fitContainer && this.enableFitContainer();
777
- }
778
- mount(t) {
779
- this.frame(t), this.enableFeatures();
780
- }
781
- static assemble(...t) {
782
- t.forEach((i) => {
783
- it(this.prototype, i);
784
- });
785
- }
601
+ `.trim(), t;
786
602
  }
787
- G.assemble(
788
- Nt,
789
- zt,
790
- vt,
791
- St,
792
- At,
793
- Ct
794
- );
795
- const Rt = {
796
- label: "",
797
- className: "bw-glass-action--close",
798
- onClick: (e, t) => {
799
- const i = P(e.target);
800
- t.removePane(i);
801
- }
802
- }, Pt = {
803
- label: "",
804
- className: "bw-glass-action--minimize",
805
- onClick: (e, t) => {
806
- const i = t.sillElement;
807
- if (!i) throw new Error("[bwin] Sill element not found when minimizing");
808
- const n = N('<button class="bw-minimized-glass" />');
809
- i.append(n);
810
- const s = e.target.closest("bw-pane"), o = e.target.closest("bw-glass"), h = s.getAttribute("sash-id"), r = s.getAttribute("position");
811
- n.bwGlassElement = o, n.bwOriginalPosition = r, n.bwOriginalBoundingRect = M(s), n.bwOriginalSashId = h, t.removePane(h);
812
- }
813
- }, xt = {
814
- label: "",
815
- className: "bw-glass-action--maximize",
816
- onClick: (e) => {
817
- const t = e.target.closest("bw-pane");
818
- t.hasAttribute("maximized") ? (t.removeAttribute("maximized"), t.style.left = `${t.bwOriginalBoundingRect.left}px`, t.style.top = `${t.bwOriginalBoundingRect.top}px`, t.style.width = `${t.bwOriginalBoundingRect.width}px`, t.style.height = `${t.bwOriginalBoundingRect.height}px`) : (t.setAttribute("maximized", ""), t.bwOriginalBoundingRect = M(t), t.style.left = "0", t.style.top = "0", t.style.width = "100%", t.style.height = "100%");
819
- }
603
+ var R = {
604
+ createWindow({ theme: e } = {}) {
605
+ let t = document.createElement("bw-window");
606
+ return t.style.width = `${this.rootSash.width}px`, t.style.height = `${this.rootSash.height}px`, t.setAttribute("root-sash-id", this.rootSash.id), e && t.setAttribute("theme", e), t;
607
+ },
608
+ glaze() {
609
+ this.rootSash.walk((e) => {
610
+ let t = null;
611
+ e.children.length > 0 ? (t = this.createMuntin(e), this.onMuntinCreate(t, e), this.windowElement.append(t)) : (t = this.createPane(e), this.onPaneCreate(t, e), this.windowElement.prepend(t)), e.domNode = t;
612
+ });
613
+ },
614
+ update() {
615
+ this.windowElement.style.width = `${this.rootSash.width}px`, this.windowElement.style.height = `${this.rootSash.height}px`;
616
+ let e = this.rootSash.getAllIds(), t = [];
617
+ this.windowElement.querySelectorAll("[sash-id]").forEach((n) => {
618
+ let r = n.getAttribute("sash-id");
619
+ t.push(r), e.includes(r) || n.remove();
620
+ }), this.rootSash.walk((e) => {
621
+ e.children.length > 0 ? t.includes(e.id) ? (this.updateMuntin(e), this.onMuntinUpdate(e.domNode, e)) : (e.domNode = this.createMuntin(e), this.windowElement.append(e.domNode)) : t.includes(e.id) ? (this.updatePane(e), this.onPaneUpdate(e.domNode, e)) : (e.domNode ||= this.createPane(e), this.windowElement.prepend(e.domNode));
622
+ });
623
+ }
624
+ }, z = {
625
+ muntinSize: 4,
626
+ createMuntin(e) {
627
+ let t = document.createElement("bw-muntin"), n = e.leftChild, r = e.topChild;
628
+ return n ? (t.style.width = `${this.muntinSize}px`, t.style.height = `${e.height}px`, t.style.top = `${e.top}px`, t.style.left = `${e.left + n.width - this.muntinSize / 2}px`, t.setAttribute("vertical", "")) : r && (t.style.width = `${e.width}px`, t.style.height = `${this.muntinSize}px`, t.style.top = `${e.top + r.height - this.muntinSize / 2}px`, t.style.left = `${e.left}px`, t.setAttribute("horizontal", "")), t.setAttribute("sash-id", e.id), e.store.resizable === !1 && t.setAttribute("resizable", "false"), t;
629
+ },
630
+ onMuntinCreate(e, t) {},
631
+ updateMuntin(e) {
632
+ let t = e.domNode, n = e.leftChild, r = e.topChild;
633
+ n ? (t.style.height = `${e.height}px`, t.style.top = `${e.top}px`, t.style.left = `${e.left + n.width - this.muntinSize / 2}px`) : r && (t.style.width = `${e.width}px`, t.style.top = `${e.top + r.height - this.muntinSize / 2}px`, t.style.left = `${e.left}px`);
634
+ },
635
+ onMuntinUpdate(e, t) {}
636
+ }, B = {
637
+ fitContainer: !1,
638
+ fit() {
639
+ this.rootSash.width = this.containerElement.clientWidth, this.rootSash.height = this.containerElement.clientHeight, this.update();
640
+ },
641
+ enableFitContainer() {
642
+ new ResizeObserver((e) => {
643
+ requestAnimationFrame(() => {
644
+ for (let t of e) t.target === this.containerElement && this.fitContainer && this.fit();
645
+ });
646
+ }).observe(this.containerElement);
647
+ }
648
+ }, V = {
649
+ activeMuntinSash: null,
650
+ isResizeStarted: !1,
651
+ isDropStarted: !1,
652
+ lastX: 0,
653
+ lastY: 0,
654
+ applyResizeStyles() {
655
+ this.activeMuntinSash.domNode.hasAttribute("vertical") ? document.body.classList.add("body--bw-resize-x") : this.activeMuntinSash.domNode.hasAttribute("horizontal") && document.body.classList.add("body--bw-resize-y");
656
+ },
657
+ revertResizeStyles() {
658
+ document.body.classList.remove("body--bw-resize-x"), document.body.classList.remove("body--bw-resize-y");
659
+ },
660
+ enableResize() {
661
+ document.addEventListener("mousedown", (e) => {
662
+ if (e.target.tagName !== "BW-MUNTIN" || e.target.getAttribute("resizable") === "false") return;
663
+ let t = e.target.getAttribute("sash-id");
664
+ this.activeMuntinSash = this.rootSash.getById(t), this.activeMuntinSash && (this.isResizeStarted = !0, this.lastX = e.pageX, this.lastY = e.pageY, this.applyResizeStyles());
665
+ }), document.addEventListener("mousemove", (e) => {
666
+ if (!this.isResizeStarted || !this.activeMuntinSash) return;
667
+ let [t, n, r, i] = this.activeMuntinSash.getChildren(), a = this.activeMuntinSash.isLeftRightSplit(), o = this.activeMuntinSash.isTopBottomSplit();
668
+ if (a && i && n) {
669
+ let t = e.pageX - this.lastX, r = i.width + t, a = n.width - t;
670
+ if (t > 0 && a <= n.calcMinWidth() || t < 0 && r <= i.calcMinWidth()) return;
671
+ i.width = r, n.width = a, n.left += t, this.update(), this.lastX = e.pageX;
672
+ } else if (o && t && r) {
673
+ let n = e.pageY - this.lastY, i = t.height + n, a = r.height - n;
674
+ if (n > 0 && a <= r.calcMinHeight() || n < 0 && i <= t.calcMinHeight()) return;
675
+ t.height = i, r.height = a, r.top += n, this.update(), this.lastY = e.pageY;
676
+ }
677
+ }), document.addEventListener("mouseup", () => {
678
+ this.isResizeStarted = !1, this.activeMuntinSash = null, this.revertResizeStyles();
679
+ });
680
+ }
681
+ }, H = {
682
+ activeDropPaneEl: null,
683
+ onPaneDrop(e, t) {},
684
+ enableDrop() {
685
+ this.windowElement.addEventListener("dragover", (e) => {
686
+ e.preventDefault();
687
+ let t = e.target.matches("bw-pane") ? e.target : e.target.closest("bw-pane");
688
+ if (!t || (t !== this.activeDropPaneEl && (this.activeDropPaneEl && this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = t), t.getAttribute("can-drop") === "false")) return;
689
+ let n = ne(t, e);
690
+ t.setAttribute("drop-area", n);
691
+ }), this.windowElement.addEventListener("dragleave", (e) => {
692
+ e.currentTarget.contains(e.relatedTarget) && e.currentTarget !== e.relatedTarget || (this.activeDropPaneEl &&= (this.activeDropPaneEl.removeAttribute("drop-area"), null));
693
+ }), this.windowElement.addEventListener("drop", (e) => {
694
+ if (!this.activeDropPaneEl || this.activeDropPaneEl.getAttribute("can-drop") === "false") return;
695
+ let t = this.activeDropPaneEl.getAttribute("sash-id"), n = this.rootSash.getById(t);
696
+ this.onPaneDrop(e, n), typeof n.store.onDrop == "function" && n.store.onDrop(e, n), this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null;
697
+ });
698
+ }
699
+ }, U = !1, W = class {
700
+ windowElement = null;
701
+ containerElement = null;
702
+ debug = U;
703
+ constructor(e) {
704
+ let t = null;
705
+ e instanceof re ? (t = e, this.rootSash = e) : (t = new O(e), this.rootSash = t.buildSashTree({ resizeStrategy: t.resizeStrategy })), this.fitContainer = t.fitContainer, this.theme = t.theme;
706
+ }
707
+ frame(e) {
708
+ this.containerElement = e, this.windowElement = this.createWindow({ theme: this.theme }), this.glaze(), this.containerElement.append(this.windowElement);
709
+ }
710
+ enableFeatures() {
711
+ this.enableResize(), this.enableDrop(), this.fitContainer && this.enableFitContainer();
712
+ }
713
+ mount(e) {
714
+ this.frame(e), this.enableFeatures();
715
+ }
716
+ static assemble(...e) {
717
+ e.forEach((e) => {
718
+ m(this.prototype, e);
719
+ });
720
+ }
820
721
  };
821
- function Dt(e, t) {
822
- const i = e.left + e.width, n = e.top + e.height, s = t.left + t.width, o = t.top + t.height;
823
- if (e.left >= s || t.left >= i || e.top >= o || t.top >= n)
824
- return null;
825
- const h = Math.max(e.left, t.left), r = Math.max(e.top, t.top), d = Math.min(i, s), l = Math.min(n, o);
826
- return {
827
- left: h,
828
- top: r,
829
- width: d - h,
830
- height: l - r
831
- };
832
- }
833
- const k = [Pt, xt, Rt], $t = {
834
- enableActions() {
835
- this.handleMinimizedGlassClick(), this.observeActionButtons();
836
- },
837
- restoreGlass(e) {
838
- const t = e.bwOriginalBoundingRect;
839
- let i = 0, n = null;
840
- if (this.windowElement.querySelectorAll("bw-pane").forEach((s) => {
841
- const o = M(s), h = Dt(t, o);
842
- if (h) {
843
- const r = h.width * h.height;
844
- r > i && (i = r, n = s);
845
- }
846
- }), n) {
847
- const s = e.bwOriginalPosition, o = M(n), h = n.getAttribute("sash-id"), r = this.rootSash.getById(h);
848
- let d = 0;
849
- if (s === a.Left || s === a.Right)
850
- d = o.width - t.width < r.minWidth ? o.width / 2 : t.width;
851
- else if (s === a.Top || s === a.Bottom)
852
- d = o.height - t.height < r.minHeight ? o.height / 2 : t.height;
853
- else
854
- throw new Error("[bwin] Invalid position when restoring glass");
855
- const l = e.bwOriginalSashId;
856
- this.addPane(n.getAttribute("sash-id"), {
857
- id: l,
858
- position: s,
859
- size: d
860
- }).domNode.append(e.bwGlassElement);
861
- }
862
- },
863
- handleMinimizedGlassClick() {
864
- this.sillElement.addEventListener("click", (e) => {
865
- if (!e.target.matches(".bw-minimized-glass")) return;
866
- const t = e.target;
867
- this.restoreGlass(t), t.remove();
868
- });
869
- },
870
- updateDisabledStateOfActionButtons() {
871
- this.updateDisabledState(".bw-glass-action--close"), this.updateDisabledState(".bw-glass-action--minimize"), this.updateDisabledState(".bw-glass-action--maximize");
872
- },
873
- updateDisabledState(e) {
874
- if (this.windowElement.querySelectorAll("bw-pane").length === 1) {
875
- const t = this.windowElement.querySelector(e);
876
- t && t.setAttribute("disabled", "");
877
- } else
878
- this.windowElement.querySelectorAll(e).forEach((t) => {
879
- t.removeAttribute("disabled");
880
- });
881
- },
882
- observeActionButtons() {
883
- this.updateDisabledStateOfActionButtons(), new MutationObserver((e) => {
884
- e.forEach((t) => {
885
- t.type === "childList" && this.updateDisabledStateOfActionButtons();
886
- });
887
- }).observe(this.windowElement, {
888
- childList: !0
889
- });
890
- }
891
- }, C = {
892
- title: null,
893
- content: null,
894
- tabs: [],
895
- actions: void 0,
896
- draggable: !0
722
+ W.assemble(R, z, I, B, H, V);
723
+ var G = {
724
+ label: "",
725
+ className: "bw-glass-action--close",
726
+ onClick: (e, t) => {
727
+ let n = F(e.target);
728
+ t.removePane(n);
729
+ }
730
+ }, K = {
731
+ label: "",
732
+ className: "bw-glass-action--minimize",
733
+ onClick: (e, t) => {
734
+ let n = t.sillElement;
735
+ if (!n) throw Error("[bwin] Sill element not found when minimizing");
736
+ let r = g("<button class=\"bw-minimized-glass\" />");
737
+ n.append(r);
738
+ let i = e.target.closest("bw-pane"), a = e.target.closest("bw-glass"), o = i.getAttribute("sash-id"), s = i.getAttribute("position");
739
+ r.bwGlassElement = a, r.bwOriginalPosition = s, r.bwOriginalBoundingRect = _(i), r.bwOriginalSashId = o, t.removePane(o);
740
+ }
741
+ }, q = {
742
+ label: "",
743
+ className: "bw-glass-action--maximize",
744
+ onClick: (e) => {
745
+ let t = e.target.closest("bw-pane");
746
+ t.hasAttribute("maximized") ? (t.removeAttribute("maximized"), t.style.left = `${t.bwOriginalBoundingRect.left}px`, t.style.top = `${t.bwOriginalBoundingRect.top}px`, t.style.width = `${t.bwOriginalBoundingRect.width}px`, t.style.height = `${t.bwOriginalBoundingRect.height}px`) : (t.setAttribute("maximized", ""), t.bwOriginalBoundingRect = _(t), t.style.left = "0", t.style.top = "0", t.style.width = "100%", t.style.height = "100%");
747
+ }
897
748
  };
898
- class O {
899
- constructor({
900
- title: t = C.title,
901
- content: i = C.content,
902
- tabs: n = C.tabs,
903
- actions: s = C.actions,
904
- draggable: o = C.draggable,
905
- sash: h,
906
- binaryWindow: r
907
- }) {
908
- y(this, "domNode"), this.title = t, this.content = i, this.tabs = n, this.actions = s, this.sash = h, this.draggable = o, this.binaryWindow = r, this.build();
909
- }
910
- build() {
911
- const t = document.createElement("bw-glass-header");
912
- if (Array.isArray(this.tabs) && this.tabs.length > 0)
913
- t.append(this.createTabs());
914
- else if (this.title) {
915
- const s = document.createElement("bw-glass-title");
916
- s.append(N(this.title)), t.append(s);
917
- }
918
- t.setAttribute("can-drag", this.draggable), t.append(this.createActions());
919
- const i = document.createElement("bw-glass-content"), n = N(this.content);
920
- n && i.append(n), this.domNode = document.createElement("bw-glass"), this.domNode.append(t, i);
921
- }
922
- createTabs() {
923
- const t = document.createElement("bw-glass-tab-container");
924
- for (const i of this.tabs) {
925
- const n = (i == null ? void 0 : i.label) ?? i, s = N(`<button class="bw-glass-tab">${n}</button>`);
926
- t.append(s);
927
- }
928
- return t;
929
- }
930
- createActions() {
931
- const t = document.createElement("bw-glass-action-container"), i = this.actions === void 0 ? k : Array.isArray(this.actions) ? this.actions : [];
932
- for (const n of i) {
933
- const s = (n == null ? void 0 : n.label) ?? n, o = n.className ? `bw-glass-action ${n.className}` : "bw-glass-action", h = N(`<button class="${o}">${s}</button>`);
934
- typeof n.onClick == "function" && h.addEventListener("click", (r) => {
935
- n.onClick(r, this.binaryWindow);
936
- }), t.append(h);
937
- }
938
- return t;
939
- }
940
- get contentElement() {
941
- return this.domNode.querySelector("bw-glass-content");
942
- }
943
- get headerElement() {
944
- return this.domNode.querySelector("bw-glass-header");
945
- }
749
+ function J(e, t) {
750
+ let n = e.left + e.width, r = e.top + e.height, i = t.left + t.width, a = t.top + t.height;
751
+ if (e.left >= i || t.left >= n || e.top >= a || t.top >= r) return null;
752
+ let o = Math.max(e.left, t.left), s = Math.max(e.top, t.top), c = Math.min(n, i), l = Math.min(r, a);
753
+ return {
754
+ left: o,
755
+ top: s,
756
+ width: c - o,
757
+ height: l - s
758
+ };
946
759
  }
947
- const Bt = {
948
- activeDragGlassEl: null,
949
- activeDragGlassPaneCanDrop: !1,
950
- onPaneDrop(e, t) {
951
- if (!this.activeDragGlassEl) return;
952
- const i = this.activeDropPaneEl.getAttribute("drop-area");
953
- if (i === "center") {
954
- const n = this.activeDragGlassEl.closest("bw-pane");
955
- this.swapPanes(n, this.activeDropPaneEl);
956
- return;
957
- } else {
958
- const n = P(this.activeDragGlassEl);
959
- this.removePane(n), this.addPane(t.id, { position: i, id: n }).domNode.append(this.activeDragGlassEl);
960
- }
961
- },
962
- enableDrag() {
963
- document.addEventListener("mousedown", (e) => {
964
- if (e.button !== 0 || !e.target.matches("bw-glass-header")) return;
965
- if (e.target.getAttribute("can-drag") === "false") {
966
- e.preventDefault();
967
- return;
968
- }
969
- const t = e.target.closest("bw-glass");
970
- t.setAttribute("draggable", !0), this.activeDragGlassEl = t;
971
- }), document.addEventListener("mouseup", () => {
972
- this.activeDragGlassEl && (this.activeDragGlassEl.removeAttribute("draggable"), this.activeDragGlassEl = null);
973
- }), this.windowElement.addEventListener("dragstart", (e) => {
974
- if (!(e.target instanceof HTMLElement) || !e.target.matches("bw-glass") || !this.activeDragGlassEl)
975
- return;
976
- e.dataTransfer.effectAllowed = "move";
977
- const t = this.activeDragGlassEl.closest("bw-pane");
978
- this.activeDragGlassPaneCanDrop = t.getAttribute("can-drop") !== "false", t.setAttribute("can-drop", !1);
979
- }), this.windowElement.addEventListener("dragend", () => {
980
- this.activeDragGlassEl && (this.activeDragGlassEl.removeAttribute("draggable"), this.activeDragGlassEl.closest("bw-pane").setAttribute("can-drop", this.activeDragGlassPaneCanDrop), this.activeDragGlassEl = null);
981
- });
982
- }
983
- }, Lt = {
984
- trimMuntin(e) {
985
- e.hasAttribute("vertical") ? (e.style.top = `${parseFloat(e.style.top) + this.muntinSize / 2}px`, e.style.height = `${parseFloat(e.style.height) - this.muntinSize}px`) : e.hasAttribute("horizontal") && (e.style.left = `${parseFloat(e.style.left) + this.muntinSize / 2}px`, e.style.width = `${parseFloat(e.style.width) - this.muntinSize}px`);
986
- },
987
- onMuntinCreate(e) {
988
- this.trimMuntin(e);
989
- },
990
- onMuntinUpdate(e) {
991
- this.trimMuntin(e);
992
- }
760
+ var Y = [
761
+ K,
762
+ q,
763
+ G
764
+ ], ae = {
765
+ enableActions() {
766
+ this.handleMinimizedGlassClick(), this.observeActionButtons();
767
+ },
768
+ restoreGlass(e) {
769
+ let t = e.bwOriginalBoundingRect, n = 0, r = null;
770
+ if (this.windowElement.querySelectorAll("bw-pane").forEach((e) => {
771
+ let i = J(t, _(e));
772
+ if (i) {
773
+ let t = i.width * i.height;
774
+ t > n && (n = t, r = e);
775
+ }
776
+ }), r) {
777
+ let n = e.bwOriginalPosition, i = _(r), a = r.getAttribute("sash-id"), o = this.rootSash.getById(a), s = 0;
778
+ if (n === v.Left || n === v.Right) s = i.width - t.width < o.minWidth ? i.width / 2 : t.width;
779
+ else if (n === v.Top || n === v.Bottom) s = i.height - t.height < o.minHeight ? i.height / 2 : t.height;
780
+ else throw Error("[bwin] Invalid position when restoring glass");
781
+ let c = e.bwOriginalSashId;
782
+ this.addPane(r.getAttribute("sash-id"), {
783
+ id: c,
784
+ position: n,
785
+ size: s
786
+ }).domNode.append(e.bwGlassElement);
787
+ }
788
+ },
789
+ handleMinimizedGlassClick() {
790
+ this.sillElement.addEventListener("click", (e) => {
791
+ if (!e.target.matches(".bw-minimized-glass")) return;
792
+ let t = e.target;
793
+ this.restoreGlass(t), t.remove();
794
+ });
795
+ },
796
+ updateDisabledStateOfActionButtons() {
797
+ this.updateDisabledState(".bw-glass-action--close"), this.updateDisabledState(".bw-glass-action--minimize"), this.updateDisabledState(".bw-glass-action--maximize");
798
+ },
799
+ updateDisabledState(e) {
800
+ if (this.windowElement.querySelectorAll("bw-pane").length === 1) {
801
+ let t = this.windowElement.querySelector(e);
802
+ t && t.setAttribute("disabled", "");
803
+ } else this.windowElement.querySelectorAll(e).forEach((e) => {
804
+ e.removeAttribute("disabled");
805
+ });
806
+ },
807
+ getMinimizedGlassElementBySashId(e) {
808
+ let t = this.windowElement.querySelectorAll(".bw-minimized-glass");
809
+ return Array.from(t).find((t) => t.bwOriginalSashId === e);
810
+ },
811
+ observeActionButtons() {
812
+ this.updateDisabledStateOfActionButtons(), new MutationObserver((e) => {
813
+ e.forEach((e) => {
814
+ e.type === "childList" && this.updateDisabledStateOfActionButtons();
815
+ });
816
+ }).observe(this.windowElement, { childList: !0 });
817
+ }
818
+ }, X = {
819
+ title: null,
820
+ content: null,
821
+ tabs: [],
822
+ actions: void 0,
823
+ draggable: !0
824
+ }, Z = class {
825
+ domNode;
826
+ constructor({ title: e = X.title, content: t = X.content, tabs: n = X.tabs, actions: r = X.actions, draggable: i = X.draggable, sash: a, binaryWindow: o }) {
827
+ this.title = e, this.content = t, this.tabs = n, this.actions = r, this.sash = a, this.draggable = i, this.binaryWindow = o, this.build();
828
+ }
829
+ build() {
830
+ let e = document.createElement("bw-glass-header");
831
+ if (Array.isArray(this.tabs) && this.tabs.length > 0) e.append(this.createTabs());
832
+ else if (this.title) {
833
+ let t = document.createElement("bw-glass-title");
834
+ t.append(g(this.title)), e.append(t);
835
+ }
836
+ e.setAttribute("can-drag", this.draggable), e.append(this.createActions());
837
+ let t = document.createElement("bw-glass-content"), n = g(this.content);
838
+ n && t.append(n), this.domNode = document.createElement("bw-glass"), this.domNode.append(e, t);
839
+ }
840
+ createTabs() {
841
+ let e = document.createElement("bw-glass-tab-container");
842
+ for (let t of this.tabs) {
843
+ let n = g(`<button class="bw-glass-tab">${t?.label ?? t}</button>`);
844
+ e.append(n);
845
+ }
846
+ return e;
847
+ }
848
+ createActions() {
849
+ let e = document.createElement("bw-glass-action-container"), t = this.actions === void 0 ? Y : Array.isArray(this.actions) ? this.actions : [];
850
+ for (let n of t) {
851
+ let t = n?.label ?? n, r = g(`<button class="${n.className ? `bw-glass-action ${n.className}` : "bw-glass-action"}">${t}</button>`);
852
+ typeof n.onClick == "function" && r.addEventListener("click", (e) => {
853
+ n.onClick(e, this.binaryWindow);
854
+ }), e.append(r);
855
+ }
856
+ return e;
857
+ }
858
+ get contentElement() {
859
+ return this.domNode.querySelector("bw-glass-content");
860
+ }
861
+ get headerElement() {
862
+ return this.domNode.querySelector("bw-glass-header");
863
+ }
864
+ }, oe = {
865
+ activeDragGlassEl: null,
866
+ activeDragGlassPaneCanDrop: !1,
867
+ onPaneDrop(e, t) {
868
+ if (!this.activeDragGlassEl) return;
869
+ let n = this.activeDropPaneEl.getAttribute("drop-area");
870
+ if (n === "center") {
871
+ let e = this.activeDragGlassEl.closest("bw-pane");
872
+ this.swapPanes(e, this.activeDropPaneEl);
873
+ return;
874
+ } else {
875
+ let e = F(this.activeDragGlassEl);
876
+ this.removePane(e), this.addPane(t.id, {
877
+ position: n,
878
+ id: e
879
+ }).domNode.append(this.activeDragGlassEl);
880
+ }
881
+ },
882
+ enableDrag() {
883
+ document.addEventListener("mousedown", (e) => {
884
+ if (e.button !== 0 || !e.target.matches("bw-glass-header")) return;
885
+ if (e.target.getAttribute("can-drag") === "false") {
886
+ e.preventDefault();
887
+ return;
888
+ }
889
+ let t = e.target.closest("bw-glass");
890
+ t.setAttribute("draggable", !0), this.activeDragGlassEl = t;
891
+ }), document.addEventListener("mouseup", () => {
892
+ this.activeDragGlassEl &&= (this.activeDragGlassEl.removeAttribute("draggable"), null);
893
+ }), this.windowElement.addEventListener("dragstart", (e) => {
894
+ if (!(e.target instanceof HTMLElement) || !e.target.matches("bw-glass") || !this.activeDragGlassEl) return;
895
+ e.dataTransfer.effectAllowed = "move";
896
+ let t = this.activeDragGlassEl.closest("bw-pane");
897
+ this.activeDragGlassPaneCanDrop = t.getAttribute("can-drop") !== "false", t.setAttribute("can-drop", !1);
898
+ }), this.windowElement.addEventListener("dragend", () => {
899
+ this.activeDragGlassEl &&= (this.activeDragGlassEl.removeAttribute("draggable"), this.activeDragGlassEl.closest("bw-pane").setAttribute("can-drop", this.activeDragGlassPaneCanDrop), null);
900
+ });
901
+ }
902
+ }, se = {
903
+ trimMuntin(e) {
904
+ e.hasAttribute("vertical") ? (e.style.top = `${parseFloat(e.style.top) + this.muntinSize / 2}px`, e.style.height = `${parseFloat(e.style.height) - this.muntinSize}px`) : e.hasAttribute("horizontal") && (e.style.left = `${parseFloat(e.style.left) + this.muntinSize / 2}px`, e.style.width = `${parseFloat(e.style.width) - this.muntinSize}px`);
905
+ },
906
+ onMuntinCreate(e) {
907
+ this.trimMuntin(e);
908
+ },
909
+ onMuntinUpdate(e) {
910
+ this.trimMuntin(e);
911
+ }
912
+ }, Q = class extends W {
913
+ sillElement = null;
914
+ frame() {
915
+ super.frame(...arguments);
916
+ let e = g("<bw-sill />");
917
+ this.windowElement.append(e), this.sillElement = e;
918
+ }
919
+ enableFeatures() {
920
+ super.enableFeatures(), this.enableDrag(), this.enableActions();
921
+ }
922
+ onPaneCreate(e, t) {
923
+ let n = new Z({
924
+ ...t.store,
925
+ sash: t,
926
+ binaryWindow: this
927
+ });
928
+ e.innerHTML = "", e.append(n.domNode), this.debug && n.contentElement.prepend(`${t.id}`);
929
+ }
930
+ onPaneUpdate() {}
931
+ addPane(e, t) {
932
+ let { position: n, size: r, id: i, ...a } = t, o = super.addPane(e, {
933
+ position: n,
934
+ size: r,
935
+ id: i
936
+ }), s = new Z({
937
+ ...a,
938
+ sash: o,
939
+ binaryWindow: this
940
+ });
941
+ return o.domNode.append(s.domNode), o;
942
+ }
943
+ setTheme(e) {
944
+ if (!e) {
945
+ this.theme = "", this.windowElement.removeAttribute("theme");
946
+ return;
947
+ }
948
+ this.theme = e, this.windowElement.setAttribute("theme", e);
949
+ }
950
+ removePane(e) {
951
+ if (this.windowElement.querySelector(`[sash-id="${e}"]`)) {
952
+ super.removePane(e);
953
+ return;
954
+ }
955
+ let t = this.getMinimizedGlassElementBySashId(e);
956
+ t && t.remove();
957
+ }
993
958
  };
994
- class F extends G {
995
- constructor() {
996
- super(...arguments), y(this, "sillElement", null);
997
- }
998
- frame() {
999
- super.frame(...arguments);
1000
- const t = N("<bw-sill />");
1001
- this.windowElement.append(t), this.sillElement = t;
1002
- }
1003
- enableFeatures() {
1004
- super.enableFeatures(), this.enableDrag(), this.enableActions();
1005
- }
1006
- onPaneCreate(t, i) {
1007
- const n = new O({ ...i.store, sash: i, binaryWindow: this });
1008
- t.innerHTML = "", t.append(n.domNode), this.debug && n.contentElement.prepend(`${i.id}`);
1009
- }
1010
- onPaneUpdate() {
1011
- }
1012
- /**
1013
- * Add a pane with glass into the target pane.
1014
- *
1015
- * @param {string} targetPaneId - The Sash ID of the target pane
1016
- * @param {Object} props - The pane and glass properties grouped together
1017
- * @returns {Sash} - The newly created Sash
1018
- */
1019
- addPane(t, i) {
1020
- const { position: n, size: s, id: o, ...h } = i, r = super.addPane(t, { position: n, size: s, id: o }), d = new O({ ...h, sash: r, binaryWindow: this });
1021
- return r.domNode.append(d.domNode), r;
1022
- }
959
+ Q.assemble(oe, se, ae);
960
+ //#endregion
961
+ //#region src/Muntin.tsx
962
+ var $ = 4;
963
+ function ce({ sash: t }) {
964
+ let r = a(), i = t.leftChild, o = t.topChild, s, c, l, u, d, f;
965
+ return i ? (s = $, c = t.height - $, l = t.top + $ / 2, u = t.left + i.width - $ / 2, d = !0) : o && (s = t.width - $, c = $, l = t.top + o.height - $ / 2, u = t.left + $ / 2, f = !0), n(() => {
966
+ t.domNode = r.current;
967
+ }, []), /* @__PURE__ */ e.createElement("bw-muntin", {
968
+ "sash-id": t.id,
969
+ style: {
970
+ width: s,
971
+ height: c,
972
+ top: l,
973
+ left: u
974
+ },
975
+ vertical: d,
976
+ horizontal: f,
977
+ resizable: t.store?.resizable === !1 ? "false" : "true",
978
+ ref: r
979
+ });
1023
980
  }
1024
- F.assemble(Bt, Lt, $t);
1025
- const E = 4;
1026
- function Tt({ sash: e }) {
1027
- var c;
1028
- const t = A(), i = e.leftChild, n = e.topChild;
1029
- let s, o, h, r, d, l;
1030
- return i ? (s = E, o = e.height - E, h = e.top + E / 2, r = e.left + i.width - E / 2, d = !0) : n && (s = e.width - E, o = E, h = e.top + n.height - E / 2, r = e.left + E / 2, l = !0), W(() => {
1031
- e.domNode = t.current;
1032
- }, []), /* @__PURE__ */ f.createElement(
1033
- "bw-muntin",
1034
- {
1035
- "sash-id": e.id,
1036
- style: {
1037
- width: s,
1038
- height: o,
1039
- top: h,
1040
- left: r
1041
- },
1042
- vertical: d,
1043
- horizontal: l,
1044
- resizable: ((c = e.store) == null ? void 0 : c.resizable) === !1 ? "false" : "true",
1045
- ref: t
1046
- }
1047
- );
981
+ //#endregion
982
+ //#region src/Pane.tsx
983
+ function le({ sash: t, bwin: r }) {
984
+ let i = a(), { left: o, top: s, width: c, height: l, id: u, position: d } = t;
985
+ n(() => {
986
+ t.domNode = i.current;
987
+ }, []);
988
+ let f = t.store?.actions === void 0 ? Y : Array.isArray(t.store.actions) ? t.store.actions : [];
989
+ return /* @__PURE__ */ e.createElement("bw-pane", {
990
+ "sash-id": u,
991
+ position: d,
992
+ style: {
993
+ left: o,
994
+ top: s,
995
+ width: c,
996
+ height: l
997
+ },
998
+ "can-drop": t.store?.droppable === !1 ? "false" : "true",
999
+ ref: i
1000
+ }, /* @__PURE__ */ e.createElement("bw-glass", null, /* @__PURE__ */ e.createElement("bw-glass-header", { "can-drag": t.store?.draggable === !1 ? "false" : "true" }, t.store?.title && /* @__PURE__ */ e.createElement("bw-glass-title", null, t.store.title), f.length > 0 && /* @__PURE__ */ e.createElement("bw-glass-action-container", null, f.map((t, n) => {
1001
+ let i = t.className ? `bw-glass-action ${t.className}` : "bw-glass-action";
1002
+ return /* @__PURE__ */ e.createElement("button", {
1003
+ className: i,
1004
+ key: n,
1005
+ onClick: (e) => t.onClick(e, r)
1006
+ }, t.label);
1007
+ }))), /* @__PURE__ */ e.createElement("bw-glass-content", null, t.store?.content)));
1048
1008
  }
1049
- function Wt({
1050
- sash: e,
1051
- bwin: t
1052
- }) {
1053
- var c, u, g, w, m;
1054
- const i = A(), { left: n, top: s, width: o, height: h, id: r, position: d } = e;
1055
- W(() => {
1056
- e.domNode = i.current;
1057
- }, []);
1058
- const l = ((c = e.store) == null ? void 0 : c.actions) === void 0 ? k : Array.isArray(e.store.actions) ? e.store.actions : [];
1059
- return /* @__PURE__ */ f.createElement(
1060
- "bw-pane",
1061
- {
1062
- "sash-id": r,
1063
- position: d,
1064
- style: { left: n, top: s, width: o, height: h },
1065
- "can-drop": ((u = e.store) == null ? void 0 : u.droppable) === !1 ? "false" : "true",
1066
- ref: i
1067
- },
1068
- /* @__PURE__ */ f.createElement("bw-glass", null, /* @__PURE__ */ f.createElement(
1069
- "bw-glass-header",
1070
- {
1071
- "can-drag": ((g = e.store) == null ? void 0 : g.draggable) === !1 ? "false" : "true"
1072
- },
1073
- ((w = e.store) == null ? void 0 : w.title) && /* @__PURE__ */ f.createElement("bw-glass-title", null, e.store.title),
1074
- l.length > 0 && /* @__PURE__ */ f.createElement("bw-glass-action-container", null, l.map((p, x) => {
1075
- const D = p.className ? `bw-glass-action ${p.className}` : "bw-glass-action";
1076
- return /* @__PURE__ */ f.createElement(
1077
- "button",
1078
- {
1079
- className: D,
1080
- key: x,
1081
- onClick: ($) => p.onClick($, t)
1082
- },
1083
- p.label
1084
- );
1085
- }))
1086
- ), /* @__PURE__ */ f.createElement("bw-glass-content", null, (m = e.store) == null ? void 0 : m.content))
1087
- );
1088
- }
1089
- const Ot = X((e, t) => {
1090
- const i = A(), n = A(), [s, o] = Y(), { panes: h, ...r } = e, d = { ...r, children: h }, l = new F(d), c = [], u = [];
1091
- l.rootSash.walk((p) => {
1092
- p.children.length > 0 ? c.push(p) : u.push(p);
1093
- }), W(() => {
1094
- const p = i.current;
1095
- p != null && p.parentElement && (l.windowElement = p, l.containerElement = p.parentElement, l.sillElement = n.current, l.enableFeatures());
1096
- }, []), j(
1097
- t,
1098
- () => ({
1099
- fit: l.fit.bind(l),
1100
- removePane: l.removePane.bind(l),
1101
- addPane: m
1102
- }),
1103
- []
1104
- );
1105
- const g = /* @__PURE__ */ f.createElement(
1106
- "bw-window",
1107
- {
1108
- "root-sash-id": l.rootSash.id,
1109
- style: { width: l.rootSash.width, height: l.rootSash.height },
1110
- ref: i
1111
- },
1112
- u.map((p) => /* @__PURE__ */ f.createElement(Wt, { key: p.id, sash: p, bwin: l })),
1113
- c.map((p) => /* @__PURE__ */ f.createElement(Tt, { key: p.id, sash: p })),
1114
- /* @__PURE__ */ f.createElement("bw-sill", { ref: n })
1115
- ), w = K(() => g, []);
1116
- function m(p, x) {
1117
- const { content: D, ...$ } = x, _ = l.addPane(p, $), q = document.querySelector(
1118
- `bw-pane[sash-id="${_.id}"] bw-glass-content`
1119
- );
1120
- o((U) => [
1121
- ...U || [],
1122
- { node: D, container: q }
1123
- ]);
1124
- }
1125
- return /* @__PURE__ */ f.createElement(f.Fragment, null, w, s == null ? void 0 : s.map((p) => V(p.node, p.container)));
1126
- }), Gt = "0.3.3";
1127
- export {
1128
- k as BUILTIN_ACTIONS,
1129
- Ot as Window,
1130
- Gt as version
1131
- };
1009
+ //#endregion
1010
+ //#region src/Window.tsx
1011
+ var ue = t((t, c) => {
1012
+ let l = a(), u = a(), [d, f] = o(), { panes: p, ...m } = t, h = new Q({
1013
+ ...m,
1014
+ children: p
1015
+ }), g = [], _ = [];
1016
+ h.rootSash.walk((e) => {
1017
+ e.children.length > 0 ? g.push(e) : _.push(e);
1018
+ }), n(() => {
1019
+ let e = l.current;
1020
+ e?.parentElement && (h.windowElement = e, h.containerElement = e.parentElement, h.sillElement = u.current, h.enableFeatures());
1021
+ }, []), r(c, () => ({
1022
+ fit: h.fit.bind(h),
1023
+ removePane: h.removePane.bind(h),
1024
+ addPane: b
1025
+ }), []);
1026
+ let v = /* @__PURE__ */ e.createElement("bw-window", {
1027
+ "root-sash-id": h.rootSash.id,
1028
+ style: {
1029
+ width: h.rootSash.width,
1030
+ height: h.rootSash.height
1031
+ },
1032
+ ref: l
1033
+ }, _.map((t) => /* @__PURE__ */ e.createElement(le, {
1034
+ key: t.id,
1035
+ sash: t,
1036
+ bwin: h
1037
+ })), g.map((t) => /* @__PURE__ */ e.createElement(ce, {
1038
+ key: t.id,
1039
+ sash: t
1040
+ })), /* @__PURE__ */ e.createElement("bw-sill", { ref: u })), y = i(() => v, []);
1041
+ function b(e, t) {
1042
+ let { content: n, ...r } = t, i = h.addPane(e, r), a = document.querySelector(`bw-pane[sash-id="${i.id}"] bw-glass-content`);
1043
+ f((e) => [...e || [], {
1044
+ node: n,
1045
+ container: a
1046
+ }]);
1047
+ }
1048
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, y, d?.map((e) => s(e.node, e.container)));
1049
+ }), de = "0.3.4";
1050
+ //#endregion
1051
+ export { Y as BUILTIN_ACTIONS, ue as Window, de as version };