Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.150/admin/js/components/share-form/Email.es",["module","exports","require","@frontend-taglib-clay$clayui/data-provider","@frontend-taglib-clay$clayui/form","@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 l=a("@frontend-taglib-clay$clayui/data-provider"),r=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(a("@frontend-taglib-clay$clayui/multi-select")),u=_interopRequireWildcard(a("liferay!frontend-js-react-web$react"));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={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=l?Object.getOwnPropertyDescriptor(e,r):null;n&&(n.get||n.set)?Object.defineProperty(a,r,n):a[r]=e[r]}return a.default=e,t&&t.set(e,a),a}function formatAutocompleteValue(e){return"".concat(e.fullName," (").concat(e.emailAddress,")")}function isEmailAddressValid(e){return/.+@.+\..+/i.test(e.label)}var _default=({addresses:e,autocompleteUserURL:t,emailContent:a,message:o,onMessageChanged:c,onMultiSelectItemsChanged:d,onSubjectChanged:i,subject:s})=>{const[f,m]=(0,u.useState)(""),[g,p]=(0,u.useState)(4),{resource:y}=(0,l.useResource)({fetchPolicy:"cache-first",link:t,onNetworkStatusChange:p});return u.default.createElement("div",{className:"share-form-modal-item-email"},u.default.createElement(r.default.Group,null,u.default.createElement("label",null,Liferay.Language.get("to")),u.default.createElement(r.ClayInput.Group,{small:!0,stacked:!0},u.default.createElement(r.ClayInput.GroupItem,null,!(5===g)&&u.default.createElement(u.default.Fragment,null,u.default.createElement(n.default,{clearAllTitle:Liferay.Language.get("clear-all"),closeButtonAriaLabel:Liferay.Language.get("remove"),items:e,loadingState:g,onChange:m,onClearAllButtonClick:()=>{a.current.addresses=[],d([])},onItemsChange:e=>{if(!e.length)return a.current.addresses=e,d(e);const t=e.filter(isEmailAddressValid);return t.length?(a.current.addresses=t,d(t)):void 0},placeholder:Liferay.Language.get("enter-a-list-of-email-addresses"),sourceItems:y?y.map((e=>({label:e.emailAddress,value:formatAutocompleteValue(e)}))):[],value:f}),u.default.createElement(r.default.FeedbackGroup,null,u.default.createElement(r.default.Text,null,Liferay.Language.get("type-a-comma-or-press-enter-to-input-email-addresses"))))))),u.default.createElement(r.default.Group,null,u.default.createElement("label",{htmlFor:"subject"},Liferay.Language.get("subject")),u.default.createElement(r.ClayInput.Group,null,u.default.createElement(r.ClayInput.GroupItem,null,u.default.createElement(r.ClayInput,{className:"form-control",id:"subject",onChange:({target:{value:e}})=>{a.current.subject=e,i(e)},type:"text",value:s})))),u.default.createElement(r.default.Group,null,u.default.createElement("label",{htmlFor:"message"},Liferay.Language.get("message")),u.default.createElement(r.ClayInput.Group,null,u.default.createElement(r.ClayInput.GroupItem,null,u.default.createElement(r.ClayInput,{className:"form-control",component:"textarea",id:"message",onChange:({target:{value:e}})=>{a.current.message=e,c(e)},type:"text",value:o})))))};t.default=_default}}));
//# sourceMappingURL=Email.es.js.map