import { jsxs as m, jsx as o } from "react/jsx-runtime";
import { a as b } from "./index.CfQlFjZU.js";
import { B as k } from "./ButtonGroup.GFy-lPs3.js";
import { useState as G, useCallback as d } from "react";
import "./ProgressActivity.DYLCzf8q.js";
import { n as u } from "./index.B0wX8xO7.js";
import "./formInputIcon.module.CU3tuFAI.js";
import { u as w } from "./useIsMobile.56gy4Bq-.js";
import "./isEqual.Bk3xqtBB.js";
import { a as B, g as C, d as h } from "./GridRow._ehOXG8R.js";
import { G as v } from "./GridLayouts.DSIvKCIo.js";
import { a as I } from "./ProgressTracker.DyY57Wb4.js";
import { P as T } from "./Preview.C_qeKXUF.js";
import { P as x } from "./Page.DxkgZw21.js";
import { P as E } from "./PageHeader.BwFpx_pz.js";
import { P as N } from "./PageSection.DaF45FbK.js";
import { W } from "./WarningModal.5J0cPFJV.js";
import { I as _ } from "./ItemCreationContext.CFI6PyWk.js";
import { l as M } from "./lodash.xuulwbEa.js";
const O = "creator_pageContent_le2XT", y = "creator_buttons_UutdN", K = "creator_previewContainer_dSOU8", f = { pageContent: O, buttons: y, previewContainer: K }, j = ({
  steps: t,
  activeStepIndex: s,
  children: e,
  buttons: r,
  preview: n,
  showWarningModal: p,
  onKeepEditing: c,
  onGoBack: a,
  ...g
}) => {
  const i = w(), [l, P] = G(!1);
  return /* @__PURE__ */ m(x, { isLoading: !1, noPadding: !0, children: [
    /* @__PURE__ */ o(
      u,
      {
        value: p,
        then: /* @__PURE__ */ o(W, { onGoBack: a, onKeepEditing: c })
      }
    ),
    /* @__PURE__ */ o(
      u,
      {
        value: t && s !== void 0,
        then: /* @__PURE__ */ o(I, { steps: t, activeStepIndex: s })
      }
    ),
    /* @__PURE__ */ m(B, { className: f.pageContent, children: [
      /* @__PURE__ */ m(C, { children: [
        /* @__PURE__ */ m(h, { className: v.siteBuilderContent, children: [
          /* @__PURE__ */ o(E, { ...g }),
          /* @__PURE__ */ o(N, { children: e })
        ] }),
        /* @__PURE__ */ o(h, { className: v.siteBuilderPreview, children: n })
      ] }),
      /* @__PURE__ */ o(C, { children: /* @__PURE__ */ o(h, { className: f.buttons, children: /* @__PURE__ */ o(k, { buttons: r, floating: !i }) }) })
    ] }),
    /* @__PURE__ */ o(
      u,
      {
        value: i,
        then: /* @__PURE__ */ o("div", { className: f.previewContainer, children: /* @__PURE__ */ o(
          T,
          {
            isExpanded: l,
            onOpen: () => P(!0),
            onClose: () => P(!1),
            children: n
          }
        ) })
      }
    )
  ] });
}, S = ({
  children: t,
  preview: s
}) => {
  const [e, r] = G({
    buttons: [],
    title: "",
    previousPageUrl: ""
  }), n = d(
    (a) => {
      Object.keys(a).some((i) => {
        const l = i;
        return !M.isEqual(e[l], a[l]);
      }) && r({ ...e, ...a });
    },
    [e, r]
  ), p = d(() => {
    e.onGoBack?.(), r({ ...e, showWarningModal: !1 });
  }, [e, r]), c = d(() => {
    e.onKeepEditing?.(), r({ ...e, showWarningModal: !1 });
  }, [e, r]);
  return {
    props: {
      ...e,
      children: t,
      preview: s,
      onGoBack: p,
      onKeepEditing: c
    },
    context: e,
    setProps: n
  };
}, U = ({
  props: t,
  context: s,
  setProps: e
}) => /* @__PURE__ */ o(_.Provider, { value: { props: s, setProps: e }, children: /* @__PURE__ */ o(j, { ...t }) }), ae = b(
  U,
  S
);
export {
  j as I,
  ae as a
};
