import { jsx as s, jsxs as g, Fragment as E } from "react/jsx-runtime";
import * as r from "react";
import { useRef as j, useState as J, useEffect as Y, forwardRef as H, useCallback as Ve, startTransition as We } from "react";
import { a as V, b as q, g as Fe, u as Q, m as Ue, n as Xe, h as Ke, t as je, f as Je } from "./use-editor.BioV43yU.js";
import { k as Ye, c as qe, P as Qe, b as k, a as Ze, y as v, o as W, p as _ } from "./index.B-GbFHzr.js";
import { a as et, o as tt, b as nt, c as ot, s as rt, d as at, u as st, F as it, e as ct } from "./floating-ui.react.C6lNb-PJ.js";
import { c as lt, B as ut } from "./use-section-style.CgktT_qE.js";
import { m as dt } from "./menubar-styles.DM8mXdFr.js";
import { u as F } from "./schema-resolver.OTL7sXPE.js";
import { _ as O } from "./twind.D_WBdNpx.js";
import { P as mt } from "./dnd.esm.ByOls-Fs.js";
import { r as K } from "./chunk-RXIM6GTA.C-ABNABt.js";
import "@sinclair/typebox";
import { f as Z, x as pt } from "./use-page-data.ClF2QKbJ.js";
import { H as ft, I as ee, a as ht } from "./theme.DuOtkXia.js";
import { g as te, j as xt, A as Ct, P as Mt, C as gt, G as vt, L as wt, m as bt, n as Pt, D as Nt, r as It, s as Et, k as St, l as yt, o as Rt, p as Bt, q as kt, a as _t, v as T, w as ne, y as Tt, B as Ot, x as At, t as oe, z as zt } from "./base-menu.props.DGjF8E3t.js";
import { v as re } from "./radius.prop.Qnji8gKF.js";
var U = "ContextMenu", [Dt, Ln] = qe(U, [
  te
]), M = te(), [Gt, ae] = Dt(U), se = (e) => {
  const { __scopeContextMenu: t, children: o, onOpenChange: a, dir: n, modal: i = !0 } = e, [c, d] = r.useState(!1), m = M(t), f = Ye(a), u = r.useCallback(
    (h) => {
      d(h), f(h);
    },
    [f]
  );
  return /* @__PURE__ */ s(
    Gt,
    {
      scope: t,
      open: c,
      onOpenChange: u,
      modal: i,
      children: /* @__PURE__ */ s(
        xt,
        {
          ...m,
          dir: n,
          open: c,
          onOpenChange: u,
          modal: i,
          children: o
        }
      )
    }
  );
};
se.displayName = U;
var ie = "ContextMenuTrigger", ce = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: o, disabled: a = !1, ...n } = e, i = ae(ie, o), c = M(o), d = r.useRef({ x: 0, y: 0 }), m = r.useRef({
      getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...d.current })
    }), f = r.useRef(0), u = r.useCallback(
      () => window.clearTimeout(f.current),
      []
    ), h = (l) => {
      d.current = { x: l.clientX, y: l.clientY }, i.onOpenChange(!0);
    };
    return r.useEffect(() => u, [u]), r.useEffect(() => void (a && u()), [a, u]), /* @__PURE__ */ g(E, { children: [
      /* @__PURE__ */ s(Ct, { ...c, virtualRef: m }),
      /* @__PURE__ */ s(
        Qe.span,
        {
          "data-state": i.open ? "open" : "closed",
          "data-disabled": a ? "" : void 0,
          ...n,
          ref: t,
          style: { WebkitTouchCallout: "none", ...e.style },
          onContextMenu: a ? e.onContextMenu : k(e.onContextMenu, (l) => {
            u(), h(l), l.preventDefault();
          }),
          onPointerDown: a ? e.onPointerDown : k(
            e.onPointerDown,
            A((l) => {
              u(), f.current = window.setTimeout(() => h(l), 700);
            })
          ),
          onPointerMove: a ? e.onPointerMove : k(e.onPointerMove, A(u)),
          onPointerCancel: a ? e.onPointerCancel : k(e.onPointerCancel, A(u)),
          onPointerUp: a ? e.onPointerUp : k(e.onPointerUp, A(u))
        }
      )
    ] });
  }
);
ce.displayName = ie;
var Lt = "ContextMenuPortal", le = (e) => {
  const { __scopeContextMenu: t, ...o } = e, a = M(t);
  return /* @__PURE__ */ s(Mt, { ...a, ...o });
};
le.displayName = Lt;
var ue = "ContextMenuContent", de = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: o, ...a } = e, n = ae(ue, o), i = M(o), c = r.useRef(!1);
    return /* @__PURE__ */ s(
      gt,
      {
        ...i,
        ...a,
        ref: t,
        side: "right",
        sideOffset: 2,
        align: "start",
        onCloseAutoFocus: (d) => {
          var m;
          (m = e.onCloseAutoFocus) == null || m.call(e, d), !d.defaultPrevented && c.current && d.preventDefault(), c.current = !1;
        },
        onInteractOutside: (d) => {
          var m;
          (m = e.onInteractOutside) == null || m.call(e, d), !d.defaultPrevented && !n.modal && (c.current = !0);
        },
        style: {
          ...e.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)"
        }
      }
    );
  }
);
de.displayName = ue;
var $t = "ContextMenuGroup", me = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: o, ...a } = e, n = M(o);
    return /* @__PURE__ */ s(vt, { ...n, ...a, ref: t });
  }
);
me.displayName = $t;
var Ht = "ContextMenuLabel", pe = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: o, ...a } = e, n = M(o);
    return /* @__PURE__ */ s(wt, { ...n, ...a, ref: t });
  }
);
pe.displayName = Ht;
var Vt = "ContextMenuItem", fe = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: o, ...a } = e, n = M(o);
    return /* @__PURE__ */ s(bt, { ...n, ...a, ref: t });
  }
);
fe.displayName = Vt;
var Wt = "ContextMenuCheckboxItem", he = r.forwardRef((e, t) => {
  const { __scopeContextMenu: o, ...a } = e, n = M(o);
  return /* @__PURE__ */ s(St, { ...n, ...a, ref: t });
});
he.displayName = Wt;
var Ft = "ContextMenuRadioGroup", xe = r.forwardRef((e, t) => {
  const { __scopeContextMenu: o, ...a } = e, n = M(o);
  return /* @__PURE__ */ s(Rt, { ...n, ...a, ref: t });
});
xe.displayName = Ft;
var Ut = "ContextMenuRadioItem", Ce = r.forwardRef((e, t) => {
  const { __scopeContextMenu: o, ...a } = e, n = M(o);
  return /* @__PURE__ */ s(Bt, { ...n, ...a, ref: t });
});
Ce.displayName = Ut;
var Xt = "ContextMenuItemIndicator", Me = r.forwardRef((e, t) => {
  const { __scopeContextMenu: o, ...a } = e, n = M(o);
  return /* @__PURE__ */ s(yt, { ...n, ...a, ref: t });
});
Me.displayName = Xt;
var Kt = "ContextMenuSeparator", ge = r.forwardRef((e, t) => {
  const { __scopeContextMenu: o, ...a } = e, n = M(o);
  return /* @__PURE__ */ s(Pt, { ...n, ...a, ref: t });
});
ge.displayName = Kt;
var jt = "ContextMenuArrow", Jt = r.forwardRef(
  (e, t) => {
    const { __scopeContextMenu: o, ...a } = e, n = M(o);
    return /* @__PURE__ */ s(kt, { ...n, ...a, ref: t });
  }
);
Jt.displayName = jt;
var Yt = "ContextMenuSub", ve = (e) => {
  const { __scopeContextMenu: t, children: o, onOpenChange: a, open: n, defaultOpen: i } = e, c = M(t), [d, m] = Ze({
    prop: n,
    defaultProp: i,
    onChange: a
  });
  return /* @__PURE__ */ s(Nt, { ...c, open: d, onOpenChange: m, children: o });
};
ve.displayName = Yt;
var qt = "ContextMenuSubTrigger", we = r.forwardRef((e, t) => {
  const { __scopeContextMenu: o, ...a } = e, n = M(o);
  return /* @__PURE__ */ s(It, { ...n, ...a, ref: t });
});
we.displayName = qt;
var Qt = "ContextMenuSubContent", be = r.forwardRef((e, t) => {
  const { __scopeContextMenu: o, ...a } = e, n = M(o);
  return /* @__PURE__ */ s(
    Et,
    {
      ...n,
      ...a,
      ref: t,
      style: {
        ...e.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)"
      }
    }
  );
});
be.displayName = Qt;
function A(e) {
  return (t) => t.pointerType !== "mouse" ? e(t) : void 0;
}
var Zt = se, en = ce, Pe = le, tn = de, nn = me, on = pe, rn = fe, an = he, sn = xe, cn = Ce, Ne = Me, ln = ge, un = ve, dn = we, mn = be;
const Ie = (e) => r.createElement(Zt, { ...e });
Ie.displayName = "ContextMenu.Root";
const Ee = r.forwardRef(({ children: e, ...t }, o) => r.createElement(en, { ...t, ref: o, asChild: !0 }, _t(e)));
Ee.displayName = "ContextMenu.Trigger";
const Se = r.createContext({}), ye = r.forwardRef((e, t) => {
  const o = ft(), { size: a = T.size.default, variant: n = T.variant.default, highContrast: i = T.highContrast.default } = e, { className: c, children: d, color: m, container: f, forceMount: u, ...h } = re(e, T), l = m || o.accentColor;
  return r.createElement(Pe, { container: f, forceMount: u }, r.createElement(ee, { asChild: !0 }, r.createElement(tn, { "data-accent-color": l, alignOffset: -Number(a) * 4, collisionPadding: 10, ...h, asChild: !1, ref: t, className: v("rt-PopperContent", "rt-BaseMenuContent", "rt-ContextMenuContent", c) }, r.createElement(ne, { type: "auto" }, r.createElement("div", { className: v("rt-BaseMenuViewport", "rt-ContextMenuViewport") }, r.createElement(Se.Provider, { value: r.useMemo(() => ({ size: a, variant: n, color: l, highContrast: i }), [a, n, l, i]) }, d))))));
});
ye.displayName = "ContextMenu.Content";
const Re = r.forwardRef(({ className: e, ...t }, o) => r.createElement(on, { ...t, asChild: !1, ref: o, className: v("rt-BaseMenuLabel", "rt-ContextMenuLabel", e) }));
Re.displayName = "ContextMenu.Label";
const b = r.forwardRef((e, t) => {
  const { className: o, children: a, color: n = Tt.color.default, shortcut: i, ...c } = e;
  return r.createElement(rn, { "data-accent-color": n, ...c, ref: t, className: v("rt-reset", "rt-BaseMenuItem", "rt-ContextMenuItem", o) }, r.createElement(W, null, a), i && r.createElement("div", { className: "rt-BaseMenuShortcut rt-ContextMenuShortcut" }, i));
});
b.displayName = "ContextMenu.Item";
const pn = r.forwardRef(({ className: e, ...t }, o) => r.createElement(nn, { ...t, asChild: !1, ref: o, className: v("rt-BaseMenuGroup", "rt-ContextMenuGroup", e) }));
pn.displayName = "ContextMenu.Group";
const fn = r.forwardRef(({ className: e, ...t }, o) => r.createElement(sn, { ...t, asChild: !1, ref: o, className: v("rt-BaseMenuRadioGroup", "rt-ContextMenuRadioGroup", e) }));
fn.displayName = "ContextMenu.RadioGroup";
const hn = r.forwardRef((e, t) => {
  const { children: o, className: a, color: n = zt.color.default, ...i } = e;
  return r.createElement(cn, { ...i, asChild: !1, ref: t, "data-accent-color": n, className: v("rt-BaseMenuItem", "rt-BaseMenuRadioItem", "rt-ContextMenuItem", "rt-ContextMenuRadioItem", a) }, r.createElement(W, null, o), r.createElement(Ne, { className: "rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator" }, r.createElement(oe, { className: "rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon" })));
});
hn.displayName = "ContextMenu.RadioItem";
const D = r.forwardRef((e, t) => {
  const { children: o, className: a, shortcut: n, color: i = At.color.default, ...c } = e;
  return r.createElement(an, { ...c, asChild: !1, ref: t, "data-accent-color": i, className: v("rt-BaseMenuItem", "rt-BaseMenuCheckboxItem", "rt-ContextMenuItem", "rt-ContextMenuCheckboxItem", a) }, r.createElement(W, null, o), r.createElement(Ne, { className: "rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator" }, r.createElement(oe, { className: "rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon" })), n && r.createElement("div", { className: "rt-BaseMenuShortcut rt-ContextMenuShortcut" }, n));
});
D.displayName = "ContextMenu.CheckboxItem";
const G = (e) => r.createElement(un, { ...e });
G.displayName = "ContextMenu.Sub";
const L = r.forwardRef((e, t) => {
  const { className: o, children: a, ...n } = e;
  return r.createElement(dn, { ...n, asChild: !1, ref: t, className: v("rt-BaseMenuItem", "rt-BaseMenuSubTrigger", "rt-ContextMenuItem", "rt-ContextMenuSubTrigger", o) }, a, r.createElement("div", { className: "rt-BaseMenuShortcut rt-ContextMenuShortcut" }, r.createElement(Ot, { className: "rt-BaseMenuSubTriggerIcon rt-ContextMenuSubTriggerIcon" })));
});
L.displayName = "ContextMenu.SubTrigger";
const $ = r.forwardRef((e, t) => {
  const { size: o, variant: a, color: n, highContrast: i } = r.useContext(Se), { className: c, children: d, container: m, forceMount: f, ...u } = re({ size: o, variant: a, color: n, highContrast: i, ...e }, T);
  return r.createElement(Pe, { container: m, forceMount: f }, r.createElement(ee, { asChild: !0 }, r.createElement(mn, { "data-accent-color": n, alignOffset: -Number(o) * 4, sideOffset: 1, collisionPadding: 10, ...u, asChild: !1, ref: t, className: v("rt-PopperContent", "rt-BaseMenuContent", "rt-BaseMenuSubContent", "rt-ContextMenuContent", "rt-ContextMenuSubContent", c) }, r.createElement(ne, { type: "auto" }, r.createElement("div", { className: v("rt-BaseMenuViewport", "rt-ContextMenuViewport") }, d)))));
});
$.displayName = "ContextMenu.SubContent";
const z = r.forwardRef(({ className: e, ...t }, o) => r.createElement(ln, { ...t, asChild: !1, ref: o, className: v("rt-BaseMenuSeparator", "rt-ContextMenuSeparator", e) }));
z.displayName = "ContextMenu.Separator";
function I({
  direction: e,
  show: t,
  manifest: o
}) {
  if (V() === "mobile" && e !== "s" && e !== "n")
    return null;
  const n = o.isContainer ? 8 : 4;
  return /* @__PURE__ */ s(
    "button",
    {
      type: "button",
      className: O(
        "resizable-handle absolute focus:outline-none",
        "overflow-visible z-[9998]",
        `resizable-handle-${e}`,
        {
          "-bottom-[2px] left-0 right-0 h-[6px] cursor-row-resize": e === "s",
          "-top-[2px] left-0 right-0 h-[6px] cursor-row-resize": e === "n",
          "top-0 -left-[2px] bottom-0 w-[6px] cursor-col-resize": e === "w",
          "top-0 -right-[2px] bottom-0 w-[6px] cursor-col-resize": e === "e",
          // sw and nw
          "-bottom-[2px] -left-[2px] w-[6px] h-[6px] cursor-nesw-resize": e === "sw",
          "-top-[2px] -left-[2px] w-[6px] h-[6px] cursor-nwse-resize": e === "nw",
          // se and ne
          "-bottom-[2px] -right-[2px] w-[6px] h-[6px] cursor-nwse-resize": e === "se",
          "-top-[2px] -right-[2px] w-[6px] h-[6px] cursor-nesw-resize": e === "ne"
        }
      ),
      children: /* @__PURE__ */ s(
        "div",
        {
          className: O(
            "z-[9999] absolute w-[10px] h-[10px] bg-white border-2 rounded-full shadow-md resizable-handle-dot",
            o.isContainer ? "border-orange-500" : "border-upstart-500",
            t && "opacity-100",
            {
              [`top-1/2 -translate-y-1/2 -left-[${n}px]`]: e === "w",
              [`top-1/2 -translate-y-1/2 -right-[${n}px]`]: e === "e",
              [`left-1/2 -translate-x-1/2 -top-[${n}px]`]: e === "n",
              [`left-1/2 -translate-x-1/2 -bottom-[${n}px]`]: e === "s",
              // sw and nw
              [`-bottom-[${n}px] -left-[${n}px]`]: e === "sw",
              [`-top-[${n}px] -left-[${n}px]`]: e === "nw",
              // se and ne
              [`-bottom-[${n}px] -right-[${n}px]`]: e === "se",
              [`-top-[${n}px] -right-[${n}px]`]: e === "ne"
            }
          )
        }
      )
    }
  );
}
function xn(e) {
  const { resizable: t } = e;
  return {
    canGrowVertical: t === !0 || t === "vertical",
    canGrowHorizontal: t === !0 || t === "horizontal",
    canShrinkVertical: t === !0 || t === "vertical",
    canShrinkHorizontal: t === !0 || t === "horizontal"
  };
}
function Cn(e = {}) {
  const { tolerance: t = 0, deepCheck: o = !1 } = e, a = j(null), [n, i] = J(!1);
  return Y(() => {
    const c = a.current;
    if (!c) return;
    const d = (f) => {
      const u = c.getBoundingClientRect(), { clientX: h, clientY: l } = f;
      if (!(h >= u.left - t && h <= u.right + t && l >= u.top - t && l <= u.bottom + t)) {
        i(!1);
        return;
      }
      if (o) {
        const P = document.elementFromPoint(h, l), p = P === c || c.contains(P);
        i(p);
      } else
        i(!0);
    }, m = () => {
      i(!1);
    };
    return document.addEventListener("mousemove", d), c.addEventListener("mouseleave", m), () => {
      document.removeEventListener("mousemove", d), c.removeEventListener("mouseleave", m);
    };
  }, [t, o]), { ref: a, isHovered: n };
}
function Mn(e, t, o) {
  if (!(o != null && o.isDropAnimating) || !o.dropAnimation)
    return t;
  const { draggingOver: a } = o, { moveTo: n } = o.dropAnimation;
  if (a === e) {
    const i = `translate(${n.x}px, 0px)`;
    return {
      ...t,
      transform: `${i}`
    };
  }
  return t;
}
function gn(e) {
  return ["bottom", "top"];
}
const $n = H(
  ({ brick: e, isContainerChild: t, index: o, level: a = 0 }, n) => {
    const i = j(!1), c = q(), d = V(), { panelPosition: m } = Fe(), f = Q(), { getParentBrick: u } = Z(), h = pt(e.id), l = F(e.type), S = u(e.id), [P, p] = J(!1), Be = gn(), ke = Ue(), _e = Xe(), {
      refs: R,
      floatingStyles: Te,
      update: X,
      context: Oe
    } = et({
      open: P,
      onOpenChange: p,
      whileElementsMounted: ct,
      transform: !0,
      middleware: [
        tt(l.isContainer ? { mainAxis: 8, crossAxis: 0 } : { mainAxis: 6, crossAxis: 0 }),
        nt({
          allowedPlacements: Be
        })
      ]
    }), Ae = ot(Oe, {
      handleClose: rt(),
      delay: {
        open: 50,
        close: 200
      }
    }), { getReferenceProps: ze, getFloatingProps: De } = at([Ae]);
    Y(() => {
      if (R.reference.current) {
        const C = () => {
          i.current = !0;
        }, w = () => {
          i.current = !1;
        }, y = () => {
          X(), setTimeout(() => {
            i.current = !1;
          }, 200);
        }, x = R.reference.current;
        return x.addEventListener("mousedown", w), x.addEventListener("mouseup", y), x.addEventListener("mousemove", C), () => {
          x.removeEventListener("mousedown", w), x.removeEventListener("mouseup", y), x.removeEventListener("mousemove", C);
        };
      }
    }, [R.reference, X]);
    const Ge = Ve(
      (C) => {
        const w = C.target, y = C.currentTarget;
        if (i.current || !y.matches("[data-brick]") || C.defaultPrevented && !w.closest('[data-prevented-by-editor="true"]')) {
          console.log(
            "EditableBrickWrapper: Click ignored due to mouse movement or default prevented",
            w
          );
          return;
        }
        let x = e, B = "brick";
        C.shiftKey ? S && (x = S) : (C.ctrlKey || C.metaKey) && h && (B = "section", x = h), f.hidePanel(), (m === "left" && C.clientX < window.innerWidth * 0.25 || m === "right" && C.clientX > window.innerWidth * 0.75) && f.togglePanelPosition(), We(() => {
          B === "section" ? f.setSelectedSectionId(x.id) : f.setSelectedBrickId(x.id), f.setPanel("inspector");
        }), i.current = !1, C.stopPropagation();
      },
      [m]
    ), { ref: Le, isHovered: N } = Cn({ tolerance: 6, deepCheck: !0 }), $e = lt({
      brick: e,
      editable: !0,
      selected: c === e.id,
      isContainerChild: t
    }), He = _e || !l.movable || t || d === "mobile";
    return /* @__PURE__ */ s(mt, { draggableId: e.id, index: o, isDragDisabled: He, children: (C, w) => {
      var B;
      const y = st([C.innerRef, R.setReference, n, Le]), x = xn(K[e.type]);
      return /* @__PURE__ */ s(bn, { brick: e, isContainerChild: t, children: /* @__PURE__ */ g(
        "div",
        {
          ref: y,
          ...C.draggableProps,
          ...C.dragHandleProps,
          ...ze(),
          id: e.id,
          "data-brick": !0,
          "data-brick-id": e.id,
          "data-brick-type": e.type,
          "data-last-touched": e.props.lastTouched ?? "0",
          "data-is-container": l.isContainer,
          "data-is-container-child": t,
          "data-level": a,
          "data-brick-width": e.props.width,
          "data-brick-height": e.props.height,
          "data-brick-max-width": JSON.stringify(l.maxWidth),
          "data-brick-min-width": JSON.stringify(l.minWidth),
          style: Mn(h == null ? void 0 : h.id, C.draggableProps.style, w),
          className: O(
            $e,
            w.isDragging ? "!z-[9999] !shadow-2xl overflow-hidden !cursor-grabbing" : "hover:cursor-auto"
          ),
          onClick: Ge,
          children: [
            /* @__PURE__ */ s(ut, { brick: e, selectedBrickId: c, editable: !0 }),
            /* @__PURE__ */ s(it, { children: /* @__PURE__ */ s(
              vn,
              {
                ref: R.setFloating,
                brick: e,
                isContainerChild: t,
                style: Te,
                show: P,
                ...De()
              }
            ) }),
            ((B = K[e.type]) == null ? void 0 : B.resizable) && !ke && !w.isDragging && c === e.id && /* @__PURE__ */ g(E, { children: [
              (x.canGrowVertical || x.canShrinkVertical) && /* @__PURE__ */ g(E, { children: [
                /* @__PURE__ */ s(I, { direction: "s", show: N, manifest: l }),
                /* @__PURE__ */ s(I, { direction: "n", show: N, manifest: l })
              ] }),
              (x.canGrowHorizontal || x.canShrinkHorizontal) && /* @__PURE__ */ g(E, { children: [
                /* @__PURE__ */ s(I, { direction: "w", show: N, manifest: l }),
                /* @__PURE__ */ s(I, { direction: "e", show: N, manifest: l })
              ] }),
              (x.canGrowVertical && x.canGrowHorizontal || x.canShrinkVertical && x.canShrinkHorizontal) && /* @__PURE__ */ g(E, { children: [
                /* @__PURE__ */ s(I, { direction: "se", show: N, manifest: l }),
                /* @__PURE__ */ s(I, { direction: "sw", show: N, manifest: l }),
                /* @__PURE__ */ s(I, { direction: "ne", show: N, manifest: l }),
                /* @__PURE__ */ s(I, { direction: "nw", show: N, manifest: l })
              ] })
            ] })
          ]
        }
      ) });
    } }, e.id);
  }
), vn = H(
  ({ brick: e, style: t, isContainerChild: o, show: a, ...n }, i) => {
    const c = q(), d = F(e.type), m = je(), f = a && d.isContainer && !c || a && !d.isContainer && !o || c === e.id;
    return !f || m ? null : /* @__PURE__ */ s(
      "div",
      {
        ref: i,
        "data-ui": !0,
        "data-ui-menu-bars-container": !0,
        role: "navigation",
        className: O(
          "z-[99999] isolate text-base items-center gap-1",
          "transition-opacity duration-150 border rounded-lg",
          f ? "opacity-100 flex" : "opacity-0 hidden",
          d.isContainer ? "border-orange-300" : "border-transparent"
        ),
        style: t,
        ...n,
        children: /* @__PURE__ */ s(wn, { brick: e })
      }
    );
  }
);
function wn({ brick: e }) {
  return /* @__PURE__ */ s(
    "div",
    {
      id: `text-editor-menu-${e.id}`,
      className: O("contents", dt, "!empty:hidden")
    }
  );
}
const bn = H(
  ({ brick: e, isContainerChild: t, children: o }, a) => {
    var S, P;
    const n = Z(), i = Q(), c = Ke();
    V();
    const d = F(e.type), m = n.canMoveToWithinParent(e.id, "previous"), f = n.canMoveToWithinParent(e.id, "next"), u = n.getParentBrick(e.id), h = u ? document.getElementById(u.id) : null, l = h && getComputedStyle(h).flexDirection || "row";
    return /* @__PURE__ */ g(
      Ie,
      {
        modal: !1,
        onOpenChange: (p) => {
          i.setContextMenuVisible(p);
        },
        children: [
          /* @__PURE__ */ s(Ee, { disabled: c, ref: a, children: o }),
          /* @__PURE__ */ s(ht, { children: /* @__PURE__ */ g(ye, { className: "nodrag", size: "2", children: [
            /* @__PURE__ */ g(Re, { className: "!text-sm", children: [
              d.name,
              " (brick)"
            ] }),
            d.duplicatable && /* @__PURE__ */ s(
              b,
              {
                shortcut: "⌘D",
                onClick: (p) => {
                  p.stopPropagation(), n.duplicateBrick(e.id);
                },
                children: "Duplicate"
              }
            ),
            m && /* @__PURE__ */ s(
              b,
              {
                shortcut: t ? "⌘↑" : "⌘←",
                onClick: (p) => {
                  p.stopPropagation(), n.moveBrickWithin(e.id, "previous");
                },
                children: t && l === "column" ? "Move up" : "Move left"
              }
            ),
            f && /* @__PURE__ */ s(
              b,
              {
                shortcut: t ? "⌘↓" : "⌘→",
                onClick: (p) => {
                  p.stopPropagation(), n.moveBrickWithin(e.id, "next");
                },
                children: t && l === "column" ? "Move down" : "Move right"
              }
            ),
            /* @__PURE__ */ g(G, { children: [
              /* @__PURE__ */ s(L, { children: "Visible on" }),
              /* @__PURE__ */ g($, { children: [
                /* @__PURE__ */ s(
                  D,
                  {
                    checked: !((S = e.props.hidden) != null && S.mobile),
                    onClick: (p) => p.stopPropagation(),
                    onCheckedChange: () => n.toggleBrickVisibilityPerBreakpoint(e.id, "mobile"),
                    children: "Mobile"
                  }
                ),
                /* @__PURE__ */ s(
                  D,
                  {
                    checked: !((P = e.props.hidden) != null && P.desktop),
                    onClick: (p) => p.stopPropagation(),
                    onCheckedChange: () => n.toggleBrickVisibilityPerBreakpoint(e.id, "desktop"),
                    children: "Desktop"
                  }
                )
              ] })
            ] }),
            u && /* @__PURE__ */ g(E, { children: [
              /* @__PURE__ */ s(z, {}),
              /* @__PURE__ */ g(G, { children: [
                /* @__PURE__ */ s(L, { children: "Parent container" }),
                /* @__PURE__ */ g($, { children: [
                  /* @__PURE__ */ s(
                    b,
                    {
                      onClick: (p) => {
                        p.stopPropagation(), n.duplicateBrick(u.id);
                      },
                      children: "Duplicate container"
                    }
                  ),
                  /* @__PURE__ */ s(
                    b,
                    {
                      onClick: (p) => {
                        p.stopPropagation(), i.setSelectedBrickId(u.id), i.setPanel("inspector");
                      },
                      children: "Edit container"
                    }
                  ),
                  /* @__PURE__ */ s(z, {}),
                  /* @__PURE__ */ s(
                    b,
                    {
                      shortcut: "⌫",
                      color: "red",
                      onClick: (p) => {
                        p.stopPropagation(), n.deleteBrick(u.id), i.deselectBrick(u.id), i.hidePanel("inspector");
                      },
                      children: "Delete container"
                    }
                  )
                ] })
              ] }),
              /* @__PURE__ */ s(
                b,
                {
                  onClick: (p) => {
                    p.stopPropagation(), n.detachBrickFromContainer(e.id);
                  },
                  children: "Detach from parent"
                }
              )
            ] }),
            d.deletable && /* @__PURE__ */ g(E, { children: [
              /* @__PURE__ */ s(z, {}),
              /* @__PURE__ */ s(
                b,
                {
                  shortcut: "⌫",
                  color: "red",
                  onClick: (p) => {
                    p.stopPropagation(), n.deleteBrick(e.id), i.deselectBrick(e.id), i.hidePanel("inspector");
                  },
                  children: "Delete"
                }
              )
            ] })
          ] }) })
        ]
      }
    );
  }
);
function Hn() {
  const e = Je(), t = _("(max-width: 768px)"), o = _("(min-width: 769px) and (max-width: 1024px)"), a = _("(min-width: 1025px)"), n = _("(min-width: 1420px)"), i = _("(min-width: 1200px)");
  return {
    isMobile: t,
    isTablet: o,
    isDesktop: a,
    canUseDnd: !e && i || e && n
  };
}
export {
  $n as E,
  pn as N,
  b as R,
  Re as S,
  z as W,
  Ee as g,
  Ie as h,
  Hn as u,
  ye as y
};
//# sourceMappingURL=use-device-info.DSobfzJS.js.map
