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