Liferay.Loader.define("account-admin-web@2.0.98/account_entries_admin/js/InviteUsersFormGroup",["module","exports","require","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/layout","@frontend-taglib-clay$clayui/multi-select","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/layout")),o=_interopRequireDefault(a("@frontend-taglib-clay$clayui/multi-select")),u=_interopRequireWildcard(a("liferay!frontend-js-react-web$react"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}return a.default=e,t&&t.set(e,a),a}const MultiSelect=({autoFocus:e=!1,errorMessages:t,helpText:a,inputName:n,items:i,label:c,onBlurFn:s=(()=>{}),onItemsChangeFn:d,placeholder:f,required:m=!1,sourceItems:g=[]})=>u.default.createElement(r.default.Group,{className:t.length?"has-error":""},u.default.createElement("label",{htmlFor:n},c,m&&u.default.createElement(l.default,{className:"ml-1 reference-mark",symbol:"asterisk"})),u.default.createElement(r.ClayInput.Group,null,u.default.createElement(r.ClayInput.GroupItem,null,u.default.createElement(o.default,{autoFocus:e,id:"".concat(n,"MultiSelect"),inputName:n,items:i,loadingState:4,onBlur:s,onItemsChange:d,placeholder:f,sourceItems:g}),u.default.createElement(r.default.FeedbackGroup,null,Boolean(a)&&u.default.createElement(r.default.Text,null,a),t.map((e=>u.default.createElement(r.default.FeedbackItem,{key:e},e)))))));function getErrorMessages(e){return e.map((e=>e.errorMessage)).filter(Boolean)}var _default=({accountRoles:e,availableAccountRoles:t,emailAddresses:a,index:r,onAccountRoleItemsChange:l,onEmailAddressItemsChange:o,portletNamespace:i})=>{const[c,s]=(0,u.useState)(!1),d=[];c&&!a.length&&d.push(Liferay.Language.get("this-field-is-required"));for(const e of getErrorMessages(a))d.push(e);return u.default.createElement(n.default.Sheet,{size:"lg"},u.default.createElement(MultiSelect,{autoFocus:!0,errorMessages:d,inputName:"".concat(i,"emailAddresses").concat(r),items:a,label:Liferay.Language.get("email-addresses"),onBlurFn:()=>s(!0),onItemsChangeFn:o,placeholder:Liferay.Language.get("type-a-comma-or-press-enter-to-input-email-addresses"),required:!0}),u.default.createElement(MultiSelect,{errorMessages:getErrorMessages(e),helpText:Liferay.Language.get("roles-will-be-applied-to-all-of-the-users-above"),inputName:"".concat(i,"accountRoleIds").concat(r),items:e,label:Liferay.Language.get("roles"),onItemsChangeFn:l,placeholder:Liferay.Language.get("type-a-comma-or-press-enter-to-input-roles"),sourceItems:t}))};t.default=_default}}));
//# sourceMappingURL=InviteUsersFormGroup.js.map