Liferay.Loader.define("commerce-frontend-taglib@10.1.16/products_compare/ProductsCompare.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.ProductsCompare = 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 ProductsCompare.soy.
      // Please don't edit this file by hand.

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

      goog.module('ProductsCompare.incrementaldom');

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

      goog.require('goog.string');

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

      goog.require('soy.asserts');

      goog.require('soy.idom');

      var $templateAlias1 = _metalSoy.default.getTemplate('ProductsCompareItem.incrementaldom', 'render');
      /**
       * @param {{
       *  products: (!Array<{id: (!goog.soy.data.SanitizedContent|number|string), thumbnail: (!goog.soy.data.SanitizedContent|string), visibility: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  spritemap: (!goog.soy.data.SanitizedContent|string),
       *  limit: number,
       *  _handleRemoveProduct: (*|null|undefined),
       *  _updateProductVisibility: (*|null|undefined),
       *  _submitCompare: (*|null|undefined),
       *  thumbnail: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  visibility: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  id: (!goog.soy.data.SanitizedContent|null|number|string|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 {!Array<{id: (!goog.soy.data.SanitizedContent|number|string), thumbnail: (!goog.soy.data.SanitizedContent|string), visibility: (!goog.soy.data.SanitizedContent|string)}>|null|undefined} */

        var products = soy.asserts.assertType(opt_data.products == null || goog.isArray(opt_data.products), 'products', opt_data.products, '!Array<{id: (!goog.soy.data.SanitizedContent|number|string), thumbnail: (!goog.soy.data.SanitizedContent|string), visibility: (!goog.soy.data.SanitizedContent|string)}>|null|undefined');
        /** @type {!goog.soy.data.SanitizedContent|string} */

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

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

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

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

        var _submitCompare = opt_data._submitCompare;
        var ctaClasses__soy3422 = '';
        ctaClasses__soy3422 += 'minium-frame__cta p-0';
        ctaClasses__soy3422 += products != null && products.length > 0 ? ' is-visible' : '';
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', ctaClasses__soy3422);
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'minium-products-compare');
        incrementalDom.elementOpenEnd();

        if (products != null) {
          var product3447List = products;
          var product3447ListLen = product3447List.length;

          for (var product3447Index = 0; product3447Index < product3447ListLen; product3447Index++) {
            var product3447Data = product3447List[product3447Index];

            if (product3447Index < limit) {
              $templateAlias1({
                events: {
                  removeProduct: _handleRemoveProduct,
                  updateProductVisibility: _updateProductVisibility
                },
                id: product3447Data.id,
                thumbnail: product3447Data.thumbnail,
                visibility: product3447Data.visibility,
                spritemap: spritemap,
                productIndex: product3447Index
              }, null, opt_ijData);
            }
          }

          var missingElements__soy3450 = limit - products.length;

          if (missingElements__soy3450 > 0) {

            for (var i3455 = 0; i3455 < missingElements__soy3450; i3455++) {
              $templateAlias1(opt_data, null, opt_ijData);
            }
          }
        }

        var compareButtonClasses__soy3463 = '';
        compareButtonClasses__soy3463 += 'commerce-button minium-products-compare__button';
        compareButtonClasses__soy3463 += products != null && products.length < 2 ? ' commerce-button--disabled' : '';
        incrementalDom.elementOpenStart('button');
        incrementalDom.attr('class', compareButtonClasses__soy3463);
        incrementalDom.attr('data-onclick', _submitCompare);
        incrementalDom.elementOpenEnd();
        /** @desc Compare */

        var MSG_EXTERNAL_7786647922346156410 = Liferay.Language.get('compare');
        incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_7786647922346156410));
        incrementalDom.elementClose('button');
        incrementalDom.elementClose('div');
        incrementalDom.elementClose('div');
      }

      exports.render = $render;
      /**
       * @typedef {{
       *  products: (!Array<{id: (!goog.soy.data.SanitizedContent|number|string), thumbnail: (!goog.soy.data.SanitizedContent|string), visibility: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  spritemap: (!goog.soy.data.SanitizedContent|string),
       *  limit: number,
       *  _handleRemoveProduct: (*|null|undefined),
       *  _updateProductVisibility: (*|null|undefined),
       *  _submitCompare: (*|null|undefined),
       *  thumbnail: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  visibility: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  id: (!goog.soy.data.SanitizedContent|null|number|string|undefined)
       * }}
       */

      $render.Params;

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

      exports.render.params = ["products", "spritemap", "limit", "_handleRemoveProduct", "_updateProductVisibility", "_submitCompare"];
      exports.render.types = {
        "products": "list<[\n\t\tid: string|number,\n\t\tthumbnail: string,\n\t\tvisibility: string\n\t]>",
        "spritemap": "string",
        "limit": "int",
        "_handleRemoveProduct": "any",
        "_updateProductVisibility": "any",
        "_submitCompare": "any"
      };
      exports.templates = templates = exports;
      return exports;
    });

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

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

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

      return ProductsCompare;
    }(_metalComponent.default);

    exports.ProductsCompare = ProductsCompare;

    _metalSoy.default.register(ProductsCompare, templates);

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

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