Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.85/designer/js/definition-builder/diagram-builder/components/sidebar/SidebarHeader",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../DefinitionBuilderContext","../../DiagramBuilderContext","./utils"],(function(e,t,a){var n;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({backButtonFunction:e=(()=>{}),contentName:t,deleteButtonFunction:a=(()=>{}),showBackButton:n,showDeleteButton:u,title:c}){const{setElements:f}=(0,o.useContext)(i.DefinitionBuilderContext),{selectedItem:y}=(0,o.useContext)(d.DiagramBuilderContext),[m,p]=(0,o.useState)(!1),[b,g]=(0,o.useState)({}),{observer:w}=(0,l.useModal)({onClose:()=>{p(!1)}}),C=e=>{"Backspace"!==e.key&&"Delete"!==e.key||"assignments"===t||document.querySelectorAll(".form-control:focus").length||document.querySelectorAll(".CodeMirror-focused").length||p(!0)};return(0,o.useEffect)((()=>{if(t)return g((0,s.getModalInfo)(t)),window.addEventListener("keydown",C),()=>{window.removeEventListener("keydown",C)}}),[t]),o.default.createElement("div",{className:"sidebar-header"},n&&o.default.createElement(r.ClayButtonWithIcon,{className:"text-secondary",displayType:"unstyled",onClick:e,symbol:"angle-left"}),o.default.createElement("div",{className:"spaced-items"},o.default.createElement("span",{className:"title"},c),u&&o.default.createElement(r.ClayButtonWithIcon,{className:"text-secondary trash-button",disabled:"assignments"===t,displayType:"unstyled",onClick:()=>p(!0),symbol:"trash"})),m&&o.default.createElement(l.default,{center:!0,observer:w,size:"sm"},o.default.createElement(l.default.Header,{className:"text-secondary"},b.title),o.default.createElement(l.default.Body,{className:"text-secondary"},b.message),o.default.createElement(l.default.Footer,{last:o.default.createElement(o.default.Fragment,null,o.default.createElement(r.default,{className:"mr-3",displayType:"secondary",onClick:()=>p(!1)},Liferay.Language.get("cancel")),o.default.createElement(r.default,{displayType:"danger",onClick:a?()=>{a(),p(!1),e()}:()=>{f((e=>e.filter((e=>e.id!==y.id&&e.source!==y.id&&e.target!==y.id)))),p(!1),e()}},Liferay.Language.get("delete")))})))};var r=c(a("@frontend-taglib-clay$clayui/button")),l=c(a("@frontend-taglib-clay$clayui/modal")),o=((n=a("liferay!frontend-js-react-web$prop-types"))&&n.__esModule,c(a("liferay!frontend-js-react-web$react"))),i=a("../../../DefinitionBuilderContext"),d=a("../../DiagramBuilderContext"),s=a("./utils");function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function c(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(a,r,l):a[r]=e[r]}return a.default=e,t&&t.set(e,a),a}}}));
//# sourceMappingURL=SidebarHeader.js.map