import { jsxs as A, jsx as f, Fragment as te } from "react/jsx-runtime";
import * as s from "react";
import { useLayoutEffect as en, useEffect as Me, useRef as he, useState as be, startTransition as ce, forwardRef as ot, useCallback as tn } from "react";
import { a as at, u as it, f as nn, b as st, v as rn, e as on, n as an } from "./use-editor.CLs27I-R.js";
import { c as sn, P as cn, b as se, a as ln, y as H, m as _e, e as un } from "./index.D1n9HtNk.js";
import { l as dn, m as fn, n as ne, f as pn, H as mn, R as ct, o as gn, p as vn, g as hn } from "./theme.BwnlJUJD.js";
import * as bn from "react-dom";
import { c as xn, B as Cn } from "./use-section-style.CqWLdjop.js";
import { u as pe } from "./use-brick-manifest.CKrAfjO8.js";
import { a as W } from "./twind.Cg2g8xBZ.js";
import { m as De, ae as Mn, Y as Ve } from "./use-page-data.BYLN5MSa.js";
import { range as wn } from "lodash-es";
import { e as yn } from "./index.DpxLxIqU.js";
import { u as En } from "./sortable.psjpNshi.js";
import { c as Le, M as Fe, d as Rn, E as Sn, R as In, g as Pn, a as Nn, C as Tn, b as Bn } from "./index.BTcesXu3.js";
import { b as On, c as kn, d as An, e as _n } from "./index.XOBVdtzY.js";
import { r as Dn, m as Ln } from "./menubar-styles.COOvYV1S.js";
import { c as lt, R as Fn, A as zn, P as Gn, C as $n, G as Vn, L as Hn, I as Un, S as Wn, l as jn, g as Yn, h as Xn, a as qn, b as Kn, d as Jn, e as Zn, f as Qn, n as le, i as ut, j as er, k as tr, p as nr } from "./base-menu.props.DId21TTL.js";
import { a as rr, l as or, t as dt } from "./icons.fQeDMwI8.js";
import { v as ft } from "./radius.prop.CaJVv35S.js";
import { e as ar } from "./tooltip.C45WcX50.js";
function ir(t) {
  let e = t.activeElement;
  for (; ((n = e) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
    var n;
    e = e.shadowRoot.activeElement;
  }
  return e;
}
function de(t, e) {
  if (!t || !e)
    return !1;
  const n = e.getRootNode == null ? void 0 : e.getRootNode();
  if (t.contains(e))
    return !0;
  if (n && dn(n)) {
    let r = e;
    for (; r; ) {
      if (t === r)
        return !0;
      r = r.parentNode || r.host;
    }
  }
  return !1;
}
function sr() {
  return /apple/i.test(navigator.vendor);
}
function Se(t, e) {
  const n = ["mouse", "pen"];
  return n.push("", void 0), n.includes(t);
}
function ue(t) {
  return t?.ownerDocument || document;
}
function cr(t) {
  return "composedPath" in t ? t.composedPath()[0] : t.target;
}
var lr = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], Ie = /* @__PURE__ */ lr.join(","), pt = typeof Element > "u", fe = pt ? function() {
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, xe = !pt && Element.prototype.getRootNode ? function(t) {
  var e;
  return t == null || (e = t.getRootNode) === null || e === void 0 ? void 0 : e.call(t);
} : function(t) {
  return t?.ownerDocument;
}, Ce = function t(e, n) {
  var r;
  n === void 0 && (n = !0);
  var o = e == null || (r = e.getAttribute) === null || r === void 0 ? void 0 : r.call(e, "inert"), i = o === "" || o === "true", a = i || n && e && t(e.parentNode);
  return a;
}, ur = function(e) {
  var n, r = e == null || (n = e.getAttribute) === null || n === void 0 ? void 0 : n.call(e, "contenteditable");
  return r === "" || r === "true";
}, dr = function(e, n, r) {
  if (Ce(e))
    return [];
  var o = Array.prototype.slice.apply(e.querySelectorAll(Ie));
  return n && fe.call(e, Ie) && o.unshift(e), o = o.filter(r), o;
}, fr = function t(e, n, r) {
  for (var o = [], i = Array.from(e); i.length; ) {
    var a = i.shift();
    if (!Ce(a, !1))
      if (a.tagName === "SLOT") {
        var c = a.assignedElements(), u = c.length ? c : a.children, d = t(u, !0, r);
        r.flatten ? o.push.apply(o, d) : o.push({
          scopeParent: a,
          candidates: d
        });
      } else {
        var p = fe.call(a, Ie);
        p && r.filter(a) && (n || !e.includes(a)) && o.push(a);
        var g = a.shadowRoot || // check for an undisclosed shadow
        typeof r.getShadowRoot == "function" && r.getShadowRoot(a), h = !Ce(g, !1) && (!r.shadowRootFilter || r.shadowRootFilter(a));
        if (g && h) {
          var l = t(g === !0 ? a.children : g.children, !0, r);
          r.flatten ? o.push.apply(o, l) : o.push({
            scopeParent: a,
            candidates: l
          });
        } else
          i.unshift.apply(i, a.children);
      }
  }
  return o;
}, mt = function(e) {
  return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
}, gt = function(e) {
  if (!e)
    throw new Error("No node provided");
  return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || ur(e)) && !mt(e) ? 0 : e.tabIndex;
}, pr = function(e, n) {
  var r = gt(e);
  return r < 0 && n && !mt(e) ? 0 : r;
}, mr = function(e, n) {
  return e.tabIndex === n.tabIndex ? e.documentOrder - n.documentOrder : e.tabIndex - n.tabIndex;
}, vt = function(e) {
  return e.tagName === "INPUT";
}, gr = function(e) {
  return vt(e) && e.type === "hidden";
}, vr = function(e) {
  var n = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(r) {
    return r.tagName === "SUMMARY";
  });
  return n;
}, hr = function(e, n) {
  for (var r = 0; r < e.length; r++)
    if (e[r].checked && e[r].form === n)
      return e[r];
}, br = function(e) {
  if (!e.name)
    return !0;
  var n = e.form || xe(e), r = function(c) {
    return n.querySelectorAll('input[type="radio"][name="' + c + '"]');
  }, o;
  if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
    o = r(window.CSS.escape(e.name));
  else
    try {
      o = r(e.name);
    } catch (a) {
      return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", a.message), !1;
    }
  var i = hr(o, e.form);
  return !i || i === e;
}, xr = function(e) {
  return vt(e) && e.type === "radio";
}, Cr = function(e) {
  return xr(e) && !br(e);
}, Mr = function(e) {
  var n, r = e && xe(e), o = (n = r) === null || n === void 0 ? void 0 : n.host, i = !1;
  if (r && r !== e) {
    var a, c, u;
    for (i = !!((a = o) !== null && a !== void 0 && (c = a.ownerDocument) !== null && c !== void 0 && c.contains(o) || e != null && (u = e.ownerDocument) !== null && u !== void 0 && u.contains(e)); !i && o; ) {
      var d, p, g;
      r = xe(o), o = (d = r) === null || d === void 0 ? void 0 : d.host, i = !!((p = o) !== null && p !== void 0 && (g = p.ownerDocument) !== null && g !== void 0 && g.contains(o));
    }
  }
  return i;
}, He = function(e) {
  var n = e.getBoundingClientRect(), r = n.width, o = n.height;
  return r === 0 && o === 0;
}, wr = function(e, n) {
  var r = n.displayCheck, o = n.getShadowRoot;
  if (getComputedStyle(e).visibility === "hidden")
    return !0;
  var i = fe.call(e, "details>summary:first-of-type"), a = i ? e.parentElement : e;
  if (fe.call(a, "details:not([open]) *"))
    return !0;
  if (!r || r === "full" || r === "legacy-full") {
    if (typeof o == "function") {
      for (var c = e; e; ) {
        var u = e.parentElement, d = xe(e);
        if (u && !u.shadowRoot && o(u) === !0)
          return He(e);
        e.assignedSlot ? e = e.assignedSlot : !u && d !== e.ownerDocument ? e = d.host : e = u;
      }
      e = c;
    }
    if (Mr(e))
      return !e.getClientRects().length;
    if (r !== "legacy-full")
      return !0;
  } else if (r === "non-zero-area")
    return He(e);
  return !1;
}, yr = function(e) {
  if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
    for (var n = e.parentElement; n; ) {
      if (n.tagName === "FIELDSET" && n.disabled) {
        for (var r = 0; r < n.children.length; r++) {
          var o = n.children.item(r);
          if (o.tagName === "LEGEND")
            return fe.call(n, "fieldset[disabled] *") ? !0 : !o.contains(e);
        }
        return !0;
      }
      n = n.parentElement;
    }
  return !1;
}, Er = function(e, n) {
  return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
  //  because we're limited in the type of selectors we can use in JSDom (see related
  //  note related to `candidateSelectors`)
  Ce(n) || gr(n) || wr(n, e) || // For a details element with a summary, the summary element gets the focus
  vr(n) || yr(n));
}, Ue = function(e, n) {
  return !(Cr(n) || gt(n) < 0 || !Er(e, n));
}, Rr = function(e) {
  var n = parseInt(e.getAttribute("tabindex"), 10);
  return !!(isNaN(n) || n >= 0);
}, Sr = function t(e) {
  var n = [], r = [];
  return e.forEach(function(o, i) {
    var a = !!o.scopeParent, c = a ? o.scopeParent : o, u = pr(c, a), d = a ? t(o.candidates) : c;
    u === 0 ? a ? n.push.apply(n, d) : n.push(c) : r.push({
      documentOrder: i,
      tabIndex: u,
      item: o,
      isScope: a,
      content: d
    });
  }), r.sort(mr).reduce(function(o, i) {
    return i.isScope ? o.push.apply(o, i.content) : o.push(i.content), o;
  }, []).concat(n);
}, ht = function(e, n) {
  n = n || {};
  var r;
  return n.getShadowRoot ? r = fr([e], n.includeContainer, {
    filter: Ue.bind(null, n),
    flatten: !1,
    getShadowRoot: n.getShadowRoot,
    shadowRootFilter: Rr
  }) : r = dr(e, n.includeContainer, Ue.bind(null, n)), Sr(r);
};
function Ir(t) {
  const e = s.useRef(void 0), n = s.useCallback((r) => {
    const o = t.map((i) => {
      if (i != null) {
        if (typeof i == "function") {
          const a = i, c = a(r);
          return typeof c == "function" ? c : () => {
            a(null);
          };
        }
        return i.current = r, () => {
          i.current = null;
        };
      }
    });
    return () => {
      o.forEach((i) => i?.());
    };
  }, t);
  return s.useMemo(() => t.every((r) => r == null) ? null : (r) => {
    e.current && (e.current(), e.current = void 0), r != null && (e.current = n(r));
  }, t);
}
const bt = {
  ...s
}, Pr = bt.useInsertionEffect, Nr = Pr || ((t) => t());
function ge(t) {
  const e = s.useRef(() => {
    if (process.env.NODE_ENV !== "production")
      throw new Error("Cannot call an event handler while rendering.");
  });
  return Nr(() => {
    e.current = t;
  }), s.useCallback(function() {
    for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
      r[o] = arguments[o];
    return e.current == null ? void 0 : e.current(...r);
  }, []);
}
var J = typeof document < "u" ? en : Me;
let We = !1, Tr = 0;
const je = () => (
  // Ensure the id is unique with multiple independent versions of Floating UI
  // on <React 18
  "floating-ui-" + Math.random().toString(36).slice(2, 6) + Tr++
);
function Br() {
  const [t, e] = s.useState(() => We ? je() : void 0);
  return J(() => {
    t == null && e(je());
  }, []), s.useEffect(() => {
    We = !0;
  }, []), t;
}
const Or = bt.useId, xt = Or || Br;
let Pe;
process.env.NODE_ENV !== "production" && (Pe = /* @__PURE__ */ new Set());
function kr() {
  for (var t, e = arguments.length, n = new Array(e), r = 0; r < e; r++)
    n[r] = arguments[r];
  const o = "Floating UI: " + n.join(" ");
  if (!((t = Pe) != null && t.has(o))) {
    var i;
    (i = Pe) == null || i.add(o), console.error(o);
  }
}
function Ar() {
  const t = /* @__PURE__ */ new Map();
  return {
    emit(e, n) {
      var r;
      (r = t.get(e)) == null || r.forEach((o) => o(n));
    },
    on(e, n) {
      t.set(e, [...t.get(e) || [], n]);
    },
    off(e, n) {
      var r;
      t.set(e, ((r = t.get(e)) == null ? void 0 : r.filter((o) => o !== n)) || []);
    }
  };
}
const _r = /* @__PURE__ */ s.createContext(null), Dr = /* @__PURE__ */ s.createContext(null), Ct = () => {
  var t;
  return ((t = s.useContext(_r)) == null ? void 0 : t.id) || null;
}, Mt = () => s.useContext(Dr);
function ze(t) {
  return "data-floating-ui-" + t;
}
function U(t) {
  t.current !== -1 && (clearTimeout(t.current), t.current = -1);
}
function we(t) {
  const e = he(t);
  return J(() => {
    e.current = t;
  }), e;
}
const Ye = /* @__PURE__ */ ze("safe-polygon");
function ye(t, e, n) {
  return n && !Se(n) ? 0 : typeof t == "number" ? t : t?.[e];
}
function Lr(t, e) {
  e === void 0 && (e = {});
  const {
    open: n,
    onOpenChange: r,
    dataRef: o,
    events: i,
    elements: a
  } = t, {
    enabled: c = !0,
    delay: u = 0,
    handleClose: d = null,
    mouseOnly: p = !1,
    restMs: g = 0,
    move: h = !0
  } = e, l = Mt(), x = Ct(), v = we(d), M = we(u), B = we(n), O = s.useRef(), E = s.useRef(-1), T = s.useRef(), D = s.useRef(-1), Z = s.useRef(!0), j = s.useRef(!1), oe = s.useRef(() => {
  }), F = s.useRef(!1), Y = s.useCallback(() => {
    var b;
    const R = (b = o.current.openEvent) == null ? void 0 : b.type;
    return R?.includes("mouse") && R !== "mousedown";
  }, [o]);
  s.useEffect(() => {
    if (!c) return;
    function b(R) {
      let {
        open: w
      } = R;
      w || (U(E), U(D), Z.current = !0, F.current = !1);
    }
    return i.on("openchange", b), () => {
      i.off("openchange", b);
    };
  }, [c, i]), s.useEffect(() => {
    if (!c || !v.current || !n) return;
    function b(w) {
      Y() && r(!1, w, "hover");
    }
    const R = ue(a.floating).documentElement;
    return R.addEventListener("mouseleave", b), () => {
      R.removeEventListener("mouseleave", b);
    };
  }, [a.floating, n, r, c, v, Y]);
  const X = s.useCallback(function(b, R, w) {
    R === void 0 && (R = !0), w === void 0 && (w = "hover");
    const I = ye(M.current, "close", O.current);
    I && !T.current ? (U(E), E.current = window.setTimeout(() => r(!1, b, w), I)) : R && (U(E), r(!1, b, w));
  }, [M, r]), $ = ge(() => {
    oe.current(), T.current = void 0;
  }), C = ge(() => {
    if (j.current) {
      const b = ue(a.floating).body;
      b.style.pointerEvents = "", b.removeAttribute(Ye), j.current = !1;
    }
  }), m = ge(() => o.current.openEvent ? ["click", "mousedown"].includes(o.current.openEvent.type) : !1);
  s.useEffect(() => {
    if (!c) return;
    function b(y) {
      if (U(E), Z.current = !1, p && !Se(O.current) || g > 0 && !ye(M.current, "open"))
        return;
      const P = ye(M.current, "open", O.current);
      P ? E.current = window.setTimeout(() => {
        B.current || r(!0, y, "hover");
      }, P) : n || r(!0, y, "hover");
    }
    function R(y) {
      if (m()) return;
      oe.current();
      const P = ue(a.floating);
      if (U(D), F.current = !1, v.current && o.current.floatingContext) {
        n || U(E), T.current = v.current({
          ...o.current.floatingContext,
          tree: l,
          x: y.clientX,
          y: y.clientY,
          onClose() {
            C(), $(), m() || X(y, !0, "safe-polygon");
          }
        });
        const ee = T.current;
        P.addEventListener("mousemove", ee), oe.current = () => {
          P.removeEventListener("mousemove", ee);
        };
        return;
      }
      (O.current === "touch" ? !de(a.floating, y.relatedTarget) : !0) && X(y);
    }
    function w(y) {
      m() || o.current.floatingContext && (v.current == null || v.current({
        ...o.current.floatingContext,
        tree: l,
        x: y.clientX,
        y: y.clientY,
        onClose() {
          C(), $(), m() || X(y);
        }
      })(y));
    }
    if (ne(a.domReference)) {
      var I;
      const y = a.domReference;
      return n && y.addEventListener("mouseleave", w), (I = a.floating) == null || I.addEventListener("mouseleave", w), h && y.addEventListener("mousemove", b, {
        once: !0
      }), y.addEventListener("mouseenter", b), y.addEventListener("mouseleave", R), () => {
        var P;
        n && y.removeEventListener("mouseleave", w), (P = a.floating) == null || P.removeEventListener("mouseleave", w), h && y.removeEventListener("mousemove", b), y.removeEventListener("mouseenter", b), y.removeEventListener("mouseleave", R);
      };
    }
  }, [a, c, t, p, g, h, X, $, C, r, n, B, l, M, v, o, m]), J(() => {
    var b;
    if (c && n && (b = v.current) != null && b.__options.blockPointerEvents && Y()) {
      j.current = !0;
      const w = a.floating;
      if (ne(a.domReference) && w) {
        var R;
        const I = ue(a.floating).body;
        I.setAttribute(Ye, "");
        const y = a.domReference, P = l == null || (R = l.nodesRef.current.find((Q) => Q.id === x)) == null || (R = R.context) == null ? void 0 : R.elements.floating;
        return P && (P.style.pointerEvents = ""), I.style.pointerEvents = "none", y.style.pointerEvents = "auto", w.style.pointerEvents = "auto", () => {
          I.style.pointerEvents = "", y.style.pointerEvents = "", w.style.pointerEvents = "";
        };
      }
    }
  }, [c, n, x, a, l, v, Y]), J(() => {
    n || (O.current = void 0, F.current = !1, $(), C());
  }, [n, $, C]), s.useEffect(() => () => {
    $(), U(E), U(D), C();
  }, [c, a.domReference, $, C]);
  const V = s.useMemo(() => {
    function b(R) {
      O.current = R.pointerType;
    }
    return {
      onPointerDown: b,
      onPointerEnter: b,
      onMouseMove(R) {
        const {
          nativeEvent: w
        } = R;
        function I() {
          !Z.current && !B.current && r(!0, w, "hover");
        }
        p && !Se(O.current) || n || g === 0 || F.current && R.movementX ** 2 + R.movementY ** 2 < 2 || (U(D), O.current === "touch" ? I() : (F.current = !0, D.current = window.setTimeout(I, g)));
      }
    };
  }, [p, r, n, B, g]), z = s.useMemo(() => ({
    onMouseEnter() {
      U(E);
    },
    onMouseLeave(b) {
      m() || X(b.nativeEvent, !1);
    }
  }), [X, m]);
  return s.useMemo(() => c ? {
    reference: V,
    floating: z
  } : {}, [c, V, z]);
}
function Fr(t, e) {
  let n = t.filter((o) => {
    var i;
    return o.parentId === e && ((i = o.context) == null ? void 0 : i.open);
  }), r = n;
  for (; r.length; )
    r = t.filter((o) => {
      var i;
      return (i = r) == null ? void 0 : i.some((a) => {
        var c;
        return o.parentId === a.id && ((c = o.context) == null ? void 0 : c.open);
      });
    }), n = n.concat(r);
  return n;
}
const wt = () => ({
  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 yt(t, e) {
  const n = ht(t, wt());
  e === "prev" && n.reverse();
  const r = n.indexOf(ir(ue(t)));
  return n.slice(r + 1)[0];
}
function zr() {
  return yt(document.body, "next");
}
function Gr() {
  return yt(document.body, "prev");
}
function Ee(t, e) {
  const n = e || t.currentTarget, r = t.relatedTarget;
  return !r || !de(n, r);
}
function $r(t) {
  ht(t, wt()).forEach((n) => {
    n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
  });
}
function Xe(t) {
  t.querySelectorAll("[data-tabindex]").forEach((n) => {
    const r = n.dataset.tabindex;
    delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
  });
}
const Et = {
  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
}, qe = /* @__PURE__ */ s.forwardRef(function(e, n) {
  const [r, o] = s.useState();
  J(() => {
    sr() && o("button");
  }, []);
  const i = {
    ref: n,
    tabIndex: 0,
    // Role is only for VoiceOver
    role: r,
    "aria-hidden": r ? void 0 : !0,
    [ze("focus-guard")]: "",
    style: Et
  };
  return /* @__PURE__ */ f("span", {
    ...e,
    ...i
  });
}), Rt = /* @__PURE__ */ s.createContext(null), Ke = /* @__PURE__ */ ze("portal");
function Vr(t) {
  t === void 0 && (t = {});
  const {
    id: e,
    root: n
  } = t, r = xt(), o = Ur(), [i, a] = s.useState(null), c = s.useRef(null);
  return J(() => () => {
    i?.remove(), queueMicrotask(() => {
      c.current = null;
    });
  }, [i]), J(() => {
    if (!r || c.current) return;
    const u = e ? document.getElementById(e) : null;
    if (!u) return;
    const d = document.createElement("div");
    d.id = r, d.setAttribute(Ke, ""), u.appendChild(d), c.current = d, a(d);
  }, [e, r]), J(() => {
    if (n === null || !r || c.current) return;
    let u = n || o?.portalNode;
    u && !ne(u) && (u = u.current), u = u || document.body;
    let d = null;
    e && (d = document.createElement("div"), d.id = e, u.appendChild(d));
    const p = document.createElement("div");
    p.id = r, p.setAttribute(Ke, ""), u = d || u, u.appendChild(p), c.current = p, a(p);
  }, [e, n, r, o]), i;
}
function Hr(t) {
  const {
    children: e,
    id: n,
    root: r,
    preserveTabOrder: o = !0
  } = t, i = Vr({
    id: n,
    root: r
  }), [a, c] = s.useState(null), u = s.useRef(null), d = s.useRef(null), p = s.useRef(null), g = s.useRef(null), h = a?.modal, l = a?.open, x = (
    // The FocusManager and therefore floating element are currently open/
    // rendered.
    !!a && // Guards are only for non-modal focus management.
    !a.modal && // Don't render if unmount is transitioning.
    a.open && o && !!(r || i)
  );
  return s.useEffect(() => {
    if (!i || !o || h)
      return;
    function v(M) {
      i && Ee(M) && (M.type === "focusin" ? Xe : $r)(i);
    }
    return i.addEventListener("focusin", v, !0), i.addEventListener("focusout", v, !0), () => {
      i.removeEventListener("focusin", v, !0), i.removeEventListener("focusout", v, !0);
    };
  }, [i, o, h]), s.useEffect(() => {
    i && (l || Xe(i));
  }, [l, i]), /* @__PURE__ */ A(Rt.Provider, {
    value: s.useMemo(() => ({
      preserveTabOrder: o,
      beforeOutsideRef: u,
      afterOutsideRef: d,
      beforeInsideRef: p,
      afterInsideRef: g,
      portalNode: i,
      setFocusManagerState: c
    }), [o, i]),
    children: [x && i && /* @__PURE__ */ f(qe, {
      "data-type": "outside",
      ref: u,
      onFocus: (v) => {
        if (Ee(v, i)) {
          var M;
          (M = p.current) == null || M.focus();
        } else {
          const B = Gr() || a?.domReference;
          B?.focus();
        }
      }
    }), x && i && /* @__PURE__ */ f("span", {
      "aria-owns": i.id,
      style: Et
    }), i && /* @__PURE__ */ bn.createPortal(e, i), x && i && /* @__PURE__ */ f(qe, {
      "data-type": "outside",
      ref: d,
      onFocus: (v) => {
        if (Ee(v, i)) {
          var M;
          (M = g.current) == null || M.focus();
        } else {
          const B = zr() || a?.domReference;
          B?.focus(), a?.closeOnFocusOut && a?.onOpenChange(!1, v.nativeEvent, "focus-out");
        }
      }
    })]
  });
}
const Ur = () => s.useContext(Rt), Wr = "data-floating-ui-focusable";
function jr(t) {
  const {
    open: e = !1,
    onOpenChange: n,
    elements: r
  } = t, o = xt(), i = s.useRef({}), [a] = s.useState(() => Ar()), c = Ct() != null;
  if (process.env.NODE_ENV !== "production") {
    const l = r.reference;
    l && !ne(l) && kr("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
  }
  const [u, d] = s.useState(r.reference), p = ge((l, x, v) => {
    i.current.openEvent = l ? x : void 0, a.emit("openchange", {
      open: l,
      event: x,
      reason: v,
      nested: c
    }), n?.(l, x, v);
  }), g = s.useMemo(() => ({
    setPositionReference: d
  }), []), h = s.useMemo(() => ({
    reference: u || r.reference || null,
    floating: r.floating || null,
    domReference: r.reference
  }), [u, r.reference, r.floating]);
  return s.useMemo(() => ({
    dataRef: i,
    open: e,
    onOpenChange: p,
    elements: h,
    events: a,
    floatingId: o,
    refs: g
  }), [e, p, h, a, o, g]);
}
function Yr(t) {
  t === void 0 && (t = {});
  const {
    nodeId: e
  } = t, n = jr({
    ...t,
    elements: {
      reference: null,
      floating: null,
      ...t.elements
    }
  }), r = t.rootContext || n, o = r.elements, [i, a] = s.useState(null), [c, u] = s.useState(null), p = o?.domReference || i, g = s.useRef(null), h = Mt();
  J(() => {
    p && (g.current = p);
  }, [p]);
  const l = fn({
    ...t,
    elements: {
      ...o,
      ...c && {
        reference: c
      }
    }
  }), x = s.useCallback((E) => {
    const T = ne(E) ? {
      getBoundingClientRect: () => E.getBoundingClientRect(),
      contextElement: E
    } : E;
    u(T), l.refs.setReference(T);
  }, [l.refs]), v = s.useCallback((E) => {
    (ne(E) || E === null) && (g.current = E, a(E)), (ne(l.refs.reference.current) || l.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.
    E !== null && !ne(E)) && l.refs.setReference(E);
  }, [l.refs]), M = s.useMemo(() => ({
    ...l.refs,
    setReference: v,
    setPositionReference: x,
    domReference: g
  }), [l.refs, v, x]), B = s.useMemo(() => ({
    ...l.elements,
    domReference: p
  }), [l.elements, p]), O = s.useMemo(() => ({
    ...l,
    ...r,
    refs: M,
    elements: B,
    nodeId: e
  }), [l, M, B, e, r]);
  return J(() => {
    r.dataRef.current.floatingContext = O;
    const E = h?.nodesRef.current.find((T) => T.id === e);
    E && (E.context = O);
  }), s.useMemo(() => ({
    ...l,
    context: O,
    refs: M,
    elements: B
  }), [l, M, B, O]);
}
const Je = "active", Ze = "selected";
function Re(t, e, n) {
  const r = /* @__PURE__ */ new Map(), o = n === "item";
  let i = t;
  if (o && t) {
    const {
      [Je]: a,
      [Ze]: c,
      ...u
    } = t;
    i = u;
  }
  return {
    ...n === "floating" && {
      tabIndex: -1,
      [Wr]: ""
    },
    ...i,
    ...e.map((a) => {
      const c = a ? a[n] : null;
      return typeof c == "function" ? t ? c(t) : null : c;
    }).concat(t).reduce((a, c) => (c && Object.entries(c).forEach((u) => {
      let [d, p] = u;
      if (!(o && [Je, Ze].includes(d)))
        if (d.indexOf("on") === 0) {
          if (r.has(d) || r.set(d, []), typeof p == "function") {
            var g;
            (g = r.get(d)) == null || g.push(p), a[d] = function() {
              for (var h, l = arguments.length, x = new Array(l), v = 0; v < l; v++)
                x[v] = arguments[v];
              return (h = r.get(d)) == null ? void 0 : h.map((M) => M(...x)).find((M) => M !== void 0);
            };
          }
        } else
          a[d] = p;
    }), a), {})
  };
}
function Xr(t) {
  t === void 0 && (t = []);
  const e = t.map((c) => c?.reference), n = t.map((c) => c?.floating), r = t.map((c) => c?.item), o = s.useCallback(
    (c) => Re(c, t, "reference"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    e
  ), i = s.useCallback(
    (c) => Re(c, t, "floating"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    n
  ), a = s.useCallback(
    (c) => Re(c, t, "item"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    r
  );
  return s.useMemo(() => ({
    getReferenceProps: o,
    getFloatingProps: i,
    getItemProps: a
  }), [o, i, a]);
}
function Qe(t, e) {
  const [n, r] = t;
  let o = !1;
  const i = e.length;
  for (let a = 0, c = i - 1; a < i; c = a++) {
    const [u, d] = e[a] || [0, 0], [p, g] = e[c] || [0, 0];
    d >= r != g >= r && n <= (p - u) * (r - d) / (g - d) + u && (o = !o);
  }
  return o;
}
function qr(t, e) {
  return t[0] >= e.x && t[0] <= e.x + e.width && t[1] >= e.y && t[1] <= e.y + e.height;
}
function Kr(t) {
  t === void 0 && (t = {});
  const {
    buffer: e = 0.5,
    blockPointerEvents: n = !1,
    requireIntent: r = !0
  } = t;
  let o, i = !1, a = null, c = null, u = performance.now();
  function d(g, h) {
    const l = performance.now(), x = l - u;
    if (a === null || c === null || x === 0)
      return a = g, c = h, u = l, null;
    const v = g - a, M = h - c, O = Math.sqrt(v * v + M * M) / x;
    return a = g, c = h, u = l, O;
  }
  const p = (g) => {
    let {
      x: h,
      y: l,
      placement: x,
      elements: v,
      onClose: M,
      nodeId: B,
      tree: O
    } = g;
    return function(T) {
      function D() {
        clearTimeout(o), M();
      }
      if (clearTimeout(o), !v.domReference || !v.floating || x == null || h == null || l == null)
        return;
      const {
        clientX: Z,
        clientY: j
      } = T, oe = [Z, j], F = cr(T), Y = T.type === "mouseleave", X = de(v.floating, F), $ = de(v.domReference, F), C = v.domReference.getBoundingClientRect(), m = v.floating.getBoundingClientRect(), V = x.split("-")[0], z = h > m.right - m.width / 2, b = l > m.bottom - m.height / 2, R = qr(oe, C), w = m.width > C.width, I = m.height > C.height, y = (w ? C : m).left, P = (w ? C : m).right, Q = (I ? C : m).top, ee = (I ? C : m).bottom;
      if (X && (i = !0, !Y))
        return;
      if ($ && (i = !1), $ && !Y) {
        i = !0;
        return;
      }
      if (Y && ne(T.relatedTarget) && de(v.floating, T.relatedTarget) || O && Fr(O.nodesRef.current, B).some((G) => {
        let {
          context: N
        } = G;
        return N?.open;
      }))
        return;
      if (V === "top" && l >= C.bottom - 1 || V === "bottom" && l <= C.top + 1 || V === "left" && h >= C.right - 1 || V === "right" && h <= C.left + 1)
        return D();
      let L = [];
      switch (V) {
        case "top":
          L = [[y, C.top + 1], [y, m.bottom - 1], [P, m.bottom - 1], [P, C.top + 1]];
          break;
        case "bottom":
          L = [[y, m.top + 1], [y, C.bottom - 1], [P, C.bottom - 1], [P, m.top + 1]];
          break;
        case "left":
          L = [[m.right - 1, ee], [m.right - 1, Q], [C.left + 1, Q], [C.left + 1, ee]];
          break;
        case "right":
          L = [[C.right - 1, ee], [C.right - 1, Q], [m.left + 1, Q], [m.left + 1, ee]];
          break;
      }
      function k(G) {
        let [N, S] = G;
        switch (V) {
          case "top": {
            const q = [w ? N + e / 2 : z ? N + e * 4 : N - e * 4, S + e + 1], ae = [w ? N - e / 2 : z ? N + e * 4 : N - e * 4, S + e + 1], ie = [[m.left, z || w ? m.bottom - e : m.top], [m.right, z ? w ? m.bottom - e : m.top : m.bottom - e]];
            return [q, ae, ...ie];
          }
          case "bottom": {
            const q = [w ? N + e / 2 : z ? N + e * 4 : N - e * 4, S - e], ae = [w ? N - e / 2 : z ? N + e * 4 : N - e * 4, S - e], ie = [[m.left, z || w ? m.top + e : m.bottom], [m.right, z ? w ? m.top + e : m.bottom : m.top + e]];
            return [q, ae, ...ie];
          }
          case "left": {
            const q = [N + e + 1, I ? S + e / 2 : b ? S + e * 4 : S - e * 4], ae = [N + e + 1, I ? S - e / 2 : b ? S + e * 4 : S - e * 4];
            return [...[[b || I ? m.right - e : m.left, m.top], [b ? I ? m.right - e : m.left : m.right - e, m.bottom]], q, ae];
          }
          case "right": {
            const q = [N - e, I ? S + e / 2 : b ? S + e * 4 : S - e * 4], ae = [N - e, I ? S - e / 2 : b ? S + e * 4 : S - e * 4], ie = [[b || I ? m.left + e : m.right, m.top], [b ? I ? m.left + e : m.right : m.left + e, m.bottom]];
            return [q, ae, ...ie];
          }
        }
      }
      if (!Qe([Z, j], L)) {
        if (i && !R)
          return D();
        if (!Y && r) {
          const G = d(T.clientX, T.clientY);
          if (G !== null && G < 0.1)
            return D();
        }
        Qe([Z, j], k([h, l])) ? !i && r && (o = window.setTimeout(D, 40)) : D();
      }
    };
  };
  return p.__options = {
    blockPointerEvents: n
  }, p;
}
var Ge = "ContextMenu", [Jr] = sn(Ge, [
  lt
]), _ = lt(), [Zr, St] = Jr(Ge), It = (t) => {
  const { __scopeContextMenu: e, children: n, onOpenChange: r, dir: o, modal: i = !0 } = t, [a, c] = s.useState(!1), u = _(e), d = pn(r), p = s.useCallback(
    (g) => {
      c(g), d(g);
    },
    [d]
  );
  return /* @__PURE__ */ f(
    Zr,
    {
      scope: e,
      open: a,
      onOpenChange: p,
      modal: i,
      children: /* @__PURE__ */ f(
        Fn,
        {
          ...u,
          dir: o,
          open: a,
          onOpenChange: p,
          modal: i,
          children: n
        }
      )
    }
  );
};
It.displayName = Ge;
var Pt = "ContextMenuTrigger", Nt = s.forwardRef(
  (t, e) => {
    const { __scopeContextMenu: n, disabled: r = !1, ...o } = t, i = St(Pt, n), a = _(n), c = s.useRef({ x: 0, y: 0 }), u = s.useRef({
      getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...c.current })
    }), d = s.useRef(0), p = s.useCallback(
      () => window.clearTimeout(d.current),
      []
    ), g = (h) => {
      c.current = { x: h.clientX, y: h.clientY }, i.onOpenChange(!0);
    };
    return s.useEffect(() => p, [p]), s.useEffect(() => void (r && p()), [r, p]), /* @__PURE__ */ A(te, { children: [
      /* @__PURE__ */ f(zn, { ...a, virtualRef: u }),
      /* @__PURE__ */ f(
        cn.span,
        {
          "data-state": i.open ? "open" : "closed",
          "data-disabled": r ? "" : void 0,
          ...o,
          ref: e,
          style: { WebkitTouchCallout: "none", ...t.style },
          onContextMenu: r ? t.onContextMenu : se(t.onContextMenu, (h) => {
            p(), g(h), h.preventDefault();
          }),
          onPointerDown: r ? t.onPointerDown : se(
            t.onPointerDown,
            me((h) => {
              p(), d.current = window.setTimeout(() => g(h), 700);
            })
          ),
          onPointerMove: r ? t.onPointerMove : se(t.onPointerMove, me(p)),
          onPointerCancel: r ? t.onPointerCancel : se(t.onPointerCancel, me(p)),
          onPointerUp: r ? t.onPointerUp : se(t.onPointerUp, me(p))
        }
      )
    ] });
  }
);
Nt.displayName = Pt;
var Qr = "ContextMenuPortal", Tt = (t) => {
  const { __scopeContextMenu: e, ...n } = t, r = _(e);
  return /* @__PURE__ */ f(Gn, { ...r, ...n });
};
Tt.displayName = Qr;
var Bt = "ContextMenuContent", Ot = s.forwardRef(
  (t, e) => {
    const { __scopeContextMenu: n, ...r } = t, o = St(Bt, n), i = _(n), a = s.useRef(!1);
    return /* @__PURE__ */ f(
      $n,
      {
        ...i,
        ...r,
        ref: e,
        side: "right",
        sideOffset: 2,
        align: "start",
        onCloseAutoFocus: (c) => {
          t.onCloseAutoFocus?.(c), !c.defaultPrevented && a.current && c.preventDefault(), a.current = !1;
        },
        onInteractOutside: (c) => {
          t.onInteractOutside?.(c), !c.defaultPrevented && !o.modal && (a.current = !0);
        },
        style: {
          ...t.style,
          "--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
          "--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
          "--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
          "--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
          "--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
        }
      }
    );
  }
);
Ot.displayName = Bt;
var eo = "ContextMenuGroup", kt = s.forwardRef(
  (t, e) => {
    const { __scopeContextMenu: n, ...r } = t, o = _(n);
    return /* @__PURE__ */ f(Vn, { ...o, ...r, ref: e });
  }
);
kt.displayName = eo;
var to = "ContextMenuLabel", At = s.forwardRef(
  (t, e) => {
    const { __scopeContextMenu: n, ...r } = t, o = _(n);
    return /* @__PURE__ */ f(Hn, { ...o, ...r, ref: e });
  }
);
At.displayName = to;
var no = "ContextMenuItem", _t = s.forwardRef(
  (t, e) => {
    const { __scopeContextMenu: n, ...r } = t, o = _(n);
    return /* @__PURE__ */ f(Un, { ...o, ...r, ref: e });
  }
);
_t.displayName = no;
var ro = "ContextMenuCheckboxItem", Dt = s.forwardRef((t, e) => {
  const { __scopeContextMenu: n, ...r } = t, o = _(n);
  return /* @__PURE__ */ f(qn, { ...o, ...r, ref: e });
});
Dt.displayName = ro;
var oo = "ContextMenuRadioGroup", Lt = s.forwardRef((t, e) => {
  const { __scopeContextMenu: n, ...r } = t, o = _(n);
  return /* @__PURE__ */ f(Jn, { ...o, ...r, ref: e });
});
Lt.displayName = oo;
var ao = "ContextMenuRadioItem", Ft = s.forwardRef((t, e) => {
  const { __scopeContextMenu: n, ...r } = t, o = _(n);
  return /* @__PURE__ */ f(Zn, { ...o, ...r, ref: e });
});
Ft.displayName = ao;
var io = "ContextMenuItemIndicator", zt = s.forwardRef((t, e) => {
  const { __scopeContextMenu: n, ...r } = t, o = _(n);
  return /* @__PURE__ */ f(Kn, { ...o, ...r, ref: e });
});
zt.displayName = io;
var so = "ContextMenuSeparator", Gt = s.forwardRef((t, e) => {
  const { __scopeContextMenu: n, ...r } = t, o = _(n);
  return /* @__PURE__ */ f(Wn, { ...o, ...r, ref: e });
});
Gt.displayName = so;
var co = "ContextMenuArrow", lo = s.forwardRef(
  (t, e) => {
    const { __scopeContextMenu: n, ...r } = t, o = _(n);
    return /* @__PURE__ */ f(Qn, { ...o, ...r, ref: e });
  }
);
lo.displayName = co;
var $t = "ContextMenuSub", Vt = (t) => {
  const { __scopeContextMenu: e, children: n, onOpenChange: r, open: o, defaultOpen: i } = t, a = _(e), [c, u] = ln({
    prop: o,
    defaultProp: i ?? !1,
    onChange: r,
    caller: $t
  });
  return /* @__PURE__ */ f(jn, { ...a, open: c, onOpenChange: u, children: n });
};
Vt.displayName = $t;
var uo = "ContextMenuSubTrigger", Ht = s.forwardRef((t, e) => {
  const { __scopeContextMenu: n, ...r } = t, o = _(n);
  return /* @__PURE__ */ f(Yn, { ...o, ...r, ref: e });
});
Ht.displayName = uo;
var fo = "ContextMenuSubContent", Ut = s.forwardRef((t, e) => {
  const { __scopeContextMenu: n, ...r } = t, o = _(n);
  return /* @__PURE__ */ f(
    Xn,
    {
      ...o,
      ...r,
      ref: e,
      style: {
        ...t.style,
        "--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
        "--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
        "--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
        "--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
        "--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
      }
    }
  );
});
Ut.displayName = fo;
function me(t) {
  return (e) => e.pointerType !== "mouse" ? t(e) : void 0;
}
var po = It, mo = Nt, Wt = Tt, go = Ot, vo = kt, ho = At, bo = _t, xo = Dt, Co = Lt, Mo = Ft, jt = zt, wo = Gt, yo = Vt, Eo = Ht, Ro = Ut;
const Yt = (t) => s.createElement(po, { ...t });
Yt.displayName = "ContextMenu.Root";
const Xt = s.forwardRef(({ children: t, ...e }, n) => s.createElement(mo, { ...e, ref: n, asChild: !0 }, rr(t)));
Xt.displayName = "ContextMenu.Trigger";
const qt = s.createContext({}), Kt = s.forwardRef((t, e) => {
  const n = mn(), { size: r = le.size.default, variant: o = le.variant.default, highContrast: i = le.highContrast.default } = t, { className: a, children: c, color: u, container: d, forceMount: p, ...g } = ft(t, le), h = u || n.accentColor;
  return s.createElement(Wt, { container: d, forceMount: p }, s.createElement(ct, { asChild: !0 }, s.createElement(go, { "data-accent-color": h, alignOffset: -Number(r) * 4, collisionPadding: 10, ...g, asChild: !1, ref: e, className: H("rt-PopperContent", "rt-BaseMenuContent", "rt-ContextMenuContent", a) }, s.createElement(ut, { type: "auto" }, s.createElement("div", { className: H("rt-BaseMenuViewport", "rt-ContextMenuViewport") }, s.createElement(qt.Provider, { value: s.useMemo(() => ({ size: r, variant: o, color: h, highContrast: i }), [r, o, h, i]) }, c))))));
});
Kt.displayName = "ContextMenu.Content";
const Jt = s.forwardRef(({ className: t, ...e }, n) => s.createElement(ho, { ...e, asChild: !1, ref: n, className: H("rt-BaseMenuLabel", "rt-ContextMenuLabel", t) }));
Jt.displayName = "ContextMenu.Label";
const K = s.forwardRef((t, e) => {
  const { className: n, children: r, color: o = er.color.default, shortcut: i, ...a } = t;
  return s.createElement(bo, { "data-accent-color": o, ...a, ref: e, className: H("rt-reset", "rt-BaseMenuItem", "rt-ContextMenuItem", n) }, s.createElement(_e, null, r), i && s.createElement("div", { className: "rt-BaseMenuShortcut rt-ContextMenuShortcut" }, i));
});
K.displayName = "ContextMenu.Item";
const So = s.forwardRef(({ className: t, ...e }, n) => s.createElement(vo, { ...e, asChild: !1, ref: n, className: H("rt-BaseMenuGroup", "rt-ContextMenuGroup", t) }));
So.displayName = "ContextMenu.Group";
const Io = s.forwardRef(({ className: t, ...e }, n) => s.createElement(Co, { ...e, asChild: !1, ref: n, className: H("rt-BaseMenuRadioGroup", "rt-ContextMenuRadioGroup", t) }));
Io.displayName = "ContextMenu.RadioGroup";
const Po = s.forwardRef((t, e) => {
  const { children: n, className: r, color: o = nr.color.default, ...i } = t;
  return s.createElement(Mo, { ...i, asChild: !1, ref: e, "data-accent-color": o, className: H("rt-BaseMenuItem", "rt-BaseMenuRadioItem", "rt-ContextMenuItem", "rt-ContextMenuRadioItem", r) }, s.createElement(_e, null, n), s.createElement(jt, { className: "rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator" }, s.createElement(dt, { className: "rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon" })));
});
Po.displayName = "ContextMenu.RadioItem";
const Ne = s.forwardRef((t, e) => {
  const { children: n, className: r, shortcut: o, color: i = tr.color.default, ...a } = t;
  return s.createElement(xo, { ...a, asChild: !1, ref: e, "data-accent-color": i, className: H("rt-BaseMenuItem", "rt-BaseMenuCheckboxItem", "rt-ContextMenuItem", "rt-ContextMenuCheckboxItem", r) }, s.createElement(_e, null, n), s.createElement(jt, { className: "rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator" }, s.createElement(dt, { className: "rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon" })), o && s.createElement("div", { className: "rt-BaseMenuShortcut rt-ContextMenuShortcut" }, o));
});
Ne.displayName = "ContextMenu.CheckboxItem";
const Te = (t) => s.createElement(yo, { ...t });
Te.displayName = "ContextMenu.Sub";
const Be = s.forwardRef((t, e) => {
  const { className: n, children: r, ...o } = t;
  return s.createElement(Eo, { ...o, asChild: !1, ref: e, className: H("rt-BaseMenuItem", "rt-BaseMenuSubTrigger", "rt-ContextMenuItem", "rt-ContextMenuSubTrigger", n) }, r, s.createElement("div", { className: "rt-BaseMenuShortcut rt-ContextMenuShortcut" }, s.createElement(or, { className: "rt-BaseMenuSubTriggerIcon rt-ContextMenuSubTriggerIcon" })));
});
Be.displayName = "ContextMenu.SubTrigger";
const Oe = s.forwardRef((t, e) => {
  const { size: n, variant: r, color: o, highContrast: i } = s.useContext(qt), { className: a, children: c, container: u, forceMount: d, ...p } = ft({ size: n, variant: r, color: o, highContrast: i, ...t }, le);
  return s.createElement(Wt, { container: u, forceMount: d }, s.createElement(ct, { asChild: !0 }, s.createElement(Ro, { "data-accent-color": o, alignOffset: -Number(n) * 4, sideOffset: 1, collisionPadding: 10, ...p, asChild: !1, ref: e, className: H("rt-PopperContent", "rt-BaseMenuContent", "rt-BaseMenuSubContent", "rt-ContextMenuContent", "rt-ContextMenuSubContent", a) }, s.createElement(ut, { type: "auto" }, s.createElement("div", { className: H("rt-BaseMenuViewport", "rt-ContextMenuViewport") }, c)))));
});
Oe.displayName = "ContextMenu.SubContent";
const ve = s.forwardRef(({ className: t, ...e }, n) => s.createElement(wo, { ...e, asChild: !1, ref: n, className: H("rt-BaseMenuSeparator", "rt-ContextMenuSeparator", t) }));
ve.displayName = "ContextMenu.Separator";
function re({
  direction: t,
  show: e,
  manifest: n
}) {
  if (at() === "mobile" && t !== "s" && t !== "n")
    return null;
  const o = n.isContainer ? 8 : 6;
  return /* @__PURE__ */ f(
    "button",
    {
      type: "button",
      className: W(
        "resizable-handle absolute focus:outline-none",
        "overflow-visible z-[9999]",
        `resizable-handle-${t}`,
        {
          "-bottom-[2px] left-0 right-0 h-[6px] cursor-row-resize": t === "s",
          "-top-[2px] left-0 right-0 h-[6px] cursor-row-resize": t === "n",
          "top-0 -left-[2px] bottom-0 w-[6px] cursor-col-resize": t === "w",
          "top-0 -right-[2px] bottom-0 w-[6px] cursor-col-resize": t === "e",
          // sw and nw
          "-bottom-[2px] -left-[2px] w-[6px] h-[6px] cursor-nesw-resize": t === "sw",
          "-top-[2px] -left-[2px] w-[6px] h-[6px] cursor-nwse-resize": t === "nw",
          // se and ne
          "-bottom-[2px] -right-[2px] w-[6px] h-[6px] cursor-nwse-resize": t === "se",
          "-top-[2px] -right-[2px] w-[6px] h-[6px] cursor-nesw-resize": t === "ne"
        }
      ),
      children: /* @__PURE__ */ f(
        "div",
        {
          className: W(
            "z-[9999] absolute w-[10px] h-[10px] bg-white border-2 rounded-full shadow-md resizable-handle-dot",
            n.isContainer ? "border-orange-500" : "border-upstart-500",
            e && "opacity-100",
            {
              [`top-1/2 -translate-y-1/2 -left-[${o}px]`]: t === "w",
              [`top-1/2 -translate-y-1/2 -right-[${o}px]`]: t === "e",
              [`left-1/2 -translate-x-1/2 -top-[${o}px]`]: t === "n",
              [`left-1/2 -translate-x-1/2 -bottom-[${o}px]`]: t === "s",
              // sw and nw
              [`-bottom-[${o}px] -left-[${o}px]`]: t === "sw",
              [`-top-[${o}px] -left-[${o}px]`]: t === "nw",
              // se and ne
              [`-bottom-[${o}px] -right-[${o}px]`]: t === "se",
              [`-top-[${o}px] -right-[${o}px]`]: t === "ne"
            }
          )
        }
      )
    }
  );
}
function No(t) {
  const { resizable: e } = t;
  return {
    canGrowVertical: e === !0 || e === "vertical",
    canGrowHorizontal: e === !0 || e === "horizontal",
    canShrinkVertical: e === !0 || e === "vertical",
    canShrinkHorizontal: e === !0 || e === "horizontal"
  };
}
function To(t = {}) {
  const { tolerance: e = 0, deepCheck: n = !1 } = t, r = he(null), [o, i] = be(!1);
  return Me(() => {
    const a = r.current;
    if (!a) return;
    const c = (p) => {
      const g = a.getBoundingClientRect(), { clientX: h, clientY: l } = p;
      if (!(h >= g.left - e && h <= g.right + e && l >= g.top - e && l <= g.bottom + e)) {
        ce(() => {
          i(!1);
        });
        return;
      }
      if (n) {
        const v = document.elementFromPoint(h, l), M = v === a || a.contains(v);
        ce(() => {
          i(M);
        });
      } else
        ce(() => {
          i(!0);
        });
    }, u = () => {
      ce(() => {
        i(!1);
      });
    }, d = new AbortController();
    return document.addEventListener("mousemove", c, { signal: d.signal }), a.addEventListener("mouseleave", u, { signal: d.signal }), () => {
      d.abort();
    };
  }, [e, n]), { ref: r, isHovered: o };
}
var Bo = Object.defineProperty, Oo = Object.defineProperties, ko = Object.getOwnPropertyDescriptors, et = Object.getOwnPropertySymbols, Ao = Object.prototype.hasOwnProperty, _o = Object.prototype.propertyIsEnumerable, tt = (t, e, n) => e in t ? Bo(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, $e = (t, e) => {
  for (var n in e || (e = {}))
    Ao.call(e, n) && tt(t, n, e[n]);
  if (et)
    for (var n of et(e))
      _o.call(e, n) && tt(t, n, e[n]);
  return t;
}, Zt = (t, e) => Oo(t, ko(e)), ke = class extends Fe {
  /**
   * Applies the axis restriction to the drag operation.
   *
   * @param operation - The current drag operation
   * @returns The modified transform with the axis restriction applied
   */
  apply({ transform: e }) {
    if (!this.options)
      return e;
    const { axis: n, value: r } = this.options;
    return Zt($e({}, e), {
      [n]: r
    });
  }
};
ke.configure = Le(ke);
var Qt = ke;
Qt.configure({
  axis: "x",
  value: 0
});
Qt.configure({
  axis: "y",
  value: 0
});
function Do(t, e, n) {
  const r = $e({}, e);
  return t.boundingRectangle.top + e.y <= n.top ? r.y = n.top - t.boundingRectangle.top : t.boundingRectangle.bottom + e.y >= n.top + n.height && (r.y = n.top + n.height - t.boundingRectangle.bottom), t.boundingRectangle.left + e.x <= n.left ? r.x = n.left - t.boundingRectangle.left : t.boundingRectangle.right + e.x >= n.left + n.width && (r.x = n.left + n.width - t.boundingRectangle.right), r;
}
var nt = class extends Fe {
  /**
   * Applies the snap grid to the drag operation.
   *
   * @param operation - The current drag operation
   * @returns The modified transform with coordinates snapped to the grid
   */
  apply({ transform: e }) {
    var n;
    const { size: r = 20 } = (n = this.options) != null ? n : {}, o = typeof r == "number" ? r : r.x, i = typeof r == "number" ? r : r.y;
    return Zt($e({}, e), {
      x: Math.ceil(e.x / o) * o,
      y: Math.ceil(e.y / i) * i
    });
  }
};
nt.configure = Le(nt);
var Ae = class extends Fe {
  constructor(e, n) {
    super(e, n), this.boundingRectangle = Rn(null), this.destroy = Sn(() => {
      if (!this.options)
        return;
      const { dragOperation: r } = e, { status: o } = r;
      if (o.initialized) {
        const { element: i } = this.options, a = typeof i == "function" ? i(r) : i;
        if (!a)
          return;
        let c;
        const u = () => {
          this.boundingRectangle.value = Pn(a);
        }, d = () => {
          c || (c = setTimeout(() => {
            u(), c = void 0;
          }, 25));
        }, p = new ResizeObserver(u);
        return p.observe(a), document.addEventListener("scroll", d, {
          passive: !0,
          capture: !0
        }), () => {
          document.removeEventListener("scroll", d, {
            capture: !0
          }), p.disconnect(), this.boundingRectangle.value = null;
        };
      }
    });
  }
  apply(e) {
    const { shape: n, transform: r } = e;
    if (!n)
      return r;
    const o = this.boundingRectangle.value;
    if (!o)
      return r;
    const { initial: i, current: a } = n, { height: c, width: u } = a.boundingRectangle, d = i.center.x - u / 2, p = i.center.y - c / 2;
    return Do(
      new In(d, p, u, c),
      r,
      o
    );
  }
};
Ae.configure = Le(Ae);
var Lo = Ae;
function Fo(t) {
  const [e, n] = be(!1);
  return Me(() => {
    const r = (a) => {
      (a.key === t || a.metaKey || a.ctrlKey) && n(!0);
    }, o = (a) => {
      (a.key === t || !a.metaKey && !a.ctrlKey) && n(!1);
    }, i = () => {
      n(!1);
    };
    return window.addEventListener("keydown", r), window.addEventListener("keyup", o), window.addEventListener("blur", i), () => {
      window.removeEventListener("keydown", r), window.removeEventListener("keyup", o), window.removeEventListener("blur", i);
    };
  }, [t]), e;
}
function zo() {
  return Fo("Meta");
}
function Go({ brick: t }) {
  const e = De(), n = pe(t.type), r = e.canMoveTo(t.id, "previous"), o = e.canMoveTo(t.id, "next"), i = e.getParentBrick(t.id), a = !!i, c = i ? document.getElementById(i.id) : null, u = c && getComputedStyle(c).flexDirection || "row", d = a && r && u === "row" || !a && r, p = a && o && u === "row" || !a && o, g = a && r && u === "column", h = a && o && u === "column", l = n.isContainer ? 9 : 7, x = "absolute z-[9999] flex items-center justify-center h-5 w-5 rounded-full border border-white text-white bg-upstart-500 shadow-lg hover:(bg-upstart-700)";
  return /* @__PURE__ */ A(te, { children: [
    d && /* @__PURE__ */ f(
      "button",
      {
        type: "button",
        className: W(x, `top-1/2 -left-${l} transform -translate-y-1/2`),
        onClick: (v) => {
          v.stopPropagation(), e.moveBrick(t.id, "previous");
        },
        children: /* @__PURE__ */ f(On, { className: "w-3 h-3" })
      }
    ),
    g && /* @__PURE__ */ f(
      "button",
      {
        type: "button",
        className: W(x, `-top-${l} left-1/2 transform -translate-x-1/2`),
        onClick: (v) => {
          v.stopPropagation(), e.moveBrick(t.id, "previous");
        },
        children: /* @__PURE__ */ f(kn, { className: "w-3 h-3" })
      }
    ),
    p && /* @__PURE__ */ f(
      "button",
      {
        type: "button",
        className: W(x, `top-1/2 -right-${l} transform -translate-y-1/2`),
        onClick: (v) => {
          v.stopPropagation(), e.moveBrick(t.id, "next");
        },
        children: /* @__PURE__ */ f(An, { className: "w-3 h-3" })
      }
    ),
    h && /* @__PURE__ */ f(
      "button",
      {
        type: "button",
        className: W(x, `-bottom-${l} left-1/2 transform -translate-x-1/2`),
        onClick: (v) => {
          v.stopPropagation(), e.moveBrick(t.id, "next");
        },
        children: /* @__PURE__ */ f(_n, { className: "w-3 h-3" })
      }
    )
  ] });
}
const $o = ot(
  ({ brick: t, isContainerChild: e, children: n }, r) => {
    const o = De(), i = it(), a = nn(), c = pe(t.type), u = o.canMoveTo(t.id, "previous"), d = o.canMoveTo(t.id, "next"), p = o.getParentBrick(t.id), g = p ? document.getElementById(p.id) : null, h = g && getComputedStyle(g).flexDirection || "row";
    return /* @__PURE__ */ A(
      Yt,
      {
        modal: !1,
        onOpenChange: (l) => {
          i.setContextMenuVisible(l);
        },
        children: [
          /* @__PURE__ */ f(Xt, { disabled: a, ref: r, children: n }),
          /* @__PURE__ */ f(Dn, { children: /* @__PURE__ */ A(Kt, { className: "nodrag", size: "2", children: [
            /* @__PURE__ */ A(Jt, { className: "!text-sm", children: [
              c.name,
              " (brick)"
            ] }),
            c.duplicatable && /* @__PURE__ */ f(
              K,
              {
                shortcut: "⌘D",
                onClick: (l) => {
                  l.stopPropagation(), o.duplicateBrick(t.id);
                },
                children: "Duplicate"
              }
            ),
            /* @__PURE__ */ f(
              K,
              {
                onClick: (l) => {
                  l.stopPropagation(), navigator.clipboard.writeText(JSON.stringify(t)), un(
                    `Brick "${c.name}" copied to clipboard. You can paste it on this page or another page.`,
                    {
                      className: "min-w-fit"
                    }
                  );
                },
                children: "Copy brick"
              }
            ),
            u && /* @__PURE__ */ f(
              K,
              {
                shortcut: e ? "⌘↑" : "⌘←",
                onClick: (l) => {
                  l.stopPropagation(), o.moveBrick(t.id, "previous");
                },
                children: e && h === "column" ? "Move up" : "Move left"
              }
            ),
            d && /* @__PURE__ */ f(
              K,
              {
                shortcut: e ? "⌘↓" : "⌘→",
                onClick: (l) => {
                  l.stopPropagation(), o.moveBrick(t.id, "next");
                },
                children: e && h === "column" ? "Move down" : "Move right"
              }
            ),
            /* @__PURE__ */ A(Te, { children: [
              /* @__PURE__ */ f(Be, { children: "Visible on" }),
              /* @__PURE__ */ A(Oe, { children: [
                /* @__PURE__ */ f(
                  Ne,
                  {
                    checked: !t.props.hidden?.mobile,
                    onClick: (l) => l.stopPropagation(),
                    onCheckedChange: () => o.toggleBrickVisibilityPerBreakpoint(t.id, "mobile"),
                    children: "Mobile"
                  }
                ),
                /* @__PURE__ */ f(
                  Ne,
                  {
                    checked: !t.props.hidden?.desktop,
                    onClick: (l) => l.stopPropagation(),
                    onCheckedChange: () => o.toggleBrickVisibilityPerBreakpoint(t.id, "desktop"),
                    children: "Desktop"
                  }
                )
              ] })
            ] }),
            p && /* @__PURE__ */ A(te, { children: [
              /* @__PURE__ */ f(ve, {}),
              /* @__PURE__ */ A(Te, { children: [
                /* @__PURE__ */ f(Be, { children: "Parent container" }),
                /* @__PURE__ */ A(Oe, { children: [
                  /* @__PURE__ */ f(
                    K,
                    {
                      onClick: (l) => {
                        l.stopPropagation(), o.duplicateBrick(p.id);
                      },
                      children: "Duplicate container"
                    }
                  ),
                  /* @__PURE__ */ f(
                    K,
                    {
                      onClick: (l) => {
                        l.stopPropagation(), i.setSelectedBrickId(p.id), i.setPanel("inspector");
                      },
                      children: "Edit container"
                    }
                  ),
                  /* @__PURE__ */ f(ve, {}),
                  /* @__PURE__ */ f(
                    K,
                    {
                      shortcut: "⌫",
                      color: "red",
                      onClick: (l) => {
                        l.stopPropagation(), o.deleteBrick(p.id), i.deselectBrick(p.id), i.hidePanel("inspector");
                      },
                      children: "Delete container"
                    }
                  )
                ] })
              ] }),
              /* @__PURE__ */ f(
                K,
                {
                  onClick: (l) => {
                    l.stopPropagation(), o.detachBrickFromContainer(t.id);
                  },
                  children: "Detach from parent"
                }
              )
            ] }),
            c.deletable && /* @__PURE__ */ A(te, { children: [
              /* @__PURE__ */ f(ve, {}),
              /* @__PURE__ */ f(
                K,
                {
                  shortcut: "⌫",
                  color: "red",
                  onClick: (l) => {
                    l.stopPropagation(), o.deleteBrick(t.id), i.deselectBrick(t.id), i.hidePanel("inspector");
                  },
                  children: "Delete"
                }
              )
            ] })
          ] }) })
        ]
      }
    );
  }
);
function Vo({ brick: t }) {
  return /* @__PURE__ */ f(
    "div",
    {
      id: `text-editor-menu-${t.id}`,
      className: W("contents", Ln, "!empty:hidden")
    }
  );
}
const Ho = ot(
  ({ brick: t, style: e, isContainerChild: n, show: r, ...o }, i) => {
    const a = st(), c = pe(t.type), u = rn(), d = r && c.isContainer && !a || r && !c.isContainer && !n || a === t.id;
    return !d || u ? null : /* @__PURE__ */ f(
      "div",
      {
        ref: i,
        "data-ui": !0,
        "data-ui-menu-bars-container": !0,
        role: "navigation",
        className: W(
          "z-[99999] isolate text-base items-center gap-1",
          "transition-opacity duration-150 border rounded-lg",
          d ? "opacity-100 flex" : "opacity-0 hidden",
          c.isContainer ? "border-orange-300" : "border-transparent"
        ),
        style: e,
        ...o,
        children: /* @__PURE__ */ f(Vo, { brick: t })
      }
    );
  }
);
function Uo(t) {
  return ["bottom", "top"];
}
function rt({
  brick: t,
  index: e,
  level: n = 0,
  isDynamicPreview: r,
  iterationIndex: o
}) {
  const i = he(!1), a = st(), c = at(), { panelPosition: u } = on(), d = it(), { getParentBrick: p, updateBrickProps: g } = De(), h = Mn(t.id), l = pe(t.type), x = p(t.id), [v, M] = be(!1), B = Uo(), O = an(), E = he(null), T = !!x, D = zo(), [Z, j] = be(!1), oe = !!r || !l.movable || T || !!t.props.ghost || c === "mobile";
  Nn({
    onBeforeDragStart(k) {
      j(!0);
    },
    onDragEnd(k) {
      setTimeout(() => {
        j(!1);
      }, 200);
    }
  });
  const { isDragging: F, isDropping: Y, isDropTarget: X, isDragSource: $ } = En({
    id: t.id,
    index: e,
    element: E,
    disabled: oe,
    collisionPriority: Tn.Normal,
    collisionDetector: D ? Bn : void 0,
    type: "brick",
    accept: (k) => k.type === "brick" || k.type === "library",
    group: h?.id,
    data: { brick: t, parentBrick: x, section: h, manifest: l },
    transition: {
      duration: 250,
      // Animation duration in ms
      easing: "cubic-bezier(0.25, 1, 0.5, 1)",
      // Animation easing
      idle: !0
      // Whether to animate when no drag is in progress but its index changes
    },
    modifiers: [
      Lo.configure({
        element: (k) => T ? E.current?.parentElement : document.querySelector("#page-container")
      })
    ]
  }), {
    refs: C,
    floatingStyles: m,
    update: V,
    context: z
  } = Yr({
    open: v,
    onOpenChange: M,
    whileElementsMounted: hn,
    transform: !0,
    middleware: [
      gn(l.isContainer ? { mainAxis: 8, crossAxis: 0 } : { mainAxis: 6, crossAxis: 0 }),
      vn({
        allowedPlacements: B
      })
    ]
  }), b = Lr(z, {
    handleClose: Kr(),
    enabled: !r,
    delay: {
      open: 50,
      close: 200
    }
  }), { getReferenceProps: R, getFloatingProps: w } = Xr([b]);
  Me(() => {
    if (C.reference.current) {
      const k = () => {
        i.current = !0;
      }, G = () => {
        i.current = !1;
      }, N = () => {
        V(), setTimeout(() => {
          i.current = !1;
        }, 200);
      }, S = C.reference.current;
      return S.addEventListener("mousedown", G), S.addEventListener("mouseup", N), S.addEventListener("mousemove", k), () => {
        S.removeEventListener("mousedown", G), S.removeEventListener("mouseup", N), S.removeEventListener("mousemove", k);
      };
    }
  }, [C.reference, V]);
  const I = tn(
    (k) => {
      const G = k.target, N = k.currentTarget;
      if (i.current || !N?.matches("[data-element-kind='brick']") && !G?.matches("[data-element-kind='brick']") || k.defaultPrevented && !G.closest('[data-prevented-by-editor="true"]')) {
        console.debug(
          "EditableBrickWrapper: Click ignored due to mouse movement or default prevented",
          G,
          k
        );
        return;
      }
      if (l.isGlobalBrick) {
        d.setPanel("settings"), d.setAttributesGroup(l.type), d.setAttributesTab("site"), d.setSelectedBrickId(t.id);
        return;
      }
      let S = t, q = "brick";
      k.shiftKey ? x && (console.log("Selecting parent brick", x), S = x) : (k.ctrlKey || k.metaKey) && h && (q = "section", S = h), d.hidePanel(), (u === "left" && k.clientX < window.innerWidth * 0.25 || u === "right" && k.clientX > window.innerWidth * 0.75) && d.togglePanelPosition(), ce(() => {
        q === "section" ? d.setSelectedSectionId(S.id) : (console.log("Selecting brick", S), d.setSelectedBrickId(S.id)), d.setPanel("inspector");
      }), i.current = !1, k.stopPropagation();
    },
    [u]
  ), { ref: y, isHovered: P } = To({ tolerance: 6, deepCheck: !0 }), Q = xn({
    brick: t,
    editable: !0,
    selected: a === t.id,
    isContainerChild: T
  }), ee = Ir([C.setReference, E, y]), L = No(Ve[t.type]);
  return /* @__PURE__ */ f($o, { brick: t, isContainerChild: T, children: /* @__PURE__ */ A(
    "div",
    {
      ref: ee,
      ...R(),
      id: t.id,
      "data-element-kind": "brick",
      "data-brick-id": t.id,
      "data-brick-type": t.type,
      "data-last-touched": t.props.lastTouched ?? "0",
      "data-is-container": l.isContainer,
      "data-is-container-child": T,
      "data-dragging": F,
      "data-level": n,
      "data-index": e,
      "data-brick-width": t.props.width,
      "data-brick-height": t.props.height,
      "data-brick-max-width": JSON.stringify(l.maxWidth),
      "data-brick-min-width": JSON.stringify(l.minWidth),
      className: W(
        Q,
        r && "hover:(opacity-40 grayscale) group-hover/section:(opacity-40 grayscale pointer-events-none)",
        F ? "!z-[9999] !shadow-2xl overflow-hidden !cursor-grabbing" : "hover:cursor-auto",
        r && Z && "scale-0",
        !!t.props.ghost && "opacity-50 pointer-events-none grayscale bg-white"
      ),
      onClick: I,
      children: [
        /* @__PURE__ */ f(
          Cn,
          {
            brick: t,
            selected: a === t.id,
            iterationIndex: o,
            isDynamicPreview: r,
            editable: !0
          }
        ),
        /* @__PURE__ */ f(Hr, { children: /* @__PURE__ */ f(
          Ho,
          {
            ref: C.setFloating,
            brick: t,
            isContainerChild: T,
            style: m,
            show: v,
            ...w()
          }
        ) }),
        Ve[t.type]?.resizable && !O && !F && !r && a === t.id && /* @__PURE__ */ A(te, { children: [
          (L.canGrowVertical || L.canShrinkVertical) && /* @__PURE__ */ A(te, { children: [
            /* @__PURE__ */ f(re, { direction: "s", show: P, manifest: l }),
            /* @__PURE__ */ f(re, { direction: "n", show: P, manifest: l })
          ] }),
          (L.canGrowHorizontal || L.canShrinkHorizontal) && /* @__PURE__ */ A(te, { children: [
            /* @__PURE__ */ f(re, { direction: "w", show: P, manifest: l }),
            /* @__PURE__ */ f(re, { direction: "e", show: P, manifest: l })
          ] }),
          (L.canGrowVertical && L.canGrowHorizontal || L.canShrinkVertical && L.canShrinkHorizontal) && /* @__PURE__ */ A(te, { children: [
            /* @__PURE__ */ f(re, { direction: "se", show: P, manifest: l }),
            /* @__PURE__ */ f(re, { direction: "sw", show: P, manifest: l }),
            /* @__PURE__ */ f(re, { direction: "ne", show: P, manifest: l }),
            /* @__PURE__ */ f(re, { direction: "nw", show: P, manifest: l })
          ] })
        ] }),
        c === "desktop" && !r && t.id === a && /* @__PURE__ */ f(Go, { brick: t }),
        typeof t.props.loop < "u" && !r && /* @__PURE__ */ f(ar, { content: "This brick will be repeated for each item in the query result", children: /* @__PURE__ */ f(
          "div",
          {
            className: W(
              `group-hover/brick:opacity-100 absolute cursor-help -top-[12px] -right-[12px] z-[99999] w-5 h-5 rounded-full
            flex items-center justify-center text-upstart-500 group/dyn-helper bg-white/90 shadow border border-upstart-500`,
              t.id === a ? "opacity-100" : "opacity-0"
            ),
            children: /* @__PURE__ */ f(yn, { className: "w-3 h-3" })
          }
        ) }),
        l.isContainer && !F && X && D && !$ && /* @__PURE__ */ f(
          "div",
          {
            className: W(
              "absolute inset-0 z-auto flex items-center justify-center bg-black/30 font-bold text-white rounded"
            ),
            children: /* @__PURE__ */ f("span", { className: "inline-flex rounded-full px-4 py-2 bg-black/50", children: "Drop in box" })
          }
        )
      ]
    }
  ) });
}
function pa(t) {
  const {
    brick: { props: e, type: n }
  } = t, r = pe(n);
  if (!e.loop?.over || r.consumesMultipleQueryRows)
    return /* @__PURE__ */ f(rt, { ...t });
  const { brick: i, ...a } = t;
  return /* @__PURE__ */ f(te, { children: wn(0, 1).map((c, u) => /* @__PURE__ */ f(
    rt,
    {
      ...a,
      iterationIndex: u,
      isDynamicPreview: u > 0,
      brick: {
        ...i,
        id: u > 0 ? `${i.id}-${u}` : i.id
      }
    },
    c
  )) });
}
export {
  pa as E,
  So as N,
  K as R,
  Xt as S,
  ve as W,
  Yt as h,
  Kt as v,
  Jt as y
};
