@settlemint/sdk-cli 2.2.3-mainfc7ba876 → 2.2.3-mainfd2a5bd3

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.
Files changed (3) hide show
  1. package/dist/cli.js +2636 -403
  2. package/dist/cli.js.map +6 -4
  3. package/package.json +9 -9
package/dist/cli.js CHANGED
@@ -29768,7 +29768,7 @@ var require_lib3 = __commonJS((exports, module) => {
29768
29768
  };
29769
29769
  });
29770
29770
 
29771
- // ../../node_modules/lru-cache/dist/commonjs/index.js
29771
+ // ../../node_modules/hosted-git-info/node_modules/lru-cache/dist/commonjs/index.js
29772
29772
  var require_commonjs = __commonJS((exports) => {
29773
29773
  Object.defineProperty(exports, "__esModule", { value: true });
29774
29774
  exports.LRUCache = undefined;
@@ -32623,8 +32623,1123 @@ globstar while`, file, fr, pattern, pr, swallowee);
32623
32623
  exports.minimatch.unescape = unescape_js_1.unescape;
32624
32624
  });
32625
32625
 
32626
- // ../../node_modules/minipass/dist/commonjs/index.js
32626
+ // ../../node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js
32627
32627
  var require_commonjs3 = __commonJS((exports) => {
32628
+ Object.defineProperty(exports, "__esModule", { value: true });
32629
+ exports.LRUCache = undefined;
32630
+ var perf2 = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
32631
+ var warned2 = new Set;
32632
+ var PROCESS2 = typeof process === "object" && !!process ? process : {};
32633
+ var emitWarning2 = (msg, type2, code, fn) => {
32634
+ typeof PROCESS2.emitWarning === "function" ? PROCESS2.emitWarning(msg, type2, code, fn) : console.error(`[${code}] ${type2}: ${msg}`);
32635
+ };
32636
+ var AC2 = globalThis.AbortController;
32637
+ var AS2 = globalThis.AbortSignal;
32638
+ if (typeof AC2 === "undefined") {
32639
+ AS2 = class AbortSignal2 {
32640
+ onabort;
32641
+ _onabort = [];
32642
+ reason;
32643
+ aborted = false;
32644
+ addEventListener(_, fn) {
32645
+ this._onabort.push(fn);
32646
+ }
32647
+ };
32648
+ AC2 = class AbortController2 {
32649
+ constructor() {
32650
+ warnACPolyfill();
32651
+ }
32652
+ signal = new AS2;
32653
+ abort(reason) {
32654
+ if (this.signal.aborted)
32655
+ return;
32656
+ this.signal.reason = reason;
32657
+ this.signal.aborted = true;
32658
+ for (const fn of this.signal._onabort) {
32659
+ fn(reason);
32660
+ }
32661
+ this.signal.onabort?.(reason);
32662
+ }
32663
+ };
32664
+ let printACPolyfillWarning = PROCESS2.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
32665
+ const warnACPolyfill = () => {
32666
+ if (!printACPolyfillWarning)
32667
+ return;
32668
+ printACPolyfillWarning = false;
32669
+ emitWarning2("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);
32670
+ };
32671
+ }
32672
+ var shouldWarn2 = (code) => !warned2.has(code);
32673
+ var TYPE2 = Symbol("type");
32674
+ var isPosInt2 = (n2) => n2 && n2 === Math.floor(n2) && n2 > 0 && isFinite(n2);
32675
+ var getUintArray2 = (max) => !isPosInt2(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray2 : null;
32676
+
32677
+ class ZeroArray2 extends Array {
32678
+ constructor(size) {
32679
+ super(size);
32680
+ this.fill(0);
32681
+ }
32682
+ }
32683
+
32684
+ class Stack2 {
32685
+ heap;
32686
+ length;
32687
+ static #constructing = false;
32688
+ static create(max) {
32689
+ const HeapCls = getUintArray2(max);
32690
+ if (!HeapCls)
32691
+ return [];
32692
+ Stack2.#constructing = true;
32693
+ const s = new Stack2(max, HeapCls);
32694
+ Stack2.#constructing = false;
32695
+ return s;
32696
+ }
32697
+ constructor(max, HeapCls) {
32698
+ if (!Stack2.#constructing) {
32699
+ throw new TypeError("instantiate Stack using Stack.create(n)");
32700
+ }
32701
+ this.heap = new HeapCls(max);
32702
+ this.length = 0;
32703
+ }
32704
+ push(n2) {
32705
+ this.heap[this.length++] = n2;
32706
+ }
32707
+ pop() {
32708
+ return this.heap[--this.length];
32709
+ }
32710
+ }
32711
+
32712
+ class LRUCache2 {
32713
+ #max;
32714
+ #maxSize;
32715
+ #dispose;
32716
+ #disposeAfter;
32717
+ #fetchMethod;
32718
+ #memoMethod;
32719
+ ttl;
32720
+ ttlResolution;
32721
+ ttlAutopurge;
32722
+ updateAgeOnGet;
32723
+ updateAgeOnHas;
32724
+ allowStale;
32725
+ noDisposeOnSet;
32726
+ noUpdateTTL;
32727
+ maxEntrySize;
32728
+ sizeCalculation;
32729
+ noDeleteOnFetchRejection;
32730
+ noDeleteOnStaleGet;
32731
+ allowStaleOnFetchAbort;
32732
+ allowStaleOnFetchRejection;
32733
+ ignoreFetchAbort;
32734
+ #size;
32735
+ #calculatedSize;
32736
+ #keyMap;
32737
+ #keyList;
32738
+ #valList;
32739
+ #next;
32740
+ #prev;
32741
+ #head;
32742
+ #tail;
32743
+ #free;
32744
+ #disposed;
32745
+ #sizes;
32746
+ #starts;
32747
+ #ttls;
32748
+ #hasDispose;
32749
+ #hasFetchMethod;
32750
+ #hasDisposeAfter;
32751
+ static unsafeExposeInternals(c) {
32752
+ return {
32753
+ starts: c.#starts,
32754
+ ttls: c.#ttls,
32755
+ sizes: c.#sizes,
32756
+ keyMap: c.#keyMap,
32757
+ keyList: c.#keyList,
32758
+ valList: c.#valList,
32759
+ next: c.#next,
32760
+ prev: c.#prev,
32761
+ get head() {
32762
+ return c.#head;
32763
+ },
32764
+ get tail() {
32765
+ return c.#tail;
32766
+ },
32767
+ free: c.#free,
32768
+ isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
32769
+ backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
32770
+ moveToTail: (index) => c.#moveToTail(index),
32771
+ indexes: (options) => c.#indexes(options),
32772
+ rindexes: (options) => c.#rindexes(options),
32773
+ isStale: (index) => c.#isStale(index)
32774
+ };
32775
+ }
32776
+ get max() {
32777
+ return this.#max;
32778
+ }
32779
+ get maxSize() {
32780
+ return this.#maxSize;
32781
+ }
32782
+ get calculatedSize() {
32783
+ return this.#calculatedSize;
32784
+ }
32785
+ get size() {
32786
+ return this.#size;
32787
+ }
32788
+ get fetchMethod() {
32789
+ return this.#fetchMethod;
32790
+ }
32791
+ get memoMethod() {
32792
+ return this.#memoMethod;
32793
+ }
32794
+ get dispose() {
32795
+ return this.#dispose;
32796
+ }
32797
+ get disposeAfter() {
32798
+ return this.#disposeAfter;
32799
+ }
32800
+ constructor(options) {
32801
+ 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;
32802
+ if (max !== 0 && !isPosInt2(max)) {
32803
+ throw new TypeError("max option must be a nonnegative integer");
32804
+ }
32805
+ const UintArray = max ? getUintArray2(max) : Array;
32806
+ if (!UintArray) {
32807
+ throw new Error("invalid max value: " + max);
32808
+ }
32809
+ this.#max = max;
32810
+ this.#maxSize = maxSize;
32811
+ this.maxEntrySize = maxEntrySize || this.#maxSize;
32812
+ this.sizeCalculation = sizeCalculation;
32813
+ if (this.sizeCalculation) {
32814
+ if (!this.#maxSize && !this.maxEntrySize) {
32815
+ throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
32816
+ }
32817
+ if (typeof this.sizeCalculation !== "function") {
32818
+ throw new TypeError("sizeCalculation set to non-function");
32819
+ }
32820
+ }
32821
+ if (memoMethod !== undefined && typeof memoMethod !== "function") {
32822
+ throw new TypeError("memoMethod must be a function if defined");
32823
+ }
32824
+ this.#memoMethod = memoMethod;
32825
+ if (fetchMethod !== undefined && typeof fetchMethod !== "function") {
32826
+ throw new TypeError("fetchMethod must be a function if specified");
32827
+ }
32828
+ this.#fetchMethod = fetchMethod;
32829
+ this.#hasFetchMethod = !!fetchMethod;
32830
+ this.#keyMap = new Map;
32831
+ this.#keyList = new Array(max).fill(undefined);
32832
+ this.#valList = new Array(max).fill(undefined);
32833
+ this.#next = new UintArray(max);
32834
+ this.#prev = new UintArray(max);
32835
+ this.#head = 0;
32836
+ this.#tail = 0;
32837
+ this.#free = Stack2.create(max);
32838
+ this.#size = 0;
32839
+ this.#calculatedSize = 0;
32840
+ if (typeof dispose === "function") {
32841
+ this.#dispose = dispose;
32842
+ }
32843
+ if (typeof disposeAfter === "function") {
32844
+ this.#disposeAfter = disposeAfter;
32845
+ this.#disposed = [];
32846
+ } else {
32847
+ this.#disposeAfter = undefined;
32848
+ this.#disposed = undefined;
32849
+ }
32850
+ this.#hasDispose = !!this.#dispose;
32851
+ this.#hasDisposeAfter = !!this.#disposeAfter;
32852
+ this.noDisposeOnSet = !!noDisposeOnSet;
32853
+ this.noUpdateTTL = !!noUpdateTTL;
32854
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
32855
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
32856
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
32857
+ this.ignoreFetchAbort = !!ignoreFetchAbort;
32858
+ if (this.maxEntrySize !== 0) {
32859
+ if (this.#maxSize !== 0) {
32860
+ if (!isPosInt2(this.#maxSize)) {
32861
+ throw new TypeError("maxSize must be a positive integer if specified");
32862
+ }
32863
+ }
32864
+ if (!isPosInt2(this.maxEntrySize)) {
32865
+ throw new TypeError("maxEntrySize must be a positive integer if specified");
32866
+ }
32867
+ this.#initializeSizeTracking();
32868
+ }
32869
+ this.allowStale = !!allowStale;
32870
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
32871
+ this.updateAgeOnGet = !!updateAgeOnGet;
32872
+ this.updateAgeOnHas = !!updateAgeOnHas;
32873
+ this.ttlResolution = isPosInt2(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
32874
+ this.ttlAutopurge = !!ttlAutopurge;
32875
+ this.ttl = ttl || 0;
32876
+ if (this.ttl) {
32877
+ if (!isPosInt2(this.ttl)) {
32878
+ throw new TypeError("ttl must be a positive integer if specified");
32879
+ }
32880
+ this.#initializeTTLTracking();
32881
+ }
32882
+ if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
32883
+ throw new TypeError("At least one of max, maxSize, or ttl is required");
32884
+ }
32885
+ if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
32886
+ const code = "LRU_CACHE_UNBOUNDED";
32887
+ if (shouldWarn2(code)) {
32888
+ warned2.add(code);
32889
+ const msg = "TTL caching without ttlAutopurge, max, or maxSize can " + "result in unbounded memory consumption.";
32890
+ emitWarning2(msg, "UnboundedCacheWarning", code, LRUCache2);
32891
+ }
32892
+ }
32893
+ }
32894
+ getRemainingTTL(key2) {
32895
+ return this.#keyMap.has(key2) ? Infinity : 0;
32896
+ }
32897
+ #initializeTTLTracking() {
32898
+ const ttls = new ZeroArray2(this.#max);
32899
+ const starts = new ZeroArray2(this.#max);
32900
+ this.#ttls = ttls;
32901
+ this.#starts = starts;
32902
+ this.#setItemTTL = (index, ttl, start = perf2.now()) => {
32903
+ starts[index] = ttl !== 0 ? start : 0;
32904
+ ttls[index] = ttl;
32905
+ if (ttl !== 0 && this.ttlAutopurge) {
32906
+ const t3 = setTimeout(() => {
32907
+ if (this.#isStale(index)) {
32908
+ this.#delete(this.#keyList[index], "expire");
32909
+ }
32910
+ }, ttl + 1);
32911
+ if (t3.unref) {
32912
+ t3.unref();
32913
+ }
32914
+ }
32915
+ };
32916
+ this.#updateItemAge = (index) => {
32917
+ starts[index] = ttls[index] !== 0 ? perf2.now() : 0;
32918
+ };
32919
+ this.#statusTTL = (status, index) => {
32920
+ if (ttls[index]) {
32921
+ const ttl = ttls[index];
32922
+ const start = starts[index];
32923
+ if (!ttl || !start)
32924
+ return;
32925
+ status.ttl = ttl;
32926
+ status.start = start;
32927
+ status.now = cachedNow || getNow();
32928
+ const age = status.now - start;
32929
+ status.remainingTTL = ttl - age;
32930
+ }
32931
+ };
32932
+ let cachedNow = 0;
32933
+ const getNow = () => {
32934
+ const n2 = perf2.now();
32935
+ if (this.ttlResolution > 0) {
32936
+ cachedNow = n2;
32937
+ const t3 = setTimeout(() => cachedNow = 0, this.ttlResolution);
32938
+ if (t3.unref) {
32939
+ t3.unref();
32940
+ }
32941
+ }
32942
+ return n2;
32943
+ };
32944
+ this.getRemainingTTL = (key2) => {
32945
+ const index = this.#keyMap.get(key2);
32946
+ if (index === undefined) {
32947
+ return 0;
32948
+ }
32949
+ const ttl = ttls[index];
32950
+ const start = starts[index];
32951
+ if (!ttl || !start) {
32952
+ return Infinity;
32953
+ }
32954
+ const age = (cachedNow || getNow()) - start;
32955
+ return ttl - age;
32956
+ };
32957
+ this.#isStale = (index) => {
32958
+ const s = starts[index];
32959
+ const t3 = ttls[index];
32960
+ return !!t3 && !!s && (cachedNow || getNow()) - s > t3;
32961
+ };
32962
+ }
32963
+ #updateItemAge = () => {};
32964
+ #statusTTL = () => {};
32965
+ #setItemTTL = () => {};
32966
+ #isStale = () => false;
32967
+ #initializeSizeTracking() {
32968
+ const sizes = new ZeroArray2(this.#max);
32969
+ this.#calculatedSize = 0;
32970
+ this.#sizes = sizes;
32971
+ this.#removeItemSize = (index) => {
32972
+ this.#calculatedSize -= sizes[index];
32973
+ sizes[index] = 0;
32974
+ };
32975
+ this.#requireSize = (k, v, size, sizeCalculation) => {
32976
+ if (this.#isBackgroundFetch(v)) {
32977
+ return 0;
32978
+ }
32979
+ if (!isPosInt2(size)) {
32980
+ if (sizeCalculation) {
32981
+ if (typeof sizeCalculation !== "function") {
32982
+ throw new TypeError("sizeCalculation must be a function");
32983
+ }
32984
+ size = sizeCalculation(v, k);
32985
+ if (!isPosInt2(size)) {
32986
+ throw new TypeError("sizeCalculation return invalid (expect positive integer)");
32987
+ }
32988
+ } else {
32989
+ throw new TypeError("invalid size value (must be positive integer). " + "When maxSize or maxEntrySize is used, sizeCalculation " + "or size must be set.");
32990
+ }
32991
+ }
32992
+ return size;
32993
+ };
32994
+ this.#addItemSize = (index, size, status) => {
32995
+ sizes[index] = size;
32996
+ if (this.#maxSize) {
32997
+ const maxSize = this.#maxSize - sizes[index];
32998
+ while (this.#calculatedSize > maxSize) {
32999
+ this.#evict(true);
33000
+ }
33001
+ }
33002
+ this.#calculatedSize += sizes[index];
33003
+ if (status) {
33004
+ status.entrySize = size;
33005
+ status.totalCalculatedSize = this.#calculatedSize;
33006
+ }
33007
+ };
33008
+ }
33009
+ #removeItemSize = (_i) => {};
33010
+ #addItemSize = (_i, _s, _st) => {};
33011
+ #requireSize = (_k, _v, size, sizeCalculation) => {
33012
+ if (size || sizeCalculation) {
33013
+ throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
33014
+ }
33015
+ return 0;
33016
+ };
33017
+ *#indexes({ allowStale = this.allowStale } = {}) {
33018
+ if (this.#size) {
33019
+ for (let i2 = this.#tail;; ) {
33020
+ if (!this.#isValidIndex(i2)) {
33021
+ break;
33022
+ }
33023
+ if (allowStale || !this.#isStale(i2)) {
33024
+ yield i2;
33025
+ }
33026
+ if (i2 === this.#head) {
33027
+ break;
33028
+ } else {
33029
+ i2 = this.#prev[i2];
33030
+ }
33031
+ }
33032
+ }
33033
+ }
33034
+ *#rindexes({ allowStale = this.allowStale } = {}) {
33035
+ if (this.#size) {
33036
+ for (let i2 = this.#head;; ) {
33037
+ if (!this.#isValidIndex(i2)) {
33038
+ break;
33039
+ }
33040
+ if (allowStale || !this.#isStale(i2)) {
33041
+ yield i2;
33042
+ }
33043
+ if (i2 === this.#tail) {
33044
+ break;
33045
+ } else {
33046
+ i2 = this.#next[i2];
33047
+ }
33048
+ }
33049
+ }
33050
+ }
33051
+ #isValidIndex(index) {
33052
+ return index !== undefined && this.#keyMap.get(this.#keyList[index]) === index;
33053
+ }
33054
+ *entries() {
33055
+ for (const i2 of this.#indexes()) {
33056
+ if (this.#valList[i2] !== undefined && this.#keyList[i2] !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33057
+ yield [this.#keyList[i2], this.#valList[i2]];
33058
+ }
33059
+ }
33060
+ }
33061
+ *rentries() {
33062
+ for (const i2 of this.#rindexes()) {
33063
+ if (this.#valList[i2] !== undefined && this.#keyList[i2] !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33064
+ yield [this.#keyList[i2], this.#valList[i2]];
33065
+ }
33066
+ }
33067
+ }
33068
+ *keys() {
33069
+ for (const i2 of this.#indexes()) {
33070
+ const k = this.#keyList[i2];
33071
+ if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33072
+ yield k;
33073
+ }
33074
+ }
33075
+ }
33076
+ *rkeys() {
33077
+ for (const i2 of this.#rindexes()) {
33078
+ const k = this.#keyList[i2];
33079
+ if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33080
+ yield k;
33081
+ }
33082
+ }
33083
+ }
33084
+ *values() {
33085
+ for (const i2 of this.#indexes()) {
33086
+ const v = this.#valList[i2];
33087
+ if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33088
+ yield this.#valList[i2];
33089
+ }
33090
+ }
33091
+ }
33092
+ *rvalues() {
33093
+ for (const i2 of this.#rindexes()) {
33094
+ const v = this.#valList[i2];
33095
+ if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33096
+ yield this.#valList[i2];
33097
+ }
33098
+ }
33099
+ }
33100
+ [Symbol.iterator]() {
33101
+ return this.entries();
33102
+ }
33103
+ [Symbol.toStringTag] = "LRUCache";
33104
+ find(fn, getOptions = {}) {
33105
+ for (const i2 of this.#indexes()) {
33106
+ const v = this.#valList[i2];
33107
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33108
+ if (value2 === undefined)
33109
+ continue;
33110
+ if (fn(value2, this.#keyList[i2], this)) {
33111
+ return this.get(this.#keyList[i2], getOptions);
33112
+ }
33113
+ }
33114
+ }
33115
+ forEach(fn, thisp = this) {
33116
+ for (const i2 of this.#indexes()) {
33117
+ const v = this.#valList[i2];
33118
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33119
+ if (value2 === undefined)
33120
+ continue;
33121
+ fn.call(thisp, value2, this.#keyList[i2], this);
33122
+ }
33123
+ }
33124
+ rforEach(fn, thisp = this) {
33125
+ for (const i2 of this.#rindexes()) {
33126
+ const v = this.#valList[i2];
33127
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33128
+ if (value2 === undefined)
33129
+ continue;
33130
+ fn.call(thisp, value2, this.#keyList[i2], this);
33131
+ }
33132
+ }
33133
+ purgeStale() {
33134
+ let deleted = false;
33135
+ for (const i2 of this.#rindexes({ allowStale: true })) {
33136
+ if (this.#isStale(i2)) {
33137
+ this.#delete(this.#keyList[i2], "expire");
33138
+ deleted = true;
33139
+ }
33140
+ }
33141
+ return deleted;
33142
+ }
33143
+ info(key2) {
33144
+ const i2 = this.#keyMap.get(key2);
33145
+ if (i2 === undefined)
33146
+ return;
33147
+ const v = this.#valList[i2];
33148
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33149
+ if (value2 === undefined)
33150
+ return;
33151
+ const entry = { value: value2 };
33152
+ if (this.#ttls && this.#starts) {
33153
+ const ttl = this.#ttls[i2];
33154
+ const start = this.#starts[i2];
33155
+ if (ttl && start) {
33156
+ const remain = ttl - (perf2.now() - start);
33157
+ entry.ttl = remain;
33158
+ entry.start = Date.now();
33159
+ }
33160
+ }
33161
+ if (this.#sizes) {
33162
+ entry.size = this.#sizes[i2];
33163
+ }
33164
+ return entry;
33165
+ }
33166
+ dump() {
33167
+ const arr = [];
33168
+ for (const i2 of this.#indexes({ allowStale: true })) {
33169
+ const key2 = this.#keyList[i2];
33170
+ const v = this.#valList[i2];
33171
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33172
+ if (value2 === undefined || key2 === undefined)
33173
+ continue;
33174
+ const entry = { value: value2 };
33175
+ if (this.#ttls && this.#starts) {
33176
+ entry.ttl = this.#ttls[i2];
33177
+ const age = perf2.now() - this.#starts[i2];
33178
+ entry.start = Math.floor(Date.now() - age);
33179
+ }
33180
+ if (this.#sizes) {
33181
+ entry.size = this.#sizes[i2];
33182
+ }
33183
+ arr.unshift([key2, entry]);
33184
+ }
33185
+ return arr;
33186
+ }
33187
+ load(arr) {
33188
+ this.clear();
33189
+ for (const [key2, entry] of arr) {
33190
+ if (entry.start) {
33191
+ const age = Date.now() - entry.start;
33192
+ entry.start = perf2.now() - age;
33193
+ }
33194
+ this.set(key2, entry.value, entry);
33195
+ }
33196
+ }
33197
+ set(k, v, setOptions = {}) {
33198
+ if (v === undefined) {
33199
+ this.delete(k);
33200
+ return this;
33201
+ }
33202
+ const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
33203
+ let { noUpdateTTL = this.noUpdateTTL } = setOptions;
33204
+ const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
33205
+ if (this.maxEntrySize && size > this.maxEntrySize) {
33206
+ if (status) {
33207
+ status.set = "miss";
33208
+ status.maxEntrySizeExceeded = true;
33209
+ }
33210
+ this.#delete(k, "set");
33211
+ return this;
33212
+ }
33213
+ let index = this.#size === 0 ? undefined : this.#keyMap.get(k);
33214
+ if (index === undefined) {
33215
+ index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
33216
+ this.#keyList[index] = k;
33217
+ this.#valList[index] = v;
33218
+ this.#keyMap.set(k, index);
33219
+ this.#next[this.#tail] = index;
33220
+ this.#prev[index] = this.#tail;
33221
+ this.#tail = index;
33222
+ this.#size++;
33223
+ this.#addItemSize(index, size, status);
33224
+ if (status)
33225
+ status.set = "add";
33226
+ noUpdateTTL = false;
33227
+ } else {
33228
+ this.#moveToTail(index);
33229
+ const oldVal = this.#valList[index];
33230
+ if (v !== oldVal) {
33231
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
33232
+ oldVal.__abortController.abort(new Error("replaced"));
33233
+ const { __staleWhileFetching: s } = oldVal;
33234
+ if (s !== undefined && !noDisposeOnSet) {
33235
+ if (this.#hasDispose) {
33236
+ this.#dispose?.(s, k, "set");
33237
+ }
33238
+ if (this.#hasDisposeAfter) {
33239
+ this.#disposed?.push([s, k, "set"]);
33240
+ }
33241
+ }
33242
+ } else if (!noDisposeOnSet) {
33243
+ if (this.#hasDispose) {
33244
+ this.#dispose?.(oldVal, k, "set");
33245
+ }
33246
+ if (this.#hasDisposeAfter) {
33247
+ this.#disposed?.push([oldVal, k, "set"]);
33248
+ }
33249
+ }
33250
+ this.#removeItemSize(index);
33251
+ this.#addItemSize(index, size, status);
33252
+ this.#valList[index] = v;
33253
+ if (status) {
33254
+ status.set = "replace";
33255
+ const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
33256
+ if (oldValue !== undefined)
33257
+ status.oldValue = oldValue;
33258
+ }
33259
+ } else if (status) {
33260
+ status.set = "update";
33261
+ }
33262
+ }
33263
+ if (ttl !== 0 && !this.#ttls) {
33264
+ this.#initializeTTLTracking();
33265
+ }
33266
+ if (this.#ttls) {
33267
+ if (!noUpdateTTL) {
33268
+ this.#setItemTTL(index, ttl, start);
33269
+ }
33270
+ if (status)
33271
+ this.#statusTTL(status, index);
33272
+ }
33273
+ if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
33274
+ const dt2 = this.#disposed;
33275
+ let task;
33276
+ while (task = dt2?.shift()) {
33277
+ this.#disposeAfter?.(...task);
33278
+ }
33279
+ }
33280
+ return this;
33281
+ }
33282
+ pop() {
33283
+ try {
33284
+ while (this.#size) {
33285
+ const val = this.#valList[this.#head];
33286
+ this.#evict(true);
33287
+ if (this.#isBackgroundFetch(val)) {
33288
+ if (val.__staleWhileFetching) {
33289
+ return val.__staleWhileFetching;
33290
+ }
33291
+ } else if (val !== undefined) {
33292
+ return val;
33293
+ }
33294
+ }
33295
+ } finally {
33296
+ if (this.#hasDisposeAfter && this.#disposed) {
33297
+ const dt2 = this.#disposed;
33298
+ let task;
33299
+ while (task = dt2?.shift()) {
33300
+ this.#disposeAfter?.(...task);
33301
+ }
33302
+ }
33303
+ }
33304
+ }
33305
+ #evict(free) {
33306
+ const head = this.#head;
33307
+ const k = this.#keyList[head];
33308
+ const v = this.#valList[head];
33309
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
33310
+ v.__abortController.abort(new Error("evicted"));
33311
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
33312
+ if (this.#hasDispose) {
33313
+ this.#dispose?.(v, k, "evict");
33314
+ }
33315
+ if (this.#hasDisposeAfter) {
33316
+ this.#disposed?.push([v, k, "evict"]);
33317
+ }
33318
+ }
33319
+ this.#removeItemSize(head);
33320
+ if (free) {
33321
+ this.#keyList[head] = undefined;
33322
+ this.#valList[head] = undefined;
33323
+ this.#free.push(head);
33324
+ }
33325
+ if (this.#size === 1) {
33326
+ this.#head = this.#tail = 0;
33327
+ this.#free.length = 0;
33328
+ } else {
33329
+ this.#head = this.#next[head];
33330
+ }
33331
+ this.#keyMap.delete(k);
33332
+ this.#size--;
33333
+ return head;
33334
+ }
33335
+ has(k, hasOptions = {}) {
33336
+ const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
33337
+ const index = this.#keyMap.get(k);
33338
+ if (index !== undefined) {
33339
+ const v = this.#valList[index];
33340
+ if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === undefined) {
33341
+ return false;
33342
+ }
33343
+ if (!this.#isStale(index)) {
33344
+ if (updateAgeOnHas) {
33345
+ this.#updateItemAge(index);
33346
+ }
33347
+ if (status) {
33348
+ status.has = "hit";
33349
+ this.#statusTTL(status, index);
33350
+ }
33351
+ return true;
33352
+ } else if (status) {
33353
+ status.has = "stale";
33354
+ this.#statusTTL(status, index);
33355
+ }
33356
+ } else if (status) {
33357
+ status.has = "miss";
33358
+ }
33359
+ return false;
33360
+ }
33361
+ peek(k, peekOptions = {}) {
33362
+ const { allowStale = this.allowStale } = peekOptions;
33363
+ const index = this.#keyMap.get(k);
33364
+ if (index === undefined || !allowStale && this.#isStale(index)) {
33365
+ return;
33366
+ }
33367
+ const v = this.#valList[index];
33368
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33369
+ }
33370
+ #backgroundFetch(k, index, options, context) {
33371
+ const v = index === undefined ? undefined : this.#valList[index];
33372
+ if (this.#isBackgroundFetch(v)) {
33373
+ return v;
33374
+ }
33375
+ const ac = new AC2;
33376
+ const { signal } = options;
33377
+ signal?.addEventListener("abort", () => ac.abort(signal.reason), {
33378
+ signal: ac.signal
33379
+ });
33380
+ const fetchOpts = {
33381
+ signal: ac.signal,
33382
+ options,
33383
+ context
33384
+ };
33385
+ const cb = (v2, updateCache = false) => {
33386
+ const { aborted } = ac.signal;
33387
+ const ignoreAbort = options.ignoreFetchAbort && v2 !== undefined;
33388
+ if (options.status) {
33389
+ if (aborted && !updateCache) {
33390
+ options.status.fetchAborted = true;
33391
+ options.status.fetchError = ac.signal.reason;
33392
+ if (ignoreAbort)
33393
+ options.status.fetchAbortIgnored = true;
33394
+ } else {
33395
+ options.status.fetchResolved = true;
33396
+ }
33397
+ }
33398
+ if (aborted && !ignoreAbort && !updateCache) {
33399
+ return fetchFail(ac.signal.reason);
33400
+ }
33401
+ const bf2 = p;
33402
+ if (this.#valList[index] === p) {
33403
+ if (v2 === undefined) {
33404
+ if (bf2.__staleWhileFetching) {
33405
+ this.#valList[index] = bf2.__staleWhileFetching;
33406
+ } else {
33407
+ this.#delete(k, "fetch");
33408
+ }
33409
+ } else {
33410
+ if (options.status)
33411
+ options.status.fetchUpdated = true;
33412
+ this.set(k, v2, fetchOpts.options);
33413
+ }
33414
+ }
33415
+ return v2;
33416
+ };
33417
+ const eb = (er) => {
33418
+ if (options.status) {
33419
+ options.status.fetchRejected = true;
33420
+ options.status.fetchError = er;
33421
+ }
33422
+ return fetchFail(er);
33423
+ };
33424
+ const fetchFail = (er) => {
33425
+ const { aborted } = ac.signal;
33426
+ const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
33427
+ const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
33428
+ const noDelete = allowStale || options.noDeleteOnFetchRejection;
33429
+ const bf2 = p;
33430
+ if (this.#valList[index] === p) {
33431
+ const del = !noDelete || bf2.__staleWhileFetching === undefined;
33432
+ if (del) {
33433
+ this.#delete(k, "fetch");
33434
+ } else if (!allowStaleAborted) {
33435
+ this.#valList[index] = bf2.__staleWhileFetching;
33436
+ }
33437
+ }
33438
+ if (allowStale) {
33439
+ if (options.status && bf2.__staleWhileFetching !== undefined) {
33440
+ options.status.returnedStale = true;
33441
+ }
33442
+ return bf2.__staleWhileFetching;
33443
+ } else if (bf2.__returned === bf2) {
33444
+ throw er;
33445
+ }
33446
+ };
33447
+ const pcall = (res, rej) => {
33448
+ const fmp = this.#fetchMethod?.(k, v, fetchOpts);
33449
+ if (fmp && fmp instanceof Promise) {
33450
+ fmp.then((v2) => res(v2 === undefined ? undefined : v2), rej);
33451
+ }
33452
+ ac.signal.addEventListener("abort", () => {
33453
+ if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
33454
+ res(undefined);
33455
+ if (options.allowStaleOnFetchAbort) {
33456
+ res = (v2) => cb(v2, true);
33457
+ }
33458
+ }
33459
+ });
33460
+ };
33461
+ if (options.status)
33462
+ options.status.fetchDispatched = true;
33463
+ const p = new Promise(pcall).then(cb, eb);
33464
+ const bf = Object.assign(p, {
33465
+ __abortController: ac,
33466
+ __staleWhileFetching: v,
33467
+ __returned: undefined
33468
+ });
33469
+ if (index === undefined) {
33470
+ this.set(k, bf, { ...fetchOpts.options, status: undefined });
33471
+ index = this.#keyMap.get(k);
33472
+ } else {
33473
+ this.#valList[index] = bf;
33474
+ }
33475
+ return bf;
33476
+ }
33477
+ #isBackgroundFetch(p) {
33478
+ if (!this.#hasFetchMethod)
33479
+ return false;
33480
+ const b = p;
33481
+ return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC2;
33482
+ }
33483
+ async fetch(k, fetchOptions = {}) {
33484
+ const {
33485
+ allowStale = this.allowStale,
33486
+ updateAgeOnGet = this.updateAgeOnGet,
33487
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
33488
+ ttl = this.ttl,
33489
+ noDisposeOnSet = this.noDisposeOnSet,
33490
+ size = 0,
33491
+ sizeCalculation = this.sizeCalculation,
33492
+ noUpdateTTL = this.noUpdateTTL,
33493
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
33494
+ allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
33495
+ ignoreFetchAbort = this.ignoreFetchAbort,
33496
+ allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
33497
+ context,
33498
+ forceRefresh = false,
33499
+ status,
33500
+ signal
33501
+ } = fetchOptions;
33502
+ if (!this.#hasFetchMethod) {
33503
+ if (status)
33504
+ status.fetch = "get";
33505
+ return this.get(k, {
33506
+ allowStale,
33507
+ updateAgeOnGet,
33508
+ noDeleteOnStaleGet,
33509
+ status
33510
+ });
33511
+ }
33512
+ const options = {
33513
+ allowStale,
33514
+ updateAgeOnGet,
33515
+ noDeleteOnStaleGet,
33516
+ ttl,
33517
+ noDisposeOnSet,
33518
+ size,
33519
+ sizeCalculation,
33520
+ noUpdateTTL,
33521
+ noDeleteOnFetchRejection,
33522
+ allowStaleOnFetchRejection,
33523
+ allowStaleOnFetchAbort,
33524
+ ignoreFetchAbort,
33525
+ status,
33526
+ signal
33527
+ };
33528
+ let index = this.#keyMap.get(k);
33529
+ if (index === undefined) {
33530
+ if (status)
33531
+ status.fetch = "miss";
33532
+ const p = this.#backgroundFetch(k, index, options, context);
33533
+ return p.__returned = p;
33534
+ } else {
33535
+ const v = this.#valList[index];
33536
+ if (this.#isBackgroundFetch(v)) {
33537
+ const stale = allowStale && v.__staleWhileFetching !== undefined;
33538
+ if (status) {
33539
+ status.fetch = "inflight";
33540
+ if (stale)
33541
+ status.returnedStale = true;
33542
+ }
33543
+ return stale ? v.__staleWhileFetching : v.__returned = v;
33544
+ }
33545
+ const isStale = this.#isStale(index);
33546
+ if (!forceRefresh && !isStale) {
33547
+ if (status)
33548
+ status.fetch = "hit";
33549
+ this.#moveToTail(index);
33550
+ if (updateAgeOnGet) {
33551
+ this.#updateItemAge(index);
33552
+ }
33553
+ if (status)
33554
+ this.#statusTTL(status, index);
33555
+ return v;
33556
+ }
33557
+ const p = this.#backgroundFetch(k, index, options, context);
33558
+ const hasStale = p.__staleWhileFetching !== undefined;
33559
+ const staleVal = hasStale && allowStale;
33560
+ if (status) {
33561
+ status.fetch = isStale ? "stale" : "refresh";
33562
+ if (staleVal && isStale)
33563
+ status.returnedStale = true;
33564
+ }
33565
+ return staleVal ? p.__staleWhileFetching : p.__returned = p;
33566
+ }
33567
+ }
33568
+ async forceFetch(k, fetchOptions = {}) {
33569
+ const v = await this.fetch(k, fetchOptions);
33570
+ if (v === undefined)
33571
+ throw new Error("fetch() returned undefined");
33572
+ return v;
33573
+ }
33574
+ memo(k, memoOptions = {}) {
33575
+ const memoMethod = this.#memoMethod;
33576
+ if (!memoMethod) {
33577
+ throw new Error("no memoMethod provided to constructor");
33578
+ }
33579
+ const { context, forceRefresh, ...options } = memoOptions;
33580
+ const v = this.get(k, options);
33581
+ if (!forceRefresh && v !== undefined)
33582
+ return v;
33583
+ const vv = memoMethod(k, v, {
33584
+ options,
33585
+ context
33586
+ });
33587
+ this.set(k, vv, options);
33588
+ return vv;
33589
+ }
33590
+ get(k, getOptions = {}) {
33591
+ const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
33592
+ const index = this.#keyMap.get(k);
33593
+ if (index !== undefined) {
33594
+ const value2 = this.#valList[index];
33595
+ const fetching = this.#isBackgroundFetch(value2);
33596
+ if (status)
33597
+ this.#statusTTL(status, index);
33598
+ if (this.#isStale(index)) {
33599
+ if (status)
33600
+ status.get = "stale";
33601
+ if (!fetching) {
33602
+ if (!noDeleteOnStaleGet) {
33603
+ this.#delete(k, "expire");
33604
+ }
33605
+ if (status && allowStale)
33606
+ status.returnedStale = true;
33607
+ return allowStale ? value2 : undefined;
33608
+ } else {
33609
+ if (status && allowStale && value2.__staleWhileFetching !== undefined) {
33610
+ status.returnedStale = true;
33611
+ }
33612
+ return allowStale ? value2.__staleWhileFetching : undefined;
33613
+ }
33614
+ } else {
33615
+ if (status)
33616
+ status.get = "hit";
33617
+ if (fetching) {
33618
+ return value2.__staleWhileFetching;
33619
+ }
33620
+ this.#moveToTail(index);
33621
+ if (updateAgeOnGet) {
33622
+ this.#updateItemAge(index);
33623
+ }
33624
+ return value2;
33625
+ }
33626
+ } else if (status) {
33627
+ status.get = "miss";
33628
+ }
33629
+ }
33630
+ #connect(p, n2) {
33631
+ this.#prev[n2] = p;
33632
+ this.#next[p] = n2;
33633
+ }
33634
+ #moveToTail(index) {
33635
+ if (index !== this.#tail) {
33636
+ if (index === this.#head) {
33637
+ this.#head = this.#next[index];
33638
+ } else {
33639
+ this.#connect(this.#prev[index], this.#next[index]);
33640
+ }
33641
+ this.#connect(this.#tail, index);
33642
+ this.#tail = index;
33643
+ }
33644
+ }
33645
+ delete(k) {
33646
+ return this.#delete(k, "delete");
33647
+ }
33648
+ #delete(k, reason) {
33649
+ let deleted = false;
33650
+ if (this.#size !== 0) {
33651
+ const index = this.#keyMap.get(k);
33652
+ if (index !== undefined) {
33653
+ deleted = true;
33654
+ if (this.#size === 1) {
33655
+ this.#clear(reason);
33656
+ } else {
33657
+ this.#removeItemSize(index);
33658
+ const v = this.#valList[index];
33659
+ if (this.#isBackgroundFetch(v)) {
33660
+ v.__abortController.abort(new Error("deleted"));
33661
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
33662
+ if (this.#hasDispose) {
33663
+ this.#dispose?.(v, k, reason);
33664
+ }
33665
+ if (this.#hasDisposeAfter) {
33666
+ this.#disposed?.push([v, k, reason]);
33667
+ }
33668
+ }
33669
+ this.#keyMap.delete(k);
33670
+ this.#keyList[index] = undefined;
33671
+ this.#valList[index] = undefined;
33672
+ if (index === this.#tail) {
33673
+ this.#tail = this.#prev[index];
33674
+ } else if (index === this.#head) {
33675
+ this.#head = this.#next[index];
33676
+ } else {
33677
+ const pi = this.#prev[index];
33678
+ this.#next[pi] = this.#next[index];
33679
+ const ni = this.#next[index];
33680
+ this.#prev[ni] = this.#prev[index];
33681
+ }
33682
+ this.#size--;
33683
+ this.#free.push(index);
33684
+ }
33685
+ }
33686
+ }
33687
+ if (this.#hasDisposeAfter && this.#disposed?.length) {
33688
+ const dt2 = this.#disposed;
33689
+ let task;
33690
+ while (task = dt2?.shift()) {
33691
+ this.#disposeAfter?.(...task);
33692
+ }
33693
+ }
33694
+ return deleted;
33695
+ }
33696
+ clear() {
33697
+ return this.#clear("delete");
33698
+ }
33699
+ #clear(reason) {
33700
+ for (const index of this.#rindexes({ allowStale: true })) {
33701
+ const v = this.#valList[index];
33702
+ if (this.#isBackgroundFetch(v)) {
33703
+ v.__abortController.abort(new Error("deleted"));
33704
+ } else {
33705
+ const k = this.#keyList[index];
33706
+ if (this.#hasDispose) {
33707
+ this.#dispose?.(v, k, reason);
33708
+ }
33709
+ if (this.#hasDisposeAfter) {
33710
+ this.#disposed?.push([v, k, reason]);
33711
+ }
33712
+ }
33713
+ }
33714
+ this.#keyMap.clear();
33715
+ this.#valList.fill(undefined);
33716
+ this.#keyList.fill(undefined);
33717
+ if (this.#ttls && this.#starts) {
33718
+ this.#ttls.fill(0);
33719
+ this.#starts.fill(0);
33720
+ }
33721
+ if (this.#sizes) {
33722
+ this.#sizes.fill(0);
33723
+ }
33724
+ this.#head = 0;
33725
+ this.#tail = 0;
33726
+ this.#free.length = 0;
33727
+ this.#calculatedSize = 0;
33728
+ this.#size = 0;
33729
+ if (this.#hasDisposeAfter && this.#disposed) {
33730
+ const dt2 = this.#disposed;
33731
+ let task;
33732
+ while (task = dt2?.shift()) {
33733
+ this.#disposeAfter?.(...task);
33734
+ }
33735
+ }
33736
+ }
33737
+ }
33738
+ exports.LRUCache = LRUCache2;
33739
+ });
33740
+
33741
+ // ../../node_modules/minipass/dist/commonjs/index.js
33742
+ var require_commonjs4 = __commonJS((exports) => {
32628
33743
  var __importDefault = exports && exports.__importDefault || function(mod) {
32629
33744
  return mod && mod.__esModule ? mod : { default: mod };
32630
33745
  };
@@ -33296,7 +34411,7 @@ var require_commonjs3 = __commonJS((exports) => {
33296
34411
  });
33297
34412
 
33298
34413
  // ../../node_modules/path-scurry/dist/commonjs/index.js
33299
- var require_commonjs4 = __commonJS((exports) => {
34414
+ var require_commonjs5 = __commonJS((exports) => {
33300
34415
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m, k, k2) {
33301
34416
  if (k2 === undefined)
33302
34417
  k2 = k;
@@ -33331,14 +34446,14 @@ var require_commonjs4 = __commonJS((exports) => {
33331
34446
  };
33332
34447
  Object.defineProperty(exports, "__esModule", { value: true });
33333
34448
  exports.PathScurry = exports.Path = exports.PathScurryDarwin = exports.PathScurryPosix = exports.PathScurryWin32 = exports.PathScurryBase = exports.PathPosix = exports.PathWin32 = exports.PathBase = exports.ChildrenCache = exports.ResolveCache = undefined;
33334
- var lru_cache_1 = require_commonjs();
34449
+ var lru_cache_1 = require_commonjs3();
33335
34450
  var node_path_1 = __require("node:path");
33336
34451
  var node_url_1 = __require("node:url");
33337
34452
  var fs_1 = __require("fs");
33338
34453
  var actualFS2 = __importStar(__require("node:fs"));
33339
34454
  var realpathSync2 = fs_1.realpathSync.native;
33340
34455
  var promises_1 = __require("node:fs/promises");
33341
- var minipass_1 = require_commonjs3();
34456
+ var minipass_1 = require_commonjs4();
33342
34457
  var defaultFS2 = {
33343
34458
  lstatSync: fs_1.lstatSync,
33344
34459
  readdir: fs_1.readdir,
@@ -35096,7 +36211,7 @@ var require_processor = __commonJS((exports) => {
35096
36211
  var require_walker2 = __commonJS((exports) => {
35097
36212
  Object.defineProperty(exports, "__esModule", { value: true });
35098
36213
  exports.GlobStream = exports.GlobWalker = exports.GlobUtil = undefined;
35099
- var minipass_1 = require_commonjs3();
36214
+ var minipass_1 = require_commonjs4();
35100
36215
  var ignore_js_1 = require_ignore2();
35101
36216
  var processor_js_1 = require_processor();
35102
36217
  var makeIgnore2 = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore;
@@ -35435,7 +36550,7 @@ var require_glob = __commonJS((exports) => {
35435
36550
  exports.Glob = undefined;
35436
36551
  var minimatch_1 = require_commonjs2();
35437
36552
  var node_url_1 = __require("node:url");
35438
- var path_scurry_1 = require_commonjs4();
36553
+ var path_scurry_1 = require_commonjs5();
35439
36554
  var pattern_js_1 = require_pattern();
35440
36555
  var walker_js_1 = require_walker2();
35441
36556
  var defaultPlatform4 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
@@ -35632,7 +36747,7 @@ var require_has_magic = __commonJS((exports) => {
35632
36747
  });
35633
36748
 
35634
36749
  // ../../node_modules/glob/dist/commonjs/index.js
35635
- var require_commonjs5 = __commonJS((exports) => {
36750
+ var require_commonjs6 = __commonJS((exports) => {
35636
36751
  Object.defineProperty(exports, "__esModule", { value: true });
35637
36752
  exports.glob = exports.sync = exports.iterate = exports.iterateSync = exports.stream = exports.streamSync = exports.Ignore = exports.hasMagic = exports.Glob = exports.unescape = exports.escape = undefined;
35638
36753
  exports.globStreamSync = globStreamSync2;
@@ -36401,443 +37516,1558 @@ var require_retry = __commonJS((exports) => {
36401
37516
  if (op.retry(err)) {
36402
37517
  return;
36403
37518
  }
36404
- if (err) {
36405
- arguments[0] = op.mainError();
37519
+ if (err) {
37520
+ arguments[0] = op.mainError();
37521
+ }
37522
+ callback.apply(this, arguments);
37523
+ });
37524
+ op.attempt(function() {
37525
+ original2.apply(obj, args);
37526
+ });
37527
+ }.bind(obj, original);
37528
+ obj[method].options = options;
37529
+ }
37530
+ };
37531
+ });
37532
+
37533
+ // ../../node_modules/promise-retry/index.js
37534
+ var require_promise_retry = __commonJS((exports, module) => {
37535
+ var errcode = require_err_code();
37536
+ var retry = require_retry();
37537
+ var hasOwn = Object.prototype.hasOwnProperty;
37538
+ function isRetryError(err) {
37539
+ return err && err.code === "EPROMISERETRY" && hasOwn.call(err, "retried");
37540
+ }
37541
+ function promiseRetry(fn, options) {
37542
+ var temp;
37543
+ var operation;
37544
+ if (typeof fn === "object" && typeof options === "function") {
37545
+ temp = options;
37546
+ options = fn;
37547
+ fn = temp;
37548
+ }
37549
+ operation = retry.operation(options);
37550
+ return new Promise(function(resolve2, reject) {
37551
+ operation.attempt(function(number) {
37552
+ Promise.resolve().then(function() {
37553
+ return fn(function(err) {
37554
+ if (isRetryError(err)) {
37555
+ err = err.retried;
37556
+ }
37557
+ throw errcode(new Error("Retrying"), "EPROMISERETRY", { retried: err });
37558
+ }, number);
37559
+ }).then(resolve2, function(err) {
37560
+ if (isRetryError(err)) {
37561
+ err = err.retried;
37562
+ if (operation.retry(err || new Error)) {
37563
+ return;
37564
+ }
37565
+ }
37566
+ reject(err);
37567
+ });
37568
+ });
37569
+ });
37570
+ }
37571
+ module.exports = promiseRetry;
37572
+ });
37573
+
37574
+ // ../../node_modules/@npmcli/git/lib/errors.js
37575
+ var require_errors2 = __commonJS((exports, module) => {
37576
+ var maxRetry = 3;
37577
+
37578
+ class GitError extends Error {
37579
+ shouldRetry() {
37580
+ return false;
37581
+ }
37582
+ }
37583
+
37584
+ class GitConnectionError extends GitError {
37585
+ constructor() {
37586
+ super("A git connection error occurred");
37587
+ }
37588
+ shouldRetry(number) {
37589
+ return number < maxRetry;
37590
+ }
37591
+ }
37592
+
37593
+ class GitPathspecError extends GitError {
37594
+ constructor() {
37595
+ super("The git reference could not be found");
37596
+ }
37597
+ }
37598
+
37599
+ class GitUnknownError extends GitError {
37600
+ constructor() {
37601
+ super("An unknown git error occurred");
37602
+ }
37603
+ }
37604
+ module.exports = {
37605
+ GitConnectionError,
37606
+ GitPathspecError,
37607
+ GitUnknownError
37608
+ };
37609
+ });
37610
+
37611
+ // ../../node_modules/@npmcli/git/lib/make-error.js
37612
+ var require_make_error = __commonJS((exports, module) => {
37613
+ var {
37614
+ GitConnectionError,
37615
+ GitPathspecError,
37616
+ GitUnknownError
37617
+ } = require_errors2();
37618
+ var connectionErrorRe = new RegExp([
37619
+ "remote error: Internal Server Error",
37620
+ "The remote end hung up unexpectedly",
37621
+ "Connection timed out",
37622
+ "Operation timed out",
37623
+ "Failed to connect to .* Timed out",
37624
+ "Connection reset by peer",
37625
+ "SSL_ERROR_SYSCALL",
37626
+ "The requested URL returned error: 503"
37627
+ ].join("|"));
37628
+ var missingPathspecRe = /pathspec .* did not match any file\(s\) known to git/;
37629
+ function makeError(er) {
37630
+ const message = er.stderr;
37631
+ let gitEr;
37632
+ if (connectionErrorRe.test(message)) {
37633
+ gitEr = new GitConnectionError(message);
37634
+ } else if (missingPathspecRe.test(message)) {
37635
+ gitEr = new GitPathspecError(message);
37636
+ } else {
37637
+ gitEr = new GitUnknownError(message);
37638
+ }
37639
+ return Object.assign(gitEr, er);
37640
+ }
37641
+ module.exports = makeError;
37642
+ });
37643
+
37644
+ // ../../node_modules/ini/lib/ini.js
37645
+ var require_ini = __commonJS((exports, module) => {
37646
+ var { hasOwnProperty } = Object.prototype;
37647
+ var encode = (obj, opt = {}) => {
37648
+ if (typeof opt === "string") {
37649
+ opt = { section: opt };
37650
+ }
37651
+ opt.align = opt.align === true;
37652
+ opt.newline = opt.newline === true;
37653
+ opt.sort = opt.sort === true;
37654
+ opt.whitespace = opt.whitespace === true || opt.align === true;
37655
+ opt.platform = opt.platform || typeof process !== "undefined" && process.platform;
37656
+ opt.bracketedArray = opt.bracketedArray !== false;
37657
+ const eol = opt.platform === "win32" ? `\r
37658
+ ` : `
37659
+ `;
37660
+ const separator = opt.whitespace ? " = " : "=";
37661
+ const children = [];
37662
+ const keys = opt.sort ? Object.keys(obj).sort() : Object.keys(obj);
37663
+ let padToChars = 0;
37664
+ if (opt.align) {
37665
+ padToChars = safe(keys.filter((k) => obj[k] === null || Array.isArray(obj[k]) || typeof obj[k] !== "object").map((k) => Array.isArray(obj[k]) ? `${k}[]` : k).concat([""]).reduce((a3, b) => safe(a3).length >= safe(b).length ? a3 : b)).length;
37666
+ }
37667
+ let out = "";
37668
+ const arraySuffix = opt.bracketedArray ? "[]" : "";
37669
+ for (const k of keys) {
37670
+ const val = obj[k];
37671
+ if (val && Array.isArray(val)) {
37672
+ for (const item of val) {
37673
+ out += safe(`${k}${arraySuffix}`).padEnd(padToChars, " ") + separator + safe(item) + eol;
37674
+ }
37675
+ } else if (val && typeof val === "object") {
37676
+ children.push(k);
37677
+ } else {
37678
+ out += safe(k).padEnd(padToChars, " ") + separator + safe(val) + eol;
37679
+ }
37680
+ }
37681
+ if (opt.section && out.length) {
37682
+ out = "[" + safe(opt.section) + "]" + (opt.newline ? eol + eol : eol) + out;
37683
+ }
37684
+ for (const k of children) {
37685
+ const nk = splitSections(k, ".").join("\\.");
37686
+ const section = (opt.section ? opt.section + "." : "") + nk;
37687
+ const child = encode(obj[k], {
37688
+ ...opt,
37689
+ section
37690
+ });
37691
+ if (out.length && child.length) {
37692
+ out += eol;
37693
+ }
37694
+ out += child;
37695
+ }
37696
+ return out;
37697
+ };
37698
+ function splitSections(str, separator) {
37699
+ var lastMatchIndex = 0;
37700
+ var lastSeparatorIndex = 0;
37701
+ var nextIndex = 0;
37702
+ var sections = [];
37703
+ do {
37704
+ nextIndex = str.indexOf(separator, lastMatchIndex);
37705
+ if (nextIndex !== -1) {
37706
+ lastMatchIndex = nextIndex + separator.length;
37707
+ if (nextIndex > 0 && str[nextIndex - 1] === "\\") {
37708
+ continue;
37709
+ }
37710
+ sections.push(str.slice(lastSeparatorIndex, nextIndex));
37711
+ lastSeparatorIndex = nextIndex + separator.length;
37712
+ }
37713
+ } while (nextIndex !== -1);
37714
+ sections.push(str.slice(lastSeparatorIndex));
37715
+ return sections;
37716
+ }
37717
+ var decode = (str, opt = {}) => {
37718
+ opt.bracketedArray = opt.bracketedArray !== false;
37719
+ const out = Object.create(null);
37720
+ let p = out;
37721
+ let section = null;
37722
+ const re = /^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i;
37723
+ const lines2 = str.split(/[\r\n]+/g);
37724
+ const duplicates = {};
37725
+ for (const line of lines2) {
37726
+ if (!line || line.match(/^\s*[;#]/) || line.match(/^\s*$/)) {
37727
+ continue;
37728
+ }
37729
+ const match2 = line.match(re);
37730
+ if (!match2) {
37731
+ continue;
37732
+ }
37733
+ if (match2[1] !== undefined) {
37734
+ section = unsafe(match2[1]);
37735
+ if (section === "__proto__") {
37736
+ p = Object.create(null);
37737
+ continue;
37738
+ }
37739
+ p = out[section] = out[section] || Object.create(null);
37740
+ continue;
37741
+ }
37742
+ const keyRaw = unsafe(match2[2]);
37743
+ let isArray;
37744
+ if (opt.bracketedArray) {
37745
+ isArray = keyRaw.length > 2 && keyRaw.slice(-2) === "[]";
37746
+ } else {
37747
+ duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1;
37748
+ isArray = duplicates[keyRaw] > 1;
37749
+ }
37750
+ const key2 = isArray && keyRaw.endsWith("[]") ? keyRaw.slice(0, -2) : keyRaw;
37751
+ if (key2 === "__proto__") {
37752
+ continue;
37753
+ }
37754
+ const valueRaw = match2[3] ? unsafe(match2[4]) : true;
37755
+ const value2 = valueRaw === "true" || valueRaw === "false" || valueRaw === "null" ? JSON.parse(valueRaw) : valueRaw;
37756
+ if (isArray) {
37757
+ if (!hasOwnProperty.call(p, key2)) {
37758
+ p[key2] = [];
37759
+ } else if (!Array.isArray(p[key2])) {
37760
+ p[key2] = [p[key2]];
37761
+ }
37762
+ }
37763
+ if (Array.isArray(p[key2])) {
37764
+ p[key2].push(value2);
37765
+ } else {
37766
+ p[key2] = value2;
37767
+ }
37768
+ }
37769
+ const remove = [];
37770
+ for (const k of Object.keys(out)) {
37771
+ if (!hasOwnProperty.call(out, k) || typeof out[k] !== "object" || Array.isArray(out[k])) {
37772
+ continue;
37773
+ }
37774
+ const parts = splitSections(k, ".");
37775
+ p = out;
37776
+ const l2 = parts.pop();
37777
+ const nl = l2.replace(/\\\./g, ".");
37778
+ for (const part of parts) {
37779
+ if (part === "__proto__") {
37780
+ continue;
37781
+ }
37782
+ if (!hasOwnProperty.call(p, part) || typeof p[part] !== "object") {
37783
+ p[part] = Object.create(null);
37784
+ }
37785
+ p = p[part];
37786
+ }
37787
+ if (p === out && nl === l2) {
37788
+ continue;
37789
+ }
37790
+ p[nl] = out[k];
37791
+ remove.push(k);
37792
+ }
37793
+ for (const del of remove) {
37794
+ delete out[del];
37795
+ }
37796
+ return out;
37797
+ };
37798
+ var isQuoted = (val) => {
37799
+ return val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'");
37800
+ };
37801
+ var safe = (val) => {
37802
+ if (typeof val !== "string" || val.match(/[=\r\n]/) || val.match(/^\[/) || val.length > 1 && isQuoted(val) || val !== val.trim()) {
37803
+ return JSON.stringify(val);
37804
+ }
37805
+ return val.split(";").join("\\;").split("#").join("\\#");
37806
+ };
37807
+ var unsafe = (val) => {
37808
+ val = (val || "").trim();
37809
+ if (isQuoted(val)) {
37810
+ if (val.charAt(0) === "'") {
37811
+ val = val.slice(1, -1);
37812
+ }
37813
+ try {
37814
+ val = JSON.parse(val);
37815
+ } catch {}
37816
+ } else {
37817
+ let esc = false;
37818
+ let unesc = "";
37819
+ for (let i2 = 0, l2 = val.length;i2 < l2; i2++) {
37820
+ const c = val.charAt(i2);
37821
+ if (esc) {
37822
+ if ("\\;#".indexOf(c) !== -1) {
37823
+ unesc += c;
37824
+ } else {
37825
+ unesc += "\\" + c;
37826
+ }
37827
+ esc = false;
37828
+ } else if (";#".indexOf(c) !== -1) {
37829
+ break;
37830
+ } else if (c === "\\") {
37831
+ esc = true;
37832
+ } else {
37833
+ unesc += c;
37834
+ }
37835
+ }
37836
+ if (esc) {
37837
+ unesc += "\\";
37838
+ }
37839
+ return unesc.trim();
37840
+ }
37841
+ return val;
37842
+ };
37843
+ module.exports = {
37844
+ parse: decode,
37845
+ decode,
37846
+ stringify: encode,
37847
+ encode,
37848
+ safe,
37849
+ unsafe
37850
+ };
37851
+ });
37852
+
37853
+ // ../../node_modules/@npmcli/git/lib/opts.js
37854
+ var require_opts = __commonJS((exports, module) => {
37855
+ var fs4 = __require("node:fs");
37856
+ var os = __require("node:os");
37857
+ var path6 = __require("node:path");
37858
+ var ini = require_ini();
37859
+ var gitConfigPath = path6.join(os.homedir(), ".gitconfig");
37860
+ var cachedConfig = null;
37861
+ var loadGitConfig = () => {
37862
+ if (cachedConfig === null) {
37863
+ try {
37864
+ cachedConfig = {};
37865
+ if (fs4.existsSync(gitConfigPath)) {
37866
+ const configContent = fs4.readFileSync(gitConfigPath, "utf-8");
37867
+ cachedConfig = ini.parse(configContent);
37868
+ }
37869
+ } catch (error2) {
37870
+ cachedConfig = {};
37871
+ }
37872
+ }
37873
+ return cachedConfig;
37874
+ };
37875
+ var checkGitConfigs = () => {
37876
+ const config3 = loadGitConfig();
37877
+ return {
37878
+ sshCommandSetInConfig: config3?.core?.sshCommand !== undefined,
37879
+ askPassSetInConfig: config3?.core?.askpass !== undefined
37880
+ };
37881
+ };
37882
+ var sshCommandSetInEnv = process.env.GIT_SSH_COMMAND !== undefined;
37883
+ var askPassSetInEnv = process.env.GIT_ASKPASS !== undefined;
37884
+ var { sshCommandSetInConfig, askPassSetInConfig } = checkGitConfigs();
37885
+ var finalGitEnv = {
37886
+ ...askPassSetInEnv || askPassSetInConfig ? {} : {
37887
+ GIT_ASKPASS: "echo"
37888
+ },
37889
+ ...sshCommandSetInEnv || sshCommandSetInConfig ? {} : {
37890
+ GIT_SSH_COMMAND: "ssh -oStrictHostKeyChecking=accept-new"
37891
+ }
37892
+ };
37893
+ module.exports = (opts = {}) => ({
37894
+ stdioString: true,
37895
+ ...opts,
37896
+ shell: false,
37897
+ env: opts.env || { ...finalGitEnv, ...process.env }
37898
+ });
37899
+ module.exports.loadGitConfig = loadGitConfig;
37900
+ });
37901
+
37902
+ // ../../node_modules/@npmcli/git/lib/which.js
37903
+ var require_which = __commonJS((exports, module) => {
37904
+ var which = require_lib5();
37905
+ var gitPath;
37906
+ try {
37907
+ gitPath = which.sync("git");
37908
+ } catch {}
37909
+ module.exports = (opts = {}) => {
37910
+ if (opts.git) {
37911
+ return opts.git;
37912
+ }
37913
+ if (!gitPath || opts.git === false) {
37914
+ return Object.assign(new Error("No git binary found in $PATH"), { code: "ENOGIT" });
37915
+ }
37916
+ return gitPath;
37917
+ };
37918
+ });
37919
+
37920
+ // ../../node_modules/@npmcli/git/lib/spawn.js
37921
+ var require_spawn = __commonJS((exports, module) => {
37922
+ var spawn2 = require_lib6();
37923
+ var promiseRetry = require_promise_retry();
37924
+ var { log } = require_lib3();
37925
+ var makeError = require_make_error();
37926
+ var makeOpts = require_opts();
37927
+ module.exports = (gitArgs, opts = {}) => {
37928
+ const whichGit = require_which();
37929
+ const gitPath = whichGit(opts);
37930
+ if (gitPath instanceof Error) {
37931
+ return Promise.reject(gitPath);
37932
+ }
37933
+ const args = opts.allowReplace || gitArgs[0] === "--no-replace-objects" ? gitArgs : ["--no-replace-objects", ...gitArgs];
37934
+ let retryOpts = opts.retry;
37935
+ if (retryOpts === null || retryOpts === undefined) {
37936
+ retryOpts = {
37937
+ retries: opts.fetchRetries || 2,
37938
+ factor: opts.fetchRetryFactor || 10,
37939
+ maxTimeout: opts.fetchRetryMaxtimeout || 60000,
37940
+ minTimeout: opts.fetchRetryMintimeout || 1000
37941
+ };
37942
+ }
37943
+ return promiseRetry((retryFn, number) => {
37944
+ if (number !== 1) {
37945
+ log.silly("git", `Retrying git command: ${args.join(" ")} attempt # ${number}`);
37946
+ }
37947
+ return spawn2(gitPath, args, makeOpts(opts)).catch((er) => {
37948
+ const gitError = makeError(er);
37949
+ if (!gitError.shouldRetry(number)) {
37950
+ throw gitError;
37951
+ }
37952
+ retryFn(gitError);
37953
+ });
37954
+ }, retryOpts);
37955
+ };
37956
+ });
37957
+
37958
+ // ../../node_modules/@npmcli/git/node_modules/lru-cache/dist/commonjs/index.js
37959
+ var require_commonjs7 = __commonJS((exports) => {
37960
+ Object.defineProperty(exports, "__esModule", { value: true });
37961
+ exports.LRUCache = undefined;
37962
+ var perf2 = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
37963
+ var warned2 = new Set;
37964
+ var PROCESS2 = typeof process === "object" && !!process ? process : {};
37965
+ var emitWarning2 = (msg, type2, code, fn) => {
37966
+ typeof PROCESS2.emitWarning === "function" ? PROCESS2.emitWarning(msg, type2, code, fn) : console.error(`[${code}] ${type2}: ${msg}`);
37967
+ };
37968
+ var AC2 = globalThis.AbortController;
37969
+ var AS2 = globalThis.AbortSignal;
37970
+ if (typeof AC2 === "undefined") {
37971
+ AS2 = class AbortSignal2 {
37972
+ onabort;
37973
+ _onabort = [];
37974
+ reason;
37975
+ aborted = false;
37976
+ addEventListener(_, fn) {
37977
+ this._onabort.push(fn);
37978
+ }
37979
+ };
37980
+ AC2 = class AbortController2 {
37981
+ constructor() {
37982
+ warnACPolyfill();
37983
+ }
37984
+ signal = new AS2;
37985
+ abort(reason) {
37986
+ if (this.signal.aborted)
37987
+ return;
37988
+ this.signal.reason = reason;
37989
+ this.signal.aborted = true;
37990
+ for (const fn of this.signal._onabort) {
37991
+ fn(reason);
37992
+ }
37993
+ this.signal.onabort?.(reason);
37994
+ }
37995
+ };
37996
+ let printACPolyfillWarning = PROCESS2.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
37997
+ const warnACPolyfill = () => {
37998
+ if (!printACPolyfillWarning)
37999
+ return;
38000
+ printACPolyfillWarning = false;
38001
+ emitWarning2("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);
38002
+ };
38003
+ }
38004
+ var shouldWarn2 = (code) => !warned2.has(code);
38005
+ var TYPE2 = Symbol("type");
38006
+ var isPosInt2 = (n2) => n2 && n2 === Math.floor(n2) && n2 > 0 && isFinite(n2);
38007
+ var getUintArray2 = (max) => !isPosInt2(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray2 : null;
38008
+
38009
+ class ZeroArray2 extends Array {
38010
+ constructor(size) {
38011
+ super(size);
38012
+ this.fill(0);
38013
+ }
38014
+ }
38015
+
38016
+ class Stack2 {
38017
+ heap;
38018
+ length;
38019
+ static #constructing = false;
38020
+ static create(max) {
38021
+ const HeapCls = getUintArray2(max);
38022
+ if (!HeapCls)
38023
+ return [];
38024
+ Stack2.#constructing = true;
38025
+ const s = new Stack2(max, HeapCls);
38026
+ Stack2.#constructing = false;
38027
+ return s;
38028
+ }
38029
+ constructor(max, HeapCls) {
38030
+ if (!Stack2.#constructing) {
38031
+ throw new TypeError("instantiate Stack using Stack.create(n)");
38032
+ }
38033
+ this.heap = new HeapCls(max);
38034
+ this.length = 0;
38035
+ }
38036
+ push(n2) {
38037
+ this.heap[this.length++] = n2;
38038
+ }
38039
+ pop() {
38040
+ return this.heap[--this.length];
38041
+ }
38042
+ }
38043
+
38044
+ class LRUCache2 {
38045
+ #max;
38046
+ #maxSize;
38047
+ #dispose;
38048
+ #disposeAfter;
38049
+ #fetchMethod;
38050
+ #memoMethod;
38051
+ ttl;
38052
+ ttlResolution;
38053
+ ttlAutopurge;
38054
+ updateAgeOnGet;
38055
+ updateAgeOnHas;
38056
+ allowStale;
38057
+ noDisposeOnSet;
38058
+ noUpdateTTL;
38059
+ maxEntrySize;
38060
+ sizeCalculation;
38061
+ noDeleteOnFetchRejection;
38062
+ noDeleteOnStaleGet;
38063
+ allowStaleOnFetchAbort;
38064
+ allowStaleOnFetchRejection;
38065
+ ignoreFetchAbort;
38066
+ #size;
38067
+ #calculatedSize;
38068
+ #keyMap;
38069
+ #keyList;
38070
+ #valList;
38071
+ #next;
38072
+ #prev;
38073
+ #head;
38074
+ #tail;
38075
+ #free;
38076
+ #disposed;
38077
+ #sizes;
38078
+ #starts;
38079
+ #ttls;
38080
+ #hasDispose;
38081
+ #hasFetchMethod;
38082
+ #hasDisposeAfter;
38083
+ static unsafeExposeInternals(c) {
38084
+ return {
38085
+ starts: c.#starts,
38086
+ ttls: c.#ttls,
38087
+ sizes: c.#sizes,
38088
+ keyMap: c.#keyMap,
38089
+ keyList: c.#keyList,
38090
+ valList: c.#valList,
38091
+ next: c.#next,
38092
+ prev: c.#prev,
38093
+ get head() {
38094
+ return c.#head;
38095
+ },
38096
+ get tail() {
38097
+ return c.#tail;
38098
+ },
38099
+ free: c.#free,
38100
+ isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
38101
+ backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
38102
+ moveToTail: (index) => c.#moveToTail(index),
38103
+ indexes: (options) => c.#indexes(options),
38104
+ rindexes: (options) => c.#rindexes(options),
38105
+ isStale: (index) => c.#isStale(index)
38106
+ };
38107
+ }
38108
+ get max() {
38109
+ return this.#max;
38110
+ }
38111
+ get maxSize() {
38112
+ return this.#maxSize;
38113
+ }
38114
+ get calculatedSize() {
38115
+ return this.#calculatedSize;
38116
+ }
38117
+ get size() {
38118
+ return this.#size;
38119
+ }
38120
+ get fetchMethod() {
38121
+ return this.#fetchMethod;
38122
+ }
38123
+ get memoMethod() {
38124
+ return this.#memoMethod;
38125
+ }
38126
+ get dispose() {
38127
+ return this.#dispose;
38128
+ }
38129
+ get disposeAfter() {
38130
+ return this.#disposeAfter;
38131
+ }
38132
+ constructor(options) {
38133
+ 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;
38134
+ if (max !== 0 && !isPosInt2(max)) {
38135
+ throw new TypeError("max option must be a nonnegative integer");
38136
+ }
38137
+ const UintArray = max ? getUintArray2(max) : Array;
38138
+ if (!UintArray) {
38139
+ throw new Error("invalid max value: " + max);
38140
+ }
38141
+ this.#max = max;
38142
+ this.#maxSize = maxSize;
38143
+ this.maxEntrySize = maxEntrySize || this.#maxSize;
38144
+ this.sizeCalculation = sizeCalculation;
38145
+ if (this.sizeCalculation) {
38146
+ if (!this.#maxSize && !this.maxEntrySize) {
38147
+ throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
38148
+ }
38149
+ if (typeof this.sizeCalculation !== "function") {
38150
+ throw new TypeError("sizeCalculation set to non-function");
38151
+ }
38152
+ }
38153
+ if (memoMethod !== undefined && typeof memoMethod !== "function") {
38154
+ throw new TypeError("memoMethod must be a function if defined");
38155
+ }
38156
+ this.#memoMethod = memoMethod;
38157
+ if (fetchMethod !== undefined && typeof fetchMethod !== "function") {
38158
+ throw new TypeError("fetchMethod must be a function if specified");
38159
+ }
38160
+ this.#fetchMethod = fetchMethod;
38161
+ this.#hasFetchMethod = !!fetchMethod;
38162
+ this.#keyMap = new Map;
38163
+ this.#keyList = new Array(max).fill(undefined);
38164
+ this.#valList = new Array(max).fill(undefined);
38165
+ this.#next = new UintArray(max);
38166
+ this.#prev = new UintArray(max);
38167
+ this.#head = 0;
38168
+ this.#tail = 0;
38169
+ this.#free = Stack2.create(max);
38170
+ this.#size = 0;
38171
+ this.#calculatedSize = 0;
38172
+ if (typeof dispose === "function") {
38173
+ this.#dispose = dispose;
38174
+ }
38175
+ if (typeof disposeAfter === "function") {
38176
+ this.#disposeAfter = disposeAfter;
38177
+ this.#disposed = [];
38178
+ } else {
38179
+ this.#disposeAfter = undefined;
38180
+ this.#disposed = undefined;
38181
+ }
38182
+ this.#hasDispose = !!this.#dispose;
38183
+ this.#hasDisposeAfter = !!this.#disposeAfter;
38184
+ this.noDisposeOnSet = !!noDisposeOnSet;
38185
+ this.noUpdateTTL = !!noUpdateTTL;
38186
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
38187
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
38188
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
38189
+ this.ignoreFetchAbort = !!ignoreFetchAbort;
38190
+ if (this.maxEntrySize !== 0) {
38191
+ if (this.#maxSize !== 0) {
38192
+ if (!isPosInt2(this.#maxSize)) {
38193
+ throw new TypeError("maxSize must be a positive integer if specified");
38194
+ }
38195
+ }
38196
+ if (!isPosInt2(this.maxEntrySize)) {
38197
+ throw new TypeError("maxEntrySize must be a positive integer if specified");
38198
+ }
38199
+ this.#initializeSizeTracking();
38200
+ }
38201
+ this.allowStale = !!allowStale;
38202
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
38203
+ this.updateAgeOnGet = !!updateAgeOnGet;
38204
+ this.updateAgeOnHas = !!updateAgeOnHas;
38205
+ this.ttlResolution = isPosInt2(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
38206
+ this.ttlAutopurge = !!ttlAutopurge;
38207
+ this.ttl = ttl || 0;
38208
+ if (this.ttl) {
38209
+ if (!isPosInt2(this.ttl)) {
38210
+ throw new TypeError("ttl must be a positive integer if specified");
38211
+ }
38212
+ this.#initializeTTLTracking();
38213
+ }
38214
+ if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
38215
+ throw new TypeError("At least one of max, maxSize, or ttl is required");
38216
+ }
38217
+ if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
38218
+ const code = "LRU_CACHE_UNBOUNDED";
38219
+ if (shouldWarn2(code)) {
38220
+ warned2.add(code);
38221
+ const msg = "TTL caching without ttlAutopurge, max, or maxSize can " + "result in unbounded memory consumption.";
38222
+ emitWarning2(msg, "UnboundedCacheWarning", code, LRUCache2);
38223
+ }
38224
+ }
38225
+ }
38226
+ getRemainingTTL(key2) {
38227
+ return this.#keyMap.has(key2) ? Infinity : 0;
38228
+ }
38229
+ #initializeTTLTracking() {
38230
+ const ttls = new ZeroArray2(this.#max);
38231
+ const starts = new ZeroArray2(this.#max);
38232
+ this.#ttls = ttls;
38233
+ this.#starts = starts;
38234
+ this.#setItemTTL = (index, ttl, start = perf2.now()) => {
38235
+ starts[index] = ttl !== 0 ? start : 0;
38236
+ ttls[index] = ttl;
38237
+ if (ttl !== 0 && this.ttlAutopurge) {
38238
+ const t3 = setTimeout(() => {
38239
+ if (this.#isStale(index)) {
38240
+ this.#delete(this.#keyList[index], "expire");
38241
+ }
38242
+ }, ttl + 1);
38243
+ if (t3.unref) {
38244
+ t3.unref();
38245
+ }
38246
+ }
38247
+ };
38248
+ this.#updateItemAge = (index) => {
38249
+ starts[index] = ttls[index] !== 0 ? perf2.now() : 0;
38250
+ };
38251
+ this.#statusTTL = (status, index) => {
38252
+ if (ttls[index]) {
38253
+ const ttl = ttls[index];
38254
+ const start = starts[index];
38255
+ if (!ttl || !start)
38256
+ return;
38257
+ status.ttl = ttl;
38258
+ status.start = start;
38259
+ status.now = cachedNow || getNow();
38260
+ const age = status.now - start;
38261
+ status.remainingTTL = ttl - age;
38262
+ }
38263
+ };
38264
+ let cachedNow = 0;
38265
+ const getNow = () => {
38266
+ const n2 = perf2.now();
38267
+ if (this.ttlResolution > 0) {
38268
+ cachedNow = n2;
38269
+ const t3 = setTimeout(() => cachedNow = 0, this.ttlResolution);
38270
+ if (t3.unref) {
38271
+ t3.unref();
38272
+ }
38273
+ }
38274
+ return n2;
38275
+ };
38276
+ this.getRemainingTTL = (key2) => {
38277
+ const index = this.#keyMap.get(key2);
38278
+ if (index === undefined) {
38279
+ return 0;
38280
+ }
38281
+ const ttl = ttls[index];
38282
+ const start = starts[index];
38283
+ if (!ttl || !start) {
38284
+ return Infinity;
38285
+ }
38286
+ const age = (cachedNow || getNow()) - start;
38287
+ return ttl - age;
38288
+ };
38289
+ this.#isStale = (index) => {
38290
+ const s = starts[index];
38291
+ const t3 = ttls[index];
38292
+ return !!t3 && !!s && (cachedNow || getNow()) - s > t3;
38293
+ };
38294
+ }
38295
+ #updateItemAge = () => {};
38296
+ #statusTTL = () => {};
38297
+ #setItemTTL = () => {};
38298
+ #isStale = () => false;
38299
+ #initializeSizeTracking() {
38300
+ const sizes = new ZeroArray2(this.#max);
38301
+ this.#calculatedSize = 0;
38302
+ this.#sizes = sizes;
38303
+ this.#removeItemSize = (index) => {
38304
+ this.#calculatedSize -= sizes[index];
38305
+ sizes[index] = 0;
38306
+ };
38307
+ this.#requireSize = (k, v, size, sizeCalculation) => {
38308
+ if (this.#isBackgroundFetch(v)) {
38309
+ return 0;
38310
+ }
38311
+ if (!isPosInt2(size)) {
38312
+ if (sizeCalculation) {
38313
+ if (typeof sizeCalculation !== "function") {
38314
+ throw new TypeError("sizeCalculation must be a function");
38315
+ }
38316
+ size = sizeCalculation(v, k);
38317
+ if (!isPosInt2(size)) {
38318
+ throw new TypeError("sizeCalculation return invalid (expect positive integer)");
38319
+ }
38320
+ } else {
38321
+ throw new TypeError("invalid size value (must be positive integer). " + "When maxSize or maxEntrySize is used, sizeCalculation " + "or size must be set.");
38322
+ }
38323
+ }
38324
+ return size;
38325
+ };
38326
+ this.#addItemSize = (index, size, status) => {
38327
+ sizes[index] = size;
38328
+ if (this.#maxSize) {
38329
+ const maxSize = this.#maxSize - sizes[index];
38330
+ while (this.#calculatedSize > maxSize) {
38331
+ this.#evict(true);
38332
+ }
38333
+ }
38334
+ this.#calculatedSize += sizes[index];
38335
+ if (status) {
38336
+ status.entrySize = size;
38337
+ status.totalCalculatedSize = this.#calculatedSize;
38338
+ }
38339
+ };
38340
+ }
38341
+ #removeItemSize = (_i) => {};
38342
+ #addItemSize = (_i, _s, _st) => {};
38343
+ #requireSize = (_k, _v, size, sizeCalculation) => {
38344
+ if (size || sizeCalculation) {
38345
+ throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
38346
+ }
38347
+ return 0;
38348
+ };
38349
+ *#indexes({ allowStale = this.allowStale } = {}) {
38350
+ if (this.#size) {
38351
+ for (let i2 = this.#tail;; ) {
38352
+ if (!this.#isValidIndex(i2)) {
38353
+ break;
38354
+ }
38355
+ if (allowStale || !this.#isStale(i2)) {
38356
+ yield i2;
38357
+ }
38358
+ if (i2 === this.#head) {
38359
+ break;
38360
+ } else {
38361
+ i2 = this.#prev[i2];
38362
+ }
38363
+ }
38364
+ }
38365
+ }
38366
+ *#rindexes({ allowStale = this.allowStale } = {}) {
38367
+ if (this.#size) {
38368
+ for (let i2 = this.#head;; ) {
38369
+ if (!this.#isValidIndex(i2)) {
38370
+ break;
38371
+ }
38372
+ if (allowStale || !this.#isStale(i2)) {
38373
+ yield i2;
38374
+ }
38375
+ if (i2 === this.#tail) {
38376
+ break;
38377
+ } else {
38378
+ i2 = this.#next[i2];
36406
38379
  }
36407
- callback.apply(this, arguments);
36408
- });
36409
- op.attempt(function() {
36410
- original2.apply(obj, args);
36411
- });
36412
- }.bind(obj, original);
36413
- obj[method].options = options;
36414
- }
36415
- };
36416
- });
36417
-
36418
- // ../../node_modules/promise-retry/index.js
36419
- var require_promise_retry = __commonJS((exports, module) => {
36420
- var errcode = require_err_code();
36421
- var retry = require_retry();
36422
- var hasOwn = Object.prototype.hasOwnProperty;
36423
- function isRetryError(err) {
36424
- return err && err.code === "EPROMISERETRY" && hasOwn.call(err, "retried");
36425
- }
36426
- function promiseRetry(fn, options) {
36427
- var temp;
36428
- var operation;
36429
- if (typeof fn === "object" && typeof options === "function") {
36430
- temp = options;
36431
- options = fn;
36432
- fn = temp;
38380
+ }
38381
+ }
36433
38382
  }
36434
- operation = retry.operation(options);
36435
- return new Promise(function(resolve2, reject) {
36436
- operation.attempt(function(number) {
36437
- Promise.resolve().then(function() {
36438
- return fn(function(err) {
36439
- if (isRetryError(err)) {
36440
- err = err.retried;
36441
- }
36442
- throw errcode(new Error("Retrying"), "EPROMISERETRY", { retried: err });
36443
- }, number);
36444
- }).then(resolve2, function(err) {
36445
- if (isRetryError(err)) {
36446
- err = err.retried;
36447
- if (operation.retry(err || new Error)) {
36448
- return;
36449
- }
36450
- }
36451
- reject(err);
36452
- });
36453
- });
36454
- });
36455
- }
36456
- module.exports = promiseRetry;
36457
- });
36458
-
36459
- // ../../node_modules/@npmcli/git/lib/errors.js
36460
- var require_errors2 = __commonJS((exports, module) => {
36461
- var maxRetry = 3;
36462
-
36463
- class GitError extends Error {
36464
- shouldRetry() {
36465
- return false;
38383
+ #isValidIndex(index) {
38384
+ return index !== undefined && this.#keyMap.get(this.#keyList[index]) === index;
36466
38385
  }
36467
- }
36468
-
36469
- class GitConnectionError extends GitError {
36470
- constructor() {
36471
- super("A git connection error occurred");
38386
+ *entries() {
38387
+ for (const i2 of this.#indexes()) {
38388
+ if (this.#valList[i2] !== undefined && this.#keyList[i2] !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38389
+ yield [this.#keyList[i2], this.#valList[i2]];
38390
+ }
38391
+ }
36472
38392
  }
36473
- shouldRetry(number) {
36474
- return number < maxRetry;
38393
+ *rentries() {
38394
+ for (const i2 of this.#rindexes()) {
38395
+ if (this.#valList[i2] !== undefined && this.#keyList[i2] !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38396
+ yield [this.#keyList[i2], this.#valList[i2]];
38397
+ }
38398
+ }
36475
38399
  }
36476
- }
36477
-
36478
- class GitPathspecError extends GitError {
36479
- constructor() {
36480
- super("The git reference could not be found");
38400
+ *keys() {
38401
+ for (const i2 of this.#indexes()) {
38402
+ const k = this.#keyList[i2];
38403
+ if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38404
+ yield k;
38405
+ }
38406
+ }
36481
38407
  }
36482
- }
36483
-
36484
- class GitUnknownError extends GitError {
36485
- constructor() {
36486
- super("An unknown git error occurred");
38408
+ *rkeys() {
38409
+ for (const i2 of this.#rindexes()) {
38410
+ const k = this.#keyList[i2];
38411
+ if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38412
+ yield k;
38413
+ }
38414
+ }
36487
38415
  }
36488
- }
36489
- module.exports = {
36490
- GitConnectionError,
36491
- GitPathspecError,
36492
- GitUnknownError
36493
- };
36494
- });
36495
-
36496
- // ../../node_modules/@npmcli/git/lib/make-error.js
36497
- var require_make_error = __commonJS((exports, module) => {
36498
- var {
36499
- GitConnectionError,
36500
- GitPathspecError,
36501
- GitUnknownError
36502
- } = require_errors2();
36503
- var connectionErrorRe = new RegExp([
36504
- "remote error: Internal Server Error",
36505
- "The remote end hung up unexpectedly",
36506
- "Connection timed out",
36507
- "Operation timed out",
36508
- "Failed to connect to .* Timed out",
36509
- "Connection reset by peer",
36510
- "SSL_ERROR_SYSCALL",
36511
- "The requested URL returned error: 503"
36512
- ].join("|"));
36513
- var missingPathspecRe = /pathspec .* did not match any file\(s\) known to git/;
36514
- function makeError(er) {
36515
- const message = er.stderr;
36516
- let gitEr;
36517
- if (connectionErrorRe.test(message)) {
36518
- gitEr = new GitConnectionError(message);
36519
- } else if (missingPathspecRe.test(message)) {
36520
- gitEr = new GitPathspecError(message);
36521
- } else {
36522
- gitEr = new GitUnknownError(message);
38416
+ *values() {
38417
+ for (const i2 of this.#indexes()) {
38418
+ const v = this.#valList[i2];
38419
+ if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38420
+ yield this.#valList[i2];
38421
+ }
38422
+ }
36523
38423
  }
36524
- return Object.assign(gitEr, er);
36525
- }
36526
- module.exports = makeError;
36527
- });
36528
-
36529
- // ../../node_modules/ini/lib/ini.js
36530
- var require_ini = __commonJS((exports, module) => {
36531
- var { hasOwnProperty } = Object.prototype;
36532
- var encode = (obj, opt = {}) => {
36533
- if (typeof opt === "string") {
36534
- opt = { section: opt };
38424
+ *rvalues() {
38425
+ for (const i2 of this.#rindexes()) {
38426
+ const v = this.#valList[i2];
38427
+ if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38428
+ yield this.#valList[i2];
38429
+ }
38430
+ }
36535
38431
  }
36536
- opt.align = opt.align === true;
36537
- opt.newline = opt.newline === true;
36538
- opt.sort = opt.sort === true;
36539
- opt.whitespace = opt.whitespace === true || opt.align === true;
36540
- opt.platform = opt.platform || typeof process !== "undefined" && process.platform;
36541
- opt.bracketedArray = opt.bracketedArray !== false;
36542
- const eol = opt.platform === "win32" ? `\r
36543
- ` : `
36544
- `;
36545
- const separator = opt.whitespace ? " = " : "=";
36546
- const children = [];
36547
- const keys = opt.sort ? Object.keys(obj).sort() : Object.keys(obj);
36548
- let padToChars = 0;
36549
- if (opt.align) {
36550
- padToChars = safe(keys.filter((k) => obj[k] === null || Array.isArray(obj[k]) || typeof obj[k] !== "object").map((k) => Array.isArray(obj[k]) ? `${k}[]` : k).concat([""]).reduce((a3, b) => safe(a3).length >= safe(b).length ? a3 : b)).length;
38432
+ [Symbol.iterator]() {
38433
+ return this.entries();
36551
38434
  }
36552
- let out = "";
36553
- const arraySuffix = opt.bracketedArray ? "[]" : "";
36554
- for (const k of keys) {
36555
- const val = obj[k];
36556
- if (val && Array.isArray(val)) {
36557
- for (const item of val) {
36558
- out += safe(`${k}${arraySuffix}`).padEnd(padToChars, " ") + separator + safe(item) + eol;
38435
+ [Symbol.toStringTag] = "LRUCache";
38436
+ find(fn, getOptions = {}) {
38437
+ for (const i2 of this.#indexes()) {
38438
+ const v = this.#valList[i2];
38439
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
38440
+ if (value2 === undefined)
38441
+ continue;
38442
+ if (fn(value2, this.#keyList[i2], this)) {
38443
+ return this.get(this.#keyList[i2], getOptions);
36559
38444
  }
36560
- } else if (val && typeof val === "object") {
36561
- children.push(k);
36562
- } else {
36563
- out += safe(k).padEnd(padToChars, " ") + separator + safe(val) + eol;
36564
38445
  }
36565
38446
  }
36566
- if (opt.section && out.length) {
36567
- out = "[" + safe(opt.section) + "]" + (opt.newline ? eol + eol : eol) + out;
36568
- }
36569
- for (const k of children) {
36570
- const nk = splitSections(k, ".").join("\\.");
36571
- const section = (opt.section ? opt.section + "." : "") + nk;
36572
- const child = encode(obj[k], {
36573
- ...opt,
36574
- section
36575
- });
36576
- if (out.length && child.length) {
36577
- out += eol;
38447
+ forEach(fn, thisp = this) {
38448
+ for (const i2 of this.#indexes()) {
38449
+ const v = this.#valList[i2];
38450
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
38451
+ if (value2 === undefined)
38452
+ continue;
38453
+ fn.call(thisp, value2, this.#keyList[i2], this);
36578
38454
  }
36579
- out += child;
36580
38455
  }
36581
- return out;
36582
- };
36583
- function splitSections(str, separator) {
36584
- var lastMatchIndex = 0;
36585
- var lastSeparatorIndex = 0;
36586
- var nextIndex = 0;
36587
- var sections = [];
36588
- do {
36589
- nextIndex = str.indexOf(separator, lastMatchIndex);
36590
- if (nextIndex !== -1) {
36591
- lastMatchIndex = nextIndex + separator.length;
36592
- if (nextIndex > 0 && str[nextIndex - 1] === "\\") {
38456
+ rforEach(fn, thisp = this) {
38457
+ for (const i2 of this.#rindexes()) {
38458
+ const v = this.#valList[i2];
38459
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
38460
+ if (value2 === undefined)
36593
38461
  continue;
38462
+ fn.call(thisp, value2, this.#keyList[i2], this);
38463
+ }
38464
+ }
38465
+ purgeStale() {
38466
+ let deleted = false;
38467
+ for (const i2 of this.#rindexes({ allowStale: true })) {
38468
+ if (this.#isStale(i2)) {
38469
+ this.#delete(this.#keyList[i2], "expire");
38470
+ deleted = true;
36594
38471
  }
36595
- sections.push(str.slice(lastSeparatorIndex, nextIndex));
36596
- lastSeparatorIndex = nextIndex + separator.length;
36597
38472
  }
36598
- } while (nextIndex !== -1);
36599
- sections.push(str.slice(lastSeparatorIndex));
36600
- return sections;
36601
- }
36602
- var decode = (str, opt = {}) => {
36603
- opt.bracketedArray = opt.bracketedArray !== false;
36604
- const out = Object.create(null);
36605
- let p = out;
36606
- let section = null;
36607
- const re = /^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i;
36608
- const lines2 = str.split(/[\r\n]+/g);
36609
- const duplicates = {};
36610
- for (const line of lines2) {
36611
- if (!line || line.match(/^\s*[;#]/) || line.match(/^\s*$/)) {
36612
- continue;
38473
+ return deleted;
38474
+ }
38475
+ info(key2) {
38476
+ const i2 = this.#keyMap.get(key2);
38477
+ if (i2 === undefined)
38478
+ return;
38479
+ const v = this.#valList[i2];
38480
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
38481
+ if (value2 === undefined)
38482
+ return;
38483
+ const entry = { value: value2 };
38484
+ if (this.#ttls && this.#starts) {
38485
+ const ttl = this.#ttls[i2];
38486
+ const start = this.#starts[i2];
38487
+ if (ttl && start) {
38488
+ const remain = ttl - (perf2.now() - start);
38489
+ entry.ttl = remain;
38490
+ entry.start = Date.now();
38491
+ }
36613
38492
  }
36614
- const match2 = line.match(re);
36615
- if (!match2) {
36616
- continue;
38493
+ if (this.#sizes) {
38494
+ entry.size = this.#sizes[i2];
36617
38495
  }
36618
- if (match2[1] !== undefined) {
36619
- section = unsafe(match2[1]);
36620
- if (section === "__proto__") {
36621
- p = Object.create(null);
38496
+ return entry;
38497
+ }
38498
+ dump() {
38499
+ const arr = [];
38500
+ for (const i2 of this.#indexes({ allowStale: true })) {
38501
+ const key2 = this.#keyList[i2];
38502
+ const v = this.#valList[i2];
38503
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
38504
+ if (value2 === undefined || key2 === undefined)
36622
38505
  continue;
38506
+ const entry = { value: value2 };
38507
+ if (this.#ttls && this.#starts) {
38508
+ entry.ttl = this.#ttls[i2];
38509
+ const age = perf2.now() - this.#starts[i2];
38510
+ entry.start = Math.floor(Date.now() - age);
36623
38511
  }
36624
- p = out[section] = out[section] || Object.create(null);
36625
- continue;
38512
+ if (this.#sizes) {
38513
+ entry.size = this.#sizes[i2];
38514
+ }
38515
+ arr.unshift([key2, entry]);
36626
38516
  }
36627
- const keyRaw = unsafe(match2[2]);
36628
- let isArray;
36629
- if (opt.bracketedArray) {
36630
- isArray = keyRaw.length > 2 && keyRaw.slice(-2) === "[]";
36631
- } else {
36632
- duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1;
36633
- isArray = duplicates[keyRaw] > 1;
38517
+ return arr;
38518
+ }
38519
+ load(arr) {
38520
+ this.clear();
38521
+ for (const [key2, entry] of arr) {
38522
+ if (entry.start) {
38523
+ const age = Date.now() - entry.start;
38524
+ entry.start = perf2.now() - age;
38525
+ }
38526
+ this.set(key2, entry.value, entry);
36634
38527
  }
36635
- const key2 = isArray && keyRaw.endsWith("[]") ? keyRaw.slice(0, -2) : keyRaw;
36636
- if (key2 === "__proto__") {
36637
- continue;
38528
+ }
38529
+ set(k, v, setOptions = {}) {
38530
+ if (v === undefined) {
38531
+ this.delete(k);
38532
+ return this;
36638
38533
  }
36639
- const valueRaw = match2[3] ? unsafe(match2[4]) : true;
36640
- const value2 = valueRaw === "true" || valueRaw === "false" || valueRaw === "null" ? JSON.parse(valueRaw) : valueRaw;
36641
- if (isArray) {
36642
- if (!hasOwnProperty.call(p, key2)) {
36643
- p[key2] = [];
36644
- } else if (!Array.isArray(p[key2])) {
36645
- p[key2] = [p[key2]];
38534
+ const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
38535
+ let { noUpdateTTL = this.noUpdateTTL } = setOptions;
38536
+ const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
38537
+ if (this.maxEntrySize && size > this.maxEntrySize) {
38538
+ if (status) {
38539
+ status.set = "miss";
38540
+ status.maxEntrySizeExceeded = true;
36646
38541
  }
38542
+ this.#delete(k, "set");
38543
+ return this;
36647
38544
  }
36648
- if (Array.isArray(p[key2])) {
36649
- p[key2].push(value2);
38545
+ let index = this.#size === 0 ? undefined : this.#keyMap.get(k);
38546
+ if (index === undefined) {
38547
+ index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
38548
+ this.#keyList[index] = k;
38549
+ this.#valList[index] = v;
38550
+ this.#keyMap.set(k, index);
38551
+ this.#next[this.#tail] = index;
38552
+ this.#prev[index] = this.#tail;
38553
+ this.#tail = index;
38554
+ this.#size++;
38555
+ this.#addItemSize(index, size, status);
38556
+ if (status)
38557
+ status.set = "add";
38558
+ noUpdateTTL = false;
36650
38559
  } else {
36651
- p[key2] = value2;
38560
+ this.#moveToTail(index);
38561
+ const oldVal = this.#valList[index];
38562
+ if (v !== oldVal) {
38563
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
38564
+ oldVal.__abortController.abort(new Error("replaced"));
38565
+ const { __staleWhileFetching: s } = oldVal;
38566
+ if (s !== undefined && !noDisposeOnSet) {
38567
+ if (this.#hasDispose) {
38568
+ this.#dispose?.(s, k, "set");
38569
+ }
38570
+ if (this.#hasDisposeAfter) {
38571
+ this.#disposed?.push([s, k, "set"]);
38572
+ }
38573
+ }
38574
+ } else if (!noDisposeOnSet) {
38575
+ if (this.#hasDispose) {
38576
+ this.#dispose?.(oldVal, k, "set");
38577
+ }
38578
+ if (this.#hasDisposeAfter) {
38579
+ this.#disposed?.push([oldVal, k, "set"]);
38580
+ }
38581
+ }
38582
+ this.#removeItemSize(index);
38583
+ this.#addItemSize(index, size, status);
38584
+ this.#valList[index] = v;
38585
+ if (status) {
38586
+ status.set = "replace";
38587
+ const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
38588
+ if (oldValue !== undefined)
38589
+ status.oldValue = oldValue;
38590
+ }
38591
+ } else if (status) {
38592
+ status.set = "update";
38593
+ }
38594
+ }
38595
+ if (ttl !== 0 && !this.#ttls) {
38596
+ this.#initializeTTLTracking();
38597
+ }
38598
+ if (this.#ttls) {
38599
+ if (!noUpdateTTL) {
38600
+ this.#setItemTTL(index, ttl, start);
38601
+ }
38602
+ if (status)
38603
+ this.#statusTTL(status, index);
38604
+ }
38605
+ if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
38606
+ const dt2 = this.#disposed;
38607
+ let task;
38608
+ while (task = dt2?.shift()) {
38609
+ this.#disposeAfter?.(...task);
38610
+ }
36652
38611
  }
38612
+ return this;
36653
38613
  }
36654
- const remove = [];
36655
- for (const k of Object.keys(out)) {
36656
- if (!hasOwnProperty.call(out, k) || typeof out[k] !== "object" || Array.isArray(out[k])) {
36657
- continue;
38614
+ pop() {
38615
+ try {
38616
+ while (this.#size) {
38617
+ const val = this.#valList[this.#head];
38618
+ this.#evict(true);
38619
+ if (this.#isBackgroundFetch(val)) {
38620
+ if (val.__staleWhileFetching) {
38621
+ return val.__staleWhileFetching;
38622
+ }
38623
+ } else if (val !== undefined) {
38624
+ return val;
38625
+ }
38626
+ }
38627
+ } finally {
38628
+ if (this.#hasDisposeAfter && this.#disposed) {
38629
+ const dt2 = this.#disposed;
38630
+ let task;
38631
+ while (task = dt2?.shift()) {
38632
+ this.#disposeAfter?.(...task);
38633
+ }
38634
+ }
36658
38635
  }
36659
- const parts = splitSections(k, ".");
36660
- p = out;
36661
- const l2 = parts.pop();
36662
- const nl = l2.replace(/\\\./g, ".");
36663
- for (const part of parts) {
36664
- if (part === "__proto__") {
36665
- continue;
38636
+ }
38637
+ #evict(free) {
38638
+ const head = this.#head;
38639
+ const k = this.#keyList[head];
38640
+ const v = this.#valList[head];
38641
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
38642
+ v.__abortController.abort(new Error("evicted"));
38643
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
38644
+ if (this.#hasDispose) {
38645
+ this.#dispose?.(v, k, "evict");
36666
38646
  }
36667
- if (!hasOwnProperty.call(p, part) || typeof p[part] !== "object") {
36668
- p[part] = Object.create(null);
38647
+ if (this.#hasDisposeAfter) {
38648
+ this.#disposed?.push([v, k, "evict"]);
36669
38649
  }
36670
- p = p[part];
36671
38650
  }
36672
- if (p === out && nl === l2) {
36673
- continue;
38651
+ this.#removeItemSize(head);
38652
+ if (free) {
38653
+ this.#keyList[head] = undefined;
38654
+ this.#valList[head] = undefined;
38655
+ this.#free.push(head);
36674
38656
  }
36675
- p[nl] = out[k];
36676
- remove.push(k);
38657
+ if (this.#size === 1) {
38658
+ this.#head = this.#tail = 0;
38659
+ this.#free.length = 0;
38660
+ } else {
38661
+ this.#head = this.#next[head];
38662
+ }
38663
+ this.#keyMap.delete(k);
38664
+ this.#size--;
38665
+ return head;
36677
38666
  }
36678
- for (const del of remove) {
36679
- delete out[del];
38667
+ has(k, hasOptions = {}) {
38668
+ const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
38669
+ const index = this.#keyMap.get(k);
38670
+ if (index !== undefined) {
38671
+ const v = this.#valList[index];
38672
+ if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === undefined) {
38673
+ return false;
38674
+ }
38675
+ if (!this.#isStale(index)) {
38676
+ if (updateAgeOnHas) {
38677
+ this.#updateItemAge(index);
38678
+ }
38679
+ if (status) {
38680
+ status.has = "hit";
38681
+ this.#statusTTL(status, index);
38682
+ }
38683
+ return true;
38684
+ } else if (status) {
38685
+ status.has = "stale";
38686
+ this.#statusTTL(status, index);
38687
+ }
38688
+ } else if (status) {
38689
+ status.has = "miss";
38690
+ }
38691
+ return false;
36680
38692
  }
36681
- return out;
36682
- };
36683
- var isQuoted = (val) => {
36684
- return val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'");
36685
- };
36686
- var safe = (val) => {
36687
- if (typeof val !== "string" || val.match(/[=\r\n]/) || val.match(/^\[/) || val.length > 1 && isQuoted(val) || val !== val.trim()) {
36688
- return JSON.stringify(val);
38693
+ peek(k, peekOptions = {}) {
38694
+ const { allowStale = this.allowStale } = peekOptions;
38695
+ const index = this.#keyMap.get(k);
38696
+ if (index === undefined || !allowStale && this.#isStale(index)) {
38697
+ return;
38698
+ }
38699
+ const v = this.#valList[index];
38700
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
36689
38701
  }
36690
- return val.split(";").join("\\;").split("#").join("\\#");
36691
- };
36692
- var unsafe = (val) => {
36693
- val = (val || "").trim();
36694
- if (isQuoted(val)) {
36695
- if (val.charAt(0) === "'") {
36696
- val = val.slice(1, -1);
38702
+ #backgroundFetch(k, index, options, context) {
38703
+ const v = index === undefined ? undefined : this.#valList[index];
38704
+ if (this.#isBackgroundFetch(v)) {
38705
+ return v;
36697
38706
  }
36698
- try {
36699
- val = JSON.parse(val);
36700
- } catch {}
36701
- } else {
36702
- let esc = false;
36703
- let unesc = "";
36704
- for (let i2 = 0, l2 = val.length;i2 < l2; i2++) {
36705
- const c = val.charAt(i2);
36706
- if (esc) {
36707
- if ("\\;#".indexOf(c) !== -1) {
36708
- unesc += c;
38707
+ const ac = new AC2;
38708
+ const { signal } = options;
38709
+ signal?.addEventListener("abort", () => ac.abort(signal.reason), {
38710
+ signal: ac.signal
38711
+ });
38712
+ const fetchOpts = {
38713
+ signal: ac.signal,
38714
+ options,
38715
+ context
38716
+ };
38717
+ const cb = (v2, updateCache = false) => {
38718
+ const { aborted } = ac.signal;
38719
+ const ignoreAbort = options.ignoreFetchAbort && v2 !== undefined;
38720
+ if (options.status) {
38721
+ if (aborted && !updateCache) {
38722
+ options.status.fetchAborted = true;
38723
+ options.status.fetchError = ac.signal.reason;
38724
+ if (ignoreAbort)
38725
+ options.status.fetchAbortIgnored = true;
36709
38726
  } else {
36710
- unesc += "\\" + c;
38727
+ options.status.fetchResolved = true;
36711
38728
  }
36712
- esc = false;
36713
- } else if (";#".indexOf(c) !== -1) {
36714
- break;
36715
- } else if (c === "\\") {
36716
- esc = true;
36717
- } else {
36718
- unesc += c;
36719
38729
  }
38730
+ if (aborted && !ignoreAbort && !updateCache) {
38731
+ return fetchFail(ac.signal.reason);
38732
+ }
38733
+ const bf2 = p;
38734
+ if (this.#valList[index] === p) {
38735
+ if (v2 === undefined) {
38736
+ if (bf2.__staleWhileFetching) {
38737
+ this.#valList[index] = bf2.__staleWhileFetching;
38738
+ } else {
38739
+ this.#delete(k, "fetch");
38740
+ }
38741
+ } else {
38742
+ if (options.status)
38743
+ options.status.fetchUpdated = true;
38744
+ this.set(k, v2, fetchOpts.options);
38745
+ }
38746
+ }
38747
+ return v2;
38748
+ };
38749
+ const eb = (er) => {
38750
+ if (options.status) {
38751
+ options.status.fetchRejected = true;
38752
+ options.status.fetchError = er;
38753
+ }
38754
+ return fetchFail(er);
38755
+ };
38756
+ const fetchFail = (er) => {
38757
+ const { aborted } = ac.signal;
38758
+ const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
38759
+ const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
38760
+ const noDelete = allowStale || options.noDeleteOnFetchRejection;
38761
+ const bf2 = p;
38762
+ if (this.#valList[index] === p) {
38763
+ const del = !noDelete || bf2.__staleWhileFetching === undefined;
38764
+ if (del) {
38765
+ this.#delete(k, "fetch");
38766
+ } else if (!allowStaleAborted) {
38767
+ this.#valList[index] = bf2.__staleWhileFetching;
38768
+ }
38769
+ }
38770
+ if (allowStale) {
38771
+ if (options.status && bf2.__staleWhileFetching !== undefined) {
38772
+ options.status.returnedStale = true;
38773
+ }
38774
+ return bf2.__staleWhileFetching;
38775
+ } else if (bf2.__returned === bf2) {
38776
+ throw er;
38777
+ }
38778
+ };
38779
+ const pcall = (res, rej) => {
38780
+ const fmp = this.#fetchMethod?.(k, v, fetchOpts);
38781
+ if (fmp && fmp instanceof Promise) {
38782
+ fmp.then((v2) => res(v2 === undefined ? undefined : v2), rej);
38783
+ }
38784
+ ac.signal.addEventListener("abort", () => {
38785
+ if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
38786
+ res(undefined);
38787
+ if (options.allowStaleOnFetchAbort) {
38788
+ res = (v2) => cb(v2, true);
38789
+ }
38790
+ }
38791
+ });
38792
+ };
38793
+ if (options.status)
38794
+ options.status.fetchDispatched = true;
38795
+ const p = new Promise(pcall).then(cb, eb);
38796
+ const bf = Object.assign(p, {
38797
+ __abortController: ac,
38798
+ __staleWhileFetching: v,
38799
+ __returned: undefined
38800
+ });
38801
+ if (index === undefined) {
38802
+ this.set(k, bf, { ...fetchOpts.options, status: undefined });
38803
+ index = this.#keyMap.get(k);
38804
+ } else {
38805
+ this.#valList[index] = bf;
36720
38806
  }
36721
- if (esc) {
36722
- unesc += "\\";
38807
+ return bf;
38808
+ }
38809
+ #isBackgroundFetch(p) {
38810
+ if (!this.#hasFetchMethod)
38811
+ return false;
38812
+ const b = p;
38813
+ return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC2;
38814
+ }
38815
+ async fetch(k, fetchOptions = {}) {
38816
+ const {
38817
+ allowStale = this.allowStale,
38818
+ updateAgeOnGet = this.updateAgeOnGet,
38819
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
38820
+ ttl = this.ttl,
38821
+ noDisposeOnSet = this.noDisposeOnSet,
38822
+ size = 0,
38823
+ sizeCalculation = this.sizeCalculation,
38824
+ noUpdateTTL = this.noUpdateTTL,
38825
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
38826
+ allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
38827
+ ignoreFetchAbort = this.ignoreFetchAbort,
38828
+ allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
38829
+ context,
38830
+ forceRefresh = false,
38831
+ status,
38832
+ signal
38833
+ } = fetchOptions;
38834
+ if (!this.#hasFetchMethod) {
38835
+ if (status)
38836
+ status.fetch = "get";
38837
+ return this.get(k, {
38838
+ allowStale,
38839
+ updateAgeOnGet,
38840
+ noDeleteOnStaleGet,
38841
+ status
38842
+ });
38843
+ }
38844
+ const options = {
38845
+ allowStale,
38846
+ updateAgeOnGet,
38847
+ noDeleteOnStaleGet,
38848
+ ttl,
38849
+ noDisposeOnSet,
38850
+ size,
38851
+ sizeCalculation,
38852
+ noUpdateTTL,
38853
+ noDeleteOnFetchRejection,
38854
+ allowStaleOnFetchRejection,
38855
+ allowStaleOnFetchAbort,
38856
+ ignoreFetchAbort,
38857
+ status,
38858
+ signal
38859
+ };
38860
+ let index = this.#keyMap.get(k);
38861
+ if (index === undefined) {
38862
+ if (status)
38863
+ status.fetch = "miss";
38864
+ const p = this.#backgroundFetch(k, index, options, context);
38865
+ return p.__returned = p;
38866
+ } else {
38867
+ const v = this.#valList[index];
38868
+ if (this.#isBackgroundFetch(v)) {
38869
+ const stale = allowStale && v.__staleWhileFetching !== undefined;
38870
+ if (status) {
38871
+ status.fetch = "inflight";
38872
+ if (stale)
38873
+ status.returnedStale = true;
38874
+ }
38875
+ return stale ? v.__staleWhileFetching : v.__returned = v;
38876
+ }
38877
+ const isStale = this.#isStale(index);
38878
+ if (!forceRefresh && !isStale) {
38879
+ if (status)
38880
+ status.fetch = "hit";
38881
+ this.#moveToTail(index);
38882
+ if (updateAgeOnGet) {
38883
+ this.#updateItemAge(index);
38884
+ }
38885
+ if (status)
38886
+ this.#statusTTL(status, index);
38887
+ return v;
38888
+ }
38889
+ const p = this.#backgroundFetch(k, index, options, context);
38890
+ const hasStale = p.__staleWhileFetching !== undefined;
38891
+ const staleVal = hasStale && allowStale;
38892
+ if (status) {
38893
+ status.fetch = isStale ? "stale" : "refresh";
38894
+ if (staleVal && isStale)
38895
+ status.returnedStale = true;
38896
+ }
38897
+ return staleVal ? p.__staleWhileFetching : p.__returned = p;
36723
38898
  }
36724
- return unesc.trim();
36725
38899
  }
36726
- return val;
36727
- };
36728
- module.exports = {
36729
- parse: decode,
36730
- decode,
36731
- stringify: encode,
36732
- encode,
36733
- safe,
36734
- unsafe
36735
- };
36736
- });
36737
-
36738
- // ../../node_modules/@npmcli/git/lib/opts.js
36739
- var require_opts = __commonJS((exports, module) => {
36740
- var fs4 = __require("node:fs");
36741
- var os = __require("node:os");
36742
- var path6 = __require("node:path");
36743
- var ini = require_ini();
36744
- var gitConfigPath = path6.join(os.homedir(), ".gitconfig");
36745
- var cachedConfig = null;
36746
- var loadGitConfig = () => {
36747
- if (cachedConfig === null) {
36748
- try {
36749
- cachedConfig = {};
36750
- if (fs4.existsSync(gitConfigPath)) {
36751
- const configContent = fs4.readFileSync(gitConfigPath, "utf-8");
36752
- cachedConfig = ini.parse(configContent);
38900
+ async forceFetch(k, fetchOptions = {}) {
38901
+ const v = await this.fetch(k, fetchOptions);
38902
+ if (v === undefined)
38903
+ throw new Error("fetch() returned undefined");
38904
+ return v;
38905
+ }
38906
+ memo(k, memoOptions = {}) {
38907
+ const memoMethod = this.#memoMethod;
38908
+ if (!memoMethod) {
38909
+ throw new Error("no memoMethod provided to constructor");
38910
+ }
38911
+ const { context, forceRefresh, ...options } = memoOptions;
38912
+ const v = this.get(k, options);
38913
+ if (!forceRefresh && v !== undefined)
38914
+ return v;
38915
+ const vv = memoMethod(k, v, {
38916
+ options,
38917
+ context
38918
+ });
38919
+ this.set(k, vv, options);
38920
+ return vv;
38921
+ }
38922
+ get(k, getOptions = {}) {
38923
+ const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
38924
+ const index = this.#keyMap.get(k);
38925
+ if (index !== undefined) {
38926
+ const value2 = this.#valList[index];
38927
+ const fetching = this.#isBackgroundFetch(value2);
38928
+ if (status)
38929
+ this.#statusTTL(status, index);
38930
+ if (this.#isStale(index)) {
38931
+ if (status)
38932
+ status.get = "stale";
38933
+ if (!fetching) {
38934
+ if (!noDeleteOnStaleGet) {
38935
+ this.#delete(k, "expire");
38936
+ }
38937
+ if (status && allowStale)
38938
+ status.returnedStale = true;
38939
+ return allowStale ? value2 : undefined;
38940
+ } else {
38941
+ if (status && allowStale && value2.__staleWhileFetching !== undefined) {
38942
+ status.returnedStale = true;
38943
+ }
38944
+ return allowStale ? value2.__staleWhileFetching : undefined;
38945
+ }
38946
+ } else {
38947
+ if (status)
38948
+ status.get = "hit";
38949
+ if (fetching) {
38950
+ return value2.__staleWhileFetching;
38951
+ }
38952
+ this.#moveToTail(index);
38953
+ if (updateAgeOnGet) {
38954
+ this.#updateItemAge(index);
38955
+ }
38956
+ return value2;
36753
38957
  }
36754
- } catch (error2) {
36755
- cachedConfig = {};
38958
+ } else if (status) {
38959
+ status.get = "miss";
36756
38960
  }
36757
38961
  }
36758
- return cachedConfig;
36759
- };
36760
- var checkGitConfigs = () => {
36761
- const config3 = loadGitConfig();
36762
- return {
36763
- sshCommandSetInConfig: config3?.core?.sshCommand !== undefined,
36764
- askPassSetInConfig: config3?.core?.askpass !== undefined
36765
- };
36766
- };
36767
- var sshCommandSetInEnv = process.env.GIT_SSH_COMMAND !== undefined;
36768
- var askPassSetInEnv = process.env.GIT_ASKPASS !== undefined;
36769
- var { sshCommandSetInConfig, askPassSetInConfig } = checkGitConfigs();
36770
- var finalGitEnv = {
36771
- ...askPassSetInEnv || askPassSetInConfig ? {} : {
36772
- GIT_ASKPASS: "echo"
36773
- },
36774
- ...sshCommandSetInEnv || sshCommandSetInConfig ? {} : {
36775
- GIT_SSH_COMMAND: "ssh -oStrictHostKeyChecking=accept-new"
38962
+ #connect(p, n2) {
38963
+ this.#prev[n2] = p;
38964
+ this.#next[p] = n2;
36776
38965
  }
36777
- };
36778
- module.exports = (opts = {}) => ({
36779
- stdioString: true,
36780
- ...opts,
36781
- shell: false,
36782
- env: opts.env || { ...finalGitEnv, ...process.env }
36783
- });
36784
- module.exports.loadGitConfig = loadGitConfig;
36785
- });
36786
-
36787
- // ../../node_modules/@npmcli/git/lib/which.js
36788
- var require_which = __commonJS((exports, module) => {
36789
- var which = require_lib5();
36790
- var gitPath;
36791
- try {
36792
- gitPath = which.sync("git");
36793
- } catch {}
36794
- module.exports = (opts = {}) => {
36795
- if (opts.git) {
36796
- return opts.git;
38966
+ #moveToTail(index) {
38967
+ if (index !== this.#tail) {
38968
+ if (index === this.#head) {
38969
+ this.#head = this.#next[index];
38970
+ } else {
38971
+ this.#connect(this.#prev[index], this.#next[index]);
38972
+ }
38973
+ this.#connect(this.#tail, index);
38974
+ this.#tail = index;
38975
+ }
36797
38976
  }
36798
- if (!gitPath || opts.git === false) {
36799
- return Object.assign(new Error("No git binary found in $PATH"), { code: "ENOGIT" });
38977
+ delete(k) {
38978
+ return this.#delete(k, "delete");
36800
38979
  }
36801
- return gitPath;
36802
- };
36803
- });
36804
-
36805
- // ../../node_modules/@npmcli/git/lib/spawn.js
36806
- var require_spawn = __commonJS((exports, module) => {
36807
- var spawn2 = require_lib6();
36808
- var promiseRetry = require_promise_retry();
36809
- var { log } = require_lib3();
36810
- var makeError = require_make_error();
36811
- var makeOpts = require_opts();
36812
- module.exports = (gitArgs, opts = {}) => {
36813
- const whichGit = require_which();
36814
- const gitPath = whichGit(opts);
36815
- if (gitPath instanceof Error) {
36816
- return Promise.reject(gitPath);
38980
+ #delete(k, reason) {
38981
+ let deleted = false;
38982
+ if (this.#size !== 0) {
38983
+ const index = this.#keyMap.get(k);
38984
+ if (index !== undefined) {
38985
+ deleted = true;
38986
+ if (this.#size === 1) {
38987
+ this.#clear(reason);
38988
+ } else {
38989
+ this.#removeItemSize(index);
38990
+ const v = this.#valList[index];
38991
+ if (this.#isBackgroundFetch(v)) {
38992
+ v.__abortController.abort(new Error("deleted"));
38993
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
38994
+ if (this.#hasDispose) {
38995
+ this.#dispose?.(v, k, reason);
38996
+ }
38997
+ if (this.#hasDisposeAfter) {
38998
+ this.#disposed?.push([v, k, reason]);
38999
+ }
39000
+ }
39001
+ this.#keyMap.delete(k);
39002
+ this.#keyList[index] = undefined;
39003
+ this.#valList[index] = undefined;
39004
+ if (index === this.#tail) {
39005
+ this.#tail = this.#prev[index];
39006
+ } else if (index === this.#head) {
39007
+ this.#head = this.#next[index];
39008
+ } else {
39009
+ const pi = this.#prev[index];
39010
+ this.#next[pi] = this.#next[index];
39011
+ const ni = this.#next[index];
39012
+ this.#prev[ni] = this.#prev[index];
39013
+ }
39014
+ this.#size--;
39015
+ this.#free.push(index);
39016
+ }
39017
+ }
39018
+ }
39019
+ if (this.#hasDisposeAfter && this.#disposed?.length) {
39020
+ const dt2 = this.#disposed;
39021
+ let task;
39022
+ while (task = dt2?.shift()) {
39023
+ this.#disposeAfter?.(...task);
39024
+ }
39025
+ }
39026
+ return deleted;
36817
39027
  }
36818
- const args = opts.allowReplace || gitArgs[0] === "--no-replace-objects" ? gitArgs : ["--no-replace-objects", ...gitArgs];
36819
- let retryOpts = opts.retry;
36820
- if (retryOpts === null || retryOpts === undefined) {
36821
- retryOpts = {
36822
- retries: opts.fetchRetries || 2,
36823
- factor: opts.fetchRetryFactor || 10,
36824
- maxTimeout: opts.fetchRetryMaxtimeout || 60000,
36825
- minTimeout: opts.fetchRetryMintimeout || 1000
36826
- };
39028
+ clear() {
39029
+ return this.#clear("delete");
36827
39030
  }
36828
- return promiseRetry((retryFn, number) => {
36829
- if (number !== 1) {
36830
- log.silly("git", `Retrying git command: ${args.join(" ")} attempt # ${number}`);
39031
+ #clear(reason) {
39032
+ for (const index of this.#rindexes({ allowStale: true })) {
39033
+ const v = this.#valList[index];
39034
+ if (this.#isBackgroundFetch(v)) {
39035
+ v.__abortController.abort(new Error("deleted"));
39036
+ } else {
39037
+ const k = this.#keyList[index];
39038
+ if (this.#hasDispose) {
39039
+ this.#dispose?.(v, k, reason);
39040
+ }
39041
+ if (this.#hasDisposeAfter) {
39042
+ this.#disposed?.push([v, k, reason]);
39043
+ }
39044
+ }
36831
39045
  }
36832
- return spawn2(gitPath, args, makeOpts(opts)).catch((er) => {
36833
- const gitError = makeError(er);
36834
- if (!gitError.shouldRetry(number)) {
36835
- throw gitError;
39046
+ this.#keyMap.clear();
39047
+ this.#valList.fill(undefined);
39048
+ this.#keyList.fill(undefined);
39049
+ if (this.#ttls && this.#starts) {
39050
+ this.#ttls.fill(0);
39051
+ this.#starts.fill(0);
39052
+ }
39053
+ if (this.#sizes) {
39054
+ this.#sizes.fill(0);
39055
+ }
39056
+ this.#head = 0;
39057
+ this.#tail = 0;
39058
+ this.#free.length = 0;
39059
+ this.#calculatedSize = 0;
39060
+ this.#size = 0;
39061
+ if (this.#hasDisposeAfter && this.#disposed) {
39062
+ const dt2 = this.#disposed;
39063
+ let task;
39064
+ while (task = dt2?.shift()) {
39065
+ this.#disposeAfter?.(...task);
36836
39066
  }
36837
- retryFn(gitError);
36838
- });
36839
- }, retryOpts);
36840
- };
39067
+ }
39068
+ }
39069
+ }
39070
+ exports.LRUCache = LRUCache2;
36841
39071
  });
36842
39072
 
36843
39073
  // ../../node_modules/semver/functions/inc.js
@@ -38266,7 +40496,7 @@ var require_lines_to_revs = __commonJS((exports, module) => {
38266
40496
  // ../../node_modules/@npmcli/git/lib/revs.js
38267
40497
  var require_revs = __commonJS((exports, module) => {
38268
40498
  var spawn2 = require_spawn();
38269
- var { LRUCache: LRUCache2 } = require_commonjs();
40499
+ var { LRUCache: LRUCache2 } = require_commonjs7();
38270
40500
  var linesToRevs = require_lines_to_revs();
38271
40501
  var revsCache = new LRUCache2({
38272
40502
  max: 100,
@@ -41007,7 +43237,7 @@ var require_normalize = __commonJS((exports, module) => {
41007
43237
  var _glob;
41008
43238
  function lazyLoadGlob() {
41009
43239
  if (!_glob) {
41010
- _glob = require_commonjs5().glob;
43240
+ _glob = require_commonjs6().glob;
41011
43241
  }
41012
43242
  return _glob;
41013
43243
  }
@@ -240787,7 +243017,7 @@ minimatch.unescape = unescape2;
240787
243017
  // ../../node_modules/glob/dist/esm/glob.js
240788
243018
  import { fileURLToPath as fileURLToPath4 } from "node:url";
240789
243019
 
240790
- // ../../node_modules/lru-cache/dist/esm/index.js
243020
+ // ../../node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js
240791
243021
  var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
240792
243022
  var warned = new Set;
240793
243023
  var PROCESS = typeof process === "object" && !!process ? process : {};
@@ -245345,7 +247575,7 @@ function pruneCurrentEnv(currentEnv, env2) {
245345
247575
  var package_default = {
245346
247576
  name: "@settlemint/sdk-cli",
245347
247577
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
245348
- version: "2.2.3-mainfc7ba876",
247578
+ version: "2.2.3-mainfd2a5bd3",
245349
247579
  type: "module",
245350
247580
  private: false,
245351
247581
  license: "FSL-1.1-MIT",
@@ -245390,13 +247620,13 @@ var package_default = {
245390
247620
  devDependencies: {
245391
247621
  "@commander-js/extra-typings": "11.1.0",
245392
247622
  commander: "11.1.0",
245393
- "@inquirer/confirm": "5.1.9",
245394
- "@inquirer/input": "4.1.9",
245395
- "@inquirer/password": "4.0.12",
245396
- "@inquirer/select": "4.2.0",
245397
- "@settlemint/sdk-js": "2.2.3-mainfc7ba876",
245398
- "@settlemint/sdk-utils": "2.2.3-mainfc7ba876",
245399
- "@types/node": "22.15.14",
247623
+ "@inquirer/confirm": "5.1.10",
247624
+ "@inquirer/input": "4.1.10",
247625
+ "@inquirer/password": "4.0.13",
247626
+ "@inquirer/select": "4.2.1",
247627
+ "@settlemint/sdk-js": "2.2.3-mainfd2a5bd3",
247628
+ "@settlemint/sdk-utils": "2.2.3-mainfd2a5bd3",
247629
+ "@types/node": "22.15.17",
245400
247630
  "@types/semver": "7.7.0",
245401
247631
  "@types/which": "3.0.4",
245402
247632
  "get-tsconfig": "4.10.0",
@@ -245409,7 +247639,7 @@ var package_default = {
245409
247639
  yoctocolors: "2.1.1"
245410
247640
  },
245411
247641
  peerDependencies: {
245412
- hardhat: "2.23.0"
247642
+ hardhat: "2.24.0"
245413
247643
  },
245414
247644
  peerDependenciesMeta: {
245415
247645
  hardhat: {
@@ -246497,6 +248727,9 @@ function createPrompt(view) {
246497
248727
  cleanups.add(onExit((code, signal2) => {
246498
248728
  reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
246499
248729
  }));
248730
+ const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
248731
+ rl.on("SIGINT", sigint);
248732
+ cleanups.add(() => rl.removeListener("SIGINT", sigint));
246500
248733
  const checkCursorPos = () => screen.checkCursorPos();
246501
248734
  rl.input.on("keypress", checkCursorPos);
246502
248735
  cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
@@ -260710,4 +262943,4 @@ async function sdkCliCommand(argv = process.argv) {
260710
262943
  // src/cli.ts
260711
262944
  sdkCliCommand();
260712
262945
 
260713
- //# debugId=DE8B481B337FE56664756E2164756E21
262946
+ //# debugId=9651AC7E1541E80A64756E2164756E21