Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.85/designer/js/definition-builder/diagram-builder/components/sidebar/sections/assignments/Assignments",["module","exports","require","liferay!frontend-js-react-web$react","../../../../DiagramBuilderContext","./select-assignment/AssetCreator","./select-assignment/ResourceActions","./select-assignment/Role","./select-assignment/RoleType","./select-assignment/ScriptedAssignment","./select-assignment/SelectAssignment","./select-assignment/User","./utils"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=p();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var i=r?Object.getOwnPropertyDescriptor(e,s):null;i&&(i.get||i.set)?Object.defineProperty(n,s,i):n[s]=e[s]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),s=n("../../../../DiagramBuilderContext"),i=g(n("./select-assignment/AssetCreator")),a=g(n("./select-assignment/ResourceActions")),o=g(n("./select-assignment/Role")),l=g(n("./select-assignment/RoleType")),c=g(n("./select-assignment/ScriptedAssignment")),u=n("./select-assignment/SelectAssignment"),f=g(n("./select-assignment/User")),d=n("./utils");function g(e){return e&&e.__esModule?e:{default:e}}function p(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return p=function(){return e},e}function m(){return(m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function y(e,t){if(null==e)return{};var n,r,s=function(e,t){if(null==e)return{};var n,r,s={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}const e={assetCreator:i.default,resourceActions:a.default,roleId:o.default,roleType:l.default,scriptedAssignment:c.default,user:f.default};var b=t=>{var n;const{selectedItem:i}=(0,r.useContext)(s.DiagramBuilderContext),a=null==i||null===(n=i.data)||void 0===n?void 0:n.assignments,o=(0,d.getAssignmentType)(a),[l,c]=(0,r.useState)(o||"assetCreator"),[f,g]=(0,r.useState)([{identifier:"".concat(Date.now(),"-0")}]),p=e[l];return(0,r.useEffect)((()=>{if("roleType"===o){const t=[];for(let n=0;n<a.roleType.length;n++){var e;t.push({autoCreate:null==a||null===(e=a.autoCreate)||void 0===e?void 0:e[n],identifier:"".concat(Date.now(),"-").concat(n),roleName:a.roleName[n],roleType:a.roleType[n]})}g(t)}else"user"===o&&g(a.sectionsData)}),[]),r.default.createElement(r.default.Fragment,null,r.default.createElement(u.SelectAssignment,{section:l,setSection:c,setSections:g}),f.map(((e,n)=>{let{identifier:s}=e,i=y(e,["identifier"]);return p&&r.default.createElement(p,m({},t,i,{identifier:s,index:n,key:"section-".concat(s),sectionsLength:null==f?void 0:f.length,setSections:g}))})))};t.default=b}}));
//# sourceMappingURL=Assignments.js.map