wilddragon-site/node_modules/next/dist/compiled/lru-cache/index.js

1 line
18 KiB
JavaScript
Raw Normal View History

2026-04-17 15:51:01 -04:00
(()=>{var t={78:t=>{const e=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date;const i=typeof AbortController==="function";const s=i?AbortController:class AbortController{constructor(){this.signal=new r}abort(t=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||t;this.signal.aborted=true;this.signal.dispatchEvent({type:"abort",target:this.signal})}};const n=typeof AbortSignal==="function";const h=typeof s.AbortSignal==="function";const r=n?AbortSignal:h?s.AbortController:class AbortSignal{constructor(){this.reason=undefined;this.aborted=false;this._listeners=[]}dispatchEvent(t){if(t.type==="abort"){this.aborted=true;this.onabort(t);this._listeners.forEach((e=>e(t)),this)}}onabort(){}addEventListener(t,e){if(t==="abort"){this._listeners.push(e)}}removeEventListener(t,e){if(t==="abort"){this._listeners=this._listeners.filter((t=>t!==e))}}};const o=new Set;const deprecatedOption=(t,e)=>{const i=`LRU_CACHE_OPTION_${t}`;if(shouldWarn(i)){warn(i,`${t} option`,`options.${e}`,LRUCache)}};const deprecatedMethod=(t,e)=>{const i=`LRU_CACHE_METHOD_${t}`;if(shouldWarn(i)){const{prototype:s}=LRUCache;const{get:n}=Object.getOwnPropertyDescriptor(s,t);warn(i,`${t} method`,`cache.${e}()`,n)}};const deprecatedProperty=(t,e)=>{const i=`LRU_CACHE_PROPERTY_${t}`;if(shouldWarn(i)){const{prototype:s}=LRUCache;const{get:n}=Object.getOwnPropertyDescriptor(s,t);warn(i,`${t} property`,`cache.${e}`,n)}};const emitWarning=(...t)=>{typeof process==="object"&&process&&typeof process.emitWarning==="function"?process.emitWarning(...t):console.error(...t)};const shouldWarn=t=>!o.has(t);const warn=(t,e,i,s)=>{o.add(t);const n=`The ${e} is deprecated. Please use ${i} instead.`;emitWarning(n,"DeprecationWarning",t,s)};const isPosInt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t);const getUintArray=t=>!isPosInt(t)?null:t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ZeroArray:null;class ZeroArray extends Array{constructor(t){super(t);this.fill(0)}}class Stack{constructor(t){if(t===0){return[]}const e=getUintArray(t);this.heap=new e(t);this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class LRUCache{constructor(t={}){const{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:h,updateAgeOnHas:r,allowStale:a,dispose:l,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:u,maxSize:d=0,maxEntrySize:p=0,sizeCalculation:g,fetchMethod:S,fetchContext:y,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:z,ignoreFetchAbort:L}=t;const{length:v,maxAge:x,stale:b}=t instanceof LRUCache?{}:t;if(e!==0&&!isPosInt(e)){throw new TypeError("max option must be a nonnegative integer")}const A=e?getUintArray(e):Array;if(!A){throw new Error("invalid max value: "+e)}this.max=e;this.maxSize=d;this.maxEntrySize=p||this.maxSize;this.sizeCalculation=g||v;if(this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize){throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize")}if(typeof this.sizeCalculation!=="function"){throw new TypeError("sizeCalculation set to non-function")}}this.fetchMethod=S||null;if(this.fetchMethod&&typeof this.fetchMethod!=="function"){throw new TypeError("fetchMethod must be a function if specified")}this.fetchContext=y;if(!this.fetchMethod&&y!==undefined){throw new TypeError("cannot set fetchContext without fetchMethod")}this.keyMap=new Map;this.keyList=new Array(e).fill(null);this.valList=new Array(e).fill(null);this.next=new A(e);this.prev=new A(e);this.head=0;this.tail=0;this.free=new Stack(e);this.initialFill=1;this.size=0;if(typeof l==="function"){this.dispose=l}if(typeof c==="function"){this.disposeAfter=c;this.disposed=[]}else{this.disposeAfter=null;this.disposed=null}this.noDisposeOnSet=!!f;this.noUpdateTTL=!!u;this.noDeleteOnFetchRejection=!!w;this.allowStaleOnFetchRejection=!!m;this.allowStaleOnFetchAbort=!!z;this.ignoreFetchAbort=!!L;if(this.maxEntrySize!==0){if(this.maxSize!==0){if(!isPosInt(this.ma