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

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

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

      var $templateAlias3 = _metalSoy.default.getTemplate('UserListItem.incrementaldom', 'render');
      /**
       * @param {{
       *  users: (!Array<{email: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string), userId: (!goog.soy.data.SanitizedContent|number|string)}>|null|undefined),
       *  addedUsers: (!Array<{email: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string), userId: (!goog.soy.data.SanitizedContent|number|string)}>|null|undefined),
       *  query: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  spritemap: (!goog.soy.data.SanitizedContent|string),
       *  accountName: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  _modalVisible: (boolean|null|undefined),
       *  _toggleInvitation: (*|null|undefined),
       *  _handleInputBox: (*|null|undefined),
       *  _handleFormSubmit: (*|null|undefined),
       *  _handleCloseModal: (*|null|undefined),
       *  _sendInvitations: (*|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<{email: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string), userId: (!goog.soy.data.SanitizedContent|number|string)}>|null|undefined} */

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

        var addedUsers = soy.asserts.assertType(opt_data.addedUsers == null || goog.isArray(opt_data.addedUsers), 'addedUsers', opt_data.addedUsers, '!Array<{email: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string), userId: (!goog.soy.data.SanitizedContent|number|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 {!goog.soy.data.SanitizedContent|null|string|undefined} */

        var accountName = soy.asserts.assertType(opt_data.accountName == null || goog.isString(opt_data.accountName) || opt_data.accountName instanceof goog.soy.data.SanitizedContent, 'accountName', opt_data.accountName, '!goog.soy.data.SanitizedContent|null|string|undefined');
        /** @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 _toggleInvitation = opt_data._toggleInvitation;
        /** @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 _sendInvitations = opt_data._sendInvitations;
        var formattedQuery__soy4623 = '';
        formattedQuery__soy4623 += query != null ? query : '';

        var body__soy4632 = function body__soy4632() {
          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();
          incrementalDom.text('Invite user to this account');
          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.elementOpenEnd();
          incrementalDom.text('Name or Email');
          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 (addedUsers != null) {
            var addedUser4656List = addedUsers;
            var addedUser4656ListLen = addedUser4656List.length;

            for (var addedUser4656Index = 0; addedUser4656Index < addedUser4656ListLen; addedUser4656Index++) {
              var addedUser4656Data = addedUser4656List[addedUser4656Index];
              $templateAlias2({
                events: {
                  removeItem: _toggleInvitation
                },
                userId: addedUser4656Data.userId,
                email: addedUser4656Data.email,
                name: addedUser4656Data.name,
                thumbnail: addedUser4656Data.thumbnail,
                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('value', formattedQuery__soy4623);
          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 (users != null && users.length > 0) {
            var user4679List = users;
            var user4679ListLen = user4679List.length;

            for (var user4679Index = 0; user4679Index < user4679ListLen; user4679Index++) {
              var user4679Data = user4679List[user4679Index];
              $templateAlias3({
                events: {
                  toggleInvitation: _toggleInvitation
                },
                userId: user4679Data.userId,
                name: user4679Data.name,
                email: user4679Data.email,
                thumbnail: user4679Data.thumbnail,
                addedUsers: addedUsers,
                query: formattedQuery__soy4623
              }, null, opt_ijData);
            }
          }

          if (users != null && users.length == 0 && formattedQuery__soy4623 != '') {
            $templateAlias3({
              events: {
                toggleInvitation: _toggleInvitation
              },
              email: formattedQuery__soy4623,
              addedUsers: addedUsers
            }, null, opt_ijData);
          }

          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
          var inviteButtonClasses__soy4692 = '';
          inviteButtonClasses__soy4692 += 'commerce-button commerce-button--big';
          inviteButtonClasses__soy4692 += addedUsers != null && addedUsers.length == 0 && accountName != null && accountName == '' ? ' commerce-button--disabled' : '';
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-modal__actions');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('button');
          incrementalDom.attr('class', inviteButtonClasses__soy4692);
          incrementalDom.attr('data-onclick', _sendInvitations);
          incrementalDom.elementOpenEnd();
          /** @desc  */

          var MSG_EXTERNAL_2987895114762364928 = Liferay.Language.get('invite-user');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_2987895114762364928));
          incrementalDom.elementClose('button');
          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
        };

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

      exports.render = $render;
      /**
       * @typedef {{
       *  users: (!Array<{email: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string), userId: (!goog.soy.data.SanitizedContent|number|string)}>|null|undefined),
       *  addedUsers: (!Array<{email: (!goog.soy.data.SanitizedContent|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string), userId: (!goog.soy.data.SanitizedContent|number|string)}>|null|undefined),
       *  query: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  spritemap: (!goog.soy.data.SanitizedContent|string),
       *  accountName: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  _modalVisible: (boolean|null|undefined),
       *  _toggleInvitation: (*|null|undefined),
       *  _handleInputBox: (*|null|undefined),
       *  _handleFormSubmit: (*|null|undefined),
       *  _handleCloseModal: (*|null|undefined),
       *  _sendInvitations: (*|null|undefined)
       * }}
       */

      $render.Params;

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

      exports.render.params = ["users", "addedUsers", "query", "spritemap", "accountName", "_modalVisible", "_toggleInvitation", "_handleInputBox", "_handleFormSubmit", "_handleCloseModal", "_sendInvitations"];
      exports.render.types = {
        "users": "list<[\n\t\tuserId: string | number,\n\t\tthumbnail: string,\n\t\tname: string,\n\t\temail: string\n\t]>",
        "addedUsers": "list<[\n\t\tuserId: string | number,\n\t\tthumbnail: string,\n\t\tname: string,\n\t\temail: string\n\t]>",
        "query": "string ",
        "spritemap": "string ",
        "accountName": "string ",
        "_modalVisible": "bool ",
        "_toggleInvitation": "any ",
        "_handleInputBox": "any ",
        "_handleFormSubmit": "any ",
        "_handleCloseModal": "any ",
        "_sendInvitations": "any "
      };
      exports.templates = templates = exports;
      return exports;
    });

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

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

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

      return UserInvitationModal;
    }(_metalComponent.default);

    exports.UserInvitationModal = UserInvitationModal;

    _metalSoy.default.register(UserInvitationModal, templates);

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

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