Liferay.Loader.define("commerce-product-options-web@3.0.22/CPOptionList.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.CPOptionList = 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 CPOptionList.soy.
      // Please don't edit this file by hand.

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

      goog.module('CPOptionList.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');
      /**
       * @param {{
       *  currentCPOptionId: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  hasEditPermission: (boolean|null|undefined),
       *  id: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  newOptionName: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  options: (?),
       *  pathThemeImages: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  _handleAddOptionClick: (*|null|undefined),
       *  _handleSelectOptionClick: (*|null|undefined),
       *  _handleEditValues: (*|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;
        opt_data = opt_data || {};
        /** @type {!goog.soy.data.SanitizedContent|null|string|undefined} */

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

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

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

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

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

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

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

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

        var _handleEditValues = opt_data._handleEditValues;
        incrementalDom.elementOpenStart('h4');
        incrementalDom.attr('class', 'section-header');
        incrementalDom.elementOpenEnd();
        /** @desc  */

        var MSG_EXTERNAL_4514237160722494630 = Liferay.Language.get('option-templates');
        incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_4514237160722494630));

        if (hasEditPermission) {
          incrementalDom.elementOpenStart('button');
          incrementalDom.attr('class', 'btn btn-primary nav-btn nav-btn-monospaced navbar-breakpoint-down-d-none');
          incrementalDom.attr('onClick', _handleAddOptionClick);
          incrementalDom.attr('type', 'button');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('svg');
          incrementalDom.attr('aria-hidden', 'true');
          incrementalDom.attr('class', 'lexicon-icon lexicon-icon-plus');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('use');
          incrementalDom.attr('xlink:href', pathThemeImages + '/lexicon/icons.svg#plus');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementClose('use');
          incrementalDom.elementClose('svg');
          incrementalDom.elementClose('button');
        }

        incrementalDom.elementClose('h4');
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('id', id);
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('table');
        incrementalDom.attr('class', 'table table-autofit table-heading-nowrap table-hover table-responsive');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpen('thead');
        incrementalDom.elementOpen('tr');
        incrementalDom.elementOpenStart('th');
        incrementalDom.attr('class', 'table-cell-content');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('span');
        incrementalDom.attr('class', 'text-truncate');
        incrementalDom.attr('title', 'Description');
        incrementalDom.elementOpenEnd();
        /** @desc  */

        var MSG_EXTERNAL_8953033926734869941 = Liferay.Language.get('Name');
        incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_8953033926734869941));
        incrementalDom.elementClose('span');
        incrementalDom.elementClose('th');
        incrementalDom.elementOpen('th');
        incrementalDom.elementClose('th');
        incrementalDom.elementClose('tr');
        incrementalDom.elementClose('thead');
        incrementalDom.elementOpen('tbody');

        if (currentCPOptionId == '0') {
          $optionRow({
            id: '0',
            name: newOptionName,
            selected: true,
            showButton: false
          }, null, opt_ijData);
        }

        if (options) {
          var option154List = options;
          var option154ListLen = option154List.length;

          for (var option154Index = 0; option154Index < option154ListLen; option154Index++) {
            var option154Data = option154List[option154Index];
            $optionRow({
              id: option154Data.cpOptionId,
              name: option154Data.name,
              selected: option154Data.cpOptionId == currentCPOptionId,
              showButton: option154Data.hasValues,
              _handleSelectOptionClick: _handleSelectOptionClick,
              _handleEditValues: _handleEditValues
            }, null, opt_ijData);
          }
        }

        incrementalDom.elementClose('tbody');
        incrementalDom.elementClose('table');
        incrementalDom.elementClose('div');
      }

      exports.render = $render;
      /**
       * @typedef {{
       *  currentCPOptionId: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  hasEditPermission: (boolean|null|undefined),
       *  id: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  newOptionName: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  options: (?),
       *  pathThemeImages: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  _handleAddOptionClick: (*|null|undefined),
       *  _handleSelectOptionClick: (*|null|undefined),
       *  _handleEditValues: (*|null|undefined)
       * }}
       */

      $render.Params;

      if (goog.DEBUG) {
        $render.soyTemplateName = 'CPOptionList.render';
      }
      /**
       * @param {{
       *  id: (!goog.soy.data.SanitizedContent|string),
       *  name: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  selected: (boolean|null|undefined),
       *  showButton: (boolean|null|undefined),
       *  _handleSelectOptionClick: (*|null|undefined),
       *  _handleEditValues: (*|null|undefined)
       * }} opt_data
       * @param {Object<string, *>=} opt_ijData
       * @param {Object<string, *>=} opt_ijData_deprecated
       * @return {void}
       * @suppress {checkTypes}
       */

      function $optionRow(opt_data, opt_ijData, opt_ijData_deprecated) {
        opt_ijData = opt_ijData_deprecated || opt_ijData;
        /** @type {!goog.soy.data.SanitizedContent|string} */

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

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

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

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

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

        var _handleEditValues = opt_data._handleEditValues;
        var classes__soy166 = '';
        classes__soy166 += selected ? 'table-active' : '';
        incrementalDom.elementOpenStart('tr');
        incrementalDom.attr('class', classes__soy166);
        incrementalDom.attr('data-id', id);
        incrementalDom.attr('onclick', _handleSelectOptionClick);
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('td');
        incrementalDom.attr('class', 'table-cell-content');
        incrementalDom.elementOpenEnd();

        if (id != 0) {
          soyIdom.print(name);
        } else {
          if (name == '') {
            incrementalDom.text('[');
            /** @desc  */

            var MSG_EXTERNAL_8643728189172449176 = Liferay.Language.get('new-option-template');
            incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_8643728189172449176));
            incrementalDom.text(']');
          } else {
            soyIdom.print(name);
          }
        }

        incrementalDom.elementClose('td');
        incrementalDom.elementOpen('td');

        if (showButton) {
          incrementalDom.elementOpenStart('button');
          incrementalDom.attr('class', 'btn btn-link');
          incrementalDom.attr('onclick', _handleEditValues);
          incrementalDom.attr('type', 'button');
          incrementalDom.elementOpenEnd();
          /** @desc  */

          var MSG_EXTERNAL_7792577166454366826 = Liferay.Language.get('values');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_7792577166454366826));
          incrementalDom.elementClose('button');
        }

        incrementalDom.elementClose('td');
        incrementalDom.elementClose('tr');
      }

      exports.optionRow = $optionRow;
      /**
       * @typedef {{
       *  id: (!goog.soy.data.SanitizedContent|string),
       *  name: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  selected: (boolean|null|undefined),
       *  showButton: (boolean|null|undefined),
       *  _handleSelectOptionClick: (*|null|undefined),
       *  _handleEditValues: (*|null|undefined)
       * }}
       */

      $optionRow.Params;

      if (goog.DEBUG) {
        $optionRow.soyTemplateName = 'CPOptionList.optionRow';
      }

      exports.render.params = ["currentCPOptionId", "hasEditPermission", "id", "newOptionName", "options", "pathThemeImages", "_handleAddOptionClick", "_handleSelectOptionClick", "_handleEditValues"];
      exports.render.types = {
        "currentCPOptionId": "string",
        "hasEditPermission": "bool",
        "id": "string",
        "newOptionName": "string",
        "options": "?",
        "pathThemeImages": "string",
        "_handleAddOptionClick": "any",
        "_handleSelectOptionClick": "any",
        "_handleEditValues": "any"
      };
      exports.optionRow.params = ["id", "name", "selected", "showButton", "_handleSelectOptionClick", "_handleEditValues"];
      exports.optionRow.types = {
        "id": "string",
        "name": "null|string ",
        "selected": "bool",
        "showButton": "bool",
        "_handleSelectOptionClick": "any",
        "_handleEditValues": "any"
      };
      exports.templates = templates = exports;
      return exports;
    });

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

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

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

      return CPOptionList;
    }(_metalComponent.default);

    exports.CPOptionList = CPOptionList;

    _metalSoy.default.register(CPOptionList, templates);

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

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