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

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

      goog.module('UserRolesModal.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('ClayIcon.incrementaldom', 'render');

      var $templateAlias4 = _metalSoy.default.getTemplate('ClayModal.incrementaldom', 'render');

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

      var $templateAlias3 = _metalSoy.default.getTemplate('RoleListItem.incrementaldom', 'render');
      /**
       * @param {{
       *  roles: (!Array<{id: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  selectedRoles: (!Array<{id: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  filteredRoles: (!Array<{id: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  query: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  spritemap: (!goog.soy.data.SanitizedContent|string),
       *  _modalVisible: (boolean|null|undefined),
       *  _toggleItem: (*|null|undefined),
       *  _handleInputBox: (*|null|undefined),
       *  _handleFormSubmit: (*|null|undefined),
       *  _handleCloseModal: (*|null|undefined),
       *  _updateRoles: (*|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 {!Array<{id: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string)}>|null|undefined} */

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

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

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

        var query = soy.asserts.assertType(opt_data.query == null || goog.isString(opt_data.query) || opt_data.query instanceof goog.soy.data.SanitizedContent, 'query', opt_data.query, '!goog.soy.data.SanitizedContent|null|string|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 {boolean|null|undefined} */

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

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

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

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

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

        var _updateRoles = opt_data._updateRoles;
        var formattedQuery__soy4575 = '';
        formattedQuery__soy4575 += query != null ? query : '';

        var body__soy4584 = function body__soy4584() {
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-modal');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-modal__header');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('h3');
          incrementalDom.attr('class', 'commerce-modal__title');
          incrementalDom.elementOpenEnd();
          /** @desc Choose User Roles */

          var MSG_EXTERNAL_7477813564515366798 = Liferay.Language.get('choose-user-roles');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_7477813564515366798));
          incrementalDom.elementClose('h3');
          incrementalDom.elementOpenStart('button');
          incrementalDom.attr('class', 'commerce-modal__close');
          incrementalDom.attr('data-onclick', _handleCloseModal);
          incrementalDom.elementOpenEnd();
          $templateAlias1({
            spritemap: spritemap,
            symbol: 'times'
          }, null, opt_ijData);
          incrementalDom.elementClose('button');
          incrementalDom.elementClose('div');
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-modal__content');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('label');
          incrementalDom.attr('class', 'commerce-modal__label');
          incrementalDom.attr('for', 'user-roles-input-text');
          incrementalDom.elementOpenEnd();
          /** @desc Available Roles */

          var MSG_EXTERNAL_1695414272474515989 = Liferay.Language.get('available-roles');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_1695414272474515989));
          incrementalDom.elementClose('label');
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'user-invitation');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'autocomplete-input user-invitation__input');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'autocomplete-input__icon');
          incrementalDom.elementOpenEnd();
          $templateAlias1({
            spritemap: spritemap,
            symbol: 'search'
          }, null, opt_ijData);
          incrementalDom.elementClose('div');
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'autocomplete-input__wrapper');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'autocomplete-input__content');
          incrementalDom.elementOpenEnd();

          if (selectedRoles != null && selectedRoles.length > 0) {
            var role4614List = selectedRoles;
            var role4614ListLen = role4614List.length;

            for (var role4614Index = 0; role4614Index < role4614ListLen; role4614Index++) {
              var role4614Data = role4614List[role4614Index];
              $templateAlias2({
                events: {
                  removeItem: _toggleItem
                },
                id: role4614Data.id,
                name: role4614Data.name,
                spritemap: spritemap
              }, null, opt_ijData);
            }
          }

          incrementalDom.elementOpenStart('form');
          incrementalDom.attr('data-onsubmit', _handleFormSubmit);
          incrementalDom.attr('ref', 'form');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('input');
          incrementalDom.attr('class', 'autocomplete-input__box');
          incrementalDom.attr('type', 'text');
          incrementalDom.attr('id', 'user-roles-input-text');
          incrementalDom.attr('value', formattedQuery__soy4575);
          incrementalDom.attr('data-onkeyup', _handleInputBox);
          incrementalDom.elementOpenEnd();
          incrementalDom.elementClose('input');
          incrementalDom.elementClose('form');
          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'user-invitation__list');
          incrementalDom.elementOpenEnd();

          if (filteredRoles != null && filteredRoles.length > 0) {
            var role4635List = filteredRoles;
            var role4635ListLen = role4635List.length;

            for (var role4635Index = 0; role4635Index < role4635ListLen; role4635Index++) {
              var role4635Data = role4635List[role4635Index];
              $templateAlias3({
                events: {
                  toggleItem: _toggleItem
                },
                id: role4635Data.id,
                name: role4635Data.name,
                query: formattedQuery__soy4575,
                selectedRoles: selectedRoles
              }, null, opt_ijData);
            }
          } else {
            if (query != null && query != '') {
              incrementalDom.elementOpenStart('div');
              incrementalDom.attr('class', 'no-element-found');
              incrementalDom.elementOpenEnd();
              /** @desc No elements were found. */

              var MSG_EXTERNAL_6179307885031020077 = Liferay.Language.get('no-elements-were-found');
              incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_6179307885031020077));
              incrementalDom.elementClose('div');
            } else {
              if (roles != null && roles.length > 0) {
                var role4660List = roles;
                var role4660ListLen = role4660List.length;

                for (var role4660Index = 0; role4660Index < role4660ListLen; role4660Index++) {
                  var role4660Data = role4660List[role4660Index];
                  $templateAlias3({
                    events: {
                      toggleItem: _toggleItem
                    },
                    id: role4660Data.id,
                    name: role4660Data.name,
                    query: formattedQuery__soy4575,
                    selectedRoles: selectedRoles
                  }, null, opt_ijData);
                }
              }
            }
          }

          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-modal__actions');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('button');
          incrementalDom.attr('class', 'commerce-button commerce-button--big commerce-button--outline');
          incrementalDom.attr('data-onclick', _handleCloseModal);
          incrementalDom.elementOpenEnd();
          /** @desc Cancel */

          var MSG_EXTERNAL_503445309622982213 = Liferay.Language.get('cancel');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_503445309622982213));
          incrementalDom.elementClose('button');
          incrementalDom.elementOpenStart('button');
          incrementalDom.attr('class', 'commerce-button commerce-button--big');
          incrementalDom.attr('data-onclick', _updateRoles);
          incrementalDom.elementOpenEnd();
          /** @desc Done */

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

        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'commerce-modal-wrapper');
        incrementalDom.elementOpenEnd();
        $templateAlias4({
          body: body__soy4584,
          elementClasses: 'modal-hidden',
          visible: _modalVisible,
          events: {
            hide: _handleCloseModal
          }
        }, null, opt_ijData);
        incrementalDom.elementClose('div');
      }

      exports.render = $render;
      /**
       * @typedef {{
       *  roles: (!Array<{id: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  selectedRoles: (!Array<{id: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  filteredRoles: (!Array<{id: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  query: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  spritemap: (!goog.soy.data.SanitizedContent|string),
       *  _modalVisible: (boolean|null|undefined),
       *  _toggleItem: (*|null|undefined),
       *  _handleInputBox: (*|null|undefined),
       *  _handleFormSubmit: (*|null|undefined),
       *  _handleCloseModal: (*|null|undefined),
       *  _updateRoles: (*|null|undefined)
       * }}
       */

      $render.Params;

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

      exports.render.params = ["roles", "selectedRoles", "filteredRoles", "query", "spritemap", "_modalVisible", "_toggleItem", "_handleInputBox", "_handleFormSubmit", "_handleCloseModal", "_updateRoles"];
      exports.render.types = {
        "roles": "list<[\n\t\tid: string|int,\n\t\tname: string\n\t]>",
        "selectedRoles": "list<[\n\t\tid: string|int,\n\t\tname: string\n\t]>",
        "filteredRoles": "list<[\n\t\tid: string|int,\n\t\tname: string\n\t]>",
        "query": "string ",
        "spritemap": "string ",
        "_modalVisible": "bool ",
        "_toggleItem": "any ",
        "_handleInputBox": "any ",
        "_handleFormSubmit": "any ",
        "_handleCloseModal": "any ",
        "_updateRoles": "any "
      };
      exports.templates = templates = exports;
      return exports;
    });

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

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

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

      return UserRolesModal;
    }(_metalComponent.default);

    exports.UserRolesModal = UserRolesModal;

    _metalSoy.default.register(UserRolesModal, templates);

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

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