import { jsxs as r, jsx as e } from "react/jsx-runtime";
import { BackgroundControl as y } from "../../../../components/controls/background.control.js";
import { ColorControl as N } from "../../../../components/controls/color.control.js";
import { InputControl as u } from "../../../../components/controls/input.control.js";
import { LinkControl as b } from "../../../../components/controls/link.control.js";
import { TextareaControl as k } from "../../../../components/controls/textarea.control.js";
import { Button as L } from "../../../../components/shared/button.js";
import { Label as S } from "../../../../components/shared/label.js";
import { Tabs as i } from "../../../../components/shared/tabs.js";
import { useSettings as x } from "../../../../hooks/use-settings.js";
import { getCurrentLocale as O } from "../../../../../../../store/selectors.js";
import { SettingsType as l } from "../../../../types/index.js";
import { PseudoClass as F } from "../../../../types/style.js";
import { createId as C, classNames as h } from "../../../../utils/index.js";
import { useAppSelector as $ } from "../../../../hooks/use-app-selector.js";
import { arrayMoveImmutable as K } from "../../../../../../../node_modules/.pnpm/array-move@4.0.0/node_modules/array-move/index.js";
import { l as m } from "../../../../../../../_virtual/lodash.js";
import { useState as w } from "react";
import T, { SortableItem as z } from "../../../../../../../node_modules/.pnpm/react-easy-sort@1.6.0_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/react-easy-sort/index.module.js";
import { BiGridVertical as A } from "../../../../../../../node_modules/.pnpm/react-icons@5.5.0_react@19.0.0/node_modules/react-icons/bi/index.js";
import { BsTrash as I, BsPlus as P } from "../../../../../../../node_modules/.pnpm/react-icons@5.5.0_react@19.0.0/node_modules/react-icons/bs/index.js";
import { FaRegCopy as j } from "../../../../../../../node_modules/.pnpm/react-icons@5.5.0_react@19.0.0/node_modules/react-icons/fa/index.js";
import D from "./slide-horizontal-position.control.js";
import E from "./slide-overlay-blend.control.js";
import V from "./slide-overlay-color.control.js";
import H from "./slide-overlay.control.js";
import M from "./slide-text-align.control.js";
import G from "./slide-vertical-position.control.js";
const ve = () => {
  const g = $(O), [s, d] = x(
    "slides",
    l.BLOCK
  ), [c, p] = w(""), v = (o, t) => {
    d(K(s ?? [], o, t));
  }, B = (o, t) => {
    const a = o == null ? void 0 : o.replace(/(<([^>]+)>)/gi, "").trim();
    return a || `Item #${t + 1}`;
  };
  return /* @__PURE__ */ r("div", { children: [
    /* @__PURE__ */ e(T, { onSortEnd: v, lockAxis: "y", children: s == null ? void 0 : s.map((o, t) => {
      var a, f;
      return /* @__PURE__ */ r("div", { className: "mb-1.5", children: [
        /* @__PURE__ */ e(z, { children: /* @__PURE__ */ e("div", { className: "z-[99] bg-[#F8F9F8] px-2", children: /* @__PURE__ */ r("div", { className: "flex min-h-[40px] items-center", children: [
          /* @__PURE__ */ e("button", { className: "me-1 cursor-move", children: /* @__PURE__ */ e(A, { size: 14, color: "#828282" }) }),
          /* @__PURE__ */ e(
            S,
            {
              onClick: () => {
                p((n) => n === o.id ? "" : o.id);
              },
              className: "flex h-full flex-1 cursor-pointer items-center py-1 text-xs hover:bg-slate-50",
              children: B(((a = o.title) == null ? void 0 : a[g]) || ((f = o.title) == null ? void 0 : f.en), t)
            }
          ),
          /* @__PURE__ */ e(
            "div",
            {
              onClick: () => {
                const n = m.cloneDeep(s) ?? [];
                n.splice(t + 1, 0, {
                  ...o,
                  id: C()
                }), d(n);
              },
              className: "me-1.5 flex h-full cursor-pointer items-center justify-center hover:bg-slate-50",
              children: /* @__PURE__ */ e(j, {})
            }
          ),
          /* @__PURE__ */ e(
            "div",
            {
              onClick: () => {
                const n = m.cloneDeep(s) ?? [];
                n.splice(t, 1), d(n);
              },
              className: "flex h-full cursor-pointer items-center justify-center hover:bg-slate-50",
              children: /* @__PURE__ */ e(I, {})
            }
          )
        ] }) }) }, o.id),
        /* @__PURE__ */ e(
          "div",
          {
            className: h(
              "grid grid-rows-[0fr] overflow-hidden bg-[#F8F9F8] transition-[grid-template-rows] duration-200",
              {
                "grid-rows-[1fr]": c === o.id
              }
            ),
            children: /* @__PURE__ */ e(
              "div",
              {
                className: h(
                  "min-h-0 px-3 transition-[padding-top,padding-bottom] duration-200",
                  {
                    "h-auto pb-3": c === o.id
                  }
                ),
                children: /* @__PURE__ */ r(i, { defaultValue: "Background", children: [
                  /* @__PURE__ */ r(i.List, { className: "h-8 w-full rounded-full", children: [
                    /* @__PURE__ */ e(
                      i.Trigger,
                      {
                        className: "flex-1 rounded-full p-[3px] text-[11px]",
                        value: "Background",
                        children: "Background"
                        /* BACKGROUND */
                      }
                    ),
                    /* @__PURE__ */ e(
                      i.Trigger,
                      {
                        className: "flex-1 rounded-full p-[3px] text-[11px]",
                        value: "Content",
                        children: "Content"
                        /* CONTENT */
                      }
                    ),
                    /* @__PURE__ */ e(
                      i.Trigger,
                      {
                        className: "flex-1 rounded-full p-[3px] text-[11px]",
                        value: "Style",
                        children: "Style"
                        /* STYLE */
                      }
                    )
                  ] }),
                  /* @__PURE__ */ r(i.Content, { value: "Background", children: [
                    /* @__PURE__ */ e(
                      y,
                      {
                        fieldName: `slides.${t}.background`,
                        type: l.BLOCK,
                        mode: F.DEFAULT
                      }
                    ),
                    /* @__PURE__ */ e(
                      H,
                      {
                        type: l.BLOCK,
                        fieldName: `slides.${t}.showBgOverlay.desktop`,
                        mediaField: `slides.${t}.backgroundImage`
                      }
                    ),
                    /* @__PURE__ */ e(
                      V,
                      {
                        type: l.BLOCK,
                        fieldName: `slides.${t}.overlayColor`,
                        overlayField: `slides.${t}.showBgOverlay.desktop`
                      }
                    ),
                    /* @__PURE__ */ e(
                      E,
                      {
                        type: l.BLOCK,
                        fieldName: `slides.${t}.blendMode.desktop`,
                        overlayField: `slides.${t}.showBgOverlay.desktop`
                      }
                    )
                  ] }),
                  /* @__PURE__ */ r(i.Content, { value: "Content", children: [
                    /* @__PURE__ */ e(
                      u,
                      {
                        type: l.BLOCK,
                        fieldName: `slides.${t}.title`,
                        label: "Title",
                        direction: "col",
                        isLocalized: !0
                      }
                    ),
                    /* @__PURE__ */ e(
                      k,
                      {
                        type: l.BLOCK,
                        fieldName: `slides.${t}.description`,
                        label: "Description",
                        isLocalized: !0
                      }
                    ),
                    /* @__PURE__ */ e(
                      u,
                      {
                        type: l.BLOCK,
                        fieldName: `slides.${t}.button.text`,
                        label: "Button Text",
                        direction: "col",
                        isLocalized: !0
                      }
                    ),
                    /* @__PURE__ */ e(
                      b,
                      {
                        type: l.BLOCK,
                        fieldName: `slides.${t}.button.link`
                      }
                    )
                  ] }),
                  /* @__PURE__ */ r(i.Content, { value: "Style", children: [
                    /* @__PURE__ */ e(
                      D,
                      {
                        type: l.BLOCK,
                        fieldName: `slides.${t}.horizontalPosition.desktop`
                      }
                    ),
                    /* @__PURE__ */ e(
                      G,
                      {
                        type: l.BLOCK,
                        fieldName: `slides.${t}.verticalPosition.desktop`
                      }
                    ),
                    /* @__PURE__ */ e(
                      M,
                      {
                        type: l.BLOCK,
                        fieldName: `slides.${t}.textAlign.desktop`
                      }
                    ),
                    /* @__PURE__ */ e(
                      N,
                      {
                        label: "Content Color",
                        type: l.BLOCK,
                        fieldName: `slides.${t}.contentColor.default`
                      }
                    )
                  ] })
                ] })
              }
            )
          }
        )
      ] }, o.id);
    }) }),
    /* @__PURE__ */ e("div", { className: "mt-5 flex justify-center", children: /* @__PURE__ */ r(
      L,
      {
        onClick: () => {
          const o = m.cloneDeep(s) ?? [], t = C();
          o.push({
            id: t,
            title: {
              en: `Item #${o.length + 1}`
            },
            description: {
              en: "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
            },
            background: { color: { default: "#BBBBBB" } },
            contentColor: { default: "#FFFFFF" },
            button: {
              text: {
                en: "Click Here"
              }
            },
            textAlign: { desktop: "center" }
          }), d(o), p(t);
        },
        variant: "outline",
        className: "flex",
        children: [
          /* @__PURE__ */ e(P, { size: 20, className: "me-1" }),
          "Add New"
        ]
      }
    ) })
  ] });
};
export {
  ve as default
};
//# sourceMappingURL=slides.control.js.map
