@hyperfixi/mcp-server 2.7.2 → 2.9.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.
@@ -68,6 +68,7 @@ var closePattern = /\\}/g;
68
68
  var commaPattern = /\\,/g;
69
69
  var periodPattern = /\\\./g;
70
70
  var EXPANSION_MAX = 1e5;
71
+ var EXPANSION_MAX_LENGTH = 4e6;
71
72
  function numeric(str) {
72
73
  return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
73
74
  }
@@ -102,11 +103,11 @@ function expand(str, options = {}) {
102
103
  if (!str) {
103
104
  return [];
104
105
  }
105
- const { max = EXPANSION_MAX } = options;
106
+ const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH } = options;
106
107
  if (str.slice(0, 2) === "{}") {
107
108
  str = "\\{\\}" + str.slice(2);
108
109
  }
109
- return expand_(escapeBraces(str), max, true).map(unescapeBraces);
110
+ return expand_(escapeBraces(str), max, maxLength, true).map(unescapeBraces);
110
111
  }
111
112
  function embrace(str) {
112
113
  return "{" + str + "}";
@@ -120,20 +121,83 @@ function lte(i, y) {
120
121
  function gte(i, y) {
121
122
  return i >= y;
122
123
  }
123
- function expand_(str, max, isTop) {
124
- const expansions = [];
124
+ function combine(acc, pre, values, max, maxLength, dropEmpties) {
125
+ const out = [];
126
+ let length = 0;
127
+ for (let a = 0; a < acc.length; a++) {
128
+ for (let v = 0; v < values.length; v++) {
129
+ if (out.length >= max)
130
+ return out;
131
+ const expansion = acc[a] + pre + values[v];
132
+ if (dropEmpties && !expansion)
133
+ continue;
134
+ if (length + expansion.length > maxLength)
135
+ return out;
136
+ out.push(expansion);
137
+ length += expansion.length;
138
+ }
139
+ }
140
+ return out;
141
+ }
142
+ function expandSequence(body, isAlphaSequence, max) {
143
+ const n = body.split(/\.\./);
144
+ const N = [];
145
+ if (n[0] === void 0 || n[1] === void 0) {
146
+ return N;
147
+ }
148
+ const x = numeric(n[0]);
149
+ const y = numeric(n[1]);
150
+ const width = Math.max(n[0].length, n[1].length);
151
+ let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
152
+ let test = lte;
153
+ const reverse = y < x;
154
+ if (reverse) {
155
+ incr *= -1;
156
+ test = gte;
157
+ }
158
+ const pad = n.some(isPadded);
159
+ for (let i = x; test(i, y) && N.length < max; i += incr) {
160
+ let c;
161
+ if (isAlphaSequence) {
162
+ c = String.fromCharCode(i);
163
+ if (c === "\\") {
164
+ c = "";
165
+ }
166
+ } else {
167
+ c = String(i);
168
+ if (pad) {
169
+ const need = width - c.length;
170
+ if (need > 0) {
171
+ const z = new Array(need + 1).join("0");
172
+ if (i < 0) {
173
+ c = "-" + z + c.slice(1);
174
+ } else {
175
+ c = z + c;
176
+ }
177
+ }
178
+ }
179
+ }
180
+ N.push(c);
181
+ }
182
+ return N;
183
+ }
184
+ function expand_(str, max, maxLength, isTop) {
185
+ let acc = [""];
186
+ let dropEmpties = false;
187
+ let firstGroup = true;
125
188
  for (; ; ) {
126
189
  const m = balanced("{", "}", str);
127
- if (!m)
128
- return [str];
190
+ if (!m) {
191
+ return combine(acc, str, [""], max, maxLength, dropEmpties);
192
+ }
129
193
  const pre = m.pre;
130
- if (/\$$/.test(m.pre)) {
131
- const post2 = m.post.length ? expand_(m.post, max, false) : [""];
132
- for (let k2 = 0; k2 < post2.length && k2 < max; k2++) {
133
- const expansion = pre + "{" + m.body + "}" + post2[k2];
134
- expansions.push(expansion);
135
- }
136
- return expansions;
194
+ if (/\$$/.test(pre)) {
195
+ acc = combine(acc, pre + "{" + m.body + "}", [""], max, maxLength, dropEmpties && !m.post.length);
196
+ firstGroup = false;
197
+ if (!m.post.length)
198
+ break;
199
+ str = m.post;
200
+ continue;
137
201
  }
138
202
  const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
139
203
  const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
@@ -145,74 +209,38 @@ function expand_(str, max, isTop) {
145
209
  isTop = true;
146
210
  continue;
147
211
  }
148
- return [str];
212
+ return combine(acc, pre + "{" + m.body + "}" + m.post, [""], max, maxLength, dropEmpties);
149
213
  }
150
- const post = m.post.length ? expand_(m.post, max, false) : [""];
151
- let n;
214
+ if (firstGroup) {
215
+ dropEmpties = isTop && !isSequence;
216
+ firstGroup = false;
217
+ }
218
+ let values;
152
219
  if (isSequence) {
153
- n = m.body.split(/\.\./);
220
+ values = expandSequence(m.body, isAlphaSequence, max);
154
221
  } else {
155
- n = parseCommaParts(m.body);
222
+ let n = parseCommaParts(m.body);
156
223
  if (n.length === 1 && n[0] !== void 0) {
157
- n = expand_(n[0], max, false).map(embrace);
224
+ n = expand_(n[0], max, maxLength, false).map(embrace);
158
225
  if (n.length === 1) {
159
- return post.map((p) => m.pre + n[0] + p);
160
- }
161
- }
162
- }
163
- let N;
164
- if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
165
- const x2 = numeric(n[0]);
166
- const y = numeric(n[1]);
167
- const width = Math.max(n[0].length, n[1].length);
168
- let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
169
- let test = lte;
170
- const reverse = y < x2;
171
- if (reverse) {
172
- incr *= -1;
173
- test = gte;
174
- }
175
- const pad = n.some(isPadded);
176
- N = [];
177
- for (let i = x2; test(i, y) && N.length < max; i += incr) {
178
- let c;
179
- if (isAlphaSequence) {
180
- c = String.fromCharCode(i);
181
- if (c === "\\") {
182
- c = "";
183
- }
184
- } else {
185
- c = String(i);
186
- if (pad) {
187
- const need = width - c.length;
188
- if (need > 0) {
189
- const z = new Array(need + 1).join("0");
190
- if (i < 0) {
191
- c = "-" + z + c.slice(1);
192
- } else {
193
- c = z + c;
194
- }
195
- }
196
- }
226
+ acc = combine(acc, pre + n[0], [""], max, maxLength, dropEmpties && !m.post.length);
227
+ if (!m.post.length)
228
+ break;
229
+ str = m.post;
230
+ continue;
197
231
  }
198
- N.push(c);
199
232
  }
200
- } else {
201
- N = [];
233
+ values = [];
202
234
  for (let j2 = 0; j2 < n.length; j2++) {
203
- N.push.apply(N, expand_(n[j2], max, false));
204
- }
205
- }
206
- for (let j2 = 0; j2 < N.length; j2++) {
207
- for (let k2 = 0; k2 < post.length && expansions.length < max; k2++) {
208
- const expansion = pre + N[j2] + post[k2];
209
- if (!isTop || isSequence || expansion) {
210
- expansions.push(expansion);
211
- }
235
+ values.push.apply(values, expand_(n[j2], max, maxLength, false));
212
236
  }
213
237
  }
214
- return expansions;
238
+ acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);
239
+ if (!m.post.length)
240
+ break;
241
+ str = m.post;
215
242
  }
243
+ return acc;
216
244
  }
217
245
 
218
246
  // ../../node_modules/minimatch/dist/esm/assert-valid-pattern.js
@@ -280,7 +308,7 @@ var parseClass = (glob2, position) => {
280
308
  }
281
309
  }
282
310
  if (c === "[" && !escaping) {
283
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
311
+ for (const [cls, [unip, u3, neg]] of Object.entries(posixClasses)) {
284
312
  if (glob2.startsWith(cls, i)) {
285
313
  if (rangeStart) {
286
314
  return ["$.", false, glob2.length - pos, true];
@@ -290,7 +318,7 @@ var parseClass = (glob2, position) => {
290
318
  negs.push(unip);
291
319
  else
292
320
  ranges.push(unip);
293
- uflag = uflag || u;
321
+ uflag = uflag || u3;
294
322
  continue WHILE;
295
323
  }
296
324
  }
@@ -1808,37 +1836,38 @@ minimatch.unescape = unescape;
1808
1836
  import { fileURLToPath as fileURLToPath2 } from "url";
1809
1837
 
1810
1838
  // ../../node_modules/lru-cache/dist/esm/node/index.min.js
1811
- import { tracingChannel as G, channel as P } from "diagnostics_channel";
1812
- var S = P("lru-cache:metrics");
1813
- var W = G("lru-cache");
1814
- var L = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
1815
- var R = () => S.hasSubscribers || W.hasSubscribers;
1839
+ import { tracingChannel as I, channel as G } from "diagnostics_channel";
1840
+ var S = G("lru-cache:metrics");
1841
+ var W = I("lru-cache");
1842
+ var C = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
1843
+ var D = () => S.hasSubscribers || W.hasSubscribers;
1816
1844
  var U = /* @__PURE__ */ new Set();
1817
- var M = typeof process == "object" && process ? process : {};
1818
- var k = (d3, e, t, i) => {
1819
- typeof M.emitWarning == "function" ? M.emitWarning(d3, e, t, i) : console.error(`[${t}] ${e}: ${d3}`);
1845
+ var L = typeof process == "object" && process ? process : {};
1846
+ var P = (u3, e, t, i) => {
1847
+ typeof L.emitWarning == "function" ? L.emitWarning(u3, e, t, i) : console.error(`[${t}] ${e}: ${u3}`);
1820
1848
  };
1821
- var H = (d3) => !U.has(d3);
1822
- var T = (d3) => !!d3 && d3 === Math.floor(d3) && d3 > 0 && isFinite(d3);
1823
- var j = (d3) => T(d3) ? d3 <= Math.pow(2, 8) ? Uint8Array : d3 <= Math.pow(2, 16) ? Uint16Array : d3 <= Math.pow(2, 32) ? Uint32Array : d3 <= Number.MAX_SAFE_INTEGER ? O : null : null;
1849
+ var H = (u3) => !U.has(u3);
1850
+ var X = Symbol("type");
1851
+ var F = (u3) => !!u3 && u3 === Math.floor(u3) && u3 > 0 && isFinite(u3);
1852
+ var j = (u3) => F(u3) ? u3 <= Math.pow(2, 8) ? Uint8Array : u3 <= Math.pow(2, 16) ? Uint16Array : u3 <= Math.pow(2, 32) ? Uint32Array : u3 <= Number.MAX_SAFE_INTEGER ? O : null : null;
1824
1853
  var O = class extends Array {
1825
1854
  constructor(e) {
1826
1855
  super(e), this.fill(0);
1827
1856
  }
1828
1857
  };
1829
- var x = class d {
1858
+ var R = class u {
1830
1859
  heap;
1831
1860
  length;
1832
1861
  static #o = false;
1833
1862
  static create(e) {
1834
1863
  let t = j(e);
1835
1864
  if (!t) return [];
1836
- d.#o = true;
1837
- let i = new d(e, t);
1838
- return d.#o = false, i;
1865
+ u.#o = true;
1866
+ let i = new u(e, t);
1867
+ return u.#o = false, i;
1839
1868
  }
1840
1869
  constructor(e, t) {
1841
- if (!d.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
1870
+ if (!u.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
1842
1871
  this.heap = new t(e), this.length = 0;
1843
1872
  }
1844
1873
  push(e) {
@@ -1848,14 +1877,14 @@ var x = class d {
1848
1877
  return this.heap[--this.length];
1849
1878
  }
1850
1879
  };
1851
- var I = class d2 {
1880
+ var M = class u2 {
1852
1881
  #o;
1853
- #c;
1854
- #S;
1855
- #O;
1882
+ #u;
1856
1883
  #w;
1884
+ #x;
1885
+ #S;
1857
1886
  #M;
1858
- #I;
1887
+ #U;
1859
1888
  #m;
1860
1889
  get perf() {
1861
1890
  return this.#m;
@@ -1875,15 +1904,14 @@ var I = class d2 {
1875
1904
  allowStaleOnFetchAbort;
1876
1905
  allowStaleOnFetchRejection;
1877
1906
  ignoreFetchAbort;
1878
- backgroundFetchSize;
1879
1907
  #n;
1880
1908
  #b;
1881
1909
  #s;
1882
1910
  #i;
1883
1911
  #t;
1884
- #l;
1885
- #u;
1886
1912
  #a;
1913
+ #c;
1914
+ #l;
1887
1915
  #h;
1888
1916
  #y;
1889
1917
  #r;
@@ -1892,12 +1920,12 @@ var I = class d2 {
1892
1920
  #d;
1893
1921
  #g;
1894
1922
  #T;
1895
- #U;
1923
+ #W;
1896
1924
  #f;
1897
- #D;
1925
+ #j;
1898
1926
  static unsafeExposeInternals(e) {
1899
- return { starts: e.#F, ttls: e.#d, autopurgeTimers: e.#g, sizes: e.#_, keyMap: e.#s, keyList: e.#i, valList: e.#t, next: e.#l, prev: e.#u, get head() {
1900
- return e.#a;
1927
+ return { starts: e.#F, ttls: e.#d, autopurgeTimers: e.#g, sizes: e.#_, keyMap: e.#s, keyList: e.#i, valList: e.#t, next: e.#a, prev: e.#c, get head() {
1928
+ return e.#l;
1901
1929
  }, get tail() {
1902
1930
  return e.#h;
1903
1931
  }, free: e.#y, isBackgroundFetch: (t) => e.#e(t), backgroundFetch: (t, i, s, n) => e.#P(t, i, s, n), moveToTail: (t) => e.#L(t), indexes: (t) => e.#A(t), rindexes: (t) => e.#z(t), isStale: (t) => e.#p(t) };
@@ -1906,7 +1934,7 @@ var I = class d2 {
1906
1934
  return this.#o;
1907
1935
  }
1908
1936
  get maxSize() {
1909
- return this.#c;
1937
+ return this.#u;
1910
1938
  }
1911
1939
  get calculatedSize() {
1912
1940
  return this.#b;
@@ -1918,139 +1946,134 @@ var I = class d2 {
1918
1946
  return this.#M;
1919
1947
  }
1920
1948
  get memoMethod() {
1921
- return this.#I;
1949
+ return this.#U;
1922
1950
  }
1923
1951
  get dispose() {
1924
- return this.#S;
1952
+ return this.#w;
1925
1953
  }
1926
1954
  get onInsert() {
1927
- return this.#O;
1955
+ return this.#x;
1928
1956
  }
1929
1957
  get disposeAfter() {
1930
- return this.#w;
1958
+ return this.#S;
1931
1959
  }
1932
1960
  constructor(e) {
1933
- let { max: t = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: l, allowStale: h, dispose: r, onInsert: c, disposeAfter: m, noDisposeOnSet: _, noUpdateTTL: u, maxSize: g = 0, maxEntrySize: f = 0, sizeCalculation: y, fetchMethod: a, memoMethod: w, noDeleteOnFetchRejection: F, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: A, ignoreFetchAbort: z, backgroundFetchSize: C = 1, perf: E } = e;
1934
- if (this.backgroundFetchSize = C, E !== void 0 && typeof E?.now != "function") throw new TypeError("perf option must have a now() method if specified");
1935
- if (this.#m = E ?? L, t !== 0 && !T(t)) throw new TypeError("max option must be a nonnegative integer");
1961
+ let { max: t = 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 } = e;
1962
+ if (x !== void 0 && typeof x?.now != "function") throw new TypeError("perf option must have a now() method if specified");
1963
+ if (this.#m = x ?? C, t !== 0 && !F(t)) throw new TypeError("max option must be a nonnegative integer");
1936
1964
  let v = t ? j(t) : Array;
1937
1965
  if (!v) throw new Error("invalid max value: " + t);
1938
- if (this.#o = t, this.#c = g, this.maxEntrySize = f || this.#c, this.sizeCalculation = y, this.sizeCalculation) {
1939
- if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
1966
+ if (this.#o = t, this.#u = T, this.maxEntrySize = w || this.#u, this.sizeCalculation = y, this.sizeCalculation) {
1967
+ if (!this.#u && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
1940
1968
  if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
1941
1969
  }
1942
- if (w !== void 0 && typeof w != "function") throw new TypeError("memoMethod must be a function if defined");
1943
- if (this.#I = w, a !== void 0 && typeof a != "function") throw new TypeError("fetchMethod must be a function if specified");
1944
- if (this.#M = a, this.#U = !!a, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: t }).fill(void 0), this.#t = Array.from({ length: t }).fill(void 0), this.#l = new v(t), this.#u = new v(t), this.#a = 0, this.#h = 0, this.#y = x.create(t), this.#n = 0, this.#b = 0, typeof r == "function" && (this.#S = r), typeof c == "function" && (this.#O = c), typeof m == "function" ? (this.#w = m, this.#r = []) : (this.#w = void 0, this.#r = void 0), this.#T = !!this.#S, this.#D = !!this.#O, this.#f = !!this.#w, this.noDisposeOnSet = !!_, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!F, this.allowStaleOnFetchRejection = !!p, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z, this.maxEntrySize !== 0) {
1945
- if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
1946
- if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
1970
+ if (m !== void 0 && typeof m != "function") throw new TypeError("memoMethod must be a function if defined");
1971
+ if (this.#U = m, a !== void 0 && typeof a != "function") throw new TypeError("fetchMethod must be a function if specified");
1972
+ if (this.#M = a, this.#W = !!a, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: t }).fill(void 0), this.#t = Array.from({ length: t }).fill(void 0), this.#a = new v(t), this.#c = new v(t), this.#l = 0, this.#h = 0, this.#y = R.create(t), this.#n = 0, this.#b = 0, typeof l == "function" && (this.#w = l), typeof c == "function" && (this.#x = c), typeof f == "function" ? (this.#S = f, this.#r = []) : (this.#S = void 0, this.#r = void 0), this.#T = !!this.#w, this.#j = !!this.#x, this.#f = !!this.#S, this.noDisposeOnSet = !!g, this.noUpdateTTL = !!p, this.noDeleteOnFetchRejection = !!_, this.allowStaleOnFetchRejection = !!d, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z, this.maxEntrySize !== 0) {
1973
+ if (this.#u !== 0 && !F(this.#u)) throw new TypeError("maxSize must be a positive integer if specified");
1974
+ if (!F(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
1947
1975
  this.#X();
1948
1976
  }
1949
- if (this.allowStale = !!h, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!l, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) {
1950
- if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
1951
- this.#k();
1977
+ if (this.allowStale = !!h, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!r, this.ttlResolution = F(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) {
1978
+ if (!F(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
1979
+ this.#H();
1952
1980
  }
1953
- if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
1954
- if (!this.ttlAutopurge && !this.#o && !this.#c) {
1955
- let D = "LRU_CACHE_UNBOUNDED";
1956
- H(D) && (U.add(D), k("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", D, d2));
1981
+ if (this.#o === 0 && this.ttl === 0 && this.#u === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
1982
+ if (!this.ttlAutopurge && !this.#o && !this.#u) {
1983
+ let E = "LRU_CACHE_UNBOUNDED";
1984
+ H(E) && (U.add(E), P("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", E, u2));
1957
1985
  }
1958
1986
  }
1959
1987
  getRemainingTTL(e) {
1960
1988
  return this.#s.has(e) ? 1 / 0 : 0;
1961
1989
  }
1962
- #k() {
1990
+ #H() {
1963
1991
  let e = new O(this.#o), t = new O(this.#o);
1964
1992
  this.#d = e, this.#F = t;
1965
1993
  let i = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
1966
- this.#g = i, this.#H = (h, r, c = this.#m.now()) => {
1967
- t[h] = r !== 0 ? c : 0, e[h] = r, s(h, r);
1968
- }, this.#R = (h) => {
1969
- t[h] = e[h] !== 0 ? this.#m.now() : 0, s(h, e[h]);
1994
+ this.#g = i, this.#N = (r, h, l = this.#m.now()) => {
1995
+ t[r] = h !== 0 ? l : 0, e[r] = h, s(r, h);
1996
+ }, this.#D = (r) => {
1997
+ t[r] = e[r] !== 0 ? this.#m.now() : 0, s(r, e[r]);
1970
1998
  };
1971
- let s = this.ttlAutopurge ? (h, r) => {
1972
- if (i?.[h] && (clearTimeout(i[h]), i[h] = void 0), r && r !== 0 && i) {
1973
- let c = setTimeout(() => {
1974
- this.#p(h) ? (this.#E(this.#i[h], "expire"), i[h] = void 0) : s(h, l(h));
1975
- }, r + 1);
1976
- c.unref && c.unref(), i[h] = c;
1999
+ let s = this.ttlAutopurge ? (r, h) => {
2000
+ if (i?.[r] && (clearTimeout(i[r]), i[r] = void 0), h && h !== 0 && i) {
2001
+ let l = setTimeout(() => {
2002
+ this.#p(r) && this.#v(this.#i[r], "expire");
2003
+ }, h + 1);
2004
+ l.unref && l.unref(), i[r] = l;
1977
2005
  }
1978
2006
  } : () => {
1979
2007
  };
1980
- this.#v = (h, r) => {
1981
- if (e[r]) {
1982
- let c = e[r], m = t[r];
1983
- if (!c || !m) return;
1984
- h.ttl = c, h.start = m, h.now = n || o();
1985
- let _ = h.now - m;
1986
- h.remainingTTL = c - _;
2008
+ this.#E = (r, h) => {
2009
+ if (e[h]) {
2010
+ let l = e[h], c = t[h];
2011
+ if (!l || !c) return;
2012
+ r.ttl = l, r.start = c, r.now = n || o();
2013
+ let f = r.now - c;
2014
+ r.remainingTTL = l - f;
1987
2015
  }
1988
2016
  };
1989
2017
  let n = 0, o = () => {
1990
- let h = this.#m.now();
2018
+ let r = this.#m.now();
1991
2019
  if (this.ttlResolution > 0) {
1992
- n = h;
1993
- let r = setTimeout(() => n = 0, this.ttlResolution);
1994
- r.unref && r.unref();
2020
+ n = r;
2021
+ let h = setTimeout(() => n = 0, this.ttlResolution);
2022
+ h.unref && h.unref();
1995
2023
  }
1996
- return h;
1997
- };
1998
- this.getRemainingTTL = (h) => {
1999
- let r = this.#s.get(h);
2000
- return r === void 0 ? 0 : l(r);
2024
+ return r;
2001
2025
  };
2002
- let l = (h) => {
2003
- let r = e[h], c = t[h];
2004
- if (!r || !c) return 1 / 0;
2005
- let m = (n || o()) - c;
2006
- return r - m;
2007
- };
2008
- this.#p = (h) => {
2009
- let r = t[h], c = e[h];
2010
- return !!c && !!r && (n || o()) - r > c;
2026
+ this.getRemainingTTL = (r) => {
2027
+ let h = this.#s.get(r);
2028
+ if (h === void 0) return 0;
2029
+ let l = e[h], c = t[h];
2030
+ if (!l || !c) return 1 / 0;
2031
+ let f = (n || o()) - c;
2032
+ return l - f;
2033
+ }, this.#p = (r) => {
2034
+ let h = t[r], l = e[r];
2035
+ return !!l && !!h && (n || o()) - h > l;
2011
2036
  };
2012
2037
  }
2013
- #R = () => {
2038
+ #D = () => {
2014
2039
  };
2015
- #v = () => {
2040
+ #E = () => {
2016
2041
  };
2017
- #H = () => {
2042
+ #N = () => {
2018
2043
  };
2019
2044
  #p = () => false;
2020
2045
  #X() {
2021
2046
  let e = new O(this.#o);
2022
- this.#b = 0, this.#_ = e, this.#x = (t) => {
2047
+ this.#b = 0, this.#_ = e, this.#R = (t) => {
2023
2048
  this.#b -= e[t], e[t] = 0;
2024
- }, this.#N = (t, i, s, n) => {
2025
- if (!T(s)) {
2026
- if (this.#e(i)) return this.backgroundFetchSize;
2027
- if (n) {
2028
- if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
2029
- if (s = n(i, t), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
2030
- } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
2031
- }
2049
+ }, this.#k = (t, i, s, n) => {
2050
+ if (this.#e(i)) return 0;
2051
+ if (!F(s)) if (n) {
2052
+ if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
2053
+ if (s = n(i, t), !F(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
2054
+ } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
2032
2055
  return s;
2033
- }, this.#j = (t, i, s) => {
2034
- if (e[t] = i, this.#c) {
2035
- let n = this.#c - e[t];
2056
+ }, this.#I = (t, i, s) => {
2057
+ if (e[t] = i, this.#u) {
2058
+ let n = this.#u - e[t];
2036
2059
  for (; this.#b > n; ) this.#G(true);
2037
2060
  }
2038
2061
  this.#b += e[t], s && (s.entrySize = i, s.totalCalculatedSize = this.#b);
2039
2062
  };
2040
2063
  }
2041
- #x = (e) => {
2064
+ #R = (e) => {
2042
2065
  };
2043
- #j = (e, t, i) => {
2066
+ #I = (e, t, i) => {
2044
2067
  };
2045
- #N = (e, t, i, s) => {
2068
+ #k = (e, t, i, s) => {
2046
2069
  if (i || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
2047
2070
  return 0;
2048
2071
  };
2049
2072
  *#A({ allowStale: e = this.allowStale } = {}) {
2050
- if (this.#n) for (let t = this.#h; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#a); ) t = this.#u[t];
2073
+ if (this.#n) for (let t = this.#h; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#l); ) t = this.#c[t];
2051
2074
  }
2052
2075
  *#z({ allowStale: e = this.allowStale } = {}) {
2053
- if (this.#n) for (let t = this.#a; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#h); ) t = this.#l[t];
2076
+ if (this.#n) for (let t = this.#l; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#h); ) t = this.#a[t];
2054
2077
  }
2055
2078
  #V(e) {
2056
2079
  return e !== void 0 && this.#s.get(this.#i[e]) === e;
@@ -2103,7 +2126,7 @@ var I = class d2 {
2103
2126
  }
2104
2127
  purgeStale() {
2105
2128
  let e = false;
2106
- for (let t of this.#z({ allowStale: true })) this.#p(t) && (this.#E(this.#i[t], "expire"), e = true);
2129
+ for (let t of this.#z({ allowStale: true })) this.#p(t) && (this.#v(this.#i[t], "expire"), e = true);
2107
2130
  return e;
2108
2131
  }
2109
2132
  info(e) {
@@ -2113,9 +2136,9 @@ var I = class d2 {
2113
2136
  if (s === void 0) return;
2114
2137
  let n = { value: s };
2115
2138
  if (this.#d && this.#F) {
2116
- let o = this.#d[t], l = this.#F[t];
2117
- if (o && l) {
2118
- let h = o - (this.#m.now() - l);
2139
+ let o = this.#d[t], r = this.#F[t];
2140
+ if (o && r) {
2141
+ let h = o - (this.#m.now() - r);
2119
2142
  n.ttl = h, n.start = Date.now();
2120
2143
  }
2121
2144
  }
@@ -2129,8 +2152,8 @@ var I = class d2 {
2129
2152
  let o = { value: n };
2130
2153
  if (this.#d && this.#F) {
2131
2154
  o.ttl = this.#d[t];
2132
- let l = this.#m.now() - this.#F[t];
2133
- o.start = Math.floor(Date.now() - l);
2155
+ let r = this.#m.now() - this.#F[t];
2156
+ o.start = Math.floor(Date.now() - r);
2134
2157
  }
2135
2158
  this.#_ && (o.size = this.#_[t]), e.unshift([i, o]);
2136
2159
  }
@@ -2143,49 +2166,51 @@ var I = class d2 {
2143
2166
  let s = Date.now() - i.start;
2144
2167
  i.start = this.#m.now() - s;
2145
2168
  }
2146
- this.#W(t, i.value, i);
2169
+ this.#O(t, i.value, i);
2147
2170
  }
2148
2171
  }
2149
2172
  set(e, t, i = {}) {
2150
2173
  let { status: s = S.hasSubscribers ? {} : void 0 } = i;
2151
- i.status = s, s && (s.op = "set", s.key = e, t !== void 0 && (s.value = t), s.cache = this);
2152
- let n = this.#W(e, t, i);
2174
+ i.status = s, s && (s.op = "set", s.key = e, t !== void 0 && (s.value = t));
2175
+ let n = this.#O(e, t, i);
2153
2176
  return s && S.hasSubscribers && S.publish(s), n;
2154
2177
  }
2155
- #W(e, t, i, s) {
2156
- let { ttl: n = this.ttl, start: o, noDisposeOnSet: l = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: r } = i, c = this.#e(t);
2157
- if (t === void 0) return r && (r.set = "deleted"), this.delete(e), this;
2158
- let { noUpdateTTL: m = this.noUpdateTTL } = i;
2159
- r && !c && (r.value = t);
2160
- let _ = this.#N(e, t, i.size || 0, h, r);
2161
- if (this.maxEntrySize && _ > this.maxEntrySize) return this.#E(e, "set"), r && (r.set = "miss", r.maxEntrySizeExceeded = true), this;
2162
- let u = this.#n === 0 ? void 0 : this.#s.get(e);
2163
- if (u === void 0) u = this.#n === 0 ? this.#h : this.#y.length !== 0 ? this.#y.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[u] = e, this.#t[u] = t, this.#s.set(e, u), this.#l[this.#h] = u, this.#u[u] = this.#h, this.#h = u, this.#n++, this.#j(u, _, r), r && (r.set = "add"), m = false, this.#D && !c && this.#O?.(t, e, "add");
2178
+ #O(e, t, i = {}) {
2179
+ let { ttl: s = this.ttl, start: n, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: r = this.sizeCalculation, status: h } = i;
2180
+ if (t === void 0) return h && (h.set = "deleted"), this.delete(e), this;
2181
+ let { noUpdateTTL: l = this.noUpdateTTL } = i;
2182
+ h && !this.#e(t) && (h.value = t);
2183
+ let c = this.#k(e, t, i.size || 0, r, h);
2184
+ if (this.maxEntrySize && c > this.maxEntrySize) return this.#v(e, "set"), h && (h.set = "miss", h.maxEntrySizeExceeded = true), this;
2185
+ let f = this.#n === 0 ? void 0 : this.#s.get(e);
2186
+ if (f === void 0) f = this.#n === 0 ? this.#h : this.#y.length !== 0 ? this.#y.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[f] = e, this.#t[f] = t, this.#s.set(e, 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 = false, this.#j && this.#x?.(t, e, "add");
2164
2187
  else {
2165
- this.#L(u);
2166
- let g = this.#t[u];
2188
+ this.#L(f);
2189
+ let g = this.#t[f];
2167
2190
  if (t !== g) {
2168
- if (!l) if (this.#e(g)) {
2169
- g !== s && g.__abortController.abort(new Error("replaced"));
2170
- let { __staleWhileFetching: f } = g;
2171
- f !== void 0 && f !== t && (this.#T && this.#S?.(f, e, "set"), this.#f && this.#r?.push([f, e, "set"]));
2172
- } else this.#T && this.#S?.(g, e, "set"), this.#f && this.#r?.push([g, e, "set"]);
2173
- if (this.#x(u), this.#j(u, _, r), this.#t[u] = t, !c) {
2174
- let f = g && this.#e(g) ? g.__staleWhileFetching : g, y = f === void 0 ? "add" : t !== f ? "replace" : "update";
2175
- r && (r.set = y, f !== void 0 && (r.oldValue = f)), this.#D && this.onInsert?.(t, e, y);
2191
+ if (this.#W && this.#e(g)) {
2192
+ g.__abortController.abort(new Error("replaced"));
2193
+ let { __staleWhileFetching: p } = g;
2194
+ p !== void 0 && !o && (this.#T && this.#w?.(p, e, "set"), this.#f && this.#r?.push([p, e, "set"]));
2195
+ } else o || (this.#T && this.#w?.(g, e, "set"), this.#f && this.#r?.push([g, e, "set"]));
2196
+ if (this.#R(f), this.#I(f, c, h), this.#t[f] = t, h) {
2197
+ h.set = "replace";
2198
+ let p = g && this.#e(g) ? g.__staleWhileFetching : g;
2199
+ p !== void 0 && (h.oldValue = p);
2176
2200
  }
2177
- } else c || (r && (r.set = "update"), this.#D && this.onInsert?.(t, e, "update"));
2201
+ } else h && (h.set = "update");
2202
+ this.#j && this.onInsert?.(t, e, t === g ? "update" : "replace");
2178
2203
  }
2179
- if (n !== 0 && !this.#d && this.#k(), this.#d && (m || this.#H(u, n, o), r && this.#v(r, u)), !l && this.#f && this.#r) {
2180
- let g = this.#r, f;
2181
- for (; f = g?.shift(); ) this.#w?.(...f);
2204
+ if (s !== 0 && !this.#d && this.#H(), this.#d && (l || this.#N(f, s, n), h && this.#E(h, f)), !o && this.#f && this.#r) {
2205
+ let g = this.#r, p;
2206
+ for (; p = g?.shift(); ) this.#S?.(...p);
2182
2207
  }
2183
2208
  return this;
2184
2209
  }
2185
2210
  pop() {
2186
2211
  try {
2187
2212
  for (; this.#n; ) {
2188
- let e = this.#t[this.#a];
2213
+ let e = this.#t[this.#l];
2189
2214
  if (this.#G(true), this.#e(e)) {
2190
2215
  if (e.__staleWhileFetching) return e.__staleWhileFetching;
2191
2216
  } else if (e !== void 0) return e;
@@ -2193,19 +2218,17 @@ var I = class d2 {
2193
2218
  } finally {
2194
2219
  if (this.#f && this.#r) {
2195
2220
  let e = this.#r, t;
2196
- for (; t = e?.shift(); ) this.#w?.(...t);
2221
+ for (; t = e?.shift(); ) this.#S?.(...t);
2197
2222
  }
2198
2223
  }
2199
2224
  }
2200
2225
  #G(e) {
2201
- let t = this.#a, i = this.#i[t], s = this.#t[t], n = this.#e(s);
2202
- n && s.__abortController.abort(new Error("evicted"));
2203
- let o = n ? s.__staleWhileFetching : s;
2204
- return (this.#T || this.#f) && o !== void 0 && (this.#T && this.#S?.(o, i, "evict"), this.#f && this.#r?.push([o, i, "evict"])), this.#x(t), this.#g?.[t] && (clearTimeout(this.#g[t]), this.#g[t] = void 0), e && (this.#i[t] = void 0, this.#t[t] = void 0, this.#y.push(t)), this.#n === 1 ? (this.#a = this.#h = 0, this.#y.length = 0) : this.#a = this.#l[t], this.#s.delete(i), this.#n--, t;
2226
+ let t = this.#l, i = this.#i[t], s = this.#t[t];
2227
+ 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([s, i, "evict"])), this.#R(t), this.#g?.[t] && (clearTimeout(this.#g[t]), this.#g[t] = void 0), e && (this.#i[t] = void 0, this.#t[t] = void 0, this.#y.push(t)), this.#n === 1 ? (this.#l = this.#h = 0, this.#y.length = 0) : this.#l = this.#a[t], this.#s.delete(i), this.#n--, t;
2205
2228
  }
2206
2229
  has(e, t = {}) {
2207
2230
  let { status: i = S.hasSubscribers ? {} : void 0 } = t;
2208
- t.status = i, i && (i.op = "has", i.key = e, i.cache = this);
2231
+ t.status = i, i && (i.op = "has", i.key = e);
2209
2232
  let s = this.#Y(e, t);
2210
2233
  return S.hasSubscribers && S.publish(i), s;
2211
2234
  }
@@ -2214,14 +2237,14 @@ var I = class d2 {
2214
2237
  if (n !== void 0) {
2215
2238
  let o = this.#t[n];
2216
2239
  if (this.#e(o) && o.__staleWhileFetching === void 0) return false;
2217
- if (this.#p(n)) s && (s.has = "stale", this.#v(s, n));
2218
- else return i && this.#R(n), s && (s.has = "hit", this.#v(s, n)), true;
2240
+ if (this.#p(n)) s && (s.has = "stale", this.#E(s, n));
2241
+ else return i && this.#D(n), s && (s.has = "hit", this.#E(s, n)), true;
2219
2242
  } else s && (s.has = "miss");
2220
2243
  return false;
2221
2244
  }
2222
2245
  peek(e, t = {}) {
2223
- let { status: i = R() ? {} : void 0 } = t;
2224
- i && (i.op = "peek", i.key = e, i.cache = this), t.status = i;
2246
+ let { status: i = D() ? {} : void 0 } = t;
2247
+ i && (i.op = "peek", i.key = e), t.status = i;
2225
2248
  let s = this.#J(e, t);
2226
2249
  return S.hasSubscribers && S.publish(i), s;
2227
2250
  }
@@ -2231,67 +2254,67 @@ var I = class d2 {
2231
2254
  i && (i.peek = n === void 0 ? "miss" : "stale");
2232
2255
  return;
2233
2256
  }
2234
- let o = this.#t[n], l = this.#e(o) ? o.__staleWhileFetching : o;
2235
- return i && (l !== void 0 ? (i.peek = "hit", i.value = l) : i.peek = "miss"), l;
2257
+ let o = this.#t[n], r = this.#e(o) ? o.__staleWhileFetching : o;
2258
+ return i && (r !== void 0 ? (i.peek = "hit", i.value = r) : i.peek = "miss"), r;
2236
2259
  }
2237
2260
  #P(e, t, i, s) {
2238
2261
  let n = t === void 0 ? void 0 : this.#t[t];
2239
2262
  if (this.#e(n)) return n;
2240
- let o = new AbortController(), { signal: l } = i;
2241
- l?.addEventListener("abort", () => o.abort(l.reason), { signal: o.signal });
2242
- let h = { signal: o.signal, options: i, context: s }, r = (f, y = false) => {
2243
- let { aborted: a } = o.signal, w = i.ignoreFetchAbort && f !== void 0, F = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && f !== void 0);
2244
- if (i.status && (a && !y ? (i.status.fetchAborted = true, i.status.fetchError = o.signal.reason, w && (i.status.fetchAbortIgnored = true)) : i.status.fetchResolved = true), a && !w && !y) return m(o.signal.reason, F);
2245
- let b = u, p = this.#t[t];
2246
- return (p === u || p === void 0 && w && y) && (f === void 0 ? b.__staleWhileFetching !== void 0 ? this.#t[t] = b.__staleWhileFetching : this.#E(e, "fetch") : (i.status && (i.status.fetchUpdated = true), this.#W(e, f, h.options, b))), f;
2247
- }, c = (f) => (i.status && (i.status.fetchRejected = true, i.status.fetchError = f), m(f, false)), m = (f, y) => {
2248
- let { aborted: a } = o.signal, w = a && i.allowStaleOnFetchAbort, F = w || i.allowStaleOnFetchRejection, b = F || i.noDeleteOnFetchRejection, p = u;
2249
- if (this.#t[t] === u && (!b || !y && p.__staleWhileFetching === void 0 ? this.#E(e, "fetch") : w || (this.#t[t] = p.__staleWhileFetching)), F) return i.status && p.__staleWhileFetching !== void 0 && (i.status.returnedStale = true), p.__staleWhileFetching;
2250
- if (p.__returned === p) throw f;
2251
- }, _ = (f, y) => {
2263
+ let o = new AbortController(), { signal: r } = i;
2264
+ r?.addEventListener("abort", () => o.abort(r.reason), { signal: o.signal });
2265
+ let h = { signal: o.signal, options: i, context: s }, l = (w, y = false) => {
2266
+ let { aborted: a } = o.signal, m = i.ignoreFetchAbort && w !== void 0, _ = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && w !== void 0);
2267
+ if (i.status && (a && !y ? (i.status.fetchAborted = true, i.status.fetchError = o.signal.reason, m && (i.status.fetchAbortIgnored = true)) : i.status.fetchResolved = true), a && !m && !y) return f(o.signal.reason, _);
2268
+ let b = p, d = this.#t[t];
2269
+ return (d === p || d === void 0 && m && y) && (w === void 0 ? b.__staleWhileFetching !== void 0 ? this.#t[t] = b.__staleWhileFetching : this.#v(e, "fetch") : (i.status && (i.status.fetchUpdated = true), this.#O(e, w, h.options))), w;
2270
+ }, c = (w) => (i.status && (i.status.fetchRejected = true, i.status.fetchError = w), f(w, false)), f = (w, y) => {
2271
+ let { aborted: a } = o.signal, m = a && i.allowStaleOnFetchAbort, _ = m || i.allowStaleOnFetchRejection, b = _ || i.noDeleteOnFetchRejection, d = p;
2272
+ if (this.#t[t] === p && (!b || !y && d.__staleWhileFetching === void 0 ? this.#v(e, "fetch") : m || (this.#t[t] = d.__staleWhileFetching)), _) return i.status && d.__staleWhileFetching !== void 0 && (i.status.returnedStale = true), d.__staleWhileFetching;
2273
+ if (d.__returned === d) throw w;
2274
+ }, g = (w, y) => {
2252
2275
  let a = this.#M?.(e, n, h);
2253
- o.signal.addEventListener("abort", () => {
2254
- (!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (f(void 0), i.allowStaleOnFetchAbort && (f = (w) => r(w, true)));
2255
- }), a && a instanceof Promise ? a.then((w) => f(w === void 0 ? void 0 : w), y) : a !== void 0 && f(a);
2276
+ a && a instanceof Promise && a.then((m) => w(m === void 0 ? void 0 : m), y), o.signal.addEventListener("abort", () => {
2277
+ (!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (w(void 0), i.allowStaleOnFetchAbort && (w = (m) => l(m, true)));
2278
+ });
2256
2279
  };
2257
2280
  i.status && (i.status.fetchDispatched = true);
2258
- let u = new Promise(_).then(r, c), g = Object.assign(u, { __abortController: o, __staleWhileFetching: n, __returned: void 0 });
2259
- return t === void 0 ? (this.#W(e, g, { ...h.options, status: void 0 }), t = this.#s.get(e)) : this.#t[t] = g, g;
2281
+ let p = new Promise(g).then(l, c), T = Object.assign(p, { __abortController: o, __staleWhileFetching: n, __returned: void 0 });
2282
+ return t === void 0 ? (this.#O(e, T, { ...h.options, status: void 0 }), t = this.#s.get(e)) : this.#t[t] = T, T;
2260
2283
  }
2261
2284
  #e(e) {
2262
- if (!this.#U) return false;
2285
+ if (!this.#W) return false;
2263
2286
  let t = e;
2264
2287
  return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof AbortController;
2265
2288
  }
2266
2289
  fetch(e, t = {}) {
2267
- let i = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
2290
+ let i = W.hasSubscribers, { status: s = D() ? {} : void 0 } = t;
2268
2291
  t.status = s, s && t.context && (s.context = t.context);
2269
2292
  let n = this.#B(e, t);
2270
2293
  return s && i && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
2271
2294
  })), n;
2272
2295
  }
2273
2296
  async #B(e, t = {}) {
2274
- let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: l = this.noDisposeOnSet, size: h = 0, sizeCalculation: r = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: m = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: _ = this.allowStaleOnFetchRejection, ignoreFetchAbort: u = this.ignoreFetchAbort, allowStaleOnFetchAbort: g = this.allowStaleOnFetchAbort, context: f, forceRefresh: y = false, status: a, signal: w } = t;
2275
- if (a && (a.op = "fetch", a.key = e, y && (a.forceRefresh = true), a.cache = this), !this.#U) return a && (a.fetch = "get"), this.#C(e, { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, status: a });
2276
- let F = { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, ttl: o, noDisposeOnSet: l, size: h, sizeCalculation: r, noUpdateTTL: c, noDeleteOnFetchRejection: m, allowStaleOnFetchRejection: _, allowStaleOnFetchAbort: g, ignoreFetchAbort: u, status: a, signal: w }, b = this.#s.get(e);
2297
+ 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 = false, status: a, signal: m } = t;
2298
+ if (a && (a.op = "fetch", a.key = e, y && (a.forceRefresh = true)), !this.#W) return a && (a.fetch = "get"), this.#C(e, { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, status: a });
2299
+ let _ = { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, ttl: o, noDisposeOnSet: r, size: h, sizeCalculation: l, noUpdateTTL: c, noDeleteOnFetchRejection: f, allowStaleOnFetchRejection: g, allowStaleOnFetchAbort: T, ignoreFetchAbort: p, status: a, signal: m }, b = this.#s.get(e);
2277
2300
  if (b === void 0) {
2278
2301
  a && (a.fetch = "miss");
2279
- let p = this.#P(e, b, F, f);
2280
- return p.__returned = p;
2302
+ let d = this.#P(e, b, _, w);
2303
+ return d.__returned = d;
2281
2304
  } else {
2282
- let p = this.#t[b];
2283
- if (this.#e(p)) {
2284
- let v = i && p.__staleWhileFetching !== void 0;
2285
- return a && (a.fetch = "inflight", v && (a.returnedStale = true)), v ? p.__staleWhileFetching : p.__returned = p;
2305
+ let d = this.#t[b];
2306
+ if (this.#e(d)) {
2307
+ let E = i && d.__staleWhileFetching !== void 0;
2308
+ return a && (a.fetch = "inflight", E && (a.returnedStale = true)), E ? d.__staleWhileFetching : d.__returned = d;
2286
2309
  }
2287
2310
  let A = this.#p(b);
2288
- if (!y && !A) return a && (a.fetch = "hit"), this.#L(b), s && this.#R(b), a && this.#v(a, b), p;
2289
- let z = this.#P(e, b, F, f), E = z.__staleWhileFetching !== void 0 && i;
2290
- return a && (a.fetch = A ? "stale" : "refresh", E && A && (a.returnedStale = true)), E ? z.__staleWhileFetching : z.__returned = z;
2311
+ if (!y && !A) return a && (a.fetch = "hit"), this.#L(b), s && this.#D(b), a && this.#E(a, b), d;
2312
+ let z = this.#P(e, b, _, w), v = z.__staleWhileFetching !== void 0 && i;
2313
+ return a && (a.fetch = A ? "stale" : "refresh", v && A && (a.returnedStale = true)), v ? z.__staleWhileFetching : z.__returned = z;
2291
2314
  }
2292
2315
  }
2293
2316
  forceFetch(e, t = {}) {
2294
- let i = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
2317
+ let i = W.hasSubscribers, { status: s = D() ? {} : void 0 } = t;
2295
2318
  t.status = s, s && t.context && (s.context = t.context);
2296
2319
  let n = this.#K(e, t);
2297
2320
  return s && i && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
@@ -2304,67 +2327,67 @@ var I = class d2 {
2304
2327
  }
2305
2328
  memo(e, t = {}) {
2306
2329
  let { status: i = S.hasSubscribers ? {} : void 0 } = t;
2307
- t.status = i, i && (i.op = "memo", i.key = e, t.context && (i.context = t.context), i.cache = this);
2330
+ t.status = i, i && (i.op = "memo", i.key = e, t.context && (i.context = t.context));
2308
2331
  let s = this.#Q(e, t);
2309
2332
  return i && (i.value = s), S.hasSubscribers && S.publish(i), s;
2310
2333
  }
2311
2334
  #Q(e, t = {}) {
2312
- let i = this.#I;
2335
+ let i = this.#U;
2313
2336
  if (!i) throw new Error("no memoMethod provided to constructor");
2314
- let { context: s, status: n, forceRefresh: o, ...l } = t;
2337
+ let { context: s, status: n, forceRefresh: o, ...r } = t;
2315
2338
  n && o && (n.forceRefresh = true);
2316
- let h = this.#C(e, l), r = o || h === void 0;
2317
- if (n && (n.memo = r ? "miss" : "hit", r || (n.value = h)), !r) return h;
2318
- let c = i(e, h, { options: l, context: s });
2319
- return n && (n.value = c), this.#W(e, c, l), c;
2339
+ let h = this.#C(e, r), l = o || h === void 0;
2340
+ if (n && (n.memo = l ? "miss" : "hit", l || (n.value = h)), !l) return h;
2341
+ let c = i(e, h, { options: r, context: s });
2342
+ return n && (n.value = c), this.#O(e, c, r), c;
2320
2343
  }
2321
2344
  get(e, t = {}) {
2322
2345
  let { status: i = S.hasSubscribers ? {} : void 0 } = t;
2323
- t.status = i, i && (i.op = "get", i.key = e, i.cache = this);
2346
+ t.status = i, i && (i.op = "get", i.key = e);
2324
2347
  let s = this.#C(e, t);
2325
2348
  return i && (s !== void 0 && (i.value = s), S.hasSubscribers && S.publish(i)), s;
2326
2349
  }
2327
2350
  #C(e, t = {}) {
2328
- let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = t, l = this.#s.get(e);
2329
- if (l === void 0) {
2351
+ let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = t, r = this.#s.get(e);
2352
+ if (r === void 0) {
2330
2353
  o && (o.get = "miss");
2331
2354
  return;
2332
2355
  }
2333
- let h = this.#t[l], r = this.#e(h);
2334
- return o && this.#v(o, l), this.#p(l) ? r ? (o && (o.get = "stale-fetching"), i && h.__staleWhileFetching !== void 0 ? (o && (o.returnedStale = true), h.__staleWhileFetching) : void 0) : (n || this.#E(e, "expire"), o && (o.get = "stale"), i ? (o && (o.returnedStale = true), h) : void 0) : (o && (o.get = r ? "fetching" : "hit"), this.#L(l), s && this.#R(l), r ? h.__staleWhileFetching : h);
2356
+ let h = this.#t[r], l = this.#e(h);
2357
+ return o && this.#E(o, r), this.#p(r) ? l ? (o && (o.get = "stale-fetching"), i && h.__staleWhileFetching !== void 0 ? (o && (o.returnedStale = true), h.__staleWhileFetching) : void 0) : (n || this.#v(e, "expire"), o && (o.get = "stale"), i ? (o && (o.returnedStale = true), h) : void 0) : (o && (o.get = l ? "fetching" : "hit"), this.#L(r), s && this.#D(r), l ? h.__staleWhileFetching : h);
2335
2358
  }
2336
2359
  #$(e, t) {
2337
- this.#u[t] = e, this.#l[e] = t;
2360
+ this.#c[t] = e, this.#a[e] = t;
2338
2361
  }
2339
2362
  #L(e) {
2340
- e !== this.#h && (e === this.#a ? this.#a = this.#l[e] : this.#$(this.#u[e], this.#l[e]), this.#$(this.#h, e), this.#h = e);
2363
+ e !== this.#h && (e === this.#l ? this.#l = this.#a[e] : this.#$(this.#c[e], this.#a[e]), this.#$(this.#h, e), this.#h = e);
2341
2364
  }
2342
2365
  delete(e) {
2343
- return this.#E(e, "delete");
2366
+ return this.#v(e, "delete");
2344
2367
  }
2345
- #E(e, t) {
2346
- S.hasSubscribers && S.publish({ op: "delete", delete: t, key: e, cache: this });
2368
+ #v(e, t) {
2369
+ S.hasSubscribers && S.publish({ op: "delete", delete: t, key: e });
2347
2370
  let i = false;
2348
2371
  if (this.#n !== 0) {
2349
2372
  let s = this.#s.get(e);
2350
- if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g[s]), this.#g[s] = void 0), i = true, this.#n === 1) this.#q(t);
2373
+ if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g?.[s]), this.#g[s] = void 0), i = true, this.#n === 1) this.#q(t);
2351
2374
  else {
2352
- this.#x(s);
2375
+ this.#R(s);
2353
2376
  let n = this.#t[s];
2354
- if (this.#e(n) ? n.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#S?.(n, e, t), this.#f && this.#r?.push([n, e, t])), this.#s.delete(e), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
2355
- else if (s === this.#a) this.#a = this.#l[s];
2377
+ if (this.#e(n) ? n.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#w?.(n, e, t), this.#f && this.#r?.push([n, e, t])), this.#s.delete(e), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#c[s];
2378
+ else if (s === this.#l) this.#l = this.#a[s];
2356
2379
  else {
2357
- let o = this.#u[s];
2358
- this.#l[o] = this.#l[s];
2359
- let l = this.#l[s];
2360
- this.#u[l] = this.#u[s];
2380
+ let o = this.#c[s];
2381
+ this.#a[o] = this.#a[s];
2382
+ let r = this.#a[s];
2383
+ this.#c[r] = this.#c[s];
2361
2384
  }
2362
2385
  this.#n--, this.#y.push(s);
2363
2386
  }
2364
2387
  }
2365
2388
  if (this.#f && this.#r?.length) {
2366
2389
  let s = this.#r, n;
2367
- for (; n = s?.shift(); ) this.#w?.(...n);
2390
+ for (; n = s?.shift(); ) this.#S?.(...n);
2368
2391
  }
2369
2392
  return i;
2370
2393
  }
@@ -2377,7 +2400,7 @@ var I = class d2 {
2377
2400
  if (this.#e(i)) i.__abortController.abort(new Error("deleted"));
2378
2401
  else {
2379
2402
  let s = this.#i[t];
2380
- this.#T && this.#S?.(i, s, e), this.#f && this.#r?.push([i, s, e]);
2403
+ this.#T && this.#w?.(i, s, e), this.#f && this.#r?.push([i, s, e]);
2381
2404
  }
2382
2405
  }
2383
2406
  if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
@@ -2385,9 +2408,9 @@ var I = class d2 {
2385
2408
  for (let t of this.#g ?? []) t !== void 0 && clearTimeout(t);
2386
2409
  this.#g?.fill(void 0);
2387
2410
  }
2388
- if (this.#_ && this.#_.fill(0), this.#a = 0, this.#h = 0, this.#y.length = 0, this.#b = 0, this.#n = 0, this.#f && this.#r) {
2411
+ 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) {
2389
2412
  let t = this.#r, i;
2390
- for (; i = t?.shift(); ) this.#w?.(...i);
2413
+ for (; i = t?.shift(); ) this.#S?.(...i);
2391
2414
  }
2392
2415
  }
2393
2416
  };
@@ -3326,7 +3349,7 @@ var ENOREALPATH = 512;
3326
3349
  var ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH;
3327
3350
  var TYPEMASK = 1023;
3328
3351
  var entToType = (s) => s.isFile() ? IFREG : s.isDirectory() ? IFDIR : s.isSymbolicLink() ? IFLNK : s.isCharacterDevice() ? IFCHR : s.isBlockDevice() ? IFBLK : s.isSocket() ? IFSOCK : s.isFIFO() ? IFIFO : UNKNOWN;
3329
- var normalizeCache = new I({ max: 2 ** 12 });
3352
+ var normalizeCache = new M({ max: 2 ** 12 });
3330
3353
  var normalize = (s) => {
3331
3354
  const c = normalizeCache.get(s);
3332
3355
  if (c)
@@ -3335,7 +3358,7 @@ var normalize = (s) => {
3335
3358
  normalizeCache.set(s, n);
3336
3359
  return n;
3337
3360
  };
3338
- var normalizeNocaseCache = new I({ max: 2 ** 12 });
3361
+ var normalizeNocaseCache = new M({ max: 2 ** 12 });
3339
3362
  var normalizeNocase = (s) => {
3340
3363
  const c = normalizeNocaseCache.get(s);
3341
3364
  if (c)
@@ -3344,12 +3367,12 @@ var normalizeNocase = (s) => {
3344
3367
  normalizeNocaseCache.set(s, n);
3345
3368
  return n;
3346
3369
  };
3347
- var ResolveCache = class extends I {
3370
+ var ResolveCache = class extends M {
3348
3371
  constructor() {
3349
3372
  super({ max: 256 });
3350
3373
  }
3351
3374
  };
3352
- var ChildrenCache = class extends I {
3375
+ var ChildrenCache = class extends M {
3353
3376
  constructor(maxSize = 16 * 1024) {
3354
3377
  super({
3355
3378
  maxSize,
@@ -5320,7 +5343,7 @@ var SubWalks = class {
5320
5343
  return subs;
5321
5344
  }
5322
5345
  entries() {
5323
- return this.keys().map((k2) => [k2, this.store.get(k2)]);
5346
+ return this.keys().map((k) => [k, this.store.get(k)]);
5324
5347
  }
5325
5348
  keys() {
5326
5349
  return [...this.store.keys()].filter((t) => t.canReaddir());