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

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

      goog.module('AccountsTable.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('AccountsTableItem.incrementaldom', 'render');
      /**
       * @param {{
       *  accounts: (!Array<{accountId: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  filterString: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  isVisible: (boolean|null|undefined),
       *  viewAllAccountsLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  createNewAccountLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  handleSelectAccount: (?)
       * }} 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 {!Array<{accountId: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string)}>|null|undefined} */

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

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

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

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

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

        var handleSelectAccount = opt_data.handleSelectAccount;
        var msg_17958__soy17959 = '';
        /** @desc Search Accounts... */

        var MSG_EXTERNAL_8320148561525678133 = Liferay.Language.get('search-accounts');
        msg_17958__soy17959 += goog.string.unescapeEntities(MSG_EXTERNAL_8320148561525678133);
        var accountSwitcherClasses__soy215 = '';
        accountSwitcherClasses__soy215 += 'commerce-account-switcher commerce-account-switcher--accounts';
        accountSwitcherClasses__soy215 += isVisible ? ' is-visible' : '';
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', accountSwitcherClasses__soy215);
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'commerce-account-switcher__section');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('form');
        incrementalDom.attr('class', 'commerce-search');
        incrementalDom.attr('data-onsubmit', '_handleSubmitFilter');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'commerce-search__input');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('input');
        incrementalDom.attr('type', 'text');
        incrementalDom.attr('placeholder', msg_17958__soy17959);
        incrementalDom.attr('data-onkeyup', '_handleFilterChange');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementClose('input');
        incrementalDom.elementClose('div');
        incrementalDom.elementClose('form');
        incrementalDom.elementClose('div');
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'commerce-account-switcher__section commerce-account-switcher__section--fill');
        incrementalDom.elementOpenEnd();
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'commerce-account-list');
        incrementalDom.elementOpenEnd();

        if (accounts != null && accounts.length > 0) {
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-account-list__title');
          incrementalDom.elementOpenEnd();
          /** @desc Select Account... */

          var MSG_EXTERNAL_613133395500708962 = Liferay.Language.get('select-account');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_613133395500708962));
          incrementalDom.elementClose('div');
          var account243List = accounts;
          var account243ListLen = account243List.length;

          for (var account243Index = 0; account243Index < account243ListLen; account243Index++) {
            var account243Data = account243List[account243Index];
            $templateAlias1({
              events: {
                selectAccount: handleSelectAccount
              },
              accountId: account243Data.accountId,
              thumbnail: account243Data.thumbnail,
              name: account243Data.name,
              query: filterString
            }, null, opt_ijData);
          }
        }

        if (accounts != null && accounts.length == 0) {
          incrementalDom.elementOpenStart('div');
          incrementalDom.attr('class', 'commerce-account-switcher__empty-table');
          incrementalDom.elementOpenEnd();
          /** @desc No accounts were found. */

          var MSG_EXTERNAL_4711006860440618531 = Liferay.Language.get('no-accounts-were-found');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_4711006860440618531));
          incrementalDom.elementClose('div');
        }

        incrementalDom.elementClose('div');
        incrementalDom.elementClose('div');
        incrementalDom.elementOpenStart('div');
        incrementalDom.attr('class', 'commerce-account-switcher__section');
        incrementalDom.elementOpenEnd();

        if (viewAllAccountsLink != null) {
          incrementalDom.elementOpenStart('a');
          incrementalDom.attr('href', viewAllAccountsLink);
          incrementalDom.attr('class', 'commerce-account-switcher__button commerce-button commerce-button--block commerce-button--link');
          incrementalDom.elementOpenEnd();
          /** @desc View All Accounts */

          var MSG_EXTERNAL_9155646596327870337 = Liferay.Language.get('view-all-accounts');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_9155646596327870337));
          incrementalDom.elementClose('a');
        }

        if (createNewAccountLink != null) {
          incrementalDom.elementOpenStart('a');
          incrementalDom.attr('href', createNewAccountLink);
          incrementalDom.attr('class', 'commerce-account-switcher__button commerce-button commerce-button--block');
          incrementalDom.elementOpenEnd();
          /** @desc Create New Account */

          var MSG_EXTERNAL_644118170061362125 = Liferay.Language.get('create-new-account');
          incrementalDom.text(goog.string.unescapeEntities(MSG_EXTERNAL_644118170061362125));
          incrementalDom.elementClose('a');
        }

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

      exports.render = $render;
      /**
       * @typedef {{
       *  accounts: (!Array<{accountId: (!goog.soy.data.SanitizedContent|number|string), name: (!goog.soy.data.SanitizedContent|string), thumbnail: (!goog.soy.data.SanitizedContent|string)}>|null|undefined),
       *  filterString: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  isVisible: (boolean|null|undefined),
       *  viewAllAccountsLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  createNewAccountLink: (!goog.soy.data.SanitizedContent|null|string|undefined),
       *  handleSelectAccount: (?)
       * }}
       */

      $render.Params;

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

      exports.render.params = ["accounts", "filterString", "isVisible", "viewAllAccountsLink", "createNewAccountLink", "handleSelectAccount"];
      exports.render.types = {
        "accounts": "list<[\n\t\tname: string,\n\t\taccountId: number|string,\n\t\tthumbnail: string\n\t]>",
        "filterString": "string ",
        "isVisible": "bool",
        "viewAllAccountsLink": "string",
        "createNewAccountLink": "string",
        "handleSelectAccount": "?"
      };
      exports.templates = templates = exports;
      return exports;
    });

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

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

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

      return AccountsTable;
    }(_metalComponent.default);

    exports.AccountsTable = AccountsTable;

    _metalSoy.default.register(AccountsTable, templates);

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

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