Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.115/designer/js/definition-builder/diagram-builder/components/sidebar/sections/assignments/select-assignment/ScriptedAssignment",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/layout","@frontend-taglib-clay$clayui/link","liferay!frontend-js-react-web$react","../../../../../DiagramBuilderContext","../../../SidebarPanel"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/button")),n=a("@frontend-taglib-clay$clayui/form"),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/layout")),i=_interopRequireDefault(a("@frontend-taglib-clay$clayui/link")),o=_interopRequireWildcard(a("liferay!frontend-js-react-web$react")),u=a("../../../../../DiagramBuilderContext"),c=_interopRequireDefault(a("../../../SidebarPanel"));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 _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={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(a,n,l):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}function ownKeys(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(a),!0).forEach((function(t){_defineProperty(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function _defineProperty(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const e=[{label:Liferay.Language.get("groovy"),value:"groovy"},{label:Liferay.Language.get("java"),value:"java"}];var _default=({setContentName:t})=>{var a,d;const{selectedItem:s,setSelectedItem:f}=(0,o.useContext)(u.DiagramBuilderContext),[p,g]=(0,o.useState)(null==s||null===(a=s.data.assignments)||void 0===a?void 0:a.script),[y,b]=(0,o.useState)(null==s||null===(d=s.data.assignments)||void 0===d?void 0:d.scriptLanguage),m=Liferay.Language.get("add-source-code"),goToEditor=()=>t("scripted-assignment");return(0,o.useEffect)((()=>{var e;g(null==s||null===(e=s.data.assignments)||void 0===e?void 0:e.script)}),[s]),o.default.createElement(c.default,{panelTitle:Liferay.Language.get("script")},o.default.createElement("label",{htmlFor:"script-language"},Liferay.Language.get("script-language")),o.default.createElement(n.ClaySelect,{"aria-label":"Select",defaultValue:y,id:"script-language",onChange:({target:e})=>{b(e.value),f((t=>_objectSpread(_objectSpread({},t),{},{data:_objectSpread(_objectSpread({},t.data),{},{assignments:_objectSpread(_objectSpread({},t.data.assignments),{},{scriptLanguage:[e.value]})})})))}},e&&e.map((e=>o.default.createElement(n.ClaySelect.Option,{key:e.value,label:e.label,value:e.value})))),p?o.default.createElement(l.default.ContentCol,{className:"current-node-data-area",float:!0},o.default.createElement(l.default.Row,{className:"current-node-data-row",justify:"between"},o.default.createElement(i.default,{button:!1,className:"truncate-container",displayType:"secondary",href:"#",onClick:goToEditor},o.default.createElement("span",null,Liferay.Language.get("script"))),o.default.createElement(r.ClayButtonWithIcon,{className:"delete-button text-secondary trash-button",displayType:"unstyled",onClick:()=>{f((e=>_objectSpread(_objectSpread({},e),{},{data:_objectSpread(_objectSpread({},e.data),{},{assignments:null})})))},symbol:"trash"}))):o.default.createElement(r.default,{displayType:"secondary",onClick:goToEditor},m.toUpperCase()))};t.default=_default}}));
//# sourceMappingURL=ScriptedAssignment.js.map