import * as c from "react";
import { useLayoutEffect as Ie, useEffect as Oe, useRef as Fe } from "react";
import { getDocument as Q, isMouseLikePointerType as ue, contains as ee, getTarget as Se, isSafari as Le, activeElement as De } from "./floating-ui.react.utils.js";
import { j as Z } from "../../../../../../../_virtual/jsx-runtime.js";
import { isElement as X } from "../../../../../@floating-ui_utils@0.2.9/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js";
import { getOverflowAncestors as gt } from "../../../../../@floating-ui_utils@0.2.9/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js";
import { tabbable as he } from "../../../../../tabbable@6.2.0/node_modules/tabbable/dist/index.esm.js";
import * as Ae from "react-dom";
import { useFloating as Ne } from "../../../../../@floating-ui_react-dom@2.1.2_react-dom@18.3.0-canary-3d9b20132-20240124_react@18.3.0-ca_b5662bd1feec88595d2ecf6fbf867e98/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";
import { autoPlacement as pt, offset as bt } from "../../../../../@floating-ui_react-dom@2.1.2_react-dom@18.3.0-canary-3d9b20132-20240124_react@18.3.0-ca_b5662bd1feec88595d2ecf6fbf867e98/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";
function ut(t) {
  const e = c.useRef(void 0), o = c.useCallback((n) => {
    const u = t.map((r) => {
      if (r != null) {
        if (typeof r == "function") {
          const s = r, i = s(n);
          return typeof i == "function" ? i : () => {
            s(null);
          };
        }
        return r.current = n, () => {
          r.current = null;
        };
      }
    });
    return () => {
      u.forEach((r) => r?.());
    };
  }, t);
  return c.useMemo(() => t.every((n) => n == null) ? null : (n) => {
    e.current && (e.current(), e.current = void 0), n != null && (e.current = o(n));
  }, t);
}
const Re = {
  ...c
}, je = Re.useInsertionEffect, ke = je || ((t) => t());
function te(t) {
  const e = c.useRef(() => {
    if (process.env.NODE_ENV !== "production")
      throw new Error("Cannot call an event handler while rendering.");
  });
  return ke(() => {
    e.current = t;
  }), c.useCallback(function() {
    for (var o = arguments.length, n = new Array(o), u = 0; u < o; u++)
      n[u] = arguments[u];
    return e.current == null ? void 0 : e.current(...n);
  }, []);
}
var j = typeof document < "u" ? Ie : Oe;
let le = !1, Ye = 0;
const fe = () => (
  // Ensure the id is unique with multiple independent versions of Floating UI
  // on <React 18
  "floating-ui-" + Math.random().toString(36).slice(2, 6) + Ye++
);
function Xe() {
  const [t, e] = c.useState(() => le ? fe() : void 0);
  return j(() => {
    t == null && e(fe());
  }, []), c.useEffect(() => {
    le = !0;
  }, []), t;
}
const _e = Re.useId, Ee = _e || Xe;
let ce;
process.env.NODE_ENV !== "production" && (ce = /* @__PURE__ */ new Set());
function Be() {
  for (var t, e = arguments.length, o = new Array(e), n = 0; n < e; n++)
    o[n] = arguments[n];
  const u = "Floating UI: " + o.join(" ");
  if (!((t = ce) != null && t.has(u))) {
    var r;
    (r = ce) == null || r.add(u), console.error(u);
  }
}
function qe() {
  const t = /* @__PURE__ */ new Map();
  return {
    emit(e, o) {
      var n;
      (n = t.get(e)) == null || n.forEach((u) => u(o));
    },
    on(e, o) {
      t.set(e, [...t.get(e) || [], o]);
    },
    off(e, o) {
      var n;
      t.set(e, ((n = t.get(e)) == null ? void 0 : n.filter((u) => u !== o)) || []);
    }
  };
}
const He = /* @__PURE__ */ c.createContext(null), Ue = /* @__PURE__ */ c.createContext(null), xe = () => {
  var t;
  return ((t = c.useContext(He)) == null ? void 0 : t.id) || null;
}, Ce = () => c.useContext(Ue);
function ie(t) {
  return "data-floating-ui-" + t;
}
function A(t) {
  t.current !== -1 && (clearTimeout(t.current), t.current = -1);
}
function ne(t) {
  const e = Fe(t);
  return j(() => {
    e.current = t;
  }), e;
}
const ae = /* @__PURE__ */ ie("safe-polygon");
function oe(t, e, o) {
  return o && !ue(o) ? 0 : typeof t == "number" ? t : t?.[e];
}
function ct(t, e) {
  e === void 0 && (e = {});
  const {
    open: o,
    onOpenChange: n,
    dataRef: u,
    events: r,
    elements: s
  } = t, {
    enabled: i = !0,
    delay: m = 0,
    handleClose: g = null,
    mouseOnly: v = !1,
    restMs: E = 0,
    move: C = !0
  } = e, f = Ce(), T = xe(), a = ne(g), h = ne(m), w = ne(o), I = c.useRef(), P = c.useRef(-1), O = c.useRef(), L = c.useRef(-1), q = c.useRef(!0), H = c.useRef(!1), J = c.useRef(() => {
  }), _ = c.useRef(!1), k = c.useCallback(() => {
    var d;
    const R = (d = u.current.openEvent) == null ? void 0 : d.type;
    return R?.includes("mouse") && R !== "mousedown";
  }, [u]);
  c.useEffect(() => {
    if (!i) return;
    function d(R) {
      let {
        open: p
      } = R;
      p || (A(P), A(L), q.current = !0, _.current = !1);
    }
    return r.on("openchange", d), () => {
      r.off("openchange", d);
    };
  }, [i, r]), c.useEffect(() => {
    if (!i || !a.current || !o) return;
    function d(p) {
      k() && n(!1, p, "hover");
    }
    const R = Q(s.floating).documentElement;
    return R.addEventListener("mouseleave", d), () => {
      R.removeEventListener("mouseleave", d);
    };
  }, [s.floating, o, n, i, a, k]);
  const B = c.useCallback(function(d, R, p) {
    R === void 0 && (R = !0), p === void 0 && (p = "hover");
    const y = oe(h.current, "close", I.current);
    y && !O.current ? (A(P), P.current = window.setTimeout(() => n(!1, d, p), y)) : R && (A(P), n(!1, d, p));
  }, [h, n]), N = te(() => {
    J.current(), O.current = void 0;
  }), x = te(() => {
    if (H.current) {
      const d = Q(s.floating).body;
      d.style.pointerEvents = "", d.removeAttribute(ae), H.current = !1;
    }
  }), l = te(() => u.current.openEvent ? ["click", "mousedown"].includes(u.current.openEvent.type) : !1);
  c.useEffect(() => {
    if (!i) return;
    function d(b) {
      if (A(P), q.current = !1, v && !ue(I.current) || E > 0 && !oe(h.current, "open"))
        return;
      const F = oe(h.current, "open", I.current);
      F ? P.current = window.setTimeout(() => {
        w.current || n(!0, b, "hover");
      }, F) : o || n(!0, b, "hover");
    }
    function R(b) {
      if (l()) return;
      J.current();
      const F = Q(s.floating);
      if (A(L), _.current = !1, a.current && u.current.floatingContext) {
        o || A(P), O.current = a.current({
          ...u.current.floatingContext,
          tree: f,
          x: b.clientX,
          y: b.clientY,
          onClose() {
            x(), N(), l() || B(b, !0, "safe-polygon");
          }
        });
        const G = O.current;
        F.addEventListener("mousemove", G), J.current = () => {
          F.removeEventListener("mousemove", G);
        };
        return;
      }
      (I.current === "touch" ? !ee(s.floating, b.relatedTarget) : !0) && B(b);
    }
    function p(b) {
      l() || u.current.floatingContext && (a.current == null || a.current({
        ...u.current.floatingContext,
        tree: f,
        x: b.clientX,
        y: b.clientY,
        onClose() {
          x(), N(), l() || B(b);
        }
      })(b));
    }
    if (X(s.domReference)) {
      var y;
      const b = s.domReference;
      return o && b.addEventListener("mouseleave", p), (y = s.floating) == null || y.addEventListener("mouseleave", p), C && b.addEventListener("mousemove", d, {
        once: !0
      }), b.addEventListener("mouseenter", d), b.addEventListener("mouseleave", R), () => {
        var F;
        o && b.removeEventListener("mouseleave", p), (F = s.floating) == null || F.removeEventListener("mouseleave", p), C && b.removeEventListener("mousemove", d), b.removeEventListener("mouseenter", d), b.removeEventListener("mouseleave", R);
      };
    }
  }, [s, i, t, v, E, C, B, N, x, n, o, w, f, h, a, u, l]), j(() => {
    var d;
    if (i && o && (d = a.current) != null && d.__options.blockPointerEvents && k()) {
      H.current = !0;
      const p = s.floating;
      if (X(s.domReference) && p) {
        var R;
        const y = Q(s.floating).body;
        y.setAttribute(ae, "");
        const b = s.domReference, F = f == null || (R = f.nodesRef.current.find((U) => U.id === T)) == null || (R = R.context) == null ? void 0 : R.elements.floating;
        return F && (F.style.pointerEvents = ""), y.style.pointerEvents = "none", b.style.pointerEvents = "auto", p.style.pointerEvents = "auto", () => {
          y.style.pointerEvents = "", b.style.pointerEvents = "", p.style.pointerEvents = "";
        };
      }
    }
  }, [i, o, T, s, f, a, k]), j(() => {
    o || (I.current = void 0, _.current = !1, N(), x());
  }, [o, N, x]), c.useEffect(() => () => {
    N(), A(P), A(L), x();
  }, [i, s.domReference, N, x]);
  const Y = c.useMemo(() => {
    function d(R) {
      I.current = R.pointerType;
    }
    return {
      onPointerDown: d,
      onPointerEnter: d,
      onMouseMove(R) {
        const {
          nativeEvent: p
        } = R;
        function y() {
          !q.current && !w.current && n(!0, p, "hover");
        }
        v && !ue(I.current) || o || E === 0 || _.current && R.movementX ** 2 + R.movementY ** 2 < 2 || (A(L), I.current === "touch" ? y() : (_.current = !0, L.current = window.setTimeout(y, E)));
      }
    };
  }, [v, n, o, w, E]), D = c.useMemo(() => ({
    onMouseEnter() {
      A(P);
    },
    onMouseLeave(d) {
      l() || B(d.nativeEvent, !1);
    }
  }), [B, l]);
  return c.useMemo(() => i ? {
    reference: Y,
    floating: D
  } : {}, [i, Y, D]);
}
function Ge(t, e) {
  let o = t.filter((u) => {
    var r;
    return u.parentId === e && ((r = u.context) == null ? void 0 : r.open);
  }), n = o;
  for (; n.length; )
    n = t.filter((u) => {
      var r;
      return (r = n) == null ? void 0 : r.some((s) => {
        var i;
        return u.parentId === s.id && ((i = u.context) == null ? void 0 : i.open);
      });
    }), o = o.concat(n);
  return o;
}
const Pe = () => ({
  getShadowRoot: !0,
  displayCheck: (
    // JSDOM does not support the `tabbable` library. To solve this we can
    // check if `ResizeObserver` is a real function (not polyfilled), which
    // determines if the current environment is JSDOM-like.
    typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
  )
});
function ye(t, e) {
  const o = he(t, Pe());
  e === "prev" && o.reverse();
  const n = o.indexOf(De(Q(t)));
  return o.slice(n + 1)[0];
}
function Ve() {
  return ye(document.body, "next");
}
function We() {
  return ye(document.body, "prev");
}
function re(t, e) {
  const o = e || t.currentTarget, n = t.relatedTarget;
  return !n || !ee(o, n);
}
function ze(t) {
  he(t, Pe()).forEach((o) => {
    o.dataset.tabindex = o.getAttribute("tabindex") || "", o.setAttribute("tabindex", "-1");
  });
}
function de(t) {
  t.querySelectorAll("[data-tabindex]").forEach((o) => {
    const n = o.dataset.tabindex;
    delete o.dataset.tabindex, n ? o.setAttribute("tabindex", n) : o.removeAttribute("tabindex");
  });
}
const Te = {
  border: 0,
  clip: "rect(0 0 0 0)",
  height: "1px",
  margin: "-1px",
  overflow: "hidden",
  padding: 0,
  position: "fixed",
  whiteSpace: "nowrap",
  width: "1px",
  top: 0,
  left: 0
}, me = /* @__PURE__ */ c.forwardRef(function(e, o) {
  const [n, u] = c.useState();
  j(() => {
    Le() && u("button");
  }, []);
  const r = {
    ref: o,
    tabIndex: 0,
    // Role is only for VoiceOver
    role: n,
    "aria-hidden": n ? void 0 : !0,
    [ie("focus-guard")]: "",
    style: Te
  };
  return /* @__PURE__ */ Z.jsx("span", {
    ...e,
    ...r
  });
}), Me = /* @__PURE__ */ c.createContext(null), ge = /* @__PURE__ */ ie("portal");
function $e(t) {
  t === void 0 && (t = {});
  const {
    id: e,
    root: o
  } = t, n = Ee(), u = Je(), [r, s] = c.useState(null), i = c.useRef(null);
  return j(() => () => {
    r?.remove(), queueMicrotask(() => {
      i.current = null;
    });
  }, [r]), j(() => {
    if (!n || i.current) return;
    const m = e ? document.getElementById(e) : null;
    if (!m) return;
    const g = document.createElement("div");
    g.id = n, g.setAttribute(ge, ""), m.appendChild(g), i.current = g, s(g);
  }, [e, n]), j(() => {
    if (o === null || !n || i.current) return;
    let m = o || u?.portalNode;
    m && !X(m) && (m = m.current), m = m || document.body;
    let g = null;
    e && (g = document.createElement("div"), g.id = e, m.appendChild(g));
    const v = document.createElement("div");
    v.id = n, v.setAttribute(ge, ""), m = g || m, m.appendChild(v), i.current = v, s(v);
  }, [e, o, n, u]), r;
}
function it(t) {
  const {
    children: e,
    id: o,
    root: n,
    preserveTabOrder: u = !0
  } = t, r = $e({
    id: o,
    root: n
  }), [s, i] = c.useState(null), m = c.useRef(null), g = c.useRef(null), v = c.useRef(null), E = c.useRef(null), C = s?.modal, f = s?.open, T = (
    // The FocusManager and therefore floating element are currently open/
    // rendered.
    !!s && // Guards are only for non-modal focus management.
    !s.modal && // Don't render if unmount is transitioning.
    s.open && u && !!(n || r)
  );
  return c.useEffect(() => {
    if (!r || !u || C)
      return;
    function a(h) {
      r && re(h) && (h.type === "focusin" ? de : ze)(r);
    }
    return r.addEventListener("focusin", a, !0), r.addEventListener("focusout", a, !0), () => {
      r.removeEventListener("focusin", a, !0), r.removeEventListener("focusout", a, !0);
    };
  }, [r, u, C]), c.useEffect(() => {
    r && (f || de(r));
  }, [f, r]), /* @__PURE__ */ Z.jsxs(Me.Provider, {
    value: c.useMemo(() => ({
      preserveTabOrder: u,
      beforeOutsideRef: m,
      afterOutsideRef: g,
      beforeInsideRef: v,
      afterInsideRef: E,
      portalNode: r,
      setFocusManagerState: i
    }), [u, r]),
    children: [T && r && /* @__PURE__ */ Z.jsx(me, {
      "data-type": "outside",
      ref: m,
      onFocus: (a) => {
        if (re(a, r)) {
          var h;
          (h = v.current) == null || h.focus();
        } else {
          const w = We() || s?.domReference;
          w?.focus();
        }
      }
    }), T && r && /* @__PURE__ */ Z.jsx("span", {
      "aria-owns": r.id,
      style: Te
    }), r && /* @__PURE__ */ Ae.createPortal(e, r), T && r && /* @__PURE__ */ Z.jsx(me, {
      "data-type": "outside",
      ref: g,
      onFocus: (a) => {
        if (re(a, r)) {
          var h;
          (h = E.current) == null || h.focus();
        } else {
          const w = Ve() || s?.domReference;
          w?.focus(), s?.closeOnFocusOut && s?.onOpenChange(!1, a.nativeEvent, "focus-out");
        }
      }
    })]
  });
}
const Je = () => c.useContext(Me), Ke = "data-floating-ui-focusable";
function Qe(t) {
  const {
    open: e = !1,
    onOpenChange: o,
    elements: n
  } = t, u = Ee(), r = c.useRef({}), [s] = c.useState(() => qe()), i = xe() != null;
  if (process.env.NODE_ENV !== "production") {
    const f = n.reference;
    f && !X(f) && Be("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
  }
  const [m, g] = c.useState(n.reference), v = te((f, T, a) => {
    r.current.openEvent = f ? T : void 0, s.emit("openchange", {
      open: f,
      event: T,
      reason: a,
      nested: i
    }), o?.(f, T, a);
  }), E = c.useMemo(() => ({
    setPositionReference: g
  }), []), C = c.useMemo(() => ({
    reference: m || n.reference || null,
    floating: n.floating || null,
    domReference: n.reference
  }), [m, n.reference, n.floating]);
  return c.useMemo(() => ({
    dataRef: r,
    open: e,
    onOpenChange: v,
    elements: C,
    events: s,
    floatingId: u,
    refs: E
  }), [e, v, C, s, u, E]);
}
function lt(t) {
  t === void 0 && (t = {});
  const {
    nodeId: e
  } = t, o = Qe({
    ...t,
    elements: {
      reference: null,
      floating: null,
      ...t.elements
    }
  }), n = t.rootContext || o, u = n.elements, [r, s] = c.useState(null), [i, m] = c.useState(null), v = u?.domReference || r, E = c.useRef(null), C = Ce();
  j(() => {
    v && (E.current = v);
  }, [v]);
  const f = Ne({
    ...t,
    elements: {
      ...u,
      ...i && {
        reference: i
      }
    }
  }), T = c.useCallback((P) => {
    const O = X(P) ? {
      getBoundingClientRect: () => P.getBoundingClientRect(),
      contextElement: P
    } : P;
    m(O), f.refs.setReference(O);
  }, [f.refs]), a = c.useCallback((P) => {
    (X(P) || P === null) && (E.current = P, s(P)), (X(f.refs.reference.current) || f.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
    // `null` to support `positionReference` + an unstable `reference`
    // callback ref.
    P !== null && !X(P)) && f.refs.setReference(P);
  }, [f.refs]), h = c.useMemo(() => ({
    ...f.refs,
    setReference: a,
    setPositionReference: T,
    domReference: E
  }), [f.refs, a, T]), w = c.useMemo(() => ({
    ...f.elements,
    domReference: v
  }), [f.elements, v]), I = c.useMemo(() => ({
    ...f,
    ...n,
    refs: h,
    elements: w,
    nodeId: e
  }), [f, h, w, e, n]);
  return j(() => {
    n.dataRef.current.floatingContext = I;
    const P = C?.nodesRef.current.find((O) => O.id === e);
    P && (P.context = I);
  }), c.useMemo(() => ({
    ...f,
    context: I,
    refs: h,
    elements: w
  }), [f, h, w, I]);
}
const ve = "active", pe = "selected";
function se(t, e, o) {
  const n = /* @__PURE__ */ new Map(), u = o === "item";
  let r = t;
  if (u && t) {
    const {
      [ve]: s,
      [pe]: i,
      ...m
    } = t;
    r = m;
  }
  return {
    ...o === "floating" && {
      tabIndex: -1,
      [Ke]: ""
    },
    ...r,
    ...e.map((s) => {
      const i = s ? s[o] : null;
      return typeof i == "function" ? t ? i(t) : null : i;
    }).concat(t).reduce((s, i) => (i && Object.entries(i).forEach((m) => {
      let [g, v] = m;
      if (!(u && [ve, pe].includes(g)))
        if (g.indexOf("on") === 0) {
          if (n.has(g) || n.set(g, []), typeof v == "function") {
            var E;
            (E = n.get(g)) == null || E.push(v), s[g] = function() {
              for (var C, f = arguments.length, T = new Array(f), a = 0; a < f; a++)
                T[a] = arguments[a];
              return (C = n.get(g)) == null ? void 0 : C.map((h) => h(...T)).find((h) => h !== void 0);
            };
          }
        } else
          s[g] = v;
    }), s), {})
  };
}
function ft(t) {
  t === void 0 && (t = []);
  const e = t.map((i) => i?.reference), o = t.map((i) => i?.floating), n = t.map((i) => i?.item), u = c.useCallback(
    (i) => se(i, t, "reference"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    e
  ), r = c.useCallback(
    (i) => se(i, t, "floating"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    o
  ), s = c.useCallback(
    (i) => se(i, t, "item"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    n
  );
  return c.useMemo(() => ({
    getReferenceProps: u,
    getFloatingProps: r,
    getItemProps: s
  }), [u, r, s]);
}
function be(t, e) {
  const [o, n] = t;
  let u = !1;
  const r = e.length;
  for (let s = 0, i = r - 1; s < r; i = s++) {
    const [m, g] = e[s] || [0, 0], [v, E] = e[i] || [0, 0];
    g >= n != E >= n && o <= (v - m) * (n - g) / (E - g) + m && (u = !u);
  }
  return u;
}
function Ze(t, e) {
  return t[0] >= e.x && t[0] <= e.x + e.width && t[1] >= e.y && t[1] <= e.y + e.height;
}
function at(t) {
  t === void 0 && (t = {});
  const {
    buffer: e = 0.5,
    blockPointerEvents: o = !1,
    requireIntent: n = !0
  } = t;
  let u, r = !1, s = null, i = null, m = performance.now();
  function g(E, C) {
    const f = performance.now(), T = f - m;
    if (s === null || i === null || T === 0)
      return s = E, i = C, m = f, null;
    const a = E - s, h = C - i, I = Math.sqrt(a * a + h * h) / T;
    return s = E, i = C, m = f, I;
  }
  const v = (E) => {
    let {
      x: C,
      y: f,
      placement: T,
      elements: a,
      onClose: h,
      nodeId: w,
      tree: I
    } = E;
    return function(O) {
      function L() {
        clearTimeout(u), h();
      }
      if (clearTimeout(u), !a.domReference || !a.floating || T == null || C == null || f == null)
        return;
      const {
        clientX: q,
        clientY: H
      } = O, J = [q, H], _ = Se(O), k = O.type === "mouseleave", B = ee(a.floating, _), N = ee(a.domReference, _), x = a.domReference.getBoundingClientRect(), l = a.floating.getBoundingClientRect(), Y = T.split("-")[0], D = C > l.right - l.width / 2, d = f > l.bottom - l.height / 2, R = Ze(J, x), p = l.width > x.width, y = l.height > x.height, b = (p ? x : l).left, F = (p ? x : l).right, U = (y ? x : l).top, G = (y ? x : l).bottom;
      if (B && (r = !0, !k))
        return;
      if (N && (r = !1), N && !k) {
        r = !0;
        return;
      }
      if (k && X(O.relatedTarget) && ee(a.floating, O.relatedTarget) || I && Ge(I.nodesRef.current, w).some((z) => {
        let {
          context: M
        } = z;
        return M?.open;
      }))
        return;
      if (Y === "top" && f >= x.bottom - 1 || Y === "bottom" && f <= x.top + 1 || Y === "left" && C >= x.right - 1 || Y === "right" && C <= x.left + 1)
        return L();
      let K = [];
      switch (Y) {
        case "top":
          K = [[b, x.top + 1], [b, l.bottom - 1], [F, l.bottom - 1], [F, x.top + 1]];
          break;
        case "bottom":
          K = [[b, l.top + 1], [b, x.bottom - 1], [F, x.bottom - 1], [F, l.top + 1]];
          break;
        case "left":
          K = [[l.right - 1, G], [l.right - 1, U], [x.left + 1, U], [x.left + 1, G]];
          break;
        case "right":
          K = [[x.right - 1, G], [x.right - 1, U], [l.left + 1, U], [l.left + 1, G]];
          break;
      }
      function we(z) {
        let [M, S] = z;
        switch (Y) {
          case "top": {
            const V = [p ? M + e / 2 : D ? M + e * 4 : M - e * 4, S + e + 1], W = [p ? M - e / 2 : D ? M + e * 4 : M - e * 4, S + e + 1], $ = [[l.left, D || p ? l.bottom - e : l.top], [l.right, D ? p ? l.bottom - e : l.top : l.bottom - e]];
            return [V, W, ...$];
          }
          case "bottom": {
            const V = [p ? M + e / 2 : D ? M + e * 4 : M - e * 4, S - e], W = [p ? M - e / 2 : D ? M + e * 4 : M - e * 4, S - e], $ = [[l.left, D || p ? l.top + e : l.bottom], [l.right, D ? p ? l.top + e : l.bottom : l.top + e]];
            return [V, W, ...$];
          }
          case "left": {
            const V = [M + e + 1, y ? S + e / 2 : d ? S + e * 4 : S - e * 4], W = [M + e + 1, y ? S - e / 2 : d ? S + e * 4 : S - e * 4];
            return [...[[d || y ? l.right - e : l.left, l.top], [d ? y ? l.right - e : l.left : l.right - e, l.bottom]], V, W];
          }
          case "right": {
            const V = [M - e, y ? S + e / 2 : d ? S + e * 4 : S - e * 4], W = [M - e, y ? S - e / 2 : d ? S + e * 4 : S - e * 4], $ = [[d || y ? l.left + e : l.right, l.top], [d ? y ? l.left + e : l.right : l.left + e, l.bottom]];
            return [V, W, ...$];
          }
        }
      }
      if (!be([q, H], K)) {
        if (r && !R)
          return L();
        if (!k && n) {
          const z = g(O.clientX, O.clientY);
          if (z !== null && z < 0.1)
            return L();
        }
        be([q, H], we([C, f])) ? !r && n && (u = window.setTimeout(L, 40)) : L();
      }
    };
  };
  return v.__options = {
    blockPointerEvents: o
  }, v;
}
export {
  it as FloatingPortal,
  pt as autoPlacement,
  gt as getOverflowAncestors,
  bt as offset,
  at as safePolygon,
  lt as useFloating,
  xe as useFloatingParentNodeId,
  $e as useFloatingPortalNode,
  Qe as useFloatingRootContext,
  Ce as useFloatingTree,
  ct as useHover,
  Ee as useId,
  ft as useInteractions,
  ut as useMergeRefs
};
//# sourceMappingURL=floating-ui.react.js.map
