Liferay.Loader.define("data-engine-taglib@3.3.26/data_layout_builder/js/utils/client.es",["module","exports","require","frontend-js-web"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.getURL=a,t.addItem=function(t,n){return i(a(t),{body:JSON.stringify(n),headers:e,method:"POST"})},t.deleteItem=u,t.confirmDelete=function(e){return t=>new Promise(((n,r)=>{confirm(Liferay.Language.get("are-you-sure-you-want-to-delete-this"))?u(e+t.id).then((()=>n(!0))).catch((e=>r(e))):n(!1)}))},t.request=function(t,n="GET"){return(0,r.fetch)(a(t),{headers:e,method:n})},t.getItem=function(t){return(0,r.fetch)(a(t),{headers:e,method:"GET"}).then((e=>e.json()))},t.updateItem=function(t,n,r){return i(a(t,r),{body:JSON.stringify(n),headers:e,method:"PUT"})};var r=n("frontend-js-web");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,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const e={Accept:"application/json","Accept-Language":Liferay.ThemeDisplay.getBCP47LanguageId(),"Content-Type":"application/json"};function i(e,t){return new Promise(((n,o)=>{let c;(0,r.fetch)(e,t).then((e=>(c=e.ok,e.json()))).then((e=>{c?n(e):o(e)})).catch((e=>o(e)))}))}function a(e,t){t=function(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){c(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}({p_auth:Liferay.authToken,t:Date.now()},t);const n=new URL("".concat(window.location.origin).concat(e));return Object.keys(t).forEach((e=>n.searchParams.set(e,t[e]))),n.toString()}function u(e){return(0,r.fetch)(a(e),{method:"DELETE"})}}}));
//# sourceMappingURL=client.es.js.map