Liferay.Loader.define("@liferay/object-web@1.0.108/js/components/ObjectRelationship/DeleteRelationship",["module","exports","require","@frontend-taglib-clay$clayui/modal","@liferay/object-js-components-web","frontend-js-web","liferay!frontend-js-react-web$react","../DangerModal","../WarningModal"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({isApproved:e}){const[t,n]=(0,l.useState)(),{observer:o,onClose:i}=(0,a.useModal)({onClose:()=>n(null)}),s=(0,l.useCallback)((e=>{r.API.deleteObjectRelationships(e).then((()=>{Liferay.Util.openToast({message:Liferay.Language.get("relationship-was-deleted-successfully")}),i(),setTimeout((()=>window.location.reload()),1500)}))}),[i]);return(0,l.useEffect)((()=>(Liferay.on("deleteObjectRelationship",(({itemData:t})=>{e||t.reverse?n(t):s(t.id)})),()=>Liferay.detach("deleteObjectRelationship"))),[s,e]),l.default.createElement(a.ClayModalProvider,null,t&&l.default.createElement(d,{objectRelationship:t,observer:o,onClose:i,onDelete:s}))};var a=n("@frontend-taglib-clay$clayui/modal"),r=n("@liferay/object-js-components-web"),o=n("frontend-js-web"),l=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 n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var o=a?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(n,r,o):n[r]=e[r]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),i=u(n("../DangerModal")),s=u(n("../WarningModal"));function u(e){return e&&e.__esModule?e:{default:e}}function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function d({objectRelationship:e,observer:t,onClose:n,onDelete:a}){return e.reverse?l.default.createElement(s.default,{observer:t,onClose:n,title:Liferay.Language.get("deletion-not-allowed")},l.default.createElement("div",null,Liferay.Language.get("you-do-not-have-permission-to-delete-this-relationship")),l.default.createElement("div",null,Liferay.Language.get("you-cannot-delete-a-relationship-from-here"))):l.default.createElement(i.default,{errorMessage:Liferay.Language.get("input-and-relationship-name-do-not-match"),observer:t,onClose:n,onDelete:()=>a(e.id),placeholder:Liferay.Language.get("confirm-relationship-name"),title:Liferay.Language.get("delete-relationship"),token:e.name},l.default.createElement("p",null,Liferay.Language.get("this-action-cannot-be-undone-and-will-permanently-permanently-all-related-fields-from-this-relationship")),l.default.createElement("p",null,Liferay.Language.get("it-may-affect-many-records")),l.default.createElement("p",{dangerouslySetInnerHTML:{__html:(0,o.sub)(Liferay.Language.get("please-type-the-relationship-name-x-to-confirm"),"<strong>".concat(e.name,"</strong>"))}}))}}}));
//# sourceMappingURL=DeleteRelationship.js.map