@vue/compiler-sfc 3.6.0-rc.10 → 3.6.0-rc.12

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.6.0-rc.10
2
+ * @vue/compiler-sfc v3.6.0-rc.12
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -264,77 +264,7 @@ function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd, defaultVar) {
264
264
  return `\nimport { ${CSS_VARS_HELPER} as _${CSS_VARS_HELPER} } from 'vue'\nconst __injectCSSVars__ = () => {\n${genCssVarsCode(cssVars, bindings, id, isProd)}}\nconst __setup__ = ${defaultVar}.setup\n${defaultVar}.setup = __setup__\n ? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }\n : __injectCSSVars__\n`;
265
265
  }
266
266
  //#endregion
267
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/typeof.js
268
- function _typeof(o) {
269
- "@babel/helpers - typeof";
270
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
271
- return typeof o;
272
- } : function(o) {
273
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
274
- }, _typeof(o);
275
- }
276
- //#endregion
277
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/toPrimitive.js
278
- function toPrimitive(t, r) {
279
- if ("object" != _typeof(t) || !t) return t;
280
- var e = t[Symbol.toPrimitive];
281
- if (void 0 !== e) {
282
- var i = e.call(t, r || "default");
283
- if ("object" != _typeof(i)) return i;
284
- throw new TypeError("@@toPrimitive must return a primitive value.");
285
- }
286
- return ("string" === r ? String : Number)(t);
287
- }
288
- //#endregion
289
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/toPropertyKey.js
290
- function toPropertyKey(t) {
291
- var i = toPrimitive(t, "string");
292
- return "symbol" == _typeof(i) ? i : i + "";
293
- }
294
- //#endregion
295
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/defineProperty.js
296
- function _defineProperty(e, r, t) {
297
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
298
- value: t,
299
- enumerable: !0,
300
- configurable: !0,
301
- writable: !0
302
- }) : e[r] = t, e;
303
- }
304
- //#endregion
305
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/checkPrivateRedeclaration.js
306
- function _checkPrivateRedeclaration(e, t) {
307
- if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
308
- }
309
- //#endregion
310
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/classPrivateMethodInitSpec.js
311
- function _classPrivateMethodInitSpec(e, a) {
312
- _checkPrivateRedeclaration(e, a), a.add(e);
313
- }
314
- //#endregion
315
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/classPrivateFieldInitSpec.js
316
- function _classPrivateFieldInitSpec(e, t, a) {
317
- _checkPrivateRedeclaration(e, t), t.set(e, a);
318
- }
319
- //#endregion
320
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/assertClassBrand.js
321
- function _assertClassBrand(e, t, n) {
322
- if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
323
- throw new TypeError("Private element is not present on this object");
324
- }
325
- //#endregion
326
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/classPrivateFieldGet2.js
327
- function _classPrivateFieldGet2(s, a) {
328
- return s.get(_assertClassBrand(s, a));
329
- }
330
- //#endregion
331
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/classPrivateFieldSet2.js
332
- function _classPrivateFieldSet2(s, a, r) {
333
- return s.set(_assertClassBrand(s, a), r), r;
334
- }
335
- //#endregion
336
267
  //#region node_modules/.pnpm/lru-cache@10.1.0/node_modules/lru-cache/dist/esm/index.js
337
- let _Symbol$iterator;
338
268
  /**
339
269
  * @module LRUCache
340
270
  */
@@ -350,33 +280,29 @@ let AC = globalThis.AbortController;
350
280
  let AS = globalThis.AbortSignal;
351
281
  /* c8 ignore start */
352
282
  if (typeof AC === "undefined") {
353
- var _PROCESS$env;
354
283
  AS = class AbortSignal {
355
- constructor() {
356
- _defineProperty(this, "onabort", void 0);
357
- _defineProperty(this, "_onabort", []);
358
- _defineProperty(this, "reason", void 0);
359
- _defineProperty(this, "aborted", false);
360
- }
284
+ onabort;
285
+ _onabort = [];
286
+ reason;
287
+ aborted = false;
361
288
  addEventListener(_, fn) {
362
289
  this._onabort.push(fn);
363
290
  }
364
291
  };
365
292
  AC = class AbortController {
366
293
  constructor() {
367
- _defineProperty(this, "signal", new AS());
368
294
  warnACPolyfill();
369
295
  }
296
+ signal = new AS();
370
297
  abort(reason) {
371
- var _this$signal$onabort, _this$signal;
372
298
  if (this.signal.aborted) return;
373
299
  this.signal.reason = reason;
374
300
  this.signal.aborted = true;
375
301
  for (const fn of this.signal._onabort) fn(reason);
376
- (_this$signal$onabort = (_this$signal = this.signal).onabort) === null || _this$signal$onabort === void 0 || _this$signal$onabort.call(_this$signal, reason);
302
+ this.signal.onabort?.(reason);
377
303
  }
378
304
  };
379
- let printACPolyfillWarning = ((_PROCESS$env = PROCESS.env) === null || _PROCESS$env === void 0 ? void 0 : _PROCESS$env.LRU_CACHE_IGNORE_AC_WARNING) !== "1";
305
+ let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
380
306
  const warnACPolyfill = () => {
381
307
  if (!printACPolyfillWarning) return;
382
308
  printACPolyfillWarning = false;
@@ -396,19 +322,20 @@ var ZeroArray = class extends Array {
396
322
  }
397
323
  };
398
324
  var Stack = class Stack {
325
+ heap;
326
+ length;
327
+ static #constructing = false;
399
328
  static create(max) {
400
329
  const HeapCls = getUintArray(max);
401
330
  if (!HeapCls) return [];
402
- _constructing._ = true;
331
+ Stack.#constructing = true;
403
332
  const s = new Stack(max, HeapCls);
404
- _constructing._ = false;
333
+ Stack.#constructing = false;
405
334
  return s;
406
335
  }
407
336
  constructor(max, HeapCls) {
408
- _defineProperty(this, "heap", void 0);
409
- _defineProperty(this, "length", void 0);
410
337
  /* c8 ignore start */
411
- if (!_constructing._) throw new TypeError("instantiate Stack using Stack.create(n)");
338
+ if (!Stack.#constructing) throw new TypeError("instantiate Stack using Stack.create(n)");
412
339
  /* c8 ignore stop */
413
340
  this.heap = new HeapCls(max);
414
341
  this.length = 0;
@@ -420,38 +347,6 @@ var Stack = class Stack {
420
347
  return this.heap[--this.length];
421
348
  }
422
349
  };
423
- var _constructing = { _: false };
424
- var _max = /* @__PURE__ */ new WeakMap();
425
- var _maxSize = /* @__PURE__ */ new WeakMap();
426
- var _dispose = /* @__PURE__ */ new WeakMap();
427
- var _disposeAfter = /* @__PURE__ */ new WeakMap();
428
- var _fetchMethod = /* @__PURE__ */ new WeakMap();
429
- var _size = /* @__PURE__ */ new WeakMap();
430
- var _calculatedSize = /* @__PURE__ */ new WeakMap();
431
- var _keyMap = /* @__PURE__ */ new WeakMap();
432
- var _keyList = /* @__PURE__ */ new WeakMap();
433
- var _valList = /* @__PURE__ */ new WeakMap();
434
- var _next = /* @__PURE__ */ new WeakMap();
435
- var _prev = /* @__PURE__ */ new WeakMap();
436
- var _head = /* @__PURE__ */ new WeakMap();
437
- var _tail = /* @__PURE__ */ new WeakMap();
438
- var _free = /* @__PURE__ */ new WeakMap();
439
- var _disposed = /* @__PURE__ */ new WeakMap();
440
- var _sizes = /* @__PURE__ */ new WeakMap();
441
- var _starts = /* @__PURE__ */ new WeakMap();
442
- var _ttls = /* @__PURE__ */ new WeakMap();
443
- var _hasDispose = /* @__PURE__ */ new WeakMap();
444
- var _hasFetchMethod = /* @__PURE__ */ new WeakMap();
445
- var _hasDisposeAfter = /* @__PURE__ */ new WeakMap();
446
- var _LRUCache_brand = /* @__PURE__ */ new WeakSet();
447
- var _updateItemAge = /* @__PURE__ */ new WeakMap();
448
- var _statusTTL = /* @__PURE__ */ new WeakMap();
449
- var _setItemTTL = /* @__PURE__ */ new WeakMap();
450
- var _isStale = /* @__PURE__ */ new WeakMap();
451
- var _removeItemSize = /* @__PURE__ */ new WeakMap();
452
- var _addItemSize = /* @__PURE__ */ new WeakMap();
453
- var _requireSize = /* @__PURE__ */ new WeakMap();
454
- _Symbol$iterator = Symbol.iterator;
455
350
  /**
456
351
  * Default export, the thing you're using this module to get.
457
352
  *
@@ -462,6 +357,88 @@ _Symbol$iterator = Symbol.iterator;
462
357
  * but is otherwise safe.
463
358
  */
464
359
  var LRUCache = class LRUCache {
360
+ #max;
361
+ #maxSize;
362
+ #dispose;
363
+ #disposeAfter;
364
+ #fetchMethod;
365
+ /**
366
+ * {@link LRUCache.OptionsBase.ttl}
367
+ */
368
+ ttl;
369
+ /**
370
+ * {@link LRUCache.OptionsBase.ttlResolution}
371
+ */
372
+ ttlResolution;
373
+ /**
374
+ * {@link LRUCache.OptionsBase.ttlAutopurge}
375
+ */
376
+ ttlAutopurge;
377
+ /**
378
+ * {@link LRUCache.OptionsBase.updateAgeOnGet}
379
+ */
380
+ updateAgeOnGet;
381
+ /**
382
+ * {@link LRUCache.OptionsBase.updateAgeOnHas}
383
+ */
384
+ updateAgeOnHas;
385
+ /**
386
+ * {@link LRUCache.OptionsBase.allowStale}
387
+ */
388
+ allowStale;
389
+ /**
390
+ * {@link LRUCache.OptionsBase.noDisposeOnSet}
391
+ */
392
+ noDisposeOnSet;
393
+ /**
394
+ * {@link LRUCache.OptionsBase.noUpdateTTL}
395
+ */
396
+ noUpdateTTL;
397
+ /**
398
+ * {@link LRUCache.OptionsBase.maxEntrySize}
399
+ */
400
+ maxEntrySize;
401
+ /**
402
+ * {@link LRUCache.OptionsBase.sizeCalculation}
403
+ */
404
+ sizeCalculation;
405
+ /**
406
+ * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
407
+ */
408
+ noDeleteOnFetchRejection;
409
+ /**
410
+ * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
411
+ */
412
+ noDeleteOnStaleGet;
413
+ /**
414
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
415
+ */
416
+ allowStaleOnFetchAbort;
417
+ /**
418
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
419
+ */
420
+ allowStaleOnFetchRejection;
421
+ /**
422
+ * {@link LRUCache.OptionsBase.ignoreFetchAbort}
423
+ */
424
+ ignoreFetchAbort;
425
+ #size;
426
+ #calculatedSize;
427
+ #keyMap;
428
+ #keyList;
429
+ #valList;
430
+ #next;
431
+ #prev;
432
+ #head;
433
+ #tail;
434
+ #free;
435
+ #disposed;
436
+ #sizes;
437
+ #starts;
438
+ #ttls;
439
+ #hasDispose;
440
+ #hasFetchMethod;
441
+ #hasDisposeAfter;
465
442
  /**
466
443
  * Do not call this method unless you need to inspect the
467
444
  * inner workings of the cache. If anything returned by this
@@ -473,260 +450,107 @@ var LRUCache = class LRUCache {
473
450
  */
474
451
  static unsafeExposeInternals(c) {
475
452
  return {
476
- starts: _classPrivateFieldGet2(_starts, c),
477
- ttls: _classPrivateFieldGet2(_ttls, c),
478
- sizes: _classPrivateFieldGet2(_sizes, c),
479
- keyMap: _classPrivateFieldGet2(_keyMap, c),
480
- keyList: _classPrivateFieldGet2(_keyList, c),
481
- valList: _classPrivateFieldGet2(_valList, c),
482
- next: _classPrivateFieldGet2(_next, c),
483
- prev: _classPrivateFieldGet2(_prev, c),
453
+ starts: c.#starts,
454
+ ttls: c.#ttls,
455
+ sizes: c.#sizes,
456
+ keyMap: c.#keyMap,
457
+ keyList: c.#keyList,
458
+ valList: c.#valList,
459
+ next: c.#next,
460
+ prev: c.#prev,
484
461
  get head() {
485
- return _classPrivateFieldGet2(_head, c);
462
+ return c.#head;
486
463
  },
487
464
  get tail() {
488
- return _classPrivateFieldGet2(_tail, c);
465
+ return c.#tail;
489
466
  },
490
- free: _classPrivateFieldGet2(_free, c),
491
- isBackgroundFetch: (p) => _assertClassBrand(_LRUCache_brand, c, _isBackgroundFetch).call(c, p),
492
- backgroundFetch: (k, index, options, context) => _assertClassBrand(_LRUCache_brand, c, _backgroundFetch).call(c, k, index, options, context),
493
- moveToTail: (index) => _assertClassBrand(_LRUCache_brand, c, _moveToTail).call(c, index),
494
- indexes: (options) => _assertClassBrand(_LRUCache_brand, c, _indexes).call(c, options),
495
- rindexes: (options) => _assertClassBrand(_LRUCache_brand, c, _rindexes).call(c, options),
496
- isStale: (index) => _classPrivateFieldGet2(_isStale, c).call(c, index)
467
+ free: c.#free,
468
+ isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
469
+ backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
470
+ moveToTail: (index) => c.#moveToTail(index),
471
+ indexes: (options) => c.#indexes(options),
472
+ rindexes: (options) => c.#rindexes(options),
473
+ isStale: (index) => c.#isStale(index)
497
474
  };
498
475
  }
499
476
  /**
500
477
  * {@link LRUCache.OptionsBase.max} (read-only)
501
478
  */
502
479
  get max() {
503
- return _classPrivateFieldGet2(_max, this);
480
+ return this.#max;
504
481
  }
505
482
  /**
506
483
  * {@link LRUCache.OptionsBase.maxSize} (read-only)
507
484
  */
508
485
  get maxSize() {
509
- return _classPrivateFieldGet2(_maxSize, this);
486
+ return this.#maxSize;
510
487
  }
511
488
  /**
512
489
  * The total computed size of items in the cache (read-only)
513
490
  */
514
491
  get calculatedSize() {
515
- return _classPrivateFieldGet2(_calculatedSize, this);
492
+ return this.#calculatedSize;
516
493
  }
517
494
  /**
518
495
  * The number of items stored in the cache (read-only)
519
496
  */
520
497
  get size() {
521
- return _classPrivateFieldGet2(_size, this);
498
+ return this.#size;
522
499
  }
523
500
  /**
524
501
  * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
525
502
  */
526
503
  get fetchMethod() {
527
- return _classPrivateFieldGet2(_fetchMethod, this);
504
+ return this.#fetchMethod;
528
505
  }
529
506
  /**
530
507
  * {@link LRUCache.OptionsBase.dispose} (read-only)
531
508
  */
532
509
  get dispose() {
533
- return _classPrivateFieldGet2(_dispose, this);
510
+ return this.#dispose;
534
511
  }
535
512
  /**
536
513
  * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
537
514
  */
538
515
  get disposeAfter() {
539
- return _classPrivateFieldGet2(_disposeAfter, this);
516
+ return this.#disposeAfter;
540
517
  }
541
518
  constructor(options) {
542
- _classPrivateMethodInitSpec(this, _LRUCache_brand);
543
- _classPrivateFieldInitSpec(this, _max, void 0);
544
- _classPrivateFieldInitSpec(this, _maxSize, void 0);
545
- _classPrivateFieldInitSpec(this, _dispose, void 0);
546
- _classPrivateFieldInitSpec(this, _disposeAfter, void 0);
547
- _classPrivateFieldInitSpec(this, _fetchMethod, void 0);
548
- _defineProperty(
549
- this,
550
- /**
551
- * {@link LRUCache.OptionsBase.ttl}
552
- */
553
- "ttl",
554
- void 0
555
- );
556
- _defineProperty(
557
- this,
558
- /**
559
- * {@link LRUCache.OptionsBase.ttlResolution}
560
- */
561
- "ttlResolution",
562
- void 0
563
- );
564
- _defineProperty(
565
- this,
566
- /**
567
- * {@link LRUCache.OptionsBase.ttlAutopurge}
568
- */
569
- "ttlAutopurge",
570
- void 0
571
- );
572
- _defineProperty(
573
- this,
574
- /**
575
- * {@link LRUCache.OptionsBase.updateAgeOnGet}
576
- */
577
- "updateAgeOnGet",
578
- void 0
579
- );
580
- _defineProperty(
581
- this,
582
- /**
583
- * {@link LRUCache.OptionsBase.updateAgeOnHas}
584
- */
585
- "updateAgeOnHas",
586
- void 0
587
- );
588
- _defineProperty(
589
- this,
590
- /**
591
- * {@link LRUCache.OptionsBase.allowStale}
592
- */
593
- "allowStale",
594
- void 0
595
- );
596
- _defineProperty(
597
- this,
598
- /**
599
- * {@link LRUCache.OptionsBase.noDisposeOnSet}
600
- */
601
- "noDisposeOnSet",
602
- void 0
603
- );
604
- _defineProperty(
605
- this,
606
- /**
607
- * {@link LRUCache.OptionsBase.noUpdateTTL}
608
- */
609
- "noUpdateTTL",
610
- void 0
611
- );
612
- _defineProperty(
613
- this,
614
- /**
615
- * {@link LRUCache.OptionsBase.maxEntrySize}
616
- */
617
- "maxEntrySize",
618
- void 0
619
- );
620
- _defineProperty(
621
- this,
622
- /**
623
- * {@link LRUCache.OptionsBase.sizeCalculation}
624
- */
625
- "sizeCalculation",
626
- void 0
627
- );
628
- _defineProperty(
629
- this,
630
- /**
631
- * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
632
- */
633
- "noDeleteOnFetchRejection",
634
- void 0
635
- );
636
- _defineProperty(
637
- this,
638
- /**
639
- * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
640
- */
641
- "noDeleteOnStaleGet",
642
- void 0
643
- );
644
- _defineProperty(
645
- this,
646
- /**
647
- * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
648
- */
649
- "allowStaleOnFetchAbort",
650
- void 0
651
- );
652
- _defineProperty(
653
- this,
654
- /**
655
- * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
656
- */
657
- "allowStaleOnFetchRejection",
658
- void 0
659
- );
660
- _defineProperty(
661
- this,
662
- /**
663
- * {@link LRUCache.OptionsBase.ignoreFetchAbort}
664
- */
665
- "ignoreFetchAbort",
666
- void 0
667
- );
668
- _classPrivateFieldInitSpec(this, _size, void 0);
669
- _classPrivateFieldInitSpec(this, _calculatedSize, void 0);
670
- _classPrivateFieldInitSpec(this, _keyMap, void 0);
671
- _classPrivateFieldInitSpec(this, _keyList, void 0);
672
- _classPrivateFieldInitSpec(this, _valList, void 0);
673
- _classPrivateFieldInitSpec(this, _next, void 0);
674
- _classPrivateFieldInitSpec(this, _prev, void 0);
675
- _classPrivateFieldInitSpec(this, _head, void 0);
676
- _classPrivateFieldInitSpec(this, _tail, void 0);
677
- _classPrivateFieldInitSpec(this, _free, void 0);
678
- _classPrivateFieldInitSpec(this, _disposed, void 0);
679
- _classPrivateFieldInitSpec(this, _sizes, void 0);
680
- _classPrivateFieldInitSpec(this, _starts, void 0);
681
- _classPrivateFieldInitSpec(this, _ttls, void 0);
682
- _classPrivateFieldInitSpec(this, _hasDispose, void 0);
683
- _classPrivateFieldInitSpec(this, _hasFetchMethod, void 0);
684
- _classPrivateFieldInitSpec(this, _hasDisposeAfter, void 0);
685
- _classPrivateFieldInitSpec(this, _updateItemAge, () => {});
686
- _classPrivateFieldInitSpec(this, _statusTTL, () => {});
687
- _classPrivateFieldInitSpec(this, _setItemTTL, () => {});
688
- _classPrivateFieldInitSpec(this, _isStale, () => false);
689
- _classPrivateFieldInitSpec(this, _removeItemSize, (_i) => {});
690
- _classPrivateFieldInitSpec(this, _addItemSize, (_i, _s, _st) => {});
691
- _classPrivateFieldInitSpec(this, _requireSize, (_k, _v, size, sizeCalculation) => {
692
- if (size || sizeCalculation) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
693
- return 0;
694
- });
695
519
  const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
696
520
  if (max !== 0 && !isPosInt(max)) throw new TypeError("max option must be a nonnegative integer");
697
521
  const UintArray = max ? getUintArray(max) : Array;
698
522
  if (!UintArray) throw new Error("invalid max value: " + max);
699
- _classPrivateFieldSet2(_max, this, max);
700
- _classPrivateFieldSet2(_maxSize, this, maxSize);
701
- this.maxEntrySize = maxEntrySize || _classPrivateFieldGet2(_maxSize, this);
523
+ this.#max = max;
524
+ this.#maxSize = maxSize;
525
+ this.maxEntrySize = maxEntrySize || this.#maxSize;
702
526
  this.sizeCalculation = sizeCalculation;
703
527
  if (this.sizeCalculation) {
704
- if (!_classPrivateFieldGet2(_maxSize, this) && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
528
+ if (!this.#maxSize && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
705
529
  if (typeof this.sizeCalculation !== "function") throw new TypeError("sizeCalculation set to non-function");
706
530
  }
707
531
  if (fetchMethod !== void 0 && typeof fetchMethod !== "function") throw new TypeError("fetchMethod must be a function if specified");
708
- _classPrivateFieldSet2(_fetchMethod, this, fetchMethod);
709
- _classPrivateFieldSet2(_hasFetchMethod, this, !!fetchMethod);
710
- _classPrivateFieldSet2(_keyMap, this, /* @__PURE__ */ new Map());
711
- _classPrivateFieldSet2(_keyList, this, new Array(max).fill(void 0));
712
- _classPrivateFieldSet2(_valList, this, new Array(max).fill(void 0));
713
- _classPrivateFieldSet2(_next, this, new UintArray(max));
714
- _classPrivateFieldSet2(_prev, this, new UintArray(max));
715
- _classPrivateFieldSet2(_head, this, 0);
716
- _classPrivateFieldSet2(_tail, this, 0);
717
- _classPrivateFieldSet2(_free, this, Stack.create(max));
718
- _classPrivateFieldSet2(_size, this, 0);
719
- _classPrivateFieldSet2(_calculatedSize, this, 0);
720
- if (typeof dispose === "function") _classPrivateFieldSet2(_dispose, this, dispose);
532
+ this.#fetchMethod = fetchMethod;
533
+ this.#hasFetchMethod = !!fetchMethod;
534
+ this.#keyMap = /* @__PURE__ */ new Map();
535
+ this.#keyList = new Array(max).fill(void 0);
536
+ this.#valList = new Array(max).fill(void 0);
537
+ this.#next = new UintArray(max);
538
+ this.#prev = new UintArray(max);
539
+ this.#head = 0;
540
+ this.#tail = 0;
541
+ this.#free = Stack.create(max);
542
+ this.#size = 0;
543
+ this.#calculatedSize = 0;
544
+ if (typeof dispose === "function") this.#dispose = dispose;
721
545
  if (typeof disposeAfter === "function") {
722
- _classPrivateFieldSet2(_disposeAfter, this, disposeAfter);
723
- _classPrivateFieldSet2(_disposed, this, []);
546
+ this.#disposeAfter = disposeAfter;
547
+ this.#disposed = [];
724
548
  } else {
725
- _classPrivateFieldSet2(_disposeAfter, this, void 0);
726
- _classPrivateFieldSet2(_disposed, this, void 0);
549
+ this.#disposeAfter = void 0;
550
+ this.#disposed = void 0;
727
551
  }
728
- _classPrivateFieldSet2(_hasDispose, this, !!_classPrivateFieldGet2(_dispose, this));
729
- _classPrivateFieldSet2(_hasDisposeAfter, this, !!_classPrivateFieldGet2(_disposeAfter, this));
552
+ this.#hasDispose = !!this.#dispose;
553
+ this.#hasDisposeAfter = !!this.#disposeAfter;
730
554
  this.noDisposeOnSet = !!noDisposeOnSet;
731
555
  this.noUpdateTTL = !!noUpdateTTL;
732
556
  this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
@@ -734,11 +558,11 @@ var LRUCache = class LRUCache {
734
558
  this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
735
559
  this.ignoreFetchAbort = !!ignoreFetchAbort;
736
560
  if (this.maxEntrySize !== 0) {
737
- if (_classPrivateFieldGet2(_maxSize, this) !== 0) {
738
- if (!isPosInt(_classPrivateFieldGet2(_maxSize, this))) throw new TypeError("maxSize must be a positive integer if specified");
561
+ if (this.#maxSize !== 0) {
562
+ if (!isPosInt(this.#maxSize)) throw new TypeError("maxSize must be a positive integer if specified");
739
563
  }
740
564
  if (!isPosInt(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
741
- _assertClassBrand(_LRUCache_brand, this, _initializeSizeTracking).call(this);
565
+ this.#initializeSizeTracking();
742
566
  }
743
567
  this.allowStale = !!allowStale;
744
568
  this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
@@ -749,10 +573,10 @@ var LRUCache = class LRUCache {
749
573
  this.ttl = ttl || 0;
750
574
  if (this.ttl) {
751
575
  if (!isPosInt(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
752
- _assertClassBrand(_LRUCache_brand, this, _initializeTTLTracking).call(this);
576
+ this.#initializeTTLTracking();
753
577
  }
754
- if (_classPrivateFieldGet2(_max, this) === 0 && this.ttl === 0 && _classPrivateFieldGet2(_maxSize, this) === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
755
- if (!this.ttlAutopurge && !_classPrivateFieldGet2(_max, this) && !_classPrivateFieldGet2(_maxSize, this)) {
578
+ if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
579
+ if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
756
580
  const code = "LRU_CACHE_UNBOUNDED";
757
581
  if (shouldWarn(code)) {
758
582
  warned.add(code);
@@ -764,14 +588,132 @@ var LRUCache = class LRUCache {
764
588
  * Return the remaining TTL time for a given entry key
765
589
  */
766
590
  getRemainingTTL(key) {
767
- return _classPrivateFieldGet2(_keyMap, this).has(key) ? Infinity : 0;
591
+ return this.#keyMap.has(key) ? Infinity : 0;
592
+ }
593
+ #initializeTTLTracking() {
594
+ const ttls = new ZeroArray(this.#max);
595
+ const starts = new ZeroArray(this.#max);
596
+ this.#ttls = ttls;
597
+ this.#starts = starts;
598
+ this.#setItemTTL = (index, ttl, start = perf.now()) => {
599
+ starts[index] = ttl !== 0 ? start : 0;
600
+ ttls[index] = ttl;
601
+ if (ttl !== 0 && this.ttlAutopurge) {
602
+ const t = setTimeout(() => {
603
+ if (this.#isStale(index)) this.delete(this.#keyList[index]);
604
+ }, ttl + 1);
605
+ /* c8 ignore start */
606
+ if (t.unref) t.unref();
607
+ }
608
+ };
609
+ this.#updateItemAge = (index) => {
610
+ starts[index] = ttls[index] !== 0 ? perf.now() : 0;
611
+ };
612
+ this.#statusTTL = (status, index) => {
613
+ if (ttls[index]) {
614
+ const ttl = ttls[index];
615
+ const start = starts[index];
616
+ /* c8 ignore next */
617
+ if (!ttl || !start) return;
618
+ status.ttl = ttl;
619
+ status.start = start;
620
+ status.now = cachedNow || getNow();
621
+ status.remainingTTL = ttl - (status.now - start);
622
+ }
623
+ };
624
+ let cachedNow = 0;
625
+ const getNow = () => {
626
+ const n = perf.now();
627
+ if (this.ttlResolution > 0) {
628
+ cachedNow = n;
629
+ const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
630
+ /* c8 ignore start */
631
+ if (t.unref) t.unref();
632
+ }
633
+ return n;
634
+ };
635
+ this.getRemainingTTL = (key) => {
636
+ const index = this.#keyMap.get(key);
637
+ if (index === void 0) return 0;
638
+ const ttl = ttls[index];
639
+ const start = starts[index];
640
+ if (!ttl || !start) return Infinity;
641
+ return ttl - ((cachedNow || getNow()) - start);
642
+ };
643
+ this.#isStale = (index) => {
644
+ const s = starts[index];
645
+ const t = ttls[index];
646
+ return !!t && !!s && (cachedNow || getNow()) - s > t;
647
+ };
648
+ }
649
+ #updateItemAge = () => {};
650
+ #statusTTL = () => {};
651
+ #setItemTTL = () => {};
652
+ /* c8 ignore stop */
653
+ #isStale = () => false;
654
+ #initializeSizeTracking() {
655
+ const sizes = new ZeroArray(this.#max);
656
+ this.#calculatedSize = 0;
657
+ this.#sizes = sizes;
658
+ this.#removeItemSize = (index) => {
659
+ this.#calculatedSize -= sizes[index];
660
+ sizes[index] = 0;
661
+ };
662
+ this.#requireSize = (k, v, size, sizeCalculation) => {
663
+ if (this.#isBackgroundFetch(v)) return 0;
664
+ if (!isPosInt(size)) {
665
+ if (sizeCalculation) {
666
+ if (typeof sizeCalculation !== "function") throw new TypeError("sizeCalculation must be a function");
667
+ size = sizeCalculation(v, k);
668
+ if (!isPosInt(size)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
669
+ } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
670
+ }
671
+ return size;
672
+ };
673
+ this.#addItemSize = (index, size, status) => {
674
+ sizes[index] = size;
675
+ if (this.#maxSize) {
676
+ const maxSize = this.#maxSize - sizes[index];
677
+ while (this.#calculatedSize > maxSize) this.#evict(true);
678
+ }
679
+ this.#calculatedSize += sizes[index];
680
+ if (status) {
681
+ status.entrySize = size;
682
+ status.totalCalculatedSize = this.#calculatedSize;
683
+ }
684
+ };
685
+ }
686
+ #removeItemSize = (_i) => {};
687
+ #addItemSize = (_i, _s, _st) => {};
688
+ #requireSize = (_k, _v, size, sizeCalculation) => {
689
+ if (size || sizeCalculation) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
690
+ return 0;
691
+ };
692
+ *#indexes({ allowStale = this.allowStale } = {}) {
693
+ if (this.#size) for (let i = this.#tail;;) {
694
+ if (!this.#isValidIndex(i)) break;
695
+ if (allowStale || !this.#isStale(i)) yield i;
696
+ if (i === this.#head) break;
697
+ else i = this.#prev[i];
698
+ }
699
+ }
700
+ *#rindexes({ allowStale = this.allowStale } = {}) {
701
+ if (this.#size) for (let i = this.#head;;) {
702
+ if (!this.#isValidIndex(i)) break;
703
+ if (allowStale || !this.#isStale(i)) yield i;
704
+ if (i === this.#tail) break;
705
+ else i = this.#next[i];
706
+ }
707
+ }
708
+ #isValidIndex(index) {
709
+ return index !== void 0 && this.#keyMap.get(this.#keyList[index]) === index;
768
710
  }
769
711
  /**
770
712
  * Return a generator yielding `[key, value]` pairs,
771
713
  * in order from most recently used to least recently used.
772
714
  */
773
715
  *entries() {
774
- for (const i of _assertClassBrand(_LRUCache_brand, this, _indexes).call(this)) if (_classPrivateFieldGet2(_valList, this)[i] !== void 0 && _classPrivateFieldGet2(_keyList, this)[i] !== void 0 && !_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, _classPrivateFieldGet2(_valList, this)[i])) yield [_classPrivateFieldGet2(_keyList, this)[i], _classPrivateFieldGet2(_valList, this)[i]];
716
+ for (const i of this.#indexes()) if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield [this.#keyList[i], this.#valList[i]];
775
717
  }
776
718
  /**
777
719
  * Inverse order version of {@link LRUCache.entries}
@@ -780,16 +722,16 @@ var LRUCache = class LRUCache {
780
722
  * in order from least recently used to most recently used.
781
723
  */
782
724
  *rentries() {
783
- for (const i of _assertClassBrand(_LRUCache_brand, this, _rindexes).call(this)) if (_classPrivateFieldGet2(_valList, this)[i] !== void 0 && _classPrivateFieldGet2(_keyList, this)[i] !== void 0 && !_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, _classPrivateFieldGet2(_valList, this)[i])) yield [_classPrivateFieldGet2(_keyList, this)[i], _classPrivateFieldGet2(_valList, this)[i]];
725
+ for (const i of this.#rindexes()) if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield [this.#keyList[i], this.#valList[i]];
784
726
  }
785
727
  /**
786
728
  * Return a generator yielding the keys in the cache,
787
729
  * in order from most recently used to least recently used.
788
730
  */
789
731
  *keys() {
790
- for (const i of _assertClassBrand(_LRUCache_brand, this, _indexes).call(this)) {
791
- const k = _classPrivateFieldGet2(_keyList, this)[i];
792
- if (k !== void 0 && !_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, _classPrivateFieldGet2(_valList, this)[i])) yield k;
732
+ for (const i of this.#indexes()) {
733
+ const k = this.#keyList[i];
734
+ if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield k;
793
735
  }
794
736
  }
795
737
  /**
@@ -799,9 +741,9 @@ var LRUCache = class LRUCache {
799
741
  * in order from least recently used to most recently used.
800
742
  */
801
743
  *rkeys() {
802
- for (const i of _assertClassBrand(_LRUCache_brand, this, _rindexes).call(this)) {
803
- const k = _classPrivateFieldGet2(_keyList, this)[i];
804
- if (k !== void 0 && !_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, _classPrivateFieldGet2(_valList, this)[i])) yield k;
744
+ for (const i of this.#rindexes()) {
745
+ const k = this.#keyList[i];
746
+ if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield k;
805
747
  }
806
748
  }
807
749
  /**
@@ -809,7 +751,7 @@ var LRUCache = class LRUCache {
809
751
  * in order from most recently used to least recently used.
810
752
  */
811
753
  *values() {
812
- for (const i of _assertClassBrand(_LRUCache_brand, this, _indexes).call(this)) if (_classPrivateFieldGet2(_valList, this)[i] !== void 0 && !_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, _classPrivateFieldGet2(_valList, this)[i])) yield _classPrivateFieldGet2(_valList, this)[i];
754
+ for (const i of this.#indexes()) if (this.#valList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield this.#valList[i];
813
755
  }
814
756
  /**
815
757
  * Inverse order version of {@link LRUCache.values}
@@ -818,13 +760,13 @@ var LRUCache = class LRUCache {
818
760
  * in order from least recently used to most recently used.
819
761
  */
820
762
  *rvalues() {
821
- for (const i of _assertClassBrand(_LRUCache_brand, this, _rindexes).call(this)) if (_classPrivateFieldGet2(_valList, this)[i] !== void 0 && !_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, _classPrivateFieldGet2(_valList, this)[i])) yield _classPrivateFieldGet2(_valList, this)[i];
763
+ for (const i of this.#rindexes()) if (this.#valList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield this.#valList[i];
822
764
  }
823
765
  /**
824
766
  * Iterating over the cache itself yields the same results as
825
767
  * {@link LRUCache.entries}
826
768
  */
827
- [_Symbol$iterator]() {
769
+ [Symbol.iterator]() {
828
770
  return this.entries();
829
771
  }
830
772
  /**
@@ -832,11 +774,11 @@ var LRUCache = class LRUCache {
832
774
  * similar to Array.find(). fn is called as fn(value, key, cache).
833
775
  */
834
776
  find(fn, getOptions = {}) {
835
- for (const i of _assertClassBrand(_LRUCache_brand, this, _indexes).call(this)) {
836
- const v = _classPrivateFieldGet2(_valList, this)[i];
837
- const value = _assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v) ? v.__staleWhileFetching : v;
777
+ for (const i of this.#indexes()) {
778
+ const v = this.#valList[i];
779
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
838
780
  if (value === void 0) continue;
839
- if (fn(value, _classPrivateFieldGet2(_keyList, this)[i], this)) return this.get(_classPrivateFieldGet2(_keyList, this)[i], getOptions);
781
+ if (fn(value, this.#keyList[i], this)) return this.get(this.#keyList[i], getOptions);
840
782
  }
841
783
  }
842
784
  /**
@@ -846,11 +788,11 @@ var LRUCache = class LRUCache {
846
788
  * Does not iterate over stale values.
847
789
  */
848
790
  forEach(fn, thisp = this) {
849
- for (const i of _assertClassBrand(_LRUCache_brand, this, _indexes).call(this)) {
850
- const v = _classPrivateFieldGet2(_valList, this)[i];
851
- const value = _assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v) ? v.__staleWhileFetching : v;
791
+ for (const i of this.#indexes()) {
792
+ const v = this.#valList[i];
793
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
852
794
  if (value === void 0) continue;
853
- fn.call(thisp, value, _classPrivateFieldGet2(_keyList, this)[i], this);
795
+ fn.call(thisp, value, this.#keyList[i], this);
854
796
  }
855
797
  }
856
798
  /**
@@ -858,11 +800,11 @@ var LRUCache = class LRUCache {
858
800
  * reverse order. (ie, less recently used items are iterated over first.)
859
801
  */
860
802
  rforEach(fn, thisp = this) {
861
- for (const i of _assertClassBrand(_LRUCache_brand, this, _rindexes).call(this)) {
862
- const v = _classPrivateFieldGet2(_valList, this)[i];
863
- const value = _assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v) ? v.__staleWhileFetching : v;
803
+ for (const i of this.#rindexes()) {
804
+ const v = this.#valList[i];
805
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
864
806
  if (value === void 0) continue;
865
- fn.call(thisp, value, _classPrivateFieldGet2(_keyList, this)[i], this);
807
+ fn.call(thisp, value, this.#keyList[i], this);
866
808
  }
867
809
  }
868
810
  /**
@@ -871,8 +813,8 @@ var LRUCache = class LRUCache {
871
813
  */
872
814
  purgeStale() {
873
815
  let deleted = false;
874
- for (const i of _assertClassBrand(_LRUCache_brand, this, _rindexes).call(this, { allowStale: true })) if (_classPrivateFieldGet2(_isStale, this).call(this, i)) {
875
- this.delete(_classPrivateFieldGet2(_keyList, this)[i]);
816
+ for (const i of this.#rindexes({ allowStale: true })) if (this.#isStale(i)) {
817
+ this.delete(this.#keyList[i]);
876
818
  deleted = true;
877
819
  }
878
820
  return deleted;
@@ -884,21 +826,21 @@ var LRUCache = class LRUCache {
884
826
  * cache, so be sure to check for expired TTLs if relevant.
885
827
  */
886
828
  info(key) {
887
- const i = _classPrivateFieldGet2(_keyMap, this).get(key);
829
+ const i = this.#keyMap.get(key);
888
830
  if (i === void 0) return void 0;
889
- const v = _classPrivateFieldGet2(_valList, this)[i];
890
- const value = _assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v) ? v.__staleWhileFetching : v;
831
+ const v = this.#valList[i];
832
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
891
833
  if (value === void 0) return void 0;
892
834
  const entry = { value };
893
- if (_classPrivateFieldGet2(_ttls, this) && _classPrivateFieldGet2(_starts, this)) {
894
- const ttl = _classPrivateFieldGet2(_ttls, this)[i];
895
- const start = _classPrivateFieldGet2(_starts, this)[i];
835
+ if (this.#ttls && this.#starts) {
836
+ const ttl = this.#ttls[i];
837
+ const start = this.#starts[i];
896
838
  if (ttl && start) {
897
839
  entry.ttl = ttl - (perf.now() - start);
898
840
  entry.start = Date.now();
899
841
  }
900
842
  }
901
- if (_classPrivateFieldGet2(_sizes, this)) entry.size = _classPrivateFieldGet2(_sizes, this)[i];
843
+ if (this.#sizes) entry.size = this.#sizes[i];
902
844
  return entry;
903
845
  }
904
846
  /**
@@ -907,18 +849,18 @@ var LRUCache = class LRUCache {
907
849
  */
908
850
  dump() {
909
851
  const arr = [];
910
- for (const i of _assertClassBrand(_LRUCache_brand, this, _indexes).call(this, { allowStale: true })) {
911
- const key = _classPrivateFieldGet2(_keyList, this)[i];
912
- const v = _classPrivateFieldGet2(_valList, this)[i];
913
- const value = _assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v) ? v.__staleWhileFetching : v;
852
+ for (const i of this.#indexes({ allowStale: true })) {
853
+ const key = this.#keyList[i];
854
+ const v = this.#valList[i];
855
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
914
856
  if (value === void 0 || key === void 0) continue;
915
857
  const entry = { value };
916
- if (_classPrivateFieldGet2(_ttls, this) && _classPrivateFieldGet2(_starts, this)) {
917
- entry.ttl = _classPrivateFieldGet2(_ttls, this)[i];
918
- const age = perf.now() - _classPrivateFieldGet2(_starts, this)[i];
858
+ if (this.#ttls && this.#starts) {
859
+ entry.ttl = this.#ttls[i];
860
+ const age = perf.now() - this.#starts[i];
919
861
  entry.start = Math.floor(Date.now() - age);
920
862
  }
921
- if (_classPrivateFieldGet2(_sizes, this)) entry.size = _classPrivateFieldGet2(_sizes, this)[i];
863
+ if (this.#sizes) entry.size = this.#sizes[i];
922
864
  arr.unshift([key, entry]);
923
865
  }
924
866
  return arr;
@@ -951,7 +893,7 @@ var LRUCache = class LRUCache {
951
893
  }
952
894
  const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
953
895
  let { noUpdateTTL = this.noUpdateTTL } = setOptions;
954
- const size = _classPrivateFieldGet2(_requireSize, this).call(this, k, v, setOptions.size || 0, sizeCalculation);
896
+ const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
955
897
  if (this.maxEntrySize && size > this.maxEntrySize) {
956
898
  if (status) {
957
899
  status.set = "miss";
@@ -960,77 +902,61 @@ var LRUCache = class LRUCache {
960
902
  this.delete(k);
961
903
  return this;
962
904
  }
963
- let index = _classPrivateFieldGet2(_size, this) === 0 ? void 0 : _classPrivateFieldGet2(_keyMap, this).get(k);
905
+ let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
964
906
  if (index === void 0) {
965
- var _this$size;
966
- index = _classPrivateFieldGet2(_size, this) === 0 ? _classPrivateFieldGet2(_tail, this) : _classPrivateFieldGet2(_free, this).length !== 0 ? _classPrivateFieldGet2(_free, this).pop() : _classPrivateFieldGet2(_size, this) === _classPrivateFieldGet2(_max, this) ? _assertClassBrand(_LRUCache_brand, this, _evict).call(this, false) : _classPrivateFieldGet2(_size, this);
967
- _classPrivateFieldGet2(_keyList, this)[index] = k;
968
- _classPrivateFieldGet2(_valList, this)[index] = v;
969
- _classPrivateFieldGet2(_keyMap, this).set(k, index);
970
- _classPrivateFieldGet2(_next, this)[_classPrivateFieldGet2(_tail, this)] = index;
971
- _classPrivateFieldGet2(_prev, this)[index] = _classPrivateFieldGet2(_tail, this);
972
- _classPrivateFieldSet2(_tail, this, index);
973
- _classPrivateFieldSet2(_size, this, (_this$size = _classPrivateFieldGet2(_size, this), _this$size++, _this$size));
974
- _classPrivateFieldGet2(_addItemSize, this).call(this, index, size, status);
907
+ index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
908
+ this.#keyList[index] = k;
909
+ this.#valList[index] = v;
910
+ this.#keyMap.set(k, index);
911
+ this.#next[this.#tail] = index;
912
+ this.#prev[index] = this.#tail;
913
+ this.#tail = index;
914
+ this.#size++;
915
+ this.#addItemSize(index, size, status);
975
916
  if (status) status.set = "add";
976
917
  noUpdateTTL = false;
977
918
  } else {
978
- _assertClassBrand(_LRUCache_brand, this, _moveToTail).call(this, index);
979
- const oldVal = _classPrivateFieldGet2(_valList, this)[index];
919
+ this.#moveToTail(index);
920
+ const oldVal = this.#valList[index];
980
921
  if (v !== oldVal) {
981
- if (_classPrivateFieldGet2(_hasFetchMethod, this) && _assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, oldVal)) {
922
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
982
923
  oldVal.__abortController.abort(/* @__PURE__ */ new Error("replaced"));
983
924
  const { __staleWhileFetching: s } = oldVal;
984
925
  if (s !== void 0 && !noDisposeOnSet) {
985
- if (_classPrivateFieldGet2(_hasDispose, this)) {
986
- var _classPrivateFieldGet2$2;
987
- (_classPrivateFieldGet2$2 = _classPrivateFieldGet2(_dispose, this)) === null || _classPrivateFieldGet2$2 === void 0 || _classPrivateFieldGet2$2.call(this, s, k, "set");
988
- }
989
- if (_classPrivateFieldGet2(_hasDisposeAfter, this)) {
990
- var _classPrivateFieldGet3;
991
- (_classPrivateFieldGet3 = _classPrivateFieldGet2(_disposed, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.push([
992
- s,
993
- k,
994
- "set"
995
- ]);
996
- }
997
- }
998
- } else if (!noDisposeOnSet) {
999
- if (_classPrivateFieldGet2(_hasDispose, this)) {
1000
- var _classPrivateFieldGet4;
1001
- (_classPrivateFieldGet4 = _classPrivateFieldGet2(_dispose, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.call(this, oldVal, k, "set");
1002
- }
1003
- if (_classPrivateFieldGet2(_hasDisposeAfter, this)) {
1004
- var _classPrivateFieldGet5;
1005
- (_classPrivateFieldGet5 = _classPrivateFieldGet2(_disposed, this)) === null || _classPrivateFieldGet5 === void 0 || _classPrivateFieldGet5.push([
1006
- oldVal,
926
+ if (this.#hasDispose) this.#dispose?.(s, k, "set");
927
+ if (this.#hasDisposeAfter) this.#disposed?.push([
928
+ s,
1007
929
  k,
1008
930
  "set"
1009
931
  ]);
1010
932
  }
933
+ } else if (!noDisposeOnSet) {
934
+ if (this.#hasDispose) this.#dispose?.(oldVal, k, "set");
935
+ if (this.#hasDisposeAfter) this.#disposed?.push([
936
+ oldVal,
937
+ k,
938
+ "set"
939
+ ]);
1011
940
  }
1012
- _classPrivateFieldGet2(_removeItemSize, this).call(this, index);
1013
- _classPrivateFieldGet2(_addItemSize, this).call(this, index, size, status);
1014
- _classPrivateFieldGet2(_valList, this)[index] = v;
941
+ this.#removeItemSize(index);
942
+ this.#addItemSize(index, size, status);
943
+ this.#valList[index] = v;
1015
944
  if (status) {
1016
945
  status.set = "replace";
1017
- const oldValue = oldVal && _assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, oldVal) ? oldVal.__staleWhileFetching : oldVal;
946
+ const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
1018
947
  if (oldValue !== void 0) status.oldValue = oldValue;
1019
948
  }
1020
949
  } else if (status) status.set = "update";
1021
950
  }
1022
- if (ttl !== 0 && !_classPrivateFieldGet2(_ttls, this)) _assertClassBrand(_LRUCache_brand, this, _initializeTTLTracking).call(this);
1023
- if (_classPrivateFieldGet2(_ttls, this)) {
1024
- if (!noUpdateTTL) _classPrivateFieldGet2(_setItemTTL, this).call(this, index, ttl, start);
1025
- if (status) _classPrivateFieldGet2(_statusTTL, this).call(this, status, index);
951
+ if (ttl !== 0 && !this.#ttls) this.#initializeTTLTracking();
952
+ if (this.#ttls) {
953
+ if (!noUpdateTTL) this.#setItemTTL(index, ttl, start);
954
+ if (status) this.#statusTTL(status, index);
1026
955
  }
1027
- if (!noDisposeOnSet && _classPrivateFieldGet2(_hasDisposeAfter, this) && _classPrivateFieldGet2(_disposed, this)) {
1028
- const dt = _classPrivateFieldGet2(_disposed, this);
956
+ if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
957
+ const dt = this.#disposed;
1029
958
  let task;
1030
- while (task = dt === null || dt === void 0 ? void 0 : dt.shift()) {
1031
- var _classPrivateFieldGet6;
1032
- (_classPrivateFieldGet6 = _classPrivateFieldGet2(_disposeAfter, this)) === null || _classPrivateFieldGet6 === void 0 || _classPrivateFieldGet6.call(this, ...task);
1033
- }
959
+ while (task = dt?.shift()) this.#disposeAfter?.(...task);
1034
960
  }
1035
961
  return this;
1036
962
  }
@@ -1040,24 +966,48 @@ var LRUCache = class LRUCache {
1040
966
  */
1041
967
  pop() {
1042
968
  try {
1043
- while (_classPrivateFieldGet2(_size, this)) {
1044
- const val = _classPrivateFieldGet2(_valList, this)[_classPrivateFieldGet2(_head, this)];
1045
- _assertClassBrand(_LRUCache_brand, this, _evict).call(this, true);
1046
- if (_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, val)) {
969
+ while (this.#size) {
970
+ const val = this.#valList[this.#head];
971
+ this.#evict(true);
972
+ if (this.#isBackgroundFetch(val)) {
1047
973
  if (val.__staleWhileFetching) return val.__staleWhileFetching;
1048
974
  } else if (val !== void 0) return val;
1049
975
  }
1050
976
  } finally {
1051
- if (_classPrivateFieldGet2(_hasDisposeAfter, this) && _classPrivateFieldGet2(_disposed, this)) {
1052
- const dt = _classPrivateFieldGet2(_disposed, this);
977
+ if (this.#hasDisposeAfter && this.#disposed) {
978
+ const dt = this.#disposed;
1053
979
  let task;
1054
- while (task = dt === null || dt === void 0 ? void 0 : dt.shift()) {
1055
- var _classPrivateFieldGet7;
1056
- (_classPrivateFieldGet7 = _classPrivateFieldGet2(_disposeAfter, this)) === null || _classPrivateFieldGet7 === void 0 || _classPrivateFieldGet7.call(this, ...task);
1057
- }
980
+ while (task = dt?.shift()) this.#disposeAfter?.(...task);
1058
981
  }
1059
982
  }
1060
983
  }
984
+ #evict(free) {
985
+ const head = this.#head;
986
+ const k = this.#keyList[head];
987
+ const v = this.#valList[head];
988
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) v.__abortController.abort(/* @__PURE__ */ new Error("evicted"));
989
+ else if (this.#hasDispose || this.#hasDisposeAfter) {
990
+ if (this.#hasDispose) this.#dispose?.(v, k, "evict");
991
+ if (this.#hasDisposeAfter) this.#disposed?.push([
992
+ v,
993
+ k,
994
+ "evict"
995
+ ]);
996
+ }
997
+ this.#removeItemSize(head);
998
+ if (free) {
999
+ this.#keyList[head] = void 0;
1000
+ this.#valList[head] = void 0;
1001
+ this.#free.push(head);
1002
+ }
1003
+ if (this.#size === 1) {
1004
+ this.#head = this.#tail = 0;
1005
+ this.#free.length = 0;
1006
+ } else this.#head = this.#next[head];
1007
+ this.#keyMap.delete(k);
1008
+ this.#size--;
1009
+ return head;
1010
+ }
1061
1011
  /**
1062
1012
  * Check if a key is in the cache, without updating the recency of use.
1063
1013
  * Will return false if the item is stale, even though it is technically
@@ -1068,20 +1018,20 @@ var LRUCache = class LRUCache {
1068
1018
  */
1069
1019
  has(k, hasOptions = {}) {
1070
1020
  const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
1071
- const index = _classPrivateFieldGet2(_keyMap, this).get(k);
1021
+ const index = this.#keyMap.get(k);
1072
1022
  if (index !== void 0) {
1073
- const v = _classPrivateFieldGet2(_valList, this)[index];
1074
- if (_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v) && v.__staleWhileFetching === void 0) return false;
1075
- if (!_classPrivateFieldGet2(_isStale, this).call(this, index)) {
1076
- if (updateAgeOnHas) _classPrivateFieldGet2(_updateItemAge, this).call(this, index);
1023
+ const v = this.#valList[index];
1024
+ if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === void 0) return false;
1025
+ if (!this.#isStale(index)) {
1026
+ if (updateAgeOnHas) this.#updateItemAge(index);
1077
1027
  if (status) {
1078
1028
  status.has = "hit";
1079
- _classPrivateFieldGet2(_statusTTL, this).call(this, status, index);
1029
+ this.#statusTTL(status, index);
1080
1030
  }
1081
1031
  return true;
1082
1032
  } else if (status) {
1083
1033
  status.has = "stale";
1084
- _classPrivateFieldGet2(_statusTTL, this).call(this, status, index);
1034
+ this.#statusTTL(status, index);
1085
1035
  }
1086
1036
  } else if (status) status.has = "miss";
1087
1037
  return false;
@@ -1095,14 +1045,101 @@ var LRUCache = class LRUCache {
1095
1045
  */
1096
1046
  peek(k, peekOptions = {}) {
1097
1047
  const { allowStale = this.allowStale } = peekOptions;
1098
- const index = _classPrivateFieldGet2(_keyMap, this).get(k);
1099
- if (index === void 0 || !allowStale && _classPrivateFieldGet2(_isStale, this).call(this, index)) return;
1100
- const v = _classPrivateFieldGet2(_valList, this)[index];
1101
- return _assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v) ? v.__staleWhileFetching : v;
1048
+ const index = this.#keyMap.get(k);
1049
+ if (index === void 0 || !allowStale && this.#isStale(index)) return;
1050
+ const v = this.#valList[index];
1051
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
1052
+ }
1053
+ #backgroundFetch(k, index, options, context) {
1054
+ const v = index === void 0 ? void 0 : this.#valList[index];
1055
+ if (this.#isBackgroundFetch(v)) return v;
1056
+ const ac = new AC();
1057
+ const { signal } = options;
1058
+ signal?.addEventListener("abort", () => ac.abort(signal.reason), { signal: ac.signal });
1059
+ const fetchOpts = {
1060
+ signal: ac.signal,
1061
+ options,
1062
+ context
1063
+ };
1064
+ const cb = (v, updateCache = false) => {
1065
+ const { aborted } = ac.signal;
1066
+ const ignoreAbort = options.ignoreFetchAbort && v !== void 0;
1067
+ if (options.status) {
1068
+ if (aborted && !updateCache) {
1069
+ options.status.fetchAborted = true;
1070
+ options.status.fetchError = ac.signal.reason;
1071
+ if (ignoreAbort) options.status.fetchAbortIgnored = true;
1072
+ } else options.status.fetchResolved = true;
1073
+ }
1074
+ if (aborted && !ignoreAbort && !updateCache) return fetchFail(ac.signal.reason);
1075
+ const bf = p;
1076
+ if (this.#valList[index] === p) {
1077
+ if (v === void 0) {
1078
+ if (bf.__staleWhileFetching) this.#valList[index] = bf.__staleWhileFetching;
1079
+ else this.delete(k);
1080
+ } else {
1081
+ if (options.status) options.status.fetchUpdated = true;
1082
+ this.set(k, v, fetchOpts.options);
1083
+ }
1084
+ }
1085
+ return v;
1086
+ };
1087
+ const eb = (er) => {
1088
+ if (options.status) {
1089
+ options.status.fetchRejected = true;
1090
+ options.status.fetchError = er;
1091
+ }
1092
+ return fetchFail(er);
1093
+ };
1094
+ const fetchFail = (er) => {
1095
+ const { aborted } = ac.signal;
1096
+ const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
1097
+ const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
1098
+ const noDelete = allowStale || options.noDeleteOnFetchRejection;
1099
+ const bf = p;
1100
+ if (this.#valList[index] === p) {
1101
+ if (!noDelete || bf.__staleWhileFetching === void 0) this.delete(k);
1102
+ else if (!allowStaleAborted) this.#valList[index] = bf.__staleWhileFetching;
1103
+ }
1104
+ if (allowStale) {
1105
+ if (options.status && bf.__staleWhileFetching !== void 0) options.status.returnedStale = true;
1106
+ return bf.__staleWhileFetching;
1107
+ } else if (bf.__returned === bf) throw er;
1108
+ };
1109
+ const pcall = (res, rej) => {
1110
+ const fmp = this.#fetchMethod?.(k, v, fetchOpts);
1111
+ if (fmp && fmp instanceof Promise) fmp.then((v) => res(v === void 0 ? void 0 : v), rej);
1112
+ ac.signal.addEventListener("abort", () => {
1113
+ if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
1114
+ res(void 0);
1115
+ if (options.allowStaleOnFetchAbort) res = (v) => cb(v, true);
1116
+ }
1117
+ });
1118
+ };
1119
+ if (options.status) options.status.fetchDispatched = true;
1120
+ const p = new Promise(pcall).then(cb, eb);
1121
+ const bf = Object.assign(p, {
1122
+ __abortController: ac,
1123
+ __staleWhileFetching: v,
1124
+ __returned: void 0
1125
+ });
1126
+ if (index === void 0) {
1127
+ this.set(k, bf, {
1128
+ ...fetchOpts.options,
1129
+ status: void 0
1130
+ });
1131
+ index = this.#keyMap.get(k);
1132
+ } else this.#valList[index] = bf;
1133
+ return bf;
1134
+ }
1135
+ #isBackgroundFetch(p) {
1136
+ if (!this.#hasFetchMethod) return false;
1137
+ const b = p;
1138
+ return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
1102
1139
  }
1103
1140
  async fetch(k, fetchOptions = {}) {
1104
1141
  const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL, noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal } = fetchOptions;
1105
- if (!_classPrivateFieldGet2(_hasFetchMethod, this)) {
1142
+ if (!this.#hasFetchMethod) {
1106
1143
  if (status) status.fetch = "get";
1107
1144
  return this.get(k, {
1108
1145
  allowStale,
@@ -1127,14 +1164,14 @@ var LRUCache = class LRUCache {
1127
1164
  status,
1128
1165
  signal
1129
1166
  };
1130
- let index = _classPrivateFieldGet2(_keyMap, this).get(k);
1167
+ let index = this.#keyMap.get(k);
1131
1168
  if (index === void 0) {
1132
1169
  if (status) status.fetch = "miss";
1133
- const p = _assertClassBrand(_LRUCache_brand, this, _backgroundFetch).call(this, k, index, options, context);
1170
+ const p = this.#backgroundFetch(k, index, options, context);
1134
1171
  return p.__returned = p;
1135
1172
  } else {
1136
- const v = _classPrivateFieldGet2(_valList, this)[index];
1137
- if (_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v)) {
1173
+ const v = this.#valList[index];
1174
+ if (this.#isBackgroundFetch(v)) {
1138
1175
  const stale = allowStale && v.__staleWhileFetching !== void 0;
1139
1176
  if (status) {
1140
1177
  status.fetch = "inflight";
@@ -1142,15 +1179,15 @@ var LRUCache = class LRUCache {
1142
1179
  }
1143
1180
  return stale ? v.__staleWhileFetching : v.__returned = v;
1144
1181
  }
1145
- const isStale = _classPrivateFieldGet2(_isStale, this).call(this, index);
1182
+ const isStale = this.#isStale(index);
1146
1183
  if (!forceRefresh && !isStale) {
1147
1184
  if (status) status.fetch = "hit";
1148
- _assertClassBrand(_LRUCache_brand, this, _moveToTail).call(this, index);
1149
- if (updateAgeOnGet) _classPrivateFieldGet2(_updateItemAge, this).call(this, index);
1150
- if (status) _classPrivateFieldGet2(_statusTTL, this).call(this, status, index);
1185
+ this.#moveToTail(index);
1186
+ if (updateAgeOnGet) this.#updateItemAge(index);
1187
+ if (status) this.#statusTTL(status, index);
1151
1188
  return v;
1152
1189
  }
1153
- const p = _assertClassBrand(_LRUCache_brand, this, _backgroundFetch).call(this, k, index, options, context);
1190
+ const p = this.#backgroundFetch(k, index, options, context);
1154
1191
  const staleVal = p.__staleWhileFetching !== void 0 && allowStale;
1155
1192
  if (status) {
1156
1193
  status.fetch = isStale ? "stale" : "refresh";
@@ -1167,12 +1204,12 @@ var LRUCache = class LRUCache {
1167
1204
  */
1168
1205
  get(k, getOptions = {}) {
1169
1206
  const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
1170
- const index = _classPrivateFieldGet2(_keyMap, this).get(k);
1207
+ const index = this.#keyMap.get(k);
1171
1208
  if (index !== void 0) {
1172
- const value = _classPrivateFieldGet2(_valList, this)[index];
1173
- const fetching = _assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, value);
1174
- if (status) _classPrivateFieldGet2(_statusTTL, this).call(this, status, index);
1175
- if (_classPrivateFieldGet2(_isStale, this).call(this, index)) {
1209
+ const value = this.#valList[index];
1210
+ const fetching = this.#isBackgroundFetch(value);
1211
+ if (status) this.#statusTTL(status, index);
1212
+ if (this.#isStale(index)) {
1176
1213
  if (status) status.get = "stale";
1177
1214
  if (!fetching) {
1178
1215
  if (!noDeleteOnStaleGet) this.delete(k);
@@ -1185,66 +1222,67 @@ var LRUCache = class LRUCache {
1185
1222
  } else {
1186
1223
  if (status) status.get = "hit";
1187
1224
  if (fetching) return value.__staleWhileFetching;
1188
- _assertClassBrand(_LRUCache_brand, this, _moveToTail).call(this, index);
1189
- if (updateAgeOnGet) _classPrivateFieldGet2(_updateItemAge, this).call(this, index);
1225
+ this.#moveToTail(index);
1226
+ if (updateAgeOnGet) this.#updateItemAge(index);
1190
1227
  return value;
1191
1228
  }
1192
1229
  } else if (status) status.get = "miss";
1193
1230
  }
1231
+ #connect(p, n) {
1232
+ this.#prev[n] = p;
1233
+ this.#next[p] = n;
1234
+ }
1235
+ #moveToTail(index) {
1236
+ if (index !== this.#tail) {
1237
+ if (index === this.#head) this.#head = this.#next[index];
1238
+ else this.#connect(this.#prev[index], this.#next[index]);
1239
+ this.#connect(this.#tail, index);
1240
+ this.#tail = index;
1241
+ }
1242
+ }
1194
1243
  /**
1195
1244
  * Deletes a key out of the cache.
1196
1245
  * Returns true if the key was deleted, false otherwise.
1197
1246
  */
1198
1247
  delete(k) {
1199
- var _classPrivateFieldGet13;
1200
1248
  let deleted = false;
1201
- if (_classPrivateFieldGet2(_size, this) !== 0) {
1202
- const index = _classPrivateFieldGet2(_keyMap, this).get(k);
1249
+ if (this.#size !== 0) {
1250
+ const index = this.#keyMap.get(k);
1203
1251
  if (index !== void 0) {
1204
1252
  deleted = true;
1205
- if (_classPrivateFieldGet2(_size, this) === 1) this.clear();
1253
+ if (this.#size === 1) this.clear();
1206
1254
  else {
1207
- var _this$size5;
1208
- _classPrivateFieldGet2(_removeItemSize, this).call(this, index);
1209
- const v = _classPrivateFieldGet2(_valList, this)[index];
1210
- if (_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v)) v.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
1211
- else if (_classPrivateFieldGet2(_hasDispose, this) || _classPrivateFieldGet2(_hasDisposeAfter, this)) {
1212
- if (_classPrivateFieldGet2(_hasDispose, this)) {
1213
- var _classPrivateFieldGet11;
1214
- (_classPrivateFieldGet11 = _classPrivateFieldGet2(_dispose, this)) === null || _classPrivateFieldGet11 === void 0 || _classPrivateFieldGet11.call(this, v, k, "delete");
1215
- }
1216
- if (_classPrivateFieldGet2(_hasDisposeAfter, this)) {
1217
- var _classPrivateFieldGet12;
1218
- (_classPrivateFieldGet12 = _classPrivateFieldGet2(_disposed, this)) === null || _classPrivateFieldGet12 === void 0 || _classPrivateFieldGet12.push([
1219
- v,
1220
- k,
1221
- "delete"
1222
- ]);
1223
- }
1255
+ this.#removeItemSize(index);
1256
+ const v = this.#valList[index];
1257
+ if (this.#isBackgroundFetch(v)) v.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
1258
+ else if (this.#hasDispose || this.#hasDisposeAfter) {
1259
+ if (this.#hasDispose) this.#dispose?.(v, k, "delete");
1260
+ if (this.#hasDisposeAfter) this.#disposed?.push([
1261
+ v,
1262
+ k,
1263
+ "delete"
1264
+ ]);
1224
1265
  }
1225
- _classPrivateFieldGet2(_keyMap, this).delete(k);
1226
- _classPrivateFieldGet2(_keyList, this)[index] = void 0;
1227
- _classPrivateFieldGet2(_valList, this)[index] = void 0;
1228
- if (index === _classPrivateFieldGet2(_tail, this)) _classPrivateFieldSet2(_tail, this, _classPrivateFieldGet2(_prev, this)[index]);
1229
- else if (index === _classPrivateFieldGet2(_head, this)) _classPrivateFieldSet2(_head, this, _classPrivateFieldGet2(_next, this)[index]);
1266
+ this.#keyMap.delete(k);
1267
+ this.#keyList[index] = void 0;
1268
+ this.#valList[index] = void 0;
1269
+ if (index === this.#tail) this.#tail = this.#prev[index];
1270
+ else if (index === this.#head) this.#head = this.#next[index];
1230
1271
  else {
1231
- const pi = _classPrivateFieldGet2(_prev, this)[index];
1232
- _classPrivateFieldGet2(_next, this)[pi] = _classPrivateFieldGet2(_next, this)[index];
1233
- const ni = _classPrivateFieldGet2(_next, this)[index];
1234
- _classPrivateFieldGet2(_prev, this)[ni] = _classPrivateFieldGet2(_prev, this)[index];
1272
+ const pi = this.#prev[index];
1273
+ this.#next[pi] = this.#next[index];
1274
+ const ni = this.#next[index];
1275
+ this.#prev[ni] = this.#prev[index];
1235
1276
  }
1236
- _classPrivateFieldSet2(_size, this, (_this$size5 = _classPrivateFieldGet2(_size, this), _this$size5--, _this$size5));
1237
- _classPrivateFieldGet2(_free, this).push(index);
1277
+ this.#size--;
1278
+ this.#free.push(index);
1238
1279
  }
1239
1280
  }
1240
1281
  }
1241
- if (_classPrivateFieldGet2(_hasDisposeAfter, this) && ((_classPrivateFieldGet13 = _classPrivateFieldGet2(_disposed, this)) === null || _classPrivateFieldGet13 === void 0 ? void 0 : _classPrivateFieldGet13.length)) {
1242
- const dt = _classPrivateFieldGet2(_disposed, this);
1282
+ if (this.#hasDisposeAfter && this.#disposed?.length) {
1283
+ const dt = this.#disposed;
1243
1284
  let task;
1244
- while (task = dt === null || dt === void 0 ? void 0 : dt.shift()) {
1245
- var _classPrivateFieldGet14;
1246
- (_classPrivateFieldGet14 = _classPrivateFieldGet2(_disposeAfter, this)) === null || _classPrivateFieldGet14 === void 0 || _classPrivateFieldGet14.call(this, ...task);
1247
- }
1285
+ while (task = dt?.shift()) this.#disposeAfter?.(...task);
1248
1286
  }
1249
1287
  return deleted;
1250
1288
  }
@@ -1252,289 +1290,39 @@ var LRUCache = class LRUCache {
1252
1290
  * Clear the cache entirely, throwing away all values.
1253
1291
  */
1254
1292
  clear() {
1255
- for (const index of _assertClassBrand(_LRUCache_brand, this, _rindexes).call(this, { allowStale: true })) {
1256
- const v = _classPrivateFieldGet2(_valList, this)[index];
1257
- if (_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v)) v.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
1293
+ for (const index of this.#rindexes({ allowStale: true })) {
1294
+ const v = this.#valList[index];
1295
+ if (this.#isBackgroundFetch(v)) v.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
1258
1296
  else {
1259
- const k = _classPrivateFieldGet2(_keyList, this)[index];
1260
- if (_classPrivateFieldGet2(_hasDispose, this)) {
1261
- var _classPrivateFieldGet15;
1262
- (_classPrivateFieldGet15 = _classPrivateFieldGet2(_dispose, this)) === null || _classPrivateFieldGet15 === void 0 || _classPrivateFieldGet15.call(this, v, k, "delete");
1263
- }
1264
- if (_classPrivateFieldGet2(_hasDisposeAfter, this)) {
1265
- var _classPrivateFieldGet16;
1266
- (_classPrivateFieldGet16 = _classPrivateFieldGet2(_disposed, this)) === null || _classPrivateFieldGet16 === void 0 || _classPrivateFieldGet16.push([
1267
- v,
1268
- k,
1269
- "delete"
1270
- ]);
1271
- }
1272
- }
1273
- }
1274
- _classPrivateFieldGet2(_keyMap, this).clear();
1275
- _classPrivateFieldGet2(_valList, this).fill(void 0);
1276
- _classPrivateFieldGet2(_keyList, this).fill(void 0);
1277
- if (_classPrivateFieldGet2(_ttls, this) && _classPrivateFieldGet2(_starts, this)) {
1278
- _classPrivateFieldGet2(_ttls, this).fill(0);
1279
- _classPrivateFieldGet2(_starts, this).fill(0);
1280
- }
1281
- if (_classPrivateFieldGet2(_sizes, this)) _classPrivateFieldGet2(_sizes, this).fill(0);
1282
- _classPrivateFieldSet2(_head, this, 0);
1283
- _classPrivateFieldSet2(_tail, this, 0);
1284
- _classPrivateFieldGet2(_free, this).length = 0;
1285
- _classPrivateFieldSet2(_calculatedSize, this, 0);
1286
- _classPrivateFieldSet2(_size, this, 0);
1287
- if (_classPrivateFieldGet2(_hasDisposeAfter, this) && _classPrivateFieldGet2(_disposed, this)) {
1288
- const dt = _classPrivateFieldGet2(_disposed, this);
1297
+ const k = this.#keyList[index];
1298
+ if (this.#hasDispose) this.#dispose?.(v, k, "delete");
1299
+ if (this.#hasDisposeAfter) this.#disposed?.push([
1300
+ v,
1301
+ k,
1302
+ "delete"
1303
+ ]);
1304
+ }
1305
+ }
1306
+ this.#keyMap.clear();
1307
+ this.#valList.fill(void 0);
1308
+ this.#keyList.fill(void 0);
1309
+ if (this.#ttls && this.#starts) {
1310
+ this.#ttls.fill(0);
1311
+ this.#starts.fill(0);
1312
+ }
1313
+ if (this.#sizes) this.#sizes.fill(0);
1314
+ this.#head = 0;
1315
+ this.#tail = 0;
1316
+ this.#free.length = 0;
1317
+ this.#calculatedSize = 0;
1318
+ this.#size = 0;
1319
+ if (this.#hasDisposeAfter && this.#disposed) {
1320
+ const dt = this.#disposed;
1289
1321
  let task;
1290
- while (task = dt === null || dt === void 0 ? void 0 : dt.shift()) {
1291
- var _classPrivateFieldGet17;
1292
- (_classPrivateFieldGet17 = _classPrivateFieldGet2(_disposeAfter, this)) === null || _classPrivateFieldGet17 === void 0 || _classPrivateFieldGet17.call(this, ...task);
1293
- }
1322
+ while (task = dt?.shift()) this.#disposeAfter?.(...task);
1294
1323
  }
1295
1324
  }
1296
1325
  };
1297
- function _initializeTTLTracking() {
1298
- const ttls = new ZeroArray(_classPrivateFieldGet2(_max, this));
1299
- const starts = new ZeroArray(_classPrivateFieldGet2(_max, this));
1300
- _classPrivateFieldSet2(_ttls, this, ttls);
1301
- _classPrivateFieldSet2(_starts, this, starts);
1302
- _classPrivateFieldSet2(_setItemTTL, this, (index, ttl, start = perf.now()) => {
1303
- starts[index] = ttl !== 0 ? start : 0;
1304
- ttls[index] = ttl;
1305
- if (ttl !== 0 && this.ttlAutopurge) {
1306
- const t = setTimeout(() => {
1307
- if (_classPrivateFieldGet2(_isStale, this).call(this, index)) this.delete(_classPrivateFieldGet2(_keyList, this)[index]);
1308
- }, ttl + 1);
1309
- /* c8 ignore start */
1310
- if (t.unref) t.unref();
1311
- }
1312
- });
1313
- _classPrivateFieldSet2(_updateItemAge, this, (index) => {
1314
- starts[index] = ttls[index] !== 0 ? perf.now() : 0;
1315
- });
1316
- _classPrivateFieldSet2(_statusTTL, this, (status, index) => {
1317
- if (ttls[index]) {
1318
- const ttl = ttls[index];
1319
- const start = starts[index];
1320
- /* c8 ignore next */
1321
- if (!ttl || !start) return;
1322
- status.ttl = ttl;
1323
- status.start = start;
1324
- status.now = cachedNow || getNow();
1325
- status.remainingTTL = ttl - (status.now - start);
1326
- }
1327
- });
1328
- let cachedNow = 0;
1329
- const getNow = () => {
1330
- const n = perf.now();
1331
- if (this.ttlResolution > 0) {
1332
- cachedNow = n;
1333
- const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
1334
- /* c8 ignore start */
1335
- if (t.unref) t.unref();
1336
- }
1337
- return n;
1338
- };
1339
- this.getRemainingTTL = (key) => {
1340
- const index = _classPrivateFieldGet2(_keyMap, this).get(key);
1341
- if (index === void 0) return 0;
1342
- const ttl = ttls[index];
1343
- const start = starts[index];
1344
- if (!ttl || !start) return Infinity;
1345
- return ttl - ((cachedNow || getNow()) - start);
1346
- };
1347
- _classPrivateFieldSet2(_isStale, this, (index) => {
1348
- const s = starts[index];
1349
- const t = ttls[index];
1350
- return !!t && !!s && (cachedNow || getNow()) - s > t;
1351
- });
1352
- }
1353
- function _initializeSizeTracking() {
1354
- const sizes = new ZeroArray(_classPrivateFieldGet2(_max, this));
1355
- _classPrivateFieldSet2(_calculatedSize, this, 0);
1356
- _classPrivateFieldSet2(_sizes, this, sizes);
1357
- _classPrivateFieldSet2(_removeItemSize, this, (index) => {
1358
- _classPrivateFieldSet2(_calculatedSize, this, _classPrivateFieldGet2(_calculatedSize, this) - sizes[index]);
1359
- sizes[index] = 0;
1360
- });
1361
- _classPrivateFieldSet2(_requireSize, this, (k, v, size, sizeCalculation) => {
1362
- if (_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v)) return 0;
1363
- if (!isPosInt(size)) {
1364
- if (sizeCalculation) {
1365
- if (typeof sizeCalculation !== "function") throw new TypeError("sizeCalculation must be a function");
1366
- size = sizeCalculation(v, k);
1367
- if (!isPosInt(size)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
1368
- } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
1369
- }
1370
- return size;
1371
- });
1372
- _classPrivateFieldSet2(_addItemSize, this, (index, size, status) => {
1373
- sizes[index] = size;
1374
- if (_classPrivateFieldGet2(_maxSize, this)) {
1375
- const maxSize = _classPrivateFieldGet2(_maxSize, this) - sizes[index];
1376
- while (_classPrivateFieldGet2(_calculatedSize, this) > maxSize) _assertClassBrand(_LRUCache_brand, this, _evict).call(this, true);
1377
- }
1378
- _classPrivateFieldSet2(_calculatedSize, this, _classPrivateFieldGet2(_calculatedSize, this) + sizes[index]);
1379
- if (status) {
1380
- status.entrySize = size;
1381
- status.totalCalculatedSize = _classPrivateFieldGet2(_calculatedSize, this);
1382
- }
1383
- });
1384
- }
1385
- function* _indexes({ allowStale = this.allowStale } = {}) {
1386
- if (_classPrivateFieldGet2(_size, this)) for (let i = _classPrivateFieldGet2(_tail, this);;) {
1387
- if (!_assertClassBrand(_LRUCache_brand, this, _isValidIndex).call(this, i)) break;
1388
- if (allowStale || !_classPrivateFieldGet2(_isStale, this).call(this, i)) yield i;
1389
- if (i === _classPrivateFieldGet2(_head, this)) break;
1390
- else i = _classPrivateFieldGet2(_prev, this)[i];
1391
- }
1392
- }
1393
- function* _rindexes({ allowStale = this.allowStale } = {}) {
1394
- if (_classPrivateFieldGet2(_size, this)) for (let i = _classPrivateFieldGet2(_head, this);;) {
1395
- if (!_assertClassBrand(_LRUCache_brand, this, _isValidIndex).call(this, i)) break;
1396
- if (allowStale || !_classPrivateFieldGet2(_isStale, this).call(this, i)) yield i;
1397
- if (i === _classPrivateFieldGet2(_tail, this)) break;
1398
- else i = _classPrivateFieldGet2(_next, this)[i];
1399
- }
1400
- }
1401
- function _isValidIndex(index) {
1402
- return index !== void 0 && _classPrivateFieldGet2(_keyMap, this).get(_classPrivateFieldGet2(_keyList, this)[index]) === index;
1403
- }
1404
- function _evict(free) {
1405
- var _this$size3;
1406
- const head = _classPrivateFieldGet2(_head, this);
1407
- const k = _classPrivateFieldGet2(_keyList, this)[head];
1408
- const v = _classPrivateFieldGet2(_valList, this)[head];
1409
- if (_classPrivateFieldGet2(_hasFetchMethod, this) && _assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v)) v.__abortController.abort(/* @__PURE__ */ new Error("evicted"));
1410
- else if (_classPrivateFieldGet2(_hasDispose, this) || _classPrivateFieldGet2(_hasDisposeAfter, this)) {
1411
- if (_classPrivateFieldGet2(_hasDispose, this)) {
1412
- var _classPrivateFieldGet8;
1413
- (_classPrivateFieldGet8 = _classPrivateFieldGet2(_dispose, this)) === null || _classPrivateFieldGet8 === void 0 || _classPrivateFieldGet8.call(this, v, k, "evict");
1414
- }
1415
- if (_classPrivateFieldGet2(_hasDisposeAfter, this)) {
1416
- var _classPrivateFieldGet9;
1417
- (_classPrivateFieldGet9 = _classPrivateFieldGet2(_disposed, this)) === null || _classPrivateFieldGet9 === void 0 || _classPrivateFieldGet9.push([
1418
- v,
1419
- k,
1420
- "evict"
1421
- ]);
1422
- }
1423
- }
1424
- _classPrivateFieldGet2(_removeItemSize, this).call(this, head);
1425
- if (free) {
1426
- _classPrivateFieldGet2(_keyList, this)[head] = void 0;
1427
- _classPrivateFieldGet2(_valList, this)[head] = void 0;
1428
- _classPrivateFieldGet2(_free, this).push(head);
1429
- }
1430
- if (_classPrivateFieldGet2(_size, this) === 1) {
1431
- _classPrivateFieldSet2(_head, this, _classPrivateFieldSet2(_tail, this, 0));
1432
- _classPrivateFieldGet2(_free, this).length = 0;
1433
- } else _classPrivateFieldSet2(_head, this, _classPrivateFieldGet2(_next, this)[head]);
1434
- _classPrivateFieldGet2(_keyMap, this).delete(k);
1435
- _classPrivateFieldSet2(_size, this, (_this$size3 = _classPrivateFieldGet2(_size, this), _this$size3--, _this$size3));
1436
- return head;
1437
- }
1438
- function _backgroundFetch(k, index, options, context) {
1439
- const v = index === void 0 ? void 0 : _classPrivateFieldGet2(_valList, this)[index];
1440
- if (_assertClassBrand(_LRUCache_brand, this, _isBackgroundFetch).call(this, v)) return v;
1441
- const ac = new AC();
1442
- const { signal } = options;
1443
- signal === null || signal === void 0 || signal.addEventListener("abort", () => ac.abort(signal.reason), { signal: ac.signal });
1444
- const fetchOpts = {
1445
- signal: ac.signal,
1446
- options,
1447
- context
1448
- };
1449
- const cb = (v, updateCache = false) => {
1450
- const { aborted } = ac.signal;
1451
- const ignoreAbort = options.ignoreFetchAbort && v !== void 0;
1452
- if (options.status) {
1453
- if (aborted && !updateCache) {
1454
- options.status.fetchAborted = true;
1455
- options.status.fetchError = ac.signal.reason;
1456
- if (ignoreAbort) options.status.fetchAbortIgnored = true;
1457
- } else options.status.fetchResolved = true;
1458
- }
1459
- if (aborted && !ignoreAbort && !updateCache) return fetchFail(ac.signal.reason);
1460
- const bf = p;
1461
- if (_classPrivateFieldGet2(_valList, this)[index] === p) {
1462
- if (v === void 0) {
1463
- if (bf.__staleWhileFetching) _classPrivateFieldGet2(_valList, this)[index] = bf.__staleWhileFetching;
1464
- else this.delete(k);
1465
- } else {
1466
- if (options.status) options.status.fetchUpdated = true;
1467
- this.set(k, v, fetchOpts.options);
1468
- }
1469
- }
1470
- return v;
1471
- };
1472
- const eb = (er) => {
1473
- if (options.status) {
1474
- options.status.fetchRejected = true;
1475
- options.status.fetchError = er;
1476
- }
1477
- return fetchFail(er);
1478
- };
1479
- const fetchFail = (er) => {
1480
- const { aborted } = ac.signal;
1481
- const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
1482
- const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
1483
- const noDelete = allowStale || options.noDeleteOnFetchRejection;
1484
- const bf = p;
1485
- if (_classPrivateFieldGet2(_valList, this)[index] === p) {
1486
- if (!noDelete || bf.__staleWhileFetching === void 0) this.delete(k);
1487
- else if (!allowStaleAborted) _classPrivateFieldGet2(_valList, this)[index] = bf.__staleWhileFetching;
1488
- }
1489
- if (allowStale) {
1490
- if (options.status && bf.__staleWhileFetching !== void 0) options.status.returnedStale = true;
1491
- return bf.__staleWhileFetching;
1492
- } else if (bf.__returned === bf) throw er;
1493
- };
1494
- const pcall = (res, rej) => {
1495
- var _classPrivateFieldGet10;
1496
- const fmp = (_classPrivateFieldGet10 = _classPrivateFieldGet2(_fetchMethod, this)) === null || _classPrivateFieldGet10 === void 0 ? void 0 : _classPrivateFieldGet10.call(this, k, v, fetchOpts);
1497
- if (fmp && fmp instanceof Promise) fmp.then((v) => res(v === void 0 ? void 0 : v), rej);
1498
- ac.signal.addEventListener("abort", () => {
1499
- if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
1500
- res(void 0);
1501
- if (options.allowStaleOnFetchAbort) res = (v) => cb(v, true);
1502
- }
1503
- });
1504
- };
1505
- if (options.status) options.status.fetchDispatched = true;
1506
- const p = new Promise(pcall).then(cb, eb);
1507
- const bf = Object.assign(p, {
1508
- __abortController: ac,
1509
- __staleWhileFetching: v,
1510
- __returned: void 0
1511
- });
1512
- if (index === void 0) {
1513
- this.set(k, bf, {
1514
- ...fetchOpts.options,
1515
- status: void 0
1516
- });
1517
- index = _classPrivateFieldGet2(_keyMap, this).get(k);
1518
- } else _classPrivateFieldGet2(_valList, this)[index] = bf;
1519
- return bf;
1520
- }
1521
- function _isBackgroundFetch(p) {
1522
- if (!_classPrivateFieldGet2(_hasFetchMethod, this)) return false;
1523
- const b = p;
1524
- return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
1525
- }
1526
- function _connect(p, n) {
1527
- _classPrivateFieldGet2(_prev, this)[n] = p;
1528
- _classPrivateFieldGet2(_next, this)[p] = n;
1529
- }
1530
- function _moveToTail(index) {
1531
- if (index !== _classPrivateFieldGet2(_tail, this)) {
1532
- if (index === _classPrivateFieldGet2(_head, this)) _classPrivateFieldSet2(_head, this, _classPrivateFieldGet2(_next, this)[index]);
1533
- else _assertClassBrand(_LRUCache_brand, this, _connect).call(this, _classPrivateFieldGet2(_prev, this)[index], _classPrivateFieldGet2(_next, this)[index]);
1534
- _assertClassBrand(_LRUCache_brand, this, _connect).call(this, _classPrivateFieldGet2(_tail, this), index);
1535
- _classPrivateFieldSet2(_tail, this, index);
1536
- }
1537
- }
1538
1326
  //#endregion
1539
1327
  //#region packages/compiler-sfc/src/cache.ts
1540
1328
  function createCache(max = 500) {
@@ -1543,7 +1331,7 @@ function createCache(max = 500) {
1543
1331
  //#endregion
1544
1332
  //#region packages/compiler-sfc/src/template/resolveTemplateAST.ts
1545
1333
  function resolveTemplateAST(inAST, options) {
1546
- if (!(inAST === null || inAST === void 0 ? void 0 : inAST.transformed)) return inAST;
1334
+ if (!inAST?.transformed) return inAST;
1547
1335
  const { compiler = _vue_compiler_dom, compilerOptions, ssr, onError } = options;
1548
1336
  const template = (ssr ? _vue_compiler_dom : compiler).parse(inAST.source, {
1549
1337
  prefixIdentifiers: true,
@@ -1578,9 +1366,9 @@ function resolveTemplateAnalysisResult(sfc, collectUsedIds = true, options) {
1578
1366
  const ids = collectUsedIds ? /* @__PURE__ */ new Set() : void 0;
1579
1367
  const vModelIds = /* @__PURE__ */ new Set();
1580
1368
  resolveTemplateAST(ast, {
1581
- compiler: options === null || options === void 0 ? void 0 : options.compiler,
1582
- compilerOptions: options === null || options === void 0 ? void 0 : options.compilerOptions,
1583
- ssr: options === null || options === void 0 ? void 0 : options.ssr,
1369
+ compiler: options?.compiler,
1370
+ compilerOptions: options?.compilerOptions,
1371
+ ssr: options?.ssr,
1584
1372
  onError: () => {}
1585
1373
  }).children.forEach(walk);
1586
1374
  function walk(node) {
@@ -1595,7 +1383,6 @@ function resolveTemplateAnalysisResult(sfc, collectUsedIds = true, options) {
1595
1383
  }
1596
1384
  }
1597
1385
  for (let i = 0; i < node.props.length; i++) {
1598
- var _prop$value;
1599
1386
  const prop = node.props[i];
1600
1387
  if (prop.type === 7) {
1601
1388
  if (ids) {
@@ -1615,7 +1402,7 @@ function resolveTemplateAnalysisResult(sfc, collectUsedIds = true, options) {
1615
1402
  else if (prop.name === "bind" && !prop.exp) ids.add((0, _vue_shared.camelize)(prop.arg.content));
1616
1403
  }
1617
1404
  }
1618
- if (ids && prop.type === 6 && prop.name === "ref" && ((_prop$value = prop.value) === null || _prop$value === void 0 ? void 0 : _prop$value.content)) ids.add(prop.value.content);
1405
+ if (ids && prop.type === 6 && prop.name === "ref" && prop.value?.content) ids.add(prop.value.content);
1619
1406
  }
1620
1407
  node.children.forEach(walk);
1621
1408
  break;
@@ -1638,10 +1425,9 @@ function extractIdentifiers$2(ids, node) {
1638
1425
  const DEFAULT_FILENAME = "anonymous.vue";
1639
1426
  const parseCache$1 = createCache();
1640
1427
  function parse(source, options = {}) {
1641
- var _options$compiler;
1642
1428
  const sourceKey = (0, _vue_shared.genCacheKey)(source, {
1643
1429
  ...options,
1644
- compiler: { parse: (_options$compiler = options.compiler) === null || _options$compiler === void 0 ? void 0 : _options$compiler.parse }
1430
+ compiler: { parse: options.compiler?.parse }
1645
1431
  });
1646
1432
  const cache = parseCache$1.get(sourceKey);
1647
1433
  if (cache) return cache;
@@ -1660,24 +1446,27 @@ function parse(source, options = {}) {
1660
1446
  shouldForceReload: (prevImports) => hmrShouldReload(prevImports, descriptor)
1661
1447
  };
1662
1448
  const errors = [];
1663
- compiler.parse(source, {
1449
+ const ast = compiler.parse(source, {
1664
1450
  parseMode: "sfc",
1665
1451
  prefixIdentifiers: true,
1666
1452
  ...templateParseOptions,
1667
1453
  onError: (e) => {
1668
1454
  errors.push(e);
1669
1455
  }
1670
- }).children.forEach((node) => {
1456
+ });
1457
+ let emptyScriptSetup;
1458
+ ast.children.forEach((node) => {
1671
1459
  if (node.type !== 1) return;
1672
1460
  if (ignoreEmpty && node.tag !== "template" && isEmpty(node) && !hasAttr(node, "src")) {
1673
- descriptor.vapor || (descriptor.vapor = hasAttr(node, "vapor"));
1461
+ descriptor.vapor ||= hasAttr(node, "vapor");
1462
+ if (node.tag === "script" && (hasAttr(node, "setup") || hasAttr(node, "vapor"))) emptyScriptSetup = node;
1674
1463
  return;
1675
1464
  }
1676
1465
  switch (node.tag) {
1677
1466
  case "template":
1678
1467
  if (!descriptor.template) {
1679
1468
  const templateBlock = descriptor.template = createBlock(node, source, false);
1680
- descriptor.vapor || (descriptor.vapor = !!templateBlock.attrs.vapor);
1469
+ descriptor.vapor ||= !!templateBlock.attrs.vapor;
1681
1470
  if (!templateBlock.attrs.src) templateBlock.ast = (0, _vue_compiler_core.createRoot)(node.children, source);
1682
1471
  if (templateBlock.attrs.functional) {
1683
1472
  const err = /* @__PURE__ */ new SyntaxError("<template functional> is no longer supported in Vue 3, since functional components no longer have significant performance difference from stateful ones. Just use a normal <template> instead.");
@@ -1688,7 +1477,7 @@ function parse(source, options = {}) {
1688
1477
  break;
1689
1478
  case "script":
1690
1479
  const scriptBlock = createBlock(node, source, pad);
1691
- descriptor.vapor || (descriptor.vapor = !!scriptBlock.attrs.vapor);
1480
+ descriptor.vapor ||= !!scriptBlock.attrs.vapor;
1692
1481
  const isSetup = !!(scriptBlock.attrs.setup || scriptBlock.attrs.vapor);
1693
1482
  if (isSetup && !descriptor.scriptSetup) {
1694
1483
  descriptor.scriptSetup = scriptBlock;
@@ -1708,6 +1497,14 @@ function parse(source, options = {}) {
1708
1497
  default: descriptor.customBlocks.push(createBlock(node, source, pad));
1709
1498
  }
1710
1499
  });
1500
+ if (descriptor.vapor && descriptor.script && !descriptor.scriptSetup) {
1501
+ if (emptyScriptSetup) descriptor.scriptSetup = createBlock(emptyScriptSetup, source, pad);
1502
+ else {
1503
+ const err = /* @__PURE__ */ new SyntaxError(`Vapor components with a normal <script> must also include <script setup>, <script vapor>, or <script setup vapor>.`);
1504
+ err.loc = descriptor.script.loc;
1505
+ errors.push(err);
1506
+ }
1507
+ }
1711
1508
  if (!descriptor.template && !descriptor.script && !descriptor.scriptSetup) errors.push(/* @__PURE__ */ new SyntaxError(`At least one <template> or <script> is required in a single file component. ${descriptor.filename}`));
1712
1509
  if (descriptor.scriptSetup) {
1713
1510
  if (descriptor.scriptSetup.src) {
@@ -1838,9 +1635,8 @@ function hmrShouldReload(prevImports, next) {
1838
1635
  function dedent(s) {
1839
1636
  const lines = s.split("\n");
1840
1637
  const minIndent = lines.reduce(function(minIndent, line) {
1841
- var _line$match;
1842
1638
  if (line.trim() === "") return minIndent;
1843
- const indent = ((_line$match = line.match(/^\s*/)) === null || _line$match === void 0 || (_line$match = _line$match[0]) === null || _line$match === void 0 ? void 0 : _line$match.length) || 0;
1639
+ const indent = line.match(/^\s*/)?.[0]?.length || 0;
1844
1640
  return Math.min(indent, minIndent);
1845
1641
  }, Infinity);
1846
1642
  if (minIndent === 0) return [s, minIndent];
@@ -1899,7 +1695,7 @@ function parseUriParts(urlString) {
1899
1695
  * whether the component root itself owns an outer fragment wrapper.
1900
1696
  */
1901
1697
  function isMultiRoot(template, parserOptions) {
1902
- const preserveComments = (parserOptions === null || parserOptions === void 0 ? void 0 : parserOptions.comments) !== false;
1698
+ const preserveComments = parserOptions?.comments !== false;
1903
1699
  if (typeof template === "string") return countRootUnits(parse(`<template>${template}</template>`, {
1904
1700
  sourceMap: false,
1905
1701
  ignoreEmpty: false,
@@ -1990,8 +1786,7 @@ const createAssetUrlTransformWithOptions = (options) => {
1990
1786
  return (node, context) => transformAssetUrl(node, context, options);
1991
1787
  };
1992
1788
  function canTransformHashImport(tag, attrName) {
1993
- var _resourceUrlTagConfig;
1994
- return !!((_resourceUrlTagConfig = resourceUrlTagConfig[tag]) === null || _resourceUrlTagConfig === void 0 ? void 0 : _resourceUrlTagConfig.includes(attrName));
1789
+ return !!resourceUrlTagConfig[tag]?.includes(attrName);
1995
1790
  }
1996
1791
  /**
1997
1792
  * A `@vue/compiler-core` plugin that transforms relative asset urls into
@@ -3579,7 +3374,7 @@ function doCompileTemplate({ filename, id, scoped, slotted, inMap, source, ast:
3579
3374
  }
3580
3375
  const tips = warnings.map((w) => {
3581
3376
  let msg = w.message;
3582
- if (w.loc) msg += `\n${(0, _vue_shared.generateCodeFrame)((inAST === null || inAST === void 0 ? void 0 : inAST.source) || source, w.loc.start.offset, w.loc.end.offset)}`;
3377
+ if (w.loc) msg += `\n${(0, _vue_shared.generateCodeFrame)(inAST?.source || source, w.loc.start.offset, w.loc.end.offset)}`;
3583
3378
  return msg;
3584
3379
  });
3585
3380
  return {
@@ -7146,9 +6941,8 @@ function isSpaceCombinator(node) {
7146
6941
  return node.type === "combinator" && /^\s+$/.test(node.value);
7147
6942
  }
7148
6943
  function isDeepSelector(node) {
7149
- var _nodes;
7150
6944
  if (node.type === "pseudo" && (node.value === ":deep" || node.value === "::v-deep")) return true;
7151
- return !!((_nodes = node.nodes) === null || _nodes === void 0 ? void 0 : _nodes.some((child) => isDeepSelector(child)));
6945
+ return !!node.nodes?.some((child) => isDeepSelector(child));
7152
6946
  }
7153
6947
  function isDeepContainerPseudo(node) {
7154
6948
  return node.type === "pseudo" && (node.value === ":is" || node.value === ":where" || node.value === ":has" || node.value === ":not");
@@ -9347,7 +9141,7 @@ const processors = {
9347
9141
  stylus: styl
9348
9142
  };
9349
9143
  //#endregion
9350
- //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.28/node_modules/postcss-modules/build/fs.js
9144
+ //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.29/node_modules/postcss-modules/build/fs.js
9351
9145
  var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
9352
9146
  Object.defineProperty(exports, "__esModule", { value: true });
9353
9147
  exports.getFileSystem = getFileSystem;
@@ -9369,7 +9163,7 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
9369
9163
  }
9370
9164
  }));
9371
9165
  //#endregion
9372
- //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.28/node_modules/postcss-modules/build/unquote.js
9166
+ //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.29/node_modules/postcss-modules/build/unquote.js
9373
9167
  var require_unquote = /* @__PURE__ */ __commonJSMin(((exports) => {
9374
9168
  Object.defineProperty(exports, "__esModule", { value: true });
9375
9169
  exports.default = unquote;
@@ -9382,7 +9176,7 @@ var require_unquote = /* @__PURE__ */ __commonJSMin(((exports) => {
9382
9176
  }
9383
9177
  }));
9384
9178
  //#endregion
9385
- //#region node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.28/node_modules/icss-utils/src/replaceValueSymbols.js
9179
+ //#region node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.29/node_modules/icss-utils/src/replaceValueSymbols.js
9386
9180
  var require_replaceValueSymbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9387
9181
  const matchValueName = /[$]?[\w-]+/g;
9388
9182
  const replaceValueSymbols = (value, replacements) => {
@@ -9399,7 +9193,7 @@ var require_replaceValueSymbols = /* @__PURE__ */ __commonJSMin(((exports, modul
9399
9193
  module.exports = replaceValueSymbols;
9400
9194
  }));
9401
9195
  //#endregion
9402
- //#region node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.28/node_modules/icss-utils/src/replaceSymbols.js
9196
+ //#region node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.29/node_modules/icss-utils/src/replaceSymbols.js
9403
9197
  var require_replaceSymbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9404
9198
  const replaceValueSymbols = require_replaceValueSymbols();
9405
9199
  const replaceSymbols = (css, replacements) => {
@@ -9412,7 +9206,7 @@ var require_replaceSymbols = /* @__PURE__ */ __commonJSMin(((exports, module) =>
9412
9206
  module.exports = replaceSymbols;
9413
9207
  }));
9414
9208
  //#endregion
9415
- //#region node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.28/node_modules/icss-utils/src/extractICSS.js
9209
+ //#region node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.29/node_modules/icss-utils/src/extractICSS.js
9416
9210
  var require_extractICSS = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9417
9211
  const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
9418
9212
  const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/;
@@ -9466,7 +9260,7 @@ var require_extractICSS = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9466
9260
  module.exports = extractICSS;
9467
9261
  }));
9468
9262
  //#endregion
9469
- //#region node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.28/node_modules/icss-utils/src/createICSSRules.js
9263
+ //#region node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.29/node_modules/icss-utils/src/createICSSRules.js
9470
9264
  var require_createICSSRules = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9471
9265
  const createImports = (imports, postcss, mode = "rule") => {
9472
9266
  return Object.keys(imports).map((path) => {
@@ -9510,7 +9304,7 @@ var require_createICSSRules = /* @__PURE__ */ __commonJSMin(((exports, module) =
9510
9304
  module.exports = createICSSRules;
9511
9305
  }));
9512
9306
  //#endregion
9513
- //#region node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.28/node_modules/icss-utils/src/index.js
9307
+ //#region node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.29/node_modules/icss-utils/src/index.js
9514
9308
  var require_src$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9515
9309
  module.exports = {
9516
9310
  replaceValueSymbols: require_replaceValueSymbols(),
@@ -9520,7 +9314,7 @@ var require_src$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9520
9314
  };
9521
9315
  }));
9522
9316
  //#endregion
9523
- //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.28/node_modules/postcss-modules/build/Parser.js
9317
+ //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.29/node_modules/postcss-modules/build/Parser.js
9524
9318
  var require_Parser = /* @__PURE__ */ __commonJSMin(((exports) => {
9525
9319
  Object.defineProperty(exports, "__esModule", { value: true });
9526
9320
  exports.default = void 0;
@@ -9588,7 +9382,7 @@ var require_Parser = /* @__PURE__ */ __commonJSMin(((exports) => {
9588
9382
  exports.default = Parser;
9589
9383
  }));
9590
9384
  //#endregion
9591
- //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.28/node_modules/postcss-modules/build/saveJSON.js
9385
+ //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.29/node_modules/postcss-modules/build/saveJSON.js
9592
9386
  var require_saveJSON = /* @__PURE__ */ __commonJSMin(((exports) => {
9593
9387
  Object.defineProperty(exports, "__esModule", { value: true });
9594
9388
  exports.default = saveJSON;
@@ -10269,7 +10063,7 @@ var require_lodash_camelcase = /* @__PURE__ */ __commonJSMin(((exports, module)
10269
10063
  module.exports = camelCase;
10270
10064
  }));
10271
10065
  //#endregion
10272
- //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.28/node_modules/postcss-modules/build/localsConvention.js
10066
+ //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.29/node_modules/postcss-modules/build/localsConvention.js
10273
10067
  var require_localsConvention = /* @__PURE__ */ __commonJSMin(((exports) => {
10274
10068
  Object.defineProperty(exports, "__esModule", { value: true });
10275
10069
  exports.makeLocalsConventionReducer = makeLocalsConventionReducer;
@@ -10307,7 +10101,7 @@ var require_localsConvention = /* @__PURE__ */ __commonJSMin(((exports) => {
10307
10101
  }
10308
10102
  }));
10309
10103
  //#endregion
10310
- //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.28/node_modules/postcss-modules/build/FileSystemLoader.js
10104
+ //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.29/node_modules/postcss-modules/build/FileSystemLoader.js
10311
10105
  var require_FileSystemLoader = /* @__PURE__ */ __commonJSMin(((exports) => {
10312
10106
  Object.defineProperty(exports, "__esModule", { value: true });
10313
10107
  exports.default = void 0;
@@ -10392,7 +10186,7 @@ var require_FileSystemLoader = /* @__PURE__ */ __commonJSMin(((exports) => {
10392
10186
  exports.default = FileSystemLoader;
10393
10187
  }));
10394
10188
  //#endregion
10395
- //#region node_modules/.pnpm/postcss-modules-extract-imports@3.1.0_postcss@8.5.28/node_modules/postcss-modules-extract-imports/src/topologicalSort.js
10189
+ //#region node_modules/.pnpm/postcss-modules-extract-imports@3.1.0_postcss@8.5.29/node_modules/postcss-modules-extract-imports/src/topologicalSort.js
10396
10190
  var require_topologicalSort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10397
10191
  const PERMANENT_MARKER = 2;
10398
10192
  const TEMPORARY_MARKER = 1;
@@ -10431,7 +10225,7 @@ var require_topologicalSort = /* @__PURE__ */ __commonJSMin(((exports, module) =
10431
10225
  module.exports = topologicalSort;
10432
10226
  }));
10433
10227
  //#endregion
10434
- //#region node_modules/.pnpm/postcss-modules-extract-imports@3.1.0_postcss@8.5.28/node_modules/postcss-modules-extract-imports/src/index.js
10228
+ //#region node_modules/.pnpm/postcss-modules-extract-imports@3.1.0_postcss@8.5.29/node_modules/postcss-modules-extract-imports/src/index.js
10435
10229
  var require_src$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10436
10230
  const topologicalSort = require_topologicalSort();
10437
10231
  const matchImports = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/;
@@ -11354,7 +11148,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11354
11148
  module.exports = ValueParser;
11355
11149
  }));
11356
11150
  //#endregion
11357
- //#region node_modules/.pnpm/postcss-modules-local-by-default@4.2.0_postcss@8.5.28/node_modules/postcss-modules-local-by-default/src/index.js
11151
+ //#region node_modules/.pnpm/postcss-modules-local-by-default@4.2.0_postcss@8.5.29/node_modules/postcss-modules-local-by-default/src/index.js
11358
11152
  var require_src$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11359
11153
  const selectorParser = require_dist();
11360
11154
  const valueParser = require_lib();
@@ -11751,7 +11545,7 @@ var require_src$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11751
11545
  module.exports.postcss = true;
11752
11546
  }));
11753
11547
  //#endregion
11754
- //#region node_modules/.pnpm/postcss-modules-scope@3.2.1_postcss@8.5.28/node_modules/postcss-modules-scope/src/index.js
11548
+ //#region node_modules/.pnpm/postcss-modules-scope@3.2.1_postcss@8.5.29/node_modules/postcss-modules-scope/src/index.js
11755
11549
  var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11756
11550
  const selectorParser = require_dist();
11757
11551
  const hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -11929,7 +11723,7 @@ var require_string_hash = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11929
11723
  module.exports = hash;
11930
11724
  }));
11931
11725
  //#endregion
11932
- //#region node_modules/.pnpm/postcss-modules-values@4.0.0_postcss@8.5.28/node_modules/postcss-modules-values/src/index.js
11726
+ //#region node_modules/.pnpm/postcss-modules-values@4.0.0_postcss@8.5.29/node_modules/postcss-modules-values/src/index.js
11933
11727
  var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11934
11728
  const ICSSUtils = require_src$4();
11935
11729
  const matchImports = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/;
@@ -12016,7 +11810,7 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12016
11810
  module.exports.postcss = true;
12017
11811
  }));
12018
11812
  //#endregion
12019
- //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.28/node_modules/postcss-modules/build/scoping.js
11813
+ //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.29/node_modules/postcss-modules/build/scoping.js
12020
11814
  var require_scoping = /* @__PURE__ */ __commonJSMin(((exports) => {
12021
11815
  Object.defineProperty(exports, "__esModule", { value: true });
12022
11816
  exports.behaviours = void 0;
@@ -12078,7 +11872,7 @@ var require_scoping = /* @__PURE__ */ __commonJSMin(((exports) => {
12078
11872
  }
12079
11873
  }));
12080
11874
  //#endregion
12081
- //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.28/node_modules/postcss-modules/build/pluginFactory.js
11875
+ //#region node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.29/node_modules/postcss-modules/build/pluginFactory.js
12082
11876
  var require_pluginFactory = /* @__PURE__ */ __commonJSMin(((exports) => {
12083
11877
  Object.defineProperty(exports, "__esModule", { value: true });
12084
11878
  exports.makePlugin = makePlugin;
@@ -12376,7 +12170,6 @@ var ScriptCompileContext = class {
12376
12170
  return `_${key}`;
12377
12171
  }
12378
12172
  constructor(descriptor, options) {
12379
- var _descriptor$scriptSet, _descriptor$scriptSet2;
12380
12173
  this.descriptor = descriptor;
12381
12174
  this.options = options;
12382
12175
  this.isCE = false;
@@ -12399,8 +12192,8 @@ var ScriptCompileContext = class {
12399
12192
  this.source = descriptor.source;
12400
12193
  this.filename = descriptor.filename;
12401
12194
  this.s = new magic_string.default(descriptor.source);
12402
- this.startOffset = (_descriptor$scriptSet = descriptor.scriptSetup) === null || _descriptor$scriptSet === void 0 ? void 0 : _descriptor$scriptSet.loc.start.offset;
12403
- this.endOffset = (_descriptor$scriptSet2 = descriptor.scriptSetup) === null || _descriptor$scriptSet2 === void 0 ? void 0 : _descriptor$scriptSet2.loc.end.offset;
12195
+ this.startOffset = descriptor.scriptSetup?.loc.start.offset;
12196
+ this.endOffset = descriptor.scriptSetup?.loc.end.offset;
12404
12197
  this.isJS = isJS(scriptLang, scriptSetupLang);
12405
12198
  this.isTS = isTS(scriptLang, scriptSetupLang);
12406
12199
  const customElement = options.customElement;
@@ -12527,12 +12320,11 @@ function processNormalScript(ctx, scopeId) {
12527
12320
  const { cssVars } = ctx.descriptor;
12528
12321
  const { genDefaultAs, isProd } = ctx.options;
12529
12322
  if (cssVars.length || genDefaultAs) {
12530
- var _ctx$options$template;
12531
12323
  const defaultVar = genDefaultAs || normalScriptDefaultVar;
12532
12324
  const s = new magic_string.default(content);
12533
12325
  rewriteDefaultAST(scriptAst.body, s, defaultVar);
12534
12326
  content = s.toString();
12535
- if (cssVars.length && !((_ctx$options$template = ctx.options.templateOptions) === null || _ctx$options$template === void 0 ? void 0 : _ctx$options$template.ssr)) content += genNormalScriptCssVarsCode(cssVars, bindings, scopeId, !!isProd, defaultVar);
12327
+ if (cssVars.length && !ctx.options.templateOptions?.ssr) content += genNormalScriptCssVarsCode(cssVars, bindings, scopeId, !!isProd, defaultVar);
12536
12328
  if (!genDefaultAs) content += `\nexport default ${defaultVar}`;
12537
12329
  }
12538
12330
  return {
@@ -12937,8 +12729,6 @@ const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}
12937
12729
  };
12938
12730
  //#endregion
12939
12731
  //#region node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/ast.js
12940
- var _AST;
12941
- let _Symbol$for;
12942
12732
  var _a;
12943
12733
  const types = /* @__PURE__ */ new Set([
12944
12734
  "!",
@@ -13005,112 +12795,118 @@ const qmark = "[^/]";
13005
12795
  const star$1 = "[^/]*?";
13006
12796
  const starNoEmpty = "[^/]+?";
13007
12797
  let ID = 0;
13008
- var _root = /* @__PURE__ */ new WeakMap();
13009
- var _hasMagic2 = /* @__PURE__ */ new WeakMap();
13010
- var _uflag = /* @__PURE__ */ new WeakMap();
13011
- var _parts = /* @__PURE__ */ new WeakMap();
13012
- var _parent = /* @__PURE__ */ new WeakMap();
13013
- var _parentIndex = /* @__PURE__ */ new WeakMap();
13014
- var _negs = /* @__PURE__ */ new WeakMap();
13015
- var _filledNegs = /* @__PURE__ */ new WeakMap();
13016
- var _options = /* @__PURE__ */ new WeakMap();
13017
- var _toString = /* @__PURE__ */ new WeakMap();
13018
- var _emptyExt = /* @__PURE__ */ new WeakMap();
13019
- var _AST_brand = /* @__PURE__ */ new WeakSet();
13020
- _Symbol$for = Symbol.for("nodejs.util.inspect.custom");
13021
- var AST = class AST {
12798
+ var AST = class {
12799
+ type;
12800
+ #root;
12801
+ #hasMagic;
12802
+ #uflag = false;
12803
+ #parts = [];
12804
+ #parent;
12805
+ #parentIndex;
12806
+ #negs;
12807
+ #filledNegs = false;
12808
+ #options;
12809
+ #toString;
12810
+ #emptyExt = false;
12811
+ id = ++ID;
13022
12812
  get depth() {
13023
- var _this$parent$depth, _classPrivateFieldGet2$1;
13024
- return ((_this$parent$depth = (_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_parent, this)) === null || _classPrivateFieldGet2$1 === void 0 ? void 0 : _classPrivateFieldGet2$1.depth) !== null && _this$parent$depth !== void 0 ? _this$parent$depth : -1) + 1;
12813
+ return (this.#parent?.depth ?? -1) + 1;
13025
12814
  }
13026
- [_Symbol$for]() {
13027
- var _classPrivateFieldGet3;
12815
+ [Symbol.for("nodejs.util.inspect.custom")]() {
13028
12816
  return {
13029
12817
  "@@type": "AST",
13030
12818
  id: this.id,
13031
12819
  type: this.type,
13032
- root: _classPrivateFieldGet2(_root, this).id,
13033
- parent: (_classPrivateFieldGet3 = _classPrivateFieldGet2(_parent, this)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.id,
12820
+ root: this.#root.id,
12821
+ parent: this.#parent?.id,
13034
12822
  depth: this.depth,
13035
- partsLength: _classPrivateFieldGet2(_parts, this).length,
13036
- parts: _classPrivateFieldGet2(_parts, this)
12823
+ partsLength: this.#parts.length,
12824
+ parts: this.#parts
13037
12825
  };
13038
12826
  }
13039
12827
  constructor(type, parent, options = {}) {
13040
- _classPrivateMethodInitSpec(this, _AST_brand);
13041
- _defineProperty(this, "type", void 0);
13042
- _classPrivateFieldInitSpec(this, _root, void 0);
13043
- _classPrivateFieldInitSpec(this, _hasMagic2, void 0);
13044
- _classPrivateFieldInitSpec(this, _uflag, false);
13045
- _classPrivateFieldInitSpec(this, _parts, []);
13046
- _classPrivateFieldInitSpec(this, _parent, void 0);
13047
- _classPrivateFieldInitSpec(this, _parentIndex, void 0);
13048
- _classPrivateFieldInitSpec(this, _negs, void 0);
13049
- _classPrivateFieldInitSpec(this, _filledNegs, false);
13050
- _classPrivateFieldInitSpec(this, _options, void 0);
13051
- _classPrivateFieldInitSpec(this, _toString, void 0);
13052
- _classPrivateFieldInitSpec(this, _emptyExt, false);
13053
- _defineProperty(this, "id", ++ID);
13054
12828
  this.type = type;
13055
- if (type) _classPrivateFieldSet2(_hasMagic2, this, true);
13056
- _classPrivateFieldSet2(_parent, this, parent);
13057
- _classPrivateFieldSet2(_root, this, _classPrivateFieldGet2(_parent, this) ? _classPrivateFieldGet2(_root, _classPrivateFieldGet2(_parent, this)) : this);
13058
- _classPrivateFieldSet2(_options, this, _classPrivateFieldGet2(_root, this) === this ? options : _classPrivateFieldGet2(_options, _classPrivateFieldGet2(_root, this)));
13059
- _classPrivateFieldSet2(_negs, this, _classPrivateFieldGet2(_root, this) === this ? [] : _classPrivateFieldGet2(_negs, _classPrivateFieldGet2(_root, this)));
13060
- if (type === "!" && !_classPrivateFieldGet2(_filledNegs, _classPrivateFieldGet2(_root, this))) _classPrivateFieldGet2(_negs, this).push(this);
13061
- _classPrivateFieldSet2(_parentIndex, this, _classPrivateFieldGet2(_parent, this) ? _classPrivateFieldGet2(_parts, _classPrivateFieldGet2(_parent, this)).length : 0);
12829
+ if (type) this.#hasMagic = true;
12830
+ this.#parent = parent;
12831
+ this.#root = this.#parent ? this.#parent.#root : this;
12832
+ this.#options = this.#root === this ? options : this.#root.#options;
12833
+ this.#negs = this.#root === this ? [] : this.#root.#negs;
12834
+ if (type === "!" && !this.#root.#filledNegs) this.#negs.push(this);
12835
+ this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
13062
12836
  }
13063
12837
  get hasMagic() {
13064
12838
  /* c8 ignore start */
13065
- if (_classPrivateFieldGet2(_hasMagic2, this) !== void 0) return _classPrivateFieldGet2(_hasMagic2, this);
12839
+ if (this.#hasMagic !== void 0) return this.#hasMagic;
13066
12840
  /* c8 ignore stop */
13067
- for (const p of _classPrivateFieldGet2(_parts, this)) {
12841
+ for (const p of this.#parts) {
13068
12842
  if (typeof p === "string") continue;
13069
- if (p.type || p.hasMagic) return _classPrivateFieldSet2(_hasMagic2, this, true);
12843
+ if (p.type || p.hasMagic) return this.#hasMagic = true;
13070
12844
  }
13071
- return _classPrivateFieldGet2(_hasMagic2, this);
12845
+ return this.#hasMagic;
13072
12846
  }
13073
12847
  toString() {
13074
- return _classPrivateFieldGet2(_toString, this) !== void 0 ? _classPrivateFieldGet2(_toString, this) : !this.type ? _classPrivateFieldSet2(_toString, this, _classPrivateFieldGet2(_parts, this).map((p) => String(p)).join("")) : _classPrivateFieldSet2(_toString, this, this.type + "(" + _classPrivateFieldGet2(_parts, this).map((p) => String(p)).join("|") + ")");
12848
+ return this.#toString !== void 0 ? this.#toString : !this.type ? this.#toString = this.#parts.map((p) => String(p)).join("") : this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
12849
+ }
12850
+ #fillNegs() {
12851
+ /* c8 ignore start */
12852
+ if (this !== this.#root) throw new Error("should only call on root");
12853
+ if (this.#filledNegs) return this;
12854
+ /* c8 ignore stop */
12855
+ this.toString();
12856
+ this.#filledNegs = true;
12857
+ let n;
12858
+ while (n = this.#negs.pop()) {
12859
+ if (n.type !== "!") continue;
12860
+ let p = n;
12861
+ let pp = p.#parent;
12862
+ while (pp) {
12863
+ for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) for (const part of n.#parts) {
12864
+ /* c8 ignore start */
12865
+ if (typeof part === "string") throw new Error("string part in extglob AST??");
12866
+ /* c8 ignore stop */
12867
+ part.copyIn(pp.#parts[i]);
12868
+ }
12869
+ p = pp;
12870
+ pp = p.#parent;
12871
+ }
12872
+ }
12873
+ return this;
13075
12874
  }
13076
12875
  push(...parts) {
13077
12876
  for (const p of parts) {
13078
12877
  if (p === "") continue;
13079
12878
  /* c8 ignore start */
13080
- if (typeof p !== "string" && !(p instanceof _a && _classPrivateFieldGet2(_parent, p) === this)) throw new Error("invalid part: " + p);
12879
+ if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) throw new Error("invalid part: " + p);
13081
12880
  /* c8 ignore stop */
13082
- _classPrivateFieldGet2(_parts, this).push(p);
12881
+ this.#parts.push(p);
13083
12882
  }
13084
12883
  }
13085
12884
  toJSON() {
13086
- var _classPrivateFieldGet4;
13087
- const ret = this.type === null ? _classPrivateFieldGet2(_parts, this).slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ..._classPrivateFieldGet2(_parts, this).map((p) => p.toJSON())];
12885
+ const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
13088
12886
  if (this.isStart() && !this.type) ret.unshift([]);
13089
- if (this.isEnd() && (this === _classPrivateFieldGet2(_root, this) || _classPrivateFieldGet2(_filledNegs, _classPrivateFieldGet2(_root, this)) && ((_classPrivateFieldGet4 = _classPrivateFieldGet2(_parent, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.type) === "!")) ret.push({});
12887
+ if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) ret.push({});
13090
12888
  return ret;
13091
12889
  }
13092
12890
  isStart() {
13093
- var _classPrivateFieldGet5;
13094
- if (_classPrivateFieldGet2(_root, this) === this) return true;
13095
- if (!((_classPrivateFieldGet5 = _classPrivateFieldGet2(_parent, this)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.isStart())) return false;
13096
- if (_classPrivateFieldGet2(_parentIndex, this) === 0) return true;
13097
- const p = _classPrivateFieldGet2(_parent, this);
13098
- for (let i = 0; i < _classPrivateFieldGet2(_parentIndex, this); i++) {
13099
- const pp = _classPrivateFieldGet2(_parts, p)[i];
12891
+ if (this.#root === this) return true;
12892
+ if (!this.#parent?.isStart()) return false;
12893
+ if (this.#parentIndex === 0) return true;
12894
+ const p = this.#parent;
12895
+ for (let i = 0; i < this.#parentIndex; i++) {
12896
+ const pp = p.#parts[i];
13100
12897
  if (!(pp instanceof _a && pp.type === "!")) return false;
13101
12898
  }
13102
12899
  return true;
13103
12900
  }
13104
12901
  isEnd() {
13105
- var _classPrivateFieldGet6, _classPrivateFieldGet7, _classPrivateFieldGet8;
13106
- if (_classPrivateFieldGet2(_root, this) === this) return true;
13107
- if (((_classPrivateFieldGet6 = _classPrivateFieldGet2(_parent, this)) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.type) === "!") return true;
13108
- if (!((_classPrivateFieldGet7 = _classPrivateFieldGet2(_parent, this)) === null || _classPrivateFieldGet7 === void 0 ? void 0 : _classPrivateFieldGet7.isEnd())) return false;
13109
- if (!this.type) return (_classPrivateFieldGet8 = _classPrivateFieldGet2(_parent, this)) === null || _classPrivateFieldGet8 === void 0 ? void 0 : _classPrivateFieldGet8.isEnd();
12902
+ if (this.#root === this) return true;
12903
+ if (this.#parent?.type === "!") return true;
12904
+ if (!this.#parent?.isEnd()) return false;
12905
+ if (!this.type) return this.#parent?.isEnd();
13110
12906
  /* c8 ignore start */
13111
- const pl = _classPrivateFieldGet2(_parent, this) ? _classPrivateFieldGet2(_parts, _classPrivateFieldGet2(_parent, this)).length : 0;
12907
+ const pl = this.#parent ? this.#parent.#parts.length : 0;
13112
12908
  /* c8 ignore stop */
13113
- return _classPrivateFieldGet2(_parentIndex, this) === pl - 1;
12909
+ return this.#parentIndex === pl - 1;
13114
12910
  }
13115
12911
  copyIn(part) {
13116
12912
  if (typeof part === "string") this.push(part);
@@ -13118,49 +12914,192 @@ var AST = class AST {
13118
12914
  }
13119
12915
  clone(parent) {
13120
12916
  const c = new _a(this.type, parent);
13121
- for (const p of _classPrivateFieldGet2(_parts, this)) c.copyIn(p);
12917
+ for (const p of this.#parts) c.copyIn(p);
13122
12918
  return c;
13123
12919
  }
12920
+ static #parseAST(str, ast, pos, opt, extDepth) {
12921
+ const maxDepth = opt.maxExtglobRecursion ?? 2;
12922
+ let escaping = false;
12923
+ let inBrace = false;
12924
+ let braceStart = -1;
12925
+ let braceNeg = false;
12926
+ if (ast.type === null) {
12927
+ let i = pos;
12928
+ let acc = "";
12929
+ while (i < str.length) {
12930
+ const c = str.charAt(i++);
12931
+ if (escaping || c === "\\") {
12932
+ escaping = !escaping;
12933
+ acc += c;
12934
+ continue;
12935
+ }
12936
+ if (inBrace) {
12937
+ if (i === braceStart + 1) {
12938
+ if (c === "^" || c === "!") braceNeg = true;
12939
+ } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
12940
+ acc += c;
12941
+ continue;
12942
+ } else if (c === "[") {
12943
+ inBrace = true;
12944
+ braceStart = i;
12945
+ braceNeg = false;
12946
+ acc += c;
12947
+ continue;
12948
+ }
12949
+ if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && extDepth <= maxDepth) {
12950
+ ast.push(acc);
12951
+ acc = "";
12952
+ const ext = new _a(c, ast);
12953
+ i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
12954
+ ast.push(ext);
12955
+ continue;
12956
+ }
12957
+ acc += c;
12958
+ }
12959
+ ast.push(acc);
12960
+ return i;
12961
+ }
12962
+ let i = pos + 1;
12963
+ let part = new _a(null, ast);
12964
+ const parts = [];
12965
+ let acc = "";
12966
+ while (i < str.length) {
12967
+ const c = str.charAt(i++);
12968
+ if (escaping || c === "\\") {
12969
+ escaping = !escaping;
12970
+ acc += c;
12971
+ continue;
12972
+ }
12973
+ if (inBrace) {
12974
+ if (i === braceStart + 1) {
12975
+ if (c === "^" || c === "!") braceNeg = true;
12976
+ } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
12977
+ acc += c;
12978
+ continue;
12979
+ } else if (c === "[") {
12980
+ inBrace = true;
12981
+ braceStart = i;
12982
+ braceNeg = false;
12983
+ acc += c;
12984
+ continue;
12985
+ }
12986
+ /* c8 ignore stop */
12987
+ if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && (extDepth <= maxDepth || ast && ast.#canAdoptType(c))) {
12988
+ const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
12989
+ part.push(acc);
12990
+ acc = "";
12991
+ const ext = new _a(c, part);
12992
+ part.push(ext);
12993
+ i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
12994
+ continue;
12995
+ }
12996
+ if (c === "|") {
12997
+ part.push(acc);
12998
+ acc = "";
12999
+ parts.push(part);
13000
+ part = new _a(null, ast);
13001
+ continue;
13002
+ }
13003
+ if (c === ")") {
13004
+ if (acc === "" && ast.#parts.length === 0) ast.#emptyExt = true;
13005
+ part.push(acc);
13006
+ acc = "";
13007
+ ast.push(...parts, part);
13008
+ return i;
13009
+ }
13010
+ acc += c;
13011
+ }
13012
+ ast.type = null;
13013
+ ast.#hasMagic = void 0;
13014
+ ast.#parts = [str.substring(pos - 1)];
13015
+ return i;
13016
+ }
13017
+ #canAdoptWithSpace(child) {
13018
+ return this.#canAdopt(child, adoptionWithSpaceMap);
13019
+ }
13020
+ #canAdopt(child, map = adoptionMap) {
13021
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) return false;
13022
+ const gc = child.#parts[0];
13023
+ if (!gc || typeof gc !== "object" || gc.type === null) return false;
13024
+ return this.#canAdoptType(gc.type, map);
13025
+ }
13026
+ #canAdoptType(c, map = adoptionAnyMap) {
13027
+ return !!map.get(this.type)?.includes(c);
13028
+ }
13029
+ #adoptWithSpace(child, index) {
13030
+ const gc = child.#parts[0];
13031
+ const blank = new _a(null, gc, this.options);
13032
+ blank.#parts.push("");
13033
+ gc.push(blank);
13034
+ this.#adopt(child, index);
13035
+ }
13036
+ #adopt(child, index) {
13037
+ const gc = child.#parts[0];
13038
+ this.#parts.splice(index, 1, ...gc.#parts);
13039
+ for (const p of gc.#parts) if (typeof p === "object") p.#parent = this;
13040
+ this.#toString = void 0;
13041
+ }
13042
+ #canUsurpType(c) {
13043
+ return !!usurpMap.get(this.type)?.has(c);
13044
+ }
13045
+ #canUsurp(child) {
13046
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) return false;
13047
+ const gc = child.#parts[0];
13048
+ if (!gc || typeof gc !== "object" || gc.type === null) return false;
13049
+ return this.#canUsurpType(gc.type);
13050
+ }
13051
+ #usurp(child) {
13052
+ const m = usurpMap.get(this.type);
13053
+ const gc = child.#parts[0];
13054
+ const nt = m?.get(gc.type);
13055
+ /* c8 ignore start - impossible */
13056
+ if (!nt) return false;
13057
+ /* c8 ignore stop */
13058
+ this.#parts = gc.#parts;
13059
+ for (const p of this.#parts) if (typeof p === "object") p.#parent = this;
13060
+ this.type = nt;
13061
+ this.#toString = void 0;
13062
+ this.#emptyExt = false;
13063
+ }
13124
13064
  static fromGlob(pattern, options = {}) {
13125
13065
  const ast = new _a(null, void 0, options);
13126
- _assertClassBrand(AST, _a, _parseAST).call(_a, pattern, ast, 0, options, 0);
13066
+ _a.#parseAST(pattern, ast, 0, options, 0);
13127
13067
  return ast;
13128
13068
  }
13129
13069
  toMMPattern() {
13130
13070
  /* c8 ignore start */
13131
- if (this !== _classPrivateFieldGet2(_root, this)) return _classPrivateFieldGet2(_root, this).toMMPattern();
13071
+ if (this !== this.#root) return this.#root.toMMPattern();
13132
13072
  /* c8 ignore stop */
13133
13073
  const glob = this.toString();
13134
13074
  const [re, body, hasMagic, uflag] = this.toRegExpSource();
13135
- if (!(hasMagic || _classPrivateFieldGet2(_hasMagic2, this) || _classPrivateFieldGet2(_options, this).nocase && !_classPrivateFieldGet2(_options, this).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase())) return body;
13136
- const flags = (_classPrivateFieldGet2(_options, this).nocase ? "i" : "") + (uflag ? "u" : "");
13075
+ if (!(hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase())) return body;
13076
+ const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
13137
13077
  return Object.assign(new RegExp(`^${re}$`, flags), {
13138
13078
  _src: re,
13139
13079
  _glob: glob
13140
13080
  });
13141
13081
  }
13142
13082
  get options() {
13143
- return _classPrivateFieldGet2(_options, this);
13083
+ return this.#options;
13144
13084
  }
13145
13085
  toRegExpSource(allowDot) {
13146
- const dot = allowDot !== null && allowDot !== void 0 ? allowDot : !!_classPrivateFieldGet2(_options, this).dot;
13147
- if (_classPrivateFieldGet2(_root, this) === this) {
13148
- _assertClassBrand(_AST_brand, this, _flatten).call(this);
13149
- _assertClassBrand(_AST_brand, this, _fillNegs).call(this);
13086
+ const dot = allowDot ?? !!this.#options.dot;
13087
+ if (this.#root === this) {
13088
+ this.#flatten();
13089
+ this.#fillNegs();
13150
13090
  }
13151
13091
  if (!isExtglobAST(this)) {
13152
- var _classPrivateFieldGet9;
13153
- const noEmpty = this.isStart() && this.isEnd() && !_classPrivateFieldGet2(_parts, this).some((s) => typeof s !== "string");
13154
- const src = _classPrivateFieldGet2(_parts, this).map((p) => {
13155
- const [re, _, hasMagic, uflag] = typeof p === "string" ? _assertClassBrand(AST, _a, _parseGlob).call(_a, p, _classPrivateFieldGet2(_hasMagic2, this), noEmpty) : p.toRegExpSource(allowDot);
13156
- _classPrivateFieldSet2(_hasMagic2, this, _classPrivateFieldGet2(_hasMagic2, this) || hasMagic);
13157
- _classPrivateFieldSet2(_uflag, this, _classPrivateFieldGet2(_uflag, this) || uflag);
13092
+ const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
13093
+ const src = this.#parts.map((p) => {
13094
+ const [re, _, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
13095
+ this.#hasMagic = this.#hasMagic || hasMagic;
13096
+ this.#uflag = this.#uflag || uflag;
13158
13097
  return re;
13159
13098
  }).join("");
13160
13099
  let start = "";
13161
13100
  if (this.isStart()) {
13162
- if (typeof _classPrivateFieldGet2(_parts, this)[0] === "string") {
13163
- if (!(_classPrivateFieldGet2(_parts, this).length === 1 && justDots.has(_classPrivateFieldGet2(_parts, this)[0]))) {
13101
+ if (typeof this.#parts[0] === "string") {
13102
+ if (!(this.#parts.length === 1 && justDots.has(this.#parts[0]))) {
13164
13103
  const aps = addPatternStart;
13165
13104
  const needNoTrav = dot && aps.has(src.charAt(0)) || src.startsWith("\\.") && aps.has(src.charAt(2)) || src.startsWith("\\.\\.") && aps.has(src.charAt(4));
13166
13105
  const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
@@ -13169,23 +13108,23 @@ var AST = class AST {
13169
13108
  }
13170
13109
  }
13171
13110
  let end = "";
13172
- if (this.isEnd() && _classPrivateFieldGet2(_filledNegs, _classPrivateFieldGet2(_root, this)) && ((_classPrivateFieldGet9 = _classPrivateFieldGet2(_parent, this)) === null || _classPrivateFieldGet9 === void 0 ? void 0 : _classPrivateFieldGet9.type) === "!") end = "(?:$|\\/)";
13111
+ if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") end = "(?:$|\\/)";
13173
13112
  return [
13174
13113
  start + src + end,
13175
13114
  unescape(src),
13176
- _classPrivateFieldSet2(_hasMagic2, this, !!_classPrivateFieldGet2(_hasMagic2, this)),
13177
- _classPrivateFieldGet2(_uflag, this)
13115
+ this.#hasMagic = !!this.#hasMagic,
13116
+ this.#uflag
13178
13117
  ];
13179
13118
  }
13180
13119
  const repeated = this.type === "*" || this.type === "+";
13181
13120
  const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
13182
- let body = _assertClassBrand(_AST_brand, this, _partsToRegExp).call(this, dot);
13121
+ let body = this.#partsToRegExp(dot);
13183
13122
  if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
13184
13123
  const s = this.toString();
13185
13124
  const me = this;
13186
- _classPrivateFieldSet2(_parts, me, [s]);
13125
+ me.#parts = [s];
13187
13126
  me.type = null;
13188
- _classPrivateFieldSet2(_hasMagic2, me, void 0);
13127
+ me.#hasMagic = void 0;
13189
13128
  return [
13190
13129
  s,
13191
13130
  unescape(this.toString()),
@@ -13193,11 +13132,11 @@ var AST = class AST {
13193
13132
  false
13194
13133
  ];
13195
13134
  }
13196
- let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : _assertClassBrand(_AST_brand, this, _partsToRegExp).call(this, true);
13135
+ let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : this.#partsToRegExp(true);
13197
13136
  if (bodyDotAllowed === body) bodyDotAllowed = "";
13198
13137
  if (bodyDotAllowed) body = `(?:${body})(?:${bodyDotAllowed})*?`;
13199
13138
  let final = "";
13200
- if (this.type === "!" && _classPrivateFieldGet2(_emptyExt, this)) final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
13139
+ if (this.type === "!" && this.#emptyExt) final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
13201
13140
  else {
13202
13141
  const close = this.type === "!" ? "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + "[^/]*?)" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
13203
13142
  final = start + body + close;
@@ -13205,270 +13144,97 @@ var AST = class AST {
13205
13144
  return [
13206
13145
  final,
13207
13146
  unescape(body),
13208
- _classPrivateFieldSet2(_hasMagic2, this, !!_classPrivateFieldGet2(_hasMagic2, this)),
13209
- _classPrivateFieldGet2(_uflag, this)
13147
+ this.#hasMagic = !!this.#hasMagic,
13148
+ this.#uflag
13210
13149
  ];
13211
13150
  }
13212
- };
13213
- _AST = AST;
13214
- function _fillNegs() {
13215
- /* c8 ignore start */
13216
- if (this !== _classPrivateFieldGet2(_root, this)) throw new Error("should only call on root");
13217
- if (_classPrivateFieldGet2(_filledNegs, this)) return this;
13218
- /* c8 ignore stop */
13219
- this.toString();
13220
- _classPrivateFieldSet2(_filledNegs, this, true);
13221
- let n;
13222
- while (n = _classPrivateFieldGet2(_negs, this).pop()) {
13223
- if (n.type !== "!") continue;
13224
- let p = n;
13225
- let pp = _classPrivateFieldGet2(_parent, p);
13226
- while (pp) {
13227
- for (let i = _classPrivateFieldGet2(_parentIndex, p) + 1; !pp.type && i < _classPrivateFieldGet2(_parts, pp).length; i++) for (const part of _classPrivateFieldGet2(_parts, n)) {
13228
- /* c8 ignore start */
13229
- if (typeof part === "string") throw new Error("string part in extglob AST??");
13230
- /* c8 ignore stop */
13231
- part.copyIn(_classPrivateFieldGet2(_parts, pp)[i]);
13232
- }
13233
- p = pp;
13234
- pp = _classPrivateFieldGet2(_parent, p);
13151
+ #flatten() {
13152
+ if (!isExtglobAST(this)) {
13153
+ for (const p of this.#parts) if (typeof p === "object") p.#flatten();
13154
+ } else {
13155
+ let iterations = 0;
13156
+ let done = false;
13157
+ do {
13158
+ done = true;
13159
+ for (let i = 0; i < this.#parts.length; i++) {
13160
+ const c = this.#parts[i];
13161
+ if (typeof c === "object") {
13162
+ c.#flatten();
13163
+ if (this.#canAdopt(c)) {
13164
+ done = false;
13165
+ this.#adopt(c, i);
13166
+ } else if (this.#canAdoptWithSpace(c)) {
13167
+ done = false;
13168
+ this.#adoptWithSpace(c, i);
13169
+ } else if (this.#canUsurp(c)) {
13170
+ done = false;
13171
+ this.#usurp(c);
13172
+ }
13173
+ }
13174
+ }
13175
+ } while (!done && ++iterations < 10);
13235
13176
  }
13177
+ this.#toString = void 0;
13236
13178
  }
13237
- return this;
13238
- }
13239
- function _parseAST(str, ast, pos, opt, extDepth) {
13240
- var _opt$maxExtglobRecurs;
13241
- const maxDepth = (_opt$maxExtglobRecurs = opt.maxExtglobRecursion) !== null && _opt$maxExtglobRecurs !== void 0 ? _opt$maxExtglobRecurs : 2;
13242
- let escaping = false;
13243
- let inBrace = false;
13244
- let braceStart = -1;
13245
- let braceNeg = false;
13246
- if (ast.type === null) {
13247
- let i = pos;
13248
- let acc = "";
13249
- while (i < str.length) {
13250
- const c = str.charAt(i++);
13251
- if (escaping || c === "\\") {
13252
- escaping = !escaping;
13253
- acc += c;
13179
+ #partsToRegExp(dot) {
13180
+ return this.#parts.map((p) => {
13181
+ /* c8 ignore start */
13182
+ if (typeof p === "string") throw new Error("string type in extglob ast??");
13183
+ /* c8 ignore stop */
13184
+ const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
13185
+ this.#uflag = this.#uflag || uflag;
13186
+ return re;
13187
+ }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
13188
+ }
13189
+ static #parseGlob(glob, hasMagic, noEmpty = false) {
13190
+ let escaping = false;
13191
+ let re = "";
13192
+ let uflag = false;
13193
+ let inStar = false;
13194
+ for (let i = 0; i < glob.length; i++) {
13195
+ const c = glob.charAt(i);
13196
+ if (escaping) {
13197
+ escaping = false;
13198
+ re += (reSpecials.has(c) ? "\\" : "") + c;
13254
13199
  continue;
13255
13200
  }
13256
- if (inBrace) {
13257
- if (i === braceStart + 1) {
13258
- if (c === "^" || c === "!") braceNeg = true;
13259
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
13260
- acc += c;
13201
+ if (c === "*") {
13202
+ if (inStar) continue;
13203
+ inStar = true;
13204
+ re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star$1;
13205
+ hasMagic = true;
13261
13206
  continue;
13262
- } else if (c === "[") {
13263
- inBrace = true;
13264
- braceStart = i;
13265
- braceNeg = false;
13266
- acc += c;
13267
- continue;
13268
- }
13269
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && extDepth <= maxDepth) {
13270
- ast.push(acc);
13271
- acc = "";
13272
- const ext = new _a(c, ast);
13273
- i = _assertClassBrand(_AST, _a, _parseAST).call(_a, str, ext, i, opt, extDepth + 1);
13274
- ast.push(ext);
13207
+ } else inStar = false;
13208
+ if (c === "\\") {
13209
+ if (i === glob.length - 1) re += "\\\\";
13210
+ else escaping = true;
13275
13211
  continue;
13276
13212
  }
13277
- acc += c;
13278
- }
13279
- ast.push(acc);
13280
- return i;
13281
- }
13282
- let i = pos + 1;
13283
- let part = new _a(null, ast);
13284
- const parts = [];
13285
- let acc = "";
13286
- while (i < str.length) {
13287
- const c = str.charAt(i++);
13288
- if (escaping || c === "\\") {
13289
- escaping = !escaping;
13290
- acc += c;
13291
- continue;
13292
- }
13293
- if (inBrace) {
13294
- if (i === braceStart + 1) {
13295
- if (c === "^" || c === "!") braceNeg = true;
13296
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
13297
- acc += c;
13298
- continue;
13299
- } else if (c === "[") {
13300
- inBrace = true;
13301
- braceStart = i;
13302
- braceNeg = false;
13303
- acc += c;
13304
- continue;
13305
- }
13306
- /* c8 ignore stop */
13307
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && (extDepth <= maxDepth || ast && _assertClassBrand(_AST_brand, ast, _canAdoptType).call(ast, c))) {
13308
- const depthAdd = ast && _assertClassBrand(_AST_brand, ast, _canAdoptType).call(ast, c) ? 0 : 1;
13309
- part.push(acc);
13310
- acc = "";
13311
- const ext = new _a(c, part);
13312
- part.push(ext);
13313
- i = _assertClassBrand(_AST, _a, _parseAST).call(_a, str, ext, i, opt, extDepth + depthAdd);
13314
- continue;
13315
- }
13316
- if (c === "|") {
13317
- part.push(acc);
13318
- acc = "";
13319
- parts.push(part);
13320
- part = new _a(null, ast);
13321
- continue;
13322
- }
13323
- if (c === ")") {
13324
- if (acc === "" && _classPrivateFieldGet2(_parts, ast).length === 0) _classPrivateFieldSet2(_emptyExt, ast, true);
13325
- part.push(acc);
13326
- acc = "";
13327
- ast.push(...parts, part);
13328
- return i;
13329
- }
13330
- acc += c;
13331
- }
13332
- ast.type = null;
13333
- _classPrivateFieldSet2(_hasMagic2, ast, void 0);
13334
- _classPrivateFieldSet2(_parts, ast, [str.substring(pos - 1)]);
13335
- return i;
13336
- }
13337
- function _canAdoptWithSpace(child) {
13338
- return _assertClassBrand(_AST_brand, this, _canAdopt).call(this, child, adoptionWithSpaceMap);
13339
- }
13340
- function _canAdopt(child, map = adoptionMap) {
13341
- if (!child || typeof child !== "object" || child.type !== null || _classPrivateFieldGet2(_parts, child).length !== 1 || this.type === null) return false;
13342
- const gc = _classPrivateFieldGet2(_parts, child)[0];
13343
- if (!gc || typeof gc !== "object" || gc.type === null) return false;
13344
- return _assertClassBrand(_AST_brand, this, _canAdoptType).call(this, gc.type, map);
13345
- }
13346
- function _canAdoptType(c, map = adoptionAnyMap) {
13347
- var _map$get;
13348
- return !!((_map$get = map.get(this.type)) === null || _map$get === void 0 ? void 0 : _map$get.includes(c));
13349
- }
13350
- function _adoptWithSpace(child, index) {
13351
- const gc = _classPrivateFieldGet2(_parts, child)[0];
13352
- const blank = new _a(null, gc, this.options);
13353
- _classPrivateFieldGet2(_parts, blank).push("");
13354
- gc.push(blank);
13355
- _assertClassBrand(_AST_brand, this, _adopt).call(this, child, index);
13356
- }
13357
- function _adopt(child, index) {
13358
- const gc = _classPrivateFieldGet2(_parts, child)[0];
13359
- _classPrivateFieldGet2(_parts, this).splice(index, 1, ..._classPrivateFieldGet2(_parts, gc));
13360
- for (const p of _classPrivateFieldGet2(_parts, gc)) if (typeof p === "object") _classPrivateFieldSet2(_parent, p, this);
13361
- _classPrivateFieldSet2(_toString, this, void 0);
13362
- }
13363
- function _canUsurpType(c) {
13364
- const m = usurpMap.get(this.type);
13365
- return !!(m === null || m === void 0 ? void 0 : m.has(c));
13366
- }
13367
- function _canUsurp(child) {
13368
- if (!child || typeof child !== "object" || child.type !== null || _classPrivateFieldGet2(_parts, child).length !== 1 || this.type === null || _classPrivateFieldGet2(_parts, this).length !== 1) return false;
13369
- const gc = _classPrivateFieldGet2(_parts, child)[0];
13370
- if (!gc || typeof gc !== "object" || gc.type === null) return false;
13371
- return _assertClassBrand(_AST_brand, this, _canUsurpType).call(this, gc.type);
13372
- }
13373
- function _usurp(child) {
13374
- const m = usurpMap.get(this.type);
13375
- const gc = _classPrivateFieldGet2(_parts, child)[0];
13376
- const nt = m === null || m === void 0 ? void 0 : m.get(gc.type);
13377
- /* c8 ignore start - impossible */
13378
- if (!nt) return false;
13379
- /* c8 ignore stop */
13380
- _classPrivateFieldSet2(_parts, this, _classPrivateFieldGet2(_parts, gc));
13381
- for (const p of _classPrivateFieldGet2(_parts, this)) if (typeof p === "object") _classPrivateFieldSet2(_parent, p, this);
13382
- this.type = nt;
13383
- _classPrivateFieldSet2(_toString, this, void 0);
13384
- _classPrivateFieldSet2(_emptyExt, this, false);
13385
- }
13386
- function _flatten() {
13387
- if (!isExtglobAST(this)) {
13388
- for (const p of _classPrivateFieldGet2(_parts, this)) if (typeof p === "object") _assertClassBrand(_AST_brand, p, _flatten).call(p);
13389
- } else {
13390
- let iterations = 0;
13391
- let done = false;
13392
- do {
13393
- done = true;
13394
- for (let i = 0; i < _classPrivateFieldGet2(_parts, this).length; i++) {
13395
- const c = _classPrivateFieldGet2(_parts, this)[i];
13396
- if (typeof c === "object") {
13397
- _assertClassBrand(_AST_brand, c, _flatten).call(c);
13398
- if (_assertClassBrand(_AST_brand, this, _canAdopt).call(this, c)) {
13399
- done = false;
13400
- _assertClassBrand(_AST_brand, this, _adopt).call(this, c, i);
13401
- } else if (_assertClassBrand(_AST_brand, this, _canAdoptWithSpace).call(this, c)) {
13402
- done = false;
13403
- _assertClassBrand(_AST_brand, this, _adoptWithSpace).call(this, c, i);
13404
- } else if (_assertClassBrand(_AST_brand, this, _canUsurp).call(this, c)) {
13405
- done = false;
13406
- _assertClassBrand(_AST_brand, this, _usurp).call(this, c);
13407
- }
13213
+ if (c === "[") {
13214
+ const [src, needUflag, consumed, magic] = parseClass(glob, i);
13215
+ if (consumed) {
13216
+ re += src;
13217
+ uflag = uflag || needUflag;
13218
+ i += consumed - 1;
13219
+ hasMagic = hasMagic || magic;
13220
+ continue;
13408
13221
  }
13409
13222
  }
13410
- } while (!done && ++iterations < 10);
13411
- }
13412
- _classPrivateFieldSet2(_toString, this, void 0);
13413
- }
13414
- function _partsToRegExp(dot) {
13415
- return _classPrivateFieldGet2(_parts, this).map((p) => {
13416
- /* c8 ignore start */
13417
- if (typeof p === "string") throw new Error("string type in extglob ast??");
13418
- /* c8 ignore stop */
13419
- const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
13420
- _classPrivateFieldSet2(_uflag, this, _classPrivateFieldGet2(_uflag, this) || uflag);
13421
- return re;
13422
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
13423
- }
13424
- function _parseGlob(glob, hasMagic, noEmpty = false) {
13425
- let escaping = false;
13426
- let re = "";
13427
- let uflag = false;
13428
- let inStar = false;
13429
- for (let i = 0; i < glob.length; i++) {
13430
- const c = glob.charAt(i);
13431
- if (escaping) {
13432
- escaping = false;
13433
- re += (reSpecials.has(c) ? "\\" : "") + c;
13434
- continue;
13435
- }
13436
- if (c === "*") {
13437
- if (inStar) continue;
13438
- inStar = true;
13439
- re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star$1;
13440
- hasMagic = true;
13441
- continue;
13442
- } else inStar = false;
13443
- if (c === "\\") {
13444
- if (i === glob.length - 1) re += "\\\\";
13445
- else escaping = true;
13446
- continue;
13447
- }
13448
- if (c === "[") {
13449
- const [src, needUflag, consumed, magic] = parseClass(glob, i);
13450
- if (consumed) {
13451
- re += src;
13452
- uflag = uflag || needUflag;
13453
- i += consumed - 1;
13454
- hasMagic = hasMagic || magic;
13223
+ if (c === "?") {
13224
+ re += qmark;
13225
+ hasMagic = true;
13455
13226
  continue;
13456
13227
  }
13228
+ re += regExpEscape$1(c);
13457
13229
  }
13458
- if (c === "?") {
13459
- re += qmark;
13460
- hasMagic = true;
13461
- continue;
13462
- }
13463
- re += regExpEscape$1(c);
13230
+ return [
13231
+ re,
13232
+ unescape(glob),
13233
+ !!hasMagic,
13234
+ uflag
13235
+ ];
13464
13236
  }
13465
- return [
13466
- re,
13467
- unescape(glob),
13468
- !!hasMagic,
13469
- uflag
13470
- ];
13471
- }
13237
+ };
13472
13238
  _a = AST;
13473
13239
  //#endregion
13474
13240
  //#region node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/escape.js
@@ -13610,33 +13376,30 @@ const match = (list, pattern, options = {}) => {
13610
13376
  minimatch.match = match;
13611
13377
  const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
13612
13378
  const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
13613
- var _Minimatch_brand = /* @__PURE__ */ new WeakSet();
13614
13379
  var Minimatch = class {
13380
+ options;
13381
+ set;
13382
+ pattern;
13383
+ windowsPathsNoEscape;
13384
+ nonegate;
13385
+ negate;
13386
+ comment;
13387
+ empty;
13388
+ preserveMultipleSlashes;
13389
+ partial;
13390
+ globSet;
13391
+ globParts;
13392
+ nocase;
13393
+ isWindows;
13394
+ platform;
13395
+ windowsNoMagicRoot;
13396
+ maxGlobstarRecursion;
13397
+ regexp;
13615
13398
  constructor(pattern, options = {}) {
13616
- var _options$maxGlobstarR;
13617
- _classPrivateMethodInitSpec(this, _Minimatch_brand);
13618
- _defineProperty(this, "options", void 0);
13619
- _defineProperty(this, "set", void 0);
13620
- _defineProperty(this, "pattern", void 0);
13621
- _defineProperty(this, "windowsPathsNoEscape", void 0);
13622
- _defineProperty(this, "nonegate", void 0);
13623
- _defineProperty(this, "negate", void 0);
13624
- _defineProperty(this, "comment", void 0);
13625
- _defineProperty(this, "empty", void 0);
13626
- _defineProperty(this, "preserveMultipleSlashes", void 0);
13627
- _defineProperty(this, "partial", void 0);
13628
- _defineProperty(this, "globSet", void 0);
13629
- _defineProperty(this, "globParts", void 0);
13630
- _defineProperty(this, "nocase", void 0);
13631
- _defineProperty(this, "isWindows", void 0);
13632
- _defineProperty(this, "platform", void 0);
13633
- _defineProperty(this, "windowsNoMagicRoot", void 0);
13634
- _defineProperty(this, "maxGlobstarRecursion", void 0);
13635
- _defineProperty(this, "regexp", void 0);
13636
13399
  assertValidPattern(pattern);
13637
13400
  options = options || {};
13638
13401
  this.options = options;
13639
- this.maxGlobstarRecursion = (_options$maxGlobstarR = options.maxGlobstarRecursion) !== null && _options$maxGlobstarR !== void 0 ? _options$maxGlobstarR : 200;
13402
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
13640
13403
  this.pattern = pattern;
13641
13404
  this.platform = options.platform || defaultPlatform;
13642
13405
  this.isWindows = this.platform === "win32";
@@ -13896,8 +13659,115 @@ var Minimatch = class {
13896
13659
  }
13897
13660
  const { optimizationLevel = 1 } = this.options;
13898
13661
  if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
13899
- if (pattern.includes(GLOBSTAR)) return _assertClassBrand(_Minimatch_brand, this, _matchGlobstar).call(this, file, pattern, partial, fileStartIndex, patternStartIndex);
13900
- return _assertClassBrand(_Minimatch_brand, this, _matchOne).call(this, file, pattern, partial, fileStartIndex, patternStartIndex);
13662
+ if (pattern.includes(GLOBSTAR)) return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
13663
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
13664
+ }
13665
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
13666
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
13667
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
13668
+ const [head, body, tail] = partial ? [
13669
+ pattern.slice(patternIndex, firstgs),
13670
+ pattern.slice(firstgs + 1),
13671
+ []
13672
+ ] : [
13673
+ pattern.slice(patternIndex, firstgs),
13674
+ pattern.slice(firstgs + 1, lastgs),
13675
+ pattern.slice(lastgs + 1)
13676
+ ];
13677
+ if (head.length) {
13678
+ const fileHead = file.slice(fileIndex, fileIndex + head.length);
13679
+ if (!this.#matchOne(fileHead, head, partial, 0, 0)) return false;
13680
+ fileIndex += head.length;
13681
+ patternIndex += head.length;
13682
+ }
13683
+ let fileTailMatch = 0;
13684
+ if (tail.length) {
13685
+ if (tail.length + fileIndex > file.length) return false;
13686
+ let tailStart = file.length - tail.length;
13687
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) fileTailMatch = tail.length;
13688
+ else {
13689
+ if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) return false;
13690
+ tailStart--;
13691
+ if (!this.#matchOne(file, tail, partial, tailStart, 0)) return false;
13692
+ fileTailMatch = tail.length + 1;
13693
+ }
13694
+ }
13695
+ if (!body.length) {
13696
+ let sawSome = !!fileTailMatch;
13697
+ for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
13698
+ const f = String(file[i]);
13699
+ sawSome = true;
13700
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
13701
+ }
13702
+ return partial || sawSome;
13703
+ }
13704
+ const bodySegments = [[[], 0]];
13705
+ let currentBody = bodySegments[0];
13706
+ let nonGsParts = 0;
13707
+ const nonGsPartsSums = [0];
13708
+ for (const b of body) if (b === GLOBSTAR) {
13709
+ nonGsPartsSums.push(nonGsParts);
13710
+ currentBody = [[], 0];
13711
+ bodySegments.push(currentBody);
13712
+ } else {
13713
+ currentBody[0].push(b);
13714
+ nonGsParts++;
13715
+ }
13716
+ let i = bodySegments.length - 1;
13717
+ const fileLength = file.length - fileTailMatch;
13718
+ for (const b of bodySegments) b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
13719
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
13720
+ }
13721
+ #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
13722
+ const bs = bodySegments[bodyIndex];
13723
+ if (!bs) {
13724
+ for (let i = fileIndex; i < file.length; i++) {
13725
+ sawTail = true;
13726
+ const f = file[i];
13727
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
13728
+ }
13729
+ return sawTail;
13730
+ }
13731
+ const [body, after] = bs;
13732
+ while (fileIndex <= after) {
13733
+ if (this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0) && globStarDepth < this.maxGlobstarRecursion) {
13734
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
13735
+ if (sub !== false) return sub;
13736
+ }
13737
+ const f = file[fileIndex];
13738
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
13739
+ fileIndex++;
13740
+ }
13741
+ return partial || null;
13742
+ }
13743
+ #matchOne(file, pattern, partial, fileIndex, patternIndex) {
13744
+ let fi;
13745
+ let pi;
13746
+ let pl;
13747
+ let fl;
13748
+ for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
13749
+ this.debug("matchOne loop");
13750
+ let p = pattern[pi];
13751
+ let f = file[fi];
13752
+ this.debug(pattern, p, f);
13753
+ /* c8 ignore start */
13754
+ if (p === false || p === GLOBSTAR) return false;
13755
+ /* c8 ignore stop */
13756
+ let hit;
13757
+ if (typeof p === "string") {
13758
+ hit = f === p;
13759
+ this.debug("string match", p, f, hit);
13760
+ } else {
13761
+ hit = p.test(f);
13762
+ this.debug("pattern match", p, f, hit);
13763
+ }
13764
+ if (!hit) return false;
13765
+ }
13766
+ if (fi === fl && pi === pl) return true;
13767
+ else if (fi === fl) return partial;
13768
+ else if (pi === pl) return fi === fl - 1 && file[fi] === "";
13769
+ else throw new Error("wtf?");
13770
+ /* c8 ignore stop */
13901
13771
  }
13902
13772
  braceExpand() {
13903
13773
  return braceExpand(this.pattern, this.options);
@@ -13999,113 +13869,6 @@ var Minimatch = class {
13999
13869
  return minimatch.defaults(def).Minimatch;
14000
13870
  }
14001
13871
  };
14002
- function _matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
14003
- const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
14004
- const lastgs = pattern.lastIndexOf(GLOBSTAR);
14005
- const [head, body, tail] = partial ? [
14006
- pattern.slice(patternIndex, firstgs),
14007
- pattern.slice(firstgs + 1),
14008
- []
14009
- ] : [
14010
- pattern.slice(patternIndex, firstgs),
14011
- pattern.slice(firstgs + 1, lastgs),
14012
- pattern.slice(lastgs + 1)
14013
- ];
14014
- if (head.length) {
14015
- const fileHead = file.slice(fileIndex, fileIndex + head.length);
14016
- if (!_assertClassBrand(_Minimatch_brand, this, _matchOne).call(this, fileHead, head, partial, 0, 0)) return false;
14017
- fileIndex += head.length;
14018
- patternIndex += head.length;
14019
- }
14020
- let fileTailMatch = 0;
14021
- if (tail.length) {
14022
- if (tail.length + fileIndex > file.length) return false;
14023
- let tailStart = file.length - tail.length;
14024
- if (_assertClassBrand(_Minimatch_brand, this, _matchOne).call(this, file, tail, partial, tailStart, 0)) fileTailMatch = tail.length;
14025
- else {
14026
- if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) return false;
14027
- tailStart--;
14028
- if (!_assertClassBrand(_Minimatch_brand, this, _matchOne).call(this, file, tail, partial, tailStart, 0)) return false;
14029
- fileTailMatch = tail.length + 1;
14030
- }
14031
- }
14032
- if (!body.length) {
14033
- let sawSome = !!fileTailMatch;
14034
- for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
14035
- const f = String(file[i]);
14036
- sawSome = true;
14037
- if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
14038
- }
14039
- return partial || sawSome;
14040
- }
14041
- const bodySegments = [[[], 0]];
14042
- let currentBody = bodySegments[0];
14043
- let nonGsParts = 0;
14044
- const nonGsPartsSums = [0];
14045
- for (const b of body) if (b === GLOBSTAR) {
14046
- nonGsPartsSums.push(nonGsParts);
14047
- currentBody = [[], 0];
14048
- bodySegments.push(currentBody);
14049
- } else {
14050
- currentBody[0].push(b);
14051
- nonGsParts++;
14052
- }
14053
- let i = bodySegments.length - 1;
14054
- const fileLength = file.length - fileTailMatch;
14055
- for (const b of bodySegments) b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
14056
- return !!_assertClassBrand(_Minimatch_brand, this, _matchGlobStarBodySections).call(this, file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
14057
- }
14058
- function _matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
14059
- const bs = bodySegments[bodyIndex];
14060
- if (!bs) {
14061
- for (let i = fileIndex; i < file.length; i++) {
14062
- sawTail = true;
14063
- const f = file[i];
14064
- if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
14065
- }
14066
- return sawTail;
14067
- }
14068
- const [body, after] = bs;
14069
- while (fileIndex <= after) {
14070
- if (_assertClassBrand(_Minimatch_brand, this, _matchOne).call(this, file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0) && globStarDepth < this.maxGlobstarRecursion) {
14071
- const sub = _assertClassBrand(_Minimatch_brand, this, _matchGlobStarBodySections).call(this, file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
14072
- if (sub !== false) return sub;
14073
- }
14074
- const f = file[fileIndex];
14075
- if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
14076
- fileIndex++;
14077
- }
14078
- return partial || null;
14079
- }
14080
- function _matchOne(file, pattern, partial, fileIndex, patternIndex) {
14081
- let fi;
14082
- let pi;
14083
- let pl;
14084
- let fl;
14085
- for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
14086
- this.debug("matchOne loop");
14087
- let p = pattern[pi];
14088
- let f = file[fi];
14089
- this.debug(pattern, p, f);
14090
- /* c8 ignore start */
14091
- if (p === false || p === GLOBSTAR) return false;
14092
- /* c8 ignore stop */
14093
- let hit;
14094
- if (typeof p === "string") {
14095
- hit = f === p;
14096
- this.debug("string match", p, f, hit);
14097
- } else {
14098
- hit = p.test(f);
14099
- this.debug("pattern match", p, f, hit);
14100
- }
14101
- if (!hit) return false;
14102
- }
14103
- if (fi === fl && pi === pl) return true;
14104
- else if (fi === fl) return partial;
14105
- else if (pi === pl) return fi === fl - 1 && file[fi] === "";
14106
- else throw new Error("wtf?");
14107
- /* c8 ignore stop */
14108
- }
14109
13872
  /* c8 ignore stop */
14110
13873
  minimatch.AST = AST;
14111
13874
  minimatch.Minimatch = Minimatch;
@@ -14167,9 +13930,8 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
14167
13930
  case "TSIndexedAccessType": return mergeElements(resolveIndexType(ctx, node, scope).map((t) => resolveTypeElements(ctx, t, t._ownerScope)), "TSUnionType");
14168
13931
  case "TSExpressionWithTypeArguments":
14169
13932
  case "TSTypeReference": {
14170
- var _scope$imports$typeNa;
14171
13933
  const typeName = getReferenceName(node);
14172
- if ((typeName === "ExtractPropTypes" || typeName === "ExtractPublicPropTypes") && node.typeParameters && ((_scope$imports$typeNa = scope.imports[typeName]) === null || _scope$imports$typeNa === void 0 ? void 0 : _scope$imports$typeNa.source) === "vue") return resolveExtractPropTypes(resolveTypeElements(ctx, node.typeParameters.params[0], scope, typeParameters), scope);
13934
+ if ((typeName === "ExtractPropTypes" || typeName === "ExtractPublicPropTypes") && node.typeParameters && scope.imports[typeName]?.source === "vue") return resolveExtractPropTypes(resolveTypeElements(ctx, node.typeParameters.params[0], scope, typeParameters), scope);
14173
13935
  const resolved = resolveTypeReference(ctx, node, scope);
14174
13936
  if (resolved) {
14175
13937
  let typeParams;
@@ -14195,8 +13957,7 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
14195
13957
  }
14196
13958
  }
14197
13959
  case "TSImportType": {
14198
- var _node$qualifier;
14199
- if (getId(node.argument) === "vue" && ((_node$qualifier = node.qualifier) === null || _node$qualifier === void 0 ? void 0 : _node$qualifier.type) === "Identifier" && node.qualifier.name === "ExtractPropTypes" && node.typeParameters) return resolveExtractPropTypes(resolveTypeElements(ctx, node.typeParameters.params[0], scope), scope);
13960
+ if (getId(node.argument) === "vue" && node.qualifier?.type === "Identifier" && node.qualifier.name === "ExtractPropTypes" && node.typeParameters) return resolveExtractPropTypes(resolveTypeElements(ctx, node.typeParameters.params[0], scope), scope);
14200
13961
  const resolved = resolveTypeReference(ctx, node, importSourceToScope(ctx, node.argument, scope, node.argument.value));
14201
13962
  if (resolved) return resolveTypeElements(ctx, resolved, resolved._ownerScope);
14202
13963
  break;
@@ -14296,8 +14057,7 @@ function resolveIndexType(ctx, node, scope) {
14296
14057
  resolved = resolveTypeElements(ctx, objectType, scope);
14297
14058
  }
14298
14059
  for (const key of keys) {
14299
- var _resolved$props$key;
14300
- const targetType = (_resolved$props$key = resolved.props[key]) === null || _resolved$props$key === void 0 || (_resolved$props$key = _resolved$props$key.typeAnnotation) === null || _resolved$props$key === void 0 ? void 0 : _resolved$props$key.typeAnnotation;
14060
+ const targetType = resolved.props[key]?.typeAnnotation?.typeAnnotation;
14301
14061
  if (targetType) {
14302
14062
  targetType._ownerScope = resolved.props[key]._ownerScope;
14303
14063
  types.push(targetType);
@@ -14419,7 +14179,7 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
14419
14179
  }
14420
14180
  }
14421
14181
  function resolveTypeReference(ctx, node, scope, name, onlyExported = false) {
14422
- const canCache = !(scope === null || scope === void 0 ? void 0 : scope.isGenericScope);
14182
+ const canCache = !scope?.isGenericScope;
14423
14183
  if (canCache && node._resolvedReference) {
14424
14184
  recordScopeDep(ctx, node._resolvedReference._ownerScope);
14425
14185
  return node._resolvedReference;
@@ -14462,8 +14222,8 @@ function innerResolveTypeReference(ctx, scope, name, node, onlyExported) {
14462
14222
  }
14463
14223
  function getReferenceName(node) {
14464
14224
  const ref = node.type === "TSTypeReference" ? node.typeName : node.type === "TSExpressionWithTypeArguments" ? node.expression : node.type === "TSImportType" ? node.qualifier : node.exprName;
14465
- if ((ref === null || ref === void 0 ? void 0 : ref.type) === "Identifier") return ref.name;
14466
- else if ((ref === null || ref === void 0 ? void 0 : ref.type) === "TSQualifiedName") return qualifiedNameToPath(ref);
14225
+ if (ref?.type === "Identifier") return ref.name;
14226
+ else if (ref?.type === "TSQualifiedName") return qualifiedNameToPath(ref);
14467
14227
  else return "default";
14468
14228
  }
14469
14229
  function qualifiedNameToPath(node) {
@@ -14494,7 +14254,7 @@ function registerTS(_loadTS) {
14494
14254
  function resolveFS(ctx) {
14495
14255
  if (ctx.fs) return ctx.fs;
14496
14256
  if (!ts && loadTS) ts = loadTS();
14497
- const fs = ctx.options.fs || (ts === null || ts === void 0 ? void 0 : ts.sys);
14257
+ const fs = ctx.options.fs || ts?.sys;
14498
14258
  if (!fs) return;
14499
14259
  return ctx.fs = {
14500
14260
  fileExists(file) {
@@ -14560,6 +14320,12 @@ function resolveExt(filename, fs) {
14560
14320
  const tsConfigCache = createCache();
14561
14321
  const tsConfigRefMap = /* @__PURE__ */ new Map();
14562
14322
  const extendedConfigCache = /* @__PURE__ */ new Map();
14323
+ const matcherCache = /* @__PURE__ */ new Map();
14324
+ function isMatch(file, pattern) {
14325
+ let matcher = matcherCache.get(pattern);
14326
+ if (!matcher) matcherCache.set(pattern, matcher = new Minimatch(pattern));
14327
+ return matcher.match(file);
14328
+ }
14563
14329
  function resolveWithTS(containingFile, source, ts, fs) {
14564
14330
  const configPath = ts.findConfigFile(containingFile, fs.fileExists);
14565
14331
  let tsCompilerOptions;
@@ -14581,12 +14347,11 @@ function resolveWithTS(containingFile, source, ts, fs) {
14581
14347
  return p.startsWith("${configDir}") && supportsConfigDir ? normalizePath(p.replace("${configDir}", (0, path.dirname)(configPath))) : joinPaths(base, p);
14582
14348
  };
14583
14349
  for (const c of configs) {
14584
- var _c$config$raw, _c$config$raw2;
14585
14350
  const base = normalizePath(c.config.options.pathsBasePath || (0, path.dirname)(c.config.options.configFilePath));
14586
- const included = (_c$config$raw = c.config.raw) === null || _c$config$raw === void 0 ? void 0 : _c$config$raw.include;
14587
- const excluded = (_c$config$raw2 = c.config.raw) === null || _c$config$raw2 === void 0 ? void 0 : _c$config$raw2.exclude;
14588
- if (!included && (!base || containingFile.startsWith(base)) || (included === null || included === void 0 ? void 0 : included.some((p) => minimatch(containingFile, getPattern(base, p))))) {
14589
- if (excluded && excluded.some((p) => minimatch(containingFile, getPattern(base, p)))) continue;
14351
+ const included = c.config.raw?.include;
14352
+ const excluded = c.config.raw?.exclude;
14353
+ if (!included && (!base || containingFile.startsWith(base)) || included?.some((p) => isMatch(containingFile, getPattern(base, p)))) {
14354
+ if (excluded && excluded.some((p) => isMatch(containingFile, getPattern(base, p)))) continue;
14590
14355
  matchedConfig = c;
14591
14356
  break;
14592
14357
  }
@@ -14629,6 +14394,7 @@ function invalidateTypeCache(filename) {
14629
14394
  if (filename.endsWith(".json")) {
14630
14395
  extendedConfigCache.clear();
14631
14396
  tsConfigCache.clear();
14397
+ matcherCache.clear();
14632
14398
  }
14633
14399
  const affectedConfig = tsConfigRefMap.get(filename);
14634
14400
  if (affectedConfig) tsConfigCache.delete(affectedConfig);
@@ -14666,7 +14432,7 @@ function parseFile(filename, content, fs, parserPlugins) {
14666
14432
  const secondBlock = scriptOffset < scriptSetupOffset ? scriptSetup : script;
14667
14433
  let scriptContent = " ".repeat(Math.min(scriptOffset, scriptSetupOffset)) + firstBlock.content;
14668
14434
  if (secondBlock) scriptContent += " ".repeat(secondBlock.loc.start.offset - script.loc.end.offset) + secondBlock.content;
14669
- const lang = (script === null || script === void 0 ? void 0 : script.lang) || (scriptSetup === null || scriptSetup === void 0 ? void 0 : scriptSetup.lang);
14435
+ const lang = script?.lang || scriptSetup?.lang;
14670
14436
  return (0, _babel_parser.parse)(scriptContent, {
14671
14437
  plugins: resolveParserPlugins(lang, parserPlugins),
14672
14438
  sourceType: "module"
@@ -15107,10 +14873,7 @@ function resolveReturnType(ctx, arg, scope) {
15107
14873
  let resolved = arg;
15108
14874
  if (arg.type === "TSTypeReference" || arg.type === "TSTypeQuery" || arg.type === "TSImportType") resolved = resolveTypeReference(ctx, arg, scope);
15109
14875
  if (!resolved) return;
15110
- if (resolved.type === "TSFunctionType") {
15111
- var _resolved$typeAnnotat;
15112
- return (_resolved$typeAnnotat = resolved.typeAnnotation) === null || _resolved$typeAnnotat === void 0 ? void 0 : _resolved$typeAnnotat.typeAnnotation;
15113
- }
14876
+ if (resolved.type === "TSFunctionType") return resolved.typeAnnotation?.typeAnnotation;
15114
14877
  if (resolved.type === "TSDeclareFunction") return resolved.returnType;
15115
14878
  }
15116
14879
  function resolveUnionType(ctx, node, scope) {
@@ -15353,7 +15116,7 @@ function genDestructuredDefaultValue(ctx, key, inferredType) {
15353
15116
  }
15354
15117
  const needSkipFactory = !inferredType && ((0, _vue_compiler_dom.isFunctionType)(unwrapped) || unwrapped.type === "Identifier");
15355
15118
  return {
15356
- valueString: !needSkipFactory && !isLiteralNode(unwrapped) && !(inferredType === null || inferredType === void 0 ? void 0 : inferredType.includes("Function")) ? `() => (${value})` : value,
15119
+ valueString: !needSkipFactory && !isLiteralNode(unwrapped) && !inferredType?.includes("Function") ? `() => (${value})` : value,
15357
15120
  needSkipFactory
15358
15121
  };
15359
15122
  }
@@ -15408,11 +15171,14 @@ function transformDestructuredProps(ctx, vueImportAliases) {
15408
15171
  const excludedIds = /* @__PURE__ */ new WeakSet();
15409
15172
  const parentStack = [];
15410
15173
  const propsLocalToPublicMap = Object.create(null);
15174
+ const modelOptionNodes = /* @__PURE__ */ new Set();
15175
+ let currentModelOption = null;
15411
15176
  for (const key in ctx.propsDestructuredBindings) {
15412
15177
  const { local } = ctx.propsDestructuredBindings[key];
15413
15178
  rootScope[local] = true;
15414
15179
  propsLocalToPublicMap[local] = key;
15415
15180
  }
15181
+ for (const { runtimeOptionNodes } of Object.values(ctx.modelDecls)) for (const node of runtimeOptionNodes) modelOptionNodes.add(node);
15416
15182
  function pushScope(isFunctionScope = false) {
15417
15183
  const scope = currentScope = Object.create(currentScope);
15418
15184
  scopeStack.push(scope);
@@ -15453,6 +15219,10 @@ function transformDestructuredProps(ctx, vueImportAliases) {
15453
15219
  } });
15454
15220
  }
15455
15221
  function rewriteId(id, parent, parentStack) {
15222
+ if (currentModelOption) {
15223
+ const isDefault = (currentModelOption.type === "ObjectProperty" || currentModelOption.type === "ObjectMethod") && resolveObjectKey(currentModelOption.key, currentModelOption.computed) === "default";
15224
+ ctx.error(`\`${DEFINE_MODEL}()\` prop options cannot reference destructured props because they are hoisted outside of the setup() function.` + (isDefault ? ` Use the props argument of the default factory instead, e.g. default: props => props${(0, _vue_shared.genPropsAccessExp)(propsLocalToPublicMap[id.name]).slice(`__props`.length)}` : ``), id);
15225
+ }
15456
15226
  if (parent.type === "AssignmentExpression" && id === parent.left || parent.type === "UpdateExpression") ctx.error(`Cannot assign to destructured props as they are readonly.`, id);
15457
15227
  if ((0, _vue_compiler_dom.isStaticProperty)(parent) && parent.shorthand) {
15458
15228
  if (!parent.inPattern || (0, _vue_compiler_dom.isInDestructureAssignment)(parent, parentStack)) ctx.s.appendLeft(id.end + ctx.startOffset, `: ${(0, _vue_shared.genPropsAccessExp)(propsLocalToPublicMap[id.name])}`);
@@ -15471,6 +15241,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
15471
15241
  enter(node, parent) {
15472
15242
  parent && parentStack.push(parent);
15473
15243
  if (parent && parent.type.startsWith("TS") && !_vue_compiler_dom.TS_NODE_TYPES.includes(parent.type)) return this.skip();
15244
+ if (modelOptionNodes.has(node)) currentModelOption = node;
15474
15245
  checkUsage(node, "watch", vueImportAliases.watch);
15475
15246
  checkUsage(node, "toRef", vueImportAliases.toRef);
15476
15247
  if ((0, _vue_compiler_dom.isFunctionType)(node)) {
@@ -15508,6 +15279,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
15508
15279
  },
15509
15280
  leave(node, parent) {
15510
15281
  parent && parentStack.pop();
15282
+ if (node === currentModelOption) currentModelOption = null;
15511
15283
  if ((0, _vue_compiler_dom.isFunctionType)(node)) popScope(true);
15512
15284
  else if (node.type === "BlockStatement" && !(0, _vue_compiler_dom.isFunctionType)(parent)) popScope();
15513
15285
  else if (node.type === "CatchClause" || node.type === "ForOfStatement" || node.type === "ForInStatement" || node.type === "ForStatement") popScope();
@@ -15685,7 +15457,6 @@ const MACROS = [
15685
15457
  * normal `<script>` + `<script setup>` if both are present.
15686
15458
  */
15687
15459
  function compileScript(sfc, options) {
15688
- var _options$templateOpti;
15689
15460
  if (!options.id) warnOnce("compileScript now requires passing the `id` option.\nUpgrade your vite or vue-loader version for compatibility with the latest experimental proposals.");
15690
15461
  const { script, scriptSetup, source, filename } = sfc;
15691
15462
  const hoistStatic = options.hoistStatic !== false && !script;
@@ -15693,7 +15464,7 @@ function compileScript(sfc, options) {
15693
15464
  const scriptLang = script && script.lang;
15694
15465
  const scriptSetupLang = scriptSetup && scriptSetup.lang;
15695
15466
  const vapor = sfc.vapor || options.vapor;
15696
- const ssr = (_options$templateOpti = options.templateOptions) === null || _options$templateOpti === void 0 ? void 0 : _options$templateOpti.ssr;
15467
+ const ssr = options.templateOptions?.ssr;
15697
15468
  const setupPreambleLines = [];
15698
15469
  const cssModuleBindings = [];
15699
15470
  let cssModuleHelper = "_useCssModule";
@@ -15701,6 +15472,7 @@ function compileScript(sfc, options) {
15701
15472
  if (script && scriptSetup && scriptLang !== scriptSetupLang) throw new Error("[@vue/compiler-sfc] <script> and <script setup> must have the same language type.");
15702
15473
  if (!scriptSetup) {
15703
15474
  if (!script) throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
15475
+ if (vapor) throw new Error(`[@vue/compiler-sfc] Vapor components with a normal <script> must also include <script setup>, <script vapor>, or <script setup vapor>.`);
15704
15476
  if (script.lang && !isJSOrTS) return script;
15705
15477
  return processNormalScript(new ScriptCompileContext(sfc, options), scopeId);
15706
15478
  }
@@ -15777,10 +15549,9 @@ function compileScript(sfc, options) {
15777
15549
  if (!sfc.template) return;
15778
15550
  while (ctx.bindingMetadata[cssModuleHelper] || inlineMode && sfc.styles.some((style) => style.module === cssModuleHelper)) cssModuleHelper += "_";
15779
15551
  for (const style of sfc.styles) {
15780
- var _options$templateOpti2;
15781
15552
  if (!style.module) continue;
15782
15553
  const name = style.module === true ? `$style` : style.module;
15783
- if (!(0, _vue_compiler_dom.isSimpleIdentifier)(name) || ctx.bindingMetadata[name] || inlineMode && sfc.template.ast && !sfc.template.lang && !((_options$templateOpti2 = options.templateOptions) === null || _options$templateOpti2 === void 0 ? void 0 : _options$templateOpti2.preprocessLang) && !isUsedInTemplate(name, sfc, options.templateOptions)) continue;
15554
+ if (!(0, _vue_compiler_dom.isSimpleIdentifier)(name) || ctx.bindingMetadata[name] || inlineMode && sfc.template.ast && !sfc.template.lang && !options.templateOptions?.preprocessLang && !isUsedInTemplate(name, sfc, options.templateOptions)) continue;
15784
15555
  if (inlineMode) {
15785
15556
  if (name === "__props" || name === "_useCssModule" || name[0] === "_" && ctx.helperImports.has(name.slice(1))) continue;
15786
15557
  try {
@@ -16056,7 +15827,7 @@ function compileScript(sfc, options) {
16056
15827
  if (cssModuleBindings.length) returned = `{\n${cssModuleBindings.join("\n")}\n${returned}\n}`;
16057
15828
  } else returned = `() => {}`;
16058
15829
  if (!inlineMode && true) ctx.s.appendRight(endOffset, `\nconst __returned__ = ${returned}\nObject.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\nreturn __returned__\n}\n\n`);
16059
- else ctx.s.appendRight(endOffset, `\n${vapor && !ssr && inlineMode ? `` : `return `}${returned}\n}\n\n`);
15830
+ else ctx.s.appendRight(endOffset, `\n${vapor && !ssr && inlineMode && !(!sfc.template && ctx.hasDefaultExportRender) ? `` : `return `}${returned}\n}\n\n`);
16060
15831
  const genDefaultAs = options.genDefaultAs ? `const ${options.genDefaultAs} =` : `export default`;
16061
15832
  let runtimeOptions = ``;
16062
15833
  if (!ctx.hasDefaultExportName && filename && filename !== "anonymous.vue") {
@@ -16068,8 +15839,7 @@ function compileScript(sfc, options) {
16068
15839
  const emitsDecl = genRuntimeEmits(ctx);
16069
15840
  if (emitsDecl) runtimeOptions += `\n emits: ${emitsDecl},`;
16070
15841
  if (vapor && !ssr && sfc.template && !sfc.template.src) {
16071
- var _options$templateOpti3;
16072
- if (isMultiRoot(sfc.template.ast, (_options$templateOpti3 = options.templateOptions) === null || _options$templateOpti3 === void 0 ? void 0 : _options$templateOpti3.compilerOptions)) runtimeOptions += `\n __multiRoot: true,`;
15842
+ if (isMultiRoot(sfc.template.ast, options.templateOptions?.compilerOptions)) runtimeOptions += `\n __multiRoot: true,`;
16073
15843
  }
16074
15844
  let definedOptions = "";
16075
15845
  if (ctx.optionsRuntimeDecl) definedOptions = scriptSetup.content.slice(ctx.optionsRuntimeDecl.start, ctx.optionsRuntimeDecl.end).trim();
@@ -16091,8 +15861,7 @@ function compileScript(sfc, options) {
16091
15861
  }
16092
15862
  }
16093
15863
  if (ctx.helperImports.size > 0) {
16094
- var _options$templateOpti4;
16095
- const runtimeModuleName = (_options$templateOpti4 = options.templateOptions) === null || _options$templateOpti4 === void 0 || (_options$templateOpti4 = _options$templateOpti4.compilerOptions) === null || _options$templateOpti4 === void 0 ? void 0 : _options$templateOpti4.runtimeModuleName;
15864
+ const runtimeModuleName = options.templateOptions?.compilerOptions?.runtimeModuleName;
16096
15865
  const importSrc = runtimeModuleName ? JSON.stringify(runtimeModuleName) : `'vue'`;
16097
15866
  ctx.s.prepend(`import { ${[...ctx.helperImports].map((h) => `${h} as ${h === "useCssModule" ? cssModuleHelper : `_${h}`}`).join(", ")} } from ${importSrc}\n`);
16098
15867
  }
@@ -16113,8 +15882,8 @@ function compileScript(sfc, options) {
16113
15882
  imports: ctx.userImports,
16114
15883
  content,
16115
15884
  map,
16116
- scriptAst: scriptAst === null || scriptAst === void 0 ? void 0 : scriptAst.body,
16117
- scriptSetupAst: scriptSetupAst === null || scriptSetupAst === void 0 ? void 0 : scriptSetupAst.body,
15885
+ scriptAst: scriptAst?.body,
15886
+ scriptSetupAst: scriptSetupAst?.body,
16118
15887
  deps: ctx.deps ? [...ctx.deps] : void 0
16119
15888
  };
16120
15889
  }
@@ -16231,7 +16000,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
16231
16000
  }
16232
16001
  //#endregion
16233
16002
  //#region packages/compiler-sfc/src/index.ts
16234
- const version = "3.6.0-rc.10";
16003
+ const version = "3.6.0-rc.12";
16235
16004
  const parseCache = parseCache$1;
16236
16005
  const errorMessages = {
16237
16006
  ..._vue_compiler_dom.errorMessages,