Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.105/admin/js/hooks/useBack.es",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/modal","@liferay/frontend-js-react-web","data-engine-js-components-web","liferay!frontend-js-react-web$react","./useAutoSave.es"],(function(e,t,a){var n;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.useBack=function(){const{portletNamespace:e}=(0,u.useConfig)(),[{onClose:t},a]=(0,c.useContext)(o.Context),{isSaved:n}=(0,i.useAutoSave)(),f=(0,c.useCallback)((e=>{if(n())return;e.preventDefault();const o=e.currentTarget.href;a({payload:{body:Liferay.Language.get("any-unsaved-changes-will-be-lost-are-you-sure-you-want-to-leave"),footer:[null,null,c.default.createElement(r.default.Group,{key:3,spaced:!0},c.default.createElement(r.default,{displayType:"secondary",onClick:()=>{window.location.href=o}},Liferay.Language.get("leave")),c.default.createElement(r.default,{displayType:"primary",onClick:t},Liferay.Language.get("stay")))],header:Liferay.Language.get("leave-form"),size:"sm"},type:1})}),[a,n,t]);(0,l.useEventListener)("click",f,!0,document.querySelector("#".concat(e,"controlMenu .sites-control-group span .control-menu-icon")))};var r=(n=a("@frontend-taglib-clay$clayui/button"))&&n.__esModule?n:{default:n},o=a("@frontend-taglib-clay$clayui/modal"),l=a("@liferay/frontend-js-react-web"),u=a("data-engine-js-components-web"),c=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=f();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 o=n?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(a,r,o):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),i=a("./useAutoSave.es");function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}}}));
//# sourceMappingURL=useBack.es.js.map