UNPKG

alinea

Version:
1,468 lines (1,439 loc) 94.8 kB
import { A, h } from "./chunk-HSIHEWFC.js"; import { K, L, T, n, o, o2, p, s, s2, t, u, y } from "./chunk-VUACWPFC.js"; // node_modules/@headlessui/react/dist/hooks/use-element-size.js import { useMemo as o3, useReducer as h2 } from "react"; function f(e3) { if (e3 === null) return { width: 0, height: 0 }; let { width: t6, height: r5 } = e3.getBoundingClientRect(); return { width: t6, height: r5 }; } function d(e3, t6 = false) { let [r5, u4] = h2(() => ({}), {}), i4 = o3(() => f(e3), [e3, r5]); return n(() => { if (!e3) return; let n7 = new ResizeObserver(u4); return n7.observe(e3), () => { n7.disconnect(); }; }, [e3]), t6 ? { width: `${i4.width}px`, height: `${i4.height}px` } : i4; } // node_modules/@headlessui/react/dist/hooks/use-on-disappear.js import { useEffect as o4 } from "react"; function m(s6, n7, l3) { let i4 = s2((t6) => { let e3 = t6.getBoundingClientRect(); e3.x === 0 && e3.y === 0 && e3.width === 0 && e3.height === 0 && l3(); }); o4(() => { if (!s6) return; let t6 = n7 === null ? null : n7 instanceof HTMLElement ? n7 : n7.current; if (!t6) return; let e3 = o(); if (typeof ResizeObserver != "undefined") { let r5 = new ResizeObserver(() => i4.current(t6)); r5.observe(t6), e3.add(() => r5.disconnect()); } if (typeof IntersectionObserver != "undefined") { let r5 = new IntersectionObserver(() => i4.current(t6)); r5.observe(t6), e3.add(() => r5.disconnect()); } return () => e3.dispose(); }, [n7, i4, s6]); } // node_modules/@headlessui/react/dist/hooks/use-outside-click.js import { useCallback as T2, useRef as d2 } from "react"; // node_modules/@headlessui/react/dist/utils/platform.js function t2() { return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0; } function i() { return /Android/gi.test(window.navigator.userAgent); } function n2() { return t2() || i(); } // node_modules/@headlessui/react/dist/hooks/use-document-event.js import { useEffect as c } from "react"; function i2(t6, e3, o6, n7) { let u4 = s2(o6); c(() => { if (!t6) return; function r5(m3) { u4.current(m3); } return document.addEventListener(e3, r5, n7), () => document.removeEventListener(e3, r5, n7); }, [t6, e3, n7]); } // node_modules/@headlessui/react/dist/hooks/use-is-top-layer.js import { useId as n3 } from "react"; // node_modules/@headlessui/react/dist/utils/default-map.js var a = class extends Map { constructor(t6) { super(); this.factory = t6; } get(t6) { let e3 = super.get(t6); return e3 === void 0 && (e3 = this.factory(t6), this.set(t6, e3)), e3; } }; // node_modules/@headlessui/react/dist/utils/store.js function a2(o6, r5) { let t6 = o6(), n7 = /* @__PURE__ */ new Set(); return { getSnapshot() { return t6; }, subscribe(e3) { return n7.add(e3), () => n7.delete(e3); }, dispatch(e3, ...s6) { let i4 = r5[e3].call(t6, ...s6); i4 && (t6 = i4, n7.forEach((c8) => c8())); } }; } // node_modules/@headlessui/react/dist/hooks/use-store.js import { useSyncExternalStore as e } from "react"; function o5(t6) { return e(t6.subscribe, t6.getSnapshot, t6.getSnapshot); } // node_modules/@headlessui/react/dist/hooks/use-is-top-layer.js var p2 = new a(() => a2(() => [], { ADD(r5) { return this.includes(r5) ? this : [...this, r5]; }, REMOVE(r5) { let e3 = this.indexOf(r5); if (e3 === -1) return this; let t6 = this.slice(); return t6.splice(e3, 1), t6; } })); function x(r5, e3) { let t6 = p2.get(e3), i4 = n3(), h3 = o5(t6); if (n(() => { if (r5) return t6.dispatch("ADD", i4), () => t6.dispatch("REMOVE", i4); }, [t6, r5]), !r5) return false; let s6 = h3.indexOf(i4), o6 = h3.length; return s6 === -1 && (s6 = o6, o6 += 1), s6 === o6 - 1; } // node_modules/@headlessui/react/dist/hooks/use-window-event.js import { useEffect as a3 } from "react"; function s3(t6, e3, o6, n7) { let i4 = s2(o6); a3(() => { if (!t6) return; function r5(d6) { i4.current(d6); } return window.addEventListener(e3, r5, n7), () => window.removeEventListener(e3, r5, n7); }, [t6, e3, n7]); } // node_modules/@headlessui/react/dist/hooks/use-outside-click.js var E = 30; function R(p3, f4, C2) { let u4 = x(p3, "outside-click"), m3 = s2(C2), s6 = T2(function(e3, n7) { if (e3.defaultPrevented) return; let r5 = n7(e3); if (r5 === null || !r5.getRootNode().contains(r5) || !r5.isConnected) return; let h3 = function l3(o6) { return typeof o6 == "function" ? l3(o6()) : Array.isArray(o6) || o6 instanceof Set ? o6 : [o6]; }(f4); for (let l3 of h3) if (l3 !== null && (l3.contains(r5) || e3.composed && e3.composedPath().includes(l3))) return; return !A(r5, h.Loose) && r5.tabIndex !== -1 && e3.preventDefault(), m3.current(e3, r5); }, [m3, f4]), i4 = d2(null); i2(u4, "pointerdown", (t6) => { var e3, n7; i4.current = ((n7 = (e3 = t6.composedPath) == null ? void 0 : e3.call(t6)) == null ? void 0 : n7[0]) || t6.target; }, true), i2(u4, "mousedown", (t6) => { var e3, n7; i4.current = ((n7 = (e3 = t6.composedPath) == null ? void 0 : e3.call(t6)) == null ? void 0 : n7[0]) || t6.target; }, true), i2(u4, "click", (t6) => { n2() || i4.current && (s6(t6, () => i4.current), i4.current = null); }, true); let a7 = d2({ x: 0, y: 0 }); i2(u4, "touchstart", (t6) => { a7.current.x = t6.touches[0].clientX, a7.current.y = t6.touches[0].clientY; }, true), i2(u4, "touchend", (t6) => { let e3 = { x: t6.changedTouches[0].clientX, y: t6.changedTouches[0].clientY }; if (!(Math.abs(e3.x - a7.current.x) >= E || Math.abs(e3.y - a7.current.y) >= E)) return s6(t6, () => t6.target instanceof HTMLElement ? t6.target : null); }, true), s3(u4, "blur", (t6) => s6(t6, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), true); } // node_modules/@headlessui/react/dist/hooks/use-owner.js import { useMemo as t3 } from "react"; function n4(...e3) { return t3(() => u(...e3), [...e3]); } // node_modules/@headlessui/react/dist/hooks/document-overflow/adjust-scrollbar-padding.js function d3() { let r5; return { before({ doc: e3 }) { var l3; let o6 = e3.documentElement, t6 = (l3 = e3.defaultView) != null ? l3 : window; r5 = Math.max(0, t6.innerWidth - o6.clientWidth); }, after({ doc: e3, d: o6 }) { let t6 = e3.documentElement, l3 = Math.max(0, t6.clientWidth - t6.offsetWidth), n7 = Math.max(0, r5 - l3); o6.style(t6, "paddingRight", `${n7}px`); } }; } // node_modules/@headlessui/react/dist/hooks/document-overflow/handle-ios-locking.js function d4() { return t2() ? { before({ doc: r5, d: n7, meta: c8 }) { function o6(a7) { return c8.containers.flatMap((l3) => l3()).some((l3) => l3.contains(a7)); } n7.microTask(() => { var s6; if (window.getComputedStyle(r5.documentElement).scrollBehavior !== "auto") { let t6 = o(); t6.style(r5.documentElement, "scrollBehavior", "auto"), n7.add(() => n7.microTask(() => t6.dispose())); } let a7 = (s6 = window.scrollY) != null ? s6 : window.pageYOffset, l3 = null; n7.addEventListener(r5, "click", (t6) => { if (t6.target instanceof HTMLElement) try { let e3 = t6.target.closest("a"); if (!e3) return; let { hash: f4 } = new URL(e3.href), i4 = r5.querySelector(f4); i4 && !o6(i4) && (l3 = i4); } catch { } }, true), n7.addEventListener(r5, "touchstart", (t6) => { if (t6.target instanceof HTMLElement) if (o6(t6.target)) { let e3 = t6.target; for (; e3.parentElement && o6(e3.parentElement); ) e3 = e3.parentElement; n7.style(e3, "overscrollBehavior", "contain"); } else n7.style(t6.target, "touchAction", "none"); }), n7.addEventListener(r5, "touchmove", (t6) => { if (t6.target instanceof HTMLElement) { if (t6.target.tagName === "INPUT") return; if (o6(t6.target)) { let e3 = t6.target; for (; e3.parentElement && e3.dataset.headlessuiPortal !== "" && !(e3.scrollHeight > e3.clientHeight || e3.scrollWidth > e3.clientWidth); ) e3 = e3.parentElement; e3.dataset.headlessuiPortal === "" && t6.preventDefault(); } else t6.preventDefault(); } }, { passive: false }), n7.add(() => { var e3; let t6 = (e3 = window.scrollY) != null ? e3 : window.pageYOffset; a7 !== t6 && window.scrollTo(0, a7), l3 && l3.isConnected && (l3.scrollIntoView({ block: "nearest" }), l3 = null); }); }); } } : {}; } // node_modules/@headlessui/react/dist/hooks/document-overflow/prevent-scroll.js function r() { return { before({ doc: e3, d: o6 }) { o6.style(e3.documentElement, "overflow", "hidden"); } }; } // node_modules/@headlessui/react/dist/hooks/document-overflow/overflow-store.js function m2(e3) { let n7 = {}; for (let t6 of e3) Object.assign(n7, t6(n7)); return n7; } var a4 = a2(() => /* @__PURE__ */ new Map(), { PUSH(e3, n7) { var o6; let t6 = (o6 = this.get(e3)) != null ? o6 : { doc: e3, count: 0, d: o(), meta: /* @__PURE__ */ new Set() }; return t6.count++, t6.meta.add(n7), this.set(e3, t6), this; }, POP(e3, n7) { let t6 = this.get(e3); return t6 && (t6.count--, t6.meta.delete(n7)), this; }, SCROLL_PREVENT({ doc: e3, d: n7, meta: t6 }) { let o6 = { doc: e3, d: n7, meta: m2(t6) }, c8 = [d4(), d3(), r()]; c8.forEach(({ before: r5 }) => r5 == null ? void 0 : r5(o6)), c8.forEach(({ after: r5 }) => r5 == null ? void 0 : r5(o6)); }, SCROLL_ALLOW({ d: e3 }) { e3.dispose(); }, TEARDOWN({ doc: e3 }) { this.delete(e3); } }); a4.subscribe(() => { let e3 = a4.getSnapshot(), n7 = /* @__PURE__ */ new Map(); for (let [t6] of e3) n7.set(t6, t6.documentElement.style.overflow); for (let t6 of e3.values()) { let o6 = n7.get(t6.doc) === "hidden", c8 = t6.count !== 0; (c8 && !o6 || !c8 && o6) && a4.dispatch(t6.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", t6), t6.count === 0 && a4.dispatch("TEARDOWN", t6); } }); // node_modules/@headlessui/react/dist/hooks/document-overflow/use-document-overflow.js function a5(r5, e3, n7 = () => ({ containers: [] })) { let f4 = o5(a4), o6 = e3 ? f4.get(e3) : void 0, i4 = o6 ? o6.count > 0 : false; return n(() => { if (!(!e3 || !r5)) return a4.dispatch("PUSH", e3, n7), () => a4.dispatch("POP", e3, n7); }, [r5, e3]), i4; } // node_modules/@headlessui/react/dist/hooks/use-scroll-lock.js function f2(e3, c8, n7 = () => [document.body]) { let r5 = x(e3, "scroll-lock"); a5(r5, c8, (t6) => { var o6; return { containers: [...(o6 = t6.containers) != null ? o6 : [], n7] }; }); } // node_modules/@headlessui/react/dist/hooks/use-transition.js import { useRef as c3, useState as S } from "react"; // node_modules/@headlessui/react/dist/hooks/use-flags.js import { useCallback as r2, useState as b } from "react"; function c2(u4 = 0) { let [t6, l3] = b(u4), g2 = r2((e3) => l3(e3), [t6]), s6 = r2((e3) => l3((a7) => a7 | e3), [t6]), m3 = r2((e3) => (t6 & e3) === e3, [t6]), n7 = r2((e3) => l3((a7) => a7 & ~e3), [l3]), F = r2((e3) => l3((a7) => a7 ^ e3), [l3]); return { flags: t6, setFlag: g2, addFlag: s6, hasFlag: m3, removeFlag: n7, toggleFlag: F }; } // node_modules/@headlessui/react/dist/hooks/use-transition.js var T3; var b2; typeof process != "undefined" && typeof globalThis != "undefined" && typeof Element != "undefined" && ((T3 = process == null ? void 0 : process.env) == null ? void 0 : T3["NODE_ENV"]) === "test" && typeof ((b2 = Element == null ? void 0 : Element.prototype) == null ? void 0 : b2.getAnimations) == "undefined" && (Element.prototype.getAnimations = function() { return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.", "Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.", "", "Example usage:", "```js", "import { mockAnimationsApi } from 'jsdom-testing-mocks'", "mockAnimationsApi()", "```"].join(` `)), []; }); var L2 = ((r5) => (r5[r5.None = 0] = "None", r5[r5.Closed = 1] = "Closed", r5[r5.Enter = 2] = "Enter", r5[r5.Leave = 4] = "Leave", r5))(L2 || {}); function R2(t6) { let n7 = {}; for (let e3 in t6) t6[e3] === true && (n7[`data-${e3}`] = ""); return n7; } function x2(t6, n7, e3, i4) { let [r5, o6] = S(e3), { hasFlag: s6, addFlag: a7, removeFlag: l3 } = c2(t6 && r5 ? 3 : 0), u4 = c3(false), f4 = c3(false), E3 = p(); return n(() => { var d6; if (t6) { if (e3 && o6(true), !n7) { e3 && a7(3); return; } return (d6 = i4 == null ? void 0 : i4.start) == null || d6.call(i4, e3), C(n7, { inFlight: u4, prepare() { f4.current ? f4.current = false : f4.current = u4.current, u4.current = true, !f4.current && (e3 ? (a7(3), l3(4)) : (a7(4), l3(2))); }, run() { f4.current ? e3 ? (l3(3), a7(4)) : (l3(4), a7(3)) : e3 ? l3(1) : a7(1); }, done() { var p3; f4.current && typeof n7.getAnimations == "function" && n7.getAnimations().length > 0 || (u4.current = false, l3(7), e3 || o6(false), (p3 = i4 == null ? void 0 : i4.end) == null || p3.call(i4, e3)); } }); } }, [t6, e3, n7, E3]), t6 ? [r5, { closed: s6(1), enter: s6(2), leave: s6(4), transition: s6(2) || s6(4) }] : [e3, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }]; } function C(t6, { prepare: n7, run: e3, done: i4, inFlight: r5 }) { let o6 = o(); return j(t6, { prepare: n7, inFlight: r5 }), o6.nextFrame(() => { e3(), o6.requestAnimationFrame(() => { o6.add(M(t6, i4)); }); }), o6.dispose; } function M(t6, n7) { var o6, s6; let e3 = o(); if (!t6) return e3.dispose; let i4 = false; e3.add(() => { i4 = true; }); let r5 = (s6 = (o6 = t6.getAnimations) == null ? void 0 : o6.call(t6).filter((a7) => a7 instanceof CSSTransition)) != null ? s6 : []; return r5.length === 0 ? (n7(), e3.dispose) : (Promise.allSettled(r5.map((a7) => a7.finished)).then(() => { i4 || n7(); }), e3.dispose); } function j(t6, { inFlight: n7, prepare: e3 }) { if (n7 != null && n7.current) { e3(); return; } let i4 = t6.style.transition; t6.style.transition = "none", e3(), t6.offsetHeight, t6.style.transition = i4; } // node_modules/@floating-ui/react/dist/floating-ui.react.mjs import * as React2 from "react"; import { useLayoutEffect as useLayoutEffect2, useEffect as useEffect3, useRef as useRef3 } from "react"; // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs function hasWindow() { return typeof window !== "undefined"; } function getNodeName(node) { if (isNode(node)) { return (node.nodeName || "").toLowerCase(); } return "#document"; } function getWindow(node) { var _node$ownerDocument; return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; } function getDocumentElement(node) { var _ref; return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; } function isNode(value) { if (!hasWindow()) { return false; } return value instanceof Node || value instanceof getWindow(value).Node; } function isElement(value) { if (!hasWindow()) { return false; } return value instanceof Element || value instanceof getWindow(value).Element; } function isHTMLElement(value) { if (!hasWindow()) { return false; } return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; } function isShadowRoot(value) { if (!hasWindow() || typeof ShadowRoot === "undefined") { return false; } return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; } function isOverflowElement(element) { const { overflow, overflowX, overflowY, display } = getComputedStyle2(element); return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display); } function isTableElement(element) { return ["table", "td", "th"].includes(getNodeName(element)); } function isTopLayer(element) { return [":popover-open", ":modal"].some((selector) => { try { return element.matches(selector); } catch (e3) { return false; } }); } function isContainingBlock(elementOrCss) { const webkit = isWebKit(); const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value)); } function getContainingBlock(element) { let currentNode = getParentNode(element); while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { if (isContainingBlock(currentNode)) { return currentNode; } else if (isTopLayer(currentNode)) { return null; } currentNode = getParentNode(currentNode); } return null; } function isWebKit() { if (typeof CSS === "undefined" || !CSS.supports) return false; return CSS.supports("-webkit-backdrop-filter", "none"); } function isLastTraversableNode(node) { return ["html", "body", "#document"].includes(getNodeName(node)); } function getComputedStyle2(element) { return getWindow(element).getComputedStyle(element); } function getNodeScroll(element) { if (isElement(element)) { return { scrollLeft: element.scrollLeft, scrollTop: element.scrollTop }; } return { scrollLeft: element.scrollX, scrollTop: element.scrollY }; } function getParentNode(node) { if (getNodeName(node) === "html") { return node; } const result = ( // Step into the shadow DOM of the parent of a slotted node. node.assignedSlot || // DOM Element detected. node.parentNode || // ShadowRoot detected. isShadowRoot(node) && node.host || // Fallback. getDocumentElement(node) ); return isShadowRoot(result) ? result.host : result; } function getNearestOverflowAncestor(node) { const parentNode = getParentNode(node); if (isLastTraversableNode(parentNode)) { return node.ownerDocument ? node.ownerDocument.body : node.body; } if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { return parentNode; } return getNearestOverflowAncestor(parentNode); } function getOverflowAncestors(node, list, traverseIframes) { var _node$ownerDocument2; if (list === void 0) { list = []; } if (traverseIframes === void 0) { traverseIframes = true; } const scrollableAncestor = getNearestOverflowAncestor(node); const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); const win = getWindow(scrollableAncestor); if (isBody) { const frameElement = getFrameElement(win); return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); } return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); } function getFrameElement(win) { return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; } // node_modules/@floating-ui/react/dist/floating-ui.react.utils.mjs function getUserAgent() { const uaData = navigator.userAgentData; if (uaData && Array.isArray(uaData.brands)) { return uaData.brands.map((_ref) => { let { brand, version } = _ref; return brand + "/" + version; }).join(" "); } return navigator.userAgent; } // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs var min = Math.min; var max = Math.max; var round = Math.round; var floor = Math.floor; var createCoords = (v2) => ({ x: v2, y: v2 }); var oppositeSideMap = { left: "right", right: "left", bottom: "top", top: "bottom" }; var oppositeAlignmentMap = { start: "end", end: "start" }; function clamp(start, value, end) { return max(start, min(value, end)); } function evaluate(value, param) { return typeof value === "function" ? value(param) : value; } function getSide(placement) { return placement.split("-")[0]; } function getAlignment(placement) { return placement.split("-")[1]; } function getOppositeAxis(axis) { return axis === "x" ? "y" : "x"; } function getAxisLength(axis) { return axis === "y" ? "height" : "width"; } function getSideAxis(placement) { return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x"; } function getAlignmentAxis(placement) { return getOppositeAxis(getSideAxis(placement)); } function getAlignmentSides(placement, rects, rtl) { if (rtl === void 0) { rtl = false; } const alignment = getAlignment(placement); const alignmentAxis = getAlignmentAxis(placement); const length = getAxisLength(alignmentAxis); let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; if (rects.reference[length] > rects.floating[length]) { mainAlignmentSide = getOppositePlacement(mainAlignmentSide); } return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; } function getExpandedPlacements(placement) { const oppositePlacement = getOppositePlacement(placement); return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; } function getOppositeAlignmentPlacement(placement) { return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]); } function getSideList(side, isStart, rtl) { const lr = ["left", "right"]; const rl = ["right", "left"]; const tb = ["top", "bottom"]; const bt = ["bottom", "top"]; switch (side) { case "top": case "bottom": if (rtl) return isStart ? rl : lr; return isStart ? lr : rl; case "left": case "right": return isStart ? tb : bt; default: return []; } } function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { const alignment = getAlignment(placement); let list = getSideList(getSide(placement), direction === "start", rtl); if (alignment) { list = list.map((side) => side + "-" + alignment); if (flipAlignment) { list = list.concat(list.map(getOppositeAlignmentPlacement)); } } return list; } function getOppositePlacement(placement) { return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]); } function expandPaddingObject(padding) { return { top: 0, right: 0, bottom: 0, left: 0, ...padding }; } function getPaddingObject(padding) { return typeof padding !== "number" ? expandPaddingObject(padding) : { top: padding, right: padding, bottom: padding, left: padding }; } function rectToClientRect(rect) { const { x: x3, y: y4, width, height } = rect; return { width, height, top: y4, left: x3, right: x3 + width, bottom: y4 + height, x: x3, y: y4 }; } // node_modules/@floating-ui/react/dist/floating-ui.react.mjs import * as ReactDOM2 from "react-dom"; // node_modules/@floating-ui/react/node_modules/@floating-ui/react-dom/node_modules/@floating-ui/dom/node_modules/@floating-ui/core/dist/floating-ui.core.mjs function computeCoordsFromPlacement(_ref, placement, rtl) { let { reference, floating } = _ref; const sideAxis = getSideAxis(placement); const alignmentAxis = getAlignmentAxis(placement); const alignLength = getAxisLength(alignmentAxis); const side = getSide(placement); const isVertical = sideAxis === "y"; const commonX = reference.x + reference.width / 2 - floating.width / 2; const commonY = reference.y + reference.height / 2 - floating.height / 2; const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; let coords; switch (side) { case "top": coords = { x: commonX, y: reference.y - floating.height }; break; case "bottom": coords = { x: commonX, y: reference.y + reference.height }; break; case "right": coords = { x: reference.x + reference.width, y: commonY }; break; case "left": coords = { x: reference.x - floating.width, y: commonY }; break; default: coords = { x: reference.x, y: reference.y }; } switch (getAlignment(placement)) { case "start": coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); break; case "end": coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); break; } return coords; } var computePosition = async (reference, floating, config) => { const { placement = "bottom", strategy = "absolute", middleware = [], platform: platform2 } = config; const validMiddleware = middleware.filter(Boolean); const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating)); let rects = await platform2.getElementRects({ reference, floating, strategy }); let { x: x3, y: y4 } = computeCoordsFromPlacement(rects, placement, rtl); let statefulPlacement = placement; let middlewareData = {}; let resetCount = 0; for (let i4 = 0; i4 < validMiddleware.length; i4++) { const { name, fn } = validMiddleware[i4]; const { x: nextX, y: nextY, data, reset } = await fn({ x: x3, y: y4, initialPlacement: placement, placement: statefulPlacement, strategy, middlewareData, rects, platform: platform2, elements: { reference, floating } }); x3 = nextX != null ? nextX : x3; y4 = nextY != null ? nextY : y4; middlewareData = { ...middlewareData, [name]: { ...middlewareData[name], ...data } }; if (reset && resetCount <= 50) { resetCount++; if (typeof reset === "object") { if (reset.placement) { statefulPlacement = reset.placement; } if (reset.rects) { rects = reset.rects === true ? await platform2.getElementRects({ reference, floating, strategy }) : reset.rects; } ({ x: x3, y: y4 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); } i4 = -1; } } return { x: x3, y: y4, placement: statefulPlacement, strategy, middlewareData }; }; async function detectOverflow(state, options) { var _await$platform$isEle; if (options === void 0) { options = {}; } const { x: x3, y: y4, platform: platform2, rects, elements, strategy } = state; const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate(options, state); const paddingObject = getPaddingObject(padding); const altContext = elementContext === "floating" ? "reference" : "floating"; const element = elements[altBoundary ? altContext : elementContext]; const clippingClientRect = rectToClientRect(await platform2.getClippingRect({ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)), boundary, rootBoundary, strategy })); const rect = elementContext === "floating" ? { x: x3, y: y4, width: rects.floating.width, height: rects.floating.height } : rects.reference; const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)); const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || { x: 1, y: 1 } : { x: 1, y: 1 }; const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({ elements, rect, offsetParent, strategy }) : rect); return { top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x }; } var flip = function(options) { if (options === void 0) { options = {}; } return { name: "flip", options, async fn(state) { var _middlewareData$arrow, _middlewareData$flip; const { placement, middlewareData, rects, initialPlacement, platform: platform2, elements } = state; const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = evaluate(options, state); if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { return {}; } const side = getSide(placement); const initialSideAxis = getSideAxis(initialPlacement); const isBasePlacement = getSide(initialPlacement) === initialPlacement; const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); } const placements2 = [initialPlacement, ...fallbackPlacements]; const overflow = await detectOverflow(state, detectOverflowOptions); const overflows = []; let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; if (checkMainAxis) { overflows.push(overflow[side]); } if (checkCrossAxis) { const sides2 = getAlignmentSides(placement, rects, rtl); overflows.push(overflow[sides2[0]], overflow[sides2[1]]); } overflowsData = [...overflowsData, { placement, overflows }]; if (!overflows.every((side2) => side2 <= 0)) { var _middlewareData$flip2, _overflowsData$filter; const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; const nextPlacement = placements2[nextIndex]; if (nextPlacement) { return { data: { index: nextIndex, overflows: overflowsData }, reset: { placement: nextPlacement } }; } let resetPlacement = (_overflowsData$filter = overflowsData.filter((d6) => d6.overflows[0] <= 0).sort((a7, b3) => a7.overflows[1] - b3.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; if (!resetPlacement) { switch (fallbackStrategy) { case "bestFit": { var _overflowsData$filter2; const placement2 = (_overflowsData$filter2 = overflowsData.filter((d6) => { if (hasFallbackAxisSideDirection) { const currentSideAxis = getSideAxis(d6.placement); return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal // reading directions favoring greater width. currentSideAxis === "y"; } return true; }).map((d6) => [d6.placement, d6.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a7, b3) => a7[1] - b3[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; if (placement2) { resetPlacement = placement2; } break; } case "initialPlacement": resetPlacement = initialPlacement; break; } } if (placement !== resetPlacement) { return { reset: { placement: resetPlacement } }; } } return {}; } }; }; async function convertValueToCoords(state, options) { const { placement, platform: platform2, elements } = state; const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); const side = getSide(placement); const alignment = getAlignment(placement); const isVertical = getSideAxis(placement) === "y"; const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1; const crossAxisMulti = rtl && isVertical ? -1 : 1; const rawValue = evaluate(options, state); let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === "number" ? { mainAxis: rawValue, crossAxis: 0, alignmentAxis: null } : { mainAxis: rawValue.mainAxis || 0, crossAxis: rawValue.crossAxis || 0, alignmentAxis: rawValue.alignmentAxis }; if (alignment && typeof alignmentAxis === "number") { crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; } return isVertical ? { x: crossAxis * crossAxisMulti, y: mainAxis * mainAxisMulti } : { x: mainAxis * mainAxisMulti, y: crossAxis * crossAxisMulti }; } var offset = function(options) { if (options === void 0) { options = 0; } return { name: "offset", options, async fn(state) { var _middlewareData$offse, _middlewareData$arrow; const { x: x3, y: y4, placement, middlewareData } = state; const diffCoords = await convertValueToCoords(state, options); if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { return {}; } return { x: x3 + diffCoords.x, y: y4 + diffCoords.y, data: { ...diffCoords, placement } }; } }; }; var shift = function(options) { if (options === void 0) { options = {}; } return { name: "shift", options, async fn(state) { const { x: x3, y: y4, placement } = state; const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => { let { x: x4, y: y5 } = _ref; return { x: x4, y: y5 }; } }, ...detectOverflowOptions } = evaluate(options, state); const coords = { x: x3, y: y4 }; const overflow = await detectOverflow(state, detectOverflowOptions); const crossAxis = getSideAxis(getSide(placement)); const mainAxis = getOppositeAxis(crossAxis); let mainAxisCoord = coords[mainAxis]; let crossAxisCoord = coords[crossAxis]; if (checkMainAxis) { const minSide = mainAxis === "y" ? "top" : "left"; const maxSide = mainAxis === "y" ? "bottom" : "right"; const min2 = mainAxisCoord + overflow[minSide]; const max2 = mainAxisCoord - overflow[maxSide]; mainAxisCoord = clamp(min2, mainAxisCoord, max2); } if (checkCrossAxis) { const minSide = crossAxis === "y" ? "top" : "left"; const maxSide = crossAxis === "y" ? "bottom" : "right"; const min2 = crossAxisCoord + overflow[minSide]; const max2 = crossAxisCoord - overflow[maxSide]; crossAxisCoord = clamp(min2, crossAxisCoord, max2); } const limitedCoords = limiter.fn({ ...state, [mainAxis]: mainAxisCoord, [crossAxis]: crossAxisCoord }); return { ...limitedCoords, data: { x: limitedCoords.x - x3, y: limitedCoords.y - y4, enabled: { [mainAxis]: checkMainAxis, [crossAxis]: checkCrossAxis } } }; } }; }; var size = function(options) { if (options === void 0) { options = {}; } return { name: "size", options, async fn(state) { var _state$middlewareData, _state$middlewareData2; const { placement, rects, platform: platform2, elements } = state; const { apply = () => { }, ...detectOverflowOptions } = evaluate(options, state); const overflow = await detectOverflow(state, detectOverflowOptions); const side = getSide(placement); const alignment = getAlignment(placement); const isYAxis = getSideAxis(placement) === "y"; const { width, height } = rects.floating; let heightSide; let widthSide; if (side === "top" || side === "bottom") { heightSide = side; widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; } else { widthSide = side; heightSide = alignment === "end" ? "top" : "bottom"; } const maximumClippingHeight = height - overflow.top - overflow.bottom; const maximumClippingWidth = width - overflow.left - overflow.right; const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); const noShift = !state.middlewareData.shift; let availableHeight = overflowAvailableHeight; let availableWidth = overflowAvailableWidth; if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { availableWidth = maximumClippingWidth; } if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { availableHeight = maximumClippingHeight; } if (noShift && !alignment) { const xMin = max(overflow.left, 0); const xMax = max(overflow.right, 0); const yMin = max(overflow.top, 0); const yMax = max(overflow.bottom, 0); if (isYAxis) { availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); } else { availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); } } await apply({ ...state, availableWidth, availableHeight }); const nextDimensions = await platform2.getDimensions(elements.floating); if (width !== nextDimensions.width || height !== nextDimensions.height) { return { reset: { rects: true } }; } return {}; } }; }; // node_modules/@floating-ui/react/node_modules/@floating-ui/react-dom/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs function getCssDimensions(element) { const css = getComputedStyle2(element); let width = parseFloat(css.width) || 0; let height = parseFloat(css.height) || 0; const hasOffset = isHTMLElement(element); const offsetWidth = hasOffset ? element.offsetWidth : width; const offsetHeight = hasOffset ? element.offsetHeight : height; const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; if (shouldFallback) { width = offsetWidth; height = offsetHeight; } return { width, height, $: shouldFallback }; } function unwrapElement(element) { return !isElement(element) ? element.contextElement : element; } function getScale(element) { const domElement = unwrapElement(element); if (!isHTMLElement(domElement)) { return createCoords(1); } const rect = domElement.getBoundingClientRect(); const { width, height, $ } = getCssDimensions(domElement); let x3 = ($ ? round(rect.width) : rect.width) / width; let y4 = ($ ? round(rect.height) : rect.height) / height; if (!x3 || !Number.isFinite(x3)) { x3 = 1; } if (!y4 || !Number.isFinite(y4)) { y4 = 1; } return { x: x3, y: y4 }; } var noOffsets = /* @__PURE__ */ createCoords(0); function getVisualOffsets(element) { const win = getWindow(element); if (!isWebKit() || !win.visualViewport) { return noOffsets; } return { x: win.visualViewport.offsetLeft, y: win.visualViewport.offsetTop }; } function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { if (isFixed === void 0) { isFixed = false; } if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { return false; } return isFixed; } function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { if (includeScale === void 0) { includeScale = false; } if (isFixedStrategy === void 0) { isFixedStrategy = false; } const clientRect = element.getBoundingClientRect(); const domElement = unwrapElement(element); let scale = createCoords(1); if (includeScale) { if (offsetParent) { if (isElement(offsetParent)) { scale = getScale(offsetParent); } } else { scale = getScale(element); } } const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); let x3 = (clientRect.left + visualOffsets.x) / scale.x; let y4 = (clientRect.top + visualOffsets.y) / scale.y; let width = clientRect.width / scale.x; let height = clientRect.height / scale.y; if (domElement) { const win = getWindow(domElement); const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; let currentWin = win; let currentIFrame = getFrameElement(currentWin); while (currentIFrame && offsetParent && offsetWin !== currentWin) { const iframeScale = getScale(currentIFrame); const iframeRect = currentIFrame.getBoundingClientRect(); const css = getComputedStyle2(currentIFrame); const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; x3 *= iframeScale.x; y4 *= iframeScale.y; width *= iframeScale.x; height *= iframeScale.y; x3 += left; y4 += top; currentWin = getWindow(currentIFrame); currentIFrame = getFrameElement(currentWin); } } return rectToClientRect({ width, height, x: x3, y: y4 }); } function getWindowScrollBarX(element, rect) { const leftScroll = getNodeScroll(element).scrollLeft; if (!rect) { return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; } return rect.left + leftScroll; } function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) { if (ignoreScrollbarX === void 0) { ignoreScrollbarX = false; } const htmlRect = documentElement.getBoundingClientRect(); const x3 = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : ( // RTL <body> scrollbar. getWindowScrollBarX(documentElement, htmlRect) )); const y4 = htmlRect.top + scroll.scrollTop; return { x: x3, y: y4 }; } function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { let { elements, rect, offsetParent, strategy } = _ref; const isFixed = strategy === "fixed"; const documentElement = getDocumentElement(offsetParent); const topLayer = elements ? isTopLayer(elements.floating) : false; if (offsetParent === documentElement || topLayer && isFixed) { return rect; } let scroll = { scrollLeft: 0, scrollTop: 0 }; let scale = createCoords(1); const offsets = createCoords(0); const isOffsetParentAnElement = isHTMLElement(offsetParent); if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { scroll = getNodeScroll(offsetParent); } if (isHTMLElement(offsetParent)) { const offsetRect = getBoundingClientRect(offsetParent); scale = getScale(offsetParent); offsets.x = offsetRect.x + offsetParent.clientLeft; offsets.y = offsetRect.y + offsetParent.clientTop; } } const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0); return { width: rect.width * scale.x, height: rect.height * scale.y, x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y }; } function getClientRects(element) { return Array.from(element.getClientRects()); } function getDocumentRect(element) { const html = getDocumentElement(element); const scroll = getNodeScroll(element); const body = element.ownerDocument.body; const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); let x3 = -scroll.scrollLeft + getWindowScrollBarX(element); const y4 = -scroll.scrollTop; if (getComputedStyle2(body).direction === "rtl") { x3 += max(html.clientWidth, body.clientWidth) - width; } return { width, height, x: x3, y: y4 }; } function getViewportRect(element, strategy) { const win = getWindow(element); const html = getDocumentElement(element); const visualViewport = win.visualViewport; let width = html.clientWidth; let height = html.clientHeight; let x3 = 0; let y4 = 0; if (visualViewport) { width = visualViewport.width; height = visualViewport.height; const visualViewportBased = isWebKit(); if (!visualViewportBased || visualViewportBased && strategy === "fixed") { x3 = visualViewport.offsetLeft; y4 = visualViewport.offsetTop; } } return { width, height, x: x3, y: y4 }; } function getInnerBoundingClientRect(element, strategy) { const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); const top = clientRect.top + element.clientTop; const left = clientRect.left + element.clientLeft; const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); const width = element.clientWidth * scale.x; const height = element.clientHeight * scale.y; const x3 = left * scale.x; const y4 = top * scale.y; return { width, height, x: x3, y: y4 }; } function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { let rect; if (clippingAncestor === "viewport") { rect = getViewportRect(element, strategy); } else if (clippingAncestor === "document") { rect = getDocumentRect(getDocumentElement(element)); } else if (isElement(clippingAncestor)) { rect = getInnerBoundingClientRect(clippingAncestor, strategy); } else { const visualOffsets = getVisualOffsets(element); rect = { x: clippingAncestor.x - visualOffsets.x, y: clippingAncestor.y - visualOffsets.y, width: clippingAncestor.width, height: clippingAncestor.height }; } return rectToClientRect(rect); } function hasFixedPositionAncestor(element, stopNode) { const parentNode = getParentNode(element); if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { return false; } return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); } function getClippingElementAncestors(element, cache) { const cachedResult = cache.get(element); if (cachedResult) { return cachedResult; } let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); let currentContainingBlockComputedStyle = null; const elementIsFixed = getComputedStyle2(element).position === "fixed"; let currentNode = elementIsFixed ? getParentNode(element) : element; while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { const computedStyle = getComputedStyle2(currentNode); const currentNodeIsContaining = isContaini