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

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

      goog.module('CompareCheckbox.incrementaldom');

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

      goog.require('goog.string');

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

      goog.require('soy.asserts');

      goog.require('soy.idom');

      /**
       * @param {{
       *  productId: (!goog.soy.data.SanitizedContent|number|string),
       *  checkboxVisible: (boolean|null|undefined),
       *  compareAvailable: (boolean|null|undefined),
       *  inCompare: (boolean|null|undefined),
       *  labelVisible: (boolean|null|undefined),
       *  _handleCompareCheckbox: (*|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 {!goog.soy.data.SanitizedContent|number|string} */

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

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

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

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

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

        var _handleCompareCheckbox = opt_data._handleCompareCheckbox;
        var checkboxId__soy2372 = '';
        checkboxId__soy2372 += 'product-';
        checkboxId__soy2372 += productId;
        checkboxId__soy2372 += '-compare-checkbox';
        var disabled__soy2377 = compareAvailable != null && compareAvailable == false ? true : false;

        var compareAttributes__soy2379 = function compareAttributes__soy2379() {
          incrementalDom.attr('id', checkboxId__soy2372);
          incrementalDom.attr('class', 'product-compare-checkbox__input');
          incrementalDom.attr('type', 'checkbox');

          if (inCompare != null && inCompare == true) {
            incrementalDom.attr('checked', '');
          } else {
            if (disabled__soy2377) {
              incrementalDom.attr('disabled', '');
            }
          }
        };

        var containerClasses__soy2394 = '';
        containerClasses__soy2394 += 'product-compare-checkbox';
        containerClasses__soy2394 += inCompare != null && inCompare == true ? ' product-compare-checkbox__checked' : disabled__soy2377 ? ' product-compare-checkbox__disabled' : '';
        incrementalDom.elementOpenStart('label');
        incrementalDom.attr('class', containerClasses__soy2394);
        incrementalDom.elementOpenEnd();

        if (checkboxVisible != null && checkboxVisible == true) {
          incrementalDom.elementOpenStart('input');
          compareAttributes__soy2379();
          incrementalDom.attr('data-onchange', _handleCompareCheckbox);
          incrementalDom.elementOpenEnd();
          incrementalDom.elementClose('input');

          if (labelVisible != null && labelVisible == true) {
            incrementalDom.elementOpenStart('span');
            incrementalDom.attr('class', 'product-compare-checkbox__label');
            incrementalDom.elementOpenEnd();
            /** @desc Compare */

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

        incrementalDom.elementClose('label');
      }

      exports.render = $render;
      /**
       * @typedef {{
       *  productId: (!goog.soy.data.SanitizedContent|number|string),
       *  checkboxVisible: (boolean|null|undefined),
       *  compareAvailable: (boolean|null|undefined),
       *  inCompare: (boolean|null|undefined),
       *  labelVisible: (boolean|null|undefined),
       *  _handleCompareCheckbox: (*|null|undefined)
       * }}
       */

      $render.Params;

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

      exports.render.params = ["productId", "checkboxVisible", "compareAvailable", "inCompare", "labelVisible", "_handleCompareCheckbox"];
      exports.render.types = {
        "productId": "number|string ",
        "checkboxVisible": "bool ",
        "compareAvailable": "bool ",
        "inCompare": "bool ",
        "labelVisible": "bool ",
        "_handleCompareCheckbox": "any "
      };
      exports.templates = templates = exports;
      return exports;
    });

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

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

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

      return CompareCheckbox;
    }(_metalComponent.default);

    exports.CompareCheckbox = CompareCheckbox;

    _metalSoy.default.register(CompareCheckbox, templates);

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

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