Liferay.Loader.define("commerce-frontend-taglib@10.1.16/add_to_cart/AddToCartButton.soy", ['module', 'exports', 'require', 'frontend-js-metal-web$metal-component', 'frontend-js-metal-web$metal-soy'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = exports.templates = exports.AddToCartButton = void 0;

    var _metalComponent = _interopRequireDefault(require("frontend-js-metal-web$metal-component"));

    var _metalSoy = _interopRequireDefault(require("frontend-js-metal-web$metal-soy"));

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

    function _classCallCheck(instance, Constructor) {
      if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
      }
    }

    function _possibleConstructorReturn(self, call) {
      if (call && (_typeof(call) === "object" || typeof call === "function")) {
        return call;
      }return _assertThisInitialized(self);
    }

    function _assertThisInitialized(self) {
      if (self === void 0) {
        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
      }return self;
    }

    function _getPrototypeOf(o) {
      _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
        return o.__proto__ || Object.getPrototypeOf(o);
      };return _getPrototypeOf(o);
    }

    function _inherits(subClass, superClass) {
      if (typeof superClass !== "function" && superClass !== null) {
        throw new TypeError("Super expression must either be null or a function");
      }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);
    }

    function _setPrototypeOf(o, p) {
      _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
        o.__proto__ = p;return o;
      };return _setPrototypeOf(o, p);
    }

    var templates;
    exports.templates = templates;
    goog.loadModule(function (exports) {
      var soy = goog.require('soy');

      goog.require('soydata');

      // This file was automatically generated from AddToCartButton.soy.
      // Please don't edit this file by hand.

      /**
       * @fileoverview Templates in namespace AddToCartButton.
       * @public
       */

      goog.module('AddToCartButton.incrementaldom');

      goog.require('goog.soy.data.SanitizedContent');

      goog.require('goog.string');

      var incrementalDom = goog.require('incrementaldom');

      goog.require('soy.asserts');

      var soyIdom = goog.require('soy.idom');

      var $templateAlias2 = _metalSoy.default.getTemplate('ClayIcon.incrementaldom', 'render');

      var $templateAlias1 = _metalSoy.default.getTemplate('QuantitySelector.incrementaldom', 'render');
      /**
       * @param {{
       *  disabled: (boolean|null|undefined),
       *  buttonStyle: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  accountId: (!goog.soy.data.SanitizedContent|null|number|string|undefined),
       *  inputQuantity: (null|number|undefined),
       *  updatingTransition: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  quantity: (null|number|undefined),
       *  settings: (?),
       *  spritemap: (?),
       *  textContent: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  _handleSubmitClick: (*|null|undefined),
       *  _handleUpdateQuantity: (*|null|undefined),
       *  _handleSubmitQuantity: (*|null|undefined)
       * }} opt_data
       * @param {Object<string, *>=} opt_ijData
       * @param {Object<string, *>=} opt_ijData_deprecated
       * @return {void}
       * @suppress {checkTypes}
       */

      function $render(opt_data, opt_ijData, opt_ijData_deprecated) {
        opt_ijData = opt_ijData_deprecated || opt_ijData;
        /** @type {boolean|null|undefined} */

        var disabled = soy.asserts.assertType(opt_data.disabled == null || goog.isBoolean(opt_data.disabled) || opt_data.disabled === 1 || opt_data.disabled === 0, 'disabled', opt_data.disabled, 'boolean|null|undefined');
        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */

        var buttonStyle = soy.asserts.assertType(opt_data.buttonStyle == null || goog.isString(opt_data.buttonStyle) || opt_data.buttonStyle instanceof goog.soy.data.SanitizedContent, 'buttonStyle', opt_data.buttonStyle, '!goog.soy.data.SanitizedContent|null|string|undefined');
        /** @type {!goog.soy.data.SanitizedContent|null|number|string|undefined} */

        var accountId = soy.asserts.assertType(opt_data.accountId == null || goog.isNumber(opt_data.accountId) || goog.isString(opt_data.accountId) || opt_data.accountId instanceof goog.soy.data.SanitizedContent, 'accountId', opt_data.accountId, '!goog.soy.data.SanitizedContent|null|number|string|undefined');
        /** @type {null|number|undefined} */

        var inputQuantity = soy.asserts.assertType(opt_data.inputQuantity == null || goog.isNumber(opt_data.inputQuantity), 'inputQuantity', opt_data.inputQuantity, 'null|number|undefined');
        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */

        var updatingTransition = soy.asserts.assertType(opt_data.updatingTransition == null || goog.isString(opt_data.updatingTransition) || opt_data.updatingTransition instanceof goog.soy.data.SanitizedContent, 'updatingTransition', opt_data.updatingTransition, '!goog.soy.data.SanitizedContent|null|string|undefined');
        /** @type {null|number|undefined} */

        var quantity = soy.asserts.assertType(opt_data.quantity == null || goog.isNumber(opt_data.quantity), 'quantity', opt_data.quantity, 'null|number|undefined');
        /** @type {?} */

        var settings = opt_data.settings;
        /** @type {?} */

        var spritemap = opt_data.spritemap;
        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */

        var textContent = soy.asserts.assertType(opt_data.textContent == null || goog.isString(opt_data.textContent) || opt_data.textContent instanceof goog.soy.data.SanitizedContent, 'textContent', opt_data.textContent, '!goog.soy.data.SanitizedContent|null|string|undefined');
        /** @type {*|null|undefined} */

        var _handleSubmitClick = opt_data._handleSubmitClick;
        /** @type {*|null|undefined} */

        var _handleUpdateQuantity = opt_data._handleUpdateQuantity;
        /** @type {*|null|undefined} */

        var _handleSubmitQuantity = opt_data._handleSubmitQuantity;
        var addToCartClasses__soy1073 = '';
        addToCartClasses__soy1073 += 'add-to-cart';
        addToCartClasses__soy1073 += buttonStyle == 'block' ? ' add-to-cart-block' : ' add-to-cart-inline';
        var btnAddToCartClasses__soy1082 = '';
        btnAddToCartClasses__soy1082 += 'btn btn-primary btn-lg btn-add-to-cart';
        btnAddToCartClasses__soy1082 += buttonStyle == 'block' ? ' btn-add-to-cart-block' : ' btn-add-to-cart-inline';
        var iconContainerClasses__soy1091 = '';
        iconContainerClasses__soy1091 += 'add-to-cart-icon-container inline-item inline-item-after';
        iconContainerClasses__soy1091 += quantity && quantity > 0 ? ' active' : '';
        var quantityMarkerClasses__soy1098 = '';
        quantityMarkerClasses__soy1098 += 'add-to-cart-quantity-marker';
        var $tmp = null;

        if (updatingTransition == 'adding') {
          $tmp = ' adding';
        } else if (updatingTransition == 'incrementing') {
          $tmp = ' incrementing';
        } else if (quantity && quantity > 0) {
          $tmp = ' active';
        } else {
          $tmp = '';
        }

        quantityMarkerClasses__soy1098 += $tmp;
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', addToCartClasses__soy1073);
        incrementalDom.elementOpenEnd();
        $templateAlias1({
          events: {
            submitQuantity: _handleSubmitQuantity,
            updateQuantity: _handleUpdateQuantity
          },
          quantity: inputQuantity,
          minQuantity: settings.minQuantity,
          maxQuantity: settings.maxQuantity,
          multipleQuantity: settings.multipleQuantity,
          allowedQuantities: settings.allowedQuantities,
          disabled: disabled
        }, null, opt_ijData);
        incrementalDom.elementOpenStart('button');
        incrementalDom.attr('class', btnAddToCartClasses__soy1082);
        incrementalDom.attr('data-onclick', _handleSubmitClick);
        incrementalDom.attr('tabindex', '0');

        if ((accountId != null && disabled != null && disabled == false) == false) {
          incrementalDom.attr('disabled', '');
        }

        incrementalDom.elementOpenEnd();

        if (textContent) {
          soyIdom.print(textContent);
        } else {
          /** @desc Add to Cart */
          var MSG_EXTERNAL_1466801703579507640 = Liferay.Language.get('add-to-cart');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_1466801703579507640));
        }

        incrementalDom.elementOpenStart('span');
        incrementalDom.attr('class', iconContainerClasses__soy1091);
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('span');
        incrementalDom.attr('class', 'add-to-cart-icon');
        incrementalDom.elementOpenEnd();
        $templateAlias2({
          spritemap: spritemap,
          symbol: 'shopping-cart'
        }, null, opt_ijData);
        incrementalDom.elementClose('span');
        incrementalDom.elementOpenStart('span');
        incrementalDom.attr('class', quantityMarkerClasses__soy1098);
        incrementalDom.attr('ref', 'marker');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementClose('span');
        incrementalDom.elementClose('span');
        incrementalDom.elementClose('button');
        incrementalDom.elementClose('div');
      }

      exports.render = $render;
      /**
       * @typedef {{
       *  disabled: (boolean|null|undefined),
       *  buttonStyle: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  accountId: (!goog.soy.data.SanitizedContent|null|number|string|undefined),
       *  inputQuantity: (null|number|undefined),
       *  updatingTransition: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  quantity: (null|number|undefined),
       *  settings: (?),
       *  spritemap: (?),
       *  textContent: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  _handleSubmitClick: (*|null|undefined),
       *  _handleUpdateQuantity: (*|null|undefined),
       *  _handleSubmitQuantity: (*|null|undefined)
       * }}
       */

      $render.Params;

      if (goog.DEBUG) {
        $render.soyTemplateName = 'AddToCartButton.render';
      }

      exports.render.params = ["disabled", "buttonStyle", "accountId", "inputQuantity", "updatingTransition", "quantity", "settings", "spritemap", "textContent", "_handleSubmitClick", "_handleUpdateQuantity", "_handleSubmitQuantity"];
      exports.render.types = {
        "disabled": "bool ",
        "buttonStyle": "string ",
        "accountId": "number|string ",
        "inputQuantity": "int ",
        "updatingTransition": "string",
        "quantity": "int ",
        "settings": "? ",
        "spritemap": "? ",
        "textContent": "string",
        "_handleSubmitClick": "any ",
        "_handleUpdateQuantity": "any ",
        "_handleSubmitQuantity": "any "
      };
      exports.templates = templates = exports;
      return exports;
    });

    var AddToCartButton = /*#__PURE__*/function (_Component) {
      _inherits(AddToCartButton, _Component);

      function AddToCartButton() {
        _classCallCheck(this, AddToCartButton);

        return _possibleConstructorReturn(this, _getPrototypeOf(AddToCartButton).apply(this, arguments));
      }

      return AddToCartButton;
    }(_metalComponent.default);

    exports.AddToCartButton = AddToCartButton;

    _metalSoy.default.register(AddToCartButton, templates);

    var _default = templates;
    /* jshint ignore:end */

    exports.default = _default;
    //# sourceMappingURL=AddToCartButton.soy.js.map
  }
});
//# sourceMappingURL=AddToCartButton.soy.js.map