import { Rectangle as tt } from "../../../../@dnd-kit_geometry@0.1.21/node_modules/@dnd-kit/geometry/dist/index.js";
var ut = (t) => {
  throw TypeError(t);
}, et = (t, n, e) => n.has(t) || ut("Cannot " + e), a = (t, n, e) => (et(t, n, "read from private field"), n.get(t)), T = (t, n, e) => n.has(t) ? ut("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(t) : n.set(t, e), R = (t, n, e, s) => (et(t, n, "write to private field"), n.set(t, e), e), ht = (t, n, e) => (et(t, n, "access private method"), e);
function U(t) {
  return t ? t instanceof KeyframeEffect ? !0 : "getKeyframes" in t && typeof t.getKeyframes == "function" : !1;
}
function kt(t, n) {
  const e = t.getAnimations();
  if (e.length > 0)
    for (const s of e) {
      if (s.playState !== "running") continue;
      const { effect: i } = s, o = (U(i) ? i.getKeyframes() : []).filter(n);
      if (o.length > 0)
        return [o[o.length - 1], s];
    }
  return null;
}
function q(t) {
  const { width: n, height: e, top: s, left: i, bottom: r, right: o } = t.getBoundingClientRect();
  return { width: n, height: e, top: s, left: i, bottom: r, right: o };
}
var dt = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
function nt(t) {
  const n = Object.prototype.toString.call(t);
  return n === "[object Window]" || // In Electron context the Window object serializes to [object global]
  n === "[object global]";
}
function it(t) {
  return "nodeType" in t;
}
function k(t) {
  var n, e, s;
  return t ? nt(t) ? t : it(t) ? "defaultView" in t ? (n = t.defaultView) != null ? n : window : (s = (e = t.ownerDocument) == null ? void 0 : e.defaultView) != null ? s : window : window : window;
}
function pt(t) {
  const { Document: n } = k(t);
  return t instanceof n || "nodeType" in t && t.nodeType === Node.DOCUMENT_NODE;
}
function V(t) {
  return !t || nt(t) ? !1 : t instanceof k(t).HTMLElement || "namespaceURI" in t && typeof t.namespaceURI == "string" && t.namespaceURI.endsWith("html");
}
function gt(t) {
  return t instanceof k(t).SVGElement || "namespaceURI" in t && typeof t.namespaceURI == "string" && t.namespaceURI.endsWith("svg");
}
function yt(t) {
  return t ? nt(t) ? t.document : it(t) ? pt(t) ? t : V(t) || gt(t) ? t.ownerDocument : document : document : document;
}
function St(t) {
  const { documentElement: n } = yt(t), e = n.clientWidth, s = n.clientHeight;
  return {
    top: 0,
    left: 0,
    right: e,
    bottom: s,
    width: e,
    height: s
  };
}
function Wt(t, n) {
  if (At(t) && t.open === !1)
    return !1;
  const { overflow: e, overflowX: s, overflowY: i } = getComputedStyle(t);
  return e === "visible" && s === "visible" && i === "visible";
}
function At(t) {
  return t.tagName === "DETAILS";
}
function B(t, n = t.getBoundingClientRect(), e = 0) {
  var s;
  let i = n;
  const { ownerDocument: r } = t, o = (s = r.defaultView) != null ? s : window;
  let c = t.parentElement;
  for (; c && c !== r.documentElement; ) {
    if (!Wt(c)) {
      const d = c.getBoundingClientRect(), y = e * (d.bottom - d.top), m = e * (d.right - d.left), h = e * (d.bottom - d.top), x = e * (d.right - d.left);
      i = {
        top: Math.max(i.top, d.top - y),
        right: Math.min(i.right, d.right + m),
        bottom: Math.min(i.bottom, d.bottom + h),
        left: Math.max(i.left, d.left - x),
        width: 0,
        // Will be calculated next
        height: 0
        // Will be calculated next
      }, i.width = i.right - i.left, i.height = i.bottom - i.top;
    }
    c = c.parentElement;
  }
  const l = o.innerWidth, f = o.innerHeight, u = e * f, g = e * l;
  return i = {
    top: Math.max(i.top, 0 - u),
    right: Math.min(i.right, l + g),
    bottom: Math.min(i.bottom, f + u),
    left: Math.max(i.left, 0 - g),
    width: 0,
    // Will be calculated next
    height: 0
    // Will be calculated next
  }, i.width = i.right - i.left, i.height = i.bottom - i.top, i.width < 0 && (i.width = 0), i.height < 0 && (i.height = 0), i;
}
function Ct() {
  return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
}
function ge(t) {
  const n = "input, textarea, select, canvas, [contenteditable]", e = t.cloneNode(!0), s = Array.from(t.querySelectorAll(n));
  return Array.from(e.querySelectorAll(n)).forEach((r, o) => {
    const c = s[o];
    if (rt(r) && rt(c) && (r.type !== "file" && (r.value = c.value), r.type === "radio" && r.name && (r.name = `Cloned__${r.name}`)), ct(r) && ct(c) && c.width > 0 && c.height > 0) {
      const l = r.getContext("2d");
      l?.drawImage(c, 0, 0);
    }
  }), e;
}
function rt(t) {
  return "value" in t;
}
function ct(t) {
  return t.tagName === "CANVAS";
}
function It(t, { x: n, y: e }) {
  const s = t.elementFromPoint(n, e);
  if (Nt(s)) {
    const { contentDocument: i } = s;
    if (i) {
      const { left: r, top: o } = s.getBoundingClientRect();
      return It(i, {
        x: n - r,
        y: e - o
      });
    }
  }
  return s;
}
function Nt(t) {
  return t?.tagName === "IFRAME";
}
var ye = /* @__PURE__ */ new WeakMap(), ve = class {
  constructor() {
    this.entries = /* @__PURE__ */ new Set(), this.clear = () => {
      for (const t of this.entries) {
        const [n, { type: e, listener: s, options: i }] = t;
        n.removeEventListener(e, s, i);
      }
      this.entries.clear();
    };
  }
  bind(t, n) {
    const e = Array.isArray(n) ? n : [n], s = [];
    for (const i of e) {
      const { type: r, listener: o, options: c } = i, l = [t, i];
      t.addEventListener(r, o, c), this.entries.add(l), s.push(l);
    }
    return function() {
      for (const [r, { type: o, listener: c, options: l }] of s)
        r.removeEventListener(o, c, l);
    };
  }
};
function D(t) {
  const n = t?.ownerDocument.defaultView;
  if (n && n.self !== n.parent)
    return n.frameElement;
}
function Ft(t) {
  const n = /* @__PURE__ */ new Set();
  let e = D(t);
  for (; e; )
    n.add(e), e = D(e);
  return n;
}
function Pt(t, n) {
  const e = setTimeout(t, n);
  return () => clearTimeout(e);
}
function vt(t, n) {
  const e = () => performance.now();
  let s, i;
  return function(...r) {
    const o = this;
    i ? (s?.(), s = Pt(
      () => {
        t.apply(o, r), i = e();
      },
      n - (e() - i)
    )) : (t.apply(o, r), i = e());
  };
}
function Lt(t, n) {
  return t === n ? !0 : !t || !n ? !1 : t.top == n.top && t.left == n.left && t.right == n.right && t.bottom == n.bottom;
}
function Vt(t, n = t.getBoundingClientRect()) {
  const { width: e, height: s } = B(
    t,
    n
  );
  return e > 0 && s > 0;
}
var Xt = dt ? ResizeObserver : class {
  observe() {
  }
  unobserve() {
  }
  disconnect() {
  }
}, O, Yt = class extends Xt {
  constructor(t) {
    super((n) => {
      if (!a(this, O)) {
        R(this, O, !0);
        return;
      }
      t(n, this);
    }), T(this, O, !1);
  }
};
O = /* @__PURE__ */ new WeakMap();
var lt = Array.from({ length: 100 }, (t, n) => n / 100), mt = 75, W, H, E, A, C, w, P, I, $, wt, xt, bt = class {
  constructor(t, n, e = {
    debug: !1,
    skipInitial: !1
  }) {
    this.element = t, this.callback = n, T(this, $), this.disconnect = () => {
      var r, o, c;
      R(this, P, !0), (r = a(this, E)) == null || r.disconnect(), (o = a(this, A)) == null || o.disconnect(), a(this, C).disconnect(), (c = a(this, w)) == null || c.remove();
    }, T(this, W, !0), T(this, H), T(this, E), T(this, A), T(this, C), T(this, w), T(this, P, !1), T(this, I, vt(() => {
      var r, o, c;
      const { element: l } = this;
      if ((r = a(this, A)) == null || r.disconnect(), a(this, P) || !a(this, W) || !l.isConnected)
        return;
      const f = (o = l.ownerDocument) != null ? o : document, { innerHeight: u, innerWidth: g } = (c = f.defaultView) != null ? c : window, d = l.getBoundingClientRect(), y = B(l, d), { top: m, left: h, bottom: x, right: b } = y, p = -Math.floor(m), _ = -Math.floor(h), M = -Math.floor(g - b), v = -Math.floor(u - x), Rt = `${p}px ${M}px ${v}px ${_}px`;
      this.boundingClientRect = d, R(this, A, new IntersectionObserver(
        (Mt) => {
          const [j] = Mt, { intersectionRect: Et } = j;
          (j.intersectionRatio !== 1 ? j.intersectionRatio : tt.intersectionRatio(
            Et,
            B(l)
          )) !== 1 && a(this, I).call(this);
        },
        {
          threshold: lt,
          rootMargin: Rt,
          root: f
        }
      )), a(this, A).observe(l), ht(this, $, wt).call(this);
    }, mt)), this.boundingClientRect = t.getBoundingClientRect(), R(this, W, Vt(t, this.boundingClientRect));
    let s = !0;
    this.callback = (r) => {
      s && (s = !1, e.skipInitial) || n(r);
    };
    const i = t.ownerDocument;
    e?.debug && (R(this, w, document.createElement("div")), a(this, w).style.background = "rgba(0,0,0,0.15)", a(this, w).style.position = "fixed", a(this, w).style.pointerEvents = "none", i.body.appendChild(a(this, w))), R(this, C, new IntersectionObserver(
      (r) => {
        var o, c;
        const l = r[r.length - 1], { boundingClientRect: f, isIntersecting: u } = l, { width: g, height: d } = f, y = a(this, W);
        R(this, W, u), !(!g && !d) && (y && !u ? ((o = a(this, A)) == null || o.disconnect(), this.callback(null), (c = a(this, E)) == null || c.disconnect(), R(this, E, void 0), a(this, w) && (a(this, w).style.visibility = "hidden")) : a(this, I).call(this), u && !a(this, E) && (R(this, E, new Yt(a(this, I))), a(this, E).observe(t)));
      },
      {
        threshold: lt,
        root: i
      }
    )), a(this, W) && !e.skipInitial && this.callback(this.boundingClientRect), a(this, C).observe(t);
  }
};
W = /* @__PURE__ */ new WeakMap();
H = /* @__PURE__ */ new WeakMap();
E = /* @__PURE__ */ new WeakMap();
A = /* @__PURE__ */ new WeakMap();
C = /* @__PURE__ */ new WeakMap();
w = /* @__PURE__ */ new WeakMap();
P = /* @__PURE__ */ new WeakMap();
I = /* @__PURE__ */ new WeakMap();
$ = /* @__PURE__ */ new WeakSet();
wt = function() {
  a(this, P) || (ht(this, $, xt).call(this), !Lt(this.boundingClientRect, a(this, H)) && (this.callback(this.boundingClientRect), R(this, H, this.boundingClientRect)));
};
xt = function() {
  if (a(this, w)) {
    const { top: t, left: n, width: e, height: s } = B(
      this.element
    );
    a(this, w).style.overflow = "hidden", a(this, w).style.visibility = "visible", a(this, w).style.top = `${Math.floor(t)}px`, a(this, w).style.left = `${Math.floor(n)}px`, a(this, w).style.width = `${Math.floor(e)}px`, a(this, w).style.height = `${Math.floor(s)}px`;
  }
};
var X = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap();
function Ot(t, n) {
  let e = X.get(t);
  return e || (e = { disconnect: new bt(
    t,
    (i) => {
      const r = X.get(t);
      r && r.callbacks.forEach((o) => o(i));
    },
    { skipInitial: !0 }
  ).disconnect, callbacks: /* @__PURE__ */ new Set() }), e.callbacks.add(n), X.set(t, e), () => {
    e.callbacks.delete(n), e.callbacks.size === 0 && (X.delete(t), e.disconnect());
  };
}
function zt(t, n) {
  const e = /* @__PURE__ */ new Set();
  for (const s of t) {
    const i = Ot(s, n);
    e.add(i);
  }
  return () => e.forEach((s) => s());
}
function Bt(t, n) {
  var e;
  const s = t.ownerDocument;
  if (!Y.has(s)) {
    const o = new AbortController(), c = /* @__PURE__ */ new Set();
    document.addEventListener(
      "scroll",
      (l) => c.forEach((f) => f(l)),
      {
        capture: !0,
        passive: !0,
        signal: o.signal
      }
    ), Y.set(s, { disconnect: () => o.abort(), listeners: c });
  }
  const { listeners: i, disconnect: r } = (e = Y.get(s)) != null ? e : {};
  return !i || !r ? () => {
  } : (i.add(n), () => {
    i.delete(n), i.size === 0 && (r(), Y.delete(s));
  });
}
var N, F, z, Q, we = class {
  constructor(t, n, e) {
    this.callback = n, T(this, N), T(this, F, !1), T(this, z), T(this, Q, vt((o) => {
      if (!a(this, F) && o.target && "contains" in o.target && typeof o.target.contains == "function") {
        for (const c of a(this, z))
          if (o.target.contains(c)) {
            this.callback(a(this, N).boundingClientRect);
            break;
          }
      }
    }, mt));
    const s = Ft(t), i = zt(s, n), r = Bt(t, a(this, Q));
    R(this, z, s), R(this, N, new bt(t, n, e)), this.disconnect = () => {
      a(this, F) || (R(this, F, !0), i(), r(), a(this, N).disconnect());
    };
  }
};
N = /* @__PURE__ */ new WeakMap();
F = /* @__PURE__ */ new WeakMap();
z = /* @__PURE__ */ new WeakMap();
Q = /* @__PURE__ */ new WeakMap();
function Dt(t) {
  return "showPopover" in t && "hidePopover" in t && typeof t.showPopover == "function" && typeof t.hidePopover == "function";
}
function xe(t) {
  try {
    Dt(t) && t.isConnected && t.hasAttribute("popover") && // This selector can throw an error in browsers that don't support it
    !t.matches(":popover-open") && t.showPopover();
  } catch {
  }
}
function at(t) {
  return !dt || !t ? !1 : t === yt(t).scrollingElement;
}
function Tt(t) {
  const n = k(t), e = at(t) ? St(t) : q(t), s = at(t) ? {
    height: n.innerHeight,
    width: n.innerWidth
  } : {
    height: t.clientHeight,
    width: t.clientWidth
  }, i = {
    current: {
      x: t.scrollLeft,
      y: t.scrollTop
    },
    max: {
      x: t.scrollWidth - s.width,
      y: t.scrollHeight - s.height
    }
  }, r = i.current.y <= 0, o = i.current.x <= 0, c = i.current.y >= i.max.y, l = i.current.x >= i.max.x;
  return {
    rect: e,
    position: i,
    isTop: r,
    isLeft: o,
    isBottom: c,
    isRight: l
  };
}
function be(t, n) {
  const { isTop: e, isBottom: s, isLeft: i, isRight: r, position: o } = Tt(t), { x: c, y: l } = n ?? { x: 0, y: 0 }, f = !e && o.current.y + l > 0, u = !s && o.current.y + l < o.max.y, g = !i && o.current.x + c > 0, d = !r && o.current.x + c < o.max.x;
  return {
    top: f,
    bottom: u,
    left: g,
    right: d,
    x: g || d,
    y: f || u
  };
}
var st = class {
  constructor(t) {
    this.scheduler = t, this.pending = !1, this.tasks = /* @__PURE__ */ new Set(), this.resolvers = /* @__PURE__ */ new Set(), this.flush = () => {
      const { tasks: n, resolvers: e } = this;
      this.pending = !1, this.tasks = /* @__PURE__ */ new Set(), this.resolvers = /* @__PURE__ */ new Set();
      for (const s of n)
        s();
      for (const s of e)
        s();
    };
  }
  schedule(t) {
    return this.tasks.add(t), this.pending || (this.pending = !0, this.scheduler(this.flush)), new Promise((n) => this.resolvers.add(n));
  }
}, Te = new st((t) => {
  typeof requestAnimationFrame == "function" ? requestAnimationFrame(t) : t();
}), Ht = new st((t) => setTimeout(t, 50)), K = /* @__PURE__ */ new Map(), $t = K.clear.bind(K);
function S(t, n = !1) {
  if (!n) return ft(t);
  let e = K.get(t);
  return e || (e = ft(t), K.set(t, e), Ht.schedule($t), e);
}
function ft(t) {
  return k(t).getComputedStyle(t);
}
function Kt(t, n = S(t, !0)) {
  return n.position === "fixed" || n.position === "sticky";
}
function Ut(t, n = S(t, !0)) {
  const e = /(auto|scroll|overlay)/;
  return ["overflow", "overflowX", "overflowY"].some((i) => {
    const r = n[i];
    return typeof r == "string" ? e.test(r) : !1;
  });
}
var qt = {
  excludeElement: !0
};
function jt(t, n = qt) {
  const { limit: e, excludeElement: s } = n, i = /* @__PURE__ */ new Set();
  function r(o) {
    if (e != null && i.size >= e || !o)
      return i;
    if (pt(o) && o.scrollingElement != null && !i.has(o.scrollingElement))
      return i.add(o.scrollingElement), i;
    if (!V(o))
      return gt(o) ? r(o.parentElement) : i;
    if (i.has(o))
      return i;
    const c = S(o, !0);
    if (s && o === t || Ut(o, c) && i.add(o), Kt(o, c)) {
      const { scrollingElement: l } = o.ownerDocument;
      return l && i.add(l), i;
    }
    return r(o.parentNode);
  }
  return t ? r(t) : i;
}
function Gt(t) {
  const [n] = jt(t, { limit: 1 });
  return n ?? null;
}
function _t(t, n = window.frameElement) {
  const e = {
    x: 0,
    y: 0,
    scaleX: 1,
    scaleY: 1
  };
  if (!t) return e;
  let s = D(t);
  for (; s; ) {
    if (s === n)
      return e;
    const i = q(s), { x: r, y: o } = Jt(s, i);
    e.x = e.x + i.left, e.y = e.y + i.top, e.scaleX = e.scaleX * r, e.scaleY = e.scaleY * o, s = D(s);
  }
  return e;
}
function Jt(t, n = q(t)) {
  const e = Math.round(n.width), s = Math.round(n.height);
  if (V(t))
    return {
      x: e / t.offsetWidth,
      y: s / t.offsetHeight
    };
  const i = S(t, !0);
  return {
    x: (parseFloat(i.width) || e) / e,
    y: (parseFloat(i.height) || s) / s
  };
}
function Qt(t) {
  if (t === "none")
    return null;
  const n = t.split(" "), e = parseFloat(n[0]), s = parseFloat(n[1]);
  return isNaN(e) && isNaN(s) ? null : {
    x: isNaN(e) ? s : e,
    y: isNaN(s) ? e : s
  };
}
function Z(t) {
  if (t === "none")
    return null;
  const [n, e, s = "0"] = t.split(" "), i = { x: parseFloat(n), y: parseFloat(e), z: parseInt(s, 10) };
  return isNaN(i.x) && isNaN(i.y) ? null : {
    x: isNaN(i.x) ? 0 : i.x,
    y: isNaN(i.y) ? 0 : i.y,
    z: isNaN(i.z) ? 0 : i.z
  };
}
function ot(t) {
  var n, e, s, i, r, o, c, l, f;
  const { scale: u, transform: g, translate: d } = t, y = Qt(u), m = Z(d), h = Zt(g);
  if (!h && !y && !m)
    return null;
  const x = {
    x: (n = y?.x) != null ? n : 1,
    y: (e = y?.y) != null ? e : 1
  }, b = {
    x: (s = m?.x) != null ? s : 0,
    y: (i = m?.y) != null ? i : 0
  }, p = {
    x: (r = h?.x) != null ? r : 0,
    y: (o = h?.y) != null ? o : 0,
    scaleX: (c = h?.scaleX) != null ? c : 1,
    scaleY: (l = h?.scaleY) != null ? l : 1
  };
  return {
    x: b.x + p.x,
    y: b.y + p.y,
    z: (f = m?.z) != null ? f : 0,
    scaleX: x.x * p.scaleX,
    scaleY: x.y * p.scaleY
  };
}
function Zt(t) {
  if (t.startsWith("matrix3d(")) {
    const n = t.slice(9, -1).split(/, /);
    return {
      x: +n[12],
      y: +n[13],
      scaleX: +n[0],
      scaleY: +n[5]
    };
  } else if (t.startsWith("matrix(")) {
    const n = t.slice(7, -1).split(/, /);
    return {
      x: +n[4],
      y: +n[5],
      scaleX: +n[0],
      scaleY: +n[3]
    };
  }
  return null;
}
var te = /* @__PURE__ */ ((t) => (t[t.Idle = 0] = "Idle", t[t.Forward = 1] = "Forward", t[t.Reverse = -1] = "Reverse", t))(te || {}), ee = {
  x: 0.2,
  y: 0.2
}, ne = {
  x: 10,
  y: 10
};
function _e(t, n, e, s = 25, i = ee, r = ne) {
  const { x: o, y: c } = n, { rect: l, isTop: f, isBottom: u, isLeft: g, isRight: d } = Tt(t), y = _t(t), m = S(t, !0), h = ot(m), x = h !== null ? h?.scaleX < 0 : !1, b = h !== null ? h?.scaleY < 0 : !1, p = new tt(
    l.left * y.scaleX + y.x,
    l.top * y.scaleY + y.y,
    l.width * y.scaleX,
    l.height * y.scaleY
  ), _ = {
    x: 0,
    y: 0
    /* Idle */
  }, M = {
    x: 0,
    y: 0
  }, v = {
    height: p.height * i.y,
    width: p.width * i.x
  };
  return (!f || b && !u) && c <= p.top + v.height && e?.y !== 1 && o >= p.left - r.x && o <= p.right + r.x ? (_.y = b ? 1 : -1, M.y = s * Math.abs(
    (p.top + v.height - c) / v.height
  )) : (!u || b && !f) && c >= p.bottom - v.height && e?.y !== -1 && o >= p.left - r.x && o <= p.right + r.x && (_.y = b ? -1 : 1, M.y = s * Math.abs(
    (p.bottom - v.height - c) / v.height
  )), (!d || x && !g) && o >= p.right - v.width && e?.x !== -1 && c >= p.top - r.y && c <= p.bottom + r.y ? (_.x = x ? -1 : 1, M.x = s * Math.abs(
    (p.right - v.width - o) / v.width
  )) : (!g || x && !d) && o <= p.left + v.width && e?.x !== 1 && c >= p.top - r.y && c <= p.bottom + r.y && (_.x = x ? 1 : -1, M.x = s * Math.abs(
    (p.left + v.width - o) / v.width
  )), {
    direction: _,
    speed: M
  };
}
function ie(t) {
  return "scrollIntoViewIfNeeded" in t && typeof t.scrollIntoViewIfNeeded == "function";
}
function Re(t, n = !1) {
  if (ie(t)) {
    t.scrollIntoViewIfNeeded(n);
    return;
  }
  if (!V(t))
    return t.scrollIntoView();
  var e = Gt(t);
  if (!V(e))
    return;
  const s = S(e, !0), i = parseInt(
    s.getPropertyValue("border-top-width")
  ), r = parseInt(
    s.getPropertyValue("border-left-width")
  ), o = t.offsetTop - e.offsetTop < e.scrollTop, c = t.offsetTop - e.offsetTop + t.clientHeight - i > e.scrollTop + e.clientHeight, l = t.offsetLeft - e.offsetLeft < e.scrollLeft, f = t.offsetLeft - e.offsetLeft + t.clientWidth - r > e.scrollLeft + e.clientWidth, u = o && !c;
  (o || c) && n && (e.scrollTop = t.offsetTop - e.offsetTop - e.clientHeight / 2 - i + t.clientHeight / 2), (l || f) && n && (e.scrollLeft = t.offsetLeft - e.offsetLeft - e.clientWidth / 2 - r + t.clientWidth / 2), (o || c || l || f) && !n && t.scrollIntoView(u);
}
function se(t, n, e) {
  const { scaleX: s, scaleY: i, x: r, y: o } = n, c = t.left + r + (1 - s) * parseFloat(e), l = t.top + o + (1 - i) * parseFloat(e.slice(e.indexOf(" ") + 1)), f = s ? t.width * s : t.width, u = i ? t.height * i : t.height;
  return {
    width: f,
    height: u,
    top: l,
    right: c + f,
    bottom: l + u,
    left: c
  };
}
function oe(t, n, e) {
  const { scaleX: s, scaleY: i, x: r, y: o } = n, c = t.left - r - (1 - s) * parseFloat(e), l = t.top - o - (1 - i) * parseFloat(e.slice(e.indexOf(" ") + 1)), f = s ? t.width / s : t.width, u = i ? t.height / i : t.height;
  return {
    width: f,
    height: u,
    top: l,
    right: c + f,
    bottom: l + u,
    left: c
  };
}
function Me({ element: t, keyframes: n, options: e }) {
  return t.animate(n, e).finished;
}
function Ee(t, n = S(t).translate, e = !0) {
  if (e) {
    const s = kt(
      t,
      (i) => "translate" in i
    );
    if (s) {
      const { translate: i = "" } = s[0];
      if (typeof i == "string") {
        const r = Z(i);
        if (r)
          return r;
      }
    }
  }
  if (n) {
    const s = Z(n);
    if (s)
      return s;
  }
  return { x: 0, y: 0, z: 0 };
}
var re = new st((t) => setTimeout(t, 0)), L = /* @__PURE__ */ new Map(), ce = L.clear.bind(L);
function le(t) {
  const n = t.ownerDocument;
  let e = L.get(n);
  if (e) return e;
  e = n.getAnimations(), L.set(n, e), re.schedule(ce);
  const s = e.filter(
    (i) => U(i.effect) && i.effect.target === t
  );
  return L.set(t, s), e;
}
function ae(t, n) {
  const e = le(t).filter((s) => {
    var i, r;
    if (U(s.effect)) {
      const { target: o } = s.effect;
      if ((r = o && ((i = n.isValidTarget) == null ? void 0 : i.call(n, o))) != null ? r : !0)
        return s.effect.getKeyframes().some((l) => {
          for (const f of n.properties)
            if (l[f]) return !0;
        });
    }
  }).map((s) => {
    const { effect: i, currentTime: r } = s, o = i?.getComputedTiming().duration;
    if (!(s.pending || s.playState === "finished") && typeof o == "number" && typeof r == "number" && r < o)
      return s.currentTime = o, () => {
        s.currentTime = r;
      };
  });
  if (e.length > 0)
    return () => e.forEach((s) => s?.());
}
var ke = class extends tt {
  constructor(t, n = {}) {
    var e, s, i, r;
    const {
      frameTransform: o = _t(t),
      ignoreTransforms: c,
      getBoundingClientRect: l = q
    } = n, f = ae(t, {
      properties: ["transform", "translate", "scale", "width", "height"],
      isValidTarget: (v) => (v !== t || Ct()) && v.contains(t)
    }), u = l(t);
    let { top: g, left: d, width: y, height: m } = u, h;
    const x = S(t), b = ot(x), p = {
      x: (e = b?.scaleX) != null ? e : 1,
      y: (s = b?.scaleY) != null ? s : 1
    }, _ = fe(t, x);
    f?.(), b && (h = oe(
      u,
      b,
      x.transformOrigin
    ), (c || _) && (g = h.top, d = h.left, y = h.width, m = h.height));
    const M = {
      width: (i = h?.width) != null ? i : y,
      height: (r = h?.height) != null ? r : m
    };
    if (_ && !c && h) {
      const v = se(
        h,
        _,
        x.transformOrigin
      );
      g = v.top, d = v.left, y = v.width, m = v.height, p.x = _.scaleX, p.y = _.scaleY;
    }
    o && (c || (d *= o.scaleX, y *= o.scaleX, g *= o.scaleY, m *= o.scaleY), d += o.x, g += o.y), super(d, g, y, m), this.scale = p, this.intrinsicWidth = M.width, this.intrinsicHeight = M.height;
  }
};
function fe(t, n) {
  var e;
  const s = t.getAnimations();
  let i = null;
  if (!s.length) return null;
  for (const r of s) {
    if (r.playState !== "running") continue;
    const o = U(r.effect) ? r.effect.getKeyframes() : [], c = o[o.length - 1];
    if (!c) continue;
    const { transform: l, translate: f, scale: u } = c;
    if (l || f || u) {
      const g = ot({
        transform: typeof l == "string" && l ? l : n.transform,
        translate: typeof f == "string" && f ? f : n.translate,
        scale: typeof u == "string" && u ? u : n.scale
      });
      g && (i = i ? {
        x: i.x + g.x,
        y: i.y + g.y,
        z: (e = i.z) != null ? e : g.z,
        scaleX: i.scaleX * g.scaleX,
        scaleY: i.scaleY * g.scaleY
      } : g);
    }
  }
  return i;
}
function G(t) {
  return "style" in t && typeof t.style == "object" && t.style !== null && "setProperty" in t.style && "removeProperty" in t.style && typeof t.style.setProperty == "function" && typeof t.style.removeProperty == "function";
}
var Se = class {
  constructor(t) {
    this.element = t, this.initial = /* @__PURE__ */ new Map();
  }
  set(t, n = "") {
    const { element: e } = this;
    if (G(e))
      for (const [s, i] of Object.entries(t)) {
        const r = `${n}${s}`;
        this.initial.has(r) || this.initial.set(r, e.style.getPropertyValue(r)), e.style.setProperty(
          r,
          typeof i == "string" ? i : `${i}px`
        );
      }
  }
  remove(t, n = "") {
    const { element: e } = this;
    if (G(e))
      for (const s of t) {
        const i = `${n}${s}`;
        e.style.removeProperty(i);
      }
  }
  reset() {
    const { element: t } = this;
    if (G(t)) {
      for (const [n, e] of this.initial)
        t.style.setProperty(n, e);
      t.getAttribute("style") === "" && t.removeAttribute("style");
    }
  }
};
function ue(t) {
  return t ? t instanceof k(t).Element || it(t) && t.nodeType === Node.ELEMENT_NODE : !1;
}
function We(t) {
  if (!t) return !1;
  const { KeyboardEvent: n } = k(t.target);
  return t instanceof n;
}
function Ae(t) {
  if (!t) return !1;
  const { PointerEvent: n } = k(t.target);
  return t instanceof n;
}
function Ce(t) {
  if (!ue(t)) return !1;
  const { tagName: n } = t;
  return n === "INPUT" || n === "TEXTAREA" || he(t);
}
function he(t) {
  return t.hasAttribute("contenteditable") && t.getAttribute("contenteditable") !== "false";
}
var J = {};
function Ie(t) {
  const n = J[t] == null ? 0 : J[t] + 1;
  return J[t] = n, `${t}-${n}`;
}
export {
  ke as DOMRectangle,
  ve as Listeners,
  we as PositionObserver,
  ye as ProxiedElements,
  Yt as ResizeNotifier,
  st as Scheduler,
  te as ScrollDirection,
  Se as Styles,
  Me as animateTransform,
  be as canScroll,
  dt as canUseDOM,
  ge as cloneElement,
  Ee as computeTranslate,
  _e as detectScrollIntent,
  Ie as generateUniqueId,
  q as getBoundingRectangle,
  S as getComputedStyles,
  yt as getDocument,
  It as getElementFromPoint,
  kt as getFinalKeyframe,
  Gt as getFirstScrollableAncestor,
  D as getFrameElement,
  _t as getFrameTransform,
  jt as getScrollableAncestors,
  St as getViewportBoundingRectangle,
  B as getVisibleBoundingRectangle,
  k as getWindow,
  oe as inverseTransform,
  at as isDocumentScrollingElement,
  ue as isElement,
  V as isHTMLElement,
  We as isKeyboardEvent,
  U as isKeyframeEffect,
  Ae as isPointerEvent,
  Ct as isSafari,
  Ce as isTextInput,
  ot as parseTransform,
  Z as parseTranslate,
  Te as scheduler,
  Re as scrollIntoViewIfNeeded,
  xe as showPopover,
  Dt as supportsPopover,
  G as supportsStyle,
  Pt as timeout
};
//# sourceMappingURL=utilities.js.map
