Liferay.Loader.define("account-admin-web@2.0.69/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")),u=_interopRequireDefault(a("@frontend-taglib-clay$clayui/multi-select")),o=_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,required:f=!1,sourceItems:m=[]})=>o.default.createElement(r.default.Group,{className:t.length?"has-error":""},o.default.createElement("label",{htmlFor:n},c,f&&o.default.createElement(l.default,{className:"ml-1 reference-mark",symbol:"asterisk"})),o.default.createElement(r.ClayInput.Group,null,o.default.createElement(r.ClayInput.GroupItem,null,o.default.createElement(u.default,{autoFocus:e,id:"".concat(n,"MultiSelect"),inputName:n,items:i,onBlur:s,onItemsChange:d,sourceItems:m}),o.default.createElement(r.default.FeedbackGroup,null,Boolean(a)&&o.default.createElement(r.default.Text,null,a),t.map((e=>o.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:u,portletNamespace:i})=>{const[c,s]=(0,o.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 o.default.createElement(n.default.Sheet,{size:"lg"},o.default.createElement(MultiSelect,{autoFocus:!0,errorMessages:d,inputName:"".concat(i,"emailAddresses").concat(r),items:a,label:Liferay.Language.get("emails"),onBlurFn:()=>s(!0),onItemsChangeFn:u,required:!0}),o.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,sourceItems:t}))};t.default=_default}}));
//# sourceMappingURL=InviteUsersFormGroup.js.map