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

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

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

      var $templateAlias3 = _metalSoy.default.getTemplate('OrganizationListItem.incrementaldom', 'render');
      /**
       * @param {{
       *  organizations: (!Array<{colorId: number, id: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  selectedOrganizations: (!Array<{colorId: number, 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),
       *  _addOrganizations: (*|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<{colorId: number, id: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string)}>|null|undefined} */

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

        var selectedOrganizations = soy.asserts.assertType(opt_data.selectedOrganizations == null || goog.isArray(opt_data.selectedOrganizations), 'selectedOrganizations', opt_data.selectedOrganizations, '!Array<{colorId: number, 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 _addOrganizations = opt_data._addOrganizations;
        var formattedQuery__soy1071 = '';
        formattedQuery__soy1071 += query != null ? query : '';

        var body__soy1080 = function body__soy1080() {
          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 Add Organization to This Account */

          var MSG_EXTERNAL_6230273538176460931 = Liferay.Language.get('add-organization-to-this-account');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_6230273538176460931));
          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();
          /** @desc Organization Name */

          var MSG_EXTERNAL_1872589570511754595 = Liferay.Language.get('organization-name');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_1872589570511754595));
          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 (selectedOrganizations != null) {
            var addedOrganization1110List = selectedOrganizations;
            var addedOrganization1110ListLen = addedOrganization1110List.length;

            for (var addedOrganization1110Index = 0; addedOrganization1110Index < addedOrganization1110ListLen; addedOrganization1110Index++) {
              var addedOrganization1110Data = addedOrganization1110List[addedOrganization1110Index];
              $templateAlias2({
                events: {
                  removeItem: _toggleItem
                },
                id: addedOrganization1110Data.id,
                name: addedOrganization1110Data.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('value', formattedQuery__soy1071);
          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 (organizations != null && organizations.length > 0) {
            var organization1132List = organizations;
            var organization1132ListLen = organization1132List.length;

            for (var organization1132Index = 0; organization1132Index < organization1132ListLen; organization1132Index++) {
              var organization1132Data = organization1132List[organization1132Index];
              $templateAlias3({
                events: {
                  toggleItem: _toggleItem
                },
                id: organization1132Data.id,
                name: organization1132Data.name,
                colorId: organization1132Data.colorId,
                selectedOrganizations: selectedOrganizations,
                query: formattedQuery__soy1071
              }, null, opt_ijData);
            }
          }

          if (organizations != null && organizations.length == 0) {
            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');
          }

          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
          var inviteButtonClasses__soy1144 = '';
          inviteButtonClasses__soy1144 += 'commerce-button commerce-button--big';
          inviteButtonClasses__soy1144 += selectedOrganizations != null && selectedOrganizations.length == 0 ? ' commerce-button--disabled' : '';
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-modal__actions');
          incrementalDom.elementOpenEnd();
          incrementalDom.elementOpenStart('button');
          incrementalDom.attr('class', inviteButtonClasses__soy1144);
          incrementalDom.attr('data-onclick', _addOrganizations);
          incrementalDom.elementOpenEnd();
          /** @desc Add Organization */

          var MSG_EXTERNAL_1812798508316997577 = Liferay.Language.get('add-organization');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_1812798508316997577));
          incrementalDom.elementClose('button');
          incrementalDom.elementClose('div');
          incrementalDom.elementClose('div');
        };

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

      exports.render = $render;
      /**
       * @typedef {{
       *  organizations: (!Array<{colorId: number, id: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  selectedOrganizations: (!Array<{colorId: number, 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),
       *  _addOrganizations: (*|null|undefined)
       * }}
       */

      $render.Params;

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

      exports.render.params = ["organizations", "selectedOrganizations", "query", "spritemap", "_modalVisible", "_toggleItem", "_handleInputBox", "_handleFormSubmit", "_handleCloseModal", "_addOrganizations"];
      exports.render.types = {
        "organizations": "list<[\n\t\tid: string | number,\n\t\tname: string,\n\t\tcolorId: number\n\t]>",
        "selectedOrganizations": "list<[\n\t\tid: string | number,\n\t\tname: string,\n\t\tcolorId: number\n\t]>",
        "query": "string ",
        "spritemap": "string ",
        "_modalVisible": "bool ",
        "_toggleItem": "any ",
        "_handleInputBox": "any ",
        "_handleFormSubmit": "any ",
        "_handleCloseModal": "any ",
        "_addOrganizations": "any "
      };
      exports.templates = templates = exports;
      return exports;
    });

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

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

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

      return AddOrganizationsModal;
    }(_metalComponent.default);

    exports.AddOrganizationsModal = AddOrganizationsModal;

    _metalSoy.default.register(AddOrganizationsModal, templates);

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

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