import { s as styleInject, u as useViewHandler } from './index-bbdfb97a.js';
import classnames from 'classnames';
import DockFilter from './index-056f2eae.js';
import RALFilter from './index-7f2e9c31.js';
import { observer } from 'mobx-react-lite';
import 'react';
import { useDivaCore, useTranslation } from '@crystaldesign/diva-core';
import Searchbar from './index-2f37b9f2.js';
import ToggleHeader from './index-07dcdfbf.js';
import NumberInput from './index-47c24a7e.js';
import InfoButton from './index-45a336e4.js';
import PDFButton from './index-d18644c0.js';
import SummaryVariantButton from './index-417c106a.js';
import SelectedOpv from './index-bb465149.js';
import InfoIcon from './index-04a7a9b4.js';
import SettingsPosNr from './index-cf5f891b.js';
import SettingsConfigSingle from './index-e35b73c9.js';
import { u as useStickyScroll } from './ussIsSticky-2f6bc37b.js';
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
import '@babel/runtime/helpers/defineProperty';
import 'react-dynamic-multi-render';
import '@babel/runtime/helpers/asyncToGenerator';
import '@babel/runtime/helpers/slicedToArray';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/regenerator';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import '@babel/runtime/helpers/toConsumableArray';
import '@crystaldesign/diva-utils';
import 'mobx';
import '@crystaldesign/web-planner-logic';
import 'qrcode.react';
import '@babel/runtime/helpers/typeof';
import 'flat';
import 'react-switch';
import 'react-countup';
import '@babel/runtime/helpers/objectDestructuringEmpty';
import './index-4b3e6bbf.js';
import 'react-dropdown';
import './index-69271b96.js';
import './index-9a965a68.js';
import '@crystaldesign/content-box';
import './index-e9a81262.js';
import './index-409bde34.js';
import 'react-laag';
import './index-7635bafb.js';
import './index-08388020.js';
import 'swiper/react';

var headerWrapper = "header-wrapper-qVEmI";
var wcConfiguratorSettingsHeaderTitle = "wcConfigurator-settings-header-title--CcUK";
var isSticky = "is-sticky-9WgWo";
var portrait = "portrait-8Z7gh";
var tablet = "tablet-GGMXO";
var scroller = "scroller-jdhnI";
var wcConfiguratorSettingsHeaderPrice = "wcConfigurator-settings-header-price-UmViW";
var isHeader = "is-header-sgSKB";
var option = "option-M-arn";
var wcConfigItemHeader = "wcConfigItem-Header-JEANn";
var minExpanded = "min-expanded-kEE9N";
var quantity = "quantity-GKJLF";
var iconsContainer = "icons-container-DbfdO";
var css_248z = ".header-wrapper-qVEmI {\n  display: flex;\n  flex-direction: row;\n  flex-wrap: nowrap;\n  gap: 10px;\n  justify-content: space-between;\n  align-items: center;\n}\n\n.wcConfigurator-settings-header-title--CcUK {\n  width: auto;\n  font-weight: 600;\n  font-size: 20px;\n  line-height: 24px;\n  color: var(--secondaryColor);\n  margin-top: 10px;\n  float: left;\n  -webkit-user-select: none;\n     -moz-user-select: none;\n          user-select: none;\n  transition:\n    font-size 0.4s ease,\n    margin-top 0.4s ease,\n    line-height 0.4s ease;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .darkmode .wcConfigurator-settings-header-title--CcUK,\nbody.diva-component-DIVA_BACKOFFICE_NEW .darkmode .wcConfigurator-settings-header-title--CcUK {\n  color: #f7fafc;\n}\n\n.is-sticky-9WgWo {\n  font-size: 16px;\n  margin-top: 5px;\n  background-color: var(--settingsBackgroundColor);\n}\n\n.portrait-8Z7gh.is-sticky-9WgWo:not(.tablet-GGMXO) {\n  --infoIconSize: 16px;\n}\n\n.scroller-jdhnI.is-sticky-9WgWo .wcConfigurator-settings-header-title--CcUK {\n  font-size: 16px;\n  line-height: 20px;\n  z-index: 2000;\n}\n\n.portrait-8Z7gh:not(.tablet-GGMXO) .wcConfigurator-settings-header-title--CcUK {\n  font-size: 16px;\n  line-height: 20px;\n}\n\n.is-sticky-9WgWo.portrait-8Z7gh:not(.tablet-GGMXO) .wcConfigurator-settings-header-title--CcUK {\n  font-size: 13px;\n  line-height: 17px;\n}\n\n.wcConfigurator-settings-header-price-UmViW {\n  width: auto;\n  font-weight: 600;\n  font-size: 20px;\n  line-height: 24px;\n  color: var(--secondaryColor);\n  margin-top: 10px;\n}\n\n.scroller-jdhnI .wcConfigurator-settings-header-title--CcUK {\n  max-width: calc(100% - 51.2px);\n  margin: 4px 0px;\n}\n\n.is-sticky-9WgWo.scroller-jdhnI .wcConfigurator-settings-header-title--CcUK,\n.portrait-8Z7gh.is-sticky-9WgWo.scroller-jdhnI:hover .wcConfigurator-settings-header-title--CcUK {\n  margin: 4px 0px;\n}\n\n.is-sticky-9WgWo.scroller-jdhnI:hover .wcConfigurator-settings-header-title--CcUK {\n  margin: 4px 0px;\n}\n\n.scroller-jdhnI .wcConfigurator-settings-header-title--CcUK.wcFilterIsVisible-S9QKu {\n  max-width: calc(50% - 19.2px);\n}\n\n.is-sticky-9WgWo.is-header-sgSKB.scroller-jdhnI.option-M-arn {\n  position: relative;\n}\n\n.wcConfigItem-Header-JEANn {\n  border-radius: 0 !important;\n  border-radius: initial !important;\n}\n\n.wcConfigItem-Header-JEANn {\n  margin-top: 8px;\n  height: -moz-fit-content;\n  height: fit-content;\n  min-height: 30px;\n  position: relative;\n  display: flex;\n  flex-direction: column;\n  position: sticky;\n  top: 0;\n  z-index: 1000;\n}\n\n.min-expanded-kEE9N.wcConfigItem-Header-JEANn {\n  overflow: hidden;\n}\n\n:not(.scroller-jdhnI).wcConfigItem-Header-JEANn {\n  margin-left: var(--settingsScrollerPaddingLeft);\n  margin-right: var(--settingsScrollerPaddingRight);\n}\n\n.is-sticky-9WgWo.wcConfigItem-Header-JEANn {\n  min-height: 0;\n  min-height: initial;\n}\n\n.quantity-GKJLF {\n  max-width: 200px;\n  float: left;\n  padding-top: 12px;\n  padding-left: 20%;\n}\n\n.icons-container-DbfdO {\n  display: flex;\n  align-items: center;\n  float: right;\n  position: relative;\n  margin-top: 5px;\n  flex-grow: 2;\n  justify-content: flex-end;\n  max-width: 100%;\n  gap: 10px;\n  transition: opacity 0.4s ease;\n  opacity: 1;\n  margin-bottom: 4px;\n}\n\n.portrait-8Z7gh .icons-container-DbfdO {\n  gap: 6px;\n}\n\n.portrait-8Z7gh:not(.tablet-GGMXO).is-sticky-9WgWo .icons-container-DbfdO {\n  opacity: 0;\n  width: 0px;\n  height: 0px;\n  pointer-events: none;\n}\n\n.is-sticky-9WgWo:not(.portrait-8Z7gh):hover .icons-container-DbfdO {\n  opacity: 1;\n  height: auto;\n}\n";
styleInject(css_248z);

var SettingsItemHeader = function SettingsItemHeader(_ref) {
  var _viewHandler$settings, _viewHandler$getViewC, _item$selectedElement, _item$selectedElement2, _item$selectedElement3;
  var isSettingsHeader = _ref.isSettingsHeader,
    item = _ref.item,
    isInScroller = _ref.isInScroller,
    _ref$titleClass = _ref.titleClass,
    titleClass = _ref$titleClass === void 0 ? wcConfiguratorSettingsHeaderTitle : _ref$titleClass,
    _ref$containerClass = _ref.containerClass,
    containerClass = _ref$containerClass === void 0 ? wcConfigItemHeader : _ref$containerClass,
    text = _ref.text,
    header = _ref.header,
    specialElement1 = _ref.specialElement1;
  var viewHandler = useViewHandler();
  var _useDivaCore = useDivaCore(),
    hidePrices = _useDivaCore.state.hidePrices;
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  var headerStickyPosThreshhold = (item === null || item === void 0 ? void 0 : item.configStepKey) == 'SUMMARY' && item.id == 2 ? 48 : (item === null || item === void 0 ? void 0 : item.configStepKey) == 'PLANNER' && viewHandler.settingsState.planner2Dot0Active && item.id == 2 ? viewHandler.uiState.isInMobileView ? viewHandler.uiState.isTablet ? 99 : 74 : 74 : 0;
  var _useStickyScroll = useStickyScroll(headerStickyPosThreshhold, (_viewHandler$settings = viewHandler.settingsState.settingsScrollerElement) !== null && _viewHandler$settings !== void 0 ? _viewHandler$settings : null),
    stickyRef = _useStickyScroll.stickyRef,
    isStickyScroll = _useStickyScroll.isSticky;
  var FilterTypeComponentMap = {
    DockFilter: !viewHandler.settingsState.plannerReplaceMode ? DockFilter : function () {
      return /*#__PURE__*/jsx(Fragment, {});
    },
    RAL: !viewHandler.uiState.ViewConfig.hideRalColorFilter ? RALFilter : function () {
      return /*#__PURE__*/jsx(Fragment, {});
    },
    CONCEPT: function CONCEPT() {
      return /*#__PURE__*/jsx(Fragment, {});
    },
    None: function None() {
      return /*#__PURE__*/jsx(Fragment, {});
    }
  };
  var PaletteComponent = FilterTypeComponentMap[item !== null && item !== void 0 && item.filterComponent ? item.filterComponent : 'None'];
  var doShowSearchbar = (item === null || item === void 0 ? void 0 : item.searchVisible) && (!isSettingsHeader || !!item.shelfPlannerGrids || item.type == 'PLANNER_2.0') && !viewHandler.uiState.ViewConfig.hideSearchBar && !item.isRenderedNotInSettingPalette;
  var doShowFilter = (item === null || item === void 0 ? void 0 : item.filterVisible) && !isSettingsHeader && item.filterComponent;
  var isStickyVal = isStickyScroll || viewHandler.settingsState.isScrollingDown && viewHandler.configuratorStructureHandler.curTabgroupType.includes('PLANNER');
  var title = text ? t(text) : (isSettingsHeader || (item === null || item === void 0 ? void 0 : item.type) == 'TOGGLE') && (!viewHandler.getIsInMobileView() || !viewHandler.settingsState.posNrAreHidden) ? t('configurator.' + viewHandler.settingsState.paletteHeaderStepName, viewHandler.settingsState.paletteHeaderStepName) : t('configurator.' + item.name, item.name);
  if (item !== null && item !== void 0 && item.isMultiselect) {
    title = title + ' (' + t('configurator.isMultiselect') + ')';
  }
  if ((_viewHandler$getViewC = viewHandler.getViewConfig()) !== null && _viewHandler$getViewC !== void 0 && _viewHandler$getViewC.showOptionCodexInOptionHeader) title = title + (item !== null && item !== void 0 && item.optionCodex ? ' (' + item.optionCodex + ')' : '');
  if (title == '') return /*#__PURE__*/jsx(Fragment, {});
  return /*#__PURE__*/jsx("div", {
    className: classnames(containerClass, viewHandler.uiState.isMobilePortrait ? portrait : undefined, viewHandler.uiState.isTablet ? tablet : undefined, viewHandler.uiState.configSettingsIsMinExpanded ? minExpanded : undefined, header ? isHeader : undefined, isInScroller ? scroller : undefined, isStickyVal ? isSticky : undefined, (item === null || item === void 0 ? void 0 : item.configStepKey) == 'OPTION' ? option : undefined),
    ref: stickyRef,
    style: {
      top: headerStickyPosThreshhold
    },
    children: /*#__PURE__*/jsxs("div", {
      onClick: function onClick(e) {
        return e.stopPropagation();
      },
      className: headerWrapper,
      children: [/*#__PURE__*/jsxs("div", {
        className: titleClass,
        children: [/*#__PURE__*/jsx("span", {
          "data-test-id": "settingsItemHeaderTitle",
          children: title
        }), !isSettingsHeader && (item === null || item === void 0 ? void 0 : item.measureUnit) && /*#__PURE__*/jsx(NumberInput, {
          item: item
        })]
      }), !isSettingsHeader && /*#__PURE__*/jsx(Fragment, {
        children: item !== null && item !== void 0 && (_item$selectedElement = item.selectedElements) !== null && _item$selectedElement !== void 0 && (_item$selectedElement = _item$selectedElement[0]) !== null && _item$selectedElement !== void 0 && _item$selectedElement.url ? /*#__PURE__*/jsx(InfoButton, {
          id: item.id,
          selectedElement: item.selectedElements[0],
          openUrl: true
        }) : item !== null && item !== void 0 && item.optionContentItemId ? /*#__PURE__*/jsx(InfoIcon, {
          item: {
            contentItemId: item.optionContentItemId,
            codex: item.configStepKey
          },
          style: {
            position: 'relative',
            marginLeft: 8
          }
        }, item.optionCodex) : !isSettingsHeader && viewHandler.uiState.isInMobileView && (item === null || item === void 0 || (_item$selectedElement2 = item.selectedElements) === null || _item$selectedElement2 === void 0 ? void 0 : _item$selectedElement2.length) && viewHandler.getViewConfig().infoButton && /*#__PURE__*/jsx(InfoButton, {
          id: item.id,
          selectedElement: item.selectedElements[0]
        })
      }), (item === null || item === void 0 ? void 0 : item.quantity) !== undefined && !isSettingsHeader && /*#__PURE__*/jsxs("div", {
        className: classnames(quantity),
        children: [" ", t('configurator.quantity', 'Anzahl') + ': ' + (item === null || item === void 0 ? void 0 : item.quantity), "x"]
      }), /*#__PURE__*/jsxs("div", {
        className: iconsContainer,
        children: [!hidePrices && !isSettingsHeader && (item === null || item === void 0 ? void 0 : item.price) !== undefined && /*#__PURE__*/jsx("div", {
          className: wcConfiguratorSettingsHeaderPrice,
          children: item === null || item === void 0 ? void 0 : item.price
        }), header && viewHandler.settingsState.doShowConfigSingle ? /*#__PURE__*/jsx(SettingsConfigSingle, {}) : undefined, header && viewHandler.settingsState.doShowActElementInfo && !viewHandler.uiState.ViewConfig.hideElementInfo && /*#__PURE__*/jsx(SettingsPosNr, {}), specialElement1, (item === null || item === void 0 ? void 0 : item.type) == 'TOGGLE_HEADER' && /*#__PURE__*/jsx(ToggleHeader, {
          item: item
        }), doShowSearchbar && /*#__PURE__*/jsx(Searchbar, {
          isInScroller: isInScroller,
          item: item,
          doShowFilter: !!doShowFilter
        }, item === null || item === void 0 ? void 0 : item.configStepKey), doShowFilter && /*#__PURE__*/jsx(PaletteComponent, {
          id: item === null || item === void 0 ? void 0 : item.id
        }), item && /*#__PURE__*/jsx(SummaryVariantButton, {
          item: item
        }), !isSettingsHeader && (item === null || item === void 0 || (_item$selectedElement3 = item.selectedElements) === null || _item$selectedElement3 === void 0 || (_item$selectedElement3 = _item$selectedElement3[0]) === null || _item$selectedElement3 === void 0 ? void 0 : _item$selectedElement3.pdfUrl) && /*#__PURE__*/jsx(PDFButton, {
          pdfUrl: item === null || item === void 0 ? void 0 : item.selectedElements[0].pdfUrl
        })]
      }), (item === null || item === void 0 ? void 0 : item.selectedElements) && (item === null || item === void 0 ? void 0 : item.isMultiselect) && header && /*#__PURE__*/jsx(SelectedOpv, {
        item: item,
        selectedElements: item.selectedElements
      })]
    })
  });
};
var SettingsItemHeader$1 = observer(SettingsItemHeader);

export { SettingsItemHeader$1 as default };
