"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 general_settings_exports = {};
__export(general_settings_exports, {
  GeneralSettings: () => GeneralSettings
});
module.exports = __toCommonJS(general_settings_exports);
var import_design_system = require("@wix/design-system");
var import_react = __toESM(require("react"));
var import_consts = require("./../../../../ricos-content/consts.js");
var import_ricos_context = require("./../../../../ricos-context/index.js");
var import_use_node_attrs = require("./../../../../_shared/use-node-attrs.js");
var import_use_spoiler_plugin = require("./../../../../_shared/use-spoiler-plugin.js");
var import_ui_components = require("./../../../../ui-components/index.js");
var import_data_hooks = require("../../../data-hooks.js");
const GeneralSettings = ({ nodeId, logBi }) => {
  const { t } = (0, import_react.useContext)(import_ricos_context.RicosContext);
  const isSpoilerEnabled = (0, import_use_spoiler_plugin.useSpoilerPlugin)(import_consts.GALLERY_TYPE);
  const { pmNodeAttrs, patchPmNodeAttrs } = (0, import_use_node_attrs.useNodeAttrs)(nodeId, "GALLERY");
  const containerEl = (0, import_ui_components.usePanelContainerElement)();
  return /* @__PURE__ */ import_react.default.createElement(import_design_system.Box, { direction: "vertical", height: "100%", gap: "SP2" }, /* @__PURE__ */ import_react.default.createElement(
    import_ui_components.ToggleButton,
    {
      title: t("GalleryPlugin_Settings_ImagesOpenInExpandMode_Label"),
      checked: !pmNodeAttrs?.disableExpand,
      onChange: () => {
        logBi({ dataHook: import_data_hooks.GENERAL_SETTINGS_EXPAND_TOGGLE, value: !!pmNodeAttrs?.disableExpand });
        patchPmNodeAttrs?.({ disableExpand: !pmNodeAttrs?.disableExpand });
      },
      infoContent: t("GallerySettings_Expand_Mode_Toggle"),
      dataHook: import_data_hooks.GENERAL_SETTINGS_EXPAND_TOGGLE,
      size: "small",
      tooltipAppendTo: containerEl
    }
  ), /* @__PURE__ */ import_react.default.createElement(
    import_ui_components.ToggleButton,
    {
      title: t("GalleryPlugin_Settings_ImagesCanBeDownloaded_Label"),
      checked: !pmNodeAttrs?.disableDownload,
      onChange: () => {
        logBi({
          dataHook: import_data_hooks.GENERAL_SETTINGS_DOWNLOAD_TOGGLE,
          value: !!pmNodeAttrs?.disableDownload
        });
        patchPmNodeAttrs?.({ disableDownload: !pmNodeAttrs?.disableDownload });
      },
      infoContent: t("GalleryPlugin_Settings_ImagesCanBeDownloaded_Tooltip"),
      dataHook: import_data_hooks.GENERAL_SETTINGS_DOWNLOAD_TOGGLE,
      size: "small",
      tooltipAppendTo: containerEl
    }
  ), isSpoilerEnabled && /* @__PURE__ */ import_react.default.createElement(
    import_ui_components.ToggleButton,
    {
      title: t("GallerySettings_Spoiler_Toggle"),
      checked: Boolean(pmNodeAttrs?.containerData?.spoiler?.enabled),
      onChange: () => {
        logBi({
          dataHook: import_data_hooks.GENERAL_SETTINGS_SPOILER_TOGGLE,
          value: !pmNodeAttrs?.containerData?.spoiler?.enabled
        });
        patchPmNodeAttrs?.({
          containerData: {
            ...pmNodeAttrs?.containerData,
            spoiler: {
              ...pmNodeAttrs?.containerData?.spoiler,
              enabled: !pmNodeAttrs?.containerData?.spoiler?.enabled
            }
          }
        });
      },
      infoContent: t("Spoiler_Toggle_Tooltip"),
      dataHook: import_data_hooks.GENERAL_SETTINGS_SPOILER_TOGGLE,
      size: "small",
      tooltipAppendTo: containerEl
    }
  ));
};
//# sourceMappingURL=general-settings.js.map
