@midscene/cli 1.8.9 → 1.8.10-beta-20260604215059.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.mjs CHANGED
@@ -4,6 +4,7 @@ import { createReportCliCommands } from "@midscene/core";
4
4
  import { runToolsCLI } from "@midscene/shared/cli";
5
5
  import { getDebug } from "@midscene/shared/logger";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
+ import { channel, tracingChannel } from "node:diagnostics_channel";
7
8
  import { lstat, readdir, readlink, realpath } from "node:fs/promises";
8
9
  import { EventEmitter } from "node:events";
9
10
  import node_stream from "node:stream";
@@ -3026,9 +3027,7 @@ var __webpack_modules__ = {
3026
3027
  "./src/index.ts" (__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
3027
3028
  var main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.5/node_modules/dotenv/lib/main.js");
3028
3029
  var main_default = /*#__PURE__*/ __webpack_require__.n(main);
3029
- var package_namespaceObject = {
3030
- rE: "1.8.9"
3031
- };
3030
+ var package_namespaceObject = JSON.parse('{"rE":"1.8.10-beta-20260604215059.0"}');
3032
3031
  var brace_expansion = __webpack_require__("../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js");
3033
3032
  const MAX_PATTERN_LENGTH = 65536;
3034
3033
  const assertValidPattern = (pattern)=>{
@@ -4163,85 +4162,46 @@ var __webpack_modules__ = {
4163
4162
  minimatch.Minimatch = esm_Minimatch;
4164
4163
  minimatch.escape = escape_escape;
4165
4164
  minimatch.unescape = unescape_unescape;
4166
- const perf = 'object' == typeof performance && performance && 'function' == typeof performance.now ? performance : Date;
4167
- const warned = new Set();
4168
- const PROCESS = 'object' == typeof process && process ? process : {};
4169
- const emitWarning = (msg, type, code, fn)=>{
4170
- 'function' == typeof PROCESS.emitWarning ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
4171
- };
4172
- let AC = globalThis.AbortController;
4173
- let AS = globalThis.AbortSignal;
4174
- if (void 0 === AC) {
4175
- AS = class {
4176
- onabort;
4177
- _onabort = [];
4178
- reason;
4179
- aborted = false;
4180
- addEventListener(_, fn) {
4181
- this._onabort.push(fn);
4182
- }
4183
- };
4184
- AC = class {
4185
- constructor(){
4186
- warnACPolyfill();
4187
- }
4188
- signal = new AS();
4189
- abort(reason) {
4190
- if (this.signal.aborted) return;
4191
- this.signal.reason = reason;
4192
- this.signal.aborted = true;
4193
- for (const fn of this.signal._onabort)fn(reason);
4194
- this.signal.onabort?.(reason);
4195
- }
4196
- };
4197
- let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== '1';
4198
- const warnACPolyfill = ()=>{
4199
- if (!printACPolyfillWarning) return;
4200
- printACPolyfillWarning = false;
4201
- emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", 'NO_ABORT_CONTROLLER', 'ENOTSUP', warnACPolyfill);
4202
- };
4203
- }
4204
- const shouldWarn = (code)=>!warned.has(code);
4205
- Symbol('type');
4206
- const isPosInt = (n)=>n && n === Math.floor(n) && n > 0 && isFinite(n);
4207
- const getUintArray = (max)=>isPosInt(max) ? max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null : null;
4208
- class ZeroArray extends Array {
4209
- constructor(size){
4210
- super(size);
4211
- this.fill(0);
4212
- }
4213
- }
4214
- class Stack {
4165
+ var S = channel("lru-cache:metrics"), W = tracingChannel("lru-cache");
4166
+ var D = ()=>S.hasSubscribers || W.hasSubscribers, G = "object" == typeof performance && performance && "function" == typeof performance.now ? performance : Date, M = new Set, C = "object" == typeof process && process ? process : {}, P = (u, e1, t1, i)=>{
4167
+ "function" == typeof C.emitWarning ? C.emitWarning(u, e1, t1, i) : console.error(`[${t1}] ${e1}: ${u}`);
4168
+ }, H = (u)=>!M.has(u), F = (Symbol("type"), (u)=>!!u && u === Math.floor(u) && u > 0 && isFinite(u)), U = (u)=>F(u) ? u <= Math.pow(2, 8) ? Uint8Array : u <= Math.pow(2, 16) ? Uint16Array : u <= Math.pow(2, 32) ? Uint32Array : u <= Number.MAX_SAFE_INTEGER ? O : null : null, O = class extends Array {
4169
+ constructor(e1){
4170
+ super(e1), this.fill(0);
4171
+ }
4172
+ }, R = class u {
4215
4173
  heap;
4216
4174
  length;
4217
- static #constructing = false;
4218
- static create(max) {
4219
- const HeapCls = getUintArray(max);
4220
- if (!HeapCls) return [];
4221
- Stack.#constructing = true;
4222
- const s = new Stack(max, HeapCls);
4223
- Stack.#constructing = false;
4224
- return s;
4225
- }
4226
- constructor(max, HeapCls){
4227
- if (!Stack.#constructing) throw new TypeError('instantiate Stack using Stack.create(n)');
4228
- this.heap = new HeapCls(max);
4229
- this.length = 0;
4230
- }
4231
- push(n) {
4232
- this.heap[this.length++] = n;
4175
+ static #o = !1;
4176
+ static create(e1) {
4177
+ let t1 = U(e1);
4178
+ if (!t1) return [];
4179
+ u.#o = !0;
4180
+ let i = new u(e1, t1);
4181
+ return u.#o = !1, i;
4182
+ }
4183
+ constructor(e1, t1){
4184
+ if (!u.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
4185
+ this.heap = new t1(e1), this.length = 0;
4186
+ }
4187
+ push(e1) {
4188
+ this.heap[this.length++] = e1;
4233
4189
  }
4234
4190
  pop() {
4235
4191
  return this.heap[--this.length];
4236
4192
  }
4237
- }
4238
- class LRUCache {
4239
- #max;
4240
- #maxSize;
4241
- #dispose;
4242
- #disposeAfter;
4243
- #fetchMethod;
4244
- #memoMethod;
4193
+ }, L = class u {
4194
+ #o;
4195
+ #u;
4196
+ #w;
4197
+ #D;
4198
+ #S;
4199
+ #M;
4200
+ #U;
4201
+ #m;
4202
+ get perf() {
4203
+ return this.#m;
4204
+ }
4245
4205
  ttl;
4246
4206
  ttlResolution;
4247
4207
  ttlAutopurge;
@@ -4257,823 +4217,613 @@ var __webpack_modules__ = {
4257
4217
  allowStaleOnFetchAbort;
4258
4218
  allowStaleOnFetchRejection;
4259
4219
  ignoreFetchAbort;
4260
- #size;
4261
- #calculatedSize;
4262
- #keyMap;
4263
- #keyList;
4264
- #valList;
4265
- #next;
4266
- #prev;
4267
- #head;
4268
- #tail;
4269
- #free;
4270
- #disposed;
4271
- #sizes;
4272
- #starts;
4273
- #ttls;
4274
- #hasDispose;
4275
- #hasFetchMethod;
4276
- #hasDisposeAfter;
4277
- static unsafeExposeInternals(c) {
4220
+ #n;
4221
+ #b;
4222
+ #s;
4223
+ #i;
4224
+ #t;
4225
+ #a;
4226
+ #c;
4227
+ #l;
4228
+ #h;
4229
+ #y;
4230
+ #r;
4231
+ #_;
4232
+ #F;
4233
+ #d;
4234
+ #g;
4235
+ #T;
4236
+ #W;
4237
+ #f;
4238
+ #j;
4239
+ static unsafeExposeInternals(e1) {
4278
4240
  return {
4279
- starts: c.#starts,
4280
- ttls: c.#ttls,
4281
- sizes: c.#sizes,
4282
- keyMap: c.#keyMap,
4283
- keyList: c.#keyList,
4284
- valList: c.#valList,
4285
- next: c.#next,
4286
- prev: c.#prev,
4241
+ starts: e1.#F,
4242
+ ttls: e1.#d,
4243
+ autopurgeTimers: e1.#g,
4244
+ sizes: e1.#_,
4245
+ keyMap: e1.#s,
4246
+ keyList: e1.#i,
4247
+ valList: e1.#t,
4248
+ next: e1.#a,
4249
+ prev: e1.#c,
4287
4250
  get head () {
4288
- return c.#head;
4251
+ return e1.#l;
4289
4252
  },
4290
4253
  get tail () {
4291
- return c.#tail;
4254
+ return e1.#h;
4292
4255
  },
4293
- free: c.#free,
4294
- isBackgroundFetch: (p)=>c.#isBackgroundFetch(p),
4295
- backgroundFetch: (k, index, options, context)=>c.#backgroundFetch(k, index, options, context),
4296
- moveToTail: (index)=>c.#moveToTail(index),
4297
- indexes: (options)=>c.#indexes(options),
4298
- rindexes: (options)=>c.#rindexes(options),
4299
- isStale: (index)=>c.#isStale(index)
4256
+ free: e1.#y,
4257
+ isBackgroundFetch: (t1)=>e1.#e(t1),
4258
+ backgroundFetch: (t1, i, s, n)=>e1.#P(t1, i, s, n),
4259
+ moveToTail: (t1)=>e1.#L(t1),
4260
+ indexes: (t1)=>e1.#A(t1),
4261
+ rindexes: (t1)=>e1.#z(t1),
4262
+ isStale: (t1)=>e1.#p(t1)
4300
4263
  };
4301
4264
  }
4302
4265
  get max() {
4303
- return this.#max;
4266
+ return this.#o;
4304
4267
  }
4305
4268
  get maxSize() {
4306
- return this.#maxSize;
4269
+ return this.#u;
4307
4270
  }
4308
4271
  get calculatedSize() {
4309
- return this.#calculatedSize;
4272
+ return this.#b;
4310
4273
  }
4311
4274
  get size() {
4312
- return this.#size;
4275
+ return this.#n;
4313
4276
  }
4314
4277
  get fetchMethod() {
4315
- return this.#fetchMethod;
4278
+ return this.#M;
4316
4279
  }
4317
4280
  get memoMethod() {
4318
- return this.#memoMethod;
4281
+ return this.#U;
4319
4282
  }
4320
4283
  get dispose() {
4321
- return this.#dispose;
4284
+ return this.#w;
4322
4285
  }
4323
- get disposeAfter() {
4324
- return this.#disposeAfter;
4286
+ get onInsert() {
4287
+ return this.#D;
4325
4288
  }
4326
- constructor(options){
4327
- const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
4328
- if (0 !== max && !isPosInt(max)) throw new TypeError('max option must be a nonnegative integer');
4329
- const UintArray = max ? getUintArray(max) : Array;
4330
- if (!UintArray) throw new Error('invalid max value: ' + max);
4331
- this.#max = max;
4332
- this.#maxSize = maxSize;
4333
- this.maxEntrySize = maxEntrySize || this.#maxSize;
4334
- this.sizeCalculation = sizeCalculation;
4335
- if (this.sizeCalculation) {
4336
- if (!this.#maxSize && !this.maxEntrySize) throw new TypeError('cannot set sizeCalculation without setting maxSize or maxEntrySize');
4337
- if ('function' != typeof this.sizeCalculation) throw new TypeError('sizeCalculation set to non-function');
4338
- }
4339
- if (void 0 !== memoMethod && 'function' != typeof memoMethod) throw new TypeError('memoMethod must be a function if defined');
4340
- this.#memoMethod = memoMethod;
4341
- if (void 0 !== fetchMethod && 'function' != typeof fetchMethod) throw new TypeError('fetchMethod must be a function if specified');
4342
- this.#fetchMethod = fetchMethod;
4343
- this.#hasFetchMethod = !!fetchMethod;
4344
- this.#keyMap = new Map();
4345
- this.#keyList = new Array(max).fill(void 0);
4346
- this.#valList = new Array(max).fill(void 0);
4347
- this.#next = new UintArray(max);
4348
- this.#prev = new UintArray(max);
4349
- this.#head = 0;
4350
- this.#tail = 0;
4351
- this.#free = Stack.create(max);
4352
- this.#size = 0;
4353
- this.#calculatedSize = 0;
4354
- if ('function' == typeof dispose) this.#dispose = dispose;
4355
- if ('function' == typeof disposeAfter) {
4356
- this.#disposeAfter = disposeAfter;
4357
- this.#disposed = [];
4358
- } else {
4359
- this.#disposeAfter = void 0;
4360
- this.#disposed = void 0;
4361
- }
4362
- this.#hasDispose = !!this.#dispose;
4363
- this.#hasDisposeAfter = !!this.#disposeAfter;
4364
- this.noDisposeOnSet = !!noDisposeOnSet;
4365
- this.noUpdateTTL = !!noUpdateTTL;
4366
- this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
4367
- this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
4368
- this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
4369
- this.ignoreFetchAbort = !!ignoreFetchAbort;
4370
- if (0 !== this.maxEntrySize) {
4371
- if (0 !== this.#maxSize) {
4372
- if (!isPosInt(this.#maxSize)) throw new TypeError('maxSize must be a positive integer if specified');
4373
- }
4374
- if (!isPosInt(this.maxEntrySize)) throw new TypeError('maxEntrySize must be a positive integer if specified');
4375
- this.#initializeSizeTracking();
4376
- }
4377
- this.allowStale = !!allowStale;
4378
- this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
4379
- this.updateAgeOnGet = !!updateAgeOnGet;
4380
- this.updateAgeOnHas = !!updateAgeOnHas;
4381
- this.ttlResolution = isPosInt(ttlResolution) || 0 === ttlResolution ? ttlResolution : 1;
4382
- this.ttlAutopurge = !!ttlAutopurge;
4383
- this.ttl = ttl || 0;
4384
- if (this.ttl) {
4385
- if (!isPosInt(this.ttl)) throw new TypeError('ttl must be a positive integer if specified');
4386
- this.#initializeTTLTracking();
4387
- }
4388
- if (0 === this.#max && 0 === this.ttl && 0 === this.#maxSize) throw new TypeError('At least one of max, maxSize, or ttl is required');
4389
- if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
4390
- const code = 'LRU_CACHE_UNBOUNDED';
4391
- if (shouldWarn(code)) {
4392
- warned.add(code);
4393
- const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
4394
- emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache);
4395
- }
4396
- }
4397
- }
4398
- getRemainingTTL(key) {
4399
- return this.#keyMap.has(key) ? 1 / 0 : 0;
4400
- }
4401
- #initializeTTLTracking() {
4402
- const ttls = new ZeroArray(this.#max);
4403
- const starts = new ZeroArray(this.#max);
4404
- this.#ttls = ttls;
4405
- this.#starts = starts;
4406
- this.#setItemTTL = (index, ttl, start = perf.now())=>{
4407
- starts[index] = 0 !== ttl ? start : 0;
4408
- ttls[index] = ttl;
4409
- if (0 !== ttl && this.ttlAutopurge) {
4410
- const t1 = setTimeout(()=>{
4411
- if (this.#isStale(index)) this.#delete(this.#keyList[index], 'expire');
4412
- }, ttl + 1);
4413
- if (t1.unref) t1.unref();
4414
- }
4415
- };
4416
- this.#updateItemAge = (index)=>{
4417
- starts[index] = 0 !== ttls[index] ? perf.now() : 0;
4289
+ get disposeAfter() {
4290
+ return this.#S;
4291
+ }
4292
+ constructor(e1){
4293
+ let { max: t1 = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: r, allowStale: h, dispose: l, onInsert: c, disposeAfter: f, noDisposeOnSet: g, noUpdateTTL: p, maxSize: T = 0, maxEntrySize: w = 0, sizeCalculation: y, fetchMethod: a, memoMethod: m, noDeleteOnFetchRejection: _, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: d, allowStaleOnFetchAbort: A, ignoreFetchAbort: z, perf: x } = e1;
4294
+ if (void 0 !== x && "function" != typeof x?.now) throw new TypeError("perf option must have a now() method if specified");
4295
+ if (this.#m = x ?? G, 0 !== t1 && !F(t1)) throw new TypeError("max option must be a nonnegative integer");
4296
+ let v = t1 ? U(t1) : Array;
4297
+ if (!v) throw new Error("invalid max value: " + t1);
4298
+ if (this.#o = t1, this.#u = T, this.maxEntrySize = w || this.#u, this.sizeCalculation = y, this.sizeCalculation) {
4299
+ if (!this.#u && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
4300
+ if ("function" != typeof this.sizeCalculation) throw new TypeError("sizeCalculation set to non-function");
4301
+ }
4302
+ if (void 0 !== m && "function" != typeof m) throw new TypeError("memoMethod must be a function if defined");
4303
+ if (this.#U = m, void 0 !== a && "function" != typeof a) throw new TypeError("fetchMethod must be a function if specified");
4304
+ if (this.#M = a, this.#W = !!a, this.#s = new Map, this.#i = Array.from({
4305
+ length: t1
4306
+ }).fill(void 0), this.#t = Array.from({
4307
+ length: t1
4308
+ }).fill(void 0), this.#a = new v(t1), this.#c = new v(t1), this.#l = 0, this.#h = 0, this.#y = R.create(t1), this.#n = 0, this.#b = 0, "function" == typeof l && (this.#w = l), "function" == typeof c && (this.#D = c), "function" == typeof f ? (this.#S = f, this.#r = []) : (this.#S = void 0, this.#r = void 0), this.#T = !!this.#w, this.#j = !!this.#D, this.#f = !!this.#S, this.noDisposeOnSet = !!g, this.noUpdateTTL = !!p, this.noDeleteOnFetchRejection = !!_, this.allowStaleOnFetchRejection = !!d, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z, 0 !== this.maxEntrySize) {
4309
+ if (0 !== this.#u && !F(this.#u)) throw new TypeError("maxSize must be a positive integer if specified");
4310
+ if (!F(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
4311
+ this.#X();
4312
+ }
4313
+ if (this.allowStale = !!h, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!r, this.ttlResolution = F(s) || 0 === s ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) {
4314
+ if (!F(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
4315
+ this.#H();
4316
+ }
4317
+ if (0 === this.#o && 0 === this.ttl && 0 === this.#u) throw new TypeError("At least one of max, maxSize, or ttl is required");
4318
+ if (!this.ttlAutopurge && !this.#o && !this.#u) {
4319
+ let E = "LRU_CACHE_UNBOUNDED";
4320
+ H(E) && (M.add(E), P("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", E, u));
4321
+ }
4322
+ }
4323
+ getRemainingTTL(e1) {
4324
+ return this.#s.has(e1) ? 1 / 0 : 0;
4325
+ }
4326
+ #H() {
4327
+ let e1 = new O(this.#o), t1 = new O(this.#o);
4328
+ this.#d = e1, this.#F = t1;
4329
+ let i = this.ttlAutopurge ? Array.from({
4330
+ length: this.#o
4331
+ }) : void 0;
4332
+ this.#g = i, this.#N = (r, h, l = this.#m.now())=>{
4333
+ t1[r] = 0 !== h ? l : 0, e1[r] = h, s(r, h);
4334
+ }, this.#x = (r)=>{
4335
+ t1[r] = 0 !== e1[r] ? this.#m.now() : 0, s(r, e1[r]);
4418
4336
  };
4419
- this.#statusTTL = (status, index)=>{
4420
- if (ttls[index]) {
4421
- const ttl = ttls[index];
4422
- const start = starts[index];
4423
- if (!ttl || !start) return;
4424
- status.ttl = ttl;
4425
- status.start = start;
4426
- status.now = cachedNow || getNow();
4427
- const age = status.now - start;
4428
- status.remainingTTL = ttl - age;
4337
+ let s = this.ttlAutopurge ? (r, h)=>{
4338
+ if (i?.[r] && (clearTimeout(i[r]), i[r] = void 0), h && 0 !== h && i) {
4339
+ let l = setTimeout(()=>{
4340
+ this.#p(r) && this.#v(this.#i[r], "expire");
4341
+ }, h + 1);
4342
+ l.unref && l.unref(), i[r] = l;
4343
+ }
4344
+ } : ()=>{};
4345
+ this.#E = (r, h)=>{
4346
+ if (e1[h]) {
4347
+ let l = e1[h], c = t1[h];
4348
+ if (!l || !c) return;
4349
+ r.ttl = l, r.start = c, r.now = n || o();
4350
+ let f = r.now - c;
4351
+ r.remainingTTL = l - f;
4429
4352
  }
4430
4353
  };
4431
- let cachedNow = 0;
4432
- const getNow = ()=>{
4433
- const n = perf.now();
4354
+ let n = 0, o = ()=>{
4355
+ let r = this.#m.now();
4434
4356
  if (this.ttlResolution > 0) {
4435
- cachedNow = n;
4436
- const t1 = setTimeout(()=>cachedNow = 0, this.ttlResolution);
4437
- if (t1.unref) t1.unref();
4357
+ n = r;
4358
+ let h = setTimeout(()=>n = 0, this.ttlResolution);
4359
+ h.unref && h.unref();
4438
4360
  }
4439
- return n;
4440
- };
4441
- this.getRemainingTTL = (key)=>{
4442
- const index = this.#keyMap.get(key);
4443
- if (void 0 === index) return 0;
4444
- const ttl = ttls[index];
4445
- const start = starts[index];
4446
- if (!ttl || !start) return 1 / 0;
4447
- const age = (cachedNow || getNow()) - start;
4448
- return ttl - age;
4361
+ return r;
4449
4362
  };
4450
- this.#isStale = (index)=>{
4451
- const s = starts[index];
4452
- const t1 = ttls[index];
4453
- return !!t1 && !!s && (cachedNow || getNow()) - s > t1;
4363
+ this.getRemainingTTL = (r)=>{
4364
+ let h = this.#s.get(r);
4365
+ if (void 0 === h) return 0;
4366
+ let l = e1[h], c = t1[h];
4367
+ if (!l || !c) return 1 / 0;
4368
+ let f = (n || o()) - c;
4369
+ return l - f;
4370
+ }, this.#p = (r)=>{
4371
+ let h = t1[r], l = e1[r];
4372
+ return !!l && !!h && (n || o()) - h > l;
4454
4373
  };
4455
4374
  }
4456
- #updateItemAge = ()=>{};
4457
- #statusTTL = ()=>{};
4458
- #setItemTTL = ()=>{};
4459
- #isStale = ()=>false;
4460
- #initializeSizeTracking() {
4461
- const sizes = new ZeroArray(this.#max);
4462
- this.#calculatedSize = 0;
4463
- this.#sizes = sizes;
4464
- this.#removeItemSize = (index)=>{
4465
- this.#calculatedSize -= sizes[index];
4466
- sizes[index] = 0;
4467
- };
4468
- this.#requireSize = (k, v, size, sizeCalculation)=>{
4469
- if (this.#isBackgroundFetch(v)) return 0;
4470
- if (!isPosInt(size)) if (sizeCalculation) {
4471
- if ('function' != typeof sizeCalculation) throw new TypeError('sizeCalculation must be a function');
4472
- size = sizeCalculation(v, k);
4473
- if (!isPosInt(size)) throw new TypeError('sizeCalculation return invalid (expect positive integer)');
4375
+ #x = ()=>{};
4376
+ #E = ()=>{};
4377
+ #N = ()=>{};
4378
+ #p = ()=>!1;
4379
+ #X() {
4380
+ let e1 = new O(this.#o);
4381
+ this.#b = 0, this.#_ = e1, this.#R = (t1)=>{
4382
+ this.#b -= e1[t1], e1[t1] = 0;
4383
+ }, this.#k = (t1, i, s, n)=>{
4384
+ if (this.#e(i)) return 0;
4385
+ if (!F(s)) if (n) {
4386
+ if ("function" != typeof n) throw new TypeError("sizeCalculation must be a function");
4387
+ if (s = n(i, t1), !F(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
4474
4388
  } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
4475
- return size;
4476
- };
4477
- this.#addItemSize = (index, size, status)=>{
4478
- sizes[index] = size;
4479
- if (this.#maxSize) {
4480
- const maxSize = this.#maxSize - sizes[index];
4481
- while(this.#calculatedSize > maxSize)this.#evict(true);
4482
- }
4483
- this.#calculatedSize += sizes[index];
4484
- if (status) {
4485
- status.entrySize = size;
4486
- status.totalCalculatedSize = this.#calculatedSize;
4389
+ return s;
4390
+ }, this.#I = (t1, i, s)=>{
4391
+ if (e1[t1] = i, this.#u) {
4392
+ let n = this.#u - e1[t1];
4393
+ for(; this.#b > n;)this.#G(!0);
4487
4394
  }
4395
+ this.#b += e1[t1], s && (s.entrySize = i, s.totalCalculatedSize = this.#b);
4488
4396
  };
4489
4397
  }
4490
- #removeItemSize = (_i)=>{};
4491
- #addItemSize = (_i, _s, _st)=>{};
4492
- #requireSize = (_k, _v, size, sizeCalculation)=>{
4493
- if (size || sizeCalculation) throw new TypeError('cannot set size without setting maxSize or maxEntrySize on cache');
4398
+ #R = (e1)=>{};
4399
+ #I = (e1, t1, i)=>{};
4400
+ #k = (e1, t1, i, s)=>{
4401
+ if (i || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
4494
4402
  return 0;
4495
4403
  };
4496
- *#indexes({ allowStale = this.allowStale } = {}) {
4497
- if (this.#size) for(let i = this.#tail; true;){
4498
- if (!this.#isValidIndex(i)) break;
4499
- if (allowStale || !this.#isStale(i)) yield i;
4500
- if (i === this.#head) break;
4501
- i = this.#prev[i];
4502
- }
4404
+ *#A({ allowStale: e1 = this.allowStale } = {}) {
4405
+ if (this.#n) for(let t1 = this.#h; this.#V(t1) && ((e1 || !this.#p(t1)) && (yield t1), t1 !== this.#l);)t1 = this.#c[t1];
4503
4406
  }
4504
- *#rindexes({ allowStale = this.allowStale } = {}) {
4505
- if (this.#size) for(let i = this.#head; true;){
4506
- if (!this.#isValidIndex(i)) break;
4507
- if (allowStale || !this.#isStale(i)) yield i;
4508
- if (i === this.#tail) break;
4509
- i = this.#next[i];
4510
- }
4407
+ *#z({ allowStale: e1 = this.allowStale } = {}) {
4408
+ if (this.#n) for(let t1 = this.#l; this.#V(t1) && ((e1 || !this.#p(t1)) && (yield t1), t1 !== this.#h);)t1 = this.#a[t1];
4511
4409
  }
4512
- #isValidIndex(index) {
4513
- return void 0 !== index && this.#keyMap.get(this.#keyList[index]) === index;
4410
+ #V(e1) {
4411
+ return void 0 !== e1 && this.#s.get(this.#i[e1]) === e1;
4514
4412
  }
4515
4413
  *entries() {
4516
- for (const i of this.#indexes())if (void 0 !== this.#valList[i] && void 0 !== this.#keyList[i] && !this.#isBackgroundFetch(this.#valList[i])) yield [
4517
- this.#keyList[i],
4518
- this.#valList[i]
4519
- ];
4414
+ for (let e1 of this.#A())void 0 === this.#t[e1] || void 0 === this.#i[e1] || this.#e(this.#t[e1]) || (yield [
4415
+ this.#i[e1],
4416
+ this.#t[e1]
4417
+ ]);
4520
4418
  }
4521
4419
  *rentries() {
4522
- for (const i of this.#rindexes())if (void 0 !== this.#valList[i] && void 0 !== this.#keyList[i] && !this.#isBackgroundFetch(this.#valList[i])) yield [
4523
- this.#keyList[i],
4524
- this.#valList[i]
4525
- ];
4420
+ for (let e1 of this.#z())void 0 === this.#t[e1] || void 0 === this.#i[e1] || this.#e(this.#t[e1]) || (yield [
4421
+ this.#i[e1],
4422
+ this.#t[e1]
4423
+ ]);
4526
4424
  }
4527
4425
  *keys() {
4528
- for (const i of this.#indexes()){
4529
- const k = this.#keyList[i];
4530
- if (void 0 !== k && !this.#isBackgroundFetch(this.#valList[i])) yield k;
4426
+ for (let e1 of this.#A()){
4427
+ let t1 = this.#i[e1];
4428
+ void 0 === t1 || this.#e(this.#t[e1]) || (yield t1);
4531
4429
  }
4532
4430
  }
4533
4431
  *rkeys() {
4534
- for (const i of this.#rindexes()){
4535
- const k = this.#keyList[i];
4536
- if (void 0 !== k && !this.#isBackgroundFetch(this.#valList[i])) yield k;
4432
+ for (let e1 of this.#z()){
4433
+ let t1 = this.#i[e1];
4434
+ void 0 === t1 || this.#e(this.#t[e1]) || (yield t1);
4537
4435
  }
4538
4436
  }
4539
4437
  *values() {
4540
- for (const i of this.#indexes()){
4541
- const v = this.#valList[i];
4542
- if (void 0 !== v && !this.#isBackgroundFetch(this.#valList[i])) yield this.#valList[i];
4543
- }
4438
+ for (let e1 of this.#A())void 0 === this.#t[e1] || this.#e(this.#t[e1]) || (yield this.#t[e1]);
4544
4439
  }
4545
4440
  *rvalues() {
4546
- for (const i of this.#rindexes()){
4547
- const v = this.#valList[i];
4548
- if (void 0 !== v && !this.#isBackgroundFetch(this.#valList[i])) yield this.#valList[i];
4549
- }
4441
+ for (let e1 of this.#z())void 0 === this.#t[e1] || this.#e(this.#t[e1]) || (yield this.#t[e1]);
4550
4442
  }
4551
4443
  [Symbol.iterator]() {
4552
4444
  return this.entries();
4553
4445
  }
4554
- [Symbol.toStringTag] = 'LRUCache';
4555
- find(fn, getOptions = {}) {
4556
- for (const i of this.#indexes()){
4557
- const v = this.#valList[i];
4558
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
4559
- if (void 0 !== value) {
4560
- if (fn(value, this.#keyList[i], this)) return this.get(this.#keyList[i], getOptions);
4561
- }
4446
+ [Symbol.toStringTag] = "LRUCache";
4447
+ find(e1, t1 = {}) {
4448
+ for (let i of this.#A()){
4449
+ let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
4450
+ if (void 0 !== n && e1(n, this.#i[i], this)) return this.#C(this.#i[i], t1);
4562
4451
  }
4563
4452
  }
4564
- forEach(fn, thisp = this) {
4565
- for (const i of this.#indexes()){
4566
- const v = this.#valList[i];
4567
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
4568
- if (void 0 !== value) fn.call(thisp, value, this.#keyList[i], this);
4453
+ forEach(e1, t1 = this) {
4454
+ for (let i of this.#A()){
4455
+ let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
4456
+ void 0 !== n && e1.call(t1, n, this.#i[i], this);
4569
4457
  }
4570
4458
  }
4571
- rforEach(fn, thisp = this) {
4572
- for (const i of this.#rindexes()){
4573
- const v = this.#valList[i];
4574
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
4575
- if (void 0 !== value) fn.call(thisp, value, this.#keyList[i], this);
4459
+ rforEach(e1, t1 = this) {
4460
+ for (let i of this.#z()){
4461
+ let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
4462
+ void 0 !== n && e1.call(t1, n, this.#i[i], this);
4576
4463
  }
4577
4464
  }
4578
4465
  purgeStale() {
4579
- let deleted = false;
4580
- for (const i of this.#rindexes({
4581
- allowStale: true
4582
- }))if (this.#isStale(i)) {
4583
- this.#delete(this.#keyList[i], 'expire');
4584
- deleted = true;
4585
- }
4586
- return deleted;
4587
- }
4588
- info(key) {
4589
- const i = this.#keyMap.get(key);
4590
- if (void 0 === i) return;
4591
- const v = this.#valList[i];
4592
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
4593
- if (void 0 === value) return;
4594
- const entry = {
4595
- value
4466
+ let e1 = !1;
4467
+ for (let t1 of this.#z({
4468
+ allowStale: !0
4469
+ }))this.#p(t1) && (this.#v(this.#i[t1], "expire"), e1 = !0);
4470
+ return e1;
4471
+ }
4472
+ info(e1) {
4473
+ let t1 = this.#s.get(e1);
4474
+ if (void 0 === t1) return;
4475
+ let i = this.#t[t1], s = this.#e(i) ? i.__staleWhileFetching : i;
4476
+ if (void 0 === s) return;
4477
+ let n = {
4478
+ value: s
4596
4479
  };
4597
- if (this.#ttls && this.#starts) {
4598
- const ttl = this.#ttls[i];
4599
- const start = this.#starts[i];
4600
- if (ttl && start) {
4601
- const remain = ttl - (perf.now() - start);
4602
- entry.ttl = remain;
4603
- entry.start = Date.now();
4480
+ if (this.#d && this.#F) {
4481
+ let o = this.#d[t1], r = this.#F[t1];
4482
+ if (o && r) {
4483
+ let h = o - (this.#m.now() - r);
4484
+ n.ttl = h, n.start = Date.now();
4604
4485
  }
4605
4486
  }
4606
- if (this.#sizes) entry.size = this.#sizes[i];
4607
- return entry;
4487
+ return this.#_ && (n.size = this.#_[t1]), n;
4608
4488
  }
4609
4489
  dump() {
4610
- const arr = [];
4611
- for (const i of this.#indexes({
4612
- allowStale: true
4490
+ let e1 = [];
4491
+ for (let t1 of this.#A({
4492
+ allowStale: !0
4613
4493
  })){
4614
- const key = this.#keyList[i];
4615
- const v = this.#valList[i];
4616
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
4617
- if (void 0 === value || void 0 === key) continue;
4618
- const entry = {
4619
- value
4494
+ let i = this.#i[t1], s = this.#t[t1], n = this.#e(s) ? s.__staleWhileFetching : s;
4495
+ if (void 0 === n || void 0 === i) continue;
4496
+ let o = {
4497
+ value: n
4620
4498
  };
4621
- if (this.#ttls && this.#starts) {
4622
- entry.ttl = this.#ttls[i];
4623
- const age = perf.now() - this.#starts[i];
4624
- entry.start = Math.floor(Date.now() - age);
4625
- }
4626
- if (this.#sizes) entry.size = this.#sizes[i];
4627
- arr.unshift([
4628
- key,
4629
- entry
4499
+ if (this.#d && this.#F) {
4500
+ o.ttl = this.#d[t1];
4501
+ let r = this.#m.now() - this.#F[t1];
4502
+ o.start = Math.floor(Date.now() - r);
4503
+ }
4504
+ this.#_ && (o.size = this.#_[t1]), e1.unshift([
4505
+ i,
4506
+ o
4630
4507
  ]);
4631
4508
  }
4632
- return arr;
4509
+ return e1;
4633
4510
  }
4634
- load(arr) {
4511
+ load(e1) {
4635
4512
  this.clear();
4636
- for (const [key, entry] of arr){
4637
- if (entry.start) {
4638
- const age = Date.now() - entry.start;
4639
- entry.start = perf.now() - age;
4640
- }
4641
- this.set(key, entry.value, entry);
4642
- }
4643
- }
4644
- set(k, v, setOptions = {}) {
4645
- if (void 0 === v) {
4646
- this.delete(k);
4647
- return this;
4648
- }
4649
- const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
4650
- let { noUpdateTTL = this.noUpdateTTL } = setOptions;
4651
- const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
4652
- if (this.maxEntrySize && size > this.maxEntrySize) {
4653
- if (status) {
4654
- status.set = 'miss';
4655
- status.maxEntrySizeExceeded = true;
4656
- }
4657
- this.#delete(k, 'set');
4658
- return this;
4659
- }
4660
- let index = 0 === this.#size ? void 0 : this.#keyMap.get(k);
4661
- if (void 0 === index) {
4662
- index = 0 === this.#size ? this.#tail : 0 !== this.#free.length ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
4663
- this.#keyList[index] = k;
4664
- this.#valList[index] = v;
4665
- this.#keyMap.set(k, index);
4666
- this.#next[this.#tail] = index;
4667
- this.#prev[index] = this.#tail;
4668
- this.#tail = index;
4669
- this.#size++;
4670
- this.#addItemSize(index, size, status);
4671
- if (status) status.set = 'add';
4672
- noUpdateTTL = false;
4673
- } else {
4674
- this.#moveToTail(index);
4675
- const oldVal = this.#valList[index];
4676
- if (v !== oldVal) {
4677
- if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
4678
- oldVal.__abortController.abort(new Error('replaced'));
4679
- const { __staleWhileFetching: s } = oldVal;
4680
- if (void 0 !== s && !noDisposeOnSet) {
4681
- if (this.#hasDispose) this.#dispose?.(s, k, 'set');
4682
- if (this.#hasDisposeAfter) this.#disposed?.push([
4683
- s,
4684
- k,
4685
- 'set'
4686
- ]);
4687
- }
4688
- } else if (!noDisposeOnSet) {
4689
- if (this.#hasDispose) this.#dispose?.(oldVal, k, 'set');
4690
- if (this.#hasDisposeAfter) this.#disposed?.push([
4691
- oldVal,
4692
- k,
4693
- 'set'
4694
- ]);
4695
- }
4696
- this.#removeItemSize(index);
4697
- this.#addItemSize(index, size, status);
4698
- this.#valList[index] = v;
4699
- if (status) {
4700
- status.set = 'replace';
4701
- const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
4702
- if (void 0 !== oldValue) status.oldValue = oldValue;
4513
+ for (let [t1, i] of e1){
4514
+ if (i.start) {
4515
+ let s = Date.now() - i.start;
4516
+ i.start = this.#m.now() - s;
4517
+ }
4518
+ this.#O(t1, i.value, i);
4519
+ }
4520
+ }
4521
+ set(e1, t1, i = {}) {
4522
+ let { status: s = S.hasSubscribers ? {} : void 0 } = i;
4523
+ i.status = s, s && (s.op = "set", s.key = e1, void 0 !== t1 && (s.value = t1));
4524
+ let n = this.#O(e1, t1, i);
4525
+ return s && S.hasSubscribers && S.publish(s), n;
4526
+ }
4527
+ #O(e1, t1, i = {}) {
4528
+ let { ttl: s = this.ttl, start: n, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: r = this.sizeCalculation, status: h } = i;
4529
+ if (void 0 === t1) return h && (h.set = "deleted"), this.delete(e1), this;
4530
+ let { noUpdateTTL: l = this.noUpdateTTL } = i;
4531
+ h && !this.#e(t1) && (h.value = t1);
4532
+ let c = this.#k(e1, t1, i.size || 0, r, h);
4533
+ if (this.maxEntrySize && c > this.maxEntrySize) return this.#v(e1, "set"), h && (h.set = "miss", h.maxEntrySizeExceeded = !0), this;
4534
+ let f = 0 === this.#n ? void 0 : this.#s.get(e1);
4535
+ if (void 0 === f) f = 0 === this.#n ? this.#h : 0 !== this.#y.length ? this.#y.pop() : this.#n === this.#o ? this.#G(!1) : this.#n, this.#i[f] = e1, this.#t[f] = t1, this.#s.set(e1, f), this.#a[this.#h] = f, this.#c[f] = this.#h, this.#h = f, this.#n++, this.#I(f, c, h), h && (h.set = "add"), l = !1, this.#j && this.#D?.(t1, e1, "add");
4536
+ else {
4537
+ this.#L(f);
4538
+ let g = this.#t[f];
4539
+ if (t1 !== g) {
4540
+ if (this.#W && this.#e(g)) {
4541
+ g.__abortController.abort(new Error("replaced"));
4542
+ let { __staleWhileFetching: p } = g;
4543
+ void 0 !== p && !o && (this.#T && this.#w?.(p, e1, "set"), this.#f && this.#r?.push([
4544
+ p,
4545
+ e1,
4546
+ "set"
4547
+ ]));
4548
+ } else o || (this.#T && this.#w?.(g, e1, "set"), this.#f && this.#r?.push([
4549
+ g,
4550
+ e1,
4551
+ "set"
4552
+ ]));
4553
+ if (this.#R(f), this.#I(f, c, h), this.#t[f] = t1, h) {
4554
+ h.set = "replace";
4555
+ let p = g && this.#e(g) ? g.__staleWhileFetching : g;
4556
+ void 0 !== p && (h.oldValue = p);
4703
4557
  }
4704
- } else if (status) status.set = 'update';
4558
+ } else h && (h.set = "update");
4559
+ this.#j && this.onInsert?.(t1, e1, t1 === g ? "update" : "replace");
4705
4560
  }
4706
- if (0 !== ttl && !this.#ttls) this.#initializeTTLTracking();
4707
- if (this.#ttls) {
4708
- if (!noUpdateTTL) this.#setItemTTL(index, ttl, start);
4709
- if (status) this.#statusTTL(status, index);
4710
- }
4711
- if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
4712
- const dt = this.#disposed;
4713
- let task;
4714
- while(task = dt?.shift())this.#disposeAfter?.(...task);
4561
+ if (0 === s || this.#d || this.#H(), this.#d && (l || this.#N(f, s, n), h && this.#E(h, f)), !o && this.#f && this.#r) {
4562
+ let g = this.#r, p;
4563
+ for(; p = g?.shift();)this.#S?.(...p);
4715
4564
  }
4716
4565
  return this;
4717
4566
  }
4718
4567
  pop() {
4719
4568
  try {
4720
- while(this.#size){
4721
- const val = this.#valList[this.#head];
4722
- this.#evict(true);
4723
- if (this.#isBackgroundFetch(val)) {
4724
- if (val.__staleWhileFetching) return val.__staleWhileFetching;
4725
- } else if (void 0 !== val) return val;
4569
+ for(; this.#n;){
4570
+ let e1 = this.#t[this.#l];
4571
+ if (this.#G(!0), this.#e(e1)) {
4572
+ if (e1.__staleWhileFetching) return e1.__staleWhileFetching;
4573
+ } else if (void 0 !== e1) return e1;
4726
4574
  }
4727
4575
  } finally{
4728
- if (this.#hasDisposeAfter && this.#disposed) {
4729
- const dt = this.#disposed;
4730
- let task;
4731
- while(task = dt?.shift())this.#disposeAfter?.(...task);
4576
+ if (this.#f && this.#r) {
4577
+ let e1 = this.#r, t1;
4578
+ for(; t1 = e1?.shift();)this.#S?.(...t1);
4732
4579
  }
4733
4580
  }
4734
4581
  }
4735
- #evict(free) {
4736
- const head = this.#head;
4737
- const k = this.#keyList[head];
4738
- const v = this.#valList[head];
4739
- if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) v.__abortController.abort(new Error('evicted'));
4740
- else if (this.#hasDispose || this.#hasDisposeAfter) {
4741
- if (this.#hasDispose) this.#dispose?.(v, k, 'evict');
4742
- if (this.#hasDisposeAfter) this.#disposed?.push([
4743
- v,
4744
- k,
4745
- 'evict'
4746
- ]);
4582
+ #G(e1) {
4583
+ let t1 = this.#l, i = this.#i[t1], s = this.#t[t1];
4584
+ return this.#W && this.#e(s) ? s.__abortController.abort(new Error("evicted")) : (this.#T || this.#f) && (this.#T && this.#w?.(s, i, "evict"), this.#f && this.#r?.push([
4585
+ s,
4586
+ i,
4587
+ "evict"
4588
+ ])), this.#R(t1), this.#g?.[t1] && (clearTimeout(this.#g[t1]), this.#g[t1] = void 0), e1 && (this.#i[t1] = void 0, this.#t[t1] = void 0, this.#y.push(t1)), 1 === this.#n ? (this.#l = this.#h = 0, this.#y.length = 0) : this.#l = this.#a[t1], this.#s.delete(i), this.#n--, t1;
4589
+ }
4590
+ has(e1, t1 = {}) {
4591
+ let { status: i = S.hasSubscribers ? {} : void 0 } = t1;
4592
+ t1.status = i, i && (i.op = "has", i.key = e1);
4593
+ let s = this.#Y(e1, t1);
4594
+ return S.hasSubscribers && S.publish(i), s;
4595
+ }
4596
+ #Y(e1, t1 = {}) {
4597
+ let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = t1, n = this.#s.get(e1);
4598
+ if (void 0 !== n) {
4599
+ let o = this.#t[n];
4600
+ if (this.#e(o) && void 0 === o.__staleWhileFetching) return !1;
4601
+ if (!this.#p(n)) return i && this.#x(n), s && (s.has = "hit", this.#E(s, n)), !0;
4602
+ s && (s.has = "stale", this.#E(s, n));
4603
+ } else s && (s.has = "miss");
4604
+ return !1;
4605
+ }
4606
+ peek(e1, t1 = {}) {
4607
+ let { status: i = D() ? {} : void 0 } = t1;
4608
+ i && (i.op = "peek", i.key = e1), t1.status = i;
4609
+ let s = this.#J(e1, t1);
4610
+ return S.hasSubscribers && S.publish(i), s;
4611
+ }
4612
+ #J(e1, t1) {
4613
+ let { status: i, allowStale: s = this.allowStale } = t1, n = this.#s.get(e1);
4614
+ if (void 0 === n || !s && this.#p(n)) {
4615
+ i && (i.peek = void 0 === n ? "miss" : "stale");
4616
+ return;
4747
4617
  }
4748
- this.#removeItemSize(head);
4749
- if (free) {
4750
- this.#keyList[head] = void 0;
4751
- this.#valList[head] = void 0;
4752
- this.#free.push(head);
4753
- }
4754
- if (1 === this.#size) {
4755
- this.#head = this.#tail = 0;
4756
- this.#free.length = 0;
4757
- } else this.#head = this.#next[head];
4758
- this.#keyMap.delete(k);
4759
- this.#size--;
4760
- return head;
4761
- }
4762
- has(k, hasOptions = {}) {
4763
- const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
4764
- const index = this.#keyMap.get(k);
4765
- if (void 0 !== index) {
4766
- const v = this.#valList[index];
4767
- if (this.#isBackgroundFetch(v) && void 0 === v.__staleWhileFetching) return false;
4768
- if (this.#isStale(index)) {
4769
- if (status) {
4770
- status.has = 'stale';
4771
- this.#statusTTL(status, index);
4772
- }
4773
- } else {
4774
- if (updateAgeOnHas) this.#updateItemAge(index);
4775
- if (status) {
4776
- status.has = 'hit';
4777
- this.#statusTTL(status, index);
4778
- }
4779
- return true;
4780
- }
4781
- } else if (status) status.has = 'miss';
4782
- return false;
4618
+ let o = this.#t[n], r = this.#e(o) ? o.__staleWhileFetching : o;
4619
+ return i && (void 0 !== r ? (i.peek = "hit", i.value = r) : i.peek = "miss"), r;
4783
4620
  }
4784
- peek(k, peekOptions = {}) {
4785
- const { allowStale = this.allowStale } = peekOptions;
4786
- const index = this.#keyMap.get(k);
4787
- if (void 0 === index || !allowStale && this.#isStale(index)) return;
4788
- const v = this.#valList[index];
4789
- return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
4790
- }
4791
- #backgroundFetch(k, index, options, context) {
4792
- const v = void 0 === index ? void 0 : this.#valList[index];
4793
- if (this.#isBackgroundFetch(v)) return v;
4794
- const ac = new AC();
4795
- const { signal } = options;
4796
- signal?.addEventListener('abort', ()=>ac.abort(signal.reason), {
4797
- signal: ac.signal
4621
+ #P(e1, t1, i, s) {
4622
+ let n = void 0 === t1 ? void 0 : this.#t[t1];
4623
+ if (this.#e(n)) return n;
4624
+ let o = new AbortController, { signal: r } = i;
4625
+ r?.addEventListener("abort", ()=>o.abort(r.reason), {
4626
+ signal: o.signal
4798
4627
  });
4799
- const fetchOpts = {
4800
- signal: ac.signal,
4801
- options,
4802
- context
4803
- };
4804
- const cb = (v, updateCache = false)=>{
4805
- const { aborted } = ac.signal;
4806
- const ignoreAbort = options.ignoreFetchAbort && void 0 !== v;
4807
- if (options.status) if (aborted && !updateCache) {
4808
- options.status.fetchAborted = true;
4809
- options.status.fetchError = ac.signal.reason;
4810
- if (ignoreAbort) options.status.fetchAbortIgnored = true;
4811
- } else options.status.fetchResolved = true;
4812
- if (aborted && !ignoreAbort && !updateCache) return fetchFail(ac.signal.reason);
4813
- const bf = p;
4814
- if (this.#valList[index] === p) if (void 0 === v) if (bf.__staleWhileFetching) this.#valList[index] = bf.__staleWhileFetching;
4815
- else this.#delete(k, 'fetch');
4816
- else {
4817
- if (options.status) options.status.fetchUpdated = true;
4818
- this.set(k, v, fetchOpts.options);
4819
- }
4820
- return v;
4821
- };
4822
- const eb = (er)=>{
4823
- if (options.status) {
4824
- options.status.fetchRejected = true;
4825
- options.status.fetchError = er;
4826
- }
4827
- return fetchFail(er);
4828
- };
4829
- const fetchFail = (er)=>{
4830
- const { aborted } = ac.signal;
4831
- const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
4832
- const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
4833
- const noDelete = allowStale || options.noDeleteOnFetchRejection;
4834
- const bf = p;
4835
- if (this.#valList[index] === p) {
4836
- const del = !noDelete || void 0 === bf.__staleWhileFetching;
4837
- if (del) this.#delete(k, 'fetch');
4838
- else if (!allowStaleAborted) this.#valList[index] = bf.__staleWhileFetching;
4839
- }
4840
- if (allowStale) {
4841
- if (options.status && void 0 !== bf.__staleWhileFetching) options.status.returnedStale = true;
4842
- return bf.__staleWhileFetching;
4843
- }
4844
- if (bf.__returned === bf) throw er;
4845
- };
4846
- const pcall = (res, rej)=>{
4847
- const fmp = this.#fetchMethod?.(k, v, fetchOpts);
4848
- if (fmp && fmp instanceof Promise) fmp.then((v)=>res(void 0 === v ? void 0 : v), rej);
4849
- ac.signal.addEventListener('abort', ()=>{
4850
- if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
4851
- res(void 0);
4852
- if (options.allowStaleOnFetchAbort) res = (v)=>cb(v, true);
4853
- }
4628
+ let h = {
4629
+ signal: o.signal,
4630
+ options: i,
4631
+ context: s
4632
+ }, l = (w, y = !1)=>{
4633
+ let { aborted: a } = o.signal, m = i.ignoreFetchAbort && void 0 !== w, _ = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && void 0 !== w);
4634
+ if (i.status && (a && !y ? (i.status.fetchAborted = !0, i.status.fetchError = o.signal.reason, m && (i.status.fetchAbortIgnored = !0)) : i.status.fetchResolved = !0), a && !m && !y) return f(o.signal.reason, _);
4635
+ let b = p, d = this.#t[t1];
4636
+ return (d === p || void 0 === d && m && y) && (void 0 === w ? void 0 !== b.__staleWhileFetching ? this.#t[t1] = b.__staleWhileFetching : this.#v(e1, "fetch") : (i.status && (i.status.fetchUpdated = !0), this.#O(e1, w, h.options))), w;
4637
+ }, c = (w)=>(i.status && (i.status.fetchRejected = !0, i.status.fetchError = w), f(w, !1)), f = (w, y)=>{
4638
+ let { aborted: a } = o.signal, m = a && i.allowStaleOnFetchAbort, _ = m || i.allowStaleOnFetchRejection, b = _ || i.noDeleteOnFetchRejection, d = p;
4639
+ if (this.#t[t1] === p && (b && (y || void 0 !== d.__staleWhileFetching) ? m || (this.#t[t1] = d.__staleWhileFetching) : this.#v(e1, "fetch")), _) return i.status && void 0 !== d.__staleWhileFetching && (i.status.returnedStale = !0), d.__staleWhileFetching;
4640
+ if (d.__returned === d) throw w;
4641
+ }, g = (w, y)=>{
4642
+ let a = this.#M?.(e1, n, h);
4643
+ a && a instanceof Promise && a.then((m)=>w(void 0 === m ? void 0 : m), y), o.signal.addEventListener("abort", ()=>{
4644
+ (!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (w(void 0), i.allowStaleOnFetchAbort && (w = (m)=>l(m, !0)));
4854
4645
  });
4855
4646
  };
4856
- if (options.status) options.status.fetchDispatched = true;
4857
- const p = new Promise(pcall).then(cb, eb);
4858
- const bf = Object.assign(p, {
4859
- __abortController: ac,
4860
- __staleWhileFetching: v,
4647
+ i.status && (i.status.fetchDispatched = !0);
4648
+ let p = new Promise(g).then(l, c), T = Object.assign(p, {
4649
+ __abortController: o,
4650
+ __staleWhileFetching: n,
4861
4651
  __returned: void 0
4862
4652
  });
4863
- if (void 0 === index) {
4864
- this.set(k, bf, {
4865
- ...fetchOpts.options,
4866
- status: void 0
4867
- });
4868
- index = this.#keyMap.get(k);
4869
- } else this.#valList[index] = bf;
4870
- return bf;
4871
- }
4872
- #isBackgroundFetch(p) {
4873
- if (!this.#hasFetchMethod) return false;
4874
- const b = p;
4875
- return !!b && b instanceof Promise && b.hasOwnProperty('__staleWhileFetching') && b.__abortController instanceof AC;
4876
- }
4877
- async fetch(k, fetchOptions = {}) {
4878
- const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL, noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal } = fetchOptions;
4879
- if (!this.#hasFetchMethod) {
4880
- if (status) status.fetch = 'get';
4881
- return this.get(k, {
4882
- allowStale,
4883
- updateAgeOnGet,
4884
- noDeleteOnStaleGet,
4885
- status
4886
- });
4887
- }
4888
- const options = {
4889
- allowStale,
4890
- updateAgeOnGet,
4891
- noDeleteOnStaleGet,
4892
- ttl,
4893
- noDisposeOnSet,
4894
- size,
4895
- sizeCalculation,
4896
- noUpdateTTL,
4897
- noDeleteOnFetchRejection,
4898
- allowStaleOnFetchRejection,
4899
- allowStaleOnFetchAbort,
4900
- ignoreFetchAbort,
4901
- status,
4902
- signal
4903
- };
4904
- let index = this.#keyMap.get(k);
4905
- if (void 0 === index) {
4906
- if (status) status.fetch = 'miss';
4907
- const p = this.#backgroundFetch(k, index, options, context);
4908
- return p.__returned = p;
4653
+ return void 0 === t1 ? (this.#O(e1, T, {
4654
+ ...h.options,
4655
+ status: void 0
4656
+ }), t1 = this.#s.get(e1)) : this.#t[t1] = T, T;
4657
+ }
4658
+ #e(e1) {
4659
+ if (!this.#W) return !1;
4660
+ let t1 = e1;
4661
+ return !!t1 && t1 instanceof Promise && t1.hasOwnProperty("__staleWhileFetching") && t1.__abortController instanceof AbortController;
4662
+ }
4663
+ fetch(e1, t1 = {}) {
4664
+ let i = W.hasSubscribers, { status: s = D() ? {} : void 0 } = t1;
4665
+ t1.status = s, s && t1.context && (s.context = t1.context);
4666
+ let n = this.#B(e1, t1);
4667
+ return s && D() && i && (s.trace = !0, W.tracePromise(()=>n, s).catch(()=>{})), n;
4668
+ }
4669
+ async #B(e1, t1 = {}) {
4670
+ let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: r = this.noDisposeOnSet, size: h = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: f = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: g = this.allowStaleOnFetchRejection, ignoreFetchAbort: p = this.ignoreFetchAbort, allowStaleOnFetchAbort: T = this.allowStaleOnFetchAbort, context: w, forceRefresh: y = !1, status: a, signal: m } = t1;
4671
+ if (a && (a.op = "fetch", a.key = e1, y && (a.forceRefresh = !0)), !this.#W) return a && (a.fetch = "get"), this.#C(e1, {
4672
+ allowStale: i,
4673
+ updateAgeOnGet: s,
4674
+ noDeleteOnStaleGet: n,
4675
+ status: a
4676
+ });
4677
+ let _ = {
4678
+ allowStale: i,
4679
+ updateAgeOnGet: s,
4680
+ noDeleteOnStaleGet: n,
4681
+ ttl: o,
4682
+ noDisposeOnSet: r,
4683
+ size: h,
4684
+ sizeCalculation: l,
4685
+ noUpdateTTL: c,
4686
+ noDeleteOnFetchRejection: f,
4687
+ allowStaleOnFetchRejection: g,
4688
+ allowStaleOnFetchAbort: T,
4689
+ ignoreFetchAbort: p,
4690
+ status: a,
4691
+ signal: m
4692
+ }, b = this.#s.get(e1);
4693
+ if (void 0 === b) {
4694
+ a && (a.fetch = "miss");
4695
+ let d = this.#P(e1, b, _, w);
4696
+ return d.__returned = d;
4909
4697
  }
4910
4698
  {
4911
- const v = this.#valList[index];
4912
- if (this.#isBackgroundFetch(v)) {
4913
- const stale = allowStale && void 0 !== v.__staleWhileFetching;
4914
- if (status) {
4915
- status.fetch = 'inflight';
4916
- if (stale) status.returnedStale = true;
4917
- }
4918
- return stale ? v.__staleWhileFetching : v.__returned = v;
4919
- }
4920
- const isStale = this.#isStale(index);
4921
- if (!forceRefresh && !isStale) {
4922
- if (status) status.fetch = 'hit';
4923
- this.#moveToTail(index);
4924
- if (updateAgeOnGet) this.#updateItemAge(index);
4925
- if (status) this.#statusTTL(status, index);
4926
- return v;
4927
- }
4928
- const p = this.#backgroundFetch(k, index, options, context);
4929
- const hasStale = void 0 !== p.__staleWhileFetching;
4930
- const staleVal = hasStale && allowStale;
4931
- if (status) {
4932
- status.fetch = isStale ? 'stale' : 'refresh';
4933
- if (staleVal && isStale) status.returnedStale = true;
4934
- }
4935
- return staleVal ? p.__staleWhileFetching : p.__returned = p;
4936
- }
4937
- }
4938
- async forceFetch(k, fetchOptions = {}) {
4939
- const v = await this.fetch(k, fetchOptions);
4940
- if (void 0 === v) throw new Error('fetch() returned undefined');
4941
- return v;
4942
- }
4943
- memo(k, memoOptions = {}) {
4944
- const memoMethod = this.#memoMethod;
4945
- if (!memoMethod) throw new Error('no memoMethod provided to constructor');
4946
- const { context, forceRefresh, ...options } = memoOptions;
4947
- const v = this.get(k, options);
4948
- if (!forceRefresh && void 0 !== v) return v;
4949
- const vv = memoMethod(k, v, {
4950
- options,
4951
- context
4699
+ let d = this.#t[b];
4700
+ if (this.#e(d)) {
4701
+ let E = i && void 0 !== d.__staleWhileFetching;
4702
+ return a && (a.fetch = "inflight", E && (a.returnedStale = !0)), E ? d.__staleWhileFetching : d.__returned = d;
4703
+ }
4704
+ let A = this.#p(b);
4705
+ if (!y && !A) return a && (a.fetch = "hit"), this.#L(b), s && this.#x(b), a && this.#E(a, b), d;
4706
+ let z = this.#P(e1, b, _, w), v = void 0 !== z.__staleWhileFetching && i;
4707
+ return a && (a.fetch = A ? "stale" : "refresh", v && A && (a.returnedStale = !0)), v ? z.__staleWhileFetching : z.__returned = z;
4708
+ }
4709
+ }
4710
+ forceFetch(e1, t1 = {}) {
4711
+ let i = W.hasSubscribers, { status: s = D() ? {} : void 0 } = t1;
4712
+ t1.status = s, s && t1.context && (s.context = t1.context);
4713
+ let n = this.#K(e1, t1);
4714
+ return s && D() && i && (s.trace = !0, W.tracePromise(()=>n, s).catch(()=>{})), n;
4715
+ }
4716
+ async #K(e1, t1 = {}) {
4717
+ let i = await this.#B(e1, t1);
4718
+ if (void 0 === i) throw new Error("fetch() returned undefined");
4719
+ return i;
4720
+ }
4721
+ memo(e1, t1 = {}) {
4722
+ let { status: i = S.hasSubscribers ? {} : void 0 } = t1;
4723
+ t1.status = i, i && (i.op = "memo", i.key = e1, t1.context && (i.context = t1.context));
4724
+ let s = this.#Q(e1, t1);
4725
+ return i && (i.value = s), S.hasSubscribers && S.publish(i), s;
4726
+ }
4727
+ #Q(e1, t1 = {}) {
4728
+ let i = this.#U;
4729
+ if (!i) throw new Error("no memoMethod provided to constructor");
4730
+ let { context: s, status: n, forceRefresh: o, ...r } = t1;
4731
+ n && o && (n.forceRefresh = !0);
4732
+ let h = this.#C(e1, r), l = o || void 0 === h;
4733
+ if (n && (n.memo = l ? "miss" : "hit", l || (n.value = h)), !l) return h;
4734
+ let c = i(e1, h, {
4735
+ options: r,
4736
+ context: s
4952
4737
  });
4953
- this.set(k, vv, options);
4954
- return vv;
4955
- }
4956
- get(k, getOptions = {}) {
4957
- const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
4958
- const index = this.#keyMap.get(k);
4959
- if (void 0 !== index) {
4960
- const value = this.#valList[index];
4961
- const fetching = this.#isBackgroundFetch(value);
4962
- if (status) this.#statusTTL(status, index);
4963
- if (this.#isStale(index)) {
4964
- if (status) status.get = 'stale';
4965
- if (fetching) {
4966
- if (status && allowStale && void 0 !== value.__staleWhileFetching) status.returnedStale = true;
4967
- return allowStale ? value.__staleWhileFetching : void 0;
4968
- }
4969
- if (!noDeleteOnStaleGet) this.#delete(k, 'expire');
4970
- if (status && allowStale) status.returnedStale = true;
4971
- return allowStale ? value : void 0;
4972
- }
4973
- if (status) status.get = 'hit';
4974
- if (fetching) return value.__staleWhileFetching;
4975
- this.#moveToTail(index);
4976
- if (updateAgeOnGet) this.#updateItemAge(index);
4977
- return value;
4738
+ return n && (n.value = c), this.#O(e1, c, r), c;
4739
+ }
4740
+ get(e1, t1 = {}) {
4741
+ let { status: i = S.hasSubscribers ? {} : void 0 } = t1;
4742
+ t1.status = i, i && (i.op = "get", i.key = e1);
4743
+ let s = this.#C(e1, t1);
4744
+ return i && (void 0 !== s && (i.value = s), S.hasSubscribers && S.publish(i)), s;
4745
+ }
4746
+ #C(e1, t1 = {}) {
4747
+ let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = t1, r = this.#s.get(e1);
4748
+ if (void 0 === r) {
4749
+ o && (o.get = "miss");
4750
+ return;
4978
4751
  }
4979
- if (status) status.get = 'miss';
4752
+ let h = this.#t[r], l = this.#e(h);
4753
+ return o && this.#E(o, r), this.#p(r) ? l ? (o && (o.get = "stale-fetching"), i && void 0 !== h.__staleWhileFetching ? (o && (o.returnedStale = !0), h.__staleWhileFetching) : void 0) : (n || this.#v(e1, "expire"), o && (o.get = "stale"), i ? (o && (o.returnedStale = !0), h) : void 0) : (o && (o.get = l ? "fetching" : "hit"), this.#L(r), s && this.#x(r), l ? h.__staleWhileFetching : h);
4980
4754
  }
4981
- #connect(p, n) {
4982
- this.#prev[n] = p;
4983
- this.#next[p] = n;
4755
+ #$(e1, t1) {
4756
+ this.#c[t1] = e1, this.#a[e1] = t1;
4984
4757
  }
4985
- #moveToTail(index) {
4986
- if (index !== this.#tail) {
4987
- if (index === this.#head) this.#head = this.#next[index];
4988
- else this.#connect(this.#prev[index], this.#next[index]);
4989
- this.#connect(this.#tail, index);
4990
- this.#tail = index;
4991
- }
4758
+ #L(e1) {
4759
+ e1 !== this.#h && (e1 === this.#l ? this.#l = this.#a[e1] : this.#$(this.#c[e1], this.#a[e1]), this.#$(this.#h, e1), this.#h = e1);
4992
4760
  }
4993
- delete(k) {
4994
- return this.#delete(k, 'delete');
4761
+ delete(e1) {
4762
+ return this.#v(e1, "delete");
4995
4763
  }
4996
- #delete(k, reason) {
4997
- let deleted = false;
4998
- if (0 !== this.#size) {
4999
- const index = this.#keyMap.get(k);
5000
- if (void 0 !== index) {
5001
- deleted = true;
5002
- if (1 === this.#size) this.#clear(reason);
4764
+ #v(e1, t1) {
4765
+ S.hasSubscribers && S.publish({
4766
+ op: "delete",
4767
+ delete: t1,
4768
+ key: e1
4769
+ });
4770
+ let i = !1;
4771
+ if (0 !== this.#n) {
4772
+ let s = this.#s.get(e1);
4773
+ if (void 0 !== s) if (this.#g?.[s] && (clearTimeout(this.#g?.[s]), this.#g[s] = void 0), i = !0, 1 === this.#n) this.#q(t1);
4774
+ else {
4775
+ this.#R(s);
4776
+ let n = this.#t[s];
4777
+ if (this.#e(n) ? n.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#w?.(n, e1, t1), this.#f && this.#r?.push([
4778
+ n,
4779
+ e1,
4780
+ t1
4781
+ ])), this.#s.delete(e1), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#c[s];
4782
+ else if (s === this.#l) this.#l = this.#a[s];
5003
4783
  else {
5004
- this.#removeItemSize(index);
5005
- const v = this.#valList[index];
5006
- if (this.#isBackgroundFetch(v)) v.__abortController.abort(new Error('deleted'));
5007
- else if (this.#hasDispose || this.#hasDisposeAfter) {
5008
- if (this.#hasDispose) this.#dispose?.(v, k, reason);
5009
- if (this.#hasDisposeAfter) this.#disposed?.push([
5010
- v,
5011
- k,
5012
- reason
5013
- ]);
5014
- }
5015
- this.#keyMap.delete(k);
5016
- this.#keyList[index] = void 0;
5017
- this.#valList[index] = void 0;
5018
- if (index === this.#tail) this.#tail = this.#prev[index];
5019
- else if (index === this.#head) this.#head = this.#next[index];
5020
- else {
5021
- const pi = this.#prev[index];
5022
- this.#next[pi] = this.#next[index];
5023
- const ni = this.#next[index];
5024
- this.#prev[ni] = this.#prev[index];
5025
- }
5026
- this.#size--;
5027
- this.#free.push(index);
4784
+ let o = this.#c[s];
4785
+ this.#a[o] = this.#a[s];
4786
+ let r = this.#a[s];
4787
+ this.#c[r] = this.#c[s];
5028
4788
  }
4789
+ this.#n--, this.#y.push(s);
5029
4790
  }
5030
4791
  }
5031
- if (this.#hasDisposeAfter && this.#disposed?.length) {
5032
- const dt = this.#disposed;
5033
- let task;
5034
- while(task = dt?.shift())this.#disposeAfter?.(...task);
4792
+ if (this.#f && this.#r?.length) {
4793
+ let s = this.#r, n;
4794
+ for(; n = s?.shift();)this.#S?.(...n);
5035
4795
  }
5036
- return deleted;
4796
+ return i;
5037
4797
  }
5038
4798
  clear() {
5039
- return this.#clear('delete');
4799
+ return this.#q("delete");
5040
4800
  }
5041
- #clear(reason) {
5042
- for (const index of this.#rindexes({
5043
- allowStale: true
4801
+ #q(e1) {
4802
+ for (let t1 of this.#z({
4803
+ allowStale: !0
5044
4804
  })){
5045
- const v = this.#valList[index];
5046
- if (this.#isBackgroundFetch(v)) v.__abortController.abort(new Error('deleted'));
4805
+ let i = this.#t[t1];
4806
+ if (this.#e(i)) i.__abortController.abort(new Error("deleted"));
5047
4807
  else {
5048
- const k = this.#keyList[index];
5049
- if (this.#hasDispose) this.#dispose?.(v, k, reason);
5050
- if (this.#hasDisposeAfter) this.#disposed?.push([
5051
- v,
5052
- k,
5053
- reason
4808
+ let s = this.#i[t1];
4809
+ this.#T && this.#w?.(i, s, e1), this.#f && this.#r?.push([
4810
+ i,
4811
+ s,
4812
+ e1
5054
4813
  ]);
5055
4814
  }
5056
4815
  }
5057
- this.#keyMap.clear();
5058
- this.#valList.fill(void 0);
5059
- this.#keyList.fill(void 0);
5060
- if (this.#ttls && this.#starts) {
5061
- this.#ttls.fill(0);
5062
- this.#starts.fill(0);
4816
+ if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
4817
+ this.#d.fill(0), this.#F.fill(0);
4818
+ for (let t1 of this.#g ?? [])void 0 !== t1 && clearTimeout(t1);
4819
+ this.#g?.fill(void 0);
5063
4820
  }
5064
- if (this.#sizes) this.#sizes.fill(0);
5065
- this.#head = 0;
5066
- this.#tail = 0;
5067
- this.#free.length = 0;
5068
- this.#calculatedSize = 0;
5069
- this.#size = 0;
5070
- if (this.#hasDisposeAfter && this.#disposed) {
5071
- const dt = this.#disposed;
5072
- let task;
5073
- while(task = dt?.shift())this.#disposeAfter?.(...task);
4821
+ if (this.#_ && this.#_.fill(0), this.#l = 0, this.#h = 0, this.#y.length = 0, this.#b = 0, this.#n = 0, this.#f && this.#r) {
4822
+ let t1 = this.#r, i;
4823
+ for(; i = t1?.shift();)this.#S?.(...i);
5074
4824
  }
5075
4825
  }
5076
- }
4826
+ };
5077
4827
  var external_fs_ = __webpack_require__("fs");
5078
4828
  const proc = 'object' == typeof process && process ? process : {
5079
4829
  stdout: null,
@@ -5146,7 +4896,7 @@ var __webpack_modules__ = {
5146
4896
  }
5147
4897
  constructor(src, dest, opts){
5148
4898
  super(src, dest, opts);
5149
- this.proxyErrors = (er)=>dest.emit('error', er);
4899
+ this.proxyErrors = (er)=>this.dest.emit('error', er);
5150
4900
  src.on('error', this.proxyErrors);
5151
4901
  }
5152
4902
  }
@@ -5598,7 +5348,8 @@ var __webpack_modules__ = {
5598
5348
  return: stop,
5599
5349
  [Symbol.asyncIterator] () {
5600
5350
  return this;
5601
- }
5351
+ },
5352
+ [Symbol.asyncDispose]: async ()=>{}
5602
5353
  };
5603
5354
  }
5604
5355
  [Symbol.iterator]() {
@@ -5632,7 +5383,8 @@ var __webpack_modules__ = {
5632
5383
  return: stop,
5633
5384
  [Symbol.iterator] () {
5634
5385
  return this;
5635
- }
5386
+ },
5387
+ [Symbol.dispose]: ()=>{}
5636
5388
  };
5637
5389
  }
5638
5390
  destroy(er) {
@@ -5715,14 +5467,14 @@ var __webpack_modules__ = {
5715
5467
  normalizeNocaseCache.set(s, n);
5716
5468
  return n;
5717
5469
  };
5718
- class ResolveCache extends LRUCache {
5470
+ class ResolveCache extends L {
5719
5471
  constructor(){
5720
5472
  super({
5721
5473
  max: 256
5722
5474
  });
5723
5475
  }
5724
5476
  }
5725
- class ChildrenCache extends LRUCache {
5477
+ class ChildrenCache extends L {
5726
5478
  constructor(maxSize = 16384){
5727
5479
  super({
5728
5480
  maxSize,
@@ -6865,6 +6617,586 @@ var __webpack_modules__ = {
6865
6617
  return true;
6866
6618
  }
6867
6619
  }
6620
+ const esm_proc = 'object' == typeof process && process ? process : {
6621
+ stdout: null,
6622
+ stderr: null
6623
+ };
6624
+ const esm_isStream = (s)=>!!s && 'object' == typeof s && (s instanceof esm_Minipass || s instanceof node_stream || esm_isReadable(s) || esm_isWritable(s));
6625
+ const esm_isReadable = (s)=>!!s && 'object' == typeof s && s instanceof EventEmitter && 'function' == typeof s.pipe && s.pipe !== node_stream.Writable.prototype.pipe;
6626
+ const esm_isWritable = (s)=>!!s && 'object' == typeof s && s instanceof EventEmitter && 'function' == typeof s.write && 'function' == typeof s.end;
6627
+ const esm_EOF = Symbol('EOF');
6628
+ const esm_MAYBE_EMIT_END = Symbol('maybeEmitEnd');
6629
+ const esm_EMITTED_END = Symbol('emittedEnd');
6630
+ const esm_EMITTING_END = Symbol('emittingEnd');
6631
+ const esm_EMITTED_ERROR = Symbol('emittedError');
6632
+ const esm_CLOSED = Symbol('closed');
6633
+ const esm_READ = Symbol('read');
6634
+ const esm_FLUSH = Symbol('flush');
6635
+ const esm_FLUSHCHUNK = Symbol('flushChunk');
6636
+ const esm_ENCODING = Symbol('encoding');
6637
+ const esm_DECODER = Symbol('decoder');
6638
+ const esm_FLOWING = Symbol('flowing');
6639
+ const esm_PAUSED = Symbol('paused');
6640
+ const esm_RESUME = Symbol('resume');
6641
+ const esm_BUFFER = Symbol('buffer');
6642
+ const esm_PIPES = Symbol('pipes');
6643
+ const esm_BUFFERLENGTH = Symbol('bufferLength');
6644
+ const esm_BUFFERPUSH = Symbol('bufferPush');
6645
+ const esm_BUFFERSHIFT = Symbol('bufferShift');
6646
+ const esm_OBJECTMODE = Symbol('objectMode');
6647
+ const esm_DESTROYED = Symbol('destroyed');
6648
+ const esm_ERROR = Symbol('error');
6649
+ const esm_EMITDATA = Symbol('emitData');
6650
+ const esm_EMITEND = Symbol('emitEnd');
6651
+ const esm_EMITEND2 = Symbol('emitEnd2');
6652
+ const esm_ASYNC = Symbol('async');
6653
+ const esm_ABORT = Symbol('abort');
6654
+ const esm_ABORTED = Symbol('aborted');
6655
+ const esm_SIGNAL = Symbol('signal');
6656
+ const esm_DATALISTENERS = Symbol('dataListeners');
6657
+ const esm_DISCARDED = Symbol('discarded');
6658
+ const esm_defer = (fn)=>Promise.resolve().then(fn);
6659
+ const esm_nodefer = (fn)=>fn();
6660
+ const esm_isEndish = (ev)=>'end' === ev || 'finish' === ev || 'prefinish' === ev;
6661
+ const esm_isArrayBufferLike = (b)=>b instanceof ArrayBuffer || !!b && 'object' == typeof b && b.constructor && 'ArrayBuffer' === b.constructor.name && b.byteLength >= 0;
6662
+ const esm_isArrayBufferView = (b)=>!Buffer.isBuffer(b) && ArrayBuffer.isView(b);
6663
+ class esm_Pipe {
6664
+ src;
6665
+ dest;
6666
+ opts;
6667
+ ondrain;
6668
+ constructor(src, dest, opts){
6669
+ this.src = src;
6670
+ this.dest = dest;
6671
+ this.opts = opts;
6672
+ this.ondrain = ()=>src[esm_RESUME]();
6673
+ this.dest.on('drain', this.ondrain);
6674
+ }
6675
+ unpipe() {
6676
+ this.dest.removeListener('drain', this.ondrain);
6677
+ }
6678
+ proxyErrors(_er) {}
6679
+ end() {
6680
+ this.unpipe();
6681
+ if (this.opts.end) this.dest.end();
6682
+ }
6683
+ }
6684
+ class esm_PipeProxyErrors extends esm_Pipe {
6685
+ unpipe() {
6686
+ this.src.removeListener('error', this.proxyErrors);
6687
+ super.unpipe();
6688
+ }
6689
+ constructor(src, dest, opts){
6690
+ super(src, dest, opts);
6691
+ this.proxyErrors = (er)=>dest.emit('error', er);
6692
+ src.on('error', this.proxyErrors);
6693
+ }
6694
+ }
6695
+ const esm_isObjectModeOptions = (o)=>!!o.objectMode;
6696
+ const esm_isEncodingOptions = (o)=>!o.objectMode && !!o.encoding && 'buffer' !== o.encoding;
6697
+ class esm_Minipass extends EventEmitter {
6698
+ [esm_FLOWING] = false;
6699
+ [esm_PAUSED] = false;
6700
+ [esm_PIPES] = [];
6701
+ [esm_BUFFER] = [];
6702
+ [esm_OBJECTMODE];
6703
+ [esm_ENCODING];
6704
+ [esm_ASYNC];
6705
+ [esm_DECODER];
6706
+ [esm_EOF] = false;
6707
+ [esm_EMITTED_END] = false;
6708
+ [esm_EMITTING_END] = false;
6709
+ [esm_CLOSED] = false;
6710
+ [esm_EMITTED_ERROR] = null;
6711
+ [esm_BUFFERLENGTH] = 0;
6712
+ [esm_DESTROYED] = false;
6713
+ [esm_SIGNAL];
6714
+ [esm_ABORTED] = false;
6715
+ [esm_DATALISTENERS] = 0;
6716
+ [esm_DISCARDED] = false;
6717
+ writable = true;
6718
+ readable = true;
6719
+ constructor(...args){
6720
+ const options = args[0] || {};
6721
+ super();
6722
+ if (options.objectMode && 'string' == typeof options.encoding) throw new TypeError('Encoding and objectMode may not be used together');
6723
+ if (esm_isObjectModeOptions(options)) {
6724
+ this[esm_OBJECTMODE] = true;
6725
+ this[esm_ENCODING] = null;
6726
+ } else if (esm_isEncodingOptions(options)) {
6727
+ this[esm_ENCODING] = options.encoding;
6728
+ this[esm_OBJECTMODE] = false;
6729
+ } else {
6730
+ this[esm_OBJECTMODE] = false;
6731
+ this[esm_ENCODING] = null;
6732
+ }
6733
+ this[esm_ASYNC] = !!options.async;
6734
+ this[esm_DECODER] = this[esm_ENCODING] ? new StringDecoder(this[esm_ENCODING]) : null;
6735
+ if (options && true === options.debugExposeBuffer) Object.defineProperty(this, 'buffer', {
6736
+ get: ()=>this[esm_BUFFER]
6737
+ });
6738
+ if (options && true === options.debugExposePipes) Object.defineProperty(this, 'pipes', {
6739
+ get: ()=>this[esm_PIPES]
6740
+ });
6741
+ const { signal } = options;
6742
+ if (signal) {
6743
+ this[esm_SIGNAL] = signal;
6744
+ if (signal.aborted) this[esm_ABORT]();
6745
+ else signal.addEventListener('abort', ()=>this[esm_ABORT]());
6746
+ }
6747
+ }
6748
+ get bufferLength() {
6749
+ return this[esm_BUFFERLENGTH];
6750
+ }
6751
+ get encoding() {
6752
+ return this[esm_ENCODING];
6753
+ }
6754
+ set encoding(_enc) {
6755
+ throw new Error('Encoding must be set at instantiation time');
6756
+ }
6757
+ setEncoding(_enc) {
6758
+ throw new Error('Encoding must be set at instantiation time');
6759
+ }
6760
+ get objectMode() {
6761
+ return this[esm_OBJECTMODE];
6762
+ }
6763
+ set objectMode(_om) {
6764
+ throw new Error('objectMode must be set at instantiation time');
6765
+ }
6766
+ get ['async']() {
6767
+ return this[esm_ASYNC];
6768
+ }
6769
+ set ['async'](a) {
6770
+ this[esm_ASYNC] = this[esm_ASYNC] || !!a;
6771
+ }
6772
+ [esm_ABORT]() {
6773
+ this[esm_ABORTED] = true;
6774
+ this.emit('abort', this[esm_SIGNAL]?.reason);
6775
+ this.destroy(this[esm_SIGNAL]?.reason);
6776
+ }
6777
+ get aborted() {
6778
+ return this[esm_ABORTED];
6779
+ }
6780
+ set aborted(_) {}
6781
+ write(chunk, encoding, cb) {
6782
+ if (this[esm_ABORTED]) return false;
6783
+ if (this[esm_EOF]) throw new Error('write after end');
6784
+ if (this[esm_DESTROYED]) {
6785
+ this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), {
6786
+ code: 'ERR_STREAM_DESTROYED'
6787
+ }));
6788
+ return true;
6789
+ }
6790
+ if ('function' == typeof encoding) {
6791
+ cb = encoding;
6792
+ encoding = 'utf8';
6793
+ }
6794
+ if (!encoding) encoding = 'utf8';
6795
+ const fn = this[esm_ASYNC] ? esm_defer : esm_nodefer;
6796
+ if (!this[esm_OBJECTMODE] && !Buffer.isBuffer(chunk)) {
6797
+ if (esm_isArrayBufferView(chunk)) chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
6798
+ else if (esm_isArrayBufferLike(chunk)) chunk = Buffer.from(chunk);
6799
+ else if ('string' != typeof chunk) throw new Error('Non-contiguous data written to non-objectMode stream');
6800
+ }
6801
+ if (this[esm_OBJECTMODE]) {
6802
+ if (this[esm_FLOWING] && 0 !== this[esm_BUFFERLENGTH]) this[esm_FLUSH](true);
6803
+ if (this[esm_FLOWING]) this.emit('data', chunk);
6804
+ else this[esm_BUFFERPUSH](chunk);
6805
+ if (0 !== this[esm_BUFFERLENGTH]) this.emit('readable');
6806
+ if (cb) fn(cb);
6807
+ return this[esm_FLOWING];
6808
+ }
6809
+ if (!chunk.length) {
6810
+ if (0 !== this[esm_BUFFERLENGTH]) this.emit('readable');
6811
+ if (cb) fn(cb);
6812
+ return this[esm_FLOWING];
6813
+ }
6814
+ if ('string' == typeof chunk && !(encoding === this[esm_ENCODING] && !this[esm_DECODER]?.lastNeed)) chunk = Buffer.from(chunk, encoding);
6815
+ if (Buffer.isBuffer(chunk) && this[esm_ENCODING]) chunk = this[esm_DECODER].write(chunk);
6816
+ if (this[esm_FLOWING] && 0 !== this[esm_BUFFERLENGTH]) this[esm_FLUSH](true);
6817
+ if (this[esm_FLOWING]) this.emit('data', chunk);
6818
+ else this[esm_BUFFERPUSH](chunk);
6819
+ if (0 !== this[esm_BUFFERLENGTH]) this.emit('readable');
6820
+ if (cb) fn(cb);
6821
+ return this[esm_FLOWING];
6822
+ }
6823
+ read(n) {
6824
+ if (this[esm_DESTROYED]) return null;
6825
+ this[esm_DISCARDED] = false;
6826
+ if (0 === this[esm_BUFFERLENGTH] || 0 === n || n && n > this[esm_BUFFERLENGTH]) {
6827
+ this[esm_MAYBE_EMIT_END]();
6828
+ return null;
6829
+ }
6830
+ if (this[esm_OBJECTMODE]) n = null;
6831
+ if (this[esm_BUFFER].length > 1 && !this[esm_OBJECTMODE]) this[esm_BUFFER] = [
6832
+ this[esm_ENCODING] ? this[esm_BUFFER].join('') : Buffer.concat(this[esm_BUFFER], this[esm_BUFFERLENGTH])
6833
+ ];
6834
+ const ret = this[esm_READ](n || null, this[esm_BUFFER][0]);
6835
+ this[esm_MAYBE_EMIT_END]();
6836
+ return ret;
6837
+ }
6838
+ [esm_READ](n, chunk) {
6839
+ if (this[esm_OBJECTMODE]) this[esm_BUFFERSHIFT]();
6840
+ else {
6841
+ const c = chunk;
6842
+ if (n === c.length || null === n) this[esm_BUFFERSHIFT]();
6843
+ else if ('string' == typeof c) {
6844
+ this[esm_BUFFER][0] = c.slice(n);
6845
+ chunk = c.slice(0, n);
6846
+ this[esm_BUFFERLENGTH] -= n;
6847
+ } else {
6848
+ this[esm_BUFFER][0] = c.subarray(n);
6849
+ chunk = c.subarray(0, n);
6850
+ this[esm_BUFFERLENGTH] -= n;
6851
+ }
6852
+ }
6853
+ this.emit('data', chunk);
6854
+ if (!this[esm_BUFFER].length && !this[esm_EOF]) this.emit('drain');
6855
+ return chunk;
6856
+ }
6857
+ end(chunk, encoding, cb) {
6858
+ if ('function' == typeof chunk) {
6859
+ cb = chunk;
6860
+ chunk = void 0;
6861
+ }
6862
+ if ('function' == typeof encoding) {
6863
+ cb = encoding;
6864
+ encoding = 'utf8';
6865
+ }
6866
+ if (void 0 !== chunk) this.write(chunk, encoding);
6867
+ if (cb) this.once('end', cb);
6868
+ this[esm_EOF] = true;
6869
+ this.writable = false;
6870
+ if (this[esm_FLOWING] || !this[esm_PAUSED]) this[esm_MAYBE_EMIT_END]();
6871
+ return this;
6872
+ }
6873
+ [esm_RESUME]() {
6874
+ if (this[esm_DESTROYED]) return;
6875
+ if (!this[esm_DATALISTENERS] && !this[esm_PIPES].length) this[esm_DISCARDED] = true;
6876
+ this[esm_PAUSED] = false;
6877
+ this[esm_FLOWING] = true;
6878
+ this.emit('resume');
6879
+ if (this[esm_BUFFER].length) this[esm_FLUSH]();
6880
+ else if (this[esm_EOF]) this[esm_MAYBE_EMIT_END]();
6881
+ else this.emit('drain');
6882
+ }
6883
+ resume() {
6884
+ return this[esm_RESUME]();
6885
+ }
6886
+ pause() {
6887
+ this[esm_FLOWING] = false;
6888
+ this[esm_PAUSED] = true;
6889
+ this[esm_DISCARDED] = false;
6890
+ }
6891
+ get destroyed() {
6892
+ return this[esm_DESTROYED];
6893
+ }
6894
+ get flowing() {
6895
+ return this[esm_FLOWING];
6896
+ }
6897
+ get paused() {
6898
+ return this[esm_PAUSED];
6899
+ }
6900
+ [esm_BUFFERPUSH](chunk) {
6901
+ if (this[esm_OBJECTMODE]) this[esm_BUFFERLENGTH] += 1;
6902
+ else this[esm_BUFFERLENGTH] += chunk.length;
6903
+ this[esm_BUFFER].push(chunk);
6904
+ }
6905
+ [esm_BUFFERSHIFT]() {
6906
+ if (this[esm_OBJECTMODE]) this[esm_BUFFERLENGTH] -= 1;
6907
+ else this[esm_BUFFERLENGTH] -= this[esm_BUFFER][0].length;
6908
+ return this[esm_BUFFER].shift();
6909
+ }
6910
+ [esm_FLUSH](noDrain = false) {
6911
+ do ;
6912
+ while (this[esm_FLUSHCHUNK](this[esm_BUFFERSHIFT]()) && this[esm_BUFFER].length);
6913
+ if (!noDrain && !this[esm_BUFFER].length && !this[esm_EOF]) this.emit('drain');
6914
+ }
6915
+ [esm_FLUSHCHUNK](chunk) {
6916
+ this.emit('data', chunk);
6917
+ return this[esm_FLOWING];
6918
+ }
6919
+ pipe(dest, opts) {
6920
+ if (this[esm_DESTROYED]) return dest;
6921
+ this[esm_DISCARDED] = false;
6922
+ const ended = this[esm_EMITTED_END];
6923
+ opts = opts || {};
6924
+ if (dest === esm_proc.stdout || dest === esm_proc.stderr) opts.end = false;
6925
+ else opts.end = false !== opts.end;
6926
+ opts.proxyErrors = !!opts.proxyErrors;
6927
+ if (ended) {
6928
+ if (opts.end) dest.end();
6929
+ } else {
6930
+ this[esm_PIPES].push(opts.proxyErrors ? new esm_PipeProxyErrors(this, dest, opts) : new esm_Pipe(this, dest, opts));
6931
+ if (this[esm_ASYNC]) esm_defer(()=>this[esm_RESUME]());
6932
+ else this[esm_RESUME]();
6933
+ }
6934
+ return dest;
6935
+ }
6936
+ unpipe(dest) {
6937
+ const p = this[esm_PIPES].find((p)=>p.dest === dest);
6938
+ if (p) {
6939
+ if (1 === this[esm_PIPES].length) {
6940
+ if (this[esm_FLOWING] && 0 === this[esm_DATALISTENERS]) this[esm_FLOWING] = false;
6941
+ this[esm_PIPES] = [];
6942
+ } else this[esm_PIPES].splice(this[esm_PIPES].indexOf(p), 1);
6943
+ p.unpipe();
6944
+ }
6945
+ }
6946
+ addListener(ev, handler) {
6947
+ return this.on(ev, handler);
6948
+ }
6949
+ on(ev, handler) {
6950
+ const ret = super.on(ev, handler);
6951
+ if ('data' === ev) {
6952
+ this[esm_DISCARDED] = false;
6953
+ this[esm_DATALISTENERS]++;
6954
+ if (!this[esm_PIPES].length && !this[esm_FLOWING]) this[esm_RESUME]();
6955
+ } else if ('readable' === ev && 0 !== this[esm_BUFFERLENGTH]) super.emit('readable');
6956
+ else if (esm_isEndish(ev) && this[esm_EMITTED_END]) {
6957
+ super.emit(ev);
6958
+ this.removeAllListeners(ev);
6959
+ } else if ('error' === ev && this[esm_EMITTED_ERROR]) {
6960
+ const h = handler;
6961
+ if (this[esm_ASYNC]) esm_defer(()=>h.call(this, this[esm_EMITTED_ERROR]));
6962
+ else h.call(this, this[esm_EMITTED_ERROR]);
6963
+ }
6964
+ return ret;
6965
+ }
6966
+ removeListener(ev, handler) {
6967
+ return this.off(ev, handler);
6968
+ }
6969
+ off(ev, handler) {
6970
+ const ret = super.off(ev, handler);
6971
+ if ('data' === ev) {
6972
+ this[esm_DATALISTENERS] = this.listeners('data').length;
6973
+ if (0 === this[esm_DATALISTENERS] && !this[esm_DISCARDED] && !this[esm_PIPES].length) this[esm_FLOWING] = false;
6974
+ }
6975
+ return ret;
6976
+ }
6977
+ removeAllListeners(ev) {
6978
+ const ret = super.removeAllListeners(ev);
6979
+ if ('data' === ev || void 0 === ev) {
6980
+ this[esm_DATALISTENERS] = 0;
6981
+ if (!this[esm_DISCARDED] && !this[esm_PIPES].length) this[esm_FLOWING] = false;
6982
+ }
6983
+ return ret;
6984
+ }
6985
+ get emittedEnd() {
6986
+ return this[esm_EMITTED_END];
6987
+ }
6988
+ [esm_MAYBE_EMIT_END]() {
6989
+ if (!this[esm_EMITTING_END] && !this[esm_EMITTED_END] && !this[esm_DESTROYED] && 0 === this[esm_BUFFER].length && this[esm_EOF]) {
6990
+ this[esm_EMITTING_END] = true;
6991
+ this.emit('end');
6992
+ this.emit('prefinish');
6993
+ this.emit('finish');
6994
+ if (this[esm_CLOSED]) this.emit('close');
6995
+ this[esm_EMITTING_END] = false;
6996
+ }
6997
+ }
6998
+ emit(ev, ...args) {
6999
+ const data = args[0];
7000
+ if ('error' !== ev && 'close' !== ev && ev !== esm_DESTROYED && this[esm_DESTROYED]) return false;
7001
+ if ('data' === ev) return this[esm_OBJECTMODE] || data ? this[esm_ASYNC] ? (esm_defer(()=>this[esm_EMITDATA](data)), true) : this[esm_EMITDATA](data) : false;
7002
+ if ('end' === ev) return this[esm_EMITEND]();
7003
+ if ('close' === ev) {
7004
+ this[esm_CLOSED] = true;
7005
+ if (!this[esm_EMITTED_END] && !this[esm_DESTROYED]) return false;
7006
+ const ret = super.emit('close');
7007
+ this.removeAllListeners('close');
7008
+ return ret;
7009
+ }
7010
+ if ('error' === ev) {
7011
+ this[esm_EMITTED_ERROR] = data;
7012
+ super.emit(esm_ERROR, data);
7013
+ const ret = !this[esm_SIGNAL] || this.listeners('error').length ? super.emit('error', data) : false;
7014
+ this[esm_MAYBE_EMIT_END]();
7015
+ return ret;
7016
+ } else if ('resume' === ev) {
7017
+ const ret = super.emit('resume');
7018
+ this[esm_MAYBE_EMIT_END]();
7019
+ return ret;
7020
+ } else if ('finish' === ev || 'prefinish' === ev) {
7021
+ const ret = super.emit(ev);
7022
+ this.removeAllListeners(ev);
7023
+ return ret;
7024
+ }
7025
+ const ret = super.emit(ev, ...args);
7026
+ this[esm_MAYBE_EMIT_END]();
7027
+ return ret;
7028
+ }
7029
+ [esm_EMITDATA](data) {
7030
+ for (const p of this[esm_PIPES])if (false === p.dest.write(data)) this.pause();
7031
+ const ret = this[esm_DISCARDED] ? false : super.emit('data', data);
7032
+ this[esm_MAYBE_EMIT_END]();
7033
+ return ret;
7034
+ }
7035
+ [esm_EMITEND]() {
7036
+ if (this[esm_EMITTED_END]) return false;
7037
+ this[esm_EMITTED_END] = true;
7038
+ this.readable = false;
7039
+ return this[esm_ASYNC] ? (esm_defer(()=>this[esm_EMITEND2]()), true) : this[esm_EMITEND2]();
7040
+ }
7041
+ [esm_EMITEND2]() {
7042
+ if (this[esm_DECODER]) {
7043
+ const data = this[esm_DECODER].end();
7044
+ if (data) {
7045
+ for (const p of this[esm_PIPES])p.dest.write(data);
7046
+ if (!this[esm_DISCARDED]) super.emit('data', data);
7047
+ }
7048
+ }
7049
+ for (const p of this[esm_PIPES])p.end();
7050
+ const ret = super.emit('end');
7051
+ this.removeAllListeners('end');
7052
+ return ret;
7053
+ }
7054
+ async collect() {
7055
+ const buf = Object.assign([], {
7056
+ dataLength: 0
7057
+ });
7058
+ if (!this[esm_OBJECTMODE]) buf.dataLength = 0;
7059
+ const p = this.promise();
7060
+ this.on('data', (c)=>{
7061
+ buf.push(c);
7062
+ if (!this[esm_OBJECTMODE]) buf.dataLength += c.length;
7063
+ });
7064
+ await p;
7065
+ return buf;
7066
+ }
7067
+ async concat() {
7068
+ if (this[esm_OBJECTMODE]) throw new Error('cannot concat in objectMode');
7069
+ const buf = await this.collect();
7070
+ return this[esm_ENCODING] ? buf.join('') : Buffer.concat(buf, buf.dataLength);
7071
+ }
7072
+ async promise() {
7073
+ return new Promise((resolve, reject)=>{
7074
+ this.on(esm_DESTROYED, ()=>reject(new Error('stream destroyed')));
7075
+ this.on('error', (er)=>reject(er));
7076
+ this.on('end', ()=>resolve());
7077
+ });
7078
+ }
7079
+ [Symbol.asyncIterator]() {
7080
+ this[esm_DISCARDED] = false;
7081
+ let stopped = false;
7082
+ const stop = async ()=>{
7083
+ this.pause();
7084
+ stopped = true;
7085
+ return {
7086
+ value: void 0,
7087
+ done: true
7088
+ };
7089
+ };
7090
+ const next = ()=>{
7091
+ if (stopped) return stop();
7092
+ const res = this.read();
7093
+ if (null !== res) return Promise.resolve({
7094
+ done: false,
7095
+ value: res
7096
+ });
7097
+ if (this[esm_EOF]) return stop();
7098
+ let resolve;
7099
+ let reject;
7100
+ const onerr = (er)=>{
7101
+ this.off('data', ondata);
7102
+ this.off('end', onend);
7103
+ this.off(esm_DESTROYED, ondestroy);
7104
+ stop();
7105
+ reject(er);
7106
+ };
7107
+ const ondata = (value)=>{
7108
+ this.off('error', onerr);
7109
+ this.off('end', onend);
7110
+ this.off(esm_DESTROYED, ondestroy);
7111
+ this.pause();
7112
+ resolve({
7113
+ value,
7114
+ done: !!this[esm_EOF]
7115
+ });
7116
+ };
7117
+ const onend = ()=>{
7118
+ this.off('error', onerr);
7119
+ this.off('data', ondata);
7120
+ this.off(esm_DESTROYED, ondestroy);
7121
+ stop();
7122
+ resolve({
7123
+ done: true,
7124
+ value: void 0
7125
+ });
7126
+ };
7127
+ const ondestroy = ()=>onerr(new Error('stream destroyed'));
7128
+ return new Promise((res, rej)=>{
7129
+ reject = rej;
7130
+ resolve = res;
7131
+ this.once(esm_DESTROYED, ondestroy);
7132
+ this.once('error', onerr);
7133
+ this.once('end', onend);
7134
+ this.once('data', ondata);
7135
+ });
7136
+ };
7137
+ return {
7138
+ next,
7139
+ throw: stop,
7140
+ return: stop,
7141
+ [Symbol.asyncIterator] () {
7142
+ return this;
7143
+ }
7144
+ };
7145
+ }
7146
+ [Symbol.iterator]() {
7147
+ this[esm_DISCARDED] = false;
7148
+ let stopped = false;
7149
+ const stop = ()=>{
7150
+ this.pause();
7151
+ this.off(esm_ERROR, stop);
7152
+ this.off(esm_DESTROYED, stop);
7153
+ this.off('end', stop);
7154
+ stopped = true;
7155
+ return {
7156
+ done: true,
7157
+ value: void 0
7158
+ };
7159
+ };
7160
+ const next = ()=>{
7161
+ if (stopped) return stop();
7162
+ const value = this.read();
7163
+ return null === value ? stop() : {
7164
+ done: false,
7165
+ value
7166
+ };
7167
+ };
7168
+ this.once('end', stop);
7169
+ this.once(esm_ERROR, stop);
7170
+ this.once(esm_DESTROYED, stop);
7171
+ return {
7172
+ next,
7173
+ throw: stop,
7174
+ return: stop,
7175
+ [Symbol.iterator] () {
7176
+ return this;
7177
+ }
7178
+ };
7179
+ }
7180
+ destroy(er) {
7181
+ if (this[esm_DESTROYED]) {
7182
+ if (er) this.emit('error', er);
7183
+ else this.emit(esm_DESTROYED);
7184
+ return this;
7185
+ }
7186
+ this[esm_DESTROYED] = true;
7187
+ this[esm_DISCARDED] = true;
7188
+ this[esm_BUFFER].length = 0;
7189
+ this[esm_BUFFERLENGTH] = 0;
7190
+ const wc = this;
7191
+ if ('function' == typeof wc.close && !this[esm_CLOSED]) wc.close();
7192
+ if (er) this.emit('error', er);
7193
+ else this.emit(esm_DESTROYED);
7194
+ return this;
7195
+ }
7196
+ static get isStream() {
7197
+ return esm_isStream;
7198
+ }
7199
+ }
6868
7200
  const ignore_defaultPlatform = 'object' == typeof process && process && 'string' == typeof process.platform ? process.platform : 'linux';
6869
7201
  class Ignore {
6870
7202
  relative;
@@ -7343,7 +7675,7 @@ var __webpack_modules__ = {
7343
7675
  results;
7344
7676
  constructor(patterns, path, opts){
7345
7677
  super(patterns, path, opts);
7346
- this.results = new Minipass({
7678
+ this.results = new esm_Minipass({
7347
7679
  signal: this.signal,
7348
7680
  objectMode: true
7349
7681
  });
@@ -10851,7 +11183,7 @@ Usage:
10851
11183
  type: 'boolean',
10852
11184
  description: `Turn on logging to help debug why certain keys or values are not being set as you expect, default is ${config_factory_defaultConfig.dotenvDebug}`
10853
11185
  }
10854
- }).version('version', 'Show version number', "1.8.9").help().epilogue(`For complete list of configuration options, please visit:
11186
+ }).version('version', 'Show version number', "1.8.10-beta-20260604215059.0").help().epilogue(`For complete list of configuration options, please visit:
10855
11187
  • Web options: https://midscenejs.com/automate-with-scripts-in-yaml#the-web-part
10856
11188
  • Android options: https://midscenejs.com/automate-with-scripts-in-yaml#the-android-part
10857
11189
  • iOS options: https://midscenejs.com/automate-with-scripts-in-yaml#the-ios-part