import { createStore as D } from "zustand";
import { devtools as N } from "zustand/middleware";
import { immer as b } from "zustand/middleware/immer";
import { getCookiesContainer as E, getDataFromResponse as R, getParmsFromValue as $, setColapsedLayoutBreakPoints as w, COOKIE_BREAKPOINT_LAYOUTS as B, DEBOUCED_SAVE_TIME as H, DEFAULT_WINDOW as O, MARGIN_GRIDLAYOUT as y, COOKIE_WINDOWS as U, deleteLayoutFromBreakPoints as G, RESPONSIVE_ROW_HEIGHTS as K, PADDING_GRIDLAYOUT as F, NORMALIZED_COLS as z, addArea as S, DEFAULT_AREA as Q, getSelectedAreaIdFromCookies as V, COOKIE_WINDOW_SELECTED as Y, COOKIE_AREAS_ADMIN_CONTAINER_ID as T, COOKIE_AREAS_ADMIN_ID as x } from "./helpers/helper.js";
import { createDynamicMFStore as v } from "../../../WindowBase/contexts/DynamicMFParmsContext/store.js";
import j from "lodash-es/cloneDeep";
import q from "lodash-es/debounce";
import { generateModuleCount as L } from "./helpers/generateModuleCount.js";
import { AREAS_STORE_ID as Z } from "../../constants.js";
import { helperSelectLayout as C } from "./helpers/selectLayout.js";
import { deleteCookie as P, setCookie as I, getCookie as _ } from "../../../../helpers/cookies/cookies.js";
import { isEqualLayouts as J } from "../../../GridLayout/utils.js";
import { cloneLayouts as X, addLayoutItemToBreakPoints as g } from "../../../GridLayout/subcomponents/Responsive/responsiveUtils.js";
const ee = (k, W) => {
  const { enabled: M = !1 } = W;
  return M && process.env.NODE_ENV === "development" ? N(k, W) : k;
}, fe = (k, W = !1) => {
  const M = {
    currentAreaId: "",
    currentModuleId: "",
    areasIds: [],
    hashAreas: {},
    hashWindows: {},
    windowsModalsIds: [],
    ...k
  };
  return D(
    ee(
      b((n, a) => ({
        ...M,
        areasActions: {
          /**
           * Initialize the Areas store.
           */
          init: () => {
            if (a().ownerState?.status !== "init")
              return;
            if (!a().loadAreasFromNetwork) {
              a().areasActions.addArea(), n((r) => {
                r.ownerState.status = "loaded";
              });
              return;
            }
            n((r) => {
              r.ownerState.status = "loading";
            });
            const e = _({
              networkOperation: a().networkOperation,
              params: {
                f: [
                  { n: "container_id", o: "e", o1: T },
                  { n: "id", o: "e", o1: x }
                ]
              }
            }), o = a().networkOperation({
              method: "GET",
              endPoint: "areas",
              parms: {},
              toastSuccess: !1
            });
            let s;
            Promise.allSettled([o, e]).then(([r, i]) => {
              if (r?.status === "fulfilled") {
                const t = r?.value?.data;
                n((d) => {
                  if (t && Array.isArray(t) && t.length > 0)
                    for (let c = 0; c < t.length; c++) {
                      const l = {
                        ...Q,
                        ...t[c],
                        // API-backed areas should lazily load windows on first selection.
                        loadWindows: !0
                      };
                      d.hashAreas[l.id] = l, d.areasIds.push(l.id);
                    }
                  else
                    S(d);
                });
              }
              i.status === "fulfilled" && (s = V(i?.value));
            }).finally(() => {
              if (n((r) => {
                r.ownerState.status = "loaded";
              }), a().areasIds.length > 0 && a().currentAreaId === "") {
                const r = s && a().areasIds?.includes?.(s) ? s : a().areasIds[0];
                a().areasActions.selectArea(r);
              }
            });
          },
          /**
           * Add a blank work area and select it.
           */
          addArea: () => {
            let e = "";
            return n((o) => {
              e = S(o);
            }), a().areasActions.selectArea(e), e;
          },
          /**
           * editArea store
           */
          editArea: (e, o) => {
            n((s) => {
              s.hashAreas[e] && (s.hashAreas[e].name = o, s.loadAreasFromNetwork && s.networkOperation({
                method: "PATCH",
                endPoint: `areas/${e}`,
                data: { name: o },
                toastSuccess: !1,
                toastError: !1
              }));
            });
          },
          /**
           * deleteArea store
           */
          deleteArea: (e) => {
            let o = "";
            n((s) => {
              if (!s.hashAreas[e] || s.areasIds.length < 2)
                return;
              const i = s.areasIds.indexOf(e);
              if (i > -1) {
                for (const d in s.hashWindows)
                  s.hashWindows[d].areaId === e && delete s.hashWindows[d];
                const t = s.areasIds.findIndex((d) => d === e);
                s.areasIds.splice(i, 1), delete s.hashAreas[e], s.currentAreaId === e && (o = s.areasIds[t <= s.areasIds.length - 1 ? t : s.areasIds.length - 1]);
              }
              s.loadAreasFromNetwork && s.networkOperation({
                method: "DELETE",
                endPoint: `areas/${e}`,
                parms: {},
                toastSuccess: !1,
                toastError: !1
              }), s.loadCookiesFromNetwork && P({
                networkOperation: a().networkOperation,
                data: { f: [{ n: "container_id", o: "c", o1: e }] }
              }).catch(() => {
              });
            }), o && a().areasActions.selectArea(o);
          },
          /**
           * selectArea store
           */
          selectArea: (e) => {
            n((o) => {
              o.currentAreaId = e, o.hashAreas[e].currentLayoutId ? o.currentModuleId = o.hashWindows[o.hashAreas[e].currentLayoutId].moduleId : o.currentModuleId = "";
            }), a().hashAreas[e].status === "init" && (a().hashAreas[e].loadWindows ? a().areaActions.loadWindowsFromApi(e) : n((o) => {
              o.hashAreas[e].status = "loaded";
            })), a().loadCookiesFromNetwork && I({
              networkOperation: a().networkOperation,
              endPoint: `${T}/${x}`,
              value: { selectedAreaId: e }
            }).catch(() => {
            });
          },
          /**
           * setHandlerGetLabel
           */
          setHandlerGetLabel: (e) => {
            n((o) => {
              o.getLabel = e;
            });
          },
          /**
           * setExternalState
           */
          setExternalState: (e) => {
            n((o) => {
              o.ownerState = { ...o.ownerState, ...e };
            });
          }
        },
        areaActions: {
          /**
           * addWindow store
           */
          addWindow: (e) => {
            const o = `${a().currentAreaId}_window_${(/* @__PURE__ */ new Date()).getTime()}_${(Math.random() * 1e3).toFixed(0)}`;
            e.emergeType === "layout" ? a().areaActions.addLayout(
              a().currentAreaId,
              o,
              e
            ) : e.emergeType === "popup" ? a().areaActions.addPopup(
              a().currentAreaId,
              o,
              e
            ) : e.emergeType === "panel" ? a().areaActions.addPanel(
              a().currentAreaId,
              o,
              e
            ) : e.emergeType === "modal" && a().areaActions.addWindowModal(
              a().currentAreaId,
              o,
              e
            );
          },
          /**
           * addLayout store
           */
          addLayout: (e, o, s) => {
            let r = o;
            const i = !1, t = L(
              a().currentAreaId,
              s.moduleId,
              a().hashWindows
            ), d = {
              ...s.layoutProps,
              i: o,
              isDraggable: !0,
              isResizable: !0,
              freeMove: i
            };
            n((c) => {
              const l = c.hashAreas[e];
              if (l) {
                if (s.replaceMeId)
                  for (let m = 0; m < l.layoutItemsIds.length; m++) {
                    const h = l.layoutItemsIds[m], p = c.hashWindows[h];
                    if (p.replaceMeId === s.replaceMeId) {
                      r = h, p.dynamicMFStore.getState().actions.changeData(s.dynamicParams), C(c, e, h, !0), w(l, h, !1), (l.maximizedId || l.currentBreakpoint === "xxs") && (l.maximizedId = h), a().popupsProviderMethods.setSelectedPopupId(e, void 0);
                      break;
                    }
                  }
                if (r === o) {
                  const m = v({
                    dynamicMFParameters: s.dynamicParams
                  });
                  c.hashWindows[o] = {
                    ...s,
                    areaId: e,
                    windowId: o,
                    onClose: (h) => {
                      a().areaActions.closeLayout(e, h);
                    },
                    ...O,
                    dynamicMFStore: m,
                    moduleCount: t
                  }, l.layoutItemsIds.push(o), l.maximizedId && (l.maximizedId = o), l.layouts = g(
                    l.layouts,
                    d,
                    z,
                    [y, y],
                    [F, F],
                    K,
                    l.containerHeight,
                    l.currentBreakpoint
                  ), l.currentBreakpoint === "xxs" && (l.maximizedId = o), C(c, e, o, !0), a().popupsProviderMethods.setSelectedPopupId(e, void 0);
                }
              }
            }), a().areaActions.saveLayouts(e), a().areaActions.bouncedSaveBreakpointsLayouts(e);
          },
          /**
           * closeLayout
           */
          closeLayout: (e, o) => {
            n((s) => {
              const r = s.hashAreas[e];
              if (!r)
                return;
              const i = r.layoutItemsIds.indexOf(o);
              i > -1 && r.layoutItemsIds.splice(i, 1), G(r, o), delete s.hashWindows[o], s.hashAreas[e].currentLayoutId === o && C(s, e, "");
            }), a().areaActions.saveLayouts(e), a().hashAreas[e].maximizedId === o && a().areaActions.maximizeLayout(e);
            for (let s = 0; s < a().hashAreas[e].layoutItemsIds.length; s++) {
              const r = a().hashAreas[e].layoutItemsIds[s], i = a().hashWindows[r];
              i && i.parentId === o && a().areaActions.closeLayout(e, i.windowId);
            }
            a().popupsProviderMethods.closeAllPopupsByParentId(o);
          },
          /**
           * saveLayouts
           */
          saveLayouts: (e) => {
            if (!a().loadCookiesFromNetwork)
              return;
            let o = 0;
            const s = a().hashAreas[e];
            if (!s)
              return;
            const r = {};
            for (let i = 0; i < s.layoutItemsIds.length; i++) {
              const t = s.layoutItemsIds[i], d = a().hashWindows[t];
              d?.emergeType === "layout" && d.winType === "microfrontend" && (r[t] = {
                winType: d.winType,
                emergeType: d.emergeType,
                title: d.title,
                url_icon: d.iconUrl,
                windowOptions: d.windowOptions,
                moduleId: d.moduleId,
                replaceMeId: d.replaceMeId,
                windowId: d.windowId,
                mfProps: d.mfProps,
                moduleCount: d.moduleCount,
                iconUrl: d.iconUrl
              }, o++);
            }
            o > 0 ? I({
              networkOperation: a().networkOperation,
              endPoint: `${s.id}/${U}`,
              value: r
            }).catch(() => {
            }) : P({
              networkOperation: a().networkOperation,
              data: { f: [{ n: "container_id", o: "c", o1: s.id }] }
            }).catch(() => {
            });
          },
          /**
           * addPopup store
           */
          addPopup: (e, o, s) => {
            let r = o;
            n((i) => {
              if (i.hashAreas[e]) {
                if (s.replaceMeId) {
                  for (const d in i.hashWindows)
                    if (i.hashWindows[d].replaceMeId === s.replaceMeId) {
                      const c = i.hashWindows[d];
                      r = d, c.dynamicMFStore.getState().actions.changeData(s.dynamicParams), a().popupsProviderMethods.bringPopupOnFront(d, !0);
                      break;
                    }
                }
                if (r === o) {
                  const d = v({
                    dynamicMFParameters: s.dynamicParams
                  });
                  i.hashWindows[o] = {
                    ...s,
                    ...O,
                    areaId: e,
                    windowId: o,
                    // Legacy behavior: popup close requests issued through Areas
                    // still reuse the layout-style close path. This matches the
                    // previous contract, but teardown ownership and close-veto
                    // orchestration remain explicit follow-up debt.
                    onClose: (u) => {
                      a().areaActions.closeLayout(e, u);
                    },
                    dynamicMFStore: d
                  };
                  const { emergeType: c, popupProps: l, ...m } = s, h = s.parentId, p = (u, f, A) => {
                    h ? A === "select" && a().areaActions.selectLayout(u, h) : a().areaActions.selectLayout(u, "");
                  };
                  a().popupsProviderMethods.addPopup({
                    ...m,
                    ...l,
                    popupId: o,
                    groupId: e,
                    dynamicMFStore: d,
                    dynamicParams: s.dynamicParams,
                    onRemove: () => a().areaActions.closePopup(e, o),
                    onSelectedPopupIdChange: p,
                    allowHeightResizeContainer: !0,
                    allowWidthResizeContainer: !1,
                    bounds: {
                      left: y,
                      top: y,
                      right: -y,
                      bottom: -y
                    }
                  });
                }
              }
            });
          },
          /**
           * addPanel store
           */
          addPanel: (e, o, s) => {
            let r = o, i;
            if (n((h) => {
              const p = h.hashAreas[e];
              if (p) {
                if (s.replaceMeId)
                  for (let u = 0; u < p.panelItemsIds.length; u++) {
                    const f = p.panelItemsIds[u], A = h.hashWindows[f];
                    if (A?.replaceMeId === s.replaceMeId) {
                      r = f, A.dynamicMFStore.getState().actions.changeData(s.dynamicParams);
                      break;
                    }
                  }
                if (i = p.panelItemsIds.find((u) => {
                  const f = h.hashWindows[u];
                  return f?.emergeType === "panel" && f.panelProps.side === s.panelProps.side;
                }), !(i && r === o) && r === o) {
                  const u = v({
                    dynamicMFParameters: s.dynamicParams
                  }), f = L(
                    e,
                    s.moduleId,
                    h.hashWindows
                  );
                  h.hashWindows[o] = {
                    ...s,
                    areaId: e,
                    windowId: o,
                    onClose: (A) => {
                      a().areaActions.closePanel(e, A);
                    },
                    ...O,
                    dynamicMFStore: u,
                    moduleCount: f
                  }, p.panelItemsIds.push(o);
                }
              }
            }), r !== o || !i)
              return;
            const t = i, d = a().hashWindows[t];
            if (!d || d.emergeType !== "panel")
              return;
            let c = !1;
            const l = () => {
              c || (c = !0, a().areaActions.addPanel(e, o, s));
            };
            if (!d.fnQueryClose) {
              a().windowActions.close(t, !1), l();
              return;
            }
            const m = {
              reason: "same-side-replace",
              /**
               * Close the occupied panel and mount the newest same-side intent
               * once the guard explicitly approves the replacement.
               */
              proceed() {
                a().windowActions.close(t, !1), l();
              },
              cancel: () => {
              }
            };
            a().windowActions.close(
              t,
              !0,
              m
            );
          },
          /**
           * closePopup
           */
          closePopup: (e, o) => {
            n((s) => {
              s.hashAreas[e] && delete s.hashWindows[o];
            });
          },
          /**
           * closePanel
           */
          closePanel: (e, o) => {
            n((s) => {
              const r = s.hashAreas[e];
              if (!r)
                return;
              const i = r.panelItemsIds.indexOf(o);
              i > -1 && r.panelItemsIds.splice(i, 1), delete s.hashWindows[o];
            });
          },
          /**
           * setPanelPinned
           */
          setPanelPinned: (e, o, s) => {
            n((r) => {
              const i = r.hashAreas[e], t = r.hashWindows[o];
              !i || t?.emergeType !== "panel" || (t.panelProps.pinned = s);
            });
          },
          /**
           * setPanelSize
           */
          setPanelSize: (e, o, s) => {
            n((r) => {
              const i = r.hashAreas[e], t = r.hashWindows[o];
              if (!(!i || t?.emergeType !== "panel")) {
                if (t.panelProps.side === "left" || t.panelProps.side === "right") {
                  "width" in s && s.width !== void 0 && (t.panelProps.width = s.width), "maxWidth" in s && s.maxWidth !== void 0 && (t.panelProps.maxWidth = s.maxWidth);
                  return;
                }
                "height" in s && s.height !== void 0 && (t.panelProps.height = s.height), "maxHeight" in s && s.maxHeight !== void 0 && (t.panelProps.maxHeight = s.maxHeight);
              }
            });
          },
          /**
           * closeWindowModal
           */
          closeWindowModal: (e) => {
            n((o) => {
              const s = o.windowsModalsIds.findIndex((r) => r === e);
              s > -1 && o.windowsModalsIds.splice(s, 1), delete o.hashWindows[e];
            });
          },
          /**
           * addWindowModal
           */
          addWindowModal: (e, o, s) => {
            n((r) => {
              const i = v({
                dynamicMFParameters: s.dynamicParams
              });
              r.windowsModalsIds.push(o);
              const t = L(
                a().currentAreaId,
                s.moduleId,
                a().hashWindows
              );
              r.hashWindows[o] = {
                ...s,
                areaId: e,
                windowId: o,
                ...O,
                onClose: a().areaActions.closeWindowModal,
                dynamicMFStore: i,
                moduleCount: t
              };
            });
          },
          bouncedSaveBreakpointsLayouts: q(
            (e) => {
              if (!a().loadCookiesFromNetwork)
                return;
              const o = {
                ...a().hashAreas[e].layouts
              }, s = {};
              for (const r in o) {
                const i = o[r];
                o[r] = i.filter((t) => t.i === "none" ? !1 : a().hashAreas[e].layoutItemsIds.indexOf(t.i) > -1), o[r].length > 0 && (s[r] = o[r]);
              }
              Object.keys(s).length > 0 && I({
                networkOperation: a().networkOperation,
                endPoint: `${a().hashAreas[e].id}/${B}`,
                value: s
              }).catch(() => {
              });
            },
            H,
            {
              leading: !0,
              trailing: !0
            }
          ),
          /**
           * onBreakpointsLayoutsChange
           */
          onBreakpointsLayoutsChange: (e, o, s) => {
            J(a().hashAreas[e].layouts, s) || (n((r) => {
              r.hashAreas[e].layouts = X(s);
            }), a().hashAreas[e].maximizedId || a().areaActions.bouncedSaveBreakpointsLayouts(e));
          },
          /**
           * containerChange
           */
          onContainerChange: (e, o) => {
            n((s) => {
              s.hashAreas[e].containerHeight = o.containerHeight, s.hashAreas[e].currentBreakpoint = o.breakpoint;
            });
          },
          /**
           * selectLayout
           */
          selectLayout: (e, o) => {
            a().hashAreas[e].currentLayoutId !== o && n((s) => {
              C(s, e, o);
            });
          },
          /**
           * unColapseLayoutItem
           */
          unColapseLayoutItem: (e, o) => {
            n((s) => {
              w(s.hashAreas[e], o, !1);
            });
          },
          /**
           * colapseLayoutItem
           */
          colapseLayoutItem: (e, o) => {
            !a().hashAreas[e].maximizedId && a().hashWindows[o] && n((s) => {
              w(s.hashAreas[e], o, !0);
            });
          },
          /**
           * minimizeLayout
           */
          maximizeLayout: (e, o) => {
            n((s) => {
              const r = s.hashAreas[e];
              r && (r.maximizedId = o);
            }), o && a().areaActions.selectLayout(e, o);
          },
          /**
           * normalizeLayouts
           */
          normalizeLayouts: (e) => {
            n((o) => {
              const s = o.hashAreas[e];
              s && (s.maximizedId = void 0);
            });
          },
          /**
           * loadWindowsFromApi
           */
          loadWindowsFromApi: (e) => {
            const o = a().hashAreas[e];
            if (o && o.status === "init") {
              if (!a().loadAreasFromNetwork || !a().loadCookiesFromNetwork || !o.loadWindows) {
                n((s) => {
                  s.hashAreas[e].status = "loaded";
                });
                return;
              }
              n((s) => {
                s.hashAreas[e].status = "loading";
              }), _({
                networkOperation: a().networkOperation,
                params: { f: [{ n: "container_id", o: "e", o1: e }] }
              }).then((s) => {
                if (!a().hashAreas[e])
                  return;
                const i = s.data;
                n((t) => {
                  const d = t.hashAreas[e], { newBreakPointsLayouts: c, newHashLayoutItems: l } = R(
                    i,
                    t,
                    e
                  );
                  d.layouts = c, d.layoutItemsIds = l, d.status = "loaded";
                  const m = $(Y, i) || { currentLayoutId: "" };
                  C(t, e, m?.currentLayoutId || "", !1);
                });
              }).catch((s) => {
                n((r) => {
                  r.hashAreas[e].status = "loaded";
                });
              });
            }
          }
          // /**
          //  * setIsDraggingResizingPopup
          //  */
          // setIsDraggingResizingPopup: (areaId: string, newIsDraggingResizingPopup: boolean) => {
          //   set(state => {
          //     state.hashAreas[areaId].isDraggingResizingPopup = newIsDraggingResizingPopup;
          //   });
          // },
        },
        windowActions: {
          /**
           * setActions
           */
          setActions: (e, o, s, r) => {
            n((i) => {
              i.hashWindows[e] && (i.hashWindows[e].moduleActions = j(o), i.hashWindows[e].version = s, i.hashWindows[e].buildTime = r);
            });
          },
          /**
           * getCookie
           */
          getCookie: (e, o) => a().hashWindows[e] ? a().hashWindows[e].cookies.windowCookies[o] || a().hashWindows[e].cookies.moduleCookies[o] : {},
          /**
           * getCookies
           */
          getCookies: (e, o) => a().hashWindows[e] ? o === "window" ? a().hashWindows[e].cookies.windowCookies : a().hashWindows[e].cookies.moduleCookies : {},
          /**
           * setCookie
           */
          setCookie: (e, o, s, r) => {
            n((i) => {
              const t = i.hashWindows[e];
              t && (a().loadCookiesFromNetwork && I({
                networkOperation: a().networkOperation,
                endPoint: `${s === "module" ? t.moduleId : e}/${o}`,
                value: r
              }).catch(() => {
              }), s === "window" ? t.cookies.windowCookies[o] = r : t.cookies.moduleCookies[o] = r);
            });
          },
          /**
           * close window
           */
          close: (e, o = !0, s) => {
            const r = a().hashWindows[e];
            if (r) {
              if (r.fnQueryClose && o) {
                r.fnQueryClose(s);
                return;
              }
              const i = r.onClose;
              i && i(r.windowId);
            }
          },
          /**
           * startProgress
           */
          startProgress: (e) => {
            n((o) => {
              o.hashWindows[e] && (o.hashWindows[e].loading = !0);
            });
          },
          /**
           * stopProgress
           */
          stopProgress: (e) => {
            n((o) => {
              o.hashWindows[e] && (o.hashWindows[e].loading = !1);
            });
          },
          /**
           * loadCookiesFromApi
           */
          loadCookiesFromApi: (e) => {
            const o = a().hashWindows[e];
            if (o && o.status === "init") {
              if (!a().loadCookiesFromNetwork) {
                n((s) => {
                  s.hashWindows[e].status = "loaded";
                });
                return;
              }
              n((s) => {
                s.hashWindows[e].status = "loading";
              }), _({
                networkOperation: a().networkOperation,
                params: {
                  f: [
                    { n: "container_id", o: "e", o1: o.windowId },
                    { n: "container_id", o: "e", o1: o.moduleId }
                  ]
                }
              }).then((s) => {
                n((r) => {
                  const i = r.hashWindows[e];
                  i && (i.cookies.moduleCookies = E(
                    s.data,
                    i.moduleId
                  ), i.cookies.windowCookies = E(s.data, e), i.status = "loaded");
                });
              }).catch((s) => {
                n((r) => {
                  r.hashWindows[e] && (r.hashWindows[e].status = "loaded");
                });
              });
            }
          },
          /**
           * saveModuleCookies
           */
          saveModuleCookies: (e) => {
            const o = a().hashWindows[e];
            if (o) {
              if (!a().loadCookiesFromNetwork)
                return;
              for (const s in o.cookies.windowCookies) {
                const r = o.cookies.windowCookies[s];
                I({
                  networkOperation: a().networkOperation,
                  endPoint: `${o.moduleId}/${s}`,
                  value: r
                }).catch(() => {
                });
              }
            }
          },
          /**
           * setModuleCookies
           */
          resetModuleCookies: (e) => {
            const o = a().hashWindows[e];
            if (o) {
              if (!a().loadCookiesFromNetwork)
                return;
              P({
                networkOperation: a().networkOperation,
                data: {
                  f: [
                    {
                      n: "id",
                      o: "c",
                      o1: o.moduleId
                    }
                  ]
                }
              }).catch(() => {
              });
            }
          },
          /**
           * setFnQueryClose
           */
          setFnQueryClose: (e, o) => {
            n((s) => {
              s.hashWindows[e].fnQueryClose = o;
            });
          },
          /**
           * setWindowTitle
           */
          setWindowTitle: (e, o) => {
            n((s) => {
              s.hashWindows[e].title = o;
            });
          },
          /**
           * setWindowSubtitle
           */
          setWindowSubTitle: (e, o) => {
            n((s) => {
              s.hashWindows[e].subTitle = o;
            });
          },
          /**
           * setWindowEditionInfo
           */
          setWindowEditionInfo: (e, o) => {
            n((s) => {
              s.hashWindows[e].editionInfo = o;
            });
          }
        }
      })),
      { name: `${Z}: ${k.storeId}`, enabled: W }
    )
  );
};
export {
  fe as createAreasStore
};
