import { j as e } from "../../../../../_virtual/jsx-runtime.js";
import { a as S } from "../../../../sdk/dist/shared/chunk-NLEWXPVM.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-AQPN5SE2.js";
import "../../../../sdk/dist/shared/chunk-DQXDGV67.js";
import "../../../../sdk/dist/shared/chunk-7DMUDZ4H.js";
import "../../../../sdk/dist/shared/chunk-LSPN22SI.js";
import "../../../../sdk/dist/shared/chunk-ETYYRWLK.js";
import "../../../../sdk/dist/shared/chunk-4TH3C76A.js";
import "../../../../sdk/dist/shared/chunk-FKNNTHWX.js";
import "../../../../sdk/dist/shared/chunk-JS4K5JRM.js";
import "../../../../sdk/dist/shared/chunk-WU6Q4WYD.js";
import "../../../../sdk/dist/shared/chunk-QISTDGPP.js";
import "../../../../sdk/dist/shared/chunk-LFQZRGHS.js";
import "../../../../sdk/dist/shared/chunk-SLRU4CT6.js";
import "../../../../sdk/dist/shared/chunk-TTTXV7TJ.js";
import "../../../../sdk/dist/shared/chunk-UHF6IEKV.js";
import "../../../../sdk/dist/shared/chunk-LGP6GWIY.js";
import "../../../../sdk/dist/shared/chunk-X43MB5WD.js";
import "../../../../sdk/dist/shared/chunk-NNI225RG.js";
import "../../../../sdk/dist/shared/chunk-ZQGNYK5I.js";
import "../../../../sdk/dist/shared/chunk-KHFNN4P3.js";
import "../../../../sdk/dist/shared/chunk-BZGNY7LB.js";
import "../../../../sdk/dist/shared/chunk-IIFTGWFZ.js";
import "lodash-es";
import "../../../../sdk/dist/shared/chunk-UU2MSQXY.js";
import "../../../../sdk/dist/shared/chunk-T3LIA4YB.js";
import "../../../../sdk/dist/shared/chunk-YBGPPF7T.js";
import "../../../../sdk/dist/shared/chunk-UMHXXXVP.js";
import "../../../../sdk/dist/shared/chunk-5N6MBJJ4.js";
import { useDebugMode as C, useEditorHelpers as y } from "../../../../../use-editor.js";
import { forwardRef as k } from "react";
import "../../../../../node_modules/.pnpm/@formkit_auto-animate@0.8.2/node_modules/@formkit/auto-animate/index.js";
import "../../../../../node_modules/.pnpm/react-hot-toast@2.5.2_react-dom@18.3.0-canary-3d9b20132-20240124_react@18.3.0-canary-3d_c02c1e17bf76c343fd22d1f22394ecf5/node_modules/react-hot-toast/dist/index.js";
import { useSections as v, useDraftHelpers as N } from "../../../../../use-page-data.js";
import { Root as b, Trigger as w, Content as R, Group as m, Label as D, Item as s, Separator as p } from "../../../../../node_modules/.pnpm/@radix-ui_themes@3.1.4_@types_react-dom@18.3.6_@types_react@18.3.3__@types_react@18.3.3_46b1dabc193c5ff5696ee783983c694e/node_modules/@radix-ui/themes/dist/esm/components/context-menu.js";
import { Portal as I } from "../../../../../node_modules/.pnpm/@radix-ui_react-portal@1.1.1_@types_react-dom@18.3.6_@types_react@18.3.3__@types_react@_d91fd04d10d265136bf0d35a7b9375b2/node_modules/@radix-ui/react-portal/dist/index.js";
const xe = k(
  ({ section: t, children: d }, l) => {
    const x = C(), c = v(), o = N(), { setSelectedSectionId: n, setPanel: a, setSelectedBrickId: j } = y(), h = c.reduce((r, i) => Math.max(r, i.order), -1), f = c.reduce((r, i) => Math.min(r, i.order), 1 / 0), u = t.order === h, g = t.order === f;
    return /* @__PURE__ */ e.jsxs(
      b,
      {
        modal: !1,
        onOpenChange: (r) => {
        },
        children: [
          /* @__PURE__ */ e.jsx(w, { disabled: x, ref: l, children: d }),
          /* @__PURE__ */ e.jsx(I, { children: /* @__PURE__ */ e.jsxs(R, { className: "nodrag", size: "2", children: [
            /* @__PURE__ */ e.jsxs(m, { children: [
              /* @__PURE__ */ e.jsxs(D, { children: [
                t.label ?? "Unnamed",
                " (section)"
              ] }),
              /* @__PURE__ */ e.jsx(
                s,
                {
                  onClick: () => {
                    n(t.id), a("inspector");
                  },
                  children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2", children: /* @__PURE__ */ e.jsx("span", { children: "Settings" }) })
                }
              ),
              /* @__PURE__ */ e.jsx(p, {}),
              !g && /* @__PURE__ */ e.jsx(s, { onClick: () => o.moveSectionUp(t.id), children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2", children: /* @__PURE__ */ e.jsx("span", { children: "Reorder up" }) }) }),
              !u && /* @__PURE__ */ e.jsx(s, { onClick: () => o.moveSectionDown(t.id), children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2", children: /* @__PURE__ */ e.jsx("span", { children: "Reorder down" }) }) })
            ] }),
            /* @__PURE__ */ e.jsx(p, {}),
            /* @__PURE__ */ e.jsxs(m, { children: [
              /* @__PURE__ */ e.jsx(
                s,
                {
                  onClick: (r) => {
                    r.stopPropagation();
                    const i = `s_${S()}`;
                    o.createEmptySection(i, t.id), n(i), a("inspector");
                  },
                  children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2", children: /* @__PURE__ */ e.jsx("span", { children: "Create new section below" }) })
                }
              ),
              /* @__PURE__ */ e.jsx(
                s,
                {
                  onClick: (r) => {
                    r.stopPropagation(), o.duplicateSection(t.id);
                  },
                  children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2", children: /* @__PURE__ */ e.jsx("span", { children: "Duplicate" }) })
                }
              )
            ] }),
            /* @__PURE__ */ e.jsx(p, {}),
            /* @__PURE__ */ e.jsx(
              s,
              {
                color: "red",
                onClick: (r) => {
                  r.stopPropagation(), o.deleteSection(t.id), n(), j(), a();
                },
                children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-start gap-2.5", children: /* @__PURE__ */ e.jsx("span", { children: "Delete section" }) })
              }
            )
          ] }) })
        ]
      }
    );
  }
);
export {
  xe as default
};
//# sourceMappingURL=EditableSectionContextMenu.js.map
