Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.92/designer/js/definition-builder/diagram-builder/util/populateNotificationsData",["module","exports","require","portal-workflow-kaleo-designer-web$react-flow-renderer","../../util/fetchUtil"],(function(e,i,t){window;Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var a=t("portal-workflow-kaleo-designer-web$react-flow-renderer"),o=t("../../util/fetchUtil");var _default=(e,i)=>{for(let t=0;t<e.length;t++){const r=e[t];if((0,a.isNode)(r)&&r.data.notifications){r.data.notifications.recipients.map(((a,r)=>{var n,s,l,d;if(void 0!==a[0]&&(a=a[0]),"roleId"===(null===(n=a)||void 0===n||null===(s=n.assignmentType)||void 0===s?void 0:s[0]))(0,o.retrieveRolesBy)("roleId",a.roleId).then((e=>e.json())).then((a=>{e[t].data.notifications.recipients[r].sectionsData={id:a.id,name:a.name,roleType:a.roleType},i([...e])}));else if("user"===(null===(l=a)||void 0===l||null===(d=l.assignmentType)||void 0===d?void 0:d[0])&&(a.emailAddress||a.screenName||a.userId)){const n=[];let s=Object.keys(a)[1];const l=Object.values(a)[1];"screenName"===s?s="alternateName":"userId"===s&&(s=s.toLocaleLowerCase().replace("user","")),(0,o.retrieveUsersBy)(s,l).then((e=>e.json())).then((({items:e})=>{e.forEach(((e,i)=>{n.push({emailAddress:e.emailAddress,identifier:"".concat(Date.now(),"-").concat(i),name:e.name,screenName:e.alternateName,userId:e.id})}))})).then((()=>{e[t].data.notifications.recipients[r].sectionsData=n,i([...e])}))}}))}}};i.default=_default}));
//# sourceMappingURL=populateNotificationsData.js.map