"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var settings_modal_exports = {};
__export(settings_modal_exports, {
  SettingsModal: () => SettingsModal
});
module.exports = __toCommonJS(settings_modal_exports);
var import_design_system = require("@wix/design-system");
var import_classnames = __toESM(require("classnames"));
var import_react = __toESM(require("react"));
var import_ricos_context = require("./../../../ricos-context/index.js");
var import_bi_context_provider = require("./../../../_shared/bi-context-provider/bi-context-provider.js");
var import_uncreachable = require("./../../../_shared/uncreachable.js");
var import_ui_components = require("./../../../ui-components/index.js");
var import_consts = require("../../consts.js");
var import_data_hooks = require("../../data-hooks.js");
var import_design_settings_section = require("./design-settings-section.js");
var import_layout_settings_section = require("./layout-settings-section.js");
var import_poll_settings_section = require("./poll-settings-section.js");
var import_settings_modal_scss = __toESM(require("./settings-modal-scss.js"));
var import_tab_navigation = require("./tab-navigation.js");
const SettingsModal = ({
  nodeId,
  activeTab: initialTab,
  config,
  modalId
}) => {
  const { t, isMobile } = (0, import_react.useContext)(import_ricos_context.RicosContext);
  const modalService = (0, import_react.useContext)(import_ricos_context.ModalServiceContext);
  const [activeTab, setActiveTab] = (0, import_react.useState)(initialTab ?? "layout");
  const logBi = (0, import_bi_context_provider.useBiNext)({ pluginId: "poll", modalId: import_consts.POLL_SETTINGS_MODAL_ID, nodeId });
  const closeModal = () => modalService.closeModal(modalId);
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: (0, import_classnames.default)({
        [import_settings_modal_scss.default.modalDesktop]: !isMobile
      })
    },
    /* @__PURE__ */ import_react.default.createElement(
      import_ui_components.Panel,
      {
        closeButtonProps: { onClick: closeModal },
        dataHook: import_data_hooks.SETTINGS_MODAL,
        maxHeight: isMobile ? void 0 : 590
      },
      /* @__PURE__ */ import_react.default.createElement(import_ui_components.PanelHeader, { title: t("Poll_PollSettings_Common_Header") }),
      /* @__PURE__ */ import_react.default.createElement(import_tab_navigation.TabNavigation, { activeTab, onTabChange: setActiveTab }),
      /* @__PURE__ */ import_react.default.createElement(
        import_design_system.Box,
        {
          direction: "vertical",
          padding: "SP3",
          gap: "SP2",
          overflow: "auto",
          className: import_settings_modal_scss.default.content
        },
        (() => {
          switch (activeTab) {
            case import_consts.SETTINGS_TAB.layout:
              return /* @__PURE__ */ import_react.default.createElement(import_layout_settings_section.LayoutSettingsSection, { nodeId, logBi });
            case import_consts.SETTINGS_TAB.design:
              return /* @__PURE__ */ import_react.default.createElement(import_design_settings_section.DesignSettingsSection, { nodeId, logBi });
            case import_consts.SETTINGS_TAB.settings:
              return /* @__PURE__ */ import_react.default.createElement(import_poll_settings_section.PollSettingsSection, { nodeId, config, logBi });
            default:
              (0, import_uncreachable.unreachable)(activeTab);
              return null;
          }
        })()
      )
    )
  );
};
//# sourceMappingURL=settings-modal.js.map
