import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
import { u as useViewHandler, _ as _onClickCheckout, I as Icon } from './index-bbdfb97a.js';
import 'react';
import { useTranslation } from '@crystaldesign/diva-core';
import { jsx, Fragment } from 'react/jsx-runtime';
import 'react-dynamic-multi-render';
import 'mobx-react-lite';
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 'classnames';
import 'qrcode.react';
import '@babel/runtime/helpers/typeof';
import 'flat';
import 'react-switch';
import 'react-countup';

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 BasketMobile = function BasketMobile(_ref) {
  var _viewHandler$uiState$;
  var props = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
  var viewHandler = useViewHandler();
  var addToBasketButton = (_viewHandler$uiState$ = viewHandler.uiState.checkoutConfig) === null || _viewHandler$uiState$ === void 0 ? void 0 : _viewHandler$uiState$.buttons.find(function (b) {
    return b.type === 'ADD_TO_BASKET';
  });
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  return /*#__PURE__*/jsx(Fragment, {
    children: addToBasketButton ? /*#__PURE__*/jsx("div", {
      onClick: function onClick() {
        return _onClickCheckout(addToBasketButton, viewHandler, addToBasketButton.index, t);
      },
      className: props.className,
      style: {
        backgroundImage: 'unset',
        display: 'flex',
        justifyContent: 'center',
        alignItems: 'center'
      },
      children: /*#__PURE__*/jsx(Icon, {
        checkoutButton: _objectSpread({
          isPrimary: true
        }, addToBasketButton),
        size: 32
      })
    }) : /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({}, props), {}, {
      onClick: function onClick() {
        return viewHandler.actionButtonState.onClickAddToBasket(viewHandler);
      }
    }))
  });
};

export { BasketMobile as default };
