UNPKG

@sheetxl/utils-react

Version:

Utils React - Utilities for React capabilities needed for all SheetXL components.

633 lines 71.6 kB
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-scrollbar_eblx4_6 ::-webkit-scrollbar-button{background:transparent}._fullscreen-portal-root_1mjsr_4{pointer-events:none;position:absolute;inset:0;width:100%;height:100%;z-index:1200}._fullscreen-portal-root_1mjsr_4>*{pointer-events:auto}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})(); import { jsx as L, jsxs as be, Fragment as Me } from "react/jsx-runtime"; import me, { useLayoutEffect as Ve, useEffect as V, useState as G, useMemo as N, useCallback as R, useRef as A, memo as Se, forwardRef as Le, useImperativeHandle as tn, version as nn, createElement as on, useReducer as rn } from "react"; import { CommonUtils as te, InternalClipboard as Ke, ClipboardUtils as Ie, MimeType as Ne } from "@sheetxl/utils"; import { createRoot as sn } from "react-dom/client"; import { unstable_batchedUpdates as ln } from "react-dom"; /** * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.6.5 * * (C) 2025-present SheetXL Inc. & Michael T. Ford * License: The license can be found at https://www.sheetxl.com/license. */ const Qn = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, Z = { Shift: "shift", Alt: "alt", Ctrl: "ctrl", Meta: "meta" }, eo = { 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 }, to = { Left: 1, Middle: 2, Right: 3 }, re = { Horizontal: "horizontal", Vertical: "vertical" }; function Ct(i) { var e, t, n = ""; if (typeof i == "string" || typeof i == "number") n += i; else if (typeof i == "object") if (Array.isArray(i)) { var o = i.length; for (e = 0; e < o; e++) i[e] && (t = Ct(i[e])) && (n && (n += " "), n += t); } else for (t in i) i[t] && (n && (n += " "), n += t); return n; } function ve() { for (var i, e, t = 0, n = "", o = arguments.length; t < o; t++) (i = arguments[t]) && (e = Ct(i)) && (n && (n += " "), n += e); return n; } var an = function() { }, Et = typeof window < "u", cn = Et ? Ve : V, dt = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 }; const fe = Et && window.ResizeObserver !== void 0 ? function() { var i = G(null), e = i[0], t = i[1], n = G(dt), o = n[0], r = n[1], s = N(function() { return new window.ResizeObserver(function(l) { if (l[0]) { var a = l[0].contentRect, c = a.x, h = a.y, u = a.width, d = a.height, w = a.top, b = a.left, x = a.bottom, S = a.right; r({ x: c, y: h, width: u, height: d, top: w, left: b, bottom: x, right: S }); } }); }, []); return cn(function() { if (e) return s.observe(e), function() { s.disconnect(); }; }, [e]), [t, o]; } : function() { return [an, dt]; }, T = (i, e) => { const t = R((...r) => i?.(...r), e), n = A(null); n.current = t; const o = R((...r) => n.current?.(...r), []); if (n.current) return o; }, hn = (i) => { const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical; return L("div", { style: { paddingBottom: "0px", paddingRight: "0px", paddingLeft: o ? "0px" : "3px", paddingTop: o ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...e }, ...n, children: L("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} single-button start`, children: L("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: L("path", { d: o ? "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" }) }) }) }); }, un = (i) => { const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical; return L("div", { style: { paddingLeft: "0px", paddingTop: "0px", paddingRight: o ? "0px" : "3px", paddingBottom: o ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...e }, ...n, children: L("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} single-button end`, children: L("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: L("path", { d: o ? "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" }) }) }) }); }, no = (i) => { const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical; return L("div", { style: { display: "flex", justifyContent: "center", alignItems: "end", transition: "fill-opacity 1s", zIndex: 1, width: "24px", height: "24px", ...e }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} edge`, ...n, children: L("svg", { width: "24", height: "24", viewBox: "0 0 24 24", transform: o ? "rotate(90) " : "", children: L("path", { style: { transition: "opacity 240ms ease 0s", opacity: i.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" }) }) }); }, Ue = (i, e, t, n, o = 0) => { for (let r = 0; r < t.length; r++) { const s = t[r].getBoundingClientRect(); let l = s.left - e, a = l + s.width; if (n) { if (l < i && a >= i) return l; } else if (Math.ceil(a) > Math.ceil(i) + 2) return a; } return o; }, oo = Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: Ue }, Symbol.toStringTag, { value: "Module" })), dn = "_sheetxl-scrollbar_eblx4_6", tt = Se(Le((i, e) => { const { offset: t = 0, totalSize: n = 0, viewportSize: o = 0, style: r, className: s, orientation: l = re.Vertical, onScrollOffset: a, onScroll: c, showCustomScrollButtons: h = !1, scrollButtonIncrement: u = 200, scrollButtonInitialRepeatDelay: d = 260, scrollButtonAdditionalRepeatDelay: w = 120, createScrollStartButton: b = hn, createScrollEndButton: x = un, ...S } = i, P = T(c, [c]), _ = A(null), [y, { width: f, height: k }] = fe(), [z, { width: O, height: F }] = fe(), g = l === re.Vertical, v = g ? "top" : "left", B = g ? "scrollTop" : "scrollLeft", p = g ? k : f, C = g ? F : O, [m, E] = G(null); V(() => { m !== null && _.current && _.current.scrollTo({ behavior: "smooth", [v]: m }); }, [m, g]); const D = R((K, se = !1) => { if (!_.current) return 0; const ie = _.current.querySelector(".scrollbar-viewport"), pe = ie.getBoundingClientRect(), le = ie.children, ce = se ? 0 : Ue(K, pe[v], le, !0, Math.max(0, K - u)); return E(ce), Math.max(0, ce); }, []), q = R((K, se = !1) => { if (!_.current) return 0; const ie = _.current.querySelector(".scrollbar-viewport"), pe = ie.getBoundingClientRect(), le = ie.children, ce = Math.ceil(C - p), Ce = se ? ce : Ue(K, pe[v], le, !1, Math.max(0, K + u)); return E(Ce), Math.min(ce, Ce); }, [C, p]), W = A(null), Y = R((K) => { W.current = t; const se = K.target[B]; a(se, o, n), P?.(K); }, [a, o, n, t]); V(() => { const K = W.current; W.current = null, t !== K && (_.current[B] = t); }, [t, B]); const X = A(null), $ = A(null), I = R(() => { X.current && (clearTimeout(X.current), X.current = null, $.current = null); }, []), j = R((K, se, ie, pe = d) => { $.current = K, X.current = setTimeout(() => { const le = ie ? D($.current || K) : q($.current || K); le !== $.current ? j(le, !1, ie, w) : I(); }, se ? 0 : pe); }, [D, q, I]); V(() => () => I(), [I]); const ne = t, ge = N(() => { if (!h) return null; const K = { orientation: l, disabled: Math.floor(ne) <= 0 || Math.floor(C - p) === 0, onMouseUp: I, onMouseLeave: I, onMouseDown: () => j(ne, !0, !0) }; return b?.(K); }, [h, l, ne, m, C, p]), ye = N(() => { if (!h) return null; const K = { orientation: l, disabled: Math.floor(C - p) <= Math.ceil(ne), onMouseUp: I, onMouseLeave: I, onMouseDown: () => j(ne, !0, !1) }; return x?.(K); }, [h, l, ne, m, C, p]); return be("div", { ref: e, style: { display: "flex", flex: "1", flexDirection: g ? "column" : "row", padding: "0", ...r }, className: ve(dn, s), ...S, children: [ge, L("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: g ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: y, children: L("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: g ? "scroll" : "hidden", overflowX: g ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: Y, ref: _, children: L("div", { ref: z, style: { position: "absolute", height: g ? n - o + (k ?? 0) : 1, width: g ? 1 : n - o + (f ?? 0) }, className: "scrollbar-viewport" }) }) }), ye] }); })); tt.displayName = "Scrollbar"; let pt = Date.now, _t = 1e3, de = {}, pn = 1; const Ee = (i) => { let e = de[i] !== null; return e && (de[i] = null), e; }, mt = (i, e, t, n = 0, o) => { let r = pt(), s = r, l = 0, a = 0, c = 0, h = pn++; if (h % 20 == 0) { const d = {}; for (let w in de) d[w] = !0; de = d; } const u = function(d) { let w = d !== !0, b = pt(), x = !0; try { x = (!e || e(h)) ?? !0; } catch { x = !1; } if (!de[h] || !x) return de[h] = null, void t?.(60 - a / ((b - r) / _t), h, !1); if (w) { c = Math.round((b - s) / 16.666666666666668) - 1; for (let _ = 0; _ < Math.min(c, 4); _++) u(!0), a++; } n && (l = (b - r) / n, l > 1 && (l = 1)); let S = o ? o(l) : l, P = !1; try { P = i(S, b, w); } catch { P = !1; } P !== !1 && l !== 1 || !w ? w && (s = b, requestAnimationFrame(u)) : (de[h] = null, t?.(60 - a / ((b - r) / _t), h, l === 1 || n == null)); }; return de[h] = !0, requestAnimationFrame(u), h; }, _n = function(i) { return Math.pow(i - 1, 3) + 1; }, mn = function(i) { return (i /= 0.5) < 1 ? 0.5 * Math.pow(i, 3) : 0.5 * (Math.pow(i - 2, 3) + 2); }; class fn { constructor(e, t) { this.__isSingleTouch = !1, this.__isTracking = !1, this.__didDecelerationComplete = !1, this.__isGesturing = !1, this.__isDragging = !1, this.__isDecelerating = 0, this.__isAnimating = 0, this.__interruptedAnimation = !1, this.__lastScale = 1, this.__enableScrollX = !0, this.__enableScrollY = !0, 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 = e, this.options = { scrollingX: !0, scrollingY: !0, animating: !0, animationDuration: 250, bouncing: !0, locking: !0, paging: !1, snapping: !1, zooming: !1, minZoom: 0.5, maxZoom: 3, speedMultiplier: 1, scrollingComplete: void 0, penetrationDeceleration: 0.03, penetrationAcceleration: 0.08, ...t }; } setDimensions(e, t, n, o) { e !== null && (this.__clientWidth = e), t !== null && (this.__clientHeight = t), n !== null && (this.__contentWidth = n), o !== null && (this.__contentHeight = o), this.__computeScrollMax(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0); } setPosition(e, t) { this.__clientLeft = e || 0, this.__clientTop = t || 0; } setSnapSize(e, t) { this.__snapWidth = e, this.__snapHeight = t; } getValues() { return { left: this.__scrollLeft, top: this.__scrollTop, right: this.__scrollLeft + this.__clientWidth / this.__zoomLevel, bottom: this.__scrollTop + this.__clientHeight / this.__zoomLevel, zoom: this.__zoomLevel }; } getPoint(e, t) { const n = this.getValues(); return { left: e / n.zoom, top: t / n.zoom }; } getScrollMax() { return { left: this.__maxScrollLeft, top: this.__maxScrollTop }; } zoomTo(e, t = !1, n, o, r) { if (!this.options.zooming) throw new Error("Zooming is not enabled!"); r && (this.__zoomComplete = r), this.__isDecelerating && (Ee(this.__isDecelerating), this.__isDecelerating = 0); const s = this.__zoomLevel; n === void 0 && (n = this.__clientWidth / 2), o === void 0 && (o = this.__clientHeight / 2), e = Math.max(Math.min(e, this.options.maxZoom), this.options.minZoom), this.__computeScrollMax(e); const l = e / s; let a = l * (this.__scrollLeft + n) - n, c = l * (this.__scrollTop + o) - o; a > this.__maxScrollLeft ? a = this.__maxScrollLeft : a < 0 && (a = 0), c > this.__maxScrollTop ? c = this.__maxScrollTop : c < 0 && (c = 0), this.__publish(a, c, e, t); } zoomBy(e, t = !1, n = 0, o = 0, r) { this.zoomTo(this.__zoomLevel * e, t, n, o, r); } scrollTo(e, t, n = !1, o = 1) { if (this.__isDecelerating && (Ee(this.__isDecelerating), this.__isDecelerating = 0), o !== void 0 && o !== this.__zoomLevel) { if (!this.options.zooming) throw new Error("Zooming is not enabled!"); e *= o, t *= o, this.__computeScrollMax(o); } else o = this.__zoomLevel; this.options.scrollingX ? this.options.paging ? e = Math.round(e / this.__clientWidth) * this.__clientWidth : this.options.snapping && (e = Math.round(e / this.__snapWidth) * this.__snapWidth) : e = this.__scrollLeft, this.options.scrollingY ? this.options.paging ? t = Math.round(t / this.__clientHeight) * this.__clientHeight : this.options.snapping && (t = Math.round(t / this.__snapHeight) * this.__snapHeight) : t = this.__scrollTop, e = Math.max(Math.min(this.__maxScrollLeft, e), 0), t = Math.max(Math.min(this.__maxScrollTop, t), 0), e === this.__scrollLeft && t === this.__scrollTop && (n = !1), this.__publish(e, t, o, n); } scrollBy(e = 0, t = 0, n = !1) { const o = this.__isAnimating ? this.__scheduledLeft : this.__scrollLeft, r = this.__isAnimating ? this.__scheduledTop : this.__scrollTop; this.scrollTo(o + (e || 0), r + (t || 0), n); } doMouseZoom(e, t, n, o) { const r = e > 0 ? 0.97 : 1.03; return this.zoomTo(this.__zoomLevel * r, !1, n - this.__clientLeft, o - this.__clientTop); } doTouchStart(e, t) { if (e.length === void 0) throw new Error("Invalid touch list: " + e); if (t instanceof Date && (t = t.valueOf()), typeof t != "number") throw new Error("Invalid timestamp value: " + t); let n, o; this.__interruptedAnimation = !0, this.__isDecelerating && (Ee(this.__isDecelerating), this.__isDecelerating = 0, this.__interruptedAnimation = !0), this.__isAnimating && (Ee(this.__isAnimating), this.__isAnimating = 0, this.__interruptedAnimation = !0); let r = e.length === 1; r ? (n = e[0].pageX, o = e[0].pageY) : (n = Math.abs(e[0].pageX + e[1].pageX) / 2, o = Math.abs(e[0].pageY + e[1].pageY) / 2), this.__initialTouchLeft = n, this.__initialTouchTop = o, this.__zoomLevelStart = this.__zoomLevel, this.__lastTouchLeft = n, this.__lastTouchTop = o, this.__lastTouchMove = t, this.__lastScale = 1, this.__enableScrollX = !r && this.options.scrollingX, this.__enableScrollY = !r && this.options.scrollingY, this.__isTracking = !0, this.__didDecelerationComplete = !1, this.__isDragging = !r, this.__isSingleTouch = r, this.__positions = []; } doTouchMove(e, t, n = 1) { if (e.length === void 0) throw new Error("Invalid touch list: " + e); if (t instanceof Date && (t = t.valueOf()), typeof t != "number") throw new Error("Invalid timestamp value: " + t); if (!this.__isTracking) return; let o, r; e.length === 2 ? (o = Math.abs(e[0].pageX + e[1].pageX) / 2, r = Math.abs(e[0].pageY + e[1].pageY) / 2) : (o = e[0].pageX, r = e[0].pageY); let s = this.__positions; if (this.__isDragging) { let l = o - this.__lastTouchLeft, a = r - this.__lastTouchTop, c = this.__scrollLeft, h = this.__scrollTop, u = this.__zoomLevel; if (n !== void 0 && this.options.zooming) { let d = u; if (u = u / this.__lastScale * n, u = Math.max(Math.min(u, this.options.maxZoom), this.options.minZoom), d !== u) { let w = o - this.__clientLeft, b = r - this.__clientTop; c = (w + c) * u / d - w, h = (b + h) * u / d - b, this.__computeScrollMax(u); } } if (this.__enableScrollX) { c -= l * this.options.speedMultiplier; let d = this.__maxScrollLeft; (c > d || c < 0) && (this.options.bouncing ? c += l / 2 * this.options.speedMultiplier : c = c > d ? d : 0); } if (this.__enableScrollY) { h -= a * this.options.speedMultiplier; const d = this.__maxScrollTop; (h > d || h < 0) && (this.options.bouncing ? h += a / 2 * this.options.speedMultiplier : h = h > d ? d : 0); } s.length > 60 && s.splice(0, 30), s.push(c, h, t), this.__publish(c, h, u); } else { let l = this.options.locking ? 3 : 0, a = 5, c = Math.abs(o - this.__initialTouchLeft), h = Math.abs(r - this.__initialTouchTop); this.__enableScrollX = this.options.scrollingX && c >= l, this.__enableScrollY = this.options.scrollingY && h >= l, s.push(this.__scrollLeft, this.__scrollTop, t), this.__isDragging = (this.__enableScrollX || this.__enableScrollY) && (c >= a || h >= a), this.__isDragging && (this.__interruptedAnimation = !1); } this.__lastTouchLeft = o, this.__lastTouchTop = r, this.__lastTouchMove = t, this.__lastScale = n; } doTouchEnd(e) { if (e instanceof Date && (e = e.valueOf()), typeof e != "number") throw new Error("Invalid timestamp value: " + e); if (this.__isTracking) { if (this.__isTracking = !1, this.__isDragging) if (this.__isDragging = !1, this.__isSingleTouch && this.options.animating && e - this.__lastTouchMove <= 100) { let t = this.__positions, n = t.length - 1, o = n; for (let r = n; r > 0 && t[r] > this.__lastTouchMove - 100; r -= 3) o = r; if (o !== n) { const r = t[n] - t[o], s = this.__scrollLeft - t[o - 2], l = this.__scrollTop - t[o - 1]; this.__decelerationVelocityX = s / r * (1e3 / 60), this.__decelerationVelocityY = l / r * (1e3 / 60); const a = this.options.paging || this.options.snapping ? 4 : 1; (Math.abs(this.__decelerationVelocityX) > a || Math.abs(this.__decelerationVelocityY) > a) && this.__startDeceleration(e); } else this.options.scrollingComplete?.(); } else e - this.__lastTouchMove > 100 && this.options.scrollingComplete?.(); this.__isDecelerating || ((this.__interruptedAnimation || this.__isDragging) && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0, this.__zoomLevel)), this.__positions.length = 0; } } __publish(e, t, n, o = !1) { const r = this.__isAnimating; if (r && (Ee(r), this.__isAnimating = 0), o && this.options.animating) { this.__scheduledLeft = e, this.__scheduledTop = t, this.__scheduledZoom = n; const s = this.__scrollLeft, l = this.__scrollTop, a = this.__zoomLevel, c = e - s, h = t - l, u = n - a, d = function(x, S, P) { P && (this.__scrollLeft = s + c * x, this.__scrollTop = l + h * x, this.__zoomLevel = a + u * x, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel)); }.bind(this), w = function(x) { return this.__isAnimating === x; }.bind(this), b = function(x, S, P) { S === this.__isAnimating && (this.__isAnimating = !1), (this.__didDecelerationComplete || P) && this.options.scrollingComplete?.(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null)); }.bind(this); this.__isAnimating = mt(d, w, b, this.options.animationDuration, r ? _n : mn); } else this.__scheduledLeft = this.__scrollLeft = e, this.__scheduledTop = this.__scrollTop = t, this.__scheduledZoom = this.__zoomLevel = n, this.__callback && this.__callback(e, t, n), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null)); } __computeScrollMax(e = this.__zoomLevel) { this.__maxScrollLeft = Math.max(this.__contentWidth * e - this.__clientWidth, 0), this.__maxScrollTop = Math.max(this.__contentHeight * e - this.__clientHeight, 0); } __startDeceleration(e) { if (this.options.paging) { const s = Math.max(Math.min(this.__scrollLeft, this.__maxScrollLeft), 0), l = Math.max(Math.min(this.__scrollTop, this.__maxScrollTop), 0), a = this.__clientWidth, c = this.__clientHeight; this.__minDecelerationScrollLeft = Math.floor(s / a) * a, this.__minDecelerationScrollTop = Math.floor(l / c) * c, this.__maxDecelerationScrollLeft = Math.ceil(s / a) * a, this.__maxDecelerationScrollTop = Math.ceil(l / c) * c; } else this.__minDecelerationScrollLeft = 0, this.__minDecelerationScrollTop = 0, this.__maxDecelerationScrollLeft = this.__maxScrollLeft, this.__maxDecelerationScrollTop = this.__maxScrollTop; const t = function(s, l, a) { this.__stepThroughDeceleration(a); }.bind(this), n = this.options.snapping ? 4 : 0.1, o = function() { const s = Math.abs(this.__decelerationVelocityX) >= n || Math.abs(this.__decelerationVelocityY) >= n; return s || (this.__didDecelerationComplete = !0), s; }.bind(this), r = function(s, l, a) { this.__isDecelerating = 0, this.__didDecelerationComplete && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping); }.bind(this); this.__isDecelerating = mt(t, o, r); } __stepThroughDeceleration(e) { let t = this.__scrollLeft + this.__decelerationVelocityX, n = this.__scrollTop + this.__decelerationVelocityY; if (!this.options.bouncing) { const o = Math.max(Math.min(this.__maxDecelerationScrollLeft, t), this.__minDecelerationScrollLeft); o !== t && (t = o, this.__decelerationVelocityX = 0); const r = Math.max(Math.min(this.__maxDecelerationScrollTop, n), this.__minDecelerationScrollTop); r !== n && (n = r, this.__decelerationVelocityY = 0); } if (e ? this.__publish(t, n, this.__zoomLevel) : (this.__scrollLeft = t, this.__scrollTop = n), !this.options.paging && (this.__decelerationVelocityX *= 0.95, this.__decelerationVelocityY *= 0.95), this.options.bouncing) { let o = 0, r = 0, s = this.options.penetrationDeceleration, l = this.options.penetrationAcceleration; t < this.__minDecelerationScrollLeft ? o = this.__minDecelerationScrollLeft - t : t > this.__maxDecelerationScrollLeft && (o = this.__maxDecelerationScrollLeft - t), n < this.__minDecelerationScrollTop ? r = this.__minDecelerationScrollTop - n : n > this.__maxDecelerationScrollTop && (r = this.__maxDecelerationScrollTop - n), o !== 0 && (o * this.__decelerationVelocityX <= 0 ? this.__decelerationVelocityX += o * s : this.__decelerationVelocityX = o * l), r !== 0 && (r * this.__decelerationVelocityY <= 0 ? this.__decelerationVelocityY += r * s : this.__decelerationVelocityY = r * l); } } } var Q = typeof window < "u" ? window : { screen: {}, navigator: {} }, we = (Q.matchMedia || function() { return { matches: !1 }; }).bind(Q), Tt = !1, gn = { get passive() { return Tt = !0; } }, ft = function() { }; Q.addEventListener && Q.addEventListener("p", ft, gn), Q.removeEventListener && Q.removeEventListener("p", ft, !1); var yn = Tt, vn = "PointerEvent" in Q, nt = "ontouchstart" in Q, Mt = nt || "TouchEvent" in Q && we("(any-pointer: coarse)").matches, gt = (Q.navigator.maxTouchPoints || 0) > 0 || Mt, Dt = Q.navigator.userAgent || "", xn = we("(pointer: coarse)").matches && /iPad|Macintosh/.test(Dt) && Math.min(Q.screen.width || 0, Q.screen.height || 0) >= 768, Pt = (we("(pointer: coarse)").matches || !we("(pointer: fine)").matches && nt) && !/Windows.*Firefox/.test(Dt), bn = we("(any-pointer: fine)").matches || we("(any-hover: hover)").matches || xn || !nt, Ze = !gt || !bn && Pt ? gt ? "touchOnly" : "mouseOnly" : "hybrid", wn = Ze === "mouseOnly" ? "mouse" : Ze === "touchOnly" || Pt ? "touch" : "mouse"; const Sn = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: Ze, primaryInput: wn, supportsPassiveEvents: yn, supportsPointerEvents: vn, supportsTouchEvents: Mt }, Symbol.toStringTag, { value: "Module" })), Ln = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), zt = {}; function Ge() { return Sn; } const kt = (i) => i === "BracketLeft" ? "[" : i === "BracketRight" ? "]" : te.camelToPrettyCase(i), io = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: zt, boundPixel: function(i, e = !1, t = 0) { return i; }, createSyntheticEvent: (i) => { let e = !1, t = !1; return { nativeEvent: i, currentTarget: i.currentTarget, target: i.target, bubbles: i.bubbles, cancelable: i.cancelable, defaultPrevented: i.defaultPrevented, eventPhase: i.eventPhase, isTrusted: i.isTrusted, preventDefault: () => { e = !0, i.preventDefault(); }, isDefaultPrevented: () => e, stopPropagation: () => { t = !0, i.stopPropagation(); }, isPropagationStopped: () => t, persist: () => { }, timeStamp: i.timeStamp, type: i.type }; }, detectIt: Ge, focusableNodeNames: Ln, toPrettyKeyCode: kt }, Symbol.toStringTag, { value: "Module" })), Cn = []; function At(i, e, t = Cn) { const n = A(null); return tn(i, () => { if (!n.current) return; const o = n.current, r = e?.(); if (!r || typeof r != "object") throw new Error("attributes must return a plain object of values"); const s = Object.keys(r), l = s.length; for (let a = 0; a < l; a++) { const c = s[a], h = r[c]; Object.defineProperty(o, c, { value: h, writable: !0, configurable: !0, enumerable: !0 }); } return o; }, t), n; } const yt = (i) => L(tt, { ...i }), En = ({ width: i, height: e }) => L("div", { className: "corner", style: { minWidth: `${i}px`, width: `${i}px`, minHeight: `${e}px`, height: `${e}px` } }), Tn = Se(Le((i, e) => { const { children: t, viewport: n, onScrollViewport: o, showHorizontalScrollbar: r = !0, showVerticalScrollbar: s = !0, createScrollCorner: l = En, createHorizontalScrollbar: a = yt, createVerticalScrollbar: c = yt, style: h, touchElement: u, disableTouch: d, ...w } = i, b = T(o, [o]), x = At(e, () => ({ isScrollPane: () => !0 }), []), S = A(null); V(() => { S.current && (S.current.__scrollTop === n?.top && S.current.__scrollLeft === n?.left || S.current.__isDecelerating || S.current?.scrollTo(n?.left, n?.top, !1)); }, [n?.left, n?.top, u]); const P = R((p, C) => { b?.({ left: p, top: C }); }, []), _ = R((p) => { S.current?.doTouchStart(p.touches, p.timeStamp); }, []), y = R((p) => { p.preventDefault(), S.current?.doTouchMove(p.touches, p.timeStamp); }, []), f = R((p) => { S.current?.doTouchEnd(p.timeStamp); }, []), k = R(({ containerWidth: p, containerHeight: C, totalWidth: m, totalHeight: E }) => { S.current.setDimensions(p, C, m, E); }, []); V(() => { const p = u ?? x.current; if (!d && Ge().supportsTouchEvents && p && n) { if (!S.current) { const C = { scrollingX: !0, scrollingY: !0, decelerationRate: 0.95, penetrationAcceleration: 0.08 }; S.current = new fn(P, C); } Ge().supportsTouchEvents && (p.addEventListener("touchstart", _), p.addEventListener("touchend", f), p.addEventListener("touchmove", y)), k({ containerWidth: n?.width, containerHeight: n?.height, totalWidth: n?.totalWidth, totalHeight: n?.totalHeight }); } return () => { p?.removeEventListener("touchstart", _), p?.removeEventListener("touchend", f), p?.removeEventListener("touchmove", y); }; }, [n?.width, n?.height, n?.totalWidth, n?.totalHeight, d, u]); const [z, { width: O }] = fe(), [F, { height: g }] = fe(), v = N(() => { const p = c({ orientation: re.Vertical, offset: n?.top, viewportSize: n?.height, totalSize: n?.totalHeight, onScrollOffset: (C) => { b?.({ top: C }); } }); return L("div", { style: { display: "flex", flex: "0" }, ref: z, children: p }); }, [c, n?.top, n?.height, n?.totalHeight]), B = N(() => { const p = a({ orientation: re.Horizontal, offset: n?.left, viewportSize: n?.width, totalSize: n?.totalWidth, onScrollOffset: (C) => b?.({ left: C }) }); return be("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${O}px)` }, children: L("div", { ref: F, className: "sizer", children: p }) }), s ? l({ width: O, height: g }) : L(Me, {})] }); }, [a, n?.left, n?.width, n?.totalWidth, s, l, O, g]); return L("div", { style: { position: "relative", display: "flex", minWidth: s ? `${O}px` : void 0, minHeight: r ? `${g}px` : void 0, ...h }, ...w, ref: x, children: be("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [be("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: t }), s ? v : L(Me, {})] }), r ? B : L(Me, {})] }) }); })); Tn.displayName = "ScrollPane"; const vt = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" }, xt = /* @__PURE__ */ new Set(), Bt = { showMessage: (i, e) => { if (e?.onceKey) { if (xt.has(e.onceKey)) return; xt.add(e.onceKey); } let t = console.log; e?.type !== vt.Warning && e?.type !== vt.Error || (t = console.warn), t(i); }, showBusy: (i, e) => new Promise((t) => { t(() => { }); }), showError: (i) => { console.error(i); } }; let ke = 0; function ro() { const [i, e] = G(!!document.fullscreenElement), t = R(() => { const n = document.fullscreenElement; return n ? n.querySelector(".fullscreen-portal-root") || n : document.body; }, []); return V(() => { function n() { const o = document.fullscreenElement; if (e(!!o), !o) return; let r = o.querySelector(".fullscreen-portal-root"); r || (r = document.createElement("div"), r.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", o.appendChild(r)); } return ke++, n(), document.addEventListener("fullscreenchange", n), () => { document.removeEventListener("fullscreenchange", n), ke--, ke <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((o) => { o.parentNode && o.parentNode.removeChild(o); }), ke = 0); }; }, []), { getPortalContainer: t, isFullscreen: i }; } const Mn = 100, Dn = 100, Pn = 1e6, zn = 100, kn = 50, An = Se(Le((i, e) => { const { offset: t = 0, viewportSize: n = 0, totalSize: o = 0, minSize: r = 0, endGap: s = Mn, endScrollIncrement: l = Dn, style: a = zt, onMouseDown: c, onScrollOffset: h, onScroll: u, scaleLimit: d = Pn, scaleFactor: w = zn, precisionFactor: b = kn, ...x } = i; u && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead"); const S = T(c, [c]), P = () => ({ offset: t, totalSize: d === 0 ? o : Math.min(o ?? 0, Math.max(r ?? 0, (t ?? 0) + (n ?? 0)) + (s ?? 0)) }), [_, y] = G(P), f = d !== 0 && _.totalSize > d ? w : 1, k = f / b, z = Math.ceil(_.totalSize / f), O = Math.ceil(_.offset / f), F = Math.ceil(n / f), g = R((D) => { }, []), [v, B] = G(!1), p = A(null); Ve(() => { if (!v) { p.current = { propTotalSize: o, propViewportSize: n, propOffset: t }; const D = P(); y(D); } }, [o, n, t, v, r, s, l]); const C = T((D, q, W) => { const Y = p.current; p.current = null, Y && Y.propTotalSize === o && Y.propViewportSize === n && Y.propOffset === t || (Math.abs(D - O) < k && (D = O), h?.(D * f, O, F)); }, [h, f, k, O, F]), m = R((D) => { document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", m), B(!1); }, []), E = R((D) => { S?.(D), B(!0), document.addEventListener("mousemove", g, { passive: !0 }), document.addEventListener("mouseup", m, { passive: !0 }); }, [g, m]); return L(tt, { ref: e, style: { ...a }, ...x, offset: O, totalSize: z, viewportSize: F, onMouseDown: E, onScrollOffset: C }); })); An.displayName = "VirtualScrollbar"; const so = { 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" }; function We(i, e) { if (typeof i == "function") return i(e); i && (i.current = e); } var He = parseInt(nn.split(".")[0], 10) >= 19 ? function(i) { return (e) => { const t = []; for (const n of i) { const o = We(n, e), r = typeof o == "function"; t.push(r ? o : () => We(n, null)); } return () => { for (const n of t) n(); }; }; } : function(i) { return (e) => { for (const t of i) We(t, e); }; }; const lo = Se(Le((i, e) => { const { refFocusStart: t, ...n } = i, o = A(null), r = R(() => { if (t) return void t?.current?.focus(); const s = o.current.parentElement.children; let l = []; for (let a = 0; a < s.length && s[a] !== o.current; a++) { const c = s[a].getAttribute("tabindex"); if (c == null || c === "-1" || s[a].getAttribute("disabled") === "true") continue; const h = s[a]; h.focus && l.push({ tabindex: parseInt(c), child: h }); } l.length !== 0 && (l.sort(function(a, c) { return a.tabindex - c.tabindex; }), l[0].child.focus()); }, [t]); return L("div", { tabIndex: 0, ref: He([o, e]), onFocus: r, ...n }); })), ao = Se(Le((i, e) => { const { className: t, style: n, children: o, radius: r = 4, strokeWidth: s = 1, strokeColor: l = "grey", ...a } = i, [c, { width: h, height: u }] = fe(), d = A(null), w = (P, _ = 0) => { const y = P / 2, f = u - y + _; return function(k, z, O = !1) { if (z === 0) return k; function F(m, E, D) { let q = E.x - m.x, W = E.y - m.y, Y = Math.sqrt(q * q + W * W); return g(m, E, Math.min(1, D / Y)); } function g(m, E, D) { return { x: m.x + (E.x - m.x) * D, y: m.y + (E.y - m.y) * D }; } function v(m, E) { m.length > 2 && (m[m.length - 2] = E.x, m[m.length - 1] = E.y); } function B(m) { return { x: parseFloat(m[m.length - 2]), y: parseFloat(m[m.length - 1]) }; } let p = k.split(/[,\s]/).reduce(function(m, E) { let D = E.match("([a-zA-Z])(.+)"); return D ? (m.push(D[1]), m.push(D[2])) : m.push(E), m; }, []).reduce(function(m, E) { return parseFloat(E) == E && m.length ? m[m.length - 1].push(E) : m.push([E]), m; }, []), C = []; if (p.length > 1) { let m = B(p[0]), E = null; p[p.length - 1][0] === "Z" && p[0].length > 2 && (E = ["L", m.x, m.y], p[p.length - 1] = E), C.push(p[0]); for (let D = 1; D < p.length; D++) { let q = C[C.length - 1], W = p[D], Y = W === E ? p[1] : p[D + 1]; if (Y && q && q.length > 2 && W[0] === "L" && Y.length > 2 && Y[0] === "L") { let X, $, I = B(q), j = B(W), ne = B(Y); O ? (X = g(j, q.origPoint || I, z), $ = g(j, Y.origPoint || ne, z)) : (X = F(j, I, z), $ = F(j, ne, z)), v(W, X), W.origPoint = j, C.push(W); let ge = g(X, j, 0.5), ye = g(j, $, 0.5), K = ["C", ge.x, ge.y, ye.x, ye.y, $.x, $.y]; K.origPoint = j, C.push(K); } else C.push(W); } if (E) { let D = B(C[C.length - 1]); C.push(["Z"]), v(C[0], D); } } else C = p; return C.reduce(function(m, E) { return m + E.join(" ") + " "; }, ""); }(`${`M 0 ${y} L ${r - 0.5} ${y} L ${r - 0.5} ${f} L ${2 * r} ${f}`} ${`L ${h - 2 * r} ${f}`} ${`M ${h - 2 * r} ${f} L ${h - r} ${f} L ${h - r} ${y} L ${h} ${y}`}`, r); }, b = N(() => w(s), [h, u, r, s]), x = N(() => { if (r === 0) return; const P = r / 2; return w(r) + `L ${h} 0 L 0 0 L 0 ${P}`; }, [b, r, s]), S = N(() => ({ style: { clipPath: `path('${x}')` } }), [x]); return be("div", { className: t, style: { display: "flex", flexDirection: "row", ...n }, ...a, ref: He([d, c, e]), children: [me.isValidElement(o) ? me.cloneElement(o, S) : L(Me, {}), L("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: h, height: u, viewBox: `0 0 ${h} ${u}`, children: L("path", { d: b, stroke: l, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: s }) })] }); })), Bn = {}, $n = (i) => { const { onPointerDown: e, style: t, splitDirection: n, paddingBefore: o = 0, paddingAfter: r = 0, disabled: s, key: l, hitAreaProps: a = Bn, ...c } = i, h = n === "row", { style: u, className: d, ...w } = a; return L("div", { style: { ...t, position: "relative" }, ...c, children: L("div", { className: ve("hit-box", d), style: { left: (h ? -o : 0) + "px", width: `calc(100% + ${h ? o + r : 0}px)`, top: (h ? 0 : -o) + "px", height: `calc(100% + ${h ? 0 : o + r}px)`, position: "absolute", ...u }, onPointerDown: s ? void 0 : e, ...w }) }, l); }, Ae = {}, _e = (i, e, t = !0) => i === null ? null : i.pixels !== null ? t ? i.pixels : e - i.pixels : (t ? i.percent : 100 - i.percent) / 100 * e, Be = (i, e = !0) => i?.percent ? `${e ? i.percent : 100 - i.percent}%` : i?.pixels ? `${i.pixels}px` : void 0, ue = (i, e) => { if (i == null) return null; const t = { percent: null, pixels: null }; let n = e; return typeof i == "string" && ((i = i.trim().toLowerCase()).endsWith("px") ? (i = i.substring(0, i.length - 2), n = !1) : i.endsWith("%") && (i = i.substring(0, i.length - 1), n = !0), i = parseFloat(i)), n ? t.percent = i : t.pixels = i, Object.freeze(t); }, co = Se(Le((i, e) => { const { elementBefore: t, elementAfter: n, splitDirection: o = "row", fixedPane: r = null, position: s, onPositionChange: l, minBefore: a, maxBefore: c, minAfter: h, maxAfter: u, children: d, className: w, style: b, disabled: x = !1, onDragStart: S, onDragResize: P, onDragFinish: _, resizerProps: y = Ae, paneProps: f = Ae, paneBeforeProps: k = Ae, paneAfterProps: z = Ae, createResizer: O = $n } = i; if (d) throw new Error("Use elementBefore and elementAfter instead of children."); const F = N(() => me.isValidElement(n) && me.isValidElement(t), [n, t]), g = N(() => { let M = null; r && (r === "before" ? M = 0 : r === "after" && (M = 1)); const H = M === null; return { fixedPaneOffset: M, isPercent: H, minBefore: ue(a, H), maxBefore: ue(c, H), minAfter: ue(h, H), maxAfter: ue(u, H) }; }, [a, c, h, u]), v = T(l, [l]), [B, p] = G(() => ue(s, r === null)); V(() => { p(ue(s, r === null)); }, [s, r]); const [C, { width: m, height: E }] = fe(), [D, { width: q, height: W }] = fe(), Y = o === "row" ? q : W, X = o === "row" ? m : E, $ = N(() => ((M, H, J, U) => { const ae = [null, null], oe = [null, null]; if (M || (M = { percent: U.fixedPaneOffset === null ? 50 : null, pixels: U.fixedPaneOffset === null ? null : 0 }), H === 0) return M?.pixels != null ? U.fixedPaneOffset !== 1 ? (ae[0] = M?.pixels, oe[1] = 100) : (ae[1] = M?.pixels - J, oe[0] = 100) : M?.percent != null && (U.fixedPaneOffset !== 1 ? (oe[0] = M?.percent, oe[1] = 100 - M?.percent) : (oe[1] = M?.percent, oe[0] = 100 - M?.percent)), { percents: oe, pixels: ae, minBefore: Be(U.minBefore, !0), maxBefore: Be(U.maxBefore, !0), minAfter: Be(U.minAfter), maxAfter: Be(U.maxAfter) }; let he = _e(M, H, U.fixedPaneOffset !== 1), ee = H - J, ct = _e(U.minBefore, ee, !0) ?? 0, Qt = _e(U.maxBefore, ee, !0) ?? ee, ze = 0, Fe = 0, ht = 0, ut = ee; ze = (_e(U.maxAfter, H, !1) ?? J) - J, Fe = _e(U.minAfter, H, !1) ?? H, ht = Math.max(ct, ze), ut = Math.min(Qt, Fe), he = Math.max(ht, Math.min(he, ut)), Fe = Math.min(ee - he, _e(U.maxAfter, ee - he, !0) ?? ee), ze = Math.min(ee - he, _e(U.minAfter, ee - he, !0) ?? ee), ae[0] = he, ae[1] = ee - ae[0]; const en = Math.max(0, Math.min(100, he / ee * 100)); return oe[0] = en, oe[1] = 100 - oe[0], { percents: oe, pixels: ae, minBefore: `${ct}px`, minAfter: `${ze}px`, maxBefore: `${ae[0]}px`, maxAfter: `${ae[1]}px` }; })(B, X, Y, g), [g, B, X, Y, o]), [I, j] = G(!1), ne = T(S, [S]), ge = T(P, [P]), ye = T(_, [_]), K = A(null), se = A(null), ie = A(null), { style: pe, className: le, ...ce } = f, Ce = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...pe }, { className: Rt, style: Vt, ...Ft } = k, { className: It, style: Nt, ...Wt } = z, Yt = { flex: "1 1 100%", width: "100%", ...b, flexDirection: o, display: "flex" }, { className: ot, style: it, onPointerDown: rt, ...st } = y, Xt = T((M) => { const H = ue(M, r === null); p(H); }, [r]), De = T((M) => { if (x || !I) return; const H = at.current?.getBoundingClientRect(); let J = 0; J = o === "row" ? (M.clientX ?? M.touches?.[0]?.clientX) - H.x : (M.clientY ?? M.touches?.[0]?.clientY) - H.y, J = Math.max(0, Math.min(X, J)), g.fixedPaneOffset === 1 && (J = X - J), s && B.pixels === J || p({ pixels: J, percent: null }), ge?.(J), M.stopPropagation(), M.preventDefault(); }, [g, o, x, I, B, X]), lt = T((M) => { if (document.removeEventListener("pointermove", De), document.removeEventListener("touchmove", De), document.removeEventListener("pointerup", lt), !!I && (j(!1), !!B)) { if (ye(B.pixels), !ue(s, r === null) || B.pixels !== s) { const H = { ...B }; H.percent === null && (H.percent = H.pixels / X * 100), v(H); } M.stopPropagation(), M.preventDefault(); } }, [B, I, s, r, X]), jt = T((M) => { rt?.(M), M.defaultPrevented || x || I || (j(!0), ne(), document.addEventListener("pointermove", De, { passive: !1 }), document.addEventListener("touchmove", De, { passive: !1 }), document.addEventListener("pointerup", lt, { passive: !1 })); }, [rt]), at = At(e, () => ({ setPosition: Xt, isSplitPane: () => !0 }), []), Ut = N(() => F ? O?.({ key: "resizer", ref: He([D, se]), className: ve("resizer", ot), onPointerDownCapture: jt, style: { cursor: x ? void 0 : o === "row" ? "ew-resize" : "ns-resize", minWidth: o === "row" ? "2px" : void 0, minHeight: o !== "row" ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...it }, splitDirection: o, disabled: x, ...st }) : null, [F, ot, st, o, it, x]), Pe = o === "row" ? "Width" : "Height", Zt = { ...Ce, ...Vt, flex: g.fixedPaneOffset === 0 && $?.pixels[0] !== null ? `0 0 ${Math.round($?.pixels[0])}px` : `1 1 ${Math.round($?.percents[0] ?? 100)}%`, [`min${Pe}`]: $?.minBefore, [`max${Pe}`]: n ? $?.maxBefore : "100%" }, Gt = { ...Ce, ...Nt, flex: g.fixedPaneOffset === 1 && $?.pixels[1] !== null ? `0 0 ${Math.round($?.pixels[1])}px` : `1 1 ${Math.round($?.percents[1] ?? 100)}%`, [`min${Pe}`]: $?.minAfter, [`max${Pe}`]: t ? $?.maxAfter : "100%" }, qt = N(() => t ? L("div", { ref: K, className: ve("before", le, Rt), style: Zt, ...ce, ...Ft, children: t }, "before") : null, [t, f, k, g, $]), Jt = N(() => n ? L("div", { ref: ie, className: ve("after", le, It), style: Gt, ...ce, ...Wt, children: n }, "after") : null, [n, f, z, g, $]); return be("div", { ref: He([C, at]), className: ve("splitPane", o === "row" ? "vertical" : "horizontal", { dragging: I }, w), style: Yt, children: [qt, Ut, Jt] }); })); function ho(i) { const [e, t] = G(typeof window < "u" ? window.devicePixelRatio : 1), n = A(null); return V(() => { if (!(typeof window < "u" && "matchMedia" in window)) return; const o = () => { const r = window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`); r.addEventListener("change", o, { once: !0, passive: !0 }), t(window.devicePixelRatio), n.current = { mediaMatcher: r, listener: o }; }; return o(), () => { n.current && n.current.mediaMatcher.removeEventListener("change", n.current.listener); }; }, [i]), e; } function uo(i) { if (typeof window > "u") return 1; const { defaultDpr: e = 1, maxDpr: t = 3, round: n = !0 } = i || {}, o = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : e; return Math.min(Math.max(1, n ? Math.floor(o) : o), t); } function po(i, e, t) { const n = T(e, [e]); V(() => { const o = (r) => { i.current && !i.current.contains(r.target) && n(r); }; return t && t.mouseEvents === !1 || (document.addEventListener("mousedown", o), document.addEventListener("touchstart", o)), t && t.focusEvents === !1 || document.addEventListener("focus", o), () => { document.removeEventListener("mousedown", o), document.removeEventListener("touchstart", o), document.removeEventListener("focus", o); }; }, [i]); } function On(i) { if (!i) throw new Error("must have a PointerHandlerOptions"); const { onPointerDown: e, onPointerUp: t, onPointerMoveOrWait: n, processTouch: o = !1, consumeTouch: r = !0 } = i, s = T(e, [e]), l = T(t, [t]), a = T(n, [n]), c = A(!1), h = i?.timerInitial ?? 230, u = i?.timerContinuous ?? h / 2, d = A(null), w = A(null), b = A(null), x = A(null), S = R(() => { x.current && (clearTimeout(x.current), x.current = null); }, []), P = R((v) => { x.current = setTimeout(() => { window.requestAnimationFrame(() => { c.current !== !1 && a?.(w.current, b.current, d.current); }), P(u); }, v ?? h); }, []); V(() => () => S(), []); const _ = o ? "pointer" : "mouse", y = R((v) => { v.stopPropagation(), v.stopImmediatePropagation(), v.preventDefault(); }, []), f = T((v) => { document.removeEventListener(`${_}move`, O), document.removeEventListener(`${_}up`, f), document.removeEventListener("keydown", F), document.removeEventListener("keyup", g), document.removeEventListener("touchstart", y, { capture: !0 }), document.removeEventListener("touchmove", y, { capture: !0 }), window.removeEventListener("blur", k), S(), window.requestAnimationFrame(() => { c.current !== !1 && (c.current = !1, l?.(v, b.current, d.current), b.current = null); }); }, []), k = R(() => { c.current !== !1 && (c.current = !1, f(w.current)); }, []), z = T(() => { S(), P(u), window.requestAnimationFrame(() => { c.current !== !1 && a?.(w.current, b.current, d.current); }); }, [u]), O = T((v) => { w.current = v, z(); }, []), F = T((v) => { b.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, z(); }, []), g = T((v) => { b.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, z(); }, [u]); return T((v) => { v.isDefaultPrevented() || (b.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, s(v, b.current) !== !1 && (d.current = v, w.current = v.nativeEvent, document.addEventListener(`${_}up`, f, { passive: !1 }), document.addEventListener(`${_}move`, O, { passive: !1 }), document.addEventListener("keydown", F, { passive: !1 }), document.addEventListener("keyup", g, { passive: !1 }), window.addEventListener("blur", k, { passive: !0 }), o && r && (document.addEventListener("touchstart", y, {