import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import { s as styleInject, u as useViewHandler, T as Toggle } from './index-bbdfb97a.js';
import classnames from 'classnames';
import { useState, useEffect } from 'react';
import Dropdown from 'react-dropdown';
import BasketActionSerious from './index-81033ea4.js';
import { observer } from 'mobx-react-lite';
import { useTranslation, DivaUtils } from '@crystaldesign/diva-core';
import { jsxs, jsx } from 'react/jsx-runtime';
import 'react-dynamic-multi-render';
import '@babel/runtime/helpers/asyncToGenerator';
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';

var formWrapper = "formWrapper-qDcu6";
var show = "show-EArlx";
var hide = "hide-PXH9V";
var headline = "headline-F6FxL";
var fullForm = "fullForm-TL--j";
var sidebyside = "sidebyside-3Yo-N";
var under = "under-hfN93";
var formButtons = "formButtons-aD3K5";
var requiredProp = "requiredProp--0b9p";
var sameHeight = "sameHeight-YPMbk";
var minHeight = "minHeight-eP9oh";
var toggle = "toggle-3hR2h";
var street = "street-Q0GIJ";
var nr = "nr-IfPHH";
var dropdownMenu = "dropdown-menu-9-3L5";
var autoMargin = "auto-margin-VKBeh";
var lieferadresse = "lieferadresse-xvF5b";
var dropdownWrapper = "dropdown-wrapper-d07ov";
var css_248z = "/* form */\n.formWrapper-qDcu6 {\n  top: 100%;\n  position: absolute;\n  width: 100%;\n}\n.show-EArlx {\n  display: flex !important;\n}\n.hide-PXH9V {\n  display: none !important;\n}\n\n.formWrapper-qDcu6 a {\n  display: flex;\n  color: black;\n  cursor: default;\n}\n.formWrapper-qDcu6 a:hover {\n  display: flex;\n  color: black;\n  cursor: default;\n}\n.formWrapper-qDcu6 .headline-F6FxL {\n  color: var(--primaryColor);\n  font-size: 150%;\n  font-weight: 300;\n  padding-bottom: 3.7%;\n  padding-top: 4%;\n  text-align: left;\n}\n.formWrapper-qDcu6 .headline-F6FxL:hover {\n  color: var(--primaryColor);\n  font-size: 150%;\n  font-weight: 300;\n  padding-bottom: 3.7%;\n  padding-top: 4%;\n  text-align: left;\n}\n.fullForm-TL--j {\n  display: flex;\n  gap: 50px;\n  padding: 0 50px;\n}\n.fullForm-TL--j > * {\n  flex-basis: 100%;\n}\n\n.sidebyside-3Yo-N {\n  display: flex;\n  flex-direction: row;\n  align-items: top;\n  flex-basis: 100%;\n  gap: 3%;\n}\n.under-hfN93 {\n  display: flex;\n  flex-direction: column;\n  align-items: top;\n  flex-basis: 100%;\n}\n.formButtons-aD3K5 {\n  margin-top: 7%;\n  margin-left: 1%;\n}\n.fullForm-TL--j .requiredProp--0b9p {\n  color: var(--primaryColor);\n  font-size: 80%;\n  padding-bottom: 2%;\n  padding-right: 38%;\n}\n.fullForm-TL--j .requiredProp--0b9p:hover {\n  color: var(--primaryColor);\n  font-size: 80%;\n  padding-bottom: 2%;\n  padding-right: 38%;\n}\n.sameHeight-YPMbk {\n  margin-top: 20px;\n}\n.formWrapper-qDcu6 input[type='checkbox'],.formWrapper-qDcu6 input[type='Checkbox'],.formWrapper-qDcu6 input[type='cHeckbox'],.formWrapper-qDcu6 input[type='CHeckbox'],.formWrapper-qDcu6 input[type='chEckbox'],.formWrapper-qDcu6 input[type='ChEckbox'],.formWrapper-qDcu6 input[type='cHEckbox'],.formWrapper-qDcu6 input[type='CHEckbox'],.formWrapper-qDcu6 input[type='cheCkbox'],.formWrapper-qDcu6 input[type='CheCkbox'],.formWrapper-qDcu6 input[type='cHeCkbox'],.formWrapper-qDcu6 input[type='CHeCkbox'],.formWrapper-qDcu6 input[type='chECkbox'],.formWrapper-qDcu6 input[type='ChECkbox'],.formWrapper-qDcu6 input[type='cHECkbox'],.formWrapper-qDcu6 input[type='CHECkbox'],.formWrapper-qDcu6 input[type='checKbox'],.formWrapper-qDcu6 input[type='ChecKbox'],.formWrapper-qDcu6 input[type='cHecKbox'],.formWrapper-qDcu6 input[type='CHecKbox'],.formWrapper-qDcu6 input[type='chEcKbox'],.formWrapper-qDcu6 input[type='ChEcKbox'],.formWrapper-qDcu6 input[type='cHEcKbox'],.formWrapper-qDcu6 input[type='CHEcKbox'],.formWrapper-qDcu6 input[type='cheCKbox'],.formWrapper-qDcu6 input[type='CheCKbox'],.formWrapper-qDcu6 input[type='cHeCKbox'],.formWrapper-qDcu6 input[type='CHeCKbox'],.formWrapper-qDcu6 input[type='chECKbox'],.formWrapper-qDcu6 input[type='ChECKbox'],.formWrapper-qDcu6 input[type='cHECKbox'],.formWrapper-qDcu6 input[type='CHECKbox'],.formWrapper-qDcu6 input[type='checkBox'],.formWrapper-qDcu6 input[type='CheckBox'],.formWrapper-qDcu6 input[type='cHeckBox'],.formWrapper-qDcu6 input[type='CHeckBox'],.formWrapper-qDcu6 input[type='chEckBox'],.formWrapper-qDcu6 input[type='ChEckBox'],.formWrapper-qDcu6 input[type='cHEckBox'],.formWrapper-qDcu6 input[type='CHEckBox'],.formWrapper-qDcu6 input[type='cheCkBox'],.formWrapper-qDcu6 input[type='CheCkBox'],.formWrapper-qDcu6 input[type='cHeCkBox'],.formWrapper-qDcu6 input[type='CHeCkBox'],.formWrapper-qDcu6 input[type='chECkBox'],.formWrapper-qDcu6 input[type='ChECkBox'],.formWrapper-qDcu6 input[type='cHECkBox'],.formWrapper-qDcu6 input[type='CHECkBox'],.formWrapper-qDcu6 input[type='checKBox'],.formWrapper-qDcu6 input[type='ChecKBox'],.formWrapper-qDcu6 input[type='cHecKBox'],.formWrapper-qDcu6 input[type='CHecKBox'],.formWrapper-qDcu6 input[type='chEcKBox'],.formWrapper-qDcu6 input[type='ChEcKBox'],.formWrapper-qDcu6 input[type='cHEcKBox'],.formWrapper-qDcu6 input[type='CHEcKBox'],.formWrapper-qDcu6 input[type='cheCKBox'],.formWrapper-qDcu6 input[type='CheCKBox'],.formWrapper-qDcu6 input[type='cHeCKBox'],.formWrapper-qDcu6 input[type='CHeCKBox'],.formWrapper-qDcu6 input[type='chECKBox'],.formWrapper-qDcu6 input[type='ChECKBox'],.formWrapper-qDcu6 input[type='cHECKBox'],.formWrapper-qDcu6 input[type='CHECKBox'],.formWrapper-qDcu6 input[type='checkbOx'],.formWrapper-qDcu6 input[type='CheckbOx'],.formWrapper-qDcu6 input[type='cHeckbOx'],.formWrapper-qDcu6 input[type='CHeckbOx'],.formWrapper-qDcu6 input[type='chEckbOx'],.formWrapper-qDcu6 input[type='ChEckbOx'],.formWrapper-qDcu6 input[type='cHEckbOx'],.formWrapper-qDcu6 input[type='CHEckbOx'],.formWrapper-qDcu6 input[type='cheCkbOx'],.formWrapper-qDcu6 input[type='CheCkbOx'],.formWrapper-qDcu6 input[type='cHeCkbOx'],.formWrapper-qDcu6 input[type='CHeCkbOx'],.formWrapper-qDcu6 input[type='chECkbOx'],.formWrapper-qDcu6 input[type='ChECkbOx'],.formWrapper-qDcu6 input[type='cHECkbOx'],.formWrapper-qDcu6 input[type='CHECkbOx'],.formWrapper-qDcu6 input[type='checKbOx'],.formWrapper-qDcu6 input[type='ChecKbOx'],.formWrapper-qDcu6 input[type='cHecKbOx'],.formWrapper-qDcu6 input[type='CHecKbOx'],.formWrapper-qDcu6 input[type='chEcKbOx'],.formWrapper-qDcu6 input[type='ChEcKbOx'],.formWrapper-qDcu6 input[type='cHEcKbOx'],.formWrapper-qDcu6 input[type='CHEcKbOx'],.formWrapper-qDcu6 input[type='cheCKbOx'],.formWrapper-qDcu6 input[type='CheCKbOx'],.formWrapper-qDcu6 input[type='cHeCKbOx'],.formWrapper-qDcu6 input[type='CHeCKbOx'],.formWrapper-qDcu6 input[type='chECKbOx'],.formWrapper-qDcu6 input[type='ChECKbOx'],.formWrapper-qDcu6 input[type='cHECKbOx'],.formWrapper-qDcu6 input[type='CHECKbOx'],.formWrapper-qDcu6 input[type='checkBOx'],.formWrapper-qDcu6 input[type='CheckBOx'],.formWrapper-qDcu6 input[type='cHeckBOx'],.formWrapper-qDcu6 input[type='CHeckBOx'],.formWrapper-qDcu6 input[type='chEckBOx'],.formWrapper-qDcu6 input[type='ChEckBOx'],.formWrapper-qDcu6 input[type='cHEckBOx'],.formWrapper-qDcu6 input[type='CHEckBOx'],.formWrapper-qDcu6 input[type='cheCkBOx'],.formWrapper-qDcu6 input[type='CheCkBOx'],.formWrapper-qDcu6 input[type='cHeCkBOx'],.formWrapper-qDcu6 input[type='CHeCkBOx'],.formWrapper-qDcu6 input[type='chECkBOx'],.formWrapper-qDcu6 input[type='ChECkBOx'],.formWrapper-qDcu6 input[type='cHECkBOx'],.formWrapper-qDcu6 input[type='CHECkBOx'],.formWrapper-qDcu6 input[type='checKBOx'],.formWrapper-qDcu6 input[type='ChecKBOx'],.formWrapper-qDcu6 input[type='cHecKBOx'],.formWrapper-qDcu6 input[type='CHecKBOx'],.formWrapper-qDcu6 input[type='chEcKBOx'],.formWrapper-qDcu6 input[type='ChEcKBOx'],.formWrapper-qDcu6 input[type='cHEcKBOx'],.formWrapper-qDcu6 input[type='CHEcKBOx'],.formWrapper-qDcu6 input[type='cheCKBOx'],.formWrapper-qDcu6 input[type='CheCKBOx'],.formWrapper-qDcu6 input[type='cHeCKBOx'],.formWrapper-qDcu6 input[type='CHeCKBOx'],.formWrapper-qDcu6 input[type='chECKBOx'],.formWrapper-qDcu6 input[type='ChECKBOx'],.formWrapper-qDcu6 input[type='cHECKBOx'],.formWrapper-qDcu6 input[type='CHECKBOx'],.formWrapper-qDcu6 input[type='checkboX'],.formWrapper-qDcu6 input[type='CheckboX'],.formWrapper-qDcu6 input[type='cHeckboX'],.formWrapper-qDcu6 input[type='CHeckboX'],.formWrapper-qDcu6 input[type='chEckboX'],.formWrapper-qDcu6 input[type='ChEckboX'],.formWrapper-qDcu6 input[type='cHEckboX'],.formWrapper-qDcu6 input[type='CHEckboX'],.formWrapper-qDcu6 input[type='cheCkboX'],.formWrapper-qDcu6 input[type='CheCkboX'],.formWrapper-qDcu6 input[type='cHeCkboX'],.formWrapper-qDcu6 input[type='CHeCkboX'],.formWrapper-qDcu6 input[type='chECkboX'],.formWrapper-qDcu6 input[type='ChECkboX'],.formWrapper-qDcu6 input[type='cHECkboX'],.formWrapper-qDcu6 input[type='CHECkboX'],.formWrapper-qDcu6 input[type='checKboX'],.formWrapper-qDcu6 input[type='ChecKboX'],.formWrapper-qDcu6 input[type='cHecKboX'],.formWrapper-qDcu6 input[type='CHecKboX'],.formWrapper-qDcu6 input[type='chEcKboX'],.formWrapper-qDcu6 input[type='ChEcKboX'],.formWrapper-qDcu6 input[type='cHEcKboX'],.formWrapper-qDcu6 input[type='CHEcKboX'],.formWrapper-qDcu6 input[type='cheCKboX'],.formWrapper-qDcu6 input[type='CheCKboX'],.formWrapper-qDcu6 input[type='cHeCKboX'],.formWrapper-qDcu6 input[type='CHeCKboX'],.formWrapper-qDcu6 input[type='chECKboX'],.formWrapper-qDcu6 input[type='ChECKboX'],.formWrapper-qDcu6 input[type='cHECKboX'],.formWrapper-qDcu6 input[type='CHECKboX'],.formWrapper-qDcu6 input[type='checkBoX'],.formWrapper-qDcu6 input[type='CheckBoX'],.formWrapper-qDcu6 input[type='cHeckBoX'],.formWrapper-qDcu6 input[type='CHeckBoX'],.formWrapper-qDcu6 input[type='chEckBoX'],.formWrapper-qDcu6 input[type='ChEckBoX'],.formWrapper-qDcu6 input[type='cHEckBoX'],.formWrapper-qDcu6 input[type='CHEckBoX'],.formWrapper-qDcu6 input[type='cheCkBoX'],.formWrapper-qDcu6 input[type='CheCkBoX'],.formWrapper-qDcu6 input[type='cHeCkBoX'],.formWrapper-qDcu6 input[type='CHeCkBoX'],.formWrapper-qDcu6 input[type='chECkBoX'],.formWrapper-qDcu6 input[type='ChECkBoX'],.formWrapper-qDcu6 input[type='cHECkBoX'],.formWrapper-qDcu6 input[type='CHECkBoX'],.formWrapper-qDcu6 input[type='checKBoX'],.formWrapper-qDcu6 input[type='ChecKBoX'],.formWrapper-qDcu6 input[type='cHecKBoX'],.formWrapper-qDcu6 input[type='CHecKBoX'],.formWrapper-qDcu6 input[type='chEcKBoX'],.formWrapper-qDcu6 input[type='ChEcKBoX'],.formWrapper-qDcu6 input[type='cHEcKBoX'],.formWrapper-qDcu6 input[type='CHEcKBoX'],.formWrapper-qDcu6 input[type='cheCKBoX'],.formWrapper-qDcu6 input[type='CheCKBoX'],.formWrapper-qDcu6 input[type='cHeCKBoX'],.formWrapper-qDcu6 input[type='CHeCKBoX'],.formWrapper-qDcu6 input[type='chECKBoX'],.formWrapper-qDcu6 input[type='ChECKBoX'],.formWrapper-qDcu6 input[type='cHECKBoX'],.formWrapper-qDcu6 input[type='CHECKBoX'],.formWrapper-qDcu6 input[type='checkbOX'],.formWrapper-qDcu6 input[type='CheckbOX'],.formWrapper-qDcu6 input[type='cHeckbOX'],.formWrapper-qDcu6 input[type='CHeckbOX'],.formWrapper-qDcu6 input[type='chEckbOX'],.formWrapper-qDcu6 input[type='ChEckbOX'],.formWrapper-qDcu6 input[type='cHEckbOX'],.formWrapper-qDcu6 input[type='CHEckbOX'],.formWrapper-qDcu6 input[type='cheCkbOX'],.formWrapper-qDcu6 input[type='CheCkbOX'],.formWrapper-qDcu6 input[type='cHeCkbOX'],.formWrapper-qDcu6 input[type='CHeCkbOX'],.formWrapper-qDcu6 input[type='chECkbOX'],.formWrapper-qDcu6 input[type='ChECkbOX'],.formWrapper-qDcu6 input[type='cHECkbOX'],.formWrapper-qDcu6 input[type='CHECkbOX'],.formWrapper-qDcu6 input[type='checKbOX'],.formWrapper-qDcu6 input[type='ChecKbOX'],.formWrapper-qDcu6 input[type='cHecKbOX'],.formWrapper-qDcu6 input[type='CHecKbOX'],.formWrapper-qDcu6 input[type='chEcKbOX'],.formWrapper-qDcu6 input[type='ChEcKbOX'],.formWrapper-qDcu6 input[type='cHEcKbOX'],.formWrapper-qDcu6 input[type='CHEcKbOX'],.formWrapper-qDcu6 input[type='cheCKbOX'],.formWrapper-qDcu6 input[type='CheCKbOX'],.formWrapper-qDcu6 input[type='cHeCKbOX'],.formWrapper-qDcu6 input[type='CHeCKbOX'],.formWrapper-qDcu6 input[type='chECKbOX'],.formWrapper-qDcu6 input[type='ChECKbOX'],.formWrapper-qDcu6 input[type='cHECKbOX'],.formWrapper-qDcu6 input[type='CHECKbOX'],.formWrapper-qDcu6 input[type='checkBOX'],.formWrapper-qDcu6 input[type='CheckBOX'],.formWrapper-qDcu6 input[type='cHeckBOX'],.formWrapper-qDcu6 input[type='CHeckBOX'],.formWrapper-qDcu6 input[type='chEckBOX'],.formWrapper-qDcu6 input[type='ChEckBOX'],.formWrapper-qDcu6 input[type='cHEckBOX'],.formWrapper-qDcu6 input[type='CHEckBOX'],.formWrapper-qDcu6 input[type='cheCkBOX'],.formWrapper-qDcu6 input[type='CheCkBOX'],.formWrapper-qDcu6 input[type='cHeCkBOX'],.formWrapper-qDcu6 input[type='CHeCkBOX'],.formWrapper-qDcu6 input[type='chECkBOX'],.formWrapper-qDcu6 input[type='ChECkBOX'],.formWrapper-qDcu6 input[type='cHECkBOX'],.formWrapper-qDcu6 input[type='CHECkBOX'],.formWrapper-qDcu6 input[type='checKBOX'],.formWrapper-qDcu6 input[type='ChecKBOX'],.formWrapper-qDcu6 input[type='cHecKBOX'],.formWrapper-qDcu6 input[type='CHecKBOX'],.formWrapper-qDcu6 input[type='chEcKBOX'],.formWrapper-qDcu6 input[type='ChEcKBOX'],.formWrapper-qDcu6 input[type='cHEcKBOX'],.formWrapper-qDcu6 input[type='CHEcKBOX'],.formWrapper-qDcu6 input[type='cheCKBOX'],.formWrapper-qDcu6 input[type='CheCKBOX'],.formWrapper-qDcu6 input[type='cHeCKBOX'],.formWrapper-qDcu6 input[type='CHeCKBOX'],.formWrapper-qDcu6 input[type='chECKBOX'],.formWrapper-qDcu6 input[type='ChECKBOX'],.formWrapper-qDcu6 input[type='cHECKBOX'],.formWrapper-qDcu6 input[type='CHECKBOX'] {\n  margin-bottom: 18px;\n}\n.minHeight-eP9oh {\n  min-height: 86px;\n}\n.toggle-3hR2h {\n  margin-top: 5px;\n}\n.fullForm-TL--j input,\n.fullForm-TL--j textarea {\n  box-sizing: border-box !important;\n}\n.fullForm-TL--j input,\n.fullForm-TL--j textarea {\n  height: 40px;\n  width: 100%;\n  display: block;\n  box-sizing: border-box;\n  padding: 0.5rem;\n  border: 1px solid #cacaca;\n  border-radius: 4px;\n  background-color: #fefefe;\n  box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.1);\n  font-family: inherit;\n  font-size: 1rem;\n  font-weight: 100;\n  color: #0a0a0a;\n  transition:\n    box-shadow 0.5s,\n    border-color 0.25s ease-in-out;\n  -webkit-appearance: none;\n  -moz-appearance: none;\n  appearance: none;\n}\n.street-Q0GIJ {\n  flex: 1 1 90%;\n}\n.nr-IfPHH {\n  flex: 1 1 10%;\n}\n.formWrapper-qDcu6 .dropdown-menu-9-3L5 {\n  max-height: 150px;\n}\n.auto-margin-VKBeh {\n  margin: auto 0px;\n}\n.lieferadresse-xvF5b {\n  margin-bottom: 1.8%;\n}\n.fullForm-TL--j textarea {\n  height: 87px !important;\n}\n.fullForm-TL--j textarea {\n  margin-bottom: 2.5%;\n  width: 100%;\n  resize: vertical;\n}\n.formWrapper-qDcu6 div {\n  outline: none !important;\n  box-shadow: none !important;\n}\n\n.dropdown-wrapper-d07ov .Dropdown-root {\n  position: relative;\n}\n\n.dropdown-wrapper-d07ov .Dropdown-control {\n  position: relative;\n  overflow: hidden;\n  box-sizing: border-box;\n  color: #333;\n  cursor: default;\n  outline: none;\n  padding: 8px 24px 8px 10px;\n  transition: all 200ms ease;\n  background-color: #fff;\n  border-radius: var(--globalBorderRadius);\n  border: 1px solid #ccc;\n  font-size: 1rem;\n  height: 38px;\n}\n\n.mobile-2XrEE .Dropdown-control {\n  font-size: 12px;\n}\n\n.tablet-37KDX .Dropdown-control {\n  font-size: 15px;\n}\n\n.dropdown-wrapper-d07ov .Dropdown-control:hover {\n  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);\n}\n\n.dropdown-wrapper-d07ov .Dropdown-arrow {\n  border-color: #999 transparent transparent;\n  border-style: solid;\n  border-width: 5px 5px 0;\n  content: ' ';\n  display: block;\n  height: 0;\n  margin-top: -ceil(2.5);\n  position: absolute;\n  right: 8px;\n  top: 15px;\n  width: 0;\n}\n\n.dropdown-wrapper-d07ov .is-open .Dropdown-arrow {\n  border-color: transparent transparent #999;\n  border-width: 0 5px 5px;\n}\n\n.dropdown-wrapper-d07ov .Dropdown-menu {\n  background-color: white;\n  box-sizing: border-box;\n  margin-top: -1px;\n  border: 1px solid #ddd;\n  max-height: 130px;\n  overflow-y: auto;\n  position: absolute;\n  top: 100%;\n  width: 100%;\n  z-index: 1100;\n  -webkit-overflow-scrolling: touch;\n}\n\n.dropdown-wrapper-d07ov .Dropdown-menu .Dropdown-group > .Dropdown-title {\n  padding: 8px 10px;\n  color: rgba(51, 51, 51, 1);\n  font-weight: 300;\n  text-transform: capitalize;\n}\n\n.dropdown-wrapper-d07ov .Dropdown-option {\n  box-sizing: border-box;\n  color: rgba(51, 51, 51, 0.8);\n  cursor: pointer;\n  display: block;\n  padding: 8px 10px;\n}\n\n.dropdown-wrapper-d07ov .Dropdown-option:last-child {\n  border-bottom-right-radius: 2px;\n  border-bottom-left-radius: 2px;\n}\n\n.dropdown-wrapper-d07ov .Dropdown-option:hover {\n  background-color: #f2f9fc;\n}\n\n.dropdown-wrapper-d07ov .Dropdown-option.is-selected {\n  background-color: #f2f9fc;\n  color: #333;\n}\n\n.dropdown-wrapper-d07ov .Dropdown-noresults {\n  box-sizing: border-box;\n  color: #ccc;\n  cursor: default;\n  display: block;\n  padding: 8px 10px;\n}\n";
styleInject(css_248z);

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var inputField = ['configurationName', 'buildService', 'sellingAdvisor', 'toProduct', 'specInformations', 'firstName', 'lastName', 'email', 'phoneNumber', 'street', 'nr', 'postalCode', 'location', 'country'];
var inputChecktype = ['simple',
// firstName
'simple',
// lastName
'email',
// email
'phoneNumber',
//phoneNumber
'simple',
// street
'simple',
// nr
'simple',
//postalCode
'simple' // location
];
var CheckOutForm = function CheckOutForm(props) {
  var _basket$ProductSetNam, _ref, _basket$Client, _basket$OrderSets, _basket$Salesperson, _viewHandler$configSt2, _viewHandler$configSt3, _basket$ClientRemark, _basket$Client$firstN, _basket$Client2, _basket$Client$prefer, _basket$Client3, _basket$Client$lastNa, _basket$Client4, _basket$Client$email, _basket$Client5, _basket$Client$phone, _basket$Client6, _basket$Client$addres, _basket$Client7, _basket$Client$addres2, _basket$Client8, _basket$Client$cap, _basket$Client9, _basket$Client$city, _basket$Client10, _ref2, _basket$Client11, _basket$Client$client, _basket$Client12, _basket$Client$delive, _basket$Client13;
  var viewHandler = useViewHandler();
  var basket = viewHandler.divaWebPlanner.getBasketData();
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    canSave = _useState2[0],
    setCanSave = _useState2[1];
  var _useState3 = useState(false),
    _useState4 = _slicedToArray(_useState3, 2),
    canSendEmail = _useState4[0],
    setCanSendEmail = _useState4[1];
  var _useState5 = useState(''),
    _useState6 = _slicedToArray(_useState5, 2),
    placeHolderSetName = _useState6[0],
    setPlaceHolderSetName = _useState6[1];
  function regexCheck(type, event) {
    switch (type) {
      case 'simple':
        if (event.length > 0) {
          return true;
        } else {
          return false;
        }
      case 'email':
        var valid = DivaUtils.validateEmail(event);
        setCanSendEmail(valid);
        return valid;
      case 'phoneNumber':
        var regPhoneNumer = /^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$/;
        if (regPhoneNumer.test(event) && event.length > 0) {
          return true;
        } else {
          return false;
        }
      case 'number':
        var regNumber = /^[0-9]*$/;
        if (regNumber.test(event) && event.length > 0) {
          return true;
        } else {
          return false;
        }
      case 'letters':
        var regLetters = /^[\u00C0-\u017Fa-zA-Z'][\u00C0-\u017Fa-zA-Z-' ]+[\u00C0-\u017Fa-zA-Z']?$/;
        if (regLetters.test(event) && event.length > 0) {
          return true;
        } else {
          return false;
        }
    }
    return false;
  }
  function InputCheck(field, event, type) {
    setSavedValues(_objectSpread(_objectSpread({}, savedValues), {}, _defineProperty({}, field, event)));
    if (field === 'buildService') {
      setValidInput(_objectSpread(_objectSpread({}, inputValidation), {}, _defineProperty({}, field, true)));
      return;
    } else setValidInput(_objectSpread(_objectSpread({}, inputValidation), {}, _defineProperty({}, field, regexCheck(type, event))));
  }
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  useEffect(function () {
    var _viewHandler$divaWebP;
    var articles = (_viewHandler$divaWebP = viewHandler.divaWebPlanner) === null || _viewHandler$divaWebP === void 0 ? void 0 : _viewHandler$divaWebP.getDivaArticles();
    if (!articles) return;
    var headboardName = false;
    var width = '';
    var length = '';
    for (var iKey in articles) {
      var _article$getArticleOp, _article$getArticleOp2, _article$getArticleOp3, _article$getArticleOp4;
      var article = articles[iKey];
      if (!width) width = (_article$getArticleOp = (_article$getArticleOp2 = article.getArticleOptionState('OPTBR')) === null || _article$getArticleOp2 === void 0 ? void 0 : _article$getArticleOp2.name) !== null && _article$getArticleOp !== void 0 ? _article$getArticleOp : '';
      if (!length) length = (_article$getArticleOp3 = (_article$getArticleOp4 = article.getArticleOptionState('OPTLAE')) === null || _article$getArticleOp4 === void 0 ? void 0 : _article$getArticleOp4.name) !== null && _article$getArticleOp3 !== void 0 ? _article$getArticleOp3 : '';
      if (article.partlistArticles) {
        for (var jKey in article.partlistArticles) {
          var _article$partlistArti;
          if (article.partlistArticles[jKey].tabGroupOption == 'Kopfteil' /* "Kopfteil" delete me in 2024 depreacted */ || (_article$partlistArti = article.partlistArticles[jKey].tabGroupOption) !== null && _article$partlistArti !== void 0 && _article$partlistArti.includes('BE_KT')) {
            headboardName = article.partlistArticles[jKey].name + ' - ';
          }
        }
      }
    }
    setPlaceHolderSetName((headboardName ? headboardName : '') + width.replace(' cm', '') + ' X ' + length);
  }, [viewHandler.settingsState.configChanged]);
  var saveValues = function saveValues(iwoFurn) {
    var _viewHandler$configSt;
    if (!basket.Client) basket.Client = {};
    basket.ProductSetName = savedValues.configurationName !== '' ? savedValues.configurationName : placeHolderSetName;
    basket.SetName = placeHolderSetName;
    if (savedValues) {
      basket.Client.firstName = savedValues.firstName;
      basket.Client.preferredContact = savedValues.preferredContact;
      basket.Client.lastName = savedValues.lastName;
      basket.Client.email = savedValues.email;
      basket.Client.phone = savedValues.phoneNumber;
      basket.Client.address = savedValues.street;
      basket.Client.addressNr = savedValues.nr;
      basket.Client.cap = savedValues.postalCode;
      basket.Client.city = savedValues.location;
      basket.Client.countryCode = savedValues.country;
      basket.Client.clientPreferedDeliveryDate = savedValues.dateofdelivery ? new Date(savedValues.dateofdelivery) : undefined;
      basket.Client.deliveryNotes = savedValues.specInformations;
      basket.Client.delivery = savedValues.buildService;
    }
    basket.ClientRemark = savedValues.toProduct;
    basket.SalespersonOverwrite = savedValues.sellingAdvisor;
    basket.SalespersonEmail = ((_viewHandler$configSt = viewHandler.configState.currentUser) === null || _viewHandler$configSt === void 0 ? void 0 : _viewHandler$configSt.mainEmail) || '';
    if (iwoFurn) {
      basket.SendIWOBasket = true;
      basket.OrderStatus = 'SEND';
    }
  };
  var _useState7 = useState({
      configurationName: (_basket$ProductSetNam = basket.ProductSetName) !== null && _basket$ProductSetNam !== void 0 ? _basket$ProductSetNam : '',
      buildService: (_ref = (_basket$Client = basket.Client) === null || _basket$Client === void 0 ? void 0 : _basket$Client.delivery) !== null && _ref !== void 0 ? _ref : !!((_basket$OrderSets = basket.OrderSets) !== null && _basket$OrderSets !== void 0 && _basket$OrderSets.find(function (set) {
        return set.OrderLines.find(function (ol) {
          var _ol$VariantBasketData;
          return !!(((_ol$VariantBasketData = ol.VariantBasketDatas) === null || _ol$VariantBasketData === void 0 || (_ol$VariantBasketData = _ol$VariantBasketData.find(function (o) {
            return o.OPT === 'SERVICE';
          })) === null || _ol$VariantBasketData === void 0 ? void 0 : _ol$VariantBasketData.OPV) == 'JA');
        });
      })),
      sellingAdvisor: (_basket$Salesperson = basket.Salesperson) !== null && _basket$Salesperson !== void 0 ? _basket$Salesperson : "".concat(((_viewHandler$configSt2 = viewHandler.configState.currentUser) === null || _viewHandler$configSt2 === void 0 ? void 0 : _viewHandler$configSt2.name) || '', " ").concat(((_viewHandler$configSt3 = viewHandler.configState.currentUser) === null || _viewHandler$configSt3 === void 0 ? void 0 : _viewHandler$configSt3.familyName) || '').trim(),
      toProduct: (_basket$ClientRemark = basket.ClientRemark) !== null && _basket$ClientRemark !== void 0 ? _basket$ClientRemark : '',
      firstName: (_basket$Client$firstN = (_basket$Client2 = basket.Client) === null || _basket$Client2 === void 0 ? void 0 : _basket$Client2.firstName) !== null && _basket$Client$firstN !== void 0 ? _basket$Client$firstN : '',
      preferredContact: (_basket$Client$prefer = (_basket$Client3 = basket.Client) === null || _basket$Client3 === void 0 ? void 0 : _basket$Client3.preferredContact) !== null && _basket$Client$prefer !== void 0 ? _basket$Client$prefer : 'email',
      lastName: (_basket$Client$lastNa = (_basket$Client4 = basket.Client) === null || _basket$Client4 === void 0 ? void 0 : _basket$Client4.lastName) !== null && _basket$Client$lastNa !== void 0 ? _basket$Client$lastNa : '',
      email: (_basket$Client$email = (_basket$Client5 = basket.Client) === null || _basket$Client5 === void 0 ? void 0 : _basket$Client5.email) !== null && _basket$Client$email !== void 0 ? _basket$Client$email : '',
      phoneNumber: (_basket$Client$phone = (_basket$Client6 = basket.Client) === null || _basket$Client6 === void 0 ? void 0 : _basket$Client6.phone) !== null && _basket$Client$phone !== void 0 ? _basket$Client$phone : '',
      street: (_basket$Client$addres = (_basket$Client7 = basket.Client) === null || _basket$Client7 === void 0 ? void 0 : _basket$Client7.address) !== null && _basket$Client$addres !== void 0 ? _basket$Client$addres : '',
      nr: (_basket$Client$addres2 = (_basket$Client8 = basket.Client) === null || _basket$Client8 === void 0 ? void 0 : _basket$Client8.addressNr) !== null && _basket$Client$addres2 !== void 0 ? _basket$Client$addres2 : '',
      postalCode: (_basket$Client$cap = (_basket$Client9 = basket.Client) === null || _basket$Client9 === void 0 ? void 0 : _basket$Client9.cap) !== null && _basket$Client$cap !== void 0 ? _basket$Client$cap : '',
      location: (_basket$Client$city = (_basket$Client10 = basket.Client) === null || _basket$Client10 === void 0 ? void 0 : _basket$Client10.city) !== null && _basket$Client$city !== void 0 ? _basket$Client$city : '',
      country: (_ref2 = (_basket$Client11 = basket.Client) === null || _basket$Client11 === void 0 ? void 0 : _basket$Client11.countryCode) !== null && _ref2 !== void 0 ? _ref2 : 'Deutschland',
      dateofdelivery: (_basket$Client$client = (_basket$Client12 = basket.Client) === null || _basket$Client12 === void 0 || (_basket$Client12 = _basket$Client12.clientPreferedDeliveryDate) === null || _basket$Client12 === void 0 ? void 0 : _basket$Client12.toString()) !== null && _basket$Client$client !== void 0 ? _basket$Client$client : '',
      specInformations: (_basket$Client$delive = (_basket$Client13 = basket.Client) === null || _basket$Client13 === void 0 ? void 0 : _basket$Client13.deliveryNotes) !== null && _basket$Client$delive !== void 0 ? _basket$Client$delive : ''
    }),
    _useState8 = _slicedToArray(_useState7, 2),
    savedValues = _useState8[0],
    setSavedValues = _useState8[1];
  var _useState9 = useState(function () {
      var booleans = [false, false, false, false, false, false, false, false];
      var fields = ['firstName', 'lastName', 'email', 'phoneNumber', 'street', 'nr', 'postalCode', 'location'];
      for (var i = 0; i < booleans.length; i++) {
        booleans[i] = regexCheck(inputChecktype[i], savedValues[fields[i]]);
      }
      return {
        firstName: booleans[0],
        lastName: booleans[1],
        email: booleans[2],
        phoneNumber: booleans[3],
        street: booleans[4],
        nr: booleans[5],
        postalCode: booleans[6],
        location: booleans[7]
      };
    }),
    _useState10 = _slicedToArray(_useState9, 2),
    inputValidation = _useState10[0],
    setValidInput = _useState10[1];
  useEffect(function () {
    if (savedValues.buildService.toString() === 'true') {
      if (Object.values(inputValidation).some(function (fields) {
        return fields === false;
      })) {
        setCanSave(false);
      } else {
        setCanSave(true);
      }
    } else if (inputValidation.firstName && inputValidation.lastName) {
      setCanSave(true);
    } else {
      setCanSave(false);
    }
  });
  return /*#__PURE__*/jsxs("div", {
    className: formWrapper,
    children: [/*#__PURE__*/jsxs("div", {
      className: fullForm,
      children: [/*#__PURE__*/jsxs("div", {
        children: [/*#__PURE__*/jsx("a", {
          className: headline,
          children: t('archive.header.productsetname')
        }), /*#__PURE__*/jsx("input", {
          placeholder: placeHolderSetName,
          className: classnames(sameHeight),
          onChange: function onChange(e) {
            return InputCheck(inputField[0], e.target.value, 'simple');
          },
          value: savedValues.configurationName
        }), /*#__PURE__*/jsx("a", {
          className: headline,
          children: t('checkout.build_service_title')
        }), /*#__PURE__*/jsxs("div", {
          className: classnames(toggle, sidebyside),
          children: [/*#__PURE__*/jsx(Toggle, {
            onChange: function onChange(e) {
              var value = !savedValues.buildService;
              viewHandler.paletteViewHandler.changeOnCheckoutConfig({
                OPTSERVICE: 'OPV' + (value ? 'JA' : 'NEIN')
              });
              setSavedValues(_objectSpread(_objectSpread({}, savedValues), {}, {
                buildService: value
              }));
            },
            state: savedValues.buildService,
            on: t('ja'),
            off: t('nein')
          }), /*#__PURE__*/jsx("a", {
            className: autoMargin,
            children: t('checkout.build_service_text')
          })]
        }), /*#__PURE__*/jsx("a", {
          className: classnames(headline),
          children: t('checkout.additional_info')
        }), /*#__PURE__*/jsxs("div", {
          className: minHeight,
          children: [/*#__PURE__*/jsx("a", {
            children: t('checkout.selling_advisor')
          }), /*#__PURE__*/jsx("input", {
            onChange: function onChange(e) {
              return InputCheck(inputField[2], e.target.value, 'simple');
            },
            value: savedValues.sellingAdvisor
          })]
        }), /*#__PURE__*/jsx("a", {
          children: t('checkout.to_product')
        }), /*#__PURE__*/jsx("textarea", {
          onChange: function onChange(e) {
            return InputCheck(inputField[3], e.target.value, 'simple');
          },
          value: savedValues.toProduct
        }), savedValues.buildService && /*#__PURE__*/jsxs("div", {
          children: [/*#__PURE__*/jsx("a", {
            children: t('checkout.spec_informations')
          }), /*#__PURE__*/jsx("textarea", {
            onChange: function onChange(e) {
              return InputCheck(inputField[4], e.target.value, 'simple');
            },
            value: savedValues.specInformations
          })]
        })]
      }), /*#__PURE__*/jsxs("div", {
        className: dropdownWrapper,
        children: [/*#__PURE__*/jsx("a", {
          className: headline,
          children: t('checkout.client_info')
        }), /*#__PURE__*/jsx("div", {
          className: under
        }), /*#__PURE__*/jsxs("div", {
          className: classnames(sidebyside, minHeight),
          children: [/*#__PURE__*/jsxs("div", {
            className: under,
            children: [/*#__PURE__*/jsxs("a", {
              children: [t('basket.clientData.form.name'), "*"]
            }), /*#__PURE__*/jsx("input", {
              onChange: function onChange(e) {
                return InputCheck(inputField[5], e.target.value, inputChecktype[0]);
              },
              value: savedValues.firstName
            }), /*#__PURE__*/jsx("a", {
              className: classnames(requiredProp, inputValidation.firstName ? hide : show),
              children: ' ' + t('checkout.required')
            })]
          }), /*#__PURE__*/jsxs("div", {
            className: under,
            children: [/*#__PURE__*/jsxs("a", {
              children: [t('basket.clientData.form.surname'), "*"]
            }), /*#__PURE__*/jsx("input", {
              onChange: function onChange(e) {
                return InputCheck(inputField[6], e.target.value, inputChecktype[1]);
              },
              value: savedValues.lastName
            }), /*#__PURE__*/jsx("a", {
              className: classnames(requiredProp, inputValidation.lastName ? hide : show),
              children: ' ' + t('checkout.required')
            })]
          })]
        }), /*#__PURE__*/jsxs("div", {
          className: minHeight,
          children: [/*#__PURE__*/jsxs("a", {
            children: [t('basket.clientData.form.email'), savedValues.buildService ? '*' : '']
          }), /*#__PURE__*/jsx("input", {
            onChange: function onChange(e) {
              return InputCheck(inputField[7], e.target.value, inputChecktype[2]);
            },
            value: savedValues.email
          }), /*#__PURE__*/jsx("a", {
            className: classnames(requiredProp, savedValues.buildService && !inputValidation.email ? show : hide),
            children: ' ' + t('checkout.required')
          })]
        }), /*#__PURE__*/jsxs("div", {
          className: minHeight,
          children: [/*#__PURE__*/jsxs("a", {
            children: [t('basket.clientData.form.phone'), savedValues.buildService ? '*' : '']
          }), /*#__PURE__*/jsx("input", {
            onChange: function onChange(e) {
              return InputCheck(inputField[8], e.target.value, inputChecktype[3]);
            },
            value: savedValues.phoneNumber
          }), /*#__PURE__*/jsx("a", {
            className: classnames(requiredProp, savedValues.buildService && !inputValidation.phoneNumber ? show : hide),
            children: ' ' + t('checkout.required')
          })]
        }), savedValues.buildService && /*#__PURE__*/jsx("a", {
          className: classnames(headline, lieferadresse),
          children: t('checkout.delivery_address')
        }), /*#__PURE__*/jsxs("div", {
          className: classnames(sidebyside, minHeight),
          children: [/*#__PURE__*/jsxs("div", {
            className: street,
            children: [/*#__PURE__*/jsxs("a", {
              children: [t('basket.clientData.form.address'), savedValues.buildService ? '*' : '']
            }), /*#__PURE__*/jsx("input", {
              className: street,
              onChange: function onChange(e) {
                return InputCheck(inputField[9], e.target.value, inputChecktype[4]);
              },
              value: savedValues.street
            }), /*#__PURE__*/jsx("a", {
              className: classnames(requiredProp, savedValues.buildService && !inputValidation.street ? show : hide),
              children: ' ' + t('checkout.required')
            })]
          }), /*#__PURE__*/jsxs("div", {
            className: nr,
            children: [/*#__PURE__*/jsxs("a", {
              children: [t('basket.clientData.form.addressNr'), savedValues.buildService ? '*' : '']
            }), /*#__PURE__*/jsx("input", {
              className: nr,
              onChange: function onChange(e) {
                return InputCheck(inputField[10], e.target.value, inputChecktype[5]);
              },
              value: savedValues.nr
            }), /*#__PURE__*/jsx("a", {
              className: classnames(requiredProp, savedValues.buildService && !inputValidation.nr ? show : hide),
              children: ' ' + t('checkout.required')
            })]
          })]
        }), /*#__PURE__*/jsxs("div", {
          className: classnames(sidebyside, minHeight),
          children: [/*#__PURE__*/jsxs("div", {
            className: under,
            children: [/*#__PURE__*/jsxs("a", {
              children: [t('basket.clientData.form.cap'), savedValues.buildService ? '*' : '']
            }), /*#__PURE__*/jsx("input", {
              onChange: function onChange(e) {
                return InputCheck(inputField[11], e.target.value, inputChecktype[6]);
              },
              value: savedValues.postalCode
            }), /*#__PURE__*/jsx("a", {
              className: classnames(requiredProp, savedValues.buildService && !inputValidation.postalCode ? show : hide),
              children: ' ' + t('checkout.required')
            })]
          }), /*#__PURE__*/jsxs("div", {
            className: under,
            children: [/*#__PURE__*/jsxs("a", {
              children: [t('basket.clientData.form.city'), savedValues.buildService ? '*' : '']
            }), /*#__PURE__*/jsx("input", {
              onChange: function onChange(e) {
                return InputCheck(inputField[12], e.target.value, inputChecktype[7]);
              },
              value: savedValues.location
            }), /*#__PURE__*/jsx("a", {
              className: classnames(requiredProp, savedValues.buildService && !inputValidation.location ? show : hide),
              children: ' ' + t('checkout.required')
            })]
          })]
        }), /*#__PURE__*/jsxs("a", {
          children: [t('basket.clientData.form.countryCode'), savedValues.buildService ? '*' : '']
        }), /*#__PURE__*/jsx(Dropdown, {
          menuClassName: dropdownMenu,
          value: savedValues.country,
          options: ['Deutschland', 'Österreich', 'Schweiz', 'Luxemburg', 'Belgien', 'Niederlande', 'Tschechien', 'Kasachstan'],
          onChange: function onChange(e) {
            return InputCheck(inputField[13], e.value, 'simple');
          }
        })]
      })]
    }), /*#__PURE__*/jsx("div", {
      className: formButtons,
      children: /*#__PURE__*/jsx(BasketActionSerious, {
        onSave: saveValues,
        saveIsDisabled: !canSave,
        sendEmailIsDisabled: !canSendEmail
      })
    })]
  });
};
var CheckoutFormNew = observer(CheckOutForm);

export { CheckoutFormNew as default };
