Liferay.Loader.define("@liferay/object-web@1.0.108/js/components/StateManager/StateDefinition",["module","exports","require","@liferay/object-js-components-web","liferay!frontend-js-react-web$react","./StateDefinition.scss"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({currentKey:e,disabled:t,index:n,initialValues:i,setValues:o,stateName:l,values:s}){const[f,u]=(0,a.useState)(i.map((({checked:e,key:t,name:n})=>({checked:e,label:n,value:t}))));return(0,a.useEffect)((()=>{var t,n;const r=null===(t=s.objectFieldSettings)||void 0===t?void 0:t.find((({name:e})=>"stateFlow"===e)),a=null===(n=s.objectFieldSettings)||void 0===n?void 0:n.indexOf(r),i=r.value,l=i.objectStates,u=l.find((t=>t.key===e)),d=l.indexOf(u),b=f.filter((e=>e.checked)).map((({value:e})=>({key:e}))),p=[...l];p[d]=c(c({},u),{},{objectStateTransitions:b}),i.objectStates=p;const j=s.objectFieldSettings;j[a].value=i,o({objectFieldSettings:j})}),[f]),a.default.createElement("div",{className:"lfr-objects__state-definition-card-state"},a.default.createElement("div",{className:"lfr-objects__state-definition-card-state-name"},0===n&&a.default.createElement("label",null,Liferay.Language.get("state-name")),a.default.createElement(r.Card,{title:l,viewMode:"no-children"})),a.default.createElement("div",{className:"lfr-objects__state-definition-card-state-next-status"},0===n&&a.default.createElement("label",null,Liferay.Language.get("next-status")),a.default.createElement(r.MultipleSelect,{disabled:t,options:f,selectAllOption:!0,setOptions:u})))};var r=n("@liferay/object-js-components-web"),a=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=r?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react"));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n("./StateDefinition.scss")}}));
//# sourceMappingURL=StateDefinition.js.map