@sheetxl/utils-react 0.7.12 → 0.7.13

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,266 +1,55 @@
1
1
  /**
2
- * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.12
2
+ * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.13
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
6
6
  */
7
- import { jsx as t, Fragment as e, jsxs as n } from "react/jsx-runtime";
8
- import o, { createContext as i, useContext as r, useRef as s, useReducer as l, useCallback as a, useState as c, useEffect as h, useLayoutEffect as u, createElement as d, useMemo as p, useImperativeHandle as f, memo as _, forwardRef as m, Component as g } from "react";
9
- import { unstable_batchedUpdates as y, createPortal as v } from "react-dom";
10
- import w from "clsx";
11
- import { mergeRefs as x } from "react-merge-refs";
12
- import { useMeasure as b } from "react-use";
13
- import { DefaultNotifier as S, Notifier as E, CommonUtils as L, InternalClipboard as M, ClipboardUtils as T, MimeType as C } from "@sheetxl/utils";
14
- import * as k from "detect-it";
15
- import { createRoot as D } from "react-dom/client";
16
- const P = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, A = { Shift: "shift", Alt: "alt", Ctrl: "ctrl", Meta: "meta" }, z = { BackSpace: 8, Tab: 9, Clear: 12, Enter: 13, Shift: 16, Control: 17, Alt: 18, Pause: 19, CapsLock: 20, Escape: 27, Space: 32, PageUp: 33, PageDown: 34, End: 35, Home: 36, Left: 37, Up: 38, Right: 39, Down: 40, Insert: 45, Delete: 46, Digit_8: 56, Y: 89, Z: 90, Meta: 91, F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, NumLock: 144, ScrollLock: 145, BackSlash: 220, Slash: 191, BracketRight: 221, BracketLeft: 219 }, B = { Left: 1, Middle: 2, Right: 3 }, $ = { Horizontal: "horizontal", Vertical: "vertical" }, O = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" };
17
- class K extends S {
18
- setOverrides(t2) {
19
- super.setOverrides(t2);
20
- }
21
- getDelegate() {
22
- return this._overrides;
23
- }
24
- showMessage(t2, e2) {
25
- const n2 = this.getDelegate();
26
- if (n2?.showMessage) return n2.showMessage(t2, e2);
27
- e2?.type !== O.Warning ? e2?.type !== O.Error ? E.log(t2) : E.error(t2) : E.warn(t2);
28
- }
29
- showBusy(t2, e2) {
30
- const n2 = this.getDelegate();
31
- return n2?.showBusy ? n2.showBusy(t2, e2) : new Promise((t3) => {
32
- t3(() => {
33
- });
34
- });
35
- }
36
- showWindow(t2, e2, n2) {
37
- const o2 = this.getDelegate();
38
- if (o2?.showWindow) return o2.showWindow(t2, e2, n2);
39
- }
40
- showError(t2) {
41
- const e2 = this.getDelegate();
42
- e2?.showError ? e2.showError(t2) : E.error(t2);
43
- }
44
- showOptions(t2) {
45
- const e2 = this.getDelegate();
46
- return e2?.showOptions ? e2.showOptions(t2) : Promise.resolve("");
47
- }
48
- showInputOptions(t2) {
49
- const e2 = this.getDelegate();
50
- return e2?.showInputOptions ? e2.showInputOptions(t2) : Promise.resolve({ input: "", option: "" });
51
- }
52
- }
53
- const H = i(new K()), N = ({ children: t2, notifier: e2 }) => (o.useEffect(() => {
54
- const t3 = E.getOverrides();
55
- return E.setOverrides(e2), () => {
56
- E.setOverrides(t3);
57
- };
58
- }, [e2]), o.createElement(H.Provider, { value: e2 }, t2)), R = () => r(H), W = 3, V = 0.5, I = 50, F = (t2) => ({ x: t2.x, y: t2.y, width: t2.width, height: t2.height, top: t2.top, left: t2.left, right: t2.right, bottom: t2.bottom });
59
- function j(t2 = {}) {
60
- const { threshold: e2 = V, stillnessThreshold: n2 = W, maxHierarchyDepth: o2 = I } = t2, [i2, r2] = b(), u2 = s(null), [d2, p2] = l((t3) => t3 + 1, 0), f2 = s(void 0), _2 = s({ x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 }), m2 = a((t3) => {
61
- u2.current = t3, "function" == typeof i2 && i2(t3);
62
- }, [i2]), [g2, y2] = c(r2);
63
- return h(() => {
64
- r2 && !g2 && y2(r2);
65
- }, [r2, g2]), h(() => {
66
- const t3 = u2.current;
67
- if (!t3) return;
68
- let i3 = false, r3 = 0;
69
- const s2 = () => {
70
- if (!t3) return;
71
- const o3 = t3.getBoundingClientRect(), l3 = _2.current;
72
- Math.abs(o3.x - l3.x) > e2 || Math.abs(o3.y - l3.y) > e2 || Math.abs(o3.width - l3.width) > e2 || Math.abs(o3.height - l3.height) > e2 ? (i3 || (i3 = true, y2(F(o3)), p2()), r3 = 0) : r3++, i3 && r3 >= n2 && (i3 = false, y2(F(o3)), p2()), _2.current = F(o3), f2.current = requestAnimationFrame(s2);
73
- };
74
- f2.current = requestAnimationFrame(s2);
75
- const l2 = (t4) => {
76
- i3 = true, p2();
77
- }, a2 = (t4) => {
78
- i3 = false, r3 = n2, p2();
79
- };
80
- let c2 = t3;
81
- const h2 = [];
82
- for (; c2 && c2 !== document.documentElement && (c2.addEventListener("animationstart", l2, true), c2.addEventListener("animationend", a2, true), c2.addEventListener("transitionstart", l2, true), c2.addEventListener("transitionend", a2, true), h2.push(c2), c2 = c2.parentElement, !(h2.length > o2)); ) ;
83
- return () => {
84
- f2.current && cancelAnimationFrame(f2.current), h2.forEach((t4) => {
85
- t4.removeEventListener("animationstart", l2, true), t4.removeEventListener("animationend", a2, true), t4.removeEventListener("transitionstart", l2, true), t4.removeEventListener("transitionend", a2, true);
86
- });
87
- };
88
- }, [d2, r2, e2, n2, o2]), [m2, g2];
89
- }
90
- const X = (t2, e2) => {
91
- const n2 = a((...e3) => t2?.(...e3), e2), o2 = s(null);
92
- o2.current = n2;
93
- const i2 = a((...t3) => o2.current?.(...t3), []);
94
- if (o2.current) return i2;
95
- };
96
- function Y(t2) {
97
- const [e2, n2] = c("undefined" != typeof window ? window.devicePixelRatio : 1), o2 = s(null);
98
- return h(() => {
99
- if (!("undefined" != typeof window && "matchMedia" in window)) return;
100
- const t3 = () => {
101
- const e3 = window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);
102
- e3.addEventListener("change", t3, { once: true, passive: true }), n2(window.devicePixelRatio), o2.current = { mediaMatcher: e3, listener: t3 };
103
- };
104
- return t3(), () => {
105
- o2.current && o2.current.mediaMatcher.removeEventListener("change", o2.current.listener);
106
- };
107
- }, [t2]), e2;
108
- }
109
- function U(t2) {
110
- if ("undefined" == typeof window) return 1;
111
- const { defaultDpr: e2 = 1, maxDpr: n2 = 3, round: o2 = true } = t2 || {}, i2 = "undefined" != typeof window && "number" == typeof window.devicePixelRatio ? window.devicePixelRatio : e2;
112
- return Math.min(Math.max(1, o2 ? Math.floor(i2) : i2), n2);
113
- }
114
- function G(t2, e2, n2) {
115
- const o2 = X(e2, [e2]);
116
- h(() => {
117
- const e3 = (e4) => {
118
- t2.current && !t2.current.contains(e4.target) && o2(e4);
119
- };
120
- return n2 && false === n2.mouseEvents || (document.addEventListener("mousedown", e3), document.addEventListener("touchstart", e3)), n2 && false === n2.focusEvents || document.addEventListener("focus", e3), () => {
121
- document.removeEventListener("mousedown", e3), document.removeEventListener("touchstart", e3), document.removeEventListener("focus", e3);
122
- };
123
- }, [t2]);
124
- }
125
- function Z(t2) {
126
- if (!t2) throw new Error("must have a PointerHandlerOptions");
127
- const { onPointerDown: e2, onPointerUp: n2, onPointerMoveOrWait: o2, processTouch: i2 = false, consumeTouch: r2 = true } = t2, l2 = X(e2, [e2]), c2 = X(n2, [n2]), u2 = X(o2, [o2]), d2 = s(false), p2 = t2?.timerInitial ?? 230, f2 = t2?.timerContinuous ?? p2 / 2, _2 = s(null), m2 = s(null), g2 = s(null), y2 = s(null), v2 = a(() => {
128
- y2.current && (clearTimeout(y2.current), y2.current = null);
129
- }, []), w2 = a((t3) => {
130
- y2.current = setTimeout(() => {
131
- window.requestAnimationFrame(() => {
132
- false !== d2.current && u2?.(m2.current, g2.current, _2.current);
133
- }), w2(f2);
134
- }, t3 ?? p2);
135
- }, []);
136
- h(() => () => v2(), []);
137
- const x2 = i2 ? "pointer" : "mouse", b2 = a((t3) => {
138
- t3.stopPropagation(), t3.stopImmediatePropagation(), t3.preventDefault();
139
- }, []), S2 = X((t3) => {
140
- document.removeEventListener(`${x2}move`, M2), document.removeEventListener(`${x2}up`, S2), document.removeEventListener("keydown", T2), document.removeEventListener("keyup", C2), document.removeEventListener("touchstart", b2, { capture: true }), document.removeEventListener("touchmove", b2, { capture: true }), window.removeEventListener("blur", E2), v2(), window.requestAnimationFrame(() => {
141
- false !== d2.current && (d2.current = false, c2?.(t3, g2.current, _2.current), g2.current = null);
142
- });
143
- }, []), E2 = a(() => {
144
- false !== d2.current && (d2.current = false, S2(m2.current));
145
- }, []), L2 = X(() => {
146
- v2(), w2(f2), window.requestAnimationFrame(() => {
147
- false !== d2.current && u2?.(m2.current, g2.current, _2.current);
148
- });
149
- }, [f2]), M2 = X((t3) => {
150
- m2.current = t3, L2();
151
- }, []), T2 = X((t3) => {
152
- g2.current = { ctrlKey: t3.ctrlKey, shiftKey: t3.shiftKey, altKey: t3.altKey, metaKey: t3.metaKey }, L2();
153
- }, []), C2 = X((t3) => {
154
- g2.current = { ctrlKey: t3.ctrlKey, shiftKey: t3.shiftKey, altKey: t3.altKey, metaKey: t3.metaKey }, L2();
155
- }, [f2]);
156
- return X((t3) => {
157
- if (t3.isDefaultPrevented()) return;
158
- g2.current = { ctrlKey: t3.ctrlKey, shiftKey: t3.shiftKey, altKey: t3.altKey, metaKey: t3.metaKey };
159
- false !== l2(t3, g2.current) && (_2.current = t3, m2.current = t3.nativeEvent, document.addEventListener(`${x2}up`, S2, { passive: false }), document.addEventListener(`${x2}move`, M2, { passive: false }), document.addEventListener("keydown", T2, { passive: false }), document.addEventListener("keyup", C2, { passive: false }), window.addEventListener("blur", E2, { passive: true }), i2 && r2 && (document.addEventListener("touchstart", b2, { passive: false, capture: true }), document.addEventListener("touchmove", b2, { passive: false, capture: true })), d2.current = true, w2(p2));
160
- }, [p2, i2]);
161
- }
162
- function q(t2, e2) {
163
- return Z({ onPointerDown: t2, onPointerMoveOrWait: (e3, n2, o2) => {
164
- t2?.(o2);
165
- }, ...e2 });
166
- }
167
- const J = ({ initValue: t2, useHookBody: e2, applyStateChange: n2 }) => {
168
- const o2 = s(t2);
169
- if ("function" != typeof e2) throw new Error("function expected as hook body parameter. got " + typeof e2);
170
- const i2 = e2();
171
- return u(() => {
172
- o2.current !== i2 && (o2.current = i2, n2(i2));
173
- }, [n2, i2]), null;
174
- }, Q = (t2) => {
175
- console && console.warn && console.warn(t2);
176
- }, tt = "object" == typeof self && self.self === self && self || "object" == typeof global && global.global === global && global || void 0;
177
- let et = 1, nt = false, ot = false;
178
- const it = [], rt = [], st = () => {
179
- rt.forEach((t2) => t2());
180
- }, lt = ({ automaticContainerInternalUseOnly: n2 }) => {
181
- const [o2, i2] = c([]), r2 = s([]);
182
- return r2.current = o2, n2 || false !== nt || (ot = true), h(() => {
183
- let t2 = true;
184
- function e2() {
185
- if (t2) return rt[0] !== e2 ? (n2 || true !== nt || Q("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void i2((t3) => [])) : void i2([...it]);
186
- }
187
- return rt.push(e2), st(), () => {
188
- t2 = false, r2.current?.length > 0 && Q("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), rt.splice(rt.indexOf(e2), 1), st();
189
- };
190
- }, [n2]), t(e, { children: o2.map(({ hook: t2, key: e2 }) => d(J, { ...t2, key: e2 })) });
191
- }, at = (e2) => {
192
- const n2 = et++;
193
- return it.push({ hook: e2, key: n2 }), 0 === rt.length && false === ot && (nt = true, ((e3) => {
194
- if (tt.document && tt.document.createElement) {
195
- const n3 = tt.document.createElement("div");
196
- D(n3).render(t(e3, { automaticContainerInternalUseOnly: true }));
197
- } else Q("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
198
- })(lt)), st(), () => {
199
- it.splice(it.findIndex((t2) => t2.key === n2), 1), st();
200
- };
201
- };
202
- let ct = null;
203
- ct || (ct = (t2, e2, n2 = {}) => {
204
- let o2, i2, r2 = false, s2 = false, l2 = [], { unmountIfNoConsumers: a2 = false } = n2;
205
- const u2 = (t3) => {
206
- i2 = t3, y(() => l2.forEach((e3) => e3(t3)));
207
- }, d2 = () => (s2 || (i2 = "function" == typeof t2 ? t2() : t2, s2 = true), i2);
208
- return () => {
209
- const [n3, s3] = c(d2);
210
- return h(() => (r2 || (r2 = true, o2 = at({ initValue: t2, useHookBody: e2, applyStateChange: u2 })), l2.push(s3), i2 !== n3 && s3(i2), () => {
211
- l2.splice(l2.indexOf(s3), 1), 0 === l2.length && a2 && (o2(), r2 = false);
212
- }), []), n3;
213
- };
214
- });
215
- const ht = ct;
216
- let ut = () => {
217
- console.warn("You must call useEditMode before setting its state.");
218
- };
219
- const dt = ht(null, () => {
220
- const [t2, e2] = c(null);
221
- return ut = e2, t2;
222
- }), pt = () => {
223
- const t2 = dt();
224
- return p(() => ({ setMode: (t3) => {
225
- ut((e2) => ("function" == typeof t3 && (t3 = t3(e2)), t3?.onModeChange?.(t3 ?? null), t3));
226
- }, getMode: () => t2 }), [t2]);
227
- };
228
- class ft {
229
- constructor(t2, e2, n2, o2) {
230
- this._listenersProperties = /* @__PURE__ */ new Set(), this._listenersExecute = /* @__PURE__ */ new Set(), this._key = t2, this._target = e2, this._applyProps(n2 || {}), this._callback = o2, void 0 === o2 && (this._callback = () => {
7
+ import { CommonUtils as e, DefaultNotifier as t, Notifier as n, InternalClipboard as o, ClipboardUtils as i, MimeType as r } from "@sheetxl/utils";
8
+ import * as s from "detect-it";
9
+ import l, { useRef as a, useReducer as c, useMemo as h, useEffect as u, useState as d, memo as p, forwardRef as f, useCallback as m, createContext as _, useContext as g, useLayoutEffect as y, createElement as v, useImperativeHandle as w, Component as b } from "react";
10
+ import { jsx as x, jsxs as S, Fragment as E } from "react/jsx-runtime";
11
+ import { mergeRefs as L } from "react-merge-refs";
12
+ import { useMeasure as M } from "react-use";
13
+ import T from "clsx";
14
+ import { createRoot as k } from "react-dom/client";
15
+ import { unstable_batchedUpdates as C, createPortal as D } from "react-dom";
16
+ const P = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, A = { Shift: "shift", Alt: "alt", Ctrl: "ctrl", Meta: "meta" }, z = { BackSpace: 8, Tab: 9, Clear: 12, Enter: 13, Shift: 16, Control: 17, Alt: 18, Pause: 19, CapsLock: 20, Escape: 27, Space: 32, PageUp: 33, PageDown: 34, End: 35, Home: 36, Left: 37, Up: 38, Right: 39, Down: 40, Insert: 45, Delete: 46, Digit_8: 56, Y: 89, Z: 90, Meta: 91, F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, NumLock: 144, ScrollLock: 145, BackSlash: 220, Slash: 191, BracketRight: 221, BracketLeft: 219 }, B = { Left: 1, Middle: 2, Right: 3 };
17
+ class $ {
18
+ constructor(e2, t2, n2, o2) {
19
+ this._listenersProperties = /* @__PURE__ */ new Set(), this._listenersExecute = /* @__PURE__ */ new Set(), this._key = e2, this._target = t2, this._applyProps(n2 || {}), this._callback = o2, void 0 === o2 && (this._callback = () => {
231
20
  console.log(`implement: ${this.label()} : ${this.description()}`);
232
21
  });
233
22
  }
234
23
  key() {
235
24
  return this._key;
236
25
  }
237
- _resolve(t2, e2) {
238
- if ("function" == typeof t2) {
239
- const n2 = e2 ?? this._context;
240
- return t2("function" == typeof n2 ? n2() : n2);
26
+ _resolve(e2, t2) {
27
+ if ("function" == typeof e2) {
28
+ const n2 = t2 ?? this._context;
29
+ return e2("function" == typeof n2 ? n2() : n2);
241
30
  }
242
- return t2;
31
+ return e2;
243
32
  }
244
33
  target() {
245
34
  return "function" == typeof this._target ? this._target() : this._target;
246
35
  }
247
- label(t2, e2) {
248
- const n2 = this._scopedLabels?.[t2] || this._label;
36
+ label(e2, t2) {
37
+ const n2 = this._scopedLabels?.[e2] || this._label;
249
38
  let o2 = null;
250
39
  if ("function" == typeof n2) {
251
- const t3 = e2 ?? this._context;
252
- o2 = n2("function" == typeof t3 ? t3() : t3);
40
+ const e3 = t2 ?? this._context;
41
+ o2 = n2("function" == typeof e3 ? e3() : e3);
253
42
  } else o2 = n2;
254
43
  return o2;
255
44
  }
256
- description(t2) {
257
- return this._resolve(this._description, t2);
45
+ description(e2) {
46
+ return this._resolve(this._description, e2);
258
47
  }
259
- tags(t2) {
260
- return this._resolve(this._tags, t2);
48
+ tags(e2) {
49
+ return this._resolve(this._tags, e2);
261
50
  }
262
- icon(t2) {
263
- return this._resolve(this._icon, t2);
51
+ icon(e2) {
52
+ return this._resolve(this._icon, e2);
264
53
  }
265
54
  shortcut() {
266
55
  return this._resolve(this._shortcut);
@@ -274,135 +63,135 @@ class ft {
274
63
  context() {
275
64
  return "function" == typeof this._context ? this._context() : this._context;
276
65
  }
277
- async execute(t2, e2) {
66
+ async execute(e2, t2) {
278
67
  if (!this.disabled() && this._callback) {
279
68
  try {
280
69
  let n2 = true;
281
- e2?.beforeExecute && (n2 = e2?.beforeExecute(this, t2));
70
+ t2?.beforeExecute && (n2 = t2?.beforeExecute(this, e2));
282
71
  if (false === await Promise.resolve(n2)) return false;
283
- const o2 = this._callback.bind(this)(t2, this);
72
+ const o2 = this._callback.bind(this)(e2, this);
284
73
  if (false === await Promise.resolve(o2)) return false;
285
- e2?.onExecute?.(this, t2), this._notifyExecute(t2);
74
+ t2?.onExecute?.(this, e2), this._notifyExecute(e2);
286
75
  } catch (n2) {
287
- return console.warn(n2), e2?.onError(this, n2, t2), this._notifyError(t2, n2), false;
76
+ return console.warn(n2), t2?.onError(this, n2, e2), this._notifyError(e2, n2), false;
288
77
  }
289
78
  return true;
290
79
  }
291
80
  }
292
- addPropertyListener(t2, e2 = false) {
293
- if (!t2) throw new Error("listener must be specified");
81
+ addPropertyListener(e2, t2 = false) {
82
+ if (!e2) throw new Error("listener must be specified");
294
83
  const n2 = this._listenersProperties;
295
- return n2.add(t2), e2 && t2({}, this), () => {
296
- n2.delete(t2);
84
+ return n2.add(e2), t2 && e2({}, this), () => {
85
+ n2.delete(e2);
297
86
  };
298
87
  }
299
- addExecuteListener(t2) {
300
- if (!t2) throw new Error("listener must be specified");
301
- const e2 = this._listenersExecute;
302
- return e2.add(t2), function() {
303
- e2.delete(t2);
88
+ addExecuteListener(e2) {
89
+ if (!e2) throw new Error("listener must be specified");
90
+ const t2 = this._listenersExecute;
91
+ return t2.add(e2), function() {
92
+ t2.delete(e2);
304
93
  };
305
94
  }
306
- _notifyExecute(t2) {
307
- const e2 = this;
95
+ _notifyExecute(e2) {
96
+ const t2 = this;
308
97
  this._listenersExecute.forEach((n2) => {
309
- n2.onExecute(e2, t2);
98
+ n2.onExecute(t2, e2);
310
99
  });
311
100
  }
312
- _notifyError(t2, e2) {
101
+ _notifyError(e2, t2) {
313
102
  const n2 = this;
314
103
  this._listenersExecute.forEach((o2) => {
315
- o2.onError?.(n2, t2, e2);
104
+ o2.onError?.(n2, e2, t2);
316
105
  });
317
106
  }
318
- updateCallback(t2) {
319
- return this._callback = t2 || null, this;
107
+ updateCallback(e2) {
108
+ return this._callback = e2 || null, this;
320
109
  }
321
- update(t2) {
322
- if (!t2) return;
323
- const e2 = this._applyProps(t2);
324
- return Object.keys(e2).length > 0 && this._notifyPropertyChange(e2), this;
110
+ update(e2) {
111
+ if (!e2) return;
112
+ const t2 = this._applyProps(e2);
113
+ return Object.keys(t2).length > 0 && this._notifyPropertyChange(t2), this;
325
114
  }
326
- _notifyPropertyChange(t2) {
327
- const e2 = this;
115
+ _notifyPropertyChange(e2) {
116
+ const t2 = this;
328
117
  this._listenersProperties.forEach((n2) => {
329
- n2(t2, e2);
118
+ n2(e2, t2);
330
119
  });
331
120
  }
332
- _applyProps(t2) {
333
- let e2 = {}, n2 = this;
334
- return Object.keys(t2).forEach((o2) => {
335
- let i2 = t2[o2];
336
- n2["_" + o2] !== i2 && (n2["_" + o2] = e2[o2] = i2);
337
- }), e2;
121
+ _applyProps(e2) {
122
+ let t2 = {}, n2 = this;
123
+ return Object.keys(e2).forEach((o2) => {
124
+ let i2 = e2[o2];
125
+ n2["_" + o2] !== i2 && (n2["_" + o2] = t2[o2] = i2);
126
+ }), t2;
338
127
  }
339
128
  }
340
- class _t extends ft {
129
+ class K extends $ {
341
130
  }
342
- const mt = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), gt = {};
343
- function yt() {
344
- return k;
131
+ const O = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), I = {};
132
+ function N() {
133
+ return s;
345
134
  }
346
- const vt = (t2) => "BracketLeft" === t2 ? "[" : "BracketRight" === t2 ? "]" : L.camelToPrettyCase(t2), wt = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: gt, boundPixel: function(t2, e2 = false, n2 = 0) {
347
- return t2;
348
- }, createSyntheticEvent: (t2) => {
349
- let e2 = false, n2 = false;
350
- return { nativeEvent: t2, currentTarget: t2.currentTarget, target: t2.target, bubbles: t2.bubbles, cancelable: t2.cancelable, defaultPrevented: t2.defaultPrevented, eventPhase: t2.eventPhase, isTrusted: t2.isTrusted, preventDefault: () => {
351
- e2 = true, t2.preventDefault();
352
- }, isDefaultPrevented: () => e2, stopPropagation: () => {
353
- n2 = true, t2.stopPropagation();
135
+ const H = (t2) => "BracketLeft" === t2 ? "[" : "BracketRight" === t2 ? "]" : e.camelToPrettyCase(t2), R = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: I, boundPixel: function(e2, t2 = false, n2 = 0) {
136
+ return e2;
137
+ }, createSyntheticEvent: (e2) => {
138
+ let t2 = false, n2 = false;
139
+ return { nativeEvent: e2, currentTarget: e2.currentTarget, target: e2.target, bubbles: e2.bubbles, cancelable: e2.cancelable, defaultPrevented: e2.defaultPrevented, eventPhase: e2.eventPhase, isTrusted: e2.isTrusted, preventDefault: () => {
140
+ t2 = true, e2.preventDefault();
141
+ }, isDefaultPrevented: () => t2, stopPropagation: () => {
142
+ n2 = true, e2.stopPropagation();
354
143
  }, isPropagationStopped: () => n2, persist: () => {
355
- }, timeStamp: t2.timeStamp, type: t2.type };
356
- }, detectIt: yt, focusableNodeNames: mt, toPrettyKeyCode: vt }, Symbol.toStringTag, { value: "Module" }));
357
- class xt {
358
- constructor(t2, e2) {
359
- this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid = L.uuidV4(), this._target = t2, this._groupKey = e2 ?? null, this._root = this, this._nodes = /* @__PURE__ */ new Map(), this._nodes.set(e2, this), this._children = /* @__PURE__ */ new Map(), this._listeners = /* @__PURE__ */ new Set(), this._commandsByKey = /* @__PURE__ */ new Map(), this._commandsByShortcut = /* @__PURE__ */ new Map();
360
- const n2 = this;
361
- this._unListenersByCommand = /* @__PURE__ */ new Map(), this._listenersByKey = /* @__PURE__ */ new Map(), this._commandsPropertyListener = (t3, e3) => {
362
- const o2 = n2._root._listenersByKey, i2 = e3.key(), r2 = o2.get(i2);
363
- r2 && n2._notifyCommands(r2, "onCommandChange", e3);
144
+ }, timeStamp: e2.timeStamp, type: e2.type };
145
+ }, detectIt: N, focusableNodeNames: O, toPrettyKeyCode: H }, Symbol.toStringTag, { value: "Module" }));
146
+ class W {
147
+ constructor(t2, n2) {
148
+ this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid = e.uuidV4(), this._target = t2, this._groupKey = n2 ?? null, this._root = this, this._nodes = /* @__PURE__ */ new Map(), this._nodes.set(n2, this), this._children = /* @__PURE__ */ new Map(), this._listeners = /* @__PURE__ */ new Set(), this._commandsByKey = /* @__PURE__ */ new Map(), this._commandsByShortcut = /* @__PURE__ */ new Map();
149
+ const o2 = this;
150
+ this._unListenersByCommand = /* @__PURE__ */ new Map(), this._listenersByKey = /* @__PURE__ */ new Map(), this._commandsPropertyListener = (e2, t3) => {
151
+ const n3 = o2._root._listenersByKey, i2 = t3.key(), r2 = n3.get(i2);
152
+ r2 && o2._notifyCommands(r2, "onCommandChange", t3);
364
153
  };
365
154
  }
366
- _getCommand(t2) {
367
- const e2 = this._commandsByKey.get(t2);
368
- return e2 || (this._parent?._getCommand(t2) ?? null);
155
+ _getCommand(e2) {
156
+ const t2 = this._commandsByKey.get(e2);
157
+ return t2 || (this._parent?._getCommand(e2) ?? null);
369
158
  }
370
- getCommand(t2, e2 = false) {
159
+ getCommand(e2, t2 = false) {
371
160
  const n2 = this._root._focused;
372
161
  let o2 = n2, i2 = n2 === this;
373
162
  for (; !i2 && o2; ) o2 === this && (i2 = true), o2 = o2._parent;
374
- return (i2 ? n2 : this)._getCommand(t2);
163
+ return (i2 ? n2 : this)._getCommand(e2);
375
164
  }
376
- createChildGroup(t2, e2, n2) {
165
+ createChildGroup(e2, t2, n2) {
377
166
  let o2;
378
167
  if (!n2) {
379
- let t3 = this;
380
- for (; t3 && !o2; ) {
381
- let n3 = t3._nodes.get(e2);
382
- n3 && (o2 = n3), t3 = t3._parent;
168
+ let e3 = this;
169
+ for (; e3 && !o2; ) {
170
+ let n3 = e3._nodes.get(t2);
171
+ n3 && (o2 = n3), e3 = e3._parent;
383
172
  }
384
173
  }
385
- o2 || (o2 = new xt(t2, e2), o2._parent = this, o2._root = this._root, o2._unListenersByCommand = null, o2._listenersByKey = null, o2._commandsPropertyListener = null);
386
- const i2 = (t3, o3) => {
387
- !t3.has(e2) || n2 ? t3.set(e2, o3) : void 0 === n2 && console.warn("commandGroup already registered", e2);
174
+ o2 || (o2 = new W(e2, t2), o2._parent = this, o2._root = this._root, o2._unListenersByCommand = null, o2._listenersByKey = null, o2._commandsPropertyListener = null);
175
+ const i2 = (e3, o3) => {
176
+ !e3.has(t2) || n2 ? e3.set(t2, o3) : void 0 === n2 && console.warn("commandGroup already registered", t2);
388
177
  };
389
178
  i2(this._root._nodes, o2);
390
179
  let r2 = this._parent;
391
180
  for (; r2; ) i2(this._nodes, o2), r2 = r2._parent;
392
- return this._children.set(e2, o2), this._notify("onGroupChange"), o2;
181
+ return this._children.set(t2, o2), this._notify("onGroupChange"), o2;
393
182
  }
394
183
  getKey() {
395
184
  return this._groupKey;
396
185
  }
397
- getGroup(t2) {
398
- return this._nodes.get(t2);
186
+ getGroup(e2) {
187
+ return this._nodes.get(e2);
399
188
  }
400
- _addCommands(t2, e2 = void 0) {
189
+ _addCommands(e2, t2 = void 0) {
401
190
  const n2 = this._commandsByKey, o2 = this._commandsByShortcut, i2 = this._root._commandsPropertyListener, r2 = this._root._unListenersByCommand;
402
- for (let s2 = 0; s2 < t2.length; s2++) {
403
- const l2 = t2[s2], a2 = l2.key();
404
- if (n2.has(a2) && !e2) {
405
- void 0 === e2 && console.warn("command already registered", a2);
191
+ for (let s2 = 0; s2 < e2.length; s2++) {
192
+ const l2 = e2[s2], a2 = l2.key();
193
+ if (n2.has(a2) && !t2) {
194
+ void 0 === t2 && console.warn("command already registered", a2);
406
195
  continue;
407
196
  }
408
197
  n2.set(a2, l2);
@@ -413,55 +202,55 @@ class xt {
413
202
  const u2 = l2.shortcut();
414
203
  if (!u2) continue;
415
204
  const d2 = Array.isArray(u2) ? u2 : [u2];
416
- for (let t3 = 0; t3 < d2.length; t3++) {
417
- const n3 = Et(d2[t3]), i3 = o2.get(n3);
418
- i3 && !e2 && void 0 === e2 && console.warn(`Shortcut already registered: ${n3}, ${a2}, ${i3}.`), o2.set(n3, a2);
205
+ for (let e3 = 0; e3 < d2.length; e3++) {
206
+ const n3 = j(d2[e3]), i3 = o2.get(n3);
207
+ i3 && !t2 && void 0 === t2 && console.warn(`Shortcut already registered: ${n3}, ${a2}, ${i3}.`), o2.set(n3, a2);
419
208
  }
420
209
  }
421
210
  }
422
211
  removeFromParent() {
423
212
  if (!this._parent) return;
424
- let t2 = this._parent, e2 = [];
213
+ let e2 = this._parent, t2 = [];
425
214
  const n2 = this._groupKey;
426
- for (; t2; ) e2.push(t2._nodes), t2._nodes.delete(n2), t2 = t2._parent;
427
- t2 = this._parent;
428
- const o2 = (t3) => {
429
- t3._children.forEach((t4) => {
430
- for (let n3 = 0; n3 < e2.length; n3++) t4._nodes.delete(e2[n3]);
431
- o2(t4);
215
+ for (; e2; ) t2.push(e2._nodes), e2._nodes.delete(n2), e2 = e2._parent;
216
+ e2 = this._parent;
217
+ const o2 = (e3) => {
218
+ e3._children.forEach((e4) => {
219
+ for (let n3 = 0; n3 < t2.length; n3++) e4._nodes.delete(t2[n3]);
220
+ o2(e4);
432
221
  });
433
222
  };
434
223
  o2(this), this._parent = null, this._notify("onGroupChange");
435
224
  }
436
- addCommands(t2, e2) {
437
- this._addCommands(t2, e2), this._notify("onGroupChange");
225
+ addCommands(e2, t2) {
226
+ this._addCommands(e2, t2), this._notify("onGroupChange");
438
227
  }
439
228
  getActive() {
440
229
  return this._root._focused ?? this._root;
441
230
  }
442
- activate(t2) {
443
- let e2 = this;
444
- if (t2 && (e2 = this._nodes.get(t2), !e2)) return void console.warn("group not found", t2);
231
+ activate(e2) {
232
+ let t2 = this;
233
+ if (e2 && (t2 = this._nodes.get(e2), !t2)) return void console.warn("group not found", e2);
445
234
  let n2 = this._root._focused ?? this._root;
446
235
  for (; n2; ) n2 = n2._parent;
447
- this._root._focused !== e2 && (this._root._focused = e2, this._notify("onGroupChange"), this._notify("onActiveChange"));
236
+ this._root._focused !== t2 && (this._root._focused = t2, this._notify("onGroupChange"), this._notify("onActiveChange"));
448
237
  }
449
- findCommandByEvent(t2) {
450
- const e2 = [];
451
- t2.altKey && e2.push(A.Alt), t2.shiftKey && e2.push(A.Shift), t2.ctrlKey && e2.push(A.Ctrl), t2.metaKey && e2.push(A.Meta);
452
- let n2 = Et({ key: t2.code, modifiers: e2 });
238
+ findCommandByEvent(e2) {
239
+ const t2 = [];
240
+ e2.altKey && t2.push(A.Alt), e2.shiftKey && t2.push(A.Shift), e2.ctrlKey && t2.push(A.Ctrl), e2.metaKey && t2.push(A.Meta);
241
+ let n2 = j({ key: e2.code, modifiers: t2 });
453
242
  const o2 = this._commandsByShortcut;
454
243
  let i2 = o2.get(n2);
455
- i2 || (n2 = Et({ key: t2.key, modifiers: e2 }), i2 = o2.get(n2)), !i2 && t2.code.startsWith("Digit") && (n2 = Et({ key: t2.code.substring(5, t2.code.length), modifiers: e2 }), i2 = this._commandsByShortcut.get(n2)), !i2 && t2.code.startsWith("Key") && (i2 = Et({ key: t2.code.substring(3, t2.code.length), modifiers: e2 }), i2 = o2.get(n2));
244
+ i2 || (n2 = j({ key: e2.key, modifiers: t2 }), i2 = o2.get(n2)), !i2 && e2.code.startsWith("Digit") && (n2 = j({ key: e2.code.substring(5, e2.code.length), modifiers: t2 }), i2 = this._commandsByShortcut.get(n2)), !i2 && e2.code.startsWith("Key") && (i2 = j({ key: e2.code.substring(3, e2.code.length), modifiers: t2 }), i2 = o2.get(n2));
456
245
  let r2 = null;
457
- return i2 && (r2 = this._commandsByKey.get(i2), r2 && r2.disabled() && (r2 = null), !r2 || r2.target() && r2.target().contains(t2.target) || (r2 = null)), r2 || (this._parent?.findCommandByEvent(t2) ?? null);
246
+ return i2 && (r2 = this._commandsByKey.get(i2), r2 && r2.disabled() && (r2 = null), !r2 || r2.target() && r2.target().contains(e2.target) || (r2 = null)), r2 || (this._parent?.findCommandByEvent(e2) ?? null);
458
247
  }
459
- dispatchToFocusedCommand(t2) {
460
- const e2 = this.getActive();
461
- if (!e2) return false;
462
- if (t2.isDefaultPrevented()) return false;
463
- const n2 = e2.findCommandByEvent?.(t2);
464
- return !!n2 && (n2.execute(), t2.preventDefault(), true);
248
+ dispatchToFocusedCommand(e2) {
249
+ const t2 = this.getActive();
250
+ if (!t2) return false;
251
+ if (e2.isDefaultPrevented()) return false;
252
+ const n2 = t2.findCommandByEvent?.(e2);
253
+ return !!n2 && (n2.execute(), e2.preventDefault(), true);
465
254
  }
466
255
  getRoot() {
467
256
  return this._parent ? this._parent.getRoot() : this;
@@ -469,728 +258,575 @@ class xt {
469
258
  getParent() {
470
259
  return this._parent;
471
260
  }
472
- addListener(t2, e2) {
473
- const n2 = this._listeners, o2 = e2?.keys, i2 = this._root._listenersByKey;
474
- if (o2 && !t2.onCommandChange) throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");
261
+ addListener(e2, t2) {
262
+ const n2 = this._listeners, o2 = t2?.keys, i2 = this._root._listenersByKey;
263
+ if (o2 && !e2.onCommandChange) throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");
475
264
  let r2 = null;
476
- if (o2) for (let e3 = 0; e3 < o2.length; e3++) {
477
- const n3 = o2[e3];
265
+ if (o2) for (let t3 = 0; t3 < o2.length; t3++) {
266
+ const n3 = o2[t3];
478
267
  if (!n3) continue;
479
268
  let s2 = i2.get(n3);
480
- s2 || (s2 = /* @__PURE__ */ new Set(), i2.set(n3, s2)), r2 || (r2 = []), r2.push(s2), s2.add(t2);
269
+ s2 || (s2 = /* @__PURE__ */ new Set(), i2.set(n3, s2)), r2 || (r2 = []), r2.push(s2), s2.add(e2);
481
270
  }
482
- return n2.add(t2), () => {
483
- if (r2) for (let e3 = 0; e3 < r2.length; e3++) {
484
- r2[e3].delete(t2);
271
+ return n2.add(e2), () => {
272
+ if (r2) for (let t3 = 0; t3 < r2.length; t3++) {
273
+ r2[t3].delete(e2);
485
274
  }
486
- n2.delete(t2);
275
+ n2.delete(e2);
487
276
  };
488
277
  }
489
- _notifyCommands(t2, e2, n2) {
278
+ _notifyCommands(e2, t2, n2) {
490
279
  const o2 = this;
491
280
  setTimeout(() => {
492
- t2.forEach((t3) => {
493
- t3[e2]?.(o2, n2);
281
+ e2.forEach((e3) => {
282
+ e3[t2]?.(o2, n2);
494
283
  });
495
284
  }, 0);
496
285
  }
497
- _notify(t2, e2) {
286
+ _notify(e2, t2) {
498
287
  const n2 = this;
499
288
  setTimeout(() => {
500
289
  n2._listeners.forEach((o2) => {
501
- o2[t2]?.(n2, e2);
502
- }), n2._parent && n2._parent._notify(t2, e2);
290
+ o2[e2]?.(n2, t2);
291
+ }), n2._parent && n2._parent._notify(e2, t2);
503
292
  }, 0);
504
293
  }
505
294
  getAllCommands() {
506
- const t2 = [], e2 = this._groupKey;
295
+ const e2 = [], t2 = this._groupKey;
507
296
  return this._commandsByKey.forEach((n2) => {
508
- t2.push({ command: n2, groupKey: e2 });
509
- }), this._children.forEach((e3) => {
510
- t2.push(...e3.getAllCommands());
511
- }), t2;
297
+ e2.push({ command: n2, groupKey: t2 });
298
+ }), this._children.forEach((t3) => {
299
+ e2.push(...t3.getAllCommands());
300
+ }), e2;
512
301
  }
513
302
  }
514
- const bt = L.getOS() === L.OSType.MacOS || L.getOS() === L.OSType.IOS ? "Cmd" : "Ctrl", St = L.getOS() === L.OSType.MacOS || L.getOS() === L.OSType.IOS ? "⌘" : "^", Et = (t2, e2 = false) => {
303
+ const V = e.getOS() === e.OSType.MacOS || e.getOS() === e.OSType.IOS ? "Cmd" : "Ctrl", F = e.getOS() === e.OSType.MacOS || e.getOS() === e.OSType.IOS ? "⌘" : "^", j = (e2, t2 = false) => {
515
304
  const n2 = {};
516
- for (let e3 = 0; t2.modifiers && e3 < t2.modifiers.length; e3++) n2[t2.modifiers[e3]] = true;
305
+ for (let t3 = 0; e2.modifiers && t3 < e2.modifiers.length; t3++) n2[e2.modifiers[t3]] = true;
517
306
  let o2 = "";
518
- return (n2?.[A.Ctrl] || n2?.[A.Meta]) && (o2 += (o2.length > 0 ? "+" : "") + (e2 ? St : bt)), n2?.[A.Alt] && (o2 += e2 ? "⌥" : "Alt"), n2?.[A.Shift] && (o2 += (o2.length > 0 ? "+" : "") + (e2 ? "⇧" : "Shift")), o2 += (o2.length > 0 ? "+" : "") + vt(t2.key), o2;
307
+ return (n2?.[A.Ctrl] || n2?.[A.Meta]) && (o2 += (o2.length > 0 ? "+" : "") + (t2 ? F : V)), n2?.[A.Alt] && (o2 += t2 ? "⌥" : "Alt"), n2?.[A.Shift] && (o2 += (o2.length > 0 ? "+" : "") + (t2 ? "⇧" : "Shift")), o2 += (o2.length > 0 ? "+" : "") + H(e2.key), o2;
519
308
  };
520
- function Lt(t2, e2 = null) {
521
- const n2 = s(e2);
522
- n2.current = e2;
523
- const [o2, i2] = l((t3) => t3 + 1, 0), r2 = p(() => Array.isArray(t2) ? t2 : [t2], [t2]);
524
- return h(() => {
525
- if (!r2 || 0 === r2.length) return;
526
- const t3 = (t4, e3) => {
527
- n2.current?.onChange?.(e3), i2();
309
+ function X(t2, n2 = null) {
310
+ const o2 = a(n2);
311
+ o2.current = n2;
312
+ const [i2, r2] = c((e2) => e2 + 1, 0), s2 = h(() => Array.isArray(t2) ? t2 : [t2], [t2]);
313
+ return u(() => {
314
+ if (!s2 || 0 === s2.length) return;
315
+ const t3 = (e2, t4) => {
316
+ o2.current?.onChange?.(t4), r2();
528
317
  };
529
- let o3 = null;
530
- e2 && (o3 = { onExecute(t4, e3) {
531
- n2.current?.onExecute?.(t4, e3);
532
- }, onError(t4, e3, o4) {
533
- n2.current?.onError?.(t4, e3, o4);
318
+ let i3 = null;
319
+ n2 && (i3 = { onExecute(e2, t4) {
320
+ o2.current?.onExecute?.(e2, t4);
321
+ }, onError(e2, t4, n3) {
322
+ o2.current?.onError?.(e2, t4, n3);
534
323
  } });
535
- const s2 = /* @__PURE__ */ new Set();
536
- for (let n3 = 0; n3 < r2.length; n3++) s2.add(r2[n3]?.addPropertyListener(L.debounce(t3, 0), true)), e2 && s2.add(r2[n3]?.addExecuteListener(o3));
324
+ const l2 = /* @__PURE__ */ new Set();
325
+ for (let o3 = 0; o3 < s2.length; o3++) l2.add(s2[o3]?.addPropertyListener(e.debounce(t3, 0), true)), n2 && l2.add(s2[o3]?.addExecuteListener(i3));
537
326
  return () => {
538
- s2.forEach((t4) => {
539
- t4?.();
327
+ l2.forEach((e2) => {
328
+ e2?.();
540
329
  });
541
330
  };
542
- }, [t2]), o2;
331
+ }, [t2]), i2;
543
332
  }
544
- const Mt = (t2, e2) => {
545
- if (!e2 || !t2 || 0 === e2.length) return L.EmptyArray;
546
- const n2 = e2.length, o2 = new Array(n2);
547
- for (let i2 = 0; i2 < n2; i2++) {
548
- const n3 = e2[i2], r2 = n3 ? t2.getCommand(n3) : null;
549
- o2[i2] = r2;
333
+ const Y = (t2, n2) => {
334
+ if (!n2 || !t2 || 0 === n2.length) return e.EmptyArray;
335
+ const o2 = n2.length, i2 = new Array(o2);
336
+ for (let e2 = 0; e2 < o2; e2++) {
337
+ const o3 = n2[e2], r2 = o3 ? t2.getCommand(o3) : null;
338
+ i2[e2] = r2;
550
339
  }
551
- return o2;
340
+ return i2;
552
341
  };
553
- function Tt(t2, e2 = null, n2 = null, o2) {
554
- const i2 = s(n2);
555
- i2.current = n2, e2 && !Array.isArray(e2) && (e2 = [e2]);
556
- const [r2, l2] = c(Mt(t2, e2)), a2 = o2 ? [...o2, t2] : [t2];
557
- return h(() => {
342
+ function U(e2, t2 = null, n2 = null, o2) {
343
+ const i2 = a(n2);
344
+ i2.current = n2, t2 && !Array.isArray(t2) && (t2 = [t2]);
345
+ const [r2, s2] = d(Y(e2, t2)), l2 = o2 ? [...o2, e2] : [e2];
346
+ return u(() => {
558
347
  const n3 = { onGroupChange: () => {
559
- const n4 = Mt(t2, e2);
560
- l2(n4), i2.current?.onChange?.(this);
348
+ const n4 = Y(e2, t2);
349
+ s2(n4), i2.current?.onChange?.(this);
561
350
  } };
562
351
  let o3;
563
- e2 && e2.length > 0 && (o3 = { keys: e2 }, n3.onCommandChange = (n4, o4) => {
564
- i2.current?.onChange?.(t2), l2(Mt(t2, e2));
352
+ t2 && t2.length > 0 && (o3 = { keys: t2 }, n3.onCommandChange = (n4, o4) => {
353
+ i2.current?.onChange?.(e2), s2(Y(e2, t2));
565
354
  });
566
- const r3 = t2?.addListener(n3, o3), s2 = Mt(t2, e2);
567
- return l2(s2), i2.current?.onChange && i2.current?.onChange(t2), () => {
355
+ const r3 = e2?.addListener(n3, o3), l3 = Y(e2, t2);
356
+ return s2(l3), i2.current?.onChange && i2.current?.onChange(e2), () => {
568
357
  r3?.();
569
358
  };
570
- }, a2), r2;
359
+ }, l2), r2;
360
+ }
361
+ const G = { Toolbar: "toolbar", Menuitem: "menuitem" }, Z = { BottomEnd: "bottom-end", BottomStart: "bottom-start", Bottom: "bottom", LeftEnd: "left-end", LeftStart: "left-start", Left: "left", RightEnd: "right-end", RightStart: "right-start", Right: "right", TopEnd: "top-end", TopStart: "top-start", Top: "top" }, q = p(f((e2, t2) => {
362
+ const { refFocusStart: n2, ...o2 } = e2, i2 = a(null), r2 = m(() => {
363
+ if (n2) return void n2?.current?.focus();
364
+ const e3 = i2.current.parentElement.children;
365
+ let t3 = [];
366
+ const o3 = e3.length;
367
+ for (let n3 = 0; n3 < o3 && e3[n3] !== i2.current; n3++) {
368
+ const o4 = e3[n3], i3 = o4.getAttribute("tabindex");
369
+ if (null == i3 || "-1" === i3) continue;
370
+ "true" !== o4.getAttribute("disabled") && (o4.focus && t3.push({ tabindex: parseInt(i3), child: o4 }));
371
+ }
372
+ 0 !== t3.length && (t3.sort(function(e4, t4) {
373
+ return e4.tabindex - t4.tabindex;
374
+ }), t3[0].child.focus());
375
+ }, [n2]);
376
+ return x("div", { tabIndex: 0, ref: L([i2, t2]), onFocus: r2, ...o2 });
377
+ }));
378
+ const J = p(f((e2, t2) => {
379
+ const { className: n2, style: o2, children: i2, radius: r2 = 4, strokeWidth: s2 = 1, strokeColor: c2 = "grey", ...u2 } = e2, [d2, { width: p2, height: f2 }] = M(), m2 = a(null), _2 = (e3, t3 = 0) => {
380
+ const n3 = e3 / 2, o3 = f2 - n3 + t3;
381
+ return (function(e4, t4, n4 = false) {
382
+ if (0 === t4) return e4;
383
+ function o4(e5, t5, n5) {
384
+ let o5 = t5.x - e5.x, r4 = t5.y - e5.y, s4 = Math.sqrt(o5 * o5 + r4 * r4);
385
+ return i3(e5, t5, Math.min(1, n5 / s4));
386
+ }
387
+ function i3(e5, t5, n5) {
388
+ return { x: e5.x + (t5.x - e5.x) * n5, y: e5.y + (t5.y - e5.y) * n5 };
389
+ }
390
+ function r3(e5, t5) {
391
+ e5.length > 2 && (e5[e5.length - 2] = t5.x, e5[e5.length - 1] = t5.y);
392
+ }
393
+ function s3(e5) {
394
+ return { x: parseFloat(e5[e5.length - 2]), y: parseFloat(e5[e5.length - 1]) };
395
+ }
396
+ let l2 = e4.split(/[,\s]/).reduce(function(e5, t5) {
397
+ let n5 = t5.match("([a-zA-Z])(.+)");
398
+ return n5 ? (e5.push(n5[1]), e5.push(n5[2])) : e5.push(t5), e5;
399
+ }, []).reduce(function(e5, t5) {
400
+ return parseFloat(t5) == t5 && e5.length ? e5[e5.length - 1].push(t5) : e5.push([t5]), e5;
401
+ }, []), a2 = [];
402
+ if (l2.length > 1) {
403
+ let e5 = s3(l2[0]), c3 = null;
404
+ "Z" === l2[l2.length - 1][0] && l2[0].length > 2 && (c3 = ["L", e5.x, e5.y], l2[l2.length - 1] = c3), a2.push(l2[0]);
405
+ for (let e6 = 1; e6 < l2.length; e6++) {
406
+ let h2 = a2[a2.length - 1], u3 = l2[e6], d3 = u3 === c3 ? l2[1] : l2[e6 + 1];
407
+ if (d3 && h2 && h2.length > 2 && "L" === u3[0] && d3.length > 2 && "L" === d3[0]) {
408
+ let e7, l3, c4 = s3(h2), p3 = s3(u3), f3 = s3(d3);
409
+ n4 ? (e7 = i3(p3, h2.origPoint || c4, t4), l3 = i3(p3, d3.origPoint || f3, t4)) : (e7 = o4(p3, c4, t4), l3 = o4(p3, f3, t4)), r3(u3, e7), u3.origPoint = p3, a2.push(u3);
410
+ let m3 = i3(e7, p3, 0.5), _3 = i3(p3, l3, 0.5), g3 = ["C", m3.x, m3.y, _3.x, _3.y, l3.x, l3.y];
411
+ g3.origPoint = p3, a2.push(g3);
412
+ } else a2.push(u3);
413
+ }
414
+ if (c3) {
415
+ let e6 = s3(a2[a2.length - 1]);
416
+ a2.push(["Z"]), r3(a2[0], e6);
417
+ }
418
+ } else a2 = l2;
419
+ return a2.reduce(function(e5, t5) {
420
+ return e5 + t5.join(" ") + " ";
421
+ }, "");
422
+ })(`${`M 0 ${n3} L ${r2 - 0.5} ${n3} L ${r2 - 0.5} ${o3} L ${2 * r2} ${o3}`} ${`L ${p2 - 2 * r2} ${o3}`} ${`M ${p2 - 2 * r2} ${o3} L ${p2 - r2} ${o3} L ${p2 - r2} ${n3} L ${p2} ${n3}`}`, r2);
423
+ }, g2 = h(() => _2(s2), [p2, f2, r2, s2]), y2 = h(() => {
424
+ if (0 === r2) return;
425
+ const e3 = r2 / 2;
426
+ return _2(r2) + `L ${p2} 0 L 0 0 L 0 ${e3}`;
427
+ }, [g2, r2, s2]), v2 = h(() => ({ style: { clipPath: `path('${y2}')` } }), [y2]);
428
+ return S("div", { className: n2, style: { display: "flex", flexDirection: "row", ...o2 }, ...u2, ref: L([m2, d2, t2]), children: [l.isValidElement(i2) ? l.cloneElement(i2, v2) : x(E, {}), x("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: p2, height: f2, viewBox: `0 0 ${p2} ${f2}`, children: x("path", { d: g2, stroke: c2, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: s2 }) })] });
429
+ })), Q = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" };
430
+ class ee extends t {
431
+ setOverrides(e2) {
432
+ super.setOverrides(e2);
433
+ }
434
+ getDelegate() {
435
+ return this._overrides;
436
+ }
437
+ showMessage(e2, t2) {
438
+ const o2 = this.getDelegate();
439
+ if (o2?.showMessage) return o2.showMessage(e2, t2);
440
+ t2?.type !== Q.Warning ? t2?.type !== Q.Error ? n.log(e2) : n.error(e2) : n.warn(e2);
441
+ }
442
+ showBusy(e2, t2) {
443
+ const n2 = this.getDelegate();
444
+ return n2?.showBusy ? n2.showBusy(e2, t2) : new Promise((e3) => {
445
+ e3(() => {
446
+ });
447
+ });
448
+ }
449
+ showWindow(e2, t2) {
450
+ const n2 = this.getDelegate();
451
+ if (n2?.showWindow) return n2.showWindow(e2, t2);
452
+ }
453
+ showError(e2) {
454
+ const t2 = this.getDelegate();
455
+ t2?.showError ? t2.showError(e2) : n.error(e2);
456
+ }
457
+ showOptions(e2) {
458
+ const t2 = this.getDelegate();
459
+ return t2?.showOptions ? t2.showOptions(e2) : Promise.resolve("");
460
+ }
461
+ showInput(e2) {
462
+ const t2 = this.getDelegate();
463
+ return t2?.showInput ? t2.showInput(e2) : Promise.resolve({ input: "", option: "" });
464
+ }
465
+ }
466
+ const te = _(new ee()), ne = ({ children: e2, notifier: t2 }) => (l.useEffect(() => {
467
+ const e3 = n.getOverrides();
468
+ return n.setOverrides(t2), () => {
469
+ n.setOverrides(e3);
470
+ };
471
+ }, [t2]), l.createElement(te.Provider, { value: t2 }, e2)), oe = () => g(te), ie = 3, re = 0.5, se = 50, le = (e2) => ({ x: e2.x, y: e2.y, width: e2.width, height: e2.height, top: e2.top, left: e2.left, right: e2.right, bottom: e2.bottom });
472
+ function ae(e2 = {}) {
473
+ const { threshold: t2 = re, stillnessThreshold: n2 = ie, maxHierarchyDepth: o2 = se } = e2, [i2, r2] = M(), s2 = a(null), [l2, h2] = c((e3) => e3 + 1, 0), p2 = a(void 0), f2 = a({ x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 }), _2 = m((e3) => {
474
+ s2.current = e3, "function" == typeof i2 && i2(e3);
475
+ }, [i2]), [g2, y2] = d(r2);
476
+ return u(() => {
477
+ r2 && !g2 && y2(r2);
478
+ }, [r2, g2]), u(() => {
479
+ const e3 = s2.current;
480
+ if (!e3) return;
481
+ let i3 = false, r3 = 0;
482
+ const l3 = () => {
483
+ if (!e3) return;
484
+ const o3 = e3.getBoundingClientRect(), s3 = f2.current;
485
+ Math.abs(o3.x - s3.x) > t2 || Math.abs(o3.y - s3.y) > t2 || Math.abs(o3.width - s3.width) > t2 || Math.abs(o3.height - s3.height) > t2 ? (i3 || (i3 = true, y2(le(o3)), h2()), r3 = 0) : r3++, i3 && r3 >= n2 && (i3 = false, y2(le(o3)), h2()), f2.current = le(o3), p2.current = requestAnimationFrame(l3);
486
+ };
487
+ p2.current = requestAnimationFrame(l3);
488
+ const a2 = (e4) => {
489
+ i3 = true, h2();
490
+ }, c2 = (e4) => {
491
+ i3 = false, r3 = n2, h2();
492
+ };
493
+ let u2 = e3;
494
+ const d2 = [];
495
+ for (; u2 && u2 !== document.documentElement && (u2.addEventListener("animationstart", a2, true), u2.addEventListener("animationend", c2, true), u2.addEventListener("transitionstart", a2, true), u2.addEventListener("transitionend", c2, true), d2.push(u2), u2 = u2.parentElement, !(d2.length > o2)); ) ;
496
+ return () => {
497
+ p2.current && cancelAnimationFrame(p2.current), d2.forEach((e4) => {
498
+ e4.removeEventListener("animationstart", a2, true), e4.removeEventListener("animationend", c2, true), e4.removeEventListener("transitionstart", a2, true), e4.removeEventListener("transitionend", c2, true);
499
+ });
500
+ };
501
+ }, [l2, r2, t2, n2, o2]), [_2, g2];
502
+ }
503
+ const ce = (e2, t2) => {
504
+ const n2 = m((...t3) => e2?.(...t3), t2), o2 = a(null);
505
+ o2.current = n2;
506
+ const i2 = m((...e3) => o2.current?.(...e3), []);
507
+ if (o2.current) return i2;
508
+ };
509
+ function he(e2) {
510
+ const [t2, n2] = d("undefined" != typeof window ? window.devicePixelRatio : 1), o2 = a(null);
511
+ return u(() => {
512
+ if (!("undefined" != typeof window && "matchMedia" in window)) return;
513
+ const e3 = () => {
514
+ const t3 = window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);
515
+ t3.addEventListener("change", e3, { once: true, passive: true }), n2(window.devicePixelRatio), o2.current = { mediaMatcher: t3, listener: e3 };
516
+ };
517
+ return e3(), () => {
518
+ o2.current && o2.current.mediaMatcher.removeEventListener("change", o2.current.listener);
519
+ };
520
+ }, [e2]), t2;
521
+ }
522
+ function ue(e2) {
523
+ if ("undefined" == typeof window) return 1;
524
+ const { defaultDpr: t2 = 1, maxDpr: n2 = 3, round: o2 = true } = e2 || {}, i2 = "undefined" != typeof window && "number" == typeof window.devicePixelRatio ? window.devicePixelRatio : t2;
525
+ return Math.min(Math.max(1, o2 ? Math.floor(i2) : i2), n2);
526
+ }
527
+ function de(e2, t2, n2) {
528
+ const o2 = ce(t2, [t2]);
529
+ u(() => {
530
+ const t3 = (t4) => {
531
+ e2.current && !e2.current.contains(t4.target) && o2(t4);
532
+ };
533
+ return n2 && false === n2.mouseEvents || (document.addEventListener("mousedown", t3), document.addEventListener("touchstart", t3)), n2 && false === n2.focusEvents || document.addEventListener("focus", t3), () => {
534
+ document.removeEventListener("mousedown", t3), document.removeEventListener("touchstart", t3), document.removeEventListener("focus", t3);
535
+ };
536
+ }, [e2]);
537
+ }
538
+ function pe(e2) {
539
+ if (!e2) throw new Error("must have a PointerHandlerOptions");
540
+ const { onPointerDown: t2, onPointerUp: n2, onPointerMoveOrWait: o2, processTouch: i2 = false, consumeTouch: r2 = true } = e2, s2 = ce(t2, [t2]), l2 = ce(n2, [n2]), c2 = ce(o2, [o2]), h2 = a(false), d2 = e2?.timerInitial ?? 230, p2 = e2?.timerContinuous ?? d2 / 2, f2 = a(null), _2 = a(null), g2 = a(null), y2 = a(null), v2 = m(() => {
541
+ y2.current && (clearTimeout(y2.current), y2.current = null);
542
+ }, []), w2 = m((e3) => {
543
+ y2.current = setTimeout(() => {
544
+ window.requestAnimationFrame(() => {
545
+ false !== h2.current && c2?.(_2.current, g2.current, f2.current);
546
+ }), w2(p2);
547
+ }, e3 ?? d2);
548
+ }, []);
549
+ u(() => () => v2(), []);
550
+ const b2 = i2 ? "pointer" : "mouse", x2 = m((e3) => {
551
+ e3.stopPropagation(), e3.stopImmediatePropagation(), e3.preventDefault();
552
+ }, []), S2 = ce((e3) => {
553
+ document.removeEventListener(`${b2}move`, M2), document.removeEventListener(`${b2}up`, S2), document.removeEventListener("keydown", T2), document.removeEventListener("keyup", k2), document.removeEventListener("touchstart", x2, { capture: true }), document.removeEventListener("touchmove", x2, { capture: true }), window.removeEventListener("blur", E2), v2(), window.requestAnimationFrame(() => {
554
+ false !== h2.current && (h2.current = false, l2?.(e3, g2.current, f2.current), g2.current = null);
555
+ });
556
+ }, []), E2 = m(() => {
557
+ false !== h2.current && (h2.current = false, S2(_2.current));
558
+ }, []), L2 = ce(() => {
559
+ v2(), w2(p2), window.requestAnimationFrame(() => {
560
+ false !== h2.current && c2?.(_2.current, g2.current, f2.current);
561
+ });
562
+ }, [p2]), M2 = ce((e3) => {
563
+ _2.current = e3, L2();
564
+ }, []), T2 = ce((e3) => {
565
+ g2.current = { ctrlKey: e3.ctrlKey, shiftKey: e3.shiftKey, altKey: e3.altKey, metaKey: e3.metaKey }, L2();
566
+ }, []), k2 = ce((e3) => {
567
+ g2.current = { ctrlKey: e3.ctrlKey, shiftKey: e3.shiftKey, altKey: e3.altKey, metaKey: e3.metaKey }, L2();
568
+ }, [p2]);
569
+ return ce((e3) => {
570
+ if (e3.isDefaultPrevented()) return;
571
+ g2.current = { ctrlKey: e3.ctrlKey, shiftKey: e3.shiftKey, altKey: e3.altKey, metaKey: e3.metaKey };
572
+ false !== s2(e3, g2.current) && (f2.current = e3, _2.current = e3.nativeEvent, document.addEventListener(`${b2}up`, S2, { passive: false }), document.addEventListener(`${b2}move`, M2, { passive: false }), document.addEventListener("keydown", T2, { passive: false }), document.addEventListener("keyup", k2, { passive: false }), window.addEventListener("blur", E2, { passive: true }), i2 && r2 && (document.addEventListener("touchstart", x2, { passive: false, capture: true }), document.addEventListener("touchmove", x2, { passive: false, capture: true })), h2.current = true, w2(d2));
573
+ }, [d2, i2]);
571
574
  }
572
- const Ct = { Toolbar: "toolbar", Menuitem: "menuitem" }, kt = ht({ setClipboard: (t2) => {
575
+ function fe(e2, t2) {
576
+ return pe({ onPointerDown: e2, onPointerMoveOrWait: (t3, n2, o2) => {
577
+ e2?.(o2);
578
+ }, ...t2 });
579
+ }
580
+ const me = ({ initValue: e2, useHookBody: t2, applyStateChange: n2 }) => {
581
+ const o2 = a(e2);
582
+ if ("function" != typeof t2) throw new Error("function expected as hook body parameter. got " + typeof t2);
583
+ const i2 = t2();
584
+ return y(() => {
585
+ o2.current !== i2 && (o2.current = i2, n2(i2));
586
+ }, [n2, i2]), null;
587
+ }, _e = (e2) => {
588
+ console && console.warn && console.warn(e2);
589
+ }, ge = "object" == typeof self && self.self === self && self || "object" == typeof global && global.global === global && global || void 0;
590
+ let ye = 1, ve = false, we = false;
591
+ const be = [], xe = [], Se = () => {
592
+ xe.forEach((e2) => e2());
593
+ }, Ee = ({ automaticContainerInternalUseOnly: e2 }) => {
594
+ const [t2, n2] = d([]), o2 = a([]);
595
+ return o2.current = t2, e2 || false !== ve || (we = true), u(() => {
596
+ let t3 = true;
597
+ function i2() {
598
+ if (t3) return xe[0] !== i2 ? (e2 || true !== ve || _e("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void n2((e3) => [])) : void n2([...be]);
599
+ }
600
+ return xe.push(i2), Se(), () => {
601
+ t3 = false, o2.current?.length > 0 && _e("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), xe.splice(xe.indexOf(i2), 1), Se();
602
+ };
603
+ }, [e2]), x(E, { children: t2.map(({ hook: e3, key: t3 }) => v(me, { ...e3, key: t3 })) });
604
+ }, Le = (e2) => {
605
+ const t2 = ye++;
606
+ return be.push({ hook: e2, key: t2 }), 0 === xe.length && false === we && (ve = true, ((e3) => {
607
+ if (ge.document && ge.document.createElement) {
608
+ const t3 = ge.document.createElement("div");
609
+ k(t3).render(x(e3, { automaticContainerInternalUseOnly: true }));
610
+ } else _e("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
611
+ })(Ee)), Se(), () => {
612
+ be.splice(be.findIndex((e3) => e3.key === t2), 1), Se();
613
+ };
614
+ };
615
+ let Me = null;
616
+ Me || (Me = (e2, t2, n2 = {}) => {
617
+ let o2, i2, r2 = false, s2 = false, l2 = [], { unmountIfNoConsumers: a2 = false } = n2;
618
+ const c2 = (e3) => {
619
+ i2 = e3, C(() => l2.forEach((t3) => t3(e3)));
620
+ }, h2 = () => (s2 || (i2 = "function" == typeof e2 ? e2() : e2, s2 = true), i2);
621
+ return () => {
622
+ const [n3, s3] = d(h2);
623
+ return u(() => (r2 || (r2 = true, o2 = Le({ initValue: e2, useHookBody: t2, applyStateChange: c2 })), l2.push(s3), i2 !== n3 && s3(i2), () => {
624
+ l2.splice(l2.indexOf(s3), 1), 0 === l2.length && a2 && (o2(), r2 = false);
625
+ }), []), n3;
626
+ };
627
+ });
628
+ const Te = Me;
629
+ let ke = () => {
630
+ console.warn("You must call useEditMode before setting its state.");
631
+ };
632
+ const Ce = Te(null, () => {
633
+ const [e2, t2] = d(null);
634
+ return ke = t2, e2;
635
+ }), De = () => {
636
+ const e2 = Ce();
637
+ return h(() => ({ setMode: (e3) => {
638
+ ke((t2) => ("function" == typeof e3 && (e3 = e3(t2)), e3?.onModeChange?.(e3 ?? null), e3));
639
+ }, getMode: () => e2 }), [e2]);
640
+ }, Pe = Te({ setClipboard: (e2) => {
573
641
  throw new Error("This is only available via the useClipboard.");
574
- }, getClipboard: () => M.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
575
- const [t2, e2] = c(M.Global);
576
- return { setClipboard: (t3) => e2(t3), getClipboard: () => t2, refNativeCopy: s(null), refNativeLastKey: s(null) };
577
- }), Dt = (t2) => {
578
- const { source: e2, target: n2, onPaste: o2, onClipboardUpdate: i2, commands: r2 } = t2, s2 = R(), l2 = X(i2, [i2]), c2 = X(o2, [o2]), { getClipboard: u2, refNativeCopy: d2 } = kt(), f2 = u2();
579
- p(() => {
580
- const t3 = e2?.element, o3 = n2?.element ?? e2?.element;
581
- if (!r2) return;
582
- const i3 = [new _t("cut", t3, { label: "Cut", description: "Remove the selection and put it on the clipboard so you can paste it somewhere else.", icon: "cut", shortcut: { key: "X", modifiers: [A.Ctrl] } }), new _t("copy", t3, { label: "Copy", description: "Put a copy of the selection on the clipboard so you can paste it somewhere else.", icon: "copy", shortcut: { key: "C", modifiers: [A.Ctrl] } }), new _t("paste", o3, { label: "Paste", description: "Add content on the clipboard to your document.", icon: "paste.yellow", shortcut: [{ key: "V", modifiers: [A.Ctrl] }, { key: "F8", modifiers: [A.Ctrl] }] })];
583
- r2?.addCommands(i3, true);
584
- }, [r2]);
585
- const _2 = X(async (t3) => {
586
- if (!e2?.element) return;
587
- let n3 = null;
642
+ }, getClipboard: () => o.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
643
+ const [e2, t2] = d(o.Global);
644
+ return { setClipboard: (e3) => t2(e3), getClipboard: () => e2, refNativeCopy: a(null), refNativeLastKey: a(null) };
645
+ }), Ae = (t2) => {
646
+ const { source: n2, target: s2, onPaste: l2, onClipboardUpdate: a2, commands: c2 } = t2, d2 = oe(), p2 = ce(a2, [a2]), f2 = ce(l2, [l2]), { getClipboard: _2, refNativeCopy: g2 } = Pe(), y2 = _2();
647
+ h(() => {
648
+ const e2 = n2?.element, t3 = s2?.element ?? n2?.element;
649
+ if (!c2) return;
650
+ const o2 = [new K("cut", e2, { label: "Cut", description: "Remove the selection and put it on the clipboard so you can paste it somewhere else.", icon: "cut", shortcut: { key: "X", modifiers: [A.Ctrl] } }), new K("copy", e2, { label: "Copy", description: "Put a copy of the selection on the clipboard so you can paste it somewhere else.", icon: "copy", shortcut: { key: "C", modifiers: [A.Ctrl] } }), new K("paste", t3, { label: "Paste", description: "Add content on the clipboard to your document.", icon: "paste.yellow", shortcut: [{ key: "V", modifiers: [A.Ctrl] }, { key: "F8", modifiers: [A.Ctrl] }] })];
651
+ c2?.addCommands(o2, true);
652
+ }, [c2]);
653
+ const v2 = ce(async (e2) => {
654
+ if (!n2?.element) return;
655
+ let t3 = null;
588
656
  try {
589
- n3 = e2.doCopy?.(t3), "string" == typeof n3 ? await f2.writeText(n3) : await f2.writeReference(n3);
590
- } catch (t4) {
591
- throw t4;
657
+ t3 = n2.doCopy?.(e2), "string" == typeof t3 ? await y2.writeText(t3) : await y2.writeReference(t3);
658
+ } catch (e3) {
659
+ throw e3;
592
660
  }
593
- }, [e2, s2]), m2 = X(async (t3) => {
594
- const n3 = e2?.element?.();
595
- if (n3) {
596
- d2.current = { sourceElement: n3, args: t3 };
661
+ }, [n2, d2]), w2 = ce(async (e2) => {
662
+ const t3 = n2?.element?.();
663
+ if (t3) {
664
+ g2.current = { sourceElement: t3, args: e2 };
597
665
  try {
598
- await _2(t3);
599
- } catch (t4) {
600
- s2.showError?.(t4);
666
+ await v2(e2);
667
+ } catch (e3) {
668
+ d2.showError?.(e3);
601
669
  }
602
670
  }
603
- }, [e2?.element, s2]), g2 = a(() => {
604
- m2({ isCut: true });
605
- }, []), y2 = X(async (t3, e3, n3) => {
671
+ }, [n2?.element, d2]), b2 = m(() => {
672
+ w2({ isCut: true });
673
+ }, []), x2 = ce(async (e2, t3, n3) => {
606
674
  try {
607
- if (false === await t3.doPaste(e3, n3)) return;
608
- c2?.(e3, n3);
609
- } catch (t4) {
610
- s2.showError?.(t4);
675
+ if (false === await e2.doPaste(t3, n3)) return;
676
+ f2?.(t3, n3);
677
+ } catch (e3) {
678
+ d2.showError?.(e3);
611
679
  }
612
- }, [c2]), v2 = X(async (t3, e3, o3) => {
613
- const i3 = n2?.element?.();
614
- if (i3 && await L.whenFocus(i3), !t3 && !e3) return;
615
- const r3 = await s2.showBusy?.("Pasting...");
616
- if (e3) try {
617
- return await y2(n2, e3, o3), void r3?.();
618
- } catch (t4) {
619
- r3?.(), s2.showError?.(t4);
680
+ }, [f2]), S2 = ce(async (t3, n3, o2) => {
681
+ const i2 = s2?.element?.();
682
+ if (i2 && await e.whenFocus(i2), !t3 && !n3) return;
683
+ const r2 = await d2.showBusy?.("Pasting...");
684
+ if (n3) try {
685
+ return await x2(s2, n3, o2), void r2?.();
686
+ } catch (e2) {
687
+ r2?.(), d2.showError?.(e2);
620
688
  }
621
- let l3, a2 = n2.importFromExternal;
622
- a2 || (a2 = (e4, n3) => ({ getItemType: () => "text", toText: () => t3.text, isClipboardItem: true }));
689
+ let l3, a3 = s2.importFromExternal;
690
+ a3 || (a3 = (e2, n4) => ({ getItemType: () => "text", toText: () => t3.text, isClipboardItem: true }));
623
691
  try {
624
- l3 = await a2(t3, { isCut: false });
625
- } catch (t4) {
626
- r3?.(), s2.showError?.(t4);
692
+ l3 = await a3(t3, { isCut: false });
693
+ } catch (e2) {
694
+ r2?.(), d2.showError?.(e2);
627
695
  }
628
696
  if (l3) try {
629
- const t4 = await Promise.resolve(l3);
630
- await y2(n2, t4, o3), r3?.();
631
- } catch (t4) {
632
- r3?.(), s2.showError?.(t4);
697
+ const e2 = await Promise.resolve(l3);
698
+ await x2(s2, e2, o2), r2?.();
699
+ } catch (e2) {
700
+ r2?.(), d2.showError?.(e2);
633
701
  }
634
- else r3?.();
635
- }, [y2, n2, s2]), w2 = X(async (t3) => {
636
- if (n2?.element) try {
637
- const e3 = await f2.readReference();
638
- if (e3) return void await v2(null, e3, t3);
702
+ else r2?.();
703
+ }, [x2, s2, d2]), E2 = ce(async (e2) => {
704
+ if (s2?.element) try {
705
+ const t3 = await y2.readReference();
706
+ if (t3) return void await S2(null, t3, e2);
639
707
  const n3 = [];
640
- n3[0] = await T.readStringFromClipboard(f2, C.plain), n3[1] = await T.readHTMLFromClipboard(f2, C.html), n3[2] = await T.readBlobFromClipboard(f2, C.png);
641
- const o3 = { text: n3[0] ?? null, html: n3[1] ?? null, image: n3[2] ?? null };
642
- await v2(o3, null, t3);
643
- } catch (t4) {
644
- if ("Document is not focused." === t4?.message) return;
645
- s2.showError?.(t4);
708
+ n3[0] = await i.readStringFromClipboard(y2, r.plain), n3[1] = await i.readHTMLFromClipboard(y2, r.html), n3[2] = await i.readBlobFromClipboard(y2, r.png);
709
+ const o2 = { text: n3[0] ?? null, html: n3[1] ?? null, image: n3[2] ?? null };
710
+ await S2(o2, null, e2);
711
+ } catch (e3) {
712
+ if ("Document is not focused." === e3?.message) return;
713
+ d2.showError?.(e3);
646
714
  }
647
- }, [v2, n2?.element, s2]);
648
- return X(async (t3) => {
649
- }, [e2?.element]), X(async (t3) => {
650
- }, [n2?.element, v2, s2]), h(() => {
651
- if (!f2) return;
652
- const t3 = async (t4) => {
653
- const e4 = await f2.readReference();
654
- l2?.(e4);
655
- }, e3 = (t4) => {
656
- s2.showMessage?.(M.ErrorMessages.PermsRead, { onceKey: "clipboard.features" });
657
- }, n3 = (t4) => {
658
- s2.showMessage?.(M.ErrorMessages.PermsWrite, { onceKey: "clipboard.features" });
715
+ }, [S2, s2?.element, d2]);
716
+ return ce(async (e2) => {
717
+ }, [n2?.element]), ce(async (e2) => {
718
+ }, [s2?.element, S2, d2]), u(() => {
719
+ if (!y2) return;
720
+ const e2 = async (e3) => {
721
+ const t4 = await y2.readReference();
722
+ p2?.(t4);
723
+ }, t3 = (e3) => {
724
+ d2.showMessage?.(o.ErrorMessages.PermsRead, { onceKey: "clipboard.features" });
725
+ }, n3 = (e3) => {
726
+ d2.showMessage?.(o.ErrorMessages.PermsWrite, { onceKey: "clipboard.features" });
659
727
  };
660
- return f2.addEventListener("clipboardchange", t3), f2.addEventListener("clipboarderrorread", e3), f2.addEventListener("clipboarderrorwrite", n3), () => {
661
- f2.removeEventListener("clipboardchange", t3), f2.removeEventListener("clipboarderrorread", e3), f2.removeEventListener("clipboarderrorwrite", n3);
728
+ return y2.addEventListener("clipboardchange", e2), y2.addEventListener("clipboarderrorread", t3), y2.addEventListener("clipboarderrorwrite", n3), () => {
729
+ y2.removeEventListener("clipboardchange", e2), y2.removeEventListener("clipboarderrorread", t3), y2.removeEventListener("clipboarderrorwrite", n3);
662
730
  };
663
- }, [f2, s2]), h(() => {
664
- }, [_2, v2, e2, n2]), h(() => {
665
- r2?.getCommand("cut")?.updateCallback(g2).update({ disabled: !e2 || !n2 }), r2?.getCommand("copy")?.updateCallback(m2).update({ disabled: !e2 }), r2?.getCommand("paste")?.updateCallback(w2).update({ disabled: !n2 });
666
- }, [e2, n2, r2]), { paste: w2, copy: m2, clipboard: f2 };
731
+ }, [y2, d2]), u(() => {
732
+ }, [v2, S2, n2, s2]), u(() => {
733
+ c2?.getCommand("cut")?.updateCallback(b2).update({ disabled: !n2 || !s2 }), c2?.getCommand("copy")?.updateCallback(w2).update({ disabled: !n2 }), c2?.getCommand("paste")?.updateCallback(E2).update({ disabled: !s2 });
734
+ }, [n2, s2, c2]), { paste: E2, copy: w2, clipboard: y2 };
667
735
  };
668
- function Pt(t2, e2 = true) {
669
- const n2 = s(t2);
670
- h(() => {
671
- if (e2) {
672
- const e3 = Object.entries(t2).reduce((t3, [e4, o2]) => (n2.current[e4] !== o2 && (t3[e4] = [n2.current[e4], o2]), t3), {});
673
- Object.keys(e3).length > 0 && console.log("Changed props:", e3);
736
+ function ze(e2, t2 = true) {
737
+ const n2 = a(e2);
738
+ u(() => {
739
+ if (t2) {
740
+ const t3 = Object.entries(e2).reduce((e3, [t4, o2]) => (n2.current[t4] !== o2 && (e3[t4] = [n2.current[t4], o2]), e3), {});
741
+ Object.keys(t3).length > 0 && console.log("Changed props:", t3);
674
742
  }
675
- n2.current = t2;
743
+ n2.current = e2;
676
744
  });
677
745
  }
678
- let At = false, zt = 0;
679
- var Bt = "undefined" != typeof document ? u : h;
680
- const $t = () => "sheetxl-ui-" + zt++;
681
- const Ot = o["useId".toString()], Kt = null != Ot ? Ot : function() {
682
- const [t2, e2] = o.useState(() => At ? $t() : void 0);
683
- return Bt(() => {
684
- null == t2 && e2($t());
685
- }, []), o.useEffect(() => {
686
- At || (At = true);
687
- }, []), t2;
688
- }, Ht = [];
689
- function Nt(t2, e2, n2 = Ht) {
690
- const o2 = s(null);
691
- return f(t2, () => {
746
+ let Be = false, $e = 0;
747
+ var Ke = "undefined" != typeof document ? y : u;
748
+ const Oe = () => "sheetxl-ui-" + $e++;
749
+ const Ie = l["useId".toString()], Ne = null != Ie ? Ie : function() {
750
+ const [e2, t2] = l.useState(() => Be ? Oe() : void 0);
751
+ return Ke(() => {
752
+ null == e2 && t2(Oe());
753
+ }, []), l.useEffect(() => {
754
+ Be || (Be = true);
755
+ }, []), e2;
756
+ }, He = [];
757
+ function Re(e2, t2, n2 = He) {
758
+ const o2 = a(null);
759
+ return w(e2, () => {
692
760
  if (!o2.current) return;
693
- const t3 = o2.current, n3 = e2?.();
761
+ const e3 = o2.current, n3 = t2?.();
694
762
  if (!n3 || "object" != typeof n3) throw new Error("attributes must return a plain object of values");
695
763
  const i2 = Object.keys(n3), r2 = i2.length;
696
- for (let e3 = 0; e3 < r2; e3++) {
697
- const o3 = i2[e3], r3 = n3[o3];
698
- Object.defineProperty(t3, o3, { value: r3, writable: true, configurable: true, enumerable: true });
764
+ for (let t3 = 0; t3 < r2; t3++) {
765
+ const o3 = i2[t3], r3 = n3[o3];
766
+ Object.defineProperty(e3, o3, { value: r3, writable: true, configurable: true, enumerable: true });
699
767
  }
700
- return t3;
768
+ return e3;
701
769
  }, n2), o2;
702
770
  }
703
- const Rt = "Undo the last action.", Wt = "Repeat the last action or undo the redo.", Vt = (t2) => `Redo ${t2}`, It = ({ manager: t2, commands: e2, disabled: n2 }) => {
704
- const o2 = R(), i2 = X((e3) => {
771
+ const We = "Undo the last action.", Ve = "Repeat the last action or undo the redo.", Fe = (e2) => `Redo ${e2}`, je = ({ manager: e2, commands: t2, disabled: n2 }) => {
772
+ const o2 = oe(), i2 = ce((t3) => {
705
773
  try {
706
- t2?.undo(e3);
707
- } catch (t3) {
708
- o2.error(t3);
774
+ e2?.undo(t3);
775
+ } catch (e3) {
776
+ o2.error(e3);
709
777
  }
710
- }, [t2]), r2 = X((e3) => {
778
+ }, [e2]), r2 = ce((t3) => {
711
779
  try {
712
- t2?.redo(e3);
713
- } catch (t3) {
714
- o2.error(t3);
780
+ e2?.redo(t3);
781
+ } catch (e3) {
782
+ o2.error(e3);
715
783
  }
716
- }, [t2]);
717
- return p(() => {
718
- if (!e2) return;
719
- const t3 = { contains: (t4) => true, focus() {
720
- } }, n3 = [new ft("undo", t3, { label: "Undo", description: Rt, shortcut: { key: "z", modifiers: [A.Ctrl] }, disabled: true }, i2), new ft("redo", t3, { label: "Redo", description: Wt, shortcut: [{ key: "y", modifiers: [A.Ctrl] }, { key: "F4" }, { key: "Enter", modifiers: [A.Alt] }], disabled: true }, r2)];
721
- e2?.addCommands(n3, true);
722
- }, [e2]), h(() => {
723
- if (!e2) return;
784
+ }, [e2]);
785
+ return h(() => {
786
+ if (!t2) return;
787
+ const e3 = { contains: (e4) => true, focus() {
788
+ } }, n3 = [new $("undo", e3, { label: "Undo", description: We, shortcut: { key: "z", modifiers: [A.Ctrl] }, disabled: true }, i2), new $("redo", e3, { label: "Redo", description: Ve, shortcut: [{ key: "y", modifiers: [A.Ctrl] }, { key: "F4" }, { key: "Enter", modifiers: [A.Alt] }], disabled: true }, r2)];
789
+ t2?.addCommands(n3, true);
790
+ }, [t2]), u(() => {
791
+ if (!t2) return;
724
792
  const o3 = () => {
725
- const o4 = t2?.getTopUndoDescription(), i4 = {};
793
+ const o4 = e2?.getTopUndoDescription(), i4 = {};
726
794
  var r3;
727
- e2.getCommand("undo").update({ disabled: n2 || !t2 || !t2.hasUndo(), description: o4 ? (r3 = o4, `Undo ${r3}`) : Rt, state: i4, context: { undoManager: t2 } });
728
- const s2 = t2?.getTopRedoDescription();
729
- e2.getCommand("redo").update({ disabled: n2 || !t2 || !t2.hasRedo(), description: s2 ? Vt(s2) : Wt, state: i4, context: { undoManager: t2 } });
795
+ t2.getCommand("undo").update({ disabled: n2 || !e2 || !e2.hasUndo(), description: o4 ? (r3 = o4, `Undo ${r3}`) : We, state: i4, context: { undoManager: e2 } });
796
+ const s2 = e2?.getTopRedoDescription();
797
+ t2.getCommand("redo").update({ disabled: n2 || !e2 || !e2.hasRedo(), description: s2 ? Fe(s2) : Ve, state: i4, context: { undoManager: e2 } });
730
798
  };
731
- if (o3(), !t2) return;
732
- const i3 = t2.addListener({ onStackChange() {
799
+ if (o3(), !e2) return;
800
+ const i3 = e2.addListener({ onStackChange() {
733
801
  o3();
734
802
  } });
735
803
  return () => i3?.();
736
- }, [t2, e2, n2]), { undo: i2, redo: r2 };
737
- }, Ft = "_scrollbar_1v478_17", jt = "_vsb-track_1v478_27", Xt = "_vsb-thumb_1v478_39", Yt = "_scrollbar-button_1v478_80", Ut = "M 5.4951012,0.62494002 7.1746358,3.4734472 8.8557603,6.3226744 c 0.13425,0.2277477 0.18228,0.4945506 0.1356,0.7535218 -0.04665,0.2589712 -0.18504,0.4935661 -0.3908099,0.6625402 C 8.3948254,7.9076371 8.1348905,8.0001761 7.8664506,7.9999997 H 1.1503225 c -0.30278993,0 -0.59312985,-0.117841 -0.80720983,-0.3275159 -0.2140799,-0.2097042 -0.3343649,-0.4941244 -0.3343649,-0.7907107 -4.5e-4,-0.1955399 0.05205,-0.3876855 0.152205,-0.55688 L 1.8390472,3.4734031 3.5178618,0.62488125 C 3.7217717,0.27898385 4.0986166,0.0658413 4.5064365,0.0658413 c 0.4078199,0 0.7846648,0.21314255 0.9885747,0.55903995 z", Gt = "M 0.6632643,3.5136438 3.5117715,1.8341092 6.3609987,0.15298466 c 0.2277477,-0.13425 0.4945506,-0.18228 0.7535218,-0.1356 0.2589712,0.04665 0.4935661,0.18504 0.6625402,0.3908099 0.1689007,0.205725 0.2614397,0.4656599 0.2612633,0.73409984 v 6.7161281 c 0,0.3027899 -0.117841,0.5931298 -0.3275159,0.8072098 -0.2097042,0.2140799 -0.4941244,0.3343649 -0.7907107,0.3343649 -0.1955399,4.5e-4 -0.3876855,-0.05205 -0.55688,-0.152205 L 3.5117274,7.1696978 0.6632056,5.4908832 C 0.31730817,5.2869733 0.10416562,4.9101284 0.10416562,4.5023085 c 0,-0.4078199 0.21314255,-0.7846648 0.55903998,-0.9885747 z", Zt = { transform: "rotate(180deg)" }, qt = (e2) => {
738
- const { style: n2, orientation: o2 = $.Vertical, disabled: i2, ...r2 } = e2, s2 = o2 === $.Vertical ? Ut : Gt;
739
- return t("button", { style: n2, className: w(Yt, o2, "scroll-button"), disabled: i2, ...r2, children: t("svg", { width: "9", height: "9", viewBox: "0 0 9 9", children: t("path", { d: s2 }) }) });
740
- }, Jt = (e2) => {
741
- const { style: n2, orientation: o2 = $.Vertical, disabled: i2, ...r2 } = e2, s2 = o2 === $.Vertical ? Ut : Gt;
742
- return t("button", { style: n2, className: w(Yt, o2, "scroll-button"), disabled: i2, ...r2, children: t("svg", { width: "9", height: "9", viewBox: "0 0 9 9", style: Zt, children: t("path", { d: s2 }) }) });
743
- }, Qt = (e2) => {
744
- const { style: n2, orientation: o2 = $.Vertical, ...i2 } = e2, r2 = o2 === $.Vertical;
745
- return t("div", { style: { display: "flex", justifyContent: "center", alignItems: "end", transition: "fill-opacity 1s", zIndex: 1, width: "24px", height: "24px", ...n2 }, className: `scrollbar-button ${r2 ? "vertical" : "horizontal"} edge`, ...i2, children: t("svg", { width: "24", height: "24", viewBox: "0 0 24 24", transform: r2 ? "rotate(90) " : "", children: t("path", { style: { transition: "opacity 240ms ease 0s", opacity: e2.disabled ? 0 : 1 }, d: "M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2" }) }) });
804
+ }, [e2, t2, n2]), { undo: i2, redo: r2 };
746
805
  };
747
- let te = 0;
748
- function ee() {
749
- const [t2, e2] = c(!!document.fullscreenElement), n2 = a(() => {
750
- const t3 = document.fullscreenElement;
751
- return t3 ? t3.querySelector(".fullscreen-portal-root") || t3 : document.body;
752
- }, []);
753
- return h(() => {
754
- function t3() {
755
- const t4 = document.fullscreenElement;
756
- if (e2(!!t4), !t4) return;
757
- let n3 = t4.querySelector(".fullscreen-portal-root");
758
- n3 || (n3 = document.createElement("div"), n3.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", t4.appendChild(n3));
759
- }
760
- return te++, t3(), document.addEventListener("fullscreenchange", t3), () => {
761
- document.removeEventListener("fullscreenchange", t3), te--, te <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((t4) => {
762
- t4.parentNode && t4.parentNode.removeChild(t4);
763
- }), te = 0);
764
- };
765
- }, []), { getPortalContainer: n2, isFullscreen: t2 };
766
- }
767
- const ne = 24, oe = _(m((e2, o2) => {
768
- const { offset: i2 = 0, totalSize: r2 = 0, viewportSize: l2 = 0, style: u2, className: d2, orientation: f2 = $.Vertical, onScrollOffset: _2, onScroll: m2, showCustomScrollButtons: g2 = true, scrollButtonIncrement: y2 = 200, scrollButtonInitialRepeatDelay: S2 = 260, scrollButtonAdditionalRepeatDelay: E2 = 120, minThumbSize: L2 = ne, maxThumbSize: M2, createScrollStartButton: T2 = qt, createScrollEndButton: C2 = Jt, usePortal: k2 = false, ...D2 } = e2;
769
- X(m2, [m2]);
770
- const [P2, A2] = c({ offset: 0, length: 0 }), z2 = s(-1), B2 = f2 === $.Vertical, [O2, { width: K2, height: H2 }] = b(), N2 = B2 ? H2 : K2, R2 = X((t2, e3, n2) => {
771
- if (0 === e3 || 0 === n2) return void A2({ offset: 0, length: L2 });
772
- const o3 = n2 / N2, i3 = e3 / o3, r3 = Math.min(Math.max(L2, i3), Math.min(N2, M2 ?? Number.MAX_SAFE_INTEGER)), s2 = t2 / o3;
773
- return { offset: Math.min(Math.max(0, s2), N2 - r3), length: r3 };
774
- }, [N2, L2, M2]), W2 = X((t2) => {
775
- const e3 = r2 / N2, n2 = Math.round(t2 * e3);
776
- A2(R2(n2, l2, r2)), _2?.(n2, l2, r2), z2.current = t2;
777
- }, [_2, l2, r2, N2, P2]), V2 = X((t2) => {
778
- A2(R2(t2, l2, r2)), _2?.(t2, l2, r2), z2.current = t2;
779
- }, [_2, l2, r2]);
780
- h(() => {
781
- z2.current !== i2 && 0 !== N2 && (z2.current = -1, A2(R2(i2, l2, r2)));
782
- }, [i2]), h(() => {
783
- 0 !== N2 && A2(R2(i2, l2, r2));
784
- }, [l2, r2, B2, N2]);
785
- const I2 = Math.max(0, r2 - l2), [F2, j2] = c(false), Y2 = s(0), U2 = s(0), G2 = Nt(o2, () => ({ isScrollbar: () => true }), []), Z2 = X((t2) => {
786
- t2.currentTarget.setPointerCapture(t2.pointerId), j2(true), Y2.current = B2 ? t2.clientY : t2.clientX, U2.current = P2.offset, t2.preventDefault(), t2.stopPropagation();
787
- }, [B2, P2]), q2 = X((t2) => {
788
- if (!F2) return;
789
- const e3 = (B2 ? t2.clientY : t2.clientX) - Y2.current, n2 = U2.current + e3;
790
- W2(n2);
791
- }, [F2, B2]), J2 = X((t2) => {
792
- try {
793
- t2.currentTarget.releasePointerCapture(t2.pointerId);
794
- } catch {
795
- }
796
- j2(false);
797
- }, []), Q2 = X((t2) => {
798
- if (!t2.currentTarget) return;
799
- const e3 = t2.currentTarget.getBoundingClientRect(), n2 = B2 ? t2.clientY - e3.top : t2.clientX - e3.left;
800
- W2(n2);
801
- }, [B2, P2, l2, r2]), tt2 = X((t2) => {
802
- const e3 = Math.max(1, Math.floor(0.9 * l2));
803
- B2 ? ("ArrowDown" === t2.key && W2(Math.min(I2, i2 + 1)), "ArrowUp" === t2.key && W2(Math.max(0, i2 - 1)), "PageDown" === t2.key && W2(Math.min(I2, i2 + e3)), "PageUp" === t2.key && W2(Math.max(0, i2 - e3)), "Home" === t2.key && W2(0), "End" === t2.key && W2(I2)) : ("ArrowRight" === t2.key && W2(Math.min(I2, i2 + 1)), "ArrowLeft" === t2.key && W2(Math.max(0, i2 - 1)), "PageDown" === t2.key && W2(Math.min(I2, i2 + e3)), "PageUp" === t2.key && W2(Math.max(0, i2 - e3)), "Home" === t2.key && W2(0), "End" === t2.key && W2(I2));
804
- }, [B2, l2, r2, i2, I2]), et2 = s(null), nt2 = p(() => t("div", { className: w(Xt), ref: et2, role: "slider", "aria-label": B2 ? "Rows" : "Columns", "aria-orientation": B2 ? "vertical" : "horizontal", "aria-valuemin": 0, "aria-valuemax": I2, "aria-valuenow": i2, tabIndex: 0, style: { position: k2 ? "fixed" : "relative", [B2 ? "height" : "width"]: `${P2.length}px`, [B2 ? "width" : "height"]: "100%", transform: B2 ? `translateY(${P2.offset}px)` : `translateX(${P2.offset}px)`, [B2 ? "minHeight" : "minWidth"]: `${L2}px` }, onPointerDown: Z2, onPointerMove: q2, onPointerUp: J2 }), [P2, L2, I2, i2, B2, false]), [ot2, it2] = c(null), rt2 = X(() => {
805
- let t2;
806
- t2 = "function" == typeof y2 ? y2(i2, l2, r2) : i2 - y2;
807
- const e3 = Math.max(0, t2);
808
- return V2(e3), it2(e3), e3;
809
- }, [y2, i2, l2, r2]), st2 = X(() => {
810
- let t2;
811
- t2 = "function" == typeof y2 ? y2(i2, l2, r2) : i2 + y2;
812
- const e3 = Math.min(I2, t2);
813
- return V2(e3), it2(e3), e3;
814
- }, [y2, i2, I2, l2, r2]), lt2 = s(null), at2 = s(null), ct2 = a(() => {
815
- lt2.current && (clearTimeout(lt2.current), lt2.current = null, at2.current = null);
816
- }, []), ht2 = a((t2, e3, n2, o3 = S2) => {
817
- at2.current = t2, lt2.current = setTimeout(() => {
818
- const t3 = n2 ? rt2() : st2();
819
- t3 !== at2.current ? ht2(t3, false, n2, E2) : ct2();
820
- }, e3 ? 0 : o3);
821
- }, [rt2, st2, ct2]);
822
- h(() => () => ct2(), [ct2]);
823
- const ut2 = p(() => {
824
- if (!g2) return null;
825
- const t2 = { orientation: f2, disabled: i2 <= 0, onMouseUp: ct2, onMouseLeave: ct2, onMouseDown: () => ht2(i2, true, true) };
826
- return T2?.(t2);
827
- }, [g2, f2, i2, ot2]), dt2 = p(() => {
828
- if (!g2) return null;
829
- const t2 = { orientation: f2, disabled: i2 >= I2, onMouseUp: ct2, onMouseLeave: ct2, onMouseDown: () => ht2(i2, true, false) };
830
- return C2?.(t2);
831
- }, [g2, f2, i2, I2, ot2]), pt2 = B2 ? "vertical" : "horizontal";
832
- return n("div", { ref: x([G2, o2]), className: w(d2, Ft, pt2, { dragging: F2 }), style: u2, ...D2, children: [ut2, t("div", { ref: O2, role: "scrollbar", "aria-orientation": pt2, "aria-valuemin": 0, "aria-valuemax": I2, "aria-valuenow": i2, tabIndex: 0, className: w(jt, "track", pt2), onPointerDown: Q2, onKeyDown: tt2, children: k2 ? null : nt2 }), k2 ? v(nt2, document.body) : null, dt2] });
833
- }));
834
- let ie = Date.now, re = 1e3, se = {}, le = 1;
835
- const ae = (t2) => {
836
- let e2 = null !== se[t2];
837
- return e2 && (se[t2] = null), e2;
838
- }, ce = (t2, e2, n2, o2 = 0, i2) => {
839
- let r2 = ie(), s2 = r2, l2 = 0, a2 = 0, c2 = 0, h2 = le++;
840
- if (h2 % 20 == 0) {
841
- const t3 = {};
842
- for (let e3 in se) t3[e3] = true;
843
- se = t3;
844
- }
845
- const u2 = function(d2) {
846
- let p2 = true !== d2, f2 = ie(), _2 = true;
847
- try {
848
- _2 = (!e2 || e2(h2)) ?? true;
849
- } catch (t3) {
850
- _2 = false;
851
- }
852
- if (!se[h2] || !_2) return se[h2] = null, void n2?.(60 - a2 / ((f2 - r2) / re), h2, false);
853
- if (p2) {
854
- c2 = Math.round((f2 - s2) / 16.666666666666668) - 1;
855
- for (let t3 = 0; t3 < Math.min(c2, 4); t3++) u2(true), a2++;
856
- }
857
- o2 && (l2 = (f2 - r2) / o2, l2 > 1 && (l2 = 1));
858
- let m2 = i2 ? i2(l2) : l2, g2 = false;
859
- try {
860
- g2 = t2(m2, f2, p2);
861
- } catch (t3) {
862
- g2 = false;
863
- }
864
- false !== g2 && 1 !== l2 || !p2 ? p2 && (s2 = f2, requestAnimationFrame(u2)) : (se[h2] = null, n2?.(60 - a2 / ((f2 - r2) / re), h2, 1 === l2 || null == o2));
865
- };
866
- return se[h2] = true, requestAnimationFrame(u2), h2;
867
- }, he = function(t2) {
868
- return Math.pow(t2 - 1, 3) + 1;
869
- }, ue = function(t2) {
870
- return (t2 /= 0.5) < 1 ? 0.5 * Math.pow(t2, 3) : 0.5 * (Math.pow(t2 - 2, 3) + 2);
871
- };
872
- class de {
873
- constructor(t2, e2) {
874
- this.__isSingleTouch = false, this.__isTracking = false, this.__didDecelerationComplete = false, this.__isGesturing = false, this.__isDragging = false, this.__isDecelerating = 0, this.__isAnimating = 0, this.__interruptedAnimation = false, this.__lastScale = 1, this.__enableScrollX = true, this.__enableScrollY = true, this.__clientLeft = 0, this.__clientTop = 0, this.__clientWidth = 0, this.__clientHeight = 0, this.__contentWidth = 0, this.__contentHeight = 0, this.__snapWidth = 100, this.__snapHeight = 100, this.__zoomLevel = 1, this.__scrollLeft = 0, this.__scrollTop = 0, this.__maxScrollLeft = 0, this.__maxScrollTop = 0, this.__scheduledLeft = 0, this.__scheduledTop = 0, this.__scheduledZoom = 0, this.__lastTouchLeft = 0, this.__lastTouchTop = 0, this.__lastTouchMove = 0, this.__positions = [], this.__initialTouchLeft = 0, this.__initialTouchTop = 0, this.__zoomLevelStart = 1, this.__minDecelerationScrollLeft = null, this.__minDecelerationScrollTop = null, this.__maxDecelerationScrollLeft = null, this.__maxDecelerationScrollTop = null, this.__decelerationVelocityX = null, this.__decelerationVelocityY = 0, this.__callback = t2, this.options = { scrollingX: true, scrollingY: true, animating: true, animationDuration: 250, bouncing: true, locking: true, paging: false, snapping: false, zooming: false, minZoom: 0.5, maxZoom: 3, speedMultiplier: 1, scrollingComplete: void 0, penetrationDeceleration: 0.03, penetrationAcceleration: 0.08, ...e2 };
875
- }
876
- setDimensions(t2, e2, n2, o2) {
877
- null !== t2 && (this.__clientWidth = t2), null !== e2 && (this.__clientHeight = e2), null !== n2 && (this.__contentWidth = n2), null !== o2 && (this.__contentHeight = o2), this.__computeScrollMax(), this.scrollTo(this.__scrollLeft, this.__scrollTop, true);
878
- }
879
- setPosition(t2, e2) {
880
- this.__clientLeft = t2 || 0, this.__clientTop = e2 || 0;
881
- }
882
- setSnapSize(t2, e2) {
883
- this.__snapWidth = t2, this.__snapHeight = e2;
884
- }
885
- getValues() {
886
- return { left: this.__scrollLeft, top: this.__scrollTop, right: this.__scrollLeft + this.__clientWidth / this.__zoomLevel, bottom: this.__scrollTop + this.__clientHeight / this.__zoomLevel, zoom: this.__zoomLevel };
887
- }
888
- getPoint(t2, e2) {
889
- const n2 = this.getValues();
890
- return { left: t2 / n2.zoom, top: e2 / n2.zoom };
891
- }
892
- getScrollMax() {
893
- return { left: this.__maxScrollLeft, top: this.__maxScrollTop };
894
- }
895
- zoomTo(t2, e2 = false, n2, o2, i2) {
896
- if (!this.options.zooming) throw new Error("Zooming is not enabled!");
897
- i2 && (this.__zoomComplete = i2), this.__isDecelerating && (ae(this.__isDecelerating), this.__isDecelerating = 0);
898
- const r2 = this.__zoomLevel;
899
- void 0 === n2 && (n2 = this.__clientWidth / 2), void 0 === o2 && (o2 = this.__clientHeight / 2), t2 = Math.max(Math.min(t2, this.options.maxZoom), this.options.minZoom), this.__computeScrollMax(t2);
900
- const s2 = t2 / r2;
901
- let l2 = s2 * (this.__scrollLeft + n2) - n2, a2 = s2 * (this.__scrollTop + o2) - o2;
902
- l2 > this.__maxScrollLeft ? l2 = this.__maxScrollLeft : l2 < 0 && (l2 = 0), a2 > this.__maxScrollTop ? a2 = this.__maxScrollTop : a2 < 0 && (a2 = 0), this.__publish(l2, a2, t2, e2);
903
- }
904
- zoomBy(t2, e2 = false, n2 = 0, o2 = 0, i2) {
905
- this.zoomTo(this.__zoomLevel * t2, e2, n2, o2, i2);
906
- }
907
- scrollTo(t2, e2, n2 = false, o2 = 1) {
908
- if (this.__isDecelerating && (ae(this.__isDecelerating), this.__isDecelerating = 0), void 0 !== o2 && o2 !== this.__zoomLevel) {
909
- if (!this.options.zooming) throw new Error("Zooming is not enabled!");
910
- t2 *= o2, e2 *= o2, this.__computeScrollMax(o2);
911
- } else o2 = this.__zoomLevel;
912
- this.options.scrollingX ? this.options.paging ? t2 = Math.round(t2 / this.__clientWidth) * this.__clientWidth : this.options.snapping && (t2 = Math.round(t2 / this.__snapWidth) * this.__snapWidth) : t2 = this.__scrollLeft, this.options.scrollingY ? this.options.paging ? e2 = Math.round(e2 / this.__clientHeight) * this.__clientHeight : this.options.snapping && (e2 = Math.round(e2 / this.__snapHeight) * this.__snapHeight) : e2 = this.__scrollTop, t2 = Math.max(Math.min(this.__maxScrollLeft, t2), 0), e2 = Math.max(Math.min(this.__maxScrollTop, e2), 0), t2 === this.__scrollLeft && e2 === this.__scrollTop && (n2 = false), this.__publish(t2, e2, o2, n2);
913
- }
914
- scrollBy(t2 = 0, e2 = 0, n2 = false) {
915
- const o2 = this.__isAnimating ? this.__scheduledLeft : this.__scrollLeft, i2 = this.__isAnimating ? this.__scheduledTop : this.__scrollTop;
916
- this.scrollTo(o2 + (t2 || 0), i2 + (e2 || 0), n2);
917
- }
918
- doMouseZoom(t2, e2, n2, o2) {
919
- const i2 = t2 > 0 ? 0.97 : 1.03;
920
- return this.zoomTo(this.__zoomLevel * i2, false, n2 - this.__clientLeft, o2 - this.__clientTop);
921
- }
922
- doTouchStart(t2, e2) {
923
- if (void 0 === t2.length) throw new Error("Invalid touch list: " + t2);
924
- if (e2 instanceof Date && (e2 = e2.valueOf()), "number" != typeof e2) throw new Error("Invalid timestamp value: " + e2);
925
- let n2, o2;
926
- this.__interruptedAnimation = true, this.__isDecelerating && (ae(this.__isDecelerating), this.__isDecelerating = 0, this.__interruptedAnimation = true), this.__isAnimating && (ae(this.__isAnimating), this.__isAnimating = 0, this.__interruptedAnimation = true);
927
- let i2 = 1 === t2.length;
928
- i2 ? (n2 = t2[0].pageX, o2 = t2[0].pageY) : (n2 = Math.abs(t2[0].pageX + t2[1].pageX) / 2, o2 = Math.abs(t2[0].pageY + t2[1].pageY) / 2), this.__initialTouchLeft = n2, this.__initialTouchTop = o2, this.__zoomLevelStart = this.__zoomLevel, this.__lastTouchLeft = n2, this.__lastTouchTop = o2, this.__lastTouchMove = e2, this.__lastScale = 1, this.__enableScrollX = !i2 && this.options.scrollingX, this.__enableScrollY = !i2 && this.options.scrollingY, this.__isTracking = true, this.__didDecelerationComplete = false, this.__isDragging = !i2, this.__isSingleTouch = i2, this.__positions = [];
929
- }
930
- doTouchMove(t2, e2, n2 = 1) {
931
- if (void 0 === t2.length) throw new Error("Invalid touch list: " + t2);
932
- if (e2 instanceof Date && (e2 = e2.valueOf()), "number" != typeof e2) throw new Error("Invalid timestamp value: " + e2);
933
- if (!this.__isTracking) return;
934
- let o2, i2;
935
- 2 === t2.length ? (o2 = Math.abs(t2[0].pageX + t2[1].pageX) / 2, i2 = Math.abs(t2[0].pageY + t2[1].pageY) / 2) : (o2 = t2[0].pageX, i2 = t2[0].pageY);
936
- let r2 = this.__positions;
937
- if (this.__isDragging) {
938
- let t3 = o2 - this.__lastTouchLeft, s2 = i2 - this.__lastTouchTop, l2 = this.__scrollLeft, a2 = this.__scrollTop, c2 = this.__zoomLevel;
939
- if (void 0 !== n2 && this.options.zooming) {
940
- let t4 = c2;
941
- if (c2 = c2 / this.__lastScale * n2, c2 = Math.max(Math.min(c2, this.options.maxZoom), this.options.minZoom), t4 !== c2) {
942
- let e3 = o2 - this.__clientLeft, n3 = i2 - this.__clientTop;
943
- l2 = (e3 + l2) * c2 / t4 - e3, a2 = (n3 + a2) * c2 / t4 - n3, this.__computeScrollMax(c2);
944
- }
945
- }
946
- if (this.__enableScrollX) {
947
- l2 -= t3 * this.options.speedMultiplier;
948
- let e3 = this.__maxScrollLeft;
949
- (l2 > e3 || l2 < 0) && (this.options.bouncing ? l2 += t3 / 2 * this.options.speedMultiplier : l2 = l2 > e3 ? e3 : 0);
950
- }
951
- if (this.__enableScrollY) {
952
- a2 -= s2 * this.options.speedMultiplier;
953
- const t4 = this.__maxScrollTop;
954
- (a2 > t4 || a2 < 0) && (this.options.bouncing ? a2 += s2 / 2 * this.options.speedMultiplier : a2 = a2 > t4 ? t4 : 0);
955
- }
956
- r2.length > 60 && r2.splice(0, 30), r2.push(l2, a2, e2), this.__publish(l2, a2, c2);
957
- } else {
958
- let t3 = this.options.locking ? 3 : 0, n3 = 5, s2 = Math.abs(o2 - this.__initialTouchLeft), l2 = Math.abs(i2 - this.__initialTouchTop);
959
- this.__enableScrollX = this.options.scrollingX && s2 >= t3, this.__enableScrollY = this.options.scrollingY && l2 >= t3, r2.push(this.__scrollLeft, this.__scrollTop, e2), this.__isDragging = (this.__enableScrollX || this.__enableScrollY) && (s2 >= n3 || l2 >= n3), this.__isDragging && (this.__interruptedAnimation = false);
960
- }
961
- this.__lastTouchLeft = o2, this.__lastTouchTop = i2, this.__lastTouchMove = e2, this.__lastScale = n2;
962
- }
963
- doTouchEnd(t2) {
964
- if (t2 instanceof Date && (t2 = t2.valueOf()), "number" != typeof t2) throw new Error("Invalid timestamp value: " + t2);
965
- if (this.__isTracking) {
966
- if (this.__isTracking = false, this.__isDragging) if (this.__isDragging = false, this.__isSingleTouch && this.options.animating && t2 - this.__lastTouchMove <= 100) {
967
- let e2 = this.__positions, n2 = e2.length - 1, o2 = n2;
968
- for (let t3 = n2; t3 > 0 && e2[t3] > this.__lastTouchMove - 100; t3 -= 3) o2 = t3;
969
- if (o2 !== n2) {
970
- const i2 = e2[n2] - e2[o2], r2 = this.__scrollLeft - e2[o2 - 2], s2 = this.__scrollTop - e2[o2 - 1];
971
- this.__decelerationVelocityX = r2 / i2 * (1e3 / 60), this.__decelerationVelocityY = s2 / i2 * (1e3 / 60);
972
- const l2 = this.options.paging || this.options.snapping ? 4 : 1;
973
- (Math.abs(this.__decelerationVelocityX) > l2 || Math.abs(this.__decelerationVelocityY) > l2) && this.__startDeceleration(t2);
974
- } else this.options.scrollingComplete?.();
975
- } else t2 - this.__lastTouchMove > 100 && this.options.scrollingComplete?.();
976
- this.__isDecelerating || ((this.__interruptedAnimation || this.__isDragging) && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, true, this.__zoomLevel)), this.__positions.length = 0;
977
- }
978
- }
979
- __publish(t2, e2, n2, o2 = false) {
980
- const i2 = this.__isAnimating;
981
- if (i2 && (ae(i2), this.__isAnimating = 0), o2 && this.options.animating) {
982
- this.__scheduledLeft = t2, this.__scheduledTop = e2, this.__scheduledZoom = n2;
983
- const o3 = this.__scrollLeft, r2 = this.__scrollTop, s2 = this.__zoomLevel, l2 = t2 - o3, a2 = e2 - r2, c2 = n2 - s2, h2 = function(t3, e3, n3) {
984
- n3 && (this.__scrollLeft = o3 + l2 * t3, this.__scrollTop = r2 + a2 * t3, this.__zoomLevel = s2 + c2 * t3, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
985
- }.bind(this), u2 = function(t3) {
986
- return this.__isAnimating === t3;
987
- }.bind(this), d2 = function(t3, e3, n3) {
988
- e3 === this.__isAnimating && (this.__isAnimating = false), (this.__didDecelerationComplete || n3) && this.options.scrollingComplete?.(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
989
- }.bind(this);
990
- this.__isAnimating = ce(h2, u2, d2, this.options.animationDuration, i2 ? he : ue);
991
- } else this.__scheduledLeft = this.__scrollLeft = t2, this.__scheduledTop = this.__scrollTop = e2, this.__scheduledZoom = this.__zoomLevel = n2, this.__callback && this.__callback(t2, e2, n2), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
992
- }
993
- __computeScrollMax(t2 = this.__zoomLevel) {
994
- this.__maxScrollLeft = Math.max(this.__contentWidth * t2 - this.__clientWidth, 0), this.__maxScrollTop = Math.max(this.__contentHeight * t2 - this.__clientHeight, 0);
995
- }
996
- __startDeceleration(t2) {
997
- if (this.options.paging) {
998
- const t3 = Math.max(Math.min(this.__scrollLeft, this.__maxScrollLeft), 0), e3 = Math.max(Math.min(this.__scrollTop, this.__maxScrollTop), 0), n3 = this.__clientWidth, o3 = this.__clientHeight;
999
- this.__minDecelerationScrollLeft = Math.floor(t3 / n3) * n3, this.__minDecelerationScrollTop = Math.floor(e3 / o3) * o3, this.__maxDecelerationScrollLeft = Math.ceil(t3 / n3) * n3, this.__maxDecelerationScrollTop = Math.ceil(e3 / o3) * o3;
1000
- } else this.__minDecelerationScrollLeft = 0, this.__minDecelerationScrollTop = 0, this.__maxDecelerationScrollLeft = this.__maxScrollLeft, this.__maxDecelerationScrollTop = this.__maxScrollTop;
1001
- const e2 = function(t3, e3, n3) {
1002
- this.__stepThroughDeceleration(n3);
1003
- }.bind(this), n2 = this.options.snapping ? 4 : 0.1, o2 = function() {
1004
- const t3 = Math.abs(this.__decelerationVelocityX) >= n2 || Math.abs(this.__decelerationVelocityY) >= n2;
1005
- return t3 || (this.__didDecelerationComplete = true), t3;
1006
- }.bind(this), i2 = function(t3, e3, n3) {
1007
- this.__isDecelerating = 0, this.__didDecelerationComplete && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping);
1008
- }.bind(this);
1009
- this.__isDecelerating = ce(e2, o2, i2);
1010
- }
1011
- __stepThroughDeceleration(t2) {
1012
- let e2 = this.__scrollLeft + this.__decelerationVelocityX, n2 = this.__scrollTop + this.__decelerationVelocityY;
1013
- if (!this.options.bouncing) {
1014
- const t3 = Math.max(Math.min(this.__maxDecelerationScrollLeft, e2), this.__minDecelerationScrollLeft);
1015
- t3 !== e2 && (e2 = t3, this.__decelerationVelocityX = 0);
1016
- const o2 = Math.max(Math.min(this.__maxDecelerationScrollTop, n2), this.__minDecelerationScrollTop);
1017
- o2 !== n2 && (n2 = o2, this.__decelerationVelocityY = 0);
1018
- }
1019
- if (t2 ? this.__publish(e2, n2, this.__zoomLevel) : (this.__scrollLeft = e2, this.__scrollTop = n2), !this.options.paging) {
1020
- const t3 = 0.95;
1021
- this.__decelerationVelocityX *= t3, this.__decelerationVelocityY *= t3;
1022
- }
1023
- if (this.options.bouncing) {
1024
- let t3 = 0, o2 = 0, i2 = this.options.penetrationDeceleration, r2 = this.options.penetrationAcceleration;
1025
- e2 < this.__minDecelerationScrollLeft ? t3 = this.__minDecelerationScrollLeft - e2 : e2 > this.__maxDecelerationScrollLeft && (t3 = this.__maxDecelerationScrollLeft - e2), n2 < this.__minDecelerationScrollTop ? o2 = this.__minDecelerationScrollTop - n2 : n2 > this.__maxDecelerationScrollTop && (o2 = this.__maxDecelerationScrollTop - n2), 0 !== t3 && (t3 * this.__decelerationVelocityX <= 0 ? this.__decelerationVelocityX += t3 * i2 : this.__decelerationVelocityX = t3 * r2), 0 !== o2 && (o2 * this.__decelerationVelocityY <= 0 ? this.__decelerationVelocityY += o2 * i2 : this.__decelerationVelocityY = o2 * r2);
1026
- }
1027
- }
1028
- }
1029
- const pe = (e2, n2) => t(oe, { ...e2, ref: n2 }), fe = Object.freeze(Object.defineProperty({ __proto__: null, defaultCreateScrollbar: pe, getScrollTo: (t2, e2, n2, o2, i2 = 0) => {
1030
- for (let i3 = 0; i3 < n2.length; i3++) {
1031
- const r2 = n2[i3].getBoundingClientRect();
1032
- let s2 = r2.left - e2, l2 = s2 + r2.width;
1033
- if (o2) {
1034
- if (s2 < t2 && l2 >= t2) return s2;
1035
- } else if (Math.ceil(l2) > Math.ceil(t2) + 2) return l2;
1036
- }
1037
- return i2;
1038
- } }, Symbol.toStringTag, { value: "Module" })), _e = ({ width: e2, height: n2 }) => t("div", { className: "corner", style: { minWidth: `${e2}px`, width: `${e2}px`, minHeight: `${n2}px`, height: `${n2}px` } }), me = _(m((o2, i2) => {
1039
- const { children: r2, viewport: l2, onScrollViewport: c2, showHorizontalScrollbar: u2 = true, showVerticalScrollbar: d2 = true, createScrollCorner: f2 = _e, createHorizontalScrollbar: _2 = pe, createVerticalScrollbar: m2 = pe, style: g2, touchElement: y2, disableTouch: v2, ...w2 } = o2, x2 = u2 && _2, S2 = d2 && m2, E2 = X(c2, [c2]), L2 = Nt(i2, () => ({ isScrollPane: () => true }), []), M2 = s(null);
1040
- h(() => {
1041
- M2.current && (M2.current.__scrollTop === l2?.top && M2.current.__scrollLeft === l2?.left || M2.current.__isDecelerating || M2.current?.scrollTo(l2?.left, l2?.top, false));
1042
- }, [l2?.left, l2?.top, y2]);
1043
- const T2 = a((t2, e2) => {
1044
- E2?.({ left: t2, top: e2 });
1045
- }, []), C2 = a((t2) => {
1046
- M2.current?.doTouchStart(t2.touches, t2.timeStamp);
1047
- }, []), k2 = a((t2) => {
1048
- t2.preventDefault(), M2.current?.doTouchMove(t2.touches, t2.timeStamp);
1049
- }, []), D2 = a((t2) => {
1050
- M2.current?.doTouchEnd(t2.timeStamp);
1051
- }, []), P2 = a(({ containerWidth: t2, containerHeight: e2, totalWidth: n2, totalHeight: o3 }) => {
1052
- M2.current.setDimensions(t2, e2, n2, o3);
1053
- }, []);
1054
- h(() => {
1055
- const t2 = y2 ?? L2.current;
1056
- if (!v2 && yt().supportsTouchEvents && t2 && l2) {
1057
- if (!M2.current) {
1058
- const t3 = { scrollingX: true, scrollingY: true, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
1059
- M2.current = new de(T2, t3);
1060
- }
1061
- yt().supportsTouchEvents && (t2.addEventListener("touchstart", C2), t2.addEventListener("touchend", D2), t2.addEventListener("touchmove", k2)), P2({ containerWidth: l2?.width, containerHeight: l2?.height, totalWidth: l2?.totalWidth, totalHeight: l2?.totalHeight });
1062
- }
1063
- return () => {
1064
- t2?.removeEventListener("touchstart", C2), t2?.removeEventListener("touchend", D2), t2?.removeEventListener("touchmove", k2);
1065
- };
1066
- }, [l2?.width, l2?.height, l2?.totalWidth, l2?.totalHeight, v2, y2]);
1067
- const [A2, { width: z2 }] = b(), [B2, { height: O2 }] = b(), K2 = p(() => {
1068
- if (!S2) return null;
1069
- const e2 = m2({ orientation: $.Vertical, offset: l2?.top, viewportSize: l2?.height, totalSize: l2?.totalHeight, onScrollOffset: (t2) => {
1070
- E2?.({ top: t2 });
1071
- } });
1072
- return t("div", { style: { display: "flex", flex: "0" }, ref: A2, children: e2 });
1073
- }, [m2, l2?.top, l2?.height, l2?.totalHeight]), H2 = p(() => {
1074
- if (!x2) return null;
1075
- const o3 = _2({ orientation: $.Horizontal, offset: l2?.left, viewportSize: l2?.width, totalSize: l2?.totalWidth, onScrollOffset: (t2) => {
1076
- E2?.({ left: t2 });
1077
- } });
1078
- return n("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [t("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${z2}px)` }, children: t("div", { ref: B2, className: "sizer", children: o3 }) }), S2 ? f2({ width: z2, height: O2 }) : t(e, {})] });
1079
- }, [_2, l2?.left, l2?.width, l2?.totalWidth, S2, f2, z2, O2]);
1080
- return t("div", { style: { position: "relative", display: "flex", minWidth: S2 ? `${z2}px` : void 0, minHeight: x2 ? `${O2}px` : void 0, ...g2 }, ...w2, ref: L2, children: n("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [n("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [t("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: r2 }), S2 ? K2 : t(e, {})] }), x2 ? H2 : t(e, {})] }) });
1081
- }));
1082
- me.displayName = "ScrollPane";
1083
- const ge = 300, ye = 100, ve = 1e6, we = 100, xe = 50, be = _(m((t2, e2) => {
1084
- const { offset: n2 = 0, viewportSize: o2 = 0, totalSize: i2 = 0, minSize: r2 = 0, endGap: s2 = ge, endScrollIncrement: l2 = ye, style: h2 = gt, onMouseDown: u2, onScrollOffset: d2, onScroll: f2, scaleLimit: _2 = ve, scaleFactor: m2 = we, precisionFactor: g2 = xe, createScrollbar: y2 = pe, ...v2 } = t2;
1085
- f2 && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
1086
- const w2 = X(u2, [u2]), [x2, b2] = c(false), S2 = p(() => {
1087
- const t3 = 0 === _2 ? i2 : Math.min(i2 ?? 0, Math.max(r2 ?? 0, (n2 ?? 0) + (o2 ?? 0)) + (s2 ?? 0)), e3 = 0 !== _2 && t3 > _2 ? m2 : 1, l3 = e3 / g2, a2 = Math.ceil(t3 / e3);
1088
- return { offset: Math.ceil(n2 / e3), totalSize: a2, viewportSize: Math.ceil(o2 / e3), scaledOffset: n2, scaledTotalSize: i2, scaledViewportSize: o2, factor: e3, precision: l3 };
1089
- }, [n2, i2, o2, x2, r2, s2, l2]), E2 = X((t3, e3, n3) => {
1090
- const o3 = S2.offset;
1091
- Math.abs(t3 - o3) < S2.precision && (t3 = o3), d2?.(t3 * S2.factor, o3, S2.viewportSize);
1092
- }, [d2, S2]), L2 = a((t3) => {
1093
- }, []), M2 = a((t3) => {
1094
- document.removeEventListener("mousemove", L2), document.removeEventListener("mouseup", M2), b2(false);
1095
- }, []), T2 = a((t3) => {
1096
- b2(true), w2?.(t3), document.addEventListener("mousemove", L2, { passive: true }), document.addEventListener("mouseup", M2, { passive: true });
1097
- }, [L2, M2]);
1098
- return pe({ style: h2, ...v2, offset: S2.offset, totalSize: S2.totalSize, viewportSize: S2.viewportSize, onMouseDown: T2, onScrollOffset: E2 }, e2);
1099
- }));
1100
- be.displayName = "VirtualScrollbar";
1101
- const Se = { BottomEnd: "bottom-end", BottomStart: "bottom-start", Bottom: "bottom", LeftEnd: "left-end", LeftStart: "left-start", Left: "left", RightEnd: "right-end", RightStart: "right-start", Right: "right", TopEnd: "top-end", TopStart: "top-start", Top: "top" }, Ee = _(m((e2, n2) => {
1102
- const { refFocusStart: o2, ...i2 } = e2, r2 = s(null), l2 = a(() => {
1103
- if (o2) return void o2?.current?.focus();
1104
- const t2 = r2.current.parentElement.children;
1105
- let e3 = [];
1106
- const n3 = t2.length;
1107
- for (let o3 = 0; o3 < n3 && t2[o3] !== r2.current; o3++) {
1108
- const n4 = t2[o3], i3 = n4.getAttribute("tabindex");
1109
- if (null == i3 || "-1" === i3) continue;
1110
- "true" !== n4.getAttribute("disabled") && (n4.focus && e3.push({ tabindex: parseInt(i3), child: n4 }));
1111
- }
1112
- 0 !== e3.length && (e3.sort(function(t3, e4) {
1113
- return t3.tabindex - e4.tabindex;
1114
- }), e3[0].child.focus());
1115
- }, [o2]);
1116
- return t("div", { tabIndex: 0, ref: x([r2, n2]), onFocus: l2, ...i2 });
1117
- }));
1118
- const Le = _(m((i2, r2) => {
1119
- const { className: l2, style: a2, children: c2, radius: h2 = 4, strokeWidth: u2 = 1, strokeColor: d2 = "grey", ...f2 } = i2, [_2, { width: m2, height: g2 }] = b(), y2 = s(null), v2 = (t2, e2 = 0) => {
1120
- const n2 = t2 / 2, o2 = g2 - n2 + e2;
1121
- return (function(t3, e3, n3 = false) {
1122
- if (0 === e3) return t3;
1123
- function o3(t4, e4, n4) {
1124
- let o4 = e4.x - t4.x, r4 = e4.y - t4.y, s3 = Math.sqrt(o4 * o4 + r4 * r4);
1125
- return i3(t4, e4, Math.min(1, n4 / s3));
1126
- }
1127
- function i3(t4, e4, n4) {
1128
- return { x: t4.x + (e4.x - t4.x) * n4, y: t4.y + (e4.y - t4.y) * n4 };
1129
- }
1130
- function r3(t4, e4) {
1131
- t4.length > 2 && (t4[t4.length - 2] = e4.x, t4[t4.length - 1] = e4.y);
1132
- }
1133
- function s2(t4) {
1134
- return { x: parseFloat(t4[t4.length - 2]), y: parseFloat(t4[t4.length - 1]) };
1135
- }
1136
- let l3 = t3.split(/[,\s]/).reduce(function(t4, e4) {
1137
- let n4 = e4.match("([a-zA-Z])(.+)");
1138
- return n4 ? (t4.push(n4[1]), t4.push(n4[2])) : t4.push(e4), t4;
1139
- }, []).reduce(function(t4, e4) {
1140
- return parseFloat(e4) == e4 && t4.length ? t4[t4.length - 1].push(e4) : t4.push([e4]), t4;
1141
- }, []), a3 = [];
1142
- if (l3.length > 1) {
1143
- let t4 = s2(l3[0]), c3 = null;
1144
- "Z" === l3[l3.length - 1][0] && l3[0].length > 2 && (c3 = ["L", t4.x, t4.y], l3[l3.length - 1] = c3), a3.push(l3[0]);
1145
- for (let t5 = 1; t5 < l3.length; t5++) {
1146
- let h3 = a3[a3.length - 1], u3 = l3[t5], d3 = u3 === c3 ? l3[1] : l3[t5 + 1];
1147
- if (d3 && h3 && h3.length > 2 && "L" === u3[0] && d3.length > 2 && "L" === d3[0]) {
1148
- let t6, l4, c4 = s2(h3), p2 = s2(u3), f3 = s2(d3);
1149
- n3 ? (t6 = i3(p2, h3.origPoint || c4, e3), l4 = i3(p2, d3.origPoint || f3, e3)) : (t6 = o3(p2, c4, e3), l4 = o3(p2, f3, e3)), r3(u3, t6), u3.origPoint = p2, a3.push(u3);
1150
- let _3 = i3(t6, p2, 0.5), m3 = i3(p2, l4, 0.5), g3 = ["C", _3.x, _3.y, m3.x, m3.y, l4.x, l4.y];
1151
- g3.origPoint = p2, a3.push(g3);
1152
- } else a3.push(u3);
1153
- }
1154
- if (c3) {
1155
- let t5 = s2(a3[a3.length - 1]);
1156
- a3.push(["Z"]), r3(a3[0], t5);
1157
- }
1158
- } else a3 = l3;
1159
- return a3.reduce(function(t4, e4) {
1160
- return t4 + e4.join(" ") + " ";
1161
- }, "");
1162
- })(`${`M 0 ${n2} L ${h2 - 0.5} ${n2} L ${h2 - 0.5} ${o2} L ${2 * h2} ${o2}`} ${`L ${m2 - 2 * h2} ${o2}`} ${`M ${m2 - 2 * h2} ${o2} L ${m2 - h2} ${o2} L ${m2 - h2} ${n2} L ${m2} ${n2}`}`, h2);
1163
- }, w2 = p(() => v2(u2), [m2, g2, h2, u2]), S2 = p(() => {
1164
- if (0 === h2) return;
1165
- const t2 = h2 / 2;
1166
- return v2(h2) + `L ${m2} 0 L 0 0 L 0 ${t2}`;
1167
- }, [w2, h2, u2]), E2 = p(() => ({ style: { clipPath: `path('${S2}')` } }), [S2]);
1168
- return n("div", { className: l2, style: { display: "flex", flexDirection: "row", ...a2 }, ...f2, ref: x([y2, _2, r2]), children: [o.isValidElement(c2) ? o.cloneElement(c2, E2) : t(e, {}), t("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: m2, height: g2, viewBox: `0 0 ${m2} ${g2}`, children: t("path", { d: w2, stroke: d2, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: u2 }) })] });
1169
- }));
1170
- class Me extends g {
806
+ class Xe extends b {
1171
807
  static getDerivedStateFromError() {
1172
808
  return { hasError: true };
1173
809
  }
1174
- componentDidCatch(t2) {
1175
- this.props.onError?.(t2);
810
+ componentDidCatch(e2) {
811
+ this.props.onError?.(e2);
1176
812
  }
1177
813
  render() {
1178
814
  return this.props.children;
1179
815
  }
1180
816
  }
1181
- const Te = ({ children: e2 }) => {
1182
- const n2 = R(), o2 = a((t2) => {
1183
- n2.showError(t2);
1184
- }, [n2]);
1185
- return t(Me, { onError: o2, children: e2 });
817
+ const Ye = ({ children: e2 }) => {
818
+ const t2 = oe(), n2 = m((e3) => {
819
+ t2.showError(e3);
820
+ }, [t2]);
821
+ return x(Xe, { onError: n2, children: e2 });
1186
822
  };
1187
- class Ce {
1188
- constructor(t2) {
1189
- this.notifier = t2, this.handleUnhandledRejection = (t3) => {
1190
- const e2 = t3.reason;
1191
- e2 instanceof DOMException && "AbortError" === e2.name || this.notifier.showError(e2);
1192
- }, this.handleGlobalError = (t3) => {
1193
- this.notifier.showError(t3.error);
823
+ class Ue {
824
+ constructor(e2) {
825
+ this.notifier = e2, this.handleUnhandledRejection = (e3) => {
826
+ const t2 = e3.reason;
827
+ t2 instanceof DOMException && "AbortError" === t2.name || this.notifier.showError(t2);
828
+ }, this.handleGlobalError = (e3) => {
829
+ this.notifier.showError(e3.error);
1194
830
  }, this.setupGlobalHandlers();
1195
831
  }
1196
832
  setupGlobalHandlers() {
@@ -1200,92 +836,92 @@ class Ce {
1200
836
  window.removeEventListener("unhandledrejection", this.handleUnhandledRejection), window.removeEventListener("error", this.handleGlobalError);
1201
837
  }
1202
838
  }
1203
- const ke = ({ children: n2 }) => {
1204
- const o2 = R();
1205
- return h(() => {
1206
- const t2 = new Ce(o2);
839
+ const Ge = ({ children: e2 }) => {
840
+ const t2 = oe();
841
+ return u(() => {
842
+ const e3 = new Ue(t2);
1207
843
  return () => {
1208
- t2.cleanup();
844
+ e3.cleanup();
1209
845
  };
1210
- }, [o2]), t(e, { children: n2 });
1211
- }, De = () => null, Pe = {}, Ae = (e2) => {
1212
- const { onPointerDown: n2, style: o2, splitDirection: i2, paddingBefore: r2 = 0, paddingAfter: s2 = 0, disabled: l2, key: a2, hitAreaProps: c2 = Pe, ...h2 } = e2, u2 = "row" === i2, { style: d2, className: p2, ...f2 } = c2;
1213
- return t("div", { style: { ...o2, position: "relative" }, ...h2, children: t("div", { className: w("hit-box", p2), style: { left: (u2 ? -r2 : 0) + "px", width: `calc(100% + ${u2 ? r2 + s2 : 0}px)`, top: (u2 ? 0 : -r2) + "px", height: `calc(100% + ${u2 ? 0 : r2 + s2}px)`, position: "absolute", ...d2 }, onPointerDown: l2 ? void 0 : n2, ...f2 }) }, a2);
1214
- }, ze = {}, Be = (t2, e2, n2 = true) => null === t2 ? null : null !== t2.pixels ? n2 ? t2.pixels : e2 - t2.pixels : (n2 ? t2.percent : 100 - t2.percent) / 100 * e2, $e = (t2, e2 = true) => t2?.percent ? `${e2 ? t2.percent : 100 - t2.percent}%` : t2?.pixels ? `${t2.pixels}px` : void 0, Oe = (t2, e2) => {
1215
- if (null == t2) return null;
846
+ }, [t2]), x(E, { children: e2 });
847
+ }, Ze = () => null, qe = {}, Je = (e2) => {
848
+ const { onPointerDown: t2, style: n2, splitDirection: o2, paddingBefore: i2 = 0, paddingAfter: r2 = 0, disabled: s2, key: l2, hitAreaProps: a2 = qe, ...c2 } = e2, h2 = "row" === o2, { style: u2, className: d2, ...p2 } = a2;
849
+ return x("div", { style: { ...n2, position: "relative" }, ...c2, children: x("div", { className: T("hit-box", d2), style: { left: (h2 ? -i2 : 0) + "px", width: `calc(100% + ${h2 ? i2 + r2 : 0}px)`, top: (h2 ? 0 : -i2) + "px", height: `calc(100% + ${h2 ? 0 : i2 + r2}px)`, position: "absolute", ...u2 }, onPointerDown: s2 ? void 0 : t2, ...p2 }) }, l2);
850
+ }, Qe = {}, et = (e2, t2, n2 = true) => null === e2 ? null : null !== e2.pixels ? n2 ? e2.pixels : t2 - e2.pixels : (n2 ? e2.percent : 100 - e2.percent) / 100 * t2, tt = (e2, t2 = true) => e2?.percent ? `${t2 ? e2.percent : 100 - e2.percent}%` : e2?.pixels ? `${e2.pixels}px` : void 0, nt = (e2, t2) => {
851
+ if (null == e2) return null;
1216
852
  const n2 = { percent: null, pixels: null };
1217
- let o2 = e2;
1218
- return "string" == typeof t2 && ((t2 = t2.trim().toLowerCase()).endsWith("px") ? (t2 = t2.substring(0, t2.length - 2), o2 = false) : t2.endsWith("%") && (t2 = t2.substring(0, t2.length - 1), o2 = true), t2 = parseFloat(t2)), o2 ? n2.percent = t2 : n2.pixels = t2, Object.freeze(n2);
1219
- }, Ke = _(m((e2, i2) => {
1220
- const { elementBefore: r2, elementAfter: l2, splitDirection: a2 = "row", fixedPane: u2 = null, position: d2, onPositionChange: f2, minBefore: _2, maxBefore: m2, minAfter: g2, maxAfter: y2, children: v2, className: S2, style: E2, disabled: L2 = false, onDragStart: M2, onDragResize: T2, onDragFinish: C2, resizerProps: k2 = ze, paneProps: D2 = ze, paneBeforeProps: P2 = ze, paneAfterProps: A2 = ze, createResizer: z2 = Ae } = e2;
1221
- if (v2) throw new Error("Use elementBefore and elementAfter instead of children.");
1222
- const B2 = p(() => o.isValidElement(l2) && o.isValidElement(r2), [l2, r2]), $2 = p(() => {
1223
- let t2 = null;
1224
- u2 && ("before" === u2 ? t2 = 0 : "after" === u2 && (t2 = 1));
1225
- const e3 = null === t2;
1226
- return { fixedPaneOffset: t2, isPercent: e3, minBefore: Oe(_2, e3), maxBefore: Oe(m2, e3), minAfter: Oe(g2, e3), maxAfter: Oe(y2, e3) };
1227
- }, [_2, m2, g2, y2]), O2 = X(f2, [f2]), [K2, H2] = c(() => Oe(d2, null === u2));
1228
- h(() => {
1229
- H2(Oe(d2, null === u2));
1230
- }, [d2, u2]);
1231
- const [N2, { width: R2, height: W2 }] = b(), [V2, { width: I2, height: F2 }] = b(), j2 = "row" === a2 ? I2 : F2, Y2 = "row" === a2 ? R2 : W2, U2 = p(() => ((t2, e3, n2, o2) => {
853
+ let o2 = t2;
854
+ return "string" == typeof e2 && ((e2 = e2.trim().toLowerCase()).endsWith("px") ? (e2 = e2.substring(0, e2.length - 2), o2 = false) : e2.endsWith("%") && (e2 = e2.substring(0, e2.length - 1), o2 = true), e2 = parseFloat(e2)), o2 ? n2.percent = e2 : n2.pixels = e2, Object.freeze(n2);
855
+ }, ot = p(f((e2, t2) => {
856
+ const { elementBefore: n2, elementAfter: o2, splitDirection: i2 = "row", fixedPane: r2 = null, position: s2, onPositionChange: c2, minBefore: p2, maxBefore: f2, minAfter: m2, maxAfter: _2, children: g2, className: y2, style: v2, disabled: w2 = false, onDragStart: b2, onDragResize: E2, onDragFinish: k2, resizerProps: C2 = Qe, paneProps: D2 = Qe, paneBeforeProps: P2 = Qe, paneAfterProps: A2 = Qe, createResizer: z2 = Je } = e2;
857
+ if (g2) throw new Error("Use elementBefore and elementAfter instead of children.");
858
+ const B2 = h(() => l.isValidElement(o2) && l.isValidElement(n2), [o2, n2]), $2 = h(() => {
859
+ let e3 = null;
860
+ r2 && ("before" === r2 ? e3 = 0 : "after" === r2 && (e3 = 1));
861
+ const t3 = null === e3;
862
+ return { fixedPaneOffset: e3, isPercent: t3, minBefore: nt(p2, t3), maxBefore: nt(f2, t3), minAfter: nt(m2, t3), maxAfter: nt(_2, t3) };
863
+ }, [p2, f2, m2, _2]), K2 = ce(c2, [c2]), [O2, I2] = d(() => nt(s2, null === r2));
864
+ u(() => {
865
+ I2(nt(s2, null === r2));
866
+ }, [s2, r2]);
867
+ const [N2, { width: H2, height: R2 }] = M(), [W2, { width: V2, height: F2 }] = M(), j2 = "row" === i2 ? V2 : F2, X2 = "row" === i2 ? H2 : R2, Y2 = h(() => ((e3, t3, n3, o3) => {
1232
868
  const i3 = [null, null], r3 = [null, null];
1233
- if (t2 || (t2 = { percent: null === o2.fixedPaneOffset ? 50 : null, pixels: null === o2.fixedPaneOffset ? null : 0 }), 0 === e3) return null != t2?.pixels ? 1 !== o2.fixedPaneOffset ? (i3[0] = t2?.pixels, r3[1] = 100) : (i3[1] = t2?.pixels - n2, r3[0] = 100) : null != t2?.percent && (1 !== o2.fixedPaneOffset ? (r3[0] = t2?.percent, r3[1] = 100 - t2?.percent) : (r3[1] = t2?.percent, r3[0] = 100 - t2?.percent)), { percents: r3, pixels: i3, minBefore: $e(o2.minBefore, true), maxBefore: $e(o2.maxBefore, true), minAfter: $e(o2.minAfter), maxAfter: $e(o2.maxAfter) };
1234
- let s2 = Be(t2, e3, 1 !== o2.fixedPaneOffset), l3 = e3 - n2, a3 = Be(o2.minBefore, l3, true) ?? 0, c2 = Be(o2.maxBefore, l3, true) ?? l3, h2 = 0, u3 = 0, d3 = 0, p2 = l3;
1235
- h2 = (Be(o2.maxAfter, e3, false) ?? n2) - n2, u3 = Be(o2.minAfter, e3, false) ?? e3, d3 = Math.max(a3, h2), p2 = Math.min(c2, u3), s2 = Math.max(d3, Math.min(s2, p2)), u3 = Math.min(l3 - s2, Be(o2.maxAfter, l3 - s2, true) ?? l3), h2 = Math.min(l3 - s2, Be(o2.minAfter, l3 - s2, true) ?? l3), i3[0] = s2, i3[1] = l3 - i3[0];
1236
- const f3 = Math.max(0, Math.min(100, s2 / l3 * 100));
1237
- return r3[0] = f3, r3[1] = 100 - r3[0], { percents: r3, pixels: i3, minBefore: `${a3}px`, minAfter: `${h2}px`, maxBefore: `${i3[0]}px`, maxAfter: `${i3[1]}px` };
1238
- })(K2, Y2, j2, $2), [$2, K2, Y2, j2, a2]), [G2, Z2] = c(false), q2 = X(M2, [M2]), J2 = X(T2, [T2]), Q2 = X(C2, [C2]), tt2 = s(null), et2 = s(null), nt2 = s(null), { style: ot2, className: it2, ...rt2 } = D2, st2 = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", height: "100%", widthResizer: "100%", display: "flex", overflow: "hidden", position: "relative", ...ot2 }, { className: lt2, style: at2, ...ct2 } = P2, { className: ht2, style: ut2, ...dt2 } = A2, pt2 = { flex: "1 1 100%", width: "100%", ...E2, flexDirection: a2, display: "flex" }, { className: ft2, style: _t2, onPointerDown: mt2, ...gt2 } = k2, yt2 = X((t2) => {
1239
- const e3 = Oe(t2, null === u2);
1240
- H2(e3);
1241
- }, [u2]), vt2 = X((t2) => {
1242
- if (L2 || !G2) return;
1243
- const e3 = bt2.current?.getBoundingClientRect();
1244
- let n2 = 0;
1245
- n2 = "row" === a2 ? (t2.clientX ?? t2.touches?.[0]?.clientX) - e3.x : (t2.clientY ?? t2.touches?.[0]?.clientY) - e3.y, n2 = Math.max(0, Math.min(Y2, n2)), 1 === $2.fixedPaneOffset && (n2 = Y2 - n2), d2 && K2.pixels === n2 || H2({ pixels: n2, percent: null }), J2?.(n2), t2.stopPropagation(), t2.preventDefault();
1246
- }, [$2, a2, L2, G2, K2, Y2]), wt2 = X((t2) => {
1247
- if (document.removeEventListener("pointermove", vt2), document.removeEventListener("touchmove", vt2), document.removeEventListener("pointerup", wt2), !G2) return;
1248
- if (Z2(false), !K2) return;
1249
- Q2(K2.pixels);
1250
- if (!Oe(d2, null === u2) || K2.pixels !== d2) {
1251
- const t3 = { ...K2 };
1252
- null === t3.percent && (t3.percent = t3.pixels / Y2 * 100), O2(t3);
869
+ if (e3 || (e3 = { percent: null === o3.fixedPaneOffset ? 50 : null, pixels: null === o3.fixedPaneOffset ? null : 0 }), 0 === t3) return null != e3?.pixels ? 1 !== o3.fixedPaneOffset ? (i3[0] = e3?.pixels, r3[1] = 100) : (i3[1] = e3?.pixels - n3, r3[0] = 100) : null != e3?.percent && (1 !== o3.fixedPaneOffset ? (r3[0] = e3?.percent, r3[1] = 100 - e3?.percent) : (r3[1] = e3?.percent, r3[0] = 100 - e3?.percent)), { percents: r3, pixels: i3, minBefore: tt(o3.minBefore, true), maxBefore: tt(o3.maxBefore, true), minAfter: tt(o3.minAfter), maxAfter: tt(o3.maxAfter) };
870
+ let s3 = et(e3, t3, 1 !== o3.fixedPaneOffset), l2 = t3 - n3, a2 = et(o3.minBefore, l2, true) ?? 0, c3 = et(o3.maxBefore, l2, true) ?? l2, h2 = 0, u2 = 0, d2 = 0, p3 = l2;
871
+ h2 = (et(o3.maxAfter, t3, false) ?? n3) - n3, u2 = et(o3.minAfter, t3, false) ?? t3, d2 = Math.max(a2, h2), p3 = Math.min(c3, u2), s3 = Math.max(d2, Math.min(s3, p3)), u2 = Math.min(l2 - s3, et(o3.maxAfter, l2 - s3, true) ?? l2), h2 = Math.min(l2 - s3, et(o3.minAfter, l2 - s3, true) ?? l2), i3[0] = s3, i3[1] = l2 - i3[0];
872
+ const f3 = Math.max(0, Math.min(100, s3 / l2 * 100));
873
+ return r3[0] = f3, r3[1] = 100 - r3[0], { percents: r3, pixels: i3, minBefore: `${a2}px`, minAfter: `${h2}px`, maxBefore: `${i3[0]}px`, maxAfter: `${i3[1]}px` };
874
+ })(O2, X2, j2, $2), [$2, O2, X2, j2, i2]), [U2, G2] = d(false), Z2 = ce(b2, [b2]), q2 = ce(E2, [E2]), J2 = ce(k2, [k2]), Q2 = a(null), ee2 = a(null), te2 = a(null), { style: ne2, className: oe2, ...ie2 } = D2, re2 = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", height: "100%", widthResizer: "100%", display: "flex", overflow: "hidden", position: "relative", ...ne2 }, { className: se2, style: le2, ...ae2 } = P2, { className: he2, style: ue2, ...de2 } = A2, pe2 = { flex: "1 1 100%", width: "100%", ...v2, flexDirection: i2, display: "flex" }, { className: fe2, style: me2, onPointerDown: _e2, ...ge2 } = C2, ye2 = ce((e3) => {
875
+ const t3 = nt(e3, null === r2);
876
+ I2(t3);
877
+ }, [r2]), ve2 = ce((e3) => {
878
+ if (w2 || !U2) return;
879
+ const t3 = xe2.current?.getBoundingClientRect();
880
+ let n3 = 0;
881
+ n3 = "row" === i2 ? (e3.clientX ?? e3.touches?.[0]?.clientX) - t3.x : (e3.clientY ?? e3.touches?.[0]?.clientY) - t3.y, n3 = Math.max(0, Math.min(X2, n3)), 1 === $2.fixedPaneOffset && (n3 = X2 - n3), s2 && O2.pixels === n3 || I2({ pixels: n3, percent: null }), q2?.(n3), e3.stopPropagation(), e3.preventDefault();
882
+ }, [$2, i2, w2, U2, O2, X2]), we2 = ce((e3) => {
883
+ if (document.removeEventListener("pointermove", ve2), document.removeEventListener("touchmove", ve2), document.removeEventListener("pointerup", we2), !U2) return;
884
+ if (G2(false), !O2) return;
885
+ J2(O2.pixels);
886
+ if (!nt(s2, null === r2) || O2.pixels !== s2) {
887
+ const e4 = { ...O2 };
888
+ null === e4.percent && (e4.percent = e4.pixels / X2 * 100), K2(e4);
1253
889
  }
1254
- t2.stopPropagation(), t2.preventDefault();
1255
- }, [K2, G2, d2, u2, Y2]), xt2 = X((t2) => {
1256
- mt2?.(t2), t2.defaultPrevented || L2 || G2 || (Z2(true), q2(), document.addEventListener("pointermove", vt2, { passive: false }), document.addEventListener("touchmove", vt2, { passive: false }), document.addEventListener("pointerup", wt2, { passive: false }));
1257
- }, [mt2]), bt2 = Nt(i2, () => ({ setPosition: yt2, isSplitPane: () => true }), []), St2 = p(() => B2 ? z2?.({ key: "resizer", ref: x([V2, et2]), className: w("resizer", ft2), onPointerDownCapture: xt2, style: { cursor: L2 ? void 0 : "row" === a2 ? "ew-resize" : "ns-resize", minWidth: "row" === a2 ? "2px" : void 0, minHeight: "row" !== a2 ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ..._t2 }, splitDirection: a2, disabled: L2, ...gt2 }) : null, [B2, ft2, gt2, a2, _t2, L2]), Et2 = "row" === a2 ? "Width" : "Height", Lt2 = p(() => {
1258
- if (!r2) return null;
1259
- const e3 = { ...st2, ...at2, flex: 0 === $2.fixedPaneOffset && null !== U2?.pixels[0] ? `0 0 ${Math.round(U2?.pixels[0])}px` : `1 1 ${Math.round(U2?.percents[0] ?? 100)}%`, [`min${Et2}`]: U2?.minBefore, [`max${Et2}`]: l2 ? U2?.maxBefore : "100%" };
1260
- return t("div", { ref: tt2, className: w("before", it2, lt2), style: e3, ...rt2, ...ct2, children: r2 }, "before");
1261
- }, [r2, D2, P2, $2, U2]), Mt2 = p(() => {
1262
- if (!l2) return null;
1263
- const e3 = { ...st2, ...ut2, flex: 1 === $2.fixedPaneOffset && null !== U2?.pixels[1] ? `0 0 ${Math.round(U2?.pixels[1])}px` : `1 1 ${Math.round(U2?.percents[1] ?? 100)}%`, [`min${Et2}`]: U2?.minAfter, [`max${Et2}`]: r2 ? U2?.maxAfter : "100%" };
1264
- return t("div", { ref: nt2, className: w("after", it2, ht2), style: e3, ...rt2, ...dt2, children: l2 }, "after");
1265
- }, [l2, D2, A2, $2, U2]);
1266
- return n("div", { ref: x([N2, bt2]), className: w("splitPane", "row" === a2 ? "vertical" : "horizontal", { dragging: G2 }, S2), style: pt2, children: [Lt2, St2, Mt2] });
890
+ e3.stopPropagation(), e3.preventDefault();
891
+ }, [O2, U2, s2, r2, X2]), be2 = ce((e3) => {
892
+ _e2?.(e3), e3.defaultPrevented || w2 || U2 || (G2(true), Z2(), document.addEventListener("pointermove", ve2, { passive: false }), document.addEventListener("touchmove", ve2, { passive: false }), document.addEventListener("pointerup", we2, { passive: false }));
893
+ }, [_e2]), xe2 = Re(t2, () => ({ setPosition: ye2, isSplitPane: () => true }), []), Se2 = h(() => B2 ? z2?.({ key: "resizer", ref: L([W2, ee2]), className: T("resizer", fe2), onPointerDownCapture: be2, style: { cursor: w2 ? void 0 : "row" === i2 ? "ew-resize" : "ns-resize", minWidth: "row" === i2 ? "2px" : void 0, minHeight: "row" !== i2 ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...me2 }, splitDirection: i2, disabled: w2, ...ge2 }) : null, [B2, fe2, ge2, i2, me2, w2]), Ee2 = "row" === i2 ? "Width" : "Height", Le2 = h(() => {
894
+ if (!n2) return null;
895
+ const e3 = { ...re2, ...le2, flex: 0 === $2.fixedPaneOffset && null !== Y2?.pixels[0] ? `0 0 ${Math.round(Y2?.pixels[0])}px` : `1 1 ${Math.round(Y2?.percents[0] ?? 100)}%`, [`min${Ee2}`]: Y2?.minBefore, [`max${Ee2}`]: o2 ? Y2?.maxBefore : "100%" };
896
+ return x("div", { ref: Q2, className: T("before", oe2, se2), style: e3, ...ie2, ...ae2, children: n2 }, "before");
897
+ }, [n2, D2, P2, $2, Y2]), Me2 = h(() => {
898
+ if (!o2) return null;
899
+ const e3 = { ...re2, ...ue2, flex: 1 === $2.fixedPaneOffset && null !== Y2?.pixels[1] ? `0 0 ${Math.round(Y2?.pixels[1])}px` : `1 1 ${Math.round(Y2?.percents[1] ?? 100)}%`, [`min${Ee2}`]: Y2?.minAfter, [`max${Ee2}`]: n2 ? Y2?.maxAfter : "100%" };
900
+ return x("div", { ref: te2, className: T("after", oe2, he2), style: e3, ...ie2, ...de2, children: o2 }, "after");
901
+ }, [o2, D2, A2, $2, Y2]);
902
+ return S("div", { ref: L([N2, xe2]), className: T("splitPane", "row" === i2 ? "vertical" : "horizontal", { dragging: U2 }, y2), style: pe2, children: [Le2, Se2, Me2] });
1267
903
  }));
1268
- function He(t2) {
1269
- if ("function" == typeof t2) return t2;
1270
- if ("string" == typeof t2) {
1271
- const e2 = t2.trim();
1272
- if (e2.startsWith("data:image/svg+xml")) {
1273
- const t3 = (function(t4) {
1274
- const e3 = /^data:image\/svg\+xml(;[^,]*)?,(.*)$/i.exec(t4.trim());
1275
- if (!e3) return null;
1276
- const n2 = e3[1] || "", o2 = e3[2] || "";
904
+ function it(e2) {
905
+ if ("function" == typeof e2) return e2;
906
+ if ("string" == typeof e2) {
907
+ const t2 = e2.trim();
908
+ if (t2.startsWith("data:image/svg+xml")) {
909
+ const e3 = (function(e4) {
910
+ const t3 = /^data:image\/svg\+xml(;[^,]*)?,(.*)$/i.exec(e4.trim());
911
+ if (!t3) return null;
912
+ const n2 = t3[1] || "", o2 = t3[2] || "";
1277
913
  try {
1278
914
  if (/;base64/i.test(n2)) {
1279
915
  if ("undefined" != typeof atob) {
1280
- const t5 = atob(o2), e4 = t5.length;
916
+ const e5 = atob(o2), t4 = e5.length;
1281
917
  if ("undefined" != typeof TextDecoder) {
1282
- const n4 = new Uint8Array(e4);
1283
- for (let o3 = 0; o3 < e4; o3++) n4[o3] = t5.charCodeAt(o3);
918
+ const n4 = new Uint8Array(t4);
919
+ for (let o3 = 0; o3 < t4; o3++) n4[o3] = e5.charCodeAt(o3);
1284
920
  return new TextDecoder("utf-8").decode(n4);
1285
921
  }
1286
922
  let n3 = "";
1287
- for (let o3 = 0; o3 < e4; o3++) {
1288
- n3 += `%${t5.charCodeAt(o3).toString(16).padStart(2, "0")}`;
923
+ for (let o3 = 0; o3 < t4; o3++) {
924
+ n3 += `%${e5.charCodeAt(o3).toString(16).padStart(2, "0")}`;
1289
925
  }
1290
926
  return decodeURIComponent(n3);
1291
927
  }
@@ -1299,300 +935,797 @@ function He(t2) {
1299
935
  } catch {
1300
936
  return null;
1301
937
  }
1302
- })(e2);
1303
- if (t3) return We(t3);
938
+ })(t2);
939
+ if (e3) return lt(e3);
1304
940
  }
1305
- if (e2.startsWith("<")) {
1306
- if (/^<\s*svg\b/i.test(e2)) return We(e2);
1307
- if (/^<\s*path\b/i.test(e2)) {
1308
- const t3 = Ne(e2);
1309
- if (t3) return { paths: [{ d: t3 }] };
941
+ if (t2.startsWith("<")) {
942
+ if (/^<\s*svg\b/i.test(t2)) return lt(t2);
943
+ if (/^<\s*path\b/i.test(t2)) {
944
+ const e3 = rt(t2);
945
+ if (e3) return { paths: [{ d: e3 }] };
1310
946
  }
1311
- return { paths: [{ d: e2 }] };
947
+ return { paths: [{ d: t2 }] };
1312
948
  }
1313
- return { paths: [{ d: e2 }] };
1314
- }
1315
- if (Array.isArray(t2)) {
1316
- const e2 = [];
1317
- for (const n2 of t2) if ("string" == typeof n2) {
1318
- const t3 = String(n2).trim();
1319
- if (t3.startsWith("<path")) {
1320
- const n3 = Ne(t3);
1321
- n3 && e2.push({ d: n3 });
1322
- } else e2.push({ d: t3 });
1323
- } else n2 && "object" == typeof n2 && "d" in n2 && "string" == typeof n2.d && e2.push({ ...n2 });
1324
- return { paths: e2 };
1325
- }
1326
- return t2;
949
+ return { paths: [{ d: t2 }] };
950
+ }
951
+ if (Array.isArray(e2)) {
952
+ const t2 = [];
953
+ for (const n2 of e2) if ("string" == typeof n2) {
954
+ const e3 = String(n2).trim();
955
+ if (e3.startsWith("<path")) {
956
+ const n3 = rt(e3);
957
+ n3 && t2.push({ d: n3 });
958
+ } else t2.push({ d: e3 });
959
+ } else n2 && "object" == typeof n2 && "d" in n2 && "string" == typeof n2.d && t2.push({ ...n2 });
960
+ return { paths: t2 };
961
+ }
962
+ return e2;
1327
963
  }
1328
- function Ne(t2) {
1329
- const e2 = /\bd\s*=\s*(?:"([^"]+)"|'([^']+)')/i.exec(t2);
1330
- return e2 ? e2[1] ?? e2[2] ?? null : null;
964
+ function rt(e2) {
965
+ const t2 = /\bd\s*=\s*(?:"([^"]+)"|'([^']+)')/i.exec(e2);
966
+ return t2 ? t2[1] ?? t2[2] ?? null : null;
1331
967
  }
1332
- function Re(t2) {
1333
- if ("svg" in t2) return { ...t2, svg: He(t2.svg) };
1334
- if ("url" in t2) {
1335
- const e2 = "string" == typeof t2.url ? { src: t2.url } : t2.url;
1336
- return { ...t2, url: e2 };
968
+ function st(e2) {
969
+ if ("svg" in e2) return { ...e2, svg: it(e2.svg) };
970
+ if ("url" in e2) {
971
+ const t2 = "string" == typeof e2.url ? { src: e2.url } : e2.url;
972
+ return { ...e2, url: t2 };
1337
973
  }
1338
- if ("emoji" in t2) {
1339
- const e2 = "string" == typeof t2.emoji ? t2.emoji : t2.emoji.text;
1340
- return { ...t2, emoji: e2 };
974
+ if ("emoji" in e2) {
975
+ const t2 = "string" == typeof e2.emoji ? e2.emoji : e2.emoji.text;
976
+ return { ...e2, emoji: t2 };
1341
977
  }
1342
- return t2;
978
+ return e2;
1343
979
  }
1344
- function We(t2) {
980
+ function lt(e2) {
1345
981
  try {
1346
982
  if ("undefined" != typeof DOMParser) {
1347
- const e3 = new DOMParser().parseFromString(t2, "image/svg+xml"), n3 = e3.querySelector("svg"), o3 = n3?.getAttribute("viewBox") ?? void 0, i3 = [];
1348
- return e3.querySelectorAll("path").forEach((t3) => {
1349
- const e4 = t3.getAttribute("d");
1350
- if (!e4) return;
1351
- const n4 = { d: e4 }, o4 = t3.getAttribute("class");
983
+ const t3 = new DOMParser().parseFromString(e2, "image/svg+xml"), n3 = t3.querySelector("svg"), o3 = n3?.getAttribute("viewBox") ?? void 0, i3 = [];
984
+ return t3.querySelectorAll("path").forEach((e3) => {
985
+ const t4 = e3.getAttribute("d");
986
+ if (!t4) return;
987
+ const n4 = { d: t4 }, o4 = e3.getAttribute("class");
1352
988
  o4 && (n4.className = o4);
1353
- const r3 = t3.getAttribute("fill");
989
+ const r3 = e3.getAttribute("fill");
1354
990
  r3 && "none" !== r3 && (n4.fill = r3);
1355
- const s2 = t3.getAttribute("stroke");
991
+ const s2 = e3.getAttribute("stroke");
1356
992
  s2 && (n4.stroke = s2);
1357
- const l2 = t3.getAttribute("opacity");
993
+ const l2 = e3.getAttribute("opacity");
1358
994
  l2 && (n4.opacity = Number(l2));
1359
- const a2 = t3.getAttribute("fill-rule");
995
+ const a2 = e3.getAttribute("fill-rule");
1360
996
  a2 && (n4.fillRule = a2);
1361
- const c2 = t3.getAttribute("clip-rule");
997
+ const c2 = e3.getAttribute("clip-rule");
1362
998
  c2 && (n4.clipRule = c2), i3.push(n4);
1363
999
  }), { viewBox: o3, paths: i3 };
1364
1000
  }
1365
1001
  } catch {
1366
1002
  }
1367
- const e2 = t2.match(/viewBox="([^"]+)"/i), n2 = e2 ? e2[1] : void 0, o2 = [], i2 = /<path\b[^>]*\sd="([^"]+)"[^>]*>/gi;
1003
+ const t2 = e2.match(/viewBox="([^"]+)"/i), n2 = t2 ? t2[1] : void 0, o2 = [], i2 = /<path\b[^>]*\sd="([^"]+)"[^>]*>/gi;
1368
1004
  let r2;
1369
- for (; r2 = i2.exec(t2); ) o2.push({ d: r2[1] });
1005
+ for (; r2 = i2.exec(e2); ) o2.push({ d: r2[1] });
1370
1006
  return { viewBox: n2, paths: o2 };
1371
1007
  }
1372
- function Ve(t2) {
1373
- const e2 = {};
1374
- for (const [n3, o3] of Object.entries(t2.icons)) e2[n3] = Re(o3);
1375
- const n2 = { label: t2.meta?.label ?? "Unnamed", version: t2.meta?.version ?? "1.0.0", license: t2.meta?.license ?? "MIT", defaultViewBox: "0 0 24 24", extends: t2.meta?.extends ?? [] };
1008
+ function at(e2) {
1009
+ const t2 = {};
1010
+ for (const [n3, o3] of Object.entries(e2.icons)) t2[n3] = st(o3);
1011
+ const n2 = { label: e2.meta?.label ?? "Unnamed", version: e2.meta?.version ?? "1.0.0", license: e2.meta?.license ?? "MIT", defaultViewBox: "0 0 24 24", extends: e2.meta?.extends ?? [] };
1376
1012
  n2.extends.includes("base") || n2.extends.push("base");
1377
- const o2 = { meta: n2, icons: e2 }, i2 = t2.overrides;
1013
+ const o2 = { meta: n2, icons: t2 }, i2 = e2.overrides;
1378
1014
  if (i2) {
1379
- const t3 = {};
1380
- for (const [e3, n3] of Object.entries(i2)) {
1015
+ const e3 = {};
1016
+ for (const [t3, n3] of Object.entries(i2)) {
1381
1017
  const o3 = {};
1382
- for (const [t4, e4] of Object.entries(n3)) o3[t4] = Re(e4);
1383
- t3[e3] = o3;
1018
+ for (const [e4, t4] of Object.entries(n3)) o3[e4] = st(t4);
1019
+ e3[t3] = o3;
1384
1020
  }
1385
- o2.__overrides = t3;
1021
+ o2.__overrides = e3;
1386
1022
  }
1387
1023
  return o2;
1388
1024
  }
1389
- function Ie() {
1390
- const t2 = /* @__PURE__ */ new Map(), e2 = /* @__PURE__ */ new Map();
1025
+ function ct() {
1026
+ const e2 = /* @__PURE__ */ new Map(), t2 = /* @__PURE__ */ new Map();
1391
1027
  let n2 = "base", o2 = /* @__PURE__ */ new Map();
1392
- async function i2(e3) {
1393
- const o3 = t2.get(e3 ?? n2);
1394
- if (!o3) throw new Error(`Icon pack not registered: ${e3}`);
1028
+ async function i2(t3) {
1029
+ const o3 = e2.get(t3 ?? n2);
1030
+ if (!o3) throw new Error(`Icon pack not registered: ${t3}`);
1395
1031
  if (!o3.pack) {
1396
1032
  if (!o3.loading) {
1397
- if (!o3.loader) throw new Error(`No loader for icon pack: ${e3}`);
1398
- o3.loading = o3.loader().then((t3) => {
1399
- const e4 = t3 && "object" == typeof t3 && "default" in t3 ? t3.default : t3;
1400
- o3.pack = Ve(e4);
1401
- }).catch((t3) => {
1402
- throw o3.loading = void 0, t3;
1033
+ if (!o3.loader) throw new Error(`No loader for icon pack: ${t3}`);
1034
+ o3.loading = o3.loader().then((e3) => {
1035
+ const t4 = e3 && "object" == typeof e3 && "default" in e3 ? e3.default : e3;
1036
+ o3.pack = at(t4);
1037
+ }).catch((e3) => {
1038
+ throw o3.loading = void 0, e3;
1403
1039
  });
1404
1040
  }
1405
1041
  await o3.loading;
1406
1042
  }
1407
1043
  }
1408
- function r2(t3) {
1409
- const e3 = t3.indexOf(":");
1410
- return e3 > 0 ? { ns: t3.slice(0, e3), key: t3.slice(e3 + 1) } : { key: t3 };
1044
+ function r2(e3) {
1045
+ const t3 = e3.indexOf(":");
1046
+ return t3 > 0 ? { ns: e3.slice(0, t3), key: e3.slice(t3 + 1) } : { key: e3 };
1411
1047
  }
1412
1048
  function s2(n3, o3) {
1413
- const i3 = [n3, ...t2.get(n3)?.pack?.meta.extends ?? []];
1049
+ const i3 = [n3, ...e2.get(n3)?.pack?.meta.extends ?? []];
1414
1050
  for (const n4 of i3) {
1415
- const i4 = t2.get(n4);
1051
+ const i4 = e2.get(n4);
1416
1052
  if (!i4?.pack) continue;
1417
- const { icons: r3 } = i4.pack, s3 = r3[e2.get(n4)?.get(o3) ?? o3] ?? r3[o3];
1053
+ const { icons: r3 } = i4.pack, s3 = r3[t2.get(n4)?.get(o3) ?? o3] ?? r3[o3];
1418
1054
  if (s3) return { glyph: s3, pack: i4.pack, packKey: n4 };
1419
1055
  }
1420
1056
  return null;
1421
1057
  }
1422
- function l2(e3, o3) {
1058
+ function l2(t3, o3) {
1423
1059
  const i3 = o3?.packKey ?? n2;
1424
- if (o3?.packKey) return s2(o3.packKey, e3);
1425
- if (!e3) return null;
1426
- const { ns: l3, key: a2 } = r2(e3);
1060
+ if (o3?.packKey) return s2(o3.packKey, t3);
1061
+ if (!t3) return null;
1062
+ const { ns: l3, key: a2 } = r2(t3);
1427
1063
  if (l3) {
1428
- const e4 = t2.get(l3)?.pack;
1429
- if (e4) {
1430
- if (!!t2.get(n2)?.pack) {
1431
- const t3 = e4.__overrides, o5 = t3?.[n2]?.[a2];
1432
- if (o5) return { glyph: o5, pack: e4, packKey: l3 };
1064
+ const t4 = e2.get(l3)?.pack;
1065
+ if (t4) {
1066
+ if (!!e2.get(n2)?.pack) {
1067
+ const e3 = t4.__overrides, o5 = e3?.[n2]?.[a2];
1068
+ if (o5) return { glyph: o5, pack: t4, packKey: l3 };
1433
1069
  }
1434
1070
  const o4 = s2(l3, a2);
1435
1071
  if (o4) return o4;
1436
1072
  }
1437
1073
  return null;
1438
1074
  }
1439
- return s2(i3, e3);
1440
- }
1441
- return { register: function(e3, o3) {
1442
- const i3 = t2.get(e3) ?? {};
1443
- "function" == typeof o3 ? i3.loader = o3 : i3.pack = Ve(o3), t2.set(e3, i3), n2 || (n2 = e3);
1444
- }, prefetch: async function(t3 = n2) {
1445
- const e3 = Array.isArray(t3) ? t3 : [t3];
1446
- await Promise.all(e3.map(i2));
1447
- }, setActive: function(t3) {
1448
- n2 = t3;
1449
- for (const e3 of o2.keys()) try {
1450
- e3(t3);
1451
- } catch (t4) {
1075
+ return s2(i3, t3);
1076
+ }
1077
+ return { register: function(t3, o3) {
1078
+ const i3 = e2.get(t3) ?? {};
1079
+ "function" == typeof o3 ? i3.loader = o3 : i3.pack = at(o3), e2.set(t3, i3), n2 || (n2 = t3);
1080
+ }, prefetch: async function(e3 = n2) {
1081
+ const t3 = Array.isArray(e3) ? e3 : [e3];
1082
+ await Promise.all(t3.map(i2));
1083
+ }, setActive: function(e3) {
1084
+ n2 = e3;
1085
+ for (const t3 of o2.keys()) try {
1086
+ t3(e3);
1087
+ } catch (e4) {
1452
1088
  }
1453
1089
  }, getActive: function() {
1454
1090
  return n2;
1455
- }, resolve: async function(e3, o3) {
1456
- let s3 = l2(e3, o3);
1091
+ }, resolve: async function(t3, o3) {
1092
+ let s3 = l2(t3, o3);
1457
1093
  if (s3) return s3;
1458
- const a2 = o3?.packKey ?? n2, { ns: c2 } = r2(e3);
1094
+ const a2 = o3?.packKey ?? n2, { ns: c2 } = r2(t3);
1459
1095
  if (o3?.packKey) {
1460
- if (await i2(a2), s3 = l2(e3, o3), s3) return s3;
1461
- const n3 = t2.get(a2)?.pack?.meta?.extends ?? [];
1462
- if (n3.length && (await Promise.all(n3.map(i2)), s3 = l2(e3, o3), s3)) return s3;
1096
+ if (await i2(a2), s3 = l2(t3, o3), s3) return s3;
1097
+ const n3 = e2.get(a2)?.pack?.meta?.extends ?? [];
1098
+ if (n3.length && (await Promise.all(n3.map(i2)), s3 = l2(t3, o3), s3)) return s3;
1463
1099
  } else if (c2) {
1464
- if (await i2(c2), s3 = l2(e3, o3), s3) return s3;
1465
- const n3 = t2.get(c2)?.pack?.meta?.extends ?? [];
1466
- if (n3.length && (await Promise.all(n3.map(i2)), s3 = l2(e3, o3), s3)) return s3;
1100
+ if (await i2(c2), s3 = l2(t3, o3), s3) return s3;
1101
+ const n3 = e2.get(c2)?.pack?.meta?.extends ?? [];
1102
+ if (n3.length && (await Promise.all(n3.map(i2)), s3 = l2(t3, o3), s3)) return s3;
1467
1103
  } else {
1468
- if (await i2(a2), s3 = l2(e3, o3), s3) return s3;
1469
- const n3 = t2.get(a2)?.pack?.meta?.extends ?? [];
1470
- if (n3.length && (await Promise.all(n3.map(i2)), s3 = l2(e3, o3), s3)) return s3;
1104
+ if (await i2(a2), s3 = l2(t3, o3), s3) return s3;
1105
+ const n3 = e2.get(a2)?.pack?.meta?.extends ?? [];
1106
+ if (n3.length && (await Promise.all(n3.map(i2)), s3 = l2(t3, o3), s3)) return s3;
1471
1107
  }
1472
1108
  return null;
1473
- }, registerAlias: function(t3, n3, o3) {
1474
- e2.has(t3) || e2.set(t3, /* @__PURE__ */ new Map()), e2.get(t3).set(n3, o3);
1475
- }, has: function(t3, e3) {
1476
- return !!l2(t3, e3);
1477
- }, getPack: function(e3) {
1478
- return t2.get(e3 ?? n2)?.pack;
1479
- }, hasPack: function(e3) {
1480
- return !!t2.get(e3)?.pack;
1109
+ }, registerAlias: function(e3, n3, o3) {
1110
+ t2.has(e3) || t2.set(e3, /* @__PURE__ */ new Map()), t2.get(e3).set(n3, o3);
1111
+ }, has: function(e3, t3) {
1112
+ return !!l2(e3, t3);
1113
+ }, getPack: function(t3) {
1114
+ return e2.get(t3 ?? n2)?.pack;
1115
+ }, hasPack: function(t3) {
1116
+ return !!e2.get(t3)?.pack;
1481
1117
  }, listPacks: function() {
1482
- return Array.from(t2.keys());
1483
- }, listIcons: function(e3) {
1484
- const n3 = t2.get(e3)?.pack;
1118
+ return Array.from(e2.keys());
1119
+ }, listIcons: function(t3) {
1120
+ const n3 = e2.get(t3)?.pack;
1485
1121
  return n3 ? Object.keys(n3.icons) : [];
1486
- }, addActiveListener: function(t3) {
1487
- const e3 = o2.get(t3);
1488
- if (e3) return e3;
1122
+ }, addActiveListener: function(e3) {
1123
+ const t3 = o2.get(e3);
1124
+ if (t3) return t3;
1489
1125
  const n3 = () => {
1490
- o2.delete(t3);
1126
+ o2.delete(e3);
1491
1127
  };
1492
- return o2.set(t3, n3), n3;
1128
+ return o2.set(e3, n3), n3;
1493
1129
  } };
1494
1130
  }
1495
- Ke.displayName = "SplitPane";
1496
- const Fe = Ie();
1497
- Fe.register("base", () => import("./i36M1qE9kUNw0xW3.mjs"));
1498
- const je = (e2) => t("svg", { ...e2, children: t("path", {}) }), Xe = { Icon: "_Icon_1ld90_10" }, Ye = _((e2) => {
1499
- const { iconKey: n2, packKey: i2, className: r2, style: s2, role: l2, title: a2, size: c2, ariaHidden: h2, sourceProps: u2, children: d2, ...f2 } = e2, [_2, m2] = o.useState(null);
1500
- o.useEffect(() => {
1501
- let t2 = true, e3 = i2, o2 = n2;
1502
- if (!o2) {
1503
- const t3 = Fe.getPack(e3);
1504
- return void m2({ glyph: t3 ? { svg: L.EmptyArray } : void 0, pack: t3 ?? void 0, packKey: e3 ?? Fe.getActive() });
1131
+ ot.displayName = "SplitPane";
1132
+ const ht = ct();
1133
+ ht.register("base", () => import("./BUbqNRja31CtMjD9.mjs"));
1134
+ const ut = (e2) => x("svg", { ...e2, children: x("path", {}) }), dt = { Icon: "_Icon_1ld90_10" }, pt = p((t2) => {
1135
+ const { iconKey: n2, packKey: o2, className: i2, style: r2, role: s2, title: a2, size: c2, ariaHidden: u2, sourceProps: d2, children: p2, ...f2 } = t2, [m2, _2] = l.useState(null);
1136
+ l.useEffect(() => {
1137
+ let t3 = true, i3 = o2, r3 = n2;
1138
+ if (!r3) {
1139
+ const t4 = ht.getPack(i3);
1140
+ return void _2({ glyph: t4 ? { svg: e.EmptyArray } : void 0, pack: t4 ?? void 0, packKey: i3 ?? ht.getActive() });
1505
1141
  }
1506
- if (o2.includes(":")) {
1507
- const [t3, n3] = o2.split(":");
1508
- e3 = t3, o2 = n3;
1142
+ if (r3.includes(":")) {
1143
+ const [e2, t4] = r3.split(":");
1144
+ i3 = e2, r3 = t4;
1509
1145
  }
1510
- return Fe.resolve(o2, { packKey: e3 }).then((e4) => {
1511
- t2 && m2(e4);
1146
+ return ht.resolve(r3, { packKey: i3 }).then((e2) => {
1147
+ t3 && _2(e2);
1512
1148
  }), () => {
1513
- t2 = false;
1149
+ t3 = false;
1514
1150
  };
1515
- }, [n2, i2]);
1516
- const g2 = _2?.pack, y2 = _2?.glyph, v2 = _2?.packKey;
1151
+ }, [n2, o2]);
1152
+ const g2 = m2?.pack, y2 = m2?.glyph, v2 = m2?.packKey;
1517
1153
  let w2 = y2 ? y2.svg : void 0;
1518
- const x2 = y2 && !w2 ? y2.url : void 0, b2 = !y2 || w2 || x2 ? void 0 : y2.emoji, S2 = null != c2 ? "number" == typeof c2 ? `${c2}px` : c2 : void 0, E2 = p(() => [Xe.Icon, "icon", r2].filter(Boolean).join(" "), [r2]), M2 = p(() => {
1519
- const t2 = { ...s2 };
1520
- return t2["--icon-size"] = S2, t2;
1521
- }, [s2, S2]), T2 = l2 ?? (a2 ? "img" : "presentation"), C2 = h2 ?? (!a2 || void 0), k2 = (e3) => t("span", { className: E2, style: M2, role: T2, "aria-hidden": C2, title: a2, "data-icon-glyph": n2, "data-icon-pack": v2, ...f2, children: e3 });
1522
- if (d2) return k2(d2);
1523
- if (b2) return k2(t("span", { children: "string" == typeof b2 ? b2 : b2.text }));
1524
- if (x2) return k2(t("img", { src: x2.src, alt: a2 ?? "" }));
1154
+ const b2 = y2 && !w2 ? y2.url : void 0, S2 = !y2 || w2 || b2 ? void 0 : y2.emoji, E2 = null != c2 ? "number" == typeof c2 ? `${c2}px` : c2 : void 0, L2 = h(() => [dt.Icon, "icon", i2].filter(Boolean).join(" "), [i2]), M2 = h(() => {
1155
+ const e2 = { ...r2 };
1156
+ return e2["--icon-size"] = E2, e2;
1157
+ }, [r2, E2]), T2 = s2 ?? (a2 ? "img" : "presentation"), k2 = u2 ?? (!a2 || void 0), C2 = (e2) => x("span", { className: L2, style: M2, role: T2, "aria-hidden": k2, title: a2, "data-icon-glyph": n2, "data-icon-pack": v2, ...f2, children: e2 });
1158
+ if (p2) return C2(p2);
1159
+ if (S2) return C2(x("span", { children: "string" == typeof S2 ? S2 : S2.text }));
1160
+ if (b2) return C2(x("img", { src: b2.src, alt: a2 ?? "" }));
1525
1161
  if (y2 && "react" in y2) {
1526
- const e3 = y2.react, n3 = { className: E2, style: M2, role: T2, "aria-hidden": C2, title: a2, ...f2, ...u2 };
1527
- return k2(t(e3, { ...n3 }));
1162
+ const e2 = y2.react, t3 = { className: L2, style: M2, role: T2, "aria-hidden": k2, title: a2, ...f2, ...d2 };
1163
+ return C2(x(e2, { ...t3 }));
1528
1164
  }
1529
1165
  const D2 = { viewBox: w2?.viewBox ?? g2?.meta.defaultViewBox ?? "0 0 24 24" };
1530
1166
  if ("function" == typeof w2) {
1531
- return k2(w2(D2) ?? t(je, { ...D2 }));
1167
+ return C2(w2(D2) ?? x(ut, { ...D2 }));
1532
1168
  }
1533
- if (!w2) return k2(t(je, { ...D2 }));
1169
+ if (!w2) return C2(x(ut, { ...D2 }));
1534
1170
  const P2 = w2.paths;
1535
- return k2(t("svg", { ...D2, children: P2 ? P2.map((e3, n3) => t("path", { d: e3.d, className: e3.className, fill: e3.fill, stroke: e3.stroke, opacity: e3.opacity, fillRule: e3.fillRule, clipRule: e3.clipRule }, n3)) : null }));
1171
+ return C2(x("svg", { ...D2, children: P2 ? P2.map((e2, t3) => x("path", { d: e2.d, className: e2.className, fill: e2.fill, stroke: e2.stroke, opacity: e2.opacity, fillRule: e2.fillRule, clipRule: e2.clipRule }, t3)) : null }));
1536
1172
  });
1537
- function Ue(e2) {
1538
- const { isWalking: n2 = false, themedType: o2 = "info", speed: i2 = 120, dashGap: r2 = 3, dashLength: s2 = 5, iconKey: l2, packKey: a2, style: c2, className: h2, ...u2 } = e2, d2 = p(() => {
1539
- if (!n2) return;
1540
- const t2 = { "--walk-duration": `${i2 * (r2 + s2)}ms`, "--walk-dash-length": `${s2}px`, "--walk-dash-gap": `${r2}px` };
1541
- return o2 && "accent" !== o2 && (t2["--icon-accent"] = `var(--icon-${o2})`), t2;
1542
- }, [n2, i2, r2, s2, o2]), f2 = p(() => n2 ? h2 + " walking" : h2, [n2, h2]);
1543
- return t(Ye, { iconKey: l2, packKey: a2, className: f2, style: { ...c2, ...d2 }, ...u2 });
1173
+ function ft(e2) {
1174
+ const { isWalking: t2 = false, themedType: n2 = "info", speed: o2 = 120, dashGap: i2 = 3, dashLength: r2 = 5, iconKey: s2, packKey: l2, style: a2, className: c2, ...u2 } = e2, d2 = h(() => {
1175
+ if (!t2) return;
1176
+ const e3 = { "--walk-duration": `${o2 * (i2 + r2)}ms`, "--walk-dash-length": `${r2}px`, "--walk-dash-gap": `${i2}px` };
1177
+ return n2 && "accent" !== n2 && (e3["--icon-accent"] = `var(--icon-${n2})`), e3;
1178
+ }, [t2, o2, i2, r2, n2]), p2 = h(() => t2 ? c2 + " walking" : c2, [t2, c2]);
1179
+ return x(pt, { iconKey: s2, packKey: l2, className: p2, style: { ...a2, ...d2 }, ...u2 });
1180
+ }
1181
+ class mt {
1182
+ constructor() {
1183
+ this.store = /* @__PURE__ */ new Map();
1184
+ }
1185
+ async getItem(e2) {
1186
+ return this.store.get(e2) ?? null;
1187
+ }
1188
+ async setItem(e2, t2) {
1189
+ this.store.set(e2, t2);
1190
+ }
1191
+ async removeItem(e2) {
1192
+ this.store.delete(e2);
1193
+ }
1194
+ }
1195
+ const _t = _(null), gt = { parse: (e2) => e2 ? JSON.parse(e2) : null, stringify: JSON.stringify }, yt = { store: new mt(), namespace: "", serializer: gt, debounceMs: 0, crossTabSync: false, notify: () => {
1196
+ }, subscribeKey: () => () => {
1197
+ } };
1198
+ function vt(e2, t2, n2 = wt) {
1199
+ const { store: o2, namespace: i2, serializer: r2, debounceMs: s2, subscribeKey: l2 } = g(_t) || yt, c2 = n2.serializer ?? r2 ?? gt, p2 = h(() => `${i2}:${e2}`, [i2, e2]), f2 = a(null), m2 = `${p2}::v`, [_2, y2] = d(() => {
1200
+ let e3;
1201
+ try {
1202
+ if ("undefined" != typeof window && "localStorage" in window && p2.startsWith(i2)) {
1203
+ const t3 = window.localStorage?.getItem(p2) ?? null;
1204
+ null != t3 && (e3 = c2.parse(t3));
1205
+ }
1206
+ } catch {
1207
+ }
1208
+ if (void 0 === e3) {
1209
+ const e4 = t2;
1210
+ return "function" == typeof e4 ? e4() : e4;
1211
+ }
1212
+ return e3;
1213
+ });
1214
+ u(() => {
1215
+ let e3 = true;
1216
+ return (async () => {
1217
+ const [i3, r3] = await Promise.all([o2.getItem(p2), o2.getItem(m2)]);
1218
+ let s3;
1219
+ try {
1220
+ s3 = null == i3 ? void 0 : c2.parse(i3);
1221
+ } catch {
1222
+ }
1223
+ const l3 = null == r3 ? void 0 : Number.parseInt(r3, 10);
1224
+ if (void 0 === s3) {
1225
+ if (!n2.lazy && void 0 !== t2) {
1226
+ s3 = "function" == typeof t2 ? t2() : t2, await o2.setItem(p2, c2.stringify(s3)), null != n2.version && await o2.setItem(m2, String(n2.version));
1227
+ }
1228
+ } else if (null != n2.version && void 0 !== l3 && l3 !== n2.version && n2.migrate) {
1229
+ s3 = n2.migrate(s3, l3), await o2.setItem(p2, c2.stringify(s3)), await o2.setItem(m2, String(n2.version));
1230
+ }
1231
+ e3 && void 0 !== s3 && y2(s3);
1232
+ })(), () => {
1233
+ e3 = false;
1234
+ };
1235
+ }, [o2, p2, m2, n2.version, n2.migrate, n2.lazy]), u(() => l2(e2, async () => {
1236
+ const e3 = await o2.getItem(p2);
1237
+ if (null != e3) try {
1238
+ y2(c2.parse(e3));
1239
+ } catch {
1240
+ }
1241
+ }), [o2, p2, l2, e2]);
1242
+ const v2 = async (e3) => {
1243
+ await o2.setItem(p2, c2.stringify(e3)), null != n2.version && await o2.setItem(m2, String(n2.version));
1244
+ };
1245
+ return [_2, (e3) => {
1246
+ y2((t3) => {
1247
+ const n3 = "function" == typeof e3 ? e3(t3) : e3;
1248
+ return f2.current && clearTimeout(f2.current), s2 > 0 ? f2.current = setTimeout(() => {
1249
+ v2(n3);
1250
+ }, s2) : v2(n3), n3;
1251
+ });
1252
+ }, () => {
1253
+ if (f2.current && clearTimeout(f2.current), o2.removeItem(p2), o2.removeItem(m2), void 0 !== t2) {
1254
+ const e3 = "function" == typeof t2 ? t2() : t2;
1255
+ y2(e3);
1256
+ } else y2(void 0);
1257
+ }];
1258
+ }
1259
+ const wt = {};
1260
+ function bt(e2) {
1261
+ const { store: t2, namespace: n2 = "", serializer: o2 = xt, debounceMs: i2 = 0, crossTabSync: r2 = true, children: s2 } = e2, l2 = h(() => "undefined" == typeof window ? new mt() : t2 ?? new mt(), [t2]), c2 = a(/* @__PURE__ */ new Map()), d2 = h(() => ({ store: l2, namespace: n2, serializer: o2, debounceMs: i2, crossTabSync: r2, notify(e3) {
1262
+ const t3 = c2.current.get(e3);
1263
+ t3 && t3.forEach((e4) => e4());
1264
+ }, subscribeKey(e3, t3) {
1265
+ const n3 = c2.current, o3 = n3.get(e3) ?? /* @__PURE__ */ new Set();
1266
+ return o3.add(t3), n3.set(e3, o3), () => {
1267
+ const o4 = n3.get(e3);
1268
+ o4 && (o4.delete(t3), 0 === o4.size && n3.delete(e3));
1269
+ };
1270
+ } }), [l2, n2, o2, i2, r2]);
1271
+ return u(() => {
1272
+ if (d2.crossTabSync && d2.store.subscribe) return d2.store.subscribe((e3) => {
1273
+ if (!e3.startsWith(d2.namespace + ":")) return;
1274
+ const t3 = e3.slice(d2.namespace.length + 1);
1275
+ d2.notify(t3);
1276
+ });
1277
+ }, [d2]), x(_t.Provider, { value: d2, children: s2 });
1278
+ }
1279
+ const xt = { parse: (e2) => null == e2 ? null : JSON.parse(e2), stringify: JSON.stringify };
1280
+ class St {
1281
+ constructor(e2 = window.localStorage) {
1282
+ this.storage = e2;
1283
+ }
1284
+ async getItem(e2) {
1285
+ try {
1286
+ return this.storage.getItem(e2);
1287
+ } catch {
1288
+ return null;
1289
+ }
1290
+ }
1291
+ async setItem(e2, t2) {
1292
+ try {
1293
+ this.storage.setItem(e2, t2);
1294
+ } catch {
1295
+ }
1296
+ }
1297
+ async removeItem(e2) {
1298
+ try {
1299
+ this.storage.removeItem(e2);
1300
+ } catch {
1301
+ }
1302
+ }
1303
+ subscribe(e2) {
1304
+ const t2 = (t3) => {
1305
+ t3.storageArea === this.storage && t3.key && e2(t3.key);
1306
+ };
1307
+ return window.addEventListener("storage", t2), () => window.removeEventListener("storage", t2);
1308
+ }
1544
1309
  }
1310
+ const Et = { Horizontal: "horizontal", Vertical: "vertical" }, Lt = "_scrollbar_1v478_17", Mt = "_vsb-track_1v478_27", Tt = "_vsb-thumb_1v478_39", kt = "_scrollbar-button_1v478_80", Ct = "M 5.4951012,0.62494002 7.1746358,3.4734472 8.8557603,6.3226744 c 0.13425,0.2277477 0.18228,0.4945506 0.1356,0.7535218 -0.04665,0.2589712 -0.18504,0.4935661 -0.3908099,0.6625402 C 8.3948254,7.9076371 8.1348905,8.0001761 7.8664506,7.9999997 H 1.1503225 c -0.30278993,0 -0.59312985,-0.117841 -0.80720983,-0.3275159 -0.2140799,-0.2097042 -0.3343649,-0.4941244 -0.3343649,-0.7907107 -4.5e-4,-0.1955399 0.05205,-0.3876855 0.152205,-0.55688 L 1.8390472,3.4734031 3.5178618,0.62488125 C 3.7217717,0.27898385 4.0986166,0.0658413 4.5064365,0.0658413 c 0.4078199,0 0.7846648,0.21314255 0.9885747,0.55903995 z", Dt = "M 0.6632643,3.5136438 3.5117715,1.8341092 6.3609987,0.15298466 c 0.2277477,-0.13425 0.4945506,-0.18228 0.7535218,-0.1356 0.2589712,0.04665 0.4935661,0.18504 0.6625402,0.3908099 0.1689007,0.205725 0.2614397,0.4656599 0.2612633,0.73409984 v 6.7161281 c 0,0.3027899 -0.117841,0.5931298 -0.3275159,0.8072098 -0.2097042,0.2140799 -0.4941244,0.3343649 -0.7907107,0.3343649 -0.1955399,4.5e-4 -0.3876855,-0.05205 -0.55688,-0.152205 L 3.5117274,7.1696978 0.6632056,5.4908832 C 0.31730817,5.2869733 0.10416562,4.9101284 0.10416562,4.5023085 c 0,-0.4078199 0.21314255,-0.7846648 0.55903998,-0.9885747 z", Pt = { transform: "rotate(180deg)" }, At = (e2) => {
1311
+ const { style: t2, orientation: n2 = Et.Vertical, disabled: o2, ...i2 } = e2, r2 = n2 === Et.Vertical ? Ct : Dt;
1312
+ return x("button", { style: t2, className: T(kt, n2, "scroll-button"), disabled: o2, ...i2, children: x("svg", { width: "9", height: "9", viewBox: "0 0 9 9", children: x("path", { d: r2 }) }) });
1313
+ }, zt = (e2) => {
1314
+ const { style: t2, orientation: n2 = Et.Vertical, disabled: o2, ...i2 } = e2, r2 = n2 === Et.Vertical ? Ct : Dt;
1315
+ return x("button", { style: t2, className: T(kt, n2, "scroll-button"), disabled: o2, ...i2, children: x("svg", { width: "9", height: "9", viewBox: "0 0 9 9", style: Pt, children: x("path", { d: r2 }) }) });
1316
+ }, Bt = (e2) => {
1317
+ const { style: t2, orientation: n2 = Et.Vertical, ...o2 } = e2, i2 = n2 === Et.Vertical;
1318
+ return x("div", { style: { display: "flex", justifyContent: "center", alignItems: "end", transition: "fill-opacity 1s", zIndex: 1, width: "24px", height: "24px", ...t2 }, className: `scrollbar-button ${i2 ? "vertical" : "horizontal"} edge`, ...o2, children: x("svg", { width: "24", height: "24", viewBox: "0 0 24 24", transform: i2 ? "rotate(90) " : "", children: x("path", { style: { transition: "opacity 240ms ease 0s", opacity: e2.disabled ? 0 : 1 }, d: "M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2" }) }) });
1319
+ };
1320
+ let $t = 0;
1321
+ function Kt() {
1322
+ const [e2, t2] = d(!!document.fullscreenElement), n2 = m(() => {
1323
+ const e3 = document.fullscreenElement;
1324
+ return e3 ? e3.querySelector(".fullscreen-portal-root") || e3 : document.body;
1325
+ }, []);
1326
+ return u(() => {
1327
+ function e3() {
1328
+ const e4 = document.fullscreenElement;
1329
+ if (t2(!!e4), !e4) return;
1330
+ let n3 = e4.querySelector(".fullscreen-portal-root");
1331
+ n3 || (n3 = document.createElement("div"), n3.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", e4.appendChild(n3));
1332
+ }
1333
+ return $t++, e3(), document.addEventListener("fullscreenchange", e3), () => {
1334
+ document.removeEventListener("fullscreenchange", e3), $t--, $t <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((e4) => {
1335
+ e4.parentNode && e4.parentNode.removeChild(e4);
1336
+ }), $t = 0);
1337
+ };
1338
+ }, []), { getPortalContainer: n2, isFullscreen: e2 };
1339
+ }
1340
+ const Ot = 24, It = p(f((e2, t2) => {
1341
+ const { offset: n2 = 0, totalSize: o2 = 0, viewportSize: i2 = 0, style: r2, className: s2, orientation: l2 = Et.Vertical, onScrollOffset: c2, onScroll: p2, showCustomScrollButtons: f2 = true, scrollButtonIncrement: _2 = 200, scrollButtonInitialRepeatDelay: g2 = 260, scrollButtonAdditionalRepeatDelay: y2 = 120, minThumbSize: v2 = Ot, maxThumbSize: w2, createScrollStartButton: b2 = At, createScrollEndButton: E2 = zt, usePortal: k2 = false, ...C2 } = e2;
1342
+ ce(p2, [p2]);
1343
+ const [P2, A2] = d({ offset: 0, length: 0 }), z2 = a(-1), B2 = l2 === Et.Vertical, [$2, { width: K2, height: O2 }] = M(), I2 = B2 ? O2 : K2, N2 = ce((e3, t3, n3) => {
1344
+ if (0 === t3 || 0 === n3) return void A2({ offset: 0, length: v2 });
1345
+ const o3 = n3 / I2, i3 = t3 / o3, r3 = Math.min(Math.max(v2, i3), Math.min(I2, w2 ?? Number.MAX_SAFE_INTEGER)), s3 = e3 / o3;
1346
+ return { offset: Math.min(Math.max(0, s3), I2 - r3), length: r3 };
1347
+ }, [I2, v2, w2]), H2 = ce((e3) => {
1348
+ const t3 = o2 / I2, n3 = Math.round(e3 * t3);
1349
+ A2(N2(n3, i2, o2)), c2?.(n3, i2, o2), z2.current = e3;
1350
+ }, [c2, i2, o2, I2, P2]), R2 = ce((e3) => {
1351
+ A2(N2(e3, i2, o2)), c2?.(e3, i2, o2), z2.current = e3;
1352
+ }, [c2, i2, o2]);
1353
+ u(() => {
1354
+ z2.current !== n2 && 0 !== I2 && (z2.current = -1, A2(N2(n2, i2, o2)));
1355
+ }, [n2]), u(() => {
1356
+ 0 !== I2 && A2(N2(n2, i2, o2));
1357
+ }, [i2, o2, B2, I2]);
1358
+ const W2 = Math.max(0, o2 - i2), [V2, F2] = d(false), j2 = a(0), X2 = a(0), Y2 = Re(t2, () => ({ isScrollbar: () => true }), []), U2 = ce((e3) => {
1359
+ e3.currentTarget.setPointerCapture(e3.pointerId), F2(true), j2.current = B2 ? e3.clientY : e3.clientX, X2.current = P2.offset, e3.preventDefault(), e3.stopPropagation();
1360
+ }, [B2, P2]), G2 = ce((e3) => {
1361
+ if (!V2) return;
1362
+ const t3 = (B2 ? e3.clientY : e3.clientX) - j2.current, n3 = X2.current + t3;
1363
+ H2(n3);
1364
+ }, [V2, B2]), Z2 = ce((e3) => {
1365
+ try {
1366
+ e3.currentTarget.releasePointerCapture(e3.pointerId);
1367
+ } catch {
1368
+ }
1369
+ F2(false);
1370
+ }, []), q2 = ce((e3) => {
1371
+ if (!e3.currentTarget) return;
1372
+ const t3 = e3.currentTarget.getBoundingClientRect(), n3 = B2 ? e3.clientY - t3.top : e3.clientX - t3.left;
1373
+ H2(n3);
1374
+ }, [B2, P2, i2, o2]), J2 = ce((e3) => {
1375
+ const t3 = Math.max(1, Math.floor(0.9 * i2));
1376
+ B2 ? ("ArrowDown" === e3.key && H2(Math.min(W2, n2 + 1)), "ArrowUp" === e3.key && H2(Math.max(0, n2 - 1)), "PageDown" === e3.key && H2(Math.min(W2, n2 + t3)), "PageUp" === e3.key && H2(Math.max(0, n2 - t3)), "Home" === e3.key && H2(0), "End" === e3.key && H2(W2)) : ("ArrowRight" === e3.key && H2(Math.min(W2, n2 + 1)), "ArrowLeft" === e3.key && H2(Math.max(0, n2 - 1)), "PageDown" === e3.key && H2(Math.min(W2, n2 + t3)), "PageUp" === e3.key && H2(Math.max(0, n2 - t3)), "Home" === e3.key && H2(0), "End" === e3.key && H2(W2));
1377
+ }, [B2, i2, o2, n2, W2]), Q2 = a(null), ee2 = h(() => x("div", { className: T(Tt), ref: Q2, role: "slider", "aria-label": B2 ? "Rows" : "Columns", "aria-orientation": B2 ? "vertical" : "horizontal", "aria-valuemin": 0, "aria-valuemax": W2, "aria-valuenow": n2, tabIndex: 0, style: { position: k2 ? "fixed" : "relative", [B2 ? "height" : "width"]: `${P2.length}px`, [B2 ? "width" : "height"]: "100%", transform: B2 ? `translateY(${P2.offset}px)` : `translateX(${P2.offset}px)`, [B2 ? "minHeight" : "minWidth"]: `${v2}px` }, onPointerDown: U2, onPointerMove: G2, onPointerUp: Z2 }), [P2, v2, W2, n2, B2, false]), [te2, ne2] = d(null), oe2 = ce(() => {
1378
+ let e3;
1379
+ e3 = "function" == typeof _2 ? _2(n2, i2, o2) : n2 - _2;
1380
+ const t3 = Math.max(0, e3);
1381
+ return R2(t3), ne2(t3), t3;
1382
+ }, [_2, n2, i2, o2]), ie2 = ce(() => {
1383
+ let e3;
1384
+ e3 = "function" == typeof _2 ? _2(n2, i2, o2) : n2 + _2;
1385
+ const t3 = Math.min(W2, e3);
1386
+ return R2(t3), ne2(t3), t3;
1387
+ }, [_2, n2, W2, i2, o2]), re2 = a(null), se2 = a(null), le2 = m(() => {
1388
+ re2.current && (clearTimeout(re2.current), re2.current = null, se2.current = null);
1389
+ }, []), ae2 = m((e3, t3, n3, o3 = g2) => {
1390
+ se2.current = e3, re2.current = setTimeout(() => {
1391
+ const e4 = n3 ? oe2() : ie2();
1392
+ e4 !== se2.current ? ae2(e4, false, n3, y2) : le2();
1393
+ }, t3 ? 0 : o3);
1394
+ }, [oe2, ie2, le2]);
1395
+ u(() => () => le2(), [le2]);
1396
+ const he2 = h(() => {
1397
+ if (!f2) return null;
1398
+ const e3 = { orientation: l2, disabled: n2 <= 0, onMouseUp: le2, onMouseLeave: le2, onMouseDown: () => ae2(n2, true, true) };
1399
+ return b2?.(e3);
1400
+ }, [f2, l2, n2, te2]), ue2 = h(() => {
1401
+ if (!f2) return null;
1402
+ const e3 = { orientation: l2, disabled: n2 >= W2, onMouseUp: le2, onMouseLeave: le2, onMouseDown: () => ae2(n2, true, false) };
1403
+ return E2?.(e3);
1404
+ }, [f2, l2, n2, W2, te2]), de2 = B2 ? "vertical" : "horizontal";
1405
+ return S("div", { ref: L([Y2, t2]), className: T(s2, Lt, de2, { dragging: V2 }), style: r2, ...C2, children: [he2, x("div", { ref: $2, role: "scrollbar", "aria-orientation": de2, "aria-valuemin": 0, "aria-valuemax": W2, "aria-valuenow": n2, tabIndex: 0, className: T(Mt, "track", de2), onPointerDown: q2, onKeyDown: J2, children: k2 ? null : ee2 }), k2 ? D(ee2, document.body) : null, ue2] });
1406
+ }));
1407
+ let Nt = Date.now, Ht = 1e3, Rt = {}, Wt = 1;
1408
+ const Vt = (e2) => {
1409
+ let t2 = null !== Rt[e2];
1410
+ return t2 && (Rt[e2] = null), t2;
1411
+ }, Ft = (e2, t2, n2, o2 = 0, i2) => {
1412
+ let r2 = Nt(), s2 = r2, l2 = 0, a2 = 0, c2 = 0, h2 = Wt++;
1413
+ if (h2 % 20 == 0) {
1414
+ const e3 = {};
1415
+ for (let t3 in Rt) e3[t3] = true;
1416
+ Rt = e3;
1417
+ }
1418
+ const u2 = function(d2) {
1419
+ let p2 = true !== d2, f2 = Nt(), m2 = true;
1420
+ try {
1421
+ m2 = (!t2 || t2(h2)) ?? true;
1422
+ } catch (e3) {
1423
+ m2 = false;
1424
+ }
1425
+ if (!Rt[h2] || !m2) return Rt[h2] = null, void n2?.(60 - a2 / ((f2 - r2) / Ht), h2, false);
1426
+ if (p2) {
1427
+ c2 = Math.round((f2 - s2) / 16.666666666666668) - 1;
1428
+ for (let e3 = 0; e3 < Math.min(c2, 4); e3++) u2(true), a2++;
1429
+ }
1430
+ o2 && (l2 = (f2 - r2) / o2, l2 > 1 && (l2 = 1));
1431
+ let _2 = i2 ? i2(l2) : l2, g2 = false;
1432
+ try {
1433
+ g2 = e2(_2, f2, p2);
1434
+ } catch (e3) {
1435
+ g2 = false;
1436
+ }
1437
+ false !== g2 && 1 !== l2 || !p2 ? p2 && (s2 = f2, requestAnimationFrame(u2)) : (Rt[h2] = null, n2?.(60 - a2 / ((f2 - r2) / Ht), h2, 1 === l2 || null == o2));
1438
+ };
1439
+ return Rt[h2] = true, requestAnimationFrame(u2), h2;
1440
+ }, jt = function(e2) {
1441
+ return Math.pow(e2 - 1, 3) + 1;
1442
+ }, Xt = function(e2) {
1443
+ return (e2 /= 0.5) < 1 ? 0.5 * Math.pow(e2, 3) : 0.5 * (Math.pow(e2 - 2, 3) + 2);
1444
+ };
1445
+ class Yt {
1446
+ constructor(e2, t2) {
1447
+ this.__isSingleTouch = false, this.__isTracking = false, this.__didDecelerationComplete = false, this.__isGesturing = false, this.__isDragging = false, this.__isDecelerating = 0, this.__isAnimating = 0, this.__interruptedAnimation = false, this.__lastScale = 1, this.__enableScrollX = true, this.__enableScrollY = true, this.__clientLeft = 0, this.__clientTop = 0, this.__clientWidth = 0, this.__clientHeight = 0, this.__contentWidth = 0, this.__contentHeight = 0, this.__snapWidth = 100, this.__snapHeight = 100, this.__zoomLevel = 1, this.__scrollLeft = 0, this.__scrollTop = 0, this.__maxScrollLeft = 0, this.__maxScrollTop = 0, this.__scheduledLeft = 0, this.__scheduledTop = 0, this.__scheduledZoom = 0, this.__lastTouchLeft = 0, this.__lastTouchTop = 0, this.__lastTouchMove = 0, this.__positions = [], this.__initialTouchLeft = 0, this.__initialTouchTop = 0, this.__zoomLevelStart = 1, this.__minDecelerationScrollLeft = null, this.__minDecelerationScrollTop = null, this.__maxDecelerationScrollLeft = null, this.__maxDecelerationScrollTop = null, this.__decelerationVelocityX = null, this.__decelerationVelocityY = 0, this.__callback = e2, this.options = { scrollingX: true, scrollingY: true, animating: true, animationDuration: 250, bouncing: true, locking: true, paging: false, snapping: false, zooming: false, minZoom: 0.5, maxZoom: 3, speedMultiplier: 1, scrollingComplete: void 0, penetrationDeceleration: 0.03, penetrationAcceleration: 0.08, ...t2 };
1448
+ }
1449
+ setDimensions(e2, t2, n2, o2) {
1450
+ null !== e2 && (this.__clientWidth = e2), null !== t2 && (this.__clientHeight = t2), null !== n2 && (this.__contentWidth = n2), null !== o2 && (this.__contentHeight = o2), this.__computeScrollMax(), this.scrollTo(this.__scrollLeft, this.__scrollTop, true);
1451
+ }
1452
+ setPosition(e2, t2) {
1453
+ this.__clientLeft = e2 || 0, this.__clientTop = t2 || 0;
1454
+ }
1455
+ setSnapSize(e2, t2) {
1456
+ this.__snapWidth = e2, this.__snapHeight = t2;
1457
+ }
1458
+ getValues() {
1459
+ return { left: this.__scrollLeft, top: this.__scrollTop, right: this.__scrollLeft + this.__clientWidth / this.__zoomLevel, bottom: this.__scrollTop + this.__clientHeight / this.__zoomLevel, zoom: this.__zoomLevel };
1460
+ }
1461
+ getPoint(e2, t2) {
1462
+ const n2 = this.getValues();
1463
+ return { left: e2 / n2.zoom, top: t2 / n2.zoom };
1464
+ }
1465
+ getScrollMax() {
1466
+ return { left: this.__maxScrollLeft, top: this.__maxScrollTop };
1467
+ }
1468
+ zoomTo(e2, t2 = false, n2, o2, i2) {
1469
+ if (!this.options.zooming) throw new Error("Zooming is not enabled!");
1470
+ i2 && (this.__zoomComplete = i2), this.__isDecelerating && (Vt(this.__isDecelerating), this.__isDecelerating = 0);
1471
+ const r2 = this.__zoomLevel;
1472
+ void 0 === n2 && (n2 = this.__clientWidth / 2), void 0 === o2 && (o2 = this.__clientHeight / 2), e2 = Math.max(Math.min(e2, this.options.maxZoom), this.options.minZoom), this.__computeScrollMax(e2);
1473
+ const s2 = e2 / r2;
1474
+ let l2 = s2 * (this.__scrollLeft + n2) - n2, a2 = s2 * (this.__scrollTop + o2) - o2;
1475
+ l2 > this.__maxScrollLeft ? l2 = this.__maxScrollLeft : l2 < 0 && (l2 = 0), a2 > this.__maxScrollTop ? a2 = this.__maxScrollTop : a2 < 0 && (a2 = 0), this.__publish(l2, a2, e2, t2);
1476
+ }
1477
+ zoomBy(e2, t2 = false, n2 = 0, o2 = 0, i2) {
1478
+ this.zoomTo(this.__zoomLevel * e2, t2, n2, o2, i2);
1479
+ }
1480
+ scrollTo(e2, t2, n2 = false, o2 = 1) {
1481
+ if (this.__isDecelerating && (Vt(this.__isDecelerating), this.__isDecelerating = 0), void 0 !== o2 && o2 !== this.__zoomLevel) {
1482
+ if (!this.options.zooming) throw new Error("Zooming is not enabled!");
1483
+ e2 *= o2, t2 *= o2, this.__computeScrollMax(o2);
1484
+ } else o2 = this.__zoomLevel;
1485
+ this.options.scrollingX ? this.options.paging ? e2 = Math.round(e2 / this.__clientWidth) * this.__clientWidth : this.options.snapping && (e2 = Math.round(e2 / this.__snapWidth) * this.__snapWidth) : e2 = this.__scrollLeft, this.options.scrollingY ? this.options.paging ? t2 = Math.round(t2 / this.__clientHeight) * this.__clientHeight : this.options.snapping && (t2 = Math.round(t2 / this.__snapHeight) * this.__snapHeight) : t2 = this.__scrollTop, e2 = Math.max(Math.min(this.__maxScrollLeft, e2), 0), t2 = Math.max(Math.min(this.__maxScrollTop, t2), 0), e2 === this.__scrollLeft && t2 === this.__scrollTop && (n2 = false), this.__publish(e2, t2, o2, n2);
1486
+ }
1487
+ scrollBy(e2 = 0, t2 = 0, n2 = false) {
1488
+ const o2 = this.__isAnimating ? this.__scheduledLeft : this.__scrollLeft, i2 = this.__isAnimating ? this.__scheduledTop : this.__scrollTop;
1489
+ this.scrollTo(o2 + (e2 || 0), i2 + (t2 || 0), n2);
1490
+ }
1491
+ doMouseZoom(e2, t2, n2, o2) {
1492
+ const i2 = e2 > 0 ? 0.97 : 1.03;
1493
+ return this.zoomTo(this.__zoomLevel * i2, false, n2 - this.__clientLeft, o2 - this.__clientTop);
1494
+ }
1495
+ doTouchStart(e2, t2) {
1496
+ if (void 0 === e2.length) throw new Error("Invalid touch list: " + e2);
1497
+ if (t2 instanceof Date && (t2 = t2.valueOf()), "number" != typeof t2) throw new Error("Invalid timestamp value: " + t2);
1498
+ let n2, o2;
1499
+ this.__interruptedAnimation = true, this.__isDecelerating && (Vt(this.__isDecelerating), this.__isDecelerating = 0, this.__interruptedAnimation = true), this.__isAnimating && (Vt(this.__isAnimating), this.__isAnimating = 0, this.__interruptedAnimation = true);
1500
+ let i2 = 1 === e2.length;
1501
+ i2 ? (n2 = e2[0].pageX, o2 = e2[0].pageY) : (n2 = Math.abs(e2[0].pageX + e2[1].pageX) / 2, o2 = Math.abs(e2[0].pageY + e2[1].pageY) / 2), this.__initialTouchLeft = n2, this.__initialTouchTop = o2, this.__zoomLevelStart = this.__zoomLevel, this.__lastTouchLeft = n2, this.__lastTouchTop = o2, this.__lastTouchMove = t2, this.__lastScale = 1, this.__enableScrollX = !i2 && this.options.scrollingX, this.__enableScrollY = !i2 && this.options.scrollingY, this.__isTracking = true, this.__didDecelerationComplete = false, this.__isDragging = !i2, this.__isSingleTouch = i2, this.__positions = [];
1502
+ }
1503
+ doTouchMove(e2, t2, n2 = 1) {
1504
+ if (void 0 === e2.length) throw new Error("Invalid touch list: " + e2);
1505
+ if (t2 instanceof Date && (t2 = t2.valueOf()), "number" != typeof t2) throw new Error("Invalid timestamp value: " + t2);
1506
+ if (!this.__isTracking) return;
1507
+ let o2, i2;
1508
+ 2 === e2.length ? (o2 = Math.abs(e2[0].pageX + e2[1].pageX) / 2, i2 = Math.abs(e2[0].pageY + e2[1].pageY) / 2) : (o2 = e2[0].pageX, i2 = e2[0].pageY);
1509
+ let r2 = this.__positions;
1510
+ if (this.__isDragging) {
1511
+ let e3 = o2 - this.__lastTouchLeft, s2 = i2 - this.__lastTouchTop, l2 = this.__scrollLeft, a2 = this.__scrollTop, c2 = this.__zoomLevel;
1512
+ if (void 0 !== n2 && this.options.zooming) {
1513
+ let e4 = c2;
1514
+ if (c2 = c2 / this.__lastScale * n2, c2 = Math.max(Math.min(c2, this.options.maxZoom), this.options.minZoom), e4 !== c2) {
1515
+ let t3 = o2 - this.__clientLeft, n3 = i2 - this.__clientTop;
1516
+ l2 = (t3 + l2) * c2 / e4 - t3, a2 = (n3 + a2) * c2 / e4 - n3, this.__computeScrollMax(c2);
1517
+ }
1518
+ }
1519
+ if (this.__enableScrollX) {
1520
+ l2 -= e3 * this.options.speedMultiplier;
1521
+ let t3 = this.__maxScrollLeft;
1522
+ (l2 > t3 || l2 < 0) && (this.options.bouncing ? l2 += e3 / 2 * this.options.speedMultiplier : l2 = l2 > t3 ? t3 : 0);
1523
+ }
1524
+ if (this.__enableScrollY) {
1525
+ a2 -= s2 * this.options.speedMultiplier;
1526
+ const e4 = this.__maxScrollTop;
1527
+ (a2 > e4 || a2 < 0) && (this.options.bouncing ? a2 += s2 / 2 * this.options.speedMultiplier : a2 = a2 > e4 ? e4 : 0);
1528
+ }
1529
+ r2.length > 60 && r2.splice(0, 30), r2.push(l2, a2, t2), this.__publish(l2, a2, c2);
1530
+ } else {
1531
+ let e3 = this.options.locking ? 3 : 0, n3 = 5, s2 = Math.abs(o2 - this.__initialTouchLeft), l2 = Math.abs(i2 - this.__initialTouchTop);
1532
+ this.__enableScrollX = this.options.scrollingX && s2 >= e3, this.__enableScrollY = this.options.scrollingY && l2 >= e3, r2.push(this.__scrollLeft, this.__scrollTop, t2), this.__isDragging = (this.__enableScrollX || this.__enableScrollY) && (s2 >= n3 || l2 >= n3), this.__isDragging && (this.__interruptedAnimation = false);
1533
+ }
1534
+ this.__lastTouchLeft = o2, this.__lastTouchTop = i2, this.__lastTouchMove = t2, this.__lastScale = n2;
1535
+ }
1536
+ doTouchEnd(e2) {
1537
+ if (e2 instanceof Date && (e2 = e2.valueOf()), "number" != typeof e2) throw new Error("Invalid timestamp value: " + e2);
1538
+ if (this.__isTracking) {
1539
+ if (this.__isTracking = false, this.__isDragging) if (this.__isDragging = false, this.__isSingleTouch && this.options.animating && e2 - this.__lastTouchMove <= 100) {
1540
+ let t2 = this.__positions, n2 = t2.length - 1, o2 = n2;
1541
+ for (let e3 = n2; e3 > 0 && t2[e3] > this.__lastTouchMove - 100; e3 -= 3) o2 = e3;
1542
+ if (o2 !== n2) {
1543
+ const i2 = t2[n2] - t2[o2], r2 = this.__scrollLeft - t2[o2 - 2], s2 = this.__scrollTop - t2[o2 - 1];
1544
+ this.__decelerationVelocityX = r2 / i2 * (1e3 / 60), this.__decelerationVelocityY = s2 / i2 * (1e3 / 60);
1545
+ const l2 = this.options.paging || this.options.snapping ? 4 : 1;
1546
+ (Math.abs(this.__decelerationVelocityX) > l2 || Math.abs(this.__decelerationVelocityY) > l2) && this.__startDeceleration(e2);
1547
+ } else this.options.scrollingComplete?.();
1548
+ } else e2 - this.__lastTouchMove > 100 && this.options.scrollingComplete?.();
1549
+ this.__isDecelerating || ((this.__interruptedAnimation || this.__isDragging) && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, true, this.__zoomLevel)), this.__positions.length = 0;
1550
+ }
1551
+ }
1552
+ __publish(e2, t2, n2, o2 = false) {
1553
+ const i2 = this.__isAnimating;
1554
+ if (i2 && (Vt(i2), this.__isAnimating = 0), o2 && this.options.animating) {
1555
+ this.__scheduledLeft = e2, this.__scheduledTop = t2, this.__scheduledZoom = n2;
1556
+ const o3 = this.__scrollLeft, r2 = this.__scrollTop, s2 = this.__zoomLevel, l2 = e2 - o3, a2 = t2 - r2, c2 = n2 - s2, h2 = function(e3, t3, n3) {
1557
+ n3 && (this.__scrollLeft = o3 + l2 * e3, this.__scrollTop = r2 + a2 * e3, this.__zoomLevel = s2 + c2 * e3, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
1558
+ }.bind(this), u2 = function(e3) {
1559
+ return this.__isAnimating === e3;
1560
+ }.bind(this), d2 = function(e3, t3, n3) {
1561
+ t3 === this.__isAnimating && (this.__isAnimating = false), (this.__didDecelerationComplete || n3) && this.options.scrollingComplete?.(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
1562
+ }.bind(this);
1563
+ this.__isAnimating = Ft(h2, u2, d2, this.options.animationDuration, i2 ? jt : Xt);
1564
+ } else this.__scheduledLeft = this.__scrollLeft = e2, this.__scheduledTop = this.__scrollTop = t2, this.__scheduledZoom = this.__zoomLevel = n2, this.__callback && this.__callback(e2, t2, n2), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
1565
+ }
1566
+ __computeScrollMax(e2 = this.__zoomLevel) {
1567
+ this.__maxScrollLeft = Math.max(this.__contentWidth * e2 - this.__clientWidth, 0), this.__maxScrollTop = Math.max(this.__contentHeight * e2 - this.__clientHeight, 0);
1568
+ }
1569
+ __startDeceleration(e2) {
1570
+ if (this.options.paging) {
1571
+ const e3 = Math.max(Math.min(this.__scrollLeft, this.__maxScrollLeft), 0), t3 = Math.max(Math.min(this.__scrollTop, this.__maxScrollTop), 0), n3 = this.__clientWidth, o3 = this.__clientHeight;
1572
+ this.__minDecelerationScrollLeft = Math.floor(e3 / n3) * n3, this.__minDecelerationScrollTop = Math.floor(t3 / o3) * o3, this.__maxDecelerationScrollLeft = Math.ceil(e3 / n3) * n3, this.__maxDecelerationScrollTop = Math.ceil(t3 / o3) * o3;
1573
+ } else this.__minDecelerationScrollLeft = 0, this.__minDecelerationScrollTop = 0, this.__maxDecelerationScrollLeft = this.__maxScrollLeft, this.__maxDecelerationScrollTop = this.__maxScrollTop;
1574
+ const t2 = function(e3, t3, n3) {
1575
+ this.__stepThroughDeceleration(n3);
1576
+ }.bind(this), n2 = this.options.snapping ? 4 : 0.1, o2 = function() {
1577
+ const e3 = Math.abs(this.__decelerationVelocityX) >= n2 || Math.abs(this.__decelerationVelocityY) >= n2;
1578
+ return e3 || (this.__didDecelerationComplete = true), e3;
1579
+ }.bind(this), i2 = function(e3, t3, n3) {
1580
+ this.__isDecelerating = 0, this.__didDecelerationComplete && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping);
1581
+ }.bind(this);
1582
+ this.__isDecelerating = Ft(t2, o2, i2);
1583
+ }
1584
+ __stepThroughDeceleration(e2) {
1585
+ let t2 = this.__scrollLeft + this.__decelerationVelocityX, n2 = this.__scrollTop + this.__decelerationVelocityY;
1586
+ if (!this.options.bouncing) {
1587
+ const e3 = Math.max(Math.min(this.__maxDecelerationScrollLeft, t2), this.__minDecelerationScrollLeft);
1588
+ e3 !== t2 && (t2 = e3, this.__decelerationVelocityX = 0);
1589
+ const o2 = Math.max(Math.min(this.__maxDecelerationScrollTop, n2), this.__minDecelerationScrollTop);
1590
+ o2 !== n2 && (n2 = o2, this.__decelerationVelocityY = 0);
1591
+ }
1592
+ if (e2 ? this.__publish(t2, n2, this.__zoomLevel) : (this.__scrollLeft = t2, this.__scrollTop = n2), !this.options.paging) {
1593
+ const e3 = 0.95;
1594
+ this.__decelerationVelocityX *= e3, this.__decelerationVelocityY *= e3;
1595
+ }
1596
+ if (this.options.bouncing) {
1597
+ let e3 = 0, o2 = 0, i2 = this.options.penetrationDeceleration, r2 = this.options.penetrationAcceleration;
1598
+ t2 < this.__minDecelerationScrollLeft ? e3 = this.__minDecelerationScrollLeft - t2 : t2 > this.__maxDecelerationScrollLeft && (e3 = this.__maxDecelerationScrollLeft - t2), n2 < this.__minDecelerationScrollTop ? o2 = this.__minDecelerationScrollTop - n2 : n2 > this.__maxDecelerationScrollTop && (o2 = this.__maxDecelerationScrollTop - n2), 0 !== e3 && (e3 * this.__decelerationVelocityX <= 0 ? this.__decelerationVelocityX += e3 * i2 : this.__decelerationVelocityX = e3 * r2), 0 !== o2 && (o2 * this.__decelerationVelocityY <= 0 ? this.__decelerationVelocityY += o2 * i2 : this.__decelerationVelocityY = o2 * r2);
1599
+ }
1600
+ }
1601
+ }
1602
+ const Ut = (e2, t2) => x(It, { ...e2, ref: t2 }), Gt = Object.freeze(Object.defineProperty({ __proto__: null, defaultCreateScrollbar: Ut, getScrollTo: (e2, t2, n2, o2, i2 = 0) => {
1603
+ for (let i3 = 0; i3 < n2.length; i3++) {
1604
+ const r2 = n2[i3].getBoundingClientRect();
1605
+ let s2 = r2.left - t2, l2 = s2 + r2.width;
1606
+ if (o2) {
1607
+ if (s2 < e2 && l2 >= e2) return s2;
1608
+ } else if (Math.ceil(l2) > Math.ceil(e2) + 2) return l2;
1609
+ }
1610
+ return i2;
1611
+ } }, Symbol.toStringTag, { value: "Module" })), Zt = ({ width: e2, height: t2 }) => x("div", { className: "corner", style: { minWidth: `${e2}px`, width: `${e2}px`, minHeight: `${t2}px`, height: `${t2}px` } }), qt = p(f((e2, t2) => {
1612
+ const { children: n2, viewport: o2, onScrollViewport: i2, showHorizontalScrollbar: r2 = true, showVerticalScrollbar: s2 = true, createScrollCorner: l2 = Zt, createHorizontalScrollbar: c2 = Ut, createVerticalScrollbar: d2 = Ut, style: p2, touchElement: f2, disableTouch: _2, ...g2 } = e2, y2 = r2 && c2, v2 = s2 && d2, w2 = ce(i2, [i2]), b2 = Re(t2, () => ({ isScrollPane: () => true }), []), L2 = a(null);
1613
+ u(() => {
1614
+ L2.current && (L2.current.__scrollTop === o2?.top && L2.current.__scrollLeft === o2?.left || L2.current.__isDecelerating || L2.current?.scrollTo(o2?.left, o2?.top, false));
1615
+ }, [o2?.left, o2?.top, f2]);
1616
+ const T2 = m((e3, t3) => {
1617
+ w2?.({ left: e3, top: t3 });
1618
+ }, []), k2 = m((e3) => {
1619
+ L2.current?.doTouchStart(e3.touches, e3.timeStamp);
1620
+ }, []), C2 = m((e3) => {
1621
+ e3.preventDefault(), L2.current?.doTouchMove(e3.touches, e3.timeStamp);
1622
+ }, []), D2 = m((e3) => {
1623
+ L2.current?.doTouchEnd(e3.timeStamp);
1624
+ }, []), P2 = m(({ containerWidth: e3, containerHeight: t3, totalWidth: n3, totalHeight: o3 }) => {
1625
+ L2.current.setDimensions(e3, t3, n3, o3);
1626
+ }, []);
1627
+ u(() => {
1628
+ const e3 = f2 ?? b2.current;
1629
+ if (!_2 && N().supportsTouchEvents && e3 && o2) {
1630
+ if (!L2.current) {
1631
+ const e4 = { scrollingX: true, scrollingY: true, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
1632
+ L2.current = new Yt(T2, e4);
1633
+ }
1634
+ N().supportsTouchEvents && (e3.addEventListener("touchstart", k2), e3.addEventListener("touchend", D2), e3.addEventListener("touchmove", C2)), P2({ containerWidth: o2?.width, containerHeight: o2?.height, totalWidth: o2?.totalWidth, totalHeight: o2?.totalHeight });
1635
+ }
1636
+ return () => {
1637
+ e3?.removeEventListener("touchstart", k2), e3?.removeEventListener("touchend", D2), e3?.removeEventListener("touchmove", C2);
1638
+ };
1639
+ }, [o2?.width, o2?.height, o2?.totalWidth, o2?.totalHeight, _2, f2]);
1640
+ const [A2, { width: z2 }] = M(), [B2, { height: $2 }] = M(), K2 = h(() => {
1641
+ if (!v2) return null;
1642
+ const e3 = d2({ orientation: Et.Vertical, offset: o2?.top, viewportSize: o2?.height, totalSize: o2?.totalHeight, onScrollOffset: (e4) => {
1643
+ w2?.({ top: e4 });
1644
+ } });
1645
+ return x("div", { style: { display: "flex", flex: "0" }, ref: A2, children: e3 });
1646
+ }, [d2, o2?.top, o2?.height, o2?.totalHeight]), O2 = h(() => {
1647
+ if (!y2) return null;
1648
+ const e3 = c2({ orientation: Et.Horizontal, offset: o2?.left, viewportSize: o2?.width, totalSize: o2?.totalWidth, onScrollOffset: (e4) => {
1649
+ w2?.({ left: e4 });
1650
+ } });
1651
+ return S("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [x("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${z2}px)` }, children: x("div", { ref: B2, className: "sizer", children: e3 }) }), v2 ? l2({ width: z2, height: $2 }) : x(E, {})] });
1652
+ }, [c2, o2?.left, o2?.width, o2?.totalWidth, v2, l2, z2, $2]);
1653
+ return x("div", { style: { position: "relative", display: "flex", minWidth: v2 ? `${z2}px` : void 0, minHeight: y2 ? `${$2}px` : void 0, ...p2 }, ...g2, ref: b2, children: S("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [S("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [x("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: n2 }), v2 ? K2 : x(E, {})] }), y2 ? O2 : x(E, {})] }) });
1654
+ }));
1655
+ qt.displayName = "ScrollPane";
1656
+ const Jt = 300, Qt = 100, en = 1e6, tn = 100, nn = 50, on = p(f((e2, t2) => {
1657
+ const { offset: n2 = 0, viewportSize: o2 = 0, totalSize: i2 = 0, minSize: r2 = 0, endGap: s2 = Jt, endScrollIncrement: l2 = Qt, style: a2 = I, onMouseDown: c2, onScrollOffset: u2, onScroll: p2, scaleLimit: f2 = en, scaleFactor: _2 = tn, precisionFactor: g2 = nn, createScrollbar: y2 = Ut, ...v2 } = e2;
1658
+ p2 && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
1659
+ const w2 = ce(c2, [c2]), [b2, x2] = d(false), S2 = h(() => {
1660
+ const e3 = 0 === f2 ? i2 : Math.min(i2 ?? 0, Math.max(r2 ?? 0, (n2 ?? 0) + (o2 ?? 0)) + (s2 ?? 0)), t3 = 0 !== f2 && e3 > f2 ? _2 : 1, l3 = t3 / g2, a3 = Math.ceil(e3 / t3);
1661
+ return { offset: Math.ceil(n2 / t3), totalSize: a3, viewportSize: Math.ceil(o2 / t3), scaledOffset: n2, scaledTotalSize: i2, scaledViewportSize: o2, factor: t3, precision: l3 };
1662
+ }, [n2, i2, o2, b2, r2, s2, l2]), E2 = ce((e3, t3, n3) => {
1663
+ const o3 = S2.offset;
1664
+ Math.abs(e3 - o3) < S2.precision && (e3 = o3), u2?.(e3 * S2.factor, o3, S2.viewportSize);
1665
+ }, [u2, S2]), L2 = m((e3) => {
1666
+ }, []), M2 = m((e3) => {
1667
+ document.removeEventListener("mousemove", L2), document.removeEventListener("mouseup", M2), x2(false);
1668
+ }, []), T2 = m((e3) => {
1669
+ x2(true), w2?.(e3), document.addEventListener("mousemove", L2, { passive: true }), document.addEventListener("mouseup", M2, { passive: true });
1670
+ }, [L2, M2]);
1671
+ return Ut({ style: a2, ...v2, offset: S2.offset, totalSize: S2.totalSize, viewportSize: S2.viewportSize, onMouseDown: T2, onScrollOffset: E2 }, t2);
1672
+ }));
1673
+ on.displayName = "VirtualScrollbar";
1545
1674
  export {
1546
- ft as Command,
1547
- Ct as CommandButtonType,
1548
- xt as CommandGroup,
1549
- Fe as DefaultDynamicIconService,
1550
- K as DefaultReactNotifier,
1551
- Ye as DynamicIcon,
1552
- De as ErrorTestPanel,
1553
- Ee as FocusKeyNavigation,
1675
+ $ as Command,
1676
+ G as CommandButtonType,
1677
+ W as CommandGroup,
1678
+ ht as DefaultDynamicIconService,
1679
+ ee as DefaultReactNotifier,
1680
+ pt as DynamicIcon,
1681
+ Ze as ErrorTestPanel,
1682
+ q as FocusKeyNavigation,
1554
1683
  P as HorizontalAlignment,
1684
+ mt as InMemoryStore,
1555
1685
  z as KeyCodes,
1556
1686
  A as KeyModifiers,
1687
+ St as LocalStorageStore,
1557
1688
  B as MouseButtonCodes,
1558
- N as NotifierProvider,
1559
- O as NotifierType,
1560
- Te as ReactErrorBoundary,
1561
- wt as ReactUtils,
1562
- Le as RoundedTab,
1563
- me as ScrollPane,
1564
- fe as ScrollUtils,
1565
- oe as Scrollbar,
1566
- $ as ScrollbarOrientation,
1567
- _t as SimpleCommand,
1568
- Ke as SplitPane,
1569
- Ae as SplitPaneResizer,
1570
- Se as ToolTipPlacement,
1571
- ke as UncaughtErrorBoundary,
1572
- be as VirtualScrollbar,
1573
- Ue as WalkingIcon,
1574
- Ie as createDynamicIconService,
1575
- _e as defaultCreateScrollCorner,
1576
- Qt as defaultCreateScrollEdgeButton,
1577
- Jt as defaultCreateScrollEndButton,
1578
- qt as defaultCreateScrollStartButton,
1579
- U as getDevicePixelRatio,
1580
- Et as toShortcutString,
1581
- j as useAnimatedMeasure,
1582
- X as useCallbackRef,
1583
- Lt as useCommand,
1584
- Tt as useCommands,
1585
- Dt as useCopyPaste,
1586
- Y as useDevicePixelRatio,
1587
- pt as useEditMode,
1588
- ee as useFullscreenPortal,
1589
- kt as useGlobalClipboard,
1590
- Kt as useId,
1591
- Nt as useImperativeElement,
1592
- q as useMouseDownAndHoldListener,
1593
- R as useNotifier,
1594
- G as useOnClickOrFocusAway,
1595
- Z as useSynchronizedPointerHandler,
1596
- Pt as useTraceUpdate,
1597
- It as useUndoManager
1689
+ ne as NotifierProvider,
1690
+ Q as NotifierType,
1691
+ bt as PersistenceStateProvider,
1692
+ Ye as ReactErrorBoundary,
1693
+ R as ReactUtils,
1694
+ J as RoundedTab,
1695
+ qt as ScrollPane,
1696
+ Gt as ScrollUtils,
1697
+ It as Scrollbar,
1698
+ Et as ScrollbarOrientation,
1699
+ K as SimpleCommand,
1700
+ ot as SplitPane,
1701
+ Je as SplitPaneResizer,
1702
+ Z as ToolTipPlacement,
1703
+ Ge as UncaughtErrorBoundary,
1704
+ on as VirtualScrollbar,
1705
+ ft as WalkingIcon,
1706
+ ct as createDynamicIconService,
1707
+ Zt as defaultCreateScrollCorner,
1708
+ Bt as defaultCreateScrollEdgeButton,
1709
+ zt as defaultCreateScrollEndButton,
1710
+ At as defaultCreateScrollStartButton,
1711
+ ue as getDevicePixelRatio,
1712
+ j as toShortcutString,
1713
+ ae as useAnimatedMeasure,
1714
+ ce as useCallbackRef,
1715
+ X as useCommand,
1716
+ U as useCommands,
1717
+ Ae as useCopyPaste,
1718
+ he as useDevicePixelRatio,
1719
+ De as useEditMode,
1720
+ Kt as useFullscreenPortal,
1721
+ Pe as useGlobalClipboard,
1722
+ Ne as useId,
1723
+ Re as useImperativeElement,
1724
+ fe as useMouseDownAndHoldListener,
1725
+ oe as useNotifier,
1726
+ de as useOnClickOrFocusAway,
1727
+ vt as usePersistenceState,
1728
+ pe as useSynchronizedPointerHandler,
1729
+ ze as useTraceUpdate,
1730
+ je as useUndoManager
1598
1731
  };