Socket
Socket
Sign inDemoInstall

xior

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xior - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

dist/index.esm.js

@@ -1,1 +0,1 @@

import{merge as e}from"ts-deepmerge";export{merge}from"ts-deepmerge";function t(e,t){let r=new globalThis.AbortController;function n(e){r.abort(e),o()}let s=[];for(let t of e){if((null==t?void 0:t.aborted)===!0){n(t.reason);break}if((null==t?void 0:t.addEventListener)!=null){let e=()=>{n(t.reason)};s.push(()=>{(null==t?void 0:t.removeEventListener)!=null&&t.removeEventListener("abort",e)}),t.addEventListener("abort",e)}}function o(){s.forEach(e=>{e()}),null==t||t()}let i=r.signal;return i.clear=o,i}function r(e,t,r){let n=t?r(t):"";n&&(n=e.includes("?")?e+"&"+n:e+"?"+n);let[s,o]=n.split("?");if(o){let e=o.split("&");return`${s}?${e.sort().join("&")}`}return n||e}function n(e){return new Promise(t=>{setTimeout(()=>{t("ok")},e)})}function s(e,t=!0,r=null){if(null==e)return"";let n=[],o=t?encodeURIComponent:e=>e;for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let a=e[i],l=r?`${r}[${o(i)}]`:o(i);if("object"==typeof a){let e=s(a,t,l);""!==e&&n.push(e)}else Array.isArray(a)?a.forEach((e,t)=>{let r=`${l}[${t}]`;n.push(`${o(r)}=${o(e)}`)}):n.push(`${o(l)}=${o(a)}`)}return n.join("&")}function o(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function i(e,t){return t?(e.endsWith("/")?e:e+"/")+(t.startsWith("/")?t.slice(1):t):e}class a extends Error{constructor(e,t,r){super(e),this.request=t,this.config=t,this.response=r}}class l extends a{}function u(e,t,r,n,s,o,i){try{var a=e[o](i),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(n,s)}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}let p="application/x-www-form-urlencoded",d="application/json";function h(e="GET"){return["HEAD","GET","DELETE","OPTIONS"].includes(e)}function f(e){return m.apply(this,arguments)}function m(){var t;return t=function*(t){let r=t.encode||t.paramsSerializer||s,n=!1!==t.encodeURI,o=t.method?t.method.toUpperCase():"GET",i=t.url||"",a=i,l=t.data,u=l,f=!1,m=(null==t?void 0:t.headers)||{};if(l&&!(l instanceof FormData)){let s="";if(null==t?void 0:t.headers){let e=Object.keys(t.headers).find(e=>"content-type"===e.toLowerCase());e&&(s=t.headers[e])}if(s||(s=h(o)?p:d,m["Content-Type"]=s),s===p&&("object"==typeof l||t.params)){f=!0;let s=r(e(l||{},t.params||{}),n);s&&(i=i.includes("?")?i+=`&${s}`:`${i}?${s}`)}else s===d&&(u=JSON.stringify(l))}return!f&&t.params&&Object.keys(t.params).length>0&&(i=i.includes("?")?i+=`&${r(t.params,n)}`:`${i}?${r(t.params,n)}`),c({},t,{data:l,_data:u,url:a,_url:i,method:o,headers:m,encode:r,paramsSerializer:r})},(m=function(){var e=this,r=arguments;return new Promise(function(n,s){var o=t.apply(e,r);function i(e){u(o,n,s,i,a,"next",e)}function a(e){u(o,n,s,i,a,"throw",e)}i(void 0)})}).apply(this,arguments)}function v(e,t,r,n,s,o,i){try{var a=e[o](i),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(n,s)}function y(e){return function(){var t=this,r=arguments;return new Promise(function(n,s){var o=e.apply(t,r);function i(e){v(o,n,s,i,a,"next",e)}function a(e){v(o,n,s,i,a,"throw",e)}i(void 0)})}}function g(){return(g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}let b="undefined"!=typeof AbortController;class E{static create(e){return new E(e)}get interceptors(){return{request:{use:(e,t)=>(this.requestInterceptors.push(e),e),eject:e=>{this.requestInterceptors=this.requestInterceptors.filter(t=>t!==e)},clear:()=>{this.requestInterceptors=[this.requestInterceptors[0]]}},response:{use:(e,t)=>(this.responseInterceptors.push({fn:e,onRejected:t}),e),eject:e=>{this.responseInterceptors=this.responseInterceptors.filter(t=>t.fn!==e)},clear:()=>{this.responseInterceptors=[]}}}}get plugins(){return{use:e=>(this._plugins.push(e),e),eject:e=>{this._plugins=this._plugins.filter(t=>t!==e)},clear:()=>{this._plugins=[]}}}request(t){var r=this;return y(function*(){let n=e({},r.config||{},r.defaults||{},"string"==typeof t?{url:t}:t||{},{headers:{},params:{}});for(let e of r.requestInterceptors)n=yield e(n);let s=r.handlerFetch.bind(r);return r._plugins.forEach(e=>{s=e(s)}),s(n)})()}handlerFetch(e){var r=this;return y(function*(){var n,s;let u,c;let{url:p,method:d,headers:f,timeout:m,signal:v,data:y,_data:E}=e,O=function(e,t){if(null==e)return{};var r,n,s={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(s[r]=e[r]);return s}(e,["url","method","headers","timeout","signal","data","_data"]),j=[];if(m&&b){let t=new AbortController;c=setTimeout(()=>{t.abort(new l(`timeout of ${m}ms exceeded`,e))},m),j.push(t.signal)}v&&j.push(v),u=j[0],j.length>1&&(u=t(j,()=>{clearTimeout(c)}));let I=e._url||p||"";e.baseURL&&!o(I)&&(I=i(e.baseURL,I));let w=yield fetch(I,g({body:h(e.method)?void 0:E},O,{signal:u,method:d,headers:f}));c&&clearTimeout(c),null==u||null==(n=u.clear)||n.call(u);let T={response:w,config:e,status:w.status,statusText:w.statusText,headers:w.headers};if(!w.ok){let t;try{(t=yield w.text())&&(t=JSON.parse(t))}catch(e){}let n=new a(w.status?`Request failed with status code ${w.status}`:"Network error",e,g({data:t},T));for(let e of r.responseInterceptors)if(e.onRejected){let t=yield e.onRejected(n);if(null==t?void 0:null==(s=t.response)?void 0:s.ok)return t}throw n}if("HEAD"===e.method)return g({data:void 0,request:e},T);let{responseType:P}=e;if(!P||"json"===P||"text"===P){let t;try{(t=yield w.text())&&"text"!==P&&(t=JSON.parse(t))}catch(e){}let n={data:t,request:e,response:w};for(let e of r.responseInterceptors)n=yield e.fn(n);return g({data:n.data,request:e},T)}return g({data:void 0,request:e},T)})()}createGetHandler(e){return(t,r)=>this.request(r?g({},r,{method:e,url:t}):{method:e,url:t})}createPostHandler(e){return(t,r,n)=>this.request(n?g({},n,{method:e,url:t,data:r}):{method:e,url:t,data:r})}get(e,t){return this.createGetHandler("GET")(e,t)}head(e,t){return this.createGetHandler("HEAD")(e,t)}post(e,t,r){return this.createPostHandler("POST")(e,t,r)}put(e,t,r){return this.createPostHandler("PUT")(e,t,r)}patch(e,t,r){return this.createPostHandler("PATCH")(e,t,r)}delete(e,t){return this.createGetHandler("DELETE")(e,t)}options(e,t){return this.createGetHandler("OPTIONS")(e,t)}constructor(e){this.requestInterceptors=[f],this.responseInterceptors=[],this._plugins=[],this.config=e,this.defaults={params:{},headers:{}}}}E.VERSION="0.2.1";let O=Object.assign(E.create(),{create:E.create,VERSION:E.VERSION});export{a as XiorError,l as XiorTimeoutError,t as anySignal,r as buildSortedURL,O as default,n as delay,s as encodeParams,o as isAbsoluteURL,i as joinPath,E as xior};
import{merge as e}from"ts-deepmerge";export{merge}from"ts-deepmerge";function t(e,t){let r=new globalThis.AbortController;function n(e){r.abort(e),o()}let s=[];for(let t of e){if((null==t?void 0:t.aborted)===!0){n(t.reason);break}if((null==t?void 0:t.addEventListener)!=null){let e=()=>{n(t.reason)};s.push(()=>{(null==t?void 0:t.removeEventListener)!=null&&t.removeEventListener("abort",e)}),t.addEventListener("abort",e)}}function o(){s.forEach(e=>{e()}),null==t||t()}let i=r.signal;return i.clear=o,i}function r(e,t,r){let n=t?r(t):"";n&&(n=e+(e.includes("?")?"&"+n:"?"+n));let[s,o]=n.split("?");if(o){let e=o.split("&");return`${s}?${e.sort().join("&")}`}return n||e}function n(e){return new Promise(t=>{setTimeout(()=>{t("ok")},e)})}function s(e,t=!0,r=null){if(null==e)return"";let n=[],o=t?encodeURIComponent:e=>e;for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let a=e[i],l=r?`${r}[${o(i)}]`:o(i);if("object"==typeof a){let e=s(a,t,l);""!==e&&n.push(e)}else Array.isArray(a)?a.forEach((e,t)=>{let r=`${l}[${t}]`;n.push(`${o(r)}=${o(e)}`)}):n.push(`${o(l)}=${o(a)}`)}return n.join("&")}function o(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function i(e,t){return t?(e.endsWith("/")?e:e+"/")+(t.startsWith("/")?t.slice(1):t):e}class a extends Error{constructor(e,t,r){super(e),this.request=t,this.config=t,this.response=r}}class l extends a{}function u(e,t,r,n,s,o,i){try{var a=e[o](i),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(n,s)}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}let p="application/x-www-form-urlencoded",d="application/json";function h(e="GET"){return["HEAD","GET","DELETE","OPTIONS"].includes(e)}function f(e){return m.apply(this,arguments)}function m(){var t;return t=function*(t){let r=t.encode||t.paramsSerializer||s,n=!1!==t.encodeURI,o=t.method?t.method.toUpperCase():"GET",i=t.url||"",a=i,l=t.data,u=l,f=!1,m=(null==t?void 0:t.headers)||{};if(l&&!(l instanceof FormData)){let s="";if(null==t?void 0:t.headers){let e=Object.keys(t.headers).find(e=>"content-type"===e.toLowerCase());e&&(s=t.headers[e])}if(s||(s=h(o)?p:d,m["Content-Type"]=s),s===p&&("object"==typeof l||t.params)){f=!0;let s=r(e(l||{},t.params||{}),n);s&&(i+=i.includes("?")?`&${s}`:`?${s}`)}else s===d&&(u=JSON.stringify(l))}return!f&&t.params&&Object.keys(t.params).length>0&&(i+=i.includes("?")?`&${r(t.params,n)}`:`?${r(t.params,n)}`),c({},t,{data:l,_data:u,url:a,_url:i,method:o,headers:m,encode:r,paramsSerializer:r})},(m=function(){var e=this,r=arguments;return new Promise(function(n,s){var o=t.apply(e,r);function i(e){u(o,n,s,i,a,"next",e)}function a(e){u(o,n,s,i,a,"throw",e)}i(void 0)})}).apply(this,arguments)}function v(e,t,r,n,s,o,i){try{var a=e[o](i),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(n,s)}function y(e){return function(){var t=this,r=arguments;return new Promise(function(n,s){var o=e.apply(t,r);function i(e){v(o,n,s,i,a,"next",e)}function a(e){v(o,n,s,i,a,"throw",e)}i(void 0)})}}function g(){return(g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}let b="undefined"!=typeof AbortController;class E{static create(e){return new E(e)}get interceptors(){return{request:{use:(e,t)=>(this.requestInterceptors.push(e),e),eject:e=>{this.requestInterceptors=this.requestInterceptors.filter(t=>t!==e)},clear:()=>{this.requestInterceptors=[this.requestInterceptors[0]]}},response:{use:(e,t)=>(this.responseInterceptors.push({fn:e,onRejected:t}),e),eject:e=>{this.responseInterceptors=this.responseInterceptors.filter(t=>t.fn!==e)},clear:()=>{this.responseInterceptors=[]}}}}get plugins(){return{use:e=>(this._plugins.push(e),e),eject:e=>{this._plugins=this._plugins.filter(t=>t!==e)},clear:()=>{this._plugins=[]}}}request(t){var r=this;return y(function*(){let n=e({},r.config||{},r.defaults||{},"string"==typeof t?{url:t}:t||{},{headers:{},params:{}});for(let e of r.requestInterceptors)n=yield e(n);let s=r.handlerFetch.bind(r);return r._plugins.forEach(e=>{s=e(s)}),s(n)})()}handlerFetch(e){var r=this;return y(function*(){var n,s;let u,c;let{url:p,method:d,headers:f,timeout:m,signal:v,data:y,_data:E}=e,O=function(e,t){if(null==e)return{};var r,n,s={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(s[r]=e[r]);return s}(e,["url","method","headers","timeout","signal","data","_data"]),j=[];if(m&&b){let t=new AbortController;c=setTimeout(()=>{t.abort(new l(`timeout of ${m}ms exceeded`,e))},m),j.push(t.signal)}v&&j.push(v),u=j[0],j.length>1&&(u=t(j,()=>{clearTimeout(c)}));let I=e._url||p||"";e.baseURL&&!o(I)&&(I=i(e.baseURL,I));let w=yield fetch(I,g({body:h(e.method)?void 0:E},O,{signal:u,method:d,headers:f}));c&&clearTimeout(c),null==u||null==(n=u.clear)||n.call(u);let T={response:w,config:e,status:w.status,statusText:w.statusText,headers:w.headers};if(!w.ok){let t;try{(t=yield w.text())&&(t=JSON.parse(t))}catch(e){}let n=new a(w.status?`Request failed with status code ${w.status}`:"Network error",e,g({data:t},T));for(let e of r.responseInterceptors)if(e.onRejected){let t=yield e.onRejected(n);if(null==t?void 0:null==(s=t.response)?void 0:s.ok)return t}throw n}if("HEAD"===e.method)return g({data:void 0,request:e},T);let{responseType:P}=e;if(!P||"json"===P||"text"===P){let t;try{(t=yield w.text())&&"text"!==P&&(t=JSON.parse(t))}catch(e){}let n={data:t,request:e,response:w};for(let e of r.responseInterceptors)n=yield e.fn(n);return g({data:n.data,request:e},T)}return g({data:void 0,request:e},T)})()}createGetHandler(e){return(t,r)=>this.request(r?g({},r,{method:e,url:t}):{method:e,url:t})}createPostHandler(e){return(t,r,n)=>this.request(n?g({},n,{method:e,url:t,data:r}):{method:e,url:t,data:r})}get(e,t){return this.createGetHandler("GET")(e,t)}head(e,t){return this.createGetHandler("HEAD")(e,t)}post(e,t,r){return this.createPostHandler("POST")(e,t,r)}put(e,t,r){return this.createPostHandler("PUT")(e,t,r)}patch(e,t,r){return this.createPostHandler("PATCH")(e,t,r)}delete(e,t){return this.createGetHandler("DELETE")(e,t)}options(e,t){return this.createGetHandler("OPTIONS")(e,t)}constructor(e){this.requestInterceptors=[f],this.responseInterceptors=[],this._plugins=[],this.config=e,this.defaults={params:{},headers:{}}}}E.VERSION="0.2.2";let O=Object.assign(E.create(),{create:E.create,VERSION:E.VERSION});export{a as XiorError,l as XiorTimeoutError,t as anySignal,r as buildSortedURL,O as default,n as delay,s as encodeParams,o as isAbsoluteURL,i as joinPath,E as xior};

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xior=t():e.xior=t()}(this,(()=>(()=>{"use strict";var e={699:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.anySignal=void 0,t.anySignal=function(e,t){const r=new globalThis.AbortController;function n(e){r.abort(e),s()}const o=[];for(const t of e){if(!0===(null==t?void 0:t.aborted)){n(t.reason);break}if(null!=(null==t?void 0:t.addEventListener)){const e=()=>{n(t.reason)};o.push((()=>{null!=(null==t?void 0:t.removeEventListener)&&t.removeEventListener("abort",e)})),t.addEventListener("abort",e)}}function s(){o.forEach((e=>{e()})),null==t||t()}const i=r.signal;return i.clear=s,i}},509:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});const s=r(895);o(r(895),t),o(r(340),t),o(r(976),t);const i=Object.assign(s.xior.create(),{create:s.xior.create,VERSION:s.xior.VERSION});t.default=i},393:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.likeGET=void 0;const o=r(976),s="application/x-www-form-urlencoded",i="application/json";function a(e="GET"){return["HEAD","GET","DELETE","OPTIONS"].includes(e)}t.likeGET=a,t.default=function(e){return n(this,void 0,void 0,(function*(){const t=e.encode||e.paramsSerializer||o.encodeParams,r=!1!==e.encodeURI,n=e.method?e.method.toUpperCase():"GET";let c=e.url||"";const u=c,l=e.data;let d=l,f=!1;const p=(null==e?void 0:e.headers)||{};if(l&&!(l instanceof FormData)){let u="";if(null==e?void 0:e.headers){const t=Object.keys(e.headers).find((e=>"content-type"===e.toLowerCase()));t&&(u=e.headers[t])}if(u||(u=a(n)?s:i,p["Content-Type"]=u),u!==s||"object"!=typeof l&&!e.params)u===i&&(d=JSON.stringify(l));else{f=!0;const n=t((0,o.merge)(l||{},e.params||{}),r);n&&(c=c.includes("?")?c+=`&${n}`:`${c}?${n}`)}}return!f&&e.params&&Object.keys(e.params).length>0&&(c=c.includes("?")?c+=`&${t(e.params,r)}`:`${c}?${t(e.params,r)}`),Object.assign(Object.assign({},e),{data:l,_data:d,url:u,_url:c,method:n,headers:p,encode:t,paramsSerializer:t})}))}},729:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const n=r(602);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return n.merge}})},629:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){let n=t?r(t):"";n&&(n=e.includes("?")?e+"&"+n:e+"?"+n);const[o,s]=n.split("?");return s?`${o}?${s.split("&").sort().join("&")}`:n||e}},99:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.delay=t.buildSortedURL=void 0;const o=n(r(629));t.buildSortedURL=o.default,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t("ok")}),e)}))}},340:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},976:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.XiorTimeoutError=t.XiorError=t.joinPath=t.isAbsoluteURL=t.encodeParams=void 0,o(r(699),t),o(r(729),t),o(r(99),t),t.encodeParams=function e(t,r=!0,n=null){if(null==t)return"";const o=[],s=r?encodeURIComponent:e=>e;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i],c=n?`${n}[${s(i)}]`:s(i);if("object"==typeof a){const t=e(a,r,c);""!==t&&o.push(t)}else Array.isArray(a)?a.forEach(((e,t)=>{const r=`${c}[${t}]`;o.push(`${s(r)}=${s(e)}`)})):o.push(`${s(c)}=${s(a)}`)}return o.join("&")},t.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},t.joinPath=function(e,t){return t?(e.endsWith("/")?e:e+"/")+(t.startsWith("/")?t.slice(1):t):e};class s extends Error{constructor(e,t,r){super(e),this.request=t,this.config=t,this.response=r}}t.XiorError=s,t.XiorTimeoutError=class extends s{}},895:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.xior=void 0;const c=s(r(393)),u=r(976),l="undefined"!=typeof AbortController;class d{static create(e){return new d(e)}constructor(e){this.requestInterceptors=[c.default],this.responseInterceptors=[],this._plugins=[],this.config=e,this.defaults={params:{},headers:{}}}get interceptors(){return{request:{use:(e,t)=>(this.requestInterceptors.push(e),e),eject:e=>{this.requestInterceptors=this.requestInterceptors.filter((t=>t!==e))},clear:()=>{this.requestInterceptors=[this.requestInterceptors[0]]}},response:{use:(e,t)=>(this.responseInterceptors.push({fn:e,onRejected:t}),e),eject:e=>{this.responseInterceptors=this.responseInterceptors.filter((t=>t.fn!==e))},clear:()=>{this.responseInterceptors=[]}}}}get plugins(){return{use:e=>(this._plugins.push(e),e),eject:e=>{this._plugins=this._plugins.filter((t=>t!==e))},clear:()=>{this._plugins=[]}}}request(e){return i(this,void 0,void 0,(function*(){let t=(0,u.merge)({},this.config||{},this.defaults||{},"string"==typeof e?{url:e}:e||{},{headers:{},params:{}});for(const e of this.requestInterceptors)t=yield e(t);let r=this.handlerFetch.bind(this);return this._plugins.forEach((e=>{r=e(r)})),r(t)}))}handlerFetch(e){var t,r;return i(this,void 0,void 0,(function*(){const{url:n,method:o,headers:s,timeout:i,signal:d,data:f,_data:p}=e,h=a(e,["url","method","headers","timeout","signal","data","_data"]);let b;const y=[];let g;if(i&&l){const t=new AbortController;g=setTimeout((()=>{t.abort(new u.XiorTimeoutError(`timeout of ${i}ms exceeded`,e))}),i),y.push(t.signal)}d&&y.push(d),b=y[0],y.length>1&&(b=(0,u.anySignal)(y,(()=>{clearTimeout(g)})));let m=e._url||n||"";e.baseURL&&!(0,u.isAbsoluteURL)(m)&&(m=(0,u.joinPath)(e.baseURL,m));const O=yield fetch(m,Object.assign(Object.assign({body:(0,c.likeGET)(e.method)?void 0:p},h),{signal:b,method:o,headers:s}));g&&clearTimeout(g),null===(t=null==b?void 0:b.clear)||void 0===t||t.call(b);const v={response:O,config:e,status:O.status,statusText:O.statusText,headers:O.headers};if(!O.ok){let t;try{t=yield O.text(),t&&(t=JSON.parse(t))}catch(e){}const n=new u.XiorError(O.status?`Request failed with status code ${O.status}`:"Network error",e,Object.assign({data:t},v));for(const e of this.responseInterceptors)if(e.onRejected){const t=yield e.onRejected(n);if(null===(r=null==t?void 0:t.response)||void 0===r?void 0:r.ok)return t}throw n}if("HEAD"===e.method)return Object.assign({data:void 0,request:e},v);const{responseType:j}=e;if(!j||"json"===j||"text"===j){let t;try{t=yield O.text(),t&&"text"!==j&&(t=JSON.parse(t))}catch(e){}let r={data:t,request:e,response:O};for(const e of this.responseInterceptors)r=yield e.fn(r);return Object.assign({data:r.data,request:e},v)}return Object.assign({data:void 0,request:e},v)}))}createGetHandler(e){return(t,r)=>this.request(r?Object.assign(Object.assign({},r),{method:e,url:t}):{method:e,url:t})}createPostHandler(e){return(t,r,n)=>this.request(n?Object.assign(Object.assign({},n),{method:e,url:t,data:r}):{method:e,url:t,data:r})}get(e,t){return this.createGetHandler("GET")(e,t)}head(e,t){return this.createGetHandler("HEAD")(e,t)}post(e,t,r){return this.createPostHandler("POST")(e,t,r)}put(e,t,r){return this.createPostHandler("PUT")(e,t,r)}patch(e,t,r){return this.createPostHandler("PATCH")(e,t,r)}delete(e,t){return this.createGetHandler("DELETE")(e,t)}options(e,t){return this.createGetHandler("OPTIONS")(e,t)}}t.xior=d,d.VERSION="0.2.1"},602:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const r=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}return!1};t.merge=(...e)=>e.reduce(((e,n)=>{if(Array.isArray(n))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(n).forEach((o=>{["__proto__","constructor","prototype"].includes(o)||(Array.isArray(e[o])&&Array.isArray(n[o])?e[o]=t.merge.options.mergeArrays?t.merge.options.uniqueArrayItems?Array.from(new Set(e[o].concat(n[o]))):[...e[o],...n[o]]:n[o]:r(e[o])&&r(n[o])?e[o]=(0,t.merge)(e[o],n[o]):e[o]=void 0===n[o]?t.merge.options.allowUndefinedOverrides?n[o]:e[o]:n[o])})),e}),{});const n={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};t.merge.options=n,t.merge.withOptions=(e,...r)=>{t.merge.options=Object.assign(Object.assign({},n),e);const o=(0,t.merge)(...r);return t.merge.options=n,o}}},t={},r=function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(509);return r.default})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xior=t():e.xior=t()}(this,(()=>(()=>{"use strict";var e={699:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.anySignal=void 0,t.anySignal=function(e,t){const r=new globalThis.AbortController;function n(e){r.abort(e),s()}const o=[];for(const t of e){if(!0===(null==t?void 0:t.aborted)){n(t.reason);break}if(null!=(null==t?void 0:t.addEventListener)){const e=()=>{n(t.reason)};o.push((()=>{null!=(null==t?void 0:t.removeEventListener)&&t.removeEventListener("abort",e)})),t.addEventListener("abort",e)}}function s(){o.forEach((e=>{e()})),null==t||t()}const i=r.signal;return i.clear=s,i}},509:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});const s=r(895);o(r(895),t),o(r(340),t),o(r(976),t);const i=Object.assign(s.xior.create(),{create:s.xior.create,VERSION:s.xior.VERSION});t.default=i},393:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.likeGET=void 0;const o=r(976),s="application/x-www-form-urlencoded",i="application/json";function a(e="GET"){return["HEAD","GET","DELETE","OPTIONS"].includes(e)}t.likeGET=a,t.default=function(e){return n(this,void 0,void 0,(function*(){const t=e.encode||e.paramsSerializer||o.encodeParams,r=!1!==e.encodeURI,n=e.method?e.method.toUpperCase():"GET";let c=e.url||"";const u=c,l=e.data;let d=l,f=!1;const p=(null==e?void 0:e.headers)||{};if(l&&!(l instanceof FormData)){let u="";if(null==e?void 0:e.headers){const t=Object.keys(e.headers).find((e=>"content-type"===e.toLowerCase()));t&&(u=e.headers[t])}if(u||(u=a(n)?s:i,p["Content-Type"]=u),u!==s||"object"!=typeof l&&!e.params)u===i&&(d=JSON.stringify(l));else{f=!0;const n=t((0,o.merge)(l||{},e.params||{}),r);n&&(c+=c.includes("?")?`&${n}`:`?${n}`)}}return!f&&e.params&&Object.keys(e.params).length>0&&(c+=c.includes("?")?`&${t(e.params,r)}`:`?${t(e.params,r)}`),Object.assign(Object.assign({},e),{data:l,_data:d,url:u,_url:c,method:n,headers:p,encode:t,paramsSerializer:t})}))}},729:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const n=r(602);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return n.merge}})},629:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){let n=t?r(t):"";n&&(n=e+(e.includes("?")?"&"+n:"?"+n));const[o,s]=n.split("?");return s?`${o}?${s.split("&").sort().join("&")}`:n||e}},99:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.delay=t.buildSortedURL=void 0;const o=n(r(629));t.buildSortedURL=o.default,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t("ok")}),e)}))}},340:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},976:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.XiorTimeoutError=t.XiorError=t.joinPath=t.isAbsoluteURL=t.encodeParams=void 0,o(r(699),t),o(r(729),t),o(r(99),t),t.encodeParams=function e(t,r=!0,n=null){if(null==t)return"";const o=[],s=r?encodeURIComponent:e=>e;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i],c=n?`${n}[${s(i)}]`:s(i);if("object"==typeof a){const t=e(a,r,c);""!==t&&o.push(t)}else Array.isArray(a)?a.forEach(((e,t)=>{const r=`${c}[${t}]`;o.push(`${s(r)}=${s(e)}`)})):o.push(`${s(c)}=${s(a)}`)}return o.join("&")},t.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},t.joinPath=function(e,t){return t?(e.endsWith("/")?e:e+"/")+(t.startsWith("/")?t.slice(1):t):e};class s extends Error{constructor(e,t,r){super(e),this.request=t,this.config=t,this.response=r}}t.XiorError=s,t.XiorTimeoutError=class extends s{}},895:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.xior=void 0;const c=s(r(393)),u=r(976),l="undefined"!=typeof AbortController;class d{static create(e){return new d(e)}constructor(e){this.requestInterceptors=[c.default],this.responseInterceptors=[],this._plugins=[],this.config=e,this.defaults={params:{},headers:{}}}get interceptors(){return{request:{use:(e,t)=>(this.requestInterceptors.push(e),e),eject:e=>{this.requestInterceptors=this.requestInterceptors.filter((t=>t!==e))},clear:()=>{this.requestInterceptors=[this.requestInterceptors[0]]}},response:{use:(e,t)=>(this.responseInterceptors.push({fn:e,onRejected:t}),e),eject:e=>{this.responseInterceptors=this.responseInterceptors.filter((t=>t.fn!==e))},clear:()=>{this.responseInterceptors=[]}}}}get plugins(){return{use:e=>(this._plugins.push(e),e),eject:e=>{this._plugins=this._plugins.filter((t=>t!==e))},clear:()=>{this._plugins=[]}}}request(e){return i(this,void 0,void 0,(function*(){let t=(0,u.merge)({},this.config||{},this.defaults||{},"string"==typeof e?{url:e}:e||{},{headers:{},params:{}});for(const e of this.requestInterceptors)t=yield e(t);let r=this.handlerFetch.bind(this);return this._plugins.forEach((e=>{r=e(r)})),r(t)}))}handlerFetch(e){var t,r;return i(this,void 0,void 0,(function*(){const{url:n,method:o,headers:s,timeout:i,signal:d,data:f,_data:p}=e,h=a(e,["url","method","headers","timeout","signal","data","_data"]);let b;const y=[];let g;if(i&&l){const t=new AbortController;g=setTimeout((()=>{t.abort(new u.XiorTimeoutError(`timeout of ${i}ms exceeded`,e))}),i),y.push(t.signal)}d&&y.push(d),b=y[0],y.length>1&&(b=(0,u.anySignal)(y,(()=>{clearTimeout(g)})));let m=e._url||n||"";e.baseURL&&!(0,u.isAbsoluteURL)(m)&&(m=(0,u.joinPath)(e.baseURL,m));const O=yield fetch(m,Object.assign(Object.assign({body:(0,c.likeGET)(e.method)?void 0:p},h),{signal:b,method:o,headers:s}));g&&clearTimeout(g),null===(t=null==b?void 0:b.clear)||void 0===t||t.call(b);const v={response:O,config:e,status:O.status,statusText:O.statusText,headers:O.headers};if(!O.ok){let t;try{t=yield O.text(),t&&(t=JSON.parse(t))}catch(e){}const n=new u.XiorError(O.status?`Request failed with status code ${O.status}`:"Network error",e,Object.assign({data:t},v));for(const e of this.responseInterceptors)if(e.onRejected){const t=yield e.onRejected(n);if(null===(r=null==t?void 0:t.response)||void 0===r?void 0:r.ok)return t}throw n}if("HEAD"===e.method)return Object.assign({data:void 0,request:e},v);const{responseType:j}=e;if(!j||"json"===j||"text"===j){let t;try{t=yield O.text(),t&&"text"!==j&&(t=JSON.parse(t))}catch(e){}let r={data:t,request:e,response:O};for(const e of this.responseInterceptors)r=yield e.fn(r);return Object.assign({data:r.data,request:e},v)}return Object.assign({data:void 0,request:e},v)}))}createGetHandler(e){return(t,r)=>this.request(r?Object.assign(Object.assign({},r),{method:e,url:t}):{method:e,url:t})}createPostHandler(e){return(t,r,n)=>this.request(n?Object.assign(Object.assign({},n),{method:e,url:t,data:r}):{method:e,url:t,data:r})}get(e,t){return this.createGetHandler("GET")(e,t)}head(e,t){return this.createGetHandler("HEAD")(e,t)}post(e,t,r){return this.createPostHandler("POST")(e,t,r)}put(e,t,r){return this.createPostHandler("PUT")(e,t,r)}patch(e,t,r){return this.createPostHandler("PATCH")(e,t,r)}delete(e,t){return this.createGetHandler("DELETE")(e,t)}options(e,t){return this.createGetHandler("OPTIONS")(e,t)}}t.xior=d,d.VERSION="0.2.2"},602:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const r=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}return!1};t.merge=(...e)=>e.reduce(((e,n)=>{if(Array.isArray(n))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(n).forEach((o=>{["__proto__","constructor","prototype"].includes(o)||(Array.isArray(e[o])&&Array.isArray(n[o])?e[o]=t.merge.options.mergeArrays?t.merge.options.uniqueArrayItems?Array.from(new Set(e[o].concat(n[o]))):[...e[o],...n[o]]:n[o]:r(e[o])&&r(n[o])?e[o]=(0,t.merge)(e[o],n[o]):e[o]=void 0===n[o]?t.merge.options.allowUndefinedOverrides?n[o]:e[o]:n[o])})),e}),{});const n={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};t.merge.options=n,t.merge.withOptions=(e,...r)=>{t.merge.options=Object.assign(Object.assign({},n),e);const o=(0,t.merge)(...r);return t.merge.options=n,o}}},t={},r=function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(509);return r.default})()));

@@ -64,4 +64,4 @@ [Go back](./README.md)

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/plugins/mock.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/plugins/mock.umd.js"></script>

@@ -83,4 +83,4 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.1/plugins/mock.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/plugins/mock.umd.js"></script>

@@ -87,0 +87,0 @@ <!-- Usage -->

{
"name": "xior",
"version": "0.2.1",
"version": "0.2.2",
"description": "A lite request lib based on fetch with plugins support, and axios similar API",

@@ -5,0 +5,0 @@ "repository": "suhaotian/xior",

/*! For license information please see cache.umd.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.xiorCache=e():t.xiorCache=e()}(this,(()=>(()=>{"use strict";var t={629:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,i){let s=e?i(e):"";s&&(s=t.includes("?")?t+"&"+s:t+"?"+s);const[n,r]=s.split("?");return r?`${n}?${r.split("&").sort().join("&")}`:s||t}},523:function(t,e,i){var s=this&&this.__awaiter||function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function l(t){try{o(s.next(t))}catch(t){r(t)}}function h(t){try{o(s.throw(t))}catch(t){r(t)}}function o(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(l,h)}o((s=s.apply(t,e||[])).next())}))},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const r=i(455),l=n(i(629));e.default=function(t={}){const{enableCache:e,defaultCache:i=(0,r.lru)(100,3e5)}=t;return function(t){return n=>s(this,void 0,void 0,(function*(){const{enableCache:r=e,forceUpdate:h,defaultCache:o=i,_url:u,encode:a,data:f}=n,c="GET"===n.method||n.isGet,p=typeof r;if("undefined"===p?c:"function"===p?r(n):Boolean(r)){const e=o,i=(0,l.default)(u,f,a);let r=e.get(i);return!r||h?(r=(()=>s(this,void 0,void 0,(function*(){try{return yield t(n)}catch(t){throw"delete"in e?e.delete(i):e.del(i),t}})))(),e.set(i,r),r):r.then((t=>(t.fromCache=!0,t)))}return t(n)}))}}},455:(t,e)=>{class i{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){return t.map((t=>[t,this.get(t)]))}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0==--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){let e;if(this.has(t)){const i=this.items[t];this.ttl>0&&i.expiry<=Date.now()?this.delete(t):(e=i.value,this.set(t,e,!0))}return e}has(t){return t in this.items}keys(){const t=[];let e=this.first;for(;null!==e;)t.push(e.key),e=e.next;return t}set(t,e,i=!1,s=this.resetTtl){let n;if(i||this.has(t)){if(n=this.items[t],n.value=e,!1===i&&s&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){const t=this.last,e=n.next,i=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,t.next=n,null!==i&&(i.next=e),null!==e&&(e.prev=i)}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1==++this.size?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map((t=>this.get(t)))}}e.LRU=i,e.lru=function(t=1e3,e=0,s=!1){if(isNaN(t)||t<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof s)throw new TypeError("Invalid resetTtl value");return new i(t,e,s)}}},e={},i=function i(s){var n=e[s];if(void 0!==n)return n.exports;var r=e[s]={exports:{}};return t[s].call(r.exports,r,r.exports,i),r.exports}(523);return i.default})()));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.xiorCache=e():t.xiorCache=e()}(this,(()=>(()=>{"use strict";var t={629:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,i){let s=e?i(e):"";s&&(s=t+(t.includes("?")?"&"+s:"?"+s));const[n,r]=s.split("?");return r?`${n}?${r.split("&").sort().join("&")}`:s||t}},523:function(t,e,i){var s=this&&this.__awaiter||function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function l(t){try{o(s.next(t))}catch(t){r(t)}}function h(t){try{o(s.throw(t))}catch(t){r(t)}}function o(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(l,h)}o((s=s.apply(t,e||[])).next())}))},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const r=i(455),l=n(i(629));e.default=function(t={}){const{enableCache:e,defaultCache:i=(0,r.lru)(100,3e5)}=t;return function(t){return n=>s(this,void 0,void 0,(function*(){const{enableCache:r=e,forceUpdate:h,defaultCache:o=i,_url:u,encode:a,data:f}=n,c="GET"===n.method||n.isGet,p=typeof r;if("undefined"===p?c:"function"===p?r(n):Boolean(r)){const e=o,i=(0,l.default)(u,f,a);let r=e.get(i);return!r||h?(r=(()=>s(this,void 0,void 0,(function*(){try{return yield t(n)}catch(t){throw"delete"in e?e.delete(i):e.del(i),t}})))(),e.set(i,r),r):r.then((t=>(t.fromCache=!0,t)))}return t(n)}))}}},455:(t,e)=>{class i{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){return t.map((t=>[t,this.get(t)]))}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0==--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){let e;if(this.has(t)){const i=this.items[t];this.ttl>0&&i.expiry<=Date.now()?this.delete(t):(e=i.value,this.set(t,e,!0))}return e}has(t){return t in this.items}keys(){const t=[];let e=this.first;for(;null!==e;)t.push(e.key),e=e.next;return t}set(t,e,i=!1,s=this.resetTtl){let n;if(i||this.has(t)){if(n=this.items[t],n.value=e,!1===i&&s&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){const t=this.last,e=n.next,i=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,t.next=n,null!==i&&(i.next=e),null!==e&&(e.prev=i)}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1==++this.size?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map((t=>this.get(t)))}}e.LRU=i,e.lru=function(t=1e3,e=0,s=!1){if(isNaN(t)||t<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof s)throw new TypeError("Invalid resetTtl value");return new i(t,e,s)}}},e={},i=function i(s){var n=e[s];if(void 0!==n)return n.exports;var r=e[s]={exports:{}};return t[s].call(r.exports,r,r.exports,i),r.exports}(523);return i.default})()));

@@ -1,1 +0,1 @@

import{lru as t}from"tiny-lru";function e(t,e,n,r,i,u,o){try{var c=t[u](o),l=c.value}catch(t){n(t);return}c.done?e(l):Promise.resolve(l).then(r,i)}function n(t){return function(){var n=this,r=arguments;return new Promise(function(i,u){var o=t.apply(n,r);function c(t){e(o,i,u,c,l,"next",t)}function l(t){e(o,i,u,c,l,"throw",t)}c(void 0)})}}function r(e={}){let{enableCache:r,defaultCache:i=t(100,3e5)}=e;return function(t){return n(function*(e){let{enableCache:u=r,forceUpdate:o,defaultCache:c=i,_url:l,encode:f,data:a}=e,d="GET"===e.method||e.isGet,h=typeof u;if("undefined"===h?d:"function"===h?u(e):!!u){let r=function(t,e,n){let r=e?n(e):"";r&&(r=t.includes("?")?t+"&"+r:t+"?"+r);let[i,u]=r.split("?");if(u){let t=u.split("&");return`${i}?${t.sort().join("&")}`}return r||t}(l,a,f),i=c.get(r);return!i||o?(i=n(function*(){try{return yield t(e)}catch(t){throw"delete"in c?c.delete(r):c.del(r),t}})(),c.set(r,i),i):i.then(t=>(t.fromCache=!0,t))}return t(e)})}}export{r as default};
import{lru as t}from"tiny-lru";function e(t,e,n,r,i,u,o){try{var c=t[u](o),l=c.value}catch(t){n(t);return}c.done?e(l):Promise.resolve(l).then(r,i)}function n(t){return function(){var n=this,r=arguments;return new Promise(function(i,u){var o=t.apply(n,r);function c(t){e(o,i,u,c,l,"next",t)}function l(t){e(o,i,u,c,l,"throw",t)}c(void 0)})}}function r(e={}){let{enableCache:r,defaultCache:i=t(100,3e5)}=e;return function(t){return n(function*(e){let{enableCache:u=r,forceUpdate:o,defaultCache:c=i,_url:l,encode:f,data:a}=e,d="GET"===e.method||e.isGet,h=typeof u;if("undefined"===h?d:"function"===h?u(e):!!u){let r=function(t,e,n){let r=e?n(e):"";r&&(r=t+(t.includes("?")?"&"+r:"?"+r));let[i,u]=r.split("?");if(u){let t=u.split("&");return`${i}?${t.sort().join("&")}`}return r||t}(l,a,f),i=c.get(r);return!i||o?(i=n(function*(){try{return yield t(e)}catch(t){throw"delete"in c?c.delete(r):c.del(r),t}})(),c.set(r,i),i):i.then(t=>(t.fromCache=!0,t))}return t(e)})}}export{r as default};

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xiorDedupe=t():e.xiorDedupe=t()}(this,(()=>(()=>{"use strict";var e={629:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){let i=t?n(t):"";i&&(i=e.includes("?")?e+"&"+i:e+"?"+i);const[o,r]=i.split("?");return r?`${o}?${r.split("&").sort().join("&")}`:i||e}},91:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,r){function u(e){try{l(i.next(e))}catch(e){r(e)}}function f(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,f)}l((i=i.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.inflight=void 0;const r=o(n(629));t.inflight=new Map,t.default=function(e={}){const{enableDedupe:n}=e;return function(e){return o=>i(this,void 0,void 0,(function*(){var i,u;const{_url:f,encode:l,enableDedupe:c=n,data:d}=o,s="GET"===o.method||o.isGet,a=typeof c;if(!("undefined"===a?s:"function"===a?c(o):Boolean(c)))return e(o);const p=(0,r.default)(f,d,l);if(t.inflight.has(p))return new Promise(((e,n)=>{var i;null===(i=t.inflight.get(p))||void 0===i||i.push([e,n])}));t.inflight.set(p,[]);try{const n=yield e(o);return null===(i=t.inflight.get(p))||void 0===i||i.forEach((([e])=>e(n))),t.inflight.delete(p),n}catch(e){throw null===(u=t.inflight.get(p))||void 0===u||u.forEach((([,t])=>t(e))),t.inflight.delete(p),e}}))}}}},t={},n=function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}(91);return n.default})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xiorDedupe=t():e.xiorDedupe=t()}(this,(()=>(()=>{"use strict";var e={629:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){let i=t?n(t):"";i&&(i=e+(e.includes("?")?"&"+i:"?"+i));const[o,r]=i.split("?");return r?`${o}?${r.split("&").sort().join("&")}`:i||e}},91:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,r){function u(e){try{l(i.next(e))}catch(e){r(e)}}function f(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,f)}l((i=i.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.inflight=void 0;const r=o(n(629));t.inflight=new Map,t.default=function(e={}){const{enableDedupe:n}=e;return function(e){return o=>i(this,void 0,void 0,(function*(){var i,u;const{_url:f,encode:l,enableDedupe:c=n,data:d}=o,s="GET"===o.method||o.isGet,a=typeof c;if(!("undefined"===a?s:"function"===a?c(o):Boolean(c)))return e(o);const p=(0,r.default)(f,d,l);if(t.inflight.has(p))return new Promise(((e,n)=>{var i;null===(i=t.inflight.get(p))||void 0===i||i.push([e,n])}));t.inflight.set(p,[]);try{const n=yield e(o);return null===(i=t.inflight.get(p))||void 0===i||i.forEach((([e])=>e(n))),t.inflight.delete(p),n}catch(e){throw null===(u=t.inflight.get(p))||void 0===u||u.forEach((([,t])=>t(e))),t.inflight.delete(p),e}}))}}}},t={},n=function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}(91);return n.default})()));

@@ -1,1 +0,1 @@

function e(e,t,n,r,u,i,l){try{var o=e[i](l),f=o.value}catch(e){n(e);return}o.done?t(f):Promise.resolve(f).then(r,u)}let t=new Map;function n(n={}){let{enableDedupe:r}=n;return function(n){var u;return u=function*(e){var u,i;let{_url:l,encode:o,enableDedupe:f=r,data:a}=e,c="GET"===e.method||e.isGet,s=typeof f;if(!("undefined"===s?c:"function"===s?f(e):!!f))return n(e);let d=function(e,t,n){let r=t?n(t):"";r&&(r=e.includes("?")?e+"&"+r:e+"?"+r);let[u,i]=r.split("?");if(i){let e=i.split("&");return`${u}?${e.sort().join("&")}`}return r||e}(l,a,o);if(t.has(d))return new Promise((e,n)=>{var r;null==(r=t.get(d))||r.push([e,n])});t.set(d,[]);try{let r=yield n(e);return null==(u=t.get(d))||u.forEach(([e])=>e(r)),t.delete(d),r}catch(e){throw null==(i=t.get(d))||i.forEach(([,t])=>t(e)),t.delete(d),e}},function(){var t=this,n=arguments;return new Promise(function(r,i){var l=u.apply(t,n);function o(t){e(l,r,i,o,f,"next",t)}function f(t){e(l,r,i,o,f,"throw",t)}o(void 0)})}}}export{n as default,t as inflight};
function e(e,t,n,r,u,i,l){try{var o=e[i](l),f=o.value}catch(e){n(e);return}o.done?t(f):Promise.resolve(f).then(r,u)}let t=new Map;function n(n={}){let{enableDedupe:r}=n;return function(n){var u;return u=function*(e){var u,i;let{_url:l,encode:o,enableDedupe:f=r,data:a}=e,c="GET"===e.method||e.isGet,s=typeof f;if(!("undefined"===s?c:"function"===s?f(e):!!f))return n(e);let d=function(e,t,n){let r=t?n(t):"";r&&(r=e+(e.includes("?")?"&"+r:"?"+r));let[u,i]=r.split("?");if(i){let e=i.split("&");return`${u}?${e.sort().join("&")}`}return r||e}(l,a,o);if(t.has(d))return new Promise((e,n)=>{var r;null==(r=t.get(d))||r.push([e,n])});t.set(d,[]);try{let r=yield n(e);return null==(u=t.get(d))||u.forEach(([e])=>e(r)),t.delete(d),r}catch(e){throw null==(i=t.get(d))||i.forEach(([,t])=>t(e)),t.delete(d),e}},function(){var t=this,n=arguments;return new Promise(function(r,i){var l=u.apply(t,n);function o(t){e(l,r,i,o,f,"next",t)}function f(t){e(l,r,i,o,f,"throw",t)}o(void 0)})}}}export{n as default,t as inflight};

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xiorErrorCache=t():e.xiorErrorCache=t()}(this,(()=>(()=>{"use strict";var e={629:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){let o=t?n(t):"";o&&(o=e.includes("?")?e+"&"+o:e+"?"+o);const[r,u]=o.split("?");return u?`${r}?${u.split("&").sort().join("&")}`:o||e}},431:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,u){function i(e){try{f(o.next(e))}catch(e){u(e)}}function c(e){try{f(o.throw(e))}catch(e){u(e)}}function f(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}f((o=o.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const u=r(n(629)),i={},c={get:e=>i[e],set(e,t){i[e]=t}};t.default=function(e={}){const{enableCache:t,defaultCache:n=c}=e;return function(e){return r=>o(this,void 0,void 0,(function*(){const{enableCache:o=t,defaultCache:i=n,_url:c,encode:f,data:a}=r,s="GET"===r.method||r.isGet,d=typeof o;if(!("undefined"===d?s:"function"===d?o(r):Boolean(o)))return e(r);const l=i,p=(0,u.default)(c,a,f);try{const t=yield e(r);return l.set(p,t),t}catch(e){const t=l.get(p);if(t)return t.fromCache=!0,t.error=e,t;throw e}}))}}}},t={},n=function n(o){var r=t[o];if(void 0!==r)return r.exports;var u=t[o]={exports:{}};return e[o].call(u.exports,u,u.exports,n),u.exports}(431);return n.default})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xiorErrorCache=t():e.xiorErrorCache=t()}(this,(()=>(()=>{"use strict";var e={629:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){let o=t?n(t):"";o&&(o=e+(e.includes("?")?"&"+o:"?"+o));const[r,u]=o.split("?");return u?`${r}?${u.split("&").sort().join("&")}`:o||e}},431:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,u){function i(e){try{f(o.next(e))}catch(e){u(e)}}function c(e){try{f(o.throw(e))}catch(e){u(e)}}function f(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}f((o=o.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const u=r(n(629)),i={},c={get:e=>i[e],set(e,t){i[e]=t}};t.default=function(e={}){const{enableCache:t,defaultCache:n=c}=e;return function(e){return r=>o(this,void 0,void 0,(function*(){const{enableCache:o=t,defaultCache:i=n,_url:c,encode:f,data:a}=r,s="GET"===r.method||r.isGet,d=typeof o;if(!("undefined"===d?s:"function"===d?o(r):Boolean(o)))return e(r);const l=i,p=(0,u.default)(c,a,f);try{const t=yield e(r);return l.set(p,t),t}catch(e){const t=l.get(p);if(t)return t.fromCache=!0,t.error=e,t;throw e}}))}}}},t={},n=function n(o){var r=t[o];if(void 0!==r)return r.exports;var u=t[o]={exports:{}};return e[o].call(u.exports,u,u.exports,n),u.exports}(431);return n.default})()));

@@ -1,1 +0,1 @@

function t(t,e,n,r,i,o,u){try{var l=t[o](u),c=l.value}catch(t){n(t);return}l.done?e(c):Promise.resolve(c).then(r,i)}let e={},n={get:t=>e[t],set(t,n){e[t]=n}};function r(e={}){let{enableCache:r,defaultCache:i=n}=e;return function(e){var n;return n=function*(t){let{enableCache:n=r,defaultCache:o=i,_url:u,encode:l,data:c}=t,f="GET"===t.method||t.isGet,a=typeof n;if(!("undefined"===a?f:"function"===a?n(t):!!n))return e(t);let s=function(t,e,n){let r=e?n(e):"";r&&(r=t.includes("?")?t+"&"+r:t+"?"+r);let[i,o]=r.split("?");if(o){let t=o.split("&");return`${i}?${t.sort().join("&")}`}return r||t}(u,c,l);try{let n=yield e(t);return o.set(s,n),n}catch(e){let t=o.get(s);if(t)return t.fromCache=!0,t.error=e,t;throw e}},function(){var e=this,r=arguments;return new Promise(function(i,o){var u=n.apply(e,r);function l(e){t(u,i,o,l,c,"next",e)}function c(e){t(u,i,o,l,c,"throw",e)}l(void 0)})}}}export{r as default};
function t(t,e,n,r,i,o,u){try{var l=t[o](u),c=l.value}catch(t){n(t);return}l.done?e(c):Promise.resolve(c).then(r,i)}let e={},n={get:t=>e[t],set(t,n){e[t]=n}};function r(e={}){let{enableCache:r,defaultCache:i=n}=e;return function(e){var n;return n=function*(t){let{enableCache:n=r,defaultCache:o=i,_url:u,encode:l,data:c}=t,f="GET"===t.method||t.isGet,a=typeof n;if(!("undefined"===a?f:"function"===a?n(t):!!n))return e(t);let s=function(t,e,n){let r=e?n(e):"";r&&(r=t+(t.includes("?")?"&"+r:"?"+r));let[i,o]=r.split("?");if(o){let t=o.split("&");return`${i}?${t.sort().join("&")}`}return r||t}(u,c,l);try{let n=yield e(t);return o.set(s,n),n}catch(e){let t=o.get(s);if(t)return t.fromCache=!0,t.error=e,t;throw e}},function(){var e=this,r=arguments;return new Promise(function(i,o){var u=n.apply(e,r);function l(e){t(u,i,o,l,c,"next",e)}function c(e){t(u,i,o,l,c,"throw",e)}l(void 0)})}}}export{r as default};

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xiorErrorRetry=t():e.xiorErrorRetry=t()}(this,(()=>(()=>{"use strict";var e={699:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.anySignal=void 0,t.anySignal=function(e,t){const r=new globalThis.AbortController;function o(e){r.abort(e),i()}const n=[];for(const t of e){if(!0===(null==t?void 0:t.aborted)){o(t.reason);break}if(null!=(null==t?void 0:t.addEventListener)){const e=()=>{o(t.reason)};n.push((()=>{null!=(null==t?void 0:t.removeEventListener)&&t.removeEventListener("abort",e)})),t.addEventListener("abort",e)}}function i(){n.forEach((e=>{e()})),null==t||t()}const s=r.signal;return s.clear=i,s}},729:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const o=r(602);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return o.merge}})},629:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){let o=t?r(t):"";o&&(o=e.includes("?")?e+"&"+o:e+"?"+o);const[n,i]=o.split("?");return i?`${n}?${i.split("&").sort().join("&")}`:o||e}},351:function(e,t,r){var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function u(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=r(99),i=r(976);t.default=function(e={}){const{retryTimes:t,retryInterval:r,enableRetry:s}=e||{retryTimes:2,retryInterval:3e3};return function(e){return u=>o(this,void 0,void 0,(function*(){const{retryTimes:c=t,retryInterval:a=r,enableRetry:l=s}=u;let f=!1,d=0;return function t(){return o(this,void 0,void 0,(function*(){try{return yield e(u)}catch(e){if(e instanceof i.XiorError||e instanceof i.XiorTimeoutError){const r="GET"===u.method||u.isGet,o=typeof l,i="undefined"===o?r:"function"===o?l(u,e):Boolean(l);if(f=c===d,f||!i)throw e;return a&&a>0&&d>0&&(yield(0,n.delay)(a)),d++,t()}throw e}}))}()}))}}},99:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.delay=t.buildSortedURL=void 0;const n=o(r(629));t.buildSortedURL=n.default,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t("ok")}),e)}))}},976:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.XiorTimeoutError=t.XiorError=t.joinPath=t.isAbsoluteURL=t.encodeParams=void 0,n(r(699),t),n(r(729),t),n(r(99),t),t.encodeParams=function e(t,r=!0,o=null){if(null==t)return"";const n=[],i=r?encodeURIComponent:e=>e;for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const u=t[s],c=o?`${o}[${i(s)}]`:i(s);if("object"==typeof u){const t=e(u,r,c);""!==t&&n.push(t)}else Array.isArray(u)?u.forEach(((e,t)=>{const r=`${c}[${t}]`;n.push(`${i(r)}=${i(e)}`)})):n.push(`${i(c)}=${i(u)}`)}return n.join("&")},t.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},t.joinPath=function(e,t){return t?(e.endsWith("/")?e:e+"/")+(t.startsWith("/")?t.slice(1):t):e};class i extends Error{constructor(e,t,r){super(e),this.request=t,this.config=t,this.response=r}}t.XiorError=i,t.XiorTimeoutError=class extends i{}},602:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const r=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}return!1};t.merge=(...e)=>e.reduce(((e,o)=>{if(Array.isArray(o))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(o).forEach((n=>{["__proto__","constructor","prototype"].includes(n)||(Array.isArray(e[n])&&Array.isArray(o[n])?e[n]=t.merge.options.mergeArrays?t.merge.options.uniqueArrayItems?Array.from(new Set(e[n].concat(o[n]))):[...e[n],...o[n]]:o[n]:r(e[n])&&r(o[n])?e[n]=(0,t.merge)(e[n],o[n]):e[n]=void 0===o[n]?t.merge.options.allowUndefinedOverrides?o[n]:e[n]:o[n])})),e}),{});const o={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};t.merge.options=o,t.merge.withOptions=(e,...r)=>{t.merge.options=Object.assign(Object.assign({},o),e);const n=(0,t.merge)(...r);return t.merge.options=o,n}}},t={},r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}(351);return r.default})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xiorErrorRetry=t():e.xiorErrorRetry=t()}(this,(()=>(()=>{"use strict";var e={699:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.anySignal=void 0,t.anySignal=function(e,t){const r=new globalThis.AbortController;function o(e){r.abort(e),i()}const n=[];for(const t of e){if(!0===(null==t?void 0:t.aborted)){o(t.reason);break}if(null!=(null==t?void 0:t.addEventListener)){const e=()=>{o(t.reason)};n.push((()=>{null!=(null==t?void 0:t.removeEventListener)&&t.removeEventListener("abort",e)})),t.addEventListener("abort",e)}}function i(){n.forEach((e=>{e()})),null==t||t()}const s=r.signal;return s.clear=i,s}},729:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const o=r(602);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return o.merge}})},629:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){let o=t?r(t):"";o&&(o=e+(e.includes("?")?"&"+o:"?"+o));const[n,i]=o.split("?");return i?`${n}?${i.split("&").sort().join("&")}`:o||e}},351:function(e,t,r){var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function u(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=r(99),i=r(976);t.default=function(e={}){const{retryTimes:t,retryInterval:r,enableRetry:s,onRetry:u}=e||{retryTimes:2,retryInterval:3e3};return function(e){return c=>o(this,void 0,void 0,(function*(){const{retryTimes:a=t,retryInterval:l=r,enableRetry:f=s,onRetry:d=u}=c;let p=!1,y=0;return function t(){return o(this,void 0,void 0,(function*(){try{return yield e(c)}catch(e){if(e instanceof i.XiorError||e instanceof i.XiorTimeoutError||e instanceof TypeError){const r="GET"===c.method||c.isGet,o=typeof f,i="undefined"===o?r:"function"===o?f(c,e):Boolean(f);if(p=a===y,p||!i)throw e;const s="function"==typeof l?l(y):l;return s&&s>0&&y>0&&(yield(0,n.delay)(s)),y++,d&&d(c,e,y),t()}throw e}}))}()}))}}},99:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.delay=t.buildSortedURL=void 0;const n=o(r(629));t.buildSortedURL=n.default,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t("ok")}),e)}))}},976:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.XiorTimeoutError=t.XiorError=t.joinPath=t.isAbsoluteURL=t.encodeParams=void 0,n(r(699),t),n(r(729),t),n(r(99),t),t.encodeParams=function e(t,r=!0,o=null){if(null==t)return"";const n=[],i=r?encodeURIComponent:e=>e;for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const u=t[s],c=o?`${o}[${i(s)}]`:i(s);if("object"==typeof u){const t=e(u,r,c);""!==t&&n.push(t)}else Array.isArray(u)?u.forEach(((e,t)=>{const r=`${c}[${t}]`;n.push(`${i(r)}=${i(e)}`)})):n.push(`${i(c)}=${i(u)}`)}return n.join("&")},t.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},t.joinPath=function(e,t){return t?(e.endsWith("/")?e:e+"/")+(t.startsWith("/")?t.slice(1):t):e};class i extends Error{constructor(e,t,r){super(e),this.request=t,this.config=t,this.response=r}}t.XiorError=i,t.XiorTimeoutError=class extends i{}},602:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const r=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}return!1};t.merge=(...e)=>e.reduce(((e,o)=>{if(Array.isArray(o))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(o).forEach((n=>{["__proto__","constructor","prototype"].includes(n)||(Array.isArray(e[n])&&Array.isArray(o[n])?e[n]=t.merge.options.mergeArrays?t.merge.options.uniqueArrayItems?Array.from(new Set(e[n].concat(o[n]))):[...e[n],...o[n]]:o[n]:r(e[n])&&r(o[n])?e[n]=(0,t.merge)(e[n],o[n]):e[n]=void 0===o[n]?t.merge.options.allowUndefinedOverrides?o[n]:e[n]:o[n])})),e}),{});const o={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};t.merge.options=o,t.merge.withOptions=(e,...r)=>{t.merge.options=Object.assign(Object.assign({},o),e);const n=(0,t.merge)(...r);return t.merge.options=o,n}}},t={},r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}(351);return r.default})()));

@@ -62,3 +62,3 @@ interface XiorRequestConfig<T = any> extends Omit<RequestInit, 'body'> {

*/
retryInterval?: number;
retryInterval?: number | ((count: number) => number);
/**

@@ -69,2 +69,3 @@ * default: true,

enableRetry?: boolean | ((config: XiorRequestConfig, error: XiorError) => boolean);
onRetry?: (config: XiorRequestConfig, error: XiorError, count: number) => void;
};

@@ -71,0 +72,0 @@ /** @ts-ignore */

@@ -62,3 +62,3 @@ interface XiorRequestConfig<T = any> extends Omit<RequestInit, 'body'> {

*/
retryInterval?: number;
retryInterval?: number | ((count: number) => number);
/**

@@ -69,2 +69,3 @@ * default: true,

enableRetry?: boolean | ((config: XiorRequestConfig, error: XiorError) => boolean);
onRetry?: (config: XiorRequestConfig, error: XiorError, count: number) => void;
};

@@ -71,0 +72,0 @@ /** @ts-ignore */

@@ -1,1 +0,1 @@

import"ts-deepmerge";class t extends Error{constructor(t,e,r){super(t),this.request=e,this.config=e,this.response=r}}class e extends t{}function r(t,e,r,n,i,o,u){try{var s=t[o](u),c=s.value}catch(t){r(t);return}s.done?e(c):Promise.resolve(c).then(n,i)}function n(t){return function(){var e=this,n=arguments;return new Promise(function(i,o){var u=t.apply(e,n);function s(t){r(u,i,o,s,c,"next",t)}function c(t){r(u,i,o,s,c,"throw",t)}s(void 0)})}}function i(r={}){let{retryTimes:i,retryInterval:o,enableRetry:u}=r||{retryTimes:2,retryInterval:3e3};return function(r){return n(function*(s){let{retryTimes:c=i,retryInterval:f=o,enableRetry:a=u}=s,l=0;function y(){return h.apply(this,arguments)}function h(){return(h=n(function*(){try{return yield r(s)}catch(r){if(r instanceof t||r instanceof e){let t="GET"===s.method||s.isGet,e=typeof a,n="undefined"===e?t:"function"===e?a(s,r):!!a;if(c===l||!n)throw r;return f&&f>0&&l>0&&(yield new Promise(t=>{setTimeout(()=>{t("ok")},f)})),l++,y()}throw r}})).apply(this,arguments)}return y()})}}export{i as default};
import"ts-deepmerge";class t extends Error{constructor(t,e,r){super(t),this.request=e,this.config=e,this.response=r}}class e extends t{}function r(t,e,r,n,o,i,u){try{var s=t[i](u),c=s.value}catch(t){r(t);return}s.done?e(c):Promise.resolve(c).then(n,o)}function n(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var u=t.apply(e,n);function s(t){r(u,o,i,s,c,"next",t)}function c(t){r(u,o,i,s,c,"throw",t)}s(void 0)})}}function o(r={}){let{retryTimes:o,retryInterval:i,enableRetry:u,onRetry:s}=r||{retryTimes:2,retryInterval:3e3};return function(r){return n(function*(c){let{retryTimes:f=o,retryInterval:a=i,enableRetry:l=u,onRetry:y=s}=c,p=0;function h(){return d.apply(this,arguments)}function d(){return(d=n(function*(){try{return yield r(c)}catch(r){if(r instanceof t||r instanceof e||r instanceof TypeError){let t="GET"===c.method||c.isGet,e=typeof l,n="undefined"===e?t:"function"===e?l(c,r):!!l;if(f===p||!n)throw r;let o="function"==typeof a?a(p):a;return o&&o>0&&p>0&&(yield new Promise(t=>{setTimeout(()=>{t("ok")},o)})),p++,y&&y(c,r,p),h()}throw r}})).apply(this,arguments)}return h()})}}export{o as default};

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xiorMock=t():e.xiorMock=t()}(this,(()=>(()=>{"use strict";var e={699:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.anySignal=void 0,t.anySignal=function(e,t){const r=new globalThis.AbortController;function n(e){r.abort(e),i()}const o=[];for(const t of e){if(!0===(null==t?void 0:t.aborted)){n(t.reason);break}if(null!=(null==t?void 0:t.addEventListener)){const e=()=>{n(t.reason)};o.push((()=>{null!=(null==t?void 0:t.removeEventListener)&&t.removeEventListener("abort",e)})),t.addEventListener("abort",e)}}function i(){o.forEach((e=>{e()})),null==t||t()}const s=r.signal;return s.clear=i,s}},729:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const n=r(602);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return n.merge}})},629:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){let n=t?r(t):"";n&&(n=e.includes("?")?e+"&"+n:e+"?"+n);const[o,i]=n.split("?");return i?`${o}?${i.split("&").sort().join("&")}`:n||e}},437:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.MockError=void 0;const o=r(732),i=r(976),s="undefined"!=typeof AbortController;class a extends Error{constructor(e,t){super(e),this.request=t,this.config=t}}function u(e){const t=e.filter((e=>{const[,t]=e;return"function"==typeof(null==t?void 0:t.asymmetricMatch)})),r=t.filter((e=>{const[t,r]=e;return r.asymmetricMatch(t)}));return r.length>0&&r.length===t.length}function d(e){e||(e={});const t={},r="undefined"==typeof Headers?{append(e,r){t[e]=r+""},get:e=>t[e]||null}:new Headers;return Object.keys(e).forEach((t=>{r.append(t,e[t])})),r}function l(e,t){if(e.status>=300)throw new i.XiorError(`Request failed with status code ${e.status}`,t,e);return e}t.MockError=a,t.default=class{constructor(e,t){this.handlers={},this.history={},this.options=t,this.instance=e,this.plugin=this._mockPlugin.bind(this),e.plugins.use(this.plugin)}_mockPlugin(e){return t=>n(this,void 0,void 0,(function*(){var r,n,o,u,c;const h=(null===(r=t.method)||void 0===r?void 0:r.toLowerCase())||"get";this.history[h]||(this.history[h]=[]),this.handlers[h]||(this.handlers[h]=[]),null===(n=this.history[h])||void 0===n||n.push(t);const f=this.findHandler(t);if(f){const r=f[6]||(null===(o=this.options)||void 0===o?void 0:o.delayResponse);6===f.length&&Object.keys(this.handlers).forEach((e=>{var t,r;let n=null===(t=this.handlers[e])||void 0===t?void 0:t.indexOf(f);n=void 0===n?-1:n,n>-1&&(null===(r=this.handlers[e])||void 0===r||r.splice(n,1))}));const n=[];let a;if(2!==f.length){let e,r;if(t.timeout&&s){const e=new AbortController;r=setTimeout((()=>{e.abort(new i.XiorTimeoutError(`timeout of ${t.timeout}ms exceeded`,t))}),t.timeout),n.push(e.signal)}t.signal&&n.push(t.signal),e=n[0],n.length>1&&(e=(0,i.anySignal)(n,(()=>{r&&clearTimeout(r)}))),a=()=>{var t;r&&clearTimeout(r),null===(t=null==e?void 0:e.clear)||void 0===t||t.call(e)}}r&&r>0&&(yield(0,i.delay)(r));const u=n.find((e=>e.aborted));if(u)return null==a||a(),Promise.reject(u.reason);if(2===f.length)return e(t);if("function"!=typeof f[2]){const e=f.slice(2),r=l({data:e[1],status:e[0],statusText:"ok",headers:e[2],request:t,config:t},t);return null==a||a(),r}const c=f[2](t);if("function"!=typeof(null==c?void 0:c.then)){const e=l({data:c[1],status:c[0],statusText:"ok",headers:d(c[2]),request:t,config:t},t);return null==a||a(),e}{const e=yield c;return null==a||a(),e.config&&e.status?e:l({data:e[1],status:e[0],statusText:"ok",headers:d(e[2]),request:t,config:t},t)}}if("passthrough"===(null===(u=this.options)||void 0===u?void 0:u.onNoMatch))return e(t);if("throwException"===(null===(c=this.options)||void 0===c?void 0:c.onNoMatch)){const e="Could not find mock for: \n"+JSON.stringify(t,["method","url"],2);throw new a(e,t)}{const e="Request failed with status code 404";throw new i.XiorError(e,t,{status:404,statusText:e,config:t})}}))}resetHandlers(){this.handlers={}}resetHistory(){this.history={}}reset(){this.resetHandlers(),this.resetHistory()}restore(){var e;this.reset(),null===(e=this.instance)||void 0===e||e.plugins.eject(this.plugin)}onGet(e,t){return this.createHandler("get")(e,t)}onDelete(e,t){return this.createHandler("delete")(e,t)}onHead(e,t){return this.createHandler("head")(e,t)}onAny(e,t){return this.createHandler("any")(e,t)}onPost(e,t,r){return this.createHandler("post")(e,(0,i.merge)({},r||{},{data:t||{}}))}onPut(e,t,r){return this.createHandler("put")(e,(0,i.merge)({},r||{},{data:t||{}}))}onPatch(e,t,r){return this.createHandler("patch")(e,(0,i.merge)({},r||{},{data:t||{}}))}onOptions(e,t){return this.createHandler("options")(e,t)}createHandler(e){const t=this;return(r,n)=>{var o,s,a,u,d,l;function c(o,i,s){const a=[r,n,o,i,s];return t.addHandler(e,a),t}function h(o,i,s){const a=[r,n,o,i,s,!0];return t.addHandler(e,a),t}return n=n?(0,i.merge)({},{headers:null===(s=null===(o=t.instance)||void 0===o?void 0:o.config)||void 0===s?void 0:s.headers,params:null===(u=null===(a=t.instance)||void 0===a?void 0:a.config)||void 0===u?void 0:u.params,data:null===(l=null===(d=t.instance)||void 0===d?void 0:d.config)||void 0===l?void 0:l.data},n||{}):{},r=void 0===r?/.*/:r,{reply:c,replyOnce:h,withDelayInMs:function(o){return function(i,s,a){return function(o,i,s,a){const u=[r,n,i,s,a,!1,o];return t.addHandler(e,u),t}(o,i,s,a)}},passThrough:()=>{const o=[r,n];return t.addHandler(e,o),t},abortRequest:()=>c((e=>Promise.reject(new i.XiorError("Request aborted",e)))),abortRequestOnce:()=>h((e=>Promise.reject(new i.XiorError("Request aborted",e,{})))),networkError:()=>c((e=>Promise.reject(new i.XiorError("Network Error",e,{})))),networkErrorOnce:()=>h((e=>Promise.reject(new i.XiorError("Network Error",e,{})))),timeout:()=>c((e=>Promise.reject(new i.XiorTimeoutError("timeout of 0ms exceeded",e)))),timeoutOnce:()=>h((e=>Promise.reject(new i.XiorTimeoutError("timeout of 0ms exceeded",e))))}}}addHandler(e,t){var r,n,s;const a=[...t];if(a[3])try{a[3]=JSON.parse(JSON.stringify(a[3]))}catch(e){}if(a[4]){const e="undefined"==typeof Headers?(()=>{const e={};return{append(t,r){e[t]=r+""},get:t=>e[t]||null}})():new Headers;Object.keys(a[4]).forEach((t=>{e.append(t,a[4][t])})),a[4]=e}if("any"===e)o.VERBS.forEach((e=>{var t;this.handlers[e]||(this.handlers[e]=[]),null===(t=this.handlers[e])||void 0===t||t.push(a)}));else{this.handlers[e]||(this.handlers[e]=[]);let t=null===(r=this.handlers[e])||void 0===r?void 0:r.findIndex((e=>6!==e.length&&(0,i.buildSortedURL)(String(e[0]),e[1],i.encodeParams)===(0,i.buildSortedURL)(String(a[0]),a[1],i.encodeParams)));t=void 0===t?-1:t,t>-1&&a.length<6?null===(n=this.handlers[e])||void 0===n||n.splice(t,1,a):null===(s=this.handlers[e])||void 0===s||s.push(a)}}findHandler(e){var t;const{method:r,url:n,_url:o,headers:s,params:a,data:d={},baseURL:l}=e,c=null==r?void 0:r.toLowerCase();return null===(t=this.handlers[c])||void 0===t?void 0:t.find((t=>{var r;const h=Object.assign({},t[1].headers||{});if((null===(r=e.headers)||void 0===r?void 0:r["Content-Type"])&&(Object.keys(h).find((e=>"content-type"===e.toLowerCase()))||(h["Content-Type"]=e.headers["Content-Type"])),"string"==typeof t[0]){const e=l&&t[0].startsWith(l),r=(0,i.buildSortedURL)(e?(0,i.joinPath)(l,n):(0,i.joinPath)("/",n),{b:a,c:d,a:s},i.encodeParams),o=(0,i.buildSortedURL)(e?t[0]:(0,i.joinPath)("/",t[0]),{b:t[1].params||{},c:t[1].data||{},a:h},i.encodeParams);return r===o||r.startsWith(o)||u([[a,t[1].params],[d,t[1].data],[s,h]])}if(t[0]instanceof RegExp)return(t[0].test(n)||t[0].test((0,i.joinPath)(l||"",n))||t[0].test(o))&&((0,i.buildSortedURL)(c,{b:a,c:d,a:s},i.encodeParams)===(0,i.buildSortedURL)(c,{b:t[1].params||{},c:t[1].data||{},a:h},i.encodeParams)||u([[a,t[1].params],[d,t[1].data],[s,h]]))}))}}},732:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VERBS=void 0,t.VERBS=["get","post","head","delete","patch","put","options"]},99:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.delay=t.buildSortedURL=void 0;const o=n(r(629));t.buildSortedURL=o.default,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t("ok")}),e)}))}},976:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.XiorTimeoutError=t.XiorError=t.joinPath=t.isAbsoluteURL=t.encodeParams=void 0,o(r(699),t),o(r(729),t),o(r(99),t),t.encodeParams=function e(t,r=!0,n=null){if(null==t)return"";const o=[],i=r?encodeURIComponent:e=>e;for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const a=t[s],u=n?`${n}[${i(s)}]`:i(s);if("object"==typeof a){const t=e(a,r,u);""!==t&&o.push(t)}else Array.isArray(a)?a.forEach(((e,t)=>{const r=`${u}[${t}]`;o.push(`${i(r)}=${i(e)}`)})):o.push(`${i(u)}=${i(a)}`)}return o.join("&")},t.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},t.joinPath=function(e,t){return t?(e.endsWith("/")?e:e+"/")+(t.startsWith("/")?t.slice(1):t):e};class i extends Error{constructor(e,t,r){super(e),this.request=t,this.config=t,this.response=r}}t.XiorError=i,t.XiorTimeoutError=class extends i{}},602:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const r=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}return!1};t.merge=(...e)=>e.reduce(((e,n)=>{if(Array.isArray(n))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(n).forEach((o=>{["__proto__","constructor","prototype"].includes(o)||(Array.isArray(e[o])&&Array.isArray(n[o])?e[o]=t.merge.options.mergeArrays?t.merge.options.uniqueArrayItems?Array.from(new Set(e[o].concat(n[o]))):[...e[o],...n[o]]:n[o]:r(e[o])&&r(n[o])?e[o]=(0,t.merge)(e[o],n[o]):e[o]=void 0===n[o]?t.merge.options.allowUndefinedOverrides?n[o]:e[o]:n[o])})),e}),{});const n={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};t.merge.options=n,t.merge.withOptions=(e,...r)=>{t.merge.options=Object.assign(Object.assign({},n),e);const o=(0,t.merge)(...r);return t.merge.options=n,o}}},t={},r=function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}(437);return r.default})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xiorMock=t():e.xiorMock=t()}(this,(()=>(()=>{"use strict";var e={699:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.anySignal=void 0,t.anySignal=function(e,t){const r=new globalThis.AbortController;function n(e){r.abort(e),i()}const o=[];for(const t of e){if(!0===(null==t?void 0:t.aborted)){n(t.reason);break}if(null!=(null==t?void 0:t.addEventListener)){const e=()=>{n(t.reason)};o.push((()=>{null!=(null==t?void 0:t.removeEventListener)&&t.removeEventListener("abort",e)})),t.addEventListener("abort",e)}}function i(){o.forEach((e=>{e()})),null==t||t()}const s=r.signal;return s.clear=i,s}},729:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const n=r(602);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return n.merge}})},629:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){let n=t?r(t):"";n&&(n=e+(e.includes("?")?"&"+n:"?"+n));const[o,i]=n.split("?");return i?`${o}?${i.split("&").sort().join("&")}`:n||e}},437:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.MockError=void 0;const o=r(732),i=r(976),s="undefined"!=typeof AbortController;class a extends Error{constructor(e,t){super(e),this.request=t,this.config=t}}function u(e){const t=e.filter((e=>{const[,t]=e;return"function"==typeof(null==t?void 0:t.asymmetricMatch)})),r=t.filter((e=>{const[t,r]=e;return r.asymmetricMatch(t)}));return r.length>0&&r.length===t.length}function d(e){e||(e={});const t={},r="undefined"==typeof Headers?{append(e,r){t[e]=r+""},get:e=>t[e]||null}:new Headers;return Object.keys(e).forEach((t=>{r.append(t,e[t])})),r}function l(e,t){if(e.status>=300)throw new i.XiorError(`Request failed with status code ${e.status}`,t,e);return e}t.MockError=a,t.default=class{constructor(e,t){this.handlers={},this.history={},this.options=t,this.instance=e,this.plugin=this._mockPlugin.bind(this),e.plugins.use(this.plugin)}_mockPlugin(e){return t=>n(this,void 0,void 0,(function*(){var r,n,o,u,c;const h=(null===(r=t.method)||void 0===r?void 0:r.toLowerCase())||"get";this.history[h]||(this.history[h]=[]),this.handlers[h]||(this.handlers[h]=[]),null===(n=this.history[h])||void 0===n||n.push(t);const f=this.findHandler(t);if(f){const r=f[6]||(null===(o=this.options)||void 0===o?void 0:o.delayResponse);6===f.length&&Object.keys(this.handlers).forEach((e=>{var t,r;let n=null===(t=this.handlers[e])||void 0===t?void 0:t.indexOf(f);n=void 0===n?-1:n,n>-1&&(null===(r=this.handlers[e])||void 0===r||r.splice(n,1))}));const n=[];let a;if(2!==f.length){let e,r;if(t.timeout&&s){const e=new AbortController;r=setTimeout((()=>{e.abort(new i.XiorTimeoutError(`timeout of ${t.timeout}ms exceeded`,t))}),t.timeout),n.push(e.signal)}t.signal&&n.push(t.signal),e=n[0],n.length>1&&(e=(0,i.anySignal)(n,(()=>{r&&clearTimeout(r)}))),a=()=>{var t;r&&clearTimeout(r),null===(t=null==e?void 0:e.clear)||void 0===t||t.call(e)}}r&&r>0&&(yield(0,i.delay)(r));const u=n.find((e=>e.aborted));if(u)return null==a||a(),Promise.reject(u.reason);if(2===f.length)return e(t);if("function"!=typeof f[2]){const e=f.slice(2),r=l({data:e[1],status:e[0],statusText:"ok",headers:e[2],request:t,config:t},t);return null==a||a(),r}const c=f[2](t);if("function"!=typeof(null==c?void 0:c.then)){const e=l({data:c[1],status:c[0],statusText:"ok",headers:d(c[2]),request:t,config:t},t);return null==a||a(),e}{const e=yield c;return null==a||a(),e.config&&e.status?e:l({data:e[1],status:e[0],statusText:"ok",headers:d(e[2]),request:t,config:t},t)}}if("passthrough"===(null===(u=this.options)||void 0===u?void 0:u.onNoMatch))return e(t);if("throwException"===(null===(c=this.options)||void 0===c?void 0:c.onNoMatch)){const e="Could not find mock for: \n"+JSON.stringify(t,["method","url"],2);throw new a(e,t)}{const e="Request failed with status code 404";throw new i.XiorError(e,t,{status:404,statusText:e,config:t})}}))}resetHandlers(){this.handlers={}}resetHistory(){this.history={}}reset(){this.resetHandlers(),this.resetHistory()}restore(){var e;this.reset(),null===(e=this.instance)||void 0===e||e.plugins.eject(this.plugin)}onGet(e,t){return this.createHandler("get")(e,t)}onDelete(e,t){return this.createHandler("delete")(e,t)}onHead(e,t){return this.createHandler("head")(e,t)}onAny(e,t){return this.createHandler("any")(e,t)}onPost(e,t,r){return this.createHandler("post")(e,(0,i.merge)({},r||{},{data:t||{}}))}onPut(e,t,r){return this.createHandler("put")(e,(0,i.merge)({},r||{},{data:t||{}}))}onPatch(e,t,r){return this.createHandler("patch")(e,(0,i.merge)({},r||{},{data:t||{}}))}onOptions(e,t){return this.createHandler("options")(e,t)}createHandler(e){const t=this;return(r,n)=>{var o,s,a,u,d,l;function c(o,i,s){const a=[r,n,o,i,s];return t.addHandler(e,a),t}function h(o,i,s){const a=[r,n,o,i,s,!0];return t.addHandler(e,a),t}return n=n?(0,i.merge)({},{headers:null===(s=null===(o=t.instance)||void 0===o?void 0:o.config)||void 0===s?void 0:s.headers,params:null===(u=null===(a=t.instance)||void 0===a?void 0:a.config)||void 0===u?void 0:u.params,data:null===(l=null===(d=t.instance)||void 0===d?void 0:d.config)||void 0===l?void 0:l.data},n||{}):{},r=void 0===r?/.*/:r,{reply:c,replyOnce:h,withDelayInMs:function(o){return function(i,s,a){return function(o,i,s,a){const u=[r,n,i,s,a,!1,o];return t.addHandler(e,u),t}(o,i,s,a)}},passThrough:()=>{const o=[r,n];return t.addHandler(e,o),t},abortRequest:()=>c((e=>Promise.reject(new i.XiorError("Request aborted",e)))),abortRequestOnce:()=>h((e=>Promise.reject(new i.XiorError("Request aborted",e,{})))),networkError:()=>c((e=>Promise.reject(new i.XiorError("Network Error",e,{})))),networkErrorOnce:()=>h((e=>Promise.reject(new i.XiorError("Network Error",e,{})))),timeout:()=>c((e=>Promise.reject(new i.XiorTimeoutError("timeout of 0ms exceeded",e)))),timeoutOnce:()=>h((e=>Promise.reject(new i.XiorTimeoutError("timeout of 0ms exceeded",e))))}}}addHandler(e,t){var r,n,s;const a=[...t];if(a[3])try{a[3]=JSON.parse(JSON.stringify(a[3]))}catch(e){}if(a[4]){const e="undefined"==typeof Headers?(()=>{const e={};return{append(t,r){e[t]=r+""},get:t=>e[t]||null}})():new Headers;Object.keys(a[4]).forEach((t=>{e.append(t,a[4][t])})),a[4]=e}if("any"===e)o.VERBS.forEach((e=>{var t;this.handlers[e]||(this.handlers[e]=[]),null===(t=this.handlers[e])||void 0===t||t.push(a)}));else{this.handlers[e]||(this.handlers[e]=[]);let t=null===(r=this.handlers[e])||void 0===r?void 0:r.findIndex((e=>6!==e.length&&(0,i.buildSortedURL)(String(e[0]),e[1],i.encodeParams)===(0,i.buildSortedURL)(String(a[0]),a[1],i.encodeParams)));t=void 0===t?-1:t,t>-1&&a.length<6?null===(n=this.handlers[e])||void 0===n||n.splice(t,1,a):null===(s=this.handlers[e])||void 0===s||s.push(a)}}findHandler(e){var t;const{method:r,url:n,_url:o,headers:s,params:a,data:d={},baseURL:l}=e,c=null==r?void 0:r.toLowerCase();return null===(t=this.handlers[c])||void 0===t?void 0:t.find((t=>{var r;const h=Object.assign({},t[1].headers||{});if((null===(r=e.headers)||void 0===r?void 0:r["Content-Type"])&&(Object.keys(h).find((e=>"content-type"===e.toLowerCase()))||(h["Content-Type"]=e.headers["Content-Type"])),"string"==typeof t[0]){const e=l&&t[0].startsWith(l),r=(0,i.buildSortedURL)(e?(0,i.joinPath)(l,n):(0,i.joinPath)("/",n),{b:a,c:d,a:s},i.encodeParams),o=(0,i.buildSortedURL)(e?t[0]:(0,i.joinPath)("/",t[0]),{b:t[1].params||{},c:t[1].data||{},a:h},i.encodeParams);return r===o||r.startsWith(o)||u([[a,t[1].params],[d,t[1].data],[s,h]])}if(t[0]instanceof RegExp)return(t[0].test(n)||t[0].test((0,i.joinPath)(l||"",n))||t[0].test(o))&&((0,i.buildSortedURL)(c,{b:a,c:d,a:s},i.encodeParams)===(0,i.buildSortedURL)(c,{b:t[1].params||{},c:t[1].data||{},a:h},i.encodeParams)||u([[a,t[1].params],[d,t[1].data],[s,h]]))}))}}},732:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VERBS=void 0,t.VERBS=["get","post","head","delete","patch","put","options"]},99:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.delay=t.buildSortedURL=void 0;const o=n(r(629));t.buildSortedURL=o.default,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t("ok")}),e)}))}},976:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.XiorTimeoutError=t.XiorError=t.joinPath=t.isAbsoluteURL=t.encodeParams=void 0,o(r(699),t),o(r(729),t),o(r(99),t),t.encodeParams=function e(t,r=!0,n=null){if(null==t)return"";const o=[],i=r?encodeURIComponent:e=>e;for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const a=t[s],u=n?`${n}[${i(s)}]`:i(s);if("object"==typeof a){const t=e(a,r,u);""!==t&&o.push(t)}else Array.isArray(a)?a.forEach(((e,t)=>{const r=`${u}[${t}]`;o.push(`${i(r)}=${i(e)}`)})):o.push(`${i(u)}=${i(a)}`)}return o.join("&")},t.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},t.joinPath=function(e,t){return t?(e.endsWith("/")?e:e+"/")+(t.startsWith("/")?t.slice(1):t):e};class i extends Error{constructor(e,t,r){super(e),this.request=t,this.config=t,this.response=r}}t.XiorError=i,t.XiorTimeoutError=class extends i{}},602:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const r=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}return!1};t.merge=(...e)=>e.reduce(((e,n)=>{if(Array.isArray(n))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(n).forEach((o=>{["__proto__","constructor","prototype"].includes(o)||(Array.isArray(e[o])&&Array.isArray(n[o])?e[o]=t.merge.options.mergeArrays?t.merge.options.uniqueArrayItems?Array.from(new Set(e[o].concat(n[o]))):[...e[o],...n[o]]:n[o]:r(e[o])&&r(n[o])?e[o]=(0,t.merge)(e[o],n[o]):e[o]=void 0===n[o]?t.merge.options.allowUndefinedOverrides?n[o]:e[o]:n[o])})),e}),{});const n={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};t.merge.options=n,t.merge.withOptions=(e,...r)=>{t.merge.options=Object.assign(Object.assign({},n),e);const o=(0,t.merge)(...r);return t.merge.options=n,o}}},t={},r=function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}(437);return r.default})()));

@@ -1,1 +0,1 @@

import{merge as e}from"ts-deepmerge";let t=["get","post","head","delete","patch","put","options"];function n(e,t,n){let r=t?n(t):"";r&&(r=e.includes("?")?e+"&"+r:e+"?"+r);let[s,o]=r.split("?");if(o){let e=o.split("&");return`${s}?${e.sort().join("&")}`}return r||e}function r(e,t=!0,n=null){if(null==e)return"";let s=[],o=t?encodeURIComponent:e=>e;for(let l in e)if(Object.prototype.hasOwnProperty.call(e,l)){let i=e[l],a=n?`${n}[${o(l)}]`:o(l);if("object"==typeof i){let e=r(i,t,a);""!==e&&s.push(e)}else Array.isArray(i)?i.forEach((e,t)=>{let n=`${a}[${t}]`;s.push(`${o(n)}=${o(e)}`)}):s.push(`${o(a)}=${o(i)}`)}return s.join("&")}function s(e,t){return t?(e.endsWith("/")?e:e+"/")+(t.startsWith("/")?t.slice(1):t):e}class o extends Error{constructor(e,t,n){super(e),this.request=t,this.config=t,this.response=n}}class l extends o{}function i(e,t,n,r,s,o,l){try{var i=e[o](l),a=i.value}catch(e){n(e);return}i.done?t(a):Promise.resolve(a).then(r,s)}function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let u="undefined"!=typeof AbortController;class d extends Error{constructor(e,t){super(e),this.request=t,this.config=t}}class h{_mockPlugin(e){var t,n=this;return t=function*(t){var r,s,i,a,h;let c=(null==(r=t.method)?void 0:r.toLowerCase())||"get";n.history[c]||(n.history[c]=[]),n.handlers[c]||(n.handlers[c]=[]),null==(s=n.history[c])||s.push(t);let v=n.findHandler(t);if(v){let r;let s=v[6]||(null==(i=n.options)?void 0:i.delayResponse);6===v.length&&Object.keys(n.handlers).forEach(e=>{var t,r;let s=null==(t=n.handlers[e])?void 0:t.indexOf(v);(s=void 0===s?-1:s)>-1&&(null==(r=n.handlers[e])||r.splice(s,1))});let o=[];if(2!==v.length){let e,n;if(t.timeout&&u){let e=new AbortController;n=setTimeout(()=>{e.abort(new l(`timeout of ${t.timeout}ms exceeded`,t))},t.timeout),o.push(e.signal)}t.signal&&o.push(t.signal),e=o[0],o.length>1&&(e=function(e,t){let n=new globalThis.AbortController;function r(e){n.abort(e),o()}let s=[];for(let t of e){if((null==t?void 0:t.aborted)===!0){r(t.reason);break}if((null==t?void 0:t.addEventListener)!=null){let e=()=>{r(t.reason)};s.push(()=>{(null==t?void 0:t.removeEventListener)!=null&&t.removeEventListener("abort",e)}),t.addEventListener("abort",e)}}function o(){s.forEach(e=>{e()}),null==t||t()}let l=n.signal;return l.clear=o,l}(o,()=>{n&&clearTimeout(n)})),r=()=>{var t;n&&clearTimeout(n),null==e||null==(t=e.clear)||t.call(e)}}s&&s>0&&(yield new Promise(e=>{setTimeout(()=>{e("ok")},s)}));let a=o.find(e=>e.aborted);if(a)return null==r||r(),Promise.reject(a.reason);if(2===v.length)return e(t);if("function"!=typeof v[2]){let e=v.slice(2),n=p({data:e[1],status:e[0],statusText:"ok",headers:e[2],request:t,config:t},t);return null==r||r(),n}let d=v[2](t);if("function"!=typeof(null==d?void 0:d.then)){let e=p({data:d[1],status:d[0],statusText:"ok",headers:f(d[2]),request:t,config:t},t);return null==r||r(),e}{let e=yield d;return(null==r||r(),e.config&&e.status)?e:p({data:e[1],status:e[0],statusText:"ok",headers:f(e[2]),request:t,config:t},t)}}if((null==(a=n.options)?void 0:a.onNoMatch)==="passthrough")return e(t);if((null==(h=n.options)?void 0:h.onNoMatch)==="throwException")throw new d("Could not find mock for: \n"+JSON.stringify(t,["method","url"],2),t);{let e="Request failed with status code 404";throw new o(e,t,{status:404,statusText:e,config:t})}},function(){var e=this,n=arguments;return new Promise(function(r,s){var o=t.apply(e,n);function l(e){i(o,r,s,l,a,"next",e)}function a(e){i(o,r,s,l,a,"throw",e)}l(void 0)})}}resetHandlers(){this.handlers={}}resetHistory(){this.history={}}reset(){this.resetHandlers(),this.resetHistory()}restore(){var e;this.reset(),null==(e=this.instance)||e.plugins.eject(this.plugin)}onGet(e,t){return this.createHandler("get")(e,t)}onDelete(e,t){return this.createHandler("delete")(e,t)}onHead(e,t){return this.createHandler("head")(e,t)}onAny(e,t){return this.createHandler("any")(e,t)}onPost(t,n,r){return this.createHandler("post")(t,e({},r||{},{data:n||{}}))}onPut(t,n,r){return this.createHandler("put")(t,e({},r||{},{data:n||{}}))}onPatch(t,n,r){return this.createHandler("patch")(t,e({},r||{},{data:n||{}}))}onOptions(e,t){return this.createHandler("options")(e,t)}createHandler(t){let n=this;return(r,s)=>{var i,a,u,d,h,c;function f(e,o,l){let i=[r,s,e,o,l];return n.addHandler(t,i),n}function p(e,o,l){let i=[r,s,e,o,l,!0];return n.addHandler(t,i),n}return s=s?e({},{headers:null==(a=n.instance)?void 0:null==(i=a.config)?void 0:i.headers,params:null==(d=n.instance)?void 0:null==(u=d.config)?void 0:u.params,data:null==(c=n.instance)?void 0:null==(h=c.config)?void 0:h.data},s||{}):{},r=void 0===r?/.*/:r,{reply:f,replyOnce:p,withDelayInMs:function(e){return function(o,l,i){return function(e,o,l,i){let a=[r,s,o,l,i,!1,e];return n.addHandler(t,a),n}(e,o,l,i)}},passThrough:()=>{let e=[r,s];return n.addHandler(t,e),n},abortRequest:()=>f(e=>Promise.reject(new o("Request aborted",e))),abortRequestOnce:()=>p(e=>Promise.reject(new o("Request aborted",e,{}))),networkError:()=>f(e=>Promise.reject(new o("Network Error",e,{}))),networkErrorOnce:()=>p(e=>Promise.reject(new o("Network Error",e,{}))),timeout:()=>f(e=>Promise.reject(new l("timeout of 0ms exceeded",e))),timeoutOnce:()=>p(e=>Promise.reject(new l("timeout of 0ms exceeded",e)))}}}addHandler(e,s){let o=[...s];if(o[3])try{o[3]=JSON.parse(JSON.stringify(o[3]))}catch(e){}if(o[4]){let e="undefined"==typeof Headers?(()=>{let e={};return{append(t,n){e[t]=n+""},get:t=>e[t]||null}})():new Headers;Object.keys(o[4]).forEach(t=>{e.append(t,o[4][t])}),o[4]=e}if("any"===e)t.forEach(e=>{var t;this.handlers[e]||(this.handlers[e]=[]),null==(t=this.handlers[e])||t.push(o)});else{var l,i,a;this.handlers[e]||(this.handlers[e]=[]);let t=null==(l=this.handlers[e])?void 0:l.findIndex(e=>6!==e.length&&n(String(e[0]),e[1],r)===n(String(o[0]),o[1],r));(t=void 0===t?-1:t)>-1&&o.length<6?null==(i=this.handlers[e])||i.splice(t,1,o):null==(a=this.handlers[e])||a.push(o)}}findHandler(e){var t;let{method:o,url:l,_url:i,headers:u,params:d,data:h={},baseURL:f}=e,p=null==o?void 0:o.toLowerCase();return null==(t=this.handlers[p])?void 0:t.find(t=>{var o;let v=a({},t[1].headers||{});if((null==(o=e.headers)?void 0:o["Content-Type"])&&!Object.keys(v).find(e=>"content-type"===e.toLowerCase())&&(v["Content-Type"]=e.headers["Content-Type"]),"string"==typeof t[0]){let e=f&&t[0].startsWith(f),o=n(e?s(f,l):s("/",l),{b:d,c:h,a:u},r),i=n(e?t[0]:s("/",t[0]),{b:t[1].params||{},c:t[1].data||{},a:v},r);return o===i||o.startsWith(i)||c([[d,t[1].params],[h,t[1].data],[u,v]])}if(t[0]instanceof RegExp)return(t[0].test(l)||t[0].test(s(f||"",l))||t[0].test(i))&&(n(p,{b:d,c:h,a:u},r)===n(p,{b:t[1].params||{},c:t[1].data||{},a:v},r)||c([[d,t[1].params],[h,t[1].data],[u,v]]))})}constructor(e,t){this.handlers={},this.history={},this.options=t,this.instance=e,this.plugin=this._mockPlugin.bind(this),e.plugins.use(this.plugin)}}function c(e){let t=e.filter(e=>{let[,t]=e;return"function"==typeof(null==t?void 0:t.asymmetricMatch)}),n=t.filter(e=>{let[t,n]=e;return n.asymmetricMatch(t)});return n.length>0&&n.length===t.length}function f(e){e||(e={});let t={},n="undefined"==typeof Headers?{append(e,n){t[e]=n+""},get:e=>t[e]||null}:new Headers;return Object.keys(e).forEach(t=>{n.append(t,e[t])}),n}function p(e,t){if(e.status>=300)throw new o(`Request failed with status code ${e.status}`,t,e);return e}export{d as MockError,h as default};
import{merge as e}from"ts-deepmerge";let t=["get","post","head","delete","patch","put","options"];function n(e,t,n){let r=t?n(t):"";r&&(r=e+(e.includes("?")?"&"+r:"?"+r));let[s,o]=r.split("?");if(o){let e=o.split("&");return`${s}?${e.sort().join("&")}`}return r||e}function r(e,t=!0,n=null){if(null==e)return"";let s=[],o=t?encodeURIComponent:e=>e;for(let l in e)if(Object.prototype.hasOwnProperty.call(e,l)){let i=e[l],a=n?`${n}[${o(l)}]`:o(l);if("object"==typeof i){let e=r(i,t,a);""!==e&&s.push(e)}else Array.isArray(i)?i.forEach((e,t)=>{let n=`${a}[${t}]`;s.push(`${o(n)}=${o(e)}`)}):s.push(`${o(a)}=${o(i)}`)}return s.join("&")}function s(e,t){return t?(e.endsWith("/")?e:e+"/")+(t.startsWith("/")?t.slice(1):t):e}class o extends Error{constructor(e,t,n){super(e),this.request=t,this.config=t,this.response=n}}class l extends o{}function i(e,t,n,r,s,o,l){try{var i=e[o](l),a=i.value}catch(e){n(e);return}i.done?t(a):Promise.resolve(a).then(r,s)}function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}let u="undefined"!=typeof AbortController;class d extends Error{constructor(e,t){super(e),this.request=t,this.config=t}}class h{_mockPlugin(e){var t,n=this;return t=function*(t){var r,s,i,a,h;let c=(null==(r=t.method)?void 0:r.toLowerCase())||"get";n.history[c]||(n.history[c]=[]),n.handlers[c]||(n.handlers[c]=[]),null==(s=n.history[c])||s.push(t);let v=n.findHandler(t);if(v){let r;let s=v[6]||(null==(i=n.options)?void 0:i.delayResponse);6===v.length&&Object.keys(n.handlers).forEach(e=>{var t,r;let s=null==(t=n.handlers[e])?void 0:t.indexOf(v);(s=void 0===s?-1:s)>-1&&(null==(r=n.handlers[e])||r.splice(s,1))});let o=[];if(2!==v.length){let e,n;if(t.timeout&&u){let e=new AbortController;n=setTimeout(()=>{e.abort(new l(`timeout of ${t.timeout}ms exceeded`,t))},t.timeout),o.push(e.signal)}t.signal&&o.push(t.signal),e=o[0],o.length>1&&(e=function(e,t){let n=new globalThis.AbortController;function r(e){n.abort(e),o()}let s=[];for(let t of e){if((null==t?void 0:t.aborted)===!0){r(t.reason);break}if((null==t?void 0:t.addEventListener)!=null){let e=()=>{r(t.reason)};s.push(()=>{(null==t?void 0:t.removeEventListener)!=null&&t.removeEventListener("abort",e)}),t.addEventListener("abort",e)}}function o(){s.forEach(e=>{e()}),null==t||t()}let l=n.signal;return l.clear=o,l}(o,()=>{n&&clearTimeout(n)})),r=()=>{var t;n&&clearTimeout(n),null==e||null==(t=e.clear)||t.call(e)}}s&&s>0&&(yield new Promise(e=>{setTimeout(()=>{e("ok")},s)}));let a=o.find(e=>e.aborted);if(a)return null==r||r(),Promise.reject(a.reason);if(2===v.length)return e(t);if("function"!=typeof v[2]){let e=v.slice(2),n=p({data:e[1],status:e[0],statusText:"ok",headers:e[2],request:t,config:t},t);return null==r||r(),n}let d=v[2](t);if("function"!=typeof(null==d?void 0:d.then)){let e=p({data:d[1],status:d[0],statusText:"ok",headers:f(d[2]),request:t,config:t},t);return null==r||r(),e}{let e=yield d;return(null==r||r(),e.config&&e.status)?e:p({data:e[1],status:e[0],statusText:"ok",headers:f(e[2]),request:t,config:t},t)}}if((null==(a=n.options)?void 0:a.onNoMatch)==="passthrough")return e(t);if((null==(h=n.options)?void 0:h.onNoMatch)==="throwException")throw new d("Could not find mock for: \n"+JSON.stringify(t,["method","url"],2),t);{let e="Request failed with status code 404";throw new o(e,t,{status:404,statusText:e,config:t})}},function(){var e=this,n=arguments;return new Promise(function(r,s){var o=t.apply(e,n);function l(e){i(o,r,s,l,a,"next",e)}function a(e){i(o,r,s,l,a,"throw",e)}l(void 0)})}}resetHandlers(){this.handlers={}}resetHistory(){this.history={}}reset(){this.resetHandlers(),this.resetHistory()}restore(){var e;this.reset(),null==(e=this.instance)||e.plugins.eject(this.plugin)}onGet(e,t){return this.createHandler("get")(e,t)}onDelete(e,t){return this.createHandler("delete")(e,t)}onHead(e,t){return this.createHandler("head")(e,t)}onAny(e,t){return this.createHandler("any")(e,t)}onPost(t,n,r){return this.createHandler("post")(t,e({},r||{},{data:n||{}}))}onPut(t,n,r){return this.createHandler("put")(t,e({},r||{},{data:n||{}}))}onPatch(t,n,r){return this.createHandler("patch")(t,e({},r||{},{data:n||{}}))}onOptions(e,t){return this.createHandler("options")(e,t)}createHandler(t){let n=this;return(r,s)=>{var i,a,u,d,h,c;function f(e,o,l){let i=[r,s,e,o,l];return n.addHandler(t,i),n}function p(e,o,l){let i=[r,s,e,o,l,!0];return n.addHandler(t,i),n}return s=s?e({},{headers:null==(a=n.instance)?void 0:null==(i=a.config)?void 0:i.headers,params:null==(d=n.instance)?void 0:null==(u=d.config)?void 0:u.params,data:null==(c=n.instance)?void 0:null==(h=c.config)?void 0:h.data},s||{}):{},r=void 0===r?/.*/:r,{reply:f,replyOnce:p,withDelayInMs:function(e){return function(o,l,i){return function(e,o,l,i){let a=[r,s,o,l,i,!1,e];return n.addHandler(t,a),n}(e,o,l,i)}},passThrough:()=>{let e=[r,s];return n.addHandler(t,e),n},abortRequest:()=>f(e=>Promise.reject(new o("Request aborted",e))),abortRequestOnce:()=>p(e=>Promise.reject(new o("Request aborted",e,{}))),networkError:()=>f(e=>Promise.reject(new o("Network Error",e,{}))),networkErrorOnce:()=>p(e=>Promise.reject(new o("Network Error",e,{}))),timeout:()=>f(e=>Promise.reject(new l("timeout of 0ms exceeded",e))),timeoutOnce:()=>p(e=>Promise.reject(new l("timeout of 0ms exceeded",e)))}}}addHandler(e,s){let o=[...s];if(o[3])try{o[3]=JSON.parse(JSON.stringify(o[3]))}catch(e){}if(o[4]){let e="undefined"==typeof Headers?(()=>{let e={};return{append(t,n){e[t]=n+""},get:t=>e[t]||null}})():new Headers;Object.keys(o[4]).forEach(t=>{e.append(t,o[4][t])}),o[4]=e}if("any"===e)t.forEach(e=>{var t;this.handlers[e]||(this.handlers[e]=[]),null==(t=this.handlers[e])||t.push(o)});else{var l,i,a;this.handlers[e]||(this.handlers[e]=[]);let t=null==(l=this.handlers[e])?void 0:l.findIndex(e=>6!==e.length&&n(String(e[0]),e[1],r)===n(String(o[0]),o[1],r));(t=void 0===t?-1:t)>-1&&o.length<6?null==(i=this.handlers[e])||i.splice(t,1,o):null==(a=this.handlers[e])||a.push(o)}}findHandler(e){var t;let{method:o,url:l,_url:i,headers:u,params:d,data:h={},baseURL:f}=e,p=null==o?void 0:o.toLowerCase();return null==(t=this.handlers[p])?void 0:t.find(t=>{var o;let v=a({},t[1].headers||{});if((null==(o=e.headers)?void 0:o["Content-Type"])&&!Object.keys(v).find(e=>"content-type"===e.toLowerCase())&&(v["Content-Type"]=e.headers["Content-Type"]),"string"==typeof t[0]){let e=f&&t[0].startsWith(f),o=n(e?s(f,l):s("/",l),{b:d,c:h,a:u},r),i=n(e?t[0]:s("/",t[0]),{b:t[1].params||{},c:t[1].data||{},a:v},r);return o===i||o.startsWith(i)||c([[d,t[1].params],[h,t[1].data],[u,v]])}if(t[0]instanceof RegExp)return(t[0].test(l)||t[0].test(s(f||"",l))||t[0].test(i))&&(n(p,{b:d,c:h,a:u},r)===n(p,{b:t[1].params||{},c:t[1].data||{},a:v},r)||c([[d,t[1].params],[h,t[1].data],[u,v]]))})}constructor(e,t){this.handlers={},this.history={},this.options=t,this.instance=e,this.plugin=this._mockPlugin.bind(this),e.plugins.use(this.plugin)}}function c(e){let t=e.filter(e=>{let[,t]=e;return"function"==typeof(null==t?void 0:t.asymmetricMatch)}),n=t.filter(e=>{let[t,n]=e;return n.asymmetricMatch(t)});return n.length>0&&n.length===t.length}function f(e){e||(e={});let t={},n="undefined"==typeof Headers?{append(e,n){t[e]=n+""},get:e=>t[e]||null}:new Headers;return Object.keys(e).forEach(t=>{n.append(t,e[t])}),n}function p(e,t){if(e.status>=300)throw new o(`Request failed with status code ${e.status}`,t,e);return e}export{d as MockError,h as default};
/*! For license information please see throttle.umd.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.xiorThrottle=e():t.xiorThrottle=e()}(this,(()=>(()=>{"use strict";var t={629:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,s){let i=e?s(e):"";i&&(i=t.includes("?")?t+"&"+i:t+"?"+i);const[n,r]=i.split("?");return r?`${n}?${r.split("&").sort().join("&")}`:i||t}},272:function(t,e,s){var i=this&&this.__awaiter||function(t,e,s,i){return new(s||(s=Promise))((function(n,r){function l(t){try{h(i.next(t))}catch(t){r(t)}}function o(t){try{h(i.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(l,o)}h((i=i.apply(t,e||[])).next())}))},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const r=s(455),l=n(s(629));e.default=function(t={}){const{enableThrottle:e,threshold:s=1e3,throttleCache:n=(0,r.lru)(10)}=t,o=n;return function(t){const n=(e,s)=>{const n=(()=>i(this,void 0,void 0,(function*(){try{const i=yield t(s);return o.set(e,{timestamp:Date.now(),value:Promise.resolve(i)}),i}catch(t){throw"delete"in o?o.delete(e):o.del(e),t}})))();return o.set(e,{timestamp:Date.now(),value:n}),n};return r=>i(this,void 0,void 0,(function*(){const{_url:i,encode:h,threshold:u=s,enableThrottle:a=e,data:f}=r,c="GET"===r.method||r.isGet,p=typeof a;if("undefined"===p?c:"function"===p?a(r):Boolean(a)){const t=(0,l.default)(i,f,h),e=Date.now(),s=o.get(t)||{timestamp:e};if(e-s.timestamp<=u){const t=s.value;if(t)return t}return n(t,r)}return t(r)}))}}},455:(t,e)=>{class s{constructor(t=0,e=0,s=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=s,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){return t.map((t=>[t,this.get(t)]))}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0==--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){let e;if(this.has(t)){const s=this.items[t];this.ttl>0&&s.expiry<=Date.now()?this.delete(t):(e=s.value,this.set(t,e,!0))}return e}has(t){return t in this.items}keys(){const t=[];let e=this.first;for(;null!==e;)t.push(e.key),e=e.next;return t}set(t,e,s=!1,i=this.resetTtl){let n;if(s||this.has(t)){if(n=this.items[t],n.value=e,!1===s&&i&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){const t=this.last,e=n.next,s=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,t.next=n,null!==s&&(s.next=e),null!==e&&(e.prev=s)}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1==++this.size?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map((t=>this.get(t)))}}e.LRU=s,e.lru=function(t=1e3,e=0,i=!1){if(isNaN(t)||t<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof i)throw new TypeError("Invalid resetTtl value");return new s(t,e,i)}}},e={},s=function s(i){var n=e[i];if(void 0!==n)return n.exports;var r=e[i]={exports:{}};return t[i].call(r.exports,r,r.exports,s),r.exports}(272);return s.default})()));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.xiorThrottle=e():t.xiorThrottle=e()}(this,(()=>(()=>{"use strict";var t={629:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,s){let i=e?s(e):"";i&&(i=t+(t.includes("?")?"&"+i:"?"+i));const[n,r]=i.split("?");return r?`${n}?${r.split("&").sort().join("&")}`:i||t}},272:function(t,e,s){var i=this&&this.__awaiter||function(t,e,s,i){return new(s||(s=Promise))((function(n,r){function l(t){try{h(i.next(t))}catch(t){r(t)}}function o(t){try{h(i.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(l,o)}h((i=i.apply(t,e||[])).next())}))},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const r=s(455),l=n(s(629));e.default=function(t={}){const{enableThrottle:e,threshold:s=1e3,throttleCache:n=(0,r.lru)(10)}=t,o=n;return function(t){const n=(e,s)=>{const n=(()=>i(this,void 0,void 0,(function*(){try{const i=yield t(s);return o.set(e,{timestamp:Date.now(),value:Promise.resolve(i)}),i}catch(t){throw"delete"in o?o.delete(e):o.del(e),t}})))();return o.set(e,{timestamp:Date.now(),value:n}),n};return r=>i(this,void 0,void 0,(function*(){const{_url:i,encode:h,threshold:u=s,enableThrottle:a=e,data:f}=r,c="GET"===r.method||r.isGet,p=typeof a;if("undefined"===p?c:"function"===p?a(r):Boolean(a)){const t=(0,l.default)(i,f,h),e=Date.now(),s=o.get(t)||{timestamp:e};if(e-s.timestamp<=u){const t=s.value;if(t)return t}return n(t,r)}return t(r)}))}}},455:(t,e)=>{class s{constructor(t=0,e=0,s=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=s,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){return t.map((t=>[t,this.get(t)]))}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0==--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){let e;if(this.has(t)){const s=this.items[t];this.ttl>0&&s.expiry<=Date.now()?this.delete(t):(e=s.value,this.set(t,e,!0))}return e}has(t){return t in this.items}keys(){const t=[];let e=this.first;for(;null!==e;)t.push(e.key),e=e.next;return t}set(t,e,s=!1,i=this.resetTtl){let n;if(s||this.has(t)){if(n=this.items[t],n.value=e,!1===s&&i&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){const t=this.last,e=n.next,s=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,t.next=n,null!==s&&(s.next=e),null!==e&&(e.prev=s)}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1==++this.size?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map((t=>this.get(t)))}}e.LRU=s,e.lru=function(t=1e3,e=0,i=!1){if(isNaN(t)||t<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof i)throw new TypeError("Invalid resetTtl value");return new s(t,e,i)}}},e={},s=function s(i){var n=e[i];if(void 0!==n)return n.exports;var r=e[i]={exports:{}};return t[i].call(r.exports,r,r.exports,s),r.exports}(272);return s.default})()));

@@ -1,1 +0,1 @@

import{lru as t}from"tiny-lru";function e(t,e,n,r,i,o,u){try{var l=t[o](u),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(r,i)}function n(t){return function(){var n=this,r=arguments;return new Promise(function(i,o){var u=t.apply(n,r);function l(t){e(u,i,o,l,a,"next",t)}function a(t){e(u,i,o,l,a,"throw",t)}l(void 0)})}}function r(e={}){let{enableThrottle:r,threshold:i=1e3,throttleCache:o=t(10)}=e;return function(t){let e=(e,r)=>{let i=n(function*(){try{let n=yield t(r);return o.set(e,{timestamp:Date.now(),value:Promise.resolve(n)}),n}catch(t){throw"delete"in o?o.delete(e):o.del(e),t}})();return o.set(e,{timestamp:Date.now(),value:i}),i};return n(function*(n){let{_url:u,encode:l,threshold:a=i,enableThrottle:f=r,data:s}=n,c="GET"===n.method||n.isGet,m=typeof f;if("undefined"===m?c:"function"===m?f(n):!!f){let t=function(t,e,n){let r=e?n(e):"";r&&(r=t.includes("?")?t+"&"+r:t+"?"+r);let[i,o]=r.split("?");if(o){let t=o.split("&");return`${i}?${t.sort().join("&")}`}return r||t}(u,s,l),r=Date.now(),i=o.get(t)||{timestamp:r};if(r-i.timestamp<=a){let t=i.value;if(t)return t}return e(t,n)}return t(n)})}}export{r as default};
import{lru as t}from"tiny-lru";function e(t,e,n,r,i,o,u){try{var l=t[o](u),a=l.value}catch(t){n(t);return}l.done?e(a):Promise.resolve(a).then(r,i)}function n(t){return function(){var n=this,r=arguments;return new Promise(function(i,o){var u=t.apply(n,r);function l(t){e(u,i,o,l,a,"next",t)}function a(t){e(u,i,o,l,a,"throw",t)}l(void 0)})}}function r(e={}){let{enableThrottle:r,threshold:i=1e3,throttleCache:o=t(10)}=e;return function(t){let e=(e,r)=>{let i=n(function*(){try{let n=yield t(r);return o.set(e,{timestamp:Date.now(),value:Promise.resolve(n)}),n}catch(t){throw"delete"in o?o.delete(e):o.del(e),t}})();return o.set(e,{timestamp:Date.now(),value:i}),i};return n(function*(n){let{_url:u,encode:l,threshold:a=i,enableThrottle:f=r,data:s}=n,c="GET"===n.method||n.isGet,m=typeof f;if("undefined"===m?c:"function"===m?f(n):!!f){let t=function(t,e,n){let r=e?n(e):"";r&&(r=t+(t.includes("?")?"&"+r:"?"+r));let[i,o]=r.split("?");if(o){let t=o.split("&");return`${i}?${t.sort().join("&")}`}return r||t}(u,s,l),r=Date.now(),i=o.get(t)||{timestamp:r};if(r-i.timestamp<=a){let t=i.value;if(t)return t}return e(t,n)}return t(n)})}}export{r as default};
[![Build](https://github.com/suhaotian/xior/actions/workflows/check.yml/badge.svg)](https://github.com/suhaotian/xior/actions/workflows/check.yml)
[![minzipped size](https://badgen.net/badge/gzip/2.6kb/green)](https://bundlephobia.com/package/xior)
[![minzipped size](https://badgen.net/badge/gzip/3kb/green)](https://bundlephobia.com/package/xior)
[![npm version](https://badgen.net/npm/v/xior?color=green)](https://www.npmjs.com/package/xior)

@@ -18,3 +18,3 @@ ![Downloads](https://img.shields.io/npm/dm/xior.svg?style=flat)

- 🥷 Plugin support: error retry, cache, throttling, dedupe, error cache, mock and easily create custom plugins
- 🚀 Lightweight (~6KB, Gzip ~2.6KB)
- 🚀 Lightweight (~8KB, Gzip ~3kb)
- 👊 Unit tested and strongly typed 💪

@@ -120,3 +120,3 @@

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/dist/xior.umd.js"></script>

@@ -136,8 +136,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Usage -->
<script>
xior.plugins.use(xiorProgress());
xior.get('https://exmapledomain.com/api').then((res) => {

@@ -397,4 +395,5 @@ console.log(res.data);

retryTimes?: number;
retryInterval?: number;
retryInterval?: number | ((errorCount: number) => number);
enableRetry?: boolean | (config: XiorRequestConfig, error: XiorError) => boolean;
onRetry?: (config: XiorRequestConfig, error: XiorError, count: number) => void;
}): XiorPlugin;

@@ -405,7 +404,8 @@ ```

| Param | Type | Default value | Description |
| ------------- | --------------------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------- |
| retryTimes | number | 2 | Set the retry times for failed request |
| retryInterval | number | 3000 | After first time retry, the next retries interval time, default interval is 3 seconds |
| enableRetry | boolean \| ((config: XiorRequestConfig, error: XiorError) => boolean) | (config, error) => config.method === 'GET' \|\| config.isGet | Default only retry if `GET` request error and `retryTimes > 0` |
| Param | Type | Default value | Description |
| ------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| retryTimes | number | 2 | Set the retry times for failed request |
| retryInterval | number \| ((errorCount: number) => number) | 3000 | After first time retry, the next retries interval time, default interval is 3 seconds; you can use function as param too |
| enableRetry | boolean \| ((config: XiorRequestConfig, error: XiorError) => boolean) | (config, error) => config.method === 'GET' \|\| config.isGet | Default only retry if `GET` request error and `retryTimes > 0` |
| onRetry | boolean \| ((config: XiorRequestConfig, error: XiorError, count: number) => void) | undefined | For log retry info |

@@ -422,3 +422,9 @@ Basic usage:

retryTimes: 3,
retryInterval: 3000,
// retryInterval: 3000,
retryInterval(count) {
return count * 3000;
},
onRetry(config, error, count) {
console.log(`${config.method} ${config.url} retry ${count} times`);
},
})

@@ -445,5 +451,5 @@ );

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/plugins/error-retry.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/plugins/error-retry.umd.js"></script>

@@ -461,6 +467,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.2.1/plugins/error-retry.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/plugins/error-retry.umd.js"></script>

@@ -548,5 +554,5 @@ <!-- Usage -->

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/plugins/throttle.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/plugins/throttle.umd.js"></script>

@@ -564,6 +570,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.2.1/plugins/throttle.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/plugins/throttle.umd.js"></script>

@@ -616,5 +622,5 @@ <!-- Usage -->

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/plugins/dedupe.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/plugins/dedupe.umd.js"></script>

@@ -632,6 +638,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.2.1/plugins/dedupe.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/plugins/dedupe.umd.js"></script>

@@ -694,5 +700,5 @@ <!-- Usage -->

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/plugins/error-cache.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/plugins/error-cache.umd.js"></script>

@@ -710,6 +716,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.2.1/plugins/error-cache.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/plugins/error-cache.umd.js"></script>

@@ -849,5 +855,5 @@ <!-- Usage -->

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/plugins/progress.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/plugins/progress.umd.js"></script>

@@ -865,6 +871,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.2.1/plugins/progress.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/plugins/progress.umd.js"></script>

@@ -976,5 +982,5 @@ <!-- Usage -->

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.1/plugins/mock.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.2.2/plugins/mock.umd.js"></script>

@@ -992,6 +998,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.2.1/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.2.1/plugins/mock.umd.js"></script>
<script src="https://unpkg.com/xior@0.2.2/plugins/mock.umd.js"></script>

@@ -998,0 +1004,0 @@ <!-- Usage -->

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc