Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More ā†’
Socket
Sign inDemoInstall
Socket

axios-cache-interceptor

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-cache-interceptor - npm Package Compare versions

Comparing version 0.8.5 to 0.8.8

umd/es5.d.ts

2

cjs/dev.js

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

(()=>{"use strict";var e={d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Header:()=>r,buildKeyGenerator:()=>y,buildMemoryStorage:()=>v,buildStorage:()=>m,buildWebStorage:()=>C,createCacheResponse:()=>c,createValidateStatus:()=>o,defaultHeaderInterpreter:()=>i,defaultKeyGenerator:()=>S,defaultRequestInterceptor:()=>l,defaultResponseInterceptor:()=>h,isMethodIn:()=>s,isStorage:()=>p,setupCache:()=>I,testCachePredicate:()=>u,updateCache:()=>g,updateStaleRequest:()=>d});const a=require("cache-parser"),r=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),i=e=>{if(!e)return"not enough headers";const t=e[r.CacheControl];if(t){const{noCache:i,noStore:n,mustRevalidate:o,maxAge:s,immutable:d}=(0,a.parse)(String(t));if(i||n)return"dont cache";if(d)return 31536e6;if(o)return 0;if(s){const t=e[r.Age];return t?1e3*(s-Number(t)):1e3*s}}const i=e[r.Expires];if(i){const e=Date.parse(String(i))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"},n=require("fast-defer");function o(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function s(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function d(e,t){var a;t.headers||(t.headers={});const{etag:i,modifiedSince:n}=t.cache;if(i){const n=!0===i?null===(a=e.data)||void 0===a?void 0:a.headers[r.ETag]:i;n&&(t.headers[r.IfNoneMatch]=n)}n&&(t.headers[r.IfModifiedSince]=!0===n?e.data.headers[r.LastModified]||new Date(e.createdAt).toUTCString():n.toUTCString())}function c(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function l(e){const t=async t=>{var a,r,i,c,l,u,g,h,f;if(!1===t.cache)return null===(a=e.debug)||void 0===a||a.call(e,{msg:"Ignoring cache because config.cache is false",data:t}),t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!s(t.method,t.cache.methods))return null===(r=e.debug)||void 0===r||r.call(e,{msg:`Ignored because method (${t.method}) is not in cache.methods (${t.cache.methods})`}),t;const p=t.id=e.generateKey(t);let m,v=await e.storage.get(p);e:if("empty"===v.state||"stale"===v.state){if(e.waiting[p]){v=await e.storage.get(p),null===(i=e.debug)||void 0===i||i.call(e,{id:p,msg:"Waiting list had an deferred for this key, waiting for it to finish"});break e}return e.waiting[p]=(0,n.deferred)(),null===(c=e.waiting[p])||void 0===c||c.catch((()=>{})),await e.storage.set(p,{state:"loading",previous:v.state,data:v.data,createdAt:v.createdAt}),"stale"===v.state&&(d(v,t),null===(l=e.debug)||void 0===l||l.call(e,{id:p,msg:"Updated stale request"})),t.validateStatus=o(t.validateStatus),null===(u=e.debug)||void 0===u||u.call(e,{id:p,msg:"Sending request, waiting for response"}),t}if("loading"===v.state){const a=e.waiting[p];if(!a)return await e.storage.remove(p),t;null===(g=e.debug)||void 0===g||g.call(e,{id:p,msg:"Detected concurrent request, waiting for it to finish"});try{m=await a}catch(a){return null===(h=e.debug)||void 0===h||h.call(e,{id:p,msg:"Deferred rejected, requesting again",data:a}),t}}else m=v.data;return t.adapter=()=>Promise.resolve({config:t,data:m.data,headers:m.headers,status:m.status,statusText:m.statusText,cached:!0,id:p}),null===(f=e.debug)||void 0===f||f.call(e,{id:p,msg:"Returning cached response"}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function u(e,t){var a;if("function"==typeof t)return t(e);const{statusCheck:r,responseMatch:i,containsHeaders:n}=t;if(r&&!await r(e.status)||i&&!await i(e))return!1;if(n)for(const t in n){const r=n[t];if(r&&!await r(null!==(a=e.headers[t.toLowerCase()])&&void 0!==a?a:e.headers[t]))return!1}return!0}async function g(e,t,a){for(const r in a){const i=a[r];if("delete"===i){await e.remove(r);continue}const n=await e.get(r);if("loading"===n.state)continue;const o=await i(n,t);"delete"!==o?"ignore"!==o&&await e.set(r,o):await e.remove(r)}}function h(e){const t=async t=>{var a;await e.storage.remove(t),null===(a=e.waiting[t])||void 0===a||a.reject(null),delete e.waiting[t]},a=async a=>{var i,n,o,s,d,l,h,f,p,m,v;if(a.id=null!==(i=(v=a.config).id)&&void 0!==i?i:v.id=e.generateKey(a.config),null!==(n=a.cached)&&void 0!==n||(a.cached=!1),a.cached)return null===(o=e.debug)||void 0===o||o.call(e,{id:a.id,msg:"Returned cached response"}),a;if(!a.config.cache)return null===(s=e.debug)||void 0===s||s.call(e,{id:a.id,msg:"Response with config.cache === false",data:a}),Object.assign(Object.assign({},a),{cached:!1});const b=a.config.cache,w=await e.storage.get(a.id);if("stale"===w.state||"empty"===w.state||"cached"===w.state)return null===(d=e.debug)||void 0===d||d.call(e,{id:a.id,msg:"Response not cached but storage is not loading",data:{cache:w,response:a}}),a;if(!w.data&&!await u(a,b.cachePredicate))return await t(a.id),null===(l=e.debug)||void 0===l||l.call(e,{id:a.id,msg:"Cache predicate rejected this response"}),a;for(const e in r)e.startsWith("XAxiosCache")&&delete a.headers[e];b.etag&&!0!==b.etag&&(a.headers[r.XAxiosCacheEtag]=b.etag),b.modifiedSince&&(a.headers[r.XAxiosCacheLastModified]=!0===b.modifiedSince?"use-cache-timestamp":b.modifiedSince.toUTCString());let y=b.ttl||-1;if(null==b?void 0:b.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(a.id),null===(h=e.debug)||void 0===h||h.call(e,{id:a.id,msg:"Cache header interpreted as 'dont cache'",data:{cache:w,response:a,expirationTime:r}}),a;y="not enough headers"===r?y:r}const S=c(a,w.data);"function"==typeof y&&(y=await y(a)),b.staleIfError&&(a.headers[r.XAxiosCacheStaleIfError]=String(y)),null===(f=e.debug)||void 0===f||f.call(e,{id:a.id,msg:"Useful response configuration found",data:{cacheConfig:b,ttl:y,cacheResponse:S}}),(null==b?void 0:b.update)&&await g(e.storage,a,b.update);const I={state:"cached",ttl:y,createdAt:Date.now(),data:S},C=e.waiting[a.id];return C&&(C.resolve(I.data),delete e.waiting[a.id],null===(p=e.debug)||void 0===p||p.call(e,{id:a.id,msg:"Found waiting deferred(s) and resolved them"})),await e.storage.set(a.id,I),null===(m=e.debug)||void 0===m||m.call(e,{id:a.id,msg:"Response cached",data:{cache:I,response:a}}),a},i=async a=>{var r,i,n,o,s,d;const c=a.config;if(!c||!1===c.cache||!c.id)throw null===(r=e.debug)||void 0===r||r.call(e,{msg:"Web request returned an error but cache handling is not enabled",data:{error:a,config:c}}),a;const l=await e.storage.get(c.id),u=c.cache;if("loading"!==l.state||"stale"!==l.previous)throw await t(c.id),null===(i=e.debug)||void 0===i||i.call(e,{msg:"Caught an error in the request interceptor",data:{error:a,config:c}}),a;if(null==u?void 0:u.staleIfError){const t="function"==typeof u.staleIfError?await u.staleIfError(a.response,l,a):u.staleIfError;if(null===(n=e.debug)||void 0===n||n.call(e,{msg:"Found cache if stale config for rejected response",data:{error:a,config:c,staleIfError:t}}),!0===t||"number"==typeof t&&l.createdAt+t>Date.now())return null===(o=e.waiting[c.id])||void 0===o||o.resolve(l.data),delete e.waiting[c.id],await e.storage.set(c.id,{state:"stale",createdAt:Date.now(),data:l.data}),null===(s=e.debug)||void 0===s||s.call(e,{msg:"staleIfError resolved this response with cached data",data:{error:a,config:c,cache:l}}),{cached:!0,config:c,id:c.id,data:l.data.data,headers:l.data.headers,status:l.data.status,statusText:l.data.statusText}}throw null===(d=e.debug)||void 0===d||d.call(e,{msg:"Received an unknown error that could not be handled",data:{error:a,config:c}}),a};return{onFulfilled:a,onRejected:i,apply:()=>e.interceptors.response.use(a,i)}}const f=Symbol(),p=e=>!!e&&!!e[f];function m({set:e,find:t,remove:a}){return{[f]:1,set:e,remove:a,get:async i=>{const n=await t(i);if(!n)return{state:"empty"};if("cached"!==n.state||n.createdAt+n.ttl>Date.now())return n;if(n.data.headers&&(r.ETag in n.data.headers||r.LastModified in n.data.headers||r.XAxiosCacheEtag in n.data.headers||r.XAxiosCacheStaleIfError in n.data.headers||r.XAxiosCacheLastModified in n.data.headers)){const t={state:"stale",createdAt:n.createdAt,data:n.data};return await e(i,t),t}return await a(i),{state:"empty"}}}}function v(){const e=m({find:t=>e.data[t],set:(t,a)=>{e.data[t]=a},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}const b=require("object-code"),w=/^\/|\/$/g;function y(e,t){return a=>{if(a.id)return a.id;a.baseURL&&(a.baseURL=a.baseURL.replace(w,"")),a.url&&(a.url=a.url.replace(w,"")),a.method&&(a.method=a.method.toLowerCase());const r=t(a);return e?(0,b.code)(r).toString():r}}const S=y(!0,(({baseURL:e="",url:t="",method:a="get",params:r,data:i})=>({url:e+(e&&t?"/":"")+t,method:a,params:r,data:i})));function I(e,t={}){var a,r,n,o,s;const d=e;if(d.storage=t.storage||v(),!p(d.storage))throw new Error("Use buildStorage() function");return d.generateKey=t.generateKey||S,d.waiting=t.waiting||{},d.headerInterpreter=t.headerInterpreter||i,d.requestInterceptor=t.requestInterceptor||l(d),d.responseInterceptor=t.responseInterceptor||h(d),d.debug=t.debug,d.defaults.cache={ttl:null!==(a=t.ttl)&&void 0!==a?a:3e5,interpretHeader:null!==(r=t.interpretHeader)&&void 0!==r&&r,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null!==(n=t.etag)&&void 0!==n&&n,modifiedSince:null!==(o=t.modifiedSince)&&void 0!==o&&o,staleIfError:null!==(s=t.staleIfError)&&void 0!==s&&s,update:t.update||{}},d.requestInterceptor.apply(),d.responseInterceptor.apply(),d}function C(e,t=""){return m({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},set:(a,r)=>{e.setItem(t+a,JSON.stringify(r))},remove:a=>{e.removeItem(t+a)}})}console.error("You are using a development build. Make sure to use the correct build in production"),console.error("https://axios-cache-interceptor.js.org/#/pages/installing"),module.exports=t})();
(()=>{"use strict";var e={d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Header:()=>r,buildKeyGenerator:()=>S,buildMemoryStorage:()=>w,buildStorage:()=>m,buildWebStorage:()=>x,createCacheResponse:()=>c,createValidateStatus:()=>o,defaultHeaderInterpreter:()=>s,defaultKeyGenerator:()=>I,defaultRequestInterceptor:()=>u,defaultResponseInterceptor:()=>f,isMethodIn:()=>n,isStorage:()=>p,setupCache:()=>C,testCachePredicate:()=>g,updateCache:()=>h,updateStaleRequest:()=>d});const a=require("cache-parser"),r=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),s=e=>{if(!e)return"not enough headers";const t=e[r.CacheControl];if(t){const{noCache:s,noStore:i,mustRevalidate:o,maxAge:n,immutable:d}=(0,a.parse)(String(t));if(s||i)return"dont cache";if(d)return 31536e6;if(o)return 0;if(n){const t=e[r.Age];return t?1e3*(n-Number(t)):1e3*n}}const s=e[r.Expires];if(s){const e=Date.parse(String(s))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"},i=require("fast-defer");function o(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function n(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function d(e,t){t.headers||(t.headers={});const{etag:a,modifiedSince:s}=t.cache;if(a){const s=!0===a?e.data?.headers[r.ETag]:a;s&&(t.headers[r.IfNoneMatch]=s)}s&&(t.headers[r.IfModifiedSince]=!0===s?e.data.headers[r.LastModified]||new Date(e.createdAt).toUTCString():s.toUTCString())}function c(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers={...t.headers,...e.headers},t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function u(e){const t=async t=>{if(!1===t.cache)return e.debug?.({msg:"Ignoring cache because config.cache is false",data:t}),t;if(t.cache={...e.defaults.cache,...t.cache},!n(t.method,t.cache.methods))return e.debug?.({msg:`Ignored because method (${t.method}) is not in cache.methods (${t.cache.methods})`}),t;const a=t.id=e.generateKey(t);let r,s=await e.storage.get(a);e:if("empty"===s.state||"stale"===s.state){if(e.waiting[a]){s=await e.storage.get(a),e.debug?.({id:a,msg:"Waiting list had an deferred for this key, waiting for it to finish"});break e}return e.waiting[a]=(0,i.deferred)(),e.waiting[a]?.catch((()=>{})),await e.storage.set(a,{state:"loading",previous:s.state,data:s.data,createdAt:s.createdAt}),"stale"===s.state&&(d(s,t),e.debug?.({id:a,msg:"Updated stale request"})),t.validateStatus=o(t.validateStatus),e.debug?.({id:a,msg:"Sending request, waiting for response"}),t}if("loading"===s.state){const s=e.waiting[a];if(!s)return await e.storage.remove(a),t;e.debug?.({id:a,msg:"Detected concurrent request, waiting for it to finish"});try{r=await s}catch(r){return e.debug?.({id:a,msg:"Deferred rejected, requesting again",data:r}),t}}else r=s.data;return t.adapter=()=>Promise.resolve({config:t,data:r.data,headers:r.headers,status:r.status,statusText:r.statusText,cached:!0,id:a}),e.debug?.({id:a,msg:"Returning cached response"}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function g(e,t){if("function"==typeof t)return t(e);const{statusCheck:a,responseMatch:r,containsHeaders:s}=t;if(a&&!await a(e.status)||r&&!await r(e))return!1;if(s)for(const t in s){const a=s[t];if(a&&!await a(e.headers[t.toLowerCase()]??e.headers[t]))return!1}return!0}async function h(e,t,a){for(const r in a){const s=a[r];if("delete"===s){await e.remove(r);continue}const i=await e.get(r);if("loading"===i.state)continue;const o=await s(i,t);"delete"!==o?"ignore"!==o&&await e.set(r,o):await e.remove(r)}}function f(e){const t=async t=>{await e.storage.remove(t),e.waiting[t]?.reject(null),delete e.waiting[t]},a=async a=>{var s;if(a.id=(s=a.config).id??(s.id=e.generateKey(a.config)),a.cached??(a.cached=!1),a.cached)return e.debug?.({id:a.id,msg:"Returned cached response"}),a;if(!a.config.cache)return e.debug?.({id:a.id,msg:"Response with config.cache === false",data:a}),{...a,cached:!1};const i=a.config.cache,o=await e.storage.get(a.id);if("stale"===o.state||"empty"===o.state||"cached"===o.state)return e.debug?.({id:a.id,msg:"Response not cached but storage is not loading",data:{cache:o,response:a}}),a;if(!o.data&&!await g(a,i.cachePredicate))return await t(a.id),e.debug?.({id:a.id,msg:"Cache predicate rejected this response"}),a;for(const e in r)e.startsWith("XAxiosCache")&&delete a.headers[e];i.etag&&!0!==i.etag&&(a.headers[r.XAxiosCacheEtag]=i.etag),i.modifiedSince&&(a.headers[r.XAxiosCacheLastModified]=!0===i.modifiedSince?"use-cache-timestamp":i.modifiedSince.toUTCString());let n=i.ttl||-1;if(i?.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(a.id),e.debug?.({id:a.id,msg:"Cache header interpreted as 'dont cache'",data:{cache:o,response:a,expirationTime:r}}),a;n="not enough headers"===r?n:r}const d=c(a,o.data);"function"==typeof n&&(n=await n(a)),i.staleIfError&&(a.headers[r.XAxiosCacheStaleIfError]=String(n)),e.debug?.({id:a.id,msg:"Useful response configuration found",data:{cacheConfig:i,ttl:n,cacheResponse:d}}),i?.update&&await h(e.storage,a,i.update);const u={state:"cached",ttl:n,createdAt:Date.now(),data:d},f=e.waiting[a.id];return f&&(f.resolve(u.data),delete e.waiting[a.id],e.debug?.({id:a.id,msg:"Found waiting deferred(s) and resolved them"})),await e.storage.set(a.id,u),e.debug?.({id:a.id,msg:"Response cached",data:{cache:u,response:a}}),a},s=async a=>{const r=a.config;if(!r||!1===r.cache||!r.id)throw e.debug?.({msg:"Web request returned an error but cache handling is not enabled",data:{error:a,config:r}}),a;const s=await e.storage.get(r.id),i=r.cache;if("loading"!==s.state||"stale"!==s.previous)throw await t(r.id),e.debug?.({msg:"Caught an error in the request interceptor",data:{error:a,config:r}}),a;if(i?.staleIfError){const t="function"==typeof i.staleIfError?await i.staleIfError(a.response,s,a):i.staleIfError;if(e.debug?.({msg:"Found cache if stale config for rejected response",data:{error:a,config:r,staleIfError:t}}),!0===t||"number"==typeof t&&s.createdAt+t>Date.now())return e.waiting[r.id]?.resolve(s.data),delete e.waiting[r.id],await e.storage.set(r.id,{state:"stale",createdAt:Date.now(),data:s.data}),e.debug?.({msg:"staleIfError resolved this response with cached data",data:{error:a,config:r,cache:s}}),{cached:!0,config:r,id:r.id,data:s.data.data,headers:s.data.headers,status:s.data.status,statusText:s.data.statusText}}throw e.debug?.({msg:"Received an unknown error that could not be handled",data:{error:a,config:r}}),a};return{onFulfilled:a,onRejected:s,apply:()=>e.interceptors.response.use(a,s)}}const l=Symbol(),p=e=>!!e&&!!e[l];function m({set:e,find:t,remove:a}){return{[l]:1,set:e,remove:a,get:async s=>{const i=await t(s);if(!i)return{state:"empty"};if("cached"!==i.state||i.createdAt+i.ttl>Date.now())return i;if(i.data.headers&&(r.ETag in i.data.headers||r.LastModified in i.data.headers||r.XAxiosCacheEtag in i.data.headers||r.XAxiosCacheStaleIfError in i.data.headers||r.XAxiosCacheLastModified in i.data.headers)){const t={state:"stale",createdAt:i.createdAt,data:i.data};return await e(s,t),t}return await a(s),{state:"empty"}}}}function w(){const e=m({find:t=>e.data[t],set:(t,a)=>{e.data[t]=a},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}const b=require("object-code"),y=/^\/|\/$/g;function S(e,t){return a=>{if(a.id)return a.id;a.baseURL&&(a.baseURL=a.baseURL.replace(y,"")),a.url&&(a.url=a.url.replace(y,"")),a.method&&(a.method=a.method.toLowerCase());const r=t(a);return e?(0,b.code)(r).toString():r}}const I=S(!0,(({baseURL:e="",url:t="",method:a="get",params:r,data:s})=>({url:e+(e&&t?"/":"")+t,method:a,params:r,data:s})));function C(e,t={}){const a=e;if(a.storage=t.storage||w(),!p(a.storage))throw new Error("Use buildStorage() function");return a.generateKey=t.generateKey||I,a.waiting=t.waiting||{},a.headerInterpreter=t.headerInterpreter||s,a.requestInterceptor=t.requestInterceptor||u(a),a.responseInterceptor=t.responseInterceptor||f(a),a.debug=t.debug,a.defaults.cache={ttl:t.ttl??3e5,interpretHeader:t.interpretHeader??!1,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:t.etag??!1,modifiedSince:t.modifiedSince??!1,staleIfError:t.staleIfError??!1,update:t.update||{}},a.requestInterceptor.apply(),a.responseInterceptor.apply(),a}function x(e,t=""){return m({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},set:(a,r)=>{e.setItem(t+a,JSON.stringify(r))},remove:a=>{e.removeItem(t+a)}})}console.error("You are using a development build. Make sure to use the correct build in production"),console.error("https://axios-cache-interceptor.js.org/#/pages/installing"),module.exports=t})();
//# sourceMappingURL=dev.map

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

(()=>{"use strict";var e={d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Header:()=>r,buildKeyGenerator:()=>w,buildMemoryStorage:()=>m,buildStorage:()=>y,buildWebStorage:()=>C,createCacheResponse:()=>u,createValidateStatus:()=>d,defaultHeaderInterpreter:()=>i,defaultKeyGenerator:()=>x,defaultRequestInterceptor:()=>l,defaultResponseInterceptor:()=>g,isMethodIn:()=>s,isStorage:()=>v,setupCache:()=>I,testCachePredicate:()=>f,updateCache:()=>h,updateStaleRequest:()=>c});const a=require("cache-parser"),r=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),i=e=>{if(!e)return"not enough headers";const t=e[r.CacheControl];if(t){const{noCache:i,noStore:n,mustRevalidate:o,maxAge:d,immutable:s}=(0,a.parse)(String(t));if(i||n)return"dont cache";if(s)return 31536e6;if(o)return 0;if(d){const t=e[r.Age];return t?1e3*(d-Number(t)):1e3*d}}const i=e[r.Expires];if(i){const e=Date.parse(String(i))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"};function n(e,t,a,r){return new(a||(a=Promise))((function(i,n){function o(e){try{s(r.next(e))}catch(e){n(e)}}function d(e){try{s(r.throw(e))}catch(e){n(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(o,d)}s((r=r.apply(e,t||[])).next())}))}Object.create;Object.create;const o=require("fast-defer");function d(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function s(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function c(e,t){var a;t.headers||(t.headers={});const{etag:i,modifiedSince:n}=t.cache;if(i){const n=!0===i?null===(a=e.data)||void 0===a?void 0:a.headers[r.ETag]:i;n&&(t.headers[r.IfNoneMatch]=n)}n&&(t.headers[r.IfModifiedSince]=!0===n?e.data.headers[r.LastModified]||new Date(e.createdAt).toUTCString():n.toUTCString())}function u(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function l(e){const t=t=>n(this,void 0,void 0,(function*(){var a;if(!1===t.cache)return t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!s(t.method,t.cache.methods))return t;const r=t.id=e.generateKey(t);let i,n=yield e.storage.get(r);e:if("empty"===n.state||"stale"===n.state){if(e.waiting[r]){n=yield e.storage.get(r);break e}return e.waiting[r]=(0,o.deferred)(),null===(a=e.waiting[r])||void 0===a||a.catch((()=>{})),yield e.storage.set(r,{state:"loading",previous:n.state,data:n.data,createdAt:n.createdAt}),"stale"===n.state&&c(n,t),t.validateStatus=d(t.validateStatus),t}if("loading"===n.state){const a=e.waiting[r];if(!a)return yield e.storage.remove(r),t;0;try{i=yield a}catch(e){return t}}else i=n.data;return t.adapter=()=>Promise.resolve({config:t,data:i.data,headers:i.headers,status:i.status,statusText:i.statusText,cached:!0,id:r}),t}));return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}function f(e,t){var a;return n(this,void 0,void 0,(function*(){if("function"==typeof t)return t(e);const{statusCheck:r,responseMatch:i,containsHeaders:n}=t;if(r&&!(yield r(e.status))||i&&!(yield i(e)))return!1;if(n)for(const t in n){const r=n[t];if(r&&!(yield r(null!==(a=e.headers[t.toLowerCase()])&&void 0!==a?a:e.headers[t])))return!1}return!0}))}function h(e,t,a){return n(this,void 0,void 0,(function*(){for(const r in a){const i=a[r];if("delete"===i){yield e.remove(r);continue}const n=yield e.get(r);if("loading"===n.state)continue;const o=yield i(n,t);"delete"!==o?"ignore"!==o&&(yield e.set(r,o)):yield e.remove(r)}}))}function g(e){const t=t=>n(this,void 0,void 0,(function*(){var a;yield e.storage.remove(t),null===(a=e.waiting[t])||void 0===a||a.reject(null),delete e.waiting[t]})),a=a=>n(this,void 0,void 0,(function*(){var i,n,o;if(a.id=null!==(i=(o=a.config).id)&&void 0!==i?i:o.id=e.generateKey(a.config),null!==(n=a.cached)&&void 0!==n||(a.cached=!1),a.cached)return a;if(!a.config.cache)return Object.assign(Object.assign({},a),{cached:!1});const d=a.config.cache,s=yield e.storage.get(a.id);if("stale"===s.state||"empty"===s.state||"cached"===s.state)return a;if(!s.data&&!(yield f(a,d.cachePredicate)))return yield t(a.id),a;for(const e in r)e.startsWith("XAxiosCache")&&delete a.headers[e];d.etag&&!0!==d.etag&&(a.headers[r.XAxiosCacheEtag]=d.etag),d.modifiedSince&&(a.headers[r.XAxiosCacheLastModified]=!0===d.modifiedSince?"use-cache-timestamp":d.modifiedSince.toUTCString());let c=d.ttl||-1;if(null==d?void 0:d.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return yield t(a.id),a;c="not enough headers"===r?c:r}const l=u(a,s.data);"function"==typeof c&&(c=yield c(a)),d.staleIfError&&(a.headers[r.XAxiosCacheStaleIfError]=String(c)),(null==d?void 0:d.update)&&(yield h(e.storage,a,d.update));const g={state:"cached",ttl:c,createdAt:Date.now(),data:l},p=e.waiting[a.id];return p&&(p.resolve(g.data),delete e.waiting[a.id]),yield e.storage.set(a.id,g),a})),i=a=>n(this,void 0,void 0,(function*(){var r;const i=a.config;if(!i||!1===i.cache||!i.id)throw a;const n=yield e.storage.get(i.id),o=i.cache;if("loading"!==n.state||"stale"!==n.previous)throw yield t(i.id),a;if(null==o?void 0:o.staleIfError){const t="function"==typeof o.staleIfError?yield o.staleIfError(a.response,n,a):o.staleIfError;if(!0===t||"number"==typeof t&&n.createdAt+t>Date.now())return null===(r=e.waiting[i.id])||void 0===r||r.resolve(n.data),delete e.waiting[i.id],yield e.storage.set(i.id,{state:"stale",createdAt:Date.now(),data:n.data}),{cached:!0,config:i,id:i.id,data:n.data.data,headers:n.data.headers,status:n.data.status,statusText:n.data.statusText}}throw a}));return{onFulfilled:a,onRejected:i,apply:()=>e.interceptors.response.use(a,i)}}const p=Symbol(),v=e=>!!e&&!!e[p];function y({set:e,find:t,remove:a}){return{[p]:1,set:e,remove:a,get:i=>n(this,void 0,void 0,(function*(){const n=yield t(i);if(!n)return{state:"empty"};if("cached"!==n.state||n.createdAt+n.ttl>Date.now())return n;if(n.data.headers&&(r.ETag in n.data.headers||r.LastModified in n.data.headers||r.XAxiosCacheEtag in n.data.headers||r.XAxiosCacheStaleIfError in n.data.headers||r.XAxiosCacheLastModified in n.data.headers)){const t={state:"stale",createdAt:n.createdAt,data:n.data};return yield e(i,t),t}return yield a(i),{state:"empty"}}))}}function m(){const e=y({find:t=>e.data[t],set:(t,a)=>{e.data[t]=a},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}const b=require("object-code"),S=/^\/|\/$/g;function w(e,t){return a=>{if(a.id)return a.id;a.baseURL&&(a.baseURL=a.baseURL.replace(S,"")),a.url&&(a.url=a.url.replace(S,"")),a.method&&(a.method=a.method.toLowerCase());const r=t(a);return e?(0,b.code)(r).toString():r}}const x=w(!0,(({baseURL:e="",url:t="",method:a="get",params:r,data:i})=>({url:e+(e&&t?"/":"")+t,method:a,params:r,data:i})));function I(e,t={}){var a,r,n,o,d;const s=e;if(s.storage=t.storage||m(),!v(s.storage))throw new Error("Use buildStorage() function");return s.generateKey=t.generateKey||x,s.waiting=t.waiting||{},s.headerInterpreter=t.headerInterpreter||i,s.requestInterceptor=t.requestInterceptor||l(s),s.responseInterceptor=t.responseInterceptor||g(s),s.debug=t.debug,s.defaults.cache={ttl:null!==(a=t.ttl)&&void 0!==a?a:3e5,interpretHeader:null!==(r=t.interpretHeader)&&void 0!==r&&r,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null!==(n=t.etag)&&void 0!==n&&n,modifiedSince:null!==(o=t.modifiedSince)&&void 0!==o&&o,staleIfError:null!==(d=t.staleIfError)&&void 0!==d&&d,update:t.update||{}},s.requestInterceptor.apply(),s.responseInterceptor.apply(),s}function C(e,t=""){return y({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},set:(a,r)=>{e.setItem(t+a,JSON.stringify(r))},remove:a=>{e.removeItem(t+a)}})}module.exports=t})();
(()=>{"use strict";var e={d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Header:()=>r,buildKeyGenerator:()=>S,buildMemoryStorage:()=>m,buildStorage:()=>w,buildWebStorage:()=>x,createCacheResponse:()=>c,createValidateStatus:()=>n,defaultHeaderInterpreter:()=>i,defaultKeyGenerator:()=>b,defaultRequestInterceptor:()=>u,defaultResponseInterceptor:()=>h,isMethodIn:()=>o,isStorage:()=>p,setupCache:()=>I,testCachePredicate:()=>f,updateCache:()=>l,updateStaleRequest:()=>d});const a=require("cache-parser"),r=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),i=e=>{if(!e)return"not enough headers";const t=e[r.CacheControl];if(t){const{noCache:i,noStore:s,mustRevalidate:n,maxAge:o,immutable:d}=(0,a.parse)(String(t));if(i||s)return"dont cache";if(d)return 31536e6;if(n)return 0;if(o){const t=e[r.Age];return t?1e3*(o-Number(t)):1e3*o}}const i=e[r.Expires];if(i){const e=Date.parse(String(i))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"},s=require("fast-defer");function n(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function o(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function d(e,t){var a;t.headers||(t.headers={});const{etag:i,modifiedSince:s}=t.cache;if(i){const s=!0===i?null===(a=e.data)||void 0===a?void 0:a.headers[r.ETag]:i;s&&(t.headers[r.IfNoneMatch]=s)}s&&(t.headers[r.IfModifiedSince]=!0===s?e.data.headers[r.LastModified]||new Date(e.createdAt).toUTCString():s.toUTCString())}function c(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function u(e){const t=async t=>{var a;if(!1===t.cache)return t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!o(t.method,t.cache.methods))return t;const r=t.id=e.generateKey(t);let i,c=await e.storage.get(r);e:if("empty"===c.state||"stale"===c.state){if(e.waiting[r]){c=await e.storage.get(r);break e}return e.waiting[r]=(0,s.deferred)(),null===(a=e.waiting[r])||void 0===a||a.catch((()=>{})),await e.storage.set(r,{state:"loading",previous:c.state,data:c.data,createdAt:c.createdAt}),"stale"===c.state&&d(c,t),t.validateStatus=n(t.validateStatus),t}if("loading"===c.state){const a=e.waiting[r];if(!a)return await e.storage.remove(r),t;0;try{i=await a}catch(e){return t}}else i=c.data;return t.adapter=()=>Promise.resolve({config:t,data:i.data,headers:i.headers,status:i.status,statusText:i.statusText,cached:!0,id:r}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function f(e,t){var a;if("function"==typeof t)return t(e);const{statusCheck:r,responseMatch:i,containsHeaders:s}=t;if(r&&!await r(e.status)||i&&!await i(e))return!1;if(s)for(const t in s){const r=s[t];if(r&&!await r(null!==(a=e.headers[t.toLowerCase()])&&void 0!==a?a:e.headers[t]))return!1}return!0}async function l(e,t,a){for(const r in a){const i=a[r];if("delete"===i){await e.remove(r);continue}const s=await e.get(r);if("loading"===s.state)continue;const n=await i(s,t);"delete"!==n?"ignore"!==n&&await e.set(r,n):await e.remove(r)}}function h(e){const t=async t=>{var a;await e.storage.remove(t),null===(a=e.waiting[t])||void 0===a||a.reject(null),delete e.waiting[t]},a=async a=>{var i,s,n;if(a.id=null!==(i=(n=a.config).id)&&void 0!==i?i:n.id=e.generateKey(a.config),null!==(s=a.cached)&&void 0!==s||(a.cached=!1),a.cached)return a;if(!a.config.cache)return Object.assign(Object.assign({},a),{cached:!1});const o=a.config.cache,d=await e.storage.get(a.id);if("stale"===d.state||"empty"===d.state||"cached"===d.state)return a;if(!d.data&&!await f(a,o.cachePredicate))return await t(a.id),a;for(const e in r)e.startsWith("XAxiosCache")&&delete a.headers[e];o.etag&&!0!==o.etag&&(a.headers[r.XAxiosCacheEtag]=o.etag),o.modifiedSince&&(a.headers[r.XAxiosCacheLastModified]=!0===o.modifiedSince?"use-cache-timestamp":o.modifiedSince.toUTCString());let u=o.ttl||-1;if(null==o?void 0:o.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(a.id),a;u="not enough headers"===r?u:r}const h=c(a,d.data);"function"==typeof u&&(u=await u(a)),o.staleIfError&&(a.headers[r.XAxiosCacheStaleIfError]=String(u)),(null==o?void 0:o.update)&&await l(e.storage,a,o.update);const g={state:"cached",ttl:u,createdAt:Date.now(),data:h},p=e.waiting[a.id];return p&&(p.resolve(g.data),delete e.waiting[a.id]),await e.storage.set(a.id,g),a},i=async a=>{var r;const i=a.config;if(!i||!1===i.cache||!i.id)throw a;const s=await e.storage.get(i.id),n=i.cache;if("loading"!==s.state||"stale"!==s.previous)throw await t(i.id),a;if(null==n?void 0:n.staleIfError){const t="function"==typeof n.staleIfError?await n.staleIfError(a.response,s,a):n.staleIfError;if(!0===t||"number"==typeof t&&s.createdAt+t>Date.now())return null===(r=e.waiting[i.id])||void 0===r||r.resolve(s.data),delete e.waiting[i.id],await e.storage.set(i.id,{state:"stale",createdAt:Date.now(),data:s.data}),{cached:!0,config:i,id:i.id,data:s.data.data,headers:s.data.headers,status:s.data.status,statusText:s.data.statusText}}throw a};return{onFulfilled:a,onRejected:i,apply:()=>e.interceptors.response.use(a,i)}}const g=Symbol(),p=e=>!!e&&!!e[g];function w({set:e,find:t,remove:a}){return{[g]:1,set:e,remove:a,get:async i=>{const s=await t(i);if(!s)return{state:"empty"};if("cached"!==s.state||s.createdAt+s.ttl>Date.now())return s;if(s.data.headers&&(r.ETag in s.data.headers||r.LastModified in s.data.headers||r.XAxiosCacheEtag in s.data.headers||r.XAxiosCacheStaleIfError in s.data.headers||r.XAxiosCacheLastModified in s.data.headers)){const t={state:"stale",createdAt:s.createdAt,data:s.data};return await e(i,t),t}return await a(i),{state:"empty"}}}}function m(){const e=w({find:t=>e.data[t],set:(t,a)=>{e.data[t]=a},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}const v=require("object-code"),y=/^\/|\/$/g;function S(e,t){return a=>{if(a.id)return a.id;a.baseURL&&(a.baseURL=a.baseURL.replace(y,"")),a.url&&(a.url=a.url.replace(y,"")),a.method&&(a.method=a.method.toLowerCase());const r=t(a);return e?(0,v.code)(r).toString():r}}const b=S(!0,(({baseURL:e="",url:t="",method:a="get",params:r,data:i})=>({url:e+(e&&t?"/":"")+t,method:a,params:r,data:i})));function I(e,t={}){var a,r,s,n,o;const d=e;if(d.storage=t.storage||m(),!p(d.storage))throw new Error("Use buildStorage() function");return d.generateKey=t.generateKey||b,d.waiting=t.waiting||{},d.headerInterpreter=t.headerInterpreter||i,d.requestInterceptor=t.requestInterceptor||u(d),d.responseInterceptor=t.responseInterceptor||h(d),d.debug=t.debug,d.defaults.cache={ttl:null!==(a=t.ttl)&&void 0!==a?a:3e5,interpretHeader:null!==(r=t.interpretHeader)&&void 0!==r&&r,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null!==(s=t.etag)&&void 0!==s&&s,modifiedSince:null!==(n=t.modifiedSince)&&void 0!==n&&n,staleIfError:null!==(o=t.staleIfError)&&void 0!==o&&o,update:t.update||{}},d.requestInterceptor.apply(),d.responseInterceptor.apply(),d}function x(e,t=""){return w({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},set:(a,r)=>{e.setItem(t+a,JSON.stringify(r))},remove:a=>{e.removeItem(t+a)}})}module.exports=t})();

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

import*as e from"cache-parser";import*as t from"fast-defer";import*as a from"object-code";var r={d:(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},s={};r.d(s,{h4:()=>n,UN:()=>y,uu:()=>I,Kd:()=>b,ZF:()=>E,p:()=>g,E7:()=>c,NQ:()=>d,xK:()=>C,G6:()=>h,LN:()=>m,Ad:()=>u,$k:()=>w,v8:()=>A,Jk:()=>f,tI:()=>p,iS:()=>l});const i=(e=>{var t={};return r.d(t,e),t})({parse:()=>e.parse}),n=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),d=e=>{if(!e)return"not enough headers";const t=e[n.CacheControl];if(t){const{noCache:a,noStore:r,mustRevalidate:s,maxAge:d,immutable:o}=(0,i.parse)(String(t));if(a||r)return"dont cache";if(o)return 31536e6;if(s)return 0;if(d){const t=e[n.Age];return t?1e3*(d-Number(t)):1e3*d}}const a=e[n.Expires];if(a){const e=Date.parse(String(a))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"};const o=(e=>{var t={};return r.d(t,e),t})({deferred:()=>t.deferred});function c(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function u(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function l(e,t){var a;t.headers||(t.headers={});const{etag:r,modifiedSince:s}=t.cache;if(r){const s=!0===r?null===(a=e.data)||void 0===a?void 0:a.headers[n.ETag]:r;s&&(t.headers[n.IfNoneMatch]=s)}s&&(t.headers[n.IfModifiedSince]=!0===s?e.data.headers[n.LastModified]||new Date(e.createdAt).toUTCString():s.toUTCString())}function g(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function h(e){const t=async t=>{var a,r,s,i,n,d,g,h,f;if(!1===t.cache)return null===(a=e.debug)||void 0===a||a.call(e,{msg:"Ignoring cache because config.cache is false",data:t}),t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!u(t.method,t.cache.methods))return null===(r=e.debug)||void 0===r||r.call(e,{msg:`Ignored because method (${t.method}) is not in cache.methods (${t.cache.methods})`}),t;const p=t.id=e.generateKey(t);let m,v=await e.storage.get(p);e:if("empty"===v.state||"stale"===v.state){if(e.waiting[p]){v=await e.storage.get(p),null===(s=e.debug)||void 0===s||s.call(e,{id:p,msg:"Waiting list had an deferred for this key, waiting for it to finish"});break e}return e.waiting[p]=(0,o.deferred)(),null===(i=e.waiting[p])||void 0===i||i.catch((()=>{})),await e.storage.set(p,{state:"loading",previous:v.state,data:v.data,createdAt:v.createdAt}),"stale"===v.state&&(l(v,t),null===(n=e.debug)||void 0===n||n.call(e,{id:p,msg:"Updated stale request"})),t.validateStatus=c(t.validateStatus),null===(d=e.debug)||void 0===d||d.call(e,{id:p,msg:"Sending request, waiting for response"}),t}if("loading"===v.state){const a=e.waiting[p];if(!a)return await e.storage.remove(p),t;null===(g=e.debug)||void 0===g||g.call(e,{id:p,msg:"Detected concurrent request, waiting for it to finish"});try{m=await a}catch(a){return null===(h=e.debug)||void 0===h||h.call(e,{id:p,msg:"Deferred rejected, requesting again",data:a}),t}}else m=v.data;return t.adapter=()=>Promise.resolve({config:t,data:m.data,headers:m.headers,status:m.status,statusText:m.statusText,cached:!0,id:p}),null===(f=e.debug)||void 0===f||f.call(e,{id:p,msg:"Returning cached response"}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function f(e,t){var a;if("function"==typeof t)return t(e);const{statusCheck:r,responseMatch:s,containsHeaders:i}=t;if(r&&!await r(e.status)||s&&!await s(e))return!1;if(i)for(const t in i){const r=i[t];if(r&&!await r(null!==(a=e.headers[t.toLowerCase()])&&void 0!==a?a:e.headers[t]))return!1}return!0}async function p(e,t,a){for(const r in a){const s=a[r];if("delete"===s){await e.remove(r);continue}const i=await e.get(r);if("loading"===i.state)continue;const n=await s(i,t);"delete"!==n?"ignore"!==n&&await e.set(r,n):await e.remove(r)}}function m(e){const t=async t=>{var a;await e.storage.remove(t),null===(a=e.waiting[t])||void 0===a||a.reject(null),delete e.waiting[t]},a=async a=>{var r,s,i,d,o,c,u,l,h,m,v;if(a.id=null!==(r=(v=a.config).id)&&void 0!==r?r:v.id=e.generateKey(a.config),null!==(s=a.cached)&&void 0!==s||(a.cached=!1),a.cached)return null===(i=e.debug)||void 0===i||i.call(e,{id:a.id,msg:"Returned cached response"}),a;if(!a.config.cache)return null===(d=e.debug)||void 0===d||d.call(e,{id:a.id,msg:"Response with config.cache === false",data:a}),Object.assign(Object.assign({},a),{cached:!1});const w=a.config.cache,b=await e.storage.get(a.id);if("stale"===b.state||"empty"===b.state||"cached"===b.state)return null===(o=e.debug)||void 0===o||o.call(e,{id:a.id,msg:"Response not cached but storage is not loading",data:{cache:b,response:a}}),a;if(!b.data&&!await f(a,w.cachePredicate))return await t(a.id),null===(c=e.debug)||void 0===c||c.call(e,{id:a.id,msg:"Cache predicate rejected this response"}),a;for(const e in n)e.startsWith("XAxiosCache")&&delete a.headers[e];w.etag&&!0!==w.etag&&(a.headers[n.XAxiosCacheEtag]=w.etag),w.modifiedSince&&(a.headers[n.XAxiosCacheLastModified]=!0===w.modifiedSince?"use-cache-timestamp":w.modifiedSince.toUTCString());let I=w.ttl||-1;if(null==w?void 0:w.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(a.id),null===(u=e.debug)||void 0===u||u.call(e,{id:a.id,msg:"Cache header interpreted as 'dont cache'",data:{cache:b,response:a,expirationTime:r}}),a;I="not enough headers"===r?I:r}const S=g(a,b.data);"function"==typeof I&&(I=await I(a)),w.staleIfError&&(a.headers[n.XAxiosCacheStaleIfError]=String(I)),null===(l=e.debug)||void 0===l||l.call(e,{id:a.id,msg:"Useful response configuration found",data:{cacheConfig:w,ttl:I,cacheResponse:S}}),(null==w?void 0:w.update)&&await p(e.storage,a,w.update);const x={state:"cached",ttl:I,createdAt:Date.now(),data:S},y=e.waiting[a.id];return y&&(y.resolve(x.data),delete e.waiting[a.id],null===(h=e.debug)||void 0===h||h.call(e,{id:a.id,msg:"Found waiting deferred(s) and resolved them"})),await e.storage.set(a.id,x),null===(m=e.debug)||void 0===m||m.call(e,{id:a.id,msg:"Response cached",data:{cache:x,response:a}}),a},r=async a=>{var r,s,i,n,d,o;const c=a.config;if(!c||!1===c.cache||!c.id)throw null===(r=e.debug)||void 0===r||r.call(e,{msg:"Web request returned an error but cache handling is not enabled",data:{error:a,config:c}}),a;const u=await e.storage.get(c.id),l=c.cache;if("loading"!==u.state||"stale"!==u.previous)throw await t(c.id),null===(s=e.debug)||void 0===s||s.call(e,{msg:"Caught an error in the request interceptor",data:{error:a,config:c}}),a;if(null==l?void 0:l.staleIfError){const t="function"==typeof l.staleIfError?await l.staleIfError(a.response,u,a):l.staleIfError;if(null===(i=e.debug)||void 0===i||i.call(e,{msg:"Found cache if stale config for rejected response",data:{error:a,config:c,staleIfError:t}}),!0===t||"number"==typeof t&&u.createdAt+t>Date.now())return null===(n=e.waiting[c.id])||void 0===n||n.resolve(u.data),delete e.waiting[c.id],await e.storage.set(c.id,{state:"stale",createdAt:Date.now(),data:u.data}),null===(d=e.debug)||void 0===d||d.call(e,{msg:"staleIfError resolved this response with cached data",data:{error:a,config:c,cache:u}}),{cached:!0,config:c,id:c.id,data:u.data.data,headers:u.data.headers,status:u.data.status,statusText:u.data.statusText}}throw null===(o=e.debug)||void 0===o||o.call(e,{msg:"Received an unknown error that could not be handled",data:{error:a,config:c}}),a};return{onFulfilled:a,onRejected:r,apply:()=>e.interceptors.response.use(a,r)}}const v=Symbol(),w=e=>!!e&&!!e[v];function b({set:e,find:t,remove:a}){return{[v]:1,set:e,remove:a,get:async r=>{const s=await t(r);if(!s)return{state:"empty"};if("cached"!==s.state||s.createdAt+s.ttl>Date.now())return s;if(s.data.headers&&(n.ETag in s.data.headers||n.LastModified in s.data.headers||n.XAxiosCacheEtag in s.data.headers||n.XAxiosCacheStaleIfError in s.data.headers||n.XAxiosCacheLastModified in s.data.headers)){const t={state:"stale",createdAt:s.createdAt,data:s.data};return await e(r,t),t}return await a(r),{state:"empty"}}}}function I(){const e=b({find:t=>e.data[t],set:(t,a)=>{e.data[t]=a},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}const S=(e=>{var t={};return r.d(t,e),t})({code:()=>a.code}),x=/^\/|\/$/g;function y(e,t){return a=>{if(a.id)return a.id;a.baseURL&&(a.baseURL=a.baseURL.replace(x,"")),a.url&&(a.url=a.url.replace(x,"")),a.method&&(a.method=a.method.toLowerCase());const r=t(a);return e?(0,S.code)(r).toString():r}}const C=y(!0,(({baseURL:e="",url:t="",method:a="get",params:r,data:s})=>({url:e+(e&&t?"/":"")+t,method:a,params:r,data:s})));function A(e,t={}){var a,r,s,i,n;const o=e;if(o.storage=t.storage||I(),!w(o.storage))throw new Error("Use buildStorage() function");return o.generateKey=t.generateKey||C,o.waiting=t.waiting||{},o.headerInterpreter=t.headerInterpreter||d,o.requestInterceptor=t.requestInterceptor||h(o),o.responseInterceptor=t.responseInterceptor||m(o),o.debug=t.debug,o.defaults.cache={ttl:null!==(a=t.ttl)&&void 0!==a?a:3e5,interpretHeader:null!==(r=t.interpretHeader)&&void 0!==r&&r,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null!==(s=t.etag)&&void 0!==s&&s,modifiedSince:null!==(i=t.modifiedSince)&&void 0!==i&&i,staleIfError:null!==(n=t.staleIfError)&&void 0!==n&&n,update:t.update||{}},o.requestInterceptor.apply(),o.responseInterceptor.apply(),o}function E(e,t=""){return b({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},set:(a,r)=>{e.setItem(t+a,JSON.stringify(r))},remove:a=>{e.removeItem(t+a)}})}console.error("You are using a development build. Make sure to use the correct build in production"),console.error("https://axios-cache-interceptor.js.org/#/pages/installing");var j=s.h4,R=s.UN,L=s.uu,T=s.Kd,M=s.ZF,O=s.p,q=s.E7,U=s.NQ,N=s.xK,k=s.G6,K=s.LN,X=s.Ad,D=s.$k,P=s.v8,F=s.Jk,H=s.tI,$=s.iS;export{j as Header,R as buildKeyGenerator,L as buildMemoryStorage,T as buildStorage,M as buildWebStorage,O as createCacheResponse,q as createValidateStatus,U as defaultHeaderInterpreter,N as defaultKeyGenerator,k as defaultRequestInterceptor,K as defaultResponseInterceptor,X as isMethodIn,D as isStorage,P as setupCache,F as testCachePredicate,H as updateCache,$ as updateStaleRequest};
import*as e from"cache-parser";import*as t from"fast-defer";import*as a from"object-code";var r={d:(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},s={};r.d(s,{h4:()=>d,UN:()=>C,uu:()=>S,Kd:()=>I,ZF:()=>E,p:()=>h,E7:()=>c,NQ:()=>o,xK:()=>v,G6:()=>f,LN:()=>m,Ad:()=>u,$k:()=>b,v8:()=>A,Jk:()=>l,tI:()=>p,iS:()=>g});const i=(e=>{var t={};return r.d(t,e),t})({parse:()=>e.parse}),d=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),o=e=>{if(!e)return"not enough headers";const t=e[d.CacheControl];if(t){const{noCache:a,noStore:r,mustRevalidate:s,maxAge:o,immutable:n}=(0,i.parse)(String(t));if(a||r)return"dont cache";if(n)return 31536e6;if(s)return 0;if(o){const t=e[d.Age];return t?1e3*(o-Number(t)):1e3*o}}const a=e[d.Expires];if(a){const e=Date.parse(String(a))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"};const n=(e=>{var t={};return r.d(t,e),t})({deferred:()=>t.deferred});function c(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function u(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function g(e,t){t.headers||(t.headers={});const{etag:a,modifiedSince:r}=t.cache;if(a){const r=!0===a?e.data?.headers[d.ETag]:a;r&&(t.headers[d.IfNoneMatch]=r)}r&&(t.headers[d.IfModifiedSince]=!0===r?e.data.headers[d.LastModified]||new Date(e.createdAt).toUTCString():r.toUTCString())}function h(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers={...t.headers,...e.headers},t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function f(e){const t=async t=>{if(!1===t.cache)return e.debug?.({msg:"Ignoring cache because config.cache is false",data:t}),t;if(t.cache={...e.defaults.cache,...t.cache},!u(t.method,t.cache.methods))return e.debug?.({msg:`Ignored because method (${t.method}) is not in cache.methods (${t.cache.methods})`}),t;const a=t.id=e.generateKey(t);let r,s=await e.storage.get(a);e:if("empty"===s.state||"stale"===s.state){if(e.waiting[a]){s=await e.storage.get(a),e.debug?.({id:a,msg:"Waiting list had an deferred for this key, waiting for it to finish"});break e}return e.waiting[a]=(0,n.deferred)(),e.waiting[a]?.catch((()=>{})),await e.storage.set(a,{state:"loading",previous:s.state,data:s.data,createdAt:s.createdAt}),"stale"===s.state&&(g(s,t),e.debug?.({id:a,msg:"Updated stale request"})),t.validateStatus=c(t.validateStatus),e.debug?.({id:a,msg:"Sending request, waiting for response"}),t}if("loading"===s.state){const s=e.waiting[a];if(!s)return await e.storage.remove(a),t;e.debug?.({id:a,msg:"Detected concurrent request, waiting for it to finish"});try{r=await s}catch(r){return e.debug?.({id:a,msg:"Deferred rejected, requesting again",data:r}),t}}else r=s.data;return t.adapter=()=>Promise.resolve({config:t,data:r.data,headers:r.headers,status:r.status,statusText:r.statusText,cached:!0,id:a}),e.debug?.({id:a,msg:"Returning cached response"}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function l(e,t){if("function"==typeof t)return t(e);const{statusCheck:a,responseMatch:r,containsHeaders:s}=t;if(a&&!await a(e.status)||r&&!await r(e))return!1;if(s)for(const t in s){const a=s[t];if(a&&!await a(e.headers[t.toLowerCase()]??e.headers[t]))return!1}return!0}async function p(e,t,a){for(const r in a){const s=a[r];if("delete"===s){await e.remove(r);continue}const i=await e.get(r);if("loading"===i.state)continue;const d=await s(i,t);"delete"!==d?"ignore"!==d&&await e.set(r,d):await e.remove(r)}}function m(e){const t=async t=>{await e.storage.remove(t),e.waiting[t]?.reject(null),delete e.waiting[t]},a=async a=>{var r;if(a.id=(r=a.config).id??(r.id=e.generateKey(a.config)),a.cached??(a.cached=!1),a.cached)return e.debug?.({id:a.id,msg:"Returned cached response"}),a;if(!a.config.cache)return e.debug?.({id:a.id,msg:"Response with config.cache === false",data:a}),{...a,cached:!1};const s=a.config.cache,i=await e.storage.get(a.id);if("stale"===i.state||"empty"===i.state||"cached"===i.state)return e.debug?.({id:a.id,msg:"Response not cached but storage is not loading",data:{cache:i,response:a}}),a;if(!i.data&&!await l(a,s.cachePredicate))return await t(a.id),e.debug?.({id:a.id,msg:"Cache predicate rejected this response"}),a;for(const e in d)e.startsWith("XAxiosCache")&&delete a.headers[e];s.etag&&!0!==s.etag&&(a.headers[d.XAxiosCacheEtag]=s.etag),s.modifiedSince&&(a.headers[d.XAxiosCacheLastModified]=!0===s.modifiedSince?"use-cache-timestamp":s.modifiedSince.toUTCString());let o=s.ttl||-1;if(s?.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(a.id),e.debug?.({id:a.id,msg:"Cache header interpreted as 'dont cache'",data:{cache:i,response:a,expirationTime:r}}),a;o="not enough headers"===r?o:r}const n=h(a,i.data);"function"==typeof o&&(o=await o(a)),s.staleIfError&&(a.headers[d.XAxiosCacheStaleIfError]=String(o)),e.debug?.({id:a.id,msg:"Useful response configuration found",data:{cacheConfig:s,ttl:o,cacheResponse:n}}),s?.update&&await p(e.storage,a,s.update);const c={state:"cached",ttl:o,createdAt:Date.now(),data:n},u=e.waiting[a.id];return u&&(u.resolve(c.data),delete e.waiting[a.id],e.debug?.({id:a.id,msg:"Found waiting deferred(s) and resolved them"})),await e.storage.set(a.id,c),e.debug?.({id:a.id,msg:"Response cached",data:{cache:c,response:a}}),a},r=async a=>{const r=a.config;if(!r||!1===r.cache||!r.id)throw e.debug?.({msg:"Web request returned an error but cache handling is not enabled",data:{error:a,config:r}}),a;const s=await e.storage.get(r.id),i=r.cache;if("loading"!==s.state||"stale"!==s.previous)throw await t(r.id),e.debug?.({msg:"Caught an error in the request interceptor",data:{error:a,config:r}}),a;if(i?.staleIfError){const t="function"==typeof i.staleIfError?await i.staleIfError(a.response,s,a):i.staleIfError;if(e.debug?.({msg:"Found cache if stale config for rejected response",data:{error:a,config:r,staleIfError:t}}),!0===t||"number"==typeof t&&s.createdAt+t>Date.now())return e.waiting[r.id]?.resolve(s.data),delete e.waiting[r.id],await e.storage.set(r.id,{state:"stale",createdAt:Date.now(),data:s.data}),e.debug?.({msg:"staleIfError resolved this response with cached data",data:{error:a,config:r,cache:s}}),{cached:!0,config:r,id:r.id,data:s.data.data,headers:s.data.headers,status:s.data.status,statusText:s.data.statusText}}throw e.debug?.({msg:"Received an unknown error that could not be handled",data:{error:a,config:r}}),a};return{onFulfilled:a,onRejected:r,apply:()=>e.interceptors.response.use(a,r)}}const w=Symbol(),b=e=>!!e&&!!e[w];function I({set:e,find:t,remove:a}){return{[w]:1,set:e,remove:a,get:async r=>{const s=await t(r);if(!s)return{state:"empty"};if("cached"!==s.state||s.createdAt+s.ttl>Date.now())return s;if(s.data.headers&&(d.ETag in s.data.headers||d.LastModified in s.data.headers||d.XAxiosCacheEtag in s.data.headers||d.XAxiosCacheStaleIfError in s.data.headers||d.XAxiosCacheLastModified in s.data.headers)){const t={state:"stale",createdAt:s.createdAt,data:s.data};return await e(r,t),t}return await a(r),{state:"empty"}}}}function S(){const e=I({find:t=>e.data[t],set:(t,a)=>{e.data[t]=a},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}const x=(e=>{var t={};return r.d(t,e),t})({code:()=>a.code}),y=/^\/|\/$/g;function C(e,t){return a=>{if(a.id)return a.id;a.baseURL&&(a.baseURL=a.baseURL.replace(y,"")),a.url&&(a.url=a.url.replace(y,"")),a.method&&(a.method=a.method.toLowerCase());const r=t(a);return e?(0,x.code)(r).toString():r}}const v=C(!0,(({baseURL:e="",url:t="",method:a="get",params:r,data:s})=>({url:e+(e&&t?"/":"")+t,method:a,params:r,data:s})));function A(e,t={}){const a=e;if(a.storage=t.storage||S(),!b(a.storage))throw new Error("Use buildStorage() function");return a.generateKey=t.generateKey||v,a.waiting=t.waiting||{},a.headerInterpreter=t.headerInterpreter||o,a.requestInterceptor=t.requestInterceptor||f(a),a.responseInterceptor=t.responseInterceptor||m(a),a.debug=t.debug,a.defaults.cache={ttl:t.ttl??3e5,interpretHeader:t.interpretHeader??!1,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:t.etag??!1,modifiedSince:t.modifiedSince??!1,staleIfError:t.staleIfError??!1,update:t.update||{}},a.requestInterceptor.apply(),a.responseInterceptor.apply(),a}function E(e,t=""){return I({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},set:(a,r)=>{e.setItem(t+a,JSON.stringify(r))},remove:a=>{e.removeItem(t+a)}})}console.error("You are using a development build. Make sure to use the correct build in production"),console.error("https://axios-cache-interceptor.js.org/#/pages/installing");var R=s.h4,L=s.UN,T=s.uu,M=s.Kd,q=s.ZF,U=s.p,j=s.E7,N=s.NQ,k=s.xK,K=s.G6,X=s.LN,D=s.Ad,O=s.$k,P=s.v8,F=s.Jk,H=s.tI,$=s.iS;export{R as Header,L as buildKeyGenerator,T as buildMemoryStorage,M as buildStorage,q as buildWebStorage,U as createCacheResponse,j as createValidateStatus,N as defaultHeaderInterpreter,k as defaultKeyGenerator,K as defaultRequestInterceptor,X as defaultResponseInterceptor,D as isMethodIn,O as isStorage,P as setupCache,F as testCachePredicate,H as updateCache,$ as updateStaleRequest};
//# sourceMappingURL=dev.map

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

import*as e from"cache-parser";import*as t from"fast-defer";import*as a from"object-code";var r={d:(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},i={};r.d(i,{h4:()=>s,UN:()=>C,uu:()=>I,Kd:()=>S,ZF:()=>L,p:()=>h,E7:()=>u,NQ:()=>o,xK:()=>A,G6:()=>g,LN:()=>m,Ad:()=>l,$k:()=>x,v8:()=>E,Jk:()=>p,tI:()=>v,iS:()=>f});const n=(e=>{var t={};return r.d(t,e),t})({parse:()=>e.parse}),s=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),o=e=>{if(!e)return"not enough headers";const t=e[s.CacheControl];if(t){const{noCache:a,noStore:r,mustRevalidate:i,maxAge:o,immutable:d}=(0,n.parse)(String(t));if(a||r)return"dont cache";if(d)return 31536e6;if(i)return 0;if(o){const t=e[s.Age];return t?1e3*(o-Number(t)):1e3*o}}const a=e[s.Expires];if(a){const e=Date.parse(String(a))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"};function d(e,t,a,r){return new(a||(a=Promise))((function(i,n){function s(e){try{d(r.next(e))}catch(e){n(e)}}function o(e){try{d(r.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(s,o)}d((r=r.apply(e,t||[])).next())}))}Object.create;Object.create;const c=(e=>{var t={};return r.d(t,e),t})({deferred:()=>t.deferred});function u(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function l(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function f(e,t){var a;t.headers||(t.headers={});const{etag:r,modifiedSince:i}=t.cache;if(r){const i=!0===r?null===(a=e.data)||void 0===a?void 0:a.headers[s.ETag]:r;i&&(t.headers[s.IfNoneMatch]=i)}i&&(t.headers[s.IfModifiedSince]=!0===i?e.data.headers[s.LastModified]||new Date(e.createdAt).toUTCString():i.toUTCString())}function h(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function g(e){const t=t=>d(this,void 0,void 0,(function*(){var a;if(!1===t.cache)return t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!l(t.method,t.cache.methods))return t;const r=t.id=e.generateKey(t);let i,n=yield e.storage.get(r);e:if("empty"===n.state||"stale"===n.state){if(e.waiting[r]){n=yield e.storage.get(r);break e}return e.waiting[r]=(0,c.deferred)(),null===(a=e.waiting[r])||void 0===a||a.catch((()=>{})),yield e.storage.set(r,{state:"loading",previous:n.state,data:n.data,createdAt:n.createdAt}),"stale"===n.state&&f(n,t),t.validateStatus=u(t.validateStatus),t}if("loading"===n.state){const a=e.waiting[r];if(!a)return yield e.storage.remove(r),t;0;try{i=yield a}catch(e){return t}}else i=n.data;return t.adapter=()=>Promise.resolve({config:t,data:i.data,headers:i.headers,status:i.status,statusText:i.statusText,cached:!0,id:r}),t}));return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}function p(e,t){var a;return d(this,void 0,void 0,(function*(){if("function"==typeof t)return t(e);const{statusCheck:r,responseMatch:i,containsHeaders:n}=t;if(r&&!(yield r(e.status))||i&&!(yield i(e)))return!1;if(n)for(const t in n){const r=n[t];if(r&&!(yield r(null!==(a=e.headers[t.toLowerCase()])&&void 0!==a?a:e.headers[t])))return!1}return!0}))}function v(e,t,a){return d(this,void 0,void 0,(function*(){for(const r in a){const i=a[r];if("delete"===i){yield e.remove(r);continue}const n=yield e.get(r);if("loading"===n.state)continue;const s=yield i(n,t);"delete"!==s?"ignore"!==s&&(yield e.set(r,s)):yield e.remove(r)}}))}function m(e){const t=t=>d(this,void 0,void 0,(function*(){var a;yield e.storage.remove(t),null===(a=e.waiting[t])||void 0===a||a.reject(null),delete e.waiting[t]})),a=a=>d(this,void 0,void 0,(function*(){var r,i,n;if(a.id=null!==(r=(n=a.config).id)&&void 0!==r?r:n.id=e.generateKey(a.config),null!==(i=a.cached)&&void 0!==i||(a.cached=!1),a.cached)return a;if(!a.config.cache)return Object.assign(Object.assign({},a),{cached:!1});const o=a.config.cache,d=yield e.storage.get(a.id);if("stale"===d.state||"empty"===d.state||"cached"===d.state)return a;if(!d.data&&!(yield p(a,o.cachePredicate)))return yield t(a.id),a;for(const e in s)e.startsWith("XAxiosCache")&&delete a.headers[e];o.etag&&!0!==o.etag&&(a.headers[s.XAxiosCacheEtag]=o.etag),o.modifiedSince&&(a.headers[s.XAxiosCacheLastModified]=!0===o.modifiedSince?"use-cache-timestamp":o.modifiedSince.toUTCString());let c=o.ttl||-1;if(null==o?void 0:o.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return yield t(a.id),a;c="not enough headers"===r?c:r}const u=h(a,d.data);"function"==typeof c&&(c=yield c(a)),o.staleIfError&&(a.headers[s.XAxiosCacheStaleIfError]=String(c)),(null==o?void 0:o.update)&&(yield v(e.storage,a,o.update));const l={state:"cached",ttl:c,createdAt:Date.now(),data:u},f=e.waiting[a.id];return f&&(f.resolve(l.data),delete e.waiting[a.id]),yield e.storage.set(a.id,l),a})),r=a=>d(this,void 0,void 0,(function*(){var r;const i=a.config;if(!i||!1===i.cache||!i.id)throw a;const n=yield e.storage.get(i.id),s=i.cache;if("loading"!==n.state||"stale"!==n.previous)throw yield t(i.id),a;if(null==s?void 0:s.staleIfError){const t="function"==typeof s.staleIfError?yield s.staleIfError(a.response,n,a):s.staleIfError;if(!0===t||"number"==typeof t&&n.createdAt+t>Date.now())return null===(r=e.waiting[i.id])||void 0===r||r.resolve(n.data),delete e.waiting[i.id],yield e.storage.set(i.id,{state:"stale",createdAt:Date.now(),data:n.data}),{cached:!0,config:i,id:i.id,data:n.data.data,headers:n.data.headers,status:n.data.status,statusText:n.data.statusText}}throw a}));return{onFulfilled:a,onRejected:r,apply:()=>e.interceptors.response.use(a,r)}}const y=Symbol(),x=e=>!!e&&!!e[y];function S({set:e,find:t,remove:a}){return{[y]:1,set:e,remove:a,get:r=>d(this,void 0,void 0,(function*(){const i=yield t(r);if(!i)return{state:"empty"};if("cached"!==i.state||i.createdAt+i.ttl>Date.now())return i;if(i.data.headers&&(s.ETag in i.data.headers||s.LastModified in i.data.headers||s.XAxiosCacheEtag in i.data.headers||s.XAxiosCacheStaleIfError in i.data.headers||s.XAxiosCacheLastModified in i.data.headers)){const t={state:"stale",createdAt:i.createdAt,data:i.data};return yield e(r,t),t}return yield a(r),{state:"empty"}}))}}function I(){const e=S({find:t=>e.data[t],set:(t,a)=>{e.data[t]=a},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}const b=(e=>{var t={};return r.d(t,e),t})({code:()=>a.code}),w=/^\/|\/$/g;function C(e,t){return a=>{if(a.id)return a.id;a.baseURL&&(a.baseURL=a.baseURL.replace(w,"")),a.url&&(a.url=a.url.replace(w,"")),a.method&&(a.method=a.method.toLowerCase());const r=t(a);return e?(0,b.code)(r).toString():r}}const A=C(!0,(({baseURL:e="",url:t="",method:a="get",params:r,data:i})=>({url:e+(e&&t?"/":"")+t,method:a,params:r,data:i})));function E(e,t={}){var a,r,i,n,s;const d=e;if(d.storage=t.storage||I(),!x(d.storage))throw new Error("Use buildStorage() function");return d.generateKey=t.generateKey||A,d.waiting=t.waiting||{},d.headerInterpreter=t.headerInterpreter||o,d.requestInterceptor=t.requestInterceptor||g(d),d.responseInterceptor=t.responseInterceptor||m(d),d.debug=t.debug,d.defaults.cache={ttl:null!==(a=t.ttl)&&void 0!==a?a:3e5,interpretHeader:null!==(r=t.interpretHeader)&&void 0!==r&&r,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null!==(i=t.etag)&&void 0!==i&&i,modifiedSince:null!==(n=t.modifiedSince)&&void 0!==n&&n,staleIfError:null!==(s=t.staleIfError)&&void 0!==s&&s,update:t.update||{}},d.requestInterceptor.apply(),d.responseInterceptor.apply(),d}function L(e,t=""){return S({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},set:(a,r)=>{e.setItem(t+a,JSON.stringify(r))},remove:a=>{e.removeItem(t+a)}})}var j=i.h4,O=i.UN,T=i.uu,M=i.Kd,N=i.ZF,K=i.p,R=i.E7,U=i.NQ,X=i.xK,P=i.G6,k=i.LN,D=i.Ad,q=i.$k,H=i.v8,F=i.Jk,G=i.tI,J=i.iS;export{j as Header,O as buildKeyGenerator,T as buildMemoryStorage,M as buildStorage,N as buildWebStorage,K as createCacheResponse,R as createValidateStatus,U as defaultHeaderInterpreter,X as defaultKeyGenerator,P as defaultRequestInterceptor,k as defaultResponseInterceptor,D as isMethodIn,q as isStorage,H as setupCache,F as testCachePredicate,G as updateCache,J as updateStaleRequest};
import*as e from"cache-parser";import*as t from"fast-defer";import*as a from"object-code";var r={d:(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},s={};r.d(s,{h4:()=>n,UN:()=>b,uu:()=>y,Kd:()=>S,ZF:()=>E,p:()=>l,E7:()=>c,NQ:()=>o,xK:()=>C,G6:()=>h,LN:()=>w,Ad:()=>u,$k:()=>v,v8:()=>A,Jk:()=>g,tI:()=>p,iS:()=>f});const i=(e=>{var t={};return r.d(t,e),t})({parse:()=>e.parse}),n=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),o=e=>{if(!e)return"not enough headers";const t=e[n.CacheControl];if(t){const{noCache:a,noStore:r,mustRevalidate:s,maxAge:o,immutable:d}=(0,i.parse)(String(t));if(a||r)return"dont cache";if(d)return 31536e6;if(s)return 0;if(o){const t=e[n.Age];return t?1e3*(o-Number(t)):1e3*o}}const a=e[n.Expires];if(a){const e=Date.parse(String(a))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"};const d=(e=>{var t={};return r.d(t,e),t})({deferred:()=>t.deferred});function c(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function u(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function f(e,t){var a;t.headers||(t.headers={});const{etag:r,modifiedSince:s}=t.cache;if(r){const s=!0===r?null===(a=e.data)||void 0===a?void 0:a.headers[n.ETag]:r;s&&(t.headers[n.IfNoneMatch]=s)}s&&(t.headers[n.IfModifiedSince]=!0===s?e.data.headers[n.LastModified]||new Date(e.createdAt).toUTCString():s.toUTCString())}function l(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function h(e){const t=async t=>{var a;if(!1===t.cache)return t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!u(t.method,t.cache.methods))return t;const r=t.id=e.generateKey(t);let s,i=await e.storage.get(r);e:if("empty"===i.state||"stale"===i.state){if(e.waiting[r]){i=await e.storage.get(r);break e}return e.waiting[r]=(0,d.deferred)(),null===(a=e.waiting[r])||void 0===a||a.catch((()=>{})),await e.storage.set(r,{state:"loading",previous:i.state,data:i.data,createdAt:i.createdAt}),"stale"===i.state&&f(i,t),t.validateStatus=c(t.validateStatus),t}if("loading"===i.state){const a=e.waiting[r];if(!a)return await e.storage.remove(r),t;0;try{s=await a}catch(e){return t}}else s=i.data;return t.adapter=()=>Promise.resolve({config:t,data:s.data,headers:s.headers,status:s.status,statusText:s.statusText,cached:!0,id:r}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function g(e,t){var a;if("function"==typeof t)return t(e);const{statusCheck:r,responseMatch:s,containsHeaders:i}=t;if(r&&!await r(e.status)||s&&!await s(e))return!1;if(i)for(const t in i){const r=i[t];if(r&&!await r(null!==(a=e.headers[t.toLowerCase()])&&void 0!==a?a:e.headers[t]))return!1}return!0}async function p(e,t,a){for(const r in a){const s=a[r];if("delete"===s){await e.remove(r);continue}const i=await e.get(r);if("loading"===i.state)continue;const n=await s(i,t);"delete"!==n?"ignore"!==n&&await e.set(r,n):await e.remove(r)}}function w(e){const t=async t=>{var a;await e.storage.remove(t),null===(a=e.waiting[t])||void 0===a||a.reject(null),delete e.waiting[t]},a=async a=>{var r,s,i;if(a.id=null!==(r=(i=a.config).id)&&void 0!==r?r:i.id=e.generateKey(a.config),null!==(s=a.cached)&&void 0!==s||(a.cached=!1),a.cached)return a;if(!a.config.cache)return Object.assign(Object.assign({},a),{cached:!1});const o=a.config.cache,d=await e.storage.get(a.id);if("stale"===d.state||"empty"===d.state||"cached"===d.state)return a;if(!d.data&&!await g(a,o.cachePredicate))return await t(a.id),a;for(const e in n)e.startsWith("XAxiosCache")&&delete a.headers[e];o.etag&&!0!==o.etag&&(a.headers[n.XAxiosCacheEtag]=o.etag),o.modifiedSince&&(a.headers[n.XAxiosCacheLastModified]=!0===o.modifiedSince?"use-cache-timestamp":o.modifiedSince.toUTCString());let c=o.ttl||-1;if(null==o?void 0:o.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(a.id),a;c="not enough headers"===r?c:r}const u=l(a,d.data);"function"==typeof c&&(c=await c(a)),o.staleIfError&&(a.headers[n.XAxiosCacheStaleIfError]=String(c)),(null==o?void 0:o.update)&&await p(e.storage,a,o.update);const f={state:"cached",ttl:c,createdAt:Date.now(),data:u},h=e.waiting[a.id];return h&&(h.resolve(f.data),delete e.waiting[a.id]),await e.storage.set(a.id,f),a},r=async a=>{var r;const s=a.config;if(!s||!1===s.cache||!s.id)throw a;const i=await e.storage.get(s.id),n=s.cache;if("loading"!==i.state||"stale"!==i.previous)throw await t(s.id),a;if(null==n?void 0:n.staleIfError){const t="function"==typeof n.staleIfError?await n.staleIfError(a.response,i,a):n.staleIfError;if(!0===t||"number"==typeof t&&i.createdAt+t>Date.now())return null===(r=e.waiting[s.id])||void 0===r||r.resolve(i.data),delete e.waiting[s.id],await e.storage.set(s.id,{state:"stale",createdAt:Date.now(),data:i.data}),{cached:!0,config:s,id:s.id,data:i.data.data,headers:i.data.headers,status:i.data.status,statusText:i.data.statusText}}throw a};return{onFulfilled:a,onRejected:r,apply:()=>e.interceptors.response.use(a,r)}}const m=Symbol(),v=e=>!!e&&!!e[m];function S({set:e,find:t,remove:a}){return{[m]:1,set:e,remove:a,get:async r=>{const s=await t(r);if(!s)return{state:"empty"};if("cached"!==s.state||s.createdAt+s.ttl>Date.now())return s;if(s.data.headers&&(n.ETag in s.data.headers||n.LastModified in s.data.headers||n.XAxiosCacheEtag in s.data.headers||n.XAxiosCacheStaleIfError in s.data.headers||n.XAxiosCacheLastModified in s.data.headers)){const t={state:"stale",createdAt:s.createdAt,data:s.data};return await e(r,t),t}return await a(r),{state:"empty"}}}}function y(){const e=S({find:t=>e.data[t],set:(t,a)=>{e.data[t]=a},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}const I=(e=>{var t={};return r.d(t,e),t})({code:()=>a.code}),x=/^\/|\/$/g;function b(e,t){return a=>{if(a.id)return a.id;a.baseURL&&(a.baseURL=a.baseURL.replace(x,"")),a.url&&(a.url=a.url.replace(x,"")),a.method&&(a.method=a.method.toLowerCase());const r=t(a);return e?(0,I.code)(r).toString():r}}const C=b(!0,(({baseURL:e="",url:t="",method:a="get",params:r,data:s})=>({url:e+(e&&t?"/":"")+t,method:a,params:r,data:s})));function A(e,t={}){var a,r,s,i,n;const d=e;if(d.storage=t.storage||y(),!v(d.storage))throw new Error("Use buildStorage() function");return d.generateKey=t.generateKey||C,d.waiting=t.waiting||{},d.headerInterpreter=t.headerInterpreter||o,d.requestInterceptor=t.requestInterceptor||h(d),d.responseInterceptor=t.responseInterceptor||w(d),d.debug=t.debug,d.defaults.cache={ttl:null!==(a=t.ttl)&&void 0!==a?a:3e5,interpretHeader:null!==(r=t.interpretHeader)&&void 0!==r&&r,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null!==(s=t.etag)&&void 0!==s&&s,modifiedSince:null!==(i=t.modifiedSince)&&void 0!==i&&i,staleIfError:null!==(n=t.staleIfError)&&void 0!==n&&n,update:t.update||{}},d.requestInterceptor.apply(),d.responseInterceptor.apply(),d}function E(e,t=""){return S({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},set:(a,r)=>{e.setItem(t+a,JSON.stringify(r))},remove:a=>{e.removeItem(t+a)}})}var L=s.h4,T=s.UN,j=s.uu,M=s.Kd,O=s.ZF,N=s.p,K=s.E7,R=s.NQ,U=s.xK,X=s.G6,k=s.LN,D=s.Ad,P=s.$k,q=s.v8,H=s.Jk,F=s.tI,G=s.iS;export{L as Header,T as buildKeyGenerator,j as buildMemoryStorage,M as buildStorage,O as buildWebStorage,N as createCacheResponse,K as createValidateStatus,R as defaultHeaderInterpreter,U as defaultKeyGenerator,X as defaultRequestInterceptor,k as defaultResponseInterceptor,D as isMethodIn,P as isStorage,q as setupCache,H as testCachePredicate,F as updateCache,G as updateStaleRequest};

@@ -1,5 +0,3 @@

//@ts-check
/* eslint-disable */
/* eslint-disable @typescript-eslint/no-var-requires */
const { create: createAxios } = require('axios').default;

@@ -6,0 +4,0 @@ const { setupCache } = require('axios-cache-interceptor');

{
"name": "axios-cache-interceptor",
"version": "0.8.5",
"version": "0.8.8",
"description": "Cache interceptor for axios",

@@ -20,3 +20,3 @@ "main": "./cjs/index.js",

"build": "sh build/build.sh",
"test": "tsc --noEmit && jest --coverage",
"test": "jest --coverage",
"check": "sh build/check.sh",

@@ -40,13 +40,2 @@ "format": "prettier --write .",

],
"files": [
"LICENSE",
"README.md",
"tsconfig.json",
"umd/",
"cjs/",
"esm/",
"src/",
"types/",
"examples/"
],
"author": {

@@ -75,4 +64,4 @@ "name": "Arthur Fiorette",

"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"auto-changelog": "^2.3.0",
"@typescript-eslint/parser": "^5.11.0",
"auto-changelog": "^2.4.0",
"axios": "~0.25.0",

@@ -79,0 +68,0 @@ "es-check": "^6.1.1",

@@ -10,2 +10,3 @@ [![Issues](https://img.shields.io/github/issues/arthurfiorette/axios-cache-interceptor?logo=github&label=Issues)](https://github.com/arthurfiorette/axios-cache-interceptor/issues)

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Farthurfiorette%2Faxios-cache-interceptor.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Farthurfiorette%2Faxios-cache-interceptor?ref=badge_shield)
[![Join the chat at https://gitter.im/axios-cache-interceptor/community](https://badges.gitter.im/axios-cache-interceptor/community.svg)](https://gitter.im/axios-cache-interceptor/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

@@ -58,6 +59,6 @@ <br />

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Farthurfiorette%2Faxios-cache-interceptor.svg?type=small)](https://app.fossa.com/projects/git%2Bgithub.com%2Farthurfiorette%2Faxios-cache-interceptor?ref=badge_small)
<br />
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Farthurfiorette%2Faxios-cache-interceptor.svg?type=small)](https://app.fossa.com/projects/git%2Bgithub.com%2Farthurfiorette%2Faxios-cache-interceptor?ref=badge_small)
## Contact

@@ -64,0 +65,0 @@

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AxiosCacheInterceptor=t():e.AxiosCacheInterceptor=t()}("undefined"!=typeof self?self:this,(function(){return(()=>{var e={549:(e,t)=>{var a,r;a=t,r=Symbol("fast-defer"),a.deferred=function(){var e,t,a=new Promise((function(a,r){e=a,t=r}));return a.resolve=e,a.reject=t,a[r]=1,a},a.isDeferred=function(e){return!!e&&!!e[r]}},246:(e,t)=>{var a;(a=t).transform=function(e){var t=typeof e;if("object"===t&&e){if(e instanceof Date)return"#"+e.getTime();if(e instanceof RegExp)return"#"+e.toString();var r=Array.isArray(e)?[]:{};for(var n in e)r[n]=a.transform(e[n]);return"#"+String(e.constructor)+JSON.stringify(r,Object.keys(r).sort())}return t+String(e)+("symbol"===t?Math.random():"")},a.code=function(e){e=a.transform(e);for(var t=7,r=0;r<e.length;)t=31*t+e.charCodeAt(r++)&9007199254740991;return t}}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,a),i.exports}a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";a.r(r),a.d(r,{Header:()=>i,buildKeyGenerator:()=>S,buildMemoryStorage:()=>w,buildStorage:()=>b,buildWebStorage:()=>A,createCacheResponse:()=>l,createValidateStatus:()=>d,defaultHeaderInterpreter:()=>o,defaultKeyGenerator:()=>C,defaultRequestInterceptor:()=>f,defaultResponseInterceptor:()=>p,isMethodIn:()=>c,isStorage:()=>v,setupCache:()=>I,testCachePredicate:()=>g,updateCache:()=>h,updateStaleRequest:()=>u});var e=Symbol("cache-parser");function t(e){return("string"==typeof e||"number"==typeof e)&&(e=Number(e))>=0&&e<1/0}function n(e){return"number"==typeof e||!0===e||"string"==typeof e&&"false"!==e}const i=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),o=a=>{if(!a)return"not enough headers";const r=a[i.CacheControl];if(r){const{noCache:o,noStore:s,mustRevalidate:d,maxAge:c,immutable:u}=function(a){var r=Object.defineProperty({},e,{enumerable:!1,value:1});if(!a||"string"!=typeof a)return r;var i=function(e){var t=e.toLowerCase().replace(/\s+/g,"").split(","),a={};for(var r in t){var n=t[r].split("=",2);a[n[0]]=1===n.length||n[1]}return a}(a);return n(i.immutable)&&(r.immutable=!0),t(i["max-age"])&&(r.maxAge=Number(i["max-age"])),t(i["max-stale"])&&(r.maxStale=Number(i["max-stale"])),t(i["min-fresh"])&&(r.minFresh=Number(i["min-fresh"])),n(i["must-revalidate"])&&(r.mustRevalidate=!0),n(i["must-understand"])&&(r.mustUnderstand=!0),n(i["no-cache"])&&(r.noCache=!0),n(i["no-store"])&&(r.noStore=!0),n(i["no-transform"])&&(r.noTransform=!0),n(i["only-if-cached"])&&(r.onlyIfCached=!0),n(i.private)&&(r.private=!0),n(i["proxy-revalidate"])&&(r.proxyRevalidate=!0),n(i.public)&&(r.public=!0),t(i["s-maxage"])&&(r.sMaxAge=Number(i["s-maxage"])),t(i["stale-if-error"])&&(r.staleIfError=Number(i["stale-if-error"])),t(i["stale-while-revalidate"])&&(r.staleWhileRevalidate=Number(i["stale-while-revalidate"])),r}(String(r));if(o||s)return"dont cache";if(u)return 31536e6;if(d)return 0;if(c){const e=a[i.Age];return e?1e3*(c-Number(e)):1e3*c}}const o=a[i.Expires];if(o){const e=Date.parse(String(o))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"};var s=a(549);function d(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function c(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function u(e,t){var a;t.headers||(t.headers={});const{etag:r,modifiedSince:n}=t.cache;if(r){const n=!0===r?null===(a=e.data)||void 0===a?void 0:a.headers[i.ETag]:r;n&&(t.headers[i.IfNoneMatch]=n)}n&&(t.headers[i.IfModifiedSince]=!0===n?e.data.headers[i.LastModified]||new Date(e.createdAt).toUTCString():n.toUTCString())}function l(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function f(e){const t=async t=>{var a,r,n,i,o,l,f,g,h;if(!1===t.cache)return null===(a=e.debug)||void 0===a||a.call(e,{msg:"Ignoring cache because config.cache is false",data:t}),t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!c(t.method,t.cache.methods))return null===(r=e.debug)||void 0===r||r.call(e,{msg:`Ignored because method (${t.method}) is not in cache.methods (${t.cache.methods})`}),t;const p=t.id=e.generateKey(t);let m,v=await e.storage.get(p);e:if("empty"===v.state||"stale"===v.state){if(e.waiting[p]){v=await e.storage.get(p),null===(n=e.debug)||void 0===n||n.call(e,{id:p,msg:"Waiting list had an deferred for this key, waiting for it to finish"});break e}return e.waiting[p]=(0,s.deferred)(),null===(i=e.waiting[p])||void 0===i||i.catch((()=>{})),await e.storage.set(p,{state:"loading",previous:v.state,data:v.data,createdAt:v.createdAt}),"stale"===v.state&&(u(v,t),null===(o=e.debug)||void 0===o||o.call(e,{id:p,msg:"Updated stale request"})),t.validateStatus=d(t.validateStatus),null===(l=e.debug)||void 0===l||l.call(e,{id:p,msg:"Sending request, waiting for response"}),t}if("loading"===v.state){const a=e.waiting[p];if(!a)return await e.storage.remove(p),t;null===(f=e.debug)||void 0===f||f.call(e,{id:p,msg:"Detected concurrent request, waiting for it to finish"});try{m=await a}catch(a){return null===(g=e.debug)||void 0===g||g.call(e,{id:p,msg:"Deferred rejected, requesting again",data:a}),t}}else m=v.data;return t.adapter=()=>Promise.resolve({config:t,data:m.data,headers:m.headers,status:m.status,statusText:m.statusText,cached:!0,id:p}),null===(h=e.debug)||void 0===h||h.call(e,{id:p,msg:"Returning cached response"}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function g(e,t){var a;if("function"==typeof t)return t(e);const{statusCheck:r,responseMatch:n,containsHeaders:i}=t;if(r&&!await r(e.status)||n&&!await n(e))return!1;if(i)for(const t in i){const r=i[t];if(r&&!await r(null!==(a=e.headers[t.toLowerCase()])&&void 0!==a?a:e.headers[t]))return!1}return!0}async function h(e,t,a){for(const r in a){const n=a[r];if("delete"===n){await e.remove(r);continue}const i=await e.get(r);if("loading"===i.state)continue;const o=await n(i,t);"delete"!==o?"ignore"!==o&&await e.set(r,o):await e.remove(r)}}function p(e){const t=async t=>{var a;await e.storage.remove(t),null===(a=e.waiting[t])||void 0===a||a.reject(null),delete e.waiting[t]},a=async a=>{var r,n,o,s,d,c,u,f,p,m,v;if(a.id=null!==(r=(v=a.config).id)&&void 0!==r?r:v.id=e.generateKey(a.config),null!==(n=a.cached)&&void 0!==n||(a.cached=!1),a.cached)return null===(o=e.debug)||void 0===o||o.call(e,{id:a.id,msg:"Returned cached response"}),a;if(!a.config.cache)return null===(s=e.debug)||void 0===s||s.call(e,{id:a.id,msg:"Response with config.cache === false",data:a}),Object.assign(Object.assign({},a),{cached:!1});const b=a.config.cache,w=await e.storage.get(a.id);if("stale"===w.state||"empty"===w.state||"cached"===w.state)return null===(d=e.debug)||void 0===d||d.call(e,{id:a.id,msg:"Response not cached but storage is not loading",data:{cache:w,response:a}}),a;if(!w.data&&!await g(a,b.cachePredicate))return await t(a.id),null===(c=e.debug)||void 0===c||c.call(e,{id:a.id,msg:"Cache predicate rejected this response"}),a;for(const e in i)e.startsWith("XAxiosCache")&&delete a.headers[e];b.etag&&!0!==b.etag&&(a.headers[i.XAxiosCacheEtag]=b.etag),b.modifiedSince&&(a.headers[i.XAxiosCacheLastModified]=!0===b.modifiedSince?"use-cache-timestamp":b.modifiedSince.toUTCString());let y=b.ttl||-1;if(null==b?void 0:b.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(a.id),null===(u=e.debug)||void 0===u||u.call(e,{id:a.id,msg:"Cache header interpreted as 'dont cache'",data:{cache:w,response:a,expirationTime:r}}),a;y="not enough headers"===r?y:r}const x=l(a,w.data);"function"==typeof y&&(y=await y(a)),b.staleIfError&&(a.headers[i.XAxiosCacheStaleIfError]=String(y)),null===(f=e.debug)||void 0===f||f.call(e,{id:a.id,msg:"Useful response configuration found",data:{cacheConfig:b,ttl:y,cacheResponse:x}}),(null==b?void 0:b.update)&&await h(e.storage,a,b.update);const S={state:"cached",ttl:y,createdAt:Date.now(),data:x},C=e.waiting[a.id];return C&&(C.resolve(S.data),delete e.waiting[a.id],null===(p=e.debug)||void 0===p||p.call(e,{id:a.id,msg:"Found waiting deferred(s) and resolved them"})),await e.storage.set(a.id,S),null===(m=e.debug)||void 0===m||m.call(e,{id:a.id,msg:"Response cached",data:{cache:S,response:a}}),a},r=async a=>{var r,n,i,o,s,d;const c=a.config;if(!c||!1===c.cache||!c.id)throw null===(r=e.debug)||void 0===r||r.call(e,{msg:"Web request returned an error but cache handling is not enabled",data:{error:a,config:c}}),a;const u=await e.storage.get(c.id),l=c.cache;if("loading"!==u.state||"stale"!==u.previous)throw await t(c.id),null===(n=e.debug)||void 0===n||n.call(e,{msg:"Caught an error in the request interceptor",data:{error:a,config:c}}),a;if(null==l?void 0:l.staleIfError){const t="function"==typeof l.staleIfError?await l.staleIfError(a.response,u,a):l.staleIfError;if(null===(i=e.debug)||void 0===i||i.call(e,{msg:"Found cache if stale config for rejected response",data:{error:a,config:c,staleIfError:t}}),!0===t||"number"==typeof t&&u.createdAt+t>Date.now())return null===(o=e.waiting[c.id])||void 0===o||o.resolve(u.data),delete e.waiting[c.id],await e.storage.set(c.id,{state:"stale",createdAt:Date.now(),data:u.data}),null===(s=e.debug)||void 0===s||s.call(e,{msg:"staleIfError resolved this response with cached data",data:{error:a,config:c,cache:u}}),{cached:!0,config:c,id:c.id,data:u.data.data,headers:u.data.headers,status:u.data.status,statusText:u.data.statusText}}throw null===(d=e.debug)||void 0===d||d.call(e,{msg:"Received an unknown error that could not be handled",data:{error:a,config:c}}),a};return{onFulfilled:a,onRejected:r,apply:()=>e.interceptors.response.use(a,r)}}const m=Symbol(),v=e=>!!e&&!!e[m];function b({set:e,find:t,remove:a}){return{[m]:1,set:e,remove:a,get:async r=>{const n=await t(r);if(!n)return{state:"empty"};if("cached"!==n.state||n.createdAt+n.ttl>Date.now())return n;if(n.data.headers&&(i.ETag in n.data.headers||i.LastModified in n.data.headers||i.XAxiosCacheEtag in n.data.headers||i.XAxiosCacheStaleIfError in n.data.headers||i.XAxiosCacheLastModified in n.data.headers)){const t={state:"stale",createdAt:n.createdAt,data:n.data};return await e(r,t),t}return await a(r),{state:"empty"}}}}function w(){const e=b({find:t=>e.data[t],set:(t,a)=>{e.data[t]=a},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}var y=a(246);const x=/^\/|\/$/g;function S(e,t){return a=>{if(a.id)return a.id;a.baseURL&&(a.baseURL=a.baseURL.replace(x,"")),a.url&&(a.url=a.url.replace(x,"")),a.method&&(a.method=a.method.toLowerCase());const r=t(a);return e?(0,y.code)(r).toString():r}}const C=S(!0,(({baseURL:e="",url:t="",method:a="get",params:r,data:n})=>({url:e+(e&&t?"/":"")+t,method:a,params:r,data:n})));function I(e,t={}){var a,r,n,i,s;const d=e;if(d.storage=t.storage||w(),!v(d.storage))throw new Error("Use buildStorage() function");return d.generateKey=t.generateKey||C,d.waiting=t.waiting||{},d.headerInterpreter=t.headerInterpreter||o,d.requestInterceptor=t.requestInterceptor||f(d),d.responseInterceptor=t.responseInterceptor||p(d),d.debug=t.debug,d.defaults.cache={ttl:null!==(a=t.ttl)&&void 0!==a?a:3e5,interpretHeader:null!==(r=t.interpretHeader)&&void 0!==r&&r,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null!==(n=t.etag)&&void 0!==n&&n,modifiedSince:null!==(i=t.modifiedSince)&&void 0!==i&&i,staleIfError:null!==(s=t.staleIfError)&&void 0!==s&&s,update:t.update||{}},d.requestInterceptor.apply(),d.responseInterceptor.apply(),d}function A(e,t=""){return b({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},set:(a,r)=>{e.setItem(t+a,JSON.stringify(r))},remove:a=>{e.removeItem(t+a)}})}console.error("You are using a development build. Make sure to use the correct build in production"),console.error("https://axios-cache-interceptor.js.org/#/pages/installing")})(),r})()}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AxiosCacheInterceptor=t():e.AxiosCacheInterceptor=t()}("undefined"!=typeof self?self:this,(function(){return(()=>{var e={549:(e,t)=>{var a,r;a=t,r=Symbol("fast-defer"),a.deferred=function(){var e,t,a=new Promise((function(a,r){e=a,t=r}));return a.resolve=e,a.reject=t,a[r]=1,a},a.isDeferred=function(e){return!!e&&!!e[r]}},246:(e,t)=>{var a;(a=t).transform=function(e){var t=typeof e;if("object"===t&&e){if(e instanceof Date)return"#"+e.getTime();if(e instanceof RegExp)return"#"+e.toString();var r=Array.isArray(e)?[]:{};for(var n in e)r[n]=a.transform(e[n]);return"#"+String(e.constructor)+JSON.stringify(r,Object.keys(r).sort())}return t+String(e)+("symbol"===t?Math.random():"")},a.code=function(e){e=a.transform(e);for(var t=7,r=0;r<e.length;)t=31*t+e.charCodeAt(r++)&9007199254740991;return t}}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,a),o.exports}a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";a.r(r),a.d(r,{Header:()=>o,buildKeyGenerator:()=>S,buildMemoryStorage:()=>y,buildStorage:()=>w,buildWebStorage:()=>A,createCacheResponse:()=>f,createValidateStatus:()=>d,defaultHeaderInterpreter:()=>s,defaultKeyGenerator:()=>C,defaultRequestInterceptor:()=>g,defaultResponseInterceptor:()=>p,isMethodIn:()=>c,isStorage:()=>b,setupCache:()=>I,testCachePredicate:()=>h,updateCache:()=>l,updateStaleRequest:()=>u});var e=Symbol("cache-parser");function t(e){return("string"==typeof e||"number"==typeof e)&&(e=Number(e))>=0&&e<1/0}function n(e){return"number"==typeof e||!0===e||"string"==typeof e&&"false"!==e}const o=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),s=a=>{if(!a)return"not enough headers";const r=a[o.CacheControl];if(r){const{noCache:s,noStore:i,mustRevalidate:d,maxAge:c,immutable:u}=function(a){var r=Object.defineProperty({},e,{enumerable:!1,value:1});if(!a||"string"!=typeof a)return r;var o=function(e){var t=e.toLowerCase().replace(/\s+/g,"").split(","),a={};for(var r in t){var n=t[r].split("=",2);a[n[0]]=1===n.length||n[1]}return a}(a);return n(o.immutable)&&(r.immutable=!0),t(o["max-age"])&&(r.maxAge=Number(o["max-age"])),t(o["max-stale"])&&(r.maxStale=Number(o["max-stale"])),t(o["min-fresh"])&&(r.minFresh=Number(o["min-fresh"])),n(o["must-revalidate"])&&(r.mustRevalidate=!0),n(o["must-understand"])&&(r.mustUnderstand=!0),n(o["no-cache"])&&(r.noCache=!0),n(o["no-store"])&&(r.noStore=!0),n(o["no-transform"])&&(r.noTransform=!0),n(o["only-if-cached"])&&(r.onlyIfCached=!0),n(o.private)&&(r.private=!0),n(o["proxy-revalidate"])&&(r.proxyRevalidate=!0),n(o.public)&&(r.public=!0),t(o["s-maxage"])&&(r.sMaxAge=Number(o["s-maxage"])),t(o["stale-if-error"])&&(r.staleIfError=Number(o["stale-if-error"])),t(o["stale-while-revalidate"])&&(r.staleWhileRevalidate=Number(o["stale-while-revalidate"])),r}(String(r));if(s||i)return"dont cache";if(u)return 31536e6;if(d)return 0;if(c){const e=a[o.Age];return e?1e3*(c-Number(e)):1e3*c}}const s=a[o.Expires];if(s){const e=Date.parse(String(s))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"};var i=a(549);function d(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function c(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function u(e,t){t.headers||(t.headers={});const{etag:a,modifiedSince:r}=t.cache;if(a){const r=!0===a?e.data?.headers[o.ETag]:a;r&&(t.headers[o.IfNoneMatch]=r)}r&&(t.headers[o.IfModifiedSince]=!0===r?e.data.headers[o.LastModified]||new Date(e.createdAt).toUTCString():r.toUTCString())}function f(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers={...t.headers,...e.headers},t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function g(e){const t=async t=>{if(!1===t.cache)return e.debug?.({msg:"Ignoring cache because config.cache is false",data:t}),t;if(t.cache={...e.defaults.cache,...t.cache},!c(t.method,t.cache.methods))return e.debug?.({msg:`Ignored because method (${t.method}) is not in cache.methods (${t.cache.methods})`}),t;const a=t.id=e.generateKey(t);let r,n=await e.storage.get(a);e:if("empty"===n.state||"stale"===n.state){if(e.waiting[a]){n=await e.storage.get(a),e.debug?.({id:a,msg:"Waiting list had an deferred for this key, waiting for it to finish"});break e}return e.waiting[a]=(0,i.deferred)(),e.waiting[a]?.catch((()=>{})),await e.storage.set(a,{state:"loading",previous:n.state,data:n.data,createdAt:n.createdAt}),"stale"===n.state&&(u(n,t),e.debug?.({id:a,msg:"Updated stale request"})),t.validateStatus=d(t.validateStatus),e.debug?.({id:a,msg:"Sending request, waiting for response"}),t}if("loading"===n.state){const n=e.waiting[a];if(!n)return await e.storage.remove(a),t;e.debug?.({id:a,msg:"Detected concurrent request, waiting for it to finish"});try{r=await n}catch(r){return e.debug?.({id:a,msg:"Deferred rejected, requesting again",data:r}),t}}else r=n.data;return t.adapter=()=>Promise.resolve({config:t,data:r.data,headers:r.headers,status:r.status,statusText:r.statusText,cached:!0,id:a}),e.debug?.({id:a,msg:"Returning cached response"}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function h(e,t){if("function"==typeof t)return t(e);const{statusCheck:a,responseMatch:r,containsHeaders:n}=t;if(a&&!await a(e.status)||r&&!await r(e))return!1;if(n)for(const t in n){const a=n[t];if(a&&!await a(e.headers[t.toLowerCase()]??e.headers[t]))return!1}return!0}async function l(e,t,a){for(const r in a){const n=a[r];if("delete"===n){await e.remove(r);continue}const o=await e.get(r);if("loading"===o.state)continue;const s=await n(o,t);"delete"!==s?"ignore"!==s&&await e.set(r,s):await e.remove(r)}}function p(e){const t=async t=>{await e.storage.remove(t),e.waiting[t]?.reject(null),delete e.waiting[t]},a=async a=>{var r;if(a.id=(r=a.config).id??(r.id=e.generateKey(a.config)),a.cached??(a.cached=!1),a.cached)return e.debug?.({id:a.id,msg:"Returned cached response"}),a;if(!a.config.cache)return e.debug?.({id:a.id,msg:"Response with config.cache === false",data:a}),{...a,cached:!1};const n=a.config.cache,s=await e.storage.get(a.id);if("stale"===s.state||"empty"===s.state||"cached"===s.state)return e.debug?.({id:a.id,msg:"Response not cached but storage is not loading",data:{cache:s,response:a}}),a;if(!s.data&&!await h(a,n.cachePredicate))return await t(a.id),e.debug?.({id:a.id,msg:"Cache predicate rejected this response"}),a;for(const e in o)e.startsWith("XAxiosCache")&&delete a.headers[e];n.etag&&!0!==n.etag&&(a.headers[o.XAxiosCacheEtag]=n.etag),n.modifiedSince&&(a.headers[o.XAxiosCacheLastModified]=!0===n.modifiedSince?"use-cache-timestamp":n.modifiedSince.toUTCString());let i=n.ttl||-1;if(n?.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(a.id),e.debug?.({id:a.id,msg:"Cache header interpreted as 'dont cache'",data:{cache:s,response:a,expirationTime:r}}),a;i="not enough headers"===r?i:r}const d=f(a,s.data);"function"==typeof i&&(i=await i(a)),n.staleIfError&&(a.headers[o.XAxiosCacheStaleIfError]=String(i)),e.debug?.({id:a.id,msg:"Useful response configuration found",data:{cacheConfig:n,ttl:i,cacheResponse:d}}),n?.update&&await l(e.storage,a,n.update);const c={state:"cached",ttl:i,createdAt:Date.now(),data:d},u=e.waiting[a.id];return u&&(u.resolve(c.data),delete e.waiting[a.id],e.debug?.({id:a.id,msg:"Found waiting deferred(s) and resolved them"})),await e.storage.set(a.id,c),e.debug?.({id:a.id,msg:"Response cached",data:{cache:c,response:a}}),a},r=async a=>{const r=a.config;if(!r||!1===r.cache||!r.id)throw e.debug?.({msg:"Web request returned an error but cache handling is not enabled",data:{error:a,config:r}}),a;const n=await e.storage.get(r.id),o=r.cache;if("loading"!==n.state||"stale"!==n.previous)throw await t(r.id),e.debug?.({msg:"Caught an error in the request interceptor",data:{error:a,config:r}}),a;if(o?.staleIfError){const t="function"==typeof o.staleIfError?await o.staleIfError(a.response,n,a):o.staleIfError;if(e.debug?.({msg:"Found cache if stale config for rejected response",data:{error:a,config:r,staleIfError:t}}),!0===t||"number"==typeof t&&n.createdAt+t>Date.now())return e.waiting[r.id]?.resolve(n.data),delete e.waiting[r.id],await e.storage.set(r.id,{state:"stale",createdAt:Date.now(),data:n.data}),e.debug?.({msg:"staleIfError resolved this response with cached data",data:{error:a,config:r,cache:n}}),{cached:!0,config:r,id:r.id,data:n.data.data,headers:n.data.headers,status:n.data.status,statusText:n.data.statusText}}throw e.debug?.({msg:"Received an unknown error that could not be handled",data:{error:a,config:r}}),a};return{onFulfilled:a,onRejected:r,apply:()=>e.interceptors.response.use(a,r)}}const m=Symbol(),b=e=>!!e&&!!e[m];function w({set:e,find:t,remove:a}){return{[m]:1,set:e,remove:a,get:async r=>{const n=await t(r);if(!n)return{state:"empty"};if("cached"!==n.state||n.createdAt+n.ttl>Date.now())return n;if(n.data.headers&&(o.ETag in n.data.headers||o.LastModified in n.data.headers||o.XAxiosCacheEtag in n.data.headers||o.XAxiosCacheStaleIfError in n.data.headers||o.XAxiosCacheLastModified in n.data.headers)){const t={state:"stale",createdAt:n.createdAt,data:n.data};return await e(r,t),t}return await a(r),{state:"empty"}}}}function y(){const e=w({find:t=>e.data[t],set:(t,a)=>{e.data[t]=a},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}var v=a(246);const x=/^\/|\/$/g;function S(e,t){return a=>{if(a.id)return a.id;a.baseURL&&(a.baseURL=a.baseURL.replace(x,"")),a.url&&(a.url=a.url.replace(x,"")),a.method&&(a.method=a.method.toLowerCase());const r=t(a);return e?(0,v.code)(r).toString():r}}const C=S(!0,(({baseURL:e="",url:t="",method:a="get",params:r,data:n})=>({url:e+(e&&t?"/":"")+t,method:a,params:r,data:n})));function I(e,t={}){const a=e;if(a.storage=t.storage||y(),!b(a.storage))throw new Error("Use buildStorage() function");return a.generateKey=t.generateKey||C,a.waiting=t.waiting||{},a.headerInterpreter=t.headerInterpreter||s,a.requestInterceptor=t.requestInterceptor||g(a),a.responseInterceptor=t.responseInterceptor||p(a),a.debug=t.debug,a.defaults.cache={ttl:t.ttl??3e5,interpretHeader:t.interpretHeader??!1,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:t.etag??!1,modifiedSince:t.modifiedSince??!1,staleIfError:t.staleIfError??!1,update:t.update||{}},a.requestInterceptor.apply(),a.responseInterceptor.apply(),a}function A(e,t=""){return w({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},set:(a,r)=>{e.setItem(t+a,JSON.stringify(r))},remove:a=>{e.removeItem(t+a)}})}console.error("You are using a development build. Make sure to use the correct build in production"),console.error("https://axios-cache-interceptor.js.org/#/pages/installing")})(),r})()}));
//# sourceMappingURL=dev.map

@@ -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.AxiosCacheInterceptor=t():e.AxiosCacheInterceptor=t()}("undefined"!=typeof self?self:this,(function(){return(()=>{var e={549:(e,t)=>{var r,a;r=t,a=Symbol("fast-defer"),r.deferred=function(){var e,t,r=new Promise((function(r,a){e=r,t=a}));return r.resolve=e,r.reject=t,r[a]=1,r},r.isDeferred=function(e){return!!e&&!!e[a]}},246:(e,t)=>{var r;(r=t).transform=function(e){var t=typeof e;if("object"===t&&e){if(e instanceof Date)return"#"+e.getTime();if(e instanceof RegExp)return"#"+e.toString();var a=Array.isArray(e)?[]:{};for(var n in e)a[n]=r.transform(e[n]);return"#"+String(e.constructor)+JSON.stringify(a,Object.keys(a).sort())}return t+String(e)+("symbol"===t?Math.random():"")},r.code=function(e){e=r.transform(e);for(var t=7,a=0;a<e.length;)t=31*t+e.charCodeAt(a++)&9007199254740991;return t}}},t={};function r(a){var n=t[a];if(void 0!==n)return n.exports;var i=t[a]={exports:{}};return e[a](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{"use strict";r.r(a),r.d(a,{Header:()=>i,buildKeyGenerator:()=>C,buildMemoryStorage:()=>x,buildStorage:()=>b,buildWebStorage:()=>j,createCacheResponse:()=>l,createValidateStatus:()=>c,defaultHeaderInterpreter:()=>o,defaultKeyGenerator:()=>I,defaultRequestInterceptor:()=>h,defaultResponseInterceptor:()=>m,isMethodIn:()=>u,isStorage:()=>y,setupCache:()=>A,testCachePredicate:()=>g,updateCache:()=>p,updateStaleRequest:()=>f});var e=Symbol("cache-parser");function t(e){return("string"==typeof e||"number"==typeof e)&&(e=Number(e))>=0&&e<1/0}function n(e){return"number"==typeof e||!0===e||"string"==typeof e&&"false"!==e}const i=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),o=r=>{if(!r)return"not enough headers";const a=r[i.CacheControl];if(a){const{noCache:o,noStore:s,mustRevalidate:d,maxAge:c,immutable:u}=function(r){var a=Object.defineProperty({},e,{enumerable:!1,value:1});if(!r||"string"!=typeof r)return a;var i=function(e){var t=e.toLowerCase().replace(/\s+/g,"").split(","),r={};for(var a in t){var n=t[a].split("=",2);r[n[0]]=1===n.length||n[1]}return r}(r);return n(i.immutable)&&(a.immutable=!0),t(i["max-age"])&&(a.maxAge=Number(i["max-age"])),t(i["max-stale"])&&(a.maxStale=Number(i["max-stale"])),t(i["min-fresh"])&&(a.minFresh=Number(i["min-fresh"])),n(i["must-revalidate"])&&(a.mustRevalidate=!0),n(i["must-understand"])&&(a.mustUnderstand=!0),n(i["no-cache"])&&(a.noCache=!0),n(i["no-store"])&&(a.noStore=!0),n(i["no-transform"])&&(a.noTransform=!0),n(i["only-if-cached"])&&(a.onlyIfCached=!0),n(i.private)&&(a.private=!0),n(i["proxy-revalidate"])&&(a.proxyRevalidate=!0),n(i.public)&&(a.public=!0),t(i["s-maxage"])&&(a.sMaxAge=Number(i["s-maxage"])),t(i["stale-if-error"])&&(a.staleIfError=Number(i["stale-if-error"])),t(i["stale-while-revalidate"])&&(a.staleWhileRevalidate=Number(i["stale-while-revalidate"])),a}(String(a));if(o||s)return"dont cache";if(u)return 31536e6;if(d)return 0;if(c){const e=r[i.Age];return e?1e3*(c-Number(e)):1e3*c}}const o=r[i.Expires];if(o){const e=Date.parse(String(o))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"};function s(e,t,r,a){return new(r||(r=Promise))((function(n,i){function o(e){try{d(a.next(e))}catch(e){i(e)}}function s(e){try{d(a.throw(e))}catch(e){i(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}d((a=a.apply(e,t||[])).next())}))}Object.create;Object.create;var d=r(549);function c(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function u(e="get",t=[]){e=e.toLowerCase();for(const r of t)if(r.toLowerCase()===e)return!0;return!1}function f(e,t){var r;t.headers||(t.headers={});const{etag:a,modifiedSince:n}=t.cache;if(a){const n=!0===a?null===(r=e.data)||void 0===r?void 0:r.headers[i.ETag]:a;n&&(t.headers[i.IfNoneMatch]=n)}n&&(t.headers[i.IfModifiedSince]=!0===n?e.data.headers[i.LastModified]||new Date(e.createdAt).toUTCString():n.toUTCString())}function l(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function h(e){const t=t=>s(this,void 0,void 0,(function*(){var r;if(!1===t.cache)return t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!u(t.method,t.cache.methods))return t;const a=t.id=e.generateKey(t);let n,i=yield e.storage.get(a);e:if("empty"===i.state||"stale"===i.state){if(e.waiting[a]){i=yield e.storage.get(a);break e}return e.waiting[a]=(0,d.deferred)(),null===(r=e.waiting[a])||void 0===r||r.catch((()=>{})),yield e.storage.set(a,{state:"loading",previous:i.state,data:i.data,createdAt:i.createdAt}),"stale"===i.state&&f(i,t),t.validateStatus=c(t.validateStatus),t}if("loading"===i.state){const r=e.waiting[a];if(!r)return yield e.storage.remove(a),t;0;try{n=yield r}catch(e){return t}}else n=i.data;return t.adapter=()=>Promise.resolve({config:t,data:n.data,headers:n.headers,status:n.status,statusText:n.statusText,cached:!0,id:a}),t}));return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}function g(e,t){var r;return s(this,void 0,void 0,(function*(){if("function"==typeof t)return t(e);const{statusCheck:a,responseMatch:n,containsHeaders:i}=t;if(a&&!(yield a(e.status))||n&&!(yield n(e)))return!1;if(i)for(const t in i){const a=i[t];if(a&&!(yield a(null!==(r=e.headers[t.toLowerCase()])&&void 0!==r?r:e.headers[t])))return!1}return!0}))}function p(e,t,r){return s(this,void 0,void 0,(function*(){for(const a in r){const n=r[a];if("delete"===n){yield e.remove(a);continue}const i=yield e.get(a);if("loading"===i.state)continue;const o=yield n(i,t);"delete"!==o?"ignore"!==o&&(yield e.set(a,o)):yield e.remove(a)}}))}function m(e){const t=t=>s(this,void 0,void 0,(function*(){var r;yield e.storage.remove(t),null===(r=e.waiting[t])||void 0===r||r.reject(null),delete e.waiting[t]})),r=r=>s(this,void 0,void 0,(function*(){var a,n,o;if(r.id=null!==(a=(o=r.config).id)&&void 0!==a?a:o.id=e.generateKey(r.config),null!==(n=r.cached)&&void 0!==n||(r.cached=!1),r.cached)return r;if(!r.config.cache)return Object.assign(Object.assign({},r),{cached:!1});const s=r.config.cache,d=yield e.storage.get(r.id);if("stale"===d.state||"empty"===d.state||"cached"===d.state)return r;if(!d.data&&!(yield g(r,s.cachePredicate)))return yield t(r.id),r;for(const e in i)e.startsWith("XAxiosCache")&&delete r.headers[e];s.etag&&!0!==s.etag&&(r.headers[i.XAxiosCacheEtag]=s.etag),s.modifiedSince&&(r.headers[i.XAxiosCacheLastModified]=!0===s.modifiedSince?"use-cache-timestamp":s.modifiedSince.toUTCString());let c=s.ttl||-1;if(null==s?void 0:s.interpretHeader){const a=e.headerInterpreter(r.headers);if("dont cache"===a)return yield t(r.id),r;c="not enough headers"===a?c:a}const u=l(r,d.data);"function"==typeof c&&(c=yield c(r)),s.staleIfError&&(r.headers[i.XAxiosCacheStaleIfError]=String(c)),(null==s?void 0:s.update)&&(yield p(e.storage,r,s.update));const f={state:"cached",ttl:c,createdAt:Date.now(),data:u},h=e.waiting[r.id];return h&&(h.resolve(f.data),delete e.waiting[r.id]),yield e.storage.set(r.id,f),r})),a=r=>s(this,void 0,void 0,(function*(){var a;const n=r.config;if(!n||!1===n.cache||!n.id)throw r;const i=yield e.storage.get(n.id),o=n.cache;if("loading"!==i.state||"stale"!==i.previous)throw yield t(n.id),r;if(null==o?void 0:o.staleIfError){const t="function"==typeof o.staleIfError?yield o.staleIfError(r.response,i,r):o.staleIfError;if(!0===t||"number"==typeof t&&i.createdAt+t>Date.now())return null===(a=e.waiting[n.id])||void 0===a||a.resolve(i.data),delete e.waiting[n.id],yield e.storage.set(n.id,{state:"stale",createdAt:Date.now(),data:i.data}),{cached:!0,config:n,id:n.id,data:i.data.data,headers:i.data.headers,status:i.data.status,statusText:i.data.statusText}}throw r}));return{onFulfilled:r,onRejected:a,apply:()=>e.interceptors.response.use(r,a)}}const v=Symbol(),y=e=>!!e&&!!e[v];function b({set:e,find:t,remove:r}){return{[v]:1,set:e,remove:r,get:a=>s(this,void 0,void 0,(function*(){const n=yield t(a);if(!n)return{state:"empty"};if("cached"!==n.state||n.createdAt+n.ttl>Date.now())return n;if(n.data.headers&&(i.ETag in n.data.headers||i.LastModified in n.data.headers||i.XAxiosCacheEtag in n.data.headers||i.XAxiosCacheStaleIfError in n.data.headers||i.XAxiosCacheLastModified in n.data.headers)){const t={state:"stale",createdAt:n.createdAt,data:n.data};return yield e(a,t),t}return yield r(a),{state:"empty"}}))}}function x(){const e=b({find:t=>e.data[t],set:(t,r)=>{e.data[t]=r},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}var S=r(246);const w=/^\/|\/$/g;function C(e,t){return r=>{if(r.id)return r.id;r.baseURL&&(r.baseURL=r.baseURL.replace(w,"")),r.url&&(r.url=r.url.replace(w,"")),r.method&&(r.method=r.method.toLowerCase());const a=t(r);return e?(0,S.code)(a).toString():a}}const I=C(!0,(({baseURL:e="",url:t="",method:r="get",params:a,data:n})=>({url:e+(e&&t?"/":"")+t,method:r,params:a,data:n})));function A(e,t={}){var r,a,n,i,s;const d=e;if(d.storage=t.storage||x(),!y(d.storage))throw new Error("Use buildStorage() function");return d.generateKey=t.generateKey||I,d.waiting=t.waiting||{},d.headerInterpreter=t.headerInterpreter||o,d.requestInterceptor=t.requestInterceptor||h(d),d.responseInterceptor=t.responseInterceptor||m(d),d.debug=t.debug,d.defaults.cache={ttl:null!==(r=t.ttl)&&void 0!==r?r:3e5,interpretHeader:null!==(a=t.interpretHeader)&&void 0!==a&&a,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null!==(n=t.etag)&&void 0!==n&&n,modifiedSince:null!==(i=t.modifiedSince)&&void 0!==i&&i,staleIfError:null!==(s=t.staleIfError)&&void 0!==s&&s,update:t.update||{}},d.requestInterceptor.apply(),d.responseInterceptor.apply(),d}function j(e,t=""){return b({find:r=>{const a=e.getItem(t+r);return a?JSON.parse(a):void 0},set:(r,a)=>{e.setItem(t+r,JSON.stringify(a))},remove:r=>{e.removeItem(t+r)}})}})(),a})()}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AxiosCacheInterceptor=t():e.AxiosCacheInterceptor=t()}("undefined"!=typeof self?self:this,(function(){return(()=>{var e={549:(e,t)=>{var a,r;a=t,r=Symbol("fast-defer"),a.deferred=function(){var e,t,a=new Promise((function(a,r){e=a,t=r}));return a.resolve=e,a.reject=t,a[r]=1,a},a.isDeferred=function(e){return!!e&&!!e[r]}},246:(e,t)=>{var a;(a=t).transform=function(e){var t=typeof e;if("object"===t&&e){if(e instanceof Date)return"#"+e.getTime();if(e instanceof RegExp)return"#"+e.toString();var r=Array.isArray(e)?[]:{};for(var n in e)r[n]=a.transform(e[n]);return"#"+String(e.constructor)+JSON.stringify(r,Object.keys(r).sort())}return t+String(e)+("symbol"===t?Math.random():"")},a.code=function(e){e=a.transform(e);for(var t=7,r=0;r<e.length;)t=31*t+e.charCodeAt(r++)&9007199254740991;return t}}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,a),i.exports}a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";a.r(r),a.d(r,{Header:()=>i,buildKeyGenerator:()=>S,buildMemoryStorage:()=>w,buildStorage:()=>y,buildWebStorage:()=>A,createCacheResponse:()=>f,createValidateStatus:()=>d,defaultHeaderInterpreter:()=>o,defaultKeyGenerator:()=>C,defaultRequestInterceptor:()=>l,defaultResponseInterceptor:()=>p,isMethodIn:()=>c,isStorage:()=>v,setupCache:()=>I,testCachePredicate:()=>h,updateCache:()=>g,updateStaleRequest:()=>u});var e=Symbol("cache-parser");function t(e){return("string"==typeof e||"number"==typeof e)&&(e=Number(e))>=0&&e<1/0}function n(e){return"number"==typeof e||!0===e||"string"==typeof e&&"false"!==e}const i=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),o=a=>{if(!a)return"not enough headers";const r=a[i.CacheControl];if(r){const{noCache:o,noStore:s,mustRevalidate:d,maxAge:c,immutable:u}=function(a){var r=Object.defineProperty({},e,{enumerable:!1,value:1});if(!a||"string"!=typeof a)return r;var i=function(e){var t=e.toLowerCase().replace(/\s+/g,"").split(","),a={};for(var r in t){var n=t[r].split("=",2);a[n[0]]=1===n.length||n[1]}return a}(a);return n(i.immutable)&&(r.immutable=!0),t(i["max-age"])&&(r.maxAge=Number(i["max-age"])),t(i["max-stale"])&&(r.maxStale=Number(i["max-stale"])),t(i["min-fresh"])&&(r.minFresh=Number(i["min-fresh"])),n(i["must-revalidate"])&&(r.mustRevalidate=!0),n(i["must-understand"])&&(r.mustUnderstand=!0),n(i["no-cache"])&&(r.noCache=!0),n(i["no-store"])&&(r.noStore=!0),n(i["no-transform"])&&(r.noTransform=!0),n(i["only-if-cached"])&&(r.onlyIfCached=!0),n(i.private)&&(r.private=!0),n(i["proxy-revalidate"])&&(r.proxyRevalidate=!0),n(i.public)&&(r.public=!0),t(i["s-maxage"])&&(r.sMaxAge=Number(i["s-maxage"])),t(i["stale-if-error"])&&(r.staleIfError=Number(i["stale-if-error"])),t(i["stale-while-revalidate"])&&(r.staleWhileRevalidate=Number(i["stale-while-revalidate"])),r}(String(r));if(o||s)return"dont cache";if(u)return 31536e6;if(d)return 0;if(c){const e=a[i.Age];return e?1e3*(c-Number(e)):1e3*c}}const o=a[i.Expires];if(o){const e=Date.parse(String(o))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"};var s=a(549);function d(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function c(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function u(e,t){var a;t.headers||(t.headers={});const{etag:r,modifiedSince:n}=t.cache;if(r){const n=!0===r?null===(a=e.data)||void 0===a?void 0:a.headers[i.ETag]:r;n&&(t.headers[i.IfNoneMatch]=n)}n&&(t.headers[i.IfModifiedSince]=!0===n?e.data.headers[i.LastModified]||new Date(e.createdAt).toUTCString():n.toUTCString())}function f(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function l(e){const t=async t=>{var a;if(!1===t.cache)return t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!c(t.method,t.cache.methods))return t;const r=t.id=e.generateKey(t);let n,i=await e.storage.get(r);e:if("empty"===i.state||"stale"===i.state){if(e.waiting[r]){i=await e.storage.get(r);break e}return e.waiting[r]=(0,s.deferred)(),null===(a=e.waiting[r])||void 0===a||a.catch((()=>{})),await e.storage.set(r,{state:"loading",previous:i.state,data:i.data,createdAt:i.createdAt}),"stale"===i.state&&u(i,t),t.validateStatus=d(t.validateStatus),t}if("loading"===i.state){const a=e.waiting[r];if(!a)return await e.storage.remove(r),t;0;try{n=await a}catch(e){return t}}else n=i.data;return t.adapter=()=>Promise.resolve({config:t,data:n.data,headers:n.headers,status:n.status,statusText:n.statusText,cached:!0,id:r}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function h(e,t){var a;if("function"==typeof t)return t(e);const{statusCheck:r,responseMatch:n,containsHeaders:i}=t;if(r&&!await r(e.status)||n&&!await n(e))return!1;if(i)for(const t in i){const r=i[t];if(r&&!await r(null!==(a=e.headers[t.toLowerCase()])&&void 0!==a?a:e.headers[t]))return!1}return!0}async function g(e,t,a){for(const r in a){const n=a[r];if("delete"===n){await e.remove(r);continue}const i=await e.get(r);if("loading"===i.state)continue;const o=await n(i,t);"delete"!==o?"ignore"!==o&&await e.set(r,o):await e.remove(r)}}function p(e){const t=async t=>{var a;await e.storage.remove(t),null===(a=e.waiting[t])||void 0===a||a.reject(null),delete e.waiting[t]},a=async a=>{var r,n,o;if(a.id=null!==(r=(o=a.config).id)&&void 0!==r?r:o.id=e.generateKey(a.config),null!==(n=a.cached)&&void 0!==n||(a.cached=!1),a.cached)return a;if(!a.config.cache)return Object.assign(Object.assign({},a),{cached:!1});const s=a.config.cache,d=await e.storage.get(a.id);if("stale"===d.state||"empty"===d.state||"cached"===d.state)return a;if(!d.data&&!await h(a,s.cachePredicate))return await t(a.id),a;for(const e in i)e.startsWith("XAxiosCache")&&delete a.headers[e];s.etag&&!0!==s.etag&&(a.headers[i.XAxiosCacheEtag]=s.etag),s.modifiedSince&&(a.headers[i.XAxiosCacheLastModified]=!0===s.modifiedSince?"use-cache-timestamp":s.modifiedSince.toUTCString());let c=s.ttl||-1;if(null==s?void 0:s.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(a.id),a;c="not enough headers"===r?c:r}const u=f(a,d.data);"function"==typeof c&&(c=await c(a)),s.staleIfError&&(a.headers[i.XAxiosCacheStaleIfError]=String(c)),(null==s?void 0:s.update)&&await g(e.storage,a,s.update);const l={state:"cached",ttl:c,createdAt:Date.now(),data:u},p=e.waiting[a.id];return p&&(p.resolve(l.data),delete e.waiting[a.id]),await e.storage.set(a.id,l),a},r=async a=>{var r;const n=a.config;if(!n||!1===n.cache||!n.id)throw a;const i=await e.storage.get(n.id),o=n.cache;if("loading"!==i.state||"stale"!==i.previous)throw await t(n.id),a;if(null==o?void 0:o.staleIfError){const t="function"==typeof o.staleIfError?await o.staleIfError(a.response,i,a):o.staleIfError;if(!0===t||"number"==typeof t&&i.createdAt+t>Date.now())return null===(r=e.waiting[n.id])||void 0===r||r.resolve(i.data),delete e.waiting[n.id],await e.storage.set(n.id,{state:"stale",createdAt:Date.now(),data:i.data}),{cached:!0,config:n,id:n.id,data:i.data.data,headers:i.data.headers,status:i.data.status,statusText:i.data.statusText}}throw a};return{onFulfilled:a,onRejected:r,apply:()=>e.interceptors.response.use(a,r)}}const m=Symbol(),v=e=>!!e&&!!e[m];function y({set:e,find:t,remove:a}){return{[m]:1,set:e,remove:a,get:async r=>{const n=await t(r);if(!n)return{state:"empty"};if("cached"!==n.state||n.createdAt+n.ttl>Date.now())return n;if(n.data.headers&&(i.ETag in n.data.headers||i.LastModified in n.data.headers||i.XAxiosCacheEtag in n.data.headers||i.XAxiosCacheStaleIfError in n.data.headers||i.XAxiosCacheLastModified in n.data.headers)){const t={state:"stale",createdAt:n.createdAt,data:n.data};return await e(r,t),t}return await a(r),{state:"empty"}}}}function w(){const e=y({find:t=>e.data[t],set:(t,a)=>{e.data[t]=a},remove:t=>{delete e.data[t]}});return e.data=Object.create(null),e}var b=a(246);const x=/^\/|\/$/g;function S(e,t){return a=>{if(a.id)return a.id;a.baseURL&&(a.baseURL=a.baseURL.replace(x,"")),a.url&&(a.url=a.url.replace(x,"")),a.method&&(a.method=a.method.toLowerCase());const r=t(a);return e?(0,b.code)(r).toString():r}}const C=S(!0,(({baseURL:e="",url:t="",method:a="get",params:r,data:n})=>({url:e+(e&&t?"/":"")+t,method:a,params:r,data:n})));function I(e,t={}){var a,r,n,i,s;const d=e;if(d.storage=t.storage||w(),!v(d.storage))throw new Error("Use buildStorage() function");return d.generateKey=t.generateKey||C,d.waiting=t.waiting||{},d.headerInterpreter=t.headerInterpreter||o,d.requestInterceptor=t.requestInterceptor||l(d),d.responseInterceptor=t.responseInterceptor||p(d),d.debug=t.debug,d.defaults.cache={ttl:null!==(a=t.ttl)&&void 0!==a?a:3e5,interpretHeader:null!==(r=t.interpretHeader)&&void 0!==r&&r,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null!==(n=t.etag)&&void 0!==n&&n,modifiedSince:null!==(i=t.modifiedSince)&&void 0!==i&&i,staleIfError:null!==(s=t.staleIfError)&&void 0!==s&&s,update:t.update||{}},d.requestInterceptor.apply(),d.responseInterceptor.apply(),d}function A(e,t=""){return y({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},set:(a,r)=>{e.setItem(t+a,JSON.stringify(r))},remove:a=>{e.removeItem(t+a)}})}})(),r})()}));

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