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

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

      goog.module('AddAccountModal.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),
       *  _handleCreateAccount: (*|null|undefined),
       *  _handleInputName: (*|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 _handleCreateAccount = opt_data._handleCreateAccount;
        /** @type {*|null|undefined} */

        var _handleInputName = opt_data._handleInputName;
        var formattedQuery__soy919 = '';
        formattedQuery__soy919 += query != null ? query : '';

        var body__soy928 = function body__soy928() {
          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 Create a New Account */

          var MSG_EXTERNAL_2557258464349587680 = Liferay.Language.get('create-a-new-account');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_2557258464349587680));
          incrementalDom.elementClose('h3');
          incrementalDom.elementOpenStart('button');
          incrementalDom.attr('class', 'commerce-modal__close');
          incrementalDom.attr('data-onclick', _handleCloseModal);
          incrementalDom.elementOpenEnd();
          $templateAlias1({
            spritemap: spritemap,
            symbol: 'close'
          }, 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();
          /** @desc Account Name */

          var MSG_EXTERNAL_3491872472395679021 = Liferay.Language.get('account-name');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_3491872472395679021));
          incrementalDom.elementClose('label');
          incrementalDom.elementOpenStart('input');
          incrementalDom.attr('class', 'commerce-modal__input');
          incrementalDom.attr('data-onkeyup', _handleInputName);
          incrementalDom.attr('type', 'text');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementClose('input');
          incrementalDom.elementOpenStart('label');
          incrementalDom.attr('class', 'commerce-modal__label');
          incrementalDom.elementOpenEnd();
          /** @desc Administrator's Email */

          var MSG_EXTERNAL_814217251282875894 = Liferay.Language.get('administrators-email');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_814217251282875894));
          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 addedUser966List = addedUsers;
            var addedUser966ListLen = addedUser966List.length;

            for (var addedUser966Index = 0; addedUser966Index < addedUser966ListLen; addedUser966Index++) {
              var addedUser966Data = addedUser966List[addedUser966Index];
              $templateAlias2({
                events: {
                  removeItem: _toggleInvitation
                },
                userId: addedUser966Data.userId,
                email: addedUser966Data.email,
                name: addedUser966Data.name,
                thumbnail: addedUser966Data.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__soy919);
          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 user989List = users;
            var user989ListLen = user989List.length;

            for (var user989Index = 0; user989Index < user989ListLen; user989Index++) {
              var user989Data = user989List[user989Index];
              $templateAlias3({
                events: {
                  toggleInvitation: _toggleInvitation
                },
                userId: user989Data.userId,
                name: user989Data.name,
                email: user989Data.email,
                thumbnail: user989Data.thumbnail,
                addedUsers: addedUsers,
                query: formattedQuery__soy919
              }, null, opt_ijData);
            }
          }

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

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

          var MSG_EXTERNAL_8141016701431358850 = Liferay.Language.get('create-account');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_8141016701431358850));
          incrementalDom.elementClose('button');
          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
        };

        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'commerce-modal-wrapper');
        incrementalDom.elementOpenEnd();
        $templateAlias4({
          body: body__soy928,
          elementClasses: 'modal-hidden',
          visible: _modalVisible,
          events: {
            hide: _handleCloseModal
          }
        }, 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),
       *  _handleCreateAccount: (*|null|undefined),
       *  _handleInputName: (*|null|undefined)
       * }}
       */

      $render.Params;

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

      exports.render.params = ["users", "addedUsers", "query", "spritemap", "accountName", "_modalVisible", "_toggleInvitation", "_handleInputBox", "_handleFormSubmit", "_handleCloseModal", "_handleCreateAccount", "_handleInputName"];
      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 ",
        "_handleCreateAccount": "any ",
        "_handleInputName": "any "
      };
      exports.templates = templates = exports;
      return exports;
    });

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

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

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

      return AddAccountModal;
    }(_metalComponent.default);

    exports.AddAccountModal = AddAccountModal;

    _metalSoy.default.register(AddAccountModal, templates);

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

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