@vue/compat 3.5.16 → 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/compat v3.5.16
2
+ * @vue/compat v3.6.0-alpha.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -25,8 +25,10 @@ const NOOP = () => {
25
25
  const NO = () => false;
26
26
  const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
27
27
  (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
28
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
29
+ key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
28
30
  const isModelListener = (key) => key.startsWith("onUpdate:");
29
- const extend$1 = Object.assign;
31
+ const extend = Object.assign;
30
32
  const remove = (arr, el) => {
31
33
  const i = arr.indexOf(el);
32
34
  if (i > -1) {
@@ -69,10 +71,9 @@ const cacheStringFunction = (fn) => {
69
71
  };
70
72
  };
71
73
  const camelizeRE = /-(\w)/g;
74
+ const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
72
75
  const camelize = cacheStringFunction(
73
- (str) => {
74
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
75
- }
76
+ (str) => str.replace(camelizeRE, camelizeReplacer)
76
77
  );
77
78
  const hyphenateRE = /\B([A-Z])/g;
78
79
  const hyphenate = cacheStringFunction(
@@ -123,6 +124,10 @@ function genCacheKey(source, options) {
123
124
  (_, val) => typeof val === "function" ? val.toString() : val
124
125
  );
125
126
  }
127
+ function canSetValueDirectly(tagName) {
128
+ return tagName !== "PROGRESS" && // custom elements may use _value internally
129
+ !tagName.includes("-");
130
+ }
126
131
 
127
132
  const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
128
133
  const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
@@ -228,6 +233,24 @@ const isKnownSvgAttr = /* @__PURE__ */ makeMap(
228
233
  const isKnownMathMLAttr = /* @__PURE__ */ makeMap(
229
234
  `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`
230
235
  );
236
+ function shouldSetAsAttr(tagName, key) {
237
+ if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
238
+ return true;
239
+ }
240
+ if (key === "form") {
241
+ return true;
242
+ }
243
+ if (key === "list" && tagName === "INPUT") {
244
+ return true;
245
+ }
246
+ if (key === "type" && tagName === "TEXTAREA") {
247
+ return true;
248
+ }
249
+ if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
250
+ return true;
251
+ }
252
+ return false;
253
+ }
231
254
 
232
255
  const escapeRE = /["'&<>]/;
233
256
  function escapeHtml(string) {
@@ -323,7 +346,20 @@ const isRef$1 = (val) => {
323
346
  return !!(val && val["__v_isRef"] === true);
324
347
  };
325
348
  const toDisplayString = (val) => {
326
- 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);
349
+ switch (typeof val) {
350
+ case "string":
351
+ return val;
352
+ case "object":
353
+ if (val) {
354
+ if (isRef$1(val)) {
355
+ return toDisplayString(val.value);
356
+ } else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
357
+ return JSON.stringify(val, replacer, 2);
358
+ }
359
+ }
360
+ default:
361
+ return val == null ? "" : String(val);
362
+ }
327
363
  };
328
364
  const replacer = (_key, val) => {
329
365
  if (isRef$1(val)) {
@@ -358,552 +394,325 @@ const stringifySymbol = (v, i = "") => {
358
394
  );
359
395
  };
360
396
 
361
- let activeEffectScope;
362
- class EffectScope {
363
- constructor(detached = false) {
364
- this.detached = detached;
365
- /**
366
- * @internal
367
- */
368
- this._active = true;
369
- /**
370
- * @internal track `on` calls, allow `on` call multiple times
371
- */
372
- this._on = 0;
373
- /**
374
- * @internal
375
- */
376
- this.effects = [];
377
- /**
378
- * @internal
379
- */
380
- this.cleanups = [];
381
- this._isPaused = false;
382
- this.parent = activeEffectScope;
383
- if (!detached && activeEffectScope) {
384
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
385
- this
386
- ) - 1;
387
- }
388
- }
389
- get active() {
390
- return this._active;
391
- }
392
- pause() {
393
- if (this._active) {
394
- this._isPaused = true;
395
- let i, l;
396
- if (this.scopes) {
397
- for (i = 0, l = this.scopes.length; i < l; i++) {
398
- this.scopes[i].pause();
399
- }
400
- }
401
- for (i = 0, l = this.effects.length; i < l; i++) {
402
- this.effects[i].pause();
403
- }
404
- }
405
- }
406
- /**
407
- * Resumes the effect scope, including all child scopes and effects.
408
- */
409
- resume() {
410
- if (this._active) {
411
- if (this._isPaused) {
412
- this._isPaused = false;
413
- let i, l;
414
- if (this.scopes) {
415
- for (i = 0, l = this.scopes.length; i < l; i++) {
416
- this.scopes[i].resume();
417
- }
418
- }
419
- for (i = 0, l = this.effects.length; i < l; i++) {
420
- this.effects[i].resume();
421
- }
422
- }
423
- }
424
- }
425
- run(fn) {
426
- if (this._active) {
427
- const currentEffectScope = activeEffectScope;
428
- try {
429
- activeEffectScope = this;
430
- return fn();
431
- } finally {
432
- activeEffectScope = currentEffectScope;
433
- }
434
- }
435
- }
436
- /**
437
- * This should only be called on non-detached scopes
438
- * @internal
439
- */
440
- on() {
441
- if (++this._on === 1) {
442
- this.prevScope = activeEffectScope;
443
- activeEffectScope = this;
444
- }
445
- }
446
- /**
447
- * This should only be called on non-detached scopes
448
- * @internal
449
- */
450
- off() {
451
- if (this._on > 0 && --this._on === 0) {
452
- activeEffectScope = this.prevScope;
453
- this.prevScope = void 0;
454
- }
455
- }
456
- stop(fromParent) {
457
- if (this._active) {
458
- this._active = false;
459
- let i, l;
460
- for (i = 0, l = this.effects.length; i < l; i++) {
461
- this.effects[i].stop();
462
- }
463
- this.effects.length = 0;
464
- for (i = 0, l = this.cleanups.length; i < l; i++) {
465
- this.cleanups[i]();
397
+ function getSequence(arr) {
398
+ const p = arr.slice();
399
+ const result = [0];
400
+ let i, j, u, v, c;
401
+ const len = arr.length;
402
+ for (i = 0; i < len; i++) {
403
+ const arrI = arr[i];
404
+ if (arrI !== 0) {
405
+ j = result[result.length - 1];
406
+ if (arr[j] < arrI) {
407
+ p[i] = j;
408
+ result.push(i);
409
+ continue;
466
410
  }
467
- this.cleanups.length = 0;
468
- if (this.scopes) {
469
- for (i = 0, l = this.scopes.length; i < l; i++) {
470
- this.scopes[i].stop(true);
411
+ u = 0;
412
+ v = result.length - 1;
413
+ while (u < v) {
414
+ c = u + v >> 1;
415
+ if (arr[result[c]] < arrI) {
416
+ u = c + 1;
417
+ } else {
418
+ v = c;
471
419
  }
472
- this.scopes.length = 0;
473
420
  }
474
- if (!this.detached && this.parent && !fromParent) {
475
- const last = this.parent.scopes.pop();
476
- if (last && last !== this) {
477
- this.parent.scopes[this.index] = last;
478
- last.index = this.index;
421
+ if (arrI < arr[result[u]]) {
422
+ if (u > 0) {
423
+ p[i] = result[u - 1];
479
424
  }
425
+ result[u] = i;
480
426
  }
481
- this.parent = void 0;
482
427
  }
483
428
  }
484
- }
485
- function effectScope(detached) {
486
- return new EffectScope(detached);
487
- }
488
- function getCurrentScope() {
489
- return activeEffectScope;
490
- }
491
- function onScopeDispose(fn, failSilently = false) {
492
- if (activeEffectScope) {
493
- activeEffectScope.cleanups.push(fn);
429
+ u = result.length;
430
+ v = result[u - 1];
431
+ while (u-- > 0) {
432
+ result[u] = v;
433
+ v = p[v];
494
434
  }
435
+ return result;
495
436
  }
496
437
 
497
- let activeSub;
498
- const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
499
- class ReactiveEffect {
500
- constructor(fn) {
501
- this.fn = fn;
502
- /**
503
- * @internal
504
- */
505
- this.deps = void 0;
506
- /**
507
- * @internal
508
- */
509
- this.depsTail = void 0;
510
- /**
511
- * @internal
512
- */
513
- this.flags = 1 | 4;
514
- /**
515
- * @internal
516
- */
517
- this.next = void 0;
518
- /**
519
- * @internal
520
- */
521
- this.cleanup = void 0;
522
- this.scheduler = void 0;
523
- if (activeEffectScope && activeEffectScope.active) {
524
- activeEffectScope.effects.push(this);
525
- }
526
- }
527
- pause() {
528
- this.flags |= 64;
529
- }
530
- resume() {
531
- if (this.flags & 64) {
532
- this.flags &= -65;
533
- if (pausedQueueEffects.has(this)) {
534
- pausedQueueEffects.delete(this);
535
- this.trigger();
536
- }
537
- }
538
- }
539
- /**
540
- * @internal
541
- */
542
- notify() {
543
- if (this.flags & 2 && !(this.flags & 32)) {
544
- return;
545
- }
546
- if (!(this.flags & 8)) {
547
- batch(this);
548
- }
549
- }
550
- run() {
551
- if (!(this.flags & 1)) {
552
- return this.fn();
553
- }
554
- this.flags |= 2;
555
- cleanupEffect(this);
556
- prepareDeps(this);
557
- const prevEffect = activeSub;
558
- const prevShouldTrack = shouldTrack;
559
- activeSub = this;
560
- shouldTrack = true;
561
- try {
562
- return this.fn();
563
- } finally {
564
- cleanupDeps(this);
565
- activeSub = prevEffect;
566
- shouldTrack = prevShouldTrack;
567
- this.flags &= -3;
568
- }
569
- }
570
- stop() {
571
- if (this.flags & 1) {
572
- for (let link = this.deps; link; link = link.nextDep) {
573
- removeSub(link);
574
- }
575
- this.deps = this.depsTail = void 0;
576
- cleanupEffect(this);
577
- this.onStop && this.onStop();
578
- this.flags &= -2;
579
- }
580
- }
581
- trigger() {
582
- if (this.flags & 64) {
583
- pausedQueueEffects.add(this);
584
- } else if (this.scheduler) {
585
- this.scheduler();
586
- } else {
587
- this.runIfDirty();
588
- }
589
- }
590
- /**
591
- * @internal
592
- */
593
- runIfDirty() {
594
- if (isDirty(this)) {
595
- this.run();
596
- }
597
- }
598
- get dirty() {
599
- return isDirty(this);
600
- }
601
- }
438
+ var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
439
+ ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
440
+ ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
441
+ ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
442
+ ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
443
+ ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
444
+ ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
445
+ ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
446
+ return ReactiveFlags2;
447
+ })(ReactiveFlags || {});
448
+ const notifyBuffer = [];
602
449
  let batchDepth = 0;
603
- let batchedSub;
604
- let batchedComputed;
605
- function batch(sub, isComputed = false) {
606
- sub.flags |= 8;
607
- if (isComputed) {
608
- sub.next = batchedComputed;
609
- batchedComputed = sub;
610
- return;
450
+ let activeSub = void 0;
451
+ let notifyIndex = 0;
452
+ let notifyBufferLength = 0;
453
+ function setActiveSub(sub) {
454
+ try {
455
+ return activeSub;
456
+ } finally {
457
+ activeSub = sub;
611
458
  }
612
- sub.next = batchedSub;
613
- batchedSub = sub;
614
459
  }
615
460
  function startBatch() {
616
- batchDepth++;
461
+ ++batchDepth;
617
462
  }
618
463
  function endBatch() {
619
- if (--batchDepth > 0) {
620
- return;
621
- }
622
- if (batchedComputed) {
623
- let e = batchedComputed;
624
- batchedComputed = void 0;
625
- while (e) {
626
- const next = e.next;
627
- e.next = void 0;
628
- e.flags &= -9;
629
- e = next;
630
- }
631
- }
632
- let error;
633
- while (batchedSub) {
634
- let e = batchedSub;
635
- batchedSub = void 0;
636
- while (e) {
637
- const next = e.next;
638
- e.next = void 0;
639
- e.flags &= -9;
640
- if (e.flags & 1) {
641
- try {
642
- ;
643
- e.trigger();
644
- } catch (err) {
645
- if (!error) error = err;
646
- }
647
- }
648
- e = next;
649
- }
650
- }
651
- if (error) throw error;
652
- }
653
- function prepareDeps(sub) {
654
- for (let link = sub.deps; link; link = link.nextDep) {
655
- link.version = -1;
656
- link.prevActiveLink = link.dep.activeLink;
657
- link.dep.activeLink = link;
464
+ if (!--batchDepth && notifyBufferLength) {
465
+ flush();
658
466
  }
659
467
  }
660
- function cleanupDeps(sub) {
661
- let head;
662
- let tail = sub.depsTail;
663
- let link = tail;
664
- while (link) {
665
- const prev = link.prevDep;
666
- if (link.version === -1) {
667
- if (link === tail) tail = prev;
668
- removeSub(link);
669
- removeDep(link);
670
- } else {
671
- head = link;
672
- }
673
- link.dep.activeLink = link.prevActiveLink;
674
- link.prevActiveLink = void 0;
675
- link = prev;
676
- }
677
- sub.deps = head;
678
- sub.depsTail = tail;
679
- }
680
- function isDirty(sub) {
681
- for (let link = sub.deps; link; link = link.nextDep) {
682
- if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
683
- return true;
684
- }
685
- }
686
- if (sub._dirty) {
687
- return true;
688
- }
689
- return false;
690
- }
691
- function refreshComputed(computed) {
692
- if (computed.flags & 4 && !(computed.flags & 16)) {
693
- return;
694
- }
695
- computed.flags &= -17;
696
- if (computed.globalVersion === globalVersion) {
468
+ function link(dep, sub) {
469
+ const prevDep = sub.depsTail;
470
+ if (prevDep !== void 0 && prevDep.dep === dep) {
697
471
  return;
698
472
  }
699
- computed.globalVersion = globalVersion;
700
- if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
701
- return;
702
- }
703
- computed.flags |= 2;
704
- const dep = computed.dep;
705
- const prevSub = activeSub;
706
- const prevShouldTrack = shouldTrack;
707
- activeSub = computed;
708
- shouldTrack = true;
709
- try {
710
- prepareDeps(computed);
711
- const value = computed.fn(computed._value);
712
- if (dep.version === 0 || hasChanged(value, computed._value)) {
713
- computed.flags |= 128;
714
- computed._value = value;
715
- dep.version++;
473
+ let nextDep = void 0;
474
+ const recursedCheck = sub.flags & 4 /* RecursedCheck */;
475
+ if (recursedCheck) {
476
+ nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
477
+ if (nextDep !== void 0 && nextDep.dep === dep) {
478
+ sub.depsTail = nextDep;
479
+ return;
716
480
  }
717
- } catch (err) {
718
- dep.version++;
719
- throw err;
720
- } finally {
721
- activeSub = prevSub;
722
- shouldTrack = prevShouldTrack;
723
- cleanupDeps(computed);
724
- computed.flags &= -3;
725
- }
726
- }
727
- function removeSub(link, soft = false) {
728
- const { dep, prevSub, nextSub } = link;
729
- if (prevSub) {
730
- prevSub.nextSub = nextSub;
731
- link.prevSub = void 0;
732
481
  }
733
- if (nextSub) {
734
- nextSub.prevSub = prevSub;
735
- link.nextSub = void 0;
482
+ const prevSub = dep.subsTail;
483
+ const newLink = sub.depsTail = dep.subsTail = {
484
+ dep,
485
+ sub,
486
+ prevDep,
487
+ nextDep,
488
+ prevSub,
489
+ nextSub: void 0
490
+ };
491
+ if (nextDep !== void 0) {
492
+ nextDep.prevDep = newLink;
736
493
  }
737
- if (dep.subs === link) {
738
- dep.subs = prevSub;
739
- if (!prevSub && dep.computed) {
740
- dep.computed.flags &= -5;
741
- for (let l = dep.computed.deps; l; l = l.nextDep) {
742
- removeSub(l, true);
743
- }
744
- }
494
+ if (prevDep !== void 0) {
495
+ prevDep.nextDep = newLink;
496
+ } else {
497
+ sub.deps = newLink;
745
498
  }
746
- if (!soft && !--dep.sc && dep.map) {
747
- dep.map.delete(dep.key);
499
+ if (prevSub !== void 0) {
500
+ prevSub.nextSub = newLink;
501
+ } else {
502
+ dep.subs = newLink;
748
503
  }
749
504
  }
750
- function removeDep(link) {
751
- const { prevDep, nextDep } = link;
752
- if (prevDep) {
753
- prevDep.nextDep = nextDep;
754
- link.prevDep = void 0;
755
- }
756
- if (nextDep) {
505
+ function unlink(link2, sub = link2.sub) {
506
+ const dep = link2.dep;
507
+ const prevDep = link2.prevDep;
508
+ const nextDep = link2.nextDep;
509
+ const nextSub = link2.nextSub;
510
+ const prevSub = link2.prevSub;
511
+ if (nextDep !== void 0) {
757
512
  nextDep.prevDep = prevDep;
758
- link.nextDep = void 0;
759
- }
760
- }
761
- function effect(fn, options) {
762
- if (fn.effect instanceof ReactiveEffect) {
763
- fn = fn.effect.fn;
764
- }
765
- const e = new ReactiveEffect(fn);
766
- if (options) {
767
- extend$1(e, options);
768
- }
769
- try {
770
- e.run();
771
- } catch (err) {
772
- e.stop();
773
- throw err;
774
- }
775
- const runner = e.run.bind(e);
776
- runner.effect = e;
777
- return runner;
778
- }
779
- function stop(runner) {
780
- runner.effect.stop();
781
- }
782
- let shouldTrack = true;
783
- const trackStack = [];
784
- function pauseTracking() {
785
- trackStack.push(shouldTrack);
786
- shouldTrack = false;
787
- }
788
- function resetTracking() {
789
- const last = trackStack.pop();
790
- shouldTrack = last === void 0 ? true : last;
791
- }
792
- function cleanupEffect(e) {
793
- const { cleanup } = e;
794
- e.cleanup = void 0;
795
- if (cleanup) {
796
- const prevSub = activeSub;
797
- activeSub = void 0;
798
- try {
799
- cleanup();
800
- } finally {
801
- activeSub = prevSub;
802
- }
513
+ } else {
514
+ sub.depsTail = prevDep;
803
515
  }
804
- }
805
-
806
- let globalVersion = 0;
807
- class Link {
808
- constructor(sub, dep) {
809
- this.sub = sub;
810
- this.dep = dep;
811
- this.version = dep.version;
812
- this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
516
+ if (prevDep !== void 0) {
517
+ prevDep.nextDep = nextDep;
518
+ } else {
519
+ sub.deps = nextDep;
813
520
  }
814
- }
815
- class Dep {
816
- constructor(computed) {
817
- this.computed = computed;
818
- this.version = 0;
819
- /**
820
- * Link between this dep and the current active effect
821
- */
822
- this.activeLink = void 0;
823
- /**
824
- * Doubly linked list representing the subscribing effects (tail)
825
- */
826
- this.subs = void 0;
827
- /**
828
- * For object property deps cleanup
829
- */
830
- this.map = void 0;
831
- this.key = void 0;
832
- /**
833
- * Subscriber counter
834
- */
835
- this.sc = 0;
521
+ if (nextSub !== void 0) {
522
+ nextSub.prevSub = prevSub;
523
+ } else {
524
+ dep.subsTail = prevSub;
836
525
  }
837
- track(debugInfo) {
838
- if (!activeSub || !shouldTrack || activeSub === this.computed) {
839
- return;
840
- }
841
- let link = this.activeLink;
842
- if (link === void 0 || link.sub !== activeSub) {
843
- link = this.activeLink = new Link(activeSub, this);
844
- if (!activeSub.deps) {
845
- activeSub.deps = activeSub.depsTail = link;
526
+ if (prevSub !== void 0) {
527
+ prevSub.nextSub = nextSub;
528
+ } else if ((dep.subs = nextSub) === void 0) {
529
+ let toRemove = dep.deps;
530
+ if (toRemove !== void 0) {
531
+ do {
532
+ toRemove = unlink(toRemove, dep);
533
+ } while (toRemove !== void 0);
534
+ dep.flags |= 16 /* Dirty */;
535
+ }
536
+ }
537
+ return nextDep;
538
+ }
539
+ function propagate(link2) {
540
+ let next = link2.nextSub;
541
+ let stack;
542
+ top: do {
543
+ const sub = link2.sub;
544
+ let flags = sub.flags;
545
+ if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
546
+ if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
547
+ sub.flags = flags | 32 /* Pending */;
548
+ } else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
549
+ flags = 0 /* None */;
550
+ } else if (!(flags & 4 /* RecursedCheck */)) {
551
+ sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
552
+ } else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
553
+ sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
554
+ flags &= 1 /* Mutable */;
846
555
  } else {
847
- link.prevDep = activeSub.depsTail;
848
- activeSub.depsTail.nextDep = link;
849
- activeSub.depsTail = link;
850
- }
851
- addSub(link);
852
- } else if (link.version === -1) {
853
- link.version = this.version;
854
- if (link.nextDep) {
855
- const next = link.nextDep;
856
- next.prevDep = link.prevDep;
857
- if (link.prevDep) {
858
- link.prevDep.nextDep = next;
859
- }
860
- link.prevDep = activeSub.depsTail;
861
- link.nextDep = void 0;
862
- activeSub.depsTail.nextDep = link;
863
- activeSub.depsTail = link;
864
- if (activeSub.deps === link) {
865
- activeSub.deps = next;
556
+ flags = 0 /* None */;
557
+ }
558
+ if (flags & 2 /* Watching */) {
559
+ notifyBuffer[notifyBufferLength++] = sub;
560
+ }
561
+ if (flags & 1 /* Mutable */) {
562
+ const subSubs = sub.subs;
563
+ if (subSubs !== void 0) {
564
+ link2 = subSubs;
565
+ if (subSubs.nextSub !== void 0) {
566
+ stack = { value: next, prev: stack };
567
+ next = link2.nextSub;
568
+ }
569
+ continue;
866
570
  }
867
571
  }
868
572
  }
869
- return link;
870
- }
871
- trigger(debugInfo) {
872
- this.version++;
873
- globalVersion++;
874
- this.notify(debugInfo);
875
- }
876
- notify(debugInfo) {
877
- startBatch();
878
- try {
879
- if (false) ;
880
- for (let link = this.subs; link; link = link.prevSub) {
881
- if (link.sub.notify()) {
882
- ;
883
- link.sub.dep.notify();
573
+ if ((link2 = next) !== void 0) {
574
+ next = link2.nextSub;
575
+ continue;
576
+ }
577
+ while (stack !== void 0) {
578
+ link2 = stack.value;
579
+ stack = stack.prev;
580
+ if (link2 !== void 0) {
581
+ next = link2.nextSub;
582
+ continue top;
583
+ }
584
+ }
585
+ break;
586
+ } while (true);
587
+ }
588
+ function startTracking(sub) {
589
+ sub.depsTail = void 0;
590
+ sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
591
+ return setActiveSub(sub);
592
+ }
593
+ function endTracking(sub, prevSub) {
594
+ activeSub = prevSub;
595
+ const depsTail = sub.depsTail;
596
+ let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
597
+ while (toRemove !== void 0) {
598
+ toRemove = unlink(toRemove, sub);
599
+ }
600
+ sub.flags &= -5 /* RecursedCheck */;
601
+ }
602
+ function flush() {
603
+ while (notifyIndex < notifyBufferLength) {
604
+ const effect = notifyBuffer[notifyIndex];
605
+ notifyBuffer[notifyIndex++] = void 0;
606
+ effect.notify();
607
+ }
608
+ notifyIndex = 0;
609
+ notifyBufferLength = 0;
610
+ }
611
+ function checkDirty(link2, sub) {
612
+ let stack;
613
+ let checkDepth = 0;
614
+ top: do {
615
+ const dep = link2.dep;
616
+ const depFlags = dep.flags;
617
+ let dirty = false;
618
+ if (sub.flags & 16 /* Dirty */) {
619
+ dirty = true;
620
+ } else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
621
+ if (dep.update()) {
622
+ const subs = dep.subs;
623
+ if (subs.nextSub !== void 0) {
624
+ shallowPropagate(subs);
625
+ }
626
+ dirty = true;
627
+ }
628
+ } else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
629
+ if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
630
+ stack = { value: link2, prev: stack };
631
+ }
632
+ link2 = dep.deps;
633
+ sub = dep;
634
+ ++checkDepth;
635
+ continue;
636
+ }
637
+ if (!dirty && link2.nextDep !== void 0) {
638
+ link2 = link2.nextDep;
639
+ continue;
640
+ }
641
+ while (checkDepth) {
642
+ --checkDepth;
643
+ const firstSub = sub.subs;
644
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
645
+ if (hasMultipleSubs) {
646
+ link2 = stack.value;
647
+ stack = stack.prev;
648
+ } else {
649
+ link2 = firstSub;
650
+ }
651
+ if (dirty) {
652
+ if (sub.update()) {
653
+ if (hasMultipleSubs) {
654
+ shallowPropagate(firstSub);
655
+ }
656
+ sub = link2.sub;
657
+ continue;
884
658
  }
659
+ } else {
660
+ sub.flags &= -33 /* Pending */;
661
+ }
662
+ sub = link2.sub;
663
+ if (link2.nextDep !== void 0) {
664
+ link2 = link2.nextDep;
665
+ continue top;
666
+ }
667
+ dirty = false;
668
+ }
669
+ return dirty;
670
+ } while (true);
671
+ }
672
+ function shallowPropagate(link2) {
673
+ do {
674
+ const sub = link2.sub;
675
+ const nextSub = link2.nextSub;
676
+ const subFlags = sub.flags;
677
+ if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
678
+ sub.flags = subFlags | 16 /* Dirty */;
679
+ }
680
+ link2 = nextSub;
681
+ } while (link2 !== void 0);
682
+ }
683
+ function isValidLink(checkLink, sub) {
684
+ const depsTail = sub.depsTail;
685
+ if (depsTail !== void 0) {
686
+ let link2 = sub.deps;
687
+ do {
688
+ if (link2 === checkLink) {
689
+ return true;
885
690
  }
886
- } finally {
887
- endBatch();
888
- }
691
+ if (link2 === depsTail) {
692
+ break;
693
+ }
694
+ link2 = link2.nextDep;
695
+ } while (link2 !== void 0);
889
696
  }
697
+ return false;
890
698
  }
891
- function addSub(link) {
892
- link.dep.sc++;
893
- if (link.sub.flags & 4) {
894
- const computed = link.dep.computed;
895
- if (computed && !link.dep.subs) {
896
- computed.flags |= 4 | 16;
897
- for (let l = computed.deps; l; l = l.nextDep) {
898
- addSub(l);
899
- }
900
- }
901
- const currentTail = link.dep.subs;
902
- if (currentTail !== link) {
903
- link.prevSub = currentTail;
904
- if (currentTail) currentTail.nextSub = link;
699
+
700
+ class Dep {
701
+ constructor(map, key) {
702
+ this.map = map;
703
+ this.key = key;
704
+ this._subs = void 0;
705
+ this.subsTail = void 0;
706
+ this.flags = ReactiveFlags.None;
707
+ }
708
+ get subs() {
709
+ return this._subs;
710
+ }
711
+ set subs(value) {
712
+ this._subs = value;
713
+ if (value === void 0) {
714
+ this.map.delete(this.key);
905
715
  }
906
- link.dep.subs = link;
907
716
  }
908
717
  }
909
718
  const targetMap = /* @__PURE__ */ new WeakMap();
@@ -917,33 +726,27 @@ const ARRAY_ITERATE_KEY = Symbol(
917
726
  ""
918
727
  );
919
728
  function track(target, type, key) {
920
- if (shouldTrack && activeSub) {
729
+ if (activeSub !== void 0) {
921
730
  let depsMap = targetMap.get(target);
922
731
  if (!depsMap) {
923
732
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
924
733
  }
925
734
  let dep = depsMap.get(key);
926
735
  if (!dep) {
927
- depsMap.set(key, dep = new Dep());
928
- dep.map = depsMap;
929
- dep.key = key;
930
- }
931
- {
932
- dep.track();
736
+ depsMap.set(key, dep = new Dep(depsMap, key));
933
737
  }
738
+ link(dep, activeSub);
934
739
  }
935
740
  }
936
741
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
937
742
  const depsMap = targetMap.get(target);
938
743
  if (!depsMap) {
939
- globalVersion++;
940
744
  return;
941
745
  }
942
746
  const run = (dep) => {
943
- if (dep) {
944
- {
945
- dep.trigger();
946
- }
747
+ if (dep !== void 0 && dep.subs !== void 0) {
748
+ propagate(dep.subs);
749
+ shallowPropagate(dep.subs);
947
750
  }
948
751
  };
949
752
  startBatch();
@@ -1168,11 +971,11 @@ function searchProxy(self, method, args) {
1168
971
  return res;
1169
972
  }
1170
973
  function noTracking(self, method, args = []) {
1171
- pauseTracking();
1172
974
  startBatch();
975
+ const prevSub = setActiveSub();
1173
976
  const res = toRaw(self)[method].apply(self, args);
977
+ setActiveSub(prevSub);
1174
978
  endBatch();
1175
- resetTracking();
1176
979
  return res;
1177
980
  }
1178
981
 
@@ -1218,14 +1021,18 @@ class BaseReactiveHandler {
1218
1021
  return hasOwnProperty;
1219
1022
  }
1220
1023
  }
1024
+ const wasRef = isRef(target);
1221
1025
  const res = Reflect.get(
1222
1026
  target,
1223
1027
  key,
1224
1028
  // if this is a proxy wrapping a ref, return methods using the raw ref
1225
1029
  // as receiver so that we don't have to call `toRaw` on the ref in all
1226
1030
  // its class methods
1227
- isRef(target) ? target : receiver
1031
+ wasRef ? target : receiver
1228
1032
  );
1033
+ if (wasRef && key !== "value") {
1034
+ return res;
1035
+ }
1229
1036
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1230
1037
  return res;
1231
1038
  }
@@ -1409,7 +1216,7 @@ function createInstrumentations(readonly, shallow) {
1409
1216
  });
1410
1217
  }
1411
1218
  };
1412
- extend$1(
1219
+ extend(
1413
1220
  instrumentations,
1414
1221
  readonly ? {
1415
1222
  add: createReadonlyMethod("add"),
@@ -1635,29 +1442,47 @@ function isRef(r) {
1635
1442
  return r ? r["__v_isRef"] === true : false;
1636
1443
  }
1637
1444
  function ref(value) {
1638
- return createRef(value, false);
1445
+ return createRef(value, toReactive);
1639
1446
  }
1640
1447
  function shallowRef(value) {
1641
- return createRef(value, true);
1448
+ return createRef(value);
1642
1449
  }
1643
- function createRef(rawValue, shallow) {
1450
+ function createRef(rawValue, wrap) {
1644
1451
  if (isRef(rawValue)) {
1645
1452
  return rawValue;
1646
1453
  }
1647
- return new RefImpl(rawValue, shallow);
1454
+ return new RefImpl(rawValue, wrap);
1648
1455
  }
1649
1456
  class RefImpl {
1650
- constructor(value, isShallow2) {
1651
- this.dep = new Dep();
1652
- this["__v_isRef"] = true;
1653
- this["__v_isShallow"] = false;
1654
- this._rawValue = isShallow2 ? value : toRaw(value);
1655
- this._value = isShallow2 ? value : toReactive(value);
1656
- this["__v_isShallow"] = isShallow2;
1457
+ // TODO isolatedDeclarations "__v_isShallow"
1458
+ constructor(value, wrap) {
1459
+ this.subs = void 0;
1460
+ this.subsTail = void 0;
1461
+ this.flags = ReactiveFlags.Mutable;
1462
+ /**
1463
+ * @internal
1464
+ */
1465
+ this.__v_isRef = true;
1466
+ // TODO isolatedDeclarations "__v_isRef"
1467
+ /**
1468
+ * @internal
1469
+ */
1470
+ this.__v_isShallow = false;
1471
+ this._oldValue = this._rawValue = wrap ? toRaw(value) : value;
1472
+ this._value = wrap ? wrap(value) : value;
1473
+ this._wrap = wrap;
1474
+ this["__v_isShallow"] = !wrap;
1475
+ }
1476
+ get dep() {
1477
+ return this;
1657
1478
  }
1658
1479
  get value() {
1659
- {
1660
- this.dep.track();
1480
+ trackRef(this);
1481
+ if (this.flags & ReactiveFlags.Dirty && this.update()) {
1482
+ const subs = this.subs;
1483
+ if (subs !== void 0) {
1484
+ shallowPropagate(subs);
1485
+ }
1661
1486
  }
1662
1487
  return this._value;
1663
1488
  }
@@ -1666,21 +1491,38 @@ class RefImpl {
1666
1491
  const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1667
1492
  newValue = useDirectValue ? newValue : toRaw(newValue);
1668
1493
  if (hasChanged(newValue, oldValue)) {
1494
+ this.flags |= ReactiveFlags.Dirty;
1669
1495
  this._rawValue = newValue;
1670
- this._value = useDirectValue ? newValue : toReactive(newValue);
1671
- {
1672
- this.dep.trigger();
1496
+ this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
1497
+ const subs = this.subs;
1498
+ if (subs !== void 0) {
1499
+ propagate(subs);
1500
+ if (!batchDepth) {
1501
+ flush();
1502
+ }
1673
1503
  }
1674
1504
  }
1675
1505
  }
1506
+ update() {
1507
+ this.flags &= ~ReactiveFlags.Dirty;
1508
+ return hasChanged(this._oldValue, this._oldValue = this._rawValue);
1509
+ }
1676
1510
  }
1677
1511
  function triggerRef(ref2) {
1678
- if (ref2.dep) {
1679
- {
1680
- ref2.dep.trigger();
1512
+ const dep = ref2.dep;
1513
+ if (dep !== void 0 && dep.subs !== void 0) {
1514
+ propagate(dep.subs);
1515
+ shallowPropagate(dep.subs);
1516
+ if (!batchDepth) {
1517
+ flush();
1681
1518
  }
1682
1519
  }
1683
1520
  }
1521
+ function trackRef(dep) {
1522
+ if (activeSub !== void 0) {
1523
+ link(dep, activeSub);
1524
+ }
1525
+ }
1684
1526
  function unref(ref2) {
1685
1527
  return isRef(ref2) ? ref2.value : ref2;
1686
1528
  }
@@ -1704,13 +1546,21 @@ function proxyRefs(objectWithRefs) {
1704
1546
  }
1705
1547
  class CustomRefImpl {
1706
1548
  constructor(factory) {
1549
+ this.subs = void 0;
1550
+ this.subsTail = void 0;
1551
+ this.flags = ReactiveFlags.None;
1707
1552
  this["__v_isRef"] = true;
1708
1553
  this._value = void 0;
1709
- const dep = this.dep = new Dep();
1710
- const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1554
+ const { get, set } = factory(
1555
+ () => trackRef(this),
1556
+ () => triggerRef(this)
1557
+ );
1711
1558
  this._get = get;
1712
1559
  this._set = set;
1713
1560
  }
1561
+ get dep() {
1562
+ return this;
1563
+ }
1714
1564
  get value() {
1715
1565
  return this._value = this._get();
1716
1566
  }
@@ -1774,65 +1624,317 @@ function propertyToRef(source, key, defaultValue) {
1774
1624
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1775
1625
  }
1776
1626
 
1777
- class ComputedRefImpl {
1778
- constructor(fn, setter, isSSR) {
1779
- this.fn = fn;
1780
- this.setter = setter;
1781
- /**
1782
- * @internal
1783
- */
1784
- this._value = void 0;
1785
- /**
1786
- * @internal
1787
- */
1788
- this.dep = new Dep(this);
1627
+ class ReactiveEffect {
1628
+ constructor(fn) {
1629
+ this.deps = void 0;
1630
+ this.depsTail = void 0;
1631
+ this.subs = void 0;
1632
+ this.subsTail = void 0;
1633
+ this.flags = ReactiveFlags.Watching | ReactiveFlags.Dirty;
1789
1634
  /**
1790
1635
  * @internal
1791
1636
  */
1792
- this.__v_isRef = true;
1793
- // TODO isolatedDeclarations "__v_isReadonly"
1794
- // A computed is also a subscriber that tracks other deps
1637
+ this.cleanups = [];
1795
1638
  /**
1796
1639
  * @internal
1797
1640
  */
1641
+ this.cleanupsLength = 0;
1642
+ if (fn !== void 0) {
1643
+ this.fn = fn;
1644
+ }
1645
+ if (activeEffectScope) {
1646
+ link(this, activeEffectScope);
1647
+ }
1648
+ }
1649
+ // @ts-expect-error
1650
+ fn() {
1651
+ }
1652
+ get active() {
1653
+ return !(this.flags & 1024);
1654
+ }
1655
+ pause() {
1656
+ this.flags |= 256;
1657
+ }
1658
+ resume() {
1659
+ const flags = this.flags &= -257;
1660
+ if (flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) {
1661
+ this.notify();
1662
+ }
1663
+ }
1664
+ notify() {
1665
+ if (!(this.flags & 256) && this.dirty) {
1666
+ this.run();
1667
+ }
1668
+ }
1669
+ run() {
1670
+ if (!this.active) {
1671
+ return this.fn();
1672
+ }
1673
+ cleanup(this);
1674
+ const prevSub = startTracking(this);
1675
+ try {
1676
+ return this.fn();
1677
+ } finally {
1678
+ endTracking(this, prevSub);
1679
+ const flags = this.flags;
1680
+ if ((flags & (ReactiveFlags.Recursed | 128)) === (ReactiveFlags.Recursed | 128)) {
1681
+ this.flags = flags & ~ReactiveFlags.Recursed;
1682
+ this.notify();
1683
+ }
1684
+ }
1685
+ }
1686
+ stop() {
1687
+ if (!this.active) {
1688
+ return;
1689
+ }
1690
+ this.flags = 1024;
1691
+ let dep = this.deps;
1692
+ while (dep !== void 0) {
1693
+ dep = unlink(dep, this);
1694
+ }
1695
+ const sub = this.subs;
1696
+ if (sub !== void 0) {
1697
+ unlink(sub);
1698
+ }
1699
+ cleanup(this);
1700
+ }
1701
+ get dirty() {
1702
+ const flags = this.flags;
1703
+ if (flags & ReactiveFlags.Dirty) {
1704
+ return true;
1705
+ }
1706
+ if (flags & ReactiveFlags.Pending) {
1707
+ if (checkDirty(this.deps, this)) {
1708
+ this.flags = flags | ReactiveFlags.Dirty;
1709
+ return true;
1710
+ } else {
1711
+ this.flags = flags & ~ReactiveFlags.Pending;
1712
+ }
1713
+ }
1714
+ return false;
1715
+ }
1716
+ }
1717
+ function effect(fn, options) {
1718
+ if (fn.effect instanceof ReactiveEffect) {
1719
+ fn = fn.effect.fn;
1720
+ }
1721
+ const e = new ReactiveEffect(fn);
1722
+ if (options) {
1723
+ const { onStop, scheduler } = options;
1724
+ if (onStop) {
1725
+ options.onStop = void 0;
1726
+ const stop2 = e.stop.bind(e);
1727
+ e.stop = () => {
1728
+ stop2();
1729
+ onStop();
1730
+ };
1731
+ }
1732
+ if (scheduler) {
1733
+ options.scheduler = void 0;
1734
+ e.notify = () => {
1735
+ if (!(e.flags & 256)) {
1736
+ scheduler();
1737
+ }
1738
+ };
1739
+ }
1740
+ extend(e, options);
1741
+ }
1742
+ try {
1743
+ e.run();
1744
+ } catch (err) {
1745
+ e.stop();
1746
+ throw err;
1747
+ }
1748
+ const runner = e.run.bind(e);
1749
+ runner.effect = e;
1750
+ return runner;
1751
+ }
1752
+ function stop(runner) {
1753
+ runner.effect.stop();
1754
+ }
1755
+ function cleanup(sub) {
1756
+ const l = sub.cleanupsLength;
1757
+ if (l) {
1758
+ for (let i = 0; i < l; i++) {
1759
+ sub.cleanups[i]();
1760
+ }
1761
+ sub.cleanupsLength = 0;
1762
+ }
1763
+ }
1764
+
1765
+ let activeEffectScope;
1766
+ class EffectScope {
1767
+ constructor(detached = false) {
1798
1768
  this.deps = void 0;
1769
+ this.depsTail = void 0;
1770
+ this.subs = void 0;
1771
+ this.subsTail = void 0;
1772
+ this.flags = 0;
1799
1773
  /**
1800
1774
  * @internal
1801
1775
  */
1802
- this.depsTail = void 0;
1776
+ this.cleanups = [];
1803
1777
  /**
1804
1778
  * @internal
1805
1779
  */
1806
- this.flags = 16;
1780
+ this.cleanupsLength = 0;
1781
+ if (!detached && activeEffectScope) {
1782
+ link(this, activeEffectScope);
1783
+ }
1784
+ }
1785
+ get active() {
1786
+ return !(this.flags & 1024);
1787
+ }
1788
+ pause() {
1789
+ if (!(this.flags & 256)) {
1790
+ this.flags |= 256;
1791
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1792
+ const dep = link2.dep;
1793
+ if ("pause" in dep) {
1794
+ dep.pause();
1795
+ }
1796
+ }
1797
+ }
1798
+ }
1799
+ /**
1800
+ * Resumes the effect scope, including all child scopes and effects.
1801
+ */
1802
+ resume() {
1803
+ const flags = this.flags;
1804
+ if (flags & 256) {
1805
+ this.flags = flags & -257;
1806
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1807
+ const dep = link2.dep;
1808
+ if ("resume" in dep) {
1809
+ dep.resume();
1810
+ }
1811
+ }
1812
+ }
1813
+ }
1814
+ run(fn) {
1815
+ const prevScope = activeEffectScope;
1816
+ try {
1817
+ activeEffectScope = this;
1818
+ return fn();
1819
+ } finally {
1820
+ activeEffectScope = prevScope;
1821
+ }
1822
+ }
1823
+ stop() {
1824
+ if (!this.active) {
1825
+ return;
1826
+ }
1827
+ this.flags = 1024;
1828
+ let dep = this.deps;
1829
+ while (dep !== void 0) {
1830
+ const node = dep.dep;
1831
+ if ("stop" in node) {
1832
+ dep = dep.nextDep;
1833
+ node.stop();
1834
+ } else {
1835
+ dep = unlink(dep, this);
1836
+ }
1837
+ }
1838
+ const sub = this.subs;
1839
+ if (sub !== void 0) {
1840
+ unlink(sub);
1841
+ }
1842
+ cleanup(this);
1843
+ }
1844
+ }
1845
+ function effectScope(detached) {
1846
+ return new EffectScope(detached);
1847
+ }
1848
+ function getCurrentScope() {
1849
+ return activeEffectScope;
1850
+ }
1851
+ function setCurrentScope(scope) {
1852
+ try {
1853
+ return activeEffectScope;
1854
+ } finally {
1855
+ activeEffectScope = scope;
1856
+ }
1857
+ }
1858
+ function onScopeDispose(fn, failSilently = false) {
1859
+ if (activeEffectScope !== void 0) {
1860
+ activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
1861
+ }
1862
+ }
1863
+
1864
+ class ComputedRefImpl {
1865
+ constructor(fn, setter) {
1866
+ this.fn = fn;
1867
+ this.setter = setter;
1807
1868
  /**
1808
1869
  * @internal
1809
1870
  */
1810
- this.globalVersion = globalVersion - 1;
1871
+ this._value = void 0;
1872
+ this.subs = void 0;
1873
+ this.subsTail = void 0;
1874
+ this.deps = void 0;
1875
+ this.depsTail = void 0;
1876
+ this.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
1811
1877
  /**
1812
1878
  * @internal
1813
1879
  */
1814
- this.next = void 0;
1815
- // for backwards compat
1816
- this.effect = this;
1880
+ this.__v_isRef = true;
1817
1881
  this["__v_isReadonly"] = !setter;
1818
- this.isSSR = isSSR;
1882
+ }
1883
+ // TODO isolatedDeclarations "__v_isReadonly"
1884
+ // for backwards compat
1885
+ get effect() {
1886
+ return this;
1887
+ }
1888
+ // for backwards compat
1889
+ get dep() {
1890
+ return this;
1819
1891
  }
1820
1892
  /**
1821
1893
  * @internal
1894
+ * for backwards compat
1822
1895
  */
1823
- notify() {
1824
- this.flags |= 16;
1825
- if (!(this.flags & 8) && // avoid infinite self recursion
1826
- activeSub !== this) {
1827
- batch(this, true);
1896
+ get _dirty() {
1897
+ const flags = this.flags;
1898
+ if (flags & ReactiveFlags.Dirty) {
1828
1899
  return true;
1829
1900
  }
1901
+ if (flags & ReactiveFlags.Pending) {
1902
+ if (checkDirty(this.deps, this)) {
1903
+ this.flags = flags | ReactiveFlags.Dirty;
1904
+ return true;
1905
+ } else {
1906
+ this.flags = flags & ~ReactiveFlags.Pending;
1907
+ }
1908
+ }
1909
+ return false;
1910
+ }
1911
+ /**
1912
+ * @internal
1913
+ * for backwards compat
1914
+ */
1915
+ set _dirty(v) {
1916
+ if (v) {
1917
+ this.flags |= ReactiveFlags.Dirty;
1918
+ } else {
1919
+ this.flags &= ~(ReactiveFlags.Dirty | ReactiveFlags.Pending);
1920
+ }
1830
1921
  }
1831
1922
  get value() {
1832
- const link = this.dep.track();
1833
- refreshComputed(this);
1834
- if (link) {
1835
- link.version = this.dep.version;
1923
+ const flags = this.flags;
1924
+ if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) {
1925
+ if (this.update()) {
1926
+ const subs = this.subs;
1927
+ if (subs !== void 0) {
1928
+ shallowPropagate(subs);
1929
+ }
1930
+ }
1931
+ } else if (flags & ReactiveFlags.Pending) {
1932
+ this.flags = flags & ~ReactiveFlags.Pending;
1933
+ }
1934
+ if (activeSub !== void 0) {
1935
+ link(this, activeSub);
1936
+ } else if (activeEffectScope !== void 0) {
1937
+ link(this, activeEffectScope);
1836
1938
  }
1837
1939
  return this._value;
1838
1940
  }
@@ -1841,6 +1943,20 @@ class ComputedRefImpl {
1841
1943
  this.setter(newValue);
1842
1944
  }
1843
1945
  }
1946
+ update() {
1947
+ const prevSub = startTracking(this);
1948
+ try {
1949
+ const oldValue = this._value;
1950
+ const newValue = this.fn(oldValue);
1951
+ if (hasChanged(oldValue, newValue)) {
1952
+ this._value = newValue;
1953
+ return true;
1954
+ }
1955
+ return false;
1956
+ } finally {
1957
+ endTracking(this, prevSub);
1958
+ }
1959
+ }
1844
1960
  }
1845
1961
  function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1846
1962
  let getter;
@@ -1851,7 +1967,7 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1851
1967
  getter = getterOrOptions.get;
1852
1968
  setter = getterOrOptions.set;
1853
1969
  }
1854
- const cRef = new ComputedRefImpl(getter, setter, isSSR);
1970
+ const cRef = new ComputedRefImpl(getter, setter);
1855
1971
  return cRef;
1856
1972
  }
1857
1973
 
@@ -1868,159 +1984,128 @@ const TriggerOpTypes = {
1868
1984
  };
1869
1985
 
1870
1986
  const INITIAL_WATCHER_VALUE = {};
1871
- const cleanupMap = /* @__PURE__ */ new WeakMap();
1872
1987
  let activeWatcher = void 0;
1873
1988
  function getCurrentWatcher() {
1874
1989
  return activeWatcher;
1875
1990
  }
1876
1991
  function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1877
1992
  if (owner) {
1878
- let cleanups = cleanupMap.get(owner);
1879
- if (!cleanups) cleanupMap.set(owner, cleanups = []);
1880
- cleanups.push(cleanupFn);
1881
- }
1882
- }
1883
- function watch$1(source, cb, options = EMPTY_OBJ) {
1884
- const { immediate, deep, once, scheduler, augmentJob, call } = options;
1885
- const reactiveGetter = (source2) => {
1886
- if (deep) return source2;
1887
- if (isShallow(source2) || deep === false || deep === 0)
1888
- return traverse(source2, 1);
1889
- return traverse(source2);
1890
- };
1891
- let effect;
1892
- let getter;
1893
- let cleanup;
1894
- let boundCleanup;
1895
- let forceTrigger = false;
1896
- let isMultiSource = false;
1897
- if (isRef(source)) {
1898
- getter = () => source.value;
1899
- forceTrigger = isShallow(source);
1900
- } else if (isReactive(source)) {
1901
- getter = () => reactiveGetter(source);
1902
- forceTrigger = true;
1903
- } else if (isArray(source)) {
1904
- isMultiSource = true;
1905
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1906
- getter = () => source.map((s) => {
1907
- if (isRef(s)) {
1908
- return s.value;
1909
- } else if (isReactive(s)) {
1910
- return reactiveGetter(s);
1911
- } else if (isFunction(s)) {
1912
- return call ? call(s, 2) : s();
1913
- } else ;
1914
- });
1915
- } else if (isFunction(source)) {
1916
- if (cb) {
1917
- getter = call ? () => call(source, 2) : source;
1993
+ const { call } = owner.options;
1994
+ if (call) {
1995
+ owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
1918
1996
  } else {
1919
- getter = () => {
1920
- if (cleanup) {
1921
- pauseTracking();
1997
+ owner.cleanups[owner.cleanupsLength++] = cleanupFn;
1998
+ }
1999
+ }
2000
+ }
2001
+ class WatcherEffect extends ReactiveEffect {
2002
+ constructor(source, cb, options = EMPTY_OBJ) {
2003
+ const { deep, once, call, onWarn } = options;
2004
+ let getter;
2005
+ let forceTrigger = false;
2006
+ let isMultiSource = false;
2007
+ if (isRef(source)) {
2008
+ getter = () => source.value;
2009
+ forceTrigger = isShallow(source);
2010
+ } else if (isReactive(source)) {
2011
+ getter = () => reactiveGetter(source, deep);
2012
+ forceTrigger = true;
2013
+ } else if (isArray(source)) {
2014
+ isMultiSource = true;
2015
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
2016
+ getter = () => source.map((s) => {
2017
+ if (isRef(s)) {
2018
+ return s.value;
2019
+ } else if (isReactive(s)) {
2020
+ return reactiveGetter(s, deep);
2021
+ } else if (isFunction(s)) {
2022
+ return call ? call(s, 2) : s();
2023
+ } else ;
2024
+ });
2025
+ } else if (isFunction(source)) {
2026
+ if (cb) {
2027
+ getter = call ? () => call(source, 2) : source;
2028
+ } else {
2029
+ getter = () => {
2030
+ if (this.cleanupsLength) {
2031
+ const prevSub = setActiveSub();
2032
+ try {
2033
+ cleanup(this);
2034
+ } finally {
2035
+ setActiveSub(prevSub);
2036
+ }
2037
+ }
2038
+ const currentEffect = activeWatcher;
2039
+ activeWatcher = this;
1922
2040
  try {
1923
- cleanup();
2041
+ return call ? call(source, 3, [
2042
+ this.boundCleanup
2043
+ ]) : source(this.boundCleanup);
1924
2044
  } finally {
1925
- resetTracking();
1926
- }
1927
- }
1928
- const currentEffect = activeWatcher;
1929
- activeWatcher = effect;
1930
- try {
1931
- return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
1932
- } finally {
1933
- activeWatcher = currentEffect;
1934
- }
2045
+ activeWatcher = currentEffect;
2046
+ }
2047
+ };
2048
+ }
2049
+ } else {
2050
+ getter = NOOP;
2051
+ }
2052
+ if (cb && deep) {
2053
+ const baseGetter = getter;
2054
+ const depth = deep === true ? Infinity : deep;
2055
+ getter = () => traverse(baseGetter(), depth);
2056
+ }
2057
+ super(getter);
2058
+ this.cb = cb;
2059
+ this.options = options;
2060
+ this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
2061
+ this.forceTrigger = forceTrigger;
2062
+ this.isMultiSource = isMultiSource;
2063
+ if (once && cb) {
2064
+ const _cb = cb;
2065
+ cb = (...args) => {
2066
+ _cb(...args);
2067
+ this.stop();
1935
2068
  };
1936
2069
  }
1937
- } else {
1938
- getter = NOOP;
1939
- }
1940
- if (cb && deep) {
1941
- const baseGetter = getter;
1942
- const depth = deep === true ? Infinity : deep;
1943
- getter = () => traverse(baseGetter(), depth);
1944
- }
1945
- const scope = getCurrentScope();
1946
- const watchHandle = () => {
1947
- effect.stop();
1948
- if (scope && scope.active) {
1949
- remove(scope.effects, effect);
1950
- }
1951
- };
1952
- if (once && cb) {
1953
- const _cb = cb;
1954
- cb = (...args) => {
1955
- _cb(...args);
1956
- watchHandle();
1957
- };
2070
+ this.cb = cb;
2071
+ this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1958
2072
  }
1959
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1960
- const job = (immediateFirstRun) => {
1961
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2073
+ run(initialRun = false) {
2074
+ const oldValue = this.oldValue;
2075
+ const newValue = this.oldValue = super.run();
2076
+ if (!this.cb) {
1962
2077
  return;
1963
2078
  }
1964
- if (cb) {
1965
- const newValue = effect.run();
1966
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1967
- if (cleanup) {
1968
- cleanup();
1969
- }
1970
- const currentWatcher = activeWatcher;
1971
- activeWatcher = effect;
1972
- try {
1973
- const args = [
1974
- newValue,
1975
- // pass undefined as the old value when it's changed for the first time
1976
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1977
- boundCleanup
1978
- ];
1979
- oldValue = newValue;
1980
- call ? call(cb, 3, args) : (
1981
- // @ts-expect-error
1982
- cb(...args)
1983
- );
1984
- } finally {
1985
- activeWatcher = currentWatcher;
1986
- }
1987
- }
1988
- } else {
1989
- effect.run();
2079
+ const { immediate, deep, call } = this.options;
2080
+ if (initialRun && !immediate) {
2081
+ return;
1990
2082
  }
1991
- };
1992
- if (augmentJob) {
1993
- augmentJob(job);
1994
- }
1995
- effect = new ReactiveEffect(getter);
1996
- effect.scheduler = scheduler ? () => scheduler(job, false) : job;
1997
- boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
1998
- cleanup = effect.onStop = () => {
1999
- const cleanups = cleanupMap.get(effect);
2000
- if (cleanups) {
2001
- if (call) {
2002
- call(cleanups, 4);
2003
- } else {
2004
- for (const cleanup2 of cleanups) cleanup2();
2083
+ if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2084
+ cleanup(this);
2085
+ const currentWatcher = activeWatcher;
2086
+ activeWatcher = this;
2087
+ try {
2088
+ const args = [
2089
+ newValue,
2090
+ // pass undefined as the old value when it's changed for the first time
2091
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2092
+ this.boundCleanup
2093
+ ];
2094
+ call ? call(this.cb, 3, args) : (
2095
+ // @ts-expect-error
2096
+ this.cb(...args)
2097
+ );
2098
+ } finally {
2099
+ activeWatcher = currentWatcher;
2005
2100
  }
2006
- cleanupMap.delete(effect);
2007
- }
2008
- };
2009
- if (cb) {
2010
- if (immediate) {
2011
- job(true);
2012
- } else {
2013
- oldValue = effect.run();
2014
2101
  }
2015
- } else if (scheduler) {
2016
- scheduler(job.bind(null, true), true);
2017
- } else {
2018
- effect.run();
2019
2102
  }
2020
- watchHandle.pause = effect.pause.bind(effect);
2021
- watchHandle.resume = effect.resume.bind(effect);
2022
- watchHandle.stop = watchHandle;
2023
- return watchHandle;
2103
+ }
2104
+ function reactiveGetter(source, deep) {
2105
+ if (deep) return source;
2106
+ if (isShallow(source) || deep === false || deep === 0)
2107
+ return traverse(source, 1);
2108
+ return traverse(source);
2024
2109
  }
2025
2110
  function traverse(value, depth = Infinity, seen) {
2026
2111
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
@@ -2055,7 +2140,7 @@ function traverse(value, depth = Infinity, seen) {
2055
2140
  return value;
2056
2141
  }
2057
2142
 
2058
- function pushWarningContext(vnode) {
2143
+ function pushWarningContext(ctx) {
2059
2144
  }
2060
2145
  function popWarningContext() {
2061
2146
  }
@@ -2152,11 +2237,10 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
2152
2237
  }
2153
2238
  }
2154
2239
  function handleError(err, instance, type, throwInDev = true) {
2155
- const contextVNode = instance ? instance.vnode : null;
2156
2240
  const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
2157
2241
  if (instance) {
2158
2242
  let cur = instance.parent;
2159
- const exposedInstance = instance.proxy;
2243
+ const exposedInstance = instance.proxy || instance;
2160
2244
  const errorInfo = `https://vuejs.org/error-reference/#runtime-${type}`;
2161
2245
  while (cur) {
2162
2246
  const errorCapturedHooks = cur.ec;
@@ -2170,19 +2254,19 @@ function handleError(err, instance, type, throwInDev = true) {
2170
2254
  cur = cur.parent;
2171
2255
  }
2172
2256
  if (errorHandler) {
2173
- pauseTracking();
2257
+ const prevSub = setActiveSub();
2174
2258
  callWithErrorHandling(errorHandler, null, 10, [
2175
2259
  err,
2176
2260
  exposedInstance,
2177
2261
  errorInfo
2178
2262
  ]);
2179
- resetTracking();
2263
+ setActiveSub(prevSub);
2180
2264
  return;
2181
2265
  }
2182
2266
  }
2183
- logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
2267
+ logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
2184
2268
  }
2185
- function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
2269
+ function logError(err, type, instance, throwInDev = true, throwInProd = false) {
2186
2270
  if (throwInProd) {
2187
2271
  throw err;
2188
2272
  } else {
@@ -2190,25 +2274,22 @@ function logError(err, type, contextVNode, throwInDev = true, throwInProd = fals
2190
2274
  }
2191
2275
  }
2192
2276
 
2193
- const queue = [];
2194
- let flushIndex = -1;
2195
- const pendingPostFlushCbs = [];
2196
- let activePostFlushCbs = null;
2277
+ const jobs = [];
2278
+ let postJobs = [];
2279
+ let activePostJobs = null;
2280
+ let currentFlushPromise = null;
2281
+ let jobsLength = 0;
2282
+ let flushIndex = 0;
2197
2283
  let postFlushIndex = 0;
2198
2284
  const resolvedPromise = /* @__PURE__ */ Promise.resolve();
2199
- let currentFlushPromise = null;
2200
2285
  function nextTick(fn) {
2201
2286
  const p = currentFlushPromise || resolvedPromise;
2202
2287
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2203
2288
  }
2204
- function findInsertionIndex(id) {
2205
- let start = flushIndex + 1;
2206
- let end = queue.length;
2289
+ function findInsertionIndex(order, queue, start, end) {
2207
2290
  while (start < end) {
2208
2291
  const middle = start + end >>> 1;
2209
- const middleJob = queue[middle];
2210
- const middleJobId = getId(middleJob);
2211
- if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
2292
+ if (queue[middle].order <= order) {
2212
2293
  start = middle + 1;
2213
2294
  } else {
2214
2295
  end = middle;
@@ -2216,112 +2297,151 @@ function findInsertionIndex(id) {
2216
2297
  }
2217
2298
  return start;
2218
2299
  }
2219
- function queueJob(job) {
2220
- if (!(job.flags & 1)) {
2221
- const jobId = getId(job);
2222
- const lastJob = queue[queue.length - 1];
2223
- if (!lastJob || // fast path when the job id is larger than the tail
2224
- !(job.flags & 2) && jobId >= getId(lastJob)) {
2225
- queue.push(job);
2300
+ function queueJob(job, id, isPre = false) {
2301
+ if (queueJobWorker(
2302
+ job,
2303
+ id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1,
2304
+ jobs,
2305
+ jobsLength,
2306
+ flushIndex
2307
+ )) {
2308
+ jobsLength++;
2309
+ queueFlush();
2310
+ }
2311
+ }
2312
+ function queueJobWorker(job, order, queue, length, flushIndex2) {
2313
+ const flags = job.flags;
2314
+ if (!(flags & 1)) {
2315
+ job.flags = flags | 1;
2316
+ job.order = order;
2317
+ if (flushIndex2 === length || // fast path when the job id is larger than the tail
2318
+ order >= queue[length - 1].order) {
2319
+ queue[length] = job;
2226
2320
  } else {
2227
- queue.splice(findInsertionIndex(jobId), 0, job);
2321
+ queue.splice(findInsertionIndex(order, queue, flushIndex2, length), 0, job);
2228
2322
  }
2229
- job.flags |= 1;
2230
- queueFlush();
2323
+ return true;
2231
2324
  }
2325
+ return false;
2232
2326
  }
2327
+ const doFlushJobs = () => {
2328
+ try {
2329
+ flushJobs();
2330
+ } catch (e) {
2331
+ currentFlushPromise = null;
2332
+ throw e;
2333
+ }
2334
+ };
2233
2335
  function queueFlush() {
2234
2336
  if (!currentFlushPromise) {
2235
- currentFlushPromise = resolvedPromise.then(flushJobs);
2337
+ currentFlushPromise = resolvedPromise.then(doFlushJobs);
2236
2338
  }
2237
2339
  }
2238
- function queuePostFlushCb(cb) {
2239
- if (!isArray(cb)) {
2240
- if (activePostFlushCbs && cb.id === -1) {
2241
- activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2242
- } else if (!(cb.flags & 1)) {
2243
- pendingPostFlushCbs.push(cb);
2244
- cb.flags |= 1;
2340
+ function queuePostFlushCb(jobs2, id = Infinity) {
2341
+ if (!isArray(jobs2)) {
2342
+ if (activePostJobs && id === -1) {
2343
+ activePostJobs.splice(postFlushIndex, 0, jobs2);
2344
+ } else {
2345
+ queueJobWorker(jobs2, id, postJobs, postJobs.length, 0);
2245
2346
  }
2246
2347
  } else {
2247
- pendingPostFlushCbs.push(...cb);
2348
+ for (const job of jobs2) {
2349
+ queueJobWorker(job, id, postJobs, postJobs.length, 0);
2350
+ }
2248
2351
  }
2249
2352
  queueFlush();
2250
2353
  }
2251
- function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2252
- for (; i < queue.length; i++) {
2253
- const cb = queue[i];
2254
- if (cb && cb.flags & 2) {
2255
- if (instance && cb.id !== instance.uid) {
2256
- continue;
2257
- }
2258
- queue.splice(i, 1);
2259
- i--;
2260
- if (cb.flags & 4) {
2261
- cb.flags &= -2;
2262
- }
2263
- cb();
2264
- if (!(cb.flags & 4)) {
2265
- cb.flags &= -2;
2266
- }
2354
+ function flushPreFlushCbs(instance, seen) {
2355
+ for (let i = flushIndex; i < jobsLength; i++) {
2356
+ const cb = jobs[i];
2357
+ if (cb.order & 1 || cb.order === Infinity) {
2358
+ continue;
2359
+ }
2360
+ if (instance && cb.order !== instance.uid * 2) {
2361
+ continue;
2362
+ }
2363
+ jobs.splice(i, 1);
2364
+ i--;
2365
+ jobsLength--;
2366
+ if (cb.flags & 2) {
2367
+ cb.flags &= -2;
2368
+ }
2369
+ cb();
2370
+ if (!(cb.flags & 2)) {
2371
+ cb.flags &= -2;
2267
2372
  }
2268
2373
  }
2269
2374
  }
2270
2375
  function flushPostFlushCbs(seen) {
2271
- if (pendingPostFlushCbs.length) {
2272
- const deduped = [...new Set(pendingPostFlushCbs)].sort(
2273
- (a, b) => getId(a) - getId(b)
2274
- );
2275
- pendingPostFlushCbs.length = 0;
2276
- if (activePostFlushCbs) {
2277
- activePostFlushCbs.push(...deduped);
2376
+ if (postJobs.length) {
2377
+ if (activePostJobs) {
2378
+ activePostJobs.push(...postJobs);
2379
+ postJobs.length = 0;
2278
2380
  return;
2279
2381
  }
2280
- activePostFlushCbs = deduped;
2281
- for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
2282
- const cb = activePostFlushCbs[postFlushIndex];
2283
- if (cb.flags & 4) {
2382
+ activePostJobs = postJobs;
2383
+ postJobs = [];
2384
+ while (postFlushIndex < activePostJobs.length) {
2385
+ const cb = activePostJobs[postFlushIndex++];
2386
+ if (cb.flags & 2) {
2284
2387
  cb.flags &= -2;
2285
2388
  }
2286
- if (!(cb.flags & 8)) cb();
2287
- cb.flags &= -2;
2389
+ if (!(cb.flags & 4)) {
2390
+ try {
2391
+ cb();
2392
+ } finally {
2393
+ cb.flags &= -2;
2394
+ }
2395
+ }
2288
2396
  }
2289
- activePostFlushCbs = null;
2397
+ activePostJobs = null;
2290
2398
  postFlushIndex = 0;
2291
2399
  }
2292
2400
  }
2293
- const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2401
+ let isFlushing = false;
2402
+ function flushOnAppMount() {
2403
+ if (!isFlushing) {
2404
+ isFlushing = true;
2405
+ flushPreFlushCbs();
2406
+ flushPostFlushCbs();
2407
+ isFlushing = false;
2408
+ }
2409
+ }
2294
2410
  function flushJobs(seen) {
2295
2411
  try {
2296
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
2297
- const job = queue[flushIndex];
2298
- if (job && !(job.flags & 8)) {
2412
+ while (flushIndex < jobsLength) {
2413
+ const job = jobs[flushIndex];
2414
+ jobs[flushIndex++] = void 0;
2415
+ if (!(job.flags & 4)) {
2299
2416
  if (false) ;
2300
- if (job.flags & 4) {
2417
+ if (job.flags & 2) {
2301
2418
  job.flags &= ~1;
2302
2419
  }
2303
- callWithErrorHandling(
2304
- job,
2305
- job.i,
2306
- job.i ? 15 : 14
2307
- );
2308
- if (!(job.flags & 4)) {
2309
- job.flags &= ~1;
2420
+ try {
2421
+ job();
2422
+ } catch (err) {
2423
+ handleError(
2424
+ err,
2425
+ job.i,
2426
+ job.i ? 15 : 14
2427
+ );
2428
+ } finally {
2429
+ if (!(job.flags & 2)) {
2430
+ job.flags &= ~1;
2431
+ }
2310
2432
  }
2311
2433
  }
2312
2434
  }
2313
2435
  } finally {
2314
- for (; flushIndex < queue.length; flushIndex++) {
2315
- const job = queue[flushIndex];
2316
- if (job) {
2317
- job.flags &= -2;
2318
- }
2436
+ while (flushIndex < jobsLength) {
2437
+ jobs[flushIndex].flags &= -2;
2438
+ jobs[flushIndex++] = void 0;
2319
2439
  }
2320
- flushIndex = -1;
2321
- queue.length = 0;
2440
+ flushIndex = 0;
2441
+ jobsLength = 0;
2322
2442
  flushPostFlushCbs();
2323
2443
  currentFlushPromise = null;
2324
- if (queue.length || pendingPostFlushCbs.length) {
2444
+ if (jobsLength || postJobs.length) {
2325
2445
  flushJobs();
2326
2446
  }
2327
2447
  }
@@ -2380,7 +2500,7 @@ const globalCompatConfig = {
2380
2500
  MODE: 2
2381
2501
  };
2382
2502
  function configureCompat(config) {
2383
- extend$1(globalCompatConfig, config);
2503
+ extend(globalCompatConfig, config);
2384
2504
  }
2385
2505
  function getCompatConfigForKey(key, instance) {
2386
2506
  const instanceConfig = instance && instance.type.compatConfig;
@@ -2517,7 +2637,7 @@ function convertLegacyVModelProps(vnode) {
2517
2637
  function applyModelFromMixins(model, mixins) {
2518
2638
  if (mixins) {
2519
2639
  mixins.forEach((m) => {
2520
- if (m.model) extend$1(model, m.model);
2640
+ if (m.model) extend(model, m.model);
2521
2641
  if (m.mixins) applyModelFromMixins(model, m.mixins);
2522
2642
  });
2523
2643
  }
@@ -2667,14 +2787,14 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2667
2787
  hook = mapCompatDirectiveHook(name, binding.dir, instance);
2668
2788
  }
2669
2789
  if (hook) {
2670
- pauseTracking();
2790
+ const prevSub = setActiveSub();
2671
2791
  callWithAsyncErrorHandling(hook, instance, 8, [
2672
2792
  vnode.el,
2673
2793
  binding,
2674
2794
  vnode,
2675
2795
  prevVNode
2676
2796
  ]);
2677
- resetTracking();
2797
+ setActiveSub(prevSub);
2678
2798
  }
2679
2799
  }
2680
2800
  }
@@ -2753,29 +2873,37 @@ const TeleportImpl = {
2753
2873
  }
2754
2874
  if (isTeleportDeferred(n2.props)) {
2755
2875
  n2.el.__isMounted = false;
2756
- queuePostRenderEffect(() => {
2757
- mountToTarget();
2758
- delete n2.el.__isMounted;
2759
- }, parentSuspense);
2876
+ queuePostRenderEffect(
2877
+ () => {
2878
+ mountToTarget();
2879
+ delete n2.el.__isMounted;
2880
+ },
2881
+ void 0,
2882
+ parentSuspense
2883
+ );
2760
2884
  } else {
2761
2885
  mountToTarget();
2762
2886
  }
2763
2887
  } else {
2764
2888
  if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
2765
- queuePostRenderEffect(() => {
2766
- TeleportImpl.process(
2767
- n1,
2768
- n2,
2769
- container,
2770
- anchor,
2771
- parentComponent,
2772
- parentSuspense,
2773
- namespace,
2774
- slotScopeIds,
2775
- optimized,
2776
- internals
2777
- );
2778
- }, parentSuspense);
2889
+ queuePostRenderEffect(
2890
+ () => {
2891
+ TeleportImpl.process(
2892
+ n1,
2893
+ n2,
2894
+ container,
2895
+ anchor,
2896
+ parentComponent,
2897
+ parentSuspense,
2898
+ namespace,
2899
+ slotScopeIds,
2900
+ optimized,
2901
+ internals
2902
+ );
2903
+ },
2904
+ void 0,
2905
+ parentSuspense
2906
+ );
2779
2907
  return;
2780
2908
  }
2781
2909
  n2.el = n1.el;
@@ -2822,6 +2950,7 @@ const TeleportImpl = {
2822
2950
  container,
2823
2951
  mainAnchor,
2824
2952
  internals,
2953
+ parentComponent,
2825
2954
  1
2826
2955
  );
2827
2956
  } else {
@@ -2841,6 +2970,7 @@ const TeleportImpl = {
2841
2970
  nextTarget,
2842
2971
  null,
2843
2972
  internals,
2973
+ parentComponent,
2844
2974
  0
2845
2975
  );
2846
2976
  }
@@ -2850,6 +2980,7 @@ const TeleportImpl = {
2850
2980
  target,
2851
2981
  targetAnchor,
2852
2982
  internals,
2983
+ parentComponent,
2853
2984
  1
2854
2985
  );
2855
2986
  }
@@ -2889,7 +3020,7 @@ const TeleportImpl = {
2889
3020
  move: moveTeleport,
2890
3021
  hydrate: hydrateTeleport
2891
3022
  };
2892
- function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
3023
+ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, parentComponent, moveType = 2) {
2893
3024
  if (moveType === 0) {
2894
3025
  insert(vnode.targetAnchor, container, parentAnchor);
2895
3026
  }
@@ -2905,7 +3036,8 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
2905
3036
  children[i],
2906
3037
  container,
2907
3038
  parentAnchor,
2908
- 2
3039
+ 2,
3040
+ parentComponent
2909
3041
  );
2910
3042
  }
2911
3043
  }
@@ -3087,7 +3219,7 @@ const BaseTransitionImpl = {
3087
3219
  state.isLeaving = true;
3088
3220
  leavingHooks.afterLeave = () => {
3089
3221
  state.isLeaving = false;
3090
- if (!(instance.job.flags & 8)) {
3222
+ if (!(instance.job.flags & 4)) {
3091
3223
  instance.update();
3092
3224
  }
3093
3225
  delete leavingHooks.afterLeave;
@@ -3357,12 +3489,12 @@ function defineComponent(options, extraOptions) {
3357
3489
  return isFunction(options) ? (
3358
3490
  // #8236: extend call and options.name access are considered side-effects
3359
3491
  // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3360
- /* @__PURE__ */ (() => extend$1({ name: options.name }, extraOptions, { setup: options }))()
3492
+ /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3361
3493
  ) : options;
3362
3494
  }
3363
3495
 
3364
3496
  function useId() {
3365
- const i = getCurrentInstance();
3497
+ const i = getCurrentGenericInstance();
3366
3498
  if (i) {
3367
3499
  return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
3368
3500
  }
@@ -3373,7 +3505,7 @@ function markAsyncBoundary(instance) {
3373
3505
  }
3374
3506
 
3375
3507
  function useTemplateRef(key) {
3376
- const i = getCurrentInstance();
3508
+ const i = getCurrentGenericInstance();
3377
3509
  const r = shallowRef(null);
3378
3510
  if (i) {
3379
3511
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
@@ -3465,8 +3597,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3465
3597
  } else ;
3466
3598
  };
3467
3599
  if (value) {
3468
- doSet.id = -1;
3469
- queuePostRenderEffect(doSet, parentSuspense);
3600
+ queuePostRenderEffect(doSet, -1, parentSuspense);
3470
3601
  } else {
3471
3602
  doSet();
3472
3603
  }
@@ -3616,6 +3747,9 @@ function createHydrationFunctions(rendererInternals) {
3616
3747
  );
3617
3748
  }
3618
3749
  } else if (shapeFlag & 6) {
3750
+ if (vnode.type.__vapor) {
3751
+ throw new Error("Vapor component hydration is not supported yet.");
3752
+ }
3619
3753
  vnode.slotScopeIds = slotScopeIds;
3620
3754
  const container = parentNode(node);
3621
3755
  if (isFragmentStart) {
@@ -3764,11 +3898,15 @@ function createHydrationFunctions(rendererInternals) {
3764
3898
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
3765
3899
  }
3766
3900
  if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
3767
- queueEffectWithSuspense(() => {
3768
- vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
3769
- needCallTransitionHooks && transition.enter(el);
3770
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
3771
- }, parentSuspense);
3901
+ queueEffectWithSuspense(
3902
+ () => {
3903
+ vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
3904
+ needCallTransitionHooks && transition.enter(el);
3905
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
3906
+ },
3907
+ void 0,
3908
+ parentSuspense
3909
+ );
3772
3910
  }
3773
3911
  }
3774
3912
  return el.nextSibling;
@@ -3938,7 +4076,7 @@ function isMismatchAllowed(el, allowedType) {
3938
4076
  if (allowedType === 0 /* TEXT */ && list.includes("children")) {
3939
4077
  return true;
3940
4078
  }
3941
- return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
4079
+ return list.includes(MismatchTypeString[allowedType]);
3942
4080
  }
3943
4081
  }
3944
4082
 
@@ -4155,7 +4293,7 @@ function defineAsyncComponent(source) {
4155
4293
  }
4156
4294
  load().then(() => {
4157
4295
  loaded.value = true;
4158
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4296
+ if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
4159
4297
  instance.parent.update();
4160
4298
  }
4161
4299
  }).catch((err) => {
@@ -4198,8 +4336,8 @@ const KeepAliveImpl = {
4198
4336
  max: [String, Number]
4199
4337
  },
4200
4338
  setup(props, { slots }) {
4201
- const instance = getCurrentInstance();
4202
- const sharedContext = instance.ctx;
4339
+ const keepAliveInstance = getCurrentInstance();
4340
+ const sharedContext = keepAliveInstance.ctx;
4203
4341
  if (!sharedContext.renderer) {
4204
4342
  return () => {
4205
4343
  const children = slots.default && slots.default();
@@ -4209,7 +4347,7 @@ const KeepAliveImpl = {
4209
4347
  const cache = /* @__PURE__ */ new Map();
4210
4348
  const keys = /* @__PURE__ */ new Set();
4211
4349
  let current = null;
4212
- const parentSuspense = instance.suspense;
4350
+ const parentSuspense = keepAliveInstance.suspense;
4213
4351
  const {
4214
4352
  renderer: {
4215
4353
  p: patch,
@@ -4220,49 +4358,71 @@ const KeepAliveImpl = {
4220
4358
  } = sharedContext;
4221
4359
  const storageContainer = createElement("div");
4222
4360
  sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
4223
- const instance2 = vnode.component;
4224
- move(vnode, container, anchor, 0, parentSuspense);
4361
+ const instance = vnode.component;
4362
+ move(
4363
+ vnode,
4364
+ container,
4365
+ anchor,
4366
+ 0,
4367
+ keepAliveInstance,
4368
+ parentSuspense
4369
+ );
4225
4370
  patch(
4226
- instance2.vnode,
4371
+ instance.vnode,
4227
4372
  vnode,
4228
4373
  container,
4229
4374
  anchor,
4230
- instance2,
4375
+ instance,
4231
4376
  parentSuspense,
4232
4377
  namespace,
4233
4378
  vnode.slotScopeIds,
4234
4379
  optimized
4235
4380
  );
4236
- queuePostRenderEffect(() => {
4237
- instance2.isDeactivated = false;
4238
- if (instance2.a) {
4239
- invokeArrayFns(instance2.a);
4240
- }
4241
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4242
- if (vnodeHook) {
4243
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4244
- }
4245
- }, parentSuspense);
4381
+ queuePostRenderEffect(
4382
+ () => {
4383
+ instance.isDeactivated = false;
4384
+ if (instance.a) {
4385
+ invokeArrayFns(instance.a);
4386
+ }
4387
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4388
+ if (vnodeHook) {
4389
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
4390
+ }
4391
+ },
4392
+ void 0,
4393
+ parentSuspense
4394
+ );
4246
4395
  };
4247
4396
  sharedContext.deactivate = (vnode) => {
4248
- const instance2 = vnode.component;
4249
- invalidateMount(instance2.m);
4250
- invalidateMount(instance2.a);
4251
- move(vnode, storageContainer, null, 1, parentSuspense);
4252
- queuePostRenderEffect(() => {
4253
- if (instance2.da) {
4254
- invokeArrayFns(instance2.da);
4255
- }
4256
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4257
- if (vnodeHook) {
4258
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4259
- }
4260
- instance2.isDeactivated = true;
4261
- }, parentSuspense);
4397
+ const instance = vnode.component;
4398
+ invalidateMount(instance.m);
4399
+ invalidateMount(instance.a);
4400
+ move(
4401
+ vnode,
4402
+ storageContainer,
4403
+ null,
4404
+ 1,
4405
+ keepAliveInstance,
4406
+ parentSuspense
4407
+ );
4408
+ queuePostRenderEffect(
4409
+ () => {
4410
+ if (instance.da) {
4411
+ invokeArrayFns(instance.da);
4412
+ }
4413
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4414
+ if (vnodeHook) {
4415
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
4416
+ }
4417
+ instance.isDeactivated = true;
4418
+ },
4419
+ void 0,
4420
+ parentSuspense
4421
+ );
4262
4422
  };
4263
4423
  function unmount(vnode) {
4264
4424
  resetShapeFlag(vnode);
4265
- _unmount(vnode, instance, parentSuspense, true);
4425
+ _unmount(vnode, keepAliveInstance, parentSuspense, true);
4266
4426
  }
4267
4427
  function pruneCache(filter) {
4268
4428
  cache.forEach((vnode, key) => {
@@ -4294,12 +4454,19 @@ const KeepAliveImpl = {
4294
4454
  let pendingCacheKey = null;
4295
4455
  const cacheSubtree = () => {
4296
4456
  if (pendingCacheKey != null) {
4297
- if (isSuspense(instance.subTree.type)) {
4298
- queuePostRenderEffect(() => {
4299
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4300
- }, instance.subTree.suspense);
4457
+ if (isSuspense(keepAliveInstance.subTree.type)) {
4458
+ queuePostRenderEffect(
4459
+ () => {
4460
+ cache.set(
4461
+ pendingCacheKey,
4462
+ getInnerChild(keepAliveInstance.subTree)
4463
+ );
4464
+ },
4465
+ void 0,
4466
+ keepAliveInstance.subTree.suspense
4467
+ );
4301
4468
  } else {
4302
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4469
+ cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
4303
4470
  }
4304
4471
  }
4305
4472
  };
@@ -4307,12 +4474,12 @@ const KeepAliveImpl = {
4307
4474
  onUpdated(cacheSubtree);
4308
4475
  onBeforeUnmount(() => {
4309
4476
  cache.forEach((cached) => {
4310
- const { subTree, suspense } = instance;
4477
+ const { subTree, suspense } = keepAliveInstance;
4311
4478
  const vnode = getInnerChild(subTree);
4312
4479
  if (cached.type === vnode.type && cached.key === vnode.key) {
4313
4480
  resetShapeFlag(vnode);
4314
4481
  const da = vnode.component.da;
4315
- da && queuePostRenderEffect(da, suspense);
4482
+ da && queuePostRenderEffect(da, void 0, suspense);
4316
4483
  return;
4317
4484
  }
4318
4485
  unmount(cached);
@@ -4399,7 +4566,7 @@ function onActivated(hook, target) {
4399
4566
  function onDeactivated(hook, target) {
4400
4567
  registerKeepAliveHook(hook, "da", target);
4401
4568
  }
4402
- function registerKeepAliveHook(hook, type, target = currentInstance) {
4569
+ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
4403
4570
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
4404
4571
  let current = target;
4405
4572
  while (current) {
@@ -4413,7 +4580,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
4413
4580
  injectHook(type, wrappedHook, target);
4414
4581
  if (target) {
4415
4582
  let current = target.parent;
4416
- while (current && current.parent) {
4583
+ while (current && current.parent && current.parent.vnode) {
4417
4584
  if (isKeepAlive(current.parent.vnode)) {
4418
4585
  injectToKeepAliveRoot(wrappedHook, type, target, current);
4419
4586
  }
@@ -4445,12 +4612,14 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4445
4612
  if (target) {
4446
4613
  const hooks = target[type] || (target[type] = []);
4447
4614
  const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
4448
- pauseTracking();
4449
- const reset = setCurrentInstance(target);
4450
- const res = callWithAsyncErrorHandling(hook, target, type, args);
4451
- reset();
4452
- resetTracking();
4453
- return res;
4615
+ const prevSub = setActiveSub();
4616
+ const prev = setCurrentInstance(target);
4617
+ try {
4618
+ return callWithAsyncErrorHandling(hook, target, type, args);
4619
+ } finally {
4620
+ setCurrentInstance(...prev);
4621
+ setActiveSub(prevSub);
4622
+ }
4454
4623
  });
4455
4624
  if (prepend) {
4456
4625
  hooks.unshift(wrappedHook);
@@ -4555,7 +4724,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
4555
4724
  const res = (
4556
4725
  // local registration
4557
4726
  // check instance[type] first which is resolved for options API
4558
- resolve(instance[type] || Component[type], name) || // global registration
4727
+ resolve(
4728
+ instance[type] || Component[type],
4729
+ name
4730
+ ) || // global registration
4731
+ // @ts-expect-error filters only exist in compat mode
4559
4732
  resolve(instance.appContext[type], name)
4560
4733
  );
4561
4734
  if (!res && maybeSelfReference) {
@@ -4634,7 +4807,7 @@ function convertLegacyProps(legacyProps, type) {
4634
4807
  const converted = {};
4635
4808
  for (const key in legacyProps) {
4636
4809
  if (key === "attrs" || key === "domProps" || key === "props") {
4637
- extend$1(converted, legacyProps[key]);
4810
+ extend(converted, legacyProps[key]);
4638
4811
  } else if (key === "on" || key === "nativeOn") {
4639
4812
  const listeners = legacyProps[key];
4640
4813
  for (const event in listeners) {
@@ -4722,7 +4895,7 @@ function convertLegacySlots(vnode) {
4722
4895
  if (scopedSlots) {
4723
4896
  delete props.scopedSlots;
4724
4897
  if (slots) {
4725
- extend$1(slots, scopedSlots);
4898
+ extend(slots, scopedSlots);
4726
4899
  } else {
4727
4900
  slots = scopedSlots;
4728
4901
  }
@@ -4885,7 +5058,13 @@ function createSlots(slots, dynamicSlots) {
4885
5058
  }
4886
5059
 
4887
5060
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4888
- if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5061
+ let slot = slots[name];
5062
+ if (slot && slot.__vapor) {
5063
+ const ret = (openBlock(), createBlock(VaporSlot, props));
5064
+ ret.vs = { slot, fallback };
5065
+ return ret;
5066
+ }
5067
+ if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
4889
5068
  if (name !== "default") props.name = name;
4890
5069
  return openBlock(), createBlock(
4891
5070
  Fragment,
@@ -4894,7 +5073,6 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4894
5073
  64
4895
5074
  );
4896
5075
  }
4897
- let slot = slots[name];
4898
5076
  if (slot && slot._c) {
4899
5077
  slot._d = false;
4900
5078
  }
@@ -4942,7 +5120,7 @@ function toObject(arr) {
4942
5120
  const res = {};
4943
5121
  for (let i = 0; i < arr.length; i++) {
4944
5122
  if (arr[i]) {
4945
- extend$1(res, arr[i]);
5123
+ extend(res, arr[i]);
4946
5124
  }
4947
5125
  }
4948
5126
  return res;
@@ -5061,7 +5239,7 @@ function installCompatInstanceProperties(map) {
5061
5239
  const del = (target, key) => {
5062
5240
  delete target[key];
5063
5241
  };
5064
- extend$1(map, {
5242
+ extend(map, {
5065
5243
  $set: (i) => {
5066
5244
  assertCompatEnabled("INSTANCE_SET", i);
5067
5245
  return set;
@@ -5106,7 +5284,7 @@ function installCompatInstanceProperties(map) {
5106
5284
  if (i.resolvedOptions) {
5107
5285
  return i.resolvedOptions;
5108
5286
  }
5109
- const res = i.resolvedOptions = extend$1({}, resolveMergedOptions(i));
5287
+ const res = i.resolvedOptions = extend({}, resolveMergedOptions(i));
5110
5288
  Object.defineProperties(res, {
5111
5289
  parent: {
5112
5290
  get() {
@@ -5162,14 +5340,15 @@ function installCompatInstanceProperties(map) {
5162
5340
  }
5163
5341
 
5164
5342
  const getPublicInstance = (i) => {
5165
- if (!i) return null;
5166
- if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5343
+ if (!i || i.vapor) return null;
5344
+ if (isStatefulComponent(i))
5345
+ return getComponentPublicInstance(i);
5167
5346
  return getPublicInstance(i.parent);
5168
5347
  };
5169
5348
  const publicPropertiesMap = (
5170
5349
  // Move PURE marker to new line to workaround compiler discarding it
5171
5350
  // due to type annotation
5172
- /* @__PURE__ */ extend$1(/* @__PURE__ */ Object.create(null), {
5351
+ /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
5173
5352
  $: (i) => i,
5174
5353
  $el: (i) => i.vnode.el,
5175
5354
  $data: (i) => i.data,
@@ -5258,7 +5437,7 @@ const PublicInstanceProxyHandlers = {
5258
5437
  return desc.get.call(instance.proxy);
5259
5438
  } else {
5260
5439
  const val = globalProperties[key];
5261
- return isFunction(val) ? extend$1(val.bind(instance.proxy), val) : val;
5440
+ return isFunction(val) ? extend(val.bind(instance.proxy), val) : val;
5262
5441
  }
5263
5442
  }
5264
5443
  } else ;
@@ -5298,7 +5477,7 @@ const PublicInstanceProxyHandlers = {
5298
5477
  return Reflect.defineProperty(target, key, descriptor);
5299
5478
  }
5300
5479
  };
5301
- const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend$1({}, PublicInstanceProxyHandlers, {
5480
+ const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
5302
5481
  get(target, key) {
5303
5482
  if (key === Symbol.unscopables) {
5304
5483
  return;
@@ -5349,8 +5528,13 @@ function useAttrs() {
5349
5528
  return getContext().attrs;
5350
5529
  }
5351
5530
  function getContext() {
5352
- const i = getCurrentInstance();
5353
- return i.setupContext || (i.setupContext = createSetupContext(i));
5531
+ const i = getCurrentGenericInstance();
5532
+ if (i.vapor) {
5533
+ return i;
5534
+ } else {
5535
+ const ii = i;
5536
+ return ii.setupContext || (ii.setupContext = createSetupContext(ii));
5537
+ }
5354
5538
  }
5355
5539
  function normalizePropsOrEmits(props) {
5356
5540
  return isArray(props) ? props.reduce(
@@ -5381,7 +5565,7 @@ function mergeDefaults(raw, defaults) {
5381
5565
  function mergeModels(a, b) {
5382
5566
  if (!a || !b) return a || b;
5383
5567
  if (isArray(a) && isArray(b)) return a.concat(b);
5384
- return extend$1({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
5568
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
5385
5569
  }
5386
5570
  function createPropsRestProxy(props, excludedKeys) {
5387
5571
  const ret = {};
@@ -5396,9 +5580,9 @@ function createPropsRestProxy(props, excludedKeys) {
5396
5580
  return ret;
5397
5581
  }
5398
5582
  function withAsyncContext(getAwaitable) {
5399
- const ctx = getCurrentInstance();
5583
+ const ctx = getCurrentGenericInstance();
5400
5584
  let awaitable = getAwaitable();
5401
- unsetCurrentInstance();
5585
+ setCurrentInstance(null, void 0);
5402
5586
  if (isPromise(awaitable)) {
5403
5587
  awaitable = awaitable.catch((e) => {
5404
5588
  setCurrentInstance(ctx);
@@ -5600,7 +5784,8 @@ function createWatcher(raw, ctx, publicThis, key) {
5600
5784
  let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
5601
5785
  const options = {};
5602
5786
  {
5603
- const instance = currentInstance && getCurrentScope() === currentInstance.scope ? currentInstance : null;
5787
+ const cur = getCurrentInstance();
5788
+ const instance = cur && getCurrentScope() === cur.scope ? cur : null;
5604
5789
  const newValue = getter();
5605
5790
  if (isArray(newValue) && isCompatEnabled$1("WATCH_ARRAY", instance)) {
5606
5791
  options.deep = true;
@@ -5631,7 +5816,7 @@ function createWatcher(raw, ctx, publicThis, key) {
5631
5816
  } else {
5632
5817
  const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
5633
5818
  if (isFunction(handler)) {
5634
- watch(getter, handler, extend$1(raw, options) );
5819
+ watch(getter, handler, extend(raw, options) );
5635
5820
  }
5636
5821
  }
5637
5822
  } else ;
@@ -5650,7 +5835,7 @@ function resolveMergedOptions(instance) {
5650
5835
  resolved = cached;
5651
5836
  } else if (!globalMixins.length && !mixins && !extendsOptions) {
5652
5837
  if (isCompatEnabled$1("PRIVATE_APIS", instance)) {
5653
- resolved = extend$1({}, base);
5838
+ resolved = extend({}, base);
5654
5839
  resolved.parent = instance.parent && instance.parent.proxy;
5655
5840
  resolved.propsData = instance.vnode.props;
5656
5841
  } else {
@@ -5733,7 +5918,7 @@ function mergeDataFn(to, from) {
5733
5918
  return from;
5734
5919
  }
5735
5920
  return function mergedDataFn() {
5736
- return (isCompatEnabled$1("OPTIONS_DATA_MERGE", null) ? deepMergeData : extend$1)(
5921
+ return (isCompatEnabled$1("OPTIONS_DATA_MERGE", null) ? deepMergeData : extend)(
5737
5922
  isFunction(to) ? to.call(this, this) : to,
5738
5923
  isFunction(from) ? from.call(this, this) : from
5739
5924
  );
@@ -5756,14 +5941,14 @@ function mergeAsArray$1(to, from) {
5756
5941
  return to ? [...new Set([].concat(to, from))] : from;
5757
5942
  }
5758
5943
  function mergeObjectOptions(to, from) {
5759
- return to ? extend$1(/* @__PURE__ */ Object.create(null), to, from) : from;
5944
+ return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
5760
5945
  }
5761
5946
  function mergeEmitsOrPropsOptions(to, from) {
5762
5947
  if (to) {
5763
5948
  if (isArray(to) && isArray(from)) {
5764
5949
  return [.../* @__PURE__ */ new Set([...to, ...from])];
5765
5950
  }
5766
- return extend$1(
5951
+ return extend(
5767
5952
  /* @__PURE__ */ Object.create(null),
5768
5953
  normalizePropsOrEmits(to),
5769
5954
  normalizePropsOrEmits(from != null ? from : {})
@@ -5775,7 +5960,7 @@ function mergeEmitsOrPropsOptions(to, from) {
5775
5960
  function mergeWatchOptions(to, from) {
5776
5961
  if (!to) return from;
5777
5962
  if (!from) return to;
5778
- const merged = extend$1(/* @__PURE__ */ Object.create(null), to);
5963
+ const merged = extend(/* @__PURE__ */ Object.create(null), to);
5779
5964
  for (const key in from) {
5780
5965
  merged[key] = mergeAsArray$1(to[key], from[key]);
5781
5966
  }
@@ -5822,7 +6007,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5822
6007
  return vm;
5823
6008
  }
5824
6009
  }
5825
- Vue.version = `2.6.14-compat:${"3.5.16"}`;
6010
+ Vue.version = `2.6.14-compat:${"3.6.0-alpha.2"}`;
5826
6011
  Vue.config = singletonApp.config;
5827
6012
  Vue.use = (plugin, ...options) => {
5828
6013
  if (plugin && isFunction(plugin.install)) {
@@ -5872,7 +6057,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5872
6057
  } else {
5873
6058
  return createCompatApp(
5874
6059
  mergeOptions(
5875
- extend$1({}, SubVue.options),
6060
+ extend({}, SubVue.options),
5876
6061
  inlineOptions,
5877
6062
  internalOptionMergeStrats
5878
6063
  ),
@@ -5886,7 +6071,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5886
6071
  const mergeBase = {};
5887
6072
  for (const key in Super.options) {
5888
6073
  const superValue = Super.options[key];
5889
- mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend$1(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6074
+ mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
5890
6075
  }
5891
6076
  SubVue.options = mergeOptions(
5892
6077
  mergeBase,
@@ -5924,7 +6109,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5924
6109
  };
5925
6110
  const util = {
5926
6111
  warn: NOOP,
5927
- extend: extend$1,
6112
+ extend,
5928
6113
  mergeOptions: (parent, child, vm) => mergeOptions(
5929
6114
  parent,
5930
6115
  child,
@@ -6176,10 +6361,10 @@ function createAppContext() {
6176
6361
  };
6177
6362
  }
6178
6363
  let uid$1 = 0;
6179
- function createAppAPI(render, hydrate) {
6364
+ function createAppAPI(mount, unmount, getPublicInstance, render) {
6180
6365
  return function createApp(rootComponent, rootProps = null) {
6181
6366
  if (!isFunction(rootComponent)) {
6182
- rootComponent = extend$1({}, rootComponent);
6367
+ rootComponent = extend({}, rootComponent);
6183
6368
  }
6184
6369
  if (rootProps != null && !isObject(rootProps)) {
6185
6370
  rootProps = null;
@@ -6235,22 +6420,11 @@ function createAppAPI(render, hydrate) {
6235
6420
  },
6236
6421
  mount(rootContainer, isHydrate, namespace) {
6237
6422
  if (!isMounted) {
6238
- const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
6239
- vnode.appContext = context;
6240
- if (namespace === true) {
6241
- namespace = "svg";
6242
- } else if (namespace === false) {
6243
- namespace = void 0;
6244
- }
6245
- if (isHydrate && hydrate) {
6246
- hydrate(vnode, rootContainer);
6247
- } else {
6248
- render(vnode, rootContainer, namespace);
6249
- }
6423
+ const instance = mount(app, rootContainer, isHydrate, namespace);
6250
6424
  isMounted = true;
6251
6425
  app._container = rootContainer;
6252
6426
  rootContainer.__vue_app__ = app;
6253
- return getComponentPublicInstance(vnode.component);
6427
+ return getPublicInstance(instance);
6254
6428
  }
6255
6429
  },
6256
6430
  onUnmount(cleanupFn) {
@@ -6263,7 +6437,7 @@ function createAppAPI(render, hydrate) {
6263
6437
  app._instance,
6264
6438
  16
6265
6439
  );
6266
- render(null, app._container);
6440
+ unmount(app);
6267
6441
  delete app._container.__vue_app__;
6268
6442
  }
6269
6443
  },
@@ -6282,7 +6456,12 @@ function createAppAPI(render, hydrate) {
6282
6456
  }
6283
6457
  };
6284
6458
  {
6285
- installAppCompatProperties(app, context, render);
6459
+ installAppCompatProperties(
6460
+ app,
6461
+ context,
6462
+ // vapor doesn't have compat mode so this is always passed
6463
+ render
6464
+ );
6286
6465
  }
6287
6466
  return app;
6288
6467
  };
@@ -6290,6 +6469,7 @@ function createAppAPI(render, hydrate) {
6290
6469
  let currentApp = null;
6291
6470
 
6292
6471
  function provide(key, value) {
6472
+ const currentInstance = getCurrentGenericInstance();
6293
6473
  if (!currentInstance) ; else {
6294
6474
  let provides = currentInstance.provides;
6295
6475
  const parentProvides = currentInstance.parent && currentInstance.parent.provides;
@@ -6300,9 +6480,9 @@ function provide(key, value) {
6300
6480
  }
6301
6481
  }
6302
6482
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
6303
- const instance = currentInstance || currentRenderingInstance;
6483
+ const instance = getCurrentGenericInstance();
6304
6484
  if (instance || currentApp) {
6305
- let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
6485
+ let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.appContext && instance.appContext.provides : instance.parent.provides : void 0;
6306
6486
  if (provides && key in provides) {
6307
6487
  return provides[key];
6308
6488
  } else if (arguments.length > 1) {
@@ -6311,7 +6491,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6311
6491
  }
6312
6492
  }
6313
6493
  function hasInjectionContext() {
6314
- return !!(currentInstance || currentRenderingInstance || currentApp);
6494
+ return !!(getCurrentGenericInstance() || currentApp);
6315
6495
  }
6316
6496
 
6317
6497
  function createPropsDefaultThis(instance, rawProps, propKey) {
@@ -6361,7 +6541,7 @@ const createInternalObject = () => Object.create(internalObjectProto);
6361
6541
  const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
6362
6542
 
6363
6543
  function initProps(instance, rawProps, isStateful, isSSR = false) {
6364
- const props = {};
6544
+ const props = instance.props = {};
6365
6545
  const attrs = createInternalObject();
6366
6546
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6367
6547
  setFullProps(instance, rawProps, props, attrs);
@@ -6414,11 +6594,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
6414
6594
  const camelizedKey = camelize(key);
6415
6595
  props[camelizedKey] = resolvePropValue(
6416
6596
  options,
6417
- rawCurrentProps,
6418
6597
  camelizedKey,
6419
6598
  value,
6420
6599
  instance,
6421
- false
6600
+ baseResolveDefault
6422
6601
  );
6423
6602
  }
6424
6603
  } else {
@@ -6452,10 +6631,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
6452
6631
  rawPrevProps[kebabKey] !== void 0)) {
6453
6632
  props[key] = resolvePropValue(
6454
6633
  options,
6455
- rawCurrentProps,
6456
6634
  key,
6457
6635
  void 0,
6458
6636
  instance,
6637
+ baseResolveDefault,
6459
6638
  true
6460
6639
  );
6461
6640
  }
@@ -6522,39 +6701,37 @@ function setFullProps(instance, rawProps, props, attrs) {
6522
6701
  }
6523
6702
  }
6524
6703
  if (needCastKeys) {
6525
- const rawCurrentProps = toRaw(props);
6526
6704
  const castValues = rawCastValues || EMPTY_OBJ;
6527
6705
  for (let i = 0; i < needCastKeys.length; i++) {
6528
6706
  const key = needCastKeys[i];
6529
6707
  props[key] = resolvePropValue(
6530
6708
  options,
6531
- rawCurrentProps,
6532
6709
  key,
6533
6710
  castValues[key],
6534
6711
  instance,
6712
+ baseResolveDefault,
6535
6713
  !hasOwn(castValues, key)
6536
6714
  );
6537
6715
  }
6538
6716
  }
6539
6717
  return hasAttrsChanged;
6540
6718
  }
6541
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6719
+ function resolvePropValue(options, key, value, instance, resolveDefault, isAbsent = false) {
6542
6720
  const opt = options[key];
6543
6721
  if (opt != null) {
6544
6722
  const hasDefault = hasOwn(opt, "default");
6545
6723
  if (hasDefault && value === void 0) {
6546
6724
  const defaultValue = opt.default;
6547
6725
  if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6548
- const { propsDefaults } = instance;
6549
- if (key in propsDefaults) {
6550
- value = propsDefaults[key];
6726
+ const cachedDefaults = instance.propsDefaults || (instance.propsDefaults = {});
6727
+ if (hasOwn(cachedDefaults, key)) {
6728
+ value = cachedDefaults[key];
6551
6729
  } else {
6552
- const reset = setCurrentInstance(instance);
6553
- value = propsDefaults[key] = defaultValue.call(
6554
- isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props) : null,
6555
- props
6730
+ value = cachedDefaults[key] = resolveDefault(
6731
+ defaultValue,
6732
+ instance,
6733
+ key
6556
6734
  );
6557
- reset();
6558
6735
  }
6559
6736
  } else {
6560
6737
  value = defaultValue;
@@ -6573,6 +6750,17 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
6573
6750
  }
6574
6751
  return value;
6575
6752
  }
6753
+ function baseResolveDefault(factory, instance, key) {
6754
+ let value;
6755
+ const prev = setCurrentInstance(instance);
6756
+ const props = toRaw(instance.props);
6757
+ value = factory.call(
6758
+ isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props) : null,
6759
+ props
6760
+ );
6761
+ setCurrentInstance(...prev);
6762
+ return value;
6763
+ }
6576
6764
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
6577
6765
  function normalizePropsOptions(comp, appContext, asMixin = false) {
6578
6766
  const cache = asMixin ? mixinPropsCache : appContext.propsCache;
@@ -6591,7 +6779,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
6591
6779
  }
6592
6780
  hasExtends = true;
6593
6781
  const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6594
- extend$1(normalized, props);
6782
+ extend(normalized, props);
6595
6783
  if (keys) needCastKeys.push(...keys);
6596
6784
  };
6597
6785
  if (!asMixin && appContext.mixins.length) {
@@ -6610,6 +6798,14 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
6610
6798
  }
6611
6799
  return EMPTY_ARR;
6612
6800
  }
6801
+ baseNormalizePropsOptions(raw, normalized, needCastKeys);
6802
+ const res = [normalized, needCastKeys];
6803
+ if (isObject(comp)) {
6804
+ cache.set(comp, res);
6805
+ }
6806
+ return res;
6807
+ }
6808
+ function baseNormalizePropsOptions(raw, normalized, needCastKeys) {
6613
6809
  if (isArray(raw)) {
6614
6810
  for (let i = 0; i < raw.length; i++) {
6615
6811
  const normalizedKey = camelize(raw[i]);
@@ -6622,7 +6818,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
6622
6818
  const normalizedKey = camelize(key);
6623
6819
  if (validatePropName(normalizedKey)) {
6624
6820
  const opt = raw[key];
6625
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend$1({}, opt);
6821
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6626
6822
  const propType = prop.type;
6627
6823
  let shouldCast = false;
6628
6824
  let shouldCastTrue = true;
@@ -6648,11 +6844,6 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
6648
6844
  }
6649
6845
  }
6650
6846
  }
6651
- const res = [normalized, needCastKeys];
6652
- if (isObject(comp)) {
6653
- cache.set(comp, res);
6654
- }
6655
- return res;
6656
6847
  }
6657
6848
  function validatePropName(key) {
6658
6849
  if (key[0] !== "$" && !isReservedProp(key)) {
@@ -6701,6 +6892,8 @@ const assignSlots = (slots, children, optimized) => {
6701
6892
  const initSlots = (instance, children, optimized) => {
6702
6893
  const slots = instance.slots = createInternalObject();
6703
6894
  if (instance.vnode.shapeFlag & 32) {
6895
+ const cacheIndexes = children.__;
6896
+ if (cacheIndexes) def(slots, "__", cacheIndexes, true);
6704
6897
  const type = children._;
6705
6898
  if (type) {
6706
6899
  assignSlots(slots, children, optimized);
@@ -6807,6 +7000,9 @@ function baseCreateRenderer(options, createHydrationFns) {
6807
7000
  optimized
6808
7001
  );
6809
7002
  break;
7003
+ case VaporSlot:
7004
+ getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
7005
+ break;
6810
7006
  default:
6811
7007
  if (shapeFlag & 1) {
6812
7008
  processElement(
@@ -6862,6 +7058,8 @@ function baseCreateRenderer(options, createHydrationFns) {
6862
7058
  }
6863
7059
  if (ref != null && parentComponent) {
6864
7060
  setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
7061
+ } else if (ref == null && n1 && n1.ref != null) {
7062
+ setRef(n1.ref, null, parentSuspense, n1, true);
6865
7063
  }
6866
7064
  };
6867
7065
  const processText = (n1, n2, container, anchor) => {
@@ -6996,11 +7194,15 @@ function baseCreateRenderer(options, createHydrationFns) {
6996
7194
  }
6997
7195
  hostInsert(el, container, anchor);
6998
7196
  if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
6999
- queuePostRenderEffect(() => {
7000
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7001
- needCallTransitionHooks && transition.enter(el);
7002
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7003
- }, parentSuspense);
7197
+ queuePostRenderEffect(
7198
+ () => {
7199
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7200
+ needCallTransitionHooks && transition.enter(el);
7201
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7202
+ },
7203
+ void 0,
7204
+ parentSuspense
7205
+ );
7004
7206
  }
7005
7207
  };
7006
7208
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
@@ -7012,8 +7214,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7012
7214
  hostSetScopeId(el, slotScopeIds[i]);
7013
7215
  }
7014
7216
  }
7015
- if (parentComponent) {
7016
- let subTree = parentComponent.subTree;
7217
+ let subTree = parentComponent && parentComponent.subTree;
7218
+ if (subTree) {
7017
7219
  if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
7018
7220
  const parentVNode = parentComponent.vnode;
7019
7221
  setScopeId(
@@ -7116,10 +7318,14 @@ function baseCreateRenderer(options, createHydrationFns) {
7116
7318
  patchProps(el, oldProps, newProps, parentComponent, namespace);
7117
7319
  }
7118
7320
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
7119
- queuePostRenderEffect(() => {
7120
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7121
- dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
7122
- }, parentSuspense);
7321
+ queuePostRenderEffect(
7322
+ () => {
7323
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7324
+ dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
7325
+ },
7326
+ void 0,
7327
+ parentSuspense
7328
+ );
7123
7329
  }
7124
7330
  };
7125
7331
  const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
@@ -7250,7 +7456,22 @@ function baseCreateRenderer(options, createHydrationFns) {
7250
7456
  };
7251
7457
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7252
7458
  n2.slotScopeIds = slotScopeIds;
7253
- if (n1 == null) {
7459
+ if (n2.type.__vapor) {
7460
+ if (n1 == null) {
7461
+ getVaporInterface(parentComponent, n2).mount(
7462
+ n2,
7463
+ container,
7464
+ anchor,
7465
+ parentComponent
7466
+ );
7467
+ } else {
7468
+ getVaporInterface(parentComponent, n2).update(
7469
+ n1,
7470
+ n2,
7471
+ shouldUpdateComponent(n1, n2, optimized)
7472
+ );
7473
+ }
7474
+ } else if (n1 == null) {
7254
7475
  if (n2.shapeFlag & 512) {
7255
7476
  parentComponent.ctx.activate(
7256
7477
  n2,
@@ -7313,15 +7534,48 @@ function baseCreateRenderer(options, createHydrationFns) {
7313
7534
  return;
7314
7535
  } else {
7315
7536
  instance.next = n2;
7316
- instance.update();
7537
+ instance.effect.run();
7317
7538
  }
7318
7539
  } else {
7319
7540
  n2.el = n1.el;
7320
7541
  instance.vnode = n2;
7321
7542
  }
7322
7543
  };
7323
- const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
7324
- const componentUpdateFn = () => {
7544
+ class SetupRenderEffect extends ReactiveEffect {
7545
+ constructor(instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) {
7546
+ const prevScope = setCurrentScope(instance.scope);
7547
+ super();
7548
+ this.instance = instance;
7549
+ this.initialVNode = initialVNode;
7550
+ this.container = container;
7551
+ this.anchor = anchor;
7552
+ this.parentSuspense = parentSuspense;
7553
+ this.namespace = namespace;
7554
+ this.optimized = optimized;
7555
+ setCurrentScope(prevScope);
7556
+ this.job = instance.job = () => {
7557
+ if (this.dirty) {
7558
+ this.run();
7559
+ }
7560
+ };
7561
+ this.job.i = instance;
7562
+ }
7563
+ notify() {
7564
+ if (!(this.flags & 256)) {
7565
+ const job = this.job;
7566
+ queueJob(job, job.i.uid);
7567
+ }
7568
+ }
7569
+ fn() {
7570
+ const {
7571
+ instance,
7572
+ initialVNode,
7573
+ container,
7574
+ anchor,
7575
+ parentSuspense,
7576
+ namespace,
7577
+ optimized
7578
+ } = this;
7325
7579
  if (!instance.isMounted) {
7326
7580
  let vnodeHook;
7327
7581
  const { el, props } = initialVNode;
@@ -7359,7 +7613,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7359
7613
  hydrateSubTree();
7360
7614
  }
7361
7615
  } else {
7362
- if (root.ce) {
7616
+ if (root.ce && // @ts-expect-error _def is private
7617
+ root.ce._def.shadowRoot !== false) {
7363
7618
  root.ce._injectChildStyle(type);
7364
7619
  }
7365
7620
  const subTree = instance.subTree = renderComponentRoot(instance);
@@ -7375,32 +7630,35 @@ function baseCreateRenderer(options, createHydrationFns) {
7375
7630
  initialVNode.el = subTree.el;
7376
7631
  }
7377
7632
  if (m) {
7378
- queuePostRenderEffect(m, parentSuspense);
7633
+ queuePostRenderEffect(m, void 0, parentSuspense);
7379
7634
  }
7380
7635
  if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
7381
7636
  const scopedInitialVNode = initialVNode;
7382
7637
  queuePostRenderEffect(
7383
7638
  () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
7639
+ void 0,
7384
7640
  parentSuspense
7385
7641
  );
7386
7642
  }
7387
7643
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
7388
7644
  queuePostRenderEffect(
7389
7645
  () => instance.emit("hook:mounted"),
7646
+ void 0,
7390
7647
  parentSuspense
7391
7648
  );
7392
7649
  }
7393
- if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
7394
- instance.a && queuePostRenderEffect(instance.a, parentSuspense);
7650
+ if (initialVNode.shapeFlag & 256 || parent && parent.vnode && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
7651
+ instance.a && queuePostRenderEffect(instance.a, void 0, parentSuspense);
7395
7652
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
7396
7653
  queuePostRenderEffect(
7397
7654
  () => instance.emit("hook:activated"),
7655
+ void 0,
7398
7656
  parentSuspense
7399
7657
  );
7400
7658
  }
7401
7659
  }
7402
7660
  instance.isMounted = true;
7403
- initialVNode = container = anchor = null;
7661
+ this.initialVNode = this.container = this.anchor = null;
7404
7662
  } else {
7405
7663
  let { next, bu, u, parent, vnode } = instance;
7406
7664
  {
@@ -7412,7 +7670,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7412
7670
  }
7413
7671
  nonHydratedAsyncRoot.asyncDep.then(() => {
7414
7672
  if (!instance.isUnmounted) {
7415
- componentUpdateFn();
7673
+ this.fn();
7416
7674
  }
7417
7675
  });
7418
7676
  return;
@@ -7456,32 +7714,38 @@ function baseCreateRenderer(options, createHydrationFns) {
7456
7714
  updateHOCHostEl(instance, nextTree.el);
7457
7715
  }
7458
7716
  if (u) {
7459
- queuePostRenderEffect(u, parentSuspense);
7717
+ queuePostRenderEffect(u, void 0, parentSuspense);
7460
7718
  }
7461
7719
  if (vnodeHook = next.props && next.props.onVnodeUpdated) {
7462
7720
  queuePostRenderEffect(
7463
7721
  () => invokeVNodeHook(vnodeHook, parent, next, vnode),
7722
+ void 0,
7464
7723
  parentSuspense
7465
7724
  );
7466
7725
  }
7467
7726
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
7468
7727
  queuePostRenderEffect(
7469
7728
  () => instance.emit("hook:updated"),
7729
+ void 0,
7470
7730
  parentSuspense
7471
7731
  );
7472
7732
  }
7473
7733
  }
7474
- };
7475
- instance.scope.on();
7476
- const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
7477
- instance.scope.off();
7478
- const update = instance.update = effect.run.bind(effect);
7479
- const job = instance.job = effect.runIfDirty.bind(effect);
7480
- job.i = instance;
7481
- job.id = instance.uid;
7482
- effect.scheduler = () => queueJob(job);
7734
+ }
7735
+ }
7736
+ const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
7737
+ const effect = instance.effect = new SetupRenderEffect(
7738
+ instance,
7739
+ initialVNode,
7740
+ container,
7741
+ anchor,
7742
+ parentSuspense,
7743
+ namespace,
7744
+ optimized
7745
+ );
7746
+ instance.update = effect.run.bind(effect);
7483
7747
  toggleRecurse(instance, true);
7484
- update();
7748
+ effect.run();
7485
7749
  };
7486
7750
  const updateComponentPreRender = (instance, nextVNode, optimized) => {
7487
7751
  nextVNode.component = instance;
@@ -7490,9 +7754,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7490
7754
  instance.next = null;
7491
7755
  updateProps(instance, nextVNode.props, prevProps, optimized);
7492
7756
  updateSlots(instance, nextVNode.children, optimized);
7493
- pauseTracking();
7757
+ const prevSub = setActiveSub();
7494
7758
  flushPreFlushCbs(instance);
7495
- resetTracking();
7759
+ setActiveSub(prevSub);
7496
7760
  };
7497
7761
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
7498
7762
  const c1 = n1 && n1.children;
@@ -7762,7 +8026,13 @@ function baseCreateRenderer(options, createHydrationFns) {
7762
8026
  );
7763
8027
  } else if (moved) {
7764
8028
  if (j < 0 || i !== increasingNewIndexSequence[j]) {
7765
- move(nextChild, container, anchor, 2);
8029
+ move(
8030
+ nextChild,
8031
+ container,
8032
+ anchor,
8033
+ 2,
8034
+ parentComponent
8035
+ );
7766
8036
  } else {
7767
8037
  j--;
7768
8038
  }
@@ -7770,10 +8040,20 @@ function baseCreateRenderer(options, createHydrationFns) {
7770
8040
  }
7771
8041
  }
7772
8042
  };
7773
- const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
8043
+ const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
7774
8044
  const { el, type, transition, children, shapeFlag } = vnode;
7775
8045
  if (shapeFlag & 6) {
7776
- move(vnode.component.subTree, container, anchor, moveType);
8046
+ if (type.__vapor) {
8047
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
8048
+ } else {
8049
+ move(
8050
+ vnode.component.subTree,
8051
+ container,
8052
+ anchor,
8053
+ moveType,
8054
+ parentComponent
8055
+ );
8056
+ }
7777
8057
  return;
7778
8058
  }
7779
8059
  if (shapeFlag & 128) {
@@ -7781,13 +8061,25 @@ function baseCreateRenderer(options, createHydrationFns) {
7781
8061
  return;
7782
8062
  }
7783
8063
  if (shapeFlag & 64) {
7784
- type.move(vnode, container, anchor, internals);
8064
+ type.move(
8065
+ vnode,
8066
+ container,
8067
+ anchor,
8068
+ internals,
8069
+ parentComponent
8070
+ );
7785
8071
  return;
7786
8072
  }
7787
8073
  if (type === Fragment) {
7788
8074
  hostInsert(el, container, anchor);
7789
8075
  for (let i = 0; i < children.length; i++) {
7790
- move(children[i], container, anchor, moveType);
8076
+ move(
8077
+ children[i],
8078
+ container,
8079
+ anchor,
8080
+ moveType,
8081
+ parentComponent
8082
+ );
7791
8083
  }
7792
8084
  hostInsert(vnode.anchor, container, anchor);
7793
8085
  return;
@@ -7801,7 +8093,11 @@ function baseCreateRenderer(options, createHydrationFns) {
7801
8093
  if (moveType === 0) {
7802
8094
  transition.beforeEnter(el);
7803
8095
  hostInsert(el, container, anchor);
7804
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
8096
+ queuePostRenderEffect(
8097
+ () => transition.enter(el),
8098
+ void 0,
8099
+ parentSuspense
8100
+ );
7805
8101
  } else {
7806
8102
  const { leave, delayLeave, afterLeave } = transition;
7807
8103
  const remove2 = () => {
@@ -7843,9 +8139,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7843
8139
  optimized = false;
7844
8140
  }
7845
8141
  if (ref != null) {
7846
- pauseTracking();
8142
+ const prevSub = setActiveSub();
7847
8143
  setRef(ref, null, parentSuspense, vnode, true);
7848
- resetTracking();
8144
+ setActiveSub(prevSub);
7849
8145
  }
7850
8146
  if (cacheIndex != null) {
7851
8147
  parentComponent.renderCache[cacheIndex] = void 0;
@@ -7861,7 +8157,12 @@ function baseCreateRenderer(options, createHydrationFns) {
7861
8157
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
7862
8158
  }
7863
8159
  if (shapeFlag & 6) {
7864
- unmountComponent(vnode.component, parentSuspense, doRemove);
8160
+ if (type.__vapor) {
8161
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8162
+ return;
8163
+ } else {
8164
+ unmountComponent(vnode.component, parentSuspense, doRemove);
8165
+ }
7865
8166
  } else {
7866
8167
  if (shapeFlag & 128) {
7867
8168
  vnode.suspense.unmount(parentSuspense, doRemove);
@@ -7895,15 +8196,23 @@ function baseCreateRenderer(options, createHydrationFns) {
7895
8196
  } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
7896
8197
  unmountChildren(children, parentComponent, parentSuspense);
7897
8198
  }
8199
+ if (type === VaporSlot) {
8200
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8201
+ return;
8202
+ }
7898
8203
  if (doRemove) {
7899
8204
  remove(vnode);
7900
8205
  }
7901
8206
  }
7902
8207
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
7903
- queuePostRenderEffect(() => {
7904
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7905
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
7906
- }, parentSuspense);
8208
+ queuePostRenderEffect(
8209
+ () => {
8210
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
8211
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8212
+ },
8213
+ void 0,
8214
+ parentSuspense
8215
+ );
7907
8216
  }
7908
8217
  };
7909
8218
  const remove = (vnode) => {
@@ -7949,7 +8258,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7949
8258
  const {
7950
8259
  bum,
7951
8260
  scope,
7952
- job,
8261
+ effect,
7953
8262
  subTree,
7954
8263
  um,
7955
8264
  m,
@@ -7971,22 +8280,25 @@ function baseCreateRenderer(options, createHydrationFns) {
7971
8280
  instance.emit("hook:beforeDestroy");
7972
8281
  }
7973
8282
  scope.stop();
7974
- if (job) {
7975
- job.flags |= 8;
8283
+ if (effect) {
8284
+ effect.stop();
7976
8285
  unmount(subTree, instance, parentSuspense, doRemove);
7977
8286
  }
7978
8287
  if (um) {
7979
- queuePostRenderEffect(um, parentSuspense);
8288
+ queuePostRenderEffect(um, void 0, parentSuspense);
7980
8289
  }
7981
8290
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
7982
8291
  queuePostRenderEffect(
7983
8292
  () => instance.emit("hook:destroyed"),
8293
+ void 0,
7984
8294
  parentSuspense
7985
8295
  );
7986
8296
  }
7987
- queuePostRenderEffect(() => {
7988
- instance.isUnmounted = true;
7989
- }, parentSuspense);
8297
+ queuePostRenderEffect(
8298
+ () => instance.isUnmounted = true,
8299
+ void 0,
8300
+ parentSuspense
8301
+ );
7990
8302
  if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
7991
8303
  parentSuspense.deps--;
7992
8304
  if (parentSuspense.deps === 0) {
@@ -8001,6 +8313,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8001
8313
  };
8002
8314
  const getNextHostNode = (vnode) => {
8003
8315
  if (vnode.shapeFlag & 6) {
8316
+ if (vnode.type.__vapor) {
8317
+ return hostNextSibling(vnode.component.block);
8318
+ }
8004
8319
  return getNextHostNode(vnode.component.subTree);
8005
8320
  }
8006
8321
  if (vnode.shapeFlag & 128) {
@@ -8010,7 +8325,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8010
8325
  const teleportEnd = el && el[TeleportEndKey];
8011
8326
  return teleportEnd ? hostNextSibling(teleportEnd) : el;
8012
8327
  };
8013
- let isFlushing = false;
8014
8328
  const render = (vnode, container, namespace) => {
8015
8329
  if (vnode == null) {
8016
8330
  if (container._vnode) {
@@ -8028,12 +8342,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8028
8342
  );
8029
8343
  }
8030
8344
  container._vnode = vnode;
8031
- if (!isFlushing) {
8032
- isFlushing = true;
8033
- flushPreFlushCbs();
8034
- flushPostFlushCbs();
8035
- isFlushing = false;
8036
- }
8345
+ flushOnAppMount();
8037
8346
  };
8038
8347
  const internals = {
8039
8348
  p: patch,
@@ -8041,6 +8350,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8041
8350
  m: move,
8042
8351
  r: remove,
8043
8352
  mt: mountComponent,
8353
+ umt: unmountComponent,
8044
8354
  mc: mountChildren,
8045
8355
  pc: patchChildren,
8046
8356
  pbc: patchBlockChildren,
@@ -8054,22 +8364,48 @@ function baseCreateRenderer(options, createHydrationFns) {
8054
8364
  internals
8055
8365
  );
8056
8366
  }
8367
+ const mountApp = (app, container, isHydrate, namespace) => {
8368
+ const vnode = app._ceVNode || createVNode(app._component, app._props);
8369
+ vnode.appContext = app._context;
8370
+ if (namespace === true) {
8371
+ namespace = "svg";
8372
+ } else if (namespace === false) {
8373
+ namespace = void 0;
8374
+ }
8375
+ if (isHydrate && hydrate) {
8376
+ hydrate(vnode, container);
8377
+ } else {
8378
+ render(vnode, container, namespace);
8379
+ }
8380
+ return vnode.component;
8381
+ };
8382
+ const unmountApp = (app) => {
8383
+ render(null, app._container);
8384
+ };
8057
8385
  return {
8058
8386
  render,
8059
8387
  hydrate,
8060
- createApp: createAppAPI(render, hydrate)
8388
+ internals,
8389
+ createApp: createAppAPI(
8390
+ mountApp,
8391
+ unmountApp,
8392
+ getComponentPublicInstance,
8393
+ render
8394
+ )
8061
8395
  };
8062
8396
  }
8063
8397
  function resolveChildrenNamespace({ type, props }, currentNamespace) {
8064
8398
  return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
8065
8399
  }
8066
- function toggleRecurse({ effect, job }, allowed) {
8067
- if (allowed) {
8068
- effect.flags |= 32;
8069
- job.flags |= 4;
8070
- } else {
8071
- effect.flags &= -33;
8072
- job.flags &= -5;
8400
+ function toggleRecurse({ effect, job, vapor }, allowed) {
8401
+ if (!vapor) {
8402
+ if (allowed) {
8403
+ effect.flags |= 128;
8404
+ job.flags |= 2;
8405
+ } else {
8406
+ effect.flags &= -129;
8407
+ job.flags &= -3;
8408
+ }
8073
8409
  }
8074
8410
  }
8075
8411
  function needTransition(parentSuspense, transition) {
@@ -8099,48 +8435,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
8099
8435
  }
8100
8436
  }
8101
8437
  }
8102
- function getSequence(arr) {
8103
- const p = arr.slice();
8104
- const result = [0];
8105
- let i, j, u, v, c;
8106
- const len = arr.length;
8107
- for (i = 0; i < len; i++) {
8108
- const arrI = arr[i];
8109
- if (arrI !== 0) {
8110
- j = result[result.length - 1];
8111
- if (arr[j] < arrI) {
8112
- p[i] = j;
8113
- result.push(i);
8114
- continue;
8115
- }
8116
- u = 0;
8117
- v = result.length - 1;
8118
- while (u < v) {
8119
- c = u + v >> 1;
8120
- if (arr[result[c]] < arrI) {
8121
- u = c + 1;
8122
- } else {
8123
- v = c;
8124
- }
8125
- }
8126
- if (arrI < arr[result[u]]) {
8127
- if (u > 0) {
8128
- p[i] = result[u - 1];
8129
- }
8130
- result[u] = i;
8131
- }
8132
- }
8133
- }
8134
- u = result.length;
8135
- v = result[u - 1];
8136
- while (u-- > 0) {
8137
- result[u] = v;
8138
- v = p[v];
8139
- }
8140
- return result;
8141
- }
8142
8438
  function locateNonHydratedAsyncRoot(instance) {
8143
- const subComponent = instance.subTree.component;
8439
+ const subComponent = instance.vapor ? null : instance.subTree.component;
8144
8440
  if (subComponent) {
8145
8441
  if (subComponent.asyncDep && !subComponent.asyncResolved) {
8146
8442
  return subComponent;
@@ -8152,9 +8448,14 @@ function locateNonHydratedAsyncRoot(instance) {
8152
8448
  function invalidateMount(hooks) {
8153
8449
  if (hooks) {
8154
8450
  for (let i = 0; i < hooks.length; i++)
8155
- hooks[i].flags |= 8;
8451
+ hooks[i].flags |= 4;
8156
8452
  }
8157
8453
  }
8454
+ function getVaporInterface(instance, vnode) {
8455
+ const ctx = instance ? instance.appContext : vnode.appContext;
8456
+ const res = ctx && ctx.vapor;
8457
+ return res;
8458
+ }
8158
8459
 
8159
8460
  const ssrContextKey = Symbol.for("v-scx");
8160
8461
  const useSSRContext = () => {
@@ -8184,9 +8485,42 @@ function watchSyncEffect(effect, options) {
8184
8485
  function watch(source, cb, options) {
8185
8486
  return doWatch(source, cb, options);
8186
8487
  }
8488
+ class RenderWatcherEffect extends WatcherEffect {
8489
+ constructor(instance, source, cb, options, flush) {
8490
+ super(source, cb, options);
8491
+ this.flush = flush;
8492
+ const job = () => {
8493
+ if (this.dirty) {
8494
+ this.run();
8495
+ }
8496
+ };
8497
+ if (cb) {
8498
+ this.flags |= 128;
8499
+ job.flags |= 2;
8500
+ }
8501
+ if (instance) {
8502
+ job.i = instance;
8503
+ }
8504
+ this.job = job;
8505
+ }
8506
+ notify() {
8507
+ const flags = this.flags;
8508
+ if (!(flags & 256)) {
8509
+ const flush = this.flush;
8510
+ const job = this.job;
8511
+ if (flush === "post") {
8512
+ queuePostRenderEffect(job, void 0, job.i ? job.i.suspense : null);
8513
+ } else if (flush === "pre") {
8514
+ queueJob(job, job.i ? job.i.uid : void 0, true);
8515
+ } else {
8516
+ job();
8517
+ }
8518
+ }
8519
+ }
8520
+ }
8187
8521
  function doWatch(source, cb, options = EMPTY_OBJ) {
8188
- const { immediate, deep, flush, once } = options;
8189
- const baseWatchOptions = extend$1({}, options);
8522
+ const { immediate, deep, flush = "pre", once } = options;
8523
+ const baseWatchOptions = extend({}, options);
8190
8524
  const runsImmediately = cb && immediate || !cb && flush !== "post";
8191
8525
  let ssrCleanup;
8192
8526
  if (isInSSRComponentSetup) {
@@ -8204,42 +8538,32 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
8204
8538
  }
8205
8539
  const instance = currentInstance;
8206
8540
  baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
8207
- let isPre = false;
8208
- if (flush === "post") {
8209
- baseWatchOptions.scheduler = (job) => {
8210
- queuePostRenderEffect(job, instance && instance.suspense);
8211
- };
8212
- } else if (flush !== "sync") {
8213
- isPre = true;
8214
- baseWatchOptions.scheduler = (job, isFirstRun) => {
8215
- if (isFirstRun) {
8216
- job();
8217
- } else {
8218
- queueJob(job);
8219
- }
8220
- };
8541
+ const effect = new RenderWatcherEffect(
8542
+ instance,
8543
+ source,
8544
+ cb,
8545
+ baseWatchOptions,
8546
+ flush
8547
+ );
8548
+ if (cb) {
8549
+ effect.run(true);
8550
+ } else if (flush === "post") {
8551
+ queuePostRenderEffect(effect.job, void 0, instance && instance.suspense);
8552
+ } else {
8553
+ effect.run(true);
8221
8554
  }
8222
- baseWatchOptions.augmentJob = (job) => {
8223
- if (cb) {
8224
- job.flags |= 4;
8225
- }
8226
- if (isPre) {
8227
- job.flags |= 2;
8228
- if (instance) {
8229
- job.id = instance.uid;
8230
- job.i = instance;
8231
- }
8232
- }
8233
- };
8234
- const watchHandle = watch$1(source, cb, baseWatchOptions);
8555
+ const stop = effect.stop.bind(effect);
8556
+ stop.pause = effect.pause.bind(effect);
8557
+ stop.resume = effect.resume.bind(effect);
8558
+ stop.stop = stop;
8235
8559
  if (isInSSRComponentSetup) {
8236
8560
  if (ssrCleanup) {
8237
- ssrCleanup.push(watchHandle);
8561
+ ssrCleanup.push(stop);
8238
8562
  } else if (runsImmediately) {
8239
- watchHandle();
8563
+ stop();
8240
8564
  }
8241
8565
  }
8242
- return watchHandle;
8566
+ return stop;
8243
8567
  }
8244
8568
  function instanceWatch(source, value, options) {
8245
8569
  const publicThis = this.proxy;
@@ -8251,9 +8575,9 @@ function instanceWatch(source, value, options) {
8251
8575
  cb = value.handler;
8252
8576
  options = value;
8253
8577
  }
8254
- const reset = setCurrentInstance(this);
8578
+ const prev = setCurrentInstance(this);
8255
8579
  const res = doWatch(getter, cb.bind(publicThis), options);
8256
- reset();
8580
+ setCurrentInstance(...prev);
8257
8581
  return res;
8258
8582
  }
8259
8583
  function createPathGetter(ctx, path) {
@@ -8268,10 +8592,10 @@ function createPathGetter(ctx, path) {
8268
8592
  }
8269
8593
 
8270
8594
  function useModel(props, name, options = EMPTY_OBJ) {
8271
- const i = getCurrentInstance();
8595
+ const i = getCurrentGenericInstance();
8272
8596
  const camelizedName = camelize(name);
8273
8597
  const hyphenatedName = hyphenate(name);
8274
- const modifiers = getModelModifiers(props, camelizedName);
8598
+ const modifiers = getModelModifiers(props, camelizedName, defaultPropGetter);
8275
8599
  const res = customRef((track, trigger) => {
8276
8600
  let localValue;
8277
8601
  let prevSetValue = EMPTY_OBJ;
@@ -8293,9 +8617,25 @@ function useModel(props, name, options = EMPTY_OBJ) {
8293
8617
  if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
8294
8618
  return;
8295
8619
  }
8296
- const rawProps = i.vnode.props;
8297
- if (!(rawProps && // check if parent has passed v-model
8298
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
8620
+ let rawPropKeys;
8621
+ let parentPassedModelValue = false;
8622
+ let parentPassedModelUpdater = false;
8623
+ if (i.rawKeys) {
8624
+ rawPropKeys = i.rawKeys();
8625
+ } else {
8626
+ const rawProps = i.vnode.props;
8627
+ rawPropKeys = rawProps && Object.keys(rawProps);
8628
+ }
8629
+ if (rawPropKeys) {
8630
+ for (const key of rawPropKeys) {
8631
+ if (key === name || key === camelizedName || key === hyphenatedName) {
8632
+ parentPassedModelValue = true;
8633
+ } else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) {
8634
+ parentPassedModelUpdater = true;
8635
+ }
8636
+ }
8637
+ }
8638
+ if (!parentPassedModelValue || !parentPassedModelUpdater) {
8299
8639
  localValue = value;
8300
8640
  trigger();
8301
8641
  }
@@ -8322,16 +8662,25 @@ function useModel(props, name, options = EMPTY_OBJ) {
8322
8662
  };
8323
8663
  return res;
8324
8664
  }
8325
- const getModelModifiers = (props, modelName) => {
8326
- return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
8665
+ const getModelModifiers = (props, modelName, getter) => {
8666
+ return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
8327
8667
  };
8328
8668
 
8329
8669
  function emit(instance, event, ...rawArgs) {
8670
+ return baseEmit(
8671
+ instance,
8672
+ instance.vnode.props || EMPTY_OBJ,
8673
+ defaultPropGetter,
8674
+ event,
8675
+ ...rawArgs
8676
+ );
8677
+ }
8678
+ function baseEmit(instance, props, getter, event, ...rawArgs) {
8330
8679
  if (instance.isUnmounted) return;
8331
- const props = instance.vnode.props || EMPTY_OBJ;
8332
8680
  let args = rawArgs;
8333
- const isModelListener = event.startsWith("update:");
8334
- const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
8681
+ const isCompatModelListener = compatModelEventPrefix + event in props;
8682
+ const isModelListener = isCompatModelListener || event.startsWith("update:");
8683
+ const modifiers = isCompatModelListener ? props.modelModifiers : isModelListener && getModelModifiers(props, event.slice(7), getter);
8335
8684
  if (modifiers) {
8336
8685
  if (modifiers.trim) {
8337
8686
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
@@ -8341,10 +8690,10 @@ function emit(instance, event, ...rawArgs) {
8341
8690
  }
8342
8691
  }
8343
8692
  let handlerName;
8344
- let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
8345
- props[handlerName = toHandlerKey(camelize(event))];
8693
+ let handler = getter(props, handlerName = toHandlerKey(event)) || // also try camelCase event handler (#2249)
8694
+ getter(props, handlerName = toHandlerKey(camelize(event)));
8346
8695
  if (!handler && isModelListener) {
8347
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
8696
+ handler = getter(props, handlerName = toHandlerKey(hyphenate(event)));
8348
8697
  }
8349
8698
  if (handler) {
8350
8699
  callWithAsyncErrorHandling(
@@ -8354,7 +8703,7 @@ function emit(instance, event, ...rawArgs) {
8354
8703
  args
8355
8704
  );
8356
8705
  }
8357
- const onceHandler = props[handlerName + `Once`];
8706
+ const onceHandler = getter(props, handlerName + `Once`);
8358
8707
  if (onceHandler) {
8359
8708
  if (!instance.emitted) {
8360
8709
  instance.emitted = {};
@@ -8369,11 +8718,18 @@ function emit(instance, event, ...rawArgs) {
8369
8718
  args
8370
8719
  );
8371
8720
  }
8372
- {
8721
+ if (args) {
8373
8722
  compatModelEmit(instance, event, args);
8374
- return emit$1(instance, event, args);
8723
+ return emit$1(
8724
+ instance,
8725
+ event,
8726
+ args
8727
+ );
8375
8728
  }
8376
8729
  }
8730
+ function defaultPropGetter(props, key) {
8731
+ return props[key];
8732
+ }
8377
8733
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
8378
8734
  const cache = appContext.emitsCache;
8379
8735
  const cached = cache.get(comp);
@@ -8388,7 +8744,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
8388
8744
  const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
8389
8745
  if (normalizedFromExtend) {
8390
8746
  hasExtends = true;
8391
- extend$1(normalized, normalizedFromExtend);
8747
+ extend(normalized, normalizedFromExtend);
8392
8748
  }
8393
8749
  };
8394
8750
  if (!asMixin && appContext.mixins.length) {
@@ -8410,7 +8766,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
8410
8766
  if (isArray(raw)) {
8411
8767
  raw.forEach((key) => normalized[key] = null);
8412
8768
  } else {
8413
- extend$1(normalized, raw);
8769
+ extend(normalized, raw);
8414
8770
  }
8415
8771
  if (isObject(comp)) {
8416
8772
  cache.set(comp, normalized);
@@ -8639,7 +8995,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
8639
8995
  return false;
8640
8996
  }
8641
8997
  function updateHOCHostEl({ vnode, parent }, el) {
8642
- while (parent) {
8998
+ while (parent && !parent.vapor) {
8643
8999
  const root = parent.subTree;
8644
9000
  if (root.suspense && root.suspense.activeBranch === vnode) {
8645
9001
  root.el = vnode.el;
@@ -8968,7 +9324,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8968
9324
  pendingBranch,
8969
9325
  container2,
8970
9326
  anchor === initialAnchor ? next(activeBranch) : anchor,
8971
- 0
9327
+ 0,
9328
+ parentComponent2
8972
9329
  );
8973
9330
  queuePostFlushCb(effects);
8974
9331
  }
@@ -8981,7 +9338,13 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8981
9338
  unmount(activeBranch, parentComponent2, suspense, true);
8982
9339
  }
8983
9340
  if (!delayEnter) {
8984
- move(pendingBranch, container2, anchor, 0);
9341
+ move(
9342
+ pendingBranch,
9343
+ container2,
9344
+ anchor,
9345
+ 0,
9346
+ parentComponent2
9347
+ );
8985
9348
  }
8986
9349
  }
8987
9350
  setActiveBranch(suspense, pendingBranch);
@@ -9054,7 +9417,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9054
9417
  }
9055
9418
  },
9056
9419
  move(container2, anchor2, type) {
9057
- suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
9420
+ suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type, parentComponent);
9058
9421
  suspense.container = container2;
9059
9422
  },
9060
9423
  next() {
@@ -9185,7 +9548,7 @@ function normalizeSuspenseSlot(s) {
9185
9548
  }
9186
9549
  return s;
9187
9550
  }
9188
- function queueEffectWithSuspense(fn, suspense) {
9551
+ function queueEffectWithSuspense(fn, id, suspense) {
9189
9552
  if (suspense && suspense.pendingBranch) {
9190
9553
  if (isArray(fn)) {
9191
9554
  suspense.effects.push(...fn);
@@ -9193,7 +9556,7 @@ function queueEffectWithSuspense(fn, suspense) {
9193
9556
  suspense.effects.push(fn);
9194
9557
  }
9195
9558
  } else {
9196
- queuePostFlushCb(fn);
9559
+ queuePostFlushCb(fn, id);
9197
9560
  }
9198
9561
  }
9199
9562
  function setActiveBranch(suspense, branch) {
@@ -9276,6 +9639,7 @@ const Fragment = Symbol.for("v-fgt");
9276
9639
  const Text = Symbol.for("v-txt");
9277
9640
  const Comment = Symbol.for("v-cmt");
9278
9641
  const Static = Symbol.for("v-stc");
9642
+ const VaporSlot = Symbol.for("v-vps");
9279
9643
  const blockStack = [];
9280
9644
  let currentBlock = null;
9281
9645
  function openBlock(disableTracking = false) {
@@ -9438,7 +9802,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
9438
9802
  }
9439
9803
  if (isObject(style)) {
9440
9804
  if (isProxy(style) && !isArray(style)) {
9441
- style = extend$1({}, style);
9805
+ style = extend({}, style);
9442
9806
  }
9443
9807
  props.style = normalizeStyle(style);
9444
9808
  }
@@ -9457,7 +9821,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
9457
9821
  }
9458
9822
  function guardReactiveProps(props) {
9459
9823
  if (!props) return null;
9460
- return isProxy(props) || isInternalObject(props) ? extend$1({}, props) : props;
9824
+ return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
9461
9825
  }
9462
9826
  function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
9463
9827
  const { props, ref, patchFlag, children, transition } = vnode;
@@ -9622,6 +9986,40 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
9622
9986
  ]);
9623
9987
  }
9624
9988
 
9989
+ let currentInstance = null;
9990
+ const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
9991
+ const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
9992
+ let isInSSRComponentSetup = false;
9993
+ let setInSSRSetupState;
9994
+ let simpleSetCurrentInstance;
9995
+ {
9996
+ const g = getGlobalThis();
9997
+ const registerGlobalSetter = (key, setter) => {
9998
+ let setters;
9999
+ if (!(setters = g[key])) setters = g[key] = [];
10000
+ setters.push(setter);
10001
+ return (v) => {
10002
+ if (setters.length > 1) setters.forEach((set) => set(v));
10003
+ else setters[0](v);
10004
+ };
10005
+ };
10006
+ simpleSetCurrentInstance = registerGlobalSetter(
10007
+ `__VUE_INSTANCE_SETTERS__`,
10008
+ (v) => currentInstance = v
10009
+ );
10010
+ setInSSRSetupState = registerGlobalSetter(
10011
+ `__VUE_SSR_SETTERS__`,
10012
+ (v) => isInSSRComponentSetup = v
10013
+ );
10014
+ }
10015
+ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope : void 0) => {
10016
+ try {
10017
+ return [currentInstance, setCurrentScope(scope)];
10018
+ } finally {
10019
+ simpleSetCurrentInstance(instance);
10020
+ }
10021
+ };
10022
+
9625
10023
  const emptyAppContext = createAppContext();
9626
10024
  let uid = 0;
9627
10025
  function createComponentInstance(vnode, parent, suspense) {
@@ -9666,7 +10064,7 @@ function createComponentInstance(vnode, parent, suspense) {
9666
10064
  // to be set immediately
9667
10065
  emitted: null,
9668
10066
  // props default value
9669
- propsDefaults: EMPTY_OBJ,
10067
+ propsDefaults: null,
9670
10068
  // inheritAttrs
9671
10069
  inheritAttrs: type.inheritAttrs,
9672
10070
  // state
@@ -9713,53 +10111,19 @@ function createComponentInstance(vnode, parent, suspense) {
9713
10111
  }
9714
10112
  return instance;
9715
10113
  }
9716
- let currentInstance = null;
9717
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
9718
- let internalSetCurrentInstance;
9719
- let setInSSRSetupState;
9720
- {
9721
- const g = getGlobalThis();
9722
- const registerGlobalSetter = (key, setter) => {
9723
- let setters;
9724
- if (!(setters = g[key])) setters = g[key] = [];
9725
- setters.push(setter);
9726
- return (v) => {
9727
- if (setters.length > 1) setters.forEach((set) => set(v));
9728
- else setters[0](v);
9729
- };
9730
- };
9731
- internalSetCurrentInstance = registerGlobalSetter(
9732
- `__VUE_INSTANCE_SETTERS__`,
9733
- (v) => currentInstance = v
9734
- );
9735
- setInSSRSetupState = registerGlobalSetter(
9736
- `__VUE_SSR_SETTERS__`,
9737
- (v) => isInSSRComponentSetup = v
9738
- );
9739
- }
9740
- const setCurrentInstance = (instance) => {
9741
- const prev = currentInstance;
9742
- internalSetCurrentInstance(instance);
9743
- instance.scope.on();
9744
- return () => {
9745
- instance.scope.off();
9746
- internalSetCurrentInstance(prev);
9747
- };
9748
- };
9749
- const unsetCurrentInstance = () => {
9750
- currentInstance && currentInstance.scope.off();
9751
- internalSetCurrentInstance(null);
9752
- };
9753
10114
  function isStatefulComponent(instance) {
9754
10115
  return instance.vnode.shapeFlag & 4;
9755
10116
  }
9756
- let isInSSRComponentSetup = false;
9757
10117
  function setupComponent(instance, isSSR = false, optimized = false) {
9758
10118
  isSSR && setInSSRSetupState(isSSR);
9759
- const { props, children } = instance.vnode;
10119
+ const { props, children, vi } = instance.vnode;
9760
10120
  const isStateful = isStatefulComponent(instance);
9761
- initProps(instance, props, isStateful, isSSR);
9762
- initSlots(instance, children, optimized || isSSR);
10121
+ if (vi) {
10122
+ vi(instance);
10123
+ } else {
10124
+ initProps(instance, props, isStateful, isSSR);
10125
+ initSlots(instance, children, optimized || isSSR);
10126
+ }
9763
10127
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
9764
10128
  isSSR && setInSSRSetupState(false);
9765
10129
  return setupResult;
@@ -9770,9 +10134,9 @@ function setupStatefulComponent(instance, isSSR) {
9770
10134
  instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9771
10135
  const { setup } = Component;
9772
10136
  if (setup) {
9773
- pauseTracking();
10137
+ const prevSub = setActiveSub();
9774
10138
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
9775
- const reset = setCurrentInstance(instance);
10139
+ const prev = setCurrentInstance(instance);
9776
10140
  const setupResult = callWithErrorHandling(
9777
10141
  setup,
9778
10142
  instance,
@@ -9783,12 +10147,15 @@ function setupStatefulComponent(instance, isSSR) {
9783
10147
  ]
9784
10148
  );
9785
10149
  const isAsyncSetup = isPromise(setupResult);
9786
- resetTracking();
9787
- reset();
10150
+ setActiveSub(prevSub);
10151
+ setCurrentInstance(...prev);
9788
10152
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
9789
10153
  markAsyncBoundary(instance);
9790
10154
  }
9791
10155
  if (isAsyncSetup) {
10156
+ const unsetCurrentInstance = () => {
10157
+ setCurrentInstance(null, void 0);
10158
+ };
9792
10159
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9793
10160
  if (isSSR) {
9794
10161
  return setupResult.then((resolvedResult) => {
@@ -9840,8 +10207,8 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9840
10207
  if (template) {
9841
10208
  const { isCustomElement, compilerOptions } = instance.appContext.config;
9842
10209
  const { delimiters, compilerOptions: componentCompilerOptions } = Component;
9843
- const finalCompilerOptions = extend$1(
9844
- extend$1(
10210
+ const finalCompilerOptions = extend(
10211
+ extend(
9845
10212
  {
9846
10213
  isCustomElement,
9847
10214
  delimiters
@@ -9853,7 +10220,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9853
10220
  {
9854
10221
  finalCompilerOptions.compatConfig = Object.create(globalCompatConfig);
9855
10222
  if (Component.compatConfig) {
9856
- extend$1(finalCompilerOptions.compatConfig, Component.compatConfig);
10223
+ extend(finalCompilerOptions.compatConfig, Component.compatConfig);
9857
10224
  }
9858
10225
  }
9859
10226
  Component.render = compile$1(template, finalCompilerOptions);
@@ -9865,13 +10232,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9865
10232
  }
9866
10233
  }
9867
10234
  if (!skipOptions) {
9868
- const reset = setCurrentInstance(instance);
9869
- pauseTracking();
10235
+ const prevInstance = setCurrentInstance(instance);
10236
+ const prevSub = setActiveSub();
9870
10237
  try {
9871
10238
  applyOptions(instance);
9872
10239
  } finally {
9873
- resetTracking();
9874
- reset();
10240
+ setActiveSub(prevSub);
10241
+ setCurrentInstance(...prevInstance);
9875
10242
  }
9876
10243
  }
9877
10244
  }
@@ -9882,18 +10249,18 @@ const attrsProxyHandlers = {
9882
10249
  }
9883
10250
  };
9884
10251
  function createSetupContext(instance) {
9885
- const expose = (exposed) => {
9886
- instance.exposed = exposed || {};
9887
- };
9888
10252
  {
9889
10253
  return {
9890
10254
  attrs: new Proxy(instance.attrs, attrsProxyHandlers),
9891
10255
  slots: instance.slots,
9892
10256
  emit: instance.emit,
9893
- expose
10257
+ expose: (exposed) => expose(instance, exposed)
9894
10258
  };
9895
10259
  }
9896
10260
  }
10261
+ function expose(instance, exposed) {
10262
+ instance.exposed = exposed || {};
10263
+ }
9897
10264
  function getComponentPublicInstance(instance) {
9898
10265
  if (instance.exposed) {
9899
10266
  return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
@@ -9901,7 +10268,9 @@ function getComponentPublicInstance(instance) {
9901
10268
  if (key in target) {
9902
10269
  return target[key];
9903
10270
  } else if (key in publicPropertiesMap) {
9904
- return publicPropertiesMap[key](instance);
10271
+ return publicPropertiesMap[key](
10272
+ instance
10273
+ );
9905
10274
  }
9906
10275
  },
9907
10276
  has(target, key) {
@@ -9920,8 +10289,7 @@ function isClassComponent(value) {
9920
10289
  }
9921
10290
 
9922
10291
  const computed = (getterOrOptions, debugOptions) => {
9923
- const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9924
- return c;
10292
+ return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9925
10293
  };
9926
10294
 
9927
10295
  function h(type, propsOrChildren, children) {
@@ -9977,7 +10345,7 @@ function isMemoSame(cached, memo) {
9977
10345
  return true;
9978
10346
  }
9979
10347
 
9980
- const version = "3.5.16";
10348
+ const version = "3.6.0-alpha.2";
9981
10349
  const warn$1 = NOOP;
9982
10350
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9983
10351
  const devtools = void 0;
@@ -10107,7 +10475,7 @@ const DOMTransitionPropsValidators = {
10107
10475
  leaveActiveClass: String,
10108
10476
  leaveToClass: String
10109
10477
  };
10110
- const TransitionPropsValidators = /* @__PURE__ */ extend$1(
10478
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
10111
10479
  {},
10112
10480
  BaseTransitionPropsValidators,
10113
10481
  DOMTransitionPropsValidators
@@ -10219,7 +10587,7 @@ function resolveTransitionProps(rawProps) {
10219
10587
  });
10220
10588
  };
10221
10589
  };
10222
- return extend$1(baseProps, {
10590
+ return extend(baseProps, {
10223
10591
  onBeforeEnter(el) {
10224
10592
  callHook(onBeforeEnter, [el]);
10225
10593
  addTransitionClass(el, enterFromClass);
@@ -10517,11 +10885,11 @@ function patchStyle(el, prev, next) {
10517
10885
  }
10518
10886
  }
10519
10887
  const importantRE = /\s*!important$/;
10520
- function setStyle(style, name, val) {
10521
- if (isArray(val)) {
10522
- val.forEach((v) => setStyle(style, name, v));
10888
+ function setStyle(style, name, rawVal) {
10889
+ if (isArray(rawVal)) {
10890
+ rawVal.forEach((v) => setStyle(style, name, v));
10523
10891
  } else {
10524
- if (val == null) val = "";
10892
+ const val = rawVal == null ? "" : String(rawVal);
10525
10893
  if (name.startsWith("--")) {
10526
10894
  style.setProperty(name, val);
10527
10895
  } else {
@@ -10615,8 +10983,7 @@ function patchDOMProp(el, key, value, parentComponent, attrName) {
10615
10983
  return;
10616
10984
  }
10617
10985
  const tag = el.tagName;
10618
- if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
10619
- !tag.includes("-")) {
10986
+ if (key === "value" && canSetValueDirectly(tag)) {
10620
10987
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
10621
10988
  const newValue = value == null ? (
10622
10989
  // #11647: value should be set as empty string for null and undefined,
@@ -10739,8 +11106,6 @@ function patchStopImmediatePropagation(e, value) {
10739
11106
  }
10740
11107
  }
10741
11108
 
10742
- const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
10743
- key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
10744
11109
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
10745
11110
  const isSVG = namespace === "svg";
10746
11111
  if (key === "class") {
@@ -10780,24 +11145,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
10780
11145
  }
10781
11146
  return false;
10782
11147
  }
10783
- if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
10784
- return false;
10785
- }
10786
- if (key === "form") {
10787
- return false;
10788
- }
10789
- if (key === "list" && el.tagName === "INPUT") {
11148
+ if (shouldSetAsAttr(el.tagName, key)) {
10790
11149
  return false;
10791
11150
  }
10792
- if (key === "type" && el.tagName === "TEXTAREA") {
10793
- return false;
10794
- }
10795
- if (key === "width" || key === "height") {
10796
- const tag = el.tagName;
10797
- if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
10798
- return false;
10799
- }
10800
- }
10801
11151
  if (isNativeOn(key) && isString(value)) {
10802
11152
  return false;
10803
11153
  }
@@ -10809,7 +11159,7 @@ const REMOVAL = {};
10809
11159
  // @__NO_SIDE_EFFECTS__
10810
11160
  function defineCustomElement(options, extraOptions, _createApp) {
10811
11161
  const Comp = defineComponent(options, extraOptions);
10812
- if (isPlainObject(Comp)) extend$1(Comp, extraOptions);
11162
+ if (isPlainObject(Comp)) extend(Comp, extraOptions);
10813
11163
  class VueCustomElement extends VueElement {
10814
11164
  constructor(initialProps) {
10815
11165
  super(Comp, initialProps, _createApp);
@@ -10956,9 +11306,10 @@ class VueElement extends BaseClass {
10956
11306
  };
10957
11307
  const asyncDef = this._def.__asyncLoader;
10958
11308
  if (asyncDef) {
10959
- this._pendingResolve = asyncDef().then(
10960
- (def) => resolve(this._def = def, true)
10961
- );
11309
+ this._pendingResolve = asyncDef().then((def) => {
11310
+ def.configureApp = this._def.configureApp;
11311
+ resolve(this._def = def, true);
11312
+ });
10962
11313
  } else {
10963
11314
  resolve(this._def);
10964
11315
  }
@@ -11057,7 +11408,7 @@ class VueElement extends BaseClass {
11057
11408
  if (!this.shadowRoot) {
11058
11409
  baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
11059
11410
  }
11060
- const vnode = createVNode(this._def, extend$1(baseProps, this._props));
11411
+ const vnode = createVNode(this._def, extend(baseProps, this._props));
11061
11412
  if (!this._instance) {
11062
11413
  vnode.ce = (instance) => {
11063
11414
  this._instance = instance;
@@ -11067,7 +11418,7 @@ class VueElement extends BaseClass {
11067
11418
  this.dispatchEvent(
11068
11419
  new CustomEvent(
11069
11420
  event,
11070
- isPlainObject(args[0]) ? extend$1({ detail: args }, args[0]) : { detail: args }
11421
+ isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
11071
11422
  )
11072
11423
  );
11073
11424
  };
@@ -11196,7 +11547,7 @@ const decorate = (t) => {
11196
11547
  };
11197
11548
  const TransitionGroupImpl = /* @__PURE__ */ decorate({
11198
11549
  name: "TransitionGroup",
11199
- props: /* @__PURE__ */ extend$1({}, TransitionPropsValidators, {
11550
+ props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
11200
11551
  tag: String,
11201
11552
  moveClass: String
11202
11553
  }),
@@ -11347,28 +11698,12 @@ const assignKey = Symbol("_assign");
11347
11698
  const vModelText = {
11348
11699
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
11349
11700
  el[assignKey] = getModelAssigner(vnode);
11350
- const castToNumber = number || vnode.props && vnode.props.type === "number";
11351
- addEventListener(el, lazy ? "change" : "input", (e) => {
11352
- if (e.target.composing) return;
11353
- let domValue = el.value;
11354
- if (trim) {
11355
- domValue = domValue.trim();
11356
- }
11357
- if (castToNumber) {
11358
- domValue = looseToNumber(domValue);
11359
- }
11360
- el[assignKey](domValue);
11361
- });
11362
- if (trim) {
11363
- addEventListener(el, "change", () => {
11364
- el.value = el.value.trim();
11365
- });
11366
- }
11367
- if (!lazy) {
11368
- addEventListener(el, "compositionstart", onCompositionStart);
11369
- addEventListener(el, "compositionend", onCompositionEnd);
11370
- addEventListener(el, "change", onCompositionEnd);
11371
- }
11701
+ vModelTextInit(
11702
+ el,
11703
+ trim,
11704
+ number || !!(vnode.props && vnode.props.type === "number"),
11705
+ lazy
11706
+ );
11372
11707
  },
11373
11708
  // set value on mounted so it's after min/max for type="range"
11374
11709
  mounted(el, { value }) {
@@ -11376,70 +11711,111 @@ const vModelText = {
11376
11711
  },
11377
11712
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
11378
11713
  el[assignKey] = getModelAssigner(vnode);
11379
- if (el.composing) return;
11380
- const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
11381
- const newValue = value == null ? "" : value;
11382
- if (elValue === newValue) {
11714
+ vModelTextUpdate(el, oldValue, value, trim, number, lazy);
11715
+ }
11716
+ };
11717
+ const vModelTextInit = (el, trim, number, lazy, set) => {
11718
+ addEventListener(el, lazy ? "change" : "input", (e) => {
11719
+ if (e.target.composing) return;
11720
+ let domValue = el.value;
11721
+ if (trim) {
11722
+ domValue = domValue.trim();
11723
+ }
11724
+ if (number || el.type === "number") {
11725
+ domValue = looseToNumber(domValue);
11726
+ }
11727
+ (0, el[assignKey])(domValue);
11728
+ });
11729
+ if (trim) {
11730
+ addEventListener(el, "change", () => {
11731
+ el.value = el.value.trim();
11732
+ });
11733
+ }
11734
+ if (!lazy) {
11735
+ addEventListener(el, "compositionstart", onCompositionStart);
11736
+ addEventListener(el, "compositionend", onCompositionEnd);
11737
+ addEventListener(el, "change", onCompositionEnd);
11738
+ }
11739
+ };
11740
+ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
11741
+ if (el.composing) return;
11742
+ const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
11743
+ const newValue = value == null ? "" : value;
11744
+ if (elValue === newValue) {
11745
+ return;
11746
+ }
11747
+ if (document.activeElement === el && el.type !== "range") {
11748
+ if (lazy && value === oldValue) {
11383
11749
  return;
11384
11750
  }
11385
- if (document.activeElement === el && el.type !== "range") {
11386
- if (lazy && value === oldValue) {
11387
- return;
11388
- }
11389
- if (trim && el.value.trim() === newValue) {
11390
- return;
11391
- }
11751
+ if (trim && el.value.trim() === newValue) {
11752
+ return;
11392
11753
  }
11393
- el.value = newValue;
11394
11754
  }
11755
+ el.value = newValue;
11395
11756
  };
11396
11757
  const vModelCheckbox = {
11397
11758
  // #4096 array checkboxes need to be deep traversed
11398
11759
  deep: true,
11399
11760
  created(el, _, vnode) {
11400
11761
  el[assignKey] = getModelAssigner(vnode);
11401
- addEventListener(el, "change", () => {
11402
- const modelValue = el._modelValue;
11403
- const elementValue = getValue(el);
11404
- const checked = el.checked;
11405
- const assign = el[assignKey];
11406
- if (isArray(modelValue)) {
11407
- const index = looseIndexOf(modelValue, elementValue);
11408
- const found = index !== -1;
11409
- if (checked && !found) {
11410
- assign(modelValue.concat(elementValue));
11411
- } else if (!checked && found) {
11412
- const filtered = [...modelValue];
11413
- filtered.splice(index, 1);
11414
- assign(filtered);
11415
- }
11416
- } else if (isSet(modelValue)) {
11417
- const cloned = new Set(modelValue);
11418
- if (checked) {
11419
- cloned.add(elementValue);
11420
- } else {
11421
- cloned.delete(elementValue);
11422
- }
11423
- assign(cloned);
11424
- } else {
11425
- assign(getCheckboxValue(el, checked));
11426
- }
11427
- });
11762
+ vModelCheckboxInit(el);
11428
11763
  },
11429
11764
  // set initial checked on mount to wait for true-value/false-value
11430
- mounted: setChecked,
11765
+ mounted(el, binding, vnode) {
11766
+ vModelCheckboxUpdate(
11767
+ el,
11768
+ binding.oldValue,
11769
+ binding.value,
11770
+ vnode.props.value
11771
+ );
11772
+ },
11431
11773
  beforeUpdate(el, binding, vnode) {
11432
11774
  el[assignKey] = getModelAssigner(vnode);
11433
- setChecked(el, binding, vnode);
11775
+ vModelCheckboxUpdate(
11776
+ el,
11777
+ binding.oldValue,
11778
+ binding.value,
11779
+ vnode.props.value
11780
+ );
11434
11781
  }
11435
11782
  };
11436
- function setChecked(el, { value, oldValue }, vnode) {
11783
+ const vModelCheckboxInit = (el, set) => {
11784
+ addEventListener(el, "change", () => {
11785
+ const assign = el[assignKey];
11786
+ const modelValue = el._modelValue;
11787
+ const elementValue = getValue(el);
11788
+ const checked = el.checked;
11789
+ if (isArray(modelValue)) {
11790
+ const index = looseIndexOf(modelValue, elementValue);
11791
+ const found = index !== -1;
11792
+ if (checked && !found) {
11793
+ assign(modelValue.concat(elementValue));
11794
+ } else if (!checked && found) {
11795
+ const filtered = [...modelValue];
11796
+ filtered.splice(index, 1);
11797
+ assign(filtered);
11798
+ }
11799
+ } else if (isSet(modelValue)) {
11800
+ const cloned = new Set(modelValue);
11801
+ if (checked) {
11802
+ cloned.add(elementValue);
11803
+ } else {
11804
+ cloned.delete(elementValue);
11805
+ }
11806
+ assign(cloned);
11807
+ } else {
11808
+ assign(getCheckboxValue(el, checked));
11809
+ }
11810
+ });
11811
+ };
11812
+ const vModelCheckboxUpdate = (el, oldValue, value, rawValue = getValue(el)) => {
11437
11813
  el._modelValue = value;
11438
11814
  let checked;
11439
11815
  if (isArray(value)) {
11440
- checked = looseIndexOf(value, vnode.props.value) > -1;
11816
+ checked = looseIndexOf(value, rawValue) > -1;
11441
11817
  } else if (isSet(value)) {
11442
- checked = value.has(vnode.props.value);
11818
+ checked = value.has(rawValue);
11443
11819
  } else {
11444
11820
  if (value === oldValue) return;
11445
11821
  checked = looseEqual(value, getCheckboxValue(el, true));
@@ -11447,7 +11823,7 @@ function setChecked(el, { value, oldValue }, vnode) {
11447
11823
  if (el.checked !== checked) {
11448
11824
  el.checked = checked;
11449
11825
  }
11450
- }
11826
+ };
11451
11827
  const vModelRadio = {
11452
11828
  created(el, { value }, vnode) {
11453
11829
  el.checked = looseEqual(value, vnode.props.value);
@@ -11467,36 +11843,38 @@ const vModelSelect = {
11467
11843
  // <select multiple> value need to be deep traversed
11468
11844
  deep: true,
11469
11845
  created(el, { value, modifiers: { number } }, vnode) {
11470
- const isSetModel = isSet(value);
11471
- addEventListener(el, "change", () => {
11472
- const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
11473
- (o) => number ? looseToNumber(getValue(o)) : getValue(o)
11474
- );
11475
- el[assignKey](
11476
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
11477
- );
11478
- el._assigning = true;
11479
- nextTick(() => {
11480
- el._assigning = false;
11481
- });
11482
- });
11846
+ vModelSelectInit(el, value, number);
11483
11847
  el[assignKey] = getModelAssigner(vnode);
11484
11848
  },
11485
11849
  // set value in mounted & updated because <select> relies on its children
11486
11850
  // <option>s.
11487
11851
  mounted(el, { value }) {
11488
- setSelected(el, value);
11852
+ vModelSetSelected(el, value);
11489
11853
  },
11490
11854
  beforeUpdate(el, _binding, vnode) {
11491
11855
  el[assignKey] = getModelAssigner(vnode);
11492
11856
  },
11493
11857
  updated(el, { value }) {
11494
- if (!el._assigning) {
11495
- setSelected(el, value);
11496
- }
11858
+ vModelSetSelected(el, value);
11497
11859
  }
11498
11860
  };
11499
- function setSelected(el, value) {
11861
+ const vModelSelectInit = (el, value, number, set) => {
11862
+ const isSetModel = isSet(value);
11863
+ addEventListener(el, "change", () => {
11864
+ const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
11865
+ (o) => number ? looseToNumber(getValue(o)) : getValue(o)
11866
+ );
11867
+ (0, el[assignKey])(
11868
+ el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
11869
+ );
11870
+ el._assigning = true;
11871
+ nextTick(() => {
11872
+ el._assigning = false;
11873
+ });
11874
+ });
11875
+ };
11876
+ const vModelSetSelected = (el, value) => {
11877
+ if (el._assigning) return;
11500
11878
  const isMultiple = el.multiple;
11501
11879
  const isArrayValue = isArray(value);
11502
11880
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -11524,13 +11902,20 @@ function setSelected(el, value) {
11524
11902
  if (!isMultiple && el.selectedIndex !== -1) {
11525
11903
  el.selectedIndex = -1;
11526
11904
  }
11527
- }
11905
+ };
11528
11906
  function getValue(el) {
11529
11907
  return "_value" in el ? el._value : el.value;
11530
11908
  }
11531
11909
  function getCheckboxValue(el, checked) {
11532
11910
  const key = checked ? "_trueValue" : "_falseValue";
11533
- return key in el ? el[key] : checked;
11911
+ if (key in el) {
11912
+ return el[key];
11913
+ }
11914
+ const attr = checked ? "true-value" : "false-value";
11915
+ if (el.hasAttribute(attr)) {
11916
+ return el.getAttribute(attr);
11917
+ }
11918
+ return checked;
11534
11919
  }
11535
11920
  const vModelDynamic = {
11536
11921
  created(el, binding, vnode) {
@@ -11686,7 +12071,7 @@ const withKeys = (fn, modifiers) => {
11686
12071
  });
11687
12072
  };
11688
12073
 
11689
- const rendererOptions = /* @__PURE__ */ extend$1({ patchProp }, nodeOps);
12074
+ const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
11690
12075
  let renderer;
11691
12076
  let enabledHydration = false;
11692
12077
  function ensureRenderer() {
@@ -11945,7 +12330,7 @@ function wrappedCreateApp(...args) {
11945
12330
  }
11946
12331
  function createCompatVue() {
11947
12332
  const Vue = compatUtils.createCompatVue(createApp, wrappedCreateApp);
11948
- extend$1(Vue, runtimeDom);
12333
+ extend(Vue, runtimeDom);
11949
12334
  return Vue;
11950
12335
  }
11951
12336
 
@@ -12870,7 +13255,7 @@ class Tokenizer {
12870
13255
  this.buffer = input;
12871
13256
  while (this.index < this.buffer.length) {
12872
13257
  const c = this.buffer.charCodeAt(this.index);
12873
- if (c === 10) {
13258
+ if (c === 10 && this.state !== 33) {
12874
13259
  this.newlines.push(this.index);
12875
13260
  }
12876
13261
  switch (this.state) {
@@ -13372,7 +13757,7 @@ function markScopeIdentifier(node, child, knownIds) {
13372
13757
  const isFunctionType = (node) => {
13373
13758
  return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
13374
13759
  };
13375
- const isStaticProperty = (node) => node && (node.type === "ObjectProperty" || node.type === "ObjectMethod") && !node.computed;
13760
+ const isStaticProperty = (node) => !!node && (node.type === "ObjectProperty" || node.type === "ObjectMethod") && !node.computed;
13376
13761
  const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
13377
13762
  function isReferenced(node, parent, grandparent) {
13378
13763
  switch (parent.type) {
@@ -14224,9 +14609,9 @@ function onCloseTag(el, end, isImplied = false) {
14224
14609
  }
14225
14610
  if (tokenizer.inSFCRoot) {
14226
14611
  if (el.children.length) {
14227
- el.innerLoc.end = extend$1({}, el.children[el.children.length - 1].loc.end);
14612
+ el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
14228
14613
  } else {
14229
- el.innerLoc.end = extend$1({}, el.innerLoc.start);
14614
+ el.innerLoc.end = extend({}, el.innerLoc.start);
14230
14615
  }
14231
14616
  el.innerLoc.source = getSlice(
14232
14617
  el.innerLoc.start.offset,
@@ -14348,7 +14733,7 @@ function isUpperCase(c) {
14348
14733
  return c > 64 && c < 91;
14349
14734
  }
14350
14735
  const windowsNewlineRE = /\r\n/g;
14351
- function condenseWhitespace(nodes, tag) {
14736
+ function condenseWhitespace(nodes) {
14352
14737
  const shouldCondense = currentOptions.whitespace !== "preserve";
14353
14738
  let removedWhitespace = false;
14354
14739
  for (let i = 0; i < nodes.length; i++) {
@@ -14496,7 +14881,7 @@ function reset() {
14496
14881
  function baseParse(input, options) {
14497
14882
  reset();
14498
14883
  currentInput = input;
14499
- currentOptions = extend$1({}, defaultParserOptions);
14884
+ currentOptions = extend({}, defaultParserOptions);
14500
14885
  if (options) {
14501
14886
  let key;
14502
14887
  for (key in options) {
@@ -14527,12 +14912,12 @@ function cacheStatic(root, context) {
14527
14912
  context,
14528
14913
  // Root node is unfortunately non-hoistable due to potential parent
14529
14914
  // fallthrough attributes.
14530
- isSingleElementRoot(root, root.children[0])
14915
+ !!getSingleElementRoot(root)
14531
14916
  );
14532
14917
  }
14533
- function isSingleElementRoot(root, child) {
14534
- const { children } = root;
14535
- return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
14918
+ function getSingleElementRoot(root) {
14919
+ const children = root.children.filter((x) => x.type !== 3);
14920
+ return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
14536
14921
  }
14537
14922
  function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14538
14923
  const { children } = node;
@@ -14817,6 +15202,10 @@ function getNodeProps(node) {
14817
15202
  }
14818
15203
  }
14819
15204
 
15205
+ function getSelfName(filename) {
15206
+ const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
15207
+ return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
15208
+ }
14820
15209
  function createTransformContext(root, {
14821
15210
  filename = "",
14822
15211
  prefixIdentifiers = false,
@@ -14841,11 +15230,10 @@ function createTransformContext(root, {
14841
15230
  onWarn = defaultOnWarn,
14842
15231
  compatConfig
14843
15232
  }) {
14844
- const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
14845
15233
  const context = {
14846
15234
  // options
14847
15235
  filename,
14848
- selfName: nameMatch && capitalize(camelize(nameMatch[1])),
15236
+ selfName: getSelfName(filename),
14849
15237
  prefixIdentifiers,
14850
15238
  hoistStatic,
14851
15239
  hmr,
@@ -15012,15 +15400,15 @@ function createRootCodegen(root, context) {
15012
15400
  const { helper } = context;
15013
15401
  const { children } = root;
15014
15402
  if (children.length === 1) {
15015
- const child = children[0];
15016
- if (isSingleElementRoot(root, child) && child.codegenNode) {
15017
- const codegenNode = child.codegenNode;
15403
+ const singleElementRootChild = getSingleElementRoot(root);
15404
+ if (singleElementRootChild && singleElementRootChild.codegenNode) {
15405
+ const codegenNode = singleElementRootChild.codegenNode;
15018
15406
  if (codegenNode.type === 13) {
15019
15407
  convertToBlock(codegenNode, context);
15020
15408
  }
15021
15409
  root.codegenNode = codegenNode;
15022
15410
  } else {
15023
- root.codegenNode = child;
15411
+ root.codegenNode = children[0];
15024
15412
  }
15025
15413
  } else if (children.length > 1) {
15026
15414
  let patchFlag = 64;
@@ -15165,7 +15553,7 @@ function createCodegenContext(ast, {
15165
15553
  helper(key) {
15166
15554
  return `_${helperNameMap[key]}`;
15167
15555
  },
15168
- push(code, newlineIndex = -2 /* None */, node) {
15556
+ push(code, newlineIndex = -2, node) {
15169
15557
  context.code += code;
15170
15558
  if (context.map) {
15171
15559
  if (node) {
@@ -15180,14 +15568,14 @@ function createCodegenContext(ast, {
15180
15568
  addMapping(node.loc.start, name);
15181
15569
  }
15182
15570
  }
15183
- if (newlineIndex === -3 /* Unknown */) {
15571
+ if (newlineIndex === -3) {
15184
15572
  advancePositionWithMutation(context, code);
15185
15573
  } else {
15186
15574
  context.offset += code.length;
15187
- if (newlineIndex === -2 /* None */) {
15575
+ if (newlineIndex === -2) {
15188
15576
  context.column += code.length;
15189
15577
  } else {
15190
- if (newlineIndex === -1 /* End */) {
15578
+ if (newlineIndex === -1) {
15191
15579
  newlineIndex = code.length - 1;
15192
15580
  }
15193
15581
  context.line++;
@@ -15214,7 +15602,7 @@ function createCodegenContext(ast, {
15214
15602
  }
15215
15603
  };
15216
15604
  function newline(n) {
15217
- context.push("\n" + ` `.repeat(n), 0 /* Start */);
15605
+ context.push("\n" + ` `.repeat(n), 0);
15218
15606
  }
15219
15607
  function addMapping(loc, name = null) {
15220
15608
  const { _names, _mappings } = context.map;
@@ -15279,7 +15667,7 @@ function generate(ast, options = {}) {
15279
15667
  push(
15280
15668
  `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
15281
15669
  `,
15282
- -1 /* End */
15670
+ -1
15283
15671
  );
15284
15672
  newline();
15285
15673
  }
@@ -15309,7 +15697,7 @@ function generate(ast, options = {}) {
15309
15697
  }
15310
15698
  if (ast.components.length || ast.directives.length || ast.temps) {
15311
15699
  push(`
15312
- `, 0 /* Start */);
15700
+ `, 0);
15313
15701
  newline();
15314
15702
  }
15315
15703
  if (!ssr) {
@@ -15330,7 +15718,8 @@ function generate(ast, options = {}) {
15330
15718
  ast,
15331
15719
  code: context.code,
15332
15720
  preamble: isSetupInlined ? preambleContext.code : ``,
15333
- map: context.map ? context.map.toJSON() : void 0
15721
+ map: context.map ? context.map.toJSON() : void 0,
15722
+ helpers: ast.helpers
15334
15723
  };
15335
15724
  }
15336
15725
  function genFunctionPreamble(ast, context) {
@@ -15350,11 +15739,11 @@ function genFunctionPreamble(ast, context) {
15350
15739
  push(
15351
15740
  `const { ${helpers.map(aliasHelper).join(", ")} } = ${VueBinding}
15352
15741
  `,
15353
- -1 /* End */
15742
+ -1
15354
15743
  );
15355
15744
  } else {
15356
15745
  push(`const _Vue = ${VueBinding}
15357
- `, -1 /* End */);
15746
+ `, -1);
15358
15747
  if (ast.hoists.length) {
15359
15748
  const staticHelpers = [
15360
15749
  CREATE_VNODE,
@@ -15364,7 +15753,7 @@ function genFunctionPreamble(ast, context) {
15364
15753
  CREATE_STATIC
15365
15754
  ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
15366
15755
  push(`const { ${staticHelpers} } = _Vue
15367
- `, -1 /* End */);
15756
+ `, -1);
15368
15757
  }
15369
15758
  }
15370
15759
  }
@@ -15372,7 +15761,7 @@ function genFunctionPreamble(ast, context) {
15372
15761
  push(
15373
15762
  `const { ${ast.ssrHelpers.map(aliasHelper).join(", ")} } = require("${ssrRuntimeModuleName}")
15374
15763
  `,
15375
- -1 /* End */
15764
+ -1
15376
15765
  );
15377
15766
  }
15378
15767
  genHoists(ast.hoists, context);
@@ -15393,20 +15782,20 @@ function genModulePreamble(ast, context, genScopeId, inline) {
15393
15782
  push(
15394
15783
  `import { ${helpers.map((s) => helperNameMap[s]).join(", ")} } from ${JSON.stringify(runtimeModuleName)}
15395
15784
  `,
15396
- -1 /* End */
15785
+ -1
15397
15786
  );
15398
15787
  push(
15399
15788
  `
15400
15789
  // Binding optimization for webpack code-split
15401
15790
  const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(", ")}
15402
15791
  `,
15403
- -1 /* End */
15792
+ -1
15404
15793
  );
15405
15794
  } else {
15406
15795
  push(
15407
15796
  `import { ${helpers.map((s) => `${helperNameMap[s]} as _${helperNameMap[s]}`).join(", ")} } from ${JSON.stringify(runtimeModuleName)}
15408
15797
  `,
15409
- -1 /* End */
15798
+ -1
15410
15799
  );
15411
15800
  }
15412
15801
  }
@@ -15414,7 +15803,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
15414
15803
  push(
15415
15804
  `import { ${ast.ssrHelpers.map((s) => `${helperNameMap[s]} as _${helperNameMap[s]}`).join(", ")} } from "${ssrRuntimeModuleName}"
15416
15805
  `,
15417
- -1 /* End */
15806
+ -1
15418
15807
  );
15419
15808
  }
15420
15809
  if (ast.imports.length) {
@@ -15489,7 +15878,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
15489
15878
  for (let i = 0; i < nodes.length; i++) {
15490
15879
  const node = nodes[i];
15491
15880
  if (isString(node)) {
15492
- push(node, -3 /* Unknown */);
15881
+ push(node, -3);
15493
15882
  } else if (isArray(node)) {
15494
15883
  genNodeListAsArray(node, context);
15495
15884
  } else {
@@ -15507,7 +15896,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
15507
15896
  }
15508
15897
  function genNode(node, context) {
15509
15898
  if (isString(node)) {
15510
- context.push(node, -3 /* Unknown */);
15899
+ context.push(node, -3);
15511
15900
  return;
15512
15901
  }
15513
15902
  if (isSymbol(node)) {
@@ -15581,13 +15970,13 @@ function genNode(node, context) {
15581
15970
  }
15582
15971
  }
15583
15972
  function genText(node, context) {
15584
- context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
15973
+ context.push(JSON.stringify(node.content), -3, node);
15585
15974
  }
15586
15975
  function genExpression(node, context) {
15587
15976
  const { content, isStatic } = node;
15588
15977
  context.push(
15589
15978
  isStatic ? JSON.stringify(content) : content,
15590
- -3 /* Unknown */,
15979
+ -3,
15591
15980
  node
15592
15981
  );
15593
15982
  }
@@ -15602,7 +15991,7 @@ function genCompoundExpression(node, context) {
15602
15991
  for (let i = 0; i < node.children.length; i++) {
15603
15992
  const child = node.children[i];
15604
15993
  if (isString(child)) {
15605
- context.push(child, -3 /* Unknown */);
15994
+ context.push(child, -3);
15606
15995
  } else {
15607
15996
  genNode(child, context);
15608
15997
  }
@@ -15616,9 +16005,9 @@ function genExpressionAsPropertyKey(node, context) {
15616
16005
  push(`]`);
15617
16006
  } else if (node.isStatic) {
15618
16007
  const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
15619
- push(text, -2 /* None */, node);
16008
+ push(text, -2, node);
15620
16009
  } else {
15621
- push(`[${node.content}]`, -3 /* Unknown */, node);
16010
+ push(`[${node.content}]`, -3, node);
15622
16011
  }
15623
16012
  }
15624
16013
  function genComment(node, context) {
@@ -15628,7 +16017,7 @@ function genComment(node, context) {
15628
16017
  }
15629
16018
  push(
15630
16019
  `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
15631
- -3 /* Unknown */,
16020
+ -3,
15632
16021
  node
15633
16022
  );
15634
16023
  }
@@ -15661,7 +16050,7 @@ function genVNodeCall(node, context) {
15661
16050
  push(PURE_ANNOTATION);
15662
16051
  }
15663
16052
  const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
15664
- push(helper(callHelper) + `(`, -2 /* None */, node);
16053
+ push(helper(callHelper) + `(`, -2, node);
15665
16054
  genNodeList(
15666
16055
  genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
15667
16056
  context
@@ -15689,7 +16078,7 @@ function genCallExpression(node, context) {
15689
16078
  if (pure) {
15690
16079
  push(PURE_ANNOTATION);
15691
16080
  }
15692
- push(callee + `(`, -2 /* None */, node);
16081
+ push(callee + `(`, -2, node);
15693
16082
  genNodeList(node.arguments, context);
15694
16083
  push(`)`);
15695
16084
  }
@@ -15697,7 +16086,7 @@ function genObjectExpression(node, context) {
15697
16086
  const { push, indent, deindent, newline } = context;
15698
16087
  const { properties } = node;
15699
16088
  if (!properties.length) {
15700
- push(`{}`, -2 /* None */, node);
16089
+ push(`{}`, -2, node);
15701
16090
  return;
15702
16091
  }
15703
16092
  const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
@@ -15725,7 +16114,7 @@ function genFunctionExpression(node, context) {
15725
16114
  if (isSlot) {
15726
16115
  push(`_${helperNameMap[WITH_CTX]}(`);
15727
16116
  }
15728
- push(`(`, -2 /* None */, node);
16117
+ push(`(`, -2, node);
15729
16118
  if (isArray(params)) {
15730
16119
  genNodeList(params, context);
15731
16120
  } else if (params) {
@@ -15832,7 +16221,7 @@ function genTemplateLiteral(node, context) {
15832
16221
  for (let i = 0; i < l; i++) {
15833
16222
  const e = node.elements[i];
15834
16223
  if (isString(e)) {
15835
- push(e.replace(/(`|\$|\\)/g, "\\$1"), -3 /* Unknown */);
16224
+ push(e.replace(/(`|\$|\\)/g, "\\$1"), -3);
15836
16225
  } else {
15837
16226
  push("${");
15838
16227
  if (multilines) indent();
@@ -16774,7 +17163,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16774
17163
  let prev;
16775
17164
  while (j--) {
16776
17165
  prev = children[j];
16777
- if (prev.type !== 3) {
17166
+ if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
16778
17167
  break;
16779
17168
  }
16780
17169
  }
@@ -18088,7 +18477,7 @@ function baseCompile(source, options = {}) {
18088
18477
  if (options.scopeId && !isModuleMode) {
18089
18478
  onError(createCompilerError(50));
18090
18479
  }
18091
- const resolvedOptions = extend$1({}, options, {
18480
+ const resolvedOptions = extend({}, options, {
18092
18481
  prefixIdentifiers
18093
18482
  });
18094
18483
  const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
@@ -18101,13 +18490,13 @@ function baseCompile(source, options = {}) {
18101
18490
  }
18102
18491
  transform(
18103
18492
  ast,
18104
- extend$1({}, resolvedOptions, {
18493
+ extend({}, resolvedOptions, {
18105
18494
  nodeTransforms: [
18106
18495
  ...nodeTransforms,
18107
18496
  ...options.nodeTransforms || []
18108
18497
  // user transforms
18109
18498
  ],
18110
- directiveTransforms: extend$1(
18499
+ directiveTransforms: extend(
18111
18500
  {},
18112
18501
  directiveTransforms,
18113
18502
  options.directiveTransforms || {}
@@ -18246,7 +18635,9 @@ const DOMErrorMessages = {
18246
18635
  [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
18247
18636
  [61]: `v-show is missing expression.`,
18248
18637
  [62]: `<Transition> expects exactly one child element or component.`,
18249
- [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
18638
+ [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
18639
+ // just to fulfill types
18640
+ [64]: ``
18250
18641
  };
18251
18642
 
18252
18643
  const transformVHtml = (dir, node, context) => {
@@ -18377,16 +18768,17 @@ const resolveModifiers = (key, modifiers, context, loc) => {
18377
18768
  const eventOptionModifiers = [];
18378
18769
  for (let i = 0; i < modifiers.length; i++) {
18379
18770
  const modifier = modifiers[i].content;
18380
- if (modifier === "native" && checkCompatEnabled(
18771
+ if (modifier === "native" && context && checkCompatEnabled(
18381
18772
  "COMPILER_V_ON_NATIVE",
18382
18773
  context)) {
18383
18774
  eventOptionModifiers.push(modifier);
18384
18775
  } else if (isEventOptionModifier(modifier)) {
18385
18776
  eventOptionModifiers.push(modifier);
18386
18777
  } else {
18778
+ const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
18387
18779
  if (maybeKeyModifier(modifier)) {
18388
- if (isStaticExp(key)) {
18389
- if (isKeyboardEvent(key.content.toLowerCase())) {
18780
+ if (keyString) {
18781
+ if (isKeyboardEvent(keyString.toLowerCase())) {
18390
18782
  keyModifiers.push(modifier);
18391
18783
  } else {
18392
18784
  nonKeyModifiers.push(modifier);
@@ -18722,7 +19114,7 @@ const DOMDirectiveTransforms = {
18722
19114
  function compile(src, options = {}) {
18723
19115
  return baseCompile(
18724
19116
  src,
18725
- extend$1({}, parserOptions, options, {
19117
+ extend({}, parserOptions, options, {
18726
19118
  nodeTransforms: [
18727
19119
  // ignore <script> and <tag>
18728
19120
  // this is not put inside DOMNodeTransforms because that list is used
@@ -18731,7 +19123,7 @@ function compile(src, options = {}) {
18731
19123
  ...DOMNodeTransforms,
18732
19124
  ...options.nodeTransforms || []
18733
19125
  ],
18734
- directiveTransforms: extend$1(
19126
+ directiveTransforms: extend(
18735
19127
  {},
18736
19128
  DOMDirectiveTransforms,
18737
19129
  options.directiveTransforms || {}
@@ -18761,7 +19153,7 @@ function compileToFunction(template, options) {
18761
19153
  }
18762
19154
  const { code } = compile(
18763
19155
  template,
18764
- extend$1(
19156
+ extend(
18765
19157
  {
18766
19158
  hoistStatic: true,
18767
19159
  whitespace: "preserve",