@sheetxl/utils-react 0.7.3 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,691 +1,720 @@
1
1
  /**
2
- * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.3
2
+ * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.4
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, jsxs as e, Fragment as n } from "react/jsx-runtime";
8
- import o, { useCallback as i, useRef as r, memo as s, forwardRef as l, useState as a, useEffect as c, useMemo as h, useImperativeHandle as u, useLayoutEffect as d, createElement as _, useReducer as p } from "react";
9
- import m from "clsx";
10
- import { useMeasure as f } from "react-use";
11
- import { CommonUtils as g, InternalClipboard as y, ClipboardUtils as v, MimeType as x } from "@sheetxl/utils";
12
- import * as b from "detect-it";
13
- import { mergeRefs as w } from "react-merge-refs";
14
- import { createRoot as S } from "react-dom/client";
15
- import { unstable_batchedUpdates as L } from "react-dom";
16
- const E = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, C = { Shift: "shift", Alt: "alt", Ctrl: "ctrl", Meta: "meta" }, T = { 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 }, M = { Left: 1, Middle: 2, Right: 3 }, D = { Horizontal: "horizontal", Vertical: "vertical" }, P = (t2, e2) => {
17
- const n2 = i((...e3) => t2?.(...e3), e2), o2 = r(null);
7
+ import { jsx as e, jsxs as t, Fragment as n } from "react/jsx-runtime";
8
+ import o, { useCallback as i, useRef as r, memo as s, forwardRef as l, useState as a, useEffect as c, useMemo as h, useImperativeHandle as u, useLayoutEffect as d, createContext as _, useContext as p, createElement as m, useReducer as f } from "react";
9
+ import g from "clsx";
10
+ import { useMeasure as y } from "react-use";
11
+ import { CommonUtils as v, DelegatingNotifier as x, Notifier as w, InternalClipboard as b, ClipboardUtils as S, MimeType as L } from "@sheetxl/utils";
12
+ import * as E from "detect-it";
13
+ import { mergeRefs as C } from "react-merge-refs";
14
+ import { createRoot as T } from "react-dom/client";
15
+ import { unstable_batchedUpdates as M } from "react-dom";
16
+ const D = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, P = { 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 }, k = { Left: 1, Middle: 2, Right: 3 }, A = { Horizontal: "horizontal", Vertical: "vertical" }, B = (e2, t2) => {
17
+ const n2 = i((...t3) => e2?.(...t3), t2), o2 = r(null);
18
18
  o2.current = n2;
19
- const s2 = i((...t3) => o2.current?.(...t3), []);
19
+ const s2 = i((...e3) => o2.current?.(...e3), []);
20
20
  if (o2.current) return s2;
21
- }, z = (e2) => {
22
- const { style: n2, orientation: o2 = D.Vertical, ...i2 } = e2, r2 = o2 === D.Vertical;
23
- return t("div", { style: { paddingBottom: "0px", paddingRight: "0px", paddingLeft: r2 ? "0px" : "3px", paddingTop: r2 ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...n2 }, ...i2, children: t("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r2 ? "vertical" : "horizontal"} single-button start`, children: t("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: t("path", { d: r2 ? "m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z" : "m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z" }) }) }) });
24
- }, k = (e2) => {
25
- const { style: n2, orientation: o2 = D.Vertical, ...i2 } = e2, r2 = o2 === D.Vertical;
26
- return t("div", { style: { paddingLeft: "0px", paddingTop: "0px", paddingRight: r2 ? "0px" : "3px", paddingBottom: r2 ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...n2 }, ...i2, children: t("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r2 ? "vertical" : "horizontal"} single-button end`, children: t("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: t("path", { d: r2 ? "M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z" : "m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z" }) }) }) });
27
- }, A = (e2) => {
28
- const { style: n2, orientation: o2 = D.Vertical, ...i2 } = e2, r2 = o2 === D.Vertical;
29
- 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" }) }) });
30
- }, B = (t2, e2, n2, o2, i2 = 0) => {
21
+ }, $ = (t2) => {
22
+ const { style: n2, orientation: o2 = A.Vertical, ...i2 } = t2, r2 = o2 === A.Vertical;
23
+ return e("div", { style: { paddingBottom: "0px", paddingRight: "0px", paddingLeft: r2 ? "0px" : "3px", paddingTop: r2 ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...n2 }, ...i2, children: e("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r2 ? "vertical" : "horizontal"} single-button start`, children: e("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: e("path", { d: r2 ? "m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z" : "m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z" }) }) }) });
24
+ }, O = (t2) => {
25
+ const { style: n2, orientation: o2 = A.Vertical, ...i2 } = t2, r2 = o2 === A.Vertical;
26
+ return e("div", { style: { paddingLeft: "0px", paddingTop: "0px", paddingRight: r2 ? "0px" : "3px", paddingBottom: r2 ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...n2 }, ...i2, children: e("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r2 ? "vertical" : "horizontal"} single-button end`, children: e("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: e("path", { d: r2 ? "M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z" : "m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z" }) }) }) });
27
+ }, K = (t2) => {
28
+ const { style: n2, orientation: o2 = A.Vertical, ...i2 } = t2, r2 = o2 === A.Vertical;
29
+ return e("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: e("svg", { width: "24", height: "24", viewBox: "0 0 24 24", transform: r2 ? "rotate(90) " : "", children: e("path", { style: { transition: "opacity 240ms ease 0s", opacity: t2.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" }) }) });
30
+ }, V = (e2, t2, n2, o2, i2 = 0) => {
31
31
  for (let i3 = 0; i3 < n2.length; i3++) {
32
32
  const r2 = n2[i3].getBoundingClientRect();
33
- let s2 = r2.left - e2, l2 = s2 + r2.width;
33
+ let s2 = r2.left - t2, l2 = s2 + r2.width;
34
34
  if (o2) {
35
- if (s2 < t2 && l2 >= t2) return s2;
36
- } else if (Math.ceil(l2) > Math.ceil(t2) + 2) return l2;
35
+ if (s2 < e2 && l2 >= e2) return s2;
36
+ } else if (Math.ceil(l2) > Math.ceil(e2) + 2) return l2;
37
37
  }
38
38
  return i2;
39
- }, $ = Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: B }, Symbol.toStringTag, { value: "Module" })), K = "_sheetxl-scrollbar_eblx4_6", O = s(l((n2, o2) => {
40
- const { offset: s2 = 0, totalSize: l2 = 0, viewportSize: u2 = 0, style: d2, className: _2, orientation: p2 = D.Vertical, onScrollOffset: g2, onScroll: y2, showCustomScrollButtons: v2 = false, scrollButtonIncrement: x2 = 200, scrollButtonInitialRepeatDelay: b2 = 260, scrollButtonAdditionalRepeatDelay: w2 = 120, createScrollStartButton: S2 = z, createScrollEndButton: L2 = k, ...E2 } = n2, C2 = P(y2, [y2]), T2 = r(null), [M2, { width: A2, height: $2 }] = f(), [O2, { width: V2, height: H2 }] = f(), W2 = p2 === D.Vertical, N2 = W2 ? "top" : "left", F2 = W2 ? "scrollTop" : "scrollLeft", R2 = W2 ? $2 : A2, I2 = W2 ? H2 : V2, [Y2, X2] = a(null);
39
+ }, H = Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: V }, Symbol.toStringTag, { value: "Module" })), W = "_sheetxl-scrollbar_eblx4_6", I = s(l((n2, o2) => {
40
+ const { offset: s2 = 0, totalSize: l2 = 0, viewportSize: u2 = 0, style: d2, className: _2, orientation: p2 = A.Vertical, onScrollOffset: m2, onScroll: f2, showCustomScrollButtons: v2 = false, scrollButtonIncrement: x2 = 200, scrollButtonInitialRepeatDelay: w2 = 260, scrollButtonAdditionalRepeatDelay: b2 = 120, createScrollStartButton: S2 = $, createScrollEndButton: L2 = O, ...E2 } = n2, C2 = B(f2, [f2]), T2 = r(null), [M2, { width: D2, height: P2 }] = y(), [z2, { width: k2, height: K2 }] = y(), H2 = p2 === A.Vertical, I2 = H2 ? "top" : "left", N2 = H2 ? "scrollTop" : "scrollLeft", F2 = H2 ? P2 : D2, R2 = H2 ? K2 : k2, [Y2, X2] = a(null);
41
41
  c(() => {
42
- null !== Y2 && T2.current && T2.current.scrollTo({ behavior: "smooth", [N2]: Y2 });
43
- }, [Y2, W2]);
44
- const j2 = i((t2, e2 = false) => {
42
+ null !== Y2 && T2.current && T2.current.scrollTo({ behavior: "smooth", [I2]: Y2 });
43
+ }, [Y2, H2]);
44
+ const j2 = i((e2, t2 = false) => {
45
45
  if (!T2.current) return 0;
46
- const n3 = T2.current.querySelector(".scrollbar-viewport"), o3 = n3.getBoundingClientRect(), i2 = n3.children, r2 = e2 ? 0 : B(t2, o3[N2], i2, true, Math.max(0, t2 - x2));
46
+ const n3 = T2.current.querySelector(".scrollbar-viewport"), o3 = n3.getBoundingClientRect(), i2 = n3.children, r2 = t2 ? 0 : V(e2, o3[I2], i2, true, Math.max(0, e2 - x2));
47
47
  return X2(r2), Math.max(0, r2);
48
- }, []), U2 = i((t2, e2 = false) => {
48
+ }, []), U2 = i((e2, t2 = false) => {
49
49
  if (!T2.current) return 0;
50
- const n3 = T2.current.querySelector(".scrollbar-viewport"), o3 = n3.getBoundingClientRect(), i2 = n3.children, r2 = Math.ceil(I2 - R2), s3 = e2 ? r2 : B(t2, o3[N2], i2, false, Math.max(0, t2 + x2));
50
+ const n3 = T2.current.querySelector(".scrollbar-viewport"), o3 = n3.getBoundingClientRect(), i2 = n3.children, r2 = Math.ceil(R2 - F2), s3 = t2 ? r2 : V(e2, o3[I2], i2, false, Math.max(0, e2 + x2));
51
51
  return X2(s3), Math.min(r2, s3);
52
- }, [I2, R2]), Z2 = r(null), G2 = i((t2) => {
52
+ }, [R2, F2]), Z2 = r(null), G2 = i((e2) => {
53
53
  Z2.current = s2;
54
- const e2 = t2.target[F2];
55
- g2(e2, u2, l2), C2?.(t2);
56
- }, [g2, u2, l2, s2]);
54
+ const t2 = e2.target[N2];
55
+ m2(t2, u2, l2), C2?.(e2);
56
+ }, [m2, u2, l2, s2]);
57
57
  c(() => {
58
- const t2 = Z2.current;
59
- Z2.current = null, s2 !== t2 && (T2.current[F2] = s2);
60
- }, [s2, F2]);
58
+ const e2 = Z2.current;
59
+ Z2.current = null, s2 !== e2 && (T2.current[N2] = s2);
60
+ }, [s2, N2]);
61
61
  const q2 = r(null), J2 = r(null), Q2 = i(() => {
62
62
  q2.current && (clearTimeout(q2.current), q2.current = null, J2.current = null);
63
- }, []), tt2 = i((t2, e2, n3, o3 = b2) => {
64
- J2.current = t2, q2.current = setTimeout(() => {
65
- const e3 = n3 ? j2(J2.current || t2) : U2(J2.current || t2);
66
- e3 !== J2.current ? tt2(e3, false, n3, w2) : Q2();
67
- }, e2 ? 0 : o3);
63
+ }, []), ee2 = i((e2, t2, n3, o3 = w2) => {
64
+ J2.current = e2, q2.current = setTimeout(() => {
65
+ const t3 = n3 ? j2(J2.current || e2) : U2(J2.current || e2);
66
+ t3 !== J2.current ? ee2(t3, false, n3, b2) : Q2();
67
+ }, t2 ? 0 : o3);
68
68
  }, [j2, U2, Q2]);
69
69
  c(() => () => Q2(), [Q2]);
70
- const et2 = s2, nt2 = h(() => {
70
+ const te2 = s2, ne2 = h(() => {
71
71
  if (!v2) return null;
72
- const t2 = { orientation: p2, disabled: Math.floor(et2) <= 0 || 0 === Math.floor(I2 - R2), onMouseUp: Q2, onMouseLeave: Q2, onMouseDown: () => tt2(et2, true, true) };
73
- return S2?.(t2);
74
- }, [v2, p2, et2, Y2, I2, R2]), ot2 = h(() => {
72
+ const e2 = { orientation: p2, disabled: Math.floor(te2) <= 0 || 0 === Math.floor(R2 - F2), onMouseUp: Q2, onMouseLeave: Q2, onMouseDown: () => ee2(te2, true, true) };
73
+ return S2?.(e2);
74
+ }, [v2, p2, te2, Y2, R2, F2]), oe2 = h(() => {
75
75
  if (!v2) return null;
76
- const t2 = { orientation: p2, disabled: Math.floor(I2 - R2) <= Math.ceil(et2), onMouseUp: Q2, onMouseLeave: Q2, onMouseDown: () => tt2(et2, true, false) };
77
- return L2?.(t2);
78
- }, [v2, p2, et2, Y2, I2, R2]);
79
- return e("div", { ref: o2, style: { display: "flex", flex: "1", flexDirection: W2 ? "column" : "row", padding: "0", ...d2 }, className: m(K, _2), ...E2, children: [nt2, t("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: W2 ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: M2, children: t("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: W2 ? "scroll" : "hidden", overflowX: W2 ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: G2, ref: T2, children: t("div", { ref: O2, style: { position: "absolute", height: W2 ? l2 - u2 + ($2 ?? 0) : 1, width: W2 ? 1 : l2 - u2 + (A2 ?? 0) }, className: "scrollbar-viewport" }) }) }), ot2] });
76
+ const e2 = { orientation: p2, disabled: Math.floor(R2 - F2) <= Math.ceil(te2), onMouseUp: Q2, onMouseLeave: Q2, onMouseDown: () => ee2(te2, true, false) };
77
+ return L2?.(e2);
78
+ }, [v2, p2, te2, Y2, R2, F2]);
79
+ return t("div", { ref: o2, style: { display: "flex", flex: "1", flexDirection: H2 ? "column" : "row", padding: "0", ...d2 }, className: g(W, _2), ...E2, children: [ne2, e("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: H2 ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: M2, children: e("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: H2 ? "scroll" : "hidden", overflowX: H2 ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: G2, ref: T2, children: e("div", { ref: z2, style: { position: "absolute", height: H2 ? l2 - u2 + (P2 ?? 0) : 1, width: H2 ? 1 : l2 - u2 + (D2 ?? 0) }, className: "scrollbar-viewport" }) }) }), oe2] });
80
80
  }));
81
- O.displayName = "Scrollbar";
82
- let V = Date.now, H = 1e3, W = {}, N = 1;
83
- const F = (t2) => {
84
- let e2 = null !== W[t2];
85
- return e2 && (W[t2] = null), e2;
86
- }, R = (t2, e2, n2, o2 = 0, i2) => {
87
- let r2 = V(), s2 = r2, l2 = 0, a2 = 0, c2 = 0, h2 = N++;
81
+ I.displayName = "Scrollbar";
82
+ let N = Date.now, F = 1e3, R = {}, Y = 1;
83
+ const X = (e2) => {
84
+ let t2 = null !== R[e2];
85
+ return t2 && (R[e2] = null), t2;
86
+ }, j = (e2, t2, n2, o2 = 0, i2) => {
87
+ let r2 = N(), s2 = r2, l2 = 0, a2 = 0, c2 = 0, h2 = Y++;
88
88
  if (h2 % 20 == 0) {
89
- const t3 = {};
90
- for (let e3 in W) t3[e3] = true;
91
- W = t3;
89
+ const e3 = {};
90
+ for (let t3 in R) e3[t3] = true;
91
+ R = e3;
92
92
  }
93
93
  const u2 = function(d2) {
94
- let _2 = true !== d2, p2 = V(), m2 = true;
94
+ let _2 = true !== d2, p2 = N(), m2 = true;
95
95
  try {
96
- m2 = (!e2 || e2(h2)) ?? true;
97
- } catch (t3) {
96
+ m2 = (!t2 || t2(h2)) ?? true;
97
+ } catch (e3) {
98
98
  m2 = false;
99
99
  }
100
- if (!W[h2] || !m2) return W[h2] = null, void n2?.(60 - a2 / ((p2 - r2) / H), h2, false);
100
+ if (!R[h2] || !m2) return R[h2] = null, void n2?.(60 - a2 / ((p2 - r2) / F), h2, false);
101
101
  if (_2) {
102
102
  c2 = Math.round((p2 - s2) / 16.666666666666668) - 1;
103
- for (let t3 = 0; t3 < Math.min(c2, 4); t3++) u2(true), a2++;
103
+ for (let e3 = 0; e3 < Math.min(c2, 4); e3++) u2(true), a2++;
104
104
  }
105
105
  o2 && (l2 = (p2 - r2) / o2, l2 > 1 && (l2 = 1));
106
106
  let f2 = i2 ? i2(l2) : l2, g2 = false;
107
107
  try {
108
- g2 = t2(f2, p2, _2);
109
- } catch (t3) {
108
+ g2 = e2(f2, p2, _2);
109
+ } catch (e3) {
110
110
  g2 = false;
111
111
  }
112
- false !== g2 && 1 !== l2 || !_2 ? _2 && (s2 = p2, requestAnimationFrame(u2)) : (W[h2] = null, n2?.(60 - a2 / ((p2 - r2) / H), h2, 1 === l2 || null == o2));
112
+ false !== g2 && 1 !== l2 || !_2 ? _2 && (s2 = p2, requestAnimationFrame(u2)) : (R[h2] = null, n2?.(60 - a2 / ((p2 - r2) / F), h2, 1 === l2 || null == o2));
113
113
  };
114
- return W[h2] = true, requestAnimationFrame(u2), h2;
115
- }, I = function(t2) {
116
- return Math.pow(t2 - 1, 3) + 1;
117
- }, Y = function(t2) {
118
- return (t2 /= 0.5) < 1 ? 0.5 * Math.pow(t2, 3) : 0.5 * (Math.pow(t2 - 2, 3) + 2);
114
+ return R[h2] = true, requestAnimationFrame(u2), h2;
115
+ }, U = function(e2) {
116
+ return Math.pow(e2 - 1, 3) + 1;
117
+ }, Z = function(e2) {
118
+ return (e2 /= 0.5) < 1 ? 0.5 * Math.pow(e2, 3) : 0.5 * (Math.pow(e2 - 2, 3) + 2);
119
119
  };
120
- class X {
121
- constructor(t2, e2) {
122
- 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 };
120
+ class G {
121
+ constructor(e2, t2) {
122
+ 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 };
123
123
  }
124
- setDimensions(t2, e2, n2, o2) {
125
- 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);
124
+ setDimensions(e2, t2, n2, o2) {
125
+ 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);
126
126
  }
127
- setPosition(t2, e2) {
128
- this.__clientLeft = t2 || 0, this.__clientTop = e2 || 0;
127
+ setPosition(e2, t2) {
128
+ this.__clientLeft = e2 || 0, this.__clientTop = t2 || 0;
129
129
  }
130
- setSnapSize(t2, e2) {
131
- this.__snapWidth = t2, this.__snapHeight = e2;
130
+ setSnapSize(e2, t2) {
131
+ this.__snapWidth = e2, this.__snapHeight = t2;
132
132
  }
133
133
  getValues() {
134
134
  return { left: this.__scrollLeft, top: this.__scrollTop, right: this.__scrollLeft + this.__clientWidth / this.__zoomLevel, bottom: this.__scrollTop + this.__clientHeight / this.__zoomLevel, zoom: this.__zoomLevel };
135
135
  }
136
- getPoint(t2, e2) {
136
+ getPoint(e2, t2) {
137
137
  const n2 = this.getValues();
138
- return { left: t2 / n2.zoom, top: e2 / n2.zoom };
138
+ return { left: e2 / n2.zoom, top: t2 / n2.zoom };
139
139
  }
140
140
  getScrollMax() {
141
141
  return { left: this.__maxScrollLeft, top: this.__maxScrollTop };
142
142
  }
143
- zoomTo(t2, e2 = false, n2, o2, i2) {
143
+ zoomTo(e2, t2 = false, n2, o2, i2) {
144
144
  if (!this.options.zooming) throw new Error("Zooming is not enabled!");
145
- i2 && (this.__zoomComplete = i2), this.__isDecelerating && (F(this.__isDecelerating), this.__isDecelerating = 0);
145
+ i2 && (this.__zoomComplete = i2), this.__isDecelerating && (X(this.__isDecelerating), this.__isDecelerating = 0);
146
146
  const r2 = this.__zoomLevel;
147
- 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);
148
- const s2 = t2 / r2;
147
+ 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);
148
+ const s2 = e2 / r2;
149
149
  let l2 = s2 * (this.__scrollLeft + n2) - n2, a2 = s2 * (this.__scrollTop + o2) - o2;
150
- 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);
150
+ 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);
151
151
  }
152
- zoomBy(t2, e2 = false, n2 = 0, o2 = 0, i2) {
153
- this.zoomTo(this.__zoomLevel * t2, e2, n2, o2, i2);
152
+ zoomBy(e2, t2 = false, n2 = 0, o2 = 0, i2) {
153
+ this.zoomTo(this.__zoomLevel * e2, t2, n2, o2, i2);
154
154
  }
155
- scrollTo(t2, e2, n2 = false, o2 = 1) {
156
- if (this.__isDecelerating && (F(this.__isDecelerating), this.__isDecelerating = 0), void 0 !== o2 && o2 !== this.__zoomLevel) {
155
+ scrollTo(e2, t2, n2 = false, o2 = 1) {
156
+ if (this.__isDecelerating && (X(this.__isDecelerating), this.__isDecelerating = 0), void 0 !== o2 && o2 !== this.__zoomLevel) {
157
157
  if (!this.options.zooming) throw new Error("Zooming is not enabled!");
158
- t2 *= o2, e2 *= o2, this.__computeScrollMax(o2);
158
+ e2 *= o2, t2 *= o2, this.__computeScrollMax(o2);
159
159
  } else o2 = this.__zoomLevel;
160
- 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);
160
+ 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);
161
161
  }
162
- scrollBy(t2 = 0, e2 = 0, n2 = false) {
162
+ scrollBy(e2 = 0, t2 = 0, n2 = false) {
163
163
  const o2 = this.__isAnimating ? this.__scheduledLeft : this.__scrollLeft, i2 = this.__isAnimating ? this.__scheduledTop : this.__scrollTop;
164
- this.scrollTo(o2 + (t2 || 0), i2 + (e2 || 0), n2);
164
+ this.scrollTo(o2 + (e2 || 0), i2 + (t2 || 0), n2);
165
165
  }
166
- doMouseZoom(t2, e2, n2, o2) {
167
- const i2 = t2 > 0 ? 0.97 : 1.03;
166
+ doMouseZoom(e2, t2, n2, o2) {
167
+ const i2 = e2 > 0 ? 0.97 : 1.03;
168
168
  return this.zoomTo(this.__zoomLevel * i2, false, n2 - this.__clientLeft, o2 - this.__clientTop);
169
169
  }
170
- doTouchStart(t2, e2) {
171
- if (void 0 === t2.length) throw new Error("Invalid touch list: " + t2);
172
- if (e2 instanceof Date && (e2 = e2.valueOf()), "number" != typeof e2) throw new Error("Invalid timestamp value: " + e2);
170
+ doTouchStart(e2, t2) {
171
+ if (void 0 === e2.length) throw new Error("Invalid touch list: " + e2);
172
+ if (t2 instanceof Date && (t2 = t2.valueOf()), "number" != typeof t2) throw new Error("Invalid timestamp value: " + t2);
173
173
  let n2, o2;
174
- this.__interruptedAnimation = true, this.__isDecelerating && (F(this.__isDecelerating), this.__isDecelerating = 0, this.__interruptedAnimation = true), this.__isAnimating && (F(this.__isAnimating), this.__isAnimating = 0, this.__interruptedAnimation = true);
175
- let i2 = 1 === t2.length;
176
- 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 = [];
174
+ this.__interruptedAnimation = true, this.__isDecelerating && (X(this.__isDecelerating), this.__isDecelerating = 0, this.__interruptedAnimation = true), this.__isAnimating && (X(this.__isAnimating), this.__isAnimating = 0, this.__interruptedAnimation = true);
175
+ let i2 = 1 === e2.length;
176
+ 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 = [];
177
177
  }
178
- doTouchMove(t2, e2, n2 = 1) {
179
- if (void 0 === t2.length) throw new Error("Invalid touch list: " + t2);
180
- if (e2 instanceof Date && (e2 = e2.valueOf()), "number" != typeof e2) throw new Error("Invalid timestamp value: " + e2);
178
+ doTouchMove(e2, t2, n2 = 1) {
179
+ if (void 0 === e2.length) throw new Error("Invalid touch list: " + e2);
180
+ if (t2 instanceof Date && (t2 = t2.valueOf()), "number" != typeof t2) throw new Error("Invalid timestamp value: " + t2);
181
181
  if (!this.__isTracking) return;
182
182
  let o2, i2;
183
- 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);
183
+ 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);
184
184
  let r2 = this.__positions;
185
185
  if (this.__isDragging) {
186
- let t3 = o2 - this.__lastTouchLeft, s2 = i2 - this.__lastTouchTop, l2 = this.__scrollLeft, a2 = this.__scrollTop, c2 = this.__zoomLevel;
186
+ let e3 = o2 - this.__lastTouchLeft, s2 = i2 - this.__lastTouchTop, l2 = this.__scrollLeft, a2 = this.__scrollTop, c2 = this.__zoomLevel;
187
187
  if (void 0 !== n2 && this.options.zooming) {
188
- let t4 = c2;
189
- if (c2 = c2 / this.__lastScale * n2, c2 = Math.max(Math.min(c2, this.options.maxZoom), this.options.minZoom), t4 !== c2) {
190
- let e3 = o2 - this.__clientLeft, n3 = i2 - this.__clientTop;
191
- l2 = (e3 + l2) * c2 / t4 - e3, a2 = (n3 + a2) * c2 / t4 - n3, this.__computeScrollMax(c2);
188
+ let e4 = c2;
189
+ if (c2 = c2 / this.__lastScale * n2, c2 = Math.max(Math.min(c2, this.options.maxZoom), this.options.minZoom), e4 !== c2) {
190
+ let t3 = o2 - this.__clientLeft, n3 = i2 - this.__clientTop;
191
+ l2 = (t3 + l2) * c2 / e4 - t3, a2 = (n3 + a2) * c2 / e4 - n3, this.__computeScrollMax(c2);
192
192
  }
193
193
  }
194
194
  if (this.__enableScrollX) {
195
- l2 -= t3 * this.options.speedMultiplier;
196
- let e3 = this.__maxScrollLeft;
197
- (l2 > e3 || l2 < 0) && (this.options.bouncing ? l2 += t3 / 2 * this.options.speedMultiplier : l2 = l2 > e3 ? e3 : 0);
195
+ l2 -= e3 * this.options.speedMultiplier;
196
+ let t3 = this.__maxScrollLeft;
197
+ (l2 > t3 || l2 < 0) && (this.options.bouncing ? l2 += e3 / 2 * this.options.speedMultiplier : l2 = l2 > t3 ? t3 : 0);
198
198
  }
199
199
  if (this.__enableScrollY) {
200
200
  a2 -= s2 * this.options.speedMultiplier;
201
- const t4 = this.__maxScrollTop;
202
- (a2 > t4 || a2 < 0) && (this.options.bouncing ? a2 += s2 / 2 * this.options.speedMultiplier : a2 = a2 > t4 ? t4 : 0);
201
+ const e4 = this.__maxScrollTop;
202
+ (a2 > e4 || a2 < 0) && (this.options.bouncing ? a2 += s2 / 2 * this.options.speedMultiplier : a2 = a2 > e4 ? e4 : 0);
203
203
  }
204
- r2.length > 60 && r2.splice(0, 30), r2.push(l2, a2, e2), this.__publish(l2, a2, c2);
204
+ r2.length > 60 && r2.splice(0, 30), r2.push(l2, a2, t2), this.__publish(l2, a2, c2);
205
205
  } else {
206
- let t3 = this.options.locking ? 3 : 0, n3 = 5, s2 = Math.abs(o2 - this.__initialTouchLeft), l2 = Math.abs(i2 - this.__initialTouchTop);
207
- 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);
206
+ let e3 = this.options.locking ? 3 : 0, n3 = 5, s2 = Math.abs(o2 - this.__initialTouchLeft), l2 = Math.abs(i2 - this.__initialTouchTop);
207
+ 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);
208
208
  }
209
- this.__lastTouchLeft = o2, this.__lastTouchTop = i2, this.__lastTouchMove = e2, this.__lastScale = n2;
209
+ this.__lastTouchLeft = o2, this.__lastTouchTop = i2, this.__lastTouchMove = t2, this.__lastScale = n2;
210
210
  }
211
- doTouchEnd(t2) {
212
- if (t2 instanceof Date && (t2 = t2.valueOf()), "number" != typeof t2) throw new Error("Invalid timestamp value: " + t2);
211
+ doTouchEnd(e2) {
212
+ if (e2 instanceof Date && (e2 = e2.valueOf()), "number" != typeof e2) throw new Error("Invalid timestamp value: " + e2);
213
213
  if (this.__isTracking) {
214
- if (this.__isTracking = false, this.__isDragging) if (this.__isDragging = false, this.__isSingleTouch && this.options.animating && t2 - this.__lastTouchMove <= 100) {
215
- let e2 = this.__positions, n2 = e2.length - 1, o2 = n2;
216
- for (let t3 = n2; t3 > 0 && e2[t3] > this.__lastTouchMove - 100; t3 -= 3) o2 = t3;
214
+ if (this.__isTracking = false, this.__isDragging) if (this.__isDragging = false, this.__isSingleTouch && this.options.animating && e2 - this.__lastTouchMove <= 100) {
215
+ let t2 = this.__positions, n2 = t2.length - 1, o2 = n2;
216
+ for (let e3 = n2; e3 > 0 && t2[e3] > this.__lastTouchMove - 100; e3 -= 3) o2 = e3;
217
217
  if (o2 !== n2) {
218
- const i2 = e2[n2] - e2[o2], r2 = this.__scrollLeft - e2[o2 - 2], s2 = this.__scrollTop - e2[o2 - 1];
218
+ const i2 = t2[n2] - t2[o2], r2 = this.__scrollLeft - t2[o2 - 2], s2 = this.__scrollTop - t2[o2 - 1];
219
219
  this.__decelerationVelocityX = r2 / i2 * (1e3 / 60), this.__decelerationVelocityY = s2 / i2 * (1e3 / 60);
220
220
  const l2 = this.options.paging || this.options.snapping ? 4 : 1;
221
- (Math.abs(this.__decelerationVelocityX) > l2 || Math.abs(this.__decelerationVelocityY) > l2) && this.__startDeceleration(t2);
221
+ (Math.abs(this.__decelerationVelocityX) > l2 || Math.abs(this.__decelerationVelocityY) > l2) && this.__startDeceleration(e2);
222
222
  } else this.options.scrollingComplete?.();
223
- } else t2 - this.__lastTouchMove > 100 && this.options.scrollingComplete?.();
223
+ } else e2 - this.__lastTouchMove > 100 && this.options.scrollingComplete?.();
224
224
  this.__isDecelerating || ((this.__interruptedAnimation || this.__isDragging) && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, true, this.__zoomLevel)), this.__positions.length = 0;
225
225
  }
226
226
  }
227
- __publish(t2, e2, n2, o2 = false) {
227
+ __publish(e2, t2, n2, o2 = false) {
228
228
  const i2 = this.__isAnimating;
229
- if (i2 && (F(i2), this.__isAnimating = 0), o2 && this.options.animating) {
230
- this.__scheduledLeft = t2, this.__scheduledTop = e2, this.__scheduledZoom = n2;
231
- const o3 = this.__scrollLeft, r2 = this.__scrollTop, s2 = this.__zoomLevel, l2 = t2 - o3, a2 = e2 - r2, c2 = n2 - s2, h2 = function(t3, e3, n3) {
232
- 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));
233
- }.bind(this), u2 = function(t3) {
234
- return this.__isAnimating === t3;
235
- }.bind(this), d2 = function(t3, e3, n3) {
236
- e3 === this.__isAnimating && (this.__isAnimating = false), (this.__didDecelerationComplete || n3) && this.options.scrollingComplete?.(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
229
+ if (i2 && (X(i2), this.__isAnimating = 0), o2 && this.options.animating) {
230
+ this.__scheduledLeft = e2, this.__scheduledTop = t2, this.__scheduledZoom = n2;
231
+ const o3 = this.__scrollLeft, r2 = this.__scrollTop, s2 = this.__zoomLevel, l2 = e2 - o3, a2 = t2 - r2, c2 = n2 - s2, h2 = function(e3, t3, n3) {
232
+ 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));
233
+ }.bind(this), u2 = function(e3) {
234
+ return this.__isAnimating === e3;
235
+ }.bind(this), d2 = function(e3, t3, n3) {
236
+ t3 === this.__isAnimating && (this.__isAnimating = false), (this.__didDecelerationComplete || n3) && this.options.scrollingComplete?.(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
237
237
  }.bind(this);
238
- this.__isAnimating = R(h2, u2, d2, this.options.animationDuration, i2 ? I : Y);
239
- } 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));
238
+ this.__isAnimating = j(h2, u2, d2, this.options.animationDuration, i2 ? U : Z);
239
+ } 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));
240
240
  }
241
- __computeScrollMax(t2 = this.__zoomLevel) {
242
- this.__maxScrollLeft = Math.max(this.__contentWidth * t2 - this.__clientWidth, 0), this.__maxScrollTop = Math.max(this.__contentHeight * t2 - this.__clientHeight, 0);
241
+ __computeScrollMax(e2 = this.__zoomLevel) {
242
+ this.__maxScrollLeft = Math.max(this.__contentWidth * e2 - this.__clientWidth, 0), this.__maxScrollTop = Math.max(this.__contentHeight * e2 - this.__clientHeight, 0);
243
243
  }
244
- __startDeceleration(t2) {
244
+ __startDeceleration(e2) {
245
245
  if (this.options.paging) {
246
- 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;
247
- 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;
246
+ 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;
247
+ 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;
248
248
  } else this.__minDecelerationScrollLeft = 0, this.__minDecelerationScrollTop = 0, this.__maxDecelerationScrollLeft = this.__maxScrollLeft, this.__maxDecelerationScrollTop = this.__maxScrollTop;
249
- const e2 = function(t3, e3, n3) {
249
+ const t2 = function(e3, t3, n3) {
250
250
  this.__stepThroughDeceleration(n3);
251
251
  }.bind(this), n2 = this.options.snapping ? 4 : 0.1, o2 = function() {
252
- const t3 = Math.abs(this.__decelerationVelocityX) >= n2 || Math.abs(this.__decelerationVelocityY) >= n2;
253
- return t3 || (this.__didDecelerationComplete = true), t3;
254
- }.bind(this), i2 = function(t3, e3, n3) {
252
+ const e3 = Math.abs(this.__decelerationVelocityX) >= n2 || Math.abs(this.__decelerationVelocityY) >= n2;
253
+ return e3 || (this.__didDecelerationComplete = true), e3;
254
+ }.bind(this), i2 = function(e3, t3, n3) {
255
255
  this.__isDecelerating = 0, this.__didDecelerationComplete && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping);
256
256
  }.bind(this);
257
- this.__isDecelerating = R(e2, o2, i2);
257
+ this.__isDecelerating = j(t2, o2, i2);
258
258
  }
259
- __stepThroughDeceleration(t2) {
260
- let e2 = this.__scrollLeft + this.__decelerationVelocityX, n2 = this.__scrollTop + this.__decelerationVelocityY;
259
+ __stepThroughDeceleration(e2) {
260
+ let t2 = this.__scrollLeft + this.__decelerationVelocityX, n2 = this.__scrollTop + this.__decelerationVelocityY;
261
261
  if (!this.options.bouncing) {
262
- const t3 = Math.max(Math.min(this.__maxDecelerationScrollLeft, e2), this.__minDecelerationScrollLeft);
263
- t3 !== e2 && (e2 = t3, this.__decelerationVelocityX = 0);
262
+ const e3 = Math.max(Math.min(this.__maxDecelerationScrollLeft, t2), this.__minDecelerationScrollLeft);
263
+ e3 !== t2 && (t2 = e3, this.__decelerationVelocityX = 0);
264
264
  const o2 = Math.max(Math.min(this.__maxDecelerationScrollTop, n2), this.__minDecelerationScrollTop);
265
265
  o2 !== n2 && (n2 = o2, this.__decelerationVelocityY = 0);
266
266
  }
267
- if (t2 ? this.__publish(e2, n2, this.__zoomLevel) : (this.__scrollLeft = e2, this.__scrollTop = n2), !this.options.paging) {
268
- const t3 = 0.95;
269
- this.__decelerationVelocityX *= t3, this.__decelerationVelocityY *= t3;
267
+ if (e2 ? this.__publish(t2, n2, this.__zoomLevel) : (this.__scrollLeft = t2, this.__scrollTop = n2), !this.options.paging) {
268
+ const e3 = 0.95;
269
+ this.__decelerationVelocityX *= e3, this.__decelerationVelocityY *= e3;
270
270
  }
271
271
  if (this.options.bouncing) {
272
- let t3 = 0, o2 = 0, i2 = this.options.penetrationDeceleration, r2 = this.options.penetrationAcceleration;
273
- 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);
272
+ let e3 = 0, o2 = 0, i2 = this.options.penetrationDeceleration, r2 = this.options.penetrationAcceleration;
273
+ 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);
274
274
  }
275
275
  }
276
276
  }
277
- const j = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), U = {};
278
- function Z() {
279
- return b;
277
+ const q = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), J = {};
278
+ function Q() {
279
+ return E;
280
280
  }
281
- const G = (t2) => "BracketLeft" === t2 ? "[" : "BracketRight" === t2 ? "]" : g.camelToPrettyCase(t2), q = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: U, boundPixel: function(t2, e2 = false, n2 = 0) {
282
- return t2;
283
- }, createSyntheticEvent: (t2) => {
284
- let e2 = false, n2 = false;
285
- 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: () => {
286
- e2 = true, t2.preventDefault();
287
- }, isDefaultPrevented: () => e2, stopPropagation: () => {
288
- n2 = true, t2.stopPropagation();
281
+ const ee = (e2) => "BracketLeft" === e2 ? "[" : "BracketRight" === e2 ? "]" : v.camelToPrettyCase(e2), te = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: J, boundPixel: function(e2, t2 = false, n2 = 0) {
282
+ return e2;
283
+ }, createSyntheticEvent: (e2) => {
284
+ let t2 = false, n2 = false;
285
+ 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: () => {
286
+ t2 = true, e2.preventDefault();
287
+ }, isDefaultPrevented: () => t2, stopPropagation: () => {
288
+ n2 = true, e2.stopPropagation();
289
289
  }, isPropagationStopped: () => n2, persist: () => {
290
- }, timeStamp: t2.timeStamp, type: t2.type };
291
- }, detectIt: Z, focusableNodeNames: j, toPrettyKeyCode: G }, Symbol.toStringTag, { value: "Module" })), J = [];
292
- function Q(t2, e2, n2 = J) {
290
+ }, timeStamp: e2.timeStamp, type: e2.type };
291
+ }, detectIt: Q, focusableNodeNames: q, toPrettyKeyCode: ee }, Symbol.toStringTag, { value: "Module" })), ne = [];
292
+ function oe(e2, t2, n2 = ne) {
293
293
  const o2 = r(null);
294
- return u(t2, () => {
294
+ return u(e2, () => {
295
295
  if (!o2.current) return;
296
- const t3 = o2.current, n3 = e2?.();
296
+ const e3 = o2.current, n3 = t2?.();
297
297
  if (!n3 || "object" != typeof n3) throw new Error("attributes must return a plain object of values");
298
298
  const i2 = Object.keys(n3), r2 = i2.length;
299
- for (let e3 = 0; e3 < r2; e3++) {
300
- const o3 = i2[e3], r3 = n3[o3];
301
- Object.defineProperty(t3, o3, { value: r3, writable: true, configurable: true, enumerable: true });
299
+ for (let t3 = 0; t3 < r2; t3++) {
300
+ const o3 = i2[t3], r3 = n3[o3];
301
+ Object.defineProperty(e3, o3, { value: r3, writable: true, configurable: true, enumerable: true });
302
302
  }
303
- return t3;
303
+ return e3;
304
304
  }, n2), o2;
305
305
  }
306
- const tt = (e2) => t(O, { ...e2 }), et = ({ width: e2, height: n2 }) => t("div", { className: "corner", style: { minWidth: `${e2}px`, width: `${e2}px`, minHeight: `${n2}px`, height: `${n2}px` } }), nt = s(l((o2, s2) => {
307
- const { children: l2, viewport: a2, onScrollViewport: u2, showHorizontalScrollbar: d2 = true, showVerticalScrollbar: _2 = true, createScrollCorner: p2 = et, createHorizontalScrollbar: m2 = tt, createVerticalScrollbar: g2 = tt, style: y2, touchElement: v2, disableTouch: x2, ...b2 } = o2, w2 = P(u2, [u2]), S2 = Q(s2, () => ({ isScrollPane: () => true }), []), L2 = r(null);
306
+ const ie = (t2) => e(I, { ...t2 }), re = ({ width: t2, height: n2 }) => e("div", { className: "corner", style: { minWidth: `${t2}px`, width: `${t2}px`, minHeight: `${n2}px`, height: `${n2}px` } }), se = s(l((o2, s2) => {
307
+ const { children: l2, viewport: a2, onScrollViewport: u2, showHorizontalScrollbar: d2 = true, showVerticalScrollbar: _2 = true, createScrollCorner: p2 = re, createHorizontalScrollbar: m2 = ie, createVerticalScrollbar: f2 = ie, style: g2, touchElement: v2, disableTouch: x2, ...w2 } = o2, b2 = B(u2, [u2]), S2 = oe(s2, () => ({ isScrollPane: () => true }), []), L2 = r(null);
308
308
  c(() => {
309
309
  L2.current && (L2.current.__scrollTop === a2?.top && L2.current.__scrollLeft === a2?.left || L2.current.__isDecelerating || L2.current?.scrollTo(a2?.left, a2?.top, false));
310
310
  }, [a2?.left, a2?.top, v2]);
311
- const E2 = i((t2, e2) => {
312
- w2?.({ left: t2, top: e2 });
313
- }, []), C2 = i((t2) => {
314
- L2.current?.doTouchStart(t2.touches, t2.timeStamp);
315
- }, []), T2 = i((t2) => {
316
- t2.preventDefault(), L2.current?.doTouchMove(t2.touches, t2.timeStamp);
317
- }, []), M2 = i((t2) => {
318
- L2.current?.doTouchEnd(t2.timeStamp);
319
- }, []), z2 = i(({ containerWidth: t2, containerHeight: e2, totalWidth: n2, totalHeight: o3 }) => {
320
- L2.current.setDimensions(t2, e2, n2, o3);
311
+ const E2 = i((e2, t2) => {
312
+ b2?.({ left: e2, top: t2 });
313
+ }, []), C2 = i((e2) => {
314
+ L2.current?.doTouchStart(e2.touches, e2.timeStamp);
315
+ }, []), T2 = i((e2) => {
316
+ e2.preventDefault(), L2.current?.doTouchMove(e2.touches, e2.timeStamp);
317
+ }, []), M2 = i((e2) => {
318
+ L2.current?.doTouchEnd(e2.timeStamp);
319
+ }, []), D2 = i(({ containerWidth: e2, containerHeight: t2, totalWidth: n2, totalHeight: o3 }) => {
320
+ L2.current.setDimensions(e2, t2, n2, o3);
321
321
  }, []);
322
322
  c(() => {
323
- const t2 = v2 ?? S2.current;
324
- if (!x2 && Z().supportsTouchEvents && t2 && a2) {
323
+ const e2 = v2 ?? S2.current;
324
+ if (!x2 && Q().supportsTouchEvents && e2 && a2) {
325
325
  if (!L2.current) {
326
- const t3 = { scrollingX: true, scrollingY: true, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
327
- L2.current = new X(E2, t3);
326
+ const e3 = { scrollingX: true, scrollingY: true, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
327
+ L2.current = new G(E2, e3);
328
328
  }
329
- Z().supportsTouchEvents && (t2.addEventListener("touchstart", C2), t2.addEventListener("touchend", M2), t2.addEventListener("touchmove", T2)), z2({ containerWidth: a2?.width, containerHeight: a2?.height, totalWidth: a2?.totalWidth, totalHeight: a2?.totalHeight });
329
+ Q().supportsTouchEvents && (e2.addEventListener("touchstart", C2), e2.addEventListener("touchend", M2), e2.addEventListener("touchmove", T2)), D2({ containerWidth: a2?.width, containerHeight: a2?.height, totalWidth: a2?.totalWidth, totalHeight: a2?.totalHeight });
330
330
  }
331
331
  return () => {
332
- t2?.removeEventListener("touchstart", C2), t2?.removeEventListener("touchend", M2), t2?.removeEventListener("touchmove", T2);
332
+ e2?.removeEventListener("touchstart", C2), e2?.removeEventListener("touchend", M2), e2?.removeEventListener("touchmove", T2);
333
333
  };
334
334
  }, [a2?.width, a2?.height, a2?.totalWidth, a2?.totalHeight, x2, v2]);
335
- const [k2, { width: A2 }] = f(), [B2, { height: $2 }] = f(), K2 = h(() => {
336
- const e2 = g2({ orientation: D.Vertical, offset: a2?.top, viewportSize: a2?.height, totalSize: a2?.totalHeight, onScrollOffset: (t2) => {
337
- w2?.({ top: t2 });
335
+ const [P2, { width: z2 }] = y(), [k2, { height: $2 }] = y(), O2 = h(() => {
336
+ const t2 = f2({ orientation: A.Vertical, offset: a2?.top, viewportSize: a2?.height, totalSize: a2?.totalHeight, onScrollOffset: (e2) => {
337
+ b2?.({ top: e2 });
338
338
  } });
339
- return t("div", { style: { display: "flex", flex: "0" }, ref: k2, children: e2 });
340
- }, [g2, a2?.top, a2?.height, a2?.totalHeight]), O2 = h(() => {
341
- const o3 = m2({ orientation: D.Horizontal, offset: a2?.left, viewportSize: a2?.width, totalSize: a2?.totalWidth, onScrollOffset: (t2) => w2?.({ left: t2 }) });
342
- return e("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% - ${A2}px)` }, children: t("div", { ref: B2, className: "sizer", children: o3 }) }), _2 ? p2({ width: A2, height: $2 }) : t(n, {})] });
343
- }, [m2, a2?.left, a2?.width, a2?.totalWidth, _2, p2, A2, $2]);
344
- return t("div", { style: { position: "relative", display: "flex", minWidth: _2 ? `${A2}px` : void 0, minHeight: d2 ? `${$2}px` : void 0, ...y2 }, ...b2, ref: S2, children: e("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [e("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [t("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: l2 }), _2 ? K2 : t(n, {})] }), d2 ? O2 : t(n, {})] }) });
339
+ return e("div", { style: { display: "flex", flex: "0" }, ref: P2, children: t2 });
340
+ }, [f2, a2?.top, a2?.height, a2?.totalHeight]), K2 = h(() => {
341
+ const o3 = m2({ orientation: A.Horizontal, offset: a2?.left, viewportSize: a2?.width, totalSize: a2?.totalWidth, onScrollOffset: (e2) => b2?.({ left: e2 }) });
342
+ return t("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [e("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${z2}px)` }, children: e("div", { ref: k2, className: "sizer", children: o3 }) }), _2 ? p2({ width: z2, height: $2 }) : e(n, {})] });
343
+ }, [m2, a2?.left, a2?.width, a2?.totalWidth, _2, p2, z2, $2]);
344
+ return e("div", { style: { position: "relative", display: "flex", minWidth: _2 ? `${z2}px` : void 0, minHeight: d2 ? `${$2}px` : void 0, ...g2 }, ...w2, ref: S2, children: t("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [t("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [e("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: l2 }), _2 ? O2 : e(n, {})] }), d2 ? K2 : e(n, {})] }) });
345
345
  }));
346
- nt.displayName = "ScrollPane";
347
- const ot = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" }, it = /* @__PURE__ */ new Set(), rt = { showMessage: (t2, e2) => {
348
- if (e2?.onceKey) {
349
- if (it.has(e2.onceKey)) return;
350
- it.add(e2.onceKey);
351
- }
352
- let n2 = console.log;
353
- e2?.type !== ot.Warning && e2?.type !== ot.Error || (n2 = console.warn), n2(t2);
354
- }, showBusy: (t2, e2) => new Promise((t3) => {
355
- t3(() => {
356
- });
357
- }), showError: (t2) => {
358
- console.error(t2);
359
- } };
360
- let st = 0;
361
- function lt() {
362
- const [t2, e2] = a(!!document.fullscreenElement), n2 = i(() => {
363
- const t3 = document.fullscreenElement;
364
- return t3 ? t3.querySelector(".fullscreen-portal-root") || t3 : document.body;
346
+ se.displayName = "ScrollPane";
347
+ let le = 0;
348
+ function ae() {
349
+ const [e2, t2] = a(!!document.fullscreenElement), n2 = i(() => {
350
+ const e3 = document.fullscreenElement;
351
+ return e3 ? e3.querySelector(".fullscreen-portal-root") || e3 : document.body;
365
352
  }, []);
366
353
  return c(() => {
367
- function t3() {
368
- const t4 = document.fullscreenElement;
369
- if (e2(!!t4), !t4) return;
370
- let n3 = t4.querySelector(".fullscreen-portal-root");
371
- n3 || (n3 = document.createElement("div"), n3.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", t4.appendChild(n3));
354
+ function e3() {
355
+ const e4 = document.fullscreenElement;
356
+ if (t2(!!e4), !e4) return;
357
+ let n3 = e4.querySelector(".fullscreen-portal-root");
358
+ n3 || (n3 = document.createElement("div"), n3.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", e4.appendChild(n3));
372
359
  }
373
- return st++, t3(), document.addEventListener("fullscreenchange", t3), () => {
374
- document.removeEventListener("fullscreenchange", t3), st--, st <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((t4) => {
375
- t4.parentNode && t4.parentNode.removeChild(t4);
376
- }), st = 0);
360
+ return le++, e3(), document.addEventListener("fullscreenchange", e3), () => {
361
+ document.removeEventListener("fullscreenchange", e3), le--, le <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((e4) => {
362
+ e4.parentNode && e4.parentNode.removeChild(e4);
363
+ }), le = 0);
377
364
  };
378
- }, []), { getPortalContainer: n2, isFullscreen: t2 };
365
+ }, []), { getPortalContainer: n2, isFullscreen: e2 };
379
366
  }
380
- const at = 100, ct = 100, ht = 1e6, ut = 100, dt = 50, _t = s(l((e2, n2) => {
381
- const { offset: o2 = 0, viewportSize: s2 = 0, totalSize: l2 = 0, minSize: c2 = 0, endGap: h2 = at, endScrollIncrement: u2 = ct, style: _2 = U, onMouseDown: p2, onScrollOffset: m2, onScroll: f2, scaleLimit: g2 = ht, scaleFactor: y2 = ut, precisionFactor: v2 = dt, ...x2 } = e2;
367
+ const ce = 100, he = 100, ue = 1e6, de = 100, _e = 50, pe = s(l((t2, n2) => {
368
+ const { offset: o2 = 0, viewportSize: s2 = 0, totalSize: l2 = 0, minSize: c2 = 0, endGap: h2 = ce, endScrollIncrement: u2 = he, style: _2 = J, onMouseDown: p2, onScrollOffset: m2, onScroll: f2, scaleLimit: g2 = ue, scaleFactor: y2 = de, precisionFactor: v2 = _e, ...x2 } = t2;
382
369
  f2 && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
383
- const b2 = P(p2, [p2]), w2 = () => ({ offset: o2, totalSize: 0 === g2 ? l2 : Math.min(l2 ?? 0, Math.max(c2 ?? 0, (o2 ?? 0) + (s2 ?? 0)) + (h2 ?? 0)) }), [S2, L2] = a(w2), E2 = 0 !== g2 && S2.totalSize > g2 ? y2 : 1, C2 = E2 / v2, T2 = Math.ceil(S2.totalSize / E2), M2 = Math.ceil(S2.offset / E2), D2 = Math.ceil(s2 / E2), z2 = i((t2) => {
384
- }, []), [k2, A2] = a(false), B2 = r(null);
370
+ const w2 = B(p2, [p2]), b2 = () => ({ offset: o2, totalSize: 0 === g2 ? l2 : Math.min(l2 ?? 0, Math.max(c2 ?? 0, (o2 ?? 0) + (s2 ?? 0)) + (h2 ?? 0)) }), [S2, L2] = a(b2), E2 = 0 !== g2 && S2.totalSize > g2 ? y2 : 1, C2 = E2 / v2, T2 = Math.ceil(S2.totalSize / E2), M2 = Math.ceil(S2.offset / E2), D2 = Math.ceil(s2 / E2), P2 = i((e2) => {
371
+ }, []), [z2, k2] = a(false), A2 = r(null);
385
372
  d(() => {
386
- if (!k2) {
387
- B2.current = { propTotalSize: l2, propViewportSize: s2, propOffset: o2 };
388
- const t2 = w2();
389
- L2(t2);
373
+ if (!z2) {
374
+ A2.current = { propTotalSize: l2, propViewportSize: s2, propOffset: o2 };
375
+ const e2 = b2();
376
+ L2(e2);
390
377
  }
391
- }, [l2, s2, o2, k2, c2, h2, u2]);
392
- const $2 = P((t2, e3, n3) => {
393
- const i2 = B2.current;
394
- B2.current = null, i2 && i2.propTotalSize === l2 && i2.propViewportSize === s2 && i2.propOffset === o2 || (Math.abs(t2 - M2) < C2 && (t2 = M2), m2?.(t2 * E2, M2, D2));
395
- }, [m2, E2, C2, M2, D2]), K2 = i((t2) => {
396
- document.removeEventListener("mousemove", z2), document.removeEventListener("mouseup", K2), A2(false);
397
- }, []), V2 = i((t2) => {
398
- b2?.(t2), A2(true), document.addEventListener("mousemove", z2, { passive: true }), document.addEventListener("mouseup", K2, { passive: true });
399
- }, [z2, K2]);
400
- return t(O, { ref: n2, style: { ..._2 }, ...x2, offset: M2, totalSize: T2, viewportSize: D2, onMouseDown: V2, onScrollOffset: $2 });
378
+ }, [l2, s2, o2, z2, c2, h2, u2]);
379
+ const $2 = B((e2, t3, n3) => {
380
+ const i2 = A2.current;
381
+ A2.current = null, i2 && i2.propTotalSize === l2 && i2.propViewportSize === s2 && i2.propOffset === o2 || (Math.abs(e2 - M2) < C2 && (e2 = M2), m2?.(e2 * E2, M2, D2));
382
+ }, [m2, E2, C2, M2, D2]), O2 = i((e2) => {
383
+ document.removeEventListener("mousemove", P2), document.removeEventListener("mouseup", O2), k2(false);
384
+ }, []), K2 = i((e2) => {
385
+ w2?.(e2), k2(true), document.addEventListener("mousemove", P2, { passive: true }), document.addEventListener("mouseup", O2, { passive: true });
386
+ }, [P2, O2]);
387
+ return e(I, { ref: n2, style: { ..._2 }, ...x2, offset: M2, totalSize: T2, viewportSize: D2, onMouseDown: K2, onScrollOffset: $2 });
401
388
  }));
402
- _t.displayName = "VirtualScrollbar";
403
- const pt = { 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" }, mt = s(l((e2, n2) => {
404
- const { refFocusStart: o2, ...s2 } = e2, l2 = r(null), a2 = i(() => {
389
+ pe.displayName = "VirtualScrollbar";
390
+ const me = { 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" }, fe = s(l((t2, n2) => {
391
+ const { refFocusStart: o2, ...s2 } = t2, l2 = r(null), a2 = i(() => {
405
392
  if (o2) return void o2?.current?.focus();
406
- const t2 = l2.current.parentElement.children;
407
- let e3 = [];
408
- for (let n3 = 0; n3 < t2.length && t2[n3] !== l2.current; n3++) {
409
- const o3 = t2[n3].getAttribute("tabindex");
393
+ const e2 = l2.current.parentElement.children;
394
+ let t3 = [];
395
+ for (let n3 = 0; n3 < e2.length && e2[n3] !== l2.current; n3++) {
396
+ const o3 = e2[n3].getAttribute("tabindex");
410
397
  if (null == o3 || "-1" === o3) continue;
411
- if ("true" === t2[n3].getAttribute("disabled")) continue;
412
- const i2 = t2[n3];
413
- i2.focus && e3.push({ tabindex: parseInt(o3), child: i2 });
398
+ if ("true" === e2[n3].getAttribute("disabled")) continue;
399
+ const i2 = e2[n3];
400
+ i2.focus && t3.push({ tabindex: parseInt(o3), child: i2 });
414
401
  }
415
- 0 !== e3.length && (e3.sort(function(t3, e4) {
416
- return t3.tabindex - e4.tabindex;
417
- }), e3[0].child.focus());
402
+ 0 !== t3.length && (t3.sort(function(e3, t4) {
403
+ return e3.tabindex - t4.tabindex;
404
+ }), t3[0].child.focus());
418
405
  }, [o2]);
419
- return t("div", { tabIndex: 0, ref: w([l2, n2]), onFocus: a2, ...s2 });
406
+ return e("div", { tabIndex: 0, ref: C([l2, n2]), onFocus: a2, ...s2 });
420
407
  }));
421
- const ft = s(l((i2, s2) => {
422
- const { className: l2, style: a2, children: c2, radius: u2 = 4, strokeWidth: d2 = 1, strokeColor: _2 = "grey", ...p2 } = i2, [m2, { width: g2, height: y2 }] = f(), v2 = r(null), x2 = (t2, e2 = 0) => {
423
- const n2 = t2 / 2, o2 = y2 - n2 + e2;
424
- return (function(t3, e3, n3 = false) {
425
- if (0 === e3) return t3;
426
- function o3(t4, e4, n4) {
427
- let o4 = e4.x - t4.x, r3 = e4.y - t4.y, s4 = Math.sqrt(o4 * o4 + r3 * r3);
428
- return i3(t4, e4, Math.min(1, n4 / s4));
408
+ const ge = s(l((i2, s2) => {
409
+ const { className: l2, style: a2, children: c2, radius: u2 = 4, strokeWidth: d2 = 1, strokeColor: _2 = "grey", ...p2 } = i2, [m2, { width: f2, height: g2 }] = y(), v2 = r(null), x2 = (e2, t2 = 0) => {
410
+ const n2 = e2 / 2, o2 = g2 - n2 + t2;
411
+ return (function(e3, t3, n3 = false) {
412
+ if (0 === t3) return e3;
413
+ function o3(e4, t4, n4) {
414
+ let o4 = t4.x - e4.x, r3 = t4.y - e4.y, s4 = Math.sqrt(o4 * o4 + r3 * r3);
415
+ return i3(e4, t4, Math.min(1, n4 / s4));
429
416
  }
430
- function i3(t4, e4, n4) {
431
- return { x: t4.x + (e4.x - t4.x) * n4, y: t4.y + (e4.y - t4.y) * n4 };
417
+ function i3(e4, t4, n4) {
418
+ return { x: e4.x + (t4.x - e4.x) * n4, y: e4.y + (t4.y - e4.y) * n4 };
432
419
  }
433
- function r2(t4, e4) {
434
- t4.length > 2 && (t4[t4.length - 2] = e4.x, t4[t4.length - 1] = e4.y);
420
+ function r2(e4, t4) {
421
+ e4.length > 2 && (e4[e4.length - 2] = t4.x, e4[e4.length - 1] = t4.y);
435
422
  }
436
- function s3(t4) {
437
- return { x: parseFloat(t4[t4.length - 2]), y: parseFloat(t4[t4.length - 1]) };
423
+ function s3(e4) {
424
+ return { x: parseFloat(e4[e4.length - 2]), y: parseFloat(e4[e4.length - 1]) };
438
425
  }
439
- let l3 = t3.split(/[,\s]/).reduce(function(t4, e4) {
440
- let n4 = e4.match("([a-zA-Z])(.+)");
441
- return n4 ? (t4.push(n4[1]), t4.push(n4[2])) : t4.push(e4), t4;
442
- }, []).reduce(function(t4, e4) {
443
- return parseFloat(e4) == e4 && t4.length ? t4[t4.length - 1].push(e4) : t4.push([e4]), t4;
426
+ let l3 = e3.split(/[,\s]/).reduce(function(e4, t4) {
427
+ let n4 = t4.match("([a-zA-Z])(.+)");
428
+ return n4 ? (e4.push(n4[1]), e4.push(n4[2])) : e4.push(t4), e4;
429
+ }, []).reduce(function(e4, t4) {
430
+ return parseFloat(t4) == t4 && e4.length ? e4[e4.length - 1].push(t4) : e4.push([t4]), e4;
444
431
  }, []), a3 = [];
445
432
  if (l3.length > 1) {
446
- let t4 = s3(l3[0]), c3 = null;
447
- "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]);
448
- for (let t5 = 1; t5 < l3.length; t5++) {
449
- let h2 = a3[a3.length - 1], u3 = l3[t5], d3 = u3 === c3 ? l3[1] : l3[t5 + 1];
433
+ let e4 = s3(l3[0]), c3 = null;
434
+ "Z" === l3[l3.length - 1][0] && l3[0].length > 2 && (c3 = ["L", e4.x, e4.y], l3[l3.length - 1] = c3), a3.push(l3[0]);
435
+ for (let e5 = 1; e5 < l3.length; e5++) {
436
+ let h2 = a3[a3.length - 1], u3 = l3[e5], d3 = u3 === c3 ? l3[1] : l3[e5 + 1];
450
437
  if (d3 && h2 && h2.length > 2 && "L" === u3[0] && d3.length > 2 && "L" === d3[0]) {
451
- let t6, l4, c4 = s3(h2), _3 = s3(u3), p3 = s3(d3);
452
- n3 ? (t6 = i3(_3, h2.origPoint || c4, e3), l4 = i3(_3, d3.origPoint || p3, e3)) : (t6 = o3(_3, c4, e3), l4 = o3(_3, p3, e3)), r2(u3, t6), u3.origPoint = _3, a3.push(u3);
453
- let m3 = i3(t6, _3, 0.5), f2 = i3(_3, l4, 0.5), g3 = ["C", m3.x, m3.y, f2.x, f2.y, l4.x, l4.y];
438
+ let e6, l4, c4 = s3(h2), _3 = s3(u3), p3 = s3(d3);
439
+ n3 ? (e6 = i3(_3, h2.origPoint || c4, t3), l4 = i3(_3, d3.origPoint || p3, t3)) : (e6 = o3(_3, c4, t3), l4 = o3(_3, p3, t3)), r2(u3, e6), u3.origPoint = _3, a3.push(u3);
440
+ let m3 = i3(e6, _3, 0.5), f3 = i3(_3, l4, 0.5), g3 = ["C", m3.x, m3.y, f3.x, f3.y, l4.x, l4.y];
454
441
  g3.origPoint = _3, a3.push(g3);
455
442
  } else a3.push(u3);
456
443
  }
457
444
  if (c3) {
458
- let t5 = s3(a3[a3.length - 1]);
459
- a3.push(["Z"]), r2(a3[0], t5);
445
+ let e5 = s3(a3[a3.length - 1]);
446
+ a3.push(["Z"]), r2(a3[0], e5);
460
447
  }
461
448
  } else a3 = l3;
462
- return a3.reduce(function(t4, e4) {
463
- return t4 + e4.join(" ") + " ";
449
+ return a3.reduce(function(e4, t4) {
450
+ return e4 + t4.join(" ") + " ";
464
451
  }, "");
465
- })(`${`M 0 ${n2} L ${u2 - 0.5} ${n2} L ${u2 - 0.5} ${o2} L ${2 * u2} ${o2}`} ${`L ${g2 - 2 * u2} ${o2}`} ${`M ${g2 - 2 * u2} ${o2} L ${g2 - u2} ${o2} L ${g2 - u2} ${n2} L ${g2} ${n2}`}`, u2);
466
- }, b2 = h(() => x2(d2), [g2, y2, u2, d2]), S2 = h(() => {
452
+ })(`${`M 0 ${n2} L ${u2 - 0.5} ${n2} L ${u2 - 0.5} ${o2} L ${2 * u2} ${o2}`} ${`L ${f2 - 2 * u2} ${o2}`} ${`M ${f2 - 2 * u2} ${o2} L ${f2 - u2} ${o2} L ${f2 - u2} ${n2} L ${f2} ${n2}`}`, u2);
453
+ }, w2 = h(() => x2(d2), [f2, g2, u2, d2]), b2 = h(() => {
467
454
  if (0 === u2) return;
468
- const t2 = u2 / 2;
469
- return x2(u2) + `L ${g2} 0 L 0 0 L 0 ${t2}`;
470
- }, [b2, u2, d2]), L2 = h(() => ({ style: { clipPath: `path('${S2}')` } }), [S2]);
471
- return e("div", { className: l2, style: { display: "flex", flexDirection: "row", ...a2 }, ...p2, ref: w([v2, m2, s2]), children: [o.isValidElement(c2) ? o.cloneElement(c2, L2) : t(n, {}), t("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: g2, height: y2, viewBox: `0 0 ${g2} ${y2}`, children: t("path", { d: b2, stroke: _2, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: d2 }) })] });
472
- })), gt = {}, yt = (e2) => {
473
- const { onPointerDown: n2, style: o2, splitDirection: i2, paddingBefore: r2 = 0, paddingAfter: s2 = 0, disabled: l2, key: a2, hitAreaProps: c2 = gt, ...h2 } = e2, u2 = "row" === i2, { style: d2, className: _2, ...p2 } = c2;
474
- return t("div", { style: { ...o2, position: "relative" }, ...h2, children: t("div", { className: m("hit-box", _2), 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, ...p2 }) }, a2);
475
- }, vt = {}, xt = (t2, e2, n2 = true) => null === t2 ? null : null !== t2.pixels ? n2 ? t2.pixels : e2 - t2.pixels : (n2 ? t2.percent : 100 - t2.percent) / 100 * e2, bt = (t2, e2 = true) => t2?.percent ? `${e2 ? t2.percent : 100 - t2.percent}%` : t2?.pixels ? `${t2.pixels}px` : void 0, wt = (t2, e2) => {
476
- if (null == t2) return null;
455
+ const e2 = u2 / 2;
456
+ return x2(u2) + `L ${f2} 0 L 0 0 L 0 ${e2}`;
457
+ }, [w2, u2, d2]), S2 = h(() => ({ style: { clipPath: `path('${b2}')` } }), [b2]);
458
+ return t("div", { className: l2, style: { display: "flex", flexDirection: "row", ...a2 }, ...p2, ref: C([v2, m2, s2]), children: [o.isValidElement(c2) ? o.cloneElement(c2, S2) : e(n, {}), e("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: f2, height: g2, viewBox: `0 0 ${f2} ${g2}`, children: e("path", { d: w2, stroke: _2, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: d2 }) })] });
459
+ })), ye = {}, ve = (t2) => {
460
+ const { onPointerDown: n2, style: o2, splitDirection: i2, paddingBefore: r2 = 0, paddingAfter: s2 = 0, disabled: l2, key: a2, hitAreaProps: c2 = ye, ...h2 } = t2, u2 = "row" === i2, { style: d2, className: _2, ...p2 } = c2;
461
+ return e("div", { style: { ...o2, position: "relative" }, ...h2, children: e("div", { className: g("hit-box", _2), 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, ...p2 }) }, a2);
462
+ }, xe = {}, we = (e2, t2, n2 = true) => null === e2 ? null : null !== e2.pixels ? n2 ? e2.pixels : t2 - e2.pixels : (n2 ? e2.percent : 100 - e2.percent) / 100 * t2, be = (e2, t2 = true) => e2?.percent ? `${t2 ? e2.percent : 100 - e2.percent}%` : e2?.pixels ? `${e2.pixels}px` : void 0, Se = (e2, t2) => {
463
+ if (null == e2) return null;
477
464
  const n2 = { percent: null, pixels: null };
478
- let o2 = e2;
479
- 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);
480
- }, St = s(l((n2, i2) => {
481
- const { elementBefore: s2, elementAfter: l2, splitDirection: u2 = "row", fixedPane: d2 = null, position: _2, onPositionChange: p2, minBefore: g2, maxBefore: y2, minAfter: v2, maxAfter: x2, children: b2, className: S2, style: L2, disabled: E2 = false, onDragStart: C2, onDragResize: T2, onDragFinish: M2, resizerProps: D2 = vt, paneProps: z2 = vt, paneBeforeProps: k2 = vt, paneAfterProps: A2 = vt, createResizer: B2 = yt } = n2;
482
- if (b2) throw new Error("Use elementBefore and elementAfter instead of children.");
483
- const $2 = h(() => o.isValidElement(l2) && o.isValidElement(s2), [l2, s2]), K2 = h(() => {
484
- let t2 = null;
485
- d2 && ("before" === d2 ? t2 = 0 : "after" === d2 && (t2 = 1));
486
- const e2 = null === t2;
487
- return { fixedPaneOffset: t2, isPercent: e2, minBefore: wt(g2, e2), maxBefore: wt(y2, e2), minAfter: wt(v2, e2), maxAfter: wt(x2, e2) };
488
- }, [g2, y2, v2, x2]), O2 = P(p2, [p2]), [V2, H2] = a(() => wt(_2, null === d2));
465
+ let o2 = t2;
466
+ 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);
467
+ }, Le = s(l((n2, i2) => {
468
+ const { elementBefore: s2, elementAfter: l2, splitDirection: u2 = "row", fixedPane: d2 = null, position: _2, onPositionChange: p2, minBefore: m2, maxBefore: f2, minAfter: v2, maxAfter: x2, children: w2, className: b2, style: S2, disabled: L2 = false, onDragStart: E2, onDragResize: T2, onDragFinish: M2, resizerProps: D2 = xe, paneProps: P2 = xe, paneBeforeProps: z2 = xe, paneAfterProps: k2 = xe, createResizer: A2 = ve } = n2;
469
+ if (w2) throw new Error("Use elementBefore and elementAfter instead of children.");
470
+ const $2 = h(() => o.isValidElement(l2) && o.isValidElement(s2), [l2, s2]), O2 = h(() => {
471
+ let e2 = null;
472
+ d2 && ("before" === d2 ? e2 = 0 : "after" === d2 && (e2 = 1));
473
+ const t2 = null === e2;
474
+ return { fixedPaneOffset: e2, isPercent: t2, minBefore: Se(m2, t2), maxBefore: Se(f2, t2), minAfter: Se(v2, t2), maxAfter: Se(x2, t2) };
475
+ }, [m2, f2, v2, x2]), K2 = B(p2, [p2]), [V2, H2] = a(() => Se(_2, null === d2));
489
476
  c(() => {
490
- H2(wt(_2, null === d2));
477
+ H2(Se(_2, null === d2));
491
478
  }, [_2, d2]);
492
- const [W2, { width: N2, height: F2 }] = f(), [R2, { width: I2, height: Y2 }] = f(), X2 = "row" === u2 ? I2 : Y2, j2 = "row" === u2 ? N2 : F2, U2 = h(() => ((t2, e2, n3, o2) => {
479
+ const [W2, { width: I2, height: N2 }] = y(), [F2, { width: R2, height: Y2 }] = y(), X2 = "row" === u2 ? R2 : Y2, j2 = "row" === u2 ? I2 : N2, U2 = h(() => ((e2, t2, n3, o2) => {
493
480
  const i3 = [null, null], r2 = [null, null];
494
- if (t2 || (t2 = { percent: null === o2.fixedPaneOffset ? 50 : null, pixels: null === o2.fixedPaneOffset ? null : 0 }), 0 === e2) return null != t2?.pixels ? 1 !== o2.fixedPaneOffset ? (i3[0] = t2?.pixels, r2[1] = 100) : (i3[1] = t2?.pixels - n3, r2[0] = 100) : null != t2?.percent && (1 !== o2.fixedPaneOffset ? (r2[0] = t2?.percent, r2[1] = 100 - t2?.percent) : (r2[1] = t2?.percent, r2[0] = 100 - t2?.percent)), { percents: r2, pixels: i3, minBefore: bt(o2.minBefore, true), maxBefore: bt(o2.maxBefore, true), minAfter: bt(o2.minAfter), maxAfter: bt(o2.maxAfter) };
495
- let s3 = xt(t2, e2, 1 !== o2.fixedPaneOffset), l3 = e2 - n3, a2 = xt(o2.minBefore, l3, true) ?? 0, c2 = xt(o2.maxBefore, l3, true) ?? l3, h2 = 0, u3 = 0, d3 = 0, _3 = l3;
496
- h2 = (xt(o2.maxAfter, e2, false) ?? n3) - n3, u3 = xt(o2.minAfter, e2, false) ?? e2, d3 = Math.max(a2, h2), _3 = Math.min(c2, u3), s3 = Math.max(d3, Math.min(s3, _3)), u3 = Math.min(l3 - s3, xt(o2.maxAfter, l3 - s3, true) ?? l3), h2 = Math.min(l3 - s3, xt(o2.minAfter, l3 - s3, true) ?? l3), i3[0] = s3, i3[1] = l3 - i3[0];
481
+ if (e2 || (e2 = { percent: null === o2.fixedPaneOffset ? 50 : null, pixels: null === o2.fixedPaneOffset ? null : 0 }), 0 === t2) return null != e2?.pixels ? 1 !== o2.fixedPaneOffset ? (i3[0] = e2?.pixels, r2[1] = 100) : (i3[1] = e2?.pixels - n3, r2[0] = 100) : null != e2?.percent && (1 !== o2.fixedPaneOffset ? (r2[0] = e2?.percent, r2[1] = 100 - e2?.percent) : (r2[1] = e2?.percent, r2[0] = 100 - e2?.percent)), { percents: r2, pixels: i3, minBefore: be(o2.minBefore, true), maxBefore: be(o2.maxBefore, true), minAfter: be(o2.minAfter), maxAfter: be(o2.maxAfter) };
482
+ let s3 = we(e2, t2, 1 !== o2.fixedPaneOffset), l3 = t2 - n3, a2 = we(o2.minBefore, l3, true) ?? 0, c2 = we(o2.maxBefore, l3, true) ?? l3, h2 = 0, u3 = 0, d3 = 0, _3 = l3;
483
+ h2 = (we(o2.maxAfter, t2, false) ?? n3) - n3, u3 = we(o2.minAfter, t2, false) ?? t2, d3 = Math.max(a2, h2), _3 = Math.min(c2, u3), s3 = Math.max(d3, Math.min(s3, _3)), u3 = Math.min(l3 - s3, we(o2.maxAfter, l3 - s3, true) ?? l3), h2 = Math.min(l3 - s3, we(o2.minAfter, l3 - s3, true) ?? l3), i3[0] = s3, i3[1] = l3 - i3[0];
497
484
  const p3 = Math.max(0, Math.min(100, s3 / l3 * 100));
498
485
  return r2[0] = p3, r2[1] = 100 - r2[0], { percents: r2, pixels: i3, minBefore: `${a2}px`, minAfter: `${h2}px`, maxBefore: `${i3[0]}px`, maxAfter: `${i3[1]}px` };
499
- })(V2, j2, X2, K2), [K2, V2, j2, X2, u2]), [Z2, G2] = a(false), q2 = P(C2, [C2]), J2 = P(T2, [T2]), tt2 = P(M2, [M2]), et2 = r(null), nt2 = r(null), ot2 = r(null), { style: it2, className: rt2, ...st2 } = z2, lt2 = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...it2 }, { className: at2, style: ct2, ...ht2 } = k2, { className: ut2, style: dt2, ..._t2 } = A2, pt2 = { flex: "1 1 100%", width: "100%", ...L2, flexDirection: u2, display: "flex" }, { className: mt2, style: ft2, onPointerDown: gt2, ...St2 } = D2, Lt2 = P((t2) => {
500
- const e2 = wt(t2, null === d2);
501
- H2(e2);
502
- }, [d2]), Et2 = P((t2) => {
503
- if (E2 || !Z2) return;
504
- const e2 = Mt2.current?.getBoundingClientRect();
486
+ })(V2, j2, X2, O2), [O2, V2, j2, X2, u2]), [Z2, G2] = a(false), q2 = B(E2, [E2]), J2 = B(T2, [T2]), Q2 = B(M2, [M2]), ee2 = r(null), te2 = r(null), ne2 = r(null), { style: ie2, className: re2, ...se2 } = P2, le2 = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...ie2 }, { className: ae2, style: ce2, ...he2 } = z2, { className: ue2, style: de2, ..._e2 } = k2, pe2 = { flex: "1 1 100%", width: "100%", ...S2, flexDirection: u2, display: "flex" }, { className: me2, style: fe2, onPointerDown: ge2, ...ye2 } = D2, Le2 = B((e2) => {
487
+ const t2 = Se(e2, null === d2);
488
+ H2(t2);
489
+ }, [d2]), Ee2 = B((e2) => {
490
+ if (L2 || !Z2) return;
491
+ const t2 = Me2.current?.getBoundingClientRect();
505
492
  let n3 = 0;
506
- n3 = "row" === u2 ? (t2.clientX ?? t2.touches?.[0]?.clientX) - e2.x : (t2.clientY ?? t2.touches?.[0]?.clientY) - e2.y, n3 = Math.max(0, Math.min(j2, n3)), 1 === K2.fixedPaneOffset && (n3 = j2 - n3), _2 && V2.pixels === n3 || H2({ pixels: n3, percent: null }), J2?.(n3), t2.stopPropagation(), t2.preventDefault();
507
- }, [K2, u2, E2, Z2, V2, j2]), Ct2 = P((t2) => {
508
- if (document.removeEventListener("pointermove", Et2), document.removeEventListener("touchmove", Et2), document.removeEventListener("pointerup", Ct2), !Z2) return;
493
+ n3 = "row" === u2 ? (e2.clientX ?? e2.touches?.[0]?.clientX) - t2.x : (e2.clientY ?? e2.touches?.[0]?.clientY) - t2.y, n3 = Math.max(0, Math.min(j2, n3)), 1 === O2.fixedPaneOffset && (n3 = j2 - n3), _2 && V2.pixels === n3 || H2({ pixels: n3, percent: null }), J2?.(n3), e2.stopPropagation(), e2.preventDefault();
494
+ }, [O2, u2, L2, Z2, V2, j2]), Ce2 = B((e2) => {
495
+ if (document.removeEventListener("pointermove", Ee2), document.removeEventListener("touchmove", Ee2), document.removeEventListener("pointerup", Ce2), !Z2) return;
509
496
  if (G2(false), !V2) return;
510
- tt2(V2.pixels);
511
- if (!wt(_2, null === d2) || V2.pixels !== _2) {
512
- const t3 = { ...V2 };
513
- null === t3.percent && (t3.percent = t3.pixels / j2 * 100), O2(t3);
497
+ Q2(V2.pixels);
498
+ if (!Se(_2, null === d2) || V2.pixels !== _2) {
499
+ const e3 = { ...V2 };
500
+ null === e3.percent && (e3.percent = e3.pixels / j2 * 100), K2(e3);
514
501
  }
515
- t2.stopPropagation(), t2.preventDefault();
516
- }, [V2, Z2, _2, d2, j2]), Tt2 = P((t2) => {
517
- gt2?.(t2), t2.defaultPrevented || E2 || Z2 || (G2(true), q2(), document.addEventListener("pointermove", Et2, { passive: false }), document.addEventListener("touchmove", Et2, { passive: false }), document.addEventListener("pointerup", Ct2, { passive: false }));
518
- }, [gt2]), Mt2 = Q(i2, () => ({ setPosition: Lt2, isSplitPane: () => true }), []), Dt2 = h(() => $2 ? B2?.({ key: "resizer", ref: w([R2, nt2]), className: m("resizer", mt2), onPointerDownCapture: Tt2, style: { cursor: E2 ? void 0 : "row" === u2 ? "ew-resize" : "ns-resize", minWidth: "row" === u2 ? "2px" : void 0, minHeight: "row" !== u2 ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...ft2 }, splitDirection: u2, disabled: E2, ...St2 }) : null, [$2, mt2, St2, u2, ft2, E2]), Pt2 = "row" === u2 ? "Width" : "Height", zt2 = { ...lt2, ...ct2, flex: 0 === K2.fixedPaneOffset && null !== U2?.pixels[0] ? `0 0 ${Math.round(U2?.pixels[0])}px` : `1 1 ${Math.round(U2?.percents[0] ?? 100)}%`, [`min${Pt2}`]: U2?.minBefore, [`max${Pt2}`]: l2 ? U2?.maxBefore : "100%" }, kt2 = { ...lt2, ...dt2, flex: 1 === K2.fixedPaneOffset && null !== U2?.pixels[1] ? `0 0 ${Math.round(U2?.pixels[1])}px` : `1 1 ${Math.round(U2?.percents[1] ?? 100)}%`, [`min${Pt2}`]: U2?.minAfter, [`max${Pt2}`]: s2 ? U2?.maxAfter : "100%" }, At2 = h(() => s2 ? t("div", { ref: et2, className: m("before", rt2, at2), style: zt2, ...st2, ...ht2, children: s2 }, "before") : null, [s2, z2, k2, K2, U2]), Bt2 = h(() => l2 ? t("div", { ref: ot2, className: m("after", rt2, ut2), style: kt2, ...st2, ..._t2, children: l2 }, "after") : null, [l2, z2, A2, K2, U2]);
519
- return e("div", { ref: w([W2, Mt2]), className: m("splitPane", "row" === u2 ? "vertical" : "horizontal", { dragging: Z2 }, S2), style: pt2, children: [At2, Dt2, Bt2] });
520
- }));
521
- function Lt(t2) {
522
- const [e2, n2] = a("undefined" != typeof window ? window.devicePixelRatio : 1), o2 = r(null);
502
+ e2.stopPropagation(), e2.preventDefault();
503
+ }, [V2, Z2, _2, d2, j2]), Te2 = B((e2) => {
504
+ ge2?.(e2), e2.defaultPrevented || L2 || Z2 || (G2(true), q2(), document.addEventListener("pointermove", Ee2, { passive: false }), document.addEventListener("touchmove", Ee2, { passive: false }), document.addEventListener("pointerup", Ce2, { passive: false }));
505
+ }, [ge2]), Me2 = oe(i2, () => ({ setPosition: Le2, isSplitPane: () => true }), []), De2 = h(() => $2 ? A2?.({ key: "resizer", ref: C([F2, te2]), className: g("resizer", me2), onPointerDownCapture: Te2, style: { cursor: L2 ? void 0 : "row" === u2 ? "ew-resize" : "ns-resize", minWidth: "row" === u2 ? "2px" : void 0, minHeight: "row" !== u2 ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...fe2 }, splitDirection: u2, disabled: L2, ...ye2 }) : null, [$2, me2, ye2, u2, fe2, L2]), Pe2 = "row" === u2 ? "Width" : "Height", ze2 = { ...le2, ...ce2, flex: 0 === O2.fixedPaneOffset && null !== U2?.pixels[0] ? `0 0 ${Math.round(U2?.pixels[0])}px` : `1 1 ${Math.round(U2?.percents[0] ?? 100)}%`, [`min${Pe2}`]: U2?.minBefore, [`max${Pe2}`]: l2 ? U2?.maxBefore : "100%" }, ke2 = { ...le2, ...de2, flex: 1 === O2.fixedPaneOffset && null !== U2?.pixels[1] ? `0 0 ${Math.round(U2?.pixels[1])}px` : `1 1 ${Math.round(U2?.percents[1] ?? 100)}%`, [`min${Pe2}`]: U2?.minAfter, [`max${Pe2}`]: s2 ? U2?.maxAfter : "100%" }, Ae2 = h(() => s2 ? e("div", { ref: ee2, className: g("before", re2, ae2), style: ze2, ...se2, ...he2, children: s2 }, "before") : null, [s2, P2, z2, O2, U2]), Be2 = h(() => l2 ? e("div", { ref: ne2, className: g("after", re2, ue2), style: ke2, ...se2, ..._e2, children: l2 }, "after") : null, [l2, P2, k2, O2, U2]);
506
+ return t("div", { ref: C([W2, Me2]), className: g("splitPane", "row" === u2 ? "vertical" : "horizontal", { dragging: Z2 }, b2), style: pe2, children: [Ae2, De2, Be2] });
507
+ })), Ee = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" };
508
+ class Ce extends x {
509
+ setDelegate(e2) {
510
+ super.setDelegate(e2);
511
+ }
512
+ getDelegate() {
513
+ return this._delegate;
514
+ }
515
+ showMessage(e2, t2) {
516
+ const n2 = this.getDelegate();
517
+ if (n2?.showMessage) return n2.showMessage(e2, t2);
518
+ t2?.type !== Ee.Warning ? t2?.type !== Ee.Error ? w.log(e2) : w.error(e2) : w.warn(e2);
519
+ }
520
+ showBusy(e2, t2) {
521
+ const n2 = this.getDelegate();
522
+ return n2?.showBusy ? n2.showBusy(e2, t2) : new Promise((e3) => {
523
+ e3(() => {
524
+ });
525
+ });
526
+ }
527
+ showWindow(e2, t2, n2) {
528
+ const o2 = this.getDelegate();
529
+ if (o2?.showWindow) return o2.showWindow(e2, t2, n2);
530
+ }
531
+ showError(e2) {
532
+ const t2 = this.getDelegate();
533
+ t2?.showError ? t2.showError(e2) : w.error(e2);
534
+ }
535
+ showOptions(e2) {
536
+ const t2 = this.getDelegate();
537
+ return t2?.showOptions ? t2.showOptions(e2) : Promise.resolve("");
538
+ }
539
+ showInputOptions(e2) {
540
+ const t2 = this.getDelegate();
541
+ return t2?.showInputOptions ? t2.showInputOptions(e2) : Promise.resolve({ input: "", option: "" });
542
+ }
543
+ }
544
+ const Te = _(new Ce()), Me = ({ children: e2, notifier: t2 }) => (o.useEffect(() => {
545
+ const e3 = w.getDelegate();
546
+ return w.setDelegate(t2), () => {
547
+ w.setDelegate(e3);
548
+ };
549
+ }, [t2]), o.createElement(Te.Provider, { value: t2 }, e2)), De = () => p(Te);
550
+ function Pe(e2) {
551
+ const [t2, n2] = a("undefined" != typeof window ? window.devicePixelRatio : 1), o2 = r(null);
523
552
  return c(() => {
524
553
  if (!("undefined" != typeof window && "matchMedia" in window)) return;
525
- const t3 = () => {
526
- const e3 = window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);
527
- e3.addEventListener("change", t3, { once: true, passive: true }), n2(window.devicePixelRatio), o2.current = { mediaMatcher: e3, listener: t3 };
554
+ const e3 = () => {
555
+ const t3 = window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);
556
+ t3.addEventListener("change", e3, { once: true, passive: true }), n2(window.devicePixelRatio), o2.current = { mediaMatcher: t3, listener: e3 };
528
557
  };
529
- return t3(), () => {
558
+ return e3(), () => {
530
559
  o2.current && o2.current.mediaMatcher.removeEventListener("change", o2.current.listener);
531
560
  };
532
- }, [t2]), e2;
561
+ }, [e2]), t2;
533
562
  }
534
- function Et(t2) {
563
+ function ze(e2) {
535
564
  if ("undefined" == typeof window) return 1;
536
- const { defaultDpr: e2 = 1, maxDpr: n2 = 3, round: o2 = true } = t2 || {}, i2 = "undefined" != typeof window && "number" == typeof window.devicePixelRatio ? window.devicePixelRatio : e2;
565
+ const { defaultDpr: t2 = 1, maxDpr: n2 = 3, round: o2 = true } = e2 || {}, i2 = "undefined" != typeof window && "number" == typeof window.devicePixelRatio ? window.devicePixelRatio : t2;
537
566
  return Math.min(Math.max(1, o2 ? Math.floor(i2) : i2), n2);
538
567
  }
539
- function Ct(t2, e2, n2) {
540
- const o2 = P(e2, [e2]);
568
+ function ke(e2, t2, n2) {
569
+ const o2 = B(t2, [t2]);
541
570
  c(() => {
542
- const e3 = (e4) => {
543
- t2.current && !t2.current.contains(e4.target) && o2(e4);
571
+ const t3 = (t4) => {
572
+ e2.current && !e2.current.contains(t4.target) && o2(t4);
544
573
  };
545
- return n2 && false === n2.mouseEvents || (document.addEventListener("mousedown", e3), document.addEventListener("touchstart", e3)), n2 && false === n2.focusEvents || document.addEventListener("focus", e3), () => {
546
- document.removeEventListener("mousedown", e3), document.removeEventListener("touchstart", e3), document.removeEventListener("focus", e3);
574
+ return n2 && false === n2.mouseEvents || (document.addEventListener("mousedown", t3), document.addEventListener("touchstart", t3)), n2 && false === n2.focusEvents || document.addEventListener("focus", t3), () => {
575
+ document.removeEventListener("mousedown", t3), document.removeEventListener("touchstart", t3), document.removeEventListener("focus", t3);
547
576
  };
548
- }, [t2]);
577
+ }, [e2]);
549
578
  }
550
- function Tt(t2) {
551
- if (!t2) throw new Error("must have a PointerHandlerOptions");
552
- const { onPointerDown: e2, onPointerUp: n2, onPointerMoveOrWait: o2, processTouch: s2 = false, consumeTouch: l2 = true } = t2, a2 = P(e2, [e2]), h2 = P(n2, [n2]), u2 = P(o2, [o2]), d2 = r(false), _2 = t2?.timerInitial ?? 230, p2 = t2?.timerContinuous ?? _2 / 2, m2 = r(null), f2 = r(null), g2 = r(null), y2 = r(null), v2 = i(() => {
579
+ function Ae(e2) {
580
+ if (!e2) throw new Error("must have a PointerHandlerOptions");
581
+ const { onPointerDown: t2, onPointerUp: n2, onPointerMoveOrWait: o2, processTouch: s2 = false, consumeTouch: l2 = true } = e2, a2 = B(t2, [t2]), h2 = B(n2, [n2]), u2 = B(o2, [o2]), d2 = r(false), _2 = e2?.timerInitial ?? 230, p2 = e2?.timerContinuous ?? _2 / 2, m2 = r(null), f2 = r(null), g2 = r(null), y2 = r(null), v2 = i(() => {
553
582
  y2.current && (clearTimeout(y2.current), y2.current = null);
554
- }, []), x2 = i((t3) => {
583
+ }, []), x2 = i((e3) => {
555
584
  y2.current = setTimeout(() => {
556
585
  window.requestAnimationFrame(() => {
557
586
  false !== d2.current && u2?.(f2.current, g2.current, m2.current);
558
587
  }), x2(p2);
559
- }, t3 ?? _2);
588
+ }, e3 ?? _2);
560
589
  }, []);
561
590
  c(() => () => v2(), []);
562
- const b2 = s2 ? "pointer" : "mouse", w2 = i((t3) => {
563
- t3.stopPropagation(), t3.stopImmediatePropagation(), t3.preventDefault();
564
- }, []), S2 = P((t3) => {
565
- document.removeEventListener(`${b2}move`, C2), document.removeEventListener(`${b2}up`, S2), document.removeEventListener("keydown", T2), document.removeEventListener("keyup", M2), document.removeEventListener("touchstart", w2, { capture: true }), document.removeEventListener("touchmove", w2, { capture: true }), window.removeEventListener("blur", L2), v2(), window.requestAnimationFrame(() => {
566
- false !== d2.current && (d2.current = false, h2?.(t3, g2.current, m2.current), g2.current = null);
591
+ const w2 = s2 ? "pointer" : "mouse", b2 = i((e3) => {
592
+ e3.stopPropagation(), e3.stopImmediatePropagation(), e3.preventDefault();
593
+ }, []), S2 = B((e3) => {
594
+ document.removeEventListener(`${w2}move`, C2), document.removeEventListener(`${w2}up`, S2), document.removeEventListener("keydown", T2), document.removeEventListener("keyup", M2), document.removeEventListener("touchstart", b2, { capture: true }), document.removeEventListener("touchmove", b2, { capture: true }), window.removeEventListener("blur", L2), v2(), window.requestAnimationFrame(() => {
595
+ false !== d2.current && (d2.current = false, h2?.(e3, g2.current, m2.current), g2.current = null);
567
596
  });
568
597
  }, []), L2 = i(() => {
569
598
  false !== d2.current && (d2.current = false, S2(f2.current));
570
- }, []), E2 = P(() => {
599
+ }, []), E2 = B(() => {
571
600
  v2(), x2(p2), window.requestAnimationFrame(() => {
572
601
  false !== d2.current && u2?.(f2.current, g2.current, m2.current);
573
602
  });
574
- }, [p2]), C2 = P((t3) => {
575
- f2.current = t3, E2();
576
- }, []), T2 = P((t3) => {
577
- g2.current = { ctrlKey: t3.ctrlKey, shiftKey: t3.shiftKey, altKey: t3.altKey, metaKey: t3.metaKey }, E2();
578
- }, []), M2 = P((t3) => {
579
- g2.current = { ctrlKey: t3.ctrlKey, shiftKey: t3.shiftKey, altKey: t3.altKey, metaKey: t3.metaKey }, E2();
603
+ }, [p2]), C2 = B((e3) => {
604
+ f2.current = e3, E2();
605
+ }, []), T2 = B((e3) => {
606
+ g2.current = { ctrlKey: e3.ctrlKey, shiftKey: e3.shiftKey, altKey: e3.altKey, metaKey: e3.metaKey }, E2();
607
+ }, []), M2 = B((e3) => {
608
+ g2.current = { ctrlKey: e3.ctrlKey, shiftKey: e3.shiftKey, altKey: e3.altKey, metaKey: e3.metaKey }, E2();
580
609
  }, [p2]);
581
- return P((t3) => {
582
- if (t3.isDefaultPrevented()) return;
583
- g2.current = { ctrlKey: t3.ctrlKey, shiftKey: t3.shiftKey, altKey: t3.altKey, metaKey: t3.metaKey };
584
- false !== a2(t3, g2.current) && (m2.current = t3, f2.current = t3.nativeEvent, document.addEventListener(`${b2}up`, S2, { passive: false }), document.addEventListener(`${b2}move`, C2, { passive: false }), document.addEventListener("keydown", T2, { passive: false }), document.addEventListener("keyup", M2, { passive: false }), window.addEventListener("blur", L2, { passive: true }), s2 && l2 && (document.addEventListener("touchstart", w2, { passive: false, capture: true }), document.addEventListener("touchmove", w2, { passive: false, capture: true })), d2.current = true, x2(_2));
610
+ return B((e3) => {
611
+ if (e3.isDefaultPrevented()) return;
612
+ g2.current = { ctrlKey: e3.ctrlKey, shiftKey: e3.shiftKey, altKey: e3.altKey, metaKey: e3.metaKey };
613
+ false !== a2(e3, g2.current) && (m2.current = e3, f2.current = e3.nativeEvent, document.addEventListener(`${w2}up`, S2, { passive: false }), document.addEventListener(`${w2}move`, C2, { passive: false }), document.addEventListener("keydown", T2, { passive: false }), document.addEventListener("keyup", M2, { passive: false }), window.addEventListener("blur", L2, { passive: true }), s2 && l2 && (document.addEventListener("touchstart", b2, { passive: false, capture: true }), document.addEventListener("touchmove", b2, { passive: false, capture: true })), d2.current = true, x2(_2));
585
614
  }, [_2, s2]);
586
615
  }
587
- function Mt(t2, e2) {
588
- return Tt({ onPointerDown: t2, onPointerMoveOrWait: (e3, n2, o2) => {
589
- t2?.(o2);
590
- }, ...e2 });
616
+ function Be(e2, t2) {
617
+ return Ae({ onPointerDown: e2, onPointerMoveOrWait: (t3, n2, o2) => {
618
+ e2?.(o2);
619
+ }, ...t2 });
591
620
  }
592
- const Dt = ({ initValue: t2, useHookBody: e2, applyStateChange: n2 }) => {
593
- const o2 = r(t2);
594
- if ("function" != typeof e2) throw new Error("function expected as hook body parameter. got " + typeof e2);
595
- const i2 = e2();
621
+ const $e = ({ initValue: e2, useHookBody: t2, applyStateChange: n2 }) => {
622
+ const o2 = r(e2);
623
+ if ("function" != typeof t2) throw new Error("function expected as hook body parameter. got " + typeof t2);
624
+ const i2 = t2();
596
625
  return d(() => {
597
626
  o2.current !== i2 && (o2.current = i2, n2(i2));
598
627
  }, [n2, i2]), null;
599
- }, Pt = (t2) => {
600
- console && console.warn && console.warn(t2);
601
- }, zt = "object" == typeof self && self.self === self && self || "object" == typeof global && global.global === global && global || void 0;
602
- let kt = 1, At = false, Bt = false;
603
- const $t = [], Kt = [], Ot = () => {
604
- Kt.forEach((t2) => t2());
605
- }, Vt = ({ automaticContainerInternalUseOnly: e2 }) => {
628
+ }, Oe = (e2) => {
629
+ console && console.warn && console.warn(e2);
630
+ }, Ke = "object" == typeof self && self.self === self && self || "object" == typeof global && global.global === global && global || void 0;
631
+ let Ve = 1, He = false, We = false;
632
+ const Ie = [], Ne = [], Fe = () => {
633
+ Ne.forEach((e2) => e2());
634
+ }, Re = ({ automaticContainerInternalUseOnly: t2 }) => {
606
635
  const [o2, i2] = a([]), s2 = r([]);
607
- return s2.current = o2, e2 || false !== At || (Bt = true), c(() => {
608
- let t2 = true;
636
+ return s2.current = o2, t2 || false !== He || (We = true), c(() => {
637
+ let e2 = true;
609
638
  function n2() {
610
- if (t2) return Kt[0] !== n2 ? (e2 || true !== At || Pt("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([...$t]);
639
+ if (e2) return Ne[0] !== n2 ? (t2 || true !== He || Oe("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void i2((e3) => [])) : void i2([...Ie]);
611
640
  }
612
- return Kt.push(n2), Ot(), () => {
613
- t2 = false, s2.current?.length > 0 && Pt("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), Kt.splice(Kt.indexOf(n2), 1), Ot();
641
+ return Ne.push(n2), Fe(), () => {
642
+ e2 = false, s2.current?.length > 0 && Oe("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), Ne.splice(Ne.indexOf(n2), 1), Fe();
614
643
  };
615
- }, [e2]), t(n, { children: o2.map(({ hook: t2, key: e3 }) => _(Dt, { ...t2, key: e3 })) });
616
- }, Ht = (e2) => {
617
- const n2 = kt++;
618
- return $t.push({ hook: e2, key: n2 }), 0 === Kt.length && false === Bt && (At = true, ((e3) => {
619
- if (zt.document && zt.document.createElement) {
620
- const n3 = zt.document.createElement("div");
621
- S(n3).render(t(e3, { automaticContainerInternalUseOnly: true }));
622
- } else Pt("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
623
- })(Vt)), Ot(), () => {
624
- $t.splice($t.findIndex((t2) => t2.key === n2), 1), Ot();
644
+ }, [t2]), e(n, { children: o2.map(({ hook: e2, key: t3 }) => m($e, { ...e2, key: t3 })) });
645
+ }, Ye = (t2) => {
646
+ const n2 = Ve++;
647
+ return Ie.push({ hook: t2, key: n2 }), 0 === Ne.length && false === We && (He = true, ((t3) => {
648
+ if (Ke.document && Ke.document.createElement) {
649
+ const n3 = Ke.document.createElement("div");
650
+ T(n3).render(e(t3, { automaticContainerInternalUseOnly: true }));
651
+ } else Oe("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
652
+ })(Re)), Fe(), () => {
653
+ Ie.splice(Ie.findIndex((e2) => e2.key === n2), 1), Fe();
625
654
  };
626
655
  };
627
- let Wt = null;
628
- Wt || (Wt = (t2, e2, n2 = {}) => {
656
+ let Xe = null;
657
+ Xe || (Xe = (e2, t2, n2 = {}) => {
629
658
  let o2, i2, r2 = false, s2 = false, l2 = [], { unmountIfNoConsumers: h2 = false } = n2;
630
- const u2 = (t3) => {
631
- i2 = t3, L(() => l2.forEach((e3) => e3(t3)));
632
- }, d2 = () => (s2 || (i2 = "function" == typeof t2 ? t2() : t2, s2 = true), i2);
659
+ const u2 = (e3) => {
660
+ i2 = e3, M(() => l2.forEach((t3) => t3(e3)));
661
+ }, d2 = () => (s2 || (i2 = "function" == typeof e2 ? e2() : e2, s2 = true), i2);
633
662
  return () => {
634
663
  const [n3, s3] = a(d2);
635
- return c(() => (r2 || (r2 = true, o2 = Ht({ initValue: t2, useHookBody: e2, applyStateChange: u2 })), l2.push(s3), i2 !== n3 && s3(i2), () => {
664
+ return c(() => (r2 || (r2 = true, o2 = Ye({ initValue: e2, useHookBody: t2, applyStateChange: u2 })), l2.push(s3), i2 !== n3 && s3(i2), () => {
636
665
  l2.splice(l2.indexOf(s3), 1), 0 === l2.length && h2 && (o2(), r2 = false);
637
666
  }), []), n3;
638
667
  };
639
668
  });
640
- const Nt = Wt;
641
- let Ft = () => {
669
+ const je = Xe;
670
+ let Ue = () => {
642
671
  console.warn("You must call useEditMode before setting its state.");
643
672
  };
644
- const Rt = Nt(null, () => {
645
- const [t2, e2] = a(null);
646
- return Ft = e2, t2;
647
- }), It = () => {
648
- const t2 = Rt();
649
- return h(() => ({ setMode: (t3) => {
650
- Ft((e2) => ("function" == typeof t3 && (t3 = t3(e2)), t3?.onModeChange?.(t3 ?? null), t3));
651
- }, getMode: () => t2 }), [t2]);
673
+ const Ze = je(null, () => {
674
+ const [e2, t2] = a(null);
675
+ return Ue = t2, e2;
676
+ }), Ge = () => {
677
+ const e2 = Ze();
678
+ return h(() => ({ setMode: (e3) => {
679
+ Ue((t2) => ("function" == typeof e3 && (e3 = e3(t2)), e3?.onModeChange?.(e3 ?? null), e3));
680
+ }, getMode: () => e2 }), [e2]);
652
681
  };
653
- class Yt {
654
- constructor(t2, e2, n2, o2) {
655
- 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 = () => {
682
+ class qe {
683
+ constructor(e2, t2, n2, o2) {
684
+ 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 = () => {
656
685
  console.log(`implement: ${this.label()} : ${this.description()}`);
657
686
  });
658
687
  }
659
688
  key() {
660
689
  return this._key;
661
690
  }
662
- _resolve(t2, e2) {
663
- if ("function" == typeof t2) {
664
- const n2 = e2 ?? this._context;
665
- return t2("function" == typeof n2 ? n2() : n2);
691
+ _resolve(e2, t2) {
692
+ if ("function" == typeof e2) {
693
+ const n2 = t2 ?? this._context;
694
+ return e2("function" == typeof n2 ? n2() : n2);
666
695
  }
667
- return t2;
696
+ return e2;
668
697
  }
669
698
  target() {
670
699
  return "function" == typeof this._target ? this._target() : this._target;
671
700
  }
672
- label(t2, e2) {
673
- const n2 = this._scopedLabels?.[t2] || this._label;
701
+ label(e2, t2) {
702
+ const n2 = this._scopedLabels?.[e2] || this._label;
674
703
  let o2 = null;
675
704
  if ("function" == typeof n2) {
676
- const t3 = e2 ?? this._context;
677
- o2 = n2("function" == typeof t3 ? t3() : t3);
705
+ const e3 = t2 ?? this._context;
706
+ o2 = n2("function" == typeof e3 ? e3() : e3);
678
707
  } else o2 = n2;
679
708
  return o2;
680
709
  }
681
- description(t2) {
682
- return this._resolve(this._description, t2);
710
+ description(e2) {
711
+ return this._resolve(this._description, e2);
683
712
  }
684
- tags(t2) {
685
- return this._resolve(this._tags, t2);
713
+ tags(e2) {
714
+ return this._resolve(this._tags, e2);
686
715
  }
687
- icon(t2) {
688
- return this._resolve(this._icon, t2);
716
+ icon(e2) {
717
+ return this._resolve(this._icon, e2);
689
718
  }
690
719
  shortcut() {
691
720
  return this._resolve(this._shortcut);
@@ -699,120 +728,120 @@ class Yt {
699
728
  context() {
700
729
  return "function" == typeof this._context ? this._context() : this._context;
701
730
  }
702
- async execute(t2, e2) {
731
+ async execute(e2, t2) {
703
732
  if (!this.disabled() && this._callback) {
704
733
  try {
705
734
  let n2 = true;
706
- e2?.beforeExecute && (n2 = e2?.beforeExecute(this, t2));
735
+ t2?.beforeExecute && (n2 = t2?.beforeExecute(this, e2));
707
736
  if (false === await Promise.resolve(n2)) return false;
708
- const o2 = this._callback.bind(this)(t2, this);
737
+ const o2 = this._callback.bind(this)(e2, this);
709
738
  if (false === await Promise.resolve(o2)) return false;
710
- e2?.onExecute?.(this, t2), this._notifyExecute(t2);
739
+ t2?.onExecute?.(this, e2), this._notifyExecute(e2);
711
740
  } catch (n2) {
712
- return console.warn(n2), e2?.onError(this, n2, t2), this._notifyError(t2, n2), false;
741
+ return console.warn(n2), t2?.onError(this, n2, e2), this._notifyError(e2, n2), false;
713
742
  }
714
743
  return true;
715
744
  }
716
745
  }
717
- addPropertyListener(t2, e2 = false) {
718
- if (!t2) throw new Error("listener must be specified");
746
+ addPropertyListener(e2, t2 = false) {
747
+ if (!e2) throw new Error("listener must be specified");
719
748
  const n2 = this._listenersProperties;
720
- return n2.add(t2), e2 && t2({}, this), () => {
721
- n2.delete(t2);
749
+ return n2.add(e2), t2 && e2({}, this), () => {
750
+ n2.delete(e2);
722
751
  };
723
752
  }
724
- addExecuteListener(t2) {
725
- if (!t2) throw new Error("listener must be specified");
726
- const e2 = this._listenersExecute;
727
- return e2.add(t2), function() {
728
- e2.delete(t2);
753
+ addExecuteListener(e2) {
754
+ if (!e2) throw new Error("listener must be specified");
755
+ const t2 = this._listenersExecute;
756
+ return t2.add(e2), function() {
757
+ t2.delete(e2);
729
758
  };
730
759
  }
731
- _notifyExecute(t2) {
732
- const e2 = this;
760
+ _notifyExecute(e2) {
761
+ const t2 = this;
733
762
  this._listenersExecute.forEach((n2) => {
734
- n2.onExecute(e2, t2);
763
+ n2.onExecute(t2, e2);
735
764
  });
736
765
  }
737
- _notifyError(t2, e2) {
766
+ _notifyError(e2, t2) {
738
767
  const n2 = this;
739
768
  this._listenersExecute.forEach((o2) => {
740
- o2.onError?.(n2, t2, e2);
769
+ o2.onError?.(n2, e2, t2);
741
770
  });
742
771
  }
743
- updateCallback(t2) {
744
- return this._callback = t2 || null, this;
772
+ updateCallback(e2) {
773
+ return this._callback = e2 || null, this;
745
774
  }
746
- update(t2) {
747
- if (!t2) return;
748
- const e2 = this._applyProps(t2);
749
- return Object.keys(e2).length > 0 && this._notifyPropertyChange(e2), this;
775
+ update(e2) {
776
+ if (!e2) return;
777
+ const t2 = this._applyProps(e2);
778
+ return Object.keys(t2).length > 0 && this._notifyPropertyChange(t2), this;
750
779
  }
751
- _notifyPropertyChange(t2) {
752
- const e2 = this;
780
+ _notifyPropertyChange(e2) {
781
+ const t2 = this;
753
782
  this._listenersProperties.forEach((n2) => {
754
- n2(t2, e2);
783
+ n2(e2, t2);
755
784
  });
756
785
  }
757
- _applyProps(t2) {
758
- let e2 = {}, n2 = this;
759
- return Object.keys(t2).forEach((o2) => {
760
- let i2 = t2[o2];
761
- n2["_" + o2] !== i2 && (n2["_" + o2] = e2[o2] = i2);
762
- }), e2;
786
+ _applyProps(e2) {
787
+ let t2 = {}, n2 = this;
788
+ return Object.keys(e2).forEach((o2) => {
789
+ let i2 = e2[o2];
790
+ n2["_" + o2] !== i2 && (n2["_" + o2] = t2[o2] = i2);
791
+ }), t2;
763
792
  }
764
793
  }
765
- class Xt extends Yt {
794
+ class Je extends qe {
766
795
  }
767
- class jt {
768
- constructor(t2, e2) {
769
- this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid = g.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();
796
+ class Qe {
797
+ constructor(e2, t2) {
798
+ this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid = v.uuidV4(), this._target = e2, this._groupKey = t2 ?? null, this._root = this, this._nodes = /* @__PURE__ */ new Map(), this._nodes.set(t2, this), this._children = /* @__PURE__ */ new Map(), this._listeners = /* @__PURE__ */ new Set(), this._commandsByKey = /* @__PURE__ */ new Map(), this._commandsByShortcut = /* @__PURE__ */ new Map();
770
799
  const n2 = this;
771
- this._unListenersByCommand = /* @__PURE__ */ new Map(), this._listenersByKey = /* @__PURE__ */ new Map(), this._commandsPropertyListener = (t3, e3) => {
772
- const o2 = n2._root._listenersByKey, i2 = e3.key(), r2 = o2.get(i2);
773
- r2 && n2._notifyCommands(r2, "onCommandChange", e3);
800
+ this._unListenersByCommand = /* @__PURE__ */ new Map(), this._listenersByKey = /* @__PURE__ */ new Map(), this._commandsPropertyListener = (e3, t3) => {
801
+ const o2 = n2._root._listenersByKey, i2 = t3.key(), r2 = o2.get(i2);
802
+ r2 && n2._notifyCommands(r2, "onCommandChange", t3);
774
803
  };
775
804
  }
776
- _getCommand(t2) {
777
- const e2 = this._commandsByKey.get(t2);
778
- return e2 || (this._parent?._getCommand(t2) ?? null);
805
+ _getCommand(e2) {
806
+ const t2 = this._commandsByKey.get(e2);
807
+ return t2 || (this._parent?._getCommand(e2) ?? null);
779
808
  }
780
- getCommand(t2, e2 = false) {
809
+ getCommand(e2, t2 = false) {
781
810
  const n2 = this._root._focused;
782
811
  let o2 = n2, i2 = n2 === this;
783
812
  for (; !i2 && o2; ) o2 === this && (i2 = true), o2 = o2._parent;
784
- return (i2 ? n2 : this)._getCommand(t2);
813
+ return (i2 ? n2 : this)._getCommand(e2);
785
814
  }
786
- createChildGroup(t2, e2, n2) {
815
+ createChildGroup(e2, t2, n2) {
787
816
  let o2;
788
817
  if (!n2) {
789
- let t3 = this;
790
- for (; t3 && !o2; ) {
791
- let n3 = t3._nodes.get(e2);
792
- n3 && (o2 = n3), t3 = t3._parent;
818
+ let e3 = this;
819
+ for (; e3 && !o2; ) {
820
+ let n3 = e3._nodes.get(t2);
821
+ n3 && (o2 = n3), e3 = e3._parent;
793
822
  }
794
823
  }
795
- o2 || (o2 = new jt(t2, e2), o2._parent = this, o2._root = this._root, o2._unListenersByCommand = null, o2._listenersByKey = null, o2._commandsPropertyListener = null);
796
- const i2 = (t3, o3) => {
797
- !t3.has(e2) || n2 ? t3.set(e2, o3) : void 0 === n2 && console.warn("commandGroup already registered", e2);
824
+ o2 || (o2 = new Qe(e2, t2), o2._parent = this, o2._root = this._root, o2._unListenersByCommand = null, o2._listenersByKey = null, o2._commandsPropertyListener = null);
825
+ const i2 = (e3, o3) => {
826
+ !e3.has(t2) || n2 ? e3.set(t2, o3) : void 0 === n2 && console.warn("commandGroup already registered", t2);
798
827
  };
799
828
  i2(this._root._nodes, o2);
800
829
  let r2 = this._parent;
801
830
  for (; r2; ) i2(this._nodes, o2), r2 = r2._parent;
802
- return this._children.set(e2, o2), this._notify("onGroupChange"), o2;
831
+ return this._children.set(t2, o2), this._notify("onGroupChange"), o2;
803
832
  }
804
833
  getKey() {
805
834
  return this._groupKey;
806
835
  }
807
- getGroup(t2) {
808
- return this._nodes.get(t2);
836
+ getGroup(e2) {
837
+ return this._nodes.get(e2);
809
838
  }
810
- _addCommands(t2, e2 = void 0) {
839
+ _addCommands(e2, t2 = void 0) {
811
840
  const n2 = this._commandsByKey, o2 = this._commandsByShortcut, i2 = this._root._commandsPropertyListener, r2 = this._root._unListenersByCommand;
812
- for (let s2 = 0; s2 < t2.length; s2++) {
813
- const l2 = t2[s2], a2 = l2.key();
814
- if (n2.has(a2) && !e2) {
815
- void 0 === e2 && console.warn("command already registered", a2);
841
+ for (let s2 = 0; s2 < e2.length; s2++) {
842
+ const l2 = e2[s2], a2 = l2.key();
843
+ if (n2.has(a2) && !t2) {
844
+ void 0 === t2 && console.warn("command already registered", a2);
816
845
  continue;
817
846
  }
818
847
  n2.set(a2, l2);
@@ -823,55 +852,55 @@ class jt {
823
852
  const u2 = l2.shortcut();
824
853
  if (!u2) continue;
825
854
  const d2 = Array.isArray(u2) ? u2 : [u2];
826
- for (let t3 = 0; t3 < d2.length; t3++) {
827
- const n3 = Gt(d2[t3]), i3 = o2.get(n3);
828
- i3 && !e2 && void 0 === e2 && console.warn(`Shortcut already registered: ${n3}, ${a2}, ${i3}.`), o2.set(n3, a2);
855
+ for (let e3 = 0; e3 < d2.length; e3++) {
856
+ const n3 = nt(d2[e3]), i3 = o2.get(n3);
857
+ i3 && !t2 && void 0 === t2 && console.warn(`Shortcut already registered: ${n3}, ${a2}, ${i3}.`), o2.set(n3, a2);
829
858
  }
830
859
  }
831
860
  }
832
861
  removeFromParent() {
833
862
  if (!this._parent) return;
834
- let t2 = this._parent, e2 = [];
863
+ let e2 = this._parent, t2 = [];
835
864
  const n2 = this._groupKey;
836
- for (; t2; ) e2.push(t2._nodes), t2._nodes.delete(n2), t2 = t2._parent;
837
- t2 = this._parent;
838
- const o2 = (t3) => {
839
- t3._children.forEach((t4) => {
840
- for (let n3 = 0; n3 < e2.length; n3++) t4._nodes.delete(e2[n3]);
841
- o2(t4);
865
+ for (; e2; ) t2.push(e2._nodes), e2._nodes.delete(n2), e2 = e2._parent;
866
+ e2 = this._parent;
867
+ const o2 = (e3) => {
868
+ e3._children.forEach((e4) => {
869
+ for (let n3 = 0; n3 < t2.length; n3++) e4._nodes.delete(t2[n3]);
870
+ o2(e4);
842
871
  });
843
872
  };
844
873
  o2(this), this._parent = null, this._notify("onGroupChange");
845
874
  }
846
- addCommands(t2, e2) {
847
- this._addCommands(t2, e2), this._notify("onGroupChange");
875
+ addCommands(e2, t2) {
876
+ this._addCommands(e2, t2), this._notify("onGroupChange");
848
877
  }
849
878
  getActive() {
850
879
  return this._root._focused ?? this._root;
851
880
  }
852
- activate(t2) {
853
- let e2 = this;
854
- if (t2 && (e2 = this._nodes.get(t2), !e2)) return void console.warn("group not found", t2);
881
+ activate(e2) {
882
+ let t2 = this;
883
+ if (e2 && (t2 = this._nodes.get(e2), !t2)) return void console.warn("group not found", e2);
855
884
  let n2 = this._root._focused ?? this._root;
856
885
  for (; n2; ) n2 = n2._parent;
857
- this._root._focused !== e2 && (this._root._focused = e2, this._notify("onGroupChange"), this._notify("onActiveChange"));
886
+ this._root._focused !== t2 && (this._root._focused = t2, this._notify("onGroupChange"), this._notify("onActiveChange"));
858
887
  }
859
- findCommandByEvent(t2) {
860
- const e2 = [];
861
- t2.altKey && e2.push(C.Alt), t2.shiftKey && e2.push(C.Shift), t2.ctrlKey && e2.push(C.Ctrl), t2.metaKey && e2.push(C.Meta);
862
- let n2 = Gt({ key: t2.code, modifiers: e2 });
888
+ findCommandByEvent(e2) {
889
+ const t2 = [];
890
+ e2.altKey && t2.push(P.Alt), e2.shiftKey && t2.push(P.Shift), e2.ctrlKey && t2.push(P.Ctrl), e2.metaKey && t2.push(P.Meta);
891
+ let n2 = nt({ key: e2.code, modifiers: t2 });
863
892
  const o2 = this._commandsByShortcut;
864
893
  let i2 = o2.get(n2);
865
- i2 || (n2 = Gt({ key: t2.key, modifiers: e2 }), i2 = o2.get(n2)), !i2 && t2.code.startsWith("Digit") && (n2 = Gt({ key: t2.code.substring(5, t2.code.length), modifiers: e2 }), i2 = this._commandsByShortcut.get(n2)), !i2 && t2.code.startsWith("Key") && (i2 = Gt({ key: t2.code.substring(3, t2.code.length), modifiers: e2 }), i2 = o2.get(n2));
894
+ i2 || (n2 = nt({ key: e2.key, modifiers: t2 }), i2 = o2.get(n2)), !i2 && e2.code.startsWith("Digit") && (n2 = nt({ key: e2.code.substring(5, e2.code.length), modifiers: t2 }), i2 = this._commandsByShortcut.get(n2)), !i2 && e2.code.startsWith("Key") && (i2 = nt({ key: e2.code.substring(3, e2.code.length), modifiers: t2 }), i2 = o2.get(n2));
866
895
  let r2 = null;
867
- 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);
896
+ 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);
868
897
  }
869
- dispatchToFocusedCommand(t2) {
870
- const e2 = this.getActive();
871
- if (!e2) return false;
872
- if (t2.isDefaultPrevented()) return false;
873
- const n2 = e2.findCommandByEvent?.(t2);
874
- return !!n2 && (n2.execute(), t2.preventDefault(), true);
898
+ dispatchToFocusedCommand(e2) {
899
+ const t2 = this.getActive();
900
+ if (!t2) return false;
901
+ if (e2.isDefaultPrevented()) return false;
902
+ const n2 = t2.findCommandByEvent?.(e2);
903
+ return !!n2 && (n2.execute(), e2.preventDefault(), true);
875
904
  }
876
905
  getRoot() {
877
906
  return this._parent ? this._parent.getRoot() : this;
@@ -879,298 +908,300 @@ class jt {
879
908
  getParent() {
880
909
  return this._parent;
881
910
  }
882
- addListener(t2, e2) {
883
- const n2 = this._listeners, o2 = e2?.keys, i2 = this._root._listenersByKey;
884
- if (o2 && !t2.onCommandChange) throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");
911
+ addListener(e2, t2) {
912
+ const n2 = this._listeners, o2 = t2?.keys, i2 = this._root._listenersByKey;
913
+ if (o2 && !e2.onCommandChange) throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");
885
914
  let r2 = null;
886
- if (o2) for (let e3 = 0; e3 < o2.length; e3++) {
887
- const n3 = o2[e3];
915
+ if (o2) for (let t3 = 0; t3 < o2.length; t3++) {
916
+ const n3 = o2[t3];
888
917
  if (!n3) continue;
889
918
  let s2 = i2.get(n3);
890
- s2 || (s2 = /* @__PURE__ */ new Set(), i2.set(n3, s2)), r2 || (r2 = []), r2.push(s2), s2.add(t2);
919
+ s2 || (s2 = /* @__PURE__ */ new Set(), i2.set(n3, s2)), r2 || (r2 = []), r2.push(s2), s2.add(e2);
891
920
  }
892
- return n2.add(t2), () => {
893
- if (r2) for (let e3 = 0; e3 < r2.length; e3++) {
894
- r2[e3].delete(t2);
921
+ return n2.add(e2), () => {
922
+ if (r2) for (let t3 = 0; t3 < r2.length; t3++) {
923
+ r2[t3].delete(e2);
895
924
  }
896
- n2.delete(t2);
925
+ n2.delete(e2);
897
926
  };
898
927
  }
899
- _notifyCommands(t2, e2, n2) {
928
+ _notifyCommands(e2, t2, n2) {
900
929
  const o2 = this;
901
930
  setTimeout(() => {
902
- t2.forEach((t3) => {
903
- t3[e2]?.(o2, n2);
931
+ e2.forEach((e3) => {
932
+ e3[t2]?.(o2, n2);
904
933
  });
905
934
  }, 0);
906
935
  }
907
- _notify(t2, e2) {
936
+ _notify(e2, t2) {
908
937
  const n2 = this;
909
938
  setTimeout(() => {
910
939
  n2._listeners.forEach((o2) => {
911
- o2[t2]?.(n2, e2);
912
- }), n2._parent && n2._parent._notify(t2, e2);
940
+ o2[e2]?.(n2, t2);
941
+ }), n2._parent && n2._parent._notify(e2, t2);
913
942
  }, 0);
914
943
  }
915
944
  getAllCommands() {
916
- const t2 = [], e2 = this._groupKey;
945
+ const e2 = [], t2 = this._groupKey;
917
946
  return this._commandsByKey.forEach((n2) => {
918
- t2.push({ command: n2, groupKey: e2 });
919
- }), this._children.forEach((e3) => {
920
- t2.push(...e3.getAllCommands());
921
- }), t2;
947
+ e2.push({ command: n2, groupKey: t2 });
948
+ }), this._children.forEach((t3) => {
949
+ e2.push(...t3.getAllCommands());
950
+ }), e2;
922
951
  }
923
952
  }
924
- const Ut = g.getOS() === g.OSType.MacOS || g.getOS() === g.OSType.IOS ? "Cmd" : "Ctrl", Zt = g.getOS() === g.OSType.MacOS || g.getOS() === g.OSType.IOS ? "⌘" : "^", Gt = (t2, e2 = false) => {
953
+ const et = v.getOS() === v.OSType.MacOS || v.getOS() === v.OSType.IOS ? "Cmd" : "Ctrl", tt = v.getOS() === v.OSType.MacOS || v.getOS() === v.OSType.IOS ? "⌘" : "^", nt = (e2, t2 = false) => {
925
954
  const n2 = {};
926
- for (let e3 = 0; t2.modifiers && e3 < t2.modifiers.length; e3++) n2[t2.modifiers[e3]] = true;
955
+ for (let t3 = 0; e2.modifiers && t3 < e2.modifiers.length; t3++) n2[e2.modifiers[t3]] = true;
927
956
  let o2 = "";
928
- return (n2?.[C.Ctrl] || n2?.[C.Meta]) && (o2 += (o2.length > 0 ? "+" : "") + (e2 ? Zt : Ut)), n2?.[C.Alt] && (o2 += e2 ? "⌥" : "Alt"), n2?.[C.Shift] && (o2 += (o2.length > 0 ? "+" : "") + (e2 ? "⇧" : "Shift")), o2 += (o2.length > 0 ? "+" : "") + G(t2.key), o2;
957
+ return (n2?.[P.Ctrl] || n2?.[P.Meta]) && (o2 += (o2.length > 0 ? "+" : "") + (t2 ? tt : et)), n2?.[P.Alt] && (o2 += t2 ? "⌥" : "Alt"), n2?.[P.Shift] && (o2 += (o2.length > 0 ? "+" : "") + (t2 ? "⇧" : "Shift")), o2 += (o2.length > 0 ? "+" : "") + ee(e2.key), o2;
929
958
  };
930
- function qt(t2, e2 = null) {
931
- const n2 = r(e2);
932
- n2.current = e2;
933
- const [o2, i2] = p((t3) => t3 + 1, 0), s2 = h(() => Array.isArray(t2) ? t2 : [t2], [t2]);
959
+ function ot(e2, t2 = null) {
960
+ const n2 = r(t2);
961
+ n2.current = t2;
962
+ const [o2, i2] = f((e3) => e3 + 1, 0), s2 = h(() => Array.isArray(e2) ? e2 : [e2], [e2]);
934
963
  return c(() => {
935
964
  if (!s2 || 0 === s2.length) return;
936
- const t3 = (t4, e3) => {
937
- n2.current?.onChange?.(e3), i2();
965
+ const e3 = (e4, t3) => {
966
+ n2.current?.onChange?.(t3), i2();
938
967
  };
939
968
  let o3 = null;
940
- e2 && (o3 = { onExecute(t4, e3) {
941
- n2.current?.onExecute?.(t4, e3);
942
- }, onError(t4, e3, o4) {
943
- n2.current?.onError?.(t4, e3, o4);
969
+ t2 && (o3 = { onExecute(e4, t3) {
970
+ n2.current?.onExecute?.(e4, t3);
971
+ }, onError(e4, t3, o4) {
972
+ n2.current?.onError?.(e4, t3, o4);
944
973
  } });
945
974
  const r2 = /* @__PURE__ */ new Set();
946
- for (let n3 = 0; n3 < s2.length; n3++) r2.add(s2[n3]?.addPropertyListener(g.debounce(t3, 0), true)), e2 && r2.add(s2[n3]?.addExecuteListener(o3));
975
+ for (let n3 = 0; n3 < s2.length; n3++) r2.add(s2[n3]?.addPropertyListener(v.debounce(e3, 0), true)), t2 && r2.add(s2[n3]?.addExecuteListener(o3));
947
976
  return () => {
948
- r2.forEach((t4) => {
949
- t4?.();
977
+ r2.forEach((e4) => {
978
+ e4?.();
950
979
  });
951
980
  };
952
- }, [t2]), o2;
981
+ }, [e2]), o2;
953
982
  }
954
- const Jt = (t2, e2) => {
983
+ const it = (e2, t2) => {
955
984
  const n2 = [];
956
- if (e2) for (let o2 = 0; o2 < e2.length; o2++) {
957
- const i2 = e2[o2], r2 = i2 ? t2?.getCommand(i2) : null;
985
+ if (t2) for (let o2 = 0; o2 < t2.length; o2++) {
986
+ const i2 = t2[o2], r2 = i2 ? e2?.getCommand(i2) : null;
958
987
  n2.push(r2);
959
988
  }
960
989
  return n2;
961
990
  };
962
- function Qt(t2, e2 = null, n2 = null, o2) {
991
+ function rt(e2, t2 = null, n2 = null, o2) {
963
992
  const i2 = r(n2);
964
- i2.current = n2, e2 && !Array.isArray(e2) && (e2 = [e2]);
965
- const [s2, l2] = a(Jt(t2, e2)), h2 = o2 ? [...o2, t2] : [t2];
993
+ i2.current = n2, t2 && !Array.isArray(t2) && (t2 = [t2]);
994
+ const [s2, l2] = a(it(e2, t2)), h2 = o2 ? [...o2, e2] : [e2];
966
995
  return c(() => {
967
996
  const n3 = { onGroupChange: () => {
968
- const n4 = Jt(t2, e2);
997
+ const n4 = it(e2, t2);
969
998
  l2(n4), i2.current?.onChange?.(this);
970
999
  } };
971
1000
  let o3;
972
- e2 && e2.length > 0 && (o3 = { keys: e2 }, n3.onCommandChange = (n4, o4) => {
973
- i2.current?.onChange?.(t2), l2(Jt(t2, e2));
1001
+ t2 && t2.length > 0 && (o3 = { keys: t2 }, n3.onCommandChange = (n4, o4) => {
1002
+ i2.current?.onChange?.(e2), l2(it(e2, t2));
974
1003
  });
975
- const r2 = t2?.addListener(n3, o3), s3 = Jt(t2, e2);
976
- return l2(s3), i2.current?.onChange && i2.current?.onChange(t2), () => {
1004
+ const r2 = e2?.addListener(n3, o3), s3 = it(e2, t2);
1005
+ return l2(s3), i2.current?.onChange && i2.current?.onChange(e2), () => {
977
1006
  r2?.();
978
1007
  };
979
1008
  }, h2), s2;
980
1009
  }
981
- const te = { Toolbar: "toolbar", Menuitem: "menuitem" }, ee = Nt({ setClipboard: (t2) => {
1010
+ const st = { Toolbar: "toolbar", Menuitem: "menuitem" }, lt = je({ setClipboard: (e2) => {
982
1011
  throw new Error("This is only available via the useClipboard.");
983
- }, getClipboard: () => y.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
984
- const [t2, e2] = a(y.Global);
985
- return { setClipboard: (t3) => e2(t3), getClipboard: () => t2, refNativeCopy: r(null), refNativeLastKey: r(null) };
986
- }), ne = (t2) => {
987
- const { source: e2, target: n2, onPaste: o2, onClipboardUpdate: r2, notifier: s2 = rt, commands: l2 } = t2, a2 = P(r2, [r2]), u2 = P(o2, [o2]), { getClipboard: d2, refNativeCopy: _2 } = ee(), p2 = d2();
1012
+ }, getClipboard: () => b.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
1013
+ const [e2, t2] = a(b.Global);
1014
+ return { setClipboard: (e3) => t2(e3), getClipboard: () => e2, refNativeCopy: r(null), refNativeLastKey: r(null) };
1015
+ }), at = (e2) => {
1016
+ const { source: t2, target: n2, onPaste: o2, onClipboardUpdate: r2, commands: s2 } = e2, l2 = De(), a2 = B(r2, [r2]), u2 = B(o2, [o2]), { getClipboard: d2, refNativeCopy: _2 } = lt(), p2 = d2();
988
1017
  h(() => {
989
- const t3 = e2?.element, o3 = n2?.element ?? e2?.element;
990
- if (!l2) return;
991
- const i2 = [new Xt("cut", t3, { label: "Cut", description: "Remove the selection and put it on the clipboard so you can paste it somewhere else.", shortcut: { key: "X", modifiers: [C.Ctrl] } }), new Xt("copy", t3, { label: "Copy", description: "Put a copy of the selection on the clipboard so you can paste it somewhere else.", shortcut: { key: "C", modifiers: [C.Ctrl] } }), new Xt("paste", o3, { label: "Paste", description: "Add content on the clipboard to your document.", shortcut: [{ key: "V", modifiers: [C.Ctrl] }, { key: "F8", modifiers: [C.Ctrl] }] })];
992
- l2?.addCommands(i2, true);
993
- }, [l2]);
994
- const m2 = P(async (t3) => {
995
- if (!e2?.element) return;
1018
+ const e3 = t2?.element, o3 = n2?.element ?? t2?.element;
1019
+ if (!s2) return;
1020
+ const i2 = [new Je("cut", e3, { label: "Cut", description: "Remove the selection and put it on the clipboard so you can paste it somewhere else.", shortcut: { key: "X", modifiers: [P.Ctrl] } }), new Je("copy", e3, { label: "Copy", description: "Put a copy of the selection on the clipboard so you can paste it somewhere else.", shortcut: { key: "C", modifiers: [P.Ctrl] } }), new Je("paste", o3, { label: "Paste", description: "Add content on the clipboard to your document.", shortcut: [{ key: "V", modifiers: [P.Ctrl] }, { key: "F8", modifiers: [P.Ctrl] }] })];
1021
+ s2?.addCommands(i2, true);
1022
+ }, [s2]);
1023
+ const m2 = B(async (e3) => {
1024
+ if (!t2?.element) return;
996
1025
  let n3 = null;
997
1026
  try {
998
- n3 = e2.doCopy?.(t3), "string" == typeof n3 ? await p2.writeText(n3) : await p2.writeReference(n3);
999
- } catch (t4) {
1000
- throw t4;
1027
+ n3 = t2.doCopy?.(e3), "string" == typeof n3 ? await p2.writeText(n3) : await p2.writeReference(n3);
1028
+ } catch (e4) {
1029
+ throw e4;
1001
1030
  }
1002
- }, [e2, s2]), f2 = P(async (t3) => {
1003
- const n3 = e2?.element?.();
1031
+ }, [t2, l2]), f2 = B(async (e3) => {
1032
+ const n3 = t2?.element?.();
1004
1033
  if (n3) {
1005
- _2.current = { sourceElement: n3, args: t3 };
1034
+ _2.current = { sourceElement: n3, args: e3 };
1006
1035
  try {
1007
- await m2(t3);
1008
- } catch (t4) {
1009
- s2?.showError?.(t4);
1036
+ await m2(e3);
1037
+ } catch (e4) {
1038
+ l2.showError?.(e4);
1010
1039
  }
1011
1040
  }
1012
- }, [e2?.element, s2]), b2 = i(() => {
1041
+ }, [t2?.element, l2]), g2 = i(() => {
1013
1042
  f2({ isCut: true });
1014
- }, []), w2 = P(async (t3, e3, n3) => {
1043
+ }, []), y2 = B(async (e3, t3, n3) => {
1015
1044
  try {
1016
- if (false === await t3.doPaste(e3, n3)) return;
1017
- u2?.(e3, n3);
1018
- } catch (t4) {
1019
- s2?.showError?.(t4);
1045
+ if (false === await e3.doPaste(t3, n3)) return;
1046
+ u2?.(t3, n3);
1047
+ } catch (e4) {
1048
+ l2.showError?.(e4);
1020
1049
  }
1021
- }, [u2]), S2 = P(async (t3, e3, o3) => {
1050
+ }, [u2]), x2 = B(async (e3, t3, o3) => {
1022
1051
  const i2 = n2?.element?.();
1023
- if (i2 && await g.whenFocus(i2), !t3 && !e3) return;
1024
- const r3 = await s2?.showBusy?.("Pasting...");
1025
- if (e3) try {
1026
- return await w2(n2, e3, o3), void r3?.();
1027
- } catch (t4) {
1028
- r3?.(), s2?.showError?.(t4);
1052
+ if (i2 && await v.whenFocus(i2), !e3 && !t3) return;
1053
+ const r3 = await l2.showBusy?.("Pasting...");
1054
+ if (t3) try {
1055
+ return await y2(n2, t3, o3), void r3?.();
1056
+ } catch (e4) {
1057
+ r3?.(), l2.showError?.(e4);
1029
1058
  }
1030
- let l3, a3 = n2.importFromExternal;
1031
- a3 || (a3 = (e4, n3) => ({ getItemType: () => "text", toText: () => t3.text, isClipboardItem: true }));
1059
+ let s3, a3 = n2.importFromExternal;
1060
+ a3 || (a3 = (t4, n3) => ({ getItemType: () => "text", toText: () => e3.text, isClipboardItem: true }));
1032
1061
  try {
1033
- l3 = await a3(t3, { isCut: false });
1034
- } catch (t4) {
1035
- r3?.(), s2?.showError?.(t4);
1062
+ s3 = await a3(e3, { isCut: false });
1063
+ } catch (e4) {
1064
+ r3?.(), l2.showError?.(e4);
1036
1065
  }
1037
- if (l3) try {
1038
- const t4 = await Promise.resolve(l3);
1039
- await w2(n2, t4, o3), r3?.();
1040
- } catch (t4) {
1041
- r3?.(), s2?.showError?.(t4);
1066
+ if (s3) try {
1067
+ const e4 = await Promise.resolve(s3);
1068
+ await y2(n2, e4, o3), r3?.();
1069
+ } catch (e4) {
1070
+ r3?.(), l2.showError?.(e4);
1042
1071
  }
1043
1072
  else r3?.();
1044
- }, [w2, n2, s2]), L2 = P(async (t3) => {
1073
+ }, [y2, n2, l2]), w2 = B(async (e3) => {
1045
1074
  if (n2?.element) try {
1046
- const e3 = await p2.readReference();
1047
- if (e3) return void await S2(null, e3, t3);
1075
+ const t3 = await p2.readReference();
1076
+ if (t3) return void await x2(null, t3, e3);
1048
1077
  const n3 = [];
1049
- n3[0] = await v.readStringFromClipboard(p2, x.plain), n3[1] = await v.readHTMLFromClipboard(p2, x.html), n3[2] = await v.readBlobFromClipboard(p2, x.png);
1078
+ n3[0] = await S.readStringFromClipboard(p2, L.plain), n3[1] = await S.readHTMLFromClipboard(p2, L.html), n3[2] = await S.readBlobFromClipboard(p2, L.png);
1050
1079
  const o3 = { text: n3[0] ?? null, html: n3[1] ?? null, image: n3[2] ?? null };
1051
- await S2(o3, null, t3);
1052
- } catch (t4) {
1053
- if ("Document is not focused." === t4?.message) return;
1054
- s2?.showError?.(t4);
1080
+ await x2(o3, null, e3);
1081
+ } catch (e4) {
1082
+ if ("Document is not focused." === e4?.message) return;
1083
+ l2.showError?.(e4);
1055
1084
  }
1056
- }, [S2, n2?.element, s2]);
1057
- return P(async (t3) => {
1058
- }, [e2?.element]), P(async (t3) => {
1059
- }, [n2?.element, S2, s2]), c(() => {
1085
+ }, [x2, n2?.element, l2]);
1086
+ return B(async (e3) => {
1087
+ }, [t2?.element]), B(async (e3) => {
1088
+ }, [n2?.element, x2, l2]), c(() => {
1060
1089
  if (!p2) return;
1061
- const t3 = async (t4) => {
1062
- const e4 = await p2.readReference();
1063
- a2?.(e4);
1064
- }, e3 = (t4) => {
1065
- s2?.showMessage?.(y.ErrorMessages.PermsRead, { onceKey: "clipboard.features" });
1066
- }, n3 = (t4) => {
1067
- s2?.showMessage?.(y.ErrorMessages.PermsWrite, { onceKey: "clipboard.features" });
1090
+ const e3 = async (e4) => {
1091
+ const t4 = await p2.readReference();
1092
+ a2?.(t4);
1093
+ }, t3 = (e4) => {
1094
+ l2.showMessage?.(b.ErrorMessages.PermsRead, { onceKey: "clipboard.features" });
1095
+ }, n3 = (e4) => {
1096
+ l2.showMessage?.(b.ErrorMessages.PermsWrite, { onceKey: "clipboard.features" });
1068
1097
  };
1069
- return p2.addEventListener("clipboardchange", t3), p2.addEventListener("clipboarderrorread", e3), p2.addEventListener("clipboarderrorwrite", n3), () => {
1070
- p2.removeEventListener("clipboardchange", t3), p2.removeEventListener("clipboarderrorread", e3), p2.removeEventListener("clipboarderrorwrite", n3);
1098
+ return p2.addEventListener("clipboardchange", e3), p2.addEventListener("clipboarderrorread", t3), p2.addEventListener("clipboarderrorwrite", n3), () => {
1099
+ p2.removeEventListener("clipboardchange", e3), p2.removeEventListener("clipboarderrorread", t3), p2.removeEventListener("clipboarderrorwrite", n3);
1071
1100
  };
1072
- }, [p2, s2]), c(() => {
1073
- }, [m2, S2, e2, n2]), c(() => {
1074
- l2?.getCommand("cut")?.updateCallback(b2).update({ disabled: !e2 || !n2 }), l2?.getCommand("copy")?.updateCallback(f2).update({ disabled: !e2 }), l2?.getCommand("paste")?.updateCallback(L2).update({ disabled: !n2 });
1075
- }, [e2, n2, l2]), { paste: L2, copy: f2, clipboard: p2 };
1101
+ }, [p2, l2]), c(() => {
1102
+ }, [m2, x2, t2, n2]), c(() => {
1103
+ s2?.getCommand("cut")?.updateCallback(g2).update({ disabled: !t2 || !n2 }), s2?.getCommand("copy")?.updateCallback(f2).update({ disabled: !t2 }), s2?.getCommand("paste")?.updateCallback(w2).update({ disabled: !n2 });
1104
+ }, [t2, n2, s2]), { paste: w2, copy: f2, clipboard: p2 };
1076
1105
  };
1077
- function oe(t2, e2 = true) {
1078
- const n2 = r(t2);
1106
+ function ct(e2, t2 = true) {
1107
+ const n2 = r(e2);
1079
1108
  c(() => {
1080
- if (e2) {
1081
- const e3 = Object.entries(t2).reduce((t3, [e4, o2]) => (n2.current[e4] !== o2 && (t3[e4] = [n2.current[e4], o2]), t3), {});
1082
- Object.keys(e3).length > 0 && console.log("Changed props:", e3);
1109
+ if (t2) {
1110
+ const t3 = Object.entries(e2).reduce((e3, [t4, o2]) => (n2.current[t4] !== o2 && (e3[t4] = [n2.current[t4], o2]), e3), {});
1111
+ Object.keys(t3).length > 0 && console.log("Changed props:", t3);
1083
1112
  }
1084
- n2.current = t2;
1113
+ n2.current = e2;
1085
1114
  });
1086
1115
  }
1087
- let ie = false, re = 0;
1088
- var se = "undefined" != typeof document ? d : c;
1089
- const le = () => "sheetxl-ui-" + re++;
1090
- const ae = o["useId".toString()], ce = null != ae ? ae : function() {
1091
- const [t2, e2] = o.useState(() => ie ? le() : void 0);
1092
- return se(() => {
1093
- null == t2 && e2(le());
1116
+ let ht = false, ut = 0;
1117
+ var dt = "undefined" != typeof document ? d : c;
1118
+ const _t = () => "sheetxl-ui-" + ut++;
1119
+ const pt = o["useId".toString()], mt = null != pt ? pt : function() {
1120
+ const [e2, t2] = o.useState(() => ht ? _t() : void 0);
1121
+ return dt(() => {
1122
+ null == e2 && t2(_t());
1094
1123
  }, []), o.useEffect(() => {
1095
- ie || (ie = true);
1096
- }, []), t2;
1097
- }, he = "Undo the last action.", ue = "Repeat the last action or undo the redo.", de = (t2) => `Redo ${t2}`, _e = ({ manager: t2, commands: e2, disabled: n2, notifier: o2 = rt }) => {
1098
- const i2 = P((e3) => {
1124
+ ht || (ht = true);
1125
+ }, []), e2;
1126
+ }, ft = "Undo the last action.", gt = "Repeat the last action or undo the redo.", yt = (e2) => `Redo ${e2}`, vt = ({ manager: e2, commands: t2, disabled: n2 }) => {
1127
+ const o2 = De(), i2 = B((t3) => {
1099
1128
  try {
1100
- t2?.undo(e3);
1101
- } catch (t3) {
1102
- o2.showError?.(t3);
1129
+ e2?.undo(t3);
1130
+ } catch (e3) {
1131
+ o2.error(e3);
1103
1132
  }
1104
- }, [t2]), r2 = P((e3) => {
1133
+ }, [e2]), r2 = B((t3) => {
1105
1134
  try {
1106
- t2?.redo(e3);
1107
- } catch (t3) {
1108
- o2.showError?.(t3);
1135
+ e2?.redo(t3);
1136
+ } catch (e3) {
1137
+ o2.error(e3);
1109
1138
  }
1110
- }, [t2]);
1139
+ }, [e2]);
1111
1140
  return h(() => {
1112
- if (!e2) return;
1113
- const t3 = { contains: (t4) => true, focus() {
1114
- } }, n3 = [new Yt("undo", t3, { label: "Undo", description: he, shortcut: { key: "z", modifiers: [C.Ctrl] }, disabled: true }, i2), new Yt("redo", t3, { label: "Redo", description: ue, shortcut: [{ key: "y", modifiers: [C.Ctrl] }, { key: "F4" }, { key: "Enter", modifiers: [C.Alt] }], disabled: true }, r2)];
1115
- e2?.addCommands(n3, true);
1116
- }, [e2]), c(() => {
1117
- if (!e2) return;
1141
+ if (!t2) return;
1142
+ const e3 = { contains: (e4) => true, focus() {
1143
+ } }, n3 = [new qe("undo", e3, { label: "Undo", description: ft, shortcut: { key: "z", modifiers: [P.Ctrl] }, disabled: true }, i2), new qe("redo", e3, { label: "Redo", description: gt, shortcut: [{ key: "y", modifiers: [P.Ctrl] }, { key: "F4" }, { key: "Enter", modifiers: [P.Alt] }], disabled: true }, r2)];
1144
+ t2?.addCommands(n3, true);
1145
+ }, [t2]), c(() => {
1146
+ if (!t2) return;
1118
1147
  const o3 = () => {
1119
- const o4 = t2?.getTopUndoDescription(), i4 = {};
1148
+ const o4 = e2?.getTopUndoDescription(), i4 = {};
1120
1149
  var r3;
1121
- e2.getCommand("undo").update({ disabled: n2 || !t2 || !t2.hasUndo(), description: o4 ? (r3 = o4, `Undo ${r3}`) : he, state: i4, context: { undoManager: t2 } });
1122
- const s2 = t2?.getTopRedoDescription();
1123
- e2.getCommand("redo").update({ disabled: n2 || !t2 || !t2.hasRedo(), description: s2 ? de(s2) : ue, state: i4, context: { undoManager: t2 } });
1150
+ t2.getCommand("undo").update({ disabled: n2 || !e2 || !e2.hasUndo(), description: o4 ? (r3 = o4, `Undo ${r3}`) : ft, state: i4, context: { undoManager: e2 } });
1151
+ const s2 = e2?.getTopRedoDescription();
1152
+ t2.getCommand("redo").update({ disabled: n2 || !e2 || !e2.hasRedo(), description: s2 ? yt(s2) : gt, state: i4, context: { undoManager: e2 } });
1124
1153
  };
1125
- if (o3(), !t2) return;
1126
- const i3 = t2.addListener({ onStackChange() {
1154
+ if (o3(), !e2) return;
1155
+ const i3 = e2.addListener({ onStackChange() {
1127
1156
  o3();
1128
1157
  } });
1129
1158
  return () => i3?.();
1130
- }, [t2, e2, n2]), { undo: i2, redo: r2 };
1159
+ }, [e2, t2, n2]), { undo: i2, redo: r2 };
1131
1160
  };
1132
1161
  export {
1133
- Yt as Command,
1134
- te as CommandButtonType,
1135
- jt as CommandGroup,
1136
- rt as DefaultNotifier,
1137
- mt as FocusKeyNavigation,
1138
- E as HorizontalAlignment,
1139
- T as KeyCodes,
1140
- C as KeyModifiers,
1141
- M as MouseButtonCodes,
1142
- ot as NotificationType,
1143
- q as ReactUtils,
1144
- ft as RoundedTab,
1145
- nt as ScrollPane,
1146
- $ as ScrollUtils,
1147
- O as Scrollbar,
1148
- D as ScrollbarOrientation,
1149
- Xt as SimpleCommand,
1150
- St as SplitPane,
1151
- yt as SplitPaneResizer,
1152
- pt as ToolTipPlacement,
1153
- _t as VirtualScrollbar,
1154
- et as defaultCreateScrollCorner,
1155
- A as defaultCreateScrollEdgeButton,
1156
- k as defaultCreateScrollEndButton,
1157
- z as defaultCreateScrollStartButton,
1158
- tt as defaultCreateScrollbar,
1159
- Et as getDevicePixelRatio,
1160
- Gt as toShortcutString,
1161
- P as useCallbackRef,
1162
- qt as useCommand,
1163
- Qt as useCommands,
1164
- ne as useCopyPaste,
1165
- Lt as useDevicePixelRatio,
1166
- It as useEditMode,
1167
- lt as useFullscreenPortal,
1168
- ee as useGlobalClipboard,
1169
- ce as useId,
1170
- Q as useImperativeElement,
1171
- Mt as useMouseDownAndHoldListener,
1172
- Ct as useOnClickOrFocusAway,
1173
- Tt as useSynchronizedPointerHandler,
1174
- oe as useTraceUpdate,
1175
- _e as useUndoManager
1162
+ qe as Command,
1163
+ st as CommandButtonType,
1164
+ Qe as CommandGroup,
1165
+ Ce as DelegatingReactNotifier,
1166
+ fe as FocusKeyNavigation,
1167
+ D as HorizontalAlignment,
1168
+ z as KeyCodes,
1169
+ P as KeyModifiers,
1170
+ k as MouseButtonCodes,
1171
+ Me as NotifierProvider,
1172
+ Ee as NotifierType,
1173
+ te as ReactUtils,
1174
+ ge as RoundedTab,
1175
+ se as ScrollPane,
1176
+ H as ScrollUtils,
1177
+ I as Scrollbar,
1178
+ A as ScrollbarOrientation,
1179
+ Je as SimpleCommand,
1180
+ Le as SplitPane,
1181
+ ve as SplitPaneResizer,
1182
+ me as ToolTipPlacement,
1183
+ pe as VirtualScrollbar,
1184
+ re as defaultCreateScrollCorner,
1185
+ K as defaultCreateScrollEdgeButton,
1186
+ O as defaultCreateScrollEndButton,
1187
+ $ as defaultCreateScrollStartButton,
1188
+ ie as defaultCreateScrollbar,
1189
+ ze as getDevicePixelRatio,
1190
+ nt as toShortcutString,
1191
+ B as useCallbackRef,
1192
+ ot as useCommand,
1193
+ rt as useCommands,
1194
+ at as useCopyPaste,
1195
+ Pe as useDevicePixelRatio,
1196
+ Ge as useEditMode,
1197
+ ae as useFullscreenPortal,
1198
+ lt as useGlobalClipboard,
1199
+ mt as useId,
1200
+ oe as useImperativeElement,
1201
+ Be as useMouseDownAndHoldListener,
1202
+ De as useNotifier,
1203
+ ke as useOnClickOrFocusAway,
1204
+ Ae as useSynchronizedPointerHandler,
1205
+ ct as useTraceUpdate,
1206
+ vt as useUndoManager
1176
1207
  };