@vue/server-renderer 3.5.16 → 3.6.0-alpha.1

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/server-renderer v3.5.16
2
+ * @vue/server-renderer v3.6.0-alpha.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -18,6 +18,8 @@ const NOOP = () => {
18
18
  const NO = () => false;
19
19
  const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
20
20
  (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
21
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
22
+ key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
21
23
  const isModelListener = (key) => key.startsWith("onUpdate:");
22
24
  const extend = Object.assign;
23
25
  const remove = (arr, el) => {
@@ -50,6 +52,7 @@ const isReservedProp = /* @__PURE__ */ makeMap(
50
52
  // the leading comma is intentional so empty string "" is also included
51
53
  ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
52
54
  );
55
+ const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
53
56
  const isBuiltInDirective = /* @__PURE__ */ makeMap(
54
57
  "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
55
58
  );
@@ -61,10 +64,9 @@ const cacheStringFunction = (fn) => {
61
64
  };
62
65
  };
63
66
  const camelizeRE = /-(\w)/g;
67
+ const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
64
68
  const camelize = cacheStringFunction(
65
- (str) => {
66
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
67
- }
69
+ (str) => str.replace(camelizeRE, camelizeReplacer)
68
70
  );
69
71
  const hyphenateRE = /\B([A-Z])/g;
70
72
  const hyphenate = cacheStringFunction(
@@ -101,6 +103,10 @@ let _globalThis;
101
103
  const getGlobalThis = () => {
102
104
  return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
103
105
  };
106
+ function canSetValueDirectly(tagName) {
107
+ return tagName !== "PROGRESS" && // custom elements may use _value internally
108
+ !tagName.includes("-");
109
+ }
104
110
 
105
111
  function normalizeStyle(value) {
106
112
  if (isArray(value)) {
@@ -208,6 +214,24 @@ function isRenderableAttrValue(value) {
208
214
  const type = typeof value;
209
215
  return type === "string" || type === "number" || type === "boolean";
210
216
  }
217
+ function shouldSetAsAttr(tagName, key) {
218
+ if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
219
+ return true;
220
+ }
221
+ if (key === "form") {
222
+ return true;
223
+ }
224
+ if (key === "list" && tagName === "INPUT") {
225
+ return true;
226
+ }
227
+ if (key === "type" && tagName === "TEXTAREA") {
228
+ return true;
229
+ }
230
+ if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
231
+ return true;
232
+ }
233
+ return false;
234
+ }
211
235
 
212
236
  const escapeRE = /["'&<>]/;
213
237
  function escapeHtml(string) {
@@ -307,7 +331,20 @@ const isRef$1 = (val) => {
307
331
  return !!(val && val["__v_isRef"] === true);
308
332
  };
309
333
  const toDisplayString = (val) => {
310
- 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);
334
+ switch (typeof val) {
335
+ case "string":
336
+ return val;
337
+ case "object":
338
+ if (val) {
339
+ if (isRef$1(val)) {
340
+ return toDisplayString(val.value);
341
+ } else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
342
+ return JSON.stringify(val, replacer, 2);
343
+ }
344
+ }
345
+ default:
346
+ return val == null ? "" : String(val);
347
+ }
311
348
  };
312
349
  const replacer = (_key, val) => {
313
350
  if (isRef$1(val)) {
@@ -342,566 +379,407 @@ const stringifySymbol = (v, i = "") => {
342
379
  );
343
380
  };
344
381
 
345
- function warn$2(msg, ...args) {
346
- console.warn(`[Vue warn] ${msg}`, ...args);
347
- }
348
-
349
- let activeEffectScope;
350
- class EffectScope {
351
- constructor(detached = false) {
352
- this.detached = detached;
353
- /**
354
- * @internal
355
- */
356
- this._active = true;
357
- /**
358
- * @internal track `on` calls, allow `on` call multiple times
359
- */
360
- this._on = 0;
361
- /**
362
- * @internal
363
- */
364
- this.effects = [];
365
- /**
366
- * @internal
367
- */
368
- this.cleanups = [];
369
- this._isPaused = false;
370
- this.parent = activeEffectScope;
371
- if (!detached && activeEffectScope) {
372
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
373
- this
374
- ) - 1;
375
- }
376
- }
377
- get active() {
378
- return this._active;
379
- }
380
- pause() {
381
- if (this._active) {
382
- this._isPaused = true;
383
- let i, l;
384
- if (this.scopes) {
385
- for (i = 0, l = this.scopes.length; i < l; i++) {
386
- this.scopes[i].pause();
387
- }
388
- }
389
- for (i = 0, l = this.effects.length; i < l; i++) {
390
- this.effects[i].pause();
391
- }
392
- }
393
- }
394
- /**
395
- * Resumes the effect scope, including all child scopes and effects.
396
- */
397
- resume() {
398
- if (this._active) {
399
- if (this._isPaused) {
400
- this._isPaused = false;
401
- let i, l;
402
- if (this.scopes) {
403
- for (i = 0, l = this.scopes.length; i < l; i++) {
404
- this.scopes[i].resume();
405
- }
406
- }
407
- for (i = 0, l = this.effects.length; i < l; i++) {
408
- this.effects[i].resume();
409
- }
410
- }
411
- }
412
- }
413
- run(fn) {
414
- if (this._active) {
415
- const currentEffectScope = activeEffectScope;
416
- try {
417
- activeEffectScope = this;
418
- return fn();
419
- } finally {
420
- activeEffectScope = currentEffectScope;
421
- }
422
- } else {
423
- warn$2(`cannot run an inactive effect scope.`);
424
- }
425
- }
426
- /**
427
- * This should only be called on non-detached scopes
428
- * @internal
429
- */
430
- on() {
431
- if (++this._on === 1) {
432
- this.prevScope = activeEffectScope;
433
- activeEffectScope = this;
434
- }
435
- }
436
- /**
437
- * This should only be called on non-detached scopes
438
- * @internal
439
- */
440
- off() {
441
- if (this._on > 0 && --this._on === 0) {
442
- activeEffectScope = this.prevScope;
443
- this.prevScope = void 0;
444
- }
445
- }
446
- stop(fromParent) {
447
- if (this._active) {
448
- this._active = false;
449
- let i, l;
450
- for (i = 0, l = this.effects.length; i < l; i++) {
451
- this.effects[i].stop();
452
- }
453
- this.effects.length = 0;
454
- for (i = 0, l = this.cleanups.length; i < l; i++) {
455
- this.cleanups[i]();
382
+ function getSequence(arr) {
383
+ const p = arr.slice();
384
+ const result = [0];
385
+ let i, j, u, v, c;
386
+ const len = arr.length;
387
+ for (i = 0; i < len; i++) {
388
+ const arrI = arr[i];
389
+ if (arrI !== 0) {
390
+ j = result[result.length - 1];
391
+ if (arr[j] < arrI) {
392
+ p[i] = j;
393
+ result.push(i);
394
+ continue;
456
395
  }
457
- this.cleanups.length = 0;
458
- if (this.scopes) {
459
- for (i = 0, l = this.scopes.length; i < l; i++) {
460
- this.scopes[i].stop(true);
396
+ u = 0;
397
+ v = result.length - 1;
398
+ while (u < v) {
399
+ c = u + v >> 1;
400
+ if (arr[result[c]] < arrI) {
401
+ u = c + 1;
402
+ } else {
403
+ v = c;
461
404
  }
462
- this.scopes.length = 0;
463
405
  }
464
- if (!this.detached && this.parent && !fromParent) {
465
- const last = this.parent.scopes.pop();
466
- if (last && last !== this) {
467
- this.parent.scopes[this.index] = last;
468
- last.index = this.index;
406
+ if (arrI < arr[result[u]]) {
407
+ if (u > 0) {
408
+ p[i] = result[u - 1];
469
409
  }
410
+ result[u] = i;
470
411
  }
471
- this.parent = void 0;
472
412
  }
473
413
  }
474
- }
475
- function getCurrentScope() {
476
- return activeEffectScope;
414
+ u = result.length;
415
+ v = result[u - 1];
416
+ while (u-- > 0) {
417
+ result[u] = v;
418
+ v = p[v];
419
+ }
420
+ return result;
477
421
  }
478
422
 
479
- let activeSub;
480
- const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
481
- class ReactiveEffect {
482
- constructor(fn) {
483
- this.fn = fn;
484
- /**
485
- * @internal
486
- */
487
- this.deps = void 0;
488
- /**
489
- * @internal
490
- */
491
- this.depsTail = void 0;
492
- /**
493
- * @internal
494
- */
495
- this.flags = 1 | 4;
496
- /**
497
- * @internal
498
- */
499
- this.next = void 0;
500
- /**
501
- * @internal
502
- */
503
- this.cleanup = void 0;
504
- this.scheduler = void 0;
505
- if (activeEffectScope && activeEffectScope.active) {
506
- activeEffectScope.effects.push(this);
507
- }
508
- }
509
- pause() {
510
- this.flags |= 64;
511
- }
512
- resume() {
513
- if (this.flags & 64) {
514
- this.flags &= -65;
515
- if (pausedQueueEffects.has(this)) {
516
- pausedQueueEffects.delete(this);
517
- this.trigger();
518
- }
519
- }
520
- }
521
- /**
522
- * @internal
523
- */
524
- notify() {
525
- if (this.flags & 2 && !(this.flags & 32)) {
526
- return;
527
- }
528
- if (!(this.flags & 8)) {
529
- batch(this);
530
- }
531
- }
532
- run() {
533
- if (!(this.flags & 1)) {
534
- return this.fn();
535
- }
536
- this.flags |= 2;
537
- cleanupEffect(this);
538
- prepareDeps(this);
539
- const prevEffect = activeSub;
540
- const prevShouldTrack = shouldTrack;
541
- activeSub = this;
542
- shouldTrack = true;
543
- try {
544
- return this.fn();
545
- } finally {
546
- if (activeSub !== this) {
547
- warn$2(
548
- "Active effect was not restored correctly - this is likely a Vue internal bug."
549
- );
550
- }
551
- cleanupDeps(this);
552
- activeSub = prevEffect;
553
- shouldTrack = prevShouldTrack;
554
- this.flags &= -3;
555
- }
556
- }
557
- stop() {
558
- if (this.flags & 1) {
559
- for (let link = this.deps; link; link = link.nextDep) {
560
- removeSub(link);
561
- }
562
- this.deps = this.depsTail = void 0;
563
- cleanupEffect(this);
564
- this.onStop && this.onStop();
565
- this.flags &= -2;
566
- }
423
+ function normalizeCssVarValue(value) {
424
+ if (value == null) {
425
+ return "initial";
567
426
  }
568
- trigger() {
569
- if (this.flags & 64) {
570
- pausedQueueEffects.add(this);
571
- } else if (this.scheduler) {
572
- this.scheduler();
573
- } else {
574
- this.runIfDirty();
575
- }
427
+ if (typeof value === "string") {
428
+ return value === "" ? " " : value;
576
429
  }
577
- /**
578
- * @internal
579
- */
580
- runIfDirty() {
581
- if (isDirty(this)) {
582
- this.run();
430
+ if (typeof value !== "number" || !Number.isFinite(value)) {
431
+ {
432
+ console.warn(
433
+ "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
434
+ value
435
+ );
583
436
  }
584
437
  }
585
- get dirty() {
586
- return isDirty(this);
587
- }
438
+ return String(value);
588
439
  }
440
+
441
+ function warn$2(msg, ...args) {
442
+ console.warn(`[Vue warn] ${msg}`, ...args);
443
+ }
444
+
445
+ var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
446
+ ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
447
+ ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
448
+ ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
449
+ ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
450
+ ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
451
+ ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
452
+ ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
453
+ return ReactiveFlags2;
454
+ })(ReactiveFlags || {});
455
+ const notifyBuffer = [];
589
456
  let batchDepth = 0;
590
- let batchedSub;
591
- let batchedComputed;
592
- function batch(sub, isComputed = false) {
593
- sub.flags |= 8;
594
- if (isComputed) {
595
- sub.next = batchedComputed;
596
- batchedComputed = sub;
597
- return;
457
+ let activeSub = void 0;
458
+ let notifyIndex = 0;
459
+ let notifyBufferLength = 0;
460
+ function setActiveSub(sub) {
461
+ try {
462
+ return activeSub;
463
+ } finally {
464
+ activeSub = sub;
598
465
  }
599
- sub.next = batchedSub;
600
- batchedSub = sub;
601
466
  }
602
467
  function startBatch() {
603
- batchDepth++;
468
+ ++batchDepth;
604
469
  }
605
470
  function endBatch() {
606
- if (--batchDepth > 0) {
607
- return;
471
+ if (!--batchDepth && notifyBufferLength) {
472
+ flush();
608
473
  }
609
- if (batchedComputed) {
610
- let e = batchedComputed;
611
- batchedComputed = void 0;
612
- while (e) {
613
- const next = e.next;
614
- e.next = void 0;
615
- e.flags &= -9;
616
- e = next;
617
- }
618
- }
619
- let error;
620
- while (batchedSub) {
621
- let e = batchedSub;
622
- batchedSub = void 0;
623
- while (e) {
624
- const next = e.next;
625
- e.next = void 0;
626
- e.flags &= -9;
627
- if (e.flags & 1) {
628
- try {
629
- ;
630
- e.trigger();
631
- } catch (err) {
632
- if (!error) error = err;
633
- }
634
- }
635
- e = next;
636
- }
637
- }
638
- if (error) throw error;
639
474
  }
640
- function prepareDeps(sub) {
641
- for (let link = sub.deps; link; link = link.nextDep) {
642
- link.version = -1;
643
- link.prevActiveLink = link.dep.activeLink;
644
- link.dep.activeLink = link;
645
- }
646
- }
647
- function cleanupDeps(sub) {
648
- let head;
649
- let tail = sub.depsTail;
650
- let link = tail;
651
- while (link) {
652
- const prev = link.prevDep;
653
- if (link.version === -1) {
654
- if (link === tail) tail = prev;
655
- removeSub(link);
656
- removeDep(link);
657
- } else {
658
- head = link;
659
- }
660
- link.dep.activeLink = link.prevActiveLink;
661
- link.prevActiveLink = void 0;
662
- link = prev;
475
+ function link(dep, sub) {
476
+ const prevDep = sub.depsTail;
477
+ if (prevDep !== void 0 && prevDep.dep === dep) {
478
+ return;
663
479
  }
664
- sub.deps = head;
665
- sub.depsTail = tail;
666
- }
667
- function isDirty(sub) {
668
- for (let link = sub.deps; link; link = link.nextDep) {
669
- if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
670
- return true;
480
+ let nextDep = void 0;
481
+ const recursedCheck = sub.flags & 4 /* RecursedCheck */;
482
+ if (recursedCheck) {
483
+ nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
484
+ if (nextDep !== void 0 && nextDep.dep === dep) {
485
+ sub.depsTail = nextDep;
486
+ return;
671
487
  }
672
488
  }
673
- if (sub._dirty) {
674
- return true;
675
- }
676
- return false;
677
- }
678
- function refreshComputed(computed) {
679
- if (computed.flags & 4 && !(computed.flags & 16)) {
489
+ const prevSub = dep.subsTail;
490
+ if (prevSub !== void 0 && prevSub.sub === sub && (!recursedCheck || isValidLink(prevSub, sub))) {
680
491
  return;
681
492
  }
682
- computed.flags &= -17;
683
- if (computed.globalVersion === globalVersion) {
684
- return;
493
+ const newLink = sub.depsTail = dep.subsTail = {
494
+ dep,
495
+ sub,
496
+ prevDep,
497
+ nextDep,
498
+ prevSub,
499
+ nextSub: void 0
500
+ };
501
+ if (nextDep !== void 0) {
502
+ nextDep.prevDep = newLink;
685
503
  }
686
- computed.globalVersion = globalVersion;
687
- if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
688
- return;
504
+ if (prevDep !== void 0) {
505
+ prevDep.nextDep = newLink;
506
+ } else {
507
+ sub.deps = newLink;
689
508
  }
690
- computed.flags |= 2;
691
- const dep = computed.dep;
692
- const prevSub = activeSub;
693
- const prevShouldTrack = shouldTrack;
694
- activeSub = computed;
695
- shouldTrack = true;
696
- try {
697
- prepareDeps(computed);
698
- const value = computed.fn(computed._value);
699
- if (dep.version === 0 || hasChanged(value, computed._value)) {
700
- computed.flags |= 128;
701
- computed._value = value;
702
- dep.version++;
703
- }
704
- } catch (err) {
705
- dep.version++;
706
- throw err;
707
- } finally {
708
- activeSub = prevSub;
709
- shouldTrack = prevShouldTrack;
710
- cleanupDeps(computed);
711
- computed.flags &= -3;
509
+ if (prevSub !== void 0) {
510
+ prevSub.nextSub = newLink;
511
+ } else {
512
+ dep.subs = newLink;
712
513
  }
713
514
  }
714
- function removeSub(link, soft = false) {
715
- const { dep, prevSub, nextSub } = link;
716
- if (prevSub) {
717
- prevSub.nextSub = nextSub;
718
- link.prevSub = void 0;
515
+ function unlink(link2, sub = link2.sub) {
516
+ const dep = link2.dep;
517
+ const prevDep = link2.prevDep;
518
+ const nextDep = link2.nextDep;
519
+ const nextSub = link2.nextSub;
520
+ const prevSub = link2.prevSub;
521
+ if (nextDep !== void 0) {
522
+ nextDep.prevDep = prevDep;
523
+ } else {
524
+ sub.depsTail = prevDep;
719
525
  }
720
- if (nextSub) {
721
- nextSub.prevSub = prevSub;
722
- link.nextSub = void 0;
526
+ if (prevDep !== void 0) {
527
+ prevDep.nextDep = nextDep;
528
+ } else {
529
+ sub.deps = nextDep;
723
530
  }
724
- if (dep.subsHead === link) {
725
- dep.subsHead = nextSub;
531
+ if (nextSub !== void 0) {
532
+ nextSub.prevSub = prevSub;
533
+ } else {
534
+ dep.subsTail = prevSub;
726
535
  }
727
- if (dep.subs === link) {
728
- dep.subs = prevSub;
729
- if (!prevSub && dep.computed) {
730
- dep.computed.flags &= -5;
731
- for (let l = dep.computed.deps; l; l = l.nextDep) {
732
- removeSub(l, true);
536
+ if (prevSub !== void 0) {
537
+ prevSub.nextSub = nextSub;
538
+ } else if ((dep.subs = nextSub) === void 0) {
539
+ let toRemove = dep.deps;
540
+ if (toRemove !== void 0) {
541
+ do {
542
+ toRemove = unlink(toRemove, dep);
543
+ } while (toRemove !== void 0);
544
+ dep.flags |= 16 /* Dirty */;
545
+ }
546
+ }
547
+ return nextDep;
548
+ }
549
+ function propagate(link2) {
550
+ let next = link2.nextSub;
551
+ let stack;
552
+ top: do {
553
+ const sub = link2.sub;
554
+ let flags = sub.flags;
555
+ if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
556
+ if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
557
+ sub.flags = flags | 32 /* Pending */;
558
+ } else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
559
+ flags = 0 /* None */;
560
+ } else if (!(flags & 4 /* RecursedCheck */)) {
561
+ sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
562
+ } else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
563
+ sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
564
+ flags &= 1 /* Mutable */;
565
+ } else {
566
+ flags = 0 /* None */;
567
+ }
568
+ if (flags & 2 /* Watching */) {
569
+ notifyBuffer[notifyBufferLength++] = sub;
570
+ }
571
+ if (flags & 1 /* Mutable */) {
572
+ const subSubs = sub.subs;
573
+ if (subSubs !== void 0) {
574
+ link2 = subSubs;
575
+ if (subSubs.nextSub !== void 0) {
576
+ stack = { value: next, prev: stack };
577
+ next = link2.nextSub;
578
+ }
579
+ continue;
580
+ }
733
581
  }
734
582
  }
735
- }
736
- if (!soft && !--dep.sc && dep.map) {
737
- dep.map.delete(dep.key);
738
- }
739
- }
740
- function removeDep(link) {
741
- const { prevDep, nextDep } = link;
742
- if (prevDep) {
743
- prevDep.nextDep = nextDep;
744
- link.prevDep = void 0;
745
- }
746
- if (nextDep) {
747
- nextDep.prevDep = prevDep;
748
- link.nextDep = void 0;
749
- }
750
- }
751
- let shouldTrack = true;
752
- const trackStack = [];
753
- function pauseTracking() {
754
- trackStack.push(shouldTrack);
755
- shouldTrack = false;
756
- }
757
- function resetTracking() {
758
- const last = trackStack.pop();
759
- shouldTrack = last === void 0 ? true : last;
760
- }
761
- function cleanupEffect(e) {
762
- const { cleanup } = e;
763
- e.cleanup = void 0;
764
- if (cleanup) {
765
- const prevSub = activeSub;
766
- activeSub = void 0;
767
- try {
768
- cleanup();
769
- } finally {
770
- activeSub = prevSub;
583
+ if ((link2 = next) !== void 0) {
584
+ next = link2.nextSub;
585
+ continue;
771
586
  }
772
- }
587
+ while (stack !== void 0) {
588
+ link2 = stack.value;
589
+ stack = stack.prev;
590
+ if (link2 !== void 0) {
591
+ next = link2.nextSub;
592
+ continue top;
593
+ }
594
+ }
595
+ break;
596
+ } while (true);
773
597
  }
774
-
775
- let globalVersion = 0;
776
- class Link {
777
- constructor(sub, dep) {
778
- this.sub = sub;
779
- this.dep = dep;
780
- this.version = dep.version;
781
- this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
782
- }
598
+ function startTracking(sub) {
599
+ sub.depsTail = void 0;
600
+ sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
601
+ return setActiveSub(sub);
783
602
  }
784
- class Dep {
785
- constructor(computed) {
786
- this.computed = computed;
787
- this.version = 0;
788
- /**
789
- * Link between this dep and the current active effect
790
- */
791
- this.activeLink = void 0;
792
- /**
793
- * Doubly linked list representing the subscribing effects (tail)
794
- */
795
- this.subs = void 0;
796
- /**
797
- * For object property deps cleanup
798
- */
799
- this.map = void 0;
800
- this.key = void 0;
801
- /**
802
- * Subscriber counter
803
- */
804
- this.sc = 0;
805
- {
806
- this.subsHead = void 0;
807
- }
603
+ function endTracking(sub, prevSub) {
604
+ if (activeSub !== sub) {
605
+ warn$2(
606
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
607
+ );
808
608
  }
809
- track(debugInfo) {
810
- if (!activeSub || !shouldTrack || activeSub === this.computed) {
811
- return;
609
+ activeSub = prevSub;
610
+ const depsTail = sub.depsTail;
611
+ let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
612
+ while (toRemove !== void 0) {
613
+ toRemove = unlink(toRemove, sub);
614
+ }
615
+ sub.flags &= -5 /* RecursedCheck */;
616
+ }
617
+ function flush() {
618
+ while (notifyIndex < notifyBufferLength) {
619
+ const effect = notifyBuffer[notifyIndex];
620
+ notifyBuffer[notifyIndex++] = void 0;
621
+ effect.notify();
622
+ }
623
+ notifyIndex = 0;
624
+ notifyBufferLength = 0;
625
+ }
626
+ function checkDirty(link2, sub) {
627
+ let stack;
628
+ let checkDepth = 0;
629
+ top: do {
630
+ const dep = link2.dep;
631
+ const depFlags = dep.flags;
632
+ let dirty = false;
633
+ if (sub.flags & 16 /* Dirty */) {
634
+ dirty = true;
635
+ } else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
636
+ if (dep.update()) {
637
+ const subs = dep.subs;
638
+ if (subs.nextSub !== void 0) {
639
+ shallowPropagate(subs);
640
+ }
641
+ dirty = true;
642
+ }
643
+ } else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
644
+ if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
645
+ stack = { value: link2, prev: stack };
646
+ }
647
+ link2 = dep.deps;
648
+ sub = dep;
649
+ ++checkDepth;
650
+ continue;
812
651
  }
813
- let link = this.activeLink;
814
- if (link === void 0 || link.sub !== activeSub) {
815
- link = this.activeLink = new Link(activeSub, this);
816
- if (!activeSub.deps) {
817
- activeSub.deps = activeSub.depsTail = link;
818
- } else {
819
- link.prevDep = activeSub.depsTail;
820
- activeSub.depsTail.nextDep = link;
821
- activeSub.depsTail = link;
822
- }
823
- addSub(link);
824
- } else if (link.version === -1) {
825
- link.version = this.version;
826
- if (link.nextDep) {
827
- const next = link.nextDep;
828
- next.prevDep = link.prevDep;
829
- if (link.prevDep) {
830
- link.prevDep.nextDep = next;
831
- }
832
- link.prevDep = activeSub.depsTail;
833
- link.nextDep = void 0;
834
- activeSub.depsTail.nextDep = link;
835
- activeSub.depsTail = link;
836
- if (activeSub.deps === link) {
837
- activeSub.deps = next;
838
- }
839
- }
840
- }
841
- if (activeSub.onTrack) {
842
- activeSub.onTrack(
843
- extend(
844
- {
845
- effect: activeSub
846
- },
847
- debugInfo
848
- )
849
- );
652
+ if (!dirty && link2.nextDep !== void 0) {
653
+ link2 = link2.nextDep;
654
+ continue;
850
655
  }
851
- return link;
852
- }
853
- trigger(debugInfo) {
854
- this.version++;
855
- globalVersion++;
856
- this.notify(debugInfo);
857
- }
858
- notify(debugInfo) {
859
- startBatch();
860
- try {
861
- if (true) {
862
- for (let head = this.subsHead; head; head = head.nextSub) {
863
- if (head.sub.onTrigger && !(head.sub.flags & 8)) {
864
- head.sub.onTrigger(
865
- extend(
866
- {
867
- effect: head.sub
868
- },
869
- debugInfo
870
- )
871
- );
656
+ while (checkDepth) {
657
+ --checkDepth;
658
+ const firstSub = sub.subs;
659
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
660
+ if (hasMultipleSubs) {
661
+ link2 = stack.value;
662
+ stack = stack.prev;
663
+ } else {
664
+ link2 = firstSub;
665
+ }
666
+ if (dirty) {
667
+ if (sub.update()) {
668
+ if (hasMultipleSubs) {
669
+ shallowPropagate(firstSub);
872
670
  }
671
+ sub = link2.sub;
672
+ continue;
873
673
  }
674
+ } else {
675
+ sub.flags &= -33 /* Pending */;
676
+ }
677
+ sub = link2.sub;
678
+ if (link2.nextDep !== void 0) {
679
+ link2 = link2.nextDep;
680
+ continue top;
681
+ }
682
+ dirty = false;
683
+ }
684
+ return dirty;
685
+ } while (true);
686
+ }
687
+ function shallowPropagate(link2) {
688
+ do {
689
+ const sub = link2.sub;
690
+ const nextSub = link2.nextSub;
691
+ const subFlags = sub.flags;
692
+ if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
693
+ sub.flags = subFlags | 16 /* Dirty */;
694
+ }
695
+ link2 = nextSub;
696
+ } while (link2 !== void 0);
697
+ }
698
+ function isValidLink(checkLink, sub) {
699
+ const depsTail = sub.depsTail;
700
+ if (depsTail !== void 0) {
701
+ let link2 = sub.deps;
702
+ do {
703
+ if (link2 === checkLink) {
704
+ return true;
874
705
  }
875
- for (let link = this.subs; link; link = link.prevSub) {
876
- if (link.sub.notify()) {
877
- ;
878
- link.sub.dep.notify();
879
- }
706
+ if (link2 === depsTail) {
707
+ break;
880
708
  }
881
- } finally {
882
- endBatch();
883
- }
709
+ link2 = link2.nextDep;
710
+ } while (link2 !== void 0);
884
711
  }
712
+ return false;
885
713
  }
886
- function addSub(link) {
887
- link.dep.sc++;
888
- if (link.sub.flags & 4) {
889
- const computed = link.dep.computed;
890
- if (computed && !link.dep.subs) {
891
- computed.flags |= 4 | 16;
892
- for (let l = computed.deps; l; l = l.nextDep) {
893
- addSub(l);
894
- }
714
+
715
+ const triggerEventInfos = [];
716
+ function onTrack(sub, debugInfo) {
717
+ if (sub.onTrack) {
718
+ sub.onTrack(
719
+ extend(
720
+ {
721
+ effect: sub
722
+ },
723
+ debugInfo
724
+ )
725
+ );
726
+ }
727
+ }
728
+ function onTrigger(sub) {
729
+ if (sub.onTrigger) {
730
+ const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
731
+ sub.onTrigger(
732
+ extend(
733
+ {
734
+ effect: sub
735
+ },
736
+ debugInfo
737
+ )
738
+ );
739
+ }
740
+ }
741
+ function setupOnTrigger(target) {
742
+ Object.defineProperty(target.prototype, "onTrigger", {
743
+ get() {
744
+ return this._onTrigger;
745
+ },
746
+ set(val) {
747
+ if (val && !this._onTrigger) setupFlagsHandler(this);
748
+ this._onTrigger = val;
895
749
  }
896
- const currentTail = link.dep.subs;
897
- if (currentTail !== link) {
898
- link.prevSub = currentTail;
899
- if (currentTail) currentTail.nextSub = link;
750
+ });
751
+ }
752
+ function setupFlagsHandler(target) {
753
+ target._flags = target.flags;
754
+ Object.defineProperty(target, "flags", {
755
+ get() {
756
+ return target._flags;
757
+ },
758
+ set(value) {
759
+ if (!(target._flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && !!(value & (ReactiveFlags.Dirty | ReactiveFlags.Pending))) {
760
+ onTrigger(this);
761
+ }
762
+ target._flags = value;
900
763
  }
901
- if (link.dep.subsHead === void 0) {
902
- link.dep.subsHead = link;
764
+ });
765
+ }
766
+
767
+ class Dep {
768
+ constructor(map, key) {
769
+ this.map = map;
770
+ this.key = key;
771
+ this._subs = void 0;
772
+ this.subsTail = void 0;
773
+ this.flags = ReactiveFlags.None;
774
+ }
775
+ get subs() {
776
+ return this._subs;
777
+ }
778
+ set subs(value) {
779
+ this._subs = value;
780
+ if (value === void 0) {
781
+ this.map.delete(this.key);
903
782
  }
904
- link.dep.subs = link;
905
783
  }
906
784
  }
907
785
  const targetMap = /* @__PURE__ */ new WeakMap();
@@ -915,36 +793,34 @@ const ARRAY_ITERATE_KEY = Symbol(
915
793
  "Array iterate"
916
794
  );
917
795
  function track(target, type, key) {
918
- if (shouldTrack && activeSub) {
796
+ if (activeSub !== void 0) {
919
797
  let depsMap = targetMap.get(target);
920
798
  if (!depsMap) {
921
799
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
922
800
  }
923
801
  let dep = depsMap.get(key);
924
802
  if (!dep) {
925
- depsMap.set(key, dep = new Dep());
926
- dep.map = depsMap;
927
- dep.key = key;
803
+ depsMap.set(key, dep = new Dep(depsMap, key));
928
804
  }
929
805
  {
930
- dep.track({
806
+ onTrack(activeSub, {
931
807
  target,
932
808
  type,
933
809
  key
934
810
  });
935
811
  }
812
+ link(dep, activeSub);
936
813
  }
937
814
  }
938
815
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
939
816
  const depsMap = targetMap.get(target);
940
817
  if (!depsMap) {
941
- globalVersion++;
942
818
  return;
943
819
  }
944
820
  const run = (dep) => {
945
- if (dep) {
821
+ if (dep !== void 0 && dep.subs !== void 0) {
946
822
  {
947
- dep.trigger({
823
+ triggerEventInfos.push({
948
824
  target,
949
825
  type,
950
826
  key,
@@ -953,6 +829,11 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
953
829
  oldTarget
954
830
  });
955
831
  }
832
+ propagate(dep.subs);
833
+ shallowPropagate(dep.subs);
834
+ {
835
+ triggerEventInfos.pop();
836
+ }
956
837
  }
957
838
  };
958
839
  startBatch();
@@ -1173,11 +1054,11 @@ function searchProxy(self, method, args) {
1173
1054
  return res;
1174
1055
  }
1175
1056
  function noTracking(self, method, args = []) {
1176
- pauseTracking();
1177
1057
  startBatch();
1058
+ const prevSub = setActiveSub();
1178
1059
  const res = toRaw(self)[method].apply(self, args);
1060
+ setActiveSub(prevSub);
1179
1061
  endBatch();
1180
- resetTracking();
1181
1062
  return res;
1182
1063
  }
1183
1064
 
@@ -1223,14 +1104,18 @@ class BaseReactiveHandler {
1223
1104
  return hasOwnProperty;
1224
1105
  }
1225
1106
  }
1107
+ const wasRef = isRef(target);
1226
1108
  const res = Reflect.get(
1227
1109
  target,
1228
1110
  key,
1229
1111
  // if this is a proxy wrapping a ref, return methods using the raw ref
1230
1112
  // as receiver so that we don't have to call `toRaw` on the ref in all
1231
1113
  // its class methods
1232
- isRef(target) ? target : receiver
1114
+ wasRef ? target : receiver
1233
1115
  );
1116
+ if (wasRef && key !== "value") {
1117
+ return res;
1118
+ }
1234
1119
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1235
1120
  return res;
1236
1121
  }
@@ -1673,96 +1558,307 @@ function markRaw(value) {
1673
1558
  if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1674
1559
  def(value, "__v_skip", true);
1675
1560
  }
1676
- return value;
1677
- }
1678
- const toReactive = (value) => isObject(value) ? reactive(value) : value;
1679
- const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1680
-
1681
- function isRef(r) {
1682
- return r ? r["__v_isRef"] === true : false;
1683
- }
1684
- function unref(ref2) {
1685
- return isRef(ref2) ? ref2.value : ref2;
1686
- }
1687
- const shallowUnwrapHandlers = {
1688
- get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1689
- set: (target, key, value, receiver) => {
1690
- const oldValue = target[key];
1691
- if (isRef(oldValue) && !isRef(value)) {
1692
- oldValue.value = value;
1693
- return true;
1694
- } else {
1695
- return Reflect.set(target, key, value, receiver);
1561
+ return value;
1562
+ }
1563
+ const toReactive = (value) => isObject(value) ? reactive(value) : value;
1564
+ const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1565
+
1566
+ function isRef(r) {
1567
+ return r ? r["__v_isRef"] === true : false;
1568
+ }
1569
+ function unref(ref2) {
1570
+ return isRef(ref2) ? ref2.value : ref2;
1571
+ }
1572
+ const shallowUnwrapHandlers = {
1573
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1574
+ set: (target, key, value, receiver) => {
1575
+ const oldValue = target[key];
1576
+ if (isRef(oldValue) && !isRef(value)) {
1577
+ oldValue.value = value;
1578
+ return true;
1579
+ } else {
1580
+ return Reflect.set(target, key, value, receiver);
1581
+ }
1582
+ }
1583
+ };
1584
+ function proxyRefs(objectWithRefs) {
1585
+ return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1586
+ }
1587
+
1588
+ class ReactiveEffect {
1589
+ constructor(fn) {
1590
+ this.deps = void 0;
1591
+ this.depsTail = void 0;
1592
+ this.subs = void 0;
1593
+ this.subsTail = void 0;
1594
+ this.flags = ReactiveFlags.Watching | ReactiveFlags.Dirty;
1595
+ /**
1596
+ * @internal
1597
+ */
1598
+ this.cleanups = [];
1599
+ /**
1600
+ * @internal
1601
+ */
1602
+ this.cleanupsLength = 0;
1603
+ if (fn !== void 0) {
1604
+ this.fn = fn;
1605
+ }
1606
+ if (activeEffectScope) {
1607
+ link(this, activeEffectScope);
1608
+ }
1609
+ }
1610
+ // @ts-expect-error
1611
+ fn() {
1612
+ }
1613
+ get active() {
1614
+ return !(this.flags & 1024);
1615
+ }
1616
+ pause() {
1617
+ this.flags |= 256;
1618
+ }
1619
+ resume() {
1620
+ const flags = this.flags &= -257;
1621
+ if (flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) {
1622
+ this.notify();
1623
+ }
1624
+ }
1625
+ notify() {
1626
+ if (!(this.flags & 256) && this.dirty) {
1627
+ this.run();
1628
+ }
1629
+ }
1630
+ run() {
1631
+ if (!this.active) {
1632
+ return this.fn();
1633
+ }
1634
+ cleanup(this);
1635
+ const prevSub = startTracking(this);
1636
+ try {
1637
+ return this.fn();
1638
+ } finally {
1639
+ endTracking(this, prevSub);
1640
+ const flags = this.flags;
1641
+ if ((flags & (ReactiveFlags.Recursed | 128)) === (ReactiveFlags.Recursed | 128)) {
1642
+ this.flags = flags & ~ReactiveFlags.Recursed;
1643
+ this.notify();
1644
+ }
1645
+ }
1646
+ }
1647
+ stop() {
1648
+ if (!this.active) {
1649
+ return;
1650
+ }
1651
+ this.flags = 1024;
1652
+ let dep = this.deps;
1653
+ while (dep !== void 0) {
1654
+ dep = unlink(dep, this);
1655
+ }
1656
+ const sub = this.subs;
1657
+ if (sub !== void 0) {
1658
+ unlink(sub);
1659
+ }
1660
+ cleanup(this);
1661
+ }
1662
+ get dirty() {
1663
+ const flags = this.flags;
1664
+ if (flags & ReactiveFlags.Dirty) {
1665
+ return true;
1666
+ }
1667
+ if (flags & ReactiveFlags.Pending) {
1668
+ if (checkDirty(this.deps, this)) {
1669
+ this.flags = flags | ReactiveFlags.Dirty;
1670
+ return true;
1671
+ } else {
1672
+ this.flags = flags & ~ReactiveFlags.Pending;
1673
+ }
1674
+ }
1675
+ return false;
1676
+ }
1677
+ }
1678
+ {
1679
+ setupOnTrigger(ReactiveEffect);
1680
+ }
1681
+ function cleanup(sub) {
1682
+ const l = sub.cleanupsLength;
1683
+ if (l) {
1684
+ for (let i = 0; i < l; i++) {
1685
+ sub.cleanups[i]();
1686
+ }
1687
+ sub.cleanupsLength = 0;
1688
+ }
1689
+ }
1690
+
1691
+ let activeEffectScope;
1692
+ class EffectScope {
1693
+ constructor(detached = false) {
1694
+ this.deps = void 0;
1695
+ this.depsTail = void 0;
1696
+ this.subs = void 0;
1697
+ this.subsTail = void 0;
1698
+ this.flags = 0;
1699
+ /**
1700
+ * @internal
1701
+ */
1702
+ this.cleanups = [];
1703
+ /**
1704
+ * @internal
1705
+ */
1706
+ this.cleanupsLength = 0;
1707
+ if (!detached && activeEffectScope) {
1708
+ link(this, activeEffectScope);
1709
+ }
1710
+ }
1711
+ get active() {
1712
+ return !(this.flags & 1024);
1713
+ }
1714
+ pause() {
1715
+ if (!(this.flags & 256)) {
1716
+ this.flags |= 256;
1717
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1718
+ const dep = link2.dep;
1719
+ if ("pause" in dep) {
1720
+ dep.pause();
1721
+ }
1722
+ }
1723
+ }
1724
+ }
1725
+ /**
1726
+ * Resumes the effect scope, including all child scopes and effects.
1727
+ */
1728
+ resume() {
1729
+ const flags = this.flags;
1730
+ if (flags & 256) {
1731
+ this.flags = flags & -257;
1732
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1733
+ const dep = link2.dep;
1734
+ if ("resume" in dep) {
1735
+ dep.resume();
1736
+ }
1737
+ }
1738
+ }
1739
+ }
1740
+ run(fn) {
1741
+ const prevSub = setActiveSub();
1742
+ const prevScope = activeEffectScope;
1743
+ try {
1744
+ activeEffectScope = this;
1745
+ return fn();
1746
+ } finally {
1747
+ activeEffectScope = prevScope;
1748
+ setActiveSub(prevSub);
1749
+ }
1750
+ }
1751
+ stop() {
1752
+ if (!this.active) {
1753
+ return;
1754
+ }
1755
+ this.flags = 1024;
1756
+ let dep = this.deps;
1757
+ while (dep !== void 0) {
1758
+ const node = dep.dep;
1759
+ if ("stop" in node) {
1760
+ dep = dep.nextDep;
1761
+ node.stop();
1762
+ } else {
1763
+ dep = unlink(dep, this);
1764
+ }
1696
1765
  }
1766
+ const sub = this.subs;
1767
+ if (sub !== void 0) {
1768
+ unlink(sub);
1769
+ }
1770
+ cleanup(this);
1771
+ }
1772
+ }
1773
+ function setCurrentScope(scope) {
1774
+ try {
1775
+ return activeEffectScope;
1776
+ } finally {
1777
+ activeEffectScope = scope;
1697
1778
  }
1698
- };
1699
- function proxyRefs(objectWithRefs) {
1700
- return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1701
1779
  }
1702
1780
 
1703
1781
  class ComputedRefImpl {
1704
- constructor(fn, setter, isSSR) {
1782
+ constructor(fn, setter) {
1705
1783
  this.fn = fn;
1706
1784
  this.setter = setter;
1707
1785
  /**
1708
1786
  * @internal
1709
1787
  */
1710
1788
  this._value = void 0;
1711
- /**
1712
- * @internal
1713
- */
1714
- this.dep = new Dep(this);
1715
- /**
1716
- * @internal
1717
- */
1718
- this.__v_isRef = true;
1719
- // TODO isolatedDeclarations "__v_isReadonly"
1720
- // A computed is also a subscriber that tracks other deps
1721
- /**
1722
- * @internal
1723
- */
1789
+ this.subs = void 0;
1790
+ this.subsTail = void 0;
1724
1791
  this.deps = void 0;
1725
- /**
1726
- * @internal
1727
- */
1728
1792
  this.depsTail = void 0;
1793
+ this.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
1729
1794
  /**
1730
1795
  * @internal
1731
1796
  */
1732
- this.flags = 16;
1733
- /**
1734
- * @internal
1735
- */
1736
- this.globalVersion = globalVersion - 1;
1737
- /**
1738
- * @internal
1739
- */
1740
- this.next = void 0;
1741
- // for backwards compat
1742
- this.effect = this;
1797
+ this.__v_isRef = true;
1743
1798
  this["__v_isReadonly"] = !setter;
1744
- this.isSSR = isSSR;
1799
+ }
1800
+ // TODO isolatedDeclarations "__v_isReadonly"
1801
+ // for backwards compat
1802
+ get effect() {
1803
+ return this;
1804
+ }
1805
+ // for backwards compat
1806
+ get dep() {
1807
+ return this;
1745
1808
  }
1746
1809
  /**
1747
1810
  * @internal
1811
+ * for backwards compat
1748
1812
  */
1749
- notify() {
1750
- this.flags |= 16;
1751
- if (!(this.flags & 8) && // avoid infinite self recursion
1752
- activeSub !== this) {
1753
- batch(this, true);
1813
+ get _dirty() {
1814
+ const flags = this.flags;
1815
+ if (flags & ReactiveFlags.Dirty) {
1754
1816
  return true;
1755
1817
  }
1818
+ if (flags & ReactiveFlags.Pending) {
1819
+ if (checkDirty(this.deps, this)) {
1820
+ this.flags = flags | ReactiveFlags.Dirty;
1821
+ return true;
1822
+ } else {
1823
+ this.flags = flags & ~ReactiveFlags.Pending;
1824
+ }
1825
+ }
1826
+ return false;
1827
+ }
1828
+ /**
1829
+ * @internal
1830
+ * for backwards compat
1831
+ */
1832
+ set _dirty(v) {
1833
+ if (v) {
1834
+ this.flags |= ReactiveFlags.Dirty;
1835
+ } else {
1836
+ this.flags &= ~(ReactiveFlags.Dirty | ReactiveFlags.Pending);
1837
+ }
1756
1838
  }
1757
1839
  get value() {
1758
- const link = this.dep.track({
1759
- target: this,
1760
- type: "get",
1761
- key: "value"
1762
- }) ;
1763
- refreshComputed(this);
1764
- if (link) {
1765
- link.version = this.dep.version;
1840
+ const flags = this.flags;
1841
+ if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) {
1842
+ if (this.update()) {
1843
+ const subs = this.subs;
1844
+ if (subs !== void 0) {
1845
+ shallowPropagate(subs);
1846
+ }
1847
+ }
1848
+ } else if (flags & ReactiveFlags.Pending) {
1849
+ this.flags = flags & ~ReactiveFlags.Pending;
1850
+ }
1851
+ if (activeSub !== void 0) {
1852
+ {
1853
+ onTrack(activeSub, {
1854
+ target: this,
1855
+ type: "get",
1856
+ key: "value"
1857
+ });
1858
+ }
1859
+ link(this, activeSub);
1860
+ } else if (activeEffectScope !== void 0) {
1861
+ link(this, activeEffectScope);
1766
1862
  }
1767
1863
  return this._value;
1768
1864
  }
@@ -1773,6 +1869,23 @@ class ComputedRefImpl {
1773
1869
  warn$2("Write operation failed: computed value is readonly");
1774
1870
  }
1775
1871
  }
1872
+ update() {
1873
+ const prevSub = startTracking(this);
1874
+ try {
1875
+ const oldValue = this._value;
1876
+ const newValue = this.fn(oldValue);
1877
+ if (hasChanged(oldValue, newValue)) {
1878
+ this._value = newValue;
1879
+ return true;
1880
+ }
1881
+ return false;
1882
+ } finally {
1883
+ endTracking(this, prevSub);
1884
+ }
1885
+ }
1886
+ }
1887
+ {
1888
+ setupOnTrigger(ComputedRefImpl);
1776
1889
  }
1777
1890
  function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1778
1891
  let getter;
@@ -1783,179 +1896,148 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1783
1896
  getter = getterOrOptions.get;
1784
1897
  setter = getterOrOptions.set;
1785
1898
  }
1786
- const cRef = new ComputedRefImpl(getter, setter, isSSR);
1899
+ const cRef = new ComputedRefImpl(getter, setter);
1787
1900
  return cRef;
1788
1901
  }
1789
1902
 
1790
1903
  const INITIAL_WATCHER_VALUE = {};
1791
- const cleanupMap = /* @__PURE__ */ new WeakMap();
1792
1904
  let activeWatcher = void 0;
1793
1905
  function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1794
1906
  if (owner) {
1795
- let cleanups = cleanupMap.get(owner);
1796
- if (!cleanups) cleanupMap.set(owner, cleanups = []);
1797
- cleanups.push(cleanupFn);
1907
+ const { call } = owner.options;
1908
+ if (call) {
1909
+ owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
1910
+ } else {
1911
+ owner.cleanups[owner.cleanupsLength++] = cleanupFn;
1912
+ }
1798
1913
  } else if (!failSilently) {
1799
1914
  warn$2(
1800
1915
  `onWatcherCleanup() was called when there was no active watcher to associate with.`
1801
1916
  );
1802
1917
  }
1803
1918
  }
1804
- function watch$1(source, cb, options = EMPTY_OBJ) {
1805
- const { immediate, deep, once, scheduler, augmentJob, call } = options;
1806
- const warnInvalidSource = (s) => {
1807
- (options.onWarn || warn$2)(
1808
- `Invalid watch source: `,
1809
- s,
1810
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1811
- );
1812
- };
1813
- const reactiveGetter = (source2) => {
1814
- if (deep) return source2;
1815
- if (isShallow(source2) || deep === false || deep === 0)
1816
- return traverse(source2, 1);
1817
- return traverse(source2);
1818
- };
1819
- let effect;
1820
- let getter;
1821
- let cleanup;
1822
- let boundCleanup;
1823
- let forceTrigger = false;
1824
- let isMultiSource = false;
1825
- if (isRef(source)) {
1826
- getter = () => source.value;
1827
- forceTrigger = isShallow(source);
1828
- } else if (isReactive(source)) {
1829
- getter = () => reactiveGetter(source);
1830
- forceTrigger = true;
1831
- } else if (isArray(source)) {
1832
- isMultiSource = true;
1833
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1834
- getter = () => source.map((s) => {
1835
- if (isRef(s)) {
1836
- return s.value;
1837
- } else if (isReactive(s)) {
1838
- return reactiveGetter(s);
1839
- } else if (isFunction(s)) {
1840
- return call ? call(s, 2) : s();
1919
+ class WatcherEffect extends ReactiveEffect {
1920
+ constructor(source, cb, options = EMPTY_OBJ) {
1921
+ const { deep, once, call, onWarn } = options;
1922
+ let getter;
1923
+ let forceTrigger = false;
1924
+ let isMultiSource = false;
1925
+ if (isRef(source)) {
1926
+ getter = () => source.value;
1927
+ forceTrigger = isShallow(source);
1928
+ } else if (isReactive(source)) {
1929
+ getter = () => reactiveGetter(source, deep);
1930
+ forceTrigger = true;
1931
+ } else if (isArray(source)) {
1932
+ isMultiSource = true;
1933
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1934
+ getter = () => source.map((s) => {
1935
+ if (isRef(s)) {
1936
+ return s.value;
1937
+ } else if (isReactive(s)) {
1938
+ return reactiveGetter(s, deep);
1939
+ } else if (isFunction(s)) {
1940
+ return call ? call(s, 2) : s();
1941
+ } else {
1942
+ warnInvalidSource(s, onWarn);
1943
+ }
1944
+ });
1945
+ } else if (isFunction(source)) {
1946
+ if (cb) {
1947
+ getter = call ? () => call(source, 2) : source;
1841
1948
  } else {
1842
- warnInvalidSource(s);
1843
- }
1844
- });
1845
- } else if (isFunction(source)) {
1846
- if (cb) {
1847
- getter = call ? () => call(source, 2) : source;
1848
- } else {
1849
- getter = () => {
1850
- if (cleanup) {
1851
- pauseTracking();
1949
+ getter = () => {
1950
+ if (this.cleanupsLength) {
1951
+ const prevSub = setActiveSub();
1952
+ try {
1953
+ cleanup(this);
1954
+ } finally {
1955
+ setActiveSub(prevSub);
1956
+ }
1957
+ }
1958
+ const currentEffect = activeWatcher;
1959
+ activeWatcher = this;
1852
1960
  try {
1853
- cleanup();
1961
+ return call ? call(source, 3, [
1962
+ this.boundCleanup
1963
+ ]) : source(this.boundCleanup);
1854
1964
  } finally {
1855
- resetTracking();
1965
+ activeWatcher = currentEffect;
1856
1966
  }
1857
- }
1858
- const currentEffect = activeWatcher;
1859
- activeWatcher = effect;
1860
- try {
1861
- return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
1862
- } finally {
1863
- activeWatcher = currentEffect;
1864
- }
1967
+ };
1968
+ }
1969
+ } else {
1970
+ getter = NOOP;
1971
+ warnInvalidSource(source, onWarn);
1972
+ }
1973
+ if (cb && deep) {
1974
+ const baseGetter = getter;
1975
+ const depth = deep === true ? Infinity : deep;
1976
+ getter = () => traverse(baseGetter(), depth);
1977
+ }
1978
+ super(getter);
1979
+ this.cb = cb;
1980
+ this.options = options;
1981
+ this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
1982
+ this.forceTrigger = forceTrigger;
1983
+ this.isMultiSource = isMultiSource;
1984
+ if (once && cb) {
1985
+ const _cb = cb;
1986
+ cb = (...args) => {
1987
+ _cb(...args);
1988
+ this.stop();
1865
1989
  };
1866
1990
  }
1867
- } else {
1868
- getter = NOOP;
1869
- warnInvalidSource(source);
1870
- }
1871
- if (cb && deep) {
1872
- const baseGetter = getter;
1873
- const depth = deep === true ? Infinity : deep;
1874
- getter = () => traverse(baseGetter(), depth);
1875
- }
1876
- const scope = getCurrentScope();
1877
- const watchHandle = () => {
1878
- effect.stop();
1879
- if (scope && scope.active) {
1880
- remove(scope.effects, effect);
1991
+ this.cb = cb;
1992
+ this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1993
+ {
1994
+ this.onTrack = options.onTrack;
1995
+ this.onTrigger = options.onTrigger;
1881
1996
  }
1882
- };
1883
- if (once && cb) {
1884
- const _cb = cb;
1885
- cb = (...args) => {
1886
- _cb(...args);
1887
- watchHandle();
1888
- };
1889
1997
  }
1890
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1891
- const job = (immediateFirstRun) => {
1892
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
1998
+ run(initialRun = false) {
1999
+ const oldValue = this.oldValue;
2000
+ const newValue = this.oldValue = super.run();
2001
+ if (!this.cb) {
1893
2002
  return;
1894
2003
  }
1895
- if (cb) {
1896
- const newValue = effect.run();
1897
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1898
- if (cleanup) {
1899
- cleanup();
1900
- }
1901
- const currentWatcher = activeWatcher;
1902
- activeWatcher = effect;
1903
- try {
1904
- const args = [
1905
- newValue,
1906
- // pass undefined as the old value when it's changed for the first time
1907
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1908
- boundCleanup
1909
- ];
1910
- oldValue = newValue;
1911
- call ? call(cb, 3, args) : (
1912
- // @ts-expect-error
1913
- cb(...args)
1914
- );
1915
- } finally {
1916
- activeWatcher = currentWatcher;
1917
- }
1918
- }
1919
- } else {
1920
- effect.run();
2004
+ const { immediate, deep, call } = this.options;
2005
+ if (initialRun && !immediate) {
2006
+ return;
1921
2007
  }
1922
- };
1923
- if (augmentJob) {
1924
- augmentJob(job);
1925
- }
1926
- effect = new ReactiveEffect(getter);
1927
- effect.scheduler = scheduler ? () => scheduler(job, false) : job;
1928
- boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
1929
- cleanup = effect.onStop = () => {
1930
- const cleanups = cleanupMap.get(effect);
1931
- if (cleanups) {
1932
- if (call) {
1933
- call(cleanups, 4);
1934
- } else {
1935
- for (const cleanup2 of cleanups) cleanup2();
2008
+ if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2009
+ cleanup(this);
2010
+ const currentWatcher = activeWatcher;
2011
+ activeWatcher = this;
2012
+ try {
2013
+ const args = [
2014
+ newValue,
2015
+ // pass undefined as the old value when it's changed for the first time
2016
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2017
+ this.boundCleanup
2018
+ ];
2019
+ call ? call(this.cb, 3, args) : (
2020
+ // @ts-expect-error
2021
+ this.cb(...args)
2022
+ );
2023
+ } finally {
2024
+ activeWatcher = currentWatcher;
1936
2025
  }
1937
- cleanupMap.delete(effect);
1938
- }
1939
- };
1940
- {
1941
- effect.onTrack = options.onTrack;
1942
- effect.onTrigger = options.onTrigger;
1943
- }
1944
- if (cb) {
1945
- if (immediate) {
1946
- job(true);
1947
- } else {
1948
- oldValue = effect.run();
1949
2026
  }
1950
- } else if (scheduler) {
1951
- scheduler(job.bind(null, true), true);
1952
- } else {
1953
- effect.run();
1954
2027
  }
1955
- watchHandle.pause = effect.pause.bind(effect);
1956
- watchHandle.resume = effect.resume.bind(effect);
1957
- watchHandle.stop = watchHandle;
1958
- return watchHandle;
2028
+ }
2029
+ function reactiveGetter(source, deep) {
2030
+ if (deep) return source;
2031
+ if (isShallow(source) || deep === false || deep === 0)
2032
+ return traverse(source, 1);
2033
+ return traverse(source);
2034
+ }
2035
+ function warnInvalidSource(s, onWarn) {
2036
+ (onWarn || warn$2)(
2037
+ `Invalid watch source: `,
2038
+ s,
2039
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
2040
+ );
1959
2041
  }
1960
2042
  function traverse(value, depth = Infinity, seen) {
1961
2043
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
@@ -1991,8 +2073,8 @@ function traverse(value, depth = Infinity, seen) {
1991
2073
  }
1992
2074
 
1993
2075
  const stack = [];
1994
- function pushWarningContext$1(vnode) {
1995
- stack.push(vnode);
2076
+ function pushWarningContext$1(ctx) {
2077
+ stack.push(ctx);
1996
2078
  }
1997
2079
  function popWarningContext$1() {
1998
2080
  stack.pop();
@@ -2001,8 +2083,9 @@ let isWarning = false;
2001
2083
  function warn$1(msg, ...args) {
2002
2084
  if (isWarning) return;
2003
2085
  isWarning = true;
2004
- pauseTracking();
2005
- const instance = stack.length ? stack[stack.length - 1].component : null;
2086
+ const prevSub = setActiveSub();
2087
+ const entry = stack.length ? stack[stack.length - 1] : null;
2088
+ const instance = isVNode$2(entry) ? entry.component : entry;
2006
2089
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
2007
2090
  const trace = getComponentTrace();
2008
2091
  if (appWarnHandler) {
@@ -2016,9 +2099,9 @@ function warn$1(msg, ...args) {
2016
2099
  var _a, _b;
2017
2100
  return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
2018
2101
  }).join(""),
2019
- instance && instance.proxy,
2102
+ instance && instance.proxy || instance,
2020
2103
  trace.map(
2021
- ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
2104
+ ({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
2022
2105
  ).join("\n"),
2023
2106
  trace
2024
2107
  ]
@@ -2032,27 +2115,31 @@ function warn$1(msg, ...args) {
2032
2115
  }
2033
2116
  console.warn(...warnArgs);
2034
2117
  }
2035
- resetTracking();
2118
+ setActiveSub(prevSub);
2036
2119
  isWarning = false;
2037
2120
  }
2038
2121
  function getComponentTrace() {
2039
- let currentVNode = stack[stack.length - 1];
2040
- if (!currentVNode) {
2122
+ let currentCtx = stack[stack.length - 1];
2123
+ if (!currentCtx) {
2041
2124
  return [];
2042
2125
  }
2043
2126
  const normalizedStack = [];
2044
- while (currentVNode) {
2127
+ while (currentCtx) {
2045
2128
  const last = normalizedStack[0];
2046
- if (last && last.vnode === currentVNode) {
2129
+ if (last && last.ctx === currentCtx) {
2047
2130
  last.recurseCount++;
2048
2131
  } else {
2049
2132
  normalizedStack.push({
2050
- vnode: currentVNode,
2133
+ ctx: currentCtx,
2051
2134
  recurseCount: 0
2052
2135
  });
2053
2136
  }
2054
- const parentInstance = currentVNode.component && currentVNode.component.parent;
2055
- currentVNode = parentInstance && parentInstance.vnode;
2137
+ if (isVNode$2(currentCtx)) {
2138
+ const parent = currentCtx.component && currentCtx.component.parent;
2139
+ currentCtx = parent && parent.vnode || parent;
2140
+ } else {
2141
+ currentCtx = currentCtx.parent;
2142
+ }
2056
2143
  }
2057
2144
  return normalizedStack;
2058
2145
  }
@@ -2064,16 +2151,13 @@ function formatTrace(trace) {
2064
2151
  });
2065
2152
  return logs;
2066
2153
  }
2067
- function formatTraceEntry({ vnode, recurseCount }) {
2154
+ function formatTraceEntry({ ctx, recurseCount }) {
2068
2155
  const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
2069
- const isRoot = vnode.component ? vnode.component.parent == null : false;
2070
- const open = ` at <${formatComponentName(
2071
- vnode.component,
2072
- vnode.type,
2073
- isRoot
2074
- )}`;
2156
+ const instance = isVNode$2(ctx) ? ctx.component : ctx;
2157
+ const isRoot = instance ? instance.parent == null : false;
2158
+ const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
2075
2159
  const close = `>` + postfix;
2076
- return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
2160
+ return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
2077
2161
  }
2078
2162
  function formatProps(props) {
2079
2163
  const res = [];
@@ -2166,11 +2250,10 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
2166
2250
  }
2167
2251
  }
2168
2252
  function handleError(err, instance, type, throwInDev = true) {
2169
- const contextVNode = instance ? instance.vnode : null;
2170
2253
  const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
2171
2254
  if (instance) {
2172
2255
  let cur = instance.parent;
2173
- const exposedInstance = instance.proxy;
2256
+ const exposedInstance = instance.proxy || instance;
2174
2257
  const errorInfo = ErrorTypeStrings[type] ;
2175
2258
  while (cur) {
2176
2259
  const errorCapturedHooks = cur.ec;
@@ -2184,26 +2267,26 @@ function handleError(err, instance, type, throwInDev = true) {
2184
2267
  cur = cur.parent;
2185
2268
  }
2186
2269
  if (errorHandler) {
2187
- pauseTracking();
2270
+ const prevSub = setActiveSub();
2188
2271
  callWithErrorHandling(errorHandler, null, 10, [
2189
2272
  err,
2190
2273
  exposedInstance,
2191
2274
  errorInfo
2192
2275
  ]);
2193
- resetTracking();
2276
+ setActiveSub(prevSub);
2194
2277
  return;
2195
2278
  }
2196
2279
  }
2197
- logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
2280
+ logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
2198
2281
  }
2199
- function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
2282
+ function logError(err, type, instance, throwInDev = true, throwInProd = false) {
2200
2283
  {
2201
2284
  const info = ErrorTypeStrings[type];
2202
- if (contextVNode) {
2203
- pushWarningContext$1(contextVNode);
2285
+ if (instance) {
2286
+ pushWarningContext$1(instance);
2204
2287
  }
2205
2288
  warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
2206
- if (contextVNode) {
2289
+ if (instance) {
2207
2290
  popWarningContext$1();
2208
2291
  }
2209
2292
  if (throwInDev) {
@@ -2214,26 +2297,23 @@ function logError(err, type, contextVNode, throwInDev = true, throwInProd = fals
2214
2297
  }
2215
2298
  }
2216
2299
 
2217
- const queue = [];
2218
- let flushIndex = -1;
2219
- const pendingPostFlushCbs = [];
2220
- let activePostFlushCbs = null;
2300
+ const jobs = [];
2301
+ let postJobs = [];
2302
+ let activePostJobs = null;
2303
+ let currentFlushPromise = null;
2304
+ let jobsLength = 0;
2305
+ let flushIndex = 0;
2221
2306
  let postFlushIndex = 0;
2222
2307
  const resolvedPromise = /* @__PURE__ */ Promise.resolve();
2223
- let currentFlushPromise = null;
2224
2308
  const RECURSION_LIMIT = 100;
2225
2309
  function nextTick(fn) {
2226
2310
  const p = currentFlushPromise || resolvedPromise;
2227
2311
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2228
2312
  }
2229
- function findInsertionIndex(id) {
2230
- let start = flushIndex + 1;
2231
- let end = queue.length;
2313
+ function findInsertionIndex(order, queue, start, end) {
2232
2314
  while (start < end) {
2233
2315
  const middle = start + end >>> 1;
2234
- const middleJob = queue[middle];
2235
- const middleJobId = getId(middleJob);
2236
- if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
2316
+ if (queue[middle].order <= order) {
2237
2317
  start = middle + 1;
2238
2318
  } else {
2239
2319
  end = middle;
@@ -2241,130 +2321,168 @@ function findInsertionIndex(id) {
2241
2321
  }
2242
2322
  return start;
2243
2323
  }
2244
- function queueJob(job) {
2245
- if (!(job.flags & 1)) {
2246
- const jobId = getId(job);
2247
- const lastJob = queue[queue.length - 1];
2248
- if (!lastJob || // fast path when the job id is larger than the tail
2249
- !(job.flags & 2) && jobId >= getId(lastJob)) {
2250
- queue.push(job);
2324
+ function queueJob(job, id, isPre = false) {
2325
+ if (queueJobWorker(
2326
+ job,
2327
+ id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1,
2328
+ jobs,
2329
+ jobsLength,
2330
+ flushIndex
2331
+ )) {
2332
+ jobsLength++;
2333
+ queueFlush();
2334
+ }
2335
+ }
2336
+ function queueJobWorker(job, order, queue, length, flushIndex2) {
2337
+ const flags = job.flags;
2338
+ if (!(flags & 1)) {
2339
+ job.flags = flags | 1;
2340
+ job.order = order;
2341
+ if (flushIndex2 === length || // fast path when the job id is larger than the tail
2342
+ order >= queue[length - 1].order) {
2343
+ queue[length] = job;
2251
2344
  } else {
2252
- queue.splice(findInsertionIndex(jobId), 0, job);
2345
+ queue.splice(findInsertionIndex(order, queue, flushIndex2, length), 0, job);
2253
2346
  }
2254
- job.flags |= 1;
2255
- queueFlush();
2347
+ return true;
2256
2348
  }
2349
+ return false;
2257
2350
  }
2351
+ const doFlushJobs = () => {
2352
+ try {
2353
+ flushJobs();
2354
+ } catch (e) {
2355
+ currentFlushPromise = null;
2356
+ throw e;
2357
+ }
2358
+ };
2258
2359
  function queueFlush() {
2259
2360
  if (!currentFlushPromise) {
2260
- currentFlushPromise = resolvedPromise.then(flushJobs);
2361
+ currentFlushPromise = resolvedPromise.then(doFlushJobs);
2261
2362
  }
2262
2363
  }
2263
- function queuePostFlushCb(cb) {
2264
- if (!isArray(cb)) {
2265
- if (activePostFlushCbs && cb.id === -1) {
2266
- activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2267
- } else if (!(cb.flags & 1)) {
2268
- pendingPostFlushCbs.push(cb);
2269
- cb.flags |= 1;
2364
+ function queuePostFlushCb(jobs2, id = Infinity) {
2365
+ if (!isArray(jobs2)) {
2366
+ if (activePostJobs && id === -1) {
2367
+ activePostJobs.splice(postFlushIndex, 0, jobs2);
2368
+ } else {
2369
+ queueJobWorker(jobs2, id, postJobs, postJobs.length, 0);
2270
2370
  }
2271
2371
  } else {
2272
- pendingPostFlushCbs.push(...cb);
2372
+ for (const job of jobs2) {
2373
+ queueJobWorker(job, id, postJobs, postJobs.length, 0);
2374
+ }
2273
2375
  }
2274
2376
  queueFlush();
2275
2377
  }
2276
- function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2378
+ function flushPreFlushCbs(instance, seen) {
2277
2379
  {
2278
2380
  seen = seen || /* @__PURE__ */ new Map();
2279
2381
  }
2280
- for (; i < queue.length; i++) {
2281
- const cb = queue[i];
2282
- if (cb && cb.flags & 2) {
2283
- if (instance && cb.id !== instance.uid) {
2284
- continue;
2285
- }
2286
- if (checkRecursiveUpdates(seen, cb)) {
2287
- continue;
2288
- }
2289
- queue.splice(i, 1);
2290
- i--;
2291
- if (cb.flags & 4) {
2292
- cb.flags &= -2;
2293
- }
2294
- cb();
2295
- if (!(cb.flags & 4)) {
2296
- cb.flags &= -2;
2297
- }
2382
+ for (let i = flushIndex; i < jobsLength; i++) {
2383
+ const cb = jobs[i];
2384
+ if (cb.order & 1 || cb.order === Infinity) {
2385
+ continue;
2386
+ }
2387
+ if (instance && cb.order !== instance.uid * 2) {
2388
+ continue;
2389
+ }
2390
+ if (checkRecursiveUpdates(seen, cb)) {
2391
+ continue;
2392
+ }
2393
+ jobs.splice(i, 1);
2394
+ i--;
2395
+ jobsLength--;
2396
+ if (cb.flags & 2) {
2397
+ cb.flags &= -2;
2398
+ }
2399
+ cb();
2400
+ if (!(cb.flags & 2)) {
2401
+ cb.flags &= -2;
2298
2402
  }
2299
2403
  }
2300
2404
  }
2301
2405
  function flushPostFlushCbs(seen) {
2302
- if (pendingPostFlushCbs.length) {
2303
- const deduped = [...new Set(pendingPostFlushCbs)].sort(
2304
- (a, b) => getId(a) - getId(b)
2305
- );
2306
- pendingPostFlushCbs.length = 0;
2307
- if (activePostFlushCbs) {
2308
- activePostFlushCbs.push(...deduped);
2406
+ if (postJobs.length) {
2407
+ if (activePostJobs) {
2408
+ activePostJobs.push(...postJobs);
2409
+ postJobs.length = 0;
2309
2410
  return;
2310
2411
  }
2311
- activePostFlushCbs = deduped;
2412
+ activePostJobs = postJobs;
2413
+ postJobs = [];
2312
2414
  {
2313
2415
  seen = seen || /* @__PURE__ */ new Map();
2314
2416
  }
2315
- for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
2316
- const cb = activePostFlushCbs[postFlushIndex];
2417
+ while (postFlushIndex < activePostJobs.length) {
2418
+ const cb = activePostJobs[postFlushIndex++];
2317
2419
  if (checkRecursiveUpdates(seen, cb)) {
2318
2420
  continue;
2319
2421
  }
2320
- if (cb.flags & 4) {
2422
+ if (cb.flags & 2) {
2321
2423
  cb.flags &= -2;
2322
2424
  }
2323
- if (!(cb.flags & 8)) cb();
2324
- cb.flags &= -2;
2425
+ if (!(cb.flags & 4)) {
2426
+ try {
2427
+ cb();
2428
+ } finally {
2429
+ cb.flags &= -2;
2430
+ }
2431
+ }
2325
2432
  }
2326
- activePostFlushCbs = null;
2433
+ activePostJobs = null;
2327
2434
  postFlushIndex = 0;
2328
2435
  }
2329
2436
  }
2330
- const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2437
+ let isFlushing = false;
2438
+ function flushOnAppMount() {
2439
+ if (!isFlushing) {
2440
+ isFlushing = true;
2441
+ flushPreFlushCbs();
2442
+ flushPostFlushCbs();
2443
+ isFlushing = false;
2444
+ }
2445
+ }
2331
2446
  function flushJobs(seen) {
2332
2447
  {
2333
- seen = seen || /* @__PURE__ */ new Map();
2448
+ seen || (seen = /* @__PURE__ */ new Map());
2334
2449
  }
2335
- const check = (job) => checkRecursiveUpdates(seen, job) ;
2336
2450
  try {
2337
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
2338
- const job = queue[flushIndex];
2339
- if (job && !(job.flags & 8)) {
2340
- if (check(job)) {
2451
+ while (flushIndex < jobsLength) {
2452
+ const job = jobs[flushIndex];
2453
+ jobs[flushIndex++] = void 0;
2454
+ if (!(job.flags & 4)) {
2455
+ if (checkRecursiveUpdates(seen, job)) {
2341
2456
  continue;
2342
2457
  }
2343
- if (job.flags & 4) {
2458
+ if (job.flags & 2) {
2344
2459
  job.flags &= ~1;
2345
2460
  }
2346
- callWithErrorHandling(
2347
- job,
2348
- job.i,
2349
- job.i ? 15 : 14
2350
- );
2351
- if (!(job.flags & 4)) {
2352
- job.flags &= ~1;
2461
+ try {
2462
+ job();
2463
+ } catch (err) {
2464
+ handleError(
2465
+ err,
2466
+ job.i,
2467
+ job.i ? 15 : 14
2468
+ );
2469
+ } finally {
2470
+ if (!(job.flags & 2)) {
2471
+ job.flags &= ~1;
2472
+ }
2353
2473
  }
2354
2474
  }
2355
2475
  }
2356
2476
  } finally {
2357
- for (; flushIndex < queue.length; flushIndex++) {
2358
- const job = queue[flushIndex];
2359
- if (job) {
2360
- job.flags &= -2;
2361
- }
2477
+ while (flushIndex < jobsLength) {
2478
+ jobs[flushIndex].flags &= -2;
2479
+ jobs[flushIndex++] = void 0;
2362
2480
  }
2363
- flushIndex = -1;
2364
- queue.length = 0;
2481
+ flushIndex = 0;
2482
+ jobsLength = 0;
2365
2483
  flushPostFlushCbs(seen);
2366
2484
  currentFlushPromise = null;
2367
- if (queue.length || pendingPostFlushCbs.length) {
2485
+ if (jobsLength || postJobs.length) {
2368
2486
  flushJobs(seen);
2369
2487
  }
2370
2488
  }
@@ -2431,10 +2549,17 @@ function rerender(id, newRender) {
2431
2549
  instance.render = newRender;
2432
2550
  normalizeClassComponent(instance.type).render = newRender;
2433
2551
  }
2434
- instance.renderCache = [];
2435
2552
  isHmrUpdating = true;
2436
- instance.update();
2437
- isHmrUpdating = false;
2553
+ if (instance.vapor) {
2554
+ instance.hmrRerender();
2555
+ } else {
2556
+ const i = instance;
2557
+ i.renderCache = [];
2558
+ i.effect.run();
2559
+ }
2560
+ nextTick(() => {
2561
+ isHmrUpdating = false;
2562
+ });
2438
2563
  });
2439
2564
  }
2440
2565
  function reload(id, newComp) {
@@ -2443,42 +2568,54 @@ function reload(id, newComp) {
2443
2568
  newComp = normalizeClassComponent(newComp);
2444
2569
  updateComponentDef(record.initialDef, newComp);
2445
2570
  const instances = [...record.instances];
2446
- for (let i = 0; i < instances.length; i++) {
2447
- const instance = instances[i];
2448
- const oldComp = normalizeClassComponent(instance.type);
2449
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2450
- if (!dirtyInstances) {
2451
- if (oldComp !== record.initialDef) {
2452
- updateComponentDef(oldComp, newComp);
2453
- }
2454
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2455
- }
2456
- dirtyInstances.add(instance);
2457
- instance.appContext.propsCache.delete(instance.type);
2458
- instance.appContext.emitsCache.delete(instance.type);
2459
- instance.appContext.optionsCache.delete(instance.type);
2460
- if (instance.ceReload) {
2571
+ if (newComp.vapor) {
2572
+ for (const instance of instances) {
2573
+ instance.hmrReload(newComp);
2574
+ }
2575
+ } else {
2576
+ for (const instance of instances) {
2577
+ const oldComp = normalizeClassComponent(instance.type);
2578
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2579
+ if (!dirtyInstances) {
2580
+ if (oldComp !== record.initialDef) {
2581
+ updateComponentDef(oldComp, newComp);
2582
+ }
2583
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2584
+ }
2461
2585
  dirtyInstances.add(instance);
2462
- instance.ceReload(newComp.styles);
2463
- dirtyInstances.delete(instance);
2464
- } else if (instance.parent) {
2465
- queueJob(() => {
2466
- isHmrUpdating = true;
2467
- instance.parent.update();
2468
- isHmrUpdating = false;
2586
+ instance.appContext.propsCache.delete(instance.type);
2587
+ instance.appContext.emitsCache.delete(instance.type);
2588
+ instance.appContext.optionsCache.delete(instance.type);
2589
+ if (instance.ceReload) {
2590
+ dirtyInstances.add(instance);
2591
+ instance.ceReload(newComp.styles);
2469
2592
  dirtyInstances.delete(instance);
2470
- });
2471
- } else if (instance.appContext.reload) {
2472
- instance.appContext.reload();
2473
- } else if (typeof window !== "undefined") {
2474
- window.location.reload();
2475
- } else {
2476
- console.warn(
2477
- "[HMR] Root or manually mounted instance modified. Full reload required."
2478
- );
2479
- }
2480
- if (instance.root.ce && instance !== instance.root) {
2481
- instance.root.ce._removeChildStyle(oldComp);
2593
+ } else if (instance.parent) {
2594
+ queueJob(() => {
2595
+ isHmrUpdating = true;
2596
+ const parent = instance.parent;
2597
+ if (parent.vapor) {
2598
+ parent.hmrRerender();
2599
+ } else {
2600
+ parent.effect.run();
2601
+ }
2602
+ nextTick(() => {
2603
+ isHmrUpdating = false;
2604
+ });
2605
+ dirtyInstances.delete(instance);
2606
+ });
2607
+ } else if (instance.appContext.reload) {
2608
+ instance.appContext.reload();
2609
+ } else if (typeof window !== "undefined") {
2610
+ window.location.reload();
2611
+ } else {
2612
+ console.warn(
2613
+ "[HMR] Root or manually mounted instance modified. Full reload required."
2614
+ );
2615
+ }
2616
+ if (instance.root.ce && instance !== instance.root) {
2617
+ instance.root.ce._removeChildStyle(oldComp);
2618
+ }
2482
2619
  }
2483
2620
  }
2484
2621
  queuePostFlushCb(() => {
@@ -2653,14 +2790,14 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2653
2790
  }
2654
2791
  let hook = binding.dir[name];
2655
2792
  if (hook) {
2656
- pauseTracking();
2793
+ const prevSub = setActiveSub();
2657
2794
  callWithAsyncErrorHandling(hook, instance, 8, [
2658
2795
  vnode.el,
2659
2796
  binding,
2660
2797
  vnode,
2661
2798
  prevVNode
2662
2799
  ]);
2663
- resetTracking();
2800
+ setActiveSub(prevSub);
2664
2801
  }
2665
2802
  }
2666
2803
  }
@@ -2780,8 +2917,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
2780
2917
  }
2781
2918
  };
2782
2919
  if (value) {
2783
- doSet.id = -1;
2784
- queuePostRenderEffect(doSet, parentSuspense);
2920
+ queuePostRenderEffect(doSet, -1, parentSuspense);
2785
2921
  } else {
2786
2922
  doSet();
2787
2923
  }
@@ -2800,7 +2936,7 @@ function onActivated(hook, target) {
2800
2936
  function onDeactivated(hook, target) {
2801
2937
  registerKeepAliveHook(hook, "da", target);
2802
2938
  }
2803
- function registerKeepAliveHook(hook, type, target = currentInstance) {
2939
+ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
2804
2940
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2805
2941
  let current = target;
2806
2942
  while (current) {
@@ -2814,7 +2950,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
2814
2950
  injectHook(type, wrappedHook, target);
2815
2951
  if (target) {
2816
2952
  let current = target.parent;
2817
- while (current && current.parent) {
2953
+ while (current && current.parent && current.parent.vnode) {
2818
2954
  if (isKeepAlive(current.parent.vnode)) {
2819
2955
  injectToKeepAliveRoot(wrappedHook, type, target, current);
2820
2956
  }
@@ -2839,12 +2975,14 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2839
2975
  if (target) {
2840
2976
  const hooks = target[type] || (target[type] = []);
2841
2977
  const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2842
- pauseTracking();
2843
- const reset = setCurrentInstance(target);
2844
- const res = callWithAsyncErrorHandling(hook, target, type, args);
2845
- reset();
2846
- resetTracking();
2847
- return res;
2978
+ const prevSub = setActiveSub();
2979
+ const prev = setCurrentInstance(target);
2980
+ try {
2981
+ return callWithAsyncErrorHandling(hook, target, type, args);
2982
+ } finally {
2983
+ setCurrentInstance(...prev);
2984
+ setActiveSub(prevSub);
2985
+ }
2848
2986
  });
2849
2987
  if (prepend) {
2850
2988
  hooks.unshift(wrappedHook);
@@ -2896,8 +3034,9 @@ function ensureValidVNode$1(vnodes) {
2896
3034
  }
2897
3035
 
2898
3036
  const getPublicInstance = (i) => {
2899
- if (!i) return null;
2900
- if (isStatefulComponent(i)) return getComponentPublicInstance(i);
3037
+ if (!i || i.vapor) return null;
3038
+ if (isStatefulComponent(i))
3039
+ return getComponentPublicInstance(i);
2901
3040
  return getPublicInstance(i.parent);
2902
3041
  };
2903
3042
  const publicPropertiesMap = (
@@ -3566,7 +3705,7 @@ function createAppContext() {
3566
3705
  };
3567
3706
  }
3568
3707
  let uid$1 = 0;
3569
- function createAppAPI(render, hydrate) {
3708
+ function createAppAPI(mount, unmount, getPublicInstance, render) {
3570
3709
  return function createApp(rootComponent, rootProps = null) {
3571
3710
  if (!isFunction(rootComponent)) {
3572
3711
  rootComponent = extend({}, rootComponent);
@@ -3659,31 +3798,15 @@ function createAppAPI(render, hydrate) {
3659
3798
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
3660
3799
  );
3661
3800
  }
3662
- const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
3663
- vnode.appContext = context;
3664
- if (namespace === true) {
3665
- namespace = "svg";
3666
- } else if (namespace === false) {
3667
- namespace = void 0;
3668
- }
3669
- {
3670
- context.reload = () => {
3671
- const cloned = cloneVNode(vnode);
3672
- cloned.el = null;
3673
- render(cloned, rootContainer, namespace);
3674
- };
3675
- }
3801
+ const instance = mount(app, rootContainer, isHydrate, namespace);
3676
3802
  {
3677
- render(vnode, rootContainer, namespace);
3803
+ app._instance = instance;
3804
+ devtoolsInitApp(app, version);
3678
3805
  }
3679
3806
  isMounted = true;
3680
3807
  app._container = rootContainer;
3681
3808
  rootContainer.__vue_app__ = app;
3682
- {
3683
- app._instance = vnode.component;
3684
- devtoolsInitApp(app, version);
3685
- }
3686
- return getComponentPublicInstance(vnode.component);
3809
+ return getPublicInstance(instance);
3687
3810
  } else {
3688
3811
  warn$1(
3689
3812
  `App has already been mounted.
@@ -3706,7 +3829,7 @@ If you want to remount the same app, move your app creation logic into a factory
3706
3829
  app._instance,
3707
3830
  16
3708
3831
  );
3709
- render(null, app._container);
3832
+ unmount(app);
3710
3833
  {
3711
3834
  app._instance = null;
3712
3835
  devtoolsUnmountApp(app);
@@ -3747,6 +3870,7 @@ If you want to remount the same app, move your app creation logic into a factory
3747
3870
  let currentApp = null;
3748
3871
 
3749
3872
  function provide(key, value) {
3873
+ const currentInstance = getCurrentGenericInstance();
3750
3874
  if (!currentInstance) {
3751
3875
  {
3752
3876
  warn$1(`provide() can only be used inside setup().`);
@@ -3761,9 +3885,9 @@ function provide(key, value) {
3761
3885
  }
3762
3886
  }
3763
3887
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
3764
- const instance = currentInstance || currentRenderingInstance;
3888
+ const instance = getCurrentGenericInstance();
3765
3889
  if (instance || currentApp) {
3766
- let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
3890
+ let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.appContext && instance.appContext.provides : instance.parent.provides : void 0;
3767
3891
  if (provides && key in provides) {
3768
3892
  return provides[key];
3769
3893
  } else if (arguments.length > 1) {
@@ -3781,7 +3905,7 @@ const createInternalObject = () => Object.create(internalObjectProto);
3781
3905
  const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
3782
3906
 
3783
3907
  function initProps(instance, rawProps, isStateful, isSSR = false) {
3784
- const props = {};
3908
+ const props = instance.props = {};
3785
3909
  const attrs = createInternalObject();
3786
3910
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
3787
3911
  setFullProps(instance, rawProps, props, attrs);
@@ -3791,7 +3915,7 @@ function initProps(instance, rawProps, isStateful, isSSR = false) {
3791
3915
  }
3792
3916
  }
3793
3917
  {
3794
- validateProps(rawProps || {}, props, instance);
3918
+ validateProps(rawProps || {}, props, instance.propsOptions[0]);
3795
3919
  }
3796
3920
  if (isStateful) {
3797
3921
  instance.props = isSSR ? props : shallowReactive(props);
@@ -3843,11 +3967,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3843
3967
  const camelizedKey = camelize(key);
3844
3968
  props[camelizedKey] = resolvePropValue(
3845
3969
  options,
3846
- rawCurrentProps,
3847
3970
  camelizedKey,
3848
3971
  value,
3849
3972
  instance,
3850
- false
3973
+ baseResolveDefault
3851
3974
  );
3852
3975
  }
3853
3976
  } else {
@@ -3874,10 +3997,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3874
3997
  rawPrevProps[kebabKey] !== void 0)) {
3875
3998
  props[key] = resolvePropValue(
3876
3999
  options,
3877
- rawCurrentProps,
3878
4000
  key,
3879
4001
  void 0,
3880
4002
  instance,
4003
+ baseResolveDefault,
3881
4004
  true
3882
4005
  );
3883
4006
  }
@@ -3899,7 +4022,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3899
4022
  trigger(instance.attrs, "set", "");
3900
4023
  }
3901
4024
  {
3902
- validateProps(rawProps || {}, props, instance);
4025
+ validateProps(rawProps || {}, props, instance.propsOptions[0]);
3903
4026
  }
3904
4027
  }
3905
4028
  function setFullProps(instance, rawProps, props, attrs) {
@@ -3928,39 +4051,37 @@ function setFullProps(instance, rawProps, props, attrs) {
3928
4051
  }
3929
4052
  }
3930
4053
  if (needCastKeys) {
3931
- const rawCurrentProps = toRaw(props);
3932
4054
  const castValues = rawCastValues || EMPTY_OBJ;
3933
4055
  for (let i = 0; i < needCastKeys.length; i++) {
3934
4056
  const key = needCastKeys[i];
3935
4057
  props[key] = resolvePropValue(
3936
4058
  options,
3937
- rawCurrentProps,
3938
4059
  key,
3939
4060
  castValues[key],
3940
4061
  instance,
4062
+ baseResolveDefault,
3941
4063
  !hasOwn(castValues, key)
3942
4064
  );
3943
4065
  }
3944
4066
  }
3945
4067
  return hasAttrsChanged;
3946
4068
  }
3947
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
4069
+ function resolvePropValue(options, key, value, instance, resolveDefault, isAbsent = false) {
3948
4070
  const opt = options[key];
3949
4071
  if (opt != null) {
3950
4072
  const hasDefault = hasOwn(opt, "default");
3951
4073
  if (hasDefault && value === void 0) {
3952
4074
  const defaultValue = opt.default;
3953
4075
  if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
3954
- const { propsDefaults } = instance;
3955
- if (key in propsDefaults) {
3956
- value = propsDefaults[key];
4076
+ const cachedDefaults = instance.propsDefaults || (instance.propsDefaults = {});
4077
+ if (hasOwn(cachedDefaults, key)) {
4078
+ value = cachedDefaults[key];
3957
4079
  } else {
3958
- const reset = setCurrentInstance(instance);
3959
- value = propsDefaults[key] = defaultValue.call(
3960
- null,
3961
- props
4080
+ value = cachedDefaults[key] = resolveDefault(
4081
+ defaultValue,
4082
+ instance,
4083
+ key
3962
4084
  );
3963
- reset();
3964
4085
  }
3965
4086
  } else {
3966
4087
  value = defaultValue;
@@ -3979,6 +4100,17 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3979
4100
  }
3980
4101
  return value;
3981
4102
  }
4103
+ function baseResolveDefault(factory, instance, key) {
4104
+ let value;
4105
+ const prev = setCurrentInstance(instance);
4106
+ const props = toRaw(instance.props);
4107
+ value = factory.call(
4108
+ null,
4109
+ props
4110
+ );
4111
+ setCurrentInstance(...prev);
4112
+ return value;
4113
+ }
3982
4114
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
3983
4115
  function normalizePropsOptions(comp, appContext, asMixin = false) {
3984
4116
  const cache = asMixin ? mixinPropsCache : appContext.propsCache;
@@ -4013,6 +4145,14 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
4013
4145
  }
4014
4146
  return EMPTY_ARR;
4015
4147
  }
4148
+ baseNormalizePropsOptions(raw, normalized, needCastKeys);
4149
+ const res = [normalized, needCastKeys];
4150
+ if (isObject(comp)) {
4151
+ cache.set(comp, res);
4152
+ }
4153
+ return res;
4154
+ }
4155
+ function baseNormalizePropsOptions(raw, normalized, needCastKeys) {
4016
4156
  if (isArray(raw)) {
4017
4157
  for (let i = 0; i < raw.length; i++) {
4018
4158
  if (!isString(raw[i])) {
@@ -4057,11 +4197,6 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
4057
4197
  }
4058
4198
  }
4059
4199
  }
4060
- const res = [normalized, needCastKeys];
4061
- if (isObject(comp)) {
4062
- cache.set(comp, res);
4063
- }
4064
- return res;
4065
4200
  }
4066
4201
  function validatePropName(key) {
4067
4202
  if (key[0] !== "$" && !isReservedProp(key)) {
@@ -4083,26 +4218,26 @@ function getType(ctor) {
4083
4218
  }
4084
4219
  return "";
4085
4220
  }
4086
- function validateProps(rawProps, props, instance) {
4087
- const resolvedValues = toRaw(props);
4088
- const options = instance.propsOptions[0];
4221
+ function validateProps(rawProps, resolvedProps, options) {
4222
+ resolvedProps = toRaw(resolvedProps);
4089
4223
  const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
4090
4224
  for (const key in options) {
4091
- let opt = options[key];
4092
- if (opt == null) continue;
4093
- validateProp(
4094
- key,
4095
- resolvedValues[key],
4096
- opt,
4097
- shallowReadonly(resolvedValues) ,
4098
- !camelizePropsKey.includes(key)
4099
- );
4225
+ const opt = options[key];
4226
+ if (opt != null) {
4227
+ validateProp(
4228
+ key,
4229
+ resolvedProps[key],
4230
+ opt,
4231
+ resolvedProps,
4232
+ !camelizePropsKey.includes(key)
4233
+ );
4234
+ }
4100
4235
  }
4101
4236
  }
4102
- function validateProp(name, value, prop, props, isAbsent) {
4103
- const { type, required, validator, skipCheck } = prop;
4237
+ function validateProp(key, value, propOptions, resolvedProps, isAbsent) {
4238
+ const { type, required, validator, skipCheck } = propOptions;
4104
4239
  if (required && isAbsent) {
4105
- warn$1('Missing required prop: "' + name + '"');
4240
+ warn$1('Missing required prop: "' + key + '"');
4106
4241
  return;
4107
4242
  }
4108
4243
  if (value == null && !required) {
@@ -4118,12 +4253,12 @@ function validateProp(name, value, prop, props, isAbsent) {
4118
4253
  isValid = valid;
4119
4254
  }
4120
4255
  if (!isValid) {
4121
- warn$1(getInvalidTypeMessage(name, value, expectedTypes));
4256
+ warn$1(getInvalidTypeMessage(key, value, expectedTypes));
4122
4257
  return;
4123
4258
  }
4124
4259
  }
4125
- if (validator && !validator(value, props)) {
4126
- warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
4260
+ if (validator && !validator(value, shallowReadonly(resolvedProps) )) {
4261
+ warn$1('Invalid prop: custom validator check failed for prop "' + key + '".');
4127
4262
  }
4128
4263
  }
4129
4264
  const isSimpleType = /* @__PURE__ */ makeMap(
@@ -4194,7 +4329,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
4194
4329
  return rawSlot;
4195
4330
  }
4196
4331
  const normalized = withCtx((...args) => {
4197
- if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
4332
+ if (currentInstance && !currentInstance.vapor && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
4198
4333
  warn$1(
4199
4334
  `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
4200
4335
  );
@@ -4241,6 +4376,8 @@ const assignSlots = (slots, children, optimized) => {
4241
4376
  const initSlots = (instance, children, optimized) => {
4242
4377
  const slots = instance.slots = createInternalObject();
4243
4378
  if (instance.vnode.shapeFlag & 32) {
4379
+ const cacheIndexes = children.__;
4380
+ if (cacheIndexes) def(slots, "__", cacheIndexes, true);
4244
4381
  const type = children._;
4245
4382
  if (type) {
4246
4383
  assignSlots(slots, children, optimized);
@@ -4289,12 +4426,15 @@ const updateSlots = (instance, children, optimized) => {
4289
4426
 
4290
4427
  let supported;
4291
4428
  let perf;
4429
+ let cachedNow$1 = 0;
4430
+ const p$1 = /* @__PURE__ */ Promise.resolve();
4431
+ const getNow$1 = () => cachedNow$1 || (p$1.then(() => cachedNow$1 = 0), cachedNow$1 = isSupported() ? perf.now() : Date.now());
4292
4432
  function startMeasure(instance, type) {
4293
4433
  if (instance.appContext.config.performance && isSupported()) {
4294
4434
  perf.mark(`vue-${type}-${instance.uid}`);
4295
4435
  }
4296
4436
  {
4297
- devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
4437
+ devtoolsPerfStart(instance, type, getNow$1());
4298
4438
  }
4299
4439
  }
4300
4440
  function endMeasure(instance, type) {
@@ -4311,7 +4451,7 @@ function endMeasure(instance, type) {
4311
4451
  perf.clearMarks(endTag);
4312
4452
  }
4313
4453
  {
4314
- devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
4454
+ devtoolsPerfEnd(instance, type, getNow$1());
4315
4455
  }
4316
4456
  }
4317
4457
  function isSupported() {
@@ -4392,6 +4532,9 @@ function baseCreateRenderer(options, createHydrationFns) {
4392
4532
  optimized
4393
4533
  );
4394
4534
  break;
4535
+ case VaporSlot:
4536
+ getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
4537
+ break;
4395
4538
  default:
4396
4539
  if (shapeFlag & 1) {
4397
4540
  processElement(
@@ -4449,6 +4592,8 @@ function baseCreateRenderer(options, createHydrationFns) {
4449
4592
  }
4450
4593
  if (ref != null && parentComponent) {
4451
4594
  setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
4595
+ } else if (ref == null && n1 && n1.ref != null) {
4596
+ setRef(n1.ref, null, parentSuspense, n1, true);
4452
4597
  }
4453
4598
  };
4454
4599
  const processText = (n1, n2, container, anchor) => {
@@ -4602,11 +4747,15 @@ function baseCreateRenderer(options, createHydrationFns) {
4602
4747
  }
4603
4748
  hostInsert(el, container, anchor);
4604
4749
  if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
4605
- queuePostRenderEffect(() => {
4606
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4607
- needCallTransitionHooks && transition.enter(el);
4608
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4609
- }, parentSuspense);
4750
+ queuePostRenderEffect(
4751
+ () => {
4752
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4753
+ needCallTransitionHooks && transition.enter(el);
4754
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4755
+ },
4756
+ void 0,
4757
+ parentSuspense
4758
+ );
4610
4759
  }
4611
4760
  };
4612
4761
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
@@ -4618,8 +4767,8 @@ function baseCreateRenderer(options, createHydrationFns) {
4618
4767
  hostSetScopeId(el, slotScopeIds[i]);
4619
4768
  }
4620
4769
  }
4621
- if (parentComponent) {
4622
- let subTree = parentComponent.subTree;
4770
+ let subTree = parentComponent && parentComponent.subTree;
4771
+ if (subTree) {
4623
4772
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
4624
4773
  subTree = filterSingleRoot(subTree.children) || subTree;
4625
4774
  }
@@ -4736,10 +4885,14 @@ function baseCreateRenderer(options, createHydrationFns) {
4736
4885
  patchProps(el, oldProps, newProps, parentComponent, namespace);
4737
4886
  }
4738
4887
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
4739
- queuePostRenderEffect(() => {
4740
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4741
- dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
4742
- }, parentSuspense);
4888
+ queuePostRenderEffect(
4889
+ () => {
4890
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4891
+ dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
4892
+ },
4893
+ void 0,
4894
+ parentSuspense
4895
+ );
4743
4896
  }
4744
4897
  };
4745
4898
  const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
@@ -4867,7 +5020,22 @@ function baseCreateRenderer(options, createHydrationFns) {
4867
5020
  };
4868
5021
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4869
5022
  n2.slotScopeIds = slotScopeIds;
4870
- if (n1 == null) {
5023
+ if (n2.type.__vapor) {
5024
+ if (n1 == null) {
5025
+ getVaporInterface(parentComponent, n2).mount(
5026
+ n2,
5027
+ container,
5028
+ anchor,
5029
+ parentComponent
5030
+ );
5031
+ } else {
5032
+ getVaporInterface(parentComponent, n2).update(
5033
+ n1,
5034
+ n2,
5035
+ shouldUpdateComponent(n1, n2, optimized)
5036
+ );
5037
+ }
5038
+ } else if (n1 == null) {
4871
5039
  if (n2.shapeFlag & 512) {
4872
5040
  parentComponent.ctx.activate(
4873
5041
  n2,
@@ -4953,15 +5121,52 @@ function baseCreateRenderer(options, createHydrationFns) {
4953
5121
  return;
4954
5122
  } else {
4955
5123
  instance.next = n2;
4956
- instance.update();
5124
+ instance.effect.run();
4957
5125
  }
4958
5126
  } else {
4959
5127
  n2.el = n1.el;
4960
5128
  instance.vnode = n2;
4961
5129
  }
4962
5130
  };
4963
- const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
4964
- const componentUpdateFn = () => {
5131
+ class SetupRenderEffect extends ReactiveEffect {
5132
+ constructor(instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) {
5133
+ const prevScope = setCurrentScope(instance.scope);
5134
+ super();
5135
+ this.instance = instance;
5136
+ this.initialVNode = initialVNode;
5137
+ this.container = container;
5138
+ this.anchor = anchor;
5139
+ this.parentSuspense = parentSuspense;
5140
+ this.namespace = namespace;
5141
+ this.optimized = optimized;
5142
+ setCurrentScope(prevScope);
5143
+ this.job = instance.job = () => {
5144
+ if (this.dirty) {
5145
+ this.run();
5146
+ }
5147
+ };
5148
+ this.job.i = instance;
5149
+ {
5150
+ this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
5151
+ this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
5152
+ }
5153
+ }
5154
+ notify() {
5155
+ if (!(this.flags & 256)) {
5156
+ const job = this.job;
5157
+ queueJob(job, job.i.uid);
5158
+ }
5159
+ }
5160
+ fn() {
5161
+ const {
5162
+ instance,
5163
+ initialVNode,
5164
+ container,
5165
+ anchor,
5166
+ parentSuspense,
5167
+ namespace,
5168
+ optimized
5169
+ } = this;
4965
5170
  if (!instance.isMounted) {
4966
5171
  let vnodeHook;
4967
5172
  const { el, props } = initialVNode;
@@ -4976,7 +5181,8 @@ function baseCreateRenderer(options, createHydrationFns) {
4976
5181
  }
4977
5182
  toggleRecurse(instance, true);
4978
5183
  {
4979
- if (root.ce) {
5184
+ if (root.ce && // @ts-expect-error _def is private
5185
+ root.ce._def.shadowRoot !== false) {
4980
5186
  root.ce._injectChildStyle(type);
4981
5187
  }
4982
5188
  {
@@ -5004,23 +5210,24 @@ function baseCreateRenderer(options, createHydrationFns) {
5004
5210
  initialVNode.el = subTree.el;
5005
5211
  }
5006
5212
  if (m) {
5007
- queuePostRenderEffect(m, parentSuspense);
5213
+ queuePostRenderEffect(m, void 0, parentSuspense);
5008
5214
  }
5009
5215
  if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
5010
5216
  const scopedInitialVNode = initialVNode;
5011
5217
  queuePostRenderEffect(
5012
5218
  () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
5219
+ void 0,
5013
5220
  parentSuspense
5014
5221
  );
5015
5222
  }
5016
- if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
5017
- instance.a && queuePostRenderEffect(instance.a, parentSuspense);
5223
+ if (initialVNode.shapeFlag & 256 || parent && parent.vnode && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
5224
+ instance.a && queuePostRenderEffect(instance.a, void 0, parentSuspense);
5018
5225
  }
5019
5226
  instance.isMounted = true;
5020
5227
  {
5021
5228
  devtoolsComponentAdded(instance);
5022
5229
  }
5023
- initialVNode = container = anchor = null;
5230
+ this.initialVNode = this.container = this.anchor = null;
5024
5231
  } else {
5025
5232
  let { next, bu, u, parent, vnode } = instance;
5026
5233
  {
@@ -5032,7 +5239,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5032
5239
  }
5033
5240
  nonHydratedAsyncRoot.asyncDep.then(() => {
5034
5241
  if (!instance.isUnmounted) {
5035
- componentUpdateFn();
5242
+ this.fn();
5036
5243
  }
5037
5244
  });
5038
5245
  return;
@@ -5088,11 +5295,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5088
5295
  updateHOCHostEl(instance, nextTree.el);
5089
5296
  }
5090
5297
  if (u) {
5091
- queuePostRenderEffect(u, parentSuspense);
5298
+ queuePostRenderEffect(u, void 0, parentSuspense);
5092
5299
  }
5093
5300
  if (vnodeHook = next.props && next.props.onVnodeUpdated) {
5094
5301
  queuePostRenderEffect(
5095
5302
  () => invokeVNodeHook(vnodeHook, parent, next, vnode),
5303
+ void 0,
5096
5304
  parentSuspense
5097
5305
  );
5098
5306
  }
@@ -5103,21 +5311,21 @@ function baseCreateRenderer(options, createHydrationFns) {
5103
5311
  popWarningContext$1();
5104
5312
  }
5105
5313
  }
5106
- };
5107
- instance.scope.on();
5108
- const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
5109
- instance.scope.off();
5110
- const update = instance.update = effect.run.bind(effect);
5111
- const job = instance.job = effect.runIfDirty.bind(effect);
5112
- job.i = instance;
5113
- job.id = instance.uid;
5114
- effect.scheduler = () => queueJob(job);
5115
- toggleRecurse(instance, true);
5116
- {
5117
- effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
5118
- effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
5119
5314
  }
5120
- update();
5315
+ }
5316
+ const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
5317
+ const effect = instance.effect = new SetupRenderEffect(
5318
+ instance,
5319
+ initialVNode,
5320
+ container,
5321
+ anchor,
5322
+ parentSuspense,
5323
+ namespace,
5324
+ optimized
5325
+ );
5326
+ instance.update = effect.run.bind(effect);
5327
+ toggleRecurse(instance, true);
5328
+ effect.run();
5121
5329
  };
5122
5330
  const updateComponentPreRender = (instance, nextVNode, optimized) => {
5123
5331
  nextVNode.component = instance;
@@ -5126,9 +5334,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5126
5334
  instance.next = null;
5127
5335
  updateProps(instance, nextVNode.props, prevProps, optimized);
5128
5336
  updateSlots(instance, nextVNode.children, optimized);
5129
- pauseTracking();
5337
+ const prevSub = setActiveSub();
5130
5338
  flushPreFlushCbs(instance);
5131
- resetTracking();
5339
+ setActiveSub(prevSub);
5132
5340
  };
5133
5341
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
5134
5342
  const c1 = n1 && n1.children;
@@ -5405,7 +5613,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5405
5613
  );
5406
5614
  } else if (moved) {
5407
5615
  if (j < 0 || i !== increasingNewIndexSequence[j]) {
5408
- move(nextChild, container, anchor, 2);
5616
+ move(
5617
+ nextChild,
5618
+ container,
5619
+ anchor,
5620
+ 2,
5621
+ parentComponent
5622
+ );
5409
5623
  } else {
5410
5624
  j--;
5411
5625
  }
@@ -5413,10 +5627,20 @@ function baseCreateRenderer(options, createHydrationFns) {
5413
5627
  }
5414
5628
  }
5415
5629
  };
5416
- const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
5630
+ const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
5417
5631
  const { el, type, transition, children, shapeFlag } = vnode;
5418
5632
  if (shapeFlag & 6) {
5419
- move(vnode.component.subTree, container, anchor, moveType);
5633
+ if (type.__vapor) {
5634
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
5635
+ } else {
5636
+ move(
5637
+ vnode.component.subTree,
5638
+ container,
5639
+ anchor,
5640
+ moveType,
5641
+ parentComponent
5642
+ );
5643
+ }
5420
5644
  return;
5421
5645
  }
5422
5646
  if (shapeFlag & 128) {
@@ -5424,13 +5648,25 @@ function baseCreateRenderer(options, createHydrationFns) {
5424
5648
  return;
5425
5649
  }
5426
5650
  if (shapeFlag & 64) {
5427
- type.move(vnode, container, anchor, internals);
5651
+ type.move(
5652
+ vnode,
5653
+ container,
5654
+ anchor,
5655
+ internals,
5656
+ parentComponent
5657
+ );
5428
5658
  return;
5429
5659
  }
5430
5660
  if (type === Fragment) {
5431
5661
  hostInsert(el, container, anchor);
5432
5662
  for (let i = 0; i < children.length; i++) {
5433
- move(children[i], container, anchor, moveType);
5663
+ move(
5664
+ children[i],
5665
+ container,
5666
+ anchor,
5667
+ moveType,
5668
+ parentComponent
5669
+ );
5434
5670
  }
5435
5671
  hostInsert(vnode.anchor, container, anchor);
5436
5672
  return;
@@ -5444,7 +5680,11 @@ function baseCreateRenderer(options, createHydrationFns) {
5444
5680
  if (moveType === 0) {
5445
5681
  transition.beforeEnter(el);
5446
5682
  hostInsert(el, container, anchor);
5447
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
5683
+ queuePostRenderEffect(
5684
+ () => transition.enter(el),
5685
+ void 0,
5686
+ parentSuspense
5687
+ );
5448
5688
  } else {
5449
5689
  const { leave, delayLeave, afterLeave } = transition;
5450
5690
  const remove2 = () => {
@@ -5486,9 +5726,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5486
5726
  optimized = false;
5487
5727
  }
5488
5728
  if (ref != null) {
5489
- pauseTracking();
5729
+ const prevSub = setActiveSub();
5490
5730
  setRef(ref, null, parentSuspense, vnode, true);
5491
- resetTracking();
5731
+ setActiveSub(prevSub);
5492
5732
  }
5493
5733
  if (cacheIndex != null) {
5494
5734
  parentComponent.renderCache[cacheIndex] = void 0;
@@ -5504,7 +5744,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5504
5744
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
5505
5745
  }
5506
5746
  if (shapeFlag & 6) {
5507
- unmountComponent(vnode.component, parentSuspense, doRemove);
5747
+ if (type.__vapor) {
5748
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
5749
+ return;
5750
+ } else {
5751
+ unmountComponent(vnode.component, parentSuspense, doRemove);
5752
+ }
5508
5753
  } else {
5509
5754
  if (shapeFlag & 128) {
5510
5755
  vnode.suspense.unmount(parentSuspense, doRemove);
@@ -5538,15 +5783,23 @@ function baseCreateRenderer(options, createHydrationFns) {
5538
5783
  } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
5539
5784
  unmountChildren(children, parentComponent, parentSuspense);
5540
5785
  }
5786
+ if (type === VaporSlot) {
5787
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
5788
+ return;
5789
+ }
5541
5790
  if (doRemove) {
5542
5791
  remove(vnode);
5543
5792
  }
5544
5793
  }
5545
5794
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
5546
- queuePostRenderEffect(() => {
5547
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5548
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
5549
- }, parentSuspense);
5795
+ queuePostRenderEffect(
5796
+ () => {
5797
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5798
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
5799
+ },
5800
+ void 0,
5801
+ parentSuspense
5802
+ );
5550
5803
  }
5551
5804
  };
5552
5805
  const remove = (vnode) => {
@@ -5603,7 +5856,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5603
5856
  const {
5604
5857
  bum,
5605
5858
  scope,
5606
- job,
5859
+ effect,
5607
5860
  subTree,
5608
5861
  um,
5609
5862
  m,
@@ -5622,16 +5875,18 @@ function baseCreateRenderer(options, createHydrationFns) {
5622
5875
  });
5623
5876
  }
5624
5877
  scope.stop();
5625
- if (job) {
5626
- job.flags |= 8;
5878
+ if (effect) {
5879
+ effect.stop();
5627
5880
  unmount(subTree, instance, parentSuspense, doRemove);
5628
5881
  }
5629
5882
  if (um) {
5630
- queuePostRenderEffect(um, parentSuspense);
5883
+ queuePostRenderEffect(um, void 0, parentSuspense);
5631
5884
  }
5632
- queuePostRenderEffect(() => {
5633
- instance.isUnmounted = true;
5634
- }, parentSuspense);
5885
+ queuePostRenderEffect(
5886
+ () => instance.isUnmounted = true,
5887
+ void 0,
5888
+ parentSuspense
5889
+ );
5635
5890
  if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
5636
5891
  parentSuspense.deps--;
5637
5892
  if (parentSuspense.deps === 0) {
@@ -5649,6 +5904,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5649
5904
  };
5650
5905
  const getNextHostNode = (vnode) => {
5651
5906
  if (vnode.shapeFlag & 6) {
5907
+ if (vnode.type.__vapor) {
5908
+ return hostNextSibling(vnode.component.block);
5909
+ }
5652
5910
  return getNextHostNode(vnode.component.subTree);
5653
5911
  }
5654
5912
  if (vnode.shapeFlag & 128) {
@@ -5658,7 +5916,6 @@ function baseCreateRenderer(options, createHydrationFns) {
5658
5916
  const teleportEnd = el && el[TeleportEndKey];
5659
5917
  return teleportEnd ? hostNextSibling(teleportEnd) : el;
5660
5918
  };
5661
- let isFlushing = false;
5662
5919
  const render = (vnode, container, namespace) => {
5663
5920
  if (vnode == null) {
5664
5921
  if (container._vnode) {
@@ -5676,12 +5933,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5676
5933
  );
5677
5934
  }
5678
5935
  container._vnode = vnode;
5679
- if (!isFlushing) {
5680
- isFlushing = true;
5681
- flushPreFlushCbs();
5682
- flushPostFlushCbs();
5683
- isFlushing = false;
5684
- }
5936
+ flushOnAppMount();
5685
5937
  };
5686
5938
  const internals = {
5687
5939
  p: patch,
@@ -5689,6 +5941,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5689
5941
  m: move,
5690
5942
  r: remove,
5691
5943
  mt: mountComponent,
5944
+ umt: unmountComponent,
5692
5945
  mc: mountChildren,
5693
5946
  pc: patchChildren,
5694
5947
  pbc: patchBlockChildren,
@@ -5696,22 +5949,51 @@ function baseCreateRenderer(options, createHydrationFns) {
5696
5949
  o: options
5697
5950
  };
5698
5951
  let hydrate;
5952
+ const mountApp = (app, container, isHydrate, namespace) => {
5953
+ const vnode = app._ceVNode || createVNode(app._component, app._props);
5954
+ vnode.appContext = app._context;
5955
+ if (namespace === true) {
5956
+ namespace = "svg";
5957
+ } else if (namespace === false) {
5958
+ namespace = void 0;
5959
+ }
5960
+ {
5961
+ app._context.reload = () => {
5962
+ const cloned = cloneVNode(vnode);
5963
+ cloned.el = null;
5964
+ render(cloned, container, namespace);
5965
+ };
5966
+ }
5967
+ {
5968
+ render(vnode, container, namespace);
5969
+ }
5970
+ return vnode.component;
5971
+ };
5972
+ const unmountApp = (app) => {
5973
+ render(null, app._container);
5974
+ };
5699
5975
  return {
5700
5976
  render,
5701
5977
  hydrate,
5702
- createApp: createAppAPI(render)
5978
+ internals,
5979
+ createApp: createAppAPI(
5980
+ mountApp,
5981
+ unmountApp,
5982
+ getComponentPublicInstance)
5703
5983
  };
5704
5984
  }
5705
5985
  function resolveChildrenNamespace({ type, props }, currentNamespace) {
5706
5986
  return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
5707
5987
  }
5708
- function toggleRecurse({ effect, job }, allowed) {
5709
- if (allowed) {
5710
- effect.flags |= 32;
5711
- job.flags |= 4;
5712
- } else {
5713
- effect.flags &= -33;
5714
- job.flags &= -5;
5988
+ function toggleRecurse({ effect, job, vapor }, allowed) {
5989
+ if (!vapor) {
5990
+ if (allowed) {
5991
+ effect.flags |= 128;
5992
+ job.flags |= 2;
5993
+ } else {
5994
+ effect.flags &= -129;
5995
+ job.flags &= -3;
5996
+ }
5715
5997
  }
5716
5998
  }
5717
5999
  function needTransition(parentSuspense, transition) {
@@ -5744,46 +6026,6 @@ function traverseStaticChildren(n1, n2, shallow = false) {
5744
6026
  }
5745
6027
  }
5746
6028
  }
5747
- function getSequence(arr) {
5748
- const p = arr.slice();
5749
- const result = [0];
5750
- let i, j, u, v, c;
5751
- const len = arr.length;
5752
- for (i = 0; i < len; i++) {
5753
- const arrI = arr[i];
5754
- if (arrI !== 0) {
5755
- j = result[result.length - 1];
5756
- if (arr[j] < arrI) {
5757
- p[i] = j;
5758
- result.push(i);
5759
- continue;
5760
- }
5761
- u = 0;
5762
- v = result.length - 1;
5763
- while (u < v) {
5764
- c = u + v >> 1;
5765
- if (arr[result[c]] < arrI) {
5766
- u = c + 1;
5767
- } else {
5768
- v = c;
5769
- }
5770
- }
5771
- if (arrI < arr[result[u]]) {
5772
- if (u > 0) {
5773
- p[i] = result[u - 1];
5774
- }
5775
- result[u] = i;
5776
- }
5777
- }
5778
- }
5779
- u = result.length;
5780
- v = result[u - 1];
5781
- while (u-- > 0) {
5782
- result[u] = v;
5783
- v = p[v];
5784
- }
5785
- return result;
5786
- }
5787
6029
  function locateNonHydratedAsyncRoot(instance) {
5788
6030
  const subComponent = instance.subTree.component;
5789
6031
  if (subComponent) {
@@ -5797,8 +6039,22 @@ function locateNonHydratedAsyncRoot(instance) {
5797
6039
  function invalidateMount(hooks) {
5798
6040
  if (hooks) {
5799
6041
  for (let i = 0; i < hooks.length; i++)
5800
- hooks[i].flags |= 8;
6042
+ hooks[i].flags |= 4;
6043
+ }
6044
+ }
6045
+ function getVaporInterface(instance, vnode) {
6046
+ const ctx = instance ? instance.appContext : vnode.appContext;
6047
+ const res = ctx && ctx.vapor;
6048
+ if (!res) {
6049
+ warn$1(
6050
+ `Vapor component found in vdom tree but vapor-in-vdom interop was not installed. Make sure to install it:
6051
+ \`\`\`
6052
+ import { vaporInteropPlugin } from 'vue'
6053
+ app.use(vaporInteropPlugin)
6054
+ \`\`\``
6055
+ );
5801
6056
  }
6057
+ return res;
5802
6058
  }
5803
6059
 
5804
6060
  const ssrContextKey = Symbol.for("v-scx");
@@ -5822,8 +6078,41 @@ function watch(source, cb, options) {
5822
6078
  }
5823
6079
  return doWatch(source, cb, options);
5824
6080
  }
6081
+ class RenderWatcherEffect extends WatcherEffect {
6082
+ constructor(instance, source, cb, options, flush) {
6083
+ super(source, cb, options);
6084
+ this.flush = flush;
6085
+ const job = () => {
6086
+ if (this.dirty) {
6087
+ this.run();
6088
+ }
6089
+ };
6090
+ if (cb) {
6091
+ this.flags |= 128;
6092
+ job.flags |= 2;
6093
+ }
6094
+ if (instance) {
6095
+ job.i = instance;
6096
+ }
6097
+ this.job = job;
6098
+ }
6099
+ notify() {
6100
+ const flags = this.flags;
6101
+ if (!(flags & 256)) {
6102
+ const flush = this.flush;
6103
+ const job = this.job;
6104
+ if (flush === "post") {
6105
+ queuePostRenderEffect(job, void 0, job.i ? job.i.suspense : null);
6106
+ } else if (flush === "pre") {
6107
+ queueJob(job, job.i ? job.i.uid : void 0, true);
6108
+ } else {
6109
+ job();
6110
+ }
6111
+ }
6112
+ }
6113
+ }
5825
6114
  function doWatch(source, cb, options = EMPTY_OBJ) {
5826
- const { immediate, deep, flush, once } = options;
6115
+ const { immediate, deep, flush = "pre", once } = options;
5827
6116
  if (!cb) {
5828
6117
  if (immediate !== void 0) {
5829
6118
  warn$1(
@@ -5860,42 +6149,32 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
5860
6149
  }
5861
6150
  const instance = currentInstance;
5862
6151
  baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
5863
- let isPre = false;
5864
- if (flush === "post") {
5865
- baseWatchOptions.scheduler = (job) => {
5866
- queuePostRenderEffect(job, instance && instance.suspense);
5867
- };
5868
- } else if (flush !== "sync") {
5869
- isPre = true;
5870
- baseWatchOptions.scheduler = (job, isFirstRun) => {
5871
- if (isFirstRun) {
5872
- job();
5873
- } else {
5874
- queueJob(job);
5875
- }
5876
- };
6152
+ const effect = new RenderWatcherEffect(
6153
+ instance,
6154
+ source,
6155
+ cb,
6156
+ baseWatchOptions,
6157
+ flush
6158
+ );
6159
+ if (cb) {
6160
+ effect.run(true);
6161
+ } else if (flush === "post") {
6162
+ queuePostRenderEffect(effect.job, void 0, instance && instance.suspense);
6163
+ } else {
6164
+ effect.run(true);
5877
6165
  }
5878
- baseWatchOptions.augmentJob = (job) => {
5879
- if (cb) {
5880
- job.flags |= 4;
5881
- }
5882
- if (isPre) {
5883
- job.flags |= 2;
5884
- if (instance) {
5885
- job.id = instance.uid;
5886
- job.i = instance;
5887
- }
5888
- }
5889
- };
5890
- const watchHandle = watch$1(source, cb, baseWatchOptions);
6166
+ const stop = effect.stop.bind(effect);
6167
+ stop.pause = effect.pause.bind(effect);
6168
+ stop.resume = effect.resume.bind(effect);
6169
+ stop.stop = stop;
5891
6170
  if (isInSSRComponentSetup) {
5892
6171
  if (ssrCleanup) {
5893
- ssrCleanup.push(watchHandle);
6172
+ ssrCleanup.push(stop);
5894
6173
  } else if (runsImmediately) {
5895
- watchHandle();
6174
+ stop();
5896
6175
  }
5897
6176
  }
5898
- return watchHandle;
6177
+ return stop;
5899
6178
  }
5900
6179
  function instanceWatch(source, value, options) {
5901
6180
  const publicThis = this.proxy;
@@ -5907,9 +6186,9 @@ function instanceWatch(source, value, options) {
5907
6186
  cb = value.handler;
5908
6187
  options = value;
5909
6188
  }
5910
- const reset = setCurrentInstance(this);
6189
+ const prev = setCurrentInstance(this);
5911
6190
  const res = doWatch(getter, cb.bind(publicThis), options);
5912
- reset();
6191
+ setCurrentInstance(...prev);
5913
6192
  return res;
5914
6193
  }
5915
6194
  function createPathGetter(ctx, path) {
@@ -5923,21 +6202,26 @@ function createPathGetter(ctx, path) {
5923
6202
  };
5924
6203
  }
5925
6204
 
5926
- const getModelModifiers = (props, modelName) => {
5927
- return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
6205
+ const getModelModifiers = (props, modelName, getter) => {
6206
+ return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
5928
6207
  };
5929
6208
 
5930
6209
  function emit(instance, event, ...rawArgs) {
6210
+ return baseEmit(
6211
+ instance,
6212
+ instance.vnode.props || EMPTY_OBJ,
6213
+ defaultPropGetter,
6214
+ event,
6215
+ ...rawArgs
6216
+ );
6217
+ }
6218
+ function baseEmit(instance, props, getter, event, ...rawArgs) {
5931
6219
  if (instance.isUnmounted) return;
5932
- const props = instance.vnode.props || EMPTY_OBJ;
5933
6220
  {
5934
- const {
5935
- emitsOptions,
5936
- propsOptions: [propsOptions]
5937
- } = instance;
6221
+ const { emitsOptions, propsOptions } = instance;
5938
6222
  if (emitsOptions) {
5939
6223
  if (!(event in emitsOptions) && true) {
5940
- if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
6224
+ if (!propsOptions || !propsOptions[0] || !(toHandlerKey(camelize(event)) in propsOptions[0])) {
5941
6225
  warn$1(
5942
6226
  `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
5943
6227
  );
@@ -5957,7 +6241,7 @@ function emit(instance, event, ...rawArgs) {
5957
6241
  }
5958
6242
  let args = rawArgs;
5959
6243
  const isModelListener = event.startsWith("update:");
5960
- const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
6244
+ const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
5961
6245
  if (modifiers) {
5962
6246
  if (modifiers.trim) {
5963
6247
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
@@ -5971,7 +6255,7 @@ function emit(instance, event, ...rawArgs) {
5971
6255
  }
5972
6256
  {
5973
6257
  const lowerCaseEvent = event.toLowerCase();
5974
- if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
6258
+ if (lowerCaseEvent !== event && getter(props, toHandlerKey(lowerCaseEvent))) {
5975
6259
  warn$1(
5976
6260
  `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
5977
6261
  instance,
@@ -5983,10 +6267,10 @@ function emit(instance, event, ...rawArgs) {
5983
6267
  }
5984
6268
  }
5985
6269
  let handlerName;
5986
- let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
5987
- props[handlerName = toHandlerKey(camelize(event))];
6270
+ let handler = getter(props, handlerName = toHandlerKey(event)) || // also try camelCase event handler (#2249)
6271
+ getter(props, handlerName = toHandlerKey(camelize(event)));
5988
6272
  if (!handler && isModelListener) {
5989
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
6273
+ handler = getter(props, handlerName = toHandlerKey(hyphenate(event)));
5990
6274
  }
5991
6275
  if (handler) {
5992
6276
  callWithAsyncErrorHandling(
@@ -5996,7 +6280,7 @@ function emit(instance, event, ...rawArgs) {
5996
6280
  args
5997
6281
  );
5998
6282
  }
5999
- const onceHandler = props[handlerName + `Once`];
6283
+ const onceHandler = getter(props, handlerName + `Once`);
6000
6284
  if (onceHandler) {
6001
6285
  if (!instance.emitted) {
6002
6286
  instance.emitted = {};
@@ -6012,6 +6296,9 @@ function emit(instance, event, ...rawArgs) {
6012
6296
  );
6013
6297
  }
6014
6298
  }
6299
+ function defaultPropGetter(props, key) {
6300
+ return props[key];
6301
+ }
6015
6302
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
6016
6303
  const cache = appContext.emitsCache;
6017
6304
  const cached = cache.get(comp);
@@ -6338,7 +6625,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
6338
6625
  return false;
6339
6626
  }
6340
6627
  function updateHOCHostEl({ vnode, parent }, el) {
6341
- while (parent) {
6628
+ while (parent && !parent.vapor) {
6342
6629
  const root = parent.subTree;
6343
6630
  if (root.suspense && root.suspense.activeBranch === vnode) {
6344
6631
  root.el = vnode.el;
@@ -6353,7 +6640,7 @@ function updateHOCHostEl({ vnode, parent }, el) {
6353
6640
  }
6354
6641
 
6355
6642
  const isSuspense = (type) => type.__isSuspense;
6356
- function queueEffectWithSuspense(fn, suspense) {
6643
+ function queueEffectWithSuspense(fn, id, suspense) {
6357
6644
  if (suspense && suspense.pendingBranch) {
6358
6645
  if (isArray(fn)) {
6359
6646
  suspense.effects.push(...fn);
@@ -6361,7 +6648,7 @@ function queueEffectWithSuspense(fn, suspense) {
6361
6648
  suspense.effects.push(fn);
6362
6649
  }
6363
6650
  } else {
6364
- queuePostFlushCb(fn);
6651
+ queuePostFlushCb(fn, id);
6365
6652
  }
6366
6653
  }
6367
6654
 
@@ -6369,6 +6656,7 @@ const Fragment = Symbol.for("v-fgt");
6369
6656
  const Text = Symbol.for("v-txt");
6370
6657
  const Comment = Symbol.for("v-cmt");
6371
6658
  const Static = Symbol.for("v-stc");
6659
+ const VaporSlot = Symbol.for("v-vps");
6372
6660
  let currentBlock = null;
6373
6661
  let isBlockTreeEnabled = 1;
6374
6662
  function setBlockTracking(value, inVOnce = false) {
@@ -6689,6 +6977,40 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
6689
6977
  ]);
6690
6978
  }
6691
6979
 
6980
+ let currentInstance = null;
6981
+ const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
6982
+ const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
6983
+ let isInSSRComponentSetup = false;
6984
+ let setInSSRSetupState;
6985
+ let simpleSetCurrentInstance;
6986
+ {
6987
+ const g = getGlobalThis();
6988
+ const registerGlobalSetter = (key, setter) => {
6989
+ let setters;
6990
+ if (!(setters = g[key])) setters = g[key] = [];
6991
+ setters.push(setter);
6992
+ return (v) => {
6993
+ if (setters.length > 1) setters.forEach((set) => set(v));
6994
+ else setters[0](v);
6995
+ };
6996
+ };
6997
+ simpleSetCurrentInstance = registerGlobalSetter(
6998
+ `__VUE_INSTANCE_SETTERS__`,
6999
+ (v) => currentInstance = v
7000
+ );
7001
+ setInSSRSetupState = registerGlobalSetter(
7002
+ `__VUE_SSR_SETTERS__`,
7003
+ (v) => isInSSRComponentSetup = v
7004
+ );
7005
+ }
7006
+ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope : void 0) => {
7007
+ try {
7008
+ return [currentInstance, setCurrentScope(scope)];
7009
+ } finally {
7010
+ simpleSetCurrentInstance(instance);
7011
+ }
7012
+ };
7013
+
6692
7014
  const emptyAppContext = createAppContext();
6693
7015
  let uid = 0;
6694
7016
  function createComponentInstance$1(vnode, parent, suspense) {
@@ -6733,7 +7055,7 @@ function createComponentInstance$1(vnode, parent, suspense) {
6733
7055
  // to be set immediately
6734
7056
  emitted: null,
6735
7057
  // props default value
6736
- propsDefaults: EMPTY_OBJ,
7058
+ propsDefaults: null,
6737
7059
  // inheritAttrs
6738
7060
  inheritAttrs: type.inheritAttrs,
6739
7061
  // state
@@ -6780,44 +7102,6 @@ function createComponentInstance$1(vnode, parent, suspense) {
6780
7102
  }
6781
7103
  return instance;
6782
7104
  }
6783
- let currentInstance = null;
6784
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
6785
- let internalSetCurrentInstance;
6786
- let setInSSRSetupState;
6787
- {
6788
- const g = getGlobalThis();
6789
- const registerGlobalSetter = (key, setter) => {
6790
- let setters;
6791
- if (!(setters = g[key])) setters = g[key] = [];
6792
- setters.push(setter);
6793
- return (v) => {
6794
- if (setters.length > 1) setters.forEach((set) => set(v));
6795
- else setters[0](v);
6796
- };
6797
- };
6798
- internalSetCurrentInstance = registerGlobalSetter(
6799
- `__VUE_INSTANCE_SETTERS__`,
6800
- (v) => currentInstance = v
6801
- );
6802
- setInSSRSetupState = registerGlobalSetter(
6803
- `__VUE_SSR_SETTERS__`,
6804
- (v) => isInSSRComponentSetup = v
6805
- );
6806
- }
6807
- const setCurrentInstance = (instance) => {
6808
- const prev = currentInstance;
6809
- internalSetCurrentInstance(instance);
6810
- instance.scope.on();
6811
- return () => {
6812
- instance.scope.off();
6813
- internalSetCurrentInstance(prev);
6814
- };
6815
- };
6816
- const unsetCurrentInstance = () => {
6817
- currentInstance && currentInstance.scope.off();
6818
- internalSetCurrentInstance(null);
6819
- };
6820
- const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
6821
7105
  function validateComponentName(name, { isNativeTag }) {
6822
7106
  if (isBuiltInTag(name) || isNativeTag(name)) {
6823
7107
  warn$1(
@@ -6828,13 +7112,16 @@ function validateComponentName(name, { isNativeTag }) {
6828
7112
  function isStatefulComponent(instance) {
6829
7113
  return instance.vnode.shapeFlag & 4;
6830
7114
  }
6831
- let isInSSRComponentSetup = false;
6832
7115
  function setupComponent$1(instance, isSSR = false, optimized = false) {
6833
7116
  isSSR && setInSSRSetupState(isSSR);
6834
- const { props, children } = instance.vnode;
7117
+ const { props, children, vi } = instance.vnode;
6835
7118
  const isStateful = isStatefulComponent(instance);
6836
- initProps(instance, props, isStateful, isSSR);
6837
- initSlots(instance, children, optimized || isSSR);
7119
+ if (vi) {
7120
+ vi(instance);
7121
+ } else {
7122
+ initProps(instance, props, isStateful, isSSR);
7123
+ initSlots(instance, children, optimized || isSSR);
7124
+ }
6838
7125
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
6839
7126
  isSSR && setInSSRSetupState(false);
6840
7127
  return setupResult;
@@ -6871,9 +7158,9 @@ function setupStatefulComponent(instance, isSSR) {
6871
7158
  }
6872
7159
  const { setup } = Component;
6873
7160
  if (setup) {
6874
- pauseTracking();
7161
+ const prevSub = setActiveSub();
6875
7162
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
6876
- const reset = setCurrentInstance(instance);
7163
+ const prev = setCurrentInstance(instance);
6877
7164
  const setupResult = callWithErrorHandling(
6878
7165
  setup,
6879
7166
  instance,
@@ -6884,12 +7171,15 @@ function setupStatefulComponent(instance, isSSR) {
6884
7171
  ]
6885
7172
  );
6886
7173
  const isAsyncSetup = isPromise(setupResult);
6887
- resetTracking();
6888
- reset();
7174
+ setActiveSub(prevSub);
7175
+ setCurrentInstance(...prev);
6889
7176
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
6890
7177
  markAsyncBoundary(instance);
6891
7178
  }
6892
7179
  if (isAsyncSetup) {
7180
+ const unsetCurrentInstance = () => {
7181
+ setCurrentInstance(null, void 0);
7182
+ };
6893
7183
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
6894
7184
  if (isSSR) {
6895
7185
  return setupResult.then((resolvedResult) => {
@@ -6947,13 +7237,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
6947
7237
  instance.render = Component.render || NOOP;
6948
7238
  }
6949
7239
  {
6950
- const reset = setCurrentInstance(instance);
6951
- pauseTracking();
7240
+ const prevInstance = setCurrentInstance(instance);
7241
+ const prevSub = setActiveSub();
6952
7242
  try {
6953
7243
  applyOptions(instance);
6954
7244
  } finally {
6955
- resetTracking();
6956
- reset();
7245
+ setActiveSub(prevSub);
7246
+ setCurrentInstance(...prevInstance);
6957
7247
  }
6958
7248
  }
6959
7249
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -6990,29 +7280,6 @@ function getSlotsProxy(instance) {
6990
7280
  });
6991
7281
  }
6992
7282
  function createSetupContext(instance) {
6993
- const expose = (exposed) => {
6994
- {
6995
- if (instance.exposed) {
6996
- warn$1(`expose() should be called only once per setup().`);
6997
- }
6998
- if (exposed != null) {
6999
- let exposedType = typeof exposed;
7000
- if (exposedType === "object") {
7001
- if (isArray(exposed)) {
7002
- exposedType = "array";
7003
- } else if (isRef(exposed)) {
7004
- exposedType = "ref";
7005
- }
7006
- }
7007
- if (exposedType !== "object") {
7008
- warn$1(
7009
- `expose() should be passed a plain object, received ${exposedType}.`
7010
- );
7011
- }
7012
- }
7013
- }
7014
- instance.exposed = exposed || {};
7015
- };
7016
7283
  {
7017
7284
  let attrsProxy;
7018
7285
  let slotsProxy;
@@ -7026,10 +7293,33 @@ function createSetupContext(instance) {
7026
7293
  get emit() {
7027
7294
  return (event, ...args) => instance.emit(event, ...args);
7028
7295
  },
7029
- expose
7296
+ expose: (exposed) => expose(instance, exposed)
7030
7297
  });
7031
7298
  }
7032
7299
  }
7300
+ function expose(instance, exposed) {
7301
+ {
7302
+ if (instance.exposed) {
7303
+ warn$1(`expose() should be called only once per setup().`);
7304
+ }
7305
+ if (exposed != null) {
7306
+ let exposedType = typeof exposed;
7307
+ if (exposedType === "object") {
7308
+ if (isArray(exposed)) {
7309
+ exposedType = "array";
7310
+ } else if (isRef(exposed)) {
7311
+ exposedType = "ref";
7312
+ }
7313
+ }
7314
+ if (exposedType !== "object") {
7315
+ warn$1(
7316
+ `expose() should be passed a plain object, received ${exposedType}.`
7317
+ );
7318
+ }
7319
+ }
7320
+ }
7321
+ instance.exposed = exposed || {};
7322
+ }
7033
7323
  function getComponentPublicInstance(instance) {
7034
7324
  if (instance.exposed) {
7035
7325
  return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
@@ -7037,7 +7327,9 @@ function getComponentPublicInstance(instance) {
7037
7327
  if (key in target) {
7038
7328
  return target[key];
7039
7329
  } else if (key in publicPropertiesMap) {
7040
- return publicPropertiesMap[key](instance);
7330
+ return publicPropertiesMap[key](
7331
+ instance
7332
+ );
7041
7333
  }
7042
7334
  },
7043
7335
  has(target, key) {
@@ -7080,17 +7372,10 @@ function isClassComponent(value) {
7080
7372
  }
7081
7373
 
7082
7374
  const computed = (getterOrOptions, debugOptions) => {
7083
- const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
7084
- {
7085
- const i = getCurrentInstance();
7086
- if (i && i.appContext.config.warnRecursiveComputed) {
7087
- c._warnRecursive = true;
7088
- }
7089
- }
7090
- return c;
7375
+ return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
7091
7376
  };
7092
7377
 
7093
- const version = "3.5.16";
7378
+ const version = "3.6.0-alpha.1";
7094
7379
  const warn = warn$1 ;
7095
7380
  const _ssrUtils = {
7096
7381
  createComponentInstance: createComponentInstance$1,
@@ -7259,11 +7544,11 @@ function patchStyle(el, prev, next) {
7259
7544
  }
7260
7545
  const semicolonRE = /[^\\];\s*$/;
7261
7546
  const importantRE = /\s*!important$/;
7262
- function setStyle(style, name, val) {
7263
- if (isArray(val)) {
7264
- val.forEach((v) => setStyle(style, name, v));
7547
+ function setStyle(style, name, rawVal) {
7548
+ if (isArray(rawVal)) {
7549
+ rawVal.forEach((v) => setStyle(style, name, v));
7265
7550
  } else {
7266
- if (val == null) val = "";
7551
+ const val = rawVal == null ? "" : String(rawVal);
7267
7552
  {
7268
7553
  if (semicolonRE.test(val)) {
7269
7554
  warn(
@@ -7336,8 +7621,7 @@ function patchDOMProp(el, key, value, parentComponent, attrName) {
7336
7621
  return;
7337
7622
  }
7338
7623
  const tag = el.tagName;
7339
- if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
7340
- !tag.includes("-")) {
7624
+ if (key === "value" && canSetValueDirectly(tag)) {
7341
7625
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
7342
7626
  const newValue = value == null ? (
7343
7627
  // #11647: value should be set as empty string for null and undefined,
@@ -7465,8 +7749,6 @@ function patchStopImmediatePropagation(e, value) {
7465
7749
  }
7466
7750
  }
7467
7751
 
7468
- const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
7469
- key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
7470
7752
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
7471
7753
  const isSVG = namespace === "svg";
7472
7754
  if (key === "class") {
@@ -7506,24 +7788,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
7506
7788
  }
7507
7789
  return false;
7508
7790
  }
7509
- if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
7510
- return false;
7511
- }
7512
- if (key === "form") {
7513
- return false;
7514
- }
7515
- if (key === "list" && el.tagName === "INPUT") {
7516
- return false;
7517
- }
7518
- if (key === "type" && el.tagName === "TEXTAREA") {
7791
+ if (shouldSetAsAttr(el.tagName, key)) {
7519
7792
  return false;
7520
7793
  }
7521
- if (key === "width" || key === "height") {
7522
- const tag = el.tagName;
7523
- if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
7524
- return false;
7525
- }
7526
- }
7527
7794
  if (isNativeOn(key) && isString(value)) {
7528
7795
  return false;
7529
7796
  }
@@ -7711,9 +7978,23 @@ function ssrRenderStyle(raw) {
7711
7978
  if (isString(raw)) {
7712
7979
  return escapeHtml(raw);
7713
7980
  }
7714
- const styles = normalizeStyle(raw);
7981
+ const styles = normalizeStyle(ssrResetCssVars(raw));
7715
7982
  return escapeHtml(stringifyStyle(styles));
7716
7983
  }
7984
+ function ssrResetCssVars(raw) {
7985
+ if (!isArray(raw) && isObject(raw)) {
7986
+ const res = {};
7987
+ for (const key in raw) {
7988
+ if (key.startsWith(":--")) {
7989
+ res[key.slice(1)] = normalizeCssVarValue(raw[key]);
7990
+ } else {
7991
+ res[key] = raw[key];
7992
+ }
7993
+ }
7994
+ return res;
7995
+ }
7996
+ return raw;
7997
+ }
7717
7998
 
7718
7999
  function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
7719
8000
  return renderComponentVNode(