import { P as St } from "./plus-base-10eea8a6.mjs";
const Pt = ["top", "right", "bottom", "left"], z = Math.min, W = Math.max, G = Math.round, D = (t) => ({
  x: t,
  y: t
}), kt = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
}, Dt = {
  start: "end",
  end: "start"
};
function ot(t, e, o) {
  return W(t, z(e, o));
}
function _(t, e) {
  return typeof t == "function" ? t(e) : t;
}
function V(t) {
  return t.split("-")[0];
}
function K(t) {
  return t.split("-")[1];
}
function gt(t) {
  return t === "x" ? "y" : "x";
}
function rt(t) {
  return t === "y" ? "height" : "width";
}
function tt(t) {
  return ["top", "bottom"].includes(V(t)) ? "y" : "x";
}
function ct(t) {
  return gt(tt(t));
}
function Bt(t, e, o) {
  o === void 0 && (o = !1);
  const n = K(t), r = ct(t), s = rt(r);
  let i = r === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
  return e.reference[s] > e.floating[s] && (i = J(i)), [i, J(i)];
}
function Nt(t) {
  const e = J(t);
  return [it(t), e, it(e)];
}
function it(t) {
  return t.replace(/start|end/g, (e) => Dt[e]);
}
function Ft(t, e, o) {
  const n = ["left", "right"], r = ["right", "left"], s = ["top", "bottom"], i = ["bottom", "top"];
  switch (t) {
    case "top":
    case "bottom":
      return o ? e ? r : n : e ? n : r;
    case "left":
    case "right":
      return e ? s : i;
    default:
      return [];
  }
}
function Ht(t, e, o, n) {
  const r = K(t);
  let s = Ft(V(t), o === "start", n);
  return r && (s = s.map((i) => i + "-" + r), e && (s = s.concat(s.map(it)))), s;
}
function J(t) {
  return t.replace(/left|right|bottom|top/g, (e) => kt[e]);
}
function Vt(t) {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    ...t
  };
}
function wt(t) {
  return typeof t != "number" ? Vt(t) : {
    top: t,
    right: t,
    bottom: t,
    left: t
  };
}
function Q(t) {
  return {
    ...t,
    top: t.y,
    left: t.x,
    right: t.x + t.width,
    bottom: t.y + t.height
  };
}
function at(t, e, o) {
  let {
    reference: n,
    floating: r
  } = t;
  const s = tt(e), i = ct(e), c = rt(i), l = V(e), f = s === "y", p = n.x + n.width / 2 - r.width / 2, a = n.y + n.height / 2 - r.height / 2, m = n[c] / 2 - r[c] / 2;
  let u;
  switch (l) {
    case "top":
      u = {
        x: p,
        y: n.y - r.height
      };
      break;
    case "bottom":
      u = {
        x: p,
        y: n.y + n.height
      };
      break;
    case "right":
      u = {
        x: n.x + n.width,
        y: a
      };
      break;
    case "left":
      u = {
        x: n.x - r.width,
        y: a
      };
      break;
    default:
      u = {
        x: n.x,
        y: n.y
      };
  }
  switch (K(e)) {
    case "start":
      u[i] -= m * (o && f ? -1 : 1);
      break;
    case "end":
      u[i] += m * (o && f ? -1 : 1);
      break;
  }
  return u;
}
const Wt = async (t, e, o) => {
  const {
    placement: n = "bottom",
    strategy: r = "absolute",
    middleware: s = [],
    platform: i
  } = o, c = s.filter(Boolean), l = await (i.isRTL == null ? void 0 : i.isRTL(e));
  let f = await i.getElementRects({
    reference: t,
    floating: e,
    strategy: r
  }), {
    x: p,
    y: a
  } = at(f, n, l), m = n, u = {}, d = 0;
  for (let h = 0; h < c.length; h++) {
    const {
      name: g,
      fn: w
    } = c[h], {
      x,
      y,
      data: R,
      reset: b
    } = await w({
      x: p,
      y: a,
      initialPlacement: n,
      placement: m,
      strategy: r,
      middlewareData: u,
      rects: f,
      platform: i,
      elements: {
        reference: t,
        floating: e
      }
    });
    p = x ?? p, a = y ?? a, u = {
      ...u,
      [g]: {
        ...u[g],
        ...R
      }
    }, b && d <= 50 && (d++, typeof b == "object" && (b.placement && (m = b.placement), b.rects && (f = b.rects === !0 ? await i.getElementRects({
      reference: t,
      floating: e,
      strategy: r
    }) : b.rects), {
      x: p,
      y: a
    } = at(f, m, l)), h = -1);
  }
  return {
    x: p,
    y: a,
    placement: m,
    strategy: r,
    middlewareData: u
  };
};
async function Z(t, e) {
  var o;
  e === void 0 && (e = {});
  const {
    x: n,
    y: r,
    platform: s,
    rects: i,
    elements: c,
    strategy: l
  } = t, {
    boundary: f = "clippingAncestors",
    rootBoundary: p = "viewport",
    elementContext: a = "floating",
    altBoundary: m = !1,
    padding: u = 0
  } = _(e, t), d = wt(u), g = c[m ? a === "floating" ? "reference" : "floating" : a], w = Q(await s.getClippingRect({
    element: (o = await (s.isElement == null ? void 0 : s.isElement(g))) == null || o ? g : g.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
    boundary: f,
    rootBoundary: p,
    strategy: l
  })), x = a === "floating" ? {
    ...i.floating,
    x: n,
    y: r
  } : i.reference, y = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), R = await (s.isElement == null ? void 0 : s.isElement(y)) ? await (s.getScale == null ? void 0 : s.getScale(y)) || {
    x: 1,
    y: 1
  } : {
    x: 1,
    y: 1
  }, b = Q(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
    elements: c,
    rect: x,
    offsetParent: y,
    strategy: l
  }) : x);
  return {
    top: (w.top - b.top + d.top) / R.y,
    bottom: (b.bottom - w.bottom + d.bottom) / R.y,
    left: (w.left - b.left + d.left) / R.x,
    right: (b.right - w.right + d.right) / R.x
  };
}
const $t = (t) => ({
  name: "arrow",
  options: t,
  async fn(e) {
    const {
      x: o,
      y: n,
      placement: r,
      rects: s,
      platform: i,
      elements: c,
      middlewareData: l
    } = e, {
      element: f,
      padding: p = 0
    } = _(t, e) || {};
    if (f == null)
      return {};
    const a = wt(p), m = {
      x: o,
      y: n
    }, u = ct(r), d = rt(u), h = await i.getDimensions(f), g = u === "y", w = g ? "top" : "left", x = g ? "bottom" : "right", y = g ? "clientHeight" : "clientWidth", R = s.reference[d] + s.reference[u] - m[u] - s.floating[d], b = m[u] - s.reference[u], F = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(f));
    let T = F ? F[y] : 0;
    (!T || !await (i.isElement == null ? void 0 : i.isElement(F))) && (T = c.floating[y] || s.floating[d]);
    const H = R / 2 - b / 2, j = T / 2 - h[d] / 2 - 1, X = z(a[w], j), Y = z(a[x], j), O = X, I = T - h[d] - Y, v = T / 2 - h[d] / 2 + H, L = ot(O, v, I), E = !l.arrow && K(r) != null && v !== L && s.reference[d] / 2 - (v < O ? X : Y) - h[d] / 2 < 0, P = E ? v < O ? v - O : v - I : 0;
    return {
      [u]: m[u] + P,
      data: {
        [u]: L,
        centerOffset: v - L - P,
        ...E && {
          alignmentOffset: P
        }
      },
      reset: E
    };
  }
}), Mt = function(t) {
  return t === void 0 && (t = {}), {
    name: "flip",
    options: t,
    async fn(e) {
      var o, n;
      const {
        placement: r,
        middlewareData: s,
        rects: i,
        initialPlacement: c,
        platform: l,
        elements: f
      } = e, {
        mainAxis: p = !0,
        crossAxis: a = !0,
        fallbackPlacements: m,
        fallbackStrategy: u = "bestFit",
        fallbackAxisSideDirection: d = "none",
        flipAlignment: h = !0,
        ...g
      } = _(t, e);
      if ((o = s.arrow) != null && o.alignmentOffset)
        return {};
      const w = V(r), x = V(c) === c, y = await (l.isRTL == null ? void 0 : l.isRTL(f.floating)), R = m || (x || !h ? [J(c)] : Nt(c));
      !m && d !== "none" && R.push(...Ht(c, h, d, y));
      const b = [c, ...R], F = await Z(e, g), T = [];
      let H = ((n = s.flip) == null ? void 0 : n.overflows) || [];
      if (p && T.push(F[w]), a) {
        const O = Bt(r, i, y);
        T.push(F[O[0]], F[O[1]]);
      }
      if (H = [...H, {
        placement: r,
        overflows: T
      }], !T.every((O) => O <= 0)) {
        var j, X;
        const O = (((j = s.flip) == null ? void 0 : j.index) || 0) + 1, I = b[O];
        if (I)
          return {
            data: {
              index: O,
              overflows: H
            },
            reset: {
              placement: I
            }
          };
        let v = (X = H.filter((L) => L.overflows[0] <= 0).sort((L, E) => L.overflows[1] - E.overflows[1])[0]) == null ? void 0 : X.placement;
        if (!v)
          switch (u) {
            case "bestFit": {
              var Y;
              const L = (Y = H.map((E) => [E.placement, E.overflows.filter((P) => P > 0).reduce((P, Et) => P + Et, 0)]).sort((E, P) => E[1] - P[1])[0]) == null ? void 0 : Y[0];
              L && (v = L);
              break;
            }
            case "initialPlacement":
              v = c;
              break;
          }
        if (r !== v)
          return {
            reset: {
              placement: v
            }
          };
      }
      return {};
    }
  };
};
function ut(t, e) {
  return {
    top: t.top - e.height,
    right: t.right - e.width,
    bottom: t.bottom - e.height,
    left: t.left - e.width
  };
}
function dt(t) {
  return Pt.some((e) => t[e] >= 0);
}
const _t = function(t) {
  return t === void 0 && (t = {}), {
    name: "hide",
    options: t,
    async fn(e) {
      const {
        rects: o
      } = e, {
        strategy: n = "referenceHidden",
        ...r
      } = _(t, e);
      switch (n) {
        case "referenceHidden": {
          const s = await Z(e, {
            ...r,
            elementContext: "reference"
          }), i = ut(s, o.reference);
          return {
            data: {
              referenceHiddenOffsets: i,
              referenceHidden: dt(i)
            }
          };
        }
        case "escaped": {
          const s = await Z(e, {
            ...r,
            altBoundary: !0
          }), i = ut(s, o.floating);
          return {
            data: {
              escapedOffsets: i,
              escaped: dt(i)
            }
          };
        }
        default:
          return {};
      }
    }
  };
};
async function jt(t, e) {
  const {
    placement: o,
    platform: n,
    elements: r
  } = t, s = await (n.isRTL == null ? void 0 : n.isRTL(r.floating)), i = V(o), c = K(o), l = tt(o) === "y", f = ["left", "top"].includes(i) ? -1 : 1, p = s && l ? -1 : 1, a = _(e, t);
  let {
    mainAxis: m,
    crossAxis: u,
    alignmentAxis: d
  } = typeof a == "number" ? {
    mainAxis: a,
    crossAxis: 0,
    alignmentAxis: null
  } : {
    mainAxis: 0,
    crossAxis: 0,
    alignmentAxis: null,
    ...a
  };
  return c && typeof d == "number" && (u = c === "end" ? d * -1 : d), l ? {
    x: u * p,
    y: m * f
  } : {
    x: m * f,
    y: u * p
  };
}
const Xt = function(t) {
  return t === void 0 && (t = 0), {
    name: "offset",
    options: t,
    async fn(e) {
      var o, n;
      const {
        x: r,
        y: s,
        placement: i,
        middlewareData: c
      } = e, l = await jt(e, t);
      return i === ((o = c.offset) == null ? void 0 : o.placement) && (n = c.arrow) != null && n.alignmentOffset ? {} : {
        x: r + l.x,
        y: s + l.y,
        data: {
          ...l,
          placement: i
        }
      };
    }
  };
}, Yt = function(t) {
  return t === void 0 && (t = {}), {
    name: "shift",
    options: t,
    async fn(e) {
      const {
        x: o,
        y: n,
        placement: r
      } = e, {
        mainAxis: s = !0,
        crossAxis: i = !1,
        limiter: c = {
          fn: (g) => {
            let {
              x: w,
              y: x
            } = g;
            return {
              x: w,
              y: x
            };
          }
        },
        ...l
      } = _(t, e), f = {
        x: o,
        y: n
      }, p = await Z(e, l), a = tt(V(r)), m = gt(a);
      let u = f[m], d = f[a];
      if (s) {
        const g = m === "y" ? "top" : "left", w = m === "y" ? "bottom" : "right", x = u + p[g], y = u - p[w];
        u = ot(x, u, y);
      }
      if (i) {
        const g = a === "y" ? "top" : "left", w = a === "y" ? "bottom" : "right", x = d + p[g], y = d - p[w];
        d = ot(x, d, y);
      }
      const h = c.fn({
        ...e,
        [m]: u,
        [a]: d
      });
      return {
        ...h,
        data: {
          x: h.x - o,
          y: h.y - n
        }
      };
    }
  };
};
function B(t) {
  return yt(t) ? (t.nodeName || "").toLowerCase() : "#document";
}
function A(t) {
  var e;
  return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
}
function N(t) {
  var e;
  return (e = (yt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
}
function yt(t) {
  return t instanceof Node || t instanceof A(t).Node;
}
function k(t) {
  return t instanceof Element || t instanceof A(t).Element;
}
function S(t) {
  return t instanceof HTMLElement || t instanceof A(t).HTMLElement;
}
function pt(t) {
  return typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof A(t).ShadowRoot;
}
function U(t) {
  const {
    overflow: e,
    overflowX: o,
    overflowY: n,
    display: r
  } = C(t);
  return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && !["inline", "contents"].includes(r);
}
function It(t) {
  return ["table", "td", "th"].includes(B(t));
}
function lt(t) {
  const e = ft(), o = C(t);
  return o.transform !== "none" || o.perspective !== "none" || (o.containerType ? o.containerType !== "normal" : !1) || !e && (o.backdropFilter ? o.backdropFilter !== "none" : !1) || !e && (o.filter ? o.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((n) => (o.willChange || "").includes(n)) || ["paint", "layout", "strict", "content"].some((n) => (o.contain || "").includes(n));
}
function xt(t) {
  let e = M(t);
  for (; S(e) && !et(e); ) {
    if (lt(e))
      return e;
    e = M(e);
  }
  return null;
}
function ft() {
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
function et(t) {
  return ["html", "body", "#document"].includes(B(t));
}
function C(t) {
  return A(t).getComputedStyle(t);
}
function nt(t) {
  return k(t) ? {
    scrollLeft: t.scrollLeft,
    scrollTop: t.scrollTop
  } : {
    scrollLeft: t.pageXOffset,
    scrollTop: t.pageYOffset
  };
}
function M(t) {
  if (B(t) === "html")
    return t;
  const e = (
    // Step into the shadow DOM of the parent of a slotted node.
    t.assignedSlot || // DOM Element detected.
    t.parentNode || // ShadowRoot detected.
    pt(t) && t.host || // Fallback.
    N(t)
  );
  return pt(e) ? e.host : e;
}
function bt(t) {
  const e = M(t);
  return et(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : S(e) && U(e) ? e : bt(e);
}
function st(t, e, o) {
  var n;
  e === void 0 && (e = []), o === void 0 && (o = !0);
  const r = bt(t), s = r === ((n = t.ownerDocument) == null ? void 0 : n.body), i = A(r);
  return s ? e.concat(i, i.visualViewport || [], U(r) ? r : [], i.frameElement && o ? st(i.frameElement) : []) : e.concat(r, st(r, [], o));
}
function vt(t) {
  const e = C(t);
  let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
  const r = S(t), s = r ? t.offsetWidth : o, i = r ? t.offsetHeight : n, c = G(o) !== s || G(n) !== i;
  return c && (o = s, n = i), {
    width: o,
    height: n,
    $: c
  };
}
function At(t) {
  return k(t) ? t : t.contextElement;
}
function $(t) {
  const e = At(t);
  if (!S(e))
    return D(1);
  const o = e.getBoundingClientRect(), {
    width: n,
    height: r,
    $: s
  } = vt(e);
  let i = (s ? G(o.width) : o.width) / n, c = (s ? G(o.height) : o.height) / r;
  return (!i || !Number.isFinite(i)) && (i = 1), (!c || !Number.isFinite(c)) && (c = 1), {
    x: i,
    y: c
  };
}
const zt = /* @__PURE__ */ D(0);
function Ot(t) {
  const e = A(t);
  return !ft() || !e.visualViewport ? zt : {
    x: e.visualViewport.offsetLeft,
    y: e.visualViewport.offsetTop
  };
}
function qt(t, e, o) {
  return e === void 0 && (e = !1), !o || e && o !== A(t) ? !1 : e;
}
function q(t, e, o, n) {
  e === void 0 && (e = !1), o === void 0 && (o = !1);
  const r = t.getBoundingClientRect(), s = At(t);
  let i = D(1);
  e && (n ? k(n) && (i = $(n)) : i = $(t));
  const c = qt(s, o, n) ? Ot(s) : D(0);
  let l = (r.left + c.x) / i.x, f = (r.top + c.y) / i.y, p = r.width / i.x, a = r.height / i.y;
  if (s) {
    const m = A(s), u = n && k(n) ? A(n) : n;
    let d = m.frameElement;
    for (; d && n && u !== m; ) {
      const h = $(d), g = d.getBoundingClientRect(), w = C(d), x = g.left + (d.clientLeft + parseFloat(w.paddingLeft)) * h.x, y = g.top + (d.clientTop + parseFloat(w.paddingTop)) * h.y;
      l *= h.x, f *= h.y, p *= h.x, a *= h.y, l += x, f += y, d = A(d).frameElement;
    }
  }
  return Q({
    width: p,
    height: a,
    x: l,
    y: f
  });
}
const Kt = [":popover-open", ":modal"];
function Ct(t) {
  let e = !1, o = 0, n = 0;
  function r(s) {
    try {
      e = e || t.matches(s);
    } catch {
    }
  }
  if (Kt.forEach((s) => {
    r(s);
  }), e) {
    const s = xt(t);
    if (s) {
      const i = s.getBoundingClientRect();
      o = i.x, n = i.y;
    }
  }
  return [e, o, n];
}
function Ut(t) {
  let {
    elements: e,
    rect: o,
    offsetParent: n,
    strategy: r
  } = t;
  const s = N(n), [i] = e ? Ct(e.floating) : [!1];
  if (n === s || i)
    return o;
  let c = {
    scrollLeft: 0,
    scrollTop: 0
  }, l = D(1);
  const f = D(0), p = S(n);
  if ((p || !p && r !== "fixed") && ((B(n) !== "body" || U(s)) && (c = nt(n)), S(n))) {
    const a = q(n);
    l = $(n), f.x = a.x + n.clientLeft, f.y = a.y + n.clientTop;
  }
  return {
    width: o.width * l.x,
    height: o.height * l.y,
    x: o.x * l.x - c.scrollLeft * l.x + f.x,
    y: o.y * l.y - c.scrollTop * l.y + f.y
  };
}
function Gt(t) {
  return Array.from(t.getClientRects());
}
function Rt(t) {
  return q(N(t)).left + nt(t).scrollLeft;
}
function Jt(t) {
  const e = N(t), o = nt(t), n = t.ownerDocument.body, r = W(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), s = W(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
  let i = -o.scrollLeft + Rt(t);
  const c = -o.scrollTop;
  return C(n).direction === "rtl" && (i += W(e.clientWidth, n.clientWidth) - r), {
    width: r,
    height: s,
    x: i,
    y: c
  };
}
function Qt(t, e) {
  const o = A(t), n = N(t), r = o.visualViewport;
  let s = n.clientWidth, i = n.clientHeight, c = 0, l = 0;
  if (r) {
    s = r.width, i = r.height;
    const f = ft();
    (!f || f && e === "fixed") && (c = r.offsetLeft, l = r.offsetTop);
  }
  return {
    width: s,
    height: i,
    x: c,
    y: l
  };
}
function Zt(t, e) {
  const o = q(t, !0, e === "fixed"), n = o.top + t.clientTop, r = o.left + t.clientLeft, s = S(t) ? $(t) : D(1), i = t.clientWidth * s.x, c = t.clientHeight * s.y, l = r * s.x, f = n * s.y;
  return {
    width: i,
    height: c,
    x: l,
    y: f
  };
}
function mt(t, e, o) {
  let n;
  if (e === "viewport")
    n = Qt(t, o);
  else if (e === "document")
    n = Jt(N(t));
  else if (k(e))
    n = Zt(e, o);
  else {
    const r = Ot(t);
    n = {
      ...e,
      x: e.x - r.x,
      y: e.y - r.y
    };
  }
  return Q(n);
}
function Tt(t, e) {
  const o = M(t);
  return o === e || !k(o) || et(o) ? !1 : C(o).position === "fixed" || Tt(o, e);
}
function te(t, e) {
  const o = e.get(t);
  if (o)
    return o;
  let n = st(t, [], !1).filter((c) => k(c) && B(c) !== "body"), r = null;
  const s = C(t).position === "fixed";
  let i = s ? M(t) : t;
  for (; k(i) && !et(i); ) {
    const c = C(i), l = lt(i);
    !l && c.position === "fixed" && (r = null), (s ? !l && !r : !l && c.position === "static" && !!r && ["absolute", "fixed"].includes(r.position) || U(i) && !l && Tt(t, i)) ? n = n.filter((p) => p !== i) : r = c, i = M(i);
  }
  return e.set(t, n), n;
}
function ee(t) {
  let {
    element: e,
    boundary: o,
    rootBoundary: n,
    strategy: r
  } = t;
  const i = [...o === "clippingAncestors" ? te(e, this._c) : [].concat(o), n], c = i[0], l = i.reduce((f, p) => {
    const a = mt(e, p, r);
    return f.top = W(a.top, f.top), f.right = z(a.right, f.right), f.bottom = z(a.bottom, f.bottom), f.left = W(a.left, f.left), f;
  }, mt(e, c, r));
  return {
    width: l.right - l.left,
    height: l.bottom - l.top,
    x: l.left,
    y: l.top
  };
}
function ne(t) {
  const {
    width: e,
    height: o
  } = vt(t);
  return {
    width: e,
    height: o
  };
}
function oe(t, e, o, n) {
  const r = S(e), s = N(e), i = o === "fixed", c = q(t, !0, i, e);
  let l = {
    scrollLeft: 0,
    scrollTop: 0
  };
  const f = D(0);
  if (r || !r && !i)
    if ((B(e) !== "body" || U(s)) && (l = nt(e)), r) {
      const h = q(e, !0, i, e);
      f.x = h.x + e.clientLeft, f.y = h.y + e.clientTop;
    } else
      s && (f.x = Rt(s));
  let p = c.left + l.scrollLeft - f.x, a = c.top + l.scrollTop - f.y;
  const [m, u, d] = Ct(n);
  return m && (p += u, a += d, r && (p += e.clientLeft, a += e.clientTop)), {
    x: p,
    y: a,
    width: c.width,
    height: c.height
  };
}
function ht(t, e) {
  return !S(t) || C(t).position === "fixed" ? null : e ? e(t) : t.offsetParent;
}
function Lt(t, e) {
  const o = A(t);
  if (!S(t))
    return o;
  let n = ht(t, e);
  for (; n && It(n) && C(n).position === "static"; )
    n = ht(n, e);
  return n && (B(n) === "html" || B(n) === "body" && C(n).position === "static" && !lt(n)) ? o : n || xt(t) || o;
}
const ie = async function(t) {
  const e = this.getOffsetParent || Lt, o = this.getDimensions;
  return {
    reference: oe(t.reference, await e(t.floating), t.strategy, t.floating),
    floating: {
      x: 0,
      y: 0,
      ...await o(t.floating)
    }
  };
};
function se(t) {
  return C(t).direction === "rtl";
}
const re = {
  convertOffsetParentRelativeRectToViewportRelativeRect: Ut,
  getDocumentElement: N,
  getClippingRect: ee,
  getOffsetParent: Lt,
  getElementRects: ie,
  getClientRects: Gt,
  getDimensions: ne,
  getScale: $,
  isElement: k,
  isRTL: se
}, ce = Yt, le = Mt, fe = _t, ae = $t, ue = (t, e, o) => {
  const n = /* @__PURE__ */ new Map(), r = {
    platform: re,
    ...o
  }, s = {
    ...r.platform,
    _c: n
  };
  return Wt(t, e, {
    ...r,
    platform: s
  });
};
class pe extends St {
  constructor(e = {
    position: "bottom",
    showArrow: !1,
    offset: 6,
    showDelay: 200,
    hideDelay: 200,
    zIndex: 50,
    autoHide: !0
  }) {
    super(), this.options = e;
  }
  updatePosition() {
    if (!this.options.target || !this.options.content)
      return;
    const e = [Xt(this.options.offset), le(), ce({ padding: 8 })];
    this.options.autoHide && e.push(fe({ padding: 10 }));
    const o = this.options.content.querySelector(".arrow");
    this.options.showArrow && o && e.push(ae({ element: o })), ue(this.options.target, this.options.content, {
      placement: this.options.position,
      middleware: e
    }).then(({ x: n, y: r, placement: s, middlewareData: i }) => {
      if (Object.assign(this.options.content.style, {
        left: `${n}px`,
        top: `${r}px`
      }), this.options.showArrow && o) {
        const c = {
          top: "bottom",
          right: "left",
          bottom: "top",
          left: "right"
        }[s.split("-")[0]];
        Object.assign(o.style, {
          left: i.arrow.x != null ? `${i.arrow.x}px` : "",
          top: i.arrow.y != null ? `${i.arrow.y}px` : "",
          right: "",
          bottom: "",
          [c]: "-6px"
        });
      }
    });
  }
  show() {
    var e, o;
    this.options.content.style.display = "block", this.updatePosition(), (o = (e = this.options).isOpened) == null || o.call(e, !0);
  }
  hide() {
    var e, o;
    this.options.content.style.display = "none", (o = (e = this.options).isOpened) == null || o.call(e, !1);
  }
  isOpen() {
    return this.options.content.style.display === "block";
  }
  destroy() {
  }
}
export {
  pe as F
};
