import { CSS as e, add as t, canUseDOM as n, findFirstFocusableNode as r, getEventCoordinates as i, getOwnerDocument as a, getWindow as o, isDocument as s, isHTMLElement as c, isKeyboardEvent as l, isNode as u, isSVGElement as d, isWindow as f, subtract as p, useEvent as m, useInterval as h, useIsomorphicLayoutEffect as g, useLatestValue as _, useLazyMemo as v, useNodeRef as y, usePrevious as b, useUniqueId as x } from "../../utilities/dist/utilities.esm.js";
import { HiddenText as S, LiveRegion as C, useAnnouncement as w } from "../../accessibility/dist/accessibility.esm.js";
import T, { cloneElement as E, createContext as D, forwardRef as ee, memo as te, useCallback as O, useContext as k, useEffect as A, useMemo as j, useReducer as ne, useRef as M, useState as N } from "react";
import { createPortal as P, unstable_batchedUpdates as re } from "react-dom";
//#region ../../node_modules/@dnd-kit/core/dist/core.esm.js
var ie = /* @__PURE__ */ D(null);
function ae(e) {
	let t = k(ie);
	A(() => {
		if (!t) throw Error("useDndMonitor must be used within a children of <DndContext>");
		return t(e);
	}, [e, t]);
}
function oe() {
	let [e] = N(() => /* @__PURE__ */ new Set()), t = O((t) => (e.add(t), () => e.delete(t)), [e]);
	return [O((t) => {
		let { type: n, event: r } = t;
		e.forEach((e) => e[n]?.call(e, r));
	}, [e]), t];
}
var se = { draggable: "\n    To pick up a draggable item, press the space bar.\n    While dragging, use the arrow keys to move the item.\n    Press space again to drop the item in its new position, or press escape to cancel.\n  " }, F = {
	onDragStart(e) {
		let { active: t } = e;
		return "Picked up draggable item " + t.id + ".";
	},
	onDragOver(e) {
		let { active: t, over: n } = e;
		return n ? "Draggable item " + t.id + " was moved over droppable area " + n.id + "." : "Draggable item " + t.id + " is no longer over a droppable area.";
	},
	onDragEnd(e) {
		let { active: t, over: n } = e;
		return n ? "Draggable item " + t.id + " was dropped over droppable area " + n.id : "Draggable item " + t.id + " was dropped.";
	},
	onDragCancel(e) {
		let { active: t } = e;
		return "Dragging was cancelled. Draggable item " + t.id + " was dropped.";
	}
};
function ce(e) {
	let { announcements: t = F, container: n, hiddenTextDescribedById: r, screenReaderInstructions: i = se } = e, { announce: a, announcement: o } = w(), s = x("DndLiveRegion"), [c, l] = N(!1);
	if (A(() => {
		l(!0);
	}, []), ae(j(() => ({
		onDragStart(e) {
			let { active: n } = e;
			a(t.onDragStart({ active: n }));
		},
		onDragMove(e) {
			let { active: n, over: r } = e;
			t.onDragMove && a(t.onDragMove({
				active: n,
				over: r
			}));
		},
		onDragOver(e) {
			let { active: n, over: r } = e;
			a(t.onDragOver({
				active: n,
				over: r
			}));
		},
		onDragEnd(e) {
			let { active: n, over: r } = e;
			a(t.onDragEnd({
				active: n,
				over: r
			}));
		},
		onDragCancel(e) {
			let { active: n, over: r } = e;
			a(t.onDragCancel({
				active: n,
				over: r
			}));
		}
	}), [a, t])), !c) return null;
	let u = T.createElement(T.Fragment, null, T.createElement(S, {
		id: r,
		value: i.draggable
	}), T.createElement(C, {
		id: s,
		announcement: o
	}));
	return n ? P(u, n) : u;
}
var I;
(function(e) {
	e.DragStart = "dragStart", e.DragMove = "dragMove", e.DragEnd = "dragEnd", e.DragCancel = "dragCancel", e.DragOver = "dragOver", e.RegisterDroppable = "registerDroppable", e.SetDroppableDisabled = "setDroppableDisabled", e.UnregisterDroppable = "unregisterDroppable";
})(I ||= {});
function le() {}
function L(e, t) {
	return j(() => ({
		sensor: e,
		options: t ?? {}
	}), [e, t]);
}
function ue() {
	var e = [...arguments];
	return j(() => [...e].filter((e) => e != null), [...e]);
}
var R = /* @__PURE__ */ Object.freeze({
	x: 0,
	y: 0
});
function z(e, t) {
	return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
}
function B(e, t) {
	let n = i(e);
	if (!n) return "0 0";
	let r = {
		x: (n.x - t.left) / t.width * 100,
		y: (n.y - t.top) / t.height * 100
	};
	return r.x + "% " + r.y + "%";
}
function de(e, t) {
	let { data: { value: n } } = e, { data: { value: r } } = t;
	return n - r;
}
function fe(e, t) {
	let { data: { value: n } } = e, { data: { value: r } } = t;
	return r - n;
}
function V(e) {
	let { left: t, top: n, height: r, width: i } = e;
	return [
		{
			x: t,
			y: n
		},
		{
			x: t + i,
			y: n
		},
		{
			x: t,
			y: n + r
		},
		{
			x: t + i,
			y: n + r
		}
	];
}
function pe(e, t) {
	if (!e || e.length === 0) return null;
	let [n] = e;
	return t ? n[t] : n;
}
function me(e, t, n) {
	return t === void 0 && (t = e.left), n === void 0 && (n = e.top), {
		x: t + e.width * .5,
		y: n + e.height * .5
	};
}
var he = (e) => {
	let { collisionRect: t, droppableRects: n, droppableContainers: r } = e, i = me(t, t.left, t.top), a = [];
	for (let e of r) {
		let { id: t } = e, r = n.get(t);
		if (r) {
			let n = z(me(r), i);
			a.push({
				id: t,
				data: {
					droppableContainer: e,
					value: n
				}
			});
		}
	}
	return a.sort(de);
}, ge = (e) => {
	let { collisionRect: t, droppableRects: n, droppableContainers: r } = e, i = V(t), a = [];
	for (let e of r) {
		let { id: t } = e, r = n.get(t);
		if (r) {
			let n = V(r), o = i.reduce((e, t, r) => e + z(n[r], t), 0), s = Number((o / 4).toFixed(4));
			a.push({
				id: t,
				data: {
					droppableContainer: e,
					value: s
				}
			});
		}
	}
	return a.sort(de);
};
function H(e, t) {
	let n = Math.max(t.top, e.top), r = Math.max(t.left, e.left), i = Math.min(t.left + t.width, e.left + e.width), a = Math.min(t.top + t.height, e.top + e.height), o = i - r, s = a - n;
	if (r < i && n < a) {
		let n = t.width * t.height, r = e.width * e.height, i = o * s, a = i / (n + r - i);
		return Number(a.toFixed(4));
	}
	return 0;
}
var _e = (e) => {
	let { collisionRect: t, droppableRects: n, droppableContainers: r } = e, i = [];
	for (let e of r) {
		let { id: r } = e, a = n.get(r);
		if (a) {
			let n = H(a, t);
			n > 0 && i.push({
				id: r,
				data: {
					droppableContainer: e,
					value: n
				}
			});
		}
	}
	return i.sort(fe);
};
function ve(e, t, n) {
	return {
		...e,
		scaleX: t && n ? t.width / n.width : 1,
		scaleY: t && n ? t.height / n.height : 1
	};
}
function ye(e, t) {
	return e && t ? {
		x: e.left - t.left,
		y: e.top - t.top
	} : R;
}
function U(e) {
	return function(t) {
		return [...arguments].slice(1).reduce((t, n) => ({
			...t,
			top: t.top + e * n.y,
			bottom: t.bottom + e * n.y,
			left: t.left + e * n.x,
			right: t.right + e * n.x
		}), { ...t });
	};
}
var be = /* @__PURE__ */ U(1);
function xe(e) {
	if (e.startsWith("matrix3d(")) {
		let t = e.slice(9, -1).split(/, /);
		return {
			x: +t[12],
			y: +t[13],
			scaleX: +t[0],
			scaleY: +t[5]
		};
	} else if (e.startsWith("matrix(")) {
		let t = e.slice(7, -1).split(/, /);
		return {
			x: +t[4],
			y: +t[5],
			scaleX: +t[0],
			scaleY: +t[3]
		};
	}
	return null;
}
function W(e, t, n) {
	let r = xe(t);
	if (!r) return e;
	let { scaleX: i, scaleY: a, x: o, y: s } = r, c = e.left - o - (1 - i) * parseFloat(n), l = e.top - s - (1 - a) * parseFloat(n.slice(n.indexOf(" ") + 1)), u = i ? e.width / i : e.width, d = a ? e.height / a : e.height;
	return {
		width: u,
		height: d,
		top: l,
		right: c + u,
		bottom: l + d,
		left: c
	};
}
var Se = { ignoreTransform: !1 };
function G(e, t) {
	t === void 0 && (t = Se);
	let n = e.getBoundingClientRect();
	if (t.ignoreTransform) {
		let { transform: t, transformOrigin: r } = o(e).getComputedStyle(e);
		t && (n = W(n, t, r));
	}
	let { top: r, left: i, width: a, height: s, bottom: c, right: l } = n;
	return {
		top: r,
		left: i,
		width: a,
		height: s,
		bottom: c,
		right: l
	};
}
function Ce(e) {
	return G(e, { ignoreTransform: !0 });
}
function we(e) {
	let t = e.innerWidth, n = e.innerHeight;
	return {
		top: 0,
		left: 0,
		right: t,
		bottom: n,
		width: t,
		height: n
	};
}
function Te(e, t) {
	return t === void 0 && (t = o(e).getComputedStyle(e)), t.position === "fixed";
}
function K(e, t) {
	t === void 0 && (t = o(e).getComputedStyle(e));
	let n = /(auto|scroll|overlay)/;
	return [
		"overflow",
		"overflowX",
		"overflowY"
	].some((e) => {
		let r = t[e];
		return typeof r == "string" ? n.test(r) : !1;
	});
}
function q(e, t) {
	let n = [];
	function r(i) {
		if (t != null && n.length >= t || !i) return n;
		if (s(i) && i.scrollingElement != null && !n.includes(i.scrollingElement)) return n.push(i.scrollingElement), n;
		if (!c(i) || d(i) || n.includes(i)) return n;
		let a = o(e).getComputedStyle(i);
		return i !== e && K(i, a) && n.push(i), Te(i, a) ? n : r(i.parentNode);
	}
	return e ? r(e) : n;
}
function Ee(e) {
	let [t] = q(e, 1);
	return t ?? null;
}
function De(e) {
	return !n || !e ? null : f(e) ? e : u(e) ? s(e) || e === a(e).scrollingElement ? window : c(e) ? e : null : null;
}
function Oe(e) {
	return f(e) ? e.scrollX : e.scrollLeft;
}
function ke(e) {
	return f(e) ? e.scrollY : e.scrollTop;
}
function Ae(e) {
	return {
		x: Oe(e),
		y: ke(e)
	};
}
var J;
(function(e) {
	e[e.Forward = 1] = "Forward", e[e.Backward = -1] = "Backward";
})(J ||= {});
function Y(e) {
	return !n || !e ? !1 : e === document.scrollingElement;
}
function je(e) {
	let t = {
		x: 0,
		y: 0
	}, n = Y(e) ? {
		height: window.innerHeight,
		width: window.innerWidth
	} : {
		height: e.clientHeight,
		width: e.clientWidth
	}, r = {
		x: e.scrollWidth - n.width,
		y: e.scrollHeight - n.height
	};
	return {
		isTop: e.scrollTop <= t.y,
		isLeft: e.scrollLeft <= t.x,
		isBottom: e.scrollTop >= r.y,
		isRight: e.scrollLeft >= r.x,
		maxScroll: r,
		minScroll: t
	};
}
var Me = {
	x: .2,
	y: .2
};
function X(e, t, n, r, i) {
	let { top: a, left: o, right: s, bottom: c } = n;
	r === void 0 && (r = 10), i === void 0 && (i = Me);
	let { isTop: l, isBottom: u, isLeft: d, isRight: f } = je(e), p = {
		x: 0,
		y: 0
	}, m = {
		x: 0,
		y: 0
	}, h = {
		height: t.height * i.y,
		width: t.width * i.x
	};
	return !l && a <= t.top + h.height ? (p.y = J.Backward, m.y = r * Math.abs((t.top + h.height - a) / h.height)) : !u && c >= t.bottom - h.height && (p.y = J.Forward, m.y = r * Math.abs((t.bottom - h.height - c) / h.height)), !f && s >= t.right - h.width ? (p.x = J.Forward, m.x = r * Math.abs((t.right - h.width - s) / h.width)) : !d && o <= t.left + h.width && (p.x = J.Backward, m.x = r * Math.abs((t.left + h.width - o) / h.width)), {
		direction: p,
		speed: m
	};
}
function Ne(e) {
	if (e === document.scrollingElement) {
		let { innerWidth: e, innerHeight: t } = window;
		return {
			top: 0,
			left: 0,
			right: e,
			bottom: t,
			width: e,
			height: t
		};
	}
	let { top: t, left: n, right: r, bottom: i } = e.getBoundingClientRect();
	return {
		top: t,
		left: n,
		right: r,
		bottom: i,
		width: e.clientWidth,
		height: e.clientHeight
	};
}
function Pe(e) {
	return e.reduce((e, n) => t(e, Ae(n)), R);
}
function Fe(e) {
	return e.reduce((e, t) => e + Oe(t), 0);
}
function Ie(e) {
	return e.reduce((e, t) => e + ke(t), 0);
}
function Le(e, t) {
	if (t === void 0 && (t = G), !e) return;
	let { top: n, left: r, bottom: i, right: a } = t(e);
	Ee(e) && (i <= 0 || a <= 0 || n >= window.innerHeight || r >= window.innerWidth) && e.scrollIntoView({
		block: "center",
		inline: "center"
	});
}
var Re = [[
	"x",
	["left", "right"],
	Fe
], [
	"y",
	["top", "bottom"],
	Ie
]], ze = class {
	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;
		let n = q(t), r = Pe(n);
		this.rect = { ...e }, this.width = e.width, this.height = e.height;
		for (let [e, t, i] of Re) for (let a of t) Object.defineProperty(this, a, {
			get: () => {
				let t = i(n), o = r[e] - t;
				return this.rect[a] + o;
			},
			enumerable: !0
		});
		Object.defineProperty(this, "rect", { enumerable: !1 });
	}
}, Be = class {
	constructor(e) {
		this.target = void 0, this.listeners = [], this.removeAll = () => {
			this.listeners.forEach((e) => this.target?.removeEventListener(...e));
		}, this.target = e;
	}
	add(e, t, n) {
		var r;
		(r = this.target) == null || r.addEventListener(e, t, n), this.listeners.push([
			e,
			t,
			n
		]);
	}
};
function Ve(e) {
	let { EventTarget: t } = o(e);
	return e instanceof t ? e : a(e);
}
function He(e, t) {
	let n = Math.abs(e.x), r = Math.abs(e.y);
	return typeof t == "number" ? Math.sqrt(n ** 2 + r ** 2) > t : "x" in t && "y" in t ? n > t.x && r > t.y : "x" in t ? n > t.x : "y" in t ? r > t.y : !1;
}
var Z;
(function(e) {
	e.Click = "click", e.DragStart = "dragstart", e.Keydown = "keydown", e.ContextMenu = "contextmenu", e.Resize = "resize", e.SelectionChange = "selectionchange", e.VisibilityChange = "visibilitychange";
})(Z ||= {});
function Ue(e) {
	e.preventDefault();
}
function We(e) {
	e.stopPropagation();
}
var Q;
(function(e) {
	e.Space = "Space", e.Down = "ArrowDown", e.Right = "ArrowRight", e.Left = "ArrowLeft", e.Up = "ArrowUp", e.Esc = "Escape", e.Enter = "Enter", e.Tab = "Tab";
})(Q ||= {});
var Ge = {
	start: [Q.Space, Q.Enter],
	cancel: [Q.Esc],
	end: [
		Q.Space,
		Q.Enter,
		Q.Tab
	]
}, Ke = (e, t) => {
	let { currentCoordinates: n } = t;
	switch (e.code) {
		case Q.Right: return {
			...n,
			x: n.x + 25
		};
		case Q.Left: return {
			...n,
			x: n.x - 25
		};
		case Q.Down: return {
			...n,
			y: n.y + 25
		};
		case Q.Up: return {
			...n,
			y: n.y - 25
		};
	}
}, qe = class {
	constructor(e) {
		this.props = void 0, this.autoScrollEnabled = !1, this.referenceCoordinates = void 0, this.listeners = void 0, this.windowListeners = void 0, this.props = e;
		let { event: { target: t } } = e;
		this.props = e, this.listeners = new Be(a(t)), this.windowListeners = new Be(o(t)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach();
	}
	attach() {
		this.handleStart(), this.windowListeners.add(Z.Resize, this.handleCancel), this.windowListeners.add(Z.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(Z.Keydown, this.handleKeyDown));
	}
	handleStart() {
		let { activeNode: e, onStart: t } = this.props, n = e.node.current;
		n && Le(n), t(R);
	}
	handleKeyDown(e) {
		if (l(e)) {
			let { active: n, context: r, options: i } = this.props, { keyboardCodes: a = Ge, coordinateGetter: o = Ke, scrollBehavior: s = "smooth" } = i, { code: c } = e;
			if (a.end.includes(c)) {
				this.handleEnd(e);
				return;
			}
			if (a.cancel.includes(c)) {
				this.handleCancel(e);
				return;
			}
			let { collisionRect: l } = r.current, u = l ? {
				x: l.left,
				y: l.top
			} : R;
			this.referenceCoordinates ||= u;
			let d = o(e, {
				active: n,
				context: r.current,
				currentCoordinates: u
			});
			if (d) {
				let n = p(d, u), i = {
					x: 0,
					y: 0
				}, { scrollableAncestors: a } = r.current;
				for (let t of a) {
					let r = e.code, { isTop: a, isRight: o, isLeft: c, isBottom: l, maxScroll: u, minScroll: f } = je(t), p = Ne(t), m = {
						x: Math.min(r === Q.Right ? p.right - p.width / 2 : p.right, Math.max(r === Q.Right ? p.left : p.left + p.width / 2, d.x)),
						y: Math.min(r === Q.Down ? p.bottom - p.height / 2 : p.bottom, Math.max(r === Q.Down ? p.top : p.top + p.height / 2, d.y))
					}, h = r === Q.Right && !o || r === Q.Left && !c, g = r === Q.Down && !l || r === Q.Up && !a;
					if (h && m.x !== d.x) {
						let e = t.scrollLeft + n.x, a = r === Q.Right && e <= u.x || r === Q.Left && e >= f.x;
						if (a && !n.y) {
							t.scrollTo({
								left: e,
								behavior: s
							});
							return;
						}
						a ? i.x = t.scrollLeft - e : i.x = r === Q.Right ? t.scrollLeft - u.x : t.scrollLeft - f.x, i.x && t.scrollBy({
							left: -i.x,
							behavior: s
						});
						break;
					} else if (g && m.y !== d.y) {
						let e = t.scrollTop + n.y, a = r === Q.Down && e <= u.y || r === Q.Up && e >= f.y;
						if (a && !n.x) {
							t.scrollTo({
								top: e,
								behavior: s
							});
							return;
						}
						a ? i.y = t.scrollTop - e : i.y = r === Q.Down ? t.scrollTop - u.y : t.scrollTop - f.y, i.y && t.scrollBy({
							top: -i.y,
							behavior: s
						});
						break;
					}
				}
				this.handleMove(e, t(p(d, this.referenceCoordinates), i));
			}
		}
	}
	handleMove(e, t) {
		let { onMove: n } = this.props;
		e.preventDefault(), n(t);
	}
	handleEnd(e) {
		let { onEnd: t } = this.props;
		e.preventDefault(), this.detach(), t();
	}
	handleCancel(e) {
		let { onCancel: t } = this.props;
		e.preventDefault(), this.detach(), t();
	}
	detach() {
		this.listeners.removeAll(), this.windowListeners.removeAll();
	}
};
qe.activators = [{
	eventName: "onKeyDown",
	handler: (e, t, n) => {
		let { keyboardCodes: r = Ge, onActivation: i } = t, { active: a } = n, { code: o } = e.nativeEvent;
		if (r.start.includes(o)) {
			let t = a.activatorNode.current;
			return t && e.target !== t ? !1 : (e.preventDefault(), i?.({ event: e.nativeEvent }), !0);
		}
		return !1;
	}
}];
function Je(e) {
	return !!(e && "distance" in e);
}
function Ye(e) {
	return !!(e && "delay" in e);
}
var Xe = class {
	constructor(e, t, n) {
		n === void 0 && (n = Ve(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;
		let { event: r } = e, { target: s } = r;
		this.props = e, this.events = t, this.document = a(s), this.documentListeners = new Be(this.document), this.listeners = new Be(n), this.windowListeners = new Be(o(s)), this.initialCoordinates = i(r) ?? R, 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() {
		let { events: e, props: { options: { activationConstraint: t, bypassActivationConstraint: n } } } = 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(Z.Resize, this.handleCancel), this.windowListeners.add(Z.DragStart, Ue), this.windowListeners.add(Z.VisibilityChange, this.handleCancel), this.windowListeners.add(Z.ContextMenu, Ue), this.documentListeners.add(Z.Keydown, this.handleKeydown), t) {
			if (n != null && n({
				event: this.props.event,
				activeNode: this.props.activeNode,
				options: this.props.options
			})) return this.handleStart();
			if (Ye(t)) {
				this.timeoutId = setTimeout(this.handleStart, t.delay), this.handlePending(t);
				return;
			}
			if (Je(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) {
		let { active: n, onPending: r } = this.props;
		r(n, e, this.initialCoordinates, t);
	}
	handleStart() {
		let { initialCoordinates: e } = this, { onStart: t } = this.props;
		e && (this.activated = !0, this.documentListeners.add(Z.Click, We, { capture: !0 }), this.removeTextSelection(), this.documentListeners.add(Z.SelectionChange, this.removeTextSelection), t(e));
	}
	handleMove(e) {
		let { activated: t, initialCoordinates: n, props: r } = this, { onMove: a, options: { activationConstraint: o } } = r;
		if (!n) return;
		let s = i(e) ?? R, c = p(n, s);
		if (!t && o) {
			if (Je(o)) {
				if (o.tolerance != null && He(c, o.tolerance)) return this.handleCancel();
				if (He(c, o.distance)) return this.handleStart();
			}
			if (Ye(o) && He(c, o.tolerance)) return this.handleCancel();
			this.handlePending(o, c);
			return;
		}
		e.cancelable && e.preventDefault(), a(s);
	}
	handleEnd() {
		let { onAbort: e, onEnd: t } = this.props;
		this.detach(), this.activated || e(this.props.active), t();
	}
	handleCancel() {
		let { onAbort: e, onCancel: t } = this.props;
		this.detach(), this.activated || e(this.props.active), t();
	}
	handleKeydown(e) {
		e.code === Q.Esc && this.handleCancel();
	}
	removeTextSelection() {
		var e;
		(e = this.document.getSelection()) == null || e.removeAllRanges();
	}
}, Ze = {
	cancel: { name: "pointercancel" },
	move: { name: "pointermove" },
	end: { name: "pointerup" }
}, Qe = class extends Xe {
	constructor(e) {
		let { event: t } = e, n = a(t.target);
		super(e, Ze, n);
	}
};
Qe.activators = [{
	eventName: "onPointerDown",
	handler: (e, t) => {
		let { nativeEvent: n } = e, { onActivation: r } = t;
		return !n.isPrimary || n.button !== 0 ? !1 : (r?.({ event: n }), !0);
	}
}];
var $e = {
	move: { name: "mousemove" },
	end: { name: "mouseup" }
}, et;
(function(e) {
	e[e.RightClick = 2] = "RightClick";
})(et ||= {});
var tt = class extends Xe {
	constructor(e) {
		super(e, $e, a(e.event.target));
	}
};
tt.activators = [{
	eventName: "onMouseDown",
	handler: (e, t) => {
		let { nativeEvent: n } = e, { onActivation: r } = t;
		return n.button === et.RightClick ? !1 : (r?.({ event: n }), !0);
	}
}];
var nt = {
	cancel: { name: "touchcancel" },
	move: { name: "touchmove" },
	end: { name: "touchend" }
}, rt = class extends Xe {
	constructor(e) {
		super(e, nt);
	}
	static setup() {
		return window.addEventListener(nt.move.name, e, {
			capture: !1,
			passive: !1
		}), function() {
			window.removeEventListener(nt.move.name, e);
		};
		function e() {}
	}
};
rt.activators = [{
	eventName: "onTouchStart",
	handler: (e, t) => {
		let { nativeEvent: n } = e, { onActivation: r } = t, { touches: i } = n;
		return i.length > 1 ? !1 : (r?.({ event: n }), !0);
	}
}];
var it;
(function(e) {
	e[e.Pointer = 0] = "Pointer", e[e.DraggableRect = 1] = "DraggableRect";
})(it ||= {});
var at;
(function(e) {
	e[e.TreeOrder = 0] = "TreeOrder", e[e.ReversedTreeOrder = 1] = "ReversedTreeOrder";
})(at ||= {});
function ot(e) {
	let { acceleration: t, activator: n = it.Pointer, canScroll: r, draggingRect: i, enabled: a, interval: o = 5, order: s = at.TreeOrder, pointerCoordinates: c, scrollableAncestors: l, scrollableAncestorRects: u, delta: d, threshold: f } = e, p = ct({
		delta: d,
		disabled: !a
	}), [m, g] = h(), _ = M({
		x: 0,
		y: 0
	}), v = M({
		x: 0,
		y: 0
	}), y = j(() => {
		switch (n) {
			case it.Pointer: return c ? {
				top: c.y,
				bottom: c.y,
				left: c.x,
				right: c.x
			} : null;
			case it.DraggableRect: return i;
		}
	}, [
		n,
		i,
		c
	]), b = M(null), x = O(() => {
		let e = b.current;
		if (!e) return;
		let t = _.current.x * v.current.x, n = _.current.y * v.current.y;
		e.scrollBy(t, n);
	}, []), S = j(() => s === at.TreeOrder ? [...l].reverse() : l, [s, l]);
	A(() => {
		if (!a || !l.length || !y) {
			g();
			return;
		}
		for (let e of S) {
			if (r?.(e) === !1) continue;
			let n = u[l.indexOf(e)];
			if (!n) continue;
			let { direction: i, speed: a } = X(e, n, y, t, f);
			for (let e of ["x", "y"]) p[e][i[e]] || (a[e] = 0, i[e] = 0);
			if (a.x > 0 || a.y > 0) {
				g(), b.current = e, m(x, o), _.current = a, v.current = i;
				return;
			}
		}
		_.current = {
			x: 0,
			y: 0
		}, v.current = {
			x: 0,
			y: 0
		}, g();
	}, [
		t,
		x,
		r,
		g,
		a,
		o,
		JSON.stringify(y),
		JSON.stringify(p),
		m,
		l,
		S,
		u,
		JSON.stringify(f)
	]);
}
var st = {
	x: {
		[J.Backward]: !1,
		[J.Forward]: !1
	},
	y: {
		[J.Backward]: !1,
		[J.Forward]: !1
	}
};
function ct(e) {
	let { delta: t, disabled: n } = e, r = b(t);
	return v((e) => {
		if (n || !r || !e) return st;
		let i = {
			x: Math.sign(t.x - r.x),
			y: Math.sign(t.y - r.y)
		};
		return {
			x: {
				[J.Backward]: e.x[J.Backward] || i.x === -1,
				[J.Forward]: e.x[J.Forward] || i.x === 1
			},
			y: {
				[J.Backward]: e.y[J.Backward] || i.y === -1,
				[J.Forward]: e.y[J.Forward] || i.y === 1
			}
		};
	}, [
		n,
		t,
		r
	]);
}
function lt(e, t) {
	let n = t == null ? void 0 : e.get(t), r = n ? n.node.current : null;
	return v((e) => t == null ? null : r ?? e ?? null, [r, t]);
}
function ut(e, t) {
	return j(() => e.reduce((e, n) => {
		let { sensor: r } = n, i = r.activators.map((e) => ({
			eventName: e.eventName,
			handler: t(e.handler, n)
		}));
		return [...e, ...i];
	}, []), [e, t]);
}
var dt;
(function(e) {
	e[e.Always = 0] = "Always", e[e.BeforeDragging = 1] = "BeforeDragging", e[e.WhileDragging = 2] = "WhileDragging";
})(dt ||= {});
var ft;
(function(e) {
	e.Optimized = "optimized";
})(ft ||= {});
var pt = /* @__PURE__ */ new Map();
function mt(e, t) {
	let { dragging: n, dependencies: r, config: i } = t, [a, o] = N(null), { frequency: s, measure: c, strategy: l } = i, u = M(e), d = g(), f = _(d), p = O(function(e) {
		e === void 0 && (e = []), !f.current && o((t) => t === null ? e : t.concat(e.filter((e) => !t.includes(e))));
	}, [f]), m = M(null), h = v((t) => {
		if (d && !n) return pt;
		if (!t || t === pt || u.current !== e || a != null) {
			let t = /* @__PURE__ */ new Map();
			for (let n of e) {
				if (!n) continue;
				if (a && a.length > 0 && !a.includes(n.id) && n.rect.current) {
					t.set(n.id, n.rect.current);
					continue;
				}
				let e = n.node.current, r = e ? new ze(c(e), e) : null;
				n.rect.current = r, r && t.set(n.id, r);
			}
			return t;
		}
		return t;
	}, [
		e,
		a,
		n,
		d,
		c
	]);
	return A(() => {
		u.current = e;
	}, [e]), A(() => {
		d || p();
	}, [n, d]), A(() => {
		a && a.length > 0 && o(null);
	}, [JSON.stringify(a)]), A(() => {
		d || typeof s != "number" || m.current !== null || (m.current = setTimeout(() => {
			p(), m.current = null;
		}, s));
	}, [
		s,
		d,
		p,
		...r
	]), {
		droppableRects: h,
		measureDroppableContainers: p,
		measuringScheduled: a != null
	};
	function g() {
		switch (l) {
			case dt.Always: return !1;
			case dt.BeforeDragging: return n;
			default: return !n;
		}
	}
}
function ht(e, t) {
	return v((n) => e ? n || (typeof t == "function" ? t(e) : e) : null, [t, e]);
}
function gt(e, t) {
	return ht(e, t);
}
function _t(e) {
	let { callback: t, disabled: n } = e, r = m(t), i = j(() => {
		if (n || typeof window > "u" || window.MutationObserver === void 0) return;
		let { MutationObserver: e } = window;
		return new e(r);
	}, [r, n]);
	return A(() => () => i?.disconnect(), [i]), i;
}
function vt(e) {
	let { callback: t, disabled: n } = e, r = m(t), i = j(() => {
		if (n || typeof window > "u" || window.ResizeObserver === void 0) return;
		let { ResizeObserver: e } = window;
		return new e(r);
	}, [n]);
	return A(() => () => i?.disconnect(), [i]), i;
}
function yt(e) {
	return new ze(G(e), e);
}
function bt(e, t, n) {
	t === void 0 && (t = yt);
	let [r, i] = N(null);
	function a() {
		i((r) => {
			if (!e) return null;
			if (e.isConnected === !1) return r ?? n ?? null;
			let i = t(e);
			return JSON.stringify(r) === JSON.stringify(i) ? r : i;
		});
	}
	let o = _t({ callback(t) {
		if (e) for (let n of t) {
			let { type: t, target: r } = n;
			if (t === "childList" && r instanceof HTMLElement && r.contains(e)) {
				a();
				break;
			}
		}
	} }), s = vt({ callback: a });
	return g(() => {
		a(), e ? (s?.observe(e), o?.observe(document.body, {
			childList: !0,
			subtree: !0
		})) : (s?.disconnect(), o?.disconnect());
	}, [e]), r;
}
function xt(e) {
	return ye(e, ht(e));
}
var St = [];
function Ct(e) {
	let t = M(e), n = v((n) => e ? n && n !== St && e && t.current && e.parentNode === t.current.parentNode ? n : q(e) : St, [e]);
	return A(() => {
		t.current = e;
	}, [e]), n;
}
function wt(e) {
	let [n, r] = N(null), i = M(e), a = O((e) => {
		let t = De(e.target);
		t && r((e) => e ? (e.set(t, Ae(t)), new Map(e)) : null);
	}, []);
	return A(() => {
		let t = i.current;
		if (e !== t) {
			n(t);
			let o = e.map((e) => {
				let t = De(e);
				return t ? (t.addEventListener("scroll", a, { passive: !0 }), [t, Ae(t)]) : null;
			}).filter((e) => e != null);
			r(o.length ? new Map(o) : null), i.current = e;
		}
		return () => {
			n(e), n(t);
		};
		function n(e) {
			e.forEach((e) => {
				De(e)?.removeEventListener("scroll", a);
			});
		}
	}, [a, e]), j(() => e.length ? n ? Array.from(n.values()).reduce((e, n) => t(e, n), R) : Pe(e) : R, [e, n]);
}
function Tt(e, t) {
	t === void 0 && (t = []);
	let n = M(null);
	return A(() => {
		n.current = null;
	}, t), A(() => {
		let t = e !== R;
		t && !n.current && (n.current = e), !t && n.current && (n.current = null);
	}, [e]), n.current ? p(e, n.current) : R;
}
function Et(e) {
	A(() => {
		if (!n) return;
		let t = e.map((e) => {
			let { sensor: t } = e;
			return t.setup == null ? void 0 : t.setup();
		});
		return () => {
			for (let e of t) e?.();
		};
	}, e.map((e) => {
		let { sensor: t } = e;
		return t;
	}));
}
function Dt(e, t) {
	return j(() => e.reduce((e, n) => {
		let { eventName: r, handler: i } = n;
		return e[r] = (e) => {
			i(e, t);
		}, e;
	}, {}), [e, t]);
}
function Ot(e) {
	return j(() => e ? we(e) : null, [e]);
}
var kt = [];
function At(e, t) {
	t === void 0 && (t = G);
	let [n] = e, r = Ot(n ? o(n) : null), [i, a] = N(kt);
	function s() {
		a(() => e.length ? e.map((e) => Y(e) ? r : new ze(t(e), e)) : kt);
	}
	let c = vt({ callback: s });
	return g(() => {
		c?.disconnect(), s(), e.forEach((e) => c?.observe(e));
	}, [e]), i;
}
function jt(e) {
	if (!e) return null;
	if (e.children.length > 1) return e;
	let t = e.children[0];
	return c(t) ? t : e;
}
function Mt(e) {
	let { measure: t } = e, [n, r] = N(null), i = vt({ callback: O((e) => {
		for (let { target: n } of e) if (c(n)) {
			r((e) => {
				let r = t(n);
				return e ? {
					...e,
					width: r.width,
					height: r.height
				} : r;
			});
			break;
		}
	}, [t]) }), [a, o] = y(O((e) => {
		let n = jt(e);
		i?.disconnect(), n && i?.observe(n), r(n ? t(n) : null);
	}, [t, i]));
	return j(() => ({
		nodeRef: a,
		rect: n,
		setRef: o
	}), [
		n,
		a,
		o
	]);
}
var Nt = [{
	sensor: Qe,
	options: {}
}, {
	sensor: qe,
	options: {}
}], Pt = { current: {} }, Ft = {
	draggable: { measure: Ce },
	droppable: {
		measure: Ce,
		strategy: dt.WhileDragging,
		frequency: ft.Optimized
	},
	dragOverlay: { measure: G }
}, It = class extends Map {
	get(e) {
		return e == null ? void 0 : super.get(e) ?? void 0;
	}
	toArray() {
		return Array.from(this.values());
	}
	getEnabled() {
		return this.toArray().filter((e) => {
			let { disabled: t } = e;
			return !t;
		});
	}
	getNodeFor(e) {
		return this.get(e)?.node.current ?? void 0;
	}
}, Lt = {
	activatorEvent: null,
	active: null,
	activeNode: null,
	activeNodeRect: null,
	collisions: null,
	containerNodeRect: null,
	draggableNodes: /* @__PURE__ */ new Map(),
	droppableRects: /* @__PURE__ */ new Map(),
	droppableContainers: /* @__PURE__ */ new It(),
	over: null,
	dragOverlay: {
		nodeRef: { current: null },
		rect: null,
		setRef: le
	},
	scrollableAncestors: [],
	scrollableAncestorRects: [],
	measuringConfiguration: Ft,
	measureDroppableContainers: le,
	windowRect: null,
	measuringScheduled: !1
}, Rt = {
	activatorEvent: null,
	activators: [],
	active: null,
	activeNodeRect: null,
	ariaDescribedById: { draggable: "" },
	dispatch: le,
	draggableNodes: /* @__PURE__ */ new Map(),
	over: null,
	measureDroppableContainers: le
}, zt = /* @__PURE__ */ D(Rt), Bt = /* @__PURE__ */ D(Lt);
function Vt() {
	return {
		draggable: {
			active: null,
			initialCoordinates: {
				x: 0,
				y: 0
			},
			nodes: /* @__PURE__ */ new Map(),
			translate: {
				x: 0,
				y: 0
			}
		},
		droppable: { containers: new It() }
	};
}
function Ht(e, t) {
	switch (t.type) {
		case I.DragStart: return {
			...e,
			draggable: {
				...e.draggable,
				initialCoordinates: t.initialCoordinates,
				active: t.active
			}
		};
		case I.DragMove: return e.draggable.active == null ? e : {
			...e,
			draggable: {
				...e.draggable,
				translate: {
					x: t.coordinates.x - e.draggable.initialCoordinates.x,
					y: t.coordinates.y - e.draggable.initialCoordinates.y
				}
			}
		};
		case I.DragEnd:
		case I.DragCancel: return {
			...e,
			draggable: {
				...e.draggable,
				active: null,
				initialCoordinates: {
					x: 0,
					y: 0
				},
				translate: {
					x: 0,
					y: 0
				}
			}
		};
		case I.RegisterDroppable: {
			let { element: n } = t, { id: r } = n, i = new It(e.droppable.containers);
			return i.set(r, n), {
				...e,
				droppable: {
					...e.droppable,
					containers: i
				}
			};
		}
		case I.SetDroppableDisabled: {
			let { id: n, key: r, disabled: i } = t, a = e.droppable.containers.get(n);
			if (!a || r !== a.key) return e;
			let o = new It(e.droppable.containers);
			return o.set(n, {
				...a,
				disabled: i
			}), {
				...e,
				droppable: {
					...e.droppable,
					containers: o
				}
			};
		}
		case I.UnregisterDroppable: {
			let { id: n, key: r } = t, i = e.droppable.containers.get(n);
			if (!i || r !== i.key) return e;
			let a = new It(e.droppable.containers);
			return a.delete(n), {
				...e,
				droppable: {
					...e.droppable,
					containers: a
				}
			};
		}
		default: return e;
	}
}
function Ut(e) {
	let { disabled: t } = e, { active: n, activatorEvent: i, draggableNodes: a } = k(zt), o = b(i), s = b(n?.id);
	return A(() => {
		if (!t && !i && o && s != null) {
			if (!l(o) || document.activeElement === o.target) return;
			let e = a.get(s);
			if (!e) return;
			let { activatorNode: t, node: n } = e;
			if (!t.current && !n.current) return;
			requestAnimationFrame(() => {
				for (let e of [t.current, n.current]) {
					if (!e) continue;
					let t = r(e);
					if (t) {
						t.focus();
						break;
					}
				}
			});
		}
	}, [
		i,
		t,
		a,
		s,
		o
	]), null;
}
function Wt(e, t) {
	let { transform: n, ...r } = t;
	return e != null && e.length ? e.reduce((e, t) => t({
		transform: e,
		...r
	}), n) : n;
}
function Gt(e) {
	return j(() => ({
		draggable: {
			...Ft.draggable,
			...e?.draggable
		},
		droppable: {
			...Ft.droppable,
			...e?.droppable
		},
		dragOverlay: {
			...Ft.dragOverlay,
			...e?.dragOverlay
		}
	}), [
		e?.draggable,
		e?.droppable,
		e?.dragOverlay
	]);
}
function Kt(e) {
	let { activeNode: t, measure: n, initialRect: r, config: i = !0 } = e, a = M(!1), { x: o, y: s } = typeof i == "boolean" ? {
		x: i,
		y: i
	} : i;
	g(() => {
		if (!o && !s || !t) {
			a.current = !1;
			return;
		}
		if (a.current || !r) return;
		let e = t?.node.current;
		if (!e || e.isConnected === !1) return;
		let i = ye(n(e), r);
		if (o || (i.x = 0), s || (i.y = 0), a.current = !0, Math.abs(i.x) > 0 || Math.abs(i.y) > 0) {
			let t = Ee(e);
			t && t.scrollBy({
				top: i.y,
				left: i.x
			});
		}
	}, [
		t,
		o,
		s,
		r,
		n
	]);
}
var qt = /* @__PURE__ */ D({
	...R,
	scaleX: 1,
	scaleY: 1
}), $;
(function(e) {
	e[e.Uninitialized = 0] = "Uninitialized", e[e.Initializing = 1] = "Initializing", e[e.Initialized = 2] = "Initialized";
})($ ||= {});
var Jt = /* @__PURE__ */ te(function(e) {
	let { id: n, accessibility: r, autoScroll: a = !0, children: s, sensors: c = Nt, collisionDetection: l = _e, measuring: u, modifiers: d, ...f } = e, [p, m] = ne(Ht, void 0, Vt), [h, v] = oe(), [y, b] = N($.Uninitialized), S = y === $.Initialized, { draggable: { active: C, nodes: w, translate: E }, droppable: { containers: D } } = p, ee = C == null ? null : w.get(C), te = M({
		initial: null,
		translated: null
	}), k = j(() => C == null ? null : {
		id: C,
		data: ee?.data ?? Pt,
		rect: te
	}, [C, ee]), P = M(null), [ae, se] = N(null), [F, le] = N(null), L = _(f, Object.values(f)), ue = x("DndDescribedBy", n), R = j(() => D.getEnabled(), [D]), z = Gt(u), { droppableRects: B, measureDroppableContainers: de, measuringScheduled: fe } = mt(R, {
		dragging: S,
		dependencies: [E.x, E.y],
		config: z.droppable
	}), V = lt(w, C), me = j(() => F ? i(F) : null, [F]), he = Be(), ge = gt(V, z.draggable.measure);
	Kt({
		activeNode: C == null ? null : w.get(C),
		config: he.layoutShiftCompensation,
		initialRect: ge,
		measure: z.draggable.measure
	});
	let H = bt(V, z.draggable.measure, ge), ye = bt(V ? V.parentElement : null), U = M({
		activatorEvent: null,
		active: null,
		activeNode: V,
		collisionRect: null,
		collisions: null,
		droppableRects: B,
		draggableNodes: w,
		draggingNode: null,
		draggingNodeRect: null,
		droppableContainers: D,
		over: null,
		scrollableAncestors: [],
		scrollAdjustedTranslate: null
	}), xe = D.getNodeFor(U.current.over?.id), W = Mt({ measure: z.dragOverlay.measure }), Se = W.nodeRef.current ?? V, G = S ? W.rect ?? H : null, Ce = !!(W.nodeRef.current && W.rect), we = xt(Ce ? null : H), Te = Ot(Se ? o(Se) : null), K = Ct(S ? xe ?? V : null), q = At(K), Ee = Wt(d, {
		transform: {
			x: E.x - we.x,
			y: E.y - we.y,
			scaleX: 1,
			scaleY: 1
		},
		activatorEvent: F,
		active: k,
		activeNodeRect: H,
		containerNodeRect: ye,
		draggingNodeRect: G,
		over: U.current.over,
		overlayNodeRect: W.rect,
		scrollableAncestors: K,
		scrollableAncestorRects: q,
		windowRect: Te
	}), De = me ? t(me, E) : null, Oe = wt(K), ke = Tt(Oe), Ae = Tt(Oe, [H]), J = t(Ee, ke), Y = G ? be(G, Ee) : null, je = k && Y ? l({
		active: k,
		collisionRect: Y,
		droppableRects: B,
		droppableContainers: R,
		pointerCoordinates: De
	}) : null, Me = pe(je, "id"), [X, Ne] = N(null), Pe = ve(Ce ? Ee : t(Ee, Ae), X?.rect ?? null, H), Fe = M(null), Ie = O((e, t) => {
		let { sensor: n, options: r } = t;
		if (P.current == null) return;
		let i = w.get(P.current);
		if (!i) return;
		let a = e.nativeEvent;
		Fe.current = new n({
			active: P.current,
			activeNode: i,
			event: a,
			options: r,
			context: U,
			onAbort(e) {
				if (!w.get(e)) return;
				let { onDragAbort: t } = L.current, n = { id: e };
				t?.(n), h({
					type: "onDragAbort",
					event: n
				});
			},
			onPending(e, t, n, r) {
				if (!w.get(e)) return;
				let { onDragPending: i } = L.current, a = {
					id: e,
					constraint: t,
					initialCoordinates: n,
					offset: r
				};
				i?.(a), h({
					type: "onDragPending",
					event: a
				});
			},
			onStart(e) {
				let t = P.current;
				if (t == null) return;
				let n = w.get(t);
				if (!n) return;
				let { onDragStart: r } = L.current, i = {
					activatorEvent: a,
					active: {
						id: t,
						data: n.data,
						rect: te
					}
				};
				re(() => {
					r?.(i), b($.Initializing), m({
						type: I.DragStart,
						initialCoordinates: e,
						active: t
					}), h({
						type: "onDragStart",
						event: i
					}), se(Fe.current), le(a);
				});
			},
			onMove(e) {
				m({
					type: I.DragMove,
					coordinates: e
				});
			},
			onEnd: o(I.DragEnd),
			onCancel: o(I.DragCancel)
		});
		function o(e) {
			return async function() {
				let { active: t, collisions: n, over: r, scrollAdjustedTranslate: i } = U.current, o = null;
				if (t && i) {
					let { cancelDrop: s } = L.current;
					o = {
						activatorEvent: a,
						active: t,
						collisions: n,
						delta: i,
						over: r
					}, e === I.DragEnd && typeof s == "function" && await Promise.resolve(s(o)) && (e = I.DragCancel);
				}
				P.current = null, re(() => {
					m({ type: e }), b($.Uninitialized), Ne(null), se(null), le(null), Fe.current = null;
					let t = e === I.DragEnd ? "onDragEnd" : "onDragCancel";
					if (o) {
						let e = L.current[t];
						e?.(o), h({
							type: t,
							event: o
						});
					}
				});
			};
		}
	}, [w]), Le = ut(c, O((e, t) => (n, r) => {
		let i = n.nativeEvent, a = w.get(r);
		if (P.current !== null || !a || i.dndKit || i.defaultPrevented) return;
		let o = { active: a };
		e(n, t.options, o) === !0 && (i.dndKit = { capturedBy: t.sensor }, P.current = r, Ie(n, t));
	}, [w, Ie]));
	Et(c), g(() => {
		H && y === $.Initializing && b($.Initialized);
	}, [H, y]), A(() => {
		let { onDragMove: e } = L.current, { active: t, activatorEvent: n, collisions: r, over: i } = U.current;
		if (!t || !n) return;
		let a = {
			active: t,
			activatorEvent: n,
			collisions: r,
			delta: {
				x: J.x,
				y: J.y
			},
			over: i
		};
		re(() => {
			e?.(a), h({
				type: "onDragMove",
				event: a
			});
		});
	}, [J.x, J.y]), A(() => {
		let { active: e, activatorEvent: t, collisions: n, droppableContainers: r, scrollAdjustedTranslate: i } = U.current;
		if (!e || P.current == null || !t || !i) return;
		let { onDragOver: a } = L.current, o = r.get(Me), s = o && o.rect.current ? {
			id: o.id,
			rect: o.rect.current,
			data: o.data,
			disabled: o.disabled
		} : null, c = {
			active: e,
			activatorEvent: t,
			collisions: n,
			delta: {
				x: i.x,
				y: i.y
			},
			over: s
		};
		re(() => {
			Ne(s), a?.(c), h({
				type: "onDragOver",
				event: c
			});
		});
	}, [Me]), g(() => {
		U.current = {
			activatorEvent: F,
			active: k,
			activeNode: V,
			collisionRect: Y,
			collisions: je,
			droppableRects: B,
			draggableNodes: w,
			draggingNode: Se,
			draggingNodeRect: G,
			droppableContainers: D,
			over: X,
			scrollableAncestors: K,
			scrollAdjustedTranslate: J
		}, te.current = {
			initial: G,
			translated: Y
		};
	}, [
		k,
		V,
		je,
		Y,
		w,
		Se,
		G,
		B,
		D,
		X,
		K,
		J
	]), ot({
		...he,
		delta: E,
		draggingRect: Y,
		pointerCoordinates: De,
		scrollableAncestors: K,
		scrollableAncestorRects: q
	});
	let Re = j(() => ({
		active: k,
		activeNode: V,
		activeNodeRect: H,
		activatorEvent: F,
		collisions: je,
		containerNodeRect: ye,
		dragOverlay: W,
		draggableNodes: w,
		droppableContainers: D,
		droppableRects: B,
		over: X,
		measureDroppableContainers: de,
		scrollableAncestors: K,
		scrollableAncestorRects: q,
		measuringConfiguration: z,
		measuringScheduled: fe,
		windowRect: Te
	}), [
		k,
		V,
		H,
		F,
		je,
		ye,
		W,
		w,
		D,
		B,
		X,
		de,
		K,
		q,
		z,
		fe,
		Te
	]), ze = j(() => ({
		activatorEvent: F,
		activators: Le,
		active: k,
		activeNodeRect: H,
		ariaDescribedById: { draggable: ue },
		dispatch: m,
		draggableNodes: w,
		over: X,
		measureDroppableContainers: de
	}), [
		F,
		Le,
		k,
		H,
		m,
		ue,
		w,
		X,
		de
	]);
	return T.createElement(ie.Provider, { value: v }, T.createElement(zt.Provider, { value: ze }, T.createElement(Bt.Provider, { value: Re }, T.createElement(qt.Provider, { value: Pe }, s)), T.createElement(Ut, { disabled: r?.restoreFocus === !1 })), T.createElement(ce, {
		...r,
		hiddenTextDescribedById: ue
	}));
	function Be() {
		let e = ae?.autoScrollEnabled === !1, t = typeof a == "object" ? a.enabled === !1 : a === !1, n = S && !e && !t;
		return typeof a == "object" ? {
			...a,
			enabled: n
		} : { enabled: n };
	}
}), Yt = /* @__PURE__ */ D(null), Xt = "button", Zt = "Draggable";
function Qt(e) {
	let { id: t, data: n, disabled: r = !1, attributes: i } = e, a = x(Zt), { activators: o, activatorEvent: s, active: c, activeNodeRect: l, ariaDescribedById: u, draggableNodes: d, over: f } = k(zt), { role: p = Xt, roleDescription: m = "draggable", tabIndex: h = 0 } = i ?? {}, v = c?.id === t, b = k(v ? qt : Yt), [S, C] = y(), [w, T] = y(), E = Dt(o, t), D = _(n);
	return g(() => (d.set(t, {
		id: t,
		key: a,
		node: S,
		activatorNode: w,
		data: D
	}), () => {
		let e = d.get(t);
		e && e.key === a && d.delete(t);
	}), [d, t]), {
		active: c,
		activatorEvent: s,
		activeNodeRect: l,
		attributes: j(() => ({
			role: p,
			tabIndex: h,
			"aria-disabled": r,
			"aria-pressed": v && p === Xt ? !0 : void 0,
			"aria-roledescription": m,
			"aria-describedby": u.draggable
		}), [
			r,
			p,
			h,
			v,
			m,
			u.draggable
		]),
		isDragging: v,
		listeners: r ? void 0 : E,
		node: S,
		over: f,
		setNodeRef: C,
		setActivatorNodeRef: T,
		transform: b
	};
}
function $t() {
	return k(Bt);
}
var en = "Droppable", tn = { timeout: 25 };
function nn(e) {
	let { data: t, disabled: n = !1, id: r, resizeObserverConfig: i } = e, a = x(en), { active: o, dispatch: s, over: c, measureDroppableContainers: l } = k(zt), u = M({ disabled: n }), d = M(!1), f = M(null), p = M(null), { disabled: m, updateMeasurementsFor: h, timeout: g } = {
		...tn,
		...i
	}, v = _(h ?? r), b = vt({
		callback: O(() => {
			if (!d.current) {
				d.current = !0;
				return;
			}
			p.current != null && clearTimeout(p.current), p.current = setTimeout(() => {
				l(Array.isArray(v.current) ? v.current : [v.current]), p.current = null;
			}, g);
		}, [g]),
		disabled: m || !o
	}), [S, C] = y(O((e, t) => {
		b && (t && (b.unobserve(t), d.current = !1), e && b.observe(e));
	}, [b])), w = _(t);
	return A(() => {
		!b || !S.current || (b.disconnect(), d.current = !1, b.observe(S.current));
	}, [S, b]), A(() => (s({
		type: I.RegisterDroppable,
		element: {
			id: r,
			key: a,
			disabled: n,
			node: S,
			rect: f,
			data: w
		}
	}), () => s({
		type: I.UnregisterDroppable,
		key: a,
		id: r
	})), [r]), A(() => {
		n !== u.current.disabled && (s({
			type: I.SetDroppableDisabled,
			id: r,
			key: a,
			disabled: n
		}), u.current.disabled = n);
	}, [
		r,
		a,
		n,
		s
	]), {
		active: o,
		rect: f,
		isOver: c?.id === r,
		node: S,
		over: c,
		setNodeRef: C
	};
}
function rn(e) {
	let { animation: t, children: n } = e, [r, i] = N(null), [a, o] = N(null), s = b(n);
	return !n && !r && s && i(s), g(() => {
		if (!a) return;
		let e = r?.key, n = r?.props.id;
		if (e == null || n == null) {
			i(null);
			return;
		}
		Promise.resolve(t(n, a)).then(() => {
			i(null);
		});
	}, [
		t,
		r,
		a
	]), T.createElement(T.Fragment, null, n, r ? E(r, { ref: o }) : null);
}
var an = {
	x: 0,
	y: 0,
	scaleX: 1,
	scaleY: 1
};
function on(e) {
	let { children: t } = e;
	return T.createElement(zt.Provider, { value: Rt }, T.createElement(qt.Provider, { value: an }, t));
}
var sn = {
	position: "fixed",
	touchAction: "none"
}, cn = (e) => l(e) ? "transform 250ms ease" : void 0, ln = /* @__PURE__ */ ee((t, n) => {
	let { as: r, activatorEvent: i, adjustScale: a, children: o, className: s, rect: c, style: l, transform: u, transition: d = cn } = t;
	if (!c) return null;
	let f = a ? u : {
		...u,
		scaleX: 1,
		scaleY: 1
	}, p = {
		...sn,
		width: c.width,
		height: c.height,
		top: c.top,
		left: c.left,
		transform: e.Transform.toString(f),
		transformOrigin: a && i ? B(i, c) : void 0,
		transition: typeof d == "function" ? d(i) : d,
		...l
	};
	return T.createElement(r, {
		className: s,
		style: p,
		ref: n
	}, o);
}), un = {
	duration: 250,
	easing: "ease",
	keyframes: (t) => {
		let { transform: { initial: n, final: r } } = t;
		return [{ transform: e.Transform.toString(n) }, { transform: e.Transform.toString(r) }];
	},
	sideEffects: /* @__PURE__ */ ((e) => (t) => {
		let { active: n, dragOverlay: r } = t, i = {}, { styles: a, className: o } = e;
		if (a != null && a.active) for (let [e, t] of Object.entries(a.active)) t !== void 0 && (i[e] = n.node.style.getPropertyValue(e), n.node.style.setProperty(e, t));
		if (a != null && a.dragOverlay) for (let [e, t] of Object.entries(a.dragOverlay)) t !== void 0 && r.node.style.setProperty(e, t);
		return o != null && o.active && n.node.classList.add(o.active), o != null && o.dragOverlay && r.node.classList.add(o.dragOverlay), function() {
			for (let [e, t] of Object.entries(i)) n.node.style.setProperty(e, t);
			o != null && o.active && n.node.classList.remove(o.active);
		};
	})({ styles: { active: { opacity: "0" } } })
};
function dn(e) {
	let { config: t, draggableNodes: n, droppableContainers: r, measuringConfiguration: i } = e;
	return m((e, a) => {
		if (t === null) return;
		let s = n.get(e);
		if (!s) return;
		let c = s.node.current;
		if (!c) return;
		let l = jt(a);
		if (!l) return;
		let { transform: u } = o(a).getComputedStyle(a), d = xe(u);
		if (!d) return;
		let f = typeof t == "function" ? t : fn(t);
		return Le(c, i.draggable.measure), f({
			active: {
				id: e,
				data: s.data,
				node: c,
				rect: i.draggable.measure(c)
			},
			draggableNodes: n,
			dragOverlay: {
				node: a,
				rect: i.dragOverlay.measure(l)
			},
			droppableContainers: r,
			measuringConfiguration: i,
			transform: d
		});
	});
}
function fn(e) {
	let { duration: t, easing: n, sideEffects: r, keyframes: i } = {
		...un,
		...e
	};
	return (e) => {
		let { active: a, dragOverlay: o, transform: s, ...c } = e;
		if (!t) return;
		let l = {
			x: o.rect.left - a.rect.left,
			y: o.rect.top - a.rect.top
		}, u = {
			scaleX: s.scaleX === 1 ? 1 : a.rect.width * s.scaleX / o.rect.width,
			scaleY: s.scaleY === 1 ? 1 : a.rect.height * s.scaleY / o.rect.height
		}, d = {
			x: s.x - l.x,
			y: s.y - l.y,
			...u
		}, f = i({
			...c,
			active: a,
			dragOverlay: o,
			transform: {
				initial: s,
				final: d
			}
		}), [p] = f, m = f[f.length - 1];
		if (JSON.stringify(p) === JSON.stringify(m)) return;
		let h = r?.({
			active: a,
			dragOverlay: o,
			...c
		}), g = o.node.animate(f, {
			duration: t,
			easing: n,
			fill: "forwards"
		});
		return new Promise((e) => {
			g.onfinish = () => {
				h?.(), e();
			};
		});
	};
}
var pn = 0;
function mn(e) {
	return j(() => {
		if (e != null) return pn++, pn;
	}, [e]);
}
var hn = /* @__PURE__ */ T.memo((e) => {
	let { adjustScale: t = !1, children: n, dropAnimation: r, style: i, transition: a, modifiers: o, wrapperElement: s = "div", className: c, zIndex: l = 999 } = e, { activatorEvent: u, active: d, activeNodeRect: f, containerNodeRect: p, draggableNodes: m, droppableContainers: h, dragOverlay: g, over: _, measuringConfiguration: v, scrollableAncestors: y, scrollableAncestorRects: b, windowRect: x } = $t(), S = k(qt), C = mn(d?.id), w = Wt(o, {
		activatorEvent: u,
		active: d,
		activeNodeRect: f,
		containerNodeRect: p,
		draggingNodeRect: g.rect,
		over: _,
		overlayNodeRect: g.rect,
		scrollableAncestors: y,
		scrollableAncestorRects: b,
		transform: S,
		windowRect: x
	}), E = ht(f), D = dn({
		config: r,
		draggableNodes: m,
		droppableContainers: h,
		measuringConfiguration: v
	}), ee = E ? g.setRef : void 0;
	return T.createElement(on, null, T.createElement(rn, { animation: D }, d && C ? T.createElement(ln, {
		key: C,
		id: d.id,
		ref: ee,
		as: s,
		activatorEvent: u,
		adjustScale: t,
		className: c,
		transition: a,
		rect: E,
		style: {
			zIndex: l,
			...i
		},
		transform: w
	}, n) : null));
});
//#endregion
export { Jt as DndContext, hn as DragOverlay, Q as KeyboardCode, qe as KeyboardSensor, Qe as PointerSensor, rt as TouchSensor, he as closestCenter, ge as closestCorners, G as getClientRect, pe as getFirstCollision, q as getScrollableAncestors, $t as useDndContext, Qt as useDraggable, nn as useDroppable, L as useSensor, ue as useSensors };

//# sourceMappingURL=core.esm.js.map