Liferay.Loader.define("commerce-frontend-js@4.0.75/utilities/AJAX/index",["module","exports","require","frontend-js-web","../index"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r("frontend-js-web");function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const e=_objectSpread({},r("../index").fetchParams);function _fetch(t,r={},n={}){const c=new URL(t,Liferay.ThemeDisplay.getPortalURL());return Object.entries(n).map((([e,t])=>{c.searchParams.append(e,t)})),(0,o.fetch)(c.pathname+c.search,_objectSpread(_objectSpread({},e),r)).then((e=>e.ok?204===e.status?Promise.resolve():e.json():e.json().catch((e=>Promise.reject(new Error(e)))).then((e=>Promise.reject(e))))).catch((e=>Promise.reject(e)))}var n={DELETE:(e,t={},r={})=>_fetch(e,_objectSpread({method:"DELETE"},t),r),GET:(e,t={},r={})=>_fetch(e,t,r),PATCH:(e,t={},r={},o={})=>_fetch(e,_objectSpread({body:JSON.stringify(t),method:"PATCH"},r),o),POST:(e,t={},r={},o={})=>_fetch(e,_objectSpread({body:JSON.stringify(t),method:"POST"},r),o),PUT:(e,t={},r={},o={})=>_fetch(e,_objectSpread({body:JSON.stringify(t),method:"PUT"},r),o)};t.default=n}}));
//# sourceMappingURL=index.js.map