UNPKG

@param_tpss/react-dev-notes

Version:

A sticky developer note panel with drag-and-drop tasks and markdown editing, for React apps (dev-only tool).

2,057 lines 183 kB
import J, { useLayoutEffect as F3, useEffect as j, useRef as N, useMemo as z, useCallback as G, useState as B, createContext as H1, memo as _3, useReducer as L3, useContext as R1, forwardRef as s3, createElement as y0 } from "react"; import { unstable_batchedUpdates as n0, createPortal as P3 } from "react-dom"; var e0 = { exports: {} }, $1 = {}; /** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var W0; function $3() { if (W0) return $1; W0 = 1; var n = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment"); function t(r, o, i) { var s = null; if (i !== void 0 && (s = "" + i), o.key !== void 0 && (s = "" + o.key), "key" in o) { i = {}; for (var a in o) a !== "key" && (i[a] = o[a]); } else i = o; return o = i.ref, { $$typeof: n, type: r, key: s, ref: o !== void 0 ? o : null, props: i }; } return $1.Fragment = e, $1.jsx = t, $1.jsxs = t, $1; } var B1 = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var X0; function B3() { return X0 || (X0 = 1, process.env.NODE_ENV !== "production" && function() { function n(c) { if (c == null) return null; if (typeof c == "function") return c.$$typeof === L ? null : c.displayName || c.name || null; if (typeof c == "string") return c; switch (c) { case p: return "Fragment"; case m: return "Profiler"; case v: return "StrictMode"; case k: return "Suspense"; case M: return "SuspenseList"; case _: return "Activity"; } if (typeof c == "object") switch (typeof c.tag == "number" && console.error( "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." ), c.$$typeof) { case b: return "Portal"; case x: return (c.displayName || "Context") + ".Provider"; case D: return (c._context.displayName || "Context") + ".Consumer"; case S: var y = c.render; return c = c.displayName, c || (c = y.displayName || y.name || "", c = c !== "" ? "ForwardRef(" + c + ")" : "ForwardRef"), c; case R: return y = c.displayName || null, y !== null ? y : n(c.type) || "Memo"; case E: y = c._payload, c = c._init; try { return n(c(y)); } catch { } } return null; } function e(c) { return "" + c; } function t(c) { try { e(c); var y = !1; } catch { y = !0; } if (y) { y = console; var w = y.error, I = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object"; return w.call( y, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", I ), e(c); } } function r(c) { if (c === p) return "<>"; if (typeof c == "object" && c !== null && c.$$typeof === E) return "<...>"; try { var y = n(c); return y ? "<" + y + ">" : "<...>"; } catch { return "<...>"; } } function o() { var c = O.A; return c === null ? null : c.getOwner(); } function i() { return Error("react-stack-top-frame"); } function s(c) { if (K.call(c, "key")) { var y = Object.getOwnPropertyDescriptor(c, "key").get; if (y && y.isReactWarning) return !1; } return c.key !== void 0; } function a(c, y) { function w() { h1 || (h1 = !0, console.error( "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", y )); } w.isReactWarning = !0, Object.defineProperty(c, "key", { get: w, configurable: !0 }); } function l() { var c = n(this.type); return w1[c] || (w1[c] = !0, console.error( "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." )), c = this.props.ref, c !== void 0 ? c : null; } function C(c, y, w, I, X, U, V, p1) { return w = U.ref, c = { $$typeof: h, type: c, key: y, props: U, _owner: X }, (w !== void 0 ? w : null) !== null ? Object.defineProperty(c, "ref", { enumerable: !1, get: l }) : Object.defineProperty(c, "ref", { enumerable: !1, value: null }), c._store = {}, Object.defineProperty(c._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }), Object.defineProperty(c, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }), Object.defineProperty(c, "_debugStack", { configurable: !1, enumerable: !1, writable: !0, value: V }), Object.defineProperty(c, "_debugTask", { configurable: !1, enumerable: !1, writable: !0, value: p1 }), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c; } function u(c, y, w, I, X, U, V, p1) { var F = y.children; if (F !== void 0) if (I) if (n1(F)) { for (I = 0; I < F.length; I++) f(F[I]); Object.freeze && Object.freeze(F); } else console.error( "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." ); else f(F); if (K.call(y, "key")) { F = n(c); var q = Object.keys(y).filter(function(D1) { return D1 !== "key"; }); I = 0 < q.length ? "{key: someKey, " + q.join(": ..., ") + ": ...}" : "{key: someKey}", o1[F + I] || (q = 0 < q.length ? "{" + q.join(": ..., ") + ": ...}" : "{}", console.error( `A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, I, F, q, F ), o1[F + I] = !0); } if (F = null, w !== void 0 && (t(w), F = "" + w), s(y) && (t(y.key), F = "" + y.key), "key" in y) { w = {}; for (var T in y) T !== "key" && (w[T] = y[T]); } else w = y; return F && a( w, typeof c == "function" ? c.displayName || c.name || "Unknown" : c ), C( c, F, U, X, o(), w, V, p1 ); } function f(c) { typeof c == "object" && c !== null && c.$$typeof === h && c._store && (c._store.validated = 1); } var g = J, h = Symbol.for("react.transitional.element"), b = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), D = Symbol.for("react.consumer"), x = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), k = Symbol.for("react.suspense"), M = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), _ = Symbol.for("react.activity"), L = Symbol.for("react.client.reference"), O = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, n1 = Array.isArray, Z = console.createTask ? console.createTask : function() { return null; }; g = { "react-stack-bottom-frame": function(c) { return c(); } }; var h1, w1 = {}, W = g["react-stack-bottom-frame"].bind( g, i )(), E1 = Z(r(i)), o1 = {}; B1.Fragment = p, B1.jsx = function(c, y, w, I, X) { var U = 1e4 > O.recentlyCreatedOwnerStacks++; return u( c, y, w, !1, I, X, U ? Error("react-stack-top-frame") : W, U ? Z(r(c)) : E1 ); }, B1.jsxs = function(c, y, w, I, X) { var U = 1e4 > O.recentlyCreatedOwnerStacks++; return u( c, y, w, !0, I, X, U ? Error("react-stack-top-frame") : W, U ? Z(r(c)) : E1 ); }; }()), B1; } var U0; function Y3() { return U0 || (U0 = 1, process.env.NODE_ENV === "production" ? e0.exports = $3() : e0.exports = B3()), e0.exports; } var d = Y3(); function W3() { for (var n = arguments.length, e = new Array(n), t = 0; t < n; t++) e[t] = arguments[t]; return z( () => (r) => { e.forEach((o) => o(r)); }, // eslint-disable-next-line react-hooks/exhaustive-deps e ); } const c0 = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u"; function N1(n) { const e = Object.prototype.toString.call(n); return e === "[object Window]" || // In Electron context the Window object serializes to [object global] e === "[object global]"; } function R0(n) { return "nodeType" in n; } function Q(n) { var e, t; return n ? N1(n) ? n : R0(n) && (e = (t = n.ownerDocument) == null ? void 0 : t.defaultView) != null ? e : window : window; } function S0(n) { const { Document: e } = Q(n); return n instanceof e; } function G1(n) { return N1(n) ? !1 : n instanceof Q(n).HTMLElement; } function a3(n) { return n instanceof Q(n).SVGElement; } function I1(n) { return n ? N1(n) ? n.document : R0(n) ? S0(n) ? n : G1(n) || a3(n) ? n.ownerDocument : document : document : document; } const u1 = c0 ? F3 : j; function k0(n) { const e = N(n); return u1(() => { e.current = n; }), G(function() { for (var t = arguments.length, r = new Array(t), o = 0; o < t; o++) r[o] = arguments[o]; return e.current == null ? void 0 : e.current(...r); }, []); } function X3() { const n = N(null), e = G((r, o) => { n.current = setInterval(r, o); }, []), t = G(() => { n.current !== null && (clearInterval(n.current), n.current = null); }, []); return [e, t]; } function U1(n, e) { e === void 0 && (e = [n]); const t = N(n); return u1(() => { t.current !== n && (t.current = n); }, e), t; } function J1(n, e) { const t = N(); return z( () => { const r = n(t.current); return t.current = r, r; }, // eslint-disable-next-line react-hooks/exhaustive-deps [...e] ); } function i0(n) { const e = k0(n), t = N(null), r = G( (o) => { o !== t.current && e?.(o, t.current), t.current = o; }, //eslint-disable-next-line [] ); return [t, r]; } function m0(n) { const e = N(); return j(() => { e.current = n; }, [n]), e.current; } let p0 = {}; function K1(n, e) { return z(() => { if (e) return e; const t = p0[n] == null ? 0 : p0[n] + 1; return p0[n] = t, n + "-" + t; }, [n, e]); } function l3(n) { return function(e) { for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), o = 1; o < t; o++) r[o - 1] = arguments[o]; return r.reduce((i, s) => { const a = Object.entries(s); for (const [l, C] of a) { const u = i[l]; u != null && (i[l] = u + n * C); } return i; }, { ...e }); }; } const O1 = /* @__PURE__ */ l3(1), s0 = /* @__PURE__ */ l3(-1); function U3(n) { return "clientX" in n && "clientY" in n; } function M0(n) { if (!n) return !1; const { KeyboardEvent: e } = Q(n.target); return e && n instanceof e; } function V3(n) { if (!n) return !1; const { TouchEvent: e } = Q(n.target); return e && n instanceof e; } function x0(n) { if (V3(n)) { if (n.touches && n.touches.length) { const { clientX: e, clientY: t } = n.touches[0]; return { x: e, y: t }; } else if (n.changedTouches && n.changedTouches.length) { const { clientX: e, clientY: t } = n.changedTouches[0]; return { x: e, y: t }; } } return U3(n) ? { x: n.clientX, y: n.clientY } : null; } const V1 = /* @__PURE__ */ Object.freeze({ Translate: { toString(n) { if (!n) return; const { x: e, y: t } = n; return "translate3d(" + (e ? Math.round(e) : 0) + "px, " + (t ? Math.round(t) : 0) + "px, 0)"; } }, Scale: { toString(n) { if (!n) return; const { scaleX: e, scaleY: t } = n; return "scaleX(" + e + ") scaleY(" + t + ")"; } }, Transform: { toString(n) { if (n) return [V1.Translate.toString(n), V1.Scale.toString(n)].join(" "); } }, Transition: { toString(n) { let { property: e, duration: t, easing: r } = n; return e + " " + t + "ms " + r; } } }), V0 = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]"; function q3(n) { return n.matches(V0) ? n : n.querySelector(V0); } const H3 = { display: "none" }; function G3(n) { let { id: e, value: t } = n; return J.createElement("div", { id: e, style: H3 }, t); } function J3(n) { let { id: e, announcement: t, ariaLiveType: r = "assertive" } = n; const o = { position: "fixed", top: 0, left: 0, width: 1, height: 1, margin: -1, border: 0, padding: 0, overflow: "hidden", clip: "rect(0 0 0 0)", clipPath: "inset(100%)", whiteSpace: "nowrap" }; return J.createElement("div", { id: e, style: o, role: "status", "aria-live": r, "aria-atomic": !0 }, t); } function K3() { const [n, e] = B(""); return { announce: G((r) => { r != null && e(r); }, []), announcement: n }; } const c3 = /* @__PURE__ */ H1(null); function Z3(n) { const e = R1(c3); j(() => { if (!e) throw new Error("useDndMonitor must be used within a children of <DndContext>"); return e(n); }, [n, e]); } function Q3() { const [n] = B(() => /* @__PURE__ */ new Set()), e = G((r) => (n.add(r), () => n.delete(r)), [n]); return [G((r) => { let { type: o, event: i } = r; n.forEach((s) => { var a; return (a = s[o]) == null ? void 0 : a.call(s, i); }); }, [n]), e]; } const n2 = { draggable: ` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. ` }, e2 = { onDragStart(n) { let { active: e } = n; return "Picked up draggable item " + e.id + "."; }, onDragOver(n) { let { active: e, over: t } = n; return t ? "Draggable item " + e.id + " was moved over droppable area " + t.id + "." : "Draggable item " + e.id + " is no longer over a droppable area."; }, onDragEnd(n) { let { active: e, over: t } = n; return t ? "Draggable item " + e.id + " was dropped over droppable area " + t.id : "Draggable item " + e.id + " was dropped."; }, onDragCancel(n) { let { active: e } = n; return "Dragging was cancelled. Draggable item " + e.id + " was dropped."; } }; function t2(n) { let { announcements: e = e2, container: t, hiddenTextDescribedById: r, screenReaderInstructions: o = n2 } = n; const { announce: i, announcement: s } = K3(), a = K1("DndLiveRegion"), [l, C] = B(!1); if (j(() => { C(!0); }, []), Z3(z(() => ({ onDragStart(f) { let { active: g } = f; i(e.onDragStart({ active: g })); }, onDragMove(f) { let { active: g, over: h } = f; e.onDragMove && i(e.onDragMove({ active: g, over: h })); }, onDragOver(f) { let { active: g, over: h } = f; i(e.onDragOver({ active: g, over: h })); }, onDragEnd(f) { let { active: g, over: h } = f; i(e.onDragEnd({ active: g, over: h })); }, onDragCancel(f) { let { active: g, over: h } = f; i(e.onDragCancel({ active: g, over: h })); } }), [i, e])), !l) return null; const u = J.createElement(J.Fragment, null, J.createElement(G3, { id: r, value: o.draggable }), J.createElement(J3, { id: a, announcement: s })); return t ? P3(u, t) : u; } var P; (function(n) { n.DragStart = "dragStart", n.DragMove = "dragMove", n.DragEnd = "dragEnd", n.DragCancel = "dragCancel", n.DragOver = "dragOver", n.RegisterDroppable = "registerDroppable", n.SetDroppableDisabled = "setDroppableDisabled", n.UnregisterDroppable = "unregisterDroppable"; })(P || (P = {})); function a0() { } function r2(n, e) { return z( () => ({ sensor: n, options: {} }), // eslint-disable-next-line react-hooks/exhaustive-deps [n, e] ); } function o2() { for (var n = arguments.length, e = new Array(n), t = 0; t < n; t++) e[t] = arguments[t]; return z( () => [...e].filter((r) => r != null), // eslint-disable-next-line react-hooks/exhaustive-deps [...e] ); } const a1 = /* @__PURE__ */ Object.freeze({ x: 0, y: 0 }); function i2(n, e) { return Math.sqrt(Math.pow(n.x - e.x, 2) + Math.pow(n.y - e.y, 2)); } function s2(n, e) { let { data: { value: t } } = n, { data: { value: r } } = e; return t - r; } function a2(n, e) { let { data: { value: t } } = n, { data: { value: r } } = e; return r - t; } function l2(n, e) { if (!n || n.length === 0) return null; const [t] = n; return t[e]; } function q0(n, e, t) { return e === void 0 && (e = n.left), t === void 0 && (t = n.top), { x: e + n.width * 0.5, y: t + n.height * 0.5 }; } const c2 = (n) => { let { collisionRect: e, droppableRects: t, droppableContainers: r } = n; const o = q0(e, e.left, e.top), i = []; for (const s of r) { const { id: a } = s, l = t.get(a); if (l) { const C = i2(q0(l), o); i.push({ id: a, data: { droppableContainer: s, value: C } }); } } return i.sort(s2); }; function C2(n, e) { const t = Math.max(e.top, n.top), r = Math.max(e.left, n.left), o = Math.min(e.left + e.width, n.left + n.width), i = Math.min(e.top + e.height, n.top + n.height), s = o - r, a = i - t; if (r < o && t < i) { const l = e.width * e.height, C = n.width * n.height, u = s * a, f = u / (l + C - u); return Number(f.toFixed(4)); } return 0; } const u2 = (n) => { let { collisionRect: e, droppableRects: t, droppableContainers: r } = n; const o = []; for (const i of r) { const { id: s } = i, a = t.get(s); if (a) { const l = C2(a, e); l > 0 && o.push({ id: s, data: { droppableContainer: i, value: l } }); } } return o.sort(a2); }; function d2(n, e, t) { return { ...n, scaleX: e && t ? e.width / t.width : 1, scaleY: e && t ? e.height / t.height : 1 }; } function C3(n, e) { return n && e ? { x: n.left - e.left, y: n.top - e.top } : a1; } function f2(n) { return function(t) { for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++) o[i - 1] = arguments[i]; return o.reduce((s, a) => ({ ...s, top: s.top + n * a.y, bottom: s.bottom + n * a.y, left: s.left + n * a.x, right: s.right + n * a.x }), { ...t }); }; } const h2 = /* @__PURE__ */ f2(1); function p2(n) { if (n.startsWith("matrix3d(")) { const e = n.slice(9, -1).split(/, /); return { x: +e[12], y: +e[13], scaleX: +e[0], scaleY: +e[5] }; } else if (n.startsWith("matrix(")) { const e = n.slice(7, -1).split(/, /); return { x: +e[4], y: +e[5], scaleX: +e[0], scaleY: +e[3] }; } return null; } function g2(n, e, t) { const r = p2(e); if (!r) return n; const { scaleX: o, scaleY: i, x: s, y: a } = r, l = n.left - s - (1 - o) * parseFloat(t), C = n.top - a - (1 - i) * parseFloat(t.slice(t.indexOf(" ") + 1)), u = o ? n.width / o : n.width, f = i ? n.height / i : n.height; return { width: u, height: f, top: C, right: l + u, bottom: C + f, left: l }; } const v2 = { ignoreTransform: !1 }; function z1(n, e) { e === void 0 && (e = v2); let t = n.getBoundingClientRect(); if (e.ignoreTransform) { const { transform: C, transformOrigin: u } = Q(n).getComputedStyle(n); C && (t = g2(t, C, u)); } const { top: r, left: o, width: i, height: s, bottom: a, right: l } = t; return { top: r, left: o, width: i, height: s, bottom: a, right: l }; } function H0(n) { return z1(n, { ignoreTransform: !0 }); } function b2(n) { const e = n.innerWidth, t = n.innerHeight; return { top: 0, left: 0, right: e, bottom: t, width: e, height: t }; } function y2(n, e) { return e === void 0 && (e = Q(n).getComputedStyle(n)), e.position === "fixed"; } function m2(n, e) { e === void 0 && (e = Q(n).getComputedStyle(n)); const t = /(auto|scroll|overlay)/; return ["overflow", "overflowX", "overflowY"].some((o) => { const i = e[o]; return typeof i == "string" ? t.test(i) : !1; }); } function T0(n, e) { const t = []; function r(o) { if (e != null && t.length >= e || !o) return t; if (S0(o) && o.scrollingElement != null && !t.includes(o.scrollingElement)) return t.push(o.scrollingElement), t; if (!G1(o) || a3(o) || t.includes(o)) return t; const i = Q(n).getComputedStyle(o); return o !== n && m2(o, i) && t.push(o), y2(o, i) ? t : r(o.parentNode); } return n ? r(n) : t; } function u3(n) { const [e] = T0(n, 1); return e ?? null; } function g0(n) { return !c0 || !n ? null : N1(n) ? n : R0(n) ? S0(n) || n === I1(n).scrollingElement ? window : G1(n) ? n : null : null; } function d3(n) { return N1(n) ? n.scrollX : n.scrollLeft; } function f3(n) { return N1(n) ? n.scrollY : n.scrollTop; } function w0(n) { return { x: d3(n), y: f3(n) }; } var $; (function(n) { n[n.Forward = 1] = "Forward", n[n.Backward = -1] = "Backward"; })($ || ($ = {})); function h3(n) { return !c0 || !n ? !1 : n === document.scrollingElement; } function p3(n) { const e = { x: 0, y: 0 }, t = h3(n) ? { height: window.innerHeight, width: window.innerWidth } : { height: n.clientHeight, width: n.clientWidth }, r = { x: n.scrollWidth - t.width, y: n.scrollHeight - t.height }, o = n.scrollTop <= e.y, i = n.scrollLeft <= e.x, s = n.scrollTop >= r.y, a = n.scrollLeft >= r.x; return { isTop: o, isLeft: i, isBottom: s, isRight: a, maxScroll: r, minScroll: e }; } const x2 = { x: 0.2, y: 0.2 }; function w2(n, e, t, r, o) { let { top: i, left: s, right: a, bottom: l } = t; r === void 0 && (r = 10), o === void 0 && (o = x2); const { isTop: C, isBottom: u, isLeft: f, isRight: g } = p3(n), h = { x: 0, y: 0 }, b = { x: 0, y: 0 }, p = { height: e.height * o.y, width: e.width * o.x }; return !C && i <= e.top + p.height ? (h.y = $.Backward, b.y = r * Math.abs((e.top + p.height - i) / p.height)) : !u && l >= e.bottom - p.height && (h.y = $.Forward, b.y = r * Math.abs((e.bottom - p.height - l) / p.height)), !g && a >= e.right - p.width ? (h.x = $.Forward, b.x = r * Math.abs((e.right - p.width - a) / p.width)) : !f && s <= e.left + p.width && (h.x = $.Backward, b.x = r * Math.abs((e.left + p.width - s) / p.width)), { direction: h, speed: b }; } function E2(n) { if (n === document.scrollingElement) { const { innerWidth: i, innerHeight: s } = window; return { top: 0, left: 0, right: i, bottom: s, width: i, height: s }; } const { top: e, left: t, right: r, bottom: o } = n.getBoundingClientRect(); return { top: e, left: t, right: r, bottom: o, width: n.clientWidth, height: n.clientHeight }; } function g3(n) { return n.reduce((e, t) => O1(e, w0(t)), a1); } function D2(n) { return n.reduce((e, t) => e + d3(t), 0); } function R2(n) { return n.reduce((e, t) => e + f3(t), 0); } function S2(n, e) { if (e === void 0 && (e = z1), !n) return; const { top: t, left: r, bottom: o, right: i } = e(n); u3(n) && (o <= 0 || i <= 0 || t >= window.innerHeight || r >= window.innerWidth) && n.scrollIntoView({ block: "center", inline: "center" }); } const k2 = [["x", ["left", "right"], D2], ["y", ["top", "bottom"], R2]]; class A0 { constructor(e, t) { this.rect = void 0, this.width = void 0, this.height = void 0, this.top = void 0, this.bottom = void 0, this.right = void 0, this.left = void 0; const r = T0(t), o = g3(r); this.rect = { ...e }, this.width = e.width, this.height = e.height; for (const [i, s, a] of k2) for (const l of s) Object.defineProperty(this, l, { get: () => { const C = a(r), u = o[i] - C; return this.rect[l] + u; }, enumerable: !0 }); Object.defineProperty(this, "rect", { enumerable: !1 }); } } class Y1 { constructor(e) { this.target = void 0, this.listeners = [], this.removeAll = () => { this.listeners.forEach((t) => { var r; return (r = this.target) == null ? void 0 : r.removeEventListener(...t); }); }, this.target = e; } add(e, t, r) { var o; (o = this.target) == null || o.addEventListener(e, t, r), this.listeners.push([e, t, r]); } } function M2(n) { const { EventTarget: e } = Q(n); return n instanceof e ? n : I1(n); } function v0(n, e) { const t = Math.abs(n.x), r = Math.abs(n.y); return typeof e == "number" ? Math.sqrt(t ** 2 + r ** 2) > e : "x" in e && "y" in e ? t > e.x && r > e.y : "x" in e ? t > e.x : "y" in e ? r > e.y : !1; } var s1; (function(n) { n.Click = "click", n.DragStart = "dragstart", n.Keydown = "keydown", n.ContextMenu = "contextmenu", n.Resize = "resize", n.SelectionChange = "selectionchange", n.VisibilityChange = "visibilitychange"; })(s1 || (s1 = {})); function G0(n) { n.preventDefault(); } function T2(n) { n.stopPropagation(); } var A; (function(n) { n.Space = "Space", n.Down = "ArrowDown", n.Right = "ArrowRight", n.Left = "ArrowLeft", n.Up = "ArrowUp", n.Esc = "Escape", n.Enter = "Enter", n.Tab = "Tab"; })(A || (A = {})); const v3 = { start: [A.Space, A.Enter], cancel: [A.Esc], end: [A.Space, A.Enter, A.Tab] }, A2 = (n, e) => { let { currentCoordinates: t } = e; switch (n.code) { case A.Right: return { ...t, x: t.x + 25 }; case A.Left: return { ...t, x: t.x - 25 }; case A.Down: return { ...t, y: t.y + 25 }; case A.Up: return { ...t, y: t.y - 25 }; } }; class b3 { constructor(e) { this.props = void 0, this.autoScrollEnabled = !1, this.referenceCoordinates = void 0, this.listeners = void 0, this.windowListeners = void 0, this.props = e; const { event: { target: t } } = e; this.props = e, this.listeners = new Y1(I1(t)), this.windowListeners = new Y1(Q(t)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach(); } attach() { this.handleStart(), this.windowListeners.add(s1.Resize, this.handleCancel), this.windowListeners.add(s1.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(s1.Keydown, this.handleKeyDown)); } handleStart() { const { activeNode: e, onStart: t } = this.props, r = e.node.current; r && S2(r), t(a1); } handleKeyDown(e) { if (M0(e)) { const { active: t, context: r, options: o } = this.props, { keyboardCodes: i = v3, coordinateGetter: s = A2, scrollBehavior: a = "smooth" } = o, { code: l } = e; if (i.end.includes(l)) { this.handleEnd(e); return; } if (i.cancel.includes(l)) { this.handleCancel(e); return; } const { collisionRect: C } = r.current, u = C ? { x: C.left, y: C.top } : a1; this.referenceCoordinates || (this.referenceCoordinates = u); const f = s(e, { active: t, context: r.current, currentCoordinates: u }); if (f) { const g = s0(f, u), h = { x: 0, y: 0 }, { scrollableAncestors: b } = r.current; for (const p of b) { const v = e.code, { isTop: m, isRight: D, isLeft: x, isBottom: S, maxScroll: k, minScroll: M } = p3(p), R = E2(p), E = { x: Math.min(v === A.Right ? R.right - R.width / 2 : R.right, Math.max(v === A.Right ? R.left : R.left + R.width / 2, f.x)), y: Math.min(v === A.Down ? R.bottom - R.height / 2 : R.bottom, Math.max(v === A.Down ? R.top : R.top + R.height / 2, f.y)) }, _ = v === A.Right && !D || v === A.Left && !x, L = v === A.Down && !S || v === A.Up && !m; if (_ && E.x !== f.x) { const O = p.scrollLeft + g.x, K = v === A.Right && O <= k.x || v === A.Left && O >= M.x; if (K && !g.y) { p.scrollTo({ left: O, behavior: a }); return; } K ? h.x = p.scrollLeft - O : h.x = v === A.Right ? p.scrollLeft - k.x : p.scrollLeft - M.x, h.x && p.scrollBy({ left: -h.x, behavior: a }); break; } else if (L && E.y !== f.y) { const O = p.scrollTop + g.y, K = v === A.Down && O <= k.y || v === A.Up && O >= M.y; if (K && !g.x) { p.scrollTo({ top: O, behavior: a }); return; } K ? h.y = p.scrollTop - O : h.y = v === A.Down ? p.scrollTop - k.y : p.scrollTop - M.y, h.y && p.scrollBy({ top: -h.y, behavior: a }); break; } } this.handleMove(e, O1(s0(f, this.referenceCoordinates), h)); } } } handleMove(e, t) { const { onMove: r } = this.props; e.preventDefault(), r(t); } handleEnd(e) { const { onEnd: t } = this.props; e.preventDefault(), this.detach(), t(); } handleCancel(e) { const { onCancel: t } = this.props; e.preventDefault(), this.detach(), t(); } detach() { this.listeners.removeAll(), this.windowListeners.removeAll(); } } b3.activators = [{ eventName: "onKeyDown", handler: (n, e, t) => { let { keyboardCodes: r = v3, onActivation: o } = e, { active: i } = t; const { code: s } = n.nativeEvent; if (r.start.includes(s)) { const a = i.activatorNode.current; return a && n.target !== a ? !1 : (n.preventDefault(), o?.({ event: n.nativeEvent }), !0); } return !1; } }]; function J0(n) { return !!(n && "distance" in n); } function K0(n) { return !!(n && "delay" in n); } class j0 { constructor(e, t, r) { var o; r === void 0 && (r = M2(e.event.target)), this.props = void 0, this.events = void 0, this.autoScrollEnabled = !0, this.document = void 0, this.activated = !1, this.initialCoordinates = void 0, this.timeoutId = null, this.listeners = void 0, this.documentListeners = void 0, this.windowListeners = void 0, this.props = e, this.events = t; const { event: i } = e, { target: s } = i; this.props = e, this.events = t, this.document = I1(s), this.documentListeners = new Y1(this.document), this.listeners = new Y1(r), this.windowListeners = new Y1(Q(s)), this.initialCoordinates = (o = x0(i)) != null ? o : a1, this.handleStart = this.handleStart.bind(this), this.handleMove = this.handleMove.bind(this), this.handleEnd = this.handleEnd.bind(this), this.handleCancel = this.handleCancel.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.removeTextSelection = this.removeTextSelection.bind(this), this.attach(); } attach() { const { events: e, props: { options: { activationConstraint: t, bypassActivationConstraint: r } } } = this; if (this.listeners.add(e.move.name, this.handleMove, { passive: !1 }), this.listeners.add(e.end.name, this.handleEnd), e.cancel && this.listeners.add(e.cancel.name, this.handleCancel), this.windowListeners.add(s1.Resize, this.handleCancel), this.windowListeners.add(s1.DragStart, G0), this.windowListeners.add(s1.VisibilityChange, this.handleCancel), this.windowListeners.add(s1.ContextMenu, G0), this.documentListeners.add(s1.Keydown, this.handleKeydown), t) { if (r != null && r({ event: this.props.event, activeNode: this.props.activeNode, options: this.props.options })) return this.handleStart(); if (K0(t)) { this.timeoutId = setTimeout(this.handleStart, t.delay), this.handlePending(t); return; } if (J0(t)) { this.handlePending(t); return; } } this.handleStart(); } detach() { this.listeners.removeAll(), this.windowListeners.removeAll(), setTimeout(this.documentListeners.removeAll, 50), this.timeoutId !== null && (clearTimeout(this.timeoutId), this.timeoutId = null); } handlePending(e, t) { const { active: r, onPending: o } = this.props; o(r, e, this.initialCoordinates, t); } handleStart() { const { initialCoordinates: e } = this, { onStart: t } = this.props; e && (this.activated = !0, this.documentListeners.add(s1.Click, T2, { capture: !0 }), this.removeTextSelection(), this.documentListeners.add(s1.SelectionChange, this.removeTextSelection), t(e)); } handleMove(e) { var t; const { activated: r, initialCoordinates: o, props: i } = this, { onMove: s, options: { activationConstraint: a } } = i; if (!o) return; const l = (t = x0(e)) != null ? t : a1, C = s0(o, l); if (!r && a) { if (J0(a)) { if (a.tolerance != null && v0(C, a.tolerance)) return this.handleCancel(); if (v0(C, a.distance)) return this.handleStart(); } if (K0(a) && v0(C, a.tolerance)) return this.handleCancel(); this.handlePending(a, C); return; } e.cancelable && e.preventDefault(), s(l); } handleEnd() { const { onAbort: e, onEnd: t } = this.props; this.detach(), this.activated || e(this.props.active), t(); } handleCancel() { const { onAbort: e, onCancel: t } = this.props; this.detach(), this.activated || e(this.props.active), t(); } handleKeydown(e) { e.code === A.Esc && this.handleCancel(); } removeTextSelection() { var e; (e = this.document.getSelection()) == null || e.removeAllRanges(); } } const j2 = { cancel: { name: "pointercancel" }, move: { name: "pointermove" }, end: { name: "pointerup" } }; class O0 extends j0 { constructor(e) { const { event: t } = e, r = I1(t.target); super(e, j2, r); } } O0.activators = [{ eventName: "onPointerDown", handler: (n, e) => { let { nativeEvent: t } = n, { onActivation: r } = e; return !t.isPrimary || t.button !== 0 ? !1 : (r?.({ event: t }), !0); } }]; const O2 = { move: { name: "mousemove" }, end: { name: "mouseup" } }; var E0; (function(n) { n[n.RightClick = 2] = "RightClick"; })(E0 || (E0 = {})); class N2 extends j0 { constructor(e) { super(e, O2, I1(e.event.target)); } } N2.activators = [{ eventName: "onMouseDown", handler: (n, e) => { let { nativeEvent: t } = n, { onActivation: r } = e; return t.button === E0.RightClick ? !1 : (r?.({ event: t }), !0); } }]; const b0 = { cancel: { name: "touchcancel" }, move: { name: "touchmove" }, end: { name: "touchend" } }; class I2 extends j0 { constructor(e) { super(e, b0); } static setup() { return window.addEventListener(b0.move.name, e, { capture: !1, passive: !1 }), function() { window.removeEventListener(b0.move.name, e); }; function e() { } } } I2.activators = [{ eventName: "onTouchStart", handler: (n, e) => { let { nativeEvent: t } = n, { onActivation: r } = e; const { touches: o } = t; return o.length > 1 ? !1 : (r?.({ event: t }), !0); } }]; var W1; (function(n) { n[n.Pointer = 0] = "Pointer", n[n.DraggableRect = 1] = "DraggableRect"; })(W1 || (W1 = {})); var l0; (function(n) { n[n.TreeOrder = 0] = "TreeOrder", n[n.ReversedTreeOrder = 1] = "ReversedTreeOrder"; })(l0 || (l0 = {})); function z2(n) { let { acceleration: e, activator: t = W1.Pointer, canScroll: r, draggingRect: o, enabled: i, interval: s = 5, order: a = l0.TreeOrder, pointerCoordinates: l, scrollableAncestors: C, scrollableAncestorRects: u, delta: f, threshold: g } = n; const h = _2({ delta: f, disabled: !i }), [b, p] = X3(), v = N({ x: 0, y: 0 }), m = N({ x: 0, y: 0 }), D = z(() => { switch (t) { case W1.Pointer: return l ? { top: l.y, bottom: l.y, left: l.x, right: l.x } : null; case W1.DraggableRect: return o; } }, [t, o, l]), x = N(null), S = G(() => { const M = x.current; if (!M) return; const R = v.current.x * m.current.x, E = v.current.y * m.current.y; M.scrollBy(R, E); }, []), k = z(() => a === l0.TreeOrder ? [...C].reverse() : C, [a, C]); j( () => { if (!i || !C.length || !D) { p(); return; } for (const M of k) { if (r?.(M) === !1) continue; const R = C.indexOf(M), E = u[R]; if (!E) continue; const { direction: _, speed: L } = w2(M, E, D, e, g); for (const O of ["x", "y"]) h[O][_[O]] || (L[O] = 0, _[O] = 0); if (L.x > 0 || L.y > 0) { p(), x.current = M, b(S, s), v.current = L, m.current = _; return; } } v.current = { x: 0, y: 0 }, m.current = { x: 0, y: 0 }, p(); }, // eslint-disable-next-line react-hooks/exhaustive-deps [ e, S, r, p, i, s, // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify(D), // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify(h), b, C, k, u, // eslint-disable-next-line react-hooks/exhaustive-deps JSON.stringify(g) ] ); } const F2 = { x: { [$.Backward]: !1, [$.Forward]: !1 }, y: { [$.Backward]: !1, [$.Forward]: !1 } }; function _2(n) { let { delta: e, disabled: t } = n; const r = m0(e); return J1((o) => { if (t || !r || !o) return F2; const i = { x: Math.sign(e.x - r.x), y: Math.sign(e.y - r.y) }; return { x: { [$.Backward]: o.x[$.Backward] || i.x === -1, [$.Forward]: o.x[$.Forward] || i.x === 1 }, y: { [$.Backward]: o.y[$.Backward] || i.y === -1, [$.Forward]: o.y[$.Forward] || i.y === 1 } }; }, [t, e, r]); } function L2(n, e) { const t = e != null ? n.get(e) : void 0, r = t ? t.node.current : null; return J1((o) => { var i; return e == null ? null : (i = r ?? o) != null ? i : null; }, [r, e]); } function P2(n, e) { return z(() => n.reduce((t, r) => { const { sensor: o } = r, i = o.activators.map((s) => ({ eventName: s.eventName, handler: e(s.handler, r) })); return [...t, ...i]; }, []), [n, e]); } var q1; (function(n) { n[n.Always = 0] = "Always", n[n.BeforeDragging = 1] = "BeforeDragging", n[n.WhileDragging = 2] = "WhileDragging"; })(q1 || (q1 = {})); var D0; (function(n) { n.Optimized = "optimized"; })(D0 || (D0 = {})); const Z0 = /* @__PURE__ */ new Map(); function $2(n, e) { let { dragging: t, dependencies: r, config: o } = e; const [i, s] = B(null), { frequency: a, measure: l, strategy: C } = o, u = N(n), f = v(), g = U1(f), h = G(function(m) { m === void 0 && (m = []), !g.current && s((D) => D === null ? m : D.concat(m.filter((x) => !D.includes(x)))); }, [g]), b = N(null), p = J1((m) => { if (f && !t) return Z0; if (!m || m === Z0 || u.current !== n || i != null) { const D = /* @__PURE__ */ new Map(); for (let x of n) { if (!x) continue; if (i && i.length > 0 && !i.includes(x.id) && x.rect.current) { D.set(x.id, x.rect.current); continue; } const S = x.node.current, k = S ? new A0(l(S), S) : null; x.rect.current = k, k && D.set(x.id, k); } return D; } return m; }, [n, i, t, f, l]); return j(() => { u.current = n; }, [n]), j( () => { f || h(); }, // eslint-disable-next-line react-hooks/exhaustive-deps [t, f] ), j( () => { i && i.length > 0 && s(null); }, //eslint-disable-next-line react-hooks/exhaustive-deps [JSON.stringify(i)] ), j( () => { f || typeof a != "number" || b.current !== null || (b.current = setTimeout(() => { h(), b.current = null; }, a)); }, // eslint-disable-next-line react-hooks/exhaustive-deps [a, f, h, ...r] ), { droppableRects: p, measureDroppableContainers: h, measuringScheduled: i != null }; function v() { switch (C) { case q1.Always: return !1; case q1.BeforeDragging: return t; default: return !t; } } } function y3(n, e) { return J1((t) => n ? t || (typeof e == "function" ? e(n) : n) : null, [e, n]); } function B2(n, e) { return y3(n, e); } function Y2(n) { let { callback: e, disabled: t } = n; const r = k0(e), o = z(() => { if (t || typeof window > "u" || typeof window.MutationObserver > "u") return; const { MutationObserver: i } = window; return new i(r); }, [r, t]); return j(() => () => o?.disconnect(), [o]), o; } function C0(n) { let { callback: e, disabled: t } = n; const r = k0(e), o = z( () => { if (t || typeof window > "u" || typeof window.ResizeObserver > "u") return; const { ResizeObserver: i } = window; return new i(r); }, // eslint-disable-next-line react-hooks/exhaustive-deps [t] ); return j(() => () => o?.disconnect(), [o]), o; } function W2(n) { return new A0(z1(n), n); } function Q0(n, e, t) { e === void 0 && (e = W2); const [r, o] = B(null); function i() { o((l) => { if (!n) return null; if (n.isConnected === !1) { var C; return (C = l ?? t) != null ? C : null; } const u = e(n); return JSON.stringify(l) === JSON.stringify(u) ? l : u; }); } const s = Y2({ callback(l) { if (n) for (const C of l) { const { type: u, target: f } = C; if (u === "childList" && f instanceof HTMLElement && f.contains(n)) { i(); break; } } } }), a = C0({ callback: i }); return u1(() => { i(), n ? (a?.observe(n), s?.observe(document.body, { childList: !0, subtree: !0 })) : (a?.disconnect(), s?.disconnect()); }, [n]), r; } function X2(n) { const e = y3(n); return C3(n, e); } const n3 = []; function U2(n) { const e = N(n), t = J1((r) => n ? r && r !== n3 && n && e.current && n.parentNode === e.current.parentNode ? r : T0(n) : n3, [n]); return j(() => { e.current = n; }, [n]), t; } function V2(n) { const [e, t] = B(null), r = N(n), o = G((i) => { const s = g0(i.target); s && t((a) => a ? (a.set(s, w0(s)), new Map(a)) : null); }, []); return j(() => { const i = r.current; if (n !== i) { s(i); const a = n.map((l) => { const C = g0(l); return C ? (C.addEventListener("scroll", o, { passive: !0 }), [C, w0(C)]) : null; }).filter((l) => l != null); t(a.length ? new Map(a) : null), r.current = n; } return () => { s(n), s(i); }; function s(a) { a.forEach((l) => { const C = g0(l); C?.removeEventListener("scroll", o); }); } }, [o, n]), z(() => n.length ? e ? Array.from(e.values()).reduce((i, s) => O1(i, s), a1) : g3(n) : a1, [n, e]); } function e3(n, e) { e === void 0 && (e = []); const t = N(null); return j( () => { t.current = null; }, // eslint-disable-next-line react-hooks/exhaustive-deps e ), j(() => { const r = n !== a1; r && !t.current && (t.current = n), !r && t.current && (t.current = null); }, [n]), t.current ? s0(n, t.current) : a1; } function q2(n) { j( () => { if (!c0) return; const e = n.map((t) => { let { sensor: r } = t; return r.setup == null ? void 0 : r.setup(); }); return () => { for (const t of e) t?.(); }; }, // TO-DO: Sensors length could theoretically change which would not be a valid dependency // eslint-disable-next-line react-hooks/exhaustive-deps n.map((e) => { let { sensor: t } = e; return t; }) ); } function H2(n, e) { return z(() => n.reduce((t, r) => { let { eventName: o, handler: i } = r; return t[o] = (s) => { i(s, e); }, t; }, {}), [n, e]); } function m3(n) { return z(() => n ? b2(n) : null, [n]); } const t3 = []; function G2(n, e) { e === void 0 && (e = z1); const [t] = n, r = m3(t ? Q(t) : null), [o, i] = B(t3); function s() { i(() => n.length ? n.map((l) => h3(l) ? r : new A0(e(l), l)) : t3); } const a = C0({ callback: s }); return u1(() => { a?.disconnect(), s(), n.forEach((l) => a?.observe(l)); }, [n]), o; } function J2(n) { if (!n) return null; if (n.children.length > 1) return n; const e = n.children[0]; return G1(e) ? e : n; } function K2(n) { let { measure: e } = n; const [t, r] = B(null), o = G((C) => { for (const { target: u } of C) if (G1(u)) { r((f) => { const g = e(u); return f ? { ...f, width: g.width, height: g.height } : g; }); break; } }, [e]), i = C0({ callback: o }), s = G((C) => { const u = J2(C); i?.disconnect(), u && i?.observe(u), r(u ? e(u) : null); }, [e, i]), [a, l] = i0(s); return z(() => ({ nodeRef: a, rect: t, setRef: l }), [t, a, l]); } const Z2 = [{ sensor: O0, options: {} }, { sensor: b3, options: {} }], Q2 = { current: {} }, o0 = { draggable: { measure: H0 }, droppable: { measure: H0, strategy: q1.WhileDragging, frequency: D0.Optimized }, dragOverlay: { measure: z1 } }; class X1 extends Map { get(e) { var t; return e != null && (t = super.get(e)) != null ? t : void 0; } toArray() { return Array.from(this.values()); } getEnabled() { return this.toArray().filter((e) => { let { disabled: t } = e; return !t; }); } getNodeFor(e) { var t, r; return (t = (r = this.get(e)) == null ? void 0 : r.node.current) != null ? t : void 0; } } const n9 = { activatorEvent: null, active: null, activeNode: null, activeNodeRect: null, collisions: null, containerNodeRect: null, draggableNodes: /* @__PURE__ */ new Map(), droppableRects: /* @__PURE__ */ new Map(), droppableContainers: /* @__PURE__ */ new X1(), over: null, dragOverlay: { nodeRef: { current: null }, rect: null, setRef: a0 }, scrollableAncestors: [], scrollableAncestorRects: [], measuringConfiguration: o0, measureDroppableContainers: a0, windowRect: null, measuringScheduled: !1 }, e9 = { activato