vue 3.5.17 → 3.6.0-alpha.2

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 v3.5.17
2
+ * vue v3.6.0-alpha.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -21,6 +21,8 @@ var Vue = (function (exports) {
21
21
  const NO = () => false;
22
22
  const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
23
23
  (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
24
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
25
+ key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
24
26
  const isModelListener = (key) => key.startsWith("onUpdate:");
25
27
  const extend = Object.assign;
26
28
  const remove = (arr, el) => {
@@ -54,6 +56,7 @@ var Vue = (function (exports) {
54
56
  // the leading comma is intentional so empty string "" is also included
55
57
  ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
56
58
  );
59
+ const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
57
60
  const isBuiltInDirective = /* @__PURE__ */ makeMap(
58
61
  "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
59
62
  );
@@ -65,10 +68,9 @@ var Vue = (function (exports) {
65
68
  };
66
69
  };
67
70
  const camelizeRE = /-(\w)/g;
71
+ const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
68
72
  const camelize = cacheStringFunction(
69
- (str) => {
70
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
71
- }
73
+ (str) => str.replace(camelizeRE, camelizeReplacer)
72
74
  );
73
75
  const hyphenateRE = /\B([A-Z])/g;
74
76
  const hyphenate = cacheStringFunction(
@@ -115,6 +117,10 @@ var Vue = (function (exports) {
115
117
  (_, val) => typeof val === "function" ? val.toString() : val
116
118
  );
117
119
  }
120
+ function canSetValueDirectly(tagName) {
121
+ return tagName !== "PROGRESS" && // custom elements may use _value internally
122
+ !tagName.includes("-");
123
+ }
118
124
 
119
125
  const PatchFlagNames = {
120
126
  [1]: `TEXT`,
@@ -289,6 +295,24 @@ var Vue = (function (exports) {
289
295
  const type = typeof value;
290
296
  return type === "string" || type === "number" || type === "boolean";
291
297
  }
298
+ function shouldSetAsAttr(tagName, key) {
299
+ if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
300
+ return true;
301
+ }
302
+ if (key === "form") {
303
+ return true;
304
+ }
305
+ if (key === "list" && tagName === "INPUT") {
306
+ return true;
307
+ }
308
+ if (key === "type" && tagName === "TEXTAREA") {
309
+ return true;
310
+ }
311
+ if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
312
+ return true;
313
+ }
314
+ return false;
315
+ }
292
316
 
293
317
  const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
294
318
  function getEscapedCssVarName(key, doubleEscape) {
@@ -352,7 +376,20 @@ var Vue = (function (exports) {
352
376
  return !!(val && val["__v_isRef"] === true);
353
377
  };
354
378
  const toDisplayString = (val) => {
355
- return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
379
+ switch (typeof val) {
380
+ case "string":
381
+ return val;
382
+ case "object":
383
+ if (val) {
384
+ if (isRef$1(val)) {
385
+ return toDisplayString(val.value);
386
+ } else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
387
+ return JSON.stringify(val, replacer, 2);
388
+ }
389
+ }
390
+ default:
391
+ return val == null ? "" : String(val);
392
+ }
356
393
  };
357
394
  const replacer = (_key, val) => {
358
395
  if (isRef$1(val)) {
@@ -387,604 +424,404 @@ var Vue = (function (exports) {
387
424
  );
388
425
  };
389
426
 
390
- function warn$2(msg, ...args) {
391
- console.warn(`[Vue warn] ${msg}`, ...args);
392
- }
393
-
394
- let activeEffectScope;
395
- class EffectScope {
396
- constructor(detached = false) {
397
- this.detached = detached;
398
- /**
399
- * @internal
400
- */
401
- this._active = true;
402
- /**
403
- * @internal track `on` calls, allow `on` call multiple times
404
- */
405
- this._on = 0;
406
- /**
407
- * @internal
408
- */
409
- this.effects = [];
410
- /**
411
- * @internal
412
- */
413
- this.cleanups = [];
414
- this._isPaused = false;
415
- this.parent = activeEffectScope;
416
- if (!detached && activeEffectScope) {
417
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
418
- this
419
- ) - 1;
420
- }
421
- }
422
- get active() {
423
- return this._active;
424
- }
425
- pause() {
426
- if (this._active) {
427
- this._isPaused = true;
428
- let i, l;
429
- if (this.scopes) {
430
- for (i = 0, l = this.scopes.length; i < l; i++) {
431
- this.scopes[i].pause();
432
- }
433
- }
434
- for (i = 0, l = this.effects.length; i < l; i++) {
435
- this.effects[i].pause();
427
+ function getSequence(arr) {
428
+ const p = arr.slice();
429
+ const result = [0];
430
+ let i, j, u, v, c;
431
+ const len = arr.length;
432
+ for (i = 0; i < len; i++) {
433
+ const arrI = arr[i];
434
+ if (arrI !== 0) {
435
+ j = result[result.length - 1];
436
+ if (arr[j] < arrI) {
437
+ p[i] = j;
438
+ result.push(i);
439
+ continue;
436
440
  }
437
- }
438
- }
439
- /**
440
- * Resumes the effect scope, including all child scopes and effects.
441
- */
442
- resume() {
443
- if (this._active) {
444
- if (this._isPaused) {
445
- this._isPaused = false;
446
- let i, l;
447
- if (this.scopes) {
448
- for (i = 0, l = this.scopes.length; i < l; i++) {
449
- this.scopes[i].resume();
450
- }
441
+ u = 0;
442
+ v = result.length - 1;
443
+ while (u < v) {
444
+ c = u + v >> 1;
445
+ if (arr[result[c]] < arrI) {
446
+ u = c + 1;
447
+ } else {
448
+ v = c;
451
449
  }
452
- for (i = 0, l = this.effects.length; i < l; i++) {
453
- this.effects[i].resume();
450
+ }
451
+ if (arrI < arr[result[u]]) {
452
+ if (u > 0) {
453
+ p[i] = result[u - 1];
454
454
  }
455
+ result[u] = i;
455
456
  }
456
457
  }
457
458
  }
458
- run(fn) {
459
- if (this._active) {
460
- const currentEffectScope = activeEffectScope;
461
- try {
462
- activeEffectScope = this;
463
- return fn();
464
- } finally {
465
- activeEffectScope = currentEffectScope;
466
- }
467
- } else {
468
- warn$2(`cannot run an inactive effect scope.`);
469
- }
459
+ u = result.length;
460
+ v = result[u - 1];
461
+ while (u-- > 0) {
462
+ result[u] = v;
463
+ v = p[v];
470
464
  }
471
- /**
472
- * This should only be called on non-detached scopes
473
- * @internal
474
- */
475
- on() {
476
- if (++this._on === 1) {
477
- this.prevScope = activeEffectScope;
478
- activeEffectScope = this;
479
- }
465
+ return result;
466
+ }
467
+
468
+ function normalizeCssVarValue(value) {
469
+ if (value == null) {
470
+ return "initial";
480
471
  }
481
- /**
482
- * This should only be called on non-detached scopes
483
- * @internal
484
- */
485
- off() {
486
- if (this._on > 0 && --this._on === 0) {
487
- activeEffectScope = this.prevScope;
488
- this.prevScope = void 0;
489
- }
472
+ if (typeof value === "string") {
473
+ return value === "" ? " " : value;
490
474
  }
491
- stop(fromParent) {
492
- if (this._active) {
493
- this._active = false;
494
- let i, l;
495
- for (i = 0, l = this.effects.length; i < l; i++) {
496
- this.effects[i].stop();
497
- }
498
- this.effects.length = 0;
499
- for (i = 0, l = this.cleanups.length; i < l; i++) {
500
- this.cleanups[i]();
501
- }
502
- this.cleanups.length = 0;
503
- if (this.scopes) {
504
- for (i = 0, l = this.scopes.length; i < l; i++) {
505
- this.scopes[i].stop(true);
506
- }
507
- this.scopes.length = 0;
508
- }
509
- if (!this.detached && this.parent && !fromParent) {
510
- const last = this.parent.scopes.pop();
511
- if (last && last !== this) {
512
- this.parent.scopes[this.index] = last;
513
- last.index = this.index;
514
- }
515
- }
516
- this.parent = void 0;
475
+ if (typeof value !== "number" || !Number.isFinite(value)) {
476
+ {
477
+ console.warn(
478
+ "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
479
+ value
480
+ );
517
481
  }
518
482
  }
483
+ return String(value);
519
484
  }
520
- function effectScope(detached) {
521
- return new EffectScope(detached);
485
+
486
+ function warn$2(msg, ...args) {
487
+ console.warn(`[Vue warn] ${msg}`, ...args);
522
488
  }
523
- function getCurrentScope() {
524
- return activeEffectScope;
489
+
490
+ var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
491
+ ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
492
+ ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
493
+ ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
494
+ ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
495
+ ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
496
+ ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
497
+ ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
498
+ return ReactiveFlags2;
499
+ })(ReactiveFlags || {});
500
+ const notifyBuffer = [];
501
+ let batchDepth = 0;
502
+ let activeSub = void 0;
503
+ let notifyIndex = 0;
504
+ let notifyBufferLength = 0;
505
+ function setActiveSub(sub) {
506
+ try {
507
+ return activeSub;
508
+ } finally {
509
+ activeSub = sub;
510
+ }
525
511
  }
526
- function onScopeDispose(fn, failSilently = false) {
527
- if (activeEffectScope) {
528
- activeEffectScope.cleanups.push(fn);
529
- } else if (!failSilently) {
530
- warn$2(
531
- `onScopeDispose() is called when there is no active effect scope to be associated with.`
532
- );
512
+ function startBatch() {
513
+ ++batchDepth;
514
+ }
515
+ function endBatch() {
516
+ if (!--batchDepth && notifyBufferLength) {
517
+ flush();
533
518
  }
534
519
  }
535
-
536
- let activeSub;
537
- const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
538
- class ReactiveEffect {
539
- constructor(fn) {
540
- this.fn = fn;
541
- /**
542
- * @internal
543
- */
544
- this.deps = void 0;
545
- /**
546
- * @internal
547
- */
548
- this.depsTail = void 0;
549
- /**
550
- * @internal
551
- */
552
- this.flags = 1 | 4;
553
- /**
554
- * @internal
555
- */
556
- this.next = void 0;
557
- /**
558
- * @internal
559
- */
560
- this.cleanup = void 0;
561
- this.scheduler = void 0;
562
- if (activeEffectScope && activeEffectScope.active) {
563
- activeEffectScope.effects.push(this);
520
+ function link(dep, sub) {
521
+ const prevDep = sub.depsTail;
522
+ if (prevDep !== void 0 && prevDep.dep === dep) {
523
+ return;
524
+ }
525
+ let nextDep = void 0;
526
+ const recursedCheck = sub.flags & 4 /* RecursedCheck */;
527
+ if (recursedCheck) {
528
+ nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
529
+ if (nextDep !== void 0 && nextDep.dep === dep) {
530
+ sub.depsTail = nextDep;
531
+ return;
564
532
  }
565
533
  }
566
- pause() {
567
- this.flags |= 64;
534
+ const prevSub = dep.subsTail;
535
+ const newLink = sub.depsTail = dep.subsTail = {
536
+ dep,
537
+ sub,
538
+ prevDep,
539
+ nextDep,
540
+ prevSub,
541
+ nextSub: void 0
542
+ };
543
+ if (nextDep !== void 0) {
544
+ nextDep.prevDep = newLink;
568
545
  }
569
- resume() {
570
- if (this.flags & 64) {
571
- this.flags &= -65;
572
- if (pausedQueueEffects.has(this)) {
573
- pausedQueueEffects.delete(this);
574
- this.trigger();
575
- }
576
- }
546
+ if (prevDep !== void 0) {
547
+ prevDep.nextDep = newLink;
548
+ } else {
549
+ sub.deps = newLink;
577
550
  }
578
- /**
579
- * @internal
580
- */
581
- notify() {
582
- if (this.flags & 2 && !(this.flags & 32)) {
583
- return;
584
- }
585
- if (!(this.flags & 8)) {
586
- batch(this);
587
- }
551
+ if (prevSub !== void 0) {
552
+ prevSub.nextSub = newLink;
553
+ } else {
554
+ dep.subs = newLink;
588
555
  }
589
- run() {
590
- if (!(this.flags & 1)) {
591
- return this.fn();
592
- }
593
- this.flags |= 2;
594
- cleanupEffect(this);
595
- prepareDeps(this);
596
- const prevEffect = activeSub;
597
- const prevShouldTrack = shouldTrack;
598
- activeSub = this;
599
- shouldTrack = true;
600
- try {
601
- return this.fn();
602
- } finally {
603
- if (activeSub !== this) {
604
- warn$2(
605
- "Active effect was not restored correctly - this is likely a Vue internal bug."
606
- );
556
+ }
557
+ function unlink(link2, sub = link2.sub) {
558
+ const dep = link2.dep;
559
+ const prevDep = link2.prevDep;
560
+ const nextDep = link2.nextDep;
561
+ const nextSub = link2.nextSub;
562
+ const prevSub = link2.prevSub;
563
+ if (nextDep !== void 0) {
564
+ nextDep.prevDep = prevDep;
565
+ } else {
566
+ sub.depsTail = prevDep;
567
+ }
568
+ if (prevDep !== void 0) {
569
+ prevDep.nextDep = nextDep;
570
+ } else {
571
+ sub.deps = nextDep;
572
+ }
573
+ if (nextSub !== void 0) {
574
+ nextSub.prevSub = prevSub;
575
+ } else {
576
+ dep.subsTail = prevSub;
577
+ }
578
+ if (prevSub !== void 0) {
579
+ prevSub.nextSub = nextSub;
580
+ } else if ((dep.subs = nextSub) === void 0) {
581
+ let toRemove = dep.deps;
582
+ if (toRemove !== void 0) {
583
+ do {
584
+ toRemove = unlink(toRemove, dep);
585
+ } while (toRemove !== void 0);
586
+ dep.flags |= 16 /* Dirty */;
587
+ }
588
+ }
589
+ return nextDep;
590
+ }
591
+ function propagate(link2) {
592
+ let next = link2.nextSub;
593
+ let stack;
594
+ top: do {
595
+ const sub = link2.sub;
596
+ let flags = sub.flags;
597
+ if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
598
+ if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
599
+ sub.flags = flags | 32 /* Pending */;
600
+ } else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
601
+ flags = 0 /* None */;
602
+ } else if (!(flags & 4 /* RecursedCheck */)) {
603
+ sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
604
+ } else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
605
+ sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
606
+ flags &= 1 /* Mutable */;
607
+ } else {
608
+ flags = 0 /* None */;
609
+ }
610
+ if (flags & 2 /* Watching */) {
611
+ notifyBuffer[notifyBufferLength++] = sub;
612
+ }
613
+ if (flags & 1 /* Mutable */) {
614
+ const subSubs = sub.subs;
615
+ if (subSubs !== void 0) {
616
+ link2 = subSubs;
617
+ if (subSubs.nextSub !== void 0) {
618
+ stack = { value: next, prev: stack };
619
+ next = link2.nextSub;
620
+ }
621
+ continue;
622
+ }
607
623
  }
608
- cleanupDeps(this);
609
- activeSub = prevEffect;
610
- shouldTrack = prevShouldTrack;
611
- this.flags &= -3;
612
624
  }
613
- }
614
- stop() {
615
- if (this.flags & 1) {
616
- for (let link = this.deps; link; link = link.nextDep) {
617
- removeSub(link);
625
+ if ((link2 = next) !== void 0) {
626
+ next = link2.nextSub;
627
+ continue;
628
+ }
629
+ while (stack !== void 0) {
630
+ link2 = stack.value;
631
+ stack = stack.prev;
632
+ if (link2 !== void 0) {
633
+ next = link2.nextSub;
634
+ continue top;
618
635
  }
619
- this.deps = this.depsTail = void 0;
620
- cleanupEffect(this);
621
- this.onStop && this.onStop();
622
- this.flags &= -2;
623
636
  }
637
+ break;
638
+ } while (true);
639
+ }
640
+ function startTracking(sub) {
641
+ sub.depsTail = void 0;
642
+ sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
643
+ return setActiveSub(sub);
644
+ }
645
+ function endTracking(sub, prevSub) {
646
+ if (activeSub !== sub) {
647
+ warn$2(
648
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
649
+ );
624
650
  }
625
- trigger() {
626
- if (this.flags & 64) {
627
- pausedQueueEffects.add(this);
628
- } else if (this.scheduler) {
629
- this.scheduler();
630
- } else {
631
- this.runIfDirty();
651
+ activeSub = prevSub;
652
+ const depsTail = sub.depsTail;
653
+ let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
654
+ while (toRemove !== void 0) {
655
+ toRemove = unlink(toRemove, sub);
656
+ }
657
+ sub.flags &= -5 /* RecursedCheck */;
658
+ }
659
+ function flush() {
660
+ while (notifyIndex < notifyBufferLength) {
661
+ const effect = notifyBuffer[notifyIndex];
662
+ notifyBuffer[notifyIndex++] = void 0;
663
+ effect.notify();
664
+ }
665
+ notifyIndex = 0;
666
+ notifyBufferLength = 0;
667
+ }
668
+ function checkDirty(link2, sub) {
669
+ let stack;
670
+ let checkDepth = 0;
671
+ top: do {
672
+ const dep = link2.dep;
673
+ const depFlags = dep.flags;
674
+ let dirty = false;
675
+ if (sub.flags & 16 /* Dirty */) {
676
+ dirty = true;
677
+ } else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
678
+ if (dep.update()) {
679
+ const subs = dep.subs;
680
+ if (subs.nextSub !== void 0) {
681
+ shallowPropagate(subs);
682
+ }
683
+ dirty = true;
684
+ }
685
+ } else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
686
+ if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
687
+ stack = { value: link2, prev: stack };
688
+ }
689
+ link2 = dep.deps;
690
+ sub = dep;
691
+ ++checkDepth;
692
+ continue;
632
693
  }
633
- }
634
- /**
635
- * @internal
636
- */
637
- runIfDirty() {
638
- if (isDirty(this)) {
639
- this.run();
694
+ if (!dirty && link2.nextDep !== void 0) {
695
+ link2 = link2.nextDep;
696
+ continue;
640
697
  }
698
+ while (checkDepth) {
699
+ --checkDepth;
700
+ const firstSub = sub.subs;
701
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
702
+ if (hasMultipleSubs) {
703
+ link2 = stack.value;
704
+ stack = stack.prev;
705
+ } else {
706
+ link2 = firstSub;
707
+ }
708
+ if (dirty) {
709
+ if (sub.update()) {
710
+ if (hasMultipleSubs) {
711
+ shallowPropagate(firstSub);
712
+ }
713
+ sub = link2.sub;
714
+ continue;
715
+ }
716
+ } else {
717
+ sub.flags &= -33 /* Pending */;
718
+ }
719
+ sub = link2.sub;
720
+ if (link2.nextDep !== void 0) {
721
+ link2 = link2.nextDep;
722
+ continue top;
723
+ }
724
+ dirty = false;
725
+ }
726
+ return dirty;
727
+ } while (true);
728
+ }
729
+ function shallowPropagate(link2) {
730
+ do {
731
+ const sub = link2.sub;
732
+ const nextSub = link2.nextSub;
733
+ const subFlags = sub.flags;
734
+ if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
735
+ sub.flags = subFlags | 16 /* Dirty */;
736
+ }
737
+ link2 = nextSub;
738
+ } while (link2 !== void 0);
739
+ }
740
+ function isValidLink(checkLink, sub) {
741
+ const depsTail = sub.depsTail;
742
+ if (depsTail !== void 0) {
743
+ let link2 = sub.deps;
744
+ do {
745
+ if (link2 === checkLink) {
746
+ return true;
747
+ }
748
+ if (link2 === depsTail) {
749
+ break;
750
+ }
751
+ link2 = link2.nextDep;
752
+ } while (link2 !== void 0);
641
753
  }
642
- get dirty() {
643
- return isDirty(this);
754
+ return false;
755
+ }
756
+
757
+ const triggerEventInfos = [];
758
+ function onTrack(sub, debugInfo) {
759
+ if (sub.onTrack) {
760
+ sub.onTrack(
761
+ extend(
762
+ {
763
+ effect: sub
764
+ },
765
+ debugInfo
766
+ )
767
+ );
644
768
  }
645
769
  }
646
- let batchDepth = 0;
647
- let batchedSub;
648
- let batchedComputed;
649
- function batch(sub, isComputed = false) {
650
- sub.flags |= 8;
651
- if (isComputed) {
652
- sub.next = batchedComputed;
653
- batchedComputed = sub;
654
- return;
770
+ function onTrigger(sub) {
771
+ if (sub.onTrigger) {
772
+ const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
773
+ sub.onTrigger(
774
+ extend(
775
+ {
776
+ effect: sub
777
+ },
778
+ debugInfo
779
+ )
780
+ );
655
781
  }
656
- sub.next = batchedSub;
657
- batchedSub = sub;
658
782
  }
659
- function startBatch() {
660
- batchDepth++;
783
+ function setupOnTrigger(target) {
784
+ Object.defineProperty(target.prototype, "onTrigger", {
785
+ get() {
786
+ return this._onTrigger;
787
+ },
788
+ set(val) {
789
+ if (val && !this._onTrigger) setupFlagsHandler(this);
790
+ this._onTrigger = val;
791
+ }
792
+ });
661
793
  }
662
- function endBatch() {
663
- if (--batchDepth > 0) {
664
- return;
665
- }
666
- if (batchedComputed) {
667
- let e = batchedComputed;
668
- batchedComputed = void 0;
669
- while (e) {
670
- const next = e.next;
671
- e.next = void 0;
672
- e.flags &= -9;
673
- e = next;
674
- }
675
- }
676
- let error;
677
- while (batchedSub) {
678
- let e = batchedSub;
679
- batchedSub = void 0;
680
- while (e) {
681
- const next = e.next;
682
- e.next = void 0;
683
- e.flags &= -9;
684
- if (e.flags & 1) {
685
- try {
686
- ;
687
- e.trigger();
688
- } catch (err) {
689
- if (!error) error = err;
690
- }
794
+ function setupFlagsHandler(target) {
795
+ target._flags = target.flags;
796
+ Object.defineProperty(target, "flags", {
797
+ get() {
798
+ return target._flags;
799
+ },
800
+ set(value) {
801
+ if (!(target._flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && !!(value & (ReactiveFlags.Dirty | ReactiveFlags.Pending))) {
802
+ onTrigger(this);
691
803
  }
692
- e = next;
804
+ target._flags = value;
693
805
  }
694
- }
695
- if (error) throw error;
806
+ });
696
807
  }
697
- function prepareDeps(sub) {
698
- for (let link = sub.deps; link; link = link.nextDep) {
699
- link.version = -1;
700
- link.prevActiveLink = link.dep.activeLink;
701
- link.dep.activeLink = link;
808
+
809
+ class Dep {
810
+ constructor(map, key) {
811
+ this.map = map;
812
+ this.key = key;
813
+ this._subs = void 0;
814
+ this.subsTail = void 0;
815
+ this.flags = ReactiveFlags.None;
702
816
  }
703
- }
704
- function cleanupDeps(sub) {
705
- let head;
706
- let tail = sub.depsTail;
707
- let link = tail;
708
- while (link) {
709
- const prev = link.prevDep;
710
- if (link.version === -1) {
711
- if (link === tail) tail = prev;
712
- removeSub(link);
713
- removeDep(link);
714
- } else {
715
- head = link;
817
+ get subs() {
818
+ return this._subs;
819
+ }
820
+ set subs(value) {
821
+ this._subs = value;
822
+ if (value === void 0) {
823
+ this.map.delete(this.key);
716
824
  }
717
- link.dep.activeLink = link.prevActiveLink;
718
- link.prevActiveLink = void 0;
719
- link = prev;
720
- }
721
- sub.deps = head;
722
- sub.depsTail = tail;
723
- }
724
- function isDirty(sub) {
725
- for (let link = sub.deps; link; link = link.nextDep) {
726
- if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
727
- return true;
728
- }
729
- }
730
- if (sub._dirty) {
731
- return true;
732
- }
733
- return false;
734
- }
735
- function refreshComputed(computed) {
736
- if (computed.flags & 4 && !(computed.flags & 16)) {
737
- return;
738
- }
739
- computed.flags &= -17;
740
- if (computed.globalVersion === globalVersion) {
741
- return;
742
- }
743
- computed.globalVersion = globalVersion;
744
- if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
745
- return;
746
- }
747
- computed.flags |= 2;
748
- const dep = computed.dep;
749
- const prevSub = activeSub;
750
- const prevShouldTrack = shouldTrack;
751
- activeSub = computed;
752
- shouldTrack = true;
753
- try {
754
- prepareDeps(computed);
755
- const value = computed.fn(computed._value);
756
- if (dep.version === 0 || hasChanged(value, computed._value)) {
757
- computed.flags |= 128;
758
- computed._value = value;
759
- dep.version++;
760
- }
761
- } catch (err) {
762
- dep.version++;
763
- throw err;
764
- } finally {
765
- activeSub = prevSub;
766
- shouldTrack = prevShouldTrack;
767
- cleanupDeps(computed);
768
- computed.flags &= -3;
769
- }
770
- }
771
- function removeSub(link, soft = false) {
772
- const { dep, prevSub, nextSub } = link;
773
- if (prevSub) {
774
- prevSub.nextSub = nextSub;
775
- link.prevSub = void 0;
776
- }
777
- if (nextSub) {
778
- nextSub.prevSub = prevSub;
779
- link.nextSub = void 0;
780
- }
781
- if (dep.subsHead === link) {
782
- dep.subsHead = nextSub;
783
- }
784
- if (dep.subs === link) {
785
- dep.subs = prevSub;
786
- if (!prevSub && dep.computed) {
787
- dep.computed.flags &= -5;
788
- for (let l = dep.computed.deps; l; l = l.nextDep) {
789
- removeSub(l, true);
790
- }
791
- }
792
- }
793
- if (!soft && !--dep.sc && dep.map) {
794
- dep.map.delete(dep.key);
795
- }
796
- }
797
- function removeDep(link) {
798
- const { prevDep, nextDep } = link;
799
- if (prevDep) {
800
- prevDep.nextDep = nextDep;
801
- link.prevDep = void 0;
802
- }
803
- if (nextDep) {
804
- nextDep.prevDep = prevDep;
805
- link.nextDep = void 0;
806
- }
807
- }
808
- function effect(fn, options) {
809
- if (fn.effect instanceof ReactiveEffect) {
810
- fn = fn.effect.fn;
811
- }
812
- const e = new ReactiveEffect(fn);
813
- if (options) {
814
- extend(e, options);
815
- }
816
- try {
817
- e.run();
818
- } catch (err) {
819
- e.stop();
820
- throw err;
821
- }
822
- const runner = e.run.bind(e);
823
- runner.effect = e;
824
- return runner;
825
- }
826
- function stop(runner) {
827
- runner.effect.stop();
828
- }
829
- let shouldTrack = true;
830
- const trackStack = [];
831
- function pauseTracking() {
832
- trackStack.push(shouldTrack);
833
- shouldTrack = false;
834
- }
835
- function resetTracking() {
836
- const last = trackStack.pop();
837
- shouldTrack = last === void 0 ? true : last;
838
- }
839
- function cleanupEffect(e) {
840
- const { cleanup } = e;
841
- e.cleanup = void 0;
842
- if (cleanup) {
843
- const prevSub = activeSub;
844
- activeSub = void 0;
845
- try {
846
- cleanup();
847
- } finally {
848
- activeSub = prevSub;
849
- }
850
- }
851
- }
852
-
853
- let globalVersion = 0;
854
- class Link {
855
- constructor(sub, dep) {
856
- this.sub = sub;
857
- this.dep = dep;
858
- this.version = dep.version;
859
- this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
860
- }
861
- }
862
- class Dep {
863
- // TODO isolatedDeclarations "__v_skip"
864
- constructor(computed) {
865
- this.computed = computed;
866
- this.version = 0;
867
- /**
868
- * Link between this dep and the current active effect
869
- */
870
- this.activeLink = void 0;
871
- /**
872
- * Doubly linked list representing the subscribing effects (tail)
873
- */
874
- this.subs = void 0;
875
- /**
876
- * For object property deps cleanup
877
- */
878
- this.map = void 0;
879
- this.key = void 0;
880
- /**
881
- * Subscriber counter
882
- */
883
- this.sc = 0;
884
- /**
885
- * @internal
886
- */
887
- this.__v_skip = true;
888
- {
889
- this.subsHead = void 0;
890
- }
891
- }
892
- track(debugInfo) {
893
- if (!activeSub || !shouldTrack || activeSub === this.computed) {
894
- return;
895
- }
896
- let link = this.activeLink;
897
- if (link === void 0 || link.sub !== activeSub) {
898
- link = this.activeLink = new Link(activeSub, this);
899
- if (!activeSub.deps) {
900
- activeSub.deps = activeSub.depsTail = link;
901
- } else {
902
- link.prevDep = activeSub.depsTail;
903
- activeSub.depsTail.nextDep = link;
904
- activeSub.depsTail = link;
905
- }
906
- addSub(link);
907
- } else if (link.version === -1) {
908
- link.version = this.version;
909
- if (link.nextDep) {
910
- const next = link.nextDep;
911
- next.prevDep = link.prevDep;
912
- if (link.prevDep) {
913
- link.prevDep.nextDep = next;
914
- }
915
- link.prevDep = activeSub.depsTail;
916
- link.nextDep = void 0;
917
- activeSub.depsTail.nextDep = link;
918
- activeSub.depsTail = link;
919
- if (activeSub.deps === link) {
920
- activeSub.deps = next;
921
- }
922
- }
923
- }
924
- if (activeSub.onTrack) {
925
- activeSub.onTrack(
926
- extend(
927
- {
928
- effect: activeSub
929
- },
930
- debugInfo
931
- )
932
- );
933
- }
934
- return link;
935
- }
936
- trigger(debugInfo) {
937
- this.version++;
938
- globalVersion++;
939
- this.notify(debugInfo);
940
- }
941
- notify(debugInfo) {
942
- startBatch();
943
- try {
944
- if (true) {
945
- for (let head = this.subsHead; head; head = head.nextSub) {
946
- if (head.sub.onTrigger && !(head.sub.flags & 8)) {
947
- head.sub.onTrigger(
948
- extend(
949
- {
950
- effect: head.sub
951
- },
952
- debugInfo
953
- )
954
- );
955
- }
956
- }
957
- }
958
- for (let link = this.subs; link; link = link.prevSub) {
959
- if (link.sub.notify()) {
960
- ;
961
- link.sub.dep.notify();
962
- }
963
- }
964
- } finally {
965
- endBatch();
966
- }
967
- }
968
- }
969
- function addSub(link) {
970
- link.dep.sc++;
971
- if (link.sub.flags & 4) {
972
- const computed = link.dep.computed;
973
- if (computed && !link.dep.subs) {
974
- computed.flags |= 4 | 16;
975
- for (let l = computed.deps; l; l = l.nextDep) {
976
- addSub(l);
977
- }
978
- }
979
- const currentTail = link.dep.subs;
980
- if (currentTail !== link) {
981
- link.prevSub = currentTail;
982
- if (currentTail) currentTail.nextSub = link;
983
- }
984
- if (link.dep.subsHead === void 0) {
985
- link.dep.subsHead = link;
986
- }
987
- link.dep.subs = link;
988
825
  }
989
826
  }
990
827
  const targetMap = /* @__PURE__ */ new WeakMap();
@@ -998,36 +835,34 @@ var Vue = (function (exports) {
998
835
  "Array iterate"
999
836
  );
1000
837
  function track(target, type, key) {
1001
- if (shouldTrack && activeSub) {
838
+ if (activeSub !== void 0) {
1002
839
  let depsMap = targetMap.get(target);
1003
840
  if (!depsMap) {
1004
841
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
1005
842
  }
1006
843
  let dep = depsMap.get(key);
1007
844
  if (!dep) {
1008
- depsMap.set(key, dep = new Dep());
1009
- dep.map = depsMap;
1010
- dep.key = key;
845
+ depsMap.set(key, dep = new Dep(depsMap, key));
1011
846
  }
1012
847
  {
1013
- dep.track({
848
+ onTrack(activeSub, {
1014
849
  target,
1015
850
  type,
1016
851
  key
1017
852
  });
1018
853
  }
854
+ link(dep, activeSub);
1019
855
  }
1020
856
  }
1021
857
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
1022
858
  const depsMap = targetMap.get(target);
1023
859
  if (!depsMap) {
1024
- globalVersion++;
1025
860
  return;
1026
861
  }
1027
862
  const run = (dep) => {
1028
- if (dep) {
863
+ if (dep !== void 0 && dep.subs !== void 0) {
1029
864
  {
1030
- dep.trigger({
865
+ triggerEventInfos.push({
1031
866
  target,
1032
867
  type,
1033
868
  key,
@@ -1036,6 +871,11 @@ var Vue = (function (exports) {
1036
871
  oldTarget
1037
872
  });
1038
873
  }
874
+ propagate(dep.subs);
875
+ shallowPropagate(dep.subs);
876
+ {
877
+ triggerEventInfos.pop();
878
+ }
1039
879
  }
1040
880
  };
1041
881
  startBatch();
@@ -1260,11 +1100,11 @@ var Vue = (function (exports) {
1260
1100
  return res;
1261
1101
  }
1262
1102
  function noTracking(self, method, args = []) {
1263
- pauseTracking();
1264
1103
  startBatch();
1104
+ const prevSub = setActiveSub();
1265
1105
  const res = toRaw(self)[method].apply(self, args);
1106
+ setActiveSub(prevSub);
1266
1107
  endBatch();
1267
- resetTracking();
1268
1108
  return res;
1269
1109
  }
1270
1110
 
@@ -1310,14 +1150,18 @@ var Vue = (function (exports) {
1310
1150
  return hasOwnProperty;
1311
1151
  }
1312
1152
  }
1153
+ const wasRef = isRef(target);
1313
1154
  const res = Reflect.get(
1314
1155
  target,
1315
1156
  key,
1316
1157
  // if this is a proxy wrapping a ref, return methods using the raw ref
1317
1158
  // as receiver so that we don't have to call `toRaw` on the ref in all
1318
1159
  // its class methods
1319
- isRef(target) ? target : receiver
1160
+ wasRef ? target : receiver
1320
1161
  );
1162
+ if (wasRef && key !== "value") {
1163
+ return res;
1164
+ }
1321
1165
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1322
1166
  return res;
1323
1167
  }
@@ -1769,33 +1613,47 @@ var Vue = (function (exports) {
1769
1613
  return r ? r["__v_isRef"] === true : false;
1770
1614
  }
1771
1615
  function ref(value) {
1772
- return createRef(value, false);
1616
+ return createRef(value, toReactive);
1773
1617
  }
1774
1618
  function shallowRef(value) {
1775
- return createRef(value, true);
1619
+ return createRef(value);
1776
1620
  }
1777
- function createRef(rawValue, shallow) {
1621
+ function createRef(rawValue, wrap) {
1778
1622
  if (isRef(rawValue)) {
1779
1623
  return rawValue;
1780
1624
  }
1781
- return new RefImpl(rawValue, shallow);
1625
+ return new RefImpl(rawValue, wrap);
1782
1626
  }
1783
1627
  class RefImpl {
1784
- constructor(value, isShallow2) {
1785
- this.dep = new Dep();
1786
- this["__v_isRef"] = true;
1787
- this["__v_isShallow"] = false;
1788
- this._rawValue = isShallow2 ? value : toRaw(value);
1789
- this._value = isShallow2 ? value : toReactive(value);
1790
- this["__v_isShallow"] = isShallow2;
1628
+ // TODO isolatedDeclarations "__v_isShallow"
1629
+ constructor(value, wrap) {
1630
+ this.subs = void 0;
1631
+ this.subsTail = void 0;
1632
+ this.flags = ReactiveFlags.Mutable;
1633
+ /**
1634
+ * @internal
1635
+ */
1636
+ this.__v_isRef = true;
1637
+ // TODO isolatedDeclarations "__v_isRef"
1638
+ /**
1639
+ * @internal
1640
+ */
1641
+ this.__v_isShallow = false;
1642
+ this._oldValue = this._rawValue = wrap ? toRaw(value) : value;
1643
+ this._value = wrap ? wrap(value) : value;
1644
+ this._wrap = wrap;
1645
+ this["__v_isShallow"] = !wrap;
1646
+ }
1647
+ get dep() {
1648
+ return this;
1791
1649
  }
1792
1650
  get value() {
1793
- {
1794
- this.dep.track({
1795
- target: this,
1796
- type: "get",
1797
- key: "value"
1798
- });
1651
+ trackRef(this);
1652
+ if (this.flags & ReactiveFlags.Dirty && this.update()) {
1653
+ const subs = this.subs;
1654
+ if (subs !== void 0) {
1655
+ shallowPropagate(subs);
1656
+ }
1799
1657
  }
1800
1658
  return this._value;
1801
1659
  }
@@ -1804,30 +1662,55 @@ var Vue = (function (exports) {
1804
1662
  const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1805
1663
  newValue = useDirectValue ? newValue : toRaw(newValue);
1806
1664
  if (hasChanged(newValue, oldValue)) {
1665
+ this.flags |= ReactiveFlags.Dirty;
1807
1666
  this._rawValue = newValue;
1808
- this._value = useDirectValue ? newValue : toReactive(newValue);
1809
- {
1810
- this.dep.trigger({
1811
- target: this,
1812
- type: "set",
1813
- key: "value",
1814
- newValue,
1815
- oldValue
1816
- });
1667
+ this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
1668
+ const subs = this.subs;
1669
+ if (subs !== void 0) {
1670
+ {
1671
+ triggerEventInfos.push({
1672
+ target: this,
1673
+ type: "set",
1674
+ key: "value",
1675
+ newValue,
1676
+ oldValue
1677
+ });
1678
+ }
1679
+ propagate(subs);
1680
+ if (!batchDepth) {
1681
+ flush();
1682
+ }
1683
+ {
1684
+ triggerEventInfos.pop();
1685
+ }
1817
1686
  }
1818
1687
  }
1819
1688
  }
1689
+ update() {
1690
+ this.flags &= ~ReactiveFlags.Dirty;
1691
+ return hasChanged(this._oldValue, this._oldValue = this._rawValue);
1692
+ }
1820
1693
  }
1821
1694
  function triggerRef(ref2) {
1822
- if (ref2.dep) {
1695
+ const dep = ref2.dep;
1696
+ if (dep !== void 0 && dep.subs !== void 0) {
1697
+ propagate(dep.subs);
1698
+ shallowPropagate(dep.subs);
1699
+ if (!batchDepth) {
1700
+ flush();
1701
+ }
1702
+ }
1703
+ }
1704
+ function trackRef(dep) {
1705
+ if (activeSub !== void 0) {
1823
1706
  {
1824
- ref2.dep.trigger({
1825
- target: ref2,
1826
- type: "set",
1827
- key: "value",
1828
- newValue: ref2._value
1707
+ onTrack(activeSub, {
1708
+ target: dep,
1709
+ type: "get",
1710
+ key: "value"
1829
1711
  });
1830
1712
  }
1713
+ link(dep, activeSub);
1831
1714
  }
1832
1715
  }
1833
1716
  function unref(ref2) {
@@ -1853,13 +1736,21 @@ var Vue = (function (exports) {
1853
1736
  }
1854
1737
  class CustomRefImpl {
1855
1738
  constructor(factory) {
1739
+ this.subs = void 0;
1740
+ this.subsTail = void 0;
1741
+ this.flags = ReactiveFlags.None;
1856
1742
  this["__v_isRef"] = true;
1857
1743
  this._value = void 0;
1858
- const dep = this.dep = new Dep();
1859
- const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1744
+ const { get, set } = factory(
1745
+ () => trackRef(this),
1746
+ () => triggerRef(this)
1747
+ );
1860
1748
  this._get = get;
1861
1749
  this._set = set;
1862
1750
  }
1751
+ get dep() {
1752
+ return this;
1753
+ }
1863
1754
  get value() {
1864
1755
  return this._value = this._get();
1865
1756
  }
@@ -1871,9 +1762,6 @@ var Vue = (function (exports) {
1871
1762
  return new CustomRefImpl(factory);
1872
1763
  }
1873
1764
  function toRefs(object) {
1874
- if (!isProxy(object)) {
1875
- warn$2(`toRefs() expects a reactive object but received a plain one.`);
1876
- }
1877
1765
  const ret = isArray(object) ? new Array(object.length) : {};
1878
1766
  for (const key in object) {
1879
1767
  ret[key] = propertyToRef(object, key);
@@ -1926,69 +1814,331 @@ var Vue = (function (exports) {
1926
1814
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1927
1815
  }
1928
1816
 
1929
- class ComputedRefImpl {
1930
- constructor(fn, setter, isSSR) {
1931
- this.fn = fn;
1932
- this.setter = setter;
1933
- /**
1934
- * @internal
1935
- */
1936
- this._value = void 0;
1937
- /**
1938
- * @internal
1939
- */
1940
- this.dep = new Dep(this);
1817
+ class ReactiveEffect {
1818
+ constructor(fn) {
1819
+ this.deps = void 0;
1820
+ this.depsTail = void 0;
1821
+ this.subs = void 0;
1822
+ this.subsTail = void 0;
1823
+ this.flags = ReactiveFlags.Watching | ReactiveFlags.Dirty;
1941
1824
  /**
1942
1825
  * @internal
1943
1826
  */
1944
- this.__v_isRef = true;
1945
- // TODO isolatedDeclarations "__v_isReadonly"
1946
- // A computed is also a subscriber that tracks other deps
1827
+ this.cleanups = [];
1947
1828
  /**
1948
1829
  * @internal
1949
1830
  */
1831
+ this.cleanupsLength = 0;
1832
+ if (fn !== void 0) {
1833
+ this.fn = fn;
1834
+ }
1835
+ if (activeEffectScope) {
1836
+ link(this, activeEffectScope);
1837
+ }
1838
+ }
1839
+ // @ts-expect-error
1840
+ fn() {
1841
+ }
1842
+ get active() {
1843
+ return !(this.flags & 1024);
1844
+ }
1845
+ pause() {
1846
+ this.flags |= 256;
1847
+ }
1848
+ resume() {
1849
+ const flags = this.flags &= -257;
1850
+ if (flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) {
1851
+ this.notify();
1852
+ }
1853
+ }
1854
+ notify() {
1855
+ if (!(this.flags & 256) && this.dirty) {
1856
+ this.run();
1857
+ }
1858
+ }
1859
+ run() {
1860
+ if (!this.active) {
1861
+ return this.fn();
1862
+ }
1863
+ cleanup(this);
1864
+ const prevSub = startTracking(this);
1865
+ try {
1866
+ return this.fn();
1867
+ } finally {
1868
+ endTracking(this, prevSub);
1869
+ const flags = this.flags;
1870
+ if ((flags & (ReactiveFlags.Recursed | 128)) === (ReactiveFlags.Recursed | 128)) {
1871
+ this.flags = flags & ~ReactiveFlags.Recursed;
1872
+ this.notify();
1873
+ }
1874
+ }
1875
+ }
1876
+ stop() {
1877
+ if (!this.active) {
1878
+ return;
1879
+ }
1880
+ this.flags = 1024;
1881
+ let dep = this.deps;
1882
+ while (dep !== void 0) {
1883
+ dep = unlink(dep, this);
1884
+ }
1885
+ const sub = this.subs;
1886
+ if (sub !== void 0) {
1887
+ unlink(sub);
1888
+ }
1889
+ cleanup(this);
1890
+ }
1891
+ get dirty() {
1892
+ const flags = this.flags;
1893
+ if (flags & ReactiveFlags.Dirty) {
1894
+ return true;
1895
+ }
1896
+ if (flags & ReactiveFlags.Pending) {
1897
+ if (checkDirty(this.deps, this)) {
1898
+ this.flags = flags | ReactiveFlags.Dirty;
1899
+ return true;
1900
+ } else {
1901
+ this.flags = flags & ~ReactiveFlags.Pending;
1902
+ }
1903
+ }
1904
+ return false;
1905
+ }
1906
+ }
1907
+ {
1908
+ setupOnTrigger(ReactiveEffect);
1909
+ }
1910
+ function effect(fn, options) {
1911
+ if (fn.effect instanceof ReactiveEffect) {
1912
+ fn = fn.effect.fn;
1913
+ }
1914
+ const e = new ReactiveEffect(fn);
1915
+ if (options) {
1916
+ const { onStop, scheduler } = options;
1917
+ if (onStop) {
1918
+ options.onStop = void 0;
1919
+ const stop2 = e.stop.bind(e);
1920
+ e.stop = () => {
1921
+ stop2();
1922
+ onStop();
1923
+ };
1924
+ }
1925
+ if (scheduler) {
1926
+ options.scheduler = void 0;
1927
+ e.notify = () => {
1928
+ if (!(e.flags & 256)) {
1929
+ scheduler();
1930
+ }
1931
+ };
1932
+ }
1933
+ extend(e, options);
1934
+ }
1935
+ try {
1936
+ e.run();
1937
+ } catch (err) {
1938
+ e.stop();
1939
+ throw err;
1940
+ }
1941
+ const runner = e.run.bind(e);
1942
+ runner.effect = e;
1943
+ return runner;
1944
+ }
1945
+ function stop(runner) {
1946
+ runner.effect.stop();
1947
+ }
1948
+ function cleanup(sub) {
1949
+ const l = sub.cleanupsLength;
1950
+ if (l) {
1951
+ for (let i = 0; i < l; i++) {
1952
+ sub.cleanups[i]();
1953
+ }
1954
+ sub.cleanupsLength = 0;
1955
+ }
1956
+ }
1957
+
1958
+ let activeEffectScope;
1959
+ class EffectScope {
1960
+ constructor(detached = false) {
1950
1961
  this.deps = void 0;
1962
+ this.depsTail = void 0;
1963
+ this.subs = void 0;
1964
+ this.subsTail = void 0;
1965
+ this.flags = 0;
1951
1966
  /**
1952
1967
  * @internal
1953
1968
  */
1954
- this.depsTail = void 0;
1969
+ this.cleanups = [];
1955
1970
  /**
1956
1971
  * @internal
1957
1972
  */
1958
- this.flags = 16;
1973
+ this.cleanupsLength = 0;
1974
+ if (!detached && activeEffectScope) {
1975
+ link(this, activeEffectScope);
1976
+ }
1977
+ }
1978
+ get active() {
1979
+ return !(this.flags & 1024);
1980
+ }
1981
+ pause() {
1982
+ if (!(this.flags & 256)) {
1983
+ this.flags |= 256;
1984
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1985
+ const dep = link2.dep;
1986
+ if ("pause" in dep) {
1987
+ dep.pause();
1988
+ }
1989
+ }
1990
+ }
1991
+ }
1992
+ /**
1993
+ * Resumes the effect scope, including all child scopes and effects.
1994
+ */
1995
+ resume() {
1996
+ const flags = this.flags;
1997
+ if (flags & 256) {
1998
+ this.flags = flags & -257;
1999
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
2000
+ const dep = link2.dep;
2001
+ if ("resume" in dep) {
2002
+ dep.resume();
2003
+ }
2004
+ }
2005
+ }
2006
+ }
2007
+ run(fn) {
2008
+ const prevScope = activeEffectScope;
2009
+ try {
2010
+ activeEffectScope = this;
2011
+ return fn();
2012
+ } finally {
2013
+ activeEffectScope = prevScope;
2014
+ }
2015
+ }
2016
+ stop() {
2017
+ if (!this.active) {
2018
+ return;
2019
+ }
2020
+ this.flags = 1024;
2021
+ let dep = this.deps;
2022
+ while (dep !== void 0) {
2023
+ const node = dep.dep;
2024
+ if ("stop" in node) {
2025
+ dep = dep.nextDep;
2026
+ node.stop();
2027
+ } else {
2028
+ dep = unlink(dep, this);
2029
+ }
2030
+ }
2031
+ const sub = this.subs;
2032
+ if (sub !== void 0) {
2033
+ unlink(sub);
2034
+ }
2035
+ cleanup(this);
2036
+ }
2037
+ }
2038
+ function effectScope(detached) {
2039
+ return new EffectScope(detached);
2040
+ }
2041
+ function getCurrentScope() {
2042
+ return activeEffectScope;
2043
+ }
2044
+ function setCurrentScope(scope) {
2045
+ try {
2046
+ return activeEffectScope;
2047
+ } finally {
2048
+ activeEffectScope = scope;
2049
+ }
2050
+ }
2051
+ function onScopeDispose(fn, failSilently = false) {
2052
+ if (activeEffectScope !== void 0) {
2053
+ activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
2054
+ } else if (!failSilently) {
2055
+ warn$2(
2056
+ `onScopeDispose() is called when there is no active effect scope to be associated with.`
2057
+ );
2058
+ }
2059
+ }
2060
+
2061
+ class ComputedRefImpl {
2062
+ constructor(fn, setter) {
2063
+ this.fn = fn;
2064
+ this.setter = setter;
1959
2065
  /**
1960
2066
  * @internal
1961
2067
  */
1962
- this.globalVersion = globalVersion - 1;
2068
+ this._value = void 0;
2069
+ this.subs = void 0;
2070
+ this.subsTail = void 0;
2071
+ this.deps = void 0;
2072
+ this.depsTail = void 0;
2073
+ this.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
1963
2074
  /**
1964
2075
  * @internal
1965
2076
  */
1966
- this.next = void 0;
1967
- // for backwards compat
1968
- this.effect = this;
2077
+ this.__v_isRef = true;
1969
2078
  this["__v_isReadonly"] = !setter;
1970
- this.isSSR = isSSR;
2079
+ }
2080
+ // TODO isolatedDeclarations "__v_isReadonly"
2081
+ // for backwards compat
2082
+ get effect() {
2083
+ return this;
2084
+ }
2085
+ // for backwards compat
2086
+ get dep() {
2087
+ return this;
1971
2088
  }
1972
2089
  /**
1973
2090
  * @internal
2091
+ * for backwards compat
1974
2092
  */
1975
- notify() {
1976
- this.flags |= 16;
1977
- if (!(this.flags & 8) && // avoid infinite self recursion
1978
- activeSub !== this) {
1979
- batch(this, true);
2093
+ get _dirty() {
2094
+ const flags = this.flags;
2095
+ if (flags & ReactiveFlags.Dirty) {
1980
2096
  return true;
1981
2097
  }
2098
+ if (flags & ReactiveFlags.Pending) {
2099
+ if (checkDirty(this.deps, this)) {
2100
+ this.flags = flags | ReactiveFlags.Dirty;
2101
+ return true;
2102
+ } else {
2103
+ this.flags = flags & ~ReactiveFlags.Pending;
2104
+ }
2105
+ }
2106
+ return false;
2107
+ }
2108
+ /**
2109
+ * @internal
2110
+ * for backwards compat
2111
+ */
2112
+ set _dirty(v) {
2113
+ if (v) {
2114
+ this.flags |= ReactiveFlags.Dirty;
2115
+ } else {
2116
+ this.flags &= ~(ReactiveFlags.Dirty | ReactiveFlags.Pending);
2117
+ }
1982
2118
  }
1983
2119
  get value() {
1984
- const link = this.dep.track({
1985
- target: this,
1986
- type: "get",
1987
- key: "value"
1988
- }) ;
1989
- refreshComputed(this);
1990
- if (link) {
1991
- link.version = this.dep.version;
2120
+ const flags = this.flags;
2121
+ if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) {
2122
+ if (this.update()) {
2123
+ const subs = this.subs;
2124
+ if (subs !== void 0) {
2125
+ shallowPropagate(subs);
2126
+ }
2127
+ }
2128
+ } else if (flags & ReactiveFlags.Pending) {
2129
+ this.flags = flags & ~ReactiveFlags.Pending;
2130
+ }
2131
+ if (activeSub !== void 0) {
2132
+ {
2133
+ onTrack(activeSub, {
2134
+ target: this,
2135
+ type: "get",
2136
+ key: "value"
2137
+ });
2138
+ }
2139
+ link(this, activeSub);
2140
+ } else if (activeEffectScope !== void 0) {
2141
+ link(this, activeEffectScope);
1992
2142
  }
1993
2143
  return this._value;
1994
2144
  }
@@ -1999,6 +2149,23 @@ var Vue = (function (exports) {
1999
2149
  warn$2("Write operation failed: computed value is readonly");
2000
2150
  }
2001
2151
  }
2152
+ update() {
2153
+ const prevSub = startTracking(this);
2154
+ try {
2155
+ const oldValue = this._value;
2156
+ const newValue = this.fn(oldValue);
2157
+ if (hasChanged(oldValue, newValue)) {
2158
+ this._value = newValue;
2159
+ return true;
2160
+ }
2161
+ return false;
2162
+ } finally {
2163
+ endTracking(this, prevSub);
2164
+ }
2165
+ }
2166
+ }
2167
+ {
2168
+ setupOnTrigger(ComputedRefImpl);
2002
2169
  }
2003
2170
  function computed$1(getterOrOptions, debugOptions, isSSR = false) {
2004
2171
  let getter;
@@ -2009,7 +2176,7 @@ var Vue = (function (exports) {
2009
2176
  getter = getterOrOptions.get;
2010
2177
  setter = getterOrOptions.set;
2011
2178
  }
2012
- const cRef = new ComputedRefImpl(getter, setter, isSSR);
2179
+ const cRef = new ComputedRefImpl(getter, setter);
2013
2180
  if (debugOptions && !isSSR) {
2014
2181
  cRef.onTrack = debugOptions.onTrack;
2015
2182
  cRef.onTrigger = debugOptions.onTrigger;
@@ -2030,177 +2197,146 @@ var Vue = (function (exports) {
2030
2197
  };
2031
2198
 
2032
2199
  const INITIAL_WATCHER_VALUE = {};
2033
- const cleanupMap = /* @__PURE__ */ new WeakMap();
2034
2200
  let activeWatcher = void 0;
2035
2201
  function getCurrentWatcher() {
2036
2202
  return activeWatcher;
2037
2203
  }
2038
2204
  function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
2039
2205
  if (owner) {
2040
- let cleanups = cleanupMap.get(owner);
2041
- if (!cleanups) cleanupMap.set(owner, cleanups = []);
2042
- cleanups.push(cleanupFn);
2206
+ const { call } = owner.options;
2207
+ if (call) {
2208
+ owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
2209
+ } else {
2210
+ owner.cleanups[owner.cleanupsLength++] = cleanupFn;
2211
+ }
2043
2212
  } else if (!failSilently) {
2044
2213
  warn$2(
2045
2214
  `onWatcherCleanup() was called when there was no active watcher to associate with.`
2046
2215
  );
2047
2216
  }
2048
2217
  }
2049
- function watch$1(source, cb, options = EMPTY_OBJ) {
2050
- const { immediate, deep, once, scheduler, augmentJob, call } = options;
2051
- const warnInvalidSource = (s) => {
2052
- (options.onWarn || warn$2)(
2053
- `Invalid watch source: `,
2054
- s,
2055
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
2056
- );
2057
- };
2058
- const reactiveGetter = (source2) => {
2059
- if (deep) return source2;
2060
- if (isShallow(source2) || deep === false || deep === 0)
2061
- return traverse(source2, 1);
2062
- return traverse(source2);
2063
- };
2064
- let effect;
2065
- let getter;
2066
- let cleanup;
2067
- let boundCleanup;
2068
- let forceTrigger = false;
2069
- let isMultiSource = false;
2070
- if (isRef(source)) {
2071
- getter = () => source.value;
2072
- forceTrigger = isShallow(source);
2073
- } else if (isReactive(source)) {
2074
- getter = () => reactiveGetter(source);
2075
- forceTrigger = true;
2076
- } else if (isArray(source)) {
2077
- isMultiSource = true;
2078
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
2079
- getter = () => source.map((s) => {
2080
- if (isRef(s)) {
2081
- return s.value;
2082
- } else if (isReactive(s)) {
2083
- return reactiveGetter(s);
2084
- } else if (isFunction(s)) {
2085
- return call ? call(s, 2) : s();
2218
+ class WatcherEffect extends ReactiveEffect {
2219
+ constructor(source, cb, options = EMPTY_OBJ) {
2220
+ const { deep, once, call, onWarn } = options;
2221
+ let getter;
2222
+ let forceTrigger = false;
2223
+ let isMultiSource = false;
2224
+ if (isRef(source)) {
2225
+ getter = () => source.value;
2226
+ forceTrigger = isShallow(source);
2227
+ } else if (isReactive(source)) {
2228
+ getter = () => reactiveGetter(source, deep);
2229
+ forceTrigger = true;
2230
+ } else if (isArray(source)) {
2231
+ isMultiSource = true;
2232
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
2233
+ getter = () => source.map((s) => {
2234
+ if (isRef(s)) {
2235
+ return s.value;
2236
+ } else if (isReactive(s)) {
2237
+ return reactiveGetter(s, deep);
2238
+ } else if (isFunction(s)) {
2239
+ return call ? call(s, 2) : s();
2240
+ } else {
2241
+ warnInvalidSource(s, onWarn);
2242
+ }
2243
+ });
2244
+ } else if (isFunction(source)) {
2245
+ if (cb) {
2246
+ getter = call ? () => call(source, 2) : source;
2086
2247
  } else {
2087
- warnInvalidSource(s);
2088
- }
2089
- });
2090
- } else if (isFunction(source)) {
2091
- if (cb) {
2092
- getter = call ? () => call(source, 2) : source;
2093
- } else {
2094
- getter = () => {
2095
- if (cleanup) {
2096
- pauseTracking();
2248
+ getter = () => {
2249
+ if (this.cleanupsLength) {
2250
+ const prevSub = setActiveSub();
2251
+ try {
2252
+ cleanup(this);
2253
+ } finally {
2254
+ setActiveSub(prevSub);
2255
+ }
2256
+ }
2257
+ const currentEffect = activeWatcher;
2258
+ activeWatcher = this;
2097
2259
  try {
2098
- cleanup();
2260
+ return call ? call(source, 3, [
2261
+ this.boundCleanup
2262
+ ]) : source(this.boundCleanup);
2099
2263
  } finally {
2100
- resetTracking();
2264
+ activeWatcher = currentEffect;
2101
2265
  }
2102
- }
2103
- const currentEffect = activeWatcher;
2104
- activeWatcher = effect;
2105
- try {
2106
- return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
2107
- } finally {
2108
- activeWatcher = currentEffect;
2109
- }
2266
+ };
2267
+ }
2268
+ } else {
2269
+ getter = NOOP;
2270
+ warnInvalidSource(source, onWarn);
2271
+ }
2272
+ if (cb && deep) {
2273
+ const baseGetter = getter;
2274
+ const depth = deep === true ? Infinity : deep;
2275
+ getter = () => traverse(baseGetter(), depth);
2276
+ }
2277
+ super(getter);
2278
+ this.cb = cb;
2279
+ this.options = options;
2280
+ this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
2281
+ this.forceTrigger = forceTrigger;
2282
+ this.isMultiSource = isMultiSource;
2283
+ if (once && cb) {
2284
+ const _cb = cb;
2285
+ cb = (...args) => {
2286
+ _cb(...args);
2287
+ this.stop();
2110
2288
  };
2111
2289
  }
2112
- } else {
2113
- getter = NOOP;
2114
- warnInvalidSource(source);
2115
- }
2116
- if (cb && deep) {
2117
- const baseGetter = getter;
2118
- const depth = deep === true ? Infinity : deep;
2119
- getter = () => traverse(baseGetter(), depth);
2120
- }
2121
- const scope = getCurrentScope();
2122
- const watchHandle = () => {
2123
- effect.stop();
2124
- if (scope && scope.active) {
2125
- remove(scope.effects, effect);
2290
+ this.cb = cb;
2291
+ this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2292
+ {
2293
+ this.onTrack = options.onTrack;
2294
+ this.onTrigger = options.onTrigger;
2126
2295
  }
2127
- };
2128
- if (once && cb) {
2129
- const _cb = cb;
2130
- cb = (...args) => {
2131
- _cb(...args);
2132
- watchHandle();
2133
- };
2134
2296
  }
2135
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2136
- const job = (immediateFirstRun) => {
2137
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2297
+ run(initialRun = false) {
2298
+ const oldValue = this.oldValue;
2299
+ const newValue = this.oldValue = super.run();
2300
+ if (!this.cb) {
2138
2301
  return;
2139
2302
  }
2140
- if (cb) {
2141
- const newValue = effect.run();
2142
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2143
- if (cleanup) {
2144
- cleanup();
2145
- }
2146
- const currentWatcher = activeWatcher;
2147
- activeWatcher = effect;
2148
- try {
2149
- const args = [
2150
- newValue,
2151
- // pass undefined as the old value when it's changed for the first time
2152
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2153
- boundCleanup
2154
- ];
2155
- oldValue = newValue;
2156
- call ? call(cb, 3, args) : (
2157
- // @ts-expect-error
2158
- cb(...args)
2159
- );
2160
- } finally {
2161
- activeWatcher = currentWatcher;
2162
- }
2163
- }
2164
- } else {
2165
- effect.run();
2166
- }
2167
- };
2168
- if (augmentJob) {
2169
- augmentJob(job);
2170
- }
2171
- effect = new ReactiveEffect(getter);
2172
- effect.scheduler = scheduler ? () => scheduler(job, false) : job;
2173
- boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
2174
- cleanup = effect.onStop = () => {
2175
- const cleanups = cleanupMap.get(effect);
2176
- if (cleanups) {
2177
- if (call) {
2178
- call(cleanups, 4);
2179
- } else {
2180
- for (const cleanup2 of cleanups) cleanup2();
2181
- }
2182
- cleanupMap.delete(effect);
2303
+ const { immediate, deep, call } = this.options;
2304
+ if (initialRun && !immediate) {
2305
+ return;
2183
2306
  }
2184
- };
2185
- {
2186
- effect.onTrack = options.onTrack;
2187
- effect.onTrigger = options.onTrigger;
2188
- }
2189
- if (cb) {
2190
- if (immediate) {
2191
- job(true);
2192
- } else {
2193
- oldValue = effect.run();
2307
+ if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2308
+ cleanup(this);
2309
+ const currentWatcher = activeWatcher;
2310
+ activeWatcher = this;
2311
+ try {
2312
+ const args = [
2313
+ newValue,
2314
+ // pass undefined as the old value when it's changed for the first time
2315
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2316
+ this.boundCleanup
2317
+ ];
2318
+ call ? call(this.cb, 3, args) : (
2319
+ // @ts-expect-error
2320
+ this.cb(...args)
2321
+ );
2322
+ } finally {
2323
+ activeWatcher = currentWatcher;
2324
+ }
2194
2325
  }
2195
- } else if (scheduler) {
2196
- scheduler(job.bind(null, true), true);
2197
- } else {
2198
- effect.run();
2199
2326
  }
2200
- watchHandle.pause = effect.pause.bind(effect);
2201
- watchHandle.resume = effect.resume.bind(effect);
2202
- watchHandle.stop = watchHandle;
2203
- return watchHandle;
2327
+ }
2328
+ function reactiveGetter(source, deep) {
2329
+ if (deep) return source;
2330
+ if (isShallow(source) || deep === false || deep === 0)
2331
+ return traverse(source, 1);
2332
+ return traverse(source);
2333
+ }
2334
+ function warnInvalidSource(s, onWarn) {
2335
+ (onWarn || warn$2)(
2336
+ `Invalid watch source: `,
2337
+ s,
2338
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
2339
+ );
2204
2340
  }
2205
2341
  function traverse(value, depth = Infinity, seen) {
2206
2342
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
@@ -2236,8 +2372,8 @@ var Vue = (function (exports) {
2236
2372
  }
2237
2373
 
2238
2374
  const stack$1 = [];
2239
- function pushWarningContext(vnode) {
2240
- stack$1.push(vnode);
2375
+ function pushWarningContext(ctx) {
2376
+ stack$1.push(ctx);
2241
2377
  }
2242
2378
  function popWarningContext() {
2243
2379
  stack$1.pop();
@@ -2246,8 +2382,9 @@ var Vue = (function (exports) {
2246
2382
  function warn$1(msg, ...args) {
2247
2383
  if (isWarning) return;
2248
2384
  isWarning = true;
2249
- pauseTracking();
2250
- const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
2385
+ const prevSub = setActiveSub();
2386
+ const entry = stack$1.length ? stack$1[stack$1.length - 1] : null;
2387
+ const instance = isVNode(entry) ? entry.component : entry;
2251
2388
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
2252
2389
  const trace = getComponentTrace();
2253
2390
  if (appWarnHandler) {
@@ -2261,9 +2398,9 @@ var Vue = (function (exports) {
2261
2398
  var _a, _b;
2262
2399
  return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
2263
2400
  }).join(""),
2264
- instance && instance.proxy,
2401
+ instance && instance.proxy || instance,
2265
2402
  trace.map(
2266
- ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
2403
+ ({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
2267
2404
  ).join("\n"),
2268
2405
  trace
2269
2406
  ]
@@ -2277,27 +2414,31 @@ var Vue = (function (exports) {
2277
2414
  }
2278
2415
  console.warn(...warnArgs);
2279
2416
  }
2280
- resetTracking();
2417
+ setActiveSub(prevSub);
2281
2418
  isWarning = false;
2282
2419
  }
2283
2420
  function getComponentTrace() {
2284
- let currentVNode = stack$1[stack$1.length - 1];
2285
- if (!currentVNode) {
2421
+ let currentCtx = stack$1[stack$1.length - 1];
2422
+ if (!currentCtx) {
2286
2423
  return [];
2287
2424
  }
2288
2425
  const normalizedStack = [];
2289
- while (currentVNode) {
2426
+ while (currentCtx) {
2290
2427
  const last = normalizedStack[0];
2291
- if (last && last.vnode === currentVNode) {
2428
+ if (last && last.ctx === currentCtx) {
2292
2429
  last.recurseCount++;
2293
2430
  } else {
2294
2431
  normalizedStack.push({
2295
- vnode: currentVNode,
2432
+ ctx: currentCtx,
2296
2433
  recurseCount: 0
2297
2434
  });
2298
2435
  }
2299
- const parentInstance = currentVNode.component && currentVNode.component.parent;
2300
- currentVNode = parentInstance && parentInstance.vnode;
2436
+ if (isVNode(currentCtx)) {
2437
+ const parent = currentCtx.component && currentCtx.component.parent;
2438
+ currentCtx = parent && parent.vnode || parent;
2439
+ } else {
2440
+ currentCtx = currentCtx.parent;
2441
+ }
2301
2442
  }
2302
2443
  return normalizedStack;
2303
2444
  }
@@ -2309,16 +2450,13 @@ var Vue = (function (exports) {
2309
2450
  });
2310
2451
  return logs;
2311
2452
  }
2312
- function formatTraceEntry({ vnode, recurseCount }) {
2453
+ function formatTraceEntry({ ctx, recurseCount }) {
2313
2454
  const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
2314
- const isRoot = vnode.component ? vnode.component.parent == null : false;
2315
- const open = ` at <${formatComponentName(
2316
- vnode.component,
2317
- vnode.type,
2318
- isRoot
2319
- )}`;
2455
+ const instance = isVNode(ctx) ? ctx.component : ctx;
2456
+ const isRoot = instance ? instance.parent == null : false;
2457
+ const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
2320
2458
  const close = `>` + postfix;
2321
- return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
2459
+ return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
2322
2460
  }
2323
2461
  function formatProps(props) {
2324
2462
  const res = [];
@@ -2450,11 +2588,10 @@ var Vue = (function (exports) {
2450
2588
  }
2451
2589
  }
2452
2590
  function handleError(err, instance, type, throwInDev = true) {
2453
- const contextVNode = instance ? instance.vnode : null;
2454
2591
  const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
2455
2592
  if (instance) {
2456
2593
  let cur = instance.parent;
2457
- const exposedInstance = instance.proxy;
2594
+ const exposedInstance = instance.proxy || instance;
2458
2595
  const errorInfo = ErrorTypeStrings$1[type] ;
2459
2596
  while (cur) {
2460
2597
  const errorCapturedHooks = cur.ec;
@@ -2468,26 +2605,26 @@ var Vue = (function (exports) {
2468
2605
  cur = cur.parent;
2469
2606
  }
2470
2607
  if (errorHandler) {
2471
- pauseTracking();
2608
+ const prevSub = setActiveSub();
2472
2609
  callWithErrorHandling(errorHandler, null, 10, [
2473
2610
  err,
2474
2611
  exposedInstance,
2475
2612
  errorInfo
2476
2613
  ]);
2477
- resetTracking();
2614
+ setActiveSub(prevSub);
2478
2615
  return;
2479
2616
  }
2480
2617
  }
2481
- logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
2618
+ logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
2482
2619
  }
2483
- function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
2620
+ function logError(err, type, instance, throwInDev = true, throwInProd = false) {
2484
2621
  {
2485
2622
  const info = ErrorTypeStrings$1[type];
2486
- if (contextVNode) {
2487
- pushWarningContext(contextVNode);
2623
+ if (instance) {
2624
+ pushWarningContext(instance);
2488
2625
  }
2489
2626
  warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
2490
- if (contextVNode) {
2627
+ if (instance) {
2491
2628
  popWarningContext();
2492
2629
  }
2493
2630
  if (throwInDev) {
@@ -2498,26 +2635,23 @@ var Vue = (function (exports) {
2498
2635
  }
2499
2636
  }
2500
2637
 
2501
- const queue = [];
2502
- let flushIndex = -1;
2503
- const pendingPostFlushCbs = [];
2504
- let activePostFlushCbs = null;
2638
+ const jobs = [];
2639
+ let postJobs = [];
2640
+ let activePostJobs = null;
2641
+ let currentFlushPromise = null;
2642
+ let jobsLength = 0;
2643
+ let flushIndex = 0;
2505
2644
  let postFlushIndex = 0;
2506
2645
  const resolvedPromise = /* @__PURE__ */ Promise.resolve();
2507
- let currentFlushPromise = null;
2508
2646
  const RECURSION_LIMIT = 100;
2509
2647
  function nextTick(fn) {
2510
2648
  const p = currentFlushPromise || resolvedPromise;
2511
2649
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2512
2650
  }
2513
- function findInsertionIndex(id) {
2514
- let start = flushIndex + 1;
2515
- let end = queue.length;
2651
+ function findInsertionIndex(order, queue, start, end) {
2516
2652
  while (start < end) {
2517
2653
  const middle = start + end >>> 1;
2518
- const middleJob = queue[middle];
2519
- const middleJobId = getId(middleJob);
2520
- if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
2654
+ if (queue[middle].order <= order) {
2521
2655
  start = middle + 1;
2522
2656
  } else {
2523
2657
  end = middle;
@@ -2525,130 +2659,168 @@ var Vue = (function (exports) {
2525
2659
  }
2526
2660
  return start;
2527
2661
  }
2528
- function queueJob(job) {
2529
- if (!(job.flags & 1)) {
2530
- const jobId = getId(job);
2531
- const lastJob = queue[queue.length - 1];
2532
- if (!lastJob || // fast path when the job id is larger than the tail
2533
- !(job.flags & 2) && jobId >= getId(lastJob)) {
2534
- queue.push(job);
2662
+ function queueJob(job, id, isPre = false) {
2663
+ if (queueJobWorker(
2664
+ job,
2665
+ id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1,
2666
+ jobs,
2667
+ jobsLength,
2668
+ flushIndex
2669
+ )) {
2670
+ jobsLength++;
2671
+ queueFlush();
2672
+ }
2673
+ }
2674
+ function queueJobWorker(job, order, queue, length, flushIndex2) {
2675
+ const flags = job.flags;
2676
+ if (!(flags & 1)) {
2677
+ job.flags = flags | 1;
2678
+ job.order = order;
2679
+ if (flushIndex2 === length || // fast path when the job id is larger than the tail
2680
+ order >= queue[length - 1].order) {
2681
+ queue[length] = job;
2535
2682
  } else {
2536
- queue.splice(findInsertionIndex(jobId), 0, job);
2683
+ queue.splice(findInsertionIndex(order, queue, flushIndex2, length), 0, job);
2537
2684
  }
2538
- job.flags |= 1;
2539
- queueFlush();
2685
+ return true;
2540
2686
  }
2687
+ return false;
2541
2688
  }
2689
+ const doFlushJobs = () => {
2690
+ try {
2691
+ flushJobs();
2692
+ } catch (e) {
2693
+ currentFlushPromise = null;
2694
+ throw e;
2695
+ }
2696
+ };
2542
2697
  function queueFlush() {
2543
2698
  if (!currentFlushPromise) {
2544
- currentFlushPromise = resolvedPromise.then(flushJobs);
2699
+ currentFlushPromise = resolvedPromise.then(doFlushJobs);
2545
2700
  }
2546
2701
  }
2547
- function queuePostFlushCb(cb) {
2548
- if (!isArray(cb)) {
2549
- if (activePostFlushCbs && cb.id === -1) {
2550
- activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2551
- } else if (!(cb.flags & 1)) {
2552
- pendingPostFlushCbs.push(cb);
2553
- cb.flags |= 1;
2702
+ function queuePostFlushCb(jobs2, id = Infinity) {
2703
+ if (!isArray(jobs2)) {
2704
+ if (activePostJobs && id === -1) {
2705
+ activePostJobs.splice(postFlushIndex, 0, jobs2);
2706
+ } else {
2707
+ queueJobWorker(jobs2, id, postJobs, postJobs.length, 0);
2554
2708
  }
2555
2709
  } else {
2556
- pendingPostFlushCbs.push(...cb);
2710
+ for (const job of jobs2) {
2711
+ queueJobWorker(job, id, postJobs, postJobs.length, 0);
2712
+ }
2557
2713
  }
2558
2714
  queueFlush();
2559
2715
  }
2560
- function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2716
+ function flushPreFlushCbs(instance, seen) {
2561
2717
  {
2562
2718
  seen = seen || /* @__PURE__ */ new Map();
2563
2719
  }
2564
- for (; i < queue.length; i++) {
2565
- const cb = queue[i];
2566
- if (cb && cb.flags & 2) {
2567
- if (instance && cb.id !== instance.uid) {
2568
- continue;
2569
- }
2570
- if (checkRecursiveUpdates(seen, cb)) {
2571
- continue;
2572
- }
2573
- queue.splice(i, 1);
2574
- i--;
2575
- if (cb.flags & 4) {
2576
- cb.flags &= -2;
2577
- }
2578
- cb();
2579
- if (!(cb.flags & 4)) {
2580
- cb.flags &= -2;
2581
- }
2720
+ for (let i = flushIndex; i < jobsLength; i++) {
2721
+ const cb = jobs[i];
2722
+ if (cb.order & 1 || cb.order === Infinity) {
2723
+ continue;
2724
+ }
2725
+ if (instance && cb.order !== instance.uid * 2) {
2726
+ continue;
2727
+ }
2728
+ if (checkRecursiveUpdates(seen, cb)) {
2729
+ continue;
2730
+ }
2731
+ jobs.splice(i, 1);
2732
+ i--;
2733
+ jobsLength--;
2734
+ if (cb.flags & 2) {
2735
+ cb.flags &= -2;
2736
+ }
2737
+ cb();
2738
+ if (!(cb.flags & 2)) {
2739
+ cb.flags &= -2;
2582
2740
  }
2583
2741
  }
2584
2742
  }
2585
2743
  function flushPostFlushCbs(seen) {
2586
- if (pendingPostFlushCbs.length) {
2587
- const deduped = [...new Set(pendingPostFlushCbs)].sort(
2588
- (a, b) => getId(a) - getId(b)
2589
- );
2590
- pendingPostFlushCbs.length = 0;
2591
- if (activePostFlushCbs) {
2592
- activePostFlushCbs.push(...deduped);
2744
+ if (postJobs.length) {
2745
+ if (activePostJobs) {
2746
+ activePostJobs.push(...postJobs);
2747
+ postJobs.length = 0;
2593
2748
  return;
2594
2749
  }
2595
- activePostFlushCbs = deduped;
2750
+ activePostJobs = postJobs;
2751
+ postJobs = [];
2596
2752
  {
2597
2753
  seen = seen || /* @__PURE__ */ new Map();
2598
2754
  }
2599
- for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
2600
- const cb = activePostFlushCbs[postFlushIndex];
2755
+ while (postFlushIndex < activePostJobs.length) {
2756
+ const cb = activePostJobs[postFlushIndex++];
2601
2757
  if (checkRecursiveUpdates(seen, cb)) {
2602
2758
  continue;
2603
2759
  }
2604
- if (cb.flags & 4) {
2760
+ if (cb.flags & 2) {
2605
2761
  cb.flags &= -2;
2606
2762
  }
2607
- if (!(cb.flags & 8)) cb();
2608
- cb.flags &= -2;
2763
+ if (!(cb.flags & 4)) {
2764
+ try {
2765
+ cb();
2766
+ } finally {
2767
+ cb.flags &= -2;
2768
+ }
2769
+ }
2609
2770
  }
2610
- activePostFlushCbs = null;
2771
+ activePostJobs = null;
2611
2772
  postFlushIndex = 0;
2612
2773
  }
2613
2774
  }
2614
- const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2775
+ let isFlushing = false;
2776
+ function flushOnAppMount() {
2777
+ if (!isFlushing) {
2778
+ isFlushing = true;
2779
+ flushPreFlushCbs();
2780
+ flushPostFlushCbs();
2781
+ isFlushing = false;
2782
+ }
2783
+ }
2615
2784
  function flushJobs(seen) {
2616
2785
  {
2617
- seen = seen || /* @__PURE__ */ new Map();
2786
+ seen || (seen = /* @__PURE__ */ new Map());
2618
2787
  }
2619
- const check = (job) => checkRecursiveUpdates(seen, job) ;
2620
2788
  try {
2621
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
2622
- const job = queue[flushIndex];
2623
- if (job && !(job.flags & 8)) {
2624
- if (check(job)) {
2789
+ while (flushIndex < jobsLength) {
2790
+ const job = jobs[flushIndex];
2791
+ jobs[flushIndex++] = void 0;
2792
+ if (!(job.flags & 4)) {
2793
+ if (checkRecursiveUpdates(seen, job)) {
2625
2794
  continue;
2626
2795
  }
2627
- if (job.flags & 4) {
2796
+ if (job.flags & 2) {
2628
2797
  job.flags &= ~1;
2629
2798
  }
2630
- callWithErrorHandling(
2631
- job,
2632
- job.i,
2633
- job.i ? 15 : 14
2634
- );
2635
- if (!(job.flags & 4)) {
2636
- job.flags &= ~1;
2799
+ try {
2800
+ job();
2801
+ } catch (err) {
2802
+ handleError(
2803
+ err,
2804
+ job.i,
2805
+ job.i ? 15 : 14
2806
+ );
2807
+ } finally {
2808
+ if (!(job.flags & 2)) {
2809
+ job.flags &= ~1;
2810
+ }
2637
2811
  }
2638
2812
  }
2639
2813
  }
2640
2814
  } finally {
2641
- for (; flushIndex < queue.length; flushIndex++) {
2642
- const job = queue[flushIndex];
2643
- if (job) {
2644
- job.flags &= -2;
2645
- }
2815
+ while (flushIndex < jobsLength) {
2816
+ jobs[flushIndex].flags &= -2;
2817
+ jobs[flushIndex++] = void 0;
2646
2818
  }
2647
- flushIndex = -1;
2648
- queue.length = 0;
2819
+ flushIndex = 0;
2820
+ jobsLength = 0;
2649
2821
  flushPostFlushCbs(seen);
2650
2822
  currentFlushPromise = null;
2651
- if (queue.length || pendingPostFlushCbs.length) {
2823
+ if (jobsLength || postJobs.length) {
2652
2824
  flushJobs(seen);
2653
2825
  }
2654
2826
  }
@@ -2715,10 +2887,17 @@ var Vue = (function (exports) {
2715
2887
  instance.render = newRender;
2716
2888
  normalizeClassComponent(instance.type).render = newRender;
2717
2889
  }
2718
- instance.renderCache = [];
2719
2890
  isHmrUpdating = true;
2720
- instance.update();
2721
- isHmrUpdating = false;
2891
+ if (instance.vapor) {
2892
+ instance.hmrRerender();
2893
+ } else {
2894
+ const i = instance;
2895
+ i.renderCache = [];
2896
+ i.effect.run();
2897
+ }
2898
+ nextTick(() => {
2899
+ isHmrUpdating = false;
2900
+ });
2722
2901
  });
2723
2902
  }
2724
2903
  function reload(id, newComp) {
@@ -2727,42 +2906,54 @@ var Vue = (function (exports) {
2727
2906
  newComp = normalizeClassComponent(newComp);
2728
2907
  updateComponentDef(record.initialDef, newComp);
2729
2908
  const instances = [...record.instances];
2730
- for (let i = 0; i < instances.length; i++) {
2731
- const instance = instances[i];
2732
- const oldComp = normalizeClassComponent(instance.type);
2733
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2734
- if (!dirtyInstances) {
2735
- if (oldComp !== record.initialDef) {
2736
- updateComponentDef(oldComp, newComp);
2737
- }
2738
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2739
- }
2740
- dirtyInstances.add(instance);
2741
- instance.appContext.propsCache.delete(instance.type);
2742
- instance.appContext.emitsCache.delete(instance.type);
2743
- instance.appContext.optionsCache.delete(instance.type);
2744
- if (instance.ceReload) {
2909
+ if (newComp.__vapor) {
2910
+ for (const instance of instances) {
2911
+ instance.hmrReload(newComp);
2912
+ }
2913
+ } else {
2914
+ for (const instance of instances) {
2915
+ const oldComp = normalizeClassComponent(instance.type);
2916
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2917
+ if (!dirtyInstances) {
2918
+ if (oldComp !== record.initialDef) {
2919
+ updateComponentDef(oldComp, newComp);
2920
+ }
2921
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2922
+ }
2745
2923
  dirtyInstances.add(instance);
2746
- instance.ceReload(newComp.styles);
2747
- dirtyInstances.delete(instance);
2748
- } else if (instance.parent) {
2749
- queueJob(() => {
2750
- isHmrUpdating = true;
2751
- instance.parent.update();
2752
- isHmrUpdating = false;
2924
+ instance.appContext.propsCache.delete(instance.type);
2925
+ instance.appContext.emitsCache.delete(instance.type);
2926
+ instance.appContext.optionsCache.delete(instance.type);
2927
+ if (instance.ceReload) {
2928
+ dirtyInstances.add(instance);
2929
+ instance.ceReload(newComp.styles);
2753
2930
  dirtyInstances.delete(instance);
2754
- });
2755
- } else if (instance.appContext.reload) {
2756
- instance.appContext.reload();
2757
- } else if (typeof window !== "undefined") {
2758
- window.location.reload();
2759
- } else {
2760
- console.warn(
2761
- "[HMR] Root or manually mounted instance modified. Full reload required."
2762
- );
2763
- }
2764
- if (instance.root.ce && instance !== instance.root) {
2765
- instance.root.ce._removeChildStyle(oldComp);
2931
+ } else if (instance.parent) {
2932
+ queueJob(() => {
2933
+ isHmrUpdating = true;
2934
+ const parent = instance.parent;
2935
+ if (parent.vapor) {
2936
+ parent.hmrRerender();
2937
+ } else {
2938
+ parent.effect.run();
2939
+ }
2940
+ nextTick(() => {
2941
+ isHmrUpdating = false;
2942
+ });
2943
+ dirtyInstances.delete(instance);
2944
+ });
2945
+ } else if (instance.appContext.reload) {
2946
+ instance.appContext.reload();
2947
+ } else if (typeof window !== "undefined") {
2948
+ window.location.reload();
2949
+ } else {
2950
+ console.warn(
2951
+ "[HMR] Root or manually mounted instance modified. Full reload required."
2952
+ );
2953
+ }
2954
+ if (instance.root.ce && instance !== instance.root) {
2955
+ instance.root.ce._removeChildStyle(oldComp);
2956
+ }
2766
2957
  }
2767
2958
  }
2768
2959
  queuePostFlushCb(() => {
@@ -2975,14 +3166,14 @@ var Vue = (function (exports) {
2975
3166
  }
2976
3167
  let hook = binding.dir[name];
2977
3168
  if (hook) {
2978
- pauseTracking();
3169
+ const prevSub = setActiveSub();
2979
3170
  callWithAsyncErrorHandling(hook, instance, 8, [
2980
3171
  vnode.el,
2981
3172
  binding,
2982
3173
  vnode,
2983
3174
  prevVNode
2984
3175
  ]);
2985
- resetTracking();
3176
+ setActiveSub(prevSub);
2986
3177
  }
2987
3178
  }
2988
3179
  }
@@ -3082,29 +3273,37 @@ var Vue = (function (exports) {
3082
3273
  }
3083
3274
  if (isTeleportDeferred(n2.props)) {
3084
3275
  n2.el.__isMounted = false;
3085
- queuePostRenderEffect(() => {
3086
- mountToTarget();
3087
- delete n2.el.__isMounted;
3088
- }, parentSuspense);
3276
+ queuePostRenderEffect(
3277
+ () => {
3278
+ mountToTarget();
3279
+ delete n2.el.__isMounted;
3280
+ },
3281
+ void 0,
3282
+ parentSuspense
3283
+ );
3089
3284
  } else {
3090
3285
  mountToTarget();
3091
3286
  }
3092
3287
  } else {
3093
3288
  if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
3094
- queuePostRenderEffect(() => {
3095
- TeleportImpl.process(
3096
- n1,
3097
- n2,
3098
- container,
3099
- anchor,
3100
- parentComponent,
3101
- parentSuspense,
3102
- namespace,
3103
- slotScopeIds,
3104
- optimized,
3105
- internals
3106
- );
3107
- }, parentSuspense);
3289
+ queuePostRenderEffect(
3290
+ () => {
3291
+ TeleportImpl.process(
3292
+ n1,
3293
+ n2,
3294
+ container,
3295
+ anchor,
3296
+ parentComponent,
3297
+ parentSuspense,
3298
+ namespace,
3299
+ slotScopeIds,
3300
+ optimized,
3301
+ internals
3302
+ );
3303
+ },
3304
+ void 0,
3305
+ parentSuspense
3306
+ );
3108
3307
  return;
3109
3308
  }
3110
3309
  n2.el = n1.el;
@@ -3151,6 +3350,7 @@ var Vue = (function (exports) {
3151
3350
  container,
3152
3351
  mainAnchor,
3153
3352
  internals,
3353
+ parentComponent,
3154
3354
  1
3155
3355
  );
3156
3356
  } else {
@@ -3170,6 +3370,7 @@ var Vue = (function (exports) {
3170
3370
  nextTarget,
3171
3371
  null,
3172
3372
  internals,
3373
+ parentComponent,
3173
3374
  0
3174
3375
  );
3175
3376
  } else {
@@ -3185,6 +3386,7 @@ var Vue = (function (exports) {
3185
3386
  target,
3186
3387
  targetAnchor,
3187
3388
  internals,
3389
+ parentComponent,
3188
3390
  1
3189
3391
  );
3190
3392
  }
@@ -3224,7 +3426,7 @@ var Vue = (function (exports) {
3224
3426
  move: moveTeleport,
3225
3427
  hydrate: hydrateTeleport
3226
3428
  };
3227
- function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
3429
+ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, parentComponent, moveType = 2) {
3228
3430
  if (moveType === 0) {
3229
3431
  insert(vnode.targetAnchor, container, parentAnchor);
3230
3432
  }
@@ -3240,7 +3442,8 @@ var Vue = (function (exports) {
3240
3442
  children[i],
3241
3443
  container,
3242
3444
  parentAnchor,
3243
- 2
3445
+ 2,
3446
+ parentComponent
3244
3447
  );
3245
3448
  }
3246
3449
  }
@@ -3425,7 +3628,7 @@ var Vue = (function (exports) {
3425
3628
  state.isLeaving = true;
3426
3629
  leavingHooks.afterLeave = () => {
3427
3630
  state.isLeaving = false;
3428
- if (!(instance.job.flags & 8)) {
3631
+ if (!(instance.job.flags & 4)) {
3429
3632
  instance.update();
3430
3633
  }
3431
3634
  delete leavingHooks.afterLeave;
@@ -3704,7 +3907,7 @@ var Vue = (function (exports) {
3704
3907
  }
3705
3908
 
3706
3909
  function useId() {
3707
- const i = getCurrentInstance();
3910
+ const i = getCurrentGenericInstance();
3708
3911
  if (i) {
3709
3912
  return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
3710
3913
  } else {
@@ -3720,7 +3923,7 @@ var Vue = (function (exports) {
3720
3923
 
3721
3924
  const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
3722
3925
  function useTemplateRef(key) {
3723
- const i = getCurrentInstance();
3926
+ const i = getCurrentGenericInstance();
3724
3927
  const r = shallowRef(null);
3725
3928
  if (i) {
3726
3929
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
@@ -3840,8 +4043,7 @@ var Vue = (function (exports) {
3840
4043
  }
3841
4044
  };
3842
4045
  if (value) {
3843
- doSet.id = -1;
3844
- queuePostRenderEffect(doSet, parentSuspense);
4046
+ queuePostRenderEffect(doSet, -1, parentSuspense);
3845
4047
  } else {
3846
4048
  doSet();
3847
4049
  }
@@ -4009,6 +4211,9 @@ var Vue = (function (exports) {
4009
4211
  );
4010
4212
  }
4011
4213
  } else if (shapeFlag & 6) {
4214
+ if (vnode.type.__vapor) {
4215
+ throw new Error("Vapor component hydration is not supported yet.");
4216
+ }
4012
4217
  vnode.slotScopeIds = slotScopeIds;
4013
4218
  const container = parentNode(node);
4014
4219
  if (isFragmentStart) {
@@ -4170,11 +4375,15 @@ Server rendered element contains more child nodes than client vdom.`
4170
4375
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4171
4376
  }
4172
4377
  if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
4173
- queueEffectWithSuspense(() => {
4174
- vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4175
- needCallTransitionHooks && transition.enter(el);
4176
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4177
- }, parentSuspense);
4378
+ queueEffectWithSuspense(
4379
+ () => {
4380
+ vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4381
+ needCallTransitionHooks && transition.enter(el);
4382
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4383
+ },
4384
+ void 0,
4385
+ parentSuspense
4386
+ );
4178
4387
  }
4179
4388
  }
4180
4389
  return el.nextSibling;
@@ -4454,14 +4663,16 @@ Server rendered element contains fewer child nodes than client vdom.`
4454
4663
  if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4455
4664
  const cssVars = instance.getCssVars();
4456
4665
  for (const key in cssVars) {
4457
- expectedMap.set(
4458
- `--${getEscapedCssVarName(key)}`,
4459
- String(cssVars[key])
4460
- );
4666
+ const value = normalizeCssVarValue(cssVars[key]);
4667
+ expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
4461
4668
  }
4462
4669
  }
4463
4670
  if (vnode === root && instance.parent) {
4464
- resolveCssVars(instance.parent, instance.vnode, expectedMap);
4671
+ resolveCssVars(
4672
+ instance.parent,
4673
+ instance.vnode,
4674
+ expectedMap
4675
+ );
4465
4676
  }
4466
4677
  }
4467
4678
  const allowMismatchAttr = "data-allow-mismatch";
@@ -4720,7 +4931,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4720
4931
  }
4721
4932
  load().then(() => {
4722
4933
  loaded.value = true;
4723
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4934
+ if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
4724
4935
  instance.parent.update();
4725
4936
  }
4726
4937
  }).catch((err) => {
@@ -4763,15 +4974,15 @@ Server rendered element contains fewer child nodes than client vdom.`
4763
4974
  max: [String, Number]
4764
4975
  },
4765
4976
  setup(props, { slots }) {
4766
- const instance = getCurrentInstance();
4767
- const sharedContext = instance.ctx;
4977
+ const keepAliveInstance = getCurrentInstance();
4978
+ const sharedContext = keepAliveInstance.ctx;
4768
4979
  const cache = /* @__PURE__ */ new Map();
4769
4980
  const keys = /* @__PURE__ */ new Set();
4770
4981
  let current = null;
4771
4982
  {
4772
- instance.__v_cache = cache;
4983
+ keepAliveInstance.__v_cache = cache;
4773
4984
  }
4774
- const parentSuspense = instance.suspense;
4985
+ const parentSuspense = keepAliveInstance.suspense;
4775
4986
  const {
4776
4987
  renderer: {
4777
4988
  p: patch,
@@ -4782,58 +4993,80 @@ Server rendered element contains fewer child nodes than client vdom.`
4782
4993
  } = sharedContext;
4783
4994
  const storageContainer = createElement("div");
4784
4995
  sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
4785
- const instance2 = vnode.component;
4786
- move(vnode, container, anchor, 0, parentSuspense);
4996
+ const instance = vnode.component;
4997
+ move(
4998
+ vnode,
4999
+ container,
5000
+ anchor,
5001
+ 0,
5002
+ keepAliveInstance,
5003
+ parentSuspense
5004
+ );
4787
5005
  patch(
4788
- instance2.vnode,
5006
+ instance.vnode,
4789
5007
  vnode,
4790
5008
  container,
4791
5009
  anchor,
4792
- instance2,
5010
+ instance,
4793
5011
  parentSuspense,
4794
5012
  namespace,
4795
5013
  vnode.slotScopeIds,
4796
5014
  optimized
4797
5015
  );
4798
- queuePostRenderEffect(() => {
4799
- instance2.isDeactivated = false;
4800
- if (instance2.a) {
4801
- invokeArrayFns(instance2.a);
4802
- }
4803
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4804
- if (vnodeHook) {
4805
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4806
- }
4807
- }, parentSuspense);
5016
+ queuePostRenderEffect(
5017
+ () => {
5018
+ instance.isDeactivated = false;
5019
+ if (instance.a) {
5020
+ invokeArrayFns(instance.a);
5021
+ }
5022
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
5023
+ if (vnodeHook) {
5024
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
5025
+ }
5026
+ },
5027
+ void 0,
5028
+ parentSuspense
5029
+ );
4808
5030
  {
4809
- devtoolsComponentAdded(instance2);
5031
+ devtoolsComponentAdded(instance);
4810
5032
  }
4811
5033
  };
4812
5034
  sharedContext.deactivate = (vnode) => {
4813
- const instance2 = vnode.component;
4814
- invalidateMount(instance2.m);
4815
- invalidateMount(instance2.a);
4816
- move(vnode, storageContainer, null, 1, parentSuspense);
4817
- queuePostRenderEffect(() => {
4818
- if (instance2.da) {
4819
- invokeArrayFns(instance2.da);
4820
- }
4821
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4822
- if (vnodeHook) {
4823
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4824
- }
4825
- instance2.isDeactivated = true;
4826
- }, parentSuspense);
5035
+ const instance = vnode.component;
5036
+ invalidateMount(instance.m);
5037
+ invalidateMount(instance.a);
5038
+ move(
5039
+ vnode,
5040
+ storageContainer,
5041
+ null,
5042
+ 1,
5043
+ keepAliveInstance,
5044
+ parentSuspense
5045
+ );
5046
+ queuePostRenderEffect(
5047
+ () => {
5048
+ if (instance.da) {
5049
+ invokeArrayFns(instance.da);
5050
+ }
5051
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
5052
+ if (vnodeHook) {
5053
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
5054
+ }
5055
+ instance.isDeactivated = true;
5056
+ },
5057
+ void 0,
5058
+ parentSuspense
5059
+ );
4827
5060
  {
4828
- devtoolsComponentAdded(instance2);
5061
+ devtoolsComponentAdded(instance);
4829
5062
  }
4830
5063
  {
4831
- instance2.__keepAliveStorageContainer = storageContainer;
5064
+ instance.__keepAliveStorageContainer = storageContainer;
4832
5065
  }
4833
5066
  };
4834
5067
  function unmount(vnode) {
4835
5068
  resetShapeFlag(vnode);
4836
- _unmount(vnode, instance, parentSuspense, true);
5069
+ _unmount(vnode, keepAliveInstance, parentSuspense, true);
4837
5070
  }
4838
5071
  function pruneCache(filter) {
4839
5072
  cache.forEach((vnode, key) => {
@@ -4865,12 +5098,19 @@ Server rendered element contains fewer child nodes than client vdom.`
4865
5098
  let pendingCacheKey = null;
4866
5099
  const cacheSubtree = () => {
4867
5100
  if (pendingCacheKey != null) {
4868
- if (isSuspense(instance.subTree.type)) {
4869
- queuePostRenderEffect(() => {
4870
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4871
- }, instance.subTree.suspense);
5101
+ if (isSuspense(keepAliveInstance.subTree.type)) {
5102
+ queuePostRenderEffect(
5103
+ () => {
5104
+ cache.set(
5105
+ pendingCacheKey,
5106
+ getInnerChild(keepAliveInstance.subTree)
5107
+ );
5108
+ },
5109
+ void 0,
5110
+ keepAliveInstance.subTree.suspense
5111
+ );
4872
5112
  } else {
4873
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5113
+ cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
4874
5114
  }
4875
5115
  }
4876
5116
  };
@@ -4878,12 +5118,12 @@ Server rendered element contains fewer child nodes than client vdom.`
4878
5118
  onUpdated(cacheSubtree);
4879
5119
  onBeforeUnmount(() => {
4880
5120
  cache.forEach((cached) => {
4881
- const { subTree, suspense } = instance;
5121
+ const { subTree, suspense } = keepAliveInstance;
4882
5122
  const vnode = getInnerChild(subTree);
4883
5123
  if (cached.type === vnode.type && cached.key === vnode.key) {
4884
5124
  resetShapeFlag(vnode);
4885
5125
  const da = vnode.component.da;
4886
- da && queuePostRenderEffect(da, suspense);
5126
+ da && queuePostRenderEffect(da, void 0, suspense);
4887
5127
  return;
4888
5128
  }
4889
5129
  unmount(cached);
@@ -4969,7 +5209,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4969
5209
  function onDeactivated(hook, target) {
4970
5210
  registerKeepAliveHook(hook, "da", target);
4971
5211
  }
4972
- function registerKeepAliveHook(hook, type, target = currentInstance) {
5212
+ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
4973
5213
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
4974
5214
  let current = target;
4975
5215
  while (current) {
@@ -4983,7 +5223,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4983
5223
  injectHook(type, wrappedHook, target);
4984
5224
  if (target) {
4985
5225
  let current = target.parent;
4986
- while (current && current.parent) {
5226
+ while (current && current.parent && current.parent.vnode) {
4987
5227
  if (isKeepAlive(current.parent.vnode)) {
4988
5228
  injectToKeepAliveRoot(wrappedHook, type, target, current);
4989
5229
  }
@@ -5015,12 +5255,14 @@ Server rendered element contains fewer child nodes than client vdom.`
5015
5255
  if (target) {
5016
5256
  const hooks = target[type] || (target[type] = []);
5017
5257
  const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
5018
- pauseTracking();
5019
- const reset = setCurrentInstance(target);
5020
- const res = callWithAsyncErrorHandling(hook, target, type, args);
5021
- reset();
5022
- resetTracking();
5023
- return res;
5258
+ const prevSub = setActiveSub();
5259
+ const prev = setCurrentInstance(target);
5260
+ try {
5261
+ return callWithAsyncErrorHandling(hook, target, type, args);
5262
+ } finally {
5263
+ setCurrentInstance(...prev);
5264
+ setActiveSub(prevSub);
5265
+ }
5024
5266
  });
5025
5267
  if (prepend) {
5026
5268
  hooks.unshift(wrappedHook);
@@ -5091,7 +5333,11 @@ Server rendered element contains fewer child nodes than client vdom.`
5091
5333
  const res = (
5092
5334
  // local registration
5093
5335
  // check instance[type] first which is resolved for options API
5094
- resolve(instance[type] || Component[type], name) || // global registration
5336
+ resolve(
5337
+ instance[type] || Component[type],
5338
+ name
5339
+ ) || // global registration
5340
+ // @ts-expect-error filters only exist in compat mode
5095
5341
  resolve(instance.appContext[type], name)
5096
5342
  );
5097
5343
  if (!res && maybeSelfReference) {
@@ -5185,7 +5431,13 @@ If this is a native custom element, make sure to exclude it from component resol
5185
5431
  }
5186
5432
 
5187
5433
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5188
- if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5434
+ let slot = slots[name];
5435
+ if (slot && slot.__vapor) {
5436
+ const ret = (openBlock(), createBlock(VaporSlot, props));
5437
+ ret.vs = { slot, fallback };
5438
+ return ret;
5439
+ }
5440
+ if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
5189
5441
  if (name !== "default") props.name = name;
5190
5442
  return openBlock(), createBlock(
5191
5443
  Fragment,
@@ -5194,7 +5446,6 @@ If this is a native custom element, make sure to exclude it from component resol
5194
5446
  64
5195
5447
  );
5196
5448
  }
5197
- let slot = slots[name];
5198
5449
  if (slot && slot.length > 1) {
5199
5450
  warn$1(
5200
5451
  `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`
@@ -5249,8 +5500,9 @@ If this is a native custom element, make sure to exclude it from component resol
5249
5500
  }
5250
5501
 
5251
5502
  const getPublicInstance = (i) => {
5252
- if (!i) return null;
5253
- if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5503
+ if (!i || i.vapor) return null;
5504
+ if (isStatefulComponent(i))
5505
+ return getComponentPublicInstance(i);
5254
5506
  return getPublicInstance(i.parent);
5255
5507
  };
5256
5508
  const publicPropertiesMap = (
@@ -5543,11 +5795,16 @@ If this is a native custom element, make sure to exclude it from component resol
5543
5795
  return getContext().attrs;
5544
5796
  }
5545
5797
  function getContext() {
5546
- const i = getCurrentInstance();
5798
+ const i = getCurrentGenericInstance();
5547
5799
  if (!i) {
5548
5800
  warn$1(`useContext() called without active instance.`);
5549
5801
  }
5550
- return i.setupContext || (i.setupContext = createSetupContext(i));
5802
+ if (i.vapor) {
5803
+ return i;
5804
+ } else {
5805
+ const ii = i;
5806
+ return ii.setupContext || (ii.setupContext = createSetupContext(ii));
5807
+ }
5551
5808
  }
5552
5809
  function normalizePropsOrEmits(props) {
5553
5810
  return isArray(props) ? props.reduce(
@@ -5595,14 +5852,14 @@ If this is a native custom element, make sure to exclude it from component resol
5595
5852
  return ret;
5596
5853
  }
5597
5854
  function withAsyncContext(getAwaitable) {
5598
- const ctx = getCurrentInstance();
5855
+ const ctx = getCurrentGenericInstance();
5599
5856
  if (!ctx) {
5600
5857
  warn$1(
5601
5858
  `withAsyncContext called without active current instance. This is likely a bug.`
5602
5859
  );
5603
5860
  }
5604
5861
  let awaitable = getAwaitable();
5605
- unsetCurrentInstance();
5862
+ setCurrentInstance(null, void 0);
5606
5863
  if (isPromise(awaitable)) {
5607
5864
  awaitable = awaitable.catch((e) => {
5608
5865
  setCurrentInstance(ctx);
@@ -6046,7 +6303,7 @@ If this is a native custom element, make sure to exclude it from component resol
6046
6303
  };
6047
6304
  }
6048
6305
  let uid$1 = 0;
6049
- function createAppAPI(render, hydrate) {
6306
+ function createAppAPI(mount, unmount, getPublicInstance, render) {
6050
6307
  return function createApp(rootComponent, rootProps = null) {
6051
6308
  if (!isFunction(rootComponent)) {
6052
6309
  rootComponent = extend({}, rootComponent);
@@ -6139,33 +6396,15 @@ If this is a native custom element, make sure to exclude it from component resol
6139
6396
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6140
6397
  );
6141
6398
  }
6142
- const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
6143
- vnode.appContext = context;
6144
- if (namespace === true) {
6145
- namespace = "svg";
6146
- } else if (namespace === false) {
6147
- namespace = void 0;
6148
- }
6399
+ const instance = mount(app, rootContainer, isHydrate, namespace);
6149
6400
  {
6150
- context.reload = () => {
6151
- const cloned = cloneVNode(vnode);
6152
- cloned.el = null;
6153
- render(cloned, rootContainer, namespace);
6154
- };
6155
- }
6156
- if (isHydrate && hydrate) {
6157
- hydrate(vnode, rootContainer);
6158
- } else {
6159
- render(vnode, rootContainer, namespace);
6401
+ app._instance = instance;
6402
+ devtoolsInitApp(app, version);
6160
6403
  }
6161
6404
  isMounted = true;
6162
6405
  app._container = rootContainer;
6163
6406
  rootContainer.__vue_app__ = app;
6164
- {
6165
- app._instance = vnode.component;
6166
- devtoolsInitApp(app, version);
6167
- }
6168
- return getComponentPublicInstance(vnode.component);
6407
+ return getPublicInstance(instance);
6169
6408
  } else {
6170
6409
  warn$1(
6171
6410
  `App has already been mounted.
@@ -6188,7 +6427,7 @@ If you want to remount the same app, move your app creation logic into a factory
6188
6427
  app._instance,
6189
6428
  16
6190
6429
  );
6191
- render(null, app._container);
6430
+ unmount(app);
6192
6431
  {
6193
6432
  app._instance = null;
6194
6433
  devtoolsUnmountApp(app);
@@ -6229,6 +6468,7 @@ If you want to remount the same app, move your app creation logic into a factory
6229
6468
  let currentApp = null;
6230
6469
 
6231
6470
  function provide(key, value) {
6471
+ const currentInstance = getCurrentGenericInstance();
6232
6472
  if (!currentInstance) {
6233
6473
  {
6234
6474
  warn$1(`provide() can only be used inside setup().`);
@@ -6243,9 +6483,9 @@ If you want to remount the same app, move your app creation logic into a factory
6243
6483
  }
6244
6484
  }
6245
6485
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
6246
- const instance = currentInstance || currentRenderingInstance;
6486
+ const instance = getCurrentGenericInstance();
6247
6487
  if (instance || currentApp) {
6248
- let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
6488
+ let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.appContext && instance.appContext.provides : instance.parent.provides : void 0;
6249
6489
  if (provides && key in provides) {
6250
6490
  return provides[key];
6251
6491
  } else if (arguments.length > 1) {
@@ -6258,7 +6498,7 @@ If you want to remount the same app, move your app creation logic into a factory
6258
6498
  }
6259
6499
  }
6260
6500
  function hasInjectionContext() {
6261
- return !!(currentInstance || currentRenderingInstance || currentApp);
6501
+ return !!(getCurrentGenericInstance() || currentApp);
6262
6502
  }
6263
6503
 
6264
6504
  const internalObjectProto = {};
@@ -6266,7 +6506,7 @@ If you want to remount the same app, move your app creation logic into a factory
6266
6506
  const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
6267
6507
 
6268
6508
  function initProps(instance, rawProps, isStateful, isSSR = false) {
6269
- const props = {};
6509
+ const props = instance.props = {};
6270
6510
  const attrs = createInternalObject();
6271
6511
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6272
6512
  setFullProps(instance, rawProps, props, attrs);
@@ -6276,7 +6516,7 @@ If you want to remount the same app, move your app creation logic into a factory
6276
6516
  }
6277
6517
  }
6278
6518
  {
6279
- validateProps(rawProps || {}, props, instance);
6519
+ validateProps(rawProps || {}, props, instance.propsOptions[0]);
6280
6520
  }
6281
6521
  if (isStateful) {
6282
6522
  instance.props = isSSR ? props : shallowReactive(props);
@@ -6328,11 +6568,10 @@ If you want to remount the same app, move your app creation logic into a factory
6328
6568
  const camelizedKey = camelize(key);
6329
6569
  props[camelizedKey] = resolvePropValue(
6330
6570
  options,
6331
- rawCurrentProps,
6332
6571
  camelizedKey,
6333
6572
  value,
6334
6573
  instance,
6335
- false
6574
+ baseResolveDefault
6336
6575
  );
6337
6576
  }
6338
6577
  } else {
@@ -6359,10 +6598,10 @@ If you want to remount the same app, move your app creation logic into a factory
6359
6598
  rawPrevProps[kebabKey] !== void 0)) {
6360
6599
  props[key] = resolvePropValue(
6361
6600
  options,
6362
- rawCurrentProps,
6363
6601
  key,
6364
6602
  void 0,
6365
6603
  instance,
6604
+ baseResolveDefault,
6366
6605
  true
6367
6606
  );
6368
6607
  }
@@ -6384,7 +6623,7 @@ If you want to remount the same app, move your app creation logic into a factory
6384
6623
  trigger(instance.attrs, "set", "");
6385
6624
  }
6386
6625
  {
6387
- validateProps(rawProps || {}, props, instance);
6626
+ validateProps(rawProps || {}, props, instance.propsOptions[0]);
6388
6627
  }
6389
6628
  }
6390
6629
  function setFullProps(instance, rawProps, props, attrs) {
@@ -6413,39 +6652,37 @@ If you want to remount the same app, move your app creation logic into a factory
6413
6652
  }
6414
6653
  }
6415
6654
  if (needCastKeys) {
6416
- const rawCurrentProps = toRaw(props);
6417
6655
  const castValues = rawCastValues || EMPTY_OBJ;
6418
6656
  for (let i = 0; i < needCastKeys.length; i++) {
6419
6657
  const key = needCastKeys[i];
6420
6658
  props[key] = resolvePropValue(
6421
6659
  options,
6422
- rawCurrentProps,
6423
6660
  key,
6424
6661
  castValues[key],
6425
6662
  instance,
6663
+ baseResolveDefault,
6426
6664
  !hasOwn(castValues, key)
6427
6665
  );
6428
6666
  }
6429
6667
  }
6430
6668
  return hasAttrsChanged;
6431
6669
  }
6432
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6670
+ function resolvePropValue(options, key, value, instance, resolveDefault, isAbsent = false) {
6433
6671
  const opt = options[key];
6434
6672
  if (opt != null) {
6435
6673
  const hasDefault = hasOwn(opt, "default");
6436
6674
  if (hasDefault && value === void 0) {
6437
6675
  const defaultValue = opt.default;
6438
6676
  if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6439
- const { propsDefaults } = instance;
6440
- if (key in propsDefaults) {
6441
- value = propsDefaults[key];
6677
+ const cachedDefaults = instance.propsDefaults || (instance.propsDefaults = {});
6678
+ if (hasOwn(cachedDefaults, key)) {
6679
+ value = cachedDefaults[key];
6442
6680
  } else {
6443
- const reset = setCurrentInstance(instance);
6444
- value = propsDefaults[key] = defaultValue.call(
6445
- null,
6446
- props
6681
+ value = cachedDefaults[key] = resolveDefault(
6682
+ defaultValue,
6683
+ instance,
6684
+ key
6447
6685
  );
6448
- reset();
6449
6686
  }
6450
6687
  } else {
6451
6688
  value = defaultValue;
@@ -6464,6 +6701,17 @@ If you want to remount the same app, move your app creation logic into a factory
6464
6701
  }
6465
6702
  return value;
6466
6703
  }
6704
+ function baseResolveDefault(factory, instance, key) {
6705
+ let value;
6706
+ const prev = setCurrentInstance(instance);
6707
+ const props = toRaw(instance.props);
6708
+ value = factory.call(
6709
+ null,
6710
+ props
6711
+ );
6712
+ setCurrentInstance(...prev);
6713
+ return value;
6714
+ }
6467
6715
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
6468
6716
  function normalizePropsOptions(comp, appContext, asMixin = false) {
6469
6717
  const cache = asMixin ? mixinPropsCache : appContext.propsCache;
@@ -6498,6 +6746,14 @@ If you want to remount the same app, move your app creation logic into a factory
6498
6746
  }
6499
6747
  return EMPTY_ARR;
6500
6748
  }
6749
+ baseNormalizePropsOptions(raw, normalized, needCastKeys);
6750
+ const res = [normalized, needCastKeys];
6751
+ if (isObject(comp)) {
6752
+ cache.set(comp, res);
6753
+ }
6754
+ return res;
6755
+ }
6756
+ function baseNormalizePropsOptions(raw, normalized, needCastKeys) {
6501
6757
  if (isArray(raw)) {
6502
6758
  for (let i = 0; i < raw.length; i++) {
6503
6759
  if (!isString(raw[i])) {
@@ -6542,11 +6798,6 @@ If you want to remount the same app, move your app creation logic into a factory
6542
6798
  }
6543
6799
  }
6544
6800
  }
6545
- const res = [normalized, needCastKeys];
6546
- if (isObject(comp)) {
6547
- cache.set(comp, res);
6548
- }
6549
- return res;
6550
6801
  }
6551
6802
  function validatePropName(key) {
6552
6803
  if (key[0] !== "$" && !isReservedProp(key)) {
@@ -6568,26 +6819,26 @@ If you want to remount the same app, move your app creation logic into a factory
6568
6819
  }
6569
6820
  return "";
6570
6821
  }
6571
- function validateProps(rawProps, props, instance) {
6572
- const resolvedValues = toRaw(props);
6573
- const options = instance.propsOptions[0];
6822
+ function validateProps(rawProps, resolvedProps, options) {
6823
+ resolvedProps = toRaw(resolvedProps);
6574
6824
  const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
6575
6825
  for (const key in options) {
6576
- let opt = options[key];
6577
- if (opt == null) continue;
6578
- validateProp(
6579
- key,
6580
- resolvedValues[key],
6581
- opt,
6582
- shallowReadonly(resolvedValues) ,
6583
- !camelizePropsKey.includes(key)
6584
- );
6826
+ const opt = options[key];
6827
+ if (opt != null) {
6828
+ validateProp(
6829
+ key,
6830
+ resolvedProps[key],
6831
+ opt,
6832
+ resolvedProps,
6833
+ !camelizePropsKey.includes(key)
6834
+ );
6835
+ }
6585
6836
  }
6586
6837
  }
6587
- function validateProp(name, value, prop, props, isAbsent) {
6588
- const { type, required, validator, skipCheck } = prop;
6838
+ function validateProp(key, value, propOptions, resolvedProps, isAbsent) {
6839
+ const { type, required, validator, skipCheck } = propOptions;
6589
6840
  if (required && isAbsent) {
6590
- warn$1('Missing required prop: "' + name + '"');
6841
+ warn$1('Missing required prop: "' + key + '"');
6591
6842
  return;
6592
6843
  }
6593
6844
  if (value == null && !required) {
@@ -6603,12 +6854,12 @@ If you want to remount the same app, move your app creation logic into a factory
6603
6854
  isValid = valid;
6604
6855
  }
6605
6856
  if (!isValid) {
6606
- warn$1(getInvalidTypeMessage(name, value, expectedTypes));
6857
+ warn$1(getInvalidTypeMessage(key, value, expectedTypes));
6607
6858
  return;
6608
6859
  }
6609
6860
  }
6610
- if (validator && !validator(value, props)) {
6611
- warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
6861
+ if (validator && !validator(value, shallowReadonly(resolvedProps) )) {
6862
+ warn$1('Invalid prop: custom validator check failed for prop "' + key + '".');
6612
6863
  }
6613
6864
  }
6614
6865
  const isSimpleType = /* @__PURE__ */ makeMap(
@@ -6679,7 +6930,7 @@ If you want to remount the same app, move your app creation logic into a factory
6679
6930
  return rawSlot;
6680
6931
  }
6681
6932
  const normalized = withCtx((...args) => {
6682
- if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
6933
+ if (currentInstance && !currentInstance.vapor && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
6683
6934
  warn$1(
6684
6935
  `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
6685
6936
  );
@@ -6776,12 +7027,15 @@ If you want to remount the same app, move your app creation logic into a factory
6776
7027
 
6777
7028
  let supported;
6778
7029
  let perf;
7030
+ let cachedNow$1 = 0;
7031
+ const p$1 = /* @__PURE__ */ Promise.resolve();
7032
+ const getNow$1 = () => cachedNow$1 || (p$1.then(() => cachedNow$1 = 0), cachedNow$1 = isSupported() ? perf.now() : Date.now());
6779
7033
  function startMeasure(instance, type) {
6780
7034
  if (instance.appContext.config.performance && isSupported()) {
6781
7035
  perf.mark(`vue-${type}-${instance.uid}`);
6782
7036
  }
6783
7037
  {
6784
- devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
7038
+ devtoolsPerfStart(instance, type, getNow$1());
6785
7039
  }
6786
7040
  }
6787
7041
  function endMeasure(instance, type) {
@@ -6798,7 +7052,7 @@ If you want to remount the same app, move your app creation logic into a factory
6798
7052
  perf.clearMarks(endTag);
6799
7053
  }
6800
7054
  {
6801
- devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
7055
+ devtoolsPerfEnd(instance, type, getNow$1());
6802
7056
  }
6803
7057
  }
6804
7058
  function isSupported() {
@@ -6882,6 +7136,9 @@ If you want to remount the same app, move your app creation logic into a factory
6882
7136
  optimized
6883
7137
  );
6884
7138
  break;
7139
+ case VaporSlot:
7140
+ getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
7141
+ break;
6885
7142
  default:
6886
7143
  if (shapeFlag & 1) {
6887
7144
  processElement(
@@ -7094,11 +7351,15 @@ If you want to remount the same app, move your app creation logic into a factory
7094
7351
  }
7095
7352
  hostInsert(el, container, anchor);
7096
7353
  if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
7097
- queuePostRenderEffect(() => {
7098
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7099
- needCallTransitionHooks && transition.enter(el);
7100
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7101
- }, parentSuspense);
7354
+ queuePostRenderEffect(
7355
+ () => {
7356
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7357
+ needCallTransitionHooks && transition.enter(el);
7358
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7359
+ },
7360
+ void 0,
7361
+ parentSuspense
7362
+ );
7102
7363
  }
7103
7364
  };
7104
7365
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
@@ -7110,8 +7371,8 @@ If you want to remount the same app, move your app creation logic into a factory
7110
7371
  hostSetScopeId(el, slotScopeIds[i]);
7111
7372
  }
7112
7373
  }
7113
- if (parentComponent) {
7114
- let subTree = parentComponent.subTree;
7374
+ let subTree = parentComponent && parentComponent.subTree;
7375
+ if (subTree) {
7115
7376
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
7116
7377
  subTree = filterSingleRoot(subTree.children) || subTree;
7117
7378
  }
@@ -7228,10 +7489,14 @@ If you want to remount the same app, move your app creation logic into a factory
7228
7489
  patchProps(el, oldProps, newProps, parentComponent, namespace);
7229
7490
  }
7230
7491
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
7231
- queuePostRenderEffect(() => {
7232
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7233
- dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
7234
- }, parentSuspense);
7492
+ queuePostRenderEffect(
7493
+ () => {
7494
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7495
+ dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
7496
+ },
7497
+ void 0,
7498
+ parentSuspense
7499
+ );
7235
7500
  }
7236
7501
  };
7237
7502
  const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
@@ -7359,7 +7624,22 @@ If you want to remount the same app, move your app creation logic into a factory
7359
7624
  };
7360
7625
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7361
7626
  n2.slotScopeIds = slotScopeIds;
7362
- if (n1 == null) {
7627
+ if (n2.type.__vapor) {
7628
+ if (n1 == null) {
7629
+ getVaporInterface(parentComponent, n2).mount(
7630
+ n2,
7631
+ container,
7632
+ anchor,
7633
+ parentComponent
7634
+ );
7635
+ } else {
7636
+ getVaporInterface(parentComponent, n2).update(
7637
+ n1,
7638
+ n2,
7639
+ shouldUpdateComponent(n1, n2, optimized)
7640
+ );
7641
+ }
7642
+ } else if (n1 == null) {
7363
7643
  if (n2.shapeFlag & 512) {
7364
7644
  parentComponent.ctx.activate(
7365
7645
  n2,
@@ -7445,15 +7725,52 @@ If you want to remount the same app, move your app creation logic into a factory
7445
7725
  return;
7446
7726
  } else {
7447
7727
  instance.next = n2;
7448
- instance.update();
7728
+ instance.effect.run();
7449
7729
  }
7450
7730
  } else {
7451
7731
  n2.el = n1.el;
7452
7732
  instance.vnode = n2;
7453
7733
  }
7454
7734
  };
7455
- const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
7456
- const componentUpdateFn = () => {
7735
+ class SetupRenderEffect extends ReactiveEffect {
7736
+ constructor(instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) {
7737
+ const prevScope = setCurrentScope(instance.scope);
7738
+ super();
7739
+ this.instance = instance;
7740
+ this.initialVNode = initialVNode;
7741
+ this.container = container;
7742
+ this.anchor = anchor;
7743
+ this.parentSuspense = parentSuspense;
7744
+ this.namespace = namespace;
7745
+ this.optimized = optimized;
7746
+ setCurrentScope(prevScope);
7747
+ this.job = instance.job = () => {
7748
+ if (this.dirty) {
7749
+ this.run();
7750
+ }
7751
+ };
7752
+ this.job.i = instance;
7753
+ {
7754
+ this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
7755
+ this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
7756
+ }
7757
+ }
7758
+ notify() {
7759
+ if (!(this.flags & 256)) {
7760
+ const job = this.job;
7761
+ queueJob(job, job.i.uid);
7762
+ }
7763
+ }
7764
+ fn() {
7765
+ const {
7766
+ instance,
7767
+ initialVNode,
7768
+ container,
7769
+ anchor,
7770
+ parentSuspense,
7771
+ namespace,
7772
+ optimized
7773
+ } = this;
7457
7774
  if (!instance.isMounted) {
7458
7775
  let vnodeHook;
7459
7776
  const { el, props } = initialVNode;
@@ -7529,23 +7846,24 @@ If you want to remount the same app, move your app creation logic into a factory
7529
7846
  initialVNode.el = subTree.el;
7530
7847
  }
7531
7848
  if (m) {
7532
- queuePostRenderEffect(m, parentSuspense);
7849
+ queuePostRenderEffect(m, void 0, parentSuspense);
7533
7850
  }
7534
7851
  if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
7535
7852
  const scopedInitialVNode = initialVNode;
7536
7853
  queuePostRenderEffect(
7537
7854
  () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
7855
+ void 0,
7538
7856
  parentSuspense
7539
7857
  );
7540
7858
  }
7541
- if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
7542
- instance.a && queuePostRenderEffect(instance.a, parentSuspense);
7859
+ if (initialVNode.shapeFlag & 256 || parent && parent.vnode && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
7860
+ instance.a && queuePostRenderEffect(instance.a, void 0, parentSuspense);
7543
7861
  }
7544
7862
  instance.isMounted = true;
7545
7863
  {
7546
7864
  devtoolsComponentAdded(instance);
7547
7865
  }
7548
- initialVNode = container = anchor = null;
7866
+ this.initialVNode = this.container = this.anchor = null;
7549
7867
  } else {
7550
7868
  let { next, bu, u, parent, vnode } = instance;
7551
7869
  {
@@ -7557,7 +7875,7 @@ If you want to remount the same app, move your app creation logic into a factory
7557
7875
  }
7558
7876
  nonHydratedAsyncRoot.asyncDep.then(() => {
7559
7877
  if (!instance.isUnmounted) {
7560
- componentUpdateFn();
7878
+ this.fn();
7561
7879
  }
7562
7880
  });
7563
7881
  return;
@@ -7613,11 +7931,12 @@ If you want to remount the same app, move your app creation logic into a factory
7613
7931
  updateHOCHostEl(instance, nextTree.el);
7614
7932
  }
7615
7933
  if (u) {
7616
- queuePostRenderEffect(u, parentSuspense);
7934
+ queuePostRenderEffect(u, void 0, parentSuspense);
7617
7935
  }
7618
7936
  if (vnodeHook = next.props && next.props.onVnodeUpdated) {
7619
7937
  queuePostRenderEffect(
7620
7938
  () => invokeVNodeHook(vnodeHook, parent, next, vnode),
7939
+ void 0,
7621
7940
  parentSuspense
7622
7941
  );
7623
7942
  }
@@ -7628,21 +7947,21 @@ If you want to remount the same app, move your app creation logic into a factory
7628
7947
  popWarningContext();
7629
7948
  }
7630
7949
  }
7631
- };
7632
- instance.scope.on();
7633
- const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
7634
- instance.scope.off();
7635
- const update = instance.update = effect.run.bind(effect);
7636
- const job = instance.job = effect.runIfDirty.bind(effect);
7637
- job.i = instance;
7638
- job.id = instance.uid;
7639
- effect.scheduler = () => queueJob(job);
7640
- toggleRecurse(instance, true);
7641
- {
7642
- effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
7643
- effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
7644
7950
  }
7645
- update();
7951
+ }
7952
+ const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
7953
+ const effect = instance.effect = new SetupRenderEffect(
7954
+ instance,
7955
+ initialVNode,
7956
+ container,
7957
+ anchor,
7958
+ parentSuspense,
7959
+ namespace,
7960
+ optimized
7961
+ );
7962
+ instance.update = effect.run.bind(effect);
7963
+ toggleRecurse(instance, true);
7964
+ effect.run();
7646
7965
  };
7647
7966
  const updateComponentPreRender = (instance, nextVNode, optimized) => {
7648
7967
  nextVNode.component = instance;
@@ -7651,9 +7970,9 @@ If you want to remount the same app, move your app creation logic into a factory
7651
7970
  instance.next = null;
7652
7971
  updateProps(instance, nextVNode.props, prevProps, optimized);
7653
7972
  updateSlots(instance, nextVNode.children, optimized);
7654
- pauseTracking();
7973
+ const prevSub = setActiveSub();
7655
7974
  flushPreFlushCbs(instance);
7656
- resetTracking();
7975
+ setActiveSub(prevSub);
7657
7976
  };
7658
7977
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
7659
7978
  const c1 = n1 && n1.children;
@@ -7930,7 +8249,13 @@ If you want to remount the same app, move your app creation logic into a factory
7930
8249
  );
7931
8250
  } else if (moved) {
7932
8251
  if (j < 0 || i !== increasingNewIndexSequence[j]) {
7933
- move(nextChild, container, anchor, 2);
8252
+ move(
8253
+ nextChild,
8254
+ container,
8255
+ anchor,
8256
+ 2,
8257
+ parentComponent
8258
+ );
7934
8259
  } else {
7935
8260
  j--;
7936
8261
  }
@@ -7938,10 +8263,20 @@ If you want to remount the same app, move your app creation logic into a factory
7938
8263
  }
7939
8264
  }
7940
8265
  };
7941
- const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
8266
+ const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
7942
8267
  const { el, type, transition, children, shapeFlag } = vnode;
7943
8268
  if (shapeFlag & 6) {
7944
- move(vnode.component.subTree, container, anchor, moveType);
8269
+ if (type.__vapor) {
8270
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
8271
+ } else {
8272
+ move(
8273
+ vnode.component.subTree,
8274
+ container,
8275
+ anchor,
8276
+ moveType,
8277
+ parentComponent
8278
+ );
8279
+ }
7945
8280
  return;
7946
8281
  }
7947
8282
  if (shapeFlag & 128) {
@@ -7949,13 +8284,25 @@ If you want to remount the same app, move your app creation logic into a factory
7949
8284
  return;
7950
8285
  }
7951
8286
  if (shapeFlag & 64) {
7952
- type.move(vnode, container, anchor, internals);
8287
+ type.move(
8288
+ vnode,
8289
+ container,
8290
+ anchor,
8291
+ internals,
8292
+ parentComponent
8293
+ );
7953
8294
  return;
7954
8295
  }
7955
8296
  if (type === Fragment) {
7956
8297
  hostInsert(el, container, anchor);
7957
8298
  for (let i = 0; i < children.length; i++) {
7958
- move(children[i], container, anchor, moveType);
8299
+ move(
8300
+ children[i],
8301
+ container,
8302
+ anchor,
8303
+ moveType,
8304
+ parentComponent
8305
+ );
7959
8306
  }
7960
8307
  hostInsert(vnode.anchor, container, anchor);
7961
8308
  return;
@@ -7969,7 +8316,11 @@ If you want to remount the same app, move your app creation logic into a factory
7969
8316
  if (moveType === 0) {
7970
8317
  transition.beforeEnter(el);
7971
8318
  hostInsert(el, container, anchor);
7972
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
8319
+ queuePostRenderEffect(
8320
+ () => transition.enter(el),
8321
+ void 0,
8322
+ parentSuspense
8323
+ );
7973
8324
  } else {
7974
8325
  const { leave, delayLeave, afterLeave } = transition;
7975
8326
  const remove2 = () => {
@@ -8011,9 +8362,9 @@ If you want to remount the same app, move your app creation logic into a factory
8011
8362
  optimized = false;
8012
8363
  }
8013
8364
  if (ref != null) {
8014
- pauseTracking();
8365
+ const prevSub = setActiveSub();
8015
8366
  setRef(ref, null, parentSuspense, vnode, true);
8016
- resetTracking();
8367
+ setActiveSub(prevSub);
8017
8368
  }
8018
8369
  if (cacheIndex != null) {
8019
8370
  parentComponent.renderCache[cacheIndex] = void 0;
@@ -8029,7 +8380,12 @@ If you want to remount the same app, move your app creation logic into a factory
8029
8380
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
8030
8381
  }
8031
8382
  if (shapeFlag & 6) {
8032
- unmountComponent(vnode.component, parentSuspense, doRemove);
8383
+ if (type.__vapor) {
8384
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8385
+ return;
8386
+ } else {
8387
+ unmountComponent(vnode.component, parentSuspense, doRemove);
8388
+ }
8033
8389
  } else {
8034
8390
  if (shapeFlag & 128) {
8035
8391
  vnode.suspense.unmount(parentSuspense, doRemove);
@@ -8063,15 +8419,23 @@ If you want to remount the same app, move your app creation logic into a factory
8063
8419
  } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
8064
8420
  unmountChildren(children, parentComponent, parentSuspense);
8065
8421
  }
8422
+ if (type === VaporSlot) {
8423
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8424
+ return;
8425
+ }
8066
8426
  if (doRemove) {
8067
8427
  remove(vnode);
8068
8428
  }
8069
8429
  }
8070
8430
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
8071
- queuePostRenderEffect(() => {
8072
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
8073
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8074
- }, parentSuspense);
8431
+ queuePostRenderEffect(
8432
+ () => {
8433
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
8434
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8435
+ },
8436
+ void 0,
8437
+ parentSuspense
8438
+ );
8075
8439
  }
8076
8440
  };
8077
8441
  const remove = (vnode) => {
@@ -8128,7 +8492,7 @@ If you want to remount the same app, move your app creation logic into a factory
8128
8492
  const {
8129
8493
  bum,
8130
8494
  scope,
8131
- job,
8495
+ effect,
8132
8496
  subTree,
8133
8497
  um,
8134
8498
  m,
@@ -8147,16 +8511,18 @@ If you want to remount the same app, move your app creation logic into a factory
8147
8511
  });
8148
8512
  }
8149
8513
  scope.stop();
8150
- if (job) {
8151
- job.flags |= 8;
8514
+ if (effect) {
8515
+ effect.stop();
8152
8516
  unmount(subTree, instance, parentSuspense, doRemove);
8153
8517
  }
8154
8518
  if (um) {
8155
- queuePostRenderEffect(um, parentSuspense);
8519
+ queuePostRenderEffect(um, void 0, parentSuspense);
8156
8520
  }
8157
- queuePostRenderEffect(() => {
8158
- instance.isUnmounted = true;
8159
- }, parentSuspense);
8521
+ queuePostRenderEffect(
8522
+ () => instance.isUnmounted = true,
8523
+ void 0,
8524
+ parentSuspense
8525
+ );
8160
8526
  if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8161
8527
  parentSuspense.deps--;
8162
8528
  if (parentSuspense.deps === 0) {
@@ -8174,6 +8540,9 @@ If you want to remount the same app, move your app creation logic into a factory
8174
8540
  };
8175
8541
  const getNextHostNode = (vnode) => {
8176
8542
  if (vnode.shapeFlag & 6) {
8543
+ if (vnode.type.__vapor) {
8544
+ return hostNextSibling(vnode.component.block);
8545
+ }
8177
8546
  return getNextHostNode(vnode.component.subTree);
8178
8547
  }
8179
8548
  if (vnode.shapeFlag & 128) {
@@ -8183,7 +8552,6 @@ If you want to remount the same app, move your app creation logic into a factory
8183
8552
  const teleportEnd = el && el[TeleportEndKey];
8184
8553
  return teleportEnd ? hostNextSibling(teleportEnd) : el;
8185
8554
  };
8186
- let isFlushing = false;
8187
8555
  const render = (vnode, container, namespace) => {
8188
8556
  if (vnode == null) {
8189
8557
  if (container._vnode) {
@@ -8201,12 +8569,7 @@ If you want to remount the same app, move your app creation logic into a factory
8201
8569
  );
8202
8570
  }
8203
8571
  container._vnode = vnode;
8204
- if (!isFlushing) {
8205
- isFlushing = true;
8206
- flushPreFlushCbs();
8207
- flushPostFlushCbs();
8208
- isFlushing = false;
8209
- }
8572
+ flushOnAppMount();
8210
8573
  };
8211
8574
  const internals = {
8212
8575
  p: patch,
@@ -8214,6 +8577,7 @@ If you want to remount the same app, move your app creation logic into a factory
8214
8577
  m: move,
8215
8578
  r: remove,
8216
8579
  mt: mountComponent,
8580
+ umt: unmountComponent,
8217
8581
  mc: mountChildren,
8218
8582
  pc: patchChildren,
8219
8583
  pbc: patchBlockChildren,
@@ -8227,22 +8591,53 @@ If you want to remount the same app, move your app creation logic into a factory
8227
8591
  internals
8228
8592
  );
8229
8593
  }
8594
+ const mountApp = (app, container, isHydrate, namespace) => {
8595
+ const vnode = app._ceVNode || createVNode(app._component, app._props);
8596
+ vnode.appContext = app._context;
8597
+ if (namespace === true) {
8598
+ namespace = "svg";
8599
+ } else if (namespace === false) {
8600
+ namespace = void 0;
8601
+ }
8602
+ {
8603
+ app._context.reload = () => {
8604
+ const cloned = cloneVNode(vnode);
8605
+ cloned.el = null;
8606
+ render(cloned, container, namespace);
8607
+ };
8608
+ }
8609
+ if (isHydrate && hydrate) {
8610
+ hydrate(vnode, container);
8611
+ } else {
8612
+ render(vnode, container, namespace);
8613
+ }
8614
+ return vnode.component;
8615
+ };
8616
+ const unmountApp = (app) => {
8617
+ render(null, app._container);
8618
+ };
8230
8619
  return {
8231
8620
  render,
8232
8621
  hydrate,
8233
- createApp: createAppAPI(render, hydrate)
8622
+ internals,
8623
+ createApp: createAppAPI(
8624
+ mountApp,
8625
+ unmountApp,
8626
+ getComponentPublicInstance)
8234
8627
  };
8235
8628
  }
8236
8629
  function resolveChildrenNamespace({ type, props }, currentNamespace) {
8237
8630
  return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
8238
8631
  }
8239
- function toggleRecurse({ effect, job }, allowed) {
8240
- if (allowed) {
8241
- effect.flags |= 32;
8242
- job.flags |= 4;
8243
- } else {
8244
- effect.flags &= -33;
8245
- job.flags &= -5;
8632
+ function toggleRecurse({ effect, job, vapor }, allowed) {
8633
+ if (!vapor) {
8634
+ if (allowed) {
8635
+ effect.flags |= 128;
8636
+ job.flags |= 2;
8637
+ } else {
8638
+ effect.flags &= -129;
8639
+ job.flags &= -3;
8640
+ }
8246
8641
  }
8247
8642
  }
8248
8643
  function needTransition(parentSuspense, transition) {
@@ -8275,48 +8670,8 @@ If you want to remount the same app, move your app creation logic into a factory
8275
8670
  }
8276
8671
  }
8277
8672
  }
8278
- function getSequence(arr) {
8279
- const p = arr.slice();
8280
- const result = [0];
8281
- let i, j, u, v, c;
8282
- const len = arr.length;
8283
- for (i = 0; i < len; i++) {
8284
- const arrI = arr[i];
8285
- if (arrI !== 0) {
8286
- j = result[result.length - 1];
8287
- if (arr[j] < arrI) {
8288
- p[i] = j;
8289
- result.push(i);
8290
- continue;
8291
- }
8292
- u = 0;
8293
- v = result.length - 1;
8294
- while (u < v) {
8295
- c = u + v >> 1;
8296
- if (arr[result[c]] < arrI) {
8297
- u = c + 1;
8298
- } else {
8299
- v = c;
8300
- }
8301
- }
8302
- if (arrI < arr[result[u]]) {
8303
- if (u > 0) {
8304
- p[i] = result[u - 1];
8305
- }
8306
- result[u] = i;
8307
- }
8308
- }
8309
- }
8310
- u = result.length;
8311
- v = result[u - 1];
8312
- while (u-- > 0) {
8313
- result[u] = v;
8314
- v = p[v];
8315
- }
8316
- return result;
8317
- }
8318
8673
  function locateNonHydratedAsyncRoot(instance) {
8319
- const subComponent = instance.subTree.component;
8674
+ const subComponent = instance.vapor ? null : instance.subTree.component;
8320
8675
  if (subComponent) {
8321
8676
  if (subComponent.asyncDep && !subComponent.asyncResolved) {
8322
8677
  return subComponent;
@@ -8328,8 +8683,22 @@ If you want to remount the same app, move your app creation logic into a factory
8328
8683
  function invalidateMount(hooks) {
8329
8684
  if (hooks) {
8330
8685
  for (let i = 0; i < hooks.length; i++)
8331
- hooks[i].flags |= 8;
8686
+ hooks[i].flags |= 4;
8687
+ }
8688
+ }
8689
+ function getVaporInterface(instance, vnode) {
8690
+ const ctx = instance ? instance.appContext : vnode.appContext;
8691
+ const res = ctx && ctx.vapor;
8692
+ if (!res) {
8693
+ warn$1(
8694
+ `Vapor component found in vdom tree but vapor-in-vdom interop was not installed. Make sure to install it:
8695
+ \`\`\`
8696
+ import { vaporInteropPlugin } from 'vue'
8697
+ app.use(vaporInteropPlugin)
8698
+ \`\`\``
8699
+ );
8332
8700
  }
8701
+ return res;
8333
8702
  }
8334
8703
 
8335
8704
  const ssrContextKey = Symbol.for("v-scx");
@@ -8364,8 +8733,41 @@ If you want to remount the same app, move your app creation logic into a factory
8364
8733
  }
8365
8734
  return doWatch(source, cb, options);
8366
8735
  }
8736
+ class RenderWatcherEffect extends WatcherEffect {
8737
+ constructor(instance, source, cb, options, flush) {
8738
+ super(source, cb, options);
8739
+ this.flush = flush;
8740
+ const job = () => {
8741
+ if (this.dirty) {
8742
+ this.run();
8743
+ }
8744
+ };
8745
+ if (cb) {
8746
+ this.flags |= 128;
8747
+ job.flags |= 2;
8748
+ }
8749
+ if (instance) {
8750
+ job.i = instance;
8751
+ }
8752
+ this.job = job;
8753
+ }
8754
+ notify() {
8755
+ const flags = this.flags;
8756
+ if (!(flags & 256)) {
8757
+ const flush = this.flush;
8758
+ const job = this.job;
8759
+ if (flush === "post") {
8760
+ queuePostRenderEffect(job, void 0, job.i ? job.i.suspense : null);
8761
+ } else if (flush === "pre") {
8762
+ queueJob(job, job.i ? job.i.uid : void 0, true);
8763
+ } else {
8764
+ job();
8765
+ }
8766
+ }
8767
+ }
8768
+ }
8367
8769
  function doWatch(source, cb, options = EMPTY_OBJ) {
8368
- const { immediate, deep, flush, once } = options;
8770
+ const { immediate, deep, flush = "pre", once } = options;
8369
8771
  if (!cb) {
8370
8772
  if (immediate !== void 0) {
8371
8773
  warn$1(
@@ -8387,35 +8789,25 @@ If you want to remount the same app, move your app creation logic into a factory
8387
8789
  baseWatchOptions.onWarn = warn$1;
8388
8790
  const instance = currentInstance;
8389
8791
  baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
8390
- let isPre = false;
8391
- if (flush === "post") {
8392
- baseWatchOptions.scheduler = (job) => {
8393
- queuePostRenderEffect(job, instance && instance.suspense);
8394
- };
8395
- } else if (flush !== "sync") {
8396
- isPre = true;
8397
- baseWatchOptions.scheduler = (job, isFirstRun) => {
8398
- if (isFirstRun) {
8399
- job();
8400
- } else {
8401
- queueJob(job);
8402
- }
8403
- };
8792
+ const effect = new RenderWatcherEffect(
8793
+ instance,
8794
+ source,
8795
+ cb,
8796
+ baseWatchOptions,
8797
+ flush
8798
+ );
8799
+ if (cb) {
8800
+ effect.run(true);
8801
+ } else if (flush === "post") {
8802
+ queuePostRenderEffect(effect.job, void 0, instance && instance.suspense);
8803
+ } else {
8804
+ effect.run(true);
8404
8805
  }
8405
- baseWatchOptions.augmentJob = (job) => {
8406
- if (cb) {
8407
- job.flags |= 4;
8408
- }
8409
- if (isPre) {
8410
- job.flags |= 2;
8411
- if (instance) {
8412
- job.id = instance.uid;
8413
- job.i = instance;
8414
- }
8415
- }
8416
- };
8417
- const watchHandle = watch$1(source, cb, baseWatchOptions);
8418
- return watchHandle;
8806
+ const stop = effect.stop.bind(effect);
8807
+ stop.pause = effect.pause.bind(effect);
8808
+ stop.resume = effect.resume.bind(effect);
8809
+ stop.stop = stop;
8810
+ return stop;
8419
8811
  }
8420
8812
  function instanceWatch(source, value, options) {
8421
8813
  const publicThis = this.proxy;
@@ -8427,9 +8819,9 @@ If you want to remount the same app, move your app creation logic into a factory
8427
8819
  cb = value.handler;
8428
8820
  options = value;
8429
8821
  }
8430
- const reset = setCurrentInstance(this);
8822
+ const prev = setCurrentInstance(this);
8431
8823
  const res = doWatch(getter, cb.bind(publicThis), options);
8432
- reset();
8824
+ setCurrentInstance(...prev);
8433
8825
  return res;
8434
8826
  }
8435
8827
  function createPathGetter(ctx, path) {
@@ -8444,7 +8836,7 @@ If you want to remount the same app, move your app creation logic into a factory
8444
8836
  }
8445
8837
 
8446
8838
  function useModel(props, name, options = EMPTY_OBJ) {
8447
- const i = getCurrentInstance();
8839
+ const i = getCurrentGenericInstance();
8448
8840
  if (!i) {
8449
8841
  warn$1(`useModel() called without active instance.`);
8450
8842
  return ref();
@@ -8455,7 +8847,7 @@ If you want to remount the same app, move your app creation logic into a factory
8455
8847
  return ref();
8456
8848
  }
8457
8849
  const hyphenatedName = hyphenate(name);
8458
- const modifiers = getModelModifiers(props, camelizedName);
8850
+ const modifiers = getModelModifiers(props, camelizedName, defaultPropGetter);
8459
8851
  const res = customRef((track, trigger) => {
8460
8852
  let localValue;
8461
8853
  let prevSetValue = EMPTY_OBJ;
@@ -8477,9 +8869,25 @@ If you want to remount the same app, move your app creation logic into a factory
8477
8869
  if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
8478
8870
  return;
8479
8871
  }
8480
- const rawProps = i.vnode.props;
8481
- if (!(rawProps && // check if parent has passed v-model
8482
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
8872
+ let rawPropKeys;
8873
+ let parentPassedModelValue = false;
8874
+ let parentPassedModelUpdater = false;
8875
+ if (i.rawKeys) {
8876
+ rawPropKeys = i.rawKeys();
8877
+ } else {
8878
+ const rawProps = i.vnode.props;
8879
+ rawPropKeys = rawProps && Object.keys(rawProps);
8880
+ }
8881
+ if (rawPropKeys) {
8882
+ for (const key of rawPropKeys) {
8883
+ if (key === name || key === camelizedName || key === hyphenatedName) {
8884
+ parentPassedModelValue = true;
8885
+ } else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) {
8886
+ parentPassedModelUpdater = true;
8887
+ }
8888
+ }
8889
+ }
8890
+ if (!parentPassedModelValue || !parentPassedModelUpdater) {
8483
8891
  localValue = value;
8484
8892
  trigger();
8485
8893
  }
@@ -8506,21 +8914,26 @@ If you want to remount the same app, move your app creation logic into a factory
8506
8914
  };
8507
8915
  return res;
8508
8916
  }
8509
- const getModelModifiers = (props, modelName) => {
8510
- return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
8917
+ const getModelModifiers = (props, modelName, getter) => {
8918
+ return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
8511
8919
  };
8512
8920
 
8513
8921
  function emit(instance, event, ...rawArgs) {
8922
+ return baseEmit(
8923
+ instance,
8924
+ instance.vnode.props || EMPTY_OBJ,
8925
+ defaultPropGetter,
8926
+ event,
8927
+ ...rawArgs
8928
+ );
8929
+ }
8930
+ function baseEmit(instance, props, getter, event, ...rawArgs) {
8514
8931
  if (instance.isUnmounted) return;
8515
- const props = instance.vnode.props || EMPTY_OBJ;
8516
8932
  {
8517
- const {
8518
- emitsOptions,
8519
- propsOptions: [propsOptions]
8520
- } = instance;
8933
+ const { emitsOptions, propsOptions } = instance;
8521
8934
  if (emitsOptions) {
8522
8935
  if (!(event in emitsOptions) && true) {
8523
- if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
8936
+ if (!propsOptions || !propsOptions[0] || !(toHandlerKey(camelize(event)) in propsOptions[0])) {
8524
8937
  warn$1(
8525
8938
  `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
8526
8939
  );
@@ -8540,7 +8953,7 @@ If you want to remount the same app, move your app creation logic into a factory
8540
8953
  }
8541
8954
  let args = rawArgs;
8542
8955
  const isModelListener = event.startsWith("update:");
8543
- const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
8956
+ const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
8544
8957
  if (modifiers) {
8545
8958
  if (modifiers.trim) {
8546
8959
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
@@ -8554,7 +8967,7 @@ If you want to remount the same app, move your app creation logic into a factory
8554
8967
  }
8555
8968
  {
8556
8969
  const lowerCaseEvent = event.toLowerCase();
8557
- if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
8970
+ if (lowerCaseEvent !== event && getter(props, toHandlerKey(lowerCaseEvent))) {
8558
8971
  warn$1(
8559
8972
  `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
8560
8973
  instance,
@@ -8566,10 +8979,10 @@ If you want to remount the same app, move your app creation logic into a factory
8566
8979
  }
8567
8980
  }
8568
8981
  let handlerName;
8569
- let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
8570
- props[handlerName = toHandlerKey(camelize(event))];
8982
+ let handler = getter(props, handlerName = toHandlerKey(event)) || // also try camelCase event handler (#2249)
8983
+ getter(props, handlerName = toHandlerKey(camelize(event)));
8571
8984
  if (!handler && isModelListener) {
8572
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
8985
+ handler = getter(props, handlerName = toHandlerKey(hyphenate(event)));
8573
8986
  }
8574
8987
  if (handler) {
8575
8988
  callWithAsyncErrorHandling(
@@ -8579,7 +8992,7 @@ If you want to remount the same app, move your app creation logic into a factory
8579
8992
  args
8580
8993
  );
8581
8994
  }
8582
- const onceHandler = props[handlerName + `Once`];
8995
+ const onceHandler = getter(props, handlerName + `Once`);
8583
8996
  if (onceHandler) {
8584
8997
  if (!instance.emitted) {
8585
8998
  instance.emitted = {};
@@ -8595,6 +9008,9 @@ If you want to remount the same app, move your app creation logic into a factory
8595
9008
  );
8596
9009
  }
8597
9010
  }
9011
+ function defaultPropGetter(props, key) {
9012
+ return props[key];
9013
+ }
8598
9014
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
8599
9015
  const cache = appContext.emitsCache;
8600
9016
  const cached = cache.get(comp);
@@ -8922,7 +9338,7 @@ If you want to remount the same app, move your app creation logic into a factory
8922
9338
  return false;
8923
9339
  }
8924
9340
  function updateHOCHostEl({ vnode, parent }, el) {
8925
- while (parent) {
9341
+ while (parent && !parent.vapor) {
8926
9342
  const root = parent.subTree;
8927
9343
  if (root.suspense && root.suspense.activeBranch === vnode) {
8928
9344
  root.el = vnode.el;
@@ -9273,7 +9689,8 @@ If you want to remount the same app, move your app creation logic into a factory
9273
9689
  pendingBranch,
9274
9690
  container2,
9275
9691
  anchor === initialAnchor ? next(activeBranch) : anchor,
9276
- 0
9692
+ 0,
9693
+ parentComponent2
9277
9694
  );
9278
9695
  queuePostFlushCb(effects);
9279
9696
  }
@@ -9286,7 +9703,13 @@ If you want to remount the same app, move your app creation logic into a factory
9286
9703
  unmount(activeBranch, parentComponent2, suspense, true);
9287
9704
  }
9288
9705
  if (!delayEnter) {
9289
- move(pendingBranch, container2, anchor, 0);
9706
+ move(
9707
+ pendingBranch,
9708
+ container2,
9709
+ anchor,
9710
+ 0,
9711
+ parentComponent2
9712
+ );
9290
9713
  }
9291
9714
  }
9292
9715
  setActiveBranch(suspense, pendingBranch);
@@ -9359,7 +9782,7 @@ If you want to remount the same app, move your app creation logic into a factory
9359
9782
  }
9360
9783
  },
9361
9784
  move(container2, anchor2, type) {
9362
- suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
9785
+ suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type, parentComponent);
9363
9786
  suspense.container = container2;
9364
9787
  },
9365
9788
  next() {
@@ -9499,7 +9922,7 @@ If you want to remount the same app, move your app creation logic into a factory
9499
9922
  }
9500
9923
  return s;
9501
9924
  }
9502
- function queueEffectWithSuspense(fn, suspense) {
9925
+ function queueEffectWithSuspense(fn, id, suspense) {
9503
9926
  if (suspense && suspense.pendingBranch) {
9504
9927
  if (isArray(fn)) {
9505
9928
  suspense.effects.push(...fn);
@@ -9507,7 +9930,7 @@ If you want to remount the same app, move your app creation logic into a factory
9507
9930
  suspense.effects.push(fn);
9508
9931
  }
9509
9932
  } else {
9510
- queuePostFlushCb(fn);
9933
+ queuePostFlushCb(fn, id);
9511
9934
  }
9512
9935
  }
9513
9936
  function setActiveBranch(suspense, branch) {
@@ -9533,6 +9956,7 @@ If you want to remount the same app, move your app creation logic into a factory
9533
9956
  const Text = Symbol.for("v-txt");
9534
9957
  const Comment = Symbol.for("v-cmt");
9535
9958
  const Static = Symbol.for("v-stc");
9959
+ const VaporSlot = Symbol.for("v-vps");
9536
9960
  const blockStack = [];
9537
9961
  let currentBlock = null;
9538
9962
  function openBlock(disableTracking = false) {
@@ -9906,6 +10330,28 @@ Component that was made reactive: `,
9906
10330
  ]);
9907
10331
  }
9908
10332
 
10333
+ let currentInstance = null;
10334
+ const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
10335
+ const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
10336
+ let isInSSRComponentSetup = false;
10337
+ let setInSSRSetupState;
10338
+ let simpleSetCurrentInstance;
10339
+ {
10340
+ simpleSetCurrentInstance = (i) => {
10341
+ currentInstance = i;
10342
+ };
10343
+ setInSSRSetupState = (v) => {
10344
+ isInSSRComponentSetup = v;
10345
+ };
10346
+ }
10347
+ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope : void 0) => {
10348
+ try {
10349
+ return [currentInstance, setCurrentScope(scope)];
10350
+ } finally {
10351
+ simpleSetCurrentInstance(instance);
10352
+ }
10353
+ };
10354
+
9909
10355
  const emptyAppContext = createAppContext();
9910
10356
  let uid = 0;
9911
10357
  function createComponentInstance(vnode, parent, suspense) {
@@ -9950,7 +10396,7 @@ Component that was made reactive: `,
9950
10396
  // to be set immediately
9951
10397
  emitted: null,
9952
10398
  // props default value
9953
- propsDefaults: EMPTY_OBJ,
10399
+ propsDefaults: null,
9954
10400
  // inheritAttrs
9955
10401
  inheritAttrs: type.inheritAttrs,
9956
10402
  // state
@@ -9997,32 +10443,6 @@ Component that was made reactive: `,
9997
10443
  }
9998
10444
  return instance;
9999
10445
  }
10000
- let currentInstance = null;
10001
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10002
- let internalSetCurrentInstance;
10003
- let setInSSRSetupState;
10004
- {
10005
- internalSetCurrentInstance = (i) => {
10006
- currentInstance = i;
10007
- };
10008
- setInSSRSetupState = (v) => {
10009
- isInSSRComponentSetup = v;
10010
- };
10011
- }
10012
- const setCurrentInstance = (instance) => {
10013
- const prev = currentInstance;
10014
- internalSetCurrentInstance(instance);
10015
- instance.scope.on();
10016
- return () => {
10017
- instance.scope.off();
10018
- internalSetCurrentInstance(prev);
10019
- };
10020
- };
10021
- const unsetCurrentInstance = () => {
10022
- currentInstance && currentInstance.scope.off();
10023
- internalSetCurrentInstance(null);
10024
- };
10025
- const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10026
10446
  function validateComponentName(name, { isNativeTag }) {
10027
10447
  if (isBuiltInTag(name) || isNativeTag(name)) {
10028
10448
  warn$1(
@@ -10033,13 +10453,16 @@ Component that was made reactive: `,
10033
10453
  function isStatefulComponent(instance) {
10034
10454
  return instance.vnode.shapeFlag & 4;
10035
10455
  }
10036
- let isInSSRComponentSetup = false;
10037
10456
  function setupComponent(instance, isSSR = false, optimized = false) {
10038
10457
  isSSR && setInSSRSetupState(isSSR);
10039
- const { props, children } = instance.vnode;
10458
+ const { props, children, vi } = instance.vnode;
10040
10459
  const isStateful = isStatefulComponent(instance);
10041
- initProps(instance, props, isStateful, isSSR);
10042
- initSlots(instance, children, optimized || isSSR);
10460
+ if (vi) {
10461
+ vi(instance);
10462
+ } else {
10463
+ initProps(instance, props, isStateful, isSSR);
10464
+ initSlots(instance, children, optimized || isSSR);
10465
+ }
10043
10466
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
10044
10467
  isSSR && setInSSRSetupState(false);
10045
10468
  return setupResult;
@@ -10076,9 +10499,9 @@ Component that was made reactive: `,
10076
10499
  }
10077
10500
  const { setup } = Component;
10078
10501
  if (setup) {
10079
- pauseTracking();
10502
+ const prevSub = setActiveSub();
10080
10503
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10081
- const reset = setCurrentInstance(instance);
10504
+ const prev = setCurrentInstance(instance);
10082
10505
  const setupResult = callWithErrorHandling(
10083
10506
  setup,
10084
10507
  instance,
@@ -10089,12 +10512,15 @@ Component that was made reactive: `,
10089
10512
  ]
10090
10513
  );
10091
10514
  const isAsyncSetup = isPromise(setupResult);
10092
- resetTracking();
10093
- reset();
10515
+ setActiveSub(prevSub);
10516
+ setCurrentInstance(...prev);
10094
10517
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
10095
10518
  markAsyncBoundary(instance);
10096
10519
  }
10097
10520
  if (isAsyncSetup) {
10521
+ const unsetCurrentInstance = () => {
10522
+ setCurrentInstance(null, void 0);
10523
+ };
10098
10524
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10099
10525
  if (isSSR) {
10100
10526
  return setupResult.then((resolvedResult) => {
@@ -10187,13 +10613,13 @@ Component that was made reactive: `,
10187
10613
  }
10188
10614
  }
10189
10615
  {
10190
- const reset = setCurrentInstance(instance);
10191
- pauseTracking();
10616
+ const prevInstance = setCurrentInstance(instance);
10617
+ const prevSub = setActiveSub();
10192
10618
  try {
10193
10619
  applyOptions(instance);
10194
10620
  } finally {
10195
- resetTracking();
10196
- reset();
10621
+ setActiveSub(prevSub);
10622
+ setCurrentInstance(...prevInstance);
10197
10623
  }
10198
10624
  }
10199
10625
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -10230,29 +10656,6 @@ Component that was made reactive: `,
10230
10656
  });
10231
10657
  }
10232
10658
  function createSetupContext(instance) {
10233
- const expose = (exposed) => {
10234
- {
10235
- if (instance.exposed) {
10236
- warn$1(`expose() should be called only once per setup().`);
10237
- }
10238
- if (exposed != null) {
10239
- let exposedType = typeof exposed;
10240
- if (exposedType === "object") {
10241
- if (isArray(exposed)) {
10242
- exposedType = "array";
10243
- } else if (isRef(exposed)) {
10244
- exposedType = "ref";
10245
- }
10246
- }
10247
- if (exposedType !== "object") {
10248
- warn$1(
10249
- `expose() should be passed a plain object, received ${exposedType}.`
10250
- );
10251
- }
10252
- }
10253
- }
10254
- instance.exposed = exposed || {};
10255
- };
10256
10659
  {
10257
10660
  let attrsProxy;
10258
10661
  let slotsProxy;
@@ -10266,10 +10669,33 @@ Component that was made reactive: `,
10266
10669
  get emit() {
10267
10670
  return (event, ...args) => instance.emit(event, ...args);
10268
10671
  },
10269
- expose
10672
+ expose: (exposed) => expose(instance, exposed)
10270
10673
  });
10271
10674
  }
10272
10675
  }
10676
+ function expose(instance, exposed) {
10677
+ {
10678
+ if (instance.exposed) {
10679
+ warn$1(`expose() should be called only once per setup().`);
10680
+ }
10681
+ if (exposed != null) {
10682
+ let exposedType = typeof exposed;
10683
+ if (exposedType === "object") {
10684
+ if (isArray(exposed)) {
10685
+ exposedType = "array";
10686
+ } else if (isRef(exposed)) {
10687
+ exposedType = "ref";
10688
+ }
10689
+ }
10690
+ if (exposedType !== "object") {
10691
+ warn$1(
10692
+ `expose() should be passed a plain object, received ${exposedType}.`
10693
+ );
10694
+ }
10695
+ }
10696
+ }
10697
+ instance.exposed = exposed || {};
10698
+ }
10273
10699
  function getComponentPublicInstance(instance) {
10274
10700
  if (instance.exposed) {
10275
10701
  return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
@@ -10277,7 +10703,9 @@ Component that was made reactive: `,
10277
10703
  if (key in target) {
10278
10704
  return target[key];
10279
10705
  } else if (key in publicPropertiesMap) {
10280
- return publicPropertiesMap[key](instance);
10706
+ return publicPropertiesMap[key](
10707
+ instance
10708
+ );
10281
10709
  }
10282
10710
  },
10283
10711
  has(target, key) {
@@ -10320,14 +10748,7 @@ Component that was made reactive: `,
10320
10748
  }
10321
10749
 
10322
10750
  const computed = (getterOrOptions, debugOptions) => {
10323
- const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10324
- {
10325
- const i = getCurrentInstance();
10326
- if (i && i.appContext.config.warnRecursiveComputed) {
10327
- c._warnRecursive = true;
10328
- }
10329
- }
10330
- return c;
10751
+ return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10331
10752
  };
10332
10753
 
10333
10754
  function h(type, propsOrChildren, children) {
@@ -10368,9 +10789,9 @@ Component that was made reactive: `,
10368
10789
  if (obj.__isVue) {
10369
10790
  return ["div", vueStyle, `VueInstance`];
10370
10791
  } else if (isRef(obj)) {
10371
- pauseTracking();
10792
+ const prevSub = setActiveSub();
10372
10793
  const value = obj.value;
10373
- resetTracking();
10794
+ setActiveSub(prevSub);
10374
10795
  return [
10375
10796
  "div",
10376
10797
  {},
@@ -10557,7 +10978,7 @@ Component that was made reactive: `,
10557
10978
  return true;
10558
10979
  }
10559
10980
 
10560
- const version = "3.5.17";
10981
+ const version = "3.6.0-alpha.2";
10561
10982
  const warn = warn$1 ;
10562
10983
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10563
10984
  const devtools = devtools$1 ;
@@ -11051,8 +11472,9 @@ Component that was made reactive: `,
11051
11472
  const style = el.style;
11052
11473
  let cssText = "";
11053
11474
  for (const key in vars) {
11054
- style.setProperty(`--${key}`, vars[key]);
11055
- cssText += `--${key}: ${vars[key]};`;
11475
+ const value = normalizeCssVarValue(vars[key]);
11476
+ style.setProperty(`--${key}`, value);
11477
+ cssText += `--${key}: ${value};`;
11056
11478
  }
11057
11479
  style[CSS_VAR_TEXT] = cssText;
11058
11480
  }
@@ -11109,11 +11531,11 @@ Component that was made reactive: `,
11109
11531
  }
11110
11532
  const semicolonRE = /[^\\];\s*$/;
11111
11533
  const importantRE = /\s*!important$/;
11112
- function setStyle(style, name, val) {
11113
- if (isArray(val)) {
11114
- val.forEach((v) => setStyle(style, name, v));
11534
+ function setStyle(style, name, rawVal) {
11535
+ if (isArray(rawVal)) {
11536
+ rawVal.forEach((v) => setStyle(style, name, v));
11115
11537
  } else {
11116
- if (val == null) val = "";
11538
+ const val = rawVal == null ? "" : String(rawVal);
11117
11539
  {
11118
11540
  if (semicolonRE.test(val)) {
11119
11541
  warn(
@@ -11186,8 +11608,7 @@ Component that was made reactive: `,
11186
11608
  return;
11187
11609
  }
11188
11610
  const tag = el.tagName;
11189
- if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11190
- !tag.includes("-")) {
11611
+ if (key === "value" && canSetValueDirectly(tag)) {
11191
11612
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
11192
11613
  const newValue = value == null ? (
11193
11614
  // #11647: value should be set as empty string for null and undefined,
@@ -11315,8 +11736,6 @@ Expected function or array of functions, received type ${typeof value}.`
11315
11736
  }
11316
11737
  }
11317
11738
 
11318
- const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
11319
- key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
11320
11739
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
11321
11740
  const isSVG = namespace === "svg";
11322
11741
  if (key === "class") {
@@ -11356,24 +11775,9 @@ Expected function or array of functions, received type ${typeof value}.`
11356
11775
  }
11357
11776
  return false;
11358
11777
  }
11359
- if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
11360
- return false;
11361
- }
11362
- if (key === "form") {
11363
- return false;
11364
- }
11365
- if (key === "list" && el.tagName === "INPUT") {
11366
- return false;
11367
- }
11368
- if (key === "type" && el.tagName === "TEXTAREA") {
11778
+ if (shouldSetAsAttr(el.tagName, key)) {
11369
11779
  return false;
11370
11780
  }
11371
- if (key === "width" || key === "height") {
11372
- const tag = el.tagName;
11373
- if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
11374
- return false;
11375
- }
11376
- }
11377
11781
  if (isNativeOn(key) && isString(value)) {
11378
11782
  return false;
11379
11783
  }
@@ -11967,28 +12371,12 @@ Expected function or array of functions, received type ${typeof value}.`
11967
12371
  const vModelText = {
11968
12372
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
11969
12373
  el[assignKey] = getModelAssigner(vnode);
11970
- const castToNumber = number || vnode.props && vnode.props.type === "number";
11971
- addEventListener(el, lazy ? "change" : "input", (e) => {
11972
- if (e.target.composing) return;
11973
- let domValue = el.value;
11974
- if (trim) {
11975
- domValue = domValue.trim();
11976
- }
11977
- if (castToNumber) {
11978
- domValue = looseToNumber(domValue);
11979
- }
11980
- el[assignKey](domValue);
11981
- });
11982
- if (trim) {
11983
- addEventListener(el, "change", () => {
11984
- el.value = el.value.trim();
11985
- });
11986
- }
11987
- if (!lazy) {
11988
- addEventListener(el, "compositionstart", onCompositionStart);
11989
- addEventListener(el, "compositionend", onCompositionEnd);
11990
- addEventListener(el, "change", onCompositionEnd);
11991
- }
12374
+ vModelTextInit(
12375
+ el,
12376
+ trim,
12377
+ number || !!(vnode.props && vnode.props.type === "number"),
12378
+ lazy
12379
+ );
11992
12380
  },
11993
12381
  // set value on mounted so it's after min/max for type="range"
11994
12382
  mounted(el, { value }) {
@@ -11996,70 +12384,111 @@ Expected function or array of functions, received type ${typeof value}.`
11996
12384
  },
11997
12385
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
11998
12386
  el[assignKey] = getModelAssigner(vnode);
11999
- if (el.composing) return;
12000
- const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
12001
- const newValue = value == null ? "" : value;
12002
- if (elValue === newValue) {
12387
+ vModelTextUpdate(el, oldValue, value, trim, number, lazy);
12388
+ }
12389
+ };
12390
+ const vModelTextInit = (el, trim, number, lazy, set) => {
12391
+ addEventListener(el, lazy ? "change" : "input", (e) => {
12392
+ if (e.target.composing) return;
12393
+ let domValue = el.value;
12394
+ if (trim) {
12395
+ domValue = domValue.trim();
12396
+ }
12397
+ if (number || el.type === "number") {
12398
+ domValue = looseToNumber(domValue);
12399
+ }
12400
+ (0, el[assignKey])(domValue);
12401
+ });
12402
+ if (trim) {
12403
+ addEventListener(el, "change", () => {
12404
+ el.value = el.value.trim();
12405
+ });
12406
+ }
12407
+ if (!lazy) {
12408
+ addEventListener(el, "compositionstart", onCompositionStart);
12409
+ addEventListener(el, "compositionend", onCompositionEnd);
12410
+ addEventListener(el, "change", onCompositionEnd);
12411
+ }
12412
+ };
12413
+ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
12414
+ if (el.composing) return;
12415
+ const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
12416
+ const newValue = value == null ? "" : value;
12417
+ if (elValue === newValue) {
12418
+ return;
12419
+ }
12420
+ if (document.activeElement === el && el.type !== "range") {
12421
+ if (lazy && value === oldValue) {
12003
12422
  return;
12004
12423
  }
12005
- if (document.activeElement === el && el.type !== "range") {
12006
- if (lazy && value === oldValue) {
12007
- return;
12008
- }
12009
- if (trim && el.value.trim() === newValue) {
12010
- return;
12011
- }
12424
+ if (trim && el.value.trim() === newValue) {
12425
+ return;
12012
12426
  }
12013
- el.value = newValue;
12014
12427
  }
12428
+ el.value = newValue;
12015
12429
  };
12016
12430
  const vModelCheckbox = {
12017
12431
  // #4096 array checkboxes need to be deep traversed
12018
12432
  deep: true,
12019
12433
  created(el, _, vnode) {
12020
12434
  el[assignKey] = getModelAssigner(vnode);
12021
- addEventListener(el, "change", () => {
12022
- const modelValue = el._modelValue;
12023
- const elementValue = getValue(el);
12024
- const checked = el.checked;
12025
- const assign = el[assignKey];
12026
- if (isArray(modelValue)) {
12027
- const index = looseIndexOf(modelValue, elementValue);
12028
- const found = index !== -1;
12029
- if (checked && !found) {
12030
- assign(modelValue.concat(elementValue));
12031
- } else if (!checked && found) {
12032
- const filtered = [...modelValue];
12033
- filtered.splice(index, 1);
12034
- assign(filtered);
12035
- }
12036
- } else if (isSet(modelValue)) {
12037
- const cloned = new Set(modelValue);
12038
- if (checked) {
12039
- cloned.add(elementValue);
12040
- } else {
12041
- cloned.delete(elementValue);
12042
- }
12043
- assign(cloned);
12044
- } else {
12045
- assign(getCheckboxValue(el, checked));
12046
- }
12047
- });
12435
+ vModelCheckboxInit(el);
12048
12436
  },
12049
12437
  // set initial checked on mount to wait for true-value/false-value
12050
- mounted: setChecked,
12438
+ mounted(el, binding, vnode) {
12439
+ vModelCheckboxUpdate(
12440
+ el,
12441
+ binding.oldValue,
12442
+ binding.value,
12443
+ vnode.props.value
12444
+ );
12445
+ },
12051
12446
  beforeUpdate(el, binding, vnode) {
12052
12447
  el[assignKey] = getModelAssigner(vnode);
12053
- setChecked(el, binding, vnode);
12448
+ vModelCheckboxUpdate(
12449
+ el,
12450
+ binding.oldValue,
12451
+ binding.value,
12452
+ vnode.props.value
12453
+ );
12054
12454
  }
12055
12455
  };
12056
- function setChecked(el, { value, oldValue }, vnode) {
12456
+ const vModelCheckboxInit = (el, set) => {
12457
+ addEventListener(el, "change", () => {
12458
+ const assign = el[assignKey];
12459
+ const modelValue = el._modelValue;
12460
+ const elementValue = getValue(el);
12461
+ const checked = el.checked;
12462
+ if (isArray(modelValue)) {
12463
+ const index = looseIndexOf(modelValue, elementValue);
12464
+ const found = index !== -1;
12465
+ if (checked && !found) {
12466
+ assign(modelValue.concat(elementValue));
12467
+ } else if (!checked && found) {
12468
+ const filtered = [...modelValue];
12469
+ filtered.splice(index, 1);
12470
+ assign(filtered);
12471
+ }
12472
+ } else if (isSet(modelValue)) {
12473
+ const cloned = new Set(modelValue);
12474
+ if (checked) {
12475
+ cloned.add(elementValue);
12476
+ } else {
12477
+ cloned.delete(elementValue);
12478
+ }
12479
+ assign(cloned);
12480
+ } else {
12481
+ assign(getCheckboxValue(el, checked));
12482
+ }
12483
+ });
12484
+ };
12485
+ const vModelCheckboxUpdate = (el, oldValue, value, rawValue = getValue(el)) => {
12057
12486
  el._modelValue = value;
12058
12487
  let checked;
12059
12488
  if (isArray(value)) {
12060
- checked = looseIndexOf(value, vnode.props.value) > -1;
12489
+ checked = looseIndexOf(value, rawValue) > -1;
12061
12490
  } else if (isSet(value)) {
12062
- checked = value.has(vnode.props.value);
12491
+ checked = value.has(rawValue);
12063
12492
  } else {
12064
12493
  if (value === oldValue) return;
12065
12494
  checked = looseEqual(value, getCheckboxValue(el, true));
@@ -12067,7 +12496,7 @@ Expected function or array of functions, received type ${typeof value}.`
12067
12496
  if (el.checked !== checked) {
12068
12497
  el.checked = checked;
12069
12498
  }
12070
- }
12499
+ };
12071
12500
  const vModelRadio = {
12072
12501
  created(el, { value }, vnode) {
12073
12502
  el.checked = looseEqual(value, vnode.props.value);
@@ -12087,36 +12516,38 @@ Expected function or array of functions, received type ${typeof value}.`
12087
12516
  // <select multiple> value need to be deep traversed
12088
12517
  deep: true,
12089
12518
  created(el, { value, modifiers: { number } }, vnode) {
12090
- const isSetModel = isSet(value);
12091
- addEventListener(el, "change", () => {
12092
- const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12093
- (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12094
- );
12095
- el[assignKey](
12096
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12097
- );
12098
- el._assigning = true;
12099
- nextTick(() => {
12100
- el._assigning = false;
12101
- });
12102
- });
12519
+ vModelSelectInit(el, value, number);
12103
12520
  el[assignKey] = getModelAssigner(vnode);
12104
12521
  },
12105
12522
  // set value in mounted & updated because <select> relies on its children
12106
12523
  // <option>s.
12107
12524
  mounted(el, { value }) {
12108
- setSelected(el, value);
12525
+ vModelSetSelected(el, value);
12109
12526
  },
12110
12527
  beforeUpdate(el, _binding, vnode) {
12111
12528
  el[assignKey] = getModelAssigner(vnode);
12112
12529
  },
12113
12530
  updated(el, { value }) {
12114
- if (!el._assigning) {
12115
- setSelected(el, value);
12116
- }
12531
+ vModelSetSelected(el, value);
12117
12532
  }
12118
12533
  };
12119
- function setSelected(el, value) {
12534
+ const vModelSelectInit = (el, value, number, set) => {
12535
+ const isSetModel = isSet(value);
12536
+ addEventListener(el, "change", () => {
12537
+ const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12538
+ (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12539
+ );
12540
+ (0, el[assignKey])(
12541
+ el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12542
+ );
12543
+ el._assigning = true;
12544
+ nextTick(() => {
12545
+ el._assigning = false;
12546
+ });
12547
+ });
12548
+ };
12549
+ const vModelSetSelected = (el, value) => {
12550
+ if (el._assigning) return;
12120
12551
  const isMultiple = el.multiple;
12121
12552
  const isArrayValue = isArray(value);
12122
12553
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12147,13 +12578,20 @@ Expected function or array of functions, received type ${typeof value}.`
12147
12578
  if (!isMultiple && el.selectedIndex !== -1) {
12148
12579
  el.selectedIndex = -1;
12149
12580
  }
12150
- }
12581
+ };
12151
12582
  function getValue(el) {
12152
12583
  return "_value" in el ? el._value : el.value;
12153
12584
  }
12154
12585
  function getCheckboxValue(el, checked) {
12155
12586
  const key = checked ? "_trueValue" : "_falseValue";
12156
- return key in el ? el[key] : checked;
12587
+ if (key in el) {
12588
+ return el[key];
12589
+ }
12590
+ const attr = checked ? "true-value" : "false-value";
12591
+ if (el.hasAttribute(attr)) {
12592
+ return el.getAttribute(attr);
12593
+ }
12594
+ return checked;
12157
12595
  }
12158
12596
  const vModelDynamic = {
12159
12597
  created(el, binding, vnode) {
@@ -14724,6 +15162,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14724
15162
  }
14725
15163
  }
14726
15164
 
15165
+ function getSelfName(filename) {
15166
+ const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
15167
+ return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
15168
+ }
14727
15169
  function createTransformContext(root, {
14728
15170
  filename = "",
14729
15171
  prefixIdentifiers = false,
@@ -14748,11 +15190,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14748
15190
  onWarn = defaultOnWarn,
14749
15191
  compatConfig
14750
15192
  }) {
14751
- const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
14752
15193
  const context = {
14753
15194
  // options
14754
15195
  filename,
14755
- selfName: nameMatch && capitalize(camelize(nameMatch[1])),
15196
+ selfName: getSelfName(filename),
14756
15197
  prefixIdentifiers,
14757
15198
  hoistStatic,
14758
15199
  hmr,
@@ -15055,7 +15496,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15055
15496
  helper(key) {
15056
15497
  return `_${helperNameMap[key]}`;
15057
15498
  },
15058
- push(code, newlineIndex = -2 /* None */, node) {
15499
+ push(code, newlineIndex = -2, node) {
15059
15500
  context.code += code;
15060
15501
  },
15061
15502
  indent() {
@@ -15073,7 +15514,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15073
15514
  }
15074
15515
  };
15075
15516
  function newline(n) {
15076
- context.push("\n" + ` `.repeat(n), 0 /* Start */);
15517
+ context.push("\n" + ` `.repeat(n), 0);
15077
15518
  }
15078
15519
  return context;
15079
15520
  }
@@ -15111,7 +15552,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15111
15552
  push(
15112
15553
  `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
15113
15554
  `,
15114
- -1 /* End */
15555
+ -1
15115
15556
  );
15116
15557
  newline();
15117
15558
  }
@@ -15136,7 +15577,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15136
15577
  }
15137
15578
  if (ast.components.length || ast.directives.length || ast.temps) {
15138
15579
  push(`
15139
- `, 0 /* Start */);
15580
+ `, 0);
15140
15581
  newline();
15141
15582
  }
15142
15583
  if (!ssr) {
@@ -15157,7 +15598,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15157
15598
  ast,
15158
15599
  code: context.code,
15159
15600
  preamble: ``,
15160
- map: context.map ? context.map.toJSON() : void 0
15601
+ map: context.map ? context.map.toJSON() : void 0,
15602
+ helpers: ast.helpers
15161
15603
  };
15162
15604
  }
15163
15605
  function genFunctionPreamble(ast, context) {
@@ -15175,7 +15617,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15175
15617
  if (helpers.length > 0) {
15176
15618
  {
15177
15619
  push(`const _Vue = ${VueBinding}
15178
- `, -1 /* End */);
15620
+ `, -1);
15179
15621
  if (ast.hoists.length) {
15180
15622
  const staticHelpers = [
15181
15623
  CREATE_VNODE,
@@ -15185,7 +15627,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15185
15627
  CREATE_STATIC
15186
15628
  ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
15187
15629
  push(`const { ${staticHelpers} } = _Vue
15188
- `, -1 /* End */);
15630
+ `, -1);
15189
15631
  }
15190
15632
  }
15191
15633
  }
@@ -15244,7 +15686,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15244
15686
  for (let i = 0; i < nodes.length; i++) {
15245
15687
  const node = nodes[i];
15246
15688
  if (isString(node)) {
15247
- push(node, -3 /* Unknown */);
15689
+ push(node, -3);
15248
15690
  } else if (isArray(node)) {
15249
15691
  genNodeListAsArray(node, context);
15250
15692
  } else {
@@ -15262,7 +15704,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15262
15704
  }
15263
15705
  function genNode(node, context) {
15264
15706
  if (isString(node)) {
15265
- context.push(node, -3 /* Unknown */);
15707
+ context.push(node, -3);
15266
15708
  return;
15267
15709
  }
15268
15710
  if (isSymbol(node)) {
@@ -15344,13 +15786,13 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15344
15786
  }
15345
15787
  }
15346
15788
  function genText(node, context) {
15347
- context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
15789
+ context.push(JSON.stringify(node.content), -3, node);
15348
15790
  }
15349
15791
  function genExpression(node, context) {
15350
15792
  const { content, isStatic } = node;
15351
15793
  context.push(
15352
15794
  isStatic ? JSON.stringify(content) : content,
15353
- -3 /* Unknown */,
15795
+ -3,
15354
15796
  node
15355
15797
  );
15356
15798
  }
@@ -15365,7 +15807,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15365
15807
  for (let i = 0; i < node.children.length; i++) {
15366
15808
  const child = node.children[i];
15367
15809
  if (isString(child)) {
15368
- context.push(child, -3 /* Unknown */);
15810
+ context.push(child, -3);
15369
15811
  } else {
15370
15812
  genNode(child, context);
15371
15813
  }
@@ -15379,9 +15821,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15379
15821
  push(`]`);
15380
15822
  } else if (node.isStatic) {
15381
15823
  const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
15382
- push(text, -2 /* None */, node);
15824
+ push(text, -2, node);
15383
15825
  } else {
15384
- push(`[${node.content}]`, -3 /* Unknown */, node);
15826
+ push(`[${node.content}]`, -3, node);
15385
15827
  }
15386
15828
  }
15387
15829
  function genComment(node, context) {
@@ -15391,7 +15833,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15391
15833
  }
15392
15834
  push(
15393
15835
  `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
15394
- -3 /* Unknown */,
15836
+ -3,
15395
15837
  node
15396
15838
  );
15397
15839
  }
@@ -15429,7 +15871,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15429
15871
  push(PURE_ANNOTATION);
15430
15872
  }
15431
15873
  const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
15432
- push(helper(callHelper) + `(`, -2 /* None */, node);
15874
+ push(helper(callHelper) + `(`, -2, node);
15433
15875
  genNodeList(
15434
15876
  genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
15435
15877
  context
@@ -15457,7 +15899,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15457
15899
  if (pure) {
15458
15900
  push(PURE_ANNOTATION);
15459
15901
  }
15460
- push(callee + `(`, -2 /* None */, node);
15902
+ push(callee + `(`, -2, node);
15461
15903
  genNodeList(node.arguments, context);
15462
15904
  push(`)`);
15463
15905
  }
@@ -15465,7 +15907,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15465
15907
  const { push, indent, deindent, newline } = context;
15466
15908
  const { properties } = node;
15467
15909
  if (!properties.length) {
15468
- push(`{}`, -2 /* None */, node);
15910
+ push(`{}`, -2, node);
15469
15911
  return;
15470
15912
  }
15471
15913
  const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
@@ -15493,7 +15935,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15493
15935
  if (isSlot) {
15494
15936
  push(`_${helperNameMap[WITH_CTX]}(`);
15495
15937
  }
15496
- push(`(`, -2 /* None */, node);
15938
+ push(`(`, -2, node);
15497
15939
  if (isArray(params)) {
15498
15940
  genNodeList(params, context);
15499
15941
  } else if (params) {
@@ -17460,7 +17902,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17460
17902
  [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17461
17903
  [61]: `v-show is missing expression.`,
17462
17904
  [62]: `<Transition> expects exactly one child element or component.`,
17463
- [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17905
+ [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
17906
+ // just to fulfill types
17907
+ [64]: ``
17464
17908
  };
17465
17909
 
17466
17910
  const transformVHtml = (dir, node, context) => {
@@ -17612,9 +18056,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17612
18056
  if (isEventOptionModifier(modifier)) {
17613
18057
  eventOptionModifiers.push(modifier);
17614
18058
  } else {
18059
+ const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
17615
18060
  if (maybeKeyModifier(modifier)) {
17616
- if (isStaticExp(key)) {
17617
- if (isKeyboardEvent(key.content.toLowerCase())) {
18061
+ if (keyString) {
18062
+ if (isKeyboardEvent(keyString.toLowerCase())) {
17618
18063
  keyModifiers.push(modifier);
17619
18064
  } else {
17620
18065
  nonKeyModifiers.push(modifier);